car-runtime 0.43.0 → 0.45.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 +67 -6
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -34,6 +34,33 @@
34
34
  */
35
35
 
36
36
  /** Persistent runtime instance with state, memory, tools, and policies. */
37
+ /**
38
+ * Optional settings for `coderStart`. Every field is independently omittable;
39
+ * each falls back to the daemon's `~/.car/coder.toml`.
40
+ *
41
+ * **Breaking (v0.44.0):** replaced five trailing positional optionals — three
42
+ * of them numbers — which callers could silently mis-order.
43
+ */
44
+ export interface CoderStartOptions {
45
+ /** `"auto" | "native" | "external[:agent_id]" | "foreman[:agent_id]"`. */
46
+ engine?: string | undefined | null;
47
+ /** Contract-evaluation rounds before the native loop gives up. */
48
+ maxIterations?: number | undefined | null;
49
+ /** Per-session backbone pin, reaching whichever engine runs. */
50
+ model?: string | undefined | null;
51
+ /**
52
+ * External-engine hypothesis budget: fresh repair invocations after a red
53
+ * pass. Recurrence escalation needs >= 2 to reach the model at all.
54
+ */
55
+ repairInvokes?: number | undefined | null;
56
+ /**
57
+ * External-engine availability budget: re-invocations after the CLI process
58
+ * died mid-run. Separate from `repairInvokes` on purpose — one buys a
59
+ * hypothesis, the other buys a retry.
60
+ */
61
+ transientRetries?: number | undefined | null;
62
+ }
63
+
37
64
  export class CarRuntime {
38
65
  constructor();
39
66
 
@@ -726,12 +753,25 @@ export class CarRuntime {
726
753
  * Unified registry (local + remote). Returns JSON array of
727
754
  * `{ id, name, provider, capabilities, param_count, size_mb,
728
755
  * context_length, available, is_local, max_output_tokens,
729
- * public_benchmarks }`. `max_output_tokens` is the registry-declared
756
+ * public_benchmarks, cost }`. `max_output_tokens` is the registry-declared
730
757
  * per-model output ceiling (`null` when the entry omits it; callers
731
758
  * then fall back to a fraction of `context_length`).
732
759
  * `public_benchmarks` is `[{ name, score, harness?, source_url?,
733
760
  * measured_at? }]` with score on a 0.0–1.0 scale; ships empty in
734
761
  * the built-in catalog and is populated via curated registry data.
762
+ * `cost` is the model's declared prices — `{ input_per_mtok,
763
+ * output_per_mtok, cache_read_input_per_mtok, cache_write_input_per_mtok,
764
+ * pricing_tiers, size_mb, ram_mb }` — in USD per 1M tokens, with
765
+ * `pricing_tiers` as `[{ min_prompt_tokens, ...prices }]` prompt-size
766
+ * overrides (highest threshold not above the prompt wins). Every price is
767
+ * nullable and `null` means **unpriced, not free**: a local model declares
768
+ * no prices, and a caller that reads that as `0` publishes a fabricated
769
+ * cost. The managed `parslee/…` alias rows carry the same prices as the
770
+ * upstream row they front, and this response carries no upstream
771
+ * identifier for them. That holds for this catalog view; `models.search`
772
+ * additionally exposes a `family` field which does name the upstream
773
+ * model family. Older daemons omit
774
+ * `cost` entirely; it deserializes to all-`null` rather than failing.
735
775
  */
736
776
  listModelsUnified(): string;
737
777
 
@@ -845,9 +885,7 @@ export class CarRuntime {
845
885
  coderStart(
846
886
  repo: string,
847
887
  intent: string,
848
- engine?: string | undefined | null,
849
- maxIterations?: number | undefined | null,
850
- model?: string | undefined | null,
888
+ options?: CoderStartOptions | undefined | null,
851
889
  ): Promise<string>;
852
890
 
853
891
  /**
@@ -3266,9 +3304,27 @@ export function agentsTailLog(id: string, n?: number | null, stream?: string | n
3266
3304
  * installed AND ready to use" answer. Returns JSON
3267
3305
  * `[ExternalAgentSpec]` (empty array when nothing installed).
3268
3306
  *
3307
+ * `ExternalAgentSpec.execution` (car#746) is the authoritative answer to
3308
+ * "can this binary run at all":
3309
+ * { state: "runnable" }
3310
+ * | { state: "unusable", reason: string, checked_at: number }
3311
+ * Written by detection, never revised by a health refresh. `health`
3312
+ * answers a different question (is it authenticated) and is owned by
3313
+ * refreshers that may rewrite it. Prefer `execution` over
3314
+ * `health.status === "not_executable"`, which is still emitted for one
3315
+ * compatibility window. An absent `execution` reads as "runnable".
3316
+ *
3269
3317
  * `ExternalAgentSpec.health` shape (when populated):
3270
3318
  * { id, status, details, reason?, checked_at }
3271
- * status: "ready" | "not_configured" | "expired" | "network_error" | "unknown"
3319
+ * status: "ready" | "not_configured" | "expired" | "network_error"
3320
+ * | "not_executable" | "unknown"
3321
+ *
3322
+ * `health` is also populated **without** `includeHealth` in one case:
3323
+ * when detection finds the binary but proves it cannot be executed,
3324
+ * the spec comes back with `status: "not_executable"` and a `reason`
3325
+ * naming the path. Do not invoke a spec in that state — it will be
3326
+ * killed at exec. Typical cause on macOS is Gatekeeper quarantine on
3327
+ * a binary installed outside the App Store.
3272
3328
  *
3273
3329
  * The `auth_kind` field is **deprecated** (Phase 2 stage 1) — modern
3274
3330
  * builds keep credentials in OS keystores so the heuristic falls
@@ -3303,11 +3359,16 @@ export function agentsDetectExternal(
3303
3359
  * {
3304
3360
  * "id": "claude-code" | "codex" | "gemini",
3305
3361
  * "status": "ready" | "not_configured" | "expired" |
3306
- * "network_error" | "unknown",
3362
+ * "network_error" | "not_executable" | "unknown",
3307
3363
  * "details": <tool-specific JSON object>,
3308
3364
  * "reason": <human-readable string when not Ready>,
3309
3365
  * "checked_at": <unix-secs>
3310
3366
  * }
3367
+ *
3368
+ * `not_executable` is set by *detection*, not by an auth-status
3369
+ * command — a binary the OS won't run can't report its own auth
3370
+ * state. It means the install is broken, not that the user is signed
3371
+ * out, so don't prompt for a login flow.
3311
3372
  */
3312
3373
  export function agentsHealthExternal(
3313
3374
  id?: string | null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "car-runtime",
3
- "version": "0.43.0",
3
+ "version": "0.45.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",