@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.
- package/README.md +2 -2
- package/a2aCore.js +41 -5
- package/accountErase.js +15 -4
- package/accountIndexDoc.js +24 -7
- package/accountRecord.js +6 -2
- package/accountStores.js +21 -5
- package/acctV2App.js +111 -12
- package/acctV2Client.js +11 -1
- package/acctV2UiCore.js +27 -7
- package/agentDoorTools.js +28 -0
- package/awsKey.js +3 -1
- package/backupRecord.js +3 -0
- package/chatLock.js +16 -0
- package/cloudDevicePins.js +2 -2
- package/codeAttachments.js +101 -0
- package/codeCache.js +173 -0
- package/codeCloud.js +2 -2
- package/codeComputers.js +9 -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 +109 -0
- package/codeSubagents.js +107 -0
- package/codeTransport.js +46 -5
- package/connections.js +37 -20
- package/decrypt.html +69 -9
- package/deviceAttest.js +9 -3
- package/eraseFile.js +15 -0
- package/idb.js +19 -3
- package/idbSeal.js +5 -2
- package/inviteReceive.js +44 -0
- package/inviteSend.js +8 -2
- package/jobAgents.js +2 -2
- package/keptMerge.js +9 -2
- package/l1-worker-src.js +1 -1
- package/l1-worker.js +122 -43
- package/laneAssociation.js +78 -0
- package/laneConfig.js +4 -3
- package/laneLinkCore.js +9 -0
- package/ledgerView.js +30 -4
- package/manifest.json +112 -87
- package/memberChange.js +4 -2
- package/mirrorBatch.js +47 -0
- package/offlineBundle.js +21 -0
- package/opRouting.js +10 -0
- package/package.json +27 -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 +52 -13
- package/reactionHolders.js +86 -0
- package/removedMessage.js +1 -1
- package/roomEmbed.js +111 -0
- package/roomIntake.js +324 -0
- package/roomName.js +1 -1
- package/roomRoster.js +30 -7
- package/rosterCount.js +6 -3
- package/scheduleNext.js +60 -0
- package/sdkA2A.js +200 -42
- package/sdkAccount.js +88 -18
- package/sdkAccountDoc.js +13 -5
- package/sdkAccountSections.js +172 -23
- package/sdkAgui.js +33 -6
- package/sdkBackup.js +53 -11
- package/sdkBackupV2.js +15 -3
- package/sdkCloudDevice.js +20 -5
- package/sdkComputers.js +695 -65
- package/sdkDictation.js +115 -25
- package/sdkErase.js +12 -5
- package/sdkExports.js +19 -8
- package/sdkInvitations.js +4 -2
- package/sdkKeptAgent.js +19 -3
- package/sdkKeptIntake.js +100 -0
- package/sdkLaneLink.js +8 -9
- package/sdkPlan.js +4 -2
- package/sdkRekey.js +122 -22
- package/sdkReport.js +1 -1
- package/sdkSafeMedia.js +1 -1
- package/sdkSchedules.js +8 -1
- package/sdkSpeech.js +32 -2
- package/sdkTemporaryRooms.js +124 -0
- package/sdkTurn.js +12 -4
- package/sdkVault.js +66 -10
- package/sentinelRelease.js +1 -0
- package/sharedViews.js +34 -4
- package/siri.js +140 -9
- package/spaceClient.js +112 -17
- package/spaceEmailGate.js +2 -2
- package/spaceExport.js +50 -5
- package/spaceFork.js +15 -7
- package/spaceTemplates.js +99 -0
- package/speechOut.js +21 -5
- package/store.js +134 -27
- package/sw-notif-core.js +11 -8
- package/tapTrail.js +58 -0
- package/turnVerdict.js +1 -0
- package/usageReceipts.js +12 -5
- package/vault-core.js +568 -126
- package/vault-kit.mjs +3 -3
- package/vault-screens.js +30 -18
- package/vaultAtRest.js +38 -6
- package/vaultCoreLock.js +3 -1
- package/vaultCorePush.js +58 -7
- package/vaultKeep.js +9 -3
- package/vaultWorkerHost.js +32 -7
- package/witbitz-admin.d.ts +3 -0
- package/witbitz-admin.mjs +12 -11
- package/witbitz-sdk.d.ts +170 -43
- package/witbitz-sdk.js +833 -203
package/sdkDictation.js
CHANGED
|
@@ -51,9 +51,11 @@ export class Dictation {
|
|
|
51
51
|
|
|
52
52
|
/** @private the page's key (op:'stt'). */
|
|
53
53
|
async _key() {
|
|
54
|
-
const
|
|
54
|
+
const epoch = this._payerEpoch
|
|
55
|
+
const { idToken, userToken } = this._cloudRun?.auth || await this._who()
|
|
55
56
|
const wb = this._wb
|
|
56
57
|
const r = await wb._client.stt(idToken, userToken)
|
|
58
|
+
if (epoch !== this._payerEpoch) throw err('account_changed', 'the voice payer changed')
|
|
57
59
|
if (r && r.status === 200 && r.key) {
|
|
58
60
|
this._stt = r.cert?.bundle ? { model: r.model, cert: structuredClone(r.cert), bundleGz: r.bundleGz } : null
|
|
59
61
|
return r
|
|
@@ -73,46 +75,126 @@ export class Dictation {
|
|
|
73
75
|
|
|
74
76
|
/** Begin a press. Resolves once the microphone is live and the connection is up (audio said meanwhile is queued).
|
|
75
77
|
* @param {{ onPartial?: (text:string)=>void, onLevel?: (rms:number)=>void }} [opts] */
|
|
76
|
-
async start({ onPartial, onLevel, room } = {}) {
|
|
78
|
+
async start({ onPartial, onLevel, room, engine: choice = 'cloud' } = {}) {
|
|
77
79
|
if (this._live) throw err('already_listening', 'dictation is already listening — stop() or cancel() first')
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
if (choice === 'device') return this._startDevice(room, onPartial, onLevel)
|
|
81
|
+
if (choice !== 'cloud') throw err('invalid_argument', 'choose cloud or device dictation')
|
|
82
|
+
const run = { partial: '', error: null }
|
|
83
|
+
this._cloudRun = run
|
|
84
|
+
this._interrupted = null
|
|
80
85
|
this._live = true
|
|
81
86
|
this._room = typeof room === 'string' ? room : null
|
|
87
|
+
const current = () => this._cloudRun === run
|
|
88
|
+
const interrupted = error => {
|
|
89
|
+
if (!current()) return
|
|
90
|
+
run.error = error
|
|
91
|
+
this.cancel()
|
|
92
|
+
this._interrupted = { text: run.partial, room: this._room, stt: this._stt }
|
|
93
|
+
}
|
|
82
94
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.
|
|
86
|
-
|
|
95
|
+
run.auth = await this._who()
|
|
96
|
+
if (!current()) return
|
|
97
|
+
const payer = run.auth.userToken || this._wb._session?.email || ''
|
|
98
|
+
if (this._payer !== undefined && payer !== this._payer) {
|
|
99
|
+
this._engine?.close(); this._engine = null; this._stt = null
|
|
100
|
+
}
|
|
101
|
+
this._payer = payer
|
|
102
|
+
const engine = await this._load()
|
|
103
|
+
if (!current()) return
|
|
104
|
+
let stream
|
|
105
|
+
try { stream = await this._gum({ audio: { channelCount: 1, echoCancellation: true, autoGainControl: true, noiseSuppression: true } }) }
|
|
106
|
+
catch (e) { throw err('mic_denied', String(e?.message || e)) }
|
|
107
|
+
if (!current()) { stream.getTracks().forEach(t => t.stop()); return }
|
|
108
|
+
this._stream = stream
|
|
109
|
+
const ready = engine.begin({ onPartial: text => {
|
|
110
|
+
if (current()) { run.partial = text; try { onPartial?.(text) } catch {} }
|
|
111
|
+
}, onError: interrupted })
|
|
112
|
+
await Promise.all([ready, (async () => {
|
|
113
|
+
const capture = await this._mod.startCapture(stream, ({ pcm, rms }) => {
|
|
114
|
+
if (!current()) return
|
|
115
|
+
engine.append(pcm)
|
|
116
|
+
try { onLevel?.(rms) } catch {}
|
|
117
|
+
}, { onError: interrupted })
|
|
118
|
+
if (current()) this._capture = capture
|
|
119
|
+
else capture.stop()
|
|
120
|
+
})()])
|
|
121
|
+
} catch (error) {
|
|
122
|
+
if (!current() && !run.error) return
|
|
123
|
+
if (current()) this.cancel()
|
|
124
|
+
throw error?.code ? error : err('stt_unavailable', String(error?.message || error))
|
|
87
125
|
}
|
|
88
|
-
|
|
89
|
-
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async _startDevice(room, onPartial, onLevel) {
|
|
129
|
+
const run = { committed: '', partial: '', transcriber: null }
|
|
130
|
+
this._deviceRun = run; this._interrupted = null; this._live = true; this._room = room || null
|
|
131
|
+
const text = () => [run.committed, run.partial].filter(Boolean).join(' ').trim()
|
|
132
|
+
const update = () => { if (this._deviceRun === run) { try { onPartial?.(text()) } catch {} } }
|
|
90
133
|
try {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
134
|
+
const M = await (this._deviceSdk ? this._deviceSdk() : import(new URL('/vendor/moonshine.web.mjs', globalThis.location.href).href))
|
|
135
|
+
if (this._deviceRun !== run) return
|
|
136
|
+
Object.assign(M.Settings.BASE_ASSET_PATH, { MOONSHINE: '/vendor/ms/', ONNX_RUNTIME: '/vendor/ms/ort/', SILERO_VAD: '/vendor/ms/vad/' })
|
|
137
|
+
const t = new M.Transcriber('model/tiny', {
|
|
138
|
+
onSpeechStart: () => { if (run.partial) { run.committed = text(); run.partial = '' } },
|
|
139
|
+
onTranscriptionUpdated: value => { run.partial = value || ''; update() },
|
|
140
|
+
onTranscriptionCommitted: value => { run.committed = [run.committed, value].filter(Boolean).join(' '); run.partial = ''; update() },
|
|
141
|
+
onError: e => { run.error = e || new Error('voice model failed') },
|
|
142
|
+
}, false)
|
|
143
|
+
run.transcriber = t
|
|
144
|
+
const stream = await this._gum({ audio: { channelCount: 1, echoCancellation: true, sampleRate: 16000 } })
|
|
145
|
+
if (this._deviceRun !== run) { for (const track of stream.getTracks()) track.stop(); return }
|
|
146
|
+
this._stream = stream
|
|
147
|
+
t.attachStream(stream)
|
|
148
|
+
await t.start()
|
|
149
|
+
if (this._deviceRun !== run) { this._endDevice(run); return }
|
|
150
|
+
if (onLevel && t.audioContext) {
|
|
151
|
+
const ctx = t.audioContext
|
|
152
|
+
const meter = ctx.createAnalyser()
|
|
153
|
+
meter.fftSize = 256
|
|
154
|
+
run.source = ctx.createMediaStreamSource(stream)
|
|
155
|
+
run.source.connect(meter)
|
|
156
|
+
const samples = new Float32Array(meter.fftSize)
|
|
157
|
+
run.timer = setInterval(() => {
|
|
158
|
+
meter.getFloatTimeDomainData(samples)
|
|
159
|
+
let square = 0
|
|
160
|
+
for (const sample of samples) square += sample * sample
|
|
161
|
+
try { onLevel(Math.sqrt(square / samples.length)) } catch {}
|
|
162
|
+
}, 50)
|
|
163
|
+
}
|
|
164
|
+
} catch (error) {
|
|
165
|
+
if (this._deviceRun !== run) return
|
|
166
|
+
this.cancel()
|
|
167
|
+
throw err(/permission|denied|notallowed/i.test(String(error)) ? 'mic_denied' : 'stt_unavailable', String(error?.message || error))
|
|
101
168
|
}
|
|
102
169
|
}
|
|
103
170
|
|
|
171
|
+
_endDevice(run) {
|
|
172
|
+
const t = run.transcriber
|
|
173
|
+
clearInterval(run.timer)
|
|
174
|
+
try { run.source?.disconnect() } catch {}
|
|
175
|
+
try { t?.stop() } catch {}
|
|
176
|
+
try { const context = t?.audioContext; if (context && context.state !== 'closed') context.close().catch(() => {}) } catch {}
|
|
177
|
+
}
|
|
178
|
+
|
|
104
179
|
/** End the press. → the final text ('' if nothing was said). */
|
|
105
180
|
async stop() {
|
|
106
|
-
if (!this._live) return ''
|
|
181
|
+
if (!this._live) { const interrupted = this._interrupted; this._interrupted = null; return interrupted?.text || '' }
|
|
107
182
|
this._live = false
|
|
183
|
+
this._cloudRun = null
|
|
108
184
|
this._release()
|
|
109
|
-
|
|
185
|
+
if (this._deviceRun) {
|
|
186
|
+
const run = this._deviceRun; this._deviceRun = null
|
|
187
|
+
this._endDevice(run)
|
|
188
|
+
if (run.error) throw err('stt_unavailable', String(run.error.message || run.error))
|
|
189
|
+
return [run.committed, run.partial].filter(Boolean).join(' ').trim()
|
|
190
|
+
}
|
|
191
|
+
return this._engine?.commit() || ''
|
|
110
192
|
}
|
|
111
193
|
|
|
112
194
|
/** Finish room-bound dictation and return the public certificate alongside the transcript. */
|
|
113
195
|
async stopCertified() {
|
|
114
|
-
if (!this._live || !this._room) throw err('dictation_room_required', 'start dictation with the destination room')
|
|
115
|
-
const room = this._room, stt = this._stt
|
|
196
|
+
if ((!this._live && !this._interrupted) || !this._room) throw err('dictation_room_required', 'start dictation with the destination room')
|
|
197
|
+
const room = this._room, stt = this._deviceRun ? null : (this._interrupted?.stt || this._stt)
|
|
116
198
|
const text = await this.stop()
|
|
117
199
|
const result = Object.freeze({ text, room, certificate: stt?.cert ? structuredClone(stt.cert) : null })
|
|
118
200
|
certifications.set(result, { room, stt })
|
|
@@ -121,9 +203,11 @@ export class Dictation {
|
|
|
121
203
|
|
|
122
204
|
/** Throw the press away. */
|
|
123
205
|
cancel() {
|
|
124
|
-
if (!this._live) return
|
|
206
|
+
if (!this._live) { this._interrupted = null; return } // an interrupted press's kept words go too — Stop must not return them (side sweep)
|
|
125
207
|
this._live = false
|
|
208
|
+
this._cloudRun = null
|
|
126
209
|
this._release()
|
|
210
|
+
if (this._deviceRun) { const run = this._deviceRun; this._deviceRun = null; this._endDevice(run); return }
|
|
127
211
|
try { this._engine.cancel() } catch { /* */ }
|
|
128
212
|
}
|
|
129
213
|
|
|
@@ -133,6 +217,12 @@ export class Dictation {
|
|
|
133
217
|
try { this._engine && this._engine.close() } catch { /* */ }
|
|
134
218
|
}
|
|
135
219
|
|
|
220
|
+
_resetPayer() {
|
|
221
|
+
this._payerEpoch = (this._payerEpoch || 0) + 1
|
|
222
|
+
this.close()
|
|
223
|
+
this._engine = null; this._stt = null; this._payer = undefined; this._interrupted = null
|
|
224
|
+
}
|
|
225
|
+
|
|
136
226
|
_release() {
|
|
137
227
|
try { this._capture && this._capture.stop() } catch { /* */ }
|
|
138
228
|
this._capture = null
|
package/sdkErase.js
CHANGED
|
@@ -177,6 +177,7 @@ export class Erasure {
|
|
|
177
177
|
try { if (wb.account && wb.account.enabled && typeof wb.account._where === 'function') indexRoom = (await wb.account._where()).room } catch { indexRoom = null }
|
|
178
178
|
const d = this._deleteDeps || {}
|
|
179
179
|
const client = wb._client
|
|
180
|
+
const temporaryScope = wb.temporaryRooms?._scope()
|
|
180
181
|
const rep = await eraseAccount({
|
|
181
182
|
me: { email: this._account(), names: (Array.isArray(names) ? names : []).map((n) => String(n || '').trim()).filter(Boolean).slice(0, 20) },
|
|
182
183
|
indexRoom,
|
|
@@ -187,7 +188,9 @@ export class Erasure {
|
|
|
187
188
|
read: d.read || (async (room) => {
|
|
188
189
|
const mk = await keyOf(room)
|
|
189
190
|
if (!mk) return null // a room this client cannot open is treated as shared: never deleted unchecked
|
|
190
|
-
|
|
191
|
+
let gone = false
|
|
192
|
+
const entries = await readAllEntries((since) => client.poll(room, mk, undefined, since), { onGone: () => { gone = true } }) // every page, not the first (sync sweep 2026-11-09)
|
|
193
|
+
if (gone) return { gone: true } // deleted already (410): not "unreadable ⇒ shared" (side sweep: account-erase-retry-treats-deleted-room-as-shared)
|
|
191
194
|
if (!entries) return null
|
|
192
195
|
let config = null; try { config = await client.getConfig(room, mk) } catch { config = null }
|
|
193
196
|
return { entries, config }
|
|
@@ -224,10 +227,14 @@ export class Erasure {
|
|
|
224
227
|
backupGone: () => { if (backup._s) { clearTimeout(backup._timer); backup._timer = null; backup._s.erased = true; backup._changed() } }, // pass 7, F#2: no write re-creates it, even if a later step fails
|
|
225
228
|
withdrawFiled: d.withdrawFiled || (this._tenant() ? async () => { const dd = this._d(); const r = await fileEraseList({ tenant: this._tenant(), account: this._account(), rooms: [], keys: [key], dropKeys, post: dd.post, auth: dd.auth, attest: dd.attest, seal: dd.seal, ls: this._ls, force: true }).catch(() => null); return { ok: !!(r && r.filed) } } : null),
|
|
226
229
|
wipe: async () => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
try {
|
|
231
|
+
if (temporaryScope) wb.temporaryRooms._erase(temporaryScope)
|
|
232
|
+
} finally {
|
|
233
|
+
this._opened = []; this._marked.clear(); this._k = { master: null, key: null }
|
|
234
|
+
try { if (wb.account && typeof wb.account.stop === 'function') wb.account.stop() } catch { /* */ }
|
|
235
|
+
backup._drop() // onState(null): the builder persists that this client holds no account any more
|
|
236
|
+
wb.signOut()
|
|
237
|
+
}
|
|
231
238
|
},
|
|
232
239
|
onStep,
|
|
233
240
|
})
|
package/sdkExports.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { exportSpace, recreateSpace } from './spaceExport.js'
|
|
2
|
-
import { makeBundle, sealSpaceMeta, keysFileText } from './offlineBundle.js'
|
|
1
|
+
import { exportSpace, recreateSpace, missingAttachments, messageCount } from './spaceExport.js'
|
|
2
|
+
import { makeBundle, sealSpaceMeta, keysFileText, OFFLINE_ATTACHMENTS_MAX_BYTES, addAttachmentStats } from './offlineBundle.js'
|
|
3
3
|
|
|
4
4
|
// Downloads stay in the document doing the export. A vault never returns the
|
|
5
5
|
// contents or a recovery key to its embedding page.
|
|
@@ -24,8 +24,13 @@ export async function saveRoomExport(sp, tier, current = () => true, title = sp.
|
|
|
24
24
|
const bundle = await exportSpace(sp.room, reader, { title })
|
|
25
25
|
if (!current()) throw new Error('account_changed')
|
|
26
26
|
bundle.tier = tier
|
|
27
|
+
// A readable file carries no credential (a connection's callKey, the room's earlier keys): exportSpace leaves them out for
|
|
28
|
+
// every caller — spaceExport.js portableConfig (side sweep: portable-export-includes-room-credentials).
|
|
27
29
|
saveExport('witbitz-space-' + sp.room + '.json', JSON.stringify(bundle), 'application/json')
|
|
28
|
-
|
|
30
|
+
// the attachments the file still carries only as a pointer to this room (their read failed): said, as the app says it — a
|
|
31
|
+
// recreated room cannot open them (side sweep: portable-export-silent-attachment-read-failure)
|
|
32
|
+
const missing = missingAttachments(bundle)
|
|
33
|
+
return { count: messageCount(bundle.entries), ...(missing ? { attachmentsMissing: missing } : {}) } // the MESSAGE count: a photo's Safe media copy is not one (side sweep: room-export-counts-hidden-records-as-messages)
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
export async function recreateExport(wb, bundle, { tier = bundle?.tier || (bundle?.device?.confidential === false ? 'standard' : 'enclave') } = {}) {
|
|
@@ -49,21 +54,27 @@ export async function recreateExport(wb, bundle, { tier = bundle?.tier || (bundl
|
|
|
49
54
|
return { space, carried: result.carried, total: result.total, ...(titleWarning ? { titleWarning } : {}) }
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
// `resolveRoom(room, keysOnly, attachments)`: `attachments` = the exportSealed option that puts the room's stored attachments in
|
|
58
|
+
// its sealed ledger — ONE cap (OFFLINE_ATTACHMENTS_MAX_BYTES) for the whole file; the room's `attachments` answer comes back
|
|
59
|
+
// beside its ledger and the result says how many were left out (`attachments: { included, tooLarge, failed }`).
|
|
60
|
+
export async function saveAccountArchive(rooms, resolveRoom, recoveryKeys, current, destination = 'download') {
|
|
61
|
+
if (!['download', 'clipboard'].includes(destination) || (destination === 'clipboard' && !recoveryKeys)) throw Object.assign(new Error('Invalid archive destination'), { code: 'invalid_argument' })
|
|
53
62
|
const spaces = [], keys = [], unavailable = []
|
|
63
|
+
let att = null
|
|
54
64
|
for (const r of rooms) {
|
|
55
65
|
if (!current()) throw new Error('account_changed')
|
|
56
66
|
try {
|
|
57
|
-
const { key, ledger, count } = await resolveRoom(r, recoveryKeys)
|
|
67
|
+
const { key, ledger, count, attachments } = await resolveRoom(r, recoveryKeys, { budget: Math.max(1, OFFLINE_ATTACHMENTS_MAX_BYTES - ((att && att.bytes) || 0)) })
|
|
58
68
|
if (!key || (!recoveryKeys && !ledger)) throw new Error('room_unavailable')
|
|
59
69
|
if (recoveryKeys) keys.push({ room: r.room, title: r.label || r.title || '', key })
|
|
60
|
-
else spaces.push({ meta: await sealSpaceMeta(key, { room: r.room, title: r.label || r.title || '', count }), ledger })
|
|
70
|
+
else { spaces.push({ meta: await sealSpaceMeta(key, { room: r.room, title: r.label || r.title || '', count }), ledger }); att = addAttachmentStats(att, attachments) }
|
|
61
71
|
} catch { unavailable.push(r.room) }
|
|
62
72
|
}
|
|
63
73
|
if (!current()) throw new Error('account_changed')
|
|
64
74
|
const saved = recoveryKeys ? keys.length : spaces.length
|
|
65
75
|
if (!saved) throw Object.assign(new Error('No rooms could be exported.'), { code: 'archive_empty', unavailable })
|
|
66
|
-
if (
|
|
76
|
+
if (destination === 'clipboard') await navigator.clipboard.writeText(keysFileText(keys))
|
|
77
|
+
else if (recoveryKeys) saveExport('witbitz-room-keys.txt', keysFileText(keys), 'text/plain')
|
|
67
78
|
else saveExport('witbitz-spaces.json', JSON.stringify(makeBundle(spaces)), 'application/json')
|
|
68
|
-
return { saved, unavailable }
|
|
79
|
+
return { saved, unavailable, ...(att && att.total ? { attachments: { included: att.included, tooLarge: att.tooLarge, failed: att.failed } } : {}) }
|
|
69
80
|
}
|
package/sdkInvitations.js
CHANGED
|
@@ -5,15 +5,17 @@ import { EMAIL } from './memberChange.js'
|
|
|
5
5
|
import { boxApp } from './attestedBox.js'
|
|
6
6
|
|
|
7
7
|
const fail = (code, text) => Object.assign(new Error('witbitz: ' + text), { code })
|
|
8
|
+
// the account backup's record of this room says it is a lane (kept as one, or detached from its Space)
|
|
9
|
+
const laneInBackup = (sp) => { try { const rooms = (sp._wb && sp._wb.backup && sp._wb.backup.rooms) || []; const r = rooms.find((x) => x && x.room === sp.room); return !!(r && (r.kind === 'lane' || r.detachedLane)) } catch { return false } }
|
|
8
10
|
export async function resendInvitation(sp, { email, username } = {}) {
|
|
9
|
-
if (sp._sharedRoom) throw fail('lane', 'a private lane cannot invite another member')
|
|
11
|
+
if (sp._sharedRoom || sp._detachedLane || laneInBackup(sp)) throw fail('lane', 'a private lane cannot invite another member') // a lane reopened as a plain Space, or detached, is still one member's room (side sweep: sdk-resend-forgets-private-lane-status)
|
|
10
12
|
if (!!email === !!username || (email && !EMAIL.test(email)) || (username && !validUsername(username))) throw fail('invalid_argument', 'name one recipient by email or username')
|
|
11
13
|
const wb = sp._wb, client = wb && wb._client
|
|
12
14
|
if (!client || !wb._session || !wb._session.idToken) throw fail('sign_in_required', 'sign in before sending an invitation')
|
|
13
15
|
// Never downgrade an attested invitation to a bearer link in a normal directory box.
|
|
14
16
|
let attested
|
|
15
17
|
try { attested = await client.attestedRoom(sp.room, sp._mk) } catch { throw fail('policy_unreadable', 'the device policy could not be read') }
|
|
16
|
-
const cfg = await sp._gateConfig()
|
|
18
|
+
const cfg = await sp._gateConfig({ fresh: true, plainMark: true }) // the CURRENT roles: isAdmin / isOwner below read this copy (side sweep 2026-11-28: a cached one kept a demoted admin, refused a promoted one)
|
|
17
19
|
if (cfg.admission === 'email') {
|
|
18
20
|
if (!(await sp.isAdmin(wb._session.email)) && !(await sp.isOwner(wb._session.email))) throw fail('not_admin', 'only an owner or admin may resend an invitation')
|
|
19
21
|
}
|
package/sdkKeptAgent.js
CHANGED
|
@@ -2,6 +2,7 @@ import { linkOwnAgent, unlinkOwnAgent } from './ownAgentLink.js'
|
|
|
2
2
|
import { enableLaneIn, addPeerIn, removePeerIn, peersOf, mcpUrlOf } from './a2aCore.js'
|
|
3
3
|
import { A2A_PEERS_DOC } from './a2aShared.js'
|
|
4
4
|
import { sealDoc } from './accountSeal.js'
|
|
5
|
+
import { keptDelivery, revokeKeptDrop } from './sdkKeptIntake.js' // its jobs to the cloud device (side sweep: sdk-kept-agent-missing-cloud-delivery)
|
|
5
6
|
|
|
6
7
|
const fail = (code, text) => Object.assign(new Error('witbitz: ' + text), { code })
|
|
7
8
|
const ID = /^[A-Za-z0-9_-]{1,128}$/
|
|
@@ -99,15 +100,29 @@ export function linkKeptAgent(lane, space, { spaceName = space && space.title, l
|
|
|
99
100
|
const cfg = await lane._gateConfig({ fresh: true }); guard()
|
|
100
101
|
if (!cfg || cfg.gated && !cfg.allow) throw fail('unreadable', 'the private assistant’s connections could not be read')
|
|
101
102
|
const connections = Array.isArray(cfg?.connections) ? cfg.connections : []
|
|
102
|
-
|
|
103
|
+
// both peers must still be listed: a peer removed since is no working link, so it is made again (side sweep 2026-11-28: it was reopened)
|
|
104
|
+
const hasPeer = (room, id) => peersOf(w.a2a._s, room).some((p) => p.id === id)
|
|
105
|
+
// a link made before its jobs reached the cloud device (an older SDK) gets its drop address now; one that has it is unchanged
|
|
106
|
+
if (connections.some((c) => c.id === existing.connId) && hasPeer(lane.room, existing.lPeer) && hasPeer(space.room, existing.sPeer)) return { ...publicLink(existing), ...await keptDelivery(w, { space: space.room, sPeer: existing.sPeer }, guard) }
|
|
103
107
|
}
|
|
104
108
|
if (existing) await unlinkKnown(w, lane, space, existing, guard)
|
|
105
109
|
const d = deps(w, lane, space, guard)
|
|
106
110
|
const result = await linkOwnAgent({ lane: lane.room, space: space.room, spaceName: String(spaceName || 'Kept assistant').slice(0, 80), laneName: String(laneName || 'Private assistant').slice(0, 80) }, d)
|
|
107
111
|
guard()
|
|
108
112
|
const link = { lane: lane.room, space: space.room, ...result }
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
// the completed record refused → the finished link is taken back (side sweep 2026-11-28: both peers, the report destination and
|
|
114
|
+
// the grant stayed installed); if that fails too, the pending record still names it and the next link removes it
|
|
115
|
+
try { await saveLink(w, link, guard) } catch (e) {
|
|
116
|
+
try {
|
|
117
|
+
await unlinkOwnAgent({ lane: lane.room, space: space.room, lPeer: link.lPeer, sPeer: link.sPeer, connId: link.connId }, d)
|
|
118
|
+
if (w._forgetAgentConnection) await w._forgetAgentConnection(link.connId)
|
|
119
|
+
if (w._keptAgentConnections) w._keptAgentConnections.delete(link.connId)
|
|
120
|
+
} catch { /* see above */ }
|
|
121
|
+
throw e
|
|
122
|
+
}
|
|
123
|
+
// ITS JOBS TO THE CLOUD DEVICE (side sweep: sdk-kept-agent-missing-cloud-delivery): the kept Space's peer gets a drop address in the
|
|
124
|
+
// account's message intake. Not done → the link still works as before ('client': its jobs wait at the Sentinel for a client).
|
|
125
|
+
return { ...link, ...await keptDelivery(w, { space: space.room, sPeer: link.sPeer }, guard) }
|
|
111
126
|
})
|
|
112
127
|
}
|
|
113
128
|
|
|
@@ -141,6 +156,7 @@ async function unlinkKnown(w, lane, space, link, guard) {
|
|
|
141
156
|
await unlinkOwnAgent({ lane: lane.room, space: space.room, lPeer: link.lPeer, sPeer: link.sPeer, connId: link.connId }, deps(w, lane, space, guard))
|
|
142
157
|
guard()
|
|
143
158
|
await saveLink(w, { ...publicLink(link), gone: true }, guard)
|
|
159
|
+
await revokeKeptDrop(w, { space: space.room, sPeer: link.sPeer }, guard)
|
|
144
160
|
if (w._forgetAgentConnection) await w._forgetAgentConnection(link.connId)
|
|
145
161
|
if (w._keptAgentConnections) w._keptAgentConnections.delete(link.connId)
|
|
146
162
|
}
|
package/sdkKeptIntake.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// sdkKeptIntake.js — A KEPT ASSISTANT'S JOBS GO TO THE CLOUD DEVICE, AS IN THE APP (side sweep: sdk-kept-agent-missing-cloud-delivery).
|
|
2
|
+
// The cloud device reads an outside agent's message for one of its Spaces only from the account's MESSAGE INTAKE (docs/message-intake.md;
|
|
3
|
+
// cloud-device/worker.mjs collectDrops). The app gives each outside agent a drop address there (intakeProducers.js) and hands the device
|
|
4
|
+
// the message room (cloudDeviceSheet.js `msgroom`). The SDK had neither: its grant kept a drop address only for a peer the Sentinel
|
|
5
|
+
// already held, so the kept Space's peer that lane.linkKept made had none, and its jobs waited at the Sentinel for a client holding
|
|
6
|
+
// the lane's key — the always-on Space answered only while some client was awake.
|
|
7
|
+
//
|
|
8
|
+
// Now, for that ONE peer, the SDK does what the app does, with the app's own pieces:
|
|
9
|
+
// • the account's message room — the one the account index names (`msgsRoom`, accountIndexDoc.js, the pointer the app adopts),
|
|
10
|
+
// else one made like the app's (roomSync.js ensureMsgsRoom) and published there over the version read;
|
|
11
|
+
// • its drop address — roomIntake.js address(): derived from the intake key kept IN the message room, registered with kind 'a2a'
|
|
12
|
+
// and the kept Space as its only target, id 'a2a:<space>:<peer>' (= intakeProducers.js a2aProducerId — the device checks it);
|
|
13
|
+
// • the cloud device is handed the message room FIRST (door.mjs `msgroom`), then the record is pushed naming the intake. A step that
|
|
14
|
+
// fails stops there: nothing is dropped into an intake the device does not read.
|
|
15
|
+
// ONLY the kept Space's peer — and any peer the intake already lists (registered by the account's app devices) — gets an address: the SDK
|
|
16
|
+
// reads no message room, so a private lane's peer keeps the Sentinel's inbox, which its client collects (lane.a2a.collect()).
|
|
17
|
+
import { makeRoomIntake } from './roomIntake.js'
|
|
18
|
+
import { validPointer, indexDoc } from './accountIndexDoc.js'
|
|
19
|
+
import { APP_DOC } from './sdkAccountDoc.js'
|
|
20
|
+
import { sealDoc } from './accountSeal.js'
|
|
21
|
+
|
|
22
|
+
const fail = (code, text) => Object.assign(new Error('witbitz: ' + text), { code })
|
|
23
|
+
/** = intakeProducers.js a2aProducerId — and cloud-device/worker.mjs checks exactly this id. */
|
|
24
|
+
export const keptProducerId = (room, peerId) => `a2a:${room}:${peerId}`
|
|
25
|
+
const MSGS_ROOM = Object.freeze({ agentReplies: false, kind: 'msgs', retention: 'purgeable' }) // roomSync.js ensureMsgsRoom
|
|
26
|
+
|
|
27
|
+
/** The account's message room → { room, mk }: the index's, else made and published (a 409 re-reads and takes the winner's). With
|
|
28
|
+
* `create: false`, null when the index names none. */
|
|
29
|
+
export async function keptMessageRoom(w, guard, { create = true } = {}) {
|
|
30
|
+
const acc = w.account, c = acc._client()
|
|
31
|
+
let made = null
|
|
32
|
+
for (let i = 0; i < 5; i++) {
|
|
33
|
+
const loc = await acc._where(); guard()
|
|
34
|
+
const got = await acc._read(loc, APP_DOC, loc.app); guard()
|
|
35
|
+
if (!got.ok) throw fail('unreadable', 'the account index could not be read')
|
|
36
|
+
const have = validPointer(got.doc && got.doc.msgsRoom)
|
|
37
|
+
if (have) return { room: String(have.room), mk: String(have.mk) }
|
|
38
|
+
if (got.doc && got.doc.msgsRoom && got.doc.msgsRoom.room) throw fail('no_key', 'the account’s message room is named without its key') // never replaced by a second one
|
|
39
|
+
if (!create) return null
|
|
40
|
+
if (!made) { const s = await c.create({ ...MSGS_ROOM }, { base: acc._viewer || undefined }); guard(); made = { room: s.room, mk: s.mk } }
|
|
41
|
+
const doc = { ...(got.doc || indexDoc({ rooms: {}, devices: {}, signouts: {}, name: '' })), msgsRoom: made, at: Date.now() }
|
|
42
|
+
const r = await c.state(loc.room, loc.mk, APP_DOC, await sealDoc(loc.app, doc), 'account index', 'device', got.v); guard()
|
|
43
|
+
if (r && r.status === 409) continue
|
|
44
|
+
if (!r || r.status !== 200) throw fail('save_failed', 'the account’s message room could not be recorded')
|
|
45
|
+
return made
|
|
46
|
+
}
|
|
47
|
+
throw fail('version_conflict', 'the account index kept changing')
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** roomIntake.js over the message room, with this client. The SDK only gives addresses; the cloud device collects. */
|
|
51
|
+
export function keptIntakeOf(w, ptr) {
|
|
52
|
+
const c = w.account._client()
|
|
53
|
+
return makeRoomIntake({
|
|
54
|
+
room: async () => ptr.room, ensureRoom: async () => ptr.room,
|
|
55
|
+
state: (room, name, patch, ifV) => c.state(room, ptr.mk, name, patch, undefined, undefined, ifV),
|
|
56
|
+
intakeReg: (room, ops) => c.intakeReg(room, ptr.mk, ops),
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Deliver the kept Space's peer `sPeer` to the cloud device. → 'device'; throws the reason (nothing named at the Sentinel then). */
|
|
61
|
+
export async function deliverKeptToDevice(w, { space, sPeer }, guard) {
|
|
62
|
+
if (typeof w.a2a?._pushIntake !== 'function' || typeof w.cloudDevice?._ask !== 'function' || typeof w.account?._client !== 'function') throw fail('not_available', 'this client cannot hand jobs to the cloud device')
|
|
63
|
+
const peer = (w.a2a._s.lanes[space]?.peers || []).find((p) => p.id === sPeer)
|
|
64
|
+
if (!peer) throw fail('not_in_record', 'the kept assistant’s peer is not in this account’s record')
|
|
65
|
+
const ptr = await keptMessageRoom(w, guard)
|
|
66
|
+
const intake = keptIntakeOf(w, ptr)
|
|
67
|
+
await intake.address({ id: keptProducerId(space, sPeer), label: peer.name, kind: 'a2a', target: space }); guard()
|
|
68
|
+
await w.cloudDevice._ask('msgroom', { room: ptr.room, mk: ptr.mk }); guard() // the device reads the room BEFORE anything is dropped there
|
|
69
|
+
await w.a2a._pushIntake(async (rec) => {
|
|
70
|
+
const listed = new Map((await intake.addresses()).map((a) => [a.id, a])) // one read: every address the intake lists (an unreadable one throws)
|
|
71
|
+
const drops = {}
|
|
72
|
+
let base = null
|
|
73
|
+
for (const [room, l] of Object.entries(rec.lanes || {})) for (const p of l.peers || []) {
|
|
74
|
+
const a = listed.get(keptProducerId(room, p.id))
|
|
75
|
+
if (a) { drops[room + '|' + p.id] = a.token; base = a }
|
|
76
|
+
}
|
|
77
|
+
if (!base || !drops[space + '|' + sPeer]) throw fail('not_in_record', 'the kept assistant’s peer left the record')
|
|
78
|
+
return { room: base.room, pub: base.pub, drops }
|
|
79
|
+
})
|
|
80
|
+
guard()
|
|
81
|
+
return 'device'
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** As deliverKeptToDevice, never throwing (an account change aside): → { delivery: 'device' } | { delivery: 'client', deliveryError }.
|
|
85
|
+
* 'client': the link works as before — its jobs wait at the Sentinel until a client collects them. */
|
|
86
|
+
export async function keptDelivery(w, args, guard) {
|
|
87
|
+
try { return { delivery: await deliverKeptToDevice(w, args, guard) } } catch (e) {
|
|
88
|
+
if (e && e.code === 'account_changed') throw e
|
|
89
|
+
return { delivery: 'client', deliveryError: String((e && e.code) || 'failed') }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The link is gone: its peer's drop address goes too (best effort — revoking the peer at the Sentinel already stopped it). */
|
|
94
|
+
export async function revokeKeptDrop(w, { space, sPeer }, guard) {
|
|
95
|
+
try {
|
|
96
|
+
if (typeof w.account?._client !== 'function' || !w.account.enabled) return
|
|
97
|
+
const ptr = await keptMessageRoom(w, guard, { create: false })
|
|
98
|
+
if (ptr) await keptIntakeOf(w, ptr).revokeAddress(keptProducerId(space, sPeer))
|
|
99
|
+
} catch { /* the Sentinel already refuses the removed peer's token; a leftover address only lets nothing in */ }
|
|
100
|
+
}
|
package/sdkLaneLink.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// assistants asking each other stops at the cap. Default 3; `cap: 0` = no lane-to-lane traffic.
|
|
14
14
|
// ⚑ It runs while both lanes are OPEN on this device (the app's driver is "app-open only" too). `link.state` carries the
|
|
15
15
|
// cursors; pass it back as `resume` to pick up an exchange that was in flight when the page closed.
|
|
16
|
-
import { buildFramed, parseFramed, newCorr, askHopFrom, canForward, planForward, DEFAULT_LANE_LINK_CAP } from './laneLinkCore.js'
|
|
16
|
+
import { buildFramed, parseFramed, newCorr, askHopFrom, canForward, planForward, DEFAULT_LANE_LINK_CAP, uniqueLabel } from './laneLinkCore.js'
|
|
17
17
|
|
|
18
18
|
const GUIDANCE =
|
|
19
19
|
'You can ask the member\'s OTHER linked assistants a question with tell_lane. It is ASYNCHRONOUS: tell_lane posts ' +
|
|
@@ -35,14 +35,12 @@ const isAgent = (e) => !!(e && e.self === true)
|
|
|
35
35
|
* the tool's enum and its executor both read THIS list, so the name the model picks can never resolve to another lane
|
|
36
36
|
* (the app's linkedLaneChoices rule). */
|
|
37
37
|
export function peersOf(lane) {
|
|
38
|
-
const
|
|
38
|
+
const used = new Set(), out = []
|
|
39
39
|
for (const link of (lane._laneLinks || [])) {
|
|
40
40
|
if (link._dead) continue
|
|
41
41
|
const side = link._sideOf(lane)
|
|
42
42
|
const base = side.to || DEFAULT_LABEL
|
|
43
|
-
|
|
44
|
-
seen.set(base, n)
|
|
45
|
-
out.push({ label: n === 1 ? base : `${base} (${n})`, link, peer: side.other })
|
|
43
|
+
out.push({ label: uniqueLabel(used, base), link, peer: side.other }) // unique among ALL labels, generated ones too
|
|
46
44
|
}
|
|
47
45
|
return out
|
|
48
46
|
}
|
|
@@ -74,13 +72,13 @@ export function laneLinkTool(lane) {
|
|
|
74
72
|
async function postAndWake(lane, text, from, { ask = false } = {}) {
|
|
75
73
|
// Given up = given up (sync sweep, 2026-10-10): a pass's send still held for "busy" is not resent after the wait (the
|
|
76
74
|
// pass retries it, and a second copy would forward twice); and `from` is the LINK's label, never the member's name.
|
|
77
|
-
let timedOut = false
|
|
75
|
+
let timedOut = false, timer
|
|
78
76
|
try {
|
|
79
77
|
const sent = lane.send(text, { from, mode: 'always', ...(ask ? { _noHold: true } : { _aborted: () => timedOut }), _linkPost: true })
|
|
80
|
-
const r = await Promise.race([sent, new Promise((res) => setTimeout(() => { timedOut = true; res(null) }, ask ? ASK_WAIT_MS : WAKE_WAIT_MS))])
|
|
78
|
+
const r = await Promise.race([sent, new Promise((res) => { timer = setTimeout(() => { timedOut = true; res(null) }, ask ? ASK_WAIT_MS : WAKE_WAIT_MS) })])
|
|
81
79
|
if (r === null && ask) { sent.catch(() => {}); return true } // still running: the question is in, the turn is answering it
|
|
82
80
|
return !!(r && r.status === 200 && !r.busy && r.ok !== false)
|
|
83
|
-
} catch { return false }
|
|
81
|
+
} catch { return false } finally { clearTimeout(timer) }
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
export class LaneLink {
|
|
@@ -121,7 +119,7 @@ export class LaneLink {
|
|
|
121
119
|
clearTimeout(this._t)
|
|
122
120
|
for (const [l, sub] of [[this.a, this._subA], [this.b, this._subB]]) {
|
|
123
121
|
const subs = l._subs && l._subs.message
|
|
124
|
-
if (subs) { const i = subs.
|
|
122
|
+
if (subs) { const i = subs.findIndex((x) => x === sub || x._orig === sub); if (i >= 0) subs.splice(i, 1) } // on() keeps its own wrapper (_orig: sub)
|
|
125
123
|
l._laneLinks = (l._laneLinks || []).filter((x) => x !== this)
|
|
126
124
|
}
|
|
127
125
|
}
|
|
@@ -153,6 +151,7 @@ export class LaneLink {
|
|
|
153
151
|
// the corr out of `sent`, and another device with this link open keeps its own `sent` — both carried the same
|
|
154
152
|
// answer back again. The asking lane is the record: a framed reply with this corr in it is a forward done.
|
|
155
153
|
if ((side.other.messages || []).some((e) => { const p = parseFramed(e && e.text); return p && p.kind === 'reply' && p.corr === f.corr })) { this._sent[side.key].push(f.corr); continue }
|
|
154
|
+
if (this._dead) return { forwarded } // unlinked while the pass read or posted (side sweep 2026-11-28): nothing more crosses
|
|
156
155
|
const framed = buildFramed({ from: side.as, fromRoom: lane.room, corr: f.corr, hop: f.hop, cap: this.cap, kind: 'reply', body: f.text })
|
|
157
156
|
if (await postAndWake(side.other, framed, side.as)) { this._sent[side.key].push(f.corr); forwarded++ } else allOk = false
|
|
158
157
|
}
|
package/sdkPlan.js
CHANGED
|
@@ -21,7 +21,7 @@ const RANK = { none: 0, in_place: 1, fork: 2, new_room: 3 }
|
|
|
21
21
|
* @param room { cfg (the room's sealed config, or null), me (the signed-in email, or ''), lane (bool), checkData?(data) }
|
|
22
22
|
* → { how: 'none'|'in_place'|'new_room'|'refused', history: 'kept'|'not_carried'|null, call, steps, reason? }
|
|
23
23
|
*/
|
|
24
|
-
export function planChange (change = {}, { cfg = null, me = '', lane = false, checkData = null, gatedUnread = false, signIn = 'wb.signIn' } = {}) { // signIn: the call that signs in here ('wb.vault.signIn' in a vault) // gatedUnread: a gated room answered only its stub (not signed in)
|
|
24
|
+
export function planChange (change = {}, { cfg = null, me = '', lane = false, activeLane = lane, checkData = null, gatedUnread = false, signIn = 'wb.signIn' } = {}) { // signIn: the call that signs in here ('wb.vault.signIn' in a vault) // gatedUnread: a gated room answered only its stub (not signed in)
|
|
25
25
|
const steps = []
|
|
26
26
|
let members = false // the change includes a member list (in place: space.changeMembers)
|
|
27
27
|
let how = 'none', refusal = null
|
|
@@ -29,7 +29,9 @@ export function planChange (change = {}, { cfg = null, me = '', lane = false, ch
|
|
|
29
29
|
const refuse = (code, reason) => { if (!refusal) refusal = { code, reason } }
|
|
30
30
|
// a private lane follows its Space's Safe media — refused as configure() refuses it (sync sweep 2026-11-02 #2), and FIRST, as
|
|
31
31
|
// configure() checks it first: after the admin/sign-in checks a lane read signed out planned sign_in_required (2026-11-03 #6)
|
|
32
|
-
if (
|
|
32
|
+
if (change.lanes !== undefined && typeof change.lanes !== 'boolean') refuse('invalid_argument', 'lanes takes true or false')
|
|
33
|
+
if (lane && change.lanes !== undefined) refuse('lane', 'a private lane has no private assistants of its own')
|
|
34
|
+
if (activeLane && change.safeMedia !== undefined) refuse('lane_follows_space', 'a private lane follows its Space’s Safe media — set it on the Space')
|
|
33
35
|
|
|
34
36
|
const agent = change.agent && typeof change.agent === 'object' ? change.agent : {}
|
|
35
37
|
for (const k of Object.keys(agent)) {
|