@pgxsinkit/client 0.1.53 → 0.2.1
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/README.md +22 -0
- package/dist/adoption.d.ts +118 -0
- package/dist/adoption.d.ts.map +1 -0
- package/dist/boot-report.d.ts +54 -15
- package/dist/boot-report.d.ts.map +1 -1
- package/dist/convergence.d.ts +2 -1
- package/dist/convergence.d.ts.map +1 -1
- package/dist/export-store.d.ts +1 -1
- package/dist/export-store.d.ts.map +1 -1
- package/dist/index.d.ts +286 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4795 -1519
- package/dist/index.js.map +34 -24
- package/dist/live-rows-sql.d.ts +1 -1
- package/dist/local-store.d.ts +16 -31
- package/dist/local-store.d.ts.map +1 -1
- package/dist/local-tables.d.ts +4 -4
- package/dist/mutation.d.ts +18 -15
- package/dist/mutation.d.ts.map +1 -1
- package/dist/opfs-effects.d.ts +51 -0
- package/dist/opfs-effects.d.ts.map +1 -0
- package/dist/placement-probe.d.ts +75 -0
- package/dist/placement-probe.d.ts.map +1 -0
- package/dist/schema.d.ts +11 -16
- package/dist/schema.d.ts.map +1 -1
- package/dist/store-boot.d.ts +77 -0
- package/dist/store-boot.d.ts.map +1 -0
- package/dist/store-lifecycle.d.ts +153 -0
- package/dist/store-lifecycle.d.ts.map +1 -0
- package/dist/store-meta.d.ts +190 -0
- package/dist/store-meta.d.ts.map +1 -0
- package/dist/store-path.d.ts +77 -7
- package/dist/store-path.d.ts.map +1 -1
- package/dist/sync/apply.d.ts.map +1 -1
- package/dist/sync/shape-inbox.d.ts +1 -1
- package/dist/sync/types.d.ts +3 -3
- package/dist/testing.js.map +3 -3
- package/dist/worker/attach-sync-client.d.ts +300 -16
- package/dist/worker/attach-sync-client.d.ts.map +1 -1
- package/dist/worker/define-sync-worker.d.ts +164 -23
- package/dist/worker/define-sync-worker.d.ts.map +1 -1
- package/dist/worker/election-coordinator.d.ts +95 -0
- package/dist/worker/election-coordinator.d.ts.map +1 -0
- package/dist/worker/engine-control.d.ts +266 -0
- package/dist/worker/engine-control.d.ts.map +1 -0
- package/dist/worker/engine-router.d.ts +75 -0
- package/dist/worker/engine-router.d.ts.map +1 -0
- package/dist/worker/live-query-manager.d.ts.map +1 -1
- package/dist/worker/protocol.d.ts +47 -31
- package/dist/worker/protocol.d.ts.map +1 -1
- package/dist/worker/sw-placement.d.ts +37 -0
- package/dist/worker/sw-placement.d.ts.map +1 -0
- package/package.json +4 -3
- package/skills/core/SKILL.md +15 -12
- package/skills/operating/SKILL.md +142 -46
- package/src/adoption.ts +275 -0
- package/src/boot-report.ts +70 -17
- package/src/convergence.ts +2 -1
- package/src/export-store.ts +1 -1
- package/src/index.ts +1157 -115
- package/src/live-rows-sql.ts +1 -1
- package/src/local-store.ts +18 -40
- package/src/local-tables.ts +2 -2
- package/src/mutation.ts +115 -53
- package/src/mutations-api.ts +3 -3
- package/src/opfs-effects.ts +160 -0
- package/src/placement-probe.ts +168 -0
- package/src/schema.ts +17 -22
- package/src/store-boot.ts +343 -0
- package/src/store-lifecycle.ts +227 -0
- package/src/store-meta.ts +459 -0
- package/src/store-path.ts +197 -22
- package/src/sync/apply.ts +63 -63
- package/src/sync/index.ts +2 -2
- package/src/sync/shape-inbox.ts +1 -1
- package/src/sync/types.ts +3 -3
- package/src/testing.ts +2 -2
- package/src/worker/attach-sync-client.ts +1753 -102
- package/src/worker/define-sync-worker.ts +1034 -71
- package/src/worker/election-coordinator.ts +462 -0
- package/src/worker/engine-control.ts +379 -0
- package/src/worker/engine-router.ts +355 -0
- package/src/worker/live-query-manager.ts +4 -1
- package/src/worker/protocol.ts +46 -16
- package/src/worker/sw-placement.ts +64 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { SyncTableRegistry } from "@pgxsinkit/contracts";
|
|
2
|
-
import { type ClientPGlite, type CreateSyncClientOptions, type SyncClient } from "../index";
|
|
1
|
+
import type { SyncStorageDeclaration, SyncTableRegistry } from "@pgxsinkit/contracts";
|
|
2
|
+
import { type AdoptionDeclaration, type ClientPGlite, type CreateSyncClientOptions, type SyncClient } from "../index";
|
|
3
|
+
import { type PlacementProbeResult } from "../placement-probe";
|
|
4
|
+
import { type ExecutionLimitConfig } from "./engine-control";
|
|
3
5
|
import { type BridgeCodec, type BridgePort } from "./protocol";
|
|
6
|
+
import { type SwPlacementResult } from "./sw-placement";
|
|
4
7
|
export interface DefineSyncWorkerOptions<TRegistry extends SyncTableRegistry> {
|
|
5
8
|
/**
|
|
6
9
|
* The sync registry — imported as CODE by the worker file, never cloned into it (ADR-0032 decision 4).
|
|
@@ -24,22 +27,18 @@ export interface DefineSyncWorkerOptions<TRegistry extends SyncTableRegistry> {
|
|
|
24
27
|
*/
|
|
25
28
|
createPglite?: (storePath: string, backendOverride?: "memory") => Promise<ClientPGlite>;
|
|
26
29
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* scheduled idb flush lands — synced tables are recoverable from the server by construction, so this
|
|
38
|
-
* relaxes flush TIMING, not persistence (ADR-0036). Opt out with `relaxedDurability: false`.
|
|
39
|
-
*/
|
|
40
|
-
relaxedDurability?: boolean;
|
|
30
|
+
* ADR-0049 (capability-driven engine placement) decision 7, plan step 11b: the consumer's explicit
|
|
31
|
+
* reconstructibility DECLARATION authorizing AUTOMATIC adoption of an existing idb-authoritative store into a
|
|
32
|
+
* committed OPFS successor. A worker-ENTRY option (baked into the worker file as code, like
|
|
33
|
+
* {@link executionLimit}), NEVER an attach option — a tab cannot set it (adoption DELETES local-only data, so
|
|
34
|
+
* only the code author may authorize it). Forwarded verbatim to the {@link createSyncClient} boot below. DEFAULT
|
|
35
|
+
* OFF (`undefined`): hook absence is never authority — only `"server-reconstructible"` (or the manual
|
|
36
|
+
* `adoptStore` API) authorizes deleting the idb predecessor. Honoured only where the engine home grants OPFS
|
|
37
|
+
* access (SW-direct / elected placement); inert on the browser-idb fallback where there is no opfs successor.
|
|
38
|
+
*/
|
|
39
|
+
adoption?: AdoptionDeclaration;
|
|
41
40
|
electricUrl: string;
|
|
42
|
-
|
|
41
|
+
batchWriteUrl: string;
|
|
43
42
|
/** Static headers on every read + write request (e.g. a gateway `apikey`). See `createSyncClient`. */
|
|
44
43
|
requestHeaders?: Record<string, string>;
|
|
45
44
|
/** Write-only headers merged over {@link requestHeaders} (e.g. region/DB-affinity). See `createSyncClient`. */
|
|
@@ -60,6 +59,15 @@ export interface DefineSyncWorkerOptions<TRegistry extends SyncTableRegistry> {
|
|
|
60
59
|
* (`flush` + `reconcile` queries). Default 15000.
|
|
61
60
|
*/
|
|
62
61
|
convergenceIntervalMs?: number;
|
|
62
|
+
/**
|
|
63
|
+
* The opt-in engine-construction EXECUTION LIMIT (ADR-0049 D5), threaded into the ROUTER when this
|
|
64
|
+
* SharedWorker lands in `elected-worker` placement (router-only mode). DISABLED by default (`undefined` /
|
|
65
|
+
* absent `maxDispatchMs`) — no finite worst-case query duration exists, so an absent limit means the router
|
|
66
|
+
* forwards no probe and queries run unbounded; enabling it is a deliberate consumer choice.
|
|
67
|
+
* Elected placement ONLY: on SW-direct (`shared-worker`) the engine home is in-scope and there is no control
|
|
68
|
+
* channel to probe, so an enabled value is rejected as unsupported before engine boot.
|
|
69
|
+
*/
|
|
70
|
+
executionLimit?: ExecutionLimitConfig;
|
|
63
71
|
/** Injected transport binder. Defaults to auto-detecting the SharedWorker/dedicated-worker global scope. */
|
|
64
72
|
installGlobal?: boolean;
|
|
65
73
|
/** Injected codec (ADR-0032 S2 §1). Defaults to the v1 identity codec. */
|
|
@@ -80,7 +88,7 @@ export interface DefineSyncWorkerOptions<TRegistry extends SyncTableRegistry> {
|
|
|
80
88
|
* NOT an attach option: the hook is a function and functions cannot cross the bridge, so a tab can never
|
|
81
89
|
* supply it — the worker owns it. Use it for DDL that must precede the registry's local tables (extensions,
|
|
82
90
|
* a bespoke schema search_path). On a fresh store the registry-derived local tables do NOT yet exist when
|
|
83
|
-
* this runs (that ordering is what distinguishes it from {@link
|
|
91
|
+
* this runs (that ordering is what distinguishes it from {@link prepareLocalDbAfterSchema}).
|
|
84
92
|
*
|
|
85
93
|
* Runs on the storePath, {@link precreatedPglite}, and restore boots; SKIPPED entirely on the
|
|
86
94
|
* {@link pgliteInstance} path (the caller owns schema/prepare/reconcile there). On a restore boot it still
|
|
@@ -90,7 +98,7 @@ export interface DefineSyncWorkerOptions<TRegistry extends SyncTableRegistry> {
|
|
|
90
98
|
prepareLocalDbBeforeSchema?: CreateSyncClientOptions<TRegistry>["prepareLocalDbBeforeSchema"];
|
|
91
99
|
/**
|
|
92
100
|
* App-level schema prep run IN THE WORKER, against the engine's own local store, AFTER the registry schema
|
|
93
|
-
* exec — forwarded verbatim to {@link CreateSyncClientOptions.
|
|
101
|
+
* exec — forwarded verbatim to {@link CreateSyncClientOptions.prepareLocalDbAfterSchema}, same timing as the in-process
|
|
94
102
|
* client. Like {@link prepareLocalDbBeforeSchema} this is a worker-ENTRY option, never an attach option (the
|
|
95
103
|
* tab never sees it — functions cannot cross the bridge). Use it for app-level indexes, views, or migrations
|
|
96
104
|
* that depend on the registry's local tables, which DO exist by the time this runs.
|
|
@@ -98,15 +106,16 @@ export interface DefineSyncWorkerOptions<TRegistry extends SyncTableRegistry> {
|
|
|
98
106
|
* Runs on the storePath, {@link precreatedPglite}, and restore boots; SKIPPED entirely on the
|
|
99
107
|
* {@link pgliteInstance} path (the caller owns schema/prepare/reconcile there).
|
|
100
108
|
*/
|
|
101
|
-
|
|
109
|
+
prepareLocalDbAfterSchema?: CreateSyncClientOptions<TRegistry>["prepareLocalDbAfterSchema"];
|
|
102
110
|
/**
|
|
103
111
|
* Bounded zero-subscriber keep-alive for the live-query manager (ADR-0040 decision 4). When an entry's last
|
|
104
112
|
* subscriber leaves, a nonzero effective keep-alive retains its PGlite registration + diff state for a grace
|
|
105
113
|
* period so a matching resubscribe (e.g. a re-mounted route across tabs) reuses it verbatim — no ~400 ms
|
|
106
114
|
* re-materialization. Bounded by explicit budgets; DEFAULTS OFF (`defaultKeepAliveMs: 0` → tear a query
|
|
107
|
-
* down the instant its last consumer leaves
|
|
108
|
-
*
|
|
109
|
-
*
|
|
115
|
+
* down the instant its last consumer leaves). The 0 default is justified: a retained entry STILL pays a
|
|
116
|
+
* full SQL rerun + diff on every dependent write — PGlite live queries cannot be paused — so retention
|
|
117
|
+
* only pays off for a genuinely hot, re-mounted query, and the default keeps worker memory bounded with
|
|
118
|
+
* no surprise standing SQL reruns.
|
|
110
119
|
*/
|
|
111
120
|
liveQueries?: {
|
|
112
121
|
/** Baseline retention (ms) for a zero-subscriber entry; floored by each subscriber's own hint. Default 0. */
|
|
@@ -131,4 +140,136 @@ export interface SyncWorkerHost<TRegistry extends SyncTableRegistry> {
|
|
|
131
140
|
* top level and it auto-binds the global scope; a test constructs it and drives {@link SyncWorkerHost.connect}.
|
|
132
141
|
*/
|
|
133
142
|
export declare function defineSyncWorker<const TRegistry extends SyncTableRegistry>(options: DefineSyncWorkerOptions<TRegistry>): SyncWorkerHost<TRegistry>;
|
|
143
|
+
/**
|
|
144
|
+
* The literal key of the CONTROL-CHANNEL DELIVERY message (ADR-0049 step 9). The spawning coordinator's step-10
|
|
145
|
+
* wiring posts `{ [CONTROL_PORT_DELIVERY_KEY]: true }` on the elected engine worker's IMPLICIT port WITH the
|
|
146
|
+
* engine end of the announce control channel as a transferred `MessagePort`. The engine entry starts that port
|
|
147
|
+
* and runs its control plane on it. Distinct namespace from the data-path bridge envelope and the `pgx0049`
|
|
148
|
+
* control envelope, so it is unambiguous on the shared implicit-port transport.
|
|
149
|
+
*/
|
|
150
|
+
export declare const CONTROL_PORT_DELIVERY_KEY: "pgx0049ControlPort";
|
|
151
|
+
/**
|
|
152
|
+
* Bind the running global scope to `connect`. A `SharedWorkerGlobalScope` exposes `onconnect` (one event per
|
|
153
|
+
* tab, each carrying a port); a dedicated `DedicatedWorkerGlobalScope` has no `onconnect` but IS itself the
|
|
154
|
+
* single implicit port (`self.postMessage`/`addEventListener`). Neither exists in a plain test/Node context,
|
|
155
|
+
* where the host is driven via {@link SyncWorkerHost.connect} directly — so this is a no-op there.
|
|
156
|
+
*
|
|
157
|
+
* `globalScope` defaults to `globalThis` (the real worker binding); tests inject a fake scope to exercise the
|
|
158
|
+
* dedicated-worker control-plane arm (ADR-0049 step 9) without a real Worker.
|
|
159
|
+
*/
|
|
160
|
+
export declare function bindGlobalScope(connect: (port: BridgePort) => void, globalScope?: unknown): void;
|
|
161
|
+
/**
|
|
162
|
+
* The PLACEMENT-QUERY envelope key: a tab posts `{ [PLACEMENT_QUERY_KEY]: true }` on its SharedWorker
|
|
163
|
+
* connection to learn the engine home; the SharedWorker replies `{ [PLACEMENT_RESULT_KEY]: PlacementQueryResult }`.
|
|
164
|
+
* A distinct namespace from the data-path bridge envelope and the `pgx0049` control envelope, so it is
|
|
165
|
+
* unambiguous on the shared tab↔SharedWorker transport (the attach client reads it off the raw message).
|
|
166
|
+
*/
|
|
167
|
+
export declare const PLACEMENT_QUERY_KEY: "pgx0049Placement";
|
|
168
|
+
/** The reply to a {@link PLACEMENT_QUERY_KEY} query — carries the engine home, `electionRequired`, and SW id. */
|
|
169
|
+
export declare const PLACEMENT_RESULT_KEY: "pgx0049PlacementResult";
|
|
170
|
+
/**
|
|
171
|
+
* The DESTROY peer-count query key (ADR-0049 D8, plan fault row "`destroy()` with peers attached → refused").
|
|
172
|
+
* A tab about to destroy the store posts `{ [DESTROY_QUERY_KEY]: true }`; the SharedWorker — which alone knows
|
|
173
|
+
* the attached-tab count — replies `{ [DESTROY_VERDICT_KEY]: { peers } }`. `peers` INCLUDES the querying tab, so
|
|
174
|
+
* `peers > 1` means other tabs still hold the store and destruction is refused.
|
|
175
|
+
*/
|
|
176
|
+
export declare const DESTROY_QUERY_KEY: "pgx0049DestroyQuery";
|
|
177
|
+
/** The reply to a {@link DESTROY_QUERY_KEY} query — the attached-tab count (querying tab included). */
|
|
178
|
+
export declare const DESTROY_VERDICT_KEY: "pgx0049DestroyVerdict";
|
|
179
|
+
/**
|
|
180
|
+
* The DECLARATION-MESSAGE envelope key (ADR-0050): the tab posts `{ [DECLARATION_KEY]: SyncStorageDeclaration }`
|
|
181
|
+
* on EVERY worker port BEFORE its placement query — always, even when the app declared nothing (an empty `{}`
|
|
182
|
+
* meaning "no opinion: capability defaults"). The bootstrap defers its placement decision until the first one
|
|
183
|
+
* arrives (a registry-attached static declaration decides at startup instead), binds the first arrival for the
|
|
184
|
+
* worker/store lifetime, and refuses explicit conflicts. The worker NAME carries the store path only — never
|
|
185
|
+
* configuration; that was the fault this key replaces.
|
|
186
|
+
*/
|
|
187
|
+
export declare const DECLARATION_KEY: "pgx0050Declaration";
|
|
188
|
+
/**
|
|
189
|
+
* The reply when a declaration (or an engine-bound message on an undeclared port) is REFUSED (ADR-0050):
|
|
190
|
+
* `{ [DECLARATION_REFUSED_KEY]: { message, name } }`. `name` is the stable typed-error name
|
|
191
|
+
* (`StorageDeclarationRefusedError`) so the tab rebuilds the refusal typed and fails its boot loudly —
|
|
192
|
+
* never a silent old value, never a hang.
|
|
193
|
+
*/
|
|
194
|
+
export declare const DECLARATION_REFUSED_KEY: "pgx0050DeclarationRefused";
|
|
195
|
+
/** The {@link DECLARATION_REFUSED_KEY} reply payload. */
|
|
196
|
+
export interface DeclarationRefusedWire {
|
|
197
|
+
message: string;
|
|
198
|
+
/** The stable typed-error name (`StorageDeclarationRefusedError`) for the tab-side rebuild. */
|
|
199
|
+
name: string;
|
|
200
|
+
}
|
|
201
|
+
/** The placement a tab learns from the SharedWorker (the reply payload under {@link PLACEMENT_RESULT_KEY}). */
|
|
202
|
+
export interface PlacementQueryResult {
|
|
203
|
+
engineHome: SwPlacementResult["engineHome"];
|
|
204
|
+
/** True in `elected-worker` mode — the tab's election coordinator must spawn the engine worker. */
|
|
205
|
+
electionRequired: boolean;
|
|
206
|
+
swInstanceId: string;
|
|
207
|
+
/**
|
|
208
|
+
* The SharedWorker's OWN script URL (`self.location.href`, ADR-0049 D5). In `elected-worker` mode the winning
|
|
209
|
+
* tab constructs the elected engine as `new Worker(swScriptUrl, { type: "module" })` — the worker entry is
|
|
210
|
+
* dual-scope (one file serves both homes), so no consumer wiring is needed; a `createEngineWorker` override is
|
|
211
|
+
* only for entries that cannot be reconstructed from their URL as a module worker. Absent when the scope cannot
|
|
212
|
+
* report its location (a plain test scope) — then a tab with no override fails attach with a typed wiring error.
|
|
213
|
+
*/
|
|
214
|
+
swScriptUrl?: string;
|
|
215
|
+
}
|
|
216
|
+
/** The SharedWorker placement bootstrap's dependencies (all injected so it is unit-testable off-worker). */
|
|
217
|
+
export interface SharedWorkerBootstrapDeps {
|
|
218
|
+
/** The engine host `connect` — used in SW-direct (`shared-worker`) placement to pipe a port to the in-scope engine. */
|
|
219
|
+
connect: (port: BridgePort, connection?: {
|
|
220
|
+
placementQueriesHandled?: boolean;
|
|
221
|
+
}) => void;
|
|
222
|
+
/** Quiesce and close the in-scope host before SW-direct destruction acknowledges handle release. */
|
|
223
|
+
closeHost?: () => Promise<void>;
|
|
224
|
+
/** Current attached-tab count for the DESTROY verdict in SW-direct mode (the host's own port set). */
|
|
225
|
+
peerCount: () => number;
|
|
226
|
+
/** The opt-in execution limit, threaded into the router in `elected-worker` (router-only) placement. */
|
|
227
|
+
executionLimit?: ExecutionLimitConfig;
|
|
228
|
+
/**
|
|
229
|
+
* The registry-attached STATIC storage declaration (ADR-0050) — authoritative when present: it binds the
|
|
230
|
+
* store's declaration and decides placement AT SCOPE STARTUP (no wait for a declaration message).
|
|
231
|
+
* `backend: "idbfs"` skips the probe entirely and binds the in-SharedWorker engine host on idbfs (ADR-0049
|
|
232
|
+
* D1's declared opt-out — the declared mode, not a fallback); any other resolution runs the UNCONDITIONAL
|
|
233
|
+
* placement probe. Absent: the scope is registry-silent and DEFERS its placement decision until the first
|
|
234
|
+
* port's declaration message arrives (whose explicit fields then bind).
|
|
235
|
+
*/
|
|
236
|
+
staticStorage?: SyncStorageDeclaration;
|
|
237
|
+
/** Test seam: inject the placement decision (a fake probe result) instead of the real {@link decideSwPlacement}. */
|
|
238
|
+
decidePlacement?: () => Promise<SwPlacementResult>;
|
|
239
|
+
/** Defaults to `globalThis`; tests inject a fake SharedWorker scope. */
|
|
240
|
+
globalScope?: unknown;
|
|
241
|
+
/**
|
|
242
|
+
* Notified once the placement grant for THIS scope resolves (SharedWorker decision, dedicated-engine probe, or
|
|
243
|
+
* the plain-scope immediate settle). The entry threads `opfsGranted` into its `hasOpfsSyncAccess` boot grant and
|
|
244
|
+
* `engineHome` into the BootReport, and opens its boot gate. `engineHome` is `undefined` for a plain test/Node
|
|
245
|
+
* scope (no home) so the report omits it, exactly as before placement.
|
|
246
|
+
*/
|
|
247
|
+
onPlacement?: (outcome: PlacementBootstrapOutcome) => void;
|
|
248
|
+
/**
|
|
249
|
+
* Test seam: inject the DEDICATED elected-engine scope's OPFS probe (a fake verdict) instead of the real
|
|
250
|
+
* {@link probeOpfsSyncAccess}. Defaults to the real probe (invariant 8 — a real `createSyncAccessHandle` open in
|
|
251
|
+
* the engine's own scope, per boot, never sniffed or cached).
|
|
252
|
+
*/
|
|
253
|
+
probe?: () => Promise<PlacementProbeResult>;
|
|
254
|
+
}
|
|
255
|
+
/** The resolved placement grant for a worker scope, threaded to the entry's boot grant + BootReport engine home. */
|
|
256
|
+
export interface PlacementBootstrapOutcome {
|
|
257
|
+
/** The engine home for this scope; `undefined` for a plain test/Node scope (the report then omits it). */
|
|
258
|
+
engineHome: SwPlacementResult["engineHome"] | undefined;
|
|
259
|
+
/** True when THIS scope actually holds OPFS sync-access (in-scope SW-direct, or the elected engine's own probe). */
|
|
260
|
+
opfsGranted: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* The verbatim reason this scope's engine opened IDBFS while OPFS was CAPABLE (ADR-0049 D1/D12, a
|
|
263
|
+
* capability-absence fallback) — stamped into the boot's `storageFallbackReason`. Absent on a granted opfs boot
|
|
264
|
+
* AND on the declared `backend: "idbfs"` mode (the contract, not a fallback).
|
|
265
|
+
*/
|
|
266
|
+
storageFallbackReason?: string;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Bootstrap the running worker scope for ADR-0049 placement. A SharedWorker scope runs the placement decision
|
|
270
|
+
* and gates every `onconnect` port on it ({@link wireSharedWorkerPlacement}); any other scope (the dedicated
|
|
271
|
+
* elected-engine worker, or a plain test/Node scope) delegates to {@link bindGlobalScope} unchanged. Called by
|
|
272
|
+
* `defineSyncWorker` in place of the old direct `bindGlobalScope(connect)`.
|
|
273
|
+
*/
|
|
274
|
+
export declare function bootstrapWorkerScope(deps: SharedWorkerBootstrapDeps): void;
|
|
134
275
|
//# sourceMappingURL=define-sync-worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-sync-worker.d.ts","sourceRoot":"","sources":["../../src/worker/define-sync-worker.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"define-sync-worker.d.ts","sourceRoot":"","sources":["../../src/worker/define-sync-worker.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAGV,sBAAsB,EAEtB,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAa9B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,uBAAuB,EAO5B,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,oBAAoB,CAAC;AAGpF,OAAO,EAML,KAAK,oBAAoB,EAI1B,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EAGL,KAAK,WAAW,EAIhB,KAAK,UAAU,EAYhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA0B3E,MAAM,WAAW,uBAAuB,CAA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CAAC,CAAC;CAC7C;AAED,oHAAoH;AACpH,MAAM,WAAW,yBAAyB;IACxC,0GAA0G;IAC1G,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IACxD,oHAAoH;IACpH,WAAW,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAqCD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CA8C1E"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/** The prefix every per-store leader lock name carries (CONTEXT "Leader lock"). */
|
|
2
|
+
export declare const LEADER_LOCK_PREFIX = "pgx-leader-";
|
|
3
|
+
/**
|
|
4
|
+
* The per-store leader-lock name: {@link LEADER_LOCK_PREFIX} + the injective store-identity component (D11,
|
|
5
|
+
* invariant 10). Using {@link storeIdentityComponent} keeps the lock name on the SAME one canonical encoding as
|
|
6
|
+
* every other browser-side identity surface (OPFS namespaces, the meta record key, the SharedWorker name), so
|
|
7
|
+
* two distinct store paths can never collapse to one lock (e.g. `"foo/bar"` → `pgx-leader-foo%2Fbar`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function leaderLockName(storePath: string): string;
|
|
10
|
+
/** A minimal MessagePort-shaped end — only ever TRANSFERRED across the SW bridge, never called on here. */
|
|
11
|
+
type ControlChannel = {
|
|
12
|
+
port1: unknown;
|
|
13
|
+
port2: unknown;
|
|
14
|
+
};
|
|
15
|
+
/** The tab's SW bridge port (control plane): where the coordinator posts `pgx0049` envelopes and reads acks. */
|
|
16
|
+
export interface SwBridgePort {
|
|
17
|
+
postMessage(message: unknown, transfer?: unknown[]): void;
|
|
18
|
+
addEventListener(type: "message", listener: (event: {
|
|
19
|
+
data: unknown;
|
|
20
|
+
}) => void): void;
|
|
21
|
+
removeEventListener(type: "message", listener: (event: {
|
|
22
|
+
data: unknown;
|
|
23
|
+
}) => void): void;
|
|
24
|
+
}
|
|
25
|
+
export interface CoordinatorDeps {
|
|
26
|
+
/** navigator.locks-shaped, injectable: `request(name, {signal}, callback)` — the callback's returned promise
|
|
27
|
+
HOLDS the lock; resolving it releases the lock, aborting the signal cancels a still-queued request. */
|
|
28
|
+
locks: {
|
|
29
|
+
request(name: string, options: {
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}, callback: () => Promise<void>): Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
/** Spawn the elected engine worker; returns a handle with `terminate()` and an error-event subscription. */
|
|
34
|
+
spawnEngineWorker: () => {
|
|
35
|
+
terminate(): void;
|
|
36
|
+
onError(listener: (message: string) => void): void;
|
|
37
|
+
};
|
|
38
|
+
/** Create the engine control MessageChannel; default `() => new MessageChannel()` — injectable so tests see
|
|
39
|
+
both ends. The ROUTER end (`port1`) is transferred to the SharedWorker via `engine-announce`; the ENGINE
|
|
40
|
+
end (`port2`) is wired to the elected engine worker in step 9. */
|
|
41
|
+
createControlChannel?: () => ControlChannel;
|
|
42
|
+
/** The tab's SW bridge port (control plane): the coordinator posts `pgx0049` envelopes (leader-granted,
|
|
43
|
+
engine-announce with the transferred control port, engine-retiring, engine-teardown, control-ping) and
|
|
44
|
+
receives control-acks + relocation notices on it. */
|
|
45
|
+
swPort: SwBridgePort;
|
|
46
|
+
/** Reconstruct the SharedWorker via the attach worker FACTORY (ADR-0049 D5) → the NEW swPort. Absent only for a
|
|
47
|
+
bare-instance attach input, where a SharedWorker cannot be rebuilt from itself: keepalive recovery is then
|
|
48
|
+
structurally unavailable (the still-live engine + grant are untouched; recovery narrows to leader-op-or-reload). */
|
|
49
|
+
reconstructSw?: () => SwBridgePort;
|
|
50
|
+
/** Await the VFS ownership release after a deliberate terminate (step 10 wires the real wait; tests fake it). */
|
|
51
|
+
awaitOwnershipRelease: () => Promise<void>;
|
|
52
|
+
timers: {
|
|
53
|
+
setTimeout(fn: () => void, ms: number): unknown;
|
|
54
|
+
clearTimeout(handle: unknown): void;
|
|
55
|
+
};
|
|
56
|
+
/** Page-lifecycle subscription seam (BFCache): `pagehide`/`pageshow`; injectable. */
|
|
57
|
+
pageLifecycle?: {
|
|
58
|
+
onPageHide(listener: (persisted: boolean) => void): void;
|
|
59
|
+
onPageShow(listener: () => void): void;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface ElectionCoordinatorOptions {
|
|
63
|
+
storePath: string;
|
|
64
|
+
/** ms between leader-keepalive pings (default 20000). */
|
|
65
|
+
keepaliveIntervalMs?: number;
|
|
66
|
+
/** consecutive unanswered keepalive pings before SharedWorker reconstruction (default 2). */
|
|
67
|
+
keepaliveMissThreshold?: number;
|
|
68
|
+
/** ms to wait for the teardown ack before terminating anyway (default 3000). */
|
|
69
|
+
teardownAckTimeoutMs?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface ElectionCoordinator {
|
|
72
|
+
/** Claim for a pre-attach provision (optionally expiry-bounded — an abandoned warmed provision retires
|
|
73
|
+
itself when the timer fires). Returns an idempotent release fn (invariant 2). */
|
|
74
|
+
claimForProvision(opts?: {
|
|
75
|
+
expiryMs?: number;
|
|
76
|
+
}): () => void;
|
|
77
|
+
/** Claim for one attachment. Returns an idempotent release fn (invariant 2). */
|
|
78
|
+
claimForAttach(): () => void;
|
|
79
|
+
/** True while this tab holds the granted leader lock. */
|
|
80
|
+
isLeader(): boolean;
|
|
81
|
+
/** True while an elected engine worker handle is held. */
|
|
82
|
+
hasEngine(): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Deliberately RETIRE this tab's elected engine and resolve once its teardown handshake has completed — the
|
|
85
|
+
* point at which the engine's EXCLUSIVE OPFS sync-access handle is provably released (ADR-0049 D8). The
|
|
86
|
+
* destroy supervisor awaits this BEFORE deleting the backend store so `deleteBackendStore` never races the
|
|
87
|
+
* engine's async handle release (which surfaced as `NoModificationAllowedError`). Runs the retirement notice →
|
|
88
|
+
* `engine-teardown` → ack/timeout → terminate → lock-settle sequence, then awaits the ownership-release seam.
|
|
89
|
+
* A no-op (resolves at once) when this tab holds no engine (not the leader). Idempotent.
|
|
90
|
+
*/
|
|
91
|
+
retireEngine(): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
export declare function createElectionCoordinator(deps: CoordinatorDeps, options: ElectionCoordinatorOptions): ElectionCoordinator;
|
|
94
|
+
export {};
|
|
95
|
+
//# sourceMappingURL=election-coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"election-coordinator.d.ts","sourceRoot":"","sources":["../../src/worker/election-coordinator.ts"],"names":[],"mappings":"AAyCA,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,2GAA2G;AAC3G,KAAK,cAAc,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzD,gHAAgH;AAChH,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC1D,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IACtF,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,GAAG,IAAI,CAAC;CAC1F;AAED,MAAM,WAAW,eAAe;IAC9B;8GAC0G;IAC1G,KAAK,EAAE;QACL,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OA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AAC;IAC7B,yDAAyD;IACzD,QAAQ,IAAI,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,IAAI,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAuBD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CA2TrB"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/** Namespaced wire key shared by every placement control-plane participant. */
|
|
2
|
+
export declare const ENGINE_CONTROL_ENVELOPE_KEY: "pgx0049";
|
|
3
|
+
/** Wrap a control message in the namespaced envelope used beside the bridge protocol. */
|
|
4
|
+
export declare function wrapControlEnvelope(message: EngineControlMessage): {
|
|
5
|
+
[ENGINE_CONTROL_ENVELOPE_KEY]: EngineControlMessage;
|
|
6
|
+
};
|
|
7
|
+
/** Read a control message from its namespaced envelope, ignoring unrelated bridge traffic. */
|
|
8
|
+
export declare function readControlEnvelope(data: unknown): EngineControlMessage | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The PAIR naming one announced engine: the SharedWorker instance that stamped it plus a generation
|
|
11
|
+
* counter that is monotonic ONLY within that one SharedWorker instance (it resets with the SharedWorker).
|
|
12
|
+
* Authority and staleness checks always compare the pair — never the bare counter — because two different
|
|
13
|
+
* SharedWorker instances can each hold a generation `0`.
|
|
14
|
+
*/
|
|
15
|
+
export interface EngineIdentity {
|
|
16
|
+
/** Opaque id of the SharedWorker instance that minted this identity. Scopes {@link generation}. */
|
|
17
|
+
swInstanceId: string;
|
|
18
|
+
/** Monotonic counter WITHIN one `swInstanceId`; resets to 0 under a new SharedWorker instance. */
|
|
19
|
+
generation: number;
|
|
20
|
+
}
|
|
21
|
+
/** Two identities are equal only when BOTH fields match (the pair, never the bare counter). */
|
|
22
|
+
export declare function engineIdentityEquals(a: EngineIdentity, b: EngineIdentity): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Staleness rule (invariant 7): a tagged message is applied ONLY when its identity equals the CURRENT
|
|
25
|
+
* identity exactly — the pair, never the bare counter (it resets with the SharedWorker). So a message is
|
|
26
|
+
* STALE precisely when it is not `engineIdentityEquals` the current identity.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isStaleIdentity(current: EngineIdentity, tagged: EngineIdentity): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Mint the next identity that THIS SharedWorker instance (`swInstanceId`) should announce.
|
|
31
|
+
*
|
|
32
|
+
* - No `previous` → generation `0` (the first engine this SharedWorker announces).
|
|
33
|
+
* - `previous` belongs to the SAME `swInstanceId` → `previous.generation + 1` (a succession within one
|
|
34
|
+
* SharedWorker: a fresh elected engine worker replacing the last).
|
|
35
|
+
* - `previous` belongs to a DIFFERENT `swInstanceId` (a re-announce arriving at a NEW SharedWorker
|
|
36
|
+
* instance, after SharedWorker death recovery) → the counter RESTARTS at `0` under the new instance id.
|
|
37
|
+
* The generation is scoped to one SharedWorker instance, so it cannot carry across instances.
|
|
38
|
+
*/
|
|
39
|
+
export declare function mintEngineIdentity(swInstanceId: string, previous?: EngineIdentity): EngineIdentity;
|
|
40
|
+
/**
|
|
41
|
+
* The identity-tagged control plane the communication centre, the elected engine worker, and the tab
|
|
42
|
+
* coordinators exchange (distinct from the data-path bridge in `protocol.ts`; the SharedWorker never sees
|
|
43
|
+
* RPC payloads). Payload interfaces mirror `protocol.ts` conventions: a discriminating `type`, typed
|
|
44
|
+
* fields only, and MessagePorts travelling as transferables OUTSIDE the JSON body (see individual members).
|
|
45
|
+
* Identity-tagged members carry the {@link EngineIdentity} they belong to so a stale one is discarded.
|
|
46
|
+
*/
|
|
47
|
+
export type EngineControlMessage =
|
|
48
|
+
/**
|
|
49
|
+
* SharedWorker → tab (the lock holder): the leader lock was granted; SPAWN the engine. Pre-spawn, so no
|
|
50
|
+
* identity exists yet — it OPENS the handoff window on the attach side (a relocation notice, CONTEXT
|
|
51
|
+
* "Handoff window"). Untagged: there is no engine identity to compare against before the engine exists.
|
|
52
|
+
*/
|
|
53
|
+
{
|
|
54
|
+
type: "leader-granted";
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* tab → SharedWorker: the freshly spawned engine's MessagePort is announced so the SharedWorker can
|
|
58
|
+
* stamp it with a minted {@link EngineIdentity}. The announce ITSELF carries no identity (the SharedWorker
|
|
59
|
+
* mints it on receipt). The engine's control MessagePort travels as a TRANSFERABLE outside this JSON body
|
|
60
|
+
* (the same way `protocol.ts` transfers ports — never a serialized field), so nothing is typed here.
|
|
61
|
+
*/
|
|
62
|
+
| {
|
|
63
|
+
type: "engine-announce";
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* tab → SharedWorker (ADR-0049 D8): this tab is detaching — UNREGISTER it from the router so `tabCount`
|
|
67
|
+
* (the destroy peer-refusal input) falls. The platform fires no SharedWorker port-close event and the tab's
|
|
68
|
+
* `detach` bridge envelope rides the per-tab PIPE (which the router never sees), so this control-plane signal
|
|
69
|
+
* on the SW port is the only channel the router observes. Untagged + always-applied: it names no engine (it
|
|
70
|
+
* concerns the tab's own registration), and a detaching tab must be dropped regardless of the current engine
|
|
71
|
+
* generation. The router stays payload-blind — this is a `pgx0049` control message, never a bridge envelope.
|
|
72
|
+
*/
|
|
73
|
+
| {
|
|
74
|
+
type: "tab-detach";
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* elected engine → SharedWorker (ADR-0049 D1, capability-absence fallback): the elected dedicated engine's
|
|
78
|
+
* OWN-scope OPFS probe was DENIED (or the OPFS API is absent/throwing in the dedicated home too), so no home on
|
|
79
|
+
* this platform can hold sync-access handles. The engine reports that here so the router-only SharedWorker
|
|
80
|
+
* abandons election and boots the in-scope IDBFS engine instead (with the registry-declared durability) — the
|
|
81
|
+
* declared-idbfs shape reached by capability detection rather than declaration. Untagged: it names no engine
|
|
82
|
+
* (the engine never became authoritative — it is reporting that it cannot host), and the SharedWorker must act
|
|
83
|
+
* on it regardless of the current generation. `reason` is the verbatim probe attribution stamped into the
|
|
84
|
+
* fallback boot's `storageFallbackReason` (decision 12).
|
|
85
|
+
*/
|
|
86
|
+
| {
|
|
87
|
+
type: "engine-fallback";
|
|
88
|
+
reason: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* SharedWorker → engine (ADR-0049 step 9): the identity the router just minted for this engine, handed to
|
|
92
|
+
* the elected engine worker's control plane RIGHT AFTER the router stamps the `engine-announce` (before any
|
|
93
|
+
* `connect-port`). Although it carries an {@link EngineIdentity}, it is ALWAYS-APPLIED — it is the ASSIGNMENT
|
|
94
|
+
* itself, so it is never gated on the receiver's (still-absent or stale) current identity; every subsequent
|
|
95
|
+
* tagged message the engine receives is compared against THIS assigned identity. The engine remembers it and
|
|
96
|
+
* replies `engine-ready` (control-plane readiness, NOT engine boot — the engine still boots lazily on first
|
|
97
|
+
* attach). Sits with the untagged members in {@link shouldApplyControlMessage}'s always-apply set.
|
|
98
|
+
*/
|
|
99
|
+
| {
|
|
100
|
+
type: "assign-identity";
|
|
101
|
+
identity: EngineIdentity;
|
|
102
|
+
}
|
|
103
|
+
/** SharedWorker → tab: the announced engine is live under this identity (the stamp fan-out). */
|
|
104
|
+
| {
|
|
105
|
+
type: "engine-ready";
|
|
106
|
+
identity: EngineIdentity;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* SharedWorker → engine: accept a per-tab proxy pipe. The tab-end MessagePort is transferred ALONGSIDE
|
|
110
|
+
* this message (outside the JSON body, as a transferable), fed into `SyncWorkerHost.connect` (ADR D4).
|
|
111
|
+
*/
|
|
112
|
+
| {
|
|
113
|
+
type: "connect-port";
|
|
114
|
+
identity: EngineIdentity;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* A liveness probe request. Used BOTH as a tab↔SharedWorker keepalive (the leader keepalive) AND as a
|
|
118
|
+
* SharedWorker↔engine control-channel probe (the execution-limit path). `pingId` correlates the ack.
|
|
119
|
+
*/
|
|
120
|
+
| {
|
|
121
|
+
type: "control-ping";
|
|
122
|
+
identity: EngineIdentity;
|
|
123
|
+
pingId: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The answer to a {@link EngineControlMessage} `control-ping`; `pingId` echoes the request. ONE reserved
|
|
127
|
+
* value: `pingId: -1` is the TEARDOWN ack by convention (ADR-0049 step 9) — the engine emits it in reply to
|
|
128
|
+
* an `engine-teardown` (not to any real ping), the router RELAYS it to every tab, and the coordinator's
|
|
129
|
+
* teardown wait settles on it. A `-1` therefore never correlates a probe ping (those start at 1).
|
|
130
|
+
*/
|
|
131
|
+
| {
|
|
132
|
+
type: "control-ack";
|
|
133
|
+
identity: EngineIdentity;
|
|
134
|
+
pingId: number;
|
|
135
|
+
/** Present only when the reserved teardown acknowledgement reports that host close failed. Mirrors `protocol.ts`'s `BridgeErrorWire` (this module deliberately imports nothing from the bridge). */
|
|
136
|
+
error?: {
|
|
137
|
+
message: string;
|
|
138
|
+
name?: string;
|
|
139
|
+
detail?: unknown;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* tab → SharedWorker: an execution-limit report — a dispatch has been outstanding `elapsedMs` past the
|
|
144
|
+
* configured limit (ADR D5). The SharedWorker then probes the engine's control channel; it is NOT itself
|
|
145
|
+
* a death verdict (the limit CONVERTS slow to terminated only after the probe threshold).
|
|
146
|
+
*/
|
|
147
|
+
| {
|
|
148
|
+
type: "overdue-dispatch";
|
|
149
|
+
identity: EngineIdentity;
|
|
150
|
+
elapsedMs: number;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The retirement notice that PRECEDES every DELIBERATE termination — last-claim teardown, BFCache exit,
|
|
154
|
+
* and execution-limit termination all send it first (ADR D5), so the attach side opens the handoff window
|
|
155
|
+
* and queues new calls instead of racing a dying engine.
|
|
156
|
+
*/
|
|
157
|
+
| {
|
|
158
|
+
type: "engine-retiring";
|
|
159
|
+
identity: EngineIdentity;
|
|
160
|
+
}
|
|
161
|
+
/** The teardown handshake after a retirement notice; ack/timeout settles the lock callback. */
|
|
162
|
+
| {
|
|
163
|
+
type: "engine-teardown";
|
|
164
|
+
identity: EngineIdentity;
|
|
165
|
+
};
|
|
166
|
+
/** Discriminants that carry an {@link EngineIdentity} and are therefore staleness-gated. `assign-identity`
|
|
167
|
+
carries one but is the ASSIGNMENT itself (always-applied), so it is excluded here alongside the untagged. */
|
|
168
|
+
type TaggedControlType = Exclude<EngineControlMessage, {
|
|
169
|
+
type: "leader-granted" | "engine-announce" | "assign-identity" | "tab-detach" | "engine-fallback";
|
|
170
|
+
}>["type"];
|
|
171
|
+
/**
|
|
172
|
+
* Whether a received control message should be APPLIED given the receiver's current engine identity.
|
|
173
|
+
*
|
|
174
|
+
* - ALWAYS-APPLY members (`leader-granted`, `engine-announce`, `assign-identity`, `tab-detach`, `engine-fallback`)
|
|
175
|
+
* always apply — `leader-granted`/`engine-announce`/`tab-detach`/`engine-fallback` carry no identity to compare
|
|
176
|
+
* (they precede any engine, mint an identity, concern the tab's own registration, or report that no engine can
|
|
177
|
+
* host), and `assign-identity` IS the assignment, so it applies unconditionally.
|
|
178
|
+
* - IDENTITY-TAGGED members apply only when `current` is set AND the identities match exactly (the pair,
|
|
179
|
+
* invariant 7). A tagged message with no current identity, or a stale identity, is discarded.
|
|
180
|
+
*
|
|
181
|
+
* The switch is exhaustive with a `never`-guard: a new union member fails to type-check until it is
|
|
182
|
+
* classified here (the runtime exhaustiveness test pairs with this compile-time guard).
|
|
183
|
+
*/
|
|
184
|
+
export declare function shouldApplyControlMessage(current: EngineIdentity | undefined, message: EngineControlMessage): boolean;
|
|
185
|
+
/** Runtime companion to {@link shouldApplyControlMessage}'s compile-time guard: is this type staleness-gated? */
|
|
186
|
+
export declare function isTaggedControlType(type: EngineControlMessage["type"]): type is TaggedControlType;
|
|
187
|
+
/**
|
|
188
|
+
* The opt-in execution limit (ADR D5). ONE engine-construction value; DISABLED BY DEFAULT — no finite
|
|
189
|
+
* worst-case query duration exists, and the limit CONVERTS slow to terminated by policy, so enabling it
|
|
190
|
+
* must be a deliberate consumer choice (the public contract). When enabled, the limit
|
|
191
|
+
* CONVERTS slow to terminated after the control-probe threshold — it is NEVER claimed as death evidence.
|
|
192
|
+
* This feature is ELECTED-PLACEMENT ONLY: on SharedWorker-direct placement (WebKit) the option is rejected
|
|
193
|
+
* as unsupported — that rejection is wired in a later step; this module only defines the config + the
|
|
194
|
+
* cross-tab mismatch rule.
|
|
195
|
+
*/
|
|
196
|
+
export interface ExecutionLimitConfig {
|
|
197
|
+
/** ms; `undefined` = DISABLED (the default — preserves unbounded queries). */
|
|
198
|
+
maxDispatchMs?: number;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Thrown at attach when a tab's execution-limit value disagrees with the engine's construction value
|
|
202
|
+
* (ADR D5): every tab must carry the SAME config. Named + `[pgxsinkit]`-prefixed like the repo's other
|
|
203
|
+
* protocol errors so a consumer can `instanceof`-branch it.
|
|
204
|
+
*/
|
|
205
|
+
export declare class ExecutionLimitMismatchError extends Error {
|
|
206
|
+
readonly engineValue: number | undefined;
|
|
207
|
+
readonly attachValue: number | undefined;
|
|
208
|
+
constructor(engineValue: number | undefined, attachValue: number | undefined);
|
|
209
|
+
}
|
|
210
|
+
declare const EXECUTION_LIMIT_MISMATCH_CODE = "execution-limit-mismatch";
|
|
211
|
+
export declare function executionLimitMismatchToWire(error: ExecutionLimitMismatchError): {
|
|
212
|
+
code: typeof EXECUTION_LIMIT_MISMATCH_CODE;
|
|
213
|
+
engineValue?: number;
|
|
214
|
+
attachValue?: number;
|
|
215
|
+
};
|
|
216
|
+
export declare function executionLimitMismatchFromWire(detail: unknown): ExecutionLimitMismatchError | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* Attach-time guard (ADR D5): every tab must carry the SAME execution-limit value as the running engine.
|
|
219
|
+
* Any mismatch — including one side disabled (`undefined`) and the other set — throws
|
|
220
|
+
* {@link ExecutionLimitMismatchError}. Equal values (both `undefined`, or the same number) pass.
|
|
221
|
+
*/
|
|
222
|
+
export declare function assertSameExecutionLimit(engineValue: number | undefined, attachValue: number | undefined): void;
|
|
223
|
+
/**
|
|
224
|
+
* The two honest relocation outcomes (ADR D10, invariant 5). There is deliberately NO blanket "retryable":
|
|
225
|
+
* - `"not-dispatched"` — the call NEVER reached the engine (a queued call failed on the handoff queue's
|
|
226
|
+
* cap/deadline, or was never sent). SAFE TO RETRY.
|
|
227
|
+
* - `"unknown"` — a DISPATCHED mutation whose response was lost to relocation. Its journal update MAY
|
|
228
|
+
* already exist and there is NO mutation-dedup key, so it must be inspected/reconciled, NEVER auto-retried.
|
|
229
|
+
*
|
|
230
|
+
* A dispatched READ that lost its response is NOT a third outcome: repeating a read is safe, so that is the
|
|
231
|
+
* CALLER'S policy (repeat the read), not a distinct wire value.
|
|
232
|
+
*/
|
|
233
|
+
export type EngineRelocatedOutcome = "not-dispatched" | "unknown";
|
|
234
|
+
/** The stable clone-safe discriminator carried on the wire (ADR D10). Consumers branch on this, never prose. */
|
|
235
|
+
export declare const ENGINE_RELOCATED_CODE = "engine-relocated";
|
|
236
|
+
/**
|
|
237
|
+
* The clone-safe wire form of a relocation failure (ADR D10). It travels inside the EXISTING bridge error
|
|
238
|
+
* `detail` field — the `{ message, detail }` error shape in `protocol.ts` (~line 330, e.g.
|
|
239
|
+
* `RpcResultPayload.error`) — so no new protocol field is needed. The attach side (step 7) calls
|
|
240
|
+
* {@link engineRelocatedFromWire} on every bridge error `detail` to reconstruct the typed error.
|
|
241
|
+
*/
|
|
242
|
+
export interface EngineRelocatedWire {
|
|
243
|
+
code: typeof ENGINE_RELOCATED_CODE;
|
|
244
|
+
outcome: EngineRelocatedOutcome;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The exported, consumer-visible relocation error (ADR D10, invariant 5). Consumers branch on `code` +
|
|
248
|
+
* `outcome`, never on message prose — but the message NAMES the semantics so a developer hitting it in a
|
|
249
|
+
* log understands immediately. `[pgxsinkit]`-prefixed like the repo's other errors.
|
|
250
|
+
*/
|
|
251
|
+
export declare class EngineRelocatedError extends Error {
|
|
252
|
+
readonly code = "engine-relocated";
|
|
253
|
+
readonly outcome: EngineRelocatedOutcome;
|
|
254
|
+
constructor(outcome: EngineRelocatedOutcome);
|
|
255
|
+
}
|
|
256
|
+
/** Encode a {@link EngineRelocatedError} to its clone-safe wire form for the bridge error `detail` field. */
|
|
257
|
+
export declare function engineRelocatedToWire(error: EngineRelocatedError): EngineRelocatedWire;
|
|
258
|
+
/**
|
|
259
|
+
* Reconstruct a typed {@link EngineRelocatedError} from a bridge error's `detail` (step 7 calls this on
|
|
260
|
+
* every bridge error detail). STRICT shape check: returns `undefined` for anything that is not exactly the
|
|
261
|
+
* `{ code: "engine-relocated", outcome }` wire form (a foreign/absent detail, a wrong code, a bogus or
|
|
262
|
+
* missing outcome, a non-object) — so a non-relocation error is never misclassified.
|
|
263
|
+
*/
|
|
264
|
+
export declare function engineRelocatedFromWire(detail: unknown): EngineRelocatedError | undefined;
|
|
265
|
+
export {};
|
|
266
|
+
//# sourceMappingURL=engine-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-control.d.ts","sourceRoot":"","sources":["../../src/worker/engine-control.ts"],"names":[],"mappings":"AAYA,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,EAAG,SAAkB,CAAC;AAE9D,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG;IAClE,CAAC,2BAA2B,CAAC,EAAE,oBAAoB,CAAC;CACrD,CAEA;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS,CAMnF;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,mGAAmG;IACnG,YAAY,EAAE,MAAM,CAAC;IACrB,kGAAkG;IAClG,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,+FA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