@ken-jo/agent-connector 0.4.79 → 0.4.91

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.
Files changed (110) hide show
  1. package/README.md +3 -3
  2. package/dist/{action-OHGFVKMC.js → action-L44DXFHT.js} +9 -9
  3. package/dist/antigravity-cli-JO6GUTV7.js +436 -0
  4. package/dist/antigravity-cli-JO6GUTV7.js.map +1 -0
  5. package/dist/{chunk-X457NOFE.js → chunk-25CPWJA7.js} +91 -11
  6. package/dist/chunk-25CPWJA7.js.map +1 -0
  7. package/dist/{chunk-VKRGQLY4.js → chunk-7HUUINPB.js} +18 -18
  8. package/dist/{chunk-LKAVD4HP.js → chunk-BLTVZACS.js} +8 -8
  9. package/dist/{chunk-PZHB5TVA.js → chunk-G4CEELKO.js} +2 -2
  10. package/dist/{chunk-VD4EG6SG.js → chunk-KIRCPLM4.js} +5 -5
  11. package/dist/{chunk-ZXX5DVSE.js → chunk-LAIITCMW.js} +6 -6
  12. package/dist/{chunk-UYZ53KWS.js → chunk-LF76VPGQ.js} +5 -5
  13. package/dist/{chunk-IRUYJD23.js → chunk-NLE2J5P4.js} +1 -1
  14. package/dist/{chunk-7NXEHZAK.js → chunk-NWLRJNXM.js} +2 -2
  15. package/dist/{chunk-YJP3KGLM.js → chunk-QARPXSIV.js} +4 -4
  16. package/dist/{chunk-AMK2K6XZ.js → chunk-R6LML2YS.js} +2 -2
  17. package/dist/{chunk-S4E6QQEM.js → chunk-ZMLVR4J7.js} +7 -2
  18. package/dist/chunk-ZMLVR4J7.js.map +1 -0
  19. package/dist/{claude-code-T6ZRCMA7.js → claude-code-WS4NAGZT.js} +4 -4
  20. package/dist/cli/sdk.js +4 -4
  21. package/dist/cli.js +1 -1
  22. package/dist/codebuddy-RBEZGXBG.js +643 -0
  23. package/dist/codebuddy-RBEZGXBG.js.map +1 -0
  24. package/dist/{codex-RHKQKNNG.js → codex-ZZ434GYR.js} +4 -4
  25. package/dist/{detect-ALAKE54S.js → detect-3S46RUMK.js} +4 -4
  26. package/dist/devin-PRJY2TTD.js +510 -0
  27. package/dist/devin-PRJY2TTD.js.map +1 -0
  28. package/dist/{doctor-UNF7FCF4.js → doctor-3CUBPQKU.js} +14 -14
  29. package/dist/grok-cli-5QD235UB.js +482 -0
  30. package/dist/grok-cli-5QD235UB.js.map +1 -0
  31. package/dist/{hook-GM2IDA3C.js → hook-P6EKDINW.js} +9 -9
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.js +2 -2
  34. package/dist/{install-7O4XWH7T.js → install-7DMK53SB.js} +10 -10
  35. package/dist/{introspect-5o5ick0_.d.ts → introspect-DYOIX8Ov.d.ts} +1 -1
  36. package/dist/{jetbrains-copilot-4IOT3I2Y.js → jetbrains-copilot-T2EPKROP.js} +9 -3
  37. package/dist/jetbrains-copilot-T2EPKROP.js.map +1 -0
  38. package/dist/junie-SQ4SDLGK.js +227 -0
  39. package/dist/junie-SQ4SDLGK.js.map +1 -0
  40. package/dist/{kilo-TAHOPT2Q.js → kilo-OU2ZLZKB.js} +4 -4
  41. package/dist/{kilo-cli-X4NPJWGX.js → kilo-cli-NMWGYF4F.js} +4 -4
  42. package/dist/{kiro-YZ4TTZGD.js → kiro-4IN5IH46.js} +77 -2
  43. package/dist/kiro-4IN5IH46.js.map +1 -0
  44. package/dist/{leaderboard-DVW4WYJ6.js → leaderboard-LF5SP6X2.js} +4 -4
  45. package/dist/mistral-vibe-TRQDHAWV.js +300 -0
  46. package/dist/mistral-vibe-TRQDHAWV.js.map +1 -0
  47. package/dist/open-interpreter-4PKL56AA.js +264 -0
  48. package/dist/open-interpreter-4PKL56AA.js.map +1 -0
  49. package/dist/openhands-5LNH3BKB.js +384 -0
  50. package/dist/openhands-5LNH3BKB.js.map +1 -0
  51. package/dist/{package-H5V3AZHR.js → package-2EAIYSJ4.js} +7 -7
  52. package/dist/{pi-I7BLL4EI.js → pi-BUADR5MJ.js} +139 -2
  53. package/dist/pi-BUADR5MJ.js.map +1 -0
  54. package/dist/{qwen-code-JG7AF442.js → qwen-code-TUJNHKNI.js} +4 -4
  55. package/dist/runtime/index.d.ts +1 -1
  56. package/dist/runtime/index.js +7 -7
  57. package/dist/sdk/index.d.ts +3 -3
  58. package/dist/sdk/index.js +3 -3
  59. package/dist/sdk/test.d.ts +2 -2
  60. package/dist/sdk/test.js +7 -7
  61. package/dist/{serve-WMO2TUW3.js → serve-K62FW3V7.js} +9 -9
  62. package/dist/{status-WRLBTBRE.js → status-E5MCFZM6.js} +7 -7
  63. package/dist/{statusline-EUD4DMIP.js → statusline-LIPF2KVP.js} +8 -8
  64. package/dist/{telemetry-U3LGMR3D.js → telemetry-4OC56NTM.js} +5 -5
  65. package/dist/{types-D6RWGXm1.d.ts → types-C4qMgbJn.d.ts} +10 -9
  66. package/dist/{uninstall-TWPUEJEC.js → uninstall-2YYKN5DX.js} +10 -10
  67. package/dist/{upgrade-EM6Y7QLH.js → upgrade-55AFPJEF.js} +10 -10
  68. package/dist/{usage-3HQDTXGY.js → usage-3PB3WZSL.js} +3 -3
  69. package/dist/{usage-event-DWIGKO7V.js → usage-event-KD5FW6W4.js} +8 -8
  70. package/dist/{zed-LLOAUXSA.js → zed-ZF2OQ75O.js} +119 -3
  71. package/dist/zed-ZF2OQ75O.js.map +1 -0
  72. package/package.json +1 -1
  73. package/dist/antigravity-cli-KODEKUTM.js +0 -87
  74. package/dist/antigravity-cli-KODEKUTM.js.map +0 -1
  75. package/dist/chunk-S4E6QQEM.js.map +0 -1
  76. package/dist/chunk-X457NOFE.js.map +0 -1
  77. package/dist/jetbrains-copilot-4IOT3I2Y.js.map +0 -1
  78. package/dist/kiro-YZ4TTZGD.js.map +0 -1
  79. package/dist/pi-I7BLL4EI.js.map +0 -1
  80. package/dist/zed-LLOAUXSA.js.map +0 -1
  81. /package/dist/{action-OHGFVKMC.js.map → action-L44DXFHT.js.map} +0 -0
  82. /package/dist/{chunk-VKRGQLY4.js.map → chunk-7HUUINPB.js.map} +0 -0
  83. /package/dist/{chunk-LKAVD4HP.js.map → chunk-BLTVZACS.js.map} +0 -0
  84. /package/dist/{chunk-PZHB5TVA.js.map → chunk-G4CEELKO.js.map} +0 -0
  85. /package/dist/{chunk-VD4EG6SG.js.map → chunk-KIRCPLM4.js.map} +0 -0
  86. /package/dist/{chunk-ZXX5DVSE.js.map → chunk-LAIITCMW.js.map} +0 -0
  87. /package/dist/{chunk-UYZ53KWS.js.map → chunk-LF76VPGQ.js.map} +0 -0
  88. /package/dist/{chunk-IRUYJD23.js.map → chunk-NLE2J5P4.js.map} +0 -0
  89. /package/dist/{chunk-7NXEHZAK.js.map → chunk-NWLRJNXM.js.map} +0 -0
  90. /package/dist/{chunk-YJP3KGLM.js.map → chunk-QARPXSIV.js.map} +0 -0
  91. /package/dist/{chunk-AMK2K6XZ.js.map → chunk-R6LML2YS.js.map} +0 -0
  92. /package/dist/{claude-code-T6ZRCMA7.js.map → claude-code-WS4NAGZT.js.map} +0 -0
  93. /package/dist/{codex-RHKQKNNG.js.map → codex-ZZ434GYR.js.map} +0 -0
  94. /package/dist/{detect-ALAKE54S.js.map → detect-3S46RUMK.js.map} +0 -0
  95. /package/dist/{doctor-UNF7FCF4.js.map → doctor-3CUBPQKU.js.map} +0 -0
  96. /package/dist/{hook-GM2IDA3C.js.map → hook-P6EKDINW.js.map} +0 -0
  97. /package/dist/{install-7O4XWH7T.js.map → install-7DMK53SB.js.map} +0 -0
  98. /package/dist/{kilo-TAHOPT2Q.js.map → kilo-OU2ZLZKB.js.map} +0 -0
  99. /package/dist/{kilo-cli-X4NPJWGX.js.map → kilo-cli-NMWGYF4F.js.map} +0 -0
  100. /package/dist/{leaderboard-DVW4WYJ6.js.map → leaderboard-LF5SP6X2.js.map} +0 -0
  101. /package/dist/{package-H5V3AZHR.js.map → package-2EAIYSJ4.js.map} +0 -0
  102. /package/dist/{qwen-code-JG7AF442.js.map → qwen-code-TUJNHKNI.js.map} +0 -0
  103. /package/dist/{serve-WMO2TUW3.js.map → serve-K62FW3V7.js.map} +0 -0
  104. /package/dist/{status-WRLBTBRE.js.map → status-E5MCFZM6.js.map} +0 -0
  105. /package/dist/{statusline-EUD4DMIP.js.map → statusline-LIPF2KVP.js.map} +0 -0
  106. /package/dist/{telemetry-U3LGMR3D.js.map → telemetry-4OC56NTM.js.map} +0 -0
  107. /package/dist/{uninstall-TWPUEJEC.js.map → uninstall-2YYKN5DX.js.map} +0 -0
  108. /package/dist/{upgrade-EM6Y7QLH.js.map → upgrade-55AFPJEF.js.map} +0 -0
  109. /package/dist/{usage-3HQDTXGY.js.map → usage-3PB3WZSL.js.map} +0 -0
  110. /package/dist/{usage-event-DWIGKO7V.js.map → usage-event-KD5FW6W4.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/junie/index.ts"],"sourcesContent":["/**\n * adapters/junie — Junie (JetBrains' own LLM-agnostic coding agent) adapter.\n *\n * Junie is JetBrains' OWN coding agent (\"An LLM-agnostic coding agent built for\n * real-world development — by JetBrains\", github.com/JetBrains/junie). It is\n * DISTINCT from the `jetbrains-copilot` adapter, which targets GitHub Copilot\n * running inside JetBrains IDEs. Junie ships as a terminal CLI (`junie`,\n * installed via junie.jetbrains.com/install.sh, Homebrew, or\n * `npm i -g @jetbrains/junie`) and also runs inside JetBrains IDEs / CI.\n *\n * From agent-connector's hook-paradigm perspective Junie is **mcp-only**: the\n * first-party docs (junie.jetbrains.com/docs) document NO user-installable\n * lifecycle hook / event-callback surface — only MCP server registration,\n * Agent Skills, subagents, custom slash commands, and guidelines/memory. So MCP\n * registration is the only runtime surface this adapter installs and every hook\n * capability is reported false. (Content surfaces exist natively but are not\n * wired here — see the capabilities note.)\n *\n * MCP config (BYTE-CONFIRMED — junie.jetbrains.com/docs/junie-cli-mcp-configuration.html,\n * \"Junie CLI uses the same MCP JSON configuration as Junie in JetBrains IDEs\"):\n * - PROJECT scope → <projectDir>/.junie/mcp/mcp.json (\"can be checked into\n * version control and shared across all team members\").\n * - USER scope → ~/.junie/mcp/mcp.json (\"available across all projects on\n * your machine while remaining private to your user account\").\n * - root key \"mcpServers\" — a JSON object/map keyed by server name.\n *\n * Server entry shapes (BYTE-CONFIRMED from the docs' verbatim JSON example):\n * - stdio: { command, args?, env? }\n * - remote: { url, headers? } — the key is `url` (NOT `serverUrl`); there is\n * NO `type` discriminator and NO `disabled` field. stdio vs remote is\n * distinguished by `command` vs `url`. `headers` is emitted only when the\n * connector's remote server provides them.\n *\n * Env interpolation: the docs example carries literal `env` values and document\n * no portable native `${env:VAR}` token for the MCP file, so every `${env:VAR}`\n * reference is resolved to a literal at install time (the safe path, same as\n * cline / windsurf / droid).\n *\n * The hook \"config path\" is aliased to the MCP file (no separate hook file) so\n * the generic doctor/backup helpers behave sensibly (the windsurf/cline idiom).\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 { buildWrappedStdio } from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"junie\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/**\n * Native MCP server entry shapes Junie accepts under `mcpServers` (an OBJECT map\n * keyed by server name):\n * - stdio: { command, args?, env? } — transport inferred from `command`.\n * - remote: { url, headers? } — `url` (NOT `serverUrl`); NO `type`\n * discriminator and NO `disabled` flag. `headers` only when provided.\n */\ninterface JunieStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n}\ninterface JunieRemoteServer {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport class JunieAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Junie\";\n readonly paradigm: HookParadigm = \"mcp-only\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: BaseAdapter AGENTS.md-first default. Junie documents its\n // own guidelines/memory surface; AC's AGENTS.md default lands in the open\n // standard file Junie also reads. (Junie-specific guideline files are not\n // wired here — the AGENTS.md default is the host-agnostic baseline.)\n supportsMemory: true,\n //\n // mcp-only: Junie documents NO user-installable lifecycle hook / event-\n // callback surface (junie.jetbrains.com/docs). Every hook flag 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 // No hook layer → no arg/output rewrite, no context injection.\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: false,\n // Junie registers stdio MCP servers (Local: Docker/npx/binary) and remote\n // (HTTP/HTTPS) servers — the remote entry is distinguished by `url` (vs\n // stdio's `command`).\n transports: [\"stdio\", \"http\"],\n // Content surfaces (Agent Skills, subagents, custom slash commands) exist\n // natively in Junie but are NOT wired by this adapter — the initial scope is\n // MCP-only. They stay UNSET so the base skip-warns; this is an honest\n // CEILING, not a host gap.\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".junie\");\n const userMcp = join(userDir, \"mcp\", \"mcp.json\");\n // ~/.junie/allowlist.json is Junie CLI's action-allowlist file\n // (byte-confirmed — junie.jetbrains.com/docs/junie-cli.html), so the dir's\n // presence is a strong CLI-installed marker.\n const projectDirJunie = join(projectDir, \".junie\");\n const installed = existsSync(userDir) || existsSync(projectDirJunie);\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath: userMcp,\n scope: \"user\",\n reason: installed\n ? `found Junie config under ${userDir}`\n : `no Junie config at ${userDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /**\n * Junie's MCP config dir is `<scope-root>/.junie/mcp`: project scope at\n * <projectDir>/.junie/mcp, user scope at ~/.junie/mcp (BYTE-CONFIRMED —\n * junie.jetbrains.com/docs/junie-cli-mcp-configuration.html).\n */\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".junie\", \"mcp\")\n : join(homedir(), \".junie\", \"mcp\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.json\");\n }\n\n /**\n * Junie has no separate hook file — the hook config path aliases the MCP file\n * so the generic doctor/backup helpers behave sensibly (windsurf/cline idiom).\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 junie\"\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\n // NEVER clobber a malformed `mcpServers`. The base upsert tolerates a\n // missing file / missing key (it creates the object), but a PRESENT-but-\n // non-object `mcpServers` (e.g. an array or string from a hand-edit) would\n // get a named property bolted on and silently corrupted — so skip-and-warn.\n const malformed = this.malformedRootKey(serverPath);\n if (malformed) return [malformed];\n\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 const malformed = this.malformedRootKey(serverPath);\n if (malformed) return [malformed];\n return [\n this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /**\n * Guard for a PRESENT-but-non-object `mcpServers` root key: returns a\n * skip-warn ChangeRecord when the existing config parses but its `mcpServers`\n * value is not a plain object (an array / string / number / null). Returns\n * undefined when the file is absent, unparseable (the base upsert's own\n * overwrite guard handles that), or `mcpServers` is absent / a plain object.\n */\n private malformedRootKey(configPath: string): ChangeRecord | undefined {\n const cfg = this.readJson<Record<string, unknown>>(configPath);\n if (!cfg || !(MCP_ROOT_KEY in cfg)) return undefined;\n const root = cfg[MCP_ROOT_KEY];\n if (root !== null && typeof root === \"object\" && !Array.isArray(root)) {\n return undefined;\n }\n return {\n platform: this.id,\n action: \"warn\",\n path: configPath,\n detail: `existing ${MCP_ROOT_KEY} in ${configPath} is not an object map; left untouched (back it up / fix it, then re-run)`,\n };\n }\n\n /** Render a normalized ServerDef into Junie's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): JunieStdioServer | JunieRemoteServer {\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 ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\n\n // Junie documents no native interpolation token for the MCP file, so\n // resolve every ${env:VAR} to a literal at install time.\n const entry: JunieStdioServer = {\n command: resolveEnvRefsDeep(command),\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 // http (and any other remote transport we surface) — Junie registers a\n // remote URL under `url` (NOT `serverUrl`). NO `type` discriminator, NO\n // `disabled`. `headers` only when the connector's remote server provides them.\n const entry: JunieRemoteServer = {\n url: resolveEnvRefsDeep(server.url ?? \"\"),\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. Junie 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 — Junie is mcp-only) ──────────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Junie 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 (Junie is mcp-only)\",\n },\n ];\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 // Only assert what the connector declares: a server-less connector\n // never writes 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 JunieAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;AA0CA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAiBrB,IAAM,OAAmB;AACzB,IAAM,eAAe;AAmBd,IAA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A,IACF;AAAA,EACF;AAAA;AAAA,EAIS,gBAAgB,KAA6C;AACpE,UAAM,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;AAGX,cAAI,CAAC,IAAI,UAAU,QAAQ;AACzB,mBAAO,EAAE,QAAQ,MAAM,QAAQ,yBAAyB;AAAA,UAC1D;AACA,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,aAAa;AACxC,IAAO,gBAAQ;","names":["entry"]}
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- renderBridgePrelude
4
- } from "./chunk-FBJQGRET.js";
5
2
  import {
6
3
  xdgConfigHome
7
4
  } from "./chunk-UM5S7DKK.js";
5
+ import {
6
+ renderBridgePrelude
7
+ } from "./chunk-FBJQGRET.js";
8
8
  import {
9
9
  resolveEnvRefsDeep
10
10
  } from "./chunk-BEFVJ2OE.js";
@@ -842,4 +842,4 @@ export {
842
842
  adapter,
843
843
  kilo_default as default
844
844
  };
845
- //# sourceMappingURL=kilo-TAHOPT2Q.js.map
845
+ //# sourceMappingURL=kilo-OU2ZLZKB.js.map
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- renderBridgePrelude
4
- } from "./chunk-FBJQGRET.js";
5
2
  import {
6
3
  xdgConfigHome
7
4
  } from "./chunk-UM5S7DKK.js";
5
+ import {
6
+ renderBridgePrelude
7
+ } from "./chunk-FBJQGRET.js";
8
8
  import {
9
9
  resolveEnvRefsDeep
10
10
  } from "./chunk-BEFVJ2OE.js";
@@ -795,4 +795,4 @@ export {
795
795
  adapter,
796
796
  kilo_cli_default as default
797
797
  };
798
- //# sourceMappingURL=kilo-cli-X4NPJWGX.js.map
798
+ //# sourceMappingURL=kilo-cli-NMWGYF4F.js.map
@@ -75,7 +75,13 @@ var KiroAdapter = class extends BaseAdapter {
75
75
  transports: ["stdio", "http"],
76
76
  // Skills: Kiro reads SKILL.md from .kiro/skills/<name>/SKILL.md (project)
77
77
  // and ~/.kiro/skills/<name>/SKILL.md (user).
78
- supportsSkills: true
78
+ supportsSkills: true,
79
+ // Actions: Kiro reads `.kiro/hooks/<id>.kiro.hook` Manual-Trigger +
80
+ // Shell-Command hooks (when.type "manual" + then.type "runCommand"),
81
+ // user-invokable from the Agent Hooks panel / Command Palette. WORKSPACE
82
+ // (project) scope ONLY — Kiro does not scan ~/.kiro/hooks/ — so user scope
83
+ // warn-skips (see installActions).
84
+ supportsActions: true
79
85
  };
80
86
  // ── Detection ────────────────────────────────────────────────────────────
81
87
  detectInstalled(projectDir) {
@@ -252,6 +258,75 @@ var KiroAdapter = class extends BaseAdapter {
252
258
  renderSkill(skill) {
253
259
  return renderSkillMd(skill);
254
260
  }
261
+ // ── Action surface (one owned .kiro.hook per action; PROJECT scope only) ──
262
+ // Kiro reads `<projectDir>/.kiro/hooks/<id>.kiro.hook` (JSON): a Manual-Trigger
263
+ // (`when.type "manual"`) + Shell-Command (`then.type "runCommand"`, `command`)
264
+ // hook, user-invokable from the Agent Hooks panel / Command Palette
265
+ // (kiro.dev/docs/hooks). The command execs `<homeBin> action kiro <id>
266
+ // --connector <id>`. Each file is FULLY OWNED → uninstall removes it.
267
+ // SCOPE: Kiro discovers hooks ONLY from the workspace `.kiro/hooks/` dir
268
+ // (~/.kiro/hooks/ is NOT scanned), so user scope warn-skips (mirrors warp's
269
+ // project-only precedent) rather than writing a file Kiro would never load.
270
+ actionHookPath(ctx, id) {
271
+ return join(ctx.projectDir, ".kiro", "hooks", `${id}.kiro.hook`);
272
+ }
273
+ installActions(ctx) {
274
+ const { connector } = ctx;
275
+ if (connector.platforms[HOST]?.actions === false) {
276
+ return [{ platform: this.id, action: "skip", detail: "actions disabled for kiro" }];
277
+ }
278
+ const triggers = this.actionTriggers(ctx);
279
+ if (triggers.length === 0) {
280
+ return [{ platform: this.id, action: "skip", detail: "connector declares no actions" }];
281
+ }
282
+ if (ctx.scope !== "project") {
283
+ return [
284
+ {
285
+ platform: this.id,
286
+ action: "warn",
287
+ detail: `kiro actions are project-scoped only (Kiro does not scan ~/.kiro/hooks/); ${triggers.length} skipped`
288
+ }
289
+ ];
290
+ }
291
+ return triggers.map(
292
+ (trigger) => this.writeContentFile(
293
+ this.actionHookPath(ctx, trigger.id),
294
+ this.renderActionHook(trigger.label, trigger.description, trigger.command),
295
+ ctx.dryRun
296
+ )
297
+ );
298
+ }
299
+ uninstallActions(ctx) {
300
+ const { connector } = ctx;
301
+ if (connector.actions.length === 0) {
302
+ return [{ platform: this.id, action: "skip", detail: "connector declares no actions" }];
303
+ }
304
+ if (ctx.scope !== "project") {
305
+ return [{ platform: this.id, action: "skip", detail: "kiro actions are project-scoped only" }];
306
+ }
307
+ return connector.actions.map(
308
+ (action) => this.removeContentFile(this.actionHookPath(ctx, action.id), ctx.dryRun)
309
+ );
310
+ }
311
+ /**
312
+ * Render a Kiro `.kiro.hook` JSON: a Manual-Trigger (`when.type "manual"`) +
313
+ * Shell-Command (`then.type "runCommand"`) hook. The key order matches the
314
+ * files Kiro itself emits (enabled, name, description, version, when, then).
315
+ */
316
+ renderActionHook(name, description, command) {
317
+ return JSON.stringify(
318
+ {
319
+ enabled: true,
320
+ name,
321
+ description,
322
+ version: "1",
323
+ when: { type: "manual" },
324
+ then: { type: "runCommand", command }
325
+ },
326
+ null,
327
+ 2
328
+ ) + "\n";
329
+ }
255
330
  // ── Hook install / uninstall (merge into the agent file) ─────────────────
256
331
  installHooks(ctx) {
257
332
  const { connector } = ctx;
@@ -518,4 +593,4 @@ export {
518
593
  adapter,
519
594
  kiro_default as default
520
595
  };
521
- //# sourceMappingURL=kiro-YZ4TTZGD.js.map
596
+ //# sourceMappingURL=kiro-4IN5IH46.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/kiro/index.ts"],"sourcesContent":["/**\n * adapters/kiro — Kiro (AWS) platform adapter for agent-connector.\n *\n * Kiro is a json-stdio host with TWO native config surfaces that live in\n * DIFFERENT files (so getServerConfigPath ≠ getHookConfigPath):\n *\n * 1. MCP servers — `mcp.json` under `~/.kiro/settings/` (user) or\n * `<projectDir>/.kiro/settings/` (project). The file is JSONC; we WRITE\n * plain JSON (valid JSONC), mirroring the other JSON-config adapters. Root\n * key `mcpServers`; a stdio server is `{ command, args, env }`.\n * Ref: https://kiro.dev/docs/mcp/configuration/\n *\n * 2. Hooks — NOT a settings file but an AGENT file:\n * `~/.kiro/agents/kiro_default.json`. Kiro auto-loads the built-in default\n * agent `kiro_default` for a new chat session, so hooks must register on\n * THAT agent (a file literally named `default.json` would define an inactive\n * custom agent the user must `/agent`-swap to). We merge a `hooks` key into\n * the existing agent JSON, creating a minimal agent object if absent.\n * Ref: kiro.dev/docs/cli/custom-agents/configuration-reference#hooks-field\n *\n * Hook protocol is EXIT-CODE based (unlike Claude's JSON-decision wrapper):\n * - exit 0 → allow the action.\n * - exit 2 → block the action; the reason is written to stderr (PreToolUse).\n * - context injection → exit 0 with the guidance text written as PLAIN STDOUT\n * (NOT a JSON envelope). Kiro adds a hook's STDOUT to the agent's context\n * ONLY for agentSpawn and userPromptSubmit; for preToolUse / postToolUse /\n * stop the docs say STDOUT is \"captured but not shown\" — there is no\n * context channel, so a `context` decision on those degrades to exit 0.\n * Ref: https://kiro.dev/docs/cli/hooks (Hook output / Hook types).\n * Kiro CANNOT rewrite tool arguments or output (exit codes only), so\n * canModifyArgs / canModifyOutput are false; `modify` degrades to allow.\n *\n * Native hook event vocabulary differs from the canonical names and is mapped:\n * PreToolUse → preToolUse\n * PostToolUse → postToolUse\n * SessionStart → agentSpawn (Kiro's session-start equivalent)\n * UserPromptSubmit → userPromptSubmit\n * Stop → stop (documented Kiro hook)\n * Kiro has no equivalent for PreCompact / SessionEnd / Notification; those are\n * reported as a warn/skip at install time.\n *\n * Env handling: Kiro documents no `${env:VAR}` token of the framework's syntax,\n * so env/header/url refs are resolved to literals at install time via\n * resolveEnvRefsDeep — the safe default matching the Gemini/Codex adapters.\n *\n * Actions surface: Kiro reads `.kiro/hooks/<id>.kiro.hook` files (JSON) where a\n * `{ when:{ type:\"manual\" } }` Manual-Trigger paired with a\n * `{ then:{ type:\"runCommand\", command } }` Shell-Command action runs a local\n * shell command (NO LLM) and is user-invokable from the Agent Hooks panel /\n * Command Palette (kiro.dev/docs/hooks — \"Run Command\" action; verified against\n * real `.kiro.hook` files in the wild). For each AC action we write ONE fully\n * owned `.kiro/hooks/<id>.kiro.hook` that execs `<homeBin> action kiro <id>\n * --connector <id>`. CONSTRAINT (verified): Kiro discovers hooks ONLY from the\n * WORKSPACE `.kiro/hooks/` dir — `~/.kiro/hooks/` is NOT scanned — so actions\n * install at PROJECT scope only and warn-skip at user scope (mirrors warp's\n * project-only skills/actions precedent).\n *\n * Grounded in context-mode's proven Kiro adapter (src/adapters/kiro/*).\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, HookReply, InstallContext, MemoryTarget, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PreToolUseEvent,\n ServerDef,\n SessionStartEvent,\n SkillDef,\n StopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { renderSkillMd } from \"../claude-code/render.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildHomeBinHookCommand,\n buildWrappedStdio,\n isHomeBinHookCommand,\n} from \"../../core/spawn.js\";\nimport { normalizeSessionSource } from \"../claude-code/wire.js\";\n\nconst HOST: PlatformId = \"kiro\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/** The built-in agent Kiro auto-loads for a new chat session. */\nconst DEFAULT_AGENT_FILE = \"kiro_default.json\";\n\n/**\n * Kiro-native hook event names (the keys under an agent file's `hooks` object).\n * Only the events Kiro actually fires for the json-stdio command paradigm.\n */\nconst KIRO_EVENT = {\n preToolUse: \"preToolUse\",\n postToolUse: \"postToolUse\",\n agentSpawn: \"agentSpawn\",\n userPromptSubmit: \"userPromptSubmit\",\n stop: \"stop\",\n} as const;\n\n/**\n * Map canonical event names → Kiro's native hook event names. Only the events\n * Kiro supports are present; PreCompact / SessionEnd / Notification have no Kiro\n * equivalent and are reported as a warn/skip at install time.\n */\nconst EVENT_MAP: Partial<Record<HookEventName, string>> = {\n PreToolUse: KIRO_EVENT.preToolUse,\n PostToolUse: KIRO_EVENT.postToolUse,\n SessionStart: KIRO_EVENT.agentSpawn,\n UserPromptSubmit: KIRO_EVENT.userPromptSubmit,\n Stop: KIRO_EVENT.stop,\n};\n\n/**\n * Kiro events whose hook STDOUT is added to the agent's context: agentSpawn\n * (≈ SessionStart) and userPromptSubmit. For preToolUse / postToolUse / stop the\n * docs say STDOUT is \"captured but not shown to user\" — no context channel — so a\n * `context` decision on those degrades to a plain exit-0 pass-through.\n * Ref: https://kiro.dev/docs/cli/hooks\n */\nconst CONTEXT_EVENTS: ReadonlySet<string> = new Set([\n KIRO_EVENT.agentSpawn,\n KIRO_EVENT.userPromptSubmit,\n]);\n\n/** A single Kiro native hook registration entry (Claude-shaped, nested). */\ninterface KiroHookEntry {\n matcher: string;\n hooks: Array<{ type: \"command\"; command: string }>;\n}\n\n/** The shape of a Kiro agent file (only the parts we touch). */\ninterface KiroAgentFile {\n hooks?: Record<string, KiroHookEntry[]>;\n [key: string]: unknown;\n}\n\n/** The shape of Kiro's mcp.json (only the parts we touch). */\ninterface KiroMcpFile {\n mcpServers?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\n/** Native MCP server entry shapes Kiro accepts under `mcpServers`. */\ninterface KiroStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n cwd?: string;\n}\ninterface KiroHttpServer {\n url: string;\n headers?: Record<string, string>;\n}\n\n/**\n * Raw Kiro CLI hook stdin payload (snake_case wire fields).\n *\n * Fields are the ones Kiro ACTUALLY serializes onto a hook's stdin per\n * kiro.dev/docs/cli/hooks. NOTE the stop hook: its stdin is exactly\n * `{ hook_event_name, cwd, session_id, assistant_response }` — there is NO\n * `stop_hook_active` field (Kiro does not model a re-entrant stop-hook flag),\n * so we read `assistant_response` (the agent's last response text) rather than a\n * never-emitted boolean. Ref: kiro.dev/docs/cli/hooks (Stop Hook → Hook Event).\n */\ninterface KiroWireInput {\n connector?: unknown;\n hook_event_name?: string;\n cwd?: string;\n session_id?: string;\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: unknown;\n source?: string;\n prompt?: string;\n /** Stop hook only: the text of the assistant's last response. */\n assistant_response?: string;\n}\n\nexport class KiroAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Kiro\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block (project <projectDir>/AGENTS.md\n // via the base default — always included, no inclusion modes; user scope →\n // ~/.kiro/steering/agent-connector.md below).\n supportsMemory: true,\n preToolUse: true,\n postToolUse: true,\n preCompact: false,\n sessionStart: true,\n sessionEnd: false,\n // Kiro fires userPromptSubmit and stop, but it has no PreCompact /\n // SessionEnd / Notification equivalent.\n userPromptSubmit: true,\n stop: true,\n notification: false,\n // Newer events: Kiro's native set (agentSpawn / userPromptSubmit /\n // preToolUse / postToolUse / stop) has no permission-dialog, tool-failure,\n // or subagent lifecycle events, so permissionRequest / postToolUseFailure /\n // subagentStart / subagentStop stay unset — install reports the standard\n // skip-warn for them.\n // Kiro's hook protocol is exit-code only — a hook can allow (0), block (2),\n // or inject agentSpawn context, but it CANNOT rewrite tool args or output.\n canModifyArgs: false,\n canModifyOutput: false,\n // agentSpawn (and userPromptSubmit) add the hook's plain STDOUT to context.\n canInjectSessionContext: true,\n transports: [\"stdio\", \"http\"],\n // Skills: Kiro reads SKILL.md from .kiro/skills/<name>/SKILL.md (project)\n // and ~/.kiro/skills/<name>/SKILL.md (user).\n supportsSkills: true,\n // Actions: Kiro reads `.kiro/hooks/<id>.kiro.hook` Manual-Trigger +\n // Shell-Command hooks (when.type \"manual\" + then.type \"runCommand\"),\n // user-invokable from the Agent Hooks panel / Command Palette. WORKSPACE\n // (project) scope ONLY — Kiro does not scan ~/.kiro/hooks/ — so user scope\n // warn-skips (see installActions).\n supportsActions: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".kiro\");\n const userMcp = this.userMcpPath();\n const projectDirKiro = join(projectDir, \".kiro\");\n const projectMcp = this.projectMcpPath(projectDir);\n\n const userInstalled = existsSync(userDir) || existsSync(userMcp);\n const projInstalled = existsSync(projectDirKiro) || existsSync(projectMcp);\n const installed = userInstalled || projInstalled;\n // Report the scope/path that actually matched, so a project-only install\n // isn't misreported as a (non-existent) user install.\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projectMcp : userMcp;\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 ? scope === \"project\"\n ? `found project Kiro config at ${projectMcp}`\n : `found Kiro config under ${userDir}`\n : `no Kiro config at ${userDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Memory surface: global steering dir at user scope ───────────────────\n // Project scope stays on the AGENTS.md base default (workspace-root\n // AGENTS.md is always included, with no inclusion modes). User scope targets\n // a dedicated agent-connector.md in Kiro's documented ~/.kiro/steering/ dir\n // (default-always inclusion; AC-created → cleanly 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(), \".kiro\", \"steering\", \"agent-connector.md\"),\n reason: \"kiro global steering dir (~/.kiro/steering; agent-connector-owned file)\",\n },\n ];\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".kiro\")\n : join(homedir(), \".kiro\");\n }\n\n /** MCP servers live in mcp.json under the scope's `.kiro/settings/`. */\n getServerConfigPath(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? this.projectMcpPath(ctx.projectDir)\n : this.userMcpPath();\n }\n\n /**\n * Hooks live in an AGENT file, NOT a settings file. Kiro auto-loads the\n * built-in default agent (`kiro_default`) for a new chat session, so we always\n * register hooks on the user-scope default agent — that is the agent Kiro\n * actually loads regardless of install scope.\n */\n getHookConfigPath(_ctx: InstallContext): string {\n return join(homedir(), \".kiro\", \"agents\", DEFAULT_AGENT_FILE);\n }\n\n private userMcpPath(): string {\n return join(homedir(), \".kiro\", \"settings\", \"mcp.json\");\n }\n\n private projectMcpPath(projectDir: string): string {\n return join(projectDir, \".kiro\", \"settings\", \"mcp.json\");\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 kiro\"\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 Kiro's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): KiroStdioServer | KiroHttpServer {\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 ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\n\n // Kiro documents no native interpolation token, so resolve every\n // ${env:VAR} to a literal at install time.\n const entry: KiroStdioServer = { 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 if (server.cwd) entry.cwd = resolveEnvRefsDeep(server.cwd);\n return entry;\n }\n\n // http (and any other remote transport) — Kiro registers a URL.\n const entry: KiroHttpServer = { 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. Kiro 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 // ── Skills surface ───────────────────────────────────────────────────────\n // Kiro reads SKILL.md from:\n // project scope → <projectDir>/.kiro/skills/<name>/SKILL.md\n // user scope → ~/.kiro/skills/<name>/SKILL.md\n\n private skillsDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".kiro\", \"skills\")\n : join(homedir(), \".kiro\", \"skills\");\n }\n\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for kiro\" }];\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 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 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;\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n private renderSkill(skill: SkillDef): string {\n return renderSkillMd(skill);\n }\n\n // ── Action surface (one owned .kiro.hook per action; PROJECT scope only) ──\n // Kiro reads `<projectDir>/.kiro/hooks/<id>.kiro.hook` (JSON): a Manual-Trigger\n // (`when.type \"manual\"`) + Shell-Command (`then.type \"runCommand\"`, `command`)\n // hook, user-invokable from the Agent Hooks panel / Command Palette\n // (kiro.dev/docs/hooks). The command execs `<homeBin> action kiro <id>\n // --connector <id>`. Each file is FULLY OWNED → uninstall removes it.\n // SCOPE: Kiro discovers hooks ONLY from the workspace `.kiro/hooks/` dir\n // (~/.kiro/hooks/ is NOT scanned), so user scope warn-skips (mirrors warp's\n // project-only precedent) rather than writing a file Kiro would never load.\n\n private actionHookPath(ctx: InstallContext, id: string): string {\n return join(ctx.projectDir, \".kiro\", \"hooks\", `${id}.kiro.hook`);\n }\n\n override installActions(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.actions === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"actions disabled for kiro\" }];\n }\n const triggers = this.actionTriggers(ctx);\n if (triggers.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no actions\" }];\n }\n if (ctx.scope !== \"project\") {\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail: `kiro actions are project-scoped only (Kiro does not scan ~/.kiro/hooks/); ${triggers.length} skipped`,\n },\n ];\n }\n return triggers.map((trigger) =>\n this.writeContentFile(\n this.actionHookPath(ctx, trigger.id),\n this.renderActionHook(trigger.label, trigger.description, trigger.command),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallActions(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.actions.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no actions\" }];\n }\n if (ctx.scope !== \"project\") {\n return [{ platform: this.id, action: \"skip\", detail: \"kiro actions are project-scoped only\" }];\n }\n return connector.actions.map((action) =>\n this.removeContentFile(this.actionHookPath(ctx, action.id), ctx.dryRun),\n );\n }\n\n /**\n * Render a Kiro `.kiro.hook` JSON: a Manual-Trigger (`when.type \"manual\"`) +\n * Shell-Command (`then.type \"runCommand\"`) hook. The key order matches the\n * files Kiro itself emits (enabled, name, description, version, when, then).\n */\n private renderActionHook(name: string, description: string, command: string): string {\n return (\n JSON.stringify(\n {\n enabled: true,\n name,\n description,\n version: \"1\",\n when: { type: \"manual\" },\n then: { type: \"runCommand\", command },\n },\n null,\n 2,\n ) + \"\\n\"\n );\n }\n\n // ── Hook install / uninstall (merge into the agent file) ─────────────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.hooks === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"hooks disabled for kiro\" }];\n }\n if (connector.hookEvents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no hooks\" }];\n }\n\n const agentPath = this.getHookConfigPath(ctx);\n // Merge into the existing agent JSON; create a minimal agent object if absent.\n const agent = this.readJson<KiroAgentFile>(agentPath) ?? {};\n const __skip = this.malformedHookRootSkip(agentPath, (agent as Record<string, unknown>).hooks);\n if (__skip) return [__skip];\n const hooks = (agent.hooks ??= {});\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of connector.hookEvents) {\n const kiroEvent = EVENT_MAP[event];\n if (!kiroEvent) {\n // No Kiro equivalent for this canonical event — report and continue.\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: agentPath,\n detail: `${event} has no Kiro hook equivalent — skipped`,\n });\n continue;\n }\n\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n const matcher = connector.hooks[event]?.matcher ?? \"\";\n const entry: KiroHookEntry = {\n matcher,\n hooks: [{ type: \"command\", command }],\n };\n\n const bucket = (hooks[kiroEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => this.entryHasOurCommand(e, ctx));\n\n if (existingIdx >= 0) {\n if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: agentPath,\n detail: `hooks.${kiroEvent} already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: agentPath,\n detail: `hooks.${kiroEvent}`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: agentPath,\n detail: `hooks.${kiroEvent}`,\n });\n }\n mutated = true;\n }\n\n if (mutated) this.writeJson(agentPath, agent, ctx.dryRun);\n return changes;\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const agentPath = this.getHookConfigPath(ctx);\n const agent = this.readJson<KiroAgentFile>(agentPath);\n const hooks = agent?.hooks;\n if (!agent || !hooks) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: agentPath,\n detail: \"no hooks section present\",\n },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const kiroEvent of Object.keys(hooks)) {\n const bucket = hooks[kiroEvent];\n if (!Array.isArray(bucket)) continue;\n\n // Strip our hook command from each entry; drop entries left empty so we\n // never remove another connector's (or the user's own) hook commands.\n const next: KiroHookEntry[] = [];\n let removed = 0;\n for (const e of bucket) {\n const innerBefore = e.hooks?.length ?? 0;\n const inner = (e.hooks ?? []).filter((h) => !this.isOurCommand(h.command, ctx));\n removed += innerBefore - inner.length;\n if (inner.length > 0) next.push({ matcher: e.matcher ?? \"\", hooks: inner });\n }\n\n if (removed > 0) {\n if (next.length > 0) hooks[kiroEvent] = next;\n else delete hooks[kiroEvent];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: agentPath,\n detail: `hooks.${kiroEvent} (${removed})`,\n });\n mutated = true;\n }\n }\n\n if (mutated) this.writeJson(agentPath, agent, ctx.dryRun);\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: agentPath,\n detail: \"no matching hook entries\",\n });\n }\n return changes;\n }\n\n private entryHasOurCommand(entry: KiroHookEntry, ctx: InstallContext): boolean {\n return (entry.hooks ?? []).some((h) => this.isOurCommand(h.command, ctx));\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 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 agentPath = this.getHookConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\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 // Only assert what the connector declares (same rule as the hook\n // check below): a server-less connector never writes an mcpServers\n // 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<KiroMcpFile>(mcpPath);\n const bucket = cfg?.mcpServers;\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 : { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}` };\n },\n },\n {\n name: `${this.name}: hook command registered`,\n check: () => {\n if (hookEvents.length === 0) {\n return { status: \"OK\", detail: \"no hooks declared\" };\n }\n const agent = this.readJson<KiroAgentFile>(agentPath);\n if (!agent) return { status: \"FAIL\", detail: `cannot read ${agentPath}` };\n const hooks = agent.hooks ?? {};\n const registered = Object.values(hooks).some((entries) =>\n (entries ?? []).some((e) =>\n (e.hooks ?? []).some((h) =>\n isHomeBinHookCommand(h.command, homeBin, connectorId),\n ),\n ),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${connectorId} in ${agentPath}` };\n },\n },\n ];\n }\n\n // ── Runtime: parse Kiro stdin JSON → normalized event ────────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as KiroWireInput;\n const connectorId = typeof input.connector === \"string\" ? input.connector : \"\";\n const sessionId = typeof input.session_id === \"string\" ? input.session_id : \"\";\n const projectDir = typeof input.cwd === \"string\" ? input.cwd : undefined;\n\n const base = {\n hostPlatform: HOST,\n connectorId,\n sessionId,\n raw,\n ...(projectDir !== undefined ? { projectDir } : {}),\n } as const;\n\n switch (event) {\n case \"PreToolUse\": {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n return ev;\n }\n case \"PostToolUse\": {\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(toolResponseToString(input.tool_response) !== undefined\n ? { toolOutput: toolResponseToString(input.tool_response) }\n : {}),\n };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = {\n ...base,\n source: normalizeSessionSource(input.source),\n };\n return ev;\n }\n case \"UserPromptSubmit\": {\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\n };\n return ev;\n }\n case \"Stop\": {\n // Kiro's stop stdin is EXACTLY { hook_event_name, cwd, session_id,\n // assistant_response } — there is no `stop_hook_active` flag (reading it\n // always yielded undefined), so we read the real `assistant_response`\n // (the agent's last response text) instead and surface it as\n // lastAssistantMessage. Ref: kiro.dev/docs/cli/hooks (Stop Hook Event).\n const ev: StopEvent & { lastAssistantMessage?: string } = {\n ...base,\n ...(typeof input.assistant_response === \"string\"\n ? { lastAssistantMessage: input.assistant_response }\n : {}),\n };\n return ev;\n }\n default: {\n // Kiro never delivers PreCompact / SessionEnd / Notification nor the\n // newer PermissionRequest / PostToolUseFailure / SubagentStart /\n // SubagentStop (no native equivalents). If the runtime dispatches one\n // anyway, surface it loudly rather than silently mis-parse.\n throw new Error(`unsupported kiro hook event: ${String(event)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Kiro native (exit-code) hook reply ─────\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const decision = response.decision ?? \"allow\";\n\n // deny → block the action: exit 2 with the reason on stderr.\n if (decision === \"deny\") {\n return { exitCode: 2, stderr: response.reason ?? \"Blocked by hook\" };\n }\n\n // ask → Kiro has no native \"ask\"; degrade to deny (exit 2) to stay fail-safe.\n if (decision === \"ask\") {\n return {\n exitCode: 2,\n stderr: response.reason ?? \"Action requires user confirmation (security policy)\",\n };\n }\n\n // Stop → exit-code only (deny already handled above as exit 2). There is no\n // context/additionalContext channel on a Stop hook, so anything non-deny\n // passes through with exit 0 (do not fall into the context branch).\n if (event === \"Stop\") {\n return { exitCode: 0 };\n }\n\n // context → inject soft guidance. Kiro adds a hook's PLAIN STDOUT to the\n // agent's context (no JSON envelope), but ONLY for the agentSpawn and\n // userPromptSubmit events; preToolUse / postToolUse have no context channel\n // (their STDOUT is \"captured but not shown\"). So emit the raw text on stdout\n // only when the FIRING event maps to a context-supporting Kiro event;\n // otherwise the context decision degrades to a plain exit-0 pass-through\n // rather than a mislabeled/ineffective payload. exit 0 = allow.\n // Ref: https://kiro.dev/docs/cli/hooks\n const kiroEvent = EVENT_MAP[event];\n if (\n decision === \"context\" &&\n response.additionalContext &&\n kiroEvent !== undefined &&\n CONTEXT_EVENTS.has(kiroEvent)\n ) {\n return { exitCode: 0, stdout: response.additionalContext };\n }\n\n // modify is unsupported on Kiro (exit-code protocol — cannot rewrite\n // args/output); allow / void → pass through with exit 0.\n return { exitCode: 0 };\n }\n}\n\n/** Coerce a Kiro PostToolUse `tool_response` into a string for the normalized event. */\nfunction toolResponseToString(value: unknown): string | undefined {\n if (value == null) return undefined;\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\nexport const adapter = new KiroAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4DA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AA+BrB,IAAM,OAAmB;AACzB,IAAM,eAAe;AAGrB,IAAM,qBAAqB;AAM3B,IAAM,aAAa;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,MAAM;AACR;AAOA,IAAM,YAAoD;AAAA,EACxD,YAAY,WAAW;AAAA,EACvB,aAAa,WAAW;AAAA,EACxB,cAAc,WAAW;AAAA,EACzB,kBAAkB,WAAW;AAAA,EAC7B,MAAM,WAAW;AACnB;AASA,IAAM,iBAAsC,oBAAI,IAAI;AAAA,EAClD,WAAW;AAAA,EACX,WAAW;AACb,CAAC;AAwDM,IAAM,cAAN,cAA0B,YAA+B;AAAA,EACrD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA;AAAA,IAI5C,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA;AAAA;AAAA,IAGZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQd,eAAe;AAAA,IACf,iBAAiB;AAAA;AAAA,IAEjB,yBAAyB;AAAA,IACzB,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Ac,UACd,eAAe,IAAI,SAAS,GAC5B;AACA,aAAO,EAAE,UAAU,GAAG,QAAQ,SAAS,kBAAkB;AAAA,IAC3D;AAIA,WAAO,EAAE,UAAU,EAAE;AAAA,EACvB;AACF;AAGA,SAAS,qBAAqB,OAAoC;AAChE,MAAI,SAAS,KAAM,QAAO;AAC1B,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI;AACF,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAEO,IAAM,UAAU,IAAI,YAAY;AACvC,IAAO,eAAQ;","names":["entry"]}
@@ -2,7 +2,8 @@
2
2
  import {
3
3
  formatHostLeaderboard,
4
4
  hostLeaderboard
5
- } from "./chunk-IRUYJD23.js";
5
+ } from "./chunk-NLE2J5P4.js";
6
+ import "./chunk-XD7MY6HB.js";
6
7
  import {
7
8
  SCOPE_FILTER_VALUES,
8
9
  formatHostNativeTurns,
@@ -11,11 +12,10 @@ import {
11
12
  isScopeFilter,
12
13
  mcpLeaderboard
13
14
  } from "./chunk-AY3RGRTT.js";
14
- import "./chunk-XD7MY6HB.js";
15
15
  import {
16
16
  fail,
17
17
  print
18
- } from "./chunk-VKRGQLY4.js";
18
+ } from "./chunk-7HUUINPB.js";
19
19
  import "./chunk-4FWETID5.js";
20
20
  import "./chunk-IXOQDZWC.js";
21
21
 
@@ -134,4 +134,4 @@ export {
134
134
  parseSince,
135
135
  run
136
136
  };
137
- //# sourceMappingURL=leaderboard-DVW4WYJ6.js.map
137
+ //# sourceMappingURL=leaderboard-LF5SP6X2.js.map
@@ -0,0 +1,300 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ resolveEnvRefsDeep
4
+ } from "./chunk-BEFVJ2OE.js";
5
+ import {
6
+ BaseAdapter
7
+ } from "./chunk-VVFDU4IX.js";
8
+ import {
9
+ buildWrappedStdio
10
+ } from "./chunk-HORHRHNG.js";
11
+ import "./chunk-YYNXIUR2.js";
12
+ import {
13
+ ensureDir
14
+ } from "./chunk-IXOQDZWC.js";
15
+
16
+ // src/adapters/mistral-vibe/index.ts
17
+ import { existsSync, readFileSync, writeFileSync } from "fs";
18
+ import { homedir } from "os";
19
+ import { dirname, join } from "path";
20
+ import TOML from "@iarna/toml";
21
+ var HOST = "mistral-vibe";
22
+ var MCP_ROOT_KEY = "mcp_servers";
23
+ var MistralVibeAdapter = class extends BaseAdapter {
24
+ id = HOST;
25
+ name = "Mistral Vibe";
26
+ paradigm = "mcp-only";
27
+ capabilities = {
28
+ // mcp-only: no hook layer wired (experimental host hooks are not
29
+ // byte-confirmed — see header HONEST CEILING). No memory/content surfaces
30
+ // wired either; only the MCP server is installed. Every hook capability is
31
+ // false.
32
+ preToolUse: false,
33
+ postToolUse: false,
34
+ preCompact: false,
35
+ sessionStart: false,
36
+ sessionEnd: false,
37
+ userPromptSubmit: false,
38
+ stop: false,
39
+ notification: false,
40
+ canModifyArgs: false,
41
+ canModifyOutput: false,
42
+ canInjectSessionContext: false,
43
+ // Mistral Vibe registers stdio + remote (http / streamable-http) MCP
44
+ // servers. The framework's `http` transport maps to Vibe's "http"; `sse`
45
+ // maps to Vibe's "streamable-http" (its closest remote form).
46
+ transports: ["stdio", "http", "sse"]
47
+ };
48
+ // ── Detection ────────────────────────────────────────────────────────────
49
+ detectInstalled(projectDir) {
50
+ const userDir = this.userConfigDir();
51
+ const userCfg = join(userDir, "config.toml");
52
+ const projDir = join(projectDir, ".vibe");
53
+ const projCfg = join(projDir, "config.toml");
54
+ const userInstalled = existsSync(userDir) || existsSync(userCfg);
55
+ const projInstalled = existsSync(projDir) || existsSync(projCfg);
56
+ const installed = userInstalled || projInstalled;
57
+ const scope = projInstalled && !userInstalled ? "project" : "user";
58
+ const configPath = scope === "project" ? projCfg : userCfg;
59
+ return {
60
+ id: this.id,
61
+ name: this.name,
62
+ installed,
63
+ paradigm: this.paradigm,
64
+ capabilities: this.capabilities,
65
+ configPath,
66
+ scope,
67
+ reason: installed ? `found Mistral Vibe config (${scope}) at ${configPath}` : `no .vibe config at ${userDir} or ${projDir}`,
68
+ confidence: installed ? "high" : "low"
69
+ };
70
+ }
71
+ // ── Native paths ─────────────────────────────────────────────────────────
72
+ /** ~/.vibe (user) or <projectDir>/.vibe (project). */
73
+ getConfigDir(ctx) {
74
+ return ctx.scope === "project" ? join(ctx.projectDir, ".vibe") : this.userConfigDir();
75
+ }
76
+ /** MCP config: config.toml under the per-scope .vibe dir. */
77
+ getServerConfigPath(ctx) {
78
+ return join(this.getConfigDir(ctx), "config.toml");
79
+ }
80
+ /**
81
+ * Mistral Vibe has no AC-wired hook file (mcp-only — see header). The hook
82
+ * "config path" is the same config.toml so the generic doctor/backup behave
83
+ * sensibly (mirrors warp/zed).
84
+ */
85
+ getHookConfigPath(ctx) {
86
+ return this.getServerConfigPath(ctx);
87
+ }
88
+ /** ~/.vibe — homedir() covers %USERPROFILE% on Windows. */
89
+ userConfigDir() {
90
+ return join(homedir(), ".vibe");
91
+ }
92
+ // ── TOML config IO ─────────────────────────────────────────────────────────
93
+ readToml(path) {
94
+ if (!existsSync(path)) return {};
95
+ try {
96
+ return TOML.parse(readFileSync(path, "utf8"));
97
+ } catch {
98
+ return {};
99
+ }
100
+ }
101
+ writeToml(path, data, dryRun) {
102
+ if (dryRun) return;
103
+ ensureDir(dirname(path));
104
+ writeFileSync(path, TOML.stringify(data), "utf8");
105
+ }
106
+ // ── MCP server install / uninstall (TOML — ARRAY-OF-TABLES, by `name`) ──────
107
+ installServer(ctx) {
108
+ const { connector, dryRun } = ctx;
109
+ const path = this.getServerConfigPath(ctx);
110
+ const server = this.effectiveServer(ctx);
111
+ if (!server) {
112
+ return [
113
+ {
114
+ platform: this.id,
115
+ action: "skip",
116
+ path,
117
+ detail: connector.server ? "server registration disabled for mistral-vibe" : "connector declares no MCP server"
118
+ }
119
+ ];
120
+ }
121
+ const symlink = this.symlinkPathWarning(path);
122
+ if (symlink) return [symlink];
123
+ const entry = this.renderServerEntry(ctx, server);
124
+ const cfg = this.readToml(path);
125
+ const existingRoot = cfg[MCP_ROOT_KEY];
126
+ if (existingRoot !== void 0 && !Array.isArray(existingRoot)) {
127
+ return [
128
+ {
129
+ platform: this.id,
130
+ action: "skip",
131
+ path,
132
+ detail: `${MCP_ROOT_KEY} is not a TOML array \u2014 left untouched (manual fix needed)`
133
+ }
134
+ ];
135
+ }
136
+ const list = Array.isArray(existingRoot) ? existingRoot : [];
137
+ const idx = list.findIndex((e) => this.entryName(e) === connector.id);
138
+ let action;
139
+ if (idx < 0) {
140
+ list.push(entry);
141
+ action = "create";
142
+ } else if (JSON.stringify(list[idx]) === JSON.stringify(entry)) {
143
+ action = "skip";
144
+ } else {
145
+ list[idx] = entry;
146
+ action = "update";
147
+ }
148
+ if (action !== "skip") {
149
+ cfg[MCP_ROOT_KEY] = list;
150
+ this.writeToml(path, cfg, dryRun);
151
+ }
152
+ return [{ platform: this.id, action, path, detail: `${MCP_ROOT_KEY}[name=${connector.id}]` }];
153
+ }
154
+ uninstallServer(ctx) {
155
+ const { connector, dryRun } = ctx;
156
+ const path = this.getServerConfigPath(ctx);
157
+ const symlink = this.symlinkPathWarning(path);
158
+ if (symlink) return [symlink];
159
+ const cfg = this.readToml(path);
160
+ const rawList = cfg[MCP_ROOT_KEY];
161
+ if (!Array.isArray(rawList)) {
162
+ return [
163
+ {
164
+ platform: this.id,
165
+ action: "skip",
166
+ path,
167
+ detail: `${MCP_ROOT_KEY}[name=${connector.id}] absent`
168
+ }
169
+ ];
170
+ }
171
+ const list = rawList;
172
+ const kept = list.filter((e) => this.entryName(e) !== connector.id);
173
+ if (kept.length === list.length) {
174
+ return [
175
+ {
176
+ platform: this.id,
177
+ action: "skip",
178
+ path,
179
+ detail: `${MCP_ROOT_KEY}[name=${connector.id}] absent`
180
+ }
181
+ ];
182
+ }
183
+ cfg[MCP_ROOT_KEY] = kept;
184
+ this.writeToml(path, cfg, dryRun);
185
+ return [
186
+ { platform: this.id, action: "remove", path, detail: `${MCP_ROOT_KEY}[name=${connector.id}]` }
187
+ ];
188
+ }
189
+ /**
190
+ * Render a normalized ServerDef into Mistral Vibe's native mcp_servers entry.
191
+ * TOML has no native ${env:VAR} token — resolve every reference to a literal at
192
+ * install time (the safe path, matching codex/droid). Honors the telemetry
193
+ * serve-wrapper for stdio.
194
+ */
195
+ renderServerEntry(ctx, server) {
196
+ const transport = server.transport;
197
+ if (transport === "stdio") {
198
+ let command = server.command ?? "";
199
+ let args = [...server.args ?? []];
200
+ ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));
201
+ command = resolveEnvRefsDeep(command);
202
+ args = resolveEnvRefsDeep(args);
203
+ const entry2 = {
204
+ name: ctx.connector.id,
205
+ transport: "stdio",
206
+ command
207
+ };
208
+ if (args.length > 0) entry2.args = args;
209
+ const env = this.renderEnv(server.env);
210
+ if (env) entry2.env = env;
211
+ return entry2;
212
+ }
213
+ const vibeTransport = transport === "http" ? "http" : "streamable-http";
214
+ const entry = {
215
+ name: ctx.connector.id,
216
+ transport: vibeTransport,
217
+ url: resolveEnvRefsDeep(server.url ?? "")
218
+ };
219
+ const headers = this.renderEnv(server.headers);
220
+ if (headers) entry.headers = headers;
221
+ return entry;
222
+ }
223
+ /**
224
+ * Render env/header values. Resolve `${env:VAR}` references to literals at
225
+ * install time (TOML cannot interpolate).
226
+ */
227
+ renderEnv(env) {
228
+ if (!env || Object.keys(env).length === 0) return void 0;
229
+ const out = {};
230
+ for (const [k, v] of Object.entries(resolveEnvRefsDeep({ ...env }))) {
231
+ out[k] = String(v);
232
+ }
233
+ return out;
234
+ }
235
+ // ── Hooks (unavailable — Mistral Vibe is mcp-only) ───────────────────────
236
+ // HONEST CEILING: Vibe ships only an experimental hook surface with no
237
+ // byte-confirmed format/event-name contract, so AC wires no hooks here.
238
+ installHooks(_ctx) {
239
+ return [
240
+ {
241
+ platform: this.id,
242
+ action: "skip",
243
+ detail: "hooks unavailable (Mistral Vibe is mcp-only)"
244
+ }
245
+ ];
246
+ }
247
+ uninstallHooks(_ctx) {
248
+ return [
249
+ {
250
+ platform: this.id,
251
+ action: "skip",
252
+ detail: "hooks unavailable (Mistral Vibe is mcp-only)"
253
+ }
254
+ ];
255
+ }
256
+ // ── Diagnostics ──────────────────────────────────────────────────────────
257
+ getHealthChecks(ctx) {
258
+ const path = this.getServerConfigPath(ctx);
259
+ const id = ctx.connector.id;
260
+ return [
261
+ {
262
+ name: `${this.name}: config.toml present`,
263
+ check: () => existsSync(path) ? { status: "OK", detail: path } : { status: "FAIL", detail: `not found: ${path}` }
264
+ },
265
+ {
266
+ name: `${this.name}: ${MCP_ROOT_KEY}[name=${id}] registered`,
267
+ check: () => {
268
+ if (!ctx.connector.server) return { status: "OK", detail: "no MCP server declared" };
269
+ const cfg = this.readToml(path);
270
+ const list = cfg[MCP_ROOT_KEY];
271
+ const present = Array.isArray(list) && list.some((e) => this.entryName(e) === id);
272
+ return present ? { status: "OK", detail: `${MCP_ROOT_KEY}[name=${id}]` } : { status: "FAIL", detail: `${MCP_ROOT_KEY}[name=${id}] not found in ${path}` };
273
+ }
274
+ }
275
+ ];
276
+ }
277
+ // ── Internal helpers ──────────────────────────────────────────────────────
278
+ /** The `name` of an array entry, or undefined when it is not a named object. */
279
+ entryName(entry) {
280
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) return void 0;
281
+ const name = entry.name;
282
+ return typeof name === "string" ? name : void 0;
283
+ }
284
+ /** Resolve the per-platform server override into an effective ServerDef. */
285
+ effectiveServer(ctx) {
286
+ const override = ctx.connector.platforms[this.id]?.server;
287
+ if (override === false) return void 0;
288
+ const base = ctx.connector.server;
289
+ if (!base) return void 0;
290
+ return override && typeof override === "object" ? { ...base, ...override } : base;
291
+ }
292
+ };
293
+ var adapter = new MistralVibeAdapter();
294
+ var mistral_vibe_default = adapter;
295
+ export {
296
+ MistralVibeAdapter,
297
+ adapter,
298
+ mistral_vibe_default as default
299
+ };
300
+ //# sourceMappingURL=mistral-vibe-TRQDHAWV.js.map