car-runtime 0.23.0 → 0.24.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/index.d.ts +219 -8
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -57,6 +57,33 @@ export class CarRuntime {
|
|
|
57
57
|
*/
|
|
58
58
|
persistMemory(path: string): Promise<number>;
|
|
59
59
|
|
|
60
|
+
// --- Foreman ---
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Decompose a coding `goal` into a footprint-annotated, scheduled subtask
|
|
64
|
+
* plan. `repo` defaults to the daemon's cwd. Returns a JSON
|
|
65
|
+
* `ForemanPlanReport` (`schema_version`, `valid`, `prefer_single_session`,
|
|
66
|
+
* `levels`, `subtasks[]` with declared `writes`/`reads`).
|
|
67
|
+
*/
|
|
68
|
+
foremanPlan(goal: string, repo?: string, maxAttempts?: number): Promise<string>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Plan a coding `goal`, then farm the subtasks to an external coding CLI
|
|
72
|
+
* (`adapter`, default `"claude-code"`) in isolated git worktrees, gating each
|
|
73
|
+
* worktree and the integrated union. `verifyCommand` is the per-worktree
|
|
74
|
+
* **regression** check; `unionVerifyCommand` is the integrated-union **goal**
|
|
75
|
+
* check (falls back to `verifyCommand` when omitted). **Spends real agent
|
|
76
|
+
* quota.** Returns JSON `{ plan, ran, run? }`.
|
|
77
|
+
*/
|
|
78
|
+
foremanRun(
|
|
79
|
+
goal: string,
|
|
80
|
+
repo?: string,
|
|
81
|
+
adapter?: string,
|
|
82
|
+
verifyCommand?: Array<string>,
|
|
83
|
+
unionVerifyCommand?: Array<string>,
|
|
84
|
+
maxAttempts?: number
|
|
85
|
+
): Promise<string>;
|
|
86
|
+
|
|
60
87
|
// --- Tools & policies ---
|
|
61
88
|
|
|
62
89
|
/** Register a tool by name. */
|
|
@@ -74,11 +101,13 @@ export class CarRuntime {
|
|
|
74
101
|
* `run_id`.
|
|
75
102
|
*
|
|
76
103
|
* `paramsJson` is a serialized request object:
|
|
77
|
-
* `{ intent, agent_id?, agent_name?, outcome_description? }`.
|
|
78
|
-
* `agent_id` is omitted the daemon resolves it from the session's
|
|
104
|
+
* `{ intent, agent_id?, agent_name?, outcome_description?, idempotency_key? }`.
|
|
105
|
+
* When `agent_id` is omitted the daemon resolves it from the session's
|
|
79
106
|
* `agent_id` binding, then `CAR_AGENT_ID`, then a deterministic id
|
|
80
|
-
* synthesized from `agent_name`.
|
|
81
|
-
*
|
|
107
|
+
* synthesized from `agent_name`. An `idempotency_key`, when supplied,
|
|
108
|
+
* becomes the `run_id` and makes the start dedup: if a run with that id
|
|
109
|
+
* already exists the existing run is returned instead of a duplicate.
|
|
110
|
+
* Returns `{ run_id, agent_id }` as a JSON string.
|
|
82
111
|
*/
|
|
83
112
|
runsStart(paramsJson: string): Promise<string>;
|
|
84
113
|
|
|
@@ -390,6 +419,22 @@ export class CarRuntime {
|
|
|
390
419
|
*/
|
|
391
420
|
detokenize(model: string, tokens: number[]): Promise<string>;
|
|
392
421
|
|
|
422
|
+
// --- Web search ---
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Web search. The daemon resolves the backend: the signed-in Parslee
|
|
426
|
+
* account's hosted search when available, else a bring-your-own
|
|
427
|
+
* `TAVILY_API_KEY`. Returns JSON `{ query, source, results: [{title, url,
|
|
428
|
+
* snippet, score, published_date}] }`.
|
|
429
|
+
*/
|
|
430
|
+
search(query: string, maxResults?: number | null): Promise<string>;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Fetch a URL and extract readable text (keyless; companion to `search`).
|
|
434
|
+
* Returns JSON `{ url, status, content_type, title?, text }`.
|
|
435
|
+
*/
|
|
436
|
+
webFetch(url: string): Promise<string>;
|
|
437
|
+
|
|
393
438
|
// --- Speech ---
|
|
394
439
|
|
|
395
440
|
/** Prepare the managed speech runtime and return its root path. */
|
|
@@ -469,6 +514,121 @@ export class CarRuntime {
|
|
|
469
514
|
*/
|
|
470
515
|
recommend(useCase: string, tier: string, cloudOk: boolean): Promise<string>;
|
|
471
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Coder — built-in coding agent (`coder.*` daemon namespace). Sessions
|
|
519
|
+
* live in the daemon and are visible in CarHost. Live `coder.event`
|
|
520
|
+
* streaming is WebSocket-only: call `coder.subscribe` on the daemon's
|
|
521
|
+
* WS directly (same contract as `infer.stream`).
|
|
522
|
+
*
|
|
523
|
+
* Start a session: provisions an isolated git worktree of `repo` and
|
|
524
|
+
* derives a verifiable outcome contract from `intent`. `engine` is
|
|
525
|
+
* `"auto" | "native" | "external[:agent_id]"` (default auto). Returns
|
|
526
|
+
* `{session_id, state, engine, worktree, contract}` JSON.
|
|
527
|
+
*/
|
|
528
|
+
coderStart(
|
|
529
|
+
repo: string,
|
|
530
|
+
intent: string,
|
|
531
|
+
engine?: string | undefined | null,
|
|
532
|
+
maxIterations?: number | undefined | null,
|
|
533
|
+
): Promise<string>;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Confirm the proposed outcome contract (optionally replacing it with
|
|
537
|
+
* the edited `contractJson`) and start the work loop.
|
|
538
|
+
*/
|
|
539
|
+
coderConfirmContract(
|
|
540
|
+
sessionId: string,
|
|
541
|
+
contractJson?: string | undefined | null,
|
|
542
|
+
): Promise<string>;
|
|
543
|
+
|
|
544
|
+
/** List coder sessions (live and persisted), newest first. */
|
|
545
|
+
coderList(): Promise<string>;
|
|
546
|
+
|
|
547
|
+
/** Full session detail, including contract and check results. */
|
|
548
|
+
coderGet(sessionId: string): Promise<string>;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Answer a `user_input_requested` event (reserved — neither engine
|
|
552
|
+
* requests mid-session input yet).
|
|
553
|
+
*/
|
|
554
|
+
coderRespond(sessionId: string, text: string): Promise<string>;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Approve (publish the `car/coder/<id>` branch in the repo) or deny
|
|
558
|
+
* (abandon) a session awaiting merge approval.
|
|
559
|
+
*/
|
|
560
|
+
coderApproveMerge(sessionId: string, approve: boolean): Promise<string>;
|
|
561
|
+
|
|
562
|
+
/** Cancel a session: stop the loop, abandon, remove the worktree. */
|
|
563
|
+
coderCancel(sessionId: string): Promise<string>;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Managed projects + in-daemon declarative agents (the non-developer path).
|
|
567
|
+
*
|
|
568
|
+
* Create (or load) a CAR-managed git-backed project under
|
|
569
|
+
* `~/.car/projects/`. `kind` is `"app"` (code) or `"agent"` (an in-daemon
|
|
570
|
+
* declarative agent). Returns the `CoderProject` JSON.
|
|
571
|
+
*/
|
|
572
|
+
projectCreate(name: string, kind?: string | undefined | null): Promise<string>;
|
|
573
|
+
/** List managed projects, newest first. */
|
|
574
|
+
projectList(): Promise<string>;
|
|
575
|
+
/** One project's metadata by slug. */
|
|
576
|
+
projectGet(slug: string): Promise<string>;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Discover what the signed-in Parslee account can do — identity, m365
|
|
580
|
+
* product entitlements, and Studio reachability. Read-only. Returns JSON.
|
|
581
|
+
*/
|
|
582
|
+
parsleeCapabilities(): Promise<string>;
|
|
583
|
+
/**
|
|
584
|
+
* Generate a Word document from a natural-language brief, saved to the
|
|
585
|
+
* user's connected drive. Gated on the `aie` entitlement. `documentType`
|
|
586
|
+
* defaults to `Report`. Returns JSON `{ file_id, web_url, ... }`.
|
|
587
|
+
*/
|
|
588
|
+
parsleeM365GenerateDocument(contentBrief: string, outputFilePath: string, documentType?: string | undefined | null, title?: string | undefined | null, author?: string | undefined | null): Promise<string>;
|
|
589
|
+
|
|
590
|
+
/** List registered in-daemon declarative agents. */
|
|
591
|
+
declagentList(): Promise<string>;
|
|
592
|
+
/** One declarative agent's spec by id. */
|
|
593
|
+
declagentGet(id: string): Promise<string>;
|
|
594
|
+
/** Unregister a declarative agent. */
|
|
595
|
+
declagentRemove(id: string): Promise<string>;
|
|
596
|
+
/** Enable or disable a declarative agent. */
|
|
597
|
+
declagentSetEnabled(id: string, enabled: boolean): Promise<string>;
|
|
598
|
+
/**
|
|
599
|
+
* Run a declarative agent on an input, in-daemon (no external process).
|
|
600
|
+
* Returns `{ output, turns, tool_calls, error? }` JSON.
|
|
601
|
+
*/
|
|
602
|
+
declagentInvoke(id: string, input: string): Promise<string>;
|
|
603
|
+
/**
|
|
604
|
+
* Route a need to the best-matching declarative agent by capability
|
|
605
|
+
* similarity. Returns `{ chosen, candidates, next_visited, invoked, result? }`
|
|
606
|
+
* JSON. With `invoke: true`, the top agent is run on `need` and its result is
|
|
607
|
+
* included. Network-entry case only; multi-hop Forward chaining (`from` /
|
|
608
|
+
* `visited`) is WS-only.
|
|
609
|
+
*/
|
|
610
|
+
declagentRoute(need: string, invoke: boolean): Promise<string>;
|
|
611
|
+
/**
|
|
612
|
+
* Split a composite need into subtasks and route each to its best-matching
|
|
613
|
+
* agent. Returns `{ subtasks: [{ subtask, chosen, score, result? }], count,
|
|
614
|
+
* invoked }` JSON. `maxSubtasks` caps the split (clamped to [1, 10]; null =
|
|
615
|
+
* default 5). With `invoke: true`, each subtask's chosen agent runs.
|
|
616
|
+
*/
|
|
617
|
+
declagentRouteSplit(need: string, invoke: boolean, maxSubtasks?: number | undefined | null): Promise<string>;
|
|
618
|
+
/**
|
|
619
|
+
* Read-only view of the learned routing topology: per-agent success stats
|
|
620
|
+
* and directed agent→agent edge weights. Returns `{ agents, edges }` JSON.
|
|
621
|
+
*/
|
|
622
|
+
declagentRoutingStats(): Promise<string>;
|
|
623
|
+
/**
|
|
624
|
+
* AgentDNS-style discovery: resolve a natural-language need into ranked
|
|
625
|
+
* CAR-local services, each named under `agentdns://org/category/name`.
|
|
626
|
+
* Returns `{ services: [{ identifier, name, kind, protocol, score,
|
|
627
|
+
* similarity }], count }` JSON. `limit` caps results (clamped to [1, 50];
|
|
628
|
+
* null = default 5).
|
|
629
|
+
*/
|
|
630
|
+
discoveryResolve(need: string, limit?: number | undefined | null): Promise<string>;
|
|
631
|
+
|
|
472
632
|
/**
|
|
473
633
|
* Build a concrete onboarding plan (machine summary, top pick, alternatives,
|
|
474
634
|
* needs-more-memory, note) as JSON.
|
|
@@ -895,6 +1055,15 @@ export interface IntentHint {
|
|
|
895
1055
|
* `prefer_local` if both are set.
|
|
896
1056
|
*/
|
|
897
1057
|
prefer_fast?: boolean;
|
|
1058
|
+
/**
|
|
1059
|
+
* Bias the score profile toward the most capable model — quality
|
|
1060
|
+
* dominates, latency and cost near-floor (maps to
|
|
1061
|
+
* `RoutingWorkload::Quality`). For quality-critical, infrequent work
|
|
1062
|
+
* (building/verifying an agent, deriving a contract, structured
|
|
1063
|
+
* extraction) where a weak model fails. Precedence: `prefer_fast` wins,
|
|
1064
|
+
* then `prefer_quality`, then `prefer_local`.
|
|
1065
|
+
*/
|
|
1066
|
+
prefer_quality?: boolean;
|
|
898
1067
|
}
|
|
899
1068
|
|
|
900
1069
|
// --- Voice streaming (stored-callback pattern) ---
|
|
@@ -1006,6 +1175,27 @@ export function registerToolHandler(
|
|
|
1006
1175
|
*/
|
|
1007
1176
|
export function unregisterToolHandler(): void;
|
|
1008
1177
|
|
|
1178
|
+
/**
|
|
1179
|
+
* Register the callback fired when a tool callback is reaped
|
|
1180
|
+
* (Parslee-ai/car#264). When a `tools.execute` callback exceeds its budget the
|
|
1181
|
+
* daemon emits a `tools.cancel` notification; this callback receives the
|
|
1182
|
+
* reaped call's `requestId` (the same `request_id` surfaced on the originating
|
|
1183
|
+
* `tools.execute` call_json) so the host can abort the in-flight child it
|
|
1184
|
+
* registered under that id (e.g. `AbortController.abort()` / `child.kill()`).
|
|
1185
|
+
*
|
|
1186
|
+
* Fire-and-forget — no return value. Process-wide setter; re-calling
|
|
1187
|
+
* overwrites. Pair with `unregisterToolCancelHandler` to clear.
|
|
1188
|
+
*/
|
|
1189
|
+
export function registerToolCancelHandler(
|
|
1190
|
+
handlerFn: (requestId: string) => void,
|
|
1191
|
+
): void;
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Clear the registered `tools.cancel` handler. Subsequent reaps are no longer
|
|
1195
|
+
* routed to the host (the daemon has already abandoned the call regardless).
|
|
1196
|
+
*/
|
|
1197
|
+
export function unregisterToolCancelHandler(): void;
|
|
1198
|
+
|
|
1009
1199
|
export function transcribeStream(
|
|
1010
1200
|
rt: CarRuntime,
|
|
1011
1201
|
sessionId: string,
|
|
@@ -1717,11 +1907,32 @@ export function agentsStop(id: string, signal?: string | null): Promise<string>;
|
|
|
1717
1907
|
export function agentsRestart(id: string): Promise<string>;
|
|
1718
1908
|
|
|
1719
1909
|
/**
|
|
1720
|
-
* Read
|
|
1721
|
-
*
|
|
1722
|
-
*
|
|
1910
|
+
* Read a window of an agent's logs under
|
|
1911
|
+
* `~/.car/logs/<id>.{stdout,stderr}.log`.
|
|
1912
|
+
*
|
|
1913
|
+
* - `n` caps lines per included stream (default 100; `0` ⇒ whole file,
|
|
1914
|
+
* still bounded by the tail byte ceiling below).
|
|
1915
|
+
* - `stream` selects `"stdout"`, `"stderr"`, or `"combined"` (default).
|
|
1916
|
+
* Each stream is tailed independently, so a long stale stderr can no
|
|
1917
|
+
* longer bury live stdout (Parslee-ai/car#273).
|
|
1918
|
+
* - `offset` pages back: skip this many lines from the end of each
|
|
1919
|
+
* stream before taking the window (`offset = n` ⇒ previous page).
|
|
1920
|
+
* Combined-view paging is not order-preserving — page within a single
|
|
1921
|
+
* stream to scroll back.
|
|
1922
|
+
*
|
|
1923
|
+
* Each stream is read via a bounded backward seek (at most an 8 MiB
|
|
1924
|
+
* tail), not a whole-file slurp, since agent logs are append-only and
|
|
1925
|
+
* never rotated. A log larger than the ceiling is truncated to its last
|
|
1926
|
+
* 8 MiB and `more` is forced `true`.
|
|
1927
|
+
*
|
|
1928
|
+
* Returns JSON `{ lines: string[], stdout: string[], stderr: string[],
|
|
1929
|
+
* stdoutTotal: number, stderrTotal: number, stdoutPath: string,
|
|
1930
|
+
* stderrPath: string, more: boolean }`. `lines` keeps the legacy
|
|
1931
|
+
* stdout-then-stderr combined view for back-compat. `stdoutTotal` /
|
|
1932
|
+
* `stderrTotal` count lines in the scanned tail (exact within the
|
|
1933
|
+
* ceiling).
|
|
1723
1934
|
*/
|
|
1724
|
-
export function agentsTailLog(id: string, n?: number | null): Promise<string>;
|
|
1935
|
+
export function agentsTailLog(id: string, n?: number | null, stream?: string | null, offset?: number | null): Promise<string>;
|
|
1725
1936
|
|
|
1726
1937
|
// --- External-agent detection (car-external-agents) ---
|
|
1727
1938
|
//
|