@suifei/dsh-ai-team 0.4.105 → 0.4.106
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 +12 -0
- package/index.js +23 -5
- package/lib/runtime/deferral-guard.js +20 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.106 - 2026-11-16
|
|
4
|
+
|
|
5
|
+
**handoff 自动作答实机两处缺陷**
|
|
6
|
+
|
|
7
|
+
- **推进纪律误伤一次性子代理**:作答子代理是 PMO 宿主的子会话,0.4.101 的纪律段与纠偏按父会话认它为团队会话。
|
|
8
|
+
il2c 实机:题面引用会话原文「tonight or tomorrow」,纠偏插入后子代理转去调 `skillopt_status`,答案作废。
|
|
9
|
+
现在按 `subagent/descriptor` 的 label(`skillopt-*`:判官、生成、handoff 作答)排除,宿主启动时也直接登记;
|
|
10
|
+
- **已结束的子代理一直判「在跑」**:回合 16:39:59 已结束,`observeChild` 在 agents/sessions 里都查不到它,
|
|
11
|
+
兜底返回 running。作答改走评审子代理实测可用的 `activation.result`(`awaitActivationText`),文本按 childId
|
|
12
|
+
收在内存;插件重启丢失的按 15 分钟 TTL 重问;
|
|
13
|
+
- 测试:`test/team-discipline.test.js` 新增 1 例(去掉修复即失败);
|
|
14
|
+
|
|
3
15
|
## 0.4.105 - 2026-11-16
|
|
4
16
|
|
|
5
17
|
**夜间 SkillOpt 环(handoff 后端)由评审官自动作答,不再停在「有待回答」**
|
package/index.js
CHANGED
|
@@ -44,7 +44,8 @@ import { isJobExpired, listJobs, readJob, writeJob } from './lib/skillopt/jobs.j
|
|
|
44
44
|
|
|
45
45
|
/** 评审通道 job 的兜底 TTL:与子代理通道(jobs.js JOB_TTL_MS)保持一致。 */
|
|
46
46
|
const REVIEW_JOB_TTL_MS = 30 * 60 * 1000;
|
|
47
|
-
import {
|
|
47
|
+
import { reconcileJobs } from './lib/skillopt/job-runner.js';
|
|
48
|
+
import { awaitActivationText } from './lib/skillopt/subagent-text.js';
|
|
48
49
|
import { HANDOFF_DIR, stepHandoff } from './lib/skillopt/handoff-answerer.js';
|
|
49
50
|
import { execFile } from 'node:child_process';
|
|
50
51
|
import { collectReview, startReview } from './lib/skillopt/review-runner.js';
|
|
@@ -690,7 +691,7 @@ export function apply(ctx, config = {}) {
|
|
|
690
691
|
// il2c 2997 次唤醒里 pmo_dispatch 为 0)。进程内状态,重启即清空——重启时本就没有回合在跑。
|
|
691
692
|
const turnsInFlight = new Set();
|
|
692
693
|
// 团队推进纪律:系统提示词段 + 回合收尾时纠偏「把行动挂在钟点上」(il2c:「今夜 03:17 自然相裁决点」)。
|
|
693
|
-
let teamDiscipline = { observe: () => {}, dispose: () => {} };
|
|
694
|
+
let teamDiscipline = { observe: () => {}, exempt: () => {}, dispose: () => {} };
|
|
694
695
|
try {
|
|
695
696
|
teamDiscipline = registerTeamDiscipline({
|
|
696
697
|
systemPrompt: serviceOf(ctx, 'systemPrompt'),
|
|
@@ -1144,6 +1145,10 @@ export function apply(ctx, config = {}) {
|
|
|
1144
1145
|
// 一样不受 pmoAuto/停止门约束:夜间环是 Human 排的,与 PMO 派发无关。
|
|
1145
1146
|
// 不 await:重跑引擎可能耗时,不能拖住 tick;同一工作区同时只推进一步。
|
|
1146
1147
|
const handoffBusy = new Set();
|
|
1148
|
+
// 作答子代理的最终文本按 childId 收在内存里:activation.result 是评审子代理实测可用的
|
|
1149
|
+
// 取数路径;已结束的子代理在 agents/sessions 里查不到,observeChild 会一直报 running
|
|
1150
|
+
// (il2c 实机:16:39:59 回合已结束,15 分钟仍判在跑)。插件重启后内存丢失,按 TTL 重问。
|
|
1151
|
+
const handoffAnswers = new Map();
|
|
1147
1152
|
const answerHandoff = (projectRuntime) => {
|
|
1148
1153
|
const workspace = String(projectRuntime?.service?.state?.projects?.[projectRuntime.id]?.workspacePath ?? '').trim();
|
|
1149
1154
|
if (workspace === '' || handoffBusy.has(workspace) || !existsSync(join(workspace, HANDOFF_DIR, 'pending.json'))) return;
|
|
@@ -1155,16 +1160,29 @@ export function apply(ctx, config = {}) {
|
|
|
1155
1160
|
diag: (row) => diag.append(row),
|
|
1156
1161
|
startChild: async (label, request) => {
|
|
1157
1162
|
const parentInfo = await ensureParent(projectRuntime);
|
|
1158
|
-
const
|
|
1163
|
+
const activation = await serviceOf(ctx, 'subagents').startActivation(activationSpec({
|
|
1159
1164
|
provider: resolveSubagentProviderName(serviceOf(ctx, 'subagents'), config?.subagentProviderName),
|
|
1160
1165
|
label,
|
|
1161
1166
|
request: { cwd: request.cwd, prompt: [{ type: 'text', text: request.prompt }], parent: parentInfo?.agent },
|
|
1162
1167
|
delivery: 'parent',
|
|
1163
1168
|
signal: new AbortController().signal,
|
|
1164
1169
|
}));
|
|
1165
|
-
|
|
1170
|
+
const childId = activation.childId;
|
|
1171
|
+
teamDiscipline.exempt(childId);
|
|
1172
|
+
awaitActivationText(activation, { timeoutMs: 14 * 60 * 1000 })
|
|
1173
|
+
.catch(() => '')
|
|
1174
|
+
.then(async (text) => {
|
|
1175
|
+
handoffAnswers.set(childId, typeof text === 'string' ? text : '');
|
|
1176
|
+
try { await activation?.dispose?.(); } catch { /* already gone */ }
|
|
1177
|
+
});
|
|
1178
|
+
return { childId, outputStart: activation.outputStart ?? null };
|
|
1179
|
+
},
|
|
1180
|
+
observe: (childId) => {
|
|
1181
|
+
if (!handoffAnswers.has(childId)) return { status: 'running', events: [] };
|
|
1182
|
+
const text = handoffAnswers.get(childId);
|
|
1183
|
+
handoffAnswers.delete(childId);
|
|
1184
|
+
return { status: 'idle', events: [], text };
|
|
1166
1185
|
},
|
|
1167
|
-
observe: (childId, outputStart) => observeChild(ctx, childId, outputStart),
|
|
1168
1186
|
rerun: (runScript) => new Promise((resolve) => {
|
|
1169
1187
|
execFile('powershell.exe', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', runScript], { windowsHide: true, timeout: 30 * 60 * 1000 }, (error) => {
|
|
1170
1188
|
resolve({ exitCode: error ? (typeof error.code === 'number' ? error.code : null) : 0 });
|
|
@@ -79,15 +79,20 @@ export const TEAM_DISCIPLINE_TEXT = [
|
|
|
79
79
|
* diag?: { append?: (row: object) => void },
|
|
80
80
|
* newId: () => string,
|
|
81
81
|
* }} options
|
|
82
|
-
* @returns {{ observe: (session: any, event: any) => void, stopping: (payload: any) => Promise<void>, dispose: () => void }}
|
|
82
|
+
* @returns {{ observe: (session: any, event: any) => void, stopping: (payload: any) => Promise<void>, exempt: (sessionId: string) => void, dispose: () => void }}
|
|
83
83
|
*/
|
|
84
84
|
export function registerTeamDiscipline({ systemPrompt, on, teamProjectOf, diag, newId }) {
|
|
85
85
|
const disposers = [];
|
|
86
86
|
// 团队会话 = 自己在账本里(PMO 宿主 / 已绑定成员),或父会话在账本里。后者覆盖两种情况:
|
|
87
87
|
// 成员激活时的第一个回合(提示词组装早于账本记下 sessionId,r36 实测成员首窗缺纪律段),
|
|
88
88
|
// 以及 PMO / 成员派生的临时子智能体(il2c:PMO 派生的 moyuan-tail267 承担了整个波尾)。
|
|
89
|
+
// SkillOpt 的一次性子代理(判官、handoff 作答)不是团队会话:纪律段与纠偏会进入它们的
|
|
90
|
+
// 上下文,污染判分与留出验证门(il2c 实机:作答题里引用了会话原文「tonight or tomorrow」,
|
|
91
|
+
// 纠偏一插,子代理转去调 skillopt_status,答案作废)。按 subagent/descriptor 的 label
|
|
92
|
+
// 认出它们,宿主侧启动时也可直接登记(exempt)。
|
|
93
|
+
const oneShot = new Set();
|
|
89
94
|
const projectFor = (sessionId, parentId) => {
|
|
90
|
-
if (typeof sessionId !== 'string') return null;
|
|
95
|
+
if (typeof sessionId !== 'string' || oneShot.has(sessionId)) return null;
|
|
91
96
|
return teamProjectOf(sessionId) ?? (typeof parentId === 'string' && parentId !== '' ? teamProjectOf(parentId) : null);
|
|
92
97
|
};
|
|
93
98
|
const parentOf = (holder) => holder?.session?.header?.parentSession ?? holder?.header?.parentSession;
|
|
@@ -111,6 +116,10 @@ export function registerTeamDiscipline({ systemPrompt, on, teamProjectOf, diag,
|
|
|
111
116
|
const observe = (session, event) => {
|
|
112
117
|
const sessionId = session?.id;
|
|
113
118
|
if (typeof sessionId !== 'string') return;
|
|
119
|
+
if (event?.type === 'subagent/descriptor' && isOneShotLabel(event?.data?.label)) {
|
|
120
|
+
oneShot.add(sessionId);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
114
123
|
if (event?.type === 'turn/start') {
|
|
115
124
|
lastText.delete(sessionId);
|
|
116
125
|
return;
|
|
@@ -149,16 +158,25 @@ export function registerTeamDiscipline({ systemPrompt, on, teamProjectOf, diag,
|
|
|
149
158
|
return {
|
|
150
159
|
observe,
|
|
151
160
|
stopping,
|
|
161
|
+
exempt: (sessionId) => {
|
|
162
|
+
if (typeof sessionId === 'string' && sessionId !== '') oneShot.add(sessionId);
|
|
163
|
+
},
|
|
152
164
|
dispose: () => {
|
|
153
165
|
for (const dispose of disposers.splice(0)) {
|
|
154
166
|
try { dispose?.(); } catch { /* already disposed */ }
|
|
155
167
|
}
|
|
156
168
|
lastText.clear();
|
|
157
169
|
steered.clear();
|
|
170
|
+
oneShot.clear();
|
|
158
171
|
},
|
|
159
172
|
};
|
|
160
173
|
}
|
|
161
174
|
|
|
175
|
+
/** SkillOpt 一次性子代理的 label(判官 skillopt-judge-*、生成 skillopt-optimize-*、作答 skillopt-reviewer-handoff-*)。 */
|
|
176
|
+
export function isOneShotLabel(label) {
|
|
177
|
+
return typeof label === 'string' && label.startsWith('skillopt-');
|
|
178
|
+
}
|
|
179
|
+
|
|
162
180
|
/** 纠偏消息:同一回合最多一次,给出明确的「例外」出口,防止与真实钟点任务死磕。 */
|
|
163
181
|
export function deferralCorrection(phrase) {
|
|
164
182
|
return [
|
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.106",
|
|
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",
|