@suifei/dsh-ai-team 0.4.37 → 0.4.38
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 +9 -0
- package/index.js +1 -1
- package/lib/host/service.js +10 -5
- package/lib/runtime/skill-loader.js +18 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.38 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**中危批次 8:技能根、决策串行化、失败升级去重**
|
|
6
|
+
|
|
7
|
+
- **成员技能不再静默缺席**:`loadSkillContext` 只在一个根下找 `skills/`,而调用方传的是**项目账本目录**,它下面永远没有 `skills/`。现在支持多根:工作区 `.dsh/skills`、用户 `~/.dsh/skills`、插件数据目录依次查找。
|
|
8
|
+
- **决策命令串行化**:`decision.request` / `decision.answer` 与 task 命令一样纳入 `runExclusive`——`answerDecision` 之前仍在锁外「读 headSeq → 分配 seq → append」,并发时同 seq 会被 fold 去重静默丢弃,双方都返回成功。
|
|
9
|
+
- **失败升级不再被自己的决策吞掉**:升级项的去重键用的是 `ref.memberId`,而 `requestDecision` 里同名字段的语义是「申请人」——成员只要有一条自己提的未决决策,ta 的致命失败就再也不会生成升级项。现在升级项带 `ref.kind = 'member_failure'` + `ref.failedMemberId`,按自己的字段去重(旧数据也做了兼容判定)。
|
|
10
|
+
- 测试:`node --test` **235/235**(新增 2 例)。
|
|
11
|
+
|
|
3
12
|
## 0.4.37 - 2026-11-12
|
|
4
13
|
|
|
5
14
|
**中危批次 7:评审卡收口、job 终态、幽灵成员、重试预算**
|
package/index.js
CHANGED
|
@@ -1521,7 +1521,7 @@ export function apply(ctx, config = {}) {
|
|
|
1521
1521
|
const result = await runtime.activate(activationMember, {
|
|
1522
1522
|
prompt: `${memberIdentity(activationMember)}\n\n${typeof body.payload?.prompt === 'string'
|
|
1523
1523
|
? body.payload.prompt
|
|
1524
|
-
: '你被加入 AI Team。先读取项目简报与收件箱,再处理分配给你的任务。'}${await formatSkillCatalog(skillsService, { cwd: effectiveDir })}${await loadSkillContext(activationMember, projectRuntime.dir)}`,
|
|
1524
|
+
: '你被加入 AI Team。先读取项目简报与收件箱,再处理分配给你的任务。'}${await formatSkillCatalog(skillsService, { cwd: effectiveDir })}${await loadSkillContext(activationMember, [join(effectiveDir, '.dsh'), dshHome(), projectRuntime.dir])}`,
|
|
1525
1525
|
});
|
|
1526
1526
|
let bound;
|
|
1527
1527
|
try {
|
package/lib/host/service.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import pathDefault from 'node:path';
|
|
3
3
|
import { ERRORS, fail } from '../domain/errors.js';
|
|
4
4
|
import { findReportPath, parseDecisionQuestions } from './decision-report.js';
|
|
@@ -437,8 +437,8 @@ export class TeamService {
|
|
|
437
437
|
case 'task.follow': return await this.follow(command, payload);
|
|
438
438
|
case 'thread.post': return await this.postThread(command, payload);
|
|
439
439
|
case 'inbox.ack': return await this.ack(command, payload);
|
|
440
|
-
case 'decision.request': return await this.requestDecision(command, payload);
|
|
441
|
-
case 'decision.answer': return await this.answerDecision(command, payload);
|
|
440
|
+
case 'decision.request': return await this.runExclusive(() => this.requestDecision(command, payload));
|
|
441
|
+
case 'decision.answer': return await this.runExclusive(() => this.answerDecision(command, payload));
|
|
442
442
|
default: fail(ERRORS.INVALID_ARGUMENT, `unknown command: ${String(command.type)}`);
|
|
443
443
|
}
|
|
444
444
|
} catch (error) {
|
|
@@ -983,10 +983,15 @@ export class TeamService {
|
|
|
983
983
|
let inboxItem = null;
|
|
984
984
|
if (fatal) {
|
|
985
985
|
const humanId = this.humanId();
|
|
986
|
+
// 去重必须用自己的判别字段:`ref.memberId` 在 requestDecision 里表示
|
|
987
|
+
// 「申请人」,与这里「失败的成员」同名不同义——成员只要有一条自己提的
|
|
988
|
+
// 未决决策,ta 的致命失败就再也不会生成升级项。
|
|
986
989
|
const duplicate = humanId === null ? undefined : Object.values(this.state.inbox ?? {}).find((item) =>
|
|
987
990
|
item.memberId === humanId
|
|
988
991
|
&& item.requiresDecision === true
|
|
989
|
-
&& item.ref?.
|
|
992
|
+
&& (item.ref?.kind === 'member_failure'
|
|
993
|
+
? item.ref?.failedMemberId === memberId
|
|
994
|
+
: item.ref?.kind === undefined && item.ref?.memberId === memberId && item.ref?.category !== undefined)
|
|
990
995
|
&& !['resolved', 'dismissed', 'superseded'].includes(item.state));
|
|
991
996
|
if (humanId !== null && duplicate === undefined) {
|
|
992
997
|
const activeTask = Object.values(this.state.tasks ?? {}).find((task) =>
|
|
@@ -997,7 +1002,7 @@ export class TeamService {
|
|
|
997
1002
|
inboxItem = createInboxItem({
|
|
998
1003
|
memberId: humanId,
|
|
999
1004
|
type: 'decision_required',
|
|
1000
|
-
ref: { memberId, category: recorded.category, taskId },
|
|
1005
|
+
ref: { kind: 'member_failure', failedMemberId: memberId, memberId, category: recorded.category, taskId },
|
|
1001
1006
|
requiresDecision: true,
|
|
1002
1007
|
}, { at: this.now() });
|
|
1003
1008
|
await this.ledger.append({
|
|
@@ -9,19 +9,28 @@ const MAX_SKILL_CHARS = 1800;
|
|
|
9
9
|
export async function loadSkillContext(member, dataDir) {
|
|
10
10
|
const skills = Array.isArray(member?.skills) ? member.skills : [];
|
|
11
11
|
const chunks = [CORE_SKILL_TEXT.replace(/^---[\s\S]*?\n---\s*/, '').trim()];
|
|
12
|
-
|
|
12
|
+
// 可以传一个根,也可以传多个根(工作区 `.dsh/skills`、用户 `~/.dsh/skills`、插件数据目录)。
|
|
13
|
+
// 只认一个根时,成员声明的技能会静默缺席——调用方传的是项目账本目录,它下面
|
|
14
|
+
// 永远没有 `skills/`。
|
|
15
|
+
const roots = (Array.isArray(dataDir) ? dataDir : [dataDir])
|
|
16
|
+
.filter((root) => typeof root === 'string' && root !== '');
|
|
17
|
+
for (const raw of skills.slice(0, 4)) {
|
|
13
18
|
const name = basename(String(raw)).replace(/[^a-zA-Z0-9._-]/g, '');
|
|
14
19
|
if (name === '' || name === '.' || name === '..' || name.startsWith('.')) continue;
|
|
15
20
|
if (isSkillExcluded(name)) continue;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
for (const root of roots) {
|
|
22
|
+
let loaded = false;
|
|
23
|
+
for (const candidate of [join(root, 'skills', name, 'SKILL.md'), join(root, 'skills', `${name}.md`)]) {
|
|
24
|
+
try {
|
|
25
|
+
const text = await readFile(candidate, 'utf8');
|
|
26
|
+
chunks.push(`### ${name}\n${text.slice(0, MAX_SKILL_CHARS)}`);
|
|
27
|
+
loaded = true;
|
|
28
|
+
break;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (error?.code !== 'ENOENT') break;
|
|
31
|
+
}
|
|
24
32
|
}
|
|
33
|
+
if (loaded) break;
|
|
25
34
|
}
|
|
26
35
|
}
|
|
27
36
|
return chunks.length === 0 ? '' : `\n\n[技能资料]\n${chunks.join('\n\n')}`;
|
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.38",
|
|
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",
|