@effect-agent/platform-cloudflare 0.1.0-beta.23 → 0.1.0-beta.25
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/index.d.mts +36 -32
- package/dist/index.mjs +234 -171
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/alarm.ts +2 -1
- package/src/bindings.ts +31 -30
- package/src/boundary.ts +51 -0
- package/src/client.ts +86 -187
- package/src/code-mode-executor.ts +128 -62
- package/src/conversation-object.ts +46 -20
- package/src/layers.ts +17 -33
- package/src/wake-scheduler.ts +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Crypto, Effect, Layer, Option, Schema, Scope } from "effect";
|
|
2
2
|
import { AbortCommand, AbortIntent, AdmissionConflict, AgentBindingResolver, AppendConflict, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, CanonicalRecordEnvelope, CanonicalSequence, ConversationNotMaterialized, ConversationStore, ConversationStoreError, DefinitionDigests, DigestError, DurableAgentRuntime, DurableBindingFailure, DurableRuntimeConfig, DurableRuntimeFailpointError, DurableRuntimeFailpointHandler, DurableSubmitAgent, DurableSubmitOptions, DurableWorkerFailure, FenceRejected, IntegrityReport, JoinedToHost, LedgerError, ObligationReport, ObligationThresholds, OperationAuthorizerService, OperationDenied, OwnershipLost, ProducerId, Receipt, RecoveryExplanation, RecoveryReport, ResolvedBinding, RetryCommand, RetryRefused, RunJournalError, Settlement, SettlementConflict, SubmissionLedger, ToolReconciler, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, WakeScheduler } from "@effect-agent/session";
|
|
3
|
-
import { ConversationPortTransport, DoStorageFailpointHandler, DoStorageInitializationError } from "@effect-agent/storage-cloudflare";
|
|
3
|
+
import { ConversationPortTransport, DoStorageFailpointHandler, DoStorageInitializationError, PortRequest, PortResponse } from "@effect-agent/storage-cloudflare";
|
|
4
4
|
import { AgentInputError, ConversationId } from "@effect-agent/core";
|
|
5
5
|
import { RunContextPreparation } from "@effect-agent/engine";
|
|
6
6
|
import { DurableObjectState as DurableObjectState$1, WorkerEnvironment } from "effect-cf";
|
|
@@ -66,7 +66,7 @@ declare class ConversationObjectNamespace extends ConversationObjectNamespace_ba
|
|
|
66
66
|
* narrowest-boundary check (structural probe for the namespace surface the transport uses);
|
|
67
67
|
* a missing or misshaped binding fails typed before any Layer is built.
|
|
68
68
|
*/
|
|
69
|
-
declare const conversationNamespaceFromEnv: (env: unknown, binding: string) => Effect.Effect<DurableObjectNamespace<ConversationObjectRpc>, CloudflareBindingError>;
|
|
69
|
+
declare const conversationNamespaceFromEnv: (env: unknown, binding: string) => Effect.Effect<DurableObjectNamespace<ConversationObjectRpc>, CloudflareBindingError, never>;
|
|
70
70
|
/** `ConversationObjectNamespace` built from the untyped Worker `env` (fails typed). */
|
|
71
71
|
declare const conversationNamespaceLayer: (env: unknown, binding: string) => Layer.Layer<ConversationObjectNamespace, CloudflareBindingError>;
|
|
72
72
|
declare const DurableObjectContext_base: Context.ServiceClass<DurableObjectContext, "@effect-agent/platform-cloudflare/DurableObjectContext", {
|
|
@@ -401,10 +401,9 @@ interface CloudflareDurableRuntimeOptions {
|
|
|
401
401
|
readonly toolReconciler?: Layer.Layer<ToolReconciler> | undefined;
|
|
402
402
|
/**
|
|
403
403
|
* Registered worker Bindings resolved at durable claim time (S2, spec/subagents.md §11):
|
|
404
|
-
* build each with `DurableWorkerBinding.make(binding, digests)`.
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
* to the empty registration (every resolved claim fails closed).
|
|
404
|
+
* build each with `DurableWorkerBinding.make(binding, digests)`. The callback receives the live
|
|
405
|
+
* Object context and derived identities and is evaluated once per incarnation during Layer
|
|
406
|
+
* construction. Defaults to the empty registration (every resolved claim fails closed).
|
|
408
407
|
*/
|
|
409
408
|
readonly bindings?: CloudflareBindingSource | undefined;
|
|
410
409
|
/**
|
|
@@ -425,11 +424,8 @@ interface CloudflareRuntimeSourceContext {
|
|
|
425
424
|
}
|
|
426
425
|
/** Per-incarnation host values available while registered worker Bindings are captured. */
|
|
427
426
|
interface CloudflareBindingSourceContext extends CloudflareRuntimeSourceContext {}
|
|
428
|
-
/**
|
|
429
|
-
|
|
430
|
-
* Durable Object incarnation. Callback Effects cannot require services or fail typed.
|
|
431
|
-
*/
|
|
432
|
-
type CloudflareBindingSource = ReadonlyArray<ResolvedBinding> | Effect.Effect<ReadonlyArray<ResolvedBinding>, never, never> | ((context: CloudflareBindingSourceContext) => ReadonlyArray<ResolvedBinding> | Effect.Effect<ReadonlyArray<ResolvedBinding>, never, never>);
|
|
427
|
+
/** Captures registered worker Bindings once for each Durable Object incarnation. */
|
|
428
|
+
type CloudflareBindingSource = (context: CloudflareBindingSourceContext) => Effect.Effect<ReadonlyArray<ResolvedBinding>, never, never>;
|
|
433
429
|
/** A closed Run-context service whose only remaining requirement is platform Crypto. */
|
|
434
430
|
type CloudflareRunContextLayer = Layer.Layer<RunContextPreparation, never, Crypto.Crypto>;
|
|
435
431
|
/** One Layer or a per-incarnation factory over explicit Cloudflare host values. */
|
|
@@ -439,13 +435,13 @@ type CloudflareDurableRuntimeInitializationError = CloudflarePlatformConfigError
|
|
|
439
435
|
/** The services `CloudflareDurableRuntime.layer` provides. */
|
|
440
436
|
type CloudflareDurableRuntimeServices = DurableAgentRuntime | SubmissionLedger | ConversationStore | WakeScheduler | DurableRuntimeConfig | AgentBindingResolver | CloudflareDurableRuntimeConfig | ConversationObjectIdentity | DurableAlarmService | ConversationMaintenance | ConversationObjectPorts | ProgressWaitRegistry;
|
|
441
437
|
declare const ConversationObjectPorts_base: Context.ServiceClass<ConversationObjectPorts, "@effect-agent/platform-cloudflare/ConversationObjectPorts", {
|
|
442
|
-
readonly handle: (
|
|
438
|
+
readonly handle: (request: PortRequest) => Effect.Effect<PortResponse>;
|
|
443
439
|
}>;
|
|
444
440
|
/**
|
|
445
|
-
* Owner-side
|
|
446
|
-
*
|
|
447
|
-
* request cannot bounce between Objects — and
|
|
448
|
-
*
|
|
441
|
+
* Owner-side execution port for a `portCall` request the wire endpoint has already decoded.
|
|
442
|
+
* It executes against THIS Object's LOCAL port facets — never the routed decorators, so a
|
|
443
|
+
* request cannot bounce between Objects — and returns the typed response for the endpoint to
|
|
444
|
+
* encode.
|
|
449
445
|
*/
|
|
450
446
|
declare class ConversationObjectPorts extends ConversationObjectPorts_base {}
|
|
451
447
|
/**
|
|
@@ -668,14 +664,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
668
664
|
readonly createdAt: string;
|
|
669
665
|
readonly deploymentId: string;
|
|
670
666
|
readonly payload: {
|
|
671
|
-
readonly _tag: "SubagentStarted";
|
|
672
|
-
readonly runId: string;
|
|
673
|
-
readonly toolCallId: string;
|
|
674
|
-
readonly childConversationId: string;
|
|
675
|
-
readonly childSubmissionId: string;
|
|
676
|
-
readonly childReceiptId: string;
|
|
677
|
-
readonly childRunId: string;
|
|
678
|
-
} | {
|
|
679
667
|
readonly _tag: "ConversationCreated";
|
|
680
668
|
readonly agentId: string;
|
|
681
669
|
readonly definitions: {
|
|
@@ -815,6 +803,14 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
815
803
|
readonly childConversationId: string;
|
|
816
804
|
readonly childPrincipal: string;
|
|
817
805
|
readonly childIdempotencyKey: string;
|
|
806
|
+
} | {
|
|
807
|
+
readonly _tag: "SubagentStarted";
|
|
808
|
+
readonly runId: string;
|
|
809
|
+
readonly toolCallId: string;
|
|
810
|
+
readonly childConversationId: string;
|
|
811
|
+
readonly childSubmissionId: string;
|
|
812
|
+
readonly childReceiptId: string;
|
|
813
|
+
readonly childRunId: string;
|
|
818
814
|
} | {
|
|
819
815
|
readonly _tag: "SubagentJoined";
|
|
820
816
|
readonly runId: string;
|
|
@@ -981,13 +977,19 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
981
977
|
}, Schema.SchemaError, never>;
|
|
982
978
|
declare const decodeHostResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SubmitSucceeded | UnknownResolutionRecorded, Schema.SchemaError, never>;
|
|
983
979
|
/** Failure surface of `CloudflareConversationClient.submit`. */
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
type
|
|
980
|
+
declare const ClientSubmitHostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof HostProtocolError]>;
|
|
981
|
+
declare const ClientAwaitHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof HostProtocolError]>;
|
|
982
|
+
declare const ClientObserveHostFailure: Schema.Union<readonly [typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof OperationDenied, typeof HostProtocolError]>;
|
|
983
|
+
declare const ClientAbortHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof JoinedToHost, typeof DurableRuntimeFailpointError, typeof DurableAlarmError, typeof HostProtocolError]>;
|
|
984
|
+
declare const ClientApprovalHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof ApprovalConflict, typeof OperationDenied, typeof DurableAlarmError, typeof HostProtocolError]>;
|
|
985
|
+
declare const ClientUnknownHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof DurableRuntimeFailpointError, typeof OperationDenied, typeof DurableAlarmError, typeof HostProtocolError]>;
|
|
986
|
+
type ClientSubmitFailure = typeof ClientSubmitHostFailure.Type | ConversationClientError;
|
|
987
|
+
type ClientAwaitFailure = typeof ClientAwaitHostFailure.Type | ConversationClientError;
|
|
988
|
+
type ClientObserveFailure = typeof ClientObserveHostFailure.Type | ConversationClientError;
|
|
989
|
+
type ClientProgressFailure = ClientObserveFailure;
|
|
990
|
+
type ClientAbortFailure = typeof ClientAbortHostFailure.Type | ConversationClientError;
|
|
991
|
+
type ClientApprovalFailure = typeof ClientApprovalHostFailure.Type | ConversationClientError;
|
|
992
|
+
type ClientUnknownFailure = typeof ClientUnknownHostFailure.Type | ConversationClientError;
|
|
991
993
|
declare const CloudflareConversationClient_base: Context.ServiceClass<CloudflareConversationClient, "@effect-agent/platform-cloudflare/CloudflareConversationClient", {
|
|
992
994
|
/** Encode the input client-side, then durably submit to the owning Object. */
|
|
993
995
|
readonly submit: <InputSchema extends Schema.Top>(agent: DurableSubmitAgent<InputSchema>, input: InputSchema["Type"], options: DurableSubmitOptions) => Effect.Effect<Receipt, ClientSubmitFailure, InputSchema["EncodingServices"]>;
|
|
@@ -1624,6 +1626,8 @@ interface CodeModeHostStub {
|
|
|
1624
1626
|
declare class CodeModeHostEntrypoint extends WorkerEntrypoint {
|
|
1625
1627
|
call(passId: unknown, hostCall: unknown): Promise<unknown>;
|
|
1626
1628
|
}
|
|
1629
|
+
/** Dispose a Cloudflare RPC handle when the runtime supplies its untyped disposal hook. @internal */
|
|
1630
|
+
declare const disposeRpcHandle: (handle: unknown) => Effect.Effect<void>;
|
|
1627
1631
|
interface DynamicWorkerCodeExecutorOptions {
|
|
1628
1632
|
/** The `worker_loader` binding. */
|
|
1629
1633
|
readonly loader: WorkerLoader;
|
|
@@ -1639,5 +1643,5 @@ interface DynamicWorkerCodeExecutorOptions {
|
|
|
1639
1643
|
/** Layer building the Dynamic Worker `CodeExecutor` from resolved bindings. */
|
|
1640
1644
|
declare const dynamicWorkerCodeExecutorLayer: (options: DynamicWorkerCodeExecutorOptions) => Layer.Layer<CodeExecutor>;
|
|
1641
1645
|
//#endregion
|
|
1642
|
-
export { AbortRecorded, AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, AdmissionLimitExceeded, ApprovalRecorded, AwaitProgressRequest, CLOUDFLARE_DATABASE_CAP_BYTES, CLOUDFLARE_RUNTIME_DEFAULTS, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareAdmissionLimitsValue, CloudflareBindingError, CloudflareBindingSource, CloudflareBindingSourceContext, CloudflareConversationClient, CloudflareDurableRuntime, CloudflareDurableRuntimeConfig, CloudflareDurableRuntimeConfigValue, CloudflareDurableRuntimeInitializationError, CloudflareDurableRuntimeOptions, CloudflareDurableRuntimeServices, CloudflarePlatformConfigError, CloudflareRunContextLayer, CloudflareRunContextSource, CloudflareRuntimeSourceContext, CodeModeHostEntrypoint, CodeModeHostStub, ConversationClientError, ConversationMaintenance, ConversationMaintenanceFailpoint, ConversationMaintenanceFailpointHandler, ConversationMaintenanceFailpointLocation, ConversationObjectClass, ConversationObjectIdentity, ConversationObjectInstance, ConversationObjectNamespace, ConversationObjectOptions, ConversationObjectPorts, ConversationObjectRpc, DEFAULT_MAX_DATABASE_BYTES, DurableAlarmError, DurableAlarmService, DurableObjectContext, DynamicWorkerCodeExecutorOptions, ExplainedRecovery, HostFailed, HostFailure, HostProtocolError, HostResponse, MaintenancePassFailure, MaintenancePassReport, ObligationsScanned, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, ProgressWaitRegistry, RetryExecuted, SettlementReached, SubmitRequest, SubmitSucceeded, UnknownResolutionRecorded, VerifiedIntegrity, boundHostDiagnostic, cloudflareWakeSchedulerLayer, conversationNamespaceFromEnv, conversationNamespaceLayer, conversationPortTransportLayer, decodeAbortCommand, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObligationThresholds, decodeObservePageRequest, decodeReceipt, decodeRetryCommand, decodeSubmitRequest, decodeUnknownResolutionCommand, dynamicWorkerCodeExecutorLayer, dynamicWorkerImplementation, encodeAbortCommand, encodeAdminResponse, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, makeConversationObjectClass };
|
|
1646
|
+
export { AbortRecorded, AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, AdmissionLimitExceeded, ApprovalRecorded, AwaitProgressRequest, CLOUDFLARE_DATABASE_CAP_BYTES, CLOUDFLARE_RUNTIME_DEFAULTS, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareAdmissionLimitsValue, CloudflareBindingError, CloudflareBindingSource, CloudflareBindingSourceContext, CloudflareConversationClient, CloudflareDurableRuntime, CloudflareDurableRuntimeConfig, CloudflareDurableRuntimeConfigValue, CloudflareDurableRuntimeInitializationError, CloudflareDurableRuntimeOptions, CloudflareDurableRuntimeServices, CloudflarePlatformConfigError, CloudflareRunContextLayer, CloudflareRunContextSource, CloudflareRuntimeSourceContext, CodeModeHostEntrypoint, CodeModeHostStub, ConversationClientError, ConversationMaintenance, ConversationMaintenanceFailpoint, ConversationMaintenanceFailpointHandler, ConversationMaintenanceFailpointLocation, ConversationObjectClass, ConversationObjectIdentity, ConversationObjectInstance, ConversationObjectNamespace, ConversationObjectOptions, ConversationObjectPorts, ConversationObjectRpc, DEFAULT_MAX_DATABASE_BYTES, DurableAlarmError, DurableAlarmService, DurableObjectContext, DynamicWorkerCodeExecutorOptions, ExplainedRecovery, HostFailed, HostFailure, HostProtocolError, HostResponse, MaintenancePassFailure, MaintenancePassReport, ObligationsScanned, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, ProgressWaitRegistry, RetryExecuted, SettlementReached, SubmitRequest, SubmitSucceeded, UnknownResolutionRecorded, VerifiedIntegrity, boundHostDiagnostic, cloudflareWakeSchedulerLayer, conversationNamespaceFromEnv, conversationNamespaceLayer, conversationPortTransportLayer, decodeAbortCommand, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObligationThresholds, decodeObservePageRequest, decodeReceipt, decodeRetryCommand, decodeSubmitRequest, decodeUnknownResolutionCommand, disposeRpcHandle, dynamicWorkerCodeExecutorLayer, dynamicWorkerImplementation, encodeAbortCommand, encodeAdminResponse, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, makeConversationObjectClass };
|
|
1643
1647
|
//# sourceMappingURL=index.d.mts.map
|