@effect-agent/platform-cloudflare 0.1.0-beta.116 → 0.1.0-beta.118

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.
@@ -497,13 +497,13 @@ export declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCo
497
497
  readonly author: string;
498
498
  readonly reason: string;
499
499
  readonly resolution: {
500
+ readonly _tag: "SafeToRetry";
501
+ } | {
500
502
  readonly _tag: "CompletedWithResult";
501
503
  readonly result: Schema.Json;
502
504
  readonly isFailure: boolean;
503
505
  } | {
504
506
  readonly _tag: "NeverHappened";
505
- } | {
506
- readonly _tag: "SafeToRetry";
507
507
  } | {
508
508
  readonly _tag: "AbortSubmission";
509
509
  };
@@ -674,6 +674,11 @@ export declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorde
674
674
  readonly childSubmissionId: string;
675
675
  readonly childReceiptId: string;
676
676
  readonly childRunId: string;
677
+ } | {
678
+ readonly _tag: "AbortRequested";
679
+ readonly submissionId: string;
680
+ readonly author: string;
681
+ readonly reason: string;
677
682
  } | {
678
683
  readonly _tag: "ThreadCreated";
679
684
  readonly agentId: string;
@@ -952,11 +957,6 @@ export declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorde
952
957
  readonly runDisposition?: Schema.Json | undefined;
953
958
  readonly finishReason?: "budget-exhausted" | undefined;
954
959
  readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
955
- } | {
956
- readonly _tag: "AbortRequested";
957
- readonly submissionId: string;
958
- readonly author: string;
959
- readonly reason: string;
960
960
  } | {
961
961
  readonly _tag: "SubmissionSettled";
962
962
  readonly submissionId: string;
@@ -1524,13 +1524,13 @@ export declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorde
1524
1524
  readonly author: string;
1525
1525
  readonly reason: string;
1526
1526
  readonly resolution: {
1527
+ readonly _tag: "SafeToRetry";
1528
+ } | {
1527
1529
  readonly _tag: "CompletedWithResult";
1528
1530
  readonly result: Schema.Json;
1529
1531
  readonly isFailure: boolean;
1530
1532
  } | {
1531
1533
  readonly _tag: "NeverHappened";
1532
- } | {
1533
- readonly _tag: "SafeToRetry";
1534
1534
  } | {
1535
1535
  readonly _tag: "AbortSubmission";
1536
1536
  };
@@ -1540,16 +1540,31 @@ export declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorde
1540
1540
  } | {
1541
1541
  readonly _tag: "HostFailed";
1542
1542
  readonly failure: {
1543
- readonly _tag: "DurableAlarmError";
1544
- readonly operation: string;
1545
- readonly message: string;
1546
- readonly cause?: Schema.Json | undefined;
1543
+ readonly _tag: "AdmissionConflict";
1544
+ readonly threadId: string;
1545
+ readonly principal: string;
1546
+ readonly idempotencyKey: string;
1547
+ readonly existingInputDigest: string;
1548
+ readonly attemptedInputDigest: string;
1547
1549
  } | {
1548
- readonly _tag: "HostProtocolError";
1549
- readonly message: string;
1550
+ readonly _tag: "AdmissionPolicyError";
1551
+ readonly reason: "occupied" | "refused" | "unavailable";
1552
+ readonly code: string;
1553
+ readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
1554
+ readonly stack?: string | undefined;
1550
1555
  } | {
1551
- readonly _tag: "ThreadNotMaterialized";
1552
- readonly threadId: string;
1556
+ readonly _tag: "SettlementConflict";
1557
+ readonly submissionId: string;
1558
+ readonly existingOutcome: "aborted" | "completed" | "failed";
1559
+ } | {
1560
+ readonly _tag: "JoinedToHost";
1561
+ readonly submissionId: string;
1562
+ readonly hostSubmissionId: string;
1563
+ } | {
1564
+ readonly _tag: "LedgerError";
1565
+ readonly operation: string;
1566
+ readonly message: string;
1567
+ readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
1553
1568
  } | {
1554
1569
  readonly _tag: "ThreadStoreError";
1555
1570
  readonly operation: string;
@@ -1563,10 +1578,8 @@ export declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorde
1563
1578
  readonly sequence?: number | undefined;
1564
1579
  } | undefined;
1565
1580
  } | {
1566
- readonly _tag: "LedgerError";
1567
- readonly operation: string;
1568
- readonly message: string;
1569
- readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
1581
+ readonly _tag: "ThreadNotMaterialized";
1582
+ readonly threadId: string;
1570
1583
  } | {
1571
1584
  readonly _tag: "AppendConflict";
1572
1585
  readonly threadId: string;
@@ -1579,25 +1592,17 @@ export declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorde
1579
1592
  readonly threadId: string;
1580
1593
  readonly actualEpoch: number;
1581
1594
  readonly attemptedEpoch: number;
1595
+ } | {
1596
+ readonly _tag: "DurableAlarmError";
1597
+ readonly operation: string;
1598
+ readonly message: string;
1599
+ readonly cause?: Schema.Json | undefined;
1582
1600
  } | {
1583
1601
  readonly _tag: "OperationDenied";
1584
1602
  readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
1585
1603
  readonly reason: string;
1586
1604
  readonly threadId?: string | undefined;
1587
1605
  readonly submissionId?: string | undefined;
1588
- } | {
1589
- readonly _tag: "AdmissionConflict";
1590
- readonly threadId: string;
1591
- readonly principal: string;
1592
- readonly idempotencyKey: string;
1593
- readonly existingInputDigest: string;
1594
- readonly attemptedInputDigest: string;
1595
- } | {
1596
- readonly _tag: "AdmissionPolicyError";
1597
- readonly reason: "occupied" | "refused" | "unavailable";
1598
- readonly code: string;
1599
- readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
1600
- readonly stack?: string | undefined;
1601
1606
  } | {
1602
1607
  readonly _tag: "AgentInputError";
1603
1608
  readonly message: string;
@@ -1608,19 +1613,14 @@ export declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorde
1608
1613
  } | {
1609
1614
  readonly _tag: "DurableRuntimeFailpointError";
1610
1615
  readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "checkpoint:after-save" | "checkpoint:before-save" | "claim:after-claim" | "compaction:after-canonical-append" | "compaction:before-canonical-append" | "input:after-canonical-append" | "join:after-canonical-append" | "join:after-claim" | "policy:after-reservation-append" | "policy:before-reservation-append" | "resolve:after-intent" | "run:after-duration-append" | "run:after-start-append" | "run:before-duration-append" | "run:before-start-append" | "step:after-step-append" | "subagent:after-admit" | "subagent:after-child-abort-intent" | "subagent:after-child-ready" | "subagent:after-join-append" | "subagent:after-release" | "subagent:after-release-pending" | "subagent:after-request-append" | "subagent:after-reserve" | "subagent:after-sibling-settle" | "subagent:after-start-append" | "subagent:after-suspend" | "subagent:before-join-append" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:after-reserve" | "tools:after-prepared-append" | "tools:after-unavailable-append" | "tools:before-prepared-append" | "tools:before-unavailable-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append" | "update:after-canonical-append" | "update:after-delivery-insert" | "update:before-canonical-append" | "update:before-delivery-insert" | "worker:after-completion-append" | "worker:after-origin-append" | "worker:after-report-append" | "worker:after-report-delivery" | "worker:after-source-append" | "worker:after-stop-append" | "worker:after-stop-seal" | "worker:after-subtree-append" | "worker:before-completion-append" | "worker:before-origin-append" | "worker:before-report-append" | "worker:before-report-delivery" | "worker:before-source-append" | "worker:before-stop-append" | "worker:before-stop-seal" | "worker:before-subtree-append";
1611
- } | {
1612
- readonly _tag: "SettlementConflict";
1613
- readonly submissionId: string;
1614
- readonly existingOutcome: "aborted" | "completed" | "failed";
1615
- } | {
1616
- readonly _tag: "JoinedToHost";
1617
- readonly submissionId: string;
1618
- readonly hostSubmissionId: string;
1619
1616
  } | {
1620
1617
  readonly _tag: "AdmissionLimitExceeded";
1621
1618
  readonly limit: "database-bytes" | "input-bytes" | "queue-depth";
1622
1619
  readonly actual: number;
1623
1620
  readonly maximum: number;
1621
+ } | {
1622
+ readonly _tag: "HostProtocolError";
1623
+ readonly message: string;
1624
1624
  } | {
1625
1625
  readonly _tag: "ApprovalConflict";
1626
1626
  readonly submissionId: string;
@@ -96,7 +96,10 @@ interface BrowserRunProtectedSession {
96
96
  readonly getHandoffState: Effect.Effect<BrowserRunHandoffState, ProtectedBrowserError>;
97
97
  /** Read only the exact page’s current origin after its recorded handoff completes; tools remain paused. */
98
98
  readonly getReturnOrigin: Effect.Effect<typeof CredentialOrigin.Type, ProtectedBrowserError>;
99
- /** Resume a committed pause; human handoffs also require provider completion. Observe before acting. */
99
+ /**
100
+ * Resume a committed pause; human handoffs also require provider completion. Returns no page data.
101
+ * A fresh authorized observation must succeed before page actions or credential operations.
102
+ */
100
103
  readonly returnControl: Effect.Effect<void, ProtectedBrowserError>;
101
104
  /** Release this attachment only after committing its suspended checkpoint; preserve the remote browser. */
102
105
  readonly detach: Effect.Effect<void, ProtectedBrowserError>;
@@ -173,7 +173,7 @@ const makeProtectedBrowserPolicy = Effect.fn("ProtectedBrowser.open")(function*
173
173
  const error = cause.reasons.find((reason) => reason._tag === "Fail" && Schema.is(ProtectedBrowserError)(reason.error));
174
174
  const reason = unexpected.length === 0 && error?._tag === "Fail" && Schema.is(ProtectedBrowserError)(error.error) ? error.error.reason : "provider";
175
175
  const interrupt = cause.reasons.some((reason) => reason._tag === "Interrupt");
176
- if (dispatch !== "not-dispatched" || interrupt || reason === "provider" || reason === "timeout") yield* close;
176
+ if (dispatch === "possibly-dispatched" || dispatch === "dispatched" && reason !== "busy" || interrupt || reason === "provider" || reason === "timeout") yield* close;
177
177
  if (interrupt) return yield* Effect.interrupt;
178
178
  const outcome = fail(dispatch === "possibly-dispatched" && reason === "provider" ? "outcome-unknown" : reason);
179
179
  return yield* unexpected.length > 0 ? reportedBrowserError(outcome) : inheritBrowserReport(error?._tag === "Fail" ? error.error : void 0, outcome);
@@ -422,7 +422,6 @@ const makeProtectedBrowserPolicy = Effect.fn("ProtectedBrowser.open")(function*
422
422
  returnControl: locked(Effect.gen(function* () {
423
423
  if (detached || observation === "closed") return yield* fail("closed");
424
424
  if (!suspended) return yield* fail("denied");
425
- yield* permitObservation;
426
425
  offers.clear();
427
426
  driver.resetReferences();
428
427
  needsObservation = true;