Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ai-native/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

- title: Plugin and MCP
sections:
- local: chat-plugins
title: Plugins in TensorPlayChat
- local: using-the-plugin
title: Use the MEGA Codex Plugin
- local: mcp-workflows
Expand Down
149 changes: 149 additions & 0 deletions ai-native/chat-plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Plugins in TensorPlayChat

TensorPlayChat can install packages that follow the Codex plugin protocol. A
plugin is a package, not a product-specific integration: its manifest declares
the presentation metadata and points to Skills, MCP servers, Apps, hooks, and
assets included with the package.

Cloudflare and GitHub are the first catalog entries. TensorPlayChat reads both
from the [official OpenAI plugin repository](https://github.com/openai/plugins)
and processes them through the same installer used for developer packages.
There is no Cloudflare- or GitHub-specific plugin schema.

## Package layout

The package root must contain `.codex-plugin/plugin.json`. Components use
paths relative to that root.

```text
my-plugin/
├── .codex-plugin/plugin.json
├── .mcp.json
├── .app.json
├── skills/
│ └── inspect/SKILL.md
├── hooks/
└── assets/
```

The manifest must provide a kebab-case name, semantic version, description,
publisher, and interface metadata. Referenced component and asset paths must
stay inside the package. See the
[Codex plugin build guide](https://developers.openai.com/plugins/build/plugins)
for the upstream field contract.

## Install from the catalog

Open **Chat → Plugins**, choose a package, review its publisher, capabilities,
external service, and data-sharing notice, then select **Install**. Installation
does not silently authorize an external account. Configure each declared MCP
connection separately and keep **Allow actions without asking** off unless the
server and requested action set are trusted.

The first catalog includes:

- Cloudflare, from `openai/plugins/plugins/cloudflare`;
- GitHub, from `openai/plugins/plugins/github`.

The package version, Skill instructions, connection endpoints, icons, and
other metadata come from the repository package rather than TensorPlayChat
source-code branches.

## Create a Skill through Chat

Open the **Skills** tab and select the **+** button. This starts the built-in
Skill Creator mode in the current conversation. Creation is deliberately
conversational rather than a one-shot form:

1. The Agent asks for concrete examples, intended triggers, and boundaries.
2. It proposes a concise Skill name, trigger description, workflow, and any
genuinely reusable scripts, references, or assets.
3. It shows the final draft and asks you to reply **Approve and install** or
**批准并安装** in a later message.
4. After approval, the account tool validates and installs the Skill.

The installer follows the same conventions as the built-in Codex
`skill-creator` and `skill-installer` workflows. It generates only the required
frontmatter fields, adds `agents/openai.yaml` UI metadata, enforces kebab-case
names and package size/path limits, and wraps the result in a normal plugin
package. The resulting source is marked **Created in Chat** and appears in the
same Skills list as Skills installed from catalog, repository, or ZIP packages.

Enabled Skill instructions are applied to Chat automatically; they do not
depend on the remote MCP toggle. Bundled references are loaded on demand when
an enabled Skill requests them and **Plugins** mode is on.
Generated scripts are stored as package resources but are not executed during
creation or by the browser runtime.

## Developer mode

Enable **Developer mode** at the bottom of the Plugins view to reveal
**New plugin**. Developer mode provides three inputs:

- **Repository** resolves a public HTTPS GitHub URL, optional ref, and optional
plugin subdirectory. The installer pins the ref to a commit before reading
package files.
- **Upload ZIP** accepts an archive containing one plugin root. The compressed
limit is 8 MiB, the expanded limit is 24 MiB, and a package may contain at
most 512 files.
- **Server URL** creates a protocol-compatible package around one remote HTTPS
MCP server. Use this for a custom MCP server that does not ship a complete
package yet.

Developer packages are not reviewed. The installer rejects ambiguous roots,
path traversal, private or local server addresses, invalid manifests, missing
referenced assets, oversized component files, and unsupported repository URL
forms. A successful validation does not establish that the package or server
is trustworthy.

## OAuth discovery and registration

For an OAuth-protected remote MCP server, TensorPlayChat performs the standard
MCP authorization sequence:

1. Call the MCP endpoint and read the `resource_metadata` URI from its
`401 Unauthorized` challenge.
2. Fetch OAuth Protected Resource Metadata and pin the advertised resource to
the configured MCP endpoint.
3. Discover OAuth Authorization Server Metadata and validate the issuer and
endpoints.
4. Use a Client ID Metadata Document (CIMD) when the server advertises
`client_id_metadata_document_supported`.
5. Otherwise, use Dynamic Client Registration (DCR) when a
`registration_endpoint` is advertised.
6. Complete Authorization Code with PKCE and an exact resource indicator.

The discovery screen shows the authorization, token, registration, resource,
scope, and optional OpenID Connect metadata before authorization begins. CIMD
client metadata uses a public, opaque TensorPlayChat URL; it contains no
account identifier or credential. DCR client secrets, access tokens, refresh
tokens, and manually supplied bearer tokens are encrypted at rest and never
returned by the settings API. OAuth state is one-time and expires after ten
minutes. See the current
[MCP authorization specification](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization)
for the registration priority and protocol requirements.

## Supported package surfaces

| Surface | TensorPlayChat behavior |
| --- | --- |
| `.codex-plugin/plugin.json` | Validated and used for identity, discovery, consent, and presentation |
| `skills/*/SKILL.md` | Installed, individually switchable, visible with included files, and automatically supplied as bounded Chat guidance; text resources can be loaded on demand while Plugins mode is on |
| Remote HTTP MCP | Discovered and invoked through the bounded Chat tool loop |
| `.app.json` | Parsed and shown as package integration metadata; a connector ID is used only when the corresponding Chat connector is available |
| Hooks and other included files | Preserved and shown with the package; the Web runtime does not launch arbitrary local processes |
| Channels | Not supported |

Local `stdio` MCP processes and arbitrary package executables cannot run in a
browser request. Publish a remote HTTPS MCP endpoint for Web Chat. This is a
runtime boundary, not a different plugin format: the package remains portable
to plugin hosts that provide those local capabilities.

## Permissions and removal

Each plugin and each Skill can be disabled without deleting the package.
Remote tools stay unavailable to the model while **Allow actions without
asking** is off. Disconnecting removes the stored connection credential;
removing the plugin deletes its account installation and OAuth state but does
not delete data at the external service. Revoke the external authorization at
that service as well when access should end completely.
4 changes: 3 additions & 1 deletion ai-native/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ other supported coding agents.

| You want to… | Use… |
| --- | --- |
| Add official or developer plugin packages to Web Chat | [Plugins in TensorPlayChat](/docs/ai-native/chat-plugins) |
| Connect Codex to MEGA and install the bundled workflow guidance | The [MEGA Codex plugin](/docs/ai-native/install) |
| Add only selected, portable MEGA workflow Skills | [MEGA Agent Skills](/docs/ai-native/skills) |

Expand All @@ -29,6 +30,7 @@ You approve access through the normal MEGA authorization flow. Only grant the
permissions needed for the task, and review the target before authorizing a
write or deletion.

Start with [Install the MEGA Codex Plugin](/docs/ai-native/install), then see
For Web Chat, start with [Plugins in TensorPlayChat](/docs/ai-native/chat-plugins).
For Codex, start with [Install the MEGA Codex Plugin](/docs/ai-native/install), then see
[MCP Workflows in Codex](/docs/ai-native/mcp-workflows) and the
[MEGA Skills Catalog](/docs/ai-native/skills-catalog).
9 changes: 5 additions & 4 deletions docs/hub/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ Account-key operations require `account:keys` when called with a fine-grained to

Generate a dedicated Ed25519 key, upload only its public half, and verify the host greeting:

> **The Web/API and SSH hostnames are intentionally different.** Use
> `mega.tensorplay.cn` for the website, API, and HTTPS Git, but use
> `ssh.tensorplay.cn` for SSH Git. Do not substitute one hostname for the other.
> **HTTPS and SSH use different published hostnames.** Use
> `git.tensorplay.cn` directly for HTTPS Git and `ssh.tensorplay.cn` for SSH.
> Existing Git remotes on `mega.tensorplay.cn` remain compatible through a
> streamed fallback; use the dedicated HTTPS host for new clones.

```bash
ssh-keygen -t ed25519 -C "$USER@$(hostname)" -f ~/.ssh/id_ed25519_mega
Expand All @@ -115,7 +116,7 @@ Host ssh.tensorplay.cn
EOF

ssh -T git@ssh.tensorplay.cn
git clone git@ssh.tensorplay.cn:OWNER/REPOSITORY.git
git clone git@ssh.tensorplay.cn:OWNER/REPOSITORY
```

The SSH key authenticates the account; normal repository permissions still decide read or write access. Removing the key immediately prevents new SSH authorization.
Expand Down
10 changes: 6 additions & 4 deletions docs/hub/repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ Repository type is selected at creation and is one of `model`, `dataset`, or `sp

HTTPS works for public clone and bearer-backed credential helpers; SSH is the recommended interactive write transport after registering a public key:

> The domains are different by design: use `mega.tensorplay.cn` for Web/API and
> HTTPS Git, and `ssh.tensorplay.cn` for SSH Git.
> Use `git.tensorplay.cn` directly for HTTPS Git and `ssh.tensorplay.cn` for SSH.
> Existing `mega.tensorplay.cn` Git remotes remain compatible through a streamed
> fallback, but new clones should use the dedicated Git data plane for performance.

```bash
git clone https://mega.tensorplay.cn/mega/qwen-release.git
git clone git@ssh.tensorplay.cn:mega/qwen-release.git
curl -sSfL https://mega.tensorplay.cn/git-xet/install.sh | sh
git clone https://git.tensorplay.cn/mega/qwen-release.git
git clone git@ssh.tensorplay.cn:mega/qwen-release

cd qwen-release
git add .
Expand Down
9 changes: 6 additions & 3 deletions docs/megatensors/guides/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,17 @@ The create command reveals a generated signing secret once. See [Webhooks](/docs

## Git, SSH, and GPG smoke test

MEGA uses different public hosts: Web/API and HTTPS Git use
`mega.tensorplay.cn`, while SSH Git uses `ssh.tensorplay.cn`.
MEGA publishes Web/API URLs on `mega.tensorplay.cn`, HTTPS Git directly on
`git.tensorplay.cn`, and SSH Git on `ssh.tensorplay.cn`. Existing Hub-host Git
remotes continue to work through a streamed compatibility fallback.

```bash
ssh-keygen -t ed25519 -C "$USER@$(hostname)" -f ~/.ssh/id_ed25519_mega
mega auth keys add ~/.ssh/id_ed25519_mega.pub --name workstation
curl -sSfL https://mega.tensorplay.cn/git-xet/install.sh | sh
git clone https://git.tensorplay.cn/OWNER/REPOSITORY.git
ssh -T -i ~/.ssh/id_ed25519_mega git@ssh.tensorplay.cn
git clone git@ssh.tensorplay.cn:OWNER/REPOSITORY.git
git clone git@ssh.tensorplay.cn:OWNER/REPOSITORY
```

Register and exercise a signing key whose email matches the MEGA account:
Expand Down
34 changes: 34 additions & 0 deletions docs/megatensors/package_reference/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,40 @@ The index records shard files and tensor placement:

Runtime APIs resolve the index first, then open only the shards required by the requested tensors.

## Hub repository metadata card

Model repository pages summarize MEGA-native artifacts in a **MegaTensors**
metadata card. The card inspects artifact data at the selected revision; it does
not infer tensor counts or dtypes from the model name.

The inspection entry point is deterministic:

- A release with one `.mega` file inspects that file directly.
- A release with multiple `.mega` shards inspects the first
`.mega.index.json` path in lexical order.
- A multi-shard release without an index remains identifiable as MEGA, but the
page cannot validate aggregate tensor metadata.

The rendered fields use these sources and fallbacks:

| Card field | Artifact source | Fallback |
| --- | --- | --- |
| Model size | `summary.parameter_count` from a directly inspected `.mega` file | A parameter-size token in repository identity or tags; otherwise stored size |
| Tensor type | Dtype counts in the inspected artifact, ordered by tensor count | A precision token in repository identity or tags; otherwise `Mixed` |
| Tensors | `summary.tensor_count` | Hidden when detailed inspection is unavailable |
| Files info | One file for a single artifact, or `summary.shard_count` for an index | Number of selected weight artifacts |
| Verified | Successful bounded artifact inspection | Hidden when inspection has not completed or failed |

Here **Verified** means that the Hub parsed and validated the artifact header or
index contract. It does not assert publisher identity, model quality, or
benchmark correctness. Use [Signing and Trust](/docs/hub/trust) for publisher
provenance and [Model Evaluations](/docs/hub/model-evaluations) for benchmark
evidence.

The card's **Files info** control opens the inspected artifact when there is a
stable file target. Otherwise it opens the selected repository tree so readers
can inspect the release layout themselves.

## Integrity

MEGA stores hashes for payload verification:
Expand Down
2 changes: 1 addition & 1 deletion hub/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ OAuth, SCIM, Git LFS, and OpenAI-compatible inference follow their protocol-spec
| Spaces runtime | `/api/spaces/*` |
| Webhooks | `/api/me/webhooks/*` |
| Papers | `/api/papers/*` |
| Pricing and billing | `/api/pricing`, `/api/billing/*` |
| Billing (authenticated) | `/api/billing/*` |

## Choose a client

Expand Down
11 changes: 6 additions & 5 deletions hub/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ Account-key operations require `account:keys` when called with a fine-grained to

Generate a dedicated Ed25519 key, upload only its public half, and verify the host greeting:

> **The Web/API and SSH hostnames are intentionally different.** Use
> `mega.tensorplay.cn` for the website, API, and HTTPS Git, but use
> `ssh.tensorplay.cn` for SSH Git. Do not substitute one hostname for the other.
> **HTTPS and SSH use different published hostnames.** Use
> `git.tensorplay.cn` directly for HTTPS Git and `ssh.tensorplay.cn` for SSH.
> Existing Git remotes on `mega.tensorplay.cn` remain compatible through a
> streamed fallback; use the dedicated HTTPS host for new clones.

```bash
ssh-keygen -t ed25519 -C "$USER@$(hostname)" -f ~/.ssh/id_ed25519_mega
Expand All @@ -118,7 +119,7 @@ Host ssh.tensorplay.cn
EOF

ssh -T git@ssh.tensorplay.cn
git clone git@ssh.tensorplay.cn:OWNER/REPOSITORY.git
git clone git@ssh.tensorplay.cn:OWNER/REPOSITORY
```

The SSH key authenticates the account; normal repository permissions still decide read or write access. Removing the key immediately prevents new SSH authorization.
Expand All @@ -139,7 +140,7 @@ ssh-keyscan -t ed25519 ssh.tensorplay.cn 2>/dev/null | ssh-keygen -lf -
```

If `ssh -T` cannot connect, use HTTPS Git while the issue is investigated.
Successful HTTPS access on `mega.tensorplay.cn` does not prove SSH reachability
Successful HTTPS access on `git.tensorplay.cn` does not prove SSH reachability
on `ssh.tensorplay.cn`.

## GPG commit verification
Expand Down
35 changes: 35 additions & 0 deletions hub/datasets-data-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,40 @@ The names are your contract: document every split, format, compression method,
field type, and identifier policy in the card. Publish checksums for important
exports and create a new revision when the meaning of an existing split changes.

Dataset Viewer can infer conventional `train`, `validation`, and `test` file
names automatically. For more than one configuration, nonstandard names, or a
custom delimiter, declare the mapping in the dataset card front matter:

```yaml
---
configs:
- config_name: english
default: true
data_dir: data/en
data_files:
- split: train
path:
- train-*.jsonl.gz
- split: validation
path: validation.jsonl.gz
- config_name: french
data_files:
train: data/fr/train.csv
test: data/fr/test.csv
delimiter: ","
encoding: utf-8
---
```

`data_files` accepts a string, a list, split-to-path mappings, path lists, and
repository-relative globs. A `data_dir` is prepended to paths within that
configuration. Keep configuration and split names stable because compatible
Viewer and Parquet URLs include both values.

For image, audio, video, PDF, or WebDataset archives, keep file extensions and
archive member names meaningful. The Viewer preserves semantic media features
and exposes member paths in previews; the original binary data remains in the
derived Parquet representation.

Do not put access tokens, raw credentials, or unreviewed personal data in data
files or examples.
4 changes: 3 additions & 1 deletion hub/datasets-data-studio.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ the Data Studio Agent for a selected configuration and split.

Use Data Studio to answer practical questions about a dataset revision:

- inspect its schema, sample rows, and column statistics in Dataset Viewer;
- inspect paginated rows, search and filter the indexed split, and open a
durable row link in Dataset Viewer;
- use SQL Console for a read-only filter, aggregation, or quality check;
- share or embed SQL and download a result as CSV or Parquet;
- save a useful query for your own later review;
- ask the Data Studio Agent to explain the selected schema, preview values,
data-quality questions, or suggest a SQL query.
Expand Down
14 changes: 10 additions & 4 deletions hub/datasets-sql-console.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ ORDER BY examples DESC
LIMIT 20
```

Queries must be a single `SELECT` statement over the selected `data` view.
The console does not permit writes, file access, or changes to the repository.
Keep result sets focused with `LIMIT`, and use the Viewer to inspect individual
rows and column statistics.
Queries run locally in the browser and must be one read-only
`SELECT` statement or common-table expression over the selected `data` view.
The console does not permit writes, external file readers, or changes to the
repository. Keep result sets focused with `LIMIT`, and use the Viewer to inspect
individual rows and column statistics.

After a query finishes, you can share a URL that restores the SQL, copy an
iframe embed, download the result as CSV or Parquet, or copy an equivalent
`mega datasets sql` command. These exports contain the returned result rows;
they do not alter the dataset revision.

## Save a personal query

Expand Down
Loading