@witbitz/sdk 4.3.0 → 4.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.
Files changed (112) hide show
  1. package/README.md +2 -2
  2. package/a2aCore.js +41 -5
  3. package/accountErase.js +15 -4
  4. package/accountIndexDoc.js +24 -7
  5. package/accountRecord.js +6 -2
  6. package/accountStores.js +21 -5
  7. package/acctV2App.js +111 -12
  8. package/acctV2Client.js +11 -1
  9. package/acctV2UiCore.js +27 -7
  10. package/agentDoorTools.js +28 -0
  11. package/awsKey.js +3 -1
  12. package/backupRecord.js +3 -0
  13. package/chatLock.js +16 -0
  14. package/cloudDevicePins.js +2 -2
  15. package/codeAttachments.js +101 -0
  16. package/codeCache.js +173 -0
  17. package/codeCloud.js +2 -2
  18. package/codeComputers.js +9 -0
  19. package/codeFolders.js +116 -0
  20. package/codeHistory.js +76 -0
  21. package/codeLanguage.js +54 -0
  22. package/codeModes.js +2 -0
  23. package/codeProgress.js +54 -0
  24. package/codeSent.js +109 -0
  25. package/codeSubagents.js +107 -0
  26. package/codeTransport.js +46 -5
  27. package/connections.js +37 -20
  28. package/decrypt.html +69 -9
  29. package/deviceAttest.js +9 -3
  30. package/eraseFile.js +15 -0
  31. package/idb.js +19 -3
  32. package/idbSeal.js +5 -2
  33. package/inviteReceive.js +44 -0
  34. package/inviteSend.js +8 -2
  35. package/jobAgents.js +2 -2
  36. package/keptMerge.js +9 -2
  37. package/l1-worker-src.js +1 -1
  38. package/l1-worker.js +122 -43
  39. package/laneAssociation.js +78 -0
  40. package/laneConfig.js +4 -3
  41. package/laneLinkCore.js +9 -0
  42. package/ledgerView.js +30 -4
  43. package/manifest.json +112 -87
  44. package/memberChange.js +4 -2
  45. package/mirrorBatch.js +47 -0
  46. package/offlineBundle.js +21 -0
  47. package/opRouting.js +10 -0
  48. package/package.json +27 -2
  49. package/pdfOptions.js +13 -0
  50. package/pdfText.js +107 -0
  51. package/pdfjs.mjs +28 -0
  52. package/pdfjs.worker.mjs +28 -0
  53. package/protectedLocal.js +52 -13
  54. package/reactionHolders.js +86 -0
  55. package/removedMessage.js +1 -1
  56. package/roomEmbed.js +111 -0
  57. package/roomIntake.js +324 -0
  58. package/roomName.js +1 -1
  59. package/roomRoster.js +30 -7
  60. package/rosterCount.js +6 -3
  61. package/scheduleNext.js +60 -0
  62. package/sdkA2A.js +200 -42
  63. package/sdkAccount.js +88 -18
  64. package/sdkAccountDoc.js +13 -5
  65. package/sdkAccountSections.js +172 -23
  66. package/sdkAgui.js +33 -6
  67. package/sdkBackup.js +53 -11
  68. package/sdkBackupV2.js +15 -3
  69. package/sdkCloudDevice.js +20 -5
  70. package/sdkComputers.js +695 -65
  71. package/sdkDictation.js +115 -25
  72. package/sdkErase.js +12 -5
  73. package/sdkExports.js +19 -8
  74. package/sdkInvitations.js +4 -2
  75. package/sdkKeptAgent.js +19 -3
  76. package/sdkKeptIntake.js +100 -0
  77. package/sdkLaneLink.js +8 -9
  78. package/sdkPlan.js +4 -2
  79. package/sdkRekey.js +122 -22
  80. package/sdkReport.js +1 -1
  81. package/sdkSafeMedia.js +1 -1
  82. package/sdkSchedules.js +8 -1
  83. package/sdkSpeech.js +32 -2
  84. package/sdkTemporaryRooms.js +124 -0
  85. package/sdkTurn.js +12 -4
  86. package/sdkVault.js +66 -10
  87. package/sentinelRelease.js +1 -0
  88. package/sharedViews.js +34 -4
  89. package/siri.js +140 -9
  90. package/spaceClient.js +112 -17
  91. package/spaceEmailGate.js +2 -2
  92. package/spaceExport.js +50 -5
  93. package/spaceFork.js +15 -7
  94. package/spaceTemplates.js +99 -0
  95. package/speechOut.js +21 -5
  96. package/store.js +134 -27
  97. package/sw-notif-core.js +11 -8
  98. package/tapTrail.js +58 -0
  99. package/turnVerdict.js +1 -0
  100. package/usageReceipts.js +12 -5
  101. package/vault-core.js +568 -126
  102. package/vault-kit.mjs +3 -3
  103. package/vault-screens.js +30 -18
  104. package/vaultAtRest.js +38 -6
  105. package/vaultCoreLock.js +3 -1
  106. package/vaultCorePush.js +58 -7
  107. package/vaultKeep.js +9 -3
  108. package/vaultWorkerHost.js +32 -7
  109. package/witbitz-admin.d.ts +3 -0
  110. package/witbitz-admin.mjs +12 -11
  111. package/witbitz-sdk.d.ts +170 -43
  112. package/witbitz-sdk.js +833 -203
package/witbitz-sdk.d.ts CHANGED
@@ -60,8 +60,13 @@ export interface Message {
60
60
  /** A lane's copy only: the original's franking record and its Space — a report of the copy names the ORIGINAL message. */
61
61
  fr?: string
62
62
  frRoom?: string
63
- /** Reactions on this message: emoji → the names that reacted (in a verified room, `reactKeys` maps each name to its key). */
63
+ /** Reactions on this message: emoji → the names that reacted, one per reactor (in a verified room two members may share a name,
64
+ * so a name can appear twice). Who reacted and whether it is yours: `space.reactionsOf(message)`. */
64
65
  reactions?: Record<string, string[]>
66
+ /** Verified rooms: emoji → key id → the name that key reacted under (one reaction per key). */
67
+ reactBy?: Record<string, Record<string, string>>
68
+ /** Verified rooms, the older record: emoji → name → ONE key id that holds that name's reaction. */
69
+ reactKeys?: Record<string, Record<string, string>>
65
70
  /** Agent replies: web sources, the turn's usage, and (confidential rooms) the signed turn certificate. */
66
71
  sources?: { url: string; title?: string }[]
67
72
  usage?: Record<string, unknown>
@@ -216,7 +221,7 @@ export interface SendOptions {
216
221
  /** Tools the page offers the assistant for THIS question (sdk-assistant.md#page-tools) — the shape a Lane's actions take. */
217
222
  tools?: LaneAction[]
218
223
  }
219
- export interface Snapshot { count: number; etag: string; messages: Message[]; /** Safe media: the copies kept beside their photos (never messages) */ safeCopies?: unknown[]; rows: unknown; title?: (RoomTitle & { ts: number | null }) | null; /** a lane's outside-agent tasks waiting for a draft or the member (resume offers them again) */ a2a?: Array<{ taskId: string; peer: { id: string; name: string; reply: 'ask' | 'auto'; job?: true }; text: string; at: number; cursor: number; draft?: string }>; [k: string]: unknown }
224
+ export interface Snapshot { a2aReceipts?: string[]; count: number; etag: string; messages: Message[]; /** Safe media: the copies kept beside their photos (never messages) */ safeCopies?: unknown[]; rows: unknown; title?: (RoomTitle & { ts: number | null }) | null; /** a lane's outside-agent tasks waiting for a draft or the member (resume offers them again) */ a2a?: Array<{ taskId: string; peer: { id: string; name: string; reply: 'ask' | 'auto'; job?: true }; text: string; at: number; cursor: number; draft?: string }>; [k: string]: unknown }
220
225
  /** What on() returns: call it to remove the listener (it returns the space). It also chains `.on()` / `.off()`. */
221
226
  export interface Unsubscribe<S> { (): S; on: S extends { on: infer F } ? F : never; off: S extends { off: infer F } ? F : never }
222
227
 
@@ -243,12 +248,12 @@ export interface SpaceConnections {
243
248
  grants(): Promise<Array<{ id: string; label: string; host: string; status: 'connected' | 'other_member' | 'detached' | 'unknown' }>>
244
249
  /** An MCP connection brings its tools: `tools` (names) to choose them, else the recommended set; `auto` (names) run without asking. */
245
250
  grant(conn: Connection | { id: string; callKey: string; host?: string; label?: string; account?: string; mcp?: boolean }, opts?: { from?: string; tools?: string[]; auto?: string[]; reads?: 'auto' | 'ask' }): Promise<unknown>
246
- revoke(id: string, opts?: { from?: string }): Promise<unknown>
251
+ revoke(id: string, opts?: { from?: string; includeAssistant?: boolean }): Promise<unknown>
247
252
  }
248
253
  /** `space.siri` — this Space's Siri alias and its drops. */
249
254
  export interface SpaceSiri {
250
- enable(opts: { alias: string; label?: string; makeDefault?: boolean }): Promise<{ key: string; endpoint: string; alias: string }>
251
- disable(): Promise<unknown>
255
+ enable(opts?: { alias?: string; label?: string; makeDefault?: boolean; includeAssistant?: boolean }): Promise<{ key: string; endpoint: string; alias: string } | { key: null; hasKey: boolean; endpoint: string; alias: string }>
256
+ disable(opts?: { includeAssistant?: boolean }): Promise<unknown>
252
257
  /** `deliver(text, meta)` takes each drop instead of posting it. At-least-once: dedupe on `meta.id`. */
253
258
  collect(opts?: { deliver?: (text: string, meta: { id: string; room: string; alias: string; at: number }) => unknown }): Promise<{ delivered: number; more?: boolean; elsewhere: Array<{ room: string; label?: string; alias?: string }>; /** captures this device could not open — left in the inbox for a device that can (not deleted) */ unopened?: number }>
254
259
  }
@@ -292,7 +297,7 @@ export declare class Space {
292
297
  readonly room: string
293
298
  /** Latest key rotation observed by this handle. Null until it observes one. */
294
299
  readonly epoch: number | null
295
- readonly shareLink: string
300
+ readonly shareLink: string | null
296
301
  /** The room key (base64url). Treat it as a secret: it IS the admission. null over a keyless client. */
297
302
  readonly key: string | null
298
303
  /** True for a temporary room (createSpace({ temporary })): wiped when idle, never in the account backup. */
@@ -326,8 +331,19 @@ export declare class Space {
326
331
  on<E extends keyof SpaceEvents>(event: E, cb: (e: SpaceEvents[E]) => void, opts?: { replay?: boolean }): Unsubscribe<this>
327
332
  /** No `cb`: every listener for the event. */
328
333
  off<E extends keyof SpaceEvents>(event: E, cb?: (e: SpaceEvents[E]) => void): this
334
+ linkPrivateRoom(target: Space, opts?: { allowStandardDestination?: boolean }): Promise<{ room: string; parent: string; linked: boolean }>
335
+ unlinkPrivateRoom(target: Space): Promise<{ room: string; parent: string; linked: boolean }>
336
+ readonly embed: {
337
+ invite(template: string): Promise<string | { shown: true }>
338
+ read(): Promise<Record<string, unknown> | null>
339
+ update(patch: Record<string, unknown>): Promise<void>
340
+ watch(listener: (state: Record<string, unknown> | null) => void): () => void
341
+ setLiveDocument(name: string, text: string | null): void
342
+ }
343
+ invokeSkill(name: string, args?: Record<string, unknown>): Promise<SendResult>
329
344
  send(text: string, opts?: SendOptions): Promise<SendResult>
330
- /** An emoji on a message, or `{ off: true }` to take yours off (sdk-rooms.md#replies). No new entry, no assistant turn. */
345
+ /** An emoji on a message, or `{ off: true }` to take yours off (sdk-rooms.md#replies). No new entry, no assistant turn.
346
+ * `{ ok: false, error: 'reaction_limit', reactions }` when the message holds as many as it can (50 names on one emoji, 12 emoji) — nothing was added. */
331
347
  react(message: Message, emoji: string, opts?: { off?: boolean; from?: string }): Promise<{ ok: boolean; reactions?: Record<string, string[]>; error?: string }>
332
348
  /** send(), plus a handle on this turn's answer. `timeoutMs` (default 960 000, about 16 minutes — as long as the Spaces app waits; a turn may run 13) stops the turn when it passes; 0 = no timeout. */
333
349
  turn(text: string, opts?: SendOptions & { timeoutMs?: number }): Turn
@@ -340,6 +356,12 @@ export declare class Space {
340
356
  rename(name: string, opts?: { by?: string }): Promise<{ ok: boolean; title: string }>
341
357
  setReplyMode(mode: ReplyMode): Promise<{ mode: ReplyMode }>
342
358
  replyMode(): Promise<ReplyMode>
359
+ /** The room's model pick for every member — the Spaces app's model chip. It wins over the model `configure()` set, on every
360
+ * turn whoever sends it. `id` is a model of `wb.models()` for this Space's tier; any other id throws `unknown_model` and writes
361
+ * nothing. */
362
+ setModel(id: string): Promise<{ model: string }>
363
+ /** Back to the room's own model (the one `createSpace` / `configure()` set), as the chip's Default does. */
364
+ clearModel(): Promise<{ model: null }>
343
365
  /** Which of the assistant's tools run on their own here, and which ask first (a card a person approves). Enforced by the server
344
366
  * on every turn; the same setting as the Witbitz app's ⋯ → Tools. In a room with admins only an admin may set them. */
345
367
  readonly toolRules: {
@@ -366,7 +388,8 @@ export declare class Space {
366
388
  changeMembers(admission: Admission): Promise<MemberChange & { removed: string[]; added: string[]; roles?: true }>
367
389
  /** The same members, a new key (a lost phone, a link sent to the wrong place) — sdk-people.md#members. */
368
390
  rotateKey(): Promise<MemberChange & { rotated: true }>
369
- /** Resend the current link through this app's invite directory. Does not add admission. Attested rooms use their native app. */
391
+ /** Resend the current link through this app's invite directory. Does not add admission. Attested rooms use their native app.
392
+ * By email, `reason: 'not_enrolled'` = not deliverable by email: never signed in, or not findable by email (alike, on purpose). */
370
393
  resendInvite(recipient: { email: string; username?: never } | { username: string; email?: never }): Promise<{ ok: boolean; reason?: string }>
371
394
  /** RETIRED (3.0.0): a Space no longer moves — members change in place (`changeMembers`). Always throws `use_change_members`. */
372
395
  fork(opts?: unknown): Promise<never>
@@ -391,18 +414,24 @@ export declare class Space {
391
414
  isAdmin(email: string): Promise<boolean>
392
415
  isOwner(email: string): Promise<boolean>
393
416
  /** Import a public ChatGPT, Claude, Gemini or Grok share URL. The server validates the source. */
394
- importChat(url: string): Promise<{ imported: number; title: string; entries: number }>
395
- /** Import the text from a WhatsApp chat export (unzip the export first). */
396
- importWhatsApp(text: string): Promise<{ imported: number; title: string; entries: number }>
417
+ importChat(url: string): Promise<{ imported: number; title: string; entries: number; /** messages cut to 8,000 characters to fit; absent when none */ shortened?: number }>
418
+ /** Import the text from a WhatsApp chat export (unzip the export first). `shortened`: how many messages were cut to 8,000 characters. */
419
+ importWhatsApp(text: string): Promise<{ imported: number; title: string; entries: number; shortened?: number }>
397
420
  /** Sealed schedules, shared with the app. Adding/resuming needs an active always-on cloud device. */
398
421
  readonly schedules: {
399
- list(): Promise<Array<{ id: string; when: { every: number } | { at: string; tz: string }; text: string; by: string; at: number; paused?: boolean; pausedAt?: number }>>
422
+ /** `next`: an active daily job's next run (ms), by this device's time zone rules — on the night the clocks skip its time, the
423
+ * moment they jump. Absent for every-N-minutes and paused jobs. */
424
+ list(): Promise<Array<{ id: string; when: { every: number } | { at: string; tz: string }; text: string; by: string; at: number; paused?: boolean; pausedAt?: number; next?: number }>>
425
+ /** A daily `at` with no `tz` is saved in this device's time zone (as the app does), so it keeps its local time across clock changes. */
400
426
  add(job: { when: { every: number } | { at: string; tz?: string }; text: string }): Promise<{ id: string; when: { every: number } | { at: string; tz: string }; text: string; by: string; at: number }>
401
427
  remove(id: string): Promise<unknown[]>
402
428
  pause(id: string, paused?: boolean): Promise<unknown[]>
403
429
  }
404
430
  readonly alwaysOn: {
405
- status(): Promise<{ on: boolean; registered: boolean; waiting?: string }>
431
+ /** `on`: the cloud device holds the Space. `marked`: the account's saved Always on mark (absent when it could not be read) —
432
+ * `on: false, marked: true` = the device let the Space go while the account still keeps it: private assistants and people stay
433
+ * refused (`kept_space`) until `disable()` takes the mark off, or `enable()` keeps it again. */
434
+ status(): Promise<{ on: boolean; registered: boolean; waiting?: string; marked?: boolean }>
406
435
  /** A backed-up solo Space; disconnectLanes explicitly turns its private assistants off first. */
407
436
  enable(opts?: { disconnectLanes?: boolean }): Promise<{ on: true }>
408
437
  disable(): Promise<{ on: false }>
@@ -414,6 +443,9 @@ export declare class Space {
414
443
  fileNamed(name: string): { message: Message; att: Media } | null
415
444
  /** Did this signed-in session send it? (verified with this session's key; never by a typed name). In a vault: the vault's session. */
416
445
  isMine(message: Message): boolean
446
+ /** Who reacted, as the Spaces app shows it. Verified room: one reactor per signed-in member, `mine` by THIS session's key (two
447
+ * members may share a name; a renamed member counts once). Open room: `mine` by name — `from`, or the name this Space sends as. */
448
+ reactionsOf(message: Message, opts?: { from?: string }): Record<string, { count: number; names: string[]; mine: boolean }>
417
449
  /** Who wrote it, as Block knows a person (the server's stamps and the signing key; never a typed name) — null: nothing proves it (sdk-people.md#block). */
418
450
  blockIdentity(message: Message): BlockWho | null
419
451
  /** Report it to Witbitz (App Store rule 1.2; sdk-people.md#report): the message, and with `context: true` the 5 before it. Signed in, a member.
@@ -422,7 +454,8 @@ export declare class Space {
422
454
  static readonly REPORT_REASONS: readonly ReportReason[]
423
455
  /** Does this Space take only a page proved to be one named app (an attested app)? From its public policy; a failed read throws `policy_unreadable`. In a vault: `vault_unsupported`. */
424
456
  attested(): Promise<{ required: boolean; confidential: boolean }>
425
- exportFile(): Promise<{ count: number }>
457
+ /** `attachmentsMissing`: attachments whose bytes could not be read — the file holds only a pointer to this room for them; export again to include them. */
458
+ exportFile(): Promise<{ count: number; attachmentsMissing?: number }>
426
459
  sealedProof(): Promise<Record<string, unknown> | null>
427
460
  /** Confidential rooms: verify every reply's turn certificate on this device. */
428
461
  certificates(): Promise<{ verified: number; failed: Array<{ id: string; reason: string }>; unchecked: number; before: number; /** a private lane's copies of its Space's replies: not signed by the lane's enclave, so counted here and never in `failed` */ copies: number; builds: Array<{ pcr16: string; pcr17: string; audit: string; replies: number; /** the build enclave's release: rebuilt from `commit`, entry `logIndex` in Rekor (`rekor` links it); null = not in the published log; absent = the log could not be read */ source?: { commit: string; logIndex: number; rekor: string } | null }>; calls: Record<string, number>; tools: Record<string, number> }>
@@ -455,7 +488,7 @@ export interface LaneA2A {
455
488
  enable(opts: { name: string; description?: string }): Promise<{ cardUrl: string; mcpUrl: string }>
456
489
  /** `job: true` — an agent that takes jobs: it reports and its run ends, reading no reply; its reports are told to the member and a follow-up goes as a new job. */
457
490
  /** In a vault (`Witbitz.inVault`) the token is shown on the vault's own screen and never reaches the page: `token` is null and `shown` true. */
458
- addPeer(name: string, opts?: { reply?: 'ask' | 'auto'; job?: boolean }): Promise<{ id: string; token: string | null; shown?: boolean; cardUrl: string; mcpUrl: string }>
491
+ addPeer(name: string, opts?: { reply?: 'ask' | 'auto'; job?: boolean; reconnect?: boolean; previousPeerId?: string; connectionId?: string }): Promise<{ id: string; token: string | null; shown?: boolean; roomListPending?: boolean; cardUrl: string; mcpUrl: string }>
459
492
  setReply(peerId: string, reply: 'ask' | 'auto'): Promise<{ id: string; reply: 'ask' | 'auto' }>
460
493
  removePeer(peerId: string): Promise<{ removed: boolean }>
461
494
  disable(): Promise<{ disabled: boolean }>
@@ -473,8 +506,10 @@ export declare class Lane extends Space {
473
506
  turn(text: string, opts?: SendOptions & { tools?: LaneAction[]; replace?: boolean; links?: Array<Space | { space: Space; label?: string }>; timeoutMs?: number }): Turn
474
507
  /** Synchronous: returns the link's handle. */
475
508
  link(other: Lane, opts?: { to?: string; as?: string; cap?: number; resume?: LaneLink['state'] }): LaneLink
476
- /** Connect a kept always-on Space as a job agent of this private lane. Credentials stay in the vault in vault mode. */
477
- linkKept(space: Space, opts?: { spaceName?: string; laneName?: string }): Promise<{ lane: string; space: string; connId: string; lPeer: string; sPeer: string }>
509
+ /** Connect a kept always-on Space as a job agent of this private lane. Credentials stay in the vault in vault mode.
510
+ * `delivery`: 'device' — the kept Space's jobs reach the cloud device through the account's message intake; 'client' — that could
511
+ * not be set up (`deliveryError` says why) and its jobs wait at the agent door until a client collects them. */
512
+ linkKept(space: Space, opts?: { spaceName?: string; laneName?: string }): Promise<{ lane: string; space: string; connId: string; lPeer: string; sPeer: string; delivery: 'device' | 'client'; deliveryError?: string }>
478
513
  unlinkKept(space: Space, link: { lane: string; space: string; connId: string; lPeer: string; sPeer: string }): Promise<{ disconnected: true }>
479
514
  /** Copy the shared room's new messages into this lane now (a lane opened with `mirror`). */
480
515
  mirrorNow(): Promise<unknown>
@@ -483,7 +518,22 @@ export declare class Lane extends Space {
483
518
  // ─── The client ───────────────────────────────────────────────────────────────────────────────────────────────────────
484
519
  /** `sign`: this device's signing keypair (JWKs) — the key a verified room stamps on its messages as `spk`. */
485
520
  export interface Session { email: string; idToken: string; exp: number; sign?: { pub: { kty: string; crv: string; x: string; y: string }; priv: Record<string, unknown> } }
521
+ export type VaultOptions = Omit<WitbitzOptions, 'session' | 'attest' | 'sentinel' | 'devRoot' | 'enclaveClaim' | 'backup' | 'siri' | 'a2a' | 'invite' | 'builds'> & {
522
+ vault: string
523
+ session?: null
524
+ attest?: never
525
+ sentinel?: never
526
+ devRoot?: never
527
+ enclaveClaim?: never
528
+ backup?: null
529
+ siri?: null
530
+ a2a?: null
531
+ invite?: null
532
+ builds?: 'published' | { mode?: 'published'; state?: BuildsState }
533
+ }
534
+
486
535
  export interface WitbitzOptions {
536
+ keepTemporaryRooms?: boolean
487
537
  endpoint?: string
488
538
  /** The origin a shareLink opens in: links read `<viewer>/space?room=<id>#mk=<key>`. */
489
539
  viewer?: string
@@ -536,20 +586,20 @@ export interface VaultLock { available: true; on: boolean; protect: boolean }
536
586
  /** A vault's notifications on this device, as the person set them (a vault started with `push: true`). */
537
587
  export interface VaultPush { available: true; on: boolean }
538
588
  /** A Space in the vault's list — never its link (the link carries the key). */
539
- export interface VaultRoom { room: string; title: string; at: number; /** a private lane: the room of its Space */ lane?: string; /** a confidential Space */ tier?: 'enclave'; /** every member gets a private assistant (sdk-agents.md#lanes-for-everyone) */ lanes?: true }
589
+ export interface VaultRoom { detachedLane?: true; room: string; title: string; at: number; /** a private lane: the room of its Space */ lane?: string; /** a confidential Space */ tier?: 'enclave'; /** every member gets a private assistant (sdk-agents.md#lanes-for-everyone) */ lanes?: true }
540
590
  /** `wb.vault` — the vault this page runs in (docs: § Vault mode). The keys are there; this page never holds one. */
541
591
  export declare class VaultSession {
542
592
  /** The vault's origin. */
543
593
  readonly origin: string
544
- /** What the vault said when the page connected. */
545
- readonly info: { v: number; tenant: string; endpoint: string; signedIn: boolean; email: string; /** the vault session key's PUBLIC id (what `space.isMine` compares) — '' when signed out; an older vault sends none */ keyId?: string; rooms: VaultRoom[]; /** the Siri Shortcut: never its key */ siri: { key: null; hasKey: boolean; endpoint: string }; /** the backup and account, as `wb.backup` / `wb.account` read them */ account: { enabled: boolean; format: string | null; /** 'account' (the Witbitz account service) | 'legacy' | null */ service: 'account' | 'legacy' | null; /** a restore and deleting the account need the emailed code as well */ gated: boolean; deviceId: string; rooms: Array<{ room: string; kind: string; label?: string; /** a lane's Space: its room id */ shared?: string; archived?: boolean; pinned?: boolean }>; devices: unknown[]; links: unknown[]; lastError: { message: string; code?: string; status?: number } | string | null; erasure: boolean }; /** only a vault started with `lock: true` says it: the lock (a passkey at every launch) and storage protection, as the person set them */ lock?: VaultLock; /** only a vault started with `push: true` says it: notifications on this device */ push?: VaultPush; /** the Space whose notification the person tapped to open the vault */ notifOpen?: string }
594
+ /** Connection details and the latest room, sign-in and account state reported by the vault. */
595
+ readonly info: { v: number; tenant: string; endpoint: string; signedIn: boolean; email: string; /** the vault session key's PUBLIC id (what `space.isMine` compares) — '' when signed out; an older vault sends none */ keyId?: string; rooms: VaultRoom[]; /** the Siri Shortcut: never its key */ siri: { key: null; hasKey: boolean; endpoint: string }; /** the backup and account, as `wb.backup` / `wb.account` read them */ account: { enabled: boolean; format: string | null; /** 'account' (the Witbitz account service) | 'legacy' | null */ service: 'account' | 'legacy' | null; /** a restore and deleting the account need the emailed code as well */ gated: boolean; deviceId: string; rooms: Array<{ room: string; kind: string; label?: string; /** a lane's Space: its room id */ shared?: string; archived?: boolean; pinned?: boolean; /** when the room was last opened or recorded on any of the account's devices — at most an hour behind */ lastOpenedAt?: number }>; devices: unknown[]; links: unknown[]; lastError: { message: string; code?: string; status?: number } | string | null; erasure: boolean }; /** only a vault started with `lock: true` says it: the lock (a passkey at every launch) and storage protection, as the person set them */ lock?: VaultLock; /** only a vault started with `push: true` says it: notifications on this device */ push?: VaultPush; /** the Space whose notification the person tapped to open the vault */ notifOpen?: string }
546
596
  /** The Spaces this vault holds, newest first. */
547
597
  rooms(): Promise<VaultRoom[]>
548
598
  /** A live Space for a room the vault holds; its key stays in the vault (`space.key` and `space.shareLink` are null). A private
549
599
  * lane's room id (`rooms()` marks it with `lane`) gives a `Lane` of its Space — `lane_space_gone` once that Space is forgotten. */
550
600
  openRoom(room: string, opts?: { resume?: Snapshot }): Promise<Space | Lane>
551
601
  /** The vault shows its share screen with the invite link; the link never reaches this page. */
552
- share(space: Space | string, opts?: { title?: string }): Promise<{ shown: true }>
602
+ share(space: Space | string, opts?: { title?: string; hostInviteTemplate?: string }): Promise<{ shown: true }>
553
603
  /** The vault shows the Siri Shortcut's key in its own screen; the key never reaches this page. */
554
604
  showSiriKey(): Promise<{ shown: true }>
555
605
  /** The vault shows its LOCK SHEET: the person turns the lock and "Also protect this device's storage" on or off there; resolves
@@ -560,7 +610,10 @@ export declare class VaultSession {
560
610
  * with `push: true`. */
561
611
  showNotifications(): Promise<VaultPush>
562
612
  /** The vault shows its sign-in screen; resolves once signed in. */
563
- signIn(opts?: { email?: string }): Promise<{ email: string }>
613
+ /** The member enters their email in the vault. */
614
+ signIn(): Promise<{ email: string }>
615
+ /** @deprecated The vault ignores the supplied email. Use signIn() and enter the address in the vault. */
616
+ signIn(opts: { email?: string }): Promise<{ email: string }>
564
617
  /** The person confirms in the vault; rejects with code `cancelled` if they do not. */
565
618
  signOut(): Promise<{ signedIn: false }>
566
619
  whoami(): Promise<{ signedIn: boolean; email?: string; keyId?: string }>
@@ -569,7 +622,7 @@ export declare class VaultSession {
569
622
  forget(space: Space | string): Promise<{ forgotten: boolean }>
570
623
  on(event: 'rooms', cb: (e: { rooms: VaultRoom[] }) => void): () => void
571
624
  on(event: 'joined', cb: (e: { room: string }) => void): () => void
572
- on(event: 'signedIn', cb: (e: { email: string }) => void): () => void
625
+ on(event: 'signedIn', cb: (e: { email: string; keyId?: string }) => void): () => void
573
626
  on(event: 'signedOut', cb: (e: object) => void): () => void
574
627
  /** This device was signed out of the account (or the account was deleted) from another device: the vault forgot the account, its
575
628
  * sign-in and its Spaces here, and `info.signedIn` is false. `reason: 'erased'`: the account was deleted. */
@@ -659,7 +712,9 @@ export declare class Protect {
659
712
  }
660
713
 
661
714
  /** `wb.backup` — the account backup (a recovery code wraps a master secret; the record is sealed in the vault). */
662
- export interface VaultAccountBackup extends Omit<AccountBackup, 'enable' | 'restore' | 'rooms' | 'protectRecoveryEmail' | 'save' | 'beginEmailMove' | 'finishEmailMove' | 'cancelPendingEmailMove'> {
715
+ export interface VaultAccountBackup extends Omit<AccountBackup, 'enable' | 'restore' | 'rooms' | 'protectRecoveryEmail' | 'save' | 'beginEmailMove' | 'finishEmailMove' | 'cancelPendingEmailMove' | 'migrate' | 'cancelEmailMove'> {
716
+ migrate(opts?: { silent?: boolean }): Promise<{ migrated: true; trust: string | null }>
717
+ cancelEmailMove(): Promise<{ cancelled: true }>
663
718
  beginEmailMove(): Promise<{ ready_at: number; expires: number }>
664
719
  finishEmailMove(): Promise<{ enabled: true }>
665
720
  cancelPendingEmailMove(): Promise<{ cancelled: true }>
@@ -680,7 +735,7 @@ export interface AccountBackup {
680
735
  /** Where the account is kept: 'account' (the Witbitz account service — a new account in a vault that names its tenant),
681
736
  * 'legacy' (the backup store every account used before), null when there is none on this client. */
682
737
  readonly service: 'account' | 'legacy' | null
683
- readonly rooms: Array<{ room: string; link: string; kind: 'space' | 'lane'; label?: string; shared?: string; archived?: boolean; pinned?: boolean }>
738
+ readonly rooms: Array<{ room: string; link: string; kind: 'space' | 'lane'; label?: string; shared?: string; laneOrigin?: 'minted'; mintedFor?: string; archived?: boolean; pinned?: boolean; /** read-only: when the room was last opened or recorded on any of the account's devices (ms since 1970) — at most an hour behind; sort by it, newest first, for the app's order (sdk-accounts.md#account-index) */ lastOpenedAt?: number }>
684
739
  onState: ((state: unknown) => void) | null
685
740
  enable(opts?: { email?: string }): Promise<{ code: string }>
686
741
  restore(opts: { code: string; email?: string; ticket?: string; emailCode?: string }): Promise<{ rooms: AccountBackup['rooms'] }>
@@ -724,7 +779,9 @@ export interface AccountBackup {
724
779
  export interface AccountIndex {
725
780
  readonly enabled: boolean
726
781
  readonly deviceId: string
727
- readonly rooms: AccountBackup['rooms']
782
+ /** `alwaysOn: true` — the account's saved Always on mark, as of the last sync (absent: not marked, or no sync yet). People and
783
+ * private assistants are refused for a marked Space (`kept_space`) even when its cloud device let it go (`alwaysOn.status()`). */
784
+ readonly rooms: Array<AccountBackup['rooms'][number] & { alwaysOn?: true }>
728
785
  /** `sdk`: the SDK release a device last synced with (3.24.0 and later; an older device has none). */
729
786
  readonly devices: Array<{ id: string; name: string; seenAt: number; signedOut: boolean; current: boolean; sdk?: string }>
730
787
  readonly links: Array<{ a: string; b: string; cap?: number }>
@@ -748,12 +805,12 @@ export interface AccountIndex {
748
805
  signOutDevice(deviceId: string, opts?: { getCode?: (address: string) => Promise<string> }): Promise<{ revoked: boolean }>
749
806
  signOut(deviceId: string, opts?: { reason?: 'erased' | 'moved' }): this
750
807
  /** `signedOut: true` (and empty lists) when another device signed this one out. */
751
- sync(): Promise<{ ok: boolean; rooms: AccountBackup['rooms']; devices: AccountIndex['devices']; signedOut?: boolean }>
808
+ sync(): Promise<{ ok: boolean; rooms: AccountIndex['rooms']; devices: AccountIndex['devices']; signedOut?: boolean }>
752
809
  start(opts?: { every?: number }): this
753
810
  stop(): this
754
811
  /** What this account's turns cost in a month (UTC, default this one), across its rooms, whoever paid — folded from the
755
812
  * receipts every turn carries (docs: #account-usage). Amounts in micro-dollars; `costUsd` in dollars. */
756
- usage(opts?: { month?: string }): Promise<{ month: string; replies: number; costMicros: number; costUsd: number; in: number; out: number; byPayer: { you: number; admin: number; app: number; witbitz: number }; byDay: Record<string, number> }>
813
+ usage(opts?: { month?: string }): Promise<{ month: string; replies: number; costMicros: number; costUsd: number; in: number; out: number; /** replies whose cost counts only their priced calls (some calls reported no price): costMicros is then a floor */ unpriced: number; byPayer: { you: number; admin: number; app: number; witbitz: number }; byDay: Record<string, number> }>
757
814
  /** Optional sections (3.24.0), kept as the Spaces app keeps them: nothing is read until you use one (sdk-accounts.md#account-sections). */
758
815
  readonly contacts: AccountContacts
759
816
  readonly name: AccountSection<string>
@@ -769,6 +826,11 @@ export interface AccountIndex {
769
826
  set(lock: { kind: 'room' | 'code'; target: string; pin: string; title?: string }): Promise<Record<string, unknown> | null>
770
827
  remove(lock: { lockId: string }): Promise<Record<string, unknown> | null>
771
828
  changePin(lock: { lockId: string; pin: string; newPin: string }): Promise<Record<string, unknown> | null>
829
+ previewDeleteAll(): Promise<{ targets: { lockId: string; kind: 'room' | 'code'; target: string }[]; privateAssistants: { room: string; parent: string; title: string }[] }>
830
+ /** Removes the listed targets without requiring their PIN. Pass `lockIds` from previewDeleteAll so a lock added since is not deleted; without them, a call right after a preview fails `changed_meanwhile` (`added`) when a lock was added since. */
831
+ deleteAll(opts?: { includePrivateAssistants?: boolean; privateAssistantRooms?: readonly string[]; lockIds?: readonly string[] }): Promise<{ lockId: string; kind: 'code' | 'room'; target: string; deleted: boolean }[]>
832
+ /** Uses the app's synced wrong-PIN backoff. Does not isolate or encrypt room data. */
833
+ match(attempt: { pin: string }): Promise<{ ok: boolean; next: number; matches: { lockId: string; kind: 'code' | 'room'; target: string; title: string }[] }>
772
834
  /** Uses the app's synced wrong-PIN backoff. Does not isolate or encrypt room data. */
773
835
  check(attempt: { lockId: string; pin: string }): Promise<{ ok: boolean; next: number }>
774
836
  on(ev: 'change', fn: (doc: Record<string, unknown> | null) => void): unknown
@@ -830,10 +892,19 @@ export interface InviteAccount {
830
892
  restore(state: unknown): this
831
893
  /** Publish it (signIn and refreshSession do). → the status */
832
894
  enroll(): Promise<InviteAccount['status']>
895
+ /** The invitations delivered to this account for this app (`resendInvite`, a member change's invite), newest per room, opened with
896
+ * this device's invite key. The inbox keeps them all: every call returns every one. Open one with `openSpace(link)`. In vault
897
+ * mode the vault opens them, asks the person before joining a Space it does not hold, and returns only the rooms it holds, each
898
+ * with `link: ''` — open one with `wb.vault.openRoom(room)` (an older vault kit: `vault_unsupported`). Throws
899
+ * `no_invite_key`, `unreachable`. Anyone who finds the inbox can drop an invitation: `link` is
900
+ * always an https address of `room` carrying its key (others are skipped), but `title` and `from` are the sender's own words —
901
+ * show them as text, never as markup. */
902
+ collect(): Promise<Array<{ room: string; link: string; title: string; from: string; at: number }>>
833
903
  }
834
904
 
835
905
  /** `wb.a2a` — the account's A2A record. Persist `state` (it holds the lanes' inbox private keys). */
836
906
  export interface A2AAccount {
907
+ stopJobAgent(name: string): Promise<{ removed: Array<{ source: string; id: string }> }>
837
908
  readonly state: unknown
838
909
  readonly endpoint: string
839
910
  onState: ((state: unknown) => void) | null
@@ -845,6 +916,7 @@ export interface A2AAccount {
845
916
  export interface Connection { id: string; label: string; host: string; /** absent in a vault: the vault keeps it (grant by id) */ callKey?: string; account?: string; /** a webhook: its one path (docs/signed-webhooks.md) */ webhook?: string; /** an agent that takes jobs: where the job goes and the fixed headers (outside-agents.md) */ job?: { field: string; headers: Record<string, string> }; /** an MCP server (attachMcp / finishMcp): granting it brings its tools */ mcp?: boolean }
846
917
  /** `wb.connections` — credentials the standing Sentinel holds and spends for the account. */
847
918
  export interface Connections {
919
+ recover(id: string): Promise<Connection | null>
848
920
  /** Public picker data shared with the app. Use category 'Agents' for outside agents; no credentials are returned. */
849
921
  catalog(opts?: { category?: string }): Array<{ name: string; kind: string; desc: string; cat: string; url?: string; host?: string; registered?: boolean; [k: string]: unknown }>
850
922
  spacesUsing(id: string): Promise<{ rooms: string[]; unreadable: string[]; incomplete: boolean }>
@@ -879,13 +951,19 @@ export interface ComputerInfo { id: string; name: string; cloud: true; version:
879
951
  * same checks as the Witbitz app's Code section; their hours charge the person's AWS key. Not available in vault mode yet
880
952
  * (`vault_mode`). Errors carry `code`: not_enabled, sign_in_required, not_found, keys_refused, aws_limit, attestation, declined. */
881
953
  export interface Computers {
954
+ setDefaultPrivate(id: string, on: boolean): Promise<void>
955
+ connections(id: string): Promise<Computer['connections']>
882
956
  list(): Promise<ComputerInfo[]>
883
957
  /** Model keys come from the account (capped) unless `keys` brings the person's own. */
884
958
  create(opts?: { name?: string; keys?: { trustedRouter: string; tinfoil?: string; github?: string }; egress?: { mode: string; hosts?: string[] }; browsePrivate?: boolean }): Promise<ComputerInfo>
885
959
  /** Start or wake it, check it runs the published Witbitz image (a NEW published image: 'auto' accepts it, 'ask' calls
886
960
  * `onNewImage(pcr0, role)`), hand it the person's keys sealed, connect. */
887
- open(id: string, opts?: { onStep?(step: 'requesting' | 'starting' | 'verifying' | 'opening' | 'connecting' | string): void; images?: 'auto' | 'ask'; onNewImage?(pcr0: string, role: 'cloud-computer' | 'sentinel'): boolean | Promise<boolean> }): Promise<Computer>
961
+ cachedSessions(id: string): Promise<Array<{ id: string; at: number; msgs: number; title: string; dir: string }>>
962
+ cachedDirectory(id: string): Promise<{ at: number; list: Array<{ id: string; title?: string; directory?: string; time: { created?: number; updated?: number; archived?: number } }> } | null>
963
+ cachedSession(id: string, sessionId: string): Promise<{ msgs: unknown[]; at: number; trimmed: boolean; dir?: string } | null>
964
+ open(id: string, opts?: { cache?: boolean; onStep?(step: 'requesting' | 'starting' | 'verifying' | 'opening' | 'connecting' | string): void; images?: 'auto' | 'ask'; onNewImage?(pcr0: string, role: 'cloud-computer' | 'sentinel'): boolean | Promise<boolean> }): Promise<Computer>
888
965
  /** Closed, its account keys cancelled, then removed from the account. */
966
+ close(id: string): Promise<boolean>
889
967
  remove(id: string): Promise<void>
890
968
  /** This month on the person's AWS key (dollars; show credits: 100 = $1), or null before the first opening. */
891
969
  usage(): Promise<{ live: boolean; tier?: 'full' | 'free'; month?: { usd: number; capUsd: number; byKind: Record<string, number> }; resetsAt?: string; why?: string } | null>
@@ -898,21 +976,43 @@ export interface CodePromptOptions {
898
976
  }
899
977
  export interface ComputerScope { session?: string; dir?: string }
900
978
 
979
+ export interface ComputerKeyGuardRequest { readonly id: string; readonly expires: number; readonly summary: Record<string, unknown>; readonly tag: string }
901
980
  export interface Computer {
902
981
  readonly id: string
903
982
  readonly name: string
904
983
  readonly status: 'online' | 'connecting' | 'offline'
984
+ preferredAgent(): Promise<string>
985
+ setPreferredAgent(sessionId: string, agent: string): Promise<string>
986
+ onAutoVerdict(sessionId: string, callback: (event: { sessionID: string; id: string; action: string; reason?: string; answered?: boolean | null }) => void, opts?: { family?: boolean }): () => void
987
+ onProgress(sessionId: string, callback: (event: { sessionID: string; phase: string; label: string; attempt: number; tool: string; subject: string; chars: number }) => void): () => void
988
+ preferredEffort(ref: string): string
989
+ setPreferredEffort(sessionId: string, ref: string, effort: string): Promise<void>
990
+ preferredModel(): Promise<string>
991
+ setPreferredModel(sessionId: string, model: string): Promise<string>
905
992
  readonly sessions: {
906
993
  list(): Promise<unknown[]>
907
- create(opts?: { dir?: string; title?: string }): Promise<{ id: string; [k: string]: unknown }>
908
- messages(sessionId: string, opts?: { limit?: number }): Promise<unknown[]>
994
+ create(opts?: { dir?: string; title?: string; agent?: string; model?: string }): Promise<{ id: string; [k: string]: unknown }>
995
+ messages(sessionId: string, opts?: { limit?: number; cursor?: string }): Promise<unknown[]>
996
+ messagePage(sessionId: string, opts?: { limit?: number; cursor?: string }): Promise<{ messages: unknown[]; cursor: string | null }>
997
+ agents(sessionId: string): Promise<Array<{ name: string; description: string }>>
998
+ saveDraft(sessionId: string, parts: Array<{ type: string; [key: string]: unknown }>): string
999
+ listDrafts(sessionId: string): Array<{ id: string; reason: string }>
1000
+ getDraft(sessionId: string, id: string): { id: string; reason: string; parts: unknown[] } | null
1001
+ discardDraft(sessionId: string, id: string): boolean
1002
+ promptLanded(sessionId: string, text: string, knownUserIds: string[] | Set<string>): Promise<boolean>
1003
+ watchFirstOutput(sessionId: string, userMessageId: string, onStall: (event: { sessionId: string; userMessageId: string }) => void, options?: { timeoutMs?: number }): () => void
1004
+ attachments(sessionId: string, message: { parts?: unknown[] }): Array<{ name: string; size: string; session: string; file: string; copy: string; inline: boolean }>
1005
+ readAttachment(sessionId: string, file: string): Promise<{ b64: string; [key: string]: unknown }>
1006
+ attachmentWarning(sessionId: string, model: string, file: { mime: string }): Promise<string>
1007
+ family(sessionId: string): Promise<{ children: string[]; approvals: unknown[]; questions: unknown[] }>
1008
+ approvalMode(sessionId: string): Promise<{ mode: string; modes: string[] }>
909
1009
  /** `model`: 'provider/model', e.g. 'trustedrouter/deepseek/deepseek-v4-flash'. */
910
1010
  prompt(sessionId: string, text: string, opts?: CodePromptOptions): Promise<unknown>
911
1011
  archive(sessionId: string, archived?: boolean): Promise<unknown>
912
1012
  undo(sessionId: string): Promise<{ changed: boolean; files: boolean }>
913
1013
  redo(sessionId: string): Promise<{ changed: boolean; files: boolean }>
914
1014
  compact(sessionId: string, model: string): Promise<unknown>
915
- models(sessionId: string): Promise<Array<{ ref: string; label: string; efforts: string[] }>>
1015
+ models(sessionId: string): Promise<Array<{ ref: string; label: string; input?: string[]; efforts: string[] }>>
916
1016
  commands(sessionId: string): Promise<Array<{ name: string; description: string; source: string; template: string; agent: string; model: string; needsComputer: boolean }>>
917
1017
  runCommand(sessionId: string, text: string, opts?: CodePromptOptions): Promise<unknown>
918
1018
  setApprovalMode(sessionId: string, mode: 'manual' | 'accept' | 'plan' | 'auto'): Promise<{ mode: string }>
@@ -923,7 +1023,19 @@ export interface Computer {
923
1023
  /** { <session id>: status } of every folder the sessions live in, or of one (`session` / `dir`). */
924
1024
  status(opts?: ComputerScope): Promise<Record<string, unknown>>
925
1025
  }
1026
+ readonly connections: {
1027
+ list(): Promise<Array<{ id: string; host: string; label: string; tools: string[]; auto: string[] }>>
1028
+ grant(connection: Connection, options?: { tools?: string[]; auto?: string[] }): Promise<void>
1029
+ revoke(id: string): Promise<void>
1030
+ }
1031
+ readonly keyGuard: {
1032
+ pending(): Promise<ComputerKeyGuardRequest[]>
1033
+ decide(request: ComputerKeyGuardRequest, allow: boolean): Promise<unknown>
1034
+ }
926
1035
  readonly approvals: {
1036
+ refusalOf(error: string): { kind: 'person' | 'auto' | 'other' | 'cancelled'; reason?: string } | null
1037
+ folders(sessionId: string, approvalId: string): Promise<Array<{ path: string }>>
1038
+ allowFolder(sessionId: string, approvalId: string): Promise<unknown>
927
1039
  /** Every approval waiting, in every folder the sessions live in — or in one (`session` / `dir`). */
928
1040
  pending(opts?: ComputerScope): Promise<unknown[]>
929
1041
  /** A 'reject' may carry a `message` for the model ("stop and ask me"); otherwise the approval's `session` is needed. */
@@ -932,7 +1044,7 @@ export interface Computer {
932
1044
  /** `opts`: the folder the question is in (`session` — the event's sessionID — or `dir`); neither = the computer's default project. */
933
1045
  readonly questions: { pending(opts?: ComputerScope): Promise<unknown[]>; answer(id: string, answers: string[][], opts?: ComputerScope): Promise<unknown>; dismiss(id: string, opts?: ComputerScope): Promise<unknown> }
934
1046
  readonly files: {
935
- mkdir(sessionId: string, relativeParent: string, name: string): Promise<unknown>
1047
+ mkdir(sessionId: string | null, relativeParent: string, name: string): Promise<unknown>
936
1048
  /** In a session's folder (`session`) or `dir`; neither = the computer's default project. */
937
1049
  list(path?: string, opts?: ComputerScope): Promise<unknown>; changes(opts?: ComputerScope): Promise<unknown>; diff(opts?: ComputerScope): Promise<unknown>
938
1050
  /** A file of the session's folder (at most 20 MB, nothing that looks like a secret). Rejects `not_supported` on an older connector. */
@@ -951,9 +1063,11 @@ export interface Computer {
951
1063
  /** Where the computer offers it (`status().canPrivate`); otherwise throws `not_supported`. The next report confirms it. */
952
1064
  setPrivate(on: boolean): true
953
1065
  /** Set privacy for one session using the encrypted owner channel; waits for confirmation, or rejects with unknown state on timeout. */
1066
+ setDefaultPrivate(on: boolean): Promise<void>
954
1067
  setSessionPrivate(session: string, on: boolean): Promise<true>
955
1068
  }
956
- /** What a reply produced: files it wrote, the browser's screenshots, files its answer names that changed. `messages` omitted = the latest reply. */
1069
+ /** What a reply produced: files it wrote, the browser's screenshots, files its answer names that changed. `messages` omitted = the latest reply.
1070
+ * A named file is listed only once the computer says it is there (and, for the latest reply, changed since its prompt). */
957
1071
  outputs(sessionId: string, messages?: unknown[]): Promise<Array<{ path: string; kind: 'pdf' | 'image' | 'table' | 'text' | 'file'; source: 'wrote' | 'shot' | 'named' }>>
958
1072
  readonly egress: { get(): unknown }
959
1073
  /** Live events (OpenCode's): a type such as 'message.part.updated', 'permission.asked', 'session.idle', or '*'. → off
@@ -965,9 +1079,12 @@ export interface Computer {
965
1079
 
966
1080
  /** `wb.siri` — the account's Siri inbox. Persist `state` (it holds the inbox private keys). */
967
1081
  export interface SiriAccount {
1082
+ /** Persist each direct-mode state change, including a removal awaiting confirmation. */
1083
+ onState: ((state: unknown) => void) | null
968
1084
  readonly state: unknown
969
1085
  readonly shortcut: { key: string | null; endpoint: string }
970
1086
  restore(state: unknown): this
1087
+ sync(): Promise<{ synced: boolean }>
971
1088
  status(): Promise<unknown>
972
1089
  /** In a vault: resolves `null` — the new key is shown in the vault's own screen (wb.vault.showSiriKey). */
973
1090
  rotateKey(): Promise<string | null>
@@ -991,7 +1108,7 @@ export interface Speech {
991
1108
  }
992
1109
  export interface Dictation {
993
1110
  readonly listening: boolean
994
- start(opts?: { room?: string; onPartial?(t: string): void; onLevel?(rms: number): void }): Promise<void>
1111
+ start(opts?: { engine?: 'device' | 'cloud'; room?: string; onPartial?(t: string): void; onLevel?(rms: number): void }): Promise<void>
995
1112
  stopCertified(): Promise<DictationResult>
996
1113
  stop(): Promise<string>
997
1114
  cancel(): void
@@ -1000,8 +1117,10 @@ export interface Dictation {
1000
1117
 
1001
1118
  import type { Origins, DeclaredHosts, Providers, TenantRooms, Customers, Billing } from './witbitz-admin'
1002
1119
 
1003
- export type VaultAccountIndex = Omit<AccountIndex, 'rooms' | 'onChange' | 'archive' | 'pin' | 'rename' | 'forget' | 'signOut' | 'sync' | 'start' | 'stop'> & {
1004
- readonly rooms: ReadonlyArray<Omit<AccountBackup['rooms'][number], 'link'>>
1120
+ export type VaultAccountIndex = Omit<AccountIndex, 'rooms' | 'onChange' | 'archive' | 'pin' | 'rename' | 'forget' | 'signOut' | 'sync' | 'start' | 'stop' | 'signOutDevice' | 'chatLocks'> & {
1121
+ readonly chatLocks: Omit<AccountIndex['chatLocks'], 'deleteAll'> & { deleteAll(): ReturnType<AccountIndex['chatLocks']['deleteAll']> }
1122
+ signOutDevice(deviceId: string): Promise<{ revoked: boolean }>
1123
+ readonly rooms: ReadonlyArray<Omit<AccountBackup['rooms'][number], 'link'> & { alwaysOn?: true }>
1005
1124
  onChange: ((index: Pick<VaultAccountIndex, 'rooms' | 'devices'>) => void) | null
1006
1125
  archive(room: string, on?: boolean): Promise<object>
1007
1126
  pin(room: string, on?: boolean): Promise<object>
@@ -1014,12 +1133,17 @@ export type VaultAccountIndex = Omit<AccountIndex, 'rooms' | 'onChange' | 'archi
1014
1133
  }
1015
1134
 
1016
1135
  export declare class Witbitz {
1136
+ setAssistantMemory(spaces?: Space[]): void
1137
+ readonly temporaryRooms: {
1138
+ list(): Promise<Array<{ room: string; at: number; title: string; status: 'recent' | 'live' | 'unknown' }>>
1139
+ open(room: string, options?: Parameters<Witbitz['openSpace']>[1]): Promise<Space>
1140
+ }
1017
1141
  constructor(opts?: WitbitzOptions)
1018
1142
  /** VAULT MODE: this page is framed by a vault you host on another origin, which keeps every room key. Rejects
1019
1143
  * `not_in_vault` when the page is not framed by that origin. Create, read and send as usual; sign-in and sharing
1020
1144
  * happen in the vault (`wb.vault`). A link is opened by the vault, not by openSpace. Refuses by name a `session`
1021
1145
  * (`vault_signs_in`), `attest`, and a persisted `backup` / `siri` / `a2a` / `invite` state (`vault_unsupported`): the vault keeps the account. */
1022
- static inVault(opts: WitbitzOptions & { vault: string }): Promise<Omit<Witbitz, 'account' | 'backup'> & { readonly account: VaultAccountIndex; readonly backup: VaultAccountBackup }>
1146
+ static inVault(opts: VaultOptions): Promise<Omit<Witbitz, 'account' | 'backup' | 'vault'> & { readonly vault: VaultSession; readonly account: VaultAccountIndex; readonly backup: VaultAccountBackup }>
1023
1147
  /** The vault this page runs in — set by {@link Witbitz.inVault}, else null. */
1024
1148
  readonly vault: VaultSession | null
1025
1149
  readonly session: Session | null
@@ -1048,8 +1172,8 @@ export declare class Witbitz {
1048
1172
  readonly usernames: Usernames
1049
1173
  recreateSpace(bundle: { kind: string; entries: unknown[]; config?: Record<string, unknown>; tier?: Tier }, opts?: { tier?: Tier }): Promise<{ space: Space; carried: number; total: number; titleWarning?: string }>
1050
1174
  saveOfflineReader(): Promise<void>
1051
- exportOfflineArchive(opts?: { recoveryKeys?: boolean; rooms?: Space[] }): Promise<{ saved: number; unavailable: string[] }>
1052
- createSpace(opts: { /** @deprecated retired in 4.0.0 — `owner` rejects with `owner_rule_retired` */ owner?: never; clientTools?: ToolDef[]; agentReplies?: boolean; agent?: AgentSpec; tools?: ToolDef[]; immediateTools?: string[]; model?: AgentSpec['model']; data?: Record<string, unknown>; platformTools?: PlatformTools; framing?: Framing; dataWrites?: boolean; /** a direct chat with this address (sdk-people.md#direct-chats) — instead of admission */ direct?: string; admission?: Admission; tier?: Tier; key?: 'split'; region?: string; /** a room wiped when idle: true (≈30 min), or { days } (1–7) after its last question (sdk-rooms.md#temporary) */ temporary?: true | { days: number }; /** others' photos and PDFs shown only from copies an attested enclave made safe (sdk-rooms.md#safe-media) */ safeMedia?: boolean; /** every member gets a private assistant (sdk-agents.md#lanes-for-everyone) */ lanes?: boolean }): Promise<Space>
1175
+ exportOfflineArchive(opts?: { recoveryKeys?: boolean; rooms?: Space[]; destination?: 'download' | 'clipboard' }): Promise<{ saved: number; unavailable: string[]; /** stored photos and documents: how many went into the file (sealed), how many were left out — past the 50 MB cap, or unreadable */ attachments?: { included: number; tooLarge: number; failed: number } }>
1176
+ createSpace(opts: { /** @deprecated retired in 4.0.0 — `owner` rejects with `owner_rule_retired` */ owner?: never; skills?: Record<string, { in: Record<string, 'string' | 'number' | 'boolean' | 'array' | 'object'>; out?: Record<string, 'string' | 'number' | 'boolean' | 'array' | 'object'> }>; clientTools?: ToolDef[]; agentReplies?: boolean; agent?: AgentSpec; tools?: ToolDef[]; immediateTools?: string[]; model?: AgentSpec['model']; data?: Record<string, unknown>; platformTools?: PlatformTools; framing?: Framing; dataWrites?: boolean; /** a direct chat with this address (sdk-people.md#direct-chats) — instead of admission */ direct?: string; usernames?: boolean; admission?: Admission; tier?: Tier; key?: 'split'; region?: string; /** a room wiped when idle: true (≈30 min), or { days } (1–7) after its last question (sdk-rooms.md#temporary) */ temporary?: true | { days: number; title?: string }; /** others' photos and PDFs shown only from copies an attested enclave made safe (sdk-rooms.md#safe-media) */ safeMedia?: boolean; /** every member gets a private assistant (sdk-agents.md#lanes-for-everyone) */ lanes?: boolean }): Promise<Space>
1053
1177
  /** `link` is REQUIRED (a share link: `<viewer>/space?room=…#mk=…`); the current page URL is not read for you. */
1054
1178
  openSpace(link: string, opts?: { resume?: Snapshot; tier?: Tier }): Promise<Space>
1055
1179
  /** Reopen a member's lane (sdk-reference.md). In a vault `laneLink` is the lane's room id; `lane_space_gone` once its Space is forgotten. */
@@ -1067,7 +1191,7 @@ export declare class Witbitz {
1067
1191
  /** Read `text` aloud → resolves when it has played. */
1068
1192
  speak(text: string): Promise<void>
1069
1193
  /** Feature detection: this SDK's version and features, the limits, the tiers and models this deployment serves. */
1070
- capabilities(): Promise<{ sdk: string; endpoint: string; features: string[]; limits: Record<string, number>; tiers: { standard: true; enclave: boolean }; models: { regular: string[]; confidential: string[] } | null }>
1194
+ capabilities(): Promise<{ sdk: string; endpoint: string; features: string[]; limits: Record<string, number>; tiers: { standard: true; enclave: boolean | null }; models: { regular: string[]; confidential: string[] } | null }>
1071
1195
  toJSON(): { viewer: string; tenant?: string; signedIn: boolean; tenantKey?: '[REDACTED]' }
1072
1196
  // ── Builder calls (server only). Deprecated here: use WitbitzAdmin (witbitz-admin.js); `users` is `customers` there.
1073
1197
  /** @deprecated use `new WitbitzAdmin(…).verifyTenantKey()` */
@@ -1096,11 +1220,14 @@ export declare function checkDataSchema(data: Record<string, unknown>): void
1096
1220
  export declare function isLaneCopy(m: Message | Record<string, unknown>): boolean
1097
1221
 
1098
1222
  // AG-UI 1.0 (sdk-agents.md#ag-ui)
1099
- export declare function aguiRun(space: Space, input: { threadId?: string; runId?: string; messages?: unknown[]; context?: unknown[]; resume?: unknown }, opts?: { from?: string; mode?: ReplyMode; timeoutMs?: number; graceMs?: number; signal?: AbortSignal }): AsyncIterable<Record<string, unknown>>
1100
- export declare function aguiHistory(space: Space): unknown[]
1223
+ export declare function aguiRun(space: Space, input: { threadId?: string; runId?: string; messages?: unknown[]; context?: unknown[]; resume?: unknown }, opts?: { from?: string; mode?: ReplyMode; timeoutMs?: number; graceMs?: number; pendingWaitMs?: number; signal?: AbortSignal }): AsyncIterable<Record<string, unknown>>
1224
+ export declare function aguiHistory(space: Space): { type: 'MESSAGES_SNAPSHOT'; timestamp: number; messages: { id: string; role: 'assistant' | 'user'; content: string; name?: string }[] }
1101
1225
  export declare function aguiAgent(lib: { AbstractAgent: unknown; Observable: unknown }, space: Space, opts?: { threadId?: string; agentConfig?: Record<string, unknown>; [k: string]: unknown }): unknown
1102
1226
 
1103
1227
  // RATS / EAT (sdk-keys.md#eat)
1104
1228
  export declare const EAT_PROFILE: string
1105
1229
  export declare function verifyEat(token: string, opts?: { expectedPCRs?: Record<string, string> | null; nonce?: string | null; root?: unknown; now?: number; maxAgeMs?: number; key?: Uint8Array | null; profile?: string }): Promise<{ ok: true; claims: Record<string, unknown>; doc: unknown; userData: unknown; pinned: boolean }>
1106
1230
  export declare function fetchAndVerifyEat(eatUrl: string, opts?: { expectedPCRs?: Record<string, string> | null; fetchImpl?: typeof fetch; [k: string]: unknown }): Promise<{ ok: true; claims: Record<string, unknown>; doc: unknown; userData: unknown; pinned: boolean }>
1231
+
1232
+ /** Built-in assistant templates, including their reusable instructions. */
1233
+ export function assistantTemplates(): Array<{ id: string; name: string; sub: string; agentName: string; persona: string }>