@tangle-network/agent-runtime 0.208.1 → 0.210.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/README.md +4 -0
- package/dist/{activation-Dan50rKs.d.ts → activation-4oMAHaQz.d.ts} +2 -2
- package/dist/{activation-B86jXbpE.js → activation-Bwyehqhg.js} +2 -2
- package/dist/{activation-B86jXbpE.js.map → activation-Bwyehqhg.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-D9dbnSA0.js → coordination-driver-Bp9a4LdC.js} +33 -6
- package/dist/coordination-driver-Bp9a4LdC.js.map +1 -0
- package/dist/{delegate-DP3QsLAy.js → delegate-Dmm9ITBZ.js} +2 -2
- package/dist/{delegate-DP3QsLAy.js.map → delegate-Dmm9ITBZ.js.map} +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +2 -2
- package/dist/{graph-BXa0AN64.js → graph-D1QQu6lY.js} +3 -3
- package/dist/{graph-BXa0AN64.js.map → graph-D1QQu6lY.js.map} +1 -1
- package/dist/{improvement-cycle-BFg94oh7.js → improvement-cycle-BlvbrKLq.js} +3 -3
- package/dist/{improvement-cycle-BFg94oh7.js.map → improvement-cycle-BlvbrKLq.js.map} +1 -1
- package/dist/{index-CHkf3b2C.d.ts → index-lXtwqnQA.d.ts} +7 -124
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +3 -3
- package/dist/kernel.js +8 -8
- package/dist/{loop-runner-bin-BUVcdgNU.d.ts → loop-runner-bin-CpJtH4zl.d.ts} +3 -3
- package/dist/{loop-runner-bin-Cv-sYY_b.js → loop-runner-bin-QKH_nf8M.js} +3 -3
- package/dist/{loop-runner-bin-Cv-sYY_b.js.map → loop-runner-bin-QKH_nf8M.js.map} +1 -1
- 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 +2 -2
- package/dist/mcp/index.js +4 -4
- package/dist/{provision-supervisor-DARqIVIZ.js → provision-supervisor-Dq81wDhU.js} +3 -3
- package/dist/{provision-supervisor-DARqIVIZ.js.map → provision-supervisor-Dq81wDhU.js.map} +1 -1
- package/dist/{redact-DXxGazcg.js → redact-CE6Hfkrp.js} +7244 -7014
- package/dist/redact-CE6Hfkrp.js.map +1 -0
- package/dist/{runtime-DXz65UHu.js → runtime-BgOCbw6N.js} +12 -8
- package/dist/{runtime-DXz65UHu.js.map → runtime-BgOCbw6N.js.map} +1 -1
- package/dist/{server-DLxegwGE.js → server-xYvBM-Te.js} +3 -3
- package/dist/{server-DLxegwGE.js.map → server-xYvBM-Te.js.map} +1 -1
- package/dist/{stream-agent-turn-B3NfR48z.d.ts → stream-agent-turn-BXZMQQ0K.d.ts} +500 -353
- package/dist/{structural-rollout-D3Su8Dla.js → structural-rollout-CcO70n6X.js} +2 -2
- package/dist/{structural-rollout-D3Su8Dla.js.map → structural-rollout-CcO70n6X.js.map} +1 -1
- package/dist/{supervise-B5kRyFJj.js → supervise-DNh1_cHO.js} +58 -16
- package/dist/supervise-DNh1_cHO.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +4 -4
- package/dist/coordination-driver-D9dbnSA0.js.map +0 -1
- package/dist/redact-DXxGazcg.js.map +0 -1
- package/dist/supervise-B5kRyFJj.js.map +0 -1
|
@@ -7,6 +7,138 @@ import { ChildProcess } from "node:child_process";
|
|
|
7
7
|
import { WorkspacePlanReceipt } from "@tangle-network/agent-profile-materialize";
|
|
8
8
|
import { BackendType, CreateSandboxOptions, PromptOptions, Sandbox, SandboxEvent, SandboxInstance } from "@tangle-network/sandbox";
|
|
9
9
|
import { AgentEnvironment, AgentEnvironment as AgentEnvironment$1, AgentEnvironmentCapabilities, AgentEnvironmentCapabilities as AgentEnvironmentCapabilities$1, AgentEnvironmentEvent, AgentEnvironmentEvent as AgentEnvironmentEvent$1, AgentEnvironmentProvider, AgentEnvironmentProvider as AgentEnvironmentProvider$1, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentProfileRef as AgentProfileRef$1, AgentSession, AgentSessionRef, AgentSessionStatus as AgentSessionStatus$1, AgentTurnInput, AgentTurnInput as AgentTurnInput$1, AgentTurnResult as AgentTurnResult$1, AgentTurnResult as AgentTurnResult$2, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, CreateAgentEnvironmentInput as CreateAgentEnvironmentInput$1, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from "@tangle-network/agent-interface/environment-provider";
|
|
10
|
+
//#region src/runtime/supervise/budget.d.ts
|
|
11
|
+
/** Opaque, single-use reservation handle returned by `reserve` and consumed by
|
|
12
|
+
* `reconcile`. Carries the reserved ceilings so reconciliation needs no lookup. */
|
|
13
|
+
interface ReservationTicket {
|
|
14
|
+
readonly id: number;
|
|
15
|
+
readonly reserved: {
|
|
16
|
+
readonly resources?: Budget['resources'];
|
|
17
|
+
readonly tokens: number;
|
|
18
|
+
readonly usd: number;
|
|
19
|
+
readonly iterations: number;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the child's `Budget` actually declared `maxUsd`. `reserved.usd` is `0` for BOTH a
|
|
22
|
+
* child that named no dollar ceiling and one that named `$0`, and the two settle differently:
|
|
23
|
+
* an undeclared ceiling cannot be exceeded, so the child's real dollars are committed as
|
|
24
|
+
* OBSERVED spend, while a declared ceiling of `$0` is a limit whose breach is fail-loud.
|
|
25
|
+
* Optional so an externally constructed ticket stays valid; an absent flag is read as
|
|
26
|
+
* `true` — the strict, fail-closed reading.
|
|
27
|
+
*/
|
|
28
|
+
readonly usdBudgeted?: boolean;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Post-reservation pool readout — the shape `Scope.budget` exposes. `tokensLeft`,
|
|
32
|
+
* `usdLeft`, and `reservedTokens` reflect committed-but-unsettled reservations;
|
|
33
|
+
* `deadlineMs` is the ABSOLUTE wall-clock deadline (0 when the root set none).
|
|
34
|
+
* `iterationsLeft` is the remaining iteration capacity.
|
|
35
|
+
* `usdCapped` distinguishes a real `usdLeft <= 0` exhaustion from an uncapped pool (which always
|
|
36
|
+
* reads `usdLeft: 0`) — the in-loop guard needs it to bound a usd-capped driver. */
|
|
37
|
+
type BudgetReadout = Readonly<{
|
|
38
|
+
resources?: Readonly<Record<string, {
|
|
39
|
+
unit: string;
|
|
40
|
+
limit: number;
|
|
41
|
+
remaining: number;
|
|
42
|
+
reserved: number;
|
|
43
|
+
committed: number;
|
|
44
|
+
known: boolean;
|
|
45
|
+
}>>;
|
|
46
|
+
tokensLeft: number;
|
|
47
|
+
/**
|
|
48
|
+
* False once the pool has recorded work whose token count was UNREPORTED (a `Spend` with
|
|
49
|
+
* `tokensKnown: false`). `tokensLeft` is then a ceiling on what remains, not a measurement: real
|
|
50
|
+
* consumption is at least the debited amount and possibly more. Reading `tokensLeft` without this
|
|
51
|
+
* flag would present an under-count as an exact balance.
|
|
52
|
+
*/
|
|
53
|
+
tokensKnown: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* False once the pool has charged a REPORTED spend whose prompt-cache split it could not read.
|
|
56
|
+
* The prompt tokens that carried no class were charged in full, and a cached prefix reaches the
|
|
57
|
+
* pool again on every turn that reads it, so the debited amount is an upper bound on
|
|
58
|
+
* newly-presented work rather than a measurement. It is a separate fact from `tokensKnown`: the
|
|
59
|
+
* counts arrived, but their composition did not. A restored uncertain reservation leaves this
|
|
60
|
+
* flag alone — it charges a declared ceiling, which has no composition to misread, and
|
|
61
|
+
* `tokensKnown` already reports that the balance is not a measurement.
|
|
62
|
+
*/
|
|
63
|
+
cacheBreakdownKnown: boolean;
|
|
64
|
+
usdLeft: number;
|
|
65
|
+
usdCapped: boolean;
|
|
66
|
+
/** False once any recorded work reported an unknown dollar cost; the dollar totals are then a
|
|
67
|
+
* lower bound on real spend, not a measurement. */
|
|
68
|
+
usdKnown: boolean;
|
|
69
|
+
iterationsLeft: number;
|
|
70
|
+
deadlineMs: number;
|
|
71
|
+
reservedTokens: number;
|
|
72
|
+
}>;
|
|
73
|
+
/** Why a reservation was refused. `budget-exhausted` means the pool ran out of a channel it
|
|
74
|
+
* budgets; `usd-unbudgeted` means the root declared no dollar ceiling, so a dollar request is
|
|
75
|
+
* unsatisfiable at any amount and the fix is to budget the root, not to ask for less. */
|
|
76
|
+
type ReservationRejection = 'budget-exhausted' | 'usd-unbudgeted';
|
|
77
|
+
/** State recovered from a prior process before new work is admitted. `committed` is measured spend
|
|
78
|
+
* already present in the durable journal. Each `uncertainReservation` is a child that was recorded
|
|
79
|
+
* as started but never recorded as settled: its full declared ceiling is charged conservatively,
|
|
80
|
+
* while the public readout remains explicitly unknown. */
|
|
81
|
+
interface BudgetPoolRestore {
|
|
82
|
+
readonly committed?: Spend;
|
|
83
|
+
readonly uncertainReservations?: ReadonlyArray<Budget>;
|
|
84
|
+
}
|
|
85
|
+
interface BudgetPool {
|
|
86
|
+
/**
|
|
87
|
+
* Atomically reserve a child's full ceiling from the free balance. Fails closed
|
|
88
|
+
* ({ ok: false }) when the pool can't cover standard or named channels — the
|
|
89
|
+
* caller inspects `ok` before `ticket`.
|
|
90
|
+
*/
|
|
91
|
+
reserve(b: Budget): {
|
|
92
|
+
ok: true;
|
|
93
|
+
ticket: ReservationTicket;
|
|
94
|
+
} | {
|
|
95
|
+
ok: false;
|
|
96
|
+
reason: ReservationRejection;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Release a reservation: commit the actual `spent`, refund the unspent remainder
|
|
100
|
+
* to the free pool. Throws on an unknown or already-reconciled ticket (fail loud —
|
|
101
|
+
* a double refund would silently break conservation).
|
|
102
|
+
*/
|
|
103
|
+
reconcile(ticket: ReservationTicket, spent: Spend): void;
|
|
104
|
+
/** Fold a normalized `UsageEvent` stream (or array) into a `Spend`. Tokens via
|
|
105
|
+
* `addTokenUsage`, usd on its own channel, iterations from `'iteration'` events.
|
|
106
|
+
* `ms` is left zero — wall-clock duration is the caller's to record, not the pool's. */
|
|
107
|
+
spendFrom(events: AsyncIterable<UsageEvent> | UsageEvent[]): Promise<Spend>;
|
|
108
|
+
/** The current readout, reflecting all outstanding reservations. */
|
|
109
|
+
readout(): BudgetReadout;
|
|
110
|
+
/**
|
|
111
|
+
* Record OBSERVED spend that did NOT go through reserve/reconcile — the driver's OWN inference
|
|
112
|
+
* (its chat turns), which is real compute but not a spawned child. A direct `free → committed`
|
|
113
|
+
* debit, so `total ≡ free + reserved + committed` is preserved: equal-k counts the driver's
|
|
114
|
+
* tokens and the in-loop budget guard (`readout().tokensLeft`) sees them. `free` may go negative
|
|
115
|
+
* when a run overspends. Unknown enforced resource usage is recorded before throwing.
|
|
116
|
+
* Partial increments defer completeness checks until the invocation reports its terminal spend.
|
|
117
|
+
* The DURABLE record is the journal's `metered` event (written by `Scope.meter`); this debit
|
|
118
|
+
* only makes the live `readout()` reflect driver inference for the in-loop guard.
|
|
119
|
+
*/
|
|
120
|
+
observe(spend: Spend, options?: {
|
|
121
|
+
partial?: boolean;
|
|
122
|
+
}): void;
|
|
123
|
+
/** Fail loud if any reservation is still open — the conserved-pool leak detector. Called at the
|
|
124
|
+
* supervisor's join barrier: once every child has settled, no ticket may remain (a leaked
|
|
125
|
+
* reservation would silently break `total ≡ free + reserved + committed`). */
|
|
126
|
+
assertNoOpenTickets(): void;
|
|
127
|
+
}
|
|
128
|
+
/** Fold a normalized `UsageEvent` array into a `Spend`. Tokens and usd are separate
|
|
129
|
+
* channels; iterations come from `'iteration'` events. Pure; `ms` stays zero (the
|
|
130
|
+
* pool does not read wall-clock). */
|
|
131
|
+
declare function spendFromUsageEvents(events: UsageEvent[]): Spend;
|
|
132
|
+
/**
|
|
133
|
+
* Create a conserved reservation pool from a root `Budget`. `runStartedAtMs` is the WALL-CLOCK
|
|
134
|
+
* instant the run's root was recorded, and it is the only input the deadline is derived from:
|
|
135
|
+
* `runStartedAtMs + root.deadlineMs`, or `0` when the root declares no deadline. The pool holds no
|
|
136
|
+
* clock, so a caller cannot hand it a run-relative one and get a duration back where an instant is
|
|
137
|
+
* expected. A resumed pool passes the ORIGINAL root instant, so restart never slides the limit.
|
|
138
|
+
* The readout is an absolute instant, not a shrinking remainder.
|
|
139
|
+
*/
|
|
140
|
+
declare function createBudgetPool(root: Budget, runStartedAtMs: number, restore?: BudgetPoolRestore): BudgetPool;
|
|
141
|
+
//#endregion
|
|
10
142
|
//#region src/runtime/retained-run-types.d.ts
|
|
11
143
|
/** Cursor plus runtime sequence needed to continue one ordered replay. @stable */
|
|
12
144
|
interface RetainedRunReplayPoint {
|
|
@@ -388,6 +520,7 @@ interface WorkerProgress {
|
|
|
388
520
|
readonly usd: number;
|
|
389
521
|
/** False when observed dollar spend is only a known subtotal, not a complete total. */
|
|
390
522
|
readonly usdKnown?: boolean;
|
|
523
|
+
readonly resources?: Spend['resources'];
|
|
391
524
|
/** Steers delivered but not yet read by the worker. */
|
|
392
525
|
readonly pendingMessages: number;
|
|
393
526
|
/** Newest-last window of tool/turn activity; empty when the executor exposes none. */
|
|
@@ -422,6 +555,7 @@ interface ScopeProgressInput {
|
|
|
422
555
|
readonly tokensKnown?: boolean;
|
|
423
556
|
readonly usd: number;
|
|
424
557
|
readonly usdKnown?: boolean;
|
|
558
|
+
readonly resources?: Spend['resources'];
|
|
425
559
|
}
|
|
426
560
|
/** Fold the scope-derived facts and the executor's optional enrichment into one read. Pure: the
|
|
427
561
|
* caller supplies `now`, so a test can observe a stall without waiting for one. */
|
|
@@ -1085,6 +1219,10 @@ interface Agent<Task, Out> {
|
|
|
1085
1219
|
* path; returning `true` means the message was accepted for the current manager session.
|
|
1086
1220
|
*/
|
|
1087
1221
|
deliver?(msg: unknown): void | boolean;
|
|
1222
|
+
/** Optional live tool evidence exposed by executors that can observe it. */
|
|
1223
|
+
traceSource?(): TraceSource | undefined;
|
|
1224
|
+
/** Optional live execution progress exposed by executors that can observe it. */
|
|
1225
|
+
progress?(): ExecutorProgress | undefined;
|
|
1088
1226
|
}
|
|
1089
1227
|
/**
|
|
1090
1228
|
* The leaf runtime — ONE open interface, not a closed union. `execute` returns a
|
|
@@ -1454,6 +1592,12 @@ type UsageEvent = {
|
|
|
1454
1592
|
/** Observed output, not accounting. Meters ignore it; the turn projection publishes it. */
|
|
1455
1593
|
kind: 'progress';
|
|
1456
1594
|
progress: ExecutorProgressEvent;
|
|
1595
|
+
} | {
|
|
1596
|
+
kind: 'resource';
|
|
1597
|
+
name: string;
|
|
1598
|
+
unit: string;
|
|
1599
|
+
amount: number;
|
|
1600
|
+
known: boolean;
|
|
1457
1601
|
} | {
|
|
1458
1602
|
kind: 'iteration';
|
|
1459
1603
|
};
|
|
@@ -1651,12 +1795,25 @@ interface ExecutorRegistry {
|
|
|
1651
1795
|
error: string;
|
|
1652
1796
|
};
|
|
1653
1797
|
}
|
|
1798
|
+
/** Caller-defined resource ceiling in non-negative safe-integer units, consistent throughout a tree. */
|
|
1799
|
+
interface ResourceLimit {
|
|
1800
|
+
readonly unit: string;
|
|
1801
|
+
readonly limit: number;
|
|
1802
|
+
}
|
|
1803
|
+
/** Non-negative safe-integer subtotal. False means unknown, even when amount is zero.
|
|
1804
|
+
* Select sufficiently fine units, such as GPU-milliseconds. */
|
|
1805
|
+
interface ResourceSpend {
|
|
1806
|
+
readonly unit: string;
|
|
1807
|
+
readonly amount: number;
|
|
1808
|
+
readonly known: boolean;
|
|
1809
|
+
}
|
|
1654
1810
|
/** A budget envelope on a spawn or the root. All ceilings; the pool reserves against them. */
|
|
1655
1811
|
interface Budget {
|
|
1656
1812
|
readonly maxIterations: number;
|
|
1657
1813
|
readonly maxTokens: number;
|
|
1658
1814
|
readonly maxUsd?: number;
|
|
1659
1815
|
readonly deadlineMs?: number;
|
|
1816
|
+
readonly resources?: Readonly<Record<string, ResourceLimit>>;
|
|
1660
1817
|
}
|
|
1661
1818
|
/**
|
|
1662
1819
|
* Conserved spend, reconciled from the normalized `UsageEvent` stream. Tokens and usd are separate
|
|
@@ -1667,6 +1824,7 @@ interface Budget {
|
|
|
1667
1824
|
* holds the reason.
|
|
1668
1825
|
*/
|
|
1669
1826
|
interface Spend {
|
|
1827
|
+
resources?: Readonly<Record<string, ResourceSpend>>;
|
|
1670
1828
|
iterations: number;
|
|
1671
1829
|
tokens: LoopTokenUsage;
|
|
1672
1830
|
/** Token accounting is known unless explicitly false. A false value marks work that HAPPENED with
|
|
@@ -1975,22 +2133,7 @@ interface Scope<Out> {
|
|
|
1975
2133
|
/** The live tree — reads the in-memory nursery, not the journal. */
|
|
1976
2134
|
readonly view: TreeView;
|
|
1977
2135
|
/** Conserved-pool readouts (post-reservation). */
|
|
1978
|
-
readonly budget:
|
|
1979
|
-
tokensLeft: number;
|
|
1980
|
-
/** `false` once a turn settled without reporting its tokens: `tokensLeft` is then a ceiling,
|
|
1981
|
-
* not a measurement. */
|
|
1982
|
-
tokensKnown: boolean;
|
|
1983
|
-
/** `false` once a charged spend arrived without a readable prompt-cache split. That spend was
|
|
1984
|
-
* charged at its rolled-up prompt total, which counts a cached prefix again on every turn that
|
|
1985
|
-
* reads it, so `tokensLeft` is an upper bound on newly-presented work. */
|
|
1986
|
-
cacheBreakdownKnown: boolean;
|
|
1987
|
-
usdLeft: number;
|
|
1988
|
-
usdCapped: boolean;
|
|
1989
|
-
usdKnown: boolean;
|
|
1990
|
-
iterationsLeft: number;
|
|
1991
|
-
deadlineMs: number;
|
|
1992
|
-
reservedTokens: number;
|
|
1993
|
-
}>;
|
|
2136
|
+
readonly budget: BudgetReadout;
|
|
1994
2137
|
/** One tree-wide view of simultaneous spawned work. Every nested scope reads the same counter;
|
|
1995
2138
|
* the root agent itself is not a spawned worker. `freeSlots` is `null` when no limit is set.
|
|
1996
2139
|
* `unconfirmed` NAMES the settled children whose executor teardown was never acknowledged —
|
|
@@ -2499,7 +2642,7 @@ interface NoWinnerError {
|
|
|
2499
2642
|
stack?: string;
|
|
2500
2643
|
}
|
|
2501
2644
|
/** The accounting channels a usage gap leaves incomplete. */
|
|
2502
|
-
type SpendChannel = 'tokens' | 'usd'
|
|
2645
|
+
type SpendChannel = 'tokens' | 'usd' | `resource:${string}`;
|
|
2503
2646
|
/**
|
|
2504
2647
|
* One journaled node whose usage accounting is incomplete — the named gap behind a `false`
|
|
2505
2648
|
* `tokensKnown`/`usdKnown` on a terminal `spentTotal`. `never-settled`: the spawn is durable but
|
|
@@ -2930,6 +3073,8 @@ type ToolLoopChat = (messages: ReadonlyArray<ToolLoopMessageRecord>, tools: Read
|
|
|
2930
3073
|
output: number;
|
|
2931
3074
|
reasoning?: number;
|
|
2932
3075
|
};
|
|
3076
|
+
/** Caller-measured resource totals for this turn; omission makes enforced dimensions unknown. */
|
|
3077
|
+
resources?: Spend['resources'];
|
|
2933
3078
|
/** Dollar value reported for the turn. It is not billed spend unless provenance says so. */
|
|
2934
3079
|
costUsd?: number;
|
|
2935
3080
|
costProvenance?: 'provider-receipt' | 'billing-receipt' | 'catalog-estimate';
|
|
@@ -2987,7 +3132,7 @@ type ToolLoopCompactionOptions = Omit<ToolLoopCompaction, 'distill'> & {
|
|
|
2987
3132
|
interface RouterTransportConfig {
|
|
2988
3133
|
routerBaseUrl: string;
|
|
2989
3134
|
routerKey: string;
|
|
2990
|
-
/** Injectable OpenAI-compatible transport
|
|
3135
|
+
/** Injectable OpenAI-compatible transport. Optional usage.resources carries measured turn totals. */
|
|
2991
3136
|
complete?: (body: Record<string, unknown>, request?: {
|
|
2992
3137
|
readonly headers: Readonly<Record<string, string>>;
|
|
2993
3138
|
readonly signal?: AbortSignal;
|
|
@@ -3446,177 +3591,6 @@ interface InPlaceHarnessResult {
|
|
|
3446
3591
|
harness: WorktreeHarnessResult['harness'];
|
|
3447
3592
|
}
|
|
3448
3593
|
//#endregion
|
|
3449
|
-
//#region src/runtime/harness-usage.d.ts
|
|
3450
|
-
/**
|
|
3451
|
-
* One harness's own token-usage report for one turn, in the runtime's field names.
|
|
3452
|
-
*
|
|
3453
|
-
* `input` is the provider's TOTAL prompt count and `output` is its TOTAL completion count.
|
|
3454
|
-
* The other three counters CLASSIFY a part of one of those totals; none of them adds to it.
|
|
3455
|
-
* `cachedInput` and `cacheWriteInput` classify `input`, which is the convention
|
|
3456
|
-
* `promptCacheTokenClasses` (`util.ts`) folds: `freshInput = input - cacheRead - cacheWrite`.
|
|
3457
|
-
* `reasoningOutput` classifies `output`.
|
|
3458
|
-
*
|
|
3459
|
-
* A counter the harness does not report stays absent, because a zero would claim the harness
|
|
3460
|
-
* measured none.
|
|
3461
|
-
*/
|
|
3462
|
-
interface HarnessUsage {
|
|
3463
|
-
/** The harness family whose adapter produced this report. */
|
|
3464
|
-
readonly harness: HarnessType;
|
|
3465
|
-
/** Total prompt tokens the provider charged for the turn, the cached ones included. */
|
|
3466
|
-
readonly input: number;
|
|
3467
|
-
/** Total completion tokens the provider charged for the turn, the reasoning ones included. */
|
|
3468
|
-
readonly output: number;
|
|
3469
|
-
/** The part of `input` the provider served from its prompt cache. */
|
|
3470
|
-
readonly cachedInput?: number;
|
|
3471
|
-
/** The part of `input` the provider wrote into its prompt cache. */
|
|
3472
|
-
readonly cacheWriteInput?: number;
|
|
3473
|
-
/** The part of `output` the model spent on reasoning. Never added to `output`. */
|
|
3474
|
-
readonly reasoningOutput?: number;
|
|
3475
|
-
}
|
|
3476
|
-
/**
|
|
3477
|
-
* Decode a sandbox event with one harness's adapter, or `undefined` when the event carries no
|
|
3478
|
-
* harness-native usage.
|
|
3479
|
-
*
|
|
3480
|
-
* A NAMED harness reads with that harness's adapter only, and a named harness with no adapter
|
|
3481
|
-
* reports nothing. It never falls through to another harness's adapter: a different harness's
|
|
3482
|
-
* `turn.completed` decoded as codex would either drop the counters codex does not name or fail on
|
|
3483
|
-
* a field codex requires, and both answers would be about the wrong harness. The composite over
|
|
3484
|
-
* every registered adapter runs only when the caller cannot name the harness.
|
|
3485
|
-
*
|
|
3486
|
-
* Throws `ValidationError` when an adapter recognizes the event as its harness's usage carrier and
|
|
3487
|
-
* cannot read the numbers.
|
|
3488
|
-
*/
|
|
3489
|
-
declare function decodeHarnessUsage(event: SandboxEvent, harness?: HarnessType): HarnessUsage | undefined;
|
|
3490
|
-
//#endregion
|
|
3491
|
-
//#region src/runtime/codex-rollout-store.d.ts
|
|
3492
|
-
/** Who wrote one rollout, exactly as its own `session_meta` states it. Nothing here is inferred. */
|
|
3493
|
-
interface CodexRolloutIdentity {
|
|
3494
|
-
/** The rollout's own thread id (`session_meta.payload.id`). */
|
|
3495
|
-
readonly sessionId: string;
|
|
3496
|
-
/** The thread this one was spawned or forked from, when it was. */
|
|
3497
|
-
readonly parentThreadId?: string;
|
|
3498
|
-
/** The thread whose rows are prepended into this file, when this file is a fork. */
|
|
3499
|
-
readonly forkedFromId?: string;
|
|
3500
|
-
/** True when `thread_source` reads `subagent`: a harness-native child, invisible to the journal. */
|
|
3501
|
-
readonly nativeChild: boolean;
|
|
3502
|
-
/** The child's own path in the harness's agent tree (`/root/c1_b_grid`), when it has one. */
|
|
3503
|
-
readonly agentPath?: string;
|
|
3504
|
-
/** The harness's own nickname for the child ("Turing"), when it has one. */
|
|
3505
|
-
readonly agentNickname?: string;
|
|
3506
|
-
/** Spawn depth the harness recorded. `1` is a direct child of the seat. */
|
|
3507
|
-
readonly depth?: number;
|
|
3508
|
-
/** The working directory the session ran in, used to attribute a store to a workspace. */
|
|
3509
|
-
readonly cwd?: string;
|
|
3510
|
-
/** The codex build that wrote it. */
|
|
3511
|
-
readonly cliVersion?: string;
|
|
3512
|
-
/** When the session itself started, from its own `session_meta` timestamp. */
|
|
3513
|
-
readonly startedAtMs?: number;
|
|
3514
|
-
}
|
|
3515
|
-
/** How this reader isolated the session's own rows from the parent rows prepended to its file. */
|
|
3516
|
-
type CodexForkBoundary =
|
|
3517
|
-
/** Not a fork: every row in the file belongs to this session. */
|
|
3518
|
-
{
|
|
3519
|
-
readonly kind: 'whole-file';
|
|
3520
|
-
} |
|
|
3521
|
-
/** A fork whose own first turn was isolated, and by which rule. */
|
|
3522
|
-
{
|
|
3523
|
-
readonly kind: 'resolved';
|
|
3524
|
-
readonly rule: 'history-start-ordinal' | 'turn-is-session' | 'turn-uuid-v7' | 'turn-start-time';
|
|
3525
|
-
/** The `turn_id` of the session's own first turn. */
|
|
3526
|
-
readonly turnId?: string;
|
|
3527
|
-
/** Rows credited to the parent and excluded from `own`. */
|
|
3528
|
-
readonly inheritedTurns: number;
|
|
3529
|
-
} |
|
|
3530
|
-
/** A fork this reader could not isolate. `own` is absent; nothing may be charged. */
|
|
3531
|
-
{
|
|
3532
|
-
readonly kind: 'unresolved';
|
|
3533
|
-
readonly reason: string;
|
|
3534
|
-
};
|
|
3535
|
-
/** One turn of one session, with the counters it added to the session's cumulative total. */
|
|
3536
|
-
interface CodexRolloutTurn {
|
|
3537
|
-
readonly turnId?: string;
|
|
3538
|
-
readonly startedAtMs?: number;
|
|
3539
|
-
readonly usage: HarnessUsage;
|
|
3540
|
-
}
|
|
3541
|
-
/** One rollout file, read. */
|
|
3542
|
-
interface CodexRolloutSession {
|
|
3543
|
-
readonly identity: CodexRolloutIdentity;
|
|
3544
|
-
readonly boundary: CodexForkBoundary;
|
|
3545
|
-
/**
|
|
3546
|
-
* The session's OWN spend — the cumulative delta from its fork boundary to its last report.
|
|
3547
|
-
* ABSENT when the boundary is unresolved: an unattributable number must not be charged.
|
|
3548
|
-
*/
|
|
3549
|
-
readonly own?: HarnessUsage;
|
|
3550
|
-
/** The session's own turns, newest last. Empty when the file reported no usage. */
|
|
3551
|
-
readonly turns: readonly CodexRolloutTurn[];
|
|
3552
|
-
/**
|
|
3553
|
-
* The file's final cumulative `total_token_usage`, kept ONLY as the diagnostic that shows how
|
|
3554
|
-
* far a naive file total is from the truth. Never charge this.
|
|
3555
|
-
*/
|
|
3556
|
-
readonly fileCumulativeInput: number;
|
|
3557
|
-
readonly fileCumulativeOutput: number;
|
|
3558
|
-
}
|
|
3559
|
-
/** What one incremental read of a store observed. */
|
|
3560
|
-
interface CodexStoreDelta {
|
|
3561
|
-
/** Spend by sessions that are NOT native children — the seat's own turns. */
|
|
3562
|
-
readonly seat: HarnessUsage;
|
|
3563
|
-
/** Spend by `thread_source: subagent` sessions — the harness-native children. */
|
|
3564
|
-
readonly native: HarnessUsage;
|
|
3565
|
-
/** Sessions whose fork boundary could not be isolated, so their spend is absent, not zero. */
|
|
3566
|
-
readonly unresolved: ReadonlyArray<{
|
|
3567
|
-
readonly sessionId: string;
|
|
3568
|
-
readonly reason: string;
|
|
3569
|
-
}>;
|
|
3570
|
-
/**
|
|
3571
|
-
* Every session this read touched, for evidence. Each one states its WHOLE own spend and turn
|
|
3572
|
-
* list, which is not the same number as `seat` / `native`: those two carry only what this read
|
|
3573
|
-
* newly observed.
|
|
3574
|
-
*/
|
|
3575
|
-
readonly sessions: readonly CodexRolloutSession[];
|
|
3576
|
-
}
|
|
3577
|
-
/** A store reader that credits each turn once: it tails only the bytes appended since the last read. */
|
|
3578
|
-
interface CodexRolloutStoreReader {
|
|
3579
|
-
/**
|
|
3580
|
-
* Read everything appended since the previous call and attribute it.
|
|
3581
|
-
*
|
|
3582
|
-
* The FIRST call establishes the baseline. Call it before the first turn so pre-existing rows are
|
|
3583
|
-
* consumed and credited to nothing; every later call returns exactly that turn's spend.
|
|
3584
|
-
*/
|
|
3585
|
-
read(): Promise<CodexStoreDelta>;
|
|
3586
|
-
}
|
|
3587
|
-
/** Where a harness keeps its own session store, and which workspace may be credited from it. */
|
|
3588
|
-
interface CodexRolloutStoreRef {
|
|
3589
|
-
/**
|
|
3590
|
-
* Absolute path to the harness home the CLI writes into — `CODEX_HOME`, or `$HOME/.codex`.
|
|
3591
|
-
* This MUST be the run's own isolated store. Pointing it at an ambient host store credits one
|
|
3592
|
-
* run with another run's files, which is the exact defect this reader exists to end.
|
|
3593
|
-
*/
|
|
3594
|
-
readonly root: string;
|
|
3595
|
-
/**
|
|
3596
|
-
* Credit only sessions whose recorded `cwd` is this path or below it. Absent credits every
|
|
3597
|
-
* session under `root`, which is correct only for a store no other run writes to.
|
|
3598
|
-
*/
|
|
3599
|
-
readonly workspaceRoot?: string;
|
|
3600
|
-
}
|
|
3601
|
-
/**
|
|
3602
|
-
* Read one rollout's rows into a session record.
|
|
3603
|
-
*
|
|
3604
|
-
* `rows` is the file's JSON values in file order. Pass the whole file to read a completed session;
|
|
3605
|
-
* the store reader passes appended slices and carries the identity forward itself.
|
|
3606
|
-
*/
|
|
3607
|
-
declare function readCodexRolloutSession(rows: Iterable<unknown>): CodexRolloutSession | undefined;
|
|
3608
|
-
/**
|
|
3609
|
-
* Open an incremental reader over a codex store.
|
|
3610
|
-
*
|
|
3611
|
-
* Nothing is read until `read()` is called, and every read is bounded by the bytes appended since
|
|
3612
|
-
* the previous one, so a 695MB rollout is scanned once rather than once per turn.
|
|
3613
|
-
*/
|
|
3614
|
-
declare function createCodexRolloutStoreReader(ref: CodexRolloutStoreRef): CodexRolloutStoreReader;
|
|
3615
|
-
/** Sum two usage reports on every counter both of them state. */
|
|
3616
|
-
declare function addHarnessUsage(left: HarnessUsage, right: HarnessUsage): HarnessUsage;
|
|
3617
|
-
/** True when a report states any spend at all. */
|
|
3618
|
-
declare function harnessUsageIsEmpty(usage: HarnessUsage): boolean;
|
|
3619
|
-
//#endregion
|
|
3620
3594
|
//#region src/runtime/provider-placement.d.ts
|
|
3621
3595
|
/** Caller-declared execution placement. Matching never changes the authored profile.
|
|
3622
3596
|
* @experimental */
|
|
@@ -3774,56 +3748,6 @@ interface ProviderExecutorOptions {
|
|
|
3774
3748
|
* @experimental */
|
|
3775
3749
|
declare function providerAsExecutor(provider: AgentEnvironmentProvider, options?: ProviderExecutorOptions): ExecutorFactory<unknown>;
|
|
3776
3750
|
//#endregion
|
|
3777
|
-
//#region src/runtime/key-provider.d.ts
|
|
3778
|
-
/** Resolve named secrets. The ONE seam every secret store adapts to. */
|
|
3779
|
-
interface KeyProvider {
|
|
3780
|
-
/** The value for `name`, or `undefined` when this provider does not hold it. */
|
|
3781
|
-
get(name: string): Promise<string | undefined>;
|
|
3782
|
-
}
|
|
3783
|
-
/** The env-backed provider: reads the (dotenvx-loaded) process env. Empty /
|
|
3784
|
-
* whitespace-only values count as absent — fail loud, not with a blank key. */
|
|
3785
|
-
declare function envKeyProvider(env?: Record<string, string | undefined>): KeyProvider;
|
|
3786
|
-
/** The `AgentProfileMcpServer.metadata` key the declarative secret-env map
|
|
3787
|
-
* rides under: `{ ENV_VAR_NAME: 'PROVIDER_KEY_NAME' }`. Names only — values
|
|
3788
|
-
* are resolved at materialize time and never stored. */
|
|
3789
|
-
declare const mcpSecretEnvMetadataKey = "secretEnv";
|
|
3790
|
-
/** Read (and validate) a server entry's declared secret-env map, if any.
|
|
3791
|
-
* Malformed metadata throws — a half-declared secret must never half-boot. */
|
|
3792
|
-
declare function secretEnvOfMcpServer(server: AgentProfileMcpServer): Record<string, string> | undefined;
|
|
3793
|
-
/**
|
|
3794
|
-
* Resolve a declared secret-env map into the real env entries for a server
|
|
3795
|
-
* spawn. Fail-closed: no provider or a missing key throws, naming the KEY
|
|
3796
|
-
* NAME only (the value never appears in any message). `label` names the
|
|
3797
|
-
* server for the error (e.g. `profile.mcp['exa']`).
|
|
3798
|
-
*/
|
|
3799
|
-
declare function resolveSecretEnv(secretEnv: Record<string, string>, keys: KeyProvider | undefined, label: string): Promise<Record<string, string>>;
|
|
3800
|
-
/** The spawn-ready strings for one stdio MCP server: profile config values
|
|
3801
|
-
* resolved, secrets separated so the client can redact them. */
|
|
3802
|
-
interface ResolvedMcpServerLaunch {
|
|
3803
|
-
args?: string[];
|
|
3804
|
-
/** Public env, safe to appear in diagnostics. */
|
|
3805
|
-
env?: Record<string, string>;
|
|
3806
|
-
/** Resolved secret env. Reaches only the child process; redacted everywhere else. */
|
|
3807
|
-
protectedEnv?: Record<string, string>;
|
|
3808
|
-
}
|
|
3809
|
-
/**
|
|
3810
|
-
* Resolve a profile MCP server's `args`/`env` config values (interface ≥0.40
|
|
3811
|
-
* `AgentProfileConfigValue`) plus the legacy `metadata.secretEnv` channel into
|
|
3812
|
-
* the plain strings a spawn needs.
|
|
3813
|
-
*
|
|
3814
|
-
* Rules, all fail-closed:
|
|
3815
|
-
* - `args` must be public values. A secret-ref in argv is refused: argv is
|
|
3816
|
-
* readable by every host process (/proc/PID/cmdline) and outside the
|
|
3817
|
-
* protected-value redaction channel, so a secret there cannot be contained.
|
|
3818
|
-
* - `env` secret-refs resolve through the KeyProvider (missing provider or key
|
|
3819
|
-
* throws, naming the KEY NAME only) and land in `protectedEnv`.
|
|
3820
|
-
* - An env var declared secret on BOTH channels (env secret-ref and
|
|
3821
|
-
* metadata.secretEnv) is ambiguous configuration and throws.
|
|
3822
|
-
* - A public `env` entry shadowed by a legacy metadata secret keeps the
|
|
3823
|
-
* pre-0.40 spawn precedence: the secret value wins in the child env.
|
|
3824
|
-
*/
|
|
3825
|
-
declare function resolveMcpServerLaunch(server: AgentProfileMcpServer, keys: KeyProvider | undefined, label: string): Promise<ResolvedMcpServerLaunch>;
|
|
3826
|
-
//#endregion
|
|
3827
3751
|
//#region src/runtime/sandbox-events.d.ts
|
|
3828
3752
|
/** The provider/model the platform reports it actually bound to a turn, when it reports one.
|
|
3829
3753
|
* `source` is the platform's own account of where that choice came from — `environment` means
|
|
@@ -4067,13 +3991,341 @@ interface SandboxLeafOut {
|
|
|
4067
3991
|
outcome?: AgentRunOutcome;
|
|
4068
3992
|
}
|
|
4069
3993
|
//#endregion
|
|
4070
|
-
//#region src/runtime/
|
|
4071
|
-
/**
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
3994
|
+
//#region src/runtime/harness-usage.d.ts
|
|
3995
|
+
/**
|
|
3996
|
+
* One harness's own token-usage report for one turn, in the runtime's field names.
|
|
3997
|
+
*
|
|
3998
|
+
* `input` is the provider's TOTAL prompt count and `output` is its TOTAL completion count.
|
|
3999
|
+
* The other three counters CLASSIFY a part of one of those totals; none of them adds to it.
|
|
4000
|
+
* `cachedInput` and `cacheWriteInput` classify `input`, which is the convention
|
|
4001
|
+
* `promptCacheTokenClasses` (`util.ts`) folds: `freshInput = input - cacheRead - cacheWrite`.
|
|
4002
|
+
* `reasoningOutput` classifies `output`.
|
|
4003
|
+
*
|
|
4004
|
+
* A counter the harness does not report stays absent, because a zero would claim the harness
|
|
4005
|
+
* measured none.
|
|
4006
|
+
*/
|
|
4007
|
+
interface HarnessUsage {
|
|
4008
|
+
/** The harness family whose adapter produced this report. */
|
|
4009
|
+
readonly harness: HarnessType;
|
|
4010
|
+
/** Total prompt tokens the provider charged for the turn, the cached ones included. */
|
|
4011
|
+
readonly input: number;
|
|
4012
|
+
/** Total completion tokens the provider charged for the turn, the reasoning ones included. */
|
|
4013
|
+
readonly output: number;
|
|
4014
|
+
/** The part of `input` the provider served from its prompt cache. */
|
|
4015
|
+
readonly cachedInput?: number;
|
|
4016
|
+
/** The part of `input` the provider wrote into its prompt cache. */
|
|
4017
|
+
readonly cacheWriteInput?: number;
|
|
4018
|
+
/** The part of `output` the model spent on reasoning. Never added to `output`. */
|
|
4019
|
+
readonly reasoningOutput?: number;
|
|
4020
|
+
}
|
|
4021
|
+
/**
|
|
4022
|
+
* Decode a sandbox event with one harness's adapter, or `undefined` when the event carries no
|
|
4023
|
+
* harness-native usage.
|
|
4024
|
+
*
|
|
4025
|
+
* A NAMED harness reads with that harness's adapter only, and a named harness with no adapter
|
|
4026
|
+
* reports nothing. It never falls through to another harness's adapter: a different harness's
|
|
4027
|
+
* `turn.completed` decoded as codex would either drop the counters codex does not name or fail on
|
|
4028
|
+
* a field codex requires, and both answers would be about the wrong harness. The composite over
|
|
4029
|
+
* every registered adapter runs only when the caller cannot name the harness.
|
|
4030
|
+
*
|
|
4031
|
+
* Throws `ValidationError` when an adapter recognizes the event as its harness's usage carrier and
|
|
4032
|
+
* cannot read the numbers.
|
|
4033
|
+
*/
|
|
4034
|
+
declare function decodeHarnessUsage(event: SandboxEvent, harness?: HarnessType): HarnessUsage | undefined;
|
|
4035
|
+
//#endregion
|
|
4036
|
+
//#region src/runtime/codex-rollout-store.d.ts
|
|
4037
|
+
/** Who wrote one rollout, exactly as its own `session_meta` states it. Nothing here is inferred. */
|
|
4038
|
+
interface CodexRolloutIdentity {
|
|
4039
|
+
/** The rollout's own thread id (`session_meta.payload.id`). */
|
|
4040
|
+
readonly sessionId: string;
|
|
4041
|
+
/** The thread this one was spawned or forked from, when it was. */
|
|
4042
|
+
readonly parentThreadId?: string;
|
|
4043
|
+
/** The thread whose rows are prepended into this file, when this file is a fork. */
|
|
4044
|
+
readonly forkedFromId?: string;
|
|
4045
|
+
/** True when `thread_source` reads `subagent`: a harness-native child, invisible to the journal. */
|
|
4046
|
+
readonly nativeChild: boolean;
|
|
4047
|
+
/** The child's own path in the harness's agent tree (`/root/c1_b_grid`), when it has one. */
|
|
4048
|
+
readonly agentPath?: string;
|
|
4049
|
+
/** The harness's own nickname for the child ("Turing"), when it has one. */
|
|
4050
|
+
readonly agentNickname?: string;
|
|
4051
|
+
/** Spawn depth the harness recorded. `1` is a direct child of the seat. */
|
|
4052
|
+
readonly depth?: number;
|
|
4053
|
+
/** The working directory the session ran in, used to attribute a store to a workspace. */
|
|
4054
|
+
readonly cwd?: string;
|
|
4055
|
+
/** The codex build that wrote it. */
|
|
4056
|
+
readonly cliVersion?: string;
|
|
4057
|
+
/** When the session itself started, from its own `session_meta` timestamp. */
|
|
4058
|
+
readonly startedAtMs?: number;
|
|
4059
|
+
}
|
|
4060
|
+
/** How this reader isolated the session's own rows from the parent rows prepended to its file. */
|
|
4061
|
+
type CodexForkBoundary =
|
|
4062
|
+
/** Not a fork: every row in the file belongs to this session. */
|
|
4063
|
+
{
|
|
4064
|
+
readonly kind: 'whole-file';
|
|
4065
|
+
} |
|
|
4066
|
+
/** A fork whose own first turn was isolated, and by which rule. */
|
|
4067
|
+
{
|
|
4068
|
+
readonly kind: 'resolved';
|
|
4069
|
+
readonly rule: 'history-start-ordinal' | 'turn-is-session' | 'turn-uuid-v7' | 'turn-start-time';
|
|
4070
|
+
/** The `turn_id` of the session's own first turn. */
|
|
4071
|
+
readonly turnId?: string;
|
|
4072
|
+
/** Rows credited to the parent and excluded from `own`. */
|
|
4073
|
+
readonly inheritedTurns: number;
|
|
4074
|
+
} |
|
|
4075
|
+
/** A fork this reader could not isolate. `own` is absent; nothing may be charged. */
|
|
4076
|
+
{
|
|
4077
|
+
readonly kind: 'unresolved';
|
|
4078
|
+
readonly reason: string;
|
|
4079
|
+
};
|
|
4080
|
+
/** One turn of one session, with the counters it added to the session's cumulative total. */
|
|
4081
|
+
interface CodexRolloutTurn {
|
|
4082
|
+
readonly turnId?: string;
|
|
4083
|
+
readonly startedAtMs?: number;
|
|
4084
|
+
readonly usage: HarnessUsage;
|
|
4085
|
+
}
|
|
4086
|
+
/** One rollout file, read. */
|
|
4087
|
+
interface CodexRolloutSession {
|
|
4088
|
+
readonly identity: CodexRolloutIdentity;
|
|
4089
|
+
readonly boundary: CodexForkBoundary;
|
|
4090
|
+
/**
|
|
4091
|
+
* The session's OWN spend — the cumulative delta from its fork boundary to its last report.
|
|
4092
|
+
* ABSENT when the boundary is unresolved: an unattributable number must not be charged.
|
|
4093
|
+
*/
|
|
4094
|
+
readonly own?: HarnessUsage;
|
|
4095
|
+
/** The session's own turns, newest last. Empty when the file reported no usage. */
|
|
4096
|
+
readonly turns: readonly CodexRolloutTurn[];
|
|
4097
|
+
/**
|
|
4098
|
+
* The file's final cumulative `total_token_usage`, kept ONLY as the diagnostic that shows how
|
|
4099
|
+
* far a naive file total is from the truth. Never charge this.
|
|
4100
|
+
*/
|
|
4101
|
+
readonly fileCumulativeInput: number;
|
|
4102
|
+
readonly fileCumulativeOutput: number;
|
|
4103
|
+
}
|
|
4104
|
+
/** What one incremental read of a store observed. */
|
|
4105
|
+
interface CodexStoreDelta {
|
|
4106
|
+
/** Spend by sessions that are NOT native children — the seat's own turns. */
|
|
4107
|
+
readonly seat: HarnessUsage;
|
|
4108
|
+
/** Spend by `thread_source: subagent` sessions — the harness-native children. */
|
|
4109
|
+
readonly native: HarnessUsage;
|
|
4110
|
+
/** Sessions whose fork boundary could not be isolated, so their spend is absent, not zero. */
|
|
4111
|
+
readonly unresolved: ReadonlyArray<{
|
|
4112
|
+
readonly sessionId: string;
|
|
4113
|
+
readonly reason: string;
|
|
4114
|
+
}>;
|
|
4115
|
+
/**
|
|
4116
|
+
* Every session this read touched, for evidence. Each one states its WHOLE own spend and turn
|
|
4117
|
+
* list, which is not the same number as `seat` / `native`: those two carry only what this read
|
|
4118
|
+
* newly observed.
|
|
4119
|
+
*/
|
|
4120
|
+
readonly sessions: readonly CodexRolloutSession[];
|
|
4121
|
+
}
|
|
4122
|
+
/** A store reader that credits each turn once: it tails only the bytes appended since the last read. */
|
|
4123
|
+
interface CodexRolloutStoreReader {
|
|
4124
|
+
/**
|
|
4125
|
+
* Read everything appended since the previous call and attribute it.
|
|
4126
|
+
*
|
|
4127
|
+
* The FIRST call establishes the baseline. Call it before the first turn so pre-existing rows are
|
|
4128
|
+
* consumed and credited to nothing; every later call returns exactly that turn's spend.
|
|
4129
|
+
*/
|
|
4130
|
+
read(): Promise<CodexStoreDelta>;
|
|
4131
|
+
}
|
|
4132
|
+
/** Where a harness keeps its own session store, and which workspace may be credited from it. */
|
|
4133
|
+
interface CodexRolloutStoreRef {
|
|
4134
|
+
/**
|
|
4135
|
+
* Absolute path to the harness home the CLI writes into — `CODEX_HOME`, or `$HOME/.codex`.
|
|
4136
|
+
* This MUST be the run's own isolated store. Pointing it at an ambient host store credits one
|
|
4137
|
+
* run with another run's files, which is the exact defect this reader exists to end.
|
|
4138
|
+
*/
|
|
4139
|
+
readonly root: string;
|
|
4140
|
+
/**
|
|
4141
|
+
* Credit only sessions whose recorded `cwd` is this path or below it. Absent credits every
|
|
4142
|
+
* session under `root`, which is correct only for a store no other run writes to.
|
|
4143
|
+
*/
|
|
4144
|
+
readonly workspaceRoot?: string;
|
|
4145
|
+
}
|
|
4146
|
+
/**
|
|
4147
|
+
* Read one rollout's rows into a session record.
|
|
4148
|
+
*
|
|
4149
|
+
* `rows` is the file's JSON values in file order. Pass the whole file to read a completed session;
|
|
4150
|
+
* the store reader passes appended slices and carries the identity forward itself.
|
|
4151
|
+
*/
|
|
4152
|
+
declare function readCodexRolloutSession(rows: Iterable<unknown>): CodexRolloutSession | undefined;
|
|
4153
|
+
/**
|
|
4154
|
+
* Open an incremental reader over a codex store.
|
|
4155
|
+
*
|
|
4156
|
+
* Nothing is read until `read()` is called, and every read is bounded by the bytes appended since
|
|
4157
|
+
* the previous one, so a 695MB rollout is scanned once rather than once per turn.
|
|
4158
|
+
*/
|
|
4159
|
+
declare function createCodexRolloutStoreReader(ref: CodexRolloutStoreRef): CodexRolloutStoreReader;
|
|
4160
|
+
/** Sum two usage reports on every counter both of them state. */
|
|
4161
|
+
declare function addHarnessUsage(left: HarnessUsage, right: HarnessUsage): HarnessUsage;
|
|
4162
|
+
/** True when a report states any spend at all. */
|
|
4163
|
+
declare function harnessUsageIsEmpty(usage: HarnessUsage): boolean;
|
|
4164
|
+
//#endregion
|
|
4165
|
+
//#region src/runtime/key-provider.d.ts
|
|
4166
|
+
/** Resolve named secrets. The ONE seam every secret store adapts to. */
|
|
4167
|
+
interface KeyProvider {
|
|
4168
|
+
/** The value for `name`, or `undefined` when this provider does not hold it. */
|
|
4169
|
+
get(name: string): Promise<string | undefined>;
|
|
4170
|
+
}
|
|
4171
|
+
/** The env-backed provider: reads the (dotenvx-loaded) process env. Empty /
|
|
4172
|
+
* whitespace-only values count as absent — fail loud, not with a blank key. */
|
|
4173
|
+
declare function envKeyProvider(env?: Record<string, string | undefined>): KeyProvider;
|
|
4174
|
+
/** The `AgentProfileMcpServer.metadata` key the declarative secret-env map
|
|
4175
|
+
* rides under: `{ ENV_VAR_NAME: 'PROVIDER_KEY_NAME' }`. Names only — values
|
|
4176
|
+
* are resolved at materialize time and never stored. */
|
|
4177
|
+
declare const mcpSecretEnvMetadataKey = "secretEnv";
|
|
4178
|
+
/** Read (and validate) a server entry's declared secret-env map, if any.
|
|
4179
|
+
* Malformed metadata throws — a half-declared secret must never half-boot. */
|
|
4180
|
+
declare function secretEnvOfMcpServer(server: AgentProfileMcpServer): Record<string, string> | undefined;
|
|
4181
|
+
/**
|
|
4182
|
+
* Resolve a declared secret-env map into the real env entries for a server
|
|
4183
|
+
* spawn. Fail-closed: no provider or a missing key throws, naming the KEY
|
|
4184
|
+
* NAME only (the value never appears in any message). `label` names the
|
|
4185
|
+
* server for the error (e.g. `profile.mcp['exa']`).
|
|
4186
|
+
*/
|
|
4187
|
+
declare function resolveSecretEnv(secretEnv: Record<string, string>, keys: KeyProvider | undefined, label: string): Promise<Record<string, string>>;
|
|
4188
|
+
/** The spawn-ready strings for one stdio MCP server: profile config values
|
|
4189
|
+
* resolved, secrets separated so the client can redact them. */
|
|
4190
|
+
interface ResolvedMcpServerLaunch {
|
|
4191
|
+
args?: string[];
|
|
4192
|
+
/** Public env, safe to appear in diagnostics. */
|
|
4193
|
+
env?: Record<string, string>;
|
|
4194
|
+
/** Resolved secret env. Reaches only the child process; redacted everywhere else. */
|
|
4195
|
+
protectedEnv?: Record<string, string>;
|
|
4196
|
+
}
|
|
4197
|
+
/**
|
|
4198
|
+
* Resolve a profile MCP server's `args`/`env` config values (interface ≥0.40
|
|
4199
|
+
* `AgentProfileConfigValue`) plus the legacy `metadata.secretEnv` channel into
|
|
4200
|
+
* the plain strings a spawn needs.
|
|
4201
|
+
*
|
|
4202
|
+
* Rules, all fail-closed:
|
|
4203
|
+
* - `args` must be public values. A secret-ref in argv is refused: argv is
|
|
4204
|
+
* readable by every host process (/proc/PID/cmdline) and outside the
|
|
4205
|
+
* protected-value redaction channel, so a secret there cannot be contained.
|
|
4206
|
+
* - `env` secret-refs resolve through the KeyProvider (missing provider or key
|
|
4207
|
+
* throws, naming the KEY NAME only) and land in `protectedEnv`.
|
|
4208
|
+
* - An env var declared secret on BOTH channels (env secret-ref and
|
|
4209
|
+
* metadata.secretEnv) is ambiguous configuration and throws.
|
|
4210
|
+
* - A public `env` entry shadowed by a legacy metadata secret keeps the
|
|
4211
|
+
* pre-0.40 spawn precedence: the secret value wins in the child env.
|
|
4212
|
+
*/
|
|
4213
|
+
declare function resolveMcpServerLaunch(server: AgentProfileMcpServer, keys: KeyProvider | undefined, label: string): Promise<ResolvedMcpServerLaunch>;
|
|
4214
|
+
//#endregion
|
|
4215
|
+
//#region src/runtime/supervise/bridge-config.d.ts
|
|
4216
|
+
/**
|
|
4217
|
+
* cli-bridge seam. A local OpenAI-compatible bridge that fronts harness CLIs
|
|
4218
|
+
* (claude-code / opencode / kimi / pi) behind one HTTP surface. The spawned
|
|
4219
|
+
* `AgentProfile` is the sole harness/provider/model and behavioral authority and
|
|
4220
|
+
* is forwarded verbatim per request; this seam carries transport data only.
|
|
4221
|
+
*
|
|
4222
|
+
* The executor opens a resumable cli-bridge session. `sessionId` identifies the
|
|
4223
|
+
* harness conversation across turns; each turn also receives its own durable run id.
|
|
4224
|
+
* A dropped HTTP reader reattaches to that exact run and explicit cancel is the only
|
|
4225
|
+
* operation allowed to stop it. Omit `sessionId` and the executor mints one per spawn.
|
|
4226
|
+
*
|
|
4227
|
+
* ── HOW TO CONTROL WHAT THE HARNESS LOADS (there is no argv field, by design) ──
|
|
4228
|
+
*
|
|
4229
|
+
* A worker often needs the harness started in a KNOWN state — no ambient extensions, skills,
|
|
4230
|
+
* context files, or prompt templates — because ambient state is how a paired experiment silently
|
|
4231
|
+
* loses its pairing: an installed extension that persists memory across runs carries arm A's state
|
|
4232
|
+
* into arm B, and nothing reports it.
|
|
4233
|
+
*
|
|
4234
|
+
* That is what the spawned `AgentProfile` is FOR. `agent_profile`
|
|
4235
|
+
* rides every request verbatim, and cli-bridge maps it onto each harness's own native controls:
|
|
4236
|
+
*
|
|
4237
|
+
* - Materializing any profile at all already starts the harness isolated from ambient
|
|
4238
|
+
* workspace state — for pi that is `--no-context-files --no-skills --no-prompt-templates`,
|
|
4239
|
+
* applied to every request that carries an `agent_profile`.
|
|
4240
|
+
* - `AgentProfile.extensions.<harness>` is the named, per-harness control channel. An explicit
|
|
4241
|
+
* `extensions: { pi: { load: [] } }` disables ambient extension discovery outright
|
|
4242
|
+
* (pi's `--no-extensions`); listing package names loads exactly those and nothing else.
|
|
4243
|
+
* - `permissions` / `tools` / `mcp` map onto the harness's native tool and server controls.
|
|
4244
|
+
*
|
|
4245
|
+
* A caller therefore does NOT need to hand-roll an `Executor` to isolate a harness run, and the
|
|
4246
|
+
* profile expressing it stays portable: the same declaration means the same thing on a different
|
|
4247
|
+
* harness, whereas an argv string means nothing anywhere else.
|
|
4248
|
+
*
|
|
4249
|
+
* WHY NOT A GENERAL ARGV PASSTHROUGH. `bridgeUrl` addresses a process-spawning server. Forwarding
|
|
4250
|
+
* an arbitrary argv array to it would let any caller holding a bearer token choose the flags of a
|
|
4251
|
+
* process on the bridge host — which for real harness CLIs includes flags that load code from a
|
|
4252
|
+
* path, read a file into the prompt, redirect the working directory, or turn off the isolation the
|
|
4253
|
+
* bridge applies. cli-bridge deliberately confines workers (a filesystem jail and deny-by-default
|
|
4254
|
+
* network egress), and every one of those confinements is expressed as spawn configuration, so an
|
|
4255
|
+
* argv channel is a channel for unwinding them. It would also break this executor's own contract:
|
|
4256
|
+
* the durable-run replay protocol, session pinning, and streaming mode are all argv the bridge
|
|
4257
|
+
* owns, and a caller-supplied duplicate silently wins or corrupts the parse. The structured profile
|
|
4258
|
+
* channel is validated, per-harness, portable, and refuses controls it does not understand — keep
|
|
4259
|
+
* new harness capability there.
|
|
4260
|
+
*/
|
|
4261
|
+
interface BridgeSeam {
|
|
4262
|
+
bridgeUrl: string;
|
|
4263
|
+
bridgeBearer: string;
|
|
4264
|
+
/**
|
|
4265
|
+
* Optional request-scoped model credential.
|
|
4266
|
+
*
|
|
4267
|
+
* The key name is portable configuration. The provider is a live service and is intentionally
|
|
4268
|
+
* not serialised. Runtime resolves both values immediately before every bridge POST and sends
|
|
4269
|
+
* them only to a loopback bridge through private request headers.
|
|
4270
|
+
*/
|
|
4271
|
+
modelCredential?: BridgeModelCredential;
|
|
4272
|
+
/** Optional working directory forwarded to cli-bridge and persisted with the session. */
|
|
4273
|
+
cwd?: string;
|
|
4274
|
+
/**
|
|
4275
|
+
* The harness's OWN on-disk session store, read as a spend receipt.
|
|
4276
|
+
*
|
|
4277
|
+
* cli-bridge forwards no token usage for a codex worker, so a turn whose provider counters exist
|
|
4278
|
+
* only in codex's rollout meters `{0, 0}` with `tokensKnown: false`. Measured on one live seat
|
|
4279
|
+
* (discovery#80): 9 of 9 `metered` events read zero while 27,320,482 codex tokens sat in the same
|
|
4280
|
+
* run directory, 1,453,948 of them belonging to harness-native children the journal never saw.
|
|
4281
|
+
*
|
|
4282
|
+
* Naming the store here turns those rows into evidence. The executor tails it once per turn and
|
|
4283
|
+
* credits the DELTA, so each turn is charged once, and it reports the counters with
|
|
4284
|
+
* `provenance: 'harness-store'` so a reader can tell a disk receipt from a stream receipt.
|
|
4285
|
+
*
|
|
4286
|
+
* The path must be the run's OWN isolated store. An ambient host store credits this run with
|
|
4287
|
+
* another run's files, and `workspaceRoot` is the structural guard against it.
|
|
4288
|
+
*/
|
|
4289
|
+
harnessStore?: BridgeHarnessStore;
|
|
4290
|
+
/** Caller-owned deadline for each bridge turn. Runtime enforces it locally and sends the
|
|
4291
|
+
* same value in `execution.timeoutMs` so the bridge-owned process follows the same policy. */
|
|
4292
|
+
timeoutMs?: number;
|
|
4293
|
+
/** Stable, caller-owned cli-bridge session id for harness-side resume. Defaults
|
|
4294
|
+
* to a freshly minted per-spawn id so each worker is its own resumable session. */
|
|
4295
|
+
sessionId?: string;
|
|
4296
|
+
/** Transport reconnects allowed after the first POST. Default 3; set 0 to disable. */
|
|
4297
|
+
maxReconnects?: number;
|
|
4298
|
+
/** Newest-last activity window `progress()` reports. Default 12. */
|
|
4299
|
+
activityWindow?: number;
|
|
4300
|
+
}
|
|
4301
|
+
/**
|
|
4302
|
+
* A harness's own session store on the bridge host, named so the runtime may read it.
|
|
4303
|
+
*
|
|
4304
|
+
* Only `codex` has a reader today. Any other harness is REFUSED rather than read with codex's
|
|
4305
|
+
* decoder: a different harness's file decoded as a codex rollout would either drop counters it does
|
|
4306
|
+
* not name or credit a number that is about the wrong wire shape.
|
|
4307
|
+
*/
|
|
4308
|
+
interface BridgeHarnessStore extends CodexRolloutStoreRef {
|
|
4309
|
+
/** The harness family that wrote the store. */
|
|
4310
|
+
readonly harness: HarnessType;
|
|
4311
|
+
}
|
|
4312
|
+
/** A live, request-scoped model credential reference for a local cli-bridge. */
|
|
4313
|
+
interface BridgeModelCredential {
|
|
4314
|
+
/** Provider key name for the scoped model token. */
|
|
4315
|
+
key: string;
|
|
4316
|
+
/** Provider key name for the exact scoped HTTPS model gateway URL. */
|
|
4317
|
+
baseUrlKey: string;
|
|
4318
|
+
/** Live credential service. Runtime retains this reference through reusable captures. */
|
|
4319
|
+
provider: KeyProvider;
|
|
4320
|
+
}
|
|
4321
|
+
//#endregion
|
|
4322
|
+
//#region src/runtime/supervise/inbox.d.ts
|
|
4323
|
+
/** A message from the run's AUTHORITY — the parent driver. These two kinds carry instruction. */
|
|
4324
|
+
interface AuthorityInboxMessage {
|
|
4325
|
+
readonly kind: 'steer' | 'answer';
|
|
4326
|
+
readonly text: string;
|
|
4327
|
+
/** Forceful messages abort the in-flight turn; queued ones wait for the boundary flush. */
|
|
4328
|
+
readonly interrupt: boolean;
|
|
4077
4329
|
/** Present for an `answer` — the question id it resolves. */
|
|
4078
4330
|
readonly questionId?: string;
|
|
4079
4331
|
}
|
|
@@ -4321,111 +4573,6 @@ interface CliWorktreeBridgeSeam {
|
|
|
4321
4573
|
/** Transport reconnects allowed after the first POST. Default 3; set 0 to disable. */
|
|
4322
4574
|
maxReconnects?: number;
|
|
4323
4575
|
}
|
|
4324
|
-
/**
|
|
4325
|
-
* cli-bridge seam. A local OpenAI-compatible bridge that fronts harness CLIs
|
|
4326
|
-
* (claude-code / opencode / kimi / pi) behind one HTTP surface. The spawned
|
|
4327
|
-
* `AgentProfile` is the sole harness/provider/model and behavioral authority and
|
|
4328
|
-
* is forwarded verbatim per request; this seam carries transport data only.
|
|
4329
|
-
*
|
|
4330
|
-
* The executor opens a resumable cli-bridge session. `sessionId` identifies the
|
|
4331
|
-
* harness conversation across turns; each turn also receives its own durable run id.
|
|
4332
|
-
* A dropped HTTP reader reattaches to that exact run and explicit cancel is the only
|
|
4333
|
-
* operation allowed to stop it. Omit `sessionId` and the executor mints one per spawn.
|
|
4334
|
-
*
|
|
4335
|
-
* ── HOW TO CONTROL WHAT THE HARNESS LOADS (there is no argv field, by design) ──
|
|
4336
|
-
*
|
|
4337
|
-
* A worker often needs the harness started in a KNOWN state — no ambient extensions, skills,
|
|
4338
|
-
* context files, or prompt templates — because ambient state is how a paired experiment silently
|
|
4339
|
-
* loses its pairing: an installed extension that persists memory across runs carries arm A's state
|
|
4340
|
-
* into arm B, and nothing reports it.
|
|
4341
|
-
*
|
|
4342
|
-
* That is what the spawned `AgentProfile` is FOR. `agent_profile`
|
|
4343
|
-
* rides every request verbatim, and cli-bridge maps it onto each harness's own native controls:
|
|
4344
|
-
*
|
|
4345
|
-
* - Materializing any profile at all already starts the harness isolated from ambient
|
|
4346
|
-
* workspace state — for pi that is `--no-context-files --no-skills --no-prompt-templates`,
|
|
4347
|
-
* applied to every request that carries an `agent_profile`.
|
|
4348
|
-
* - `AgentProfile.extensions.<harness>` is the named, per-harness control channel. An explicit
|
|
4349
|
-
* `extensions: { pi: { load: [] } }` disables ambient extension discovery outright
|
|
4350
|
-
* (pi's `--no-extensions`); listing package names loads exactly those and nothing else.
|
|
4351
|
-
* - `permissions` / `tools` / `mcp` map onto the harness's native tool and server controls.
|
|
4352
|
-
*
|
|
4353
|
-
* A caller therefore does NOT need to hand-roll an `Executor` to isolate a harness run, and the
|
|
4354
|
-
* profile expressing it stays portable: the same declaration means the same thing on a different
|
|
4355
|
-
* harness, whereas an argv string means nothing anywhere else.
|
|
4356
|
-
*
|
|
4357
|
-
* WHY NOT A GENERAL ARGV PASSTHROUGH. `bridgeUrl` addresses a process-spawning server. Forwarding
|
|
4358
|
-
* an arbitrary argv array to it would let any caller holding a bearer token choose the flags of a
|
|
4359
|
-
* process on the bridge host — which for real harness CLIs includes flags that load code from a
|
|
4360
|
-
* path, read a file into the prompt, redirect the working directory, or turn off the isolation the
|
|
4361
|
-
* bridge applies. cli-bridge deliberately confines workers (a filesystem jail and deny-by-default
|
|
4362
|
-
* network egress), and every one of those confinements is expressed as spawn configuration, so an
|
|
4363
|
-
* argv channel is a channel for unwinding them. It would also break this executor's own contract:
|
|
4364
|
-
* the durable-run replay protocol, session pinning, and streaming mode are all argv the bridge
|
|
4365
|
-
* owns, and a caller-supplied duplicate silently wins or corrupts the parse. The structured profile
|
|
4366
|
-
* channel is validated, per-harness, portable, and refuses controls it does not understand — keep
|
|
4367
|
-
* new harness capability there.
|
|
4368
|
-
*/
|
|
4369
|
-
interface BridgeSeam {
|
|
4370
|
-
bridgeUrl: string;
|
|
4371
|
-
bridgeBearer: string;
|
|
4372
|
-
/**
|
|
4373
|
-
* Optional request-scoped model credential.
|
|
4374
|
-
*
|
|
4375
|
-
* The key name is portable configuration. The provider is a live service and is intentionally
|
|
4376
|
-
* not serialised. Runtime resolves both values immediately before every bridge POST and sends
|
|
4377
|
-
* them only to a loopback bridge through private request headers.
|
|
4378
|
-
*/
|
|
4379
|
-
modelCredential?: BridgeModelCredential;
|
|
4380
|
-
/** Optional working directory forwarded to cli-bridge and persisted with the session. */
|
|
4381
|
-
cwd?: string;
|
|
4382
|
-
/**
|
|
4383
|
-
* The harness's OWN on-disk session store, read as a spend receipt.
|
|
4384
|
-
*
|
|
4385
|
-
* cli-bridge forwards no token usage for a codex worker, so a turn whose provider counters exist
|
|
4386
|
-
* only in codex's rollout meters `{0, 0}` with `tokensKnown: false`. Measured on one live seat
|
|
4387
|
-
* (discovery#80): 9 of 9 `metered` events read zero while 27,320,482 codex tokens sat in the same
|
|
4388
|
-
* run directory, 1,453,948 of them belonging to harness-native children the journal never saw.
|
|
4389
|
-
*
|
|
4390
|
-
* Naming the store here turns those rows into evidence. The executor tails it once per turn and
|
|
4391
|
-
* credits the DELTA, so each turn is charged once, and it reports the counters with
|
|
4392
|
-
* `provenance: 'harness-store'` so a reader can tell a disk receipt from a stream receipt.
|
|
4393
|
-
*
|
|
4394
|
-
* The path must be the run's OWN isolated store. An ambient host store credits this run with
|
|
4395
|
-
* another run's files, and `workspaceRoot` is the structural guard against it.
|
|
4396
|
-
*/
|
|
4397
|
-
harnessStore?: BridgeHarnessStore;
|
|
4398
|
-
/** Caller-owned deadline for each bridge turn. Runtime enforces it locally and sends the
|
|
4399
|
-
* same value in `execution.timeoutMs` so the bridge-owned process follows the same policy. */
|
|
4400
|
-
timeoutMs?: number;
|
|
4401
|
-
/** Stable, caller-owned cli-bridge session id for harness-side resume. Defaults
|
|
4402
|
-
* to a freshly minted per-spawn id so each worker is its own resumable session. */
|
|
4403
|
-
sessionId?: string;
|
|
4404
|
-
/** Transport reconnects allowed after the first POST. Default 3; set 0 to disable. */
|
|
4405
|
-
maxReconnects?: number;
|
|
4406
|
-
/** Newest-last activity window `progress()` reports. Default 12. */
|
|
4407
|
-
activityWindow?: number;
|
|
4408
|
-
}
|
|
4409
|
-
/**
|
|
4410
|
-
* A harness's own session store on the bridge host, named so the runtime may read it.
|
|
4411
|
-
*
|
|
4412
|
-
* Only `codex` has a reader today. Any other harness is REFUSED rather than read with codex's
|
|
4413
|
-
* decoder: a different harness's file decoded as a codex rollout would either drop counters it does
|
|
4414
|
-
* not name or credit a number that is about the wrong wire shape.
|
|
4415
|
-
*/
|
|
4416
|
-
interface BridgeHarnessStore extends CodexRolloutStoreRef {
|
|
4417
|
-
/** The harness family that wrote the store. */
|
|
4418
|
-
readonly harness: HarnessType;
|
|
4419
|
-
}
|
|
4420
|
-
/** A live, request-scoped model credential reference for a local cli-bridge. */
|
|
4421
|
-
interface BridgeModelCredential {
|
|
4422
|
-
/** Provider key name for the scoped model token. */
|
|
4423
|
-
key: string;
|
|
4424
|
-
/** Provider key name for the exact scoped HTTPS model gateway URL. */
|
|
4425
|
-
baseUrlKey: string;
|
|
4426
|
-
/** Live credential service. Runtime retains this reference through reusable captures. */
|
|
4427
|
-
provider: KeyProvider;
|
|
4428
|
-
}
|
|
4429
4576
|
/**
|
|
4430
4577
|
* Generic environment provider executor config. External packages implement
|
|
4431
4578
|
* `AgentEnvironmentProvider`; this built-in wrapper lets `createExecutor` consume them as backend
|
|
@@ -4665,5 +4812,5 @@ declare function streamAgentTurn(backend: AgentTurnBackend, input: AgentTurnInpu
|
|
|
4665
4812
|
*/
|
|
4666
4813
|
declare function collectAgentTurn(stream: AsyncIterable<RuntimeStreamEvent>): Promise<CollectedAgentTurn>;
|
|
4667
4814
|
//#endregion
|
|
4668
|
-
export {
|
|
4669
|
-
//# sourceMappingURL=stream-agent-turn-
|
|
4815
|
+
export { decodeHarnessUsage as $, RetainedRunCancellation as $a, SanitizedKnowledgeRequirement as $i, Redactor as $n, SteerableRootHandle as $r, WorktreeCommandResult as $t, createInbox as A, createActivityLog as Aa, LoopSpanNode as Ai, ToolLoopToolCall as An, ProfileMaterializationReceipt as Ar, CreateAgentEnvironmentInput$1 as At, secretEnvOfMcpServer as B, NativeContextContinuationHandle as Ba, createOtelExporter as Bi, PeerMailRefusal as Bn, RootProviderModelEvidence as Br, SandboxClientProviderOptions as Bt, SteerableSandboxArgs as C, sandboxSessionTraceSource as Ca, readTraceContextFromEnv as Ci, RouterTransportConfig as Cn, MaterializedExecutionIdentity as Cr, AgentProfileRef$1 as Ct, Inbox as D, ExecutorProgress as Da, EvalRunsExportConfig as Di, ToolLoopCompaction as Dn, NodeId as Dr, AgentTurnResult$2 as Dt, AuthorityInboxMessage as E, DEFAULT_STALL_AFTER_MS as Ea, EvalRunGeneration as Ei, ToolLoopChat as En, NodeExecutionIdentity as Er, AgentSessionStatus$1 as Et, ResolvedMcpServerLaunch as F, RetainedInteractiveEnvironmentInput as Fa, RuntimeEventOtelOptions as Fi, PeerMailEvent as Fn, ResultBlobStore as Fr, ProviderAsSandboxClientOptions as Ft, CodexRolloutStoreRef as G, RecoverRetainedRunResult as Ga, padTraceId as Gi, createPeerMailbox as Gn, SpawnEvent as Gr, resolveAgentEnvironmentProvider as Gt, CodexRolloutIdentity as H, ReconnectRetainedRunOptions as Ha, generateSpanId as Hi, PeerMailbox as Hn, Runtime as Hr, createAgentEnvironmentProviderRegistry as Ht, envKeyProvider as I, RetainedInteractiveRunHandle as Ia, buildLoopOtelSpans as Ii, PeerMailKind as In, ResumedKeyState as Ir, ProviderExecutorOptions as It, addHarnessUsage as J, RetainedInteractiveIntentAdmission as Ja, RuntimeStreamEventCollector as Ji, peerMailVerbNames as Jn, SpawnPrior as Jr, SandboxControlClient as Jt, CodexRolloutTurn as K, RetainedInteractiveAdmission as Ka, toOtelAttributes as Ki, isPeerMailEnvelope as Kn, SpawnJournal as Kr, sandboxClientAsProvider as Kt, mcpSecretEnvMetadataKey as L, RetainedInteractiveStartMaterial as La, buildLoopSpanNodes as Li, PeerMailLimits as Ln, ResumedWork as Lr, ProviderLeafOut as Lt, BridgeModelCredential as M, ReconnectRetainedInteractiveRunOptions as Ma, OtelExportConfig as Mi, DEFAULT_PEER_MAIL_LIMITS as Mn, ProviderModelExecutionEvidence as Mr, ExecResult as Mt, BridgeSeam as N, RecoverRetainedInteractiveRunOptions as Na, OtelExporter as Ni, PEER_MAIL_WIRE_KEY as Nn, ResourceLimit as Nr, ForkRequest as Nt, InboxMessage as O, ScopeProgressInput as Oa, EvalRunsExportResult as Oi, ToolLoopCompactionOptions as On, NodeSnapshot as Or, CheckpointRef as Ot, KeyProvider as P, RetainedInteractiveAdmissionHook as Pa, OtelSpan as Pi, PeerMailEnvelope as Pn, ResourceSpend as Pr, PlacementInfo as Pt, HarnessUsage as Q, RetainedRunCancelOptions as Qa, SanitizedKnowledgeReadinessReport as Qi, McpTransport as Qn, SpendGap as Qr, WorktreeCheckRunner as Qt, resolveMcpServerLaunch as R, StartRetainedInteractiveRunOptions as Ra, buildRuntimeEventOtelSpans as Ri, PeerMailOutcome as Rn, RootHandle as Rr, ProviderPromptOptions as Rt, SandboxSteeringOptions as S, decodeToolPart as Sa, mergeTraceEnv as Si, runLocalHarness as Sn, Handle as Sr, AgentEnvironmentSummary as St, createSteerableSandboxSession as T, ActivityNote as Ta, EvalRunEvent as Ti, ToolLoopCallContext as Tn, NoWinnerError as Tr, AgentSessionRef as Tt, CodexRolloutSession as U, RecoverRetainedRunIntentOptions as Ua, loopEventToOtelSpan as Ui, PeerMailboxOptions as Un, Scope as Ur, providerAsExecutor as Ut, CodexForkBoundary as V, NativeContextContinuationInput as Va, exportEvalRuns as Vi, PeerMailSendInput as Vn, RootSignal as Vr, WorkspaceRequest as Vt, CodexRolloutStoreReader as W, RecoverRetainedRunOptions as Wa, padSpanId as Wi, claimsAuthority as Wn, Settled as Wr, providerAsSandboxClient as Wt, harnessUsageIsEmpty as X, RetainedRunAdmission as Xa, RuntimeStreamEventSummary as Xi, JsonRpcResponse as Xn, Spend as Xr, ProviderPlacement as Xt, createCodexRolloutStoreReader as Y, RetainedInteractiveStartedAdmission as Ya, RuntimeStreamEventSink as Yi, JsonRpcMessage as Yn, SpawnRejection as Yr, createTangleSandboxExactProcessProvider as Yt, readCodexRolloutSession as Z, RetainedRunAdmissionHook as Za, RuntimeTelemetryOptions as Zi, McpToolDescriptor as Zn, SpendChannel as Zr, InPlaceHarnessResult as Zt, cliInPlaceExecutor as _, SessionMessageLike as _a, workerTraceEnv as _i, LocalHarnessResult as _n, createBudgetPool as _o, ExecutorProgressEvent as _r, AgentEnvironmentProvider$1 as _t, StreamAgentTurnOptions as a, PendingWait as aa, UnconfirmedTeardown as ai, GitRunner as an, RetainedRunIntentAdmission as ao, Budget as ar, assertSandboxServedModel as at, createExecutorRegistry as b, TraceSource as ba, TraceContext as bi, localHarnessExecutable as bn, ExecutorTeardownWarning as br, AgentEnvironmentQuery as bt, CliInPlaceSeam as c, WaitProbeRegistry as ca, WaitOpts as ci, captureWorktreeDiff as cn, RetainedRunStartMaterial as co, Executor as cr, extractLlmCallEvent as ct, CliWorktreeSeam as d, createWaitProbes as da, WorkerInteractiveUnavailableReason as di, CodexExecutionEvidence as dn, StartRetainedRunOptions as do, ExecutorCancellationRequest as dr, sandboxEventServedBackend as dt, createRuntimeEventCollector as ea, SupervisedResult as ei, WorktreeHarnessResult as en, RetainedRunDispatchedAdmission as eo, defaultRedactor as er, SandboxLeafOut as et, ExecutorConfig as f, isWaitOutcome as fa, WorkerTraceEvidence as fi, CodexExecutionPolicy as fn, BudgetPool as fo, ExecutorContext as fr, sandboxProgressEvents as ft, SandboxSeam as g, waitUntil as ga, readWorkerTraceContext as gi, LocalHarness as gn, ReservationTicket as go, ExecutorNodeContext as gr, AgentEnvironmentEvent$1 as gt, RouterToolsSeam as h, validateWaitSpec as ha, WorkerTraceSeamCarrier as hi, LOCAL_HARNESSES as hn, ReservationRejection as ho, ExecutorMaterialization as hr, AgentEnvironmentCapabilities$1 as ht, CollectedAgentTurn as i, sanitizeRuntimeStreamEvent as ia, TreeView as ii, DiffResult as in, RetainedRunHandle as io, AgentSpec as ir, SandboxUsageLedger as it, BridgeHarnessStore as j, readWorkerProgress as ja, OtelAttribute as ji, AUTHORITY_MARKERS as jn, ProviderModelAttemptEvidence as jr, ExecRequest as jt, PeerInboxMessage as k, WorkerProgress as ka, INTELLIGENCE_WIRE_VERSION as ki, ToolLoopMessageRecord as kn, NodeStatus as kr, CheckpointRequest as kt, CliSeam as l, WaitRejection as la, WidenGate as li, createWorktree as ln, RetainedRunTurnInput as lo, ExecutorAccounting as lr, mapSandboxEvent as lt, RouterSeam as m, timerAt as ma, WorkerTraceResolver as mi, DEFAULT_LOCAL_HARNESS as mn, BudgetReadout as mo, ExecutorFactory as mr, AgentEnvironment$1 as mt, AgentTurnInput$1 as n, sanitizeAgentRuntimeEvent as na, SupervisorOpts as ni, CreateWorktreeOptions as nn, RetainedRunEnvironmentAdmission as no, Agent as nr, SandboxServedBackend as nt, collectAgentTurn as o, WaitOutcome as oa, UnknownMaterializationReason as oi, RemoveWorktreeOptions as on, RetainedRunReplayPoint as oo, DefaultVerdict as or, createSandboxToolPartState as ot, ProviderSeam as p, pollFor as pa, WorkerTraceUnavailableReason as pi, CodexTokenUsage as pn, BudgetPoolRestore as po, ExecutorExecutionBinding as pr, sumSandboxUsage as pt, CodexStoreDelta as q, RetainedInteractiveEnvironmentAdmission as qa, RuntimeEventCollector as qi, peerMailTools as qn, SpawnOpts as qr, CreateTangleSandboxExactProcessProviderOptions as qt, AgentTurnUsage as r, sanitizeKnowledgeReadinessReport as ra, TokenUsageProvenance as ri, DiffOptions as rn, RetainedRunEventOptions as ro, AgentExecutionRef as rr, SandboxToolPartState as rt, streamAgentTurn as s, WaitProbe as sa, UsageEvent as si, WorktreeHandle as sn, RetainedRunSnapshot as so, ExecutionBindingReceipt as sr, createSandboxUsageLedger as st, AgentTurnBackend as t, createRuntimeStreamEventCollector as ta, Supervisor as ti, WorktreeProfileMaterializationReceipt as tn, RetainedRunEffect as to, resolveRedactor as tr, SandboxOutputMarker as tt, CliWorktreeBridgeSeam as u, WaitSpec as ua, WorkerInteractiveSession as ui, removeWorktree as un, StartRetainedRunInEnvironmentOptions as uo, ExecutorCancellation as ur, mapSandboxToolEvent as ut, cliWorktreeExecutor as v, SessionTraceBox as va, workerTraceHeaders as vi, RunLocalHarnessOptions as vn, spendFromUsageEvents as vo, ExecutorRegistry as vr, AgentEnvironmentProviderRef as vt, SteerableSandboxSession as w, ActivityLog as wa, traceContextToEnv as wi, ToolSpec as wn, MaterializedModelIdentity as wr, AgentSession as wt, DEFAULT_SANDBOX_STEERING_MAX_TURNS as x, createPushTraceSource as xa, createPropagatingTraceEmitter as xi, parseCodexTokenUsage as xn, ExecutorToolCall as xr, AgentEnvironmentStatus as xt, createExecutor as y, ToolStepInput as ya, workerTraceSeamKey as yi, harnessSupportsReasoningEffort as yn, ExecutorResult as yr, AgentEnvironmentProviderRegistry as yt, resolveSecretEnv as z, NativeContextContinuationExecution as za, createOpenInferenceFileExporter as zi, PeerMailReadout as zn, RootMaterialization as zr, ResourceRequest as zt };
|
|
4816
|
+
//# sourceMappingURL=stream-agent-turn-BXZMQQ0K.d.ts.map
|