@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
|
@@ -8,24 +8,46 @@
|
|
|
8
8
|
* sendMessage instead steers a running Agent and must never carry team jobs.
|
|
9
9
|
*/
|
|
10
10
|
import type { Context } from '@deepseek-ai/cordis';
|
|
11
|
-
import type
|
|
11
|
+
import { type Agent, type AgentOptions, type ModelSelection } from '@deepseek-ai/dsh-agent';
|
|
12
12
|
import type { ContentBlock, MessageId, MessageSource } from '@deepseek-ai/dsh-llm';
|
|
13
13
|
import type { Session, SessionEvent, SessionId } from '@deepseek-ai/dsh-session';
|
|
14
14
|
import { type MemberToolFilter } from './tool-policies.ts';
|
|
15
15
|
type Setup = (childCtx: Context, child: Agent) => () => void;
|
|
16
|
-
/**
|
|
17
|
-
interface MemberStartSpec {
|
|
16
|
+
/** Version-independent creation contract; legacy-only options stay at this seam. */
|
|
17
|
+
export interface MemberStartSpec {
|
|
18
18
|
provider: string;
|
|
19
|
-
label
|
|
19
|
+
label: string;
|
|
20
20
|
request: {
|
|
21
21
|
parent: Agent;
|
|
22
22
|
prompt: ContentBlock[];
|
|
23
|
+
agentOptions?: AgentOptions;
|
|
23
24
|
persona?: string;
|
|
24
25
|
toolFilter?: MemberToolFilter;
|
|
25
|
-
agentOptions?: ModelSelection;
|
|
26
26
|
};
|
|
27
27
|
signal: AbortSignal;
|
|
28
28
|
}
|
|
29
|
+
export declare function usesManagedActivations(runtime: Context['subagents']): boolean;
|
|
30
|
+
export declare function startMember(runtime: Context['subagents'], spec: MemberStartSpec): Promise<{
|
|
31
|
+
childId: SessionId;
|
|
32
|
+
}>;
|
|
33
|
+
/** Wrap every available creation API, restoring only this plugin's own methods. */
|
|
34
|
+
export declare function guardSubagentCreation(ctx: Context, check: (parent: Agent) => void): void;
|
|
35
|
+
/**
|
|
36
|
+
* Install the member's next-step model selection hook on a child context.
|
|
37
|
+
*
|
|
38
|
+
* 0.2.1 hosts take a caller-owned selection ref here; 0.2.2 moved the selected
|
|
39
|
+
* route into the Agent's own durable model API, so the hook contributes switch
|
|
40
|
+
* notices only and takes the child context alone. Dispatch on the function's
|
|
41
|
+
* own arity so one build serves both declared host lines instead of binding to
|
|
42
|
+
* whichever signature the development host happens to ship.
|
|
43
|
+
* @param childCtx - the member child context the hook belongs to.
|
|
44
|
+
* @param ref - the resolved selection the member is running on.
|
|
45
|
+
* @returns the disposal for the installed hook.
|
|
46
|
+
*/
|
|
47
|
+
export declare function installMemberModelSelection(childCtx: Context, ref: {
|
|
48
|
+
current: ModelSelection;
|
|
49
|
+
assembled?: ModelSelection;
|
|
50
|
+
}): () => void;
|
|
29
51
|
declare module '@deepseek-ai/dsh-llm' {
|
|
30
52
|
interface MessageSourceMap {
|
|
31
53
|
'agent-teams': {
|
|
@@ -33,14 +55,6 @@ declare module '@deepseek-ai/dsh-llm' {
|
|
|
33
55
|
};
|
|
34
56
|
}
|
|
35
57
|
}
|
|
36
|
-
/** 在 0.2.1 的 activation 契约上保留旧版持久子会话与父级通知语义。 */
|
|
37
|
-
export declare function startMember(runtime: Context['subagents'], spec: MemberStartSpec): Promise<{
|
|
38
|
-
childId: SessionId;
|
|
39
|
-
}>;
|
|
40
|
-
/** 新旧宿主均只停止指定成员子树,保留原生接收者与停止失败。 */
|
|
41
|
-
export declare function drainMemberChildren(runtime: Context['subagents'], parent: Agent, childIds: readonly SessionId[]): Promise<void>;
|
|
42
|
-
/** 只包装真实存在的接口,避免把缺失的旧方法伪装成可调用方法。 */
|
|
43
|
-
export declare function guardSubagentCreation(ctx: Context, check: (parent: Agent) => void): void;
|
|
44
58
|
/** Package identity a released plugin-wrapper source names on older hosts. */
|
|
45
59
|
export declare const AGENT_TEAMS_PLUGIN_NAME = "@nanmicoder/dsh-agent-teams";
|
|
46
60
|
/**
|
|
@@ -59,8 +73,33 @@ export type AgentTeamsSource = {
|
|
|
59
73
|
readonly goal?: string;
|
|
60
74
|
readonly profile?: string;
|
|
61
75
|
};
|
|
62
|
-
/**
|
|
63
|
-
export
|
|
76
|
+
/** Anything that exposes the stored format generation on its live session header. */
|
|
77
|
+
export interface SessionFormatBearer {
|
|
78
|
+
readonly session?: {
|
|
79
|
+
readonly header?: {
|
|
80
|
+
readonly version?: unknown;
|
|
81
|
+
};
|
|
82
|
+
} | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Stored format generation observed on a live session, when the host exposes it.
|
|
86
|
+
*
|
|
87
|
+
* The module constant is only a fallback: a plugin can resolve a *nested*
|
|
88
|
+
* `@deepseek-ai/dsh-session` copy that belongs to a different host generation
|
|
89
|
+
* than the process loading it (a profile whose lockfile pins the DSH package
|
|
90
|
+
* line, a Desktop shell with an embedded core, a duplicated store). That copy
|
|
91
|
+
* then reports the wrong generation — 0 on a v4 host — which selects the
|
|
92
|
+
* retired `plugin` wrapper and makes every durable AgentTeams message fail the
|
|
93
|
+
* host's own admission check (#236). The live session header belongs to the
|
|
94
|
+
* host that persists the message, so it outranks the resolved module.
|
|
95
|
+
*/
|
|
96
|
+
export declare function observedSessionFormatVersion(subject?: SessionFormatBearer): number | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Stored session format generation of the running host; 0 when neither the live
|
|
99
|
+
* session nor the resolved module exposes one.
|
|
100
|
+
* @param observed - a live session observation; preferred over the module constant.
|
|
101
|
+
*/
|
|
102
|
+
export declare function hostSessionFormatVersion(observed?: number): number;
|
|
64
103
|
/**
|
|
65
104
|
* Source for one AgentTeams-authored message on the running host.
|
|
66
105
|
*
|
|
@@ -73,9 +112,13 @@ export declare function hostSessionFormatVersion(): number;
|
|
|
73
112
|
* the released plugin wrapper is used instead; the goal and profile already
|
|
74
113
|
* travel in the message text.
|
|
75
114
|
* @param modern - the producer-owned source to use where the host admits it.
|
|
115
|
+
* @param observed - the live session's stored format generation, when callers
|
|
116
|
+
* have the owning agent at hand. Never trust the resolved module alone: on a
|
|
117
|
+
* host whose profile pins another DSH line it reports a retired generation and
|
|
118
|
+
* the v4 writer rejects the wrapper (#236).
|
|
76
119
|
* @returns a source accepted by the running host and by its migration chain.
|
|
77
120
|
*/
|
|
78
|
-
export declare function agentTeamsSource(modern: AgentTeamsSource): MessageSource;
|
|
121
|
+
export declare function agentTeamsSource(modern: AgentTeamsSource, observed?: number): MessageSource;
|
|
79
122
|
/**
|
|
80
123
|
* 0.1.6 moved startup admission to serial agent/created. Older created events
|
|
81
124
|
* have no source and precede session-start; ignore those until the old hook.
|
|
@@ -84,6 +127,8 @@ export declare function agentTeamsSource(modern: AgentTeamsSource): MessageSourc
|
|
|
84
127
|
export declare function onAgentReady(ctx: Context, listener: (agent: Agent, vetoable: boolean) => void): () => void;
|
|
85
128
|
/** Read child-owned history, excluding any descriptor inherited from a parent. */
|
|
86
129
|
export declare function sessionOwnEvents(session: Session): readonly SessionEvent[];
|
|
130
|
+
/** Legacy hosts log each chunk separately; current hosts embed the committed stream. */
|
|
131
|
+
export declare function outputLimitTurn(event: SessionEvent): number | undefined;
|
|
87
132
|
/** 读取宿主冻结的会话策略,旧版没有投影服务时检查本会话日志。 */
|
|
88
133
|
export declare function assertMemberModelSelection(ctx: Context, captain: Agent, route: {
|
|
89
134
|
provider: string;
|
|
@@ -147,4 +192,6 @@ export declare function memberToolFilter(maxDepth: number | undefined, knownTool
|
|
|
147
192
|
* @returns the started member.
|
|
148
193
|
*/
|
|
149
194
|
export declare function startMemberWithLenientFilter<T>(start: (filter: MemberToolFilter) => Promise<T>, filter: MemberToolFilter, relaxableDeny?: readonly string[]): Promise<T>;
|
|
195
|
+
/** Targeted recursive cancellation renamed with the unified activation manager. */
|
|
196
|
+
export declare function drainMemberChildren(runtime: Context['subagents'], parent: Agent, ids: readonly SessionId[]): Promise<void>;
|
|
150
197
|
export {};
|
package/lib/types/mailbox.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import type { TeamMessage, TeamState } from './types.ts';
|
|
|
4
4
|
export declare function isCurrentMail(team: TeamState, message: TeamMessage): boolean;
|
|
5
5
|
/** Include structured provenance even in the status-tool fallback presentation. */
|
|
6
6
|
export declare function mailboxContent(message: TeamMessage): string;
|
|
7
|
+
/** Read current mail while the caller holds the lock and has verified the team. */
|
|
8
|
+
export declare function readCurrentMailboxLocked(root: string, team: TeamState, recipient: string, onMalformed?: (line: number) => void): Promise<TeamMessage[]>;
|
|
7
9
|
/** Fallback reads must enforce the same current-generation rule as live admission. */
|
|
8
10
|
export declare function readCurrentMailbox(root: string, teamId: string, recipient: string, onMalformed?: (line: number) => void): Promise<TeamMessage[]>;
|
|
9
11
|
export declare function mailboxPrompt(teamId: string, recipient: string, messages: readonly TeamMessage[]): string;
|
package/lib/types/members.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import type { Context } from '@deepseek-ai/cordis';
|
|
15
15
|
import { type Agent } from '@deepseek-ai/dsh-agent';
|
|
16
16
|
import type { Session } from '@deepseek-ai/dsh-session';
|
|
17
|
+
import { type SessionFormatBearer } from './harness-compat.ts';
|
|
17
18
|
import type { MemberToolFilter } from './tool-policies.ts';
|
|
18
19
|
import { type TeamMember, type TeamState, type TeamTask } from './types.ts';
|
|
19
20
|
/** Persona snapshot of a profile protocol; the full text lives on team.json. */
|
|
@@ -120,22 +121,12 @@ export declare function composeMemberRoute(request: Pick<MemberLlmSelectionReque
|
|
|
120
121
|
readonly provider: string;
|
|
121
122
|
readonly model: string;
|
|
122
123
|
}): MemberRouteResolution | undefined;
|
|
123
|
-
/**
|
|
124
|
-
* 新版(preset-only)宿主不再声明 persona/toolFilter 能力位,改由插件在成员
|
|
125
|
-
* 首个请求前自行安装;这里就是那份被安装的组合。
|
|
126
|
-
*/
|
|
127
|
-
interface MemberComposition {
|
|
128
|
-
persona: string;
|
|
129
|
-
toolFilter: MemberToolFilter;
|
|
130
|
-
}
|
|
131
124
|
/** Process-local bridge between spawn admission and synchronous child setup. */
|
|
132
125
|
export interface MemberSelectionRuntime {
|
|
133
|
-
/** 已安装可拒绝创建的成员组合钩子,不能只略过宿主能力检查。 */
|
|
134
|
-
readonly scopedComposition?: true;
|
|
135
126
|
/** Trusted fresh-child admission, before the durable member id is written. */
|
|
136
127
|
isPendingMember(agent: Agent): boolean;
|
|
137
128
|
/** Make one selection visible while Harness materializes the fresh child. */
|
|
138
|
-
withPending<T>(parentSessionId: string, label: string, selection: MemberLlmSelection, operation: () => Promise<T>,
|
|
129
|
+
withPending<T>(parentSessionId: string, label: string, selection: MemberLlmSelection, operation: () => Promise<T>, setup?: TeamMember['runtimeSetup']): Promise<T>;
|
|
139
130
|
}
|
|
140
131
|
/**
|
|
141
132
|
* Validate a resolved roster against every provider catalog before any child
|
|
@@ -161,11 +152,12 @@ export declare function selectFallbackRoute(current: {
|
|
|
161
152
|
};
|
|
162
153
|
};
|
|
163
154
|
/** Deliver a durable member report to the live captain at its next model step. */
|
|
164
|
-
export declare function steerCaptainReport(captain: Pick<Agent, 'steer'
|
|
155
|
+
export declare function steerCaptainReport(captain: Pick<Agent, 'steer'> & SessionFormatBearer, from: string, content: string, receipt?: string): boolean;
|
|
165
156
|
interface FailedMemberAttempt {
|
|
166
157
|
readonly captainSessionId: string;
|
|
167
158
|
readonly memberId: string;
|
|
168
159
|
readonly task?: Pick<TeamTask, 'id' | 'attempt' | 'attemptId'>;
|
|
160
|
+
readonly openAttemptOnly?: boolean;
|
|
169
161
|
}
|
|
170
162
|
/** How a final member turn failure relates to the durable record. */
|
|
171
163
|
export type MemberFailureDisposition =
|
|
@@ -249,12 +241,8 @@ export declare function resolveMemberLlmSelection(ctx: Context, captain: Agent,
|
|
|
249
241
|
* cold resume restores the same selection from the owning team's durable
|
|
250
242
|
* record. Legacy members without a complete saved route retain Harness's
|
|
251
243
|
* descriptor provider/model behavior.
|
|
252
|
-
* @param ctx - the plugin context (injects `subagents`).
|
|
253
|
-
* @param stateDir - configured state directory, read for cold-resume snapshots.
|
|
254
|
-
* @param onFailureSettled - settlement hook after a member turn failure.
|
|
255
|
-
* @param executionPrompt - plugin-wide execution prompt (a persona input).
|
|
256
244
|
*/
|
|
257
|
-
export declare function installMemberSelectionRuntime(ctx: Context, stateDir: string, onFailureSettled?: (workspace: string, teamId: string, memberName: string) => Promise<void
|
|
245
|
+
export declare function installMemberSelectionRuntime(ctx: Context, stateDir: string, onFailureSettled?: (workspace: string, teamId: string, memberName: string) => Promise<void>): MemberSelectionRuntime;
|
|
258
246
|
/**
|
|
259
247
|
* The member's system prompt (persona), shadowing the deployment persona for
|
|
260
248
|
* that child. Self-contained: it replaces the whole persona section.
|
package/lib/types/snapshot.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import type { Context } from '@deepseek-ai/cordis';
|
|
11
11
|
import type { MemberStatus, TeamState } from './types.ts';
|
|
12
12
|
/** Visual task state for the activity panel. */
|
|
13
|
-
export type VisualTaskState = 'blocked' | 'open' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
13
|
+
export type VisualTaskState = 'blocked' | 'open' | 'claimed' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
14
14
|
/** One member row of the activity snapshot. */
|
|
15
15
|
export interface TeamActivityMember {
|
|
16
16
|
readonly id: string;
|
|
@@ -19,7 +19,7 @@ export interface TeamActivityMember {
|
|
|
19
19
|
readonly provider: string;
|
|
20
20
|
readonly model: string;
|
|
21
21
|
readonly reasoningEffort: string;
|
|
22
|
-
readonly executionPrompt
|
|
22
|
+
readonly executionPrompt?: string;
|
|
23
23
|
readonly status: MemberStatus;
|
|
24
24
|
readonly activity: 'working' | 'idle' | 'unknown';
|
|
25
25
|
readonly progress: number;
|
|
@@ -32,7 +32,7 @@ export interface TeamActivityMember {
|
|
|
32
32
|
export interface TeamActivityTask {
|
|
33
33
|
readonly id: string;
|
|
34
34
|
readonly subject: string;
|
|
35
|
-
readonly description
|
|
35
|
+
readonly description?: string;
|
|
36
36
|
readonly status: string;
|
|
37
37
|
readonly state: VisualTaskState;
|
|
38
38
|
readonly assignee: string;
|
|
@@ -87,6 +87,8 @@ export interface TeamActivitySnapshot {
|
|
|
87
87
|
}
|
|
88
88
|
/** Snapshot projection switches for live and archived teams. */
|
|
89
89
|
export interface TeamSnapshotOptions {
|
|
90
|
+
/** Running panels omit the long text used only by the staging editor. */
|
|
91
|
+
readonly summary?: boolean;
|
|
90
92
|
/** Historic review must retain members that were marked removed at shutdown. */
|
|
91
93
|
readonly includeRemoved?: boolean;
|
|
92
94
|
/** Archived teams have no meaningful live activity after their sessions stop. */
|
|
@@ -113,25 +115,28 @@ export declare function memberModelRoute(member: {
|
|
|
113
115
|
*/
|
|
114
116
|
export declare function assembleTeamSnapshot(ctx: Context, stateRoot: string, workspace: string, state: TeamState, options?: TeamSnapshotOptions): Promise<TeamActivitySnapshot>;
|
|
115
117
|
/**
|
|
116
|
-
* Collect
|
|
118
|
+
* Collect live teams under the given workspace state roots.
|
|
117
119
|
* @param ctx - the plugin context.
|
|
118
120
|
* @param roots - `{ workspace, stateRoot }` pairs (resolved absolute roots).
|
|
121
|
+
* @param captainSessionId - when present, assemble only the requested captain's teams.
|
|
122
|
+
* @param summary - omit editor-only text from running teams.
|
|
119
123
|
* @returns the snapshots in stable order (workspace, then team id).
|
|
120
124
|
*/
|
|
121
125
|
export declare function collectTeamsActivity(ctx: Context, roots: readonly {
|
|
122
126
|
workspace: string;
|
|
123
127
|
stateRoot: string;
|
|
124
128
|
workspacePath?: string;
|
|
125
|
-
}[]): Promise<TeamActivitySnapshot[]>;
|
|
129
|
+
}[], captainSessionId?: string, summary?: boolean): Promise<TeamActivitySnapshot[]>;
|
|
126
130
|
/**
|
|
127
|
-
* Collect
|
|
131
|
+
* Collect archived teams under the given workspace state roots (the
|
|
128
132
|
* `archive/` subdirectory of each state root). Used by the historic panel
|
|
129
133
|
* path to restore full team detail after deletion.
|
|
130
134
|
* @param ctx - the plugin context.
|
|
131
135
|
* @param roots - `{ workspace, stateRoot }` pairs.
|
|
136
|
+
* @param captainSessionId - when present, assemble only the requested captain's teams.
|
|
132
137
|
* @returns the archived snapshots in stable order.
|
|
133
138
|
*/
|
|
134
139
|
export declare function collectArchivedTeamsActivity(ctx: Context, roots: readonly {
|
|
135
140
|
workspace: string;
|
|
136
141
|
stateRoot: string;
|
|
137
|
-
}[]): Promise<TeamActivitySnapshot[]>;
|
|
142
|
+
}[], captainSessionId?: string): Promise<TeamActivitySnapshot[]>;
|
package/lib/types/state.d.ts
CHANGED
|
@@ -102,12 +102,18 @@ export declare function readTeam(stateRoot: string, teamId: string): Promise<Tea
|
|
|
102
102
|
* @returns the team record, or `undefined` when absent.
|
|
103
103
|
*/
|
|
104
104
|
export declare function readTeamSync(stateRoot: string, teamId: string): TeamState | undefined;
|
|
105
|
+
/** Pair a cancellation-sensitive team replacement with its live effect. */
|
|
106
|
+
interface TeamWriteCommit {
|
|
107
|
+
signal: AbortSignal;
|
|
108
|
+
onCommit: () => void;
|
|
109
|
+
}
|
|
105
110
|
/**
|
|
106
111
|
* Persist one team record (inside the caller's lock).
|
|
107
112
|
* @param stateRoot - resolved absolute state root directory.
|
|
108
113
|
* @param state - the record to persist.
|
|
114
|
+
* @param commit - gate and synchronous effect for a cancellation-sensitive replacement.
|
|
109
115
|
*/
|
|
110
|
-
export declare function writeTeam(stateRoot: string, state: TeamState): Promise<void>;
|
|
116
|
+
export declare function writeTeam(stateRoot: string, state: TeamState, commit?: TeamWriteCommit): Promise<void>;
|
|
111
117
|
/** Synchronous role hydration before the host's first prompt assembly. */
|
|
112
118
|
export declare function readRetiredMemberIdsSync(stateRoot: string): Set<string>;
|
|
113
119
|
export declare function readRetiredMemberIds(stateRoot: string): Promise<Set<string>>;
|
|
@@ -241,9 +247,10 @@ export declare function readArchivedTeam(stateRoot: string, teamId: string): Pro
|
|
|
241
247
|
*/
|
|
242
248
|
export declare function listArchivedTeamIds(stateRoot: string): Promise<string[]>;
|
|
243
249
|
/** Visual task state for the activity panel. */
|
|
244
|
-
export type VisualTaskState = 'blocked' | 'open' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
250
|
+
export type VisualTaskState = 'blocked' | 'open' | 'claimed' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
245
251
|
/**
|
|
246
|
-
* The visual state of one task: `
|
|
252
|
+
* The visual state of one task: `claimed` after assignment, `running` only
|
|
253
|
+
* after the explicit in_progress update, `completed`
|
|
247
254
|
* when done, `failed`/`cancelled` when terminal without success, `blocked`
|
|
248
255
|
* while any dependency is unfinished, else `open`.
|
|
249
256
|
*/
|
package/lib/types/types.d.ts
CHANGED
|
@@ -253,6 +253,11 @@ export interface TeamMember {
|
|
|
253
253
|
* the persona and this filter from.
|
|
254
254
|
*/
|
|
255
255
|
toolFilter?: MemberToolFilter;
|
|
256
|
+
/** Exact child-scoped setup restored on hosts with managed activations. */
|
|
257
|
+
runtimeSetup?: {
|
|
258
|
+
persona: string;
|
|
259
|
+
toolFilter: MemberToolFilter;
|
|
260
|
+
};
|
|
256
261
|
joinedAt: number;
|
|
257
262
|
status: MemberStatus;
|
|
258
263
|
/** Execution admission is closed while a failed/pending handoff is drained. */
|
|
@@ -15,5 +15,7 @@ export declare class RequestBodyError extends Error {
|
|
|
15
15
|
}
|
|
16
16
|
/** Bound memory while draining oversized requests so the route can return 413. */
|
|
17
17
|
export declare function readJsonRequest(req: IncomingMessage, maxBytes?: number): Promise<Record<string, unknown>>;
|
|
18
|
+
/** Revalidate a current JSON representation across both identity and gzip delivery. */
|
|
19
|
+
export declare function writeJsonWithEtag(req: IncomingMessage, res: ServerResponse, body: string): void;
|
|
18
20
|
/** Raw WebServer routes do not inherit Connection's authentication fence. */
|
|
19
21
|
export declare function authenticatedWebRoutes(server: WebRouteHost, connection: () => BrowserRequestGate | undefined): WebRouteHost;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Bounded, lifecycle-owned execution of current-byte audits off the host thread. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import { type DeliveryAudit } from './quality-gates.ts';
|
|
4
|
+
import type { TeamState } from './types.ts';
|
|
5
|
+
/** Execution limits; callers cannot turn these into a successful partial audit. */
|
|
6
|
+
export interface WorkspaceAuditOptions {
|
|
7
|
+
workerUrl?: URL;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
maxPending?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One lazy, reusable worker per plugin owner. Identical requests may share a
|
|
13
|
+
* queued audit until it is dispatched. Every later request needs a read that
|
|
14
|
+
* starts after it arrives.
|
|
15
|
+
*/
|
|
16
|
+
export declare class WorkspaceAuditService {
|
|
17
|
+
private readonly options;
|
|
18
|
+
private worker;
|
|
19
|
+
private active;
|
|
20
|
+
private timer;
|
|
21
|
+
private idleTimer;
|
|
22
|
+
private readonly jobs;
|
|
23
|
+
private readonly queue;
|
|
24
|
+
private sequence;
|
|
25
|
+
private closed;
|
|
26
|
+
constructor(options?: WorkspaceAuditOptions);
|
|
27
|
+
audit(workspace: string, team: TeamState, stateRoot?: string): Promise<DeliveryAudit>;
|
|
28
|
+
private pump;
|
|
29
|
+
private finish;
|
|
30
|
+
private failWorker;
|
|
31
|
+
/** Unload cancels active/queued work; late replies can never restore a pass. */
|
|
32
|
+
dispose(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/** Share tools/panel work and release the worker with its Cordis owner. */
|
|
35
|
+
export declare function workspaceAuditor(ctx: Context): WorkspaceAuditService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/web-routes.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
export class RequestBodyError extends Error {
|
|
2
3
|
status;
|
|
3
4
|
constructor(message, status) {
|
|
@@ -58,6 +59,36 @@ export async function readJsonRequest(req, maxBytes = 1_000_000) {
|
|
|
58
59
|
}
|
|
59
60
|
return value;
|
|
60
61
|
}
|
|
62
|
+
function matchesEntityTagList(header, tag) {
|
|
63
|
+
if (header === undefined)
|
|
64
|
+
return false;
|
|
65
|
+
if (header.trim() === '*')
|
|
66
|
+
return true;
|
|
67
|
+
// A comma can be part of the quoted opaque tag. Consume whole list entries
|
|
68
|
+
// and compare their quoted values, accepting either weak or strong spelling.
|
|
69
|
+
const entry = /[ \t]*(?:(?:W\/)?("[\x21\x23-\x7e\x80-\xff]*"))?[ \t]*(?:,|$)/y;
|
|
70
|
+
let matched = false;
|
|
71
|
+
while (entry.lastIndex < header.length) {
|
|
72
|
+
const parsed = entry.exec(header);
|
|
73
|
+
if (parsed === null)
|
|
74
|
+
return false;
|
|
75
|
+
matched ||= parsed[1] === tag;
|
|
76
|
+
}
|
|
77
|
+
return matched;
|
|
78
|
+
}
|
|
79
|
+
/** Revalidate a current JSON representation across both identity and gzip delivery. */
|
|
80
|
+
export function writeJsonWithEtag(req, res, body) {
|
|
81
|
+
const tag = `"${createHash('sha256').update(body).digest('base64url')}"`;
|
|
82
|
+
const headers = { 'cache-control': 'no-store', etag: `W/${tag}` };
|
|
83
|
+
if ((req.method === 'GET' || req.method === 'HEAD')
|
|
84
|
+
&& matchesEntityTagList(req.headers['if-none-match'], tag)) {
|
|
85
|
+
res.writeHead(304, headers);
|
|
86
|
+
res.end();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
res.writeHead(200, { ...headers, 'content-type': 'application/json; charset=utf-8' });
|
|
90
|
+
res.end(body);
|
|
91
|
+
}
|
|
61
92
|
/** Raw WebServer routes do not inherit Connection's authentication fence. */
|
|
62
93
|
export function authenticatedWebRoutes(server, connection) {
|
|
63
94
|
return {
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { Worker } from 'node:worker_threads';
|
|
4
|
+
import { deliveryArtifactPaths, deliveryScopePatterns } from "./quality-gates.js";
|
|
5
|
+
import { readTeam } from "./state.js";
|
|
6
|
+
function incomplete(reason) {
|
|
7
|
+
return { artifacts: [], expandedScope: [], gaps: [{ pattern: '(workspace audit)', reason }] };
|
|
8
|
+
}
|
|
9
|
+
function isAudit(value) {
|
|
10
|
+
if (typeof value !== 'object' || value === null)
|
|
11
|
+
return false;
|
|
12
|
+
const audit = value;
|
|
13
|
+
return Array.isArray(audit.artifacts)
|
|
14
|
+
&& audit.artifacts.every(item => typeof item?.path === 'string' && typeof item.present === 'boolean'
|
|
15
|
+
&& (item.present !== true || (typeof item.sha256 === 'string' && /^[a-f0-9]{64}$/.test(item.sha256))))
|
|
16
|
+
&& Array.isArray(audit.expandedScope)
|
|
17
|
+
&& audit.expandedScope.every(item => typeof item?.path === 'string' && typeof item.present === 'boolean')
|
|
18
|
+
&& (audit.gaps === undefined || (Array.isArray(audit.gaps)
|
|
19
|
+
&& audit.gaps.every(gap => typeof gap?.pattern === 'string' && typeof gap.reason === 'string')));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One lazy, reusable worker per plugin owner. Identical requests may share a
|
|
23
|
+
* queued audit until it is dispatched. Every later request needs a read that
|
|
24
|
+
* starts after it arrives.
|
|
25
|
+
*/
|
|
26
|
+
export class WorkspaceAuditService {
|
|
27
|
+
options;
|
|
28
|
+
worker;
|
|
29
|
+
active;
|
|
30
|
+
timer;
|
|
31
|
+
idleTimer;
|
|
32
|
+
jobs = new Set();
|
|
33
|
+
queue = [];
|
|
34
|
+
sequence = 0;
|
|
35
|
+
closed = false;
|
|
36
|
+
constructor(options = {}) {
|
|
37
|
+
this.options = options;
|
|
38
|
+
}
|
|
39
|
+
audit(workspace, team, stateRoot = join(workspace, '.agent-teams')) {
|
|
40
|
+
if (this.closed)
|
|
41
|
+
return Promise.resolve(incomplete('workspace audit service was disposed; retry after reload'));
|
|
42
|
+
if (deliveryArtifactPaths(team).length === 0 && deliveryScopePatterns(team).length === 0) {
|
|
43
|
+
return Promise.resolve({ artifacts: [], expandedScope: [] });
|
|
44
|
+
}
|
|
45
|
+
const source = JSON.stringify(team);
|
|
46
|
+
const key = `${resolve(workspace)}\0${resolve(stateRoot)}\0${team.id}\0${createHash('sha256').update(source).digest('hex')}`;
|
|
47
|
+
const existing = this.queue.find(job => job.key === key);
|
|
48
|
+
if (existing !== undefined)
|
|
49
|
+
return existing.promise;
|
|
50
|
+
if (this.jobs.size >= (this.options.maxPending ?? 16)) {
|
|
51
|
+
return Promise.resolve(incomplete('workspace audit queue is full; retry instead of treating unaudited bytes as verified'));
|
|
52
|
+
}
|
|
53
|
+
let complete;
|
|
54
|
+
const promise = new Promise(done => { complete = done; });
|
|
55
|
+
const job = { id: ++this.sequence, key, workspace, stateRoot, source, team: JSON.parse(source), promise, complete };
|
|
56
|
+
this.jobs.add(job);
|
|
57
|
+
this.queue.push(job);
|
|
58
|
+
this.pump();
|
|
59
|
+
return promise;
|
|
60
|
+
}
|
|
61
|
+
pump() {
|
|
62
|
+
if (this.closed || this.active !== undefined || this.queue.length === 0)
|
|
63
|
+
return;
|
|
64
|
+
clearTimeout(this.idleTimer);
|
|
65
|
+
this.idleTimer = undefined;
|
|
66
|
+
const job = this.queue.shift();
|
|
67
|
+
this.active = job;
|
|
68
|
+
try {
|
|
69
|
+
if (this.worker === undefined) {
|
|
70
|
+
const worker = new Worker(this.options.workerUrl ?? new URL('./workspace-audit-worker.js', import.meta.url));
|
|
71
|
+
this.worker = worker;
|
|
72
|
+
worker.on('message', (message) => {
|
|
73
|
+
if (this.worker !== worker)
|
|
74
|
+
return;
|
|
75
|
+
const reply = message;
|
|
76
|
+
if (reply === null || typeof reply !== 'object' || reply.id !== this.active?.id) {
|
|
77
|
+
this.failWorker('workspace audit worker returned an invalid response');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const current = this.active;
|
|
81
|
+
this.active = undefined;
|
|
82
|
+
clearTimeout(this.timer);
|
|
83
|
+
this.timer = undefined;
|
|
84
|
+
worker.unref();
|
|
85
|
+
const audit = isAudit(reply.audit)
|
|
86
|
+
? reply.audit
|
|
87
|
+
: incomplete(typeof reply.error === 'string' ? `workspace audit failed: ${reply.error}` : 'workspace audit worker returned incomplete evidence');
|
|
88
|
+
void this.finish(current, audit);
|
|
89
|
+
this.pump();
|
|
90
|
+
if (this.active === undefined) {
|
|
91
|
+
this.idleTimer = setTimeout(() => {
|
|
92
|
+
if (this.worker === worker && this.active === undefined) {
|
|
93
|
+
this.worker = undefined;
|
|
94
|
+
void worker.terminate();
|
|
95
|
+
}
|
|
96
|
+
}, 10_000);
|
|
97
|
+
this.idleTimer.unref();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
worker.on('error', error => { if (this.worker === worker)
|
|
101
|
+
this.failWorker(`workspace audit worker failed: ${error.message}`); });
|
|
102
|
+
worker.on('exit', code => { if (this.worker === worker)
|
|
103
|
+
this.failWorker(`workspace audit worker exited (${code}) before completing its evidence`); });
|
|
104
|
+
}
|
|
105
|
+
this.worker.ref();
|
|
106
|
+
this.timer = setTimeout(() => this.failWorker('workspace audit timed out; current bytes could not be verified'), this.options.timeoutMs ?? 120_000);
|
|
107
|
+
this.worker.postMessage({ id: job.id, workspace: job.workspace, team: job.team });
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
this.failWorker(`workspace audit could not start: ${String(error)}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async finish(job, audit) {
|
|
114
|
+
try {
|
|
115
|
+
// Hashing yields the host thread, so a newer task attempt, edit, archive
|
|
116
|
+
// or replacement team can win while the worker is running. Never apply
|
|
117
|
+
// the old answer to that new record, even when its artifact paths match.
|
|
118
|
+
const current = await readTeam(job.stateRoot, job.team.id);
|
|
119
|
+
if (current === undefined || JSON.stringify(current) !== job.source) {
|
|
120
|
+
audit = { ...audit, gaps: [...audit.gaps ?? [], { pattern: '(team revision)', reason: 'team state changed during the workspace audit; retry the current revision' }] };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
audit = { ...audit, gaps: [...audit.gaps ?? [], { pattern: '(team revision)', reason: `team state could not be revalidated after the workspace audit: ${String(error)}` }] };
|
|
125
|
+
}
|
|
126
|
+
if (!this.jobs.delete(job))
|
|
127
|
+
return;
|
|
128
|
+
job.complete(this.closed ? incomplete('workspace audit service was disposed before its result could be applied') : audit);
|
|
129
|
+
}
|
|
130
|
+
failWorker(reason) {
|
|
131
|
+
const worker = this.worker;
|
|
132
|
+
this.worker = undefined;
|
|
133
|
+
this.active = undefined;
|
|
134
|
+
clearTimeout(this.timer);
|
|
135
|
+
clearTimeout(this.idleTimer);
|
|
136
|
+
this.timer = undefined;
|
|
137
|
+
this.idleTimer = undefined;
|
|
138
|
+
this.queue.length = 0;
|
|
139
|
+
for (const job of this.jobs)
|
|
140
|
+
job.complete(incomplete(reason));
|
|
141
|
+
this.jobs.clear();
|
|
142
|
+
return worker?.terminate();
|
|
143
|
+
}
|
|
144
|
+
/** Unload cancels active/queued work; late replies can never restore a pass. */
|
|
145
|
+
async dispose() {
|
|
146
|
+
this.closed = true;
|
|
147
|
+
await this.failWorker('workspace audit was cancelled when its owner unloaded');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const owners = new WeakMap();
|
|
151
|
+
/** Share tools/panel work and release the worker with its Cordis owner. */
|
|
152
|
+
export function workspaceAuditor(ctx) {
|
|
153
|
+
let service = owners.get(ctx);
|
|
154
|
+
if (service !== undefined)
|
|
155
|
+
return service;
|
|
156
|
+
service = new WorkspaceAuditService();
|
|
157
|
+
owners.set(ctx, service);
|
|
158
|
+
const owned = service;
|
|
159
|
+
ctx.effect(() => () => {
|
|
160
|
+
// A reloaded Cordis fiber gets a new Context. Keep this disposed owner's
|
|
161
|
+
// service so a late callback cannot start new work after unload.
|
|
162
|
+
return owned.dispose();
|
|
163
|
+
}, 'agent-teams: workspace audit worker');
|
|
164
|
+
return service;
|
|
165
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Built worker entry: no Harness service instances cross the thread boundary. */
|
|
2
|
+
import { parentPort } from 'node:worker_threads';
|
|
3
|
+
import { auditTeamWorkspace } from "./workspace-audit.js";
|
|
4
|
+
parentPort?.on('message', (job) => {
|
|
5
|
+
try {
|
|
6
|
+
parentPort?.postMessage({ id: job.id, audit: auditTeamWorkspace(job.workspace, job.team) });
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
parentPort?.postMessage({ id: job.id, error: String(error) });
|
|
10
|
+
}
|
|
11
|
+
});
|
package/lib/workspace-audit.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* otherwise be reported as fully verified.
|
|
14
14
|
* @module dsh-agent-teams/workspace-audit
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { readArtifactScopes } from "./artifacts.js";
|
|
17
17
|
import { deliveryArtifactPaths, deliveryScopePatterns } from "./quality-gates.js";
|
|
18
18
|
/**
|
|
19
19
|
* Read the current workspace bytes a team's recorded verdicts and generated
|
|
@@ -27,10 +27,9 @@ import { deliveryArtifactPaths, deliveryScopePatterns } from "./quality-gates.js
|
|
|
27
27
|
export function auditTeamWorkspace(workspace, team) {
|
|
28
28
|
const paths = deliveryArtifactPaths(team);
|
|
29
29
|
const scopePatterns = deliveryScopePatterns(team);
|
|
30
|
-
const pathRead
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const seen = new Set(gaps.map((gap) => `${gap.pattern}\u0000${gap.reason}`));
|
|
30
|
+
const [pathRead, scopeRead] = readArtifactScopes(workspace, [paths, scopePatterns]);
|
|
31
|
+
const gaps = [];
|
|
32
|
+
const seen = new Set();
|
|
34
33
|
const recordGap = (pattern, reason) => {
|
|
35
34
|
const key = `${pattern}\u0000${reason}`;
|
|
36
35
|
if (seen.has(key))
|
|
@@ -38,6 +37,8 @@ export function auditTeamWorkspace(workspace, team) {
|
|
|
38
37
|
seen.add(key);
|
|
39
38
|
gaps.push({ pattern, reason });
|
|
40
39
|
};
|
|
40
|
+
for (const gap of [...pathRead.gaps, ...scopeRead.gaps])
|
|
41
|
+
recordGap(gap.pattern, gap.reason);
|
|
41
42
|
for (const artifact of [...pathRead.artifacts, ...scopeRead.artifacts]) {
|
|
42
43
|
// An unreadable path is not a gap in enumeration but a gap in evidence:
|
|
43
44
|
// report it the same way so no surface treats it as a clean read.
|
package/locale/en.json
ADDED