@effect-agent/platform-cloudflare 0.1.0-beta.42 → 0.1.0-beta.45
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/browser-quick-action.mjs.map +1 -1
- package/dist/browser-rest-capture.mjs.map +1 -1
- package/dist/browser-rest-crawl.mjs.map +1 -1
- package/dist/browser-session-lifecycle-DqntvG-Y.d.mts +21 -0
- package/dist/browser-session-lifecycle-ZGgb3pnK.mjs +84 -0
- package/dist/browser-session-lifecycle-ZGgb3pnK.mjs.map +1 -0
- package/dist/index.d.mts +47 -34
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/interactive-browser.d.mts +1 -18
- package/dist/interactive-browser.mjs +2 -81
- package/dist/interactive-browser.mjs.map +1 -1
- package/dist/{prepared-admission-BKp_Upw2.mjs → prepared-admission-BhW2eT_a.mjs} +3 -3
- package/dist/prepared-admission-BhW2eT_a.mjs.map +1 -0
- package/dist/protected-browser.d.mts +62 -0
- package/dist/protected-browser.mjs +714 -0
- package/dist/protected-browser.mjs.map +1 -0
- package/dist/scheduling.mjs +1 -1
- package/dist/scheduling.mjs.map +1 -1
- package/dist/subscriptions.mjs +1 -1
- package/dist/subscriptions.mjs.map +1 -1
- package/package.json +1 -81
- package/src/alarm.ts +277 -242
- package/src/bindings.ts +5 -0
- package/src/boundary.ts +4 -0
- package/src/browser-quick-action.ts +52 -0
- package/src/browser-rest-capture.ts +30 -0
- package/src/browser-rest-crawl.ts +43 -0
- package/src/browser-session-lifecycle.ts +18 -0
- package/src/client.ts +40 -0
- package/src/code-mode-executor.ts +50 -0
- package/src/interactive-browser.ts +176 -0
- package/src/layers.ts +13 -3
- package/src/memory.ts +42 -3
- package/src/prepared-admission.ts +1 -0
- package/src/progress-wait.ts +14 -0
- package/src/protected-browser/binding.ts +185 -0
- package/src/protected-browser/inspect-frame.ts +82 -0
- package/src/protected-browser/native.ts +384 -0
- package/src/protected-browser/policy.ts +594 -0
- package/src/protected-browser.ts +2 -0
- package/src/scheduling.ts +34 -0
- package/src/subscriptions.ts +50 -0
- package/src/thread-object.ts +55 -1
- package/src/transport.ts +1 -0
- package/src/wake-scheduler.ts +1 -0
- package/dist/prepared-admission-BKp_Upw2.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -211,7 +211,7 @@ declare const ThreadMaintenance_base: Context.ServiceClass<ThreadMaintenance, "@
|
|
|
211
211
|
* recovery states leave their generation dirty and retain bounded backoff rearming.
|
|
212
212
|
*/
|
|
213
213
|
declare class ThreadMaintenance extends ThreadMaintenance_base {
|
|
214
|
-
static readonly layer:
|
|
214
|
+
static readonly layer: Layer.Layer<ThreadMaintenance, never, DurableAgentRuntime | SubmissionLedger | DurableAlarmService | ThreadMaintenanceFailpoint | CloudflareDurableRuntimeConfig | ThreadObjectIdentity | DurableObjectContext>;
|
|
215
215
|
}
|
|
216
216
|
//#endregion
|
|
217
217
|
//#region src/wake-scheduler.d.ts
|
|
@@ -264,7 +264,7 @@ declare const threadPortTransportLayer: Layer.Layer<ThreadPortTransport, never,
|
|
|
264
264
|
//#region src/layers.d.ts
|
|
265
265
|
/**
|
|
266
266
|
* Raw (unvalidated) construction options for `ThreadObject.make`, mirroring
|
|
267
|
-
* `
|
|
267
|
+
* `NodeDurableAgentRuntimeOptions`. Optional fields default to the documented production values
|
|
268
268
|
* (`CLOUDFLARE_RUNTIME_DEFAULTS`); everything is schema-decoded into
|
|
269
269
|
* `CloudflareDurableRuntimeConfigValue` before any resource opens (deployment §5 gate 1).
|
|
270
270
|
*/
|
|
@@ -350,6 +350,19 @@ declare const layerConfig: (options: CloudflareDurableRuntimeOptions) => Layer.L
|
|
|
350
350
|
* Use Layer.unwrap for registration values that need effectful application setup.
|
|
351
351
|
*/
|
|
352
352
|
declare const layer: <const Entries extends ReadonlyArray<AgentRegistration>>(registrations: Entries) => Layer.Layer<CloudflareDurableRuntimeServices, DigestError | DoStorageInitializationError, DurableObjectContext | ThreadObjectNamespace | Exclude<[Entries[number]] extends [never] ? never : Entries[number] extends (infer T) ? T extends Entries[number] ? T extends {
|
|
353
|
+
readonly attemptLayer: (context: import("@effect-agent/thread").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>;
|
|
354
|
+
} ? Requires | Exclude<T extends (infer T_1) ? T_1 extends T ? T_1 extends {
|
|
355
|
+
readonly agent: infer A extends import("@effect-agent/thread").ExecutableAgentBinding;
|
|
356
|
+
} ? import("@effect-agent/thread").DurableWorkerRequirements<A> : T_1 extends {
|
|
357
|
+
readonly agent: infer D extends import("@effect-agent/core").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
|
|
358
|
+
readonly instructions: import("@effect-agent/core").InstructionSource<never, unknown, unknown>;
|
|
359
|
+
readonly inputPrompt?: import("@effect-agent/core").InputPromptSource<never, unknown, unknown> | undefined;
|
|
360
|
+
};
|
|
361
|
+
readonly model: infer M extends import("@effect-agent/thread").ExecutableAgentBinding["model"];
|
|
362
|
+
} ? import("@effect-agent/thread").DurableWorkerRequirements<{
|
|
363
|
+
readonly definition: D;
|
|
364
|
+
readonly model: M;
|
|
365
|
+
}> : never : never : never, Provides> : T extends {
|
|
353
366
|
readonly agent: infer A extends import("@effect-agent/thread").ExecutableAgentBinding;
|
|
354
367
|
} ? import("@effect-agent/thread").DurableWorkerRequirements<A> : T extends {
|
|
355
368
|
readonly agent: infer D extends import("@effect-agent/core").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
|
|
@@ -521,13 +534,13 @@ declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCommand,
|
|
|
521
534
|
readonly author: string;
|
|
522
535
|
readonly reason: string;
|
|
523
536
|
readonly resolution: {
|
|
524
|
-
readonly _tag: "SafeToRetry";
|
|
525
|
-
} | {
|
|
526
537
|
readonly _tag: "CompletedWithResult";
|
|
527
538
|
readonly result: Schema.Json;
|
|
528
539
|
readonly isFailure: boolean;
|
|
529
540
|
} | {
|
|
530
541
|
readonly _tag: "NeverHappened";
|
|
542
|
+
} | {
|
|
543
|
+
readonly _tag: "SafeToRetry";
|
|
531
544
|
} | {
|
|
532
545
|
readonly _tag: "AbortSubmission";
|
|
533
546
|
};
|
|
@@ -602,11 +615,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
602
615
|
readonly createdAt: string;
|
|
603
616
|
readonly deploymentId: string;
|
|
604
617
|
readonly payload: {
|
|
605
|
-
readonly _tag: "AbortRequested";
|
|
606
|
-
readonly submissionId: string;
|
|
607
|
-
readonly author: string;
|
|
608
|
-
readonly reason: string;
|
|
609
|
-
} | {
|
|
610
618
|
readonly _tag: "ThreadCreated";
|
|
611
619
|
readonly agentId: string;
|
|
612
620
|
readonly definitions: {
|
|
@@ -743,6 +751,11 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
743
751
|
readonly runDisposition?: Schema.Json | undefined;
|
|
744
752
|
readonly finishReason?: "budget-exhausted" | undefined;
|
|
745
753
|
readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
|
|
754
|
+
} | {
|
|
755
|
+
readonly _tag: "AbortRequested";
|
|
756
|
+
readonly submissionId: string;
|
|
757
|
+
readonly author: string;
|
|
758
|
+
readonly reason: string;
|
|
746
759
|
} | {
|
|
747
760
|
readonly _tag: "SubmissionSettled";
|
|
748
761
|
readonly submissionId: string;
|
|
@@ -913,13 +926,13 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
913
926
|
readonly author: string;
|
|
914
927
|
readonly reason: string;
|
|
915
928
|
readonly resolution: {
|
|
916
|
-
readonly _tag: "SafeToRetry";
|
|
917
|
-
} | {
|
|
918
929
|
readonly _tag: "CompletedWithResult";
|
|
919
930
|
readonly result: Schema.Json;
|
|
920
931
|
readonly isFailure: boolean;
|
|
921
932
|
} | {
|
|
922
933
|
readonly _tag: "NeverHappened";
|
|
934
|
+
} | {
|
|
935
|
+
readonly _tag: "SafeToRetry";
|
|
923
936
|
} | {
|
|
924
937
|
readonly _tag: "AbortSubmission";
|
|
925
938
|
};
|
|
@@ -929,8 +942,13 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
929
942
|
} | {
|
|
930
943
|
readonly _tag: "HostFailed";
|
|
931
944
|
readonly failure: {
|
|
932
|
-
readonly _tag: "
|
|
933
|
-
readonly
|
|
945
|
+
readonly _tag: "HostProtocolError";
|
|
946
|
+
readonly message: string;
|
|
947
|
+
} | {
|
|
948
|
+
readonly _tag: "AgentInputError";
|
|
949
|
+
readonly message: string;
|
|
950
|
+
} | {
|
|
951
|
+
readonly _tag: "DigestError";
|
|
934
952
|
readonly message: string;
|
|
935
953
|
readonly cause?: Schema.Json | undefined;
|
|
936
954
|
} | {
|
|
@@ -944,6 +962,15 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
944
962
|
readonly _tag: "SettlementConflict";
|
|
945
963
|
readonly submissionId: string;
|
|
946
964
|
readonly existingOutcome: "aborted" | "completed" | "failed";
|
|
965
|
+
} | {
|
|
966
|
+
readonly _tag: "ApprovalConflict";
|
|
967
|
+
readonly submissionId: string;
|
|
968
|
+
readonly toolCallId: string;
|
|
969
|
+
readonly existingDecision: "approved" | "denied";
|
|
970
|
+
} | {
|
|
971
|
+
readonly _tag: "UnknownResolutionConflict";
|
|
972
|
+
readonly submissionId: string;
|
|
973
|
+
readonly toolCallId: string;
|
|
947
974
|
} | {
|
|
948
975
|
readonly _tag: "JoinedToHost";
|
|
949
976
|
readonly submissionId: string;
|
|
@@ -973,25 +1000,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
973
1000
|
readonly threadId: string;
|
|
974
1001
|
readonly actualEpoch: number;
|
|
975
1002
|
readonly attemptedEpoch: number;
|
|
976
|
-
} | {
|
|
977
|
-
readonly _tag: "HostProtocolError";
|
|
978
|
-
readonly message: string;
|
|
979
|
-
} | {
|
|
980
|
-
readonly _tag: "AgentInputError";
|
|
981
|
-
readonly message: string;
|
|
982
|
-
} | {
|
|
983
|
-
readonly _tag: "DigestError";
|
|
984
|
-
readonly message: string;
|
|
985
|
-
readonly cause?: Schema.Json | undefined;
|
|
986
|
-
} | {
|
|
987
|
-
readonly _tag: "ApprovalConflict";
|
|
988
|
-
readonly submissionId: string;
|
|
989
|
-
readonly toolCallId: string;
|
|
990
|
-
readonly existingDecision: "approved" | "denied";
|
|
991
|
-
} | {
|
|
992
|
-
readonly _tag: "UnknownResolutionConflict";
|
|
993
|
-
readonly submissionId: string;
|
|
994
|
-
readonly toolCallId: string;
|
|
995
1003
|
} | {
|
|
996
1004
|
readonly _tag: "DurableRuntimeFailpointError";
|
|
997
1005
|
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";
|
|
@@ -1000,6 +1008,11 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
1000
1008
|
readonly limit: "database-bytes" | "input-bytes" | "queue-depth";
|
|
1001
1009
|
readonly actual: number;
|
|
1002
1010
|
readonly maximum: number;
|
|
1011
|
+
} | {
|
|
1012
|
+
readonly _tag: "DurableAlarmError";
|
|
1013
|
+
readonly operation: string;
|
|
1014
|
+
readonly message: string;
|
|
1015
|
+
readonly cause?: Schema.Json | undefined;
|
|
1003
1016
|
} | {
|
|
1004
1017
|
readonly _tag: "OperationDenied";
|
|
1005
1018
|
readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
|
|
@@ -1204,13 +1217,13 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
1204
1217
|
readonly author: string;
|
|
1205
1218
|
readonly reason: string;
|
|
1206
1219
|
readonly resolution: {
|
|
1207
|
-
readonly _tag: "SafeToRetry";
|
|
1208
|
-
} | {
|
|
1209
1220
|
readonly _tag: "CompletedWithResult";
|
|
1210
1221
|
readonly result: Schema.Json;
|
|
1211
1222
|
readonly isFailure: boolean;
|
|
1212
1223
|
} | {
|
|
1213
1224
|
readonly _tag: "NeverHappened";
|
|
1225
|
+
} | {
|
|
1226
|
+
readonly _tag: "SafeToRetry";
|
|
1214
1227
|
} | {
|
|
1215
1228
|
readonly _tag: "AbortSubmission";
|
|
1216
1229
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { $ as CloudflarePlatformConfigError, A as decodeUnknownResolutionCommand, B as DurableAlarmError, C as decodeApprovalDecisionCommand, D as decodeObservePageRequest, E as decodeHostResponse, F as encodeHostResponse, G as safeCauseDiagnostic, H as MaintenancePassReport, I as encodeObservePageRequest, J as CLOUDFLARE_DATABASE_CAP_BYTES, K as safeCauseMessage, L as encodeReceipt, M as encodeApprovalDecisionCommand, N as encodeAwaitProgressRequest, O as decodeReceipt, P as encodeCancelProgressRequest, Q as CloudflareDurableRuntimeConfigValue, R as encodeSubmitRequest, S as decodeAbortCommand, T as decodeCancelProgressRequest, U as ThreadMaintenance, V as DurableAlarmService, W as ThreadMaintenanceFailpoint, X as CloudflareAdmissionLimitsValue, Y as CLOUDFLARE_RUNTIME_DEFAULTS, Z as CloudflareDurableRuntimeConfig, _ as SubmitRequest, a as AwaitProgressRequest, at as threadNamespaceFromEnv, b as UnknownResolutionRecorded, c as HostFailed, d as HostResponse, et as DEFAULT_MAX_DATABASE_BYTES, f as ObservePageRequest, g as SettlementReached, h as ProgressObserved, i as ApprovalRecorded, it as ThreadObjectNamespace, j as encodeAbortCommand, k as decodeSubmitRequest, l as HostFailure, m as ProgressCancelled, n as cloudflareScheduledInputAdmissionLayer, nt as DurableObjectContext, o as CancelProgressRequest, ot as threadNamespaceLayer, p as ObservedPage, q as AdmissionLimitExceeded, r as AbortRecorded, rt as ThreadObjectIdentity, s as CloudflareThreadClient, t as cloudflarePreparedInputAdmissionLayer, tt as CloudflareBindingError, u as HostProtocolError, v as SubmitSucceeded, w as decodeAwaitProgressRequest, x as boundHostDiagnostic, y as ThreadClientError, z as encodeUnknownResolutionCommand } from "./prepared-admission-
|
|
2
|
+
import { $ as CloudflarePlatformConfigError, A as decodeUnknownResolutionCommand, B as DurableAlarmError, C as decodeApprovalDecisionCommand, D as decodeObservePageRequest, E as decodeHostResponse, F as encodeHostResponse, G as safeCauseDiagnostic, H as MaintenancePassReport, I as encodeObservePageRequest, J as CLOUDFLARE_DATABASE_CAP_BYTES, K as safeCauseMessage, L as encodeReceipt, M as encodeApprovalDecisionCommand, N as encodeAwaitProgressRequest, O as decodeReceipt, P as encodeCancelProgressRequest, Q as CloudflareDurableRuntimeConfigValue, R as encodeSubmitRequest, S as decodeAbortCommand, T as decodeCancelProgressRequest, U as ThreadMaintenance, V as DurableAlarmService, W as ThreadMaintenanceFailpoint, X as CloudflareAdmissionLimitsValue, Y as CLOUDFLARE_RUNTIME_DEFAULTS, Z as CloudflareDurableRuntimeConfig, _ as SubmitRequest, a as AwaitProgressRequest, at as threadNamespaceFromEnv, b as UnknownResolutionRecorded, c as HostFailed, d as HostResponse, et as DEFAULT_MAX_DATABASE_BYTES, f as ObservePageRequest, g as SettlementReached, h as ProgressObserved, i as ApprovalRecorded, it as ThreadObjectNamespace, j as encodeAbortCommand, k as decodeSubmitRequest, l as HostFailure, m as ProgressCancelled, n as cloudflareScheduledInputAdmissionLayer, nt as DurableObjectContext, o as CancelProgressRequest, ot as threadNamespaceLayer, p as ObservedPage, q as AdmissionLimitExceeded, r as AbortRecorded, rt as ThreadObjectIdentity, s as CloudflareThreadClient, t as cloudflarePreparedInputAdmissionLayer, tt as CloudflareBindingError, u as HostProtocolError, v as SubmitSucceeded, w as decodeAwaitProgressRequest, x as boundHostDiagnostic, y as ThreadClientError, z as encodeUnknownResolutionCommand } from "./prepared-admission-BhW2eT_a.mjs";
|
|
3
3
|
import { CloudflareSchedulingClient, ScheduleAlarmProtocolError, ScheduleOwnerIdentity, ScheduleOwnerNamespace, ScheduleOwnerProtocolError, makeScheduleOwnerObjectClass } from "./scheduling.mjs";
|
|
4
4
|
import { CloudflareSubscriptionConfigError, CloudflareSubscriptionsClient, SubscriptionAlarmProtocolError, SubscriptionPartitionIdentity, SubscriptionPartitionNamespace, SubscriptionPartitionProtocolError, makeSubscriptionPartitionObjectClass, sourcePartitionName, validateCloudflareSubscriptionLimits } from "./subscriptions.mjs";
|
|
5
5
|
import { CloudflareBrowser } from "./browser-quick-action.mjs";
|
|
@@ -251,8 +251,8 @@ const layerFromBindings = (bindings) => Layer.unwrap(Effect.gen(function* () {
|
|
|
251
251
|
})).pipe(Layer.provide(localPorts));
|
|
252
252
|
const routedPorts = Layer.mergeAll(routedSubmissionLedgerLayer({ localThreadId: threadId }), routedThreadStoreLayer({ localThreadId: threadId })).pipe(Layer.provide(localPorts), Layer.provide(threadPortTransportLayer));
|
|
253
253
|
const base = Layer.mergeAll(DurableAlarmService.layer, ProgressWaitRegistry.layer);
|
|
254
|
-
const runtimeStack = DurableAgentRuntime.
|
|
255
|
-
return Layer.mergeAll(runtimeStack, ThreadMaintenance.layer
|
|
254
|
+
const runtimeStack = DurableAgentRuntime.layerWithBindings(bindings).pipe(Layer.provideMerge(routedPorts), Layer.provideMerge(cloudflareWakeSchedulerLayer), Layer.provideMerge(base));
|
|
255
|
+
return Layer.mergeAll(runtimeStack, ThreadMaintenance.layer.pipe(Layer.provide(runtimeStack)), portsEndpointLayer);
|
|
256
256
|
}));
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region src/thread-object.ts
|