dsh-agent-team-presets 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +20 -12
  2. package/README.zh.md +19 -11
  3. package/lib/client.js +7998 -2007
  4. package/lib/index.js +2626 -1214
  5. package/lib/typert.host.js +7090 -1648
  6. package/lib/typert.remote-client.d.ts +4 -1
  7. package/lib/typert.remote-client.d.ts.map +1 -0
  8. package/lib/typert.remote-client.js +7171 -1729
  9. package/lib/types/application.d.ts +24 -1
  10. package/lib/types/application.js +77 -34
  11. package/lib/types/builtin-skill.js +7 -13
  12. package/lib/types/client/ComposerTeamSelect.d.ts +1 -1
  13. package/lib/types/client/ComposerTeamSelect.js +100 -7
  14. package/lib/types/client/TeamImportDialog.js +1 -1
  15. package/lib/types/client/TeamListView.js +8 -7
  16. package/lib/types/client/TeamRosterAction.d.ts +15 -0
  17. package/lib/types/client/TeamRosterAction.js +205 -0
  18. package/lib/types/client/index.js +33 -2
  19. package/lib/types/client/locales.d.ts +1 -1
  20. package/lib/types/client/locales.js +60 -12
  21. package/lib/types/client/team-presets-controller.d.ts +18 -0
  22. package/lib/types/client/team-presets-controller.js +15 -0
  23. package/lib/types/execution.d.ts +2 -2
  24. package/lib/types/execution.js +13 -11
  25. package/lib/types/index.js +89 -22
  26. package/lib/types/member-runtime.d.ts +32 -2
  27. package/lib/types/member-runtime.js +55 -2
  28. package/lib/types/presentation.d.ts +12 -5
  29. package/lib/types/presentation.js +63 -10
  30. package/lib/types/preset-tools.js +3 -9
  31. package/lib/types/team-runtime.d.ts +25 -0
  32. package/lib/types/team-runtime.js +50 -0
  33. package/lib/types/tool-catalog.d.ts +17 -1
  34. package/lib/types/tool-catalog.js +16 -0
  35. package/lib/types/types.d.ts +29 -0
  36. package/package.json +51 -49
@@ -19,7 +19,7 @@
19
19
  import type { Context } from '@deepseek-ai/cordis';
20
20
  import type { Agent } from '@deepseek-ai/dsh-agent';
21
21
  import { ReasoningEffortId } from '@deepseek-ai/dsh-llm';
22
- import type { SessionId } from '@deepseek-ai/dsh-session';
22
+ import { SessionId } from '@deepseek-ai/dsh-session';
23
23
  import type { ConfiguredMemberRoute } from './presets.ts';
24
24
  import type { TeamAgentPreset, TeamCaptainPreset, TeamPreset } from './types.ts';
25
25
  import type { MemberRuntime } from './member-runtime.ts';
@@ -168,6 +168,29 @@ export declare function assertTeamApplicable(agent: Agent, team: TeamPreset): vo
168
168
  * @returns the refusal text, or undefined when every named capability is reachable.
169
169
  */
170
170
  export declare function capabilityRefusal(agent: Agent, team: TeamPreset, target?: TeamApplicationTarget): string | undefined;
171
+ /**
172
+ * One roster line this refusal can act on.
173
+ *
174
+ * The roster is the only place that knows whether an occupied slot belongs to a
175
+ * member that still runs, or to a creation that never became usable. Without that
176
+ * split the captain cannot tell a busy Team from one that will never summon again.
177
+ */
178
+ export interface SpawnRosterEntry {
179
+ readonly name: string;
180
+ readonly status: string;
181
+ }
182
+ /**
183
+ * Explain one failed creation in terms the captain can act on.
184
+ *
185
+ * The two limits are different: an activity slot frees itself when a member
186
+ * finishes, while a used-up Team allowance never comes back. The official text
187
+ * is always preserved verbatim inside the explanation, because it carries the
188
+ * exact numbers the Host decided with.
189
+ * @param error - the failure `startActivation` reported.
190
+ * @param roster - current roster rows, used to name the slots that never became usable.
191
+ * @returns the model-facing explanation.
192
+ */
193
+ export declare function classifySpawnFailure(error: unknown, roster?: readonly SpawnRosterEntry[]): string;
171
194
  /**
172
195
  * Apply one Team preset to one live Session.
173
196
  *
@@ -18,6 +18,8 @@
18
18
  */
19
19
  import { defineTool } from '@deepseek-ai/dsh-tools';
20
20
  import { ReasoningEffortId } from '@deepseek-ai/dsh-llm';
21
+ import { SessionId } from '@deepseek-ai/dsh-session';
22
+ import { randomUUID } from 'node:crypto';
21
23
  import { PERSONA_PREFIX_SECTION } from '@deepseek-ai/dsh-system-prompt';
22
24
  import { IMPLICIT_TOOLS, captainBriefing, definitionFingerprint, findMember, memberBriefing, memberRouteOf, memberTargets, memberTeamDivision, soloMemberBriefing, toolMode } from "./presets.js";
23
25
  import { depthRefusal, routeRefusal } from "./delegation.js";
@@ -25,6 +27,7 @@ import { memberProviderFor } from "./member-identity.js";
25
27
  import { guardPolicy, inheritedFilter, isOwnLayerTool, policyOf } from "./tool-policy.js";
26
28
  import { SPAWN_TEAM_MEMBER_DESCRIPTION } from "./tool-descriptions.js";
27
29
  import { prepareNativePresentation } from "./presentation.js";
30
+ import { reserveMember, teamMembers } from "./team-runtime.js";
28
31
  /** The route this plugin actually installed on one created member. */
29
32
  const MEMBER_ROUTE_SCHEMA = {
30
33
  type: 'object',
@@ -163,6 +166,8 @@ export function capabilityRefusal(agent, team, target) {
163
166
  const CONCURRENT_CAPACITY = /active child limit/i;
164
167
  /** The Team's lifetime member allowance, which a finished member still occupies. */
165
168
  const LIFETIME_QUOTA = /team member limit/i;
169
+ /** The allowance the Host reported, when its refusal carries the number. */
170
+ const LIFETIME_LIMIT = /team member limit (\d+)/i;
166
171
  /**
167
172
  * Explain one failed creation in terms the captain can act on.
168
173
  *
@@ -170,18 +175,30 @@ const LIFETIME_QUOTA = /team member limit/i;
170
175
  * finishes, while a used-up Team allowance never comes back. The official text
171
176
  * is always preserved verbatim inside the explanation, because it carries the
172
177
  * exact numbers the Host decided with.
173
- * @param error - the failure `spawnTeammate` reported.
178
+ * @param error - the failure `startActivation` reported.
179
+ * @param roster - current roster rows, used to name the slots that never became usable.
174
180
  * @returns the model-facing explanation.
175
181
  */
176
- function classifySpawnFailure(error) {
182
+ export function classifySpawnFailure(error, roster = []) {
177
183
  const message = error instanceof Error ? error.message : String(error);
178
184
  if (CONCURRENT_CAPACITY.test(message)) {
179
185
  return 'No subagent slot is free right now: this deployment\'s concurrent subagent limit is reached. Wait for a '
180
186
  + `running member to finish, then summon again. (${message})`;
181
187
  }
182
188
  if (LIFETIME_QUOTA.test(message)) {
183
- return 'This Team has used up its lifetime member allowance. A member that already finished still occupies its '
184
- + `Team roster slot, so this Team cannot summon another instance; finish the task with the members it has. (${message})`;
189
+ const limit = LIFETIME_LIMIT.exec(message)?.[1];
190
+ const used = roster.length;
191
+ const failed = roster.filter(entry => entry.status === 'failed').map(entry => entry.name);
192
+ const occupancy = limit === undefined
193
+ ? `${used} roster slot${used === 1 ? '' : 's'} occupied`
194
+ : `${used} of ${limit} roster slots occupied`;
195
+ const spent = failed.length === 0
196
+ ? ''
197
+ : `, and ${failed.length} of them never became usable (${failed.join(', ')})`;
198
+ return 'This Team has used up its lifetime member allowance. A member that already finished, or a creation that '
199
+ + `never became usable, still occupies its Team roster slot (${occupancy}${spent}). The Host's roster is `
200
+ + 'append-only and exposes no removal API, so a slot spent by a failed creation cannot be reclaimed; start a new '
201
+ + `Session to summon more members. (${message})`;
185
202
  }
186
203
  return message;
187
204
  }
@@ -210,16 +227,38 @@ function routedMember(frozen, stored) {
210
227
  const matches = stored.members.filter(member => member.name.trim() === frozen.name.trim());
211
228
  return matches.length === 1 ? matches[0] : frozen;
212
229
  }
230
+ /**
231
+ * Reserve one child name the subagent runtime accepts.
232
+ *
233
+ * A name is a lower-case segment of at most 32 characters that starts with a
234
+ * letter and is never `lead`, so a display-derived target is adjusted rather
235
+ * than passed through.
236
+ * @param target - the configured teammate target.
237
+ * @param used - names already taken among the captain's children.
238
+ * @returns a free name for this creation.
239
+ */
240
+ function availableName(target, used) {
241
+ const prefixed = /^[a-z]/u.test(target) ? target : `m-${target}`;
242
+ const base = (prefixed === 'lead' ? 'lead-2' : prefixed).slice(0, 32).replace(/-+$/u, '');
243
+ let name = base;
244
+ let suffix = 2;
245
+ while (used.has(name)) {
246
+ const tail = `-${suffix++}`;
247
+ name = `${base.slice(0, 32 - tail.length).replace(/-+$/u, '')}${tail}`;
248
+ }
249
+ return name;
250
+ }
213
251
  /**
214
252
  * Register the model-facing member tool on one Session.
215
253
  *
216
- * Official rc.2's Team request accepts only `name`, `description`, `prompt`,
217
- * `context`, `provider`, and `signal`; the member's route, persona, and tool
218
- * scope therefore travel through the durable member snapshot this tool records
219
- * BEFORE `spawnTeammate` is called, and are installed by the serial
220
- * `agent/created` listener. A refused snapshot refuses the spawn: a member that
221
- * could not be recorded must not be created, because nothing would re-scope it.
222
- * @param ctx - the plugin context providing `agentTeams`.
254
+ * A subagent creation request carries no persona or tool filter, so the member's
255
+ * route, persona, and tool scope travel through the durable member snapshot this
256
+ * tool records BEFORE `startActivation` is called, and are installed by the
257
+ * serial `agent/created` listener. The snapshot also reserves the child
258
+ * identity, because the runtime publishes tree membership only after that
259
+ * callback returns. A refused snapshot refuses the spawn: a member that could
260
+ * not be recorded must not be created, because nothing would re-scope it.
261
+ * @param ctx - the plugin context providing `subagents`.
223
262
  * @param agent - the live Session agent that owns the tool.
224
263
  * @param team - the applied Team preset.
225
264
  * @param providers - continuable-subagent providers to spawn through.
@@ -282,15 +321,10 @@ function registerMemberTool(ctx, agent, team, providers, stored, members) {
282
321
  const alias = memberProviderFor(providers, context);
283
322
  if ('error' in alias)
284
323
  throw new Error(alias.error);
285
- const used = new Set(ctx.agentTeams.listMembers(caller).map(row => row.name));
324
+ const used = new Set(teamMembers(ctx, caller).map(row => row.name.split('/').pop() ?? row.name));
286
325
  for (const name of reserved)
287
326
  used.add(name);
288
- let instance = target;
289
- let suffix = 2;
290
- while (used.has(instance)) {
291
- const tail = `-${suffix++}`;
292
- instance = `${target.slice(0, 64 - tail.length).replace(/-+$/u, '')}${tail}`;
293
- }
327
+ const instance = availableName(target, used);
294
328
  reserved.add(instance);
295
329
  try {
296
330
  return await members.admit(async () => {
@@ -309,8 +343,15 @@ function registerMemberTool(ctx, agent, team, providers, stored, members) {
309
343
  if (recheck !== undefined)
310
344
  throw new Error(recheck);
311
345
  const policy = policyOf(team.id, member);
346
+ // The child identity is reserved here and recorded with the snapshot,
347
+ // so the creation callback can identify this member before the runtime
348
+ // publishes any membership for it.
349
+ const childId = SessionId(randomUUID());
350
+ const description = args.description
351
+ ?? (member.description.trim() === '' ? member.name.trim() || target : member.description.trim());
312
352
  const prepared = await members.prepare({
313
353
  root: caller,
354
+ childId,
314
355
  target: instance,
315
356
  teamId: team.id,
316
357
  roleId: member.id,
@@ -332,25 +373,24 @@ function registerMemberTool(ctx, agent, team, providers, stored, members) {
332
373
  });
333
374
  if (prepared.kind === 'refused')
334
375
  throw new Error(prepared.reason);
376
+ const release = reserveMember(caller, childId, instance);
335
377
  try {
336
- // Official fields only. The three extra properties earlier versions
337
- // passed here are not part of the Team request and were ignored.
338
- const result = await ctx.agentTeams.spawnTeammate(caller, {
339
- name: instance,
340
- description: args.description ?? (member.description.trim() === '' ? member.name.trim() || target : member.description.trim()),
341
- prompt: task,
342
- context,
378
+ // The alias is this member's durable identity: the Host writes it into
379
+ // the child's own descriptor, which is what tells this member apart
380
+ // from a native teammate after a restart.
381
+ const activation = members.track(await ctx.subagents.startActivation({
343
382
  provider: alias.name,
383
+ label: description,
384
+ prompt: task,
385
+ parent: caller,
344
386
  signal: exec.signal,
345
- });
346
- const failed = result.member.status === 'failed';
347
- // The Host can settle a member as failed while resolving the spawn;
348
- // record that on the snapshot so the durable record matches the action.
349
- if (failed)
350
- await members.markFailed(caller.id, instance);
387
+ delivery: 'parent',
388
+ name: instance,
389
+ childId,
390
+ }));
351
391
  return {
352
- target: result.member.name,
353
- status: failed ? 'failed' : 'active',
392
+ target: activation.name,
393
+ status: 'active',
354
394
  ...route === undefined ? {} : { configuredRoute: { ...route } },
355
395
  };
356
396
  }
@@ -362,11 +402,14 @@ function registerMemberTool(ctx, agent, team, providers, stored, members) {
362
402
  // and the Host then reports only its provisioning checkpoint. Name the
363
403
  // member's real cause so the fault is not mistaken for a Team fault.
364
404
  const cause = members.failureOf(caller.id, instance);
365
- const reported = classifySpawnFailure(error);
405
+ const reported = classifySpawnFailure(error, teamMembers(ctx, caller));
366
406
  if (cause === undefined)
367
407
  throw new Error(reported, { cause: error });
368
408
  throw new Error(`${reported} (the member's own first request failed: ${cause})`, { cause: error });
369
409
  }
410
+ finally {
411
+ release();
412
+ }
370
413
  });
371
414
  }
372
415
  finally {
@@ -40,7 +40,7 @@ export const BUILTIN_SKILL_CONTENT = `# Agent Team Presets 使用问题排查
40
40
  | 现象 | 先查 | 常见原因 | 处理 |
41
41
  |---|---|---|---|
42
42
  | 选中团队但不生效 | 当前会话 Team selection、应用状态、报错文本 | Team 无效、被 quarantine、任务运行中冻结、Agent preset 不兼容 | 修复预设或换 Team;等队长/成员 idle;必要时换 Agent preset |
43
- | 自定义工具策略被拒 | 报错是否提到 native Agent preset / PTC | DSH rc.1 无法在临时覆盖执行器后恢复继承执行器,插件主动拒绝 | 改用 all-tools,或先把 Agent preset 换成 standard/cordis |
43
+ | 自定义工具策略被拒 | 报错是否提到 native executor / run_code 仍暴露 | 挂载 native 执行器失败,或挂载后工具面仍含 PTC 传输 | 改用 all-tools,或在会话开始前换 standard/cordis 预设;两种情况都不会留下残留 |
44
44
  | 成员无法召唤 | 报错文本、成员快照、subagent provider、存储 | 无 member runtime、无存储、无 spawn/fork 后端、深度/配额、快照损坏、技能目录无法发布 | 按报错逐项修复;不要绕过标记或隔离 |
45
45
  | 成员模型与配置不符 | configuredRoute、model/selection、request/header、成员快照 route;list_agents 的 model 仅作展示 | 展示值 fallback(list_agents 可能返回错误/继承模型);预设未保存;provider 不支持该模型/effort;成员路由在召唤时读取 | 以运行证据为准;三处运行证据一致而 list_agents 不同时,判定为展示问题,实际路由正确 |
46
46
  | Team Skill 不可见 | 是否已分配给正确 roleId、skill 工具是否可见、库是否打开 | 分配错角色、成员创建早于目录发布、宿主隐藏 skill 工具、存储未打开 | 重新分配/重建成员;检查库与绑定 |
@@ -60,19 +60,13 @@ export const BUILTIN_SKILL_CONTENT = `# Agent Team Presets 使用问题排查
60
60
 
61
61
  ## 2. 自定义工具策略被拒 / PTC
62
62
 
63
- 典型报错:
63
+ PTC 预设 + 自定义白名单现在可以应用,但会改变该会话的工具面:
64
64
 
65
- ~~~text
66
- Custom Team tool policies require a native Agent preset (standard or cordis).
67
- This Session uses PTC, and this Harness version cannot restore an inherited
68
- executor after a temporary override.
69
- ~~~
70
-
71
- - 这是 **有意拒绝**,不是漏配。DSH 0.2.2-rc.1 的 setExecutor disposer 会在精确作用域留下不可用的选择,没有公开操作能恢复继承执行器;插件不再安装 native presentation 覆盖,因此 PTC 下不能安全执行自定义 allow-list。
72
- - 处理:
73
- 1. 在会话开始前把 Agent preset 切到 standard 或 cordis;或
74
- 2. 该 Team 改用 all-tools 模式(PTC 仍可用)。
75
- - 不要尝试 presentAs、强制 native、关闭 guard 或修改隔离来“让它先跑起来”;这会让策略与实际执行面不一致。
65
+ - 应用时插件把宿主自带的 native 工具执行器挂到**该会话的 Agent 作用域**(\`agent.ctx.tools.setExecutor\`),部署级 PTC 执行器和其他会话都不受影响。
66
+ - 该注册的 effect 归 Agent ctx 所有,插件**从不主动释放** —— 这正是 DSH 0.2.2-rc.1 单向释放(tombstone)不会咬到的原因;Agent 销毁时随上下文回收。
67
+ - 代价:这个会话此后不再使用 \`run_code\`,直到它的 Agent 结束。
68
+ - 报错时只有两种可能:挂载失败,或挂载后工具面仍暴露 PTC 传输;两种情况都不会留下残留(从未释放过执行器),处理方式是该 Team 改用 all-tools 模式,或在会话开始前选 native 预设。
69
+ - 不要绕过 guard、不要关闭隔离、也不要手工 \`presentAs\`:策略必须与实际执行面一致。
76
70
  - 检查点:会话当前 Agent preset、Team 队长/成员的 toolMode、报错是否来自应用阶段还是 spawn_team_member。
77
71
 
78
72
  ## 3. 成员无法召唤
@@ -13,4 +13,4 @@ export type ComposerTeamSelectProps = PropsRuntime<'conversation.input.left'> &
13
13
  * @param props - the Session identity, the page's locale reader, and the selection writers.
14
14
  * @returns the Team trigger, the picker with its member panel, and a notice when the last selection write failed.
15
15
  */
16
- export declare function ComposerTeamSelect(props: ComposerTeamSelectProps): import("react").JSX.Element;
16
+ export declare function ComposerTeamSelect(props: ComposerTeamSelectProps): import("react").JSX.Element | null;
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
5
5
  *
6
6
  * It sits in the composer tool row after the permission control.
7
7
  */
8
- import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
8
+ import { useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
9
9
  import { IconChevronDownOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives';
10
10
  import { selectedMember, selectedRoleId, selectedTeam } from "../presets.js";
11
11
  import { TEAM_SERIES } from "../team-catalog.js";
@@ -13,6 +13,27 @@ import { matchTeam, orderedCategories, queryTokens, teamOrigin } from "../team-s
13
13
  import { groupTeams, matchesCategoryFilter } from "./team-grouping.js";
14
14
  import { FORM_ISSUE_KEYS, selectionFailureText } from "./locales.js";
15
15
  import css from './ComposerTeamSelect.module.css';
16
+ /** The empty library state a build without a Team Skill service reports. */
17
+ const NO_SKILL_STATE = {
18
+ status: 'unavailable',
19
+ library: undefined,
20
+ selectedId: undefined,
21
+ detail: undefined,
22
+ busy: false,
23
+ message: undefined,
24
+ failed: false,
25
+ issue: undefined,
26
+ file: undefined,
27
+ fileText: undefined,
28
+ scan: undefined,
29
+ canOpenScanFolder: false,
30
+ scanFolderPath: undefined,
31
+ scanFolderNotice: undefined,
32
+ };
33
+ /** Subscription used when this build composes no Team Skill library. */
34
+ const NO_SKILL_UPDATES = () => () => { };
35
+ /** Snapshot reader used when this build composes no Team Skill library. */
36
+ const readNoSkillState = () => NO_SKILL_STATE;
16
37
  /** How long the member panel survives while the pointer crosses the gap to it. */
17
38
  const PANEL_GRACE_MS = 140;
18
39
  /** Gap between the picker and the panel, matching the dock's CSS gap. */
@@ -39,6 +60,18 @@ function memberRouteLabel(providers, member) {
39
60
  const parts = [provider?.name ?? member.provider, model?.name ?? member.model].filter(part => part.trim() !== '');
40
61
  return parts.length === 0 ? undefined : parts.join(' · ');
41
62
  }
63
+ /** Stable tag palette index for one skill id, so a skill keeps its colour. */
64
+ function skillTagStyle(skillId) {
65
+ let hash = 0;
66
+ for (let index = 0; index < skillId.length; index += 1) {
67
+ hash = (hash * 31 + skillId.charCodeAt(index)) % 360;
68
+ }
69
+ return {
70
+ background: `hsl(${hash} 70% 93%)`,
71
+ borderColor: `hsl(${hash} 55% 82%)`,
72
+ color: `hsl(${hash} 45% 32%)`,
73
+ };
74
+ }
42
75
  /**
43
76
  * Render the composer's Team picker.
44
77
  * @param props - the Session identity, the page's locale reader, and the selection writers.
@@ -47,6 +80,17 @@ function memberRouteLabel(providers, member) {
47
80
  export function ComposerTeamSelect(props) {
48
81
  const { t, sessionId } = props;
49
82
  const state = props.useTeamPresets(snapshot => snapshot);
83
+ // The official Team-mode switch lives in the model menu. Team presets pick
84
+ // members through the subagent runtime, so the switch is the product's answer
85
+ // to "may this Session run a Team at all": while it is off, the control that
86
+ // would apply one is not offered. A deployment that composes no Team service
87
+ // publishes no projection, and then nothing else can gate the control.
88
+ const teamMode = props.useProjection('agentTeam');
89
+ // Team Skills bound to a member's role are what that member can load, so the
90
+ // panel offering a one-to-one chat names them; a bound skill is otherwise
91
+ // invisible until the member's first turn.
92
+ const skills = props.skills;
93
+ const skillsState = useSyncExternalStore(skills?.subscribe ?? NO_SKILL_UPDATES, skills?.getSnapshot ?? readNoSkillState);
50
94
  const [open, setOpen] = useState(false);
51
95
  // The Team whose member panel is showing: a hover or a keyboard focus keeps it
52
96
  // up while the pointer crosses the gap between the picker and the panel.
@@ -98,6 +142,29 @@ export function ComposerTeamSelect(props) {
98
142
  const [source, setSource] = useState('all');
99
143
  const [series, setSeries] = useState('all');
100
144
  const [categoryId, setCategoryId] = useState('');
145
+ /**
146
+ * Team Skills bound to each member role of the Team whose panel is open.
147
+ *
148
+ * Only the roles' own bindings count: a captain's skills are not a member's,
149
+ * and a skill the library does not list has nothing to show.
150
+ */
151
+ const skillNamesByRole = useMemo(() => {
152
+ const byRole = new Map();
153
+ const assets = skillsState.library?.assets ?? [];
154
+ if (hoverTeamId === undefined)
155
+ return byRole;
156
+ for (const asset of assets) {
157
+ for (const binding of asset.bindings) {
158
+ if (binding.teamId !== hoverTeamId || binding.captain)
159
+ continue;
160
+ const names = byRole.get(binding.roleId) ?? [];
161
+ if (!names.includes(asset.skillId))
162
+ names.push(asset.skillId);
163
+ byRole.set(binding.roleId, names);
164
+ }
165
+ }
166
+ return byRole;
167
+ }, [skillsState.library, hoverTeamId]);
101
168
  /** Cancel a pending panel close, so a hover that continues keeps the panel up. */
102
169
  const cancelHoverClose = () => {
103
170
  if (hoverTimer.current === undefined)
@@ -176,8 +243,13 @@ export function ComposerTeamSelect(props) {
176
243
  setPanelPlacement('right');
177
244
  return;
178
245
  }
179
- const roomOnLeft = dockRect.left - PANEL_GAP_PX - width >= PANEL_VIEWPORT_MARGIN_PX;
180
- setPanelPlacement(roomOnLeft ? 'left' : 'overlay');
246
+ // A flipped panel must stay inside the element that clips the composer:
247
+ // reaching the viewport edge is not enough when the composer itself ends
248
+ // further in, and a panel under that edge would be cut in half.
249
+ const clipRect = dockNode.offsetParent instanceof HTMLElement ? dockNode.offsetParent.getBoundingClientRect() : undefined;
250
+ const leftEdge = dockRect.left - PANEL_GAP_PX - width;
251
+ const leftLimit = Math.max(clipRect?.left ?? 0, PANEL_VIEWPORT_MARGIN_PX) + PANEL_VIEWPORT_MARGIN_PX;
252
+ setPanelPlacement(leftEdge >= leftLimit ? 'left' : 'overlay');
181
253
  };
182
254
  measure();
183
255
  window.addEventListener('resize', measure);
@@ -223,11 +295,29 @@ export function ComposerTeamSelect(props) {
223
295
  }
224
296
  schedulePanelClose();
225
297
  };
298
+ if (teamMode !== undefined && teamMode.enabled !== true)
299
+ return null;
226
300
  return (_jsxs(_Fragment, { children: [_jsxs("span", { className: css.wrap, ref: popover, children: [_jsxs("button", { type: "button", className: activeMember === undefined ? css.trigger : `${css.trigger} ${css.triggerMember}`, disabled: !writable, "aria-haspopup": "listbox", "aria-expanded": open, title: failure ?? issue ?? (missing ? `${missingLabel}. ${t('composerMissingHint')}` : t('composerHint')), onClick: () => { setOpen(value => !value); }, children: [accent === ''
227
301
  ? null
228
- : (_jsx("span", { className: css.accentDot, style: { background: accent }, "aria-hidden": true })), _jsx("span", { className: css.triggerLabel, "aria-label": t('composerTitle'), children: triggerLabel }), _jsx("span", { className: css.triggerIcon, children: _jsx(IconChevronDownOutlineRegular, { size: 14 }) })] }), open ? (_jsxs("div", { className: css.dock, ref: dock, onBlur: onDockBlur, children: [_jsxs("div", { className: css.popover, role: "listbox", "aria-label": t('composeTitle'), children: [_jsxs("div", { className: css.popHead, children: [_jsx("span", { children: t('composeTitle') }), _jsx("button", { type: "button", className: css.popClose, onClick: () => { closePicker(); }, children: t('composeClose') })] }), _jsx("input", { className: css.popSearch, autoFocus: true, value: query, placeholder: t('composeSearch'), onChange: (event) => { setQuery(event.target.value); } }), _jsxs("div", { className: css.popChips, children: [_jsx("span", { className: css.popFilterLabel, children: t('filterSource') }), _jsx("button", { type: "button", className: `${css.popChip} ${source === 'all' ? css.popChipActive : ''}`, onClick: () => { setSource('all'); }, children: t('listAll') }), _jsx("button", { type: "button", className: `${css.popChip} ${source === 'builtin' ? css.popChipActive : ''}`, onClick: () => { setSource('builtin'); setCategoryId(''); }, children: t('listBuiltin') }), _jsx("button", { type: "button", className: `${css.popChip} ${source === 'custom' ? css.popChipActive : ''}`, onClick: () => { setSource('custom'); setSeries('all'); }, children: t('listCustom') })] }), _jsxs("div", { className: css.popChips, children: [_jsx("span", { className: css.popFilterLabel, children: t('filterCategory') }), _jsx("button", { type: "button", className: `${css.popChip} ${series === 'all' && categoryId === '' ? css.popChipActive : ''}`, onClick: () => { setSeries('all'); setCategoryId(''); }, children: t('listAll') }), source !== 'custom' ? TEAM_SERIES.map(entry => (_jsx("button", { type: "button", className: `${css.popChip} ${series === entry.id ? css.popChipActive : ''}`, onClick: () => { setSeries(series === entry.id ? 'all' : entry.id); setCategoryId(''); }, children: entry.id === 'classic-development' ? t('seriesDevelopment') : t('seriesWorkModes') }, entry.id))) : null, source !== 'builtin' ? categories.map(entry => (_jsx("button", { type: "button", className: `${css.popChip} ${categoryId === entry.id ? css.popChipActive : ''}`, onClick: () => { setCategoryId(categoryId === entry.id ? '' : entry.id); setSeries('all'); }, children: entry.name }, entry.id))) : null, source === 'custom' && categories.length === 0
229
- ? _jsx("span", { className: css.popFilterLabel, children: t('filterNoCategory') })
230
- : null] }), _jsxs("div", { className: css.popList, children: [_jsxs("button", { type: "button", className: `${css.popOption} ${selection === undefined ? css.popOptionActive : ''}`, onClick: () => { choose(undefined); }, children: [_jsx("span", { className: css.popOptionName, children: t('composerNone') }), _jsx("span", { className: css.popOptionSub, children: t('composeNoneSub') })] }), missing ? (_jsxs("button", { type: "button", className: css.popOption, disabled: true, children: [_jsx("span", { className: css.popOptionName, children: missingLabel }), _jsx("span", { className: css.popOptionSub, children: t('composerMissingHint') })] })) : null, groups.map(group => group.teams.length === 0 ? null : (_jsxs("div", { children: [_jsx("div", { className: css.popGroup, children: groupLabel(group) }), group.teams.map((team) => (_jsxs("button", { type: "button", role: "option", "aria-selected": selection?.teamId === team.id, className: `${css.popOption} ${selection?.teamId === team.id ? css.popOptionActive : ''}`, onClick: () => { choose(team.id); }, onMouseEnter: () => { showPanel(team.id); }, onMouseLeave: schedulePanelClose, onFocus: () => { showPanel(team.id); }, onBlur: schedulePanelClose, children: [_jsx("span", { className: css.popOptionName, children: team.name === '' ? team.id : team.name }), _jsx("span", { className: css.popOptionSub, title: team.description, children: team.description || team.metadata?.summary || '' })] }, team.id)))] }, group.id))), groups.every(group => group.teams.length === 0) ? _jsx("div", { className: css.popEmpty, children: t('composeEmpty') }) : null] })] }), hoverTeam === undefined ? null : (_jsxs("div", { ref: panel, className: `${css.memberPanel} ${panelPlacement === 'left' ? css.memberPanelLeft : panelPlacement === 'overlay' ? css.memberPanelOverlay : ''}`, role: "group", "aria-label": t('composePanelTitle'), onMouseEnter: cancelHoverClose, onMouseLeave: schedulePanelClose, children: [_jsxs("div", { className: css.panelHead, children: [_jsx("span", { className: css.panelTitle, children: t('composePanelTitle') }), _jsx("span", { className: css.panelTeam, children: hoverTeam.name === '' ? hoverTeam.id : hoverTeam.name })] }), _jsx("div", { className: css.panelSection, children: t('composePanelCaptain') }), _jsxs("button", { type: "button", className: `${css.panelRow} ${isActiveCaptain(hoverTeam) ? css.panelRowActive : ''}`, "aria-pressed": isActiveCaptain(hoverTeam), title: t('composePanelCaptainHint'), onClick: () => { choose(hoverTeam.id); }, children: [_jsxs("span", { className: css.panelRowHead, children: [_jsx("span", { className: css.panelDot, style: hoverTeam.captain.color === '' ? undefined : { background: hoverTeam.captain.color }, "aria-hidden": true }), _jsx("span", { className: css.panelName, children: hoverTeam.captain.name.trim() === '' ? t('composePanelCaptain') : hoverTeam.captain.name }), _jsx("span", { className: css.panelBadge, children: t('composePanelCaptain') })] }), _jsx("span", { className: css.panelRoute, children: t('composePanelSessionModel') }), hoverTeam.captain.description.trim() === '' ? null : _jsx("span", { className: css.panelDesc, children: hoverTeam.captain.description })] }), _jsx("div", { className: css.panelSection, children: t('composePanelMembers') }), hoverTeam.members.length === 0
302
+ : (_jsx("span", { className: css.accentDot, style: { background: accent }, "aria-hidden": true })), _jsx("span", { className: css.triggerLabel, "aria-label": t('composerTitle'), children: triggerLabel }), _jsx("span", { className: css.triggerIcon, children: _jsx(IconChevronDownOutlineRegular, { size: 14 }) })] }), open ? (_jsxs("div", { className: css.dock, ref: dock, onBlur: onDockBlur, children: [_jsxs("div", { className: css.popover, role: "listbox", "aria-label": t('composeTitle'), children: [_jsxs("div", { className: css.popHead, children: [_jsx("span", { children: t('composeTitle') }), _jsx("button", { type: "button", className: css.popClose, onClick: () => { closePicker(); }, children: t('composeClose') })] }), _jsx("input", { className: css.popSearch, autoFocus: true, value: query, placeholder: t('composeSearch'), onChange: (event) => { setQuery(event.target.value); } }), _jsxs("div", { className: css.popFilters, children: [_jsxs("label", { className: css.popFilterRow, children: [_jsx("span", { className: css.popFilterLabel, children: t('filterSource') }), _jsxs("select", { className: css.popSelect, value: source, onChange: (event) => {
303
+ const next = event.target.value;
304
+ setSource(next === 'builtin' || next === 'custom' ? next : 'all');
305
+ setSeries('all');
306
+ setCategoryId('');
307
+ }, children: [_jsx("option", { value: "all", children: t('listAll') }), _jsx("option", { value: "builtin", children: t('listBuiltin') }), _jsx("option", { value: "custom", children: t('listCustom') })] })] }), _jsxs("label", { className: css.popFilterRow, children: [_jsx("span", { className: css.popFilterLabel, children: t('filterCategory') }), _jsxs("select", { className: css.popSelect, value: series !== 'all' ? `series:${series}` : categoryId === '' ? '' : `category:${categoryId}`, onChange: (event) => {
308
+ const next = event.target.value;
309
+ if (next.startsWith('series:')) {
310
+ const id = next.slice('series:'.length);
311
+ const known = TEAM_SERIES.find(entry => entry.id === id);
312
+ setSeries(known === undefined ? 'all' : known.id);
313
+ setCategoryId('');
314
+ return;
315
+ }
316
+ setSeries('all');
317
+ setCategoryId(next.startsWith('category:') ? next.slice('category:'.length) : '');
318
+ }, children: [_jsx("option", { value: "", children: t('listAll') }), source === 'custom' ? null : TEAM_SERIES.map(entry => (_jsx("option", { value: `series:${entry.id}`, children: entry.id === 'classic-development' ? t('seriesDevelopment') : t('seriesWorkModes') }, entry.id))), source === 'builtin' ? null : categories.map(entry => (_jsx("option", { value: `category:${entry.id}`, children: entry.name }, entry.id))), source === 'custom' && categories.length === 0
319
+ ? _jsx("option", { value: "", disabled: true, children: t('filterNoCategory') })
320
+ : null] })] })] }), _jsxs("div", { className: css.popList, children: [_jsxs("button", { type: "button", className: `${css.popOption} ${selection === undefined ? css.popOptionActive : ''}`, onClick: () => { choose(undefined); }, children: [_jsx("span", { className: css.popOptionName, children: t('composerNone') }), _jsx("span", { className: css.popOptionSub, children: t('composeNoneSub') })] }), missing ? (_jsxs("button", { type: "button", className: css.popOption, disabled: true, children: [_jsx("span", { className: css.popOptionName, children: missingLabel }), _jsx("span", { className: css.popOptionSub, children: t('composerMissingHint') })] })) : null, groups.map(group => group.teams.length === 0 ? null : (_jsxs("div", { children: [_jsx("div", { className: css.popGroup, children: groupLabel(group) }), group.teams.map((team) => (_jsxs("button", { type: "button", role: "option", "aria-selected": selection?.teamId === team.id, className: `${css.popOption} ${selection?.teamId === team.id ? css.popOptionActive : ''}`, onClick: () => { choose(team.id); }, onMouseEnter: () => { showPanel(team.id); }, onMouseLeave: schedulePanelClose, onFocus: () => { showPanel(team.id); }, onBlur: schedulePanelClose, children: [_jsx("span", { className: css.popOptionName, children: team.name === '' ? team.id : team.name }), _jsx("span", { className: css.popOptionSub, title: team.description, children: team.description || team.metadata?.summary || '' })] }, team.id)))] }, group.id))), groups.every(group => group.teams.length === 0) ? _jsx("div", { className: css.popEmpty, children: t('composeEmpty') }) : null] })] }), hoverTeam === undefined ? null : (_jsxs("div", { ref: panel, className: `${css.memberPanel} ${panelPlacement === 'left' ? css.memberPanelLeft : panelPlacement === 'overlay' ? css.memberPanelOverlay : ''}`, role: "group", "aria-label": t('composePanelTitle'), onMouseEnter: cancelHoverClose, onMouseLeave: schedulePanelClose, children: [_jsxs("div", { className: css.panelHead, children: [_jsx("span", { className: css.panelTitle, children: t('composePanelTitle') }), _jsx("span", { className: css.panelTeam, children: hoverTeam.name === '' ? hoverTeam.id : hoverTeam.name })] }), _jsx("div", { className: css.panelSection, children: t('composePanelCaptain') }), _jsxs("button", { type: "button", className: `${css.panelRow} ${isActiveCaptain(hoverTeam) ? css.panelRowActive : ''}`, "aria-pressed": isActiveCaptain(hoverTeam), title: t('composePanelCaptainHint'), onClick: () => { choose(hoverTeam.id); }, children: [_jsxs("span", { className: css.panelRowHead, children: [_jsx("span", { className: css.panelDot, style: hoverTeam.captain.color === '' ? undefined : { background: hoverTeam.captain.color }, "aria-hidden": true }), _jsx("span", { className: css.panelName, children: hoverTeam.captain.name.trim() === '' ? t('composePanelCaptain') : hoverTeam.captain.name }), _jsx("span", { className: css.panelBadge, children: t('composePanelCaptain') })] }), _jsx("span", { className: css.panelRoute, children: t('composePanelSessionModel') }), hoverTeam.captain.description.trim() === '' ? null : _jsx("span", { className: css.panelDesc, children: hoverTeam.captain.description })] }), _jsx("div", { className: css.panelSection, children: t('composePanelMembers') }), hoverTeam.members.length === 0
231
321
  ? _jsx("div", { className: css.panelEmpty, children: t('composePanelEmptyMembers') })
232
322
  : hoverTeam.members.map((member, index) => {
233
323
  // A member without a stable identity cannot be named by a
@@ -235,10 +325,13 @@ export function ComposerTeamSelect(props) {
235
325
  // than offered as a click that would write nothing usable.
236
326
  const selectable = member.id !== undefined && member.id.trim() !== '';
237
327
  const route = memberRouteLabel(state.providers, member) ?? t('composePanelSessionModel');
328
+ // Only this member's own role bindings: a captain's skills and
329
+ // another role's skills are not what this conversation loads.
330
+ const boundNames = member.id === undefined ? [] : skillNamesByRole.get(member.id) ?? [];
238
331
  return (_jsxs("button", { type: "button", className: `${css.panelRow} ${isActiveMember(hoverTeam, member) ? css.panelRowActive : ''}`, "aria-pressed": isActiveMember(hoverTeam, member), disabled: !selectable, title: selectable ? t('composePanelSoloHint') : t('composePanelNoId'), onClick: () => {
239
332
  if (member.id === undefined || member.id.trim() === '')
240
333
  return;
241
334
  chooseMember(hoverTeam.id, member.id);
242
- }, children: [_jsxs("span", { className: css.panelRowHead, children: [_jsx("span", { className: css.panelDot, style: member.color === '' ? undefined : { background: member.color }, "aria-hidden": true }), _jsx("span", { className: css.panelName, children: member.name.trim() === '' ? (member.id ?? t('composePanelMembers')) : member.name })] }), _jsx("span", { className: css.panelRoute, children: route }), member.description.trim() === '' ? null : _jsx("span", { className: css.panelDesc, children: member.description }), selectable ? null : _jsx("span", { className: css.panelDesc, children: t('composePanelNoId') })] }, member.id ?? `${hoverTeam.id}:${index}`));
335
+ }, children: [_jsxs("span", { className: css.panelRowHead, children: [_jsx("span", { className: css.panelDot, style: member.color === '' ? undefined : { background: member.color }, "aria-hidden": true }), _jsx("span", { className: css.panelName, children: member.name.trim() === '' ? (member.id ?? t('composePanelMembers')) : member.name })] }), _jsx("span", { className: css.panelRoute, children: route }), member.description.trim() === '' ? null : _jsx("span", { className: css.panelDesc, children: member.description }), boundNames.length === 0 ? null : (_jsx("span", { className: css.panelSkillTags, children: boundNames.map(name => (_jsx("span", { className: css.panelSkillTag, style: skillTagStyle(name), children: name }, name))) })), selectable ? null : _jsx("span", { className: css.panelDesc, children: t('composePanelNoId') })] }, member.id ?? `${hoverTeam.id}:${index}`));
243
336
  }), _jsx("div", { className: css.panelHint, children: hoverTeam.members.length === 0 ? t('composePanelCaptainHint') : t('composePanelSoloHint') })] }))] })) : null] }), failure === undefined ? null : _jsx("span", { className: css.failure, role: "status", children: failure })] }));
244
337
  }
@@ -55,5 +55,5 @@ export function TeamImportDialog(props) {
55
55
  }, {
56
56
  replace: t('importMemberReplace'),
57
57
  rename: t('importMemberRename'),
58
- })] }, name))) })] }))] }))] }));
58
+ })] }, name))) })] }))] })), _jsx("p", { className: css.dialogNote, children: t('importNote') })] }));
59
59
  }
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
4
4
  * opens that Team's own page.
5
5
  */
6
6
  import { useMemo, useRef, useState } from 'react';
7
- import { Button } from '@deepseek-ai/dsh-client-ui-primitives';
7
+ import { Button, Modal } from '@deepseek-ai/dsh-client-ui-primitives';
8
8
  import { matchTeam, queryTokens, teamOrigin } from "../team-search.js";
9
9
  import { TEAM_SERIES, teamSeriesOf } from "../team-catalog.js";
10
10
  import css from './TeamPresetsSection.module.css';
@@ -16,6 +16,7 @@ import css from './TeamPresetsSection.module.css';
16
16
  export function TeamListView(props) {
17
17
  const { t, disabled } = props;
18
18
  const fileInput = useRef(null);
19
+ const [confirmRestore, setConfirmRestore] = useState(false);
19
20
  const [query, setQuery] = useState('');
20
21
  const [source, setSource] = useState('all');
21
22
  const [series, setSeries] = useState('all');
@@ -32,17 +33,17 @@ export function TeamListView(props) {
32
33
  const matchesQuery = tokens.length === 0 || matchTeam(team, tokens) !== undefined;
33
34
  return matchesSource && matchesSeries && matchesCategory && matchesQuery;
34
35
  }), [props.teams, props.teamCategories, source, series, category, tokens]);
35
- return (_jsxs(_Fragment, { children: [_jsxs("header", { className: css.pageHead, children: [_jsx("h2", { className: css.title, children: t('title') }), _jsx("p", { className: css.intro, children: t('description') })] }), _jsxs("div", { className: css.actionRow, children: [_jsx(Button, { size: "sm", variant: "outline", disabled: disabled, onClick: props.onCreate, children: t('newTeam') }), _jsx(Button, { size: "sm", variant: "outline", disabled: disabled, onClick: () => { fileInput.current?.click(); }, children: t('importPreset') }), _jsx(Button, { size: "sm", variant: "outline", disabled: disabled, onClick: props.onRestoreDefaults, children: t('restoreDefaults') }), props.onManageCategories === undefined ? null : (_jsx(Button, { size: "sm", variant: "outline", onClick: props.onManageCategories, children: t('categoryManagePage') })), _jsx("input", { ref: fileInput, className: css.fileInput, type: "file", accept: "application/json,.json", disabled: disabled, onChange: (event) => {
36
+ return (_jsxs(_Fragment, { children: [_jsxs("header", { className: css.pageHead, children: [_jsx("h2", { className: css.title, children: t('title') }), _jsx("p", { className: css.intro, children: t('description') })] }), _jsxs("div", { className: css.toolbar, children: [_jsxs("div", { className: css.toolbarGroup, children: [_jsx(Button, { size: "sm", variant: "primary", disabled: disabled, onClick: props.onCreate, children: t('newTeam') }), _jsx(Button, { size: "sm", variant: "outline", disabled: disabled, title: t('importNote'), onClick: () => { fileInput.current?.click(); }, children: t('importPreset') })] }), _jsxs("div", { className: css.toolbarGroup, children: [props.onManageCategories === undefined ? null : (_jsx(Button, { size: "sm", variant: "outline", onClick: props.onManageCategories, children: t('categoryManagePage') })), _jsx(Button, { size: "sm", variant: "ghost", disabled: disabled, onClick: () => { setConfirmRestore(true); }, children: t('restoreDefaults') })] }), _jsx("input", { ref: fileInput, className: css.fileInput, type: "file", accept: "application/json,.json", disabled: disabled, onChange: (event) => {
36
37
  const file = event.target.files?.[0];
37
38
  // Clearing the value lets the same document be chosen twice in a row.
38
39
  event.target.value = '';
39
40
  if (file !== undefined)
40
41
  props.onImport(file);
41
- } })] }), _jsx("p", { className: css.hint, children: t('importNote') }), _jsx("p", { className: css.hint, children: t('restoreDefaultsHint') }), props.importError === undefined
42
+ } })] }), confirmRestore ? (_jsx(Modal, { open: true, onClose: () => { setConfirmRestore(false); }, title: t('restoreConfirmTitle'), closeLabel: t('close'), footer: (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => { setConfirmRestore(false); }, children: t('cancel') }), _jsx(Button, { variant: "primary", onClick: () => { setConfirmRestore(false); props.onRestoreDefaults(); }, children: t('restoreConfirmAction') })] })), children: _jsx("p", { className: css.dialogCopy, children: t('restoreConfirmBody') }) })) : null, props.importError === undefined
42
43
  ? null
43
- : _jsx("p", { className: css.warn, role: "status", children: t(props.importError) }), _jsx("div", { className: css.listToolbar, children: _jsx("input", { className: css.listSearch, value: query, placeholder: t('listSearch'), onChange: (event) => { setQuery(event.target.value); } }) }), _jsxs("div", { className: css.filterRow, children: [_jsx("span", { className: css.filterLabel, children: t('filterSource') }), _jsx("button", { type: "button", className: `${css.chip} ${source === 'all' ? css.chipActive : ''}`, onClick: () => { setSource('all'); }, children: t('listAll') }), _jsx("button", { type: "button", className: `${css.chip} ${source === 'builtin' ? css.chipActive : ''}`, onClick: () => { setSource('builtin'); setCategory(''); }, children: t('listBuiltin') }), _jsx("button", { type: "button", className: `${css.chip} ${source === 'custom' ? css.chipActive : ''}`, onClick: () => { setSource('custom'); setSeries('all'); }, children: t('listCustom') })] }), _jsxs("div", { className: css.filterRow, children: [_jsx("span", { className: css.filterLabel, children: t('filterCategory') }), _jsx("button", { type: "button", className: `${css.chip} ${series === 'all' && category === '' ? css.chipActive : ''}`, onClick: () => { setSeries('all'); setCategory(''); }, children: t('listAll') }), source !== 'custom' ? TEAM_SERIES.map(entry => (_jsx("button", { type: "button", className: `${css.chip} ${series === entry.id ? css.chipActive : ''}`, onClick: () => { setSeries(series === entry.id ? 'all' : entry.id); setCategory(''); }, children: entry.id === 'classic-development' ? t('seriesDevelopment') : t('seriesWorkModes') }, entry.id))) : null, source !== 'builtin' ? [...(props.categories ?? [])].sort((left, right) => left.order - right.order).map(entry => (_jsx("button", { type: "button", className: `${css.chip} ${category === entry.id ? css.chipActive : ''}`, onClick: () => { setCategory(category === entry.id ? '' : entry.id); setSeries('all'); }, children: entry.name }, entry.id))) : null, source === 'custom' && (props.categories ?? []).length === 0
44
- ? _jsx("span", { className: css.filterLabel, children: t('filterNoCategory') })
45
- : null] }), _jsxs("p", { className: css.hint, children: [t('listMatched'), " ", visible.length, " \u00B7 ", t('listNoInject')] }), props.teams.length === 0
44
+ : _jsx("p", { className: css.warn, role: "status", children: t(props.importError) }), _jsx("div", { className: css.listToolbar, children: _jsx("input", { className: css.listSearch, value: query, placeholder: t('listSearch'), onChange: (event) => { setQuery(event.target.value); } }) }), _jsxs("div", { className: css.filters, children: [_jsxs("div", { className: css.filterRow, children: [_jsx("span", { className: css.filterLabel, children: t('filterSource') }), _jsx("button", { type: "button", className: `${css.chip} ${source === 'all' ? css.chipActive : ''}`, onClick: () => { setSource('all'); }, children: t('listAll') }), _jsx("button", { type: "button", className: `${css.chip} ${source === 'builtin' ? css.chipActive : ''}`, onClick: () => { setSource('builtin'); setCategory(''); }, children: t('listBuiltin') }), _jsx("button", { type: "button", className: `${css.chip} ${source === 'custom' ? css.chipActive : ''}`, onClick: () => { setSource('custom'); setSeries('all'); }, children: t('listCustom') })] }), _jsxs("div", { className: css.filterRow, children: [_jsx("span", { className: css.filterLabel, children: t('filterCategory') }), _jsx("button", { type: "button", className: `${css.chip} ${series === 'all' && category === '' ? css.chipActive : ''}`, onClick: () => { setSeries('all'); setCategory(''); }, children: t('listAll') }), source !== 'custom' ? TEAM_SERIES.map(entry => (_jsx("button", { type: "button", className: `${css.chip} ${series === entry.id ? css.chipActive : ''}`, onClick: () => { setSeries(series === entry.id ? 'all' : entry.id); setCategory(''); }, children: entry.id === 'classic-development' ? t('seriesDevelopment') : t('seriesWorkModes') }, entry.id))) : null, source !== 'builtin' ? [...(props.categories ?? [])].sort((left, right) => left.order - right.order).map(entry => (_jsx("button", { type: "button", className: `${css.chip} ${category === entry.id ? css.chipActive : ''}`, onClick: () => { setCategory(category === entry.id ? '' : entry.id); setSeries('all'); }, children: entry.name }, entry.id))) : null, source === 'custom' && (props.categories ?? []).length === 0
45
+ ? _jsx("span", { className: css.filterLabel, children: t('filterNoCategory') })
46
+ : null] })] }), _jsxs("div", { className: css.resultsHead, children: [_jsx("span", { className: css.resultCount, children: t('listResultCount').replace('{count}', String(visible.length)) }), _jsx("span", { className: css.resultNote, children: t('listNoInject') })] }), props.teams.length === 0
46
47
  ? _jsx("p", { className: css.emptyPage, children: t('emptyTeams') })
47
- : (_jsxs("ul", { className: css.rows, children: [visible.length === 0 ? _jsx("li", { className: css.rowsEmpty, children: t('listNoMatch') }) : null, visible.map(team => (_jsxs("li", { className: css.card, "data-series": teamSeriesOf(team.id) ?? '', children: [_jsxs("button", { type: "button", className: css.rowMain, onClick: () => { props.onOpen(team.id); }, children: [_jsx("span", { className: css.dot, style: team.captain.color === '' ? undefined : { background: team.captain.color }, "aria-hidden": true }), _jsxs("span", { className: css.rowText, children: [_jsx("span", { className: css.rowName, children: team.name === '' ? team.id : team.name }), _jsx("span", { className: css.rowMeta, children: `${String(team.members.length)} ${t('memberCount')} · ${t('captainFollowsSession')}` })] })] }), _jsxs("span", { className: css.rowActions, children: [_jsx(Button, { size: "sm", variant: "ghost", onClick: () => { props.onExport(team.id); }, children: t('exportPreset') }), _jsx(Button, { size: "sm", variant: "ghost", disabled: disabled, onClick: () => { props.onDuplicate(team.id); }, children: t('duplicate') }), _jsx(Button, { size: "sm", variant: "ghost", disabled: disabled, onClick: () => { props.onDelete(team.id); }, children: t('remove') })] })] }, team.id)))] }))] }));
48
+ : (_jsxs("ul", { className: css.rows, children: [visible.length === 0 ? _jsx("li", { className: css.rowsEmpty, children: t('listNoMatch') }) : null, visible.map(team => (_jsxs("li", { className: css.card, "data-series": teamSeriesOf(team.id) ?? '', children: [_jsxs("button", { type: "button", className: css.rowMain, onClick: () => { props.onOpen(team.id); }, children: [_jsx("span", { className: css.dot, style: team.captain.color === '' ? undefined : { background: team.captain.color }, "aria-hidden": true }), _jsxs("span", { className: css.rowText, children: [_jsx("span", { className: css.rowName, children: team.name === '' ? team.id : team.name }), _jsx("span", { className: css.rowMeta, children: `${String(team.members.length)} ${t('memberCount')} · ${t('captainFollowsSession')}` })] })] }), _jsxs("span", { className: css.rowActions, children: [_jsx(Button, { size: "sm", variant: "ghost", title: t('importNote'), onClick: () => { props.onExport(team.id); }, children: t('exportPreset') }), _jsx(Button, { size: "sm", variant: "ghost", disabled: disabled, onClick: () => { props.onDuplicate(team.id); }, children: t('duplicate') }), _jsx(Button, { size: "sm", variant: "ghost", disabled: disabled, onClick: () => { props.onDelete(team.id); }, children: t('remove') })] })] }, team.id)))] }))] }));
48
49
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The conversation-header Team roster.
3
+ *
4
+ * Ported from the rc.1 official `agent-team` header action: same slot, same
5
+ * order, same icon/label/hover-popover behaviour and stylesheet. rc.2 folded
6
+ * Teams into the subagent tree and kept only the task board, so the roster rows
7
+ * are reconstructed from this plugin's member snapshots instead of the removed
8
+ * Team projection.
9
+ */
10
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
11
+ import type { TeamRosterInjected } from './team-presets-controller.ts';
12
+ /** Full props of the Team conversation-header action. */
13
+ export type TeamRosterActionProps = PropsRuntime<'conversation.session.header.actions'> & InjectFace<TeamRosterInjected> & PropsLocale<'settings.agentTeamPresets'>;
14
+ /** Render the summoned-member roster as the header's Team action. */
15
+ export declare function TeamRosterAction({ sessionId, openTeammate, roster, useProjection, t, }: TeamRosterActionProps): import("react").JSX.Element | null;