@elizaos/plugin-task-coordinator 2.0.3-beta.2 → 2.0.3-beta.4

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 (176) hide show
  1. package/assets/hero.png +0 -0
  2. package/dist/AgentTabsSection.d.ts +16 -0
  3. package/dist/AgentTabsSection.d.ts.map +1 -0
  4. package/dist/AgentTabsSection.js +169 -0
  5. package/dist/AgentTabsSection.js.map +1 -0
  6. package/dist/CodingAgentControlChip.d.ts +2 -0
  7. package/dist/CodingAgentControlChip.d.ts.map +1 -0
  8. package/dist/CodingAgentControlChip.js +73 -0
  9. package/dist/CodingAgentControlChip.js.map +1 -0
  10. package/dist/CodingAgentSettingsSection.d.ts +2 -0
  11. package/dist/CodingAgentSettingsSection.d.ts.map +1 -0
  12. package/dist/CodingAgentSettingsSection.js +379 -0
  13. package/dist/CodingAgentSettingsSection.js.map +1 -0
  14. package/dist/CodingAgentTasksPanel.d.ts +4 -0
  15. package/dist/CodingAgentTasksPanel.d.ts.map +1 -0
  16. package/dist/CodingAgentTasksPanel.interact.d.ts +2 -0
  17. package/dist/CodingAgentTasksPanel.interact.d.ts.map +1 -0
  18. package/dist/CodingAgentTasksPanel.interact.js +46 -0
  19. package/dist/CodingAgentTasksPanel.interact.js.map +1 -0
  20. package/dist/CodingAgentTasksPanel.js +740 -0
  21. package/dist/CodingAgentTasksPanel.js.map +1 -0
  22. package/dist/GitHubConnectionCard.d.ts +2 -0
  23. package/dist/GitHubConnectionCard.d.ts.map +1 -0
  24. package/dist/GitHubConnectionCard.js +172 -0
  25. package/dist/GitHubConnectionCard.js.map +1 -0
  26. package/dist/GlobalPrefsSection.d.ts +10 -0
  27. package/dist/GlobalPrefsSection.d.ts.map +1 -0
  28. package/dist/GlobalPrefsSection.js +166 -0
  29. package/dist/GlobalPrefsSection.js.map +1 -0
  30. package/dist/LlmProviderSection.d.ts +10 -0
  31. package/dist/LlmProviderSection.d.ts.map +1 -0
  32. package/dist/LlmProviderSection.js +161 -0
  33. package/dist/LlmProviderSection.js.map +1 -0
  34. package/dist/ModelConfigSection.d.ts +15 -0
  35. package/dist/ModelConfigSection.d.ts.map +1 -0
  36. package/dist/ModelConfigSection.js +86 -0
  37. package/dist/ModelConfigSection.js.map +1 -0
  38. package/dist/OrchestratorView.d.ts +20 -0
  39. package/dist/OrchestratorView.d.ts.map +1 -0
  40. package/dist/OrchestratorView.js +231 -0
  41. package/dist/OrchestratorView.js.map +1 -0
  42. package/dist/OrchestratorWorkbench.d.ts +32 -0
  43. package/dist/OrchestratorWorkbench.d.ts.map +1 -0
  44. package/dist/OrchestratorWorkbench.js +3200 -0
  45. package/dist/OrchestratorWorkbench.js.map +1 -0
  46. package/dist/PtyConsoleBase.d.ts +9 -0
  47. package/dist/PtyConsoleBase.d.ts.map +1 -0
  48. package/dist/PtyConsoleBase.js +174 -0
  49. package/dist/PtyConsoleBase.js.map +1 -0
  50. package/dist/PtyConsoleDrawer.d.ts +10 -0
  51. package/dist/PtyConsoleDrawer.d.ts.map +1 -0
  52. package/dist/PtyConsoleDrawer.js +77 -0
  53. package/dist/PtyConsoleDrawer.js.map +1 -0
  54. package/dist/PtyConsoleSidePanel.d.ts +8 -0
  55. package/dist/PtyConsoleSidePanel.d.ts.map +1 -0
  56. package/dist/PtyConsoleSidePanel.js +9 -0
  57. package/dist/PtyConsoleSidePanel.js.map +1 -0
  58. package/dist/PtyTerminalPane.d.ts +10 -0
  59. package/dist/PtyTerminalPane.d.ts.map +1 -0
  60. package/dist/PtyTerminalPane.js +147 -0
  61. package/dist/PtyTerminalPane.js.map +1 -0
  62. package/dist/TaskCardList.d.ts +76 -0
  63. package/dist/TaskCardList.d.ts.map +1 -0
  64. package/dist/TaskCardList.js +327 -0
  65. package/dist/TaskCardList.js.map +1 -0
  66. package/dist/TaskCoordinatorView.d.ts +20 -0
  67. package/dist/TaskCoordinatorView.d.ts.map +1 -0
  68. package/dist/TaskCoordinatorView.js +146 -0
  69. package/dist/TaskCoordinatorView.js.map +1 -0
  70. package/dist/__e2e__/dashboard-fixture.d.ts +9 -0
  71. package/dist/__e2e__/dashboard-fixture.d.ts.map +1 -0
  72. package/dist/__e2e__/dashboard-fixture.js +123 -0
  73. package/dist/__e2e__/dashboard-fixture.js.map +1 -0
  74. package/dist/api/coding-agents-auth-sanitize.d.ts +23 -0
  75. package/dist/api/coding-agents-auth-sanitize.d.ts.map +1 -0
  76. package/dist/api/coding-agents-auth-sanitize.js +22 -0
  77. package/dist/api/coding-agents-auth-sanitize.js.map +1 -0
  78. package/dist/api/coding-agents-preflight-normalize.d.ts +29 -0
  79. package/dist/api/coding-agents-preflight-normalize.d.ts.map +1 -0
  80. package/dist/api/coding-agents-preflight-normalize.js +20 -0
  81. package/dist/api/coding-agents-preflight-normalize.js.map +1 -0
  82. package/dist/coding-agent-settings-shared.d.ts +42 -0
  83. package/dist/coding-agent-settings-shared.d.ts.map +1 -0
  84. package/dist/coding-agent-settings-shared.js +121 -0
  85. package/dist/coding-agent-settings-shared.js.map +1 -0
  86. package/dist/components/OrchestratorSpatialView.d.ts +56 -0
  87. package/dist/components/OrchestratorSpatialView.d.ts.map +1 -0
  88. package/dist/components/OrchestratorSpatialView.js +501 -0
  89. package/dist/components/OrchestratorSpatialView.js.map +1 -0
  90. package/dist/components/TaskCoordinatorSpatialView.d.ts +59 -0
  91. package/dist/components/TaskCoordinatorSpatialView.d.ts.map +1 -0
  92. package/dist/components/TaskCoordinatorSpatialView.js +294 -0
  93. package/dist/components/TaskCoordinatorSpatialView.js.map +1 -0
  94. package/dist/index.d.ts +5 -0
  95. package/dist/index.d.ts.map +1 -0
  96. package/dist/index.js +286 -0
  97. package/dist/index.js.map +1 -0
  98. package/dist/orchestrator-capabilities.d.ts +3 -0
  99. package/dist/orchestrator-capabilities.d.ts.map +1 -0
  100. package/dist/orchestrator-capabilities.js +136 -0
  101. package/dist/orchestrator-capabilities.js.map +1 -0
  102. package/dist/orchestrator-command.d.ts +39 -0
  103. package/dist/orchestrator-command.d.ts.map +1 -0
  104. package/dist/orchestrator-command.js +52 -0
  105. package/dist/orchestrator-command.js.map +1 -0
  106. package/dist/orchestrator-diff.d.ts +19 -0
  107. package/dist/orchestrator-diff.d.ts.map +1 -0
  108. package/dist/orchestrator-diff.helpers.d.ts +18 -0
  109. package/dist/orchestrator-diff.helpers.d.ts.map +1 -0
  110. package/dist/orchestrator-diff.helpers.js +76 -0
  111. package/dist/orchestrator-diff.helpers.js.map +1 -0
  112. package/dist/orchestrator-diff.js +119 -0
  113. package/dist/orchestrator-diff.js.map +1 -0
  114. package/dist/orchestrator-markdown.d.ts +5 -0
  115. package/dist/orchestrator-markdown.d.ts.map +1 -0
  116. package/dist/orchestrator-markdown.helpers.d.ts +2 -0
  117. package/dist/orchestrator-markdown.helpers.d.ts.map +1 -0
  118. package/dist/orchestrator-markdown.helpers.js +21 -0
  119. package/dist/orchestrator-markdown.helpers.js.map +1 -0
  120. package/dist/orchestrator-markdown.js +199 -0
  121. package/dist/orchestrator-markdown.js.map +1 -0
  122. package/dist/orchestrator-params.d.ts +8 -0
  123. package/dist/orchestrator-params.d.ts.map +1 -0
  124. package/dist/orchestrator-params.js +27 -0
  125. package/dist/orchestrator-params.js.map +1 -0
  126. package/dist/orchestrator-plan.d.ts +5 -0
  127. package/dist/orchestrator-plan.d.ts.map +1 -0
  128. package/dist/orchestrator-plan.js +95 -0
  129. package/dist/orchestrator-plan.js.map +1 -0
  130. package/dist/orchestrator-reasoning.d.ts +21 -0
  131. package/dist/orchestrator-reasoning.d.ts.map +1 -0
  132. package/dist/orchestrator-reasoning.js +105 -0
  133. package/dist/orchestrator-reasoning.js.map +1 -0
  134. package/dist/orchestrator-stream.d.ts +15 -0
  135. package/dist/orchestrator-stream.d.ts.map +1 -0
  136. package/dist/orchestrator-stream.helpers.d.ts +89 -0
  137. package/dist/orchestrator-stream.helpers.d.ts.map +1 -0
  138. package/dist/orchestrator-stream.helpers.js +361 -0
  139. package/dist/orchestrator-stream.helpers.js.map +1 -0
  140. package/dist/orchestrator-stream.js +307 -0
  141. package/dist/orchestrator-stream.js.map +1 -0
  142. package/dist/pty-status-dots.d.ts +2 -0
  143. package/dist/pty-status-dots.d.ts.map +1 -0
  144. package/dist/pty-status-dots.js +6 -0
  145. package/dist/pty-status-dots.js.map +1 -0
  146. package/dist/register-slots.d.ts +20 -0
  147. package/dist/register-slots.d.ts.map +1 -0
  148. package/dist/register-slots.js +50 -0
  149. package/dist/register-slots.js.map +1 -0
  150. package/dist/register-terminal-view.d.ts +21 -0
  151. package/dist/register-terminal-view.d.ts.map +1 -0
  152. package/dist/register-terminal-view.js +46 -0
  153. package/dist/register-terminal-view.js.map +1 -0
  154. package/dist/register.d.ts +2 -0
  155. package/dist/register.d.ts.map +1 -0
  156. package/dist/register.js +23 -0
  157. package/dist/register.js.map +1 -0
  158. package/dist/session-hydration.d.ts +2 -0
  159. package/dist/session-hydration.d.ts.map +1 -0
  160. package/dist/session-hydration.js +9 -0
  161. package/dist/session-hydration.js.map +1 -0
  162. package/dist/task-coordinator-view-bundle.d.ts +4 -0
  163. package/dist/task-coordinator-view-bundle.d.ts.map +1 -0
  164. package/dist/task-coordinator-view-bundle.js +9 -0
  165. package/dist/task-coordinator-view-bundle.js.map +1 -0
  166. package/dist/ui.d.ts +2 -0
  167. package/dist/ui.d.ts.map +1 -0
  168. package/dist/ui.js +13 -0
  169. package/dist/ui.js.map +1 -0
  170. package/dist/view-format.d.ts +25 -0
  171. package/dist/view-format.d.ts.map +1 -0
  172. package/dist/view-format.js +64 -0
  173. package/dist/view-format.js.map +1 -0
  174. package/dist/views/bundle.js +1383 -0
  175. package/dist/views/bundle.js.map +1 -0
  176. package/package.json +7 -6
@@ -0,0 +1,740 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import {
3
+ ApiError,
4
+ Button,
5
+ client,
6
+ useAppSelectorShallow
7
+ } from "@elizaos/ui";
8
+ import { useAgentElement } from "@elizaos/ui/agent-surface";
9
+ import { Archive, Bot, ListChecks, Terminal } from "lucide-react";
10
+ import {
11
+ useDeferredValue,
12
+ useEffect,
13
+ useMemo,
14
+ useState
15
+ } from "react";
16
+ import {
17
+ BackChip,
18
+ SparseWatermark,
19
+ TaskCard,
20
+ TaskCountChip,
21
+ TaskEmptyState,
22
+ TaskListHeader,
23
+ TaskMetaChip,
24
+ TaskSearchInput,
25
+ TaskStatusMedallion
26
+ } from "./TaskCardList.js";
27
+ const ANSI_ESCAPE_PATTERN = new RegExp(
28
+ [
29
+ "\\u001b(?:",
30
+ "\\[[0-9;?]*[A-Za-z]|\\][^\\u0007]*\\u0007|[()][0-9A-Za-z])"
31
+ ].join(""),
32
+ "g"
33
+ );
34
+ const fallbackTranslate = (key, vars) => String(vars?.defaultValue ?? key);
35
+ function formatRelativeTime(ts, locale) {
36
+ const delta = Math.max(0, Math.floor((Date.now() - ts) / 1e3));
37
+ const formatter = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
38
+ if (delta < 5) return formatter.format(0, "second");
39
+ if (delta < 60) return formatter.format(-delta, "second");
40
+ const minutes = Math.floor(delta / 60);
41
+ if (minutes < 60) return formatter.format(-minutes, "minute");
42
+ const hours = Math.floor(minutes / 60);
43
+ if (hours < 24) return formatter.format(-hours, "hour");
44
+ return formatter.format(-Math.floor(hours / 24), "day");
45
+ }
46
+ function stripAnsi(str) {
47
+ return str.replace(ANSI_ESCAPE_PATTERN, "").trim();
48
+ }
49
+ function formatIsoTime(value, locale, t) {
50
+ if (!value) {
51
+ return t("codingagenttaskspanel.unknown", {
52
+ defaultValue: "Unknown"
53
+ });
54
+ }
55
+ const date = new Date(value);
56
+ if (Number.isNaN(date.getTime())) {
57
+ return t("codingagenttaskspanel.unknown", {
58
+ defaultValue: "Unknown"
59
+ });
60
+ }
61
+ return formatRelativeTime(date.getTime(), locale);
62
+ }
63
+ function formatThreadStatus(status, t) {
64
+ const mapped = {
65
+ open: "codingagenttaskspanel.status.open",
66
+ active: "codingagenttaskspanel.status.active",
67
+ waiting_on_user: "codingagenttaskspanel.status.waitingOnUser",
68
+ blocked: "codingagenttaskspanel.status.blocked",
69
+ validating: "codingagenttaskspanel.status.validating",
70
+ done: "codingagenttaskspanel.status.done",
71
+ failed: "codingagenttaskspanel.status.failed",
72
+ archived: "codingagenttaskspanel.status.archived",
73
+ interrupted: "codingagenttaskspanel.status.interrupted"
74
+ };
75
+ return t(mapped[status] ?? "codingagenttaskspanel.status.unknown", {
76
+ defaultValue: status.replace(/_/g, " ")
77
+ });
78
+ }
79
+ const THREAD_KIND_LABELS = {
80
+ coding: "codingagenttaskspanel.kind.coding"
81
+ };
82
+ function formatThreadKind(kind, t) {
83
+ const key = THREAD_KIND_LABELS[kind];
84
+ if (!key) return null;
85
+ return t(key, { defaultValue: kind });
86
+ }
87
+ function getWorkspaceChangesSummary(metadata) {
88
+ const raw = metadata.workspaceChanges;
89
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
90
+ return null;
91
+ }
92
+ const workspaceChanges = raw;
93
+ const changedFiles = Array.isArray(workspaceChanges.changedFiles) ? workspaceChanges.changedFiles.filter(
94
+ (value) => typeof value === "string"
95
+ ) : [];
96
+ const total = typeof workspaceChanges.totalChangedFiles === "number" ? workspaceChanges.totalChangedFiles : changedFiles.length;
97
+ if (total <= 0 || changedFiles.length === 0) {
98
+ return null;
99
+ }
100
+ return {
101
+ files: changedFiles,
102
+ total
103
+ };
104
+ }
105
+ function getClientErrorMessage(error, fallback) {
106
+ return error instanceof Error ? error.message : fallback;
107
+ }
108
+ function DetailList({
109
+ title,
110
+ children
111
+ }) {
112
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
113
+ /* @__PURE__ */ jsx("div", { className: "text-2xs font-semibold uppercase tracking-[0.08em] text-muted/70", children: title }),
114
+ children
115
+ ] });
116
+ }
117
+ function ThreadActionButton({
118
+ agentId,
119
+ label,
120
+ description,
121
+ variant,
122
+ disabled,
123
+ onClick,
124
+ className
125
+ }) {
126
+ const { ref, agentProps } = useAgentElement({
127
+ id: agentId,
128
+ role: "button",
129
+ label,
130
+ group: "thread-actions",
131
+ description
132
+ });
133
+ return /* @__PURE__ */ jsx(
134
+ Button,
135
+ {
136
+ ref,
137
+ variant,
138
+ size: "sm",
139
+ disabled,
140
+ onClick,
141
+ className,
142
+ "aria-label": label,
143
+ ...agentProps,
144
+ children: label
145
+ }
146
+ );
147
+ }
148
+ function ThreadDetailContent({
149
+ detail,
150
+ busy,
151
+ onDelete,
152
+ onReopen,
153
+ t,
154
+ locale
155
+ }) {
156
+ const latestTranscripts = (detail.transcripts ?? []).filter(
157
+ (entry) => entry.direction === "stdin" || entry.direction === "system"
158
+ ).slice(-8).reverse();
159
+ const latestEvents = (detail.events ?? []).slice(-6).reverse();
160
+ const latestDecisions = (detail.decisions ?? []).slice(-6).reverse();
161
+ const latestArtifacts = (detail.artifacts ?? []).slice(-6).reverse();
162
+ const pendingDecisions = (detail.pendingDecisions ?? []).slice(-4).reverse();
163
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
164
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3 text-2xs text-muted", children: [
165
+ /* @__PURE__ */ jsx("span", { children: t("codingagenttaskspanel.sessionsCount", {
166
+ defaultValue: "{{count}} sessions",
167
+ count: (detail.sessions ?? []).length
168
+ }) }),
169
+ /* @__PURE__ */ jsx("span", { children: t("codingagenttaskspanel.artifactsCount", {
170
+ defaultValue: "{{count}} artifacts",
171
+ count: (detail.artifacts ?? []).length
172
+ }) }),
173
+ /* @__PURE__ */ jsx("span", { children: t("codingagenttaskspanel.transcriptEntriesCount", {
174
+ defaultValue: "{{count}} transcript entries",
175
+ count: (detail.transcripts ?? []).length
176
+ }) })
177
+ ] }),
178
+ detail.acceptanceCriteria && detail.acceptanceCriteria.length > 0 ? /* @__PURE__ */ jsxs("div", { children: [
179
+ /* @__PURE__ */ jsx("div", { className: "mb-1 text-2xs font-semibold uppercase tracking-[0.08em] text-muted", children: t("codingagenttaskspanel.acceptance", {
180
+ defaultValue: "Acceptance"
181
+ }) }),
182
+ /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: detail.acceptanceCriteria.map((criterion) => /* @__PURE__ */ jsx(
183
+ "div",
184
+ {
185
+ className: "text-xs-tight text-txt",
186
+ children: criterion
187
+ },
188
+ `${detail.id}-criterion-${criterion}`
189
+ )) })
190
+ ] }) : null,
191
+ /* @__PURE__ */ jsx(
192
+ DetailList,
193
+ {
194
+ title: t("codingagenttaskspanel.sessions", {
195
+ defaultValue: "Sessions"
196
+ }),
197
+ children: (detail.sessions ?? []).length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-xs-tight text-muted", children: t("codingagenttaskspanel.noSessionsRecorded", {
198
+ defaultValue: "None"
199
+ }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: (detail.sessions ?? []).slice(-4).reverse().map((session) => /* @__PURE__ */ jsxs("div", { className: "text-xs-tight text-txt", children: [
200
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: session.label }),
201
+ /* @__PURE__ */ jsxs("div", { className: "text-muted", children: [
202
+ session.framework,
203
+ session.providerSource ? ` (${session.providerSource})` : "",
204
+ " \xB7 ",
205
+ formatThreadStatus(session.status, t),
206
+ " \xB7",
207
+ " ",
208
+ session.workdir || session.repo || t("codingagenttaskspanel.noWorkspace", {
209
+ defaultValue: "None"
210
+ })
211
+ ] }),
212
+ getWorkspaceChangesSummary(session.metadata) ? /* @__PURE__ */ jsx("div", { className: "text-muted", children: (() => {
213
+ const summary = getWorkspaceChangesSummary(
214
+ session.metadata
215
+ );
216
+ if (!summary) return null;
217
+ const preview = summary.files.slice(0, 3).join(", ");
218
+ return summary.total > 3 ? t("codingagenttaskspanel.changedFilesMore", {
219
+ defaultValue: "{{count}} changed files: {{preview}}, +{{remaining}} more",
220
+ count: summary.total,
221
+ preview,
222
+ remaining: summary.total - 3
223
+ }) : t("codingagenttaskspanel.changedFiles", {
224
+ defaultValue: "{{count}} changed files: {{preview}}",
225
+ count: summary.total,
226
+ preview
227
+ });
228
+ })() }) : null
229
+ ] }, session.id)) })
230
+ }
231
+ ),
232
+ pendingDecisions.length > 0 ? /* @__PURE__ */ jsx(
233
+ DetailList,
234
+ {
235
+ title: t("codingagenttaskspanel.pendingUserInput", {
236
+ defaultValue: "Pending User Input"
237
+ }),
238
+ children: /* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: pendingDecisions.map((decision) => /* @__PURE__ */ jsxs(
239
+ "div",
240
+ {
241
+ className: "text-xs-tight text-txt",
242
+ children: [
243
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: decision.promptText }),
244
+ /* @__PURE__ */ jsx("div", { className: "line-clamp-2 text-muted", children: typeof decision.llmDecision.reasoning === "string" ? decision.llmDecision.reasoning : decision.recentOutput || t("codingagenttaskspanel.waitingForNextUserResponse", {
245
+ defaultValue: "Coordinator is waiting for the next user response."
246
+ }) })
247
+ ]
248
+ },
249
+ `${decision.threadId}-${decision.sessionId}`
250
+ )) })
251
+ }
252
+ ) : null,
253
+ latestArtifacts.length > 0 ? /* @__PURE__ */ jsx(
254
+ DetailList,
255
+ {
256
+ title: t("codingagenttaskspanel.artifacts", {
257
+ defaultValue: "Artifacts"
258
+ }),
259
+ children: /* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: latestArtifacts.map((artifact) => /* @__PURE__ */ jsxs("div", { className: "text-xs-tight text-txt", children: [
260
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: artifact.title }),
261
+ /* @__PURE__ */ jsxs("div", { className: "break-all text-muted", children: [
262
+ artifact.artifactType,
263
+ " \xB7",
264
+ " ",
265
+ artifact.path ?? artifact.uri ?? t("codingagenttaskspanel.inline", {
266
+ defaultValue: "inline"
267
+ })
268
+ ] })
269
+ ] }, artifact.id)) })
270
+ }
271
+ ) : null,
272
+ latestDecisions.length > 0 ? /* @__PURE__ */ jsx(
273
+ DetailList,
274
+ {
275
+ title: t("codingagenttaskspanel.coordinatorDecisions", {
276
+ defaultValue: "Coordinator Decisions"
277
+ }),
278
+ children: /* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: latestDecisions.map((decision) => /* @__PURE__ */ jsxs("div", { className: "text-xs-tight text-txt", children: [
279
+ /* @__PURE__ */ jsxs("div", { className: "font-medium", children: [
280
+ decision.decision,
281
+ " \xB7",
282
+ " ",
283
+ formatRelativeTime(decision.timestamp, locale)
284
+ ] }),
285
+ /* @__PURE__ */ jsx("div", { className: "line-clamp-3 text-muted", children: decision.reasoning })
286
+ ] }, decision.id)) })
287
+ }
288
+ ) : null,
289
+ latestEvents.length > 0 ? /* @__PURE__ */ jsx(
290
+ DetailList,
291
+ {
292
+ title: t("codingagenttaskspanel.events", {
293
+ defaultValue: "Events"
294
+ }),
295
+ children: /* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: latestEvents.map((event) => /* @__PURE__ */ jsxs("div", { className: "text-xs-tight text-txt", children: [
296
+ /* @__PURE__ */ jsxs("div", { className: "font-medium", children: [
297
+ event.eventType.replace(/_/g, " "),
298
+ " \xB7",
299
+ " ",
300
+ formatRelativeTime(event.timestamp, locale)
301
+ ] }),
302
+ /* @__PURE__ */ jsx("div", { className: "line-clamp-2 text-muted", children: event.summary })
303
+ ] }, event.id)) })
304
+ }
305
+ ) : null,
306
+ latestTranscripts.length > 0 ? /* @__PURE__ */ jsx(
307
+ DetailList,
308
+ {
309
+ title: t("codingagenttaskspanel.messages", {
310
+ defaultValue: "Messages"
311
+ }),
312
+ children: /* @__PURE__ */ jsx("div", { className: "max-h-40 space-y-2 overflow-y-auto pr-1", children: latestTranscripts.map((entry) => {
313
+ const text = stripAnsi(entry.content);
314
+ if (!text) return null;
315
+ return /* @__PURE__ */ jsxs(
316
+ "div",
317
+ {
318
+ className: "rounded border border-border/40 bg-bg-hover/40 p-2",
319
+ children: [
320
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 text-2xs uppercase tracking-[0.08em] text-muted", children: [
321
+ entry.direction === "stdin" ? t("codingagenttaskspanel.prompt", {
322
+ defaultValue: "prompt"
323
+ }) : t("codingagenttaskspanel.system", {
324
+ defaultValue: "system"
325
+ }),
326
+ " ",
327
+ "\xB7 ",
328
+ formatRelativeTime(entry.timestamp, locale)
329
+ ] }),
330
+ /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap break-words font-mono text-2xs text-txt", children: text })
331
+ ]
332
+ },
333
+ entry.id
334
+ );
335
+ }) })
336
+ }
337
+ ) : null,
338
+ /* @__PURE__ */ jsx("div", { className: "flex gap-2 pt-1", children: detail.status === "archived" ? /* @__PURE__ */ jsx(
339
+ ThreadActionButton,
340
+ {
341
+ agentId: "action-reopen-thread",
342
+ label: t("codingagenttaskspanel.reopen", {
343
+ defaultValue: "Reopen"
344
+ }),
345
+ description: "Reopen the selected archived task thread",
346
+ variant: "secondary",
347
+ disabled: busy,
348
+ onClick: onReopen,
349
+ className: "h-7 px-2 text-xs-tight"
350
+ }
351
+ ) : /* @__PURE__ */ jsx(
352
+ ThreadActionButton,
353
+ {
354
+ agentId: "action-delete-thread",
355
+ label: t("codingagenttaskspanel.delete", {
356
+ defaultValue: "Delete"
357
+ }),
358
+ description: "Delete (archive) the selected task thread",
359
+ variant: "secondary",
360
+ disabled: busy,
361
+ onClick: onDelete,
362
+ className: "h-7 px-2 text-xs-tight text-danger hover:bg-danger/10"
363
+ }
364
+ ) })
365
+ ] });
366
+ }
367
+ function threadChips(thread, t, locale) {
368
+ const kindLabel = thread.kind ? formatThreadKind(thread.kind, t) : null;
369
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
370
+ thread.sessionCount > 0 ? /* @__PURE__ */ jsx(TaskMetaChip, { icon: /* @__PURE__ */ jsx(Bot, { className: "h-3 w-3" }), children: t("codingagenttaskspanel.sessionsCount", {
371
+ defaultValue: "{{count}} sessions",
372
+ count: thread.sessionCount
373
+ }) }) : null,
374
+ thread.decisionCount > 0 ? /* @__PURE__ */ jsx(TaskMetaChip, { icon: /* @__PURE__ */ jsx(ListChecks, { className: "h-3 w-3" }), children: t("codingagenttaskspanel.decisionsCount", {
375
+ defaultValue: "{{count}} decisions",
376
+ count: thread.decisionCount
377
+ }) }) : null,
378
+ kindLabel ? /* @__PURE__ */ jsx(TaskMetaChip, { icon: /* @__PURE__ */ jsx(Terminal, { className: "h-3 w-3" }), children: kindLabel }) : null,
379
+ /* @__PURE__ */ jsx("span", { className: "text-2xs text-muted/80", children: formatIsoTime(thread.updatedAt, locale, t) })
380
+ ] });
381
+ }
382
+ function ThreadDetailPane({
383
+ thread,
384
+ detail,
385
+ detailLoading,
386
+ busy,
387
+ onBack,
388
+ onDelete,
389
+ onReopen,
390
+ t,
391
+ locale
392
+ }) {
393
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-testid": "task-detail-pane", children: [
394
+ /* @__PURE__ */ jsx(
395
+ BackChip,
396
+ {
397
+ label: t("codingagenttaskspanel.backToTasks", {
398
+ defaultValue: "Tasks"
399
+ }),
400
+ onClick: onBack,
401
+ testId: "task-detail-back"
402
+ }
403
+ ),
404
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-2xl bg-bg-accent/20 p-3", children: [
405
+ /* @__PURE__ */ jsx(TaskStatusMedallion, { status: thread.status }),
406
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
407
+ /* @__PURE__ */ jsx("div", { className: "truncate text-sm font-semibold text-txt-strong", children: thread.title }),
408
+ thread.originalRequest ? /* @__PURE__ */ jsx("div", { className: "mt-0.5 line-clamp-2 text-xs text-muted", children: thread.originalRequest }) : null
409
+ ] })
410
+ ] }),
411
+ !detail && detailLoading ? /* @__PURE__ */ jsx("div", { className: "text-xs-tight text-muted", children: t("common.loading", { defaultValue: "Loading\u2026" }) }) : detail ? /* @__PURE__ */ jsx(
412
+ ThreadDetailContent,
413
+ {
414
+ detail,
415
+ busy,
416
+ onDelete,
417
+ onReopen,
418
+ t,
419
+ locale
420
+ }
421
+ ) : null
422
+ ] });
423
+ }
424
+ function CodingAgentTasksPanel(_props = {}) {
425
+ const { t: appT, uiLanguage: appUiLanguage } = useAppSelectorShallow((s) => ({
426
+ t: s.t,
427
+ uiLanguage: s.uiLanguage
428
+ }));
429
+ const t = appT ?? fallbackTranslate;
430
+ const uiLanguage = typeof appUiLanguage === "string" ? appUiLanguage : void 0;
431
+ const [threads, setThreads] = useState([]);
432
+ const [selectedThreadId, setSelectedThreadId] = useState(null);
433
+ const [selectedThread, setSelectedThread] = useState(null);
434
+ const [showArchived, setShowArchived] = useState(false);
435
+ const [search, setSearch] = useState("");
436
+ const [loading, setLoading] = useState(true);
437
+ const [mutating, setMutating] = useState(false);
438
+ const [loadError, setLoadError] = useState(null);
439
+ const [detailError, setDetailError] = useState(null);
440
+ const [mutationError, setMutationError] = useState(null);
441
+ const deferredSearch = useDeferredValue(search.trim());
442
+ const selectedThreadSummary = useMemo(
443
+ () => threads.find((thread) => thread.id === selectedThreadId) ?? null,
444
+ [selectedThreadId, threads]
445
+ );
446
+ const searchLabel = t("codingagenttaskspanel.searchPlaceholder", {
447
+ defaultValue: "Search tasks"
448
+ });
449
+ const showArchivedLabel = t("codingagenttaskspanel.showArchived", {
450
+ defaultValue: "Show archived"
451
+ });
452
+ const { ref: searchRef, agentProps: searchAgentProps } = useAgentElement({
453
+ id: "input-search-tasks",
454
+ role: "text-input",
455
+ label: searchLabel,
456
+ group: "task-filters",
457
+ description: "Filter task threads by title or request text"
458
+ });
459
+ const { ref: archivedRef, agentProps: archivedAgentProps } = useAgentElement({
460
+ id: "toggle-show-archived",
461
+ role: "toggle",
462
+ label: showArchivedLabel,
463
+ group: "task-filters",
464
+ status: showArchived ? "active" : "inactive",
465
+ description: "Toggle showing archived tasks",
466
+ onActivate: () => setShowArchived((value) => !value)
467
+ });
468
+ useEffect(() => {
469
+ let cancelled = false;
470
+ const refreshThreads = async (silent = false) => {
471
+ if (!silent) {
472
+ setLoading(true);
473
+ }
474
+ try {
475
+ const nextThreads = await client.listCodingAgentTaskThreads({
476
+ includeArchived: showArchived,
477
+ search: deferredSearch || void 0,
478
+ limit: 30
479
+ });
480
+ if (cancelled) return;
481
+ setLoadError(null);
482
+ setMutationError(null);
483
+ setThreads(nextThreads);
484
+ setSelectedThreadId((current) => {
485
+ if (current === null) return null;
486
+ if (nextThreads.some((thread) => thread.id === current)) {
487
+ return current;
488
+ }
489
+ return null;
490
+ });
491
+ } catch (error) {
492
+ if (cancelled) return;
493
+ if (error instanceof ApiError && error.status === 404) {
494
+ setLoadError(null);
495
+ setThreads([]);
496
+ setSelectedThreadId(null);
497
+ setSelectedThread(null);
498
+ return;
499
+ }
500
+ if (!silent) {
501
+ setLoadError(
502
+ getClientErrorMessage(
503
+ error,
504
+ t("codingagenttaskspanel.unknown", {
505
+ defaultValue: "Unknown"
506
+ })
507
+ )
508
+ );
509
+ }
510
+ if (!silent) {
511
+ setThreads([]);
512
+ setSelectedThreadId(null);
513
+ setSelectedThread(null);
514
+ }
515
+ } finally {
516
+ if (!cancelled && !silent) {
517
+ setLoading(false);
518
+ }
519
+ }
520
+ };
521
+ void refreshThreads(false);
522
+ const timer = setInterval(() => {
523
+ void refreshThreads(true);
524
+ }, 5e3);
525
+ return () => {
526
+ cancelled = true;
527
+ clearInterval(timer);
528
+ };
529
+ }, [deferredSearch, showArchived, t]);
530
+ useEffect(() => {
531
+ let cancelled = false;
532
+ if (!selectedThreadId) {
533
+ setDetailError(null);
534
+ setSelectedThread(null);
535
+ return;
536
+ }
537
+ const loadDetail = async () => {
538
+ try {
539
+ const expectedUpdatedAt = selectedThreadSummary?.updatedAt ?? null;
540
+ const detail = await client.getCodingAgentTaskThread(selectedThreadId);
541
+ if (cancelled) return;
542
+ setDetailError(null);
543
+ setSelectedThread((current) => {
544
+ if (current && detail && expectedUpdatedAt && current.updatedAt === expectedUpdatedAt && current.id === detail.id) {
545
+ return current;
546
+ }
547
+ return detail;
548
+ });
549
+ } catch (error) {
550
+ if (cancelled) return;
551
+ setDetailError(
552
+ getClientErrorMessage(
553
+ error,
554
+ t("codingagenttaskspanel.unknown", {
555
+ defaultValue: "Unknown"
556
+ })
557
+ )
558
+ );
559
+ setSelectedThread(null);
560
+ }
561
+ };
562
+ void loadDetail();
563
+ return () => {
564
+ cancelled = true;
565
+ };
566
+ }, [selectedThreadId, selectedThreadSummary?.updatedAt, t]);
567
+ const handleDelete = async () => {
568
+ if (!selectedThread) return;
569
+ setMutating(true);
570
+ setMutationError(null);
571
+ try {
572
+ await client.archiveCodingAgentTaskThread(selectedThread.id);
573
+ const nextThreads = await client.listCodingAgentTaskThreads({
574
+ includeArchived: showArchived,
575
+ search: deferredSearch || void 0,
576
+ limit: 30
577
+ });
578
+ setLoadError(null);
579
+ setDetailError(null);
580
+ setMutationError(null);
581
+ setThreads(nextThreads);
582
+ setSelectedThreadId(nextThreads[0]?.id ?? null);
583
+ } catch (error) {
584
+ setMutationError(
585
+ t("codingagenttaskspanel.deleteFailed", {
586
+ defaultValue: error instanceof Error ? "Failed to delete task: {{error}}" : "Failed to delete task.",
587
+ error: error instanceof Error ? error.message : void 0
588
+ })
589
+ );
590
+ } finally {
591
+ setMutating(false);
592
+ }
593
+ };
594
+ const handleReopen = async () => {
595
+ if (!selectedThread) return;
596
+ setMutating(true);
597
+ setMutationError(null);
598
+ try {
599
+ await client.reopenCodingAgentTaskThread(selectedThread.id);
600
+ const nextThreads = await client.listCodingAgentTaskThreads({
601
+ includeArchived: false,
602
+ search: deferredSearch || void 0,
603
+ limit: 30
604
+ });
605
+ setLoadError(null);
606
+ setDetailError(null);
607
+ setMutationError(null);
608
+ setThreads(nextThreads);
609
+ setShowArchived(false);
610
+ setSelectedThreadId(nextThreads[0]?.id ?? null);
611
+ } catch (error) {
612
+ setMutationError(
613
+ t("codingagenttaskspanel.reopenFailed", {
614
+ defaultValue: error instanceof Error ? "Failed to reopen task: {{error}}" : "Failed to reopen task.",
615
+ error: error instanceof Error ? error.message : void 0
616
+ })
617
+ );
618
+ } finally {
619
+ setMutating(false);
620
+ }
621
+ };
622
+ const activeCount = threads.filter((t2) => t2.status === "active").length;
623
+ const doneCount = threads.filter((t2) => t2.status === "done").length;
624
+ if (selectedThreadId && selectedThreadSummary) {
625
+ return /* @__PURE__ */ jsxs(
626
+ "div",
627
+ {
628
+ className: "flex h-full min-h-0 w-full flex-col gap-3 overflow-y-auto bg-bg px-4 pb-28 pt-4 text-txt",
629
+ "data-testid": "task-coordinator-panel",
630
+ children: [
631
+ detailError ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-danger/30 bg-danger/10 px-2 py-1.5 text-xs text-danger", children: t("codingagenttaskspanel.loadTaskDetailFailed", {
632
+ defaultValue: "Failed to load task detail: {{error}}",
633
+ error: detailError
634
+ }) }) : null,
635
+ mutationError ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-danger/30 bg-danger/10 px-2 py-1.5 text-xs text-danger", children: mutationError }) : null,
636
+ /* @__PURE__ */ jsx(
637
+ ThreadDetailPane,
638
+ {
639
+ thread: selectedThreadSummary,
640
+ detail: selectedThread,
641
+ detailLoading: loading,
642
+ busy: mutating,
643
+ onBack: () => setSelectedThreadId(null),
644
+ onDelete: handleDelete,
645
+ onReopen: handleReopen,
646
+ t,
647
+ locale: uiLanguage
648
+ }
649
+ )
650
+ ]
651
+ }
652
+ );
653
+ }
654
+ return /* @__PURE__ */ jsxs(
655
+ "div",
656
+ {
657
+ className: "relative flex h-full min-h-0 w-full flex-col gap-3 overflow-y-auto bg-bg px-4 pb-28 pt-4 text-txt",
658
+ "data-testid": "task-coordinator-panel",
659
+ children: [
660
+ /* @__PURE__ */ jsx(
661
+ TaskListHeader,
662
+ {
663
+ icon: /* @__PURE__ */ jsx(ListChecks, { className: "h-5 w-5" }),
664
+ title: t("taskseventspanel.Tasks", { defaultValue: "Coding Tasks" }),
665
+ counts: /* @__PURE__ */ jsxs(Fragment, { children: [
666
+ /* @__PURE__ */ jsx(TaskCountChip, { value: threads.length, label: "total" }),
667
+ activeCount > 0 ? /* @__PURE__ */ jsx(TaskCountChip, { value: activeCount, label: "active", tone: "active" }) : null,
668
+ doneCount > 0 ? /* @__PURE__ */ jsx(TaskCountChip, { value: doneCount, label: "done", tone: "accent" }) : null
669
+ ] })
670
+ }
671
+ ),
672
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
673
+ /* @__PURE__ */ jsx(
674
+ TaskSearchInput,
675
+ {
676
+ value: search,
677
+ onChange: setSearch,
678
+ placeholder: searchLabel,
679
+ inputRef: searchRef,
680
+ agentProps: searchAgentProps
681
+ }
682
+ ),
683
+ /* @__PURE__ */ jsxs(
684
+ "button",
685
+ {
686
+ ref: archivedRef,
687
+ type: "button",
688
+ onClick: () => setShowArchived((value) => !value),
689
+ "aria-pressed": showArchived,
690
+ "data-testid": "task-show-archived",
691
+ className: `inline-flex h-9 items-center gap-2 rounded-xl border px-3 text-xs font-medium transition-colors ${showArchived ? "border-accent/40 bg-accent-subtle text-accent" : "border-border/50 bg-bg-accent/30 text-muted hover:text-txt"}`,
692
+ ...archivedAgentProps,
693
+ children: [
694
+ /* @__PURE__ */ jsx(Archive, { className: "h-3.5 w-3.5" }),
695
+ showArchivedLabel
696
+ ]
697
+ }
698
+ )
699
+ ] }),
700
+ loadError ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-danger/30 bg-danger/10 px-2 py-1.5 text-xs text-danger", children: t("codingagenttaskspanel.loadThreadsFailed", {
701
+ defaultValue: "Failed to load task threads: {{error}}",
702
+ error: loadError
703
+ }) }) : null,
704
+ mutationError ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-danger/30 bg-danger/10 px-2 py-1.5 text-xs text-danger", children: mutationError }) : null,
705
+ threads.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
706
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2.5", children: threads.map((thread) => /* @__PURE__ */ jsx(
707
+ TaskCard,
708
+ {
709
+ id: thread.id,
710
+ title: thread.title,
711
+ subtitle: thread.summary || thread.originalRequest,
712
+ status: thread.status,
713
+ chips: threadChips(thread, t, uiLanguage),
714
+ onOpen: setSelectedThreadId,
715
+ t
716
+ },
717
+ thread.id
718
+ )) }),
719
+ threads.length < 4 ? /* @__PURE__ */ jsx(SparseWatermark, { icon: ListChecks }) : null
720
+ ] }) : loading ? /* @__PURE__ */ jsx("div", { className: "text-sm text-muted", children: t("codingagenttaskspanel.loadingTasks", {
721
+ defaultValue: "Loading"
722
+ }) }) : /* @__PURE__ */ jsx(
723
+ TaskEmptyState,
724
+ {
725
+ title: t("codingagenttaskspanel.empty.title", {
726
+ defaultValue: "None"
727
+ }),
728
+ hint: t("codingagenttaskspanel.empty.hint", {
729
+ defaultValue: "Coding agents you dispatch will appear here with their sessions, decisions, and live console output."
730
+ })
731
+ }
732
+ )
733
+ ]
734
+ }
735
+ );
736
+ }
737
+ export {
738
+ CodingAgentTasksPanel
739
+ };
740
+ //# sourceMappingURL=CodingAgentTasksPanel.js.map