export declare const PLUGIN_NAME = "mma"; /** * Key for the bundled MCP server inside `.mcp.json`. * * Claude Code scopes a plugin's server as `:` in the UI and as * `mcp__plugin____` in hook matchers, so naming it `mma` * inside plugin `mma` renders "Plugin:mma:mma MCP Server" and * `mcp__plugin_mma_mma__mma_run`. `daemon` is both shorter and accurate — it is * the local HTTP daemon — giving `mma:daemon`. * * The TOOL names keep their `mma_` prefix: they are also served over the plain * `POST /mcp` endpoint to non-plugin clients, where nothing namespaces them. */ export declare const MCP_SERVER_KEY = "daemon"; /** The packaging formats this emitter produces. */ export declare const PLUGIN_TARGETS: readonly ["claude-code", "agent-plugin"]; export type PluginTarget = typeof PLUGIN_TARGETS[number]; /** * Packaged skill name -> plugin component name. * * Packaged skills carry an `mma-` prefix because a standalone `sync-skills` * install drops them into a FLAT `~/.claude/skills/` shared with every other * tool — there, the prefix IS the namespace. A plugin already namespaces every * component as `/:`, so keeping the prefix would produce * `/mma:mma-audit`. Strip it: the directory name is the invocation name, so * `audit/` yields `/mma:audit`. * * The router skill is packaged as `multi-model-agent` (the product name); as a * plugin component that reads as `/mma:multi-model-agent`, so it becomes * `router` — what it actually is. */ export declare function pluginComponentName(packagedName: string): string; /** * Rewrite cross-skill references in skill prose to the namespaced plugin form: * `mma-investigate` -> `mma:investigate`, and `/mma-flow` -> `/mma:flow` (which * is the real invocation). Only exact packaged skill names are matched, so * unrelated text — `mma serve`, `.mma/plans/`, `mma-parent` — is untouched. * * The frontmatter `name:` field is NOT handled here; it must be the bare * component name and is rewritten separately. The product name * `multi-model-agent` is deliberately never rewritten — it appears throughout * the prose as the project's name, not as a skill reference. */ export declare function rewriteSkillReferences(content: string, packagedNames: readonly string[]): string; /** Emitted at /scripts/mma-mcp-headers.sh and referenced by .mcp.json. * Must print a JSON object of string header pairs on stdout (Claude Code * merges it into the connection headers). Prints `{}` when no token is * available so a stopped daemon surfaces as an auth failure, not a crash. * * `X-MMA-Client` is the only signal telling the daemon this traffic came from an * Agent Plugins install; without it the call records the anonymous `mcp`. The * value is `agent-plugin`, not `claude-code`, because several clients can load * the plugin and none of them owns it. */ export declare const HEADERS_HELPER_SH = "#!/usr/bin/env bash\n# Supplies the MMA bearer token and client attribution to Claude Code as MCP\n# connection headers.\n#\n# Read at CONNECT time, never stored in the plugin: rotating the token file is\n# picked up on the next connection, and Claude Code re-runs this helper\n# automatically if a call returns 401/403.\n#\n# Token resolution order:\n# 1. $MMA_AUTH_TOKEN (env override, matches the daemon's own override)\n# 2. $MMA_TOKEN_FILE (explicit path)\n# 3. ~/.mma/auth-token (default daemon location)\nset -uo pipefail\n\nif [ -n \"${MMA_AUTH_TOKEN:-}\" ]; then\n token=\"$MMA_AUTH_TOKEN\"\nelse\n token_file=\"${MMA_TOKEN_FILE:-$HOME/.mma/auth-token}\"\n if [ -r \"$token_file\" ]; then\n token=\"$(tr -d '\\r\\n' < \"$token_file\")\"\n else\n # No token available \u2014 emit no credential rather than failing the connection,\n # so the user sees an auth error they can act on. The client header carries no\n # secret, so it still goes out.\n printf '{\"X-MMA-Client\":\"agent-plugin\"}\\n'\n exit 0\n fi\nfi\n\n# JSON-escape the token defensively (a real token is base64url, but never\n# hand-build JSON from unvalidated input).\nescaped=$(printf '%s' \"$token\" | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\"/\\\\\"/g')\nprintf '{\"Authorization\":\"Bearer %s\",\"X-MMA-Client\":\"agent-plugin\"}\\n' \"$escaped\"\n"; interface BuildPluginOptions { /** Directory to write the plugin into. Created if missing; skills/, commands/ * and scripts/ inside it are replaced wholesale so stale entries can't survive. */ outDir: string; /** Plugin manifest version — the mma server version it was generated from. */ version: string; /** Daemon port the MCP entry points at. */ port: number; /** Packaging format. Defaults to `claude-code` — the format that predates * this option and the one Claude Code is known to consume, so an existing * caller that never passes a target keeps getting exactly what it got. */ target?: PluginTarget; /** Override the packaged skills root (tests). */ skillsRoot?: string; } interface BuildPluginResult { outDir: string; target: PluginTarget; skills: string[]; commands: string[]; /** The daemon endpoint. Reached directly by the http target and through the * stdio bridge by the AP target, but the same endpoint either way. */ mcpUrl: string; /** How this package reaches {@link mcpUrl}, for display. */ transport: string; } export declare function buildPlugin(opts: BuildPluginOptions): BuildPluginResult; export {}; //# sourceMappingURL=build-plugin.d.ts.map