agent-relay-server 0.96.0 → 0.97.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 (142) hide show
  1. package/docs/openapi.json +1 -1
  2. package/package.json +2 -2
  3. package/public/assets/MessageBubble-CIDyX8f7.js +4 -0
  4. package/public/assets/{MessageBubble-BO9eaLce.js.map → MessageBubble-CIDyX8f7.js.map} +1 -1
  5. package/public/assets/{PlanGraphPanel-BK2GoOql.js → PlanGraphPanel-BmWB81w_.js} +2 -2
  6. package/public/assets/{PlanGraphPanel-BK2GoOql.js.map → PlanGraphPanel-BmWB81w_.js.map} +1 -1
  7. package/public/assets/{activity-FPNsylmj.js → activity-QQikHZe4.js} +2 -2
  8. package/public/assets/{activity-FPNsylmj.js.map → activity-QQikHZe4.js.map} +1 -1
  9. package/public/assets/agent-profiles-WvAN5cR_.js +2 -0
  10. package/public/assets/agent-profiles-WvAN5cR_.js.map +1 -0
  11. package/public/assets/agents-BsFfumLn.js +2 -0
  12. package/public/assets/{agents-DwXYbjeZ.js.map → agents-BsFfumLn.js.map} +1 -1
  13. package/public/assets/{analytics-BiYHZABE.js → analytics-CUJbpoA7.js} +2 -2
  14. package/public/assets/{analytics-BiYHZABE.js.map → analytics-CUJbpoA7.js.map} +1 -1
  15. package/public/assets/{automation-deDG3zs5.js → automation-BTbpiINE.js} +2 -2
  16. package/public/assets/{automation-deDG3zs5.js.map → automation-BTbpiINE.js.map} +1 -1
  17. package/public/assets/{badge-BbfOskRI.js → badge-BLar6FjP.js} +2 -2
  18. package/public/assets/{badge-BbfOskRI.js.map → badge-BLar6FjP.js.map} +1 -1
  19. package/public/assets/branch-state-badge-CNko2_BL.js +2 -0
  20. package/public/assets/{branch-state-badge-ClWlvQks.js.map → branch-state-badge-CNko2_BL.js.map} +1 -1
  21. package/public/assets/{button-DWiw--lT.js → button-BrIB69qd.js} +2 -2
  22. package/public/assets/{button-DWiw--lT.js.map → button-BrIB69qd.js.map} +1 -1
  23. package/public/assets/card-lhnFnBoz.js +2 -0
  24. package/public/assets/{card-BeqvuYTT.js.map → card-lhnFnBoz.js.map} +1 -1
  25. package/public/assets/{channels-ln-_oQlI.js → channels-Tg8l4n5J.js} +2 -2
  26. package/public/assets/{channels-ln-_oQlI.js.map → channels-Tg8l4n5J.js.map} +1 -1
  27. package/public/assets/chat-BlFUmD3r.js +2 -0
  28. package/public/assets/{chat-DH8vR-mf.js.map → chat-BlFUmD3r.js.map} +1 -1
  29. package/public/assets/{connectors-CmxpixdH.js → connectors-B5wbjyUd.js} +2 -2
  30. package/public/assets/{connectors-CmxpixdH.js.map → connectors-B5wbjyUd.js.map} +1 -1
  31. package/public/assets/copy-button-Cd-LbSbg.js +2 -0
  32. package/public/assets/{copy-button-CIXy8ks6.js.map → copy-button-Cd-LbSbg.js.map} +1 -1
  33. package/public/assets/dist-30weaXto.js +2 -0
  34. package/public/assets/{dist-LFuRypZd.js.map → dist-30weaXto.js.map} +1 -1
  35. package/public/assets/{dist-CtuS_3Jl.js → dist-B5VvlkhI.js} +2 -2
  36. package/public/assets/{dist-CtuS_3Jl.js.map → dist-B5VvlkhI.js.map} +1 -1
  37. package/public/assets/dist-BEzpMqLy.js +2 -0
  38. package/public/assets/{dist-Q6OOS84U.js.map → dist-BEzpMqLy.js.map} +1 -1
  39. package/public/assets/{dist-CbxR2pzD.js → dist-BjOBkHHY.js} +2 -2
  40. package/public/assets/{dist-CbxR2pzD.js.map → dist-BjOBkHHY.js.map} +1 -1
  41. package/public/assets/{dist-zTw85jD8.js → dist-BnbGIUmi.js} +2 -2
  42. package/public/assets/{dist-zTw85jD8.js.map → dist-BnbGIUmi.js.map} +1 -1
  43. package/public/assets/{dist-BufB2Xy_.js → dist-Bp10H3oR.js} +2 -2
  44. package/public/assets/{dist-BufB2Xy_.js.map → dist-Bp10H3oR.js.map} +1 -1
  45. package/public/assets/{dist-Du_bcq-z.js → dist-CQF3Jiqg.js} +2 -2
  46. package/public/assets/{dist-Du_bcq-z.js.map → dist-CQF3Jiqg.js.map} +1 -1
  47. package/public/assets/dist-Cgy0FmP-.js +2 -0
  48. package/public/assets/{dist-CXkmW1Od.js.map → dist-Cgy0FmP-.js.map} +1 -1
  49. package/public/assets/{dist-KxiSP9h9.js → dist-DAl28ejX.js} +2 -2
  50. package/public/assets/{dist-KxiSP9h9.js.map → dist-DAl28ejX.js.map} +1 -1
  51. package/public/assets/{dist-eG_93I3z.js → dist-DDUGmmoi.js} +2 -2
  52. package/public/assets/{dist-eG_93I3z.js.map → dist-DDUGmmoi.js.map} +1 -1
  53. package/public/assets/{dist-BQXmO19g.js → dist-DZ97OosY.js} +2 -2
  54. package/public/assets/{dist-BQXmO19g.js.map → dist-DZ97OosY.js.map} +1 -1
  55. package/public/assets/{es2015-ibwCE_JR.js → es2015-B8Z9p8oQ.js} +2 -2
  56. package/public/assets/{es2015-ibwCE_JR.js.map → es2015-B8Z9p8oQ.js.map} +1 -1
  57. package/public/assets/{formatted-body-impl-l_m1i28m.js → formatted-body-impl-Dbjjdcu9.js} +2 -2
  58. package/public/assets/{formatted-body-impl-l_m1i28m.js.map → formatted-body-impl-Dbjjdcu9.js.map} +1 -1
  59. package/public/assets/index-CPWbr4sq.css +2 -0
  60. package/public/assets/index-CPXz74W5.js +23 -0
  61. package/public/assets/index-CPXz74W5.js.map +1 -0
  62. package/public/assets/{input-DUdtS3nG.js → input-B_fUHtLD.js} +2 -2
  63. package/public/assets/{input-DUdtS3nG.js.map → input-B_fUHtLD.js.map} +1 -1
  64. package/public/assets/{insights-DpNVkiVq.js → insights-D1Oq25BL.js} +2 -2
  65. package/public/assets/{insights-DpNVkiVq.js.map → insights-D1Oq25BL.js.map} +1 -1
  66. package/public/assets/{integrations-DscgKx2I.js → integrations-sYKtupOq.js} +2 -2
  67. package/public/assets/{integrations-DscgKx2I.js.map → integrations-sYKtupOq.js.map} +1 -1
  68. package/public/assets/{lib-Gp69YB9e.js → lib-ng6WZYjE.js} +2 -2
  69. package/public/assets/{lib-Gp69YB9e.js.map → lib-ng6WZYjE.js.map} +1 -1
  70. package/public/assets/{lucide-react-uFIMC7W7.js → lucide-react-BYZuAhQs.js} +2 -2
  71. package/public/assets/{lucide-react-uFIMC7W7.js.map → lucide-react-BYZuAhQs.js.map} +1 -1
  72. package/public/assets/maintenance-CgXJwFTo.js +2 -0
  73. package/public/assets/{maintenance-BhAxK-Fd.js.map → maintenance-CgXJwFTo.js.map} +1 -1
  74. package/public/assets/{managed-agents-Bg4aG1a9.js → managed-agents-CbuFHwWE.js} +4 -4
  75. package/public/assets/{managed-agents-Bg4aG1a9.js.map → managed-agents-CbuFHwWE.js.map} +1 -1
  76. package/public/assets/markdown-preview-impl-B79bSsKK.js +2 -0
  77. package/public/assets/{markdown-preview-impl-BJHjAo1H.js.map → markdown-preview-impl-B79bSsKK.js.map} +1 -1
  78. package/public/assets/memory-Box_rMj_.js +2 -0
  79. package/public/assets/{memory-WwrerNC0.js.map → memory-Box_rMj_.js.map} +1 -1
  80. package/public/assets/{messages-BY6mboBf.js → messages-BXIHBaN2.js} +2 -2
  81. package/public/assets/{messages-BY6mboBf.js.map → messages-BXIHBaN2.js.map} +1 -1
  82. package/public/assets/{orchestrators-ClNqQHnw.js → orchestrators-MNj_mp3U.js} +2 -2
  83. package/public/assets/{orchestrators-ClNqQHnw.js.map → orchestrators-MNj_mp3U.js.map} +1 -1
  84. package/public/assets/{overview-Bk91s8bA.js → overview-KfwJgCUa.js} +2 -2
  85. package/public/assets/{overview-Bk91s8bA.js.map → overview-KfwJgCUa.js.map} +1 -1
  86. package/public/assets/{pairs-IxkuPIfN.js → pairs-DfrGWlgL.js} +2 -2
  87. package/public/assets/{pairs-IxkuPIfN.js.map → pairs-DfrGWlgL.js.map} +1 -1
  88. package/public/assets/{projects-D7WJtj7Y.js → projects-BPI8z55X.js} +2 -2
  89. package/public/assets/{projects-D7WJtj7Y.js.map → projects-BPI8z55X.js.map} +1 -1
  90. package/public/assets/{react-dom-DF2cuNaf.js → react-dom-Dbhs84ug.js} +2 -2
  91. package/public/assets/{react-dom-DF2cuNaf.js.map → react-dom-Dbhs84ug.js.map} +1 -1
  92. package/public/assets/{registry-DUzVG_Oi.js → registry-CiBC97sL.js} +2 -2
  93. package/public/assets/{registry-DUzVG_Oi.js.map → registry-CiBC97sL.js.map} +1 -1
  94. package/public/assets/{security-D9ru8DHd.js → security-BbU_vIdb.js} +2 -2
  95. package/public/assets/{security-D9ru8DHd.js.map → security-BbU_vIdb.js.map} +1 -1
  96. package/public/assets/{select-Bu-gipoC.js → select-CeQwmVTm.js} +2 -2
  97. package/public/assets/{select-Bu-gipoC.js.map → select-CeQwmVTm.js.map} +1 -1
  98. package/public/assets/settings-DBsL3jb7.js +6 -0
  99. package/public/assets/{settings-CoOySnqS.js.map → settings-DBsL3jb7.js.map} +1 -1
  100. package/public/assets/{store-DGM2s9L1.js → store-pKbf_WYd.js} +5 -5
  101. package/public/assets/{store-DGM2s9L1.js.map → store-pKbf_WYd.js.map} +1 -1
  102. package/public/assets/{tasks-C94dSpvI.js → tasks-za0RxIQw.js} +2 -2
  103. package/public/assets/{tasks-C94dSpvI.js.map → tasks-za0RxIQw.js.map} +1 -1
  104. package/public/assets/{teams-Cq7HWQe9.js → teams-ByAqwLG9.js} +2 -2
  105. package/public/assets/{teams-Cq7HWQe9.js.map → teams-ByAqwLG9.js.map} +1 -1
  106. package/public/assets/{terminal-viewer-impl-BQr-VK32.js → terminal-viewer-impl-CkoWD5D_.js} +3 -3
  107. package/public/assets/{terminal-viewer-impl-BQr-VK32.js.map → terminal-viewer-impl-CkoWD5D_.js.map} +1 -1
  108. package/public/assets/{use-keyboard-viewport-CeLM-PeW.js → use-keyboard-viewport-D8_NYDkh.js} +2 -2
  109. package/public/assets/{use-keyboard-viewport-CeLM-PeW.js.map → use-keyboard-viewport-D8_NYDkh.js.map} +1 -1
  110. package/public/assets/user-avatar-Q_N6iHEn.js +2 -0
  111. package/public/assets/{user-avatar-aCd8Fb5v.js.map → user-avatar-Q_N6iHEn.js.map} +1 -1
  112. package/public/assets/{work-queue-BuyQhedx.js → work-queue-DfRo1B2P.js} +2 -2
  113. package/public/assets/{work-queue-BuyQhedx.js.map → work-queue-DfRo1B2P.js.map} +1 -1
  114. package/public/assets/workspaces-BolccWZy.js +3 -0
  115. package/public/assets/{workspaces-DXTrd2or.js.map → workspaces-BolccWZy.js.map} +1 -1
  116. package/public/index.html +21 -21
  117. package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
  118. package/src/agent-busy-health.ts +22 -20
  119. package/src/mcp/tools-spawn.ts +13 -2
  120. package/src/mcp-team-template-tools.ts +8 -1
  121. package/src/routes/agents-spawn.ts +4 -2
  122. package/src/services/spawn-agent.ts +46 -1
  123. package/public/assets/MessageBubble-BO9eaLce.js +0 -4
  124. package/public/assets/agent-profiles-lEZqu7Gm.js +0 -2
  125. package/public/assets/agent-profiles-lEZqu7Gm.js.map +0 -1
  126. package/public/assets/agents-DwXYbjeZ.js +0 -2
  127. package/public/assets/branch-state-badge-ClWlvQks.js +0 -2
  128. package/public/assets/card-BeqvuYTT.js +0 -2
  129. package/public/assets/chat-DH8vR-mf.js +0 -2
  130. package/public/assets/copy-button-CIXy8ks6.js +0 -2
  131. package/public/assets/dist-CXkmW1Od.js +0 -2
  132. package/public/assets/dist-LFuRypZd.js +0 -2
  133. package/public/assets/dist-Q6OOS84U.js +0 -2
  134. package/public/assets/index-BETon8ID.css +0 -2
  135. package/public/assets/index-D1GX2b-m.js +0 -23
  136. package/public/assets/index-D1GX2b-m.js.map +0 -1
  137. package/public/assets/maintenance-BhAxK-Fd.js +0 -2
  138. package/public/assets/markdown-preview-impl-BJHjAo1H.js +0 -2
  139. package/public/assets/memory-WwrerNC0.js +0 -2
  140. package/public/assets/settings-CoOySnqS.js +0 -6
  141. package/public/assets/user-avatar-aCd8Fb5v.js +0 -2
  142. package/public/assets/workspaces-DXTrd2or.js +0 -3
@@ -30,9 +30,9 @@ export interface AgentBusyHealth {
30
30
  lastProviderEventAgeMs?: number;
31
31
  /** Most recent of lastProviderEventAt and any fresh lifecycle/timeline transition (e.g. `compacting`). */
32
32
  lastProgressAt: number;
33
- /** Most recent transport liveness signal (server frame / heartbeat ack); undefined when the runner reports no transport. */
34
- transportLiveAt?: number;
35
- /** Age of the transport liveness signal; +Infinity when transport is unknown (treated as dead). */
33
+ /** Most recent transport liveness signal: the max of meta.transport frames, heartbeat acks, and agent.lastSeen. Always set. */
34
+ transportLiveAt: number;
35
+ /** Age of the most recent transport liveness signal. */
36
36
  transportStaleForMs: number;
37
37
  staleForMs: number;
38
38
  }
@@ -52,18 +52,21 @@ function hasLiveToolOrSubprocessWork(works: ActiveWorkLike[]): boolean {
52
52
  });
53
53
  }
54
54
 
55
- // #713 — most recent transport-liveness timestamp the runner reported on meta.transport
56
- // (`lastServerFrameAt` / `lastHeartbeatAckAt`). A current value proves the runner→server link is
57
- // alive, which means the agent is NOT wedged regardless of provider-token silence. Returns undefined
58
- // when no transport block is present (older runners / pre-transport meta) the caller treats that as
59
- // "can't prove alive" so a genuine wedge with no transport still fires.
60
- function transportLiveAt(agent: AgentCard): number | undefined {
55
+ // #713/#724 — most recent transport-liveness timestamp. Considers (in order of specificity):
56
+ // meta.transport.lastServerFrameAt / lastHeartbeatAckAt (runner-level frame timestamps), and
57
+ // agent.lastSeen (server-stamped on every registration heartbeat). A current value from ANY of these
58
+ // proves the runner→server link is alive, so the agent is NOT wedged regardless of provider-token
59
+ // silence long Opus turns, extended thinking, native compaction, and multi-minute subprocesses
60
+ // (bun test, build:dashboard, typecheck) all go token-silent while heartbeating normally.
61
+ // A fresh lastSeen is the authoritative veto: if the server heard from the runner within the stale
62
+ // window it is alive, full stop. Never returns undefined (lastSeen is always set on AgentCard).
63
+ function transportLiveAt(agent: AgentCard): number {
61
64
  const transport = isRecord(agent.meta?.transport) ? agent.meta.transport : undefined;
62
- if (!transport) return undefined;
63
- const frame = numberValue(transport.lastServerFrameAt);
64
- const ack = numberValue(transport.lastHeartbeatAckAt);
65
- if (frame === undefined && ack === undefined) return undefined;
66
- return Math.max(frame ?? 0, ack ?? 0);
65
+ const frame = transport ? numberValue(transport.lastServerFrameAt) : undefined;
66
+ const ack = transport ? numberValue(transport.lastHeartbeatAckAt) : undefined;
67
+ // agent.lastSeen is stamped by the server on every heartbeat — it is always a valid transport
68
+ // liveness proxy even when the runner does not populate meta.transport.
69
+ return Math.max(frame ?? 0, ack ?? 0, agent.lastSeen);
67
70
  }
68
71
 
69
72
  // #713 — timestamp of the latest lifecycle/timeline transition (e.g. Claude `compacting`/`compacted`)
@@ -116,12 +119,11 @@ export function deriveAgentBusyHealth(agent: AgentCard, now: number = Date.now()
116
119
  // fresh `compacting` event means the worker is actively progressing even with zero provider tokens.
117
120
  const lastProgressAt = Math.max(lastProviderEventAt ?? activeWorkStartedAt, timelineProgressAt(agent) ?? 0);
118
121
  const staleForMs = Math.max(0, now - lastProgressAt);
119
- // #713: transport heartbeat liveness. A current server-frame/heartbeat-ack proves the runner→server
120
- // link is alive the agent is NOT wedged, no matter how long provider tokens have been silent
121
- // (long turns, extended thinking, native compaction). Unknown transport +Infinity (can't prove
122
- // alive), so a genuine wedge whose runner has stopped reporting still trips.
122
+ // #713/#724: transport heartbeat veto. transportLiveAt() returns the most recent of
123
+ // meta.transport frames, heartbeat acks, and agent.lastSeen a fresh value from ANY of these
124
+ // proves the runner is alive, so provider-token silence alone never triggers stuck-busy.
123
125
  const liveAt = transportLiveAt(agent);
124
- const transportStaleForMs = liveAt === undefined ? Number.POSITIVE_INFINITY : Math.max(0, now - liveAt);
126
+ const transportStaleForMs = Math.max(0, now - liveAt);
125
127
  const stuck =
126
128
  !hasLiveToolOrSubprocessWork(works) &&
127
129
  activeWorkAgeMs >= thresholdMs &&
@@ -139,7 +141,7 @@ export function deriveAgentBusyHealth(agent: AgentCard, now: number = Date.now()
139
141
  activeWorkAgeMs,
140
142
  ...(lastProviderEventAt !== undefined ? { lastProviderEventAt, lastProviderEventAgeMs: Math.max(0, now - lastProviderEventAt) } : {}),
141
143
  lastProgressAt,
142
- ...(liveAt !== undefined ? { transportLiveAt: liveAt } : {}),
144
+ transportLiveAt: liveAt,
143
145
  transportStaleForMs,
144
146
  staleForMs,
145
147
  };
@@ -1,4 +1,4 @@
1
- import { spawnAgent, type SpawnAgentInput } from "../services/spawn-agent";
1
+ import { spawnAgent, summarizeSpawnCommandForCaller, type SpawnAgentInput } from "../services/spawn-agent";
2
2
  import { authContextFromMcp } from "../services/auth-context";
3
3
  import { ShutdownAuthError, ShutdownTargetError, shutdownAgent } from "../services/shutdown-agent";
4
4
  import { buildSpawnTargets } from "../spawn-targets";
@@ -162,7 +162,18 @@ export async function relaySpawnAgent(auth: McpAuthContext, args: Record<string,
162
162
  resumeWorkspace: parseResumeWorkspace(args.resumeWorkspace),
163
163
  };
164
164
  const result = await spawnAgent(input, authContextFromMcp(auth));
165
- return { ...result };
165
+ // #734 — return the lean shape callers need (spawnRequestId + agentId for idempotency/shutdown)
166
+ // plus a sanitized command summary. The full resolved provisioning already went to the
167
+ // orchestrator on the dispatched command; echoing it here blows the MCP result token cap.
168
+ return {
169
+ ok: result.ok,
170
+ spawnRequestId: result.spawnRequestId,
171
+ orchestratorId: result.orchestratorId,
172
+ provider: result.provider,
173
+ agentId: result.agentId,
174
+ registered: result.registered,
175
+ command: summarizeSpawnCommandForCaller(result.command),
176
+ };
166
177
  }
167
178
 
168
179
  export function relaySpawnTargets(auth: McpAuthContext): Record<string, unknown> {
@@ -2,6 +2,7 @@ import { APPROVAL_MODES, VALID_AGENT_LIFECYCLES, VALID_WORKSPACE_MODES } from "a
2
2
  import { McpAuthError } from "./mcp-errors";
3
3
  import { authContextFromMcp } from "./services/auth-context";
4
4
  import { deleteTeamTemplate, getTeamTemplate, instantiateTeamTemplate, listTeamTemplates, saveTeamTemplate } from "./services/team-templates";
5
+ import { summarizeSpawnCommandForCaller } from "./services/spawn-agent";
5
6
  import { ValidationError } from "./db";
6
7
 
7
8
  const COMPOSITION_ENTRY_SCHEMA = {
@@ -123,7 +124,13 @@ export async function relayTeamTemplateTool(auth: McpAuthLike, name: string, arg
123
124
  }
124
125
  if (name === "relay_team_spawn_from_template") {
125
126
  requireScope(auth, "teams:write");
126
- return await instantiateTeamTemplate({ ...args, slug: slugArg(args) }, authContextFromMcp(auth)) as unknown as Record<string, unknown>;
127
+ const instantiated = await instantiateTeamTemplate({ ...args, slug: slugArg(args) }, authContextFromMcp(auth));
128
+ // #734 — each spawned result echoes its full resolved agentProfile; strip the heavy inlined
129
+ // provisioning file contents (multiplied by N spawned agents here) before returning to the caller.
130
+ return {
131
+ ...instantiated,
132
+ spawned: instantiated.spawned.map((s) => ({ ...s, command: summarizeSpawnCommandForCaller(s.command) })),
133
+ } as unknown as Record<string, unknown>;
127
134
  }
128
135
  throw new ValidationError(`unknown tool: ${name}`);
129
136
  }
@@ -5,7 +5,7 @@ import { VALID_AGENT_STATUSES, error, json, parseBody, type Handler } from "./_s
5
5
  import { ValidationError, listAgents } from "../db";
6
6
  import { cleanMeta, cleanNullableString, cleanString, cleanStringArray, optionalEnum } from "../validation";
7
7
  import { registerAgent } from "../services/register-agent";
8
- import { spawnAgent, type SpawnAgentInput } from "../services/spawn-agent";
8
+ import { spawnAgent, summarizeSpawnCommandForCaller, type SpawnAgentInput } from "../services/spawn-agent";
9
9
  import { parseProjectInstructions } from "../project-instructions";
10
10
  import { parseProjectMcp } from "../project-mcp";
11
11
  import { parseProjectSettings } from "../project-settings";
@@ -153,7 +153,9 @@ export const postAgentSpawn: Handler = async (req) => {
153
153
  waitForRegistrationMs: 0,
154
154
  };
155
155
  const result = await spawnAgent(input, authContextFromRequest(req));
156
- return json({ ok: true, orchestratorId: result.orchestratorId, provider: result.provider, command: result.command }, 202);
156
+ // #734 the dispatched command carries the full resolved agentProfile to the orchestrator;
157
+ // strip the heavy inlined provisioning file contents from the echoed-back summary.
158
+ return json({ ok: true, orchestratorId: result.orchestratorId, provider: result.provider, command: summarizeSpawnCommandForCaller(result.command) }, 202);
157
159
  } catch (e) {
158
160
  if (e instanceof McpAuthError) return error(e.message, 403);
159
161
  if (e instanceof McpNotFoundError) return error(e.message, 404);
@@ -24,7 +24,7 @@
24
24
  // them through `spawnAgent(systemCtx)` is a clean belt-and-suspenders follow-up (#342),
25
25
  // deliberately out of scope here — this slice converges the two external TRANSPORTS.
26
26
  import type { SpawnProvider } from "agent-relay-sdk";
27
- import { DEFAULT_USER_ID, errMessage, stringValue } from "agent-relay-sdk";
27
+ import { DEFAULT_USER_ID, errMessage, isRecord, stringValue } from "agent-relay-sdk";
28
28
  import { countLiveSpawnedAgents, createActivityEvent, ensureTeam, getAgent, listAgents, listWorkspaces, resolveAgentOwnership, resolveProjectForCwd, resolveScopedAnchor, setAgentTeam, ValidationError, withResolvedProvisioning } from "../db";
29
29
  import { createCommand } from "../commands-db";
30
30
  import { emitCommandEvent } from "../command-events";
@@ -446,6 +446,51 @@ export async function spawnAgent(input: SpawnAgentInput, ctx: AuthContext): Prom
446
446
  };
447
447
  }
448
448
 
449
+ /**
450
+ * #734 — strip the heavy resolved-provisioning file CONTENTS from a spawn command before
451
+ * echoing it back to the CALLER. `withResolvedProvisioning` inlines every bundled plugin/skill
452
+ * file under `params.agentProfile.provisioning.{skills,plugins}[].files[].content` (~90KB for a
453
+ * bundled-plugin profile like default-relay), which blows the MCP result token cap and hard-errors
454
+ * the call. The ORCHESTRATOR-bound command — dispatched on the command bus inside `spawnAgent`
455
+ * (the row in `listCommands`, not this returned object) — keeps the full bytes so it can still
456
+ * materialize the plugins on the target host. This returns a structural summary (paths + byte
457
+ * counts, contents dropped) leaving the dispatched command untouched (the mutated path is
458
+ * shallow-cloned, never mutated in place).
459
+ */
460
+ export function summarizeSpawnCommandForCaller(command: Command): Command {
461
+ const profile = command.params.agentProfile;
462
+ if (!isRecord(profile) || !isRecord(profile.provisioning)) return command;
463
+ const provisioning = profile.provisioning;
464
+ const stripContents = (assets: unknown): unknown => {
465
+ if (!Array.isArray(assets)) return assets;
466
+ return assets.map((asset) => {
467
+ if (!isRecord(asset) || !Array.isArray(asset.files)) return asset;
468
+ return {
469
+ ...asset,
470
+ files: asset.files.map((file) =>
471
+ isRecord(file) && typeof file.content === "string"
472
+ ? { path: file.path, contentBytes: file.content.length }
473
+ : file,
474
+ ),
475
+ };
476
+ });
477
+ };
478
+ return {
479
+ ...command,
480
+ params: {
481
+ ...command.params,
482
+ agentProfile: {
483
+ ...profile,
484
+ provisioning: {
485
+ ...provisioning,
486
+ skills: stripContents(provisioning.skills),
487
+ plugins: stripContents(provisioning.plugins),
488
+ },
489
+ },
490
+ },
491
+ };
492
+ }
493
+
449
494
  /** Poll the agents table for the child that registers with this spawnRequestId (#255). */
450
495
  async function waitForSpawnedAgent(spawnRequestId: string, timeoutMs: number, pollMs = 300): Promise<string | null> {
451
496
  const deadline = Date.now() + timeoutMs;
@@ -1,4 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{B as t,Bn as n,Bt as r,Dt as i,Et as a,Jn as o,L as s,Nn as c,On as l,Qn as u,V as d,Vn as f,Xn as p,Xt as m,Zt as h,_n as g,a as _,b as v,bn as y,c as ee,cn as te,ft as b,g as x,gn as S,hn as C,i as ne,in as re,lr as w,lt as T,m as E,pn as D,r as O,sn as ie,x as k,xn as A,yn as ae}from"./lucide-react-uFIMC7W7.js";import{g as j,r as M,t as N}from"./store-DGM2s9L1.js";import{E as P,H as oe,N as F,P as I,R as se,S as ce,V as le,_ as ue,d as de,f as fe,k as L,q as R,rt as z,v as pe}from"./display-DRiGi1zj.js";import{t as B}from"./types-Tv67voFu.js";import{a as me,i as he,o as ge,t as V,w as H}from"./index-D1GX2b-m.js";import{t as _e}from"./user-avatar-aCd8Fb5v.js";var U=e(w(),1),ve={online:`came online`,offline:`went offline`,shutdown:`shut down`,restarted:`restarted`,"compaction-requested":`compaction requested`,compacting:`compaction started`,compacted:`context compacted`,"compaction-stalled":`compaction stalled — may need manual intervention`,"clear-requested":`clear requested`,"clearing-context":`clear started`,"context-cleared":`context cleared`,"clear-stalled":`context clear stalled — may need manual intervention`,"shutting-down":`shutting down`},ye=new Set(Object.keys(ve)),be=3e3;function W(e){return new Date(e.occurredAt??e.createdAt).getTime()}function xe(e){if(e.kind!==`session`)return null;let t=e.payload?.session;return!t||t.type!==`narration`&&t.type!==`reasoning`&&t.type!==`tool`?null:{id:e.id,kind:t.type,label:typeof t.label==`string`?t.label:void 0,text:e.body,ts:W(e),turnId:typeof t.turnId==`string`?t.turnId:void 0}}function Se(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`notice`)return null;let n=typeof t.label==`string`&&t.label?t.label:`compacted`;return{id:`notice-${e.id}`,status:n,timestamp:W(e)}}function Ce(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`relay-injection`)return null;let n=t.relayInjection&&typeof t.relayInjection==`object`&&!Array.isArray(t.relayInjection)?t.relayInjection:{},r=typeof n.category==`string`&&[`memory`,`instructions`,`tools`,`comms`,`knowledge`,`context`].includes(n.category)?n.category:`context`,i=typeof n.timestamp==`number`&&Number.isFinite(n.timestamp)?n.timestamp:W(e),a=n.detail&&typeof n.detail==`object`&&!Array.isArray(n.detail)?n.detail:{};return{id:e.id,category:r,summary:typeof n.summary==`string`&&n.summary.trim()?n.summary:e.body,detail:a,agentId:typeof n.agentId==`string`&&n.agentId?n.agentId:e.from,timestamp:i}}function we(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`prompt-resolution`)return null;let n=t.promptResolution&&typeof t.promptResolution==`object`&&!Array.isArray(t.promptResolution)?t.promptResolution:{},r=n.kind===`questions`||n.kind===`plan`||n.kind===`command`||n.kind===`tool`?n.kind:`tool`,i=typeof n.title==`string`&&n.title.trim()?n.title:`Prompt resolved`,a=typeof n.decisionLabel==`string`&&n.decisionLabel.trim()?n.decisionLabel:typeof t.label==`string`&&t.label.trim()?t.label:`Resolved`,o=n.answers&&typeof n.answers==`object`&&!Array.isArray(n.answers)?n.answers:{};return{id:e.id,title:i,kind:r,body:typeof n.promptBody==`string`?n.promptBody:typeof n.body==`string`?n.body:e.body,toolName:typeof n.toolName==`string`&&n.toolName.trim()?n.toolName:i,decisionLabel:a,questions:Te(n.questions,o,a),timestamp:W(e)}}function Te(e,t,n){let r=(Array.isArray(e)?e:[]).map((e,r)=>{let i=e&&typeof e==`object`&&!Array.isArray(e)?e:{},a=typeof i.question==`string`&&i.question.trim()?i.question.trim():typeof i.header==`string`&&i.header.trim()?i.header.trim():`Question ${r+1}`,o=t[a]??t[String(i.question??``)]??t[String(i.header??``)];return{question:a,answer:typeof o==`string`&&o.trim()?o.trim():n}});return r.length?r:Object.entries(t).map(([e,t])=>({question:e,answer:t}))}function Ee(e,t){let n=e.trim();for(let e of t){let t=e.trim();if(t){if(n===t)break;n.startsWith(`${t}\n\n`)&&(n=n.slice(t.length+2).trimStart())}}return n.trim()||e.trim()}function De(e){return e.kind===`system`&&e.from===`system`}var Oe=new Set([`agent.ready`,`agent.exited`,`agent.spawn_failed`]);function G(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ke(e){let t=e.filter(e=>ye.has(e.status)).slice().sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let e of t)n.some(t=>t.id===e.id)||n.some(t=>t.status===e.status&&Math.abs(t.timestamp-e.timestamp)<=be)||n.push(e);return n}function Ae(e,t,n,r=[],i){let a=[];for(let e of r){let t=e.entries.reduce((e,t)=>Math.min(e,R(t.originalCreatedAt)),1/0),n=Number.isFinite(t)?t-1:e.importedAt;a.push({ts:n,entry:{type:`import-boundary`,history:e,timestamp:n}});for(let t of e.entries)a.push({ts:R(t.originalCreatedAt),entry:{type:`imported-message`,history:e,entry:t}})}if(n){let e=new Date(n).getTime();Number.isFinite(e)&&a.push({ts:e,entry:{type:`created`,timestamp:e}})}if(i?.spawnedBy){let e=n?new Date(n).getTime():0,t=Number.isFinite(e)?e:0;a.push({ts:t,entry:{type:`agent-action`,direction:`spawned-by`,agentId:i.spawnedBy.agentId,provider:i.spawnedBy.provider,status:`ready`,timestamp:t}})}let o=i?.spawnedBy?.agentId,s=null,c=1/0;for(let t of e){if(t.kind===`session`||De(t)||P(t)||!(t.from===`user`||o!==void 0&&t.from===o)||!L(t).trim())continue;let e=W(t);e<c&&(c=e,s=t.id)}let l=new Map,u=new Map,d=new Map;for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type===`narration`&&typeof e.turnId==`string`){let n=u.get(e.turnId)??[];n.push({id:t.id,body:t.body.trim()}),u.set(e.turnId,n)}else if(e?.type===`response`&&typeof e.turnId==`string`){let n=l.get(e.turnId)??[];n.push(t.body.trim()),l.set(e.turnId,n)}}let f=new Map;for(let[e,t]of l){let n=(u.get(e)??[]).map(e=>e.body);f.set(e,t.map(e=>Ee(e,n)))}for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type!==`response`||typeof e.turnId!=`string`)continue;let n=Ee(t.body,(u.get(e.turnId)??[]).map(e=>e.body));n&&n!==t.body&&d.set(t.id,n)}let p=new Set;for(let[e,t]of f){let n=u.get(e)??[];for(let e of t)for(let t=n.length-1;t>=0;t--){let r=n[t];if(!p.has(r.id)&&oe(e,r.body)){p.add(r.id);break}}}let m=new Map,h=[];for(let t of e){if(De(t)){let e=typeof t.payload?.kind==`string`?t.payload.kind:``;if(Oe.has(e)){let n=t.payload,r=typeof n.agentId==`string`?n.agentId:``,i=W(t);if(!r){a.push({ts:i,entry:{type:`notice`,msg:t}});continue}let o=e===`agent.ready`?`ready`:e===`agent.exited`?`exited`:`failed`,s=m.get(r);if(s)s.entry.status=o,typeof n.reason==`string`&&(s.entry.reason=n.reason),s.entry.timestamp=i,s.ts=i;else{let e={ts:i,entry:{type:`agent-action`,direction:`spawned-child`,agentId:r,provider:typeof n.provider==`string`?n.provider:void 0,status:o,reason:typeof n.reason==`string`?n.reason:void 0,timestamp:i}};m.set(r,e),a.push(e)}continue}a.push({ts:W(t),entry:{type:`notice`,msg:t}});continue}let e=Se(t);if(e){h.push(e);continue}let n=xe(t);if(n){if(n.kind===`narration`&&p.has(n.id))continue;a.push({ts:n.ts,entry:{type:`activity`,steps:[n],timestamp:n.ts}});continue}let r=Ce(t);if(r){a.push({ts:r.timestamp,entry:{type:`relay-injection`,event:r}});continue}let i=we(t);if(i){a.push({ts:i.timestamp,entry:{type:`prompt-resolution`,event:i}});continue}if(t.kind===`session`){let e=t.payload?.session;if(e?.type===`response`&&typeof e.turnId==`string`){let e=d.get(t.id);if(e&&e!==t.body){a.push({ts:W(t),entry:{type:`message`,msg:{...t,body:e}}});continue}}}let o=t.id===s?`initial-prompt`:`message`;a.push({ts:W(t),entry:{type:o,msg:t}})}for(let e of ke([...t,...h]))a.push({ts:e.timestamp,entry:{type:`status`,event:e}});let g={created:0,date:1,"import-boundary":2,"imported-message":3,"initial-prompt":4,message:4,activity:4,notice:4,"agent-action":4,"relay-injection":4,"prompt-resolution":4,status:5};a.sort((e,t)=>{let n=e.ts-t.ts;return Math.abs(n)<3e3&&g[e.entry.type]-g[t.entry.type]||n});let _=[],v=``;for(let{ts:e,entry:t}of a){if(t.type===`created`){_.push(t);continue}let n=G(e);if(n!==v&&(_.push({type:`date`,date:n,timestamp:e}),v=n),t.type===`activity`){let e=_[_.length-1];if(e&&e.type===`activity`&&Ne(e,t)){e.steps.push(...t.steps);continue}}_.push(t)}return _}function je(e){return e.type===`message`?`msg-${e.msg.id}`:e.type===`initial-prompt`?`initprompt-${e.msg.id}`:e.type===`notice`?`notice-${e.msg.id}`:e.type===`relay-injection`?`relay-injection-${e.event.id}`:e.type===`prompt-resolution`?`prompt-resolution-${e.event.id}`:e.type===`agent-action`?`agent-action-${e.direction}-${e.agentId}`:e.type===`activity`?`act-${e.steps[0]?.id??e.timestamp}`:e.type===`import-boundary`?`import-${e.history.id}`:e.type===`imported-message`?`import-msg-${e.history.id}-${e.entry.originalMessageId}-${e.entry.position}`:e.type===`status`?`status-${e.event.id}`:e.type===`date`?`date-${e.date}`:`created-${e.timestamp}`}function Me(e){return e.type===`message`||e.type===`initial-prompt`||e.type===`notice`?(e.msg.subject?`${e.msg.subject} `:``)+L(e.msg):e.type===`imported-message`?L(e.entry.message):e.type===`activity`?e.steps.map(e=>[e.label,e.text].filter(Boolean).join(` `)).join(`
2
- `):e.type===`relay-injection`?`${e.event.category} ${e.event.summary}\n${JSON.stringify(e.event.detail)}`:e.type===`prompt-resolution`?[e.event.title,e.event.decisionLabel,e.event.body,...e.event.questions.map(e=>`${e.question} ${e.answer}`)].filter(Boolean).join(`
3
- `):``}function Ne(e,t){let n=e.steps[e.steps.length-1]?.turnId,r=t.steps[0]?.turnId;return n&&r?n===r:!n&&!r}function Pe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Fe(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function Ie(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function Le(e,t){return e.filter(e=>e.status===`online`&&se(t,e.baseDir)).sort((e,t)=>F(t.baseDir).length-F(e.baseDir).length)[0]||e.find(e=>e.status===`online`)}function Re(){return typeof window<`u`&&window.matchMedia(`(min-width: 1280px)`).matches}function ze(){return typeof window<`u`&&!!window.getSelection()?.toString()}function Be(e){let t=e.payload?.attachments;return Array.isArray(t)?t.filter(e=>!!(e&&typeof e==`object`&&typeof e.artifactId==`string`)):[]}var Ve=[`👍`,`❤️`,`✅`,`👀`];function He(e){let t=new Map;for(let n of e.reactions||[]){let e=I(n.emoji),r=t.get(e)??{emoji:e,count:0,mine:!1,actors:[]};r.count+=1,r.mine=r.mine||n.actorId===`user`,r.actors.push(n.actorId),t.set(e,r)}return[...t.values()].sort((e,t)=>t.count-e.count||e.emoji.localeCompare(t.emoji))}function K(e){return P(e)}function Ue(e,t){let n=e.readBy||[],r=e.resolvedToAgent||t||e.to,i=r?n.includes(r):!1,a=n.some(e=>e!==z);if(i||a){let e=i?r:n.find(e=>e!==z);return{label:`read`,title:e?`Read by ${e}`:`Read by agent`,tone:`ok`,icon:A}}if(e.deliveryStatus===`delivered`)return{label:`delivered`,title:`Delivered to agent inbox`,tone:`ok`,icon:A};if(e.deliveryStatus===`queued`)return{label:`queued`,title:`Queued until the target agent is available`,tone:`warn`,icon:re};if(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`){let t=e.deliveryPoisonReason||e.deliveryLastError||e.deliveryStatus;return{label:e.deliveryStatus,title:t,tone:`danger`,icon:C}}return{label:`sent`,title:`Accepted by Relay`,tone:`muted`,icon:y}}function We(e){let t=R(e.createdAt);return(e.reactions||[]).reduce((e,t)=>Math.max(e,R(t.updatedAt||t.createdAt)),t)}function Ge(e){return e?e.messages.reduce((e,t)=>Math.max(e,We(t)),0):0}function Ke(e,t,n){return(e-t)*n}function qe(e){if(!e)return 0;let t=0;for(let n of e.messages)ce(n)&&(t=Math.max(t,R(n.createdAt)));return t}function q(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function Je(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function Ye(e,t,n,r){if(e?.teamId)return{teamId:e.teamId};let i=[...t];n&&!i.some(e=>e.id===n.id)&&i.push(n);let a=i.filter(e=>e.threadId).reverse(),o=a.find(e=>!!r[M(e.threadId,e.channel)])??a[0];return o?.threadId?{threadId:o.threadId,...o.channel?{channel:o.channel}:{}}:null}var J=p(),Xe={online:`text-emerald-400`,offline:`text-zinc-400`,shutdown:`text-zinc-400`,restarted:`text-blue-400`,"compaction-requested":`text-zinc-400`,compacting:`text-amber-400`,compacted:`text-amber-400`,"compaction-stalled":`text-red-400`,"clear-requested":`text-zinc-400`,"clearing-context":`text-amber-400`,"context-cleared":`text-amber-400`,"clear-stalled":`text-red-400`,"shutting-down":`text-zinc-400`};function Ze(e){let t=new Date,[n,r,i]=e.split(`-`).map(Number),a=new Date(n,r-1,i);if(e===G(t.getTime()))return`Today`;let o=new Date(t);return o.setDate(o.getDate()-1),e===G(o.getTime())?`Yesterday`:a.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`,year:a.getFullYear()===t.getFullYear()?void 0:`numeric`})}function Qe({event:e}){return(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(ie,{className:o(`w-2 h-2 fill-current`,Xe[e.status]||`text-zinc-400`)}),(0,J.jsx)(`span`,{children:ve[e.status]||e.status}),(0,J.jsx)(`span`,{className:`text-muted-foreground/60`,children:q(e.timestamp)})]}),(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}var $e={"branch.landed":a,"context.warning":E,"agent.context_threshold":E,"agent.resume_budget_exhausted":E,"agent.rate_limit_resume":d},et={"branch.landed":`branch landed`,"context.warning":`context warning`,"agent.context_threshold":`context threshold reached`};function tt(e){return e&&(e.includes(`.`)?e.slice(e.indexOf(`.`)+1):e).replace(/[._-]+/g,` `).trim()||`system signal`}function Y({agentId:e,fallbackLabel:t,className:n,noIcon:r}){let i=N(t=>t.agentsById[e])||null,a=N(e=>e.openInboxThread),s=N(e=>e.switchView),c=i?de(i):t||e;return(0,J.jsxs)(`button`,{type:`button`,className:o(`inline-flex max-w-full items-center gap-1 rounded px-1 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground`,n),onClick:t=>{t.stopPropagation(),a(e),s(`chat`)},title:`Open chat for ${c}`,children:[!r&&(0,J.jsx)(H,{agent:i,className:`w-4 h-4 text-[10px]`}),(0,J.jsx)(`span`,{className:`max-w-[160px] truncate`,children:c})]})}function nt({msg:e}){let t=e.payload??{},n=it(e),r=typeof t.sha==`string`?t.sha:``,i=r?r.slice(0,7):``,o=typeof t.author==`string`?t.author:``,s=typeof t.branch==`string`?t.branch:``,c=typeof t.base==`string`?t.base:``,l=t.pushed;return(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,J.jsxs)(`div`,{className:`flex max-w-full flex-wrap items-center justify-center gap-x-1.5 gap-y-0.5 rounded-full border border-emerald-600/35 bg-emerald-500/10 px-2.5 py-1 text-xs text-emerald-700 dark:border-emerald-500/25 dark:text-emerald-300/90`,children:[(0,J.jsx)(a,{className:`h-3 w-3 shrink-0 text-emerald-600 dark:text-emerald-400`}),(0,J.jsx)(`span`,{className:`text-emerald-700 dark:text-emerald-300`,children:`branch landed`}),s&&c&&(0,J.jsxs)(`span`,{className:`font-mono text-emerald-700/80 dark:text-emerald-200/70`,title:`${s} → ${c}`,children:[s,(0,J.jsx)(`span`,{className:`opacity-50`,children:` → `}),c]}),i&&(0,J.jsx)(`span`,{className:`rounded bg-emerald-500/15 px-1 font-mono text-emerald-800 dark:text-emerald-200`,title:r,children:i}),o&&(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-emerald-700/80 dark:text-emerald-300/80`,children:[(0,J.jsx)(`span`,{className:`opacity-70`,children:`by`}),(0,J.jsx)(Y,{agentId:o,className:`text-emerald-700 hover:text-emerald-900 dark:text-emerald-300/90 dark:hover:text-emerald-100`})]}),l===!1&&(0,J.jsx)(`span`,{className:`text-amber-600 dark:text-amber-300/80`,title:`Local-only land — not pushed to origin`,children:`· local only`}),n&&(0,J.jsxs)(`span`,{className:`max-w-[220px] truncate text-emerald-700/70 dark:text-emerald-300/70`,title:n,children:[`· because `,n]}),(0,J.jsx)(`span`,{className:`text-emerald-700/60 dark:text-emerald-300/50`,children:q(e.occurredAt??e.createdAt)})]}),(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function rt({msg:e}){let t=typeof e.payload?.kind==`string`?e.payload.kind:``;if(t===`branch.landed`)return(0,J.jsx)(nt,{msg:e});let n=$e[t]??s,r=et[t]??tt(t),i=it(e);return(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(n,{className:`h-3 w-3`}),(0,J.jsx)(`span`,{children:r}),i&&(0,J.jsxs)(`span`,{className:`max-w-[220px] truncate text-muted-foreground/80`,title:i,children:[`· because `,i]}),(0,J.jsx)(`span`,{className:`text-muted-foreground/60`,children:q(e.occurredAt??e.createdAt)})]}),(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function it(e){let t=e.payload?.routing;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.reason;return typeof n==`string`?n:``}var at={"spawned-child":{ready:`spawned`,exited:`spawned · exited`,failed:`spawn failed`},"spawned-by":{ready:`spawned by`,exited:`spawned by`,failed:`spawned by`}},ot={"spawned-child-ready":t,"spawned-child-exited":T,"spawned-child-failed":C,"spawned-by-ready":f,"spawned-by-exited":f,"spawned-by-failed":f},st={"spawned-child-ready":`text-emerald-400`,"spawned-child-exited":`text-zinc-400`,"spawned-child-failed":`text-red-400`,"spawned-by-ready":`text-blue-400`,"spawned-by-exited":`text-blue-400`,"spawned-by-failed":`text-blue-400`};function ct({entry:e}){let t=`${e.direction}-${e.status}`,n=at[e.direction]?.[e.status]??e.direction,r=ot[t]??s,i=st[t]??`text-muted-foreground`,a=e.status===`failed`;return(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,J.jsxs)(`div`,{className:o(`flex items-center gap-1.5 rounded-full border bg-muted/30 px-2.5 py-1 text-xs`,a?`border-red-500/30`:`border-border`),children:[(0,J.jsx)(r,{className:o(`h-3 w-3 shrink-0`,i)}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:n}),(0,J.jsx)(Y,{agentId:e.agentId}),e.reason&&a&&(0,J.jsxs)(`span`,{className:`text-red-400/80 max-w-[120px] truncate`,title:e.reason,children:[`— `,e.reason]}),(0,J.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0`,children:q(e.timestamp)})]}),(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}var lt={memory:l,instructions:r,tools:_,comms:s,knowledge:c,context:h},ut={memory:`border-emerald-500/25 bg-emerald-500/10 text-emerald-300`,instructions:`border-sky-500/25 bg-sky-500/10 text-sky-300`,tools:`border-amber-500/25 bg-amber-500/10 text-amber-300`,comms:`border-violet-500/25 bg-violet-500/10 text-violet-300`,knowledge:`border-cyan-500/25 bg-cyan-500/10 text-cyan-300`,context:`border-zinc-500/25 bg-zinc-500/10 text-zinc-300`};function dt(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ft({entry:e}){let[t,n]=(0,U.useState)(!1),r=e.event,i=lt[r.category]??v;return(0,J.jsx)(`div`,{className:`flex justify-center py-2 my-1`,children:(0,J.jsxs)(`div`,{className:o(`w-full max-w-[85%] md:max-w-[75%] rounded-lg border px-2.5 py-1.5 text-xs shadow-sm`,ut[r.category]??ut.context),children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-center gap-1.5 text-left`,onClick:()=>n(e=>!e),children:[(0,J.jsx)(i,{className:`h-3.5 w-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`shrink-0 font-medium`,children:r.category}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/80`,children:r.summary}),(0,J.jsx)(`span`,{className:`shrink-0 text-muted-foreground/60`,children:q(r.timestamp)}),(0,J.jsx)(g,{className:o(`h-3.5 w-3.5 shrink-0 transition-transform`,t&&`rotate-90`)})]}),t&&(0,J.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto rounded-md border border-border/60 bg-background/75 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground whitespace-pre-wrap break-words`,children:dt(r.detail)})]})})}function pt({blockedLabel:e,onInterrupt:t}){return e?(0,J.jsx)(`div`,{className:`flex justify-start mb-3 animate-in fade-in slide-in-from-bottom-1 duration-150`,children:(0,J.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-red-500/30 px-4`,children:[(0,J.jsx)(C,{className:`w-3.5 h-3.5 text-red-400`}),(0,J.jsxs)(`span`,{className:`text-xs text-red-300`,children:[`blocked: `,e]})]})}):(0,J.jsx)(`div`,{className:`flex justify-start mb-3 animate-in fade-in slide-in-from-bottom-1 duration-150`,children:(0,J.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-foreground/10 px-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_infinite]`}),(0,J.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_0.2s_infinite]`}),(0,J.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_0.4s_infinite]`})]}),(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`working`}),t&&(0,J.jsxs)(`button`,{onClick:t,title:`Interrupt`,className:`ml-1 flex items-center gap-1 rounded-full px-1.5 py-0.5 text-xs text-muted-foreground hover:text-red-300 hover:bg-red-500/10 transition-colors`,children:[(0,J.jsx)(te,{className:`w-3.5 h-3.5`}),`Stop`]})]})})}var X=`agent-relay:chat-hide-tools`,Z=(()=>{let e=new Set,t=(()=>{try{return window.localStorage.getItem(X)===`on`}catch{return!1}})(),n=()=>e.forEach(e=>e());return typeof window<`u`&&window.addEventListener(`storage`,e=>{e.key===X&&(t=e.newValue===`on`,n())}),{subscribe(t){return e.add(t),()=>e.delete(t)},get:()=>t,toggle(){t=!t;try{window.localStorage.setItem(X,t?`on`:`off`)}catch{}n()}}})();function mt(){return[(0,U.useSyncExternalStore)(Z.subscribe,Z.get,()=>!1),Z.toggle]}function ht({steps:e,showReasoning:t,issueRepo:n}){let[r,i]=mt(),a=t?e:e.filter(e=>e.kind!==`reasoning`);if(!a.length)return null;let s=a.filter(e=>e.kind===`tool`).length;return(0,J.jsx)(`div`,{className:`flex justify-start mb-2`,children:(0,J.jsxs)(`div`,{className:`max-w-[85%] md:max-w-[75%] min-w-0 space-y-1.5`,children:[a.map(e=>e.kind===`narration`?(0,J.jsx)(V,{text:e.text,issueRepo:n,className:`text-sm leading-relaxed break-words text-foreground/90 min-w-0`},e.id):e.kind===`reasoning`?(0,J.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground/80`,children:[(0,J.jsx)(l,{className:`w-3.5 h-3.5 mt-0.5 shrink-0 opacity-70`}),(0,J.jsx)(V,{text:e.text,issueRepo:n,className:`italic break-words min-w-0`})]},e.id):r?null:(0,J.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground`,children:[(0,J.jsx)(x,{className:`w-3 h-3 mt-0.5 shrink-0 opacity-70`}),(0,J.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:e.label||`tool`}),e.text&&e.text.trim()&&e.text.trim()!==(e.label??``).trim()?(0,J.jsxs)(`span`,{className:`opacity-70`,children:[` — `,e.text]}):null]})]},e.id)),s>0&&(0,J.jsxs)(`button`,{onClick:i,className:`flex items-center gap-1 text-[11px] text-muted-foreground/50 hover:text-muted-foreground transition-colors text-left`,children:[(0,J.jsx)(g,{className:o(`w-3 h-3 shrink-0 transition-transform`,!r&&`rotate-90`)}),(0,J.jsx)(`span`,{children:r?`show ${s} tool step${s===1?``:`s`}`:`hide tool steps`})]})]})})}function gt({entry:e}){let{event:t}=e,n=t.kind===`questions`,r=n?t.title:t.kind===`plan`?`Plan prompt`:`${t.toolName} permission`;return(0,J.jsx)(`div`,{className:`flex justify-center py-1.5`,children:(0,J.jsxs)(`div`,{className:`w-full max-w-2xl rounded-md border border-border bg-muted/20 px-3 py-2 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(D,{className:`h-3.5 w-3.5 text-emerald-500`}),(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),(0,J.jsx)(`span`,{children:t.decisionLabel}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-muted-foreground/60`,children:q(t.timestamp)})]}),n&&t.questions.length>0?(0,J.jsx)(`div`,{className:`mt-2 space-y-1.5`,children:t.questions.map((e,t)=>(0,J.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.question}),(0,J.jsx)(`div`,{className:`text-sm text-foreground`,children:e.answer})]},`${e.question}-${t}`))}):t.body.trim()?(0,J.jsx)(`div`,{className:`mt-2 max-h-48 overflow-auto rounded border border-border/70 bg-background/40 px-2 py-1.5 text-sm`,children:(0,J.jsx)(V,{text:t.body})}):null]})})}function _t({date:e}){return(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-3 my-1`,children:[(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,J.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:Ze(e)}),(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function vt({timestamp:e}){let t=new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`});return(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground/60`,children:[`created `,t]}),(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function yt({history:e}){let t=e.sourceAgentLabel||e.sourcePeerId,n=e.entries.length;return(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-dashed border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground`,children:[(0,J.jsx)(i,{className:`h-3 w-3`}),(0,J.jsxs)(`span`,{children:[`forked history from `,t]}),(0,J.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[n,` `,n===1?`entry`:`entries`]})]}),(0,J.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function bt({entry:e,sourceLabel:t,issueRepo:n}){let r=e.message,i=L(r),a=e.originalFrom===z;return(0,J.jsx)(`div`,{className:o(`flex mb-3 opacity-80`,a?`justify-end`:`justify-start`),children:(0,J.jsx)(`div`,{className:`max-w-[85%] md:max-w-[75%]`,children:(0,J.jsxs)(`div`,{className:o(`rounded-2xl border border-dashed px-3.5 py-2 text-sm select-text`,a?`border-primary/25 bg-primary/10 text-foreground rounded-br-sm`:`border-border bg-card/70 rounded-bl-sm`),children:[(0,J.jsxs)(`div`,{className:o(`mb-1 text-[10px] uppercase tracking-normal`,a?`text-primary/70`:`text-muted-foreground`),children:[`forked history · `,a?`you`:t||e.originalFrom]}),(0,J.jsx)(V,{text:i,rawBody:r.body,issueRepo:n,className:`leading-relaxed`}),(0,J.jsxs)(`p`,{className:o(`mt-1 flex items-center justify-end gap-1.5 text-xs`,a?`text-primary/60`:`text-muted-foreground`),children:[(0,J.jsxs)(`span`,{className:`opacity-40`,children:[`#`,e.originalMessageId]}),(0,J.jsx)(`span`,{children:q(e.originalCreatedAt)})]})]})})})}function Q({msg:e,issueRepo:t}){let n=L(e),r=q(e.occurredAt??e.createdAt);return(0,J.jsx)(`div`,{"data-msg-id":e.id,className:`mb-3`,children:(0,J.jsxs)(`div`,{className:`rounded-xl border border-primary/30 bg-primary/[0.06] px-3.5 py-2.5 shadow-sm`,children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-primary/80`,children:[(0,J.jsx)(v,{className:`h-3.5 w-3.5`}),(0,J.jsx)(`span`,{children:`Initial prompt`}),(0,J.jsx)(`span`,{className:`ml-auto text-[10px] font-normal normal-case text-muted-foreground/60`,children:r})]}),(0,J.jsx)(V,{text:n,rawBody:e.body,issueRepo:t,className:`text-sm leading-relaxed text-foreground`})]})})}function xt({scrollEl:e,timeline:t}){let[n,r]=(0,U.useState)(!0),[i,a]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),d=(0,U.useMemo)(()=>{for(let e=t.length-1;e>=0;e--){let n=t[e];if(!(!n||n.type!==`message`&&n.type!==`initial-prompt`)&&n.msg.from===`user`)return{id:n.msg.id,body:L(n.msg)}}return null},[t]);if((0,U.useEffect)(()=>{if(!d||!e){r(!0);return}let t=null,n=null,i=()=>{let i=e.querySelector(`[data-msg-id="${d.id}"]`);if(!i){t?.disconnect(),t=null,n=null,r(!1);return}let a=i.getBoundingClientRect(),o=e.getBoundingClientRect();u(a.top<o.top),i!==n&&(t?.disconnect(),n=i,t=new IntersectionObserver(([e])=>{e&&r(e.isIntersecting)},{root:e,threshold:0}),t.observe(i))};return i(),e.addEventListener(`scroll`,i,{passive:!0}),()=>{t?.disconnect(),e.removeEventListener(`scroll`,i)}},[d?.id,e]),n||!d||!d.body.trim())return null;let f=i?.id===d.id?i.value:!1,p=s?.id===d.id?s.value:!1;function m(){!e||!d||e.querySelector(`[data-msg-id="${d.id}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`})}let h=l?`↑`:`↓`;return p?(0,J.jsx)(`div`,{className:`flex shrink-0 bg-card/45 border-b border-border`,children:(0,J.jsxs)(`button`,{type:`button`,className:`w-full flex items-center justify-center gap-1.5 py-1 text-[11px] text-primary/60 hover:text-primary transition-colors`,onClick:()=>c({id:d.id,value:!1}),children:[(0,J.jsx)(`span`,{children:`Your prompt`}),(0,J.jsx)(ae,{className:`w-3 h-3`})]})}):(0,J.jsxs)(`section`,{className:`flex shrink-0 flex-col border-b border-border bg-card/45 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground mb-0.5`,children:[(0,J.jsx)(`span`,{className:`font-medium text-primary/70`,children:`Your prompt`}),(0,J.jsxs)(`button`,{type:`button`,className:`ml-auto hover:text-foreground transition-colors`,onClick:m,children:[h,` scroll to original`]}),(0,J.jsx)(`button`,{type:`button`,className:`hover:text-foreground transition-colors`,onClick:()=>c({id:d.id,value:!0}),title:`Minimize`,children:(0,J.jsx)(S,{className:`w-3 h-3`})})]}),(0,J.jsx)(`p`,{className:o(`text-sm text-foreground leading-snug cursor-pointer`,!f&&`line-clamp-2`),onClick:()=>a({id:d.id,value:!f}),children:d.body})]})}function St(){return(0,U.useSyncExternalStore)(e=>j.subscribe(e),()=>j.getPlayingKey(),()=>null)}function Ct({msg:e,peer:t}){return(0,J.jsx)(Q,{msg:e,issueRepo:N(e=>e.agentsById[t]?.issueRepo)})}function wt({agent:e,onClick:t}){let n=!!(t&&e);return(0,J.jsx)(`button`,{type:`button`,title:e?e.label||e.name||e.id:void 0,onClick:t,disabled:!n,className:o(`shrink-0 self-end transition-opacity`,n?`cursor-pointer hover:opacity-80`:`cursor-default opacity-60`),children:(0,J.jsx)(H,{agent:e})})}function Tt({agentId:e,onOpen:t}){let n=N(t=>t.agentsById[e]??null);return(0,J.jsx)(wt,{agent:n,onClick:n?()=>t(n):void 0})}function Et({attachment:e,outbound:t}){let n=e.kind===`image`,i=e.title||e.artifactId,[a,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1),[p,h]=(0,U.useState)(!1);(0,U.useEffect)(()=>{let t=!1,n=null;async function r(){f(!0),l(null),s(null);try{let r=await u(`/artifacts/${encodeURIComponent(e.artifactId)}/content`);if(t)return;n=URL.createObjectURL(r),s(n)}catch(e){t||l(e.message)}finally{t||f(!1)}}return r(),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e.artifactId]);function g(){if(!a)return;let e=document.createElement(`a`);e.href=a,e.download=i,document.body.appendChild(e),e.click(),e.remove()}return n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>a&&h(!0),disabled:!a,className:`group/img mt-2 block overflow-hidden rounded-md border border-foreground/10 bg-black/10 text-left disabled:cursor-default relative`,children:a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`img`,{src:a,alt:i,loading:`lazy`,className:`block max-h-72 max-w-full object-contain`}),(0,J.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/img:bg-black/30 transition-colors`,children:(0,J.jsx)(O,{className:`w-6 h-6 text-white opacity-0 group-hover/img:opacity-100 transition-opacity drop-shadow-md`})})]}):(0,J.jsxs)(`span`,{className:o(`flex min-h-20 items-center gap-2 px-3 py-2 text-xs`,c?`text-red-400`:`text-muted-foreground`),children:[d?(0,J.jsx)(b,{className:`h-4 w-4 animate-spin`}):(0,J.jsx)(C,{className:`h-4 w-4`}),c||`Loading image`]})}),a&&(0,J.jsx)(he,{open:p,onOpenChange:h,children:(0,J.jsxs)(me,{className:`max-w-[95vw] max-h-[95vh] w-auto p-0 bg-black/95 border-zinc-800 gap-0 overflow-hidden`,showCloseButton:!1,children:[(0,J.jsx)(ge,{className:`sr-only`,children:i}),(0,J.jsxs)(`div`,{className:`relative flex items-center justify-center min-h-[200px]`,children:[(0,J.jsx)(`img`,{src:a,alt:i,className:`max-w-[93vw] max-h-[90vh] object-contain`}),(0,J.jsxs)(`div`,{className:`absolute top-2 right-2 flex gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:g,className:`rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Download`,children:(0,J.jsx)(m,{className:`w-4 h-4`})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Close`,children:(0,J.jsx)(ne,{className:`w-4 h-4`})})]})]})]})})]}):(0,J.jsxs)(`button`,{type:`button`,onClick:g,disabled:!a,className:o(`mt-2 flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-xs transition-colors disabled:cursor-default disabled:opacity-70`,t?`border-primary-foreground/20 bg-primary-foreground/10 hover:bg-primary-foreground/15`:`border-border bg-background hover:bg-muted`),children:[d?(0,J.jsx)(b,{className:`h-4 w-4 shrink-0 animate-spin`}):c?(0,J.jsx)(C,{className:`h-4 w-4 shrink-0 text-red-400`}):(0,J.jsx)(r,{className:`h-4 w-4 shrink-0`}),(0,J.jsx)(`span`,{className:o(`min-w-0 flex-1 truncate`,c&&`text-red-400`),children:c||i}),(0,J.jsx)(m,{className:`h-3.5 w-3.5 shrink-0`})]})}function $({open:e,onToggle:t,onReact:n}){return(0,J.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,J.jsx)(`button`,{type:`button`,title:`Add reaction`,onClick:t,className:o(`inline-flex h-5 w-6 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-sm transition hover:bg-muted hover:text-foreground`,e?`opacity-100`:`opacity-0 pointer-events-none md:group-hover/msg:opacity-100 md:group-hover/msg:pointer-events-auto`),children:(0,J.jsx)(k,{className:`h-3 w-3`})}),e&&(0,J.jsx)(`div`,{className:`absolute bottom-full left-0 z-30 mb-1 flex gap-0.5 rounded-full border border-border bg-popover p-0.5 shadow-md`,children:Ve.map(e=>(0,J.jsx)(`button`,{type:`button`,title:`React ${e}`,onClick:()=>n(e),className:`inline-flex h-6 w-7 items-center justify-center rounded-full text-xs transition-colors hover:bg-muted`,children:e},e))})]})}function Dt({msg:e,peer:t}){let[r,i]=(0,U.useState)(!1),a=N(e=>e.agentsById),s=N(e=>e.openAgentDetail),c=e.from===t,l=(c?e.to:e.from)||``,u=a[c?t:l]?.issueRepo??a[t]?.issueRepo,d=!l||l===`broadcast`||l.includes(`:`),p=L(e),m=q(e.occurredAt??e.createdAt),h=c?n:f,_=a[e.from??``]??null;function v(e){e.stopPropagation(),_&&s(_)}return(0,J.jsx)(`div`,{"data-msg-id":e.id,className:`flex justify-center mb-1.5`,children:(0,J.jsxs)(`div`,{className:`w-full max-w-[94%] rounded-md border border-border/50 bg-muted/15 px-2.5 py-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs cursor-pointer select-none`,onClick:()=>i(e=>!e),children:[(0,J.jsx)(g,{className:o(`h-3 w-3 shrink-0 text-muted-foreground/60 transition-transform`,r&&`rotate-90`)}),(0,J.jsx)(`button`,{type:`button`,title:_?_.label||_.name||_.id:void 0,disabled:!_,onClick:v,className:o(`shrink-0 transition-opacity`,_?`cursor-pointer hover:opacity-80`:`cursor-default opacity-60`),children:(0,J.jsx)(H,{agent:_,className:`!w-4 !h-4 !rounded-sm opacity-70`})}),(0,J.jsx)(h,{className:`h-3 w-3 shrink-0 text-muted-foreground/70`}),(0,J.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`Message `,c?`to`:`from`]}),d?(0,J.jsx)(`span`,{className:`shrink-0 font-medium text-muted-foreground`,children:fe(l,a)}):(0,J.jsx)(Y,{agentId:l,className:`shrink-0 px-0.5 text-foreground/80`,noIcon:!0}),!r&&(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground/50`,children:p}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-muted-foreground/40`,children:m})]}),r&&(0,J.jsx)(`div`,{className:`mt-1.5 pl-5`,children:(0,J.jsx)(V,{text:p,rawBody:e.body,issueRepo:u,className:`text-sm leading-relaxed text-foreground/90`})})]})})}var Ot=(0,U.memo)(function({msg:e,peer:t,showAvatar:n=!1,onOpenReferencedPath:r,onPreviewReferencedPath:i,onPreviewReferencedPathEnd:a}){if(!B(e.from)&&!B(e.to))return(0,J.jsx)(Dt,{msg:e,peer:t});let s=e.kind===`session`?e.payload?.session:void 0;if(s?.type===`prompt`&&s?.origin===`provider`)return(0,J.jsx)(Ct,{msg:e,peer:t});let c=B(e.from),l=N(e=>e.reactToMessage),u=N(e=>e.voiceTtsEnabled),d=St(),f=N(e=>{let n=e.agentsById[t]?.meta?.cwd;return typeof n==`string`?n:``}),p=N(e=>e.agentsById[t]?.issueRepo),m=N(e=>e.usersById),h=N(e=>e.users.length>1),g=c?le(e.from,m):void 0,_=N(e=>e.openAgentDetail),[v,y]=(0,U.useState)(!1),b=(0,U.useRef)(null),x=(0,U.useRef)(null),S=(0,U.useRef)(!1),C=L(e),ne=q(e.occurredAt??e.createdAt),re=Be(e),w=He(e),T=c?Ue(e,t):null,E=T?.icon,D=d===String(e.id),O=u&&!c&&!K(e)&&C.trim().length>0;function ie(t){t.stopPropagation(),D?j.bargeIn():j.speak(e.body,String(e.id))}(0,U.useEffect)(()=>{if(!v)return;function e(e){ze()||b.current&&!b.current.contains(e.target)&&y(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)}},[v]);function k(e){return Fe(f||`/`,e)}function A(e,t){let n=k(e);r?.(n,t)}function ae(e,t,n){let r=k(e);i?.(r,t,n)}function M(t){l(e,t),y(!1)}function P(e){e.button===0&&(x.current={x:e.clientX,y:e.clientY},S.current=!1)}function oe(e){let t=x.current;t&&(Math.abs(e.clientX-t.x)>3||Math.abs(e.clientY-t.y)>3)&&(S.current=!0)}function F(t){if(!(K(e)||c)&&!t.target.closest(`a,button,input,textarea,select,[role="button"]`)){if(S.current||ze()){S.current=!1;return}y(e=>!e)}}let I=n&&!K(e);return(0,J.jsxs)(`div`,{"data-msg-id":e.id,className:o(`group/msg flex mb-3 items-end`,c?`justify-end`:`justify-start`,I&&`gap-1.5`),children:[!c&&I&&(0,J.jsx)(Tt,{agentId:t,onOpen:_}),(0,J.jsxs)(`div`,{ref:b,className:o(`relative`,I?`max-w-[calc(85%-2rem)] md:max-w-[calc(75%-2rem)]`:`max-w-[85%] md:max-w-[75%]`),children:[O&&(0,J.jsx)(`button`,{type:`button`,title:D?`Stop playback`:`Play aloud`,onClick:ie,className:o(`absolute -top-2 -right-2 z-20 inline-flex h-6 w-6 items-center justify-center rounded-full border bg-popover shadow-sm transition`,D?`border-primary/50 text-primary opacity-100`:`border-border text-muted-foreground opacity-70 hover:bg-muted hover:text-foreground hover:opacity-100 [@media(hover:hover)]:md:opacity-0 [@media(hover:hover)]:md:group-hover/msg:opacity-100`),children:D?(0,J.jsx)(te,{className:`h-3.5 w-3.5 animate-pulse`}):(0,J.jsx)(ee,{className:`h-3.5 w-3.5`})}),(0,J.jsxs)(`div`,{className:o(`rounded-2xl px-3.5 py-2 text-sm select-text`,!c&&!K(e)&&`cursor-pointer`,c?`bg-primary text-primary-foreground rounded-br-sm`:`bg-card ring-1 ring-foreground/10 rounded-bl-sm`),onPointerDown:P,onPointerMove:oe,onClick:F,children:[c&&h&&(0,J.jsx)(`p`,{className:o(`text-[11px] font-semibold mb-0.5 text-right`,ue(e.from)),children:pe(e.from,m)}),e.subject&&(0,J.jsx)(`p`,{className:o(`text-xs font-semibold mb-1`,c?`text-primary-foreground/70`:`text-muted-foreground`),children:e.subject}),(0,J.jsx)(V,{text:C,rawBody:e.body,issueRepo:p,className:`leading-relaxed`,onPrimary:c,onOpenPath:A,onPreviewPath:ae,onPreviewPathEnd:a,resolvePathTitle:(e,t)=>`${k(e)}${t?`:${t}`:``}`}),re.map(t=>(0,J.jsx)(Et,{attachment:t,outbound:c},`${e.id}-${t.artifactId}-${t.role||``}`)),(0,J.jsxs)(`p`,{className:o(`text-xs mt-1 flex items-center gap-1.5`,c?`justify-end text-primary-foreground/60`:`justify-end text-muted-foreground`),children:[(0,J.jsxs)(`span`,{className:`opacity-40`,children:[`#`,e.id]}),(0,J.jsx)(`span`,{children:ne}),T&&E&&(0,J.jsxs)(`span`,{className:o(`inline-flex items-center gap-1`,T.tone===`ok`&&`text-emerald-300`,T.tone===`warn`&&`text-amber-200`,T.tone===`danger`&&`text-red-200`),title:T.title,children:[(0,J.jsx)(E,{className:`h-3 w-3`}),T.label]})]})]}),!K(e)&&w.length>0&&(0,J.jsxs)(`div`,{className:o(`flex flex-wrap items-center gap-0.5 -mt-1 relative z-10`,c?`justify-end pr-2`:`justify-start pl-2`),children:[!c&&(0,J.jsx)($,{open:v,onToggle:()=>y(e=>!e),onReact:M}),w.map(e=>(0,J.jsxs)(`button`,{type:`button`,title:e.actors.join(`, `),onClick:()=>M(e.emoji),className:o(`inline-flex h-5 items-center gap-0.5 rounded-full border px-1.5 text-[11px] shadow-sm transition-colors`,e.mine?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-background hover:bg-muted text-foreground`),children:[(0,J.jsx)(`span`,{children:e.emoji}),e.count>1&&(0,J.jsx)(`span`,{children:e.count})]},e.emoji))]}),!K(e)&&!c&&w.length===0&&(0,J.jsx)(`div`,{className:`absolute -bottom-2.5 left-1 z-20`,children:(0,J.jsx)($,{open:v,onToggle:()=>y(e=>!e),onReact:M})})]}),c&&I&&(0,J.jsx)(`span`,{className:`shrink-0 self-end opacity-60`,children:(0,J.jsx)(_e,{user:g,address:e.from,distinct:h})})]})});export{Ge as C,Me as E,Re as S,je as T,qe as _,vt as a,Ye as b,bt as c,gt as d,ft as f,Pe as g,Ke as h,pt as i,Q as l,xt as m,ht as n,_t as o,Qe as p,ct as r,yt as s,Ot as t,rt as u,Le as v,Ae as w,Je as x,Ie as y};
4
- //# sourceMappingURL=MessageBubble-BO9eaLce.js.map
@@ -1,2 +0,0 @@
1
- import{B as e,W as t,Wt as n,Xn as r,f as i,h as a,tn as o}from"./lucide-react-uFIMC7W7.js";import{t as s}from"./store-DGM2s9L1.js";import{t as c}from"./badge-BbfOskRI.js";import{t as l}from"./button-DWiw--lT.js";var u=r(),d={host:`text-emerald-400 bg-emerald-500/10`,minimal:`text-amber-400 bg-amber-500/10`,isolated:`text-red-400 bg-red-500/10`,vanilla:`text-fuchsia-400 bg-fuchsia-500/10`};function f({relay:e}){return(0,u.jsx)(`div`,{className:`flex items-center gap-1`,children:[{key:`ctx`,on:e.context},{key:`skl`,on:e.skills},{key:`plg`,on:e.plugins},{key:`stl`,on:e.statusLine}].map(e=>(0,u.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e.on?`bg-emerald-400`:`bg-muted-foreground/30`}`,title:`${e.key}: ${e.on?`on`:`off`}`},e.key))})}function p({profile:e}){let r=s(e=>e.openProfileModal),i=s(e=>e.deleteProfile),p=e.builtIn===!0;return(0,u.jsxs)(`div`,{className:`group flex flex-col gap-3 rounded-lg border border-border bg-card p-4`,children:[(0,u.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.name}),p&&(0,u.jsx)(c,{variant:`secondary`,className:`text-[10px]`,children:`Built-in`}),e.overridden&&(0,u.jsx)(c,{variant:`outline`,className:`text-[10px] border-amber-500/30 bg-amber-500/10 text-amber-400`,children:`Overridden`})]}),e.description&&(0,u.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,u.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity`,children:[(0,u.jsx)(l,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`View`,onClick:()=>r(`view`,e),children:(0,u.jsx)(n,{className:`h-3.5 w-3.5`})}),(0,u.jsx)(l,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Edit`,onClick:()=>r(`edit`,e),children:(0,u.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,u.jsx)(l,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Duplicate`,onClick:()=>r(`duplicate`,e),children:(0,u.jsx)(o,{className:`h-3.5 w-3.5`})}),(!p||e.overridden)&&(0,u.jsx)(l,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7 text-destructive`,title:p?`Reset to default`:`Delete`,onClick:()=>i(e),children:(0,u.jsx)(a,{className:`h-3.5 w-3.5`})})]})]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,u.jsx)(c,{variant:`outline`,className:d[e.base]||``,children:e.base}),(0,u.jsx)(c,{variant:`outline`,children:e.provider||`any`}),(0,u.jsxs)(c,{variant:`outline`,children:[`fs: `,e.permissions.filesystem]}),e.permissions.mode&&(0,u.jsx)(c,{variant:`outline`,children:e.permissions.mode})]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted-foreground`,children:[(0,u.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Relay `,(0,u.jsx)(f,{relay:e.relay})]}),(0,u.jsxs)(`span`,{children:[`MCP: `,e.mcp.mode]}),(0,u.jsxs)(`span`,{children:[`Hooks: `,e.hooks.mode]}),e.instructions.globalInstructions===`ignore`&&(0,u.jsx)(`span`,{className:`text-amber-400`,children:`global: ignore`}),Object.keys(e.env||{}).length>0&&(0,u.jsxs)(`span`,{children:[Object.keys(e.env).length,` env vars`]})]})]})}function m(){let t=s(e=>e.agentProfiles),n=s(e=>e.openProfileModal),r=t.filter(e=>e.builtIn),a=t.filter(e=>!e.builtIn);return(0,u.jsxs)(`div`,{className:`space-y-4`,children:[(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,u.jsx)(i,{className:`h-5 w-5 text-primary`}),`Agent Profiles`]}),(0,u.jsx)(c,{variant:`outline`,children:t.length}),(0,u.jsx)(`div`,{className:`flex-1`}),(0,u.jsxs)(l,{size:`sm`,className:`gap-1`,onClick:()=>n(`create`),children:[(0,u.jsx)(e,{className:`h-3.5 w-3.5`}),`Create Profile`]})]}),r.length>0&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Built-in`}),(0,u.jsx)(`div`,{className:`grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,children:r.map(e=>(0,u.jsx)(p,{profile:e},e.name))})]}),a.length>0&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Custom`}),(0,u.jsx)(`div`,{className:`grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,children:a.map(e=>(0,u.jsx)(p,{profile:e},e.name))})]}),t.length===0&&(0,u.jsx)(`div`,{className:`py-12 text-center text-sm text-muted-foreground`,children:`No agent profiles found. Create one to configure agent behavior.`})]})}export{m as AgentProfilesView};
2
- //# sourceMappingURL=agent-profiles-lEZqu7Gm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-profiles-lEZqu7Gm.js","names":[],"sources":["../../dashboard/src/components/views/agent-profiles.tsx"],"sourcesContent":["import { useRelayStore } from '@/store'\nimport { Button } from '@/components/ui/button'\nimport { Badge } from '@/components/ui/badge'\nimport { Copy, Eye, Pencil, Plus, Trash2, UserCog } from 'lucide-react'\nimport type { AgentProfile } from '@/types'\n\nconst BASE_COLORS: Record<string, string> = {\n host: 'text-emerald-400 bg-emerald-500/10',\n minimal: 'text-amber-400 bg-amber-500/10',\n isolated: 'text-red-400 bg-red-500/10',\n vanilla: 'text-fuchsia-400 bg-fuchsia-500/10',\n}\n\nfunction RelayDots({ relay }: { relay: AgentProfile['relay'] }) {\n const items = [\n { key: 'ctx', on: relay.context },\n { key: 'skl', on: relay.skills },\n { key: 'plg', on: relay.plugins },\n { key: 'stl', on: relay.statusLine },\n ]\n return (\n <div className=\"flex items-center gap-1\">\n {items.map((item) => (\n <span key={item.key} className={`inline-block h-1.5 w-1.5 rounded-full ${item.on ? 'bg-emerald-400' : 'bg-muted-foreground/30'}`} title={`${item.key}: ${item.on ? 'on' : 'off'}`} />\n ))}\n </div>\n )\n}\n\nfunction ProfileCard({ profile }: { profile: AgentProfile }) {\n const openProfileModal = useRelayStore((s) => s.openProfileModal)\n const deleteProfile = useRelayStore((s) => s.deleteProfile)\n const isBuiltIn = profile.builtIn === true\n\n return (\n <div className=\"group flex flex-col gap-3 rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-start gap-2\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"font-mono text-sm font-medium\">{profile.name}</span>\n {isBuiltIn && <Badge variant=\"secondary\" className=\"text-[10px]\">Built-in</Badge>}\n {profile.overridden && <Badge variant=\"outline\" className=\"text-[10px] border-amber-500/30 bg-amber-500/10 text-amber-400\">Overridden</Badge>}\n </div>\n {profile.description && (\n <p className=\"mt-0.5 text-xs text-muted-foreground line-clamp-2\">{profile.description}</p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity\">\n <Button variant=\"ghost\" size=\"icon-sm\" className=\"h-7 w-7\" title=\"View\" onClick={() => openProfileModal('view', profile)}>\n <Eye className=\"h-3.5 w-3.5\" />\n </Button>\n <Button variant=\"ghost\" size=\"icon-sm\" className=\"h-7 w-7\" title=\"Edit\" onClick={() => openProfileModal('edit', profile)}>\n <Pencil className=\"h-3.5 w-3.5\" />\n </Button>\n <Button variant=\"ghost\" size=\"icon-sm\" className=\"h-7 w-7\" title=\"Duplicate\" onClick={() => openProfileModal('duplicate', profile)}>\n <Copy className=\"h-3.5 w-3.5\" />\n </Button>\n {(!isBuiltIn || profile.overridden) && (\n <Button variant=\"ghost\" size=\"icon-sm\" className=\"h-7 w-7 text-destructive\" title={isBuiltIn ? 'Reset to default' : 'Delete'} onClick={() => deleteProfile(profile)}>\n <Trash2 className=\"h-3.5 w-3.5\" />\n </Button>\n )}\n </div>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-1.5 text-[10px]\">\n <Badge variant=\"outline\" className={BASE_COLORS[profile.base] || ''}>{profile.base}</Badge>\n <Badge variant=\"outline\">{profile.provider || 'any'}</Badge>\n <Badge variant=\"outline\">fs: {profile.permissions.filesystem}</Badge>\n {profile.permissions.mode && <Badge variant=\"outline\">{profile.permissions.mode}</Badge>}\n </div>\n\n <div className=\"flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted-foreground\">\n <span className=\"flex items-center gap-1\">\n Relay <RelayDots relay={profile.relay} />\n </span>\n <span>MCP: {profile.mcp.mode}</span>\n <span>Hooks: {profile.hooks.mode}</span>\n {profile.instructions.globalInstructions === 'ignore' && <span className=\"text-amber-400\">global: ignore</span>}\n {Object.keys(profile.env || {}).length > 0 && <span>{Object.keys(profile.env).length} env vars</span>}\n </div>\n </div>\n )\n}\n\nexport function AgentProfilesView() {\n const profiles = useRelayStore((s) => s.agentProfiles)\n const openProfileModal = useRelayStore((s) => s.openProfileModal)\n\n const builtIn = profiles.filter((p) => p.builtIn)\n const custom = profiles.filter((p) => !p.builtIn)\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <div className=\"flex items-center gap-2 text-lg font-semibold\">\n <UserCog className=\"h-5 w-5 text-primary\" />\n Agent Profiles\n </div>\n <Badge variant=\"outline\">{profiles.length}</Badge>\n <div className=\"flex-1\" />\n <Button size=\"sm\" className=\"gap-1\" onClick={() => openProfileModal('create')}>\n <Plus className=\"h-3.5 w-3.5\" />\n Create Profile\n </Button>\n </div>\n\n {builtIn.length > 0 && (\n <div>\n <h3 className=\"mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider\">Built-in</h3>\n <div className=\"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3\">\n {builtIn.map((p) => <ProfileCard key={p.name} profile={p} />)}\n </div>\n </div>\n )}\n\n {custom.length > 0 && (\n <div>\n <h3 className=\"mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider\">Custom</h3>\n <div className=\"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3\">\n {custom.map((p) => <ProfileCard key={p.name} profile={p} />)}\n </div>\n </div>\n )}\n\n {profiles.length === 0 && (\n <div className=\"py-12 text-center text-sm text-muted-foreground\">\n No agent profiles found. Create one to configure agent behavior.\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"+NAMM,EAAsC,CAC1C,KAAM,qCACN,QAAS,iCACT,SAAU,6BACV,QAAS,qCACV,CAED,SAAS,EAAU,CAAE,SAA2C,CAO9D,OACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,mCACZ,CAPH,CAAE,IAAK,MAAO,GAAI,EAAM,QAAS,CACjC,CAAE,IAAK,MAAO,GAAI,EAAM,OAAQ,CAChC,CAAE,IAAK,MAAO,GAAI,EAAM,QAAS,CACjC,CAAE,IAAK,MAAO,GAAI,EAAM,WAAY,CAIjC,CAAM,IAAK,IACV,EAAA,EAAA,KAAC,OAAD,CAAqB,UAAW,yCAAyC,EAAK,GAAK,iBAAmB,2BAA4B,MAAO,GAAG,EAAK,IAAI,IAAI,EAAK,GAAK,KAAO,QAAW,CAA1K,EAAK,IAAqK,CACrL,CACE,CAAA,CAIV,SAAS,EAAY,CAAE,WAAsC,CAC3D,IAAM,EAAmB,EAAe,GAAM,EAAE,iBAAiB,CAC3D,EAAgB,EAAe,GAAM,EAAE,cAAc,CACrD,EAAY,EAAQ,UAAY,GAEtC,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,iFAAf,EACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,kCAAf,EACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,0BAAf,EACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,mCAAf,EACE,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,yCAAiC,EAAQ,KAAY,CAAA,CACpE,IAAa,EAAA,EAAA,KAAC,EAAD,CAAO,QAAQ,YAAY,UAAU,uBAAc,WAAgB,CAAA,CAChF,EAAQ,aAAc,EAAA,EAAA,KAAC,EAAD,CAAO,QAAQ,UAAU,UAAU,0EAAiE,aAAkB,CAAA,CACzI,GACL,EAAQ,cACP,EAAA,EAAA,KAAC,IAAD,CAAG,UAAU,6DAAqD,EAAQ,YAAgB,CAAA,CAExF,IACN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qHAAf,EACE,EAAA,EAAA,KAAC,EAAD,CAAQ,QAAQ,QAAQ,KAAK,UAAU,UAAU,UAAU,MAAM,OAAO,YAAe,EAAiB,OAAQ,EAAQ,WACtH,EAAA,EAAA,KAAC,EAAD,CAAK,UAAU,cAAgB,CAAA,CACxB,CAAA,EACT,EAAA,EAAA,KAAC,EAAD,CAAQ,QAAQ,QAAQ,KAAK,UAAU,UAAU,UAAU,MAAM,OAAO,YAAe,EAAiB,OAAQ,EAAQ,WACtH,EAAA,EAAA,KAAC,EAAD,CAAQ,UAAU,cAAgB,CAAA,CAC3B,CAAA,EACT,EAAA,EAAA,KAAC,EAAD,CAAQ,QAAQ,QAAQ,KAAK,UAAU,UAAU,UAAU,MAAM,YAAY,YAAe,EAAiB,YAAa,EAAQ,WAChI,EAAA,EAAA,KAAC,EAAD,CAAM,UAAU,cAAgB,CAAA,CACzB,CAAA,EACP,CAAC,GAAa,EAAQ,cACtB,EAAA,EAAA,KAAC,EAAD,CAAQ,QAAQ,QAAQ,KAAK,UAAU,UAAU,2BAA2B,MAAO,EAAY,mBAAqB,SAAU,YAAe,EAAc,EAAQ,WACjK,EAAA,EAAA,KAAC,EAAD,CAAQ,UAAU,cAAgB,CAAA,CAC3B,CAAA,CAEP,GACF,IAEN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,2DAAf,EACE,EAAA,EAAA,KAAC,EAAD,CAAO,QAAQ,UAAU,UAAW,EAAY,EAAQ,OAAS,YAAK,EAAQ,KAAa,CAAA,EAC3F,EAAA,EAAA,KAAC,EAAD,CAAO,QAAQ,mBAAW,EAAQ,UAAY,MAAc,CAAA,EAC5D,EAAA,EAAA,MAAC,EAAD,CAAO,QAAQ,mBAAf,CAAyB,OAAK,EAAQ,YAAY,WAAmB,GACpE,EAAQ,YAAY,OAAQ,EAAA,EAAA,KAAC,EAAD,CAAO,QAAQ,mBAAW,EAAQ,YAAY,KAAa,CAAA,CACpF,IAEN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,yFAAf,EACE,EAAA,EAAA,MAAC,OAAD,CAAM,UAAU,mCAAhB,CAA0C,UAClC,EAAA,EAAA,KAAC,EAAD,CAAW,MAAO,EAAQ,MAAS,CAAA,CACpC,IACP,EAAA,EAAA,MAAC,OAAD,CAAA,SAAA,CAAM,QAAM,EAAQ,IAAI,KAAY,CAAA,CAAA,EACpC,EAAA,EAAA,MAAC,OAAD,CAAA,SAAA,CAAM,UAAQ,EAAQ,MAAM,KAAY,CAAA,CAAA,CACvC,EAAQ,aAAa,qBAAuB,WAAY,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,0BAAiB,iBAAqB,CAAA,CAC9G,OAAO,KAAK,EAAQ,KAAO,EAAE,CAAC,CAAC,OAAS,IAAK,EAAA,EAAA,MAAC,OAAD,CAAA,SAAA,CAAO,OAAO,KAAK,EAAQ,IAAI,CAAC,OAAO,YAAgB,CAAA,CAAA,CACjG,GACF,GAIV,SAAgB,GAAoB,CAClC,IAAM,EAAW,EAAe,GAAM,EAAE,cAAc,CAChD,EAAmB,EAAe,GAAM,EAAE,iBAAiB,CAE3D,EAAU,EAAS,OAAQ,GAAM,EAAE,QAAQ,CAC3C,EAAS,EAAS,OAAQ,GAAM,CAAC,EAAE,QAAQ,CAEjD,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qBAAf,EACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,6CAAf,EACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,yDAAf,EACE,EAAA,EAAA,KAAC,EAAD,CAAS,UAAU,uBAAyB,CAAA,CAAA,iBAExC,IACN,EAAA,EAAA,KAAC,EAAD,CAAO,QAAQ,mBAAW,EAAS,OAAe,CAAA,EAClD,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,SAAW,CAAA,EAC1B,EAAA,EAAA,MAAC,EAAD,CAAQ,KAAK,KAAK,UAAU,QAAQ,YAAe,EAAiB,SAAS,UAA7E,EACE,EAAA,EAAA,KAAC,EAAD,CAAM,UAAU,cAAgB,CAAA,CAAA,iBAEzB,GACL,GAEL,EAAQ,OAAS,IAChB,EAAA,EAAA,MAAC,MAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,KAAD,CAAI,UAAU,mFAA0E,WAAa,CAAA,EACrG,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gEACZ,EAAQ,IAAK,IAAM,EAAA,EAAA,KAAC,EAAD,CAA0B,QAAS,EAAK,CAAtB,EAAE,KAAoB,CAAC,CACzD,CAAA,CACF,CAAA,CAAA,CAGP,EAAO,OAAS,IACf,EAAA,EAAA,MAAC,MAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,KAAD,CAAI,UAAU,mFAA0E,SAAW,CAAA,EACnG,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gEACZ,EAAO,IAAK,IAAM,EAAA,EAAA,KAAC,EAAD,CAA0B,QAAS,EAAK,CAAtB,EAAE,KAAoB,CAAC,CACxD,CAAA,CACF,CAAA,CAAA,CAGP,EAAS,SAAW,IACnB,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,2DAAkD,mEAE3D,CAAA,CAEJ"}
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{B as t,G as n,Jn as r,Q as i,R as a,Rt as o,Wn as s,Xn as c,g as l,h as u,i as d,l as f,lr as p,mt as m,qt as h,tt as g,zn as ee}from"./lucide-react-uFIMC7W7.js";import{l as te,t as _}from"./store-DGM2s9L1.js";import{J as v,K as y,W as ne,Y as b,a as x,d as S,i as re,n as ie}from"./display-DRiGi1zj.js";import{o as C,r as w}from"./dist-zTw85jD8.js";import{t as T}from"./dist-Du_bcq-z.js";import{i as E,n as D}from"./dist-KxiSP9h9.js";import{t as O}from"./dist-eG_93I3z.js";import{t as k}from"./dist-CtuS_3Jl.js";import{a as A,i as j,n as M,o as N,r as P,s as F,t as I}from"./es2015-ibwCE_JR.js";import{a as L,i as ae,n as R,r as oe,t as z}from"./dist-BQXmO19g.js";import{t as B}from"./badge-BbfOskRI.js";import{t as V}from"./button-DWiw--lT.js";import{t as se}from"./copy-button-CIXy8ks6.js";import{G as H,K as U,L as ce,T as W,U as le,W as G,_ as ue,d as de,g as fe,l as pe,p as me,u as he,v as ge,w as K,y as _e}from"./index-D1GX2b-m.js";import{r as ve,t as ye}from"./card-BeqvuYTT.js";import{n as be,t as xe}from"./branch-state-badge-ClWlvQks.js";var q=e(p(),1),J=c(),Y=`Popover`,[Se,Ce]=E(Y,[L]),X=L(),[we,Z]=Se(Y),Te=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=X(t),c=q.useRef(null),[l,u]=q.useState(!1),[d,f]=O({prop:r,defaultProp:i??!1,onChange:a,caller:Y});return(0,J.jsx)(ae,{...s,children:(0,J.jsx)(we,{scope:t,contentId:F(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:q.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:q.useCallback(()=>u(!0),[]),onCustomAnchorRemove:q.useCallback(()=>u(!1),[]),modal:o,children:n})})};Te.displayName=Y;var Ee=`PopoverAnchor`,De=q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Z(Ee,n),a=X(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return q.useEffect(()=>(o(),()=>s()),[o,s]),(0,J.jsx)(z,{...a,...r,ref:t})});De.displayName=Ee;var Oe=`PopoverTrigger`,ke=q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Z(Oe,n),a=X(n),o=C(t,i.triggerRef),s=(0,J.jsx)(T.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":He(i.open),...r,ref:o,onClick:D(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,J.jsx)(z,{asChild:!0,...a,children:s})});ke.displayName=Oe;var Q=`PopoverPortal`,[Ae,je]=Se(Q,{forceMount:void 0}),Me=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Z(Q,t);return(0,J.jsx)(Ae,{scope:t,forceMount:n,children:(0,J.jsx)(k,{present:n||a.open,children:(0,J.jsx)(j,{asChild:!0,container:i,children:r})})})};Me.displayName=Q;var $=`PopoverContent`,Ne=q.forwardRef((e,t)=>{let n=je($,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Z($,e.__scopePopover);return(0,J.jsx)(k,{present:r||a.open,children:a.modal?(0,J.jsx)(Fe,{...i,ref:t}):(0,J.jsx)(Ie,{...i,ref:t})})});Ne.displayName=$;var Pe=w(`PopoverContent.RemoveScroll`),Fe=q.forwardRef((e,t)=>{let n=Z($,e.__scopePopover),r=q.useRef(null),i=C(t,r),a=q.useRef(!1);return q.useEffect(()=>{let e=r.current;if(e)return I(e)},[]),(0,J.jsx)(M,{as:Pe,allowPinchZoom:!0,children:(0,J.jsx)(Le,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:D(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:D(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:D(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ie=q.forwardRef((e,t)=>{let n=Z($,e.__scopePopover),r=q.useRef(!1),i=q.useRef(!1);return(0,J.jsx)(Le,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Le=q.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Z($,n),p=X(n);return P(),(0,J.jsx)(A,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,J.jsx)(N,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,J.jsx)(oe,{"data-state":He(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Re=`PopoverClose`,ze=q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Z(Re,n);return(0,J.jsx)(T.button,{type:`button`,...r,ref:t,onClick:D(e.onClick,()=>i.onOpenChange(!1))})});ze.displayName=Re;var Be=`PopoverArrow`,Ve=q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=X(n);return(0,J.jsx)(R,{...i,...r,ref:t})});Ve.displayName=Be;function He(e){return e?`open`:`closed`}var Ue=Te,We=ke,Ge=Me,Ke=Ne;function qe({...e}){return(0,J.jsx)(Ue,{"data-slot":`popover`,...e})}function Je({...e}){return(0,J.jsx)(We,{"data-slot":`popover-trigger`,...e})}function Ye({className:e,align:t=`center`,sideOffset:n=4,...i}){return(0,J.jsx)(Ge,{children:(0,J.jsx)(Ke,{"data-slot":`popover-content`,align:t,sideOffset:n,className:r(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...i})})}function Xe({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`popover-header`,className:r(`flex flex-col gap-0.5 text-sm`,e),...t})}function Ze({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`popover-title`,className:r(`font-medium`,e),...t})}function Qe({agent:e,childAgents:t=[],parentAgent:r}){let s=te();_(e=>e.set);let c=_(e=>e.switchView),d=_(e=>e.openInboxThread),p=_(e=>e.openAgentDetail),ee=_(e=>e.openPairInvite),C=_(e=>e.openRename),w=_(e=>e.openConfirm),T=_(e=>e.doAgentAction),E=_(e=>e.doDeleteAgent),D=_(e=>e.openFilesForAgent),O=_(e=>e.workspaceAction),k=_(e=>e.openWorkspaceFocus),{terminalOpen:A,terminalTarget:j,terminalOpening:M,openTerminal:N,closeTerminal:P}=be(e.id),F=le(),I=re(s,e,ce(e),F[e.id]||null),L=x(e,`shutdown`),ae=x(e,`compact`),R=x(e,`clearContext`),oe=!!(e.providerCapabilities?.terminal?.live?.read||e.providerCapabilities?.terminal?.attach?.create),z=!!(e.providerCapabilities?.terminal?.live?.write||e.providerCapabilities?.model?.provider===`claude`),H=ie(e),U=r?S(r):e.spawnedBy,G=t.length>0;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ye,{className:`group hover:border-zinc-600 transition-colors cursor-pointer`,onClick:()=>p(e),children:(0,J.jsxs)(ve,{className:`p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5 mb-2.5`,children:[(0,J.jsx)(W,{agent:e,now:s,className:`mt-0.5`}),(0,J.jsx)(K,{agent:e}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium truncate`,children:S(e)}),(0,J.jsx)(`div`,{className:`text-xs mt-0.5 ${v(I.tone)}`,children:I.label}),typeof e.meta?.cwd==`string`&&e.meta.cwd&&(0,J.jsx)(`button`,{type:`button`,className:`mt-0.5 block max-w-full truncate font-mono text-[10px] text-muted-foreground hover:text-foreground`,title:`Open ${e.meta.cwd} in Files`,onClick:t=>{t.stopPropagation(),D(e)},children:ne(e.meta.cwd)}),(0,J.jsx)(me,{agent:e,className:`mt-1`})]}),e.branchState&&e.branchWorkspaceId&&(0,J.jsx)(xe,{state:e.branchState,className:`mt-0.5 shrink-0`,onClick:t=>{t.stopPropagation(),k(e.branchWorkspaceId)}})]}),I.badges.length>0&&(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:I.badges.map(e=>(0,J.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium ${e.className}`,children:e.label},e.label))}),(G||e.spawnedBy&&U)&&(0,J.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,onClick:e=>e.stopPropagation(),children:[G&&(0,J.jsxs)(qe,{children:[(0,J.jsx)(Je,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex h-6 max-w-full items-center gap-1.5 rounded-full border border-sky-500/30 bg-sky-500/10 px-2 text-[10px] font-medium text-sky-300 transition-colors hover:bg-sky-500/15`,title:`${t.length} live child ${t.length===1?`agent`:`agents`}`,children:[(0,J.jsx)(f,{className:`h-3 w-3`}),(0,J.jsx)(`span`,{children:t.length}),(0,J.jsx)(`span`,{className:`flex -space-x-1`,children:t.slice(0,4).map(e=>(0,J.jsx)(W,{agent:e,now:s,className:`h-2 w-2 ring-1 ring-background`},e.id))})]})}),(0,J.jsxs)(Ye,{align:`start`,className:`w-80`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(Xe,{children:(0,J.jsx)(Ze,{children:`Team`})}),(0,J.jsx)(`div`,{className:`space-y-1.5`,children:t.map(e=>(0,J.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(W,{agent:e,now:s,className:`mt-1`}),(0,J.jsx)(K,{agent:e}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-xs font-medium`,children:S(e)}),(0,J.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.providerCapabilities?.model?.alias||e.providerCapabilities?.model?.id||e.providerCapabilities?.model?.provider||e.status})]}),(0,J.jsx)(B,{variant:`outline`,className:`h-4 px-1.5 text-[9px]`,children:e.status})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex gap-1`,children:[(0,J.jsx)(V,{size:`xs`,variant:`outline`,onClick:()=>p(e),children:`Open`}),(0,J.jsxs)(V,{size:`xs`,variant:`ghost`,onClick:()=>{d(e.id),c(`chat`)},children:[(0,J.jsx)(g,{className:`h-3 w-3`}),`Chat`]})]})]},e.id))})]})]}),e.spawnedBy&&U&&(0,J.jsx)(B,{variant:`outline`,className:`max-w-full text-[10px] text-muted-foreground`,children:(0,J.jsxs)(`span`,{className:`truncate`,children:[`spawned by `,U]})})]}),(e.tags.length>0||b(e.capabilities).length>0)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:[e.tags.slice(0,3).map(e=>(0,J.jsx)(B,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e)),b(e.capabilities).slice(0,2).map(e=>(0,J.jsx)(B,{variant:`secondary`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))]}),(0,J.jsxs)(`div`,{className:`space-y-2 mb-2`,children:[(0,J.jsx)(ge,{agent:e}),(0,J.jsx)(ue,{agent:e,compact:!0}),(0,J.jsx)(_e,{agent:e})]}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.id!==`user`&&e.id!==`system`&&y(s,e.lastSeen)}),(0,J.jsxs)(`div`,{className:`flex gap-1 mt-2.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(se,{value:e.id,label:`Copy agent ID`,size:`icon`,className:`h-7 w-7`,iconClassName:`w-3 h-3`}),(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Chat`,onClick:()=>{d(e.id),c(`chat`)},children:(0,J.jsx)(g,{className:`w-3 h-3`})}),(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Pair`,onClick:()=>ee(e.id),children:(0,J.jsx)(m,{className:`w-3 h-3`})}),(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Rename`,onClick:()=>C(e),children:(0,J.jsx)(n,{className:`w-3 h-3`})}),oe&&(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Terminal`,disabled:M,onClick:()=>void N(),children:(0,J.jsx)(l,{className:`w-3 h-3`})}),(e.branchState===`changes`||e.branchState===`idle`)&&e.branchWorkspaceId&&(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-amber-400 hover:text-amber-300`,title:`Mark workspace ready — hand off to the auto-merge`,onClick:()=>w(`Mark Workspace Ready`,`Mark ${S(e)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>O(e.branchWorkspaceId,`ready`)),children:(0,J.jsx)(o,{className:`w-3 h-3`})}),ae&&(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Compact`,onClick:()=>w(`Compact Agent`,`Compact context for ${S(e)}?`,()=>T(e,`compact`,`agents-grid`)),children:(0,J.jsx)(i,{className:`w-3 h-3`})}),R&&(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Clear Context`,onClick:()=>w(`Clear Context`,`Clear context for ${S(e)}?`,()=>T(e,`clearContext`,`agents-grid`)),children:(0,J.jsx)(h,{className:`w-3 h-3`})}),L&&(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-red-400 hover:text-red-300`,title:`Shutdown`,onClick:()=>w(`Shutdown Agent`,`Shutdown ${S(e)}?`,()=>T(e,`shutdown`,`agents-grid`)),children:(0,J.jsx)(a,{className:`w-3 h-3`})}),H&&(0,J.jsx)(V,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-red-400 hover:text-red-300`,title:`Forget stale agent`,onClick:()=>w(`Forget Agent`,`Forget ${S(e)}?`,()=>E(e.id)),children:(0,J.jsx)(u,{className:`w-3 h-3`})})]})]})}),j&&(0,J.jsx)(fe,{open:A,onOpenChange:P,orchestratorId:j.orchestratorId,session:j.session,interactive:j.interactive||z})]})}function $e(){let e=_(e=>e.agentPresetFilter),n=_(e=>e.agentStatusFilter),r=_(e=>e.agentTagFilter),i=_(e=>e.agentHostFilter),a=_(e=>e.agentSort),o=_(e=>e.agentSortDir),c=_(e=>e.showOffline),l=_(e=>e.set),u=_(e=>e.openAgentSpawn),f=_(e=>e.agentsById),p=te(),m=G(),h=U(),g=H(),v=pe(m,p),y=de(m,p),ne=e||n||r||i;function b(){l({agentPresetFilter:``,agentStatusFilter:``,agentTagFilter:``,agentHostFilter:``})}function x(){l({agentSortDir:o===`asc`?`desc`:`asc`})}return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`select`,{value:e,onChange:e=>l({agentPresetFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,J.jsx)(`option`,{value:``,children:`All agents`}),(0,J.jsx)(`option`,{value:`active`,children:`Active`}),(0,J.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,J.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,J.jsx)(`option`,{value:`paired`,children:`Paired`}),(0,J.jsx)(`option`,{value:`unpaired`,children:`Unpaired`}),(0,J.jsx)(`option`,{value:`offline_stale`,children:`Offline / Stale`})]}),(0,J.jsxs)(`select`,{value:n,onChange:e=>l({agentStatusFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,J.jsx)(`option`,{value:``,children:`Any status`}),(0,J.jsx)(`option`,{value:`online`,children:`Online`}),(0,J.jsx)(`option`,{value:`idle`,children:`Idle`}),(0,J.jsx)(`option`,{value:`busy`,children:`Busy`}),(0,J.jsx)(`option`,{value:`offline`,children:`Offline`}),(0,J.jsx)(`option`,{value:`starting`,children:`Starting`})]}),h.length>0&&(0,J.jsxs)(`select`,{value:r,onChange:e=>l({agentTagFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,J.jsx)(`option`,{value:``,children:`Any tag`}),h.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]}),g.length>1&&(0,J.jsxs)(`select`,{value:i,onChange:e=>l({agentHostFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,J.jsx)(`option`,{value:``,children:`Any host`}),g.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]}),(0,J.jsxs)(`select`,{value:a,onChange:e=>l({agentSort:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,J.jsx)(`option`,{value:`status`,children:`Sort: Status`}),(0,J.jsx)(`option`,{value:`name`,children:`Sort: Name`}),(0,J.jsx)(`option`,{value:`lastSeen`,children:`Sort: Last seen`}),(0,J.jsx)(`option`,{value:`created`,children:`Sort: Created`})]}),(0,J.jsx)(V,{size:`icon`,variant:`outline`,className:`h-8 w-8`,title:`Toggle sort direction`,onClick:x,children:o===`asc`?(0,J.jsx)(ee,{className:`w-3.5 h-3.5`}):(0,J.jsx)(s,{className:`w-3.5 h-3.5`})}),(0,J.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground cursor-pointer select-none`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l({showOffline:e.target.checked}),className:`rounded`}),`Show offline`]}),ne&&(0,J.jsxs)(V,{size:`sm`,variant:`ghost`,className:`h-8 text-muted-foreground hover:text-foreground gap-1`,onClick:b,children:[(0,J.jsx)(d,{className:`w-3 h-3`}),`Clear filters`]}),(0,J.jsx)(`div`,{className:`ml-auto`,children:(0,J.jsxs)(V,{size:`sm`,onClick:u,className:`gap-1`,children:[(0,J.jsx)(t,{className:`w-3.5 h-3.5`}),`Spawn`]})})]}),y.length===0?(0,J.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:`No agents match the current filters.`}):(0,J.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-3`,children:y.map(e=>(0,J.jsx)(Qe,{agent:e,parentAgent:e.spawnedBy?f[e.spawnedBy]??null:null,childAgents:he(v.get(e.id)??[])},e.id))})]})}export{$e as AgentsView};
2
- //# sourceMappingURL=agents-DwXYbjeZ.js.map
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{Jn as t,Ot as n,Xn as r,Zn as i,a,lr as o,m as s,mn as c,sn as l}from"./lucide-react-uFIMC7W7.js";import{t as u}from"./store-DGM2s9L1.js";var d=e(o(),1);function f(e){let t=u(e=>e.showError),[n,r]=(0,d.useState)(!1),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(!1);async function l(){if(!(!e||s)){c(!0);try{o(await i(`POST`,`/agents/`+encodeURIComponent(e)+`/terminal-session`)),r(!0)}catch(e){t(`Terminal Failed`,e.message)}finally{c(!1)}}}function f(t){if(t){r(!0);return}r(!1);let n=a;o(null),e&&n?.mode===`guest`&&i(`DELETE`,`/agents/`+encodeURIComponent(e)+`/terminal-session/`+encodeURIComponent(n.session)).catch(()=>{})}return{terminalOpen:n,terminalTarget:a,terminalOpening:s,openTerminal:l,closeTerminal:f}}var p=r(),m={idle:{label:`idle`,tip:`Branch worktree — nothing to land yet.`,className:`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`,Icon:l},changes:{label:`changes`,tip:`Unlanded work in this branch — use "Mark workspace ready" to land it.`,className:`bg-amber-500/10 text-amber-400 border-amber-500/20`,Icon:n},ready:{label:`ready`,tip:`Handed off — the relay auto-merge will land it (~2 min sweep).`,className:`bg-blue-500/10 text-blue-400 border-blue-500/20`,Icon:c},steward:{label:`steward`,tip:`Under reconciliation — a steward is landing it. No action needed.`,className:`bg-orange-500/10 text-orange-400 border-orange-500/20`,Icon:a},blocked:{label:`blocked`,tip:`Escalated — the auto-merge/steward path is stuck. Needs human attention.`,className:`bg-red-500/10 text-red-400 border-red-500/20`,Icon:s}};function h({state:e,onClick:n,iconOnly:r=!1,className:i}){let a=m[e],{Icon:o}=a,s=!!n,c=s?`${a.tip} Click to open this workspace.`:a.tip;return(0,p.jsxs)(`span`,{role:s?`button`:void 0,tabIndex:s?0:void 0,title:c,onClick:n,onKeyDown:s?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n?.(e))}:void 0,className:t(`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium leading-none`,a.className,s&&`cursor-pointer hover:brightness-125 focus:outline-none focus:ring-1 focus:ring-current`,i),children:[(0,p.jsx)(o,{className:`h-2.5 w-2.5 shrink-0`}),!r&&(0,p.jsx)(`span`,{children:a.label})]})}export{f as n,h as t};
2
- //# sourceMappingURL=branch-state-badge-ClWlvQks.js.map
@@ -1,2 +0,0 @@
1
- import"./chunk-CilyBKbf.js";import{Jn as e,Xn as t,lr as n}from"./lucide-react-uFIMC7W7.js";n();var r=t();function i({className:t,size:n=`default`,...i}){return(0,r.jsx)(`div`,{"data-slot":`card`,"data-size":n,className:e(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,t),...i})}function a({className:t,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-header`,className:e(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,t),...n})}function o({className:t,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-title`,className:e(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,t),...n})}function s({className:t,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-description`,className:e(`text-sm text-muted-foreground`,t),...n})}function c({className:t,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-action`,className:e(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,t),...n})}function l({className:t,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-content`,className:e(`px-4 group-data-[size=sm]/card:px-3`,t),...n})}export{a,s as i,c as n,o,l as r,i as t};
2
- //# sourceMappingURL=card-BeqvuYTT.js.map