@yielded/agent-platform-cloudflare 0.1.0-beta.176 → 0.1.0-beta.178

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 (33) hide show
  1. package/dist/{Alarm-7uipp6LW.mjs → Alarm-CZO-Gbts.mjs} +16 -31
  2. package/dist/Alarm-CZO-Gbts.mjs.map +1 -0
  3. package/dist/Alarm.d.mts +3 -19
  4. package/dist/Alarm.mjs +2 -1
  5. package/dist/CloudflareBindings.d.mts +8 -1
  6. package/dist/CloudflareBindings.mjs +8 -1
  7. package/dist/CloudflareBindings.mjs.map +1 -1
  8. package/dist/CloudflareCodeMode.mjs +4 -0
  9. package/dist/CloudflareCodeMode.mjs.map +1 -1
  10. package/dist/CloudflareScheduling.mjs +2 -2
  11. package/dist/CloudflareSubscriptions.mjs +2 -2
  12. package/dist/{CloudflareThreadClient-HO_3rkM7.d.mts → CloudflareThreadClient-Bo0cBJe9.d.mts} +246 -96
  13. package/dist/{CloudflareThreadClient-bA3lGA_2.mjs → CloudflareThreadClient-CEUjVwis.mjs} +69 -62
  14. package/dist/CloudflareThreadClient-CEUjVwis.mjs.map +1 -0
  15. package/dist/CloudflareThreadClient.d.mts +2 -2
  16. package/dist/CloudflareThreadClient.mjs +2 -2
  17. package/dist/{ThreadObject-CxNlhoPL.d.mts → ThreadObject-DQfv28fe.d.mts} +9 -9
  18. package/dist/{ThreadObject-SNcCsrS2.mjs → ThreadObject-v-mwNRZ0.mjs} +5 -5
  19. package/dist/{ThreadObject-SNcCsrS2.mjs.map → ThreadObject-v-mwNRZ0.mjs.map} +1 -1
  20. package/dist/ThreadObject.d.mts +1 -1
  21. package/dist/ThreadObject.mjs +1 -1
  22. package/dist/WakeScheduler.mjs +1 -1
  23. package/dist/index.d.mts +2 -2
  24. package/dist/index.mjs +3 -3
  25. package/dist/{prepared-admission-BvMiFR41.mjs → prepared-admission-C3uBqIz0.mjs} +2 -2
  26. package/dist/{prepared-admission-BvMiFR41.mjs.map → prepared-admission-C3uBqIz0.mjs.map} +1 -1
  27. package/package.json +1 -1
  28. package/src/Alarm.ts +6 -10
  29. package/src/CloudflareBindings.ts +10 -0
  30. package/src/CloudflareCodeMode.ts +4 -0
  31. package/src/CloudflareThreadClient.ts +134 -113
  32. package/dist/Alarm-7uipp6LW.mjs.map +0 -1
  33. package/dist/CloudflareThreadClient-bA3lGA_2.mjs.map +0 -1
@@ -1,7 +1,6 @@
1
- import { ThreadObjectNamespace, ThreadObjectRpc } from "./CloudflareBindings.mjs";
1
+ import { DurableAlarmError, ThreadObjectNamespace, ThreadObjectRpc } from "./CloudflareBindings.mjs";
2
2
  import { t as AdmissionLimitExceeded } from "./CloudflareConfig-C9MvPbX8.mjs";
3
- import { DurableAlarmError } from "./Alarm.mjs";
4
- import { DurableSubmitAgent, DurableSubmitOptions, Receipt } from "@yielded/agent/durable-agent-runtime";
3
+ import { DurableSubmitAgent, DurableSubmitOptions } from "@yielded/agent/durable-agent-runtime";
5
4
  import { ThreadId } from "@yielded/agent/identifiers";
6
5
  import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionPolicyError, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, JoinedToHost, LedgerError, OwnershipLost, Settlement, SettlementConflict, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent } from "@yielded/agent/submission-ledger";
7
6
  import { Context, Crypto, Effect, Layer, Schema, Stream } from "effect";
@@ -10,6 +9,7 @@ import { AgentInputError } from "@yielded/agent/agent-error";
10
9
  import { DigestError } from "@yielded/agent/digest";
11
10
  import { DurableRuntimeFailpointError } from "@yielded/agent/durable-failpoint";
12
11
  import { OperationDenied } from "@yielded/agent/operation-authorizer";
12
+ import { Receipt } from "@yielded/agent/receipt";
13
13
  import { SubmissionStatus } from "@yielded/agent/submission-status";
14
14
  import { AppendConflict, ThreadNotMaterialized, ThreadStoreError } from "@yielded/agent/thread-store";
15
15
  import { Event } from "@yielded/agent/provisional-text";
@@ -66,7 +66,7 @@ declare const Frame: Schema.Union<readonly [Schema.TaggedStruct<"Reset", {
66
66
  }>]>;
67
67
  type Frame = typeof Frame.Type;
68
68
  declare namespace CloudflareThreadClient_d_exports {
69
- export { AbortRecorded, ApprovalRecorded, AwaitProgressRequest, AwaitSettlementRequest, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareThreadClient, HostFailed, HostFailure, HostProtocolError, HostResponse, Frame as LiveTextFrame, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, SettlementReached, SettlementRecordReached, SubmissionStatusResponse, SubmitRequest, SubmitSucceeded, ThreadClientError, UnknownResolutionRecorded, boundHostDiagnostic, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeAwaitSettlementRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeAwaitSettlementRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand };
69
+ export { AbortRecorded, ApprovalRecorded, AwaitProgressRequest, AwaitSettlementRequest, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareThreadClient, HostFailed, HostFailure, HostProtocolError, HostResponse, Frame as LiveTextFrame, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, SettlementReached, SettlementRecordReached, SubmissionStatusResponse, SubmitRequest, SubmitSucceeded, ThreadClientError, UnknownResolutionRecorded, boundHostDiagnostic, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeAwaitSettlementRequest, decodeCancelProgressRequest, decodeHostResponse, decodeLiveText, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeAwaitSettlementRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand };
70
70
  }
71
71
  /** Truncate a diagnostic string to the host protocol's bounded length. */
72
72
  declare const boundHostDiagnostic: (value: string) => string;
@@ -317,7 +317,146 @@ declare class HostFailed extends HostFailed_base {}
317
317
  declare const HostResponse: Schema.Union<readonly [typeof SubmitSucceeded, typeof SettlementReached, typeof SettlementRecordReached, typeof SubmissionStatusResponse, typeof ObservedPage, typeof ProgressObserved, typeof ProgressCancelled, typeof AbortRecorded, typeof ApprovalRecorded, typeof UnknownResolutionRecorded, typeof HostFailed]>;
318
318
  type HostResponse = typeof HostResponse.Type;
319
319
  declare const decodeSubmitRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<SubmitRequest, Schema.SchemaError, never>;
320
- declare const encodeSubmitRequest: (input: SubmitRequest, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
320
+ declare const encodeSubmitRequest: (input: {
321
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
322
+ readonly principal: string & import("effect/Brand").Brand<"@effect-agent/thread/Principal">;
323
+ readonly idempotencyKey: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
324
+ readonly admissionGroup?: string | undefined;
325
+ readonly admissionFence?: {
326
+ readonly policyId: string;
327
+ readonly key: string;
328
+ readonly revision: string;
329
+ } | undefined;
330
+ readonly workerAdmission?: {
331
+ readonly origin: {
332
+ readonly worker: {
333
+ readonly schemaVersion: 1;
334
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
335
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
336
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
337
+ };
338
+ readonly source: {
339
+ readonly _tag: "tool";
340
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
341
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
342
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
343
+ readonly toolCallId: string & import("effect/Brand").Brand<"@effect-agent/core/ToolCallId">;
344
+ } | {
345
+ readonly _tag: "programmatic";
346
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
347
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
348
+ };
349
+ readonly continuationOf?: {
350
+ readonly worker: {
351
+ readonly schemaVersion: 1;
352
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
353
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
354
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
355
+ };
356
+ readonly receipt: Receipt;
357
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
358
+ } | undefined;
359
+ readonly budgetScope: "source-subtree" | "worker-run";
360
+ readonly lifecycle?: "assignment" | undefined;
361
+ readonly targetDigests: DefinitionDigests;
362
+ readonly policy: import("@yielded/agent/agent-policy").AgentPolicy;
363
+ readonly budget: {
364
+ readonly caps: import("@yielded/agent/subagent-contract").SubagentDelegationCaps;
365
+ readonly allocation: import("@yielded/agent/subagent-contract").SubagentReservationAmounts;
366
+ readonly descendantInvocations?: number | undefined;
367
+ };
368
+ readonly grant: import("@yielded/agent/subagent-contract").SubagentGrant;
369
+ readonly depth: number;
370
+ readonly toolCallAllowance?: number | undefined;
371
+ readonly firstMessageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
372
+ readonly createdAtMillis: number;
373
+ readonly expiresAtMillis: number;
374
+ readonly reporting?: {
375
+ readonly mode?: "standard" | undefined;
376
+ readonly sourceDigests: DefinitionDigests;
377
+ readonly destinationDelegationId?: (string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">) | undefined;
378
+ readonly returnAddress?: {
379
+ readonly input: Schema.Json;
380
+ readonly principal: string & import("effect/Brand").Brand<"@effect-agent/thread/Principal">;
381
+ readonly policy: import("@yielded/agent/agent-policy").AgentPolicy;
382
+ readonly depth: number;
383
+ readonly grant?: import("@yielded/agent/subagent-contract").SubagentGrant | undefined;
384
+ readonly workerAdmission?: Schema.Json | undefined;
385
+ } | undefined;
386
+ } | undefined;
387
+ };
388
+ readonly executionRunId: (string & import("effect/Brand").Brand<"@effect-agent/core/RunId">) | null;
389
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
390
+ readonly parameters: Schema.Json;
391
+ readonly createdAtMillis: number;
392
+ readonly sourceSubmissionId?: (string & import("effect/Brand").Brand<"@effect-agent/core/SubmissionId">) | undefined;
393
+ readonly deliveryPrincipal?: (string & import("effect/Brand").Brand<"@effect-agent/thread/Principal">) | undefined;
394
+ readonly reportKind?: "update" | undefined;
395
+ } | undefined;
396
+ readonly messageAdmission?: {
397
+ readonly _tag: "WorkerCompletion";
398
+ readonly budgetExhausted: boolean;
399
+ readonly schemaVersion: 1;
400
+ readonly report: {
401
+ readonly _tag: "Settled";
402
+ readonly worker: {
403
+ readonly schemaVersion: 1;
404
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
405
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
406
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
407
+ };
408
+ readonly receipt: Receipt;
409
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
410
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
411
+ readonly outcome: "completed";
412
+ readonly result: Schema.Json;
413
+ } | {
414
+ readonly _tag: "Settled";
415
+ readonly worker: {
416
+ readonly schemaVersion: 1;
417
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
418
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
419
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
420
+ };
421
+ readonly receipt: Receipt;
422
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
423
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
424
+ readonly outcome: "aborted" | "failed";
425
+ readonly failure: import("@yielded/agent/subagent-contract").SubagentExecutionFailure;
426
+ };
427
+ } | {
428
+ readonly _tag: "WorkerUpdate";
429
+ readonly schemaVersion: 1;
430
+ readonly worker: {
431
+ readonly schemaVersion: 1;
432
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
433
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
434
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
435
+ };
436
+ readonly update: import("@yielded/agent/agent-updates").Update;
437
+ } | {
438
+ readonly schemaVersion: 1;
439
+ readonly message: {
440
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
441
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
442
+ };
443
+ readonly peerName: string;
444
+ readonly sender: {
445
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
446
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
447
+ };
448
+ readonly returnAddress: {
449
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
450
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
451
+ };
452
+ readonly inReplyTo?: {
453
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
454
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
455
+ } | undefined;
456
+ } | undefined;
457
+ readonly definitions: DefinitionDigests;
458
+ readonly inputPayload: Schema.Json;
459
+ }, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
321
460
  readonly agentId: string;
322
461
  readonly principal: string;
323
462
  readonly idempotencyKey: string;
@@ -599,13 +738,13 @@ declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCommand,
599
738
  readonly author: string;
600
739
  readonly reason: string;
601
740
  readonly resolution: {
602
- readonly _tag: "SafeToRetry";
603
- } | {
604
741
  readonly _tag: "CompletedWithResult";
605
742
  readonly result: Schema.Json;
606
743
  readonly isFailure: boolean;
607
744
  } | {
608
745
  readonly _tag: "NeverHappened";
746
+ } | {
747
+ readonly _tag: "SafeToRetry";
609
748
  } | {
610
749
  readonly _tag: "AbortSubmission";
611
750
  };
@@ -855,6 +994,21 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
855
994
  readonly createdAt: string;
856
995
  readonly deploymentId: string;
857
996
  readonly payload: {
997
+ readonly _tag: "ThreadCreated";
998
+ readonly agentId: string;
999
+ readonly definitions: {
1000
+ readonly agent: string;
1001
+ readonly model: string;
1002
+ readonly tools: string;
1003
+ readonly replay?: {
1004
+ readonly agent: string;
1005
+ readonly agentBehavior?: string | undefined;
1006
+ readonly tools: {
1007
+ readonly [x: string]: string;
1008
+ };
1009
+ } | undefined;
1010
+ };
1011
+ } | {
858
1012
  readonly _tag: "UserInputRecorded";
859
1013
  readonly submissionId?: string | undefined;
860
1014
  readonly kind: "follow-up" | "steering" | "user";
@@ -949,6 +1103,25 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
949
1103
  readonly value: Schema.Json;
950
1104
  };
951
1105
  } | undefined;
1106
+ } | {
1107
+ readonly _tag: "RunStarted";
1108
+ readonly runId: string;
1109
+ readonly policyAccountingVersion: 1;
1110
+ readonly maxDurationMillis: number;
1111
+ } | {
1112
+ readonly _tag: "RunDurationExhausted";
1113
+ readonly runId: string;
1114
+ } | {
1115
+ readonly _tag: "RunPolicyUsageReserved";
1116
+ readonly runId: string;
1117
+ readonly programmaticToolCalls: number;
1118
+ readonly finalizationUsed: boolean;
1119
+ } | {
1120
+ readonly _tag: "ModelCompleted";
1121
+ readonly runId: string;
1122
+ readonly output: Schema.Json;
1123
+ readonly messages?: Schema.Json | undefined;
1124
+ readonly history?: Schema.Json | undefined;
952
1125
  } | {
953
1126
  readonly _tag: "ModelResponseRecorded";
954
1127
  readonly toolResultMaxBytes: number;
@@ -1015,48 +1188,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1015
1188
  readonly inputTokens?: number | undefined;
1016
1189
  readonly outputTokens?: number | undefined;
1017
1190
  readonly costMicrousd?: number | undefined;
1018
- } | {
1019
- readonly _tag: "CompactionCreated";
1020
- readonly runId: string;
1021
- readonly turn: number;
1022
- readonly kind: "clear-tool-results" | "rollover" | "summarize";
1023
- readonly coversThrough: number;
1024
- readonly summary?: string | undefined;
1025
- readonly handoff?: string | undefined;
1026
- } | {
1027
- readonly _tag: "ThreadCreated";
1028
- readonly agentId: string;
1029
- readonly definitions: {
1030
- readonly agent: string;
1031
- readonly model: string;
1032
- readonly tools: string;
1033
- readonly replay?: {
1034
- readonly agent: string;
1035
- readonly agentBehavior?: string | undefined;
1036
- readonly tools: {
1037
- readonly [x: string]: string;
1038
- };
1039
- } | undefined;
1040
- };
1041
- } | {
1042
- readonly _tag: "RunStarted";
1043
- readonly runId: string;
1044
- readonly policyAccountingVersion: 1;
1045
- readonly maxDurationMillis: number;
1046
- } | {
1047
- readonly _tag: "RunDurationExhausted";
1048
- readonly runId: string;
1049
- } | {
1050
- readonly _tag: "RunPolicyUsageReserved";
1051
- readonly runId: string;
1052
- readonly programmaticToolCalls: number;
1053
- readonly finalizationUsed: boolean;
1054
- } | {
1055
- readonly _tag: "ModelCompleted";
1056
- readonly runId: string;
1057
- readonly output: Schema.Json;
1058
- readonly messages?: Schema.Json | undefined;
1059
- readonly history?: Schema.Json | undefined;
1060
1191
  } | {
1061
1192
  readonly _tag: "ToolCallSettled";
1062
1193
  readonly toolSelection?: {
@@ -1143,6 +1274,14 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1143
1274
  readonly costMicrousd: number;
1144
1275
  }[];
1145
1276
  readonly unobservedModelCalls: number;
1277
+ } | {
1278
+ readonly _tag: "CompactionCreated";
1279
+ readonly runId: string;
1280
+ readonly turn: number;
1281
+ readonly kind: "clear-tool-results" | "rollover" | "summarize";
1282
+ readonly coversThrough: number;
1283
+ readonly summary?: string | undefined;
1284
+ readonly handoff?: string | undefined;
1146
1285
  } | {
1147
1286
  readonly _tag: "RunFailed";
1148
1287
  readonly runId: string;
@@ -1866,13 +2005,13 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1866
2005
  readonly author: string;
1867
2006
  readonly reason: string;
1868
2007
  readonly resolution: {
1869
- readonly _tag: "SafeToRetry";
1870
- } | {
1871
2008
  readonly _tag: "CompletedWithResult";
1872
2009
  readonly result: Schema.Json;
1873
2010
  readonly isFailure: boolean;
1874
2011
  } | {
1875
2012
  readonly _tag: "NeverHappened";
2013
+ } | {
2014
+ readonly _tag: "SafeToRetry";
1876
2015
  } | {
1877
2016
  readonly _tag: "AbortSubmission";
1878
2017
  };
@@ -1882,6 +2021,33 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1882
2021
  } | {
1883
2022
  readonly _tag: "HostFailed";
1884
2023
  readonly failure: {
2024
+ readonly _tag: "OwnershipLost";
2025
+ readonly submissionId: string;
2026
+ } | {
2027
+ readonly _tag: "DurableRuntimeFailpointError";
2028
+ 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-duration-append" | "run:after-start-append" | "run:before-duration-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" | "subagent:before-join-append" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:before-publication" | "tools:after-dispatch-fence" | "tools:after-unavailable-append" | "tools:before-dispatch-fence" | "tools:before-unavailable-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append" | "update:after-canonical-append" | "update:after-delivery-insert" | "update:before-canonical-append" | "update:before-delivery-insert" | "worker:after-completion-append" | "worker:after-origin-append" | "worker:after-report-append" | "worker:after-report-delivery" | "worker:after-source-append" | "worker:after-stop-append" | "worker:after-stop-seal" | "worker:after-subtree-append" | "worker:before-completion-append" | "worker:before-origin-append" | "worker:before-report-append" | "worker:before-report-delivery" | "worker:before-source-append" | "worker:before-stop-append" | "worker:before-stop-seal" | "worker:before-subtree-append";
2029
+ } | {
2030
+ readonly _tag: "AdmissionConflict";
2031
+ readonly threadId: string;
2032
+ readonly principal: string;
2033
+ readonly idempotencyKey: string;
2034
+ readonly existingInputDigest: string;
2035
+ readonly attemptedInputDigest: string;
2036
+ } | {
2037
+ readonly _tag: "AdmissionPolicyError";
2038
+ readonly reason: "occupied" | "refused" | "unavailable";
2039
+ readonly code: string;
2040
+ readonly cause?: import("@yielded/agent/failure-diagnostic").Diagnostic | undefined;
2041
+ readonly stack?: string | undefined;
2042
+ } | {
2043
+ readonly _tag: "SettlementConflict";
2044
+ readonly submissionId: string;
2045
+ readonly existingOutcome: "aborted" | "completed" | "failed";
2046
+ } | {
2047
+ readonly _tag: "JoinedToHost";
2048
+ readonly submissionId: string;
2049
+ readonly hostSubmissionId: string;
2050
+ } | {
1885
2051
  readonly _tag: "LedgerError";
1886
2052
  readonly operation: string;
1887
2053
  readonly message: string;
@@ -1908,41 +2074,24 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1908
2074
  readonly reason: "batch-content" | "record-identity" | "stale-command" | "tail";
1909
2075
  readonly actualTailSequence?: number | undefined;
1910
2076
  } | {
1911
- readonly _tag: "OwnershipLost";
1912
- readonly submissionId: string;
1913
- } | {
1914
- readonly _tag: "OperationDenied";
1915
- readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
1916
- readonly reason: string;
1917
- readonly threadId?: string | undefined;
1918
- readonly submissionId?: string | undefined;
1919
- } | {
1920
- readonly _tag: "SettlementConflict";
1921
- readonly submissionId: string;
1922
- readonly existingOutcome: "aborted" | "completed" | "failed";
2077
+ readonly _tag: "HostProtocolError";
2078
+ readonly message: string;
1923
2079
  } | {
1924
- readonly _tag: "AdmissionPolicyError";
1925
- readonly reason: "occupied" | "refused" | "unavailable";
1926
- readonly code: string;
1927
- readonly cause?: import("@yielded/agent/failure-diagnostic").Diagnostic | undefined;
1928
- readonly stack?: string | undefined;
2080
+ readonly _tag: "AgentInputError";
2081
+ readonly message: string;
1929
2082
  } | {
1930
2083
  readonly _tag: "DigestError";
1931
2084
  readonly message: string;
1932
2085
  readonly cause?: Schema.Json | undefined;
1933
2086
  } | {
1934
- readonly _tag: "DurableRuntimeFailpointError";
1935
- 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-duration-append" | "run:after-start-append" | "run:before-duration-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" | "subagent:before-join-append" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:before-publication" | "tools:after-dispatch-fence" | "tools:after-unavailable-append" | "tools:before-dispatch-fence" | "tools:before-unavailable-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append" | "update:after-canonical-append" | "update:after-delivery-insert" | "update:before-canonical-append" | "update:before-delivery-insert" | "worker:after-completion-append" | "worker:after-origin-append" | "worker:after-report-append" | "worker:after-report-delivery" | "worker:after-source-append" | "worker:after-stop-append" | "worker:after-stop-seal" | "worker:after-subtree-append" | "worker:before-completion-append" | "worker:before-origin-append" | "worker:before-report-append" | "worker:before-report-delivery" | "worker:before-source-append" | "worker:before-stop-append" | "worker:before-stop-seal" | "worker:before-subtree-append";
1936
- } | {
1937
- readonly _tag: "AdmissionConflict";
1938
- readonly threadId: string;
1939
- readonly principal: string;
1940
- readonly idempotencyKey: string;
1941
- readonly existingInputDigest: string;
1942
- readonly attemptedInputDigest: string;
2087
+ readonly _tag: "ApprovalConflict";
2088
+ readonly submissionId: string;
2089
+ readonly toolCallId: string;
2090
+ readonly existingDecision: "approved" | "denied";
1943
2091
  } | {
1944
- readonly _tag: "AgentInputError";
1945
- readonly message: string;
2092
+ readonly _tag: "UnknownResolutionConflict";
2093
+ readonly submissionId: string;
2094
+ readonly toolCallId: string;
1946
2095
  } | {
1947
2096
  readonly _tag: "AdmissionLimitExceeded";
1948
2097
  readonly limit: "database-bytes" | "input-bytes" | "queue-depth";
@@ -1954,21 +2103,11 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1954
2103
  readonly message: string;
1955
2104
  readonly cause?: Schema.Json | undefined;
1956
2105
  } | {
1957
- readonly _tag: "HostProtocolError";
1958
- readonly message: string;
1959
- } | {
1960
- readonly _tag: "JoinedToHost";
1961
- readonly submissionId: string;
1962
- readonly hostSubmissionId: string;
1963
- } | {
1964
- readonly _tag: "ApprovalConflict";
1965
- readonly submissionId: string;
1966
- readonly toolCallId: string;
1967
- readonly existingDecision: "approved" | "denied";
1968
- } | {
1969
- readonly _tag: "UnknownResolutionConflict";
1970
- readonly submissionId: string;
1971
- readonly toolCallId: string;
2106
+ readonly _tag: "OperationDenied";
2107
+ readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
2108
+ readonly reason: string;
2109
+ readonly threadId?: string | undefined;
2110
+ readonly submissionId?: string | undefined;
1972
2111
  };
1973
2112
  }, Schema.SchemaError, never>;
1974
2113
  declare const decodeHostResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SettlementRecordReached | SubmissionStatusResponse | SubmitSucceeded | UnknownResolutionRecorded, Schema.SchemaError, never>;
@@ -1986,6 +2125,11 @@ type ClientProgressFailure = ClientObserveFailure;
1986
2125
  type ClientAbortFailure = typeof ClientAbortHostFailure.Type | ThreadClientError;
1987
2126
  type ClientApprovalFailure = typeof ClientApprovalHostFailure.Type | ThreadClientError;
1988
2127
  type ClientUnknownFailure = typeof ClientUnknownHostFailure.Type | ThreadClientError;
2128
+ /**
2129
+ * Validate untrusted NDJSON at the final consumer, including frame bounds, thread,
2130
+ * sequence and text lifecycle. Stream loss invalidates all provisional drafts.
2131
+ */
2132
+ declare const decodeLiveText: <E, R>(threadId: ThreadId, source: Stream.Stream<Uint8Array, E, R>) => Stream.Stream<Frame, E | HostProtocolError, R>;
1989
2133
  declare const CloudflareThreadClient_base: Context.ServiceClass<CloudflareThreadClient, "@effect-agent/platform-cloudflare/CloudflareThreadClient", {
1990
2134
  /** Encode the input client-side, then durably submit to the owning Object. */
1991
2135
  readonly submit: <InputSchema extends Schema.Top>(agent: DurableSubmitAgent<InputSchema>, input: InputSchema["Type"], options: DurableSubmitOptions) => Effect.Effect<Receipt, ClientSubmitFailure, InputSchema["EncodingServices"]>;
@@ -2017,6 +2161,12 @@ declare const CloudflareThreadClient_base: Context.ServiceClass<CloudflareThread
2017
2161
  * Scope the stream: interruption cancels its remote subscription.
2018
2162
  */
2019
2163
  readonly watchText: (threadId: ThreadId) => Stream.Stream<Frame, ClientObserveFailure>;
2164
+ /**
2165
+ * Forward producer NDJSON bytes without decoding or re-encoding frames.
2166
+ * The final consumer must use `decodeLiveText` to validate untrusted frames.
2167
+ * Interruption cancels the remote subscription; buffers remain producer-bounded.
2168
+ */
2169
+ readonly watchTextBytes: (threadId: ThreadId) => Stream.Stream<Uint8Array, ClientObserveFailure>;
2020
2170
  /** One bounded page of canonical records. */
2021
2171
  readonly readPage: (threadId: ThreadId, options?: {
2022
2172
  readonly afterSequence?: CanonicalSequence | undefined;
@@ -2051,5 +2201,5 @@ declare class CloudflareThreadClient extends CloudflareThreadClient_base {
2051
2201
  static readonly layer: Layer.Layer<CloudflareThreadClient, never, ThreadObjectNamespace | Crypto.Crypto>;
2052
2202
  }
2053
2203
  //#endregion
2054
- export { boundHostDiagnostic as A, decodeUnknownResolutionCommand as B, SettlementReached as C, SubmitSucceeded as D, SubmitRequest as E, decodeCancelProgressRequest as F, encodeCancelProgressRequest as G, encodeApprovalDecisionCommand as H, decodeHostResponse as I, encodeReceipt as J, encodeHostResponse as K, decodeObservePageRequest as L, decodeApprovalDecisionCommand as M, decodeAwaitProgressRequest as N, ThreadClientError as O, decodeAwaitSettlementRequest as P, decodeReceipt as R, ProgressObserved as S, SubmissionStatusResponse as T, encodeAwaitProgressRequest as U, encodeAbortCommand as V, encodeAwaitSettlementRequest as W, encodeUnknownResolutionCommand as X, encodeSubmitRequest as Y, Frame as Z, HostProtocolError as _, CancelProgressRequest as a, ObservedPage as b, ClientAwaitFailure as c, ClientSubmitFailure as d, ClientUnknownFailure as f, HostFailure as g, HostFailed as h, AwaitSettlementRequest as i, decodeAbortCommand as j, UnknownResolutionRecorded as k, ClientObserveFailure as l, CloudflareThreadClient_d_exports as m, ApprovalRecorded as n, ClientAbortFailure as o, CloudflareThreadClient as p, encodeObservePageRequest as q, AwaitProgressRequest as r, ClientApprovalFailure as s, AbortRecorded as t, ClientProgressFailure as u, HostResponse as v, SettlementRecordReached as w, ProgressCancelled as x, ObservePageRequest as y, decodeSubmitRequest as z };
2055
- //# sourceMappingURL=CloudflareThreadClient-HO_3rkM7.d.mts.map
2204
+ export { boundHostDiagnostic as A, decodeSubmitRequest as B, SettlementReached as C, SubmitSucceeded as D, SubmitRequest as E, decodeCancelProgressRequest as F, encodeAwaitSettlementRequest as G, encodeAbortCommand as H, decodeHostResponse as I, encodeObservePageRequest as J, encodeCancelProgressRequest as K, decodeLiveText as L, decodeApprovalDecisionCommand as M, decodeAwaitProgressRequest as N, ThreadClientError as O, decodeAwaitSettlementRequest as P, Frame as Q, decodeObservePageRequest as R, ProgressObserved as S, SubmissionStatusResponse as T, encodeApprovalDecisionCommand as U, decodeUnknownResolutionCommand as V, encodeAwaitProgressRequest as W, encodeSubmitRequest as X, encodeReceipt as Y, encodeUnknownResolutionCommand as Z, HostProtocolError as _, CancelProgressRequest as a, ObservedPage as b, ClientAwaitFailure as c, ClientSubmitFailure as d, ClientUnknownFailure as f, HostFailure as g, HostFailed as h, AwaitSettlementRequest as i, decodeAbortCommand as j, UnknownResolutionRecorded as k, ClientObserveFailure as l, CloudflareThreadClient_d_exports as m, ApprovalRecorded as n, ClientAbortFailure as o, CloudflareThreadClient as p, encodeHostResponse as q, AwaitProgressRequest as r, ClientApprovalFailure as s, AbortRecorded as t, ClientProgressFailure as u, HostResponse as v, SettlementRecordReached as w, ProgressCancelled as x, ObservePageRequest as y, decodeReceipt as z };
2205
+ //# sourceMappingURL=CloudflareThreadClient-Bo0cBJe9.d.mts.map