@warble/claude-agent-sdk 0.15.3 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -9,13 +9,14 @@ import {
9
9
  discoverClaudeModels,
10
10
  dispatch,
11
11
  emitAgentModule,
12
+ loadHostMcpConfig,
12
13
  parseIr,
13
14
  parseRenderFlavor,
14
15
  parseSlotFlags,
15
16
  preflightDispatchAssets,
16
17
  prepareDispatch,
17
18
  prepareDisplayManifest
18
- } from "./chunk-XH2CFK2E.js";
19
+ } from "./chunk-6GZGHFX7.js";
19
20
 
20
21
  // src/cli.ts
21
22
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -99,12 +100,16 @@ async function main() {
99
100
  component: { type: "string" },
100
101
  "stream-json": { type: "boolean" },
101
102
  resume: { type: "string" },
103
+ "host-mcp-config": { type: "string" },
102
104
  timeout: { type: "string" },
103
105
  "include-unavailable": { type: "boolean" },
104
106
  slot: { type: "string", multiple: true }
105
107
  }
106
108
  });
107
109
  const [subcommand, irArg, question] = positionals;
110
+ if (values["host-mcp-config"] !== void 0 && subcommand !== "chat") {
111
+ fail("--host-mcp-config is only accepted by `chat`");
112
+ }
108
113
  if (subcommand !== "dispatch" && subcommand !== "emit" && subcommand !== "manifest" && subcommand !== "chat" && subcommand !== "list-models") {
109
114
  fail(USAGE);
110
115
  }
@@ -279,6 +284,8 @@ async function runChatCmd(common, values) {
279
284
  const outDir = resolve(values.out ?? "./run");
280
285
  const warbleBin = values["warble-bin"] ?? defaultWarbleBin();
281
286
  const componentId = values.component ?? "answer_query";
287
+ const hostMcpPath = values["host-mcp-config"];
288
+ const hostMcp = hostMcpPath !== void 0 ? loadHostMcpConfig(hostMcpPath) : void 0;
282
289
  const input = {
283
290
  slots: common.slots,
284
291
  ir: common.raw,
@@ -302,7 +309,8 @@ async function runChatCmd(common, values) {
302
309
  {
303
310
  outDir,
304
311
  warbleBin,
305
- assets: { ir: { ...ir, components: [component.node] }, irPath: common.irPath }
312
+ assets: { ir: { ...ir, components: [component.node] }, irPath: common.irPath },
313
+ ...hostMcp ? { hostMcp } : {}
306
314
  },
307
315
  resumeSessionId
308
316
  );
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `warble-agent-sdk` — the Claude Agent SDK back-end CLI.\n *\n * warble-agent-sdk dispatch <ir.json> \"<question>\" [--target …] [--models-config m.yml]\n * [--render-flavor programmatic|prompt] [--out ./run] [--project <dir>]\n * [--strong opus] [--cheap haiku] [--orchestrator sonnet]\n * [--warble-bin <path>] [--max-turns N] [--title <t>] [--dry-run]\n *\n * warble-agent-sdk emit <ir.json> [--out agent.ts] [--standalone] [--target …] [--models-config …]\n * [--render-flavor …] [--project <dir>] [--strong/--cheap/--orchestrator …]\n *\n * warble-agent-sdk manifest <ir.json> [--include-unavailable] [--out manifest.json] [--target …] [--models-config …]\n * [--render-flavor …] [--project <dir>] [--strong/--cheap/--orchestrator …]\n *\n * warble-agent-sdk chat <ir.json> [--project <dir>] [--component answer_query] [--out ./run]\n * [--target …] [--models-config m.yml] [--render-flavor programmatic|prompt] [--warble-bin <path>]\n * [--stream-json] [--resume <session-id>]\n *\n * `--slot NAME=VARIANT` fills a named prompt slot with that variant; `--slot NAME=` removes a slot\n * whose condition does not hold. Repeatable, accepted by every subcommand, and mirroring the `warble`\n * CLI's flag of the same name. A slot nobody names takes its declared default — except one carrying\n * a `present_when` condition, which is refused when unanswered on any path whose text reaches a\n * model, because shipping wording for something that may have been withheld is worse than shipping\n * none. `manifest` is a display and renders such a default instead of refusing.\n *\n * `chat --stream-json` emits per-step/per-tool NDJSON events (one `WarbleChatEvent`, events.ts, per\n * line) to stdout as each turn runs, ending with a terminal `{\"t\":\"answer\",\"text\":…}` line, instead of\n * the default plain final-answer-text-per-turn output — for a consumer that wants to build a live,\n * expandable work log rather than just the finished text. Every turn also emits a\n * `{\"t\":\"session\",\"id\":…}` line (on success AND on a failed turn) carrying that turn's SDK session id.\n *\n * `--resume <session-id>` seeds a brand-new `chat` process's FIRST turn with a session id captured by\n * an earlier `chat` process (from its `{\"t\":\"session\",…}` line) — lets a caller resume a conversation\n * that a previous process started (e.g. one that ran out of turns), continuing the real SDK\n * conversation instead of re-dispatching a fresh prompt from scratch. Ignored after the first turn:\n * subsequent turns resume from this process's own prior turn, as usual.\n *\n * `dispatch` consumes the SAME `ir.json` a Rust `warble compile` emits and drives the SDK loop\n * in-process (`--dry-run` writes the assembled plan without calling `query()`). `emit` freezes the\n * resolved plan into an importable TS agent module (thin, or `--standalone`). `manifest` runs the\n * same preparation as `emit` (no `question`, no `query()` call) and instead serializes a display\n * manifest — the resolved agents/steps/tiers/capabilities/guardrails for THIS target, structurally\n * identical to the vercel back-end's bundle — so a consumer can source a display from whichever\n * back-end actually runs, instead of always reading the vercel bundle target's output. `chat` opens a\n * multi-turn session (session.ts, G1 — single profile, many turns) over one component, reading\n * questions from stdin line-by-line and resuming the SDK session turn over turn.\n */\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { createInterface } from \"node:readline\";\nimport { parseArgs } from \"node:util\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { emitAgentModule } from \"./codegen.js\";\nimport {\n dispatch,\n preflightDispatchAssets,\n prepareDisplayManifest,\n prepareDispatch,\n type DispatchInput,\n type PreparedDispatch,\n} from \"./dispatch.js\";\nimport { parseSlotFlags } from \"./slots.js\";\nimport type { SlotSupply } from \"./slots.js\";\nimport { DispatchError } from \"./error.js\";\nimport type { WarbleChatEvent } from \"./events.js\";\nimport { buildManifest } from \"./manifest.js\";\nimport { parseIr } from \"./ir.js\";\nimport { ModelConfig } from \"./models.js\";\nimport { discoverClaudeModels } from \"./model_catalog.js\";\nimport { parseRenderFlavor, type RenderFlavor } from \"./options.js\";\nimport { DispatchSessionError } from \"./run.js\";\nimport { createChatSession } from \"./session.js\";\nimport { type ResolutionReport } from \"./resolve.js\";\nimport { DEFAULT_TARGET } from \"./targets.js\";\n\n/** `parseSlotFlags` throws; this CLI reports a bad flag as a usage failure instead. */\nfunction parseSlotFlagsOrFail(flags: readonly string[]): SlotSupply {\n try {\n return parseSlotFlags(flags);\n } catch (e) {\n fail(e instanceof Error ? e.message : String(e));\n }\n}\n\nfunction fail(message: string): never {\n process.stderr.write(`error: ${message}\\n`);\n process.exit(1);\n}\n\nconst USAGE =\n 'usage: warble-agent-sdk <dispatch|emit|manifest|chat> <ir.json> [\"<question>\"] [options]\\n' +\n \" warble-agent-sdk list-models [--project <dir>] [--timeout <ms>]\";\n\n// `require(\"../package.json\")` resolves relative to *this* file's own location, one directory up —\n// which is the package root in both the dev tree (src/cli.ts → ../package.json) and the published\n// layout (dist/cli.js → ../package.json; package.json ships in every npm package regardless of the\n// \"files\" allowlist). That keeps the reported version tied to the package's real `version` field\n// instead of a literal that could drift from it.\nconst requireFromHere = createRequire(import.meta.url);\n\nfunction packageVersion(): string {\n return (requireFromHere(\"../package.json\") as { version: string }).version;\n}\n\n/** Locate the reference `warble` binary: --warble-bin, else PATH, else this repo's release build. */\nfunction defaultWarbleBin(): string {\n const here = dirname(fileURLToPath(import.meta.url));\n const repoBuilt = resolve(here, \"../../../target/release/warble\");\n return existsSync(repoBuilt) ? repoBuilt : \"warble\";\n}\n\nfunction printResolutionSummary(target: string, id: string, report: ResolutionReport): void {\n process.stderr.write(`warble-agent-sdk: capability resolution for '${target}' (component '${id}'):\\n`);\n for (const e of report) {\n const note = e.note ? ` — ${e.note}` : \"\";\n process.stderr.write(\n ` ${e.capability.padEnd(28)} ${e.outcome.padEnd(12)} (${e.provided_by}, ${e.criticality})${note}\\n`,\n );\n }\n}\n\ninterface CommonArgs {\n target: string;\n flavor: RenderFlavor;\n models: ModelConfig;\n raw: string;\n irPath: string;\n project: string | undefined;\n /** The host's slot table, from `--slot`. Empty when none was given. */\n slots: SlotSupply;\n}\n\nfunction buildModels(values: Record<string, string | string[] | boolean | undefined>): ModelConfig {\n const cfgPath = values[\"models-config\"];\n if (typeof cfgPath === \"string\") {\n return ModelConfig.fromYaml(readFileSync(resolve(cfgPath), \"utf8\"));\n }\n return ModelConfig.fromFlags(\n (values.strong as string) ?? \"opus\",\n (values.cheap as string) ?? \"haiku\",\n (values.orchestrator as string) ?? \"sonnet\",\n );\n}\n\nasync function main(): Promise<void> {\n // Handle `--version`/`-V` and `--help`/`-h` up front, before the strict `parseArgs` below —\n // neither is a declared option there, so leaving them for `parseArgs` to see would throw\n // `ERR_PARSE_ARGS_UNKNOWN_OPTION` instead of doing what every other CLI does with them.\n const firstArg = process.argv[2];\n if (firstArg === \"--version\" || firstArg === \"-V\") {\n process.stdout.write(`${packageVersion()}\\n`);\n return;\n }\n if (firstArg === \"--help\" || firstArg === \"-h\") {\n process.stdout.write(`${USAGE}\\n`);\n return;\n }\n\n const { values, positionals } = parseArgs({\n allowPositionals: true,\n options: {\n target: { type: \"string\" },\n out: { type: \"string\" },\n \"models-config\": { type: \"string\" },\n \"render-flavor\": { type: \"string\" },\n strong: { type: \"string\" },\n cheap: { type: \"string\" },\n orchestrator: { type: \"string\" },\n project: { type: \"string\" },\n \"warble-bin\": { type: \"string\" },\n \"max-turns\": { type: \"string\" },\n title: { type: \"string\" },\n \"dry-run\": { type: \"boolean\" },\n standalone: { type: \"boolean\" },\n component: { type: \"string\" },\n \"stream-json\": { type: \"boolean\" },\n resume: { type: \"string\" },\n timeout: { type: \"string\" },\n \"include-unavailable\": { type: \"boolean\" },\n slot: { type: \"string\", multiple: true },\n },\n });\n\n\n\n const [subcommand, irArg, question] = positionals;\n if (\n subcommand !== \"dispatch\" &&\n subcommand !== \"emit\" &&\n subcommand !== \"manifest\" &&\n subcommand !== \"chat\" &&\n subcommand !== \"list-models\"\n ) {\n fail(USAGE);\n }\n if (subcommand === \"list-models\") {\n if (irArg !== undefined || question !== undefined) fail(\"list-models does not take an <ir.json> or question\");\n const timeout = values.timeout === undefined ? undefined : Number(values.timeout);\n if (timeout !== undefined && (!Number.isFinite(timeout) || timeout <= 0)) fail(\"--timeout must be a positive number\");\n const catalog = await discoverClaudeModels({\n ...(values.project ? { cwd: values.project } : {}),\n ...(timeout !== undefined ? { timeoutMs: timeout } : {}),\n });\n process.stdout.write(`${JSON.stringify(catalog)}\\n`);\n return;\n }\n if (values.timeout !== undefined) fail(\"--timeout is only supported by list-models\");\n if (values[\"include-unavailable\"] && subcommand !== \"manifest\") fail(\"--include-unavailable is only supported by manifest\");\n if (!irArg) fail(\"missing <ir.json> argument\");\n\n const target = values.target ?? DEFAULT_TARGET;\n const flavor = parseRenderFlavor(values[\"render-flavor\"] ?? \"programmatic\");\n const models = buildModels(values);\n const raw = readFileSync(resolve(irArg), \"utf8\");\n\n // Parsed once and carried on CommonArgs, so every subcommand that builds prompts gets the same\n // table. Without this the seam would be reachable only by importing the library, and a profile\n // with a conditional slot could not be run through this CLI at all — it would always refuse for\n // want of an answer.\n const common: CommonArgs = {\n target,\n flavor,\n models,\n raw,\n irPath: irArg,\n project: values.project,\n slots: parseSlotFlagsOrFail(values.slot ?? []),\n };\n\n if (subcommand === \"emit\") {\n return runEmit(common, values.out, Boolean(values.standalone));\n }\n if (subcommand === \"manifest\") {\n return runManifest(common, values.out, Boolean(values[\"include-unavailable\"]));\n }\n if (subcommand === \"chat\") {\n return runChatCmd(common, values);\n }\n return runDispatchCmd(common, values, question);\n}\n\nfunction runEmit(common: CommonArgs, outArg: string | undefined, standalone: boolean): void {\n const input: DispatchInput = {\n slots: common.slots,\n ir: common.raw,\n target: common.target,\n flavor: common.flavor,\n models: common.models,\n irPath: common.irPath,\n ...(common.project !== undefined ? { project: common.project } : {}),\n };\n const prepared: PreparedDispatch = prepareDispatch(input);\n preflightDispatchAssets(input, prepared);\n for (const c of prepared.components) printResolutionSummary(common.target, c.id, c.report);\n\n const outPath = resolve(outArg ?? \"agent.ts\");\n mkdirSync(dirname(outPath), { recursive: true });\n writeFileSync(outPath, emitAgentModule(prepared, { standalone }), \"utf8\");\n process.stderr.write(\n `warble-agent-sdk: emit — wrote ${outPath} (${prepared.components.length} component(s), ${standalone ? \"standalone\" : \"thin\"}).\\n`,\n );\n}\n\n/**\n * `manifest` — same preparation as `emit` (no `question`, `query()` never called), but instead of\n * freezing an importable agent module, serializes the display manifest (see `manifest.ts`) to stdout\n * or `--out`. Capability resolution summaries still go to stderr so stdout stays pure JSON.\n */\nfunction runManifest(common: CommonArgs, outArg: string | undefined, includeUnavailable: boolean): void {\n const input = {\n ir: common.raw,\n target: common.target,\n flavor: common.flavor,\n models: common.models,\n irPath: common.irPath,\n ...(common.project !== undefined ? { project: common.project } : {}),\n } as const;\n const prepared = includeUnavailable ? prepareDisplayManifest({ ...input, slots: common.slots }) : prepareDispatch({ ...input, slots: common.slots });\n for (const c of prepared.components) {\n if (\"report\" in c) printResolutionSummary(common.target, c.id, c.report);\n }\n\n const manifest = buildManifest(prepared, common.raw);\n const json = `${JSON.stringify(manifest, null, 2)}\\n`;\n\n if (outArg) {\n const outPath = resolve(outArg);\n mkdirSync(dirname(outPath), { recursive: true });\n writeFileSync(outPath, json, \"utf8\");\n process.stderr.write(\n `warble-agent-sdk: manifest — wrote ${outPath} (${prepared.components.length} agent(s)).\\n`,\n );\n } else {\n process.stdout.write(json);\n }\n}\n\nasync function runDispatchCmd(\n common: CommonArgs,\n values: Record<string, string | string[] | boolean | undefined>,\n question: string | undefined,\n): Promise<void> {\n const dryRun = Boolean(values[\"dry-run\"]);\n if (!question && !dryRun) fail('missing \"<question>\" argument (or pass --dry-run)');\n\n const maxTurnsRaw = values[\"max-turns\"];\n const maxTurns = typeof maxTurnsRaw === \"string\" ? Number(maxTurnsRaw) : undefined;\n if (maxTurns !== undefined && !Number.isFinite(maxTurns)) fail(\"--max-turns must be a number\");\n\n const outDir = resolve((values.out as string) ?? \"./run\");\n const warbleBin = (values[\"warble-bin\"] as string) ?? defaultWarbleBin();\n const title = values.title as string | undefined;\n\n const input: DispatchInput = {\n slots: common.slots,\n ir: common.raw,\n question: question ?? \"\",\n target: common.target,\n flavor: common.flavor,\n models: common.models,\n irPath: common.irPath,\n ...(common.project !== undefined ? { project: common.project } : {}),\n ...(maxTurns !== undefined ? { maxTurns } : {}),\n };\n const prepared = prepareDispatch(input);\n preflightDispatchAssets(input, prepared);\n for (const c of prepared.components) printResolutionSummary(common.target, c.id, c.report);\n\n if (dryRun) {\n mkdirSync(outDir, { recursive: true });\n for (const c of prepared.components) {\n const planPath = join(outDir, `${c.node.verb}.plan.json`);\n writeFileSync(\n planPath,\n JSON.stringify({\n prompt: c.plan.prompt,\n options: c.plan.options,\n meta: c.plan.meta,\n composition: {\n entry: prepared.entries.find((entry) => entry.root === c.id) ?? null,\n dependencies: prepared.dependencies,\n prepared_callees: prepared.preparedCallees.map((callee) => callee.id),\n },\n }, null, 2) + \"\\n\",\n \"utf8\",\n );\n process.stderr.write(\n `warble-agent-sdk: dry-run — wrote plan ${planPath} (model=${c.plan.meta.model}, split=${c.plan.meta.split}, render=${c.plan.meta.render.kind}); query() not called.\\n`,\n );\n }\n } else {\n const outcome = await dispatch(input, {\n outDir,\n warbleBin,\n ...(title ? { title } : {}),\n });\n for (const component of outcome.components) {\n process.stderr.write(\n `warble-agent-sdk: ran '${component.id}' → ${component.result.htmlPath ?? \"(no html)\"}; ` +\n `${component.result.denials.length} guardrail denial(s); trace at ${join(outDir, \"trace.json\")}\\n`,\n );\n }\n }\n\n writeFileSync(\n join(outDir, \"capability-report.json\"),\n JSON.stringify(\n {\n target: common.target,\n profile: prepared.profile,\n entries: prepared.entries,\n dependencies: prepared.dependencies,\n components: [...prepared.components, ...prepared.preparedCallees].map((c) => ({\n id: c.id,\n role: c.role,\n capabilities: c.report,\n })),\n },\n null,\n 2,\n ) + \"\\n\",\n \"utf8\",\n );\n}\n\n/**\n * `chat` — a multi-turn session (session.ts, G1) over ONE prepared component, reading questions from\n * stdin line-by-line. Each turn's answer is printed to stdout; the SDK session is resumed turn over\n * turn (`ChatSession` handles the `resume: session_id` plumbing). Manual/live use only — not exercised\n * by the offline test suite.\n *\n * `--stream-json` (opt-in): instead of printing the turn's plain final-answer text, stream one\n * `WarbleChatEvent` NDJSON line per event as the turn runs (via `session.ask`'s `onEvent`), followed\n * by a terminal `{\"t\":\"answer\",\"text\":…}` line. Without the flag, behavior is byte-for-byte unchanged\n * from before this option existed.\n */\nasync function runChatCmd(\n common: CommonArgs,\n values: Record<string, string | string[] | boolean | undefined>,\n): Promise<void> {\n const outDir = resolve((values.out as string) ?? \"./run\");\n const warbleBin = (values[\"warble-bin\"] as string) ?? defaultWarbleBin();\n const componentId = (values.component as string) ?? \"answer_query\";\n\n // Scoped to `componentId`: only its own required capabilities are resolved, so a *different*\n // component's unmet requirements (e.g. a sibling gated-tool with no approval channel wired on\n // this target) can never block dispatching this one. See `DispatchInput.componentId`.\n const input: DispatchInput = {\n slots: common.slots,\n ir: common.raw,\n target: common.target,\n flavor: common.flavor,\n models: common.models,\n irPath: common.irPath,\n componentId,\n ...(common.project !== undefined ? { project: common.project } : {}),\n };\n const prepared = prepareDispatch(input);\n preflightDispatchAssets(input, prepared);\n\n // `prepareDispatch` with `componentId` set either returns exactly this one component or throws\n // (caught by `main().catch()` below) — this is a defensive invariant check, not a reachable\n // \"not found\" path; that path's error text now comes from `prepareDispatch` itself.\n const component = prepared.components[0];\n if (!component) fail(`internal error: no component prepared for '${componentId}'`);\n for (const c of prepared.components) printResolutionSummary(common.target, c.id, c.report);\n\n mkdirSync(outDir, { recursive: true });\n const resumeSessionId = values.resume as string | undefined;\n const ir = parseIr(common.raw);\n const session = createChatSession(\n component.plan,\n {\n outDir,\n warbleBin,\n assets: { ir: { ...ir, components: [component.node] }, irPath: common.irPath },\n },\n resumeSessionId,\n );\n\n process.stderr.write(\n `warble-agent-sdk: chat — component '${componentId}'; type a question per line (Ctrl-D to end).\\n`,\n );\n\n const streamJson = Boolean(values[\"stream-json\"]);\n const onEvent = streamJson\n ? (event: WarbleChatEvent): void => {\n process.stdout.write(`${JSON.stringify(event)}\\n`);\n }\n : undefined;\n\n const emitSession = (id: string | null): void => {\n if (!streamJson) return;\n const sessionEvent: WarbleChatEvent = { t: \"session\", id };\n process.stdout.write(`${JSON.stringify(sessionEvent)}\\n`);\n };\n\n const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });\n for await (const line of rl) {\n const question = line.trim();\n if (!question) continue;\n let turn;\n try {\n turn = await session.ask(question, onEvent ? { onEvent } : {});\n } catch (err) {\n // A failed turn (e.g. error_max_turns) still surfaces its session id, when the SDK's result\n // message carried one, so a caller can resume this same conversation instead of starting over.\n emitSession(err instanceof DispatchSessionError ? err.sessionId : null);\n throw err;\n }\n emitSession(turn.sessionId);\n if (streamJson) {\n const answerEvent: WarbleChatEvent = { t: \"answer\", text: turn.finalText };\n process.stdout.write(`${JSON.stringify(answerEvent)}\\n`);\n } else {\n process.stdout.write(`${turn.finalText}\\n`);\n }\n }\n}\n\nmain().catch((e: unknown) => {\n if (e instanceof DispatchError) fail(e.message);\n fail(e instanceof Error ? (e.stack ?? e.message) : String(e));\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgDA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,qBAAqB;AAC9B,SAAS,SAAS,MAAM,eAAe;AACvC,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AA0B9B,SAAS,qBAAqB,OAAsC;AAClE,MAAI;AACF,WAAO,eAAe,KAAK;AAAA,EAC7B,SAAS,GAAG;AACV,SAAK,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;AAAA,EACjD;AACF;AAEA,SAAS,KAAK,SAAwB;AACpC,UAAQ,OAAO,MAAM,UAAU,OAAO;AAAA,CAAI;AAC1C,UAAQ,KAAK,CAAC;AAChB;AAEA,IAAM,QACJ;AAQF,IAAM,kBAAkB,cAAc,YAAY,GAA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,GAAG,KAAK,UAAU,YAAY,CAAC;AAAA,CAAI;AAAA,EAC1D;AAEA,QAAM,KAAK,gBAAgB,EAAE,OAAO,QAAQ,OAAO,WAAW,SAAS,CAAC;AACxE,mBAAiB,QAAQ,IAAI;AAC3B,UAAM,WAAW,KAAK,KAAK;AAC3B,QAAI,CAAC,SAAU;AACf,QAAI;AACJ,QAAI;AACF,aAAO,MAAM,QAAQ,IAAI,UAAU,UAAU,EAAE,QAAQ,IAAI,CAAC,CAAC;AAAA,IAC/D,SAAS,KAAK;AAGZ,kBAAY,eAAe,uBAAuB,IAAI,YAAY,IAAI;AACtE,YAAM;AAAA,IACR;AACA,gBAAY,KAAK,SAAS;AAC1B,QAAI,YAAY;AACd,YAAM,cAA+B,EAAE,GAAG,UAAU,MAAM,KAAK,UAAU;AACzE,cAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,WAAW,CAAC;AAAA,CAAI;AAAA,IACzD,OAAO;AACL,cAAQ,OAAO,MAAM,GAAG,KAAK,SAAS;AAAA,CAAI;AAAA,IAC5C;AAAA,EACF;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,MAAe;AAC3B,MAAI,aAAa,cAAe,MAAK,EAAE,OAAO;AAC9C,OAAK,aAAa,QAAS,EAAE,SAAS,EAAE,UAAW,OAAO,CAAC,CAAC;AAC9D,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `warble-agent-sdk` — the Claude Agent SDK back-end CLI.\n *\n * warble-agent-sdk dispatch <ir.json> \"<question>\" [--target …] [--models-config m.yml]\n * [--render-flavor programmatic|prompt] [--out ./run] [--project <dir>]\n * [--strong opus] [--cheap haiku] [--orchestrator sonnet]\n * [--warble-bin <path>] [--max-turns N] [--title <t>] [--dry-run]\n *\n * warble-agent-sdk emit <ir.json> [--out agent.ts] [--standalone] [--target …] [--models-config …]\n * [--render-flavor …] [--project <dir>] [--strong/--cheap/--orchestrator …]\n *\n * warble-agent-sdk manifest <ir.json> [--include-unavailable] [--out manifest.json] [--target …] [--models-config …]\n * [--render-flavor …] [--project <dir>] [--strong/--cheap/--orchestrator …]\n *\n * warble-agent-sdk chat <ir.json> [--project <dir>] [--component answer_query] [--out ./run]\n * [--target …] [--models-config m.yml] [--render-flavor programmatic|prompt] [--warble-bin <path>]\n * [--stream-json] [--resume <session-id>] [--host-mcp-config <absolute path>]\n *\n * `--slot NAME=VARIANT` fills a named prompt slot with that variant; `--slot NAME=` removes a slot\n * whose condition does not hold. Repeatable, accepted by every subcommand, and mirroring the `warble`\n * CLI's flag of the same name. A slot nobody names takes its declared default — except one carrying\n * a `present_when` condition, which is refused when unanswered on any path whose text reaches a\n * model, because shipping wording for something that may have been withheld is worse than shipping\n * none. `manifest` is a display and renders such a default instead of refusing.\n *\n * `chat --stream-json` emits per-step/per-tool NDJSON events (one `WarbleChatEvent`, events.ts, per\n * line) to stdout as each turn runs, ending with a terminal `{\"t\":\"answer\",\"text\":…}` line, instead of\n * the default plain final-answer-text-per-turn output — for a consumer that wants to build a live,\n * expandable work log rather than just the finished text. Every turn also emits a\n * `{\"t\":\"session\",\"id\":…}` line (on success AND on a failed turn) carrying that turn's SDK session id.\n *\n * `--resume <session-id>` seeds a brand-new `chat` process's FIRST turn with a session id captured by\n * an earlier `chat` process (from its `{\"t\":\"session\",…}` line) — lets a caller resume a conversation\n * that a previous process started (e.g. one that ran out of turns), continuing the real SDK\n * conversation instead of re-dispatching a fresh prompt from scratch. Ignored after the first turn:\n * subsequent turns resume from this process's own prior turn, as usual.\n *\n * `--host-mcp-config <absolute path>` (opt-in, `chat` only) names a host-supplied stdio MCP server:\n * `{ \"name\", \"command\", \"args\", \"tools\", \"instruction\"? }` (hostMcp.ts). The file must be a regular\n * file owned by the current user with no group/other access; the guardrail allows exactly\n * `mcp__<name>__<tool>` for the listed tools and nothing else under `mcp__`. Without the flag, `chat`\n * is unchanged.\n *\n * `dispatch` consumes the SAME `ir.json` a Rust `warble compile` emits and drives the SDK loop\n * in-process (`--dry-run` writes the assembled plan without calling `query()`). `emit` freezes the\n * resolved plan into an importable TS agent module (thin, or `--standalone`). `manifest` runs the\n * same preparation as `emit` (no `question`, no `query()` call) and instead serializes a display\n * manifest — the resolved agents/steps/tiers/capabilities/guardrails for THIS target, structurally\n * identical to the vercel back-end's bundle — so a consumer can source a display from whichever\n * back-end actually runs, instead of always reading the vercel bundle target's output. `chat` opens a\n * multi-turn session (session.ts, G1 — single profile, many turns) over one component, reading\n * questions from stdin line-by-line and resuming the SDK session turn over turn.\n */\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { createInterface } from \"node:readline\";\nimport { parseArgs } from \"node:util\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { emitAgentModule } from \"./codegen.js\";\nimport { loadHostMcpConfig } from \"./hostMcp.js\";\nimport {\n dispatch,\n preflightDispatchAssets,\n prepareDisplayManifest,\n prepareDispatch,\n type DispatchInput,\n type PreparedDispatch,\n} from \"./dispatch.js\";\nimport { parseSlotFlags } from \"./slots.js\";\nimport type { SlotSupply } from \"./slots.js\";\nimport { DispatchError } from \"./error.js\";\nimport type { WarbleChatEvent } from \"./events.js\";\nimport { buildManifest } from \"./manifest.js\";\nimport { parseIr } from \"./ir.js\";\nimport { ModelConfig } from \"./models.js\";\nimport { discoverClaudeModels } from \"./model_catalog.js\";\nimport { parseRenderFlavor, type RenderFlavor } from \"./options.js\";\nimport { DispatchSessionError } from \"./run.js\";\nimport { createChatSession } from \"./session.js\";\nimport { type ResolutionReport } from \"./resolve.js\";\nimport { DEFAULT_TARGET } from \"./targets.js\";\n\n/** `parseSlotFlags` throws; this CLI reports a bad flag as a usage failure instead. */\nfunction parseSlotFlagsOrFail(flags: readonly string[]): SlotSupply {\n try {\n return parseSlotFlags(flags);\n } catch (e) {\n fail(e instanceof Error ? e.message : String(e));\n }\n}\n\nfunction fail(message: string): never {\n process.stderr.write(`error: ${message}\\n`);\n process.exit(1);\n}\n\nconst USAGE =\n 'usage: warble-agent-sdk <dispatch|emit|manifest|chat> <ir.json> [\"<question>\"] [options]\\n' +\n \" warble-agent-sdk list-models [--project <dir>] [--timeout <ms>]\";\n\n// `require(\"../package.json\")` resolves relative to *this* file's own location, one directory up —\n// which is the package root in both the dev tree (src/cli.ts → ../package.json) and the published\n// layout (dist/cli.js → ../package.json; package.json ships in every npm package regardless of the\n// \"files\" allowlist). That keeps the reported version tied to the package's real `version` field\n// instead of a literal that could drift from it.\nconst requireFromHere = createRequire(import.meta.url);\n\nfunction packageVersion(): string {\n return (requireFromHere(\"../package.json\") as { version: string }).version;\n}\n\n/** Locate the reference `warble` binary: --warble-bin, else PATH, else this repo's release build. */\nfunction defaultWarbleBin(): string {\n const here = dirname(fileURLToPath(import.meta.url));\n const repoBuilt = resolve(here, \"../../../target/release/warble\");\n return existsSync(repoBuilt) ? repoBuilt : \"warble\";\n}\n\nfunction printResolutionSummary(target: string, id: string, report: ResolutionReport): void {\n process.stderr.write(`warble-agent-sdk: capability resolution for '${target}' (component '${id}'):\\n`);\n for (const e of report) {\n const note = e.note ? ` — ${e.note}` : \"\";\n process.stderr.write(\n ` ${e.capability.padEnd(28)} ${e.outcome.padEnd(12)} (${e.provided_by}, ${e.criticality})${note}\\n`,\n );\n }\n}\n\ninterface CommonArgs {\n target: string;\n flavor: RenderFlavor;\n models: ModelConfig;\n raw: string;\n irPath: string;\n project: string | undefined;\n /** The host's slot table, from `--slot`. Empty when none was given. */\n slots: SlotSupply;\n}\n\nfunction buildModels(values: Record<string, string | string[] | boolean | undefined>): ModelConfig {\n const cfgPath = values[\"models-config\"];\n if (typeof cfgPath === \"string\") {\n return ModelConfig.fromYaml(readFileSync(resolve(cfgPath), \"utf8\"));\n }\n return ModelConfig.fromFlags(\n (values.strong as string) ?? \"opus\",\n (values.cheap as string) ?? \"haiku\",\n (values.orchestrator as string) ?? \"sonnet\",\n );\n}\n\nasync function main(): Promise<void> {\n // Handle `--version`/`-V` and `--help`/`-h` up front, before the strict `parseArgs` below —\n // neither is a declared option there, so leaving them for `parseArgs` to see would throw\n // `ERR_PARSE_ARGS_UNKNOWN_OPTION` instead of doing what every other CLI does with them.\n const firstArg = process.argv[2];\n if (firstArg === \"--version\" || firstArg === \"-V\") {\n process.stdout.write(`${packageVersion()}\\n`);\n return;\n }\n if (firstArg === \"--help\" || firstArg === \"-h\") {\n process.stdout.write(`${USAGE}\\n`);\n return;\n }\n\n const { values, positionals } = parseArgs({\n allowPositionals: true,\n options: {\n target: { type: \"string\" },\n out: { type: \"string\" },\n \"models-config\": { type: \"string\" },\n \"render-flavor\": { type: \"string\" },\n strong: { type: \"string\" },\n cheap: { type: \"string\" },\n orchestrator: { type: \"string\" },\n project: { type: \"string\" },\n \"warble-bin\": { type: \"string\" },\n \"max-turns\": { type: \"string\" },\n title: { type: \"string\" },\n \"dry-run\": { type: \"boolean\" },\n standalone: { type: \"boolean\" },\n component: { type: \"string\" },\n \"stream-json\": { type: \"boolean\" },\n resume: { type: \"string\" },\n \"host-mcp-config\": { type: \"string\" },\n timeout: { type: \"string\" },\n \"include-unavailable\": { type: \"boolean\" },\n slot: { type: \"string\", multiple: true },\n },\n });\n\n\n\n const [subcommand, irArg, question] = positionals;\n if (values[\"host-mcp-config\"] !== undefined && subcommand !== \"chat\") {\n fail(\"--host-mcp-config is only accepted by `chat`\");\n }\n if (\n subcommand !== \"dispatch\" &&\n subcommand !== \"emit\" &&\n subcommand !== \"manifest\" &&\n subcommand !== \"chat\" &&\n subcommand !== \"list-models\"\n ) {\n fail(USAGE);\n }\n if (subcommand === \"list-models\") {\n if (irArg !== undefined || question !== undefined) fail(\"list-models does not take an <ir.json> or question\");\n const timeout = values.timeout === undefined ? undefined : Number(values.timeout);\n if (timeout !== undefined && (!Number.isFinite(timeout) || timeout <= 0)) fail(\"--timeout must be a positive number\");\n const catalog = await discoverClaudeModels({\n ...(values.project ? { cwd: values.project } : {}),\n ...(timeout !== undefined ? { timeoutMs: timeout } : {}),\n });\n process.stdout.write(`${JSON.stringify(catalog)}\\n`);\n return;\n }\n if (values.timeout !== undefined) fail(\"--timeout is only supported by list-models\");\n if (values[\"include-unavailable\"] && subcommand !== \"manifest\") fail(\"--include-unavailable is only supported by manifest\");\n if (!irArg) fail(\"missing <ir.json> argument\");\n\n const target = values.target ?? DEFAULT_TARGET;\n const flavor = parseRenderFlavor(values[\"render-flavor\"] ?? \"programmatic\");\n const models = buildModels(values);\n const raw = readFileSync(resolve(irArg), \"utf8\");\n\n // Parsed once and carried on CommonArgs, so every subcommand that builds prompts gets the same\n // table. Without this the seam would be reachable only by importing the library, and a profile\n // with a conditional slot could not be run through this CLI at all — it would always refuse for\n // want of an answer.\n const common: CommonArgs = {\n target,\n flavor,\n models,\n raw,\n irPath: irArg,\n project: values.project,\n slots: parseSlotFlagsOrFail(values.slot ?? []),\n };\n\n if (subcommand === \"emit\") {\n return runEmit(common, values.out, Boolean(values.standalone));\n }\n if (subcommand === \"manifest\") {\n return runManifest(common, values.out, Boolean(values[\"include-unavailable\"]));\n }\n if (subcommand === \"chat\") {\n return runChatCmd(common, values);\n }\n return runDispatchCmd(common, values, question);\n}\n\nfunction runEmit(common: CommonArgs, outArg: string | undefined, standalone: boolean): void {\n const input: DispatchInput = {\n slots: common.slots,\n ir: common.raw,\n target: common.target,\n flavor: common.flavor,\n models: common.models,\n irPath: common.irPath,\n ...(common.project !== undefined ? { project: common.project } : {}),\n };\n const prepared: PreparedDispatch = prepareDispatch(input);\n preflightDispatchAssets(input, prepared);\n for (const c of prepared.components) printResolutionSummary(common.target, c.id, c.report);\n\n const outPath = resolve(outArg ?? \"agent.ts\");\n mkdirSync(dirname(outPath), { recursive: true });\n writeFileSync(outPath, emitAgentModule(prepared, { standalone }), \"utf8\");\n process.stderr.write(\n `warble-agent-sdk: emit — wrote ${outPath} (${prepared.components.length} component(s), ${standalone ? \"standalone\" : \"thin\"}).\\n`,\n );\n}\n\n/**\n * `manifest` — same preparation as `emit` (no `question`, `query()` never called), but instead of\n * freezing an importable agent module, serializes the display manifest (see `manifest.ts`) to stdout\n * or `--out`. Capability resolution summaries still go to stderr so stdout stays pure JSON.\n */\nfunction runManifest(common: CommonArgs, outArg: string | undefined, includeUnavailable: boolean): void {\n const input = {\n ir: common.raw,\n target: common.target,\n flavor: common.flavor,\n models: common.models,\n irPath: common.irPath,\n ...(common.project !== undefined ? { project: common.project } : {}),\n } as const;\n const prepared = includeUnavailable ? prepareDisplayManifest({ ...input, slots: common.slots }) : prepareDispatch({ ...input, slots: common.slots });\n for (const c of prepared.components) {\n if (\"report\" in c) printResolutionSummary(common.target, c.id, c.report);\n }\n\n const manifest = buildManifest(prepared, common.raw);\n const json = `${JSON.stringify(manifest, null, 2)}\\n`;\n\n if (outArg) {\n const outPath = resolve(outArg);\n mkdirSync(dirname(outPath), { recursive: true });\n writeFileSync(outPath, json, \"utf8\");\n process.stderr.write(\n `warble-agent-sdk: manifest — wrote ${outPath} (${prepared.components.length} agent(s)).\\n`,\n );\n } else {\n process.stdout.write(json);\n }\n}\n\nasync function runDispatchCmd(\n common: CommonArgs,\n values: Record<string, string | string[] | boolean | undefined>,\n question: string | undefined,\n): Promise<void> {\n const dryRun = Boolean(values[\"dry-run\"]);\n if (!question && !dryRun) fail('missing \"<question>\" argument (or pass --dry-run)');\n\n const maxTurnsRaw = values[\"max-turns\"];\n const maxTurns = typeof maxTurnsRaw === \"string\" ? Number(maxTurnsRaw) : undefined;\n if (maxTurns !== undefined && !Number.isFinite(maxTurns)) fail(\"--max-turns must be a number\");\n\n const outDir = resolve((values.out as string) ?? \"./run\");\n const warbleBin = (values[\"warble-bin\"] as string) ?? defaultWarbleBin();\n const title = values.title as string | undefined;\n\n const input: DispatchInput = {\n slots: common.slots,\n ir: common.raw,\n question: question ?? \"\",\n target: common.target,\n flavor: common.flavor,\n models: common.models,\n irPath: common.irPath,\n ...(common.project !== undefined ? { project: common.project } : {}),\n ...(maxTurns !== undefined ? { maxTurns } : {}),\n };\n const prepared = prepareDispatch(input);\n preflightDispatchAssets(input, prepared);\n for (const c of prepared.components) printResolutionSummary(common.target, c.id, c.report);\n\n if (dryRun) {\n mkdirSync(outDir, { recursive: true });\n for (const c of prepared.components) {\n const planPath = join(outDir, `${c.node.verb}.plan.json`);\n writeFileSync(\n planPath,\n JSON.stringify({\n prompt: c.plan.prompt,\n options: c.plan.options,\n meta: c.plan.meta,\n composition: {\n entry: prepared.entries.find((entry) => entry.root === c.id) ?? null,\n dependencies: prepared.dependencies,\n prepared_callees: prepared.preparedCallees.map((callee) => callee.id),\n },\n }, null, 2) + \"\\n\",\n \"utf8\",\n );\n process.stderr.write(\n `warble-agent-sdk: dry-run — wrote plan ${planPath} (model=${c.plan.meta.model}, split=${c.plan.meta.split}, render=${c.plan.meta.render.kind}); query() not called.\\n`,\n );\n }\n } else {\n const outcome = await dispatch(input, {\n outDir,\n warbleBin,\n ...(title ? { title } : {}),\n });\n for (const component of outcome.components) {\n process.stderr.write(\n `warble-agent-sdk: ran '${component.id}' → ${component.result.htmlPath ?? \"(no html)\"}; ` +\n `${component.result.denials.length} guardrail denial(s); trace at ${join(outDir, \"trace.json\")}\\n`,\n );\n }\n }\n\n writeFileSync(\n join(outDir, \"capability-report.json\"),\n JSON.stringify(\n {\n target: common.target,\n profile: prepared.profile,\n entries: prepared.entries,\n dependencies: prepared.dependencies,\n components: [...prepared.components, ...prepared.preparedCallees].map((c) => ({\n id: c.id,\n role: c.role,\n capabilities: c.report,\n })),\n },\n null,\n 2,\n ) + \"\\n\",\n \"utf8\",\n );\n}\n\n/**\n * `chat` — a multi-turn session (session.ts, G1) over ONE prepared component, reading questions from\n * stdin line-by-line. Each turn's answer is printed to stdout; the SDK session is resumed turn over\n * turn (`ChatSession` handles the `resume: session_id` plumbing). Manual/live use only — not exercised\n * by the offline test suite.\n *\n * `--stream-json` (opt-in): instead of printing the turn's plain final-answer text, stream one\n * `WarbleChatEvent` NDJSON line per event as the turn runs (via `session.ask`'s `onEvent`), followed\n * by a terminal `{\"t\":\"answer\",\"text\":…}` line. Without the flag, behavior is byte-for-byte unchanged\n * from before this option existed.\n */\nasync function runChatCmd(\n common: CommonArgs,\n values: Record<string, string | string[] | boolean | undefined>,\n): Promise<void> {\n const outDir = resolve((values.out as string) ?? \"./run\");\n const warbleBin = (values[\"warble-bin\"] as string) ?? defaultWarbleBin();\n const componentId = (values.component as string) ?? \"answer_query\";\n const hostMcpPath = values[\"host-mcp-config\"] as string | undefined;\n // Loaded before anything else runs so a rejected file fails the command up front. Its contents,\n // args and environment are never printed.\n const hostMcp = hostMcpPath !== undefined ? loadHostMcpConfig(hostMcpPath) : undefined;\n\n // Scoped to `componentId`: only its own required capabilities are resolved, so a *different*\n // component's unmet requirements (e.g. a sibling gated-tool with no approval channel wired on\n // this target) can never block dispatching this one. See `DispatchInput.componentId`.\n const input: DispatchInput = {\n slots: common.slots,\n ir: common.raw,\n target: common.target,\n flavor: common.flavor,\n models: common.models,\n irPath: common.irPath,\n componentId,\n ...(common.project !== undefined ? { project: common.project } : {}),\n };\n const prepared = prepareDispatch(input);\n preflightDispatchAssets(input, prepared);\n\n // `prepareDispatch` with `componentId` set either returns exactly this one component or throws\n // (caught by `main().catch()` below) — this is a defensive invariant check, not a reachable\n // \"not found\" path; that path's error text now comes from `prepareDispatch` itself.\n const component = prepared.components[0];\n if (!component) fail(`internal error: no component prepared for '${componentId}'`);\n for (const c of prepared.components) printResolutionSummary(common.target, c.id, c.report);\n\n mkdirSync(outDir, { recursive: true });\n const resumeSessionId = values.resume as string | undefined;\n const ir = parseIr(common.raw);\n const session = createChatSession(\n component.plan,\n {\n outDir,\n warbleBin,\n assets: { ir: { ...ir, components: [component.node] }, irPath: common.irPath },\n ...(hostMcp ? { hostMcp } : {}),\n },\n resumeSessionId,\n );\n\n process.stderr.write(\n `warble-agent-sdk: chat — component '${componentId}'; type a question per line (Ctrl-D to end).\\n`,\n );\n\n const streamJson = Boolean(values[\"stream-json\"]);\n const onEvent = streamJson\n ? (event: WarbleChatEvent): void => {\n process.stdout.write(`${JSON.stringify(event)}\\n`);\n }\n : undefined;\n\n const emitSession = (id: string | null): void => {\n if (!streamJson) return;\n const sessionEvent: WarbleChatEvent = { t: \"session\", id };\n process.stdout.write(`${JSON.stringify(sessionEvent)}\\n`);\n };\n\n const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });\n for await (const line of rl) {\n const question = line.trim();\n if (!question) continue;\n let turn;\n try {\n turn = await session.ask(question, onEvent ? { onEvent } : {});\n } catch (err) {\n // A failed turn (e.g. error_max_turns) still surfaces its session id, when the SDK's result\n // message carried one, so a caller can resume this same conversation instead of starting over.\n emitSession(err instanceof DispatchSessionError ? err.sessionId : null);\n throw err;\n }\n emitSession(turn.sessionId);\n if (streamJson) {\n const answerEvent: WarbleChatEvent = { t: \"answer\", text: turn.finalText };\n process.stdout.write(`${JSON.stringify(answerEvent)}\\n`);\n } else {\n process.stdout.write(`${turn.finalText}\\n`);\n }\n }\n}\n\nmain().catch((e: unknown) => {\n if (e instanceof DispatchError) fail(e.message);\n fail(e instanceof Error ? (e.stack ?? e.message) : String(e));\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsDA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,qBAAqB;AAC9B,SAAS,SAAS,MAAM,eAAe;AACvC,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AA2B9B,SAAS,qBAAqB,OAAsC;AAClE,MAAI;AACF,WAAO,eAAe,KAAK;AAAA,EAC7B,SAAS,GAAG;AACV,SAAK,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;AAAA,EACjD;AACF;AAEA,SAAS,KAAK,SAAwB;AACpC,UAAQ,OAAO,MAAM,UAAU,OAAO;AAAA,CAAI;AAC1C,UAAQ,KAAK,CAAC;AAChB;AAEA,IAAM,QACJ;AAQF,IAAM,kBAAkB,cAAc,YAAY,GAAG;AAErD,SAAS,i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D,QAAM,UAAU,aACZ,CAAC,UAAiC;AAChC,YAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,KAAK,CAAC;AAAA,CAAI;AAAA,EACnD,IACA;AAEJ,QAAM,cAAc,CAAC,OAA4B;AAC/C,QAAI,CAAC,WAAY;AACjB,UAAM,eAAgC,EAAE,GAAG,WAAW,GAAG;AACzD,YAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,YAAY,CAAC;AAAA,CAAI;AAAA,EAC1D;AAEA,QAAM,KAAK,gBAAgB,EAAE,OAAO,QAAQ,OAAO,WAAW,SAAS,CAAC;AACxE,mBAAiB,QAAQ,IAAI;AAC3B,UAAM,WAAW,KAAK,KAAK;AAC3B,QAAI,CAAC,SAAU;AACf,QAAI;AACJ,QAAI;AACF,aAAO,MAAM,QAAQ,IAAI,UAAU,UAAU,EAAE,QAAQ,IAAI,CAAC,CAAC;AAAA,IAC/D,SAAS,KAAK;AAGZ,kBAAY,eAAe,uBAAuB,IAAI,YAAY,IAAI;AACtE,YAAM;AAAA,IACR;AACA,gBAAY,KAAK,SAAS;AAC1B,QAAI,YAAY;AACd,YAAM,cAA+B,EAAE,GAAG,UAAU,MAAM,KAAK,UAAU;AACzE,cAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,WAAW,CAAC;AAAA,CAAI;AAAA,IACzD,OAAO;AACL,cAAQ,OAAO,MAAM,GAAG,KAAK,SAAS;AAAA,CAAI;AAAA,IAC5C;AAAA,EACF;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,MAAe;AAC3B,MAAI,aAAa,cAAe,MAAK,EAAE,OAAO;AAC9C,OAAK,aAAa,QAAS,EAAE,SAAS,EAAE,UAAW,OAAO,CAAC,CAAC;AAC9D,CAAC;","names":[]}
package/dist/index.d.ts CHANGED
@@ -881,6 +881,13 @@ interface GuardConfig {
881
881
  * project. `undefined`/`null` leaves every other component's behavior unchanged.
882
882
  */
883
883
  setupScope?: string | null;
884
+ /**
885
+ * Host-supplied MCP tools (`chat --host-mcp-config`, hostMcp.ts): the EXACT `mcp__<server>__<tool>`
886
+ * names this guard allows on top of everything above. Matched by string equality, never by
887
+ * prefix — any other `mcp__*` tool, including another tool on the same server, still falls through
888
+ * to the fail-closed denial. `undefined` leaves every decision exactly as it was before this seam.
889
+ */
890
+ hostMcpTools?: readonly string[];
884
891
  }
885
892
  /**
886
893
  * Build the `canUseTool` gate for a component, plus the `PreToolUse` hooks needed to actually enforce
@@ -900,6 +907,24 @@ declare function makeReadOnlyGuard(cfg: GuardConfig): {
900
907
  hooks: HookCallbackMatcher[];
901
908
  };
902
909
 
910
+ interface HostMcpConfig {
911
+ /** MCP server name, `[a-z0-9_]{1,32}`; the agent sees its tools as `mcp__<name>__<tool>`. */
912
+ name: string;
913
+ /** Absolute path of the server executable. */
914
+ command: string;
915
+ args: string[];
916
+ /** The only tools on this server the guardrail allows, each `[a-z0-9_]{1,64}`. */
917
+ tools: string[];
918
+ /** Optional single line (at most 300 chars) appended to the system prompt. */
919
+ instruction?: string;
920
+ }
921
+ /** Validate a parsed config value. Exported for tests; `loadHostMcpConfig` is the entry point. */
922
+ declare function parseHostMcpConfig(value: unknown): HostMcpConfig;
923
+ /** Load and validate a `--host-mcp-config` file. Throws `DispatchError` without echoing contents. */
924
+ declare function loadHostMcpConfig(path: string): HostMcpConfig;
925
+ /** The exact tool names the guardrail allows for this server: `mcp__<name>__<tool>`. */
926
+ declare function hostMcpToolNames(cfg: HostMcpConfig): string[];
927
+
903
928
  /** One assistant turn's usage. `parent_tool_use_id` distinguishes driver turns from subagent turns. */
904
929
  interface StepUsage {
905
930
  model: string;
@@ -987,6 +1012,13 @@ interface RunConfig {
987
1012
  ir: WarbleIr;
988
1013
  irPath: string;
989
1014
  };
1015
+ /**
1016
+ * A host-supplied stdio MCP server (`chat --host-mcp-config`, hostMcp.ts): added to the turn's
1017
+ * `mcpServers`, its listed tools allowed by the guardrail by exact name, and its optional
1018
+ * instruction appended as one line to the system prompt. Only the single/split SDK loop accepts
1019
+ * it; a hybrid-staged plan refuses it rather than silently dropping it. Omitted, nothing changes.
1020
+ */
1021
+ hostMcp?: HostMcpConfig;
990
1022
  }
991
1023
  /**
992
1024
  * A dispatch failure that still carries the SDK's session id, when the result message had one —
@@ -1674,4 +1706,4 @@ declare function buildUnavailableAgentManifest(component: UnavailableDisplayComp
1674
1706
  * `profile`, which `PreparedDispatch` does not itself carry. */
1675
1707
  declare function buildManifest(prepared: PreparedDispatch | PreparedDisplayManifest, raw: string): Manifest;
1676
1708
 
1677
- export { type AgentManifest, type AskOptions, type AvailableAgentManifest, type AvailableDisplayComponent, type BuildConfig, COMPONENT_TYPES, type CallLocalOptions, type CapabilityEntry, type CapabilityOutcome, type CapabilityProfile, type ChatRequest, ChatSession, type ClarifyOutcome, type CompatibilityPolicy, type ComponentCall, type ComponentCallTrace, type ComponentClosurePlan, type ComponentDependency, type ComponentDependencyManifest, type ComponentInvocationLimits, type ComponentInvocationRequest, type ComponentInvocationResult, ComponentInvocationRuntime, type ComponentNode, type ComponentOutcome, type ComponentRootResult, ComponentStepExecutionError, type ComponentStepResult, type ComponentStepRun, type ComponentStepRunner, type ComponentType, type ComposedRunConfig, type ContextBinding, type Criticality, DEFAULT_CLARIFY_THRESHOLD, DEFAULT_COMPONENT_INVOCATION_LIMITS, DEFAULT_RENDER_FLAVOR, DEFAULT_TARGET, DESTRUCTIVE_BASH_DENY, type Denial, type DiscoverClaudeModelsOptions, DispatchError, type DispatchInput, type DispatchMeta, type DispatchOutcome, type DispatchPlan, type DispatchRunConfig, DispatchSessionError, type DisplayComponent, type Effect, type EmitOptions, type EntryClosure, type EntryManifest, type GateFailureMode, type GateKind, type GuardConfig, type Guardrail, type GuardrailManifest, type IrConfig, type LlmCall, MODEL_CATALOG_VERSION, type Manifest, type ModelCatalogModel, type ModelCatalogResult, type ModelCatalogUnavailableCode, ModelConfig, OUTCOME_KINDS, type Outcome, type OutcomeKind, type PreconditionResult, type PreparedComponent, type PreparedDispatch, type PreparedDisplayManifest, type PromptFingerprint, type ProvidedBy, type Provider, REALIZATION_KINDS, type RealizationKind, type RenderBlock, type RenderFlavor, type RenderGate, type RenderResult, type ResolutionReport, type ResolvedCapability, type ResolvedIntent, type RoutingMode, type RoutingPlan, type RunConfig, type RunResult, SUPPORTED_IR_VERSIONS, type SessionState, type SlotSupply, type StagedStep, type StepManifest, type StepMessage, type StepRealization, type StepUsage, TRIGGER_KINDS, type TargetId, type TierBinding, type ToolPlan, type ToolRef, type Trace, type Trigger, type TriggerKind, type Turn, type TurnResult, UNAVAILABLE_COMPONENT_REASON, type UnansweredCondition, type UnavailableAgentManifest, type UnavailableDisplayComponent, type WarbleIr, type WhenGuardOut, aggregateTrace, appendTurn, applySlots, assertEligibleComponentCallee, assertEligibleComponentCaller, assertNoSlotReferences, assetDirForIr, buildAgentManifest, buildChatRequest, buildDispatchPlan, buildManifest, buildStepMessages, buildToolDriverPrompt, buildTurnPrompt, buildUnavailableAgentManifest, callOpenAiCompat, collectRequiredCapabilities, componentDependencies, composeCanUseTool, composeHooks, createChatSession, createSdkComponentStepRunner, createSessionState, decideClarify, discoverClaudeModels, dispatch, distillFollowup, distinctProviders, distinctTiers, emitAgentModule, extractCompletionText, fingerprintPrompts, fingerprintSurfaces, inspectNodeCapabilities, isKnownTarget, knownTargetNames, landAssets, lastResolvedIntent, lastSessionId, localProfile, makeReadOnlyGuard, normalizeComponentRequest, normalizeComponentResult, parseIr, parseRenderFlavor, parseSlotFlags, planProviderRouting, preflightDispatchAssets, prepareDispatch, prepareDisplayManifest, profileFor, promptSurfaces, promptSurfacesOf, renderEnvelope, resolveCapabilities, resolveComponentClosure, resolveNodeCapabilities, resolveProjectCwd, resolveSlots, resolveStagedSteps, runComposedDispatch, runDispatch, runHybridTool, shouldSplitPerStepTier, usesLocalProvider, validateAssets };
1709
+ export { type AgentManifest, type AskOptions, type AvailableAgentManifest, type AvailableDisplayComponent, type BuildConfig, COMPONENT_TYPES, type CallLocalOptions, type CapabilityEntry, type CapabilityOutcome, type CapabilityProfile, type ChatRequest, ChatSession, type ClarifyOutcome, type CompatibilityPolicy, type ComponentCall, type ComponentCallTrace, type ComponentClosurePlan, type ComponentDependency, type ComponentDependencyManifest, type ComponentInvocationLimits, type ComponentInvocationRequest, type ComponentInvocationResult, ComponentInvocationRuntime, type ComponentNode, type ComponentOutcome, type ComponentRootResult, ComponentStepExecutionError, type ComponentStepResult, type ComponentStepRun, type ComponentStepRunner, type ComponentType, type ComposedRunConfig, type ContextBinding, type Criticality, DEFAULT_CLARIFY_THRESHOLD, DEFAULT_COMPONENT_INVOCATION_LIMITS, DEFAULT_RENDER_FLAVOR, DEFAULT_TARGET, DESTRUCTIVE_BASH_DENY, type Denial, type DiscoverClaudeModelsOptions, DispatchError, type DispatchInput, type DispatchMeta, type DispatchOutcome, type DispatchPlan, type DispatchRunConfig, DispatchSessionError, type DisplayComponent, type Effect, type EmitOptions, type EntryClosure, type EntryManifest, type GateFailureMode, type GateKind, type GuardConfig, type Guardrail, type GuardrailManifest, type HostMcpConfig, type IrConfig, type LlmCall, MODEL_CATALOG_VERSION, type Manifest, type ModelCatalogModel, type ModelCatalogResult, type ModelCatalogUnavailableCode, ModelConfig, OUTCOME_KINDS, type Outcome, type OutcomeKind, type PreconditionResult, type PreparedComponent, type PreparedDispatch, type PreparedDisplayManifest, type PromptFingerprint, type ProvidedBy, type Provider, REALIZATION_KINDS, type RealizationKind, type RenderBlock, type RenderFlavor, type RenderGate, type RenderResult, type ResolutionReport, type ResolvedCapability, type ResolvedIntent, type RoutingMode, type RoutingPlan, type RunConfig, type RunResult, SUPPORTED_IR_VERSIONS, type SessionState, type SlotSupply, type StagedStep, type StepManifest, type StepMessage, type StepRealization, type StepUsage, TRIGGER_KINDS, type TargetId, type TierBinding, type ToolPlan, type ToolRef, type Trace, type Trigger, type TriggerKind, type Turn, type TurnResult, UNAVAILABLE_COMPONENT_REASON, type UnansweredCondition, type UnavailableAgentManifest, type UnavailableDisplayComponent, type WarbleIr, type WhenGuardOut, aggregateTrace, appendTurn, applySlots, assertEligibleComponentCallee, assertEligibleComponentCaller, assertNoSlotReferences, assetDirForIr, buildAgentManifest, buildChatRequest, buildDispatchPlan, buildManifest, buildStepMessages, buildToolDriverPrompt, buildTurnPrompt, buildUnavailableAgentManifest, callOpenAiCompat, collectRequiredCapabilities, componentDependencies, composeCanUseTool, composeHooks, createChatSession, createSdkComponentStepRunner, createSessionState, decideClarify, discoverClaudeModels, dispatch, distillFollowup, distinctProviders, distinctTiers, emitAgentModule, extractCompletionText, fingerprintPrompts, fingerprintSurfaces, hostMcpToolNames, inspectNodeCapabilities, isKnownTarget, knownTargetNames, landAssets, lastResolvedIntent, lastSessionId, loadHostMcpConfig, localProfile, makeReadOnlyGuard, normalizeComponentRequest, normalizeComponentResult, parseHostMcpConfig, parseIr, parseRenderFlavor, parseSlotFlags, planProviderRouting, preflightDispatchAssets, prepareDispatch, prepareDisplayManifest, profileFor, promptSurfaces, promptSurfacesOf, renderEnvelope, resolveCapabilities, resolveComponentClosure, resolveNodeCapabilities, resolveProjectCwd, resolveSlots, resolveStagedSteps, runComposedDispatch, runDispatch, runHybridTool, shouldSplitPerStepTier, usesLocalProvider, validateAssets };
package/dist/index.js CHANGED
@@ -50,16 +50,19 @@ import {
50
50
  extractCompletionText,
51
51
  fingerprintPrompts,
52
52
  fingerprintSurfaces,
53
+ hostMcpToolNames,
53
54
  inspectNodeCapabilities,
54
55
  isKnownTarget,
55
56
  knownTargetNames,
56
57
  landAssets,
57
58
  lastResolvedIntent,
58
59
  lastSessionId,
60
+ loadHostMcpConfig,
59
61
  localProfile,
60
62
  makeReadOnlyGuard,
61
63
  normalizeComponentRequest,
62
64
  normalizeComponentResult,
65
+ parseHostMcpConfig,
63
66
  parseIr,
64
67
  parseRenderFlavor,
65
68
  parseSlotFlags,
@@ -83,7 +86,7 @@ import {
83
86
  shouldSplitPerStepTier,
84
87
  usesLocalProvider,
85
88
  validateAssets
86
- } from "./chunk-XH2CFK2E.js";
89
+ } from "./chunk-6GZGHFX7.js";
87
90
  export {
88
91
  COMPONENT_TYPES,
89
92
  ChatSession,
@@ -136,16 +139,19 @@ export {
136
139
  extractCompletionText,
137
140
  fingerprintPrompts,
138
141
  fingerprintSurfaces,
142
+ hostMcpToolNames,
139
143
  inspectNodeCapabilities,
140
144
  isKnownTarget,
141
145
  knownTargetNames,
142
146
  landAssets,
143
147
  lastResolvedIntent,
144
148
  lastSessionId,
149
+ loadHostMcpConfig,
145
150
  localProfile,
146
151
  makeReadOnlyGuard,
147
152
  normalizeComponentRequest,
148
153
  normalizeComponentResult,
154
+ parseHostMcpConfig,
149
155
  parseIr,
150
156
  parseRenderFlavor,
151
157
  parseSlotFlags,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warble/claude-agent-sdk",
3
- "version": "0.15.3",
3
+ "version": "0.16.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Warble back-end: Claude Agent SDK query() loop dispatcher (embeddable library + CLI)",