@yielded/agent-platform-cloudflare 0.0.0-stage → 0.1.0-beta.166

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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Alarm-B0ODr1NE.mjs +1738 -0
  3. package/dist/Alarm-B0ODr1NE.mjs.map +1 -0
  4. package/dist/Alarm.d.mts +267 -0
  5. package/dist/Alarm.mjs +2 -0
  6. package/dist/BrowserCredentials.d.mts +91 -0
  7. package/dist/BrowserCredentials.mjs +120 -0
  8. package/dist/BrowserCredentials.mjs.map +1 -0
  9. package/dist/BrowserRestCapture.d.mts +34 -0
  10. package/dist/BrowserRestCapture.mjs +238 -0
  11. package/dist/BrowserRestCapture.mjs.map +1 -0
  12. package/dist/BrowserRestCrawl.d.mts +16 -0
  13. package/dist/BrowserRestCrawl.mjs +244 -0
  14. package/dist/BrowserRestCrawl.mjs.map +1 -0
  15. package/dist/BrowserSession-B969Xg-2.d.mts +132 -0
  16. package/dist/BrowserSession-RfIzxGCH.mjs +515 -0
  17. package/dist/BrowserSession-RfIzxGCH.mjs.map +1 -0
  18. package/dist/BrowserSession.d.mts +3 -0
  19. package/dist/BrowserSession.mjs +4 -0
  20. package/dist/CloudflareAiGateway.d.mts +64 -0
  21. package/dist/CloudflareAiGateway.mjs +70 -0
  22. package/dist/CloudflareAiGateway.mjs.map +1 -0
  23. package/dist/CloudflareBindings.d.mts +115 -0
  24. package/dist/CloudflareBindings.mjs +113 -0
  25. package/dist/CloudflareBindings.mjs.map +1 -0
  26. package/dist/CloudflareBrowser-5an6m-Qb.mjs +495 -0
  27. package/dist/CloudflareBrowser-5an6m-Qb.mjs.map +1 -0
  28. package/dist/CloudflareBrowser-gu7gma0Y.d.mts +80 -0
  29. package/dist/CloudflareBrowser.d.mts +2 -0
  30. package/dist/CloudflareBrowser.mjs +2 -0
  31. package/dist/CloudflareCodeMode.d.mts +44 -0
  32. package/dist/CloudflareCodeMode.mjs +616 -0
  33. package/dist/CloudflareCodeMode.mjs.map +1 -0
  34. package/dist/CloudflareConfig-qDrRLofL.d.mts +100 -0
  35. package/dist/CloudflareConfig.d.mts +2 -0
  36. package/dist/CloudflareConfig.mjs +122 -0
  37. package/dist/CloudflareConfig.mjs.map +1 -0
  38. package/dist/CloudflareMemory.d.mts +142 -0
  39. package/dist/CloudflareMemory.mjs +202 -0
  40. package/dist/CloudflareMemory.mjs.map +1 -0
  41. package/dist/CloudflareScheduling.d.mts +52 -0
  42. package/dist/CloudflareScheduling.mjs +396 -0
  43. package/dist/CloudflareScheduling.mjs.map +1 -0
  44. package/dist/CloudflareSubscriptions.d.mts +87 -0
  45. package/dist/CloudflareSubscriptions.mjs +529 -0
  46. package/dist/CloudflareSubscriptions.mjs.map +1 -0
  47. package/dist/CloudflareThreadClient.d.mts +1796 -0
  48. package/dist/CloudflareThreadClient.mjs +382 -0
  49. package/dist/CloudflareThreadClient.mjs.map +1 -0
  50. package/dist/InteractiveBrowser-BbG3kGA9.mjs +1934 -0
  51. package/dist/InteractiveBrowser-BbG3kGA9.mjs.map +1 -0
  52. package/dist/InteractiveBrowser-wV2Bti5e.d.mts +228 -0
  53. package/dist/InteractiveBrowser.d.mts +2 -0
  54. package/dist/InteractiveBrowser.mjs +2 -0
  55. package/dist/ThreadObject-BcfXbzSO.d.mts +867 -0
  56. package/dist/ThreadObject-DHjrnlX4.mjs +937 -0
  57. package/dist/ThreadObject-DHjrnlX4.mjs.map +1 -0
  58. package/dist/ThreadObject.d.mts +2 -0
  59. package/dist/ThreadObject.mjs +3 -0
  60. package/dist/WakeScheduler.d.mts +23 -0
  61. package/dist/WakeScheduler.mjs +57 -0
  62. package/dist/WakeScheduler.mjs.map +1 -0
  63. package/dist/boundary-BguazVkh.mjs +42 -0
  64. package/dist/boundary-BguazVkh.mjs.map +1 -0
  65. package/dist/index.d.mts +15 -0
  66. package/dist/index.mjs +15 -0
  67. package/dist/prepared-admission-DMX5p9dC.mjs +73 -0
  68. package/dist/prepared-admission-DMX5p9dC.mjs.map +1 -0
  69. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  70. package/package.json +1 -6
  71. package/src/Alarm.ts +2961 -0
  72. package/src/BrowserCredentials.ts +146 -0
  73. package/src/BrowserRestCapture.ts +477 -0
  74. package/src/BrowserRestCrawl.ts +540 -0
  75. package/src/BrowserSession.ts +667 -0
  76. package/src/CloudflareAiGateway.ts +170 -0
  77. package/src/CloudflareBindings.ts +199 -0
  78. package/src/CloudflareBrowser.ts +15 -0
  79. package/src/CloudflareCodeMode.ts +878 -0
  80. package/src/CloudflareConfig.ts +138 -0
  81. package/src/CloudflareMemory.ts +420 -0
  82. package/src/CloudflareScheduling.ts +745 -0
  83. package/src/CloudflareSubscriptions.ts +1044 -0
  84. package/src/CloudflareThreadClient.ts +809 -0
  85. package/src/InteractiveBrowser.ts +3275 -0
  86. package/src/ThreadObject.ts +1198 -0
  87. package/src/WakeScheduler.ts +91 -0
  88. package/src/index.ts +14 -0
  89. package/src/internal/boundary.ts +55 -0
  90. package/src/internal/browser-binding.ts +322 -0
  91. package/src/internal/browser-credentials.ts +362 -0
  92. package/src/internal/browser-failure.ts +92 -0
  93. package/src/internal/browser-file-selection.ts +126 -0
  94. package/src/internal/browser-quick-action.ts +857 -0
  95. package/src/internal/browser-readonly-live-view.ts +111 -0
  96. package/src/internal/browser-session-lifecycle.ts +193 -0
  97. package/src/internal/due-queue.ts +493 -0
  98. package/src/internal/layers.ts +1068 -0
  99. package/src/internal/message-delivery.ts +120 -0
  100. package/src/internal/prepared-admission.ts +116 -0
  101. package/src/internal/progress-wait.ts +121 -0
  102. package/src/internal/transport.ts +56 -0
  103. package/README.md +0 -3
@@ -0,0 +1,267 @@
1
+ import { DurableObjectContext } from "./CloudflareBindings.mjs";
2
+ import { s as CloudflareDurableRuntimeConfig } from "./CloudflareConfig-qDrRLofL.mjs";
3
+ import { DurableBindingFailure } from "@yielded/agent/agent-registration";
4
+ import { DurableAgentRuntime, DurableRuntimeConfig, DurableWorkerFailure, RecoveryFailure } from "@yielded/agent/durable-agent-runtime";
5
+ import { SubmissionLedger } from "@yielded/agent/submission-ledger";
6
+ import { ThreadProjectionError, ThreadProjectionMaintenance } from "@yielded/agent/thread-projection-maintenance";
7
+ import { WakeScheduler } from "@yielded/agent/wake-scheduler";
8
+ import { Cause, Context, Effect, Layer, Option, Schema, Scope } from "effect";
9
+ import { SqlClient } from "effect/sql/SqlClient";
10
+ import { SqlError } from "effect/sql/SqlError";
11
+ declare namespace Alarm_d_exports {
12
+ export { DurableAlarmError, DurableAlarmService, MaintenancePassFailure, MaintenancePassReport, ThreadHostMaintenance, ThreadHostMaintenanceLane, ThreadMaintenance, ThreadMaintenanceFailpoint, ThreadMaintenanceFailpointHandler, ThreadMaintenanceFailpointLocation, ThreadMessageDelivery, ThreadMutationGate, ThreadNativeMaintenance, ThreadPublication, ThreadPublicationService, ThreadRecoveryEvents, ThreadRecoveryFaultEvent, publishCommitted };
13
+ }
14
+ declare const DurableAlarmError_base: Schema.Class<DurableAlarmError, Schema.TaggedStruct<"DurableAlarmError", {
15
+ readonly operation: Schema.String;
16
+ readonly message: Schema.String;
17
+ readonly cause: Schema.optionalKey<Schema.Defect>;
18
+ }>, Cause.YieldableError>;
19
+ /**
20
+ * The single multiplexed Durable Object alarm (decision D-P6-2). A Durable Object has ONE
21
+ * alarm slot; due work (lease expiry, settlement
22
+ * and abort re-checks, retry backoff) multiplexes into one idempotent maintenance pass, and
23
+ * the slot always holds the EARLIEST deadline any caller asked for.
24
+ *
25
+ * The alarm invariant (plan §1.4): every committed actionable mutation carries a newer durable
26
+ * maintenance generation and a committed alarm. Stable externally-driven waits may be
27
+ * nonterminal without retaining an alarm; their resolving mutation advances the generation and
28
+ * restores the alarm atomically.
29
+ */
30
+ /** The Durable Object alarm API failed; surfaces on host entry points as a typed refusal. */
31
+ export declare class DurableAlarmError extends DurableAlarmError_base {}
32
+ declare const DurableAlarmService_base: Context.ServiceClass<DurableAlarmService, "@effect-agent/platform-cloudflare/DurableAlarmService", {
33
+ /** The scheduled deadline in epoch milliseconds, if any. */
34
+ readonly scheduled: Effect.Effect<Option.Option<number>, DurableAlarmError>;
35
+ /** Replace the slot with this deadline. */
36
+ readonly scheduleAt: (epochMillis: number) => Effect.Effect<void, DurableAlarmError>;
37
+ /** Keep the EARLIER of the existing deadline and this one (the multiplexing rule). */
38
+ readonly ensureScheduledBy: (epochMillis: number) => Effect.Effect<void, DurableAlarmError>;
39
+ /**
40
+ * Arm an immediate alarm (the durable, coalescing local wake) — DEFERRED while a
41
+ * maintenance pass is executing. Workerd cancels an in-flight alarm handler when a new
42
+ * EARLIER deadline is written during its execution (`requestScheduledAlarm`), and the
43
+ * maintenance pass runs INSIDE the alarm handler: an immediate wake landing mid-pass
44
+ * (a routed port mutation, a sibling's `wake()`, the coordinator's own local notify)
45
+ * would kill the running Attempt — manufacturing an ownership loss no real eviction
46
+ * caused, and routing open uncertain-class Tool Calls into spurious Unknown Outcomes.
47
+ * Deferral is contract-safe: wakes are droppable hints, every mutating entry point
48
+ * pre-arms BEFORE its first durable mutation (the alarm invariant never rests on this
49
+ * call). The pass's durable generation check observes any racing mutation, so the
50
+ * in-memory hint does not need to be flushed after a stable wait is acknowledged.
51
+ */
52
+ readonly scheduleNow: Effect.Effect<void, DurableAlarmError>;
53
+ /**
54
+ * Run one maintenance pass with wake deferral (see `scheduleNow`). Calls made while `body`
55
+ * executes are droppable promptness hints; correctness rests on the durable generation.
56
+ */
57
+ readonly withWakesDeferred: <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
58
+ /** Clear the slot; correctness-sensitive clears live in maintenance generation transactions. */
59
+ readonly cancel: Effect.Effect<void, DurableAlarmError>;
60
+ }>;
61
+ /** Native `ctx.storage` alarm slot owned by ThreadMaintenance; storage is truth. */
62
+ export declare class DurableAlarmService extends DurableAlarmService_base {
63
+ static readonly layer: Layer.Layer<DurableAlarmService, never, DurableObjectContext | SqlClient>;
64
+ }
65
+ declare const MaintenancePassReport_base: Schema.Class<MaintenancePassReport, Schema.Struct<{
66
+ /** `caught-up` ran no runtime work (publication may be pending); `actionable` ran recovery. */
67
+ readonly phase: Schema.Literals<readonly ["caught-up", "actionable"]>;
68
+ /** Recovery decisions and Thread faults observed during this event. */
69
+ readonly recovered: Schema.Int;
70
+ /** Head Attempts settled during the event. Joined input may settle with each head. */
71
+ readonly settled: Schema.Int;
72
+ /** Submissions still nonterminal after the pass (suspended/unknown lanes stay honest). */
73
+ readonly nonterminal: Schema.Int;
74
+ /** `rearmed` for dirty/autonomous work, `cleared` for stable waits or settlement. */
75
+ readonly alarm: Schema.Literals<readonly ["rearmed", "cleared"]>;
76
+ }>, {}>;
77
+ /** What one maintenance pass did — auditable evidence mirroring `NodeDurableHost`'s report. */
78
+ export declare class MaintenancePassReport extends MaintenancePassReport_base {}
79
+ /** Fault boundaries around every maintenance-owned durable mutation. */
80
+ export type ThreadMaintenanceFailpointLocation = "maintenance:dirty:before" | "maintenance:dirty:after" | "maintenance:mutation:armed" | "maintenance:mutation:finished" | "maintenance:ensure:before" | "maintenance:ensure:after" | "maintenance:begin:before" | "maintenance:begin:after" | "maintenance:select:before" | "maintenance:select:after" | "maintenance:binding-retry:before" | "maintenance:binding-retry:after" | "maintenance:recovery-status:before" | "maintenance:recovery-status:after" | "maintenance:retry:before" | "maintenance:retry:after" | "maintenance:checkpoint:before" | "maintenance:checkpoint:after" | "maintenance:finish:before" | "maintenance:finish:after";
81
+ export type ThreadMaintenanceFailpointHandler = (location: ThreadMaintenanceFailpointLocation) => Effect.Effect<void>;
82
+ declare const ThreadMaintenanceFailpoint_base: Context.ServiceClass<ThreadMaintenanceFailpoint, "@effect-agent/platform-cloudflare/ThreadMaintenanceFailpoint", {
83
+ readonly hit: ThreadMaintenanceFailpointHandler;
84
+ }>;
85
+ /** Test-only fault authority; production uses the inert layer. */
86
+ export declare class ThreadMaintenanceFailpoint extends ThreadMaintenanceFailpoint_base {
87
+ static readonly layer: Layer.Layer<ThreadMaintenanceFailpoint, never, never>;
88
+ }
89
+ /**
90
+ * Durable host publication of canonical records and ledger approval/abort/resolution intents.
91
+ * The host owns schema-versioned cursors, destination idempotency and acknowledgement. Delivery
92
+ * is at least once. Hooks must not write the alarm slot or mutate the supplied raw source ports.
93
+ *
94
+ * `invalidate` and `prepareGeneration` must be bounded local operations.
95
+ * `prepareGeneration` durably invalidates a scan only when its generation changes; repeated
96
+ * calls must preserve partial scan progress. It runs with no source mutation in flight.
97
+ * Use this gate only for publication required before dependent native execution. Independent
98
+ * UI relays and outboxes belong to ThreadHostMaintenance.
99
+ * `drain` performs bounded delivery and returns its next deadline (None when caught up),
100
+ * after persisting receipts and retries. A pending deadline
101
+ * defers runtime recovery/Attempts, allowing committed host publications to drain first.
102
+ * Unexpected hook failures leave the prearmed generation for retry. Hooks acquire per-call
103
+ * resources with Effect.scoped; Layer construction owns incarnation resources (eviction need
104
+ * not run finalizers). Do not hold a local hook behind network I/O or call back into producers.
105
+ */
106
+ export interface ThreadPublicationService {
107
+ readonly invalidate: Effect.Effect<void, DurableAlarmError>;
108
+ readonly prepareGeneration: (generation: bigint) => Effect.Effect<void, DurableAlarmError>;
109
+ readonly drain: Effect.Effect<Option.Option<number>, DurableAlarmError>;
110
+ }
111
+ declare const ThreadPublication_base: Context.ServiceClass<ThreadPublication, "@effect-agent/platform-cloudflare/ThreadPublication", ThreadPublicationService>;
112
+ /** Opt in with `ThreadObject.layer(registrations, { publication: Layer.effect(ThreadPublication)(...) })`. */
113
+ export declare class ThreadPublication extends ThreadPublication_base {
114
+ static readonly layer: Layer.Layer<ThreadPublication, never, never>;
115
+ }
116
+ /**
117
+ * Host-assembled native message recovery. Preparation is a bounded local selection; the
118
+ * driver bounds each actual Claim and persists its timeout/retry before `run` returns.
119
+ * The alarm must not add a timer starting at selection: Claim setup and retry commits belong
120
+ * to the driver. The prepared allowance decides only whether a wave fits this event.
121
+ */
122
+ export declare const ThreadMessageDelivery: Context.Reference<{
123
+ readonly prepare: Effect.Effect<{
124
+ readonly timeoutMillis: number;
125
+ readonly run: Effect.Effect<Option.Option<number>, DurableAlarmError>;
126
+ }, DurableAlarmError>;
127
+ }>;
128
+ /**
129
+ * One explicitly scheduled application obligation. IDs are stable and unique within the
130
+ * physical Object; the `@yielded/agent:` prefix is reserved. There is no initial host wave.
131
+ * Producers enroll only affected IDs through ThreadMutationGate.withMutation({ lanes })
132
+ * or schedule(id, dueAt). A lane returns its next epoch-millisecond deadline (None = idle)
133
+ * with its finite wave, after persisting claims, receipts and retries. No deadline callback
134
+ * or polling is used. A racing producer keeps its newer revision due.
135
+ *
136
+ * The 1..300000ms allowance includes selection, dispatch, commits and scoped cleanup.
137
+ * Failed waves retain independent backoff and are not retried in the same event. Delivery
138
+ * remains at least once: persist exact envelopes and deduplicate by domain receipt identity.
139
+ * Hooks never write the alarm slot. Required execution gates belong to ThreadPublication.
140
+ */
141
+ export interface ThreadHostMaintenanceLane {
142
+ readonly id: string;
143
+ /** Omission runs concurrently with native work. After-native lanes get one due wave
144
+ * after all admitted native Attempts and their scoped cleanup, even on native failure.
145
+ * They share the event deadline and remain inside the maintenance pass permit.
146
+ * Newly enrolled concurrent work yields this phase after scoped cleanup; unfinished
147
+ * waves retain their due revision and domain receipts for the next alarm.
148
+ */
149
+ readonly phase?: "concurrent" | "after-native";
150
+ readonly dispatchTimeoutMillis: number;
151
+ readonly run: Effect.Effect<Option.Option<number>, DurableAlarmError, Scope.Scope>;
152
+ }
153
+ /** Independent lanes share the existing alarm; compose hosts by concatenating their lanes. */
154
+ export declare const ThreadHostMaintenance: Context.Reference<{
155
+ readonly lanes: ReadonlyArray<ThreadHostMaintenanceLane>;
156
+ }>;
157
+ /** @internal Framework handlers are separate from host registrations and their namespace. */
158
+ export declare const ThreadNativeMaintenance: Context.Reference<{
159
+ readonly lanes: ReadonlyArray<ThreadHostMaintenanceLane>;
160
+ }>;
161
+ /** @internal Required host publication only; native lifecycle facts use a maintenance lane. */
162
+ export declare const publishCommitted: Effect.Effect<void, never, ThreadPublication>;
163
+ declare const ThreadRecoveryFaultEvent_base: Schema.Class<ThreadRecoveryFaultEvent, Schema.Struct<{
164
+ readonly schemaVersion: Schema.Literal<1>;
165
+ /** Monotonic within the physical Object; retained unchanged on delivery retries. */
166
+ readonly sequence: Schema.BigIntFromString;
167
+ readonly transition: Schema.Literals<readonly ["created", "changed", "cleared"]>;
168
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
169
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
170
+ readonly occurredAt: Schema.Finite;
171
+ readonly firstFailedAt: Schema.Finite;
172
+ /** The current failure, or the last failure for a cleared event. */
173
+ readonly failure: typeof RecoveryFailure;
174
+ }>, {}>;
175
+ /** A committed recovery transition for one affected Submission; never a Settlement. */
176
+ export declare class ThreadRecoveryFaultEvent extends ThreadRecoveryFaultEvent_base {}
177
+ declare const ThreadRecoveryEvents_base: Context.ServiceClass<ThreadRecoveryEvents, "@effect-agent/platform-cloudflare/ThreadRecoveryEvents", {
178
+ readonly publish: (event: ThreadRecoveryFaultEvent) => Effect.Effect<void, DurableAlarmError>;
179
+ }>;
180
+ /**
181
+ * Ordered, at-least-once delivery through the existing host maintenance lane. Return only
182
+ * after durably applying the event or retaining it in a host outbox. Deduplicate by physical
183
+ * Object and sequence; callbacks may repeat after interruption. This is a trusted host hook,
184
+ * not pre-authorized UI data: the host owns recipient authorization and safe presentation.
185
+ * Capture services in the Layer. Do not call producers or write the raw alarm slot.
186
+ */
187
+ export declare class ThreadRecoveryEvents extends ThreadRecoveryEvents_base {}
188
+ declare const ThreadMutationGate_base: Context.ServiceClass<ThreadMutationGate, "@effect-agent/platform-cloudflare/internal/ThreadMutationGate", {
189
+ /** Commit source facts and their scheduling intent together. The flush runs before
190
+ * native commit; failed or interrupted transactions discard their queue view. */
191
+ readonly withTransaction: <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E | SqlError, R>;
192
+ readonly withMutation: <A, E, R>(body: Effect.Effect<A, E, R>,
193
+ /**
194
+ * Call outside SQL transactions so prearming commits before the body runs.
195
+ * Native admission, approval, abort and unknown resolution keep the default true.
196
+ * Host producers use false and name only the lanes for which they create work.
197
+ * Receipt-only bookkeeping with no new obligation names no lanes. Enrollment preserves
198
+ * a pending retry budget; idle completion or actual source progress replenishes it.
199
+ * Actual new work must record that progress in its source transaction, so a commit
200
+ * after parking cannot be stranded by eviction before this body returns.
201
+ */
202
+ options?: {
203
+ readonly invalidatesRecovery?: boolean;
204
+ readonly lanes?: ReadonlyArray<string>;
205
+ }) => Effect.Effect<A, E | DurableAlarmError, R>;
206
+ /** Enroll a known lane without accelerating its retry floor. A strictly increasing
207
+ * source cursor replenishes its budget; equal/older notices are replayed hints.
208
+ * Cursors identify committed source facts, never clocks, attempts or retry counters.
209
+ * Local sources call inside their source transaction. Remote sources retain the cursor
210
+ * notice with their work and retry delivery here; this call atomically accepts that
211
+ * notice and its alarm. Prearming alone cannot fence a later remote commit. */
212
+ readonly schedule: (id: string, dueAt: number, progressCursor?: bigint) => Effect.Effect<void, DurableAlarmError>;
213
+ /** Record an actual new fact inside its local source SQL transaction. The source
214
+ * transaction owns duplicate detection. Claims, lease renewals and retries are not progress.
215
+ * Also enrolls the lanes selected by this producer's enclosing withMutation boundary. */
216
+ readonly recordProgress: (lanes: ReadonlyArray<string>) => Effect.Effect<void, DurableAlarmError>;
217
+ /** In-incarnation notification; the durable due queue is the recovery authority. */
218
+ readonly activeLanes: Effect.Effect<ReadonlySet<string>>;
219
+ readonly revision: Effect.Effect<number>;
220
+ readonly awaitChange: (revision: number) => Effect.Effect<void>;
221
+ readonly withSnapshot: <A, E, R>(body: (active: number) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
222
+ }>;
223
+ export declare class ThreadMutationGate extends ThreadMutationGate_base {
224
+ static readonly layer: Layer.Layer<ThreadMutationGate, DurableAlarmError, CloudflareDurableRuntimeConfig | DurableObjectContext | SqlClient | ThreadMaintenanceFailpoint>;
225
+ }
226
+ export type MaintenancePassFailure = DurableWorkerFailure | DurableBindingFailure | DurableAlarmError | ThreadProjectionError;
227
+ declare const ThreadMaintenance_base: Context.ServiceClass<ThreadMaintenance, "@effect-agent/platform-cloudflare/ThreadMaintenance", {
228
+ /** One idempotent pass; failures propagate after durably scheduling bounded recovery. */
229
+ readonly pass: Effect.Effect<MaintenancePassReport, MaintenancePassFailure>;
230
+ /**
231
+ * Constructor gate: initialize/inspect only the O(1) maintenance record and ensure a dirty
232
+ * generation has an alarm. It never scans the ledger or canonical history.
233
+ */
234
+ readonly ensureAlarm: Effect.Effect<void, MaintenancePassFailure>;
235
+ /**
236
+ * Serialize the pre-arm boundary with pass acknowledgement, advance the durable dirty
237
+ * generation and arm the alarm in one transaction BEFORE running the caller's mutation.
238
+ * A pass cannot acknowledge while that mutation remains in flight.
239
+ */
240
+ readonly withMutation: <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E | DurableAlarmError, R>;
241
+ }>;
242
+ /**
243
+ * Incremental, quiescent maintenance over a durable dirty/processed generation (issue #93).
244
+ *
245
+ * One physical event owns native scheduling, auxiliary delivery and final alarm rearming.
246
+ *
247
+ * 1. Prearm before any work. A caught-up native step uses the O(1) generation record without
248
+ * recovery, ledger scans or canonical-history reads.
249
+ * 2. Reconcile before each head Attempt, then checkpoint only the observed generation. A racing
250
+ * producer keeps its generation dirty and immediately eligible. Quiescent native retries
251
+ * retain their durable backoff.
252
+ * 3. Admit at most two independent Thread Attempts, one active head per Thread.
253
+ * Keep native and delivery admission open together while finite waves remain active, so
254
+ * fresh replies and abort controls can progress during unrelated cleanup. Close atomically
255
+ * at quiescence, or at the original ten-minute yield deadline, then join admitted waves.
256
+ * 4. Native message delivery retains its driver-owned Claim deadline. Host/backfill waves are
257
+ * bounded independently; incoming native work never restarts or cancels their attempts.
258
+ * Auxiliary failures are reported after the current native opportunity.
259
+ * 5. Close every event resource before the final gated deadline snapshot and alarm decision.
260
+ * The whole event retains one fourteen-minute cooperative timeout.
261
+ */
262
+ export declare class ThreadMaintenance extends ThreadMaintenance_base {
263
+ static readonly layer: Layer.Layer<ThreadMaintenance, DurableAlarmError, ThreadMutationGate | ThreadPublication | ThreadProjectionMaintenance | DurableAgentRuntime | DurableRuntimeConfig | SubmissionLedger | WakeScheduler | DurableAlarmService | ThreadMaintenanceFailpoint | CloudflareDurableRuntimeConfig | DurableObjectContext | SqlClient>;
264
+ }
265
+ //#endregion
266
+ export { Alarm_d_exports as t };
267
+ //# sourceMappingURL=Alarm.d.mts.map
package/dist/Alarm.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { a as ThreadHostMaintenance, c as ThreadMessageDelivery, d as ThreadPublication, f as ThreadRecoveryEvents, i as MaintenancePassReport, l as ThreadMutationGate, m as publishCommitted, n as DurableAlarmError, o as ThreadMaintenance, p as ThreadRecoveryFaultEvent, r as DurableAlarmService, s as ThreadMaintenanceFailpoint, u as ThreadNativeMaintenance } from "./Alarm-B0ODr1NE.mjs";
2
+ export { DurableAlarmError, DurableAlarmService, MaintenancePassReport, ThreadHostMaintenance, ThreadMaintenance, ThreadMaintenanceFailpoint, ThreadMessageDelivery, ThreadMutationGate, ThreadNativeMaintenance, ThreadPublication, ThreadRecoveryEvents, ThreadRecoveryFaultEvent, publishCommitted };
@@ -0,0 +1,91 @@
1
+ import { Context, Effect, Schema } from "effect";
2
+ declare namespace BrowserCredentials_d_exports {
3
+ export { BrowserCredentialAccess, BrowserCredentialMaterial, CardCredential, CredentialAccessError, CredentialAccessRequest, CredentialDispatch, CredentialFieldRole, CredentialFillError, CredentialFillResult, CredentialKind, CredentialOrigin, CredentialTarget, FillCredentialRequest, LoginCredential };
4
+ }
5
+ export declare const CredentialKind: Schema.Literals<readonly ["login", "card"]>;
6
+ export declare const CredentialFieldRole: Schema.Literals<readonly ["username", "password", "card-name", "card-number", "card-expiry", "card-expiry-month", "card-expiry-year", "card-security-code"]>;
7
+ /** Canonical HTTPS origins, including non-default ports. Grants must match exactly. */
8
+ export declare const CredentialOrigin: Schema.String;
9
+ declare const CredentialTarget_base: Schema.Class<CredentialTarget, Schema.Struct<{
10
+ readonly topOrigin: Schema.String;
11
+ readonly frameOrigin: Schema.String;
12
+ readonly recipientOrigin: Schema.String;
13
+ }>, {}>;
14
+ export declare class CredentialTarget extends CredentialTarget_base {}
15
+ declare const FillCredentialRequest_base: Schema.Class<FillCredentialRequest, Schema.Struct<{
16
+ readonly credential: Schema.NonEmptyString;
17
+ readonly kind: Schema.Literals<readonly ["login", "card"]>;
18
+ readonly frame: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
19
+ readonly fields: Schema.$Array<Schema.Struct<{
20
+ readonly selector: Schema.NonEmptyString;
21
+ readonly role: Schema.Literals<readonly ["username", "password", "card-name", "card-number", "card-expiry", "card-expiry-month", "card-expiry-year", "card-security-code"]>;
22
+ }>>;
23
+ }>, {}>;
24
+ /** Selectors identify one native form. Roles explicitly select material; no field inference occurs. */
25
+ export declare class FillCredentialRequest extends FillCredentialRequest_base {}
26
+ /** Host-only material. Never return or encode it through a Tool, log, trace, or checkpoint. */
27
+ export declare const LoginCredential: Schema.TaggedStruct<"LoginCredential", {
28
+ readonly username: Schema.Redacted<Schema.NonEmptyString>;
29
+ readonly password: Schema.Redacted<Schema.NonEmptyString>;
30
+ }>;
31
+ /** Security codes are transient; the host must not persist them. */
32
+ export declare const CardCredential: Schema.TaggedStruct<"CardCredential", {
33
+ readonly name: Schema.Redacted<Schema.NonEmptyString>;
34
+ readonly number: Schema.Redacted<Schema.String>;
35
+ readonly expiry: Schema.Redacted<Schema.NonEmptyString>;
36
+ readonly expiryMonth: Schema.Redacted<Schema.String>;
37
+ readonly expiryYear: Schema.Redacted<Schema.String>;
38
+ readonly securityCode: Schema.optionalKey<Schema.Redacted<Schema.String>>;
39
+ }>;
40
+ export declare const BrowserCredentialMaterial: Schema.Union<readonly [Schema.TaggedStruct<"LoginCredential", {
41
+ readonly username: Schema.Redacted<Schema.NonEmptyString>;
42
+ readonly password: Schema.Redacted<Schema.NonEmptyString>;
43
+ }>, Schema.TaggedStruct<"CardCredential", {
44
+ readonly name: Schema.Redacted<Schema.NonEmptyString>;
45
+ readonly number: Schema.Redacted<Schema.String>;
46
+ readonly expiry: Schema.Redacted<Schema.NonEmptyString>;
47
+ readonly expiryMonth: Schema.Redacted<Schema.String>;
48
+ readonly expiryYear: Schema.Redacted<Schema.String>;
49
+ readonly securityCode: Schema.optionalKey<Schema.Redacted<Schema.String>>;
50
+ }>]>;
51
+ export type BrowserCredentialMaterial = typeof BrowserCredentialMaterial.Type;
52
+ declare const CredentialAccessError_base: Schema.Class<CredentialAccessError, Schema.TaggedStruct<"CredentialAccessError", {
53
+ readonly reason: Schema.Literals<readonly ["denied", "missing-credential", "needs-attention", "busy", "resolver"]>;
54
+ }>, import("effect/Cause").YieldableError>;
55
+ export declare class CredentialAccessError extends CredentialAccessError_base {}
56
+ export interface CredentialAccessRequest {
57
+ readonly credential: string;
58
+ readonly kind: typeof CredentialKind.Type;
59
+ readonly target: CredentialTarget;
60
+ readonly roles: ReadonlyArray<typeof CredentialFieldRole.Type>;
61
+ }
62
+ declare const BrowserCredentialAccess_base: Context.ServiceClass<BrowserCredentialAccess, "@effect-agent/platform-cloudflare/BrowserCredentialAccess", {
63
+ readonly authorize: (request: CredentialAccessRequest) => Effect.Effect<void, CredentialAccessError>;
64
+ readonly resolve: (request: CredentialAccessRequest) => Effect.Effect<BrowserCredentialMaterial, CredentialAccessError>;
65
+ }>;
66
+ /**
67
+ * Invocation-owned authority. Derive caller/ownership from the host, not the public credential
68
+ * identifier. Authorize the actual merchant, frame, recipient, roles, and side effects of filling.
69
+ * Repeated checks must consult current grants. Never log or trace resolved material.
70
+ * Bind caller identity and identifier-to-vault-item selection for the whole invocation; an alias
71
+ * changing between resolve and authorize must never authorize different material.
72
+ */
73
+ export declare class BrowserCredentialAccess extends BrowserCredentialAccess_base {}
74
+ export declare const CredentialDispatch: Schema.Literals<readonly ["not-dispatched", "possibly-dispatched", "dispatched"]>;
75
+ declare const CredentialFillResult_base: Schema.Class<CredentialFillResult, Schema.Struct<{
76
+ readonly dispatch: Schema.Literal<"dispatched">;
77
+ readonly filled: Schema.Natural;
78
+ }>, {}>;
79
+ /** Filled counts acknowledged assignments, not authentication, submission, or website acceptance. */
80
+ export declare class CredentialFillResult extends CredentialFillResult_base {}
81
+ declare const CredentialFillError_base: Schema.Class<CredentialFillError, Schema.TaggedStruct<"CredentialFillError", {
82
+ readonly reason: Schema.Literals<readonly ["denied", "missing-credential", "stale-target", "unsupported", "needs-attention", "busy", "provider", "resolver", "timeout"]>;
83
+ readonly dispatch: Schema.Literals<readonly ["not-dispatched", "possibly-dispatched", "dispatched"]>;
84
+ readonly filled: Schema.Natural;
85
+ readonly cleanup: Schema.Literals<readonly ["not-requested", "confirmed", "unconfirmed"]>;
86
+ }>, import("effect/Cause").YieldableError>;
87
+ /** Content-free evidence. A lost reply never authorizes a retry or proves that no write occurred. */
88
+ export declare class CredentialFillError extends CredentialFillError_base {}
89
+ //#endregion
90
+ export { BrowserCredentials_d_exports as t };
91
+ //# sourceMappingURL=BrowserCredentials.d.mts.map
@@ -0,0 +1,120 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Context, Schema } from "effect";
3
+ //#region src/BrowserCredentials.ts
4
+ var BrowserCredentials_exports = /* @__PURE__ */ __exportAll({
5
+ BrowserCredentialAccess: () => BrowserCredentialAccess,
6
+ BrowserCredentialMaterial: () => BrowserCredentialMaterial,
7
+ CardCredential: () => CardCredential,
8
+ CredentialAccessError: () => CredentialAccessError,
9
+ CredentialDispatch: () => CredentialDispatch,
10
+ CredentialFieldRole: () => CredentialFieldRole,
11
+ CredentialFillError: () => CredentialFillError,
12
+ CredentialFillResult: () => CredentialFillResult,
13
+ CredentialKind: () => CredentialKind,
14
+ CredentialOrigin: () => CredentialOrigin,
15
+ CredentialTarget: () => CredentialTarget,
16
+ FillCredentialRequest: () => FillCredentialRequest,
17
+ LoginCredential: () => LoginCredential
18
+ });
19
+ const Selector = Schema.NonEmptyString.check(Schema.isMaxLength(2048));
20
+ const CredentialKind = Schema.Literals(["login", "card"]);
21
+ const CredentialFieldRole = Schema.Literals([
22
+ "username",
23
+ "password",
24
+ "card-name",
25
+ "card-number",
26
+ "card-expiry",
27
+ "card-expiry-month",
28
+ "card-expiry-year",
29
+ "card-security-code"
30
+ ]);
31
+ /** Canonical HTTPS origins, including non-default ports. Grants must match exactly. */
32
+ const CredentialOrigin = Schema.String.check(Schema.isMaxLength(2048), Schema.makeFilter((value) => {
33
+ try {
34
+ const url = new URL(value);
35
+ return url.protocol === "https:" && url.origin === value && !url.username && !url.password;
36
+ } catch {
37
+ return false;
38
+ }
39
+ }));
40
+ var CredentialTarget = class extends Schema.Class("CredentialTarget")({
41
+ topOrigin: CredentialOrigin,
42
+ frameOrigin: CredentialOrigin,
43
+ recipientOrigin: CredentialOrigin
44
+ }) {};
45
+ /** Selectors identify one native form. Roles explicitly select material; no field inference occurs. */
46
+ var FillCredentialRequest = class extends Schema.Class("FillCredentialRequest")({
47
+ credential: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
48
+ kind: CredentialKind,
49
+ frame: Schema.optionalKey(Schema.Array(Selector).check(Schema.isMaxLength(8))),
50
+ fields: Schema.Array(Schema.Struct({
51
+ selector: Selector,
52
+ role: CredentialFieldRole
53
+ })).check(Schema.isMinLength(1), Schema.isMaxLength(8))
54
+ }) {};
55
+ const SecretText = Schema.Redacted(Schema.NonEmptyString.check(Schema.isMaxLength(1024)));
56
+ /** Host-only material. Never return or encode it through a Tool, log, trace, or checkpoint. */
57
+ const LoginCredential = Schema.TaggedStruct("LoginCredential", {
58
+ username: SecretText,
59
+ password: SecretText
60
+ });
61
+ /** Security codes are transient; the host must not persist them. */
62
+ const CardCredential = Schema.TaggedStruct("CardCredential", {
63
+ name: SecretText,
64
+ number: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{12,19}$/))),
65
+ expiry: SecretText,
66
+ expiryMonth: Schema.Redacted(Schema.String.check(Schema.isPattern(/^(0[1-9]|1[0-2])$/))),
67
+ expiryYear: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{4}$/))),
68
+ securityCode: Schema.optionalKey(Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{3,4}$/))))
69
+ });
70
+ const BrowserCredentialMaterial = Schema.Union([LoginCredential, CardCredential]);
71
+ var CredentialAccessError = class extends Schema.TaggedError()("CredentialAccessError", { reason: Schema.Literals([
72
+ "denied",
73
+ "missing-credential",
74
+ "needs-attention",
75
+ "busy",
76
+ "resolver"
77
+ ]) }) {};
78
+ /**
79
+ * Invocation-owned authority. Derive caller/ownership from the host, not the public credential
80
+ * identifier. Authorize the actual merchant, frame, recipient, roles, and side effects of filling.
81
+ * Repeated checks must consult current grants. Never log or trace resolved material.
82
+ * Bind caller identity and identifier-to-vault-item selection for the whole invocation; an alias
83
+ * changing between resolve and authorize must never authorize different material.
84
+ */
85
+ var BrowserCredentialAccess = class extends Context.Service()("@effect-agent/platform-cloudflare/BrowserCredentialAccess") {};
86
+ const CredentialDispatch = Schema.Literals([
87
+ "not-dispatched",
88
+ "possibly-dispatched",
89
+ "dispatched"
90
+ ]);
91
+ /** Filled counts acknowledged assignments, not authentication, submission, or website acceptance. */
92
+ var CredentialFillResult = class extends Schema.Class("CredentialFillResult")({
93
+ dispatch: Schema.Literal("dispatched"),
94
+ filled: Schema.Natural.check(Schema.isLessThanOrEqualTo(8))
95
+ }) {};
96
+ /** Content-free evidence. A lost reply never authorizes a retry or proves that no write occurred. */
97
+ var CredentialFillError = class extends Schema.TaggedError()("CredentialFillError", {
98
+ reason: Schema.Literals([
99
+ "denied",
100
+ "missing-credential",
101
+ "stale-target",
102
+ "unsupported",
103
+ "needs-attention",
104
+ "busy",
105
+ "provider",
106
+ "resolver",
107
+ "timeout"
108
+ ]),
109
+ dispatch: CredentialDispatch,
110
+ filled: Schema.Natural.check(Schema.isLessThanOrEqualTo(8)),
111
+ cleanup: Schema.Literals([
112
+ "not-requested",
113
+ "confirmed",
114
+ "unconfirmed"
115
+ ])
116
+ }) {};
117
+ //#endregion
118
+ export { BrowserCredentialAccess, BrowserCredentialMaterial, CardCredential, CredentialAccessError, CredentialDispatch, CredentialFieldRole, CredentialFillError, CredentialFillResult, CredentialKind, CredentialOrigin, CredentialTarget, FillCredentialRequest, LoginCredential, BrowserCredentials_exports as t };
119
+
120
+ //# sourceMappingURL=BrowserCredentials.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrowserCredentials.mjs","names":[],"sources":["../src/BrowserCredentials.ts"],"sourcesContent":["import { Context, type Effect, Schema } from \"effect\";\n\nconst Selector = Schema.NonEmptyString.check(Schema.isMaxLength(2048));\n\nexport const CredentialKind = Schema.Literals([\"login\", \"card\"]);\n\nexport const CredentialFieldRole = Schema.Literals([\n \"username\",\n \"password\",\n \"card-name\",\n \"card-number\",\n \"card-expiry\",\n \"card-expiry-month\",\n \"card-expiry-year\",\n \"card-security-code\",\n]);\n\n/** Canonical HTTPS origins, including non-default ports. Grants must match exactly. */\nexport const CredentialOrigin = Schema.String.check(\n Schema.isMaxLength(2048),\n Schema.makeFilter((value) => {\n try {\n const url = new URL(value);\n\n return url.protocol === \"https:\" && url.origin === value && !url.username && !url.password;\n } catch {\n return false;\n }\n }),\n);\n\nexport class CredentialTarget extends Schema.Class<CredentialTarget>(\"CredentialTarget\")({\n topOrigin: CredentialOrigin,\n frameOrigin: CredentialOrigin,\n recipientOrigin: CredentialOrigin,\n}) {}\n\n/** Selectors identify one native form. Roles explicitly select material; no field inference occurs. */\nexport class FillCredentialRequest extends Schema.Class<FillCredentialRequest>(\n \"FillCredentialRequest\",\n)({\n credential: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n kind: CredentialKind,\n frame: Schema.optionalKey(Schema.Array(Selector).check(Schema.isMaxLength(8))),\n fields: Schema.Array(Schema.Struct({ selector: Selector, role: CredentialFieldRole })).check(\n Schema.isMinLength(1),\n Schema.isMaxLength(8),\n ),\n}) {}\n\nconst SecretText = Schema.Redacted(Schema.NonEmptyString.check(Schema.isMaxLength(1024)));\n\n/** Host-only material. Never return or encode it through a Tool, log, trace, or checkpoint. */\nexport const LoginCredential = Schema.TaggedStruct(\"LoginCredential\", {\n username: SecretText,\n password: SecretText,\n});\n\n/** Security codes are transient; the host must not persist them. */\nexport const CardCredential = Schema.TaggedStruct(\"CardCredential\", {\n name: SecretText,\n number: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\\d{12,19}$/))),\n expiry: SecretText,\n expiryMonth: Schema.Redacted(Schema.String.check(Schema.isPattern(/^(0[1-9]|1[0-2])$/))),\n expiryYear: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\\d{4}$/))),\n securityCode: Schema.optionalKey(\n Schema.Redacted(Schema.String.check(Schema.isPattern(/^\\d{3,4}$/))),\n ),\n});\n\nexport const BrowserCredentialMaterial = Schema.Union([LoginCredential, CardCredential]);\nexport type BrowserCredentialMaterial = typeof BrowserCredentialMaterial.Type;\n\nexport class CredentialAccessError extends Schema.TaggedError<CredentialAccessError>()(\n \"CredentialAccessError\",\n {\n reason: Schema.Literals([\n \"denied\",\n \"missing-credential\",\n \"needs-attention\",\n \"busy\",\n \"resolver\",\n ]),\n },\n) {}\n\nexport interface CredentialAccessRequest {\n readonly credential: string;\n readonly kind: typeof CredentialKind.Type;\n readonly target: CredentialTarget;\n readonly roles: ReadonlyArray<typeof CredentialFieldRole.Type>;\n}\n\n/**\n * Invocation-owned authority. Derive caller/ownership from the host, not the public credential\n * identifier. Authorize the actual merchant, frame, recipient, roles, and side effects of filling.\n * Repeated checks must consult current grants. Never log or trace resolved material.\n * Bind caller identity and identifier-to-vault-item selection for the whole invocation; an alias\n * changing between resolve and authorize must never authorize different material.\n */\nexport class BrowserCredentialAccess extends Context.Service<\n BrowserCredentialAccess,\n {\n readonly authorize: (\n request: CredentialAccessRequest,\n ) => Effect.Effect<void, CredentialAccessError>;\n readonly resolve: (\n request: CredentialAccessRequest,\n ) => Effect.Effect<BrowserCredentialMaterial, CredentialAccessError>;\n }\n>()(\"@effect-agent/platform-cloudflare/BrowserCredentialAccess\") {}\n\nexport const CredentialDispatch = Schema.Literals([\n \"not-dispatched\",\n \"possibly-dispatched\",\n \"dispatched\",\n]);\n\n/** Filled counts acknowledged assignments, not authentication, submission, or website acceptance. */\nexport class CredentialFillResult extends Schema.Class<CredentialFillResult>(\n \"CredentialFillResult\",\n)({\n dispatch: Schema.Literal(\"dispatched\"),\n filled: Schema.Natural.check(Schema.isLessThanOrEqualTo(8)),\n}) {}\n\n/** Content-free evidence. A lost reply never authorizes a retry or proves that no write occurred. */\nexport class CredentialFillError extends Schema.TaggedError<CredentialFillError>()(\n \"CredentialFillError\",\n {\n reason: Schema.Literals([\n \"denied\",\n \"missing-credential\",\n \"stale-target\",\n \"unsupported\",\n \"needs-attention\",\n \"busy\",\n \"provider\",\n \"resolver\",\n \"timeout\",\n ]),\n dispatch: CredentialDispatch,\n filled: Schema.Natural.check(Schema.isLessThanOrEqualTo(8)),\n cleanup: Schema.Literals([\"not-requested\", \"confirmed\", \"unconfirmed\"]),\n },\n) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,MAAM,WAAW,OAAO,eAAe,MAAM,OAAO,YAAY,IAAI,CAAC;AAErE,MAAa,iBAAiB,OAAO,SAAS,CAAC,SAAS,MAAM,CAAC;AAE/D,MAAa,sBAAsB,OAAO,SAAS;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAGD,MAAa,mBAAmB,OAAO,OAAO,MAC5C,OAAO,YAAY,IAAI,GACvB,OAAO,YAAY,UAAU;CAC3B,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EAEzB,OAAO,IAAI,aAAa,YAAY,IAAI,WAAW,SAAS,CAAC,IAAI,YAAY,CAAC,IAAI;CACpF,QAAQ;EACN,OAAO;CACT;AACF,CAAC,CACH;AAEA,IAAa,mBAAb,cAAsC,OAAO,MAAwB,kBAAkB,CAAC,CAAC;CACvF,WAAW;CACX,aAAa;CACb,iBAAiB;AACnB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,wBAAb,cAA2C,OAAO,MAChD,uBACF,CAAC,CAAC;CACA,YAAY,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CAC/D,MAAM;CACN,OAAO,OAAO,YAAY,OAAO,MAAM,QAAQ,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC,CAAC;CAC7E,QAAQ,OAAO,MAAM,OAAO,OAAO;EAAE,UAAU;EAAU,MAAM;CAAoB,CAAC,CAAC,CAAC,CAAC,MACrF,OAAO,YAAY,CAAC,GACpB,OAAO,YAAY,CAAC,CACtB;AACF,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,aAAa,OAAO,SAAS,OAAO,eAAe,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;;AAGxF,MAAa,kBAAkB,OAAO,aAAa,mBAAmB;CACpE,UAAU;CACV,UAAU;AACZ,CAAC;;AAGD,MAAa,iBAAiB,OAAO,aAAa,kBAAkB;CAClE,MAAM;CACN,QAAQ,OAAO,SAAS,OAAO,OAAO,MAAM,OAAO,UAAU,aAAa,CAAC,CAAC;CAC5E,QAAQ;CACR,aAAa,OAAO,SAAS,OAAO,OAAO,MAAM,OAAO,UAAU,mBAAmB,CAAC,CAAC;CACvF,YAAY,OAAO,SAAS,OAAO,OAAO,MAAM,OAAO,UAAU,SAAS,CAAC,CAAC;CAC5E,cAAc,OAAO,YACnB,OAAO,SAAS,OAAO,OAAO,MAAM,OAAO,UAAU,WAAW,CAAC,CAAC,CACpE;AACF,CAAC;AAED,MAAa,4BAA4B,OAAO,MAAM,CAAC,iBAAiB,cAAc,CAAC;AAGvF,IAAa,wBAAb,cAA2C,OAAO,YAAmC,CAAC,CACpF,yBACA,EACE,QAAQ,OAAO,SAAS;CACtB;CACA;CACA;CACA;CACA;AACF,CAAC,EACH,CACF,CAAC,CAAC,CAAC;;;;;;;;AAgBH,IAAa,0BAAb,cAA6C,QAAQ,QAUnD,CAAC,CAAC,2DAA2D,CAAC,CAAC,CAAC;AAElE,MAAa,qBAAqB,OAAO,SAAS;CAChD;CACA;CACA;AACF,CAAC;;AAGD,IAAa,uBAAb,cAA0C,OAAO,MAC/C,sBACF,CAAC,CAAC;CACA,UAAU,OAAO,QAAQ,YAAY;CACrC,QAAQ,OAAO,QAAQ,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAChF,uBACA;CACE,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,UAAU;CACV,QAAQ,OAAO,QAAQ,MAAM,OAAO,oBAAoB,CAAC,CAAC;CAC1D,SAAS,OAAO,SAAS;EAAC;EAAiB;EAAa;CAAa,CAAC;AACxE,CACF,CAAC,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { o as BrowserQuickActionWorkersAi, s as BrowserQuickActionWorkersAiPolicy } from "./CloudflareBrowser-gu7gma0Y.mjs";
2
+ import { Layer, Redacted } from "effect";
3
+ import { PageCapture } from "@yielded/agent/page-capture";
4
+ import { SandboxImplementation } from "@yielded/agent/sandbox";
5
+ import { HttpClient } from "effect/http";
6
+ //#region src/BrowserRestCapture.d.ts
7
+ /** Node-safe REST PageCapture implementation; it never imports Worker runtime modules. */
8
+ export declare const browserRestCaptureImplementation: SandboxImplementation;
9
+ /** Explicit construction inputs; credentials are only projected into the fixed-origin Authorization header. */
10
+ export interface BrowserRestCaptureOptions {
11
+ readonly accountId: string;
12
+ readonly apiToken: Redacted.Redacted<string>;
13
+ }
14
+ /** REST PageCapture layer for Node and other non-Worker composition roots. */
15
+ export declare const browserRestCaptureLayer: (options: BrowserRestCaptureOptions) => Layer.Layer<PageCapture, never, HttpClient.HttpClient>;
16
+ /** REST structured extraction additionally requires explicit Workers AI authorization/accounting. */
17
+ export declare const browserRestWorkersAiCaptureLayer: (options: BrowserRestCaptureOptions) => Layer.Layer<PageCapture, never, HttpClient.HttpClient | BrowserQuickActionWorkersAi>;
18
+ /** Explicit REST credentials and optional authorization for separately billed extraction. */
19
+ export interface CloudflareBrowserRestOptions extends BrowserRestCaptureOptions {
20
+ readonly workersAi?: BrowserQuickActionWorkersAiPolicy;
21
+ }
22
+ /** Node-safe WebCapture handler assembly; the application supplies its HttpClient. */
23
+ export declare const CloudflareBrowserRest: {
24
+ /**
25
+ * Supports capture, scrape, and extraction definitions. Only PageCapture is supplied;
26
+ * handler errors and other services remain visible. Extraction fails closed without
27
+ * workersAi. Existing host policies, response limits, and scoped cleanup are unchanged.
28
+ */
29
+ layer: <A, E, R>(definition: {
30
+ readonly handlers: Layer.Layer<A, E, R>;
31
+ }, options: CloudflareBrowserRestOptions) => Layer.Layer<A, E, Exclude<R, PageCapture> | HttpClient.HttpClient>;
32
+ };
33
+ //#endregion
34
+ //# sourceMappingURL=BrowserRestCapture.d.mts.map