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
package/lib/index.js
CHANGED
|
@@ -54,64 +54,87 @@ const IMPLICIT_TOOLS = [SKILL_TOOL_NAME];
|
|
|
54
54
|
function toolMode(agent) {
|
|
55
55
|
return agent.toolMode ?? (agent.tools.length === 0 ? "all" : "custom");
|
|
56
56
|
}
|
|
57
|
-
/** The
|
|
57
|
+
/** The grammar and length of a configured member's summon target. */
|
|
58
58
|
const MEMBER_TARGET = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
59
|
+
const MEMBER_TARGET_LIMIT = 64;
|
|
60
|
+
/** Return the member's normalized name when it can be used as a target. */
|
|
61
|
+
function preferredMemberTarget(member) {
|
|
62
|
+
const target = member.name.trim().toLowerCase();
|
|
63
|
+
return target !== "lead" && target.length <= MEMBER_TARGET_LIMIT && MEMBER_TARGET.test(target) ? target : void 0;
|
|
64
|
+
}
|
|
59
65
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* Teammate names are permanent, lower-kebab-case, and never reused, so a
|
|
63
|
-
* display name that already satisfies the grammar is kept and any other name
|
|
64
|
-
* is transliterated to `member-<index>`. The display name still reaches the
|
|
65
|
-
* captain through the roster.
|
|
66
|
+
* Claim a target for one member after the Team's preferred targets are reserved.
|
|
66
67
|
* @param member - the configured member.
|
|
67
68
|
* @param index - zero-based position in the Team's member list.
|
|
68
69
|
* @param used - targets already taken in this Team; the returned target is added.
|
|
69
70
|
* @returns the teammate target this member is summoned under.
|
|
70
71
|
*/
|
|
71
72
|
function memberTarget(member, index, used) {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
target =
|
|
78
|
-
|
|
73
|
+
const preferred = preferredMemberTarget(member);
|
|
74
|
+
let target;
|
|
75
|
+
if (preferred === void 0) {
|
|
76
|
+
let number = index + 1;
|
|
77
|
+
while (used.has(`member-${number}`)) number += 1;
|
|
78
|
+
target = `member-${number}`;
|
|
79
|
+
} else {
|
|
80
|
+
target = preferred;
|
|
81
|
+
let suffix = 2;
|
|
82
|
+
while (used.has(target)) {
|
|
83
|
+
const tail = `-${suffix}`;
|
|
84
|
+
target = `${preferred.slice(0, MEMBER_TARGET_LIMIT - tail.length).replace(/-+$/u, "")}${tail}`;
|
|
85
|
+
suffix += 1;
|
|
86
|
+
}
|
|
79
87
|
}
|
|
80
88
|
used.add(target);
|
|
81
89
|
return target;
|
|
82
90
|
}
|
|
83
91
|
/**
|
|
84
|
-
* Resolve one member by its display name or its teammate target.
|
|
85
|
-
*
|
|
86
|
-
* The resolved target travels with the member, so a caller never re-derives it
|
|
87
|
-
* and cannot disagree with the roster about the name it summons.
|
|
88
|
-
* @param team - the Team preset to search.
|
|
89
|
-
* @param key - the model-authored member name.
|
|
90
|
-
* @returns the matching member with its target, or undefined when the name is unknown.
|
|
91
|
-
*/
|
|
92
|
-
function findMember(team, key) {
|
|
93
|
-
const wanted = key.trim();
|
|
94
|
-
const used = /* @__PURE__ */ new Set();
|
|
95
|
-
for (const [index, member] of team.members.entries()) {
|
|
96
|
-
const target = memberTarget(member, index, used);
|
|
97
|
-
if (target === wanted.toLowerCase() || member.name.trim() === wanted) return {
|
|
98
|
-
member,
|
|
99
|
-
target
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
92
|
* List every addressable teammate target of one Team.
|
|
105
93
|
* @param team - the Team preset.
|
|
106
94
|
* @returns one entry per member, in declared order.
|
|
107
95
|
*/
|
|
108
96
|
function memberTargets(team) {
|
|
109
97
|
const used = /* @__PURE__ */ new Set();
|
|
98
|
+
const preferred = team.members.map(preferredMemberTarget);
|
|
99
|
+
const targets = preferred.map((target) => {
|
|
100
|
+
if (target === void 0 || used.has(target)) return void 0;
|
|
101
|
+
used.add(target);
|
|
102
|
+
return target;
|
|
103
|
+
});
|
|
104
|
+
for (const [index, target] of preferred.entries()) {
|
|
105
|
+
if (target !== void 0) continue;
|
|
106
|
+
const fallback = `member-${index + 1}`;
|
|
107
|
+
if (used.has(fallback)) continue;
|
|
108
|
+
used.add(fallback);
|
|
109
|
+
targets[index] = fallback;
|
|
110
|
+
}
|
|
110
111
|
return team.members.map((member, index) => ({
|
|
111
112
|
member,
|
|
112
|
-
target: memberTarget(member, index, used)
|
|
113
|
+
target: targets[index] ?? memberTarget(member, index, used)
|
|
113
114
|
}));
|
|
114
115
|
}
|
|
116
|
+
/** Resolve an exact target, then an exact display name, then a case-insensitive target. */
|
|
117
|
+
function findMemberInRoster(roster, key) {
|
|
118
|
+
const wanted = key.trim();
|
|
119
|
+
const normalized = wanted.toLowerCase();
|
|
120
|
+
return roster.find((row) => row.target === wanted) ?? roster.find((row) => row.member.name.trim() === wanted) ?? roster.find((row) => row.target === normalized);
|
|
121
|
+
}
|
|
122
|
+
/** Resolve one member by display name or the same target shown in the roster. */
|
|
123
|
+
function findMember(team, key) {
|
|
124
|
+
return findMemberInRoster(memberTargets(team), key);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Recover the role of a durable instance created before role ids were recorded.
|
|
128
|
+
* Its instance name can overlap a different role's current summon target.
|
|
129
|
+
*/
|
|
130
|
+
function recordedMemberRole(team, record) {
|
|
131
|
+
if (record.roleId !== void 0) return record.roleId;
|
|
132
|
+
if (team === void 0) return record.memberName;
|
|
133
|
+
const matches = team.members.filter((member) => member.name.trim() === record.displayName);
|
|
134
|
+
if (matches.length !== 1) return void 0;
|
|
135
|
+
const member = matches[0];
|
|
136
|
+
return member.id ?? member.name;
|
|
137
|
+
}
|
|
115
138
|
/**
|
|
116
139
|
* Select the fields of one slot that a Team task owns.
|
|
117
140
|
*
|
|
@@ -7807,16 +7830,131 @@ const OFFICIAL_REPOSITORY_SKILLS = [{
|
|
|
7807
7830
|
roleName: "repository-specialist"
|
|
7808
7831
|
}];
|
|
7809
7832
|
/**
|
|
7810
|
-
* The
|
|
7811
|
-
*
|
|
7833
|
+
* The leader workflow skills, assigned by default to the `team-lead` captain of
|
|
7834
|
+
* every software engineering Team: dispatching and reporting, the bounded
|
|
7835
|
+
* medium-task board, the long-running delivery plan, and the subagent
|
|
7836
|
+
* orchestration rules a captain needs before it may explore in parallel.
|
|
7812
7837
|
*/
|
|
7813
|
-
const
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7838
|
+
const OFFICIAL_LEADER_SKILLS = [
|
|
7839
|
+
{
|
|
7840
|
+
skillId: "agent-leader-communication",
|
|
7841
|
+
roleName: "team-lead"
|
|
7842
|
+
},
|
|
7843
|
+
{
|
|
7844
|
+
skillId: "leader-medium-task-workflow",
|
|
7845
|
+
roleName: "team-lead"
|
|
7846
|
+
},
|
|
7847
|
+
{
|
|
7848
|
+
skillId: "leader-long-task-orchestration",
|
|
7849
|
+
roleName: "team-lead"
|
|
7850
|
+
},
|
|
7851
|
+
{
|
|
7852
|
+
skillId: "agent-subagent-orchestration",
|
|
7853
|
+
roleName: "team-lead"
|
|
7854
|
+
}
|
|
7855
|
+
];
|
|
7856
|
+
/**
|
|
7857
|
+
* The advisory workflow skill, assigned by default to the `fullstack-advisor`
|
|
7858
|
+
* role. The advisor stays single-threaded, so it never receives the subagent
|
|
7859
|
+
* orchestration skill.
|
|
7860
|
+
*/
|
|
7861
|
+
const OFFICIAL_ADVISOR_SKILLS = [{
|
|
7862
|
+
skillId: "fullstack-advisor",
|
|
7863
|
+
roleName: "fullstack-advisor"
|
|
7819
7864
|
}];
|
|
7865
|
+
/**
|
|
7866
|
+
* The delivery skills, assigned by default to the `executor` role of software
|
|
7867
|
+
* engineering Teams: the bounded implementation workflow, the parallel
|
|
7868
|
+
* work-package orchestration rules, and the two repository delivery skills.
|
|
7869
|
+
*/
|
|
7870
|
+
const OFFICIAL_DEVELOPMENT_EXECUTOR_SKILLS = [
|
|
7871
|
+
{
|
|
7872
|
+
skillId: "executor-short-task-workflow",
|
|
7873
|
+
roleName: "executor"
|
|
7874
|
+
},
|
|
7875
|
+
{
|
|
7876
|
+
skillId: "agent-subagent-orchestration",
|
|
7877
|
+
roleName: "executor"
|
|
7878
|
+
},
|
|
7879
|
+
{
|
|
7880
|
+
skillId: "git-release-hygiene",
|
|
7881
|
+
roleName: "executor"
|
|
7882
|
+
},
|
|
7883
|
+
{
|
|
7884
|
+
skillId: "github-repository-presentation",
|
|
7885
|
+
roleName: "executor"
|
|
7886
|
+
}
|
|
7887
|
+
];
|
|
7888
|
+
/**
|
|
7889
|
+
* The default assignments of a software engineering Team that carries an
|
|
7890
|
+
* advisory role: leader, advisor, then executor. `agent-subagent-orchestration`
|
|
7891
|
+
* is deliberately bound to two roles and to no third one.
|
|
7892
|
+
*/
|
|
7893
|
+
const OFFICIAL_DEVELOPMENT_SKILLS = [
|
|
7894
|
+
...OFFICIAL_LEADER_SKILLS,
|
|
7895
|
+
...OFFICIAL_ADVISOR_SKILLS,
|
|
7896
|
+
...OFFICIAL_DEVELOPMENT_EXECUTOR_SKILLS
|
|
7897
|
+
];
|
|
7898
|
+
/**
|
|
7899
|
+
* The professional-role workflows, one main skill per specialist role: the
|
|
7900
|
+
* UI frontend engineer, the backend architect, and the independent reviewer.
|
|
7901
|
+
*
|
|
7902
|
+
* Each is a progressive-loading entry point — the detailed methods live in its
|
|
7903
|
+
* own `references/` folder and are read on demand, never registered as skills
|
|
7904
|
+
* of their own. The reviewer keeps the subagent orchestration rules because a
|
|
7905
|
+
* large, high-risk review may fan out; the two advisory-side roles never
|
|
7906
|
+
* dispatch.
|
|
7907
|
+
*/
|
|
7908
|
+
const OFFICIAL_PROFESSIONAL_SKILLS = [
|
|
7909
|
+
{
|
|
7910
|
+
skillId: "frontend-engineering-workflow",
|
|
7911
|
+
roleName: "ui-designer"
|
|
7912
|
+
},
|
|
7913
|
+
{
|
|
7914
|
+
skillId: "backend-architecture-workflow",
|
|
7915
|
+
roleName: "backend-architect"
|
|
7916
|
+
},
|
|
7917
|
+
{
|
|
7918
|
+
skillId: "independent-code-review-workflow",
|
|
7919
|
+
roleName: "reviewer"
|
|
7920
|
+
},
|
|
7921
|
+
{
|
|
7922
|
+
skillId: "agent-subagent-orchestration",
|
|
7923
|
+
roleName: "reviewer"
|
|
7924
|
+
}
|
|
7925
|
+
];
|
|
7926
|
+
/**
|
|
7927
|
+
* The reviewer's bindings alone.
|
|
7928
|
+
*
|
|
7929
|
+
* The 标准研发团队 has no specialist role, so it declares the leader, advisor,
|
|
7930
|
+
* executor, and reviewer defaults and nothing that names a role it does not
|
|
7931
|
+
* carry — a declaration with no matching role would never resolve, and the
|
|
7932
|
+
* catalog is what the Host reconciles against.
|
|
7933
|
+
*/
|
|
7934
|
+
const OFFICIAL_STANDARD_SKILLS = [
|
|
7935
|
+
...OFFICIAL_LEADER_SKILLS,
|
|
7936
|
+
...OFFICIAL_ADVISOR_SKILLS,
|
|
7937
|
+
{
|
|
7938
|
+
skillId: "independent-code-review-workflow",
|
|
7939
|
+
roleName: "reviewer"
|
|
7940
|
+
},
|
|
7941
|
+
{
|
|
7942
|
+
skillId: "agent-subagent-orchestration",
|
|
7943
|
+
roleName: "reviewer"
|
|
7944
|
+
},
|
|
7945
|
+
...OFFICIAL_DEVELOPMENT_EXECUTOR_SKILLS
|
|
7946
|
+
];
|
|
7947
|
+
/**
|
|
7948
|
+
* The default assignments of the 全栈软件研发团队, whose advisor work is split
|
|
7949
|
+
* into two specialist roles: leader, the frontend and backend workflows, the
|
|
7950
|
+
* reviewer pair, and the executor's own delivery skills. There is no single
|
|
7951
|
+
* `fullstack-advisor` binding, because that Team does not carry that role.
|
|
7952
|
+
*/
|
|
7953
|
+
const OFFICIAL_SPECIALIST_SKILLS = [
|
|
7954
|
+
...OFFICIAL_LEADER_SKILLS,
|
|
7955
|
+
...OFFICIAL_PROFESSIONAL_SKILLS,
|
|
7956
|
+
...OFFICIAL_DEVELOPMENT_EXECUTOR_SKILLS
|
|
7957
|
+
];
|
|
7820
7958
|
/** Every official Team, in install order: the three development Teams, then the six work modes. */
|
|
7821
7959
|
const BUILTIN_TEAM_CATALOG = [
|
|
7822
7960
|
{
|
|
@@ -7827,28 +7965,28 @@ const BUILTIN_TEAM_CATALOG = [
|
|
|
7827
7965
|
"version": 1,
|
|
7828
7966
|
"team": {
|
|
7829
7967
|
"name": "轻量研发团队",
|
|
7830
|
-
"description": "
|
|
7968
|
+
"description": "适合中小型功能迭代与多阶段开发。队长负责需求对齐、任务分级、并行探查与验收;顾问按需提供技术方案和验收契约;执行者负责并行实现、集成与验证。",
|
|
7831
7969
|
"captain": {
|
|
7832
7970
|
"name": "team-lead",
|
|
7833
|
-
"description": "
|
|
7834
|
-
"systemPrompt": "
|
|
7971
|
+
"description": "负责需求对齐、任务分级、团队调度、风险控制与最终验收。",
|
|
7972
|
+
"systemPrompt": "你是团队队长,负责需求对齐、任务分级、成员调度、结果整合与最终验收;仅在用户明确要求团队协作时召集成员。\n\n1. 确认目标、范围、验收、项目规则与权限。产品功能、流程、界面及重大范围由用户裁决;基线内技术方案由团队决定。\n2. 按规模路由:短程直接派发;中程用 `leader-medium-task-workflow`;长程用 `leader-long-task-orchestration`。通信使用 `agent-leader-communication`。\n3. 存在两个或以上独立工程探查方向时,必须用 `agent-subagent-orchestration` 并行探查,不得仅因即时委派成本而默认串行。\n4. 派发时明确任务范围、发现责任和验收;只传递必要事实、路径和符号,避免重复背景。多个独立编码工作包拆分后交执行者按其工作流处理。\n5. 父代理负责整合与最终验收;仅依据可复核证据报告完成,并列明未验证项、阻塞和风险。",
|
|
7835
7973
|
"color": "#4c8dff"
|
|
7836
7974
|
},
|
|
7837
7975
|
"members": [{
|
|
7838
7976
|
"name": "fullstack-advisor",
|
|
7839
|
-
"description": "
|
|
7840
|
-
"systemPrompt": "
|
|
7977
|
+
"description": "按需提供跨层技术决策、方案权衡、风险分析与可执行验收契约;不承担编码。",
|
|
7978
|
+
"systemPrompt": "你是全栈技术顾问,不负责编码、项目调度或产品裁决,保持单线程,不创建孙代理。使用 fullstack-advisor Skill 执行咨询工作流。\n1. 接收队长的决策问题、约束和事实来源;只调查影响判断的必要范围,复用已有调查。\n2. 输出首选方案、关键理由、主要权衡与风险、必要证据位置及可验证验收条件;区分事实、推断和假设。\n3. 功能、业务规则、用户流程和界面歧义交队长向用户确认;技术细节在已批准边界内自主分析。重大范围、兼容、预算或安全影响须标记升级。\n4. 默认只返回决策摘要,详细论证按需展开。不得修改生产代码、测试或脚本;不得把静态分析描述为运行验证。",
|
|
7841
7979
|
"color": "#e0a43c"
|
|
7842
7980
|
}, {
|
|
7843
7981
|
"name": "executor",
|
|
7844
|
-
"description": "
|
|
7845
|
-
"systemPrompt": "
|
|
7982
|
+
"description": "负责获派范围内的编码、调试、测试、修复与验证交接。",
|
|
7983
|
+
"systemPrompt": "你是研发执行者,负责获派范围内的实现、集成与验证。使用 executor-short-task-workflow 执行任务。\n1. 核对项目规则、任务范围、验收和接口契约;功能或界面歧义交队长。\n2. 存在两个或以上实质独立、可分别验收的编码工作包时,必须调用 agent-subagent-orchestration 并行执行,不得仅因即时委派开销而默认串行。先明确接口、文件所有权和局部验收。\n3. 按最小可验证切片实施,沿用项目技术栈,不改无关文件、不覆盖他人产物、不擅自扩大范围。孙代理不得继续派生;你负责检查 diff、集成、冲突处理和最终回归。\n4. 单一局部任务、强依赖或共享文件冲突时不强行并行;宿主能力/名额不足时说明原因并调整。运行与风险匹配的测试、lint、构建或真实链路,未运行不得报通过。\n5. 按 STATUS、TASK_ID、CHANGES、TESTS、BLOCKERS 汇报;证据提供路径和命令,长日志只给位置。Git/Release/仓库文档任务按需使用对应 Skill;push、发布和改写历史需单独授权。",
|
|
7846
7984
|
"color": "#4c8dff"
|
|
7847
7985
|
}]
|
|
7848
7986
|
}
|
|
7849
7987
|
},
|
|
7850
7988
|
metadata: {
|
|
7851
|
-
"summary": "
|
|
7989
|
+
"summary": "三角色协作的小型研发团队,支持按需并行探查与编码。",
|
|
7852
7990
|
"tags": [
|
|
7853
7991
|
"软件研发",
|
|
7854
7992
|
"小团队",
|
|
@@ -7860,44 +7998,90 @@ const BUILTIN_TEAM_CATALOG = [
|
|
|
7860
7998
|
"小范围重构"
|
|
7861
7999
|
],
|
|
7862
8000
|
"quickPrompts": ["为这个模块增加参数校验并补充测试", "修复这个已定位的缺陷并验证回归"],
|
|
7863
|
-
"notes": "
|
|
8001
|
+
"notes": "官方内置 Skill 共 9 项:队长 4 项、顾问 1 项、执行者 4 项。agent-subagent-orchestration 仅绑定队长与执行者;顾问保持单线程。grilling、research 不属于本团队绑定。"
|
|
7864
8002
|
},
|
|
7865
|
-
officialSkillBindings:
|
|
8003
|
+
officialSkillBindings: OFFICIAL_DEVELOPMENT_SKILLS
|
|
7866
8004
|
},
|
|
7867
8005
|
{
|
|
7868
8006
|
id: "builtin-standard",
|
|
7869
8007
|
series: "classic-development",
|
|
7870
8008
|
document: {
|
|
7871
8009
|
"format": "dsh-agent-team-preset",
|
|
7872
|
-
"version":
|
|
8010
|
+
"version": 2,
|
|
7873
8011
|
"team": {
|
|
7874
8012
|
"name": "标准研发团队",
|
|
7875
|
-
"description": "
|
|
8013
|
+
"description": "适合中型功能、重要重构与持续项目迭代。队长统筹;全栈顾问按需提供跨层技术决策与可执行验收契约;执行者持续研发;代码审查员对代码变更独立验收。",
|
|
7876
8014
|
"captain": {
|
|
7877
8015
|
"name": "team-lead",
|
|
7878
|
-
"description": "
|
|
7879
|
-
"
|
|
7880
|
-
"
|
|
8016
|
+
"description": "负责需求对齐、任务分级、团队调度、风险控制与最终验收。",
|
|
8017
|
+
"color": "#4c8dff",
|
|
8018
|
+
"systemPrompt": "你是团队队长,负责需求对齐、任务分级、成员调度、结果整合与最终验收;仅在用户明确要求团队协作时召集成员。\n\n1. 确认目标、范围、验收、项目规则与权限。产品功能、流程、界面及重大范围由用户裁决;基线内技术方案由团队决定。\n2. 按规模路由:短程直接派发;中程用 `leader-medium-task-workflow`;长程用 `leader-long-task-orchestration`。通信使用 `agent-leader-communication`。reviewer 对有代码变更的交付开展独立审查:高风险切片提前介入,修复后只复审改动差异与相关回归。\n3. 存在两个或以上独立工程探查方向时,必须用 `agent-subagent-orchestration` 并行探查,不得仅因即时委派成本而默认串行。\n4. 派发时明确任务范围、发现责任和验收;只传递必要事实、路径和符号,避免重复背景。多个独立编码工作包拆分后交执行者按其工作流处理。\n5. 父代理负责整合与最终验收;仅依据可复核证据报告完成,并列明未验证项、阻塞和风险。"
|
|
7881
8019
|
},
|
|
7882
8020
|
"members": [
|
|
7883
8021
|
{
|
|
7884
8022
|
"name": "fullstack-advisor",
|
|
7885
|
-
"description": "
|
|
7886
|
-
"systemPrompt": "
|
|
8023
|
+
"description": "全栈顾问:按需提供跨层技术决策、方案权衡、风险分析与可执行验收契约;不承担编码。",
|
|
8024
|
+
"systemPrompt": "你是团队全栈顾问,不负责常规编码、项目调度或产品裁决,保持单线程,不创建孙代理。使用 `fullstack-advisor` Skill 执行咨询工作流。\n1. 接收队长的决策问题、约束和事实来源;只调查影响判断的必要范围,复用已有调查。\n2. 输出首选方案、关键理由、主要权衡与风险、必要证据位置及可验证验收条件;区分事实、推断和假设。\n3. 功能、业务规则、用户流程和界面歧义交队长向用户确认;技术细节在已批准边界内自主分析。重大范围、兼容、预算或安全影响须标记升级。\n4. 默认只返回决策摘要,详细论证按需展开。不得修改生产代码、测试或脚本;不得把静态分析描述为运行验证。",
|
|
7887
8025
|
"color": "#e0a43c"
|
|
7888
8026
|
},
|
|
7889
8027
|
{
|
|
7890
8028
|
"name": "reviewer",
|
|
7891
|
-
"description": "
|
|
7892
|
-
"systemPrompt": "
|
|
8029
|
+
"description": "代码审查员:独立审查所有成员的实际代码变更,验证需求符合性、工程规范、测试有效性及安全/并发/兼容性风险。",
|
|
8030
|
+
"systemPrompt": "你是团队独立代码审查员,审查队长、UI 前端工程师与后端架构师的实际代码变更;保持只读,不修改被审查实现。使用 `independent-code-review-workflow` 作为审查入口,按风险按需加载参考资料。以项目规范和需求为依据,提交可复核的问题、证据及风险;不得将未经验证的判断写成缺陷,必要证据不足时明确说明。\n1. 围绕实际变更、关键调用链与约定的验收契约审查功能、安全权限、并发、兼容迁移和重要界面状态;不无目的扫描全仓。\n2. 确认测试到达目标路径、关键断言能捕获缺陷;mock、全绿和静态检查均不自动等于真实验证。独立复跑前确认权限与隔离范围,不污染共享文件。\n3. 将发现区分为已证实缺陷、待验证风险与建议;按 P0/P1/P2/P3 报告位置、触发条件、影响、证据和最小修复建议。复审聚焦修复差异与相关回归。\n4. 视觉判断需亲自读取实际截图;设计争议交队长协调。结论为通过、需修改或证据不足;必要项未验证不得放行,风险接受交队长裁决。\n5. 沿用既有团队通信规范提交审查结论:先给结论,再列可复核的证据位置、未验证项与待决风险。",
|
|
7893
8031
|
"color": "#8d6bff"
|
|
7894
8032
|
},
|
|
7895
8033
|
{
|
|
7896
8034
|
"name": "executor",
|
|
7897
|
-
"description": "
|
|
7898
|
-
"systemPrompt": "
|
|
8035
|
+
"description": "负责获派范围内的编码、调试、测试、修复与验证交接。",
|
|
8036
|
+
"systemPrompt": "你是研发执行者,负责获派范围内的实现、集成与验证。使用 executor-short-task-workflow 执行任务。\n1. 核对项目规则、任务范围、验收和接口契约;功能或界面歧义交队长。\n2. 存在两个或以上实质独立、可分别验收的编码工作包时,必须调用 agent-subagent-orchestration 并行执行,不得仅因即时委派开销而默认串行。先明确接口、文件所有权和局部验收。\n3. 按最小可验证切片实施,沿用项目技术栈,不改无关文件、不覆盖他人产物、不擅自扩大范围。孙代理不得继续派生;你负责检查 diff、集成、冲突处理和最终回归。\n4. 单一局部任务、强依赖或共享文件冲突时不强行并行;宿主能力/名额不足时说明原因并调整。运行与风险匹配的测试、lint、构建或真实链路,未运行不得报通过。\n5. 按 STATUS、TASK_ID、CHANGES、TESTS、BLOCKERS 汇报;证据提供路径和命令,长日志只给位置。Git/Release/仓库文档任务按需使用对应 Skill;push、发布和改写历史需单独授权。",
|
|
7899
8037
|
"color": "#4c8dff"
|
|
7900
8038
|
}
|
|
8039
|
+
],
|
|
8040
|
+
"officialSkills": [
|
|
8041
|
+
{
|
|
8042
|
+
"skillId": "agent-leader-communication",
|
|
8043
|
+
"roleName": "team-lead"
|
|
8044
|
+
},
|
|
8045
|
+
{
|
|
8046
|
+
"skillId": "leader-medium-task-workflow",
|
|
8047
|
+
"roleName": "team-lead"
|
|
8048
|
+
},
|
|
8049
|
+
{
|
|
8050
|
+
"skillId": "leader-long-task-orchestration",
|
|
8051
|
+
"roleName": "team-lead"
|
|
8052
|
+
},
|
|
8053
|
+
{
|
|
8054
|
+
"skillId": "agent-subagent-orchestration",
|
|
8055
|
+
"roleName": "team-lead"
|
|
8056
|
+
},
|
|
8057
|
+
{
|
|
8058
|
+
"skillId": "fullstack-advisor",
|
|
8059
|
+
"roleName": "fullstack-advisor"
|
|
8060
|
+
},
|
|
8061
|
+
{
|
|
8062
|
+
"skillId": "independent-code-review-workflow",
|
|
8063
|
+
"roleName": "reviewer"
|
|
8064
|
+
},
|
|
8065
|
+
{
|
|
8066
|
+
"skillId": "agent-subagent-orchestration",
|
|
8067
|
+
"roleName": "reviewer"
|
|
8068
|
+
},
|
|
8069
|
+
{
|
|
8070
|
+
"skillId": "executor-short-task-workflow",
|
|
8071
|
+
"roleName": "executor"
|
|
8072
|
+
},
|
|
8073
|
+
{
|
|
8074
|
+
"skillId": "agent-subagent-orchestration",
|
|
8075
|
+
"roleName": "executor"
|
|
8076
|
+
},
|
|
8077
|
+
{
|
|
8078
|
+
"skillId": "git-release-hygiene",
|
|
8079
|
+
"roleName": "executor"
|
|
8080
|
+
},
|
|
8081
|
+
{
|
|
8082
|
+
"skillId": "github-repository-presentation",
|
|
8083
|
+
"roleName": "executor"
|
|
8084
|
+
}
|
|
7901
8085
|
]
|
|
7902
8086
|
}
|
|
7903
8087
|
},
|
|
@@ -7914,50 +8098,100 @@ const BUILTIN_TEAM_CATALOG = [
|
|
|
7914
8098
|
"持续项目迭代"
|
|
7915
8099
|
],
|
|
7916
8100
|
"quickPrompts": ["实现这个中型功能并完成独立审查", "重构这个模块并保证测试全部通过"],
|
|
7917
|
-
"notes": "
|
|
8101
|
+
"notes": "四个成员(含队长):全栈顾问提供跨层技术决策与验收契约,执行者承担常规实施,代码审查员独立验收。"
|
|
7918
8102
|
},
|
|
7919
|
-
officialSkillBindings:
|
|
8103
|
+
officialSkillBindings: OFFICIAL_STANDARD_SKILLS
|
|
7920
8104
|
},
|
|
7921
8105
|
{
|
|
7922
8106
|
id: "builtin-fullstack",
|
|
7923
8107
|
series: "classic-development",
|
|
7924
8108
|
document: {
|
|
7925
8109
|
"format": "dsh-agent-team-preset",
|
|
7926
|
-
"version":
|
|
8110
|
+
"version": 2,
|
|
7927
8111
|
"team": {
|
|
7928
8112
|
"name": "全栈软件研发团队",
|
|
7929
|
-
"description": "
|
|
8113
|
+
"description": "面向复杂 Web、桌面与 Android 工程。队长调度并验收;UI 前端工程师与后端架构师分别承担前端与后端专业工作;执行者负责常规开发测试;代码审查员独立验收;按风险召集成员并按切片交接。",
|
|
7930
8114
|
"captain": {
|
|
7931
8115
|
"name": "team-lead",
|
|
7932
|
-
"description": "
|
|
7933
|
-
"
|
|
7934
|
-
"
|
|
8116
|
+
"description": "负责需求对齐、任务分级、团队调度、风险控制与最终验收。",
|
|
8117
|
+
"color": "#4c8dff",
|
|
8118
|
+
"systemPrompt": "你是团队队长,负责需求对齐、任务分级、成员调度、结果整合与最终验收;仅在用户明确要求团队协作时召集成员。\n\n1. 确认目标、范围、验收、项目规则与权限。产品功能、流程、界面及重大范围由用户裁决;基线内技术方案由团队决定。\n2. 按规模路由:短程直接派发;中程用 `leader-medium-task-workflow`;长程用 `leader-long-task-orchestration`。通信使用 `agent-leader-communication`。executor 持续实施、调试与测试;接口、安全或系统设计风险咨询 backend-architect;新交互或视觉争议咨询 ui-designer;reviewer 负责高风险阶段与交付前独立审查,顾问按需参与,不默认全员并行。\n3. 存在两个或以上独立工程探查方向时,必须用 `agent-subagent-orchestration` 并行探查,不得仅因即时委派成本而默认串行。\n4. 派发时明确任务范围、发现责任和验收;只传递必要事实、路径和符号,避免重复背景。多个独立编码工作包拆分后交执行者按其工作流处理。\n5. 父代理负责整合与最终验收;仅依据可复核证据报告完成,并列明未验证项、阻塞和风险。"
|
|
7935
8119
|
},
|
|
7936
8120
|
"members": [
|
|
7937
8121
|
{
|
|
7938
8122
|
"name": "backend-architect",
|
|
7939
|
-
"description": "
|
|
7940
|
-
"systemPrompt": "
|
|
7941
|
-
"color": "#
|
|
8123
|
+
"description": "后端架构师:负责后端与系统架构、技术契约、复杂后端 Bug 根因分析与修复,以及高风险技术攻坚。",
|
|
8124
|
+
"systemPrompt": "你是团队后端架构师,负责系统架构、技术契约及复杂后端问题攻坚;可在获派范围内直接修复复杂 Bug 和架构性缺陷。\n常规 API、CRUD、一般业务逻辑和局部易定位 Bug 由队长或其他获派成员承担。使用 `backend-architecture-workflow` 作为专业工作入口,按任务需要加载参考资料。\n\n与 UI 前端工程师对齐接口契约,并明确文件所有权。未经授权不部署、发布、修改生产数据或执行破坏性操作。沿用既有团队通信规范交付决策、证据和验证结果。",
|
|
8125
|
+
"color": "#2fa5b6"
|
|
7942
8126
|
},
|
|
7943
8127
|
{
|
|
7944
8128
|
"name": "ui-designer",
|
|
7945
|
-
"description": "
|
|
7946
|
-
"systemPrompt": "
|
|
8129
|
+
"description": "UI 前端工程师:负责视觉方向、设计系统、前端组件与交互实现、真实页面视觉 QA 和前端缺陷修复。",
|
|
8130
|
+
"systemPrompt": "你是团队 UI 前端工程师,负责视觉方向、设计系统、前端组件与交互实现、真实页面视觉 QA 和前端缺陷修复,可直接修改获派范围内的前端代码和测试。\n常规前端实施按复杂度分配,队长也可自行承担。你不修改后端、数据库或服务端契约;接口语义不清时咨询 backend-architect。\n\n使用 `frontend-engineering-workflow` 作为专业工作入口,按任务需要加载参考资料。与队长或其他写入者协作前明确文件所有权,沿用既有团队通信规范交接结果和验证证据。",
|
|
7947
8131
|
"color": "#2fbf71"
|
|
7948
8132
|
},
|
|
7949
8133
|
{
|
|
7950
8134
|
"name": "reviewer",
|
|
7951
|
-
"description": "
|
|
7952
|
-
"systemPrompt": "
|
|
8135
|
+
"description": "代码审查员:独立审查所有成员的实际代码变更,验证需求符合性、工程规范、测试有效性及安全/并发/兼容性风险。",
|
|
8136
|
+
"systemPrompt": "你是团队独立代码审查员,审查队长、UI 前端工程师与后端架构师的实际代码变更;保持只读,不修改被审查实现。使用 `independent-code-review-workflow` 作为审查入口,按风险按需加载参考资料。以项目规范和需求为依据,提交可复核的问题、证据及风险;不得将未经验证的判断写成缺陷,必要证据不足时明确说明。\n1. 围绕实际变更、关键调用链与约定的验收契约审查功能、安全权限、并发、兼容迁移和重要界面状态;不无目的扫描全仓。\n2. 确认测试到达目标路径、关键断言能捕获缺陷;mock、全绿和静态检查均不自动等于真实验证。独立复跑前确认权限与隔离范围,不污染共享文件。\n3. 将发现区分为已证实缺陷、待验证风险与建议;按 P0/P1/P2/P3 报告位置、触发条件、影响、证据和最小修复建议。复审聚焦修复差异与相关回归。\n4. 视觉判断需亲自读取实际截图;设计争议交队长协调。结论为通过、需修改或证据不足;必要项未验证不得放行,风险接受交队长裁决。\n5. 沿用既有团队通信规范提交审查结论:先给结论,再列可复核的证据位置、未验证项与待决风险。",
|
|
7953
8137
|
"color": "#8d6bff"
|
|
7954
8138
|
},
|
|
7955
8139
|
{
|
|
7956
8140
|
"name": "executor",
|
|
7957
|
-
"description": "
|
|
7958
|
-
"systemPrompt": "
|
|
8141
|
+
"description": "负责获派范围内的编码、调试、测试、修复与验证交接。",
|
|
8142
|
+
"systemPrompt": "你是研发执行者,负责获派范围内的实现、集成与验证。使用 executor-short-task-workflow 执行任务。\n1. 核对项目规则、任务范围、验收和接口契约;功能或界面歧义交队长。\n2. 存在两个或以上实质独立、可分别验收的编码工作包时,必须调用 agent-subagent-orchestration 并行执行,不得仅因即时委派开销而默认串行。先明确接口、文件所有权和局部验收。\n3. 按最小可验证切片实施,沿用项目技术栈,不改无关文件、不覆盖他人产物、不擅自扩大范围。孙代理不得继续派生;你负责检查 diff、集成、冲突处理和最终回归。\n4. 单一局部任务、强依赖或共享文件冲突时不强行并行;宿主能力/名额不足时说明原因并调整。运行与风险匹配的测试、lint、构建或真实链路,未运行不得报通过。\n5. 按 STATUS、TASK_ID、CHANGES、TESTS、BLOCKERS 汇报;证据提供路径和命令,长日志只给位置。Git/Release/仓库文档任务按需使用对应 Skill;push、发布和改写历史需单独授权。",
|
|
7959
8143
|
"color": "#4c8dff"
|
|
7960
8144
|
}
|
|
8145
|
+
],
|
|
8146
|
+
"officialSkills": [
|
|
8147
|
+
{
|
|
8148
|
+
"skillId": "agent-leader-communication",
|
|
8149
|
+
"roleName": "team-lead"
|
|
8150
|
+
},
|
|
8151
|
+
{
|
|
8152
|
+
"skillId": "leader-medium-task-workflow",
|
|
8153
|
+
"roleName": "team-lead"
|
|
8154
|
+
},
|
|
8155
|
+
{
|
|
8156
|
+
"skillId": "leader-long-task-orchestration",
|
|
8157
|
+
"roleName": "team-lead"
|
|
8158
|
+
},
|
|
8159
|
+
{
|
|
8160
|
+
"skillId": "agent-subagent-orchestration",
|
|
8161
|
+
"roleName": "team-lead"
|
|
8162
|
+
},
|
|
8163
|
+
{
|
|
8164
|
+
"skillId": "frontend-engineering-workflow",
|
|
8165
|
+
"roleName": "ui-designer"
|
|
8166
|
+
},
|
|
8167
|
+
{
|
|
8168
|
+
"skillId": "backend-architecture-workflow",
|
|
8169
|
+
"roleName": "backend-architect"
|
|
8170
|
+
},
|
|
8171
|
+
{
|
|
8172
|
+
"skillId": "independent-code-review-workflow",
|
|
8173
|
+
"roleName": "reviewer"
|
|
8174
|
+
},
|
|
8175
|
+
{
|
|
8176
|
+
"skillId": "agent-subagent-orchestration",
|
|
8177
|
+
"roleName": "reviewer"
|
|
8178
|
+
},
|
|
8179
|
+
{
|
|
8180
|
+
"skillId": "executor-short-task-workflow",
|
|
8181
|
+
"roleName": "executor"
|
|
8182
|
+
},
|
|
8183
|
+
{
|
|
8184
|
+
"skillId": "agent-subagent-orchestration",
|
|
8185
|
+
"roleName": "executor"
|
|
8186
|
+
},
|
|
8187
|
+
{
|
|
8188
|
+
"skillId": "git-release-hygiene",
|
|
8189
|
+
"roleName": "executor"
|
|
8190
|
+
},
|
|
8191
|
+
{
|
|
8192
|
+
"skillId": "github-repository-presentation",
|
|
8193
|
+
"roleName": "executor"
|
|
8194
|
+
}
|
|
7961
8195
|
]
|
|
7962
8196
|
}
|
|
7963
8197
|
},
|
|
@@ -7974,9 +8208,9 @@ const BUILTIN_TEAM_CATALOG = [
|
|
|
7974
8208
|
"复杂重构"
|
|
7975
8209
|
],
|
|
7976
8210
|
"quickPrompts": ["为现有项目增加用户认证模块并验证", "统一 Web 与桌面端的设置页面交互"],
|
|
7977
|
-
"notes": "
|
|
8211
|
+
"notes": "五个成员(含队长):顾问职责拆成 UI 前端工程师与后端架构师两个专业角色,执行者承担常规实施,代码审查员独立验收;跨端一致性由队长裁定。"
|
|
7978
8212
|
},
|
|
7979
|
-
officialSkillBindings:
|
|
8213
|
+
officialSkillBindings: OFFICIAL_SPECIALIST_SKILLS
|
|
7980
8214
|
},
|
|
7981
8215
|
{
|
|
7982
8216
|
id: "builtin-discovery",
|
|
@@ -9058,9 +9292,7 @@ function editTeamPreset(team, edit) {
|
|
|
9058
9292
|
members
|
|
9059
9293
|
});
|
|
9060
9294
|
for (const entry of edit.members ?? []) {
|
|
9061
|
-
const
|
|
9062
|
-
const at = roster.findIndex((row) => row.target === wanted.toLowerCase() || row.member.name.trim() === wanted);
|
|
9063
|
-
const row = roster[at];
|
|
9295
|
+
const row = findMemberInRoster(roster, entry.member);
|
|
9064
9296
|
if (row === void 0) {
|
|
9065
9297
|
const targets = roster.map((candidate) => candidate.target).join(", ");
|
|
9066
9298
|
return {
|
|
@@ -9068,6 +9300,7 @@ function editTeamPreset(team, edit) {
|
|
|
9068
9300
|
message: `unknown Team member "${entry.member}"; available members: ${targets === "" ? "(none)" : targets}`
|
|
9069
9301
|
};
|
|
9070
9302
|
}
|
|
9303
|
+
const at = roster.indexOf(row);
|
|
9071
9304
|
const current = members[at] ?? row.member;
|
|
9072
9305
|
const updated = { ...current };
|
|
9073
9306
|
if (entry.description !== void 0) {
|
|
@@ -9651,6 +9884,69 @@ function registerPresetTools(ctx, agent, config, namespace, appliedTeamId = () =
|
|
|
9651
9884
|
for (const dispose of disposers.splice(0).reverse()) dispose();
|
|
9652
9885
|
};
|
|
9653
9886
|
}
|
|
9887
|
+
|
|
9888
|
+
|
|
9889
|
+
/**
|
|
9890
|
+
* Whether a Session's Team-themed tools follow the Team mode it was started in.
|
|
9891
|
+
*
|
|
9892
|
+
* The official `team_task_*` tools are declared only while a Session root has
|
|
9893
|
+
* Agent Teams turned on. This plugin's seven Team-themed tools — five that manage
|
|
9894
|
+
* the private skill library, two that read and edit the Team preset — answer the
|
|
9895
|
+
* same question the same way: with Team mode off a Session carries no Team, no
|
|
9896
|
+
* selected role, and no library to manage, so declaring those schemas there
|
|
9897
|
+
* spends context on capabilities the Session cannot use. The composer already
|
|
9898
|
+
* hides its Team control on the same fact, so gating the tools keeps the model
|
|
9899
|
+
* side and the page side describing one behaviour instead of two.
|
|
9900
|
+
*
|
|
9901
|
+
* WHY THIS IS A REGISTRATION DECISION, NOT A `when` CONDITION
|
|
9902
|
+
*
|
|
9903
|
+
* A conditional registration (`tools.register(def, { when })`) is not readable
|
|
9904
|
+
* outside a model step: `tools.executable()` answers undefined for it without a
|
|
9905
|
+
* step's admitted set. Three paths in this plugin read tool visibility outside a
|
|
9906
|
+
* step — the quarantine guard that decides what a paused Session may reach, the
|
|
9907
|
+
* `capabilityRefusal` preflight that proves a custom allow-list names tools this
|
|
9908
|
+
* Session composes, and the member-creation route resolution. Conditional
|
|
9909
|
+
* registrations would make those tools look absent at every one of them,
|
|
9910
|
+
* including the window while a Team is being applied, when the paused captain
|
|
9911
|
+
* must still reach its recovery tools.
|
|
9912
|
+
*
|
|
9913
|
+
* Withdrawing the registration instead keeps one answer per tool: a name is
|
|
9914
|
+
* either registered and readable from outside a step, or it is not installed at
|
|
9915
|
+
* all. Nothing observes a registered-but-unreadable half state.
|
|
9916
|
+
* @module dsh-agent-team-presets/team-mode
|
|
9917
|
+
*/
|
|
9918
|
+
/** The projection key the Agent Teams service publishes. */
|
|
9919
|
+
const TEAM_PROJECTION = "agentTeam";
|
|
9920
|
+
/**
|
|
9921
|
+
* Read the Agent Teams mode of one Session root from the session projections.
|
|
9922
|
+
* @param projections - the projection registry, when this deployment composes one.
|
|
9923
|
+
* @param agent - the Agent whose mode is being read.
|
|
9924
|
+
* @returns `true`/`false` when the mode is observable, `undefined` when it is not.
|
|
9925
|
+
*/
|
|
9926
|
+
function teamModeOf(projections, agent) {
|
|
9927
|
+
const registry = projections;
|
|
9928
|
+
if (registry?.snapshot === void 0) return void 0;
|
|
9929
|
+
let projection;
|
|
9930
|
+
try {
|
|
9931
|
+
projection = registry.snapshot(agent.session, [TEAM_PROJECTION]).values[TEAM_PROJECTION];
|
|
9932
|
+
} catch {
|
|
9933
|
+
return;
|
|
9934
|
+
}
|
|
9935
|
+
return projection === void 0 ? void 0 : projection.enabled === true;
|
|
9936
|
+
}
|
|
9937
|
+
/**
|
|
9938
|
+
* Whether the Team-themed tools belong on this Session right now.
|
|
9939
|
+
*
|
|
9940
|
+
* An unobservable mode keeps them installed: only a positively read "Team mode is
|
|
9941
|
+
* off" removes them, because a deployment that composes no Agent Teams service
|
|
9942
|
+
* has no switch to turn on and must keep the management surface it always had.
|
|
9943
|
+
* @param projections - the projection registry, when this deployment composes one.
|
|
9944
|
+
* @param agent - the Session root being adopted.
|
|
9945
|
+
* @returns whether to register the seven tools.
|
|
9946
|
+
*/
|
|
9947
|
+
function teamModeAdmitsTools(projections, agent) {
|
|
9948
|
+
return teamModeOf(projections, agent) !== false;
|
|
9949
|
+
}
|
|
9654
9950
|
/** A refusal carrying the path that produced it. */
|
|
9655
9951
|
var SkillPathError = class extends Error {
|
|
9656
9952
|
reason;
|
|
@@ -16450,35 +16746,45 @@ var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
16450
16746
|
})))();
|
|
16451
16747
|
/** The instruction file every Team Skill must carry. */
|
|
16452
16748
|
const SKILL_FILE = "SKILL.md";
|
|
16749
|
+
const DEPENDENCY_FRONTMATTER_FIELDS = [
|
|
16750
|
+
"executables",
|
|
16751
|
+
"mcpServers",
|
|
16752
|
+
"otherSkills"
|
|
16753
|
+
];
|
|
16453
16754
|
/** The kebab-case grammar the official skill registry enforces. */
|
|
16454
16755
|
const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
16455
|
-
/**
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16459
|
-
|
|
16460
|
-
* `metadata`, `allowed-tools`, an unknown vendor key — stays in the file
|
|
16461
|
-
* untouched, because the document is portable and this reader is one consumer.
|
|
16462
|
-
* @param text - the whole document.
|
|
16463
|
-
* @returns the two required fields, or undefined when the fence is absent.
|
|
16464
|
-
*/
|
|
16465
|
-
function parseSkillFrontmatter(text) {
|
|
16466
|
-
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/u.exec(text);
|
|
16467
|
-
if (match?.[1] === void 0) return void 0;
|
|
16756
|
+
/** Read the frontmatter and retain the location of the YAML source. */
|
|
16757
|
+
function readSkillFrontmatter(text, keepSourceTokens = false) {
|
|
16758
|
+
const match = /^\uFEFF?---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/du.exec(text);
|
|
16759
|
+
const range = match?.indices?.[1];
|
|
16760
|
+
if (match?.[1] === void 0 || range === void 0) return void 0;
|
|
16468
16761
|
try {
|
|
16469
|
-
const document = (0, import_dist.parseDocument)(match[1], {
|
|
16762
|
+
const document = (0, import_dist.parseDocument)(match[1], {
|
|
16763
|
+
uniqueKeys: true,
|
|
16764
|
+
keepSourceTokens
|
|
16765
|
+
});
|
|
16470
16766
|
if (document.errors.length > 0) return void 0;
|
|
16471
|
-
const
|
|
16472
|
-
if (
|
|
16473
|
-
const
|
|
16767
|
+
const value = document.toJS({ maxAliasCount: 100 });
|
|
16768
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
16769
|
+
const fields = value;
|
|
16474
16770
|
return {
|
|
16475
|
-
|
|
16476
|
-
|
|
16771
|
+
document,
|
|
16772
|
+
yamlStart: range[0],
|
|
16773
|
+
name: typeof fields["name"] === "string" ? fields["name"] : "",
|
|
16774
|
+
description: typeof fields["description"] === "string" ? fields["description"] : ""
|
|
16477
16775
|
};
|
|
16478
16776
|
} catch {
|
|
16479
16777
|
return;
|
|
16480
16778
|
}
|
|
16481
16779
|
}
|
|
16780
|
+
/** Find an explicitly written top-level field without following YAML merges. */
|
|
16781
|
+
function explicitField(document, field) {
|
|
16782
|
+
if (!(0, import_dist.isMap)(document.contents)) return void 0;
|
|
16783
|
+
return document.contents.items.findLast(({ key }) => {
|
|
16784
|
+
const resolved = (0, import_dist.isAlias)(key) ? key.resolve(document) : key;
|
|
16785
|
+
return (0, import_dist.isScalar)(resolved) && resolved.value === field;
|
|
16786
|
+
});
|
|
16787
|
+
}
|
|
16482
16788
|
/**
|
|
16483
16789
|
* Validate one decoded folder as a Team Skill.
|
|
16484
16790
|
*
|
|
@@ -16517,7 +16823,10 @@ function buildSkillPackage(input) {
|
|
|
16517
16823
|
};
|
|
16518
16824
|
let text;
|
|
16519
16825
|
try {
|
|
16520
|
-
text = new TextDecoder("utf-8", {
|
|
16826
|
+
text = new TextDecoder("utf-8", {
|
|
16827
|
+
fatal: true,
|
|
16828
|
+
ignoreBOM: true
|
|
16829
|
+
}).decode(instruction.bytes);
|
|
16521
16830
|
} catch {
|
|
16522
16831
|
return {
|
|
16523
16832
|
ok: false,
|
|
@@ -16525,7 +16834,7 @@ function buildSkillPackage(input) {
|
|
|
16525
16834
|
path: SKILL_FILE
|
|
16526
16835
|
};
|
|
16527
16836
|
}
|
|
16528
|
-
const frontmatter =
|
|
16837
|
+
const frontmatter = readSkillFrontmatter(text);
|
|
16529
16838
|
if (frontmatter === void 0) return {
|
|
16530
16839
|
ok: false,
|
|
16531
16840
|
reason: "invalid-frontmatter",
|
|
@@ -16541,6 +16850,10 @@ function buildSkillPackage(input) {
|
|
|
16541
16850
|
reason: "missing-description",
|
|
16542
16851
|
path: SKILL_FILE
|
|
16543
16852
|
};
|
|
16853
|
+
const dependencyWarnings = DEPENDENCY_FRONTMATTER_FIELDS.filter((field) => explicitField(frontmatter.document, field) !== void 0).map((field) => ({
|
|
16854
|
+
code: "unsupported-dependency-frontmatter",
|
|
16855
|
+
field
|
|
16856
|
+
}));
|
|
16544
16857
|
const totalBytes = ordered.reduce((sum, file) => sum + file.bytes.byteLength, 0);
|
|
16545
16858
|
const warnings = [];
|
|
16546
16859
|
const scripts = ordered.filter((file) => /\.(?:py|sh|ps1|bat|cmd)$/u.test(file.path));
|
|
@@ -16553,10 +16866,66 @@ function buildSkillPackage(input) {
|
|
|
16553
16866
|
files: ordered,
|
|
16554
16867
|
totalBytes
|
|
16555
16868
|
},
|
|
16556
|
-
warnings
|
|
16869
|
+
warnings,
|
|
16870
|
+
dependencyWarnings
|
|
16557
16871
|
};
|
|
16558
16872
|
}
|
|
16559
16873
|
/**
|
|
16874
|
+
* Rename an already validated Team Skill package for a new copy.
|
|
16875
|
+
* @param package_ - the source package, whose files are left intact.
|
|
16876
|
+
* @param name - the new kebab-case name.
|
|
16877
|
+
* @returns the renamed package, with only the instruction file changed.
|
|
16878
|
+
*/
|
|
16879
|
+
function renameSkillPackage(package_, name) {
|
|
16880
|
+
if (!SKILL_NAME.test(name)) throw new Error(`invalid Team Skill name: ${name}`);
|
|
16881
|
+
const instruction = package_.files.find((file) => file.path === SKILL_FILE);
|
|
16882
|
+
if (instruction === void 0) throw new Error(`missing ${SKILL_FILE}`);
|
|
16883
|
+
const text = new TextDecoder("utf-8", {
|
|
16884
|
+
fatal: true,
|
|
16885
|
+
ignoreBOM: true
|
|
16886
|
+
}).decode(instruction.bytes);
|
|
16887
|
+
const frontmatter = readSkillFrontmatter(text, true);
|
|
16888
|
+
if (frontmatter === void 0 || !SKILL_NAME.test(frontmatter.name)) throw new Error(`invalid skill name in ${SKILL_FILE}`);
|
|
16889
|
+
if (frontmatter.name === name && package_.name === name) return package_;
|
|
16890
|
+
const { document, yamlStart } = frontmatter;
|
|
16891
|
+
const node = explicitField(document, "name")?.value;
|
|
16892
|
+
let replacement = (0, import_dist.stringify)(name, { version: document.directives.yaml.version }).trimEnd();
|
|
16893
|
+
let start;
|
|
16894
|
+
let end;
|
|
16895
|
+
if (((0, import_dist.isScalar)(node) || (0, import_dist.isAlias)(node)) && node.range !== void 0) [start, end] = node.range;
|
|
16896
|
+
else if ((0, import_dist.isMap)(document.contents) && document.contents.range !== void 0) {
|
|
16897
|
+
start = document.contents.range[0];
|
|
16898
|
+
if (document.contents.flow) {
|
|
16899
|
+
start += 1;
|
|
16900
|
+
replacement = `name: ${replacement}, `;
|
|
16901
|
+
} else {
|
|
16902
|
+
const keyStart = yamlStart + start;
|
|
16903
|
+
const lineStart = text.lastIndexOf("\n", keyStart - 1) + 1;
|
|
16904
|
+
const indent = text.slice(lineStart, keyStart);
|
|
16905
|
+
const newline = text[lineStart - 2] === "\r" ? "\r\n" : "\n";
|
|
16906
|
+
replacement = `name: ${replacement}${newline}${indent}`;
|
|
16907
|
+
}
|
|
16908
|
+
end = start;
|
|
16909
|
+
} else throw new Error(`cannot locate name in ${SKILL_FILE}`);
|
|
16910
|
+
if ((0, import_dist.isScalar)(node) && node.srcToken?.type === "block-scalar") {
|
|
16911
|
+
const { source } = node.srcToken;
|
|
16912
|
+
const offset = source.indexOf(frontmatter.name);
|
|
16913
|
+
if (offset < 0) throw new Error(`cannot locate name in ${SKILL_FILE}`);
|
|
16914
|
+
start = end - source.length + offset;
|
|
16915
|
+
end = start + frontmatter.name.length;
|
|
16916
|
+
replacement = name;
|
|
16917
|
+
} else if ((0, import_dist.isScalar)(node) && node.type === "QUOTE_SINGLE") replacement = `'${name}'`;
|
|
16918
|
+
else if ((0, import_dist.isScalar)(node) && node.type === "QUOTE_DOUBLE") replacement = JSON.stringify(name);
|
|
16919
|
+
const renamed = text.slice(0, yamlStart + start) + replacement + text.slice(yamlStart + end);
|
|
16920
|
+
const result = buildSkillPackage(package_.files.map((file) => file === instruction ? {
|
|
16921
|
+
path: file.path,
|
|
16922
|
+
bytes: new TextEncoder().encode(renamed)
|
|
16923
|
+
} : file));
|
|
16924
|
+
if (!result.ok) throw new Error(`invalid renamed Team Skill: ${result.reason}`);
|
|
16925
|
+
if (result.skill.name !== name) throw new Error(`could not rename ${SKILL_FILE} to ${name}`);
|
|
16926
|
+
return result.skill;
|
|
16927
|
+
}
|
|
16928
|
+
/**
|
|
16560
16929
|
* Decode the browser's base64 file payloads into bytes.
|
|
16561
16930
|
*
|
|
16562
16931
|
* A folder picker cannot hand over a `File` object across the Remote boundary,
|
|
@@ -16573,6 +16942,7 @@ function decodeImportFiles(files) {
|
|
|
16573
16942
|
|
|
16574
16943
|
|
|
16575
16944
|
/** Immutable package versions and an atomically persisted private registry. */
|
|
16945
|
+
const SKILL_IMPORT_FOLDER = "inbox";
|
|
16576
16946
|
const REGISTRY_VERSION = 1;
|
|
16577
16947
|
const NO_DEPENDENCIES = {
|
|
16578
16948
|
mcpServers: [],
|
|
@@ -16613,6 +16983,10 @@ function diskComponent(value) {
|
|
|
16613
16983
|
function strings(value) {
|
|
16614
16984
|
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
16615
16985
|
}
|
|
16986
|
+
function importFolderName(value) {
|
|
16987
|
+
if (normalizeSkillPath(value) !== value || value.includes("/") || value.startsWith(".")) throw new Error("invalid Team Skill source folder");
|
|
16988
|
+
return value;
|
|
16989
|
+
}
|
|
16616
16990
|
function validateAsset(value) {
|
|
16617
16991
|
if (value === null || typeof value !== "object") throw new Error("invalid Team Skill asset");
|
|
16618
16992
|
const a = value;
|
|
@@ -16624,6 +16998,10 @@ function validateAsset(value) {
|
|
|
16624
16998
|
"custom",
|
|
16625
16999
|
"override"
|
|
16626
17000
|
].includes(a.origin) || typeof a.description !== "string" || !/^[a-f0-9]{64}$/u.test(a.digest) || !Number.isSafeInteger(a.updatedAt) || a.updatedAt < 0 || !Array.isArray(a.files) || a.officialSkillId !== void 0 && (typeof a.officialSkillId !== "string" || assetDirectoryName(a.officialSkillId) !== a.officialSkillId) || a.baseVersion !== void 0 && component(a.baseVersion) !== a.baseVersion || a.updateAvailable !== void 0 && typeof a.updateAvailable !== "boolean") throw new Error("invalid Team Skill asset shape");
|
|
17001
|
+
if (a.sourceFolder !== void 0) {
|
|
17002
|
+
if (a.origin !== "custom" || typeof a.sourceFolder !== "string") throw new Error("invalid Team Skill source folder");
|
|
17003
|
+
importFolderName(a.sourceFolder);
|
|
17004
|
+
}
|
|
16627
17005
|
for (const file of a.files) if (file === null || typeof file !== "object" || typeof file.path !== "string" || normalizeSkillPath(file.path) !== file.path || typeof file.text !== "boolean" || typeof file.sha256 !== "string" || !/^[a-f0-9]{64}$/u.test(file.sha256)) throw new Error("invalid Team Skill file shape");
|
|
16628
17006
|
checkFolder(a.files.map((file) => ({
|
|
16629
17007
|
path: file.path,
|
|
@@ -16725,7 +17103,11 @@ var TeamSkillStore = class {
|
|
|
16725
17103
|
return join(this.root, "transaction.json");
|
|
16726
17104
|
}
|
|
16727
17105
|
journalTarget(path) {
|
|
16728
|
-
|
|
17106
|
+
const parts = path.split("/");
|
|
17107
|
+
if (parts[0] === "inbox" && parts.length >= 3) {
|
|
17108
|
+
importFolderName(parts[1]);
|
|
17109
|
+
normalizeSkillPath(parts.slice(2).join("/"));
|
|
17110
|
+
} else if (!/^(?:(?:assets|manifests)\/(?:[A-Za-z0-9][A-Za-z0-9:._-]*|~(?:[a-f0-9]+|h[a-f0-9]{64}))(?:\/(?:[A-Za-z0-9][A-Za-z0-9:._-]*|~(?:[a-f0-9]+|h[a-f0-9]{64}))(?:\.json)?)?|\.(?:stage|removed)-[a-f0-9-]+)$/u.test(path) || path.split("/").some((part) => part === "." || part === "..")) throw new Error("invalid Team Skill transaction path");
|
|
16729
17111
|
if (process.platform === "win32" && path.includes(":")) throw new Error("invalid Team Skill transaction path");
|
|
16730
17112
|
return resolveInside(this.root, path);
|
|
16731
17113
|
}
|
|
@@ -16876,9 +17258,20 @@ var TeamSkillStore = class {
|
|
|
16876
17258
|
get(assetId) {
|
|
16877
17259
|
return this.table.get(assetId);
|
|
16878
17260
|
}
|
|
17261
|
+
/**
|
|
17262
|
+
* Resolve one skill by its name rather than by asset identity.
|
|
17263
|
+
*
|
|
17264
|
+
* Several assets may legitimately share a name: the shipped copy, a local
|
|
17265
|
+
* override of it, and a skill the user imported under the same name. The
|
|
17266
|
+
* shipped copy wins, because a name denotes the skill the plugin ships — a
|
|
17267
|
+
* user's own copy must never shadow it for a caller that only said the name.
|
|
17268
|
+
* Callers that know which copy they mean pass the asset id instead.
|
|
17269
|
+
* @param skillId - kebab-case skill name.
|
|
17270
|
+
* @returns the shipped copy when it exists, else the best local one.
|
|
17271
|
+
*/
|
|
16879
17272
|
bySkillId(skillId) {
|
|
16880
17273
|
const candidates = this.list().filter((asset) => asset.skillId === skillId);
|
|
16881
|
-
return candidates.find((asset) => asset.origin === "override") ?? candidates.find((asset) => asset.origin === "custom") ?? candidates[0];
|
|
17274
|
+
return candidates.find((asset) => asset.origin === "builtin") ?? candidates.find((asset) => asset.origin === "override") ?? candidates.find((asset) => asset.origin === "custom") ?? candidates[0];
|
|
16882
17275
|
}
|
|
16883
17276
|
/** Commit all nested store mutations once; failures restore memory and version folders. */
|
|
16884
17277
|
async transaction(operation) {
|
|
@@ -16923,6 +17316,10 @@ var TeamSkillStore = class {
|
|
|
16923
17316
|
const checked = buildSkillPackage(input);
|
|
16924
17317
|
if (!checked.ok) throw new Error(`invalid skill package: ${checked.reason}`);
|
|
16925
17318
|
assetDirectoryName(package_.name);
|
|
17319
|
+
if (options.origin !== "builtin") {
|
|
17320
|
+
const clash = [...this.table.values()].find((asset) => asset.skillId === package_.name && asset.id !== options.id && !(options.origin === "override" && asset.origin === "builtin"));
|
|
17321
|
+
if (clash !== void 0) throw new Error(`the skill name "${package_.name}" already belongs to ${clash.id}; a skill name is the identity a binding uses`);
|
|
17322
|
+
}
|
|
16926
17323
|
const target = this.assetPath(options.id, options.version);
|
|
16927
17324
|
const manifest = this.manifestPath(options.id, options.version);
|
|
16928
17325
|
await assertNoSymlinks(target);
|
|
@@ -16942,6 +17339,7 @@ var TeamSkillStore = class {
|
|
|
16942
17339
|
version: options.version,
|
|
16943
17340
|
...options.officialSkillId === void 0 ? {} : { officialSkillId: options.officialSkillId },
|
|
16944
17341
|
...options.baseVersion === void 0 ? {} : { baseVersion: options.baseVersion },
|
|
17342
|
+
...options.sourceFolder === void 0 ? {} : { sourceFolder: options.sourceFolder },
|
|
16945
17343
|
digest: folderDigest(files),
|
|
16946
17344
|
files,
|
|
16947
17345
|
dependencies: options.dependencies ?? NO_DEPENDENCIES,
|
|
@@ -16998,10 +17396,41 @@ var TeamSkillStore = class {
|
|
|
16998
17396
|
return asset;
|
|
16999
17397
|
});
|
|
17000
17398
|
}
|
|
17001
|
-
|
|
17399
|
+
sourcePath(folder) {
|
|
17400
|
+
return resolveInside(join(this.root, SKILL_IMPORT_FOLDER), importFolderName(folder));
|
|
17401
|
+
}
|
|
17402
|
+
/** Publish a scanned package under its existing identity, or register it for the first time. */
|
|
17403
|
+
async publishSource(folder, package_) {
|
|
17404
|
+
importFolderName(folder);
|
|
17405
|
+
return this.transaction(async () => {
|
|
17406
|
+
const current = this.bySkillId(package_.name);
|
|
17407
|
+
if (current !== void 0 && current.origin !== "custom") throw new Error(`the skill name "${package_.name}" already belongs to ${current.id}`);
|
|
17408
|
+
if (current !== void 0 && current.digest === folderDigest(fileTable(package_.files))) {
|
|
17409
|
+
if (current.sourceFolder !== folder) {
|
|
17410
|
+
const tx = this.transactions.getStore();
|
|
17411
|
+
tx.assets.set(current.id, immutable({
|
|
17412
|
+
...current,
|
|
17413
|
+
sourceFolder: folder
|
|
17414
|
+
}));
|
|
17415
|
+
tx.dirty = true;
|
|
17416
|
+
}
|
|
17417
|
+
return "existing";
|
|
17418
|
+
}
|
|
17419
|
+
await this.install(package_, {
|
|
17420
|
+
id: current?.id ?? `custom:${package_.name}`,
|
|
17421
|
+
origin: "custom",
|
|
17422
|
+
sourceFolder: folder,
|
|
17423
|
+
version: current === void 0 ? "1" : nextVersion(),
|
|
17424
|
+
...current === void 0 ? {} : { dependencies: current.dependencies }
|
|
17425
|
+
});
|
|
17426
|
+
return current === void 0 ? "imported" : "updated";
|
|
17427
|
+
});
|
|
17428
|
+
}
|
|
17429
|
+
async writeFile(assetId, path, content, expectedVersion) {
|
|
17002
17430
|
return this.transaction(async () => {
|
|
17003
17431
|
const asset = requireAsset(this.table, assetId);
|
|
17004
17432
|
if (asset.origin === "builtin") throw new Error("a shipped Team Skill is read-only; create an editable copy instead");
|
|
17433
|
+
if (expectedVersion !== void 0 && asset.version !== expectedVersion) throw new Error("This Team Skill has a newer published version. Reopen its file before saving.");
|
|
17005
17434
|
const relative = normalizeSkillPath(path);
|
|
17006
17435
|
const files = /* @__PURE__ */ new Map();
|
|
17007
17436
|
for (const file of asset.files) files.set(file.path, await this.readBytes(assetId, file.path, asset.version));
|
|
@@ -17012,12 +17441,48 @@ var TeamSkillStore = class {
|
|
|
17012
17441
|
})));
|
|
17013
17442
|
if (!checked.ok) throw new Error(`invalid skill package: ${checked.reason}`);
|
|
17014
17443
|
if (checked.skill.name !== asset.skillId) throw new Error("editing cannot change the skill name");
|
|
17444
|
+
if (asset.sourceFolder !== void 0) await this.writeSourceFile(asset, asset.sourceFolder, relative, files.get(relative));
|
|
17015
17445
|
return this.install(checked.skill, {
|
|
17016
17446
|
...asset,
|
|
17017
17447
|
version: nextVersion()
|
|
17018
17448
|
});
|
|
17019
17449
|
});
|
|
17020
17450
|
}
|
|
17451
|
+
async writeSourceFile(asset, folder, path, bytes) {
|
|
17452
|
+
const current = await inspectSkillDirectory(this.sourcePath(folder));
|
|
17453
|
+
const sourceChanged = "The Team Skill source changed on disk. Scan the import folder before saving.";
|
|
17454
|
+
if (!current.ok || folderDigest(fileTable(current.skill.files)) !== asset.digest) throw new Error(sourceChanged);
|
|
17455
|
+
const previous = asset.files.find((file) => file.path === path);
|
|
17456
|
+
if (previous === void 0 || !previous.text) throw new Error("Only existing text files can be edited in a scanned Team Skill.");
|
|
17457
|
+
const sourcePath = `${SKILL_IMPORT_FOLDER}/${folder}/${path}`;
|
|
17458
|
+
const stagePath = `.stage-${randomUUID()}`;
|
|
17459
|
+
const backupPath = `.removed-${randomUUID()}`;
|
|
17460
|
+
const target = this.journalTarget(sourcePath);
|
|
17461
|
+
const stage = this.journalTarget(stagePath);
|
|
17462
|
+
const backup = this.journalTarget(backupPath);
|
|
17463
|
+
await assertNoSymlinks(target);
|
|
17464
|
+
await this.record({
|
|
17465
|
+
kind: "create",
|
|
17466
|
+
path: stagePath
|
|
17467
|
+
});
|
|
17468
|
+
await writeFile(stage, bytes, {
|
|
17469
|
+
flag: "wx",
|
|
17470
|
+
mode: (await lstat(target)).mode & 511
|
|
17471
|
+
});
|
|
17472
|
+
await this.record({
|
|
17473
|
+
kind: "move",
|
|
17474
|
+
path: sourcePath,
|
|
17475
|
+
backup: backupPath
|
|
17476
|
+
});
|
|
17477
|
+
await rename(target, backup);
|
|
17478
|
+
if (digestBytes(await readFile(backup)) !== previous.sha256) throw new Error(sourceChanged);
|
|
17479
|
+
await this.record({
|
|
17480
|
+
kind: "relocate",
|
|
17481
|
+
path: stagePath,
|
|
17482
|
+
destination: sourcePath
|
|
17483
|
+
});
|
|
17484
|
+
await rename(stage, target);
|
|
17485
|
+
}
|
|
17021
17486
|
/** Change dependency metadata by publishing a new immutable asset version. */
|
|
17022
17487
|
async updateDependencies(assetId, dependencies) {
|
|
17023
17488
|
return this.transaction(async () => {
|
|
@@ -17154,25 +17619,57 @@ var TeamSkillStore = class {
|
|
|
17154
17619
|
if (parsed.id !== assetId || parsed.version !== version) throw new Error("Team Skill manifest does not match its version");
|
|
17155
17620
|
return immutable(parsed);
|
|
17156
17621
|
}
|
|
17157
|
-
|
|
17622
|
+
freeCopyName(skillId, reserved) {
|
|
17623
|
+
const taken = new Set([...reserved, ...this.list().map((asset) => asset.skillId)]);
|
|
17624
|
+
let suffix = 1;
|
|
17625
|
+
while (taken.has(`${skillId}-${suffix}`)) suffix += 1;
|
|
17626
|
+
return `${skillId}-${suffix}`;
|
|
17627
|
+
}
|
|
17628
|
+
/** Keep old binding identities when a previously same-named copy needs its own name. */
|
|
17629
|
+
async renameLegacyCopies(reserved) {
|
|
17630
|
+
await this.transaction(async () => {
|
|
17631
|
+
const seen = new Set([...reserved, ...this.list().filter((asset) => asset.origin !== "override").map((asset) => asset.skillId)]);
|
|
17632
|
+
for (const asset of this.list()) {
|
|
17633
|
+
if (asset.origin !== "override") continue;
|
|
17634
|
+
if (seen.has(asset.skillId) || asset.skillId === asset.officialSkillId) {
|
|
17635
|
+
const name = this.freeCopyName(asset.officialSkillId ?? asset.skillId, reserved);
|
|
17636
|
+
const package_ = renameSkillPackage(await this.readPackage(asset), name);
|
|
17637
|
+
await this.install(package_, {
|
|
17638
|
+
...asset,
|
|
17639
|
+
version: nextVersion()
|
|
17640
|
+
});
|
|
17641
|
+
seen.add(name);
|
|
17642
|
+
} else seen.add(asset.skillId);
|
|
17643
|
+
}
|
|
17644
|
+
});
|
|
17645
|
+
}
|
|
17646
|
+
async readPackage(asset) {
|
|
17647
|
+
const files = [];
|
|
17648
|
+
for (const file of asset.files) files.push({
|
|
17649
|
+
path: file.path,
|
|
17650
|
+
bytes: await this.readBytes(asset.id, file.path, asset.version)
|
|
17651
|
+
});
|
|
17652
|
+
const checked = buildSkillPackage(files);
|
|
17653
|
+
if (!checked.ok) throw new Error(`invalid skill package: ${checked.reason}`);
|
|
17654
|
+
return checked.skill;
|
|
17655
|
+
}
|
|
17656
|
+
async createOverride(skillId, id, reserved = []) {
|
|
17158
17657
|
return this.transaction(async () => {
|
|
17159
|
-
const existing = this.table.get(id);
|
|
17658
|
+
const existing = id === void 0 ? void 0 : this.table.get(id);
|
|
17160
17659
|
if (existing) {
|
|
17161
17660
|
if (existing.origin === "override" && existing.officialSkillId === skillId) return existing;
|
|
17162
17661
|
throw new Error("asset identity already belongs to another skill");
|
|
17163
17662
|
}
|
|
17164
17663
|
const official = requireAsset(this.table, `builtin:${skillId}`);
|
|
17165
|
-
const
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
});
|
|
17170
|
-
return this.installFiles(skillId, files, {
|
|
17171
|
-
id,
|
|
17664
|
+
const name = this.freeCopyName(skillId, reserved);
|
|
17665
|
+
const package_ = renameSkillPackage(await this.readPackage(official), name);
|
|
17666
|
+
return this.install(package_, {
|
|
17667
|
+
id: id ?? `override:${randomUUID()}`,
|
|
17172
17668
|
origin: "override",
|
|
17173
17669
|
version: nextVersion(),
|
|
17174
17670
|
officialSkillId: skillId,
|
|
17175
|
-
baseVersion: official.version
|
|
17671
|
+
baseVersion: official.version,
|
|
17672
|
+
dependencies: official.dependencies
|
|
17176
17673
|
});
|
|
17177
17674
|
});
|
|
17178
17675
|
}
|
|
@@ -17181,16 +17678,10 @@ var TeamSkillStore = class {
|
|
|
17181
17678
|
const asset = requireAsset(this.table, assetId);
|
|
17182
17679
|
if (asset.origin !== "override" || asset.officialSkillId === void 0) throw new Error("only an override of a shipped Team Skill can be reset");
|
|
17183
17680
|
const official = requireAsset(this.table, `builtin:${asset.officialSkillId}`);
|
|
17184
|
-
const
|
|
17185
|
-
|
|
17186
|
-
|
|
17187
|
-
bytes: await this.readBytes(official.id, file.path, official.version)
|
|
17188
|
-
});
|
|
17189
|
-
return this.installFiles(official.skillId, files, {
|
|
17190
|
-
id: assetId,
|
|
17191
|
-
origin: "override",
|
|
17681
|
+
const package_ = renameSkillPackage(await this.readPackage(official), asset.skillId);
|
|
17682
|
+
return this.install(package_, {
|
|
17683
|
+
...asset,
|
|
17192
17684
|
version: nextVersion(),
|
|
17193
|
-
officialSkillId: official.skillId,
|
|
17194
17685
|
baseVersion: official.version
|
|
17195
17686
|
});
|
|
17196
17687
|
});
|
|
@@ -17258,10 +17749,7 @@ async function readDirectory(source) {
|
|
|
17258
17749
|
async function inspectSkillDirectory(source) {
|
|
17259
17750
|
try {
|
|
17260
17751
|
const checked = buildSkillPackage(await readDirectory(source));
|
|
17261
|
-
if (checked.ok) return
|
|
17262
|
-
ok: true,
|
|
17263
|
-
skill: checked.skill
|
|
17264
|
-
};
|
|
17752
|
+
if (checked.ok) return checked;
|
|
17265
17753
|
return {
|
|
17266
17754
|
ok: false,
|
|
17267
17755
|
reason: checked.reason,
|
|
@@ -17281,6 +17769,65 @@ async function inspectSkillDirectory(source) {
|
|
|
17281
17769
|
}
|
|
17282
17770
|
|
|
17283
17771
|
|
|
17772
|
+
/** Skills shipped under `assets/skills`, including assets missing from this installation. */
|
|
17773
|
+
const OFFICIAL_SKILL_IDS = [
|
|
17774
|
+
"agent-leader-communication",
|
|
17775
|
+
"leader-medium-task-workflow",
|
|
17776
|
+
"leader-long-task-orchestration",
|
|
17777
|
+
"agent-subagent-orchestration",
|
|
17778
|
+
"fullstack-advisor",
|
|
17779
|
+
"executor-short-task-workflow",
|
|
17780
|
+
"github-repository-presentation",
|
|
17781
|
+
"git-release-hygiene",
|
|
17782
|
+
"frontend-engineering-workflow",
|
|
17783
|
+
"backend-architecture-workflow",
|
|
17784
|
+
"independent-code-review-workflow",
|
|
17785
|
+
"grilling",
|
|
17786
|
+
"research"
|
|
17787
|
+
];
|
|
17788
|
+
const officialIds = new Set(OFFICIAL_SKILL_IDS);
|
|
17789
|
+
/** The binding slot reserved for a captain. */
|
|
17790
|
+
const CAPTAIN_ROLE = "captain";
|
|
17791
|
+
/** Shipped identities always use the catalog, including records from earlier releases. */
|
|
17792
|
+
function officialSkillDefaults(team) {
|
|
17793
|
+
const entry = builtinEntry(team.id);
|
|
17794
|
+
return entry === void 0 ? {
|
|
17795
|
+
source: "preset",
|
|
17796
|
+
declarations: team.officialSkills ?? []
|
|
17797
|
+
} : {
|
|
17798
|
+
source: "catalog",
|
|
17799
|
+
declarations: entry.officialSkillBindings
|
|
17800
|
+
};
|
|
17801
|
+
}
|
|
17802
|
+
/** A declaration can address only an unambiguous name and an unambiguous binding slot. */
|
|
17803
|
+
function officialSkillTarget(team, declaration) {
|
|
17804
|
+
if (!officialIds.has(declaration.skillId)) return { status: "unknown-skill" };
|
|
17805
|
+
const roles = [{
|
|
17806
|
+
name: team.captain.name,
|
|
17807
|
+
id: CAPTAIN_ROLE
|
|
17808
|
+
}, ...team.members.map((member) => ({
|
|
17809
|
+
name: member.name,
|
|
17810
|
+
id: member.id ?? member.name
|
|
17811
|
+
}))];
|
|
17812
|
+
const [role, otherMatch] = roles.filter((candidate) => candidate.name === declaration.roleName);
|
|
17813
|
+
if (role === void 0) return { status: "missing-role" };
|
|
17814
|
+
if (otherMatch !== void 0 || roles.filter((candidate) => candidate.id === role.id).length !== 1) return { status: "ambiguous-role" };
|
|
17815
|
+
return {
|
|
17816
|
+
status: "valid",
|
|
17817
|
+
roleId: role.id,
|
|
17818
|
+
assetId: `builtin:${declaration.skillId}`
|
|
17819
|
+
};
|
|
17820
|
+
}
|
|
17821
|
+
/** A default can seed only the shipped asset with the declared identity. */
|
|
17822
|
+
function isOfficialSkillAsset(asset, assetId) {
|
|
17823
|
+
return asset.origin === "builtin" && asset.id === assetId;
|
|
17824
|
+
}
|
|
17825
|
+
/** A role that already holds a derived override keeps its explicit assignment. */
|
|
17826
|
+
function isOfficialSkillOverride(asset, skillId) {
|
|
17827
|
+
return asset.origin === "override" && asset.officialSkillId === skillId;
|
|
17828
|
+
}
|
|
17829
|
+
|
|
17830
|
+
|
|
17284
17831
|
/**
|
|
17285
17832
|
* Who receives which Team Skill, and what may not be deleted.
|
|
17286
17833
|
*
|
|
@@ -17302,8 +17849,6 @@ async function inspectSkillDirectory(source) {
|
|
|
17302
17849
|
*/
|
|
17303
17850
|
/** Bindings document revision this build understands. */
|
|
17304
17851
|
const BINDINGS_VERSION = 1;
|
|
17305
|
-
/** The role slot the captain is stored under. */
|
|
17306
|
-
const CAPTAIN_ROLE = "captain";
|
|
17307
17852
|
/** Windows executable extensions assumed when PATHEXT is unset. */
|
|
17308
17853
|
const DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
17309
17854
|
/**
|
|
@@ -17352,6 +17897,19 @@ function seedOwner(key) {
|
|
|
17352
17897
|
} catch {}
|
|
17353
17898
|
}
|
|
17354
17899
|
/** The Team Skill library plus its role bindings. */
|
|
17900
|
+
/**
|
|
17901
|
+
* Whether two assets are the shipped copy and its own editable copy.
|
|
17902
|
+
*
|
|
17903
|
+
* They share a name because they ARE the same skill: the override is the shipped
|
|
17904
|
+
* body with the user's edits. Presenting that pair as a name clash made an
|
|
17905
|
+
* ordinary "I made a local copy" state read as a defect.
|
|
17906
|
+
* @param left - one asset.
|
|
17907
|
+
* @param right - the other asset.
|
|
17908
|
+
* @returns true when one is the shipped copy and the other its override.
|
|
17909
|
+
*/
|
|
17910
|
+
function sanctionedCopy(left, right) {
|
|
17911
|
+
return left.origin === "builtin" && right.origin === "override" && right.officialSkillId === left.skillId || right.origin === "builtin" && left.origin === "override" && left.officialSkillId === right.skillId;
|
|
17912
|
+
}
|
|
17355
17913
|
var TeamSkillManager = class {
|
|
17356
17914
|
store;
|
|
17357
17915
|
bindings = [];
|
|
@@ -17452,39 +18010,12 @@ var TeamSkillManager = class {
|
|
|
17452
18010
|
};
|
|
17453
18011
|
}));
|
|
17454
18012
|
}
|
|
17455
|
-
/** Replace existing shipped
|
|
18013
|
+
/** Replace only existing bindings to the shipped skill after an explicit switch. */
|
|
17456
18014
|
async replaceBuiltinBindings(skillId, overrideId) {
|
|
17457
18015
|
return this.mutate(() => this.store.withLock(async () => {
|
|
17458
18016
|
const replacement = this.store.get(overrideId);
|
|
17459
18017
|
if (replacement?.origin !== "override" || replacement.officialSkillId !== skillId) throw new Error("replacement must be an override of the shipped skill");
|
|
17460
|
-
|
|
17461
|
-
let replaced = 0;
|
|
17462
|
-
const seen = /* @__PURE__ */ new Set();
|
|
17463
|
-
const next = [];
|
|
17464
|
-
for (const binding of this.bindings) {
|
|
17465
|
-
const hasOtherOverride = binding.assetId === builtinId && this.bindings.some((other) => {
|
|
17466
|
-
if (other.teamId !== binding.teamId || other.roleId !== binding.roleId || other.assetId === overrideId) return false;
|
|
17467
|
-
const asset = this.store.get(other.assetId);
|
|
17468
|
-
return asset?.origin === "override" && asset.officialSkillId === skillId;
|
|
17469
|
-
});
|
|
17470
|
-
const convert = binding.assetId === builtinId && !hasOtherOverride;
|
|
17471
|
-
const row = convert ? {
|
|
17472
|
-
...binding,
|
|
17473
|
-
assetId: overrideId
|
|
17474
|
-
} : binding;
|
|
17475
|
-
if (convert) replaced += 1;
|
|
17476
|
-
const key = JSON.stringify([
|
|
17477
|
-
row.teamId,
|
|
17478
|
-
row.roleId,
|
|
17479
|
-
row.assetId
|
|
17480
|
-
]);
|
|
17481
|
-
if (row.assetId !== overrideId || !seen.has(key)) next.push(row);
|
|
17482
|
-
if (row.assetId === overrideId) seen.add(key);
|
|
17483
|
-
}
|
|
17484
|
-
if (replaced === 0) return 0;
|
|
17485
|
-
this.bindings = next;
|
|
17486
|
-
await this.flush();
|
|
17487
|
-
return replaced;
|
|
18018
|
+
return this.replaceAssetBindingsNow(`builtin:${skillId}`, overrideId);
|
|
17488
18019
|
}));
|
|
17489
18020
|
}
|
|
17490
18021
|
/**
|
|
@@ -17631,63 +18162,67 @@ var TeamSkillManager = class {
|
|
|
17631
18162
|
const owner = seedOwner(key);
|
|
17632
18163
|
return owner !== void 0 && this.hasRole(owner[0], owner[1]);
|
|
17633
18164
|
}));
|
|
17634
|
-
for (const team of teams) {
|
|
17635
|
-
const
|
|
17636
|
-
|
|
17637
|
-
|
|
17638
|
-
|
|
17639
|
-
|
|
17640
|
-
|
|
17641
|
-
|
|
17642
|
-
|
|
17643
|
-
|
|
17644
|
-
|
|
17645
|
-
|
|
17646
|
-
|
|
17647
|
-
|
|
17648
|
-
]);
|
|
17649
|
-
if (this.seeded.has(key)) {
|
|
17650
|
-
const builtinId = `builtin:${declaration.skillId}`;
|
|
17651
|
-
if (assetId !== builtinId) {
|
|
17652
|
-
const stale = this.bindings.findIndex((row) => row.teamId === team.id && row.roleId === roleId && row.assetId === builtinId);
|
|
17653
|
-
if (stale >= 0) this.bindings[stale] = {
|
|
17654
|
-
teamId: team.id,
|
|
17655
|
-
roleId,
|
|
17656
|
-
assetId,
|
|
17657
|
-
...roleId === "captain" ? { captain: true } : {}
|
|
17658
|
-
};
|
|
17659
|
-
}
|
|
17660
|
-
continue;
|
|
17661
|
-
}
|
|
18165
|
+
for (const team of teams) for (const declaration of officialSkillDefaults(team).declarations) {
|
|
18166
|
+
const target = officialSkillTarget(team, declaration);
|
|
18167
|
+
if (target.status !== "valid") continue;
|
|
18168
|
+
const { roleId, assetId } = target;
|
|
18169
|
+
const key = JSON.stringify([
|
|
18170
|
+
team.id,
|
|
18171
|
+
roleId,
|
|
18172
|
+
assetId
|
|
18173
|
+
]);
|
|
18174
|
+
if (this.bindings.some((row) => {
|
|
18175
|
+
if (row.teamId !== team.id || row.roleId !== roleId) return false;
|
|
18176
|
+
const asset = this.store.get(row.assetId);
|
|
18177
|
+
return asset !== void 0 && (isOfficialSkillAsset(asset, assetId) || isOfficialSkillOverride(asset, declaration.skillId));
|
|
18178
|
+
})) {
|
|
17662
18179
|
this.seeded.add(key);
|
|
17663
|
-
|
|
17664
|
-
teamId: team.id,
|
|
17665
|
-
roleId,
|
|
17666
|
-
assetId,
|
|
17667
|
-
...roleId === "captain" ? { captain: true } : {}
|
|
17668
|
-
});
|
|
18180
|
+
continue;
|
|
17669
18181
|
}
|
|
18182
|
+
const shipped = this.store.get(assetId);
|
|
18183
|
+
if (shipped === void 0 || !isOfficialSkillAsset(shipped, assetId)) continue;
|
|
18184
|
+
if (this.seeded.has(key)) continue;
|
|
18185
|
+
this.seeded.add(key);
|
|
18186
|
+
this.bindings.push({
|
|
18187
|
+
teamId: team.id,
|
|
18188
|
+
roleId,
|
|
18189
|
+
assetId,
|
|
18190
|
+
...roleId === "captain" ? { captain: true } : {}
|
|
18191
|
+
});
|
|
17670
18192
|
}
|
|
17671
18193
|
if (JSON.stringify([this.bindings, [...this.seeded]]) !== before) await this.flush();
|
|
17672
18194
|
}
|
|
17673
18195
|
/**
|
|
17674
|
-
*
|
|
18196
|
+
* Move every role holding one asset onto another.
|
|
17675
18197
|
*
|
|
17676
|
-
*
|
|
17677
|
-
*
|
|
17678
|
-
*
|
|
17679
|
-
*
|
|
17680
|
-
*
|
|
17681
|
-
*
|
|
17682
|
-
* @param skillId - shipped skill identity the default names.
|
|
17683
|
-
* @returns the asset identity to bind, or undefined when neither copy exists.
|
|
18198
|
+
* Used by "restore to the built-in version": the roles reading a local copy
|
|
18199
|
+
* have to read the shipped one again, or the restore would only change bytes
|
|
18200
|
+
* nobody is bound to.
|
|
18201
|
+
* @param fromAssetId - asset the roles hold now.
|
|
18202
|
+
* @param toAssetId - asset they should hold.
|
|
18203
|
+
* @returns the number of bindings moved.
|
|
17684
18204
|
*/
|
|
17685
|
-
|
|
17686
|
-
|
|
17687
|
-
|
|
17688
|
-
|
|
17689
|
-
|
|
17690
|
-
|
|
18205
|
+
async replaceAssetBindings(fromAssetId, toAssetId) {
|
|
18206
|
+
return this.mutate(() => this.replaceAssetBindingsNow(fromAssetId, toAssetId));
|
|
18207
|
+
}
|
|
18208
|
+
async replaceAssetBindingsNow(fromAssetId, toAssetId) {
|
|
18209
|
+
if (fromAssetId === toAssetId || this.store.get(toAssetId) === void 0) return 0;
|
|
18210
|
+
const moved = this.bindings.filter((row) => row.assetId === fromAssetId).length;
|
|
18211
|
+
if (moved === 0) return 0;
|
|
18212
|
+
const seen = /* @__PURE__ */ new Set();
|
|
18213
|
+
this.bindings = this.bindings.flatMap((binding) => {
|
|
18214
|
+
const row = binding.assetId === fromAssetId ? {
|
|
18215
|
+
...binding,
|
|
18216
|
+
assetId: toAssetId
|
|
18217
|
+
} : binding;
|
|
18218
|
+
if (row.assetId !== toAssetId) return [row];
|
|
18219
|
+
const key = JSON.stringify([row.teamId, row.roleId]);
|
|
18220
|
+
if (seen.has(key)) return [];
|
|
18221
|
+
seen.add(key);
|
|
18222
|
+
return [row];
|
|
18223
|
+
});
|
|
18224
|
+
await this.flush();
|
|
18225
|
+
return moved;
|
|
17691
18226
|
}
|
|
17692
18227
|
mutate(operation) {
|
|
17693
18228
|
const result = this.pending.then(async () => {
|
|
@@ -17815,12 +18350,24 @@ var TeamSkillManager = class {
|
|
|
17815
18350
|
*/
|
|
17816
18351
|
async restoreBuiltinBindings(teamIds) {
|
|
17817
18352
|
return this.mutate(async () => {
|
|
17818
|
-
const
|
|
18353
|
+
const requested = Array.isArray(teamIds) ? teamIds : [];
|
|
18354
|
+
const targets = new Set(requested.length === 0 ? BUILTIN_TEAM_IDS : requested);
|
|
17819
18355
|
this.seeded = new Set([...this.seeded].filter((key) => {
|
|
17820
18356
|
const owner = seedOwner(key);
|
|
17821
18357
|
return owner === void 0 || !targets.has(owner[0]);
|
|
17822
18358
|
}));
|
|
18359
|
+
this.bindings = this.bindings.map((row) => {
|
|
18360
|
+
if (!targets.has(row.teamId)) return row;
|
|
18361
|
+
const asset = this.store.get(row.assetId);
|
|
18362
|
+
if (asset?.origin !== "override" || asset.officialSkillId === void 0) return row;
|
|
18363
|
+
const builtinId = `builtin:${asset.officialSkillId}`;
|
|
18364
|
+
return this.store.get(builtinId) === void 0 ? row : {
|
|
18365
|
+
...row,
|
|
18366
|
+
assetId: builtinId
|
|
18367
|
+
};
|
|
18368
|
+
});
|
|
17823
18369
|
await this.reconcileNow();
|
|
18370
|
+
await this.flush();
|
|
17824
18371
|
});
|
|
17825
18372
|
}
|
|
17826
18373
|
/**
|
|
@@ -18205,31 +18752,6 @@ var TeamSkillRuntime = class {
|
|
|
18205
18752
|
this.injectFiber.dispose();
|
|
18206
18753
|
}
|
|
18207
18754
|
};
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
/**
|
|
18211
|
-
* The Team Skill subsystem as one object the plugin lifecycle drives.
|
|
18212
|
-
*
|
|
18213
|
-
* This module is the seam between the plugin and the store/manager/provider
|
|
18214
|
-
* trio: it resolves the private root, loads the shipped skills, and answers the
|
|
18215
|
-
* two lifecycle questions the runtime asks — "what does this role get?" and
|
|
18216
|
-
* "this Agent is gone, release it".
|
|
18217
|
-
*
|
|
18218
|
-
* The private root is resolved from the Harness home the deployment itself uses
|
|
18219
|
-
* (`$DSH_HOME`, else `~/.dsh`) under a plugin-owned directory. v0.2.1-rc.2
|
|
18220
|
-
* publishes no per-plugin data-directory API, so this is a documented
|
|
18221
|
-
* derivation rather than a guess about a global skill directory: it is never a
|
|
18222
|
-
* user or project skill folder, it is never scanned by the host's own skill
|
|
18223
|
-
* providers, and an explicit `skillRoot` config value always wins.
|
|
18224
|
-
* @module dsh-agent-team-presets/team-skills
|
|
18225
|
-
*/
|
|
18226
|
-
/** The skills the package ships under `assets/skills`. */
|
|
18227
|
-
const OFFICIAL_SKILL_IDS = [
|
|
18228
|
-
"github-repository-presentation",
|
|
18229
|
-
"git-release-hygiene",
|
|
18230
|
-
"grilling",
|
|
18231
|
-
"research"
|
|
18232
|
-
];
|
|
18233
18755
|
/**
|
|
18234
18756
|
* Resolve the private Team Skill root.
|
|
18235
18757
|
* @param configured - an explicit `skillRoot` from the plugin config, when set.
|
|
@@ -18246,21 +18768,6 @@ function resolveSkillRoot(configured) {
|
|
|
18246
18768
|
function officialSkillDirectory() {
|
|
18247
18769
|
return join(dirname(dirname(fileURLToPath(import.meta.url))), "assets", "skills");
|
|
18248
18770
|
}
|
|
18249
|
-
/**
|
|
18250
|
-
* Resolve the role identity one live member belongs to.
|
|
18251
|
-
*
|
|
18252
|
-
* The member's own durable snapshot names the role, and the roster gives the
|
|
18253
|
-
* teammate target; a role without a stored identity falls back to its display
|
|
18254
|
-
* name, which is how shipped presets identify their members.
|
|
18255
|
-
* @param team - the Team the member belongs to.
|
|
18256
|
-
* @param memberTarget - the target the captain summoned it under.
|
|
18257
|
-
* @returns the role identity, or undefined when the target matches no member.
|
|
18258
|
-
*/
|
|
18259
|
-
function roleOfMember(team, memberTarget) {
|
|
18260
|
-
const row = memberTargets(team).find((candidate) => candidate.target === memberTarget);
|
|
18261
|
-
if (row === void 0) return void 0;
|
|
18262
|
-
return row.member.id ?? row.member.name;
|
|
18263
|
-
}
|
|
18264
18771
|
/** The Team Skill subsystem, ready for the runtime to drive. */
|
|
18265
18772
|
var TeamSkills = class {
|
|
18266
18773
|
root;
|
|
@@ -18320,13 +18827,14 @@ var TeamSkills = class {
|
|
|
18320
18827
|
entries.push({
|
|
18321
18828
|
skillId,
|
|
18322
18829
|
directory: join(directory, skillId),
|
|
18323
|
-
version: "
|
|
18830
|
+
version: "5"
|
|
18324
18831
|
});
|
|
18325
18832
|
} catch {
|
|
18326
18833
|
log(`the shipped skill "${skillId}" is not present in this installation`);
|
|
18327
18834
|
}
|
|
18328
18835
|
this.official = entries.map((entry) => entry.skillId);
|
|
18329
18836
|
const warnings = [];
|
|
18837
|
+
await this.store.renameLegacyCopies(OFFICIAL_SKILL_IDS);
|
|
18330
18838
|
const changed = await this.store.ensureOfficial(entries, warnings);
|
|
18331
18839
|
for (const warning of warnings) log(warning);
|
|
18332
18840
|
if (changed.length > 0) log(`Team Skill store updated: ${changed.join(", ")}`);
|
|
@@ -18495,9 +19003,6 @@ var __esDecorate$1 = function(ctor, descriptorIn, decorators, contextIn, initial
|
|
|
18495
19003
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
18496
19004
|
done = true;
|
|
18497
19005
|
};
|
|
18498
|
-
/** Text the page shows when this deployment could not open its store. */
|
|
18499
|
-
/** Folder under the private root that a scan reads. */
|
|
18500
|
-
const IMPORT_FOLDER = "inbox";
|
|
18501
19006
|
const UNAVAILABLE = "the Team Skill store could not be opened in this deployment";
|
|
18502
19007
|
/** Blank instruction text a freshly created skill starts from. */
|
|
18503
19008
|
const TEMPLATE = "---\nname: SKILL-ID\ndescription: Describe when this method applies.\n---\n\n# Method\n\nDescribe the steps to follow.\n";
|
|
@@ -18759,7 +19264,7 @@ let TeamSkillService = (() => {
|
|
|
18759
19264
|
fileCount: asset.files.length,
|
|
18760
19265
|
totalBytes: asset.files.reduce((sum, file) => sum + file.size, 0),
|
|
18761
19266
|
mcpServers: asset.dependencies.mcpServers.map((server) => server.serverName),
|
|
18762
|
-
clashesWith: this.config.store.list().filter((other) => other.id !== asset.id && other.skillId === asset.skillId).map((other) => other.id),
|
|
19267
|
+
clashesWith: this.config.store.list().filter((other) => other.id !== asset.id && other.skillId === asset.skillId && !sanctionedCopy(asset, other)).map((other) => other.id),
|
|
18763
19268
|
bindings: this.config.manager.bindingSummaries(assetId)
|
|
18764
19269
|
};
|
|
18765
19270
|
}
|
|
@@ -18786,7 +19291,7 @@ let TeamSkillService = (() => {
|
|
|
18786
19291
|
* List the library, the roster, and the shipped skill ids.
|
|
18787
19292
|
* @returns one page load.
|
|
18788
19293
|
*/
|
|
18789
|
-
async library() {
|
|
19294
|
+
async library(checkInbox) {
|
|
18790
19295
|
const issue = await this.settle();
|
|
18791
19296
|
if (issue !== void 0) return {
|
|
18792
19297
|
root: this.config.store.root,
|
|
@@ -18795,6 +19300,7 @@ let TeamSkillService = (() => {
|
|
|
18795
19300
|
official: [],
|
|
18796
19301
|
issue
|
|
18797
19302
|
};
|
|
19303
|
+
const check = checkInbox === true ? await this.checkInbox() : void 0;
|
|
18798
19304
|
return {
|
|
18799
19305
|
root: this.config.store.root,
|
|
18800
19306
|
assets: this.config.store.list().flatMap((asset) => {
|
|
@@ -18802,7 +19308,12 @@ let TeamSkillService = (() => {
|
|
|
18802
19308
|
return row === void 0 ? [] : [row];
|
|
18803
19309
|
}),
|
|
18804
19310
|
teams: this.roster(),
|
|
18805
|
-
official: [...this.config.official()]
|
|
19311
|
+
official: [...this.config.official()],
|
|
19312
|
+
...check === void 0 ? {} : { inboxChanges: Array.isArray(check) ? check.filter((entry) => entry.status !== "existing").map(({ digest: _digest, ...entry }) => entry) : [{
|
|
19313
|
+
folder: SKILL_IMPORT_FOLDER,
|
|
19314
|
+
status: "invalid",
|
|
19315
|
+
reason: "unreadable"
|
|
19316
|
+
}] }
|
|
18806
19317
|
};
|
|
18807
19318
|
}
|
|
18808
19319
|
/**
|
|
@@ -18843,7 +19354,7 @@ let TeamSkillService = (() => {
|
|
|
18843
19354
|
text: file.text
|
|
18844
19355
|
})),
|
|
18845
19356
|
body,
|
|
18846
|
-
directory: this.config.store.assetPath(asset.id, asset.version),
|
|
19357
|
+
directory: asset.sourceFolder === void 0 ? this.config.store.assetPath(asset.id, asset.version) : this.config.store.sourcePath(asset.sourceFolder),
|
|
18847
19358
|
dependencies: report
|
|
18848
19359
|
};
|
|
18849
19360
|
}
|
|
@@ -18879,9 +19390,10 @@ let TeamSkillService = (() => {
|
|
|
18879
19390
|
* @param assetId - asset identity.
|
|
18880
19391
|
* @param path - relative path.
|
|
18881
19392
|
* @param text - new content.
|
|
19393
|
+
* @param expectedVersion - the version the editor has open.
|
|
18882
19394
|
* @returns the refreshed detail, or a refusal.
|
|
18883
19395
|
*/
|
|
18884
|
-
async writeFile(assetId, path, text) {
|
|
19396
|
+
async writeFile(assetId, path, text, expectedVersion) {
|
|
18885
19397
|
const issue = await this.settle();
|
|
18886
19398
|
if (issue !== void 0) return {
|
|
18887
19399
|
ok: false,
|
|
@@ -18889,7 +19401,7 @@ let TeamSkillService = (() => {
|
|
|
18889
19401
|
detail: issue
|
|
18890
19402
|
};
|
|
18891
19403
|
try {
|
|
18892
|
-
await this.config.store.writeFile(assetId, path, text);
|
|
19404
|
+
await this.config.store.writeFile(assetId, path, text, expectedVersion);
|
|
18893
19405
|
} catch (error) {
|
|
18894
19406
|
return {
|
|
18895
19407
|
ok: false,
|
|
@@ -18900,6 +19412,9 @@ let TeamSkillService = (() => {
|
|
|
18900
19412
|
this.config.resync();
|
|
18901
19413
|
return this.detail(assetId);
|
|
18902
19414
|
}
|
|
19415
|
+
reservedSkillName(name) {
|
|
19416
|
+
return OFFICIAL_SKILL_IDS.some((skillId) => skillId === name) || this.config.official().includes(name) || this.config.store.get(`builtin:${name}`) !== void 0;
|
|
19417
|
+
}
|
|
18903
19418
|
/**
|
|
18904
19419
|
* Create one editable skill from the blank template.
|
|
18905
19420
|
* @param skillId - kebab-case name the new skill takes.
|
|
@@ -18924,6 +19439,11 @@ let TeamSkillService = (() => {
|
|
|
18924
19439
|
detail: `"${skillId}" is not a legal skill id.`
|
|
18925
19440
|
};
|
|
18926
19441
|
const id = `custom:${skillId}`;
|
|
19442
|
+
if (this.reservedSkillName(result.skill.name)) return {
|
|
19443
|
+
ok: false,
|
|
19444
|
+
reason: "builtin-name-conflict",
|
|
19445
|
+
detail: `"${result.skill.name}" is reserved for a read-only built-in Team Skill.`
|
|
19446
|
+
};
|
|
18927
19447
|
if (this.config.store.list().some((asset) => asset.skillId === result.skill.name)) return {
|
|
18928
19448
|
ok: false,
|
|
18929
19449
|
reason: "duplicate",
|
|
@@ -18976,6 +19496,11 @@ let TeamSkillService = (() => {
|
|
|
18976
19496
|
detail: `${result.reason}${result.path === void 0 ? "" : ` at ${result.path}`}`
|
|
18977
19497
|
};
|
|
18978
19498
|
const id = `custom:${result.skill.name}`;
|
|
19499
|
+
if (this.reservedSkillName(result.skill.name)) return {
|
|
19500
|
+
ok: false,
|
|
19501
|
+
reason: "builtin-name-conflict",
|
|
19502
|
+
detail: `"${result.skill.name}" is reserved for a read-only built-in Team Skill.`
|
|
19503
|
+
};
|
|
18979
19504
|
if (this.config.store.list().some((asset) => asset.skillId === result.skill.name)) return {
|
|
18980
19505
|
ok: false,
|
|
18981
19506
|
reason: "duplicate",
|
|
@@ -18994,7 +19519,11 @@ let TeamSkillService = (() => {
|
|
|
18994
19519
|
detail: String(error)
|
|
18995
19520
|
};
|
|
18996
19521
|
}
|
|
18997
|
-
|
|
19522
|
+
const detail = await this.detail(id);
|
|
19523
|
+
return "asset" in detail && result.dependencyWarnings.length > 0 ? {
|
|
19524
|
+
...detail,
|
|
19525
|
+
ignoredDependencyFields: result.dependencyWarnings.map((warning) => warning.field)
|
|
19526
|
+
} : detail;
|
|
18998
19527
|
}
|
|
18999
19528
|
/**
|
|
19000
19529
|
* Create the private import directory when it is missing.
|
|
@@ -19011,7 +19540,7 @@ let TeamSkillService = (() => {
|
|
|
19011
19540
|
reason: "unavailable",
|
|
19012
19541
|
detail: issue
|
|
19013
19542
|
};
|
|
19014
|
-
const path = join(this.config.store.root,
|
|
19543
|
+
const path = join(this.config.store.root, SKILL_IMPORT_FOLDER);
|
|
19015
19544
|
try {
|
|
19016
19545
|
await assertNoSymlinks(path);
|
|
19017
19546
|
await mkdir(path, { recursive: true });
|
|
@@ -19029,128 +19558,184 @@ let TeamSkillService = (() => {
|
|
|
19029
19558
|
path
|
|
19030
19559
|
};
|
|
19031
19560
|
}
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
*
|
|
19035
|
-
* The directory is the only supported way to hand the plugin a skill without
|
|
19036
|
-
* the browser picker. Each folder is judged by the same importer rules as a
|
|
19037
|
-
* picked folder, and the answer names the exact refusal for the ones that
|
|
19038
|
-
* fail, so the page can list them instead of reporting a single count.
|
|
19039
|
-
* @returns one row per folder, or a refusal when the store is unavailable.
|
|
19040
|
-
*/
|
|
19041
|
-
async scanImportFolder() {
|
|
19042
|
-
const issue = await this.settle();
|
|
19043
|
-
if (issue !== void 0) return {
|
|
19044
|
-
ok: false,
|
|
19045
|
-
reason: "unavailable",
|
|
19046
|
-
detail: issue
|
|
19047
|
-
};
|
|
19048
|
-
const root = join(this.config.store.root, IMPORT_FOLDER);
|
|
19561
|
+
async checkInbox() {
|
|
19562
|
+
const root = join(this.config.store.root, SKILL_IMPORT_FOLDER);
|
|
19049
19563
|
let dirents;
|
|
19050
19564
|
try {
|
|
19051
19565
|
await assertNoSymlinks(root);
|
|
19052
19566
|
dirents = await readdir(root, { withFileTypes: true });
|
|
19053
19567
|
} catch (error) {
|
|
19054
|
-
if (error.code
|
|
19055
|
-
ok: true,
|
|
19056
|
-
root,
|
|
19057
|
-
scanned: 0,
|
|
19058
|
-
imported: 0,
|
|
19059
|
-
existing: 0,
|
|
19060
|
-
invalid: 0,
|
|
19061
|
-
entries: []
|
|
19062
|
-
};
|
|
19063
|
-
return {
|
|
19568
|
+
if (error.code !== "ENOENT") return {
|
|
19064
19569
|
ok: false,
|
|
19065
19570
|
reason: "scan-refused",
|
|
19066
19571
|
detail: String(error)
|
|
19067
19572
|
};
|
|
19573
|
+
dirents = [];
|
|
19068
19574
|
}
|
|
19069
|
-
|
|
19575
|
+
const entries = [];
|
|
19576
|
+
const names = /* @__PURE__ */ new Map();
|
|
19577
|
+
for (const dirent of dirents.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
19578
|
+
const folder = dirent.name;
|
|
19579
|
+
if (folder.startsWith(".")) continue;
|
|
19580
|
+
if (!dirent.isDirectory()) {
|
|
19581
|
+
entries.push({
|
|
19582
|
+
folder,
|
|
19583
|
+
status: "invalid",
|
|
19584
|
+
reason: dirent.isSymbolicLink() ? "symlink-escape" : "not-directory"
|
|
19585
|
+
});
|
|
19586
|
+
continue;
|
|
19587
|
+
}
|
|
19588
|
+
const inspected = await inspectSkillDirectory(join(root, folder));
|
|
19589
|
+
if (!inspected.ok) {
|
|
19590
|
+
entries.push({
|
|
19591
|
+
folder,
|
|
19592
|
+
status: "invalid",
|
|
19593
|
+
reason: inspected.reason,
|
|
19594
|
+
...inspected.path === void 0 ? {} : { detail: inspected.path }
|
|
19595
|
+
});
|
|
19596
|
+
continue;
|
|
19597
|
+
}
|
|
19598
|
+
const skillId = inspected.skill.name;
|
|
19599
|
+
const ignoredDependencyFields = inspected.dependencyWarnings.map((warning) => warning.field);
|
|
19600
|
+
const info = {
|
|
19601
|
+
folder,
|
|
19602
|
+
skillId,
|
|
19603
|
+
...ignoredDependencyFields.length === 0 ? {} : { ignoredDependencyFields }
|
|
19604
|
+
};
|
|
19605
|
+
if (this.reservedSkillName(skillId)) {
|
|
19606
|
+
entries.push({
|
|
19607
|
+
...info,
|
|
19608
|
+
status: "invalid",
|
|
19609
|
+
reason: "builtin-name-conflict"
|
|
19610
|
+
});
|
|
19611
|
+
continue;
|
|
19612
|
+
}
|
|
19613
|
+
const current = this.config.store.bySkillId(skillId);
|
|
19614
|
+
if (current !== void 0 && current.origin !== "custom") {
|
|
19615
|
+
entries.push({
|
|
19616
|
+
...info,
|
|
19617
|
+
status: "invalid",
|
|
19618
|
+
reason: "copy-name-conflict",
|
|
19619
|
+
assetId: current.id
|
|
19620
|
+
});
|
|
19621
|
+
continue;
|
|
19622
|
+
}
|
|
19623
|
+
const digest = folderDigest(fileTable(inspected.skill.files));
|
|
19624
|
+
const duplicate = names.get(skillId);
|
|
19625
|
+
if (duplicate !== void 0) {
|
|
19626
|
+
entries[duplicate] = {
|
|
19627
|
+
...entries[duplicate],
|
|
19628
|
+
status: "invalid",
|
|
19629
|
+
reason: "duplicate-source-name"
|
|
19630
|
+
};
|
|
19631
|
+
entries.push({
|
|
19632
|
+
...info,
|
|
19633
|
+
status: "invalid",
|
|
19634
|
+
reason: "duplicate-source-name"
|
|
19635
|
+
});
|
|
19636
|
+
continue;
|
|
19637
|
+
}
|
|
19638
|
+
names.set(skillId, entries.length);
|
|
19639
|
+
if (current === void 0) entries.push({
|
|
19640
|
+
...info,
|
|
19641
|
+
status: "imported",
|
|
19642
|
+
digest
|
|
19643
|
+
});
|
|
19644
|
+
else entries.push({
|
|
19645
|
+
...info,
|
|
19646
|
+
assetId: current.id,
|
|
19647
|
+
digest,
|
|
19648
|
+
status: current.digest !== digest || current.sourceFolder !== void 0 && current.sourceFolder !== folder ? "updated" : "existing"
|
|
19649
|
+
});
|
|
19650
|
+
}
|
|
19651
|
+
for (const asset of this.config.store.list()) {
|
|
19652
|
+
if (asset.sourceFolder === void 0 || names.has(asset.skillId)) continue;
|
|
19653
|
+
if (entries.some((entry) => entry.folder === asset.sourceFolder && entry.status === "invalid")) continue;
|
|
19654
|
+
entries.push({
|
|
19655
|
+
folder: asset.sourceFolder,
|
|
19656
|
+
status: "missing",
|
|
19657
|
+
skillId: asset.skillId,
|
|
19658
|
+
assetId: asset.id,
|
|
19659
|
+
reason: "source-missing"
|
|
19660
|
+
});
|
|
19661
|
+
}
|
|
19662
|
+
return entries;
|
|
19663
|
+
}
|
|
19664
|
+
/** Validate sources, publishing changed packages as new versions only on this explicit request. */
|
|
19665
|
+
async scanImportFolder() {
|
|
19666
|
+
const issue = await this.settle();
|
|
19667
|
+
if (issue !== void 0) return {
|
|
19668
|
+
ok: false,
|
|
19669
|
+
reason: "unavailable",
|
|
19670
|
+
detail: issue
|
|
19671
|
+
};
|
|
19672
|
+
const root = join(this.config.store.root, SKILL_IMPORT_FOLDER);
|
|
19673
|
+
const result = await this.config.store.withLock(async () => {
|
|
19674
|
+
const planned = await this.checkInbox();
|
|
19675
|
+
if (!Array.isArray(planned)) return planned;
|
|
19070
19676
|
const entries = [];
|
|
19071
|
-
for (const
|
|
19072
|
-
if (
|
|
19073
|
-
|
|
19074
|
-
entries.push({
|
|
19075
|
-
folder: dirent.name,
|
|
19076
|
-
status: "invalid",
|
|
19077
|
-
reason: dirent.isSymbolicLink() ? "symlink-escape" : "not-directory"
|
|
19078
|
-
});
|
|
19677
|
+
for (const { digest, ...entry } of planned) {
|
|
19678
|
+
if (entry.status === "invalid" || entry.status === "missing") {
|
|
19679
|
+
entries.push(entry);
|
|
19079
19680
|
continue;
|
|
19080
19681
|
}
|
|
19081
|
-
const inspected = await inspectSkillDirectory(join(root,
|
|
19082
|
-
if (!inspected.ok) {
|
|
19682
|
+
const inspected = await inspectSkillDirectory(join(root, entry.folder));
|
|
19683
|
+
if (!inspected.ok || inspected.skill.name !== entry.skillId || folderDigest(fileTable(inspected.skill.files)) !== digest) {
|
|
19083
19684
|
entries.push({
|
|
19084
|
-
|
|
19685
|
+
...entry,
|
|
19085
19686
|
status: "invalid",
|
|
19086
|
-
reason:
|
|
19087
|
-
...inspected.path === void 0 ? {} : { detail: inspected.path }
|
|
19088
|
-
});
|
|
19089
|
-
continue;
|
|
19090
|
-
}
|
|
19091
|
-
const skillId = inspected.skill.name;
|
|
19092
|
-
const clash = this.config.store.list().find((asset) => asset.skillId === skillId);
|
|
19093
|
-
if (clash !== void 0) {
|
|
19094
|
-
entries.push({
|
|
19095
|
-
folder: dirent.name,
|
|
19096
|
-
status: "existing",
|
|
19097
|
-
skillId,
|
|
19098
|
-
assetId: clash.id,
|
|
19099
|
-
reason: "duplicate"
|
|
19687
|
+
reason: "source-changed"
|
|
19100
19688
|
});
|
|
19101
19689
|
continue;
|
|
19102
19690
|
}
|
|
19103
19691
|
try {
|
|
19104
|
-
const
|
|
19105
|
-
id: `custom:${skillId}`,
|
|
19106
|
-
origin: "custom",
|
|
19107
|
-
version: "1"
|
|
19108
|
-
});
|
|
19692
|
+
const status = await this.config.store.publishSource(entry.folder, inspected.skill);
|
|
19109
19693
|
entries.push({
|
|
19110
|
-
|
|
19111
|
-
status
|
|
19112
|
-
|
|
19113
|
-
assetId: asset.id
|
|
19694
|
+
...entry,
|
|
19695
|
+
status,
|
|
19696
|
+
assetId: this.config.store.bySkillId(inspected.skill.name).id
|
|
19114
19697
|
});
|
|
19115
19698
|
} catch (error) {
|
|
19116
19699
|
entries.push({
|
|
19117
|
-
|
|
19700
|
+
...entry,
|
|
19118
19701
|
status: "invalid",
|
|
19119
|
-
skillId,
|
|
19120
19702
|
reason: "install-refused",
|
|
19121
19703
|
detail: String(error)
|
|
19122
19704
|
});
|
|
19123
19705
|
}
|
|
19124
19706
|
}
|
|
19125
19707
|
const count = (status) => entries.filter((entry) => entry.status === status).length;
|
|
19708
|
+
const missing = count("missing");
|
|
19126
19709
|
return {
|
|
19127
19710
|
ok: true,
|
|
19128
19711
|
root,
|
|
19129
|
-
scanned: entries.length,
|
|
19712
|
+
scanned: entries.length - missing,
|
|
19130
19713
|
imported: count("imported"),
|
|
19714
|
+
updated: count("updated"),
|
|
19131
19715
|
existing: count("existing"),
|
|
19132
19716
|
invalid: count("invalid"),
|
|
19717
|
+
missing,
|
|
19133
19718
|
entries
|
|
19134
19719
|
};
|
|
19135
19720
|
});
|
|
19721
|
+
if (result.ok && (result.updated > 0 || result.imported > 0)) this.config.resync();
|
|
19722
|
+
return result;
|
|
19136
19723
|
}
|
|
19137
19724
|
/**
|
|
19138
19725
|
* Copy one shipped skill into an editable override.
|
|
19139
19726
|
* @param skillId - shipped skill id.
|
|
19140
19727
|
* @returns the new detail, or a refusal.
|
|
19141
19728
|
*/
|
|
19142
|
-
async overrideSkill(skillId) {
|
|
19729
|
+
async overrideSkill(skillId, switchBindings) {
|
|
19143
19730
|
const issue = await this.settle();
|
|
19144
19731
|
if (issue !== void 0) return {
|
|
19145
19732
|
ok: false,
|
|
19146
19733
|
reason: "unavailable",
|
|
19147
19734
|
detail: issue
|
|
19148
19735
|
};
|
|
19149
|
-
|
|
19736
|
+
let id;
|
|
19150
19737
|
try {
|
|
19151
|
-
await this.config.store.createOverride(skillId, id
|
|
19152
|
-
await this.config.manager.replaceBuiltinBindings(skillId, id);
|
|
19153
|
-
this.config.resync();
|
|
19738
|
+
id = (await this.config.store.createOverride(skillId, void 0, [...OFFICIAL_SKILL_IDS, ...this.config.official()])).id;
|
|
19154
19739
|
} catch (error) {
|
|
19155
19740
|
return {
|
|
19156
19741
|
ok: false,
|
|
@@ -19158,7 +19743,18 @@ let TeamSkillService = (() => {
|
|
|
19158
19743
|
detail: String(error)
|
|
19159
19744
|
};
|
|
19160
19745
|
}
|
|
19161
|
-
|
|
19746
|
+
let bindingSwitchIssue;
|
|
19747
|
+
if (switchBindings === true) try {
|
|
19748
|
+
await this.config.manager.replaceBuiltinBindings(skillId, id);
|
|
19749
|
+
this.config.resync();
|
|
19750
|
+
} catch (error) {
|
|
19751
|
+
bindingSwitchIssue = String(error);
|
|
19752
|
+
}
|
|
19753
|
+
const detail = await this.detail(id);
|
|
19754
|
+
return "asset" in detail && bindingSwitchIssue !== void 0 ? {
|
|
19755
|
+
...detail,
|
|
19756
|
+
bindingSwitchIssue
|
|
19757
|
+
} : detail;
|
|
19162
19758
|
}
|
|
19163
19759
|
async updateDependencies(assetId, dependencies) {
|
|
19164
19760
|
const issue = await this.settle();
|
|
@@ -19192,7 +19788,8 @@ let TeamSkillService = (() => {
|
|
|
19192
19788
|
detail: issue
|
|
19193
19789
|
};
|
|
19194
19790
|
try {
|
|
19195
|
-
await this.config.store.resetOverride(assetId);
|
|
19791
|
+
const reset = await this.config.store.resetOverride(assetId);
|
|
19792
|
+
if (reset.officialSkillId !== void 0) await this.config.manager.replaceAssetBindings(assetId, `builtin:${reset.officialSkillId}`);
|
|
19196
19793
|
} catch (error) {
|
|
19197
19794
|
return {
|
|
19198
19795
|
ok: false,
|
|
@@ -19321,6 +19918,7 @@ let TeamSkillService = (() => {
|
|
|
19321
19918
|
try {
|
|
19322
19919
|
await this.config.manager.restoreBuiltinBindings(teamIds);
|
|
19323
19920
|
} catch (error) {
|
|
19921
|
+
this.ctx.logger.warn("agent-team-presets: restoring built-in Team Skill bindings failed: %s", String(error));
|
|
19324
19922
|
return {
|
|
19325
19923
|
...await this.library(),
|
|
19326
19924
|
issue: String(error)
|
|
@@ -20855,8 +21453,7 @@ function apply(ctx, config) {
|
|
|
20855
21453
|
quarantines.get(agent)?.dispose();
|
|
20856
21454
|
quarantines.delete(agent);
|
|
20857
21455
|
managedMembers.add(agent);
|
|
20858
|
-
const
|
|
20859
|
-
const role = claim.record.roleId ?? (claimedTeam === void 0 ? claim.record.memberName : roleOfMember(claimedTeam, claim.record.memberName));
|
|
21456
|
+
const role = recordedMemberRole(findTeam(config.teams.get(), claim.record.teamId), claim.record);
|
|
20860
21457
|
let installation;
|
|
20861
21458
|
if (role !== void 0) {
|
|
20862
21459
|
const assignment = {
|
|
@@ -21342,8 +21939,21 @@ function apply(ctx, config) {
|
|
|
21342
21939
|
const selection = config.selections.get().find((row) => row.sessionId === agent.session.id);
|
|
21343
21940
|
const selectedId = selection?.teamId;
|
|
21344
21941
|
const selectedRole = selectedRoleId(selection);
|
|
21345
|
-
|
|
21346
|
-
|
|
21942
|
+
let projections;
|
|
21943
|
+
try {
|
|
21944
|
+
projections = ctx.get("sessionProjections");
|
|
21945
|
+
} catch {
|
|
21946
|
+
projections = void 0;
|
|
21947
|
+
}
|
|
21948
|
+
if (!teamModeAdmitsTools(projections, agent)) {
|
|
21949
|
+
presetTools.get(agent)?.();
|
|
21950
|
+
presetTools.delete(agent);
|
|
21951
|
+
skillTools.get(agent)?.();
|
|
21952
|
+
skillTools.delete(agent);
|
|
21953
|
+
} else {
|
|
21954
|
+
if (!presetTools.has(agent)) presetTools.set(agent, registerPresetTools(ctx, agent, config, NAMESPACE, (root) => applications.get(root)?.teamId));
|
|
21955
|
+
if (!skillTools.has(agent)) skillTools.set(agent, registerTeamSkillTools(ctx, agent, skillToolDeps));
|
|
21956
|
+
}
|
|
21347
21957
|
if (startingTask ? teammatesBusy(ctx, agent) : agent.status === "running" || teammatesBusy(ctx, agent)) {
|
|
21348
21958
|
if (!applications.has(agent)) {
|
|
21349
21959
|
const marked = hasTeamApplicationMarker(agent);
|
|
@@ -21572,6 +22182,14 @@ function apply(ctx, config) {
|
|
|
21572
22182
|
if (root === void 0) return;
|
|
21573
22183
|
reconcile(root, isSessionRoot(agent) && status === "running");
|
|
21574
22184
|
});
|
|
22185
|
+
ctx.on("session/event", (session, event) => {
|
|
22186
|
+
if (event.type !== "team/mode") return;
|
|
22187
|
+
const agent = ctx.agents.get(session.id);
|
|
22188
|
+
if (agent === void 0 || !isSessionRoot(agent)) return;
|
|
22189
|
+
queueMicrotask(() => {
|
|
22190
|
+
if (!disposed) reconcile(agent);
|
|
22191
|
+
});
|
|
22192
|
+
});
|
|
21575
22193
|
ctx.on("session/event", (session, event) => {
|
|
21576
22194
|
if (event.type !== "subagent/catalog") return;
|
|
21577
22195
|
const agent = ctx.agents.get(session.id);
|