car-runtime 0.26.0 → 0.28.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 (2) hide show
  1. package/index.d.ts +88 -3
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -49,6 +49,19 @@ export class CarRuntime {
49
49
  */
50
50
  loadMemory(path: string): Promise<number>;
51
51
 
52
+ /**
53
+ * Stream one delta of a chat turn back to the daemon as an
54
+ * `agent.chat.event` notification (the agent-chat surface). Called from an
55
+ * `agent.chat` handler (see `registerChatHandler`) to emit the reply
56
+ * incrementally; the daemon rewrites each event to `agents.chat.event` for
57
+ * the host that issued `agents.chat`, keyed by `sessionId`.
58
+ *
59
+ * `kind` is one of `token` | `tool_call` | `done` | `error`. `delta` carries
60
+ * the text for `token` (and the final text/status for `done`/`error`); omit
61
+ * it for a bare signal.
62
+ */
63
+ chatEvent(sessionId: string, kind: string, delta?: string | undefined | null): Promise<void>;
64
+
52
65
  /**
53
66
  * Persist memory graph to a JSON file (backward-compatible flat format).
54
67
  * Returns the number of records written.
@@ -631,7 +644,15 @@ export class CarRuntime {
631
644
  * invoked }` JSON. `maxSubtasks` caps the split (clamped to [1, 10]; null =
632
645
  * default 5). With `invoke: true`, each subtask's chosen agent runs.
633
646
  */
634
- declagentRouteSplit(need: string, invoke: boolean, maxSubtasks?: number | undefined | null): Promise<string>;
647
+ declagentRouteSplit(
648
+ need: string,
649
+ invoke: boolean,
650
+ maxSubtasks?: number | undefined | null,
651
+ decompositionMode?: "vanilla" | "sad" | string | undefined | null,
652
+ sadHints?: number | undefined | null,
653
+ sadIterations?: number | undefined | null,
654
+ sadConvergenceJaccard?: number | undefined | null
655
+ ): Promise<string>;
635
656
  /**
636
657
  * Read-only view of the learned routing topology: per-agent success stats
637
658
  * and directed agent→agent edge weights. Returns `{ agents, edges }` JSON.
@@ -645,6 +666,21 @@ export class CarRuntime {
645
666
  * null = default 5).
646
667
  */
647
668
  discoveryResolve(need: string, limit?: number | undefined | null): Promise<string>;
669
+ /**
670
+ * Compose a decompose/retrieve/plan route over all discoverable services.
671
+ * Returns `{ plan, decomposition, candidates, metadata }` JSON. Planning only;
672
+ * callers invoke returned targets through existing governed surfaces.
673
+ */
674
+ discoveryRouteCompose(
675
+ need: string,
676
+ maxSubtasks?: number | undefined | null,
677
+ decompositionMode?: "vanilla" | "sad" | string | undefined | null,
678
+ sadHints?: number | undefined | null,
679
+ sadIterations?: number | undefined | null,
680
+ sadConvergenceJaccard?: number | undefined | null,
681
+ candidatesPerStep?: number | undefined | null,
682
+ rerank?: boolean
683
+ ): Promise<string>;
648
684
 
649
685
  /**
650
686
  * Build a concrete onboarding plan (machine summary, top pick, alternatives,
@@ -674,7 +710,7 @@ export class CarRuntime {
674
710
  * why a model won and what the alternatives cost in reliability terms. Empty
675
711
  * on explicit-model and cold-start paths where no ranking occurred.
676
712
  */
677
- routeModel(prompt: string): Promise<string>;
713
+ routeModel(prompt: string, intentJson?: string | null): Promise<string>;
678
714
 
679
715
  /** Per-model performance profiles. Returns JSON. */
680
716
  modelStats(): Promise<string>;
@@ -819,6 +855,14 @@ export class CarRuntime {
819
855
  /** Returns JSON `{exists: boolean, key, service}` without exposing the value. */
820
856
  secretStatus(key: string, service?: string | null): string;
821
857
 
858
+ /**
859
+ * List the NAMES of secrets stored through this surface. Returns JSON
860
+ * `{secrets: [{service, key, exists}]}` — never the values. Backed by the
861
+ * `~/.car/secret_index.json` name index, joined with a live existence check
862
+ * (`exists` is `null` if the backend couldn't be probed).
863
+ */
864
+ secretList(): string;
865
+
822
866
  // -------------------------------------------------------------------------
823
867
  // OS permission preflight
824
868
  // -------------------------------------------------------------------------
@@ -1182,6 +1226,32 @@ export function registerVoiceEventHandler(
1182
1226
  onEvent: (sessionId: string, eventJson: string) => void,
1183
1227
  ): void;
1184
1228
 
1229
+ /**
1230
+ * Register the JS handler that serves daemon-initiated `agent.chat`
1231
+ * reverse-calls — the agent-chat surface. A supervised agent (running in
1232
+ * `--serve` mode, attached via `session.auth`) calls this once; the daemon
1233
+ * reverse-calls `agent.chat` for every host `agents.chat`, the bridge acks
1234
+ * `{accepted:true}` immediately, and fires this handler.
1235
+ *
1236
+ * `handlerFn(paramsJson)` receives `{"session_id":"...","prompt":"...",
1237
+ * "attachments":[...]?,"context":{...}?}` as a JSON string. Run one
1238
+ * conversational turn — keep a per-`session_id` message thread, run the
1239
+ * agent loop, and stream the reply back via `CarRuntime.chatEvent` — then
1240
+ * return. It is fire-and-forget (the ack already went back), so a rejected
1241
+ * Promise is logged, not surfaced to the host. Process-wide setter,
1242
+ * symmetric to `registerVoiceEventHandler`; pair with
1243
+ * `unregisterChatHandler` to clear.
1244
+ */
1245
+ export function registerChatHandler(
1246
+ handlerFn: (paramsJson: string) => void,
1247
+ ): void;
1248
+
1249
+ /**
1250
+ * Clear the registered `agent.chat` handler. Subsequent reverse-calls are
1251
+ * refused so the daemon learns this agent is no longer conversational.
1252
+ */
1253
+ export function unregisterChatHandler(): void;
1254
+
1185
1255
  /**
1186
1256
  * Register the JS `tools.execute` handler for `submitProposal`
1187
1257
  * (Parslee-ai/car-releases#38). When the daemon dispatches a
@@ -2301,12 +2371,26 @@ export function agentsHealthExternal(
2301
2371
  * "allowed_tools"?: string[], // tool allowlist; [] denies all
2302
2372
  * "max_turns"?: number, // turn cap
2303
2373
  * "timeout_secs"?: number, // hard deadline (default 300s)
2304
- * "mcp_endpoint"?: string // MCP server URL passed via
2374
+ * "mcp_endpoint"?: string, // MCP server URL passed via
2305
2375
  * // --mcp-config; daemon callers
2306
2376
  * // auto-fill from car-server's
2307
2377
  * // bound /mcp URL. "" opts out.
2378
+ * "attachments"?: [ // images attached to the prompt
2379
+ * { "path": string, // abs path on the daemon's fs
2380
+ * "media_type"?: string } // advisory; the runner derives
2381
+ * ] // the real type from content
2308
2382
  * }
2309
2383
  *
2384
+ * `attachments` are image files the runner hands to the CLI in its
2385
+ * native form: Claude Code reads + inlines a base64 image block on
2386
+ * stdin, Codex passes each via `--image`, Gemini references it with
2387
+ * `@path`. Paths must be readable by the daemon process. The runner
2388
+ * caps reads at 32 MB and (on the read/stage paths) verifies the bytes
2389
+ * are a real image by magic signature, deriving `media_type` from
2390
+ * content — non-image / oversized / unreadable paths are skipped, so a
2391
+ * file that isn't an image is never inlined. Adapters whose CLI lacks
2392
+ * image input ignore them.
2393
+ *
2310
2394
  * Returns JSON `InvokeResult`:
2311
2395
  *
2312
2396
  * {
@@ -2316,6 +2400,7 @@ export function agentsHealthExternal(
2316
2400
  * "tool_calls": number, // tool_use blocks observed
2317
2401
  * "duration_ms": number,
2318
2402
  * "total_cost_usd"?: number, // would-be API cost (subscription users don't pay)
2403
+ * "dropped_attachments"?: number, // images dropped (unreadable/oversized/not an image); omitted when 0
2319
2404
  * "is_error": boolean,
2320
2405
  * "error"?: string
2321
2406
  * }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "car-runtime",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "description": "Common Agent Runtime — a deterministic execution layer for AI agents",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",