@systemfsoftware/agent-platform-cloudflare 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/dist/Alarm-CbhflIzz.mjs +1931 -0
- package/dist/Alarm-CbhflIzz.mjs.map +1 -0
- package/dist/Alarm-Nz1gIjfv.d.mts +252 -0
- package/dist/Alarm.d.mts +3 -0
- package/dist/Alarm.mjs +3 -0
- package/dist/BrowserCredentials-BWC4RqRn.d.mts +116 -0
- package/dist/BrowserCredentials-CktBoPgE.mjs +140 -0
- package/dist/BrowserCredentials-CktBoPgE.mjs.map +1 -0
- package/dist/BrowserCredentials.d.mts +2 -0
- package/dist/BrowserCredentials.mjs +1 -0
- package/dist/BrowserRestCapture.d.mts +14 -0
- package/dist/BrowserRestCapture.mjs +195 -0
- package/dist/BrowserRestCapture.mjs.map +1 -0
- package/dist/BrowserSession-5bdpqPIT.d.mts +152 -0
- package/dist/BrowserSession-Ce8cWN1A.mjs +673 -0
- package/dist/BrowserSession-Ce8cWN1A.mjs.map +1 -0
- package/dist/BrowserSession.d.mts +3 -0
- package/dist/BrowserSession.mjs +4 -0
- package/dist/BrowserUse-Bsi830Yv.mjs +263 -0
- package/dist/BrowserUse-Bsi830Yv.mjs.map +1 -0
- package/dist/BrowserUse-DF8afbNt.d.mts +59 -0
- package/dist/BrowserUse.d.mts +2 -0
- package/dist/BrowserUse.mjs +1 -0
- package/dist/CloudflareAiGateway-By8C8c5z.mjs +79 -0
- package/dist/CloudflareAiGateway-By8C8c5z.mjs.map +1 -0
- package/dist/CloudflareAiGateway-ukN34014.d.mts +63 -0
- package/dist/CloudflareAiGateway.d.mts +2 -0
- package/dist/CloudflareAiGateway.mjs +1 -0
- package/dist/CloudflareBindings-Dylkir84.mjs +123 -0
- package/dist/CloudflareBindings-Dylkir84.mjs.map +1 -0
- package/dist/CloudflareBindings-E1Sty9Vq.d.mts +134 -0
- package/dist/CloudflareBindings.d.mts +2 -0
- package/dist/CloudflareBindings.mjs +1 -0
- package/dist/CloudflareBrowser-CmiQpslZ.d.mts +41 -0
- package/dist/CloudflareBrowser-DmMCFeIQ.mjs +397 -0
- package/dist/CloudflareBrowser-DmMCFeIQ.mjs.map +1 -0
- package/dist/CloudflareBrowser.d.mts +3 -0
- package/dist/CloudflareBrowser.mjs +1 -0
- package/dist/CloudflareCodeMode-BMva6dCs.mjs +627 -0
- package/dist/CloudflareCodeMode-BMva6dCs.mjs.map +1 -0
- package/dist/CloudflareCodeMode-CeGXZtHv.d.mts +43 -0
- package/dist/CloudflareCodeMode.d.mts +2 -0
- package/dist/CloudflareCodeMode.mjs +1 -0
- package/dist/CloudflareConfig-BFWgEyhH.d.mts +102 -0
- package/dist/CloudflareConfig-rBlbPSIZ.mjs +125 -0
- package/dist/CloudflareConfig-rBlbPSIZ.mjs.map +1 -0
- package/dist/CloudflareConfig.d.mts +2 -0
- package/dist/CloudflareConfig.mjs +1 -0
- package/dist/CloudflareMemory-Bzp32ZpR.d.mts +120 -0
- package/dist/CloudflareMemory-DejIVKBT.mjs +207 -0
- package/dist/CloudflareMemory-DejIVKBT.mjs.map +1 -0
- package/dist/CloudflareMemory.d.mts +2 -0
- package/dist/CloudflareMemory.mjs +1 -0
- package/dist/CloudflareScheduling-BleqfC44.mjs +395 -0
- package/dist/CloudflareScheduling-BleqfC44.mjs.map +1 -0
- package/dist/CloudflareScheduling-vZ7iSR57.d.mts +54 -0
- package/dist/CloudflareScheduling.d.mts +2 -0
- package/dist/CloudflareScheduling.mjs +1 -0
- package/dist/CloudflareSubscriptions-IHSo19MU.d.mts +91 -0
- package/dist/CloudflareSubscriptions-S3fZF-Jo.mjs +529 -0
- package/dist/CloudflareSubscriptions-S3fZF-Jo.mjs.map +1 -0
- package/dist/CloudflareSubscriptions.d.mts +2 -0
- package/dist/CloudflareSubscriptions.mjs +1 -0
- package/dist/CloudflareThreadClient-BUv9Te1s.d.mts +2141 -0
- package/dist/CloudflareThreadClient-K7QJHYpK.mjs +496 -0
- package/dist/CloudflareThreadClient-K7QJHYpK.mjs.map +1 -0
- package/dist/CloudflareThreadClient.d.mts +3 -0
- package/dist/CloudflareThreadClient.mjs +3 -0
- package/dist/InteractiveBrowser-CMbA7YPP.d.mts +228 -0
- package/dist/InteractiveBrowser-e8ZvxC1C.mjs +2013 -0
- package/dist/InteractiveBrowser-e8ZvxC1C.mjs.map +1 -0
- package/dist/InteractiveBrowser.d.mts +2 -0
- package/dist/InteractiveBrowser.mjs +1 -0
- package/dist/LiveText-CfpcZaGb.d.mts +91 -0
- package/dist/LiveText-DaF0tN_p.mjs +148 -0
- package/dist/LiveText-DaF0tN_p.mjs.map +1 -0
- package/dist/LiveText.d.mts +2 -0
- package/dist/LiveText.mjs +1 -0
- package/dist/R2ToolResultStorage.d.mts +27 -0
- package/dist/R2ToolResultStorage.mjs +84 -0
- package/dist/R2ToolResultStorage.mjs.map +1 -0
- package/dist/ThreadObject-B2-PqnpT.d.mts +390 -0
- package/dist/ThreadObject-D1pCeNrq.mjs +1225 -0
- package/dist/ThreadObject-D1pCeNrq.mjs.map +1 -0
- package/dist/ThreadObject.d.mts +2 -0
- package/dist/ThreadObject.mjs +1 -0
- package/dist/WakeScheduler-67UeXBYK.d.mts +22 -0
- package/dist/WakeScheduler-DV4J4TRe.mjs +69 -0
- package/dist/WakeScheduler-DV4J4TRe.mjs.map +1 -0
- package/dist/WakeScheduler.d.mts +2 -0
- package/dist/WakeScheduler.mjs +1 -0
- package/dist/boundary-YrOnE2zO.mjs +41 -0
- package/dist/boundary-YrOnE2zO.mjs.map +1 -0
- package/dist/browser-failure-CWBBnf1j.mjs +70 -0
- package/dist/browser-failure-CWBBnf1j.mjs.map +1 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.mjs +17 -0
- package/dist/prepared-admission-DngoYN74.mjs +57 -0
- package/dist/prepared-admission-DngoYN74.mjs.map +1 -0
- package/dist/rolldown-runtime-D3KUYPsf.mjs +12 -0
- package/package.json +134 -3
- package/src/Alarm.ts +3402 -0
- package/src/BrowserCredentials.ts +181 -0
- package/src/BrowserRestCapture.ts +383 -0
- package/src/BrowserSession.ts +993 -0
- package/src/BrowserUse.ts +438 -0
- package/src/CloudflareAiGateway.ts +176 -0
- package/src/CloudflareBindings.ts +225 -0
- package/src/CloudflareBrowser.ts +9 -0
- package/src/CloudflareCodeMode.ts +896 -0
- package/src/CloudflareConfig.ts +142 -0
- package/src/CloudflareMemory.ts +418 -0
- package/src/CloudflareScheduling.ts +736 -0
- package/src/CloudflareSubscriptions.ts +1032 -0
- package/src/CloudflareThreadClient.ts +980 -0
- package/src/InteractiveBrowser.ts +3300 -0
- package/src/LiveText.ts +145 -0
- package/src/R2ToolResultStorage.ts +131 -0
- package/src/ThreadObject.ts +1348 -0
- package/src/WakeScheduler.ts +102 -0
- package/src/index.ts +16 -0
- package/src/internal/boundary.ts +53 -0
- package/src/internal/browser-binding.ts +483 -0
- package/src/internal/browser-credentials.ts +481 -0
- package/src/internal/browser-failure.ts +145 -0
- package/src/internal/browser-file-selection.ts +146 -0
- package/src/internal/browser-quick-action.ts +666 -0
- package/src/internal/browser-readonly-live-view.ts +121 -0
- package/src/internal/browser-session-lifecycle.ts +200 -0
- package/src/internal/crypto.ts +44 -0
- package/src/internal/due-queue.ts +452 -0
- package/src/internal/host-protocol-error.ts +23 -0
- package/src/internal/layers.ts +1181 -0
- package/src/internal/live-text-observation.ts +8 -0
- package/src/internal/live-text-protocol.ts +59 -0
- package/src/internal/live-text.ts +339 -0
- package/src/internal/message-delivery.ts +149 -0
- package/src/internal/page-function.ts +12 -0
- package/src/internal/prepared-admission.ts +83 -0
- package/src/internal/progress-wait.ts +121 -0
- package/src/internal/transport.ts +53 -0
- package/README.md +0 -3
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { DurableBindingFailure } from "@systemfsoftware/agent/agent-registration";
|
|
2
|
+
import { DurableAgentRuntime, DurableRuntimeConfig, DurableWorkerFailure, RecoveryFailure } from "@systemfsoftware/agent/durable-agent-runtime";
|
|
3
|
+
import { SubmissionLedger, SubmissionWorkItem } from "@systemfsoftware/agent/submission-ledger";
|
|
4
|
+
import { ThreadProjectionError, ThreadProjectionMaintenance } from "@systemfsoftware/agent/thread-projection-maintenance";
|
|
5
|
+
import { WakeScheduler } from "@systemfsoftware/agent/wake-scheduler";
|
|
6
|
+
import { DurableObjectAlarm } from "effect-cf";
|
|
7
|
+
import * as Context from "effect/Context";
|
|
8
|
+
import * as SecureRandom from "effect/crypto/SecureRandom";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Layer from "effect/Layer";
|
|
11
|
+
import * as Option from "effect/Option";
|
|
12
|
+
import * as Schema from "effect/Schema";
|
|
13
|
+
import * as Scope from "effect/Scope";
|
|
14
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
15
|
+
import * as SqlError from "effect/sql/SqlError";
|
|
16
|
+
import { i as DurableObjectContext, r as DurableAlarmError } from "./CloudflareBindings-E1Sty9Vq.mjs";
|
|
17
|
+
import { s as CloudflareDurableRuntimeConfig } from "./CloudflareConfig-BFWgEyhH.mjs";
|
|
18
|
+
declare namespace Alarm_d_exports {
|
|
19
|
+
export { DurableAlarmError, DurableAlarmService, MaintenancePassFailure, MaintenancePassReport, ThreadHostMaintenance, ThreadHostMaintenanceLane, ThreadMaintenance, ThreadMaintenanceAlarm, ThreadMaintenanceFailpoint, ThreadMaintenanceFailpointHandler, ThreadMaintenanceFailpointLocation, ThreadMessageDelivery, ThreadMutationGate, ThreadNativeMaintenance, ThreadPublication, ThreadPublicationService, ThreadRecoveryEvents, ThreadRecoveryFaultEvent, publishCommitted };
|
|
20
|
+
}
|
|
21
|
+
declare const ThreadMaintenanceAlarm_base: DurableObjectAlarm.AlarmTagClass<ThreadMaintenanceAlarm, "@systemfsoftware/agent/thread-maintenance", {
|
|
22
|
+
readonly '@systemfsoftware/agent/thread-maintenance': {
|
|
23
|
+
readonly payload: Schema.Null;
|
|
24
|
+
readonly lifecycle: "manual";
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
/** One manual alarm for the entire consumer-owned maintenance queue. */
|
|
28
|
+
declare class ThreadMaintenanceAlarm extends ThreadMaintenanceAlarm_base {}
|
|
29
|
+
declare const DurableAlarmService_base: Context.ServiceClass<DurableAlarmService, "@effect-agent/platform-cloudflare/DurableAlarmService", {
|
|
30
|
+
readonly scheduled: Effect.Effect<Option.Option<number>, DurableAlarmError>;
|
|
31
|
+
readonly scheduleAt: (epochMillis: number) => Effect.Effect<void, DurableAlarmError>;
|
|
32
|
+
readonly ensureScheduledBy: (epochMillis: number) => Effect.Effect<void, DurableAlarmError>;
|
|
33
|
+
/** Queue-aware promptness hint; idle queues stay idle and retry floors survive. */
|
|
34
|
+
readonly scheduleNow: Effect.Effect<void, DurableAlarmError>;
|
|
35
|
+
/** Coalesce droppable inline hints without delaying committed deadlines or their delivery. */
|
|
36
|
+
readonly withHintsDeferred: <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
37
|
+
readonly cancel: Effect.Effect<void, DurableAlarmError>;
|
|
38
|
+
}>;
|
|
39
|
+
/** Named maintenance checkpoint; the library owns the shared native alarm slot. */
|
|
40
|
+
declare class DurableAlarmService extends DurableAlarmService_base {
|
|
41
|
+
static readonly layer: Layer.Layer<DurableAlarmService, never, DurableObjectContext | SecureRandom.SecureRandom | SqlClient.SqlClient | ThreadMaintenanceAlarm>;
|
|
42
|
+
}
|
|
43
|
+
declare const MaintenancePassReport_base: Schema.Class<MaintenancePassReport, Schema.Struct<{
|
|
44
|
+
/** `caught-up` ran no runtime work (publication may be pending); `actionable` ran recovery. */
|
|
45
|
+
readonly phase: Schema.Literals<readonly ["caught-up", "actionable"]>;
|
|
46
|
+
/** Recovery decisions and Thread faults observed during this event. */
|
|
47
|
+
readonly recovered: Schema.Int;
|
|
48
|
+
/** Head Attempts settled during the event. Joined input may settle with each head. */
|
|
49
|
+
readonly settled: Schema.Int;
|
|
50
|
+
/** Submissions still nonterminal after the pass (suspended/unknown lanes stay honest). */
|
|
51
|
+
readonly nonterminal: Schema.Int;
|
|
52
|
+
/** `rearmed` for dirty/autonomous work, `cleared` for stable waits or settlement. */
|
|
53
|
+
readonly alarm: Schema.Literals<readonly ["rearmed", "cleared"]>;
|
|
54
|
+
}>, {}>;
|
|
55
|
+
declare class MaintenancePassReport extends MaintenancePassReport_base {}
|
|
56
|
+
/** Fault boundaries around every maintenance-owned durable mutation. */
|
|
57
|
+
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';
|
|
58
|
+
type ThreadMaintenanceFailpointHandler = (location: ThreadMaintenanceFailpointLocation) => Effect.Effect<void>;
|
|
59
|
+
declare const ThreadMaintenanceFailpoint_base: Context.ServiceClass<ThreadMaintenanceFailpoint, "@effect-agent/platform-cloudflare/ThreadMaintenanceFailpoint", {
|
|
60
|
+
readonly hit: ThreadMaintenanceFailpointHandler;
|
|
61
|
+
}>;
|
|
62
|
+
/** Test-only fault authority; production uses the inert layer. */
|
|
63
|
+
declare class ThreadMaintenanceFailpoint extends ThreadMaintenanceFailpoint_base {
|
|
64
|
+
static readonly layer: Layer.Layer<ThreadMaintenanceFailpoint, never, never>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Durable host publication of canonical records and ledger approval/abort/resolution intents.
|
|
68
|
+
* The host owns schema-versioned cursors, destination idempotency and acknowledgement. Delivery
|
|
69
|
+
* is at least once. Hooks must not write the alarm slot or mutate the supplied raw source ports.
|
|
70
|
+
*
|
|
71
|
+
* `invalidate` and `prepareGeneration` must be bounded local operations.
|
|
72
|
+
* `prepareGeneration` durably invalidates a scan only when its generation changes; repeated
|
|
73
|
+
* calls must preserve partial scan progress. It runs with no source mutation in flight.
|
|
74
|
+
* Use this gate only for publication required before dependent native execution. Independent
|
|
75
|
+
* UI relays and outboxes belong to ThreadHostMaintenance.
|
|
76
|
+
* `drain` performs bounded delivery and returns its next deadline (None when caught up),
|
|
77
|
+
* after persisting receipts and retries. A pending deadline
|
|
78
|
+
* defers runtime recovery/Attempts, allowing committed host publications to drain first.
|
|
79
|
+
* Unexpected hook failures leave the prearmed generation for retry. Hooks acquire per-call
|
|
80
|
+
* resources with Effect.scoped; Layer construction owns incarnation resources (eviction need
|
|
81
|
+
* not run finalizers). Do not hold a local hook behind network I/O or call back into producers.
|
|
82
|
+
*/
|
|
83
|
+
interface ThreadPublicationService {
|
|
84
|
+
readonly invalidate: Effect.Effect<void, DurableAlarmError>;
|
|
85
|
+
readonly prepareGeneration: (generation: bigint) => Effect.Effect<void, DurableAlarmError>;
|
|
86
|
+
readonly drain: Effect.Effect<Option.Option<number>, DurableAlarmError>;
|
|
87
|
+
}
|
|
88
|
+
declare const ThreadPublication_base: Context.ServiceClass<ThreadPublication, "@effect-agent/platform-cloudflare/ThreadPublication", ThreadPublicationService>;
|
|
89
|
+
/** Opt in with `ThreadObject.layer(registrations, { publication: Layer.effect(ThreadPublication)(...) })`. */
|
|
90
|
+
declare class ThreadPublication extends ThreadPublication_base {
|
|
91
|
+
static readonly layer: Layer.Layer<ThreadPublication, never, never>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Host-assembled native message recovery. Preparation is a bounded local selection; the
|
|
95
|
+
* driver bounds each actual Claim and persists its timeout/retry before `run` returns.
|
|
96
|
+
* The alarm must not add a timer starting at selection: Claim setup and retry commits belong
|
|
97
|
+
* to the driver. The prepared allowance decides only whether a wave fits this event.
|
|
98
|
+
*/
|
|
99
|
+
declare const ThreadMessageDelivery: Context.Reference<{
|
|
100
|
+
readonly prepare: Effect.Effect<{
|
|
101
|
+
readonly timeoutMillis: number;
|
|
102
|
+
readonly run: Effect.Effect<Option.Option<number>, DurableAlarmError>;
|
|
103
|
+
}, DurableAlarmError>;
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* One explicitly scheduled application obligation. IDs are stable and unique within the
|
|
107
|
+
* physical Object; the `@systemfsoftware/agent:` prefix is reserved. There is no initial host wave.
|
|
108
|
+
* Producers enroll only affected IDs through ThreadMutationGate.withMutation({ lanes })
|
|
109
|
+
* or schedule(id, dueAt). A lane returns its next epoch-millisecond deadline (None = idle)
|
|
110
|
+
* with its finite wave, after persisting claims, receipts and retries. No deadline callback
|
|
111
|
+
* or polling is used. A racing producer keeps its newer revision due.
|
|
112
|
+
*
|
|
113
|
+
* The 1..300000ms allowance includes selection, dispatch, commits and scoped cleanup.
|
|
114
|
+
* Failed waves retain independent backoff and are not retried in the same event. Delivery
|
|
115
|
+
* remains at least once: persist exact envelopes and deduplicate by domain receipt identity.
|
|
116
|
+
* Hooks never write the alarm slot. Required execution gates belong to ThreadPublication.
|
|
117
|
+
*/
|
|
118
|
+
interface ThreadHostMaintenanceLane {
|
|
119
|
+
readonly id: string;
|
|
120
|
+
/** Omission runs concurrently with native work. After-native lanes get one due wave
|
|
121
|
+
* after all admitted native Attempts and their scoped cleanup, even on native failure.
|
|
122
|
+
* They share the event deadline and remain inside the maintenance pass permit.
|
|
123
|
+
* Newly enrolled concurrent work yields this phase after scoped cleanup; unfinished
|
|
124
|
+
* waves retain their due revision and domain receipts for the next alarm.
|
|
125
|
+
*/
|
|
126
|
+
readonly phase?: 'concurrent' | 'after-native';
|
|
127
|
+
readonly dispatchTimeoutMillis: number;
|
|
128
|
+
readonly run: Effect.Effect<Option.Option<number>, DurableAlarmError, Scope.Scope>;
|
|
129
|
+
}
|
|
130
|
+
/** Independent lanes share the existing alarm; compose hosts by concatenating their lanes. */
|
|
131
|
+
declare const ThreadHostMaintenance: Context.Reference<{
|
|
132
|
+
readonly lanes: ReadonlyArray<ThreadHostMaintenanceLane>;
|
|
133
|
+
}>;
|
|
134
|
+
/** @internal Framework handlers are separate from host registrations and their namespace. */
|
|
135
|
+
declare const ThreadNativeMaintenance: Context.Reference<{
|
|
136
|
+
readonly lanes: ReadonlyArray<ThreadHostMaintenanceLane>;
|
|
137
|
+
/** Exact runtime built over a single-Thread placement; never apply to a replacement. */
|
|
138
|
+
readonly singleThreadRuntime?: DurableAgentRuntime['Service'];
|
|
139
|
+
}>;
|
|
140
|
+
/** @internal Required host publication only; native lifecycle facts use a maintenance lane. */
|
|
141
|
+
declare const publishCommitted: Effect.Effect<void, never, ThreadPublication>;
|
|
142
|
+
declare const ThreadRecoveryFaultEvent_base: Schema.Class<ThreadRecoveryFaultEvent, Schema.Struct<{
|
|
143
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
144
|
+
/** Monotonic within the physical Object; retained unchanged on delivery retries. */
|
|
145
|
+
readonly sequence: Schema.BigIntFromString;
|
|
146
|
+
readonly transition: Schema.Literals<readonly ["created", "changed", "cleared"]>;
|
|
147
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
148
|
+
readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
|
|
149
|
+
readonly occurredAt: Schema.Finite;
|
|
150
|
+
readonly firstFailedAt: Schema.Finite;
|
|
151
|
+
/** The current failure, or the last failure for a cleared event. */
|
|
152
|
+
readonly failure: typeof RecoveryFailure;
|
|
153
|
+
}>, {}>;
|
|
154
|
+
/** A committed recovery transition for one affected Submission; never a Settlement. */
|
|
155
|
+
declare class ThreadRecoveryFaultEvent extends ThreadRecoveryFaultEvent_base {}
|
|
156
|
+
declare const ThreadRecoveryEvents_base: Context.ServiceClass<ThreadRecoveryEvents, "@effect-agent/platform-cloudflare/ThreadRecoveryEvents", {
|
|
157
|
+
readonly publish: (event: ThreadRecoveryFaultEvent) => Effect.Effect<void, DurableAlarmError>;
|
|
158
|
+
}>;
|
|
159
|
+
/**
|
|
160
|
+
* Ordered, at-least-once delivery through the existing host maintenance lane. Return only
|
|
161
|
+
* after durably applying the event or retaining it in a host outbox. Deduplicate by physical
|
|
162
|
+
* Object and sequence; callbacks may repeat after interruption. This is a trusted host hook,
|
|
163
|
+
* not pre-authorized UI data: the host owns recipient authorization and safe presentation.
|
|
164
|
+
* Capture services in the Layer. Do not call producers or write the raw alarm slot.
|
|
165
|
+
* Without this service, maintenance acknowledges and discards transitions. Install the
|
|
166
|
+
* handler before the first maintenance pass if the application needs that event stream.
|
|
167
|
+
*/
|
|
168
|
+
declare class ThreadRecoveryEvents extends ThreadRecoveryEvents_base {}
|
|
169
|
+
declare const ThreadMutationGate_base: Context.ServiceClass<ThreadMutationGate, "@effect-agent/platform-cloudflare/internal/ThreadMutationGate", {
|
|
170
|
+
/** Commit source facts and their scheduling intent together. Mutate from this callback's
|
|
171
|
+
* fiber, or use an explicit child transaction. The flush runs before native commit;
|
|
172
|
+
* failed or interrupted transactions discard their queue view. */
|
|
173
|
+
readonly withTransaction: <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E | SqlError.SqlError, R>;
|
|
174
|
+
readonly withMutation: <A, E, R>(body: Effect.Effect<A, E, R>,
|
|
175
|
+
/**
|
|
176
|
+
* Call outside SQL transactions so prearming commits before the body runs.
|
|
177
|
+
* Native admission, approval, abort and unknown resolution keep the default true.
|
|
178
|
+
* Host producers use false and name only the lanes for which they create work.
|
|
179
|
+
* Receipt-only bookkeeping with no new obligation names no lanes. Enrollment preserves
|
|
180
|
+
* a pending retry budget; idle completion or actual source progress replenishes it.
|
|
181
|
+
* Actual new work must record that progress in its source transaction, so a commit
|
|
182
|
+
* after parking cannot be stranded by eviction before this body returns.
|
|
183
|
+
*/
|
|
184
|
+
options?: {
|
|
185
|
+
readonly invalidatesRecovery?: boolean;
|
|
186
|
+
readonly lanes?: ReadonlyArray<string>;
|
|
187
|
+
}) => Effect.Effect<A, E | DurableAlarmError, R>;
|
|
188
|
+
/** Enroll a known lane without accelerating its retry floor. A strictly increasing
|
|
189
|
+
* source cursor replenishes its budget; equal/older notices are replayed hints.
|
|
190
|
+
* Cursors identify committed source facts, never clocks, attempts or retry counters.
|
|
191
|
+
* Local sources call inside their source transaction. Remote sources retain the cursor
|
|
192
|
+
* notice with their work and retry delivery here; this call atomically accepts that
|
|
193
|
+
* notice and its alarm. Prearming alone cannot fence a later remote commit. */
|
|
194
|
+
readonly schedule: (id: string, dueAt: number, progressCursor?: bigint) => Effect.Effect<void, DurableAlarmError>;
|
|
195
|
+
/** Record an actual new fact inside its local source SQL transaction. The source
|
|
196
|
+
* transaction owns duplicate detection. Claims, lease renewals and retries are not progress.
|
|
197
|
+
* Also enrolls the lanes selected by this producer's enclosing withMutation boundary. */
|
|
198
|
+
readonly recordProgress: (lanes: ReadonlyArray<string>) => Effect.Effect<void, DurableAlarmError>;
|
|
199
|
+
/** In-incarnation notification; the durable due queue is the recovery authority. */
|
|
200
|
+
readonly activeLanes: Effect.Effect<ReadonlySet<string>>;
|
|
201
|
+
readonly revision: Effect.Effect<number>;
|
|
202
|
+
readonly awaitChange: (revision: number) => Effect.Effect<void>;
|
|
203
|
+
/** Register an incarnation-local observer; its caller must detach it on completion. */
|
|
204
|
+
readonly observeChange: (revision: number, notify: () => void) => () => void;
|
|
205
|
+
readonly withSnapshot: <A, E, R>(body: (active: number) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
206
|
+
}>;
|
|
207
|
+
declare class ThreadMutationGate extends ThreadMutationGate_base {
|
|
208
|
+
static readonly layer: Layer.Layer<ThreadMutationGate, DurableAlarmError, CloudflareDurableRuntimeConfig | DurableObjectContext | SecureRandom.SecureRandom | SqlClient.SqlClient | ThreadMaintenanceAlarm | ThreadMaintenanceFailpoint>;
|
|
209
|
+
}
|
|
210
|
+
type MaintenancePassFailure = DurableWorkerFailure | DurableBindingFailure | DurableAlarmError | ThreadProjectionError;
|
|
211
|
+
declare const ThreadMaintenance_base: Context.ServiceClass<ThreadMaintenance, "@effect-agent/platform-cloudflare/ThreadMaintenance", {
|
|
212
|
+
/** One idempotent pass; failures propagate after durably scheduling bounded recovery. */
|
|
213
|
+
readonly pass: Effect.Effect<MaintenancePassReport, MaintenancePassFailure>;
|
|
214
|
+
/** Start a committed admission under the same bounded processing and recovery guard. */
|
|
215
|
+
readonly start: (admission: Pick<SubmissionWorkItem, 'threadId' | 'submissionId'>) => Effect.Effect<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Constructor gate: initialize/inspect only the O(1) maintenance record and ensure a dirty
|
|
218
|
+
* generation has an alarm. It never scans the ledger or canonical history.
|
|
219
|
+
*/
|
|
220
|
+
readonly ensureAlarm: Effect.Effect<void, MaintenancePassFailure>;
|
|
221
|
+
/**
|
|
222
|
+
* Serialize the pre-arm boundary with pass acknowledgement, advance the durable dirty
|
|
223
|
+
* generation and arm the alarm in one transaction BEFORE running the caller's mutation.
|
|
224
|
+
* A pass cannot acknowledge while that mutation remains in flight.
|
|
225
|
+
*/
|
|
226
|
+
readonly withMutation: <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E | DurableAlarmError, R>;
|
|
227
|
+
}>;
|
|
228
|
+
/**
|
|
229
|
+
* Incremental, quiescent maintenance over a durable dirty/processed generation (issue #93).
|
|
230
|
+
*
|
|
231
|
+
* One physical event owns native scheduling, auxiliary delivery and final alarm rearming.
|
|
232
|
+
*
|
|
233
|
+
* 1. Prearm before any work. A caught-up native step uses the O(1) generation record without
|
|
234
|
+
* recovery, ledger scans or canonical-history reads.
|
|
235
|
+
* 2. Reconcile before each head Attempt, then checkpoint only the observed generation. A racing
|
|
236
|
+
* producer keeps its generation dirty and immediately eligible. Quiescent native retries
|
|
237
|
+
* retain their durable backoff.
|
|
238
|
+
* 3. Admit one Attempt for a single-Thread runtime, or at most two independent Thread
|
|
239
|
+
* Attempts for a shared host, with one active head per Thread.
|
|
240
|
+
* Keep native and delivery admission open together while finite waves remain active, so
|
|
241
|
+
* fresh replies and abort controls can progress during unrelated cleanup. Close atomically
|
|
242
|
+
* at quiescence, or at the original ten-minute yield deadline, then join admitted waves.
|
|
243
|
+
* 4. Native message delivery retains its driver-owned Claim deadline. Host/backfill waves are
|
|
244
|
+
* bounded independently; incoming native work never restarts or cancels their attempts.
|
|
245
|
+
* Auxiliary failures are reported after the current native opportunity.
|
|
246
|
+
* 5. Close every event resource before the final gated deadline snapshot and alarm decision.
|
|
247
|
+
* The whole event retains one fourteen-minute cooperative timeout.
|
|
248
|
+
*/
|
|
249
|
+
declare class ThreadMaintenance extends ThreadMaintenance_base {
|
|
250
|
+
static readonly layer: Layer.Layer<ThreadMaintenance, DurableAlarmError, ThreadMutationGate | ThreadPublication | ThreadProjectionMaintenance | DurableAgentRuntime | DurableRuntimeConfig | SubmissionLedger | WakeScheduler | DurableAlarmService | ThreadMaintenanceAlarm | ThreadMaintenanceFailpoint | CloudflareDurableRuntimeConfig | DurableObjectContext | SqlClient.SqlClient | SecureRandom.SecureRandom>;
|
|
251
|
+
}
|
|
252
|
+
export { ThreadRecoveryEvents as _, ThreadHostMaintenance as a, ThreadMaintenanceAlarm as c, ThreadMaintenanceFailpointLocation as d, ThreadMessageDelivery as f, ThreadPublicationService as g, ThreadPublication as h, MaintenancePassReport as i, ThreadMaintenanceFailpoint as l, ThreadNativeMaintenance as m, DurableAlarmService as n, ThreadHostMaintenanceLane as o, ThreadMutationGate as p, MaintenancePassFailure as r, ThreadMaintenance as s, Alarm_d_exports as t, ThreadMaintenanceFailpointHandler as u, ThreadRecoveryFaultEvent as v, publishCommitted as y };
|
package/dist/Alarm.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { r as DurableAlarmError } from "./CloudflareBindings-E1Sty9Vq.mjs";
|
|
2
|
+
import { _ as ThreadRecoveryEvents, a as ThreadHostMaintenance, c as ThreadMaintenanceAlarm, d as ThreadMaintenanceFailpointLocation, f as ThreadMessageDelivery, g as ThreadPublicationService, h as ThreadPublication, i as MaintenancePassReport, l as ThreadMaintenanceFailpoint, m as ThreadNativeMaintenance, n as DurableAlarmService, o as ThreadHostMaintenanceLane, p as ThreadMutationGate, r as MaintenancePassFailure, s as ThreadMaintenance, u as ThreadMaintenanceFailpointHandler, v as ThreadRecoveryFaultEvent, y as publishCommitted } from "./Alarm-Nz1gIjfv.mjs";
|
|
3
|
+
export { DurableAlarmError, DurableAlarmService, MaintenancePassFailure, MaintenancePassReport, ThreadHostMaintenance, ThreadHostMaintenanceLane, ThreadMaintenance, ThreadMaintenanceAlarm, ThreadMaintenanceFailpoint, ThreadMaintenanceFailpointHandler, ThreadMaintenanceFailpointLocation, ThreadMessageDelivery, ThreadMutationGate, ThreadNativeMaintenance, ThreadPublication, ThreadPublicationService, ThreadRecoveryEvents, ThreadRecoveryFaultEvent, publishCommitted };
|
package/dist/Alarm.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { r as DurableAlarmError } from "./CloudflareBindings-Dylkir84.mjs";
|
|
2
|
+
import { a as ThreadMaintenance, c as ThreadMessageDelivery, d as ThreadPublication, f as ThreadRecoveryEvents, i as ThreadHostMaintenance, l as ThreadMutationGate, m as publishCommitted, n as DurableAlarmService, o as ThreadMaintenanceAlarm, p as ThreadRecoveryFaultEvent, r as MaintenancePassReport, s as ThreadMaintenanceFailpoint, u as ThreadNativeMaintenance } from "./Alarm-CbhflIzz.mjs";
|
|
3
|
+
export { DurableAlarmError, DurableAlarmService, MaintenancePassReport, ThreadHostMaintenance, ThreadMaintenance, ThreadMaintenanceAlarm, ThreadMaintenanceFailpoint, ThreadMessageDelivery, ThreadMutationGate, ThreadNativeMaintenance, ThreadPublication, ThreadRecoveryEvents, ThreadRecoveryFaultEvent, publishCommitted };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
declare namespace BrowserCredentials_d_exports {
|
|
5
|
+
export { BrowserCredentialAccess, BrowserCredentialMaterial, CardCredential, CredentialAccessError, CredentialAccessRequest, CredentialBinding, CredentialDispatch, CredentialFieldRole, CredentialFillError, CredentialFillResult, CredentialForm, CredentialKind, CredentialOrigin, CredentialTarget, FillCredentialRequest, LoginCredential };
|
|
6
|
+
}
|
|
7
|
+
declare const CredentialKind: Schema.Literals<readonly ["login", "card"]>;
|
|
8
|
+
declare const CredentialFieldRole: Schema.Literals<readonly ["username", "password", "card-name", "card-number", "card-expiry", "card-expiry-month", "card-expiry-year", "card-security-code"]>;
|
|
9
|
+
/** Canonical HTTPS origins, including non-default ports. Grants must match exactly. */
|
|
10
|
+
declare const CredentialOrigin: Schema.String;
|
|
11
|
+
declare const CredentialTarget_base: Schema.Class<CredentialTarget, Schema.Struct<{
|
|
12
|
+
readonly topOrigin: Schema.String;
|
|
13
|
+
readonly frameOrigin: Schema.String;
|
|
14
|
+
readonly recipientOrigin: Schema.String;
|
|
15
|
+
}>, {}>;
|
|
16
|
+
declare class CredentialTarget extends CredentialTarget_base {}
|
|
17
|
+
declare const CredentialForm_base: Schema.Class<CredentialForm, Schema.Struct<{
|
|
18
|
+
readonly kind: Schema.Literals<readonly ["login", "card"]>;
|
|
19
|
+
readonly frame: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
20
|
+
readonly fields: Schema.$Array<Schema.Struct<{
|
|
21
|
+
readonly selector: Schema.NonEmptyString;
|
|
22
|
+
readonly role: Schema.Literals<readonly ["username", "password", "card-name", "card-number", "card-expiry", "card-expiry-month", "card-expiry-year", "card-security-code"]>;
|
|
23
|
+
}>>;
|
|
24
|
+
}>, {}>;
|
|
25
|
+
/** Selectors identify one native form. Roles explicitly select material; no field inference occurs. */
|
|
26
|
+
declare class CredentialForm extends CredentialForm_base {}
|
|
27
|
+
declare const CredentialBinding_base: Schema.Class<CredentialBinding, Schema.Struct<{
|
|
28
|
+
readonly version: Schema.Literal<1>;
|
|
29
|
+
readonly pageId: Schema.NonEmptyString;
|
|
30
|
+
readonly frameId: Schema.NonEmptyString;
|
|
31
|
+
readonly target: typeof CredentialTarget;
|
|
32
|
+
readonly nodes: Schema.$Array<Schema.Int>;
|
|
33
|
+
readonly shape: Schema.String;
|
|
34
|
+
}>, {}>;
|
|
35
|
+
/**
|
|
36
|
+
* Private, persistable evidence for an exact page, document and native form controls.
|
|
37
|
+
* Keep it with the host's one-use request, never accept a binding from a model or submitter.
|
|
38
|
+
* A detached document or replaced control requires a fresh user request.
|
|
39
|
+
*/
|
|
40
|
+
declare class CredentialBinding extends CredentialBinding_base {}
|
|
41
|
+
declare const FillCredentialRequest_base: Schema.Class<FillCredentialRequest, Schema.Struct<{
|
|
42
|
+
readonly kind: Schema.Literals<readonly ["login", "card"]>;
|
|
43
|
+
readonly frame: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
44
|
+
readonly fields: Schema.$Array<Schema.Struct<{
|
|
45
|
+
readonly selector: Schema.NonEmptyString;
|
|
46
|
+
readonly role: Schema.Literals<readonly ["username", "password", "card-name", "card-number", "card-expiry", "card-expiry-month", "card-expiry-year", "card-security-code"]>;
|
|
47
|
+
}>>;
|
|
48
|
+
readonly credential: Schema.NonEmptyString;
|
|
49
|
+
/** Required for delayed user entry; omitted for immediate, host-authorized vault fills. */
|
|
50
|
+
readonly binding: Schema.optionalKey<typeof CredentialBinding>;
|
|
51
|
+
}>, {}>;
|
|
52
|
+
declare class FillCredentialRequest extends FillCredentialRequest_base {}
|
|
53
|
+
/** Host-only material. Never return or encode it through a Tool, log, trace, or checkpoint. */
|
|
54
|
+
declare const LoginCredential: Schema.TaggedStruct<"LoginCredential", {
|
|
55
|
+
readonly username: Schema.Redacted<Schema.NonEmptyString>;
|
|
56
|
+
readonly password: Schema.Redacted<Schema.NonEmptyString>;
|
|
57
|
+
}>;
|
|
58
|
+
/** Security codes are transient; the host must not persist them. */
|
|
59
|
+
declare const CardCredential: Schema.TaggedStruct<"CardCredential", {
|
|
60
|
+
readonly name: Schema.Redacted<Schema.NonEmptyString>;
|
|
61
|
+
readonly number: Schema.Redacted<Schema.String>;
|
|
62
|
+
readonly expiry: Schema.Redacted<Schema.NonEmptyString>;
|
|
63
|
+
readonly expiryMonth: Schema.Redacted<Schema.String>;
|
|
64
|
+
readonly expiryYear: Schema.Redacted<Schema.String>;
|
|
65
|
+
readonly securityCode: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
66
|
+
}>;
|
|
67
|
+
declare const BrowserCredentialMaterial: Schema.Union<readonly [Schema.TaggedStruct<"LoginCredential", {
|
|
68
|
+
readonly username: Schema.Redacted<Schema.NonEmptyString>;
|
|
69
|
+
readonly password: Schema.Redacted<Schema.NonEmptyString>;
|
|
70
|
+
}>, Schema.TaggedStruct<"CardCredential", {
|
|
71
|
+
readonly name: Schema.Redacted<Schema.NonEmptyString>;
|
|
72
|
+
readonly number: Schema.Redacted<Schema.String>;
|
|
73
|
+
readonly expiry: Schema.Redacted<Schema.NonEmptyString>;
|
|
74
|
+
readonly expiryMonth: Schema.Redacted<Schema.String>;
|
|
75
|
+
readonly expiryYear: Schema.Redacted<Schema.String>;
|
|
76
|
+
readonly securityCode: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
77
|
+
}>]>;
|
|
78
|
+
type BrowserCredentialMaterial = typeof BrowserCredentialMaterial.Type;
|
|
79
|
+
declare const CredentialAccessError_base: Schema.Class<CredentialAccessError, Schema.TaggedStruct<"CredentialAccessError", {
|
|
80
|
+
readonly reason: Schema.Literals<readonly ["denied", "missing-credential", "needs-attention", "busy", "resolver"]>;
|
|
81
|
+
}>, import("effect/Cause").YieldableError>;
|
|
82
|
+
declare class CredentialAccessError extends CredentialAccessError_base {}
|
|
83
|
+
interface CredentialAccessRequest {
|
|
84
|
+
readonly credential: string;
|
|
85
|
+
readonly kind: typeof CredentialKind.Type;
|
|
86
|
+
readonly target: CredentialTarget;
|
|
87
|
+
readonly roles: ReadonlyArray<typeof CredentialFieldRole.Type>;
|
|
88
|
+
}
|
|
89
|
+
declare const BrowserCredentialAccess_base: Context.ServiceClass<BrowserCredentialAccess, "@effect-agent/platform-cloudflare/BrowserCredentialAccess", {
|
|
90
|
+
readonly authorize: (request: CredentialAccessRequest) => Effect.Effect<void, CredentialAccessError>;
|
|
91
|
+
readonly resolve: (request: CredentialAccessRequest) => Effect.Effect<BrowserCredentialMaterial, CredentialAccessError>;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Invocation-owned authority. Derive caller/ownership from the host, not the public credential
|
|
95
|
+
* identifier. Authorize the actual merchant, frame, recipient, roles, and side effects of filling.
|
|
96
|
+
* Repeated checks must consult current grants. Never log or trace resolved material.
|
|
97
|
+
* Bind caller identity and identifier-to-vault-item selection for the whole invocation; an alias
|
|
98
|
+
* changing between resolve and authorize must never authorize different material.
|
|
99
|
+
*/
|
|
100
|
+
declare class BrowserCredentialAccess extends BrowserCredentialAccess_base {}
|
|
101
|
+
declare const CredentialDispatch: Schema.Literals<readonly ["not-dispatched", "possibly-dispatched", "dispatched"]>;
|
|
102
|
+
declare const CredentialFillResult_base: Schema.Class<CredentialFillResult, Schema.Struct<{
|
|
103
|
+
readonly dispatch: Schema.Literal<"dispatched">;
|
|
104
|
+
readonly filled: Schema.Natural;
|
|
105
|
+
}>, {}>;
|
|
106
|
+
/** Filled counts acknowledged assignments, not authentication, submission, or website acceptance. */
|
|
107
|
+
declare class CredentialFillResult extends CredentialFillResult_base {}
|
|
108
|
+
declare const CredentialFillError_base: Schema.Class<CredentialFillError, Schema.TaggedStruct<"CredentialFillError", {
|
|
109
|
+
readonly reason: Schema.Literals<readonly ["denied", "missing-credential", "stale-target", "unsupported", "needs-attention", "busy", "provider", "resolver", "timeout"]>;
|
|
110
|
+
readonly dispatch: Schema.Literals<readonly ["not-dispatched", "possibly-dispatched", "dispatched"]>;
|
|
111
|
+
readonly filled: Schema.Natural;
|
|
112
|
+
readonly cleanup: Schema.Literals<readonly ["not-requested", "confirmed", "unconfirmed"]>;
|
|
113
|
+
}>, import("effect/Cause").YieldableError>;
|
|
114
|
+
/** Content-free evidence. A lost reply never authorizes a retry or proves that no write occurred. */
|
|
115
|
+
declare class CredentialFillError extends CredentialFillError_base {}
|
|
116
|
+
export { LoginCredential as _, CredentialAccessError as a, CredentialDispatch as c, CredentialFillResult as d, CredentialForm as f, FillCredentialRequest as g, CredentialTarget as h, CardCredential as i, CredentialFieldRole as l, CredentialOrigin as m, BrowserCredentialMaterial as n, CredentialAccessRequest as o, CredentialKind as p, BrowserCredentials_d_exports as r, CredentialBinding as s, BrowserCredentialAccess as t, CredentialFillError as u };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.mjs";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
// src/BrowserCredentials.ts
|
|
5
|
+
var BrowserCredentials_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
BrowserCredentialAccess: () => BrowserCredentialAccess,
|
|
7
|
+
BrowserCredentialMaterial: () => BrowserCredentialMaterial,
|
|
8
|
+
CardCredential: () => CardCredential,
|
|
9
|
+
CredentialAccessError: () => CredentialAccessError,
|
|
10
|
+
CredentialBinding: () => CredentialBinding,
|
|
11
|
+
CredentialDispatch: () => CredentialDispatch,
|
|
12
|
+
CredentialFieldRole: () => CredentialFieldRole,
|
|
13
|
+
CredentialFillError: () => CredentialFillError,
|
|
14
|
+
CredentialFillResult: () => CredentialFillResult,
|
|
15
|
+
CredentialForm: () => CredentialForm,
|
|
16
|
+
CredentialKind: () => CredentialKind,
|
|
17
|
+
CredentialOrigin: () => CredentialOrigin,
|
|
18
|
+
CredentialTarget: () => CredentialTarget,
|
|
19
|
+
FillCredentialRequest: () => FillCredentialRequest,
|
|
20
|
+
LoginCredential: () => LoginCredential
|
|
21
|
+
});
|
|
22
|
+
const Selector = Schema.NonEmptyString.check(Schema.isMaxLength(2048));
|
|
23
|
+
const CredentialKind = Schema.Literals(["login", "card"]);
|
|
24
|
+
const CredentialFieldRole = Schema.Literals([
|
|
25
|
+
"username",
|
|
26
|
+
"password",
|
|
27
|
+
"card-name",
|
|
28
|
+
"card-number",
|
|
29
|
+
"card-expiry",
|
|
30
|
+
"card-expiry-month",
|
|
31
|
+
"card-expiry-year",
|
|
32
|
+
"card-security-code"
|
|
33
|
+
]);
|
|
34
|
+
/** Canonical HTTPS origins, including non-default ports. Grants must match exactly. */
|
|
35
|
+
const CredentialOrigin = Schema.String.check(Schema.isMaxLength(2048), Schema.makeFilter((value) => {
|
|
36
|
+
try {
|
|
37
|
+
const url = new URL(value);
|
|
38
|
+
return url.protocol === "https:" && url.origin === value && !url.username && !url.password;
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
var CredentialTarget = class extends Schema.Class("CredentialTarget")({
|
|
44
|
+
topOrigin: CredentialOrigin,
|
|
45
|
+
frameOrigin: CredentialOrigin,
|
|
46
|
+
recipientOrigin: CredentialOrigin
|
|
47
|
+
}) {};
|
|
48
|
+
/** Selectors identify one native form. Roles explicitly select material; no field inference occurs. */
|
|
49
|
+
var CredentialForm = class extends Schema.Class("CredentialForm")({
|
|
50
|
+
kind: CredentialKind,
|
|
51
|
+
frame: Schema.optionalKey(Schema.Array(Selector).check(Schema.isMaxLength(8))),
|
|
52
|
+
fields: Schema.Array(Schema.Struct({
|
|
53
|
+
selector: Selector,
|
|
54
|
+
role: CredentialFieldRole
|
|
55
|
+
})).check(Schema.isMinLength(1), Schema.isMaxLength(8))
|
|
56
|
+
}) {};
|
|
57
|
+
/**
|
|
58
|
+
* Private, persistable evidence for an exact page, document and native form controls.
|
|
59
|
+
* Keep it with the host's one-use request, never accept a binding from a model or submitter.
|
|
60
|
+
* A detached document or replaced control requires a fresh user request.
|
|
61
|
+
*/
|
|
62
|
+
var CredentialBinding = class extends Schema.Class("CredentialBinding")({
|
|
63
|
+
version: Schema.Literal(1),
|
|
64
|
+
pageId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
65
|
+
frameId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
66
|
+
target: CredentialTarget,
|
|
67
|
+
nodes: Schema.Array(Schema.Int.check(Schema.isGreaterThan(0))).check(Schema.isMinLength(3), Schema.isMaxLength(10)),
|
|
68
|
+
shape: Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/))
|
|
69
|
+
}) {};
|
|
70
|
+
var FillCredentialRequest = class extends Schema.Class("FillCredentialRequest")({
|
|
71
|
+
...CredentialForm.fields,
|
|
72
|
+
credential: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
73
|
+
/** Required for delayed user entry; omitted for immediate, host-authorized vault fills. */
|
|
74
|
+
binding: Schema.optionalKey(CredentialBinding)
|
|
75
|
+
}) {};
|
|
76
|
+
const SecretText = Schema.Redacted(Schema.NonEmptyString.check(Schema.isMaxLength(1024)), { disallowJsonEncode: true });
|
|
77
|
+
/** Host-only material. Never return or encode it through a Tool, log, trace, or checkpoint. */
|
|
78
|
+
const LoginCredential = Schema.TaggedStruct("LoginCredential", {
|
|
79
|
+
username: SecretText,
|
|
80
|
+
password: SecretText
|
|
81
|
+
});
|
|
82
|
+
/** Security codes are transient; the host must not persist them. */
|
|
83
|
+
const CardCredential = Schema.TaggedStruct("CardCredential", {
|
|
84
|
+
name: SecretText,
|
|
85
|
+
number: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{12,19}$/)), { disallowJsonEncode: true }),
|
|
86
|
+
expiry: SecretText,
|
|
87
|
+
expiryMonth: Schema.Redacted(Schema.String.check(Schema.isPattern(/^(0[1-9]|1[0-2])$/)), { disallowJsonEncode: true }),
|
|
88
|
+
expiryYear: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{4}$/)), { disallowJsonEncode: true }),
|
|
89
|
+
securityCode: Schema.optionalKey(Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{3,4}$/)), { disallowJsonEncode: true }))
|
|
90
|
+
});
|
|
91
|
+
const BrowserCredentialMaterial = Schema.Union([LoginCredential, CardCredential]);
|
|
92
|
+
var CredentialAccessError = class extends Schema.TaggedError()("CredentialAccessError", { reason: Schema.Literals([
|
|
93
|
+
"denied",
|
|
94
|
+
"missing-credential",
|
|
95
|
+
"needs-attention",
|
|
96
|
+
"busy",
|
|
97
|
+
"resolver"
|
|
98
|
+
]) }) {};
|
|
99
|
+
/**
|
|
100
|
+
* Invocation-owned authority. Derive caller/ownership from the host, not the public credential
|
|
101
|
+
* identifier. Authorize the actual merchant, frame, recipient, roles, and side effects of filling.
|
|
102
|
+
* Repeated checks must consult current grants. Never log or trace resolved material.
|
|
103
|
+
* Bind caller identity and identifier-to-vault-item selection for the whole invocation; an alias
|
|
104
|
+
* changing between resolve and authorize must never authorize different material.
|
|
105
|
+
*/
|
|
106
|
+
var BrowserCredentialAccess = class extends Context.Service()("@effect-agent/platform-cloudflare/BrowserCredentialAccess") {};
|
|
107
|
+
const CredentialDispatch = Schema.Literals([
|
|
108
|
+
"not-dispatched",
|
|
109
|
+
"possibly-dispatched",
|
|
110
|
+
"dispatched"
|
|
111
|
+
]);
|
|
112
|
+
/** Filled counts acknowledged assignments, not authentication, submission, or website acceptance. */
|
|
113
|
+
var CredentialFillResult = class extends Schema.Class("CredentialFillResult")({
|
|
114
|
+
dispatch: Schema.Literal("dispatched"),
|
|
115
|
+
filled: Schema.Natural.check(Schema.isLessThanOrEqualTo(8))
|
|
116
|
+
}) {};
|
|
117
|
+
/** Content-free evidence. A lost reply never authorizes a retry or proves that no write occurred. */
|
|
118
|
+
var CredentialFillError = class extends Schema.TaggedError()("CredentialFillError", {
|
|
119
|
+
reason: Schema.Literals([
|
|
120
|
+
"denied",
|
|
121
|
+
"missing-credential",
|
|
122
|
+
"stale-target",
|
|
123
|
+
"unsupported",
|
|
124
|
+
"needs-attention",
|
|
125
|
+
"busy",
|
|
126
|
+
"provider",
|
|
127
|
+
"resolver",
|
|
128
|
+
"timeout"
|
|
129
|
+
]),
|
|
130
|
+
dispatch: CredentialDispatch,
|
|
131
|
+
filled: Schema.Natural.check(Schema.isLessThanOrEqualTo(8)),
|
|
132
|
+
cleanup: Schema.Literals([
|
|
133
|
+
"not-requested",
|
|
134
|
+
"confirmed",
|
|
135
|
+
"unconfirmed"
|
|
136
|
+
])
|
|
137
|
+
}) {};
|
|
138
|
+
export { CredentialAccessError as a, CredentialFieldRole as c, CredentialForm as d, CredentialKind as f, LoginCredential as g, FillCredentialRequest as h, CardCredential as i, CredentialFillError as l, CredentialTarget as m, BrowserCredentialMaterial as n, CredentialBinding as o, CredentialOrigin as p, BrowserCredentials_exports as r, CredentialDispatch as s, BrowserCredentialAccess as t, CredentialFillResult as u };
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=BrowserCredentials-CktBoPgE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserCredentials-CktBoPgE.mjs","names":[],"sources":["../src/BrowserCredentials.ts"],"sourcesContent":["import * as Context from 'effect/Context'\nimport type * as Effect from 'effect/Effect'\nimport * as Schema from 'effect/Schema'\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 CredentialForm extends Schema.Class<CredentialForm>('CredentialForm')({\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\n/**\n * Private, persistable evidence for an exact page, document and native form controls.\n * Keep it with the host's one-use request, never accept a binding from a model or submitter.\n * A detached document or replaced control requires a fresh user request.\n */\nexport class CredentialBinding extends Schema.Class<CredentialBinding>('CredentialBinding')({\n version: Schema.Literal(1),\n pageId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n frameId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n target: CredentialTarget,\n nodes: Schema.Array(Schema.Int.check(Schema.isGreaterThan(0))).check(\n Schema.isMinLength(3),\n Schema.isMaxLength(10),\n ),\n shape: Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/)),\n}) {}\n\nexport class FillCredentialRequest extends Schema.Class<FillCredentialRequest>(\n 'FillCredentialRequest',\n)({\n ...CredentialForm.fields,\n credential: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n /** Required for delayed user entry; omitted for immediate, host-authorized vault fills. */\n binding: Schema.optionalKey(CredentialBinding),\n}) {}\n\nconst SecretText = Schema.Redacted(Schema.NonEmptyString.check(Schema.isMaxLength(1024)), {\n disallowJsonEncode: true,\n})\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 disallowJsonEncode: true,\n }),\n expiry: SecretText,\n expiryMonth: Schema.Redacted(Schema.String.check(Schema.isPattern(/^(0[1-9]|1[0-2])$/)), {\n disallowJsonEncode: true,\n }),\n expiryYear: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\\d{4}$/)), {\n disallowJsonEncode: true,\n }),\n securityCode: Schema.optionalKey(\n Schema.Redacted(Schema.String.check(Schema.isPattern(/^\\d{3,4}$/)), {\n disallowJsonEncode: true,\n }),\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":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as LoginCredential, a as CredentialAccessError, c as CredentialDispatch, d as CredentialFillResult, f as CredentialForm, g as FillCredentialRequest, h as CredentialTarget, i as CardCredential, l as CredentialFieldRole, m as CredentialOrigin, n as BrowserCredentialMaterial, o as CredentialAccessRequest, p as CredentialKind, s as CredentialBinding, t as BrowserCredentialAccess, u as CredentialFillError } from "./BrowserCredentials-BWC4RqRn.mjs";
|
|
2
|
+
export { BrowserCredentialAccess, BrowserCredentialMaterial, CardCredential, CredentialAccessError, CredentialAccessRequest, CredentialBinding, CredentialDispatch, CredentialFieldRole, CredentialFillError, CredentialFillResult, CredentialForm, CredentialKind, CredentialOrigin, CredentialTarget, FillCredentialRequest, LoginCredential };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as BrowserCredentialAccess, n as BrowserCredentialMaterial, i as CardCredential, a as CredentialAccessError, o as CredentialBinding, s as CredentialDispatch, c as CredentialFieldRole, l as CredentialFillError, u as CredentialFillResult, d as CredentialForm, f as CredentialKind, p as CredentialOrigin, m as CredentialTarget, h as FillCredentialRequest, g as LoginCredential } from "./BrowserCredentials-CktBoPgE.mjs";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PageCapture } from "@systemfsoftware/agent/page-capture";
|
|
2
|
+
import { SandboxImplementation } from "@systemfsoftware/agent/sandbox";
|
|
3
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import * as Redacted from "effect/Redacted";
|
|
6
|
+
/** Node-safe REST PageCapture implementation; it never imports Worker runtime modules. */
|
|
7
|
+
export declare const browserRestCaptureImplementation: SandboxImplementation;
|
|
8
|
+
/** Explicit construction inputs; credentials are only projected into the fixed-origin Authorization header. */
|
|
9
|
+
export interface BrowserRestCaptureOptions {
|
|
10
|
+
readonly accountId: string;
|
|
11
|
+
readonly apiToken: Redacted.Redacted<string>;
|
|
12
|
+
}
|
|
13
|
+
/** REST PageCapture layer for Node and other non-Worker composition roots. */
|
|
14
|
+
export declare const browserRestCaptureLayer: (options: BrowserRestCaptureOptions) => Layer.Layer<PageCapture, never, HttpClient.HttpClient>;
|