@suifei/dsh-ai-team 0.4.108 → 0.4.110
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 +25 -0
- package/index.js +11 -4
- package/lib/diaglog.js +2 -0
- package/lib/runtime/deferral-guard.js +2 -1
- package/lib/runtime/stop-guard.js +39 -0
- package/lib/vendor/skillopt/skillopt_sleep/harvest_dsh.py +9 -0
- package/package.json +1 -1
- package/skills/skillopt-sleep/SKILL.md +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.110 - 2026-11-16
|
|
4
|
+
|
|
5
|
+
**SkillOpt 一次性子代理只凭题面作答,不在真实工作区动手**
|
|
6
|
+
|
|
7
|
+
- il2c night 8 实机:handoff 作答子代理继承 PMO 宿主的 `danger-full-access`,工作目录就是 il2c 工作区;
|
|
8
|
+
回放题里它真的去读仓库与账本「取证」后作答。这次挖出的任务恰好都是只读对账,若挖出「修复 csvstat 门禁」
|
|
9
|
+
这类任务,回放就会真改代码、写账本;
|
|
10
|
+
- 宿主没有可编程的只读预设(默认只有 `workspace-write`+ask 与 `danger-full-access`),在工具层拦:新增
|
|
11
|
+
`registerOneShotToolGuard`(`tools.guard`),`skillopt-*` 一次性子代理(作答、判官、生成)的任何工具调用一律
|
|
12
|
+
拒绝,理由回给模型「只凭题面文字回答」;拦截行 `skillopt.oneshot.tool.blocked` 在发布默认 `errors` 级别可见;
|
|
13
|
+
- 作答子代理的工作目录改为工作区之外的空目录(系统临时目录下 `dsh-ai-team-skillopt-answer`),项目 AGENTS.md
|
|
14
|
+
与仓库不进作答上下文;
|
|
15
|
+
- 测试:`test/stop-guard.test.js` 新增 1 例;
|
|
16
|
+
|
|
17
|
+
## 0.4.109 - 2026-11-16
|
|
18
|
+
|
|
19
|
+
**dsh 来源不再采 SkillOpt 自己的子代理会话**
|
|
20
|
+
|
|
21
|
+
- handoff 作答、判官、生成子代理都在项目工作区里运行,`dsh` 来源按 `cwd` 认项目,会把它们当成团队会话:
|
|
22
|
+
题面以 `user` 消息投递,被挖成「回答 SkillOpt 题目」的任务。il2c 实机:一个 handoff 夜间后 17:00 起 39 个
|
|
23
|
+
新会话里 38 个是 `skillopt-*` 子代理,采集得到 33 个摘要;
|
|
24
|
+
- `harvest_dsh` 遇到 label 以 `skillopt-` 开头的 `subagent/descriptor` 即跳过该会话(团队派生的其它子代理照采)。
|
|
25
|
+
实机:17:00 起只剩团队宿主会话 1 个,72 小时窗口 10 个(与作答子代理出现前一致);
|
|
26
|
+
- 测试:`test/skillopt-dsh-source.test.js` 新增 1 例(去掉修复即失败);
|
|
27
|
+
|
|
3
28
|
## 0.4.108 - 2026-11-16
|
|
4
29
|
|
|
5
30
|
**handoff 作答题面原样转交**
|
package/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { planDispatch, planTaskNudges } from './lib/host/pmo.js';
|
|
12
12
|
import { pmoHasNews } from './lib/ledger/fold.js';
|
|
13
|
-
import { homedir } from 'node:os';
|
|
13
|
+
import { homedir, tmpdir } from 'node:os';
|
|
14
14
|
import { randomUUID } from 'node:crypto';
|
|
15
15
|
import { join, sep } from 'node:path';
|
|
16
16
|
import { fileURLToPath } from 'node:url';
|
|
@@ -58,7 +58,7 @@ import { describeTaskContext, describeWake, planWakes } from './lib/host/waker.j
|
|
|
58
58
|
import { describeCauseChain } from './lib/runtime/error-chain.js';
|
|
59
59
|
import { classifyWakeFailure, isMalformedTurnError } from './lib/runtime/wake-failure.js';
|
|
60
60
|
import { registerShellGuard } from './lib/runtime/shell-guard.js';
|
|
61
|
-
import { registerStopGuard } from './lib/runtime/stop-guard.js';
|
|
61
|
+
import { registerOneShotToolGuard, registerStopGuard } from './lib/runtime/stop-guard.js';
|
|
62
62
|
import { registerTeamDiscipline } from './lib/runtime/deferral-guard.js';
|
|
63
63
|
import { createActivationBudget } from './lib/runtime/activation-budget.js';
|
|
64
64
|
import { blocksActivation, probeProviderRegistration } from './lib/runtime/subagent-probe.js';
|
|
@@ -691,7 +691,7 @@ export function apply(ctx, config = {}) {
|
|
|
691
691
|
// il2c 2997 次唤醒里 pmo_dispatch 为 0)。进程内状态,重启即清空——重启时本就没有回合在跑。
|
|
692
692
|
const turnsInFlight = new Set();
|
|
693
693
|
// 团队推进纪律:系统提示词段 + 回合收尾时纠偏「把行动挂在钟点上」(il2c:「今夜 03:17 自然相裁决点」)。
|
|
694
|
-
let teamDiscipline = { observe: () => {}, exempt: () => {}, dispose: () => {} };
|
|
694
|
+
let teamDiscipline = { observe: () => {}, exempt: () => {}, isOneShot: () => false, dispose: () => {} };
|
|
695
695
|
try {
|
|
696
696
|
teamDiscipline = registerTeamDiscipline({
|
|
697
697
|
systemPrompt: serviceOf(ctx, 'systemPrompt'),
|
|
@@ -1160,10 +1160,14 @@ export function apply(ctx, config = {}) {
|
|
|
1160
1160
|
diag: (row) => diag.append(row),
|
|
1161
1161
|
startChild: async (label, request) => {
|
|
1162
1162
|
const parentInfo = await ensureParent(projectRuntime);
|
|
1163
|
+
// 作答在工作区之外的空目录里进行:项目 AGENTS.md / 仓库不进作答上下文,
|
|
1164
|
+
// 工具调用另由 registerOneShotToolGuard 一律拒绝。
|
|
1165
|
+
const answerCwd = join(tmpdir(), 'dsh-ai-team-skillopt-answer');
|
|
1166
|
+
mkdirSync(answerCwd, { recursive: true });
|
|
1163
1167
|
const activation = await serviceOf(ctx, 'subagents').startActivation(activationSpec({
|
|
1164
1168
|
provider: resolveSubagentProviderName(serviceOf(ctx, 'subagents'), config?.subagentProviderName),
|
|
1165
1169
|
label,
|
|
1166
|
-
request: { cwd:
|
|
1170
|
+
request: { cwd: answerCwd, prompt: [{ type: 'text', text: request.prompt }], parent: parentInfo?.agent },
|
|
1167
1171
|
delivery: 'parent',
|
|
1168
1172
|
signal: new AbortController().signal,
|
|
1169
1173
|
}));
|
|
@@ -1862,8 +1866,10 @@ export function apply(ctx, config = {}) {
|
|
|
1862
1866
|
// 停止即停:停止期间 PMO 与成员不得用宿主内置工具(send_message 等)互相唤醒或派生
|
|
1863
1867
|
// 子智能体——实机停止后 PMO 收到「成员被停」通知,又用 send_message 把成员续跑了 25 分钟。
|
|
1864
1868
|
let disposeStopGuard = () => {};
|
|
1869
|
+
let disposeOneShotToolGuard = () => {};
|
|
1865
1870
|
try {
|
|
1866
1871
|
disposeStopGuard = registerStopGuard({ tools: tools ?? serviceOf(ctx, 'tools'), projectOf: teamProjectOf, diag });
|
|
1872
|
+
disposeOneShotToolGuard = registerOneShotToolGuard({ tools: tools ?? serviceOf(ctx, 'tools'), isOneShot: (sessionId) => teamDiscipline.isOneShot?.(sessionId) === true, diag });
|
|
1867
1873
|
} catch (error) {
|
|
1868
1874
|
diag.append({ ev: 'stop.guard.fail', message: error?.message ?? String(error) });
|
|
1869
1875
|
}
|
|
@@ -2953,6 +2959,7 @@ export function apply(ctx, config = {}) {
|
|
|
2953
2959
|
try { removeDiagSink(); } catch { /* sink already replaced */ }
|
|
2954
2960
|
try { disposeShellGuard(); } catch { /* already disposed */ }
|
|
2955
2961
|
try { disposeStopGuard(); } catch { /* already disposed */ }
|
|
2962
|
+
try { disposeOneShotToolGuard(); } catch { /* already disposed */ }
|
|
2956
2963
|
try { teamDiscipline.dispose(); } catch { /* already disposed */ }
|
|
2957
2964
|
// 在途的 boot 也算本组合的资源:等它落定(落定时见 disposed 会自行关账本),
|
|
2958
2965
|
// 否则下一组合抢在关锁之前打开同一账本。
|
package/lib/diaglog.js
CHANGED
|
@@ -39,6 +39,8 @@ export function isErrorEvent(ev) {
|
|
|
39
39
|
|| ev === 'team.interrupt'
|
|
40
40
|
// 停止期间团队会话想唤醒/派生智能体被拦下:停止是否真的停住的直接证据。
|
|
41
41
|
|| ev === 'team.stopped.blocked'
|
|
42
|
+
// SkillOpt 一次性子代理想调工具被拦下:作答有没有在真实工作区里动手的直接证据。
|
|
43
|
+
|| ev === 'skillopt.oneshot.tool.blocked'
|
|
42
44
|
// 换新团队会话(Human):新旧 PMO 与每个成员的新旧会话。
|
|
43
45
|
|| ev === 'team.renewed'
|
|
44
46
|
// 重建后旧会话有没有从工作区摘掉:决定工作区列表是否随自愈累积死会话。
|
|
@@ -79,7 +79,7 @@ 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>, exempt: (sessionId: string) => void, dispose: () => void }}
|
|
82
|
+
* @returns {{ observe: (session: any, event: any) => void, stopping: (payload: any) => Promise<void>, exempt: (sessionId: string) => void, isOneShot: (sessionId: string) => boolean, dispose: () => void }}
|
|
83
83
|
*/
|
|
84
84
|
export function registerTeamDiscipline({ systemPrompt, on, teamProjectOf, diag, newId }) {
|
|
85
85
|
const disposers = [];
|
|
@@ -161,6 +161,7 @@ export function registerTeamDiscipline({ systemPrompt, on, teamProjectOf, diag,
|
|
|
161
161
|
exempt: (sessionId) => {
|
|
162
162
|
if (typeof sessionId === 'string' && sessionId !== '') oneShot.add(sessionId);
|
|
163
163
|
},
|
|
164
|
+
isOneShot: (sessionId) => typeof sessionId === 'string' && oneShot.has(sessionId),
|
|
164
165
|
dispose: () => {
|
|
165
166
|
for (const dispose of disposers.splice(0)) {
|
|
166
167
|
try { dispose?.(); } catch { /* already disposed */ }
|
|
@@ -31,6 +31,45 @@ export function stoppedTeamDenial(execution, projectOf) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* SkillOpt 一次性子代理(handoff 作答、判官、生成)只凭题面文字作答,不得调用任何工具。
|
|
36
|
+
*
|
|
37
|
+
* il2c night 8 实机:作答子代理继承 PMO 宿主的 danger-full-access,工作目录就是 il2c
|
|
38
|
+
* 工作区,回放题里它真的去读仓库与账本「取证」——题目若是「修复 csvstat 门禁」它就会真改
|
|
39
|
+
* 代码、写账本。宿主没有可编程的只读预设(默认只有 workspace-write+ask 与
|
|
40
|
+
* danger-full-access),所以在工具层拒绝。
|
|
41
|
+
*
|
|
42
|
+
* @param {object} execution 宿主 ToolExecution(name / agent.id)
|
|
43
|
+
* @param {(sessionId: string) => boolean} isOneShot
|
|
44
|
+
* @returns {string | null} 需要拒绝时返回理由
|
|
45
|
+
*/
|
|
46
|
+
export function oneShotToolDenial(execution, isOneShot) {
|
|
47
|
+
const sessionId = execution?.agent?.id;
|
|
48
|
+
if (typeof sessionId !== 'string' || sessionId === '' || isOneShot(sessionId) !== true) return null;
|
|
49
|
+
return `已阻止:这是 SkillOpt 的一次性作答,只凭题面文字回答,不得调用任何工具(${String(execution?.name ?? '')})。不要读写文件、不要执行命令,直接输出题目要求的答案。`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param {object} options
|
|
54
|
+
* @param {object} options.tools `ctx.tools`
|
|
55
|
+
* @param {(sessionId: string) => boolean} options.isOneShot
|
|
56
|
+
* @param {{ append?: (row: object) => void }} [options.diag]
|
|
57
|
+
* @returns {() => void} disposer
|
|
58
|
+
*/
|
|
59
|
+
export function registerOneShotToolGuard({ tools, isOneShot, diag }) {
|
|
60
|
+
if (tools === undefined || tools === null || typeof tools.guard !== 'function') return () => {};
|
|
61
|
+
return tools.guard((execution) => {
|
|
62
|
+
try {
|
|
63
|
+
const reason = oneShotToolDenial(execution, isOneShot);
|
|
64
|
+
if (reason === null) return undefined;
|
|
65
|
+
diag?.append?.({ ev: 'skillopt.oneshot.tool.blocked', sessionId: execution?.agent?.id ?? null, tool: String(execution?.name ?? '') });
|
|
66
|
+
return reason;
|
|
67
|
+
} catch {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
34
73
|
/**
|
|
35
74
|
* @param {object} options
|
|
36
75
|
* @param {object} options.tools `ctx.tools`
|
|
@@ -55,6 +55,8 @@ DECODER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "dsh_decode.m
|
|
|
55
55
|
# Host bookkeeping (``time-context``, ``runtime-context``, ``skill-catalog``,
|
|
56
56
|
# ``agent-instructions``, ``subagent-settled``, ``tool-jobs``, …) is not intent.
|
|
57
57
|
_INTENT_SOURCES = {"", "user", "agent-message", "ai-team"}
|
|
58
|
+
# Label prefix of the AI-team plugin's SkillOpt subagents (subagent/descriptor).
|
|
59
|
+
_ENGINE_LABEL_PREFIX = "skillopt-"
|
|
58
60
|
_RELAY_PREFIX = re.compile(r"^Agent \S+ sent a message:\s*")
|
|
59
61
|
# AI-team activation prompts start with the member's identity block
|
|
60
62
|
# (``memberIdentity`` in lib/domain/member-profile.js: "你是 <名>(<角色>)。"
|
|
@@ -178,6 +180,13 @@ def digest_dsh_session(path: str, *, node: str, project: str = "") -> Optional[S
|
|
|
178
180
|
ended = stamp
|
|
179
181
|
rtype = rec.get("type")
|
|
180
182
|
data = rec.get("data") if isinstance(rec.get("data"), dict) else {}
|
|
183
|
+
if rtype == "subagent/descriptor" and str(data.get("label") or "").startswith(_ENGINE_LABEL_PREFIX):
|
|
184
|
+
# The engine's own one-shot children (handoff answers, judges,
|
|
185
|
+
# generators) run in the project directory too; their prompt is
|
|
186
|
+
# a SkillOpt task, not the team's work. Mining them teaches the
|
|
187
|
+
# loop to answer SkillOpt prompts (il2c: 38 of 39 sessions in one
|
|
188
|
+
# handoff night).
|
|
189
|
+
return None
|
|
181
190
|
if rtype == "user/message":
|
|
182
191
|
source = data.get("source") if isinstance(data.get("source"), dict) else {}
|
|
183
192
|
kind = str(source.get("kind") or "")
|
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.110",
|
|
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",
|
|
@@ -75,6 +75,8 @@ With `backend=handoff` the engine stops with exit 3 whenever model calls need
|
|
|
75
75
|
answers (`<project>/.skillopt-sleep-handoff/pending.json`). The AI team answers
|
|
76
76
|
them automatically: on each PMO tick, one fresh one-shot reviewer subagent per
|
|
77
77
|
call writes `answers/<id>.md`, then the scheduled `run.ps1` is rerun to resume.
|
|
78
|
+
The answering subagent runs outside the workspace and every tool call it makes
|
|
79
|
+
is refused, so a replayed task is answered in text, never carried out for real.
|
|
78
80
|
Do not answer these prompts from a member session — its history contaminates the
|
|
79
81
|
held-out gate. Exit 3 in the task result means "waiting for answers", not failure.
|
|
80
82
|
|