@fish-under-sea/dsh-agent-teams-fish 1.0.2 → 2.0.0
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/NOTICE.md +13 -7
- package/README.en.md +20 -12
- package/README.md +20 -12
- package/compatibility.json +82 -46
- package/icon.png +0 -0
- package/lib/artifacts.js +148 -25
- package/lib/client/ActivityPanel.js +26 -5
- package/lib/client/WorkspaceActivity.js +6 -4
- package/lib/client/activity-monitor.js +113 -41
- package/lib/client/locales.js +14 -0
- package/lib/client.js +433 -199
- package/lib/client.js.map +1 -1
- package/lib/command.js +7 -4
- package/lib/git-artifact-stamp.json +2 -2
- package/lib/harness-compat.js +120 -62
- package/lib/index.js +7 -10
- package/lib/mailbox.js +15 -5
- package/lib/members.js +221 -154
- package/lib/snapshot.js +15 -10
- package/lib/state.js +41 -8
- package/lib/tools.js +123 -64
- package/lib/types/artifacts.d.ts +6 -3
- package/lib/types/client/activity-monitor.d.ts +13 -4
- package/lib/types/client/locales.d.ts +14 -0
- package/lib/types/harness-compat.d.ts +63 -16
- package/lib/types/mailbox.d.ts +2 -0
- package/lib/types/members.d.ts +5 -17
- package/lib/types/snapshot.d.ts +12 -7
- package/lib/types/state.d.ts +10 -3
- package/lib/types/types.d.ts +5 -0
- package/lib/types/web-routes.d.ts +2 -0
- package/lib/types/workspace-audit-service.d.ts +35 -0
- package/lib/types/workspace-audit-worker.d.ts +1 -0
- package/lib/web-routes.js +31 -0
- package/lib/workspace-audit-service.js +165 -0
- package/lib/workspace-audit-worker.js +11 -0
- package/lib/workspace-audit.js +6 -5
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +69 -64
- package/pnpm-workspace.yaml +306 -273
- package/release-notes/v0.1.25.md +16 -0
- package/release-notes/v0.1.26.md +19 -0
- package/release-notes/v0.1.27.md +42 -0
- package/release-notes/v0.1.28.md +45 -0
- package/release-notes/v0.1.29.md +23 -0
- package/release-notes/v1.1.0.md +42 -0
- package/release-notes/v2.0.0.md +17 -0
- package/scripts/artwork-role-match.test.mjs +517 -0
- package/scripts/capabilities.test.mjs +301 -0
- package/scripts/check-install-channel.mjs +55 -0
- package/scripts/check-install-channel.test.mjs +39 -0
- package/scripts/clean-build.mjs +14 -0
- package/scripts/client-harness-migration.test.mjs +46 -0
- package/scripts/compatibility.mjs +20 -0
- package/scripts/compatibility.test.mjs +187 -0
- package/scripts/corrupt-teamjson.test.mjs +180 -0
- package/scripts/custom-artwork.test.mjs +273 -0
- package/scripts/fallback-tdd.mjs +61 -0
- package/scripts/fixtures/harness-benchmark-scope.mjs +16 -0
- package/scripts/fixtures/harness-benchmark-scope.test.mjs +18 -0
- package/scripts/fixtures/harness-complex-case.mjs +201 -0
- package/scripts/fixtures/harness-complex-case.test.mjs +21 -0
- package/scripts/fixtures/harness-complex-oracle.mjs +63 -0
- package/scripts/fixtures/harness-issue-case.mjs +51 -0
- package/scripts/fixtures/harness-issue159-case.mjs +28 -0
- package/scripts/fixtures/harness-model-case.mjs +127 -0
- package/scripts/fixtures/harness-model-case.test.mjs +37 -0
- package/scripts/fixtures/harness-model-driver.mjs +100 -0
- package/scripts/fixtures/harness-runtime-credentials.mjs +23 -0
- package/scripts/fixtures/harness-runtime-entry.mjs +171 -0
- package/scripts/fixtures/harness-runtime-idle.mjs +42 -0
- package/scripts/fixtures/harness-runtime-llm.mjs +193 -0
- package/scripts/fixtures/harness-runtime-protocol.mjs +187 -0
- package/scripts/fixtures/harness-runtime-resume.mjs +24 -0
- package/scripts/fixtures/harness-runtime-stability.mjs +282 -0
- package/scripts/fixtures/harness-runtime-tools.mjs +13 -0
- package/scripts/fixtures/harness-runtime-web-approval.mjs +341 -0
- package/scripts/fixtures/issue-336-audit-worker.mjs +18 -0
- package/scripts/git-artifacts.mjs +64 -0
- package/scripts/git-artifacts.test.mjs +32 -0
- package/scripts/harness-compat-tdd.mjs +492 -0
- package/scripts/harness-issue-verify.mjs +26 -0
- package/scripts/harness-model-benchmark.mjs +163 -0
- package/scripts/harness-runtime-platform.test.mjs +31 -0
- package/scripts/harness-runtime-scenarios.mjs +297 -0
- package/scripts/harness-runtime-verify.mjs +169 -0
- package/scripts/harness-source-verify.mjs +211 -0
- package/scripts/harness-source-verify.test.mjs +97 -0
- package/scripts/harness-validation.mjs +68 -0
- package/scripts/harness-validation.test.mjs +95 -0
- package/scripts/http-body.test.mjs +72 -0
- package/scripts/import-vendor-artwork.mjs +78 -0
- package/scripts/inline-plan-blank-optional-tdd.mjs +121 -0
- package/scripts/issue-159.test.mjs +78 -0
- package/scripts/issue-188.test.mjs +148 -0
- package/scripts/issue-189.test.mjs +100 -0
- package/scripts/issue-203-card.test.mjs +181 -0
- package/scripts/issue-205.test.mjs +163 -0
- package/scripts/issue-234.test.mjs +424 -0
- package/scripts/issue-236-stale-module.test.mjs +63 -0
- package/scripts/issue-236.test.mjs +59 -0
- package/scripts/issue-262.test.mjs +98 -0
- package/scripts/issue-336.test.mjs +404 -0
- package/scripts/legacy-session-source-repair.test.mjs +201 -0
- package/scripts/lifecycle-verify.mjs +1573 -0
- package/scripts/lineage-identity.test.mjs +77 -0
- package/scripts/member-failure-tdd.mjs +451 -0
- package/scripts/member-spawn-recovery.test.mjs +92 -0
- package/scripts/quality-gates-amend.test.mjs +161 -0
- package/scripts/quality-gates-content-bound.test.mjs +572 -0
- package/scripts/quality-gates-cross-binding.test.mjs +184 -0
- package/scripts/quality-gates-excluded-scope.test.mjs +163 -0
- package/scripts/quality-gates-repair-scope.test.mjs +143 -0
- package/scripts/quality-gates-repair-wiring.test.mjs +189 -0
- package/scripts/quality-gates-tdd.mjs +1238 -0
- package/scripts/quality-gates-work-order.test.mjs +494 -0
- package/scripts/readme-version.mjs +89 -0
- package/scripts/readme-version.test.mjs +77 -0
- package/scripts/release-metadata.mjs +45 -0
- package/scripts/release-metadata.test.mjs +66 -0
- package/scripts/scoped-release.test.mjs +52 -0
- package/scripts/stability-tdd.mjs +144 -0
- package/scripts/stress-verify.mjs +548 -0
- package/scripts/symlink-support.mjs +46 -0
- package/scripts/sync-skill.mjs +103 -0
- package/scripts/tool-policies.test.mjs +280 -0
- package/scripts/update-skills.mjs +105 -0
- package/scripts/update-skills.test.mjs +79 -0
- package/scripts/upgrade-status.mjs +66 -0
- package/scripts/upgrade-status.test.mjs +83 -0
- package/scripts/verify-package.mjs +73 -0
- package/scripts/verify.mjs +2199 -0
- package/scripts/web-routes-verify.mjs +142 -0
- package/scripts/workspace-activity.test.mjs +346 -0
- package/scripts/workspace-summary.test.mjs +49 -0
- package/src/artifacts.ts +487 -0
- package/src/artwork-source.ts +262 -0
- package/src/capabilities.ts +113 -0
- package/src/client/ActivityPanel.module.css +2390 -0
- package/src/client/ActivityPanel.tsx +1507 -0
- package/src/client/AgentTeamsCard.module.css +148 -0
- package/src/client/AgentTeamsCard.tsx +155 -0
- package/src/client/StagingPlanEditor.tsx +829 -0
- package/src/client/TeamChatEntry.tsx +27 -0
- package/src/client/WorkspaceActivity.module.css +41 -0
- package/src/client/WorkspaceActivity.tsx +137 -0
- package/src/client/activity-model.ts +372 -0
- package/src/client/activity-monitor.ts +440 -0
- package/src/client/agent-teams-card-definition.ts +250 -0
- package/src/client/artwork.ts +374 -0
- package/src/client/icons.tsx +17 -0
- package/src/client/index.tsx +140 -0
- package/src/client/locales.ts +481 -0
- package/src/client/panel-geometry.ts +194 -0
- package/src/client/session-navigation.ts +73 -0
- package/src/client/workspace-state.ts +52 -0
- package/src/command.ts +145 -0
- package/src/css-modules.d.ts +4 -0
- package/src/event-types.ts +177 -0
- package/src/events.ts +78 -0
- package/src/harness-compat.ts +570 -0
- package/src/index.ts +599 -0
- package/src/lineage.ts +248 -0
- package/src/mailbox.ts +185 -0
- package/src/members.ts +1230 -0
- package/src/profiles.ts +765 -0
- package/src/quality-gates.ts +2124 -0
- package/src/scheduler.ts +554 -0
- package/src/snapshot.ts +333 -0
- package/src/state.ts +1317 -0
- package/src/tool-names.ts +14 -0
- package/src/tool-policies.ts +219 -0
- package/src/tools.ts +2939 -0
- package/src/types.ts +414 -0
- package/src/web-routes.ts +128 -0
- package/src/workspace-audit-service.ts +182 -0
- package/src/workspace-audit-worker.ts +12 -0
- package/src/workspace-audit.ts +57 -0
package/lib/snapshot.js
CHANGED
|
@@ -11,7 +11,7 @@ import { readdir } from 'node:fs/promises';
|
|
|
11
11
|
import { join } from 'node:path';
|
|
12
12
|
import { captainRouteOf, memberActivity } from "./members.js";
|
|
13
13
|
import { canDeclareDelivery, describeQualityLoop, verdictAuditNotes } from "./quality-gates.js";
|
|
14
|
-
import {
|
|
14
|
+
import { workspaceAuditor } from "./workspace-audit-service.js";
|
|
15
15
|
import { CAPTAIN_KEY, listArchivedTeamIds, readArchivedTeam, readUnreadMailbox, readTeam, taskDepthsById, taskVisualState, } from "./state.js";
|
|
16
16
|
/** The current task of a member: its first unfinished owned task. */
|
|
17
17
|
function currentTaskOf(memberName, tasks) {
|
|
@@ -41,6 +41,7 @@ export function memberModelRoute(member) {
|
|
|
41
41
|
*/
|
|
42
42
|
export async function assembleTeamSnapshot(ctx, stateRoot, workspace, state, options = {}) {
|
|
43
43
|
const tasks = state.tasks;
|
|
44
|
+
const includePlanText = options.summary !== true || state.phase === 'staged' || options.historic === true;
|
|
44
45
|
const depths = taskDepthsById(tasks);
|
|
45
46
|
const roster = options.includeRemoved === true
|
|
46
47
|
? state.members
|
|
@@ -68,7 +69,7 @@ export async function assembleTeamSnapshot(ctx, stateRoot, workspace, state, opt
|
|
|
68
69
|
provider: member.provider?.trim() ?? '',
|
|
69
70
|
model: member.model?.trim() ?? '',
|
|
70
71
|
reasoningEffort: member.reasoningEffort?.trim() ?? '',
|
|
71
|
-
executionPrompt: member.executionPrompt ?? '',
|
|
72
|
+
...includePlanText ? { executionPrompt: member.executionPrompt ?? '' } : {},
|
|
72
73
|
status: member.status,
|
|
73
74
|
activity: options.historic === true
|
|
74
75
|
? 'idle'
|
|
@@ -96,7 +97,7 @@ export async function assembleTeamSnapshot(ctx, stateRoot, workspace, state, opt
|
|
|
96
97
|
const captainModel = liveRoute?.captainModel ?? state.captainModel ?? '';
|
|
97
98
|
// The panel must reach the same delivery conclusion as the status tool, so
|
|
98
99
|
// it reads the same current bytes instead of trusting task records alone.
|
|
99
|
-
const audit = options.workspacePath === undefined ? undefined :
|
|
100
|
+
const audit = options.workspacePath === undefined ? undefined : await workspaceAuditor(ctx).audit(options.workspacePath, state, stateRoot);
|
|
100
101
|
const deliveryCheck = audit === undefined ? canDeclareDelivery(state) : canDeclareDelivery(state, audit);
|
|
101
102
|
const loop = audit === undefined ? describeQualityLoop(state) : describeQualityLoop(state, audit);
|
|
102
103
|
const staleById = new Map();
|
|
@@ -127,7 +128,7 @@ export async function assembleTeamSnapshot(ctx, stateRoot, workspace, state, opt
|
|
|
127
128
|
tasks: tasks.map((task) => ({
|
|
128
129
|
id: task.id,
|
|
129
130
|
subject: task.subject,
|
|
130
|
-
description: task.description ?? '',
|
|
131
|
+
...includePlanText ? { description: task.description ?? '' } : {},
|
|
131
132
|
status: task.status,
|
|
132
133
|
state: taskVisualState(task.status, task.dependencies, tasks),
|
|
133
134
|
assignee: task.assignee ?? '',
|
|
@@ -149,12 +150,14 @@ export async function assembleTeamSnapshot(ctx, stateRoot, workspace, state, opt
|
|
|
149
150
|
};
|
|
150
151
|
}
|
|
151
152
|
/**
|
|
152
|
-
* Collect
|
|
153
|
+
* Collect live teams under the given workspace state roots.
|
|
153
154
|
* @param ctx - the plugin context.
|
|
154
155
|
* @param roots - `{ workspace, stateRoot }` pairs (resolved absolute roots).
|
|
156
|
+
* @param captainSessionId - when present, assemble only the requested captain's teams.
|
|
157
|
+
* @param summary - omit editor-only text from running teams.
|
|
155
158
|
* @returns the snapshots in stable order (workspace, then team id).
|
|
156
159
|
*/
|
|
157
|
-
export async function collectTeamsActivity(ctx, roots) {
|
|
160
|
+
export async function collectTeamsActivity(ctx, roots, captainSessionId, summary = false) {
|
|
158
161
|
const snapshots = [];
|
|
159
162
|
for (const root of roots) {
|
|
160
163
|
let entries;
|
|
@@ -172,9 +175,10 @@ export async function collectTeamsActivity(ctx, roots) {
|
|
|
172
175
|
continue;
|
|
173
176
|
try {
|
|
174
177
|
const state = await readTeam(root.stateRoot, entry.name);
|
|
175
|
-
if (state === undefined)
|
|
178
|
+
if (state === undefined || (captainSessionId !== undefined && state.captainSessionId !== captainSessionId))
|
|
176
179
|
continue;
|
|
177
180
|
snapshots.push(await assembleTeamSnapshot(ctx, root.stateRoot, root.workspace, state, {
|
|
181
|
+
summary,
|
|
178
182
|
...root.workspacePath === undefined ? {} : { workspacePath: root.workspacePath },
|
|
179
183
|
}));
|
|
180
184
|
}
|
|
@@ -186,20 +190,21 @@ export async function collectTeamsActivity(ctx, roots) {
|
|
|
186
190
|
return snapshots;
|
|
187
191
|
}
|
|
188
192
|
/**
|
|
189
|
-
* Collect
|
|
193
|
+
* Collect archived teams under the given workspace state roots (the
|
|
190
194
|
* `archive/` subdirectory of each state root). Used by the historic panel
|
|
191
195
|
* path to restore full team detail after deletion.
|
|
192
196
|
* @param ctx - the plugin context.
|
|
193
197
|
* @param roots - `{ workspace, stateRoot }` pairs.
|
|
198
|
+
* @param captainSessionId - when present, assemble only the requested captain's teams.
|
|
194
199
|
* @returns the archived snapshots in stable order.
|
|
195
200
|
*/
|
|
196
|
-
export async function collectArchivedTeamsActivity(ctx, roots) {
|
|
201
|
+
export async function collectArchivedTeamsActivity(ctx, roots, captainSessionId) {
|
|
197
202
|
const snapshots = [];
|
|
198
203
|
for (const root of roots) {
|
|
199
204
|
for (const teamId of await listArchivedTeamIds(root.stateRoot)) {
|
|
200
205
|
try {
|
|
201
206
|
const state = await readArchivedTeam(root.stateRoot, teamId);
|
|
202
|
-
if (state === undefined)
|
|
207
|
+
if (state === undefined || (captainSessionId !== undefined && state.captainSessionId !== captainSessionId))
|
|
203
208
|
continue;
|
|
204
209
|
snapshots.push(await assembleTeamSnapshot(ctx, join(root.stateRoot, 'archive'), root.workspace, state, { includeRemoved: true, historic: true }));
|
|
205
210
|
}
|
package/lib/state.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @module dsh-agent-teams/state
|
|
14
14
|
*/
|
|
15
15
|
import { createHash, randomUUID } from 'node:crypto';
|
|
16
|
-
import { readFileSync } from 'node:fs';
|
|
16
|
+
import { readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
17
17
|
import { mkdir, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
|
|
18
18
|
import { join } from 'node:path';
|
|
19
19
|
import { FINDING_SEVERITIES, REVIEW_VERDICTS, TASK_KINDS, TERMINAL_TASK_STATUSES } from "./types.js";
|
|
@@ -247,9 +247,10 @@ export function readTeamSync(stateRoot, teamId) {
|
|
|
247
247
|
* Persist one team record (inside the caller's lock).
|
|
248
248
|
* @param stateRoot - resolved absolute state root directory.
|
|
249
249
|
* @param state - the record to persist.
|
|
250
|
+
* @param commit - gate and synchronous effect for a cancellation-sensitive replacement.
|
|
250
251
|
*/
|
|
251
|
-
export async function writeTeam(stateRoot, state) {
|
|
252
|
-
await atomicWriteText(join(stateRoot, state.id, 'team.json'), JSON.stringify(state, null, 2));
|
|
252
|
+
export async function writeTeam(stateRoot, state, commit) {
|
|
253
|
+
await atomicWriteText(join(stateRoot, state.id, 'team.json'), JSON.stringify(state, null, 2), commit);
|
|
253
254
|
}
|
|
254
255
|
/** Read the durable set of member session ids retired by remove/delete. */
|
|
255
256
|
function parseRetiredMemberIds(raw) {
|
|
@@ -587,7 +588,7 @@ export async function replaceFileAtomicOrDirect(temporary, file, content, primit
|
|
|
587
588
|
* degrading to a direct overwrite when the atomic rename cannot proceed
|
|
588
589
|
* (see {@link replaceFileAtomicOrDirect} for the Windows EPERM rationale).
|
|
589
590
|
*/
|
|
590
|
-
async function atomicWriteText(file, content) {
|
|
591
|
+
async function atomicWriteText(file, content, commit) {
|
|
591
592
|
const temporary = `${file}.${process.pid}.${randomUUID()}.tmp`;
|
|
592
593
|
try {
|
|
593
594
|
await writeFile(temporary, content, { encoding: 'utf8', flag: 'wx' });
|
|
@@ -596,11 +597,37 @@ async function atomicWriteText(file, content) {
|
|
|
596
597
|
await rm(temporary, { force: true }).catch(() => undefined);
|
|
597
598
|
throw error;
|
|
598
599
|
}
|
|
600
|
+
// Stage bytes asynchronously. Guarded callers install the file and apply
|
|
601
|
+
// its live effect in the same JS turn, so abort can never leave a canceled
|
|
602
|
+
// route visible to a synchronous cold read while the rename is pending.
|
|
603
|
+
const remove = (path) => rm(path, { force: true });
|
|
604
|
+
let effectFailure;
|
|
605
|
+
const commitIfActive = (replace) => {
|
|
606
|
+
if (commit?.signal.aborted)
|
|
607
|
+
return false;
|
|
608
|
+
replace();
|
|
609
|
+
// An effect failure is not a filesystem failure. Do not let the Windows
|
|
610
|
+
// retry/direct overwrite run the effect again.
|
|
611
|
+
try {
|
|
612
|
+
commit?.onCommit();
|
|
613
|
+
}
|
|
614
|
+
catch (error) {
|
|
615
|
+
effectFailure = { error };
|
|
616
|
+
}
|
|
617
|
+
return true;
|
|
618
|
+
};
|
|
599
619
|
await replaceFileAtomicOrDirect(temporary, file, content, {
|
|
600
|
-
rename: (from, to) => rename(from, to),
|
|
601
|
-
|
|
602
|
-
|
|
620
|
+
rename: commit === undefined ? (from, to) => rename(from, to) : async (from, to) => {
|
|
621
|
+
if (!commitIfActive(() => renameSync(from, to)))
|
|
622
|
+
await remove(from).catch(() => undefined);
|
|
623
|
+
},
|
|
624
|
+
writeFile: commit === undefined ? (target, payload) => writeFile(target, payload, 'utf8') : async (target, payload) => {
|
|
625
|
+
commitIfActive(() => writeFileSync(target, payload, 'utf8'));
|
|
626
|
+
},
|
|
627
|
+
remove,
|
|
603
628
|
});
|
|
629
|
+
if (effectFailure !== undefined)
|
|
630
|
+
throw effectFailure.error;
|
|
604
631
|
}
|
|
605
632
|
/** Whether a parsed JSON value is a plain record. */
|
|
606
633
|
function isRecord(value) {
|
|
@@ -665,6 +692,9 @@ function isTeamMember(value) {
|
|
|
665
692
|
// A member without a policy keeps the legacy shape: both fields stay absent.
|
|
666
693
|
&& isOptionalNonBlankString(value['toolPolicy'])
|
|
667
694
|
&& (value['toolFilter'] === undefined || isMemberToolFilter(value['toolFilter']))
|
|
695
|
+
&& (value['runtimeSetup'] === undefined || (isRecord(value['runtimeSetup'])
|
|
696
|
+
&& typeof value['runtimeSetup']['persona'] === 'string'
|
|
697
|
+
&& isMemberToolFilter(value['runtimeSetup']['toolFilter'])))
|
|
668
698
|
&& isFiniteNumber(value['joinedAt'])
|
|
669
699
|
&& (value['status'] === 'idle' || value['status'] === 'working' || value['status'] === 'removed');
|
|
670
700
|
}
|
|
@@ -1172,7 +1202,8 @@ export async function listArchivedTeamIds(stateRoot) {
|
|
|
1172
1202
|
}
|
|
1173
1203
|
}
|
|
1174
1204
|
/**
|
|
1175
|
-
* The visual state of one task: `
|
|
1205
|
+
* The visual state of one task: `claimed` after assignment, `running` only
|
|
1206
|
+
* after the explicit in_progress update, `completed`
|
|
1176
1207
|
* when done, `failed`/`cancelled` when terminal without success, `blocked`
|
|
1177
1208
|
* while any dependency is unfinished, else `open`.
|
|
1178
1209
|
*/
|
|
@@ -1185,6 +1216,8 @@ export function taskVisualState(status, dependencies, tasks) {
|
|
|
1185
1216
|
return 'cancelled';
|
|
1186
1217
|
if (status === 'in_progress')
|
|
1187
1218
|
return 'running';
|
|
1219
|
+
if (status === 'claimed')
|
|
1220
|
+
return 'claimed';
|
|
1188
1221
|
const byId = new Map(tasks.map((task) => [task.id, task]));
|
|
1189
1222
|
const openDependency = dependencies.some((dependencyId) => {
|
|
1190
1223
|
const dependency = byId.get(dependencyId);
|
package/lib/tools.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* The `agent_teams_*` model-facing tools.
|
|
3
|
-
*
|
|
4
|
-
* The captain (the agent that created the team) orchestrates: members are
|
|
5
|
-
* continuable subagents it spawns and wakes. Members share the same tools and
|
|
6
|
-
* drive their own task state, mirroring the Claude Code AgentTeams flow:
|
|
7
|
-
* create team → add members → create tasks with dependencies → claim/assign →
|
|
8
|
-
* work → report → status → delete.
|
|
9
|
-
* @module dsh-agent-teams/tools
|
|
10
|
-
*/
|
|
1
|
+
import { drainMemberChildren } from "./harness-compat.js";
|
|
11
2
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
12
3
|
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
13
4
|
import { join } from 'node:path';
|
|
@@ -15,14 +6,14 @@ import { appendTeamEvent, captainSessionOf } from "./events.js";
|
|
|
15
6
|
import { amendTaskContract, acknowledgeMailbox, markMailboxDelivered, discardMailboxMessages, appendMailbox, archiveTeamDir, beginTaskAttempt, CAPTAIN_KEY, createMessage, createTeamDir, findTeamByCaptain, findTeamByParticipant, cancelUnfinishedTask, invalidateTaskAttempt, readUnreadMailbox, readMailbox, recordRetiredMemberIds, releaseMailboxDelivery, readTeam, sanitizeKey, transitionError, unsatisfiedDependencies, withTeamLock, writeTeam, validateCreateTask, evaluateQualityCompletion, planQualityFollowUp, resumeTeamState, buildCoverageMatrix, canDeclareDelivery, describeQualityLoop, sanitizeReviewAcceptance, sanitizeReviewObjective, isValidFindingLine, normalizeBlankOptionalTaskFields, taskKindOf, } from "./state.js";
|
|
16
7
|
import { appendTaskEvidence } from "./quality-gates.js";
|
|
17
8
|
import { artifactDrift, bindReviewToRevision, isQualityKind, verdictScopePatterns, } from "./quality-gates.js";
|
|
18
|
-
import {
|
|
9
|
+
import { workspaceAuditor } from "./workspace-audit-service.js";
|
|
19
10
|
import { readArtifactScope, snapshotWorkspacePaths, workspacePathExists } from "./artifacts.js";
|
|
20
|
-
import {
|
|
11
|
+
import { agentTeamsSource, observedSessionFormatVersion, restrictableToolNames } from "./harness-compat.js";
|
|
21
12
|
import { memberSpawnRelaxableDeny, optionalToolPolicy, requireToolPolicy, resolveMemberToolFilter } from "./tool-policies.js";
|
|
22
13
|
import { captainRouteOf, deliverToMember, installRetiredMemberGuard, installMemberSelectionRuntime, installMemberDelegationGuard, memberActivity, resolveMemberLlmSelection, spawnMember, steerCaptainReport, validateMemberLlmSelections, } from "./members.js";
|
|
23
14
|
import { TERMINAL_TASK_STATUSES } from "./types.js";
|
|
24
15
|
import { collectCompletedDependencyOutputs, formatDependencyOutputs, installTeamScheduler } from "./scheduler.js";
|
|
25
|
-
import { installMailboxAdmission, isCurrentMail, mailboxContent, mailboxPrompt,
|
|
16
|
+
import { installMailboxAdmission, isCurrentMail, mailboxContent, mailboxPrompt, readCurrentMailboxLocked } from "./mailbox.js";
|
|
26
17
|
import { resolveTeamProfile } from "./profiles.js";
|
|
27
18
|
import { forkLineageNote, leadIdentityOfAsync, nearestLiveLead, sessionLeadsTeamAsync } from "./lineage.js";
|
|
28
19
|
export { steerCaptainReport } from "./members.js";
|
|
@@ -157,6 +148,31 @@ function trimmedOptional(value) {
|
|
|
157
148
|
const trimmed = value?.trim();
|
|
158
149
|
return trimmed === undefined || trimmed === '' ? undefined : trimmed;
|
|
159
150
|
}
|
|
151
|
+
/** Whether one materialized plan member carries no roster content at all. */
|
|
152
|
+
function isEmptyPlanMember(member) {
|
|
153
|
+
if (member === undefined || member === null)
|
|
154
|
+
return true;
|
|
155
|
+
if (typeof member !== 'object')
|
|
156
|
+
return typeof member === 'string' && member.trim() === '';
|
|
157
|
+
return Object.values(member).every(value => value === undefined || value === null || (typeof value === 'string' && value.trim() === ''));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Some model gateways materialize optional object parameters instead of
|
|
161
|
+
* omitting them: a call that only passed `profile` arrives carrying
|
|
162
|
+
* `plan: { members: [], tasks: [] }`, or one placeholder member whose every
|
|
163
|
+
* field is blank (issue #234). Such a plan carries no roster, so it must count
|
|
164
|
+
* as an omitted plan — the same invariant issue #99 established for a blank
|
|
165
|
+
* `profile` string (a materialized blank equals "not provided").
|
|
166
|
+
* @param plan - the materialized inline plan argument.
|
|
167
|
+
* @returns whether the plan carries no member content and no task at all.
|
|
168
|
+
*/
|
|
169
|
+
function isEmptyInlinePlan(plan) {
|
|
170
|
+
const members = plan.members;
|
|
171
|
+
const tasks = plan.tasks;
|
|
172
|
+
const emptyMembers = !Array.isArray(members) || members.length === 0 || members.every(member => isEmptyPlanMember(member));
|
|
173
|
+
const emptyTasks = !Array.isArray(tasks) || tasks.length === 0;
|
|
174
|
+
return emptyMembers && emptyTasks;
|
|
175
|
+
}
|
|
160
176
|
/**
|
|
161
177
|
* Resolve one member's selected tool policy into the persisted policy id and
|
|
162
178
|
* the immutable effective filter (#59).
|
|
@@ -476,11 +492,13 @@ export function stagedPlanFeedbackContext(teamName) {
|
|
|
476
492
|
* @param config - resolved tool config.
|
|
477
493
|
*/
|
|
478
494
|
export function registerAgentTeamsTools(ctx, config) {
|
|
495
|
+
// Own the lazy worker before any asynchronous tool/route callback can race
|
|
496
|
+
// with unload. Late callbacks retain a closed service and fail safely.
|
|
497
|
+
const auditor = workspaceAuditor(ctx);
|
|
479
498
|
installRetiredMemberGuard(ctx, config.stateDir);
|
|
480
499
|
installMemberDelegationGuard(ctx, config.stateDir, config.memberMaxDepth ?? 0);
|
|
481
500
|
installMailboxAdmission(ctx, config.stateDir);
|
|
482
501
|
const scheduler = installTeamScheduler(ctx, { stateDir: config.stateDir, executionPrompt: config.executionPrompt, dispatch: dispatchMember });
|
|
483
|
-
const memberSelections = installMemberSelectionRuntime(ctx, config.stateDir, (workspace, teamId, memberName) => (scheduler.kickMember(workspace, teamId, memberName)), config.executionPrompt);
|
|
484
502
|
async function dispatchMember(captain, teamId, memberName, text, signal, mode, attemptId) {
|
|
485
503
|
const root = stateRootOf(workspaceOf(captain), config);
|
|
486
504
|
// Record why a member never started. The scheduler treats a failed dispatch as
|
|
@@ -715,7 +733,7 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
715
733
|
try {
|
|
716
734
|
captain.followup(createUserMessage({
|
|
717
735
|
content: [{ type: 'text', text: stagedPlanFeedbackContext(prepared.teamName) }],
|
|
718
|
-
source: { kind: 'agent-teams' },
|
|
736
|
+
source: agentTeamsSource({ kind: 'agent-teams' }, observedSessionFormatVersion(captain)),
|
|
719
737
|
}));
|
|
720
738
|
}
|
|
721
739
|
catch (error) {
|
|
@@ -753,7 +771,7 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
753
771
|
try {
|
|
754
772
|
captain.inject(createUserMessage({
|
|
755
773
|
content: [{ type: 'text', text: stagedPlanDiscardContext(discarded.teamName) }],
|
|
756
|
-
source: { kind: 'agent-teams' },
|
|
774
|
+
source: agentTeamsSource({ kind: 'agent-teams' }, observedSessionFormatVersion(captain)),
|
|
757
775
|
}));
|
|
758
776
|
}
|
|
759
777
|
catch (error) {
|
|
@@ -765,14 +783,6 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
765
783
|
captain.cancel({ kind: 'user' }, { keepInbox: true });
|
|
766
784
|
return { teamId: discarded.teamId };
|
|
767
785
|
};
|
|
768
|
-
const runtime = {
|
|
769
|
-
isPendingMember: memberSelections.isPendingMember,
|
|
770
|
-
updateStagedPlan,
|
|
771
|
-
updateStagedPlanBatch,
|
|
772
|
-
approveStagedTeam,
|
|
773
|
-
continueStagedPlanning,
|
|
774
|
-
discardStagedTeam,
|
|
775
|
-
};
|
|
776
786
|
ctx.tools.register(defineTool({
|
|
777
787
|
name: 'agent_teams_create',
|
|
778
788
|
description: 'Create a team. Use approval=required for a two-phase plan: members and tasks remain unspawned/unclaimed until the user reviews the Web plan and explicitly approves it. Optional profiles expand their configured roster; seed profiles also expand template tasks, while captain profiles leave the graph for the Captain to design. approval=automatic preserves the legacy immediate-execution path.',
|
|
@@ -858,7 +868,11 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
858
868
|
const profileName = args.profile !== undefined && args.profile.trim() !== ''
|
|
859
869
|
? args.profile.trim()
|
|
860
870
|
: undefined;
|
|
861
|
-
|
|
871
|
+
// Gateways materialize the optional `plan` object the same way (issue
|
|
872
|
+
// #234): an empty shell carries no roster, so it is an omitted plan and
|
|
873
|
+
// the profile / inline-plan exclusion below stays untouched.
|
|
874
|
+
const inlinePlan = args.plan !== undefined && !isEmptyInlinePlan(args.plan) ? args.plan : undefined;
|
|
875
|
+
if (profileName !== undefined && inlinePlan !== undefined)
|
|
862
876
|
throw new Error('choose either a configured profile or an inline plan');
|
|
863
877
|
const created = await withTeamLock(captainLockKey(stateRoot, captain.id), async () => {
|
|
864
878
|
const current = await findTeamByParticipant(stateRoot, captain.id, await leadIdentityOfAsync(ctx, captain.session));
|
|
@@ -875,7 +889,7 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
875
889
|
if (existing !== undefined) {
|
|
876
890
|
throw new Error(`team id "${teamId}" is taken by another captain — pick a different team name`);
|
|
877
891
|
}
|
|
878
|
-
if (profileName === undefined &&
|
|
892
|
+
if (profileName === undefined && inlinePlan === undefined) {
|
|
879
893
|
const state = {
|
|
880
894
|
name: teamName,
|
|
881
895
|
id: teamId,
|
|
@@ -900,7 +914,7 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
900
914
|
teamName,
|
|
901
915
|
teamId,
|
|
902
916
|
profileName: profileName ?? 'inline-plan',
|
|
903
|
-
inlinePlan
|
|
917
|
+
inlinePlan,
|
|
904
918
|
description: args.description,
|
|
905
919
|
staged,
|
|
906
920
|
});
|
|
@@ -945,7 +959,7 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
945
959
|
}
|
|
946
960
|
const persisted = await readTeam(stateRoot, created.state.id).catch(() => undefined);
|
|
947
961
|
const snapshot = persisted ?? created.state;
|
|
948
|
-
if (snapshot.profile === undefined &&
|
|
962
|
+
if (snapshot.profile === undefined && inlinePlan === undefined) {
|
|
949
963
|
return {
|
|
950
964
|
team_id: snapshot.id,
|
|
951
965
|
team_name: snapshot.name,
|
|
@@ -1201,11 +1215,11 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
1201
1215
|
throw new Error(`team "${fresh.name}" is at its member cap (${config.maxMembers})`);
|
|
1202
1216
|
}
|
|
1203
1217
|
const selection = await resolveMemberLlmSelection(ctx, captain, {
|
|
1204
|
-
provider: args.provider,
|
|
1205
|
-
model: args.model,
|
|
1218
|
+
provider: trimmedOptional(args.provider),
|
|
1219
|
+
model: trimmedOptional(args.model),
|
|
1206
1220
|
defaultModel: config.memberModel,
|
|
1207
1221
|
defaultProvider: config.memberLlmProvider,
|
|
1208
|
-
reasoningEffort: args.reasoning_effort,
|
|
1222
|
+
reasoningEffort: trimmedOptional(args.reasoning_effort),
|
|
1209
1223
|
fallback: config.fallback,
|
|
1210
1224
|
}, exec.signal);
|
|
1211
1225
|
const toolSelection = memberToolSelection(config, captain, trimmedOptional(args.tool_policy));
|
|
@@ -1640,17 +1654,23 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
1640
1654
|
if (task.reassigning === true) {
|
|
1641
1655
|
throw new Error(`task ${task.id} is being reassigned; wait for the handoff to finish`);
|
|
1642
1656
|
}
|
|
1657
|
+
// Gateways materialize this deprecated optional argument, and a model may
|
|
1658
|
+
// also restate its own member name. A blank or self-valued assignee is
|
|
1659
|
+
// harmless: it asks for exactly what a claim does anyway.
|
|
1660
|
+
const requestedAssignee = typeof args.assignee === 'string' && args.assignee.trim() !== ''
|
|
1661
|
+
? args.assignee.trim()
|
|
1662
|
+
: undefined;
|
|
1643
1663
|
let assignee = task.assignee;
|
|
1644
1664
|
if (identity.kind === 'captain') {
|
|
1645
1665
|
// A captain may read the capability of its already-started takeover,
|
|
1646
1666
|
// but must never create a member claim without dispatching it (#125).
|
|
1647
|
-
if (
|
|
1667
|
+
if (requestedAssignee !== undefined || task.assignee !== CAPTAIN_KEY
|
|
1648
1668
|
|| (task.status !== 'claimed' && task.status !== 'in_progress')) {
|
|
1649
1669
|
throw new Error('claim_task is for members claiming their own task; captains must use agent_teams_reassign_task to assign and wake a member');
|
|
1650
1670
|
}
|
|
1651
1671
|
}
|
|
1652
1672
|
else {
|
|
1653
|
-
if (
|
|
1673
|
+
if (requestedAssignee !== undefined && requestedAssignee !== identity.name) {
|
|
1654
1674
|
throw new Error('members cannot set assignee when claiming a task');
|
|
1655
1675
|
}
|
|
1656
1676
|
if (assignee !== undefined && assignee !== identity.name) {
|
|
@@ -2158,9 +2178,39 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
2158
2178
|
if (await sessionLeadsTeamAsync(ctx, located, caller.id)) {
|
|
2159
2179
|
await scheduler.kickTeam(workspace, located.id, await memberOperationParent(ctx, located, caller));
|
|
2160
2180
|
}
|
|
2161
|
-
const { team, identity } = await withTeamLock(teamLockKey(stateRoot, located.id), () =>
|
|
2181
|
+
const { team, identity, captainInbox, ownInbox, memberInboxes, mailboxWarnings, mailboxWarningCount, } = await withTeamLock(teamLockKey(stateRoot, located.id), async () => {
|
|
2182
|
+
// Authorize and read mail under the same lock. A team name can be
|
|
2183
|
+
// reused while the worker audits the previously captured state.
|
|
2184
|
+
const { team, identity } = await requireFreshParticipant(ctx, stateRoot, located.id, caller.id);
|
|
2185
|
+
const mailboxWarnings = [];
|
|
2186
|
+
let mailboxWarningCount = 0;
|
|
2187
|
+
const reportMalformed = (agentKey) => (lineNumber) => {
|
|
2188
|
+
mailboxWarningCount += 1;
|
|
2189
|
+
if (mailboxWarnings.length < 10)
|
|
2190
|
+
mailboxWarnings.push(`${agentKey} mailbox line ${lineNumber}`);
|
|
2191
|
+
};
|
|
2192
|
+
const captainInbox = identity.kind === 'captain'
|
|
2193
|
+
? (await readCurrentMailboxLocked(stateRoot, team, CAPTAIN_KEY, reportMalformed(CAPTAIN_KEY))).slice(0, 10)
|
|
2194
|
+
: [];
|
|
2195
|
+
let ownInbox = [];
|
|
2196
|
+
const memberInboxes = {};
|
|
2197
|
+
for (const member of team.members) {
|
|
2198
|
+
if (member.status === 'removed' || (identity.kind === 'member' && member.name !== identity.name))
|
|
2199
|
+
continue;
|
|
2200
|
+
const messages = await readCurrentMailboxLocked(stateRoot, team, member.name, reportMalformed(member.name));
|
|
2201
|
+
if (identity.kind === 'member')
|
|
2202
|
+
ownInbox = messages.slice(0, 10);
|
|
2203
|
+
if (messages.length > 0) {
|
|
2204
|
+
memberInboxes[member.name] = {
|
|
2205
|
+
count: messages.length,
|
|
2206
|
+
latest: messages[messages.length - 1]?.content.slice(0, 200) ?? '',
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
return { team, identity, captainInbox, ownInbox, memberInboxes, mailboxWarnings, mailboxWarningCount };
|
|
2211
|
+
});
|
|
2162
2212
|
const activity = memberActivity(ctx, team.members.map((member) => member.id));
|
|
2163
|
-
const audit =
|
|
2213
|
+
const audit = await auditor.audit(workspace, team, stateRoot);
|
|
2164
2214
|
const members = team.members
|
|
2165
2215
|
.filter((member) => member.status !== 'removed')
|
|
2166
2216
|
.map((member) => ({
|
|
@@ -2192,31 +2242,6 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
2192
2242
|
...task.profileSeedId === undefined ? {} : { seed_id: task.profileSeedId },
|
|
2193
2243
|
...task.output !== undefined ? { output: task.output } : {},
|
|
2194
2244
|
}));
|
|
2195
|
-
const mailboxWarnings = [];
|
|
2196
|
-
let mailboxWarningCount = 0;
|
|
2197
|
-
const reportMalformed = (agentKey) => (lineNumber) => {
|
|
2198
|
-
mailboxWarningCount += 1;
|
|
2199
|
-
if (mailboxWarnings.length < 10) {
|
|
2200
|
-
mailboxWarnings.push(`${agentKey} mailbox line ${lineNumber}`);
|
|
2201
|
-
}
|
|
2202
|
-
};
|
|
2203
|
-
const captainInbox = identity.kind === 'captain'
|
|
2204
|
-
? await readCurrentMailbox(stateRoot, team.id, CAPTAIN_KEY, reportMalformed(CAPTAIN_KEY))
|
|
2205
|
-
: [];
|
|
2206
|
-
const ownInbox = identity.kind === 'member' ? (await readCurrentMailbox(stateRoot, team.id, identity.name)).slice(0, 10) : [];
|
|
2207
|
-
const memberInboxes = {};
|
|
2208
|
-
const visibleMembers = identity.kind === 'captain'
|
|
2209
|
-
? members
|
|
2210
|
-
: members.filter((member) => member.name === identity.name);
|
|
2211
|
-
for (const member of visibleMembers) {
|
|
2212
|
-
const messages = await readCurrentMailbox(stateRoot, team.id, member.name, reportMalformed(member.name));
|
|
2213
|
-
if (messages.length > 0) {
|
|
2214
|
-
memberInboxes[member.name] = {
|
|
2215
|
-
count: messages.length,
|
|
2216
|
-
latest: messages[messages.length - 1]?.content.slice(0, 200) ?? '',
|
|
2217
|
-
};
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
2245
|
const coverage = buildCoverageMatrix([...new Set(team.tasks.flatMap((item) => item.coverageOf ?? []))], team.tasks).map((row) => ({
|
|
2221
2246
|
goal_item: row.goal_item,
|
|
2222
2247
|
task_ids: [...row.task_ids],
|
|
@@ -2254,7 +2279,7 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
2254
2279
|
viewer: identity.name,
|
|
2255
2280
|
members,
|
|
2256
2281
|
tasks,
|
|
2257
|
-
captain_inbox: captainInbox.
|
|
2282
|
+
captain_inbox: captainInbox.map((message) => ({
|
|
2258
2283
|
from: message.from,
|
|
2259
2284
|
content: mailboxContent(message),
|
|
2260
2285
|
ts: message.ts,
|
|
@@ -2265,10 +2290,20 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
2265
2290
|
mailbox_warning_count: mailboxWarningCount,
|
|
2266
2291
|
};
|
|
2267
2292
|
const acknowledged = identity.kind === 'captain'
|
|
2268
|
-
? captainInbox.
|
|
2293
|
+
? captainInbox.map(message => message.id)
|
|
2269
2294
|
: ownInbox.map(message => message.id);
|
|
2270
2295
|
if (acknowledged.length > 0) {
|
|
2271
|
-
await withTeamLock(teamLockKey(stateRoot, team.id), () =>
|
|
2296
|
+
await withTeamLock(teamLockKey(stateRoot, team.id), async () => {
|
|
2297
|
+
// Keep acknowledgement after the audit, and never write through
|
|
2298
|
+
// the captured identity if the live team or recipient changed.
|
|
2299
|
+
const current = await readTeam(stateRoot, team.id).catch(() => undefined);
|
|
2300
|
+
if (current === undefined || current.captainSessionId !== team.captainSessionId || current.createdAt !== team.createdAt)
|
|
2301
|
+
return;
|
|
2302
|
+
const recipient = await participantIdentityOf(ctx, current, caller.id);
|
|
2303
|
+
if (recipient?.kind !== identity.kind || recipient.name !== identity.name)
|
|
2304
|
+
return;
|
|
2305
|
+
await acknowledgeMailbox(stateRoot, team.id, recipient.name, acknowledged);
|
|
2306
|
+
});
|
|
2272
2307
|
}
|
|
2273
2308
|
return result;
|
|
2274
2309
|
},
|
|
@@ -2381,10 +2416,34 @@ export function registerAgentTeamsTools(ctx, config) {
|
|
|
2381
2416
|
return { deleted: true, team_name: team.name };
|
|
2382
2417
|
},
|
|
2383
2418
|
}));
|
|
2419
|
+
// Live-member hydration validates saved filters against registered tools.
|
|
2420
|
+
const memberSelections = installMemberSelectionRuntime(ctx, config.stateDir, (workspace, teamId, memberName) => (scheduler.kickMember(workspace, teamId, memberName)));
|
|
2421
|
+
const runtime = {
|
|
2422
|
+
isPendingMember: memberSelections.isPendingMember,
|
|
2423
|
+
updateStagedPlan,
|
|
2424
|
+
updateStagedPlanBatch,
|
|
2425
|
+
approveStagedTeam,
|
|
2426
|
+
continueStagedPlanning,
|
|
2427
|
+
discardStagedTeam,
|
|
2428
|
+
};
|
|
2384
2429
|
return runtime;
|
|
2385
2430
|
}
|
|
2386
2431
|
async function initializeProfileTeam(input) {
|
|
2387
|
-
|
|
2432
|
+
// Tool gateways can materialize omitted optional strings as blanks (#234).
|
|
2433
|
+
// Normalize only the tool-supplied roster; owner profile validation remains
|
|
2434
|
+
// strict, and required fields, unknown policies and route pairing still fail.
|
|
2435
|
+
const inlinePlan = input.inlinePlan === undefined ? undefined : {
|
|
2436
|
+
...input.inlinePlan,
|
|
2437
|
+
members: input.inlinePlan.members.map(member => ({
|
|
2438
|
+
...member,
|
|
2439
|
+
role: trimmedOptional(member.role),
|
|
2440
|
+
provider: trimmedOptional(member.provider),
|
|
2441
|
+
model: trimmedOptional(member.model),
|
|
2442
|
+
reasoning_effort: trimmedOptional(member.reasoning_effort),
|
|
2443
|
+
tool_policy: trimmedOptional(member.tool_policy),
|
|
2444
|
+
})),
|
|
2445
|
+
};
|
|
2446
|
+
const profile = resolveTeamProfile(inlinePlan === undefined ? input.config.profiles : { [input.profileName]: inlinePlan }, input.profileName, input.config.maxMembers);
|
|
2388
2447
|
const selections = [];
|
|
2389
2448
|
for (const template of profile.members) {
|
|
2390
2449
|
selections.push(await resolveMemberLlmSelection(input.ctx, input.captain, {
|
package/lib/types/artifacts.d.ts
CHANGED
|
@@ -38,10 +38,13 @@ export interface ArtifactScopeRead {
|
|
|
38
38
|
gaps: ArtifactScopeGap[];
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* Read
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* Read related scopes in one audit. Each scope retains its own expansion cap
|
|
42
|
+
* and gaps, but overlapping paths hash only once. A final revalidation rejects
|
|
43
|
+
* changed file identities and changed directory membership instead of handing
|
|
44
|
+
* out a mixture of revisions as complete evidence.
|
|
44
45
|
*/
|
|
46
|
+
export declare function readArtifactScopes(workspace: string, scopes: readonly (readonly string[])[]): ArtifactScopeRead[];
|
|
47
|
+
/** Read one scope without retaining byte identities for the next request. */
|
|
45
48
|
export declare function readArtifactScope(workspace: string, patterns: readonly string[]): ArtifactScopeRead;
|
|
46
49
|
/**
|
|
47
50
|
* Read the current bytes of workspace-relative paths (directories expand).
|
|
@@ -22,7 +22,7 @@ export interface ActivityTask {
|
|
|
22
22
|
readonly subject: string;
|
|
23
23
|
readonly description?: string;
|
|
24
24
|
readonly status: string;
|
|
25
|
-
readonly state: 'blocked' | 'open' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
25
|
+
readonly state: 'blocked' | 'open' | 'claimed' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
26
26
|
readonly assignee: string;
|
|
27
27
|
readonly model?: string;
|
|
28
28
|
readonly dependencies: readonly string[];
|
|
@@ -90,8 +90,10 @@ export declare function settleActivityMonitorTargets(keys: ReadonlySet<string>):
|
|
|
90
90
|
export declare function subscribeActivitySnapshots(listener: () => void): () => void;
|
|
91
91
|
/** Read the stable shared live/archive snapshot. */
|
|
92
92
|
export declare function getActivitySnapshotsSnapshot(): ActivitySnapshots;
|
|
93
|
-
/**
|
|
94
|
-
export declare function
|
|
93
|
+
/** Read the rows owned by one route and optional scope for ETag comparison. */
|
|
94
|
+
export declare function getPublishedActivityRows(field: keyof ActivitySnapshots, scope?: string): readonly ActivityTeam[] | undefined;
|
|
95
|
+
/** Publish full state-route responses or replace the rows for just one captain. */
|
|
96
|
+
export declare function updateActivitySnapshots(update: Partial<ActivitySnapshots>, scope?: string): void;
|
|
95
97
|
/** Poll cadence for the live host snapshot route. */
|
|
96
98
|
export declare const ACTIVITY_POLL_MS = 1000;
|
|
97
99
|
/**
|
|
@@ -106,6 +108,10 @@ export declare const ACTIVITY_STATE_URL = "/plugins/dsh-agent-teams/state";
|
|
|
106
108
|
export declare const ACTIVITY_HALT_URL = "/plugins/dsh-agent-teams/halt";
|
|
107
109
|
interface ActivityFetchResponse {
|
|
108
110
|
readonly ok: boolean;
|
|
111
|
+
readonly status?: number;
|
|
112
|
+
readonly headers?: {
|
|
113
|
+
get(name: string): string | null;
|
|
114
|
+
};
|
|
109
115
|
json(): Promise<unknown>;
|
|
110
116
|
}
|
|
111
117
|
/** Injectable browser primitives used by the poll controller and its tests. */
|
|
@@ -121,10 +127,13 @@ export interface ActivityPollingRuntime {
|
|
|
121
127
|
readonly fetchState?: (url: string, init: {
|
|
122
128
|
readonly cache: 'no-store';
|
|
123
129
|
readonly signal: AbortSignal;
|
|
130
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
124
131
|
}) => Promise<ActivityFetchResponse>;
|
|
125
132
|
readonly schedule?: (callback: () => void, intervalMs: number) => unknown;
|
|
126
133
|
readonly cancel?: (timer: unknown) => void;
|
|
127
|
-
readonly publishSnapshots?: (update: Partial<ActivitySnapshots
|
|
134
|
+
readonly publishSnapshots?: (update: Partial<ActivitySnapshots>, scope?: string) => void;
|
|
135
|
+
/** Read back the shared store when supplying a custom publisher for it. */
|
|
136
|
+
readonly getPublishedRows?: typeof getPublishedActivityRows;
|
|
128
137
|
readonly settleTargets?: (keys: ReadonlySet<string>) => void;
|
|
129
138
|
}
|
|
130
139
|
/** Handle returned by one current-session polling loop. */
|
|
@@ -22,6 +22,11 @@ export declare const zh: {
|
|
|
22
22
|
'workspace.completed': string;
|
|
23
23
|
'workspace.focus': string;
|
|
24
24
|
'workspace.noTasks': string;
|
|
25
|
+
'workspace.inbox': string;
|
|
26
|
+
'workspace.inboxHint': string;
|
|
27
|
+
'workspace.inboxEmpty': string;
|
|
28
|
+
'workspace.taskSummary': string;
|
|
29
|
+
'workspace.verdictStale': string;
|
|
25
30
|
'card.memberCount': string;
|
|
26
31
|
'action.openActivityPanel': string;
|
|
27
32
|
'activity.panelButton': string;
|
|
@@ -83,6 +88,7 @@ export declare const zh: {
|
|
|
83
88
|
'task.summary.blockedAndRunning': string;
|
|
84
89
|
'task.summary.more': string;
|
|
85
90
|
'task.summary.running': string;
|
|
91
|
+
'task.summary.claimed': string;
|
|
86
92
|
'task.summary.ready': string;
|
|
87
93
|
'task.summary.blocked': string;
|
|
88
94
|
'task.summary.failedSettled': string;
|
|
@@ -90,6 +96,7 @@ export declare const zh: {
|
|
|
90
96
|
'progress.aria': string;
|
|
91
97
|
'progress.title': string;
|
|
92
98
|
'progress.running': string;
|
|
99
|
+
'progress.claimed': string;
|
|
93
100
|
'progress.blocked': string;
|
|
94
101
|
'progress.delivered': string;
|
|
95
102
|
'dependency.aria': string;
|
|
@@ -249,6 +256,11 @@ export declare const en: {
|
|
|
249
256
|
'workspace.completed': string;
|
|
250
257
|
'workspace.focus': string;
|
|
251
258
|
'workspace.noTasks': string;
|
|
259
|
+
'workspace.inbox': string;
|
|
260
|
+
'workspace.inboxHint': string;
|
|
261
|
+
'workspace.inboxEmpty': string;
|
|
262
|
+
'workspace.taskSummary': string;
|
|
263
|
+
'workspace.verdictStale': string;
|
|
252
264
|
'card.memberCount': string;
|
|
253
265
|
'action.openActivityPanel': string;
|
|
254
266
|
'activity.panelButton': string;
|
|
@@ -310,6 +322,7 @@ export declare const en: {
|
|
|
310
322
|
'task.summary.blockedAndRunning': string;
|
|
311
323
|
'task.summary.more': string;
|
|
312
324
|
'task.summary.running': string;
|
|
325
|
+
'task.summary.claimed': string;
|
|
313
326
|
'task.summary.ready': string;
|
|
314
327
|
'task.summary.blocked': string;
|
|
315
328
|
'task.summary.failedSettled': string;
|
|
@@ -317,6 +330,7 @@ export declare const en: {
|
|
|
317
330
|
'progress.aria': string;
|
|
318
331
|
'progress.title': string;
|
|
319
332
|
'progress.running': string;
|
|
333
|
+
'progress.claimed': string;
|
|
320
334
|
'progress.blocked': string;
|
|
321
335
|
'progress.delivered': string;
|
|
322
336
|
'dependency.aria': string;
|