@mowaos/host-browser 0.0.0-stage → 0.5.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.
@@ -0,0 +1,466 @@
1
+ /**
2
+ * Storage Subsystem for MO·WA OS Browser Host.
3
+ *
4
+ * Implements the 6-store IndexedDB layout:
5
+ * 1. `sessions` - WorkflowSession snapshot (keyed by sessionId)
6
+ * 2. `flows` - FlowDefinition JSON (keyed by flowHash, written once on install)
7
+ * 3. `idempotency` - Idempotency records (keyed by dedupKey, verified by intentHash)
8
+ * 4. `audit_log` - TransitionAudit records (keyed by transitionId, chained via prevResultHash)
9
+ * 5. `outbox` - SideEffect outbox records (keyed by outboxId, compound index: [status, nextAttemptAt])
10
+ * 6. `steps` - Step inputs + commit (keyed by transitionId, index: [sessionId, version]),
11
+ * kept so every decision can be replayed (docs/host-contract.md, section 6)
12
+ *
13
+ * Provides:
14
+ * - `IndexedDbStorage`: Production-grade browser implementation.
15
+ * - `MemoryStorage`: Deterministic in-memory implementation for testing/Node.
16
+ */
17
+ function stepRecord(sessionId, commit, record) {
18
+ return {
19
+ ...record.inputs,
20
+ transitionId: commit.audit.transitionId,
21
+ sessionId,
22
+ version: commit.newSession.version,
23
+ commit,
24
+ };
25
+ }
26
+ export class CasConflictError extends Error {
27
+ constructor(sessionId, expected, actual) {
28
+ super(`CAS conflict on session '${sessionId}': expected version ${expected}, actual version ${actual}`);
29
+ this.name = "CasConflictError";
30
+ }
31
+ }
32
+ /**
33
+ * In-memory storage implementation for tests, simulation, and Node environments.
34
+ */
35
+ export class MemoryStorage {
36
+ sessions = new Map();
37
+ flows = new Map();
38
+ idempotency = new Map();
39
+ auditLog = new Map();
40
+ outbox = new Map();
41
+ steps = new Map();
42
+ async getSteps(sessionId) {
43
+ return [...this.steps.values()]
44
+ .filter((s) => s.sessionId === sessionId)
45
+ .sort((a, b) => a.version - b.version)
46
+ .map((s) => structuredClone(s));
47
+ }
48
+ async getFlow(flowHash) {
49
+ return this.flows.get(flowHash) ?? null;
50
+ }
51
+ async saveFlow(flowHash, flow) {
52
+ this.flows.set(flowHash, structuredClone(flow));
53
+ }
54
+ async getSession(sessionId) {
55
+ const s = this.sessions.get(sessionId);
56
+ return s ? structuredClone(s) : null;
57
+ }
58
+ async getIdempotency(dedupKey) {
59
+ const r = this.idempotency.get(dedupKey);
60
+ return r ? structuredClone(r) : null;
61
+ }
62
+ async getAudit(transitionId) {
63
+ const a = this.auditLog.get(transitionId);
64
+ return a ? structuredClone(a) : null;
65
+ }
66
+ async getOutbox(outboxId) {
67
+ const o = this.outbox.get(outboxId);
68
+ return o ? structuredClone(o) : null;
69
+ }
70
+ async getPendingOutbox(limit = 50, now = Date.now()) {
71
+ const due = [];
72
+ for (const record of this.outbox.values()) {
73
+ if (record.status === "PENDING" && record.nextAttemptAt <= now) {
74
+ due.push(structuredClone(record));
75
+ }
76
+ }
77
+ // Strict FIFO ordering: nextAttemptAt ASC, ties broken by outboxId
78
+ due.sort((a, b) => {
79
+ if (a.nextAttemptAt !== b.nextAttemptAt)
80
+ return a.nextAttemptAt - b.nextAttemptAt;
81
+ return a.outboxId.localeCompare(b.outboxId);
82
+ });
83
+ return due.slice(0, limit);
84
+ }
85
+ async getOutboxByStatus(status, limit = 50) {
86
+ const results = [];
87
+ for (const record of this.outbox.values()) {
88
+ if (record.status === status) {
89
+ results.push(structuredClone(record));
90
+ }
91
+ }
92
+ results.sort((a, b) => a.createdAt - b.createdAt || a.outboxId.localeCompare(b.outboxId));
93
+ return results.slice(0, limit);
94
+ }
95
+ async getNextDueAt() {
96
+ let earliest = null;
97
+ for (const record of this.outbox.values()) {
98
+ if (record.status === "PENDING") {
99
+ if (earliest === null || record.nextAttemptAt < earliest) {
100
+ earliest = record.nextAttemptAt;
101
+ }
102
+ }
103
+ }
104
+ return earliest;
105
+ }
106
+ async updateOutboxStatus(outboxId, status, data) {
107
+ const record = this.outbox.get(outboxId);
108
+ if (!record)
109
+ return;
110
+ record.status = status;
111
+ if (data) {
112
+ if (data.attempts !== undefined) {
113
+ record.attempts = data.attempts;
114
+ }
115
+ if (data.nextAttemptAt !== undefined) {
116
+ record.nextAttemptAt = data.nextAttemptAt;
117
+ }
118
+ if (data.lastAttemptAt !== undefined) {
119
+ record.lastAttemptAt = data.lastAttemptAt;
120
+ }
121
+ if ("unhandledSince" in data) {
122
+ record.unhandledSince = data.unhandledSince;
123
+ }
124
+ if ("lastError" in data) {
125
+ record.lastError = data.lastError;
126
+ }
127
+ }
128
+ }
129
+ async atomicCommit(sessionId, expectedVersion, commit, record) {
130
+ const existing = this.sessions.get(sessionId);
131
+ const actualVersion = existing ? existing.version : null;
132
+ if (actualVersion !== expectedVersion) {
133
+ throw new CasConflictError(sessionId, expectedVersion, actualVersion);
134
+ }
135
+ const now = Date.now();
136
+ this.sessions.set(sessionId, structuredClone(commit.newSession));
137
+ this.idempotency.set(commit.dedupKey, {
138
+ dedupKey: commit.dedupKey,
139
+ sessionId,
140
+ intentHash: record.intentHash,
141
+ commit: structuredClone(commit),
142
+ createdAt: now,
143
+ });
144
+ this.auditLog.set(commit.audit.transitionId, structuredClone(commit.audit));
145
+ this.steps.set(commit.audit.transitionId, structuredClone(stepRecord(sessionId, commit, record)));
146
+ const transitionId = commit.audit.transitionId;
147
+ for (const effect of commit.outbox) {
148
+ this.outbox.set(effect.id, {
149
+ outboxId: effect.id,
150
+ sessionId,
151
+ transitionId,
152
+ effect: structuredClone(effect),
153
+ status: "PENDING",
154
+ attempts: 0,
155
+ createdAt: now,
156
+ nextAttemptAt: now,
157
+ });
158
+ }
159
+ }
160
+ }
161
+ /**
162
+ * Production IndexedDB storage engine for Chrome MV3 extension.
163
+ */
164
+ export class IndexedDbStorage {
165
+ dbName;
166
+ version;
167
+ dbPromise = null;
168
+ constructor(dbName = "mowa_kernel_db", version = 3) {
169
+ this.dbName = dbName;
170
+ this.version = version;
171
+ }
172
+ getDb() {
173
+ if (this.dbPromise)
174
+ return this.dbPromise;
175
+ this.dbPromise = new Promise((resolve, reject) => {
176
+ if (typeof indexedDB === "undefined") {
177
+ reject(new Error("indexedDB is not available in the current environment"));
178
+ return;
179
+ }
180
+ const req = indexedDB.open(this.dbName, this.version);
181
+ req.onupgradeneeded = () => {
182
+ const db = req.result;
183
+ if (!db.objectStoreNames.contains("sessions")) {
184
+ db.createObjectStore("sessions", { keyPath: "id" });
185
+ }
186
+ if (!db.objectStoreNames.contains("flows")) {
187
+ db.createObjectStore("flows", { keyPath: "flowHash" });
188
+ }
189
+ if (!db.objectStoreNames.contains("idempotency")) {
190
+ db.createObjectStore("idempotency", { keyPath: "dedupKey" });
191
+ }
192
+ if (!db.objectStoreNames.contains("audit_log")) {
193
+ db.createObjectStore("audit_log", { keyPath: "transitionId" });
194
+ }
195
+ // DB v3: step inputs for replay. Sessions committed before v3 have no steps.
196
+ if (!db.objectStoreNames.contains("steps")) {
197
+ const steps = db.createObjectStore("steps", { keyPath: "transitionId" });
198
+ steps.createIndex("sessionId_version", ["sessionId", "version"], { unique: true });
199
+ }
200
+ let outboxStore;
201
+ if (!db.objectStoreNames.contains("outbox")) {
202
+ outboxStore = db.createObjectStore("outbox", { keyPath: "outboxId" });
203
+ outboxStore.createIndex("status_nextAttemptAt", ["status", "nextAttemptAt"], {
204
+ unique: false,
205
+ });
206
+ }
207
+ else {
208
+ outboxStore = req.transaction.objectStore("outbox");
209
+ if (!outboxStore.indexNames.contains("status_nextAttemptAt")) {
210
+ outboxStore.createIndex("status_nextAttemptAt", ["status", "nextAttemptAt"], {
211
+ unique: false,
212
+ });
213
+ }
214
+ // Note on DB v2 migration:
215
+ // Existing outbox records from v1 may not have nextAttemptAt populated.
216
+ // Cursor migration fills nextAttemptAt = record.createdAt if missing.
217
+ // NOTE: Effects that were previously sent to FAILED_DLQ due to attempt-counting bugs
218
+ // can be recovered by the operator via host.requeueEffect(outboxId).
219
+ const cursorReq = outboxStore.openCursor();
220
+ cursorReq.onsuccess = () => {
221
+ const cursor = cursorReq.result;
222
+ if (cursor) {
223
+ const val = cursor.value;
224
+ if (typeof val.nextAttemptAt !== "number") {
225
+ val.nextAttemptAt = val.createdAt || Date.now();
226
+ cursor.update(val);
227
+ }
228
+ cursor.continue();
229
+ }
230
+ };
231
+ }
232
+ };
233
+ req.onsuccess = () => resolve(req.result);
234
+ req.onerror = () => reject(req.error);
235
+ });
236
+ return this.dbPromise;
237
+ }
238
+ async getFlow(flowHash) {
239
+ const db = await this.getDb();
240
+ return new Promise((resolve, reject) => {
241
+ const tx = db.transaction("flows", "readonly");
242
+ const store = tx.objectStore("flows");
243
+ const req = store.get(flowHash);
244
+ req.onsuccess = () => resolve(req.result?.definition ?? null);
245
+ req.onerror = () => reject(req.error);
246
+ });
247
+ }
248
+ async saveFlow(flowHash, flow) {
249
+ const db = await this.getDb();
250
+ return new Promise((resolve, reject) => {
251
+ const tx = db.transaction("flows", "readwrite");
252
+ const store = tx.objectStore("flows");
253
+ const req = store.put({ flowHash, definition: flow });
254
+ req.onsuccess = () => resolve();
255
+ req.onerror = () => reject(req.error);
256
+ });
257
+ }
258
+ async getSteps(sessionId) {
259
+ const db = await this.getDb();
260
+ return new Promise((resolve, reject) => {
261
+ const tx = db.transaction("steps", "readonly");
262
+ const index = tx.objectStore("steps").index("sessionId_version");
263
+ const range = IDBKeyRange.bound([sessionId, 0], [sessionId, Number.MAX_SAFE_INTEGER]);
264
+ const req = index.getAll(range);
265
+ req.onsuccess = () => resolve(req.result ?? []);
266
+ req.onerror = () => reject(req.error);
267
+ });
268
+ }
269
+ async getSession(sessionId) {
270
+ const db = await this.getDb();
271
+ return new Promise((resolve, reject) => {
272
+ const tx = db.transaction("sessions", "readonly");
273
+ const store = tx.objectStore("sessions");
274
+ const req = store.get(sessionId);
275
+ req.onsuccess = () => resolve(req.result ?? null);
276
+ req.onerror = () => reject(req.error);
277
+ });
278
+ }
279
+ async getIdempotency(dedupKey) {
280
+ const db = await this.getDb();
281
+ return new Promise((resolve, reject) => {
282
+ const tx = db.transaction("idempotency", "readonly");
283
+ const store = tx.objectStore("idempotency");
284
+ const req = store.get(dedupKey);
285
+ req.onsuccess = () => resolve(req.result ?? null);
286
+ req.onerror = () => reject(req.error);
287
+ });
288
+ }
289
+ async getAudit(transitionId) {
290
+ const db = await this.getDb();
291
+ return new Promise((resolve, reject) => {
292
+ const tx = db.transaction("audit_log", "readonly");
293
+ const store = tx.objectStore("audit_log");
294
+ const req = store.get(transitionId);
295
+ req.onsuccess = () => resolve(req.result ?? null);
296
+ req.onerror = () => reject(req.error);
297
+ });
298
+ }
299
+ async getOutbox(outboxId) {
300
+ const db = await this.getDb();
301
+ return new Promise((resolve, reject) => {
302
+ const tx = db.transaction("outbox", "readonly");
303
+ const store = tx.objectStore("outbox");
304
+ const req = store.get(outboxId);
305
+ req.onsuccess = () => resolve(req.result ?? null);
306
+ req.onerror = () => reject(req.error);
307
+ });
308
+ }
309
+ async getPendingOutbox(limit = 50, now = Date.now()) {
310
+ const db = await this.getDb();
311
+ return new Promise((resolve, reject) => {
312
+ const tx = db.transaction("outbox", "readonly");
313
+ const store = tx.objectStore("outbox");
314
+ const index = store.index("status_nextAttemptAt");
315
+ // Single query for status="PENDING" and nextAttemptAt <= now
316
+ const range = IDBKeyRange.bound(["PENDING", -Infinity], ["PENDING", now]);
317
+ const results = [];
318
+ const cursorReq = index.openCursor(range);
319
+ cursorReq.onsuccess = () => {
320
+ const cursor = cursorReq.result;
321
+ if (cursor && results.length < limit) {
322
+ results.push(cursor.value);
323
+ cursor.continue();
324
+ }
325
+ else {
326
+ resolve(results);
327
+ }
328
+ };
329
+ cursorReq.onerror = () => reject(cursorReq.error);
330
+ });
331
+ }
332
+ async getOutboxByStatus(status, limit = 50) {
333
+ const db = await this.getDb();
334
+ return new Promise((resolve, reject) => {
335
+ const tx = db.transaction("outbox", "readonly");
336
+ const store = tx.objectStore("outbox");
337
+ const index = store.index("status_nextAttemptAt");
338
+ const range = IDBKeyRange.bound([status, -Infinity], [status, Infinity]);
339
+ const results = [];
340
+ const cursorReq = index.openCursor(range);
341
+ cursorReq.onsuccess = () => {
342
+ const cursor = cursorReq.result;
343
+ if (cursor) {
344
+ results.push(cursor.value);
345
+ cursor.continue();
346
+ }
347
+ else {
348
+ results.sort((a, b) => a.createdAt - b.createdAt || a.outboxId.localeCompare(b.outboxId));
349
+ resolve(results.slice(0, limit));
350
+ }
351
+ };
352
+ cursorReq.onerror = () => reject(cursorReq.error);
353
+ });
354
+ }
355
+ async getNextDueAt() {
356
+ const db = await this.getDb();
357
+ return new Promise((resolve, reject) => {
358
+ const tx = db.transaction("outbox", "readonly");
359
+ const store = tx.objectStore("outbox");
360
+ const index = store.index("status_nextAttemptAt");
361
+ const range = IDBKeyRange.bound(["PENDING", -Infinity], ["PENDING", Infinity]);
362
+ const cursorReq = index.openCursor(range);
363
+ cursorReq.onsuccess = () => {
364
+ const cursor = cursorReq.result;
365
+ if (cursor) {
366
+ resolve(cursor.value.nextAttemptAt ?? null);
367
+ }
368
+ else {
369
+ resolve(null);
370
+ }
371
+ };
372
+ cursorReq.onerror = () => reject(cursorReq.error);
373
+ });
374
+ }
375
+ async updateOutboxStatus(outboxId, status, data) {
376
+ const db = await this.getDb();
377
+ return new Promise((resolve, reject) => {
378
+ const tx = db.transaction("outbox", "readwrite");
379
+ const store = tx.objectStore("outbox");
380
+ const getReq = store.get(outboxId);
381
+ getReq.onsuccess = () => {
382
+ const record = getReq.result;
383
+ if (!record) {
384
+ resolve();
385
+ return;
386
+ }
387
+ record.status = status;
388
+ if (data) {
389
+ if (data.attempts !== undefined) {
390
+ record.attempts = data.attempts;
391
+ }
392
+ if (data.nextAttemptAt !== undefined) {
393
+ record.nextAttemptAt = data.nextAttemptAt;
394
+ }
395
+ if (data.lastAttemptAt !== undefined) {
396
+ record.lastAttemptAt = data.lastAttemptAt;
397
+ }
398
+ if ("unhandledSince" in data) {
399
+ record.unhandledSince = data.unhandledSince;
400
+ }
401
+ if ("lastError" in data) {
402
+ record.lastError = data.lastError;
403
+ }
404
+ }
405
+ const putReq = store.put(record);
406
+ putReq.onsuccess = () => resolve();
407
+ putReq.onerror = () => reject(putReq.error);
408
+ };
409
+ getReq.onerror = () => reject(getReq.error);
410
+ });
411
+ }
412
+ async atomicCommit(sessionId, expectedVersion, commit, record) {
413
+ const db = await this.getDb();
414
+ return new Promise((resolve, reject) => {
415
+ const tx = db.transaction(["sessions", "idempotency", "audit_log", "outbox", "steps"], "readwrite");
416
+ const sessionStore = tx.objectStore("sessions");
417
+ const idempotencyStore = tx.objectStore("idempotency");
418
+ const auditStore = tx.objectStore("audit_log");
419
+ const outboxStore = tx.objectStore("outbox");
420
+ const stepsStore = tx.objectStore("steps");
421
+ const sessionReq = sessionStore.get(sessionId);
422
+ sessionReq.onsuccess = () => {
423
+ const existing = sessionReq.result;
424
+ const actualVersion = existing ? existing.version : null;
425
+ if (actualVersion !== expectedVersion) {
426
+ tx.abort();
427
+ reject(new CasConflictError(sessionId, expectedVersion, actualVersion));
428
+ return;
429
+ }
430
+ const now = Date.now();
431
+ // Put new session
432
+ sessionStore.put(commit.newSession);
433
+ // Put idempotency record
434
+ idempotencyStore.put({
435
+ dedupKey: commit.dedupKey,
436
+ sessionId,
437
+ intentHash: record.intentHash,
438
+ commit,
439
+ createdAt: now,
440
+ });
441
+ // Put audit log
442
+ auditStore.put(commit.audit);
443
+ // Put step inputs, so the decision can be replayed
444
+ stepsStore.put(stepRecord(sessionId, commit, record));
445
+ // Put outbox items
446
+ const transitionId = commit.audit.transitionId;
447
+ for (const effect of commit.outbox) {
448
+ outboxStore.put({
449
+ outboxId: effect.id,
450
+ sessionId,
451
+ transitionId,
452
+ effect,
453
+ status: "PENDING",
454
+ attempts: 0,
455
+ createdAt: now,
456
+ nextAttemptAt: now,
457
+ });
458
+ }
459
+ };
460
+ tx.oncomplete = () => resolve();
461
+ tx.onerror = () => reject(tx.error);
462
+ tx.onabort = () => reject(new Error("IndexedDB transaction aborted"));
463
+ });
464
+ }
465
+ }
466
+ //# sourceMappingURL=storage.js.map
@@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