@suifei/dsh-ai-team 0.4.35 → 0.4.36
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 +11 -0
- package/lib/host/service.js +13 -1
- package/lib/ledger/fold.js +3 -2
- package/lib/runtime/skill-provider.js +5 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.36 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**中危批次 6:PMO tick 崩溃、重复决策、接管不污染验收资格、退役终态**
|
|
6
|
+
|
|
7
|
+
- **PMO tick 不再每轮抛 TypeError**:`autoAnswerDecisions` 在 Human 缺失时返回数字 `0`,调用方按数组迭代直接 TypeError,整个 tick 被打断且每轮重复。改为返回 `[]`。
|
|
8
|
+
- **重复决策被拒**:`answerDecision` 没有终态前置,对已 `resolved`/`dismissed`/`superseded` 的决策项再次提交会被接受,重复写 Thread 回复、ack 回来的还是旧答案。
|
|
9
|
+
- **接管不再污染验收资格**(INV-07):`task/taken-over` 把继任者写进 `claimHistory`,而 `isReviewCandidate` 会排除 `claimHistory` 里的人——继任者因此永久没有资格验收自己名下的卡。接管事实改由既有的 `takeoverHistory` 记录。
|
|
10
|
+
- **退役是终态**:`member.fail` 与迟到的 `recordMemberFailure` 都不再接受退役成员(此前 retired 会被改写成 failed,随后 `member.bind` 能把成员复活)。
|
|
11
|
+
- **删除死代码**:`installFileSkillProvider` 按「`registerProvider` 可能返回 invalidate」处理,而 SDK 契约只返回 disposer——该分支永远不可达,已按契约收敛。
|
|
12
|
+
- 测试:`node --test` **231/231**(新增 3 例;另按 INV-07 更新 1 处既有断言)。
|
|
13
|
+
|
|
3
14
|
## 0.4.35 - 2026-11-12
|
|
4
15
|
|
|
5
16
|
**中危批次 5:命名空间、poison 恢复、多数决、并发认领**
|
package/lib/host/service.js
CHANGED
|
@@ -710,6 +710,8 @@ export class TeamService {
|
|
|
710
710
|
if (command.actor.kind !== 'human') fail(ERRORS.UNAUTHORIZED, 'only Human may mark a member failed');
|
|
711
711
|
const member = this.state.members?.[payload.memberId];
|
|
712
712
|
if (member === undefined) fail(ERRORS.NOT_FOUND, `member ${String(payload.memberId)} not found`);
|
|
713
|
+
// 退役是终态:把 retired 改成 failed 会让 member.bind 之后把 ta 复活。
|
|
714
|
+
if (member.status === 'retired') fail(ERRORS.INVALID_STATE, `member ${member.id} is retired`);
|
|
713
715
|
await this.append(command, 'member/failed', { memberId: member.id, reason: payload.reason ?? '' });
|
|
714
716
|
return { member: { ...member, status: 'failed', failure: payload.reason ?? '' } };
|
|
715
717
|
}
|
|
@@ -939,6 +941,9 @@ export class TeamService {
|
|
|
939
941
|
async recordMemberFailure(memberId, failure, projectId = Object.keys(this.state.projects ?? {})[0]) {
|
|
940
942
|
const member = this.state.members?.[memberId];
|
|
941
943
|
if (member === undefined) fail(ERRORS.NOT_FOUND, `member ${String(memberId)} not found`);
|
|
944
|
+
// 退役成员不该被迟到的 LLM 失败改成 failed(fold 对这条事件没有 retired 守卫,
|
|
945
|
+
// 之后 member.bind 就能把 ta 复活)。直接忽略,不写事件。
|
|
946
|
+
if (member.status === 'retired') return null;
|
|
942
947
|
const attempt = Number.isSafeInteger(failure.attempt) ? failure.attempt : (member.lastFailure?.attempt ?? 0) + 1;
|
|
943
948
|
const fatal = failure.category === 'auth' || failure.category === 'billing' || failure.category === 'policy' || failure.category === 'unknown';
|
|
944
949
|
// Tool-argument and provider dumps can run to kilobytes; the ledger and
|
|
@@ -1270,7 +1275,9 @@ export class TeamService {
|
|
|
1270
1275
|
/** PMO: answer all pending structured questions with the max-value policy. */
|
|
1271
1276
|
async autoAnswerDecisions(projectId = Object.keys(this.state.projects ?? {})[0]) {
|
|
1272
1277
|
const humanId = this.humanId();
|
|
1273
|
-
|
|
1278
|
+
// 合同是「返回回答列表」:这里曾返回数字 0,调用方按数组迭代时抛 TypeError,
|
|
1279
|
+
// 整个 PMO tick 被打断且每个 tick 都重复失败。
|
|
1280
|
+
if (humanId === null || humanId === undefined) return [];
|
|
1274
1281
|
const items = Object.values(this.state.inbox ?? {}).filter((item) =>
|
|
1275
1282
|
item.memberId === humanId
|
|
1276
1283
|
&& item.type === 'decision_required'
|
|
@@ -1393,6 +1400,11 @@ export class TeamService {
|
|
|
1393
1400
|
}
|
|
1394
1401
|
const humanId = command.actor.memberId;
|
|
1395
1402
|
if (item.memberId !== humanId) fail(ERRORS.UNAUTHORIZED, 'decision belongs to another member');
|
|
1403
|
+
// 终态前置:已 resolved/dismissed/superseded 的决策项再次提交过去会被接受,
|
|
1404
|
+
// 于是同一决策重复写 Thread 回复,ack 回来的 item 还是旧答案。
|
|
1405
|
+
if (['resolved', 'dismissed', 'superseded'].includes(item.state)) {
|
|
1406
|
+
fail(ERRORS.INVALID_STATE, `decision ${String(item.id)} is already ${String(item.state)}`);
|
|
1407
|
+
}
|
|
1396
1408
|
const answers = (Array.isArray(payload.answers) ? payload.answers : [])
|
|
1397
1409
|
.map((answer, index) => ({
|
|
1398
1410
|
id: typeof answer?.id === 'string' && answer.id !== '' ? answer.id : `q${index + 1}`,
|
package/lib/ledger/fold.js
CHANGED
|
@@ -452,14 +452,15 @@ function applyTaskEvent(state, event, payload) {
|
|
|
452
452
|
case 'task/taken-over': {
|
|
453
453
|
const to = textOr(payload.toMemberId, null);
|
|
454
454
|
if (to === null) return advance(state, event);
|
|
455
|
-
|
|
455
|
+
// INV-07:只有 claim 能进 claimHistory。接管曾把继任者写进去,而
|
|
456
|
+
// isReviewCandidate 会排除所有在 claimHistory 里的人——继任者因此永久
|
|
457
|
+
// 没有资格验收自己名下的这张卡。接管事实由 takeoverHistory 记录。
|
|
456
458
|
const takeoverHistory = Array.isArray(task.takeoverHistory) ? task.takeoverHistory : [];
|
|
457
459
|
return patch({
|
|
458
460
|
...task,
|
|
459
461
|
accountableOwnerId: to,
|
|
460
462
|
ownerId: to,
|
|
461
463
|
assigneeId: to,
|
|
462
|
-
claimHistory: history.includes(to) ? history : [...history, to],
|
|
463
464
|
takeoverHistory: [...takeoverHistory, {
|
|
464
465
|
from: textOr(payload.fromMemberId, task.assigneeId ?? task.ownerId ?? null),
|
|
465
466
|
to,
|
|
@@ -194,17 +194,12 @@ export function createFileSkillProvider({ dshHome, projectCwd, bundledDir } = {}
|
|
|
194
194
|
export function installFileSkillProvider(skills, options) {
|
|
195
195
|
if (!skills || typeof skills.registerProvider !== 'function') return () => {};
|
|
196
196
|
const provider = createFileSkillProvider(options);
|
|
197
|
+
// SDK 契约(dsh-skill.md):`registerProvider` 同步注册、**返回 disposer**,
|
|
198
|
+
// 没有 invalidate 这一档。旧实现按「可能返回 { dispose, invalidate }」处理,
|
|
199
|
+
// invalidate 分支永远不可达,属于死代码——这里只保留真实的两种返回形态。
|
|
197
200
|
const control = skills.registerProvider(() => provider);
|
|
198
|
-
|
|
199
|
-
// control:直接把它当函数调用会在 teardown 里抛错(provider 泄漏),且从不
|
|
200
|
-
// invalidate 会让技能目录一直停在注册时的快照。
|
|
201
|
-
if (typeof control === 'function') {
|
|
202
|
-
return () => {
|
|
203
|
-
try { control(); } catch { /* already disposed */ }
|
|
204
|
-
};
|
|
205
|
-
}
|
|
201
|
+
const dispose = typeof control === 'function' ? control : control?.dispose;
|
|
206
202
|
return () => {
|
|
207
|
-
try {
|
|
208
|
-
try { control?.dispose?.(); } catch { /* already disposed */ }
|
|
203
|
+
try { dispose?.(); } catch { /* already disposed */ }
|
|
209
204
|
};
|
|
210
205
|
}
|
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.36",
|
|
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",
|