@ken-jo/agent-connector 0.1.0 → 0.3.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 +183 -24
- package/dist/{amp-QSFH2V7Y.js → amp-YGV66GJT.js} +9 -2
- package/dist/amp-YGV66GJT.js.map +1 -0
- package/dist/{antigravity-CX2YLSY7.js → antigravity-7IBYFO6P.js} +4 -3
- package/dist/{antigravity-cli-YQDFVV4U.js → antigravity-cli-JEOUP2VN.js} +4 -3
- package/dist/{antigravity-cli-YQDFVV4U.js.map → antigravity-cli-JEOUP2VN.js.map} +1 -1
- package/dist/{chunk-LTT56GI3.js → chunk-3JCRUROU.js} +18 -5
- package/dist/chunk-3JCRUROU.js.map +1 -0
- package/dist/chunk-44HUXXC6.js +284 -0
- package/dist/chunk-44HUXXC6.js.map +1 -0
- package/dist/{chunk-54EMKTTX.js → chunk-DS3LUFVN.js} +21 -21
- package/dist/chunk-DS3LUFVN.js.map +1 -0
- package/dist/chunk-GSGDG2BV.js +568 -0
- package/dist/chunk-GSGDG2BV.js.map +1 -0
- package/dist/{chunk-TRKWUNO4.js → chunk-KQSNDFBN.js} +13 -2
- package/dist/chunk-KQSNDFBN.js.map +1 -0
- package/dist/{chunk-KHO5WNTP.js → chunk-KVAAFYRR.js} +18 -2
- package/dist/chunk-KVAAFYRR.js.map +1 -0
- package/dist/chunk-N6HH7K6P.js +494 -0
- package/dist/chunk-N6HH7K6P.js.map +1 -0
- package/dist/{chunk-XUCWLJY5.js → chunk-NJU275US.js} +30 -30
- package/dist/{chunk-WCETQWWK.js → chunk-OP4KBXUO.js} +1 -17
- package/dist/chunk-OP4KBXUO.js.map +1 -0
- package/dist/{chunk-TIIP3RG2.js → chunk-PD4VFEBY.js} +342 -2
- package/dist/chunk-PD4VFEBY.js.map +1 -0
- package/dist/chunk-QADSG2JY.js +1989 -0
- package/dist/chunk-QADSG2JY.js.map +1 -0
- package/dist/{chunk-WV63X7IK.js → chunk-SCVBYSF7.js} +2 -2
- package/dist/chunk-SCVBYSF7.js.map +1 -0
- package/dist/{package-DLOVE2E4.js → chunk-WNREHWKL.js} +26 -115
- package/dist/chunk-WNREHWKL.js.map +1 -0
- package/dist/{chunk-YNZU6PAV.js → chunk-ZAM4M7LI.js} +74 -21
- package/dist/chunk-ZAM4M7LI.js.map +1 -0
- package/dist/claude-code-4275HQU4.js +1432 -0
- package/dist/claude-code-4275HQU4.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-QX57FJDN.js → codebuff-LE3KBZGM.js} +9 -2
- package/dist/codebuff-LE3KBZGM.js.map +1 -0
- package/dist/{codex-JFQTS6LU.js → codex-4BY2ZJIW.js} +148 -7
- package/dist/codex-4BY2ZJIW.js.map +1 -0
- package/dist/{copilot-cli-MTCGHZ2T.js → copilot-cli-IPISKO3V.js} +109 -2
- package/dist/copilot-cli-IPISKO3V.js.map +1 -0
- package/dist/{crush-I7PK3FGI.js → crush-X3E25EQG.js} +31 -3
- package/dist/crush-X3E25EQG.js.map +1 -0
- package/dist/{cursor-4TMXKJOZ.js → cursor-UH3W622V.js} +66 -5
- package/dist/cursor-UH3W622V.js.map +1 -0
- package/dist/{detect-WIAGVYS4.js → detect-MNDHGLSV.js} +7 -3
- package/dist/detect-MNDHGLSV.js.map +1 -0
- package/dist/{doctor-EZW2K4NI.js → doctor-N5KZDD55.js} +45 -7
- package/dist/doctor-N5KZDD55.js.map +1 -0
- package/dist/{droid-KN6VRMMT.js → droid-T5VBRXZF.js} +32 -3
- package/dist/droid-T5VBRXZF.js.map +1 -0
- package/dist/{gemini-cli-Y35FFK4M.js → gemini-cli-ZSUK55UA.js} +51 -3
- package/dist/gemini-cli-ZSUK55UA.js.map +1 -0
- package/dist/{goose-ZTGTSUFJ.js → goose-M3RR3CZG.js} +63 -4
- package/dist/goose-M3RR3CZG.js.map +1 -0
- package/dist/{hermes-H2KV44GK.js → hermes-CUNKIAR5.js} +76 -3
- package/dist/hermes-CUNKIAR5.js.map +1 -0
- package/dist/{hook-YVDILAMZ.js → hook-7LUOKIXH.js} +28 -13
- package/dist/hook-7LUOKIXH.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/install-TQTT4F3I.js +89 -0
- package/dist/install-TQTT4F3I.js.map +1 -0
- package/dist/{jetbrains-copilot-HWA3DMH7.js → jetbrains-copilot-C3HDGGML.js} +16 -2
- package/dist/jetbrains-copilot-C3HDGGML.js.map +1 -0
- package/dist/kilo-PKAJCWPX.js +852 -0
- package/dist/kilo-PKAJCWPX.js.map +1 -0
- package/dist/{kilo-cli-EAQTHXUW.js → kilo-cli-QWUVXG2O.js} +186 -7
- package/dist/kilo-cli-QWUVXG2O.js.map +1 -0
- package/dist/{kimi-GQ7VXNYT.js → kimi-EVD7YKXS.js} +167 -9
- package/dist/kimi-EVD7YKXS.js.map +1 -0
- package/dist/{kiro-VQTT6LO2.js → kiro-UQRY6EIO.js} +98 -4
- package/dist/kiro-UQRY6EIO.js.map +1 -0
- package/dist/{leaderboard-K6ON3SWW.js → leaderboard-MUJ7DURM.js} +3 -3
- package/dist/{mux-T2TV4CIQ.js → mux-5CI5FP2W.js} +9 -2
- package/dist/mux-5CI5FP2W.js.map +1 -0
- package/dist/{omp-PB4VDKS6.js → omp-AXA7XY22.js} +13 -2
- package/dist/omp-AXA7XY22.js.map +1 -0
- package/dist/{openclaw-ETN2M63O.js → openclaw-UZ5BMCGQ.js} +101 -4
- package/dist/openclaw-UZ5BMCGQ.js.map +1 -0
- package/dist/{opencode-FZ33JKUZ.js → opencode-NZBRLJN3.js} +53 -7
- package/dist/opencode-NZBRLJN3.js.map +1 -0
- package/dist/package-SYPA5POO.js +130 -0
- package/dist/package-SYPA5POO.js.map +1 -0
- package/dist/{pi-CIU2QHT4.js → pi-WMTUX6ES.js} +106 -23
- package/dist/pi-WMTUX6ES.js.map +1 -0
- package/dist/{qwen-code-5POCNU6P.js → qwen-code-MRRIUQ3P.js} +187 -6
- package/dist/qwen-code-MRRIUQ3P.js.map +1 -0
- package/dist/{roo-code-IOIUXRDE.js → roo-code-NI5UU6JB.js} +26 -2
- package/dist/roo-code-NI5UU6JB.js.map +1 -0
- package/dist/runtime/index.d.ts +38 -4
- package/dist/runtime/index.js +11 -6
- package/dist/{serve-HVWWY4B6.js → serve-XJOSA7BY.js} +9 -8
- package/dist/{serve-HVWWY4B6.js.map → serve-XJOSA7BY.js.map} +1 -1
- package/dist/{status-FE7TECZD.js → status-DYSS6BOR.js} +19 -9
- package/dist/status-DYSS6BOR.js.map +1 -0
- package/dist/{telemetry-36GESKQQ.js → telemetry-IJ4GP2Q3.js} +5 -4
- package/dist/{telemetry-36GESKQQ.js.map → telemetry-IJ4GP2Q3.js.map} +1 -1
- package/dist/{trae-JSNDZFKL.js → trae-CQC72RHH.js} +9 -2
- package/dist/trae-CQC72RHH.js.map +1 -0
- package/dist/types-CNigfEuR.d.ts +757 -0
- package/dist/uninstall-3DXIBRCV.js +162 -0
- package/dist/uninstall-3DXIBRCV.js.map +1 -0
- package/dist/{upgrade-JV2VK242.js → upgrade-GJEB3ITY.js} +29 -10
- package/dist/upgrade-GJEB3ITY.js.map +1 -0
- package/dist/{usage-6ER6EMEY.js → usage-2BJLM3GJ.js} +3 -3
- package/dist/{usage-event-JKBI6XCF.js → usage-event-472X3DOY.js} +8 -7
- package/dist/{usage-event-JKBI6XCF.js.map → usage-event-472X3DOY.js.map} +1 -1
- package/dist/{vscode-copilot-CK3NO54M.js → vscode-copilot-4RVRTCKV.js} +53 -4
- package/dist/vscode-copilot-4RVRTCKV.js.map +1 -0
- package/dist/{warp-QNVDXOG4.js → warp-X6MB67NT.js} +110 -4
- package/dist/warp-X6MB67NT.js.map +1 -0
- package/dist/{zed-VRJKWYUR.js → zed-NTCYW4V2.js} +120 -5
- package/dist/zed-NTCYW4V2.js.map +1 -0
- package/package.json +4 -3
- package/dist/amp-QSFH2V7Y.js.map +0 -1
- package/dist/chunk-54EMKTTX.js.map +0 -1
- package/dist/chunk-7MSDGHJW.js +0 -316
- package/dist/chunk-7MSDGHJW.js.map +0 -1
- package/dist/chunk-KHO5WNTP.js.map +0 -1
- package/dist/chunk-LTT56GI3.js.map +0 -1
- package/dist/chunk-TIIP3RG2.js.map +0 -1
- package/dist/chunk-TRKWUNO4.js.map +0 -1
- package/dist/chunk-WCETQWWK.js.map +0 -1
- package/dist/chunk-WV63X7IK.js.map +0 -1
- package/dist/chunk-XNAM7F35.js +0 -276
- package/dist/chunk-XNAM7F35.js.map +0 -1
- package/dist/chunk-YNZU6PAV.js.map +0 -1
- package/dist/claude-code-HKDV7T32.js +0 -637
- package/dist/claude-code-HKDV7T32.js.map +0 -1
- package/dist/codebuff-QX57FJDN.js.map +0 -1
- package/dist/codex-JFQTS6LU.js.map +0 -1
- package/dist/copilot-cli-MTCGHZ2T.js.map +0 -1
- package/dist/crush-I7PK3FGI.js.map +0 -1
- package/dist/cursor-4TMXKJOZ.js.map +0 -1
- package/dist/detect-WIAGVYS4.js.map +0 -1
- package/dist/doctor-EZW2K4NI.js.map +0 -1
- package/dist/droid-KN6VRMMT.js.map +0 -1
- package/dist/gemini-cli-Y35FFK4M.js.map +0 -1
- package/dist/goose-ZTGTSUFJ.js.map +0 -1
- package/dist/hermes-H2KV44GK.js.map +0 -1
- package/dist/hook-YVDILAMZ.js.map +0 -1
- package/dist/install-HQRYZOQ2.js +0 -60
- package/dist/install-HQRYZOQ2.js.map +0 -1
- package/dist/jetbrains-copilot-HWA3DMH7.js.map +0 -1
- package/dist/kilo-QXJRCSLT.js +0 -384
- package/dist/kilo-QXJRCSLT.js.map +0 -1
- package/dist/kilo-cli-EAQTHXUW.js.map +0 -1
- package/dist/kimi-GQ7VXNYT.js.map +0 -1
- package/dist/kiro-VQTT6LO2.js.map +0 -1
- package/dist/mux-T2TV4CIQ.js.map +0 -1
- package/dist/omp-PB4VDKS6.js.map +0 -1
- package/dist/openclaw-ETN2M63O.js.map +0 -1
- package/dist/opencode-FZ33JKUZ.js.map +0 -1
- package/dist/package-DLOVE2E4.js.map +0 -1
- package/dist/pi-CIU2QHT4.js.map +0 -1
- package/dist/qwen-code-5POCNU6P.js.map +0 -1
- package/dist/roo-code-IOIUXRDE.js.map +0 -1
- package/dist/status-FE7TECZD.js.map +0 -1
- package/dist/trae-JSNDZFKL.js.map +0 -1
- package/dist/types-CYUB1OTr.d.ts +0 -427
- package/dist/uninstall-IGCKNOSF.js +0 -72
- package/dist/uninstall-IGCKNOSF.js.map +0 -1
- package/dist/upgrade-JV2VK242.js.map +0 -1
- package/dist/vscode-copilot-CK3NO54M.js.map +0 -1
- package/dist/warp-QNVDXOG4.js.map +0 -1
- package/dist/zed-VRJKWYUR.js.map +0 -1
- /package/dist/{antigravity-CX2YLSY7.js.map → antigravity-7IBYFO6P.js.map} +0 -0
- /package/dist/{chunk-XUCWLJY5.js.map → chunk-NJU275US.js.map} +0 -0
- /package/dist/{leaderboard-K6ON3SWW.js.map → leaderboard-MUJ7DURM.js.map} +0 -0
- /package/dist/{usage-6ER6EMEY.js.map → usage-2BJLM3GJ.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/status.ts"],"sourcesContent":["/**\n * cli/commands/status — a light, glanceable install-state summary.\n *\n * There is NO MCP standard for \"which connectors are installed into which host\n * configs on this machine\" — distribution/wire standards (server.json, MCPB,\n * the lifecycle) cover publishing + the protocol, not local install state. So\n * `status` is purely agent-connector infrastructure, and we design it for the\n * everyday question it answers in one line per platform:\n *\n * \"which of my connectors are present on which hosts?\"\n *\n * It REUSES detect (host enumeration) + the adapters' own config-path resolvers\n * (a read-only presence check) — NO new adapter SPI methods. Unlike `doctor`\n * (deep health checks, non-zero exit on failure) and `doctor --probe` (a live\n * protocol probe that FAILs on a dead server), `status` ALWAYS exits 0: it\n * describes, it never gates. A connector being absent is informational.\n */\n\nimport { parseArgs } from \"node:util\";\nimport { readFileSync } from \"node:fs\";\n\nimport type { InstallScope, PlatformId, ResolvedConnector } from \"../../core/types.js\";\nimport type { InstallContext } from \"../../adapters/spi.js\";\nimport { detectInstalledPlatforms } from \"../../adapters/detect.js\";\nimport { loadAdapter } from \"../../adapters/registry.js\";\nimport {\n findConnectorConfig,\n listRegisteredConnectors,\n loadConnectorFromPath,\n} from \"../../core/load-connector.js\";\nimport { dataRoot, homeBinPath } from \"../../core/paths.js\";\nimport { fail, parseScope, print } from \"../app.js\";\n\n/**\n * Resolve which connector(s) status reports on: an explicit --connector path or\n * a local config first, else every connector registered under the data-root\n * (what is actually installed). Empty array when none — status still lists the\n * detected platforms.\n */\nasync function resolveConnectors(\n connectorPath: string | undefined,\n projectDir: string,\n): Promise<ResolvedConnector[]> {\n const configPath = connectorPath ?? findConnectorConfig(projectDir);\n if (configPath) {\n try {\n const { connector } = await loadConnectorFromPath(configPath);\n return [connector];\n } catch {\n /* fall through to the registry */\n }\n }\n return listRegisteredConnectors();\n}\n\nfunction buildContext(\n connector: ResolvedConnector,\n id: PlatformId,\n scope: InstallScope,\n projectDir: string,\n): InstallContext {\n return {\n connector,\n scope: connector.platforms[id]?.scope ?? scope,\n projectDir,\n homeBinPath: homeBinPath(),\n dataRoot: dataRoot(),\n dryRun: true,\n };\n}\n\n/** Read-only: does the file at `path` mention `needle`? Missing/unreadable → false. */\nfunction fileMentions(path: string, needle: string): boolean {\n try {\n return readFileSync(path, \"utf8\").includes(needle);\n } catch {\n return false;\n }\n}\n\ninterface ConnStatus {\n id: string;\n serverPresent: boolean;\n hooksPresent: boolean;\n}\ninterface StatusRow {\n platform: PlatformId;\n scope: InstallScope;\n configPath: string;\n connectors: ConnStatus[];\n}\n\nexport async function run(argv: string[]): Promise<number> {\n const { values } = parseArgs({\n args: argv,\n options: {\n scope: { type: \"string\", default: \"user\" },\n connector: { type: \"string\" },\n project: { type: \"string\" },\n json: { type: \"boolean\", default: false },\n },\n allowPositionals: false,\n });\n\n const projectDir = values.project ?? process.cwd();\n const scope = parseScope(values.scope);\n if (scope == null) return fail(`invalid --scope \"${values.scope}\" (use user|project)`);\n\n const connectors = await resolveConnectors(values.connector, projectDir);\n const detected = await detectInstalledPlatforms(projectDir);\n\n const rows: StatusRow[] = [];\n for (const p of detected) {\n const adapter = await loadAdapter(p.id);\n if (!adapter) continue;\n const connStatuses: ConnStatus[] = connectors.map((connector) => {\n const ctx = buildContext(connector, p.id, scope, projectDir);\n let serverPath = \"\";\n let hookPath = \"\";\n try {\n serverPath = adapter.getServerConfigPath(ctx);\n } catch {\n /* adapter has no server config path */\n }\n try {\n hookPath = adapter.getHookConfigPath(ctx);\n } catch {\n /* adapter has no hook config path */\n }\n return {\n id: connector.id,\n serverPresent: serverPath ? fileMentions(serverPath, connector.id) : false,\n hooksPresent: hookPath ? fileMentions(hookPath, connector.id) : false,\n };\n });\n rows.push({\n platform: p.id,\n scope: p.scope,\n configPath: p.configPath,\n connectors: connStatuses,\n });\n }\n\n if (values.json) {\n print(JSON.stringify(rows, null, 2));\n return 0;\n }\n\n if (rows.length === 0) {\n print(\"status: no agent platforms detected.\");\n return 0;\n }\n if (connectors.length === 0) {\n print(\"status: no connectors found (pass --connector <path> or install one).\\n\");\n }\n\n for (const r of rows) {\n print(`${r.platform} [${r.scope}] ${r.configPath}`);\n if (r.connectors.length === 0) {\n print(\" (no connectors to check)\");\n } else {\n for (const c of r.connectors) {\n const mark = c.serverPresent || c.hooksPresent ? \"[installed]\" : \"[absent ]\";\n const server = c.serverPresent ? \"server ✓\" : \"server ·\";\n const hooks = c.hooksPresent ? \"hooks ✓\" : \"hooks ·\";\n print(` ${mark} ${c.id} ${server} ${hooks}`);\n }\n }\n print(\"\");\n }\n\n // Always 0: status is descriptive (what is installed where), never a gate —\n // that contrast with doctor (non-zero on FAIL) is the reason it exists.\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAoB7B,eAAe,k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;AAAA,MAChD;AAAA,IACF;AACA,UAAM,EAAE;AAAA,EACV;AAIA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters/trae/index.ts"],"sourcesContent":["/**\n * adapters/trae — Trae (ByteDance) platform adapter for agent-connector.\n *\n * Trae is an **mcp-only** host for our purposes: it exposes MCP servers as its\n * extensibility mechanism but has no lifecycle hook system we can register\n * against. This adapter therefore installs only the MCP server and reports hooks\n * as unavailable, mirroring the Warp reference path that validates the\n * `mcp-only` paradigm end-to-end.\n *\n * MCP config (medium-confidence path — still implemented; doctor reports presence):\n * - user scope → ~/.trae/mcp.json\n * - project scope → <projectDir>/.trae/mcp.json\n * Both are JSON, root key \"mcpServers\", and are the SAME file used for the\n * (non-existent) hook registration — there is no separate hook file here.\n *\n * A stdio server entry uses the standard Claude/Cursor shape:\n * { command, args, env } (object-keyed by connector id).\n *\n * Trae documents no native `${env:VAR}` interpolation token, so env/header/url\n * refs are resolved to literals at install time (the no-native-token path).\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, InstallContext } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookParadigm,\n PlatformCapabilities,\n PlatformId,\n ServerDef,\n Transport,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildServeWrapperCommand,\n isHomeBinHookCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"trae\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/** Native MCP server entry shapes Trae accepts under `mcpServers`. */\ninterface TraeStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n}\ninterface TraeHttpServer {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport class TraeAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Trae\";\n readonly paradigm: HookParadigm = \"mcp-only\";\n\n readonly capabilities: PlatformCapabilities = {\n // Trae has no lifecycle hook system we can target — every hook capability\n // 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 // Trae registers stdio, SSE, and Streamable HTTP MCP servers.\n transports: [\"stdio\", \"sse\", \"http\"],\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".trae\");\n const userMcp = join(userDir, \"mcp.json\");\n const projDir = join(projectDir, \".trae\");\n const projMcp = join(projDir, \"mcp.json\");\n\n const userInstalled = existsSync(userDir) || existsSync(userMcp);\n const projInstalled = existsSync(projDir) || existsSync(projMcp);\n const installed = userInstalled || projInstalled;\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projMcp : userMcp;\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: installed\n ? `found Trae config (${scope})`\n : `no Trae config at ${userDir} or ${projDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".trae\")\n : join(homedir(), \".trae\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.json\");\n }\n\n /**\n * Trae has no hook file — hooks are not a thing here. The hook \"config path\"\n * is the same mcp.json so the generic doctor/backup behave 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 trae\"\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 Trae's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): TraeStdioServer | TraeHttpServer {\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 // Trae has no documented native interpolation token, so resolve every\n // ${env:VAR} to a literal at install time.\n const entry: TraeStdioServer = { command: resolveEnvRefsDeep(command) };\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) — Trae registers a URL.\n const entry: TraeHttpServer = { url: resolveEnvRefsDeep(server.url ?? \"\") };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. Trae documents no native interpolation token, so\n * 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 — Trae is mcp-only) ───────────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Trae 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 (Trae is mcp-only)\",\n },\n ];\n }\n\n /**\n * True when a hook command references our home binary AND this connector id\n * (anchored so a shared-prefix id can't collide — see isHomeBinHookCommand).\n * Trae installs no hooks, but this guard keeps any future shared-file edit\n * from removing another connector's entries.\n */\n private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\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.json 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 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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AM,UAAU,KAAK,oBAAoB,GAAG;AAC5C,UAAM,cAAc,IAAI,UAAU;AAClC,WAAO;AAAA,MACL;AAAA,QACE,MAAM,GAAG,KAAK,IAAI;AAAA,QAClB,OAAO,MACL,WAAW,OAAO,IACd,EAAE,QAAQ,MAAM,QAAQ,QAAQ,IAChC,EAAE,QAAQ,QAAQ,QAAQ,cAAc,OAAO,GAAG;AAAA,MAC1D;AAAA,MACA;AAAA,QACE,MAAM,GAAG,KAAK,IAAI;AAAA,QAClB,OAAO,MAAM;AACX,gBAAM,MAAM,KAAK,SAAmD,OAAO;AAC3E,gBAAM,SAAS,MAAM,YAAY;AACjC,cAAI,CAAC,OAAO,CAAC,QAAQ;AACnB,mBAAO,EAAE,QAAQ,QAAQ,QAAQ,MAAM,YAAY,OAAO,OAAO,GAAG;AAAA,UACtE;AACA,iBAAO,eAAe,SAClB,EAAE,QAAQ,MAAM,QAAQ,GAAG,YAAY,IAAI,WAAW,WAAW,IACjE;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ,MAAM,YAAY,IAAI,WAAW,OAAO,OAAO;AAAA,UACzD;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,UAAU,IAAI,YAAY;AACvC,IAAO,eAAQ;","names":["entry"]}
|
package/dist/types-CYUB1OTr.d.ts
DELETED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* core/types — the shared contract surface for agent-connector.
|
|
3
|
-
*
|
|
4
|
-
* Everything in this file is type-only (no runtime), so it is safe to import
|
|
5
|
-
* from anywhere without creating module cycles. It is the single source of
|
|
6
|
-
* truth that every adapter, the telemetry layer, the CLI, and the public API
|
|
7
|
-
* code against.
|
|
8
|
-
*
|
|
9
|
-
* Grounded in the understand-phase report (docs/research/understand-report.md)
|
|
10
|
-
* and generalized from context-mode's proven 15-platform adapter SPI:
|
|
11
|
-
* - context-mode hardcoded the served identity ("context-mode"); here the
|
|
12
|
-
* identity is a parameter the developer supplies via defineConnector().
|
|
13
|
-
* - context-mode's session/memory/FTS domain logic is removed from the SPI.
|
|
14
|
-
* - MCP server registration is modeled here (root key + format differ per
|
|
15
|
-
* platform, so adapters must render it — it is NOT "100% portable").
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Stable identifiers for every host platform agent-connector can target.
|
|
19
|
-
*
|
|
20
|
-
* NOTE on usage-only platforms: `"synthetic"` is a TELEMETRY-ONLY id
|
|
21
|
-
* (Octofriend / synthetic.new). It has a usage reader (usage/readers/synthetic)
|
|
22
|
-
* but DELIBERATELY no deploy adapter and no ADAPTER_REGISTRY entry — Octofriend
|
|
23
|
-
* exposes no writable MCP config to install into. The registry-completeness test
|
|
24
|
-
* (tests/adapters/registry-completeness.test.ts) allowlists it for this reason.
|
|
25
|
-
*/
|
|
26
|
-
type PlatformId = "claude-code" | "codex" | "cursor" | "vscode-copilot" | "jetbrains-copilot" | "copilot-cli" | "gemini-cli" | "opencode" | "kilo" | "kilo-cli" | "warp" | "hermes" | "openclaw" | "zed" | "antigravity" | "antigravity-cli" | "kiro" | "qwen-code" | "kimi" | "pi" | "omp" | "droid" | "roo-code" | "trae" | "amp" | "codebuff" | "mux" | "crush" | "goose" | "synthetic" | "unknown";
|
|
27
|
-
/**
|
|
28
|
-
* Hook I/O paradigm — the deepest cross-platform divergence (report §4).
|
|
29
|
-
* Canonical shipped sets (keep in sync with src/adapters/registry.ts — this
|
|
30
|
-
* comment once drifted and seeded a docs-wide misclassification):
|
|
31
|
-
* - "json-stdio" (16): host pipes JSON to a command on stdin, reads
|
|
32
|
-
* JSON/exit-code back — Claude Code, Codex, Cursor, VS Code/JetBrains
|
|
33
|
-
* Copilot, Copilot CLI, Gemini CLI, Qwen, Kiro, Kimi, Crush, Goose, Hermes,
|
|
34
|
-
* Droid (Factory), Antigravity (+ the agy CLI). One universal entrypoint
|
|
35
|
-
* binary handles all of them.
|
|
36
|
-
* - "ts-plugin" (4): host loads a JS/TS module exporting lifecycle functions
|
|
37
|
-
* — OpenCode, Kilo CLI, OMP, OpenClaw. Framework generates the module.
|
|
38
|
-
* - "mcp-only" (9): no hook layer at all — Warp, Kilo, Roo Code, Trae, Zed,
|
|
39
|
-
* Amp, Codebuff, Mux, Pi. Only the MCP server (or skills surface) is
|
|
40
|
-
* installed; hooks are reported unavailable.
|
|
41
|
-
*/
|
|
42
|
-
type HookParadigm = "json-stdio" | "ts-plugin" | "mcp-only";
|
|
43
|
-
/**
|
|
44
|
-
* Install scope, normalized across platforms and ordered low→high precedence.
|
|
45
|
-
* Each adapter maps these to a concrete config path and knows which it supports.
|
|
46
|
-
*/
|
|
47
|
-
type InstallScope = "system" | "user" | "project" | "profile" | "managed";
|
|
48
|
-
type Transport = "stdio" | "http" | "sse" | "ws";
|
|
49
|
-
interface ToolFilter {
|
|
50
|
-
/** Glob/exact tool names to expose. Default: ["*"]. */
|
|
51
|
-
include?: string[];
|
|
52
|
-
/** Glob/exact tool names to hide. */
|
|
53
|
-
exclude?: string[];
|
|
54
|
-
}
|
|
55
|
-
interface AuthSpec {
|
|
56
|
-
type: "oauth" | "bearerEnv" | "none";
|
|
57
|
-
/** Env var holding the bearer token when type === "bearerEnv". */
|
|
58
|
-
bearerEnvVar?: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* A normalized, transport-polymorphic MCP server descriptor. Declared ONCE by
|
|
62
|
-
* the developer; each adapter renders it into that platform's native dialect
|
|
63
|
-
* (root key, field names, format). Adapters that cannot honor a requested
|
|
64
|
-
* transport downgrade-or-skip and report it — they never throw.
|
|
65
|
-
*/
|
|
66
|
-
interface ServerDef {
|
|
67
|
-
transport: Transport;
|
|
68
|
-
command?: string;
|
|
69
|
-
args?: string[];
|
|
70
|
-
/** Env vars passed to the server process. Values support ${env:VAR} interpolation. */
|
|
71
|
-
env?: Record<string, string>;
|
|
72
|
-
cwd?: string;
|
|
73
|
-
url?: string;
|
|
74
|
-
headers?: Record<string, string>;
|
|
75
|
-
auth?: AuthSpec;
|
|
76
|
-
tools?: ToolFilter;
|
|
77
|
-
timeoutMs?: number;
|
|
78
|
-
/** Default true. When false, the entry is written disabled where supported. */
|
|
79
|
-
enabled?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Wrap the server with `agent-connector serve` so per-tool telemetry is
|
|
82
|
-
* captured transparently. Default: true for stdio servers when telemetry is
|
|
83
|
-
* enabled; false for remote servers (cannot intercept) and when explicitly off.
|
|
84
|
-
*/
|
|
85
|
-
wrapForTelemetry?: boolean;
|
|
86
|
-
}
|
|
87
|
-
/** Canonical, platform-agnostic lifecycle event names. */
|
|
88
|
-
type HookEventName = "SessionStart" | "SessionEnd" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "PreCompact" | "Stop" | "Notification";
|
|
89
|
-
interface BaseEvent {
|
|
90
|
-
/** Which host produced this event (from runtime detection). */
|
|
91
|
-
hostPlatform: PlatformId;
|
|
92
|
-
/** Connector id this event is dispatched to. */
|
|
93
|
-
connectorId: string;
|
|
94
|
-
/** Host session id (adapter-extracted; "" when the host provides none). */
|
|
95
|
-
sessionId: string;
|
|
96
|
-
/** Project directory if the host exposes one. */
|
|
97
|
-
projectDir?: string;
|
|
98
|
-
/** Raw host-specific payload for passthrough/escape-hatch use. */
|
|
99
|
-
raw: unknown;
|
|
100
|
-
}
|
|
101
|
-
interface PreToolUseEvent extends BaseEvent {
|
|
102
|
-
toolName: string;
|
|
103
|
-
toolInput: Record<string, unknown>;
|
|
104
|
-
}
|
|
105
|
-
interface PostToolUseEvent extends BaseEvent {
|
|
106
|
-
toolName: string;
|
|
107
|
-
toolInput: Record<string, unknown>;
|
|
108
|
-
toolOutput?: string;
|
|
109
|
-
isError?: boolean;
|
|
110
|
-
}
|
|
111
|
-
interface SessionStartEvent extends BaseEvent {
|
|
112
|
-
source: "startup" | "compact" | "resume" | "clear";
|
|
113
|
-
}
|
|
114
|
-
interface SessionEndEvent extends BaseEvent {
|
|
115
|
-
reason?: string;
|
|
116
|
-
}
|
|
117
|
-
interface UserPromptSubmitEvent extends BaseEvent {
|
|
118
|
-
prompt: string;
|
|
119
|
-
}
|
|
120
|
-
interface PreCompactEvent extends BaseEvent {
|
|
121
|
-
trigger?: "auto" | "manual";
|
|
122
|
-
}
|
|
123
|
-
interface StopEvent extends BaseEvent {
|
|
124
|
-
/** True when the stop hook itself was triggered during a previous stop hook. */
|
|
125
|
-
stopHookActive?: boolean;
|
|
126
|
-
}
|
|
127
|
-
interface NotificationEvent extends BaseEvent {
|
|
128
|
-
message: string;
|
|
129
|
-
}
|
|
130
|
-
/** Map of event name → its normalized payload type. */
|
|
131
|
-
interface EventPayloadMap {
|
|
132
|
-
SessionStart: SessionStartEvent;
|
|
133
|
-
SessionEnd: SessionEndEvent;
|
|
134
|
-
UserPromptSubmit: UserPromptSubmitEvent;
|
|
135
|
-
PreToolUse: PreToolUseEvent;
|
|
136
|
-
PostToolUse: PostToolUseEvent;
|
|
137
|
-
PreCompact: PreCompactEvent;
|
|
138
|
-
Stop: StopEvent;
|
|
139
|
-
Notification: NotificationEvent;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Normalized hook response. A handler returns a subset of these; the adapter
|
|
143
|
-
* formats it into the host's native reply (exit codes / JSON / control fields).
|
|
144
|
-
* Adapters drop fields the host cannot honor (e.g. updatedOutput where the host
|
|
145
|
-
* cannot rewrite tool output) and the framework reports the degradation.
|
|
146
|
-
*/
|
|
147
|
-
interface HookResponse {
|
|
148
|
-
/**
|
|
149
|
-
* - "allow": pass through (default when handler returns void)
|
|
150
|
-
* - "deny": block tool execution / stop the action
|
|
151
|
-
* - "modify": replace tool input (PreToolUse) with `updatedInput`
|
|
152
|
-
* - "context": inject `additionalContext` as soft guidance
|
|
153
|
-
* - "ask": prompt the user to confirm
|
|
154
|
-
*/
|
|
155
|
-
decision?: "allow" | "deny" | "modify" | "context" | "ask";
|
|
156
|
-
/** Shown to the model/user; required in spirit for deny/ask. */
|
|
157
|
-
reason?: string;
|
|
158
|
-
/** Replacement tool input — only meaningful with decision "modify". */
|
|
159
|
-
updatedInput?: Record<string, unknown>;
|
|
160
|
-
/** Extra context to inject — meaningful with "context" or on SessionStart. */
|
|
161
|
-
additionalContext?: string;
|
|
162
|
-
/** Rewritten tool output — only where the host supports it (PostToolUse). */
|
|
163
|
-
updatedOutput?: string;
|
|
164
|
-
}
|
|
165
|
-
/** A handler bound to one event, optionally filtered by a tool matcher. */
|
|
166
|
-
interface HookDefinition<E extends HookEventName = HookEventName> {
|
|
167
|
-
/**
|
|
168
|
-
* Regex string matched against the tool name (tool events only). Empty/omitted
|
|
169
|
-
* matches all. Rendered into each host's native matcher syntax where supported,
|
|
170
|
-
* else evaluated by the universal entrypoint at runtime.
|
|
171
|
-
*/
|
|
172
|
-
matcher?: string;
|
|
173
|
-
handler(event: EventPayloadMap[E]): HookResponse | void | Promise<HookResponse | void>;
|
|
174
|
-
}
|
|
175
|
-
/** Developer-declared hooks, keyed by canonical event name. */
|
|
176
|
-
interface HooksConfig {
|
|
177
|
-
SessionStart?: HookDefinition<"SessionStart">;
|
|
178
|
-
SessionEnd?: HookDefinition<"SessionEnd">;
|
|
179
|
-
UserPromptSubmit?: HookDefinition<"UserPromptSubmit">;
|
|
180
|
-
PreToolUse?: HookDefinition<"PreToolUse">;
|
|
181
|
-
PostToolUse?: HookDefinition<"PostToolUse">;
|
|
182
|
-
PreCompact?: HookDefinition<"PreCompact">;
|
|
183
|
-
Stop?: HookDefinition<"Stop">;
|
|
184
|
-
Notification?: HookDefinition<"Notification">;
|
|
185
|
-
}
|
|
186
|
-
/** What a given host can actually honor. The single-API layer degrades to it. */
|
|
187
|
-
interface PlatformCapabilities {
|
|
188
|
-
preToolUse: boolean;
|
|
189
|
-
postToolUse: boolean;
|
|
190
|
-
preCompact: boolean;
|
|
191
|
-
sessionStart: boolean;
|
|
192
|
-
sessionEnd: boolean;
|
|
193
|
-
userPromptSubmit: boolean;
|
|
194
|
-
stop: boolean;
|
|
195
|
-
notification: boolean;
|
|
196
|
-
/** Can a PreToolUse hook rewrite tool arguments? */
|
|
197
|
-
canModifyArgs: boolean;
|
|
198
|
-
/** Can a PostToolUse hook rewrite tool output? */
|
|
199
|
-
canModifyOutput: boolean;
|
|
200
|
-
/** Can a hook inject context at session start / compaction? */
|
|
201
|
-
canInjectSessionContext: boolean;
|
|
202
|
-
/** MCP transports this host can register. */
|
|
203
|
-
transports: Transport[];
|
|
204
|
-
/**
|
|
205
|
-
* Content-surface support (all OPTIONAL so existing adapter capability
|
|
206
|
-
* literals compile unchanged; read as `?? false`). Only surface-supporting
|
|
207
|
-
* adapters set these true. The BaseAdapter install/uninstall defaults
|
|
208
|
-
* handle the "unsupported" skip/warn regardless of the flag.
|
|
209
|
-
*/
|
|
210
|
-
supportsCommands?: boolean;
|
|
211
|
-
supportsSkills?: boolean;
|
|
212
|
-
supportsSubagents?: boolean;
|
|
213
|
-
}
|
|
214
|
-
/** Tool access expressed once; adapters render to allowed-tools / tools[] / readonly. */
|
|
215
|
-
interface SurfaceToolPolicy {
|
|
216
|
-
allow?: string[];
|
|
217
|
-
deny?: string[];
|
|
218
|
-
}
|
|
219
|
-
/** A slash command (= a Skill on 2026 Claude; adapters pick the right surface). */
|
|
220
|
-
interface CommandDef {
|
|
221
|
-
/** kebab-case; becomes the slash name and the filename stem. Source of truth. */
|
|
222
|
-
name: string;
|
|
223
|
-
/** One-line description for /help + model auto-selection. */
|
|
224
|
-
description?: string;
|
|
225
|
-
/** Prompt template body (markdown). The portable core of the command. */
|
|
226
|
-
prompt: string;
|
|
227
|
-
/** Shown in argument completion, e.g. "[environment]". */
|
|
228
|
-
argumentHint?: string;
|
|
229
|
-
tools?: SurfaceToolPolicy;
|
|
230
|
-
/** Model override (raw id or alias; adapters pass through or drop+warn). */
|
|
231
|
-
model?: string;
|
|
232
|
-
/** Force subagent / forked context where the platform supports it. */
|
|
233
|
-
subtask?: boolean;
|
|
234
|
-
/** Verbatim per-platform frontmatter additions (escape hatch). */
|
|
235
|
-
extra?: Record<string, unknown>;
|
|
236
|
-
}
|
|
237
|
-
/** An Agent Skill (folder + SKILL.md, Agent Skills open standard). */
|
|
238
|
-
interface SkillDef {
|
|
239
|
-
/** <=64 chars, [a-z0-9-]; MUST equal the skill dir name. Source of truth. */
|
|
240
|
-
name: string;
|
|
241
|
-
/** <=1024 chars, 3rd-person "what + when"; drives model auto-selection. Required. */
|
|
242
|
-
description: string;
|
|
243
|
-
/** SKILL.md markdown body (instructions). */
|
|
244
|
-
body: string;
|
|
245
|
-
tools?: SurfaceToolPolicy;
|
|
246
|
-
model?: string;
|
|
247
|
-
disableModelInvocation?: boolean;
|
|
248
|
-
/** Extra files bundled beside SKILL.md, relative path → contents. */
|
|
249
|
-
resources?: Record<string, string>;
|
|
250
|
-
extra?: Record<string, unknown>;
|
|
251
|
-
}
|
|
252
|
-
/** A named subagent (system-prompt + tool/model scoping). */
|
|
253
|
-
interface SubagentDef {
|
|
254
|
-
/** kebab-case identifier. Source of truth (filename stem on most platforms). */
|
|
255
|
-
name: string;
|
|
256
|
-
/** Delegation hint shown to the orchestrator. Required. */
|
|
257
|
-
description: string;
|
|
258
|
-
/** System prompt = the agent's instructions (markdown body / developer_instructions). */
|
|
259
|
-
prompt: string;
|
|
260
|
-
tools?: SurfaceToolPolicy;
|
|
261
|
-
/** Model: alias|full-id|"inherit". Default left to platform. */
|
|
262
|
-
model?: string;
|
|
263
|
-
/** Coarse permission knob → Cursor readonly, opencode/kilo permission map. */
|
|
264
|
-
readonly?: boolean;
|
|
265
|
-
extra?: Record<string, unknown>;
|
|
266
|
-
}
|
|
267
|
-
interface TelemetryConfig {
|
|
268
|
-
/** On by default. Global kill switch also via AGENT_CONNECTOR_TELEMETRY=0. */
|
|
269
|
-
enabled?: boolean;
|
|
270
|
-
/** Tokenizer family selection. "auto" infers from client/host. */
|
|
271
|
-
modelFamilyHint?: "auto" | "openai" | "anthropic" | "generic";
|
|
272
|
-
/** Tokenize tools/list schemas once → fixed per-turn tool-definition overhead. */
|
|
273
|
-
measureToolDefs?: boolean;
|
|
274
|
-
/** Opt-in network calibration (sends content off-box — off by default). */
|
|
275
|
-
calibration?: {
|
|
276
|
-
anthropicCountTokens?: boolean;
|
|
277
|
-
};
|
|
278
|
-
/**
|
|
279
|
-
* OPT-IN host-native turn-usage capture (off by default). When enabled, the
|
|
280
|
-
* Gemini / Antigravity adapters ALSO install an AfterModel / PostInvocation hook
|
|
281
|
-
* that reads the host's `usageMetadata` and records a DISTINCT `model_turn`
|
|
282
|
-
* telemetry row (confidence `host-native`). Whole-conversation, never summed with
|
|
283
|
-
* the per-MCP `call` rows. May also be forced on at install via the env switch
|
|
284
|
-
* AGENT_CONNECTOR_HOST_NATIVE=1. Aggregate counts only; no raw content stored.
|
|
285
|
-
*/
|
|
286
|
-
hostNativeUsage?: boolean;
|
|
287
|
-
/** Storage backend. NDJSON (default) needs no native deps; sqlite is an upgrade. */
|
|
288
|
-
store?: "ndjson" | "sqlite";
|
|
289
|
-
}
|
|
290
|
-
/** Per-platform override / escape hatch (report §3.2). */
|
|
291
|
-
interface PlatformOverride {
|
|
292
|
-
/** false → do not install hooks on this platform; object → merge/replace hooks. */
|
|
293
|
-
hooks?: boolean | Partial<HooksConfig>;
|
|
294
|
-
/** false → do not register the MCP server here; object → shallow-merge into ServerDef. */
|
|
295
|
-
server?: Partial<ServerDef> | false;
|
|
296
|
-
/** Force a specific scope for this platform. */
|
|
297
|
-
scope?: InstallScope;
|
|
298
|
-
/** false → skip command files on this platform. */
|
|
299
|
-
commands?: boolean;
|
|
300
|
-
/** false → skip skill files on this platform. */
|
|
301
|
-
skills?: boolean;
|
|
302
|
-
/** false → skip subagent files on this platform. */
|
|
303
|
-
subagents?: boolean;
|
|
304
|
-
/** Verbatim fields merged into the native config (reach platform-exclusive features). */
|
|
305
|
-
extra?: Record<string, unknown>;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Distribution metadata for the OFFICIAL MCP standard artifacts `package` can
|
|
309
|
-
* emit — the registry `server.json` and the MCPB `.mcpb` bundle. These describe
|
|
310
|
-
* the developer's REAL upstream MCP server (what a registry installer / Claude
|
|
311
|
-
* Desktop runs directly), NOT agent-connector's telemetry `serve` wrapper, so
|
|
312
|
-
* they need inputs the cross-platform install does not: the namespace the dev
|
|
313
|
-
* proved ownership of, their published package name, and bundle author info.
|
|
314
|
-
*
|
|
315
|
-
* All optional — a connector that never publishes to the registry or as a
|
|
316
|
-
* bundle can omit this entirely; the relevant `package --format` raises a clear,
|
|
317
|
-
* actionable error only when its required field is missing.
|
|
318
|
-
*/
|
|
319
|
-
interface PublishConfig {
|
|
320
|
-
/**
|
|
321
|
-
* Reverse-DNS namespace the developer OWNS, e.g. "io.github.acme" or
|
|
322
|
-
* "com.acme". server.json `name` is rendered as `${registryNamespace}/${id}`.
|
|
323
|
-
* agent-connector never mints a namespace on the dev's behalf — the registry
|
|
324
|
-
* requires proven ownership (the `mcp-publisher login` step the dev runs).
|
|
325
|
-
*/
|
|
326
|
-
registryNamespace?: string;
|
|
327
|
-
/**
|
|
328
|
-
* The developer's REAL published package that runs the MCP server, e.g.
|
|
329
|
-
* "@acme/acme-db-mcp" — server.json packages[].identifier. Required to emit a
|
|
330
|
-
* registry npm package entry (we cannot guess the published name).
|
|
331
|
-
*/
|
|
332
|
-
packageName?: string;
|
|
333
|
-
/** Package registry base URL. Default https://registry.npmjs.org for npm. */
|
|
334
|
-
registryBaseUrl?: string;
|
|
335
|
-
/** Bundle author. The MCPB manifest requires author.name. */
|
|
336
|
-
author?: {
|
|
337
|
-
name: string;
|
|
338
|
-
email?: string;
|
|
339
|
-
url?: string;
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
/** What a developer passes to defineConnector(). */
|
|
343
|
-
interface ConnectorConfig {
|
|
344
|
-
/** Stable connector id (kebab-case). Replaces context-mode's hardcoded identity. */
|
|
345
|
-
id: string;
|
|
346
|
-
displayName?: string;
|
|
347
|
-
version?: string;
|
|
348
|
-
/** The MCP server to deploy. Omit for a hooks-only connector. */
|
|
349
|
-
server?: ServerDef;
|
|
350
|
-
/** Lifecycle hooks. Omit for a server-only connector. */
|
|
351
|
-
hooks?: HooksConfig;
|
|
352
|
-
/** Telemetry options. Telemetry is ON by default even if this is omitted. */
|
|
353
|
-
telemetry?: TelemetryConfig;
|
|
354
|
-
/** Slash commands to deploy as native content files. */
|
|
355
|
-
commands?: CommandDef[];
|
|
356
|
-
/** Agent Skills to deploy as native content files. */
|
|
357
|
-
skills?: SkillDef[];
|
|
358
|
-
/** Named subagents to deploy as native content files. */
|
|
359
|
-
subagents?: SubagentDef[];
|
|
360
|
-
/** Per-platform overrides / escape hatches. */
|
|
361
|
-
platforms?: Partial<Record<PlatformId, PlatformOverride>>;
|
|
362
|
-
/** "auto" (all detected) or an explicit allow-list. Default "auto". */
|
|
363
|
-
targets?: "auto" | PlatformId[];
|
|
364
|
-
/** Distribution metadata for the registry server.json + MCPB bundle formats. */
|
|
365
|
-
publish?: PublishConfig;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* A validated, normalized connector — what defineConnector() returns and what
|
|
369
|
-
* adapters/CLI consume. All optional config fields are resolved to defaults.
|
|
370
|
-
*/
|
|
371
|
-
interface ResolvedConnector {
|
|
372
|
-
id: string;
|
|
373
|
-
displayName: string;
|
|
374
|
-
version: string;
|
|
375
|
-
server?: ServerDef;
|
|
376
|
-
hooks: HooksConfig;
|
|
377
|
-
hookEvents: HookEventName[];
|
|
378
|
-
telemetry: Required<Omit<TelemetryConfig, "calibration">> & {
|
|
379
|
-
calibration: {
|
|
380
|
-
anthropicCountTokens: boolean;
|
|
381
|
-
};
|
|
382
|
-
};
|
|
383
|
-
/** Normalized commands; defaults applied; [] when none. */
|
|
384
|
-
commands: CommandDef[];
|
|
385
|
-
/** Normalized skills; defaults applied; [] when none. */
|
|
386
|
-
skills: SkillDef[];
|
|
387
|
-
/** Normalized subagents; defaults applied; [] when none. */
|
|
388
|
-
subagents: SubagentDef[];
|
|
389
|
-
platforms: Partial<Record<PlatformId, PlatformOverride>>;
|
|
390
|
-
targets: "auto" | PlatformId[];
|
|
391
|
-
/** Distribution metadata (registry server.json + MCPB bundle); passed through verbatim. */
|
|
392
|
-
publish?: PublishConfig;
|
|
393
|
-
}
|
|
394
|
-
/** Result of detecting one platform on this machine. */
|
|
395
|
-
interface DetectedPlatform {
|
|
396
|
-
id: PlatformId;
|
|
397
|
-
name: string;
|
|
398
|
-
installed: boolean;
|
|
399
|
-
paradigm: HookParadigm;
|
|
400
|
-
capabilities: PlatformCapabilities;
|
|
401
|
-
/** Native config path that would be written for `scope`. */
|
|
402
|
-
configPath: string;
|
|
403
|
-
scope: InstallScope;
|
|
404
|
-
reason: string;
|
|
405
|
-
confidence: "high" | "medium" | "low";
|
|
406
|
-
}
|
|
407
|
-
interface ChangeRecord {
|
|
408
|
-
platform: PlatformId;
|
|
409
|
-
action: "create" | "update" | "skip" | "remove" | "warn";
|
|
410
|
-
/** File touched (when applicable). */
|
|
411
|
-
path?: string;
|
|
412
|
-
detail: string;
|
|
413
|
-
}
|
|
414
|
-
interface InstallResult {
|
|
415
|
-
connectorId: string;
|
|
416
|
-
dryRun: boolean;
|
|
417
|
-
changes: ChangeRecord[];
|
|
418
|
-
warnings: string[];
|
|
419
|
-
}
|
|
420
|
-
interface DiagnosticResult {
|
|
421
|
-
check: string;
|
|
422
|
-
status: "pass" | "fail" | "warn";
|
|
423
|
-
message: string;
|
|
424
|
-
fix?: string;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
export type { AuthSpec as A, ConnectorConfig as C, DetectedPlatform as D, EventPayloadMap as E, HookDefinition as H, InstallResult as I, NotificationEvent as N, PlatformCapabilities as P, ResolvedConnector as R, ServerDef as S, TelemetryConfig as T, UserPromptSubmitEvent as U, ChangeRecord as a, DiagnosticResult as b, HookEventName as c, HookParadigm as d, HookResponse as e, HooksConfig as f, InstallScope as g, PlatformId as h, PlatformOverride as i, PostToolUseEvent as j, PreCompactEvent as k, PreToolUseEvent as l, SessionEndEvent as m, SessionStartEvent as n, StopEvent as o, ToolFilter as p, Transport as q };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
uninstallConnector
|
|
4
|
-
} from "./chunk-7MSDGHJW.js";
|
|
5
|
-
import {
|
|
6
|
-
fail,
|
|
7
|
-
parseScope,
|
|
8
|
-
parseTargets,
|
|
9
|
-
print,
|
|
10
|
-
renderInstallResult
|
|
11
|
-
} from "./chunk-54EMKTTX.js";
|
|
12
|
-
import "./chunk-KHO5WNTP.js";
|
|
13
|
-
import "./chunk-XUCWLJY5.js";
|
|
14
|
-
import {
|
|
15
|
-
findConnectorConfig,
|
|
16
|
-
loadConnectorFromPath
|
|
17
|
-
} from "./chunk-LTT56GI3.js";
|
|
18
|
-
import "./chunk-XNAM7F35.js";
|
|
19
|
-
import "./chunk-TRQKHP7D.js";
|
|
20
|
-
|
|
21
|
-
// src/cli/commands/uninstall.ts
|
|
22
|
-
import { parseArgs } from "util";
|
|
23
|
-
async function resolveConnectorId(explicitId, connectorPath, projectDir) {
|
|
24
|
-
if (explicitId && explicitId.trim() !== "") return explicitId;
|
|
25
|
-
const configPath = connectorPath ?? findConnectorConfig(projectDir);
|
|
26
|
-
if (!configPath) return null;
|
|
27
|
-
const { connector } = await loadConnectorFromPath(configPath);
|
|
28
|
-
return connector.id;
|
|
29
|
-
}
|
|
30
|
-
async function run(argv) {
|
|
31
|
-
const { values } = parseArgs({
|
|
32
|
-
args: argv,
|
|
33
|
-
options: {
|
|
34
|
-
scope: { type: "string", default: "user" },
|
|
35
|
-
targets: { type: "string" },
|
|
36
|
-
connector: { type: "string" },
|
|
37
|
-
"connector-id": { type: "string" },
|
|
38
|
-
project: { type: "string" },
|
|
39
|
-
"dry-run": { type: "boolean", default: false },
|
|
40
|
-
purge: { type: "boolean", default: false }
|
|
41
|
-
},
|
|
42
|
-
allowPositionals: false
|
|
43
|
-
});
|
|
44
|
-
const projectDir = values.project ?? process.cwd();
|
|
45
|
-
const scope = parseScope(values.scope);
|
|
46
|
-
if (scope == null) return fail(`invalid --scope "${values.scope}" (use user|project)`);
|
|
47
|
-
const connectorId = await resolveConnectorId(
|
|
48
|
-
values["connector-id"],
|
|
49
|
-
values.connector,
|
|
50
|
-
projectDir
|
|
51
|
-
);
|
|
52
|
-
if (!connectorId) {
|
|
53
|
-
return fail(
|
|
54
|
-
"could not determine connector id. Pass --connector-id <id>, --connector <path>, or run inside a project with an agent-connector config."
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
const targets = parseTargets(values.targets);
|
|
58
|
-
const result = await uninstallConnector({
|
|
59
|
-
connectorId,
|
|
60
|
-
scope,
|
|
61
|
-
projectDir,
|
|
62
|
-
dryRun: values["dry-run"],
|
|
63
|
-
purge: values.purge,
|
|
64
|
-
...targets ? { targets } : {}
|
|
65
|
-
});
|
|
66
|
-
print(renderInstallResult(result, "uninstall"));
|
|
67
|
-
return result.changes.some((c) => c.action === "warn") ? 1 : 0;
|
|
68
|
-
}
|
|
69
|
-
export {
|
|
70
|
-
run
|
|
71
|
-
};
|
|
72
|
-
//# sourceMappingURL=uninstall-IGCKNOSF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/uninstall.ts"],"sourcesContent":["/**\n * cli/commands/uninstall — strip a connector's MCP + hook registrations.\n *\n * The connector id is taken from --connector-id, or inferred from the local\n * connector config (--connector <path> / findConnectorConfig). The installer's\n * uninstall orchestration loads the registered connector for context and removes\n * its entries from every resolved target.\n *\n * --purge additionally removes the framework-state this connector left behind:\n * its DATA-dir connector record (connectorDir(id)) and, when no connectors\n * remain, the shared home-bin launcher. Without --purge those linger so the\n * connector can be re-synced without re-registering.\n */\n\nimport { parseArgs } from \"node:util\";\n\nimport { uninstallConnector } from \"../../core/installer.js\";\nimport { findConnectorConfig, loadConnectorFromPath } from \"../../core/load-connector.js\";\nimport { fail, parseScope, parseTargets, print, renderInstallResult } from \"../app.js\";\n\n/** Resolve the connector id from flags, then from a local config file. */\nasync function resolveConnectorId(\n explicitId: string | undefined,\n connectorPath: string | undefined,\n projectDir: string,\n): Promise<string | null> {\n if (explicitId && explicitId.trim() !== \"\") return explicitId;\n const configPath = connectorPath ?? findConnectorConfig(projectDir);\n if (!configPath) return null;\n const { connector } = await loadConnectorFromPath(configPath);\n return connector.id;\n}\n\nexport async function run(argv: string[]): Promise<number> {\n const { values } = parseArgs({\n args: argv,\n options: {\n scope: { type: \"string\", default: \"user\" },\n targets: { type: \"string\" },\n connector: { type: \"string\" },\n \"connector-id\": { type: \"string\" },\n project: { type: \"string\" },\n \"dry-run\": { type: \"boolean\", default: false },\n purge: { type: \"boolean\", default: false },\n },\n allowPositionals: false,\n });\n\n const projectDir = values.project ?? process.cwd();\n\n const scope = parseScope(values.scope);\n if (scope == null) return fail(`invalid --scope \"${values.scope}\" (use user|project)`);\n\n const connectorId = await resolveConnectorId(\n values[\"connector-id\"],\n values.connector,\n projectDir,\n );\n if (!connectorId) {\n return fail(\n \"could not determine connector id. Pass --connector-id <id>, \" +\n \"--connector <path>, or run inside a project with an agent-connector config.\",\n );\n }\n\n const targets = parseTargets(values.targets);\n\n const result = await uninstallConnector({\n connectorId,\n scope,\n projectDir,\n dryRun: values[\"dry-run\"],\n purge: values.purge,\n ...(targets ? { targets } : {}),\n });\n\n print(renderInstallResult(result, \"uninstall\"));\n return result.changes.some((c) => c.action === \"warn\") ? 1 : 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,iBAAiB;AAO1B,eAAe,mBACb,YACA,eACA,YACwB;AACxB,MAAI,cAAc,WAAW,KAAK,MAAM,GAAI,QAAO;AACnD,QAAM,aAAa,iBAAiB,oBAAoB,UAAU;AAClE,MAAI,CAAC,WAAY,QAAO;AACxB,QAAM,EAAE,UAAU,IAAI,MAAM,sBAAsB,UAAU;AAC5D,SAAO,UAAU;AACnB;AAEA,eAAsB,IAAI,MAAiC;AACzD,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC3B,MAAM;AAAA,IACN,SAAS;AAAA,MACP,OAAO,EAAE,MAAM,UAAU,SAAS,OAAO;AAAA,MACzC,SAAS,EAAE,MAAM,SAAS;AAAA,MAC1B,WAAW,EAAE,MAAM,SAAS;AAAA,MAC5B,gBAAgB,EAAE,MAAM,SAAS;AAAA,MACjC,SAAS,EAAE,MAAM,SAAS;AAAA,MAC1B,WAAW,EAAE,MAAM,WAAW,SAAS,MAAM;AAAA,MAC7C,OAAO,EAAE,MAAM,WAAW,SAAS,MAAM;AAAA,IAC3C;AAAA,IACA,kBAAkB;AAAA,EACpB,CAAC;AAED,QAAM,aAAa,OAAO,WAAW,QAAQ,IAAI;AAEjD,QAAM,QAAQ,WAAW,OAAO,KAAK;AACrC,MAAI,SAAS,KAAM,QAAO,KAAK,oBAAoB,OAAO,KAAK,sBAAsB;AAErF,QAAM,cAAc,MAAM;AAAA,IACxB,OAAO,cAAc;AAAA,IACrB,OAAO;AAAA,IACP;AAAA,EACF;AACA,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,MACL;AAAA,IAEF;AAAA,EACF;AAEA,QAAM,UAAU,aAAa,OAAO,OAAO;AAE3C,QAAM,SAAS,MAAM,mBAAmB;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,OAAO,SAAS;AAAA,IACxB,OAAO,OAAO;AAAA,IACd,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC/B,CAAC;AAED,QAAM,oBAAoB,QAAQ,WAAW,CAAC;AAC9C,SAAO,OAAO,QAAQ,KAAK,CAAC,MAAM,EAAE,WAAW,MAAM,IAAI,IAAI;AAC/D;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/upgrade.ts"],"sourcesContent":["/**\n * cli/commands/upgrade — bring an agent-connector install current.\n *\n * `upgrade` (aliases: `update`, `sync`) consolidates the two former verbs into\n * ONE the way npm/brew pair `install` + `upgrade`, so there is a single verb to\n * learn for \"make everything current\". It:\n *\n * 1. re-renders the connector's config into every target host idempotently\n * (identical entries report \"skip\"), exactly like the old `sync` — this is\n * also the self-heal path: run `upgrade` to repair a drifted install; then\n * 2. refreshes the stable home-bin pointer and prints managed (never-silent)\n * update guidance for the chosen channel, exactly like the old `update`.\n *\n * When no connector config is resolvable it still does step 2, so `upgrade`\n * works as a pure tool-refresh from anywhere. By design agent-connector NEVER\n * silently auto-updates (docs/ARCHITECTURE.md §3 R1).\n */\n\nimport { parseArgs } from \"node:util\";\n\nimport { resolveCliEntry, syncConnector } from \"../../core/installer.js\";\nimport { findConnectorConfig, loadConnectorFromPath } from \"../../core/load-connector.js\";\nimport { ensureHomeBin, homeBinPath } from \"../../core/paths.js\";\nimport { fail, parseScope, parseTargets, print, renderInstallResult } from \"../app.js\";\n\ntype Channel = \"stable\" | \"latest\";\n\n/** Heuristic: does the running CLI live under an npm-style node_modules tree? */\nfunction looksNpmManaged(): boolean {\n const entry = resolveCliEntry().replace(/\\\\/g, \"/\");\n return entry.includes(\"/node_modules/\");\n}\n\nexport async function run(argv: string[]): Promise<number> {\n const { values } = parseArgs({\n args: argv,\n options: {\n channel: { type: \"string\", default: \"stable\" },\n scope: { type: \"string\", default: \"user\" },\n targets: { type: \"string\" },\n connector: { type: \"string\" },\n project: { type: \"string\" },\n \"dry-run\": { type: \"boolean\", default: false },\n },\n allowPositionals: false,\n });\n\n const channel = values.channel;\n if (channel !== \"stable\" && channel !== \"latest\") {\n return fail(`invalid --channel \"${channel}\" (use stable|latest)`);\n }\n const ch: Channel = channel;\n\n const scope = parseScope(values.scope);\n if (scope == null) return fail(`invalid --scope \"${values.scope}\" (use user|project)`);\n\n let hadWarn = false;\n\n // ── Step 1: re-render the connector into every target host (former `sync`). ──\n const projectDir = values.project ?? process.cwd();\n const configPath = values.connector ?? findConnectorConfig(projectDir);\n if (configPath) {\n const { connector, modulePath } = await loadConnectorFromPath(configPath);\n const targets = parseTargets(values.targets);\n const result = await syncConnector({\n connector,\n modulePath,\n scope,\n projectDir,\n dryRun: values[\"dry-run\"],\n ...(targets ? { targets } : {}),\n });\n print(renderInstallResult(result, \"upgrade\"));\n if (result.changes.some((c) => c.action === \"warn\")) hadWarn = true;\n print(\"\");\n } else {\n print(\"upgrade: no connector config found — refreshing the tool only.\");\n print(\n \"(pass --connector <path> or run inside a project to also re-render host config.)\\n\",\n );\n }\n\n // ── Step 2: managed update guidance + home-bin pointer refresh (former `update`). ──\n print(\"agent-connector uses managed (explicit) updates — never silent\");\n print(\"auto-update — so one bad release can't break every project at once.\\n\");\n\n const dist = ch === \"stable\" ? \"latest\" : \"next\";\n if (looksNpmManaged()) {\n print(`To update the ${ch} channel, run:`);\n print(` npm i -g @ken-jo/agent-connector@${dist}`);\n } else {\n print(\n `This install does not look npm-managed. Update it the way you installed it,`,\n );\n print(`then re-run \\`agent-connector upgrade\\` to refresh the home pointer.`);\n print(`(npm installs would use: npm i -g @ken-jo/agent-connector@${dist})`);\n }\n\n // Refresh the stable home-bin pointer so hosts keep execing a working CLI.\n if (!values[\"dry-run\"]) {\n try {\n const binPath = ensureHomeBin(resolveCliEntry());\n print(`\\nRefreshed home binary pointer: ${binPath}`);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n print(`\\n[warn] could not refresh home binary at ${homeBinPath()}: ${message}`);\n return 1;\n }\n }\n\n return hadWarn ? 1 : 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,iBAAiB;AAU1B,SAAS,kBAA2B;AAClC,QAAM,QAAQ,gBAAgB,EAAE,QAAQ,OAAO,GAAG;AAClD,SAAO,MAAM,SAAS,gBAAgB;AACxC;AAEA,eAAsB,IAAI,MAAiC;AACzD,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC3B,MAAM;AAAA,IACN,SAAS;AAAA,MACP,SAAS,EAAE,MAAM,UAAU,SAAS,SAAS;AAAA,MAC7C,OAA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