@zhuifengqug/dsh-ant 0.2.0 → 0.2.1
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/README.md +3 -3
- package/compatibility.json +6 -2
- package/lib/git-artifact-stamp.json +2 -2
- package/lib/harness-compat.js +32 -2
- package/lib/mailbox.js +3 -13
- package/lib/members.js +22 -8
- package/lib/quality-gates.js +3 -0
- package/lib/scheduler.js +57 -6
- package/lib/tools.js +6 -2
- package/lib/types/harness-compat.d.ts +8 -2
- package/package.json +2 -2
- package/release-notes/v0.2.1.md +35 -0
- package/scripts/doctor.mjs +4 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ DeepSeek Harness 的多智能体团队插件。一句话把当前会话变成队
|
|
|
6
6
|
|
|
7
7
|
## 与上游的关系
|
|
8
8
|
|
|
9
|
-
本仓库是 [NanmiCoder/dsh-agent-teams](https://github.com/NanmiCoder/dsh-agent-teams) 的分支(fork),基线为上游 [0.1.30](./release-notes/v0.1.30.md)(该版适配 Harness `0.2.2-rc.2`
|
|
9
|
+
本仓库是 [NanmiCoder/dsh-agent-teams](https://github.com/NanmiCoder/dsh-agent-teams) 的分支(fork),基线为上游 [0.1.30](./release-notes/v0.1.30.md)(该版适配 Harness `0.2.2-rc.2` 的子代理树契约),并增量吸收上游 `0.1.31` 里与本分支不冲突的五处修复(空 subject 拒收、status 去重、parked attempt 只通知一次、保留 attempt、长会话分批扫描);发版见 [0.2.1](./release-notes/v0.2.1.md)。上游的功能照单全收,本分支只叠加四件事,全部有测试兜底:
|
|
10
10
|
|
|
11
11
|
- **中文语言约束**:团队提示词与全部工具参数描述要求队名、成员名、任务标题与描述、计划摘要一律用当前对话语言书写,工具名、id、路径、代码标识符保留原文。
|
|
12
12
|
- **归档团队永久删除**:归档列表里可以真正删掉一个团队(先精确匹配 id,再绑定归属会话,两击确认),不再只能堆积。
|
|
@@ -20,7 +20,7 @@ DeepSeek Harness 的多智能体团队插件。一句话把当前会话变成队
|
|
|
20
20
|
从 npm 安装(桌面端「插件 → 添加插件」里填版本号即可):
|
|
21
21
|
|
|
22
22
|
```powershell
|
|
23
|
-
dsh plugin --profile desktop add @zhuifengqug/dsh-ant@0.2.
|
|
23
|
+
dsh plugin --profile desktop add @zhuifengqug/dsh-ant@0.2.1
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
本地开发目录安装(`link:` 指向本仓库):
|
|
@@ -70,7 +70,7 @@ npx pnpm run verify
|
|
|
70
70
|
|
|
71
71
|
## 兼容性
|
|
72
72
|
|
|
73
|
-
宿主最低版本由 [`compatibility.json`](./compatibility.json)
|
|
73
|
+
宿主最低版本由 [`compatibility.json`](./compatibility.json) 里最旧的兼容项派生,推荐宿主是 `0.2.2-rc.5`;`0.2.2-rc.2` / `0.2.2-rc.1` / `0.2.1-rc.3` 属 preview 通道,其中 rc.2 与 rc.1 的宿主矩阵证据见 [docs/harness-0.2.2-rc.2](./docs/harness-0.2.2-rc.2/README.md)。开发基线仍是 `0.2.1-rc.2`:子代理树的 `rootOf` / `prompt` / `startActivation` / `manager.resident` / `deliverToMember` 契约在 rc.5 上未变,rc.5 新增的 `session.snapshotEvents` 已用于 `findOwnSessionEvent` 的 256 条分批读取。
|
|
74
74
|
|
|
75
75
|
## 许可
|
|
76
76
|
|
package/compatibility.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"recommendedHost": "0.2.
|
|
3
|
+
"recommendedHost": "0.2.2-rc.5",
|
|
4
4
|
"previewTag": "next",
|
|
5
5
|
"supportedHosts": [
|
|
6
|
+
{
|
|
7
|
+
"version": "0.2.2-rc.5",
|
|
8
|
+
"track": "recommended"
|
|
9
|
+
},
|
|
6
10
|
{
|
|
7
11
|
"version": "0.2.2-rc.2",
|
|
8
12
|
"track": "preview"
|
|
@@ -17,7 +21,7 @@
|
|
|
17
21
|
},
|
|
18
22
|
{
|
|
19
23
|
"version": "0.2.1-rc.2",
|
|
20
|
-
"track": "
|
|
24
|
+
"track": "legacy"
|
|
21
25
|
},
|
|
22
26
|
{
|
|
23
27
|
"version": "0.2.1-rc.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"source": "
|
|
4
|
-
"output": "
|
|
3
|
+
"source": "6181462ccec155536269ae02a6c5fbb9d064971ad8ef0227c9e6398b8e25be61",
|
|
4
|
+
"output": "fce545598056d0f5a9532f6518600fa01bc3487e8168d25472d7b5ba4f527755"
|
|
5
5
|
}
|
package/lib/harness-compat.js
CHANGED
|
@@ -193,8 +193,7 @@ export function onAgentReady(ctx, listener) {
|
|
|
193
193
|
const stopLegacy = legacy.on('agent/session-start', ({ agent }) => listener(agent, false));
|
|
194
194
|
return () => { stopCreated(); stopLegacy(); };
|
|
195
195
|
}
|
|
196
|
-
|
|
197
|
-
export function sessionOwnEvents(session) {
|
|
196
|
+
function legacyOwnSessionEvents(session) {
|
|
198
197
|
const current = session;
|
|
199
198
|
if (typeof current.ownEvents === 'function')
|
|
200
199
|
return current.ownEvents.call(session);
|
|
@@ -203,6 +202,37 @@ export function sessionOwnEvents(session) {
|
|
|
203
202
|
return unsupported('missing ownEvents/legacy session log');
|
|
204
203
|
return legacy.events.slice(legacy.header.seedLength ?? 0);
|
|
205
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Search child-owned history in bounded reads on hosts with ranged snapshots.
|
|
207
|
+
* Stop at the first match in the requested direction without copying the full log.
|
|
208
|
+
*/
|
|
209
|
+
export function findOwnSessionEvent(session, matches, options = {}) {
|
|
210
|
+
const { order = 'oldest', fromSeq = 0 } = options;
|
|
211
|
+
const start = Math.max(session.inheritedEventCount, fromSeq);
|
|
212
|
+
const end = session.seq;
|
|
213
|
+
const search = (events) => {
|
|
214
|
+
if (order === 'oldest')
|
|
215
|
+
return events.find(matches);
|
|
216
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
217
|
+
const event = events[i];
|
|
218
|
+
if (matches(event))
|
|
219
|
+
return event;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
if (typeof session.snapshotEvents !== 'function' || !Number.isSafeInteger(start) || !Number.isSafeInteger(end)) {
|
|
223
|
+
return search(legacyOwnSessionEvents(session));
|
|
224
|
+
}
|
|
225
|
+
const batchSize = 256;
|
|
226
|
+
let cursor = order === 'oldest' ? start : end;
|
|
227
|
+
while (order === 'oldest' ? cursor < end : cursor > start) {
|
|
228
|
+
const from = order === 'oldest' ? cursor : Math.max(start, cursor - batchSize);
|
|
229
|
+
const to = order === 'oldest' ? Math.min(end, cursor + batchSize) : cursor;
|
|
230
|
+
const event = search(session.snapshotEvents(from, to));
|
|
231
|
+
if (event !== undefined)
|
|
232
|
+
return event;
|
|
233
|
+
cursor = order === 'oldest' ? to : from;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
206
236
|
/** Legacy hosts log each chunk separately; current hosts embed the committed stream. */
|
|
207
237
|
export function outputLimitTurn(event) {
|
|
208
238
|
const record = event;
|
package/lib/mailbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { acknowledgeMailbox, CAPTAIN_KEY, discardMailboxMessages, findTeamByCaptain, readMailbox, readUnreadMailbox, readTeam, sanitizeKey, withTeamLock } from "./state.js";
|
|
3
|
-
import {
|
|
3
|
+
import { findOwnSessionEvent, successfulSubagentSettlement } from "./harness-compat.js";
|
|
4
4
|
import { leadIdentityOfAsync, sessionLeadsTeamAsync } from "./lineage.js";
|
|
5
5
|
const PREFIX = 'AgentTeams inbox receipt: ';
|
|
6
6
|
export function isCurrentMail(team, message) {
|
|
@@ -188,18 +188,8 @@ export function installMailboxAdmission(ctx, stateDir) {
|
|
|
188
188
|
// existing turn, a status tool may have consumed this same mail already;
|
|
189
189
|
// dropping its duplicate must not block the pending tool-result response.
|
|
190
190
|
if (decision.messages.length > 0 && admitted.length === 0) {
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
for (let i = events.length - 1; i >= 0; i--) {
|
|
194
|
-
const event = events[i];
|
|
195
|
-
if (event.type === 'step/start' && event.data.turn === payload.turn) {
|
|
196
|
-
continuing = true;
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
if (event.type === 'turn/start')
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
if (!continuing)
|
|
191
|
+
const boundary = findOwnSessionEvent(payload.agent.session, event => event.type === 'turn/start' || (event.type === 'step/start' && event.data.turn === payload.turn), { order: 'newest' });
|
|
192
|
+
if (boundary?.type !== 'step/start')
|
|
203
193
|
return { kind: 'reject' };
|
|
204
194
|
}
|
|
205
195
|
return { ...decision, messages: admitted };
|
package/lib/members.js
CHANGED
|
@@ -17,7 +17,7 @@ import { foldSubagentDescriptor } from '@deepseek-ai/dsh-subagent';
|
|
|
17
17
|
import { createUserMessage, LlmError, ReasoningEffortId } from '@deepseek-ai/dsh-llm';
|
|
18
18
|
import { randomUUID } from 'node:crypto';
|
|
19
19
|
import { join } from 'node:path';
|
|
20
|
-
import { agentTeamsSource, observedSessionFormatVersion, outputLimitTurn, guardSubagentCreation, startMember, usesManagedActivations, guardSubagentDelivery, installContinuableMemberSetup, memberToolFilter, queueMemberPrompt, restrictableToolNames, startMemberWithLenientFilter, steerMemberPrompt,
|
|
20
|
+
import { agentTeamsSource, observedSessionFormatVersion, outputLimitTurn, guardSubagentCreation, startMember, usesManagedActivations, guardSubagentDelivery, installContinuableMemberSetup, memberToolFilter, queueMemberPrompt, restrictableToolNames, startMemberWithLenientFilter, steerMemberPrompt, findOwnSessionEvent } from "./harness-compat.js";
|
|
21
21
|
import { markMailboxDelivered, appendMailbox, CAPTAIN_KEY, createMessage, readRetiredMemberIds, readTeamSync, readTeam, releaseMailboxDelivery, withTeamLock, writeTeam } from "./state.js";
|
|
22
22
|
import { mailboxPrompt } from "./mailbox.js";
|
|
23
23
|
import { nearestLiveLead } from "./lineage.js";
|
|
@@ -508,13 +508,13 @@ export function installMemberSelectionRuntime(ctx, stateDir, onFailureSettled) {
|
|
|
508
508
|
const pending = new Map();
|
|
509
509
|
const pendingSetup = new Map();
|
|
510
510
|
installContinuableMemberSetup(ctx, (childCtx, child) => {
|
|
511
|
-
const descriptor = foldSubagentDescriptor(sessionOwnEvents(child.session));
|
|
512
|
-
if (descriptor?.mode !== 'continuable' || !descriptor.label.startsWith(MEMBER_LABEL_PREFIX)) {
|
|
513
|
-
return () => undefined;
|
|
514
|
-
}
|
|
515
511
|
const parentSessionId = child.session.header.parentSession;
|
|
516
512
|
if (parentSessionId === undefined)
|
|
517
513
|
return () => undefined;
|
|
514
|
+
const descriptor = ownSubagentDescriptor(child);
|
|
515
|
+
if (descriptor?.mode !== 'continuable' || !descriptor.label.startsWith(MEMBER_LABEL_PREFIX)) {
|
|
516
|
+
return () => undefined;
|
|
517
|
+
}
|
|
518
518
|
const identity = descriptor.label.slice(MEMBER_LABEL_PREFIX.length);
|
|
519
519
|
const separator = identity.indexOf(':');
|
|
520
520
|
if (separator < 1 || separator === identity.length - 1)
|
|
@@ -745,8 +745,10 @@ export function installMemberSelectionRuntime(ctx, stateDir, onFailureSettled) {
|
|
|
745
745
|
return {
|
|
746
746
|
isPendingMember(agent) {
|
|
747
747
|
const parent = agent.session.header.parentSession;
|
|
748
|
-
|
|
749
|
-
|
|
748
|
+
if (parent === undefined || pending.size === 0)
|
|
749
|
+
return false;
|
|
750
|
+
const descriptor = ownSubagentDescriptor(agent);
|
|
751
|
+
return descriptor?.mode === 'continuable'
|
|
750
752
|
&& pending.has(pendingSelectionKey(parent, descriptor.label));
|
|
751
753
|
},
|
|
752
754
|
async withPending(parentSessionId, label, selection, operation, setup) {
|
|
@@ -988,6 +990,18 @@ export function installRetiredMemberGuard(ctx, stateDir) {
|
|
|
988
990
|
return retired.has(childId);
|
|
989
991
|
});
|
|
990
992
|
}
|
|
993
|
+
const subagentDescriptorScan = new WeakMap();
|
|
994
|
+
/** Harness treats the first descriptor in the child's own log as authoritative. */
|
|
995
|
+
function ownSubagentDescriptor(agent) {
|
|
996
|
+
const { session } = agent;
|
|
997
|
+
const prior = subagentDescriptorScan.get(session);
|
|
998
|
+
const event = prior?.event ?? findOwnSessionEvent(session, entry => entry.type === 'subagent/descriptor', { fromSeq: prior?.through });
|
|
999
|
+
// Session history is append-only. After exhausting an own prefix, resume the
|
|
1000
|
+
// scan at newly appended events, and retain the first descriptor once seen.
|
|
1001
|
+
if (typeof session.seq === 'number')
|
|
1002
|
+
subagentDescriptorScan.set(session, { through: session.seq, event });
|
|
1003
|
+
return event === undefined ? undefined : foldSubagentDescriptor([event]);
|
|
1004
|
+
}
|
|
991
1005
|
/** Bound all descendant creation, including renamed tools and code-runtime calls. */
|
|
992
1006
|
export function installMemberDelegationGuard(ctx, stateDir, maxDepth) {
|
|
993
1007
|
let active = true;
|
|
@@ -997,7 +1011,7 @@ export function installMemberDelegationGuard(ctx, stateDir, maxDepth) {
|
|
|
997
1011
|
let ancestor = parent;
|
|
998
1012
|
let depth = 1;
|
|
999
1013
|
while (ancestor !== undefined) {
|
|
1000
|
-
const descriptor =
|
|
1014
|
+
const descriptor = ownSubagentDescriptor(ancestor);
|
|
1001
1015
|
if (descriptor?.label?.startsWith(MEMBER_LABEL_PREFIX)) {
|
|
1002
1016
|
const identity = descriptor.label.slice(MEMBER_LABEL_PREFIX.length);
|
|
1003
1017
|
const separator = identity.indexOf(':');
|
package/lib/quality-gates.js
CHANGED
|
@@ -208,6 +208,9 @@ export function validateCreateTask(team, input) {
|
|
|
208
208
|
if (!TASK_KINDS.includes(kind)) {
|
|
209
209
|
return { ok: false, error: `unknown task kind "${String(kind)}"` };
|
|
210
210
|
}
|
|
211
|
+
if (!nonemptyString(input.subject)) {
|
|
212
|
+
return { ok: false, error: 'task subject must not be empty' };
|
|
213
|
+
}
|
|
211
214
|
if (team.halted === true) {
|
|
212
215
|
const reason = input.resumeReason?.trim() ?? '';
|
|
213
216
|
if (input.resume !== true || reason === '') {
|
package/lib/scheduler.js
CHANGED
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
* @module dsh-agent-teams/scheduler
|
|
13
13
|
*/
|
|
14
14
|
import { join } from 'node:path';
|
|
15
|
-
import { deliverToMember } from "./members.js";
|
|
15
|
+
import { deliverToMember, steerCaptainReport } from "./members.js";
|
|
16
|
+
import { nearestLiveLead } from "./lineage.js";
|
|
17
|
+
import { appendTeamEvent, captainSessionOf } from "./events.js";
|
|
16
18
|
import { isCurrentMail, mailboxPrompt } from "./mailbox.js";
|
|
17
|
-
import { markMailboxDelivered, discardMailboxMessages, beginTaskAttempt, CAPTAIN_KEY, claimMailboxDelivery, findTeamByParticipant, invalidateTaskAttempt, readTeam, readPendingMailbox, releaseMailboxDelivery, unsatisfiedDependencies, withTeamLock, writeTeam, } from "./state.js";
|
|
19
|
+
import { appendMailbox, createMessage, readMailbox, markMailboxDelivered, discardMailboxMessages, beginTaskAttempt, CAPTAIN_KEY, claimMailboxDelivery, findTeamByParticipant, invalidateTaskAttempt, readTeam, readPendingMailbox, releaseMailboxDelivery, unsatisfiedDependencies, withTeamLock, writeTeam, } from "./state.js";
|
|
18
20
|
import { contractStaleness, isVerdictKind, taskKindOf, verdictScopePatterns } from "./quality-gates.js";
|
|
19
21
|
import { digestWorkspacePaths, snapshotWorkspacePaths } from "./artifacts.js";
|
|
20
22
|
/** Per-dependency output cap in the assignment prompt. */
|
|
@@ -394,6 +396,54 @@ export function installTeamScheduler(ctx, config) {
|
|
|
394
396
|
});
|
|
395
397
|
},
|
|
396
398
|
};
|
|
399
|
+
const notifyParkedAttempt = async (stateRoot, teamId, agent) => {
|
|
400
|
+
const prepared = await withTeamLock(teamLockKey(stateRoot, teamId), async () => {
|
|
401
|
+
const fresh = await readTeam(stateRoot, teamId);
|
|
402
|
+
const current = fresh?.members.find(candidate => candidate.id === agent.id && candidate.status !== 'removed');
|
|
403
|
+
if (fresh === undefined || current === undefined || current.status !== 'idle'
|
|
404
|
+
|| fresh.halted === true || fresh.phase === 'staged' || current.stopping === true)
|
|
405
|
+
return;
|
|
406
|
+
const owned = ownedOpenTask(fresh.tasks, current.name);
|
|
407
|
+
if (owned?.attemptId === undefined || owned.attemptId !== parkedAttempts.get(agent.id)
|
|
408
|
+
|| owned.reassigning === true)
|
|
409
|
+
return;
|
|
410
|
+
// Mail history, not the process-local park marker, dedupes notices
|
|
411
|
+
// across acknowledgement, re-parking and scheduler replacement.
|
|
412
|
+
const id = `parked-attempt:${JSON.stringify([current.id, owned.id, owned.attemptId])}`;
|
|
413
|
+
const inbox = await readMailbox(stateRoot, fresh.id, CAPTAIN_KEY);
|
|
414
|
+
if (inbox.some(item => item.id === id))
|
|
415
|
+
return;
|
|
416
|
+
const content = `Member "${current.name}" is idle with open task ${owned.id}`
|
|
417
|
+
+ ` (attempt ${owned.attempt ?? 1}, attempt_id ${owned.attemptId}).`
|
|
418
|
+
+ ' Scheduling is parked; use agent_teams_reassign_task to resume.';
|
|
419
|
+
const message = {
|
|
420
|
+
...createMessage(current.name, CAPTAIN_KEY, content),
|
|
421
|
+
id,
|
|
422
|
+
sourceTaskId: owned.id,
|
|
423
|
+
sourceAttemptId: owned.attemptId,
|
|
424
|
+
sourceTaskStatus: owned.status,
|
|
425
|
+
deliveryClaimedAt: Date.now(),
|
|
426
|
+
};
|
|
427
|
+
await appendMailbox(stateRoot, fresh.id, CAPTAIN_KEY, message);
|
|
428
|
+
appendTeamEvent(ctx, captainSessionOf(ctx, fresh.captainSessionId, agent.session), 'agent-teams/message-sent', {
|
|
429
|
+
teamId: fresh.id,
|
|
430
|
+
messageId: message.id,
|
|
431
|
+
from: current.name,
|
|
432
|
+
to: CAPTAIN_KEY,
|
|
433
|
+
content: message.content,
|
|
434
|
+
ts: message.ts,
|
|
435
|
+
});
|
|
436
|
+
return { captainSessionId: fresh.captainSessionId, members: fresh.members, memberName: current.name, message };
|
|
437
|
+
});
|
|
438
|
+
// A steer may synchronously start a turn; all host calls stay outside the lock.
|
|
439
|
+
if (prepared !== undefined) {
|
|
440
|
+
const captain = nearestLiveLead(ctx, prepared);
|
|
441
|
+
const delivered = captain !== undefined && steerCaptainReport(captain, prepared.memberName, prepared.message.content, mailboxPrompt(teamId, CAPTAIN_KEY, [prepared.message]));
|
|
442
|
+
await withTeamLock(teamLockKey(stateRoot, teamId), () => delivered
|
|
443
|
+
? markMailboxDelivered(stateRoot, teamId, CAPTAIN_KEY, [prepared.message.id])
|
|
444
|
+
: releaseMailboxDelivery(stateRoot, teamId, CAPTAIN_KEY, [prepared.message.id]));
|
|
445
|
+
}
|
|
446
|
+
};
|
|
397
447
|
const syncMemberStatus = async (agent, status) => {
|
|
398
448
|
const workspace = agent.session.header.cwd ?? process.cwd();
|
|
399
449
|
const stateRoot = stateRootOf(workspace, config);
|
|
@@ -444,6 +494,7 @@ export function installTeamScheduler(ctx, config) {
|
|
|
444
494
|
if (fresh === undefined || current === undefined)
|
|
445
495
|
return;
|
|
446
496
|
const next = status === 'running' ? 'working' : 'idle';
|
|
497
|
+
// Guidance can wake the member without replacing its parked attempt.
|
|
447
498
|
if (next === 'idle') {
|
|
448
499
|
const owned = ownedOpenTask(fresh.tasks, current.name);
|
|
449
500
|
if (owned?.attemptId === undefined)
|
|
@@ -451,16 +502,16 @@ export function installTeamScheduler(ctx, config) {
|
|
|
451
502
|
else
|
|
452
503
|
parkedAttempts.set(agent.id, owned.attemptId);
|
|
453
504
|
}
|
|
454
|
-
else {
|
|
455
|
-
parkedAttempts.delete(agent.id);
|
|
456
|
-
}
|
|
457
505
|
if (current.status === next)
|
|
458
506
|
return;
|
|
459
507
|
current.status = next;
|
|
460
508
|
await writeTeam(stateRoot, fresh);
|
|
461
509
|
});
|
|
462
|
-
if (status === 'idle')
|
|
510
|
+
if (status === 'idle') {
|
|
463
511
|
await runtime.kickMember(workspace, located.id, member.name);
|
|
512
|
+
// Wait for the member lane before deciding whether its attempt stayed parked.
|
|
513
|
+
await notifyParkedAttempt(stateRoot, located.id, agent);
|
|
514
|
+
}
|
|
464
515
|
};
|
|
465
516
|
ctx.on('agent/status', ({ agent, status }) => {
|
|
466
517
|
void syncMemberStatus(agent, status).catch((error) => {
|
package/lib/tools.js
CHANGED
|
@@ -576,7 +576,9 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
576
576
|
if (fresh.halted === true)
|
|
577
577
|
throw new Error('team is halted; resume before editing tasks');
|
|
578
578
|
if (!staged && mutations.some(mutation => mutation.action !== 'update_task')) {
|
|
579
|
-
throw new Error('
|
|
579
|
+
throw new Error('agent_teams_edit_plan only updates pending, never-started tasks while the team is running. '
|
|
580
|
+
+ 'Use agent_teams_create_task, agent_teams_add_member, agent_teams_remove_member, agent_teams_reassign_task, '
|
|
581
|
+
+ 'or agent_teams_update_task for other changes on a running team.');
|
|
580
582
|
}
|
|
581
583
|
for (const mutation of mutations) {
|
|
582
584
|
if (mutation.action === 'update_member') {
|
|
@@ -803,6 +805,7 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
803
805
|
members: { type: 'array', required: true, items: { type: 'object', additionalProperties: false, properties: {
|
|
804
806
|
name: { type: 'string', required: true, description: 'Unique member name inside the team. Write it in the user\'s conversation language (简体中文 when the user writes Chinese).' }, role: { type: 'string', description: `Role of the member (e.g. researcher, engineer, reviewer).${USER_LANGUAGE_NOTE}` },
|
|
805
807
|
provider: { type: 'string' }, model: { type: 'string' }, reasoning_effort: { type: 'string' },
|
|
808
|
+
executionPrompt: { type: 'string', description: '可选:该成员专属的执行提示词,只随该成员的任务派发,不影响其他成员。' },
|
|
806
809
|
tool_policy: { type: 'string', description: 'Optional owner-declared tool-policy id for this member.' },
|
|
807
810
|
} } },
|
|
808
811
|
tasks: { type: 'array', required: true, items: { type: 'object', additionalProperties: false, properties: {
|
|
@@ -2461,6 +2464,7 @@ async function initializeProfileTeam(input) {
|
|
|
2461
2464
|
provider: trimmedOptional(member.provider),
|
|
2462
2465
|
model: trimmedOptional(member.model),
|
|
2463
2466
|
reasoning_effort: trimmedOptional(member.reasoning_effort),
|
|
2467
|
+
executionPrompt: trimmedOptional(member.executionPrompt),
|
|
2464
2468
|
tool_policy: trimmedOptional(member.tool_policy),
|
|
2465
2469
|
})),
|
|
2466
2470
|
};
|
|
@@ -2712,7 +2716,7 @@ function renderStatus(value) {
|
|
|
2712
2716
|
team.loop_state && team.loop_state !== 'running' && team.loop_state !== 'halted' && team.loop_state !== 'escalated'
|
|
2713
2717
|
? team.loop_state
|
|
2714
2718
|
: undefined,
|
|
2715
|
-
].filter((item) => item !== undefined);
|
|
2719
|
+
].filter((item, index, all) => item !== undefined && all.indexOf(item) === index);
|
|
2716
2720
|
const lines = [
|
|
2717
2721
|
`Team "${team.team_name}"${team.description ? ` — ${team.description}` : ''}${flags.length > 0 ? ` [${flags.join(', ')}]` : ''}`,
|
|
2718
2722
|
...team.profile === undefined ? [] : [`Profile: ${team.profile.name}${team.profile.task_planning ? ` [${team.profile.task_planning}]` : ''}${team.profile.protocol ? ` — ${team.profile.protocol}` : ''}`],
|
|
@@ -109,8 +109,14 @@ export declare function agentTeamsSource(modern: AgentTeamsSource, observed?: nu
|
|
|
109
109
|
* Keep the removed event's type confined to this audited compatibility seam.
|
|
110
110
|
*/
|
|
111
111
|
export declare function onAgentReady(ctx: Context, listener: (agent: Agent, vetoable: boolean) => void): () => void;
|
|
112
|
-
/**
|
|
113
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Search child-owned history in bounded reads on hosts with ranged snapshots.
|
|
114
|
+
* Stop at the first match in the requested direction without copying the full log.
|
|
115
|
+
*/
|
|
116
|
+
export declare function findOwnSessionEvent(session: Session, matches: (event: SessionEvent) => boolean, options?: {
|
|
117
|
+
order?: 'oldest' | 'newest';
|
|
118
|
+
fromSeq?: number;
|
|
119
|
+
}): SessionEvent | undefined;
|
|
114
120
|
/** Legacy hosts log each chunk separately; current hosts embed the committed stream. */
|
|
115
121
|
export declare function outputLimitTurn(event: SessionEvent): number | undefined;
|
|
116
122
|
/** rc.2 summaries use tree names; the new structured reason owns the outcome. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhuifengqug/dsh-ant",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "\u7384\u9a79\uff1aDeepSeek Harness \u7684\u591a\u667a\u80fd\u4f53\u56e2\u961f\u63d2\u4ef6\uff08AgentTeams \u5206\u652f\u7248\uff09\u3002\u4e00\u53e5\u8bdd\u7ec4\u961f\uff0c\u961f\u957f\u6d3e\u6d3b\u3001\u961f\u5458\u5e76\u884c\u3001\u4f9d\u8d56\u81ea\u52a8\u8c03\u5ea6\uff0c\u5168\u4e2d\u6587\u4efb\u52a1\u4e0e\u5168\u4e2d\u6587\u534f\u8bae\u3002",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"test:git-install": "node --test scripts/git-artifacts.test.mjs",
|
|
113
113
|
"verify:source-runner": "node --test scripts/harness-source-verify.test.mjs",
|
|
114
114
|
"verify:git-artifact": "node scripts/git-artifacts.mjs",
|
|
115
|
-
"verify:issue-regressions": "node --test scripts/issue-188.test.mjs scripts/issue-189.test.mjs scripts/issue-205.test.mjs scripts/issue-234.test.mjs scripts/issue-236.test.mjs scripts/issue-236-stale-module.test.mjs scripts/issue-262.test.mjs scripts/issue-336.test.mjs",
|
|
115
|
+
"verify:issue-regressions": "node --test scripts/issue-188.test.mjs scripts/issue-189.test.mjs scripts/issue-205.test.mjs scripts/issue-234.test.mjs scripts/issue-236.test.mjs scripts/issue-236-stale-module.test.mjs scripts/issue-262.test.mjs scripts/issue-272.test.mjs scripts/issue-305.test.mjs scripts/issue-336.test.mjs",
|
|
116
116
|
"verify:legacy-session-repair": "node --test scripts/legacy-session-source-repair.test.mjs",
|
|
117
117
|
"verify:lineage-identity": "node --test scripts/lineage-identity.test.mjs"
|
|
118
118
|
},
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# v0.2.1 — 玄驹:吸收上游 0.1.31 增量 + 适配 Harness 0.2.2-rc.5
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 宿主口径升到 Harness `0.2.2-rc.5`:`compatibility.json` 的 `recommendedHost` 改为 rc.5 并置于 recommended 轨道,rc.2 / rc.1 / 0.2.1-rc.3 降到 preview,其余保持 legacy;矩阵上限同步到 rc.5。
|
|
6
|
+
- 长会话不再全量复制事件:`findOwnSessionEvent`(吸收上游 #360A)改走 `session.snapshotEvents(fromSeq, toSeqExclusive)` 的 256 条分批 ranged snapshot,起点从 `Math.max(session.inheritedEventCount, fromSeq)` 算,旧宿主缺少该方法时仍有全量兜底。rc.5 的 Session 契约三个成员(`snapshotEvents` / `ownEvents` / `inheritedEventCount`)都在,无需抬依赖。
|
|
7
|
+
- 质量门禁拒收空任务标题(吸收上游 #307):`task subject must not be empty`,中文描述同步。
|
|
8
|
+
- `agent_teams_status` 去重(吸收上游 #303):新增 index / all 两个参数形态,同一份快照不再重复回两遍。
|
|
9
|
+
- parked attempt 只通知队长一次(吸收上游 #301):同一 attempt 被反复 park 时不再刷屏,通知走 `notifyParkedAttempt` 单次记账。
|
|
10
|
+
- parked 后保留 attempt 记录(吸收上游 #345):删掉会清空 `parkedAttempts` 的那条 else 分支,证据不再被后继调度抹掉。
|
|
11
|
+
- 计划成员的 `executionPrompt` 描述按本分支中文口径重写(上游 #360B 的 schema 变更照收,文案不照抄),兼容矩阵与安装文案按 #361 重写成本仓口径。
|
|
12
|
+
- 上游 0.1.31 中依赖上游编排、包名或发版面的改动不并入:本仓包名是 `@zhuifengqug/dsh-ant`,编排与发布流程自成一套。
|
|
13
|
+
- 测试:`pnpm build && pnpm verify` 全链路通过(含 fork 四套用例与上游回归用例)。
|
|
14
|
+
|
|
15
|
+
## English
|
|
16
|
+
|
|
17
|
+
- Host target moves to Harness `0.2.2-rc.5`: `recommendedHost` now points at rc.5 on the recommended track, rc.2 / rc.1 / 0.2.1-rc.3 fall back to preview, everything older stays legacy, and the tested matrix tops out at rc.5.
|
|
18
|
+
- Long sessions stop copying every event: `findOwnSessionEvent` (absorbing upstream #360A) reads through `session.snapshotEvents(fromSeq, toSeqExclusive)` in 256-event ranged batches starting at `Math.max(session.inheritedEventCount, fromSeq)`, with the old full-scan path kept as a fallback when the method is absent. All three Session members rc.5 requires exist, so no dependency bump was needed.
|
|
19
|
+
- Quality gates reject an empty task subject (upstream #307) with the same error string.
|
|
20
|
+
- `agent_teams_status` gains the de-duplicated index / all shapes from upstream #303.
|
|
21
|
+
- A parked attempt notifies the captain once (upstream #301) instead of on every re-park.
|
|
22
|
+
- Parked attempt records survive subsequent scheduling (upstream #345) because the branch that cleared `parkedAttempts` is gone.
|
|
23
|
+
- `executionPrompt` descriptions on planned members are rewritten in this fork's Chinese voice (upstream #360B's schema change is taken, the wording is not), and the compatibility matrix plus install copy are rewritten for this repository per #361.
|
|
24
|
+
- Upstream 0.1.31 changes that depend on upstream's own orchestration, package name or release surface are not merged: this fork ships as `@zhuifengqug/dsh-ant`.
|
|
25
|
+
- Tests: the full `pnpm build && pnpm verify` chain passes, fork suites and upstream regressions included.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
In **Plugins → Add plugin**, enter `@zhuifengqug/dsh-ant@0.2.1`. For a CLI-managed profile, run:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
dsh plugin --profile desktop add --save-exact @zhuifengqug/dsh-ant@0.2.1
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Recommended host is Harness `0.2.2-rc.5`; see the [tested matrix](../compatibility.json).
|
package/scripts/doctor.mjs
CHANGED
|
@@ -8,6 +8,8 @@ function manifest(path) {
|
|
|
8
8
|
return JSON.parse(readFileSync(path, 'utf8'))
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
const PLUGIN_NAME = manifest(new URL('../package.json', import.meta.url)).name
|
|
12
|
+
|
|
11
13
|
function locatePackage(name, from) {
|
|
12
14
|
let directory = resolve(from)
|
|
13
15
|
for (;;) {
|
|
@@ -51,8 +53,8 @@ export function inspectInstallation(hostRoot, profileRoot, support = policy) {
|
|
|
51
53
|
walk(hostPath)
|
|
52
54
|
let plugin
|
|
53
55
|
if (profileRoot) {
|
|
54
|
-
const path = locatePackage(
|
|
55
|
-
if (!path) missing.push(
|
|
56
|
+
const path = locatePackage(PLUGIN_NAME, resolve(profileRoot))
|
|
57
|
+
if (!path) missing.push(`${PLUGIN_NAME} (profile)`)
|
|
56
58
|
else {
|
|
57
59
|
const pkg = manifest(path)
|
|
58
60
|
plugin = { version: pkg.version, path: dirname(path) }
|