@zhuifengqug/dsh-ant 0.1.29 → 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 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.29`。上游的功能照单全收,本分支只叠加四件事,全部有测试兜底:
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,再绑定归属会话,两击确认),不再只能堆积。
@@ -17,6 +17,12 @@ DeepSeek Harness 的多智能体团队插件。一句话把当前会话变成队
17
17
 
18
18
  ## 安装
19
19
 
20
+ 从 npm 安装(桌面端「插件 → 添加插件」里填版本号即可):
21
+
22
+ ```powershell
23
+ dsh plugin --profile desktop add @zhuifengqug/dsh-ant@0.2.1
24
+ ```
25
+
20
26
  本地开发目录安装(`link:` 指向本仓库):
21
27
 
22
28
  ```powershell
@@ -60,11 +66,11 @@ npx pnpm run build
60
66
  npx pnpm run verify
61
67
  ```
62
68
 
63
- `verify` 串起契约、质量门禁、兼容性、客户端与 fork 自有四处改动的全部用例,末段会校验 `lib/` 与源码一致(`git-artifacts`)。
69
+ `verify` 串起契约、质量门禁、兼容性、客户端与 fork 自有四处改动的全部用例,末段会校验 `lib/` 与源码一致(`git-artifacts`)。只想跑本分支那四件事,用 `npx pnpm run verify:fork`;只跑宿主契约兼容,用 `npx pnpm run verify:harness-contract`。
64
70
 
65
71
  ## 兼容性
66
72
 
67
- 宿主最低版本由 [`compatibility.json`](./compatibility.json) 里最旧的兼容项派生:推荐 `0.2.1-rc.2`,已在 `0.2.2-rc.1`(preview)上验证。当前开发的宿主是 `0.2.2-rc.1`。
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 条分批读取。
68
74
 
69
75
  ## 许可
70
76
 
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "recommendedHost": "0.2.1-rc.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
+ },
10
+ {
11
+ "version": "0.2.2-rc.2",
12
+ "track": "preview"
13
+ },
6
14
  {
7
15
  "version": "0.2.2-rc.1",
8
16
  "track": "preview"
@@ -13,7 +21,7 @@
13
21
  },
14
22
  {
15
23
  "version": "0.2.1-rc.2",
16
- "track": "recommended"
24
+ "track": "legacy"
17
25
  },
18
26
  {
19
27
  "version": "0.2.1-rc.1",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "schema": 1,
3
- "source": "47365906bf4270c718af7382a1728a969792ec827e94216f669c79e3be4714a5",
4
- "output": "e4b72213fe421e350cd599aa0d29e20f1d35f7597a3d9bc46709d3db1c5dc6fa"
3
+ "source": "6181462ccec155536269ae02a6c5fbb9d064971ad8ef0227c9e6398b8e25be61",
4
+ "output": "fce545598056d0f5a9532f6518600fa01bc3487e8168d25472d7b5ba4f527755"
5
5
  }
@@ -13,6 +13,45 @@ const hostPromptQueue = Symbol.for('dsh.subagent.queuePrompt');
13
13
  // 0.1.5 keeps queueHostSubagentPrompt but replaces its symbol with this
14
14
  // delivery-mode-aware implementation (packages/subagent/subagent/src/internal.ts).
15
15
  const hostPromptDeliver = Symbol.for('dsh.subagent.deliverPrompt');
16
+ const treeWork = new WeakMap();
17
+ function treeBoundary(runtime) {
18
+ const tree = runtime;
19
+ if (typeof tree.rootOf !== 'function' || typeof tree.prompt !== 'function')
20
+ return undefined;
21
+ if (typeof tree.manager?.deliverToMember !== 'function' || typeof tree.manager.dispose !== 'function'
22
+ || !(tree.manager.resident instanceof Map))
23
+ return unsupported('missing audited tree delivery manager');
24
+ return tree;
25
+ }
26
+ /** Track exact branch work before its first await so a targeted stop can join it. */
27
+ function trackTreeWork(manager, root, branch, signal, operation) {
28
+ const pending = treeWork.get(manager) ?? new Set();
29
+ treeWork.set(manager, pending);
30
+ const controller = new AbortController();
31
+ let finish;
32
+ const settled = new Promise(resolve => { finish = resolve; });
33
+ const work = { root, branch, controller, settled };
34
+ pending.add(work);
35
+ try {
36
+ return operation(AbortSignal.any([signal, controller.signal])).finally(() => { pending.delete(work); finish(); });
37
+ }
38
+ catch (error) {
39
+ pending.delete(work);
40
+ finish();
41
+ throw error;
42
+ }
43
+ }
44
+ function deliverTreePrompt(runtime, tree, parent, childId, content, source, signal, delivery) {
45
+ const root = tree.rootOf.call(runtime, parent);
46
+ return tree.manager.deliverToMember.call(tree.manager, root, childId, content, {
47
+ source, signal, delivery,
48
+ // Recheck the exact live caller immediately before native inbox acceptance.
49
+ authorize: () => {
50
+ if (tree.rootOf.call(runtime, parent) !== root)
51
+ throw new SubagentError('AgentTeams caller left its subagent tree', 'UNAUTHORIZED');
52
+ },
53
+ });
54
+ }
16
55
  export function usesManagedActivations(runtime) {
17
56
  return typeof runtime.startActivation === 'function';
18
57
  }
@@ -20,7 +59,9 @@ export async function startMember(runtime, spec) {
20
59
  const host = runtime;
21
60
  if (typeof host.startActivation === 'function') {
22
61
  const { persona: _persona, toolFilter: _filter, ...request } = spec.request;
23
- const activation = await host.startActivation.call(runtime, { ...spec, request, delivery: 'parent' });
62
+ const activation = await Reflect.apply(host.startActivation, runtime, [treeBoundary(runtime) === undefined
63
+ ? { ...spec, request, delivery: 'parent' }
64
+ : { provider: spec.provider, label: spec.label, ...request, signal: spec.signal, delivery: 'parent' }]);
24
65
  // Preserve native settlement as the missing-report/error fallback on both
25
66
  // fresh and resumed activations. mailbox.ts deduplicates successful reports.
26
67
  void activation.result.catch(() => undefined);
@@ -33,6 +74,7 @@ export async function startMember(runtime, spec) {
33
74
  /** Wrap every available creation API, restoring only this plugin's own methods. */
34
75
  export function guardSubagentCreation(ctx, check) {
35
76
  const runtime = ctx.subagents;
77
+ const tree = treeBoundary(ctx.subagents);
36
78
  ctx.effect(() => {
37
79
  const disposers = [];
38
80
  for (const key of ['start', 'startContinuable', 'startActivation']) {
@@ -41,8 +83,16 @@ export function guardSubagentCreation(ctx, check) {
41
83
  continue;
42
84
  const descriptor = Object.getOwnPropertyDescriptor(runtime, key);
43
85
  const guarded = async (...args) => {
44
- const request = key === 'start' ? args[1] : args[0].request;
45
- check(request.parent);
86
+ const request = key === 'start' ? args[1] : key === 'startActivation' && tree !== undefined
87
+ ? args[0] : args[0].request;
88
+ const parent = request.parent;
89
+ check(parent);
90
+ if (key === 'startActivation' && tree !== undefined) {
91
+ const spec = args[0];
92
+ const root = tree.rootOf.call(ctx.subagents, parent);
93
+ const branch = [parent.id, ...tree.manager.resident.get(parent.id)?.ancestors ?? []];
94
+ return trackTreeWork(tree.manager, root, branch, spec.signal, signal => Reflect.apply(original, ctx.subagents, [{ ...spec, signal }]));
95
+ }
46
96
  return Reflect.apply(original, ctx.subagents, args);
47
97
  };
48
98
  Object.defineProperty(runtime, key, { value: guarded, writable: true, configurable: true });
@@ -143,8 +193,7 @@ export function onAgentReady(ctx, listener) {
143
193
  const stopLegacy = legacy.on('agent/session-start', ({ agent }) => listener(agent, false));
144
194
  return () => { stopCreated(); stopLegacy(); };
145
195
  }
146
- /** Read child-owned history, excluding any descriptor inherited from a parent. */
147
- export function sessionOwnEvents(session) {
196
+ function legacyOwnSessionEvents(session) {
148
197
  const current = session;
149
198
  if (typeof current.ownEvents === 'function')
150
199
  return current.ownEvents.call(session);
@@ -153,6 +202,37 @@ export function sessionOwnEvents(session) {
153
202
  return unsupported('missing ownEvents/legacy session log');
154
203
  return legacy.events.slice(legacy.header.seedLength ?? 0);
155
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
+ }
156
236
  /** Legacy hosts log each chunk separately; current hosts embed the committed stream. */
157
237
  export function outputLimitTurn(event) {
158
238
  const record = event;
@@ -164,6 +244,15 @@ export function outputLimitTurn(event) {
164
244
  return record.data.turn;
165
245
  }
166
246
  }
247
+ /** rc.2 summaries use tree names; the new structured reason owns the outcome. */
248
+ export function successfulSubagentSettlement(source) {
249
+ if (source?.kind !== 'subagent-settled')
250
+ return false;
251
+ const current = source;
252
+ return current.stopReason === undefined
253
+ ? source.summary === `Background subagent ${source.senderSessionId} finished and will do no further work unless you send it more.`
254
+ : current.stopReason === 'completed';
255
+ }
167
256
  /** Install before the first request, including cold resume, with HMR cleanup. */
168
257
  export function installContinuableMemberSetup(ctx, setup) {
169
258
  const runtime = boundary(ctx.subagents);
@@ -178,7 +267,7 @@ export function installContinuableMemberSetup(ctx, setup) {
178
267
  });
179
268
  return;
180
269
  }
181
- if ((typeof runtime[hostPromptQueue] !== 'function' && typeof runtime[hostPromptDeliver] !== 'function') || typeof runtime.sendMessage !== 'function') {
270
+ if (treeBoundary(ctx.subagents) === undefined && ((typeof runtime[hostPromptQueue] !== 'function' && typeof runtime[hostPromptDeliver] !== 'function') || typeof runtime.sendMessage !== 'function')) {
182
271
  return unsupported('missing continuable setup and modern host queue');
183
272
  }
184
273
  const installed = new WeakSet();
@@ -246,6 +335,9 @@ export function installContinuableMemberSetup(ctx, setup) {
246
335
  export async function queueMemberPrompt(runtime, parent, childId, content, signal) {
247
336
  const host = boundary(runtime);
248
337
  const source = agentTeamsSource({ kind: 'agent-teams' }, observedSessionFormatVersion(parent));
338
+ const tree = treeBoundary(runtime);
339
+ if (tree !== undefined)
340
+ return deliverTreePrompt(runtime, tree, parent, childId, content, source, signal, 'queue');
249
341
  if (typeof host.followup === 'function') {
250
342
  return host.followup.call(runtime, parent, childId, content, { source, signal });
251
343
  }
@@ -261,6 +353,9 @@ export async function queueMemberPrompt(runtime, parent, childId, content, signa
261
353
  export async function steerMemberPrompt(runtime, parent, childId, content, signal, live) {
262
354
  const host = boundary(runtime);
263
355
  const source = agentTeamsSource({ kind: 'agent-teams' }, observedSessionFormatVersion(live ?? parent));
356
+ const tree = treeBoundary(runtime);
357
+ if (tree !== undefined)
358
+ return deliverTreePrompt(runtime, tree, parent, childId, content, source, signal, 'steer');
264
359
  const deliver = host[hostPromptDeliver];
265
360
  if (typeof deliver === 'function')
266
361
  return deliver.call(runtime, parent, childId, content, source, signal, 'steer');
@@ -281,6 +376,39 @@ export async function steerMemberPrompt(runtime, parent, childId, content, signa
281
376
  /** Guard all resumable delivery paths, preserving the native service receiver. */
282
377
  export function guardSubagentDelivery(ctx, isRetired) {
283
378
  const runtime = ctx.subagents;
379
+ const tree = treeBoundary(runtime);
380
+ if (tree !== undefined) {
381
+ const manager = tree.manager;
382
+ ctx.effect(() => {
383
+ const original = manager.deliverToMember;
384
+ const descriptor = Object.getOwnPropertyDescriptor(manager, 'deliverToMember');
385
+ let active = true;
386
+ const guarded = async (root, childId, content, options) => {
387
+ if (!active)
388
+ return original.call(manager, root, childId, content, options);
389
+ const branch = [childId, ...manager.resident.get(childId)?.ancestors ?? []];
390
+ return trackTreeWork(manager, root, branch, options.signal, async (signal) => {
391
+ signal.throwIfAborted();
392
+ if (await isRetired(root, childId)) {
393
+ throw new SubagentError(`AgentTeams member "${childId}" was retired and cannot be resumed`, 'NOT_RESUMABLE');
394
+ }
395
+ signal.throwIfAborted();
396
+ return original.call(manager, root, childId, content, { ...options, signal });
397
+ });
398
+ };
399
+ manager.deliverToMember = guarded;
400
+ return () => {
401
+ active = false;
402
+ if (Object.getOwnPropertyDescriptor(manager, 'deliverToMember')?.value !== guarded)
403
+ return;
404
+ if (descriptor === undefined)
405
+ Reflect.deleteProperty(manager, 'deliverToMember');
406
+ else
407
+ Object.defineProperty(manager, 'deliverToMember', descriptor);
408
+ };
409
+ }, 'agent-teams: tree retired member guard');
410
+ return;
411
+ }
284
412
  const host = boundary(runtime);
285
413
  const legacy = host.followup;
286
414
  const queue = host[hostPromptQueue];
@@ -446,6 +574,24 @@ export async function startMemberWithLenientFilter(start, filter, relaxableDeny
446
574
  }
447
575
  /** Targeted recursive cancellation renamed with the unified activation manager. */
448
576
  export async function drainMemberChildren(runtime, parent, ids) {
577
+ const tree = treeBoundary(runtime);
578
+ if (tree !== undefined) {
579
+ const root = tree.rootOf.call(runtime, parent);
580
+ const selected = new Set(ids);
581
+ // The native tree-wide drain also stops unrelated siblings and permanently
582
+ // closes the captain. Join only work in the selected creation branches.
583
+ const pending = [...treeWork.get(tree.manager) ?? []].filter(work => work.root === root && work.branch.some(id => selected.has(id)));
584
+ for (const work of pending)
585
+ work.controller.abort();
586
+ await Promise.all(pending.map(work => work.settled));
587
+ const targets = [...tree.manager.resident.values()].filter(item => item.root === root
588
+ && item.ancestors.includes(parent.id) && (selected.has(item.childId) || item.ancestors.some(id => selected.has(id))));
589
+ const results = await Promise.allSettled(targets.map(item => tree.manager.dispose.call(tree.manager, item)));
590
+ const failures = results.flatMap(result => result.status === 'rejected' ? [result.reason] : []);
591
+ if (failures.length)
592
+ throw new AggregateError(failures, 'AgentTeams member teardown failed');
593
+ return;
594
+ }
449
595
  const host = runtime;
450
596
  const drain = host.drainChildren ?? host.drainContinuableChildren;
451
597
  if (typeof drain !== 'function')
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 { sessionOwnEvents } from "./harness-compat.js";
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) {
@@ -80,8 +80,7 @@ export function installMailboxAdmission(ctx, stateDir) {
80
80
  // result. Keep abnormal endings and missing reports as fallback signals.
81
81
  const successfulSettlements = new Set(decision.messages.flatMap(input => {
82
82
  const source = input.source;
83
- return source?.kind === 'subagent-settled'
84
- && source.summary === `Background subagent ${source.senderSessionId} finished and will do no further work unless you send it more.`
83
+ return successfulSubagentSettlement(source)
85
84
  ? [source.senderSessionId] : [];
86
85
  }));
87
86
  const redundantSettlements = new Set();
@@ -168,8 +167,7 @@ export function installMailboxAdmission(ctx, stateDir) {
168
167
  }
169
168
  const admitted = [];
170
169
  for (const { input, receipt, batch } of inputs) {
171
- if (input.source?.kind === 'subagent-settled' && redundantSettlements.has(input.source.senderSessionId)
172
- && input.source.summary === `Background subagent ${input.source.senderSessionId} finished and will do no further work unless you send it more.`)
170
+ if (successfulSubagentSettlement(input.source) && redundantSettlements.has(input.source.senderSessionId))
173
171
  continue;
174
172
  if (receipt === undefined || batch === undefined || batch.failed === true) {
175
173
  admitted.push(input);
@@ -190,18 +188,8 @@ export function installMailboxAdmission(ctx, stateDir) {
190
188
  // existing turn, a status tool may have consumed this same mail already;
191
189
  // dropping its duplicate must not block the pending tool-result response.
192
190
  if (decision.messages.length > 0 && admitted.length === 0) {
193
- const events = sessionOwnEvents(payload.agent.session);
194
- let continuing = false;
195
- for (let i = events.length - 1; i >= 0; i--) {
196
- const event = events[i];
197
- if (event.type === 'step/start' && event.data.turn === payload.turn) {
198
- continuing = true;
199
- break;
200
- }
201
- if (event.type === 'turn/start')
202
- break;
203
- }
204
- 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')
205
193
  return { kind: 'reject' };
206
194
  }
207
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, sessionOwnEvents } from "./harness-compat.js";
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
- const descriptor = foldSubagentDescriptor(sessionOwnEvents(agent.session));
749
- return parent !== undefined && descriptor?.mode === 'continuable'
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 = foldSubagentDescriptor(sessionOwnEvents(ancestor.session));
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(':');
@@ -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('a running team only permits update_task edits to pending, never-started tasks; roster and removal edits require a staged plan');
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,10 +109,20 @@ 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
- /** Read child-owned history, excluding any descriptor inherited from a parent. */
113
- export declare function sessionOwnEvents(session: Session): readonly SessionEvent[];
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;
122
+ /** rc.2 summaries use tree names; the new structured reason owns the outcome. */
123
+ export declare function successfulSubagentSettlement(source: MessageSource | undefined): source is Extract<MessageSource, {
124
+ kind: 'subagent-settled';
125
+ }>;
116
126
  /** Install before the first request, including cold resume, with HMR cleanup. */
117
127
  export declare function installContinuableMemberSetup(ctx: Context, setup: Setup): void;
118
128
  /** Queue a distinct host-authored turn; never substitute model-message steer. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhuifengqug/dsh-ant",
3
- "version": "0.1.29",
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,23 @@
1
+ # v0.1.30 — Harness 0.2.2-rc.2 compatibility
2
+
3
+ - Restore plugin activation on Harness `0.2.2-rc.2` after the subagent runtime removed its previous host delivery entry point.
4
+ - Adapt member creation, queued assignments, step-boundary messages and cold recovery to the new subagent tree contract, preserving model selection, reasoning effort and tool restrictions.
5
+ - Stop selected members and their descendants without stopping unrelated siblings or closing the captain's tree. Retired members remain blocked through both model and browser messages.
6
+ - Avoid waking the captain twice after a member has already reported a completed task. Structured stop reasons preserve failure and missing-report notifications.
7
+
8
+ ## 中文
9
+
10
+ - 修复 Harness `0.2.2-rc.2` 升级后插件无法启用的问题。
11
+ - 适配新版子代理的创建、任务排队、消息与冷恢复,保留成员的模型、推理力度和工具范围。
12
+ - 停止成员时清理选定分支及其后代,保留无关队员与队长;已退役成员不能通过模型或网页消息重新启动。
13
+ - 成员已回报完成结果后,不再因新版结算通知重复唤醒队长;失败或缺失回报仍会通知。
14
+
15
+ ## Install
16
+
17
+ In **Plugins → Add plugin**, enter `@nanmicoder/dsh-agent-teams@0.1.30`. For a CLI-managed profile, run:
18
+
19
+ ```sh
20
+ dsh plugin --profile web add --save-exact @nanmicoder/dsh-agent-teams@0.1.30
21
+ ```
22
+
23
+ The recommended host remains Harness `0.2.1-rc.2`. Harness `0.2.2-rc.2` joins the Ubuntu and Windows preview matrix. See the [tested matrix](../compatibility.json) and [migration evidence](../docs/harness-0.2.2-rc.2/README.md).
@@ -0,0 +1,28 @@
1
+ # v0.2.0 — 玄驹:吸收上游 0.1.30,适配 Harness 0.2.2-rc.3
2
+
3
+ ## 中文
4
+
5
+ - 全量吸收上游 0.1.30:适配 Harness `0.2.2-rc.2` 的子代理树契约(`manager.deliverToMember` + `rootOf` + `resident`),修复该版把旧的宿主投递入口拆掉后插件无法启用的问题。
6
+ - 成员创建、任务排队、步边界消息与冷恢复改走树契约,成员模型、推理力度与工具范围保持不变;定向停止只清理选中成员及其后代,退役成员在模型与网页两路都被拦。
7
+ - 成员已回报完成后不再重复唤醒队长:`subagent-settled` 的结构化 `stopReason` 成为结算判据,失败与缺失回报仍会通知。
8
+ - 开发宿主切到 Harness `0.2.2-rc.3`:核验其子代理运行时仍保留 `rootOf` / `prompt` / `startActivation` / `manager.resident` / `deliverToMember` 这套形状,与 rc.2 同构。
9
+ - 本分支四件定制随之上移:中文语言约束(团队提示词与全部工具参数描述)、归档团队永久删除(绑定归属会话 + 两击确认)、无进展滑动窗口标记、质量门禁只重跑失败命令并把验收证据绑定到当前 attempt。
10
+ - 测试:新增上游三条树 ABI 用例(激活 / 退役守卫三路投递 / 定向 drain)与运行期平台用例;`verify:fork` 四套本分支用例照旧复用。
11
+
12
+ ## English
13
+
14
+ - Absorbs upstream 0.1.30 in full: adapts to the Harness `0.2.2-rc.2` subagent tree contract (`manager.deliverToMember` + `rootOf` + `resident`), restoring plugin activation after that release removed the previous host delivery entry point.
15
+ - Member creation, queued assignments, step-boundary messages and cold recovery now flow through the tree contract while model, reasoning effort and tool restrictions stay intact; a targeted stop clears only the selected branch, and retired members stay blocked on both model and browser paths.
16
+ - No duplicate captain wakeup once a member has already reported completion: the structured `stopReason` of `subagent-settled` decides settlement, while failures and missing reports still notify.
17
+ - Development host moves to Harness `0.2.2-rc.3`, whose subagent runtime keeps the same `rootOf` / `prompt` / `startActivation` / `manager.resident` / `deliverToMember` shape as rc.2.
18
+ - The fork's four customizations carry over: mandatory Chinese language rule in team prompts and tool descriptions, permanent deletion of archived teams (session-bound, two-step confirm), sliding no-progress markers, and verification that re-runs only failed commands with evidence bound to the current attempt.
19
+
20
+ ## Install
21
+
22
+ In **Plugins → Add plugin**, enter `@zhuifengqug/dsh-ant@0.2.0`. For a CLI-managed profile, run:
23
+
24
+ ```sh
25
+ dsh plugin --profile desktop add --save-exact @zhuifengqug/dsh-ant@0.2.0
26
+ ```
27
+
28
+ The recommended host remains Harness `0.2.1-rc.2`; `0.2.2-rc.1` and `0.2.2-rc.2` are the preview targets covered by upstream's runtime matrix, and this fork develops against `0.2.2-rc.3`. See the [tested matrix](../compatibility.json) and the [rc.2 migration evidence](../docs/harness-0.2.2-rc.2/README.md).
@@ -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).
@@ -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('@nanmicoder/dsh-agent-teams', resolve(profileRoot))
55
- if (!path) missing.push('@nanmicoder/dsh-agent-teams (profile)')
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) }