feat(v2): add agent teams support with subagent pane spawning and routing

Detect subagent tool_call events (Agent/Task/dispatch_agent), auto-spawn
child agent panes with parent/child navigation. Messages with parentId
are routed to child panes; parent session keeps its own messages.

- agents.svelte.ts: parent/child hierarchy fields, findChildByToolUseId,
  getChildSessions, parent-aware createAgentSession/removeAgentSession
- agent-dispatcher.ts: SUBAGENT_TOOL_NAMES detection, toolUseToChildPane
  routing map, spawnSubagentPane with auto-grouping under parent title
- AgentPane.svelte: parent link bar (SUB badge), children bar (chips
  with status colors), clickable navigation between parent/child
- SessionList.svelte: subagent panes show arrow icon instead of asterisk
This commit is contained in:
Hibryda 2026-03-06 16:54:27 +01:00
parent d021061b8a
commit 07fc52b958
4 changed files with 220 additions and 6 deletions

View file

@ -43,7 +43,8 @@
}
}
function paneIcon(type: string): string {
function paneIcon(type: string, title: string): string {
if (type === 'agent' && title.startsWith('Sub: ')) return '↳';
switch (type) {
case 'terminal': return '>';
case 'agent': return '*';
@ -153,7 +154,7 @@
{#snippet paneItem(pane: Pane)}
<li class="pane-item" class:focused={pane.focused}>
<button class="pane-btn" onclick={() => focusPane(pane.id)} oncontextmenu={(e) => { e.preventDefault(); setGroup(pane.id); }}>
<span class="pane-icon">{paneIcon(pane.type)}</span>
<span class="pane-icon">{paneIcon(pane.type, pane.title)}</span>
<span class="pane-name">{pane.title}</span>
</button>
<button class="remove-btn" onclick={() => removePane(pane.id)}>&times;</button>