@suifei/dsh-ai-team 0.4.50 → 0.4.51
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/CHANGELOG.md +14 -0
- package/index.js +20 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.51 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**批 16:卸载闸门(teardown 不再被在途异步链穿透)**
|
|
6
|
+
|
|
7
|
+
插件卸载后仍在飞的异步链此前会继续写状态:
|
|
8
|
+
|
|
9
|
+
- `ensureParent()` 在卸载后才解析出的父代理:句柄留在进程里,且继续往每个项目账本写 `team/host-bound`;
|
|
10
|
+
- 激活在卸载后才完成:`activations.set(...)` 把句柄塞进**已经清空**的表里,再也没人 dispose 它;
|
|
11
|
+
- 归档修复的 2s×30 重试窗口在卸载后继续跑,且可能在清理之后重建 PMO 定时器。
|
|
12
|
+
|
|
13
|
+
现在统一用一个 `disposed` 闸门:teardown 第一步置位;父代理迟到的句柄立即 `dispose()` 并记 `host.created.after-dispose`;迟到的激活立即释放并返回 503(记 `member.activated.after-dispose`);重试循环与定时器创建都先看闸门。
|
|
14
|
+
|
|
15
|
+
- 测试:`node --test` **252 通过 / 1 跳过**(这部分是防御性改动,未新增用例——没有可观测的对外行为变化,已在报告里如实标注)。
|
|
16
|
+
|
|
3
17
|
## 0.4.50 - 2026-11-12
|
|
4
18
|
|
|
5
19
|
**首次使用必须先设定目录;新建项目必须指定目录**
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
2
|
* dsh-ai-team — Host half.
|
|
3
3
|
*
|
|
4
4
|
* M1: one default Project backed by the plugin-owned append-only ledger.
|
|
@@ -262,6 +262,9 @@ export function apply(ctx, config = {}) {
|
|
|
262
262
|
|
|
263
263
|
let booted = null;
|
|
264
264
|
let bootError = null;
|
|
265
|
+
// 卸载闸门:teardown 之后仍在飞的异步链(boot 续体、ensureParent、归档修复重试)
|
|
266
|
+
// 不能继续写状态,否则会把句柄塞进已清空的表里、或在清理之后重建定时器。
|
|
267
|
+
let disposed = false;
|
|
265
268
|
const projectRuntime = (projectId) => booted?.runtimes?.get(projectId) ?? null;
|
|
266
269
|
const runtimeForAgent = (sessionId) => {
|
|
267
270
|
if (sessionId === undefined || sessionId === null) return null;
|
|
@@ -371,11 +374,13 @@ export function apply(ctx, config = {}) {
|
|
|
371
374
|
// 再用一个短重试窗口(2s × 30)兜住就绪时间,不必等 60s 的 tick。
|
|
372
375
|
void (async () => {
|
|
373
376
|
for (let attempt = 0; attempt < 30; attempt += 1) {
|
|
377
|
+
if (disposed) return;
|
|
374
378
|
await repairArchivedHosts();
|
|
375
|
-
if (hostRepaired) return;
|
|
379
|
+
if (hostRepaired || disposed) return;
|
|
376
380
|
await new Promise((resolve) => { const timer = setTimeout(resolve, 2000); timer.unref?.(); });
|
|
377
381
|
}
|
|
378
382
|
})();
|
|
383
|
+
if (disposed) return;
|
|
379
384
|
if (pmoTimer === null) {
|
|
380
385
|
pmoTimer = setInterval(() => {
|
|
381
386
|
for (const runtime of booted?.runtimes?.values() ?? []) {
|
|
@@ -1492,6 +1497,12 @@ export function apply(ctx, config = {}) {
|
|
|
1492
1497
|
cwd: hostCwd(),
|
|
1493
1498
|
resumeSessionId: existingHost,
|
|
1494
1499
|
}).then(async (value) => {
|
|
1500
|
+
// 卸载后才完成的父代理:句柄不能留在进程里,也不能写账本。
|
|
1501
|
+
if (disposed) {
|
|
1502
|
+
try { await value.dispose?.(); } catch { /* already gone */ }
|
|
1503
|
+
diag.append({ ev: 'host.created.after-dispose', sessionId: value.sessionId ?? null });
|
|
1504
|
+
return value;
|
|
1505
|
+
}
|
|
1495
1506
|
// Host 会话必须落账:它决定冷恢复与 sendMessage 的 parent,也决定归档
|
|
1496
1507
|
// 修复 sweep 能不能看见根会话。除了「首次创建」,从 roots() 里选中
|
|
1497
1508
|
// 既有会话、以及父级发生变化(换成了另一条根会话)时同样要重绑——
|
|
@@ -1610,6 +1621,12 @@ export function apply(ctx, config = {}) {
|
|
|
1610
1621
|
try { await result.activation.dispose?.(); } catch { /* already gone */ }
|
|
1611
1622
|
throw error;
|
|
1612
1623
|
}
|
|
1624
|
+
// 卸载后才完成的激活:直接释放,不登记(否则句柄留在已清空的表里)。
|
|
1625
|
+
if (disposed) {
|
|
1626
|
+
try { await result.activation.dispose?.(); } catch { /* already gone */ }
|
|
1627
|
+
diag.append({ ev: 'member.activated.after-dispose', memberId: member.id, sessionId: result.childId });
|
|
1628
|
+
return { error: { code: 'E_RUNTIME', message: 'plugin is shutting down' }, status: 503 };
|
|
1629
|
+
}
|
|
1613
1630
|
activations.set(result.childId, result.activation);
|
|
1614
1631
|
await attachMemberWorkspace(projectRuntime, result.childId);
|
|
1615
1632
|
persistModelSelection(result.childId, activationMember.config, member.name);
|
|
@@ -2351,6 +2368,7 @@ export function apply(ctx, config = {}) {
|
|
|
2351
2368
|
// Teardown must fully settle before the loader activates the next
|
|
2352
2369
|
// composition: a racing parent-agent dispose left the previous
|
|
2353
2370
|
// session-controller graph half-disposed and broke plugin toggles.
|
|
2371
|
+
disposed = true;
|
|
2354
2372
|
const cleanup = [];
|
|
2355
2373
|
for (const client of sseClients) {
|
|
2356
2374
|
try { client.res.end(); } catch { /* socket already gone */ }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suifei/dsh-ai-team",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.51",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
|
|
6
6
|
"license": "MIT",
|