@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.
- package/README.md +2 -2
- package/a2aCore.js +26 -5
- package/accountErase.js +6 -1
- package/accountRecord.js +2 -2
- package/agentDoorTools.js +28 -0
- package/chatLock.js +16 -0
- package/cloudDevicePins.js +2 -2
- package/codeAttachments.js +100 -0
- package/codeCache.js +149 -0
- package/codeCloud.js +0 -2
- package/codeComputers.js +1 -0
- package/codeFolders.js +116 -0
- package/codeHistory.js +76 -0
- package/codeLanguage.js +54 -0
- package/codeModes.js +2 -0
- package/codeProgress.js +54 -0
- package/codeSent.js +68 -0
- package/codeSubagents.js +107 -0
- package/codeTransport.js +22 -0
- package/connections.js +17 -18
- package/deviceAttest.js +9 -3
- package/idb.js +19 -3
- package/jobAgents.js +2 -2
- package/keptMerge.js +9 -2
- package/l1-worker-src.js +1 -1
- package/l1-worker.js +93 -30
- package/laneAssociation.js +68 -0
- package/laneConfig.js +4 -3
- package/manifest.json +80 -61
- package/memberChange.js +4 -2
- package/mirrorBatch.js +47 -0
- package/opRouting.js +10 -0
- package/package.json +21 -2
- package/pdfOptions.js +13 -0
- package/pdfText.js +107 -0
- package/pdfjs.mjs +28 -0
- package/pdfjs.worker.mjs +28 -0
- package/protectedLocal.js +18 -2
- package/removedMessage.js +1 -1
- package/roomEmbed.js +111 -0
- package/roomName.js +1 -1
- package/roomRoster.js +21 -5
- package/rosterCount.js +6 -3
- package/sdkA2A.js +160 -40
- package/sdkAccount.js +17 -4
- package/sdkAccountDoc.js +11 -3
- package/sdkAccountSections.js +117 -8
- package/sdkBackup.js +35 -8
- package/sdkCloudDevice.js +8 -2
- package/sdkComputers.js +582 -53
- package/sdkDictation.js +114 -24
- package/sdkErase.js +9 -4
- package/sdkExports.js +4 -2
- package/sdkLaneLink.js +3 -3
- package/sdkPlan.js +4 -2
- package/sdkRekey.js +50 -17
- package/sdkReport.js +1 -1
- package/sdkSafeMedia.js +1 -1
- package/sdkSpeech.js +19 -2
- package/sdkTemporaryRooms.js +123 -0
- package/sdkVault.js +66 -10
- package/sentinelRelease.js +1 -0
- package/sharedViews.js +17 -3
- package/siri.js +114 -7
- package/spaceClient.js +16 -5
- package/spaceEmailGate.js +2 -2
- package/spaceTemplates.js +99 -0
- package/speechOut.js +4 -2
- package/store.js +83 -14
- package/sw-notif-core.js +9 -7
- package/turnVerdict.js +1 -0
- package/vault-core.js +480 -112
- package/vault-kit.mjs +2 -2
- package/vault-screens.js +5 -7
- package/vaultAtRest.js +35 -4
- package/vaultKeep.js +9 -3
- package/vaultWorkerHost.js +23 -4
- package/witbitz-admin.mjs +12 -11
- package/witbitz-sdk.d.ts +115 -24
- package/witbitz-sdk.js +572 -149
package/witbitz-sdk.d.ts
CHANGED
|
@@ -216,7 +216,7 @@ export interface SendOptions {
|
|
|
216
216
|
/** Tools the page offers the assistant for THIS question (sdk-assistant.md#page-tools) — the shape a Lane's actions take. */
|
|
217
217
|
tools?: LaneAction[]
|
|
218
218
|
}
|
|
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 }
|
|
219
|
+
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
220
|
/** What on() returns: call it to remove the listener (it returns the space). It also chains `.on()` / `.off()`. */
|
|
221
221
|
export interface Unsubscribe<S> { (): S; on: S extends { on: infer F } ? F : never; off: S extends { off: infer F } ? F : never }
|
|
222
222
|
|
|
@@ -243,12 +243,12 @@ export interface SpaceConnections {
|
|
|
243
243
|
grants(): Promise<Array<{ id: string; label: string; host: string; status: 'connected' | 'other_member' | 'detached' | 'unknown' }>>
|
|
244
244
|
/** An MCP connection brings its tools: `tools` (names) to choose them, else the recommended set; `auto` (names) run without asking. */
|
|
245
245
|
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>
|
|
246
|
+
revoke(id: string, opts?: { from?: string; includeAssistant?: boolean }): Promise<unknown>
|
|
247
247
|
}
|
|
248
248
|
/** `space.siri` — this Space's Siri alias and its drops. */
|
|
249
249
|
export interface SpaceSiri {
|
|
250
|
-
enable(opts
|
|
251
|
-
disable(): Promise<unknown>
|
|
250
|
+
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 }>
|
|
251
|
+
disable(opts?: { includeAssistant?: boolean }): Promise<unknown>
|
|
252
252
|
/** `deliver(text, meta)` takes each drop instead of posting it. At-least-once: dedupe on `meta.id`. */
|
|
253
253
|
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
254
|
}
|
|
@@ -292,7 +292,7 @@ export declare class Space {
|
|
|
292
292
|
readonly room: string
|
|
293
293
|
/** Latest key rotation observed by this handle. Null until it observes one. */
|
|
294
294
|
readonly epoch: number | null
|
|
295
|
-
readonly shareLink: string
|
|
295
|
+
readonly shareLink: string | null
|
|
296
296
|
/** The room key (base64url). Treat it as a secret: it IS the admission. null over a keyless client. */
|
|
297
297
|
readonly key: string | null
|
|
298
298
|
/** True for a temporary room (createSpace({ temporary })): wiped when idle, never in the account backup. */
|
|
@@ -326,6 +326,16 @@ export declare class Space {
|
|
|
326
326
|
on<E extends keyof SpaceEvents>(event: E, cb: (e: SpaceEvents[E]) => void, opts?: { replay?: boolean }): Unsubscribe<this>
|
|
327
327
|
/** No `cb`: every listener for the event. */
|
|
328
328
|
off<E extends keyof SpaceEvents>(event: E, cb?: (e: SpaceEvents[E]) => void): this
|
|
329
|
+
linkPrivateRoom(target: Space, opts?: { allowStandardDestination?: boolean }): Promise<{ room: string; parent: string; linked: boolean }>
|
|
330
|
+
unlinkPrivateRoom(target: Space): Promise<{ room: string; parent: string; linked: boolean }>
|
|
331
|
+
readonly embed: {
|
|
332
|
+
invite(template: string): Promise<string | { shown: true }>
|
|
333
|
+
read(): Promise<Record<string, unknown> | null>
|
|
334
|
+
update(patch: Record<string, unknown>): Promise<void>
|
|
335
|
+
watch(listener: (state: Record<string, unknown> | null) => void): () => void
|
|
336
|
+
setLiveDocument(name: string, text: string | null): void
|
|
337
|
+
}
|
|
338
|
+
invokeSkill(name: string, args?: Record<string, unknown>): Promise<SendResult>
|
|
329
339
|
send(text: string, opts?: SendOptions): Promise<SendResult>
|
|
330
340
|
/** An emoji on a message, or `{ off: true }` to take yours off (sdk-rooms.md#replies). No new entry, no assistant turn. */
|
|
331
341
|
react(message: Message, emoji: string, opts?: { off?: boolean; from?: string }): Promise<{ ok: boolean; reactions?: Record<string, string[]>; error?: string }>
|
|
@@ -455,7 +465,7 @@ export interface LaneA2A {
|
|
|
455
465
|
enable(opts: { name: string; description?: string }): Promise<{ cardUrl: string; mcpUrl: string }>
|
|
456
466
|
/** `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
467
|
/** 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 }>
|
|
468
|
+
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
469
|
setReply(peerId: string, reply: 'ask' | 'auto'): Promise<{ id: string; reply: 'ask' | 'auto' }>
|
|
460
470
|
removePeer(peerId: string): Promise<{ removed: boolean }>
|
|
461
471
|
disable(): Promise<{ disabled: boolean }>
|
|
@@ -483,7 +493,22 @@ export declare class Lane extends Space {
|
|
|
483
493
|
// ─── The client ───────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
484
494
|
/** `sign`: this device's signing keypair (JWKs) — the key a verified room stamps on its messages as `spk`. */
|
|
485
495
|
export interface Session { email: string; idToken: string; exp: number; sign?: { pub: { kty: string; crv: string; x: string; y: string }; priv: Record<string, unknown> } }
|
|
496
|
+
export type VaultOptions = Omit<WitbitzOptions, 'session' | 'attest' | 'sentinel' | 'devRoot' | 'enclaveClaim' | 'backup' | 'siri' | 'a2a' | 'invite' | 'builds'> & {
|
|
497
|
+
vault: string
|
|
498
|
+
session?: null
|
|
499
|
+
attest?: never
|
|
500
|
+
sentinel?: never
|
|
501
|
+
devRoot?: never
|
|
502
|
+
enclaveClaim?: never
|
|
503
|
+
backup?: null
|
|
504
|
+
siri?: null
|
|
505
|
+
a2a?: null
|
|
506
|
+
invite?: null
|
|
507
|
+
builds?: 'published' | { mode?: 'published'; state?: BuildsState }
|
|
508
|
+
}
|
|
509
|
+
|
|
486
510
|
export interface WitbitzOptions {
|
|
511
|
+
keepTemporaryRooms?: boolean
|
|
487
512
|
endpoint?: string
|
|
488
513
|
/** The origin a shareLink opens in: links read `<viewer>/space?room=<id>#mk=<key>`. */
|
|
489
514
|
viewer?: string
|
|
@@ -536,12 +561,12 @@ export interface VaultLock { available: true; on: boolean; protect: boolean }
|
|
|
536
561
|
/** A vault's notifications on this device, as the person set them (a vault started with `push: true`). */
|
|
537
562
|
export interface VaultPush { available: true; on: boolean }
|
|
538
563
|
/** 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 }
|
|
564
|
+
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
565
|
/** `wb.vault` — the vault this page runs in (docs: § Vault mode). The keys are there; this page never holds one. */
|
|
541
566
|
export declare class VaultSession {
|
|
542
567
|
/** The vault's origin. */
|
|
543
568
|
readonly origin: string
|
|
544
|
-
/**
|
|
569
|
+
/** Connection details and the latest room, sign-in and account state reported by the vault. */
|
|
545
570
|
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 }
|
|
546
571
|
/** The Spaces this vault holds, newest first. */
|
|
547
572
|
rooms(): Promise<VaultRoom[]>
|
|
@@ -549,7 +574,7 @@ export declare class VaultSession {
|
|
|
549
574
|
* lane's room id (`rooms()` marks it with `lane`) gives a `Lane` of its Space — `lane_space_gone` once that Space is forgotten. */
|
|
550
575
|
openRoom(room: string, opts?: { resume?: Snapshot }): Promise<Space | Lane>
|
|
551
576
|
/** 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 }>
|
|
577
|
+
share(space: Space | string, opts?: { title?: string; hostInviteTemplate?: string }): Promise<{ shown: true }>
|
|
553
578
|
/** The vault shows the Siri Shortcut's key in its own screen; the key never reaches this page. */
|
|
554
579
|
showSiriKey(): Promise<{ shown: true }>
|
|
555
580
|
/** 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 +585,10 @@ export declare class VaultSession {
|
|
|
560
585
|
* with `push: true`. */
|
|
561
586
|
showNotifications(): Promise<VaultPush>
|
|
562
587
|
/** The vault shows its sign-in screen; resolves once signed in. */
|
|
563
|
-
|
|
588
|
+
/** The member enters their email in the vault. */
|
|
589
|
+
signIn(): Promise<{ email: string }>
|
|
590
|
+
/** @deprecated The vault ignores the supplied email. Use signIn() and enter the address in the vault. */
|
|
591
|
+
signIn(opts: { email?: string }): Promise<{ email: string }>
|
|
564
592
|
/** The person confirms in the vault; rejects with code `cancelled` if they do not. */
|
|
565
593
|
signOut(): Promise<{ signedIn: false }>
|
|
566
594
|
whoami(): Promise<{ signedIn: boolean; email?: string; keyId?: string }>
|
|
@@ -569,7 +597,7 @@ export declare class VaultSession {
|
|
|
569
597
|
forget(space: Space | string): Promise<{ forgotten: boolean }>
|
|
570
598
|
on(event: 'rooms', cb: (e: { rooms: VaultRoom[] }) => void): () => void
|
|
571
599
|
on(event: 'joined', cb: (e: { room: string }) => void): () => void
|
|
572
|
-
on(event: 'signedIn', cb: (e: { email: string }) => void): () => void
|
|
600
|
+
on(event: 'signedIn', cb: (e: { email: string; keyId?: string }) => void): () => void
|
|
573
601
|
on(event: 'signedOut', cb: (e: object) => void): () => void
|
|
574
602
|
/** This device was signed out of the account (or the account was deleted) from another device: the vault forgot the account, its
|
|
575
603
|
* sign-in and its Spaces here, and `info.signedIn` is false. `reason: 'erased'`: the account was deleted. */
|
|
@@ -659,7 +687,9 @@ export declare class Protect {
|
|
|
659
687
|
}
|
|
660
688
|
|
|
661
689
|
/** `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'> {
|
|
690
|
+
export interface VaultAccountBackup extends Omit<AccountBackup, 'enable' | 'restore' | 'rooms' | 'protectRecoveryEmail' | 'save' | 'beginEmailMove' | 'finishEmailMove' | 'cancelPendingEmailMove' | 'migrate' | 'cancelEmailMove'> {
|
|
691
|
+
migrate(opts?: { silent?: boolean }): Promise<{ migrated: true; trust: string | null }>
|
|
692
|
+
cancelEmailMove(): Promise<{ cancelled: true }>
|
|
663
693
|
beginEmailMove(): Promise<{ ready_at: number; expires: number }>
|
|
664
694
|
finishEmailMove(): Promise<{ enabled: true }>
|
|
665
695
|
cancelPendingEmailMove(): Promise<{ cancelled: true }>
|
|
@@ -680,7 +710,7 @@ export interface AccountBackup {
|
|
|
680
710
|
/** Where the account is kept: 'account' (the Witbitz account service — a new account in a vault that names its tenant),
|
|
681
711
|
* 'legacy' (the backup store every account used before), null when there is none on this client. */
|
|
682
712
|
readonly service: 'account' | 'legacy' | null
|
|
683
|
-
readonly rooms: Array<{ room: string; link: string; kind: 'space' | 'lane'; label?: string; shared?: string; archived?: boolean; pinned?: boolean }>
|
|
713
|
+
readonly rooms: Array<{ room: string; link: string; kind: 'space' | 'lane'; label?: string; shared?: string; laneOrigin?: 'minted'; mintedFor?: string; archived?: boolean; pinned?: boolean }>
|
|
684
714
|
onState: ((state: unknown) => void) | null
|
|
685
715
|
enable(opts?: { email?: string }): Promise<{ code: string }>
|
|
686
716
|
restore(opts: { code: string; email?: string; ticket?: string; emailCode?: string }): Promise<{ rooms: AccountBackup['rooms'] }>
|
|
@@ -769,6 +799,11 @@ export interface AccountIndex {
|
|
|
769
799
|
set(lock: { kind: 'room' | 'code'; target: string; pin: string; title?: string }): Promise<Record<string, unknown> | null>
|
|
770
800
|
remove(lock: { lockId: string }): Promise<Record<string, unknown> | null>
|
|
771
801
|
changePin(lock: { lockId: string; pin: string; newPin: string }): Promise<Record<string, unknown> | null>
|
|
802
|
+
previewDeleteAll(): Promise<{ targets: { lockId: string; kind: 'room' | 'code'; target: string }[]; privateAssistants: { room: string; parent: string; title: string }[] }>
|
|
803
|
+
/** Removes the listed targets without requiring their PIN. */
|
|
804
|
+
deleteAll(opts?: { includePrivateAssistants?: boolean; privateAssistantRooms?: readonly string[] }): Promise<{ lockId: string; kind: 'code' | 'room'; target: string; deleted: boolean }[]>
|
|
805
|
+
/** Uses the app's synced wrong-PIN backoff. Does not isolate or encrypt room data. */
|
|
806
|
+
match(attempt: { pin: string }): Promise<{ ok: boolean; next: number; matches: { lockId: string; kind: 'code' | 'room'; target: string; title: string }[] }>
|
|
772
807
|
/** Uses the app's synced wrong-PIN backoff. Does not isolate or encrypt room data. */
|
|
773
808
|
check(attempt: { lockId: string; pin: string }): Promise<{ ok: boolean; next: number }>
|
|
774
809
|
on(ev: 'change', fn: (doc: Record<string, unknown> | null) => void): unknown
|
|
@@ -834,6 +869,7 @@ export interface InviteAccount {
|
|
|
834
869
|
|
|
835
870
|
/** `wb.a2a` — the account's A2A record. Persist `state` (it holds the lanes' inbox private keys). */
|
|
836
871
|
export interface A2AAccount {
|
|
872
|
+
stopJobAgent(name: string): Promise<{ removed: Array<{ source: string; id: string }> }>
|
|
837
873
|
readonly state: unknown
|
|
838
874
|
readonly endpoint: string
|
|
839
875
|
onState: ((state: unknown) => void) | null
|
|
@@ -845,6 +881,7 @@ export interface A2AAccount {
|
|
|
845
881
|
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
882
|
/** `wb.connections` — credentials the standing Sentinel holds and spends for the account. */
|
|
847
883
|
export interface Connections {
|
|
884
|
+
recover(id: string): Promise<Connection | null>
|
|
848
885
|
/** Public picker data shared with the app. Use category 'Agents' for outside agents; no credentials are returned. */
|
|
849
886
|
catalog(opts?: { category?: string }): Array<{ name: string; kind: string; desc: string; cat: string; url?: string; host?: string; registered?: boolean; [k: string]: unknown }>
|
|
850
887
|
spacesUsing(id: string): Promise<{ rooms: string[]; unreadable: string[]; incomplete: boolean }>
|
|
@@ -879,13 +916,19 @@ export interface ComputerInfo { id: string; name: string; cloud: true; version:
|
|
|
879
916
|
* same checks as the Witbitz app's Code section; their hours charge the person's AWS key. Not available in vault mode yet
|
|
880
917
|
* (`vault_mode`). Errors carry `code`: not_enabled, sign_in_required, not_found, keys_refused, aws_limit, attestation, declined. */
|
|
881
918
|
export interface Computers {
|
|
919
|
+
setDefaultPrivate(id: string, on: boolean): Promise<void>
|
|
920
|
+
connections(id: string): Promise<Computer['connections']>
|
|
882
921
|
list(): Promise<ComputerInfo[]>
|
|
883
922
|
/** Model keys come from the account (capped) unless `keys` brings the person's own. */
|
|
884
923
|
create(opts?: { name?: string; keys?: { trustedRouter: string; tinfoil?: string; github?: string }; egress?: { mode: string; hosts?: string[] }; browsePrivate?: boolean }): Promise<ComputerInfo>
|
|
885
924
|
/** Start or wake it, check it runs the published Witbitz image (a NEW published image: 'auto' accepts it, 'ask' calls
|
|
886
925
|
* `onNewImage(pcr0, role)`), hand it the person's keys sealed, connect. */
|
|
887
|
-
|
|
926
|
+
cachedSessions(id: string): Promise<Array<{ id: string; at: number; msgs: number; title: string; dir: string }>>
|
|
927
|
+
cachedDirectory(id: string): Promise<{ at: number; list: Array<{ id: string; title?: string; directory?: string; time: { created?: number; updated?: number; archived?: number } }> } | null>
|
|
928
|
+
cachedSession(id: string, sessionId: string): Promise<{ msgs: unknown[]; at: number; trimmed: boolean; dir?: string } | null>
|
|
929
|
+
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
930
|
/** Closed, its account keys cancelled, then removed from the account. */
|
|
931
|
+
close(id: string): Promise<boolean>
|
|
889
932
|
remove(id: string): Promise<void>
|
|
890
933
|
/** This month on the person's AWS key (dollars; show credits: 100 = $1), or null before the first opening. */
|
|
891
934
|
usage(): Promise<{ live: boolean; tier?: 'full' | 'free'; month?: { usd: number; capUsd: number; byKind: Record<string, number> }; resetsAt?: string; why?: string } | null>
|
|
@@ -898,21 +941,43 @@ export interface CodePromptOptions {
|
|
|
898
941
|
}
|
|
899
942
|
export interface ComputerScope { session?: string; dir?: string }
|
|
900
943
|
|
|
944
|
+
export interface ComputerKeyGuardRequest { readonly id: string; readonly expires: number; readonly summary: Record<string, unknown>; readonly tag: string }
|
|
901
945
|
export interface Computer {
|
|
902
946
|
readonly id: string
|
|
903
947
|
readonly name: string
|
|
904
948
|
readonly status: 'online' | 'connecting' | 'offline'
|
|
949
|
+
preferredAgent(): Promise<string>
|
|
950
|
+
setPreferredAgent(sessionId: string, agent: string): Promise<string>
|
|
951
|
+
onAutoVerdict(sessionId: string, callback: (event: { sessionID: string; id: string; action: string; reason?: string; answered?: boolean | null }) => void, opts?: { family?: boolean }): () => void
|
|
952
|
+
onProgress(sessionId: string, callback: (event: { sessionID: string; phase: string; label: string; attempt: number; tool: string; subject: string; chars: number }) => void): () => void
|
|
953
|
+
preferredEffort(ref: string): string
|
|
954
|
+
setPreferredEffort(sessionId: string, ref: string, effort: string): Promise<void>
|
|
955
|
+
preferredModel(): Promise<string>
|
|
956
|
+
setPreferredModel(sessionId: string, model: string): Promise<string>
|
|
905
957
|
readonly sessions: {
|
|
906
958
|
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[]>
|
|
959
|
+
create(opts?: { dir?: string; title?: string; agent?: string; model?: string }): Promise<{ id: string; [k: string]: unknown }>
|
|
960
|
+
messages(sessionId: string, opts?: { limit?: number; cursor?: string }): Promise<unknown[]>
|
|
961
|
+
messagePage(sessionId: string, opts?: { limit?: number; cursor?: string }): Promise<{ messages: unknown[]; cursor: string | null }>
|
|
962
|
+
agents(sessionId: string): Promise<Array<{ name: string; description: string }>>
|
|
963
|
+
saveDraft(sessionId: string, parts: Array<{ type: string; [key: string]: unknown }>): string
|
|
964
|
+
listDrafts(sessionId: string): Array<{ id: string; reason: string }>
|
|
965
|
+
getDraft(sessionId: string, id: string): { id: string; reason: string; parts: unknown[] } | null
|
|
966
|
+
discardDraft(sessionId: string, id: string): boolean
|
|
967
|
+
promptLanded(sessionId: string, text: string, knownUserIds: string[] | Set<string>): Promise<boolean>
|
|
968
|
+
watchFirstOutput(sessionId: string, userMessageId: string, onStall: (event: { sessionId: string; userMessageId: string }) => void, options?: { timeoutMs?: number }): () => void
|
|
969
|
+
attachments(sessionId: string, message: { parts?: unknown[] }): Array<{ name: string; size: string; session: string; file: string; copy: string; inline: boolean }>
|
|
970
|
+
readAttachment(sessionId: string, file: string): Promise<{ b64: string; [key: string]: unknown }>
|
|
971
|
+
attachmentWarning(sessionId: string, model: string, file: { mime: string }): Promise<string>
|
|
972
|
+
family(sessionId: string): Promise<{ children: string[]; approvals: unknown[]; questions: unknown[] }>
|
|
973
|
+
approvalMode(sessionId: string): Promise<{ mode: string; modes: string[] }>
|
|
909
974
|
/** `model`: 'provider/model', e.g. 'trustedrouter/deepseek/deepseek-v4-flash'. */
|
|
910
975
|
prompt(sessionId: string, text: string, opts?: CodePromptOptions): Promise<unknown>
|
|
911
976
|
archive(sessionId: string, archived?: boolean): Promise<unknown>
|
|
912
977
|
undo(sessionId: string): Promise<{ changed: boolean; files: boolean }>
|
|
913
978
|
redo(sessionId: string): Promise<{ changed: boolean; files: boolean }>
|
|
914
979
|
compact(sessionId: string, model: string): Promise<unknown>
|
|
915
|
-
models(sessionId: string): Promise<Array<{ ref: string; label: string; efforts: string[] }>>
|
|
980
|
+
models(sessionId: string): Promise<Array<{ ref: string; label: string; input?: string[]; efforts: string[] }>>
|
|
916
981
|
commands(sessionId: string): Promise<Array<{ name: string; description: string; source: string; template: string; agent: string; model: string; needsComputer: boolean }>>
|
|
917
982
|
runCommand(sessionId: string, text: string, opts?: CodePromptOptions): Promise<unknown>
|
|
918
983
|
setApprovalMode(sessionId: string, mode: 'manual' | 'accept' | 'plan' | 'auto'): Promise<{ mode: string }>
|
|
@@ -923,7 +988,19 @@ export interface Computer {
|
|
|
923
988
|
/** { <session id>: status } of every folder the sessions live in, or of one (`session` / `dir`). */
|
|
924
989
|
status(opts?: ComputerScope): Promise<Record<string, unknown>>
|
|
925
990
|
}
|
|
991
|
+
readonly connections: {
|
|
992
|
+
list(): Promise<Array<{ id: string; host: string; label: string; tools: string[]; auto: string[] }>>
|
|
993
|
+
grant(connection: Connection, options?: { tools?: string[]; auto?: string[] }): Promise<void>
|
|
994
|
+
revoke(id: string): Promise<void>
|
|
995
|
+
}
|
|
996
|
+
readonly keyGuard: {
|
|
997
|
+
pending(): Promise<ComputerKeyGuardRequest[]>
|
|
998
|
+
decide(request: ComputerKeyGuardRequest, allow: boolean): Promise<unknown>
|
|
999
|
+
}
|
|
926
1000
|
readonly approvals: {
|
|
1001
|
+
refusalOf(error: string): { kind: 'person' | 'auto' | 'other' | 'cancelled'; reason?: string } | null
|
|
1002
|
+
folders(sessionId: string, approvalId: string): Promise<Array<{ path: string }>>
|
|
1003
|
+
allowFolder(sessionId: string, approvalId: string): Promise<unknown>
|
|
927
1004
|
/** Every approval waiting, in every folder the sessions live in — or in one (`session` / `dir`). */
|
|
928
1005
|
pending(opts?: ComputerScope): Promise<unknown[]>
|
|
929
1006
|
/** A 'reject' may carry a `message` for the model ("stop and ask me"); otherwise the approval's `session` is needed. */
|
|
@@ -932,7 +1009,7 @@ export interface Computer {
|
|
|
932
1009
|
/** `opts`: the folder the question is in (`session` — the event's sessionID — or `dir`); neither = the computer's default project. */
|
|
933
1010
|
readonly questions: { pending(opts?: ComputerScope): Promise<unknown[]>; answer(id: string, answers: string[][], opts?: ComputerScope): Promise<unknown>; dismiss(id: string, opts?: ComputerScope): Promise<unknown> }
|
|
934
1011
|
readonly files: {
|
|
935
|
-
mkdir(sessionId: string, relativeParent: string, name: string): Promise<unknown>
|
|
1012
|
+
mkdir(sessionId: string | null, relativeParent: string, name: string): Promise<unknown>
|
|
936
1013
|
/** In a session's folder (`session`) or `dir`; neither = the computer's default project. */
|
|
937
1014
|
list(path?: string, opts?: ComputerScope): Promise<unknown>; changes(opts?: ComputerScope): Promise<unknown>; diff(opts?: ComputerScope): Promise<unknown>
|
|
938
1015
|
/** 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,6 +1028,7 @@ export interface Computer {
|
|
|
951
1028
|
/** Where the computer offers it (`status().canPrivate`); otherwise throws `not_supported`. The next report confirms it. */
|
|
952
1029
|
setPrivate(on: boolean): true
|
|
953
1030
|
/** Set privacy for one session using the encrypted owner channel; waits for confirmation, or rejects with unknown state on timeout. */
|
|
1031
|
+
setDefaultPrivate(on: boolean): Promise<void>
|
|
954
1032
|
setSessionPrivate(session: string, on: boolean): Promise<true>
|
|
955
1033
|
}
|
|
956
1034
|
/** What a reply produced: files it wrote, the browser's screenshots, files its answer names that changed. `messages` omitted = the latest reply. */
|
|
@@ -965,9 +1043,12 @@ export interface Computer {
|
|
|
965
1043
|
|
|
966
1044
|
/** `wb.siri` — the account's Siri inbox. Persist `state` (it holds the inbox private keys). */
|
|
967
1045
|
export interface SiriAccount {
|
|
1046
|
+
/** Persist each direct-mode state change, including a removal awaiting confirmation. */
|
|
1047
|
+
onState: ((state: unknown) => void) | null
|
|
968
1048
|
readonly state: unknown
|
|
969
1049
|
readonly shortcut: { key: string | null; endpoint: string }
|
|
970
1050
|
restore(state: unknown): this
|
|
1051
|
+
sync(): Promise<{ synced: boolean }>
|
|
971
1052
|
status(): Promise<unknown>
|
|
972
1053
|
/** In a vault: resolves `null` — the new key is shown in the vault's own screen (wb.vault.showSiriKey). */
|
|
973
1054
|
rotateKey(): Promise<string | null>
|
|
@@ -991,7 +1072,7 @@ export interface Speech {
|
|
|
991
1072
|
}
|
|
992
1073
|
export interface Dictation {
|
|
993
1074
|
readonly listening: boolean
|
|
994
|
-
start(opts?: { room?: string; onPartial?(t: string): void; onLevel?(rms: number): void }): Promise<void>
|
|
1075
|
+
start(opts?: { engine?: 'device' | 'cloud'; room?: string; onPartial?(t: string): void; onLevel?(rms: number): void }): Promise<void>
|
|
995
1076
|
stopCertified(): Promise<DictationResult>
|
|
996
1077
|
stop(): Promise<string>
|
|
997
1078
|
cancel(): void
|
|
@@ -1000,7 +1081,9 @@ export interface Dictation {
|
|
|
1000
1081
|
|
|
1001
1082
|
import type { Origins, DeclaredHosts, Providers, TenantRooms, Customers, Billing } from './witbitz-admin'
|
|
1002
1083
|
|
|
1003
|
-
export type VaultAccountIndex = Omit<AccountIndex, 'rooms' | 'onChange' | 'archive' | 'pin' | 'rename' | 'forget' | 'signOut' | 'sync' | 'start' | 'stop'> & {
|
|
1084
|
+
export type VaultAccountIndex = Omit<AccountIndex, 'rooms' | 'onChange' | 'archive' | 'pin' | 'rename' | 'forget' | 'signOut' | 'sync' | 'start' | 'stop' | 'signOutDevice' | 'chatLocks'> & {
|
|
1085
|
+
readonly chatLocks: Omit<AccountIndex['chatLocks'], 'deleteAll'> & { deleteAll(): ReturnType<AccountIndex['chatLocks']['deleteAll']> }
|
|
1086
|
+
signOutDevice(deviceId: string): Promise<{ revoked: boolean }>
|
|
1004
1087
|
readonly rooms: ReadonlyArray<Omit<AccountBackup['rooms'][number], 'link'>>
|
|
1005
1088
|
onChange: ((index: Pick<VaultAccountIndex, 'rooms' | 'devices'>) => void) | null
|
|
1006
1089
|
archive(room: string, on?: boolean): Promise<object>
|
|
@@ -1014,12 +1097,17 @@ export type VaultAccountIndex = Omit<AccountIndex, 'rooms' | 'onChange' | 'archi
|
|
|
1014
1097
|
}
|
|
1015
1098
|
|
|
1016
1099
|
export declare class Witbitz {
|
|
1100
|
+
setAssistantMemory(spaces?: Space[]): void
|
|
1101
|
+
readonly temporaryRooms: {
|
|
1102
|
+
list(): Promise<Array<{ room: string; at: number; title: string; status: 'recent' | 'live' | 'unknown' }>>
|
|
1103
|
+
open(room: string, options?: Parameters<Witbitz['openSpace']>[1]): Promise<Space>
|
|
1104
|
+
}
|
|
1017
1105
|
constructor(opts?: WitbitzOptions)
|
|
1018
1106
|
/** VAULT MODE: this page is framed by a vault you host on another origin, which keeps every room key. Rejects
|
|
1019
1107
|
* `not_in_vault` when the page is not framed by that origin. Create, read and send as usual; sign-in and sharing
|
|
1020
1108
|
* happen in the vault (`wb.vault`). A link is opened by the vault, not by openSpace. Refuses by name a `session`
|
|
1021
1109
|
* (`vault_signs_in`), `attest`, and a persisted `backup` / `siri` / `a2a` / `invite` state (`vault_unsupported`): the vault keeps the account. */
|
|
1022
|
-
static inVault(opts:
|
|
1110
|
+
static inVault(opts: VaultOptions): Promise<Omit<Witbitz, 'account' | 'backup' | 'vault'> & { readonly vault: VaultSession; readonly account: VaultAccountIndex; readonly backup: VaultAccountBackup }>
|
|
1023
1111
|
/** The vault this page runs in — set by {@link Witbitz.inVault}, else null. */
|
|
1024
1112
|
readonly vault: VaultSession | null
|
|
1025
1113
|
readonly session: Session | null
|
|
@@ -1048,8 +1136,8 @@ export declare class Witbitz {
|
|
|
1048
1136
|
readonly usernames: Usernames
|
|
1049
1137
|
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
1138
|
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>
|
|
1139
|
+
exportOfflineArchive(opts?: { recoveryKeys?: boolean; rooms?: Space[]; destination?: 'download' | 'clipboard' }): Promise<{ saved: number; unavailable: string[] }>
|
|
1140
|
+
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
1141
|
/** `link` is REQUIRED (a share link: `<viewer>/space?room=…#mk=…`); the current page URL is not read for you. */
|
|
1054
1142
|
openSpace(link: string, opts?: { resume?: Snapshot; tier?: Tier }): Promise<Space>
|
|
1055
1143
|
/** 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 +1155,7 @@ export declare class Witbitz {
|
|
|
1067
1155
|
/** Read `text` aloud → resolves when it has played. */
|
|
1068
1156
|
speak(text: string): Promise<void>
|
|
1069
1157
|
/** 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 }>
|
|
1158
|
+
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
1159
|
toJSON(): { viewer: string; tenant?: string; signedIn: boolean; tenantKey?: '[REDACTED]' }
|
|
1072
1160
|
// ── Builder calls (server only). Deprecated here: use WitbitzAdmin (witbitz-admin.js); `users` is `customers` there.
|
|
1073
1161
|
/** @deprecated use `new WitbitzAdmin(…).verifyTenantKey()` */
|
|
@@ -1104,3 +1192,6 @@ export declare function aguiAgent(lib: { AbstractAgent: unknown; Observable: unk
|
|
|
1104
1192
|
export declare const EAT_PROFILE: string
|
|
1105
1193
|
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
1194
|
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 }>
|
|
1195
|
+
|
|
1196
|
+
/** Built-in assistant templates, including their reusable instructions. */
|
|
1197
|
+
export function assistantTemplates(): Array<{ id: string; name: string; sub: string; agentName: string; persona: string }>
|