@ken-jo/agent-connector 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -20
- package/dist/action-PLZW5BGX.js +54 -0
- package/dist/action-PLZW5BGX.js.map +1 -0
- package/dist/{amp-YGV66GJT.js → amp-B524U6LO.js} +81 -5
- package/dist/amp-B524U6LO.js.map +1 -0
- package/dist/{antigravity-7IBYFO6P.js → antigravity-ANDKF3K7.js} +4 -4
- package/dist/{antigravity-cli-JEOUP2VN.js → antigravity-cli-LLRPDDOT.js} +4 -4
- package/dist/chunk-22Y24V7O.js +21 -0
- package/dist/chunk-22Y24V7O.js.map +1 -0
- package/dist/chunk-3PFFTFCU.js +190 -0
- package/dist/chunk-3PFFTFCU.js.map +1 -0
- package/dist/{chunk-SCVBYSF7.js → chunk-6XHB6BE3.js} +1 -1
- package/dist/chunk-76FUSVIA.js +43 -0
- package/dist/chunk-76FUSVIA.js.map +1 -0
- package/dist/{chunk-GSGDG2BV.js → chunk-ADTHT2FN.js} +109 -16
- package/dist/chunk-ADTHT2FN.js.map +1 -0
- package/dist/{chunk-ZAM4M7LI.js → chunk-BHUCB6LY.js} +135 -296
- package/dist/chunk-BHUCB6LY.js.map +1 -0
- package/dist/{chunk-MEH7GC7R.js → chunk-BXGFUENQ.js} +20 -3
- package/dist/chunk-BXGFUENQ.js.map +1 -0
- package/dist/chunk-CIRDOY2V.js +351 -0
- package/dist/chunk-CIRDOY2V.js.map +1 -0
- package/dist/{chunk-QADSG2JY.js → chunk-G3ER4SY5.js} +1152 -106
- package/dist/chunk-G3ER4SY5.js.map +1 -0
- package/dist/{chunk-44HUXXC6.js → chunk-G5CQHVQG.js} +232 -5
- package/dist/chunk-G5CQHVQG.js.map +1 -0
- package/dist/{chunk-PD4VFEBY.js → chunk-IW77FFNX.js} +39 -1
- package/dist/chunk-IW77FFNX.js.map +1 -0
- package/dist/chunk-J3D5W5T2.js +83 -0
- package/dist/chunk-J3D5W5T2.js.map +1 -0
- package/dist/{openclaw-UZ5BMCGQ.js → chunk-KGGBNKI4.js} +125 -33
- package/dist/chunk-KGGBNKI4.js.map +1 -0
- package/dist/{chunk-3JCRUROU.js → chunk-KGJWE6A2.js} +13 -4
- package/dist/chunk-KGJWE6A2.js.map +1 -0
- package/dist/{chunk-DS3LUFVN.js → chunk-KGXDYGNJ.js} +26 -16
- package/dist/chunk-KGXDYGNJ.js.map +1 -0
- package/dist/{chunk-KVAAFYRR.js → chunk-KHO5WNTP.js} +2 -18
- package/dist/chunk-KHO5WNTP.js.map +1 -0
- package/dist/{chunk-KQSNDFBN.js → chunk-LL4OBGRU.js} +3 -3
- package/dist/{chunk-WNREHWKL.js → chunk-MAH6QQTO.js} +3 -3
- package/dist/{claude-code-4275HQU4.js → claude-code-MLWS7CW6.js} +180 -28
- package/dist/claude-code-MLWS7CW6.js.map +1 -0
- package/dist/cli/sdk.js +4 -3
- package/dist/cli/sdk.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/{codebuff-LE3KBZGM.js → codebuff-SH2S3QAN.js} +102 -5
- package/dist/codebuff-SH2S3QAN.js.map +1 -0
- package/dist/{codex-4BY2ZJIW.js → codex-BXA4FIF4.js} +3 -3
- package/dist/{copilot-cli-IPISKO3V.js → copilot-cli-ROIBTTDT.js} +3 -3
- package/dist/{crush-X3E25EQG.js → crush-QLEFLHUC.js} +3 -3
- package/dist/{cursor-UH3W622V.js → cursor-ASJPWZ4R.js} +6 -3
- package/dist/cursor-ASJPWZ4R.js.map +1 -0
- package/dist/{detect-MNDHGLSV.js → detect-ZIIS55LD.js} +4 -3
- package/dist/{detect-MNDHGLSV.js.map → detect-ZIIS55LD.js.map} +1 -1
- package/dist/{doctor-N5KZDD55.js → doctor-TJUGSQ5C.js} +17 -13
- package/dist/doctor-TJUGSQ5C.js.map +1 -0
- package/dist/{droid-T5VBRXZF.js → droid-NCSS3B5Y.js} +170 -4
- package/dist/droid-NCSS3B5Y.js.map +1 -0
- package/dist/{gemini-cli-ZSUK55UA.js → gemini-cli-SLVWLXJW.js} +3 -3
- package/dist/{goose-M3RR3CZG.js → goose-PBA7KTE5.js} +100 -5
- package/dist/goose-PBA7KTE5.js.map +1 -0
- package/dist/{hermes-CUNKIAR5.js → hermes-ONDCECP2.js} +3 -3
- package/dist/{hook-7LUOKIXH.js → hook-OU522ABV.js} +12 -9
- package/dist/{hook-7LUOKIXH.js.map → hook-OU522ABV.js.map} +1 -1
- package/dist/index.d.ts +71 -3
- package/dist/index.js +22 -3
- package/dist/{install-TQTT4F3I.js → install-UDCBL7HP.js} +12 -10
- package/dist/{install-TQTT4F3I.js.map → install-UDCBL7HP.js.map} +1 -1
- package/dist/introspect-DuZSPSHB.d.ts +53 -0
- package/dist/{jetbrains-copilot-C3HDGGML.js → jetbrains-copilot-YABZ3HFA.js} +3 -3
- package/dist/{kilo-PKAJCWPX.js → kilo-F3ZDZKCT.js} +3 -3
- package/dist/{kilo-cli-QWUVXG2O.js → kilo-cli-3HWPWBY4.js} +3 -3
- package/dist/{kimi-EVD7YKXS.js → kimi-NV72FVAO.js} +3 -3
- package/dist/{kiro-UQRY6EIO.js → kiro-C5W6AGDR.js} +3 -3
- package/dist/{leaderboard-MUJ7DURM.js → leaderboard-TIBVONVT.js} +3 -3
- package/dist/mimo-code-IMM5YM3M.js +754 -0
- package/dist/mimo-code-IMM5YM3M.js.map +1 -0
- package/dist/{mux-5CI5FP2W.js → mux-DSSH4AFS.js} +3 -3
- package/dist/nemoclaw-3EVNKD3I.js +58 -0
- package/dist/nemoclaw-3EVNKD3I.js.map +1 -0
- package/dist/{omp-AXA7XY22.js → omp-Z6FRNDPN.js} +3 -3
- package/dist/openclaw-7G437NT7.js +18 -0
- package/dist/openclaw-7G437NT7.js.map +1 -0
- package/dist/{opencode-NZBRLJN3.js → opencode-Q6KBSAKW.js} +3 -3
- package/dist/{package-SYPA5POO.js → package-RMPN57YZ.js} +7 -6
- package/dist/{package-SYPA5POO.js.map → package-RMPN57YZ.js.map} +1 -1
- package/dist/{pi-WMTUX6ES.js → pi-LZT6WWAZ.js} +2 -2
- package/dist/{qwen-code-MRRIUQ3P.js → qwen-code-WQBKRPWJ.js} +3 -3
- package/dist/{roo-code-NI5UU6JB.js → roo-code-GWSNU3OW.js} +137 -4
- package/dist/roo-code-GWSNU3OW.js.map +1 -0
- package/dist/runtime/index.d.ts +96 -2
- package/dist/runtime/index.js +18 -10
- package/dist/sdk/index.d.ts +52 -0
- package/dist/sdk/index.js +81 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/test.d.ts +74 -0
- package/dist/sdk/test.js +291 -0
- package/dist/sdk/test.js.map +1 -0
- package/dist/{serve-XJOSA7BY.js → serve-D3GO36UT.js} +12 -9
- package/dist/{serve-XJOSA7BY.js.map → serve-D3GO36UT.js.map} +1 -1
- package/dist/{status-DYSS6BOR.js → status-KOSKCETC.js} +10 -8
- package/dist/{status-DYSS6BOR.js.map → status-KOSKCETC.js.map} +1 -1
- package/dist/statusline-ZNTCL5YC.js +59 -0
- package/dist/statusline-ZNTCL5YC.js.map +1 -0
- package/dist/{telemetry-IJ4GP2Q3.js → telemetry-XIKUUGTQ.js} +5 -4
- package/dist/{telemetry-IJ4GP2Q3.js.map → telemetry-XIKUUGTQ.js.map} +1 -1
- package/dist/{trae-CQC72RHH.js → trae-NWT3TMSZ.js} +99 -5
- package/dist/trae-NWT3TMSZ.js.map +1 -0
- package/dist/{types-CNigfEuR.d.ts → types-BEKsAium.d.ts} +268 -6
- package/dist/{uninstall-3DXIBRCV.js → uninstall-2LBLQVFA.js} +12 -10
- package/dist/{uninstall-3DXIBRCV.js.map → uninstall-2LBLQVFA.js.map} +1 -1
- package/dist/{upgrade-GJEB3ITY.js → upgrade-ZC2S7VRN.js} +12 -10
- package/dist/{upgrade-GJEB3ITY.js.map → upgrade-ZC2S7VRN.js.map} +1 -1
- package/dist/{usage-2BJLM3GJ.js → usage-E2A4O2CY.js} +3 -3
- package/dist/{usage-event-472X3DOY.js → usage-event-JKMC4QC4.js} +11 -8
- package/dist/{usage-event-472X3DOY.js.map → usage-event-JKMC4QC4.js.map} +1 -1
- package/dist/{vscode-copilot-4RVRTCKV.js → vscode-copilot-ALV45XF6.js} +3 -3
- package/dist/{warp-X6MB67NT.js → warp-H6IX4U3J.js} +3 -3
- package/dist/{zed-NTCYW4V2.js → zed-RH34TNSW.js} +3 -3
- package/package.json +9 -1
- package/dist/amp-YGV66GJT.js.map +0 -1
- package/dist/chunk-3JCRUROU.js.map +0 -1
- package/dist/chunk-44HUXXC6.js.map +0 -1
- package/dist/chunk-DS3LUFVN.js.map +0 -1
- package/dist/chunk-GSGDG2BV.js.map +0 -1
- package/dist/chunk-KVAAFYRR.js.map +0 -1
- package/dist/chunk-MEH7GC7R.js.map +0 -1
- package/dist/chunk-NJU275US.js +0 -238
- package/dist/chunk-NJU275US.js.map +0 -1
- package/dist/chunk-PD4VFEBY.js.map +0 -1
- package/dist/chunk-QADSG2JY.js.map +0 -1
- package/dist/chunk-ZAM4M7LI.js.map +0 -1
- package/dist/claude-code-4275HQU4.js.map +0 -1
- package/dist/codebuff-LE3KBZGM.js.map +0 -1
- package/dist/cursor-UH3W622V.js.map +0 -1
- package/dist/doctor-N5KZDD55.js.map +0 -1
- package/dist/droid-T5VBRXZF.js.map +0 -1
- package/dist/goose-M3RR3CZG.js.map +0 -1
- package/dist/openclaw-UZ5BMCGQ.js.map +0 -1
- package/dist/roo-code-NI5UU6JB.js.map +0 -1
- package/dist/trae-CQC72RHH.js.map +0 -1
- /package/dist/{antigravity-7IBYFO6P.js.map → antigravity-ANDKF3K7.js.map} +0 -0
- /package/dist/{antigravity-cli-JEOUP2VN.js.map → antigravity-cli-LLRPDDOT.js.map} +0 -0
- /package/dist/{chunk-SCVBYSF7.js.map → chunk-6XHB6BE3.js.map} +0 -0
- /package/dist/{chunk-KQSNDFBN.js.map → chunk-LL4OBGRU.js.map} +0 -0
- /package/dist/{chunk-WNREHWKL.js.map → chunk-MAH6QQTO.js.map} +0 -0
- /package/dist/{codex-4BY2ZJIW.js.map → codex-BXA4FIF4.js.map} +0 -0
- /package/dist/{copilot-cli-IPISKO3V.js.map → copilot-cli-ROIBTTDT.js.map} +0 -0
- /package/dist/{crush-X3E25EQG.js.map → crush-QLEFLHUC.js.map} +0 -0
- /package/dist/{gemini-cli-ZSUK55UA.js.map → gemini-cli-SLVWLXJW.js.map} +0 -0
- /package/dist/{hermes-CUNKIAR5.js.map → hermes-ONDCECP2.js.map} +0 -0
- /package/dist/{jetbrains-copilot-C3HDGGML.js.map → jetbrains-copilot-YABZ3HFA.js.map} +0 -0
- /package/dist/{kilo-PKAJCWPX.js.map → kilo-F3ZDZKCT.js.map} +0 -0
- /package/dist/{kilo-cli-QWUVXG2O.js.map → kilo-cli-3HWPWBY4.js.map} +0 -0
- /package/dist/{kimi-EVD7YKXS.js.map → kimi-NV72FVAO.js.map} +0 -0
- /package/dist/{kiro-UQRY6EIO.js.map → kiro-C5W6AGDR.js.map} +0 -0
- /package/dist/{leaderboard-MUJ7DURM.js.map → leaderboard-TIBVONVT.js.map} +0 -0
- /package/dist/{mux-5CI5FP2W.js.map → mux-DSSH4AFS.js.map} +0 -0
- /package/dist/{omp-AXA7XY22.js.map → omp-Z6FRNDPN.js.map} +0 -0
- /package/dist/{opencode-NZBRLJN3.js.map → opencode-Q6KBSAKW.js.map} +0 -0
- /package/dist/{pi-WMTUX6ES.js.map → pi-LZT6WWAZ.js.map} +0 -0
- /package/dist/{qwen-code-MRRIUQ3P.js.map → qwen-code-WQBKRPWJ.js.map} +0 -0
- /package/dist/{usage-2BJLM3GJ.js.map → usage-E2A4O2CY.js.map} +0 -0
- /package/dist/{vscode-copilot-4RVRTCKV.js.map → vscode-copilot-ALV45XF6.js.map} +0 -0
- /package/dist/{warp-X6MB67NT.js.map → warp-H6IX4U3J.js.map} +0 -0
- /package/dist/{zed-NTCYW4V2.js.map → zed-RH34TNSW.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/roo-code/index.ts"],"sourcesContent":["/**\n * adapters/roo-code — Roo Code (VS Code extension) platform adapter.\n *\n * Roo Code (rooveterinaryinc.roo-cline) is a Cline-fork VS Code extension and an\n * **mcp-only** host from agent-connector's perspective: it exposes no lifecycle\n * hook system, so MCP server registration is the only thing we install and hooks\n * are reported unavailable. This mirrors the Warp reference adapter exactly.\n *\n * MCP config (vsix 3.54.0):\n * - user scope → <vscodeUserDir>/globalStorage/rooveterinaryinc.roo-cline/\n * settings/mcp_settings.json (renamed in 3.54.0 from the\n * older `cline_mcp_settings.json`; we PROBE both on detection\n * — the extension migrates the old name at startup — and\n * WRITE the new `mcp_settings.json`)\n * - project scope → <projectDir>/.roo/mcp.json\n * Both are JSON, root key \"mcpServers\".\n *\n * VS Code user-dir resolution (cross-OS):\n * - macOS → ~/Library/Application Support/Code/User\n * - Linux → ~/.config/Code/User\n * - Windows → %APPDATA%/Code/User (falls back to ~/AppData/Roaming/Code/User)\n * We deliberately target stable VS Code (\"Code\"), the documented home for the\n * published Roo Code extension's globalStorage. Insiders/forks would live under\n * a sibling dir but are out of scope for the default path.\n *\n * Env interpolation: Roo Code's settings file documents no native `${env:VAR}`\n * token (the entries are plain command/args/env literals), so we resolve every\n * `${env:VAR}` reference to a literal at install time — the no-native-token path.\n *\n * The hook \"config path\" is the SAME MCP settings file (there is no hook file),\n * so the generic doctor/backup behave sensibly.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir, platform as osPlatform } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, InstallContext, MemoryTarget } from \"../spi.js\";\nimport type {\n ChangeRecord,\n CommandDef,\n DetectedPlatform,\n HealthCheck,\n HookParadigm,\n PlatformCapabilities,\n PlatformId,\n ServerDef,\n SkillDef,\n Transport,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildServeWrapperCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"roo-code\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/** Roo Code extension id → its VS Code globalStorage folder. */\nconst ROO_EXTENSION_ID = \"rooveterinaryinc.roo-cline\";\n/** User-scope MCP settings filename — renamed in vsix 3.54.0. */\nconst MCP_SETTINGS_FILE = \"mcp_settings.json\";\n/** Legacy filename (pre-3.54.0) — probed on detection for older installs. */\nconst LEGACY_MCP_SETTINGS_FILE = \"cline_mcp_settings.json\";\n\n/**\n * Native MCP server entry shapes Roo Code accepts under `mcpServers`.\n * We write the minimal stdio shape { command, args, env, disabled }; Roo Code\n * also accepts optional `alwaysAllow` / `timeout`, which we intentionally omit.\n */\ninterface RooStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n disabled: boolean;\n}\ninterface RooHttpServer {\n url: string;\n headers?: Record<string, string>;\n disabled: boolean;\n}\n\n/**\n * Resolve the cross-OS VS Code per-user data directory (the \"User\" folder that\n * contains `globalStorage`). See module header for the per-platform mapping.\n */\nfunction vscodeUserDir(): string {\n const home = homedir();\n switch (osPlatform()) {\n case \"darwin\":\n return join(home, \"Library\", \"Application Support\", \"Code\", \"User\");\n case \"win32\": {\n const appData =\n process.env.APPDATA ?? join(home, \"AppData\", \"Roaming\");\n return join(appData, \"Code\", \"User\");\n }\n default:\n // Linux / other POSIX: XDG-style config dir.\n return join(home, \".config\", \"Code\", \"User\");\n }\n}\n\nexport class RooCodeAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Roo Code\";\n readonly paradigm: HookParadigm = \"mcp-only\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block (project <projectDir>/AGENTS.md\n // via the base default — Roo's \"Agent Rules standard\" support is default-on;\n // user scope → ~/.roo/rules/agent-connector.md below).\n supportsMemory: true,\n // Roo Code has no lifecycle hook system — every hook capability is false.\n preToolUse: false,\n postToolUse: false,\n preCompact: false,\n sessionStart: false,\n sessionEnd: false,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: false,\n // Roo Code registers stdio, SSE, and Streamable HTTP MCP servers.\n transports: [\"stdio\", \"sse\", \"http\"],\n // Content surfaces: Roo Code reads custom slash commands and AgentSkills from\n // its `.roo` config dir (BOTH user ~/.roo and project <projectDir>/.roo).\n // command → <configDir>/commands/<name>.md (md+optional frontmatter)\n // skill → <configDir>/skills/<name>/SKILL.md (+ resources)\n supportsCommands: true,\n supportsSkills: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userSettings = this.userSettingsPath();\n const userExtDir = join(\n vscodeUserDir(),\n \"globalStorage\",\n ROO_EXTENSION_ID,\n );\n // Probe the legacy filename too (3.54.0 migrates it at startup) so an older\n // install is still recognized; we WRITE the new mcp_settings.json.\n const userLegacySettings = join(\n userExtDir,\n \"settings\",\n LEGACY_MCP_SETTINGS_FILE,\n );\n const projectMcp = join(projectDir, \".roo\", \"mcp.json\");\n\n const userMatch =\n existsSync(userSettings) ||\n existsSync(userLegacySettings) ||\n existsSync(userExtDir);\n const projectMatch = existsSync(projectMcp);\n const installed = userMatch || projectMatch;\n\n // Prefer the user scope/path when present; otherwise surface the project one.\n const scope = userMatch || !projectMatch ? \"user\" : \"project\";\n const configPath = scope === \"user\" ? userSettings : projectMcp;\n const reason = installed\n ? userMatch\n ? `found Roo Code globalStorage under ${userExtDir}`\n : `found Roo Code project config at ${projectMcp}`\n : `no Roo Code config at ${userExtDir} or ${projectMcp}`;\n\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope,\n reason,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /** Absolute path to the user-scope MCP settings file (VS Code globalStorage). */\n private userSettingsPath(): string {\n return join(\n vscodeUserDir(),\n \"globalStorage\",\n ROO_EXTENSION_ID,\n \"settings\",\n MCP_SETTINGS_FILE,\n );\n }\n\n // ── Memory surface: global rules dir at user scope ──────────────────────\n // Project scope stays on the AGENTS.md base default (\"Agent Rules standard\",\n // default-on). User scope targets a dedicated agent-connector.md in Roo's\n // documented ~/.roo/rules/ dir (files concatenated; AC-created → cleanly\n // deletable on uninstall).\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n if (this.memoryOverride(ctx)?.path || ctx.scope !== \"user\") {\n return super.memoryTargets(ctx);\n }\n return [\n {\n path: join(homedir(), \".roo\", \"rules\", \"agent-connector.md\"),\n reason: \"roo-code global rules dir (~/.roo/rules; agent-connector-owned file)\",\n },\n ];\n }\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".roo\")\n : join(\n vscodeUserDir(),\n \"globalStorage\",\n ROO_EXTENSION_ID,\n \"settings\",\n );\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".roo\", \"mcp.json\")\n : this.userSettingsPath();\n }\n\n /**\n * Roo Code has no hook file — hooks are not a thing here. The hook \"config\n * path\" is the same MCP settings file so the generic doctor/backup behave\n * sensibly.\n */\n getHookConfigPath(ctx: InstallContext): string {\n return this.getServerConfigPath(ctx);\n }\n\n // ── MCP server install / uninstall ───────────────────────────────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST]?.server;\n if (!connector.server || override === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: connector.server\n ? \"server registration disabled for roo-code\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n // Shallow-merge any per-platform server override into the base ServerDef.\n const server: ServerDef =\n override && typeof override === \"object\"\n ? { ...connector.server, ...override }\n : connector.server;\n\n const serverPath = this.getServerConfigPath(ctx);\n const entry = this.renderServerEntry(ctx, server);\n\n return [\n this.upsertServerInJson(serverPath, MCP_ROOT_KEY, connector.id, entry, ctx.dryRun),\n ];\n }\n\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const serverPath = this.getServerConfigPath(ctx);\n return [\n this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /** Render a normalized ServerDef into Roo Code's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): RooStdioServer | RooHttpServer {\n const transport: Transport = server.transport;\n\n if (transport === \"stdio\") {\n let command = server.command ?? \"\";\n let args = [...(server.args ?? [])];\n\n // Transparent telemetry wrapping: route the real command through\n // `<homeBin> serve --connector <id> -- <command> <args...>`.\n if (shouldWrapForTelemetry(server, ctx.connector.telemetry)) {\n const wrapped = buildServeWrapperCommand(\n ctx.homeBinPath,\n ctx.connector.id,\n command,\n args,\n ctx.scope,\n this.id,\n );\n command = wrapped.command;\n args = wrapped.args;\n }\n\n // Roo Code documents no native interpolation token, so resolve every\n // ${env:VAR} to a literal at install time.\n const entry: RooStdioServer = {\n command: resolveEnvRefsDeep(command),\n // Honor the per-call server's enabled flag (mirror droid) rather than\n // hardcoding enabled — a server marked enabled:false installs disabled.\n disabled: server.enabled === false,\n };\n if (args.length > 0) entry.args = resolveEnvRefsDeep(args);\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n return entry;\n }\n\n // sse / http (and any other remote transport) — Roo Code registers a URL.\n const entry: RooHttpServer = {\n url: resolveEnvRefsDeep(server.url ?? \"\"),\n disabled: server.enabled === false,\n };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. Roo Code documents no native interpolation token,\n * so resolve `${env:VAR}` references to literals at install time.\n */\n private renderEnv(\n env: Record<string, string> | undefined,\n ): Record<string, string> | undefined {\n if (!env || Object.keys(env).length === 0) return undefined;\n return resolveEnvRefsDeep({ ...env });\n }\n\n // ── Hooks (unavailable — Roo Code is mcp-only) ───────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Roo Code is mcp-only)\",\n },\n ];\n }\n\n uninstallHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Roo Code is mcp-only)\",\n },\n ];\n }\n\n // ── Content surfaces: commands / skills ──────────────────────────────────\n // CONTENT-ONLY: pure native-file writers. No runtime dispatch, no home-bin\n // pointer, no telemetry wrap. Each method is idempotent (byte-identical →\n // skip) via writeContentFile and reversible via removeContentFile. Honors\n // platforms[\"roo-code\"] per-surface false to skip. BOTH scopes are supported:\n // user → ~/.roo, project → <projectDir>/.roo.\n //\n // Native locations (the `.roo` content root, NOT the globalStorage MCP dir):\n // command → <rooDir>/commands/<name>.md md+optional frontmatter\n // (description, argument-hint, + `mode` when cmd.extra carries it)\n // skill → <rooDir>/skills/<name>/SKILL.md (+ resources)\n\n /**\n * The `.roo` content root for the active scope: ~/.roo (user) or\n * <projectDir>/.roo (project). Distinct from getConfigDir's user-scope path\n * (the VS Code globalStorage `settings` dir, which holds MCP settings only).\n */\n private rooDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".roo\")\n : join(homedir(), \".roo\");\n }\n private commandPath(ctx: InstallContext, name: string): string {\n return join(this.rooDir(ctx), \"commands\", `${name}.md`);\n }\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.rooDir(ctx), \"skills\", name);\n }\n\n // ── Commands ─────────────────────────────────────────────────────────────\n\n override installCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[this.id]?.commands === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"commands disabled for roo-code\" }];\n }\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.writeContentFile(this.commandPath(ctx, cmd.name), this.renderCommand(cmd), ctx.dryRun),\n );\n }\n\n override uninstallCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.removeContentFile(this.commandPath(ctx, cmd.name), ctx.dryRun),\n );\n }\n\n /**\n * Render a command to md+optional frontmatter (description, argument-hint).\n * Roo Code additionally honors a `mode` frontmatter key; it is passed through\n * only when cmd.extra carries it (the escape-hatch Object.assign below) — the\n * standard description/argument-hint shape otherwise.\n */\n private renderCommand(cmd: CommandDef): string {\n const frontmatter: Record<string, unknown> = {};\n if (cmd.description !== undefined) frontmatter.description = cmd.description;\n if (cmd.argumentHint !== undefined) frontmatter[\"argument-hint\"] = cmd.argumentHint;\n if (cmd.extra) Object.assign(frontmatter, cmd.extra);\n return this.renderFrontmatterMd(frontmatter, cmd.prompt);\n }\n\n // ── Skills ───────────────────────────────────────────────────────────────\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[this.id]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for roo-code\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), this.renderSkill(skill), ctx.dryRun),\n );\n // Bundle any resource files beside SKILL.md (relative path → contents).\n // Defense-in-depth: skip+warn on any key that escapes the skill dir\n // (config-time validation already rejects these, but never trust input).\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n // Remove only the files we wrote (SKILL.md + declared resources), then the\n // skill dir itself when we own its full contents.\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue; // never delete outside the skill dir\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n // Only remove the skill dir when WE own its full contents — never rm -rf a\n // dir that still holds user-added / sibling-tool / shared files.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n /**\n * Render a skill's SKILL.md: frontmatter (name, description + optional model,\n * allowed-tools, disable-model-invocation) + body. UNIFORM with every other\n * skill-supporting platform — only the parent dir differs.\n */\n private renderSkill(skill: SkillDef): string {\n const frontmatter: Record<string, unknown> = {\n name: skill.name,\n description: skill.description,\n };\n if (skill.model !== undefined) frontmatter.model = skill.model;\n const allow = skill.tools?.allow;\n if (allow && allow.length > 0) frontmatter[\"allowed-tools\"] = allow.join(\", \");\n if (skill.disableModelInvocation !== undefined) {\n frontmatter[\"disable-model-invocation\"] = skill.disableModelInvocation;\n }\n if (skill.extra) Object.assign(frontmatter, skill.extra);\n return this.renderFrontmatterMd(frontmatter, skill.body);\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n return [\n {\n name: `${this.name}: MCP settings present`,\n check: () =>\n existsSync(mcpPath)\n ? { status: \"OK\", detail: mcpPath }\n : { status: \"FAIL\", detail: `not found: ${mcpPath}` },\n },\n {\n name: `${this.name}: server entry registered`,\n check: () => {\n // Only assert what the connector declares: a server-less connector —\n // e.g. a catalog-only bundle of agents/skills/commands — never writes\n // an mcpServers entry, so its absence is healthy.\n if (!ctx.connector.server) {\n return { status: \"OK\", detail: \"no MCP server declared\" };\n }\n const cfg = this.readJson<{ [k: string]: Record<string, unknown> }>(mcpPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };\n }\n return connectorId in bucket\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}.${connectorId} present` }\n : {\n status: \"FAIL\",\n detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}`,\n };\n },\n },\n ];\n }\n}\n\nexport const adapter = new RooCodeAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,SAAS,kBAAkB;AAC3B,SAAS,SAAS,YAAY,kBAAkB;AAChD,SAAS,YAAY;AAsBrB,IAAM,OAAmB;AACzB,IAAM,eAAe;AAGrB,IAAM,mBAAmB;AAEzB,IAAM,oBAAoB;AAE1B,IAAM,2BAA2B;AAuBjC,SAAS,gBAAwB;AAC/B,QAAM,OAAO,QAAQ;AACrB,UAAQ,WAAW,GAAG;AAAA,IACpB,KAAK;AACH,aAAO,KAAK,MAAM,WAAW,uBAAuB,QAAQ,MAAM;AAAA,IACpE,KAAK,SAAS;AACZ,YAAM,UACJ,QAAQ,IAAI,WAAW,KAAK,MAAM,WAAW,SAAS;AACxD,aAAO,KAAK,SAAS,QAAQ,MAAM;AAAA,IACrC;AAAA,IACA;AAEE,aAAO,KAAK,MAAM,WAAW,QAAQ,MAAM;AAAA,EAC/C;AACF;AAEO,IAAM,iBAAN,cAA6B,YAA+B;AAAA,EACxD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA;AAAA,IAI5C,gBAAgB;AAAA;AAA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-BEKsAium.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* runtime/hook-entrypoint — the universal json-stdio hook dispatcher.
|
|
@@ -188,4 +188,98 @@ interface RunUsageEventResult {
|
|
|
188
188
|
*/
|
|
189
189
|
declare function runUsageEvent(opts: RunUsageEventOptions): Promise<RunUsageEventResult>;
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
/**
|
|
192
|
+
* runtime/statusline-entrypoint — the universal statusline (HUD) renderer.
|
|
193
|
+
*
|
|
194
|
+
* A statusline-supporting host points its status line config at the single stable
|
|
195
|
+
* home binary (`<homeBin> statusline <platformId> --connector <id>`, built by
|
|
196
|
+
* core/spawn.buildHomeBinStatuslineCommand). The CLI reads stdin and calls
|
|
197
|
+
* {@link runStatusline} with the parsed flags + the raw stdin string. This module:
|
|
198
|
+
*
|
|
199
|
+
* 1. Loads the registered connector (live render handler) and the host adapter.
|
|
200
|
+
* 2. Parses the host's raw status payload into a normalized StatuslineContext.
|
|
201
|
+
* 3. Calls the connector's render(ctx) and coerces the result to a string.
|
|
202
|
+
* 4. Formats the line into the host's native status reply (exit code + stdout).
|
|
203
|
+
*
|
|
204
|
+
* FAIL-SAFE is the contract (NOT fail-open with carve-outs like hooks): a status
|
|
205
|
+
* line is decorative — it must NEVER wedge the host or spew an error/stack trace
|
|
206
|
+
* into the status bar. So ANY error path — bad payload, missing connector,
|
|
207
|
+
* throwing render, adapter without statusline support — returns exit 0 with NO
|
|
208
|
+
* stdout (an empty status line), never a non-zero exit and never partial output.
|
|
209
|
+
*
|
|
210
|
+
* NOTE (follow-up): no telemetry is recorded for statusline renders in v1 (out of
|
|
211
|
+
* scope). When added, it MUST stay inside the same fail-safe envelope.
|
|
212
|
+
*/
|
|
213
|
+
/** Flags + stdin the CLI hands to {@link runStatusline}. */
|
|
214
|
+
interface RunStatuslineOptions {
|
|
215
|
+
/** Host platform id from the command (`statusline <platformId> …`). */
|
|
216
|
+
platformId: string;
|
|
217
|
+
/** Connector id from `--connector <id>`. */
|
|
218
|
+
connectorId: string;
|
|
219
|
+
/** Raw stdin payload (host-native status JSON). Empty string is tolerated → `{}`. */
|
|
220
|
+
stdin: string;
|
|
221
|
+
}
|
|
222
|
+
/** Process-level result the CLI translates into exit code + stdout/stderr. */
|
|
223
|
+
interface RunStatuslineResult {
|
|
224
|
+
exitCode: number;
|
|
225
|
+
stdout?: string;
|
|
226
|
+
stderr?: string;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Render one host status-line invocation. Always resolves (never rejects): every
|
|
230
|
+
* failure path returns the empty {@link EMPTY} result so the CLI exits cleanly
|
|
231
|
+
* with an empty status line. See the module header for the fail-safe contract.
|
|
232
|
+
*/
|
|
233
|
+
declare function runStatusline(opts: RunStatuslineOptions): Promise<RunStatuslineResult>;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* runtime/action-entrypoint — the universal user-invokable action dispatcher.
|
|
237
|
+
*
|
|
238
|
+
* A future host affordance (slash command / keybinding) points at the single
|
|
239
|
+
* stable home binary (`<homeBin> action <platformId> <actionId> --connector
|
|
240
|
+
* <id>`, built by core/spawn.buildHomeBinActionCommand). The CLI parses the
|
|
241
|
+
* flags and calls {@link runAction}. This module:
|
|
242
|
+
*
|
|
243
|
+
* 1. Loads the registered connector (live run handler) and the host adapter.
|
|
244
|
+
* 2. Builds the shared {@link HostCtx} (host + the adapter's capabilities; NO
|
|
245
|
+
* stdin — an action takes no host payload, unlike a hook or status line).
|
|
246
|
+
* 3. Finds the action by id, resolves the per-host run override, runs it, and
|
|
247
|
+
* prints the optional result.message.
|
|
248
|
+
*
|
|
249
|
+
* USER-TRIGGERED ERROR SEMANTICS (the key difference from hooks/statusline):
|
|
250
|
+
* actions are invoked DELIBERATELY by a user, so errors are SURFACED, never
|
|
251
|
+
* failed silently. An unknown action id or a throwing run → exit 1 + a stderr
|
|
252
|
+
* message. (Hooks fail-open to exit 0; the statusline fail-safes to an empty
|
|
253
|
+
* line — both are passive surfaces a host fires automatically. An action is not:
|
|
254
|
+
* swallowing its failure would leave the user staring at nothing, unable to
|
|
255
|
+
* tell the action ran.)
|
|
256
|
+
*
|
|
257
|
+
* NOTE (follow-up): no telemetry is recorded for action runs in v1 (out of
|
|
258
|
+
* scope), and no adapter EMITS the affordance yet — v1 ships the dispatch
|
|
259
|
+
* backbone only.
|
|
260
|
+
*/
|
|
261
|
+
/** Flags the CLI hands to {@link runAction} (no stdin — actions take no payload). */
|
|
262
|
+
interface RunActionOptions {
|
|
263
|
+
/** Host platform id from the command (`action <platformId> <actionId> …`). */
|
|
264
|
+
platformId: string;
|
|
265
|
+
/** Connector id from `--connector <id>`. */
|
|
266
|
+
connectorId: string;
|
|
267
|
+
/** The action id positional (`action <platformId> <actionId> …`). */
|
|
268
|
+
actionId: string;
|
|
269
|
+
}
|
|
270
|
+
/** Process-level result the CLI translates into exit code + stdout/stderr. */
|
|
271
|
+
interface RunActionResult {
|
|
272
|
+
exitCode: number;
|
|
273
|
+
stdout?: string;
|
|
274
|
+
stderr?: string;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Dispatch one user-invokable action. Always resolves (never rejects): every
|
|
278
|
+
* path returns a concrete {@link RunActionResult} so the CLI can exit cleanly,
|
|
279
|
+
* but UNLIKE the hook/statusline runtimes an error resolves to exit 1 + a stderr
|
|
280
|
+
* message (actions are user-triggered — surface the failure). See the module
|
|
281
|
+
* header for the user-triggered error contract.
|
|
282
|
+
*/
|
|
283
|
+
declare function runAction(opts: RunActionOptions): Promise<RunActionResult>;
|
|
284
|
+
|
|
285
|
+
export { type RunActionOptions, type RunActionResult, type RunHookOptions, type RunHookResult, type RunNativeHookOptions, type RunServeOptions, type RunStatuslineOptions, type RunStatuslineResult, type RunUsageEventOptions, type RunUsageEventResult, isNativeHookDeclared, runAction, runHook, runNativeHook, runServe, runStatusline, runUsageEvent };
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
runHook,
|
|
5
|
-
runNativeHook,
|
|
3
|
+
runAction,
|
|
6
4
|
runServe,
|
|
5
|
+
runStatusline,
|
|
7
6
|
runUsageEvent
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-BCHWFTV4.js";
|
|
7
|
+
} from "../chunk-BHUCB6LY.js";
|
|
10
8
|
import "../chunk-OP4KBXUO.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
import "../chunk-22Y24V7O.js";
|
|
10
|
+
import "../chunk-J3D5W5T2.js";
|
|
11
|
+
import {
|
|
12
|
+
isNativeHookDeclared,
|
|
13
|
+
runHook,
|
|
14
|
+
runNativeHook
|
|
15
|
+
} from "../chunk-CIRDOY2V.js";
|
|
16
|
+
import "../chunk-BCHWFTV4.js";
|
|
17
|
+
import "../chunk-KHO5WNTP.js";
|
|
18
|
+
import "../chunk-KGJWE6A2.js";
|
|
19
|
+
import "../chunk-ADTHT2FN.js";
|
|
20
|
+
import "../chunk-3PFFTFCU.js";
|
|
21
|
+
import "../chunk-BXGFUENQ.js";
|
|
16
22
|
import "../chunk-N6HH7K6P.js";
|
|
17
23
|
import "../chunk-TRQKHP7D.js";
|
|
18
24
|
export {
|
|
19
25
|
isNativeHookDeclared,
|
|
26
|
+
runAction,
|
|
20
27
|
runHook,
|
|
21
28
|
runNativeHook,
|
|
22
29
|
runServe,
|
|
30
|
+
runStatusline,
|
|
23
31
|
runUsageEvent
|
|
24
32
|
};
|
|
25
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export { ConnectorConfigError, defineAction, defineCommand, defineConfigPatch, defineConnector, defineHook, defineMemory, defineNativeHook, defineSkill, defineStatusline, defineSubagent } from '../index.js';
|
|
2
|
+
export { S as SURFACE_PREDICATES, a as SurfaceName, c as capabilitiesOf, h as hostsSupporting, s as surfaceSupport } from '../introspect-DuZSPSHB.js';
|
|
3
|
+
import { P as PlatformId } from '../types-BEKsAium.js';
|
|
4
|
+
export { A as ActionDef, a as ActionResult, b as AuthSpec, C as CommandDef, c as ConfigPatchDef, d as ConnectorConfig, E as EventPayloadMap, H as HookDefinition, e as HookEventName, f as HookParadigm, g as HookResponse, h as HooksConfig, i as HostCtx, I as InstallScope, J as JsonValue, M as MemoryDef, N as NativeHookDef, j as NativeHookEvent, k as NotificationEvent, l as PermissionRequestEvent, m as PlatformCapabilities, n as PlatformMemoryOverride, o as PlatformOverride, p as PostToolUseEvent, q as PostToolUseFailureEvent, r as PreCompactEvent, s as PreToolUseEvent, t as PublishConfig, R as ResolvedConnector, S as ServerDef, u as SessionEndEvent, v as SessionStartEvent, w as SkillDef, x as StatuslineContext, y as StatuslineDef, z as StopEvent, B as SubagentDef, D as SubagentStartEvent, F as SubagentStopEvent, G as SurfaceToolPolicy, T as TelemetryAccessor, K as TelemetryConfig, L as TelemetryUsageSummary, O as ToolFilter, Q as Transport, U as UserPromptSubmitEvent } from '../types-BEKsAium.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* sdk/helpers — host-aware authoring helpers for connector handlers.
|
|
8
|
+
*
|
|
9
|
+
* A handler (a hook, a statusline render, an action run) sees the host it is
|
|
10
|
+
* dispatched for via the {@link HostCtx} (`ctx.host`). These two helpers let a
|
|
11
|
+
* handler render a host-correct value without hardcoding a per-host branch:
|
|
12
|
+
*
|
|
13
|
+
* • {@link toolName} — resolve a bare MCP tool name to the host's native
|
|
14
|
+
* reference form (some hosts namespace MCP tools as `mcp__<id>__<tool>`).
|
|
15
|
+
* • {@link style} — wrap text in an ANSI escape ONLY on hosts that render
|
|
16
|
+
* ANSI in a status line / output; plain everywhere else.
|
|
17
|
+
*
|
|
18
|
+
* Both are deliberately MODEST, documented best-effort lists — NOT a capability
|
|
19
|
+
* query. The per-host convention each encodes is not centrally modeled in
|
|
20
|
+
* {@link PlatformCapabilities} yet; if either set grows it should migrate to a
|
|
21
|
+
* capability flag (a `mcpToolPrefix` / `rendersAnsi` flag) the adapter declares.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Resolve a bare MCP tool name to the host's native reference form.
|
|
26
|
+
*
|
|
27
|
+
* On a {@link PREFIXED_HOSTS} host the result is `mcp__<connectorId>__<baseName>`
|
|
28
|
+
* (how those hosts surface a connector's MCP tools); on every other host it is
|
|
29
|
+
* the bare `baseName`. When the host prefixes but no `connectorId` is supplied
|
|
30
|
+
* the helper falls back to the bare name rather than emitting a malformed
|
|
31
|
+
* `mcp__undefined__…` reference — it NEVER throws.
|
|
32
|
+
*/
|
|
33
|
+
declare function toolName(ctx: {
|
|
34
|
+
host: PlatformId;
|
|
35
|
+
connectorId?: string;
|
|
36
|
+
}, baseName: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Style `text` with an ANSI SGR escape on hosts that render it (a status line /
|
|
39
|
+
* terminal output), plain everywhere else.
|
|
40
|
+
*
|
|
41
|
+
* When `ctx.host` is in {@link ANSI_HOSTS} and `codes.ansi` is provided, returns
|
|
42
|
+
* `\x1b[<ansi>m<text>\x1b[0m`; otherwise returns `text` unchanged (an
|
|
43
|
+
* IDE-embedded host, or no `ansi` code given). `codes.ansi` is the SGR
|
|
44
|
+
* parameter(s), e.g. `"1"` (bold) or `"1;32"` (bold green).
|
|
45
|
+
*/
|
|
46
|
+
declare function style(ctx: {
|
|
47
|
+
host: PlatformId;
|
|
48
|
+
}, text: string, codes: {
|
|
49
|
+
ansi?: string;
|
|
50
|
+
}): string;
|
|
51
|
+
|
|
52
|
+
export { PlatformId, style, toolName };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
SURFACE_PREDICATES,
|
|
4
|
+
capabilitiesOf,
|
|
5
|
+
hostsSupporting,
|
|
6
|
+
surfaceSupport
|
|
7
|
+
} from "../chunk-76FUSVIA.js";
|
|
8
|
+
import {
|
|
9
|
+
ConnectorConfigError,
|
|
10
|
+
defineAction,
|
|
11
|
+
defineCommand,
|
|
12
|
+
defineConfigPatch,
|
|
13
|
+
defineConnector,
|
|
14
|
+
defineHook,
|
|
15
|
+
defineMemory,
|
|
16
|
+
defineNativeHook,
|
|
17
|
+
defineSkill,
|
|
18
|
+
defineStatusline,
|
|
19
|
+
defineSubagent
|
|
20
|
+
} from "../chunk-ADTHT2FN.js";
|
|
21
|
+
import "../chunk-3PFFTFCU.js";
|
|
22
|
+
import "../chunk-N6HH7K6P.js";
|
|
23
|
+
import "../chunk-TRQKHP7D.js";
|
|
24
|
+
|
|
25
|
+
// src/sdk/helpers.ts
|
|
26
|
+
var PREFIXED_HOSTS = /* @__PURE__ */ new Set([
|
|
27
|
+
"claude-code",
|
|
28
|
+
"codex",
|
|
29
|
+
"kimi",
|
|
30
|
+
"cursor",
|
|
31
|
+
"copilot-cli",
|
|
32
|
+
"vscode-copilot",
|
|
33
|
+
"jetbrains-copilot",
|
|
34
|
+
"gemini-cli",
|
|
35
|
+
"qwen-code"
|
|
36
|
+
]);
|
|
37
|
+
function toolName(ctx, baseName) {
|
|
38
|
+
if (PREFIXED_HOSTS.has(ctx.host) && ctx.connectorId) {
|
|
39
|
+
return `mcp__${ctx.connectorId}__${baseName}`;
|
|
40
|
+
}
|
|
41
|
+
return baseName;
|
|
42
|
+
}
|
|
43
|
+
var ANSI_HOSTS = /* @__PURE__ */ new Set([
|
|
44
|
+
"claude-code",
|
|
45
|
+
"codex",
|
|
46
|
+
"gemini-cli",
|
|
47
|
+
"qwen-code",
|
|
48
|
+
"cursor",
|
|
49
|
+
"copilot-cli",
|
|
50
|
+
"opencode",
|
|
51
|
+
"droid",
|
|
52
|
+
"crush",
|
|
53
|
+
"goose",
|
|
54
|
+
"amp"
|
|
55
|
+
]);
|
|
56
|
+
function style(ctx, text, codes) {
|
|
57
|
+
if (codes.ansi && ANSI_HOSTS.has(ctx.host)) {
|
|
58
|
+
return `\x1B[${codes.ansi}m${text}\x1B[0m`;
|
|
59
|
+
}
|
|
60
|
+
return text;
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
ConnectorConfigError,
|
|
64
|
+
SURFACE_PREDICATES,
|
|
65
|
+
capabilitiesOf,
|
|
66
|
+
defineAction,
|
|
67
|
+
defineCommand,
|
|
68
|
+
defineConfigPatch,
|
|
69
|
+
defineConnector,
|
|
70
|
+
defineHook,
|
|
71
|
+
defineMemory,
|
|
72
|
+
defineNativeHook,
|
|
73
|
+
defineSkill,
|
|
74
|
+
defineStatusline,
|
|
75
|
+
defineSubagent,
|
|
76
|
+
hostsSupporting,
|
|
77
|
+
style,
|
|
78
|
+
surfaceSupport,
|
|
79
|
+
toolName
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/sdk/helpers.ts"],"sourcesContent":["/**\n * sdk/helpers — host-aware authoring helpers for connector handlers.\n *\n * A handler (a hook, a statusline render, an action run) sees the host it is\n * dispatched for via the {@link HostCtx} (`ctx.host`). These two helpers let a\n * handler render a host-correct value without hardcoding a per-host branch:\n *\n * • {@link toolName} — resolve a bare MCP tool name to the host's native\n * reference form (some hosts namespace MCP tools as `mcp__<id>__<tool>`).\n * • {@link style} — wrap text in an ANSI escape ONLY on hosts that render\n * ANSI in a status line / output; plain everywhere else.\n *\n * Both are deliberately MODEST, documented best-effort lists — NOT a capability\n * query. The per-host convention each encodes is not centrally modeled in\n * {@link PlatformCapabilities} yet; if either set grows it should migrate to a\n * capability flag (a `mcpToolPrefix` / `rendersAnsi` flag) the adapter declares.\n */\n\nimport type { PlatformId } from \"../core/types.js\";\n\n/**\n * Hosts that namespace MCP tools as `mcp__<connectorId>__<tool>` — the\n * `mcp__`-prefix convention Claude Code popularized and most MCP-client agents\n * adopted. CONFIRMED in-repo via the adapters' own `mcp__` PreToolUse matchers\n * for claude-code, codex, and kimi; the remaining members are MCP-client hosts\n * the convention applies to but are not separately verified here (a wrong\n * inclusion only ever yields a name the host doesn't resolve, the same outcome\n * as wrongly EXCLUDING a prefixing host — and an author can always construct the\n * reference themselves). This is a SMALL explicit set, not a capability query;\n * if it grows, migrate it to a per-adapter `mcpToolPrefix` capability flag.\n * (Follow-up: spot-verify gemini-cli / a copilot variant on a live box.)\n */\nconst PREFIXED_HOSTS: ReadonlySet<PlatformId> = new Set<PlatformId>([\n \"claude-code\",\n \"codex\",\n \"kimi\",\n \"cursor\",\n \"copilot-cli\",\n \"vscode-copilot\",\n \"jetbrains-copilot\",\n \"gemini-cli\",\n \"qwen-code\",\n]);\n\n/**\n * Resolve a bare MCP tool name to the host's native reference form.\n *\n * On a {@link PREFIXED_HOSTS} host the result is `mcp__<connectorId>__<baseName>`\n * (how those hosts surface a connector's MCP tools); on every other host it is\n * the bare `baseName`. When the host prefixes but no `connectorId` is supplied\n * the helper falls back to the bare name rather than emitting a malformed\n * `mcp__undefined__…` reference — it NEVER throws.\n */\nexport function toolName(\n ctx: { host: PlatformId; connectorId?: string },\n baseName: string,\n): string {\n if (PREFIXED_HOSTS.has(ctx.host) && ctx.connectorId) {\n return `mcp__${ctx.connectorId}__${baseName}`;\n }\n return baseName;\n}\n\n/**\n * Hosts that render ANSI escape sequences in a status line / terminal output —\n * the CLI/TUI hosts. IDE-embedded hosts (where output lands in a webview /\n * editor panel that shows the raw escape) are deliberately EXCLUDED. Like\n * {@link PREFIXED_HOSTS} this is a documented best-effort list, not a capability\n * query; migrate it to a `rendersAnsi` capability flag if it grows.\n */\nconst ANSI_HOSTS: ReadonlySet<PlatformId> = new Set<PlatformId>([\n \"claude-code\",\n \"codex\",\n \"gemini-cli\",\n \"qwen-code\",\n \"cursor\",\n \"copilot-cli\",\n \"opencode\",\n \"droid\",\n \"crush\",\n \"goose\",\n \"amp\",\n]);\n\n/**\n * Style `text` with an ANSI SGR escape on hosts that render it (a status line /\n * terminal output), plain everywhere else.\n *\n * When `ctx.host` is in {@link ANSI_HOSTS} and `codes.ansi` is provided, returns\n * `\\x1b[<ansi>m<text>\\x1b[0m`; otherwise returns `text` unchanged (an\n * IDE-embedded host, or no `ansi` code given). `codes.ansi` is the SGR\n * parameter(s), e.g. `\"1\"` (bold) or `\"1;32\"` (bold green).\n */\nexport function style(\n ctx: { host: PlatformId },\n text: string,\n codes: { ansi?: string },\n): string {\n if (codes.ansi && ANSI_HOSTS.has(ctx.host)) {\n return `\\x1b[${codes.ansi}m${text}\\x1b[0m`;\n }\n return text;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAM,iBAA0C,oBAAI,IAAgB;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,SAAS,SACd,KACA,UACQ;AACR,MAAI,eAAe,IAAI,IAAI,IAAI,KAAK,IAAI,aAAa;AACnD,WAAO,QAAQ,IAAI,WAAW,KAAK,QAAQ;AAAA,EAC7C;AACA,SAAO;AACT;AASA,IAAM,aAAsC,oBAAI,IAAgB;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,SAAS,MACd,KACA,MACA,OACQ;AACR,MAAI,MAAM,QAAQ,WAAW,IAAI,IAAI,IAAI,GAAG;AAC1C,WAAO,QAAQ,MAAM,IAAI,IAAI,IAAI;AAAA,EACnC;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { P as PlatformId, e as HookEventName, R as ResolvedConnector } from '../types-BEKsAium.js';
|
|
2
|
+
import { a as SurfaceName } from '../introspect-DuZSPSHB.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* sdk/test-harness — the SHIPPED, OFFLINE behavioral harness.
|
|
6
|
+
*
|
|
7
|
+
* Two read-only tools a connector author runs WITHOUT installing anything or
|
|
8
|
+
* touching the host's filesystem:
|
|
9
|
+
*
|
|
10
|
+
* • `explain(connector)` — the static per-host × per-DECLARED-surface matrix:
|
|
11
|
+
* for every registered host and every surface the connector actually ships,
|
|
12
|
+
* is it `native` (the host can honor it), `disabled` (the connector opted
|
|
13
|
+
* out for that host via `platforms[host].<surface> === false`), or
|
|
14
|
+
* `skip-warn` (the host cannot honor it → install would skip-warn)?
|
|
15
|
+
*
|
|
16
|
+
* • `simulate(connector, opts)` — runs the REAL adapter parse → handler →
|
|
17
|
+
* format chain INLINE against a host-shaped raw payload and reports whether
|
|
18
|
+
* the host actually HONORS the connector's response (the trustworthy part:
|
|
19
|
+
* it surfaces the documented degradations, e.g. Codex silently dropping a
|
|
20
|
+
* UserPromptSubmit "context" injection that has no stdout path).
|
|
21
|
+
*
|
|
22
|
+
* It deliberately does NOT import the runtime entrypoints (runHook /
|
|
23
|
+
* runStatusline) — those load the REGISTERED connector from disk and record
|
|
24
|
+
* telemetry. The harness instead re-implements the tiny parse→handler→format
|
|
25
|
+
* chain against the in-memory connector + the adapter, mirroring the runtime's
|
|
26
|
+
* input tolerance (empty/malformed payload → `{}`) and its fail-safe envelope.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** One cell of the {@link explain} matrix: a host × a declared surface. */
|
|
30
|
+
interface ExplainRow {
|
|
31
|
+
host: PlatformId;
|
|
32
|
+
surface: SurfaceName;
|
|
33
|
+
/**
|
|
34
|
+
* - "native" — the host's capabilities pass the surface predicate.
|
|
35
|
+
* - "disabled" — the connector opted out for this host
|
|
36
|
+
* (`platforms[host].<surface> === false`).
|
|
37
|
+
* - "skip-warn" — the host cannot honor it; install would skip-warn.
|
|
38
|
+
*/
|
|
39
|
+
support: "native" | "skip-warn" | "disabled";
|
|
40
|
+
reason: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The static support matrix: every registered host × every surface the
|
|
44
|
+
* connector declares. Rows are sorted by host then surface for stable output.
|
|
45
|
+
* Pure read of the adapter capabilities — installs nothing, writes nothing.
|
|
46
|
+
*/
|
|
47
|
+
declare function explain(connector: ResolvedConnector): Promise<ExplainRow[]>;
|
|
48
|
+
/** What to drive through the harness: one host, one surface, one raw payload. */
|
|
49
|
+
interface SimulateOptions {
|
|
50
|
+
surface: "hooks" | "statusline";
|
|
51
|
+
host: PlatformId | string;
|
|
52
|
+
/** REQUIRED when `surface === "hooks"`: which normalized lifecycle event. */
|
|
53
|
+
event?: HookEventName;
|
|
54
|
+
/** The host-shaped RAW payload (what the host would pipe in on stdin). */
|
|
55
|
+
input: unknown;
|
|
56
|
+
}
|
|
57
|
+
/** The harness verdict: did the host actually honor the connector's response? */
|
|
58
|
+
interface SimulateResult {
|
|
59
|
+
/** True when the host's native reply carries the connector's intent. */
|
|
60
|
+
honored: boolean;
|
|
61
|
+
/** The host-native stdout the adapter would emit (when there is one). */
|
|
62
|
+
hostReply?: string;
|
|
63
|
+
/** Human-readable why — names the documented degradation when honored:false. */
|
|
64
|
+
reason: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Run the connector against ONE host-shaped payload through the REAL adapter
|
|
68
|
+
* path and report whether the host honors the response. Self-contained (does not
|
|
69
|
+
* touch the registered-connector loader or telemetry) and fail-safe: any throw
|
|
70
|
+
* in the chain degrades to `honored:false` with the error message, never rejects.
|
|
71
|
+
*/
|
|
72
|
+
declare function simulate(connector: ResolvedConnector, opts: SimulateOptions): Promise<SimulateResult>;
|
|
73
|
+
|
|
74
|
+
export { type ExplainRow, type SimulateOptions, type SimulateResult, explain, simulate };
|