@nanmicoder/dsh-agent-teams 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -0
  3. package/assets/agent-teams/action-celebrating.png +0 -0
  4. package/assets/agent-teams/action-reporting.png +0 -0
  5. package/assets/agent-teams/action-sending.png +0 -0
  6. package/assets/agent-teams/action-sleeping.png +0 -0
  7. package/assets/agent-teams/action-thinking.png +0 -0
  8. package/assets/agent-teams/action-working.png +0 -0
  9. package/assets/agent-teams/data-analyst.png +0 -0
  10. package/assets/agent-teams/designer.png +0 -0
  11. package/assets/agent-teams/docs-coordinator.png +0 -0
  12. package/assets/agent-teams/engineer.png +0 -0
  13. package/assets/agent-teams/qa-engineer.png +0 -0
  14. package/assets/agent-teams/researcher.png +0 -0
  15. package/assets/agent-teams/security-reviewer.png +0 -0
  16. package/assets/agent-teams/team-lead.png +0 -0
  17. package/cordis.patch.yml +21 -0
  18. package/lib/client/ActivityPanel.js +340 -0
  19. package/lib/client/AgentTeamsCard.js +74 -0
  20. package/lib/client/activity-model.js +70 -0
  21. package/lib/client/agent-teams-card-definition.js +85 -0
  22. package/lib/client/artwork.js +40 -0
  23. package/lib/client/index.js +33 -0
  24. package/lib/client.js +1235 -0
  25. package/lib/client.js.map +1 -0
  26. package/lib/event-types.js +12 -0
  27. package/lib/events.js +60 -0
  28. package/lib/index.js +172 -0
  29. package/lib/members.js +168 -0
  30. package/lib/snapshot.js +155 -0
  31. package/lib/state.js +461 -0
  32. package/lib/tools.js +749 -0
  33. package/lib/types/client/ActivityPanel.d.ts +64 -0
  34. package/lib/types/client/AgentTeamsCard.d.ts +24 -0
  35. package/lib/types/client/activity-model.d.ts +31 -0
  36. package/lib/types/client/agent-teams-card-definition.d.ts +44 -0
  37. package/lib/types/client/artwork.d.ts +19 -0
  38. package/lib/types/client/index.d.ts +11 -0
  39. package/lib/types/event-types.d.ts +103 -0
  40. package/lib/types/events.d.ts +37 -0
  41. package/lib/types/index.d.ts +42 -0
  42. package/lib/types/members.d.ts +86 -0
  43. package/lib/types/snapshot.d.ts +83 -0
  44. package/lib/types/state.d.ts +144 -0
  45. package/lib/types/tools.d.ts +40 -0
  46. package/lib/types/types.d.ts +73 -0
  47. package/lib/types.js +11 -0
  48. package/package.json +108 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","names":["css","css","IconBranchOutline16","IconChevronRightOutline14","StateDot","_Fragment","IconCloseOutline16"],"sources":["client/activity-model.js","client/artwork.js","client/AgentTeamsCard.js","client/ActivityPanel.js","client/agent-teams-card-definition.js","client/index.js"],"sourcesContent":["/** Pure relationship projections used by the AgentTeams activity panel. */\n/**\n * Whether an expanded activity panel still belongs to the current session.\n *\n * The panel is mounted through a body portal, so React does not remount it\n * when the conversation route changes. Ownership keeps an expanded panel\n * from leaking onto the new-session screen (or another conversation) while\n * its local open state is being reset.\n */\nexport function activityPanelExpandedForSession(open, owner, current) {\n return open && owner !== undefined && owner === current;\n}\n/** Group tasks by their precomputed dependency depth. */\nexport function taskStages(tasks) {\n const byDepth = new Map();\n for (const task of tasks) {\n const depth = Number.isFinite(task.depth) ? Math.max(0, Math.floor(task.depth)) : 0;\n const stage = byDepth.get(depth) ?? [];\n stage.push(task);\n byDepth.set(depth, stage);\n }\n return [...byDepth.entries()]\n .sort(([left], [right]) => left - right)\n .map(([depth, stageTasks]) => ({\n depth,\n tasks: stageTasks.slice().sort((left, right) => left.id.localeCompare(right.id, 'en', { numeric: true })),\n }));\n}\n/**\n * Return the complete upstream/downstream chain around one task.\n *\n * Traversal uses both dependency directions and remains cycle-safe, so the UI\n * can highlight every handoff related to the focused task even if malformed\n * durable data contains a cycle.\n */\nexport function relatedTaskIds(taskId, tasks) {\n const byId = new Map(tasks.map((task) => [task.id, task]));\n if (!byId.has(taskId))\n return new Set();\n const dependents = new Map();\n for (const task of tasks) {\n for (const dependency of task.dependencies) {\n const targets = dependents.get(dependency) ?? [];\n targets.push(task.id);\n dependents.set(dependency, targets);\n }\n }\n const related = new Set();\n const upstreamSeen = new Set();\n const downstreamSeen = new Set();\n const visitUpstream = (id) => {\n if (upstreamSeen.has(id))\n return;\n upstreamSeen.add(id);\n related.add(id);\n for (const dependency of byId.get(id)?.dependencies ?? [])\n visitUpstream(dependency);\n };\n const visitDownstream = (id) => {\n if (downstreamSeen.has(id))\n return;\n downstreamSeen.add(id);\n related.add(id);\n for (const dependent of dependents.get(id) ?? [])\n visitDownstream(dependent);\n };\n visitUpstream(taskId);\n visitDownstream(taskId);\n return related;\n}\n","/**\n * Shared whale artwork lookup for the activity panel and the conversation\n * card: role keywords map to the packaged role images; the captain always\n * uses the lead whale.\n * @module dsh-agent-teams/client/artwork\n */\n/** Artwork route prefix served by the plugin host half. */\nexport const ART_BASE = '/plugins/dsh-agent-teams/assets/';\n/** Whale role artwork per role keyword. */\nconst ROLE_ART = [\n [/resear|analys|investig|explor|data|study|研究|分析|数据|调查|探索|调研/, 'researcher.png'],\n [/engineer|dev\\b|server|backend|\\bapi\\b|runtime|watcher|contract|工程|后端|服务|接口|开发|代码|编程/, 'engineer.png'],\n [/\\bqa\\b|test|verif|quality|测试|质量/, 'qa-engineer.png'],\n [/design|\\bui\\b|\\bux\\b|front|theme|accessib|设计|前端|主题/, 'designer.png'],\n [/secur|audit|risk|threat|review|安全|审计|审查|风险/, 'security-reviewer.png'],\n [/docs|writer|product|spec|coordin|撰写|文案|写作|文档|协调/, 'docs-coordinator.png'],\n [/release|\\bbuild\\b|deploy|\\bops\\b|\\bci\\b|ship|发布|构建|部署/, 'engineer.png'],\n];\n/** Captain artwork (always the lead whale). */\nexport const LEAD_ART = `${ART_BASE}team-lead.png`;\n/** Status action artwork per member activity. */\nexport const ACTION_ART = {\n working: `${ART_BASE}action-working.png`,\n idle: `${ART_BASE}action-sleeping.png`,\n unknown: `${ART_BASE}action-thinking.png`,\n};\n/**\n * Member artwork URL, or null when no role matches (initial-letter fallback).\n * @param name - the member's display name.\n * @param role - the member's role text.\n * @returns the artwork URL, or null when unmatched.\n */\nexport function memberArtUrl(name, role) {\n const identity = `${name} ${role}`.toLowerCase();\n for (const [pattern, art] of ROLE_ART) {\n if (pattern.test(identity))\n return `${ART_BASE}${art}`;\n }\n return null;\n}\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * AgentTeams conversation card: the lightweight in-conversation summary for\n * one team — the captain's whale avatar and name, the member roster as\n * clickable whale avatars (opening the member's subagent transcript), and\n * an \"activity panel\" button that re-activates the top-right floater.\n *\n * The floater and this card share the `agent-teams:open-panel` window event\n * so the card can summon the panel even after it was closed (or when an old\n * session is re-opened for review).\n * @module dsh-agent-teams/client/card\n */\nimport { useEffect, useMemo, useState } from 'react';\nimport { LEAD_ART, memberArtUrl } from \"./artwork.js\";\nimport css from './AgentTeamsCard.module.css';\n/** Window event name the floater listens for to open itself. */\nexport const OPEN_PANEL_EVENT = 'agent-teams:open-panel';\n/** Re-activate the top-right activity panel, carrying this team's summary\n * so the panel can show it even when the team no longer exists on disk\n * (historical session review). */\nfunction openActivityPanel(data) {\n window.dispatchEvent(new CustomEvent(OPEN_PANEL_EVENT, {\n detail: {\n teamId: data.teamId,\n captainSessionId: data.captainSessionId,\n teamName: data.teamName,\n members: data.members,\n },\n }));\n}\n/** Render one durable team as a compact conversation card. */\nexport function AgentTeamsCard({ node, openSession, currentSessionId }) {\n const data = node.data;\n const owner = data.captainSessionId || currentSessionId() || '';\n const [snapshot, setSnapshot] = useState();\n useEffect(() => {\n let cancelled = false;\n const tick = async () => {\n for (const url of ['/plugins/dsh-agent-teams/state', '/plugins/dsh-agent-teams/state?archived=1']) {\n try {\n const response = await fetch(url, { cache: 'no-store' });\n if (!response.ok)\n continue;\n const body = (await response.json());\n const found = Array.isArray(body.teams)\n ? body.teams.find((team) => team.teamId === data.teamId && (owner === '' || team.captainSessionId === owner))\n : undefined;\n if (found !== undefined) {\n if (!cancelled)\n setSnapshot(found);\n return;\n }\n }\n catch {\n // Host restarting; retry on the next poll.\n }\n }\n };\n void tick();\n const timer = setInterval(() => { void tick(); }, 1500);\n return () => {\n cancelled = true;\n clearInterval(timer);\n };\n }, [data.teamId, owner]);\n const resolved = useMemo(() => ({\n ...data,\n captainSessionId: snapshot?.captainSessionId ?? owner,\n teamName: snapshot?.name ?? data.teamName,\n members: snapshot?.members.map((member) => ({ id: member.id, name: member.name, role: member.role })) ?? data.members,\n }), [data, owner, snapshot]);\n return (_jsxs(\"section\", { className: css.root, \"data-agent-teams-card\": true, \"data-team-id\": resolved.teamId, children: [_jsxs(\"header\", { className: css.head, children: [_jsx(\"img\", { className: css.leadAvatar, src: LEAD_ART, alt: \"\", \"aria-hidden\": true }), _jsx(\"span\", { className: css.teamName, title: resolved.teamName, children: resolved.teamName }), _jsxs(\"span\", { className: css.memberCount, children: [resolved.members.length, \" \\u540D\\u6210\\u5458\"] }), _jsx(\"button\", { type: \"button\", className: css.panelButton, onClick: () => { openActivityPanel(resolved); }, \"aria-label\": \"\\u6253\\u5F00\\u6D3B\\u52A8\\u9762\\u677F\", title: \"\\u6253\\u5F00\\u6D3B\\u52A8\\u9762\\u677F\", children: \"\\u6D3B\\u52A8\\u9762\\u677F\" })] }), resolved.members.length > 0 && (_jsx(\"div\", { className: css.members, children: resolved.members.map((member) => (_jsxs(\"button\", { type: \"button\", className: css.member, onClick: () => { if (member.id !== '')\n openSession(member.id); }, title: member.role === '' ? member.name : `${member.name} · ${member.role}`, children: [memberArtUrl(member.name, member.role) !== null ? (_jsx(\"img\", { className: css.memberArt, src: memberArtUrl(member.name, member.role) ?? '', alt: \"\", \"aria-hidden\": true })) : (_jsx(\"span\", { className: css.memberInitial, children: member.name.trim().slice(0, 1).toUpperCase() || '?' })), _jsx(\"span\", { className: css.memberName, children: member.name })] }, member.id))) }))] }));\n}\n","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\n/**\n * AgentTeams activity panel: the top-right floater monitoring every team.\n *\n * Modeled on the Claude Code desktop SessionActivityPanel: a fixed glass\n * panel at the top-right corner. On wide viewports it cooperatively makes the\n * conversation column yield space; narrow viewports keep overlay mode. It\n * polls the host `/plugins/dsh-agent-teams/state` route for\n * server-side snapshots (durable files + live subagent activity), with a\n * collapsed badge that auto-expands once when activity appears. Archived\n * teams stay available for the owning conversation after live work ends.\n *\n * The floater mounts through a body portal (no top-right slot exists in the\n * web shell); it is not a conversation node — the in-conversation panel was\n * removed in favor of this always-available monitor.\n * @module dsh-agent-teams/client/activity\n */\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { IconBranchOutline16, IconChevronRightOutline14, IconCloseOutline16, StateDot, } from '@deepseek-ai/dsh-client-ui-primitives';\nimport { activityPanelExpandedForSession, relatedTaskIds, taskStages } from \"./activity-model.js\";\nimport { ACTION_ART, LEAD_ART, memberArtUrl } from \"./artwork.js\";\nimport { OPEN_PANEL_EVENT } from \"./AgentTeamsCard.js\";\nimport css from './ActivityPanel.module.css';\n/** Poll cadence for the host snapshot route. */\nconst POLL_MS = 1000;\n/** Grace before the panel collapses once no team remains. */\nconst AUTOCLOSE_GRACE_MS = 2000;\n/**\n * Page-settle window after mount: activity restored on page load only shows\n * the collapsed badge, so the panel never yanks the conversation column\n * right after load. New activity after this window auto-expands as usual.\n */\nconst AUTO_OPEN_SETTLE_MS = 4000;\n/** Host route serving team snapshots. */\nconst STATE_URL = '/plugins/dsh-agent-teams/state';\n/** Root marker shared with the panel CSS while the portal is expanded. */\nconst PANEL_OPEN_ATTRIBUTE = 'data-agent-teams-panel-open';\n/** Initial-letter fallback for unmatched roles. */\nfunction memberInitial(name) {\n return name.trim().slice(0, 1).toUpperCase() || '?';\n}\nfunction stableHash(value) {\n let hash = 0;\n for (let index = 0; index < value.length; index += 1) {\n hash = ((hash << 5) - hash + value.charCodeAt(index)) | 0;\n }\n return Math.abs(hash);\n}\nconst ACCENTS = [\n 'var(--dsw-alias-state-business-primary)',\n 'var(--dsw-alias-state-success)',\n 'var(--dsw-alias-state-danger)',\n 'var(--dsw-alias-state-warning)',\n 'var(--dsw-alias-label-tertiary)',\n];\nfunction accentOf(id) {\n return ACCENTS[stableHash(id) % ACCENTS.length] ?? ACCENTS[0];\n}\n/** Badge text follows the raw task status (finer than the 4 visual states):\n * claimed/pending/failed/cancelled keep their own labels and colors. */\nconst TASK_STATUS_LABEL = {\n pending: '待领取',\n claimed: '已认领',\n in_progress: '进行中',\n completed: '已完成',\n failed: '失败',\n cancelled: '已取消',\n};\nfunction taskStatusLabel(status) {\n return TASK_STATUS_LABEL[status] ?? status;\n}\n/** Badge/bar coloring key: visual state, widened for terminal statuses. */\nfunction taskTone(state, status) {\n if (status === 'failed')\n return 'failed';\n if (status === 'cancelled')\n return 'cancelled';\n return state;\n}\n/** Collapsed badge: an always-visible corner pill while any team exists. */\nfunction CollapsedBadge({ count, busy, onClick }) {\n return (_jsxs(\"button\", { type: \"button\", className: css.badge, \"data-busy\": busy, onClick: onClick, \"aria-label\": `AgentTeams 活动,${count} 个团队`, children: [_jsx(\"span\", { className: css.badgeDot, \"data-busy\": busy, \"aria-hidden\": true }), _jsx(\"span\", { className: css.badgeCount, children: count })] }));\n}\nfunction memberDotState(member, tasks) {\n const owned = tasks.filter((task) => task.assignee === member.name);\n if (member.activity === 'working')\n return 'ongoing';\n if (owned.some((task) => task.status === 'failed'))\n return 'error';\n if (owned.length > 0 && owned.every((task) => task.status === 'completed'))\n return 'done';\n return 'warning';\n}\nfunction memberStateLabel(member, tasks) {\n const owned = tasks.filter((task) => task.assignee === member.name);\n if (member.activity === 'working')\n return '工作中';\n if (owned.some((task) => task.status === 'failed'))\n return '有失败';\n if (owned.some((task) => task.state === 'blocked'))\n return '等待';\n if (owned.length > 0 && owned.every((task) => task.status === 'completed'))\n return '已交付';\n if (owned.length > 0)\n return '待执行';\n return '待派工';\n}\nfunction memberStatusText(member, tasks) {\n const owned = tasks.filter((task) => task.assignee === member.name);\n const current = owned.find((task) => task.id === member.currentTask);\n const blocked = owned.find((task) => task.state === 'blocked');\n if (member.activity === 'working' && current !== undefined)\n return `正在执行 ${current.id}`;\n if (member.activity === 'working')\n return '正在处理已派任务';\n if (blocked !== undefined) {\n const dependency = tasks.find((task) => blocked.dependencies.includes(task.id) && task.state !== 'completed');\n if (dependency !== undefined)\n return `等待 ${dependency.id} · ${dependency.assignee || '待认领'}`;\n return '等待前置任务';\n }\n if (member.total === 0)\n return '等待队长派工';\n if (member.done === member.total)\n return '任务已交付';\n return member.activity === 'idle' ? '待继续执行' : '状态未知';\n}\nfunction dependencyLabel(task, tasks) {\n return task.dependencies.map((id) => {\n const dependency = tasks.find((candidate) => candidate.id === id);\n return dependency?.assignee ? `${id}·${dependency.assignee}` : id;\n }).join('、');\n}\nfunction TaskNode({ task, tasks, focused, dimmed, pinned, onPin, onPreview }) {\n const tone = taskTone(task.state, task.status);\n return (_jsxs(\"button\", { type: \"button\", className: css.taskNode, \"data-task-id\": task.id, \"data-state\": tone, \"data-focused\": focused, \"data-dimmed\": dimmed, \"aria-pressed\": pinned, title: `${task.id} · ${task.subject}(点击固定依赖链)`, onClick: () => { onPin(task.id); }, onMouseEnter: () => { onPreview(task.id); }, onMouseLeave: () => { onPreview(null); }, onFocus: () => { onPreview(task.id); }, onBlur: () => { onPreview(null); }, children: [_jsxs(\"span\", { className: css.taskNodeHead, children: [_jsx(\"span\", { className: css.taskId, children: task.id }), _jsx(\"span\", { className: css.taskBadge, \"data-state\": tone, children: taskStatusLabel(task.status) })] }), _jsx(\"span\", { className: css.taskSubject, children: task.subject }), _jsxs(\"span\", { className: css.taskRoute, children: [_jsx(\"span\", { className: css.taskOwner, children: task.assignee || '待认领' }), task.dependencies.length === 0\n ? _jsx(\"span\", { className: css.taskStart, children: \"\\u8D77\\u70B9\" })\n : _jsxs(\"span\", { className: css.taskDeps, children: [\"\\u4F9D\\u8D56 \", dependencyLabel(task, tasks)] })] })] }));\n}\nfunction DependencyMap({ tasks }) {\n const [previewTaskId, setPreviewTaskId] = useState(null);\n const [pinnedTaskId, setPinnedTaskId] = useState(null);\n const focusedTaskId = pinnedTaskId ?? previewTaskId;\n const stages = useMemo(() => taskStages(tasks), [tasks]);\n const related = useMemo(() => focusedTaskId === null ? null : relatedTaskIds(focusedTaskId, tasks), [focusedTaskId, tasks]);\n useEffect(() => {\n const onKeyDown = (event) => {\n if (event.key === 'Escape')\n setPinnedTaskId(null);\n };\n window.addEventListener('keydown', onKeyDown);\n return () => { window.removeEventListener('keydown', onKeyDown); };\n }, []);\n if (tasks.length === 0)\n return null;\n return (_jsxs(\"section\", { className: css.dependencySection, \"aria-label\": \"\\u4EFB\\u52A1\\u4F9D\\u8D56\\u94FE\", \"data-dependency-map\": true, children: [_jsxs(\"header\", { className: css.sectionHead, children: [_jsxs(\"span\", { className: css.sectionTitle, children: [_jsx(IconBranchOutline16, {}), \" \\u4EFB\\u52A1\\u4F9D\\u8D56\"] }), _jsx(\"span\", { className: css.sectionHint, children: pinnedTaskId === null ? '悬停预览 · 点击固定' : `${pinnedTaskId} 已固定 · Esc 取消` })] }), _jsx(\"div\", { className: css.stageFlow, children: stages.map((stage, index) => (_jsxs(\"div\", { className: css.stageGroup, \"data-depth\": stage.depth, children: [index > 0 && (_jsxs(\"span\", { className: css.stageConnector, \"aria-hidden\": true, children: [_jsx(\"span\", { className: css.stageLine }), _jsx(IconChevronRightOutline14, {})] })), _jsxs(\"div\", { className: css.stageColumn, children: [_jsxs(\"span\", { className: css.stageLabel, children: [stage.depth === 0 ? '起点' : `依赖层 ${stage.depth}`, _jsx(\"span\", { children: stage.tasks.length })] }), _jsx(\"div\", { className: css.stageTasks, children: stage.tasks.map((task) => (_jsx(TaskNode, { task: task, tasks: tasks, focused: related?.has(task.id) ?? false, dimmed: related !== null && !related.has(task.id), pinned: pinnedTaskId === task.id, onPin: (id) => { setPinnedTaskId((current) => current === id ? null : id); }, onPreview: setPreviewTaskId }, task.id))) })] })] }, stage.depth))) })] }));\n}\nfunction TeamSection({ team, onNavigate, historic = false }) {\n const busyCount = team.members.filter((member) => member.activity === 'working').length;\n const assignedCount = team.tasks.filter((task) => task.assignee !== '').length;\n const completedCount = team.tasks.filter((task) => task.status === 'completed').length;\n const allCompleted = team.tasks.length > 0 && completedCount === team.tasks.length;\n const unclaimed = team.tasks.filter((task) => {\n if (task.status === 'completed' || task.status === 'failed' || task.status === 'cancelled')\n return false;\n if (task.assignee === '')\n return true;\n return !team.members.some((member) => member.name === task.assignee);\n });\n return (_jsxs(\"section\", { className: css.team, \"data-team-id\": team.teamId, children: [_jsxs(\"header\", { className: css.teamHead, children: [_jsx(\"span\", { className: css.teamName, title: team.name, children: team.name }), historic && _jsx(\"span\", { className: css.historicPill, children: \"\\u5DF2\\u7ED3\\u675F\" }), _jsxs(\"span\", { className: css.teamStats, children: [_jsxs(\"span\", { \"data-stat\": \"members\", children: [team.members.length, \" \\u6210\\u5458\"] }), _jsxs(\"span\", { \"data-stat\": \"tasks\", children: [completedCount, \"/\", team.tasks.length, \" \\u5B8C\\u6210\"] }), _jsxs(\"span\", { \"data-stat\": \"messages\", children: [team.messageCount, \" \\u6D88\\u606F\"] })] })] }), _jsxs(\"section\", { className: css.delegationSection, \"aria-label\": \"\\u961F\\u957F\\u6D3E\\u5DE5\\u5173\\u7CFB\", \"data-delegation-map\": true, children: [_jsxs(\"div\", { className: css.captainNode, children: [_jsx(\"span\", { className: css.captainAvatar, children: _jsx(\"img\", { className: css.leadAvatar, src: LEAD_ART, alt: \"\", \"aria-hidden\": true }) }), _jsxs(\"span\", { className: css.captainInfo, children: [_jsxs(\"span\", { className: css.captainLine, children: [_jsx(\"span\", { className: css.captainName, children: \"\\u961F\\u957F\" }), _jsx(\"span\", { className: css.captainRole, children: \"\\u62C6\\u89E3 \\u00B7 \\u6D3E\\u53D1 \\u00B7 \\u6C47\\u603B\" })] }), _jsxs(\"span\", { className: css.captainSummary, children: [\"\\u5DF2\\u6D3E\\u53D1 \", assignedCount, \" \\u9879\\u4EFB\\u52A1\\u7ED9 \", team.members.length, \" \\u540D\\u6210\\u5458\"] })] }), _jsxs(\"span\", { className: css.captainState, \"data-busy\": busyCount > 0, children: [_jsx(StateDot, { state: busyCount > 0 ? 'ongoing' : allCompleted ? 'done' : 'warning' }), busyCount > 0 ? `${busyCount} 人执行中` : allCompleted ? '已收齐' : '等待回报'] })] }), _jsxs(\"div\", { className: css.delegationTree, children: [team.members.length === 0 && _jsx(\"span\", { className: css.emptyHint, children: \"\\u6682\\u65E0\\u6210\\u5458\\uFF0C\\u7B49\\u5F85\\u961F\\u957F\\u7EC4\\u5EFA\\u56E2\\u961F\" }), team.members.map((member) => {\n const owned = team.tasks.filter((task) => task.assignee === member.name);\n return (_jsxs(\"div\", { className: css.memberBlock, \"data-activity\": member.activity, children: [_jsx(\"span\", { className: css.memberBranch, \"aria-hidden\": true, children: _jsx(\"span\", {}) }), _jsxs(\"button\", { type: \"button\", className: css.memberRow, \"data-activity\": member.activity, onClick: () => { if (member.id !== '')\n onNavigate(member.id); }, children: [_jsxs(\"span\", { className: css.memberAvatar, \"data-unread\": member.unread > 0, children: [memberArtUrl(member.name, member.role) !== null ? (_jsx(\"img\", { className: css.memberArt, src: memberArtUrl(member.name, member.role) ?? '', alt: \"\", \"aria-hidden\": true })) : (_jsx(\"span\", { className: css.memberInitial, style: { background: accentOf(member.id) }, children: memberInitial(member.name) })), _jsx(\"img\", { className: css.stateArt, \"data-activity\": member.activity, src: ACTION_ART[member.activity], alt: \"\", \"aria-hidden\": true })] }), _jsxs(\"span\", { className: css.memberInfo, children: [_jsxs(\"span\", { className: css.memberLine, children: [_jsx(\"span\", { className: css.memberName, children: member.name }), member.role !== '' && _jsx(\"span\", { className: css.memberRole, children: member.role }), _jsxs(\"span\", { className: css.memberState, \"data-activity\": member.activity, children: [_jsx(StateDot, { state: memberDotState(member, team.tasks) }), memberStateLabel(member, team.tasks)] })] }), _jsx(\"span\", { className: css.memberStatusLine, children: memberStatusText(member, team.tasks) })] }), _jsxs(\"span\", { className: css.memberCount, children: [member.done, \"/\", member.total] })] }), _jsxs(\"div\", { className: css.assignmentLine, children: [_jsx(\"span\", { className: css.assignmentLabel, children: \"\\u961F\\u957F\\u6D3E\\u53D1\" }), _jsx(\"span\", { className: css.assignmentTasks, children: owned.length === 0\n ? _jsx(\"span\", { className: css.taskEmpty, children: \"\\u6682\\u65E0\\u4EFB\\u52A1\" })\n : owned.map((task) => (_jsx(\"span\", { className: css.assignmentChip, \"data-state\": taskTone(task.state, task.status), title: task.subject, children: task.id }, task.id))) }), member.unread > 0 && _jsxs(\"span\", { className: css.unreadPill, children: [member.unread, \" \\u6761\\u6D88\\u606F\"] })] })] }, member.id));\n })] })] }), _jsx(DependencyMap, { tasks: team.tasks }), unclaimed.length > 0 && (_jsxs(\"section\", { className: css.unclaimed, \"aria-label\": \"\\u5F85\\u8BA4\\u9886\\u4EFB\\u52A1\", children: [_jsx(\"span\", { className: css.unclaimedTitle, children: \"\\u5F85\\u961F\\u957F\\u8BA4\\u9886\\u6216\\u6539\\u6D3E\" }), _jsx(\"span\", { className: css.assignmentTasks, children: unclaimed.map((task) => (_jsxs(\"span\", { className: css.assignmentChip, \"data-state\": taskTone(task.state, task.status), title: task.subject, children: [task.id, \" \\u00B7 \", task.assignee || '未分配'] }, task.id))) })] })), team.captainInbox.length > 0 && (_jsxs(\"section\", { className: css.inbox, \"aria-label\": \"\\u6210\\u5458\\u56DE\\u62A5\\u961F\\u957F\", children: [_jsxs(\"header\", { className: css.sectionHead, children: [_jsx(\"span\", { className: css.sectionTitle, children: \"\\u6210\\u5458\\u56DE\\u62A5\" }), _jsx(\"span\", { className: css.sectionHint, children: \"\\u6D41\\u5411\\u961F\\u957F\" })] }), team.captainInbox.slice(-2).map((message, index) => (_jsxs(\"div\", { className: css.inboxRow, children: [_jsxs(\"span\", { className: css.inboxRoute, children: [message.from, _jsx(IconChevronRightOutline14, {}), \"\\u961F\\u957F\"] }), _jsx(\"span\", { className: css.inboxContent, title: message.content, children: message.content })] }, index)))] }))] }));\n}\n/** The top-right activity floater. Teams follow the current session: live\n * snapshots and historic card summaries are only shown while their captain\n * session is the one currently open. */\nexport function ActivityPanel({ sessionsList, openSession }) {\n // Navigating to a member's subagent transcript is an explicit departure:\n // hide the floater immediately instead of waiting out the autocollapse\n // grace, so the panel never lingers over the member session.\n const navigateToSession = (id) => {\n setOpen(false);\n setWasActive(false);\n openSession(id);\n };\n const [teams, setTeams] = useState([]);\n const [archivedTeams, setArchivedTeams] = useState([]);\n const [open, setOpen] = useState(false);\n const [openOwner, setOpenOwner] = useState();\n const [autoOpened, setAutoOpened] = useState(false);\n const [wasActive, setWasActive] = useState(false);\n const [historic, setHistoric] = useState(new Map());\n const current = useSyncExternalStore(sessionsList.subscribe, sessionsList.getSnapshot).current;\n const currentRef = useRef(current);\n useEffect(() => { currentRef.current = current; }, [current]);\n const mountedAtRef = useRef(performance.now());\n const expanded = activityPanelExpandedForSession(open, openOwner, current);\n // This portal survives conversation route changes. Gate expansion by its\n // owning session during render, then clear stale state before paint. This\n // removes the old panel immediately instead of waiting for the no-team\n // autoclose grace period on the destination page.\n useLayoutEffect(() => {\n if (openOwner === undefined || openOwner === current)\n return;\n setOpen(false);\n setOpenOwner(undefined);\n setWasActive(false);\n setAutoOpened(false);\n }, [current, openOwner]);\n // The activity panel is a body portal, so announce its open state on body.\n // CSS can then make the conversation column yield space without knowing the\n // host shell's hashed module class names. Narrow viewports keep overlay mode.\n useLayoutEffect(() => {\n const root = document.documentElement;\n if (expanded)\n root.setAttribute(PANEL_OPEN_ATTRIBUTE, '');\n else\n root.removeAttribute(PANEL_OPEN_ATTRIBUTE);\n return () => { root.removeAttribute(PANEL_OPEN_ATTRIBUTE); };\n }, [expanded]);\n useEffect(() => {\n let cancelled = false;\n let inFlight = false;\n const tick = async () => {\n if (inFlight || cancelled)\n return;\n inFlight = true;\n try {\n const [liveResponse, archivedResponse] = await Promise.all([\n fetch(STATE_URL, { cache: 'no-store' }),\n fetch(`${STATE_URL}?archived=1`, { cache: 'no-store' }),\n ]);\n if (liveResponse.ok) {\n const body = (await liveResponse.json());\n if (!cancelled && Array.isArray(body.teams))\n setTeams(body.teams);\n }\n if (archivedResponse.ok) {\n const body = (await archivedResponse.json());\n if (!cancelled && Array.isArray(body.teams))\n setArchivedTeams(body.teams);\n }\n }\n catch {\n // Host restarting; keep the last snapshot.\n }\n finally {\n inFlight = false;\n }\n };\n void tick();\n const timer = setInterval(() => { void tick(); }, POLL_MS);\n return () => {\n cancelled = true;\n clearInterval(timer);\n };\n }, []);\n useEffect(() => {\n const onOpenPanel = (event) => {\n const activeSession = currentRef.current;\n if (activeSession === undefined)\n return;\n setOpenOwner(activeSession);\n setOpen(true);\n const detail = event.detail;\n if (detail?.teamId !== undefined) {\n // A card from a log that predates captainSessionId belongs to the\n // session that activated it (the current one at injection time).\n const owner = detail.captainSessionId !== '' ? detail.captainSessionId : currentRef.current ?? '';\n const teamKey = `${owner}:${detail.teamId}`;\n setHistoric((previous) => {\n const next = new Map(previous);\n next.set(teamKey, { data: detail, owner });\n return next;\n });\n }\n };\n window.addEventListener(OPEN_PANEL_EVENT, onOpenPanel);\n return () => {\n window.removeEventListener(OPEN_PANEL_EVENT, onOpenPanel);\n };\n }, []);\n // Teams follow the current session: live snapshots and historic card\n // summaries are visible only while their captain session is current.\n const visibleTeams = useMemo(\n // No current session (initial load): show nothing until one is picked,\n // so cross-session teams never leak into the floater.\n () => (current === undefined ? [] : teams.filter((team) => team.captainSessionId === current)), [teams, current]);\n const visibleHistoric = useMemo(() => (current === undefined ? [] : [...historic.values()].filter(({ data, owner }) => owner === current && !teams.some((live) => live.captainSessionId === current && live.teamId === data.teamId) && !archivedTeams.some((archived) => archived.captainSessionId === current && archived.teamId === data.teamId))), [historic, current, teams, archivedTeams]);\n const visibleArchived = useMemo(() => (current === undefined ? [] : archivedTeams.filter((team) => team.captainSessionId === current && !teams.some((live) => live.captainSessionId === current && live.teamId === team.teamId))), [archivedTeams, current, teams]);\n const visibleCount = visibleTeams.length + visibleArchived.length + visibleHistoric.length;\n useEffect(() => {\n if (visibleCount > 0) {\n setWasActive(true);\n // Auto-expand only after the page-settle window: opening (and its\n // main-column yield) right after load reads as a whole-page flicker.\n const settled = performance.now() - mountedAtRef.current >= AUTO_OPEN_SETTLE_MS;\n if (!autoOpened && settled) {\n setOpenOwner(current);\n setOpen(true);\n setAutoOpened(true);\n }\n return;\n }\n if (!wasActive)\n return;\n const timer = setTimeout(() => {\n setOpen(false);\n setOpenOwner(undefined);\n setWasActive(false);\n // Re-arm auto-expand: a later activity (new team, new session) may\n // open the panel on its own again.\n setAutoOpened(false);\n }, AUTOCLOSE_GRACE_MS);\n return () => { clearTimeout(timer); };\n }, [visibleCount, autoOpened, wasActive]);\n const busy = useMemo(() => visibleTeams.some((team) => team.members.some((member) => member.activity === 'working')), [visibleTeams]);\n const hasTeams = visibleCount > 0;\n if (!hasTeams && !expanded)\n return null;\n return (_jsxs(_Fragment, { children: [!expanded && (_jsx(CollapsedBadge, { count: visibleCount, busy: busy, onClick: () => {\n if (current === undefined)\n return;\n setOpenOwner(current);\n setOpen(true);\n } })), expanded && (_jsxs(\"aside\", { className: css.panel, \"data-agent-teams-activity\": true, children: [_jsxs(\"header\", { className: css.panelHead, children: [_jsxs(\"span\", { className: css.panelTitle, children: [\"AgentTeams \\u6D3B\\u52A8\", _jsx(\"span\", { className: css.panelDot, \"data-busy\": busy, \"aria-hidden\": true })] }), _jsx(\"button\", { type: \"button\", className: css.closeButton, onClick: () => {\n setOpen(false);\n setOpenOwner(undefined);\n }, \"aria-label\": \"\\u5173\\u95ED\", children: _jsx(IconCloseOutline16, {}) })] }), _jsx(\"div\", { className: css.teams, children: visibleCount === 0\n ? _jsx(\"span\", { className: css.emptyHint, children: \"\\u6682\\u65E0\\u56E2\\u961F\\u6D3B\\u52A8\" })\n : (_jsxs(_Fragment, { children: [visibleTeams.map((team) => (_jsx(TeamSection, { team: team, onNavigate: navigateToSession }, team.teamId))), visibleArchived.map((team) => (_jsx(\"div\", { \"data-team-id\": team.teamId, \"data-historic\": true, className: css.archivedWrap, children: _jsx(TeamSection, { team: team, onNavigate: navigateToSession, historic: true }) }, `${team.captainSessionId}:${team.teamId}`))), visibleHistoric.map(({ data: team, owner }) => {\n const teamKey = `${owner}:${team.teamId}`;\n return (_jsxs(\"section\", { className: css.team, \"data-team-id\": team.teamId, \"data-historic\": true, children: [_jsxs(\"header\", { className: css.teamHead, children: [_jsxs(\"span\", { className: css.teamName, title: team.teamName, children: [_jsx(\"img\", { className: css.leadAvatar, src: LEAD_ART, alt: \"\", \"aria-hidden\": true }), \" \", team.teamName] }), _jsx(\"span\", { className: css.historicPill, children: \"\\u5DF2\\u7ED3\\u675F\" })] }), _jsx(\"div\", { className: css.members, children: team.members.map((member) => (_jsxs(\"button\", { type: \"button\", className: css.memberRow, \"data-activity\": \"idle\", onClick: () => { if (member.id !== '')\n navigateToSession(member.id); }, children: [_jsx(\"span\", { className: css.memberAvatar, children: memberArtUrl(member.name, member.role) !== null ? (_jsx(\"img\", { className: css.memberArt, src: memberArtUrl(member.name, member.role) ?? '', alt: \"\", \"aria-hidden\": true })) : (_jsx(\"span\", { className: css.memberInitial, style: { background: accentOf(member.id) }, children: memberInitial(member.name) })) }), _jsx(\"span\", { className: css.memberInfo, children: _jsxs(\"span\", { className: css.memberLine, children: [_jsx(\"span\", { className: css.memberName, children: member.name }), member.role !== '' && _jsx(\"span\", { className: css.memberRole, children: member.role })] }) })] }, member.id))) })] }, teamKey));\n })] })) })] }))] }));\n}\n","/**\n * AgentTeams conversation card: a lightweight in-conversation summary shown\n * when a team is created — the captain's name, the member roster with whale\n * avatars, and an entry point that re-activates the top-right activity\n * panel (useful after the floater was closed, or when re-opening an old\n * session for review).\n *\n * The fold anchors to the Harness's durable `tool/call` + `tool/result`\n * records for `agent_teams_create`. Those are first-party session events, so\n * the card survives restarts without writing an out-of-repo event type.\n * @module dsh-agent-teams/client/card\n */\n/** Parse the only create-call fields the historic card owns. */\nexport function parseAgentTeamsCreateArgs(value) {\n try {\n const parsed = JSON.parse(value);\n if (typeof parsed !== 'object' || parsed === null || !('name' in parsed) || typeof parsed.name !== 'string') {\n return undefined;\n }\n const name = parsed.name.trim();\n if (name === '')\n return undefined;\n const cleaned = name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');\n return { teamId: cleaned === '' ? 'team' : cleaned, name };\n }\n catch {\n return undefined;\n }\n}\n/** Durable first-party tool events folded into one keyed Chat node. */\nexport const agentTeamsCardDefinition = {\n kind: 'agent-teams',\n target: 'chat',\n match: (event) => {\n if (event.type === 'tool/call' && event.data.name === 'agent_teams_create') {\n return parseAgentTeamsCreateArgs(event.data.arguments) === undefined\n ? null\n : { id: String(event.data.callId), role: 'start' };\n }\n if (event.type === 'tool/result' && event.data.message.source.kind === 'tool') {\n return { id: String(event.data.message.source.callId), role: 'update' };\n }\n return null;\n },\n start: (_context, match) => {\n if (match.event.type !== 'tool/call') {\n throw new Error('agent-teams card start requires agent_teams_create tool/call');\n }\n const parsed = parseAgentTeamsCreateArgs(match.event.data.arguments);\n if (parsed === undefined)\n throw new Error('agent-teams card start requires valid create arguments');\n return { ...parsed, accepted: false };\n },\n update: (context, match) => {\n if (match.event.type !== 'tool/result')\n return context.state;\n const failed = match.event.data.error !== undefined\n || match.event.data.message.content.some((block) => block.type === 'tool-result' && block.isError === true);\n if (failed)\n return context.state;\n return { ...context.state, accepted: true };\n },\n buildViewNode: (context) => {\n if (context.start === undefined)\n return null;\n const state = context.state;\n if (!state.accepted)\n return null;\n return {\n key: context.key,\n kind: 'agent-teams',\n id: context.id,\n target: 'chat',\n anchorSeq: context.start.event.seq,\n location: context.start.location,\n visibility: 'visible',\n data: {\n teamId: state.teamId,\n captainSessionId: '',\n teamName: state.name,\n members: [],\n },\n };\n },\n};\n","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createRoot } from 'react-dom/client';\nimport { ActivityPanel } from \"./ActivityPanel.js\";\nimport { AgentTeamsCard } from \"./AgentTeamsCard.js\";\nimport { agentTeamsCardDefinition } from \"./agent-teams-card-definition.js\";\n/** Required services: conversation nodes, slots, and sessions navigation. */\nexport const inject = ['conversationEvents', 'slots', 'sessions'];\n/**\n * Mount the floater through a body portal (the web shell has no top-right\n * slot) and register the in-conversation team card, whose \"activity panel\"\n * button re-activates the floater via a window event — the recovery path\n * for a closed floater or a re-opened session.\n */\nexport function apply(ctx) {\n const host = document.createElement('div');\n host.dataset.agentTeamsHost = '';\n document.body.appendChild(host);\n const root = createRoot(host);\n root.render(_jsx(ActivityPanel, { sessionsList: ctx.sessions.list, openSession: (id) => { ctx.sessions.open(id); } }));\n ctx.effect(() => () => {\n root.unmount();\n host.remove();\n }, 'agent-teams: activity panel');\n ctx.conversationEvents.register(agentTeamsCardDefinition);\n ctx.slots.inject('conversation.chat.node', () => ctx.slots.register({\n name: 'conversation.chat.node',\n key: 'agent-teams',\n inject: () => ({\n openSession: (id) => { ctx.sessions.open(id); },\n currentSessionId: () => ctx.sessions.list.getSnapshot().current,\n }),\n }, AgentTeamsCard));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EASA,SAAgB,gCAAgC,MAAM,OAAO,SAAS;GAClE,OAAO,QAAQ,UAAU,KAAA,KAAa,UAAU;EACpD;;EAEA,SAAgB,WAAW,OAAO;GAC9B,MAAM,0BAAU,IAAI,IAAI;GACxB,KAAK,MAAM,QAAQ,OAAO;IACtB,MAAM,QAAQ,OAAO,SAAS,KAAK,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,KAAK,CAAC,IAAI;IAClF,MAAM,QAAQ,QAAQ,IAAI,KAAK,KAAK,CAAC;IACrC,MAAM,KAAK,IAAI;IACf,QAAQ,IAAI,OAAO,KAAK;GAC5B;GACA,OAAO,CAAC,GAAG,QAAQ,QAAQ,CAAC,CAAC,CACxB,MAAM,CAAC,OAAO,CAAC,WAAW,OAAO,KAAK,CAAC,CACvC,KAAK,CAAC,OAAO,iB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O;IACX,MAAM,QAAQ,QAAQ;IACtB,IAAI,CAAC,MAAM,UACP,OAAO;IACX,OAAO;KACH,KAAK,QAAQ;KACb,MAAM;KACN,IAAI,QAAQ;KACZ,QAAQ;KACR,WAAW,QAAQ,MAAM,MAAM;KAC/B,UAAU,QAAQ,MAAM;KACxB,YAAY;KACZ,MAAM;MACF,QAAQ,MAAM;MACd,kBAAkB;MAClB,UAAU,MAAM;MAChB,SAAS,CAAC;KACd;IACJ;GACJ;EACJ;;;;EC9EA,MAAa,SAAS;GAAC;GAAsB;GAAS;EAAU;;;;;;;EAOhE,SAAgB,MAAM,KAAK;GACvB,MAAM,OAAO,SAAS,cAAc,KAAK;GACzC,KAAK,QAAQ,iBAAiB;GAC9B,SAAS,KAAK,YAAY,IAAI;GAC9B,MAAM,QAAA,GAAA,iBAAA,WAAA,CAAkB,IAAI;GAC5B,KAAK,QAAA,GAAA,kBAAA,IAAA,CAAY,eAAe;IAAE,cAAc,IAAI,SAAS;IAAM,cAAc,OAAO;KAAE,IAAI,SAAS,KAAK,EAAE;IAAG;GAAE,CAAC,CAAC;GACrH,IAAI,mBAAmB;IACnB,KAAK,QAAQ;IACb,KAAK,OAAO;GAChB,GAAG,6BAA6B;GAChC,IAAI,mBAAmB,SAAS,wBAAwB;GACxD,IAAI,MAAM,OAAO,gCAAgC,IAAI,MAAM,SAAS;IAChE,MAAM;IACN,KAAK;IACL,eAAe;KACX,cAAc,OAAO;MAAE,IAAI,SAAS,KAAK,EAAE;KAAG;KAC9C,wBAAwB,IAAI,SAAS,KAAK,YAAY,CAAC,CAAC;IAC5D;GACJ,GAAG,cAAc,CAAC;EACtB"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * AgentTeams session event types — pure types only, zero imports.
3
+ *
4
+ * This file intentionally imports nothing: both the host program (the
5
+ * emitter in `events.ts`) and the browser program (the Conversation Node
6
+ * definition) must be able to load these types and the `SessionEventMap`
7
+ * declaration merge without pulling in host-side `Context` augmentations
8
+ * (dsh-session's index declares `Context.sessions: SessionStore`, which
9
+ * collides with the browser runtime's `ISessions` under the same name).
10
+ * @module dsh-agent-teams/event-types
11
+ */
12
+ export {};
package/lib/events.js ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Durable AgentTeams session events and their emitter.
3
+ *
4
+ * Every team-state mutation appends one event to the captain's Session, so
5
+ * the web client's Conversation Node mechanism can fold the tree view from
6
+ * the session log deterministically (same mechanism as `tool-workflow`'s
7
+ * `tool-workflow/*` record events). Events append to the captain's session
8
+ * even when a member agent performed the mutation, so the captain's
9
+ * conversation stream stays the single authoritative monitor surface.
10
+ *
11
+ * Types and the `SessionEventMap` merge live in `event-types.ts` (zero
12
+ * imports) so the browser program can load them without host augmentations.
13
+ * @module dsh-agent-teams/events
14
+ */
15
+ import * as dshSession from '@deepseek-ai/dsh-session';
16
+ /** Event types already reported as unsupported, to avoid repetitive logs. */
17
+ const skippedEventTypes = new Set();
18
+ /**
19
+ * Append one AgentTeams event to a Session, containing failures (a broken
20
+ * durable record must never break team tool execution).
21
+ * @param ctx - the plugin context (for logging).
22
+ * @param session - the session to record into (the captain's, normally).
23
+ * @param type - the event type.
24
+ * @param data - the event payload.
25
+ */
26
+ export function appendTeamEvent(ctx, session, type, data) {
27
+ // Out-of-repo events are not in the harness's generated vocabulary today.
28
+ // Mutating that ReadonlySet would make readability depend on which plugins
29
+ // happen to be loaded. Until Session.append exposes the official
30
+ // `ignorable: true` writer surface, omit these informational records unless
31
+ // the running harness already recognizes them. Disk state remains the
32
+ // authoritative source for the activity panel.
33
+ const known = dshSession.KNOWN_SESSION_EVENT_TYPES;
34
+ if (known?.has(type) !== true) {
35
+ if (!skippedEventTypes.has(type)) {
36
+ skippedEventTypes.add(type);
37
+ ctx.logger.debug(`agent-teams: session event "${type}" omitted because this harness does not recognize it`);
38
+ }
39
+ return;
40
+ }
41
+ try {
42
+ session.append(type, data);
43
+ }
44
+ catch (error) {
45
+ ctx.logger.warn(`agent-teams: session record failed after ${type}: ${String(error)}`);
46
+ }
47
+ }
48
+ /**
49
+ * Resolve the captain's live Session for event recording. The captain agent
50
+ * may be offline (its team outlives the session), in which case the caller's
51
+ * own session is used as the fallback record target.
52
+ * @param ctx - the plugin context (injects `agents`).
53
+ * @param captainSessionId - the captain's durable session id.
54
+ * @param fallback - the calling agent's session, used when the captain is not live.
55
+ * @returns the session to record into.
56
+ */
57
+ export function captainSessionOf(ctx, captainSessionId, fallback) {
58
+ const captain = ctx.agents.get(captainSessionId);
59
+ return captain?.session ?? fallback;
60
+ }
package/lib/index.js ADDED
@@ -0,0 +1,172 @@
1
+ /**
2
+ * AgentTeams for DeepSeek Harness.
3
+ *
4
+ * A host-plane plugin that registers the `agent_teams_*` tools and one usage
5
+ * section into the global system prompt. After installation any session can
6
+ * run multi-agent teamwork through natural language (e.g. "use AgentTeams to research X"):
7
+ * the model creates a team (it becomes the captain), spawns members as
8
+ * durable continuable subagents, breaks the goal into tasks with
9
+ * dependencies, wakes members with messages, relays reports, and collects
10
+ * results.
11
+ *
12
+ * Installation (bundle): `dsh plugin --profile <name> add @nanmicoder/dsh-agent-teams`
13
+ * (or a local path). The bundle patch mounts this plugin row into the host
14
+ * composition; the tools register into the shared `tools` registry and the
15
+ * usage section into the global system prompt, so the plugin needs no realm.
16
+ *
17
+ * @module dsh-agent-teams
18
+ */
19
+ import z from '@deepseek-ai/schemastery';
20
+ import { registerAgentTeamsTools } from "./tools.js";
21
+ import { readFile } from 'node:fs/promises';
22
+ import { join } from 'node:path';
23
+ import { fileURLToPath } from 'node:url';
24
+ import { collectArchivedTeamsActivity, collectTeamsActivity } from "./snapshot.js";
25
+ /** Web-server service key candidates, newest first. */
26
+ const WEB_SERVER_KEYS = ['webServer', 'httpServer'];
27
+ /** Workspace registry service key candidates, newest first. */
28
+ const WORKSPACE_KEYS = ['workspaceRegistry', 'workspace'];
29
+ export const name = 'agent-teams';
30
+ export const inject = ['tools', 'subagents', 'systemPrompt', 'agents'];
31
+ export const Config = z.object({
32
+ stateDir: z.string().default('.agent-teams'),
33
+ memberProvider: z.string().default('spawn'),
34
+ memberModel: z.string(),
35
+ memberMaxDepth: z.natural().default(1),
36
+ maxMembers: z.natural().min(1).default(8),
37
+ promptSectionOrder: z.natural().default(117),
38
+ });
39
+ /** The model-facing usage policy: when and how to drive AgentTeams. */
40
+ function usageSectionText(toolNames) {
41
+ return `When the user asks to run something with AgentTeams (e.g. "use AgentTeams to do X"), you are the captain of a multi-agent team. Follow this protocol:
42
+ 1. Call agent_teams_create with a team name and the goal as description. You become the captain and may lead one team at a time.
43
+ 2. Call agent_teams_add_member once per role the goal needs (researcher, engineer, reviewer, ...). Members are durable subagents: they wait for your messages, then work a full turn.
44
+ 3. Break the goal into tasks with agent_teams_create_task; wire dependencies between tasks (a task is claimable only when its dependencies are completed). Assign each task to a member when it fits a role.
45
+ 4. Dispatch work: claim each assigned task (agent_teams_claim_task with assignee) and wake the member with agent_teams_send_message naming its task id and instructions. One task per message keeps turns focused.
46
+ 5. Poll agent_teams_status until members are idle; relay member-to-member messages (agent_teams_send_message with from=<sender>) and collect completed tasks' outputs. If a member reports a blocker, reassign the task or adjust the plan.
47
+ 6. Present the team's results to the user, then agent_teams_delete the team unless the user wants to keep working with it.
48
+
49
+ Tools: ${toolNames}`;
50
+ }
51
+ export function apply(ctx, config) {
52
+ const resolved = {
53
+ stateDir: config.stateDir ?? '.agent-teams',
54
+ memberProvider: config.memberProvider ?? 'spawn',
55
+ memberModel: config.memberModel,
56
+ memberMaxDepth: config.memberMaxDepth ?? 1,
57
+ maxMembers: config.maxMembers ?? 8,
58
+ };
59
+ // Provider registration is a sibling plugin's effect (`subagent-spawn` /
60
+ // `subagent-fork` rows), which can land after this mount under the Loader's
61
+ // concurrent activation — so capability validation happens at the first
62
+ // member spawn (`spawnMember`), the earliest point the provider list is
63
+ // settled, rather than here.
64
+ const toolNames = [
65
+ 'agent_teams_create',
66
+ 'agent_teams_add_member',
67
+ 'agent_teams_remove_member',
68
+ 'agent_teams_create_task',
69
+ 'agent_teams_claim_task',
70
+ 'agent_teams_update_task',
71
+ 'agent_teams_send_message',
72
+ 'agent_teams_status',
73
+ 'agent_teams_delete',
74
+ ].join(', ');
75
+ ctx.systemPrompt.section({
76
+ name: 'agent-teams:usage',
77
+ order: config.promptSectionOrder ?? 117,
78
+ text: usageSectionText(toolNames),
79
+ });
80
+ registerAgentTeamsTools(ctx, resolved);
81
+ // The activity panel data/artwork routes need the Web server and the
82
+ // workspace registry, which headless profiles do not mount; under
83
+ // concurrent activation they may also bind after this plugin. Register the
84
+ // routes lazily: try now, then on each service binding event. In a webless
85
+ // profile the plugin stays tool-only and never blocks boot.
86
+ let webRegistered = false;
87
+ const registerWebSurface = () => {
88
+ if (webRegistered)
89
+ return;
90
+ const webServer = (ctx.get(WEB_SERVER_KEYS[0]) ?? ctx.get(WEB_SERVER_KEYS[1]));
91
+ const workspaceRegistry = (ctx.get(WORKSPACE_KEYS[0]) ?? ctx.get(WORKSPACE_KEYS[1]));
92
+ if (webServer === undefined || workspaceRegistry === undefined)
93
+ return;
94
+ webRegistered = true;
95
+ // Activity panel data route: the browser floater polls this for team
96
+ // snapshots (disk truth + live subagent activity). Mirrors the Claude
97
+ // Code desktop watcher's server-side snapshot pattern.
98
+ ctx.effect(() => webServer.register({
99
+ kind: 'exact',
100
+ path: '/plugins/dsh-agent-teams/state',
101
+ handler: async (req, res) => {
102
+ const url = new URL(req.url ?? '/', 'http://x');
103
+ const roots = workspaceRegistry.list().map((workspace) => ({
104
+ workspace: workspace.title,
105
+ stateRoot: join(workspace.path, resolved.stateDir),
106
+ }));
107
+ // ?archived=1 serves teams moved to archive/ (post-delete review).
108
+ const snapshots = url.searchParams.get('archived') === '1'
109
+ ? await collectArchivedTeamsActivity(ctx, roots)
110
+ : await collectTeamsActivity(ctx, roots);
111
+ const body = JSON.stringify({ teams: snapshots });
112
+ res.writeHead(200, {
113
+ 'content-type': 'application/json; charset=utf-8',
114
+ 'cache-control': 'no-store',
115
+ });
116
+ res.end(body);
117
+ },
118
+ }), 'agent-teams: activity route');
119
+ // Whale mascot artwork: serve the packaged role/action images to the
120
+ // activity panel. An explicit allowlist guards the route (no path
121
+ // traversal); the images ship with the bundle (files: assets/).
122
+ const artDir = fileURLToPath(new URL('../assets/agent-teams/', import.meta.url));
123
+ const ART_ALLOWLIST = new Set([
124
+ 'team-lead.png', 'researcher.png', 'engineer.png', 'designer.png',
125
+ 'qa-engineer.png', 'security-reviewer.png', 'data-analyst.png',
126
+ 'docs-coordinator.png', 'action-working.png', 'action-thinking.png',
127
+ 'action-reporting.png', 'action-celebrating.png', 'action-sleeping.png',
128
+ 'action-sending.png',
129
+ ]);
130
+ ctx.effect(() => webServer.register({
131
+ kind: 'prefix',
132
+ path: '/plugins/dsh-agent-teams/assets',
133
+ handler: async (req, res) => {
134
+ let name;
135
+ try {
136
+ name = decodeURIComponent(new URL(req.url ?? '/', 'http://x').pathname.split('/').pop() ?? '');
137
+ }
138
+ catch {
139
+ // Malformed percent-encoding: treat as an unknown asset, not a 400.
140
+ res.writeHead(404);
141
+ res.end();
142
+ return;
143
+ }
144
+ if (!ART_ALLOWLIST.has(name)) {
145
+ res.writeHead(404);
146
+ res.end();
147
+ return;
148
+ }
149
+ try {
150
+ const data = await readFile(join(artDir, name));
151
+ res.writeHead(200, {
152
+ 'content-type': 'image/png',
153
+ 'cache-control': 'public, max-age=86400',
154
+ });
155
+ res.end(data);
156
+ }
157
+ catch (error) {
158
+ ctx.logger.warn(`agent-teams: artwork read failed for ${name}: ${String(error)}`);
159
+ res.writeHead(404);
160
+ res.end();
161
+ }
162
+ },
163
+ }), 'agent-teams: artwork route');
164
+ };
165
+ registerWebSurface();
166
+ ctx.on('internal/service', (name) => {
167
+ if (WEB_SERVER_KEYS.includes(name)
168
+ || WORKSPACE_KEYS.includes(name)) {
169
+ registerWebSurface();
170
+ }
171
+ });
172
+ }
package/lib/members.js ADDED
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Member subagent lifecycle: spawn a continuable child per member, deliver
3
+ * messages into its FIFO inbox, and observe its activity.
4
+ *
5
+ * Members are durable continuable subagents of the captain, so a member keeps
6
+ * its conversation across turns and across harness restarts: the captain
7
+ * wakes it with {@link ctx.subagents.followup}, it works through its turn
8
+ * (updating team state through the `agent_teams_*` tools), and becomes idle
9
+ * again. Its final assistant message is not readable programmatically, so the
10
+ * member persists its report into the captain's mailbox and the task records,
11
+ * which the captain reads through `agent_teams_status`.
12
+ * @module dsh-agent-teams/members
13
+ */
14
+ /** Captain-only AgentTeams tools hidden from newly spawned members. */
15
+ const MEMBER_DENIED_TOOLS = [
16
+ 'agent_teams_create',
17
+ 'agent_teams_add_member',
18
+ 'agent_teams_remove_member',
19
+ 'agent_teams_create_task',
20
+ 'agent_teams_delete',
21
+ ];
22
+ /**
23
+ * Restore the SessionId brand on a value that round-tripped through the
24
+ * durable team file. The brand is erased by JSON serialization; the value
25
+ * originated from `startContinuable`/`agent.id`, so this cast is the boundary
26
+ * restoration, not a new assertion.
27
+ */
28
+ function brandedSessionId(value) {
29
+ return value;
30
+ }
31
+ /**
32
+ * The member's system prompt (persona), shadowing the deployment persona for
33
+ * that child. Self-contained: it replaces the whole persona section.
34
+ * @param team - the team the member joined.
35
+ * @param member - the member record (name/role are read before spawning).
36
+ * @param stateDir - configured state directory, so the member can locate the
37
+ * team files with its own file tools.
38
+ */
39
+ export function memberPersona(team, member, stateDir) {
40
+ return `You are ${member.name}, a member of the multi-agent team "${team.name}" running inside DeepSeek Harness AgentTeams. The captain leads the team; you are a worker member${member.role ? ` with the role: ${member.role}` : ''}.
41
+
42
+ Team context:
43
+ - Team id: ${team.id}
44
+ - Your name inside the team (use it as \`from\`/identity): ${member.name}
45
+ - The team state lives under ${stateDir}/${team.id}/ (team.json and inbox/*.jsonl). You may inspect these files read-only for diagnostics, but never edit them directly; use the agent_teams_* tools so JSON escaping and concurrent updates stay safe.
46
+ - The captain and your teammates reach you through messages. Each message you receive is a new turn: act on it and end your turn with a concise reply.
47
+
48
+ Working rules:
49
+ 1. When the captain assigns you a task, call agent_teams_claim_task with the task id to claim it, then agent_teams_update_task (status=in_progress) once you start working.
50
+ 2. Work thoroughly with your available tools; do not cut corners.
51
+ 3. When finished, call agent_teams_update_task with status=completed and a concise \`output\` summarizing what you did and the key results.
52
+ 4. Send a short report to the captain with agent_teams_send_message (to=captain) when you complete a task or hit a blocker.
53
+ 5. To ask a teammate something, use agent_teams_send_message with to=<teammate name>; the message lands in their mailbox and wakes them directly — teammates talk to each other without the captain in the loop. The same applies to the captain (to=captain).
54
+ 6. You are a worker: do not create or delete teams, and do not add or remove members — that is the captain's job.`;
55
+ }
56
+ /**
57
+ * The initial user message delivered when the member is created.
58
+ * @param team - the team the member joined.
59
+ */
60
+ export function memberWelcome(team) {
61
+ return `You have joined the team "${team.name}" as a member. The captain will send you tasks and messages; wait for instructions. Current team status: ${team.tasks.length} task(s), none assigned to you yet.`;
62
+ }
63
+ /**
64
+ * Spawn one member as a durable continuable subagent of the captain and fill
65
+ * `member.id` with its child session id. On failure nothing is persisted.
66
+ * @param ctx - the plugin context (injects `subagents`).
67
+ * @param config - member runtime knobs.
68
+ * @param captain - the exact live captain agent (the calling agent).
69
+ * @param team - the team record (read-only here).
70
+ * @param member - the member draft whose `id` is filled on success.
71
+ * @param stateDir - configured state directory (for the persona).
72
+ * @param signal - caller cancellation, forwarded to the start.
73
+ */
74
+ export async function spawnMember(ctx, config, captain, team, member, stateDir, signal) {
75
+ // Fail loud at the first use: provider registration is a sibling plugin's
76
+ // effect and may settle after this plugin mounts. Capability checks here
77
+ // mirror what startContinuable would reject, with an actionable error.
78
+ const provider = ctx.subagents.getProvider(config.provider);
79
+ if (provider === undefined) {
80
+ throw new Error(`agent-teams: no subagent provider "${config.provider}" is registered (available: ${ctx.subagents.list().join(', ') || 'none'}) — `
81
+ + 'check that the subagent provider row (e.g. subagent-spawn) is mounted in the composition');
82
+ }
83
+ if (provider.prepareContinuable === undefined) {
84
+ throw new Error(`agent-teams: provider "${config.provider}" does not support continuable members`);
85
+ }
86
+ if (!provider.capabilities.persona) {
87
+ throw new Error(`agent-teams: provider "${config.provider}" cannot apply a member persona`);
88
+ }
89
+ if (!provider.capabilities.toolFilter) {
90
+ throw new Error(`agent-teams: provider "${config.provider}" cannot restrict captain-only tools for members`);
91
+ }
92
+ const start = await ctx.subagents.startContinuable({
93
+ provider: config.provider,
94
+ label: `agent-teams:${team.id}:${member.name}`,
95
+ request: {
96
+ prompt: [{ type: 'text', text: memberWelcome(team) }],
97
+ parent: captain,
98
+ persona: memberPersona(team, member, stateDir),
99
+ toolFilter: { deny: [...MEMBER_DENIED_TOOLS] },
100
+ ...config.model !== undefined ? { agentOptions: { model: config.model } } : {},
101
+ ...config.maxDepth !== undefined ? { maxDepth: config.maxDepth } : {},
102
+ },
103
+ signal,
104
+ });
105
+ member.id = start.childId;
106
+ }
107
+ /**
108
+ * Deliver one message to a member as its next FIFO turn. Best effort: a
109
+ * failure (member gone or not continuable) is logged and reported as `false`
110
+ * so the caller can decide (mailbox delivery still happened).
111
+ *
112
+ * Any team sender can route through this helper: the captain is the direct
113
+ * parent of every member, and the caller passes the captain's live Agent
114
+ * (its own when the captain calls, the registry-resolved one when a member
115
+ * sends) — mirroring the Claude Code mailbox model where the writer writes
116
+ * the target's inbox and the target picks it up on its own.
117
+ * @param ctx - the plugin context (injects `subagents`).
118
+ * @param captain - the exact live captain agent (the member's direct parent).
119
+ * @param childId - the member's durable child session id.
120
+ * @param text - the message content.
121
+ * @param signal - caller cancellation, forwarded to the delivery.
122
+ * @returns whether the member inbox accepted the message.
123
+ */
124
+ export async function deliverToMember(ctx, captain, childId, text, signal) {
125
+ try {
126
+ await ctx.subagents.followup(captain, brandedSessionId(childId), [{ type: 'text', text }], {
127
+ source: { kind: 'plugin', plugin: 'dsh-agent-teams' },
128
+ signal,
129
+ });
130
+ return true;
131
+ }
132
+ catch (error) {
133
+ ctx.logger.warn(`agent-teams: followup to member ${childId} failed: ${String(error)}`);
134
+ return false;
135
+ }
136
+ }
137
+ /**
138
+ * Request cancellation of one live member's current turn. Best effort, fire
139
+ * and return; the target may keep running until it observes the signal.
140
+ * @param ctx - the plugin context (injects `subagents`).
141
+ * @param captain - the exact live captain agent (the member's parent).
142
+ * @param childId - the member's durable child session id.
143
+ */
144
+ export function interruptMember(ctx, captain, childId) {
145
+ try {
146
+ ctx.subagents.interrupt(brandedSessionId(childId), { kind: 'ancestor', agent: captain });
147
+ }
148
+ catch (error) {
149
+ ctx.logger.warn(`agent-teams: interrupt of member ${childId} failed: ${String(error)}`);
150
+ }
151
+ }
152
+ /**
153
+ * Snapshot each direct continuable child's activity under the captain's
154
+ * session, keyed by child session id. A member that is currently running its
155
+ * turn reports `running`; an idle member reports `inactive`.
156
+ * @param ctx - the plugin context (injects `subagents`).
157
+ * @param captainSessionId - the captain's session id.
158
+ * @returns child id → activity, missing entries are unknown children.
159
+ */
160
+ export async function memberActivity(ctx, captainSessionId) {
161
+ const entries = await ctx.subagents.listChildren(brandedSessionId(captainSessionId));
162
+ const activity = new Map();
163
+ for (const entry of entries) {
164
+ if (entry.kind === 'child')
165
+ activity.set(entry.id, entry.activity);
166
+ }
167
+ return activity;
168
+ }