@tangle-network/agent-runtime 0.264.0 → 0.271.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/dist/{activation-Bx4kfVU3.d.ts → activation-BrJmwTLB.d.ts} +4 -4
- package/dist/{activation-DHFdvps3.js → activation-DGbFPGR3.js} +2 -2
- package/dist/{activation-DHFdvps3.js.map → activation-DGbFPGR3.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-Bz-H17bC.js → coordination-driver-iBGMKDvB.js} +90 -50
- package/dist/coordination-driver-iBGMKDvB.js.map +1 -0
- package/dist/{delegate-CwbWhX5W.js → delegate-DOqUvaIz.js} +3 -3
- package/dist/delegate-DOqUvaIz.js.map +1 -0
- package/dist/durable.d.ts +5 -4
- package/dist/durable.js +3 -3
- package/dist/durable.js.map +1 -1
- package/dist/{graph-5NrpTg0h.js → graph-DnMcepkN.js} +12 -7
- package/dist/graph-DnMcepkN.js.map +1 -0
- package/dist/{improvement-cycle-WRWcFyuO.js → improvement-cycle-1IyRJo5h.js} +9 -9
- package/dist/improvement-cycle-1IyRJo5h.js.map +1 -0
- package/dist/{index-9wXpbjbX.d.ts → index-CL1dduJd.d.ts} +123 -73
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +9 -3
- package/dist/intelligence.js +11 -5
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-DC1Lm0nM.js → loop-runner-bin-BPZ9tt1W.js} +3 -3
- package/dist/{loop-runner-bin-DC1Lm0nM.js.map → loop-runner-bin-BPZ9tt1W.js.map} +1 -1
- package/dist/{loop-runner-bin-DPewOZMn.d.ts → loop-runner-bin-O_vM1w8Y.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +12 -6
- package/dist/mcp/index.js +7 -7
- package/dist/mcp/memory-bin.js +1 -1
- package/dist/{memory-server-Cn8LbAxO.js → memory-server-DXQ8IxGR.js} +2 -2
- package/dist/{memory-server-Cn8LbAxO.js.map → memory-server-DXQ8IxGR.js.map} +1 -1
- package/dist/{openai-tools-ByTMUJcD.d.ts → openai-tools-DWHxpwx2.d.ts} +2 -2
- package/dist/profiles.d.ts +2 -2
- package/dist/{provision-supervisor-BZ6_uBGR.js → provision-supervisor-Cy8pqE95.js} +4 -4
- package/dist/{provision-supervisor-BZ6_uBGR.js.map → provision-supervisor-Cy8pqE95.js.map} +1 -1
- package/dist/{runtime-CUZC75EX.js → runtime-DVjIH1eo.js} +1160 -18
- package/dist/runtime-DVjIH1eo.js.map +1 -0
- package/dist/{server-KpdpN627.js → server-CN9vzbSe.js} +4 -4
- package/dist/{server-KpdpN627.js.map → server-CN9vzbSe.js.map} +1 -1
- package/dist/{stream-agent-turn-D1zelVx6.d.ts → stream-agent-turn-DbEsKgb_.d.ts} +200 -3
- package/dist/{structural-rollout-D17I5CwF.js → structural-rollout-I92sIfNl.js} +2 -2
- package/dist/{structural-rollout-D17I5CwF.js.map → structural-rollout-I92sIfNl.js.map} +1 -1
- package/dist/{substrate-qQphD9f0.d.ts → substrate-CbC03Vzo.d.ts} +2 -2
- package/dist/{supervise-_DTVHXPC.js → supervise-DJ_1i9vj.js} +85 -30
- package/dist/supervise-DJ_1i9vj.js.map +1 -0
- package/dist/{supervisor-C26k7X5-.js → supervisor-Cvd5mf7x.js} +1276 -488
- package/dist/supervisor-Cvd5mf7x.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +14 -14
- package/dist/testing.js.map +1 -1
- package/dist/{tool-server-x9NEhvHZ.js → tool-server-Dqer2M4_.js} +30 -12
- package/dist/tool-server-Dqer2M4_.js.map +1 -0
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-BV14WTyW.d.ts → types-Bo7z5aG5.d.ts} +311 -75
- package/package.json +3 -2
- package/dist/coordination-driver-Bz-H17bC.js.map +0 -1
- package/dist/delegate-CwbWhX5W.js.map +0 -1
- package/dist/graph-5NrpTg0h.js.map +0 -1
- package/dist/improvement-cycle-WRWcFyuO.js.map +0 -1
- package/dist/runtime-CUZC75EX.js.map +0 -1
- package/dist/supervise-_DTVHXPC.js.map +0 -1
- package/dist/supervisor-C26k7X5-.js.map +0 -1
- package/dist/tool-server-x9NEhvHZ.js.map +0 -1
|
@@ -1403,6 +1403,30 @@ type BudgetReadout = Readonly<{
|
|
|
1403
1403
|
deadlineMs: number;
|
|
1404
1404
|
reservedTokens: number;
|
|
1405
1405
|
}>;
|
|
1406
|
+
/** The part of each channel a reservation must leave free: a manager's own share of its slice,
|
|
1407
|
+
* which its children may not reserve. */
|
|
1408
|
+
interface ReservationFloor {
|
|
1409
|
+
readonly tokens: number;
|
|
1410
|
+
readonly iterations: number;
|
|
1411
|
+
readonly usd?: number;
|
|
1412
|
+
}
|
|
1413
|
+
/** How a caller asks for a reservation. */
|
|
1414
|
+
interface ReserveOptions {
|
|
1415
|
+
/** Wait for budget instead of failing, when the reservations still open would return enough.
|
|
1416
|
+
* The reservation then holds nothing until it is granted. */
|
|
1417
|
+
readonly wait?: boolean;
|
|
1418
|
+
/** Leave this much of each channel free after the reservation. */
|
|
1419
|
+
readonly keep?: ReservationFloor;
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* A waiting reservation that can never be granted: every open reservation settled and the free
|
|
1423
|
+
* balance still cannot cover it. `shortfalls` are the channels that did not fit at that moment.
|
|
1424
|
+
*/
|
|
1425
|
+
declare class ReservationWaitRefused extends Error {
|
|
1426
|
+
readonly reason: "budget-exhausted";
|
|
1427
|
+
readonly shortfalls: readonly ReservationShortfall[];
|
|
1428
|
+
constructor(shortfalls: readonly ReservationShortfall[]);
|
|
1429
|
+
}
|
|
1406
1430
|
/** Why a reservation was refused. `budget-exhausted` means the pool ran out of a channel it
|
|
1407
1431
|
* budgets; `usd-unbudgeted` means the root declared no dollar ceiling, so a dollar request is
|
|
1408
1432
|
* unsatisfiable at any amount and the fix is to budget the root, not to ask for less. */
|
|
@@ -1420,6 +1444,9 @@ interface ReservationShortfall {
|
|
|
1420
1444
|
readonly channel: 'tokens' | 'iterations' | 'usd' | `resource:${string}`;
|
|
1421
1445
|
readonly requested: number;
|
|
1422
1446
|
readonly free: number;
|
|
1447
|
+
/** What open reservations hold on this channel, when they hold any. A request of at most
|
|
1448
|
+
* `free + held` can wait for them to settle; a larger one never fits. */
|
|
1449
|
+
readonly held?: number;
|
|
1423
1450
|
readonly closedByUnknownSpend?: true;
|
|
1424
1451
|
}
|
|
1425
1452
|
/** State recovered from a prior process before new work is admitted. `committed` is measured spend
|
|
@@ -1435,10 +1462,17 @@ interface BudgetPool {
|
|
|
1435
1462
|
* Atomically reserve a child's full ceiling from the free balance. Fails closed
|
|
1436
1463
|
* ({ ok: false }) when the pool can't cover standard or named channels — the
|
|
1437
1464
|
* caller inspects `ok` before `ticket`.
|
|
1465
|
+
*
|
|
1466
|
+
* With `wait`, a request the free balance cannot cover now, but could once the open reservations
|
|
1467
|
+
* return, is admitted as a WAITING ticket: `granted` resolves when the pool reserves it, and
|
|
1468
|
+
* rejects with {@link ReservationWaitRefused} once nothing open could return enough. A waiting
|
|
1469
|
+
* ticket reserves nothing; reconciling it withdraws it. While any ticket waits, a new waiting
|
|
1470
|
+
* request queues behind it even when it would fit, so the order of asking is the order of grant.
|
|
1438
1471
|
*/
|
|
1439
|
-
reserve(b: Budget, holder?: ReservationHolder): {
|
|
1472
|
+
reserve(b: Budget, holder?: ReservationHolder, options?: ReserveOptions): {
|
|
1440
1473
|
ok: true;
|
|
1441
1474
|
ticket: ReservationTicket;
|
|
1475
|
+
granted?: Promise<void>;
|
|
1442
1476
|
} | {
|
|
1443
1477
|
ok: false;
|
|
1444
1478
|
reason: ReservationRejection;
|
|
@@ -1770,6 +1804,55 @@ type RecoverRetainedRunResult = {
|
|
|
1770
1804
|
readonly environment: AgentEnvironment;
|
|
1771
1805
|
};
|
|
1772
1806
|
//#endregion
|
|
1807
|
+
//#region src/runtime/supervise/worker-slots.d.ts
|
|
1808
|
+
/**
|
|
1809
|
+
* Worker slots: the one bound on how many spawned agents work at the same time.
|
|
1810
|
+
*
|
|
1811
|
+
* Every scope of a supervised tree draws from one allocator. A host that runs several trees in one
|
|
1812
|
+
* process can pass the same allocator to each of them, and the bound then holds across all of them.
|
|
1813
|
+
*
|
|
1814
|
+
* A spawn past the bound is never refused. It keeps its reserved budget slice and waits in a queue,
|
|
1815
|
+
* and it starts when a slot frees. The queue releases the deepest spawn first and then the oldest,
|
|
1816
|
+
* so a subtree that is already paid for finishes before the tree grows wider.
|
|
1817
|
+
*
|
|
1818
|
+
* A slot counts a working agent: a spawned agent that runs with no running child of its own. A
|
|
1819
|
+
* manager whose children are all running is waiting on them, so its first running child takes over
|
|
1820
|
+
* the manager's slot and the manager takes it back when its last running child ends. This makes
|
|
1821
|
+
* nested waits deadlock-free: a manager can always run one child on its own slot, so a queued subtree
|
|
1822
|
+
* always keeps a path to completion, whatever the bound and however deep the tree.
|
|
1823
|
+
*
|
|
1824
|
+
* The bound therefore limits working agents, not environments. The environments alive at one time
|
|
1825
|
+
* can exceed it by the number of managers that have a running child. The conserved budget pool and
|
|
1826
|
+
* the deadline bound the total work; this allocator only bounds how much of it runs at once.
|
|
1827
|
+
*
|
|
1828
|
+
* @experimental
|
|
1829
|
+
*/
|
|
1830
|
+
/** A fleet-wide bound on concurrently working agents, with a queue for the spawns past it. */
|
|
1831
|
+
interface WorkerSlots {
|
|
1832
|
+
/** The bound on working agents, or `undefined` when only the budget bounds concurrency. */
|
|
1833
|
+
readonly max: number | undefined;
|
|
1834
|
+
/** Working agents that hold a slot now. */
|
|
1835
|
+
readonly working: number;
|
|
1836
|
+
/** Spawns that hold a budget slice and wait for a slot. */
|
|
1837
|
+
readonly queued: number;
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* One held or awaited slot. `ready` resolves when the slot is granted; `granted` reads whether it
|
|
1841
|
+
* has been. `release` returns the slot, or withdraws a request that is still queued, and is
|
|
1842
|
+
* idempotent.
|
|
1843
|
+
*/
|
|
1844
|
+
interface SlotPermit {
|
|
1845
|
+
readonly ready: Promise<void>;
|
|
1846
|
+
readonly granted: boolean;
|
|
1847
|
+
release(): void;
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Create a worker-slot allocator. `max` omitted, `0`, or negative leaves concurrency bounded by the
|
|
1851
|
+
* budget alone, and every spawn starts at once. Pass the returned allocator as `workerSlots` to each
|
|
1852
|
+
* run that should share one bound.
|
|
1853
|
+
*/
|
|
1854
|
+
declare function createWorkerSlots(max?: number): WorkerSlots;
|
|
1855
|
+
//#endregion
|
|
1773
1856
|
//#region src/errors.d.ts
|
|
1774
1857
|
/**
|
|
1775
1858
|
*
|
|
@@ -1915,6 +1998,18 @@ declare class RetainedRunDispatchBindingError extends AgentEvalError {
|
|
|
1915
1998
|
});
|
|
1916
1999
|
}
|
|
1917
2000
|
//#endregion
|
|
2001
|
+
//#region src/runtime/supervise/upstream-unavailable.d.ts
|
|
2002
|
+
/** How long an agent waits after its upstream refused a turn for capacity: the codes and
|
|
2003
|
+
* statuses `upstreamUnavailableSignal` reads. A pause is not a failure: a driver spends neither
|
|
2004
|
+
* `maxAttempts` nor `maxConsecutiveFailures` on it. */
|
|
2005
|
+
interface UnavailablePausePolicy {
|
|
2006
|
+
/** The first pause, doubling per consecutive refusal. Default 15000ms. */
|
|
2007
|
+
readonly unavailablePauseMs?: number;
|
|
2008
|
+
/** Ceiling on the doubling. Default 300000ms, so a long outage costs at most twelve turns an
|
|
2009
|
+
* hour. */
|
|
2010
|
+
readonly maxUnavailablePauseMs?: number;
|
|
2011
|
+
}
|
|
2012
|
+
//#endregion
|
|
1918
2013
|
//#region src/runtime/supervise/driver-retry.d.ts
|
|
1919
2014
|
/** The scope's live conserved-pool readout — the retry's real bound. Indexed off `Scope` so this
|
|
1920
2015
|
* module tracks the pool's shape rather than restating it. */
|
|
@@ -1924,7 +2019,7 @@ type DriverBudgetReadout = Scope<unknown>['budget'];
|
|
|
1924
2019
|
type DriverContractState = 'met' | 'unmet' | 'none';
|
|
1925
2020
|
/** How hard the root driver is retried after a transient failure. The defaults retry; a caller
|
|
1926
2021
|
* that wants the pre-#741 behavior sets `enabled: false` and owns the consequence. */
|
|
1927
|
-
interface DriverRetryPolicy {
|
|
2022
|
+
interface DriverRetryPolicy extends UnavailablePausePolicy {
|
|
1928
2023
|
/** `false` restores the historical behavior: the first driver failure ends the run. */
|
|
1929
2024
|
readonly enabled?: boolean;
|
|
1930
2025
|
/** Consecutive failures that changed NOTHING (no metered spend, no settlement, no submission)
|
|
@@ -1938,13 +2033,6 @@ interface DriverRetryPolicy {
|
|
|
1938
2033
|
readonly initialBackoffMs?: number;
|
|
1939
2034
|
/** Ceiling on the doubling. Default 30000ms. */
|
|
1940
2035
|
readonly maxBackoffMs?: number;
|
|
1941
|
-
/** Pause before re-entering after the upstream was unavailable (see
|
|
1942
|
-
* {@link upstreamUnavailableSignal}), doubling per consecutive pause. Default 15000ms. A pause
|
|
1943
|
-
* is not a failure: it consumes neither `maxAttempts` nor `maxConsecutiveFailures`. */
|
|
1944
|
-
readonly unavailablePauseMs?: number;
|
|
1945
|
-
/** Ceiling on the pause doubling. Default 300000ms, so a long outage costs at most twelve
|
|
1946
|
-
* re-entries an hour. */
|
|
1947
|
-
readonly maxUnavailablePauseMs?: number;
|
|
1948
2036
|
}
|
|
1949
2037
|
/** Why the retry loop stopped. `completed` is the only non-failure. */
|
|
1950
2038
|
type DriverAttemptStop = 'completed' | 'terminal-error' | 'retry-disabled' | 'aborted' | 'budget-exhausted' | 'deadline' | 'no-progress' | 'max-attempts';
|
|
@@ -2355,6 +2443,23 @@ interface ExecutorProgress {
|
|
|
2355
2443
|
/** A one-line human-readable state ("turn 3, running tests"). */
|
|
2356
2444
|
readonly note?: string;
|
|
2357
2445
|
}
|
|
2446
|
+
/** The team a worker leads, as its own lead observes it mid-flight: every agent below the worker,
|
|
2447
|
+
* at every depth. A lead reads this instead of the team's raw outputs, so the read stays bounded
|
|
2448
|
+
* however large the team grows. */
|
|
2449
|
+
interface TeamProgress {
|
|
2450
|
+
/** Agents spawned below the worker, at every depth. */
|
|
2451
|
+
readonly agents: number;
|
|
2452
|
+
/** Levels below the worker: `1` when it leads only workers that lead no one. */
|
|
2453
|
+
readonly depth: number;
|
|
2454
|
+
/** Agents below it that hold a worker slot and are running. */
|
|
2455
|
+
readonly working: number;
|
|
2456
|
+
/** Agents below it waiting for a worker slot. */
|
|
2457
|
+
readonly queued: number;
|
|
2458
|
+
/** Agents below it that settled done. */
|
|
2459
|
+
readonly done: number;
|
|
2460
|
+
/** Agents below it that settled down or were cancelled. */
|
|
2461
|
+
readonly down: number;
|
|
2462
|
+
}
|
|
2358
2463
|
/** The full live view of one worker, as `observe_agent` returns it mid-flight. */
|
|
2359
2464
|
interface WorkerProgress {
|
|
2360
2465
|
readonly id: string;
|
|
@@ -2365,9 +2470,11 @@ interface WorkerProgress {
|
|
|
2365
2470
|
* can actually reach it. False means a steer would be recorded and dropped. */
|
|
2366
2471
|
readonly steerable: boolean;
|
|
2367
2472
|
readonly startedAt: number;
|
|
2368
|
-
/** Epoch ms of the last metered usage event or executor-reported activity.
|
|
2473
|
+
/** Epoch ms of the last metered usage event or executor-reported activity. For a worker that
|
|
2474
|
+
* leads a team, the newest activity anywhere in that team counts, its own turns included. */
|
|
2369
2475
|
readonly lastActivityAt: number;
|
|
2370
2476
|
readonly idleMs: number;
|
|
2477
|
+
/** Live, not waiting for a worker slot, and idle past `stallAfterMs`. */
|
|
2371
2478
|
readonly stalled: boolean;
|
|
2372
2479
|
readonly stallAfterMs: number;
|
|
2373
2480
|
/** Metered iterations so far (the executor's own count when it reports one). */
|
|
@@ -2393,6 +2500,8 @@ interface WorkerProgress {
|
|
|
2393
2500
|
* Unlike `recentActivity` this is never evicted, so it still answers on a failed run. */
|
|
2394
2501
|
readonly derived?: ReadonlyArray<string>;
|
|
2395
2502
|
readonly note?: string;
|
|
2503
|
+
/** The team this worker leads; absent while it leads no one. */
|
|
2504
|
+
readonly team?: TeamProgress;
|
|
2396
2505
|
}
|
|
2397
2506
|
/** A bounded newest-last ring of `ActivityNote`s an executor keeps to answer `progress()`. */
|
|
2398
2507
|
interface ActivityLog {
|
|
@@ -2420,6 +2529,8 @@ interface ScopeProgressInput {
|
|
|
2420
2529
|
readonly usd: number;
|
|
2421
2530
|
readonly usdKnown?: boolean;
|
|
2422
2531
|
readonly resources?: Spend['resources'];
|
|
2532
|
+
/** The team the worker leads, when it leads one. */
|
|
2533
|
+
readonly team?: TeamProgress;
|
|
2423
2534
|
}
|
|
2424
2535
|
/** Fold the scope-derived facts and the executor's optional enrichment into one read. Pure: the
|
|
2425
2536
|
* caller supplies `now`, so a test can observe a stall without waiting for one. */
|
|
@@ -2471,10 +2582,22 @@ interface RetainedChildRecovery {
|
|
|
2471
2582
|
kind: 'spawned';
|
|
2472
2583
|
}>;
|
|
2473
2584
|
readonly spec: AgentSpec;
|
|
2585
|
+
/** The node's original task, which its admitted identity digests. */
|
|
2474
2586
|
readonly task: unknown;
|
|
2587
|
+
/** The admissions of the invocation being recovered. */
|
|
2475
2588
|
readonly admissions: readonly RetainedRunAdmission[];
|
|
2476
2589
|
readonly factory: ExecutorFactory<unknown>;
|
|
2477
2590
|
readonly priorMaterialization?: ProfileMaterializationReceipt;
|
|
2591
|
+
/** The invocation being recovered, when it is a leaf's continuation rather than its first. */
|
|
2592
|
+
readonly continuation?: RetainedLeafContinuation;
|
|
2593
|
+
}
|
|
2594
|
+
/** @internal A leaf's later invocation: its own task, input and execution identity, and the
|
|
2595
|
+
* environment admission of the invocation it continues. */
|
|
2596
|
+
interface RetainedLeafContinuation {
|
|
2597
|
+
readonly task: unknown;
|
|
2598
|
+
readonly inputSeq: number;
|
|
2599
|
+
readonly executionId: string;
|
|
2600
|
+
readonly priorSession: RetainedRunEnvironmentAdmission;
|
|
2478
2601
|
}
|
|
2479
2602
|
//#endregion
|
|
2480
2603
|
//#region src/runtime/supervise/trace-source.d.ts
|
|
@@ -2798,18 +2921,45 @@ interface OtelExportConfig {
|
|
|
2798
2921
|
batchSize?: number;
|
|
2799
2922
|
/** Flush interval ms. Default 5000. */
|
|
2800
2923
|
flushIntervalMs?: number;
|
|
2924
|
+
/**
|
|
2925
|
+
* Most spans held at once, queued plus in flight. Default 2048, the OpenTelemetry batch
|
|
2926
|
+
* processor's own default. A span that arrives when the queue is full is dropped and counted in
|
|
2927
|
+
* {@link OtelExportStats.dropped}, so a stalled collector costs a bounded amount of memory.
|
|
2928
|
+
*/
|
|
2929
|
+
maxQueueSize?: number;
|
|
2930
|
+
/** Milliseconds one POST may take before it is abandoned and its spans count as dropped. Default 10000. */
|
|
2931
|
+
timeoutMs?: number;
|
|
2801
2932
|
/** Resource attributes stamped on every export. */
|
|
2802
2933
|
resourceAttributes?: Record<string, string | number | boolean>;
|
|
2803
2934
|
/** Service name. Default 'agent-runtime'. */
|
|
2804
2935
|
serviceName?: string;
|
|
2805
2936
|
}
|
|
2806
2937
|
interface OtelExporter {
|
|
2807
|
-
/** Export a span. */
|
|
2938
|
+
/** Export a span. Never throws: a sink that cannot take the span counts it as dropped. */
|
|
2808
2939
|
exportSpan(span: OtelSpan): void;
|
|
2809
|
-
/**
|
|
2940
|
+
/**
|
|
2941
|
+
* Deliver everything queued so far. Rejects when spans were dropped since the previous `flush`,
|
|
2942
|
+
* naming how many and the last error, because a caller that awaits delivery is owed the answer.
|
|
2943
|
+
*/
|
|
2810
2944
|
flush(): Promise<void>;
|
|
2811
|
-
/**
|
|
2945
|
+
/** Stop accepting spans and deliver what is queued. Never rejects. */
|
|
2812
2946
|
shutdown(): Promise<void>;
|
|
2947
|
+
/** What this sink has delivered and lost so far. */
|
|
2948
|
+
stats(): OtelExportStats;
|
|
2949
|
+
}
|
|
2950
|
+
/**
|
|
2951
|
+
* Delivery accounting for one exporter. `written + dropped + pending` covers every span handed to
|
|
2952
|
+
* `exportSpan`, so a trace that arrives short can be told apart from a run that emitted less.
|
|
2953
|
+
*/
|
|
2954
|
+
interface OtelExportStats {
|
|
2955
|
+
/** Spans the sink confirmed: a 2xx collector response, or a completed file append. */
|
|
2956
|
+
written: number;
|
|
2957
|
+
/** Spans lost: refused by the collector, failed in transit, over the queue bound, or unwritable. */
|
|
2958
|
+
dropped: number;
|
|
2959
|
+
/** Spans accepted and not yet written or dropped. */
|
|
2960
|
+
pending: number;
|
|
2961
|
+
/** The most recent failure, when there has been one. */
|
|
2962
|
+
lastError?: string;
|
|
2813
2963
|
}
|
|
2814
2964
|
interface OtelSpan {
|
|
2815
2965
|
traceId: string;
|
|
@@ -2855,7 +3005,13 @@ interface OtelAttribute {
|
|
|
2855
3005
|
*/
|
|
2856
3006
|
declare function createOpenInferenceFileExporter(filePath: string): OtelExporter;
|
|
2857
3007
|
/**
|
|
2858
|
-
* Create an
|
|
3008
|
+
* Create an OTLP/HTTP exporter. Returns undefined when no endpoint is configured.
|
|
3009
|
+
*
|
|
3010
|
+
* One batch is in flight at a time; spans that arrive meanwhile wait in a queue bounded by
|
|
3011
|
+
* `maxQueueSize`. Every span ends in exactly one of `written` or `dropped`: a non-2xx response, a
|
|
3012
|
+
* network error, a timeout, an OTLP `partialSuccess.rejectedSpans` count and a full queue each count
|
|
3013
|
+
* as drops and set `lastError`. Nothing here throws into the caller's run; `flush()` reports the
|
|
3014
|
+
* loss, the same rule {@link createOpenInferenceFileExporter} follows.
|
|
2859
3015
|
*/
|
|
2860
3016
|
declare function createOtelExporter(config?: OtelExportConfig): OtelExporter | undefined;
|
|
2861
3017
|
/**
|
|
@@ -3883,12 +4039,14 @@ interface Spend {
|
|
|
3883
4039
|
*/
|
|
3884
4040
|
tokensProvenance?: TokenUsageProvenance;
|
|
3885
4041
|
}
|
|
3886
|
-
/** `'
|
|
3887
|
-
*
|
|
4042
|
+
/** `'queued'` is an admitted child that holds its budget slice and waits for a worker slot
|
|
4043
|
+
* (`workerSlots`); it runs nothing until the allocator grants one. `'acquiring'` is first-class
|
|
4044
|
+
* (M1): a node spends real time + reaps an orphan box during sandbox acquire BEFORE it is
|
|
4045
|
+
* `running`, so abort must be defined over it.
|
|
3888
4046
|
* `'waiting'` is first-class for the opposite reason: a wait-state node holds NO executor, NO
|
|
3889
4047
|
* box, and no conserved budget — it is neither in flight nor settled, so neither `inFlight` nor
|
|
3890
4048
|
* a terminal status describes it (see `Scope.wait`). */
|
|
3891
|
-
type NodeStatus = 'pending' | 'acquiring' | 'running' | 'waiting' | 'done' | 'failed' | 'cancelled';
|
|
4049
|
+
type NodeStatus = 'pending' | 'queued' | 'acquiring' | 'running' | 'waiting' | 'done' | 'failed' | 'cancelled';
|
|
3892
4050
|
/** Deterministic node id — `${parent}:s${seq}` from the cursor order, never wall-clock. */
|
|
3893
4051
|
type NodeId = string;
|
|
3894
4052
|
interface SpawnOpts {
|
|
@@ -3904,10 +4062,14 @@ interface SpawnOpts {
|
|
|
3904
4062
|
* idempotent per key: once a child spawned under a key settles `done` — in this process or in a
|
|
3905
4063
|
* journaled prior one — spawning the same key returns that committed result (`prior.state:
|
|
3906
4064
|
* 'completed'`) instead of paying for the work again. A key whose prior attempt settled `down`
|
|
3907
|
-
* spawns fresh and says so explicitly (`prior.state: 'retried'`)
|
|
3908
|
-
*
|
|
3909
|
-
*
|
|
3910
|
-
*
|
|
4065
|
+
* spawns fresh and says so explicitly (`prior.state: 'retried'`); a resume DERIVES that same
|
|
4066
|
+
* `down` for an interrupted `inline` attempt, because an in-process execution cannot outlive
|
|
4067
|
+
* its process — so a worker killed mid-flight under a plain in-process executor retries under
|
|
4068
|
+
* its own key instead of wedging. A key whose un-settled prior attempt may still exist
|
|
4069
|
+
* elsewhere (`sandbox`/`cli`/`router` runtimes) is refused (`'in-doubt'`): the remote execution
|
|
4070
|
+
* may still be running and must be recovered before replacement. A key that is currently LIVE
|
|
4071
|
+
* is refused (`'duplicate-key'`). Unkeyed spawns (the default) are position-identified and
|
|
4072
|
+
* always run.
|
|
3911
4073
|
*/
|
|
3912
4074
|
readonly key?: string;
|
|
3913
4075
|
/** The settled sibling node this spawn replaces, so a run's record names which worker took over
|
|
@@ -3928,7 +4090,7 @@ interface SpawnOpts {
|
|
|
3928
4090
|
* run, its driver simply finished. A caller that outlived the request it was serving (a background
|
|
3929
4091
|
* tool invocation still holding the driver's verbs) gets a refusal it can record, instead of a
|
|
3930
4092
|
* child nobody joins. */
|
|
3931
|
-
type SpawnRejection = 'budget-exhausted' | 'usd-unbudgeted' | 'depth-exceeded' | 'duplicate-key' | 'in-doubt' | 'invalid-identity' | 'key-conflict' | '
|
|
4093
|
+
type SpawnRejection = 'budget-exhausted' | 'usd-unbudgeted' | 'depth-exceeded' | 'duplicate-key' | 'in-doubt' | 'invalid-identity' | 'key-conflict' | 'scope-aborted' | 'scope-settled';
|
|
3932
4094
|
/**
|
|
3933
4095
|
* What a KEYED spawn resolved to when the key had a prior attempt. Absent on a fresh key (and on
|
|
3934
4096
|
* every unkeyed spawn). `'completed'` is the exactly-once path: NOTHING was spawned — the handle
|
|
@@ -3993,6 +4155,8 @@ type Settled<Out> = {
|
|
|
3993
4155
|
harnessTranscript?: HarnessTranscriptEvidence;
|
|
3994
4156
|
/** Present when the measured spend exceeded this child's reservation. */
|
|
3995
4157
|
budgetViolation?: BudgetViolation;
|
|
4158
|
+
/** Present when this child led workers of its own: a bounded account of its team. */
|
|
4159
|
+
subtree?: SubtreeSummary;
|
|
3996
4160
|
/** Epoch ms parsed from the durable settlement record when available. */
|
|
3997
4161
|
settledAt?: number;
|
|
3998
4162
|
seq: number;
|
|
@@ -4022,8 +4186,9 @@ type Settled<Out> = {
|
|
|
4022
4186
|
budgetViolation?: BudgetViolation;
|
|
4023
4187
|
/** Present only when this child's provider execution was RETAINED (see
|
|
4024
4188
|
* `RetainedExecutionState`); absent on an ordinary down. `'pending'` on the settlement the
|
|
4025
|
-
* driver receives at the reconcile; `'released'`
|
|
4026
|
-
*
|
|
4189
|
+
* driver receives at the reconcile; `'released'` or `'release-unconfirmed'` on the
|
|
4190
|
+
* replayed settlement of a node a final settlement closed. The driver and every replay
|
|
4191
|
+
* reader see the fact the journal
|
|
4027
4192
|
* states, so a reader never splits this population on `reason` text — which is identical
|
|
4028
4193
|
* on every one of these children. */
|
|
4029
4194
|
retainedExecution?: RetainedExecutionState;
|
|
@@ -4033,10 +4198,47 @@ type Settled<Out> = {
|
|
|
4033
4198
|
* `retainedExecution` is; the `reason` text names the same thing, but a reader must never
|
|
4034
4199
|
* have to parse it (#1204). */
|
|
4035
4200
|
retainedPendingCause?: RetainedPendingCause;
|
|
4201
|
+
/** Present when this child led workers of its own: a bounded account of its team. */
|
|
4202
|
+
subtree?: SubtreeSummary;
|
|
4036
4203
|
/** Epoch ms parsed from the durable settlement/cancellation record when available. */
|
|
4037
4204
|
settledAt?: number;
|
|
4038
4205
|
seq: number;
|
|
4039
4206
|
};
|
|
4207
|
+
/**
|
|
4208
|
+
* A bounded account of the team a manager led, carried up on its settlement.
|
|
4209
|
+
*
|
|
4210
|
+
* A lead reads its children's summaries instead of every descendant's output: the counts cover
|
|
4211
|
+
* the whole subtree, and `results` lists only the manager's own direct children, best first.
|
|
4212
|
+
* Every listed result stays addressable by its content address (`outRef`), so the lead can read
|
|
4213
|
+
* any one of them in full. The summary is bounded at every level, so a tree of hundreds of agents
|
|
4214
|
+
* reaches its root as a handful of summaries.
|
|
4215
|
+
*/
|
|
4216
|
+
interface SubtreeSummary {
|
|
4217
|
+
/** Spawned agents below this node, at every depth. */
|
|
4218
|
+
readonly agents: number;
|
|
4219
|
+
/** Levels below this node: `1` when it led only workers that led no one. */
|
|
4220
|
+
readonly depth: number;
|
|
4221
|
+
/** Agents below this node that settled done. */
|
|
4222
|
+
readonly done: number;
|
|
4223
|
+
/** Agents below this node that settled down or were cancelled. */
|
|
4224
|
+
readonly down: number;
|
|
4225
|
+
/** This node's own direct children, done before down and then by score, at most
|
|
4226
|
+
* `SUBTREE_RESULT_LIMIT` of them. */
|
|
4227
|
+
readonly results: ReadonlyArray<SubtreeResult>;
|
|
4228
|
+
/** Direct children not listed in `results`. */
|
|
4229
|
+
readonly omitted: number;
|
|
4230
|
+
}
|
|
4231
|
+
/** One direct child of a manager, as its lead sees it in a {@link SubtreeSummary}. */
|
|
4232
|
+
interface SubtreeResult {
|
|
4233
|
+
readonly id: NodeId;
|
|
4234
|
+
readonly label: string;
|
|
4235
|
+
readonly status: 'done' | 'down';
|
|
4236
|
+
/** Content address of the child's retained output, when it produced one. */
|
|
4237
|
+
readonly outRef?: string;
|
|
4238
|
+
readonly score?: number;
|
|
4239
|
+
/** Agents in this child's own subtree, itself excluded. */
|
|
4240
|
+
readonly agents: number;
|
|
4241
|
+
}
|
|
4040
4242
|
/**
|
|
4041
4243
|
* The budget-conserving reactive scope an `Agent.act` runs inside. `spawn` reserves
|
|
4042
4244
|
* budget atomically from the shared pool and fails closed when the pool cannot cover it.
|
|
@@ -4181,12 +4383,14 @@ interface Scope<Out> {
|
|
|
4181
4383
|
readonly view: TreeView;
|
|
4182
4384
|
/** Conserved-pool readouts (post-reservation). */
|
|
4183
4385
|
readonly budget: BudgetReadout;
|
|
4184
|
-
/**
|
|
4185
|
-
* the
|
|
4186
|
-
*
|
|
4187
|
-
*
|
|
4386
|
+
/** The worker-slot allocator as this scope sees it. Every scope of a tree, and every tree that
|
|
4387
|
+
* shares the allocator, reads the same counts; the root agent itself holds no slot. `working`
|
|
4388
|
+
* counts agents that hold a slot, `queued` counts admitted spawns that wait for one, and
|
|
4389
|
+
* `freeSlots` is `null` when no bound is set. `unconfirmed` NAMES this scope's settled children
|
|
4390
|
+
* whose executor teardown was never acknowledged. Empty on every healthy run. */
|
|
4188
4391
|
readonly workerCapacity: Readonly<{
|
|
4189
|
-
|
|
4392
|
+
working: number;
|
|
4393
|
+
queued: number;
|
|
4190
4394
|
freeSlots: number | null;
|
|
4191
4395
|
unconfirmed: ReadonlyArray<UnconfirmedTeardown>;
|
|
4192
4396
|
}>;
|
|
@@ -4253,8 +4457,12 @@ interface ResumedKeyState<Out = unknown> {
|
|
|
4253
4457
|
/** Identity recorded when this key was first admitted. Every reuse must match it exactly. */
|
|
4254
4458
|
readonly identity?: NodeExecutionIdentity;
|
|
4255
4459
|
readonly state: 'completed' | 'down' | 'in-doubt';
|
|
4256
|
-
/** The rehydrated settlement; absent
|
|
4460
|
+
/** The rehydrated settlement; absent when `state` is `'in-doubt'`, and when `'down'` was
|
|
4461
|
+
* *derived* — the resume itself proved the execution dead (an `inline` runtime cannot outlive
|
|
4462
|
+
* its process), so there is no settlement to rehydrate and `reason` says how it died. */
|
|
4257
4463
|
readonly settled?: Settled<Out>;
|
|
4464
|
+
/** Why a derived `'down'` state exists. Absent on every state backed by a settlement. */
|
|
4465
|
+
readonly reason?: string;
|
|
4258
4466
|
}
|
|
4259
4467
|
interface NodeSnapshot {
|
|
4260
4468
|
readonly id: NodeId;
|
|
@@ -4301,10 +4509,10 @@ interface NodeSnapshot {
|
|
|
4301
4509
|
readonly trace?: WorkerTraceEvidence;
|
|
4302
4510
|
/** Present once a settled node's measured spend exceeded its reservation. */
|
|
4303
4511
|
readonly budgetViolation?: BudgetViolation;
|
|
4304
|
-
/** Present on a retained child: `'pending'` while its cursor slot is open, `'released'`
|
|
4305
|
-
*
|
|
4306
|
-
* (`materializeTreeView`) state the same fact, so a settle record's
|
|
4307
|
-
* retained-vs-down question without the observer journal. */
|
|
4512
|
+
/** Present on a retained child: `'pending'` while its cursor slot is open, `'released'` or
|
|
4513
|
+
* `'release-unconfirmed'` once a final settlement closed it. The live view (`makeTreeView`)
|
|
4514
|
+
* and the journal view (`materializeTreeView`) state the same fact, so a settle record's
|
|
4515
|
+
* `tree` answers the retained-vs-down question without the observer journal. */
|
|
4308
4516
|
readonly retainedExecution?: RetainedExecutionState;
|
|
4309
4517
|
/** Why a retained child has no accepted result; see `RetainedPendingCause`. */
|
|
4310
4518
|
readonly retainedPendingCause?: RetainedPendingCause;
|
|
@@ -4313,7 +4521,7 @@ interface NodeSnapshot {
|
|
|
4313
4521
|
interface TreeView {
|
|
4314
4522
|
readonly root: NodeId;
|
|
4315
4523
|
readonly nodes: ReadonlyArray<NodeSnapshot>;
|
|
4316
|
-
/** Count of nodes in `
|
|
4524
|
+
/** Count of nodes in `queued`, `acquiring`, or `running` — the "what's in flow?" answer. */
|
|
4317
4525
|
readonly inFlight: number;
|
|
4318
4526
|
/** Count of nodes in `waiting` — armed wait-states. Deliberately NOT folded into `inFlight`:
|
|
4319
4527
|
* a wait burns no executor and no budget, so counting it as flow would misreport both idle
|
|
@@ -4336,12 +4544,10 @@ type SpawnEvent = {
|
|
|
4336
4544
|
successorOf?: NodeId;
|
|
4337
4545
|
budget: Budget;
|
|
4338
4546
|
runtime: Runtime;
|
|
4339
|
-
/** Root-only opt-in
|
|
4340
|
-
*
|
|
4547
|
+
/** Root-only opt-in owner-share contract. A resumed run must use the same policy; absent on
|
|
4548
|
+
* records that set none. */
|
|
4341
4549
|
recursiveAdmission?: {
|
|
4342
4550
|
policy: RecursiveReservationPolicy;
|
|
4343
|
-
maxDepth: number;
|
|
4344
|
-
maxLiveWorkers: number;
|
|
4345
4551
|
};
|
|
4346
4552
|
/** Exact nested journal tree this node owns. Runtime writes this only after privately
|
|
4347
4553
|
* attesting the executor as a recursive scope owner. Its absence means no tree is followed,
|
|
@@ -4421,13 +4627,15 @@ type SpawnEvent = {
|
|
|
4421
4627
|
harnessTranscript?: HarnessTranscriptEvidence;
|
|
4422
4628
|
/** Present when the reconciled spend exceeded the reservation, on either status. */
|
|
4423
4629
|
budgetViolation?: BudgetViolation;
|
|
4424
|
-
/**
|
|
4425
|
-
* `environment-teardown` receipt for the node reads `destroyed: true` and the
|
|
4426
|
-
* own teardown confirmed — or by `healReleasedSlots` on the next resume, when
|
|
4427
|
-
* died between the last `destroyed: true` receipt and this record: the same
|
|
4428
|
-
* and `at`, read from the `reconciled` record, so the bytes are identical
|
|
4429
|
-
*
|
|
4430
|
-
*
|
|
4630
|
+
/** `'released'` is written by the release sweep in the settling process, on the same tree,
|
|
4631
|
+
* after every `environment-teardown` receipt for the node reads `destroyed: true` and the
|
|
4632
|
+
* executor's own teardown confirmed — or by `healReleasedSlots` on the next resume, when
|
|
4633
|
+
* that process died between the last `destroyed: true` receipt and this record: the same
|
|
4634
|
+
* builder, `seq` and `at`, read from the `reconciled` record, so the bytes are identical
|
|
4635
|
+
* either way. `'release-unconfirmed'` is written by the same builder at the end of a final
|
|
4636
|
+
* settlement for every retained node the release could not confirm: a `destroyed: false`
|
|
4637
|
+
* receipt, an empty receipt set, or a refused teardown probe. Only a crash before that point
|
|
4638
|
+
* or a `reconciled` record without `settledSeq` leaves the slot open.
|
|
4431
4639
|
* `spent` is this node's child-work component of the reconcile the pool committed — for
|
|
4432
4640
|
* a leaf the streamed floor itself, for a recursive executor its `accounting().reported`
|
|
4433
4641
|
* split with the remainder on its `metered` records — never the reservation ceiling.
|
|
@@ -4436,8 +4644,10 @@ type SpawnEvent = {
|
|
|
4436
4644
|
* delivery, so replay yields it at the position the driver saw it; `at` is the settlement
|
|
4437
4645
|
* instant, and the release instant is on the receipt immediately before it. Typed so a
|
|
4438
4646
|
* `'pending'` can never be journaled: the journal states that as `reconciled`. */
|
|
4439
|
-
retainedExecution?:
|
|
4647
|
+
retainedExecution?: Exclude<RetainedExecutionState, 'pending'>;
|
|
4440
4648
|
retainedPendingCause?: RetainedPendingCause;
|
|
4649
|
+
/** The bounded account of the team this child led, when it led one. */
|
|
4650
|
+
subtree?: SubtreeSummary;
|
|
4441
4651
|
seq: number;
|
|
4442
4652
|
at: string;
|
|
4443
4653
|
} | {
|
|
@@ -4456,8 +4666,10 @@ type SpawnEvent = {
|
|
|
4456
4666
|
budgetViolation?: BudgetViolation;
|
|
4457
4667
|
/** As on `settled`: a retained child that was cancelled settles `cancelled`, and the one
|
|
4458
4668
|
* builder writes whichever kind the settlement had. */
|
|
4459
|
-
retainedExecution?:
|
|
4669
|
+
retainedExecution?: Exclude<RetainedExecutionState, 'pending'>;
|
|
4460
4670
|
retainedPendingCause?: RetainedPendingCause;
|
|
4671
|
+
/** The bounded account of the team this child led, when it led one. */
|
|
4672
|
+
subtree?: SubtreeSummary;
|
|
4461
4673
|
seq: number;
|
|
4462
4674
|
at: string;
|
|
4463
4675
|
} | {
|
|
@@ -4561,12 +4773,14 @@ type SpawnEvent = {
|
|
|
4561
4773
|
* observed, while its cursor slot stays OPEN so a resume can recover the execution. It stands
|
|
4562
4774
|
* in for the `settled` record an open node cannot carry: cost readers and a restored pool
|
|
4563
4775
|
* charge this floor for the node instead of its declared ceiling, and a later `settled` or
|
|
4564
|
-
* `cancelled` record for the same node supersedes it. That record has
|
|
4776
|
+
* `cancelled` record for the same node supersedes it. That record has four writers: a
|
|
4565
4777
|
* resumed process's recovered settlement, the release sweep's terminal record marked
|
|
4566
|
-
* `retainedExecution: 'released'`,
|
|
4567
|
-
*
|
|
4568
|
-
*
|
|
4569
|
-
*
|
|
4778
|
+
* `retainedExecution: 'released'`, the final settlement's record marked
|
|
4779
|
+
* `'release-unconfirmed'` for a node whose release it could not confirm, or
|
|
4780
|
+
* `healReleasedSlots` on the next resume when the process died between the last
|
|
4781
|
+
* `environment-teardown` receipt and the released record. The last three carry the same
|
|
4782
|
+
* settlement, because each reads it from THIS record or from the live child it mirrors: it
|
|
4783
|
+
* is literally the settlement it stands in for, minus the cursor position it cannot hold. A
|
|
4570
4784
|
* driver's own inference travels on its `metered` record as on every other path, so
|
|
4571
4785
|
* `reconciled + metered` is what the pool committed. Its `seq` lives outside the
|
|
4572
4786
|
* cursor-uniqueness namespace; `settledSeq` is the cursor seq. */
|
|
@@ -4668,8 +4882,10 @@ type SpawnEvent = {
|
|
|
4668
4882
|
* terminal `settled`/`cancelled` record with `retainedExecution: 'released'` follows on
|
|
4669
4883
|
* the same tree and closes the cursor slot; when the settling process dies between this
|
|
4670
4884
|
* receipt and that record, `healReleasedSlots` writes the same record on the next resume
|
|
4671
|
-
* from the `reconciled` record.
|
|
4672
|
-
* unconfirmed teardown
|
|
4885
|
+
* from the `reconciled` record. After a `destroyed: false` receipt, an empty receipt set, or
|
|
4886
|
+
* an unconfirmed teardown, the environment may still exist: the node is journaled as
|
|
4887
|
+
* `teardown-unconfirmed`, and its slot closes with `retainedExecution:
|
|
4888
|
+
* 'release-unconfirmed'` instead, because the settlement is final either way.
|
|
4673
4889
|
* Informational: replay, `materializeTreeView`, and cost readers skip it, and its `seq` is
|
|
4674
4890
|
* per node, outside the cursor-uniqueness namespace. */
|
|
4675
4891
|
kind: 'environment-teardown';
|
|
@@ -4780,8 +4996,7 @@ interface Supervisor<Task, Out> {
|
|
|
4780
4996
|
attach(h: RootHandle<Out>): void;
|
|
4781
4997
|
}
|
|
4782
4998
|
/** Optional recursive admission policy. `ownerShare` is the fraction of every manager's budget
|
|
4783
|
-
* kept free for its own inference while children hold their
|
|
4784
|
-
* policy reserves one live worker slot per remaining depth, up to `maxDepth`. */
|
|
4999
|
+
* kept free for its own inference while children hold their declared slices. */
|
|
4785
5000
|
interface RecursiveReservationPolicy {
|
|
4786
5001
|
readonly ownerShare: number;
|
|
4787
5002
|
}
|
|
@@ -4807,13 +5022,16 @@ interface SupervisorOpts {
|
|
|
4807
5022
|
* the wait can be journaled and re-armed by a later process; this is what the name resolves
|
|
4808
5023
|
* against. Unset ⇒ `poll` waits are refused (`unknown-probe`); `timer` waits are unaffected. */
|
|
4809
5024
|
readonly probes?: WaitProbeRegistry;
|
|
4810
|
-
/**
|
|
5025
|
+
/** Recursion ceiling (root = 0). The conserved pool bounds depth; this only stops a runaway
|
|
5026
|
+
* recursion. Omit = `DEFAULT_MAX_DEPTH` (16). */
|
|
4811
5027
|
readonly maxDepth?: number;
|
|
4812
|
-
/**
|
|
4813
|
-
*
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
5028
|
+
/** The bound on concurrently working agents across the whole tree, as a number or as an
|
|
5029
|
+
* allocator from `createWorkerSlots` that several runs share. A spawn past it waits in a queue
|
|
5030
|
+
* instead of being refused. The root holds no slot. Omit/`<= 0` bounds concurrency by the budget
|
|
5031
|
+
* alone. */
|
|
5032
|
+
readonly workerSlots?: number | WorkerSlots;
|
|
5033
|
+
/** Opt in to keeping each manager's inference share free of its children's slices. A resumed
|
|
5034
|
+
* run must use the same policy. */
|
|
4817
5035
|
readonly reservationPolicy?: RecursiveReservationPolicy;
|
|
4818
5036
|
/**
|
|
4819
5037
|
* OTP intensity breaker: more than `maxRestarts` child restarts within `withinMs`
|
|
@@ -4871,10 +5089,16 @@ interface SupervisorOpts {
|
|
|
4871
5089
|
* Sandbox fleet for 19 to 37 hours without it. It then closes each released child's cursor
|
|
4872
5090
|
* slot with a terminal record marked `retainedExecution: 'released'`, so `spendGaps` names
|
|
4873
5091
|
* it `unreported` (a floor) rather than `never-settled` (a ceiling) and
|
|
4874
|
-
* `fleetYield.releasedUnrecovered` counts it
|
|
4875
|
-
* the node in `teardownUnconfirmed
|
|
4876
|
-
*
|
|
4877
|
-
* `
|
|
5092
|
+
* `fleetYield.releasedUnrecovered` counts it. A release that is refused or cannot be
|
|
5093
|
+
* confirmed names the node in `teardownUnconfirmed` and its `teardown-unconfirmed` record,
|
|
5094
|
+
* and after the retry window closes its slot with `retainedExecution: 'release-unconfirmed'`,
|
|
5095
|
+
* counted by `fleetYield.releaseUnconfirmed`: the settlement is final, so the slot closes
|
|
5096
|
+
* whether or not the environment is confirmed gone. Measured 2026-09-23/24 on the Discovery
|
|
5097
|
+
* fleet (Runtime 0.249.1 to 0.261.0): 338 of 1,620 agents never settled, and 179 of the
|
|
5098
|
+
* retained ones had an admission that never named an environment. A process that dies
|
|
5099
|
+
* between the last `destroyed: true` receipt and the released record leaves the slot open
|
|
5100
|
+
* only until the next resume, whose `healReleasedSlots` writes the identical record from the
|
|
5101
|
+
* `reconciled` record.
|
|
4878
5102
|
* - `'keep'`: a later process may resume this run, so the environments stay for its recovery.
|
|
4879
5103
|
*
|
|
4880
5104
|
* Default: `'keep'` when `resume` is true (a durable run a later process may continue), else
|
|
@@ -4999,13 +5223,20 @@ interface SpendGap {
|
|
|
4999
5223
|
* `destroyed: true` receipt and the record (same builder, `seq` and `at`, from the
|
|
5000
5224
|
* `reconciled` record). The pool's own admission fault, if the reconcile raised one, is not
|
|
5001
5225
|
* on this record.
|
|
5226
|
+
* - `'release-unconfirmed'`: root settlement under `retainedAtSettlement: 'release'` ended with
|
|
5227
|
+
* the execution unrecovered and its environment NOT confirmed destroyed: the provider refused
|
|
5228
|
+
* the delete, the executor could not confirm it, or the admission never named an environment
|
|
5229
|
+
* (a create that timed out). The settlement is final, so no process will recover the execution
|
|
5230
|
+
* and the slot closes anyway, with the same builder, `seq` and `at` as `'released'`. What the
|
|
5231
|
+
* node may still hold stays named by its `teardown-unconfirmed` record and in
|
|
5232
|
+
* `teardownUnconfirmed`, for a sweeper.
|
|
5002
5233
|
*
|
|
5003
5234
|
* Absent = an ordinary child. The live `Settled` a driver branched on carried `'pending'` where
|
|
5004
|
-
* replay yields `'released'` for the same seq, so a resume-aware driver
|
|
5005
|
-
*
|
|
5006
|
-
* path and the recorded-result path writes no marker.
|
|
5235
|
+
* replay yields `'released'` or `'release-unconfirmed'` for the same seq, so a resume-aware driver
|
|
5236
|
+
* must not branch on these values. No `'recovered'` value exists yet: a live-adopted recovery
|
|
5237
|
+
* settles on the ordinary path and the recorded-result path writes no marker.
|
|
5007
5238
|
*/
|
|
5008
|
-
type RetainedExecutionState = 'pending' | 'released';
|
|
5239
|
+
type RetainedExecutionState = 'pending' | 'released' | 'release-unconfirmed';
|
|
5009
5240
|
/**
|
|
5010
5241
|
* How this run's spawned CHILDREN ended, counted by node id off the complete journal FOREST at
|
|
5011
5242
|
* root settlement — after the join barrier and the release sweep, so the terminal records the
|
|
@@ -5024,13 +5255,18 @@ interface FleetYield {
|
|
|
5024
5255
|
/** `settled` records with `status: 'down'`, released records included. */
|
|
5025
5256
|
readonly down: number;
|
|
5026
5257
|
readonly cancelled: number;
|
|
5027
|
-
/** Spawned with no terminal record: a crash-orphaned child, a
|
|
5028
|
-
*
|
|
5258
|
+
/** Spawned with no terminal record: a crash-orphaned child, or a retained child of a run that
|
|
5259
|
+
* keeps its environments for a resume (`retainedAtSettlement: 'keep'`). Named after
|
|
5260
|
+
* `SpendGap`'s `never-settled`. */
|
|
5029
5261
|
readonly neverSettled: number;
|
|
5030
5262
|
/** Terminal records marked `retainedExecution: 'released'` — a subset of `down + cancelled`.
|
|
5031
5263
|
* A nested manager whose OWN retained execution was released counts here beside the
|
|
5032
5264
|
* grandchildren it released, because its execution was destroyed unrecovered too. */
|
|
5033
5265
|
readonly releasedUnrecovered: number;
|
|
5266
|
+
/** Terminal records marked `retainedExecution: 'release-unconfirmed'` — a subset of
|
|
5267
|
+
* `down + cancelled`, disjoint from `releasedUnrecovered`: executions a final settlement left
|
|
5268
|
+
* unrecovered without confirming their environment destroyed. */
|
|
5269
|
+
readonly releaseUnconfirmed: number;
|
|
5034
5270
|
}
|
|
5035
5271
|
/**
|
|
5036
5272
|
* One channel on which a settled reservation's measured spend exceeded what it reserved.
|
|
@@ -5263,5 +5499,5 @@ interface WidenGate<Out> {
|
|
|
5263
5499
|
readonly judgeExempt?: boolean;
|
|
5264
5500
|
}
|
|
5265
5501
|
//#endregion
|
|
5266
|
-
export { SpawnJournal as $,
|
|
5267
|
-
//# sourceMappingURL=types-
|
|
5502
|
+
export { SpawnJournal as $, LoopTraceEvent as $i, HarnessTranscriptCapture as $n, RetainedInteractiveAdmission as $r, loopEventToOtelSpan as $t, NodeExecutionIdentity as A, OpenAIChatResponseFormat as Aa, ReservationWaitRefused as Ai, TraceSource as An, AgentEvalError$1 as Ar, createPropagatingTraceEmitter as At, ResultBlobStore as B, LoopEndedPayload as Bi, ScopeProgressInput as Bn, RetainedRunDispatchBindingError as Br, OtelAttribute as Bt, ExecutorToolCall as C, AgentRuntimeEventSink as Ca, LeakedReservation as Ci, pollFor as Cn, DriverUnmetContractDecision as Cr, WorkerTraceResolver as Ct, MaterializedExecutionIdentity as D, AgentTaskStatus as Da, ReservationShortfall as Di, SessionMessageLike as Dn, summarizeDriverAttempts as Dr, workerTraceHeaders as Dt, HeldEnvironment as E, AgentTaskSpec as Ea, ReservationRejection as Ei, waitUntil as En, defaultUnmetContractSteer as Er, workerTraceEnv as Et, ProviderModelAttemptEvidence as F, RuntimeCanonicalStreamEvent as Fa, DefaultVerdict$1 as Fi, RetainedPendingCause as Fn, NotFoundError as Fr, EvalRunGeneration as Ft, RootMaterialization as G, LoopPlanDescription as Gi, ReconnectRetainedInteractiveRunOptions as Gn, createWorkerSlots as Gr, RuntimeEventOtelOptions as Gt, ResumedWork as H, LoopIterationEndedPayload as Hi, WorkerProgress as Hn, ValidationError as Hr, OtelExportStats as Ht, ProviderModelExecutionEvidence as I, RuntimeSession as Ia, Driver as Ii, ActivityLog as In, PlannerError as Ir, EvalRunsExportConfig as It, RootStreamReceipt as J, LoopSandboxPlacement as Ji, RetainedInteractiveEnvironmentInput as Jn, NativeContextContinuationInput as Jr, buildRuntimeEventOtelSpans as Jt, RootProviderModelEvidence as K, LoopPlanPayload as Ki, RecoverRetainedInteractiveRunOptions as Kn, NativeContextContinuationExecution as Kr, buildLoopOtelSpans as Kt, RecursiveReservationPolicy as L, RuntimeSessionStore as La, ExecCtx as Li, ActivityNote as Ln, RetainedInteractiveAdmissionError as Lr, EvalRunsExportResult as Lt, NodeSnapshot as M, OpenAIChatToolChoice as Ma, createBudgetPool as Mi, decodeToolPart as Mn, BackendTransportError as Mr, readTraceContextFromEnv as Mt, NodeStatus as N, RunAgentTaskOptions as Na, spendFromUsageEvents as Ni, sandboxSessionTraceSource as Nn, ConfigError as Nr, traceContextToEnv as Nt, MaterializedModelIdentity as O, BackendErrorDetail as Oa, ReservationStage as Oi, SessionTraceBox as On, upstreamUnavailableSignal as Or, workerTraceSeamKey as Ot, ProfileMaterializationReceipt as P, RunAgentTaskStreamOptions as Pa, AgentRunSpec as Pi, RetainedChildRecovery as Pn, JudgeError as Pr, EvalRunEvent as Pt, SpawnEvent as Q, LoopTraceEmitter as Qi, HarnessTranscriptArtifact as Qn, RecoverRetainedRunResult as Qr, generateSpanId as Qt, ResourceLimit as R, RuntimeStreamEvent as Ra, Iteration as Ri, DEFAULT_STALL_AFTER_MS as Rn, RetainedInteractiveBindingError as Rr, INTELLIGENCE_WIRE_VERSION as Rt, ExecutorTeardownWarning as S, AgentRuntimeEvent as Sa, BudgetReconcileFault as Si, isWaitOutcome as Sn, DriverUnmetContractContext as Sr, WorkerTraceUnavailableReason as St, Handle as T, AgentTaskRunResult as Ta, ReservationHolder as Ti, validateWaitSpec as Tn, classifyDriverFailure as Tr, readWorkerTraceContext as Tt, RetainedExecutionState as U, LoopIterationStartedPayload as Ui, createActivityLog as Un, SlotPermit as Ur, OtelExporter as Ut, ResumedKeyState as V, LoopIterationDispatchPayload as Vi, TeamProgress as Vn, RuntimeRunStateError as Vr, OtelExportConfig as Vt, RootHandle as W, LoopLineageOptions as Wi, readWorkerProgress as Wn, WorkerSlots as Wr, OtelSpan as Wt, Scope as X, LoopTeardownFailedPayload as Xi, RetainedInteractiveStartMaterial as Xn, RecoverRetainedRunIntentOptions as Xr, createOtelExporter as Xt, Runtime as Y, LoopStartedPayload as Yi, RetainedInteractiveRunHandle as Yn, ReconnectRetainedRunOptions as Yr, createOpenInferenceFileExporter as Yt, Settled as Z, LoopTokenUsage as Zi, StartRetainedInteractiveRunOptions as Zn, RecoverRetainedRunOptions as Zr, exportEvalRuns as Zt, ExecutorMaterialization as _, AgentAdapter as _a, StartRetainedRunInEnvironmentOptions as _i, WaitProbe as _n, DriverProgressMark as _r, WaitOpts as _t, BudgetOverspend as a, SandboxClient as aa, RetainedRunCancelOptions as ai, RuntimeStreamEventSink as an, captureHarnessTranscript as ar, SpendGap as at, ExecutorRegistry as b, AgentExecutionBackend as ba, BudgetPoolRestore as bi, WaitSpec as bn, DriverRepromptRefusal as br, WorkerInteractiveUnavailableReason as bt, EnvironmentTeardownReceipt as c, Validator as ca, RetainedRunEffect as ci, SanitizedKnowledgeReadinessReport as cn, DEFAULT_MAX_BARREN_REPROMPTS as cr, SubtreeSummary as ct, ExecutorAccounting as d, RuntimeRunHandle as da, RetainedRunHandle as di, createRuntimeStreamEventCollector as dn, DriverAttemptsExhaustedError as dr, SupervisorOpts as dt, LoopWinner as ea, RetainedInteractiveEnvironmentAdmission as ei, padSpanId as en, HarnessTranscriptEvidence as er, SpawnOpts as et, ExecutorCancellation as f, RuntimeRunOptions as fa, RetainedRunIntentAdmission as fi, sanitizeAgentRuntimeEvent as fn, DriverBudgetReadout as fr, TokenUsageProvenance as ft, ExecutorFactory as g, startRuntimeRun as ga, RetainedRunTurnInput as gi, WaitOutcome as gn, DriverLoopRecord as gr, UsageEvent as gt, ExecutorExecutionBinding as h, RuntimeRunStatus as ha, RetainedRunStartMaterial as hi, PendingWait as hn, DriverFailureClass as hr, UnknownMaterializationReason as ht, Budget as i, RunProvenance as ia, RetainedRunAdmissionHook as ii, RuntimeStreamEventCollector as in, ReadableEnvironment as ir, SpendChannel as it, NodeId as j, OpenAIChatTool as ja, ReserveOptions as ji, createPushTraceSource as jn, AgentEvalErrorCode as jr, mergeTraceEnv as jt, NoWinnerError as k, KnowledgeReadinessDecision as ka, ReservationTicket as ki, ToolStepInput as kn, UnavailablePausePolicy as kr, TraceContext as kt, ExecutionBindingReceipt as l, RuntimeRunCompleteInput as la, RetainedRunEnvironmentAdmission as li, SanitizedKnowledgeRequirement as ln, DriverAttemptRecord as lr, SupervisedResult as lt, ExecutorContext as m, RuntimeRunRow as ma, RetainedRunSnapshot as mi, sanitizeRuntimeStreamEvent as mn, DriverContractState as mr, UnconfirmedTeardown as mt, AgentExecutionRef as n, MountRecorder as na, RetainedInteractiveStartedAdmission as ni, toOtelAttributes as nn, HarnessTranscriptUnavailable as nr, SpawnRejection as nt, BudgetViolation as o, SelectionReceipt as oa, RetainedRunCancellation as oi, RuntimeStreamEventSummary as on, harnessTranscriptArtifact as or, SteerableRootHandle as ot, ExecutorCancellationRequest as p, RuntimeRunPersistenceAdapter as pa, RetainedRunReplayPoint as pi, sanitizeKnowledgeReadinessReport as pn, DriverContinuationRecord as pr, TreeView as pt, RootSignal as q, LoopResult as qi, RetainedInteractiveAdmissionHook as qn, NativeContextContinuationHandle as qr, buildLoopSpanNodes as qt, AgentSpec as r, OutputAdapter as ra, RetainedRunAdmission as ri, RuntimeEventCollector as rn, HarnessTranscriptUnavailableReason as rr, Spend as rt, DefaultVerdict as s, ValidationCtx as sa, RetainedRunDispatchedAdmission as si, RuntimeTelemetryOptions as sn, persistHarnessTranscript as sr, SubtreeResult as st, Agent as t, MountManifestEntry as ta, RetainedInteractiveIntentAdmission as ti, padTraceId as tn, HarnessTranscriptFile as tr, SpawnPrior as tt, Executor as u, RuntimeRunCost as ua, RetainedRunEventOptions as ui, createRuntimeEventCollector as un, DriverAttemptStop as ur, Supervisor as ut, ExecutorNodeContext as v, AgentBackendContext as va, StartRetainedRunOptions as vi, WaitProbeRegistry as vn, DriverReentry as vr, WidenGate as vt, FleetYield as w, AgentTaskContext as wa, ReservationFloor as wi, timerAt as wn, OnUnmetContract as wr, WorkerTraceSeamCarrier as wt, ExecutorResult as x, AgentKnowledgeProvider as xa, BudgetReadout as xi, createWaitProbes as xn, DriverRetryPolicy as xr, WorkerTraceEvidence as xt, ExecutorProgressEvent as y, AgentBackendInput as ya, BudgetPool as yi, WaitRejection as yn, DriverRepromptPolicy as yr, WorkerInteractiveSession as yt, ResourceSpend as z, LoopDecisionPayload as zi, ExecutorProgress as zn, RetainedRunAdmissionError as zr, LoopSpanNode as zt };
|
|
5503
|
+
//# sourceMappingURL=types-Bo7z5aG5.d.ts.map
|