@pgxsinkit/client 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/boot-report.d.ts +3 -3
  2. package/dist/index.d.ts +35 -119
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +254 -391
  5. package/dist/index.js.map +14 -15
  6. package/dist/opfs-effects.d.ts +1 -1
  7. package/dist/store-boot.d.ts +82 -18
  8. package/dist/store-boot.d.ts.map +1 -1
  9. package/dist/store-lifecycle.d.ts +5 -66
  10. package/dist/store-lifecycle.d.ts.map +1 -1
  11. package/dist/store-meta.d.ts +20 -21
  12. package/dist/store-meta.d.ts.map +1 -1
  13. package/dist/worker/attach-sync-client.d.ts +53 -7
  14. package/dist/worker/attach-sync-client.d.ts.map +1 -1
  15. package/dist/worker/define-sync-worker.d.ts +1 -12
  16. package/dist/worker/define-sync-worker.d.ts.map +1 -1
  17. package/dist/worker/engine-control.d.ts +13 -0
  18. package/dist/worker/engine-control.d.ts.map +1 -1
  19. package/dist/worker/engine-router.d.ts +21 -5
  20. package/dist/worker/engine-router.d.ts.map +1 -1
  21. package/dist/worker/protocol.d.ts +1 -1
  22. package/dist/worker/protocol.d.ts.map +1 -1
  23. package/package.json +3 -3
  24. package/skills/core/SKILL.md +3 -2
  25. package/skills/operating/SKILL.md +50 -12
  26. package/src/boot-report.ts +3 -3
  27. package/src/index.ts +159 -486
  28. package/src/opfs-effects.ts +2 -2
  29. package/src/store-boot.ts +183 -71
  30. package/src/store-lifecycle.ts +12 -96
  31. package/src/store-meta.ts +33 -33
  32. package/src/worker/attach-sync-client.ts +199 -22
  33. package/src/worker/define-sync-worker.ts +94 -26
  34. package/src/worker/engine-control.ts +12 -0
  35. package/src/worker/engine-router.ts +176 -21
  36. package/src/worker/protocol.ts +8 -1
  37. package/dist/adoption.d.ts +0 -118
  38. package/dist/adoption.d.ts.map +0 -1
  39. package/src/adoption.ts +0 -275
@@ -30,12 +30,19 @@ export interface EngineRouterOptions {
30
30
  /** The opaque id of THIS SharedWorker instance — scopes every minted {@link EngineIdentity}'s generation. */
31
31
  swInstanceId: string;
32
32
  /**
33
- * Engine-construction execution limit (`undefined`/absent `maxDispatchMs` = DISABLED, ADR D5). The router
34
- * only FORWARDS tab-reported overdue dispatches into control-channel probes when enabled; the verdict
35
- * threshold is {@link probeMissThreshold}. Disabled → overdue reports are ignored entirely.
33
+ * Engine-construction execution limit (`undefined`/absent `maxDispatchMs` = DISABLED, ADR D5). This one
34
+ * option gates ALL of the router's timing machinery: tab-reported overdue dispatches are forwarded into
35
+ * control-channel probes, and delivered pipes are covered by the {@link connectAckTimeoutMs} window, only
36
+ * when it is enabled. Disabled (the default) → overdue reports are ignored, no window is armed, and no
37
+ * amount of engine silence ever produces a verdict.
36
38
  */
37
39
  executionLimit?: ExecutionLimitConfig;
38
- /** Consecutive unanswered probe pings before an engine-loss verdict (default 3). */
40
+ /**
41
+ * Probe pings that each went a FULL {@link probeIntervalMs} unanswered before an engine-loss verdict
42
+ * (default 3). Counting is per-ping, never per-tick: the threshold-th ping owns its own whole interval, so
43
+ * the effective silence before a verdict is `probeMissThreshold × probeIntervalMs` (plus the ack window
44
+ * where the probe started there).
45
+ */
39
46
  probeMissThreshold?: number;
40
47
  /** Injectable pipe factory (default `() => new MessageChannel()`) so tests can observe both minted ends. */
41
48
  createPipe?: () => {
@@ -46,6 +53,14 @@ export interface EngineRouterOptions {
46
53
  timers?: RouterTimers;
47
54
  /** Milliseconds between probe pings once a dispatch is reported overdue (default 2000). */
48
55
  probeIntervalMs?: number;
56
+ /**
57
+ * Milliseconds a delivered `connect-port` may go unacknowledged by the engine before its liveness is
58
+ * QUESTIONED (default 3000). ONLY armed when {@link executionLimit} is enabled — silence is not evidence of
59
+ * death (ADR-0049 D5), so the default configuration never starts this clock. Where it is armed, expiry is
60
+ * still not a verdict: it starts the {@link probeMissThreshold} probe loop, so a live-but-busy engine
61
+ * answers a ping and survives while a corpse is retired.
62
+ */
63
+ connectAckTimeoutMs?: number;
49
64
  }
50
65
  export interface EngineRouter {
51
66
  /**
@@ -57,7 +72,8 @@ export interface EngineRouter {
57
72
  * tab→SW: the leader coordinator announces a fresh engine control channel. Stamps the next
58
73
  * {@link EngineIdentity} ({@link mintEngineIdentity}), stores the control channel, and returns the identity.
59
74
  * On the engine's `engine-ready` for THIS identity it pipes every attached tab. Any prior engine's control
60
- * listener/probe is cleared first (this does not itself fan a notice).
75
+ * listener/probe is cleared first (this does not itself fan a notice). The announced port is also WATCHED for
76
+ * liveness from here on: its `close` (where the platform has that event) retires this engine.
61
77
  */
62
78
  announceEngine(controlPort: RouterPort): EngineIdentity;
63
79
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"engine-router.d.ts","sourceRoot":"","sources":["../../src/worker/engine-router.ts"],"names":[],"mappings":"AAqBA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAE1B,MAAM,kBAAkB,CAAC;AAE1B;;;;GAIG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAC9D,gBAAgB,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,KAAK,IAAI,CAAC;IAC1F,mBAAmB,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,KAAK,IAAI,CAAC;IAC7F,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,yGAAyG;AACzG,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE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,EAAE,UAAU,GAAG,cAAc,CAAC;IACxD;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,IAAI,CAAC;IAChE,yFAAyF;IACzF,eAAe,IAAI,cAAc,GAAG,SAAS,CAAC;IAC9C,sEAAsE;IACtE,QAAQ,IAAI,MAAM,CAAC;CACpB;AAgBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CA2W7E"}
@@ -17,7 +17,7 @@ export type BridgeTransferable = unknown;
17
17
  * it, `Worker`/`self` do not); `close()` is optional (a dedicated `self` cannot be closed by the tab).
18
18
  */
19
19
  export interface BridgePort {
20
- postMessage: (message: unknown, transfer?: BridgeTransferable[]) => void;
20
+ postMessage: (message: unknown, transfer?: any) => void;
21
21
  addEventListener: (type: "message", listener: (event: {
22
22
  data: unknown;
23
23
  }) => void) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/worker/protocol.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,cAAc,EAAG,kBAA2B,CAAC;AAC1D,eAAO,MAAM,uBAAuB,EAAG,CAAU,CAAC;AAElD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;IACzE,gBAAgB,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,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AAE,OAAO,KAAK,OAAO,CAAC;CACvC;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,WAG3B,CAAC;AAIF,8GAA8G;AAC9G,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,OAAO,EAChB,EAAE,CAAC,EAAE,MAAM,GACV;IAAE,QAAQ,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAU/D;AAED,mHAAmH;AACnH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,cAAc,CAOtE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,OAAO,EAChB,EAAE,CAAC,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,kBAAkB,EAAE,GAC9B,IAAI,CAQN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgxsinkit/client",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "keywords": [
5
5
  "tanstack-intent"
6
6
  ],
@@ -36,8 +36,8 @@
36
36
  "@electric-sql/client": "^1.5.24",
37
37
  "@electric-sql/experimental": "^6.0.24",
38
38
  "@electric-sql/pglite-tools": "0.4.4",
39
- "@pgxsinkit/contracts": "0.2.1",
40
- "@pgxsinkit/pglite-opfs-repacked": "0.2.1"
39
+ "@pgxsinkit/contracts": "0.2.3",
40
+ "@pgxsinkit/pglite-opfs-repacked": "0.2.3"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@electric-sql/pglite": ">=0.5.4-pgx.0 <0.5.5",
@@ -13,7 +13,7 @@ description: >-
13
13
  metadata:
14
14
  type: core
15
15
  library: "@pgxsinkit/client"
16
- library_version: "0.2.2"
16
+ library_version: "0.2.3"
17
17
  source: https://pgxsinkit.github.io/llms-full.txt
18
18
  ---
19
19
 
@@ -225,7 +225,8 @@ Separately from persistence, the store's flush **timing** is `durability`, decla
225
225
  physical behavior is backend-specific: idb detaches its whole-snapshot flush, while OPFS-repacked keeps the
226
226
  host awaited but omits routine physical flushes. `"strict"` restores each backend's strict boundary. The
227
227
  SharedWorker factory, capability-driven Safari/Chromium/Firefox engine placement, relocation outcomes,
228
- adoption, destruction, write-latency rationale, and recovery windows live in the `operating` skill.
228
+ backend permanence, destruction, write-latency rationale, and recovery windows live in the `operating`
229
+ skill.
229
230
  Backups, the SQL exports, and `restoreFrom` are there too.
230
231
 
231
232
  ## Where to look
@@ -9,12 +9,12 @@ description: >-
9
9
  budget, the edge worker timeout vs Electric's long-poll, globalThis.__pgxsinkitDebug + the BootReport,
10
10
  worker mode (defineSyncWorker/attachSyncClient — capability-driven Safari SharedWorker vs elected
11
11
  Chromium/Firefox engine placement, factories, relocation outcomes, diagnostics, and the forwarded rail),
12
- and the store lifecycle surface: storePath naming, backend-specific durability, adoption, supervised
13
- destruction, exportStore/exportDiagnostics/exportData (+ drain guard), and restoreFrom.
12
+ and the store lifecycle surface: storePath naming, backend-specific durability, backend permanence,
13
+ supervised destruction, exportStore/exportDiagnostics/exportData (+ drain guard), and restoreFrom.
14
14
  metadata:
15
15
  type: task
16
16
  library: "@pgxsinkit/client"
17
- library_version: "0.2.2"
17
+ library_version: "0.2.3"
18
18
  source: https://pgxsinkit.github.io/start/operating-in-production/
19
19
  ---
20
20
 
@@ -81,6 +81,12 @@ best-effort: a rejected warm is caught to `undefined` and PGlite loads its own a
81
81
  fails the boot. The `boot pglite assets warm` rail stamp times it. (Board demo: `apps/board/src/board/
82
82
  pglite-warm.ts` shows the Vite `?url` asset-URL pattern PGlite's `exports` field otherwise blocks.)
83
83
 
84
+ **In worker mode the engine loads PGlite's OWN assets — deliberately; do not pre-supply them.** The tab's
85
+ warm still serves the engine, by priming the same-origin HTTP cache the worker fetches from. Handing the
86
+ engine a pre-compiled `WebAssembly.Module` benched NET-NEGATIVE: it forces compile-to-completion before
87
+ instantiate (forfeiting the pipelining PGlite gets from its own streaming load) and the engine realm has no
88
+ overlap window longer than the placement/handshake gap, so the compile only competes for CPU at spawn.
89
+
84
90
  Pre-warming only hides the WASM fetch+compile; `PGlite.create` still spends ~1.9s on `initdb` + store open,
85
91
  and that can't start until the store id is known (usually the signed-in user). To hide it too, create the
86
92
  store EAGERLY under a generated id on the first screen and BIND it at auth. `createClientPGlite(storePath,
@@ -110,14 +116,31 @@ exercises the capability fallback to idb (declared durability kept, `storageBack
110
116
  no probe, no election, the engine boots in the SharedWorker on idb. `createSyncClient` remains the bun/Node
111
117
  mode and the main-thread idb fallback where SharedWorker is missing.
112
118
 
119
+ **A home with NO grant refuses a store already committed to OPFS.** A boot whose home holds no sync-access
120
+ grant (a tab realm, the in-process fallback) over a store whose meta record says `opfs-committed` fails
121
+ CLOSED with `CommittedStoreUnreachableError` — it cannot open that store, and `idb://<storePath>` would be an
122
+ EMPTY sibling (app looks wiped, offline writes fork into a store no worker-mode boot opens). No override
123
+ flag; the message names both exits — boot from a granted home, or destroy first with
124
+ `destroyStoreArtifacts(storePath)`, the path-addressed destroy (the failed boot leaves you no client to call
125
+ `destroy()` on) that deletes both backends plus the sentinel and the meta record and needs no grant; quiesce
126
+ any live worker for the path first (`quiesceStoreWorker`). The error is `instanceof`-branchable on the tab
127
+ side in worker mode too (it crosses the bridge as its class) and carries the refused `storePath`. A no-grant
128
+ `provision` declines that store for the same reason rather than pre-minting the sibling.
129
+
113
130
  **Two-file pattern.** One worker entry, bundled for both SharedWorker and dedicated Worker, calls
114
131
  `defineSyncWorker({ registry, electricUrl, batchWriteUrl, … })` at module top level — no placement or
115
132
  durability option (both are runtime/registry concerns); the registry is CODE, _imported_ by the worker
116
133
  file, never cloned/serialized in. Give each store a stable SharedWorker name and always pass
117
134
  `extendedLifetime: true` (Chromium 148+ grace period; ignore-safe elsewhere). The tab calls
118
- `attachSyncClient({ worker, registry, getToken })`, where `worker` is a **factory**
119
- (`worker: () => SharedWorker`), not an instance — a SharedWorker cannot be reconstructed from itself, and
120
- the factory is what makes SharedWorker-death recovery a guarantee. The elected engine worker needs no
135
+ `attachSyncClient({ worker, registry, getToken })`. Prefer the **factory** form (`worker: () => SharedWorker`)
136
+ over a bare instance or a raw `port` (`SharedWorker.port`) — a SharedWorker cannot be reconstructed from
137
+ itself, so **in elected placement** (Chromium/Firefox) the factory is what arms SharedWorker(router)-death
138
+ recovery: the election coordinator's keepalive reconstructs the router through it. A `port`/instance input
139
+ stays fully functional — provision, attach, and the provision→attach handoff all work (the handoff is keyed
140
+ by `storePath`, not the transport) — but **forfeits that reconstruction** (the coordinator detects the death
141
+ and can only stop). In SW-direct placement (Safari/idbfs) the engine lives in the SharedWorker and there is
142
+ no keepalive; neither form auto-recovers a dead SharedWorker (opt into `bridgeSilenceMs` + a factory for a
143
+ bridge-silence reconnect there). The elected engine worker needs no
121
144
  consumer wiring: the SharedWorker reports its own script URL and the winning tab constructs the engine as
122
145
  `new Worker(reportedUrl, { type: "module" })`. Supply `createEngineWorker` ONLY as an override for entries
123
146
  that cannot be reconstructed from their URL as a module worker (classic-script workers, `blob:`/`data:`
@@ -165,9 +188,18 @@ so GoTrue refresh-token reuse detection can't be tripped by a second client.
165
188
  **Boot: spare-as-worker + internal prefetch overlap.** The spare store (see above) becomes a pre-spawned
166
189
  schemaless worker at the login screen (create + initdb off every thread that matters); the userId→storeId
167
190
  registry stays tab-side in localStorage so binding resolves before attach (SharedWorker naming needs it).
168
- Call `provisionSyncWorker` with the same `worker` factory as attach; an elected
191
+ Call `provisionSyncWorker` with the same `worker` input as attach (the factory form, so elected-mode recovery is armed for provisioning too); an elected
169
192
  Chromium/Firefox pre-open shares the tab's one election coordinator and auto-derives the engine from the
170
193
  SharedWorker's own script URL (override with `createEngineWorker` only for non-module/underivable entries).
194
+ `provisionExpiryMs` (default 60000) is ONE deadline: it retires the abandoned elected claim AND settles the
195
+ returned promise with the typed `ProvisionExpiredError` in both modes, so a provision behind a dead
196
+ SharedWorker connection fails loudly rather than hanging. It bounds YOUR promise; the worker-side create
197
+ attempt follows the placement. SW-direct: the attempt is left running — a later attach adopts that create if it
198
+ completed and waits on it if it is stuck, and a retried provision re-acks the same attempt rather than starting
199
+ a second open. Elected: the deadline also releases the provision claim, and a LAST-claim release retires and
200
+ terminates the engine with that attempt inside it, so the next attach elects a fresh engine (an attach that
201
+ adopted the coordinator earlier keeps its claim, and with it that engine).
202
+ Fire-and-forget callers should `.catch()` it like any un-awaited promise.
171
203
  Claim = bind id, attach, push config + token. On a PROVABLY-fresh claimed store, pass
172
204
  `attachSyncClient({ freshStore: true })` (never for a mapped/returning store) and the worker overlaps the
173
205
  shape catch-up with schema/journal/store-version recovery — far-user boot bounded by `max(create+schema,
@@ -294,11 +326,17 @@ offline for inspection; a clean-journal restore may honor the normal online opti
294
326
  persisted store normally. Consumer docs:
295
327
  <https://pgxsinkit.github.io/concepts/export-and-restore/>.
296
328
 
297
- **Adoption.** An existing idb store is authoritative and is never silently replaced by a newly capable
298
- OPFS home. Automatic adoption is default-off and requires the worker-entry declaration
299
- `adoption: "server-reconstructible"`; only a drained journal, authorized online reconstruction, and a
300
- returned strict barrier permit the idb predecessor to be deleted. `adoptStore()` is the manual
301
- creation-path equivalent and refuses a live store with `StoreInUseError`.
329
+ **Backend permanence.** A store's storage backend is FIXED at its first mint, for the store's whole
330
+ life. An existing idb store is opened IN PLACE by a newly capable OPFS home — no candidate, no
331
+ sentinel, nothing copied, nothing deleted (`storageBackend: "idbfs"` + a `storageFallbackReason` on the
332
+ report); a no-grant home refuses a committed OPFS store instead (above). The ONE route to another
333
+ backend is a deliberate destroy — `client.destroy()`, or `destroyStoreArtifacts(storePath)` for a store
334
+ nobody holds — then a fresh boot that re-syncs from the server and mints on the then-best backend.
335
+ Budget a full cold bootstrap, and expect local-only state (anything written via `rawExec`, un-flushed
336
+ journal rows dropped by `force`) to be gone: the replacement is a NEW store, not a converted one. There
337
+ is no migration API and no in-place conversion. For a storage-PREFERENCE change, mint under a FRESH path
338
+ and destroy the obsolete one in the background — never delete-and-recreate the same path while a
339
+ predecessor worker may still hold it.
302
340
 
303
341
  **Resetting and deleting stores (ADR-0050).** Three non-interchangeable levers — pick by what you keep
304
342
  and whether the store is running:
@@ -52,9 +52,9 @@ export interface BootReport {
52
52
  * The verbatim reason an opfs-CAPABLE boot (the probe granted sync-access handles) nonetheless opened `idbfs`
53
53
  * (ADR-0049 decision 12). Set ONLY when such a fallback actually occurred — never on a plain idb boot (the probe
54
54
  * denied from the start), and never on a granted opfs boot that stayed on opfs. Today's set-sites are the
55
- * granted-then-idb transitions the client owns: a declaration-gated adoption that deferred/failed (idb stays
56
- * authoritative) and the recordless idb-store downgrade (invariant 14 — never a fresh opfs mint over an
57
- * existing idb store's data). Additive field; `reportVersion` stays `1`.
55
+ * granted-then-idb transitions the client owns: the recordless idb-store downgrade (invariant 14 — an existing
56
+ * idb store is opened in place, never overwritten by a fresh opfs mint) and the virgin-uncreatable session
57
+ * idbfs fallback (the verbatim opfs open failure). Additive field; `reportVersion` stays `1`.
58
58
  */
59
59
  storageFallbackReason?: string;
60
60
  /** Whether the ADR-0032 S4 fetch/schema overlap was active for this boot. */