@ai-workbench/connect 0.7.20 → 0.7.21
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
安装:在官方 DSH「插件 → 添加插件」中选择编排已核验的 tgz 绝对路径。已由编排发布的版本也可按其提供的精确包版本安装;本轮0.7.
|
|
1
|
+
安装:在官方 DSH「插件 → 添加插件」中选择编排已核验的 tgz 绝对路径。已由编排发布的版本也可按其提供的精确包版本安装;本轮0.7.21只提供固定tgz,本项目不自行 publish。
|
|
2
2
|
|
|
3
3
|
# 远程主机连接插件(L)
|
|
4
4
|
|
|
@@ -43,7 +43,7 @@ openssl s_client -connect registry.npmjs.org:443 -servername registry.npmjs.org
|
|
|
43
43
|
|
|
44
44
|
D13已通过[PR15](https://github.com/yzsnstotz/ai-workbench-connect/pull/15)合推main7915df5,移除前为909eabb;五项被拒产物及清单引用已撤除。不再生成新的聚合整包或验收ZIP,交付物为插件本身。
|
|
45
45
|
|
|
46
|
-
**插件版本0.7.
|
|
46
|
+
**插件版本0.7.21,API保持0.7.0/native-local-v1。** 本轮沿用现有N/X公开API,真实组合由编排验证。L导入动作固定使用官方系统目录窗口:自动能力为native时直接消费其pick;SSH等启动上下文提供browse时,明确调用同一官方原生包的公开pickNativeDirectory,不修改全局选择器。失败原因与临时登录路径只在本节技术详情准确投影。js-yaml/yauzl及其传递运行依赖随tgz打包,官方宿主peer由已安装官方程序提供,员工不另装npm依赖。真实中文GUI/授权及leo E门分别留证。旧140测试/46图只属于前任draft.3;本轮证据独立记录于[第2轮证据](docs/evidence/2026-10-21-L-round2-draft4/)。不得拿旧0.6.3 tgz当native-local-v1的输入。
|
|
47
47
|
|
|
48
48
|
开发使用Node24.13.1,依赖/缓存/构建和临时HOME放自有外接APFS。工程检查为`npm test`、`npm run check`、`npm run build`;它们不替代真实产品路径。安装走官方插件管理,本包自身只声明一个官方bundle条目,不使用wrapper或员工启动器。工人GUI按[SELFTEST](docs/SELFTEST.md)的PID和三项获准偏离执行,不操作owner实例。
|
|
49
49
|
|
|
@@ -53,7 +53,7 @@ L0.7.4按owner最新纠正分开供给和授权:Electron组件从自身官方
|
|
|
53
53
|
|
|
54
54
|
官方Electron内置Node会把.asar视作虚拟目录;组件缓存/解压专用physical-fs在Electron中使用original-fs核验物理归档,不修改全局process.noAsar。真实官方运行时新建及跨Node复用缓存均有回归。
|
|
55
55
|
|
|
56
|
-
0.7.5仅调整公开 npm 发布元数据和包内容:运行依赖继续随包,合同、源码、测试与证据不进包;无安装脚本。源码与合同见[项目仓库](https://github.com/yzsnstotz/ai-workbench-connect)。发布前可用官方插件页安装已核验的tgz绝对路径。0.7.
|
|
56
|
+
0.7.5仅调整公开 npm 发布元数据和包内容:运行依赖继续随包,合同、源码、测试与证据不进包;无安装脚本。源码与合同见[项目仓库](https://github.com/yzsnstotz/ai-workbench-connect)。发布前可用官方插件页安装已核验的tgz绝对路径。0.7.21本轮提供固定tgz,由编排决定发布;L不执行publish。
|
|
57
57
|
|
|
58
58
|
0.7.6:L设置节可显式选择 GitHub 官方源或 npmmirror(Electron 官方文档列出的中国镜像),显示所选来源与理由。未保存选择/未显式配置时默认 npmmirror,依据为编排在leo的可达性实测,不代表自动测速。优先级:本profile设置节已保存选择 → helper.componentDownloadSource初值 → 旧helper.source显式URL → 默认npmmirror;坏设置/保存失败明确报错,不静默切源。预设仍校验原Electron44.0.0固定SHA256。helper.componentObservationIntervalMs默认1000毫秒,只刷新“已N秒无进展”,不触发超时/重试/换源。Claude网页登录的当前流向见下节;Codex本版保留原有N主机代理方式。
|
|
59
59
|
|
|
@@ -125,3 +125,14 @@ payload 仅有七个必填字段:phase 固定 `workspace-source-admission`;s
|
|
|
125
125
|
## 0.7.19 本地首轮会话核验修复
|
|
126
126
|
|
|
127
127
|
官方 rc.2 JSONL 会将新会话省略的 delegationDepth 写为 0。接纳与本地技术详情历史核验现在只将这两种官方表示视为同一身份,避免新建 Claude/Codex 会话误报 REMOTE_DETAIL_SCOPE_INVALID;其他完整 header 身份、实际员工输入、品牌、目录与连接代次检查保持严格。不会重写原始 header/旧关系摘要或恢复旧轮写权限,无新增 Config、权限或自动重试。X 的输入核验和错误文案须随统一 0.8.13 修复;leo 真实组合复验另行进行,本包不安装现场、不 publish。
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 0.7.20 已选主机目录
|
|
131
|
+
|
|
132
|
+
已选主机文件夹经真实会话/品牌/工作区关系和目录身份/权限复核后,可返回主机执行目录;远程提供方须消费hostWorkspaceResolution及resolveSessionProject的主机位置CAS增量。原projectRoot不改,同会话不能换来源/目录,变更后明确“文件来源已改,请新建会话继续”,原技术详情历史只读。运行前核目录身份和权限是正确性要求,不可关闭;实际写入仍由主机系统权限决定。当前可信主机标识不依赖先浏览;设置页短暂HTTP/SSE异常保留最后快照并标“正在重新确认”。两插件组合与leo产品验收由编排安排。
|
|
133
|
+
|
|
134
|
+
## 0.7.21 技术详情增量读取
|
|
135
|
+
|
|
136
|
+
写入技术详情使用紧凑内存索引,避免每条都重读整个域的JSON及重复打开相同接纳关系;正文仍保存在原私有文件中,按页读取全部原始字段。每次核文件身份/权限及变更元数据,新增或变化文件重验完整schema与摘要;作用域证明仅在本次操作内按完整归属合并,返回正文前重核原记录关系,不能借同会话另一关系读取悬空记录。跨会话eventId幂等、全历史序号、原子写和文件/目录fsync、未知结果只读核实保持。
|
|
137
|
+
|
|
138
|
+
不增加Config、权限层、超时或业务重试。性能数据来自本地夹具,不代表leo已安装或已消除全部失败收尾耗时;X适配器、网络与真实员工复验分别留证。本轮仍只交固定tgz,由编排决定发布,L不publish。
|
|
@@ -48,6 +48,7 @@ export function validRemoteConversationDetail(v) {
|
|
|
48
48
|
return false;
|
|
49
49
|
return v.version === 1 && text(v.eventId) && text(v.instanceId) && integer(v.epoch) && text(v.sessionId) && brand(v.provider) && integer(v.sequence) && [v.turn, v.step].every(x => x === null || text(x) || integer(x)) && text(v.kind) && ['info', 'warning', 'action-required'].includes(v.severity) && text(v.code) && typeof v.summary === 'string' && (v.method === undefined || text(v.method));
|
|
50
50
|
}
|
|
51
|
+
const header = (d) => ({ eventId: d.eventId, instanceId: d.instanceId, epoch: d.epoch, sessionId: d.sessionId, provider: d.provider, sequence: d.sequence, kind: d.kind, severity: d.severity });
|
|
51
52
|
const counts = (items, knownKinds = ['extensions', 'commands', 'tools', 'usage', 'action-required']) => ({ total: items.length, unknownCount: items.filter(d => !knownKinds.includes(d.kind)).length, actionRequiredCount: items.filter(d => d.severity === 'action-required' || d.kind === 'action-required').length });
|
|
52
53
|
export function createConversationDetails(options) {
|
|
53
54
|
const parent = join(options.profileDir, 'ai-workbench-connect'), root = join(parent, options.storageName ?? 'conversation-details');
|
|
@@ -60,6 +61,9 @@ export function createConversationDetails(options) {
|
|
|
60
61
|
let snapshotGuards = [];
|
|
61
62
|
let snapshot = { ...connectionIds(), revision, phase: 'unavailable', sessions: [] };
|
|
62
63
|
const listeners = new Set();
|
|
64
|
+
// Only compact, validated metadata is retained: event bodies remain on disk.
|
|
65
|
+
const indexed = new Map(), storedDigests = new WeakMap();
|
|
66
|
+
const operationScopes = new Map();
|
|
63
67
|
function connectionIds() { const c = options.getConnectionState(); return { instanceId: c.instanceId, epoch: c.epoch }; }
|
|
64
68
|
function check(before) { const c = options.getConnectionState(); if (disposed || c.phase === 'disposed')
|
|
65
69
|
throw new NeedError(need('DISPOSED')); if (c.phase !== 'connected' || c.instanceId !== before.instanceId || c.epoch !== before.epoch)
|
|
@@ -83,6 +87,7 @@ export function createConversationDetails(options) {
|
|
|
83
87
|
return { ...connectionIds(), revision, phase: 'unavailable', sessions: [], need: need(e instanceof NeedError ? e.need.code : 'REMOTE_DETAIL_STORAGE_FAILED') };
|
|
84
88
|
} return structuredClone(snapshot); }
|
|
85
89
|
function error(e) { const code = e instanceof NeedError ? e.need.code : 'REMOTE_DETAIL_STORAGE_FAILED'; if (code === 'REMOTE_DETAIL_STORAGE_FAILED') {
|
|
90
|
+
indexed.clear();
|
|
86
91
|
uncertain = true;
|
|
87
92
|
publish('failed', [], code);
|
|
88
93
|
}
|
|
@@ -92,6 +97,7 @@ export function createConversationDetails(options) {
|
|
|
92
97
|
publish('unavailable', [], code); return fail(code); }
|
|
93
98
|
function serial(run) {
|
|
94
99
|
const pending = (queues.get(root) ?? Promise.resolve()).then(async () => { try {
|
|
100
|
+
operationScopes.clear();
|
|
95
101
|
return await run();
|
|
96
102
|
}
|
|
97
103
|
catch (e) {
|
|
@@ -224,36 +230,74 @@ export function createConversationDetails(options) {
|
|
|
224
230
|
return Object.keys(raw).sort().join(',') === 'detail,digest,hostBindingRef,scopeDigest,version' && text(raw.hostBindingRef) && raw.scopeDigest === digest(canonical(['host', raw.hostBindingRef, raw.detail]));
|
|
225
231
|
return raw.version === 2 && Object.keys(raw).sort().join(',') === 'detail,digest,localAcceptanceId,scopeDigest,version' && text(raw.localAcceptanceId) && raw.scopeDigest === digest(canonical([raw.localAcceptanceId, raw.detail]));
|
|
226
232
|
}
|
|
233
|
+
function metadata(st) {
|
|
234
|
+
if (!st.isFile() || st.isSymbolicLink() || st.uid !== BigInt(process.getuid()) || st.nlink !== 1n || (st.mode & 511n) !== 384n)
|
|
235
|
+
throw Error('DETAIL_RECORD_INVALID');
|
|
236
|
+
return [st.dev, st.ino, st.size, st.mtimeNs, st.ctimeNs, st.mode, st.uid, st.gid, st.nlink].join(':');
|
|
237
|
+
}
|
|
238
|
+
function recordScope(d, identity, before) {
|
|
239
|
+
const host = hostRefs.get(d), local = localRefs.get(d), ref = host ?? local;
|
|
240
|
+
if (!ref)
|
|
241
|
+
throw Error('DETAIL_CONTEXT_REQUIRED');
|
|
242
|
+
const id = canonical([identity, host ? 'host' : 'local', ref, d.sessionId, d.provider, d.instanceId, d.epoch]), cached = operationScopes.get(id);
|
|
243
|
+
if (cached)
|
|
244
|
+
return cached;
|
|
245
|
+
const admission = host ? options.hostAcceptance : options.localAcceptance;
|
|
246
|
+
if (!admission)
|
|
247
|
+
throw Error('DETAIL_CONTEXT_REQUIRED');
|
|
248
|
+
return checked(admission.readScope(d.sessionId, d.provider, ref, d, identity), before).then(r => { operationScopes.set(id, r); return r; });
|
|
249
|
+
}
|
|
227
250
|
async function rows(domain, before) {
|
|
228
|
-
const items = [], ids = new Set(), sequences = new Set();
|
|
229
|
-
|
|
251
|
+
const items = [], ids = new Set(), sequences = new Set(), previous = indexed.get(domain), next = new Map();
|
|
252
|
+
const names = await checked(readdir(domain), before);
|
|
253
|
+
for (const name of names)
|
|
230
254
|
if (!/^[a-f0-9]{64}\.json$/.test(name))
|
|
231
255
|
throw Error('DETAIL_RECORD_INVALID');
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
if (!
|
|
241
|
-
throw
|
|
256
|
+
// Batch independent metadata reads under one post-await admission check. Never
|
|
257
|
+
// treat an unchanged directory mtime as evidence that file contents are intact.
|
|
258
|
+
const fingerprints = await checked(Promise.all(names.map(async (name) => metadata(await lstat(join(domain, name), { bigint: true })))), before);
|
|
259
|
+
for (let n = 0; n < names.length; n++) {
|
|
260
|
+
const name = names[n], fingerprint = fingerprints[n];
|
|
261
|
+
let entry = previous?.get(name);
|
|
262
|
+
if (!entry || entry.fingerprint !== fingerprint) {
|
|
263
|
+
const raw = JSON.parse(await privateRead(join(domain, name), before));
|
|
264
|
+
if (!validStored(raw) || name !== digest(raw.detail.eventId) + '.json' || metadata(await checked(lstat(join(domain, name), { bigint: true }), before)) !== fingerprint)
|
|
265
|
+
throw Error('DETAIL_RECORD_INVALID');
|
|
266
|
+
const d = header(raw.detail);
|
|
267
|
+
if (raw.version === 2)
|
|
268
|
+
localRefs.set(d, raw.localAcceptanceId);
|
|
269
|
+
if (raw.version === 3)
|
|
270
|
+
hostRefs.set(d, raw.hostBindingRef);
|
|
271
|
+
entry = { fingerprint, row: d, digest: raw.digest };
|
|
272
|
+
storedDigests.set(d, raw.digest);
|
|
242
273
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
const
|
|
274
|
+
const d = entry.row;
|
|
275
|
+
if (ids.has(d.eventId) || sequences.has(canonical([d.sessionId, d.provider, d.sequence])))
|
|
276
|
+
throw Error('DETAIL_RECORD_INVALID');
|
|
277
|
+
if (localRefs.has(d) || hostRefs.has(d)) {
|
|
278
|
+
const proof = recordScope(d, basename(domain), before), r = proof instanceof Promise ? await proof : proof;
|
|
248
279
|
if (!r.ok && r.error.code !== 'REMOTE_DETAIL_SCOPE_INVALID')
|
|
249
280
|
throw new NeedError(r.error);
|
|
250
281
|
}
|
|
251
282
|
ids.add(d.eventId);
|
|
252
283
|
sequences.add(canonical([d.sessionId, d.provider, d.sequence]));
|
|
253
284
|
items.push(d);
|
|
285
|
+
next.set(name, entry);
|
|
254
286
|
}
|
|
287
|
+
indexed.set(domain, next);
|
|
255
288
|
return items;
|
|
256
289
|
}
|
|
290
|
+
async function loadDetail(domain, row, before) {
|
|
291
|
+
const raw = JSON.parse(await privateRead(join(domain, digest(row.eventId) + '.json'), before));
|
|
292
|
+
if (!validStored(raw) || canonical(header(raw.detail)) !== canonical(row) || raw.digest !== storedDigests.get(row) || (raw.localAcceptanceId ?? undefined) !== localRefs.get(row) || (raw.hostBindingRef ?? undefined) !== hostRefs.get(row))
|
|
293
|
+
throw Error('DETAIL_RECORD_INVALID');
|
|
294
|
+
const d = raw.detail;
|
|
295
|
+
if (localRefs.has(row))
|
|
296
|
+
localRefs.set(d, localRefs.get(row));
|
|
297
|
+
if (hostRefs.has(row))
|
|
298
|
+
hostRefs.set(d, hostRefs.get(row));
|
|
299
|
+
return d;
|
|
300
|
+
}
|
|
257
301
|
async function scope(sessionId, provider, before) {
|
|
258
302
|
if (!text(sessionId) || !brand(provider))
|
|
259
303
|
throw new NeedError(need('REMOTE_DETAIL_SCOPE_INVALID'));
|
|
@@ -291,7 +335,7 @@ export function createConversationDetails(options) {
|
|
|
291
335
|
for (const d of selected) {
|
|
292
336
|
const hostRef = hostRefs.get(d);
|
|
293
337
|
if (hostRef) {
|
|
294
|
-
const
|
|
338
|
+
const proof = recordScope(d, identity, before), r = proof instanceof Promise ? await proof : proof;
|
|
295
339
|
if (r.ok && r.value.identity === identity) {
|
|
296
340
|
recordGuards.set(d, { guard: r.value.guard, cacheGuard: r.value.cacheGuard });
|
|
297
341
|
result.push(d);
|
|
@@ -302,7 +346,7 @@ export function createConversationDetails(options) {
|
|
|
302
346
|
}
|
|
303
347
|
const ref = localRefs.get(d);
|
|
304
348
|
if (ref) {
|
|
305
|
-
const
|
|
349
|
+
const proof = recordScope(d, identity, before), r = proof instanceof Promise ? await proof : proof;
|
|
306
350
|
if (r.ok && r.value.identity === identity) {
|
|
307
351
|
recordGuards.set(d, { guard: r.value.guard, cacheGuard: r.value.cacheGuard });
|
|
308
352
|
result.push(d);
|
|
@@ -315,6 +359,11 @@ export function createConversationDetails(options) {
|
|
|
315
359
|
}
|
|
316
360
|
return result;
|
|
317
361
|
}
|
|
362
|
+
function guardRecords(items) {
|
|
363
|
+
const guards = new Set(items.flatMap(d => { const proof = recordGuards.get(d); return proof ? [proof.guard] : []; }));
|
|
364
|
+
for (const guard of guards)
|
|
365
|
+
guard();
|
|
366
|
+
}
|
|
318
367
|
async function stateRows(items, identity, before) {
|
|
319
368
|
const publicationRevision = options.publicationRevision?.(), publicationCurrent = () => !options.publicationRevision || options.publicationRevision() === publicationRevision, publicationGuard = () => { if (!publicationCurrent())
|
|
320
369
|
throw new NeedError(need('REMOTE_DETAIL_SCOPE_INVALID')); };
|
|
@@ -340,11 +389,11 @@ export function createConversationDetails(options) {
|
|
|
340
389
|
sessions.push({ sessionId: d.sessionId, provider: d.provider, ...counts(accessible, options.knownKinds) });
|
|
341
390
|
}
|
|
342
391
|
check(before);
|
|
343
|
-
for (const guard of guards)
|
|
392
|
+
for (const guard of new Set(guards))
|
|
344
393
|
guard();
|
|
345
394
|
if (!publicationCurrent())
|
|
346
395
|
return;
|
|
347
|
-
snapshotGuards = [...cacheGuards, ...(options.cacheContext ? [() => options.cacheContext(identity)] : []), ...(options.publicationRevision ? [publicationGuard] : [])];
|
|
396
|
+
snapshotGuards = [...new Set(cacheGuards), ...(options.cacheContext ? [() => options.cacheContext(identity)] : []), ...(options.publicationRevision ? [publicationGuard] : [])];
|
|
348
397
|
publish('ready', sessions, excluded ? 'REMOTE_DETAIL_SCOPE_INVALID' : undefined);
|
|
349
398
|
}
|
|
350
399
|
function cursor(value, secret) { const payload = Buffer.from(canonical(value)).toString('base64url'); return payload + '.' + createHmac('sha256', secret).update(payload).digest('hex'); }
|
|
@@ -390,7 +439,7 @@ export function createConversationDetails(options) {
|
|
|
390
439
|
if (!Number.isSafeInteger(options.maxEventBytes) || options.maxEventBytes < 1)
|
|
391
440
|
return fail('SETTINGS_REQUIRED');
|
|
392
441
|
const identity = proof?.identity ?? await scope(detail.sessionId, detail.provider, before), domain = (await prepare(identity, before, true)), items = await rows(domain, before), existing = items.find(d => d.eventId === detail.eventId);
|
|
393
|
-
if (existing && (
|
|
442
|
+
if (existing && (storedDigests.get(existing) !== digest(canonical(detail)) || localRefs.get(existing) !== localId || hostRefs.get(existing) !== proof?.hostBindingRef))
|
|
394
443
|
return fail('REMOTE_DETAIL_CONFLICT');
|
|
395
444
|
if (!existing && Buffer.byteLength(JSON.stringify(detail), 'utf8') > options.maxEventBytes)
|
|
396
445
|
return fail('REMOTE_DETAIL_TOO_LARGE');
|
|
@@ -411,15 +460,11 @@ export function createConversationDetails(options) {
|
|
|
411
460
|
items.push(detail);
|
|
412
461
|
}
|
|
413
462
|
else {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
finally {
|
|
420
|
-
await h.close();
|
|
421
|
-
}
|
|
422
|
-
await syncDir(domain, before);
|
|
463
|
+
if (localId)
|
|
464
|
+
localRefs.set(detail, localId);
|
|
465
|
+
if (proof?.hostBindingRef)
|
|
466
|
+
hostRefs.set(detail, proof.hostBindingRef);
|
|
467
|
+
await verifyReceipt(domain, detail, before);
|
|
423
468
|
}
|
|
424
469
|
await stateRows(items, identity, before);
|
|
425
470
|
if (!proof && await scope(detail.sessionId, detail.provider, before) !== identity)
|
|
@@ -463,7 +508,8 @@ export function createConversationDetails(options) {
|
|
|
463
508
|
const before = start();
|
|
464
509
|
if (!q || !text(q.eventId) || Object.keys(q).sort().join(',') !== 'eventId,provider,sessionId')
|
|
465
510
|
return fail('REMOTE_DETAIL_INVALID');
|
|
466
|
-
const identity = await readScope(q.sessionId, q.provider, before), domain = await prepare(identity, before), items = domain ? await rows(domain, before) : [],
|
|
511
|
+
const identity = await readScope(q.sessionId, q.provider, before), domain = await prepare(identity, before), items = domain ? await rows(domain, before) : [], row = items.find(r => r.eventId === q.eventId);
|
|
512
|
+
const d = row ? await loadDetail(domain, row, before) : undefined;
|
|
467
513
|
if (d && (d.sessionId !== q.sessionId || d.provider !== q.provider || !(await authorized([d], identity, q.sessionId, q.provider, before)).length))
|
|
468
514
|
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
469
515
|
if (d)
|
|
@@ -474,6 +520,8 @@ export function createConversationDetails(options) {
|
|
|
474
520
|
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
475
521
|
if (d)
|
|
476
522
|
uncertain = false;
|
|
523
|
+
if (d)
|
|
524
|
+
guardRecords([d]);
|
|
477
525
|
finalReadGuard?.();
|
|
478
526
|
check(before);
|
|
479
527
|
return ok(d ? { eventId: q.eventId, recorded: true, detail: structuredClone(d) } : { eventId: q.eventId, recorded: false });
|
|
@@ -517,7 +565,11 @@ export function createConversationDetails(options) {
|
|
|
517
565
|
await stateRows(items, identity, before);
|
|
518
566
|
if (await readScope(q.sessionId, q.provider, before) !== identity)
|
|
519
567
|
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
520
|
-
const
|
|
568
|
+
const bodies = await Promise.all(page.map(d => loadDetail(domain, d, before)));
|
|
569
|
+
if (await readScope(q.sessionId, q.provider, before) !== identity)
|
|
570
|
+
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
571
|
+
const value = { items: structuredClone(bodies), ...counts(bounded, options.knownKinds), ...(page.length < remaining.length ? { nextCursor: cursor({ version: 1, identity, sessionId: q.sessionId, provider: q.provider, upper, after: page.at(-1).sequence, authorization: digest(canonical(bounded.map(d => [d.eventId, reference(d)]))) }, secret) } : {}) };
|
|
572
|
+
guardRecords(bounded);
|
|
521
573
|
finalReadGuard?.();
|
|
522
574
|
check(before);
|
|
523
575
|
return ok(value);
|
|
@@ -528,11 +580,12 @@ export function createConversationDetails(options) {
|
|
|
528
580
|
};
|
|
529
581
|
return { ...api, observeConnection(c) { if (disposed)
|
|
530
582
|
return; if (c.phase !== 'connected') {
|
|
583
|
+
indexed.clear();
|
|
531
584
|
publish(c.phase === 'disposed' ? 'disposed' : 'unavailable', [], c.phase === 'disposed' ? 'DISPOSED' : 'CONNECTION_LOST');
|
|
532
585
|
return;
|
|
533
586
|
} if (uncertain) {
|
|
534
587
|
publish('failed', [], 'REMOTE_DETAIL_STORAGE_FAILED');
|
|
535
588
|
return;
|
|
536
589
|
} publish('loading'); void serial(async () => { const before = start(), context = await checked(options.context(), before); if (!context.ok)
|
|
537
|
-
throw new NeedError(context.error); const identity = context.value.identity, domain = await prepare(identity, before); await stateRows(domain ? await rows(domain, before) : [], identity, before); return ok(undefined); }); }, async dispose() { disposed = true; await tail; publish('disposed', [], 'DISPOSED'); listeners.clear(); } };
|
|
590
|
+
throw new NeedError(context.error); const identity = context.value.identity, domain = await prepare(identity, before); await stateRows(domain ? await rows(domain, before) : [], identity, before); return ok(undefined); }); }, async dispose() { disposed = true; indexed.clear(); await tail; publish('disposed', [], 'DISPOSED'); listeners.clear(); } };
|
|
538
591
|
}
|
|
@@ -53,7 +53,7 @@ export declare function createHostSessionProjects(o: Options): {
|
|
|
53
53
|
observeLocations: (state: WorkspaceLocationState) => void;
|
|
54
54
|
observeSessionDisposed: (session: Session) => void;
|
|
55
55
|
resolve: (id: string, use: WorkspaceUse, input: HostWorkspaceResolveContext) => Promise<Result<HostSessionProjectTarget>>;
|
|
56
|
-
readScope: (sessionId: string, provider: Provider, ref?: string, detail?: RemoteConversationDetail, expectedIdentity?: string) => Promise<Result<{
|
|
56
|
+
readScope: (sessionId: string, provider: Provider, ref?: string, detail?: Pick<RemoteConversationDetail, "sessionId" | "provider" | "instanceId" | "epoch">, expectedIdentity?: string) => Promise<Result<{
|
|
57
57
|
identity: string;
|
|
58
58
|
guard: () => void;
|
|
59
59
|
cacheGuard: () => void;
|
|
@@ -59,7 +59,7 @@ export declare function createLocalUserTurnAcceptance(o: Options): {
|
|
|
59
59
|
observe: (session: Session, event: SessionEvent) => void;
|
|
60
60
|
observeLocations: (state: WorkspaceLocationState) => void;
|
|
61
61
|
observeSessionDisposed: (session: Session) => void;
|
|
62
|
-
readScope: (sessionId: string, provider: Provider, acceptanceId?: string, detail?: RemoteConversationDetail, expectedIdentity?: string) => Promise<Result<{
|
|
62
|
+
readScope: (sessionId: string, provider: Provider, acceptanceId?: string, detail?: Pick<RemoteConversationDetail, "sessionId" | "provider" | "instanceId" | "epoch">, expectedIdentity?: string) => Promise<Result<{
|
|
63
63
|
identity: string;
|
|
64
64
|
guard: () => void;
|
|
65
65
|
cacheGuard: () => void;
|