@witbitz/sdk 4.3.0 → 4.4.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.
Files changed (80) hide show
  1. package/README.md +2 -2
  2. package/a2aCore.js +26 -5
  3. package/accountErase.js +6 -1
  4. package/accountRecord.js +2 -2
  5. package/agentDoorTools.js +28 -0
  6. package/chatLock.js +16 -0
  7. package/cloudDevicePins.js +2 -2
  8. package/codeAttachments.js +100 -0
  9. package/codeCache.js +149 -0
  10. package/codeCloud.js +0 -2
  11. package/codeComputers.js +1 -0
  12. package/codeFolders.js +116 -0
  13. package/codeHistory.js +76 -0
  14. package/codeLanguage.js +54 -0
  15. package/codeModes.js +2 -0
  16. package/codeProgress.js +54 -0
  17. package/codeSent.js +68 -0
  18. package/codeSubagents.js +107 -0
  19. package/codeTransport.js +22 -0
  20. package/connections.js +17 -18
  21. package/deviceAttest.js +9 -3
  22. package/idb.js +19 -3
  23. package/jobAgents.js +2 -2
  24. package/keptMerge.js +9 -2
  25. package/l1-worker-src.js +1 -1
  26. package/l1-worker.js +93 -30
  27. package/laneAssociation.js +68 -0
  28. package/laneConfig.js +4 -3
  29. package/manifest.json +80 -61
  30. package/memberChange.js +4 -2
  31. package/mirrorBatch.js +47 -0
  32. package/opRouting.js +10 -0
  33. package/package.json +21 -2
  34. package/pdfOptions.js +13 -0
  35. package/pdfText.js +107 -0
  36. package/pdfjs.mjs +28 -0
  37. package/pdfjs.worker.mjs +28 -0
  38. package/protectedLocal.js +18 -2
  39. package/removedMessage.js +1 -1
  40. package/roomEmbed.js +111 -0
  41. package/roomName.js +1 -1
  42. package/roomRoster.js +21 -5
  43. package/rosterCount.js +6 -3
  44. package/sdkA2A.js +160 -40
  45. package/sdkAccount.js +17 -4
  46. package/sdkAccountDoc.js +11 -3
  47. package/sdkAccountSections.js +117 -8
  48. package/sdkBackup.js +35 -8
  49. package/sdkCloudDevice.js +8 -2
  50. package/sdkComputers.js +582 -53
  51. package/sdkDictation.js +114 -24
  52. package/sdkErase.js +9 -4
  53. package/sdkExports.js +4 -2
  54. package/sdkLaneLink.js +3 -3
  55. package/sdkPlan.js +4 -2
  56. package/sdkRekey.js +50 -17
  57. package/sdkReport.js +1 -1
  58. package/sdkSafeMedia.js +1 -1
  59. package/sdkSpeech.js +19 -2
  60. package/sdkTemporaryRooms.js +123 -0
  61. package/sdkVault.js +66 -10
  62. package/sentinelRelease.js +1 -0
  63. package/sharedViews.js +17 -3
  64. package/siri.js +114 -7
  65. package/spaceClient.js +16 -5
  66. package/spaceEmailGate.js +2 -2
  67. package/spaceTemplates.js +99 -0
  68. package/speechOut.js +4 -2
  69. package/store.js +83 -14
  70. package/sw-notif-core.js +9 -7
  71. package/turnVerdict.js +1 -0
  72. package/vault-core.js +480 -112
  73. package/vault-kit.mjs +2 -2
  74. package/vault-screens.js +5 -7
  75. package/vaultAtRest.js +35 -4
  76. package/vaultKeep.js +9 -3
  77. package/vaultWorkerHost.js +23 -4
  78. package/witbitz-admin.mjs +12 -11
  79. package/witbitz-sdk.d.ts +115 -24
  80. package/witbitz-sdk.js +572 -149
package/store.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { PENDING_MS } from './connPending.js'
1
2
  // store.js — local data-persistence layer (Verified-Client Phase 1). Recents, contacts, the hidden
2
3
  // room pointers (pipes/index/invite), the name, and lanes flags — all localStorage. saveRecents's
3
4
  // durability+sync side effects (queueBackup/scheduleIndexPush) are INJECTED via setRecentsSaveHook.
@@ -245,17 +246,24 @@ const CONN_ID = /^[A-Za-z0-9_-]{1,64}$/
245
246
  const isHeldStub = (k) => (k.held === 1 || k.held === true) && (k.callKey == null || k.callKey === '')
246
247
  function vaultConnStore () { try { const s = globalThis.__wbAppStoreState; return s && s.active && s.connKeys && typeof s.ask === 'function' ? s : null } catch { return null } }
247
248
  export function connKeysInVault () { return !!vaultConnStore() }
249
+ const MAX_CONNECTION_KEYS = 64
250
+ export function checkConnectionCapacity(held, pending, id) {
251
+ const reserved = new Set([...Object.keys(held || {}), ...Object.keys(pending || {})])
252
+ if (!reserved.has(id) && reserved.size >= MAX_CONNECTION_KEYS) {
253
+ throw Object.assign(new Error('Remove a connection before adding another on this device.'), { code: 'connection_limit' })
254
+ }
255
+ }
248
256
  export function normConnectionKeys(o) {
249
257
  if (!o || typeof o !== 'object' || Array.isArray(o)) return {}
250
258
  const out = {}
251
259
  const s = (v) => (typeof v === 'string' ? v.slice(0, 256) : '')
252
260
  for (const [id, k] of Object.entries(o)) {
253
- if (Object.keys(out).length >= 64) break
261
+ if (Object.keys(out).length >= MAX_CONNECTION_KEYS) break
254
262
  if (!CONN_ID.test(id) || !k || typeof k !== 'object') continue
255
263
  const held = isHeldStub(k)
256
264
  if (!held && (typeof k.callKey !== 'string' || !k.callKey || k.callKey.length > 256)) continue
257
265
  const at = Number(k.at)
258
- out[id] = { callKey: held ? '' : k.callKey, label: s(k.label), host: s(k.host), account: s(k.account), ...(Number.isFinite(at) && at > 0 ? { at } : {}), ...(held ? { held: 1 } : {}) }
266
+ out[id] = { callKey: held ? '' : k.callKey, label: s(k.label), host: s(k.host), account: s(k.account), ...(s(k.peerId) ? { peerId: s(k.peerId), ...(s(k.peerRoom) ? { peerRoom: s(k.peerRoom) } : {}) } : {}), ...(k.mcp === true ? { mcp: true } : {}), ...(Number.isFinite(at) && at > 0 ? { at } : {}), ...(held ? { held: 1 } : {}) }
259
267
  }
260
268
  return out
261
269
  }
@@ -333,7 +341,7 @@ const b64bytes = (u8) => btoa(String.fromCharCode(...new Uint8Array(u8)))
333
341
  export const vaultCallKeyMinter = {
334
342
  async seal ({ spki, nonce, payload, id, rec }) {
335
343
  const s = vaultConnStore(); if (!s || !s.connMint) return null
336
- let r = null; try { r = await s.ask('connSeal', { conn: id, spki: b64bytes(spki), nonce: b64bytes(nonce), payload, rec: rec || {} }, null, 8000) } catch { return null }
344
+ let r = null; try { r = await s.ask('connSeal', { conn: id, spki: b64bytes(spki), nonce: b64bytes(nonce), payload, rec: rec || {} }, null, 8000) } catch (e) { if (e?.code === 'connection_limit') throw e; return null }
337
345
  if (!r || !r.sealed || typeof r.sealed.ct !== 'string') return null
338
346
  return { sealed: r.sealed, settle: (ok, as = {}) => s.ask('connSettle', { conn: id, ok: !!ok, as }, null, 8000).then((x) => !!(x && x.held)) }
339
347
  },
@@ -345,9 +353,9 @@ export const vaultCallKeyMinter = {
345
353
  return r && r.ok && typeof r.mac === 'string' && r.keySealed && typeof r.keySealed.ct === 'string' ? { mac: r.mac, keySealed: r.keySealed } : null
346
354
  },
347
355
  /** The account's list was read: the vault adopts the pending keys it shows → [[id, { label, host, account }]] (the page keeps stubs). */
348
- async adopt (ids) {
356
+ async adopt (ids, account) {
349
357
  const s = vaultConnStore(); if (!s || !s.connMint) return []
350
- try { const r = await s.ask('connAdopt', { ids: (ids || []).slice(0, 256) }, null, 8000); return Array.isArray(r && r.adopted) ? r.adopted.filter((x) => Array.isArray(x) && typeof x[0] === 'string') : [] } catch { return [] }
358
+ try { const r = await s.ask('connAdopt', { ids: (ids || []).slice(0, 256), account }, null, 8000); return Array.isArray(r && r.adopted) ? r.adopted.filter((x) => Array.isArray(x) && typeof x[0] === 'string') : [] } catch { return [] }
351
359
  },
352
360
  }
353
361
  // a launch whose copy still holds whole keys (written before this, or while the vault was away): asked in once, after the launch
@@ -366,6 +374,13 @@ export const connGoneField = (g = loadConnGone()) => (Object.keys(g).length ? {
366
374
  export function mergeConnectionRecords(cur, inc) {
367
375
  const gone = unionMarks(normConnGone(cur && cur.gone), normConnGone(inc && inc.gone))
368
376
  const keys = normConnectionKeys(mergeByMarks(normConnectionKeys(cur && cur.keys), normConnectionKeys(inc && inc.keys), gone))
377
+ const incoming = normConnectionKeys(inc?.keys)
378
+ for (const [id, saved] of Object.entries(keys)) {
379
+ const fresh = incoming[id]
380
+ if (!fresh?.peerId || !saved.account || fresh.account !== saved.account || (fresh.at || 0) <= (saved.at || 0)) continue
381
+ if (saved.callKey && fresh.callKey && fresh.callKey !== saved.callKey) continue
382
+ keys[id] = { ...saved, peerId: fresh.peerId, peerRoom: fresh.peerRoom, at: fresh.at }
383
+ }
369
384
  return { keys, gone }
370
385
  }
371
386
  // A call key whose grant / finish answer is still out (connections.js postWithPendingKey — state machines pass 9, N#7): this device's
@@ -374,6 +389,36 @@ export const CONN_PENDING_KEY = 'space:connPending'
374
389
  export function loadPendingConnectionKeys() { try { const o = JSON.parse(lsGet(CONN_PENDING_KEY) || '{}'); return o && typeof o === 'object' && !Array.isArray(o) ? o : {} } catch { return {} } }
375
390
  export function savePendingConnectionKeys(o) { try { if (o && Object.keys(o).length) localStorage.setItem(CONN_PENDING_KEY, JSON.stringify(o)); else localStorage.removeItem(CONN_PENDING_KEY) } catch { /* private mode */ } }
376
391
  // stamped `at`: newer than a mark this device holds for the id, so a re-attach after a detach wins everywhere
392
+ const pendingKeyWrites = new Map()
393
+ export const readConnectionDisk = async name => (await import('./protectedLocal.js')).durableRead(name)
394
+ export function updatePendingConnectionKeys(change, readDisk = readConnectionDisk) {
395
+ const update = async () => {
396
+ const rows = JSON.parse(await readDisk(CONN_PENDING_KEY) || '{}')
397
+ if (!rows || typeof rows !== 'object' || Array.isArray(rows)) throw new Error('Pending connection keys could not be read')
398
+ await change(rows)
399
+ savePendingConnectionKeys(rows)
400
+ if (JSON.stringify(JSON.parse(await readDisk(CONN_PENDING_KEY) || '{}')) !== JSON.stringify(rows)) throw new Error('Could not save pending connection keys')
401
+ }
402
+ const run = () => globalThis.navigator?.locks ? navigator.locks.request('wb:pending-connection-keys', update) : update()
403
+ const scope = readDisk
404
+ const next = (pendingKeyWrites.get(scope) || Promise.resolve()).then(run)
405
+ const settled = next.catch(() => {})
406
+ pendingKeyWrites.set(scope, settled)
407
+ settled.then(() => { if (pendingKeyWrites.get(scope) === settled) pendingKeyWrites.delete(scope) })
408
+ return next
409
+ }
410
+ export function removePendingConnectionKey(id, callKey, readDisk = readConnectionDisk) {
411
+ return updatePendingConnectionKeys(rows => { if (rows[id]?.callKey === callKey) delete rows[id] }, readDisk)
412
+ }
413
+ export const appPendingConnectionStore = {
414
+ durable: true,
415
+ keep: (id, rec) => updatePendingConnectionKeys(async rows => {
416
+ for (const [key, entry] of Object.entries(rows)) if (Date.now() - Number(entry?.at || 0) >= PENDING_MS) delete rows[key]
417
+ checkConnectionCapacity(JSON.parse(await readConnectionDisk(CONNKEYS_KEY) || '{}'), rows, id)
418
+ rows[id] = { ...rec, at: Number(rec.at) || Date.now() }
419
+ }),
420
+ drop: (id, callKey) => removePendingConnectionKey(id, callKey),
421
+ }
377
422
  export function rememberConnectionKey(id, k, now = Date.now()) { return saveConnectionKeys({ ...loadConnectionKeys(), [id]: { ...k, at: Math.max(now, (loadConnGone()[id] || 0) + 1) } }) }
378
423
 
379
424
  // ── The Siri inbox (docs/siri-inbox.md): { token, defaultRoom, rooms: { [room]: { alias, label, pub:{x,y}, priv:{jwk}, at } } }.
@@ -419,11 +464,13 @@ export function mergeSiriRecords(cur, inc) {
419
464
  const gone = unionMarks(a.gone, b.gone, Infinity) // normSiri keeps the newest 64
420
465
  const token = siriKeyOf(a, b)
421
466
  const tokenHash = token ? '' : siriKeyOf({ rev: a.rev, token: a.tokenHash }, { rev: b.rev, token: b.tokenHash })
422
- const rooms = mergeSiriRooms(a.rooms, b.rooms, gone) // the newer entry (a tie: local) — and never one a mark took off
467
+ const rev = Math.max(a.rev || 0, b.rev || 0)
468
+ const eligible = [a, b].filter(s => (s.rev || 0) === rev)
469
+ const rooms = mergeSiriRooms(eligible[0].rooms, eligible[1]?.rooms || {}, gone) // the newer entry (a tie: local) — and never one a mark took off
423
470
  // a held stub never beats a whole copy of the SAME key (an older device's record still carries it)
424
- for (const [r, e] of Object.entries(rooms)) { const o = [a.rooms[r], b.rooms[r]].find((x) => x && x.priv && x.pub.x === e.pub.x && x.pub.y === e.pub.y); if (e.held && o) rooms[r] = o }
471
+ for (const [r, e] of Object.entries(rooms)) { const o = eligible.map(s => s.rooms[r]).find((x) => x && x.priv && x.pub.x === e.pub.x && x.pub.y === e.pub.y); if (e.held && o) { const { held, ...meta } = e; rooms[r] = { ...meta, priv: o.priv } } }
425
472
  // the other copy's default when this one's is gone (C3 — the keep's rule: it was blanked)
426
- return normSiri({ token, tokenHash, defaultRoom: siriDefaultOf(rooms, a.defaultRoom, b.defaultRoom), rooms, gone, rev: Math.max(a.rev || 0, b.rev || 0) })
473
+ return normSiri({ token, tokenHash, defaultRoom: siriDefaultOf(rooms, ...eligible.map(s => s.defaultRoom)), rooms, gone, rev })
427
474
  }
428
475
  export function loadSiri() { try { return normSiri(JSON.parse(lsGet(SIRI_KEY) || 'null')) } catch { return normSiri(null) } }
429
476
  export function saveSiri(o) { const n = normSiri(o); try { localStorage.setItem(SIRI_KEY, JSON.stringify(n)) } catch { /* private mode */ } try { dispatchEvent(new CustomEvent('wb-siri-changed')) } catch { /* no window (the SDK, tests) */ } return n } // the change event: the iPhone app's Siri list follows (siriHeld.js syncSiriToNative)
@@ -434,7 +481,7 @@ export function mergeSiri(incoming) {
434
481
  const cur = loadSiri()
435
482
  const next = mergeSiriRecords(cur, inc)
436
483
  if (JSON.stringify(next) === JSON.stringify(cur)) return false
437
- saveSiri(next); return true
484
+ saveSiri(next); return JSON.stringify(loadSiri()) === JSON.stringify(next)
438
485
  }
439
486
  // ── A2A into a member's private lanes (docs/a2a-lanes.md): { lanes: { [laneRoom]: { handle, name, description, pub:{x,y},
440
487
  // priv:{jwk}, peers: [{ id, name, tokenHash, reply, created }] } } }. Each lane's INBOX KEYPAIR lives here and nowhere else
@@ -455,10 +502,29 @@ export function mergeA2A(incoming) {
455
502
  const cur = loadA2A()
456
503
  const next = mergeA2ARecords(cur, inc) // a2aCore.js: union, the newer copy leads, and a REMOVAL in either copy wins over a listing in the other (pass 9, K#3)
457
504
  if (JSON.stringify(next) === JSON.stringify(cur)) return false
458
- saveA2A(next); return true
505
+ saveA2A(next); return JSON.stringify(loadA2A()) === JSON.stringify(next)
459
506
  }
460
507
  /** A DETACH (connectionsSheet.js drop, after the Sentinel revoked it): the mark first — newer than the entry, and recorded even
461
508
  * when this device never held the key (attached elsewhere) — then the key. */
509
+ export async function forgetConnectionKeyDurably(id, readDisk) {
510
+ if (!CONN_ID.test(String(id))) throw new Error('Invalid connection')
511
+ const s = vaultConnStore()
512
+ if (!readDisk && s?.connForget) {
513
+ const receipt = await s.ask('connForget', { conn: id }, null, 8000)
514
+ if (!receipt?.forgotten) throw new Error('The vault could not save the removal')
515
+ return forgetConnectionKey(id)
516
+ }
517
+ const read = readDisk || (await import('./protectedLocal.js')).durableRead
518
+ const save = async () => {
519
+ const cur = loadConnectionKeys()
520
+ const at = Math.max(Date.now(), (Number(cur[id]?.at) || 0) + 1, (loadConnGone()[id] || 0) + 1)
521
+ saveConnGone(unionMarks(loadConnGone(), { [id]: at }))
522
+ if (!(Number(JSON.parse(await read(CONNGONE_KEY) || '{}')[id]) >= at)) throw new Error('Could not save the connection removal')
523
+ const rest = loadConnectionKeys(); delete rest[id]
524
+ return saveConnectionKeys(rest)
525
+ }
526
+ return globalThis.navigator?.locks ? navigator.locks.request('wb:connection-removals', save) : save()
527
+ }
462
528
  export function forgetConnectionKey(id, now = Date.now()) {
463
529
  const cur = loadConnectionKeys()
464
530
  if (CONN_ID.test(String(id))) saveConnGone(unionMarks(loadConnGone(), { [id]: Math.max(now, ((cur[id] && cur[id].at) || 0) + 1) }))
@@ -568,11 +634,14 @@ export function plainProse(s) {
568
634
  .replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, '$1 ($2)')
569
635
  .trim()
570
636
  }
571
- export const rememberCrossed = (r, text) => {
572
- const t = plainProse(text); if (!t) return
573
- try { localStorage.setItem(crossedKey(r), JSON.stringify([...crossedList(r).filter((x) => x !== t), t].slice(-50))) } catch { /* */ }
637
+ export const rememberCrossed = (room, id) => {
638
+ if (typeof id !== 'string' || !id.startsWith('cross:')) return
639
+ const entries = crossedList(room).filter(e => typeof e?.id === 'string' && e.id !== id)
640
+ try { localStorage.setItem(crossedKey(room), JSON.stringify([...entries, { id }].slice(-50))) } catch {}
574
641
  }
575
- export const wasCrossed = (r, text) => { const t = plainProse(text); return !!t && crossedList(r).some((x) => x === t || plainProse(x) === t) }
642
+ export const wasCrossed = (room, mirroredId) => typeof mirroredId === 'string' && mirroredId.startsWith('sh:cross:') &&
643
+ crossedList(room).some(entry => entry?.id === mirroredId.slice(3))
644
+
576
645
 
577
646
  // ── deleted-Space tombstones ────────────────────────────────────────────────────────────────────────────────────────
578
647
  // A delete is a TOMBSTONE, not a local forget: it rides the index doc to your other devices (roomSync publishes
package/sw-notif-core.js CHANGED
@@ -35,7 +35,7 @@ self.wbxIdbGet = (key) => new Promise((resolve) => {
35
35
  setTimeout(() => resolve(null), IDB_WAIT)
36
36
  try {
37
37
  const r = indexedDB.open('spaces', 1)
38
- r.onsuccess = () => { try { const rq = r.result.transaction('kv', 'readonly').objectStore('kv').get(key); rq.onsuccess = () => resolve(rq.result || null); rq.onerror = () => resolve(null) } catch { resolve(null) } }
38
+ r.onsuccess = () => { const db = r.result; db.onversionchange = () => db.close(); try { const rq = db.transaction('kv', 'readonly').objectStore('kv').get(key); rq.onsuccess = () => resolve(rq.result || null); rq.onerror = () => resolve(null) } catch { resolve(null) } }
39
39
  r.onerror = () => resolve(null)
40
40
  r.onupgradeneeded = () => { try { r.result.createObjectStore('kv') } catch { /* already there */ } }
41
41
  } catch { resolve(null) }
@@ -44,7 +44,7 @@ self.wbxIdbSet = (key, value) => new Promise((resolve) => {
44
44
  setTimeout(() => resolve(false), IDB_WAIT)
45
45
  try {
46
46
  const r = indexedDB.open('spaces', 1)
47
- r.onsuccess = () => { try { const rq = r.result.transaction('kv', 'readwrite').objectStore('kv').put(value, key); rq.onsuccess = () => resolve(true); rq.onerror = () => resolve(false) } catch { resolve(false) } }
47
+ r.onsuccess = () => { const db = r.result; db.onversionchange = () => db.close(); try { const rq = db.transaction('kv', 'readwrite').objectStore('kv').put(value, key); rq.onsuccess = () => resolve(true); rq.onerror = () => resolve(false) } catch { resolve(false) } }
48
48
  r.onerror = () => resolve(false)
49
49
  r.onupgradeneeded = () => { try { r.result.createObjectStore('kv') } catch { /* already there */ } }
50
50
  } catch { resolve(false) }
@@ -80,12 +80,12 @@ self.wbxNoteSw = (line) => {
80
80
  // `id` is THIS showing's own mark (the worker puts it in the notification's data too): iOS keeps GHOSTS of long-gone
81
81
  // notifications in getNotifications() — the owner's list held two stale 'space-test' entries for hours — so a fresh
82
82
  // notification that shares a ghost's TAG would read as "still showing" and a consumed tap could never be inferred.
83
- self.wbxNoteShown = async (room, tag, id) => {
84
- if (!room || !tag) return
83
+ self.wbxNoteShown = async (room, tag, id, dest = {}) => {
84
+ if (!tag || !(room || dest.code || dest.intake)) return
85
85
  try {
86
86
  const a = await self.wbxIdbGet('notifShown')
87
87
  const list = (Array.isArray(a) ? a : []).filter((x) => x && x.tag !== tag)
88
- list.push({ room, tag, id: id || '', at: Date.now() })
88
+ list.push({ room, tag, id: id || '', at: Date.now(), ...(dest.card ? { card: dest.card } : {}), ...(dest.code ? { code: dest.code } : {}), ...(dest.intake ? { intake: 1 } : {}) })
89
89
  while (list.length > 12) list.shift()
90
90
  await self.wbxIdbSet('notifShown', list)
91
91
  } catch { /* */ }
@@ -312,14 +312,16 @@ self.wbxWirePush = (cfg) => self.addEventListener('push', (e) => {
312
312
  if (p.remind || p.code) { // "WAITING FOR YOUR APPROVAL" — a room's card or a Code ask (wbxWaitingNotice)
313
313
  await self.wbxNoteSw('push remind ' + (p.code ? 'code' : room.slice(0, 10)))
314
314
  const w = (await self.wbxWaitingNotice(p)) || { title: 'Waiting for your approval', body: 'Open the app to answer.', tag: 'remind', data: {} }
315
- return self.registration.showNotification(w.title, { body: w.body, tag: w.tag, data: { ...w.data, id: idFor(w.tag) }, ...art, renotify: true })
315
+ const id = idFor(w.tag)
316
+ await self.wbxNoteShown(w.data.room || '', w.tag, id, w.data)
317
+ return self.registration.showNotification(w.title, { body: w.body, tag: w.tag, data: { ...w.data, id }, ...art, renotify: true })
316
318
  }
317
319
  // A MESSAGE WAITS IN THE ACCOUNT'S INTAKE (agent/messageIntake.mjs wake list; the owner, 2026-11-09: no notification when Claude Code
318
320
  // wrote to the private lane). Content-free by construction: the box is sealed to the account's devices and nobody on the way knows
319
321
  // who sent it. The tap opens the app (no room: the message room is not one to show), which collects it into its Space.
320
322
  if (p.intake) {
321
323
  await self.wbxNoteSw('push intake')
322
- const id = idFor('intake'); await self.wbxNoteShown('', 'intake', id)
324
+ const id = idFor('intake'); await self.wbxNoteShown('', 'intake', id, { intake: 1 })
323
325
  return self.registration.showNotification('New message for your assistant', { body: cfg.intakeBody || 'An agent you let in (or Siri) sent your assistant a message. Open the app to read it.', tag: 'intake', data: { intake: 1, id }, ...art, renotify: true })
324
326
  }
325
327
  const kind = p.test ? 'test' : p.invite ? 'invite' : p.call ? 'call' : 'message'
package/turnVerdict.js CHANGED
@@ -6,6 +6,7 @@
6
6
  // none of our codes: the API front door cut the request at ~30 s while the server finishes — the reply still comes;
7
7
  // never resend) · failed (a 5xx we raised) · no_answer
8
8
  export const CLOCK_REASON = 'This device’s clock is more than a minute off, so the confidential Space refused the request — set the clock to the right time (automatic), then try again.'
9
+ export const CONTINUATION_WINDOW_MS = 10 * 60 * 1000
9
10
  export const QUEUE_RETRY_MS = 1500
10
11
  export const QUEUE_MAX_TRIES = 640 // ~16 min of holding: longer than the longest turn (13 min since 2026-11-18; was 120 ≈ 180 s)
11
12