dsh-agent-team-presets 0.3.2 → 0.3.4
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 +58 -3
- package/README.md +73 -398
- package/README.zh.md +79 -404
- package/assets/card-patches/catalog.json +30 -0
- package/assets/card-patches/dsh-context-0.85.0.client.js.gz +0 -0
- package/assets/card-patches/dsh-context-0.85.1.client.js.gz +0 -0
- package/assets/card-patches/dsh-context-0.87.0.client.js.gz +0 -0
- package/assets/skills/agent-leader-communication/SKILL.md +100 -0
- package/assets/skills/agent-subagent-orchestration/SKILL.md +56 -0
- package/assets/skills/agent-subagent-orchestration/references/executor-parallel-execution.md +56 -0
- package/assets/skills/agent-subagent-orchestration/references/leader-discovery.md +53 -0
- package/assets/skills/agent-subagent-orchestration/references/subagent-communication.md +58 -0
- package/assets/skills/backend-architecture-workflow/SKILL.md +55 -0
- package/assets/skills/backend-architecture-workflow/references/README.md +9 -0
- package/assets/skills/backend-architecture-workflow/references/architecture-audit.md +70 -0
- package/assets/skills/backend-architecture-workflow/references/architecture-decay-risks.md +75 -0
- package/assets/skills/backend-architecture-workflow/references/architecture-design.md +151 -0
- package/assets/skills/backend-architecture-workflow/references/bugfix-regression.md +63 -0
- package/assets/skills/backend-architecture-workflow/references/complex-bug-diagnosis.md +104 -0
- package/assets/skills/executor-short-task-workflow/SKILL.md +48 -0
- package/assets/skills/executor-short-task-workflow/references/agent-communication.md +44 -0
- package/assets/skills/executor-short-task-workflow/references/verification-and-reporting.md +45 -0
- package/assets/skills/frontend-engineering-workflow/SKILL.md +47 -0
- package/assets/skills/frontend-engineering-workflow/references/README.md +7 -0
- package/assets/skills/frontend-engineering-workflow/references/frontend-implementation.md +46 -0
- package/assets/skills/frontend-engineering-workflow/references/visual-design.md +43 -0
- package/assets/skills/frontend-engineering-workflow/references/visual-qa.md +126 -0
- package/assets/skills/fullstack-advisor/SKILL.md +50 -0
- package/assets/skills/fullstack-advisor/references/brooks-principles.md +51 -0
- package/assets/skills/fullstack-advisor/references/consultant-communication.md +51 -0
- package/assets/skills/fullstack-advisor/references/consultation-workflow.md +71 -0
- package/assets/skills/git-release-hygiene/SKILL.md +33 -21
- package/assets/skills/git-release-hygiene/references/git-safety.md +66 -0
- package/assets/skills/git-release-hygiene/references/pr-changelog.md +98 -0
- package/assets/skills/git-release-hygiene/references/release-standard.md +139 -0
- package/assets/skills/git-release-hygiene/references/validation-checklist.md +42 -0
- package/assets/skills/github-repository-presentation/SKILL.md +49 -130
- package/assets/skills/github-repository-presentation/references/bilingual-writing.md +43 -0
- package/assets/skills/github-repository-presentation/references/documentation-architecture.md +156 -0
- package/assets/skills/github-repository-presentation/references/readme-standard.md +273 -0
- package/assets/skills/github-repository-presentation/references/release-notes.md +70 -0
- package/assets/skills/github-repository-presentation/references/validation-checklist.md +47 -0
- package/assets/skills/independent-code-review-workflow/SKILL.md +60 -0
- package/assets/skills/independent-code-review-workflow/references/README.md +9 -0
- package/assets/skills/independent-code-review-workflow/references/decay-risks.md +99 -0
- package/assets/skills/independent-code-review-workflow/references/review-checklist.md +53 -0
- package/assets/skills/independent-code-review-workflow/references/review-methodology.md +113 -0
- package/assets/skills/independent-code-review-workflow/references/review-severity.md +49 -0
- package/assets/skills/independent-code-review-workflow/references/test-quality-review.md +71 -0
- package/assets/skills/leader-long-task-orchestration/SKILL.md +49 -0
- package/assets/skills/leader-long-task-orchestration/references/delivery-plan-template.md +73 -0
- package/assets/skills/leader-long-task-orchestration/references/product-alignment.md +46 -0
- package/assets/skills/leader-long-task-orchestration/references/rolling-wave-planning.md +32 -0
- package/assets/skills/leader-long-task-orchestration/references/technical-decisions-and-escalation.md +34 -0
- package/assets/skills/leader-medium-task-workflow/SKILL.md +55 -0
- package/assets/skills/leader-medium-task-workflow/references/task-board-and-leader-todo.md +41 -0
- package/docs/builtin-team-skills.md +82 -0
- package/docs/builtin-team-skills.zh.md +82 -0
- package/docs/builtin-teams.md +62 -0
- package/docs/builtin-teams.zh.md +62 -0
- package/docs/developer/architecture.md +54 -0
- package/docs/developer/architecture.zh.md +54 -0
- package/docs/guide/install.md +86 -0
- package/docs/guide/install.zh.md +86 -0
- package/docs/guide/integrations.md +50 -0
- package/docs/guide/integrations.zh.md +50 -0
- package/docs/guide/team-skills.md +68 -0
- package/docs/guide/team-skills.zh.md +68 -0
- package/docs/guide/using-teams.md +92 -0
- package/docs/guide/using-teams.zh.md +92 -0
- package/docs/index.md +53 -0
- package/docs/index.zh.md +53 -0
- package/docs/reference/tools-and-permissions.md +62 -0
- package/docs/reference/tools-and-permissions.zh.md +62 -0
- package/docs/reference/troubleshooting.md +59 -0
- package/docs/reference/troubleshooting.zh.md +59 -0
- package/icon.webp +0 -0
- package/lib/client.js +1459 -253
- package/lib/index.js +960 -342
- package/lib/typert.host.js +402 -29
- package/lib/typert.remote-client.d.ts +9 -9
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +402 -29
- package/lib/types/client/CardPatchView.js +21 -1
- package/lib/types/client/ComposerTeamSelect.js +24 -8
- package/lib/types/client/TeamAgentView.d.ts +1 -1
- package/lib/types/client/TeamAgentView.js +11 -6
- package/lib/types/client/TeamImportDialog.d.ts +4 -15
- package/lib/types/client/TeamImportDialog.js +29 -25
- package/lib/types/client/TeamPresetsSection.js +14 -5
- package/lib/types/client/TeamSkillsView.d.ts +5 -4
- package/lib/types/client/TeamSkillsView.js +64 -15
- package/lib/types/client/locales.d.ts +41 -2
- package/lib/types/client/locales.js +185 -8
- package/lib/types/client/team-presets-controller.d.ts +15 -2
- package/lib/types/client/team-presets-controller.js +86 -30
- package/lib/types/client/team-skills-controller.d.ts +14 -5
- package/lib/types/client/team-skills-controller.js +71 -37
- package/lib/types/index.js +57 -19
- package/lib/types/preset-editor.js +3 -4
- package/lib/types/preset-transfer.d.ts +1 -1
- package/lib/types/presets.d.ts +21 -23
- package/lib/types/presets.js +72 -36
- package/lib/types/team-catalog.d.ts +50 -3
- package/lib/types/team-catalog.js +214 -43
- package/lib/types/team-mode.d.ts +48 -0
- package/lib/types/team-mode.js +64 -0
- package/lib/types/team-skills/import.d.ts +17 -7
- package/lib/types/team-skills/import.js +115 -21
- package/lib/types/team-skills/index.d.ts +2 -3
- package/lib/types/team-skills/index.js +4 -8
- package/lib/types/team-skills/manager.d.ts +24 -15
- package/lib/types/team-skills/manager.js +98 -105
- package/lib/types/team-skills/official-bindings.d.ts +29 -0
- package/lib/types/team-skills/official-bindings.js +51 -0
- package/lib/types/team-skills/service.d.ts +7 -12
- package/lib/types/team-skills/service.js +143 -63
- package/lib/types/team-skills/store.d.ts +27 -6
- package/lib/types/team-skills/store.js +151 -15
- package/lib/types/types.d.ts +18 -4
- package/package.json +21 -2
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import type { Context } from '@deepseek-ai/cordis';
|
|
6
6
|
import type { ModelCatalog } from '@deepseek-ai/dsh-api-remotes/client';
|
|
7
7
|
import { type SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
8
|
-
import type { TeamPresetImportFailure, TeamPresetTransfer } from '../preset-transfer.ts';
|
|
8
|
+
import type { OfficialSkillTransfer, TeamPresetImportFailure, TeamPresetTransfer } from '../preset-transfer.ts';
|
|
9
9
|
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
10
10
|
import type { TeamRosterValue } from '../types.ts';
|
|
11
|
-
import type { TeamAgentPreset, TeamCaptainPreset, TeamCategory, TeamCategoryAssignment, TeamExecutionRow, TeamExecutionState, TeamPreset, ToolChoice } from '../types.ts';
|
|
11
|
+
import type { TeamAgentPreset, TeamCaptainPreset, TeamCategory, TeamCategoryAssignment, TeamExecutionRow, TeamExecutionState, TeamPreset, TeamSkillAssetView, ToolChoice } from '../types.ts';
|
|
12
12
|
/**
|
|
13
13
|
* Loader entry id of the Host row that owns the Team preset namespace. Spelled
|
|
14
14
|
* here rather than imported: a client package must not depend on a Host package.
|
|
@@ -219,6 +219,10 @@ export type DefaultsRestore = 'restored' | 'unchanged';
|
|
|
219
219
|
export type TeamPresetImportPlan = {
|
|
220
220
|
/** The document being imported. */
|
|
221
221
|
readonly transfer: TeamPresetTransfer;
|
|
222
|
+
/** Imported roles with the IDs they will keep if added to the draft. */
|
|
223
|
+
readonly incoming: TeamPreset;
|
|
224
|
+
/** Local identity of the replacement target, when there is a conflict. */
|
|
225
|
+
readonly targetId: string | undefined;
|
|
222
226
|
/** Index of the Team the document would overwrite, or undefined when it adds one. */
|
|
223
227
|
readonly targetIndex: number | undefined;
|
|
224
228
|
/** Display name of that Team, for the dialog that resolves the collision. */
|
|
@@ -257,6 +261,11 @@ export type TeamPresetImportResolution = {
|
|
|
257
261
|
* @returns the resolution that adds the document as a new Team.
|
|
258
262
|
*/
|
|
259
263
|
export declare function defaultImportResolution(plan: TeamPresetImportPlan): TeamPresetImportResolution;
|
|
264
|
+
/** Feedback describes the draft and the current library, before any binding is applied. */
|
|
265
|
+
export type TeamPresetImportSkillRow = OfficialSkillTransfer & {
|
|
266
|
+
readonly source: 'preset' | 'catalog';
|
|
267
|
+
readonly status: 'unknown-skill' | 'missing-role' | 'ambiguous-role' | 'catalog-ignored' | 'eligible' | 'asset-missing' | 'library-unavailable' | 'local-override';
|
|
268
|
+
};
|
|
260
269
|
/**
|
|
261
270
|
* Whether one stored Team still matches a staged draft, so the page can tell
|
|
262
271
|
* a duplicate from a real edit.
|
|
@@ -559,6 +568,8 @@ export declare class TeamPresetsController {
|
|
|
559
568
|
* @returns the plan, or the reason the document is not a Team preset of this format.
|
|
560
569
|
*/
|
|
561
570
|
inspectImport(text: string): TeamPresetImportInspection;
|
|
571
|
+
/** Inspect the draft that the selected collision choices would stage. */
|
|
572
|
+
previewImport(plan: TeamPresetImportPlan, resolution: TeamPresetImportResolution, assets?: readonly TeamSkillAssetView[]): readonly TeamPresetImportSkillRow[];
|
|
562
573
|
/**
|
|
563
574
|
* Stage one inspected document onto the draft.
|
|
564
575
|
*
|
|
@@ -769,6 +780,8 @@ export interface TeamPresetsInjected {
|
|
|
769
780
|
exportTeam: (index: number) => string | undefined;
|
|
770
781
|
/** Read one shared document and report what importing it would collide with. */
|
|
771
782
|
inspectImport: (text: string) => TeamPresetImportInspection;
|
|
783
|
+
/** Preview the declared skills for the selected import choices. */
|
|
784
|
+
previewImport: (plan: TeamPresetImportPlan, resolution: TeamPresetImportResolution, assets?: readonly TeamSkillAssetView[]) => readonly TeamPresetImportSkillRow[];
|
|
772
785
|
/** Stage one inspected document under the user's resolution of its collisions. */
|
|
773
786
|
applyImport: (plan: TeamPresetImportPlan, resolution: TeamPresetImportResolution) => string;
|
|
774
787
|
removeTeam: (index: number) => void;
|
|
@@ -6,7 +6,8 @@ import { createSnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
|
6
6
|
import { toolMode, withSelection } from "../presets.js";
|
|
7
7
|
import { cloneMetadata, restoreBuiltinTeams } from "../builtin-teams.js";
|
|
8
8
|
import { builtinEntry } from "../team-catalog.js";
|
|
9
|
-
import {
|
|
9
|
+
import { isOfficialSkillAsset, isOfficialSkillOverride, officialSkillDefaults, officialSkillTarget } from "../team-skills/official-bindings.js";
|
|
10
|
+
import { applySharedFields, importConflicts, parseTeamPresetText, serializeTeamPreset, slotNameKey, teamFromTransfer, uniqueName, } from "../preset-transfer.js";
|
|
10
11
|
import { liveAssignments } from "../team-search.js";
|
|
11
12
|
/**
|
|
12
13
|
* Loader entry id of the Host row that owns the Team preset namespace. Spelled
|
|
@@ -74,7 +75,7 @@ export function defaultImportResolution(plan) {
|
|
|
74
75
|
function mergeTransfer(target, plan, resolution) {
|
|
75
76
|
const members = [...target.members];
|
|
76
77
|
const importedNames = new Map();
|
|
77
|
-
for (const incoming of plan.
|
|
78
|
+
for (const incoming of plan.incoming.members) {
|
|
78
79
|
const key = slotNameKey(incoming.name);
|
|
79
80
|
const at = key === '' ? -1 : members.findIndex(member => slotNameKey(member.name) === key);
|
|
80
81
|
if (at >= 0 && (resolution.members[incoming.name] ?? 'replace') === 'replace') {
|
|
@@ -86,31 +87,75 @@ function mergeTransfer(target, plan, resolution) {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
const name = uniqueName(incoming.name, members.map(member => member.name));
|
|
89
|
-
members.push(
|
|
90
|
+
members.push({ ...incoming, name });
|
|
90
91
|
importedNames.set(incoming.name, name);
|
|
91
92
|
}
|
|
92
93
|
const captain = plan.transfer.team.captain;
|
|
93
94
|
const captainName = resolution.captain === 'rename' ? plan.suggestedCaptainName : captain.name;
|
|
94
95
|
importedNames.set(captain.name, captainName);
|
|
95
96
|
return {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
: {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
: { officialSkills: plan.transfer.team.officialSkills.map(binding => ({
|
|
107
|
-
...binding,
|
|
108
|
-
roleName: importedNames.get(binding.roleName) ?? binding.roleName,
|
|
109
|
-
})) }),
|
|
110
|
-
captain: applySharedFields(target.captain, { ...captain, name: captainName }),
|
|
111
|
-
members,
|
|
97
|
+
importedNames,
|
|
98
|
+
team: {
|
|
99
|
+
...target,
|
|
100
|
+
name: plan.transfer.team.name,
|
|
101
|
+
description: plan.transfer.team.description,
|
|
102
|
+
// v1 never carried discovery metadata; v2 owns the field even when empty.
|
|
103
|
+
...(plan.transfer.version < 2 ? {} : { metadata: structuredClone(plan.transfer.team.metadata ?? {}) }),
|
|
104
|
+
captain: applySharedFields(target.captain, { ...captain, name: captainName }),
|
|
105
|
+
members,
|
|
106
|
+
},
|
|
112
107
|
};
|
|
113
108
|
}
|
|
109
|
+
function skillRow(team, declaration, source, assets) {
|
|
110
|
+
const row = { ...declaration, source };
|
|
111
|
+
const target = officialSkillTarget(team, declaration);
|
|
112
|
+
if (target.status !== 'valid')
|
|
113
|
+
return { ...row, status: target.status };
|
|
114
|
+
if (assets === undefined)
|
|
115
|
+
return { ...row, status: 'library-unavailable' };
|
|
116
|
+
if (assets.some(asset => isOfficialSkillOverride(asset, declaration.skillId)
|
|
117
|
+
&& asset.bindings.some(binding => binding.teamId === team.id && binding.roleId === target.roleId))) {
|
|
118
|
+
return { ...row, status: 'local-override' };
|
|
119
|
+
}
|
|
120
|
+
const available = assets.some(asset => isOfficialSkillAsset(asset, target.assetId));
|
|
121
|
+
return { ...row, status: available ? 'eligible' : 'asset-missing' };
|
|
122
|
+
}
|
|
123
|
+
/** Build the same proposed roster and declaration set for preview and staging. */
|
|
124
|
+
function projectImport(teams, plan, resolution, assets) {
|
|
125
|
+
const target = resolution.team === 'replace' ? teams.find(team => team.id === plan.targetId) : undefined;
|
|
126
|
+
const replacement = target === undefined ? undefined : mergeTransfer(target, plan, resolution);
|
|
127
|
+
const preferred = resolution.teamName.trim() === '' ? plan.transfer.team.name : resolution.teamName;
|
|
128
|
+
// New roles already have their draft identities. A new Team gets its local ID
|
|
129
|
+
// at staging, so preview cannot mistake it for a saved Team with bindings.
|
|
130
|
+
const team = replacement?.team ?? { ...plan.incoming, name: uniqueName(preferred, teams.map(candidate => candidate.name)) };
|
|
131
|
+
const defaults = officialSkillDefaults(team);
|
|
132
|
+
const declarations = plan.transfer.team.officialSkills;
|
|
133
|
+
const rows = [];
|
|
134
|
+
const retained = [];
|
|
135
|
+
for (const declaration of declarations ?? []) {
|
|
136
|
+
const original = officialSkillTarget(plan.incoming, declaration);
|
|
137
|
+
if (original.status !== 'valid') {
|
|
138
|
+
rows.push({ ...declaration, source: 'preset', status: original.status });
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (defaults.source === 'catalog') {
|
|
142
|
+
rows.push({ ...declaration, source: 'preset', status: 'catalog-ignored' });
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const resolved = { ...declaration, roleName: replacement?.importedNames.get(declaration.roleName) ?? declaration.roleName };
|
|
146
|
+
const row = skillRow(team, resolved, 'preset', assets);
|
|
147
|
+
rows.push(row);
|
|
148
|
+
if (row.status !== 'missing-role' && row.status !== 'ambiguous-role')
|
|
149
|
+
retained.push(resolved);
|
|
150
|
+
}
|
|
151
|
+
if (defaults.source === 'catalog' || declarations === undefined) {
|
|
152
|
+
rows.push(...defaults.declarations.map(declaration => skillRow(team, declaration, defaults.source, assets)));
|
|
153
|
+
}
|
|
154
|
+
const staged = defaults.source === 'catalog'
|
|
155
|
+
? { ...team, officialSkills: defaults.declarations.map(declaration => ({ ...declaration })) }
|
|
156
|
+
: declarations === undefined ? team : { ...team, officialSkills: retained };
|
|
157
|
+
return { team: staged, target, rows };
|
|
158
|
+
}
|
|
114
159
|
/**
|
|
115
160
|
* Narrow one stored category list.
|
|
116
161
|
*
|
|
@@ -660,6 +705,7 @@ export class TeamPresetsController {
|
|
|
660
705
|
restoreDefaults: () => { this.restoreDefaults(); },
|
|
661
706
|
exportTeam: (index) => this.exportTeam(index),
|
|
662
707
|
inspectImport: (text) => this.inspectImport(text),
|
|
708
|
+
previewImport: (plan, resolution, assets) => this.previewImport(plan, resolution, assets),
|
|
663
709
|
applyImport: (plan, resolution) => {
|
|
664
710
|
return this.applyImport(plan, resolution);
|
|
665
711
|
},
|
|
@@ -979,8 +1025,7 @@ export class TeamPresetsController {
|
|
|
979
1025
|
const team = this.visibleTeams()[index];
|
|
980
1026
|
if (team === undefined)
|
|
981
1027
|
return undefined;
|
|
982
|
-
|
|
983
|
-
return serializeTeamPreset(team, officialSkills === undefined ? {} : { officialSkills });
|
|
1028
|
+
return serializeTeamPreset(team, { officialSkills: officialSkillDefaults(team).declarations });
|
|
984
1029
|
}
|
|
985
1030
|
/**
|
|
986
1031
|
* Read one document and work out what importing it would collide with.
|
|
@@ -994,7 +1039,21 @@ export class TeamPresetsController {
|
|
|
994
1039
|
const parsed = parseTeamPresetText(text);
|
|
995
1040
|
if (!parsed.ok)
|
|
996
1041
|
return parsed;
|
|
997
|
-
|
|
1042
|
+
const teams = this.visibleTeams();
|
|
1043
|
+
const conflicts = importConflicts(teams, parsed.transfer);
|
|
1044
|
+
return {
|
|
1045
|
+
ok: true,
|
|
1046
|
+
plan: {
|
|
1047
|
+
transfer: parsed.transfer,
|
|
1048
|
+
incoming: teamFromTransfer(parsed.transfer, ''),
|
|
1049
|
+
targetId: conflicts.targetIndex === undefined ? undefined : teams[conflicts.targetIndex]?.id,
|
|
1050
|
+
...conflicts,
|
|
1051
|
+
},
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
/** Inspect the draft that the selected collision choices would stage. */
|
|
1055
|
+
previewImport(plan, resolution, assets) {
|
|
1056
|
+
return projectImport(this.visibleTeams(), plan, resolution, assets).rows;
|
|
998
1057
|
}
|
|
999
1058
|
/**
|
|
1000
1059
|
* Stage one inspected document onto the draft.
|
|
@@ -1008,16 +1067,13 @@ export class TeamPresetsController {
|
|
|
1008
1067
|
*/
|
|
1009
1068
|
applyImport(plan, resolution) {
|
|
1010
1069
|
const draft = this.beginDraft();
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1013
|
-
|
|
1014
|
-
this.draft = draft.map((team, position) => position === plan.targetIndex ? merged : team);
|
|
1070
|
+
const projected = projectImport(draft, plan, resolution);
|
|
1071
|
+
if (projected.target !== undefined) {
|
|
1072
|
+
this.draft = draft.map(team => team === projected.target ? projected.team : team);
|
|
1015
1073
|
this.publish();
|
|
1016
|
-
return
|
|
1074
|
+
return projected.team.id;
|
|
1017
1075
|
}
|
|
1018
|
-
const
|
|
1019
|
-
const name = uniqueName(preferred, draft.map(team => team.name));
|
|
1020
|
-
const created = { ...teamFromTransfer(plan.transfer, createTeamPreset(draft).id), name };
|
|
1076
|
+
const created = { ...projected.team, id: createTeamPreset(draft).id };
|
|
1021
1077
|
this.draft = [...draft, created];
|
|
1022
1078
|
this.publish();
|
|
1023
1079
|
return created.id;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module dsh-agent-team-presets/client/team-skills-controller
|
|
11
11
|
*/
|
|
12
12
|
import type { Context } from '@deepseek-ai/cordis';
|
|
13
|
-
import type { TeamSkillDeleteView, TeamSkillDetailView, TeamSkillLibraryView, TeamSkillScanView } from '../types.ts';
|
|
13
|
+
import type { TeamSkillDeleteView, TeamSkillDetailView, TeamSkillLibraryView, TeamSkillScanEntry, TeamSkillScanView } from '../types.ts';
|
|
14
14
|
/** One page snapshot. */
|
|
15
15
|
export interface TeamSkillsState {
|
|
16
16
|
/** Where the library load stands. */
|
|
@@ -33,6 +33,8 @@ export interface TeamSkillsState {
|
|
|
33
33
|
readonly file: string | undefined;
|
|
34
34
|
/** That file's text, once read. */
|
|
35
35
|
readonly fileText: string | undefined;
|
|
36
|
+
/** Changes found by the last deliberate inbox check. */
|
|
37
|
+
readonly inboxChanges?: readonly TeamSkillScanEntry[];
|
|
36
38
|
/** The last directory scan, so the page can list every folder it judged. */
|
|
37
39
|
readonly scan: TeamSkillScanView | undefined;
|
|
38
40
|
/** Whether this Host can reveal a folder natively; false means the control copies the path. */
|
|
@@ -48,6 +50,9 @@ export declare class TeamSkillsController {
|
|
|
48
50
|
private readonly listeners;
|
|
49
51
|
private readonly ctx;
|
|
50
52
|
private disposed;
|
|
53
|
+
private pendingInboxCheck;
|
|
54
|
+
private libraryRequest;
|
|
55
|
+
private inboxRequest;
|
|
51
56
|
/**
|
|
52
57
|
* The Remote namespace, once the gateway announces it.
|
|
53
58
|
*
|
|
@@ -90,8 +95,8 @@ export declare class TeamSkillsController {
|
|
|
90
95
|
* @param patch - fields to change.
|
|
91
96
|
*/
|
|
92
97
|
private publish;
|
|
93
|
-
/** Read the library
|
|
94
|
-
refresh(): Promise<void>;
|
|
98
|
+
/** Read the library, optionally checking the inbox for pending changes. */
|
|
99
|
+
refresh(checkInbox?: boolean): Promise<void>;
|
|
95
100
|
/**
|
|
96
101
|
* Show one asset's detail.
|
|
97
102
|
* @param assetId - asset identity.
|
|
@@ -117,11 +122,12 @@ export declare class TeamSkillsController {
|
|
|
117
122
|
/**
|
|
118
123
|
* Import one folder the user picked.
|
|
119
124
|
* @param files - the picker's files, already carrying relative paths.
|
|
125
|
+
* @returns the asset identity when the folder was imported.
|
|
120
126
|
*/
|
|
121
127
|
importFolder(files: readonly {
|
|
122
128
|
path: string;
|
|
123
129
|
content: Uint8Array;
|
|
124
|
-
}[]): Promise<
|
|
130
|
+
}[]): Promise<string | undefined>;
|
|
125
131
|
/**
|
|
126
132
|
* Scan the Host's import folder and publish every new legal skill.
|
|
127
133
|
*
|
|
@@ -132,8 +138,11 @@ export declare class TeamSkillsController {
|
|
|
132
138
|
/**
|
|
133
139
|
* Copy one shipped skill into an editable override.
|
|
134
140
|
* @param skillId - shipped skill id.
|
|
141
|
+
* @param switchBindings - whether to move current role bindings to the copy.
|
|
142
|
+
* @returns the copy's asset identity when the Host created it.
|
|
135
143
|
*/
|
|
136
|
-
createOverride(skillId: string): Promise<
|
|
144
|
+
createOverride(skillId: string, switchBindings: boolean): Promise<string | undefined>;
|
|
145
|
+
private showCreatedAsset;
|
|
137
146
|
/**
|
|
138
147
|
* Discard one override's edits by re-copying the shipped skill.
|
|
139
148
|
* @param assetId - override identity.
|
|
@@ -41,6 +41,7 @@ export class TeamSkillsController {
|
|
|
41
41
|
issue: undefined,
|
|
42
42
|
file: undefined,
|
|
43
43
|
fileText: undefined,
|
|
44
|
+
inboxChanges: [],
|
|
44
45
|
scan: undefined,
|
|
45
46
|
canOpenScanFolder: false,
|
|
46
47
|
scanFolderPath: undefined,
|
|
@@ -49,6 +50,9 @@ export class TeamSkillsController {
|
|
|
49
50
|
listeners = new Set();
|
|
50
51
|
ctx;
|
|
51
52
|
disposed = false;
|
|
53
|
+
pendingInboxCheck = false;
|
|
54
|
+
libraryRequest = 0;
|
|
55
|
+
inboxRequest = 0;
|
|
52
56
|
/**
|
|
53
57
|
* The Remote namespace, once the gateway announces it.
|
|
54
58
|
*
|
|
@@ -70,7 +74,9 @@ export class TeamSkillsController {
|
|
|
70
74
|
try {
|
|
71
75
|
ctx.inject(['remote.teamSkills'], (scope) => {
|
|
72
76
|
this.service = scope.remote.teamSkills;
|
|
73
|
-
|
|
77
|
+
const checkInbox = this.pendingInboxCheck;
|
|
78
|
+
this.pendingInboxCheck = false;
|
|
79
|
+
void this.refresh(checkInbox);
|
|
74
80
|
return () => { this.service = undefined; };
|
|
75
81
|
});
|
|
76
82
|
}
|
|
@@ -169,30 +175,36 @@ export class TeamSkillsController {
|
|
|
169
175
|
for (const listener of this.listeners)
|
|
170
176
|
listener();
|
|
171
177
|
}
|
|
172
|
-
/** Read the library
|
|
173
|
-
async refresh() {
|
|
178
|
+
/** Read the library, optionally checking the inbox for pending changes. */
|
|
179
|
+
async refresh(checkInbox = false) {
|
|
180
|
+
if (checkInbox && this.service === undefined)
|
|
181
|
+
this.pendingInboxCheck = true;
|
|
182
|
+
const request = ++this.libraryRequest;
|
|
183
|
+
if (checkInbox)
|
|
184
|
+
this.inboxRequest = request;
|
|
174
185
|
this.publish({ status: this.state.library === undefined ? 'loading' : 'ready' });
|
|
175
186
|
try {
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
// the next build, and this branch must stay correct in the meantime.
|
|
181
|
-
const issue = library.issue;
|
|
182
|
-
if (issue !== undefined) {
|
|
183
|
-
this.publish({ status: 'unavailable', library: undefined, issue });
|
|
184
|
-
return;
|
|
187
|
+
const api = this.api();
|
|
188
|
+
const library = unwrap(await (checkInbox ? api.library(true) : api.library()));
|
|
189
|
+
if (checkInbox && request === this.inboxRequest && library.issue === undefined) {
|
|
190
|
+
this.publish({ inboxChanges: library.inboxChanges ?? [] });
|
|
185
191
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (
|
|
189
|
-
this.publish({
|
|
192
|
+
if (request !== this.libraryRequest)
|
|
193
|
+
return;
|
|
194
|
+
if (library.issue !== undefined) {
|
|
195
|
+
this.publish({ status: 'unavailable', library: undefined, issue: library.issue });
|
|
196
|
+
return;
|
|
190
197
|
}
|
|
198
|
+
const selectedId = this.state.selectedId;
|
|
199
|
+
const selectionGone = selectedId !== undefined && !library.assets.some(asset => asset.id === selectedId);
|
|
200
|
+
this.publish({
|
|
201
|
+
status: 'ready', library, issue: undefined,
|
|
202
|
+
...(selectionGone ? { selectedId: undefined, detail: undefined, file: undefined, fileText: undefined } : {}),
|
|
203
|
+
});
|
|
191
204
|
}
|
|
192
205
|
catch (error) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
this.publish({ status: 'unavailable', issue: String(error) });
|
|
206
|
+
if (request === this.libraryRequest)
|
|
207
|
+
this.publish({ status: 'unavailable', issue: String(error) });
|
|
196
208
|
}
|
|
197
209
|
}
|
|
198
210
|
/**
|
|
@@ -200,7 +212,7 @@ export class TeamSkillsController {
|
|
|
200
212
|
* @param assetId - asset identity.
|
|
201
213
|
*/
|
|
202
214
|
async select(assetId) {
|
|
203
|
-
this.publish({ selectedId: assetId, detail: undefined });
|
|
215
|
+
this.publish({ selectedId: assetId, detail: undefined, file: undefined, fileText: undefined });
|
|
204
216
|
const answer = unwrap(await this.api().detail(assetId));
|
|
205
217
|
if (this.disposed || this.state.selectedId !== assetId)
|
|
206
218
|
return;
|
|
@@ -224,7 +236,7 @@ export class TeamSkillsController {
|
|
|
224
236
|
this.publish({ file: path, fileText: undefined });
|
|
225
237
|
try {
|
|
226
238
|
const answer = unwrap(await this.api().readFile(assetId, path));
|
|
227
|
-
if (this.state.file !== path)
|
|
239
|
+
if (this.state.selectedId !== assetId || this.state.file !== path)
|
|
228
240
|
return;
|
|
229
241
|
if ('text' in answer)
|
|
230
242
|
this.publish({ fileText: answer.text });
|
|
@@ -232,7 +244,9 @@ export class TeamSkillsController {
|
|
|
232
244
|
this.publish({ message: answer.detail, failed: true });
|
|
233
245
|
}
|
|
234
246
|
catch (error) {
|
|
235
|
-
this.
|
|
247
|
+
if (this.state.selectedId === assetId && this.state.file === path) {
|
|
248
|
+
this.publish({ message: String(error), failed: true });
|
|
249
|
+
}
|
|
236
250
|
}
|
|
237
251
|
}
|
|
238
252
|
/**
|
|
@@ -244,13 +258,17 @@ export class TeamSkillsController {
|
|
|
244
258
|
const assetId = this.state.selectedId;
|
|
245
259
|
if (assetId === undefined)
|
|
246
260
|
return;
|
|
261
|
+
const version = this.state.detail?.asset.version;
|
|
247
262
|
await this.run(async () => {
|
|
248
|
-
const
|
|
263
|
+
const api = this.api();
|
|
264
|
+
const answer = unwrap(await api.writeFile(assetId, path, text, version));
|
|
249
265
|
if (!isDetail(answer))
|
|
250
266
|
return answer.detail;
|
|
251
|
-
this.
|
|
252
|
-
|
|
253
|
-
await this.
|
|
267
|
+
if (this.state.selectedId === assetId)
|
|
268
|
+
this.publish({ detail: answer });
|
|
269
|
+
await this.refresh(true);
|
|
270
|
+
if (this.state.selectedId === assetId)
|
|
271
|
+
await this.openFile(path);
|
|
254
272
|
return 'saved';
|
|
255
273
|
});
|
|
256
274
|
}
|
|
@@ -265,13 +283,14 @@ export class TeamSkillsController {
|
|
|
265
283
|
if (!isDetail(answer))
|
|
266
284
|
return answer.detail;
|
|
267
285
|
this.publish({ detail: answer, selectedId: answer.asset.id });
|
|
268
|
-
await this.refresh();
|
|
286
|
+
await this.refresh(true);
|
|
269
287
|
return 'created';
|
|
270
288
|
});
|
|
271
289
|
}
|
|
272
290
|
/**
|
|
273
291
|
* Import one folder the user picked.
|
|
274
292
|
* @param files - the picker's files, already carrying relative paths.
|
|
293
|
+
* @returns the asset identity when the folder was imported.
|
|
275
294
|
*/
|
|
276
295
|
async importFolder(files) {
|
|
277
296
|
if (files.length === 0)
|
|
@@ -280,14 +299,15 @@ export class TeamSkillsController {
|
|
|
280
299
|
path: file.path,
|
|
281
300
|
base64: encodeBase64(file.content),
|
|
282
301
|
}));
|
|
302
|
+
let importedId;
|
|
283
303
|
await this.run(async () => {
|
|
284
304
|
const answer = unwrap(await this.api().importSkill(payload));
|
|
285
305
|
if (!isDetail(answer))
|
|
286
306
|
return answer.detail;
|
|
287
|
-
this.
|
|
288
|
-
await this.refresh();
|
|
307
|
+
importedId = await this.showCreatedAsset(answer);
|
|
289
308
|
return 'imported';
|
|
290
309
|
});
|
|
310
|
+
return importedId;
|
|
291
311
|
}
|
|
292
312
|
/**
|
|
293
313
|
* Scan the Host's import folder and publish every new legal skill.
|
|
@@ -303,23 +323,34 @@ export class TeamSkillsController {
|
|
|
303
323
|
return answer.detail;
|
|
304
324
|
}
|
|
305
325
|
this.publish({ scan: answer });
|
|
306
|
-
await this.refresh();
|
|
326
|
+
await this.refresh(true);
|
|
307
327
|
return 'scanned';
|
|
308
328
|
});
|
|
309
329
|
}
|
|
310
330
|
/**
|
|
311
331
|
* Copy one shipped skill into an editable override.
|
|
312
332
|
* @param skillId - shipped skill id.
|
|
333
|
+
* @param switchBindings - whether to move current role bindings to the copy.
|
|
334
|
+
* @returns the copy's asset identity when the Host created it.
|
|
313
335
|
*/
|
|
314
|
-
async createOverride(skillId) {
|
|
336
|
+
async createOverride(skillId, switchBindings) {
|
|
337
|
+
let copyId;
|
|
315
338
|
await this.run(async () => {
|
|
316
|
-
const
|
|
339
|
+
const api = this.api();
|
|
340
|
+
const answer = unwrap(await api.overrideSkill(skillId, switchBindings));
|
|
317
341
|
if (!isDetail(answer))
|
|
318
342
|
return answer.detail;
|
|
319
|
-
this.
|
|
320
|
-
await this.refresh();
|
|
343
|
+
copyId = await this.showCreatedAsset(answer);
|
|
321
344
|
return 'override-created';
|
|
322
345
|
});
|
|
346
|
+
return copyId;
|
|
347
|
+
}
|
|
348
|
+
async showCreatedAsset(detail) {
|
|
349
|
+
await this.refresh(true);
|
|
350
|
+
const assetId = detail.asset.id;
|
|
351
|
+
this.publish({ selectedId: assetId, detail, file: undefined, fileText: undefined });
|
|
352
|
+
await this.openFile('SKILL.md');
|
|
353
|
+
return assetId;
|
|
323
354
|
}
|
|
324
355
|
/**
|
|
325
356
|
* Discard one override's edits by re-copying the shipped skill.
|
|
@@ -330,7 +361,10 @@ export class TeamSkillsController {
|
|
|
330
361
|
const answer = unwrap(await this.api().resetSkill(assetId));
|
|
331
362
|
if (!isDetail(answer))
|
|
332
363
|
return answer.detail;
|
|
333
|
-
this.
|
|
364
|
+
if (this.state.selectedId === assetId) {
|
|
365
|
+
this.publish({ detail: answer });
|
|
366
|
+
await this.openFile('SKILL.md');
|
|
367
|
+
}
|
|
334
368
|
await this.refresh();
|
|
335
369
|
return 'override-reset';
|
|
336
370
|
});
|
|
@@ -344,7 +378,7 @@ export class TeamSkillsController {
|
|
|
344
378
|
let outcome;
|
|
345
379
|
await this.run(async () => {
|
|
346
380
|
outcome = unwrap(await this.api().deleteAsset(assetId));
|
|
347
|
-
await this.refresh();
|
|
381
|
+
await this.refresh(outcome.ok);
|
|
348
382
|
if (!outcome.ok)
|
|
349
383
|
return outcome.blockers.map(blocker => `${blocker.kind}: ${blocker.detail}`).join('; ');
|
|
350
384
|
this.publish({ selectedId: undefined, detail: undefined });
|
|
@@ -437,7 +471,7 @@ export class TeamSkillsController {
|
|
|
437
471
|
const message = await work();
|
|
438
472
|
// A success is shown by the refreshed panel itself; only a refusal needs
|
|
439
473
|
// words, so a machine key never reaches the user as raw text.
|
|
440
|
-
const succeeded = /^(saved|created|imported|deleted|assigned|unassigned|scanned|override
|
|
474
|
+
const succeeded = /^(saved|created|imported|deleted|assigned|unassigned|scanned|override-created|override-reset|restored-bindings)$/u.test(message);
|
|
441
475
|
this.publish({ busy: false, message: succeeded ? undefined : message, failed: !succeeded });
|
|
442
476
|
}
|
|
443
477
|
catch (error) {
|
package/lib/types/index.js
CHANGED
|
@@ -27,10 +27,11 @@ import { hasTeamApplicationMarker, isSessionRoot, TeamExecutionMonitor, teammate
|
|
|
27
27
|
import { membershipOf } from "./team-runtime.js";
|
|
28
28
|
import { RUN_CODE_NAME } from '@deepseek-ai/dsh-tools';
|
|
29
29
|
import { registerPresetTools } from "./preset-tools.js";
|
|
30
|
-
import {
|
|
30
|
+
import { teamModeAdmitsTools } from "./team-mode.js";
|
|
31
|
+
import { CAPTAIN_ROLE, TeamSkills, resolveSkillRoot } from "./team-skills/index.js";
|
|
31
32
|
import { TeamSkillService } from "./team-skills/service.js";
|
|
32
33
|
import { registerTeamSkillTools } from "./team-skills/tools.js";
|
|
33
|
-
import { definitionFingerprint, findMemberById, findTeam, memberRouteOf, sameMemberRoute, selectedRoleId, selectedTeam, toolMode } from "./presets.js";
|
|
34
|
+
import { definitionFingerprint, findMemberById, findTeam, memberRouteOf, recordedMemberRole, sameMemberRoute, selectedRoleId, selectedTeam, toolMode } from "./presets.js";
|
|
34
35
|
import TeamPresetsToolCatalog from "./tool-catalog.js";
|
|
35
36
|
import { CAPTAIN_RECOVERY_TOOLS, descriptorPolicy, guardPolicy, hasLegacyPresetBriefing, policyOf } from "./tool-policy.js";
|
|
36
37
|
export { Config } from "./config.js";
|
|
@@ -318,12 +319,10 @@ export function apply(ctx, config) {
|
|
|
318
319
|
quarantines.get(agent)?.dispose();
|
|
319
320
|
quarantines.delete(agent);
|
|
320
321
|
managedMembers.add(agent);
|
|
321
|
-
//
|
|
322
|
-
//
|
|
323
|
-
// the current Settings, exactly as its route and policy are.
|
|
322
|
+
// Use the snapshot's role id or its saved display name when restoring
|
|
323
|
+
// Team Skills. The current summon target may have changed ownership.
|
|
324
324
|
const claimedTeam = findTeam(config.teams.get(), claim.record.teamId);
|
|
325
|
-
const role = claim.record
|
|
326
|
-
?? (claimedTeam === undefined ? claim.record.memberName : roleOfMember(claimedTeam, claim.record.memberName));
|
|
325
|
+
const role = recordedMemberRole(claimedTeam, claim.record);
|
|
327
326
|
let installation;
|
|
328
327
|
if (role !== undefined) {
|
|
329
328
|
const assignment = { teamId: claim.record.teamId, roleId: role, captain: false };
|
|
@@ -924,19 +923,45 @@ export function apply(ctx, config) {
|
|
|
924
923
|
const selection = config.selections.get().find(row => row.sessionId === agent.session.id);
|
|
925
924
|
const selectedId = selection?.teamId;
|
|
926
925
|
const selectedRole = selectedRoleId(selection);
|
|
927
|
-
// The
|
|
928
|
-
//
|
|
929
|
-
//
|
|
930
|
-
//
|
|
931
|
-
//
|
|
932
|
-
|
|
933
|
-
|
|
926
|
+
// The seven Team-themed tools follow the Session's Team mode, exactly as the
|
|
927
|
+
// official team_task_* tools do: with Team mode off there is no Team, no
|
|
928
|
+
// selected role and no library to manage, and the composer offers no Team
|
|
929
|
+
// control either. Registration is what carries that decision, so the two
|
|
930
|
+
// states are "installed" and "not installed" — never "registered but
|
|
931
|
+
// unreadable", which is what a step-time `when` condition would produce for
|
|
932
|
+
// the quarantine guard, the capability preflight and member routing.
|
|
933
|
+
// A deployment that composes no Agent Teams service publishes no projection.
|
|
934
|
+
// Reading that absence through `ctx.get` is the only safe way to ask: the
|
|
935
|
+
// injected property throws when the service is missing, and an unknown mode
|
|
936
|
+
// must keep the tools exactly as they were.
|
|
937
|
+
let projections;
|
|
938
|
+
try {
|
|
939
|
+
projections = ctx.get('sessionProjections');
|
|
940
|
+
}
|
|
941
|
+
catch {
|
|
942
|
+
projections = undefined;
|
|
943
|
+
}
|
|
944
|
+
const teamToolsAdmitted = teamModeAdmitsTools(projections, agent);
|
|
945
|
+
if (!teamToolsAdmitted) {
|
|
946
|
+
presetTools.get(agent)?.();
|
|
947
|
+
presetTools.delete(agent);
|
|
948
|
+
skillTools.get(agent)?.();
|
|
949
|
+
skillTools.delete(agent);
|
|
934
950
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
951
|
+
else {
|
|
952
|
+
// The preset tools are the discovery path, not a Team capability: a user can
|
|
953
|
+
// ask the captain to adjust "the Team preset" before this Session selects
|
|
954
|
+
// one, and the captain must be able to read the configured Teams and ask
|
|
955
|
+
// which one. They therefore belong to every admitted Session root.
|
|
956
|
+
if (!presetTools.has(agent)) {
|
|
957
|
+
presetTools.set(agent, registerPresetTools(ctx, agent, config, NAMESPACE, root => applications.get(root)?.teamId));
|
|
958
|
+
}
|
|
959
|
+
// The library is managed by the user through the captain, on the Session root
|
|
960
|
+
// only: a teammate able to grant itself a skill would defeat the per-Agent
|
|
961
|
+
// isolation the subsystem exists for.
|
|
962
|
+
if (!skillTools.has(agent)) {
|
|
963
|
+
skillTools.set(agent, registerTeamSkillTools(ctx, agent, skillToolDeps));
|
|
964
|
+
}
|
|
940
965
|
}
|
|
941
966
|
// The Team Skill library is managed by the user through the captain, on the
|
|
942
967
|
// Session root only: a teammate able to grant itself a skill would defeat the
|
|
@@ -1331,6 +1356,19 @@ export function apply(ctx, config) {
|
|
|
1331
1356
|
// instead of through `agent/status`. The phase is read on the next microtask,
|
|
1332
1357
|
// so the projection has folded the append this listener just saw, and several
|
|
1333
1358
|
// settlements in one append batch cost one read.
|
|
1359
|
+
// The Team mode itself is a Session event, so a Session that turns Agent Teams
|
|
1360
|
+
// on or off mid-life gains or loses the Team-themed tools at that commit — the
|
|
1361
|
+
// same edge the official team_task_* tools follow. The mode is read from the
|
|
1362
|
+
// projection, which has folded this append by the next microtask.
|
|
1363
|
+
ctx.on('session/event', (session, event) => {
|
|
1364
|
+
if (event.type !== 'team/mode')
|
|
1365
|
+
return;
|
|
1366
|
+
const agent = ctx.agents.get(session.id);
|
|
1367
|
+
if (agent === undefined || !isSessionRoot(agent))
|
|
1368
|
+
return;
|
|
1369
|
+
queueMicrotask(() => { if (!disposed)
|
|
1370
|
+
reconcile(agent); });
|
|
1371
|
+
});
|
|
1334
1372
|
ctx.on('session/event', (session, event) => {
|
|
1335
1373
|
if (event.type !== 'subagent/catalog')
|
|
1336
1374
|
return;
|