@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,1383 @@
1
+ import { ApiError as e, client as t } from "@elizaos/ui";
2
+ import { Button as n, Card as r, Divider as i, Field as a, HStack as o, List as s, SpatialSurface as c, Text as l, VStack as u } from "@elizaos/ui/spatial";
3
+ import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
4
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
5
+ //#region src/orchestrator-params.ts
6
+ function v(e) {
7
+ return typeof e == "string" && e.trim() ? e.trim() : void 0;
8
+ }
9
+ function y(e) {
10
+ return e === "low" || e === "normal" || e === "high" || e === "urgent" ? e : void 0;
11
+ }
12
+ function b(e) {
13
+ if (!Array.isArray(e)) return;
14
+ let t = e.filter((e) => typeof e == "string" && e.trim() !== "");
15
+ return t.length > 0 ? t.map((e) => e.trim()) : void 0;
16
+ }
17
+ function x(e) {
18
+ let t = v(e?.taskId);
19
+ if (!t) throw Error("taskId is required for this capability.");
20
+ return t;
21
+ }
22
+ //#endregion
23
+ //#region src/orchestrator-capabilities.ts
24
+ var S = new Set([
25
+ "orchestrator-status",
26
+ "orchestrator-list-tasks",
27
+ "orchestrator-open-task",
28
+ "orchestrator-create-task",
29
+ "orchestrator-pause-task",
30
+ "orchestrator-resume-task",
31
+ "orchestrator-pause-all",
32
+ "orchestrator-resume-all",
33
+ "orchestrator-delete-task",
34
+ "orchestrator-fork-task",
35
+ "orchestrator-update-task",
36
+ "orchestrator-validate-task",
37
+ "orchestrator-add-agent",
38
+ "orchestrator-stop-agent",
39
+ "orchestrator-send-message"
40
+ ]);
41
+ async function C(e, n) {
42
+ switch (e) {
43
+ case "orchestrator-status": return t.getOrchestratorStatus();
44
+ case "orchestrator-list-tasks": return t.listCodingAgentTaskThreads({
45
+ includeArchived: n?.includeArchived === !0,
46
+ status: v(n?.status),
47
+ search: v(n?.search),
48
+ limit: typeof n?.limit == "number" ? n.limit : 100
49
+ });
50
+ case "orchestrator-open-task": {
51
+ let e = v(n?.taskId);
52
+ if (e) return t.getCodingAgentTaskThread(e);
53
+ let [r] = await t.listCodingAgentTaskThreads({ limit: 1 });
54
+ return r ? t.getCodingAgentTaskThread(r.id) : null;
55
+ }
56
+ case "orchestrator-create-task": {
57
+ let e = v(n?.title), r = v(n?.goal);
58
+ if (!e || !r) throw Error("title and goal are required to create a task.");
59
+ return t.createOrchestratorTask({
60
+ title: e,
61
+ goal: r,
62
+ originalRequest: v(n?.originalRequest),
63
+ kind: v(n?.kind),
64
+ priority: y(n?.priority),
65
+ acceptanceCriteria: b(n?.acceptanceCriteria)
66
+ });
67
+ }
68
+ case "orchestrator-pause-task": return t.pauseOrchestratorTask(x(n));
69
+ case "orchestrator-resume-task": return t.resumeOrchestratorTask(x(n));
70
+ case "orchestrator-pause-all": return { paused: await t.pauseAllOrchestratorTasks() };
71
+ case "orchestrator-resume-all": return { resumed: await t.resumeAllOrchestratorTasks() };
72
+ case "orchestrator-delete-task": return { deleted: await t.deleteOrchestratorTask(x(n)) };
73
+ case "orchestrator-fork-task": return t.forkOrchestratorTask(x(n), {
74
+ title: v(n?.title),
75
+ goal: v(n?.goal),
76
+ priority: y(n?.priority),
77
+ acceptanceCriteria: b(n?.acceptanceCriteria)
78
+ });
79
+ case "orchestrator-update-task": return t.updateOrchestratorTask(x(n), {
80
+ title: v(n?.title),
81
+ goal: v(n?.goal),
82
+ summary: v(n?.summary),
83
+ priority: y(n?.priority),
84
+ acceptanceCriteria: b(n?.acceptanceCriteria)
85
+ });
86
+ case "orchestrator-validate-task":
87
+ if (typeof n?.passed != "boolean") throw Error("passed (boolean) is required to validate a task.");
88
+ return t.validateOrchestratorTask(x(n), {
89
+ passed: n.passed,
90
+ summary: v(n?.summary),
91
+ evidence: v(n?.evidence),
92
+ verifier: v(n?.verifier),
93
+ humanOverride: n?.humanOverride === !0
94
+ });
95
+ case "orchestrator-add-agent": return t.addOrchestratorAgent(x(n), {
96
+ framework: v(n?.framework),
97
+ providerSource: v(n?.providerSource),
98
+ model: v(n?.model),
99
+ workdir: v(n?.workdir),
100
+ repo: v(n?.repo),
101
+ label: v(n?.label),
102
+ task: v(n?.task)
103
+ });
104
+ case "orchestrator-stop-agent": {
105
+ let e = v(n?.sessionId);
106
+ if (!e) throw Error("sessionId is required to stop an agent.");
107
+ return { stopped: await t.stopOrchestratorAgent(x(n), e) };
108
+ }
109
+ case "orchestrator-send-message": {
110
+ let e = v(n?.content);
111
+ if (!e) throw Error("content is required to send a message.");
112
+ return { sent: await t.postOrchestratorTaskMessage(x(n), e) };
113
+ }
114
+ default: throw Error(`Orchestrator view does not support "${e}".`);
115
+ }
116
+ }
117
+ //#endregion
118
+ //#region src/CodingAgentTasksPanel.interact.ts
119
+ async function w(e, n) {
120
+ if (S.has(e)) return C(e, n);
121
+ if (e === "list-sessions" || e === "refresh") return t.getCodingAgentStatus();
122
+ if (e === "list-task-threads") return t.listCodingAgentTaskThreads({
123
+ includeArchived: n?.includeArchived === !0,
124
+ search: typeof n?.search == "string" ? n.search : void 0,
125
+ limit: typeof n?.limit == "number" ? n.limit : 30
126
+ });
127
+ if (e === "open-thread") {
128
+ let e = typeof n?.threadId == "string" ? n.threadId.trim() : "";
129
+ if (e) return t.getCodingAgentTaskThread(e);
130
+ let [r] = await t.listCodingAgentTaskThreads({
131
+ includeArchived: !1,
132
+ limit: 1
133
+ });
134
+ return r ? t.getCodingAgentTaskThread(r.id) : null;
135
+ }
136
+ if (e === "stop-session") {
137
+ let e = typeof n?.sessionId == "string" ? n.sessionId.trim() : "";
138
+ return e ? t.stopCodingAgent(e) : {
139
+ stopped: !1,
140
+ reason: "sessionId is required to stop a coding agent session"
141
+ };
142
+ }
143
+ throw Error(`Task Coordinator TUI does not support "${e}".`);
144
+ }
145
+ //#endregion
146
+ //#region src/components/OrchestratorSpatialView.tsx
147
+ var T = {
148
+ open: "primary",
149
+ active: "success",
150
+ validating: "primary",
151
+ waiting_on_user: "warning",
152
+ blocked: "warning",
153
+ interrupted: "warning",
154
+ done: "success",
155
+ failed: "danger",
156
+ archived: "muted"
157
+ }, E = {
158
+ open: "o",
159
+ active: ">",
160
+ validating: "~",
161
+ waiting_on_user: "?",
162
+ blocked: "!",
163
+ interrupted: "!",
164
+ done: "+",
165
+ failed: "x",
166
+ archived: "."
167
+ }, D = {
168
+ low: "muted",
169
+ normal: "default",
170
+ high: "warning",
171
+ urgent: "danger"
172
+ }, O = {
173
+ pending: "muted",
174
+ active: "primary",
175
+ done: "success",
176
+ blocked: "danger"
177
+ }, k = {
178
+ pending: "[ ]",
179
+ active: "[>]",
180
+ done: "[x]",
181
+ blocked: "[!]"
182
+ }, ee = {
183
+ passed: "success",
184
+ failed: "danger",
185
+ pending: "warning",
186
+ unknown: "muted"
187
+ };
188
+ function A(e) {
189
+ return T[e] ?? "muted";
190
+ }
191
+ function j(e) {
192
+ return E[e] ?? ".";
193
+ }
194
+ function M(e) {
195
+ return e.replace(/_/g, " ");
196
+ }
197
+ function N(e) {
198
+ return e === 0 ? "$0" : e < 1 ? `$${e.toFixed(4)}` : `$${e.toFixed(2)}`;
199
+ }
200
+ function P(e) {
201
+ return e >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(1)}K` : String(e);
202
+ }
203
+ function F(e, t) {
204
+ return e.length <= t ? e : `${e.slice(0, Math.max(0, t - 1))}…`;
205
+ }
206
+ function te({ snapshot: e, onAction: t }) {
207
+ let n = (e) => () => t?.(e);
208
+ return e.detail ? /* @__PURE__ */ g(ie, {
209
+ detail: e.detail,
210
+ planSteps: e.planSteps,
211
+ pendingInputs: e.pendingInputs,
212
+ dispatch: n
213
+ }) : /* @__PURE__ */ g(ne, {
214
+ status: e.status,
215
+ threads: e.threads,
216
+ hasMore: e.hasMore,
217
+ loading: e.loading,
218
+ error: e.error,
219
+ dispatch: n
220
+ });
221
+ }
222
+ function ne({ status: e, threads: t, hasMore: a, loading: c, error: u, dispatch: d }) {
223
+ return /* @__PURE__ */ _(r, {
224
+ gap: 1,
225
+ padding: 1,
226
+ children: [
227
+ /* @__PURE__ */ _(o, {
228
+ gap: 1,
229
+ align: "center",
230
+ wrap: !0,
231
+ children: [/* @__PURE__ */ g(l, {
232
+ style: "caption",
233
+ tone: "muted",
234
+ grow: 1,
235
+ children: c ? "loading" : `${t.length} threads`
236
+ }), e ? /* @__PURE__ */ _(h, { children: [
237
+ /* @__PURE__ */ g(l, {
238
+ style: "caption",
239
+ tone: "success",
240
+ children: `${e.activeTaskCount} active`
241
+ }),
242
+ /* @__PURE__ */ g(l, {
243
+ style: "caption",
244
+ tone: "warning",
245
+ children: `${e.blockedTaskCount} blocked`
246
+ }),
247
+ /* @__PURE__ */ g(l, {
248
+ style: "caption",
249
+ tone: "muted",
250
+ children: `${e.sessionCount} sessions`
251
+ }),
252
+ /* @__PURE__ */ g(l, {
253
+ style: "caption",
254
+ tone: "primary",
255
+ children: N(e.usage.costUsd)
256
+ })
257
+ ] }) : null]
258
+ }),
259
+ u ? /* @__PURE__ */ g(l, {
260
+ tone: "danger",
261
+ style: "caption",
262
+ children: u
263
+ }) : null,
264
+ /* @__PURE__ */ _(o, {
265
+ gap: 1,
266
+ wrap: !0,
267
+ children: [
268
+ /* @__PURE__ */ g(n, {
269
+ variant: "outline",
270
+ tone: "default",
271
+ agent: "pause-all",
272
+ onPress: d("pause-all"),
273
+ children: "Pause all"
274
+ }),
275
+ /* @__PURE__ */ g(n, {
276
+ variant: "outline",
277
+ tone: "default",
278
+ agent: "resume-all",
279
+ onPress: d("resume-all"),
280
+ children: "Resume all"
281
+ }),
282
+ /* @__PURE__ */ g(n, {
283
+ variant: "ghost",
284
+ tone: "default",
285
+ agent: "refresh",
286
+ onPress: d("refresh"),
287
+ children: "Refresh"
288
+ })
289
+ ]
290
+ }),
291
+ /* @__PURE__ */ g(i, { label: "tasks" }),
292
+ t.length === 0 ? /* @__PURE__ */ g(l, {
293
+ tone: "muted",
294
+ align: "center",
295
+ style: "caption",
296
+ children: "None"
297
+ }) : /* @__PURE__ */ g(s, {
298
+ gap: 1,
299
+ children: t.map((e) => /* @__PURE__ */ g(re, {
300
+ thread: e,
301
+ dispatch: d
302
+ }, e.id))
303
+ }),
304
+ a ? /* @__PURE__ */ g(l, {
305
+ tone: "muted",
306
+ align: "center",
307
+ style: "caption",
308
+ children: "more…"
309
+ }) : null
310
+ ]
311
+ });
312
+ }
313
+ function re({ thread: e, dispatch: t }) {
314
+ return /* @__PURE__ */ _(u, {
315
+ gap: 0,
316
+ agent: `task-${e.id}`,
317
+ children: [/* @__PURE__ */ _(o, {
318
+ gap: 1,
319
+ align: "center",
320
+ children: [
321
+ /* @__PURE__ */ g(l, {
322
+ tone: A(e.status),
323
+ children: j(e.status)
324
+ }),
325
+ /* @__PURE__ */ g(l, {
326
+ bold: !0,
327
+ wrap: !1,
328
+ grow: 1,
329
+ children: e.title
330
+ }),
331
+ /* @__PURE__ */ g(l, {
332
+ style: "caption",
333
+ tone: D[e.priority],
334
+ children: e.priority
335
+ })
336
+ ]
337
+ }), /* @__PURE__ */ _(o, {
338
+ gap: 1,
339
+ align: "center",
340
+ wrap: !0,
341
+ children: [
342
+ /* @__PURE__ */ g(l, {
343
+ style: "caption",
344
+ tone: A(e.status),
345
+ children: M(e.status)
346
+ }),
347
+ /* @__PURE__ */ g(l, {
348
+ style: "caption",
349
+ tone: "muted",
350
+ children: `${e.activeSessionCount}/${e.sessionCount} sess`
351
+ }),
352
+ /* @__PURE__ */ g(l, {
353
+ style: "caption",
354
+ tone: "muted",
355
+ children: `${e.decisionCount} dec`
356
+ }),
357
+ /* @__PURE__ */ g(l, {
358
+ style: "caption",
359
+ tone: "muted",
360
+ children: P(e.usage.totalTokens)
361
+ }),
362
+ /* @__PURE__ */ g(l, {
363
+ style: "caption",
364
+ tone: "primary",
365
+ grow: 1,
366
+ children: N(e.usage.costUsd)
367
+ }),
368
+ /* @__PURE__ */ g(n, {
369
+ variant: "outline",
370
+ tone: "default",
371
+ agent: `open-${e.id}`,
372
+ onPress: t(`open:${e.id}`),
373
+ children: "Open"
374
+ })
375
+ ]
376
+ })]
377
+ });
378
+ }
379
+ function ie({ detail: e, planSteps: t, pendingInputs: i, dispatch: s }) {
380
+ let c = e.status === "done" || e.status === "failed" || e.status === "archived";
381
+ return /* @__PURE__ */ _(r, {
382
+ gap: 1,
383
+ padding: 1,
384
+ children: [
385
+ /* @__PURE__ */ _(o, {
386
+ gap: 1,
387
+ align: "center",
388
+ children: [
389
+ /* @__PURE__ */ g(n, {
390
+ variant: "ghost",
391
+ tone: "default",
392
+ agent: "back",
393
+ onPress: s("back"),
394
+ children: "< Back"
395
+ }),
396
+ /* @__PURE__ */ g(l, {
397
+ style: "caption",
398
+ tone: A(e.status),
399
+ grow: 1,
400
+ children: M(e.status)
401
+ }),
402
+ /* @__PURE__ */ g(l, {
403
+ style: "caption",
404
+ tone: D[e.priority],
405
+ children: e.priority
406
+ })
407
+ ]
408
+ }),
409
+ /* @__PURE__ */ g(l, {
410
+ style: "subheading",
411
+ bold: !0,
412
+ wrap: !0,
413
+ children: e.title
414
+ }),
415
+ e.goal ? /* @__PURE__ */ g(l, {
416
+ style: "caption",
417
+ tone: "muted",
418
+ wrap: !0,
419
+ children: F(e.goal, 200)
420
+ }) : null,
421
+ /* @__PURE__ */ _(o, {
422
+ gap: 1,
423
+ wrap: !0,
424
+ children: [
425
+ e.paused ? /* @__PURE__ */ g(n, {
426
+ agent: "resume",
427
+ onPress: s("resume"),
428
+ children: "Resume"
429
+ }) : /* @__PURE__ */ g(n, {
430
+ variant: "outline",
431
+ tone: "default",
432
+ agent: "pause",
433
+ onPress: s("pause"),
434
+ children: "Pause"
435
+ }),
436
+ /* @__PURE__ */ g(n, {
437
+ variant: "outline",
438
+ tone: "default",
439
+ agent: "validate",
440
+ onPress: s("validate"),
441
+ children: "Validate"
442
+ }),
443
+ c ? null : /* @__PURE__ */ _(h, { children: [
444
+ /* @__PURE__ */ g(n, {
445
+ variant: "outline",
446
+ tone: "default",
447
+ agent: "fork",
448
+ onPress: s("fork"),
449
+ children: "Fork"
450
+ }),
451
+ /* @__PURE__ */ g(n, {
452
+ variant: "outline",
453
+ tone: "default",
454
+ agent: "restart",
455
+ onPress: s("restart"),
456
+ children: "Restart"
457
+ }),
458
+ /* @__PURE__ */ g(n, {
459
+ variant: "outline",
460
+ tone: "default",
461
+ agent: "add-agent",
462
+ onPress: s("add-agent"),
463
+ children: "Add agent"
464
+ })
465
+ ] }),
466
+ /* @__PURE__ */ g(n, {
467
+ variant: "ghost",
468
+ tone: "default",
469
+ agent: "copy-link",
470
+ onPress: s("copy-link"),
471
+ children: "Copy link"
472
+ }),
473
+ e.status === "archived" ? /* @__PURE__ */ g(n, {
474
+ variant: "outline",
475
+ tone: "default",
476
+ agent: "reopen",
477
+ onPress: s("reopen"),
478
+ children: "Reopen"
479
+ }) : /* @__PURE__ */ g(n, {
480
+ variant: "ghost",
481
+ tone: "default",
482
+ agent: "archive",
483
+ onPress: s("archive"),
484
+ children: "Archive"
485
+ }),
486
+ /* @__PURE__ */ g(n, {
487
+ variant: "ghost",
488
+ tone: "danger",
489
+ agent: "delete",
490
+ onPress: s("delete"),
491
+ children: "Delete"
492
+ })
493
+ ]
494
+ }),
495
+ c ? null : /* @__PURE__ */ g(a, {
496
+ label: "priority",
497
+ kind: "select",
498
+ value: e.priority,
499
+ options: [
500
+ "low",
501
+ "normal",
502
+ "high",
503
+ "urgent"
504
+ ],
505
+ agent: "priority",
506
+ onChange: (e) => s(`priority:${e}`)()
507
+ }),
508
+ i.length > 0 ? /* @__PURE__ */ g(I, { inputs: i }) : null,
509
+ t.length > 0 ? /* @__PURE__ */ g(L, { steps: t }) : null,
510
+ /* @__PURE__ */ g(R, {
511
+ sessions: e.sessions,
512
+ dispatch: s
513
+ }),
514
+ e.decisions.length > 0 ? /* @__PURE__ */ g(z, { decisions: e.decisions }) : null,
515
+ e.artifacts.length > 0 ? /* @__PURE__ */ g(B, { artifacts: e.artifacts }) : null,
516
+ e.events.length > 0 ? /* @__PURE__ */ g(V, { events: e.events }) : null,
517
+ e.transcripts.length > 0 ? /* @__PURE__ */ g(H, { transcripts: e.transcripts }) : null
518
+ ]
519
+ });
520
+ }
521
+ function I({ inputs: e }) {
522
+ return /* @__PURE__ */ _(u, {
523
+ gap: 0,
524
+ children: [/* @__PURE__ */ g(i, { label: "awaiting you" }), /* @__PURE__ */ g(s, {
525
+ gap: 0,
526
+ children: e.slice(0, 4).map((e) => /* @__PURE__ */ _(u, {
527
+ gap: 0,
528
+ agent: `pending-${e.sessionId}`,
529
+ children: [/* @__PURE__ */ g(l, {
530
+ tone: "warning",
531
+ bold: !0,
532
+ wrap: !0,
533
+ children: F(e.promptText, 120)
534
+ }), e.recentOutput ? /* @__PURE__ */ g(l, {
535
+ style: "caption",
536
+ tone: "muted",
537
+ wrap: !1,
538
+ children: F(e.recentOutput, 80)
539
+ }) : null]
540
+ }, e.sessionId))
541
+ })]
542
+ });
543
+ }
544
+ function L({ steps: e }) {
545
+ return /* @__PURE__ */ _(u, {
546
+ gap: 0,
547
+ children: [/* @__PURE__ */ g(i, { label: "plan" }), /* @__PURE__ */ g(s, {
548
+ gap: 0,
549
+ children: e.slice(0, 10).map((e) => /* @__PURE__ */ _(o, {
550
+ gap: 1,
551
+ align: "center",
552
+ agent: `plan-${e.id}`,
553
+ children: [/* @__PURE__ */ g(l, {
554
+ tone: O[e.state],
555
+ children: k[e.state]
556
+ }), /* @__PURE__ */ g(l, {
557
+ grow: 1,
558
+ wrap: !1,
559
+ tone: e.state === "done" ? "muted" : "default",
560
+ children: e.label
561
+ })]
562
+ }, e.id))
563
+ })]
564
+ });
565
+ }
566
+ function R({ sessions: e, dispatch: t }) {
567
+ return /* @__PURE__ */ _(u, {
568
+ gap: 0,
569
+ children: [/* @__PURE__ */ g(i, { label: `sessions (${e.length})` }), e.length === 0 ? /* @__PURE__ */ g(l, {
570
+ tone: "muted",
571
+ align: "center",
572
+ style: "caption",
573
+ children: "None"
574
+ }) : /* @__PURE__ */ g(s, {
575
+ gap: 1,
576
+ children: e.slice(0, 8).map((e) => /* @__PURE__ */ _(u, {
577
+ gap: 0,
578
+ agent: `session-${e.sessionId}`,
579
+ children: [/* @__PURE__ */ _(o, {
580
+ gap: 1,
581
+ align: "center",
582
+ children: [
583
+ /* @__PURE__ */ g(l, {
584
+ tone: A(e.status),
585
+ children: j(e.status)
586
+ }),
587
+ /* @__PURE__ */ g(l, {
588
+ bold: !0,
589
+ wrap: !1,
590
+ grow: 1,
591
+ children: e.label
592
+ }),
593
+ /* @__PURE__ */ g(n, {
594
+ variant: "ghost",
595
+ tone: "danger",
596
+ agent: `stop-${e.sessionId}`,
597
+ onPress: t(`stop-session:${e.sessionId}`),
598
+ children: "Stop"
599
+ })
600
+ ]
601
+ }), /* @__PURE__ */ _(o, {
602
+ gap: 1,
603
+ align: "center",
604
+ wrap: !0,
605
+ children: [
606
+ /* @__PURE__ */ g(l, {
607
+ style: "caption",
608
+ tone: "muted",
609
+ children: e.framework
610
+ }),
611
+ e.model ? /* @__PURE__ */ g(l, {
612
+ style: "caption",
613
+ tone: "muted",
614
+ wrap: !1,
615
+ children: e.model
616
+ }) : null,
617
+ /* @__PURE__ */ g(l, {
618
+ style: "caption",
619
+ tone: "muted",
620
+ children: P(e.totalTokens)
621
+ }),
622
+ /* @__PURE__ */ g(l, {
623
+ style: "caption",
624
+ tone: "primary",
625
+ grow: 1,
626
+ children: N(e.costUsd)
627
+ }),
628
+ e.activeTool ? /* @__PURE__ */ g(l, {
629
+ style: "caption",
630
+ tone: "success",
631
+ wrap: !1,
632
+ children: e.activeTool
633
+ }) : null
634
+ ]
635
+ })]
636
+ }, e.id))
637
+ })]
638
+ });
639
+ }
640
+ function z({ decisions: e }) {
641
+ return /* @__PURE__ */ _(u, {
642
+ gap: 0,
643
+ children: [/* @__PURE__ */ g(i, { label: `decisions (${e.length})` }), /* @__PURE__ */ g(s, {
644
+ gap: 0,
645
+ children: e.slice(0, 6).map((e) => /* @__PURE__ */ _(o, {
646
+ gap: 1,
647
+ align: "center",
648
+ agent: `decision-${e.id}`,
649
+ children: [/* @__PURE__ */ g(l, {
650
+ tone: "primary",
651
+ wrap: !1,
652
+ children: e.decision
653
+ }), /* @__PURE__ */ g(l, {
654
+ grow: 1,
655
+ wrap: !1,
656
+ children: F(e.promptText, 100)
657
+ })]
658
+ }, e.id))
659
+ })]
660
+ });
661
+ }
662
+ function B({ artifacts: e }) {
663
+ return /* @__PURE__ */ _(u, {
664
+ gap: 0,
665
+ children: [/* @__PURE__ */ g(i, { label: `artifacts (${e.length})` }), /* @__PURE__ */ g(s, {
666
+ gap: 0,
667
+ children: e.slice(0, 6).map((e) => /* @__PURE__ */ _(o, {
668
+ gap: 1,
669
+ align: "center",
670
+ agent: `artifact-${e.id}`,
671
+ children: [
672
+ /* @__PURE__ */ g(l, {
673
+ tone: ee[e.verificationStatus],
674
+ wrap: !1,
675
+ children: e.verificationStatus === "passed" ? "+" : e.verificationStatus === "failed" ? "x" : e.verificationStatus === "pending" ? "~" : "."
676
+ }),
677
+ /* @__PURE__ */ g(l, {
678
+ grow: 1,
679
+ wrap: !1,
680
+ children: e.title
681
+ }),
682
+ /* @__PURE__ */ g(l, {
683
+ style: "caption",
684
+ tone: "muted",
685
+ wrap: !1,
686
+ children: e.artifactType
687
+ })
688
+ ]
689
+ }, e.id))
690
+ })]
691
+ });
692
+ }
693
+ function V({ events: e }) {
694
+ return /* @__PURE__ */ _(u, {
695
+ gap: 0,
696
+ children: [/* @__PURE__ */ g(i, { label: `events (${e.length})` }), /* @__PURE__ */ g(s, {
697
+ gap: 0,
698
+ children: e.slice(0, 6).map((e) => /* @__PURE__ */ _(o, {
699
+ gap: 1,
700
+ align: "center",
701
+ agent: `event-${e.id}`,
702
+ children: [/* @__PURE__ */ g(l, {
703
+ style: "caption",
704
+ tone: "muted",
705
+ wrap: !1,
706
+ children: e.eventType
707
+ }), /* @__PURE__ */ g(l, {
708
+ style: "caption",
709
+ grow: 1,
710
+ wrap: !1,
711
+ children: F(e.summary, 90)
712
+ })]
713
+ }, e.id))
714
+ })]
715
+ });
716
+ }
717
+ function H({ transcripts: e }) {
718
+ return /* @__PURE__ */ _(u, {
719
+ gap: 0,
720
+ children: [/* @__PURE__ */ g(i, { label: `transcript (${e.length})` }), /* @__PURE__ */ g(s, {
721
+ gap: 0,
722
+ children: e.slice(-6).map((e) => /* @__PURE__ */ g(l, {
723
+ style: "caption",
724
+ tone: e.direction === "stderr" ? "danger" : "muted",
725
+ wrap: !1,
726
+ children: F(e.content.replace(/\s+/g, " ").trim(), 110)
727
+ }, e.id))
728
+ })]
729
+ });
730
+ }
731
+ //#endregion
732
+ //#region src/OrchestratorView.tsx
733
+ var U = 30;
734
+ function W(e) {
735
+ if (!e) return [];
736
+ let t = Array.isArray(e.steps) ? e.steps : [], n = [];
737
+ for (let e of t) {
738
+ if (typeof e == "string" && e.trim()) {
739
+ n.push({
740
+ id: `step-${n.length}`,
741
+ label: e.trim(),
742
+ state: "pending"
743
+ });
744
+ continue;
745
+ }
746
+ if (e && typeof e == "object") {
747
+ let t = e, r = typeof t.title == "string" && t.title || typeof t.label == "string" && t.label || typeof t.description == "string" && t.description || null;
748
+ if (!r) continue;
749
+ let i = typeof t.status == "string" ? t.status : "";
750
+ n.push({
751
+ id: `step-${n.length}`,
752
+ label: r,
753
+ state: i === "done" || i === "complete" || i === "completed" ? "done" : i === "active" || i === "in_progress" || i === "running" ? "active" : i === "blocked" || i === "failed" ? "blocked" : "pending"
754
+ });
755
+ }
756
+ }
757
+ return n;
758
+ }
759
+ function G(e) {
760
+ return e instanceof Error ? e.message : String(e);
761
+ }
762
+ function K() {
763
+ typeof window > "u" || window.dispatchEvent(new CustomEvent("eliza:navigate:view", { detail: {
764
+ viewId: "orchestrator",
765
+ viewPath: "/orchestrator"
766
+ } }));
767
+ }
768
+ function q(e) {
769
+ if (typeof window > "u") return;
770
+ let t = `${window.location.origin}/orchestrator?task=${encodeURIComponent(e)}`;
771
+ navigator.clipboard?.writeText(t).catch(() => {});
772
+ }
773
+ function J() {
774
+ let [e, n] = m(null), [r, i] = m([]), [a, o] = m(!1), [s, l] = m(null), [u, h] = m(null), [_, v] = m(!1), [y, b] = m(null), x = d(async (e = !1) => {
775
+ e || v(!0);
776
+ try {
777
+ let [e, r] = await Promise.all([t.getOrchestratorStatus(), t.listCodingAgentTaskThreads({ limit: U })]);
778
+ n(e), i(r), o(r.length >= U), b(null);
779
+ } catch (t) {
780
+ e || (b(G(t)), n(null), i([]), o(!1));
781
+ } finally {
782
+ e || v(!1);
783
+ }
784
+ }, []), S = d(async (e) => {
785
+ try {
786
+ h(await t.getCodingAgentTaskThread(e)), b(null);
787
+ } catch (e) {
788
+ b(G(e)), h(null);
789
+ }
790
+ }, []), C = p(!1);
791
+ f(() => {
792
+ C.current || (C.current = !0, x(!1));
793
+ let e = setInterval(() => {
794
+ x(!0), s && S(s);
795
+ }, 5e3);
796
+ return () => clearInterval(e);
797
+ }, [
798
+ x,
799
+ S,
800
+ s
801
+ ]), f(() => {
802
+ if (!s) {
803
+ h(null);
804
+ return;
805
+ }
806
+ S(s);
807
+ }, [s, S]);
808
+ let w = d(async (e) => {
809
+ try {
810
+ await e(), await x(!0), s && await S(s);
811
+ } catch (e) {
812
+ b(G(e));
813
+ }
814
+ }, [
815
+ x,
816
+ S,
817
+ s
818
+ ]), T = d((e) => {
819
+ if (e.startsWith("open:")) {
820
+ l(e.slice(5));
821
+ return;
822
+ }
823
+ if (e.startsWith("stop-session:")) {
824
+ let n = e.slice(13);
825
+ s && w(() => t.stopOrchestratorAgent(s, n));
826
+ return;
827
+ }
828
+ if (e.startsWith("priority:")) {
829
+ let n = e.slice(9);
830
+ s && (n === "low" || n === "normal" || n === "high" || n === "urgent") && w(() => t.updateOrchestratorTask(s, { priority: n }));
831
+ return;
832
+ }
833
+ switch (e) {
834
+ case "refresh":
835
+ x(!1);
836
+ return;
837
+ case "pause-all":
838
+ w(() => t.pauseAllOrchestratorTasks());
839
+ return;
840
+ case "resume-all":
841
+ w(() => t.resumeAllOrchestratorTasks());
842
+ return;
843
+ case "back":
844
+ l(null);
845
+ return;
846
+ case "add-agent":
847
+ K();
848
+ return;
849
+ }
850
+ if (s) switch (e) {
851
+ case "pause":
852
+ w(() => t.pauseOrchestratorTask(s));
853
+ return;
854
+ case "resume":
855
+ w(() => t.resumeOrchestratorTask(s));
856
+ return;
857
+ case "validate":
858
+ w(() => t.validateOrchestratorTask(s, { passed: !0 }));
859
+ return;
860
+ case "fork":
861
+ w(() => t.forkOrchestratorTask(s));
862
+ return;
863
+ case "restart":
864
+ w(() => t.restartOrchestratorTask(s));
865
+ return;
866
+ case "delete":
867
+ w(async () => {
868
+ await t.deleteOrchestratorTask(s), l(null);
869
+ });
870
+ return;
871
+ case "archive":
872
+ w(async () => {
873
+ await t.archiveCodingAgentTaskThread(s), l(null);
874
+ });
875
+ return;
876
+ case "reopen":
877
+ w(() => t.reopenCodingAgentTaskThread(s));
878
+ return;
879
+ case "copy-link":
880
+ q(s);
881
+ return;
882
+ }
883
+ }, [
884
+ x,
885
+ w,
886
+ s
887
+ ]), E = u?.pendingDecisions ?? [];
888
+ return /* @__PURE__ */ g(c, { children: /* @__PURE__ */ g(te, {
889
+ snapshot: {
890
+ status: e,
891
+ threads: r,
892
+ hasMore: a,
893
+ detail: u,
894
+ planSteps: u ? W(u.currentPlan) : [],
895
+ pendingInputs: E,
896
+ loading: _,
897
+ error: y
898
+ },
899
+ onAction: T
900
+ }) });
901
+ }
902
+ //#endregion
903
+ //#region src/components/TaskCoordinatorSpatialView.tsx
904
+ var ae = {
905
+ open: "primary",
906
+ active: "success",
907
+ validating: "primary",
908
+ waiting_on_user: "warning",
909
+ blocked: "warning",
910
+ interrupted: "warning",
911
+ done: "success",
912
+ failed: "danger",
913
+ archived: "muted"
914
+ }, oe = {
915
+ open: "o",
916
+ active: ">",
917
+ validating: "~",
918
+ waiting_on_user: "?",
919
+ blocked: "!",
920
+ interrupted: "!",
921
+ done: "+",
922
+ failed: "x",
923
+ archived: "."
924
+ };
925
+ function Y(e) {
926
+ return ae[e] ?? "muted";
927
+ }
928
+ function se(e) {
929
+ return oe[e] ?? ".";
930
+ }
931
+ function X(e) {
932
+ return e.replace(/_/g, " ");
933
+ }
934
+ function Z(e, t) {
935
+ return e.length <= t ? e : `${e.slice(0, Math.max(0, t - 1))}…`;
936
+ }
937
+ function ce(e) {
938
+ return {
939
+ id: e.id,
940
+ title: e.title,
941
+ subtitle: e.summary || e.originalRequest || void 0,
942
+ status: e.status,
943
+ sessionCount: e.sessionCount,
944
+ decisionCount: e.decisionCount
945
+ };
946
+ }
947
+ function le({ snapshot: e, onAction: t }) {
948
+ let n = (e) => () => t?.(e);
949
+ return e.detail ? /* @__PURE__ */ g(fe, {
950
+ detail: e.detail,
951
+ dispatch: n,
952
+ onAction: t
953
+ }) : /* @__PURE__ */ g(ue, {
954
+ threads: e.threads,
955
+ showArchived: e.showArchived,
956
+ search: e.search,
957
+ loading: e.loading,
958
+ error: e.error,
959
+ dispatch: n,
960
+ onAction: t
961
+ });
962
+ }
963
+ function ue({ threads: e, showArchived: t, search: c, loading: u, error: d, dispatch: f, onAction: p }) {
964
+ let m = e.filter((e) => e.status === "active").length, h = e.filter((e) => e.status === "done").length;
965
+ return /* @__PURE__ */ _(r, {
966
+ gap: 1,
967
+ padding: 1,
968
+ children: [
969
+ /* @__PURE__ */ _(o, {
970
+ gap: 1,
971
+ align: "center",
972
+ wrap: !0,
973
+ children: [
974
+ /* @__PURE__ */ g(l, {
975
+ style: "caption",
976
+ tone: "muted",
977
+ grow: 1,
978
+ children: u ? "loading" : `${e.length} total`
979
+ }),
980
+ m > 0 ? /* @__PURE__ */ g(l, {
981
+ style: "caption",
982
+ tone: "success",
983
+ children: `${m} active`
984
+ }) : null,
985
+ h > 0 ? /* @__PURE__ */ g(l, {
986
+ style: "caption",
987
+ tone: "primary",
988
+ children: `${h} done`
989
+ }) : null
990
+ ]
991
+ }),
992
+ d ? /* @__PURE__ */ g(l, {
993
+ tone: "danger",
994
+ style: "caption",
995
+ children: d
996
+ }) : null,
997
+ /* @__PURE__ */ _(o, {
998
+ gap: 1,
999
+ align: "center",
1000
+ wrap: !0,
1001
+ children: [
1002
+ /* @__PURE__ */ g(a, {
1003
+ placeholder: "Search tasks",
1004
+ value: c,
1005
+ agent: "search",
1006
+ grow: 1,
1007
+ onChange: (e) => p?.(`search:${e}`)
1008
+ }),
1009
+ /* @__PURE__ */ g(n, {
1010
+ variant: t ? "solid" : "outline",
1011
+ tone: "default",
1012
+ agent: "toggle-archived",
1013
+ onPress: f("toggle-archived"),
1014
+ children: t ? "Hide archived" : "Show archived"
1015
+ }),
1016
+ /* @__PURE__ */ g(n, {
1017
+ variant: "ghost",
1018
+ tone: "default",
1019
+ agent: "refresh",
1020
+ onPress: f("refresh"),
1021
+ children: "Refresh"
1022
+ })
1023
+ ]
1024
+ }),
1025
+ /* @__PURE__ */ g(i, { label: "tasks" }),
1026
+ e.length === 0 ? /* @__PURE__ */ g(l, {
1027
+ tone: "muted",
1028
+ align: "center",
1029
+ style: "caption",
1030
+ children: u ? "Loading" : "None"
1031
+ }) : /* @__PURE__ */ g(s, {
1032
+ gap: 1,
1033
+ children: e.map((e) => /* @__PURE__ */ g(de, {
1034
+ thread: e,
1035
+ dispatch: f
1036
+ }, e.id))
1037
+ })
1038
+ ]
1039
+ });
1040
+ }
1041
+ function de({ thread: e, dispatch: t }) {
1042
+ return /* @__PURE__ */ _(u, {
1043
+ gap: 0,
1044
+ agent: `task-${e.id}`,
1045
+ children: [/* @__PURE__ */ _(o, {
1046
+ gap: 1,
1047
+ align: "center",
1048
+ children: [
1049
+ /* @__PURE__ */ g(l, {
1050
+ tone: Y(e.status),
1051
+ children: se(e.status)
1052
+ }),
1053
+ /* @__PURE__ */ g(l, {
1054
+ bold: !0,
1055
+ wrap: !1,
1056
+ grow: 1,
1057
+ children: e.title
1058
+ }),
1059
+ /* @__PURE__ */ g(n, {
1060
+ variant: "outline",
1061
+ tone: "default",
1062
+ agent: `open-${e.id}`,
1063
+ onPress: t(`open:${e.id}`),
1064
+ children: "Open"
1065
+ })
1066
+ ]
1067
+ }), /* @__PURE__ */ _(o, {
1068
+ gap: 1,
1069
+ align: "center",
1070
+ wrap: !0,
1071
+ children: [
1072
+ /* @__PURE__ */ g(l, {
1073
+ style: "caption",
1074
+ tone: Y(e.status),
1075
+ children: X(e.status)
1076
+ }),
1077
+ e.sessionCount > 0 ? /* @__PURE__ */ g(l, {
1078
+ style: "caption",
1079
+ tone: "muted",
1080
+ children: `${e.sessionCount} sess`
1081
+ }) : null,
1082
+ e.decisionCount > 0 ? /* @__PURE__ */ g(l, {
1083
+ style: "caption",
1084
+ tone: "muted",
1085
+ children: `${e.decisionCount} dec`
1086
+ }) : null,
1087
+ e.subtitle ? /* @__PURE__ */ g(l, {
1088
+ style: "caption",
1089
+ tone: "muted",
1090
+ grow: 1,
1091
+ wrap: !1,
1092
+ children: Z(e.subtitle, 80)
1093
+ }) : null
1094
+ ]
1095
+ })]
1096
+ });
1097
+ }
1098
+ function fe({ detail: e, dispatch: t }) {
1099
+ return /* @__PURE__ */ _(r, {
1100
+ gap: 1,
1101
+ padding: 1,
1102
+ children: [
1103
+ /* @__PURE__ */ _(o, {
1104
+ gap: 1,
1105
+ align: "center",
1106
+ children: [/* @__PURE__ */ g(n, {
1107
+ variant: "ghost",
1108
+ tone: "default",
1109
+ agent: "back",
1110
+ onPress: t("back"),
1111
+ children: "< Tasks"
1112
+ }), /* @__PURE__ */ g(l, {
1113
+ style: "caption",
1114
+ tone: Y(e.status),
1115
+ grow: 1,
1116
+ children: X(e.status)
1117
+ })]
1118
+ }),
1119
+ /* @__PURE__ */ g(l, {
1120
+ style: "subheading",
1121
+ bold: !0,
1122
+ wrap: !0,
1123
+ children: e.title
1124
+ }),
1125
+ e.originalRequest ? /* @__PURE__ */ g(l, {
1126
+ style: "caption",
1127
+ tone: "muted",
1128
+ wrap: !0,
1129
+ children: Z(e.originalRequest, 200)
1130
+ }) : null,
1131
+ /* @__PURE__ */ g(o, {
1132
+ gap: 1,
1133
+ wrap: !0,
1134
+ children: e.status === "archived" ? /* @__PURE__ */ g(n, {
1135
+ agent: "reopen-thread",
1136
+ onPress: t("reopen-thread"),
1137
+ children: "Reopen"
1138
+ }) : /* @__PURE__ */ g(n, {
1139
+ variant: "ghost",
1140
+ tone: "danger",
1141
+ agent: "delete-thread",
1142
+ onPress: t("delete-thread"),
1143
+ children: "Delete"
1144
+ })
1145
+ }),
1146
+ e.acceptanceCriteria.length > 0 ? /* @__PURE__ */ g(pe, { criteria: e.acceptanceCriteria }) : null,
1147
+ /* @__PURE__ */ g(me, { sessions: e.sessions }),
1148
+ e.artifacts.length > 0 ? /* @__PURE__ */ g(Q, { artifacts: e.artifacts }) : null,
1149
+ e.decisions.length > 0 ? /* @__PURE__ */ g(he, { decisions: e.decisions }) : null,
1150
+ e.events.length > 0 ? /* @__PURE__ */ g(ge, { events: e.events }) : null
1151
+ ]
1152
+ });
1153
+ }
1154
+ function pe({ criteria: e }) {
1155
+ return /* @__PURE__ */ _(u, {
1156
+ gap: 0,
1157
+ children: [/* @__PURE__ */ g(i, { label: "acceptance" }), /* @__PURE__ */ g(s, {
1158
+ gap: 0,
1159
+ children: e.slice(0, 8).map((e) => /* @__PURE__ */ g(l, {
1160
+ style: "caption",
1161
+ wrap: !0,
1162
+ children: Z(e, 110)
1163
+ }, e))
1164
+ })]
1165
+ });
1166
+ }
1167
+ function me({ sessions: e }) {
1168
+ return /* @__PURE__ */ _(u, {
1169
+ gap: 0,
1170
+ children: [/* @__PURE__ */ g(i, { label: `sessions (${e.length})` }), e.length === 0 ? /* @__PURE__ */ g(l, {
1171
+ tone: "muted",
1172
+ align: "center",
1173
+ style: "caption",
1174
+ children: "None"
1175
+ }) : /* @__PURE__ */ g(s, {
1176
+ gap: 0,
1177
+ children: e.slice(-6).reverse().map((e) => /* @__PURE__ */ _(u, {
1178
+ gap: 0,
1179
+ agent: `session-${e.id}`,
1180
+ children: [/* @__PURE__ */ g(l, {
1181
+ bold: !0,
1182
+ wrap: !1,
1183
+ children: e.label
1184
+ }), /* @__PURE__ */ _(o, {
1185
+ gap: 1,
1186
+ align: "center",
1187
+ wrap: !0,
1188
+ children: [
1189
+ /* @__PURE__ */ g(l, {
1190
+ style: "caption",
1191
+ tone: Y(e.status),
1192
+ children: X(e.status)
1193
+ }),
1194
+ /* @__PURE__ */ g(l, {
1195
+ style: "caption",
1196
+ tone: "muted",
1197
+ children: e.framework
1198
+ }),
1199
+ /* @__PURE__ */ g(l, {
1200
+ style: "caption",
1201
+ tone: "muted",
1202
+ grow: 1,
1203
+ wrap: !1,
1204
+ children: e.workdir || e.repo || "no workspace"
1205
+ })
1206
+ ]
1207
+ })]
1208
+ }, e.id))
1209
+ })]
1210
+ });
1211
+ }
1212
+ function Q({ artifacts: e }) {
1213
+ return /* @__PURE__ */ _(u, {
1214
+ gap: 0,
1215
+ children: [/* @__PURE__ */ g(i, { label: `artifacts (${e.length})` }), /* @__PURE__ */ g(s, {
1216
+ gap: 0,
1217
+ children: e.slice(-6).reverse().map((e) => /* @__PURE__ */ _(o, {
1218
+ gap: 1,
1219
+ align: "center",
1220
+ agent: `artifact-${e.id}`,
1221
+ children: [/* @__PURE__ */ g(l, {
1222
+ grow: 1,
1223
+ wrap: !1,
1224
+ children: e.title
1225
+ }), /* @__PURE__ */ g(l, {
1226
+ style: "caption",
1227
+ tone: "muted",
1228
+ wrap: !1,
1229
+ children: e.artifactType
1230
+ })]
1231
+ }, e.id))
1232
+ })]
1233
+ });
1234
+ }
1235
+ function he({ decisions: e }) {
1236
+ return /* @__PURE__ */ _(u, {
1237
+ gap: 0,
1238
+ children: [/* @__PURE__ */ g(i, { label: `decisions (${e.length})` }), /* @__PURE__ */ g(s, {
1239
+ gap: 0,
1240
+ children: e.slice(-6).reverse().map((e) => /* @__PURE__ */ _(o, {
1241
+ gap: 1,
1242
+ align: "center",
1243
+ agent: `decision-${e.id}`,
1244
+ children: [/* @__PURE__ */ g(l, {
1245
+ tone: "primary",
1246
+ wrap: !1,
1247
+ children: e.decision
1248
+ }), /* @__PURE__ */ g(l, {
1249
+ grow: 1,
1250
+ wrap: !1,
1251
+ children: Z(e.reasoning || e.promptText, 100)
1252
+ })]
1253
+ }, e.id))
1254
+ })]
1255
+ });
1256
+ }
1257
+ function ge({ events: e }) {
1258
+ return /* @__PURE__ */ _(u, {
1259
+ gap: 0,
1260
+ children: [/* @__PURE__ */ g(i, { label: `events (${e.length})` }), /* @__PURE__ */ g(s, {
1261
+ gap: 0,
1262
+ children: e.slice(-6).reverse().map((e) => /* @__PURE__ */ _(o, {
1263
+ gap: 1,
1264
+ align: "center",
1265
+ agent: `event-${e.id}`,
1266
+ children: [/* @__PURE__ */ g(l, {
1267
+ style: "caption",
1268
+ tone: "muted",
1269
+ wrap: !1,
1270
+ children: e.eventType.replace(/_/g, " ")
1271
+ }), /* @__PURE__ */ g(l, {
1272
+ style: "caption",
1273
+ grow: 1,
1274
+ wrap: !1,
1275
+ children: Z(e.summary, 90)
1276
+ })]
1277
+ }, e.id))
1278
+ })]
1279
+ });
1280
+ }
1281
+ //#endregion
1282
+ //#region src/TaskCoordinatorView.tsx
1283
+ var _e = 30;
1284
+ function $(e) {
1285
+ return e instanceof Error ? e.message : String(e);
1286
+ }
1287
+ function ve() {
1288
+ let [n, r] = m([]), [i, a] = m(null), [o, s] = m(null), [l, u] = m(!1), [h, _] = m(""), [v, y] = m(!0), [b, x] = m(null), S = d(async (n = !1) => {
1289
+ n || y(!0);
1290
+ try {
1291
+ let e = await t.listCodingAgentTaskThreads({
1292
+ includeArchived: l,
1293
+ search: h.trim() || void 0,
1294
+ limit: _e
1295
+ });
1296
+ r(e), x(null), a((t) => (t && e.some((e) => e.id === t), t));
1297
+ } catch (t) {
1298
+ if (t instanceof e && t.status === 404) {
1299
+ r([]), x(null);
1300
+ return;
1301
+ }
1302
+ n || (x($(t)), r([]));
1303
+ } finally {
1304
+ n || y(!1);
1305
+ }
1306
+ }, [l, h]), C = d(async (e) => {
1307
+ try {
1308
+ s(await t.getCodingAgentTaskThread(e)), x(null);
1309
+ } catch (e) {
1310
+ x($(e)), s(null);
1311
+ }
1312
+ }, []), w = p(!1);
1313
+ f(() => {
1314
+ w.current = !0, S(!1);
1315
+ let e = setInterval(() => {
1316
+ S(!0), i && C(i);
1317
+ }, 5e3);
1318
+ return () => clearInterval(e);
1319
+ }, [
1320
+ S,
1321
+ C,
1322
+ i
1323
+ ]), f(() => {
1324
+ if (!i) {
1325
+ s(null);
1326
+ return;
1327
+ }
1328
+ C(i);
1329
+ }, [i, C]);
1330
+ let T = d(async (e) => {
1331
+ try {
1332
+ await e(), a(null), await S(!0);
1333
+ } catch (e) {
1334
+ x($(e));
1335
+ }
1336
+ }, [S]), E = d((e) => {
1337
+ if (e.startsWith("open:")) {
1338
+ a(e.slice(5));
1339
+ return;
1340
+ }
1341
+ if (e.startsWith("search:")) {
1342
+ _(e.slice(7));
1343
+ return;
1344
+ }
1345
+ switch (e) {
1346
+ case "toggle-archived":
1347
+ u((e) => !e);
1348
+ return;
1349
+ case "refresh":
1350
+ S(!1);
1351
+ return;
1352
+ case "back":
1353
+ a(null);
1354
+ return;
1355
+ case "delete-thread":
1356
+ i && T(() => t.archiveCodingAgentTaskThread(i));
1357
+ return;
1358
+ case "reopen-thread":
1359
+ i && (u(!1), T(() => t.reopenCodingAgentTaskThread(i)));
1360
+ return;
1361
+ }
1362
+ }, [
1363
+ S,
1364
+ T,
1365
+ i
1366
+ ]);
1367
+ return /* @__PURE__ */ g(c, { children: /* @__PURE__ */ g(le, {
1368
+ snapshot: {
1369
+ threads: n.map(ce),
1370
+ selectedThreadId: i,
1371
+ detail: o,
1372
+ showArchived: l,
1373
+ search: h,
1374
+ loading: v,
1375
+ error: b
1376
+ },
1377
+ onAction: E
1378
+ }) });
1379
+ }
1380
+ //#endregion
1381
+ export { J as OrchestratorView, ve as TaskCoordinatorView, w as interact };
1382
+
1383
+ //# sourceMappingURL=bundle.js.map