@effect-agent/platform-cloudflare 0.1.0-beta.15 → 0.1.0-beta.17
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 +144 -73
- package/dist/index.mjs +148 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/bindings.ts +4 -0
- package/src/client.ts +150 -2
- package/src/conversation-object.ts +63 -42
- package/src/index.ts +1 -0
- package/src/layers.ts +18 -2
- package/src/progress-wait.ts +103 -0
- package/src/wake-scheduler.ts +5 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
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, OperationDenied, OwnershipLost, ProducerId, Receipt, RecoveryExplanation, RecoveryReport, ResolvedBinding, RetryCommand, RetryRefused, RunJournalError, Settlement, SettlementConflict, SubmissionLedger, ToolReconciler, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, WakeScheduler } from "@effect-agent/session";
|
|
1
|
+
import { Context, Crypto, Effect, Layer, Option, Schema, Scope } from "effect";
|
|
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
3
|
import { ConversationPortTransport, DoStorageFailpointHandler, DoStorageInitializationError } from "@effect-agent/storage-cloudflare";
|
|
4
4
|
import { AgentInputError, ConversationId } from "@effect-agent/core";
|
|
5
5
|
import { DurableObjectState as DurableObjectState$1, WorkerEnvironment } from "effect-cf";
|
|
@@ -31,6 +31,10 @@ interface ConversationObjectRpc extends Rpc.DurableObjectBranded {
|
|
|
31
31
|
submitEncoded(encoded: unknown): Promise<unknown>;
|
|
32
32
|
/** Wake-hinted, poll-guaranteed settlement wait; answers an `AwaitSettlementResponse`. */
|
|
33
33
|
awaitSettlementEncoded(encoded: unknown): Promise<unknown>;
|
|
34
|
+
/** Event-driven durable progress wait; answers a `ProgressObserved` host response. */
|
|
35
|
+
awaitProgressEncoded(encoded: unknown): Promise<unknown>;
|
|
36
|
+
/** Best-effort cancellation for one in-flight progress wait. */
|
|
37
|
+
cancelProgressEncoded(encoded: unknown): Promise<unknown>;
|
|
34
38
|
/** One bounded page of canonical records; answers an `ObservePageResponse`. */
|
|
35
39
|
observePage(encoded: unknown): Promise<unknown>;
|
|
36
40
|
/** Durable abort intent; answers an `AbortResponse`. */
|
|
@@ -307,6 +311,22 @@ declare class ConversationMaintenance extends ConversationMaintenance_base {
|
|
|
307
311
|
*/
|
|
308
312
|
declare const cloudflareWakeSchedulerLayer: Layer.Layer<WakeScheduler, never, DurableAlarmService | ConversationObjectIdentity | ConversationObjectNamespace>;
|
|
309
313
|
//#endregion
|
|
314
|
+
//#region src/progress-wait.d.ts
|
|
315
|
+
declare const ProgressWaitRegistry_base: Context.ServiceClass<ProgressWaitRegistry, "@effect-agent/platform-cloudflare/ProgressWaitRegistry", {
|
|
316
|
+
/** Register a Scope-owned cancellation signal, observing any early cancel tombstone. */
|
|
317
|
+
readonly subscribe: (waiterId: string) => Effect.Effect<Effect.Effect<void>, never, Scope.Scope>;
|
|
318
|
+
/** Cancel a registered waiter, or remember a bounded early cancellation. */
|
|
319
|
+
readonly cancel: (waiterId: string) => Effect.Effect<void>;
|
|
320
|
+
}>;
|
|
321
|
+
/**
|
|
322
|
+
* Per-incarnation cancellation registry for long-lived progress RPCs. The public runtime owns
|
|
323
|
+
* the actual wake registration; this host-only registry lets an interrupted Worker Effect ask
|
|
324
|
+
* the Object to interrupt its scoped wait before the Worker execution context itself ends.
|
|
325
|
+
*/
|
|
326
|
+
declare class ProgressWaitRegistry extends ProgressWaitRegistry_base {
|
|
327
|
+
static readonly layer: Layer.Layer<ProgressWaitRegistry>;
|
|
328
|
+
}
|
|
329
|
+
//#endregion
|
|
310
330
|
//#region src/transport.d.ts
|
|
311
331
|
/**
|
|
312
332
|
* `ConversationPortTransport` over native Durable Object JS RPC (decision D-P6-3): one
|
|
@@ -370,6 +390,8 @@ interface CloudflareDurableRuntimeOptions {
|
|
|
370
390
|
readonly runtimeFailpoint?: ((ctx: DurableObjectState) => DurableRuntimeFailpointHandler) | undefined;
|
|
371
391
|
/** Conversation-maintenance generation/alarm fault injection; default none. */
|
|
372
392
|
readonly maintenanceFailpoint?: ((ctx: DurableObjectState) => ConversationMaintenanceFailpointHandler) | undefined;
|
|
393
|
+
/** Host-supplied fail-closed authorization policy; defaults to service possession. */
|
|
394
|
+
readonly operationAuthorizer?: OperationAuthorizerService | undefined;
|
|
373
395
|
/**
|
|
374
396
|
* Reconciliation policy consulted for open ordinary Tool Calls before an Unknown Outcome
|
|
375
397
|
* is recorded (durability §10, DUR-009). Defaults to the fail-closed
|
|
@@ -400,7 +422,7 @@ type CloudflareBindingSource = ReadonlyArray<ResolvedBinding> | Effect.Effect<Re
|
|
|
400
422
|
/** Every construction failure of the assembled Cloudflare durable runtime stack. */
|
|
401
423
|
type CloudflareDurableRuntimeInitializationError = CloudflarePlatformConfigError | DoStorageInitializationError;
|
|
402
424
|
/** The services `CloudflareDurableRuntime.layer` provides. */
|
|
403
|
-
type CloudflareDurableRuntimeServices = DurableAgentRuntime | SubmissionLedger | ConversationStore | WakeScheduler | DurableRuntimeConfig | AgentBindingResolver | CloudflareDurableRuntimeConfig | ConversationObjectIdentity | DurableAlarmService | ConversationMaintenance | ConversationObjectPorts;
|
|
425
|
+
type CloudflareDurableRuntimeServices = DurableAgentRuntime | SubmissionLedger | ConversationStore | WakeScheduler | DurableRuntimeConfig | AgentBindingResolver | CloudflareDurableRuntimeConfig | ConversationObjectIdentity | DurableAlarmService | ConversationMaintenance | ConversationObjectPorts | ProgressWaitRegistry;
|
|
404
426
|
declare const ConversationObjectPorts_base: Context.ServiceClass<ConversationObjectPorts, "@effect-agent/platform-cloudflare/ConversationObjectPorts", {
|
|
405
427
|
readonly handle: (encoded: unknown) => Effect.Effect<unknown>;
|
|
406
428
|
}>;
|
|
@@ -447,6 +469,10 @@ declare const ConversationClientError_base: Schema.Class<ConversationClientError
|
|
|
447
469
|
readonly conversationId: Schema.String;
|
|
448
470
|
readonly message: Schema.String;
|
|
449
471
|
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
472
|
+
/** Cloudflare's own classification for a failure safe to retry with a fresh stub. */
|
|
473
|
+
readonly retryable: Schema.optionalKey<Schema.Boolean>;
|
|
474
|
+
/** Cloudflare overloads are surfaced immediately instead of adding retry pressure. */
|
|
475
|
+
readonly overloaded: Schema.optionalKey<Schema.Boolean>;
|
|
450
476
|
}>, import("effect/Cause").YieldableError>;
|
|
451
477
|
/** The Worker-side stub call itself failed (RPC rejection, overload, eviction mid-call). */
|
|
452
478
|
declare class ConversationClientError extends ConversationClientError_base {}
|
|
@@ -470,13 +496,24 @@ declare const ObservePageRequest_base: Schema.Class<ObservePageRequest, Schema.S
|
|
|
470
496
|
}>, {}>;
|
|
471
497
|
/** One bounded page of canonical records after an optional sequence. */
|
|
472
498
|
declare class ObservePageRequest extends ObservePageRequest_base {}
|
|
499
|
+
declare const AwaitProgressRequest_base: Schema.Class<AwaitProgressRequest, Schema.Struct<{
|
|
500
|
+
readonly afterSequence: Schema.brand<Schema.Natural, "@effect-agent/session/CanonicalSequence">;
|
|
501
|
+
readonly waiterId: Schema.String;
|
|
502
|
+
}>, {}>;
|
|
503
|
+
/** One event-driven wait for canonical progress strictly after this sequence. */
|
|
504
|
+
declare class AwaitProgressRequest extends AwaitProgressRequest_base {}
|
|
505
|
+
declare const CancelProgressRequest_base: Schema.Class<CancelProgressRequest, Schema.Struct<{
|
|
506
|
+
readonly waiterId: Schema.String;
|
|
507
|
+
}>, {}>;
|
|
508
|
+
/** Best-effort cancellation of one in-flight progress RPC. */
|
|
509
|
+
declare class CancelProgressRequest extends CancelProgressRequest_base {}
|
|
473
510
|
/**
|
|
474
511
|
* Every typed failure a host entry point can produce, plus the protocol's own errors. Same
|
|
475
512
|
* closed-union discipline as the WP2 `PortFailure`: members re-decode to the SAME tagged
|
|
476
513
|
* classes on the Worker side; `cause` chains travel as Schema defects without instance
|
|
477
514
|
* fidelity (plan §2.8).
|
|
478
515
|
*/
|
|
479
|
-
declare const HostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof HostProtocolError]>;
|
|
516
|
+
declare const HostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
|
|
480
517
|
type HostFailure = typeof HostFailure.Type;
|
|
481
518
|
declare const SubmitSucceeded_base: Schema.Class<SubmitSucceeded, Schema.TaggedStruct<"SubmitSucceeded", {
|
|
482
519
|
readonly receipt: typeof Receipt;
|
|
@@ -490,6 +527,11 @@ declare const ObservedPage_base: Schema.Class<ObservedPage, Schema.TaggedStruct<
|
|
|
490
527
|
readonly records: Schema.$Array<typeof CanonicalRecordEnvelope>;
|
|
491
528
|
}>, {}>;
|
|
492
529
|
declare class ObservedPage extends ObservedPage_base {}
|
|
530
|
+
declare const ProgressObserved_base: Schema.Class<ProgressObserved, Schema.TaggedStruct<"ProgressObserved", {}>, {}>;
|
|
531
|
+
/** A record was already committed or an incarnation-local hint says the caller should re-read. */
|
|
532
|
+
declare class ProgressObserved extends ProgressObserved_base {}
|
|
533
|
+
declare const ProgressCancelled_base: Schema.Class<ProgressCancelled, Schema.TaggedStruct<"ProgressCancelled", {}>, {}>;
|
|
534
|
+
declare class ProgressCancelled extends ProgressCancelled_base {}
|
|
493
535
|
declare const AbortRecorded_base: Schema.Class<AbortRecorded, Schema.TaggedStruct<"AbortRecorded", {
|
|
494
536
|
readonly intent: typeof AbortIntent;
|
|
495
537
|
}>, {}>;
|
|
@@ -503,12 +545,12 @@ declare const UnknownResolutionRecorded_base: Schema.Class<UnknownResolutionReco
|
|
|
503
545
|
}>, {}>;
|
|
504
546
|
declare class UnknownResolutionRecorded extends UnknownResolutionRecorded_base {}
|
|
505
547
|
declare const HostFailed_base: Schema.Class<HostFailed, Schema.TaggedStruct<"HostFailed", {
|
|
506
|
-
readonly failure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof HostProtocolError]>;
|
|
548
|
+
readonly failure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
|
|
507
549
|
}>, {}>;
|
|
508
550
|
/** The entry point failed TYPED on the Object; the failure re-decodes verbatim. */
|
|
509
551
|
declare class HostFailed extends HostFailed_base {}
|
|
510
552
|
/** The uniform answer of one host entry point. Callers narrow by the tag their call implies. */
|
|
511
|
-
declare const HostResponse: Schema.Union<readonly [typeof SubmitSucceeded, typeof SettlementReached, typeof ObservedPage, typeof AbortRecorded, typeof ApprovalRecorded, typeof UnknownResolutionRecorded, typeof HostFailed]>;
|
|
553
|
+
declare const HostResponse: Schema.Union<readonly [typeof SubmitSucceeded, typeof SettlementReached, typeof ObservedPage, typeof ProgressObserved, typeof ProgressCancelled, typeof AbortRecorded, typeof ApprovalRecorded, typeof UnknownResolutionRecorded, typeof HostFailed]>;
|
|
512
554
|
type HostResponse = typeof HostResponse.Type;
|
|
513
555
|
declare const decodeSubmitRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<SubmitRequest, Schema.SchemaError, never>;
|
|
514
556
|
declare const encodeSubmitRequest: (input: SubmitRequest, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
|
|
@@ -534,6 +576,15 @@ declare const encodeObservePageRequest: (input: ObservePageRequest, options?: im
|
|
|
534
576
|
readonly afterSequence?: number | undefined;
|
|
535
577
|
readonly limit: number;
|
|
536
578
|
}, Schema.SchemaError, never>;
|
|
579
|
+
declare const decodeAwaitProgressRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AwaitProgressRequest, Schema.SchemaError, never>;
|
|
580
|
+
declare const encodeAwaitProgressRequest: (input: AwaitProgressRequest, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
|
|
581
|
+
readonly afterSequence: number;
|
|
582
|
+
readonly waiterId: string;
|
|
583
|
+
}, Schema.SchemaError, never>;
|
|
584
|
+
declare const decodeCancelProgressRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<CancelProgressRequest, Schema.SchemaError, never>;
|
|
585
|
+
declare const encodeCancelProgressRequest: (input: CancelProgressRequest, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
|
|
586
|
+
readonly waiterId: string;
|
|
587
|
+
}, Schema.SchemaError, never>;
|
|
537
588
|
declare const decodeAbortCommand: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AbortCommand, Schema.SchemaError, never>;
|
|
538
589
|
declare const encodeAbortCommand: (input: AbortCommand, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
|
|
539
590
|
readonly submissionId: string;
|
|
@@ -566,7 +617,7 @@ declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCommand,
|
|
|
566
617
|
readonly _tag: "AbortSubmission";
|
|
567
618
|
};
|
|
568
619
|
}, Schema.SchemaError, never>;
|
|
569
|
-
declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | SettlementReached | SubmitSucceeded | UnknownResolutionRecorded, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
|
|
620
|
+
declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SubmitSucceeded | UnknownResolutionRecorded, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
|
|
570
621
|
readonly _tag: "SubmitSucceeded";
|
|
571
622
|
readonly receipt: {
|
|
572
623
|
readonly receiptId: string;
|
|
@@ -581,6 +632,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
581
632
|
readonly settlementId: string;
|
|
582
633
|
readonly receiptId: string;
|
|
583
634
|
readonly outcome: "aborted" | "completed" | "failed";
|
|
635
|
+
readonly runDisposition?: Schema.Json | undefined;
|
|
584
636
|
readonly settledAt: string;
|
|
585
637
|
};
|
|
586
638
|
} | {
|
|
@@ -597,42 +649,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
597
649
|
readonly createdAt: string;
|
|
598
650
|
readonly deploymentId: string;
|
|
599
651
|
readonly payload: {
|
|
600
|
-
readonly _tag: "ToolCallPrepared";
|
|
601
|
-
readonly runId: string;
|
|
602
|
-
readonly turnId: string;
|
|
603
|
-
readonly turn: number;
|
|
604
|
-
readonly toolCallId: string;
|
|
605
|
-
readonly toolName: string;
|
|
606
|
-
readonly parameters: Schema.Json;
|
|
607
|
-
readonly parametersDigest: string;
|
|
608
|
-
} | {
|
|
609
|
-
readonly _tag: "ToolCallUnknown";
|
|
610
|
-
readonly runId: string;
|
|
611
|
-
readonly turn: number;
|
|
612
|
-
readonly toolCallId: string;
|
|
613
|
-
readonly toolName: string;
|
|
614
|
-
readonly reason: string;
|
|
615
|
-
} | {
|
|
616
|
-
readonly _tag: "ToolApprovalDecided";
|
|
617
|
-
readonly runId: string;
|
|
618
|
-
readonly turn: number;
|
|
619
|
-
readonly toolCallId: string;
|
|
620
|
-
readonly decision: "approved" | "denied";
|
|
621
|
-
readonly resolver: string;
|
|
622
|
-
readonly reason: string;
|
|
623
|
-
} | {
|
|
624
|
-
readonly _tag: "ToolCallResolved";
|
|
625
|
-
readonly runId: string;
|
|
626
|
-
readonly toolCallId: string;
|
|
627
|
-
readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
|
|
628
|
-
readonly author: string;
|
|
629
|
-
readonly reason: string;
|
|
630
|
-
} | {
|
|
631
|
-
readonly _tag: "AbortRequested";
|
|
632
|
-
readonly submissionId: string;
|
|
633
|
-
readonly author: string;
|
|
634
|
-
readonly reason: string;
|
|
635
|
-
} | {
|
|
636
652
|
readonly _tag: "ConversationCreated";
|
|
637
653
|
readonly agentId: string;
|
|
638
654
|
readonly definitions: {
|
|
@@ -660,6 +676,15 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
660
676
|
readonly inputTokens?: number | undefined;
|
|
661
677
|
readonly outputTokens?: number | undefined;
|
|
662
678
|
readonly costMicrousd?: number | undefined;
|
|
679
|
+
} | {
|
|
680
|
+
readonly _tag: "ToolCallPrepared";
|
|
681
|
+
readonly runId: string;
|
|
682
|
+
readonly turnId: string;
|
|
683
|
+
readonly turn: number;
|
|
684
|
+
readonly toolCallId: string;
|
|
685
|
+
readonly toolName: string;
|
|
686
|
+
readonly parameters: Schema.Json;
|
|
687
|
+
readonly parametersDigest: string;
|
|
663
688
|
} | {
|
|
664
689
|
readonly _tag: "ToolCallSettled";
|
|
665
690
|
readonly runId: string;
|
|
@@ -667,6 +692,20 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
667
692
|
readonly toolName: string;
|
|
668
693
|
readonly result: Schema.Json;
|
|
669
694
|
readonly isFailure: boolean;
|
|
695
|
+
} | {
|
|
696
|
+
readonly _tag: "ToolCallUnknown";
|
|
697
|
+
readonly runId: string;
|
|
698
|
+
readonly turn: number;
|
|
699
|
+
readonly toolCallId: string;
|
|
700
|
+
readonly toolName: string;
|
|
701
|
+
readonly reason: string;
|
|
702
|
+
} | {
|
|
703
|
+
readonly _tag: "ToolCallResolved";
|
|
704
|
+
readonly runId: string;
|
|
705
|
+
readonly toolCallId: string;
|
|
706
|
+
readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
|
|
707
|
+
readonly author: string;
|
|
708
|
+
readonly reason: string;
|
|
670
709
|
} | {
|
|
671
710
|
readonly _tag: "ToolStepSettled";
|
|
672
711
|
readonly runId: string;
|
|
@@ -682,6 +721,14 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
682
721
|
readonly toolCallId: string;
|
|
683
722
|
readonly toolName: string;
|
|
684
723
|
readonly parametersDigest: string;
|
|
724
|
+
} | {
|
|
725
|
+
readonly _tag: "ToolApprovalDecided";
|
|
726
|
+
readonly runId: string;
|
|
727
|
+
readonly turn: number;
|
|
728
|
+
readonly toolCallId: string;
|
|
729
|
+
readonly decision: "approved" | "denied";
|
|
730
|
+
readonly resolver: string;
|
|
731
|
+
readonly reason: string;
|
|
685
732
|
} | {
|
|
686
733
|
readonly _tag: "ModelResponseInterrupted";
|
|
687
734
|
readonly runId: string;
|
|
@@ -703,6 +750,11 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
703
750
|
readonly _tag: "RunCompleted";
|
|
704
751
|
readonly runId: string;
|
|
705
752
|
readonly output: Schema.Json;
|
|
753
|
+
} | {
|
|
754
|
+
readonly _tag: "AbortRequested";
|
|
755
|
+
readonly submissionId: string;
|
|
756
|
+
readonly author: string;
|
|
757
|
+
readonly reason: string;
|
|
706
758
|
} | {
|
|
707
759
|
readonly _tag: "SubmissionSettled";
|
|
708
760
|
readonly submissionId: string;
|
|
@@ -711,6 +763,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
711
763
|
readonly outcome: "aborted" | "completed" | "failed";
|
|
712
764
|
readonly runId?: string | undefined;
|
|
713
765
|
readonly result?: Schema.Json | undefined;
|
|
766
|
+
readonly runDisposition?: Schema.Json | undefined;
|
|
714
767
|
readonly finishReason?: "budget-exhausted" | undefined;
|
|
715
768
|
readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
|
|
716
769
|
readonly policyLimit?: "cost" | "duration" | "repeated-failures" | "tokens" | "tool-calls" | "turns" | "usage" | undefined;
|
|
@@ -780,6 +833,10 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
780
833
|
};
|
|
781
834
|
};
|
|
782
835
|
}[];
|
|
836
|
+
} | {
|
|
837
|
+
readonly _tag: "ProgressObserved";
|
|
838
|
+
} | {
|
|
839
|
+
readonly _tag: "ProgressCancelled";
|
|
783
840
|
} | {
|
|
784
841
|
readonly _tag: "AbortRecorded";
|
|
785
842
|
readonly intent: {
|
|
@@ -895,21 +952,33 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
|
|
|
895
952
|
readonly operation: string;
|
|
896
953
|
readonly message: string;
|
|
897
954
|
readonly cause?: Schema.Json | undefined;
|
|
955
|
+
} | {
|
|
956
|
+
readonly _tag: "OperationDenied";
|
|
957
|
+
readonly operation: "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
|
|
958
|
+
readonly reason: string;
|
|
959
|
+
readonly conversationId?: string | undefined;
|
|
960
|
+
readonly submissionId?: string | undefined;
|
|
898
961
|
};
|
|
899
962
|
}, Schema.SchemaError, never>;
|
|
900
|
-
declare const decodeHostResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | SettlementReached | SubmitSucceeded | UnknownResolutionRecorded, Schema.SchemaError, never>;
|
|
963
|
+
declare const decodeHostResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SubmitSucceeded | UnknownResolutionRecorded, Schema.SchemaError, never>;
|
|
901
964
|
/** Failure surface of `CloudflareConversationClient.submit`. */
|
|
902
965
|
type ClientSubmitFailure = AgentInputError | DigestError | AdmissionConflict | LedgerError | ConversationStoreError | ConversationNotMaterialized | AppendConflict | FenceRejected | DurableRuntimeFailpointError | AdmissionLimitExceeded | DurableAlarmError | HostProtocolError | ConversationClientError;
|
|
903
966
|
type ClientAwaitFailure = LedgerError | SettlementConflict | HostProtocolError | ConversationClientError;
|
|
904
|
-
type ClientObserveFailure = ConversationStoreError | ConversationNotMaterialized | HostProtocolError | ConversationClientError;
|
|
967
|
+
type ClientObserveFailure = ConversationStoreError | ConversationNotMaterialized | OperationDenied | HostProtocolError | ConversationClientError;
|
|
968
|
+
type ClientProgressFailure = ConversationStoreError | ConversationNotMaterialized | OperationDenied | HostProtocolError | ConversationClientError;
|
|
905
969
|
type ClientAbortFailure = LedgerError | SettlementConflict | JoinedToHost | DurableRuntimeFailpointError | DurableAlarmError | HostProtocolError | ConversationClientError;
|
|
906
|
-
type ClientApprovalFailure = LedgerError | SettlementConflict | ApprovalConflict | DurableAlarmError | HostProtocolError | ConversationClientError;
|
|
907
|
-
type ClientUnknownFailure = LedgerError | SettlementConflict | UnknownResolutionConflict | JoinedToHost | DurableRuntimeFailpointError | DurableAlarmError | HostProtocolError | ConversationClientError;
|
|
970
|
+
type ClientApprovalFailure = LedgerError | SettlementConflict | ApprovalConflict | OperationDenied | DurableAlarmError | HostProtocolError | ConversationClientError;
|
|
971
|
+
type ClientUnknownFailure = LedgerError | SettlementConflict | UnknownResolutionConflict | JoinedToHost | DurableRuntimeFailpointError | OperationDenied | DurableAlarmError | HostProtocolError | ConversationClientError;
|
|
908
972
|
declare const CloudflareConversationClient_base: Context.ServiceClass<CloudflareConversationClient, "@effect-agent/platform-cloudflare/CloudflareConversationClient", {
|
|
909
973
|
/** Encode the input client-side, then durably submit to the owning Object. */
|
|
910
974
|
readonly submit: <InputSchema extends Schema.Top>(agent: DurableSubmitAgent<InputSchema>, input: InputSchema["Type"], options: DurableSubmitOptions) => Effect.Effect<Receipt, ClientSubmitFailure, InputSchema["EncodingServices"]>;
|
|
911
975
|
/** Wake-hinted, poll-guaranteed settlement wait executed inside the owning Object. */
|
|
912
976
|
readonly awaitSettlement: (receipt: Receipt) => Effect.Effect<Settlement, ClientAwaitFailure>;
|
|
977
|
+
/**
|
|
978
|
+
* Wait without polling until progress after `afterSequence` is already durable or hinted.
|
|
979
|
+
* The result is deliberately void: canonical records remain authoritative and must be read.
|
|
980
|
+
*/
|
|
981
|
+
readonly awaitProgress: (conversationId: ConversationId, afterSequence: CanonicalSequence) => Effect.Effect<void, ClientProgressFailure>;
|
|
913
982
|
/** One bounded page of canonical records. */
|
|
914
983
|
readonly readPage: (conversationId: ConversationId, options?: {
|
|
915
984
|
readonly afterSequence?: CanonicalSequence | undefined;
|
|
@@ -932,7 +1001,7 @@ declare const CloudflareConversationClient_base: Context.ServiceClass<Cloudflare
|
|
|
932
1001
|
}>;
|
|
933
1002
|
/** Worker-side client over the Conversation Object namespace (DEPLOY-010). */
|
|
934
1003
|
declare class CloudflareConversationClient extends CloudflareConversationClient_base {
|
|
935
|
-
static readonly layer: Layer.Layer<CloudflareConversationClient, never, ConversationObjectNamespace>;
|
|
1004
|
+
static readonly layer: Layer.Layer<CloudflareConversationClient, never, ConversationObjectNamespace | Crypto.Crypto>;
|
|
936
1005
|
}
|
|
937
1006
|
//#endregion
|
|
938
1007
|
//#region src/conversation-object.d.ts
|
|
@@ -1411,21 +1480,38 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
1411
1480
|
} | {
|
|
1412
1481
|
readonly _tag: "AdminFailed";
|
|
1413
1482
|
readonly failure: {
|
|
1414
|
-
readonly _tag: "
|
|
1483
|
+
readonly _tag: "OperationDenied";
|
|
1484
|
+
readonly operation: "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
|
|
1485
|
+
readonly reason: string;
|
|
1486
|
+
readonly conversationId?: string | undefined;
|
|
1487
|
+
readonly submissionId?: string | undefined;
|
|
1488
|
+
} | {
|
|
1489
|
+
readonly _tag: "RetryRefused";
|
|
1490
|
+
readonly submissionId: string;
|
|
1491
|
+
readonly refusal: "await-approval-decision" | "await-unknown-resolution" | "settled";
|
|
1492
|
+
readonly decisionTag: string;
|
|
1415
1493
|
readonly message: string;
|
|
1494
|
+
} | {
|
|
1495
|
+
readonly _tag: "LedgerError";
|
|
1496
|
+
readonly operation: string;
|
|
1497
|
+
readonly message: string;
|
|
1498
|
+
readonly cause?: Schema.Json | undefined;
|
|
1499
|
+
} | {
|
|
1500
|
+
readonly _tag: "RunJournalError";
|
|
1501
|
+
readonly message: string;
|
|
1502
|
+
readonly cause?: Schema.Json | undefined;
|
|
1416
1503
|
} | {
|
|
1417
1504
|
readonly _tag: "DigestError";
|
|
1418
1505
|
readonly message: string;
|
|
1419
1506
|
readonly cause?: Schema.Json | undefined;
|
|
1507
|
+
} | {
|
|
1508
|
+
readonly _tag: "OwnershipLost";
|
|
1509
|
+
readonly submissionId: string;
|
|
1510
|
+
readonly actualEpoch: number;
|
|
1420
1511
|
} | {
|
|
1421
1512
|
readonly _tag: "SettlementConflict";
|
|
1422
1513
|
readonly submissionId: string;
|
|
1423
1514
|
readonly existingOutcome: "aborted" | "completed" | "failed";
|
|
1424
|
-
} | {
|
|
1425
|
-
readonly _tag: "LedgerError";
|
|
1426
|
-
readonly operation: string;
|
|
1427
|
-
readonly message: string;
|
|
1428
|
-
readonly cause?: Schema.Json | undefined;
|
|
1429
1515
|
} | {
|
|
1430
1516
|
readonly _tag: "ConversationStoreError";
|
|
1431
1517
|
readonly operation: string;
|
|
@@ -1455,25 +1541,8 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
1455
1541
|
readonly message: string;
|
|
1456
1542
|
readonly cause?: Schema.Json | undefined;
|
|
1457
1543
|
} | {
|
|
1458
|
-
readonly _tag: "
|
|
1459
|
-
readonly operation: "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
|
|
1460
|
-
readonly reason: string;
|
|
1461
|
-
readonly conversationId?: string | undefined;
|
|
1462
|
-
readonly submissionId?: string | undefined;
|
|
1463
|
-
} | {
|
|
1464
|
-
readonly _tag: "RetryRefused";
|
|
1465
|
-
readonly submissionId: string;
|
|
1466
|
-
readonly refusal: "await-approval-decision" | "await-unknown-resolution" | "settled";
|
|
1467
|
-
readonly decisionTag: string;
|
|
1468
|
-
readonly message: string;
|
|
1469
|
-
} | {
|
|
1470
|
-
readonly _tag: "RunJournalError";
|
|
1544
|
+
readonly _tag: "HostProtocolError";
|
|
1471
1545
|
readonly message: string;
|
|
1472
|
-
readonly cause?: Schema.Json | undefined;
|
|
1473
|
-
} | {
|
|
1474
|
-
readonly _tag: "OwnershipLost";
|
|
1475
|
-
readonly submissionId: string;
|
|
1476
|
-
readonly actualEpoch: number;
|
|
1477
1546
|
};
|
|
1478
1547
|
}, Schema.SchemaError, never>;
|
|
1479
1548
|
declare const decodeAdminResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AdminFailed | ExplainedRecovery | ObligationsScanned | RetryExecuted | VerifiedIntegrity, Schema.SchemaError, never>;
|
|
@@ -1481,6 +1550,8 @@ declare const decodeAdminResponse: (input: unknown, options?: import("effect/Sch
|
|
|
1481
1550
|
interface ConversationObjectInstance extends DurableObject$1 {
|
|
1482
1551
|
submitEncoded(encoded: unknown): Promise<unknown>;
|
|
1483
1552
|
awaitSettlementEncoded(encoded: unknown): Promise<unknown>;
|
|
1553
|
+
awaitProgressEncoded(encoded: unknown): Promise<unknown>;
|
|
1554
|
+
cancelProgressEncoded(encoded: unknown): Promise<unknown>;
|
|
1484
1555
|
observePage(encoded: unknown): Promise<unknown>;
|
|
1485
1556
|
abortEncoded(encoded: unknown): Promise<unknown>;
|
|
1486
1557
|
resolveApprovalEncoded(encoded: unknown): Promise<unknown>;
|
|
@@ -1549,5 +1620,5 @@ interface DynamicWorkerCodeExecutorOptions {
|
|
|
1549
1620
|
/** Layer building the Dynamic Worker `CodeExecutor` from resolved bindings. */
|
|
1550
1621
|
declare const dynamicWorkerCodeExecutorLayer: (options: DynamicWorkerCodeExecutorOptions) => Layer.Layer<CodeExecutor>;
|
|
1551
1622
|
//#endregion
|
|
1552
|
-
export { AbortRecorded, AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, AdmissionLimitExceeded, ApprovalRecorded, CLOUDFLARE_DATABASE_CAP_BYTES, CLOUDFLARE_RUNTIME_DEFAULTS, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareAdmissionLimitsValue, CloudflareBindingError, CloudflareBindingSource, CloudflareBindingSourceContext, CloudflareConversationClient, CloudflareDurableRuntime, CloudflareDurableRuntimeConfig, CloudflareDurableRuntimeConfigValue, CloudflareDurableRuntimeInitializationError, CloudflareDurableRuntimeOptions, CloudflareDurableRuntimeServices, CloudflarePlatformConfigError, 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, RetryExecuted, SettlementReached, SubmitRequest, SubmitSucceeded, UnknownResolutionRecorded, VerifiedIntegrity, boundHostDiagnostic, cloudflareWakeSchedulerLayer, conversationNamespaceFromEnv, conversationNamespaceLayer, conversationPortTransportLayer, decodeAbortCommand, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeApprovalDecisionCommand, decodeHostResponse, decodeObligationThresholds, decodeObservePageRequest, decodeReceipt, decodeRetryCommand, decodeSubmitRequest, decodeUnknownResolutionCommand, dynamicWorkerCodeExecutorLayer, dynamicWorkerImplementation, encodeAbortCommand, encodeAdminResponse, encodeApprovalDecisionCommand, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, makeConversationObjectClass };
|
|
1623
|
+
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, 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 };
|
|
1553
1624
|
//# sourceMappingURL=index.d.mts.map
|