car-runtime 0.19.0 → 0.21.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 +190 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -65,6 +65,34 @@ export class CarRuntime {
|
|
|
65
65
|
/** Register CAR's built-in agent utility tools. */
|
|
66
66
|
registerAgentBasics(): Promise<void>;
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Start an agent run on the daemon (agent run tracing). Brackets the
|
|
70
|
+
* beginning of a run: the daemon mints a durable `run_id`, resolves
|
|
71
|
+
* the owning `agent_id`, tags it as the session's current run before
|
|
72
|
+
* replying, and records that the run started. Await this before
|
|
73
|
+
* submitting any proposal so the per-turn recorder reads the right
|
|
74
|
+
* `run_id`.
|
|
75
|
+
*
|
|
76
|
+
* `paramsJson` is a serialized request object:
|
|
77
|
+
* `{ intent, agent_id?, agent_name?, outcome_description? }`. When
|
|
78
|
+
* `agent_id` is omitted the daemon resolves it from the session's
|
|
79
|
+
* `agent_id` binding, then `CAR_AGENT_ID`, then a deterministic id
|
|
80
|
+
* synthesized from `agent_name`. Returns `{ run_id, agent_id }` as a
|
|
81
|
+
* JSON string.
|
|
82
|
+
*/
|
|
83
|
+
runsStart(paramsJson: string): Promise<string>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Complete an agent run on the daemon (agent run tracing). Records
|
|
87
|
+
* the terminal `AgentOutcome` for `run_id` and acks. Await this ack
|
|
88
|
+
* before letting the connection close so a healthy run is never
|
|
89
|
+
* mislabeled `Incomplete`.
|
|
90
|
+
*
|
|
91
|
+
* `paramsJson` is a serialized request object: `{ run_id, outcome }`.
|
|
92
|
+
* Returns `{ run_id, ok }` as a JSON string.
|
|
93
|
+
*/
|
|
94
|
+
runsComplete(paramsJson: string): Promise<string>;
|
|
95
|
+
|
|
68
96
|
/**
|
|
69
97
|
* Open a policy-scoping session and return its opaque id. Hosts
|
|
70
98
|
* that drive multiple concurrent agent contexts through one
|
|
@@ -217,6 +245,39 @@ export class CarRuntime {
|
|
|
217
245
|
/** Evolve skills for a domain based on failed events. Returns JSON array. */
|
|
218
246
|
evolveSkills(eventsJson: string, domain: string): Promise<string>;
|
|
219
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Ingest distilled/evolved skills as validation-gated PROVISIONAL candidates
|
|
250
|
+
* on trial (vs `ingestDistilledSkills`, which trusts them active). Returns the
|
|
251
|
+
* count ingested. See docs/solutions/gated-skill-optimization.md.
|
|
252
|
+
*/
|
|
253
|
+
ingestProvisionalSkills(skillsJson: string, tenant?: string | null): number;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Run the skill promotion gate: provisional candidates with enough trial
|
|
257
|
+
* outcomes are promoted (strictly-better Wilson lower bound) or rejected.
|
|
258
|
+
* Returns JSON `{ promoted: string[], rejected: string[] }`.
|
|
259
|
+
*/
|
|
260
|
+
gateSkillCandidates(): Promise<string>;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Fetch a skill's full SkillMeta by key (lifecycle `status`, `incumbent`,
|
|
264
|
+
* `version`, `stats`). Returns JSON SkillMeta, or the string "null" if absent.
|
|
265
|
+
*/
|
|
266
|
+
skillMeta(key: string): Promise<string>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Export a VALIDATED skill as a portable markdown document (the SkillOpt
|
|
270
|
+
* best_skill.md analog). Only Active, healthy skills export. Returns the
|
|
271
|
+
* markdown, or null if the key is absent / not exportable.
|
|
272
|
+
*/
|
|
273
|
+
exportSkill(key: string): Promise<string | null>;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Import a skill from a portable markdown document (digest-verified). Returns
|
|
277
|
+
* true on success; rejects malformed or tampered documents.
|
|
278
|
+
*/
|
|
279
|
+
importSkill(markdown: string): Promise<boolean>;
|
|
280
|
+
|
|
220
281
|
// --- Inference ---
|
|
221
282
|
|
|
222
283
|
/**
|
|
@@ -277,6 +338,15 @@ export class CarRuntime {
|
|
|
277
338
|
*/
|
|
278
339
|
inferTrackedWithRequest(requestJson: string): Promise<string>;
|
|
279
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Build a runnable workflow from a natural-language goal via the daemon's
|
|
343
|
+
* builder. `requestJson` is `{ goal, existing?, max_attempts? }`; on the
|
|
344
|
+
* daemon the catalog (registered tools + models) is authoritative, so the
|
|
345
|
+
* tool cross-check fires. Returns
|
|
346
|
+
* `{ valid, workflow, issues, warnings, attempts }` as JSON.
|
|
347
|
+
*/
|
|
348
|
+
buildWorkflow(requestJson: string): Promise<string>;
|
|
349
|
+
|
|
280
350
|
/**
|
|
281
351
|
* Generate text grounded with memory context from this runtime's
|
|
282
352
|
* memgine. `intentJson` works the same as on {@link infer}.
|
|
@@ -391,6 +461,35 @@ export class CarRuntime {
|
|
|
391
461
|
*/
|
|
392
462
|
registerModel(schemaJson: string): Promise<string>;
|
|
393
463
|
|
|
464
|
+
/**
|
|
465
|
+
* Recommend models for this machine + intent. `useCase`/`tier` are
|
|
466
|
+
* snake_case enum values (e.g. "coding", "most_capable"); `cloudOk` lets
|
|
467
|
+
* cloud models compete. Returns the `RecommendationSet` JSON
|
|
468
|
+
* (`{ picks, notEnoughMemory, note }`).
|
|
469
|
+
*/
|
|
470
|
+
recommend(useCase: string, tier: string, cloudOk: boolean): Promise<string>;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Build a concrete onboarding plan (machine summary, top pick, alternatives,
|
|
474
|
+
* needs-more-memory, note) as JSON.
|
|
475
|
+
*/
|
|
476
|
+
setupPlan(useCase: string, tier: string, cloudOk: boolean): Promise<string>;
|
|
477
|
+
|
|
478
|
+
/** Detect upgrades (curated + upstream, channel-gated). Returns JSON. */
|
|
479
|
+
detectUpgrades(): Promise<string>;
|
|
480
|
+
|
|
481
|
+
/** Current proactive-upgrade decision (poll form). Returns JSON. */
|
|
482
|
+
checkUpgradeNudge(inferenceActive: boolean): Promise<string>;
|
|
483
|
+
|
|
484
|
+
/** Dismiss an upgrade nudge by its `dismissKey` so it never re-fires. */
|
|
485
|
+
dismissUpgrade(dismissKey: string): Promise<string>;
|
|
486
|
+
|
|
487
|
+
/** Get update preferences as JSON. */
|
|
488
|
+
updatePrefsGet(): Promise<string>;
|
|
489
|
+
|
|
490
|
+
/** Set update preferences (JSON `UpdatePreferences` shape). Returns stored prefs JSON. */
|
|
491
|
+
updatePrefsSet(prefsJson: string): Promise<string>;
|
|
492
|
+
|
|
394
493
|
/** Route a prompt. Returns the routing decision as JSON. */
|
|
395
494
|
routeModel(prompt: string): Promise<string>;
|
|
396
495
|
|
|
@@ -568,6 +667,25 @@ export class CarRuntime {
|
|
|
568
667
|
calendarIdsCsv?: string | null,
|
|
569
668
|
): string;
|
|
570
669
|
|
|
670
|
+
/**
|
|
671
|
+
* Create a calendar event. `inputJson` is JSON-encoded
|
|
672
|
+
* `{ calendar_id, title, start, end, all_day?, notes?, location?, url? }`
|
|
673
|
+
* with RFC3339 timestamps. Returns JSON-encoded EventMutationResult.
|
|
674
|
+
*/
|
|
675
|
+
calendarCreateEvent(inputJson: string): string;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Update an existing event. `inputJson` is JSON-encoded
|
|
679
|
+
* `{ event_id, title?, start?, end?, all_day?, notes?, location?, url? }`.
|
|
680
|
+
* Absent fields leave existing values; empty string for
|
|
681
|
+
* notes/location/url clears that field. Returns JSON-encoded
|
|
682
|
+
* EventMutationResult.
|
|
683
|
+
*/
|
|
684
|
+
calendarUpdateEvent(inputJson: string): string;
|
|
685
|
+
|
|
686
|
+
/** Delete an event by host-assigned id. Returns JSON-encoded EventMutationResult. */
|
|
687
|
+
calendarDeleteEvent(eventId: string): string;
|
|
688
|
+
|
|
571
689
|
/** Returns JSON array of contact containers (sources). */
|
|
572
690
|
contactsContainers(): string;
|
|
573
691
|
|
|
@@ -1064,6 +1182,15 @@ export function removeEnrollment(rt: CarRuntime, label: string): string;
|
|
|
1064
1182
|
*/
|
|
1065
1183
|
export function runWorkflow(workflowJson: string): Promise<string>;
|
|
1066
1184
|
|
|
1185
|
+
/**
|
|
1186
|
+
* Resume a workflow that paused at a human-in-the-loop approval gate.
|
|
1187
|
+
* `pausedJson` is the `paused` checkpoint object from a prior `runWorkflow`
|
|
1188
|
+
* (or `resumeWorkflow`) result; `inputJson` is a JSON object of the human's
|
|
1189
|
+
* response fields. Returns the next workflow result JSON, which may itself be
|
|
1190
|
+
* paused again at another gate.
|
|
1191
|
+
*/
|
|
1192
|
+
export function resumeWorkflow(pausedJson: string, inputJson: string): Promise<string>;
|
|
1193
|
+
|
|
1067
1194
|
/** Static analysis on a workflow definition. Returns verification report JSON. */
|
|
1068
1195
|
export function verifyWorkflow(workflowJson: string): string;
|
|
1069
1196
|
|
|
@@ -1254,21 +1381,53 @@ export function registerAgentRunner(
|
|
|
1254
1381
|
// See docs/websocket-protocol.md §"Inference runner" for the wire shape.
|
|
1255
1382
|
// `car-server` is shipped as a binary in this npm package (`bin/car-server`).
|
|
1256
1383
|
|
|
1257
|
-
/**
|
|
1384
|
+
/**
|
|
1385
|
+
* Coordination budget — a runtime-enforced spend ceiling for one multi-agent
|
|
1386
|
+
* run. Passed to the `run*` functions as a JSON string (`JSON.stringify`).
|
|
1387
|
+
* Every field is optional; an omitted field is unbounded.
|
|
1388
|
+
*
|
|
1389
|
+
* The runtime sums the token/cost spend reported by the agent runner and
|
|
1390
|
+
* refuses to START further agents once a limit is crossed (overshoot is bounded
|
|
1391
|
+
* by the in-flight work already launched). `maxAgents` is a hard cap on agents
|
|
1392
|
+
* started. Note: these are snake_case JSON keys, matching the Rust `BudgetLimits`.
|
|
1393
|
+
*
|
|
1394
|
+
* ```ts
|
|
1395
|
+
* const budget = JSON.stringify({ max_total_tokens: 200000, max_agents: 12 });
|
|
1396
|
+
* await runSwarm("parallel", agents, task, null, budget);
|
|
1397
|
+
* ```
|
|
1398
|
+
*/
|
|
1399
|
+
export interface BudgetLimits {
|
|
1400
|
+
max_input_tokens?: number | null;
|
|
1401
|
+
max_output_tokens?: number | null;
|
|
1402
|
+
max_total_tokens?: number | null;
|
|
1403
|
+
max_cost_usd?: number | null;
|
|
1404
|
+
max_agents?: number | null;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/**
|
|
1408
|
+
* Run a Swarm pattern. `mode` is "parallel", "sequential", or "debate".
|
|
1409
|
+
* `budgetSpec` is an optional JSON-encoded {@link BudgetLimits}.
|
|
1410
|
+
*/
|
|
1258
1411
|
export function runSwarm(
|
|
1259
1412
|
mode: string,
|
|
1260
1413
|
agents: string,
|
|
1261
1414
|
task: string,
|
|
1262
1415
|
synthesizerSpec?: string | null,
|
|
1416
|
+
budgetSpec?: string | null,
|
|
1263
1417
|
): Promise<string>;
|
|
1264
1418
|
|
|
1265
|
-
export function runPipeline(
|
|
1419
|
+
export function runPipeline(
|
|
1420
|
+
stages: string,
|
|
1421
|
+
task: string,
|
|
1422
|
+
budgetSpec?: string | null,
|
|
1423
|
+
): Promise<string>;
|
|
1266
1424
|
|
|
1267
1425
|
export function runSupervisor(
|
|
1268
1426
|
workers: string,
|
|
1269
1427
|
supervisor: string,
|
|
1270
1428
|
task: string,
|
|
1271
1429
|
maxRounds: number,
|
|
1430
|
+
budgetSpec?: string | null,
|
|
1272
1431
|
): Promise<string>;
|
|
1273
1432
|
|
|
1274
1433
|
export function runMapReduce(
|
|
@@ -1276,12 +1435,41 @@ export function runMapReduce(
|
|
|
1276
1435
|
reducer: string,
|
|
1277
1436
|
task: string,
|
|
1278
1437
|
items: string,
|
|
1438
|
+
budgetSpec?: string | null,
|
|
1279
1439
|
): Promise<string>;
|
|
1280
1440
|
|
|
1281
1441
|
export function runVote(
|
|
1282
1442
|
agents: string,
|
|
1283
1443
|
task: string,
|
|
1284
1444
|
synthesizerSpec?: string | null,
|
|
1445
|
+
budgetSpec?: string | null,
|
|
1446
|
+
): Promise<string>;
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1449
|
+
* Run a Tournament pattern: rank `competitors` (AgentSpec[] JSON) by
|
|
1450
|
+
* single-elimination pairwise judging with a `judge` (AgentSpec JSON). Returns
|
|
1451
|
+
* TournamentResult JSON ({ winner_name, winner_answer, ranking, matches, ... }).
|
|
1452
|
+
* `budgetSpec` is an optional JSON-encoded {@link BudgetLimits}.
|
|
1453
|
+
*/
|
|
1454
|
+
export function runTournament(
|
|
1455
|
+
competitors: string,
|
|
1456
|
+
judge: string,
|
|
1457
|
+
task: string,
|
|
1458
|
+
budgetSpec?: string | null,
|
|
1459
|
+
): Promise<string>;
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Run an agent that can spawn isolated, tool-constrained sub-agents via the
|
|
1463
|
+
* `spawn_subtask` tool. `mainAgent` is the main AgentSpec JSON; a spawned
|
|
1464
|
+
* sub-agent may only use a subset of its tools (enforced by the tool schema's
|
|
1465
|
+
* `enum` and re-checked at execution). `budgetSpec` is an optional JSON-encoded
|
|
1466
|
+
* {@link BudgetLimits} that also caps the sub-agents this agent may spawn.
|
|
1467
|
+
* Returns SpawnSubtaskResult JSON.
|
|
1468
|
+
*/
|
|
1469
|
+
export function runSubtask(
|
|
1470
|
+
mainAgent: string,
|
|
1471
|
+
task: string,
|
|
1472
|
+
budgetSpec?: string | null,
|
|
1285
1473
|
): Promise<string>;
|
|
1286
1474
|
|
|
1287
1475
|
// --- Scheduler ---
|