@agimon-ai/po-team 0.0.0-alpha.21 → 0.0.0-alpha.210

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 (112) hide show
  1. package/LICENSE +95 -171
  2. package/NOTICE +35 -0
  3. package/README.md +24 -111
  4. package/dist/{agentDiscovery-ZNG8iZXV.mjs → agentDiscovery-BiMO2Ibu.mjs} +190 -193
  5. package/dist/agentDiscovery-BiMO2Ibu.mjs.map +1 -0
  6. package/dist/{agentDiscovery-DTTlM_LT.cjs → agentDiscovery-D0VcSETk.cjs} +268 -227
  7. package/dist/agentDiscovery-D0VcSETk.cjs.map +1 -0
  8. package/dist/apiContracts.cjs +1 -1
  9. package/dist/apiContracts.cjs.map +1 -1
  10. package/dist/apiContracts.d.mts +2 -2
  11. package/dist/apiContracts.mjs +1 -1
  12. package/dist/apiContracts.mjs.map +1 -1
  13. package/dist/{capabilityCeiling-BaHT9v9S.mjs → capabilityCeiling-DFcqYSTc.mjs} +3 -22
  14. package/dist/capabilityCeiling-DFcqYSTc.mjs.map +1 -0
  15. package/dist/{capabilityCeiling-CO3ZjYmY.cjs → capabilityCeiling-x2WmB2TL.cjs} +3 -22
  16. package/dist/capabilityCeiling-x2WmB2TL.cjs.map +1 -0
  17. package/dist/capabilityCeiling.cjs +2 -2
  18. package/dist/capabilityCeiling.d.mts +2 -4
  19. package/dist/capabilityCeiling.d.mts.map +1 -1
  20. package/dist/capabilityCeiling.mjs +2 -2
  21. package/dist/coordinatorSessions.cjs +14 -0
  22. package/dist/coordinatorSessions.d.mts +2 -0
  23. package/dist/coordinatorSessions.mjs +1 -0
  24. package/dist/env.cjs +1 -2
  25. package/dist/env.d.mts +2 -2
  26. package/dist/env.mjs +1 -1
  27. package/dist/{environment-BtvJI2S-.mjs → environment-BKQikJyW.mjs} +2 -11
  28. package/dist/environment-BKQikJyW.mjs.map +1 -0
  29. package/dist/{environment-Bz1OlWIT.d.mts → environment-CE9zbaE4.d.mts} +2 -9
  30. package/dist/environment-CE9zbaE4.d.mts.map +1 -0
  31. package/dist/{environment-Cqs7vHJL.cjs → environment-COaoVl5M.cjs} +1 -16
  32. package/dist/environment-COaoVl5M.cjs.map +1 -0
  33. package/dist/extensions/native.mjs +2477 -208
  34. package/dist/extensions/native.mjs.map +1 -1
  35. package/dist/extensions/server.cjs +4645 -3681
  36. package/dist/extensions/server.cjs.map +1 -1
  37. package/dist/extensions/server.d.mts.map +1 -1
  38. package/dist/extensions/server.mjs +5299 -4333
  39. package/dist/extensions/server.mjs.map +1 -1
  40. package/dist/extensions/web.mjs +1573 -573
  41. package/dist/extensions/web.mjs.map +1 -1
  42. package/dist/index.cjs +3 -4
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.d.mts +3 -3
  45. package/dist/index.mjs +2 -2
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/po-runtime-identity.json +1 -0
  48. package/dist/runtimeSubagentPolicy.cjs +1 -1
  49. package/dist/runtimeSubagentPolicy.d.mts +1 -1
  50. package/dist/runtimeSubagentPolicy.mjs +1 -1
  51. package/dist/runtimeSubagentTool.cjs +1 -1
  52. package/dist/runtimeSubagentTool.d.mts +1 -1
  53. package/dist/runtimeSubagentTool.mjs +1 -1
  54. package/dist/{subagentPolicy-BE-OZoa-.d.mts → subagentPolicy-CN-AYfeB.d.mts} +1 -2
  55. package/dist/subagentPolicy-CN-AYfeB.d.mts.map +1 -0
  56. package/dist/{subagentPolicy-LfcXuqO5.mjs → subagentPolicy-CXqAT9aI.mjs} +1 -5
  57. package/dist/subagentPolicy-CXqAT9aI.mjs.map +1 -0
  58. package/dist/{subagentPolicy-DIpaKHO8.cjs → subagentPolicy-DYj_SOTG.cjs} +1 -5
  59. package/dist/subagentPolicy-DYj_SOTG.cjs.map +1 -0
  60. package/dist/subagentPolicy.cjs +1 -1
  61. package/dist/subagentPolicy.d.mts +1 -1
  62. package/dist/subagentPolicy.mjs +1 -1
  63. package/dist/{subagentTool-UdB3s6Mn.d.mts → subagentTool-BHY7OcDf.d.mts} +3 -3
  64. package/dist/{subagentTool-UdB3s6Mn.d.mts.map → subagentTool-BHY7OcDf.d.mts.map} +1 -1
  65. package/dist/{subagentTool-a2oh2v5B.mjs → subagentTool-CCeGXaPL.mjs} +3 -4
  66. package/dist/subagentTool-CCeGXaPL.mjs.map +1 -0
  67. package/dist/{subagentTool-BueNPGHo.cjs → subagentTool-CqXgI3iD.cjs} +3 -4
  68. package/dist/subagentTool-CqXgI3iD.cjs.map +1 -0
  69. package/dist/subagentTool.cjs +1 -1
  70. package/dist/subagentTool.d.mts +1 -1
  71. package/dist/subagentTool.mjs +1 -1
  72. package/dist/teamSnapshot.d.mts.map +1 -1
  73. package/llms.txt +12 -0
  74. package/locales/vi.json +325 -0
  75. package/locales/zh-CN.json +325 -0
  76. package/package.json +129 -43
  77. package/src/prompts/codemode-how-to-team/SKILL.md +71 -0
  78. package/src/prompts/help-how-to-team/SKILL.md +91 -0
  79. package/dist/agentDiscovery-DTTlM_LT.cjs.map +0 -1
  80. package/dist/agentDiscovery-ZNG8iZXV.mjs.map +0 -1
  81. package/dist/atomicJson-DRT03Ql5.cjs +0 -824
  82. package/dist/atomicJson-DRT03Ql5.cjs.map +0 -1
  83. package/dist/atomicJson-VVM1iAPu.mjs +0 -712
  84. package/dist/atomicJson-VVM1iAPu.mjs.map +0 -1
  85. package/dist/capabilityCeiling-BaHT9v9S.mjs.map +0 -1
  86. package/dist/capabilityCeiling-CO3ZjYmY.cjs.map +0 -1
  87. package/dist/environment-BtvJI2S-.mjs.map +0 -1
  88. package/dist/environment-Bz1OlWIT.d.mts.map +0 -1
  89. package/dist/environment-Cqs7vHJL.cjs.map +0 -1
  90. package/dist/fablePlan.cjs +0 -17
  91. package/dist/fablePlan.d.mts +0 -2
  92. package/dist/fablePlan.mjs +0 -1
  93. package/dist/fablePlanApi-BTNKjLni.d.mts +0 -97
  94. package/dist/fablePlanApi-BTNKjLni.d.mts.map +0 -1
  95. package/dist/fablePlanApi-BhI4jnDP.cjs +0 -207
  96. package/dist/fablePlanApi-BhI4jnDP.cjs.map +0 -1
  97. package/dist/fablePlanApi-DuMg43Hu.mjs +0 -118
  98. package/dist/fablePlanApi-DuMg43Hu.mjs.map +0 -1
  99. package/dist/fablePlanApi.cjs +0 -17
  100. package/dist/fablePlanApi.d.mts +0 -2
  101. package/dist/fablePlanApi.mjs +0 -1
  102. package/dist/rolldown-runtime-VH7oDXx4.cjs +0 -28
  103. package/dist/runs/background/cliRunnerEntry.cjs +0 -540
  104. package/dist/runs/background/cliRunnerEntry.cjs.map +0 -1
  105. package/dist/runs/background/cliRunnerEntry.d.mts +0 -1
  106. package/dist/runs/background/cliRunnerEntry.mjs +0 -537
  107. package/dist/runs/background/cliRunnerEntry.mjs.map +0 -1
  108. package/dist/subagentPolicy-BE-OZoa-.d.mts.map +0 -1
  109. package/dist/subagentPolicy-DIpaKHO8.cjs.map +0 -1
  110. package/dist/subagentPolicy-LfcXuqO5.mjs.map +0 -1
  111. package/dist/subagentTool-BueNPGHo.cjs.map +0 -1
  112. package/dist/subagentTool-a2oh2v5B.mjs.map +0 -1
@@ -1,17 +1,21 @@
1
- import { createApiClient, defineActivityGroup, defineApiRoutes, defineChannelFile, defineFill, defineNativePlugin, defineSessionStore, nativeApiTransport, sessionApiAddress } from "@agimon-ai/po-core/native";
2
- import { Badge, Button, Dot, Input, ListRow, SegmentedControl, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Textarea, UsersIcon } from "@agimon-ai/po-native-components";
1
+ import { createApiClient, defineActivityGroup, defineApiRoutes, defineChannelFile, defineFill, defineNativePlugin, defineSessionStore, defineSlot, defineToolRenderer, nativeApiTransport, sessionApiAddress, t, useT } from "@agimon-ai/po-core/native";
2
+ import { AgentAvatar, ArrowRightIcon, Badge, Button, ChevronDownIcon, Dot, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EmptyState, Input, KebabIcon, ListRow, LiveDuration, LoadingState, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, Panel, STATUS_EDGE, SearchIcon, SegmentedControl, SendIcon, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, StatusBadge, Textarea, UsersIcon, fontOf, toolTone } from "@agimon-ai/po-native-components";
3
3
  import { createElement, useCallback, useEffect, useState, useSyncExternalStore } from "react";
4
- import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
5
4
  import { View } from "react-native-unistyles/components/native/View";
6
5
  import { Text } from "react-native-unistyles/components/native/Text";
6
+ import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
7
7
  import { StyleSheet } from "react-native-unistyles";
8
- import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Pressable } from "react-native-unistyles/components/native/Pressable";
9
+ import { FlatList } from "react-native-unistyles/components/native/FlatList";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
11
  //#region src/extensions/workspaces/(frontend)/fill/Team.home.native.ts
10
12
  var Team_home_native_default = defineFill({ data: {
11
13
  version: 1,
12
14
  label: "Team",
15
+ translateLabel: (t) => t("team.home.label", "Team"),
13
16
  source: "subagent_runs",
14
- destination: "agents"
17
+ destination: "agents",
18
+ icon: UsersIcon
15
19
  } });
16
20
  //#endregion
17
21
  //#region src/extensions/workspaces/sessions/(frontend)/_lib/catalog.native.ts
@@ -39,14 +43,14 @@ const api = createApiClient(routes, {
39
43
  transport: nativeApiTransport,
40
44
  sessionAddress: sessionApiAddress
41
45
  });
42
- function isRecord$2(value) {
46
+ function isRecord$3(value) {
43
47
  return typeof value === "object" && value !== null && !Array.isArray(value);
44
48
  }
45
49
  function isStrings(value) {
46
50
  return Array.isArray(value) && value.every((item) => typeof item === "string");
47
51
  }
48
52
  function isAgent(value) {
49
- return isRecord$2(value) && typeof value.name === "string" && typeof value.description === "string" && typeof value.filePath === "string" && [
53
+ return isRecord$3(value) && typeof value.name === "string" && typeof value.description === "string" && typeof value.filePath === "string" && [
50
54
  "project",
51
55
  "user",
52
56
  "plugin"
@@ -56,8 +60,8 @@ function isAgent(value) {
56
60
  async function fetchCatalog(sessionId, signal) {
57
61
  const response = await api.session(sessionId).catalog({ signal });
58
62
  const body = response.data;
59
- if (!response.ok) throw new Error(isRecord$2(body) && typeof body.error === "string" ? body.error : `Agent catalog could not be loaded (${response.status}).`);
60
- if (!isRecord$2(body) || typeof body.cwd !== "string" || !Array.isArray(body.agents) || !body.agents.every(isAgent) || !isStrings(body.models)) throw new Error("The server returned an invalid agent catalog.");
63
+ if (!response.ok) throw new Error(isRecord$3(body) && typeof body.error === "string" ? body.error : t("team.error.catalogFailed", "Agent catalog could not be loaded ({status}).", { status: response.status }));
64
+ if (!isRecord$3(body) || typeof body.cwd !== "string" || !Array.isArray(body.agents) || !body.agents.every(isAgent) || !isStrings(body.models)) throw new Error(t("team.error.invalidCatalog", "The server returned an invalid agent catalog."));
61
65
  return {
62
66
  cwd: body.cwd,
63
67
  agents: body.agents,
@@ -68,8 +72,8 @@ async function fetchCatalog(sessionId, signal) {
68
72
  async function launchAgent(sessionId, request) {
69
73
  const response = await api.session(sessionId).run({ body: request });
70
74
  const body = response.data;
71
- if (!response.ok) throw new Error(isRecord$2(body) && typeof body.error === "string" ? body.error : `Agent could not be launched (${response.status}).`);
72
- if (!isRecord$2(body) || typeof body.runId !== "string" || body.runId === "") throw new Error("The server returned an invalid run ID.");
75
+ if (!response.ok) throw new Error(isRecord$3(body) && typeof body.error === "string" ? body.error : t("team.error.launchFailed", "Agent could not be launched ({status}).", { status: response.status }));
76
+ if (!isRecord$3(body) || typeof body.runId !== "string" || body.runId === "") throw new Error(t("team.error.invalidRun", "The server returned an invalid run ID."));
73
77
  return body.runId;
74
78
  }
75
79
  function isSteerState(value) {
@@ -82,8 +86,8 @@ async function steerRun(sessionId, runId, message) {
82
86
  message
83
87
  } });
84
88
  const body = response.data;
85
- if (!response.ok) throw new Error(isRecord$2(body) && typeof body.error === "string" ? body.error : `Guidance could not be sent (${response.status}).`);
86
- if (!isRecord$2(body) || !isSteerState(body.state) || typeof body.message !== "string") throw new Error("The server returned an invalid steer result.");
89
+ if (!response.ok) throw new Error(isRecord$3(body) && typeof body.error === "string" ? body.error : t("team.error.guidanceFailed", "Guidance could not be sent ({status}).", { status: response.status }));
90
+ if (!isRecord$3(body) || !isSteerState(body.state) || typeof body.message !== "string") throw new Error(t("team.error.invalidSteer", "The server returned an invalid steer result."));
87
91
  return {
88
92
  state: body.state,
89
93
  message: body.message
@@ -93,7 +97,7 @@ async function steerRun(sessionId, runId, message) {
93
97
  async function stopRun(sessionId, runId) {
94
98
  const response = await api.session(sessionId).stop({ body: { runId } });
95
99
  const body = response.data;
96
- if (!response.ok) throw new Error(isRecord$2(body) && typeof body.error === "string" ? body.error : `The run could not be stopped (${response.status}).`);
100
+ if (!response.ok) throw new Error(isRecord$3(body) && typeof body.error === "string" ? body.error : t("team.error.stopFailed", "The run could not be stopped ({status}).", { status: response.status }));
97
101
  }
98
102
  //#endregion
99
103
  //#region src/types/webSubagents.ts
@@ -115,7 +119,7 @@ const catalog = defineSessionStore({
115
119
  inspected: void 0,
116
120
  launch: void 0
117
121
  });
118
- function isRecord$1(value) {
122
+ function isRecord$2(value) {
119
123
  return typeof value === "object" && value !== null && !Array.isArray(value);
120
124
  }
121
125
  function openCatalog(sessionId, task = "") {
@@ -169,11 +173,11 @@ function loadCatalog(sessionId) {
169
173
  const subagentCatalogChannel = catalog.channel({
170
174
  channel: SUBAGENT_CATALOG_TYPE,
171
175
  parse(input) {
172
- if (!isRecord$1(input) || typeof input.cwd !== "string" || !Array.isArray(input.agents)) return null;
176
+ if (!isRecord$2(input) || typeof input.cwd !== "string" || !Array.isArray(input.agents)) return null;
173
177
  const models = Array.isArray(input.models) ? input.models.filter((m) => typeof m === "string") : [];
174
178
  return {
175
179
  cwd: input.cwd,
176
- agents: input.agents.filter(isRecord$1),
180
+ agents: input.agents.filter(isRecord$2),
177
181
  models,
178
182
  ...typeof input.warning === "string" ? { warning: input.warning } : {}
179
183
  };
@@ -201,12 +205,20 @@ const subagentCatalogChannel = catalog.channel({
201
205
  */
202
206
  const MINUTE_MS = 6e4;
203
207
  const HOUR_MS = 60 * MINUTE_MS;
204
- function formatRunDuration(elapsedMs) {
205
- if (elapsedMs < MINUTE_MS) return "<1m";
206
- if (elapsedMs < HOUR_MS) return `${Math.floor(elapsedMs / MINUTE_MS)}m`;
208
+ function formatRunDuration(elapsedMs, t = (_key, fallback, vars) => fallback.replace(/\{(\w+)\}/gu, (match, key) => String(vars?.[key] ?? match))) {
209
+ if (elapsedMs < MINUTE_MS) return t("team.duration.underMinute", "<1m");
210
+ if (elapsedMs < HOUR_MS) return t("team.duration.minutes", "{count}m", { count: Math.floor(elapsedMs / MINUTE_MS) });
207
211
  const hours = Math.floor(elapsedMs / HOUR_MS);
208
212
  const minutes = Math.floor(elapsedMs % HOUR_MS / MINUTE_MS);
209
- return `${hours}h ${String(minutes).padStart(2, "0")}m`;
213
+ return t("team.duration.hoursMinutes", "{hours}h {minutes}m", {
214
+ hours,
215
+ minutes: String(minutes).padStart(2, "0")
216
+ });
217
+ }
218
+ function abbreviateCwd(cwd) {
219
+ const match = /^\/(?:Users|home)\/[^/]+/u.exec(cwd);
220
+ if (!match) return cwd;
221
+ return `~${cwd.slice(match[0].length)}`;
210
222
  }
211
223
  /** What to call a run on screen: the identity's first name, else the agent name. Never a run id. */
212
224
  function agentRunLabel(run) {
@@ -260,10 +272,17 @@ function modelChoices(agent, models) {
260
272
  return choices;
261
273
  }
262
274
  /** The row's one-liner: what tools it may use, how many skills, and how it starts. */
263
- function agentMeta(agent) {
264
- return `${agent.tools.length === 0 ? "all tools" : `tools ${agent.tools.slice(0, META_TOOL_LIMIT).join(", ")}${agent.tools.length > META_TOOL_LIMIT ? ` +${agent.tools.length - META_TOOL_LIMIT}` : ""}`}${agent.skills.length > 0 ? ` · ${agent.skills.length} skill${agent.skills.length === 1 ? "" : "s"}` : ""} · ${agent.defaultContext === "fork" ? "forks the session" : "fresh context"}`;
275
+ function agentMeta(agent, t = (_key, fallback, vars) => fallback.replace(/\{(\w+)\}/gu, (match, key) => String(vars?.[key] ?? match))) {
276
+ return `${agent.tools.length === 0 ? t("team.catalog.allTools", "all tools") : t("team.catalog.tools", "tools {tools}{more}", {
277
+ tools: agent.tools.slice(0, META_TOOL_LIMIT).join(", "),
278
+ more: agent.tools.length > META_TOOL_LIMIT ? ` +${agent.tools.length - META_TOOL_LIMIT}` : ""
279
+ })}${agent.skills.length > 0 ? " · " + (agent.skills.length === 1 ? t("team.catalog.oneSkill", "{count} skill", { count: agent.skills.length }) : t("team.catalog.skills", "{count} skills", { count: agent.skills.length })) : ""} · ${agent.defaultContext === "fork" ? t("team.catalog.forksSession", "forks the session") : t("team.catalog.freshContext", "fresh context")}`;
265
280
  }
266
281
  //#endregion
282
+ //#region src/extensions/workspaces/sessions/(frontend)/_lib/runActionsSlot.native.ts
283
+ /** The native twin of `runActionsSlot.ts`: the same slot name, declared from the native SDK. */
284
+ const RUN_ACTIONS_SLOT = defineSlot({ slot: "subagents.run-actions" });
285
+ //#endregion
267
286
  //#region src/extensions/workspaces/sessions/(frontend)/_lib/subagentsStore.native.ts
268
287
  const TERMINAL_STATES = /* @__PURE__ */ new Set([
269
288
  "done",
@@ -274,6 +293,7 @@ function isTerminalRun(run) {
274
293
  return TERMINAL_STATES.has(run.state);
275
294
  }
276
295
  const subagents = defineSessionStore({
296
+ loaded: false,
277
297
  runs: [],
278
298
  dismissed: [],
279
299
  stopRequested: [],
@@ -281,15 +301,15 @@ const subagents = defineSessionStore({
281
301
  pendingLaunch: void 0,
282
302
  autoOpenRunId: void 0
283
303
  });
284
- function isRecord(value) {
304
+ function isRecord$1(value) {
285
305
  return typeof value === "object" && value !== null && !Array.isArray(value);
286
306
  }
287
307
  function without(list, runId) {
288
308
  return list.filter((id) => id !== runId);
289
309
  }
290
- /** The full Subagents tab's runs minus the ones the reader dismissed. */
310
+ /** The full Subagents tab's runs minus the ones the reader dismissed, live runs first (stable sort keeps presented order within each group). */
291
311
  function visibleRuns(session) {
292
- return session.dismissed.length === 0 ? session.runs : session.runs.filter((run) => !session.dismissed.includes(run.runId));
312
+ return session.runs.filter((run) => !session.dismissed.includes(run.runId)).sort((a, b) => Number(isTerminalRun(a)) - Number(isTerminalRun(b)));
293
313
  }
294
314
  /** Only runs that can still be doing work belong in the activity group. */
295
315
  function activityRuns(session) {
@@ -341,12 +361,24 @@ function clearPendingLaunch(sessionId) {
341
361
  pendingLaunch: void 0
342
362
  }));
343
363
  }
364
+ function clearAutoOpen(sessionId) {
365
+ subagents.update(sessionId, (current) => ({
366
+ ...current,
367
+ autoOpenRunId: void 0
368
+ }));
369
+ }
370
+ function openRun(sessionId, runId) {
371
+ subagents.update(sessionId, (current) => ({
372
+ ...current,
373
+ openRunId: runId
374
+ }));
375
+ }
344
376
  /** The plugin's session data channel: 'subagent_runs' payloads into the store. */
345
377
  const subagentRunsChannel = subagents.channel({
346
378
  channel: SUBAGENT_RUNS_TYPE,
347
379
  parse(input) {
348
- if (!isRecord(input) || !Array.isArray(input.runs)) return null;
349
- return { runs: input.runs.filter(isRecord) };
380
+ if (!isRecord$1(input) || !Array.isArray(input.runs)) return null;
381
+ return { runs: input.runs.filter(isRecord$1) };
350
382
  },
351
383
  reduce(current, { runs }) {
352
384
  const present = new Map(runs.map((run) => [run.runId, run]));
@@ -358,6 +390,7 @@ const subagentRunsChannel = subagents.channel({
358
390
  const arrived = current.pendingLaunch === void 0 ? void 0 : runs.find((run) => run.agent === current.pendingLaunch?.agent && !current.pendingLaunch.knownRunIds.includes(run.runId));
359
391
  return {
360
392
  ...current,
393
+ loaded: true,
361
394
  runs,
362
395
  stopRequested,
363
396
  dismissed,
@@ -366,8 +399,841 @@ const subagentRunsChannel = subagents.channel({
366
399
  };
367
400
  }
368
401
  });
402
+ const MESSAGE_PREVIEW_CHARS = 72;
403
+ const ELLIPSIS = "…";
404
+ function isRecord(value) {
405
+ return typeof value === "object" && value !== null && !Array.isArray(value);
406
+ }
407
+ function asString(value) {
408
+ return typeof value === "string" ? value : "";
409
+ }
410
+ /** The detail beside the subagent action, as the TUI's callDetails words it. */
411
+ function subagentCallDetail(args, t = (_key, fallback, vars) => fallback.replace(/\{(\w+)\}/gu, (match, key) => String(vars?.[key] ?? match))) {
412
+ switch (args.action) {
413
+ case "agents": return asString(args.name);
414
+ case "run": {
415
+ const requests = Array.isArray(args.requests) ? args.requests : [];
416
+ const agents = requests.map((request) => isRecord(request) ? asString(request.agent) : "").filter(Boolean);
417
+ const count = requests.length === 1 ? t("team.count.agent", "{count} agent", { count: requests.length }) : t("team.count.agents", "{count} agents", { count: requests.length });
418
+ return agents.length > 0 ? `${count} · ${agents.join(", ")}` : count;
419
+ }
420
+ case "status": return args.id ? t("team.tool.run", "run") : t("team.tool.fleet", "fleet");
421
+ default: return "";
422
+ }
423
+ }
424
+ /** Result text as lines, trailing blank lines dropped the way the TUI does. */
425
+ function resultLines(output) {
426
+ const lines = output.split("\n");
427
+ while (lines.length > 0 && lines.at(-1)?.trim() === "") lines.pop();
428
+ return lines.length === 1 && lines[0] === "" ? [] : lines;
429
+ }
430
+ /**
431
+ * The subagent result body: a tail while running, then the head collapsed to
432
+ * the TUI budget, with the closing glyph line the TUI appends.
433
+ */
434
+ function shapeResult(output, options) {
435
+ const all = resultLines(output);
436
+ if (options.isPartial) return {
437
+ lines: all.slice(-12),
438
+ glyph: "running",
439
+ hidden: 0
440
+ };
441
+ const lines = options.expanded ? all : all.slice(0, 12);
442
+ const hidden = all.length - lines.length;
443
+ if (options.isError) return {
444
+ lines,
445
+ glyph: "failed",
446
+ hidden
447
+ };
448
+ if (hidden > 0) return {
449
+ lines,
450
+ glyph: "more",
451
+ hidden
452
+ };
453
+ if (lines.length === 0) return {
454
+ lines,
455
+ glyph: "done",
456
+ hidden: 0
457
+ };
458
+ return {
459
+ lines,
460
+ glyph: "none",
461
+ hidden: 0
462
+ };
463
+ }
464
+ function preview(message) {
465
+ const flat = message.replace(/\s+/g, " ").trim();
466
+ return flat.length > MESSAGE_PREVIEW_CHARS ? `${flat.slice(0, 71)}${ELLIPSIS}` : flat;
467
+ }
468
+ function records(value) {
469
+ return Array.isArray(value) ? value.filter(isRecord) : [];
470
+ }
471
+ function parts(values) {
472
+ return values.filter((value) => typeof value === "string" && value.trim() !== "").join(" · ");
473
+ }
474
+ function stateAvatar(state) {
475
+ if (state === "failed" || state === "error") return "failed";
476
+ if (state === "running" || state === "starting") return "running";
477
+ if (state === "queued") return "waiting";
478
+ if (state === "complete" || state === "completed" || state === "stopped") return "done";
479
+ }
480
+ function stateTone(state) {
481
+ if (state === "failed" || state === "error") return "error";
482
+ if (state === "complete" || state === "completed") return "ok";
483
+ if (state === "running" || state === "starting") return "running";
484
+ return "idle";
485
+ }
486
+ function countSummary(count, noun, t) {
487
+ if (noun === "agent") return count === 0 ? t("team.count.noAgents", "no agents") : count === 1 ? t("team.count.agent", "{count} agent", { count }) : t("team.count.agents", "{count} agents", { count });
488
+ return count === 0 ? t("team.count.noRuns", "no runs") : count === 1 ? t("team.count.run", "{count} run", { count }) : t("team.count.runs", "{count} runs", { count });
489
+ }
490
+ function agentsView(value, t) {
491
+ const rows = records(value).map((agent, index) => ({
492
+ key: `${asString(agent.name)}-${index}`,
493
+ label: asString(agent.name),
494
+ seed: asString(agent.name),
495
+ detail: preview(asString(agent.description)),
496
+ state: asString(agent.source),
497
+ tone: "idle"
498
+ }));
499
+ return {
500
+ kind: "agents",
501
+ rows,
502
+ summary: countSummary(rows.length, "agent", t),
503
+ tone: "idle"
504
+ };
505
+ }
506
+ function runView(value, t) {
507
+ const rows = records(value).map((outcome, index) => {
508
+ const runId = asString(outcome.runId);
509
+ return {
510
+ key: runId || `${asString(outcome.agent)}-${index}`,
511
+ label: asString(outcome.agent),
512
+ seed: asString(outcome.agent),
513
+ avatar: runId ? "running" : "failed",
514
+ detail: preview(runId ? asString(outcome.task) : asString(outcome.error)) || (runId ? "" : t("team.tool.unknownError", "unknown error")),
515
+ state: runId ? "started" : "failed",
516
+ tone: runId ? "ok" : "error"
517
+ };
518
+ });
519
+ const started = rows.filter((row) => row.state === "started").length;
520
+ const failed = rows.length - started;
521
+ return {
522
+ kind: "run",
523
+ rows,
524
+ summary: failed === 0 ? t("team.count.started", "{count} started", { count: started }) : t("team.count.startedFailed", "{started} started · {failed} failed", {
525
+ started,
526
+ failed
527
+ }),
528
+ tone: failed === 0 ? "ok" : "error"
529
+ };
530
+ }
531
+ function fleetView(value, t) {
532
+ const rows = records(value).map((job, index) => {
533
+ const state = asString(job.status) || "starting";
534
+ const who = agentDisplay({
535
+ agent: asString(job.agent),
536
+ identity: asString(job.identity) || void 0
537
+ });
538
+ return {
539
+ key: asString(job.runId) || `run-${index}`,
540
+ label: who.name,
541
+ seed: who.seed,
542
+ avatar: stateAvatar(state),
543
+ detail: preview(parts([
544
+ who.role,
545
+ job.currentTool,
546
+ job.activityState,
547
+ job.attentionReason,
548
+ job.error
549
+ ])),
550
+ state,
551
+ tone: stateTone(state)
552
+ };
553
+ });
554
+ return {
555
+ kind: "fleet",
556
+ rows,
557
+ summary: countSummary(rows.length, "run", t),
558
+ tone: "idle"
559
+ };
560
+ }
561
+ function statusView(details, t) {
562
+ const runId = asString(details.runId);
563
+ const status = isRecord(details.status) ? details.status : void 0;
564
+ const state = status ? asString(status.state) : "";
565
+ if (!state) return {
566
+ kind: "status",
567
+ rows: [],
568
+ summary: t("team.tool.noStatusYet", "no status yet"),
569
+ tone: "idle"
570
+ };
571
+ const who = agentDisplay({
572
+ agent: asString(status?.agent),
573
+ identity: asString(status?.identity) || void 0
574
+ });
575
+ return {
576
+ kind: "status",
577
+ rows: [{
578
+ key: runId,
579
+ label: who.name,
580
+ seed: who.seed,
581
+ avatar: stateAvatar(state),
582
+ detail: preview(parts([
583
+ who.role,
584
+ status?.activityState,
585
+ status?.summary,
586
+ status?.error
587
+ ])),
588
+ state,
589
+ tone: stateTone(state)
590
+ }],
591
+ summary: "",
592
+ tone: stateTone(state)
593
+ };
594
+ }
595
+ function controlView(summary, tone) {
596
+ return {
597
+ kind: "control",
598
+ rows: [],
599
+ summary,
600
+ tone
601
+ };
602
+ }
603
+ /**
604
+ * Narrows the wire `details` of a subagent result to the rows the card draws.
605
+ * Null when they are not a finished subagent result at all, which is what a
606
+ * partial update or an error message is: the card then falls back to the text.
607
+ */
608
+ function subagentResultView(details, t = (_key, fallback, vars) => fallback.replace(/\{(\w+)\}/gu, (match, key) => String(vars?.[key] ?? match))) {
609
+ if (!isRecord(details) || details.partial === true) return null;
610
+ if (Array.isArray(details.agents)) return agentsView(details.agents, t);
611
+ if (Array.isArray(details.outcomes)) return runView(details.outcomes, t);
612
+ if (isRecord(details.spawn) && Array.isArray(details.spawn.outcomes)) return runView(details.spawn.outcomes, t);
613
+ if (Array.isArray(details.runs)) return fleetView(details.runs, t);
614
+ if (Array.isArray(details.fleet)) return fleetView(details.fleet, t);
615
+ if (isRecord(details.control)) return controlView(t("team.tool.stopRequested", "stop requested"), "ok");
616
+ if (isRecord(details.steer)) {
617
+ const state = asString(details.steer.state);
618
+ return controlView(t("team.tool.steerState", "steer {state}{message}", {
619
+ state: subagentStateLabel(state, t),
620
+ message: details.steer.message ? `: ${preview(asString(details.steer.message))}` : ""
621
+ }), state === "failed" ? "error" : "ok");
622
+ }
623
+ if (typeof details.runId === "string") return statusView(details, t);
624
+ return null;
625
+ }
626
+ /** The intercom call header: action, its resolved target name, and what is being said. */
627
+ function intercomCallSummary(args, details) {
628
+ const action = asString(args.action);
629
+ const toName = isRecord(details) ? asString(details.toName).trim() : "";
630
+ switch (action) {
631
+ case "send":
632
+ case "ask": return {
633
+ action,
634
+ target: toName || asString(args.to),
635
+ message: preview(asString(args.message))
636
+ };
637
+ case "reply": return {
638
+ action,
639
+ target: asString(args.requestId),
640
+ message: preview(asString(args.message))
641
+ };
642
+ default: return {
643
+ action,
644
+ target: "",
645
+ message: ""
646
+ };
647
+ }
648
+ }
649
+ /**
650
+ * The outcome line for a finished intercom call, read from the details the
651
+ * tool attaches: a send is delivered or only queued, a reply confirms its
652
+ * request, an ask carries the answer's sender.
653
+ */
654
+ function intercomOutcome(details) {
655
+ if (!isRecord(details)) return {
656
+ outcome: "none",
657
+ who: "",
658
+ reply: ""
659
+ };
660
+ if (details.delivered === true) return {
661
+ outcome: "delivered",
662
+ who: asString(details.to),
663
+ reply: ""
664
+ };
665
+ if (details.state === "queued") return {
666
+ outcome: "queued",
667
+ who: asString(details.to),
668
+ reply: ""
669
+ };
670
+ if (typeof details.reply === "string") return {
671
+ outcome: "answered",
672
+ who: asString(details.from),
673
+ reply: details.reply
674
+ };
675
+ if (typeof details.requestId === "string" && typeof details.to === "string") return {
676
+ outcome: "replied",
677
+ who: details.to,
678
+ reply: ""
679
+ };
680
+ return {
681
+ outcome: "none",
682
+ who: "",
683
+ reply: ""
684
+ };
685
+ }
686
+ /**
687
+ * The agent that sent an intercom message, from the tool's `sender` detail; empty
688
+ * while the call runs or for a result recorded before the tool named its sender.
689
+ */
690
+ function intercomSender(details) {
691
+ return isRecord(details) ? asString(details.sender) : "";
692
+ }
693
+ /** One line per outgoing intercom message: who it went to and what it said. members and pending stay compact. */
694
+ function intercomActivity({ args, result, isError }, t = (_key, fallback, vars) => fallback.replace(/\{(\w+)\}/gu, (match, key) => String(vars?.[key] ?? match))) {
695
+ if (isError) return [];
696
+ const { action, target, message } = intercomCallSummary(args, result?.details);
697
+ if (!message) return [];
698
+ const who = (action === "reply" ? intercomOutcome(result?.details).who : target) || t("team.activity.agent", "agent");
699
+ return [action === "ask" ? t("team.activity.asks", "→ {who} asks \"{message}\"", {
700
+ who,
701
+ message
702
+ }) : t("team.activity.message", "→ {who} \"{message}\"", {
703
+ who,
704
+ message
705
+ })];
706
+ }
707
+ /** One line per agent a subagent run starts, with its task. Status, agents and control calls stay compact. */
708
+ function subagentActivity({ args, isError }, t = (_key, fallback, vars) => fallback.replace(/\{(\w+)\}/gu, (match, key) => String(vars?.[key] ?? match))) {
709
+ if (isError || args.action !== "run") return [];
710
+ return records(args.requests).flatMap((request) => {
711
+ const agent = asString(request.agent);
712
+ if (!agent) return [];
713
+ const task = preview(asString(request.task));
714
+ return [task ? t("team.activity.agentTask", "Subagent {agent}: {task}", {
715
+ agent,
716
+ task
717
+ }) : t("team.activity.subagent", "Subagent {agent}", { agent })];
718
+ });
719
+ }
720
+ /** The new session's name and brief, so a hand-off reads in the conversation. */
721
+ function startSessionActivity({ args, isError }, t = (_key, fallback, vars) => fallback.replace(/\{(\w+)\}/gu, (match, key) => String(vars?.[key] ?? match))) {
722
+ if (isError) return [];
723
+ const name = asString(args.name);
724
+ if (!name) return [];
725
+ const brief = preview(asString(args.brief));
726
+ return [brief ? t("team.activity.sessionBrief", "Started session {name}: {brief}", {
727
+ name,
728
+ brief
729
+ }) : t("team.activity.session", "Started session {name}", { name })];
730
+ }
731
+ function subagentStateLabel(state, t) {
732
+ return {
733
+ queued: t("team.state.queued", "queued"),
734
+ running: t("team.state.running", "running"),
735
+ starting: t("team.state.starting", "starting"),
736
+ started: t("team.state.started", "started"),
737
+ complete: t("team.state.complete", "complete"),
738
+ completed: t("team.state.completed", "completed"),
739
+ done: t("team.state.done", "done"),
740
+ failed: t("team.state.failed", "failed"),
741
+ error: t("team.state.error", "error"),
742
+ stopped: t("team.state.stopped", "stopped"),
743
+ pending: t("team.state.pending", "pending"),
744
+ project: t("team.source.project", "project"),
745
+ user: t("team.source.user", "user"),
746
+ plugin: t("team.source.plugin", "plugin")
747
+ }[state] ?? state;
748
+ }
749
+ function teamActionLabel(action, t) {
750
+ return {
751
+ agents: t("team.action.agents", "agents"),
752
+ run: t("team.action.run", "run"),
753
+ status: t("team.action.status", "status"),
754
+ stop: t("team.action.stop", "stop"),
755
+ steer: t("team.action.steer", "steer"),
756
+ members: t("team.action.members", "members"),
757
+ send: t("team.action.send", "send"),
758
+ ask: t("team.action.ask", "ask"),
759
+ reply: t("team.action.reply", "reply"),
760
+ pending: t("team.action.pending", "pending")
761
+ }[action] ?? action;
762
+ }
763
+ //#endregion
764
+ //#region src/extensions/workspaces/sessions/(frontend)/_components/CompactAgents.native.tsx
765
+ const BADGES = (t) => ({
766
+ queued: {
767
+ label: t("team.ui.queued", "Queued"),
768
+ tone: "neutral"
769
+ },
770
+ running: {
771
+ label: t("team.ui.running", "Running"),
772
+ tone: "running"
773
+ },
774
+ done: {
775
+ label: t("team.ui.done", "Done"),
776
+ tone: "ok"
777
+ },
778
+ failed: {
779
+ label: t("team.ui.failed", "Failed"),
780
+ tone: "error"
781
+ },
782
+ stopped: {
783
+ label: t("team.ui.stopped", "Stopped"),
784
+ tone: "neutral"
785
+ }
786
+ });
787
+ function terminal(item) {
788
+ return item.state === "done" || item.state === "failed" || item.state === "stopped";
789
+ }
790
+ function elapsedRun(item, now, t) {
791
+ return formatRunDuration(Math.max(0, (item.endedAt ?? (terminal(item) ? item.lastUpdate : now)) - item.startedAt), t);
792
+ }
793
+ function firstLine(text) {
794
+ return text.split("\n").find((line) => line.trim() !== "") ?? "";
795
+ }
796
+ /** Duration-only clock on the UI thread, never a React state tick. */
797
+ function RunElapsed({ item, now, active = true, style }) {
798
+ const t = useT();
799
+ const clock = useCallback((clockNow) => {
800
+ const time = now ?? clockNow;
801
+ const text = elapsedRun(item, time, t);
802
+ if (now !== void 0 || !active || terminal(item) || item.endedAt !== void 0) return { text };
803
+ return {
804
+ text,
805
+ nextMs: 6e4 - Math.max(0, time - item.startedAt) % 6e4
806
+ };
807
+ }, [
808
+ item,
809
+ now,
810
+ active,
811
+ t
812
+ ]);
813
+ return /* @__PURE__ */ jsx(LiveDuration, {
814
+ clock,
815
+ style
816
+ });
817
+ }
818
+ function RunActions({ item, stopping, initiallyOpen, onAction }) {
819
+ const t = useT();
820
+ return /* @__PURE__ */ jsxs(DropdownMenu, {
821
+ defaultOpen: initiallyOpen,
822
+ children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
823
+ variant: "ghost",
824
+ size: "icon",
825
+ style: styles$5.menu,
826
+ testID: `compact-run-menu-${item.runId}`,
827
+ accessibilityLabel: t("team.ui.actionsFor", "Actions for {name}", { name: agentRunLabel(item) }),
828
+ children: /* @__PURE__ */ jsx(KebabIcon, { size: 14 })
829
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, { children: [
830
+ /* @__PURE__ */ jsx(DropdownMenuItem, {
831
+ onSelect: () => onAction("thread", item),
832
+ children: t("team.ui.openThread", "Open thread")
833
+ }),
834
+ /* @__PURE__ */ jsx(DropdownMenuItem, {
835
+ onSelect: () => onAction("details", item),
836
+ children: t("team.ui.details", "Details")
837
+ }),
838
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
839
+ terminal(item) ? /* @__PURE__ */ jsx(DropdownMenuItem, {
840
+ onSelect: () => onAction("clear", item),
841
+ children: t("team.ui.clearFromTheList", "Clear from the list")
842
+ }) : /* @__PURE__ */ jsx(DropdownMenuItem, {
843
+ variant: "destructive",
844
+ disabled: stopping,
845
+ onSelect: () => onAction("stop", item),
846
+ children: stopping ? t("team.ui.stopping", "Stopping…") : t("team.ui.stop", "Stop")
847
+ })
848
+ ] })]
849
+ });
850
+ }
851
+ function CompactRun({ now, item, stopping, menuRunId, stopError, onAction }) {
852
+ const t = useT();
853
+ const who = agentDisplay(item);
854
+ const badge = BADGES(t)[item.state];
855
+ const summary = item.promptWithheld ? t("team.ui.promptWithheldThisTaskWasMarkedSensitive", "Prompt withheld: this task was marked sensitive.") : firstLine(item.error ?? item.summary ?? item.task) || t("team.ui.noPromptRecorded", "No prompt recorded");
856
+ return /* @__PURE__ */ jsxs(Panel, {
857
+ testID: `compact-run-${item.runId}`,
858
+ style: styles$5.card(STATUS_EDGE[badge.tone]),
859
+ children: [/* @__PURE__ */ jsxs(Pressable, {
860
+ accessibilityRole: "button",
861
+ accessibilityLabel: t("team.ui.openConversation", "Open {name}'s conversation", { name: who.name }),
862
+ testID: `compact-run-open-${item.runId}`,
863
+ onPress: () => onAction("thread", item),
864
+ style: styles$5.open,
865
+ children: [
866
+ /* @__PURE__ */ jsxs(View, {
867
+ style: styles$5.rowHead,
868
+ children: [
869
+ /* @__PURE__ */ jsx(AgentAvatar, {
870
+ name: who.name,
871
+ seed: who.seed,
872
+ size: "sm"
873
+ }),
874
+ /* @__PURE__ */ jsxs(View, {
875
+ style: styles$5.nameBlock,
876
+ children: [/* @__PURE__ */ jsx(Text, {
877
+ numberOfLines: 2,
878
+ style: styles$5.name,
879
+ children: who.name
880
+ }), who.role ? /* @__PURE__ */ jsxs(View, {
881
+ style: styles$5.elapsed,
882
+ children: [/* @__PURE__ */ jsxs(Text, {
883
+ numberOfLines: 1,
884
+ style: styles$5.dim,
885
+ children: [
886
+ who.role,
887
+ " ·",
888
+ " "
889
+ ]
890
+ }), /* @__PURE__ */ jsx(RunElapsed, {
891
+ item,
892
+ now,
893
+ style: styles$5.dim
894
+ })]
895
+ }) : null]
896
+ }),
897
+ /* @__PURE__ */ jsx(StatusBadge, {
898
+ tone: badge.tone,
899
+ children: stopping ? t("team.ui.stopping", "Stopping…") : badge.label
900
+ })
901
+ ]
902
+ }),
903
+ /* @__PURE__ */ jsx(Text, {
904
+ numberOfLines: 2,
905
+ style: item.error ? styles$5.error : styles$5.workText,
906
+ children: summary
907
+ }),
908
+ stopError ? /* @__PURE__ */ jsx(Text, {
909
+ accessibilityRole: "alert",
910
+ style: styles$5.error,
911
+ children: stopError
912
+ }) : null
913
+ ]
914
+ }), /* @__PURE__ */ jsx(RunActions, {
915
+ item,
916
+ stopping,
917
+ initiallyOpen: menuRunId === item.runId,
918
+ onAction
919
+ })]
920
+ });
921
+ }
922
+ /** Same prompt/report/failure and control contract as the current RunDetailSheet. */
923
+ function CompactRunDetails({ now, actions, stopError, item, stopping, onClose, onAction }) {
924
+ const t = useT();
925
+ const badge = BADGES(t)[item.state];
926
+ const facts = [
927
+ [t("team.ui.run", "Run"), item.runId],
928
+ ...item.taskRef ? [[t("team.ui.task", "Task"), item.taskRef]] : [],
929
+ [t("team.ui.model", "Model"), item.model ?? t("team.ui.theRuntimeDefault", "The runtime default")],
930
+ [t("team.ui.folder", "Folder"), abbreviateCwd(item.cwd)],
931
+ ...item.currentTool ? [[t("team.ui.currentAction", "Current action"), item.currentTool]] : [],
932
+ [t("team.ui.work", "Work"), [item.toolCount === void 0 ? t("team.ui.noToolsReported", "No tools reported") : t("team.ui.toolCount", "{count} tools", { count: item.toolCount }), item.tokens === void 0 ? void 0 : t("team.ui.tokenCountShort", "{count} tk", { count: item.tokens })].filter(Boolean).join(" · ")]
933
+ ];
934
+ return /* @__PURE__ */ jsx(Sheet, {
935
+ open: true,
936
+ onOpenChange: (open) => {
937
+ if (!open) onClose();
938
+ },
939
+ children: /* @__PURE__ */ jsxs(SheetContent, { children: [/* @__PURE__ */ jsxs(SheetHeader, { children: [/* @__PURE__ */ jsx(SheetTitle, { children: agentRunLabel(item) }), /* @__PURE__ */ jsx(StatusBadge, {
940
+ tone: badge.tone,
941
+ children: badge.label
942
+ })] }), /* @__PURE__ */ jsxs(SheetBody, { children: [
943
+ actions,
944
+ stopError ? /* @__PURE__ */ jsx(Text, {
945
+ accessibilityRole: "alert",
946
+ style: styles$5.error,
947
+ children: stopError
948
+ }) : null,
949
+ /* @__PURE__ */ jsx(RunElapsed, {
950
+ item,
951
+ now,
952
+ style: styles$5.dim
953
+ }),
954
+ facts.map(([label, value]) => /* @__PURE__ */ jsxs(View, {
955
+ style: styles$5.fact,
956
+ children: [/* @__PURE__ */ jsx(Text, {
957
+ style: styles$5.factLabel,
958
+ children: label
959
+ }), /* @__PURE__ */ jsx(Text, {
960
+ selectable: true,
961
+ style: styles$5.factValue,
962
+ children: value
963
+ })]
964
+ }, label)),
965
+ /* @__PURE__ */ jsxs(View, {
966
+ style: styles$5.detailBlock,
967
+ children: [/* @__PURE__ */ jsx(Text, {
968
+ style: styles$5.name,
969
+ children: t("team.ui.promptFromTheMainAgent", "Prompt from the main agent")
970
+ }), /* @__PURE__ */ jsx(Text, {
971
+ selectable: true,
972
+ style: styles$5.body,
973
+ children: item.promptWithheld ? t("team.ui.withheldThisTaskWasMarkedSensitive", "Withheld: this task was marked sensitive.") : item.task || t("team.ui.noPromptRecordedLower", "(no prompt recorded)")
974
+ })]
975
+ }),
976
+ item.summary ? /* @__PURE__ */ jsxs(View, {
977
+ style: styles$5.detailBlock,
978
+ children: [/* @__PURE__ */ jsx(Text, {
979
+ style: styles$5.name,
980
+ children: t("team.ui.report", "Report")
981
+ }), /* @__PURE__ */ jsx(Text, {
982
+ selectable: true,
983
+ style: styles$5.body,
984
+ children: item.summary
985
+ })]
986
+ }) : null,
987
+ item.error ? /* @__PURE__ */ jsxs(View, {
988
+ style: styles$5.detailBlock,
989
+ children: [/* @__PURE__ */ jsx(Text, {
990
+ style: styles$5.name,
991
+ children: t("team.ui.failure", "Failure")
992
+ }), /* @__PURE__ */ jsx(Text, {
993
+ selectable: true,
994
+ style: styles$5.error,
995
+ children: item.error
996
+ })]
997
+ }) : null,
998
+ /* @__PURE__ */ jsx(Button, {
999
+ variant: terminal(item) || stopping ? "outline" : "danger-outline",
1000
+ disabled: stopping,
1001
+ onPress: () => onAction(terminal(item) ? "clear" : "stop", item),
1002
+ children: terminal(item) ? t("team.ui.clearFromTheList", "Clear from the list") : stopping ? t("team.ui.stopping", "Stopping…") : t("team.ui.stop", "Stop")
1003
+ })
1004
+ ] })] })
1005
+ });
1006
+ }
1007
+ function CompactAgents({ now, items, stoppingRunId, stoppingRunIds = [], menuRunId, stopError, stopErrorRunId, loading = false, onAction }) {
1008
+ const t = useT();
1009
+ const tally = Object.keys(BADGES(t)).map((state) => t("team.count.state", "{count} {state}", {
1010
+ count: items.filter((item) => item.state === state).length,
1011
+ state: subagentStateLabel(state, t)
1012
+ })).join(" · ");
1013
+ return /* @__PURE__ */ jsx(View, {
1014
+ style: styles$5.screen,
1015
+ children: /* @__PURE__ */ jsx(FlatList, {
1016
+ accessibilityLabel: t("team.ui.agentRuns", "Agent runs"),
1017
+ data: items,
1018
+ keyExtractor: (item) => item.runId,
1019
+ style: styles$5.list,
1020
+ contentContainerStyle: styles$5.listContent,
1021
+ initialNumToRender: 8,
1022
+ maxToRenderPerBatch: 8,
1023
+ windowSize: 5,
1024
+ ListHeaderComponent: /* @__PURE__ */ jsxs(View, {
1025
+ style: styles$5.headingBlock,
1026
+ children: [/* @__PURE__ */ jsxs(View, {
1027
+ style: styles$5.headingRow,
1028
+ children: [/* @__PURE__ */ jsx(Text, {
1029
+ accessibilityRole: "header",
1030
+ style: styles$5.heading,
1031
+ children: t("team.ui.agentsThisSession", "Agents · this session")
1032
+ }), items.length === 0 ? null : /* @__PURE__ */ jsx(Button, {
1033
+ variant: "primary",
1034
+ testID: "compact-agent-launch",
1035
+ onPress: () => onAction("launch"),
1036
+ children: t("team.ui.newAgentRun", "New agent run")
1037
+ })]
1038
+ }), loading && items.length === 0 ? null : /* @__PURE__ */ jsx(Text, {
1039
+ testID: "compact-agent-tally",
1040
+ style: styles$5.dim,
1041
+ children: items.length === 0 ? t("team.ui.noRunsYet", "No runs yet") : tally
1042
+ })]
1043
+ }),
1044
+ ListEmptyComponent: loading ? /* @__PURE__ */ jsx(LoadingState, {
1045
+ label: t("team.ui.loadingAgentRuns", "Loading agent runs"),
1046
+ testID: "compact-agent-loading"
1047
+ }) : /* @__PURE__ */ jsx(EmptyState, {
1048
+ icon: /* @__PURE__ */ jsx(UsersIcon, { size: 20 }),
1049
+ title: t("team.ui.noRunsYet", "No runs yet"),
1050
+ description: t("team.ui.startAnAgentRunToGetHelpWithYourWork", "Start an agent run to get help with your work."),
1051
+ action: {
1052
+ label: t("team.ui.newAgentRun", "New agent run"),
1053
+ onAction: () => onAction("launch"),
1054
+ testId: "compact-agent-launch"
1055
+ }
1056
+ }),
1057
+ renderItem: ({ item }) => /* @__PURE__ */ jsx(CompactRun, {
1058
+ item,
1059
+ now,
1060
+ stopping: stoppingRunId === item.runId || stoppingRunIds.includes(item.runId),
1061
+ menuRunId,
1062
+ stopError: item.runId === (stopErrorRunId ?? items[0]?.runId) ? stopError : void 0,
1063
+ onAction
1064
+ }),
1065
+ ListFooterComponent: items.length === 0 ? void 0 : /* @__PURE__ */ jsx(Text, {
1066
+ style: styles$5.dim,
1067
+ children: t("team.ui.tapARunToOpenItsThreadRunActionsHoldsDetailsStopAndClearFinishedRunsLeaveTheListAfter10m", "Tap a run to open its thread. Run actions holds details, stop and clear. Finished runs leave the list after 10m.")
1068
+ })
1069
+ })
1070
+ });
1071
+ }
1072
+ const styles$5 = StyleSheet.create((theme) => {
1073
+ const sans = fontOf(theme.fontFamily.sans);
1074
+ const small = {
1075
+ fontFamily: sans,
1076
+ fontSize: theme.fontSize.sm,
1077
+ lineHeight: theme.lineHeight.sm
1078
+ };
1079
+ const base = {
1080
+ fontFamily: sans,
1081
+ fontSize: theme.fontSize.base,
1082
+ lineHeight: theme.lineHeight.base
1083
+ };
1084
+ return {
1085
+ elapsed: {
1086
+ flexDirection: "row",
1087
+ alignItems: "center"
1088
+ },
1089
+ list: { flex: 1 },
1090
+ listContent: {
1091
+ padding: theme.spacing(3),
1092
+ uni__dependencies: [0]
1093
+ },
1094
+ screen: {
1095
+ flex: 1,
1096
+ backgroundColor: theme.colors.bg,
1097
+ uni__dependencies: [0]
1098
+ },
1099
+ headingBlock: {
1100
+ gap: theme.spacing(2),
1101
+ paddingBottom: theme.spacing(3),
1102
+ uni__dependencies: [0]
1103
+ },
1104
+ headingRow: {
1105
+ flexDirection: "row",
1106
+ flexWrap: "wrap",
1107
+ alignItems: "center",
1108
+ justifyContent: "space-between",
1109
+ gap: theme.spacing(2),
1110
+ uni__dependencies: [0]
1111
+ },
1112
+ heading: {
1113
+ fontFamily: sans,
1114
+ fontSize: theme.fontSize.lg,
1115
+ lineHeight: theme.lineHeight.lg,
1116
+ fontWeight: theme.fontWeight.semibold,
1117
+ color: theme.colors.hi,
1118
+ uni__dependencies: [0]
1119
+ },
1120
+ card: (edge) => ({
1121
+ flexDirection: "row",
1122
+ marginBottom: theme.spacing(3),
1123
+ borderColor: theme.colors[edge],
1124
+ uni__dependencies: [0]
1125
+ }),
1126
+ open: {
1127
+ flex: 1,
1128
+ minWidth: 0,
1129
+ minHeight: 44,
1130
+ padding: theme.spacing(3),
1131
+ gap: theme.spacing(1.5),
1132
+ uni__dependencies: [0]
1133
+ },
1134
+ rowHead: {
1135
+ flexDirection: "row",
1136
+ alignItems: "center",
1137
+ gap: theme.spacing(2),
1138
+ uni__dependencies: [0]
1139
+ },
1140
+ nameBlock: {
1141
+ flex: 1,
1142
+ minWidth: 0
1143
+ },
1144
+ name: {
1145
+ ...base,
1146
+ fontWeight: theme.fontWeight.semibold,
1147
+ color: theme.colors.hi,
1148
+ uni__dependencies: [0]
1149
+ },
1150
+ dim: {
1151
+ ...small,
1152
+ color: theme.colors.dim,
1153
+ uni__dependencies: [0]
1154
+ },
1155
+ error: {
1156
+ ...small,
1157
+ color: theme.colors.red,
1158
+ uni__dependencies: [0]
1159
+ },
1160
+ body: {
1161
+ ...base,
1162
+ color: theme.colors.text,
1163
+ uni__dependencies: [0]
1164
+ },
1165
+ workText: {
1166
+ ...base,
1167
+ minWidth: 0,
1168
+ color: theme.colors.text,
1169
+ uni__dependencies: [0]
1170
+ },
1171
+ menu: {
1172
+ width: 44,
1173
+ minWidth: 44,
1174
+ minHeight: 44,
1175
+ alignSelf: "flex-start"
1176
+ },
1177
+ fact: {
1178
+ flexDirection: "row",
1179
+ gap: theme.spacing(3),
1180
+ uni__dependencies: [0]
1181
+ },
1182
+ factLabel: {
1183
+ ...small,
1184
+ width: 44,
1185
+ color: theme.colors.dim,
1186
+ uni__dependencies: [0]
1187
+ },
1188
+ factValue: {
1189
+ ...base,
1190
+ flex: 1,
1191
+ minWidth: 0,
1192
+ color: theme.colors.text,
1193
+ uni__dependencies: [0]
1194
+ },
1195
+ detailBlock: {
1196
+ gap: theme.spacing(1),
1197
+ borderWidth: 1,
1198
+ borderColor: theme.colors.border,
1199
+ borderRadius: theme.borderRadius.md,
1200
+ backgroundColor: theme.colors.deep,
1201
+ padding: theme.spacing(3),
1202
+ uni__dependencies: [0]
1203
+ }
1204
+ };
1205
+ });
369
1206
  //#endregion
370
1207
  //#region src/extensions/workspaces/sessions/(frontend)/_components/SubagentsPanel.native.tsx
1208
+ /** One run state, in the host's shared outcome vocabulary. */
1209
+ const RUN_BADGE = (t) => ({
1210
+ queued: {
1211
+ label: t("team.ui.queuedUpper", "QUEUED"),
1212
+ tone: "neutral"
1213
+ },
1214
+ running: {
1215
+ label: t("team.ui.runningUpper", "RUNNING"),
1216
+ tone: "running"
1217
+ },
1218
+ done: {
1219
+ label: t("team.ui.doneUpper", "DONE"),
1220
+ tone: "ok"
1221
+ },
1222
+ failed: {
1223
+ label: t("team.ui.failedUpper", "FAILED"),
1224
+ tone: "error"
1225
+ },
1226
+ stopped: {
1227
+ label: t("team.ui.stoppedUpper", "STOPPED"),
1228
+ tone: "neutral"
1229
+ }
1230
+ });
1231
+ const NOT_REPORTED = (t) => t("team.ui.notReported", "Not reported");
1232
+ const END_NOTE = (t) => ({
1233
+ done: t("team.ui.thisRunHasFinishedStartANewRunFromAgents", "This run has finished. Start a new run from Agents."),
1234
+ failed: t("team.ui.thisRunFailedStartANewRunFromAgents", "This run failed. Start a new run from Agents."),
1235
+ stopped: t("team.ui.thisRunWasStoppedStartANewRunFromAgents", "This run was stopped. Start a new run from Agents.")
1236
+ });
371
1237
  function useSubagents(sessionId) {
372
1238
  const subscribe = useCallback((listener) => {
373
1239
  const sub = subagents.store.subscribe(listener);
@@ -378,7 +1244,8 @@ function useSubagents(sessionId) {
378
1244
  function subagentsTab() {
379
1245
  return {
380
1246
  id: "subagents",
381
- label: "agents",
1247
+ label: "Agents",
1248
+ translateLabel: (t) => t("team.activityGroup.label", "Agents"),
382
1249
  panel: SubagentsPanel
383
1250
  };
384
1251
  }
@@ -390,44 +1257,77 @@ function agentThreadTab(run) {
390
1257
  panel: (props) => /* @__PURE__ */ jsx(AgentThreadPanel, {
391
1258
  ...props,
392
1259
  runId
393
- })
1260
+ }, `${props.sessionId}:${runId}`)
394
1261
  };
395
1262
  }
396
- function AgentRunRow({ run, onPress }) {
397
- const detail = run.error ?? run.summary?.split("\n").find((line) => line.trim() !== "") ?? run.currentTool ?? run.tail.at(-1) ?? run.state;
398
- return /* @__PURE__ */ jsx(ListRow, {
399
- leading: /* @__PURE__ */ jsx(Dot, { tone: run.state === "failed" ? "red" : run.state === "running" ? "yellow" : run.state === "done" ? "green" : "muted" }),
400
- title: /* @__PURE__ */ jsx(Button, {
401
- variant: "ghost",
402
- onPress,
403
- testID: `activity-run-${run.runId}`,
404
- children: agentRunLabel(run)
405
- }),
406
- description: detail,
407
- trailing: /* @__PURE__ */ jsx(Badge, { children: run.state })
408
- });
409
- }
1263
+ /** The subagents tab: the focused session's fleet, one card per run. */
410
1264
  function SubagentsPanel(props) {
411
- const state = useSubagents(props.sessionId);
412
- return /* @__PURE__ */ jsxs(ScrollView, {
413
- contentContainerStyle: styles.body,
1265
+ const { sessionId, renderSlot, openTransientTab } = props;
1266
+ const state = useSubagents(sessionId);
1267
+ const runs = visibleRuns(state);
1268
+ const { openRunId, stopRequested, autoOpenRunId } = state;
1269
+ useEffect(() => {
1270
+ if (autoOpenRunId === void 0 || sessionId === null) return;
1271
+ const run = runs.find((candidate) => candidate.runId === autoOpenRunId);
1272
+ if (run) openTransientTab(agentThreadTab(run));
1273
+ clearAutoOpen(sessionId);
1274
+ }, [
1275
+ autoOpenRunId,
1276
+ runs,
1277
+ sessionId,
1278
+ openTransientTab
1279
+ ]);
1280
+ const shownRun = openRunId === void 0 ? void 0 : runs.find((run) => run.runId === openRunId);
1281
+ const stopping = (run) => stopRequested.includes(run.runId);
1282
+ const [stopError, setStopError] = useState();
1283
+ const onAction = (action, run) => {
1284
+ if (sessionId === null) return;
1285
+ if (action === "launch") {
1286
+ openRun(sessionId, void 0);
1287
+ openCatalog(sessionId);
1288
+ } else if (run) {
1289
+ if (action === "thread") {
1290
+ closeCatalog(sessionId);
1291
+ openTransientTab(agentThreadTab(run));
1292
+ } else if (action === "details") {
1293
+ closeCatalog(sessionId);
1294
+ openRun(sessionId, run.runId);
1295
+ } else if (action === "clear") dismissRun(sessionId, run.runId);
1296
+ else if (action === "stop") {
1297
+ setStopError(void 0);
1298
+ requestRunStop(sessionId, run.runId).catch((cause) => setStopError({
1299
+ runId: run.runId,
1300
+ message: cause instanceof Error ? cause.message : String(cause)
1301
+ }));
1302
+ }
1303
+ }
1304
+ };
1305
+ return /* @__PURE__ */ jsxs(View, {
1306
+ testID: "subagents-panel",
1307
+ style: styles$4.screen,
414
1308
  children: [
415
- /* @__PURE__ */ jsx(Button, {
416
- testID: "activity-agents-launch",
417
- onPress: () => {
418
- if (props.sessionId !== null) openCatalog(props.sessionId);
419
- },
420
- children: "Launch an agent"
1309
+ /* @__PURE__ */ jsx(CompactAgents, {
1310
+ items: runs,
1311
+ loading: sessionId !== null && !state.loaded,
1312
+ stoppingRunIds: stopRequested,
1313
+ stopError: stopError?.message,
1314
+ stopErrorRunId: stopError?.runId,
1315
+ onAction
421
1316
  }),
422
- visibleRuns(state).map((run) => /* @__PURE__ */ jsx(AgentRunRow, {
423
- run,
424
- onPress: () => props.openTransientTab(agentThreadTab(run))
425
- }, run.runId)),
426
- /* @__PURE__ */ jsx(AgentCatalog, { ...props })
1317
+ /* @__PURE__ */ jsx(AgentCatalog, { ...props }),
1318
+ shownRun && sessionId !== null ? /* @__PURE__ */ jsx(CompactRunDetails, {
1319
+ item: shownRun,
1320
+ stopping: stopping(shownRun),
1321
+ actions: renderSlot(RUN_ACTIONS_SLOT.slot),
1322
+ stopError: stopError?.runId === shownRun.runId ? stopError.message : void 0,
1323
+ onClose: () => openRun(sessionId, void 0),
1324
+ onAction
1325
+ }) : null
427
1326
  ]
428
1327
  });
429
1328
  }
430
1329
  function AgentCatalog({ sessionId }) {
1330
+ const t = useT();
431
1331
  const subscribe = useCallback((listener) => {
432
1332
  const sub = catalog.store.subscribe(listener);
433
1333
  return () => sub.unsubscribe();
@@ -439,6 +1339,7 @@ function AgentCatalog({ sessionId }) {
439
1339
  if (sessionId !== null && state.open) return loadCatalog(sessionId);
440
1340
  }, [sessionId, state.open]);
441
1341
  if (sessionId === null || !state.open) return null;
1342
+ const shown = filterCatalog(state.agents, filter);
442
1343
  return /* @__PURE__ */ jsx(Sheet, {
443
1344
  open: true,
444
1345
  onOpenChange: (open) => {
@@ -447,7 +1348,7 @@ function AgentCatalog({ sessionId }) {
447
1348
  setAgent(void 0);
448
1349
  }
449
1350
  },
450
- children: /* @__PURE__ */ jsxs(SheetContent, { children: [/* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: agent ? `Launch ${agent.name}` : "Launch an agent" }) }), /* @__PURE__ */ jsx(SheetBody, { children: agent ? /* @__PURE__ */ jsx(AgentLaunch, {
1351
+ children: /* @__PURE__ */ jsxs(SheetContent, { children: [/* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: agent ? t("team.ui.launchNamed", "Launch {name}", { name: agent.name }) : t("team.ui.launchAnAgent", "Launch an agent") }) }), /* @__PURE__ */ jsx(SheetBody, { children: agent ? /* @__PURE__ */ jsx(AgentLaunch, {
451
1352
  sessionId,
452
1353
  agent,
453
1354
  models: state.models,
@@ -457,35 +1358,45 @@ function AgentCatalog({ sessionId }) {
457
1358
  setAgent(void 0);
458
1359
  }
459
1360
  }, agent.name) : /* @__PURE__ */ jsxs(View, {
460
- style: styles.body,
1361
+ style: styles$4.body,
461
1362
  children: [
462
1363
  /* @__PURE__ */ jsx(Input, {
463
- accessibilityLabel: "Filter agents",
464
- placeholder: "Find an agent",
1364
+ accessibilityLabel: t("team.ui.filterAgents", "Filter agents"),
1365
+ placeholder: t("team.ui.findAnAgent", "Find an agent"),
465
1366
  value: filter,
466
1367
  onChangeText: setFilter
467
1368
  }),
468
1369
  state.loading ? /* @__PURE__ */ jsx(Text, {
469
- style: styles.meta,
470
- children: "Loading agents…"
1370
+ style: styles$4.meta,
1371
+ children: t("team.ui.loadingAgents", "Loading agents…")
471
1372
  }) : null,
472
1373
  state.warning ? /* @__PURE__ */ jsx(Text, {
473
- style: styles.error,
1374
+ style: styles$4.error,
474
1375
  children: state.warning
475
1376
  }) : null,
476
- filterCatalog(state.agents, filter).map((item) => /* @__PURE__ */ jsx(ListRow, {
477
- title: /* @__PURE__ */ jsx(Button, {
478
- variant: "ghost",
479
- onPress: () => setAgent(item),
480
- children: item.name
481
- }),
482
- description: `${item.description}\n${agentMeta(item)}`
483
- }, item.name))
1377
+ shown.map((item) => /* @__PURE__ */ jsx(ListRow, {
1378
+ title: item.name,
1379
+ description: item.description || agentMeta(item, t),
1380
+ onPress: () => setAgent(item)
1381
+ }, item.name)),
1382
+ !state.loading && shown.length === 0 && filter.trim() !== "" ? /* @__PURE__ */ jsx(EmptyState, {
1383
+ testID: "catalog-no-match",
1384
+ size: "compact",
1385
+ surface: "plain",
1386
+ icon: /* @__PURE__ */ jsx(SearchIcon, { size: 16 }),
1387
+ title: t("team.ui.noMatchingAgents", "No matching agents"),
1388
+ description: t("team.ui.tryAnotherName", "Try another name."),
1389
+ secondaryAction: {
1390
+ label: t("team.ui.clearFilter", "Clear filter"),
1391
+ onAction: () => setFilter("")
1392
+ }
1393
+ }) : null
484
1394
  ]
485
1395
  }) })] })
486
1396
  });
487
1397
  }
488
1398
  function AgentLaunch({ sessionId, agent, models, initialTask, onClose }) {
1399
+ const t = useT();
489
1400
  const [task, setTask] = useState(initialTask);
490
1401
  const [fork, setFork] = useState(agent.defaultContext === "fork");
491
1402
  const [model, setModel] = useState("");
@@ -512,37 +1423,37 @@ function AgentLaunch({ sessionId, agent, models, initialTask, onClose }) {
512
1423
  }
513
1424
  };
514
1425
  return /* @__PURE__ */ jsxs(View, {
515
- style: styles.body,
1426
+ style: styles$4.body,
516
1427
  children: [
517
1428
  /* @__PURE__ */ jsx(Text, {
518
- style: styles.meta,
1429
+ style: styles$4.meta,
519
1430
  children: agent.description
520
1431
  }),
521
1432
  /* @__PURE__ */ jsx(Textarea, {
522
- accessibilityLabel: "Task",
1433
+ accessibilityLabel: t("team.ui.task", "Task"),
523
1434
  value: task,
524
1435
  onChangeText: setTask,
525
- placeholder: "What should the agent do? Empty runs its own prompt"
1436
+ placeholder: t("team.ui.whatShouldTheAgentDoEmptyRunsItsOwnPrompt", "What should the agent do? Empty runs its own prompt")
526
1437
  }),
527
1438
  /* @__PURE__ */ jsx(SegmentedControl, {
528
1439
  value: fork ? "fork" : "fresh",
529
1440
  onValueChange: (value) => setFork(value === "fork"),
530
1441
  options: [{
531
1442
  value: "fresh",
532
- label: "Fresh"
1443
+ label: t("team.ui.fresh", "Fresh")
533
1444
  }, {
534
1445
  value: "fork",
535
- label: "Fork this session"
1446
+ label: t("team.ui.forkThisSession", "Fork this session")
536
1447
  }]
537
1448
  }),
538
1449
  /* @__PURE__ */ jsx(Text, {
539
- style: styles.meta,
540
- children: "Model"
1450
+ style: styles$4.meta,
1451
+ children: t("team.ui.model", "Model")
541
1452
  }),
542
1453
  /* @__PURE__ */ jsxs(Button, {
543
1454
  variant: model === "" ? "primary" : "outline",
544
1455
  onPress: () => setModel(""),
545
- children: ["Agent default", agent.model ? ` · ${agent.model}` : ""]
1456
+ children: [t("team.ui.agentDefault", "Agent default"), agent.model ? ` · ${agent.model}` : ""]
546
1457
  }),
547
1458
  modelChoices(agent, models).map((choice) => /* @__PURE__ */ jsx(Button, {
548
1459
  variant: "outline",
@@ -551,154 +1462,562 @@ function AgentLaunch({ sessionId, agent, models, initialTask, onClose }) {
551
1462
  children: choice
552
1463
  }, choice)),
553
1464
  error ? /* @__PURE__ */ jsx(Text, {
554
- style: styles.error,
1465
+ style: styles$4.error,
555
1466
  children: error
556
1467
  }) : null,
557
1468
  /* @__PURE__ */ jsx(Button, {
558
1469
  testID: "launch-agent-submit",
559
1470
  disabled: busy,
560
1471
  onPress: () => void launch(),
561
- children: busy ? "Launching…" : "Launch"
1472
+ children: busy ? t("team.ui.launching", "Launching…") : t("team.ui.launch", "Launch")
1473
+ })
1474
+ ]
1475
+ });
1476
+ }
1477
+ /**
1478
+ * The one control a run offers: stop while it is active, clear once it is not.
1479
+ * Stop is a request the runtime acknowledges in its own time, so the button
1480
+ * reads "stopping" until the run's own status says otherwise.
1481
+ */
1482
+ function RunControl({ sessionId, run, stopping }) {
1483
+ const t = useT();
1484
+ const [error, setError] = useState();
1485
+ if (isTerminalRun(run)) return /* @__PURE__ */ jsx(Button, {
1486
+ variant: "outline",
1487
+ size: "xs",
1488
+ testID: `run-clear-${run.runId}`,
1489
+ onPress: () => dismissRun(sessionId, run.runId),
1490
+ children: t("team.ui.clear", "clear")
1491
+ });
1492
+ return /* @__PURE__ */ jsxs(Fragment, { children: [error ? /* @__PURE__ */ jsx(Text, {
1493
+ accessibilityRole: "alert",
1494
+ testID: `run-stop-error-${run.runId}`,
1495
+ numberOfLines: 1,
1496
+ style: styles$4.error,
1497
+ children: error
1498
+ }) : null, /* @__PURE__ */ jsx(Button, {
1499
+ variant: stopping ? "outline" : "danger-outline",
1500
+ size: "xs",
1501
+ testID: `run-stop-${run.runId}`,
1502
+ disabled: stopping,
1503
+ onPress: () => {
1504
+ setError(void 0);
1505
+ requestRunStop(sessionId, run.runId).catch((cause) => setError(cause instanceof Error ? cause.message : String(cause)));
1506
+ },
1507
+ children: stopping ? t("team.ui.stoppingLower", "stopping…") : t("team.ui.stopLower", "stop")
1508
+ })] });
1509
+ }
1510
+ function InfoRow({ label, children }) {
1511
+ return /* @__PURE__ */ jsxs(View, {
1512
+ style: styles$4.infoRow,
1513
+ children: [/* @__PURE__ */ jsx(Text, {
1514
+ style: [styles$4.dim, styles$4.infoLabel],
1515
+ children: label
1516
+ }), /* @__PURE__ */ jsx(View, {
1517
+ style: styles$4.infoValue,
1518
+ children
1519
+ })]
1520
+ });
1521
+ }
1522
+ /** What the run is: the agent, what it was asked, and how it thinks. Only what the runtime recorded. */
1523
+ function RunInfo({ run }) {
1524
+ const t = useT();
1525
+ const usage = [run?.toolCount === void 0 ? void 0 : t("team.ui.toolCount", "{count} tools", { count: run.toolCount }), run?.tokens === void 0 ? void 0 : t("team.ui.tokenCount", "{count} tokens", { count: run.tokens })].filter(Boolean).join(" · ");
1526
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1527
+ /* @__PURE__ */ jsxs(InfoRow, {
1528
+ label: t("team.ui.agent", "Agent"),
1529
+ children: [
1530
+ /* @__PURE__ */ jsx(Text, {
1531
+ style: styles$4.name,
1532
+ children: run?.agent ?? NOT_REPORTED(t)
1533
+ }),
1534
+ run?.agentDescription ? /* @__PURE__ */ jsx(Text, {
1535
+ style: styles$4.bodyDim,
1536
+ children: run.agentDescription
1537
+ }) : null,
1538
+ run?.agentFilePath ? /* @__PURE__ */ jsx(Text, {
1539
+ style: styles$4.monoDim,
1540
+ children: run.agentFilePath
1541
+ }) : null
1542
+ ]
1543
+ }),
1544
+ /* @__PURE__ */ jsx(InfoRow, {
1545
+ label: t("team.ui.model", "Model"),
1546
+ children: /* @__PURE__ */ jsxs(Text, {
1547
+ style: styles$4.bodyText,
1548
+ children: [run?.model ?? NOT_REPORTED(t), run?.model && run.modelSource === "configured" ? /* @__PURE__ */ jsx(Text, {
1549
+ style: styles$4.bodyDim,
1550
+ children: t("team.ui.configuredNotConfirmedByTheRuntime", "· configured, not confirmed by the runtime")
1551
+ }) : null]
1552
+ })
1553
+ }),
1554
+ /* @__PURE__ */ jsx(InfoRow, {
1555
+ label: t("team.ui.thinking", "Thinking"),
1556
+ children: /* @__PURE__ */ jsx(Text, {
1557
+ style: [styles$4.bodyText, styles$4.capitalize],
1558
+ children: run?.thinking ?? NOT_REPORTED(t)
1559
+ })
1560
+ }),
1561
+ /* @__PURE__ */ jsx(InfoRow, {
1562
+ label: t("team.ui.prompt", "Prompt"),
1563
+ children: run?.promptWithheld ? /* @__PURE__ */ jsx(Text, {
1564
+ style: styles$4.bodyDim,
1565
+ children: t("team.ui.withheldThisTaskWasMarkedSensitive", "Withheld: this task was marked sensitive.")
1566
+ }) : /* @__PURE__ */ jsx(ScrollView, {
1567
+ style: styles$4.prompt,
1568
+ nestedScrollEnabled: true,
1569
+ children: /* @__PURE__ */ jsx(Text, {
1570
+ style: styles$4.bodyText,
1571
+ children: run?.task || NOT_REPORTED(t)
1572
+ })
1573
+ })
1574
+ }),
1575
+ run?.taskRef ? /* @__PURE__ */ jsx(InfoRow, {
1576
+ label: t("team.ui.task", "Task"),
1577
+ children: /* @__PURE__ */ jsx(Badge, {
1578
+ tone: "violet",
1579
+ size: "xs",
1580
+ children: run.taskRef
1581
+ })
1582
+ }) : null,
1583
+ /* @__PURE__ */ jsx(InfoRow, {
1584
+ label: t("team.ui.folder", "Folder"),
1585
+ children: /* @__PURE__ */ jsx(Text, {
1586
+ style: styles$4.mono,
1587
+ children: run?.cwd ? abbreviateCwd(run.cwd) : NOT_REPORTED(t)
562
1588
  })
1589
+ }),
1590
+ /* @__PURE__ */ jsx(InfoRow, {
1591
+ label: t("team.ui.usage", "Usage"),
1592
+ children: /* @__PURE__ */ jsx(Text, {
1593
+ style: styles$4.bodyDim,
1594
+ children: usage || NOT_REPORTED(t)
1595
+ })
1596
+ })
1597
+ ] });
1598
+ }
1599
+ function RunChip({ dot, open, onPress, children }) {
1600
+ return /* @__PURE__ */ jsxs(Button, {
1601
+ variant: "outline",
1602
+ size: "md",
1603
+ accessibilityState: { expanded: open },
1604
+ onPress,
1605
+ style: styles$4.chip,
1606
+ children: [
1607
+ /* @__PURE__ */ jsx(Dot, {
1608
+ tone: dot,
1609
+ size: "sm"
1610
+ }),
1611
+ children,
1612
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 14 })
563
1613
  ]
564
1614
  });
565
1615
  }
1616
+ /**
1617
+ * A run's own conversation on the host's transcript, with its live actions.
1618
+ * The run can leave the fleet feed before the reader is done; the thread and
1619
+ * what the run last reported stay, and the panel says so.
1620
+ */
566
1621
  function AgentThreadPanel({ sessionId, runId, renderThread }) {
567
- const state = useSubagents(sessionId);
568
- const run = state.runs.find((item) => item.runId === runId);
1622
+ const t = useT();
1623
+ const { runs, stopRequested } = useSubagents(sessionId);
1624
+ const listed = runs.find((candidate) => candidate.runId === runId);
1625
+ const [seen, setSeen] = useState(listed);
1626
+ if (listed !== void 0 && listed !== seen) setSeen(listed);
1627
+ const run = listed ?? seen;
1628
+ const gone = listed === void 0;
569
1629
  const [guidance, setGuidance] = useState("");
570
- const [busy, setBusy] = useState(false);
1630
+ const [sending, setSending] = useState(false);
1631
+ const [error, setError] = useState();
571
1632
  const [notice, setNotice] = useState();
572
- const [confirmClear, setConfirmClear] = useState(false);
573
- const act = async (action) => {
574
- setBusy(true);
1633
+ const [infoOpen, setInfoOpen] = useState(false);
1634
+ const live = sessionId !== null && listed !== void 0 && !isTerminalRun(listed);
1635
+ const stopping = stopRequested.includes(runId);
1636
+ const canSteer = live && listed.canSteer !== false;
1637
+ const submitGuidance = async () => {
1638
+ const message = guidance.trim();
1639
+ if (!canSteer || stopping || !message || sending) return;
1640
+ setSending(true);
1641
+ setError(void 0);
575
1642
  setNotice(void 0);
576
1643
  try {
577
- await action();
1644
+ const result = await steerRun(sessionId, runId, message);
1645
+ if (result.state === "failed") {
1646
+ setError(result.message);
1647
+ return;
1648
+ }
1649
+ setGuidance("");
1650
+ if (result.state === "pending") setNotice(result.message);
578
1651
  } catch (cause) {
579
- setNotice(cause instanceof Error ? cause.message : String(cause));
1652
+ setError(cause instanceof Error ? cause.message : String(cause));
580
1653
  } finally {
581
- setBusy(false);
1654
+ setSending(false);
582
1655
  }
583
1656
  };
1657
+ const who = run ? agentDisplay(run) : void 0;
1658
+ const badge = run ? RUN_BADGE(t)[run.state] : void 0;
1659
+ const endNote = run && isTerminalRun(run) ? END_NOTE(t)[run.state] : run?.canSteer === false && !gone ? t("team.ui.thisRuntimeDoesNotTakeGuidanceWhileItRuns", "This runtime does not take guidance while it runs.") : t("team.ui.guidanceIsUnavailableForThisRun", "Guidance is unavailable for this run.");
1660
+ const toggleInfo = () => setInfoOpen((current) => !current);
584
1661
  return /* @__PURE__ */ jsxs(View, {
585
- style: styles.screen,
1662
+ testID: "agent-thread-panel",
1663
+ style: styles$4.screen,
586
1664
  children: [
587
- run ? /* @__PURE__ */ jsxs(View, {
588
- style: styles.body,
1665
+ /* @__PURE__ */ jsxs(View, {
1666
+ testID: "agent-thread-header",
1667
+ style: styles$4.threadHead,
589
1668
  children: [
590
- /* @__PURE__ */ jsxs(Text, {
591
- style: styles.title,
592
- children: [
593
- agentRunLabel(run),
594
- " · ",
595
- run.state
596
- ]
1669
+ run && who ? /* @__PURE__ */ jsx(AgentAvatar, {
1670
+ name: who.name,
1671
+ seed: who.seed,
1672
+ size: "sm"
1673
+ }) : null,
1674
+ /* @__PURE__ */ jsx(Text, {
1675
+ testID: "agent-thread-agent",
1676
+ numberOfLines: 1,
1677
+ style: styles$4.name,
1678
+ children: run ? agentRunLabel(run) : t("team.ui.agentRun", "Agent run")
597
1679
  }),
598
- /* @__PURE__ */ jsxs(Text, {
599
- style: styles.meta,
600
- children: [
601
- run.model,
602
- "\\n",
603
- run.task,
604
- "\\n",
605
- formatRunDuration(Math.max(0, (run.endedAt ?? run.lastUpdate) - run.startedAt))
606
- ]
1680
+ who?.role ? /* @__PURE__ */ jsx(Text, {
1681
+ numberOfLines: 1,
1682
+ style: styles$4.dim,
1683
+ children: who.role
1684
+ }) : null,
1685
+ badge && run ? /* @__PURE__ */ jsx(StatusBadge, {
1686
+ tone: badge.tone,
1687
+ testID: "agent-thread-state",
1688
+ style: styles$4.centered,
1689
+ children: stopping && !isTerminalRun(run) ? t("team.ui.stoppingUpper", "STOPPING…") : badge.label
1690
+ }) : null,
1691
+ /* @__PURE__ */ jsx(View, {
1692
+ style: styles$4.grow,
1693
+ children: run ? /* @__PURE__ */ jsx(RunElapsed, {
1694
+ item: gone ? {
1695
+ ...run,
1696
+ endedAt: run.endedAt ?? run.lastUpdate
1697
+ } : run,
1698
+ active: !gone,
1699
+ style: styles$4.dim
1700
+ }) : null
607
1701
  }),
608
- sessionId !== null ? isTerminalRun(run) ? /* @__PURE__ */ jsx(Button, {
609
- variant: "outline",
610
- onPress: () => setConfirmClear(true),
611
- children: "Clear run"
612
- }) : /* @__PURE__ */ jsx(Button, {
613
- variant: "danger-outline",
614
- disabled: busy || state.stopRequested.includes(runId),
615
- onPress: () => void act(() => requestRunStop(sessionId, runId)),
616
- children: state.stopRequested.includes(runId) ? "Stopping…" : "Stop"
1702
+ live ? /* @__PURE__ */ jsx(RunControl, {
1703
+ sessionId,
1704
+ run: listed,
1705
+ stopping
617
1706
  }) : null
618
1707
  ]
619
- }) : /* @__PURE__ */ jsx(Text, {
620
- style: styles.meta,
621
- children: "This run is no longer listed; its transcript stays readable."
622
1708
  }),
1709
+ gone ? /* @__PURE__ */ jsx(Text, {
1710
+ testID: "agent-thread-gone",
1711
+ style: [styles$4.dim, styles$4.gone],
1712
+ children: t("team.ui.thisRunIsNoLongerListedItsThreadStaysReadable", "This run is no longer listed. Its thread stays readable.")
1713
+ }) : null,
623
1714
  /* @__PURE__ */ jsx(View, {
624
- style: styles.transcript,
1715
+ style: styles$4.transcript,
625
1716
  children: renderThread(runId)
626
1717
  }),
627
- run && sessionId !== null && !isTerminalRun(run) ? /* @__PURE__ */ jsxs(View, {
628
- style: styles.body,
629
- children: [/* @__PURE__ */ jsx(Textarea, {
630
- accessibilityLabel: "Steering guidance",
631
- value: guidance,
632
- onChangeText: setGuidance,
633
- placeholder: "Guide this agent…"
634
- }), /* @__PURE__ */ jsx(Button, {
635
- disabled: busy || guidance.trim() === "",
636
- onPress: () => void act(async () => {
637
- const result = await steerRun(sessionId, runId, guidance.trim());
638
- setNotice(result.message);
639
- if (result.state !== "failed") setGuidance("");
640
- }),
641
- children: "Send guidance"
642
- })]
1718
+ infoOpen ? /* @__PURE__ */ jsx(ScrollView, {
1719
+ accessibilityLabel: t("team.ui.runInfo", "Run info"),
1720
+ testID: "run-info",
1721
+ style: styles$4.info,
1722
+ contentContainerStyle: styles$4.infoBody,
1723
+ children: /* @__PURE__ */ jsx(RunInfo, { run })
643
1724
  }) : null,
644
- notice ? /* @__PURE__ */ jsx(Text, {
645
- style: styles.meta,
646
- children: notice
647
- }) : null,
648
- /* @__PURE__ */ jsx(Sheet, {
649
- open: confirmClear,
650
- onOpenChange: setConfirmClear,
651
- children: /* @__PURE__ */ jsxs(SheetContent, { children: [/* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: "Clear this run?" }) }), /* @__PURE__ */ jsxs(SheetBody, { children: [/* @__PURE__ */ jsx(Text, {
652
- style: styles.meta,
653
- children: "This hides the finished run. Its transcript stays on disk."
654
- }), /* @__PURE__ */ jsx(Button, {
655
- variant: "danger-outline",
656
- onPress: () => {
657
- if (sessionId !== null) dismissRun(sessionId, runId);
658
- setConfirmClear(false);
659
- },
660
- children: "Clear"
661
- })] })] })
662
- })
1725
+ canSteer ? /* @__PURE__ */ jsx(View, {
1726
+ testID: "agent-steer-composer",
1727
+ style: styles$4.composerWrap,
1728
+ children: /* @__PURE__ */ jsxs(View, {
1729
+ style: styles$4.composer,
1730
+ children: [
1731
+ /* @__PURE__ */ jsx(Textarea, {
1732
+ variant: "bare",
1733
+ testID: "agent-steer-input",
1734
+ accessibilityLabel: t("team.ui.steeringGuidance", "Steering guidance"),
1735
+ rows: 2,
1736
+ value: guidance,
1737
+ readOnly: sending,
1738
+ disabled: stopping,
1739
+ placeholder: stopping ? t("team.ui.stoppingGuidancePaused", "Stopping, guidance paused") : t("team.ui.guideThisAgentItReadsThisAtItsNextStep", "Guide this agent · it reads this at its next step"),
1740
+ style: styles$4.composerInput,
1741
+ onChangeText: setGuidance
1742
+ }),
1743
+ error ? /* @__PURE__ */ jsx(Text, {
1744
+ accessibilityRole: "alert",
1745
+ testID: "agent-steer-error",
1746
+ style: [styles$4.error, styles$4.composerPad],
1747
+ children: error
1748
+ }) : null,
1749
+ /* @__PURE__ */ jsxs(View, {
1750
+ style: styles$4.composerFoot,
1751
+ children: [/* @__PURE__ */ jsx(Text, {
1752
+ testID: "agent-steer-hint",
1753
+ numberOfLines: 1,
1754
+ style: [styles$4.dim, styles$4.grow],
1755
+ children: notice
1756
+ }), /* @__PURE__ */ jsxs(Button, {
1757
+ testID: "agent-steer-submit",
1758
+ variant: "primary",
1759
+ size: "lg",
1760
+ disabled: stopping || sending || guidance.trim() === "",
1761
+ onPress: () => void submitGuidance(),
1762
+ children: [/* @__PURE__ */ jsx(SendIcon, { size: 16 }), sending ? t("team.ui.sending", "Sending…") : t("team.ui.send", "Send")]
1763
+ })]
1764
+ })
1765
+ ]
1766
+ })
1767
+ }) : /* @__PURE__ */ jsx(Text, {
1768
+ testID: "agent-thread-end",
1769
+ style: [styles$4.dim, styles$4.end],
1770
+ children: endNote
1771
+ }),
1772
+ /* @__PURE__ */ jsxs(View, {
1773
+ style: styles$4.chips,
1774
+ children: [
1775
+ /* @__PURE__ */ jsx(RunChip, {
1776
+ dot: "magenta",
1777
+ open: infoOpen,
1778
+ onPress: toggleInfo,
1779
+ children: run?.agent ?? t("team.ui.agent", "Agent")
1780
+ }),
1781
+ /* @__PURE__ */ jsxs(RunChip, {
1782
+ dot: "green",
1783
+ open: infoOpen,
1784
+ onPress: toggleInfo,
1785
+ children: [run?.model ? run.model.split("/").pop() ?? run.model : t("team.ui.modelNotReported", "Model not reported"), run?.thinking ? /* @__PURE__ */ jsxs(Text, {
1786
+ style: styles$4.dim,
1787
+ children: [" ", run.thinking]
1788
+ }) : null]
1789
+ }),
1790
+ /* @__PURE__ */ jsx(RunChip, {
1791
+ dot: "blue",
1792
+ open: infoOpen,
1793
+ onPress: toggleInfo,
1794
+ children: t("team.ui.prompt", "Prompt")
1795
+ })
1796
+ ]
1797
+ })
663
1798
  ]
664
1799
  });
665
1800
  }
666
- const styles = StyleSheet.create((theme) => ({
667
- screen: {
668
- flex: 1,
669
- backgroundColor: theme.colors.bg,
670
- uni__dependencies: [0]
671
- },
672
- transcript: { flex: 1 },
673
- body: {
674
- padding: theme.spacing(3),
675
- gap: theme.spacing(2),
676
- uni__dependencies: [0]
677
- },
678
- title: {
679
- color: theme.colors.hi,
680
- fontSize: theme.fontSize.base,
681
- fontWeight: "600",
682
- uni__dependencies: [0]
683
- },
684
- meta: {
685
- color: theme.colors.dim,
1801
+ /** `px-[26px]`: the cockpit's gutter. */
1802
+ const GUTTER = 26;
1803
+ const styles$4 = StyleSheet.create((theme) => {
1804
+ const sans = fontOf(theme.fontFamily.sans);
1805
+ const mono = fontOf(theme.fontFamily.mono);
1806
+ const sm = {
1807
+ fontFamily: sans,
686
1808
  fontSize: theme.fontSize.sm,
687
- uni__dependencies: [0]
688
- },
689
- error: {
690
- color: theme.colors.red,
691
- fontSize: theme.fontSize.sm,
692
- uni__dependencies: [0]
693
- }
694
- }));
1809
+ lineHeight: theme.lineHeight.sm
1810
+ };
1811
+ const base = {
1812
+ fontFamily: sans,
1813
+ fontSize: theme.fontSize.base,
1814
+ lineHeight: theme.lineHeight.base
1815
+ };
1816
+ return {
1817
+ screen: {
1818
+ flex: 1,
1819
+ backgroundColor: theme.colors.bg,
1820
+ uni__dependencies: [0]
1821
+ },
1822
+ transcript: {
1823
+ flex: 1,
1824
+ minHeight: 0
1825
+ },
1826
+ body: {
1827
+ padding: theme.spacing(3),
1828
+ gap: theme.spacing(2),
1829
+ uni__dependencies: [0]
1830
+ },
1831
+ grow: {
1832
+ flex: 1,
1833
+ minWidth: 0
1834
+ },
1835
+ centered: { alignSelf: "center" },
1836
+ spacer: { flex: 1 },
1837
+ title: {
1838
+ color: theme.colors.hi,
1839
+ fontSize: theme.fontSize.base,
1840
+ fontWeight: "600",
1841
+ uni__dependencies: [0]
1842
+ },
1843
+ meta: {
1844
+ color: theme.colors.dim,
1845
+ fontSize: theme.fontSize.sm,
1846
+ uni__dependencies: [0]
1847
+ },
1848
+ dim: {
1849
+ ...sm,
1850
+ color: theme.colors.dim,
1851
+ flexShrink: 1,
1852
+ uni__dependencies: [0]
1853
+ },
1854
+ error: {
1855
+ ...sm,
1856
+ color: theme.colors.red,
1857
+ flexShrink: 1,
1858
+ uni__dependencies: [0]
1859
+ },
1860
+ name: {
1861
+ ...base,
1862
+ fontWeight: theme.fontWeight.semibold,
1863
+ color: theme.colors.hi,
1864
+ flexShrink: 1,
1865
+ uni__dependencies: [0]
1866
+ },
1867
+ bodyText: {
1868
+ ...base,
1869
+ color: theme.colors.text,
1870
+ uni__dependencies: [0]
1871
+ },
1872
+ bodyDim: {
1873
+ ...base,
1874
+ color: theme.colors.dim,
1875
+ uni__dependencies: [0]
1876
+ },
1877
+ bodyRed: {
1878
+ ...base,
1879
+ color: theme.colors.red,
1880
+ uni__dependencies: [0]
1881
+ },
1882
+ violet: {
1883
+ ...base,
1884
+ color: theme.colors.violet,
1885
+ uni__dependencies: [0]
1886
+ },
1887
+ mono: {
1888
+ fontFamily: mono,
1889
+ fontSize: theme.fontSize.sm,
1890
+ lineHeight: theme.lineHeight.sm,
1891
+ color: theme.colors.text,
1892
+ uni__dependencies: [0]
1893
+ },
1894
+ monoDim: {
1895
+ fontFamily: mono,
1896
+ fontSize: theme.fontSize.sm,
1897
+ lineHeight: theme.lineHeight.sm,
1898
+ color: theme.colors.dim,
1899
+ uni__dependencies: [0]
1900
+ },
1901
+ capitalize: { textTransform: "capitalize" },
1902
+ threadHead: {
1903
+ flexDirection: "row",
1904
+ alignItems: "center",
1905
+ gap: theme.spacing(2.5),
1906
+ height: 44,
1907
+ paddingHorizontal: GUTTER,
1908
+ borderBottomWidth: 1,
1909
+ borderBottomColor: theme.colors["border-soft"],
1910
+ backgroundColor: theme.colors.rail,
1911
+ uni__dependencies: [0]
1912
+ },
1913
+ gone: {
1914
+ paddingHorizontal: GUTTER,
1915
+ paddingVertical: theme.spacing(2),
1916
+ borderBottomWidth: 1,
1917
+ borderBottomColor: theme.colors["border-soft"],
1918
+ uni__dependencies: [0]
1919
+ },
1920
+ info: {
1921
+ marginHorizontal: GUTTER,
1922
+ marginBottom: theme.spacing(2),
1923
+ maxHeight: "40%",
1924
+ flexGrow: 0,
1925
+ borderRadius: theme.borderRadius.lg,
1926
+ borderWidth: 1,
1927
+ borderColor: theme.colors.border,
1928
+ backgroundColor: theme.colors.panel,
1929
+ uni__dependencies: [0]
1930
+ },
1931
+ infoBody: {
1932
+ gap: theme.spacing(3),
1933
+ paddingHorizontal: theme.spacing(4),
1934
+ paddingVertical: theme.spacing(3),
1935
+ uni__dependencies: [0]
1936
+ },
1937
+ infoRow: {
1938
+ flexDirection: "row",
1939
+ gap: theme.spacing(3),
1940
+ uni__dependencies: [0]
1941
+ },
1942
+ infoLabel: {
1943
+ width: 96,
1944
+ flexShrink: 0
1945
+ },
1946
+ infoValue: {
1947
+ flex: 1,
1948
+ minWidth: 0
1949
+ },
1950
+ prompt: {
1951
+ maxHeight: 160,
1952
+ borderRadius: theme.borderRadius.md,
1953
+ backgroundColor: theme.colors.deep,
1954
+ paddingHorizontal: theme.spacing(3),
1955
+ paddingVertical: theme.spacing(2),
1956
+ uni__dependencies: [0]
1957
+ },
1958
+ composerWrap: {
1959
+ paddingHorizontal: GUTTER,
1960
+ paddingTop: theme.spacing(2),
1961
+ paddingBottom: theme.spacing(2),
1962
+ uni__dependencies: [0]
1963
+ },
1964
+ composer: {
1965
+ borderRadius: theme.borderRadius.lg,
1966
+ borderWidth: 1,
1967
+ borderColor: theme.colors.border,
1968
+ backgroundColor: theme.colors.panel,
1969
+ uni__dependencies: [0]
1970
+ },
1971
+ composerInput: {
1972
+ paddingHorizontal: theme.spacing(4),
1973
+ paddingTop: theme.spacing(3),
1974
+ fontSize: theme.fontSize.lg,
1975
+ lineHeight: theme.lineHeightRelaxed.lg,
1976
+ uni__dependencies: [0]
1977
+ },
1978
+ composerPad: {
1979
+ paddingHorizontal: theme.spacing(4),
1980
+ paddingTop: theme.spacing(1),
1981
+ uni__dependencies: [0]
1982
+ },
1983
+ composerFoot: {
1984
+ flexDirection: "row",
1985
+ alignItems: "center",
1986
+ gap: theme.spacing(3),
1987
+ paddingHorizontal: theme.spacing(4),
1988
+ paddingTop: theme.spacing(1),
1989
+ paddingBottom: theme.spacing(3),
1990
+ uni__dependencies: [0]
1991
+ },
1992
+ end: {
1993
+ paddingHorizontal: GUTTER,
1994
+ paddingTop: theme.spacing(3),
1995
+ paddingBottom: theme.spacing(2),
1996
+ uni__dependencies: [0]
1997
+ },
1998
+ chips: {
1999
+ flexDirection: "row",
2000
+ flexWrap: "wrap",
2001
+ alignItems: "center",
2002
+ gap: theme.spacing(2),
2003
+ paddingHorizontal: GUTTER,
2004
+ paddingBottom: theme.spacing(4),
2005
+ uni__dependencies: [0]
2006
+ },
2007
+ chip: {
2008
+ maxWidth: "100%",
2009
+ gap: theme.spacing(2),
2010
+ uni__dependencies: [0]
2011
+ }
2012
+ };
2013
+ });
695
2014
  //#endregion
696
2015
  //#region src/extensions/workspaces/sessions/(frontend)/activity-group/agents.native.ts
697
2016
  var agents_native_default = defineActivityGroup({
2017
+ label: (t) => t("team.activityGroup.label", "Agents"),
698
2018
  keys: "a r",
699
2019
  icon: () => createElement(UsersIcon),
700
2020
  statusKey: "po-team-agents",
701
- order: 10,
702
2021
  transientTab: subagentsTab,
703
2022
  activeSource: {
704
2023
  subscribe(listener) {
@@ -718,35 +2037,975 @@ var subagent_catalog_native_default = defineChannelFile(subagentCatalogChannel);
718
2037
  var subagent_runs_native_default = defineChannelFile(subagentRunsChannel);
719
2038
  //#endregion
720
2039
  //#region src/extensions/workspaces/sessions/(frontend)/fill/_components/AgentsActivitySection.native.tsx
2040
+ const AVATAR_STATE = {
2041
+ queued: "waiting",
2042
+ running: "running",
2043
+ done: "done",
2044
+ failed: "failed",
2045
+ stopped: "done"
2046
+ };
2047
+ /** The one-liner under a row: what the run is doing, or how it ended. */
2048
+ function detail(run, t) {
2049
+ if (run.state === "failed" && run.error) return run.error;
2050
+ if (run.summary) return run.summary.split("\n").find((line) => line.trim() !== "") ?? "";
2051
+ return run.currentTool ?? run.tail.at(-1) ?? (run.state === "running" ? "" : subagentStateLabel(run.state, t));
2052
+ }
721
2053
  function AgentsActivitySection({ sessionId, openTransientTab }) {
2054
+ const t = useT();
722
2055
  const runs = activityRuns(useSubagents(sessionId));
723
- return /* @__PURE__ */ jsxs(View, { children: [runs.map((run) => /* @__PURE__ */ jsx(AgentRunRow, {
724
- run,
725
- onPress: () => openTransientTab(agentThreadTab(run))
726
- }, run.runId)), runs.length === 0 ? /* @__PURE__ */ jsx(Button, {
727
- variant: "ghost",
728
- testID: "activity-agents-launch",
729
- disabled: sessionId === null,
730
- onPress: () => {
731
- if (sessionId !== null) {
732
- openCatalog(sessionId);
733
- openTransientTab(subagentsTab());
734
- }
735
- },
736
- children: "Launch an agent"
737
- }) : null] });
2056
+ if (runs.length === 0) return /* @__PURE__ */ jsxs(View, {
2057
+ style: styles$3.idle,
2058
+ children: [/* @__PURE__ */ jsx(Text, {
2059
+ testID: "activity-summary-agents",
2060
+ style: styles$3.status,
2061
+ children: t("team.ui.idle", "Idle")
2062
+ }), /* @__PURE__ */ jsxs(Pressable, {
2063
+ accessibilityRole: "button",
2064
+ accessibilityState: { disabled: sessionId === null },
2065
+ testID: "activity-agents-launch",
2066
+ disabled: sessionId === null,
2067
+ hitSlop: 10,
2068
+ onPress: () => {
2069
+ if (sessionId !== null) {
2070
+ openCatalog(sessionId);
2071
+ openTransientTab(subagentsTab());
2072
+ }
2073
+ },
2074
+ style: styles$3.action,
2075
+ children: [/* @__PURE__ */ jsx(Text, {
2076
+ style: styles$3.actionText(sessionId === null),
2077
+ children: t("team.ui.launchAnAgent", "Launch an agent")
2078
+ }), /* @__PURE__ */ jsx(ArrowRightIcon, {
2079
+ size: 14,
2080
+ color: sessionId === null ? "dim" : "green"
2081
+ })]
2082
+ })]
2083
+ });
2084
+ return /* @__PURE__ */ jsx(View, {
2085
+ testID: "activity-agent-runs",
2086
+ style: styles$3.runs,
2087
+ children: runs.map((run) => {
2088
+ const who = agentDisplay(run);
2089
+ const description = detail(run, t);
2090
+ return /* @__PURE__ */ jsx(Button, {
2091
+ variant: "ghost",
2092
+ size: "card",
2093
+ testID: `activity-run-${run.runId}`,
2094
+ accessibilityLabel: t("team.ui.openConversation", "Open {name}'s conversation", { name: who.name }),
2095
+ onPress: () => {
2096
+ if (sessionId !== null) openTransientTab(agentThreadTab(run));
2097
+ },
2098
+ style: styles$3.run,
2099
+ children: /* @__PURE__ */ jsxs(View, {
2100
+ style: styles$3.line,
2101
+ children: [
2102
+ /* @__PURE__ */ jsx(AgentAvatar, {
2103
+ name: who.name,
2104
+ seed: who.seed,
2105
+ state: AVATAR_STATE[run.state],
2106
+ size: "sm"
2107
+ }),
2108
+ /* @__PURE__ */ jsxs(View, {
2109
+ style: styles$3.text,
2110
+ children: [/* @__PURE__ */ jsxs(View, {
2111
+ style: styles$3.who,
2112
+ children: [/* @__PURE__ */ jsx(Text, {
2113
+ numberOfLines: 1,
2114
+ style: styles$3.name,
2115
+ children: who.name
2116
+ }), who.role ? /* @__PURE__ */ jsx(Text, {
2117
+ numberOfLines: 1,
2118
+ style: styles$3.dim,
2119
+ children: who.role
2120
+ }) : null]
2121
+ }), description ? /* @__PURE__ */ jsx(Text, {
2122
+ numberOfLines: 1,
2123
+ style: run.state === "failed" ? styles$3.failed : styles$3.dim,
2124
+ children: description
2125
+ }) : null]
2126
+ }),
2127
+ /* @__PURE__ */ jsxs(View, {
2128
+ style: styles$3.elapsed,
2129
+ children: [/* @__PURE__ */ jsx(RunElapsed, {
2130
+ item: run,
2131
+ style: styles$3.dim
2132
+ }), run.toolCount !== void 0 ? /* @__PURE__ */ jsx(Text, {
2133
+ style: styles$3.dim,
2134
+ children: " · " + t("team.ui.toolCount", "{count} tools", { count: run.toolCount })
2135
+ }) : null]
2136
+ })
2137
+ ]
2138
+ })
2139
+ }, run.runId);
2140
+ })
2141
+ });
738
2142
  }
2143
+ const styles$3 = StyleSheet.create((theme) => {
2144
+ const small = {
2145
+ fontFamily: fontOf(theme.fontFamily.sans),
2146
+ fontSize: theme.fontSize.sm,
2147
+ lineHeight: theme.lineHeight.sm
2148
+ };
2149
+ return {
2150
+ idle: {
2151
+ flexDirection: "row",
2152
+ alignItems: "center",
2153
+ flexWrap: "wrap",
2154
+ gap: theme.spacing(4),
2155
+ uni__dependencies: [0]
2156
+ },
2157
+ status: {
2158
+ ...small,
2159
+ color: theme.colors.dim,
2160
+ uni__dependencies: [0]
2161
+ },
2162
+ action: {
2163
+ flexDirection: "row",
2164
+ alignItems: "center",
2165
+ gap: theme.spacing(1),
2166
+ uni__dependencies: [0]
2167
+ },
2168
+ actionText: (disabled) => ({
2169
+ fontFamily: fontOf(theme.fontFamily.sans),
2170
+ fontSize: theme.fontSize.base,
2171
+ lineHeight: theme.lineHeight.base,
2172
+ fontWeight: theme.fontWeight.medium,
2173
+ color: disabled ? theme.colors.dim : theme.colors.green,
2174
+ uni__dependencies: [0]
2175
+ }),
2176
+ runs: { gap: 2 },
2177
+ elapsed: {
2178
+ flexDirection: "row",
2179
+ alignItems: "center"
2180
+ },
2181
+ run: {
2182
+ paddingHorizontal: theme.spacing(1),
2183
+ paddingVertical: theme.spacing(1),
2184
+ uni__dependencies: [0]
2185
+ },
2186
+ line: {
2187
+ flexDirection: "row",
2188
+ alignItems: "center",
2189
+ gap: theme.spacing(2),
2190
+ minWidth: 0,
2191
+ uni__dependencies: [0]
2192
+ },
2193
+ text: {
2194
+ flex: 1,
2195
+ minWidth: 0
2196
+ },
2197
+ who: {
2198
+ flexDirection: "row",
2199
+ alignItems: "baseline",
2200
+ gap: theme.spacing(1.5),
2201
+ minWidth: 0,
2202
+ uni__dependencies: [0]
2203
+ },
2204
+ name: {
2205
+ fontFamily: fontOf(theme.fontFamily.sans),
2206
+ fontSize: theme.fontSize.base,
2207
+ lineHeight: theme.lineHeight.base,
2208
+ fontWeight: theme.fontWeight.semibold,
2209
+ color: theme.colors.hi,
2210
+ flexShrink: 1,
2211
+ uni__dependencies: [0]
2212
+ },
2213
+ dim: {
2214
+ ...small,
2215
+ color: theme.colors.dim,
2216
+ flexShrink: 1,
2217
+ uni__dependencies: [0]
2218
+ },
2219
+ failed: {
2220
+ ...small,
2221
+ color: theme.colors.red,
2222
+ uni__dependencies: [0]
2223
+ }
2224
+ };
2225
+ });
739
2226
  //#endregion
740
2227
  //#region src/extensions/workspaces/sessions/(frontend)/fill/Agents.activity.agents.native.tsx
741
2228
  var Agents_activity_agents_native_default = defineFill({ component: AgentsActivitySection });
742
2229
  //#endregion
2230
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/Team.help.guides.native.ts
2231
+ var Team_help_guides_native_default = defineFill({
2232
+ slot: "help.guides",
2233
+ id: "Team",
2234
+ order: 320,
2235
+ data: {
2236
+ version: 1,
2237
+ category: "work",
2238
+ labelKey: "team.guides.team",
2239
+ label: "Team",
2240
+ guides: [{
2241
+ id: "about",
2242
+ questionKey: "team.guides.whatDoesTeamDoForMe",
2243
+ question: "What does Team do for me?",
2244
+ order: 0,
2245
+ answerKey: "team.guides.teamLetsPoRunAgentsInTheBackgroundAndExchangeMessagesWithThemItCanWorkWithoutTasksWhenBothAreEnabledTasksKeepsTheWorkGraphAndTeamRunsTheAgents",
2246
+ answer: "Team lets Po run agents in the background and exchange messages with them. It can work without Tasks; when both are enabled, Tasks keeps the work graph and Team runs the agents.",
2247
+ keywords: ["agents", "background"]
2248
+ }, {
2249
+ id: "use",
2250
+ questionKey: "team.guides.howDoIUseAndMonitorATeam",
2251
+ question: "How do I use and monitor a team?",
2252
+ order: 1,
2253
+ answerKey: "team.guides.askPoToDelegateWorkToAgentsOrRunIndependentTasksInParallelOpenAgentsInActivityToInspectRunsAndAskPoToSteerOrStopARunWhenNeeded",
2254
+ answer: "Ask Po to delegate work to agents or run independent tasks in parallel. Open Agents in Activity to inspect runs, and ask Po to steer or stop a run when needed.",
2255
+ keywords: ["parallel", "stop"]
2256
+ }]
2257
+ }
2258
+ });
2259
+ //#endregion
2260
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/IntercomToolMessage.native.tsx
2261
+ /** How the outgoing bubble settled, as a quiet line beneath it. An answer is its own bubble instead. */
2262
+ const OUTCOME_LINE = (t) => ({
2263
+ delivered: {
2264
+ tone: "neutral",
2265
+ glyph: "✓",
2266
+ text: t("team.ui.delivered", "Delivered")
2267
+ },
2268
+ queued: {
2269
+ tone: "running",
2270
+ glyph: void 0,
2271
+ text: t("team.ui.queuedNotYetConfirmed", "Queued, not yet confirmed")
2272
+ },
2273
+ replied: {
2274
+ tone: "neutral",
2275
+ glyph: "✓",
2276
+ text: t("team.ui.replied", "Replied")
2277
+ }
2278
+ });
2279
+ /** The chip beside the sender: what kind of message this session's agent sent. */
2280
+ const ACTION_CHIP = (t) => ({
2281
+ ask: t("team.ui.asked", "Asked"),
2282
+ send: t("team.ui.message", "Message"),
2283
+ reply: t("team.ui.reply", "Reply")
2284
+ });
2285
+ /** An agent's side of the thread: avatar, name, role when known, an optional chip, then the bubble. */
2286
+ function AgentTurn({ name, role, chip, state, testID, children }) {
2287
+ return /* @__PURE__ */ jsxs(View, {
2288
+ testID,
2289
+ style: styles$2.agentTurn,
2290
+ children: [/* @__PURE__ */ jsx(AgentAvatar, {
2291
+ name,
2292
+ size: "sm",
2293
+ state
2294
+ }), /* @__PURE__ */ jsxs(View, {
2295
+ style: styles$2.agentColumn,
2296
+ children: [/* @__PURE__ */ jsxs(View, {
2297
+ style: styles$2.speakerRow,
2298
+ children: [
2299
+ /* @__PURE__ */ jsx(Text, {
2300
+ numberOfLines: 1,
2301
+ style: [
2302
+ styles$2.small,
2303
+ styles$2.speaker,
2304
+ styles$2.agentName
2305
+ ],
2306
+ children: name
2307
+ }),
2308
+ role ? /* @__PURE__ */ jsx(Text, {
2309
+ numberOfLines: 1,
2310
+ style: [
2311
+ styles$2.small,
2312
+ styles$2.dim,
2313
+ styles$2.role
2314
+ ],
2315
+ children: role
2316
+ }) : null,
2317
+ chip
2318
+ ]
2319
+ }), children]
2320
+ })]
2321
+ });
2322
+ }
2323
+ /**
2324
+ * The intercom tool's timeline item on native, drawn as a chat thread between
2325
+ * agents: this session's agent sends on the right, named with its avatar once the
2326
+ * tool reports it, with a quiet delivery tick; the recipient sits on the left with
2327
+ * its avatar and name, replying while the ask waits and answering in a rail bubble
2328
+ * once it has. Actions with no message (members, pending) show the result text. A
2329
+ * failure shows only its reason, in red.
2330
+ */
2331
+ function IntercomToolMessage({ args, result, output, running, isError }) {
2332
+ const t = useT();
2333
+ const summary = intercomCallSummary(args, result?.details);
2334
+ const collapsed = shapeResult(output, {
2335
+ expanded: false,
2336
+ isPartial: running,
2337
+ isError
2338
+ });
2339
+ const outcome = running || isError ? {
2340
+ outcome: "none",
2341
+ who: "",
2342
+ reply: ""
2343
+ } : intercomOutcome(result?.details);
2344
+ const line = outcome.outcome === "none" || outcome.outcome === "answered" ? null : OUTCOME_LINE(t)[outcome.outcome];
2345
+ const message = typeof args.message === "string" ? args.message.trim() : "";
2346
+ const recipient = summary.action === "reply" ? outcome.who : summary.target;
2347
+ const sender = intercomSender(result?.details);
2348
+ const chip = ACTION_CHIP(t)[summary.action];
2349
+ return /* @__PURE__ */ jsx(MessageItem, {
2350
+ tone: toolTone({
2351
+ running,
2352
+ isError
2353
+ }),
2354
+ expandable: collapsed.glyph === "more",
2355
+ children: ({ expanded }) => {
2356
+ const shaped = expanded ? shapeResult(output, {
2357
+ expanded: true,
2358
+ isPartial: running,
2359
+ isError
2360
+ }) : collapsed;
2361
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
2362
+ title: "intercom",
2363
+ children: /* @__PURE__ */ jsxs(View, {
2364
+ testID: "tool-call-intercom",
2365
+ style: styles$2.summary,
2366
+ children: [/* @__PURE__ */ jsx(Text, {
2367
+ numberOfLines: 1,
2368
+ style: [styles$2.sans, styles$2.action],
2369
+ children: teamActionLabel(summary.action, t)
2370
+ }), recipient ? /* @__PURE__ */ jsxs(Text, {
2371
+ numberOfLines: 1,
2372
+ style: [styles$2.sans, styles$2.recipient],
2373
+ children: ["→ ", recipient]
2374
+ }) : null]
2375
+ })
2376
+ }), /* @__PURE__ */ jsxs(MessageItemBody, {
2377
+ testID: "tool-result-intercom",
2378
+ style: styles$2.body,
2379
+ children: [isError ? /* @__PURE__ */ jsx(Text, {
2380
+ selectable: true,
2381
+ accessibilityRole: "alert",
2382
+ style: [styles$2.sans, styles$2.error],
2383
+ children: shaped.lines.join("\n")
2384
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2385
+ message ? /* @__PURE__ */ jsxs(View, {
2386
+ testID: "intercom-outgoing",
2387
+ style: styles$2.outgoing,
2388
+ children: [
2389
+ /* @__PURE__ */ jsxs(View, {
2390
+ style: styles$2.speakerRow,
2391
+ children: [chip ? /* @__PURE__ */ jsx(Text, {
2392
+ style: [
2393
+ styles$2.small,
2394
+ styles$2.chip,
2395
+ styles$2.neutralChip
2396
+ ],
2397
+ children: chip
2398
+ }) : null, sender ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AgentAvatar, {
2399
+ name: sender,
2400
+ size: "sm"
2401
+ }), /* @__PURE__ */ jsx(Text, {
2402
+ numberOfLines: 1,
2403
+ style: [styles$2.small, styles$2.speaker],
2404
+ children: sender
2405
+ })] }) : null]
2406
+ }),
2407
+ /* @__PURE__ */ jsx(Text, {
2408
+ selectable: true,
2409
+ style: [
2410
+ styles$2.sans,
2411
+ styles$2.bubble,
2412
+ styles$2.outgoingBubble
2413
+ ],
2414
+ children: message
2415
+ }),
2416
+ line ? /* @__PURE__ */ jsx(MessageItemStatus, {
2417
+ tone: line.tone,
2418
+ glyph: line.glyph,
2419
+ children: line.text
2420
+ }) : null,
2421
+ running && summary.action !== "ask" ? /* @__PURE__ */ jsx(MessageItemStatus, {
2422
+ tone: "running",
2423
+ children: t("team.ui.sendingAlt", "Sending")
2424
+ }) : null
2425
+ ]
2426
+ }) : null,
2427
+ running && message && summary.action === "ask" ? /* @__PURE__ */ jsx(AgentTurn, {
2428
+ testID: "intercom-replying",
2429
+ name: recipient || "reply",
2430
+ state: "running",
2431
+ chip: /* @__PURE__ */ jsx(Text, {
2432
+ style: [styles$2.small, styles$2.dim],
2433
+ children: t("team.ui.isReplying", "is replying")
2434
+ }),
2435
+ children: /* @__PURE__ */ jsxs(View, {
2436
+ accessibilityLabel: t("team.ui.recipientReplying", "{name} is replying", { name: recipient || t("team.ui.theRecipient", "The recipient") }),
2437
+ style: [
2438
+ styles$2.bubble,
2439
+ styles$2.incomingBubble,
2440
+ styles$2.typing
2441
+ ],
2442
+ children: [
2443
+ /* @__PURE__ */ jsx(Dot, {
2444
+ tone: "muted",
2445
+ size: "md",
2446
+ pulse: true
2447
+ }),
2448
+ /* @__PURE__ */ jsx(Dot, {
2449
+ tone: "muted",
2450
+ size: "md",
2451
+ pulse: true
2452
+ }),
2453
+ /* @__PURE__ */ jsx(Dot, {
2454
+ tone: "muted",
2455
+ size: "md",
2456
+ pulse: true
2457
+ })
2458
+ ]
2459
+ })
2460
+ }) : null,
2461
+ outcome.outcome === "answered" ? /* @__PURE__ */ jsx(AgentTurn, {
2462
+ testID: "intercom-incoming",
2463
+ name: outcome.who,
2464
+ chip: /* @__PURE__ */ jsx(Text, {
2465
+ style: [
2466
+ styles$2.small,
2467
+ styles$2.chip,
2468
+ styles$2.repliedChip
2469
+ ],
2470
+ children: t("team.ui.replied", "Replied")
2471
+ }),
2472
+ children: /* @__PURE__ */ jsx(Text, {
2473
+ selectable: true,
2474
+ style: [
2475
+ styles$2.sans,
2476
+ styles$2.bubble,
2477
+ styles$2.incomingBubble
2478
+ ],
2479
+ children: outcome.reply
2480
+ })
2481
+ }) : null,
2482
+ !message && shaped.lines.length > 0 ? /* @__PURE__ */ jsx(Text, {
2483
+ selectable: true,
2484
+ numberOfLines: expanded ? void 0 : 1,
2485
+ style: [styles$2.sans, styles$2.dim],
2486
+ children: shaped.lines.join("\n")
2487
+ }) : null
2488
+ ] }), shaped.glyph === "more" ? /* @__PURE__ */ jsx(MessageItemStatus, {
2489
+ expands: true,
2490
+ children: t("team.ui.moreLines", "{count} more line(s)", { count: shaped.hidden })
2491
+ }) : null]
2492
+ })] });
2493
+ }
2494
+ });
2495
+ }
2496
+ const styles$2 = StyleSheet.create((theme) => ({
2497
+ summary: {
2498
+ flex: 1,
2499
+ flexDirection: "row",
2500
+ alignItems: "center",
2501
+ gap: theme.spacing(2),
2502
+ minWidth: 0,
2503
+ uni__dependencies: [0]
2504
+ },
2505
+ sans: {
2506
+ fontFamily: fontOf(theme.fontFamily.sans),
2507
+ fontSize: theme.fontSize.base,
2508
+ lineHeight: theme.lineHeight.base,
2509
+ uni__dependencies: [0]
2510
+ },
2511
+ small: {
2512
+ fontFamily: fontOf(theme.fontFamily.sans),
2513
+ fontSize: theme.fontSize.sm,
2514
+ lineHeight: theme.lineHeight.sm,
2515
+ uni__dependencies: [0]
2516
+ },
2517
+ action: {
2518
+ flexShrink: 0,
2519
+ color: theme.colors.hi,
2520
+ uni__dependencies: [0]
2521
+ },
2522
+ recipient: {
2523
+ flexShrink: 1,
2524
+ color: theme.colors.cyan,
2525
+ uni__dependencies: [0]
2526
+ },
2527
+ body: {
2528
+ gap: theme.spacing(4),
2529
+ uni__dependencies: [0]
2530
+ },
2531
+ speakerRow: {
2532
+ flexDirection: "row",
2533
+ flexWrap: "wrap",
2534
+ alignItems: "center",
2535
+ columnGap: theme.spacing(2),
2536
+ rowGap: 1,
2537
+ uni__dependencies: [0]
2538
+ },
2539
+ speaker: {
2540
+ color: theme.colors.hi,
2541
+ fontWeight: theme.fontWeight.semibold,
2542
+ uni__dependencies: [0]
2543
+ },
2544
+ agentName: {
2545
+ flexShrink: 0,
2546
+ maxWidth: "70%"
2547
+ },
2548
+ role: { flexShrink: 1 },
2549
+ chip: {
2550
+ overflow: "hidden",
2551
+ borderRadius: theme.borderRadius.full,
2552
+ paddingHorizontal: theme.spacing(2),
2553
+ paddingVertical: 1,
2554
+ uni__dependencies: [0]
2555
+ },
2556
+ neutralChip: {
2557
+ backgroundColor: theme.colors.deep,
2558
+ color: theme.colors.dim,
2559
+ uni__dependencies: [0]
2560
+ },
2561
+ repliedChip: {
2562
+ backgroundColor: theme.colors["tint-green"],
2563
+ color: theme.colors.green,
2564
+ uni__dependencies: [0]
2565
+ },
2566
+ outgoing: {
2567
+ alignItems: "flex-end",
2568
+ gap: theme.spacing(1),
2569
+ uni__dependencies: [0]
2570
+ },
2571
+ agentTurn: {
2572
+ flexDirection: "row",
2573
+ alignItems: "flex-start",
2574
+ gap: theme.spacing(2),
2575
+ uni__dependencies: [0]
2576
+ },
2577
+ agentColumn: {
2578
+ flexShrink: 1,
2579
+ minWidth: 0,
2580
+ alignItems: "flex-start",
2581
+ gap: theme.spacing(1),
2582
+ uni__dependencies: [0]
2583
+ },
2584
+ bubble: {
2585
+ maxWidth: "90%",
2586
+ borderRadius: theme.borderRadius.lg,
2587
+ paddingHorizontal: theme.spacing(3),
2588
+ paddingVertical: theme.spacing(2),
2589
+ color: theme.colors.hi,
2590
+ uni__dependencies: [0]
2591
+ },
2592
+ outgoingBubble: {
2593
+ backgroundColor: theme.colors["tint-green"],
2594
+ uni__dependencies: [0]
2595
+ },
2596
+ incomingBubble: {
2597
+ maxWidth: "100%",
2598
+ backgroundColor: theme.colors.rail,
2599
+ uni__dependencies: [0]
2600
+ },
2601
+ typing: {
2602
+ flexDirection: "row",
2603
+ alignItems: "center",
2604
+ gap: theme.spacing(1.5),
2605
+ paddingVertical: theme.spacing(3),
2606
+ uni__dependencies: [0]
2607
+ },
2608
+ dim: {
2609
+ color: theme.colors.dim,
2610
+ uni__dependencies: [0]
2611
+ },
2612
+ error: {
2613
+ color: theme.colors.red,
2614
+ uni__dependencies: [0]
2615
+ }
2616
+ }));
2617
+ //#endregion
2618
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/intercom.native.tsx
2619
+ /** The intercom tool's timeline card on the phone. The filename names the tool it renders. */
2620
+ var intercom_native_default = defineToolRenderer({
2621
+ message: IntercomToolMessage,
2622
+ activity: (props) => intercomActivity(props, t)
2623
+ });
2624
+ //#endregion
2625
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/StartSessionToolMessage.native.tsx
2626
+ function StartSessionToolMessage({ args, result, output, running, isError }) {
2627
+ const t = useT();
2628
+ const details = result?.details;
2629
+ const sessionId = details && typeof details === "object" && "sessionId" in details && typeof details.sessionId === "string" ? details.sessionId : "";
2630
+ return /* @__PURE__ */ jsxs(MessageItem, {
2631
+ tone: toolTone({
2632
+ running,
2633
+ isError
2634
+ }),
2635
+ children: [/* @__PURE__ */ jsx(MessageItemHeader, {
2636
+ title: "start_session",
2637
+ children: /* @__PURE__ */ jsx(Text, {
2638
+ numberOfLines: 1,
2639
+ style: styles$1.name,
2640
+ children: typeof args.name === "string" ? args.name : ""
2641
+ })
2642
+ }), /* @__PURE__ */ jsxs(MessageItemBody, {
2643
+ style: styles$1.body,
2644
+ children: [
2645
+ typeof args.brief === "string" ? /* @__PURE__ */ jsx(Text, {
2646
+ selectable: true,
2647
+ style: styles$1.text,
2648
+ children: args.brief
2649
+ }) : null,
2650
+ typeof args.workspaceId === "string" ? /* @__PURE__ */ jsxs(Text, {
2651
+ selectable: true,
2652
+ style: styles$1.metadata,
2653
+ children: [
2654
+ t("team.ui.workspace", "Workspace:"),
2655
+ " ",
2656
+ args.workspaceId
2657
+ ]
2658
+ }) : null,
2659
+ isError ? /* @__PURE__ */ jsx(Text, {
2660
+ selectable: true,
2661
+ accessibilityRole: "alert",
2662
+ style: styles$1.error,
2663
+ children: output || t("team.ui.sessionCouldNotBeStarted", "Session could not be started")
2664
+ }) : running ? /* @__PURE__ */ jsx(MessageItemStatus, {
2665
+ tone: "running",
2666
+ children: t("team.ui.startingSession", "Starting session")
2667
+ }) : sessionId ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemStatus, {
2668
+ tone: "ok",
2669
+ children: t("team.ui.sessionStarted", "Session started")
2670
+ }), /* @__PURE__ */ jsx(Text, {
2671
+ selectable: true,
2672
+ style: styles$1.metadata,
2673
+ children: sessionId
2674
+ })] }) : output ? /* @__PURE__ */ jsx(Text, {
2675
+ selectable: true,
2676
+ style: styles$1.text,
2677
+ children: output
2678
+ }) : null
2679
+ ]
2680
+ })]
2681
+ });
2682
+ }
2683
+ const styles$1 = StyleSheet.create((theme) => ({
2684
+ body: {
2685
+ gap: theme.spacing(2),
2686
+ uni__dependencies: [0]
2687
+ },
2688
+ name: {
2689
+ flexShrink: 1,
2690
+ fontFamily: fontOf(theme.fontFamily.sans),
2691
+ fontSize: theme.fontSize.base,
2692
+ color: theme.colors.hi,
2693
+ fontWeight: theme.fontWeight.semibold,
2694
+ uni__dependencies: [0]
2695
+ },
2696
+ text: {
2697
+ fontFamily: fontOf(theme.fontFamily.sans),
2698
+ fontSize: theme.fontSize.base,
2699
+ color: theme.colors.text,
2700
+ uni__dependencies: [0]
2701
+ },
2702
+ metadata: {
2703
+ fontFamily: fontOf(theme.fontFamily.mono),
2704
+ fontSize: theme.fontSize.sm,
2705
+ color: theme.colors.dim,
2706
+ uni__dependencies: [0]
2707
+ },
2708
+ error: {
2709
+ fontFamily: fontOf(theme.fontFamily.sans),
2710
+ fontSize: theme.fontSize.base,
2711
+ color: theme.colors.red,
2712
+ uni__dependencies: [0]
2713
+ }
2714
+ }));
2715
+ //#endregion
2716
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/start_session.native.tsx
2717
+ var start_session_native_default = defineToolRenderer({
2718
+ message: StartSessionToolMessage,
2719
+ activity: (props) => startSessionActivity(props, t)
2720
+ });
2721
+ //#endregion
2722
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/SubagentToolMessage.native.tsx
2723
+ const CLOSING = (t) => ({
2724
+ running: {
2725
+ tone: "running",
2726
+ text: t("team.ui.running", "Running")
2727
+ },
2728
+ done: {
2729
+ tone: "ok",
2730
+ text: t("team.ui.done", "Done")
2731
+ }
2732
+ });
2733
+ const ROW_BADGE = {
2734
+ ok: "ok",
2735
+ error: "error",
2736
+ running: "running",
2737
+ idle: "neutral"
2738
+ };
2739
+ const STATUS_TONE = {
2740
+ ok: "ok",
2741
+ error: "error",
2742
+ running: "running",
2743
+ idle: "ok"
2744
+ };
2745
+ /** One structured row: the run or agent, what it is doing, and its state flushed right. */
2746
+ function SubagentRowLine({ row }) {
2747
+ const t = useT();
2748
+ return /* @__PURE__ */ jsxs(View, {
2749
+ testID: "tool-result-subagent-row",
2750
+ style: styles.row,
2751
+ children: [
2752
+ /* @__PURE__ */ jsx(AgentAvatar, {
2753
+ name: row.label,
2754
+ seed: row.seed,
2755
+ state: row.avatar
2756
+ }),
2757
+ /* @__PURE__ */ jsxs(View, {
2758
+ style: styles.rowText,
2759
+ children: [/* @__PURE__ */ jsx(Text, {
2760
+ numberOfLines: 1,
2761
+ style: [styles.sans, styles.label],
2762
+ children: row.label
2763
+ }), row.detail ? /* @__PURE__ */ jsx(Text, {
2764
+ numberOfLines: 1,
2765
+ style: [styles.small, styles.dim],
2766
+ children: row.detail
2767
+ }) : null]
2768
+ }),
2769
+ row.state ? /* @__PURE__ */ jsx(StatusBadge, {
2770
+ tone: ROW_BADGE[row.tone],
2771
+ size: "md",
2772
+ style: ROW_BADGE[row.tone] === "neutral" ? styles.neutralBadge : void 0,
2773
+ children: subagentStateLabel(row.state, t)
2774
+ }) : null
2775
+ ]
2776
+ });
2777
+ }
2778
+ /**
2779
+ * The subagent tool's timeline item on native, as the web's: the action and
2780
+ * its per-action detail in the header, the rows the result reported in the
2781
+ * body, and the subagents tab one tap away. A result the narrower does not
2782
+ * recognise, a partial one included, falls back to the text the model was
2783
+ * given. A failure shows only its reason, in red.
2784
+ */
2785
+ function SubagentToolMessage({ args, result, output, running, isError, openTransientTab }) {
2786
+ const t = useT();
2787
+ const action = typeof args.action === "string" ? args.action : "";
2788
+ const detail = subagentCallDetail(args, t);
2789
+ const view = running || isError ? null : subagentResultView(result?.details, t);
2790
+ const hiddenRows = view ? Math.max(0, view.rows.length - 8) : 0;
2791
+ const collapsedText = view ? null : shapeResult(output, {
2792
+ expanded: false,
2793
+ isPartial: running,
2794
+ isError
2795
+ });
2796
+ return /* @__PURE__ */ jsx(MessageItem, {
2797
+ tone: toolTone({
2798
+ running,
2799
+ isError
2800
+ }),
2801
+ expandable: view ? hiddenRows > 0 : collapsedText?.glyph === "more",
2802
+ children: ({ expanded }) => {
2803
+ const shaped = view || !collapsedText ? null : expanded ? shapeResult(output, {
2804
+ expanded: true,
2805
+ isPartial: running,
2806
+ isError
2807
+ }) : collapsedText;
2808
+ const closing = shaped && (shaped.glyph === "running" || shaped.glyph === "done") ? CLOSING(t)[shaped.glyph] : null;
2809
+ const rows = view ? expanded ? view.rows : view.rows.slice(0, 8) : [];
2810
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
2811
+ title: "subagent",
2812
+ children: /* @__PURE__ */ jsxs(View, {
2813
+ testID: "tool-call-subagent",
2814
+ style: styles.summary,
2815
+ children: [/* @__PURE__ */ jsx(Text, {
2816
+ numberOfLines: 1,
2817
+ style: [styles.sans, styles.action],
2818
+ children: teamActionLabel(action, t)
2819
+ }), detail ? /* @__PURE__ */ jsx(Text, {
2820
+ numberOfLines: 1,
2821
+ style: [styles.sans, styles.detail],
2822
+ children: detail
2823
+ }) : null]
2824
+ })
2825
+ }), /* @__PURE__ */ jsxs(MessageItemBody, {
2826
+ testID: "tool-result-subagent",
2827
+ style: styles.body,
2828
+ children: [
2829
+ isError ? /* @__PURE__ */ jsx(Text, {
2830
+ selectable: true,
2831
+ accessibilityRole: "alert",
2832
+ style: [styles.sans, styles.error],
2833
+ children: shaped?.lines.join("\n")
2834
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2835
+ rows.length > 0 ? /* @__PURE__ */ jsx(View, {
2836
+ style: styles.rows,
2837
+ children: rows.map((row) => /* @__PURE__ */ jsx(SubagentRowLine, { row }, row.key))
2838
+ }) : null,
2839
+ shaped && shaped.lines.length > 0 ? /* @__PURE__ */ jsx(Text, {
2840
+ selectable: true,
2841
+ numberOfLines: expanded ? void 0 : 1,
2842
+ style: [styles.mono, styles.dim],
2843
+ children: shaped.lines.join("\n")
2844
+ }) : null,
2845
+ !expanded && hiddenRows > 0 ? /* @__PURE__ */ jsx(MessageItemStatus, {
2846
+ expands: true,
2847
+ children: t("team.ui.moreCount", "{count} more", { count: hiddenRows })
2848
+ }) : null,
2849
+ closing ? /* @__PURE__ */ jsx(MessageItemStatus, {
2850
+ tone: closing.tone,
2851
+ children: closing.text
2852
+ }) : null
2853
+ ] }),
2854
+ shaped?.glyph === "more" ? /* @__PURE__ */ jsx(MessageItemStatus, {
2855
+ expands: true,
2856
+ children: t("team.ui.moreLines", "{count} more line(s)", { count: shaped.hidden })
2857
+ }) : null,
2858
+ isError ? null : /* @__PURE__ */ jsxs(View, {
2859
+ style: [styles.footer, rows.length > 0 ? styles.footerRule : null],
2860
+ children: [view && view.summary ? /* @__PURE__ */ jsx(MessageItemStatus, {
2861
+ testID: "tool-result-subagent-summary",
2862
+ tone: STATUS_TONE[view.tone],
2863
+ children: view.summary
2864
+ }) : null, /* @__PURE__ */ jsxs(Pressable, {
2865
+ accessibilityRole: "button",
2866
+ testID: "tool-result-subagent-open",
2867
+ hitSlop: 10,
2868
+ onPress: () => openTransientTab(subagentsTab()),
2869
+ style: styles.open,
2870
+ children: [/* @__PURE__ */ jsx(Text, {
2871
+ style: [styles.small, styles.openText],
2872
+ children: t("team.ui.openSubagents", "Open subagents")
2873
+ }), /* @__PURE__ */ jsx(ArrowRightIcon, {
2874
+ size: 14,
2875
+ color: "green"
2876
+ })]
2877
+ })]
2878
+ })
2879
+ ]
2880
+ })] });
2881
+ }
2882
+ });
2883
+ }
2884
+ const styles = StyleSheet.create((theme) => ({
2885
+ summary: {
2886
+ flex: 1,
2887
+ flexDirection: "row",
2888
+ alignItems: "center",
2889
+ gap: theme.spacing(2),
2890
+ minWidth: 0,
2891
+ uni__dependencies: [0]
2892
+ },
2893
+ sans: {
2894
+ fontFamily: fontOf(theme.fontFamily.sans),
2895
+ fontSize: theme.fontSize.base,
2896
+ lineHeight: theme.lineHeight.base,
2897
+ uni__dependencies: [0]
2898
+ },
2899
+ small: {
2900
+ fontFamily: fontOf(theme.fontFamily.sans),
2901
+ fontSize: theme.fontSize.sm,
2902
+ lineHeight: theme.lineHeight.sm,
2903
+ uni__dependencies: [0]
2904
+ },
2905
+ mono: {
2906
+ fontFamily: fontOf(theme.fontFamily.mono),
2907
+ fontSize: theme.fontSize.sm,
2908
+ lineHeight: theme.lineHeightRelaxed.sm,
2909
+ uni__dependencies: [0]
2910
+ },
2911
+ action: {
2912
+ flexShrink: 0,
2913
+ color: theme.colors.dim,
2914
+ uni__dependencies: [0]
2915
+ },
2916
+ detail: {
2917
+ flexShrink: 1,
2918
+ color: theme.colors.dim,
2919
+ uni__dependencies: [0]
2920
+ },
2921
+ body: {
2922
+ gap: theme.spacing(1),
2923
+ uni__dependencies: [0]
2924
+ },
2925
+ rows: {
2926
+ marginHorizontal: -theme.spacing(2),
2927
+ uni__dependencies: [0]
2928
+ },
2929
+ row: {
2930
+ flexDirection: "row",
2931
+ alignItems: "center",
2932
+ gap: theme.spacing(3),
2933
+ paddingHorizontal: theme.spacing(2),
2934
+ paddingVertical: theme.spacing(1.5),
2935
+ uni__dependencies: [0]
2936
+ },
2937
+ rowText: {
2938
+ flex: 1,
2939
+ minWidth: 0
2940
+ },
2941
+ label: {
2942
+ fontWeight: theme.fontWeight.semibold,
2943
+ color: theme.colors.hi,
2944
+ uni__dependencies: [0]
2945
+ },
2946
+ neutralBadge: {
2947
+ backgroundColor: theme.colors.rail,
2948
+ uni__dependencies: [0]
2949
+ },
2950
+ footer: {
2951
+ flexDirection: "row",
2952
+ flexWrap: "wrap",
2953
+ alignItems: "center",
2954
+ columnGap: theme.spacing(4),
2955
+ rowGap: theme.spacing(1),
2956
+ uni__dependencies: [0]
2957
+ },
2958
+ footerRule: {
2959
+ marginTop: theme.spacing(1),
2960
+ paddingTop: theme.spacing(2.5),
2961
+ borderTopWidth: 1,
2962
+ borderTopColor: theme.colors["border-soft"],
2963
+ uni__dependencies: [0]
2964
+ },
2965
+ open: {
2966
+ flexDirection: "row",
2967
+ alignItems: "center",
2968
+ gap: theme.spacing(1),
2969
+ uni__dependencies: [0]
2970
+ },
2971
+ openText: {
2972
+ fontWeight: theme.fontWeight.medium,
2973
+ color: theme.colors.green,
2974
+ uni__dependencies: [0]
2975
+ },
2976
+ dim: {
2977
+ color: theme.colors.dim,
2978
+ uni__dependencies: [0]
2979
+ },
2980
+ error: {
2981
+ color: theme.colors.red,
2982
+ uni__dependencies: [0]
2983
+ }
2984
+ }));
2985
+ //#endregion
2986
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/subagent.native.tsx
2987
+ /** The subagent tool's timeline card on the phone. The filename names the tool it renders. */
2988
+ var subagent_native_default = defineToolRenderer({
2989
+ message: SubagentToolMessage,
2990
+ activity: (props) => subagentActivity(props, t)
2991
+ });
2992
+ //#endregion
743
2993
  //#region generated/native.ts
744
- const via = (identity, value) => value === void 0 ? void 0 : {
745
- ...identity,
746
- ...value
2994
+ const via = (identity, value) => {
2995
+ if (value === void 0) return void 0;
2996
+ const declaration = value;
2997
+ return {
2998
+ ...identity,
2999
+ ...declaration,
3000
+ ...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
3001
+ evidence: "declared",
3002
+ ...relation
3003
+ })) }
3004
+ };
747
3005
  };
748
3006
  const nativePlugin = defineNativePlugin({
749
3007
  id: "subagents",
3008
+ packageName: "@agimon-ai/po-team",
750
3009
  workspace: { get fills() {
751
3010
  return [via({
752
3011
  slot: "home",
@@ -764,7 +3023,17 @@ const nativePlugin = defineNativePlugin({
764
3023
  return [via({
765
3024
  slot: "activity.agents",
766
3025
  id: "agents"
767
- }, Agents_activity_agents_native_default)];
3026
+ }, Agents_activity_agents_native_default), via({
3027
+ slot: "help.guides",
3028
+ id: "team"
3029
+ }, Team_help_guides_native_default)];
3030
+ },
3031
+ get toolRenderers() {
3032
+ return [
3033
+ via({ tools: ["intercom"] }, intercom_native_default),
3034
+ via({ tools: ["start_session"] }, start_session_native_default),
3035
+ via({ tools: ["subagent"] }, subagent_native_default)
3036
+ ];
768
3037
  }
769
3038
  }
770
3039
  });