car-runtime 0.20.0 → 0.22.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 +161 -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}.
|
|
@@ -597,6 +667,25 @@ export class CarRuntime {
|
|
|
597
667
|
calendarIdsCsv?: string | null,
|
|
598
668
|
): string;
|
|
599
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
|
+
|
|
600
689
|
/** Returns JSON array of contact containers (sources). */
|
|
601
690
|
contactsContainers(): string;
|
|
602
691
|
|
|
@@ -1093,6 +1182,15 @@ export function removeEnrollment(rt: CarRuntime, label: string): string;
|
|
|
1093
1182
|
*/
|
|
1094
1183
|
export function runWorkflow(workflowJson: string): Promise<string>;
|
|
1095
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
|
+
|
|
1096
1194
|
/** Static analysis on a workflow definition. Returns verification report JSON. */
|
|
1097
1195
|
export function verifyWorkflow(workflowJson: string): string;
|
|
1098
1196
|
|
|
@@ -1283,21 +1381,53 @@ export function registerAgentRunner(
|
|
|
1283
1381
|
// See docs/websocket-protocol.md §"Inference runner" for the wire shape.
|
|
1284
1382
|
// `car-server` is shipped as a binary in this npm package (`bin/car-server`).
|
|
1285
1383
|
|
|
1286
|
-
/**
|
|
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
|
+
*/
|
|
1287
1411
|
export function runSwarm(
|
|
1288
1412
|
mode: string,
|
|
1289
1413
|
agents: string,
|
|
1290
1414
|
task: string,
|
|
1291
1415
|
synthesizerSpec?: string | null,
|
|
1416
|
+
budgetSpec?: string | null,
|
|
1292
1417
|
): Promise<string>;
|
|
1293
1418
|
|
|
1294
|
-
export function runPipeline(
|
|
1419
|
+
export function runPipeline(
|
|
1420
|
+
stages: string,
|
|
1421
|
+
task: string,
|
|
1422
|
+
budgetSpec?: string | null,
|
|
1423
|
+
): Promise<string>;
|
|
1295
1424
|
|
|
1296
1425
|
export function runSupervisor(
|
|
1297
1426
|
workers: string,
|
|
1298
1427
|
supervisor: string,
|
|
1299
1428
|
task: string,
|
|
1300
1429
|
maxRounds: number,
|
|
1430
|
+
budgetSpec?: string | null,
|
|
1301
1431
|
): Promise<string>;
|
|
1302
1432
|
|
|
1303
1433
|
export function runMapReduce(
|
|
@@ -1305,12 +1435,41 @@ export function runMapReduce(
|
|
|
1305
1435
|
reducer: string,
|
|
1306
1436
|
task: string,
|
|
1307
1437
|
items: string,
|
|
1438
|
+
budgetSpec?: string | null,
|
|
1308
1439
|
): Promise<string>;
|
|
1309
1440
|
|
|
1310
1441
|
export function runVote(
|
|
1311
1442
|
agents: string,
|
|
1312
1443
|
task: string,
|
|
1313
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,
|
|
1314
1473
|
): Promise<string>;
|
|
1315
1474
|
|
|
1316
1475
|
// --- Scheduler ---
|