@effect-agent/storage-cloudflare 0.1.0-beta.8 → 0.1.0-beta.81

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.
Files changed (73) hide show
  1. package/dist/DoMemoryStore.d.mts +29 -0
  2. package/dist/DoMemoryStore.mjs +55 -0
  3. package/dist/DoMemoryStore.mjs.map +1 -0
  4. package/dist/DoMessageDeliveryStore.d.mts +17 -0
  5. package/dist/DoMessageDeliveryStore.mjs +32 -0
  6. package/dist/DoMessageDeliveryStore.mjs.map +1 -0
  7. package/dist/DoScheduleStore.d.mts +36 -0
  8. package/dist/DoScheduleStore.mjs +388 -0
  9. package/dist/DoScheduleStore.mjs.map +1 -0
  10. package/dist/DoStorageConfig.d.mts +45 -0
  11. package/dist/DoStorageConfig.mjs +52 -0
  12. package/dist/DoStorageConfig.mjs.map +1 -0
  13. package/dist/DoStorageError-Cmhvl4TQ.d.mts +98 -0
  14. package/dist/DoStorageError.d.mts +2 -0
  15. package/dist/DoStorageError.mjs +164 -0
  16. package/dist/DoStorageError.mjs.map +1 -0
  17. package/dist/DoStorageFailpoint.d.mts +17 -0
  18. package/dist/DoStorageFailpoint.mjs +14 -0
  19. package/dist/DoStorageFailpoint.mjs.map +1 -0
  20. package/dist/DoStorageFailpointTesting.d.mts +34 -0
  21. package/dist/DoStorageFailpointTesting.mjs +35 -0
  22. package/dist/DoStorageFailpointTesting.mjs.map +1 -0
  23. package/dist/DoStorageVersion-x5OOurvZ.d.mts +12 -0
  24. package/dist/DoStorageVersion.d.mts +2 -0
  25. package/dist/DoStorageVersion.mjs +8 -0
  26. package/dist/DoStorageVersion.mjs.map +1 -0
  27. package/dist/DoSubmissionLedger.d.mts +23 -0
  28. package/dist/DoSubmissionLedger.mjs +1849 -0
  29. package/dist/DoSubmissionLedger.mjs.map +1 -0
  30. package/dist/DoSubscriptionStore.d.mts +25 -0
  31. package/dist/DoSubscriptionStore.mjs +183 -0
  32. package/dist/DoSubscriptionStore.mjs.map +1 -0
  33. package/dist/DoThreadStore.d.mts +59 -0
  34. package/dist/DoThreadStore.mjs +465 -0
  35. package/dist/DoThreadStore.mjs.map +1 -0
  36. package/dist/MemoryProtocol.d.mts +38160 -0
  37. package/dist/MemoryProtocol.mjs +219 -0
  38. package/dist/MemoryProtocol.mjs.map +1 -0
  39. package/dist/PortProtocol.d.mts +3207 -0
  40. package/dist/PortProtocol.mjs +176 -0
  41. package/dist/PortProtocol.mjs.map +1 -0
  42. package/dist/PortRouting.d.mts +83 -0
  43. package/dist/PortRouting.mjs +410 -0
  44. package/dist/PortRouting.mjs.map +1 -0
  45. package/dist/do-journal-DHqCQeBU.mjs +991 -0
  46. package/dist/do-journal-DHqCQeBU.mjs.map +1 -0
  47. package/dist/index.d.mts +14 -1521
  48. package/dist/index.mjs +14 -3695
  49. package/dist/migrations-Ba_kOrSx.mjs +287 -0
  50. package/dist/migrations-Ba_kOrSx.mjs.map +1 -0
  51. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  52. package/package.json +1 -45
  53. package/src/DoMemoryStore.ts +59 -0
  54. package/src/DoMessageDeliveryStore.ts +53 -0
  55. package/src/DoScheduleStore.ts +622 -0
  56. package/src/{errors.ts → DoStorageError.ts} +10 -3
  57. package/src/DoStorageFailpoint.ts +20 -0
  58. package/src/{do-storage-failpoint.ts → DoStorageFailpointTesting.ts} +5 -18
  59. package/src/DoStorageVersion.ts +2 -0
  60. package/src/{do-ledger.ts → DoSubmissionLedger.ts} +862 -163
  61. package/src/DoSubscriptionStore.ts +329 -0
  62. package/src/DoThreadStore.ts +1014 -0
  63. package/src/MemoryProtocol.ts +355 -0
  64. package/src/{port-protocol.ts → PortProtocol.ts} +44 -37
  65. package/src/{routing.ts → PortRouting.ts} +292 -264
  66. package/src/index.ts +13 -32
  67. package/src/{do-journal.ts → internal/do-journal.ts} +716 -232
  68. package/src/internal/message-delivery-schema.ts +24 -0
  69. package/src/{migrations.ts → internal/migrations.ts} +51 -35
  70. package/src/internal/recovery-checkpoint-schema.ts +17 -0
  71. package/dist/index.mjs.map +0 -1
  72. package/src/do-conversation-store.ts +0 -850
  73. /package/src/{do-storage-config.ts → DoStorageConfig.ts} +0 -0
@@ -0,0 +1,3207 @@
1
+ import { Schema } from "effect";
2
+ import { CanonicalRecordEnvelope } from "@effect-agent/thread/Records";
3
+ import { AppendConflict, AppendResult, FenceRejected, FencedAppendRequest, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadRead, ThreadStoreError, ThreadTail, ThreadTailRequest } from "@effect-agent/thread/ThreadStore";
4
+ import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionPolicyError, AdmissionRequest, AdmissionResult, ChildSettledNotification, JoinedToHost, LedgerError, MarkReadyRequest, SettlementConflict, SubmissionLookupByKey, SubmissionSnapshot } from "@effect-agent/thread/SubmissionLedger";
5
+ declare namespace PortProtocol_d_exports {
6
+ export { LedgerAdmitCall, LedgerAdmitResult, LedgerLookupCall, LedgerLookupResult, LedgerMarkReadyCall, LedgerMarkReadyResult, LedgerRecordChildSettledCall, LedgerRecordChildSettledResult, LedgerRequestAbortCall, LedgerRequestAbortResult, LedgerResolveAdmissionCall, LedgerResolveAdmissionResult, MAX_PORT_DIAGNOSTIC_LENGTH, PortFailed, PortFailure, PortProtocolError, PortRequest, PortRequestEnvelope, PortResponse, PortResponseEnvelope, PortResult, PortSucceeded, StoreAppendCall, StoreAppendResult, StoreExportCall, StoreExportResult, StoreInspectTailCall, StoreInspectTailResult, StoreMaterializeCall, StoreMaterializeResult, StoreReadPageCall, StoreReadPageResult, boundPortDiagnostic, decodePortRequest, decodePortResponse, encodePortRequest, encodePortResponse };
7
+ }
8
+ /**
9
+ * The cross-Durable-Object port protocol (plan §1.3, D-P6-3): Schema request/response/error
10
+ * envelopes for the CLOSED route-capable subset of the thread ports. One Thread's
11
+ * Durable Object executes another Thread's request against its OWN local facets; the
12
+ * envelopes here are the only values that cross the Object boundary, and they are
13
+ * transport-agnostic — native Durable Object JS RPC is the shipped carrier, fetch-with-JSON
14
+ * the documented fallback, and both move the same Schema-encoded JSON.
15
+ *
16
+ * The closed subset is exactly the set of operations the durable coordinator performs against
17
+ * a FOREIGN Thread (parent/child establishment, status checks, abort propagation,
18
+ * child-settlement notification, and the child-thread store operations used by
19
+ * establishment, `verifySettledChild`, and result projection):
20
+ *
21
+ * - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,
22
+ * `recordChildSettled`;
23
+ * - store: `materialize`, `append`, `read` (one page), `inspectTail`, `export`.
24
+ *
25
+ * Every other port operation is lane-local and has no envelope. A foreign disposable
26
+ * recovery-cache load returns a miss so the caller can replay canonical history. Other
27
+ * foreign operations fail fast and typed instead of widening the distributed surface.
28
+ *
29
+ * Failures cross the boundary as the `PortFailure` union and re-decode on the caller side to
30
+ * the SAME tagged error types the local facet would have produced, so routed calls keep
31
+ * error-tag fidelity. `cause` chains inside `LedgerError`/`ThreadStoreError` travel as
32
+ * Schema defects and do not claim instance fidelity across Objects (plan §2.8).
33
+ */
34
+ /** Ceiling for protocol diagnostic strings; matches `AdmissionIndeterminate.reason`. */
35
+ declare const MAX_PORT_DIAGNOSTIC_LENGTH = 4096;
36
+ /** Truncate a diagnostic string to the protocol's bounded diagnostic length. */
37
+ declare const boundPortDiagnostic: (value: string) => string;
38
+ declare const PortProtocolError_base: Schema.Class<PortProtocolError, Schema.TaggedStruct<"PortProtocolError", {
39
+ readonly message: Schema.String;
40
+ }>, import("effect/Cause").YieldableError>;
41
+ /**
42
+ * The envelope itself could not be honored: the receiving Object could not decode the
43
+ * request, or a response could not be encoded/decoded. It never carries port semantics —
44
+ * callers fold it into the operation's base error (`LedgerError`/`ThreadStoreError`),
45
+ * except `resolveAdmission`, which folds it into `AdmissionIndeterminate` because a
46
+ * non-answer is never proof of absence (SUB-031).
47
+ */
48
+ declare class PortProtocolError extends PortProtocolError_base {}
49
+ declare const LedgerAdmitCall_base: Schema.Class<LedgerAdmitCall, Schema.TaggedStruct<"LedgerAdmit", {
50
+ readonly request: typeof AdmissionRequest;
51
+ }>, {}>;
52
+ /** Routed `SubmissionLedger.admit` — child establishment admits INTO the owning Object. */
53
+ declare class LedgerAdmitCall extends LedgerAdmitCall_base {}
54
+ declare const LedgerMarkReadyCall_base: Schema.Class<LedgerMarkReadyCall, Schema.TaggedStruct<"LedgerMarkReady", {
55
+ readonly request: typeof MarkReadyRequest;
56
+ }>, {}>;
57
+ /** Routed `SubmissionLedger.markReady` for a Submission owned by another Object. */
58
+ declare class LedgerMarkReadyCall extends LedgerMarkReadyCall_base {}
59
+ declare const LedgerLookupCall_base: Schema.Class<LedgerLookupCall, Schema.TaggedStruct<"LedgerLookup", {
60
+ readonly request: Schema.Union<readonly [typeof import("@effect-agent/thread/SubmissionLedger").SubmissionLookupById, typeof SubmissionLookupByKey]>;
61
+ }>, {}>;
62
+ /** Routed `SubmissionLedger.lookup` (by identity or scoped idempotency key). */
63
+ declare class LedgerLookupCall extends LedgerLookupCall_base {}
64
+ declare const LedgerResolveAdmissionCall_base: Schema.Class<LedgerResolveAdmissionCall, Schema.TaggedStruct<"LedgerResolveAdmission", {
65
+ readonly request: typeof SubmissionLookupByKey;
66
+ }>, {}>;
67
+ /** Routed `SubmissionLedger.resolveAdmission` — the SUB-031 tri-state authority call. */
68
+ declare class LedgerResolveAdmissionCall extends LedgerResolveAdmissionCall_base {}
69
+ declare const LedgerRequestAbortCall_base: Schema.Class<LedgerRequestAbortCall, Schema.TaggedStruct<"LedgerRequestAbort", {
70
+ readonly request: typeof AbortCommand;
71
+ }>, {}>;
72
+ /** Routed `SubmissionLedger.requestAbort` — abort propagation across Objects. */
73
+ declare class LedgerRequestAbortCall extends LedgerRequestAbortCall_base {}
74
+ declare const LedgerRecordChildSettledCall_base: Schema.Class<LedgerRecordChildSettledCall, Schema.TaggedStruct<"LedgerRecordChildSettled", {
75
+ readonly request: typeof ChildSettledNotification;
76
+ }>, {}>;
77
+ /** Routed `SubmissionLedger.recordChildSettled` — the child→parent durable notification. */
78
+ declare class LedgerRecordChildSettledCall extends LedgerRecordChildSettledCall_base {}
79
+ declare const StoreMaterializeCall_base: Schema.Class<StoreMaterializeCall, Schema.TaggedStruct<"StoreMaterialize", {
80
+ readonly request: typeof ThreadMaterialization;
81
+ }>, {}>;
82
+ /** Routed `ThreadStore.materialize` against the owning Object. */
83
+ declare class StoreMaterializeCall extends StoreMaterializeCall_base {}
84
+ declare const StoreAppendCall_base: Schema.Class<StoreAppendCall, Schema.TaggedStruct<"StoreAppend", {
85
+ readonly request: typeof FencedAppendRequest;
86
+ }>, {}>;
87
+ /** Routed `ThreadStore.append` against the owning Object. */
88
+ declare class StoreAppendCall extends StoreAppendCall_base {}
89
+ declare const StoreReadPageCall_base: Schema.Class<StoreReadPageCall, Schema.TaggedStruct<"StoreReadPage", {
90
+ readonly request: typeof ThreadRead;
91
+ }>, {}>;
92
+ /** Routed one-page `ThreadStore.read`; the page bound is the request's own `limit`. */
93
+ declare class StoreReadPageCall extends StoreReadPageCall_base {}
94
+ declare const StoreInspectTailCall_base: Schema.Class<StoreInspectTailCall, Schema.TaggedStruct<"StoreInspectTail", {
95
+ readonly request: typeof ThreadTailRequest;
96
+ }>, {}>;
97
+ /** Routed `ThreadStore.inspectTail` against the owning Object. */
98
+ declare class StoreInspectTailCall extends StoreInspectTailCall_base {}
99
+ declare const StoreExportCall_base: Schema.Class<StoreExportCall, Schema.TaggedStruct<"StoreExport", {
100
+ readonly request: typeof ThreadExportRequest;
101
+ }>, {}>;
102
+ /** Routed `ThreadStore.export` against the owning Object. */
103
+ declare class StoreExportCall extends StoreExportCall_base {}
104
+ /** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
105
+ declare const PortRequest: Schema.Union<readonly [typeof LedgerAdmitCall, typeof LedgerMarkReadyCall, typeof LedgerLookupCall, typeof LedgerResolveAdmissionCall, typeof LedgerRequestAbortCall, typeof LedgerRecordChildSettledCall, typeof StoreMaterializeCall, typeof StoreAppendCall, typeof StoreReadPageCall, typeof StoreInspectTailCall, typeof StoreExportCall]>;
106
+ type PortRequest = typeof PortRequest.Type;
107
+ /** The wire form of one port request (what a transport actually carries). */
108
+ type PortRequestEnvelope = typeof PortRequest.Encoded;
109
+ declare const LedgerAdmitResult_base: Schema.Class<LedgerAdmitResult, Schema.TaggedStruct<"LedgerAdmitResult", {
110
+ readonly result: typeof AdmissionResult;
111
+ }>, {}>;
112
+ declare class LedgerAdmitResult extends LedgerAdmitResult_base {}
113
+ declare const LedgerMarkReadyResult_base: Schema.Class<LedgerMarkReadyResult, Schema.TaggedStruct<"LedgerMarkReadyResult", {}>, {}>;
114
+ declare class LedgerMarkReadyResult extends LedgerMarkReadyResult_base {}
115
+ declare const LedgerLookupResult_base: Schema.Class<LedgerLookupResult, Schema.TaggedStruct<"LedgerLookupResult", {
116
+ readonly submission: Schema.optionalKey<typeof SubmissionSnapshot>;
117
+ }>, {}>;
118
+ /** `submission` is absent exactly when the lookup answered `Option.none`. */
119
+ declare class LedgerLookupResult extends LedgerLookupResult_base {}
120
+ declare const LedgerResolveAdmissionResult_base: Schema.Class<LedgerResolveAdmissionResult, Schema.TaggedStruct<"LedgerResolveAdmissionResult", {
121
+ readonly resolution: Schema.Union<readonly [typeof import("@effect-agent/thread/SubmissionLedger").AdmissionNotAdmitted, typeof import("@effect-agent/thread/SubmissionLedger").AdmissionAdmitted, typeof import("@effect-agent/thread/SubmissionLedger").AdmissionIndeterminate]>;
122
+ }>, {}>;
123
+ declare class LedgerResolveAdmissionResult extends LedgerResolveAdmissionResult_base {}
124
+ declare const LedgerRequestAbortResult_base: Schema.Class<LedgerRequestAbortResult, Schema.TaggedStruct<"LedgerRequestAbortResult", {
125
+ readonly intent: typeof AbortIntent;
126
+ }>, {}>;
127
+ declare class LedgerRequestAbortResult extends LedgerRequestAbortResult_base {}
128
+ declare const LedgerRecordChildSettledResult_base: Schema.Class<LedgerRecordChildSettledResult, Schema.TaggedStruct<"LedgerRecordChildSettledResult", {
129
+ readonly outcome: Schema.Literals<readonly ["woken", "still-waiting", "not-waiting"]>;
130
+ }>, {}>;
131
+ declare class LedgerRecordChildSettledResult extends LedgerRecordChildSettledResult_base {}
132
+ declare const StoreMaterializeResult_base: Schema.Class<StoreMaterializeResult, Schema.TaggedStruct<"StoreMaterializeResult", {}>, {}>;
133
+ declare class StoreMaterializeResult extends StoreMaterializeResult_base {}
134
+ declare const StoreAppendResult_base: Schema.Class<StoreAppendResult, Schema.TaggedStruct<"StoreAppendResult", {
135
+ readonly result: typeof AppendResult;
136
+ }>, {}>;
137
+ declare class StoreAppendResult extends StoreAppendResult_base {}
138
+ declare const StoreReadPageResult_base: Schema.Class<StoreReadPageResult, Schema.TaggedStruct<"StoreReadPageResult", {
139
+ readonly records: Schema.$Array<typeof CanonicalRecordEnvelope>;
140
+ }>, {}>;
141
+ /** One page of canonical records, bounded by the request's `limit` (≤ 1,024). */
142
+ declare class StoreReadPageResult extends StoreReadPageResult_base {}
143
+ declare const StoreInspectTailResult_base: Schema.Class<StoreInspectTailResult, Schema.TaggedStruct<"StoreInspectTailResult", {
144
+ readonly tail: typeof ThreadTail;
145
+ }>, {}>;
146
+ declare class StoreInspectTailResult extends StoreInspectTailResult_base {}
147
+ declare const StoreExportResult_base: Schema.Class<StoreExportResult, Schema.TaggedStruct<"StoreExportResult", {
148
+ readonly export: typeof ThreadExport;
149
+ }>, {}>;
150
+ declare class StoreExportResult extends StoreExportResult_base {}
151
+ /** Every successful routed result. Callers narrow by the tag their request implies. */
152
+ declare const PortResult: Schema.Union<readonly [typeof LedgerAdmitResult, typeof LedgerMarkReadyResult, typeof LedgerLookupResult, typeof LedgerResolveAdmissionResult, typeof LedgerRequestAbortResult, typeof LedgerRecordChildSettledResult, typeof StoreMaterializeResult, typeof StoreAppendResult, typeof StoreReadPageResult, typeof StoreInspectTailResult, typeof StoreExportResult]>;
153
+ type PortResult = typeof PortResult.Type;
154
+ /**
155
+ * Every typed failure a route-capable operation can produce on its owning Object, plus the
156
+ * protocol's own `PortProtocolError`. Members re-decode to the SAME tagged classes the
157
+ * thread ports declare, so a routed caller observes identical error tags and fields.
158
+ */
159
+ declare const PortFailure: Schema.Union<readonly [typeof AdmissionConflict, typeof AdmissionPolicyError, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
160
+ type PortFailure = typeof PortFailure.Type;
161
+ declare const PortSucceeded_base: Schema.Class<PortSucceeded, Schema.TaggedStruct<"PortSucceeded", {
162
+ readonly result: Schema.Union<readonly [typeof LedgerAdmitResult, typeof LedgerMarkReadyResult, typeof LedgerLookupResult, typeof LedgerResolveAdmissionResult, typeof LedgerRequestAbortResult, typeof LedgerRecordChildSettledResult, typeof StoreMaterializeResult, typeof StoreAppendResult, typeof StoreReadPageResult, typeof StoreInspectTailResult, typeof StoreExportResult]>;
163
+ }>, {}>;
164
+ /** The routed operation succeeded on its owning Object. */
165
+ declare class PortSucceeded extends PortSucceeded_base {}
166
+ declare const PortFailed_base: Schema.Class<PortFailed, Schema.TaggedStruct<"PortFailed", {
167
+ readonly failure: Schema.Union<readonly [typeof AdmissionConflict, typeof AdmissionPolicyError, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
168
+ }>, {}>;
169
+ /** The routed operation failed TYPED on its owning Object; the failure re-decodes verbatim. */
170
+ declare class PortFailed extends PortFailed_base {}
171
+ /** The uniform answer of one `portCall`: op-specific success or a re-decodable typed failure. */
172
+ declare const PortResponse: Schema.Union<readonly [typeof PortSucceeded, typeof PortFailed]>;
173
+ type PortResponse = typeof PortResponse.Type;
174
+ /** The wire form of one port response (what a transport actually carries). */
175
+ type PortResponseEnvelope = typeof PortResponse.Encoded;
176
+ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
177
+ readonly _tag: "LedgerAdmit";
178
+ readonly request: {
179
+ readonly threadId: string;
180
+ readonly principal: string;
181
+ readonly idempotencyKey: string;
182
+ readonly agentId: string;
183
+ readonly agentDigests: {
184
+ readonly agent: string;
185
+ readonly model: string;
186
+ readonly tools: string;
187
+ };
188
+ readonly deploymentId: string;
189
+ readonly inputPayload: Schema.Json;
190
+ readonly inputDigest: string;
191
+ readonly parentLinkage?: {
192
+ readonly parentSubmissionId: string;
193
+ readonly parentToolCallId: string;
194
+ } | undefined;
195
+ readonly workerAdmission?: {
196
+ readonly origin: {
197
+ readonly worker: {
198
+ readonly schemaVersion: 1;
199
+ readonly delegationId: string;
200
+ readonly targetAgentId: string;
201
+ readonly threadId: string;
202
+ };
203
+ readonly source: {
204
+ readonly _tag: "tool";
205
+ readonly agentId: string;
206
+ readonly threadId: string;
207
+ readonly runId: string;
208
+ readonly toolCallId: string;
209
+ } | {
210
+ readonly _tag: "programmatic";
211
+ readonly agentId: string;
212
+ readonly threadId: string;
213
+ };
214
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
215
+ readonly targetDigests: {
216
+ readonly agent: string;
217
+ readonly model: string;
218
+ readonly tools: string;
219
+ };
220
+ readonly policy: Schema.Json;
221
+ readonly budget: {
222
+ readonly caps: {
223
+ readonly maxTotalChildInvocations?: number | undefined;
224
+ readonly maxConcurrentChildren?: number | undefined;
225
+ readonly maxTurns?: number | undefined;
226
+ readonly maxToolCalls?: number | undefined;
227
+ readonly maxDurationMillis?: number | undefined;
228
+ readonly maxInputTokens?: number | undefined;
229
+ readonly maxOutputTokens?: number | undefined;
230
+ readonly maxCostMicrousd?: number | undefined;
231
+ readonly maxResultBytes?: number | undefined;
232
+ };
233
+ readonly allocation: {
234
+ readonly turns: number;
235
+ readonly toolCalls: number;
236
+ readonly durationMillis: number;
237
+ readonly inputTokens: number;
238
+ readonly outputTokens: number;
239
+ readonly costMicrousd: number;
240
+ readonly resultBytes: number;
241
+ };
242
+ readonly descendantInvocations?: number | undefined;
243
+ };
244
+ readonly grant: {
245
+ readonly allowedToolNames: readonly string[];
246
+ readonly maxDepth: number;
247
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
248
+ };
249
+ readonly depth: number;
250
+ readonly toolCallAllowance?: number | undefined;
251
+ readonly firstMessageId: string;
252
+ readonly createdAtMillis: number;
253
+ readonly expiresAtMillis: number;
254
+ readonly reporting?: {
255
+ readonly sourceDigests: {
256
+ readonly agent: string;
257
+ readonly model: string;
258
+ readonly tools: string;
259
+ };
260
+ readonly destinationDelegationId?: string | undefined;
261
+ } | undefined;
262
+ };
263
+ readonly messageId: string;
264
+ readonly parameters: Schema.Json;
265
+ readonly createdAtMillis: number;
266
+ readonly sourceSubmissionId?: string | undefined;
267
+ readonly deliveryPrincipal?: string | undefined;
268
+ } | undefined;
269
+ readonly messageAdmission?: {
270
+ readonly schemaVersion: 1;
271
+ readonly message: {
272
+ readonly ownerThreadId: string;
273
+ readonly messageId: string;
274
+ };
275
+ readonly peerName: string;
276
+ readonly sender: {
277
+ readonly threadId: string;
278
+ readonly agentId: string;
279
+ };
280
+ readonly returnAddress: {
281
+ readonly threadId: string;
282
+ readonly agentId: string;
283
+ };
284
+ readonly inReplyTo?: {
285
+ readonly ownerThreadId: string;
286
+ readonly messageId: string;
287
+ } | undefined;
288
+ } | undefined;
289
+ readonly admissionGroup?: string | undefined;
290
+ readonly admissionFence?: {
291
+ readonly policyId: string;
292
+ readonly key: string;
293
+ readonly revision: string;
294
+ } | undefined;
295
+ };
296
+ } | {
297
+ readonly _tag: "LedgerMarkReady";
298
+ readonly request: {
299
+ readonly submissionId: string;
300
+ };
301
+ } | {
302
+ readonly _tag: "LedgerLookup";
303
+ readonly request: {
304
+ readonly _tag: "SubmissionLookupById";
305
+ readonly submissionId: string;
306
+ } | {
307
+ readonly _tag: "SubmissionLookupByKey";
308
+ readonly threadId: string;
309
+ readonly principal: string;
310
+ readonly idempotencyKey: string;
311
+ };
312
+ } | {
313
+ readonly _tag: "LedgerResolveAdmission";
314
+ readonly request: {
315
+ readonly _tag: "SubmissionLookupByKey";
316
+ readonly threadId: string;
317
+ readonly principal: string;
318
+ readonly idempotencyKey: string;
319
+ };
320
+ } | {
321
+ readonly _tag: "LedgerRequestAbort";
322
+ readonly request: {
323
+ readonly submissionId: string;
324
+ readonly author: string;
325
+ readonly reason: string;
326
+ };
327
+ } | {
328
+ readonly _tag: "LedgerRecordChildSettled";
329
+ readonly request: {
330
+ readonly parentSubmissionId: string;
331
+ readonly childSubmissionId: string;
332
+ };
333
+ } | {
334
+ readonly _tag: "StoreMaterialize";
335
+ readonly request: {
336
+ readonly threadId: string;
337
+ readonly producerEpoch: number;
338
+ };
339
+ } | {
340
+ readonly _tag: "StoreAppend";
341
+ readonly request: {
342
+ readonly threadId: string;
343
+ readonly batch: {
344
+ readonly batchId: string;
345
+ readonly producerId: string;
346
+ readonly records: readonly [{
347
+ readonly recordId: string;
348
+ readonly family: "thread";
349
+ readonly schemaVersion: 1;
350
+ readonly createdAt: string;
351
+ readonly deploymentId: string;
352
+ readonly payload: {
353
+ readonly _tag: "ThreadCreated";
354
+ readonly agentId: string;
355
+ readonly definitions: {
356
+ readonly agent: string;
357
+ readonly model: string;
358
+ readonly tools: string;
359
+ };
360
+ } | {
361
+ readonly _tag: "UserInputRecorded";
362
+ readonly submissionId?: string | undefined;
363
+ readonly kind: "follow-up" | "steering" | "user";
364
+ readonly runId?: string | undefined;
365
+ readonly input: Schema.Json;
366
+ readonly messageAdmission?: {
367
+ readonly schemaVersion: 1;
368
+ readonly message: {
369
+ readonly ownerThreadId: string;
370
+ readonly messageId: string;
371
+ };
372
+ readonly peerName: string;
373
+ readonly sender: {
374
+ readonly threadId: string;
375
+ readonly agentId: string;
376
+ };
377
+ readonly returnAddress: {
378
+ readonly threadId: string;
379
+ readonly agentId: string;
380
+ };
381
+ readonly inReplyTo?: {
382
+ readonly ownerThreadId: string;
383
+ readonly messageId: string;
384
+ } | undefined;
385
+ } | undefined;
386
+ } | {
387
+ readonly _tag: "RunStarted";
388
+ readonly runId: string;
389
+ readonly policyAccountingVersion: 1;
390
+ readonly maxDurationMillis: number;
391
+ } | {
392
+ readonly _tag: "RunPolicyUsageReserved";
393
+ readonly runId: string;
394
+ readonly programmaticToolCalls: number;
395
+ readonly finalizationUsed: boolean;
396
+ } | {
397
+ readonly _tag: "ModelCompleted";
398
+ readonly runId: string;
399
+ readonly output: Schema.Json;
400
+ readonly messages?: Schema.Json | undefined;
401
+ } | {
402
+ readonly _tag: "ModelResponseRecorded";
403
+ readonly toolExposure?: {
404
+ readonly exposedToolNames: readonly string[];
405
+ readonly selection?: {
406
+ readonly toolNames: readonly string[];
407
+ } | undefined;
408
+ } | undefined;
409
+ readonly runId: string;
410
+ readonly turnId: string;
411
+ readonly turn: number;
412
+ readonly messages: Schema.Json;
413
+ readonly messagesDigest: string;
414
+ readonly runScopedPrefixLength?: number | undefined;
415
+ readonly modelUsage?: readonly {
416
+ readonly provider: string;
417
+ readonly model: string;
418
+ readonly serviceTier?: string | undefined;
419
+ readonly pricingVersion?: string | undefined;
420
+ readonly response?: {
421
+ readonly id?: string | undefined;
422
+ readonly model?: string | undefined;
423
+ } | undefined;
424
+ readonly purpose?: "summary" | "turn" | undefined;
425
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
426
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
427
+ readonly inputTokens: {
428
+ readonly total: number;
429
+ readonly uncached: number;
430
+ readonly cacheRead: number;
431
+ readonly cacheWrite: number;
432
+ };
433
+ readonly outputTokens: {
434
+ readonly total: number;
435
+ readonly text: number;
436
+ readonly reasoning: number;
437
+ };
438
+ readonly costMicrousd: number;
439
+ }[] | undefined;
440
+ readonly unobservedModelCalls?: number | undefined;
441
+ readonly inputTokens?: number | undefined;
442
+ readonly outputTokens?: number | undefined;
443
+ readonly costMicrousd?: number | undefined;
444
+ } | {
445
+ readonly _tag: "ToolCallPrepared";
446
+ readonly runId: string;
447
+ readonly turnId: string;
448
+ readonly turn: number;
449
+ readonly toolCallId: string;
450
+ readonly toolName: string;
451
+ readonly parameters: Schema.Json;
452
+ readonly parametersDigest: string;
453
+ readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
454
+ } | {
455
+ readonly _tag: "ToolCallSettled";
456
+ readonly toolSelection?: {
457
+ readonly toolNames: readonly string[];
458
+ } | undefined;
459
+ readonly runId: string;
460
+ readonly toolCallId: string;
461
+ readonly toolName: string;
462
+ readonly result: Schema.Json;
463
+ readonly isFailure: boolean;
464
+ readonly budgetRejected?: true | undefined;
465
+ } | {
466
+ readonly _tag: "ToolCallUnknown";
467
+ readonly runId: string;
468
+ readonly turn: number;
469
+ readonly toolCallId: string;
470
+ readonly toolName: string;
471
+ readonly reason: string;
472
+ } | {
473
+ readonly _tag: "ToolCallResolved";
474
+ readonly runId: string;
475
+ readonly toolCallId: string;
476
+ readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
477
+ readonly author: string;
478
+ readonly reason: string;
479
+ } | {
480
+ readonly _tag: "ToolStepSettled";
481
+ readonly runId: string;
482
+ readonly toolCallId: string;
483
+ readonly stepName: string;
484
+ readonly output: Schema.Json;
485
+ readonly outputDigest: string;
486
+ } | {
487
+ readonly _tag: "ToolApprovalRequested";
488
+ readonly runId: string;
489
+ readonly turnId: string;
490
+ readonly turn: number;
491
+ readonly toolCallId: string;
492
+ readonly toolName: string;
493
+ readonly parametersDigest: string;
494
+ } | {
495
+ readonly _tag: "ToolApprovalDecided";
496
+ readonly runId: string;
497
+ readonly turn: number;
498
+ readonly toolCallId: string;
499
+ readonly decision: "approved" | "denied";
500
+ readonly resolver: string;
501
+ readonly reason: string;
502
+ } | {
503
+ readonly _tag: "ModelResponseInterrupted";
504
+ readonly runId: string;
505
+ readonly supersededEpoch: number;
506
+ readonly attemptId: string;
507
+ readonly reason: string;
508
+ } | {
509
+ readonly _tag: "CompactionCreated";
510
+ readonly runId: string;
511
+ readonly turn: number;
512
+ readonly kind: "clear-tool-results" | "rollover" | "summarize";
513
+ readonly coversThrough: number;
514
+ readonly summary?: string | undefined;
515
+ readonly handoff?: string | undefined;
516
+ } | {
517
+ readonly _tag: "RunFailed";
518
+ readonly runId: string;
519
+ readonly failure: Schema.Json;
520
+ } | {
521
+ readonly _tag: "RunCompleted";
522
+ readonly runId: string;
523
+ readonly output: Schema.Json;
524
+ readonly runDisposition?: Schema.Json | undefined;
525
+ readonly finishReason?: "budget-exhausted" | undefined;
526
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
527
+ } | {
528
+ readonly _tag: "AbortRequested";
529
+ readonly submissionId: string;
530
+ readonly author: string;
531
+ readonly reason: string;
532
+ } | {
533
+ readonly _tag: "SubmissionSettled";
534
+ readonly submissionId: string;
535
+ readonly settlementId: string;
536
+ readonly receiptId: string;
537
+ readonly outcome: "aborted" | "completed" | "failed";
538
+ readonly runId?: string | undefined;
539
+ readonly result?: Schema.Json | undefined;
540
+ readonly runDisposition?: Schema.Json | undefined;
541
+ readonly finishReason?: "budget-exhausted" | undefined;
542
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
543
+ readonly policyLimit?: "cost" | "duration" | "repeated-failures" | "tokens" | "tool-calls" | "turns" | "usage" | undefined;
544
+ readonly usageSummary?: {
545
+ readonly modelCalls: number;
546
+ readonly inputTokens: {
547
+ readonly total: number;
548
+ readonly uncached: number;
549
+ readonly cacheRead: number;
550
+ readonly cacheWrite: number;
551
+ };
552
+ readonly outputTokens: {
553
+ readonly total: number;
554
+ readonly text: number;
555
+ readonly reasoning: number;
556
+ };
557
+ readonly costMicrousd: number;
558
+ readonly byModel: readonly {
559
+ readonly provider: string;
560
+ readonly model: string;
561
+ readonly responseModel?: string | undefined;
562
+ readonly serviceTier?: string | undefined;
563
+ readonly pricingVersion?: string | undefined;
564
+ readonly modelCalls: number;
565
+ readonly inputTokens: {
566
+ readonly total: number;
567
+ readonly uncached: number;
568
+ readonly cacheRead: number;
569
+ readonly cacheWrite: number;
570
+ };
571
+ readonly outputTokens: {
572
+ readonly total: number;
573
+ readonly text: number;
574
+ readonly reasoning: number;
575
+ };
576
+ readonly costMicrousd: number;
577
+ }[];
578
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
579
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
580
+ readonly unobservedModelCalls?: number | undefined;
581
+ } | undefined;
582
+ readonly uncommittedModelUsage?: readonly {
583
+ readonly provider: string;
584
+ readonly model: string;
585
+ readonly serviceTier?: string | undefined;
586
+ readonly pricingVersion?: string | undefined;
587
+ readonly response?: {
588
+ readonly id?: string | undefined;
589
+ readonly model?: string | undefined;
590
+ } | undefined;
591
+ readonly purpose?: "summary" | "turn" | undefined;
592
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
593
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
594
+ readonly inputTokens: {
595
+ readonly total: number;
596
+ readonly uncached: number;
597
+ readonly cacheRead: number;
598
+ readonly cacheWrite: number;
599
+ };
600
+ readonly outputTokens: {
601
+ readonly total: number;
602
+ readonly text: number;
603
+ readonly reasoning: number;
604
+ };
605
+ readonly costMicrousd: number;
606
+ }[] | undefined;
607
+ } | {
608
+ readonly _tag: "SubagentRequested";
609
+ readonly runId: string;
610
+ readonly turnId: string;
611
+ readonly turn: number;
612
+ readonly toolCallId: string;
613
+ readonly delegationId: string;
614
+ readonly targetAgentId: string;
615
+ readonly targetDigests: {
616
+ readonly agent: string;
617
+ readonly model: string;
618
+ readonly tools: string;
619
+ };
620
+ readonly childInput: Schema.Json;
621
+ readonly childInputDigest: string;
622
+ readonly grantDigest: string;
623
+ readonly reservationId: string;
624
+ readonly reservationDigest: string;
625
+ readonly childThreadId: string;
626
+ readonly childPrincipal: string;
627
+ readonly childIdempotencyKey: string;
628
+ readonly toolCallAllowance?: number | undefined;
629
+ readonly policy?: Schema.Json | undefined;
630
+ readonly budget?: {
631
+ readonly caps: {
632
+ readonly maxTotalChildInvocations?: number | undefined;
633
+ readonly maxConcurrentChildren?: number | undefined;
634
+ readonly maxTurns?: number | undefined;
635
+ readonly maxToolCalls?: number | undefined;
636
+ readonly maxDurationMillis?: number | undefined;
637
+ readonly maxInputTokens?: number | undefined;
638
+ readonly maxOutputTokens?: number | undefined;
639
+ readonly maxCostMicrousd?: number | undefined;
640
+ readonly maxResultBytes?: number | undefined;
641
+ };
642
+ readonly allocation: {
643
+ readonly turns: number;
644
+ readonly toolCalls: number;
645
+ readonly durationMillis: number;
646
+ readonly inputTokens: number;
647
+ readonly outputTokens: number;
648
+ readonly costMicrousd: number;
649
+ readonly resultBytes: number;
650
+ };
651
+ readonly descendantInvocations?: number | undefined;
652
+ } | undefined;
653
+ readonly grant?: {
654
+ readonly allowedToolNames: readonly string[];
655
+ readonly maxDepth: number;
656
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
657
+ } | undefined;
658
+ readonly depth?: number | undefined;
659
+ } | {
660
+ readonly _tag: "SubagentStarted";
661
+ readonly runId: string;
662
+ readonly toolCallId: string;
663
+ readonly childThreadId: string;
664
+ readonly childSubmissionId: string;
665
+ readonly childReceiptId: string;
666
+ readonly childRunId: string;
667
+ } | {
668
+ readonly _tag: "SubagentJoined";
669
+ readonly runId: string;
670
+ readonly toolCallId: string;
671
+ readonly childSubmissionId: string;
672
+ readonly childSettlementId: string;
673
+ readonly childOutcome: "aborted" | "completed" | "failed";
674
+ readonly childResultDigest: string;
675
+ readonly projectedResultDigest: string;
676
+ readonly usageSummary: Schema.Json;
677
+ readonly usage?: {
678
+ readonly modelCalls: number;
679
+ readonly inputTokens: number;
680
+ readonly outputTokens: number;
681
+ readonly costMicrousd: number;
682
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
683
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
684
+ readonly unobservedModelCalls?: number | undefined;
685
+ } | undefined;
686
+ readonly delegatedUsage?: {
687
+ readonly modelCalls: number;
688
+ readonly inputTokens: number;
689
+ readonly outputTokens: number;
690
+ readonly costMicrousd: number;
691
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
692
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
693
+ readonly unobservedModelCalls?: number | undefined;
694
+ } | undefined;
695
+ readonly reservationId: string;
696
+ readonly finalAccounting: Schema.Json;
697
+ } | {
698
+ readonly _tag: "SubagentLineageRecorded";
699
+ readonly parentLink: {
700
+ readonly delegationId: string;
701
+ readonly parentAgentId: string;
702
+ readonly parentThreadId: string;
703
+ readonly parentRunId: string;
704
+ readonly parentToolCallId: string;
705
+ readonly depth: number;
706
+ };
707
+ readonly parentSubmissionId: string;
708
+ readonly childDefinitionDigests: {
709
+ readonly agent: string;
710
+ readonly model: string;
711
+ readonly tools: string;
712
+ };
713
+ readonly childInputDigest: string;
714
+ readonly grantDigest: string;
715
+ readonly toolCallAllowance?: number | undefined;
716
+ readonly policy?: Schema.Json | undefined;
717
+ readonly budget?: {
718
+ readonly caps: {
719
+ readonly maxTotalChildInvocations?: number | undefined;
720
+ readonly maxConcurrentChildren?: number | undefined;
721
+ readonly maxTurns?: number | undefined;
722
+ readonly maxToolCalls?: number | undefined;
723
+ readonly maxDurationMillis?: number | undefined;
724
+ readonly maxInputTokens?: number | undefined;
725
+ readonly maxOutputTokens?: number | undefined;
726
+ readonly maxCostMicrousd?: number | undefined;
727
+ readonly maxResultBytes?: number | undefined;
728
+ };
729
+ readonly allocation: {
730
+ readonly turns: number;
731
+ readonly toolCalls: number;
732
+ readonly durationMillis: number;
733
+ readonly inputTokens: number;
734
+ readonly outputTokens: number;
735
+ readonly costMicrousd: number;
736
+ readonly resultBytes: number;
737
+ };
738
+ readonly descendantInvocations?: number | undefined;
739
+ } | undefined;
740
+ readonly grant?: {
741
+ readonly allowedToolNames: readonly string[];
742
+ readonly maxDepth: number;
743
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
744
+ } | undefined;
745
+ } | {
746
+ readonly _tag: "WorkerInputRequested";
747
+ readonly admission: {
748
+ readonly origin: {
749
+ readonly worker: {
750
+ readonly schemaVersion: 1;
751
+ readonly delegationId: string;
752
+ readonly targetAgentId: string;
753
+ readonly threadId: string;
754
+ };
755
+ readonly source: {
756
+ readonly _tag: "tool";
757
+ readonly agentId: string;
758
+ readonly threadId: string;
759
+ readonly runId: string;
760
+ readonly toolCallId: string;
761
+ } | {
762
+ readonly _tag: "programmatic";
763
+ readonly agentId: string;
764
+ readonly threadId: string;
765
+ };
766
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
767
+ readonly targetDigests: {
768
+ readonly agent: string;
769
+ readonly model: string;
770
+ readonly tools: string;
771
+ };
772
+ readonly policy: Schema.Json;
773
+ readonly budget: {
774
+ readonly caps: {
775
+ readonly maxTotalChildInvocations?: number | undefined;
776
+ readonly maxConcurrentChildren?: number | undefined;
777
+ readonly maxTurns?: number | undefined;
778
+ readonly maxToolCalls?: number | undefined;
779
+ readonly maxDurationMillis?: number | undefined;
780
+ readonly maxInputTokens?: number | undefined;
781
+ readonly maxOutputTokens?: number | undefined;
782
+ readonly maxCostMicrousd?: number | undefined;
783
+ readonly maxResultBytes?: number | undefined;
784
+ };
785
+ readonly allocation: {
786
+ readonly turns: number;
787
+ readonly toolCalls: number;
788
+ readonly durationMillis: number;
789
+ readonly inputTokens: number;
790
+ readonly outputTokens: number;
791
+ readonly costMicrousd: number;
792
+ readonly resultBytes: number;
793
+ };
794
+ readonly descendantInvocations?: number | undefined;
795
+ };
796
+ readonly grant: {
797
+ readonly allowedToolNames: readonly string[];
798
+ readonly maxDepth: number;
799
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
800
+ };
801
+ readonly depth: number;
802
+ readonly toolCallAllowance?: number | undefined;
803
+ readonly firstMessageId: string;
804
+ readonly createdAtMillis: number;
805
+ readonly expiresAtMillis: number;
806
+ readonly reporting?: {
807
+ readonly sourceDigests: {
808
+ readonly agent: string;
809
+ readonly model: string;
810
+ readonly tools: string;
811
+ };
812
+ readonly destinationDelegationId?: string | undefined;
813
+ } | undefined;
814
+ };
815
+ readonly messageId: string;
816
+ readonly parameters: Schema.Json;
817
+ readonly createdAtMillis: number;
818
+ readonly sourceSubmissionId?: string | undefined;
819
+ readonly deliveryPrincipal?: string | undefined;
820
+ };
821
+ readonly inputDigest: string;
822
+ } | {
823
+ readonly _tag: "WorkerOriginRecorded";
824
+ readonly origin: {
825
+ readonly worker: {
826
+ readonly schemaVersion: 1;
827
+ readonly delegationId: string;
828
+ readonly targetAgentId: string;
829
+ readonly threadId: string;
830
+ };
831
+ readonly source: {
832
+ readonly _tag: "tool";
833
+ readonly agentId: string;
834
+ readonly threadId: string;
835
+ readonly runId: string;
836
+ readonly toolCallId: string;
837
+ } | {
838
+ readonly _tag: "programmatic";
839
+ readonly agentId: string;
840
+ readonly threadId: string;
841
+ };
842
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
843
+ readonly targetDigests: {
844
+ readonly agent: string;
845
+ readonly model: string;
846
+ readonly tools: string;
847
+ };
848
+ readonly policy: Schema.Json;
849
+ readonly budget: {
850
+ readonly caps: {
851
+ readonly maxTotalChildInvocations?: number | undefined;
852
+ readonly maxConcurrentChildren?: number | undefined;
853
+ readonly maxTurns?: number | undefined;
854
+ readonly maxToolCalls?: number | undefined;
855
+ readonly maxDurationMillis?: number | undefined;
856
+ readonly maxInputTokens?: number | undefined;
857
+ readonly maxOutputTokens?: number | undefined;
858
+ readonly maxCostMicrousd?: number | undefined;
859
+ readonly maxResultBytes?: number | undefined;
860
+ };
861
+ readonly allocation: {
862
+ readonly turns: number;
863
+ readonly toolCalls: number;
864
+ readonly durationMillis: number;
865
+ readonly inputTokens: number;
866
+ readonly outputTokens: number;
867
+ readonly costMicrousd: number;
868
+ readonly resultBytes: number;
869
+ };
870
+ readonly descendantInvocations?: number | undefined;
871
+ };
872
+ readonly grant: {
873
+ readonly allowedToolNames: readonly string[];
874
+ readonly maxDepth: number;
875
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
876
+ };
877
+ readonly depth: number;
878
+ readonly toolCallAllowance?: number | undefined;
879
+ readonly firstMessageId: string;
880
+ readonly createdAtMillis: number;
881
+ readonly expiresAtMillis: number;
882
+ readonly reporting?: {
883
+ readonly sourceDigests: {
884
+ readonly agent: string;
885
+ readonly model: string;
886
+ readonly tools: string;
887
+ };
888
+ readonly destinationDelegationId?: string | undefined;
889
+ } | undefined;
890
+ };
891
+ } | {
892
+ readonly _tag: "WorkerInputCompleted";
893
+ readonly messageId: string;
894
+ readonly workerThreadId: string;
895
+ readonly submissionId: string;
896
+ readonly receiptId: string;
897
+ readonly settlementId: string;
898
+ readonly completedAtMillis: number;
899
+ } | {
900
+ readonly _tag: "WorkerReportPrepared";
901
+ readonly runId: string;
902
+ readonly messageId: string;
903
+ readonly envelope: Schema.Json;
904
+ readonly createdAtMillis: number;
905
+ readonly deadlineAtMillis: number;
906
+ } | {
907
+ readonly _tag: "WorkerReportRefused";
908
+ readonly runId: string;
909
+ readonly messageId: string;
910
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
911
+ } | {
912
+ readonly _tag: "PeerMessagePrepared";
913
+ readonly messageId: string;
914
+ readonly sourcePrincipal: string;
915
+ readonly operation: "reply" | "send";
916
+ readonly deadlineAtMillis: number;
917
+ readonly encodedEnvelope: Schema.Json;
918
+ } | {
919
+ readonly _tag: "SubtreeBudgetReserved";
920
+ readonly reservationId: string;
921
+ readonly sourceSubmissionId?: string | undefined;
922
+ readonly childThreadId: string;
923
+ readonly lifetime: "attached" | "background";
924
+ readonly depth: number;
925
+ readonly policy: Schema.Json;
926
+ readonly grant: {
927
+ readonly allowedToolNames: readonly string[];
928
+ readonly maxDepth: number;
929
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
930
+ };
931
+ readonly budget: {
932
+ readonly caps: {
933
+ readonly maxTotalChildInvocations?: number | undefined;
934
+ readonly maxConcurrentChildren?: number | undefined;
935
+ readonly maxTurns?: number | undefined;
936
+ readonly maxToolCalls?: number | undefined;
937
+ readonly maxDurationMillis?: number | undefined;
938
+ readonly maxInputTokens?: number | undefined;
939
+ readonly maxOutputTokens?: number | undefined;
940
+ readonly maxCostMicrousd?: number | undefined;
941
+ readonly maxResultBytes?: number | undefined;
942
+ };
943
+ readonly allocation: {
944
+ readonly turns: number;
945
+ readonly toolCalls: number;
946
+ readonly durationMillis: number;
947
+ readonly inputTokens: number;
948
+ readonly outputTokens: number;
949
+ readonly costMicrousd: number;
950
+ readonly resultBytes: number;
951
+ };
952
+ readonly descendantInvocations?: number | undefined;
953
+ };
954
+ } | {
955
+ readonly _tag: "RepairAnnotated";
956
+ readonly reason: string;
957
+ readonly details: Schema.Json;
958
+ };
959
+ }, ...{
960
+ readonly recordId: string;
961
+ readonly family: "thread";
962
+ readonly schemaVersion: 1;
963
+ readonly createdAt: string;
964
+ readonly deploymentId: string;
965
+ readonly payload: {
966
+ readonly _tag: "ThreadCreated";
967
+ readonly agentId: string;
968
+ readonly definitions: {
969
+ readonly agent: string;
970
+ readonly model: string;
971
+ readonly tools: string;
972
+ };
973
+ } | {
974
+ readonly _tag: "UserInputRecorded";
975
+ readonly submissionId?: string | undefined;
976
+ readonly kind: "follow-up" | "steering" | "user";
977
+ readonly runId?: string | undefined;
978
+ readonly input: Schema.Json;
979
+ readonly messageAdmission?: {
980
+ readonly schemaVersion: 1;
981
+ readonly message: {
982
+ readonly ownerThreadId: string;
983
+ readonly messageId: string;
984
+ };
985
+ readonly peerName: string;
986
+ readonly sender: {
987
+ readonly threadId: string;
988
+ readonly agentId: string;
989
+ };
990
+ readonly returnAddress: {
991
+ readonly threadId: string;
992
+ readonly agentId: string;
993
+ };
994
+ readonly inReplyTo?: {
995
+ readonly ownerThreadId: string;
996
+ readonly messageId: string;
997
+ } | undefined;
998
+ } | undefined;
999
+ } | {
1000
+ readonly _tag: "RunStarted";
1001
+ readonly runId: string;
1002
+ readonly policyAccountingVersion: 1;
1003
+ readonly maxDurationMillis: number;
1004
+ } | {
1005
+ readonly _tag: "RunPolicyUsageReserved";
1006
+ readonly runId: string;
1007
+ readonly programmaticToolCalls: number;
1008
+ readonly finalizationUsed: boolean;
1009
+ } | {
1010
+ readonly _tag: "ModelCompleted";
1011
+ readonly runId: string;
1012
+ readonly output: Schema.Json;
1013
+ readonly messages?: Schema.Json | undefined;
1014
+ } | {
1015
+ readonly _tag: "ModelResponseRecorded";
1016
+ readonly toolExposure?: {
1017
+ readonly exposedToolNames: readonly string[];
1018
+ readonly selection?: {
1019
+ readonly toolNames: readonly string[];
1020
+ } | undefined;
1021
+ } | undefined;
1022
+ readonly runId: string;
1023
+ readonly turnId: string;
1024
+ readonly turn: number;
1025
+ readonly messages: Schema.Json;
1026
+ readonly messagesDigest: string;
1027
+ readonly runScopedPrefixLength?: number | undefined;
1028
+ readonly modelUsage?: readonly {
1029
+ readonly provider: string;
1030
+ readonly model: string;
1031
+ readonly serviceTier?: string | undefined;
1032
+ readonly pricingVersion?: string | undefined;
1033
+ readonly response?: {
1034
+ readonly id?: string | undefined;
1035
+ readonly model?: string | undefined;
1036
+ } | undefined;
1037
+ readonly purpose?: "summary" | "turn" | undefined;
1038
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1039
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
1040
+ readonly inputTokens: {
1041
+ readonly total: number;
1042
+ readonly uncached: number;
1043
+ readonly cacheRead: number;
1044
+ readonly cacheWrite: number;
1045
+ };
1046
+ readonly outputTokens: {
1047
+ readonly total: number;
1048
+ readonly text: number;
1049
+ readonly reasoning: number;
1050
+ };
1051
+ readonly costMicrousd: number;
1052
+ }[] | undefined;
1053
+ readonly unobservedModelCalls?: number | undefined;
1054
+ readonly inputTokens?: number | undefined;
1055
+ readonly outputTokens?: number | undefined;
1056
+ readonly costMicrousd?: number | undefined;
1057
+ } | {
1058
+ readonly _tag: "ToolCallPrepared";
1059
+ readonly runId: string;
1060
+ readonly turnId: string;
1061
+ readonly turn: number;
1062
+ readonly toolCallId: string;
1063
+ readonly toolName: string;
1064
+ readonly parameters: Schema.Json;
1065
+ readonly parametersDigest: string;
1066
+ readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
1067
+ } | {
1068
+ readonly _tag: "ToolCallSettled";
1069
+ readonly toolSelection?: {
1070
+ readonly toolNames: readonly string[];
1071
+ } | undefined;
1072
+ readonly runId: string;
1073
+ readonly toolCallId: string;
1074
+ readonly toolName: string;
1075
+ readonly result: Schema.Json;
1076
+ readonly isFailure: boolean;
1077
+ readonly budgetRejected?: true | undefined;
1078
+ } | {
1079
+ readonly _tag: "ToolCallUnknown";
1080
+ readonly runId: string;
1081
+ readonly turn: number;
1082
+ readonly toolCallId: string;
1083
+ readonly toolName: string;
1084
+ readonly reason: string;
1085
+ } | {
1086
+ readonly _tag: "ToolCallResolved";
1087
+ readonly runId: string;
1088
+ readonly toolCallId: string;
1089
+ readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
1090
+ readonly author: string;
1091
+ readonly reason: string;
1092
+ } | {
1093
+ readonly _tag: "ToolStepSettled";
1094
+ readonly runId: string;
1095
+ readonly toolCallId: string;
1096
+ readonly stepName: string;
1097
+ readonly output: Schema.Json;
1098
+ readonly outputDigest: string;
1099
+ } | {
1100
+ readonly _tag: "ToolApprovalRequested";
1101
+ readonly runId: string;
1102
+ readonly turnId: string;
1103
+ readonly turn: number;
1104
+ readonly toolCallId: string;
1105
+ readonly toolName: string;
1106
+ readonly parametersDigest: string;
1107
+ } | {
1108
+ readonly _tag: "ToolApprovalDecided";
1109
+ readonly runId: string;
1110
+ readonly turn: number;
1111
+ readonly toolCallId: string;
1112
+ readonly decision: "approved" | "denied";
1113
+ readonly resolver: string;
1114
+ readonly reason: string;
1115
+ } | {
1116
+ readonly _tag: "ModelResponseInterrupted";
1117
+ readonly runId: string;
1118
+ readonly supersededEpoch: number;
1119
+ readonly attemptId: string;
1120
+ readonly reason: string;
1121
+ } | {
1122
+ readonly _tag: "CompactionCreated";
1123
+ readonly runId: string;
1124
+ readonly turn: number;
1125
+ readonly kind: "clear-tool-results" | "rollover" | "summarize";
1126
+ readonly coversThrough: number;
1127
+ readonly summary?: string | undefined;
1128
+ readonly handoff?: string | undefined;
1129
+ } | {
1130
+ readonly _tag: "RunFailed";
1131
+ readonly runId: string;
1132
+ readonly failure: Schema.Json;
1133
+ } | {
1134
+ readonly _tag: "RunCompleted";
1135
+ readonly runId: string;
1136
+ readonly output: Schema.Json;
1137
+ readonly runDisposition?: Schema.Json | undefined;
1138
+ readonly finishReason?: "budget-exhausted" | undefined;
1139
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
1140
+ } | {
1141
+ readonly _tag: "AbortRequested";
1142
+ readonly submissionId: string;
1143
+ readonly author: string;
1144
+ readonly reason: string;
1145
+ } | {
1146
+ readonly _tag: "SubmissionSettled";
1147
+ readonly submissionId: string;
1148
+ readonly settlementId: string;
1149
+ readonly receiptId: string;
1150
+ readonly outcome: "aborted" | "completed" | "failed";
1151
+ readonly runId?: string | undefined;
1152
+ readonly result?: Schema.Json | undefined;
1153
+ readonly runDisposition?: Schema.Json | undefined;
1154
+ readonly finishReason?: "budget-exhausted" | undefined;
1155
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
1156
+ readonly policyLimit?: "cost" | "duration" | "repeated-failures" | "tokens" | "tool-calls" | "turns" | "usage" | undefined;
1157
+ readonly usageSummary?: {
1158
+ readonly modelCalls: number;
1159
+ readonly inputTokens: {
1160
+ readonly total: number;
1161
+ readonly uncached: number;
1162
+ readonly cacheRead: number;
1163
+ readonly cacheWrite: number;
1164
+ };
1165
+ readonly outputTokens: {
1166
+ readonly total: number;
1167
+ readonly text: number;
1168
+ readonly reasoning: number;
1169
+ };
1170
+ readonly costMicrousd: number;
1171
+ readonly byModel: readonly {
1172
+ readonly provider: string;
1173
+ readonly model: string;
1174
+ readonly responseModel?: string | undefined;
1175
+ readonly serviceTier?: string | undefined;
1176
+ readonly pricingVersion?: string | undefined;
1177
+ readonly modelCalls: number;
1178
+ readonly inputTokens: {
1179
+ readonly total: number;
1180
+ readonly uncached: number;
1181
+ readonly cacheRead: number;
1182
+ readonly cacheWrite: number;
1183
+ };
1184
+ readonly outputTokens: {
1185
+ readonly total: number;
1186
+ readonly text: number;
1187
+ readonly reasoning: number;
1188
+ };
1189
+ readonly costMicrousd: number;
1190
+ }[];
1191
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1192
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
1193
+ readonly unobservedModelCalls?: number | undefined;
1194
+ } | undefined;
1195
+ readonly uncommittedModelUsage?: readonly {
1196
+ readonly provider: string;
1197
+ readonly model: string;
1198
+ readonly serviceTier?: string | undefined;
1199
+ readonly pricingVersion?: string | undefined;
1200
+ readonly response?: {
1201
+ readonly id?: string | undefined;
1202
+ readonly model?: string | undefined;
1203
+ } | undefined;
1204
+ readonly purpose?: "summary" | "turn" | undefined;
1205
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1206
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
1207
+ readonly inputTokens: {
1208
+ readonly total: number;
1209
+ readonly uncached: number;
1210
+ readonly cacheRead: number;
1211
+ readonly cacheWrite: number;
1212
+ };
1213
+ readonly outputTokens: {
1214
+ readonly total: number;
1215
+ readonly text: number;
1216
+ readonly reasoning: number;
1217
+ };
1218
+ readonly costMicrousd: number;
1219
+ }[] | undefined;
1220
+ } | {
1221
+ readonly _tag: "SubagentRequested";
1222
+ readonly runId: string;
1223
+ readonly turnId: string;
1224
+ readonly turn: number;
1225
+ readonly toolCallId: string;
1226
+ readonly delegationId: string;
1227
+ readonly targetAgentId: string;
1228
+ readonly targetDigests: {
1229
+ readonly agent: string;
1230
+ readonly model: string;
1231
+ readonly tools: string;
1232
+ };
1233
+ readonly childInput: Schema.Json;
1234
+ readonly childInputDigest: string;
1235
+ readonly grantDigest: string;
1236
+ readonly reservationId: string;
1237
+ readonly reservationDigest: string;
1238
+ readonly childThreadId: string;
1239
+ readonly childPrincipal: string;
1240
+ readonly childIdempotencyKey: string;
1241
+ readonly toolCallAllowance?: number | undefined;
1242
+ readonly policy?: Schema.Json | undefined;
1243
+ readonly budget?: {
1244
+ readonly caps: {
1245
+ readonly maxTotalChildInvocations?: number | undefined;
1246
+ readonly maxConcurrentChildren?: number | undefined;
1247
+ readonly maxTurns?: number | undefined;
1248
+ readonly maxToolCalls?: number | undefined;
1249
+ readonly maxDurationMillis?: number | undefined;
1250
+ readonly maxInputTokens?: number | undefined;
1251
+ readonly maxOutputTokens?: number | undefined;
1252
+ readonly maxCostMicrousd?: number | undefined;
1253
+ readonly maxResultBytes?: number | undefined;
1254
+ };
1255
+ readonly allocation: {
1256
+ readonly turns: number;
1257
+ readonly toolCalls: number;
1258
+ readonly durationMillis: number;
1259
+ readonly inputTokens: number;
1260
+ readonly outputTokens: number;
1261
+ readonly costMicrousd: number;
1262
+ readonly resultBytes: number;
1263
+ };
1264
+ readonly descendantInvocations?: number | undefined;
1265
+ } | undefined;
1266
+ readonly grant?: {
1267
+ readonly allowedToolNames: readonly string[];
1268
+ readonly maxDepth: number;
1269
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1270
+ } | undefined;
1271
+ readonly depth?: number | undefined;
1272
+ } | {
1273
+ readonly _tag: "SubagentStarted";
1274
+ readonly runId: string;
1275
+ readonly toolCallId: string;
1276
+ readonly childThreadId: string;
1277
+ readonly childSubmissionId: string;
1278
+ readonly childReceiptId: string;
1279
+ readonly childRunId: string;
1280
+ } | {
1281
+ readonly _tag: "SubagentJoined";
1282
+ readonly runId: string;
1283
+ readonly toolCallId: string;
1284
+ readonly childSubmissionId: string;
1285
+ readonly childSettlementId: string;
1286
+ readonly childOutcome: "aborted" | "completed" | "failed";
1287
+ readonly childResultDigest: string;
1288
+ readonly projectedResultDigest: string;
1289
+ readonly usageSummary: Schema.Json;
1290
+ readonly usage?: {
1291
+ readonly modelCalls: number;
1292
+ readonly inputTokens: number;
1293
+ readonly outputTokens: number;
1294
+ readonly costMicrousd: number;
1295
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1296
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
1297
+ readonly unobservedModelCalls?: number | undefined;
1298
+ } | undefined;
1299
+ readonly delegatedUsage?: {
1300
+ readonly modelCalls: number;
1301
+ readonly inputTokens: number;
1302
+ readonly outputTokens: number;
1303
+ readonly costMicrousd: number;
1304
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1305
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
1306
+ readonly unobservedModelCalls?: number | undefined;
1307
+ } | undefined;
1308
+ readonly reservationId: string;
1309
+ readonly finalAccounting: Schema.Json;
1310
+ } | {
1311
+ readonly _tag: "SubagentLineageRecorded";
1312
+ readonly parentLink: {
1313
+ readonly delegationId: string;
1314
+ readonly parentAgentId: string;
1315
+ readonly parentThreadId: string;
1316
+ readonly parentRunId: string;
1317
+ readonly parentToolCallId: string;
1318
+ readonly depth: number;
1319
+ };
1320
+ readonly parentSubmissionId: string;
1321
+ readonly childDefinitionDigests: {
1322
+ readonly agent: string;
1323
+ readonly model: string;
1324
+ readonly tools: string;
1325
+ };
1326
+ readonly childInputDigest: string;
1327
+ readonly grantDigest: string;
1328
+ readonly toolCallAllowance?: number | undefined;
1329
+ readonly policy?: Schema.Json | undefined;
1330
+ readonly budget?: {
1331
+ readonly caps: {
1332
+ readonly maxTotalChildInvocations?: number | undefined;
1333
+ readonly maxConcurrentChildren?: number | undefined;
1334
+ readonly maxTurns?: number | undefined;
1335
+ readonly maxToolCalls?: number | undefined;
1336
+ readonly maxDurationMillis?: number | undefined;
1337
+ readonly maxInputTokens?: number | undefined;
1338
+ readonly maxOutputTokens?: number | undefined;
1339
+ readonly maxCostMicrousd?: number | undefined;
1340
+ readonly maxResultBytes?: number | undefined;
1341
+ };
1342
+ readonly allocation: {
1343
+ readonly turns: number;
1344
+ readonly toolCalls: number;
1345
+ readonly durationMillis: number;
1346
+ readonly inputTokens: number;
1347
+ readonly outputTokens: number;
1348
+ readonly costMicrousd: number;
1349
+ readonly resultBytes: number;
1350
+ };
1351
+ readonly descendantInvocations?: number | undefined;
1352
+ } | undefined;
1353
+ readonly grant?: {
1354
+ readonly allowedToolNames: readonly string[];
1355
+ readonly maxDepth: number;
1356
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1357
+ } | undefined;
1358
+ } | {
1359
+ readonly _tag: "WorkerInputRequested";
1360
+ readonly admission: {
1361
+ readonly origin: {
1362
+ readonly worker: {
1363
+ readonly schemaVersion: 1;
1364
+ readonly delegationId: string;
1365
+ readonly targetAgentId: string;
1366
+ readonly threadId: string;
1367
+ };
1368
+ readonly source: {
1369
+ readonly _tag: "tool";
1370
+ readonly agentId: string;
1371
+ readonly threadId: string;
1372
+ readonly runId: string;
1373
+ readonly toolCallId: string;
1374
+ } | {
1375
+ readonly _tag: "programmatic";
1376
+ readonly agentId: string;
1377
+ readonly threadId: string;
1378
+ };
1379
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
1380
+ readonly targetDigests: {
1381
+ readonly agent: string;
1382
+ readonly model: string;
1383
+ readonly tools: string;
1384
+ };
1385
+ readonly policy: Schema.Json;
1386
+ readonly budget: {
1387
+ readonly caps: {
1388
+ readonly maxTotalChildInvocations?: number | undefined;
1389
+ readonly maxConcurrentChildren?: number | undefined;
1390
+ readonly maxTurns?: number | undefined;
1391
+ readonly maxToolCalls?: number | undefined;
1392
+ readonly maxDurationMillis?: number | undefined;
1393
+ readonly maxInputTokens?: number | undefined;
1394
+ readonly maxOutputTokens?: number | undefined;
1395
+ readonly maxCostMicrousd?: number | undefined;
1396
+ readonly maxResultBytes?: number | undefined;
1397
+ };
1398
+ readonly allocation: {
1399
+ readonly turns: number;
1400
+ readonly toolCalls: number;
1401
+ readonly durationMillis: number;
1402
+ readonly inputTokens: number;
1403
+ readonly outputTokens: number;
1404
+ readonly costMicrousd: number;
1405
+ readonly resultBytes: number;
1406
+ };
1407
+ readonly descendantInvocations?: number | undefined;
1408
+ };
1409
+ readonly grant: {
1410
+ readonly allowedToolNames: readonly string[];
1411
+ readonly maxDepth: number;
1412
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1413
+ };
1414
+ readonly depth: number;
1415
+ readonly toolCallAllowance?: number | undefined;
1416
+ readonly firstMessageId: string;
1417
+ readonly createdAtMillis: number;
1418
+ readonly expiresAtMillis: number;
1419
+ readonly reporting?: {
1420
+ readonly sourceDigests: {
1421
+ readonly agent: string;
1422
+ readonly model: string;
1423
+ readonly tools: string;
1424
+ };
1425
+ readonly destinationDelegationId?: string | undefined;
1426
+ } | undefined;
1427
+ };
1428
+ readonly messageId: string;
1429
+ readonly parameters: Schema.Json;
1430
+ readonly createdAtMillis: number;
1431
+ readonly sourceSubmissionId?: string | undefined;
1432
+ readonly deliveryPrincipal?: string | undefined;
1433
+ };
1434
+ readonly inputDigest: string;
1435
+ } | {
1436
+ readonly _tag: "WorkerOriginRecorded";
1437
+ readonly origin: {
1438
+ readonly worker: {
1439
+ readonly schemaVersion: 1;
1440
+ readonly delegationId: string;
1441
+ readonly targetAgentId: string;
1442
+ readonly threadId: string;
1443
+ };
1444
+ readonly source: {
1445
+ readonly _tag: "tool";
1446
+ readonly agentId: string;
1447
+ readonly threadId: string;
1448
+ readonly runId: string;
1449
+ readonly toolCallId: string;
1450
+ } | {
1451
+ readonly _tag: "programmatic";
1452
+ readonly agentId: string;
1453
+ readonly threadId: string;
1454
+ };
1455
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
1456
+ readonly targetDigests: {
1457
+ readonly agent: string;
1458
+ readonly model: string;
1459
+ readonly tools: string;
1460
+ };
1461
+ readonly policy: Schema.Json;
1462
+ readonly budget: {
1463
+ readonly caps: {
1464
+ readonly maxTotalChildInvocations?: number | undefined;
1465
+ readonly maxConcurrentChildren?: number | undefined;
1466
+ readonly maxTurns?: number | undefined;
1467
+ readonly maxToolCalls?: number | undefined;
1468
+ readonly maxDurationMillis?: number | undefined;
1469
+ readonly maxInputTokens?: number | undefined;
1470
+ readonly maxOutputTokens?: number | undefined;
1471
+ readonly maxCostMicrousd?: number | undefined;
1472
+ readonly maxResultBytes?: number | undefined;
1473
+ };
1474
+ readonly allocation: {
1475
+ readonly turns: number;
1476
+ readonly toolCalls: number;
1477
+ readonly durationMillis: number;
1478
+ readonly inputTokens: number;
1479
+ readonly outputTokens: number;
1480
+ readonly costMicrousd: number;
1481
+ readonly resultBytes: number;
1482
+ };
1483
+ readonly descendantInvocations?: number | undefined;
1484
+ };
1485
+ readonly grant: {
1486
+ readonly allowedToolNames: readonly string[];
1487
+ readonly maxDepth: number;
1488
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1489
+ };
1490
+ readonly depth: number;
1491
+ readonly toolCallAllowance?: number | undefined;
1492
+ readonly firstMessageId: string;
1493
+ readonly createdAtMillis: number;
1494
+ readonly expiresAtMillis: number;
1495
+ readonly reporting?: {
1496
+ readonly sourceDigests: {
1497
+ readonly agent: string;
1498
+ readonly model: string;
1499
+ readonly tools: string;
1500
+ };
1501
+ readonly destinationDelegationId?: string | undefined;
1502
+ } | undefined;
1503
+ };
1504
+ } | {
1505
+ readonly _tag: "WorkerInputCompleted";
1506
+ readonly messageId: string;
1507
+ readonly workerThreadId: string;
1508
+ readonly submissionId: string;
1509
+ readonly receiptId: string;
1510
+ readonly settlementId: string;
1511
+ readonly completedAtMillis: number;
1512
+ } | {
1513
+ readonly _tag: "WorkerReportPrepared";
1514
+ readonly runId: string;
1515
+ readonly messageId: string;
1516
+ readonly envelope: Schema.Json;
1517
+ readonly createdAtMillis: number;
1518
+ readonly deadlineAtMillis: number;
1519
+ } | {
1520
+ readonly _tag: "WorkerReportRefused";
1521
+ readonly runId: string;
1522
+ readonly messageId: string;
1523
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
1524
+ } | {
1525
+ readonly _tag: "PeerMessagePrepared";
1526
+ readonly messageId: string;
1527
+ readonly sourcePrincipal: string;
1528
+ readonly operation: "reply" | "send";
1529
+ readonly deadlineAtMillis: number;
1530
+ readonly encodedEnvelope: Schema.Json;
1531
+ } | {
1532
+ readonly _tag: "SubtreeBudgetReserved";
1533
+ readonly reservationId: string;
1534
+ readonly sourceSubmissionId?: string | undefined;
1535
+ readonly childThreadId: string;
1536
+ readonly lifetime: "attached" | "background";
1537
+ readonly depth: number;
1538
+ readonly policy: Schema.Json;
1539
+ readonly grant: {
1540
+ readonly allowedToolNames: readonly string[];
1541
+ readonly maxDepth: number;
1542
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1543
+ };
1544
+ readonly budget: {
1545
+ readonly caps: {
1546
+ readonly maxTotalChildInvocations?: number | undefined;
1547
+ readonly maxConcurrentChildren?: number | undefined;
1548
+ readonly maxTurns?: number | undefined;
1549
+ readonly maxToolCalls?: number | undefined;
1550
+ readonly maxDurationMillis?: number | undefined;
1551
+ readonly maxInputTokens?: number | undefined;
1552
+ readonly maxOutputTokens?: number | undefined;
1553
+ readonly maxCostMicrousd?: number | undefined;
1554
+ readonly maxResultBytes?: number | undefined;
1555
+ };
1556
+ readonly allocation: {
1557
+ readonly turns: number;
1558
+ readonly toolCalls: number;
1559
+ readonly durationMillis: number;
1560
+ readonly inputTokens: number;
1561
+ readonly outputTokens: number;
1562
+ readonly costMicrousd: number;
1563
+ readonly resultBytes: number;
1564
+ };
1565
+ readonly descendantInvocations?: number | undefined;
1566
+ };
1567
+ } | {
1568
+ readonly _tag: "RepairAnnotated";
1569
+ readonly reason: string;
1570
+ readonly details: Schema.Json;
1571
+ };
1572
+ }[]];
1573
+ };
1574
+ readonly expectedTailSequence: number;
1575
+ readonly expectedTailDigest: string;
1576
+ readonly producerEpoch: number;
1577
+ };
1578
+ } | {
1579
+ readonly _tag: "StoreReadPage";
1580
+ readonly request: {
1581
+ readonly threadId: string;
1582
+ readonly afterSequence?: number | undefined;
1583
+ readonly limit: number;
1584
+ };
1585
+ } | {
1586
+ readonly _tag: "StoreInspectTail";
1587
+ readonly request: {
1588
+ readonly threadId: string;
1589
+ };
1590
+ } | {
1591
+ readonly _tag: "StoreExport";
1592
+ readonly request: {
1593
+ readonly threadId: string;
1594
+ };
1595
+ }, Schema.SchemaError, never>;
1596
+ declare const decodePortRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, Schema.SchemaError, never>;
1597
+ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
1598
+ readonly _tag: "PortSucceeded";
1599
+ readonly result: {
1600
+ readonly _tag: "LedgerAdmitResult";
1601
+ readonly result: {
1602
+ readonly submissionId: string;
1603
+ readonly receiptId: string;
1604
+ readonly queueSequence: number;
1605
+ readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
1606
+ readonly replayed: boolean;
1607
+ };
1608
+ } | {
1609
+ readonly _tag: "LedgerMarkReadyResult";
1610
+ } | {
1611
+ readonly _tag: "LedgerLookupResult";
1612
+ readonly submission?: {
1613
+ readonly submissionId: string;
1614
+ readonly threadId: string;
1615
+ readonly queueSequence: number;
1616
+ readonly principal: string;
1617
+ readonly idempotencyKey: string;
1618
+ readonly agentId: string;
1619
+ readonly agentDigests: {
1620
+ readonly agent: string;
1621
+ readonly model: string;
1622
+ readonly tools: string;
1623
+ };
1624
+ readonly deploymentId: string;
1625
+ readonly inputPayload: Schema.Json;
1626
+ readonly inputDigest: string;
1627
+ readonly receiptId: string;
1628
+ readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
1629
+ readonly settledOutcome?: "aborted" | "completed" | "failed" | undefined;
1630
+ readonly createdAt: string;
1631
+ readonly readyAt?: string | undefined;
1632
+ readonly admissionGroup?: string | undefined;
1633
+ readonly admissionFence?: {
1634
+ readonly policyId: string;
1635
+ readonly key: string;
1636
+ readonly revision: string;
1637
+ } | undefined;
1638
+ readonly parentLinkage?: {
1639
+ readonly parentSubmissionId: string;
1640
+ readonly parentToolCallId: string;
1641
+ } | undefined;
1642
+ readonly workerAdmission?: {
1643
+ readonly origin: {
1644
+ readonly worker: {
1645
+ readonly schemaVersion: 1;
1646
+ readonly delegationId: string;
1647
+ readonly targetAgentId: string;
1648
+ readonly threadId: string;
1649
+ };
1650
+ readonly source: {
1651
+ readonly _tag: "tool";
1652
+ readonly agentId: string;
1653
+ readonly threadId: string;
1654
+ readonly runId: string;
1655
+ readonly toolCallId: string;
1656
+ } | {
1657
+ readonly _tag: "programmatic";
1658
+ readonly agentId: string;
1659
+ readonly threadId: string;
1660
+ };
1661
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
1662
+ readonly targetDigests: {
1663
+ readonly agent: string;
1664
+ readonly model: string;
1665
+ readonly tools: string;
1666
+ };
1667
+ readonly policy: Schema.Json;
1668
+ readonly budget: {
1669
+ readonly caps: {
1670
+ readonly maxTotalChildInvocations?: number | undefined;
1671
+ readonly maxConcurrentChildren?: number | undefined;
1672
+ readonly maxTurns?: number | undefined;
1673
+ readonly maxToolCalls?: number | undefined;
1674
+ readonly maxDurationMillis?: number | undefined;
1675
+ readonly maxInputTokens?: number | undefined;
1676
+ readonly maxOutputTokens?: number | undefined;
1677
+ readonly maxCostMicrousd?: number | undefined;
1678
+ readonly maxResultBytes?: number | undefined;
1679
+ };
1680
+ readonly allocation: {
1681
+ readonly turns: number;
1682
+ readonly toolCalls: number;
1683
+ readonly durationMillis: number;
1684
+ readonly inputTokens: number;
1685
+ readonly outputTokens: number;
1686
+ readonly costMicrousd: number;
1687
+ readonly resultBytes: number;
1688
+ };
1689
+ readonly descendantInvocations?: number | undefined;
1690
+ };
1691
+ readonly grant: {
1692
+ readonly allowedToolNames: readonly string[];
1693
+ readonly maxDepth: number;
1694
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1695
+ };
1696
+ readonly depth: number;
1697
+ readonly toolCallAllowance?: number | undefined;
1698
+ readonly firstMessageId: string;
1699
+ readonly createdAtMillis: number;
1700
+ readonly expiresAtMillis: number;
1701
+ readonly reporting?: {
1702
+ readonly sourceDigests: {
1703
+ readonly agent: string;
1704
+ readonly model: string;
1705
+ readonly tools: string;
1706
+ };
1707
+ readonly destinationDelegationId?: string | undefined;
1708
+ } | undefined;
1709
+ };
1710
+ readonly messageId: string;
1711
+ readonly parameters: Schema.Json;
1712
+ readonly createdAtMillis: number;
1713
+ readonly sourceSubmissionId?: string | undefined;
1714
+ readonly deliveryPrincipal?: string | undefined;
1715
+ } | undefined;
1716
+ readonly messageAdmission?: {
1717
+ readonly schemaVersion: 1;
1718
+ readonly message: {
1719
+ readonly ownerThreadId: string;
1720
+ readonly messageId: string;
1721
+ };
1722
+ readonly peerName: string;
1723
+ readonly sender: {
1724
+ readonly threadId: string;
1725
+ readonly agentId: string;
1726
+ };
1727
+ readonly returnAddress: {
1728
+ readonly threadId: string;
1729
+ readonly agentId: string;
1730
+ };
1731
+ readonly inReplyTo?: {
1732
+ readonly ownerThreadId: string;
1733
+ readonly messageId: string;
1734
+ } | undefined;
1735
+ } | undefined;
1736
+ } | undefined;
1737
+ } | {
1738
+ readonly _tag: "LedgerResolveAdmissionResult";
1739
+ readonly resolution: {
1740
+ readonly _tag: "NotAdmitted";
1741
+ } | {
1742
+ readonly _tag: "Admitted";
1743
+ readonly submission: {
1744
+ readonly submissionId: string;
1745
+ readonly threadId: string;
1746
+ readonly queueSequence: number;
1747
+ readonly principal: string;
1748
+ readonly idempotencyKey: string;
1749
+ readonly agentId: string;
1750
+ readonly agentDigests: {
1751
+ readonly agent: string;
1752
+ readonly model: string;
1753
+ readonly tools: string;
1754
+ };
1755
+ readonly deploymentId: string;
1756
+ readonly inputPayload: Schema.Json;
1757
+ readonly inputDigest: string;
1758
+ readonly receiptId: string;
1759
+ readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
1760
+ readonly settledOutcome?: "aborted" | "completed" | "failed" | undefined;
1761
+ readonly createdAt: string;
1762
+ readonly readyAt?: string | undefined;
1763
+ readonly admissionGroup?: string | undefined;
1764
+ readonly admissionFence?: {
1765
+ readonly policyId: string;
1766
+ readonly key: string;
1767
+ readonly revision: string;
1768
+ } | undefined;
1769
+ readonly parentLinkage?: {
1770
+ readonly parentSubmissionId: string;
1771
+ readonly parentToolCallId: string;
1772
+ } | undefined;
1773
+ readonly workerAdmission?: {
1774
+ readonly origin: {
1775
+ readonly worker: {
1776
+ readonly schemaVersion: 1;
1777
+ readonly delegationId: string;
1778
+ readonly targetAgentId: string;
1779
+ readonly threadId: string;
1780
+ };
1781
+ readonly source: {
1782
+ readonly _tag: "tool";
1783
+ readonly agentId: string;
1784
+ readonly threadId: string;
1785
+ readonly runId: string;
1786
+ readonly toolCallId: string;
1787
+ } | {
1788
+ readonly _tag: "programmatic";
1789
+ readonly agentId: string;
1790
+ readonly threadId: string;
1791
+ };
1792
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
1793
+ readonly targetDigests: {
1794
+ readonly agent: string;
1795
+ readonly model: string;
1796
+ readonly tools: string;
1797
+ };
1798
+ readonly policy: Schema.Json;
1799
+ readonly budget: {
1800
+ readonly caps: {
1801
+ readonly maxTotalChildInvocations?: number | undefined;
1802
+ readonly maxConcurrentChildren?: number | undefined;
1803
+ readonly maxTurns?: number | undefined;
1804
+ readonly maxToolCalls?: number | undefined;
1805
+ readonly maxDurationMillis?: number | undefined;
1806
+ readonly maxInputTokens?: number | undefined;
1807
+ readonly maxOutputTokens?: number | undefined;
1808
+ readonly maxCostMicrousd?: number | undefined;
1809
+ readonly maxResultBytes?: number | undefined;
1810
+ };
1811
+ readonly allocation: {
1812
+ readonly turns: number;
1813
+ readonly toolCalls: number;
1814
+ readonly durationMillis: number;
1815
+ readonly inputTokens: number;
1816
+ readonly outputTokens: number;
1817
+ readonly costMicrousd: number;
1818
+ readonly resultBytes: number;
1819
+ };
1820
+ readonly descendantInvocations?: number | undefined;
1821
+ };
1822
+ readonly grant: {
1823
+ readonly allowedToolNames: readonly string[];
1824
+ readonly maxDepth: number;
1825
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1826
+ };
1827
+ readonly depth: number;
1828
+ readonly toolCallAllowance?: number | undefined;
1829
+ readonly firstMessageId: string;
1830
+ readonly createdAtMillis: number;
1831
+ readonly expiresAtMillis: number;
1832
+ readonly reporting?: {
1833
+ readonly sourceDigests: {
1834
+ readonly agent: string;
1835
+ readonly model: string;
1836
+ readonly tools: string;
1837
+ };
1838
+ readonly destinationDelegationId?: string | undefined;
1839
+ } | undefined;
1840
+ };
1841
+ readonly messageId: string;
1842
+ readonly parameters: Schema.Json;
1843
+ readonly createdAtMillis: number;
1844
+ readonly sourceSubmissionId?: string | undefined;
1845
+ readonly deliveryPrincipal?: string | undefined;
1846
+ } | undefined;
1847
+ readonly messageAdmission?: {
1848
+ readonly schemaVersion: 1;
1849
+ readonly message: {
1850
+ readonly ownerThreadId: string;
1851
+ readonly messageId: string;
1852
+ };
1853
+ readonly peerName: string;
1854
+ readonly sender: {
1855
+ readonly threadId: string;
1856
+ readonly agentId: string;
1857
+ };
1858
+ readonly returnAddress: {
1859
+ readonly threadId: string;
1860
+ readonly agentId: string;
1861
+ };
1862
+ readonly inReplyTo?: {
1863
+ readonly ownerThreadId: string;
1864
+ readonly messageId: string;
1865
+ } | undefined;
1866
+ } | undefined;
1867
+ };
1868
+ } | {
1869
+ readonly _tag: "Indeterminate";
1870
+ readonly reason: string;
1871
+ };
1872
+ } | {
1873
+ readonly _tag: "LedgerRequestAbortResult";
1874
+ readonly intent: {
1875
+ readonly submissionId: string;
1876
+ readonly author: string;
1877
+ readonly reason: string;
1878
+ readonly requestedAt: string;
1879
+ readonly canonicalRecordId?: string | undefined;
1880
+ };
1881
+ } | {
1882
+ readonly _tag: "LedgerRecordChildSettledResult";
1883
+ readonly outcome: "not-waiting" | "still-waiting" | "woken";
1884
+ } | {
1885
+ readonly _tag: "StoreMaterializeResult";
1886
+ } | {
1887
+ readonly _tag: "StoreAppendResult";
1888
+ readonly result: {
1889
+ readonly firstSequence: number;
1890
+ readonly lastSequence: number;
1891
+ readonly tailDigest: string;
1892
+ readonly replayed: boolean;
1893
+ };
1894
+ } | {
1895
+ readonly _tag: "StoreReadPageResult";
1896
+ readonly records: readonly {
1897
+ readonly threadId: string;
1898
+ readonly batchId: string;
1899
+ readonly sequence: number;
1900
+ readonly offset: string;
1901
+ readonly record: {
1902
+ readonly recordId: string;
1903
+ readonly family: "thread";
1904
+ readonly schemaVersion: 1;
1905
+ readonly createdAt: string;
1906
+ readonly deploymentId: string;
1907
+ readonly payload: {
1908
+ readonly _tag: "ThreadCreated";
1909
+ readonly agentId: string;
1910
+ readonly definitions: {
1911
+ readonly agent: string;
1912
+ readonly model: string;
1913
+ readonly tools: string;
1914
+ };
1915
+ } | {
1916
+ readonly _tag: "UserInputRecorded";
1917
+ readonly submissionId?: string | undefined;
1918
+ readonly kind: "follow-up" | "steering" | "user";
1919
+ readonly runId?: string | undefined;
1920
+ readonly input: Schema.Json;
1921
+ readonly messageAdmission?: {
1922
+ readonly schemaVersion: 1;
1923
+ readonly message: {
1924
+ readonly ownerThreadId: string;
1925
+ readonly messageId: string;
1926
+ };
1927
+ readonly peerName: string;
1928
+ readonly sender: {
1929
+ readonly threadId: string;
1930
+ readonly agentId: string;
1931
+ };
1932
+ readonly returnAddress: {
1933
+ readonly threadId: string;
1934
+ readonly agentId: string;
1935
+ };
1936
+ readonly inReplyTo?: {
1937
+ readonly ownerThreadId: string;
1938
+ readonly messageId: string;
1939
+ } | undefined;
1940
+ } | undefined;
1941
+ } | {
1942
+ readonly _tag: "RunStarted";
1943
+ readonly runId: string;
1944
+ readonly policyAccountingVersion: 1;
1945
+ readonly maxDurationMillis: number;
1946
+ } | {
1947
+ readonly _tag: "RunPolicyUsageReserved";
1948
+ readonly runId: string;
1949
+ readonly programmaticToolCalls: number;
1950
+ readonly finalizationUsed: boolean;
1951
+ } | {
1952
+ readonly _tag: "ModelCompleted";
1953
+ readonly runId: string;
1954
+ readonly output: Schema.Json;
1955
+ readonly messages?: Schema.Json | undefined;
1956
+ } | {
1957
+ readonly _tag: "ModelResponseRecorded";
1958
+ readonly toolExposure?: {
1959
+ readonly exposedToolNames: readonly string[];
1960
+ readonly selection?: {
1961
+ readonly toolNames: readonly string[];
1962
+ } | undefined;
1963
+ } | undefined;
1964
+ readonly runId: string;
1965
+ readonly turnId: string;
1966
+ readonly turn: number;
1967
+ readonly messages: Schema.Json;
1968
+ readonly messagesDigest: string;
1969
+ readonly runScopedPrefixLength?: number | undefined;
1970
+ readonly modelUsage?: readonly {
1971
+ readonly provider: string;
1972
+ readonly model: string;
1973
+ readonly serviceTier?: string | undefined;
1974
+ readonly pricingVersion?: string | undefined;
1975
+ readonly response?: {
1976
+ readonly id?: string | undefined;
1977
+ readonly model?: string | undefined;
1978
+ } | undefined;
1979
+ readonly purpose?: "summary" | "turn" | undefined;
1980
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1981
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
1982
+ readonly inputTokens: {
1983
+ readonly total: number;
1984
+ readonly uncached: number;
1985
+ readonly cacheRead: number;
1986
+ readonly cacheWrite: number;
1987
+ };
1988
+ readonly outputTokens: {
1989
+ readonly total: number;
1990
+ readonly text: number;
1991
+ readonly reasoning: number;
1992
+ };
1993
+ readonly costMicrousd: number;
1994
+ }[] | undefined;
1995
+ readonly unobservedModelCalls?: number | undefined;
1996
+ readonly inputTokens?: number | undefined;
1997
+ readonly outputTokens?: number | undefined;
1998
+ readonly costMicrousd?: number | undefined;
1999
+ } | {
2000
+ readonly _tag: "ToolCallPrepared";
2001
+ readonly runId: string;
2002
+ readonly turnId: string;
2003
+ readonly turn: number;
2004
+ readonly toolCallId: string;
2005
+ readonly toolName: string;
2006
+ readonly parameters: Schema.Json;
2007
+ readonly parametersDigest: string;
2008
+ readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
2009
+ } | {
2010
+ readonly _tag: "ToolCallSettled";
2011
+ readonly toolSelection?: {
2012
+ readonly toolNames: readonly string[];
2013
+ } | undefined;
2014
+ readonly runId: string;
2015
+ readonly toolCallId: string;
2016
+ readonly toolName: string;
2017
+ readonly result: Schema.Json;
2018
+ readonly isFailure: boolean;
2019
+ readonly budgetRejected?: true | undefined;
2020
+ } | {
2021
+ readonly _tag: "ToolCallUnknown";
2022
+ readonly runId: string;
2023
+ readonly turn: number;
2024
+ readonly toolCallId: string;
2025
+ readonly toolName: string;
2026
+ readonly reason: string;
2027
+ } | {
2028
+ readonly _tag: "ToolCallResolved";
2029
+ readonly runId: string;
2030
+ readonly toolCallId: string;
2031
+ readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
2032
+ readonly author: string;
2033
+ readonly reason: string;
2034
+ } | {
2035
+ readonly _tag: "ToolStepSettled";
2036
+ readonly runId: string;
2037
+ readonly toolCallId: string;
2038
+ readonly stepName: string;
2039
+ readonly output: Schema.Json;
2040
+ readonly outputDigest: string;
2041
+ } | {
2042
+ readonly _tag: "ToolApprovalRequested";
2043
+ readonly runId: string;
2044
+ readonly turnId: string;
2045
+ readonly turn: number;
2046
+ readonly toolCallId: string;
2047
+ readonly toolName: string;
2048
+ readonly parametersDigest: string;
2049
+ } | {
2050
+ readonly _tag: "ToolApprovalDecided";
2051
+ readonly runId: string;
2052
+ readonly turn: number;
2053
+ readonly toolCallId: string;
2054
+ readonly decision: "approved" | "denied";
2055
+ readonly resolver: string;
2056
+ readonly reason: string;
2057
+ } | {
2058
+ readonly _tag: "ModelResponseInterrupted";
2059
+ readonly runId: string;
2060
+ readonly supersededEpoch: number;
2061
+ readonly attemptId: string;
2062
+ readonly reason: string;
2063
+ } | {
2064
+ readonly _tag: "CompactionCreated";
2065
+ readonly runId: string;
2066
+ readonly turn: number;
2067
+ readonly kind: "clear-tool-results" | "rollover" | "summarize";
2068
+ readonly coversThrough: number;
2069
+ readonly summary?: string | undefined;
2070
+ readonly handoff?: string | undefined;
2071
+ } | {
2072
+ readonly _tag: "RunFailed";
2073
+ readonly runId: string;
2074
+ readonly failure: Schema.Json;
2075
+ } | {
2076
+ readonly _tag: "RunCompleted";
2077
+ readonly runId: string;
2078
+ readonly output: Schema.Json;
2079
+ readonly runDisposition?: Schema.Json | undefined;
2080
+ readonly finishReason?: "budget-exhausted" | undefined;
2081
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
2082
+ } | {
2083
+ readonly _tag: "AbortRequested";
2084
+ readonly submissionId: string;
2085
+ readonly author: string;
2086
+ readonly reason: string;
2087
+ } | {
2088
+ readonly _tag: "SubmissionSettled";
2089
+ readonly submissionId: string;
2090
+ readonly settlementId: string;
2091
+ readonly receiptId: string;
2092
+ readonly outcome: "aborted" | "completed" | "failed";
2093
+ readonly runId?: string | undefined;
2094
+ readonly result?: Schema.Json | undefined;
2095
+ readonly runDisposition?: Schema.Json | undefined;
2096
+ readonly finishReason?: "budget-exhausted" | undefined;
2097
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
2098
+ readonly policyLimit?: "cost" | "duration" | "repeated-failures" | "tokens" | "tool-calls" | "turns" | "usage" | undefined;
2099
+ readonly usageSummary?: {
2100
+ readonly modelCalls: number;
2101
+ readonly inputTokens: {
2102
+ readonly total: number;
2103
+ readonly uncached: number;
2104
+ readonly cacheRead: number;
2105
+ readonly cacheWrite: number;
2106
+ };
2107
+ readonly outputTokens: {
2108
+ readonly total: number;
2109
+ readonly text: number;
2110
+ readonly reasoning: number;
2111
+ };
2112
+ readonly costMicrousd: number;
2113
+ readonly byModel: readonly {
2114
+ readonly provider: string;
2115
+ readonly model: string;
2116
+ readonly responseModel?: string | undefined;
2117
+ readonly serviceTier?: string | undefined;
2118
+ readonly pricingVersion?: string | undefined;
2119
+ readonly modelCalls: number;
2120
+ readonly inputTokens: {
2121
+ readonly total: number;
2122
+ readonly uncached: number;
2123
+ readonly cacheRead: number;
2124
+ readonly cacheWrite: number;
2125
+ };
2126
+ readonly outputTokens: {
2127
+ readonly total: number;
2128
+ readonly text: number;
2129
+ readonly reasoning: number;
2130
+ };
2131
+ readonly costMicrousd: number;
2132
+ }[];
2133
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2134
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
2135
+ readonly unobservedModelCalls?: number | undefined;
2136
+ } | undefined;
2137
+ readonly uncommittedModelUsage?: readonly {
2138
+ readonly provider: string;
2139
+ readonly model: string;
2140
+ readonly serviceTier?: string | undefined;
2141
+ readonly pricingVersion?: string | undefined;
2142
+ readonly response?: {
2143
+ readonly id?: string | undefined;
2144
+ readonly model?: string | undefined;
2145
+ } | undefined;
2146
+ readonly purpose?: "summary" | "turn" | undefined;
2147
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2148
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
2149
+ readonly inputTokens: {
2150
+ readonly total: number;
2151
+ readonly uncached: number;
2152
+ readonly cacheRead: number;
2153
+ readonly cacheWrite: number;
2154
+ };
2155
+ readonly outputTokens: {
2156
+ readonly total: number;
2157
+ readonly text: number;
2158
+ readonly reasoning: number;
2159
+ };
2160
+ readonly costMicrousd: number;
2161
+ }[] | undefined;
2162
+ } | {
2163
+ readonly _tag: "SubagentRequested";
2164
+ readonly runId: string;
2165
+ readonly turnId: string;
2166
+ readonly turn: number;
2167
+ readonly toolCallId: string;
2168
+ readonly delegationId: string;
2169
+ readonly targetAgentId: string;
2170
+ readonly targetDigests: {
2171
+ readonly agent: string;
2172
+ readonly model: string;
2173
+ readonly tools: string;
2174
+ };
2175
+ readonly childInput: Schema.Json;
2176
+ readonly childInputDigest: string;
2177
+ readonly grantDigest: string;
2178
+ readonly reservationId: string;
2179
+ readonly reservationDigest: string;
2180
+ readonly childThreadId: string;
2181
+ readonly childPrincipal: string;
2182
+ readonly childIdempotencyKey: string;
2183
+ readonly toolCallAllowance?: number | undefined;
2184
+ readonly policy?: Schema.Json | undefined;
2185
+ readonly budget?: {
2186
+ readonly caps: {
2187
+ readonly maxTotalChildInvocations?: number | undefined;
2188
+ readonly maxConcurrentChildren?: number | undefined;
2189
+ readonly maxTurns?: number | undefined;
2190
+ readonly maxToolCalls?: number | undefined;
2191
+ readonly maxDurationMillis?: number | undefined;
2192
+ readonly maxInputTokens?: number | undefined;
2193
+ readonly maxOutputTokens?: number | undefined;
2194
+ readonly maxCostMicrousd?: number | undefined;
2195
+ readonly maxResultBytes?: number | undefined;
2196
+ };
2197
+ readonly allocation: {
2198
+ readonly turns: number;
2199
+ readonly toolCalls: number;
2200
+ readonly durationMillis: number;
2201
+ readonly inputTokens: number;
2202
+ readonly outputTokens: number;
2203
+ readonly costMicrousd: number;
2204
+ readonly resultBytes: number;
2205
+ };
2206
+ readonly descendantInvocations?: number | undefined;
2207
+ } | undefined;
2208
+ readonly grant?: {
2209
+ readonly allowedToolNames: readonly string[];
2210
+ readonly maxDepth: number;
2211
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2212
+ } | undefined;
2213
+ readonly depth?: number | undefined;
2214
+ } | {
2215
+ readonly _tag: "SubagentStarted";
2216
+ readonly runId: string;
2217
+ readonly toolCallId: string;
2218
+ readonly childThreadId: string;
2219
+ readonly childSubmissionId: string;
2220
+ readonly childReceiptId: string;
2221
+ readonly childRunId: string;
2222
+ } | {
2223
+ readonly _tag: "SubagentJoined";
2224
+ readonly runId: string;
2225
+ readonly toolCallId: string;
2226
+ readonly childSubmissionId: string;
2227
+ readonly childSettlementId: string;
2228
+ readonly childOutcome: "aborted" | "completed" | "failed";
2229
+ readonly childResultDigest: string;
2230
+ readonly projectedResultDigest: string;
2231
+ readonly usageSummary: Schema.Json;
2232
+ readonly usage?: {
2233
+ readonly modelCalls: number;
2234
+ readonly inputTokens: number;
2235
+ readonly outputTokens: number;
2236
+ readonly costMicrousd: number;
2237
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2238
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
2239
+ readonly unobservedModelCalls?: number | undefined;
2240
+ } | undefined;
2241
+ readonly delegatedUsage?: {
2242
+ readonly modelCalls: number;
2243
+ readonly inputTokens: number;
2244
+ readonly outputTokens: number;
2245
+ readonly costMicrousd: number;
2246
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2247
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
2248
+ readonly unobservedModelCalls?: number | undefined;
2249
+ } | undefined;
2250
+ readonly reservationId: string;
2251
+ readonly finalAccounting: Schema.Json;
2252
+ } | {
2253
+ readonly _tag: "SubagentLineageRecorded";
2254
+ readonly parentLink: {
2255
+ readonly delegationId: string;
2256
+ readonly parentAgentId: string;
2257
+ readonly parentThreadId: string;
2258
+ readonly parentRunId: string;
2259
+ readonly parentToolCallId: string;
2260
+ readonly depth: number;
2261
+ };
2262
+ readonly parentSubmissionId: string;
2263
+ readonly childDefinitionDigests: {
2264
+ readonly agent: string;
2265
+ readonly model: string;
2266
+ readonly tools: string;
2267
+ };
2268
+ readonly childInputDigest: string;
2269
+ readonly grantDigest: string;
2270
+ readonly toolCallAllowance?: number | undefined;
2271
+ readonly policy?: Schema.Json | undefined;
2272
+ readonly budget?: {
2273
+ readonly caps: {
2274
+ readonly maxTotalChildInvocations?: number | undefined;
2275
+ readonly maxConcurrentChildren?: number | undefined;
2276
+ readonly maxTurns?: number | undefined;
2277
+ readonly maxToolCalls?: number | undefined;
2278
+ readonly maxDurationMillis?: number | undefined;
2279
+ readonly maxInputTokens?: number | undefined;
2280
+ readonly maxOutputTokens?: number | undefined;
2281
+ readonly maxCostMicrousd?: number | undefined;
2282
+ readonly maxResultBytes?: number | undefined;
2283
+ };
2284
+ readonly allocation: {
2285
+ readonly turns: number;
2286
+ readonly toolCalls: number;
2287
+ readonly durationMillis: number;
2288
+ readonly inputTokens: number;
2289
+ readonly outputTokens: number;
2290
+ readonly costMicrousd: number;
2291
+ readonly resultBytes: number;
2292
+ };
2293
+ readonly descendantInvocations?: number | undefined;
2294
+ } | undefined;
2295
+ readonly grant?: {
2296
+ readonly allowedToolNames: readonly string[];
2297
+ readonly maxDepth: number;
2298
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2299
+ } | undefined;
2300
+ } | {
2301
+ readonly _tag: "WorkerInputRequested";
2302
+ readonly admission: {
2303
+ readonly origin: {
2304
+ readonly worker: {
2305
+ readonly schemaVersion: 1;
2306
+ readonly delegationId: string;
2307
+ readonly targetAgentId: string;
2308
+ readonly threadId: string;
2309
+ };
2310
+ readonly source: {
2311
+ readonly _tag: "tool";
2312
+ readonly agentId: string;
2313
+ readonly threadId: string;
2314
+ readonly runId: string;
2315
+ readonly toolCallId: string;
2316
+ } | {
2317
+ readonly _tag: "programmatic";
2318
+ readonly agentId: string;
2319
+ readonly threadId: string;
2320
+ };
2321
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
2322
+ readonly targetDigests: {
2323
+ readonly agent: string;
2324
+ readonly model: string;
2325
+ readonly tools: string;
2326
+ };
2327
+ readonly policy: Schema.Json;
2328
+ readonly budget: {
2329
+ readonly caps: {
2330
+ readonly maxTotalChildInvocations?: number | undefined;
2331
+ readonly maxConcurrentChildren?: number | undefined;
2332
+ readonly maxTurns?: number | undefined;
2333
+ readonly maxToolCalls?: number | undefined;
2334
+ readonly maxDurationMillis?: number | undefined;
2335
+ readonly maxInputTokens?: number | undefined;
2336
+ readonly maxOutputTokens?: number | undefined;
2337
+ readonly maxCostMicrousd?: number | undefined;
2338
+ readonly maxResultBytes?: number | undefined;
2339
+ };
2340
+ readonly allocation: {
2341
+ readonly turns: number;
2342
+ readonly toolCalls: number;
2343
+ readonly durationMillis: number;
2344
+ readonly inputTokens: number;
2345
+ readonly outputTokens: number;
2346
+ readonly costMicrousd: number;
2347
+ readonly resultBytes: number;
2348
+ };
2349
+ readonly descendantInvocations?: number | undefined;
2350
+ };
2351
+ readonly grant: {
2352
+ readonly allowedToolNames: readonly string[];
2353
+ readonly maxDepth: number;
2354
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2355
+ };
2356
+ readonly depth: number;
2357
+ readonly toolCallAllowance?: number | undefined;
2358
+ readonly firstMessageId: string;
2359
+ readonly createdAtMillis: number;
2360
+ readonly expiresAtMillis: number;
2361
+ readonly reporting?: {
2362
+ readonly sourceDigests: {
2363
+ readonly agent: string;
2364
+ readonly model: string;
2365
+ readonly tools: string;
2366
+ };
2367
+ readonly destinationDelegationId?: string | undefined;
2368
+ } | undefined;
2369
+ };
2370
+ readonly messageId: string;
2371
+ readonly parameters: Schema.Json;
2372
+ readonly createdAtMillis: number;
2373
+ readonly sourceSubmissionId?: string | undefined;
2374
+ readonly deliveryPrincipal?: string | undefined;
2375
+ };
2376
+ readonly inputDigest: string;
2377
+ } | {
2378
+ readonly _tag: "WorkerOriginRecorded";
2379
+ readonly origin: {
2380
+ readonly worker: {
2381
+ readonly schemaVersion: 1;
2382
+ readonly delegationId: string;
2383
+ readonly targetAgentId: string;
2384
+ readonly threadId: string;
2385
+ };
2386
+ readonly source: {
2387
+ readonly _tag: "tool";
2388
+ readonly agentId: string;
2389
+ readonly threadId: string;
2390
+ readonly runId: string;
2391
+ readonly toolCallId: string;
2392
+ } | {
2393
+ readonly _tag: "programmatic";
2394
+ readonly agentId: string;
2395
+ readonly threadId: string;
2396
+ };
2397
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
2398
+ readonly targetDigests: {
2399
+ readonly agent: string;
2400
+ readonly model: string;
2401
+ readonly tools: string;
2402
+ };
2403
+ readonly policy: Schema.Json;
2404
+ readonly budget: {
2405
+ readonly caps: {
2406
+ readonly maxTotalChildInvocations?: number | undefined;
2407
+ readonly maxConcurrentChildren?: number | undefined;
2408
+ readonly maxTurns?: number | undefined;
2409
+ readonly maxToolCalls?: number | undefined;
2410
+ readonly maxDurationMillis?: number | undefined;
2411
+ readonly maxInputTokens?: number | undefined;
2412
+ readonly maxOutputTokens?: number | undefined;
2413
+ readonly maxCostMicrousd?: number | undefined;
2414
+ readonly maxResultBytes?: number | undefined;
2415
+ };
2416
+ readonly allocation: {
2417
+ readonly turns: number;
2418
+ readonly toolCalls: number;
2419
+ readonly durationMillis: number;
2420
+ readonly inputTokens: number;
2421
+ readonly outputTokens: number;
2422
+ readonly costMicrousd: number;
2423
+ readonly resultBytes: number;
2424
+ };
2425
+ readonly descendantInvocations?: number | undefined;
2426
+ };
2427
+ readonly grant: {
2428
+ readonly allowedToolNames: readonly string[];
2429
+ readonly maxDepth: number;
2430
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2431
+ };
2432
+ readonly depth: number;
2433
+ readonly toolCallAllowance?: number | undefined;
2434
+ readonly firstMessageId: string;
2435
+ readonly createdAtMillis: number;
2436
+ readonly expiresAtMillis: number;
2437
+ readonly reporting?: {
2438
+ readonly sourceDigests: {
2439
+ readonly agent: string;
2440
+ readonly model: string;
2441
+ readonly tools: string;
2442
+ };
2443
+ readonly destinationDelegationId?: string | undefined;
2444
+ } | undefined;
2445
+ };
2446
+ } | {
2447
+ readonly _tag: "WorkerInputCompleted";
2448
+ readonly messageId: string;
2449
+ readonly workerThreadId: string;
2450
+ readonly submissionId: string;
2451
+ readonly receiptId: string;
2452
+ readonly settlementId: string;
2453
+ readonly completedAtMillis: number;
2454
+ } | {
2455
+ readonly _tag: "WorkerReportPrepared";
2456
+ readonly runId: string;
2457
+ readonly messageId: string;
2458
+ readonly envelope: Schema.Json;
2459
+ readonly createdAtMillis: number;
2460
+ readonly deadlineAtMillis: number;
2461
+ } | {
2462
+ readonly _tag: "WorkerReportRefused";
2463
+ readonly runId: string;
2464
+ readonly messageId: string;
2465
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
2466
+ } | {
2467
+ readonly _tag: "PeerMessagePrepared";
2468
+ readonly messageId: string;
2469
+ readonly sourcePrincipal: string;
2470
+ readonly operation: "reply" | "send";
2471
+ readonly deadlineAtMillis: number;
2472
+ readonly encodedEnvelope: Schema.Json;
2473
+ } | {
2474
+ readonly _tag: "SubtreeBudgetReserved";
2475
+ readonly reservationId: string;
2476
+ readonly sourceSubmissionId?: string | undefined;
2477
+ readonly childThreadId: string;
2478
+ readonly lifetime: "attached" | "background";
2479
+ readonly depth: number;
2480
+ readonly policy: Schema.Json;
2481
+ readonly grant: {
2482
+ readonly allowedToolNames: readonly string[];
2483
+ readonly maxDepth: number;
2484
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2485
+ };
2486
+ readonly budget: {
2487
+ readonly caps: {
2488
+ readonly maxTotalChildInvocations?: number | undefined;
2489
+ readonly maxConcurrentChildren?: number | undefined;
2490
+ readonly maxTurns?: number | undefined;
2491
+ readonly maxToolCalls?: number | undefined;
2492
+ readonly maxDurationMillis?: number | undefined;
2493
+ readonly maxInputTokens?: number | undefined;
2494
+ readonly maxOutputTokens?: number | undefined;
2495
+ readonly maxCostMicrousd?: number | undefined;
2496
+ readonly maxResultBytes?: number | undefined;
2497
+ };
2498
+ readonly allocation: {
2499
+ readonly turns: number;
2500
+ readonly toolCalls: number;
2501
+ readonly durationMillis: number;
2502
+ readonly inputTokens: number;
2503
+ readonly outputTokens: number;
2504
+ readonly costMicrousd: number;
2505
+ readonly resultBytes: number;
2506
+ };
2507
+ readonly descendantInvocations?: number | undefined;
2508
+ };
2509
+ } | {
2510
+ readonly _tag: "RepairAnnotated";
2511
+ readonly reason: string;
2512
+ readonly details: Schema.Json;
2513
+ };
2514
+ };
2515
+ }[];
2516
+ } | {
2517
+ readonly _tag: "StoreInspectTailResult";
2518
+ readonly tail: {
2519
+ readonly threadId: string;
2520
+ readonly tailSequence: number;
2521
+ readonly tailDigest: string;
2522
+ readonly producerEpoch: number;
2523
+ };
2524
+ } | {
2525
+ readonly _tag: "StoreExportResult";
2526
+ readonly export: {
2527
+ readonly format: "effect-agent/thread@1";
2528
+ readonly threadId: string;
2529
+ readonly tailSequence: number;
2530
+ readonly tailDigest: string;
2531
+ readonly records: readonly {
2532
+ readonly threadId: string;
2533
+ readonly batchId: string;
2534
+ readonly sequence: number;
2535
+ readonly offset: string;
2536
+ readonly record: {
2537
+ readonly recordId: string;
2538
+ readonly family: "thread";
2539
+ readonly schemaVersion: 1;
2540
+ readonly createdAt: string;
2541
+ readonly deploymentId: string;
2542
+ readonly payload: {
2543
+ readonly _tag: "ThreadCreated";
2544
+ readonly agentId: string;
2545
+ readonly definitions: {
2546
+ readonly agent: string;
2547
+ readonly model: string;
2548
+ readonly tools: string;
2549
+ };
2550
+ } | {
2551
+ readonly _tag: "UserInputRecorded";
2552
+ readonly submissionId?: string | undefined;
2553
+ readonly kind: "follow-up" | "steering" | "user";
2554
+ readonly runId?: string | undefined;
2555
+ readonly input: Schema.Json;
2556
+ readonly messageAdmission?: {
2557
+ readonly schemaVersion: 1;
2558
+ readonly message: {
2559
+ readonly ownerThreadId: string;
2560
+ readonly messageId: string;
2561
+ };
2562
+ readonly peerName: string;
2563
+ readonly sender: {
2564
+ readonly threadId: string;
2565
+ readonly agentId: string;
2566
+ };
2567
+ readonly returnAddress: {
2568
+ readonly threadId: string;
2569
+ readonly agentId: string;
2570
+ };
2571
+ readonly inReplyTo?: {
2572
+ readonly ownerThreadId: string;
2573
+ readonly messageId: string;
2574
+ } | undefined;
2575
+ } | undefined;
2576
+ } | {
2577
+ readonly _tag: "RunStarted";
2578
+ readonly runId: string;
2579
+ readonly policyAccountingVersion: 1;
2580
+ readonly maxDurationMillis: number;
2581
+ } | {
2582
+ readonly _tag: "RunPolicyUsageReserved";
2583
+ readonly runId: string;
2584
+ readonly programmaticToolCalls: number;
2585
+ readonly finalizationUsed: boolean;
2586
+ } | {
2587
+ readonly _tag: "ModelCompleted";
2588
+ readonly runId: string;
2589
+ readonly output: Schema.Json;
2590
+ readonly messages?: Schema.Json | undefined;
2591
+ } | {
2592
+ readonly _tag: "ModelResponseRecorded";
2593
+ readonly toolExposure?: {
2594
+ readonly exposedToolNames: readonly string[];
2595
+ readonly selection?: {
2596
+ readonly toolNames: readonly string[];
2597
+ } | undefined;
2598
+ } | undefined;
2599
+ readonly runId: string;
2600
+ readonly turnId: string;
2601
+ readonly turn: number;
2602
+ readonly messages: Schema.Json;
2603
+ readonly messagesDigest: string;
2604
+ readonly runScopedPrefixLength?: number | undefined;
2605
+ readonly modelUsage?: readonly {
2606
+ readonly provider: string;
2607
+ readonly model: string;
2608
+ readonly serviceTier?: string | undefined;
2609
+ readonly pricingVersion?: string | undefined;
2610
+ readonly response?: {
2611
+ readonly id?: string | undefined;
2612
+ readonly model?: string | undefined;
2613
+ } | undefined;
2614
+ readonly purpose?: "summary" | "turn" | undefined;
2615
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2616
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
2617
+ readonly inputTokens: {
2618
+ readonly total: number;
2619
+ readonly uncached: number;
2620
+ readonly cacheRead: number;
2621
+ readonly cacheWrite: number;
2622
+ };
2623
+ readonly outputTokens: {
2624
+ readonly total: number;
2625
+ readonly text: number;
2626
+ readonly reasoning: number;
2627
+ };
2628
+ readonly costMicrousd: number;
2629
+ }[] | undefined;
2630
+ readonly unobservedModelCalls?: number | undefined;
2631
+ readonly inputTokens?: number | undefined;
2632
+ readonly outputTokens?: number | undefined;
2633
+ readonly costMicrousd?: number | undefined;
2634
+ } | {
2635
+ readonly _tag: "ToolCallPrepared";
2636
+ readonly runId: string;
2637
+ readonly turnId: string;
2638
+ readonly turn: number;
2639
+ readonly toolCallId: string;
2640
+ readonly toolName: string;
2641
+ readonly parameters: Schema.Json;
2642
+ readonly parametersDigest: string;
2643
+ readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
2644
+ } | {
2645
+ readonly _tag: "ToolCallSettled";
2646
+ readonly toolSelection?: {
2647
+ readonly toolNames: readonly string[];
2648
+ } | undefined;
2649
+ readonly runId: string;
2650
+ readonly toolCallId: string;
2651
+ readonly toolName: string;
2652
+ readonly result: Schema.Json;
2653
+ readonly isFailure: boolean;
2654
+ readonly budgetRejected?: true | undefined;
2655
+ } | {
2656
+ readonly _tag: "ToolCallUnknown";
2657
+ readonly runId: string;
2658
+ readonly turn: number;
2659
+ readonly toolCallId: string;
2660
+ readonly toolName: string;
2661
+ readonly reason: string;
2662
+ } | {
2663
+ readonly _tag: "ToolCallResolved";
2664
+ readonly runId: string;
2665
+ readonly toolCallId: string;
2666
+ readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
2667
+ readonly author: string;
2668
+ readonly reason: string;
2669
+ } | {
2670
+ readonly _tag: "ToolStepSettled";
2671
+ readonly runId: string;
2672
+ readonly toolCallId: string;
2673
+ readonly stepName: string;
2674
+ readonly output: Schema.Json;
2675
+ readonly outputDigest: string;
2676
+ } | {
2677
+ readonly _tag: "ToolApprovalRequested";
2678
+ readonly runId: string;
2679
+ readonly turnId: string;
2680
+ readonly turn: number;
2681
+ readonly toolCallId: string;
2682
+ readonly toolName: string;
2683
+ readonly parametersDigest: string;
2684
+ } | {
2685
+ readonly _tag: "ToolApprovalDecided";
2686
+ readonly runId: string;
2687
+ readonly turn: number;
2688
+ readonly toolCallId: string;
2689
+ readonly decision: "approved" | "denied";
2690
+ readonly resolver: string;
2691
+ readonly reason: string;
2692
+ } | {
2693
+ readonly _tag: "ModelResponseInterrupted";
2694
+ readonly runId: string;
2695
+ readonly supersededEpoch: number;
2696
+ readonly attemptId: string;
2697
+ readonly reason: string;
2698
+ } | {
2699
+ readonly _tag: "CompactionCreated";
2700
+ readonly runId: string;
2701
+ readonly turn: number;
2702
+ readonly kind: "clear-tool-results" | "rollover" | "summarize";
2703
+ readonly coversThrough: number;
2704
+ readonly summary?: string | undefined;
2705
+ readonly handoff?: string | undefined;
2706
+ } | {
2707
+ readonly _tag: "RunFailed";
2708
+ readonly runId: string;
2709
+ readonly failure: Schema.Json;
2710
+ } | {
2711
+ readonly _tag: "RunCompleted";
2712
+ readonly runId: string;
2713
+ readonly output: Schema.Json;
2714
+ readonly runDisposition?: Schema.Json | undefined;
2715
+ readonly finishReason?: "budget-exhausted" | undefined;
2716
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
2717
+ } | {
2718
+ readonly _tag: "AbortRequested";
2719
+ readonly submissionId: string;
2720
+ readonly author: string;
2721
+ readonly reason: string;
2722
+ } | {
2723
+ readonly _tag: "SubmissionSettled";
2724
+ readonly submissionId: string;
2725
+ readonly settlementId: string;
2726
+ readonly receiptId: string;
2727
+ readonly outcome: "aborted" | "completed" | "failed";
2728
+ readonly runId?: string | undefined;
2729
+ readonly result?: Schema.Json | undefined;
2730
+ readonly runDisposition?: Schema.Json | undefined;
2731
+ readonly finishReason?: "budget-exhausted" | undefined;
2732
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
2733
+ readonly policyLimit?: "cost" | "duration" | "repeated-failures" | "tokens" | "tool-calls" | "turns" | "usage" | undefined;
2734
+ readonly usageSummary?: {
2735
+ readonly modelCalls: number;
2736
+ readonly inputTokens: {
2737
+ readonly total: number;
2738
+ readonly uncached: number;
2739
+ readonly cacheRead: number;
2740
+ readonly cacheWrite: number;
2741
+ };
2742
+ readonly outputTokens: {
2743
+ readonly total: number;
2744
+ readonly text: number;
2745
+ readonly reasoning: number;
2746
+ };
2747
+ readonly costMicrousd: number;
2748
+ readonly byModel: readonly {
2749
+ readonly provider: string;
2750
+ readonly model: string;
2751
+ readonly responseModel?: string | undefined;
2752
+ readonly serviceTier?: string | undefined;
2753
+ readonly pricingVersion?: string | undefined;
2754
+ readonly modelCalls: number;
2755
+ readonly inputTokens: {
2756
+ readonly total: number;
2757
+ readonly uncached: number;
2758
+ readonly cacheRead: number;
2759
+ readonly cacheWrite: number;
2760
+ };
2761
+ readonly outputTokens: {
2762
+ readonly total: number;
2763
+ readonly text: number;
2764
+ readonly reasoning: number;
2765
+ };
2766
+ readonly costMicrousd: number;
2767
+ }[];
2768
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2769
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
2770
+ readonly unobservedModelCalls?: number | undefined;
2771
+ } | undefined;
2772
+ readonly uncommittedModelUsage?: readonly {
2773
+ readonly provider: string;
2774
+ readonly model: string;
2775
+ readonly serviceTier?: string | undefined;
2776
+ readonly pricingVersion?: string | undefined;
2777
+ readonly response?: {
2778
+ readonly id?: string | undefined;
2779
+ readonly model?: string | undefined;
2780
+ } | undefined;
2781
+ readonly purpose?: "summary" | "turn" | undefined;
2782
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2783
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
2784
+ readonly inputTokens: {
2785
+ readonly total: number;
2786
+ readonly uncached: number;
2787
+ readonly cacheRead: number;
2788
+ readonly cacheWrite: number;
2789
+ };
2790
+ readonly outputTokens: {
2791
+ readonly total: number;
2792
+ readonly text: number;
2793
+ readonly reasoning: number;
2794
+ };
2795
+ readonly costMicrousd: number;
2796
+ }[] | undefined;
2797
+ } | {
2798
+ readonly _tag: "SubagentRequested";
2799
+ readonly runId: string;
2800
+ readonly turnId: string;
2801
+ readonly turn: number;
2802
+ readonly toolCallId: string;
2803
+ readonly delegationId: string;
2804
+ readonly targetAgentId: string;
2805
+ readonly targetDigests: {
2806
+ readonly agent: string;
2807
+ readonly model: string;
2808
+ readonly tools: string;
2809
+ };
2810
+ readonly childInput: Schema.Json;
2811
+ readonly childInputDigest: string;
2812
+ readonly grantDigest: string;
2813
+ readonly reservationId: string;
2814
+ readonly reservationDigest: string;
2815
+ readonly childThreadId: string;
2816
+ readonly childPrincipal: string;
2817
+ readonly childIdempotencyKey: string;
2818
+ readonly toolCallAllowance?: number | undefined;
2819
+ readonly policy?: Schema.Json | undefined;
2820
+ readonly budget?: {
2821
+ readonly caps: {
2822
+ readonly maxTotalChildInvocations?: number | undefined;
2823
+ readonly maxConcurrentChildren?: number | undefined;
2824
+ readonly maxTurns?: number | undefined;
2825
+ readonly maxToolCalls?: number | undefined;
2826
+ readonly maxDurationMillis?: number | undefined;
2827
+ readonly maxInputTokens?: number | undefined;
2828
+ readonly maxOutputTokens?: number | undefined;
2829
+ readonly maxCostMicrousd?: number | undefined;
2830
+ readonly maxResultBytes?: number | undefined;
2831
+ };
2832
+ readonly allocation: {
2833
+ readonly turns: number;
2834
+ readonly toolCalls: number;
2835
+ readonly durationMillis: number;
2836
+ readonly inputTokens: number;
2837
+ readonly outputTokens: number;
2838
+ readonly costMicrousd: number;
2839
+ readonly resultBytes: number;
2840
+ };
2841
+ readonly descendantInvocations?: number | undefined;
2842
+ } | undefined;
2843
+ readonly grant?: {
2844
+ readonly allowedToolNames: readonly string[];
2845
+ readonly maxDepth: number;
2846
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2847
+ } | undefined;
2848
+ readonly depth?: number | undefined;
2849
+ } | {
2850
+ readonly _tag: "SubagentStarted";
2851
+ readonly runId: string;
2852
+ readonly toolCallId: string;
2853
+ readonly childThreadId: string;
2854
+ readonly childSubmissionId: string;
2855
+ readonly childReceiptId: string;
2856
+ readonly childRunId: string;
2857
+ } | {
2858
+ readonly _tag: "SubagentJoined";
2859
+ readonly runId: string;
2860
+ readonly toolCallId: string;
2861
+ readonly childSubmissionId: string;
2862
+ readonly childSettlementId: string;
2863
+ readonly childOutcome: "aborted" | "completed" | "failed";
2864
+ readonly childResultDigest: string;
2865
+ readonly projectedResultDigest: string;
2866
+ readonly usageSummary: Schema.Json;
2867
+ readonly usage?: {
2868
+ readonly modelCalls: number;
2869
+ readonly inputTokens: number;
2870
+ readonly outputTokens: number;
2871
+ readonly costMicrousd: number;
2872
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2873
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
2874
+ readonly unobservedModelCalls?: number | undefined;
2875
+ } | undefined;
2876
+ readonly delegatedUsage?: {
2877
+ readonly modelCalls: number;
2878
+ readonly inputTokens: number;
2879
+ readonly outputTokens: number;
2880
+ readonly costMicrousd: number;
2881
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
2882
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
2883
+ readonly unobservedModelCalls?: number | undefined;
2884
+ } | undefined;
2885
+ readonly reservationId: string;
2886
+ readonly finalAccounting: Schema.Json;
2887
+ } | {
2888
+ readonly _tag: "SubagentLineageRecorded";
2889
+ readonly parentLink: {
2890
+ readonly delegationId: string;
2891
+ readonly parentAgentId: string;
2892
+ readonly parentThreadId: string;
2893
+ readonly parentRunId: string;
2894
+ readonly parentToolCallId: string;
2895
+ readonly depth: number;
2896
+ };
2897
+ readonly parentSubmissionId: string;
2898
+ readonly childDefinitionDigests: {
2899
+ readonly agent: string;
2900
+ readonly model: string;
2901
+ readonly tools: string;
2902
+ };
2903
+ readonly childInputDigest: string;
2904
+ readonly grantDigest: string;
2905
+ readonly toolCallAllowance?: number | undefined;
2906
+ readonly policy?: Schema.Json | undefined;
2907
+ readonly budget?: {
2908
+ readonly caps: {
2909
+ readonly maxTotalChildInvocations?: number | undefined;
2910
+ readonly maxConcurrentChildren?: number | undefined;
2911
+ readonly maxTurns?: number | undefined;
2912
+ readonly maxToolCalls?: number | undefined;
2913
+ readonly maxDurationMillis?: number | undefined;
2914
+ readonly maxInputTokens?: number | undefined;
2915
+ readonly maxOutputTokens?: number | undefined;
2916
+ readonly maxCostMicrousd?: number | undefined;
2917
+ readonly maxResultBytes?: number | undefined;
2918
+ };
2919
+ readonly allocation: {
2920
+ readonly turns: number;
2921
+ readonly toolCalls: number;
2922
+ readonly durationMillis: number;
2923
+ readonly inputTokens: number;
2924
+ readonly outputTokens: number;
2925
+ readonly costMicrousd: number;
2926
+ readonly resultBytes: number;
2927
+ };
2928
+ readonly descendantInvocations?: number | undefined;
2929
+ } | undefined;
2930
+ readonly grant?: {
2931
+ readonly allowedToolNames: readonly string[];
2932
+ readonly maxDepth: number;
2933
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2934
+ } | undefined;
2935
+ } | {
2936
+ readonly _tag: "WorkerInputRequested";
2937
+ readonly admission: {
2938
+ readonly origin: {
2939
+ readonly worker: {
2940
+ readonly schemaVersion: 1;
2941
+ readonly delegationId: string;
2942
+ readonly targetAgentId: string;
2943
+ readonly threadId: string;
2944
+ };
2945
+ readonly source: {
2946
+ readonly _tag: "tool";
2947
+ readonly agentId: string;
2948
+ readonly threadId: string;
2949
+ readonly runId: string;
2950
+ readonly toolCallId: string;
2951
+ } | {
2952
+ readonly _tag: "programmatic";
2953
+ readonly agentId: string;
2954
+ readonly threadId: string;
2955
+ };
2956
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
2957
+ readonly targetDigests: {
2958
+ readonly agent: string;
2959
+ readonly model: string;
2960
+ readonly tools: string;
2961
+ };
2962
+ readonly policy: Schema.Json;
2963
+ readonly budget: {
2964
+ readonly caps: {
2965
+ readonly maxTotalChildInvocations?: number | undefined;
2966
+ readonly maxConcurrentChildren?: number | undefined;
2967
+ readonly maxTurns?: number | undefined;
2968
+ readonly maxToolCalls?: number | undefined;
2969
+ readonly maxDurationMillis?: number | undefined;
2970
+ readonly maxInputTokens?: number | undefined;
2971
+ readonly maxOutputTokens?: number | undefined;
2972
+ readonly maxCostMicrousd?: number | undefined;
2973
+ readonly maxResultBytes?: number | undefined;
2974
+ };
2975
+ readonly allocation: {
2976
+ readonly turns: number;
2977
+ readonly toolCalls: number;
2978
+ readonly durationMillis: number;
2979
+ readonly inputTokens: number;
2980
+ readonly outputTokens: number;
2981
+ readonly costMicrousd: number;
2982
+ readonly resultBytes: number;
2983
+ };
2984
+ readonly descendantInvocations?: number | undefined;
2985
+ };
2986
+ readonly grant: {
2987
+ readonly allowedToolNames: readonly string[];
2988
+ readonly maxDepth: number;
2989
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2990
+ };
2991
+ readonly depth: number;
2992
+ readonly toolCallAllowance?: number | undefined;
2993
+ readonly firstMessageId: string;
2994
+ readonly createdAtMillis: number;
2995
+ readonly expiresAtMillis: number;
2996
+ readonly reporting?: {
2997
+ readonly sourceDigests: {
2998
+ readonly agent: string;
2999
+ readonly model: string;
3000
+ readonly tools: string;
3001
+ };
3002
+ readonly destinationDelegationId?: string | undefined;
3003
+ } | undefined;
3004
+ };
3005
+ readonly messageId: string;
3006
+ readonly parameters: Schema.Json;
3007
+ readonly createdAtMillis: number;
3008
+ readonly sourceSubmissionId?: string | undefined;
3009
+ readonly deliveryPrincipal?: string | undefined;
3010
+ };
3011
+ readonly inputDigest: string;
3012
+ } | {
3013
+ readonly _tag: "WorkerOriginRecorded";
3014
+ readonly origin: {
3015
+ readonly worker: {
3016
+ readonly schemaVersion: 1;
3017
+ readonly delegationId: string;
3018
+ readonly targetAgentId: string;
3019
+ readonly threadId: string;
3020
+ };
3021
+ readonly source: {
3022
+ readonly _tag: "tool";
3023
+ readonly agentId: string;
3024
+ readonly threadId: string;
3025
+ readonly runId: string;
3026
+ readonly toolCallId: string;
3027
+ } | {
3028
+ readonly _tag: "programmatic";
3029
+ readonly agentId: string;
3030
+ readonly threadId: string;
3031
+ };
3032
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
3033
+ readonly targetDigests: {
3034
+ readonly agent: string;
3035
+ readonly model: string;
3036
+ readonly tools: string;
3037
+ };
3038
+ readonly policy: Schema.Json;
3039
+ readonly budget: {
3040
+ readonly caps: {
3041
+ readonly maxTotalChildInvocations?: number | undefined;
3042
+ readonly maxConcurrentChildren?: number | undefined;
3043
+ readonly maxTurns?: number | undefined;
3044
+ readonly maxToolCalls?: number | undefined;
3045
+ readonly maxDurationMillis?: number | undefined;
3046
+ readonly maxInputTokens?: number | undefined;
3047
+ readonly maxOutputTokens?: number | undefined;
3048
+ readonly maxCostMicrousd?: number | undefined;
3049
+ readonly maxResultBytes?: number | undefined;
3050
+ };
3051
+ readonly allocation: {
3052
+ readonly turns: number;
3053
+ readonly toolCalls: number;
3054
+ readonly durationMillis: number;
3055
+ readonly inputTokens: number;
3056
+ readonly outputTokens: number;
3057
+ readonly costMicrousd: number;
3058
+ readonly resultBytes: number;
3059
+ };
3060
+ readonly descendantInvocations?: number | undefined;
3061
+ };
3062
+ readonly grant: {
3063
+ readonly allowedToolNames: readonly string[];
3064
+ readonly maxDepth: number;
3065
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
3066
+ };
3067
+ readonly depth: number;
3068
+ readonly toolCallAllowance?: number | undefined;
3069
+ readonly firstMessageId: string;
3070
+ readonly createdAtMillis: number;
3071
+ readonly expiresAtMillis: number;
3072
+ readonly reporting?: {
3073
+ readonly sourceDigests: {
3074
+ readonly agent: string;
3075
+ readonly model: string;
3076
+ readonly tools: string;
3077
+ };
3078
+ readonly destinationDelegationId?: string | undefined;
3079
+ } | undefined;
3080
+ };
3081
+ } | {
3082
+ readonly _tag: "WorkerInputCompleted";
3083
+ readonly messageId: string;
3084
+ readonly workerThreadId: string;
3085
+ readonly submissionId: string;
3086
+ readonly receiptId: string;
3087
+ readonly settlementId: string;
3088
+ readonly completedAtMillis: number;
3089
+ } | {
3090
+ readonly _tag: "WorkerReportPrepared";
3091
+ readonly runId: string;
3092
+ readonly messageId: string;
3093
+ readonly envelope: Schema.Json;
3094
+ readonly createdAtMillis: number;
3095
+ readonly deadlineAtMillis: number;
3096
+ } | {
3097
+ readonly _tag: "WorkerReportRefused";
3098
+ readonly runId: string;
3099
+ readonly messageId: string;
3100
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
3101
+ } | {
3102
+ readonly _tag: "PeerMessagePrepared";
3103
+ readonly messageId: string;
3104
+ readonly sourcePrincipal: string;
3105
+ readonly operation: "reply" | "send";
3106
+ readonly deadlineAtMillis: number;
3107
+ readonly encodedEnvelope: Schema.Json;
3108
+ } | {
3109
+ readonly _tag: "SubtreeBudgetReserved";
3110
+ readonly reservationId: string;
3111
+ readonly sourceSubmissionId?: string | undefined;
3112
+ readonly childThreadId: string;
3113
+ readonly lifetime: "attached" | "background";
3114
+ readonly depth: number;
3115
+ readonly policy: Schema.Json;
3116
+ readonly grant: {
3117
+ readonly allowedToolNames: readonly string[];
3118
+ readonly maxDepth: number;
3119
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
3120
+ };
3121
+ readonly budget: {
3122
+ readonly caps: {
3123
+ readonly maxTotalChildInvocations?: number | undefined;
3124
+ readonly maxConcurrentChildren?: number | undefined;
3125
+ readonly maxTurns?: number | undefined;
3126
+ readonly maxToolCalls?: number | undefined;
3127
+ readonly maxDurationMillis?: number | undefined;
3128
+ readonly maxInputTokens?: number | undefined;
3129
+ readonly maxOutputTokens?: number | undefined;
3130
+ readonly maxCostMicrousd?: number | undefined;
3131
+ readonly maxResultBytes?: number | undefined;
3132
+ };
3133
+ readonly allocation: {
3134
+ readonly turns: number;
3135
+ readonly toolCalls: number;
3136
+ readonly durationMillis: number;
3137
+ readonly inputTokens: number;
3138
+ readonly outputTokens: number;
3139
+ readonly costMicrousd: number;
3140
+ readonly resultBytes: number;
3141
+ };
3142
+ readonly descendantInvocations?: number | undefined;
3143
+ };
3144
+ } | {
3145
+ readonly _tag: "RepairAnnotated";
3146
+ readonly reason: string;
3147
+ readonly details: Schema.Json;
3148
+ };
3149
+ };
3150
+ }[];
3151
+ };
3152
+ };
3153
+ } | {
3154
+ readonly _tag: "PortFailed";
3155
+ readonly failure: {
3156
+ readonly _tag: "ThreadNotMaterialized";
3157
+ readonly threadId: string;
3158
+ } | {
3159
+ readonly _tag: "FenceRejected";
3160
+ readonly threadId: string;
3161
+ readonly actualEpoch: number;
3162
+ readonly attemptedEpoch: number;
3163
+ } | {
3164
+ readonly _tag: "ThreadStoreError";
3165
+ readonly operation: string;
3166
+ readonly message: string;
3167
+ readonly cause?: Schema.Json | undefined;
3168
+ } | {
3169
+ readonly _tag: "AppendConflict";
3170
+ readonly threadId: string;
3171
+ readonly batchId: string;
3172
+ readonly reason: "batch-digest" | "record-identity" | "tail";
3173
+ readonly actualTailSequence?: number | undefined;
3174
+ readonly actualTailDigest?: string | undefined;
3175
+ } | {
3176
+ readonly _tag: "AdmissionConflict";
3177
+ readonly threadId: string;
3178
+ readonly principal: string;
3179
+ readonly idempotencyKey: string;
3180
+ readonly existingInputDigest: string;
3181
+ readonly attemptedInputDigest: string;
3182
+ } | {
3183
+ readonly _tag: "AdmissionPolicyError";
3184
+ readonly reason: "occupied" | "refused" | "unavailable";
3185
+ readonly code: string;
3186
+ } | {
3187
+ readonly _tag: "LedgerError";
3188
+ readonly operation: string;
3189
+ readonly message: string;
3190
+ readonly cause?: Schema.Json | undefined;
3191
+ } | {
3192
+ readonly _tag: "SettlementConflict";
3193
+ readonly submissionId: string;
3194
+ readonly existingOutcome: "aborted" | "completed" | "failed";
3195
+ } | {
3196
+ readonly _tag: "PortProtocolError";
3197
+ readonly message: string;
3198
+ } | {
3199
+ readonly _tag: "JoinedToHost";
3200
+ readonly submissionId: string;
3201
+ readonly hostSubmissionId: string;
3202
+ };
3203
+ }, Schema.SchemaError, never>;
3204
+ declare const decodePortResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<PortFailed | PortSucceeded, Schema.SchemaError, never>;
3205
+ //#endregion
3206
+ export { LedgerAdmitCall, LedgerAdmitResult, LedgerLookupCall, LedgerLookupResult, LedgerMarkReadyCall, LedgerMarkReadyResult, LedgerRecordChildSettledCall, LedgerRecordChildSettledResult, LedgerRequestAbortCall, LedgerRequestAbortResult, LedgerResolveAdmissionCall, LedgerResolveAdmissionResult, MAX_PORT_DIAGNOSTIC_LENGTH, PortFailed, PortFailure, PortProtocolError, PortRequest, PortRequestEnvelope, PortResponse, PortResponseEnvelope, PortResult, PortSucceeded, StoreAppendCall, StoreAppendResult, StoreExportCall, StoreExportResult, StoreInspectTailCall, StoreInspectTailResult, StoreMaterializeCall, StoreMaterializeResult, StoreReadPageCall, StoreReadPageResult, boundPortDiagnostic, decodePortRequest, decodePortResponse, encodePortRequest, encodePortResponse, PortProtocol_d_exports as t };
3207
+ //# sourceMappingURL=PortProtocol.d.mts.map