Skip to content

Latest commit

 

History

History
127 lines (115 loc) · 8.75 KB

AGENTS.md

File metadata and controls

127 lines (115 loc) · 8.75 KB

AGENTS.md

This repository hosts community Mini App packages for MiniMax Code. Most tasks add or update one package at plugins/<github-username>/<plugin-id>/; the rest change the checks or the docs (see "Change the checks or the docs").

Add or update a Mini App

  1. New package: copy examples/hello-miniapp/ to plugins/<you>/<plugin-id>/, then replace name, displayName, description, author, exampleQueries, the <title>, the README, and the LICENSE holder. Update: open the existing package, keep its plugin ID, and raise version in plugin.json. A newly declared field or engines.mcode bound that raises the minimum client version (docs/package-contract.md) drops older clients; say so in the README and the PR.
  2. Before editing manifests, miniapp/node/*, miniapp/client/*, or permissions, read the matching document in "Navigation" below.
  3. Write README.md (English; README.zh-CN.md optional): what it does, how to install and open it, and the headings ## Tested environment and ## Data & access (files read/written, network hosts, spawned processes, Agent turns, conversations read, tools and Connectors called, microphone, camera, and notification use, Host navigation read, file extensions handled, where state is stored). When the package uses a feature with a minimum client version (docs/package-contract.md), name a MiniMax Code version at or above it under ## Tested environment.
  4. Add one row to the table in both root READMEs.
  5. Run npm run check. Done when it reports no errors and every warning is either fixed or explained in the PR description.
  6. Open the PR with a short opener: one to three sentences on what changed and why, plus a screenshot when the page looks different. Keep these visible below it: the tested environment and results, what you did not verify, each remaining npm run check warning with its reason, and any new access or higher minimum client version. Put the rest of a long description inside <details><summary>Written by <model></summary> … </details>, with a blank line after </summary>; without it GitHub shows the Markdown inside as plain text. Ask the person you work for to read and edit the opener before you submit.

Hard rules

  • context.dataDir is your private state directory, created and owned by the Host. Store durable state there and treat its location as opaque. Reading Host files has no supported API; a plugin that does so must state in its README which files, how it locates them, and that this relies on unspecified layout.
  • stdout and stdin belong to the Host. Log through context.logger.
  • The Node entry is ESM with a named export start(context). Resolve start only after the listener accepts connections on context.listen. Return { dispose }; dispose closes everything the entry started: server, timers, child processes, streams, file handles, within 2 seconds.
  • While no page is visible, the Host may stop the Node process or reload the page without notice or callback. Write durable state as it changes and save view state on visibilitychange; polling and heartbeats keep nothing alive.
  • Bind only context.listen.host / context.listen.port, with a node:http server (or a framework on top of it); https, http2, tls, raw net, or a child process on that port never becomes ready. Serve surface.path plus your own routes, none under /__mavis/.
  • A Mini App package is a MiniMax Plugin. Skills, subagents (agents), MCP servers, hooks, host bindings, MCP endpoints, and permissions.connector may all be declared; npm run check validates their shape, and the Host validates Connector providers at install time. This repository documents the Mini App payload (fileHandlers included), the page APIs, the Agent/session APIs, and the tool API; treat context.connector provider details and the other plugin capabilities as outside its scope.
  • Declare in permissions (docs/package-contract.md) exactly the grants the code uses, and pair 3.1.20 names with "engines": { "mcode": ">=3.1.20" }. Keep legacy *Access fields and window.mcode.miniapp only when a package intentionally supports clients before 3.1.20; mixing permissions with any legacy *Access field fails with MINIAPP_PERMISSIONS_INVALID, and undeclared calls fail npm run check with ACCESS_UNDECLARED.
  • Hold window.miniapp in another variable name (such as const api = window.miniapp) or use <script type="module">: window.miniapp is a read-only, non-configurable global, so a classic script with a top-level const, let, class, or function named miniapp fails before running (CLIENT_GLOBAL_MINIAPP).
  • permissions.agent: ["run"] gives an Agent with files, shell, and MCP, and permissions.session: ["read"] exposes every user conversation. Show every permission.requested to the user and send allowOnce only after they choose it.
  • The user can switch any declared permission off at any time. Handle PERMISSION_DENIED and browser NotAllowedError where the call is made, explain what can be re-enabled in the plugin settings, and keep the app running; treat NOT_PERMITTED as an author-fixable error. Page promises reject with plain { code, message } objects (docs/client.md).
  • The runtime payload is exactly miniapp/client and miniapp/node. Keep tests and docs outside miniapp/. Vendor third-party code inside the payload; node_modules is never committed.
  • Paths are portable: ASCII, case-distinct, no symlinks, no ... npm run check enforces the full rule set.
  • Secrets stay in the Node process: never in HTML, Client JavaScript, logs, or error responses.
  • Plugin ID = directory name = plugin.json.name, unique across the repository.

Review policy

Maintainers gate on three things: manifests pass npm run check; the README describes real behaviour (files, network, processes, Agent turns, conversations read, tools called, device use, tested environment); the package cannot damage Host or user data. Everything else is a suggestion.

Change the checks or the docs

scripts/ mirrors the MiniMax Code package reader; docs/ publishes the same contract.

  • A minimum in FEATURE_MIN_HOST_VERSION is the first MiniMax Code release that accepts the field and has installers for both macOS and Windows on the production CDN. A tag, a preview build, or a release on one platform only is not evidence: 3.1.5 shipped no installers and 3.1.8 none for Windows. Check that MiniMax%20Code-<version>-arm64.dmg and MiniMax%20Code%20Setup%20<version>-x64.exe (and -arm64.exe; releases before 3.1.15 used MiniMax%20Code%20Setup%20<version>.exe) answer 200 under both https://filecdn.minimax.chat/public/minimax-agent-prod/release/ and https://file.cdn.minimax.io/public/minimax-agent-prod/release/.
  • A feature that ships first in the next release uses NEXT_RELEASE in scripts/lib/contract.mjs. Its PR stays a draft until that release's installers pass the check above.
  • Change scripts/lib/contract.mjs, the rule, its test/<rule>.test.mjs, and the matching docs/ page together, and update the docs' Verified against line. The checker stays dependency-free.
  • CI validates every package under plugins/. A new error must leave existing packages at zero errors; otherwise ship it as a warning first.
  • Keep contract changes in their own PR, apart from package updates.
  • Describe the PR as in step 6 of "Add or update a Mini App": a short opener, what was and was not verified in view, the rest folded.

Navigation

  • docs/package-contract.md — editing any manifest: layout, the three manifests, permissions, fileHandlers, surface.window, switches, minimum client versions, static checks, legacy <3.1.20 compatibility
  • docs/runtime.md — editing miniapp/node/*: start(context), dispose, context namespaces, logger, lifecycle and reclaim, loopback authentication
  • docs/client.md — calling window.miniapp, handling file opens, or using browser permissions: capabilities, getUserMedia / Notification, host.composer.append, speech.transcribe, tool.request, host, files.subscribe, window, { code, message } page errors
  • docs/agent.md — declaring permissions.agent or permissions.session: sessions, agent.* and session.* calls, whenBusy, events, errors
  • docs/tool.md — declaring permissions.tool: context.tool, tool.request, prompts, errors
  • docs/security.md — reading or writing files, spawning processes, making network requests, or handling sensitive data across any capability
  • docs/snippets/audio-capture.ts — microphone capture in the format speech.transcribe takes
  • examples/hello-miniapp/ — the copyable starting point
  • CONTRIBUTING.md — fork, pull request, and license steps for people