@effect-agent/platform-cloudflare 0.1.0-beta.55 → 0.1.0-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Alarm.d.mts +10 -2
- package/dist/Alarm.mjs +22 -5
- package/dist/Alarm.mjs.map +1 -1
- package/dist/CloudflareScheduling.mjs +1 -1
- package/dist/CloudflareSubscriptions.mjs +1 -1
- package/dist/CloudflareThreadClient.d.mts +429 -11
- package/dist/CloudflareThreadClient.mjs +6 -1
- package/dist/CloudflareThreadClient.mjs.map +1 -1
- package/dist/{ThreadObject-wDwMUV8v.d.mts → ThreadObject-Avjx5Gmk.d.mts} +40 -37
- package/dist/{ThreadObject-Cm6tuhon.mjs → ThreadObject-J5thaFpm.mjs} +66 -6
- package/dist/ThreadObject-J5thaFpm.mjs.map +1 -0
- package/dist/ThreadObject.d.mts +1 -1
- package/dist/ThreadObject.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{prepared-admission-9rvlHI0y.mjs → prepared-admission-G7N4DDqS.mjs} +3 -1
- package/dist/prepared-admission-G7N4DDqS.mjs.map +1 -0
- package/package.json +1 -1
- package/src/Alarm.ts +41 -3
- package/src/CloudflareThreadClient.ts +10 -0
- package/src/ThreadObject.ts +6 -0
- package/src/internal/layers.ts +34 -2
- package/src/internal/message-delivery.ts +90 -0
- package/src/internal/prepared-admission.ts +6 -0
- package/dist/ThreadObject-Cm6tuhon.mjs.map +0 -1
- package/dist/prepared-admission-9rvlHI0y.mjs.map +0 -1
|
@@ -46,6 +46,69 @@ declare const SubmitRequest_base: Schema.Class<SubmitRequest, Schema.Struct<{
|
|
|
46
46
|
readonly key: Schema.NonEmptyString;
|
|
47
47
|
readonly revision: Schema.NonEmptyString;
|
|
48
48
|
}>>;
|
|
49
|
+
readonly workerAdmission: Schema.optionalKey<Schema.Struct<{
|
|
50
|
+
readonly origin: Schema.Struct<{
|
|
51
|
+
readonly worker: Schema.Struct<{
|
|
52
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
53
|
+
readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
|
|
54
|
+
readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
55
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
56
|
+
}>;
|
|
57
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
58
|
+
readonly _tag: Schema.Literal<"tool">;
|
|
59
|
+
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
60
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
61
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
62
|
+
readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
|
|
63
|
+
}>, Schema.Struct<{
|
|
64
|
+
readonly _tag: Schema.Literal<"programmatic">;
|
|
65
|
+
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
66
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
67
|
+
}>]>;
|
|
68
|
+
readonly targetDigests: typeof DefinitionDigests;
|
|
69
|
+
readonly policy: Schema.toCodecJson<typeof import("@effect-agent/core/AgentPolicy").AgentPolicy>;
|
|
70
|
+
readonly budget: Schema.Struct<{
|
|
71
|
+
readonly caps: typeof import("@effect-agent/core/SubagentContract").SubagentDelegationCaps;
|
|
72
|
+
readonly allocation: typeof import("@effect-agent/core/SubagentContract").SubagentReservationAmounts;
|
|
73
|
+
readonly descendantInvocations: Schema.optionalKey<Schema.Natural>;
|
|
74
|
+
}>;
|
|
75
|
+
readonly grant: typeof import("@effect-agent/core/SubagentContract").SubagentGrant;
|
|
76
|
+
readonly depth: Schema.Int;
|
|
77
|
+
readonly toolCallAllowance: Schema.optionalKey<Schema.Int>;
|
|
78
|
+
readonly firstMessageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
79
|
+
readonly createdAtMillis: Schema.Natural;
|
|
80
|
+
readonly expiresAtMillis: Schema.Natural;
|
|
81
|
+
readonly reporting: Schema.optionalKey<Schema.Struct<{
|
|
82
|
+
readonly sourceDigests: typeof DefinitionDigests;
|
|
83
|
+
readonly destinationDelegationId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">>;
|
|
84
|
+
}>>;
|
|
85
|
+
}>;
|
|
86
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
87
|
+
readonly parameters: Schema.declare<Schema.Json, Schema.Json>;
|
|
88
|
+
readonly createdAtMillis: Schema.Natural;
|
|
89
|
+
readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
|
|
90
|
+
readonly deliveryPrincipal: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">>;
|
|
91
|
+
}>>;
|
|
92
|
+
readonly messageAdmission: Schema.optionalKey<Schema.Struct<{
|
|
93
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
94
|
+
readonly message: Schema.Struct<{
|
|
95
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
96
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
97
|
+
}>;
|
|
98
|
+
readonly peerName: Schema.NonEmptyString;
|
|
99
|
+
readonly sender: Schema.Struct<{
|
|
100
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
101
|
+
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
102
|
+
}>;
|
|
103
|
+
readonly returnAddress: Schema.Struct<{
|
|
104
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
105
|
+
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
106
|
+
}>;
|
|
107
|
+
readonly inReplyTo: Schema.optionalKey<Schema.Struct<{
|
|
108
|
+
readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
109
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
110
|
+
}>>;
|
|
111
|
+
}>>;
|
|
49
112
|
readonly definitions: typeof DefinitionDigests;
|
|
50
113
|
readonly inputPayload: Schema.declare<Schema.Json, Schema.Json>;
|
|
51
114
|
}>, {}>;
|
|
@@ -133,6 +196,99 @@ declare const encodeSubmitRequest: (input: SubmitRequest, options?: import("effe
|
|
|
133
196
|
readonly key: string;
|
|
134
197
|
readonly revision: string;
|
|
135
198
|
} | undefined;
|
|
199
|
+
readonly workerAdmission?: {
|
|
200
|
+
readonly origin: {
|
|
201
|
+
readonly worker: {
|
|
202
|
+
readonly schemaVersion: 1;
|
|
203
|
+
readonly delegationId: string;
|
|
204
|
+
readonly targetAgentId: string;
|
|
205
|
+
readonly threadId: string;
|
|
206
|
+
};
|
|
207
|
+
readonly source: {
|
|
208
|
+
readonly _tag: "tool";
|
|
209
|
+
readonly agentId: string;
|
|
210
|
+
readonly threadId: string;
|
|
211
|
+
readonly runId: string;
|
|
212
|
+
readonly toolCallId: string;
|
|
213
|
+
} | {
|
|
214
|
+
readonly _tag: "programmatic";
|
|
215
|
+
readonly agentId: string;
|
|
216
|
+
readonly threadId: string;
|
|
217
|
+
};
|
|
218
|
+
readonly targetDigests: {
|
|
219
|
+
readonly agent: string;
|
|
220
|
+
readonly model: string;
|
|
221
|
+
readonly tools: string;
|
|
222
|
+
};
|
|
223
|
+
readonly policy: Schema.Json;
|
|
224
|
+
readonly budget: {
|
|
225
|
+
readonly caps: {
|
|
226
|
+
readonly maxTotalChildInvocations?: number | undefined;
|
|
227
|
+
readonly maxConcurrentChildren?: number | undefined;
|
|
228
|
+
readonly maxTurns?: number | undefined;
|
|
229
|
+
readonly maxToolCalls?: number | undefined;
|
|
230
|
+
readonly maxDurationMillis?: number | undefined;
|
|
231
|
+
readonly maxInputTokens?: number | undefined;
|
|
232
|
+
readonly maxOutputTokens?: number | undefined;
|
|
233
|
+
readonly maxCostMicrousd?: number | undefined;
|
|
234
|
+
readonly maxResultBytes?: number | undefined;
|
|
235
|
+
};
|
|
236
|
+
readonly allocation: {
|
|
237
|
+
readonly turns: number;
|
|
238
|
+
readonly toolCalls: number;
|
|
239
|
+
readonly durationMillis: number;
|
|
240
|
+
readonly inputTokens: number;
|
|
241
|
+
readonly outputTokens: number;
|
|
242
|
+
readonly costMicrousd: number;
|
|
243
|
+
readonly resultBytes: number;
|
|
244
|
+
};
|
|
245
|
+
readonly descendantInvocations?: number | undefined;
|
|
246
|
+
};
|
|
247
|
+
readonly grant: {
|
|
248
|
+
readonly allowedToolNames: readonly string[];
|
|
249
|
+
readonly maxDepth: number;
|
|
250
|
+
readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
|
|
251
|
+
};
|
|
252
|
+
readonly depth: number;
|
|
253
|
+
readonly toolCallAllowance?: number | undefined;
|
|
254
|
+
readonly firstMessageId: string;
|
|
255
|
+
readonly createdAtMillis: number;
|
|
256
|
+
readonly expiresAtMillis: number;
|
|
257
|
+
readonly reporting?: {
|
|
258
|
+
readonly sourceDigests: {
|
|
259
|
+
readonly agent: string;
|
|
260
|
+
readonly model: string;
|
|
261
|
+
readonly tools: string;
|
|
262
|
+
};
|
|
263
|
+
readonly destinationDelegationId?: string | undefined;
|
|
264
|
+
} | undefined;
|
|
265
|
+
};
|
|
266
|
+
readonly messageId: string;
|
|
267
|
+
readonly parameters: Schema.Json;
|
|
268
|
+
readonly createdAtMillis: number;
|
|
269
|
+
readonly sourceSubmissionId?: string | undefined;
|
|
270
|
+
readonly deliveryPrincipal?: string | undefined;
|
|
271
|
+
} | undefined;
|
|
272
|
+
readonly messageAdmission?: {
|
|
273
|
+
readonly schemaVersion: 1;
|
|
274
|
+
readonly message: {
|
|
275
|
+
readonly ownerThreadId: string;
|
|
276
|
+
readonly messageId: string;
|
|
277
|
+
};
|
|
278
|
+
readonly peerName: string;
|
|
279
|
+
readonly sender: {
|
|
280
|
+
readonly threadId: string;
|
|
281
|
+
readonly agentId: string;
|
|
282
|
+
};
|
|
283
|
+
readonly returnAddress: {
|
|
284
|
+
readonly threadId: string;
|
|
285
|
+
readonly agentId: string;
|
|
286
|
+
};
|
|
287
|
+
readonly inReplyTo?: {
|
|
288
|
+
readonly ownerThreadId: string;
|
|
289
|
+
readonly messageId: string;
|
|
290
|
+
} | undefined;
|
|
291
|
+
} | undefined;
|
|
136
292
|
readonly definitions: {
|
|
137
293
|
readonly agent: string;
|
|
138
294
|
readonly model: string;
|
|
@@ -182,13 +338,13 @@ declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCommand,
|
|
|
182
338
|
readonly author: string;
|
|
183
339
|
readonly reason: string;
|
|
184
340
|
readonly resolution: {
|
|
341
|
+
readonly _tag: "SafeToRetry";
|
|
342
|
+
} | {
|
|
185
343
|
readonly _tag: "CompletedWithResult";
|
|
186
344
|
readonly result: Schema.Json;
|
|
187
345
|
readonly isFailure: boolean;
|
|
188
346
|
} | {
|
|
189
347
|
readonly _tag: "NeverHappened";
|
|
190
|
-
} | {
|
|
191
|
-
readonly _tag: "SafeToRetry";
|
|
192
348
|
} | {
|
|
193
349
|
readonly _tag: "AbortSubmission";
|
|
194
350
|
};
|
|
@@ -316,6 +472,11 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
316
472
|
readonly createdAt: string;
|
|
317
473
|
readonly deploymentId: string;
|
|
318
474
|
readonly payload: {
|
|
475
|
+
readonly _tag: "AbortRequested";
|
|
476
|
+
readonly submissionId: string;
|
|
477
|
+
readonly author: string;
|
|
478
|
+
readonly reason: string;
|
|
479
|
+
} | {
|
|
319
480
|
readonly _tag: "ThreadCreated";
|
|
320
481
|
readonly agentId: string;
|
|
321
482
|
readonly definitions: {
|
|
@@ -329,6 +490,26 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
329
490
|
readonly kind: "follow-up" | "steering" | "user";
|
|
330
491
|
readonly runId?: string | undefined;
|
|
331
492
|
readonly input: Schema.Json;
|
|
493
|
+
readonly messageAdmission?: {
|
|
494
|
+
readonly schemaVersion: 1;
|
|
495
|
+
readonly message: {
|
|
496
|
+
readonly ownerThreadId: string;
|
|
497
|
+
readonly messageId: string;
|
|
498
|
+
};
|
|
499
|
+
readonly peerName: string;
|
|
500
|
+
readonly sender: {
|
|
501
|
+
readonly threadId: string;
|
|
502
|
+
readonly agentId: string;
|
|
503
|
+
};
|
|
504
|
+
readonly returnAddress: {
|
|
505
|
+
readonly threadId: string;
|
|
506
|
+
readonly agentId: string;
|
|
507
|
+
};
|
|
508
|
+
readonly inReplyTo?: {
|
|
509
|
+
readonly ownerThreadId: string;
|
|
510
|
+
readonly messageId: string;
|
|
511
|
+
} | undefined;
|
|
512
|
+
} | undefined;
|
|
332
513
|
} | {
|
|
333
514
|
readonly _tag: "RunStarted";
|
|
334
515
|
readonly runId: string;
|
|
@@ -382,7 +563,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
382
563
|
readonly toolName: string;
|
|
383
564
|
readonly parameters: Schema.Json;
|
|
384
565
|
readonly parametersDigest: string;
|
|
385
|
-
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
566
|
+
readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
|
|
386
567
|
} | {
|
|
387
568
|
readonly _tag: "ToolCallSettled";
|
|
388
569
|
readonly runId: string;
|
|
@@ -453,11 +634,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
453
634
|
readonly runDisposition?: Schema.Json | undefined;
|
|
454
635
|
readonly finishReason?: "budget-exhausted" | undefined;
|
|
455
636
|
readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
|
|
456
|
-
} | {
|
|
457
|
-
readonly _tag: "AbortRequested";
|
|
458
|
-
readonly submissionId: string;
|
|
459
|
-
readonly author: string;
|
|
460
|
-
readonly reason: string;
|
|
461
637
|
} | {
|
|
462
638
|
readonly _tag: "SubmissionSettled";
|
|
463
639
|
readonly submissionId: string;
|
|
@@ -548,7 +724,14 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
548
724
|
readonly costMicrousd: number;
|
|
549
725
|
readonly resultBytes: number;
|
|
550
726
|
};
|
|
727
|
+
readonly descendantInvocations?: number | undefined;
|
|
728
|
+
} | undefined;
|
|
729
|
+
readonly grant?: {
|
|
730
|
+
readonly allowedToolNames: readonly string[];
|
|
731
|
+
readonly maxDepth: number;
|
|
732
|
+
readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
|
|
551
733
|
} | undefined;
|
|
734
|
+
readonly depth?: number | undefined;
|
|
552
735
|
} | {
|
|
553
736
|
readonly _tag: "SubagentStarted";
|
|
554
737
|
readonly runId: string;
|
|
@@ -589,6 +772,241 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
589
772
|
readonly grantDigest: string;
|
|
590
773
|
readonly toolCallAllowance?: number | undefined;
|
|
591
774
|
readonly policy?: Schema.Json | undefined;
|
|
775
|
+
readonly budget?: {
|
|
776
|
+
readonly caps: {
|
|
777
|
+
readonly maxTotalChildInvocations?: number | undefined;
|
|
778
|
+
readonly maxConcurrentChildren?: number | undefined;
|
|
779
|
+
readonly maxTurns?: number | undefined;
|
|
780
|
+
readonly maxToolCalls?: number | undefined;
|
|
781
|
+
readonly maxDurationMillis?: number | undefined;
|
|
782
|
+
readonly maxInputTokens?: number | undefined;
|
|
783
|
+
readonly maxOutputTokens?: number | undefined;
|
|
784
|
+
readonly maxCostMicrousd?: number | undefined;
|
|
785
|
+
readonly maxResultBytes?: number | undefined;
|
|
786
|
+
};
|
|
787
|
+
readonly allocation: {
|
|
788
|
+
readonly turns: number;
|
|
789
|
+
readonly toolCalls: number;
|
|
790
|
+
readonly durationMillis: number;
|
|
791
|
+
readonly inputTokens: number;
|
|
792
|
+
readonly outputTokens: number;
|
|
793
|
+
readonly costMicrousd: number;
|
|
794
|
+
readonly resultBytes: number;
|
|
795
|
+
};
|
|
796
|
+
readonly descendantInvocations?: number | undefined;
|
|
797
|
+
} | undefined;
|
|
798
|
+
readonly grant?: {
|
|
799
|
+
readonly allowedToolNames: readonly string[];
|
|
800
|
+
readonly maxDepth: number;
|
|
801
|
+
readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
|
|
802
|
+
} | undefined;
|
|
803
|
+
} | {
|
|
804
|
+
readonly _tag: "WorkerInputRequested";
|
|
805
|
+
readonly admission: {
|
|
806
|
+
readonly origin: {
|
|
807
|
+
readonly worker: {
|
|
808
|
+
readonly schemaVersion: 1;
|
|
809
|
+
readonly delegationId: string;
|
|
810
|
+
readonly targetAgentId: string;
|
|
811
|
+
readonly threadId: string;
|
|
812
|
+
};
|
|
813
|
+
readonly source: {
|
|
814
|
+
readonly _tag: "tool";
|
|
815
|
+
readonly agentId: string;
|
|
816
|
+
readonly threadId: string;
|
|
817
|
+
readonly runId: string;
|
|
818
|
+
readonly toolCallId: string;
|
|
819
|
+
} | {
|
|
820
|
+
readonly _tag: "programmatic";
|
|
821
|
+
readonly agentId: string;
|
|
822
|
+
readonly threadId: string;
|
|
823
|
+
};
|
|
824
|
+
readonly targetDigests: {
|
|
825
|
+
readonly agent: string;
|
|
826
|
+
readonly model: string;
|
|
827
|
+
readonly tools: string;
|
|
828
|
+
};
|
|
829
|
+
readonly policy: Schema.Json;
|
|
830
|
+
readonly budget: {
|
|
831
|
+
readonly caps: {
|
|
832
|
+
readonly maxTotalChildInvocations?: number | undefined;
|
|
833
|
+
readonly maxConcurrentChildren?: number | undefined;
|
|
834
|
+
readonly maxTurns?: number | undefined;
|
|
835
|
+
readonly maxToolCalls?: number | undefined;
|
|
836
|
+
readonly maxDurationMillis?: number | undefined;
|
|
837
|
+
readonly maxInputTokens?: number | undefined;
|
|
838
|
+
readonly maxOutputTokens?: number | undefined;
|
|
839
|
+
readonly maxCostMicrousd?: number | undefined;
|
|
840
|
+
readonly maxResultBytes?: number | undefined;
|
|
841
|
+
};
|
|
842
|
+
readonly allocation: {
|
|
843
|
+
readonly turns: number;
|
|
844
|
+
readonly toolCalls: number;
|
|
845
|
+
readonly durationMillis: number;
|
|
846
|
+
readonly inputTokens: number;
|
|
847
|
+
readonly outputTokens: number;
|
|
848
|
+
readonly costMicrousd: number;
|
|
849
|
+
readonly resultBytes: number;
|
|
850
|
+
};
|
|
851
|
+
readonly descendantInvocations?: number | undefined;
|
|
852
|
+
};
|
|
853
|
+
readonly grant: {
|
|
854
|
+
readonly allowedToolNames: readonly string[];
|
|
855
|
+
readonly maxDepth: number;
|
|
856
|
+
readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
|
|
857
|
+
};
|
|
858
|
+
readonly depth: number;
|
|
859
|
+
readonly toolCallAllowance?: number | undefined;
|
|
860
|
+
readonly firstMessageId: string;
|
|
861
|
+
readonly createdAtMillis: number;
|
|
862
|
+
readonly expiresAtMillis: number;
|
|
863
|
+
readonly reporting?: {
|
|
864
|
+
readonly sourceDigests: {
|
|
865
|
+
readonly agent: string;
|
|
866
|
+
readonly model: string;
|
|
867
|
+
readonly tools: string;
|
|
868
|
+
};
|
|
869
|
+
readonly destinationDelegationId?: string | undefined;
|
|
870
|
+
} | undefined;
|
|
871
|
+
};
|
|
872
|
+
readonly messageId: string;
|
|
873
|
+
readonly parameters: Schema.Json;
|
|
874
|
+
readonly createdAtMillis: number;
|
|
875
|
+
readonly sourceSubmissionId?: string | undefined;
|
|
876
|
+
readonly deliveryPrincipal?: string | undefined;
|
|
877
|
+
};
|
|
878
|
+
readonly inputDigest: string;
|
|
879
|
+
} | {
|
|
880
|
+
readonly _tag: "WorkerOriginRecorded";
|
|
881
|
+
readonly origin: {
|
|
882
|
+
readonly worker: {
|
|
883
|
+
readonly schemaVersion: 1;
|
|
884
|
+
readonly delegationId: string;
|
|
885
|
+
readonly targetAgentId: string;
|
|
886
|
+
readonly threadId: string;
|
|
887
|
+
};
|
|
888
|
+
readonly source: {
|
|
889
|
+
readonly _tag: "tool";
|
|
890
|
+
readonly agentId: string;
|
|
891
|
+
readonly threadId: string;
|
|
892
|
+
readonly runId: string;
|
|
893
|
+
readonly toolCallId: string;
|
|
894
|
+
} | {
|
|
895
|
+
readonly _tag: "programmatic";
|
|
896
|
+
readonly agentId: string;
|
|
897
|
+
readonly threadId: string;
|
|
898
|
+
};
|
|
899
|
+
readonly targetDigests: {
|
|
900
|
+
readonly agent: string;
|
|
901
|
+
readonly model: string;
|
|
902
|
+
readonly tools: string;
|
|
903
|
+
};
|
|
904
|
+
readonly policy: Schema.Json;
|
|
905
|
+
readonly budget: {
|
|
906
|
+
readonly caps: {
|
|
907
|
+
readonly maxTotalChildInvocations?: number | undefined;
|
|
908
|
+
readonly maxConcurrentChildren?: number | undefined;
|
|
909
|
+
readonly maxTurns?: number | undefined;
|
|
910
|
+
readonly maxToolCalls?: number | undefined;
|
|
911
|
+
readonly maxDurationMillis?: number | undefined;
|
|
912
|
+
readonly maxInputTokens?: number | undefined;
|
|
913
|
+
readonly maxOutputTokens?: number | undefined;
|
|
914
|
+
readonly maxCostMicrousd?: number | undefined;
|
|
915
|
+
readonly maxResultBytes?: number | undefined;
|
|
916
|
+
};
|
|
917
|
+
readonly allocation: {
|
|
918
|
+
readonly turns: number;
|
|
919
|
+
readonly toolCalls: number;
|
|
920
|
+
readonly durationMillis: number;
|
|
921
|
+
readonly inputTokens: number;
|
|
922
|
+
readonly outputTokens: number;
|
|
923
|
+
readonly costMicrousd: number;
|
|
924
|
+
readonly resultBytes: number;
|
|
925
|
+
};
|
|
926
|
+
readonly descendantInvocations?: number | undefined;
|
|
927
|
+
};
|
|
928
|
+
readonly grant: {
|
|
929
|
+
readonly allowedToolNames: readonly string[];
|
|
930
|
+
readonly maxDepth: number;
|
|
931
|
+
readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
|
|
932
|
+
};
|
|
933
|
+
readonly depth: number;
|
|
934
|
+
readonly toolCallAllowance?: number | undefined;
|
|
935
|
+
readonly firstMessageId: string;
|
|
936
|
+
readonly createdAtMillis: number;
|
|
937
|
+
readonly expiresAtMillis: number;
|
|
938
|
+
readonly reporting?: {
|
|
939
|
+
readonly sourceDigests: {
|
|
940
|
+
readonly agent: string;
|
|
941
|
+
readonly model: string;
|
|
942
|
+
readonly tools: string;
|
|
943
|
+
};
|
|
944
|
+
readonly destinationDelegationId?: string | undefined;
|
|
945
|
+
} | undefined;
|
|
946
|
+
};
|
|
947
|
+
} | {
|
|
948
|
+
readonly _tag: "WorkerInputCompleted";
|
|
949
|
+
readonly messageId: string;
|
|
950
|
+
readonly workerThreadId: string;
|
|
951
|
+
readonly submissionId: string;
|
|
952
|
+
readonly receiptId: string;
|
|
953
|
+
readonly settlementId: string;
|
|
954
|
+
readonly completedAtMillis: number;
|
|
955
|
+
} | {
|
|
956
|
+
readonly _tag: "WorkerReportPrepared";
|
|
957
|
+
readonly runId: string;
|
|
958
|
+
readonly messageId: string;
|
|
959
|
+
readonly envelope: Schema.Json;
|
|
960
|
+
readonly createdAtMillis: number;
|
|
961
|
+
readonly deadlineAtMillis: number;
|
|
962
|
+
} | {
|
|
963
|
+
readonly _tag: "WorkerReportRefused";
|
|
964
|
+
readonly runId: string;
|
|
965
|
+
readonly messageId: string;
|
|
966
|
+
readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
|
|
967
|
+
} | {
|
|
968
|
+
readonly _tag: "PeerMessagePrepared";
|
|
969
|
+
readonly messageId: string;
|
|
970
|
+
readonly sourcePrincipal: string;
|
|
971
|
+
readonly operation: "reply" | "send";
|
|
972
|
+
readonly deadlineAtMillis: number;
|
|
973
|
+
readonly encodedEnvelope: Schema.Json;
|
|
974
|
+
} | {
|
|
975
|
+
readonly _tag: "SubtreeBudgetReserved";
|
|
976
|
+
readonly reservationId: string;
|
|
977
|
+
readonly sourceSubmissionId?: string | undefined;
|
|
978
|
+
readonly childThreadId: string;
|
|
979
|
+
readonly lifetime: "attached" | "background";
|
|
980
|
+
readonly depth: number;
|
|
981
|
+
readonly policy: Schema.Json;
|
|
982
|
+
readonly grant: {
|
|
983
|
+
readonly allowedToolNames: readonly string[];
|
|
984
|
+
readonly maxDepth: number;
|
|
985
|
+
readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
|
|
986
|
+
};
|
|
987
|
+
readonly budget: {
|
|
988
|
+
readonly caps: {
|
|
989
|
+
readonly maxTotalChildInvocations?: number | undefined;
|
|
990
|
+
readonly maxConcurrentChildren?: number | undefined;
|
|
991
|
+
readonly maxTurns?: number | undefined;
|
|
992
|
+
readonly maxToolCalls?: number | undefined;
|
|
993
|
+
readonly maxDurationMillis?: number | undefined;
|
|
994
|
+
readonly maxInputTokens?: number | undefined;
|
|
995
|
+
readonly maxOutputTokens?: number | undefined;
|
|
996
|
+
readonly maxCostMicrousd?: number | undefined;
|
|
997
|
+
readonly maxResultBytes?: number | undefined;
|
|
998
|
+
};
|
|
999
|
+
readonly allocation: {
|
|
1000
|
+
readonly turns: number;
|
|
1001
|
+
readonly toolCalls: number;
|
|
1002
|
+
readonly durationMillis: number;
|
|
1003
|
+
readonly inputTokens: number;
|
|
1004
|
+
readonly outputTokens: number;
|
|
1005
|
+
readonly costMicrousd: number;
|
|
1006
|
+
readonly resultBytes: number;
|
|
1007
|
+
};
|
|
1008
|
+
readonly descendantInvocations?: number | undefined;
|
|
1009
|
+
};
|
|
592
1010
|
} | {
|
|
593
1011
|
readonly _tag: "RepairAnnotated";
|
|
594
1012
|
readonly reason: string;
|
|
@@ -628,13 +1046,13 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
628
1046
|
readonly author: string;
|
|
629
1047
|
readonly reason: string;
|
|
630
1048
|
readonly resolution: {
|
|
1049
|
+
readonly _tag: "SafeToRetry";
|
|
1050
|
+
} | {
|
|
631
1051
|
readonly _tag: "CompletedWithResult";
|
|
632
1052
|
readonly result: Schema.Json;
|
|
633
1053
|
readonly isFailure: boolean;
|
|
634
1054
|
} | {
|
|
635
1055
|
readonly _tag: "NeverHappened";
|
|
636
|
-
} | {
|
|
637
|
-
readonly _tag: "SafeToRetry";
|
|
638
1056
|
} | {
|
|
639
1057
|
readonly _tag: "AbortSubmission";
|
|
640
1058
|
};
|
|
@@ -708,7 +1126,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
708
1126
|
readonly attemptedEpoch: number;
|
|
709
1127
|
} | {
|
|
710
1128
|
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";
|
|
1129
|
+
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" | "worker:after-completion-append" | "worker:after-origin-append" | "worker:after-report-append" | "worker:after-report-delivery" | "worker:after-source-append" | "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-subtree-append";
|
|
712
1130
|
} | {
|
|
713
1131
|
readonly _tag: "AdmissionLimitExceeded";
|
|
714
1132
|
readonly limit: "database-bytes" | "input-bytes" | "queue-depth";
|
|
@@ -7,10 +7,11 @@ import { Receipt } from "@effect-agent/thread/DurableAgentRuntime";
|
|
|
7
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
|
-
import { CanonicalRecordEnvelope, CanonicalSequence, DefinitionDigests, PersistedJson } from "@effect-agent/thread/Records";
|
|
10
|
+
import { CanonicalRecordEnvelope, CanonicalSequence, DefinitionDigests, PersistedJson, WorkerAdmission } from "@effect-agent/thread/Records";
|
|
11
11
|
import { RpcTracing } from "effect-cf";
|
|
12
12
|
import { BrowserCrypto } from "@effect/platform-browser";
|
|
13
13
|
import { AgentInputError } from "@effect-agent/core/AgentError";
|
|
14
|
+
import { MessageAdmission } from "@effect-agent/core/Messaging";
|
|
14
15
|
import { DigestError } from "@effect-agent/thread/Digest";
|
|
15
16
|
import { DurableRuntimeFailpointError } from "@effect-agent/thread/DurableFailpoint";
|
|
16
17
|
import { OperationDenied } from "@effect-agent/thread/OperationAuthorizer";
|
|
@@ -98,6 +99,8 @@ var SubmitRequest = class extends Schema.Class("@effect-agent/platform-cloudflar
|
|
|
98
99
|
idempotencyKey: IdempotencyKey,
|
|
99
100
|
admissionGroup: Schema.optionalKey(AdmissionGroup),
|
|
100
101
|
admissionFence: Schema.optionalKey(AdmissionFence),
|
|
102
|
+
workerAdmission: Schema.optionalKey(WorkerAdmission),
|
|
103
|
+
messageAdmission: Schema.optionalKey(MessageAdmission),
|
|
101
104
|
definitions: DefinitionDigests,
|
|
102
105
|
inputPayload: PersistedJson
|
|
103
106
|
}) {};
|
|
@@ -315,6 +318,8 @@ var CloudflareThreadClient = class CloudflareThreadClient extends Context.Servic
|
|
|
315
318
|
idempotencyKey: options.idempotencyKey,
|
|
316
319
|
...options.admissionGroup === void 0 ? {} : { admissionGroup: options.admissionGroup },
|
|
317
320
|
...options.admissionFence === void 0 ? {} : { admissionFence: options.admissionFence },
|
|
321
|
+
...options.workerAdmission === void 0 ? {} : { workerAdmission: options.workerAdmission },
|
|
322
|
+
...options.messageAdmission === void 0 ? {} : { messageAdmission: options.messageAdmission },
|
|
318
323
|
definitions: options.definitions,
|
|
319
324
|
inputPayload
|
|
320
325
|
});
|