@effect-agent/platform-cloudflare 0.1.0-beta.49 → 0.1.0-beta.51

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 (35) hide show
  1. package/dist/CloudflareBindings.d.mts +1 -0
  2. package/dist/CloudflareBindings.mjs.map +1 -1
  3. package/dist/CloudflareCodeMode.mjs +0 -7
  4. package/dist/CloudflareCodeMode.mjs.map +1 -1
  5. package/dist/CloudflareScheduling.mjs +36 -3
  6. package/dist/CloudflareScheduling.mjs.map +1 -1
  7. package/dist/CloudflareSubscriptions.d.mts +31 -4
  8. package/dist/CloudflareSubscriptions.mjs +170 -11
  9. package/dist/CloudflareSubscriptions.mjs.map +1 -1
  10. package/dist/CloudflareThreadClient.d.mts +150 -74
  11. package/dist/CloudflareThreadClient.mjs +18 -2
  12. package/dist/CloudflareThreadClient.mjs.map +1 -1
  13. package/dist/InteractiveBrowser.mjs +2 -1
  14. package/dist/InteractiveBrowser.mjs.map +1 -1
  15. package/dist/{ThreadObject-IrGuIO4a.mjs → ThreadObject-BY8axaWT.mjs} +11 -3
  16. package/dist/ThreadObject-BY8axaWT.mjs.map +1 -0
  17. package/dist/{ThreadObject-D-NmQZC0.d.mts → ThreadObject-sDr1JBCj.d.mts} +37 -32
  18. package/dist/ThreadObject.d.mts +1 -1
  19. package/dist/ThreadObject.mjs +1 -1
  20. package/dist/index.d.mts +1 -1
  21. package/dist/index.mjs +1 -1
  22. package/dist/prepared-admission-9rvlHI0y.mjs +71 -0
  23. package/dist/prepared-admission-9rvlHI0y.mjs.map +1 -0
  24. package/package.json +1 -1
  25. package/src/CloudflareBindings.ts +1 -0
  26. package/src/CloudflareCodeMode.ts +0 -12
  27. package/src/CloudflareScheduling.ts +52 -0
  28. package/src/CloudflareSubscriptions.ts +321 -8
  29. package/src/CloudflareThreadClient.ts +40 -0
  30. package/src/InteractiveBrowser.ts +3 -1
  31. package/src/ThreadObject.ts +27 -0
  32. package/src/internal/prepared-admission.ts +19 -0
  33. package/dist/ThreadObject-IrGuIO4a.mjs.map +0 -1
  34. package/dist/prepared-admission-DRBhl2Sp.mjs +0 -63
  35. package/dist/prepared-admission-DRBhl2Sp.mjs.map +0 -1
@@ -2,7 +2,7 @@ import { ThreadObjectNamespace, ThreadObjectRpc } from "./CloudflareBindings.mjs
2
2
  import { t as AdmissionLimitExceeded } from "./CloudflareConfig-f3CqTel1.mjs";
3
3
  import { DurableAlarmError } from "./Alarm.mjs";
4
4
  import { DurableSubmitAgent, DurableSubmitOptions, Receipt } from "@effect-agent/thread/DurableAgentRuntime";
5
- import { AbortCommand, AbortIntent, AdmissionConflict, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, JoinedToHost, LedgerError, Settlement, SettlementConflict, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent } from "@effect-agent/thread/SubmissionLedger";
5
+ import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionPolicyError, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, JoinedToHost, LedgerError, Settlement, SettlementConflict, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent } from "@effect-agent/thread/SubmissionLedger";
6
6
  import { Context, Crypto, Effect, Layer, Schema } from "effect";
7
7
  import { ThreadId } from "@effect-agent/core/Identifiers";
8
8
  import { CanonicalRecordEnvelope, CanonicalSequence, DefinitionDigests } from "@effect-agent/thread/Records";
@@ -10,9 +10,10 @@ import { AgentInputError } from "@effect-agent/core/AgentError";
10
10
  import { DigestError } from "@effect-agent/thread/Digest";
11
11
  import { DurableRuntimeFailpointError } from "@effect-agent/thread/DurableFailpoint";
12
12
  import { OperationDenied } from "@effect-agent/thread/OperationAuthorizer";
13
+ import { SubmissionStatus } from "@effect-agent/thread/SubmissionStatus";
13
14
  import { AppendConflict, FenceRejected, ThreadNotMaterialized, ThreadStoreError } from "@effect-agent/thread/ThreadStore";
14
15
  declare namespace CloudflareThreadClient_d_exports {
15
- export { AbortRecorded, ApprovalRecorded, AwaitProgressRequest, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareThreadClient, HostFailed, HostFailure, HostProtocolError, HostResponse, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, SettlementReached, SubmitRequest, SubmitSucceeded, ThreadClientError, UnknownResolutionRecorded, boundHostDiagnostic, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand };
16
+ export { AbortRecorded, ApprovalRecorded, AwaitProgressRequest, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareThreadClient, HostFailed, HostFailure, HostProtocolError, HostResponse, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, SettlementReached, SubmissionStatusResponse, SubmitRequest, SubmitSucceeded, ThreadClientError, UnknownResolutionRecorded, boundHostDiagnostic, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand };
16
17
  }
17
18
  /** Truncate a diagnostic string to the host protocol's bounded length. */
18
19
  declare const boundHostDiagnostic: (value: string) => string;
@@ -39,6 +40,12 @@ declare const SubmitRequest_base: Schema.Class<SubmitRequest, Schema.Struct<{
39
40
  readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
40
41
  readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
41
42
  readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
43
+ readonly admissionGroup: Schema.optionalKey<Schema.NonEmptyString>;
44
+ readonly admissionFence: Schema.optionalKey<Schema.Struct<{
45
+ readonly policyId: Schema.NonEmptyString;
46
+ readonly key: Schema.NonEmptyString;
47
+ readonly revision: Schema.NonEmptyString;
48
+ }>>;
42
49
  readonly definitions: typeof DefinitionDigests;
43
50
  readonly inputPayload: Schema.declare<Schema.Json, Schema.Json>;
44
51
  }>, {}>;
@@ -72,12 +79,16 @@ declare class CancelProgressRequest extends CancelProgressRequest_base {}
72
79
  * classes on the Worker side; `cause` chains travel as Schema defects without instance
73
80
  * fidelity (plan §2.8).
74
81
  */
75
- declare const HostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
82
+ declare const HostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof AdmissionPolicyError, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
76
83
  type HostFailure = typeof HostFailure.Type;
77
84
  declare const SubmitSucceeded_base: Schema.Class<SubmitSucceeded, Schema.TaggedStruct<"SubmitSucceeded", {
78
85
  readonly receipt: typeof Receipt;
79
86
  }>, {}>;
80
87
  declare class SubmitSucceeded extends SubmitSucceeded_base {}
88
+ declare const SubmissionStatusResponse_base: Schema.Class<SubmissionStatusResponse, Schema.TaggedStruct<"SubmissionStatusResponse", {
89
+ readonly status: Schema.Union<readonly [typeof import("@effect-agent/thread/SubmissionStatus").PendingSubmission, typeof import("@effect-agent/thread/SubmissionStatus").SettledSubmission]>;
90
+ }>, {}>;
91
+ declare class SubmissionStatusResponse extends SubmissionStatusResponse_base {}
81
92
  declare const SettlementReached_base: Schema.Class<SettlementReached, Schema.TaggedStruct<"SettlementReached", {
82
93
  readonly settlement: typeof Settlement;
83
94
  }>, {}>;
@@ -104,18 +115,24 @@ declare const UnknownResolutionRecorded_base: Schema.Class<UnknownResolutionReco
104
115
  }>, {}>;
105
116
  declare class UnknownResolutionRecorded extends UnknownResolutionRecorded_base {}
106
117
  declare const HostFailed_base: Schema.Class<HostFailed, Schema.TaggedStruct<"HostFailed", {
107
- readonly failure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
118
+ readonly failure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof AdmissionPolicyError, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
108
119
  }>, {}>;
109
120
  /** The entry point failed TYPED on the Object; the failure re-decodes verbatim. */
110
121
  declare class HostFailed extends HostFailed_base {}
111
122
  /** The uniform answer of one host entry point. Callers narrow by the tag their call implies. */
112
- declare const HostResponse: Schema.Union<readonly [typeof SubmitSucceeded, typeof SettlementReached, typeof ObservedPage, typeof ProgressObserved, typeof ProgressCancelled, typeof AbortRecorded, typeof ApprovalRecorded, typeof UnknownResolutionRecorded, typeof HostFailed]>;
123
+ declare const HostResponse: Schema.Union<readonly [typeof SubmitSucceeded, typeof SettlementReached, typeof SubmissionStatusResponse, typeof ObservedPage, typeof ProgressObserved, typeof ProgressCancelled, typeof AbortRecorded, typeof ApprovalRecorded, typeof UnknownResolutionRecorded, typeof HostFailed]>;
113
124
  type HostResponse = typeof HostResponse.Type;
114
125
  declare const decodeSubmitRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<SubmitRequest, Schema.SchemaError, never>;
115
126
  declare const encodeSubmitRequest: (input: SubmitRequest, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
116
127
  readonly agentId: string;
117
128
  readonly principal: string;
118
129
  readonly idempotencyKey: string;
130
+ readonly admissionGroup?: string | undefined;
131
+ readonly admissionFence?: {
132
+ readonly policyId: string;
133
+ readonly key: string;
134
+ readonly revision: string;
135
+ } | undefined;
119
136
  readonly definitions: {
120
137
  readonly agent: string;
121
138
  readonly model: string;
@@ -176,7 +193,7 @@ declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCommand,
176
193
  readonly _tag: "AbortSubmission";
177
194
  };
178
195
  }, Schema.SchemaError, never>;
179
- declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SubmitSucceeded | UnknownResolutionRecorded, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
196
+ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SubmissionStatusResponse | SubmitSucceeded | UnknownResolutionRecorded, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
180
197
  readonly _tag: "SubmitSucceeded";
181
198
  readonly receipt: {
182
199
  readonly receiptId: string;
@@ -184,6 +201,59 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
184
201
  readonly threadId: string;
185
202
  readonly queueSequence: number;
186
203
  };
204
+ } | {
205
+ readonly _tag: "SubmissionStatusResponse";
206
+ readonly status: {
207
+ readonly _tag: "pending";
208
+ } | {
209
+ readonly _tag: "settled";
210
+ readonly settlement: {
211
+ readonly submissionId: string;
212
+ readonly settlementId: string;
213
+ readonly receiptId: string;
214
+ readonly outcome: "aborted" | "completed" | "failed";
215
+ readonly runDisposition?: Schema.Json | undefined;
216
+ readonly usageSummary?: {
217
+ readonly modelCalls: number;
218
+ readonly inputTokens: {
219
+ readonly total: number;
220
+ readonly uncached: number;
221
+ readonly cacheRead: number;
222
+ readonly cacheWrite: number;
223
+ };
224
+ readonly outputTokens: {
225
+ readonly total: number;
226
+ readonly text: number;
227
+ readonly reasoning: number;
228
+ };
229
+ readonly costMicrousd: number;
230
+ readonly byModel: readonly {
231
+ readonly provider: string;
232
+ readonly model: string;
233
+ readonly serviceTier?: string | undefined;
234
+ readonly pricingVersion?: string | undefined;
235
+ readonly modelCalls: number;
236
+ readonly inputTokens: {
237
+ readonly total: number;
238
+ readonly uncached: number;
239
+ readonly cacheRead: number;
240
+ readonly cacheWrite: number;
241
+ };
242
+ readonly outputTokens: {
243
+ readonly total: number;
244
+ readonly text: number;
245
+ readonly reasoning: number;
246
+ };
247
+ readonly costMicrousd: number;
248
+ }[];
249
+ } | undefined;
250
+ readonly failure?: {
251
+ readonly errorTag: string;
252
+ readonly message: string;
253
+ } | undefined;
254
+ readonly settledAt: string;
255
+ };
256
+ };
187
257
  } | {
188
258
  readonly _tag: "SettlementReached";
189
259
  readonly settlement: {
@@ -246,38 +316,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
246
316
  readonly createdAt: string;
247
317
  readonly deploymentId: string;
248
318
  readonly payload: {
249
- readonly _tag: "ToolCallPrepared";
250
- readonly runId: string;
251
- readonly turnId: string;
252
- readonly turn: number;
253
- readonly toolCallId: string;
254
- readonly toolName: string;
255
- readonly parameters: Schema.Json;
256
- readonly parametersDigest: string;
257
- readonly executionKind?: "delegation" | "ordinary" | undefined;
258
- } | {
259
- readonly _tag: "ToolCallUnknown";
260
- readonly runId: string;
261
- readonly turn: number;
262
- readonly toolCallId: string;
263
- readonly toolName: string;
264
- readonly reason: string;
265
- } | {
266
- readonly _tag: "ToolApprovalDecided";
267
- readonly runId: string;
268
- readonly turn: number;
269
- readonly toolCallId: string;
270
- readonly decision: "approved" | "denied";
271
- readonly resolver: string;
272
- readonly reason: string;
273
- } | {
274
- readonly _tag: "ToolCallResolved";
275
- readonly runId: string;
276
- readonly toolCallId: string;
277
- readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
278
- readonly author: string;
279
- readonly reason: string;
280
- } | {
281
319
  readonly _tag: "AbortRequested";
282
320
  readonly submissionId: string;
283
321
  readonly author: string;
@@ -340,6 +378,16 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
340
378
  readonly inputTokens?: number | undefined;
341
379
  readonly outputTokens?: number | undefined;
342
380
  readonly costMicrousd?: number | undefined;
381
+ } | {
382
+ readonly _tag: "ToolCallPrepared";
383
+ readonly runId: string;
384
+ readonly turnId: string;
385
+ readonly turn: number;
386
+ readonly toolCallId: string;
387
+ readonly toolName: string;
388
+ readonly parameters: Schema.Json;
389
+ readonly parametersDigest: string;
390
+ readonly executionKind?: "delegation" | "ordinary" | undefined;
343
391
  } | {
344
392
  readonly _tag: "ToolCallSettled";
345
393
  readonly runId: string;
@@ -348,6 +396,20 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
348
396
  readonly result: Schema.Json;
349
397
  readonly isFailure: boolean;
350
398
  readonly budgetRejected?: true | undefined;
399
+ } | {
400
+ readonly _tag: "ToolCallUnknown";
401
+ readonly runId: string;
402
+ readonly turn: number;
403
+ readonly toolCallId: string;
404
+ readonly toolName: string;
405
+ readonly reason: string;
406
+ } | {
407
+ readonly _tag: "ToolCallResolved";
408
+ readonly runId: string;
409
+ readonly toolCallId: string;
410
+ readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
411
+ readonly author: string;
412
+ readonly reason: string;
351
413
  } | {
352
414
  readonly _tag: "ToolStepSettled";
353
415
  readonly runId: string;
@@ -363,6 +425,14 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
363
425
  readonly toolCallId: string;
364
426
  readonly toolName: string;
365
427
  readonly parametersDigest: string;
428
+ } | {
429
+ readonly _tag: "ToolApprovalDecided";
430
+ readonly runId: string;
431
+ readonly turn: number;
432
+ readonly toolCallId: string;
433
+ readonly decision: "approved" | "denied";
434
+ readonly resolver: string;
435
+ readonly reason: string;
366
436
  } | {
367
437
  readonly _tag: "ModelResponseInterrupted";
368
438
  readonly runId: string;
@@ -373,9 +443,10 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
373
443
  readonly _tag: "CompactionCreated";
374
444
  readonly runId: string;
375
445
  readonly turn: number;
376
- readonly kind: "clear-tool-results" | "summarize";
446
+ readonly kind: "clear-tool-results" | "rollover" | "summarize";
377
447
  readonly coversThrough: number;
378
448
  readonly summary?: string | undefined;
449
+ readonly handoff?: string | undefined;
379
450
  } | {
380
451
  readonly _tag: "RunFailed";
381
452
  readonly runId: string;
@@ -573,24 +644,29 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
573
644
  } | {
574
645
  readonly _tag: "HostFailed";
575
646
  readonly failure: {
576
- readonly _tag: "OperationDenied";
577
- readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
578
- readonly reason: string;
579
- readonly threadId?: string | undefined;
580
- readonly submissionId?: string | undefined;
581
- } | {
582
- readonly _tag: "LedgerError";
583
- readonly operation: string;
584
- readonly message: string;
585
- readonly cause?: Schema.Json | undefined;
647
+ readonly _tag: "AdmissionConflict";
648
+ readonly threadId: string;
649
+ readonly principal: string;
650
+ readonly idempotencyKey: string;
651
+ readonly existingInputDigest: string;
652
+ readonly attemptedInputDigest: string;
586
653
  } | {
587
- readonly _tag: "DigestError";
588
- readonly message: string;
589
- readonly cause?: Schema.Json | undefined;
654
+ readonly _tag: "AdmissionPolicyError";
655
+ readonly reason: "occupied" | "refused" | "unavailable";
656
+ readonly code: string;
590
657
  } | {
591
658
  readonly _tag: "SettlementConflict";
592
659
  readonly submissionId: string;
593
660
  readonly existingOutcome: "aborted" | "completed" | "failed";
661
+ } | {
662
+ readonly _tag: "JoinedToHost";
663
+ readonly submissionId: string;
664
+ readonly hostSubmissionId: string;
665
+ } | {
666
+ readonly _tag: "LedgerError";
667
+ readonly operation: string;
668
+ readonly message: string;
669
+ readonly cause?: Schema.Json | undefined;
594
670
  } | {
595
671
  readonly _tag: "ThreadStoreError";
596
672
  readonly operation: string;
@@ -611,31 +687,16 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
611
687
  readonly threadId: string;
612
688
  readonly actualEpoch: number;
613
689
  readonly attemptedEpoch: number;
614
- } | {
615
- readonly _tag: "DurableRuntimeFailpointError";
616
- readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "claim:after-claim" | "compaction:after-canonical-append" | "input:after-canonical-append" | "join:after-canonical-append" | "join:after-claim" | "policy:after-reservation-append" | "policy:before-reservation-append" | "resolve:after-intent" | "run:after-start-append" | "run:before-start-append" | "step:after-step-append" | "subagent:after-admit" | "subagent:after-child-abort-intent" | "subagent:after-child-ready" | "subagent:after-join-append" | "subagent:after-release" | "subagent:after-release-pending" | "subagent:after-request-append" | "subagent:after-reserve" | "subagent:after-sibling-settle" | "subagent:after-start-append" | "subagent:after-suspend" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:after-reserve" | "tools:after-prepared-append" | "tools:before-prepared-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append";
617
- } | {
618
- readonly _tag: "DurableAlarmError";
619
- readonly operation: string;
620
- readonly message: string;
621
- readonly cause?: Schema.Json | undefined;
622
690
  } | {
623
691
  readonly _tag: "HostProtocolError";
624
692
  readonly message: string;
625
- } | {
626
- readonly _tag: "AdmissionConflict";
627
- readonly threadId: string;
628
- readonly principal: string;
629
- readonly idempotencyKey: string;
630
- readonly existingInputDigest: string;
631
- readonly attemptedInputDigest: string;
632
- } | {
633
- readonly _tag: "JoinedToHost";
634
- readonly submissionId: string;
635
- readonly hostSubmissionId: string;
636
693
  } | {
637
694
  readonly _tag: "AgentInputError";
638
695
  readonly message: string;
696
+ } | {
697
+ readonly _tag: "DigestError";
698
+ readonly message: string;
699
+ readonly cause?: Schema.Json | undefined;
639
700
  } | {
640
701
  readonly _tag: "ApprovalConflict";
641
702
  readonly submissionId: string;
@@ -645,16 +706,30 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
645
706
  readonly _tag: "UnknownResolutionConflict";
646
707
  readonly submissionId: string;
647
708
  readonly toolCallId: string;
709
+ } | {
710
+ readonly _tag: "DurableRuntimeFailpointError";
711
+ readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "claim:after-claim" | "compaction:after-canonical-append" | "compaction:before-canonical-append" | "input:after-canonical-append" | "join:after-canonical-append" | "join:after-claim" | "policy:after-reservation-append" | "policy:before-reservation-append" | "resolve:after-intent" | "run:after-start-append" | "run:before-start-append" | "step:after-step-append" | "subagent:after-admit" | "subagent:after-child-abort-intent" | "subagent:after-child-ready" | "subagent:after-join-append" | "subagent:after-release" | "subagent:after-release-pending" | "subagent:after-request-append" | "subagent:after-reserve" | "subagent:after-sibling-settle" | "subagent:after-start-append" | "subagent:after-suspend" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:after-reserve" | "tools:after-prepared-append" | "tools:before-prepared-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append";
648
712
  } | {
649
713
  readonly _tag: "AdmissionLimitExceeded";
650
714
  readonly limit: "database-bytes" | "input-bytes" | "queue-depth";
651
715
  readonly actual: number;
652
716
  readonly maximum: number;
717
+ } | {
718
+ readonly _tag: "DurableAlarmError";
719
+ readonly operation: string;
720
+ readonly message: string;
721
+ readonly cause?: Schema.Json | undefined;
722
+ } | {
723
+ readonly _tag: "OperationDenied";
724
+ readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
725
+ readonly reason: string;
726
+ readonly threadId?: string | undefined;
727
+ readonly submissionId?: string | undefined;
653
728
  };
654
729
  }, Schema.SchemaError, never>;
655
- declare const decodeHostResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SubmitSucceeded | UnknownResolutionRecorded, Schema.SchemaError, never>;
730
+ declare const decodeHostResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SubmissionStatusResponse | SubmitSucceeded | UnknownResolutionRecorded, Schema.SchemaError, never>;
656
731
  /** Failure surface of `CloudflareThreadClient.submit`. */
657
- declare const ClientSubmitHostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof HostProtocolError]>;
732
+ declare const ClientSubmitHostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof AdmissionPolicyError, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof HostProtocolError]>;
658
733
  declare const ClientAwaitHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof OperationDenied, typeof HostProtocolError]>;
659
734
  declare const ClientObserveHostFailure: Schema.Union<readonly [typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof OperationDenied, typeof HostProtocolError]>;
660
735
  declare const ClientAbortHostFailure: Schema.Union<readonly [typeof OperationDenied, typeof LedgerError, typeof SettlementConflict, typeof JoinedToHost, typeof DurableRuntimeFailpointError, typeof DurableAlarmError, typeof HostProtocolError]>;
@@ -671,6 +746,7 @@ declare const CloudflareThreadClient_base: Context.ServiceClass<CloudflareThread
671
746
  /** Encode the input client-side, then durably submit to the owning Object. */
672
747
  readonly submit: <InputSchema extends Schema.Top>(agent: DurableSubmitAgent<InputSchema>, input: InputSchema["Type"], options: DurableSubmitOptions) => Effect.Effect<Receipt, ClientSubmitFailure, InputSchema["EncodingServices"]>;
673
748
  /** Wake-hinted, poll-guaranteed settlement wait executed inside the owning Object. */
749
+ readonly submissionStatus: (receipt: Receipt) => Effect.Effect<SubmissionStatus, ClientAwaitFailure>;
674
750
  readonly awaitSettlement: (receipt: Receipt) => Effect.Effect<Settlement, ClientAwaitFailure>;
675
751
  /**
676
752
  * Wait without polling until progress after `afterSequence` is already durable or hinted.
@@ -711,5 +787,5 @@ declare class CloudflareThreadClient extends CloudflareThreadClient_base {
711
787
  static readonly layer: Layer.Layer<CloudflareThreadClient, never, ThreadObjectNamespace | Crypto.Crypto>;
712
788
  }
713
789
  //#endregion
714
- export { AbortRecorded, ApprovalRecorded, AwaitProgressRequest, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareThreadClient, HostFailed, HostFailure, HostProtocolError, HostResponse, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, SettlementReached, SubmitRequest, SubmitSucceeded, ThreadClientError, UnknownResolutionRecorded, boundHostDiagnostic, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, CloudflareThreadClient_d_exports as t };
790
+ export { AbortRecorded, ApprovalRecorded, AwaitProgressRequest, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareThreadClient, HostFailed, HostFailure, HostProtocolError, HostResponse, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, SettlementReached, SubmissionStatusResponse, SubmitRequest, SubmitSucceeded, ThreadClientError, UnknownResolutionRecorded, boundHostDiagnostic, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, CloudflareThreadClient_d_exports as t };
715
791
  //# sourceMappingURL=CloudflareThreadClient.d.mts.map
@@ -4,7 +4,7 @@ import { AdmissionLimitExceeded } from "./CloudflareConfig.mjs";
4
4
  import { r as safeCauseMessage, t as cloudflareFailureSignals } from "./boundary-BguazVkh.mjs";
5
5
  import { DurableAlarmError } from "./Alarm.mjs";
6
6
  import { Receipt } from "@effect-agent/thread/DurableAgentRuntime";
7
- import { AbortCommand, AbortIntent, AdmissionConflict, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, IdempotencyKey, JoinedToHost, LedgerError, Principal, Settlement, SettlementConflict, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent } from "@effect-agent/thread/SubmissionLedger";
7
+ import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionFence, AdmissionGroup, AdmissionPolicyError, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, IdempotencyKey, JoinedToHost, LedgerError, Principal, Settlement, SettlementConflict, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent } from "@effect-agent/thread/SubmissionLedger";
8
8
  import { Context, Crypto, Duration, Effect, Layer, Schema } from "effect";
9
9
  import { AgentId } from "@effect-agent/core/Identifiers";
10
10
  import { CanonicalRecordEnvelope, CanonicalSequence, DefinitionDigests, PersistedJson } from "@effect-agent/thread/Records";
@@ -14,6 +14,7 @@ import { AgentInputError } from "@effect-agent/core/AgentError";
14
14
  import { DigestError } from "@effect-agent/thread/Digest";
15
15
  import { DurableRuntimeFailpointError } from "@effect-agent/thread/DurableFailpoint";
16
16
  import { OperationDenied } from "@effect-agent/thread/OperationAuthorizer";
17
+ import { SubmissionStatus } from "@effect-agent/thread/SubmissionStatus";
17
18
  import { AppendConflict, FenceRejected, ThreadNotMaterialized, ThreadStoreError } from "@effect-agent/thread/ThreadStore";
18
19
  //#region src/CloudflareThreadClient.ts
19
20
  var CloudflareThreadClient_exports = /* @__PURE__ */ __exportAll({
@@ -31,6 +32,7 @@ var CloudflareThreadClient_exports = /* @__PURE__ */ __exportAll({
31
32
  ProgressCancelled: () => ProgressCancelled,
32
33
  ProgressObserved: () => ProgressObserved,
33
34
  SettlementReached: () => SettlementReached,
35
+ SubmissionStatusResponse: () => SubmissionStatusResponse,
34
36
  SubmitRequest: () => SubmitRequest,
35
37
  SubmitSucceeded: () => SubmitSucceeded,
36
38
  ThreadClientError: () => ThreadClientError,
@@ -93,6 +95,8 @@ var SubmitRequest = class extends Schema.Class("@effect-agent/platform-cloudflar
93
95
  agentId: AgentId,
94
96
  principal: Principal,
95
97
  idempotencyKey: IdempotencyKey,
98
+ admissionGroup: Schema.optionalKey(AdmissionGroup),
99
+ admissionFence: Schema.optionalKey(AdmissionFence),
96
100
  definitions: DefinitionDigests,
97
101
  inputPayload: PersistedJson
98
102
  }) {};
@@ -118,6 +122,7 @@ const HostFailure = Schema.Union([
118
122
  AgentInputError,
119
123
  DigestError,
120
124
  AdmissionConflict,
125
+ AdmissionPolicyError,
121
126
  SettlementConflict,
122
127
  ApprovalConflict,
123
128
  UnknownResolutionConflict,
@@ -134,6 +139,7 @@ const HostFailure = Schema.Union([
134
139
  HostProtocolError
135
140
  ]);
136
141
  var SubmitSucceeded = class extends Schema.TaggedClass("@effect-agent/platform-cloudflare/SubmitSucceeded")("SubmitSucceeded", { receipt: Receipt }) {};
142
+ var SubmissionStatusResponse = class extends Schema.TaggedClass("@effect-agent/platform-cloudflare/SubmissionStatusResponse")("SubmissionStatusResponse", { status: SubmissionStatus }) {};
137
143
  var SettlementReached = class extends Schema.TaggedClass("@effect-agent/platform-cloudflare/SettlementReached")("SettlementReached", { settlement: Settlement }) {};
138
144
  var ObservedPage = class extends Schema.TaggedClass("@effect-agent/platform-cloudflare/ObservedPage")("ObservedPage", { records: Schema.Array(CanonicalRecordEnvelope).check(Schema.isMaxLength(1024)) }) {};
139
145
  /** A record was already committed or an incarnation-local hint says the caller should re-read. */
@@ -148,6 +154,7 @@ var HostFailed = class extends Schema.TaggedClass("@effect-agent/platform-cloudf
148
154
  const HostResponse = Schema.Union([
149
155
  SubmitSucceeded,
150
156
  SettlementReached,
157
+ SubmissionStatusResponse,
151
158
  ObservedPage,
152
159
  ProgressObserved,
153
160
  ProgressCancelled,
@@ -179,6 +186,7 @@ const ClientSubmitHostFailure = Schema.Union([
179
186
  AgentInputError,
180
187
  DigestError,
181
188
  AdmissionConflict,
189
+ AdmissionPolicyError,
182
190
  LedgerError,
183
191
  ThreadStoreError,
184
192
  ThreadNotMaterialized,
@@ -235,6 +243,7 @@ const outOfContract = (threadId, operation, observed) => ThreadClientError.make(
235
243
  const hostRpcMethods = {
236
244
  submit: "submitEncoded",
237
245
  awaitSettlement: "awaitSettlementEncoded",
246
+ submissionStatus: "submissionStatusEncoded",
238
247
  awaitProgress: "awaitProgressEncoded",
239
248
  cancelProgress: "cancelProgressEncoded",
240
249
  observePage: "observePage",
@@ -303,6 +312,8 @@ var CloudflareThreadClient = class CloudflareThreadClient extends Context.Servic
303
312
  agentId: agent.definition.id,
304
313
  principal: options.principal,
305
314
  idempotencyKey: options.idempotencyKey,
315
+ ...options.admissionGroup === void 0 ? {} : { admissionGroup: options.admissionGroup },
316
+ ...options.admissionFence === void 0 ? {} : { admissionFence: options.admissionFence },
306
317
  definitions: options.definitions,
307
318
  inputPayload
308
319
  });
@@ -310,6 +321,11 @@ var CloudflareThreadClient = class CloudflareThreadClient extends Context.Servic
310
321
  const response = yield* call(options.threadId, "submit", encoded);
311
322
  return (yield* expect(options.threadId, "submit", SubmitSucceeded, ClientSubmitHostFailure)(response)).receipt;
312
323
  }),
324
+ submissionStatus: (receipt) => Effect.gen(function* () {
325
+ const encoded = yield* encodeReceipt(receipt).pipe(Effect.mapError(() => HostProtocolError.make({ message: "Invalid receipt" })));
326
+ const response = yield* call(receipt.threadId, "submissionStatus", encoded);
327
+ return (yield* expect(receipt.threadId, "submissionStatus", SubmissionStatusResponse, ClientAwaitHostFailure)(response)).status;
328
+ }),
313
329
  awaitSettlement: (receipt) => Effect.gen(function* () {
314
330
  const encoded = yield* encodeReceipt(receipt).pipe(Effect.mapError((error) => HostProtocolError.make({ message: boundHostDiagnostic(`receipt encode failed: ${error.message}`) })));
315
331
  const response = yield* call(receipt.threadId, "awaitSettlement", encoded);
@@ -359,6 +375,6 @@ var CloudflareThreadClient = class CloudflareThreadClient extends Context.Servic
359
375
  }));
360
376
  };
361
377
  //#endregion
362
- export { AbortRecorded, ApprovalRecorded, AwaitProgressRequest, CancelProgressRequest, CloudflareThreadClient, HostFailed, HostFailure, HostProtocolError, HostResponse, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, SettlementReached, SubmitRequest, SubmitSucceeded, ThreadClientError, UnknownResolutionRecorded, boundHostDiagnostic, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, CloudflareThreadClient_exports as t };
378
+ export { AbortRecorded, ApprovalRecorded, AwaitProgressRequest, CancelProgressRequest, CloudflareThreadClient, HostFailed, HostFailure, HostProtocolError, HostResponse, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, SettlementReached, SubmissionStatusResponse, SubmitRequest, SubmitSucceeded, ThreadClientError, UnknownResolutionRecorded, boundHostDiagnostic, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, CloudflareThreadClient_exports as t };
363
379
 
364
380
  //# sourceMappingURL=CloudflareThreadClient.mjs.map