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
@@ -0,0 +1,205 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * The conversation-header Team roster.
4
+ *
5
+ * Ported from the rc.1 official `agent-team` header action: same slot, same
6
+ * order, same icon/label/hover-popover behaviour and stylesheet. rc.2 folded
7
+ * Teams into the subagent tree and kept only the task board, so the roster rows
8
+ * are reconstructed from this plugin's member snapshots instead of the removed
9
+ * Team projection.
10
+ */
11
+ import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
12
+ import { createPortal } from 'react-dom';
13
+ import { IconChevronDownOutlineRegular, IconUserOutlineRegular, IconUsersOutlineRegular, StateDot, Tag, Tooltip, useDismissOnOutsidePointer, } from '@deepseek-ai/dsh-client-ui-primitives';
14
+ import css from './TeamRosterAction.module.css';
15
+ /** How often the open, or merely present, roster re-reads the Host. */
16
+ const ROSTER_REFRESH_MS = 4000;
17
+ function memberStatusKey(status) {
18
+ return status === 'running' ? 'memberStatus.running' : 'memberStatus.inactive';
19
+ }
20
+ function statusKey(status) {
21
+ switch (status) {
22
+ case 'pending': return 'status.pending';
23
+ case 'in_progress': return 'status.in_progress';
24
+ case 'completed': return 'status.completed';
25
+ /* v8 ignore next -- deleted tombstones are filtered before rendering. */
26
+ case 'deleted': return 'status.completed';
27
+ }
28
+ }
29
+ function taskDotState(task) {
30
+ switch (task.status) {
31
+ case 'pending': return task.ready ? 'idle' : 'warning';
32
+ case 'in_progress': return 'ongoing';
33
+ case 'completed': return 'done';
34
+ /* v8 ignore next -- deleted tombstones are filtered before rendering. */
35
+ case 'deleted': return 'idle';
36
+ }
37
+ }
38
+ /** One shared task, with rc.1's two-line description clamp and meta row. */
39
+ function TaskCard({ task, t }) {
40
+ const [expanded, setExpanded] = useState(false);
41
+ const [clamped, setClamped] = useState(false);
42
+ const textRef = useRef(null);
43
+ useLayoutEffect(() => {
44
+ if (expanded)
45
+ return;
46
+ const paragraph = textRef.current;
47
+ /* v8 ignore next -- the paragraph mounts in the same commit as the effect. */
48
+ if (paragraph === null)
49
+ return;
50
+ const measure = () => { setClamped(paragraph.scrollHeight > paragraph.clientHeight + 1); };
51
+ measure();
52
+ if (typeof ResizeObserver === 'undefined')
53
+ return;
54
+ const observer = new ResizeObserver(measure);
55
+ observer.observe(paragraph);
56
+ return () => { observer.disconnect(); };
57
+ }, [task.description, expanded]);
58
+ return (_jsxs("article", { className: css.task, children: [_jsxs("div", { className: css.taskTitle, children: [_jsx("strong", { children: task.subject }), _jsxs("span", { className: css.taskState, children: [_jsx(StateDot, { state: taskDotState(task) }), _jsx("span", { children: t(statusKey(task.status)) })] })] }), _jsx("p", { ref: textRef, className: expanded ? undefined : css.clampedDescription, children: task.description }), _jsxs("div", { className: css.meta, children: [(clamped || expanded) && (_jsxs("button", { type: "button", className: css.expandToggle, "aria-expanded": expanded, onClick: () => { setExpanded(current => !current); }, children: [t(expanded ? 'task.collapse' : 'task.expand'), _jsx(IconChevronDownOutlineRegular, { size: 12, className: expanded ? css.expandToggleOpen : undefined })] })), _jsx("span", { children: task.id }), _jsxs("span", { children: [t('owner'), ": ", task.ownerName ?? t('unowned')] }), task.status === 'pending' && _jsx("span", { children: task.ready ? t('ready') : t('blocked') }), task.blockedBy.length > 0 && _jsxs("span", { children: [t('blockedBy'), ": ", task.blockedBy.join(', ')] }), task.writeScopes.length > 0 && _jsxs("span", { children: [t('writeScopes'), ": ", task.writeScopes.join(', ')] }), task.writeScopeWarnings.map(warning => _jsx("span", { className: css.warning, children: warning }, warning))] })] }));
59
+ }
60
+ function memberDotState(status) {
61
+ return status === 'running' ? 'ongoing' : 'idle';
62
+ }
63
+ function TeamMemberRow({ member, model, sessionId, openTeammate, onError, t }) {
64
+ const status = member.status === 'running' ? 'running' : 'inactive';
65
+ const isCurrent = member.role === 'captain' || member.childSessionId === sessionId;
66
+ const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: css.memberDot, children: status === 'inactive'
67
+ ? _jsx(IconUserOutlineRegular, { size: 14, className: css.inactiveIcon })
68
+ : _jsx(StateDot, { state: memberDotState(status) }) }), _jsxs("span", { className: css.memberText, children: [_jsxs("span", { className: css.memberName, children: [_jsx("span", { className: css.memberNameText, children: member.displayName }), isCurrent && _jsx(Tag, { tone: "info", className: css.currentTag, children: t('current') })] }), _jsxs("small", { children: [t(memberStatusKey(status)), model !== undefined && (_jsx("span", { className: css.memberModel, children: ` · ${t('model')}: ${model}` }))] })] })] }));
69
+ // The Lead row never navigates: back to the Team Lead is the official breadcrumb's
70
+ // job, and the row you are already reading has nowhere to go. Teammates switch.
71
+ if (isCurrent) {
72
+ return (_jsx(Tooltip, { label: member.description, side: "bottom", gap: 4, children: _jsx("div", { className: `${css.member} ${css.memberCurrent} ${css.memberStatic}`, children: content }) }));
73
+ }
74
+ return (_jsx(Tooltip, { label: t('open'), side: "bottom", gap: 4, children: _jsx("button", { type: "button", className: css.member, onClick: () => {
75
+ try {
76
+ openTeammate(sessionId, member.childSessionId);
77
+ }
78
+ catch (reason) {
79
+ onError(String(reason));
80
+ }
81
+ }, children: content }) }));
82
+ }
83
+ /** Render the summoned-member roster as the header's Team action. */
84
+ export function TeamRosterAction({ sessionId, openTeammate, roster, useProjection, t, }) {
85
+ const [open, setOpen] = useState(false);
86
+ const [members, setMembers] = useState([]);
87
+ const [error, setError] = useState(null);
88
+ const rootRef = useRef(null);
89
+ const triggerRef = useRef(null);
90
+ const triggerLabelRef = useRef(null);
91
+ const panelRef = useRef(null);
92
+ // rc.2 replaced JS anchored positioning with CSS anchor positioning; the panel
93
+ // names the same anchor the trigger declares, so the popover follows the header
94
+ // control on resize and scroll without measuring.
95
+ const id = useId();
96
+ const anchorStyle = { '--dsh-team-roster-anchor': `--dsh-team-${id.replaceAll(':', '')}` };
97
+ const hoverTimer = useRef(undefined);
98
+ const pinnedRef = useRef(false);
99
+ // The Team Lead carries this Session, so a Session with no roster yet still
100
+ // renders the action once its Team is selected: the Host reports the Lead row.
101
+ const readRoster = roster;
102
+ useEffect(() => {
103
+ let live = true;
104
+ const read = () => {
105
+ void readRoster(String(sessionId)).then((answer) => {
106
+ if (!live)
107
+ return;
108
+ setMembers(answer.members);
109
+ }, (reason) => {
110
+ if (!live)
111
+ return;
112
+ setError(reason instanceof Error ? reason.message : String(reason));
113
+ });
114
+ };
115
+ read();
116
+ const timer = setInterval(read, ROSTER_REFRESH_MS);
117
+ return () => { live = false; clearInterval(timer); };
118
+ }, [readRoster, sessionId]);
119
+ const cancelHoverChange = () => {
120
+ clearTimeout(hoverTimer.current);
121
+ hoverTimer.current = undefined;
122
+ };
123
+ useEffect(() => {
124
+ cancelHoverChange();
125
+ pinnedRef.current = false;
126
+ setOpen(false);
127
+ setError(null);
128
+ }, [sessionId]);
129
+ useEffect(() => cancelHoverChange, []);
130
+ useLayoutEffect(() => {
131
+ if (open && pinnedRef.current)
132
+ panelRef.current?.focus();
133
+ }, [open]);
134
+ const changeOpen = (next) => {
135
+ cancelHoverChange();
136
+ if (!next)
137
+ pinnedRef.current = false;
138
+ setOpen(next);
139
+ };
140
+ const scheduleHoverOpen = () => {
141
+ cancelHoverChange();
142
+ if (open)
143
+ return;
144
+ const label = triggerLabelRef.current;
145
+ if (label === null)
146
+ return;
147
+ // Icon-only trigger (label collapsed): hover-open would surprise, so only a
148
+ // click opens it.
149
+ if (getComputedStyle(label).display === 'none')
150
+ return;
151
+ hoverTimer.current = setTimeout(() => {
152
+ hoverTimer.current = undefined;
153
+ changeOpen(true);
154
+ }, 150);
155
+ };
156
+ const scheduleHoverClose = () => {
157
+ cancelHoverChange();
158
+ if (pinnedRef.current)
159
+ return;
160
+ hoverTimer.current = setTimeout(() => {
161
+ hoverTimer.current = undefined;
162
+ changeOpen(false);
163
+ }, 120);
164
+ };
165
+ useDismissOnOutsidePointer(rootRef, open, changeOpen, panelRef);
166
+ useEffect(() => {
167
+ if (!open)
168
+ return;
169
+ const dismiss = (event) => {
170
+ if (event.key !== 'Escape')
171
+ return;
172
+ event.preventDefault();
173
+ cancelHoverChange();
174
+ pinnedRef.current = false;
175
+ setOpen(false);
176
+ if (panelRef.current?.contains(document.activeElement))
177
+ triggerRef.current?.focus();
178
+ };
179
+ document.addEventListener('keydown', dismiss);
180
+ return () => { document.removeEventListener('keydown', dismiss); };
181
+ }, [open]);
182
+ // Gated on the deployment's own Team switch for this Session: the roster belongs
183
+ // to the Team that runs here, and a member Session has none of its own.
184
+ const team = useProjection('agentTeam');
185
+ if (team !== undefined && team.enabled !== true)
186
+ return null;
187
+ // Progressive disclosure: a Session whose Team was never selected shows no
188
+ // control at all.
189
+ if (members.length === 0)
190
+ return null;
191
+ // rc.1 listed the Team's shared tasks under its members; the official board shows
192
+ // only when tasks exist, so this section is what a quiet board still reads as.
193
+ const tasks = (team?.tasks ?? []).filter(task => task.status !== 'deleted');
194
+ const compact = members.length === 1 && tasks.length === 0;
195
+ return (_jsxs("div", { ref: rootRef, className: css.root, style: anchorStyle, "data-team-action": true, onMouseLeave: scheduleHoverClose, children: [_jsxs("button", { type: "button", ref: triggerRef, onMouseEnter: scheduleHoverOpen, className: css.trigger, "aria-label": t('trigger'), "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => {
196
+ cancelHoverChange();
197
+ pinnedRef.current = true;
198
+ if (!open)
199
+ changeOpen(true);
200
+ else
201
+ panelRef.current?.focus();
202
+ }, children: [_jsx(IconUsersOutlineRegular, { size: 14 }), _jsx("span", { ref: triggerLabelRef, className: css.triggerLabel, children: t('trigger') })] }), open && createPortal(_jsx("div", { ref: panelRef, className: compact ? `${css.panel} ${css.panelCompact}` : css.panel, style: anchorStyle, role: "dialog", tabIndex: -1, "aria-label": t('trigger'), "data-team-panel": true, onMouseEnter: cancelHoverChange, onMouseLeave: scheduleHoverClose, children: _jsxs("div", { className: css.body, children: [error !== null && (_jsxs("div", { className: css.error, role: "alert", children: [_jsx(StateDot, { state: "error" }), error] })), _jsxs("section", { children: [_jsxs("h3", { children: [t('roster'), members.length > 1 && _jsx("span", { className: css.count, children: members.length })] }), _jsx("div", { className: css.roster, children: members.map(member => (_jsx(TeamMemberRow, { member: member, model: member.model ?? member.route?.model, sessionId: sessionId, openTeammate: openTeammate, onError: setError, t: t }, member.name))) })] }), _jsx("section", { children: tasks.length === 0
203
+ ? _jsx("p", { className: css.emptyNotice, children: t('empty') })
204
+ : (_jsxs(_Fragment, { children: [_jsxs("h3", { children: [t('tasks'), _jsx("span", { className: css.count, children: tasks.length })] }), _jsx("div", { className: css.tasks, children: tasks.map(task => _jsx(TaskCard, { task: task, t: t }, task.id)) })] })) })] }) }), document.body)] }));
205
+ }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import teamPresetsRemote from 'dsh-agent-team-presets/remote';
6
6
  import { ComposerTeamSelect } from "./ComposerTeamSelect.js";
7
+ import { TeamRosterAction } from "./TeamRosterAction.js";
7
8
  import { teamAppearance } from "./appearance.js";
8
9
  import { TeamPresetsSection } from "./TeamPresetsSection.js";
9
10
  import { TeamPresetsController, TEAM_PRESETS_NS } from "./team-presets-controller.js";
@@ -23,7 +24,7 @@ export { TEAM_PRESETS_NS };
23
24
  * `cannot get property "remote.settings" without inject`, which is exactly the
24
25
  * failure mode this plugin's own scope must never reproduce.
25
26
  */
26
- export const inject = ['slots', 'locale', 'configForms', 'remote', 'remote.session', 'remote.settings'];
27
+ export const inject = ['slots', 'locale', 'configForms', 'remote', 'remote.session', 'remote.settings', 'sessions', 'uiWorkspace'];
27
28
  /**
28
29
  * Host notifications that change which provider routes exist.
29
30
  *
@@ -66,7 +67,7 @@ async function applyUi(ctx) {
66
67
  // injected UI scope: a scope created for a fixed dependency set may not spawn a
67
68
  // further injection, and failing that way takes the whole browser entry down.
68
69
  const skills = new TeamSkillsController(ctx);
69
- const ui = ctx.inject(['remote.teamPresets', 'slots', 'locale', 'configForms', 'remote.session', 'remote.settings'], scope => registerUi(scope, skills));
70
+ const ui = ctx.inject(['remote.teamPresets', 'slots', 'locale', 'configForms', 'remote.session', 'remote.settings', 'sessions', 'uiWorkspace'], scope => registerUi(scope, skills));
70
71
  try {
71
72
  await ui;
72
73
  }
@@ -83,6 +84,20 @@ async function applyUi(ctx) {
83
84
  * disagree about the settings document.
84
85
  * @param ctx - the browser plugin context, with the Team Remote mounted.
85
86
  */
87
+ /**
88
+ * Open one member's conversation from the roster, the way the rc.1 header action
89
+ * did: resolve the Team Lead Session, then route to that member's child Session.
90
+ * @param ctx - the injected browser scope.
91
+ * @param sessionId - the Session the roster was opened from.
92
+ * @param childSessionId - the member Session to open.
93
+ */
94
+ function openTeammateOf(ctx) {
95
+ return (sessionId, childSessionId) => {
96
+ const address = ctx.sessions.binding(sessionId)?.session.getSnapshot().subagent?.address;
97
+ const parentSessionId = address?.parentSessionId ?? sessionId;
98
+ ctx.uiWorkspace.openSession({ parentSessionId, childSessionId, mode: 'continuable' });
99
+ };
100
+ }
86
101
  function registerUi(ctx, skills) {
87
102
  const t = ctx.locale.bind(NS);
88
103
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'agent-team-presets: dictionaries');
@@ -118,6 +133,22 @@ function registerUi(ctx, skills) {
118
133
  return teamAppearance(state.teams, state.selections, sessionId);
119
134
  }), 'agent-team-presets: roster appearance');
120
135
  });
136
+ // Same place the rc.1 official Team action occupied: the header actions strip,
137
+ // ahead of the other action buttons, with its icon and roster popover. Only the
138
+ // data source differs — rc.2 removed the Team projection it used to read.
139
+ const openTeammate = openTeammateOf(ctx);
140
+ ctx.effect(() => ctx.slots.inject('conversation.session.header.actions', () => ctx.slots.register({
141
+ name: 'conversation.session.header.actions',
142
+ id: 'agent-team',
143
+ order: -20,
144
+ locale: NS,
145
+ inject: () => ({
146
+ roster: (sessionId) => controller.readRoster(sessionId),
147
+ openTeammate: (sessionId, childSessionId) => {
148
+ openTeammate(sessionId, childSessionId);
149
+ },
150
+ }),
151
+ }, TeamRosterAction)), 'agent-team-presets: header roster');
121
152
  ctx.effect(() => ctx.slots.inject('conversation.input.left', () => ctx.slots.register({
122
153
  name: 'conversation.input.left',
123
154
  id: 'agent-team-presets',
@@ -3,7 +3,7 @@ import type { TeamPresetImportFailure } from '../preset-transfer.ts';
3
3
  import type { TeamExecutionState } from '../types.ts';
4
4
  import type { DefaultsRestore, TeamPresetsFormIssue, TeamSelectionFailure } from './team-presets-controller.ts';
5
5
  /** Locale keys this plugin renders. */
6
- export type TeamPresetsLocaleKey = 'nav' | 'title' | 'description' | 'newTeam' | 'duplicate' | 'remove' | 'removeMember' | 'teamList' | 'emptyTeams' | 'emptySelection' | 'memberCount' | 'teamName' | 'teamNamePlaceholder' | 'teamDescription' | 'captain' | 'captainHint' | 'members' | 'addMember' | 'membersHint' | 'agentName' | 'agentNamePlaceholder' | 'agentColor' | 'agentDescription' | 'route' | 'routeInherit' | 'provider' | 'model' | 'effort' | 'effortDefault' | 'captainModelHint' | 'captainFollowsSession' | 'modelsPartial' | 'modelsFailed' | 'tools' | 'toolsHint' | 'toolMode' | 'toolsDefault' | 'toolsCustom' | 'toolsAllHint' | 'toolsEmpty' | 'toolsScoped' | 'toolsSelectAll' | 'toolsClear' | 'toolsRemove' | 'toolsUnavailable' | 'toolsLoading' | 'toolsFailed' | 'toolsNoCatalog' | 'toolsCaptainOnly' | 'toolsGroupPresets' | 'toolsGroupMcp' | 'toolsGroupOther' | 'toolsInvert' | 'composerMissing' | 'composerMissingHint' | 'systemPrompt' | 'systemPromptPlaceholder' | 'systemPromptHint' | 'promptWarnBraces' | 'save' | 'saving' | 'saveFailed' | 'discard' | 'unsaved' | 'readOnly' | 'unavailable' | 'sectionLoading' | 'formIssueSettingsUnavailable' | 'formIssueNamespaceMissing' | 'formIssueSchemaRejected' | 'selectionUnavailable' | 'selectionRefused' | 'selectionFailed' | 'teamNameRequired' | 'externalUpdateOne' | 'externalUpdateMany' | 'externalUpdateOverriddenOne' | 'externalUpdateOverriddenMany' | 'executionBusy' | 'executionBusyShared' | 'executionIdle' | 'executionUnknown' | 'executionPtcOverridden' | 'externalAddedOne' | 'externalAddedMany' | 'externalRemovedOne' | 'externalRemovedMany' | 'externalRemovedEditedOne' | 'externalRemovedEditedMany' | 'back' | 'backToList' | 'editCaptain' | 'editMember' | 'teamSections' | 'agentSections' | 'modelSection' | 'promptSection' | 'toolsSection' | 'identitySection' | 'emptyMembers' | 'inheritSession' | 'deleteAgent' | 'roleCaptain' | 'roleMember' | 'composerTitle' | 'composerNone' | 'composerHint' | 'importPreset' | 'exportPreset' | 'importNote' | 'importConfirm' | 'cancel' | 'close' | 'restoreDefaults' | 'restoreDefaultsHint' | 'defaultsRestored' | 'defaultsUnchanged' | 'importConflictTitle' | 'importTeamConflict' | 'importTeamReplace' | 'importTeamRename' | 'importNewTeamName' | 'importCaptainConflict' | 'importCaptainReplace' | 'importCaptainRename' | 'importMemberConflict' | 'importMemberReplace' | 'importMemberRename' | 'importInvalidJson' | 'importInvalidFormat' | 'importUnsupportedVersion' | 'importUnsupportedFields' | 'importDuplicateMembers' | 'importTooManyMembers' | 'importTooLarge' | 'importInvalidMetadata' | 'skillsEmpty' | 'skillsImport' | 'skillsNew' | 'skillsSave' | 'skillsDelete' | 'skillsAssign' | 'skillsUnassign' | 'skillsBuiltinList' | 'skillsFiles' | 'skillsBindings' | 'skillsNamePlaceholder' | 'skillsDescriptionPlaceholder' | 'skillsRoot' | 'skillsRefresh' | 'skillsScan' | 'skillsScanHint' | 'skillsScanSummary' | 'skillsScanEmpty' | 'skillsScanImported' | 'skillsScanExisting' | 'skillsScanInvalid' | 'skillsScanMissingSkill' | 'skillsScanInvalidFrontmatter' | 'skillsScanInvalidName' | 'skillsScanMissingDescription' | 'skillsScanTooLarge' | 'skillsScanSymlink' | 'skillsScanNotDirectory' | 'skillsScanUnreadable' | 'skillsScanDuplicate' | 'skillsScanInstallRefused' | 'skillsOpenScanFolder' | 'skillsCopyScanFolder' | 'skillsScanFolderOpened' | 'skillsScanFolderCopied' | 'skillsScanFolderCopyFailed' | 'skillsOverride' | 'skillsReset' | 'skillsBody' | 'tabTeams' | 'tabSkills' | 'skillsHint' | 'skillsAssignTitle' | 'skillsAssignHint' | 'skillsAssignEmpty' | 'skillsNameClash' | 'skillsNameClashBody' | 'skillsBlockedAssign' | 'skillsMcpUnverified' | 'skillsDeclared' | 'skillsFound' | 'skillsMissing' | 'categoryRename' | 'categoryUp' | 'categoryDown' | 'categoryManagePage' | 'categoryTitle' | 'categorySub' | 'categoryTeams' | 'categorySave' | 'categoryRemove' | 'categoryNote' | 'categoryManage' | 'categoryFold' | 'categoryName' | 'categoryAdd' | 'categoryEmpty' | 'categoryOf' | 'categoryNone' | 'metadataTitle' | 'metadataOnlyDisplay' | 'metadataNote' | 'metadataFold' | 'metadataUnfold' | 'metadataSummary' | 'metadataTags' | 'metadataTagsHint' | 'metadataUseCases' | 'metadataQuickPrompts' | 'metadataNotes' | 'filterSource' | 'filterCategory' | 'filterNoCategory' | 'listSearch' | 'listAll' | 'listBuiltin' | 'listCustom' | 'seriesDevelopment' | 'seriesWorkModes' | 'listMatched' | 'listNoInject' | 'listNoMatch' | 'composeTitle' | 'composeClose' | 'composeSearch' | 'composeAll' | 'composeFilterCategory' | 'composeCategoryAll' | 'composeUncategorized' | 'composeNoneSub' | 'composeSeriesDev' | 'composeSeriesModes' | 'composeEmpty' | 'composePanelTitle' | 'composePanelCaptain' | 'composePanelMembers' | 'composePanelSessionModel' | 'composePanelCaptainHint' | 'composePanelSoloHint' | 'composePanelEmptyMembers' | 'composePanelNoId' | 'composerMissingMember' | 'originBuiltin' | 'originCustom' | 'originOverride' | 'skillsTitle' | 'skillsSub' | 'skillsNote' | 'skillsOpenFolder' | 'skillsOpenAssetFolder' | 'skillsSearch' | 'skillsAll' | 'skillsBuiltin' | 'skillsCustom' | 'skillsBound' | 'skillsResources' | 'skillsSaveFile' | 'skillsEditable' | 'skillsReadonly' | 'skillsMakeCopy' | 'skillsResetCopy' | 'skillsNoBinding' | 'skillsUnbind' | 'skillsDeps' | 'skillsNoDeps' | 'skillsDeleteTitle' | 'skillsDeleteBody' | 'skillsDeleteBlocked' | 'skillsDeleteBoundWarning' | 'skillsDeleteBuiltinWarning' | 'skillsCancel' | 'skillsConfirm' | 'skillsName' | 'skillsDesc' | 'skillsNewTitle' | 'skillsVersion' | 'skillsOverrideOn';
6
+ export type TeamPresetsLocaleKey = 'nav' | 'title' | 'description' | 'newTeam' | 'duplicate' | 'remove' | 'removeMember' | 'teamList' | 'emptyTeams' | 'emptySelection' | 'memberCount' | 'teamName' | 'teamNamePlaceholder' | 'teamDescription' | 'captain' | 'captainHint' | 'members' | 'addMember' | 'membersHint' | 'agentName' | 'agentNamePlaceholder' | 'agentColor' | 'agentDescription' | 'route' | 'routeInherit' | 'provider' | 'model' | 'effort' | 'effortDefault' | 'captainModelHint' | 'captainFollowsSession' | 'modelsPartial' | 'modelsFailed' | 'tools' | 'toolsHint' | 'toolMode' | 'toolsDefault' | 'toolsCustom' | 'toolsAllHint' | 'toolsEmpty' | 'toolsScoped' | 'toolsSelectAll' | 'toolsClear' | 'toolsRemove' | 'toolsUnavailable' | 'toolsLoading' | 'toolsFailed' | 'toolsNoCatalog' | 'toolsCaptainOnly' | 'toolsGroupPresets' | 'toolsGroupMcp' | 'toolsGroupOther' | 'toolsInvert' | 'composerMissing' | 'composerMissingHint' | 'systemPrompt' | 'systemPromptPlaceholder' | 'systemPromptHint' | 'promptWarnBraces' | 'save' | 'saving' | 'saveFailed' | 'discard' | 'unsaved' | 'readOnly' | 'unavailable' | 'sectionLoading' | 'formIssueSettingsUnavailable' | 'formIssueNamespaceMissing' | 'formIssueSchemaRejected' | 'selectionUnavailable' | 'selectionRefused' | 'selectionFailed' | 'teamNameRequired' | 'externalUpdateOne' | 'externalUpdateMany' | 'externalUpdateOverriddenOne' | 'externalUpdateOverriddenMany' | 'executionBusy' | 'executionBusyShared' | 'executionIdle' | 'executionUnknown' | 'executionPtcOverridden' | 'externalAddedOne' | 'externalAddedMany' | 'externalRemovedOne' | 'externalRemovedMany' | 'externalRemovedEditedOne' | 'externalRemovedEditedMany' | 'back' | 'backToList' | 'editCaptain' | 'editMember' | 'teamSections' | 'agentSections' | 'modelSection' | 'promptSection' | 'toolsSection' | 'identitySection' | 'emptyMembers' | 'inheritSession' | 'deleteAgent' | 'roleCaptain' | 'roleMember' | 'composerTitle' | 'composerNone' | 'composerHint' | 'trigger' | 'loading' | 'unavailable' | 'roster' | 'model' | 'open' | 'current' | 'memberStatus.running' | 'memberStatus.inactive' | 'tasks' | 'empty' | 'owner' | 'unowned' | 'blockedBy' | 'writeScopes' | 'ready' | 'blocked' | 'task.expand' | 'task.collapse' | 'status.pending' | 'status.in_progress' | 'status.completed' | 'importPreset' | 'exportPreset' | 'importNote' | 'importConfirm' | 'cancel' | 'close' | 'restoreDefaults' | 'restoreDefaultsHint' | 'defaultsRestored' | 'defaultsUnchanged' | 'importConflictTitle' | 'importTeamConflict' | 'importTeamReplace' | 'importTeamRename' | 'importNewTeamName' | 'importCaptainConflict' | 'importCaptainReplace' | 'importCaptainRename' | 'importMemberConflict' | 'importMemberReplace' | 'importMemberRename' | 'importInvalidJson' | 'importInvalidFormat' | 'importUnsupportedVersion' | 'importUnsupportedFields' | 'importDuplicateMembers' | 'importTooManyMembers' | 'importTooLarge' | 'importInvalidMetadata' | 'skillsEmpty' | 'skillsImport' | 'skillsNew' | 'skillsSave' | 'skillsDelete' | 'skillsAssign' | 'skillsUnassign' | 'skillsBuiltinList' | 'skillsFiles' | 'skillsBindings' | 'skillsNamePlaceholder' | 'skillsDescriptionPlaceholder' | 'skillsRoot' | 'skillsRefresh' | 'skillsScan' | 'skillsScanHint' | 'skillsScanSummary' | 'skillsScanEmpty' | 'skillsScanImported' | 'skillsScanExisting' | 'skillsScanInvalid' | 'skillsScanMissingSkill' | 'skillsScanInvalidFrontmatter' | 'skillsScanInvalidName' | 'skillsScanMissingDescription' | 'skillsScanTooLarge' | 'skillsScanSymlink' | 'skillsScanNotDirectory' | 'skillsScanUnreadable' | 'skillsScanDuplicate' | 'skillsScanInstallRefused' | 'skillsOpenScanFolder' | 'skillsCopyScanFolder' | 'skillsScanFolderOpened' | 'skillsScanFolderCopied' | 'skillsScanFolderCopyFailed' | 'skillsOverride' | 'skillsReset' | 'skillsBody' | 'tabTeams' | 'tabSkills' | 'skillsHint' | 'skillsAssignTitle' | 'skillsAssignHint' | 'skillsAssignEmpty' | 'skillsNameClash' | 'skillsNameClashBody' | 'skillsBlockedAssign' | 'skillsMcpUnverified' | 'skillsDeclared' | 'skillsFound' | 'skillsMissing' | 'categoryRename' | 'categoryUp' | 'categoryDown' | 'categoryManagePage' | 'categoryTitle' | 'categorySub' | 'categoryTeams' | 'categorySave' | 'categoryRemove' | 'categoryNote' | 'categoryManage' | 'categoryFold' | 'categoryName' | 'categoryAdd' | 'categoryEmpty' | 'categoryOf' | 'categoryNone' | 'metadataTitle' | 'metadataOnlyDisplay' | 'metadataNote' | 'metadataFold' | 'metadataUnfold' | 'metadataSummary' | 'metadataTags' | 'metadataTagsHint' | 'metadataUseCases' | 'metadataQuickPrompts' | 'metadataNotes' | 'filterSource' | 'filterCategory' | 'filterNoCategory' | 'listSearch' | 'listAll' | 'listBuiltin' | 'listCustom' | 'seriesDevelopment' | 'seriesWorkModes' | 'listMatched' | 'listNoInject' | 'listNoMatch' | 'listResultCount' | 'restoreConfirmTitle' | 'restoreConfirmBody' | 'restoreConfirmAction' | 'composeTitle' | 'composeClose' | 'composeSearch' | 'composeAll' | 'composeFilterCategory' | 'composeCategoryAll' | 'composeUncategorized' | 'composeNoneSub' | 'composeSeriesDev' | 'composeSeriesModes' | 'composeEmpty' | 'composePanelTitle' | 'composePanelCaptain' | 'composePanelMembers' | 'composePanelSessionModel' | 'composePanelCaptainHint' | 'composePanelSoloHint' | 'composePanelEmptyMembers' | 'composePanelNoId' | 'composerMissingMember' | 'originBuiltin' | 'originCustom' | 'originOverride' | 'skillsTitle' | 'skillsSub' | 'skillsNote' | 'skillsOpenFolder' | 'skillsOpenAssetFolder' | 'skillsSearch' | 'skillsAll' | 'skillsBuiltin' | 'skillsCustom' | 'skillsBound' | 'skillsResources' | 'skillsSaveFile' | 'skillsEditable' | 'skillsReadonly' | 'skillsMakeCopy' | 'skillsResetCopy' | 'skillsNoBinding' | 'skillsUnbind' | 'skillsDeps' | 'skillsNoDeps' | 'skillsDeleteTitle' | 'skillsDeleteBody' | 'skillsDeleteBlocked' | 'skillsDeleteBoundWarning' | 'skillsDeleteBuiltinWarning' | 'skillsCancel' | 'skillsConfirm' | 'skillsName' | 'skillsDesc' | 'skillsNewTitle' | 'skillsVersion' | 'skillsOverrideOn';
7
7
  /** Locale namespace owned by this plugin. */
8
8
  export declare const NS = "settings.agentTeamPresets";
9
9
  /** English copy. */
@@ -5,7 +5,7 @@ export const NS = 'settings.agentTeamPresets';
5
5
  export const en = {
6
6
  nav: 'Agent team presets',
7
7
  title: 'Agent team presets',
8
- description: 'Reusable Teams of named agents. Select a Team in the composer and its captain leads the session on the model you already picked, summoning members with their own prompt, model, reasoning effort, and tools.',
8
+ description: 'Manage reusable named agent teams. Pick a team in the conversation and its captain takes over the session on the model you already chose, summoning members by name; each member runs with its own prompt, model, reasoning effort, and tools.',
9
9
  newTeam: 'New team',
10
10
  duplicate: 'Duplicate',
11
11
  remove: 'Delete team',
@@ -29,7 +29,6 @@ export const en = {
29
29
  route: 'Model',
30
30
  routeInherit: 'Follow the session',
31
31
  provider: 'Provider',
32
- model: 'Model',
33
32
  effort: 'Reasoning effort',
34
33
  effortDefault: 'Model default',
35
34
  captainModelHint: 'The captain leads on the model this session already selected. Pick that model in the composer; a Team never changes it.',
@@ -105,15 +104,36 @@ export const en = {
105
104
  selectionUnavailable: 'No Team selection could be written: the Team settings section is not available in this page.',
106
105
  selectionRefused: 'The Host refused the Team selection write.',
107
106
  selectionFailed: 'The Team selection write did not complete.',
107
+ trigger: 'Agent team',
108
+ loading: 'Loading team…',
109
+ roster: 'Members',
110
+ 'tasks': 'Shared tasks',
111
+ 'empty': 'No shared tasks yet. Create them through the conversation.',
112
+ 'owner': 'Owner',
113
+ 'unowned': 'Unowned',
114
+ 'blockedBy': 'Blocked by',
115
+ 'writeScopes': 'Write scopes',
116
+ 'ready': 'Ready',
117
+ 'blocked': 'Blocked by dependencies',
118
+ 'task.expand': 'Show more',
119
+ 'task.collapse': 'Show less',
120
+ 'status.pending': 'Pending',
121
+ 'status.in_progress': 'In progress',
122
+ 'status.completed': 'Completed',
123
+ model: 'Model',
124
+ open: 'Open member conversation',
125
+ current: 'Current chat',
126
+ 'memberStatus.running': 'Running',
127
+ 'memberStatus.inactive': 'Inactive',
108
128
  composerTitle: 'Team',
109
- composerNone: 'No team',
129
+ composerNone: 'No preset',
110
130
  composerHint: 'Apply one Team preset to this session.',
111
131
  composerMissing: 'Missing Team: {team}',
112
132
  composerMissingHint: 'This is not No team. An unapplicable selection denies tools; a running task keeps its old policy until idle. Choose a valid Team or No team.',
113
133
  importPreset: 'Import preset',
114
134
  exportPreset: 'Export',
115
135
  importNote: 'A shared document carries names, descriptions, system prompts, and colors. Model routes and tool permissions stay local.',
116
- restoreDefaults: 'Restore defaults',
136
+ restoreDefaults: 'Restore built-in presets',
117
137
  restoreDefaultsHint: 'Puts every preset this plugin ships back to its shipped name, description, prompts, colors, and roster. The model routes and tool permissions you configured stay as they are, and teams you created yourself are not touched.',
118
138
  defaultsRestored: 'Default presets restored in this draft. Save to apply them.',
119
139
  defaultsUnchanged: 'The default presets already match what this plugin ships; nothing was staged.',
@@ -254,13 +274,17 @@ export const en = {
254
274
  metadataNotes: 'Notes',
255
275
  filterSource: 'Team source',
256
276
  filterNoCategory: 'No custom category yet — add one under 管理团队预设分类',
257
- filterCategory: 'Category',
277
+ filterCategory: 'Team category',
258
278
  listSearch: 'Search name, summary, tags, use cases, suggested tasks',
259
279
  listAll: 'All',
260
280
  listBuiltin: 'Built-in',
261
281
  listCustom: 'Custom',
262
282
  seriesDevelopment: 'Development scale',
263
283
  seriesWorkModes: 'Work modes',
284
+ listResultCount: 'Found {count} presets',
285
+ restoreConfirmTitle: 'Restore built-in team presets?',
286
+ restoreConfirmBody: 'The presets this plugin ships go back to their initial name, description, system prompt, colors, and member roster. Model routes and tool permissions you configured for them are kept, and teams you created yourself are not touched.',
287
+ restoreConfirmAction: 'Restore built-in presets',
264
288
  listMatched: 'Matched',
265
289
  listNoInject: 'display metadata is never injected into runtime context',
266
290
  listNoMatch: 'No team matches this filter',
@@ -270,7 +294,7 @@ export const en = {
270
294
  composeFilterCategory: 'Category',
271
295
  composeCategoryAll: 'All categories',
272
296
  composeUncategorized: 'Uncategorized',
273
- composeNoneSub: 'The session runs without a team',
297
+ composeNoneSub: 'This session loads no preset',
274
298
  composeSeriesDev: 'Built-in · development',
275
299
  composeSeriesModes: 'Built-in · work modes',
276
300
  composeEmpty: 'No team matches',
@@ -291,7 +315,7 @@ export const en = {
291
315
  export const zh = {
292
316
  nav: '智能体团队预设',
293
317
  title: '智能体团队预设',
294
- description: '可复用的命名智能体团队。在对话框选中一个团队后,队长以你当前已选的模型接管本会话,并按名字召唤队员;每个队员使用自己配置的提示词、模型、思考强度和工具。',
318
+ description: '管理可复用的命名智能体团队。在对话中选择团队后,队长使用当前选定的模型接管会话,并按名称召唤队员;每位队员使用各自配置的提示词、模型、思考强度和工具。',
295
319
  newTeam: '新建团队',
296
320
  duplicate: '复制',
297
321
  remove: '删除团队',
@@ -315,7 +339,6 @@ export const zh = {
315
339
  route: '模型',
316
340
  routeInherit: '跟随会话',
317
341
  provider: '提供商',
318
- model: '模型',
319
342
  effort: '思考强度',
320
343
  effortDefault: '模型默认',
321
344
  captainModelHint: '队长使用本会话当前已选的模型。请在对话框里选择该模型;团队不会改动它。',
@@ -391,15 +414,36 @@ export const zh = {
391
414
  selectionUnavailable: '无法写入团队选择:当前页面没有可用的团队设置分区。',
392
415
  selectionRefused: '宿主拒绝了团队选择写入。',
393
416
  selectionFailed: '团队选择写入未完成。',
417
+ trigger: '智能体团队',
418
+ loading: '正在加载团队…',
419
+ roster: '成员',
420
+ 'tasks': '共享任务',
421
+ 'empty': '暂无共享任务,可以通过对话创建',
422
+ 'owner': 'Owner',
423
+ 'unowned': '未分配',
424
+ 'blockedBy': '依赖',
425
+ 'writeScopes': '写入范围',
426
+ 'ready': '可开始',
427
+ 'blocked': '被依赖阻塞',
428
+ 'task.expand': '展开',
429
+ 'task.collapse': '收起',
430
+ 'status.pending': '待处理',
431
+ 'status.in_progress': '进行中',
432
+ 'status.completed': '已完成',
433
+ model: '模型',
434
+ open: '打开成员会话',
435
+ current: '当前会话',
436
+ 'memberStatus.running': '运行中',
437
+ 'memberStatus.inactive': '未运行',
394
438
  composerTitle: '团队',
395
- composerNone: '不使用团队',
439
+ composerNone: '不加载预设',
396
440
  composerHint: '为本会话启用一个团队预设。',
397
441
  composerMissing: '团队已失效:{team}',
398
442
  composerMissingHint: '这不是“不使用团队”。无法应用时权限保持拒绝;进行中的任务保留旧策略直到空闲。请改选有效团队或“不使用团队”。',
399
443
  importPreset: '导入预设',
400
444
  exportPreset: '导出',
401
445
  importNote: '共享文档只携带名称、描述、系统提示词和颜色;模型路由与工具权限保留在本地。',
402
- restoreDefaults: '恢复默认预设',
446
+ restoreDefaults: '恢复内置预设',
403
447
  restoreDefaultsHint: '把插件自带的预设全部恢复到出厂的名称、说明、提示词、颜色和成员名单;你为它们配置的模型路由与工具权限保持不变,你自己创建的团队完全不受影响。',
404
448
  defaultsRestored: '默认预设已恢复到草稿,保存后生效。',
405
449
  defaultsUnchanged: '默认预设与插件出厂状态一致,无需恢复。',
@@ -540,13 +584,17 @@ export const zh = {
540
584
  metadataNotes: '备注',
541
585
  filterSource: '团队来源',
542
586
  filterNoCategory: '还没有自定义分类,可在「管理团队预设分类」里创建',
543
- filterCategory: '分类',
587
+ filterCategory: '团队分类',
544
588
  listSearch: '搜索名称、简介、标签、适用场景、推荐任务',
545
589
  listAll: '全部',
546
590
  listBuiltin: '插件内置',
547
591
  listCustom: '自定义',
548
592
  seriesDevelopment: '研发规模',
549
593
  seriesWorkModes: '工作模式',
594
+ listResultCount: '找到 {count} 个预设',
595
+ restoreConfirmTitle: '恢复内置团队预设?',
596
+ restoreConfirmBody: '将插件自带的团队预设恢复为初始名称、说明、系统提示词、颜色和成员名单。你为这些预设配置的模型路由与工具权限会保留,自定义团队不受影响。',
597
+ restoreConfirmAction: '恢复内置预设',
550
598
  listMatched: '匹配',
551
599
  listNoInject: '展示信息不会注入运行时上下文',
552
600
  listNoMatch: '没有匹配的团队',
@@ -556,7 +604,7 @@ export const zh = {
556
604
  composeFilterCategory: '分类',
557
605
  composeCategoryAll: '全部分类',
558
606
  composeUncategorized: '未分类',
559
- composeNoneSub: '本会话不使用团队',
607
+ composeNoneSub: '本会话不加载预设',
560
608
  composeSeriesDev: '插件内置 · 研发规模',
561
609
  composeSeriesModes: '插件内置 · 工作模式',
562
610
  composeEmpty: '没有匹配的团队',
@@ -6,6 +6,8 @@ import type { Context } from '@deepseek-ai/cordis';
6
6
  import type { ModelCatalog } from '@deepseek-ai/dsh-api-remotes/client';
7
7
  import { type SnapshotStore } from '@deepseek-ai/dsh-client-store';
8
8
  import type { TeamPresetImportFailure, TeamPresetTransfer } from '../preset-transfer.ts';
9
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
10
+ import type { TeamRosterValue } from '../types.ts';
9
11
  import type { TeamAgentPreset, TeamCaptainPreset, TeamCategory, TeamCategoryAssignment, TeamExecutionRow, TeamExecutionState, TeamPreset, ToolChoice } from '../types.ts';
10
12
  /**
11
13
  * Loader entry id of the Host row that owns the Team preset namespace. Spelled
@@ -491,6 +493,15 @@ export declare class TeamPresetsController {
491
493
  */
492
494
  private readNamespace;
493
495
  private loadModelCatalogue;
496
+ /**
497
+ * Read the preset members one Session's Team has summoned.
498
+ *
499
+ * The header control hides itself while this answers nothing, so a refusal is
500
+ * reported as an empty roster rather than a control that cannot be trusted.
501
+ * @param sessionId - the Session root whose roster is read.
502
+ * @returns the summoned members, or none when the Host cannot answer.
503
+ */
504
+ readRoster(sessionId: string): Promise<TeamRosterValue>;
494
505
  private loadToolCatalogue;
495
506
  /**
496
507
  * Open the staged draft from the stored Teams.
@@ -724,6 +735,13 @@ export declare class TeamPresetsController {
724
735
  private failSelection;
725
736
  }
726
737
  /** Business face the page and composer registrations inject. */
738
+ /** Roster reader the header control receives. */
739
+ export interface TeamRosterInjected {
740
+ /** Reads the summoned members of one Session's Team, and whether that Team is on. */
741
+ roster: (sessionId: string) => Promise<TeamRosterValue>;
742
+ /** Opens one member's conversation from the roster. */
743
+ openTeammate: (sessionId: SessionId, childSessionId: SessionId) => void;
744
+ }
727
745
  export interface TeamPresetsInjected {
728
746
  /** Team Skill panel state, absent when this build ships no library service. */
729
747
  skills?: import('./team-skills-controller.ts').TeamSkillsController;
@@ -825,6 +825,21 @@ export class TeamPresetsController {
825
825
  this.publish();
826
826
  });
827
827
  }
828
+ /**
829
+ * Read the preset members one Session's Team has summoned.
830
+ *
831
+ * The header control hides itself while this answers nothing, so a refusal is
832
+ * reported as an empty roster rather than a control that cannot be trusted.
833
+ * @param sessionId - the Session root whose roster is read.
834
+ * @returns the summoned members, or none when the Host cannot answer.
835
+ */
836
+ async readRoster(sessionId) {
837
+ const read = this.readNamespace(() => this.ctx.remote.teamPresets.roster(sessionId));
838
+ if (read === undefined)
839
+ return { members: [] };
840
+ const result = await read;
841
+ return result.ok ? result.value : { members: [] };
842
+ }
828
843
  loadToolCatalogue() {
829
844
  if (this.toolCatalogueLoading || this.toolCatalogue === 'ready')
830
845
  return;
@@ -26,8 +26,8 @@ export declare function isSessionRoot(agent: Agent): boolean;
26
26
  /**
27
27
  * Whether any teammate of one Session is still running or provisioning.
28
28
  *
29
- * A teammate whose child has not been created yet has no `agent/status` of its
30
- * own, so the roster — which folds the durable `team/member` events — is the
29
+ * A member whose child has not been published yet has no `agent/status` of its
30
+ * own, so the subagent catalog and this plugin's own admission record are the
31
31
  * authority here rather than the Agent registry. The captain is not counted:
32
32
  * its own status is the other half of the same question.
33
33
  * @param ctx - host context carrying the Team service.
@@ -12,6 +12,7 @@
12
12
  * session content ever leaves the Host.
13
13
  * @module dsh-agent-team-presets/execution
14
14
  */
15
+ import { executingMemberCount } from "./team-runtime.js";
15
16
  import { definitionFingerprint, findMemberById, memberRouteOf, sameMemberRoute, selectedRoleId, selectedTeam } from "./presets.js";
16
17
  /**
17
18
  * Whether one Agent is a top-level Session agent this plugin composes.
@@ -24,8 +25,8 @@ export function isSessionRoot(agent) {
24
25
  /**
25
26
  * Whether any teammate of one Session is still running or provisioning.
26
27
  *
27
- * A teammate whose child has not been created yet has no `agent/status` of its
28
- * own, so the roster — which folds the durable `team/member` events — is the
28
+ * A member whose child has not been published yet has no `agent/status` of its
29
+ * own, so the subagent catalog and this plugin's own admission record are the
29
30
  * authority here rather than the Agent registry. The captain is not counted:
30
31
  * its own status is the other half of the same question.
31
32
  * @param ctx - host context carrying the Team service.
@@ -33,10 +34,7 @@ export function isSessionRoot(agent) {
33
34
  * @returns whether a teammate is still working on that Session's Team task.
34
35
  */
35
36
  export function teammatesBusy(ctx, agent) {
36
- if (ctx.agentTeams.tryMembership(agent) === undefined)
37
- return false;
38
- return ctx.agentTeams.listMembers(agent).some(member => member.role === 'teammate'
39
- && (member.status === 'running' || member.status === 'provisioning'));
37
+ return executingMemberCount(ctx, agent) > 0;
40
38
  }
41
39
  /**
42
40
  * The tool name that only a Team application registers on one Agent.
@@ -226,11 +224,15 @@ export class TeamExecutionMonitor {
226
224
  continue;
227
225
  // The roster is the only authority on a teammate with no live child, so a
228
226
  // Session whose roster cannot be read is undecidable rather than idle.
229
- const readable = this.ctx.agentTeams.tryMembership(agent) !== undefined;
230
- const members = readable
231
- ? this.ctx.agentTeams.listMembers(agent).filter(member => member.role === 'teammate'
232
- && (member.status === 'running' || member.status === 'provisioning')).length
233
- : 0;
227
+ let readable = true;
228
+ let members = 0;
229
+ try {
230
+ members = executingMemberCount(this.ctx, agent);
231
+ }
232
+ catch (error) {
233
+ readable = false;
234
+ this.ctx.logger.warn('agent-team-presets: member execution state could not be read: %s', String(error));
235
+ }
234
236
  const busy = agent.status === 'running' || members > 0;
235
237
  const pending = applied === undefined
236
238
  || selected === undefined