@warlock.js/ai-cli 5.31.0 → 5.33.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/cjs/index.cjs +38 -46
  3. package/cjs/index.cjs.map +1 -1
  4. package/esm/adapters/aider.d.mts +4 -4
  5. package/esm/adapters/aider.d.mts.map +1 -1
  6. package/esm/adapters/amp.d.mts +2 -2
  7. package/esm/adapters/amp.d.mts.map +1 -1
  8. package/esm/adapters/antigravity.d.mts +3 -3
  9. package/esm/adapters/antigravity.d.mts.map +1 -1
  10. package/esm/adapters/claude-code.d.mts +2 -2
  11. package/esm/adapters/claude-code.d.mts.map +1 -1
  12. package/esm/adapters/claude-stream.d.mts +3 -3
  13. package/esm/adapters/claude-stream.d.mts.map +1 -1
  14. package/esm/adapters/codex.d.mts +3 -3
  15. package/esm/adapters/codex.d.mts.map +1 -1
  16. package/esm/adapters/codex.mjs +10 -8
  17. package/esm/adapters/codex.mjs.map +1 -1
  18. package/esm/adapters/copilot.d.mts +3 -3
  19. package/esm/adapters/copilot.d.mts.map +1 -1
  20. package/esm/adapters/copilot.mjs +5 -7
  21. package/esm/adapters/copilot.mjs.map +1 -1
  22. package/esm/adapters/cursor.d.mts +3 -3
  23. package/esm/adapters/cursor.d.mts.map +1 -1
  24. package/esm/adapters/droid.d.mts +3 -3
  25. package/esm/adapters/droid.d.mts.map +1 -1
  26. package/esm/adapters/grok.d.mts +3 -3
  27. package/esm/adapters/grok.d.mts.map +1 -1
  28. package/esm/adapters/grok.mjs +6 -8
  29. package/esm/adapters/grok.mjs.map +1 -1
  30. package/esm/adapters/index.d.mts +2 -1
  31. package/esm/adapters/index.mjs +1 -1
  32. package/esm/adapters/kimi.d.mts +3 -3
  33. package/esm/adapters/kimi.d.mts.map +1 -1
  34. package/esm/adapters/mistral-vibe.d.mts +3 -3
  35. package/esm/adapters/mistral-vibe.d.mts.map +1 -1
  36. package/esm/adapters/mistral-vibe.mjs +5 -7
  37. package/esm/adapters/mistral-vibe.mjs.map +1 -1
  38. package/esm/adapters/opencode.d.mts +3 -3
  39. package/esm/adapters/opencode.d.mts.map +1 -1
  40. package/esm/adapters/qwen-code.d.mts +2 -2
  41. package/esm/adapters/qwen-code.d.mts.map +1 -1
  42. package/esm/adapters/reasonix.d.mts +3 -3
  43. package/esm/adapters/reasonix.d.mts.map +1 -1
  44. package/esm/adapters/reasonix.mjs +6 -8
  45. package/esm/adapters/reasonix.mjs.map +1 -1
  46. package/esm/adapters/shared.d.mts +19 -16
  47. package/esm/adapters/shared.d.mts.map +1 -1
  48. package/esm/cli-agent.d.mts +9 -8
  49. package/esm/cli-agent.d.mts.map +1 -1
  50. package/esm/cli.d.mts +11 -8
  51. package/esm/cli.d.mts.map +1 -1
  52. package/esm/contracts/adapter.contract.d.mts +52 -31
  53. package/esm/contracts/adapter.contract.d.mts.map +1 -1
  54. package/esm/contracts/events.type.d.mts +36 -24
  55. package/esm/contracts/events.type.d.mts.map +1 -1
  56. package/esm/contracts/index.d.mts +2 -1
  57. package/esm/contracts/mcp.type.d.mts +4 -5
  58. package/esm/contracts/mcp.type.d.mts.map +1 -1
  59. package/esm/contracts/options.type.d.mts +56 -31
  60. package/esm/contracts/options.type.d.mts.map +1 -1
  61. package/esm/errors.d.mts +11 -9
  62. package/esm/errors.d.mts.map +1 -1
  63. package/esm/index.d.mts +2 -0
  64. package/esm/model/cli-model.d.mts +8 -7
  65. package/esm/model/cli-model.d.mts.map +1 -1
  66. package/esm/probe/probe.d.mts +4 -4
  67. package/esm/probe/probe.d.mts.map +1 -1
  68. package/esm/probe/probe.mjs +2 -2
  69. package/esm/probe/probe.mjs.map +1 -1
  70. package/esm/session/aggregate.mjs +2 -4
  71. package/esm/session/aggregate.mjs.map +1 -1
  72. package/esm/session/environment.mjs +1 -1
  73. package/esm/spawn/invocation.d.mts +6 -7
  74. package/esm/spawn/invocation.d.mts.map +1 -1
  75. package/esm/spawn/invocation.mjs +3 -3
  76. package/esm/spawn/invocation.mjs.map +1 -1
  77. package/esm/spawn/resolve-command.d.mts +12 -10
  78. package/esm/spawn/resolve-command.d.mts.map +1 -1
  79. package/esm/stream/json-lines.d.mts +10 -10
  80. package/esm/stream/json-lines.d.mts.map +1 -1
  81. package/esm/stream/line-splitter.mjs +2 -2
  82. package/esm/stream/line-splitter.mjs.map +1 -1
  83. package/esm/utils/toml.d.mts +3 -4
  84. package/esm/utils/toml.d.mts.map +1 -1
  85. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"mistral-vibe.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/mistral-vibe.ts"],"mappings":";;;;;AAkDA;;;;AAuEC;AAiFD;;;;;;;;AAA6E;;;;;;;;cAxJhE,kBAAA,EAAoB,UAuEhC;;iBAiFe,gBAAA,CAAiB,OAAA,GAAU,gBAAA,GAAmB,eAAe"}
1
+ {"version":3,"file":"mistral-vibe.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/mistral-vibe.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;qBAkDa,oBAAoB;;wBAwJjB,iBAAiB,UAAU,mBAAmB"}
@@ -229,13 +229,11 @@ function createVibeParser(context) {
229
229
  }
230
230
  break;
231
231
  }
232
- case "notice":
233
- if (stringField(record, "level") === "error") events.push({
234
- type: "error",
235
- message: stringField(record, "message") ?? "error",
236
- raw: record
237
- });
238
- break;
232
+ case "notice": if (stringField(record, "level") === "error") events.push({
233
+ type: "error",
234
+ message: stringField(record, "message") ?? "error",
235
+ raw: record
236
+ });
239
237
  }
240
238
  return events;
241
239
  }, () => {
@@ -1 +1 @@
1
- {"version":3,"file":"mistral-vibe.mjs","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/mistral-vibe.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n CliAdapter,\n CliLaunchContext,\n CliLaunchFile,\n CliMcpServers,\n CliParsedEvent,\n CliStreamParser,\n} from \"../contracts\";\nimport {\n asArray,\n asRecord,\n jsonLinesParser,\n numberField,\n outputText,\n parseJsonLine,\n recordField,\n stringField,\n} from \"../stream/json-lines\";\nimport { type TomlTable, toToml } from \"../utils/toml\";\nimport { argvPrompt, promptFile, requirePrivateHome, usageOf } from \"./shared\";\n\n/** Folder (inside the run directory) Vibe writes `export.json` to. */\nconst EXPORT_DIR = \"vibe-output\";\n\n/**\n * Mistral Vibe (`vibe`, PyPI `mistral-vibe`).\n *\n * Verified against the official repo at tag v2.26.1 only (README,\n * `vibe/cli/entrypoint.py`, `vibe/cli/programmatic.py`,\n * `vibe/app_server/run_export.py`, `vibe/core/config/*`); Vibe needs Python\n * 3.12, so no real `--help` was run, 2026-10-17. The capability probe checks\n * every flag against the installed `--help`.\n *\n * - Headless: `vibe -p <prompt> --output streaming` (or `--prompt-file`;\n * `-p` with no value reads stdin). The stream is NDJSON of completed\n * history entries (camelCase): `message` (`role`, `content[].text`), and\n * `effect` — a tool call and its result in one line (`detail.toolName`,\n * `detail.input`, `state.status`, `state.outputText`/`state.error`).\n * There is no usage, cost or final record in the stream, so the adapter\n * adds `--output-dir` and reads usage, cost, session id and outcome from\n * `export.json` when the stream ends.\n * - Model: no flag; `VIBE_ACTIVE_MODEL=<alias>` (set from `model`). Effort\n * is a per-model config field, so `effort` is refused.\n * - Permissions: headless auto-denies every approval (the default agent\n * only auto-approves file edits); bypass is `--auto-approve`.\n * - MCP: `[[mcp_servers]]` in `$VIBE_HOME/config.toml` (private home).\n * - Auth: `MISTRAL_API_KEY`; home `VIBE_HOME`.\n */\nexport const mistralVibeAdapter: CliAdapter = {\n name: \"mistral-vibe\",\n title: \"Mistral Vibe\",\n command: \"vibe\",\n apiKeyEnv: [\"MISTRAL_API_KEY\"],\n homeEnv: [\"VIBE_HOME\"],\n transports: [\"argv\", \"file\", \"stdin\"],\n effort: false,\n mcp: true,\n probe: { help: [[\"--help\"]], version: [\"--version\"] },\n verification: {\n version: \"2.26.1\",\n verifiedBy: \"docs\",\n sources: [\n \"https://github.com/mistralai/mistral-vibe/blob/v2.26.1/README.md\",\n \"https://github.com/mistralai/mistral-vibe/blob/v2.26.1/vibe/cli/entrypoint.py\",\n \"https://github.com/mistralai/mistral-vibe/blob/v2.26.1/vibe/cli/programmatic.py\",\n ],\n checkedAt: \"2026-10-17\",\n },\n plan(context) {\n const args = [\"--output\", \"streaming\", \"--output-dir\", path.join(context.runDir, EXPORT_DIR)];\n const requires = [\"--output\", \"streaming\", \"--output-dir\"];\n const files: CliLaunchFile[] = [];\n const env: Record<string, string> = {};\n\n if (context.model !== undefined) {\n env.VIBE_ACTIVE_MODEL = context.model;\n }\n\n if (context.resume !== undefined) {\n args.push(\"--resume\", context.resume);\n requires.push(\"--resume\");\n }\n\n if (context.permission === \"bypass\") {\n args.push(\"--auto-approve\");\n requires.push(\"--auto-approve\");\n }\n\n if (context.mcp !== undefined) {\n const home = requirePrivateHome(context, mistralVibeAdapter, \"MCP servers\");\n\n files.push({\n path: path.join(home, \"config.toml\"),\n content: toToml({ mcp_servers: vibeMcp(context.mcp) }),\n });\n }\n\n if (context.home !== undefined) {\n env.VIBE_HOME = context.home;\n }\n\n if (context.transport === \"file\") {\n const prompt = promptFile(context);\n\n files.push(prompt);\n requires.push(\"--prompt-file\");\n\n return { args, tail: [\"--prompt-file\", prompt.path], env, files, requires };\n }\n\n requires.push(\"-p\");\n\n if (context.transport === \"stdin\") {\n return { args, tail: [\"-p\"], stdin: context.prompt, env, files, requires };\n }\n\n return { args, tail: [\"-p\", argvPrompt(context.prompt)], env, files, requires };\n },\n parser: createVibeParser,\n};\n\nfunction vibeMcp(servers: CliMcpServers): TomlTable[] {\n return Object.entries(servers).map(([name, server]): TomlTable =>\n server.type === \"stdio\"\n ? {\n name,\n transport: \"stdio\",\n command: server.command,\n args: server.args ?? [],\n env: server.env,\n }\n : {\n name,\n transport: server.type === \"http\" ? \"streamable-http\" : \"http\",\n url: server.url,\n auth:\n server.headers !== undefined ? { type: \"static\", headers: server.headers } : undefined,\n },\n );\n}\n\n/** Read Vibe's `export.json`: usage, cost, session id and outcome of the run. */\nfunction exportEvents(context: CliLaunchContext | undefined): {\n events: CliParsedEvent[];\n sessionRef?: string;\n} {\n if (context === undefined) {\n return { events: [] };\n }\n\n let report: Record<string, unknown> | undefined;\n\n try {\n report = parseJsonLine(\n readFileSync(path.join(context.runDir, EXPORT_DIR, \"export.json\"), \"utf8\"),\n );\n } catch {\n return { events: [] };\n }\n\n if (report === undefined) {\n return { events: [] };\n }\n\n const events: CliParsedEvent[] = [];\n const usage = recordField(report, \"usage\");\n\n if (usage !== undefined) {\n const cached = numberField(usage, \"cached_input_tokens\");\n\n events.push({\n type: \"usage\",\n cumulative: true,\n usage: usageOf({\n input: numberField(usage, \"input_tokens\"),\n output: numberField(usage, \"output_tokens\"),\n total: numberField(usage, \"total_tokens\"),\n cachedTokens: cached !== undefined && cached > 0 ? cached : undefined,\n costUSD: numberField(report, \"cost_usd\"),\n }),\n raw: report,\n });\n }\n\n const outcome = stringField(report, \"outcome\");\n\n if (outcome !== undefined && outcome !== \"finished\") {\n events.push({\n type: \"error\",\n message:\n stringField(recordField(report, \"error\"), \"message\") ?? `Mistral Vibe stopped: ${outcome}`,\n fatal: true,\n raw: report,\n });\n }\n\n return { events, sessionRef: stringField(report, \"session_id\") };\n}\n\n/** Parser for `vibe -p … --output streaming` (plus the run's `export.json`). */\nexport function createVibeParser(context?: CliLaunchContext): CliStreamParser {\n let started = false;\n let sessionRef: string | undefined;\n\n const parser = jsonLinesParser(\n (record): CliParsedEvent[] => {\n const events: CliParsedEvent[] = [];\n const session = stringField(record, \"sessionId\");\n\n if (session !== undefined) {\n sessionRef = session;\n }\n\n if (!started) {\n started = true;\n events.push({ type: \"session.started\", sessionRef: session, raw: record });\n }\n\n switch (stringField(record, \"type\")) {\n case \"message\": {\n if (stringField(record, \"role\") !== \"assistant\") {\n break;\n }\n\n const text = asArray(record.content)\n .map((block) => stringField(asRecord(block), \"text\") ?? \"\")\n .join(\"\");\n\n if (text.length > 0) {\n events.push({ type: \"message\", text, delta: false, raw: record });\n }\n break;\n }\n case \"effect\": {\n const detail = recordField(record, \"detail\");\n const state = recordField(record, \"state\");\n const status = stringField(state, \"status\");\n const id = stringField(record, \"id\") ?? \"\";\n\n events.push({\n type: \"tool.call\",\n id,\n name: stringField(detail, \"toolName\") ?? stringField(record, \"title\") ?? \"\",\n input: detail?.input,\n raw: record,\n });\n\n if (\n status === \"completed\" ||\n status === \"failed\" ||\n status === \"cancelled\" ||\n status === \"skipped\"\n ) {\n const error = stringField(recordField(state, \"error\"), \"message\");\n\n events.push({\n type: \"tool.result\",\n id,\n output: error ?? stringField(state, \"outputText\") ?? outputText(state?.output),\n isError: status !== \"completed\",\n raw: record,\n });\n }\n break;\n }\n case \"notice\":\n if (stringField(record, \"level\") === \"error\") {\n events.push({\n type: \"error\",\n message: stringField(record, \"message\") ?? \"error\",\n raw: record,\n });\n }\n break;\n }\n\n return events;\n },\n () => {\n const exported = exportEvents(context);\n\n sessionRef = exported.sessionRef ?? sessionRef;\n\n return exported.events;\n },\n );\n\n return { ...parser, sessionRef: () => sessionRef };\n}\n"],"mappings":";;;;;;;;AAwBA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;AA0BnB,MAAa,qBAAiC;CAC5C,MAAM;CACN,OAAO;CACP,SAAS;CACT,WAAW,CAAC,iBAAiB;CAC7B,SAAS,CAAC,WAAW;CACrB,YAAY;EAAC;EAAQ;EAAQ;CAAO;CACpC,QAAQ;CACR,KAAK;CACL,OAAO;EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC;EAAG,SAAS,CAAC,WAAW;CAAE;CACpD,cAAc;EACZ,SAAS;EACT,YAAY;EACZ,SAAS;GACP;GACA;GACA;EACF;EACA,WAAW;CACb;CACA,KAAK,SAAS;EACZ,MAAM,OAAO;GAAC;GAAY;GAAa;GAAgB,KAAK,KAAK,QAAQ,QAAQ,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K;KACP,CAAC;KAEH;GACJ;GAEA,OAAO;EACT,SACM;GACJ,MAAM,WAAW,aAAa,OAAO;GAErC,aAAa,SAAS,cAAc;GAEpC,OAAO,SAAS;EAClB,CAGe;EAAG,kBAAkB;CAAW;AACnD"}
1
+ {"version":3,"file":"mistral-vibe.mjs","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/mistral-vibe.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n CliAdapter,\n CliLaunchContext,\n CliLaunchFile,\n CliMcpServers,\n CliParsedEvent,\n CliStreamParser,\n} from \"../contracts\";\nimport {\n asArray,\n asRecord,\n jsonLinesParser,\n numberField,\n outputText,\n parseJsonLine,\n recordField,\n stringField,\n} from \"../stream/json-lines\";\nimport { type TomlTable, toToml } from \"../utils/toml\";\nimport { argvPrompt, promptFile, requirePrivateHome, usageOf } from \"./shared\";\n\n/** Folder (inside the run directory) Vibe writes `export.json` to. */\nconst EXPORT_DIR = \"vibe-output\";\n\n/**\n * Mistral Vibe (`vibe`, PyPI `mistral-vibe`).\n *\n * Verified against the official repo at tag v2.26.1 only (README,\n * `vibe/cli/entrypoint.py`, `vibe/cli/programmatic.py`,\n * `vibe/app_server/run_export.py`, `vibe/core/config/*`); Vibe needs Python\n * 3.12, so no real `--help` was run, 2026-10-17. The capability probe checks\n * every flag against the installed `--help`.\n *\n * - Headless: `vibe -p <prompt> --output streaming` (or `--prompt-file`;\n * `-p` with no value reads stdin). The stream is NDJSON of completed\n * history entries (camelCase): `message` (`role`, `content[].text`), and\n * `effect` — a tool call and its result in one line (`detail.toolName`,\n * `detail.input`, `state.status`, `state.outputText`/`state.error`).\n * There is no usage, cost or final record in the stream, so the adapter\n * adds `--output-dir` and reads usage, cost, session id and outcome from\n * `export.json` when the stream ends.\n * - Model: no flag; `VIBE_ACTIVE_MODEL=<alias>` (set from `model`). Effort\n * is a per-model config field, so `effort` is refused.\n * - Permissions: headless auto-denies every approval (the default agent\n * only auto-approves file edits); bypass is `--auto-approve`.\n * - MCP: `[[mcp_servers]]` in `$VIBE_HOME/config.toml` (private home).\n * - Auth: `MISTRAL_API_KEY`; home `VIBE_HOME`.\n */\nexport const mistralVibeAdapter: CliAdapter = {\n name: \"mistral-vibe\",\n title: \"Mistral Vibe\",\n command: \"vibe\",\n apiKeyEnv: [\"MISTRAL_API_KEY\"],\n homeEnv: [\"VIBE_HOME\"],\n transports: [\"argv\", \"file\", \"stdin\"],\n effort: false,\n mcp: true,\n probe: { help: [[\"--help\"]], version: [\"--version\"] },\n verification: {\n version: \"2.26.1\",\n verifiedBy: \"docs\",\n sources: [\n \"https://github.com/mistralai/mistral-vibe/blob/v2.26.1/README.md\",\n \"https://github.com/mistralai/mistral-vibe/blob/v2.26.1/vibe/cli/entrypoint.py\",\n \"https://github.com/mistralai/mistral-vibe/blob/v2.26.1/vibe/cli/programmatic.py\",\n ],\n checkedAt: \"2026-10-17\",\n },\n plan(context) {\n const args = [\"--output\", \"streaming\", \"--output-dir\", path.join(context.runDir, EXPORT_DIR)];\n const requires = [\"--output\", \"streaming\", \"--output-dir\"];\n const files: CliLaunchFile[] = [];\n const env: Record<string, string> = {};\n\n if (context.model !== undefined) {\n env.VIBE_ACTIVE_MODEL = context.model;\n }\n\n if (context.resume !== undefined) {\n args.push(\"--resume\", context.resume);\n requires.push(\"--resume\");\n }\n\n if (context.permission === \"bypass\") {\n args.push(\"--auto-approve\");\n requires.push(\"--auto-approve\");\n }\n\n if (context.mcp !== undefined) {\n const home = requirePrivateHome(context, mistralVibeAdapter, \"MCP servers\");\n\n files.push({\n path: path.join(home, \"config.toml\"),\n content: toToml({ mcp_servers: vibeMcp(context.mcp) }),\n });\n }\n\n if (context.home !== undefined) {\n env.VIBE_HOME = context.home;\n }\n\n if (context.transport === \"file\") {\n const prompt = promptFile(context);\n\n files.push(prompt);\n requires.push(\"--prompt-file\");\n\n return { args, tail: [\"--prompt-file\", prompt.path], env, files, requires };\n }\n\n requires.push(\"-p\");\n\n if (context.transport === \"stdin\") {\n return { args, tail: [\"-p\"], stdin: context.prompt, env, files, requires };\n }\n\n return { args, tail: [\"-p\", argvPrompt(context.prompt)], env, files, requires };\n },\n parser: createVibeParser,\n};\n\nfunction vibeMcp(servers: CliMcpServers): TomlTable[] {\n return Object.entries(servers).map(([name, server]): TomlTable =>\n server.type === \"stdio\"\n ? {\n name,\n transport: \"stdio\",\n command: server.command,\n args: server.args ?? [],\n env: server.env,\n }\n : {\n name,\n transport: server.type === \"http\" ? \"streamable-http\" : \"http\",\n url: server.url,\n auth:\n server.headers !== undefined ? { type: \"static\", headers: server.headers } : undefined,\n },\n );\n}\n\n/** Read Vibe's `export.json`: usage, cost, session id and outcome of the run. */\nfunction exportEvents(context: CliLaunchContext | undefined): {\n events: CliParsedEvent[];\n sessionRef?: string;\n} {\n if (context === undefined) {\n return { events: [] };\n }\n\n let report: Record<string, unknown> | undefined;\n\n try {\n report = parseJsonLine(\n readFileSync(path.join(context.runDir, EXPORT_DIR, \"export.json\"), \"utf8\"),\n );\n } catch {\n return { events: [] };\n }\n\n if (report === undefined) {\n return { events: [] };\n }\n\n const events: CliParsedEvent[] = [];\n const usage = recordField(report, \"usage\");\n\n if (usage !== undefined) {\n const cached = numberField(usage, \"cached_input_tokens\");\n\n events.push({\n type: \"usage\",\n cumulative: true,\n usage: usageOf({\n input: numberField(usage, \"input_tokens\"),\n output: numberField(usage, \"output_tokens\"),\n total: numberField(usage, \"total_tokens\"),\n cachedTokens: cached !== undefined && cached > 0 ? cached : undefined,\n costUSD: numberField(report, \"cost_usd\"),\n }),\n raw: report,\n });\n }\n\n const outcome = stringField(report, \"outcome\");\n\n if (outcome !== undefined && outcome !== \"finished\") {\n events.push({\n type: \"error\",\n message:\n stringField(recordField(report, \"error\"), \"message\") ?? `Mistral Vibe stopped: ${outcome}`,\n fatal: true,\n raw: report,\n });\n }\n\n return { events, sessionRef: stringField(report, \"session_id\") };\n}\n\n/** Parser for `vibe -p … --output streaming` (plus the run's `export.json`). */\nexport function createVibeParser(context?: CliLaunchContext): CliStreamParser {\n let started = false;\n let sessionRef: string | undefined;\n\n const parser = jsonLinesParser(\n (record): CliParsedEvent[] => {\n const events: CliParsedEvent[] = [];\n const session = stringField(record, \"sessionId\");\n\n if (session !== undefined) {\n sessionRef = session;\n }\n\n if (!started) {\n started = true;\n events.push({ type: \"session.started\", sessionRef: session, raw: record });\n }\n\n switch (stringField(record, \"type\")) {\n case \"message\": {\n if (stringField(record, \"role\") !== \"assistant\") {\n break;\n }\n\n const text = asArray(record.content)\n .map((block) => stringField(asRecord(block), \"text\") ?? \"\")\n .join(\"\");\n\n if (text.length > 0) {\n events.push({ type: \"message\", text, delta: false, raw: record });\n }\n break;\n }\n case \"effect\": {\n const detail = recordField(record, \"detail\");\n const state = recordField(record, \"state\");\n const status = stringField(state, \"status\");\n const id = stringField(record, \"id\") ?? \"\";\n\n events.push({\n type: \"tool.call\",\n id,\n name: stringField(detail, \"toolName\") ?? stringField(record, \"title\") ?? \"\",\n input: detail?.input,\n raw: record,\n });\n\n if (\n status === \"completed\" ||\n status === \"failed\" ||\n status === \"cancelled\" ||\n status === \"skipped\"\n ) {\n const error = stringField(recordField(state, \"error\"), \"message\");\n\n events.push({\n type: \"tool.result\",\n id,\n output: error ?? stringField(state, \"outputText\") ?? outputText(state?.output),\n isError: status !== \"completed\",\n raw: record,\n });\n }\n break;\n }\n case \"notice\":\n if (stringField(record, \"level\") === \"error\") {\n events.push({\n type: \"error\",\n message: stringField(record, \"message\") ?? \"error\",\n raw: record,\n });\n }\n break;\n }\n\n return events;\n },\n () => {\n const exported = exportEvents(context);\n\n sessionRef = exported.sessionRef ?? sessionRef;\n\n return exported.events;\n },\n );\n\n return { ...parser, sessionRef: () => sessionRef };\n}\n"],"mappings":";;;;;;;;AAwBA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;AA0BnB,MAAa,qBAAiC;CAC5C,MAAM;CACN,OAAO;CACP,SAAS;CACT,WAAW,CAAC,i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X,WAAW,WACX;MACA,MAAM,QAAQ,YAAY,YAAY,OAAO,OAAO,GAAG,SAAS;MAEhE,OAAO,KAAK;OACV,MAAM;OACN;OACA,QAAQ,SAAS,YAAY,OAAO,YAAY,KAAK,WAAW,OAAO,MAAM;OAC7E,SAAS,WAAW;OACpB,KAAK;MACP,CAAC;KACH;KACA;IACF;IACA,KAAK,UACH,IAAI,YAAY,QAAQ,OAAO,MAAM,SACnC,OAAO,KAAK;KACV,MAAM;KACN,SAAS,YAAY,QAAQ,SAAS,KAAK;KAC3C,KAAK;IACP,CAAC;GAGP;GAEA,OAAO;EACT,SACM;GACJ,MAAM,WAAW,aAAa,OAAO;GAErC,aAAa,SAAS,cAAc;GAEpC,OAAO,SAAS;EAClB,CAGe;EAAG,kBAAkB;CAAW;AACnD"}
@@ -1,4 +1,5 @@
1
1
  import { CliAdapter, CliStreamParser } from "../contracts/adapter.contract.mjs";
2
+ import "../contracts/index.mjs";
2
3
  //#region ../../packages/ai-cli/src/adapters/opencode.d.ts
3
4
  /**
4
5
  * OpenCode (`opencode`, npm `opencode-ai`).
@@ -28,9 +29,8 @@ import { CliAdapter, CliStreamParser } from "../contracts/adapter.contract.mjs";
28
29
  * - The working directory is passed with `--dir`, because OpenCode prefers a
29
30
  * (possibly stale) `PWD` over the process cwd.
30
31
  */
31
- declare const opencodeAdapter: CliAdapter;
32
+ export declare const opencodeAdapter: CliAdapter;
32
33
  /** Parser for `opencode run --format json`. */
33
- declare function createOpencodeParser(): CliStreamParser;
34
+ export declare function createOpencodeParser(): CliStreamParser;
34
35
  //#endregion
35
- export { createOpencodeParser, opencodeAdapter };
36
36
  //# sourceMappingURL=opencode.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"opencode.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/opencode.ts"],"mappings":";;;;;AA6CA;;;;AA8EC;AA0BD;;;;AAAuD;;;;;;;;;;;;;;;;cAxG1C,eAAA,EAAiB,UA8E7B;;iBA0Be,oBAAA,IAAwB,eAAe"}
1
+ {"version":3,"file":"opencode.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/opencode.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA6Ca,iBAAiB;;wBAwGd,wBAAwB"}
@@ -1,4 +1,5 @@
1
1
  import { CliAdapter } from "../contracts/adapter.contract.mjs";
2
+ import "../contracts/index.mjs";
2
3
  //#region ../../packages/ai-cli/src/adapters/qwen-code.d.ts
3
4
  /**
4
5
  * Qwen Code (`qwen`, npm `@qwen-code/qwen-code`), a Gemini CLI fork.
@@ -24,7 +25,6 @@ import { CliAdapter } from "../contracts/adapter.contract.mjs";
24
25
  * - Effort has no flag (it is the `model.reasoningEffort` setting), so
25
26
  * `effort` is refused.
26
27
  */
27
- declare const qwenCodeAdapter: CliAdapter;
28
+ export declare const qwenCodeAdapter: CliAdapter;
28
29
  //#endregion
29
- export { qwenCodeAdapter };
30
30
  //# sourceMappingURL=qwen-code.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qwen-code.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/qwen-code.ts"],"mappings":";;;;;AA6BA;;;;AA+DC;;;;;;;;;;;;;;;;;cA/DY,eAAA,EAAiB,UA+D7B"}
1
+ {"version":3,"file":"qwen-code.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/qwen-code.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;qBA6Ba,iBAAiB"}
@@ -1,4 +1,5 @@
1
1
  import { CliAdapter, CliStreamParser } from "../contracts/adapter.contract.mjs";
2
+ import "../contracts/index.mjs";
2
3
  //#region ../../packages/ai-cli/src/adapters/reasonix.d.ts
3
4
  /**
4
5
  * Reasonix (`reasonix`, npm `reasonix`) — a cache-first coding agent built
@@ -23,9 +24,8 @@ import { CliAdapter, CliStreamParser } from "../contracts/adapter.contract.mjs";
23
24
  * `DEEPSEEK_API_KEY` — this needs a private home. For another provider,
24
25
  * put its variable in that file yourself via a caller-owned home.
25
26
  */
26
- declare const reasonixAdapter: CliAdapter;
27
+ export declare const reasonixAdapter: CliAdapter;
27
28
  /** Parser for `reasonix run --output-format stream-json`. */
28
- declare function createReasonixParser(): CliStreamParser;
29
+ export declare function createReasonixParser(): CliStreamParser;
29
30
  //#endregion
30
- export { createReasonixParser, reasonixAdapter };
31
31
  //# sourceMappingURL=reasonix.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reasonix.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/reasonix.ts"],"mappings":";;;;;AAkDA;;;;AAgFC;AA6BD;;;;AAAuD;;;;;;;;;;;cA7G1C,eAAA,EAAiB,UAgF7B;;iBA6Be,oBAAA,IAAwB,eAAe"}
1
+ {"version":3,"file":"reasonix.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/reasonix.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;qBAkDa,iBAAiB;;wBA6Gd,wBAAwB"}
@@ -230,14 +230,12 @@ function createReasonixParser() {
230
230
  });
231
231
  break;
232
232
  }
233
- case "turn_done":
234
- if (stringField(record, "status") === "failed") events.push({
235
- type: "error",
236
- message: stringField(record, "err") ?? "Reasonix turn failed",
237
- fatal: true,
238
- raw: record
239
- });
240
- break;
233
+ case "turn_done": if (stringField(record, "status") === "failed") events.push({
234
+ type: "error",
235
+ message: stringField(record, "err") ?? "Reasonix turn failed",
236
+ fatal: true,
237
+ raw: record
238
+ });
241
239
  }
242
240
  return events;
243
241
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"reasonix.mjs","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/reasonix.ts"],"sourcesContent":["import path from \"node:path\";\nimport type {\n CliAdapter,\n CliLaunchFile,\n CliMcpServers,\n CliParsedEvent,\n CliStreamParser,\n CliUsage,\n} from \"../contracts\";\nimport {\n asRecord,\n jsonLinesParser,\n numberField,\n recordField,\n stringField,\n type JsonRecord,\n} from \"../stream/json-lines\";\nimport { type TomlTable, toToml } from \"../utils/toml\";\nimport {\n argvPrompt,\n dotenvFile,\n mapEffort,\n parseArguments,\n requirePrivateHome,\n usageOf,\n} from \"./shared\";\n\n/**\n * Reasonix (`reasonix`, npm `reasonix`) — a cache-first coding agent built\n * around DeepSeek (now multi-provider); the npm package launches a prebuilt\n * Go binary.\n *\n * Verified against the real `reasonix run --help` / `--version` of 2.43.0,\n * real stream-json output (captured against a local fake model server) and\n * the docs at that tag (`docs/CLI.md`, `docs/CONFIG_PATHS.md`), 2026-10-17.\n *\n * - Headless: `reasonix run --output-format stream-json <task>`; with no\n * positional task, piped stdin is the prompt.\n * - Stream: every line has `kind` (`text` deltas, `message` full text,\n * `tool_dispatch`/`tool_started`/`tool_result` with a `tool` object whose\n * non-empty `err` marks a failure, `usage` per model call, `turn_done`) plus\n * `sessionId`; the final line is `{\"type\":\"result\",…}` with totals.\n * - Permissions: headless \"ask\" mode refuses writes (listed in\n * `permission_denials`; exit 4 in an untrusted folder); bypass is `--yolo`.\n * - MCP: no flag; `[[plugins]]` in `$REASONIX_HOME/config.toml`.\n * - Auth: provider keys are read only from `$REASONIX_HOME/.env`, never the\n * shell environment, so `apiKey` is written there (0600) as\n * `DEEPSEEK_API_KEY` — this needs a private home. For another provider,\n * put its variable in that file yourself via a caller-owned home.\n */\nexport const reasonixAdapter: CliAdapter = {\n name: \"reasonix\",\n title: \"Reasonix\",\n command: \"reasonix\",\n apiKeyEnv: [\"DEEPSEEK_API_KEY\"],\n homeEnv: [\"REASONIX_HOME\"],\n transports: [\"argv\", \"stdin\"],\n effort: true,\n mcp: true,\n probe: { help: [[\"run\", \"--help\"]], version: [\"--version\"] },\n verification: {\n version: \"2.43.0\",\n verifiedBy: \"help\",\n sources: [\n \"https://github.com/esengine/DeepSeek-Reasonix/blob/v2.43.0/docs/CLI.md\",\n \"https://github.com/esengine/DeepSeek-Reasonix/blob/v2.43.0/docs/CONFIG_PATHS.md\",\n \"https://www.npmjs.com/package/reasonix\",\n ],\n checkedAt: \"2026-10-17\",\n },\n plan(context) {\n const args = [\"run\", \"--output-format\", \"stream-json\"];\n const requires = [\"--output-format\", \"stream-json\"];\n const files: CliLaunchFile[] = [];\n\n if (context.model !== undefined) {\n args.push(\"--model\", context.model);\n requires.push(\"--model\");\n }\n\n if (context.effort !== undefined) {\n // DeepSeek levels per docs/REASONING_PROVIDERS.md: auto | disabled | low | high | max.\n args.push(\n \"--effort\",\n mapEffort(context.effort, { none: \"disabled\", low: \"low\", high: \"high\", max: \"max\" }),\n );\n requires.push(\"--effort\");\n }\n\n if (context.resume !== undefined) {\n args.push(\"--resume\", context.resume);\n requires.push(\"--resume\");\n }\n\n if (context.permission === \"bypass\") {\n args.push(\"--yolo\");\n requires.push(\"--yolo\");\n }\n\n if (context.mcp !== undefined) {\n const home = requirePrivateHome(context, reasonixAdapter, \"MCP servers\");\n\n files.push({\n path: path.join(home, \"config.toml\"),\n content: toToml({ plugins: reasonixPlugins(context.mcp) }),\n });\n }\n\n if (context.apiKey !== undefined) {\n const home = requirePrivateHome(context, reasonixAdapter, \"API keys (its .env file)\");\n\n files.push({\n path: path.join(home, \".env\"),\n content: dotenvFile({ DEEPSEEK_API_KEY: context.apiKey }),\n });\n }\n\n return {\n args,\n tail: context.transport === \"argv\" ? [argvPrompt(context.prompt)] : [],\n stdin: context.transport === \"stdin\" ? context.prompt : undefined,\n env: {\n ...(context.home !== undefined ? { REASONIX_HOME: context.home } : {}),\n REASONIX_TELEMETRY: \"off\",\n },\n files,\n requires,\n };\n },\n parser: createReasonixParser,\n};\n\nfunction reasonixPlugins(servers: CliMcpServers): TomlTable[] {\n return Object.entries(servers).map(([name, server]): TomlTable =>\n server.type === \"stdio\"\n ? { name, type: \"stdio\", command: server.command, args: server.args ?? [], env: server.env }\n : { name, type: server.type, url: server.url, headers: server.headers },\n );\n}\n\n/** Reasonix per-call usage (`promptTokens` includes cache hits). */\nfunction callUsage(usage: JsonRecord | undefined): CliUsage | undefined {\n if (usage === undefined) {\n return undefined;\n }\n\n const cacheHit = numberField(usage, \"cacheHitTokens\");\n\n return usageOf({\n input: numberField(usage, \"promptTokens\"),\n output: numberField(usage, \"completionTokens\"),\n total: numberField(usage, \"totalTokens\"),\n cachedTokens: cacheHit !== undefined && cacheHit > 0 ? cacheHit : undefined,\n reasoningTokens: numberField(usage, \"reasoningTokens\"),\n costUSD: numberField(usage, \"costUsd\"),\n });\n}\n\n/** Parser for `reasonix run --output-format stream-json`. */\nexport function createReasonixParser(): CliStreamParser {\n let started = false;\n let sessionRef: string | undefined;\n\n return {\n ...jsonLinesParser((record): CliParsedEvent[] => {\n const events: CliParsedEvent[] = [];\n const recordSession = stringField(record, \"sessionId\") ?? stringField(record, \"session_id\");\n\n if (recordSession !== undefined) {\n sessionRef = recordSession;\n }\n\n if (!started && recordSession !== undefined) {\n started = true;\n events.push({ type: \"session.started\", sessionRef: recordSession, raw: record });\n }\n\n if (stringField(record, \"type\") === \"result\") {\n const usage = recordField(record, \"usage\");\n\n if (usage !== undefined) {\n events.push({\n type: \"usage\",\n cumulative: true,\n usage: usageOf({\n input: numberField(usage, \"input_tokens\"),\n output: numberField(usage, \"output_tokens\"),\n cachedTokens: numberField(usage, \"cache_read_input_tokens\") || undefined,\n costUSD: numberField(record, \"total_cost_usd\"),\n }),\n raw: record,\n });\n }\n\n const result = stringField(record, \"result\") ?? \"\";\n\n if (record.is_error === true) {\n events.push({\n type: \"error\",\n message: result || \"Reasonix run failed\",\n fatal: true,\n raw: record,\n });\n } else if (result.length > 0) {\n events.push({ type: \"message\", text: result, delta: false, final: true, raw: record });\n }\n\n return events;\n }\n\n const tool = asRecord(record.tool);\n\n switch (stringField(record, \"kind\")) {\n case \"text\": {\n const text = stringField(record, \"text\") ?? \"\";\n\n if (text.length > 0) {\n events.push({ type: \"message\", text, delta: true, raw: record });\n }\n break;\n }\n case \"message\":\n events.push({\n type: \"message\",\n text: stringField(record, \"text\") ?? \"\",\n delta: false,\n raw: record,\n });\n break;\n case \"tool_dispatch\":\n // The first dispatch streams arguments (`partial: true`); report the complete one.\n if (tool !== undefined && tool.partial !== true) {\n events.push({\n type: \"tool.call\",\n id: stringField(tool, \"id\") ?? \"\",\n name: stringField(tool, \"name\") ?? \"\",\n input: parseArguments(tool.args),\n raw: record,\n });\n }\n break;\n case \"tool_result\": {\n const error = stringField(tool, \"err\") ?? \"\";\n\n events.push({\n type: \"tool.result\",\n id: stringField(tool, \"id\") ?? \"\",\n output: error.length > 0 ? error : (stringField(tool, \"output\") ?? \"\"),\n isError: error.length > 0,\n raw: record,\n });\n break;\n }\n case \"usage\": {\n const usage = callUsage(recordField(record, \"usage\"));\n\n if (usage !== undefined) {\n events.push({ type: \"usage\", usage, cumulative: false, raw: record });\n }\n break;\n }\n case \"turn_done\":\n if (stringField(record, \"status\") === \"failed\") {\n events.push({\n type: \"error\",\n message: stringField(record, \"err\") ?? \"Reasonix turn failed\",\n fatal: true,\n raw: record,\n });\n }\n break;\n }\n\n return events;\n }),\n sessionRef: () => sessionRef,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAa,kBAA8B;CACzC,MAAM;CACN,OAAO;CACP,SAAS;CACT,WAAW,CAAC,kBAAkB;CAC9B,SAAS,CAAC,eAAe;CACzB,YAAY,CAAC,QAAQ,OAAO;CAC5B,QAAQ;CACR,KAAK;CACL,OAAO;EAAE,MAAM,CAAC,CAAC,OAAO,QAAQ,CAAC;EAAG,SAAS,CAAC,WAAW;CAAE;CAC3D,cAAc;EACZ,SAAS;EACT,YAAY;EACZ,SAAS;GACP;GACA;GACA;EACF;EACA,WAAW;CACb;CACA,KAAK,SAAS;EACZ,MAAM,OAAO;GAAC;GAAO;GAAmB;EAAa;EACrD,MAAM,WAAW,CAAC,mBAAmB,aAAa;EAClD,MAAM,QAAyB,CAAC;EAEhC,IAAI,QAAQ,UAAU,QAAW;GAC/B,KAAK,KAAK,WAAW,QAAQ,KAAK;GAClC,SAAS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V,MAAM;MACN,SAAS,YAAY,QAAQ,KAAK,KAAK;MACvC,OAAO;MACP,KAAK;KACP,CAAC;KAEH;GACJ;GAEA,OAAO;EACT,CAAC;EACD,kBAAkB;CACpB;AACF"}
1
+ {"version":3,"file":"reasonix.mjs","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/reasonix.ts"],"sourcesContent":["import path from \"node:path\";\nimport type {\n CliAdapter,\n CliLaunchFile,\n CliMcpServers,\n CliParsedEvent,\n CliStreamParser,\n CliUsage,\n} from \"../contracts\";\nimport {\n asRecord,\n jsonLinesParser,\n numberField,\n recordField,\n stringField,\n type JsonRecord,\n} from \"../stream/json-lines\";\nimport { type TomlTable, toToml } from \"../utils/toml\";\nimport {\n argvPrompt,\n dotenvFile,\n mapEffort,\n parseArguments,\n requirePrivateHome,\n usageOf,\n} from \"./shared\";\n\n/**\n * Reasonix (`reasonix`, npm `reasonix`) — a cache-first coding agent built\n * around DeepSeek (now multi-provider); the npm package launches a prebuilt\n * Go binary.\n *\n * Verified against the real `reasonix run --help` / `--version` of 2.43.0,\n * real stream-json output (captured against a local fake model server) and\n * the docs at that tag (`docs/CLI.md`, `docs/CONFIG_PATHS.md`), 2026-10-17.\n *\n * - Headless: `reasonix run --output-format stream-json <task>`; with no\n * positional task, piped stdin is the prompt.\n * - Stream: every line has `kind` (`text` deltas, `message` full text,\n * `tool_dispatch`/`tool_started`/`tool_result` with a `tool` object whose\n * non-empty `err` marks a failure, `usage` per model call, `turn_done`) plus\n * `sessionId`; the final line is `{\"type\":\"result\",…}` with totals.\n * - Permissions: headless \"ask\" mode refuses writes (listed in\n * `permission_denials`; exit 4 in an untrusted folder); bypass is `--yolo`.\n * - MCP: no flag; `[[plugins]]` in `$REASONIX_HOME/config.toml`.\n * - Auth: provider keys are read only from `$REASONIX_HOME/.env`, never the\n * shell environment, so `apiKey` is written there (0600) as\n * `DEEPSEEK_API_KEY` — this needs a private home. For another provider,\n * put its variable in that file yourself via a caller-owned home.\n */\nexport const reasonixAdapter: CliAdapter = {\n name: \"reasonix\",\n title: \"Reasonix\",\n command: \"reasonix\",\n apiKeyEnv: [\"DEEPSEEK_API_KEY\"],\n homeEnv: [\"REASONIX_HOME\"],\n transports: [\"argv\", \"stdin\"],\n effort: true,\n mcp: true,\n probe: { help: [[\"run\", \"--help\"]], version: [\"--version\"] },\n verification: {\n version: \"2.43.0\",\n verifiedBy: \"help\",\n sources: [\n \"https://github.com/esengine/DeepSeek-Reasonix/blob/v2.43.0/docs/CLI.md\",\n \"https://github.com/esengine/DeepSeek-Reasonix/blob/v2.43.0/docs/CONFIG_PATHS.md\",\n \"https://www.npmjs.com/package/reasonix\",\n ],\n checkedAt: \"2026-10-17\",\n },\n plan(context) {\n const args = [\"run\", \"--output-format\", \"stream-json\"];\n const requires = [\"--output-format\", \"stream-json\"];\n const files: CliLaunchFile[] = [];\n\n if (context.model !== undefined) {\n args.push(\"--model\", context.model);\n requires.push(\"--model\");\n }\n\n if (context.effort !== undefined) {\n // DeepSeek levels per docs/REASONING_PROVIDERS.md: auto | disabled | low | high | max.\n args.push(\n \"--effort\",\n mapEffort(context.effort, { none: \"disabled\", low: \"low\", high: \"high\", max: \"max\" }),\n );\n requires.push(\"--effort\");\n }\n\n if (context.resume !== undefined) {\n args.push(\"--resume\", context.resume);\n requires.push(\"--resume\");\n }\n\n if (context.permission === \"bypass\") {\n args.push(\"--yolo\");\n requires.push(\"--yolo\");\n }\n\n if (context.mcp !== undefined) {\n const home = requirePrivateHome(context, reasonixAdapter, \"MCP servers\");\n\n files.push({\n path: path.join(home, \"config.toml\"),\n content: toToml({ plugins: reasonixPlugins(context.mcp) }),\n });\n }\n\n if (context.apiKey !== undefined) {\n const home = requirePrivateHome(context, reasonixAdapter, \"API keys (its .env file)\");\n\n files.push({\n path: path.join(home, \".env\"),\n content: dotenvFile({ DEEPSEEK_API_KEY: context.apiKey }),\n });\n }\n\n return {\n args,\n tail: context.transport === \"argv\" ? [argvPrompt(context.prompt)] : [],\n stdin: context.transport === \"stdin\" ? context.prompt : undefined,\n env: {\n ...(context.home !== undefined ? { REASONIX_HOME: context.home } : {}),\n REASONIX_TELEMETRY: \"off\",\n },\n files,\n requires,\n };\n },\n parser: createReasonixParser,\n};\n\nfunction reasonixPlugins(servers: CliMcpServers): TomlTable[] {\n return Object.entries(servers).map(([name, server]): TomlTable =>\n server.type === \"stdio\"\n ? { name, type: \"stdio\", command: server.command, args: server.args ?? [], env: server.env }\n : { name, type: server.type, url: server.url, headers: server.headers },\n );\n}\n\n/** Reasonix per-call usage (`promptTokens` includes cache hits). */\nfunction callUsage(usage: JsonRecord | undefined): CliUsage | undefined {\n if (usage === undefined) {\n return undefined;\n }\n\n const cacheHit = numberField(usage, \"cacheHitTokens\");\n\n return usageOf({\n input: numberField(usage, \"promptTokens\"),\n output: numberField(usage, \"completionTokens\"),\n total: numberField(usage, \"totalTokens\"),\n cachedTokens: cacheHit !== undefined && cacheHit > 0 ? cacheHit : undefined,\n reasoningTokens: numberField(usage, \"reasoningTokens\"),\n costUSD: numberField(usage, \"costUsd\"),\n });\n}\n\n/** Parser for `reasonix run --output-format stream-json`. */\nexport function createReasonixParser(): CliStreamParser {\n let started = false;\n let sessionRef: string | undefined;\n\n return {\n ...jsonLinesParser((record): CliParsedEvent[] => {\n const events: CliParsedEvent[] = [];\n const recordSession = stringField(record, \"sessionId\") ?? stringField(record, \"session_id\");\n\n if (recordSession !== undefined) {\n sessionRef = recordSession;\n }\n\n if (!started && recordSession !== undefined) {\n started = true;\n events.push({ type: \"session.started\", sessionRef: recordSession, raw: record });\n }\n\n if (stringField(record, \"type\") === \"result\") {\n const usage = recordField(record, \"usage\");\n\n if (usage !== undefined) {\n events.push({\n type: \"usage\",\n cumulative: true,\n usage: usageOf({\n input: numberField(usage, \"input_tokens\"),\n output: numberField(usage, \"output_tokens\"),\n cachedTokens: numberField(usage, \"cache_read_input_tokens\") || undefined,\n costUSD: numberField(record, \"total_cost_usd\"),\n }),\n raw: record,\n });\n }\n\n const result = stringField(record, \"result\") ?? \"\";\n\n if (record.is_error === true) {\n events.push({\n type: \"error\",\n message: result || \"Reasonix run failed\",\n fatal: true,\n raw: record,\n });\n } else if (result.length > 0) {\n events.push({ type: \"message\", text: result, delta: false, final: true, raw: record });\n }\n\n return events;\n }\n\n const tool = asRecord(record.tool);\n\n switch (stringField(record, \"kind\")) {\n case \"text\": {\n const text = stringField(record, \"text\") ?? \"\";\n\n if (text.length > 0) {\n events.push({ type: \"message\", text, delta: true, raw: record });\n }\n break;\n }\n case \"message\":\n events.push({\n type: \"message\",\n text: stringField(record, \"text\") ?? \"\",\n delta: false,\n raw: record,\n });\n break;\n case \"tool_dispatch\":\n // The first dispatch streams arguments (`partial: true`); report the complete one.\n if (tool !== undefined && tool.partial !== true) {\n events.push({\n type: \"tool.call\",\n id: stringField(tool, \"id\") ?? \"\",\n name: stringField(tool, \"name\") ?? \"\",\n input: parseArguments(tool.args),\n raw: record,\n });\n }\n break;\n case \"tool_result\": {\n const error = stringField(tool, \"err\") ?? \"\";\n\n events.push({\n type: \"tool.result\",\n id: stringField(tool, \"id\") ?? \"\",\n output: error.length > 0 ? error : (stringField(tool, \"output\") ?? \"\"),\n isError: error.length > 0,\n raw: record,\n });\n break;\n }\n case \"usage\": {\n const usage = callUsage(recordField(record, \"usage\"));\n\n if (usage !== undefined) {\n events.push({ type: \"usage\", usage, cumulative: false, raw: record });\n }\n break;\n }\n case \"turn_done\":\n if (stringField(record, \"status\") === \"failed\") {\n events.push({\n type: \"error\",\n message: stringField(record, \"err\") ?? \"Reasonix turn failed\",\n fatal: true,\n raw: record,\n });\n }\n break;\n }\n\n return events;\n }),\n sessionRef: () => sessionRef,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAa,kBAA8B;CACzC,MAAM;CACN,OAAO;CACP,SAAS;CACT,WAAW,CAAC,kBAAkB;CAC9B,SAAS,CAAC,eAAe;CACzB,YAAY,CAAC,QAAQ,OAAO;CAC5B,Q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IAAI,YAAY,MAAM,IAAI,KAAK;MAC/B,QAAQ,MAAM,SAAS,IAAI,QAAS,YAAY,MAAM,QAAQ,KAAK;MACnE,SAAS,MAAM,SAAS;MACxB,KAAK;KACP,CAAC;KACD;IACF;IACA,KAAK,SAAS;KACZ,MAAM,QAAQ,UAAU,YAAY,QAAQ,OAAO,CAAC;KAEpD,IAAI,UAAU,QACZ,OAAO,KAAK;MAAE,MAAM;MAAS;MAAO,YAAY;MAAO,KAAK;KAAO,CAAC;KAEtE;IACF;IACA,KAAK,aACH,IAAI,YAAY,QAAQ,QAAQ,MAAM,UACpC,OAAO,KAAK;KACV,MAAM;KACN,SAAS,YAAY,QAAQ,KAAK,KAAK;KACvC,OAAO;KACP,KAAK;IACP,CAAC;GAGP;GAEA,OAAO;EACT,CAAC;EACD,kBAAkB;CACpB;AACF"}
@@ -1,29 +1,29 @@
1
1
  import { CliUsage } from "../contracts/events.type.mjs";
2
2
  import { CliMcpServers } from "../contracts/mcp.type.mjs";
3
3
  import { CliLaunchContext, CliLaunchFile } from "../contracts/adapter.contract.mjs";
4
+ import "../contracts/index.mjs";
4
5
  import { CliError } from "../errors.mjs";
5
6
  import { ReasoningEffort } from "@warlock.js/ai";
6
-
7
7
  //#region ../../packages/ai-cli/src/adapters/shared.d.ts
8
8
  /**
9
9
  * The prompt as an argv value. A prompt starting with `-` would be read as a
10
10
  * flag by the CLI's argument parser, so it gets one leading space (harmless
11
11
  * to the model, and no parser treats it as an option).
12
12
  */
13
- declare function argvPrompt(prompt: string): string;
13
+ export declare function argvPrompt(prompt: string): string;
14
14
  /** The prompt written to `prompt.txt` in the run directory, for `transport: "file"`. */
15
- declare function promptFile(context: CliLaunchContext): CliLaunchFile;
15
+ export declare function promptFile(context: CliLaunchContext): CliLaunchFile;
16
16
  /**
17
17
  * Fail closed when an option needs a file inside the CLI's config home but
18
18
  * the home is not private to this run (writing it into a caller-owned or
19
19
  * inherited home would leak tokens into it and race concurrent runs).
20
20
  */
21
- declare function requirePrivateHome(context: CliLaunchContext, adapter: {
21
+ export declare function requirePrivateHome(context: CliLaunchContext, adapter: {
22
22
  name: string;
23
23
  title: string;
24
24
  }, option: string): string;
25
25
  /** A `.env` file body. Values are written verbatim; newlines are refused. */
26
- declare function dotenvFile(values: Record<string, string>): string;
26
+ export declare function dotenvFile(values: Record<string, string>): string;
27
27
  /**
28
28
  * Map a framework effort to a vendor's levels, following the framework
29
29
  * rule: an exact level wins; otherwise the nearest higher level the vendor
@@ -34,7 +34,7 @@ declare function dotenvFile(values: Record<string, string>): string;
34
34
  * mapEffort("xhigh", { low: "low", medium: "medium", high: "high" }); // "high"
35
35
  * mapEffort("minimal", { low: "low", medium: "medium", high: "high" }); // "low"
36
36
  */
37
- declare function mapEffort(effort: ReasoningEffort, levels: Partial<Record<ReasoningEffort, string>>): string;
37
+ export declare function mapEffort(effort: ReasoningEffort, levels: Partial<Record<ReasoningEffort, string>>): string;
38
38
  /**
39
39
  * The common `mcpServers` JSON shape (Claude Code, Cursor, Kimi, Droid,
40
40
  * Copilot, Amp, Qwen Code …): stdio servers as `command`/`args`/`env`,
@@ -42,16 +42,20 @@ declare function mapEffort(effort: ReasoningEffort, levels: Partial<Record<Reaso
42
42
  * vendor expects (`"stdio"`, `"http"`, `"sse"`), or a renamed remote
43
43
  * transport (`"streamable-http"`).
44
44
  */
45
- declare function mcpServersJson(servers: CliMcpServers, options?: {
46
- /** Emit a `type` key on every server. */typeField?: boolean; /** Value of `type` for streamable HTTP servers. Default `"http"`. */
47
- httpType?: string; /** Extra keys merged into every server (for example `tools: ["*"]`). */
48
- extra?: Record<string, unknown>; /** Key holding a streamable-HTTP URL. Default `"url"`. */
45
+ export declare function mcpServersJson(servers: CliMcpServers, options?: {
46
+ /** Emit a `type` key on every server. */
47
+ typeField?: boolean;
48
+ /** Value of `type` for streamable HTTP servers. Default `"http"`. */
49
+ httpType?: string;
50
+ /** Extra keys merged into every server (for example `tools: ["*"]`). */
51
+ extra?: Record<string, unknown>;
52
+ /** Key holding a streamable-HTTP URL. Default `"url"`. */
49
53
  httpUrlKey?: string;
50
54
  }): Record<string, Record<string, unknown>>;
51
55
  /** JSON for a config file, pretty-printed with a trailing newline. */
52
- declare function jsonFile(value: unknown): string;
56
+ export declare function jsonFile(value: unknown): string;
53
57
  /** Build a `CliUsage`, computing `total` when the vendor omits it. */
54
- declare function usageOf(fields: {
58
+ export declare function usageOf(fields: {
55
59
  input?: number;
56
60
  output?: number;
57
61
  total?: number;
@@ -61,18 +65,17 @@ declare function usageOf(fields: {
61
65
  costUSD?: number;
62
66
  }): CliUsage;
63
67
  /** An `unsupported-option` error for an adapter. */
64
- declare function unsupportedOption(adapter: {
68
+ export declare function unsupportedOption(adapter: {
65
69
  name: string;
66
70
  title: string;
67
71
  }, message: string): CliError;
68
72
  /** Parse a JSON-encoded tool-arguments string; keeps the raw string when it is not JSON. */
69
- declare function parseArguments(value: unknown): unknown;
73
+ export declare function parseArguments(value: unknown): unknown;
70
74
  /**
71
75
  * Usage in the Anthropic Messages shape (`input_tokens` excludes cache reads
72
76
  * and writes, which are reported separately). `input` is the sum of all
73
77
  * three, matching the framework rule that `input` includes cached tokens.
74
78
  */
75
- declare function anthropicUsage(usage: Record<string, unknown> | undefined, costUSD?: number): CliUsage | undefined;
79
+ export declare function anthropicUsage(usage: Record<string, unknown> | undefined, costUSD?: number): CliUsage | undefined;
76
80
  //#endregion
77
- export { anthropicUsage, argvPrompt, dotenvFile, jsonFile, mapEffort, mcpServersJson, parseArguments, promptFile, requirePrivateHome, unsupportedOption, usageOf };
78
81
  //# sourceMappingURL=shared.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/shared.ts"],"mappings":";;;;;;;;;;;;iBAUgB,UAAA,CAAW,MAAc;;iBAKzB,UAAA,CAAW,OAAA,EAAS,gBAAA,GAAmB,aAAa;;AAL3B;AAKzC;;;iBASgB,kBAAA,CACd,OAAA,EAAS,gBAAgB,EACzB,OAAA;EAAW,IAAA;EAAc,KAAA;AAAA,GACzB,MAAA;;iBAac,UAAA,CAAW,MAA8B,EAAtB,MAAM;AAhBzC;;;;;;;;;;AAAA,iBAkDgB,SAAA,CACd,MAAA,EAAQ,eAAA,EACR,MAAA,EAAQ,OAAA,CAAQ,MAAA,CAAO,eAAA;AAjDT;AAahB;;;;AAAyD;AAkCzD;AA/CgB,iBA6EA,cAAA,CACd,OAAA,EAAS,aAAA,EACT,OAAA;2CAEE,SAAA,YAhCqB;EAkCrB,QAAA,WAlCM;EAoCN,KAAA,GAAQ,MAAA,mBApCK;EAsCb,UAAA;AAAA,IAED,MAAA,SAAe,MAAA;;iBA+BF,QAAA,CAAS,KAAc;;iBAKvB,OAAA,CAAQ,MAAA;EACtB,KAAA;EACA,MAAA;EACA,KAAA;EACA,YAAA;EACA,gBAAA;EACA,eAAA;EACA,OAAA;AAAA,IACE,QAAQ;;iBAmBI,iBAAA,CACd,OAAA;EAAW,IAAA;EAAc,KAAA;AAAA,GACzB,OAAA,WACC,QAAQ;;iBAQK,cAAA,CAAe,KAAc;;;;;;iBAiB7B,cAAA,CACd,KAAA,EAAO,MAAA,+BACP,OAAA,YACC,QAAQ"}
1
+ {"version":3,"file":"shared.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/shared.ts"],"mappings":";;;;;;;;;;;;wBAUgB,WAAW;;wBAKX,WAAW,SAAS,mBAAmB;;;;;;wBASvC,mBACd,SAAS,kBACT;EAAW;EAAc;GACzB;;wBAac,WAAW,QAAQ;;;;;;;;;;;wBAkCnB,UACd,QAAQ,iBACR,QAAQ,QAAQ,OAAO;;;;;;;;wBA4BT,eACd,SAAS,eACT;;EAEE;;EAEA;;EAEA,QAAQ;;EAER;IAED,eAAe;;wBA+BF,SAAS;;wBAKT,QAAQ;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;IACE;;wBAmBY,kBACd;EAAW;EAAc;GACzB,kBACC;;wBAQa,eAAe;;;;;;wBAiBf,eACd,OAAO,qCACP,mBACC"}
@@ -1,12 +1,12 @@
1
1
  import { CliAdapter } from "./contracts/adapter.contract.mjs";
2
2
  import { CliAgentOptions, CliProbeResult, CliRunOptions, CliSession } from "./contracts/options.type.mjs";
3
+ import "./contracts/index.mjs";
3
4
  import { CliModelConfig } from "./model/cli-model.mjs";
4
5
  import { CommandLookup } from "./spawn/resolve-command.mjs";
5
6
  import { ModelContract } from "@warlock.js/ai";
6
-
7
7
  //#region ../../packages/ai-cli/src/cli-agent.d.ts
8
8
  /** A configured coding CLI: run prompts, probe the binary, or use it as an `ai.agent` model. */
9
- type CliAgent = {
9
+ export type CliAgent = {
10
10
  readonly adapter: CliAdapter;
11
11
  readonly options: Readonly<CliAgentOptions>;
12
12
  /**
@@ -14,16 +14,18 @@ type CliAgent = {
14
14
  * — executable not found, a flag missing from `--help`, an unsupported
15
15
  * option; the run's own outcome is reported by `session.done()`.
16
16
  */
17
- run(prompt: string, options?: CliRunOptions): Promise<CliSession>; /** Run (or reuse) the capability probe: resolved executable, version and help text. */
18
- probe(): Promise<CliProbeResult>; /** This CLI as an `ai.agent` model (see {@link cliModel}). */
17
+ run(prompt: string, options?: CliRunOptions): Promise<CliSession>;
18
+ /** Run (or reuse) the capability probe: resolved executable, version and help text. */
19
+ probe(): Promise<CliProbeResult>;
20
+ /** This CLI as an `ai.agent` model (see {@link cliModel}). */
19
21
  model(config?: CliModelConfig): ModelContract;
20
22
  };
21
23
  /** Host facts, injectable for tests. */
22
- type CliHost = CommandLookup & {
24
+ export type CliHost = CommandLookup & {
23
25
  comspec: string;
24
26
  };
25
27
  /** The current machine as a {@link CliHost}. */
26
- declare function currentHost(): CliHost;
28
+ export declare function currentHost(): CliHost;
27
29
  /**
28
30
  * Create a CLI agent from an adapter. The vendor factories
29
31
  * (`cli.claudeCode(...)`, `cli.codex(...)`, …) call this with their
@@ -34,7 +36,6 @@ declare function currentHost(): CliHost;
34
36
  * const session = await agent.run("Summarize README.md", { cwd: "/srv/repo" });
35
37
  * console.log((await session.done()).text);
36
38
  */
37
- declare function createCliAgent(adapter: CliAdapter, options?: CliAgentOptions, host?: CliHost): CliAgent;
39
+ export declare function createCliAgent(adapter: CliAdapter, options?: CliAgentOptions, host?: CliHost): CliAgent;
38
40
  //#endregion
39
- export { CliAgent, CliHost, createCliAgent, currentHost };
40
41
  //# sourceMappingURL=cli-agent.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-agent.d.mts","names":[],"sources":["../../../../../../../packages/ai-cli/src/cli-agent.ts"],"mappings":";;;;;;;;KA2BY,QAAA;EAAA,SACD,OAAA,EAAS,UAAA;EAAA,SACT,OAAA,EAAS,QAAA,CAAS,eAAA;EAFjB;;;;;EAQV,GAAA,CAAI,MAAA,UAAgB,OAAA,GAAU,aAAA,GAAgB,OAAA,CAAQ,UAAA,GAAxB;EAE9B,KAAA,IAAS,OAAA,CAAQ,cAAA,GAF6B;EAI9C,KAAA,CAAM,MAAA,GAAS,cAAA,GAAiB,aAAA;AAAA;;KAItB,OAAA,GAAU,aAAa;EAAK,OAAO;AAAA;;iBAmB/B,WAAA,IAAe,OAAO;;;;;;;;;;;iBAoCtB,cAAA,CACd,OAAA,EAAS,UAAA,EACT,OAAA,GAAS,eAAA,EACT,IAAA,GAAM,OAAA,GACL,QAAA"}
1
+ {"version":3,"file":"cli-agent.d.mts","names":[],"sources":["../../../../../../../packages/ai-cli/src/cli-agent.ts"],"mappings":";;;;;;;;YA2BY;WACD,SAAS;WACT,SAAS,SAAS;;;;;;EAM3B,IAAI,gBAAgB,UAAU,gBAAgB,QAAQ;;EAEtD,SAAS,QAAQ;;EAEjB,MAAM,SAAS,iBAAiB;;;YAItB,UAAU;EAAkB;;;wBAmBxB,eAAe;;;;;;;;;;;wBAoCf,eACd,SAAS,YACT,UAAS,iBACT,OAAM,UACL"}
package/esm/cli.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { CliAdapter } from "./contracts/adapter.contract.mjs";
2
2
  import { CliAgentOptions } from "./contracts/options.type.mjs";
3
+ import "./contracts/index.mjs";
3
4
  import { cliModel } from "./model/cli-model.mjs";
4
5
  import { CliAgent } from "./cli-agent.mjs";
5
-
6
6
  //#region ../../packages/ai-cli/src/cli.d.ts
7
7
  /** Every built-in adapter, keyed by its factory name. */
8
- declare const cliAdapters: {
8
+ export declare const cliAdapters: {
9
9
  readonly claudeCode: CliAdapter;
10
10
  readonly codex: CliAdapter;
11
11
  readonly antigravity: CliAdapter;
@@ -22,8 +22,8 @@ declare const cliAdapters: {
22
22
  readonly reasonix: CliAdapter;
23
23
  };
24
24
  /** Name of a built-in adapter factory. */
25
- type CliVendor = keyof typeof cliAdapters;
26
- type VendorFactories = { [Vendor in CliVendor]: (options?: CliAgentOptions) => CliAgent };
25
+ export type CliVendor = keyof typeof cliAdapters;
26
+ type VendorFactories = { [Vendor in CliVendor]: (options?: CliAgentOptions) => CliAgent; };
27
27
  /**
28
28
  * The CLI-agent namespace: one factory per vendor, `custom()` for your own
29
29
  * adapter, `model()` to hand a CLI agent to `ai.agent`. Also available as
@@ -37,9 +37,12 @@ type VendorFactories = { [Vendor in CliVendor]: (options?: CliAgentOptions) => C
37
37
  * for await (const event of session.events) console.log(event.type);
38
38
  * const { text, usage, sessionRef } = await session.done();
39
39
  */
40
- declare const cli: VendorFactories & {
41
- /** A CLI agent for an adapter you wrote. */custom(adapter: CliAdapter, options?: CliAgentOptions): CliAgent; /** A CLI agent as an `ai.agent` model. */
42
- model: typeof cliModel; /** The built-in adapters, for inspection or extension. */
40
+ export declare const cli: VendorFactories & {
41
+ /** A CLI agent for an adapter you wrote. */
42
+ custom(adapter: CliAdapter, options?: CliAgentOptions): CliAgent;
43
+ /** A CLI agent as an `ai.agent` model. */
44
+ model: typeof cliModel;
45
+ /** The built-in adapters, for inspection or extension. */
43
46
  adapters: typeof cliAdapters;
44
47
  };
45
48
  declare module "@warlock.js/ai" {
@@ -49,5 +52,5 @@ declare module "@warlock.js/ai" {
49
52
  }
50
53
  }
51
54
  //#endregion
52
- export { CliVendor, cli, cliAdapters };
55
+ export {};
53
56
  //# sourceMappingURL=cli.d.mts.map
package/esm/cli.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.mts","names":[],"sources":["../../../../../../../packages/ai-cli/src/cli.ts"],"mappings":";;;;;;;cAoBa,WAAA;EAAA;;;;;;;;;;;;;;;;KAkBD,SAAA,gBAAyB,WAAW;AAAA,KAE3C,eAAA,gBAA+B,SAAA,IAAa,OAAA,GAAU,eAAA,KAAoB,QAAA;;;;;;;;;;;;;;cAsBlE,GAAA,EAAK,eAAA;8CAEhB,MAAA,CAAO,OAAA,EAAS,UAAA,EAAY,OAAA,GAAU,eAAA,GAAkB,QAAA;EAExD,KAAA,SAAc,QAAA;EAEd,QAAA,SAAiB,WAAA;AAAA;AAAA;EAAA,UASP,EAAA;;IAER,GAAA,SAAY,GAAG;EAAA;AAAA"}
1
+ {"version":3,"file":"cli.d.mts","names":[],"sources":["../../../../../../../packages/ai-cli/src/cli.ts"],"mappings":";;;;;;;qBAoBa;WACX,YAAU;WACV,OAAK;WACL,aAAW;WACX,UAAQ;WACR,MAAI;WACJ,QAAM;WACN,SAAO;WACP,MAAI;WACJ,UAAQ;WACR,KAAG;WACH,OAAK;WACL,aAAW;WACX,OAAK;WACL,UAAQ;;;YAIE,yBAAyB;KAEhC,qBAAqB,UAAU,aAAa,UAAU,oBAAoB;;;;;;;;;;;;;;qBAsBlE,KAAK;;EAEhB,OAAO,SAAS,YAAY,UAAU,kBAAkB;;EAExD,cAAc;;EAEd,iBAAiB;;;YASP;;IAER,YAAY"}