car-runtime 0.57.4 → 0.58.0-nightly.20261015

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -138,13 +138,19 @@ main({
138
138
 
139
139
  `runAgent(config, goal)` is also exported for embedding and tests. Pass one
140
140
  long-lived runtime as `config.runtime` to reuse its daemon connection across
141
- runs; otherwise the loop creates and closes a runtime for each call. `serveChat`
141
+ runs; otherwise the loop creates and closes a runtime for each call. The loop
142
+ registers its tools and policies once per daemon session: when that runtime is
143
+ closed and reused, or reconnects after a daemon restart (`connectionEpoch()`
144
+ changes), the next run or `serveChat` chat turn registers them again on the
145
+ new session. `serveChat`
142
146
  uses the same option and returns the runtime it is serving on. Its
143
147
  `AgentOutcome.run_id` is the durable key accepted by `runsGetTrace`; it is
144
148
  `null` when an older daemon has no `runs.*` surface or did not acknowledge the
145
149
  start. `runChatTurn` keeps returning bare text by default; pass
146
150
  `{ includeRunId: true }` as its final options argument to receive
147
- `{ text, run_id }`. `main(config)` provides `--task`, `--json`, and `--serve`.
151
+ `{ text, run_id }`. It registers its tool schemas and `config.policies` on the
152
+ runtime itself, so tool-using turns need no earlier `serveChat` call.
153
+ `main(config)` provides `--task`, `--json`, and `--serve`.
148
154
  The loop adds `finish`, statically verifies every proposal before execution,
149
155
  preserves tool-call/result IDs, honors per-schema `timeoutMs`, traces task and
150
156
  chat runs, and uses request-shaped inference with prompt-cache breakpoints.
package/agent-loop.d.ts CHANGED
@@ -15,6 +15,7 @@ export function runAgent(
15
15
  options?: AgentLoopOptions,
16
16
  ): Promise<AgentOutcome>;
17
17
 
18
+ /** Registers the config's tools and policies on `runtime` before every turn whose `connectionEpoch()` is new. */
18
19
  export function runChatTurn(
19
20
  runtime: CarRuntime,
20
21
  config: AgentLoopConfig,
@@ -27,6 +28,7 @@ export function runChatTurn(
27
28
  options: AgentChatTurnOptions & { includeRunId: true },
28
29
  ): Promise<AgentChatTurnResult>;
29
30
 
31
+ /** Registers the config's tools and policies on `runtime` before every turn whose `connectionEpoch()` is new. */
30
32
  export function runChatTurn(
31
33
  runtime: CarRuntime,
32
34
  config: AgentLoopConfig,
package/agent-loop.js CHANGED
@@ -121,10 +121,13 @@ function makeToolCallback(tools, toolTimeouts = {}, onFinish = null) {
121
121
  // for the entire run;
122
122
  // 2. the LAST tool definition — so identity + every tool schema forms ONE
123
123
  // cached prefix, the largest genuinely stable block this loop has;
124
- // 3. the LAST message — the moving breakpoint. Anthropic serves the longest
125
- // cached prefix it can find, so each turn writes only its own delta and
126
- // READS everything the previous turn wrote. That is what turns quadratic
127
- // re-billing into one write plus N cheap reads.
124
+ // 3. the SECOND-TO-LAST message — the moving breakpoint. Anthropic serves
125
+ // the longest cached prefix it can find, so each turn writes only its own
126
+ // delta and READS everything the previous turn wrote. That is what turns
127
+ // quadratic re-billing into one write plus N cheap reads. Not the last
128
+ // message, because CAR's own assistant loop appends per-turn state to the
129
+ // newest message that the next request re-sends without it; the newest
130
+ // message is billed once at the input rate before it joins the prefix.
128
131
  // The 4th breakpoint is deliberately left unused. It would buy a
129
132
  // `context_stable_prefix` split of the system prompt, which helps only when the
130
133
  // system prompt has a volatile tail; ours has none, so splitting it would
@@ -142,29 +145,48 @@ function makeToolCallback(tools, toolTimeouts = {}, onFinish = null) {
142
145
  // Remember what this package installed so a caller-owned runtime can serve
143
146
  // hundreds of sequential runs without appending the same policy hundreds of
144
147
  // times. Weak keys ensure this bookkeeping never keeps a runtime/socket alive.
148
+ //
149
+ // The bookkeeping is keyed to the connection epoch, not just the object: after
150
+ // `close()`, or a daemon restart the client silently reconnects through, the
151
+ // same runtime talks to a blank daemon session, and remembering the old one's
152
+ // registrations would leave the new session without its tools and policies.
145
153
  const RUNTIME_REGISTRATION = new WeakMap();
154
+ const MAX_SETUP_ATTEMPTS = 3;
155
+
156
+ // A runtime without `connectionEpoch` (a hand-built runtime-shaped object)
157
+ // reports one epoch forever, which is the object-scoped behavior.
158
+ async function connectionEpoch(rt) {
159
+ return typeof rt.connectionEpoch === 'function' ? rt.connectionEpoch() : 0;
160
+ }
146
161
 
147
162
  async function prepareRuntime(rt, toolSchemas, policies) {
148
- let state = RUNTIME_REGISTRATION.get(rt);
149
- if (!state) {
150
- state = { basicsAttempted: false, tools: new Set(), policies: new Set() };
151
- RUNTIME_REGISTRATION.set(rt, state);
152
- }
153
- if (!state.basicsAttempted) {
154
- state.basicsAttempted = true;
155
- try { await rt.registerAgentBasics(); } catch { /* unsupported on this daemon — fine */ }
156
- }
157
- for (const schema of toolSchemas) {
158
- if (state.tools.has(schema.name)) continue;
159
- await rt.registerTool(schema.name);
160
- state.tools.add(schema.name);
161
- }
162
- for (const policy of policies || []) {
163
- const fingerprint = JSON.stringify(policy);
164
- if (state.policies.has(fingerprint)) continue;
165
- await rt.registerPolicy(...policy);
166
- state.policies.add(fingerprint);
163
+ for (let attempt = 0; attempt < MAX_SETUP_ATTEMPTS; attempt++) {
164
+ const epoch = await connectionEpoch(rt);
165
+ let state = RUNTIME_REGISTRATION.get(rt);
166
+ if (!state || state.epoch !== epoch) {
167
+ state = { epoch, basicsAttempted: false, tools: new Set(), policies: new Set() };
168
+ RUNTIME_REGISTRATION.set(rt, state);
169
+ }
170
+ if (!state.basicsAttempted) {
171
+ state.basicsAttempted = true;
172
+ try { await rt.registerAgentBasics(); } catch { /* unsupported on this daemon — fine */ }
173
+ }
174
+ for (const schema of toolSchemas) {
175
+ if (state.tools.has(schema.name)) continue;
176
+ await rt.registerTool(schema.name);
177
+ state.tools.add(schema.name);
178
+ }
179
+ for (const policy of policies || []) {
180
+ const fingerprint = JSON.stringify(policy);
181
+ if (state.policies.has(fingerprint)) continue;
182
+ await rt.registerPolicy(...policy);
183
+ state.policies.add(fingerprint);
184
+ }
185
+ // A reconnect partway through setup put the later registrations on a new
186
+ // session and the earlier ones on a dead one; start that session over.
187
+ if (await connectionEpoch(rt) === epoch) return;
167
188
  }
189
+ throw new Error(`daemon connection reset during agent setup ${MAX_SETUP_ATTEMPTS} times in a row`);
168
190
  }
169
191
 
170
192
  async function closeRuntime(rt) {
@@ -449,6 +471,10 @@ async function runChatTurn(
449
471
  options = {},
450
472
  ) {
451
473
  const { executeProposal } = runtimeApi();
474
+ // A --serve agent outlives daemon restarts and the reconnects they cause, so
475
+ // each turn makes sure the session it lands on has the tools and policies.
476
+ // One epoch read when nothing changed.
477
+ await prepareRuntime(rt, toolSchemas, config.policies);
452
478
  const turnsCap = config.maxTurns ?? 8;
453
479
  const selectedModel = typeof requestedModel === 'string' && requestedModel.trim()
454
480
  ? requestedModel
@@ -2587,7 +2587,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
2587
2587
  "generated": false,
2588
2588
  "name": "fleet_worker_set"
2589
2589
  },
2590
- "role": "operator"
2590
+ "role": "operator_only"
2591
2591
  },
2592
2592
  {
2593
2593
  "javascript": {
@@ -2626,7 +2626,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
2626
2626
  "generated": true,
2627
2627
  "name": "goal_clear"
2628
2628
  },
2629
- "role": "operator"
2629
+ "role": "agent"
2630
2630
  },
2631
2631
  {
2632
2632
  "javascript": {
@@ -2639,7 +2639,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
2639
2639
  "generated": true,
2640
2640
  "name": "goal_set"
2641
2641
  },
2642
- "role": "operator"
2642
+ "role": "agent"
2643
2643
  },
2644
2644
  {
2645
2645
  "javascript": {
@@ -2652,7 +2652,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
2652
2652
  "generated": true,
2653
2653
  "name": "goal_status"
2654
2654
  },
2655
- "role": "operator"
2655
+ "role": "agent"
2656
2656
  },
2657
2657
  {
2658
2658
  "javascript": {
@@ -2665,7 +2665,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
2665
2665
  "generated": true,
2666
2666
  "name": "goal_suggest"
2667
2667
  },
2668
- "role": "operator"
2668
+ "role": "agent"
2669
2669
  },
2670
2670
  {
2671
2671
  "javascript": {
@@ -3055,7 +3055,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
3055
3055
  "generated": true,
3056
3056
  "name": "lattice_claim"
3057
3057
  },
3058
- "role": "operator"
3058
+ "role": "owner"
3059
3059
  },
3060
3060
  {
3061
3061
  "javascript": {
@@ -3068,7 +3068,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
3068
3068
  "generated": true,
3069
3069
  "name": "lattice_claims"
3070
3070
  },
3071
- "role": "operator"
3071
+ "role": "owner"
3072
3072
  },
3073
3073
  {
3074
3074
  "javascript": {
@@ -3198,7 +3198,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
3198
3198
  "generated": true,
3199
3199
  "name": "lattice_find"
3200
3200
  },
3201
- "role": "operator"
3201
+ "role": "owner"
3202
3202
  },
3203
3203
  {
3204
3204
  "javascript": {
@@ -3211,7 +3211,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
3211
3211
  "generated": true,
3212
3212
  "name": "lattice_join"
3213
3213
  },
3214
- "role": "operator"
3214
+ "role": "owner"
3215
3215
  },
3216
3216
  {
3217
3217
  "javascript": {
@@ -3315,7 +3315,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
3315
3315
  "generated": true,
3316
3316
  "name": "lattice_leave"
3317
3317
  },
3318
- "role": "operator"
3318
+ "role": "owner"
3319
3319
  },
3320
3320
  {
3321
3321
  "javascript": {
@@ -3328,7 +3328,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
3328
3328
  "generated": true,
3329
3329
  "name": "lattice_nodes"
3330
3330
  },
3331
- "role": "operator"
3331
+ "role": "owner"
3332
3332
  },
3333
3333
  {
3334
3334
  "javascript": {
@@ -3445,7 +3445,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
3445
3445
  "generated": true,
3446
3446
  "name": "lattice_release"
3447
3447
  },
3448
- "role": "operator"
3448
+ "role": "owner"
3449
3449
  },
3450
3450
  {
3451
3451
  "javascript": {
@@ -3484,7 +3484,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
3484
3484
  "generated": true,
3485
3485
  "name": "lattice_wait"
3486
3486
  },
3487
- "role": "operator"
3487
+ "role": "owner"
3488
3488
  },
3489
3489
  {
3490
3490
  "javascript": {
@@ -4576,7 +4576,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
4576
4576
  "generated": true,
4577
4577
  "name": "multiplayer_abandon"
4578
4578
  },
4579
- "role": "operator"
4579
+ "role": "operator_only"
4580
4580
  },
4581
4581
  {
4582
4582
  "javascript": {
@@ -4589,7 +4589,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
4589
4589
  "generated": true,
4590
4590
  "name": "multiplayer_get"
4591
4591
  },
4592
- "role": "operator"
4592
+ "role": "operator_only"
4593
4593
  },
4594
4594
  {
4595
4595
  "javascript": {
@@ -4602,7 +4602,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
4602
4602
  "generated": true,
4603
4603
  "name": "multiplayer_list"
4604
4604
  },
4605
- "role": "operator"
4605
+ "role": "operator_only"
4606
4606
  },
4607
4607
  {
4608
4608
  "javascript": {
@@ -4615,7 +4615,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
4615
4615
  "generated": true,
4616
4616
  "name": "multiplayer_merge_check"
4617
4617
  },
4618
- "role": "operator"
4618
+ "role": "operator_only"
4619
4619
  },
4620
4620
  {
4621
4621
  "javascript": {
@@ -4628,7 +4628,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
4628
4628
  "generated": true,
4629
4629
  "name": "multiplayer_publish"
4630
4630
  },
4631
- "role": "operator"
4631
+ "role": "operator_only"
4632
4632
  },
4633
4633
  {
4634
4634
  "javascript": {
@@ -4641,7 +4641,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
4641
4641
  "generated": true,
4642
4642
  "name": "multiplayer_start_stage"
4643
4643
  },
4644
- "role": "operator"
4644
+ "role": "operator_only"
4645
4645
  },
4646
4646
  {
4647
4647
  "javascript": {
@@ -4654,7 +4654,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
4654
4654
  "generated": true,
4655
4655
  "name": "multiplayer_submit_stage"
4656
4656
  },
4657
- "role": "operator"
4657
+ "role": "operator_only"
4658
4658
  },
4659
4659
  {
4660
4660
  "javascript": {
@@ -4734,6 +4734,58 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
4734
4734
  },
4735
4735
  "role": "operator"
4736
4736
  },
4737
+ {
4738
+ "javascript": {
4739
+ "generated": true,
4740
+ "name": "openaiCodexAuthCancel"
4741
+ },
4742
+ "method": "openai_codex.auth_cancel",
4743
+ "owner": "HostClient",
4744
+ "python": {
4745
+ "generated": true,
4746
+ "name": "openai_codex_auth_cancel"
4747
+ },
4748
+ "role": "host"
4749
+ },
4750
+ {
4751
+ "javascript": {
4752
+ "generated": true,
4753
+ "name": "openaiCodexAuthStart"
4754
+ },
4755
+ "method": "openai_codex.auth_start",
4756
+ "owner": "HostClient",
4757
+ "python": {
4758
+ "generated": true,
4759
+ "name": "openai_codex_auth_start"
4760
+ },
4761
+ "role": "host"
4762
+ },
4763
+ {
4764
+ "javascript": {
4765
+ "generated": true,
4766
+ "name": "openaiCodexSignOut"
4767
+ },
4768
+ "method": "openai_codex.sign_out",
4769
+ "owner": "HostClient",
4770
+ "python": {
4771
+ "generated": true,
4772
+ "name": "openai_codex_sign_out"
4773
+ },
4774
+ "role": "host"
4775
+ },
4776
+ {
4777
+ "javascript": {
4778
+ "generated": true,
4779
+ "name": "openaiCodexStatus"
4780
+ },
4781
+ "method": "openai_codex.status",
4782
+ "owner": "HostClient",
4783
+ "python": {
4784
+ "generated": true,
4785
+ "name": "openai_codex_status"
4786
+ },
4787
+ "role": "host"
4788
+ },
4737
4789
  {
4738
4790
  "javascript": {
4739
4791
  "generated": true,
@@ -5642,7 +5694,7 @@ const DAEMON_WRAPPER_ROWS = Object.freeze([
5642
5694
  "generated": true,
5643
5695
  "name": "session_bind_sandbox"
5644
5696
  },
5645
- "role": "agent"
5697
+ "role": "operator_only"
5646
5698
  },
5647
5699
  {
5648
5700
  "javascript": {
package/docs/ASSISTANT.md CHANGED
@@ -102,7 +102,7 @@ than no tool.
102
102
  |---|---|
103
103
  | `http_request` | `url`, `method?`, `headers?`, `body?`, `timeout_secs?` (default 30, max 120) |
104
104
  | `web_search` | `query`, `max_results?` |
105
- | `m365_task` | `task`, `conversation_id?` — delegates to the user's Microsoft 365 Parslee AI Employee (email, calendar, contacts, HubSpot CRM, meetings) over one chat call. Mutating actions (send mail, create an event) come back **drafted for approval**, never executed silently. Advertised only with a Parslee session (`car auth login`) |
105
+ | `m365_task` | `task`, `conversation_id?` — delegates to the user's Microsoft 365 Parslee AI Employee (email, calendar, contacts, HubSpot CRM, meetings) over one chat call. Mutating actions (send mail, create an event) come back **drafted for approval**, never executed silently. When the M365 service itself fails the task, the result has `ok: false`, an `error`, and the code to quote to support in `support_code`. Advertised only with a Parslee session (`car auth login`) |
106
106
 
107
107
  These self-declare `"tier": "full_access"`, so — unlike file/shell — they need
108
108
  approval even *inside* the sandbox unless the session was started with
@@ -125,8 +125,10 @@ The capability a text-only coding agent structurally does not have. Two tiers:
125
125
  local models (fast, always-available-if-installed) and Parslee Studio
126
126
  (slower, needs `car auth login`, materially higher quality on some axes).
127
127
 
128
- **Local (`sandbox_edit` tier — no approval needed once the run has edit
129
- permission), advertised only when the matching local model is installed:**
128
+ **Local (`full_access` tier — approval is required unless the run uses
129
+ `--full-access`), advertised only when the matching local model is installed.**
130
+ These generators run through the host process even during a sandboxed session,
131
+ so their artifact writes cross the sandbox boundary:
130
132
 
131
133
  | Tool | Parameters |
132
134
  |---|---|
@@ -179,7 +181,7 @@ nothing for it.
179
181
  | `browse_wait` | `condition` (`"page_loaded"` or `"url_changed"`), `timeout_ms?` (default 5000) |
180
182
  | `browse_observe` | `include_screenshot?`, `ocr?` — screenshot + accessibility tree + a fused `ui_map`; OCR recovers labels a polished SPA's accessibility tree misses |
181
183
  | `browser_await_answer` | `timeout_seconds?` (default 45) — blocks until a page stops changing after you submit something, so you don't screenshot mid-load |
182
- | `browser_await_signin` | `url?`, `success_url_contains?`, `timeout_seconds?` (default 300, max 1800) — asks the human to complete a sign-in the agent can't (SSO, MFA); the session persists afterward |
184
+ | `browser_await_signin` | `url?`, `success_url_contains?`, `timeout_seconds?` (default 300, max 1800) — asks the human to complete a sign-in the agent can't (SSO, MFA); the session persists afterward. `success_url_contains` is matched against the URL without its query string; omitted, the wait ends when the URL leaves a login/SSO page. A start page that already passes the test (the needle matches it, or with no needle it does not look like a login page) is refused, since it cannot tell signed in from not |
183
185
  | `browser_record_start` | `quality?` (JPEG 1–100, default 80) |
184
186
  | `browser_record_stop` | `output_path?` — writes an MP4 (requires ffmpeg), captures only frames where the page actually changed |
185
187
 
@@ -237,17 +239,20 @@ a human:
237
239
  tool is routed to approval whenever its declared tier **exceeds** the run's
238
240
  standing tier. This is why `web_search`, the browser tools, `run_applescript`
239
241
  / `run_powershell`, `m365_task`, the Studio media tools, `remember`, and
240
- `notify_linked_device` all stop for approval inside the *default sandboxed
241
- run* — they declare `full_access`, and the sandbox's standing tier is only
242
- `SandboxEdit`. The local generators (`generate_image`, `generate_speech`)
243
- declare `sandbox_edit`, so they run without asking inside the sandbox but are
244
- gated on an unelevated local run.
242
+ `notify_linked_device`, and the local generators (`generate_image`,
243
+ `generate_speech`) all stop for approval inside the *default sandboxed run* —
244
+ they declare `full_access`, and the sandbox's standing tier is only
245
+ `SandboxEdit`. The generators write artifacts through the host process rather
246
+ than inside the container, so their writes cross the sandbox boundary.
245
247
 
246
248
  **How the human is asked** depends on the surface:
247
249
 
248
250
  - One-shot / REPL (`car do "<goal>"` or `car do`): a terminal prompt —
249
251
  `⚠ Approve <tool>(<brief>)? [y/N]` — reading a single line from stdin.
250
252
  Anything but `y` is a denial with reason `"declined by user"`.
253
+ A run whose needed action was declined, or could not be approved because
254
+ nobody could be asked, ends as not done and exits 1, even when the final
255
+ answer explains it.
251
256
  - `car do --serve` / `agents.chat`: routed through the chat surface's
252
257
  `approval_pending` → park → resolve flow. A connected host can present that
253
258
  same pending approval as a reviewable control rather than a plain
@@ -272,9 +277,11 @@ supervises, not just one `car do` invocation. The three presets are the only
272
277
  accepted values; anything else is rejected before it reaches the daemon.
273
278
 
274
279
  A per-agent posture cannot widen the environment that was actually bound.
275
- **Approve for me** auto-allows `sandbox_edit` actions only when a sandbox exists.
276
- If Docker is unavailable and CAR falls back to the local host (or the run uses
277
- `--local`), shell commands and file edits still ask before they touch the Mac.
280
+ **Approve for me** auto-allows `sandbox_edit` actions only when a sandbox exists
281
+ or the user explicitly starts the run with `--full-access`. If Docker is
282
+ unavailable and CAR falls back to the local host (or the run uses `--local`),
283
+ shell commands and file edits still ask before they touch the Mac unless that
284
+ explicit full-access flag was supplied.
278
285
 
279
286
  ## Memory: what actually persists
280
287
 
@@ -471,7 +478,12 @@ of `summary`, which a failed run does not carry:
471
478
  }
472
479
  ```
473
480
 
474
- - `status` is `"success"` or `"error"`. Branch on it.
481
+ - `status` is one of `"success"`, `"success_substituted"`, `"max_turns"`,
482
+ `"stalled"`, `"error"` or `"auth_required"`. Branch on it, and match the set
483
+ exhaustively rather than assuming it is closed. `"success_substituted"` is an
484
+ answer from a model other than the one the run named, with `substituted_from`
485
+ and `substitution_reason` naming the model it replaced and why; it exits 0
486
+ like `"success"`.
475
487
  - `error` is a stable machine-readable kind (e.g. `AssistantLoopFailed`);
476
488
  `message` is the human-readable detail and is NOT stable enough to match on.
477
489
  - `receipts` is always present, including on failure, and is how you see what
package/docs/CLI.md CHANGED
@@ -18,6 +18,11 @@ and installing other people's agents on your machine. This map groups the
18
18
  commands people actually reach for; the full alphabetical reference with every
19
19
  flag follows below.
20
20
 
21
+ A release-lab build appends its compile-time identity to version output, for
22
+ example `car 0.57.0 (build 20261008-7fdc72e)`. The `car-server`, `car-host`, and
23
+ `car-mcp` binaries report the same ID. Ordinary builds without `CAR_BUILD_ID`
24
+ keep the shorter `name version` form.
25
+
21
26
  ### Run an agent
22
27
 
23
28
  - [`car do`](#car-do) — the general-purpose CAR Assistant. No goal opens an
@@ -664,7 +669,7 @@ Re-score one delivered attempt without starting a coding session
664
669
  Usage: car coder-ab rescore [OPTIONS] --attempt <ATTEMPT> --corpus <CORPUS>
665
670
 
666
671
  Options:
667
- --attempt <ATTEMPT> Existing `<ledger-dir>/artifacts/<task-id>/<attempt>` directory
672
+ --attempt <ATTEMPT> Existing `<ledger-dir>/artifacts/ledgers/<ledger stem>/<task-id>/<attempt>` (or legacy `<ledger-dir>/artifacts/<task-id>/<attempt>`) directory
668
673
  --corpus <CORPUS> Corpus manifest containing the task named by the source ledger row
669
674
  --ledger <LEDGER> Owning ledger. Omit to discover it from the attempt artifact layout
670
675
  -h, --help Print help
@@ -1186,9 +1191,9 @@ Commands:
1186
1191
  both the `everyday` and `local_focused` policies — the same rule `models.list_unified` reports,
1187
1192
  without a machine of each size. Reads a row or an array of rows (as `car models add --dry-run
1188
1193
  --json` prints) from FILE, or stdin. Prints JSON. The verdict is the recommendation estimate
1189
- `models.list_unified` shows, which sizes the KV cache from the parameter count; load-time
1190
- admission uses an installed checkpoint's own KV geometry and the machine's live state, so it can
1191
- differ
1194
+ `models.list_unified` shows, which sizes the KV cache from an installed checkpoint's own KV
1195
+ geometry, as load-time admission does, and from the parameter count for a row not installed;
1196
+ admission also uses the machine's live state, so it can differ
1192
1197
  register Register a custom model from a JSON schema file
1193
1198
  unregister Unregister a model by ID
1194
1199
  stats Show performance stats for models based on observed outcomes
@@ -1430,8 +1435,11 @@ CAR's memory-fit verdict for catalog rows on stated Apple Silicon machines, unde
1430
1435
  `everyday` and `local_focused` policies — the same rule `models.list_unified` reports, without a
1431
1436
  machine of each size. Reads a row or an array of rows (as `car models add --dry-run --json` prints)
1432
1437
  from FILE, or stdin. Prints JSON. The verdict is the recommendation estimate `models.list_unified`
1433
- shows, which sizes the KV cache from the parameter count; load-time admission uses an installed
1434
- checkpoint's own KV geometry and the machine's live state, so it can differ
1438
+ shows, which sizes the KV cache from an installed checkpoint's own KV geometry, as load-time
1439
+ admission does, and from the parameter count for a row not installed; admission also uses the
1440
+ machine's live state, so it can differ. `platform_compatible` is false for a row CAR does not run on
1441
+ Apple Silicon at any size (a GGUF/Candle row, say), and its `smallest_mac_gb` is then null whatever
1442
+ the memory verdict
1435
1443
 
1436
1444
  Usage: car models fit [OPTIONS] [FILE]
1437
1445
 
package/index.d.ts CHANGED
@@ -232,6 +232,14 @@ export class CarRuntime {
232
232
  /** Transport-named alias for `close()`. */
233
233
  disconnect(): Promise<void>;
234
234
 
235
+ /**
236
+ * Identify the daemon session this runtime's calls land on, connecting first
237
+ * if needed. Registered tools, policies and state belong to that session, so
238
+ * a different value than last time (after `close()`, or a daemon restart the
239
+ * client reconnected through) means they must be registered again.
240
+ */
241
+ connectionEpoch(): Promise<number>;
242
+
235
243
  /**
236
244
  * Invoke any daemon JSON-RPC method with a JSON-encoded params value.
237
245
  * `daemonCall` is the call-by-name escape hatch; use the typed wrappers as the primary API.
@@ -240,7 +248,7 @@ export class CarRuntime {
240
248
  */
241
249
  daemonCall(method: string, paramsJson: string): Promise<string>;
242
250
 
243
- /** Host-management-token twin of `daemonCall`; the method allowlist remains enforced. */
251
+ /** Host-management-token twin of `daemonCall`; the method allowlist remains enforced. It admits the owner-gated Coder methods (`coder.respond`, `coder.revise_contract`, `coder.confirm_contract`, `coder.refresh_review`, `coder.approve_merge`, `coder.cancel`), but refuses `coder.confirm_contract` and `coder.approve_merge` on an agent build: building an agent needs the CAR app or `car agent new` in your terminal. */
244
252
  daemonCallHostManagement(method: string, paramsJson: string): Promise<string>;
245
253
 
246
254
  /** List durable permission grants using host-management authority. */
@@ -625,16 +633,16 @@ export class CarRuntime {
625
633
  /** Generated daemon wrapper for `feedback.submit` (operator). */
626
634
  feedbackSubmit(paramsJson: string): Promise<string>;
627
635
 
628
- /** Generated daemon wrapper for `goal.clear` (operator). */
636
+ /** Generated daemon wrapper for `goal.clear` (agent). */
629
637
  goalClear(paramsJson: string): Promise<string>;
630
638
 
631
- /** Generated daemon wrapper for `goal.set` (operator). */
639
+ /** Generated daemon wrapper for `goal.set` (agent). */
632
640
  goalSet(paramsJson: string): Promise<string>;
633
641
 
634
- /** Generated daemon wrapper for `goal.status` (operator). */
642
+ /** Generated daemon wrapper for `goal.status` (agent). */
635
643
  goalStatus(paramsJson: string): Promise<string>;
636
644
 
637
- /** Generated daemon wrapper for `goal.suggest` (operator). */
645
+ /** Generated daemon wrapper for `goal.suggest` (agent). */
638
646
  goalSuggest(paramsJson: string): Promise<string>;
639
647
 
640
648
  /** Generated daemon wrapper for `host.subscribe` (operator). */
@@ -664,28 +672,28 @@ export class CarRuntime {
664
672
  /** Generated daemon wrapper for `inference.runner.fail` (operator). */
665
673
  inferenceRunnerFail(paramsJson: string): Promise<string>;
666
674
 
667
- /** Generated daemon wrapper for `lattice.claim` (operator). */
675
+ /** Generated daemon wrapper for `lattice.claim` (owner). */
668
676
  latticeClaim(paramsJson: string): Promise<string>;
669
677
 
670
- /** Generated daemon wrapper for `lattice.claims` (operator). */
678
+ /** Generated daemon wrapper for `lattice.claims` (owner). */
671
679
  latticeClaims(paramsJson: string): Promise<string>;
672
680
 
673
- /** Generated daemon wrapper for `lattice.find` (operator). */
681
+ /** Generated daemon wrapper for `lattice.find` (owner). */
674
682
  latticeFind(paramsJson: string): Promise<string>;
675
683
 
676
- /** Generated daemon wrapper for `lattice.join` (operator). */
684
+ /** Generated daemon wrapper for `lattice.join` (owner). */
677
685
  latticeJoin(paramsJson: string): Promise<string>;
678
686
 
679
- /** Generated daemon wrapper for `lattice.leave` (operator). */
687
+ /** Generated daemon wrapper for `lattice.leave` (owner). */
680
688
  latticeLeave(paramsJson: string): Promise<string>;
681
689
 
682
- /** Generated daemon wrapper for `lattice.nodes` (operator). */
690
+ /** Generated daemon wrapper for `lattice.nodes` (owner). */
683
691
  latticeNodes(paramsJson: string): Promise<string>;
684
692
 
685
- /** Generated daemon wrapper for `lattice.release` (operator). */
693
+ /** Generated daemon wrapper for `lattice.release` (owner). */
686
694
  latticeRelease(paramsJson: string): Promise<string>;
687
695
 
688
- /** Generated daemon wrapper for `lattice.wait` (operator). */
696
+ /** Generated daemon wrapper for `lattice.wait` (owner). */
689
697
  latticeWait(paramsJson: string): Promise<string>;
690
698
 
691
699
  /** Generated daemon wrapper for `meeting.get` (operator). */
@@ -823,25 +831,25 @@ export class CarRuntime {
823
831
  /** Generated daemon wrapper for `multi.vote` (operator). */
824
832
  multiVote(paramsJson: string): Promise<string>;
825
833
 
826
- /** Generated daemon wrapper for `multiplayer.abandon` (operator). */
834
+ /** Generated daemon wrapper for `multiplayer.abandon` (operator_only). */
827
835
  multiplayerAbandon(paramsJson: string): Promise<string>;
828
836
 
829
- /** Generated daemon wrapper for `multiplayer.get` (operator). */
837
+ /** Generated daemon wrapper for `multiplayer.get` (operator_only). */
830
838
  multiplayerGet(paramsJson: string): Promise<string>;
831
839
 
832
- /** Generated daemon wrapper for `multiplayer.list` (operator). */
840
+ /** Generated daemon wrapper for `multiplayer.list` (operator_only). */
833
841
  multiplayerList(paramsJson: string): Promise<string>;
834
842
 
835
- /** Generated daemon wrapper for `multiplayer.merge_check` (operator). */
843
+ /** Generated daemon wrapper for `multiplayer.merge_check` (operator_only). */
836
844
  multiplayerMergeCheck(paramsJson: string): Promise<string>;
837
845
 
838
- /** Generated daemon wrapper for `multiplayer.publish` (operator). */
846
+ /** Generated daemon wrapper for `multiplayer.publish` (operator_only). */
839
847
  multiplayerPublish(paramsJson: string): Promise<string>;
840
848
 
841
- /** Generated daemon wrapper for `multiplayer.start_stage` (operator). */
849
+ /** Generated daemon wrapper for `multiplayer.start_stage` (operator_only). */
842
850
  multiplayerStartStage(paramsJson: string): Promise<string>;
843
851
 
844
- /** Generated daemon wrapper for `multiplayer.submit_stage` (operator). */
852
+ /** Generated daemon wrapper for `multiplayer.submit_stage` (operator_only). */
845
853
  multiplayerSubmitStage(paramsJson: string): Promise<string>;
846
854
 
847
855
  /** Generated daemon wrapper for `nlp.extract_entities` (operator). */
@@ -967,7 +975,7 @@ export class CarRuntime {
967
975
  /** Generated daemon wrapper for `session.auth` (agent). */
968
976
  sessionAuth(paramsJson: string): Promise<string>;
969
977
 
970
- /** Generated daemon wrapper for `session.bindSandbox` (agent). */
978
+ /** Generated daemon wrapper for `session.bindSandbox` (operator_only). */
971
979
  sessionBindSandbox(paramsJson: string): Promise<string>;
972
980
 
973
981
  /** Generated daemon wrapper for `session.bindSubstrate` (operator). */
@@ -1666,7 +1674,9 @@ export class CarRuntime {
1666
1674
  /**
1667
1675
  * `agents.peers` — visible peers as JSON. Each row distinguishes the
1668
1676
  * kind-level `can_receive` capability from the current `reachable` delivery
1669
- * preflight; the send remains authoritative.
1677
+ * preflight; the send remains authoritative. `{"organization_directory": true}`
1678
+ * adds the colleague directory of the organization this connection is bound
1679
+ * to, from what the CAR already holds.
1670
1680
  */
1671
1681
  agentsPeers(requestJson: string): Promise<string>;
1672
1682
  /** `agents.message` — send text to one peer: `{ to, body, summary? }`. The sender is derived server-side. */
@@ -1769,7 +1779,11 @@ export class CarRuntime {
1769
1779
  * `approved_no_patch` | `rejected_by_gate` | `measurement_failed` |
1770
1780
  * `config_moved_during_measurement` (a graded promotion whose measured base
1771
1781
  * was moved by something else while the replays ran — nothing applied, both
1772
- * values reported, no backoff). When `context_measure` was requested the
1782
+ * values reported, no backoff) | `config_moved_since_diagnosis` (a
1783
+ * human-approved patch whose `conversation_keep_recent` moved after
1784
+ * diagnosis — nothing applied, `diagnosed_under_conversation_keep_recent` and
1785
+ * `current_conversation_keep_recent` reported, no backoff). When
1786
+ * `context_measure` was requested the
1773
1787
  * summary also carries `context_measured: { status: "measured" |
1774
1788
  * "skipped_dry_run", grade_attempts, model, split, split_seed }`.
1775
1789
  *
@@ -2002,9 +2016,11 @@ export class CarRuntime {
2002
2016
  * with reasoning suppressed to produce a direct answer, or
2003
2017
  * `"thinking_truncated"` when even that retry was empty (car-releases#60).
2004
2018
  *
2005
- * `local_last_resort` is present and true ONLY when CAR appended an
2006
- * installed on-device model behind a remote-only chain and that model
2007
- * actually served the turn. An explicitly selected local model is not marked.
2019
+ * `local_last_resort` is present and true ONLY when CAR appended a
2020
+ * model installed through CAR (under CAR's models dir or with an install
2021
+ * receipt; a model only in the shared Hugging Face cache is skipped and
2022
+ * named with `car models adopt`) behind a remote-only chain and that
2023
+ * model actually served the turn. An explicitly selected local model is not marked.
2008
2024
  *
2009
2025
  * `auth_fallback_from` is present ONLY when a candidate earlier in the
2010
2026
  * fallback chain was skipped because its credential was **rejected**
@@ -2164,7 +2180,9 @@ export class CarRuntime {
2164
2180
 
2165
2181
  /**
2166
2182
  * Fetch a URL and extract readable text (keyless; companion to `search`).
2167
- * Returns JSON `{ url, status, content_type, title?, text }`.
2183
+ * Returns JSON `{ url, status, content_type, title?, text }`. Only the
2184
+ * first 8 MiB of the body are read; a longer page's `text` ends in
2185
+ * `…[truncated]…`.
2168
2186
  */
2169
2187
  webFetch(url: string): Promise<string>;
2170
2188
 
@@ -2238,7 +2256,10 @@ export class CarRuntime {
2238
2256
  * weights_ready, downloads_weights,
2239
2257
  * max_output_tokens, public_benchmarks, cost, car_enabled, can_remove,
2240
2258
  * in_use, management_evidence, fit, estimated_peak_mb,
2241
- * platform_compatible, deprecated, family, version }`. `available` means CAR
2259
+ * platform_compatible, deprecated, credential_required,
2260
+ * unavailable_reason, family, version, source_kind }`. `source_kind` is the
2261
+ * row's source `type` tag (`codex_cli`, `remote_api`, `proprietary`, ...),
2262
+ * which keeps two routes to one model apart. `available` means CAR
2242
2263
  * can use the model
2243
2264
  * here — for a local MLX entry with a declared `hf_repo` it is `true`
2244
2265
  * before a byte is fetched, because it lazy-downloads on first use —
@@ -2498,7 +2519,7 @@ export class CarRuntime {
2498
2519
  * JSON may carry `network_approved: true` and
2499
2520
  * `approved_credentials: string[]`. Credential approval is limited to names
2500
2521
  * declared by that exact check; changing its name, command, or declarations
2501
- * drops carried approval.
2522
+ * drops carried approval. Only the agent that started the run or the CAR app may call this; a run a person started also accepts any connection not bound to an agent, and an agent's run also accepts unbound connections when the daemon has no host token. To act on an agent's run with host authority, send the method through the host-management call.
2502
2523
  */
2503
2524
  coderConfirmContract(
2504
2525
  sessionId: string,
@@ -2556,6 +2577,7 @@ export class CarRuntime {
2556
2577
 
2557
2578
  /**
2558
2579
  * Answer a `user_input_requested` event, or queue native steering with steer=true.
2580
+ * Only the agent that started the run or the CAR app may call this; a run a person started also accepts any connection not bound to an agent, and an agent's run also accepts unbound connections when the daemon has no host token. To act on an agent's run with host authority, send the method through the host-management call.
2559
2581
  */
2560
2582
  coderRespond(sessionId: string, text: string): Promise<string>;
2561
2583
  coderRespond(sessionId: string, text: string, steer: boolean | null): Promise<string>;
@@ -2570,7 +2592,7 @@ export class CarRuntime {
2570
2592
  * reply is `{state: "reported", branch: null}`. A plain `approve: true` on
2571
2593
  * a finding, or `acceptFinding` on a diff, is refused. Successful delivery
2572
2594
  * replies include `excluded_artifacts` with the exact records used by the
2573
- * committed staging pass.
2595
+ * committed staging pass. Only the agent that started the run or the CAR app may call this; a run a person started also accepts any connection not bound to an agent, and an agent's run also accepts unbound connections when the daemon has no host token. To act on an agent's run with host authority, send the method through the host-management call.
2574
2596
  */
2575
2597
  coderApproveMerge(
2576
2598
  sessionId: string,
@@ -2596,6 +2618,7 @@ export class CarRuntime {
2596
2618
  * `message` names what already happened. Callers that cancel unconditionally
2597
2619
  * on shutdown depend on that — rejecting would turn a quiet exit into a
2598
2620
  * protocol error whenever the session raced to terminal first.
2621
+ * Only the agent that started the run or the CAR app may call this; a run a person started also accepts any connection not bound to an agent, and an agent's run also accepts unbound connections when the daemon has no host token. To act on an agent's run with host authority, send the method through the host-management call.
2599
2622
  */
2600
2623
  /** `reason` names a non-operator cause and is recorded as `cancelled: <reason>`; omit it only when a person cancelled. */
2601
2624
  coderCancel(sessionId: string, reason?: string | undefined | null): Promise<string>;
@@ -2642,7 +2665,7 @@ export class CarRuntime {
2642
2665
  * Returns `{state: "running", review_refresh: true}`; the outcome arrives on
2643
2666
  * the event stream. Passing checks return the session to `needs_approval`
2644
2667
  * with a new diff; failing checks fail it and keep the worktree. Delivery
2645
- * still needs a separate `coderApproveMerge`.
2668
+ * still needs a separate `coderApproveMerge`. Only the agent that started the run or the CAR app may call this; a run a person started also accepts any connection not bound to an agent, and an agent's run also accepts unbound connections when the daemon has no host token. To act on an agent's run with host authority, send the method through the host-management call.
2646
2669
  */
2647
2670
  coderRefreshReview(sessionId: string): Promise<string>;
2648
2671
 
@@ -2656,7 +2679,7 @@ export class CarRuntime {
2656
2679
  * message}`. **Check `revised` before trusting `contract`**: on a redraft
2657
2680
  * that does not validate, the previous contract comes back byte-identical
2658
2681
  * with `revised: false` and a `message` explaining why, and the daemon emits
2659
- * a `contract_revision_rejected` event.
2682
+ * a `contract_revision_rejected` event. Only the agent that started the run or the CAR app may call this; a run a person started also accepts any connection not bound to an agent, and an agent's run also accepts unbound connections when the daemon has no host token. To act on an agent's run with host authority, send the method through the host-management call.
2660
2683
  */
2661
2684
  coderReviseContract(sessionId: string, request: string): Promise<string>;
2662
2685
 
@@ -2734,6 +2757,10 @@ export class CarRuntime {
2734
2757
  /**
2735
2758
  * Discover what the signed-in Parslee account can do — identity, m365
2736
2759
  * product entitlements, and Studio reachability. Read-only. Returns JSON.
2760
+ * Resolves `{authenticated: false, hint, error?}` when signed out; rejects
2761
+ * with the underlying failure when Parslee could not answer the session
2762
+ * check (a rate limit, an outage, or no session answer) or denied this
2763
+ * signed-in account access (HTTP 403).
2737
2764
  */
2738
2765
  parsleeCapabilities(): Promise<string>;
2739
2766
  /**
@@ -3557,6 +3584,18 @@ export class HostClient {
3557
3584
  /** Generated host wrapper for `models.storage_roots`. */
3558
3585
  modelsStorageRoots(paramsJson: string): Promise<string>;
3559
3586
 
3587
+ /** Generated host wrapper for `openai_codex.auth_cancel`. */
3588
+ openaiCodexAuthCancel(paramsJson: string): Promise<string>;
3589
+
3590
+ /** Generated host wrapper for `openai_codex.auth_start`. */
3591
+ openaiCodexAuthStart(paramsJson: string): Promise<string>;
3592
+
3593
+ /** Generated host wrapper for `openai_codex.sign_out`. */
3594
+ openaiCodexSignOut(paramsJson: string): Promise<string>;
3595
+
3596
+ /** Generated host wrapper for `openai_codex.status`. */
3597
+ openaiCodexStatus(paramsJson: string): Promise<string>;
3598
+
3560
3599
  /** Generated host wrapper for `openrouter.auth_cancel`. */
3561
3600
  openrouterAuthCancel(paramsJson: string): Promise<string>;
3562
3601
 
@@ -4005,7 +4044,22 @@ export interface DispatchVoiceTurnResponse {
4005
4044
 
4006
4045
  export type VoiceTurnEvent =
4007
4046
  | { type: 'voice.turn.fast_delta'; turn_id: number; text: string }
4008
- | { type: 'voice.turn.fast_done'; turn_id: number }
4047
+ | {
4048
+ type: 'voice.turn.fast_done';
4049
+ turn_id: number;
4050
+ /** Present (true) only when the on-device last resort answered the fast track. */
4051
+ local_last_resort?: true;
4052
+ /** The model the request was routed to, when the last resort stood in for it. */
4053
+ substituted_from?: string;
4054
+ /** Why `substituted_from` did not serve. */
4055
+ substitution_reason?:
4056
+ | 'credential_rejected'
4057
+ | 'credential_absent'
4058
+ | 'rate_limited'
4059
+ | 'quota_exhausted'
4060
+ | 'timed_out'
4061
+ | 'failed';
4062
+ }
4009
4063
  | {
4010
4064
  type: 'voice.turn.bridge';
4011
4065
  turn_id: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "car-runtime",
3
- "version": "0.57.4",
3
+ "version": "0.58.0-nightly.20261015",
4
4
  "carProtocolVersion": 3,
5
5
  "description": "Common Agent Runtime — a deterministic execution layer for AI agents",
6
6
  "main": "index.js",