@qwen-code/web-shell 0.24.6 → 0.24.7-nightly.20260929.b906f937ec
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.
- package/README.md +10 -0
- package/dist/ThreadsRoute-DIWrKAvJ.js +1726 -0
- package/dist/daemon-react-sdk.js +1 -1
- package/dist/index-BQmwkK6l.js +121229 -0
- package/dist/index.js +69 -118171
- package/dist/sw.js +1 -1
- package/dist/{toolNames-C6S4xtsA.js → toolNames-C6G4mcM3.js} +5485 -4631
- package/dist/transcript.js +9384 -9198
- package/dist/types/adapters/messageTypes.d.ts +11 -0
- package/dist/types/components/BranchPickerPopover.d.ts +2 -1
- package/dist/types/components/ChatEditor.d.ts +1 -0
- package/dist/types/components/DesktopRelayControl.d.ts +51 -0
- package/dist/types/components/MessageList.d.ts +1 -0
- package/dist/types/components/agents/AgentCreatePage.d.ts +10 -1
- package/dist/types/components/agents/AgentsManagerPage.d.ts +5 -1
- package/dist/types/components/artifacts/ArtifactPanel.d.ts +8 -1
- package/dist/types/components/artifacts/TrajectoryInspector.d.ts +15 -0
- package/dist/types/components/composer/AddMenu.d.ts +5 -1
- package/dist/types/components/dialogs/BranchSessionDialog.d.ts +6 -0
- package/dist/types/components/dialogs/GitDiffDialog.d.ts +2 -1
- package/dist/types/components/dialogs/GitLogDialog.d.ts +2 -1
- package/dist/types/components/managed/WorkspaceBindingCreator.d.ts +6 -0
- package/dist/types/components/managed/generated/managed-agent-api.d.ts +1074 -0
- package/dist/types/components/managed/java-managed-agent-client.d.ts +32 -113
- package/dist/types/components/managed/java-managed-agent-provider.d.ts +1 -0
- package/dist/types/components/managed/managed-agent-provider.d.ts +31 -1
- package/dist/types/components/messages/AssistantMessage.d.ts +3 -0
- package/dist/types/components/messages/AuthorAvatar.d.ts +16 -0
- package/dist/types/components/messages/McpApp.d.ts +1 -1
- package/dist/types/components/messages/toolFormatting.d.ts +2 -0
- package/dist/types/components/panels/EnvironmentPanel.d.ts +2 -1
- package/dist/types/components/sidebar/UpdateControl.d.ts +10 -0
- package/dist/types/components/sidebar/WebShellSidebar.d.ts +6 -3
- package/dist/types/components/sidebar/WorkspaceSection.d.ts +2 -1
- package/dist/types/components/sidebar/sessionSearch.d.ts +2 -1
- package/dist/types/components/workspace-agents/LazyThreadsRoute.d.ts +7 -0
- package/dist/types/components/workspace-agents/ThreadChat.d.ts +30 -0
- package/dist/types/components/workspace-agents/ThreadView.d.ts +65 -0
- package/dist/types/components/workspace-agents/ThreadsPage.d.ts +97 -0
- package/dist/types/components/workspace-agents/ThreadsRoute.d.ts +23 -0
- package/dist/types/components/workspace-agents/agent-events.d.ts +50 -0
- package/dist/types/components/workspace-agents/agents-view-logic.d.ts +176 -0
- package/dist/types/components/workspace-agents/messages.d.ts +16 -0
- package/dist/types/components/workspace-agents/messages.transcript-stub.d.ts +12 -0
- package/dist/types/components/workspace-agents/threads-api.d.ts +43 -0
- package/dist/types/components/workspace-agents/useAgentChatEntry.d.ts +36 -0
- package/dist/types/components/workspace-agents/useProjectConversations.d.ts +10 -0
- package/dist/types/customization.d.ts +10 -0
- package/dist/types/daemon/session/transcript-page-table.d.ts +10 -1
- package/dist/types/daemon/session/types.d.ts +2 -2
- package/dist/types/desktop-relay/desktop-relay-client.d.ts +63 -0
- package/dist/types/mcpAppHostContext.d.ts +7 -0
- package/dist/types/settings/messages.d.ts +16 -0
- package/dist/types/settings/messages.transcript-stub.d.ts +12 -0
- package/dist/types/settings.d.ts +1 -0
- package/dist/types/trajectory/summarizeTrajectory.d.ts +20 -0
- package/package.json +3 -1
|
@@ -0,0 +1,1726 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as xe } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as ne, useState as x, useEffect as le, useContext as et, createContext as tt, useRef as ce, useCallback as Ce } from "react";
|
|
3
|
+
import { PlusIcon as Se, MoreHorizontalIcon as Ve, MessagesSquareIcon as nt, ChevronRightIcon as Fe, Check as we, UsersRound as Ee, ArrowLeftIcon as Ge, LoaderCircle as ze, X as at } from "lucide-react";
|
|
4
|
+
import { W as oe, T as st, m as lt } from "./toolNames-C6G4mcM3.js";
|
|
5
|
+
import "@qwen-code/sdk/daemon";
|
|
6
|
+
import { g as ot, B as A, T as rt, a as it, D as ct, b as dt, c as mt, d as ut, e as gt, s as pt, f as Re, E as Me, h as We, i as qe, j as Be, C as bt, A as ge, k as ht, l as Pe, m as ft, n as Le, o as $e, p as De, q as de, r as Ue, t as _t, u as Te, v as vt, w as pe, M as Nt, x as xt, y as wt, z as Ie, F as Ae, G as Tt, H as T, W as Oe, I as yt, J as kt, K as Ct, L as St, N as At, O as Rt } from "./index-BQmwkK6l.js";
|
|
7
|
+
import { createPortal as Lt } from "react-dom";
|
|
8
|
+
const $t = "_formActions_i822m_4", Dt = "_field_i822m_11", It = "_roster_i822m_33", Ht = "_agentCard_i822m_39", Et = "_agentRow_i822m_44", zt = "_agentRowDisabled_i822m_51", Mt = "_agentMain_i822m_55", Wt = "_agentTitleLine_i822m_63", qt = "_agentName_i822m_70", Bt = "_statusBadge_i822m_89", Pt = "_agentActivityLink_i822m_104", Ot = "_agentActions_i822m_126", jt = "_emptyRoster_i822m_133", Vt = "_agentConfig_i822m_141", Ft = "_agentWorkspace_i822m_142", Gt = "_agentWorkspaceHeader_i822m_154", Ut = "_configLabel_i822m_169", Kt = "_configNote_i822m_176", Xt = "_ceiling_i822m_184", Jt = "_ceilingTitle_i822m_193", Yt = "_ceilingText_i822m_200", Qt = "_ceilingTools_i822m_208", Zt = "_group_i822m_217", en = "_groupHeading_i822m_225", tn = "_groupHeadingToggle_i822m_241", nn = "_groupCount_i822m_249", an = "_list_i822m_256", sn = "_row_i822m_265", ln = "_rowText_i822m_291", on = "_rowTitle_i822m_299", rn = "_rowReason_i822m_310", cn = "_rowChevron_i822m_326", h = {
|
|
9
|
+
formActions: $t,
|
|
10
|
+
field: Dt,
|
|
11
|
+
roster: It,
|
|
12
|
+
agentCard: Ht,
|
|
13
|
+
agentRow: Et,
|
|
14
|
+
agentRowDisabled: zt,
|
|
15
|
+
agentMain: Mt,
|
|
16
|
+
agentTitleLine: Wt,
|
|
17
|
+
agentName: qt,
|
|
18
|
+
statusBadge: Bt,
|
|
19
|
+
agentActivityLink: Pt,
|
|
20
|
+
agentActions: Ot,
|
|
21
|
+
emptyRoster: jt,
|
|
22
|
+
agentConfig: Vt,
|
|
23
|
+
agentWorkspace: Ft,
|
|
24
|
+
agentWorkspaceHeader: Gt,
|
|
25
|
+
configLabel: Ut,
|
|
26
|
+
configNote: Kt,
|
|
27
|
+
ceiling: Xt,
|
|
28
|
+
ceilingTitle: Jt,
|
|
29
|
+
ceilingText: Yt,
|
|
30
|
+
ceilingTools: Qt,
|
|
31
|
+
group: Zt,
|
|
32
|
+
groupHeading: en,
|
|
33
|
+
groupHeadingToggle: tn,
|
|
34
|
+
groupCount: nn,
|
|
35
|
+
list: an,
|
|
36
|
+
row: sn,
|
|
37
|
+
rowText: ln,
|
|
38
|
+
rowTitle: on,
|
|
39
|
+
rowReason: rn,
|
|
40
|
+
rowChevron: cn
|
|
41
|
+
}, dn = /* @__PURE__ */ new Set([
|
|
42
|
+
"idle",
|
|
43
|
+
"working",
|
|
44
|
+
"blocked",
|
|
45
|
+
"offline",
|
|
46
|
+
"error",
|
|
47
|
+
"finishing",
|
|
48
|
+
"stopping"
|
|
49
|
+
]);
|
|
50
|
+
function Ke({
|
|
51
|
+
thread: t,
|
|
52
|
+
onOpen: m
|
|
53
|
+
}) {
|
|
54
|
+
const { t: i } = oe();
|
|
55
|
+
return /* @__PURE__ */ s(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
type: "button",
|
|
59
|
+
className: h.row,
|
|
60
|
+
"data-attention": vt(t) || void 0,
|
|
61
|
+
onClick: () => m(t.id),
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ s("span", { className: h.rowText, children: [
|
|
64
|
+
/* @__PURE__ */ e("span", { className: h.rowTitle, children: t.title }),
|
|
65
|
+
/* @__PURE__ */ e("span", { className: h.rowReason, children: Te(t.reason, i) })
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ e(Fe, { "aria-hidden": "true", className: h.rowChevron })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function mn({
|
|
73
|
+
group: t,
|
|
74
|
+
onOpenThread: m,
|
|
75
|
+
hidden: i
|
|
76
|
+
}) {
|
|
77
|
+
const { t: d } = oe(), [l, _] = x(t.collapsedByDefault), b = t.collapsedByDefault;
|
|
78
|
+
return /* @__PURE__ */ s("section", { className: h.group, hidden: i, children: [
|
|
79
|
+
/* @__PURE__ */ s(
|
|
80
|
+
"button",
|
|
81
|
+
{
|
|
82
|
+
type: "button",
|
|
83
|
+
className: b ? `${h.groupHeading} ${h.groupHeadingToggle}` : h.groupHeading,
|
|
84
|
+
onClick: b ? () => _((g) => !g) : void 0,
|
|
85
|
+
"aria-expanded": b ? !l : void 0,
|
|
86
|
+
disabled: !b,
|
|
87
|
+
children: [
|
|
88
|
+
d(`collab.group.${t.key}`),
|
|
89
|
+
/* @__PURE__ */ e("span", { className: h.groupCount, children: t.threads.length })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
!l && /* @__PURE__ */ e("div", { className: h.list, children: t.threads.map((g) => /* @__PURE__ */ e(Ke, { thread: g, onOpen: m }, g.id)) })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
function un({
|
|
97
|
+
agents: t,
|
|
98
|
+
threads: m,
|
|
99
|
+
view: i,
|
|
100
|
+
onViewChange: d,
|
|
101
|
+
onOpenThread: l,
|
|
102
|
+
onDeleteAgent: _,
|
|
103
|
+
onSetAgentEnabled: b,
|
|
104
|
+
onUpdateAgent: g,
|
|
105
|
+
onOpenAgentBuilder: H,
|
|
106
|
+
onOpenDefinitions: O,
|
|
107
|
+
capabilities: M,
|
|
108
|
+
onCreateThread: R,
|
|
109
|
+
workspaceCwd: L,
|
|
110
|
+
workspaces: Z,
|
|
111
|
+
onWorkspaceChange: U,
|
|
112
|
+
createError: y,
|
|
113
|
+
onPreviewThread: r,
|
|
114
|
+
createPreview: f,
|
|
115
|
+
pending: W
|
|
116
|
+
}) {
|
|
117
|
+
const q = ne(() => ot(m), [m]), [V, $] = x(), [F, E] = x(), [X, re] = x(), { t: o } = oe(), [ae, C] = x(""), B = (n) => dn.has(n) ? o(`collab.agentStatus.${n}`) : n, K = (n) => (w) => {
|
|
118
|
+
if (w.preventDefault(), !g) return;
|
|
119
|
+
const D = new FormData(w.currentTarget), j = (J) => {
|
|
120
|
+
const ee = String(D.get(J) ?? "").trim();
|
|
121
|
+
return ee === "" ? null : ee;
|
|
122
|
+
}, P = String(D.get("maxConcurrentRuns") ?? "").trim();
|
|
123
|
+
g(n, {
|
|
124
|
+
description: j("description"),
|
|
125
|
+
model: j("model"),
|
|
126
|
+
agentType: j("agentType"),
|
|
127
|
+
instructions: j("instructions"),
|
|
128
|
+
maxConcurrentRuns: P === "" ? null : Number(P)
|
|
129
|
+
}), E(void 0);
|
|
130
|
+
}, G = async (n) => {
|
|
131
|
+
n.preventDefault();
|
|
132
|
+
const w = new FormData(n.currentTarget), D = String(w.get("assignee") ?? ""), j = String(
|
|
133
|
+
w.get("acceptanceCriteria") ?? ""
|
|
134
|
+
).trim(), P = String(w.get("priority") ?? "");
|
|
135
|
+
await R({
|
|
136
|
+
title: String(w.get("title") ?? "").trim(),
|
|
137
|
+
body: String(w.get("body") ?? "").trim(),
|
|
138
|
+
// Left out when blank or ordinary, so the thread records a decision
|
|
139
|
+
// only where one was made.
|
|
140
|
+
...j ? { acceptanceCriteria: j } : {},
|
|
141
|
+
...P && P !== "normal" ? { priority: P } : {},
|
|
142
|
+
...D ? { assignee: D } : {}
|
|
143
|
+
}) !== !1 && (r?.(void 0), $(void 0));
|
|
144
|
+
}, ie = (n) => {
|
|
145
|
+
d(n), $(void 0), E(void 0), re(void 0), r?.(void 0);
|
|
146
|
+
};
|
|
147
|
+
return /* @__PURE__ */ s("div", { className: "flex w-full flex-col gap-6", children: [
|
|
148
|
+
/* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-4", children: [
|
|
149
|
+
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
150
|
+
/* @__PURE__ */ e("h1", { className: "text-xl font-semibold text-balance", children: o("agents.title") }),
|
|
151
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-muted-foreground", children: o(`collab.tabs.${i}Hint`) })
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ s("div", { className: "flex shrink-0 gap-2", children: [
|
|
154
|
+
i === "agents" && O ? /* @__PURE__ */ e(A, { variant: "outline", onClick: O, children: o("collab.agent.roles") }) : null,
|
|
155
|
+
i === "agents" && H ? /* @__PURE__ */ s(A, { onClick: () => H(), children: [
|
|
156
|
+
/* @__PURE__ */ e(Se, { "data-icon": "inline-start" }),
|
|
157
|
+
o("collab.agent.new")
|
|
158
|
+
] }) : null,
|
|
159
|
+
i === "tasks" ? /* @__PURE__ */ s(
|
|
160
|
+
A,
|
|
161
|
+
{
|
|
162
|
+
onClick: () => {
|
|
163
|
+
$("thread"), C(""), r?.(void 0);
|
|
164
|
+
},
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ e(Se, { "data-icon": "inline-start" }),
|
|
167
|
+
o("collab.thread.new")
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
) : null
|
|
171
|
+
] })
|
|
172
|
+
] }),
|
|
173
|
+
/* @__PURE__ */ e(
|
|
174
|
+
rt,
|
|
175
|
+
{
|
|
176
|
+
type: "single",
|
|
177
|
+
value: i,
|
|
178
|
+
onValueChange: (n) => {
|
|
179
|
+
n && ie(n);
|
|
180
|
+
},
|
|
181
|
+
variant: "outline",
|
|
182
|
+
size: "sm",
|
|
183
|
+
"aria-label": o("agents.title"),
|
|
184
|
+
children: ["agents", "tasks"].map((n) => /* @__PURE__ */ e(it, { value: n, children: o(`collab.tabs.${n}`) }, n))
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ s("div", { className: "contents", children: [
|
|
188
|
+
/* @__PURE__ */ e(
|
|
189
|
+
ct,
|
|
190
|
+
{
|
|
191
|
+
open: i === "tasks" && V === "thread",
|
|
192
|
+
onOpenChange: (n) => {
|
|
193
|
+
!n && !W && $(void 0);
|
|
194
|
+
},
|
|
195
|
+
children: /* @__PURE__ */ s(dt, { className: "sm:max-w-2xl", children: [
|
|
196
|
+
/* @__PURE__ */ s(mt, { children: [
|
|
197
|
+
/* @__PURE__ */ e(ut, { children: o("collab.thread.new") }),
|
|
198
|
+
/* @__PURE__ */ e(gt, { children: o("collab.thread.newHint") })
|
|
199
|
+
] }),
|
|
200
|
+
/* @__PURE__ */ s(
|
|
201
|
+
"form",
|
|
202
|
+
{
|
|
203
|
+
className: "flex flex-col gap-4",
|
|
204
|
+
onSubmit: (n) => void G(n),
|
|
205
|
+
children: [
|
|
206
|
+
y && /* @__PURE__ */ e("p", { role: "alert", className: "text-sm text-destructive", children: y }),
|
|
207
|
+
/* @__PURE__ */ s("label", { className: "text-xs text-muted-foreground", children: [
|
|
208
|
+
o("collab.form.project"),
|
|
209
|
+
/* @__PURE__ */ s(
|
|
210
|
+
"select",
|
|
211
|
+
{
|
|
212
|
+
className: h.field,
|
|
213
|
+
value: L ?? "",
|
|
214
|
+
disabled: W,
|
|
215
|
+
onChange: (n) => {
|
|
216
|
+
C(""), U?.(n.target.value);
|
|
217
|
+
},
|
|
218
|
+
children: [
|
|
219
|
+
L && !Z?.some(
|
|
220
|
+
(n) => n.cwd === L
|
|
221
|
+
) && /* @__PURE__ */ e("option", { value: L, children: L.split(/[\\/]/).filter(Boolean).at(-1) }),
|
|
222
|
+
Z?.map((n) => /* @__PURE__ */ e("option", { value: n.cwd, children: n.cwd.split(/[\\/]/).filter(Boolean).at(-1) }, n.cwd))
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
] }),
|
|
227
|
+
/* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground", children: [
|
|
228
|
+
/* @__PURE__ */ e("span", { className: "block break-all", children: L }),
|
|
229
|
+
o("collab.form.projectHint")
|
|
230
|
+
] }),
|
|
231
|
+
/* @__PURE__ */ e(
|
|
232
|
+
"input",
|
|
233
|
+
{
|
|
234
|
+
className: "w-full border-0 bg-transparent text-xl font-medium outline-none",
|
|
235
|
+
name: "title",
|
|
236
|
+
"aria-label": o("collab.form.titleLabel"),
|
|
237
|
+
placeholder: o("collab.form.title"),
|
|
238
|
+
required: !0
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ e(
|
|
242
|
+
"textarea",
|
|
243
|
+
{
|
|
244
|
+
className: h.field,
|
|
245
|
+
name: "body",
|
|
246
|
+
"aria-label": o("collab.form.bodyLabel"),
|
|
247
|
+
rows: 6,
|
|
248
|
+
placeholder: o("collab.form.body"),
|
|
249
|
+
required: !0
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
/* @__PURE__ */ e(
|
|
253
|
+
"textarea",
|
|
254
|
+
{
|
|
255
|
+
className: h.field,
|
|
256
|
+
name: "acceptanceCriteria",
|
|
257
|
+
"aria-label": o("collab.form.criteriaLabel"),
|
|
258
|
+
placeholder: o("collab.form.criteria")
|
|
259
|
+
}
|
|
260
|
+
),
|
|
261
|
+
/* @__PURE__ */ e(
|
|
262
|
+
"select",
|
|
263
|
+
{
|
|
264
|
+
className: h.field,
|
|
265
|
+
name: "priority",
|
|
266
|
+
"aria-label": o("collab.form.priority"),
|
|
267
|
+
defaultValue: "normal",
|
|
268
|
+
children: ["urgent", "high", "normal", "low"].map((n) => /* @__PURE__ */ e("option", { value: n, children: o(`collab.priority.${n}`) }, n))
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: o("collab.form.priorityHint") }),
|
|
272
|
+
/* @__PURE__ */ s(
|
|
273
|
+
"select",
|
|
274
|
+
{
|
|
275
|
+
className: h.field,
|
|
276
|
+
name: "assignee",
|
|
277
|
+
"aria-label": o("collab.form.assignee"),
|
|
278
|
+
defaultValue: ae,
|
|
279
|
+
onChange: (n) => {
|
|
280
|
+
C(n.target.value), r?.(n.target.value || void 0);
|
|
281
|
+
},
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ e("option", { value: "", children: o("collab.form.noAssignee") }),
|
|
284
|
+
t.filter((n) => n.enabled && !n.retiredAt).map((n) => /* @__PURE__ */ e("option", { value: n.name, children: n.name }, n.id))
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
L
|
|
288
|
+
),
|
|
289
|
+
!ae && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: o("collab.form.noAssigneeHint") }),
|
|
290
|
+
f ? /* @__PURE__ */ s(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
role: "status",
|
|
294
|
+
className: "space-y-1 text-xs text-muted-foreground",
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ e("strong", { children: ae ? pt(f, o) : o("collab.form.saveOnly") }),
|
|
297
|
+
f.filter((n) => !n.willWake).map((n) => {
|
|
298
|
+
const w = Re(
|
|
299
|
+
n.reason ?? "",
|
|
300
|
+
n.agentName,
|
|
301
|
+
o
|
|
302
|
+
);
|
|
303
|
+
return /* @__PURE__ */ e(
|
|
304
|
+
"p",
|
|
305
|
+
{
|
|
306
|
+
children: w
|
|
307
|
+
},
|
|
308
|
+
`${n.agentName}:${n.reason ?? "unknown"}`
|
|
309
|
+
);
|
|
310
|
+
})
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
) : null,
|
|
314
|
+
/* @__PURE__ */ s("div", { className: h.formActions, children: [
|
|
315
|
+
/* @__PURE__ */ e(
|
|
316
|
+
A,
|
|
317
|
+
{
|
|
318
|
+
type: "button",
|
|
319
|
+
variant: "ghost",
|
|
320
|
+
size: "sm",
|
|
321
|
+
onClick: () => {
|
|
322
|
+
$(void 0), r?.(void 0);
|
|
323
|
+
},
|
|
324
|
+
children: o("collab.form.cancel")
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
/* @__PURE__ */ e(A, { type: "submit", size: "sm", disabled: W, children: o(W ? "collab.form.creating" : "collab.form.create") })
|
|
328
|
+
] })
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
] })
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
/* @__PURE__ */ s("section", { className: h.roster, hidden: i !== "agents", children: [
|
|
336
|
+
t.length === 0 ? /* @__PURE__ */ e(Me, { className: "border", children: /* @__PURE__ */ s(We, { children: [
|
|
337
|
+
/* @__PURE__ */ e(qe, { variant: "icon", children: /* @__PURE__ */ e(Se, {}) }),
|
|
338
|
+
/* @__PURE__ */ e(Be, { children: o("collab.agent.empty") })
|
|
339
|
+
] }) }) : t.map((n) => /* @__PURE__ */ s(
|
|
340
|
+
bt,
|
|
341
|
+
{
|
|
342
|
+
size: "sm",
|
|
343
|
+
className: n.enabled && !n.retiredAt ? h.agentCard : `${h.agentCard} ${h.agentRowDisabled}`,
|
|
344
|
+
children: [
|
|
345
|
+
/* @__PURE__ */ s("div", { className: h.agentRow, children: [
|
|
346
|
+
/* @__PURE__ */ e(
|
|
347
|
+
ge,
|
|
348
|
+
{
|
|
349
|
+
name: n.name,
|
|
350
|
+
color: n.color,
|
|
351
|
+
size: "md"
|
|
352
|
+
}
|
|
353
|
+
),
|
|
354
|
+
/* @__PURE__ */ s("div", { className: h.agentMain, children: [
|
|
355
|
+
/* @__PURE__ */ s("div", { className: h.agentTitleLine, children: [
|
|
356
|
+
/* @__PURE__ */ e(ht, { className: "min-w-0 truncate", children: /* @__PURE__ */ e(
|
|
357
|
+
"button",
|
|
358
|
+
{
|
|
359
|
+
type: "button",
|
|
360
|
+
className: h.agentName,
|
|
361
|
+
"aria-expanded": X === n.id,
|
|
362
|
+
onClick: () => re(
|
|
363
|
+
X === n.id ? void 0 : n.id
|
|
364
|
+
),
|
|
365
|
+
children: n.name
|
|
366
|
+
}
|
|
367
|
+
) }),
|
|
368
|
+
/* @__PURE__ */ e(
|
|
369
|
+
Pe,
|
|
370
|
+
{
|
|
371
|
+
variant: "secondary",
|
|
372
|
+
className: h.statusBadge,
|
|
373
|
+
"data-status": n.retiredAt || !n.enabled ? "off" : n.workingOn ? "working" : n.status,
|
|
374
|
+
children: n.retiredAt ? o("collab.agentStatus.retired") : n.enabled ? n.workingOn ? B(n.workingOn.state) : B(n.status) : o("collab.agentStatus.paused")
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
n.waiting ? /* @__PURE__ */ e(Pe, { variant: "outline", className: "text-[10px]", children: o("collab.agent.waiting", { count: n.waiting }) }) : null
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ e(ft, { className: "truncate text-xs", children: n.description || "—" }),
|
|
380
|
+
n.workingOn ? /* @__PURE__ */ e(
|
|
381
|
+
"button",
|
|
382
|
+
{
|
|
383
|
+
type: "button",
|
|
384
|
+
className: h.agentActivityLink,
|
|
385
|
+
onClick: () => l(n.workingOn.id),
|
|
386
|
+
children: o("collab.agent.workingOn", {
|
|
387
|
+
title: n.workingOn.title
|
|
388
|
+
})
|
|
389
|
+
}
|
|
390
|
+
) : null
|
|
391
|
+
] }),
|
|
392
|
+
n.retiredAt ? null : /* @__PURE__ */ s("div", { className: h.agentActions, children: [
|
|
393
|
+
/* @__PURE__ */ e(
|
|
394
|
+
A,
|
|
395
|
+
{
|
|
396
|
+
variant: "outline",
|
|
397
|
+
size: "sm",
|
|
398
|
+
disabled: !n.enabled || W,
|
|
399
|
+
onClick: () => {
|
|
400
|
+
ie("tasks"), C(n.name), $("thread"), r?.(n.name);
|
|
401
|
+
},
|
|
402
|
+
children: o("collab.agent.mentionIt")
|
|
403
|
+
}
|
|
404
|
+
),
|
|
405
|
+
/* @__PURE__ */ s(Le, { children: [
|
|
406
|
+
/* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(
|
|
407
|
+
A,
|
|
408
|
+
{
|
|
409
|
+
variant: "ghost",
|
|
410
|
+
size: "icon-sm",
|
|
411
|
+
"aria-label": o("collab.agent.more", {
|
|
412
|
+
name: n.name
|
|
413
|
+
}),
|
|
414
|
+
children: /* @__PURE__ */ e(Ve, { "aria-hidden": "true" })
|
|
415
|
+
}
|
|
416
|
+
) }),
|
|
417
|
+
/* @__PURE__ */ s(De, { align: "end", className: "min-w-40", children: [
|
|
418
|
+
g ? /* @__PURE__ */ e(
|
|
419
|
+
de,
|
|
420
|
+
{
|
|
421
|
+
onSelect: () => E(n.id),
|
|
422
|
+
children: o("collab.agent.configure")
|
|
423
|
+
}
|
|
424
|
+
) : null,
|
|
425
|
+
/* @__PURE__ */ e(
|
|
426
|
+
de,
|
|
427
|
+
{
|
|
428
|
+
disabled: W,
|
|
429
|
+
onSelect: () => b(n.id, !n.enabled),
|
|
430
|
+
children: n.enabled ? o("collab.agent.pause") : o("collab.agent.resume")
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
/* @__PURE__ */ e(Ue, {}),
|
|
434
|
+
/* @__PURE__ */ e(
|
|
435
|
+
de,
|
|
436
|
+
{
|
|
437
|
+
variant: "destructive",
|
|
438
|
+
disabled: !!(n.workingOn || n.waiting),
|
|
439
|
+
onSelect: () => {
|
|
440
|
+
window.confirm(
|
|
441
|
+
o("collab.agent.retireConfirm", {
|
|
442
|
+
name: n.name
|
|
443
|
+
})
|
|
444
|
+
) && _(n.id);
|
|
445
|
+
},
|
|
446
|
+
children: o("collab.agent.retire")
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
] })
|
|
450
|
+
] })
|
|
451
|
+
] })
|
|
452
|
+
] }),
|
|
453
|
+
F === n.id && g ? /* @__PURE__ */ s(
|
|
454
|
+
"form",
|
|
455
|
+
{
|
|
456
|
+
className: h.agentConfig,
|
|
457
|
+
onSubmit: K(n.id),
|
|
458
|
+
children: [
|
|
459
|
+
/* @__PURE__ */ s("label", { className: h.configLabel, children: [
|
|
460
|
+
o("collab.config.description"),
|
|
461
|
+
/* @__PURE__ */ e(
|
|
462
|
+
"input",
|
|
463
|
+
{
|
|
464
|
+
className: h.field,
|
|
465
|
+
name: "description",
|
|
466
|
+
defaultValue: n.description ?? "",
|
|
467
|
+
placeholder: o("collab.config.descriptionHint")
|
|
468
|
+
}
|
|
469
|
+
)
|
|
470
|
+
] }),
|
|
471
|
+
/* @__PURE__ */ s("label", { className: h.configLabel, children: [
|
|
472
|
+
o("collab.config.instructions"),
|
|
473
|
+
/* @__PURE__ */ e(
|
|
474
|
+
"textarea",
|
|
475
|
+
{
|
|
476
|
+
className: h.field,
|
|
477
|
+
name: "instructions",
|
|
478
|
+
rows: 4,
|
|
479
|
+
defaultValue: n.instructions ?? "",
|
|
480
|
+
placeholder: o("collab.config.instructionsHint")
|
|
481
|
+
}
|
|
482
|
+
)
|
|
483
|
+
] }),
|
|
484
|
+
/* @__PURE__ */ s("label", { className: h.configLabel, children: [
|
|
485
|
+
o("collab.config.agentType"),
|
|
486
|
+
/* @__PURE__ */ e(
|
|
487
|
+
"input",
|
|
488
|
+
{
|
|
489
|
+
className: h.field,
|
|
490
|
+
name: "agentType",
|
|
491
|
+
defaultValue: n.agentType ?? "",
|
|
492
|
+
placeholder: o("collab.config.workspaceDefault")
|
|
493
|
+
}
|
|
494
|
+
)
|
|
495
|
+
] }),
|
|
496
|
+
/* @__PURE__ */ s("label", { className: h.configLabel, children: [
|
|
497
|
+
o("collab.config.model"),
|
|
498
|
+
/* @__PURE__ */ e(
|
|
499
|
+
"input",
|
|
500
|
+
{
|
|
501
|
+
className: h.field,
|
|
502
|
+
name: "model",
|
|
503
|
+
defaultValue: n.model ?? "",
|
|
504
|
+
placeholder: o("collab.config.workspaceDefault")
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
] }),
|
|
508
|
+
/* @__PURE__ */ s("label", { className: h.configLabel, children: [
|
|
509
|
+
o("collab.config.maxRuns"),
|
|
510
|
+
/* @__PURE__ */ e(
|
|
511
|
+
"input",
|
|
512
|
+
{
|
|
513
|
+
className: h.field,
|
|
514
|
+
name: "maxConcurrentRuns",
|
|
515
|
+
type: "number",
|
|
516
|
+
min: 1,
|
|
517
|
+
max: 8,
|
|
518
|
+
defaultValue: n.maxConcurrentRuns ?? 1
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
] }),
|
|
522
|
+
/* @__PURE__ */ e("p", { className: h.configNote, children: o("collab.config.note") }),
|
|
523
|
+
/* @__PURE__ */ s("div", { className: h.formActions, children: [
|
|
524
|
+
/* @__PURE__ */ e(
|
|
525
|
+
A,
|
|
526
|
+
{
|
|
527
|
+
type: "button",
|
|
528
|
+
variant: "ghost",
|
|
529
|
+
size: "sm",
|
|
530
|
+
onClick: () => E(void 0),
|
|
531
|
+
children: o("collab.form.cancel")
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
/* @__PURE__ */ e(A, { type: "submit", size: "sm", disabled: W, children: o("collab.config.save") })
|
|
535
|
+
] })
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
) : null,
|
|
539
|
+
X === n.id ? /* @__PURE__ */ s("section", { className: h.agentWorkspace, children: [
|
|
540
|
+
/* @__PURE__ */ s("div", { className: h.agentWorkspaceHeader, children: [
|
|
541
|
+
/* @__PURE__ */ e("strong", { children: o("collab.agent.assigned") }),
|
|
542
|
+
/* @__PURE__ */ e("span", { children: B(n.status) })
|
|
543
|
+
] }),
|
|
544
|
+
m.some(
|
|
545
|
+
(w) => w.assigneeName === n.name
|
|
546
|
+
) ? m.filter((w) => w.assigneeName === n.name).sort((w, D) => D.updatedAt - w.updatedAt).map((w) => /* @__PURE__ */ e(
|
|
547
|
+
Ke,
|
|
548
|
+
{
|
|
549
|
+
thread: w,
|
|
550
|
+
onOpen: l
|
|
551
|
+
},
|
|
552
|
+
w.id
|
|
553
|
+
)) : /* @__PURE__ */ e("p", { className: h.emptyRoster, children: o("collab.agent.noneAssigned") })
|
|
554
|
+
] }) : null
|
|
555
|
+
]
|
|
556
|
+
},
|
|
557
|
+
n.id
|
|
558
|
+
)),
|
|
559
|
+
M ? /* @__PURE__ */ s("div", { className: h.ceiling, children: [
|
|
560
|
+
/* @__PURE__ */ e("h3", { className: h.ceilingTitle, children: o("collab.ceiling.title") }),
|
|
561
|
+
/* @__PURE__ */ e("p", { className: h.ceilingText, children: M.readOnly ? o("collab.ceiling.readOnly") : o("collab.ceiling.open") }),
|
|
562
|
+
/* @__PURE__ */ s("details", { children: [
|
|
563
|
+
/* @__PURE__ */ e("summary", { className: "cursor-pointer text-xs text-muted-foreground", children: o("collab.ceiling.tools") }),
|
|
564
|
+
/* @__PURE__ */ e("p", { className: h.ceilingTools, children: M.allowed.join(", ") })
|
|
565
|
+
] })
|
|
566
|
+
] }) : null
|
|
567
|
+
] }),
|
|
568
|
+
q.length === 0 ? /* @__PURE__ */ e(Me, { className: "border", hidden: i !== "tasks", children: /* @__PURE__ */ s(We, { children: [
|
|
569
|
+
/* @__PURE__ */ e(qe, { variant: "icon", children: /* @__PURE__ */ e(nt, {}) }),
|
|
570
|
+
/* @__PURE__ */ e(Be, { children: o("collab.empty.lead") }),
|
|
571
|
+
/* @__PURE__ */ e(_t, { children: o("collab.empty.hint") })
|
|
572
|
+
] }) }) : q.map((n) => /* @__PURE__ */ e(
|
|
573
|
+
mn,
|
|
574
|
+
{
|
|
575
|
+
group: n,
|
|
576
|
+
onOpenThread: l,
|
|
577
|
+
hidden: i !== "tasks"
|
|
578
|
+
},
|
|
579
|
+
n.key
|
|
580
|
+
))
|
|
581
|
+
] })
|
|
582
|
+
] });
|
|
583
|
+
}
|
|
584
|
+
const gn = "_runRow_1vx3b_3", pn = "_runAgent_1vx3b_12", bn = "_runState_1vx3b_23", hn = "_runStateOutstanding_1vx3b_33", fn = "_runStateLive_1vx3b_37", _n = "_runProgress_1vx3b_41", vn = "_runTrigger_1vx3b_58", Nn = "_runLink_1vx3b_67", xn = "_runCancel_1vx3b_68", wn = "_runError_1vx3b_91", z = {
|
|
585
|
+
runRow: gn,
|
|
586
|
+
runAgent: pn,
|
|
587
|
+
runState: bn,
|
|
588
|
+
runStateOutstanding: hn,
|
|
589
|
+
runStateLive: fn,
|
|
590
|
+
runProgress: _n,
|
|
591
|
+
runTrigger: vn,
|
|
592
|
+
runLink: Nn,
|
|
593
|
+
runCancel: xn,
|
|
594
|
+
runError: wn
|
|
595
|
+
}, Tn = /* @__PURE__ */ new Set([
|
|
596
|
+
"starting",
|
|
597
|
+
"resuming",
|
|
598
|
+
"waiting",
|
|
599
|
+
"thinking",
|
|
600
|
+
"tool",
|
|
601
|
+
"responding"
|
|
602
|
+
]);
|
|
603
|
+
function je({
|
|
604
|
+
row: t,
|
|
605
|
+
hideAgent: m = !1,
|
|
606
|
+
onOpenAgentSession: i,
|
|
607
|
+
onCancelRun: d
|
|
608
|
+
}) {
|
|
609
|
+
const { t: l } = oe(), _ = t.run.sessionId, b = t.run.progress, [g, H] = x(Date.now);
|
|
610
|
+
le(() => {
|
|
611
|
+
if (!t.live) return;
|
|
612
|
+
const L = setInterval(() => H(Date.now()), 1e3);
|
|
613
|
+
return () => clearInterval(L);
|
|
614
|
+
}, [t.live]);
|
|
615
|
+
const O = b && g - b.activityAt > 15e3, M = t.run.status === "queued" ? l("collab.runRow.queued") : t.run.status === "running" ? b ? b.stage === "awaiting_approval" ? l("collab.runRow.stage.awaiting_approval") : O ? l("collab.runRow.quiet") : Tn.has(b.stage) ? l(`collab.runRow.stage.${b.stage}`) : l("collab.runRow.working") : l("collab.runRow.unconfirmed") : t.state, R = t.outstanding ? `${z.runState} ${z.runStateOutstanding}` : t.live ? `${z.runState} ${z.runStateLive}` : z.runState;
|
|
616
|
+
return /* @__PURE__ */ s("div", { className: z.runRow, "data-compact": m || void 0, children: [
|
|
617
|
+
m ? null : /* @__PURE__ */ e("span", { className: z.runAgent, children: t.run.agentName }),
|
|
618
|
+
/* @__PURE__ */ s("span", { className: R, children: [
|
|
619
|
+
M,
|
|
620
|
+
t.live && t.run.status !== "cancelling" && d ? /* @__PURE__ */ e(
|
|
621
|
+
"button",
|
|
622
|
+
{
|
|
623
|
+
type: "button",
|
|
624
|
+
className: z.runCancel,
|
|
625
|
+
onClick: () => d(t.run.id),
|
|
626
|
+
children: l("collab.runRow.cancel")
|
|
627
|
+
}
|
|
628
|
+
) : null
|
|
629
|
+
] }),
|
|
630
|
+
t.live && /* @__PURE__ */ s("div", { className: z.runProgress, role: "status", children: [
|
|
631
|
+
t.run.startedAt && /* @__PURE__ */ e("div", { children: l("collab.runRow.elapsed", {
|
|
632
|
+
elapsed: pe(g - t.run.startedAt, l)
|
|
633
|
+
}) }),
|
|
634
|
+
b ? /* @__PURE__ */ e("div", { children: l("collab.runRow.lastActivity", {
|
|
635
|
+
elapsed: pe(g - b.activityAt, l)
|
|
636
|
+
}) }) : /* @__PURE__ */ e("div", { children: t.run.status === "queued" ? l("collab.runRow.queuedHint") : l("collab.runRow.unconfirmedHint") })
|
|
637
|
+
] }),
|
|
638
|
+
b?.detail && /* @__PURE__ */ s("details", { className: z.runProgress, open: t.live, children: [
|
|
639
|
+
/* @__PURE__ */ e("summary", { children: l("collab.runRow.activity") }),
|
|
640
|
+
/* @__PURE__ */ e("div", { children: b.detail })
|
|
641
|
+
] }),
|
|
642
|
+
b?.thoughtText && /* @__PURE__ */ s("details", { className: z.runProgress, open: t.live, children: [
|
|
643
|
+
/* @__PURE__ */ e("summary", { children: l("collab.runRow.thinking") }),
|
|
644
|
+
/* @__PURE__ */ e("div", { className: "max-h-64 overflow-y-auto whitespace-pre-wrap break-words", children: b.thoughtText }),
|
|
645
|
+
b.thoughtText.length >= 65536 && /* @__PURE__ */ e("p", { children: l("collab.runRow.thinkingCap") })
|
|
646
|
+
] }),
|
|
647
|
+
b?.outputText && /* @__PURE__ */ s("details", { className: z.runProgress, children: [
|
|
648
|
+
/* @__PURE__ */ e("summary", { children: l("collab.runRow.output") }),
|
|
649
|
+
/* @__PURE__ */ e(
|
|
650
|
+
Nt,
|
|
651
|
+
{
|
|
652
|
+
content: b.outputText,
|
|
653
|
+
isStreaming: t.run.status === "running"
|
|
654
|
+
}
|
|
655
|
+
),
|
|
656
|
+
b.outputText.length >= 262144 && /* @__PURE__ */ e("p", { children: l("collab.runRow.outputCap") })
|
|
657
|
+
] }),
|
|
658
|
+
/* @__PURE__ */ s("span", { className: z.runTrigger, children: [
|
|
659
|
+
xt(t.run.trigger, l),
|
|
660
|
+
_ && i ? /* @__PURE__ */ s(xe, { children: [
|
|
661
|
+
" · ",
|
|
662
|
+
/* @__PURE__ */ e(
|
|
663
|
+
"button",
|
|
664
|
+
{
|
|
665
|
+
type: "button",
|
|
666
|
+
className: z.runLink,
|
|
667
|
+
onClick: () => i(_),
|
|
668
|
+
children: l("collab.runRow.openSession", { agent: t.run.agentName })
|
|
669
|
+
}
|
|
670
|
+
)
|
|
671
|
+
] }) : null
|
|
672
|
+
] }),
|
|
673
|
+
t.run.error ? /* @__PURE__ */ e("span", { className: z.runError, children: t.run.error === "agent_run_stalled" ? l("collab.runRow.stalled") : t.run.error }) : null
|
|
674
|
+
] });
|
|
675
|
+
}
|
|
676
|
+
const yn = "_context_dl3fu_6", kn = "_chevronShown_dl3fu_11", Cn = "_contextBody_dl3fu_15", Sn = "_dock_dl3fu_27", An = "_row_dl3fu_36", Rn = "_rowText_dl3fu_44", Ln = "_attention_dl3fu_48", $n = "_steps_dl3fu_52", Dn = "_step_dl3fu_52", In = "_stepText_dl3fu_70", Hn = "_approval_dl3fu_77", En = "_approvalCaption_dl3fu_83", zn = "_note_dl3fu_91", Mn = "_composerHint_dl3fu_107", Wn = "_team_dl3fu_119", qn = "_teamHeader_dl3fu_128", Bn = "_teamTitle_dl3fu_135", Pn = "_teamReason_dl3fu_144", On = "_muted_dl3fu_145", jn = "_teamLink_dl3fu_150", Vn = "_sectionTitle_dl3fu_167", Fn = "_criteria_dl3fu_174", Gn = "_criteriaText_dl3fu_178", Un = "_memberList_dl3fu_185", Kn = "_member_dl3fu_185", Xn = "_memberHead_dl3fu_198", Jn = "_memberToggle_dl3fu_204", Yn = "_childRow_dl3fu_205", Qn = "_memberText_dl3fu_236", Zn = "_memberName_dl3fu_243", ea = "_memberStatus_dl3fu_256", ta = "_memberStatusAttention_dl3fu_267", na = "_memberStatusRunning_dl3fu_271", aa = "_leadBadge_dl3fu_275", sa = "_memberChevron_dl3fu_285", la = "_memberDetail_dl3fu_304", oa = "_history_dl3fu_311", ra = "_budget_dl3fu_315", p = {
|
|
677
|
+
context: yn,
|
|
678
|
+
chevronShown: kn,
|
|
679
|
+
contextBody: Cn,
|
|
680
|
+
dock: Sn,
|
|
681
|
+
row: An,
|
|
682
|
+
rowText: Rn,
|
|
683
|
+
attention: Ln,
|
|
684
|
+
steps: $n,
|
|
685
|
+
step: Dn,
|
|
686
|
+
stepText: In,
|
|
687
|
+
approval: Hn,
|
|
688
|
+
approvalCaption: En,
|
|
689
|
+
note: zn,
|
|
690
|
+
composerHint: Mn,
|
|
691
|
+
team: Wn,
|
|
692
|
+
teamHeader: qn,
|
|
693
|
+
teamTitle: Bn,
|
|
694
|
+
teamReason: Pn,
|
|
695
|
+
muted: On,
|
|
696
|
+
teamLink: jn,
|
|
697
|
+
sectionTitle: Vn,
|
|
698
|
+
criteria: Fn,
|
|
699
|
+
criteriaText: Gn,
|
|
700
|
+
memberList: Un,
|
|
701
|
+
member: Kn,
|
|
702
|
+
memberHead: Xn,
|
|
703
|
+
memberToggle: Jn,
|
|
704
|
+
childRow: Yn,
|
|
705
|
+
memberText: Qn,
|
|
706
|
+
memberName: Zn,
|
|
707
|
+
memberStatus: ea,
|
|
708
|
+
memberStatusAttention: ta,
|
|
709
|
+
memberStatusRunning: na,
|
|
710
|
+
leadBadge: aa,
|
|
711
|
+
memberChevron: sa,
|
|
712
|
+
memberDetail: la,
|
|
713
|
+
history: oa,
|
|
714
|
+
budget: ra
|
|
715
|
+
}, He = 5 * 6e4;
|
|
716
|
+
function Xe(t) {
|
|
717
|
+
const [m, i] = x(() => Date.now());
|
|
718
|
+
return le(() => {
|
|
719
|
+
if (!t) return;
|
|
720
|
+
const d = setInterval(() => i(Date.now()), 1e3);
|
|
721
|
+
return () => clearInterval(d);
|
|
722
|
+
}, [t]), m;
|
|
723
|
+
}
|
|
724
|
+
function ia(t, m, i) {
|
|
725
|
+
const d = t.agentName;
|
|
726
|
+
if (t.status === "queued")
|
|
727
|
+
return {
|
|
728
|
+
text: t.queueAhead ? i("collab.run.queuedBehind", { agent: d, count: t.queueAhead }) : i("collab.run.queued", { agent: d }),
|
|
729
|
+
stalled: !1
|
|
730
|
+
};
|
|
731
|
+
if (t.status === "cancelling")
|
|
732
|
+
return { text: i("collab.run.stopping", { agent: d }), stalled: !1 };
|
|
733
|
+
const l = t.progress;
|
|
734
|
+
if (!l)
|
|
735
|
+
return { text: i("collab.run.starting", { agent: d }), stalled: !1 };
|
|
736
|
+
const _ = m - l.activityAt;
|
|
737
|
+
if (_ >= He)
|
|
738
|
+
return {
|
|
739
|
+
text: i("collab.run.stalled", { agent: d, elapsed: pe(_, i) }),
|
|
740
|
+
stalled: !0
|
|
741
|
+
};
|
|
742
|
+
const b = pe(m - (t.startedAt ?? m), i);
|
|
743
|
+
switch (l.stage) {
|
|
744
|
+
case "starting":
|
|
745
|
+
return { text: i("collab.run.starting", { agent: d }), stalled: !1 };
|
|
746
|
+
case "resuming":
|
|
747
|
+
return { text: i("collab.run.resuming", { agent: d }), stalled: !1 };
|
|
748
|
+
case "thinking":
|
|
749
|
+
return {
|
|
750
|
+
text: i("collab.run.thinking", { agent: d, elapsed: b }),
|
|
751
|
+
stalled: !1
|
|
752
|
+
};
|
|
753
|
+
case "responding":
|
|
754
|
+
return {
|
|
755
|
+
text: i("collab.run.responding", { agent: d, elapsed: b }),
|
|
756
|
+
stalled: !1
|
|
757
|
+
};
|
|
758
|
+
case "tool":
|
|
759
|
+
return {
|
|
760
|
+
text: l.detail ? i("collab.run.toolNamed", { agent: d, tool: l.detail, elapsed: b }) : i("collab.run.tool", { agent: d, elapsed: b }),
|
|
761
|
+
stalled: !1
|
|
762
|
+
};
|
|
763
|
+
case "stream_lost":
|
|
764
|
+
return { text: i("collab.run.streamLost", { agent: d }), stalled: !1 };
|
|
765
|
+
default:
|
|
766
|
+
return {
|
|
767
|
+
text: i("collab.run.working", { agent: d, elapsed: b }),
|
|
768
|
+
stalled: !1
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
const ca = /* @__PURE__ */ new Set(["queued", "running", "finishing", "cancelling"]), Ne = (t) => t !== void 0 && ca.has(t.status), ye = (t) => t.endedAt ?? t.startedAt ?? 0;
|
|
773
|
+
function da(t, m, i) {
|
|
774
|
+
const d = t.filter((_) => _.willWake).map((_) => _.agentName);
|
|
775
|
+
return d.length === 0 ? i("collab.preview.nobody") : m.filter((_) => !d.includes(_.name)).length > 0 ? i("collab.preview.only", { names: d.join(", ") }) : i("collab.preview.to", { names: d.join(", ") });
|
|
776
|
+
}
|
|
777
|
+
function Je(t, m) {
|
|
778
|
+
const i = /* @__PURE__ */ new Map(), d = (l, _ = {}) => {
|
|
779
|
+
const b = i.get(l) ?? { name: l, lead: !1 };
|
|
780
|
+
i.set(l, { ...b, ..._ });
|
|
781
|
+
};
|
|
782
|
+
t.assigneeName && d(t.assigneeName, { lead: !0 });
|
|
783
|
+
for (const l of t.posts)
|
|
784
|
+
l.authorKind === "agent" && d(l.authorName);
|
|
785
|
+
for (const l of t.runs) {
|
|
786
|
+
const _ = i.get(l.agentName)?.run, b = !_ || Ne(l) && !Ne(_) || Ne(l) === Ne(_) && ye(l) >= ye(_);
|
|
787
|
+
d(l.agentName, {
|
|
788
|
+
...l.agentColor ? { color: l.agentColor } : {},
|
|
789
|
+
...b ? { run: l } : {}
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
for (const l of i.values()) {
|
|
793
|
+
const _ = m.find((b) => b.name === l.name);
|
|
794
|
+
l.color ??= _?.color;
|
|
795
|
+
}
|
|
796
|
+
return [...i.values()].sort((l, _) => Number(_.lead) - Number(l.lead));
|
|
797
|
+
}
|
|
798
|
+
function ma(t, m, i) {
|
|
799
|
+
const d = t.run, l = "", _ = p.memberStatusAttention, b = p.memberStatusRunning;
|
|
800
|
+
if (!d) return { text: i("collab.member.idle"), tone: l };
|
|
801
|
+
switch (d.status) {
|
|
802
|
+
case "queued":
|
|
803
|
+
return { text: i("collab.member.queued"), tone: l };
|
|
804
|
+
case "running":
|
|
805
|
+
case "finishing":
|
|
806
|
+
case "cancelling": {
|
|
807
|
+
const g = d.progress;
|
|
808
|
+
return g?.permission ? { text: i("collab.member.approval"), tone: _ } : g && m - g.activityAt >= He ? { text: i("collab.member.stalled"), tone: _ } : g?.stage === "tool" && g.detail ? {
|
|
809
|
+
text: i("collab.member.tool", { tool: g.detail }),
|
|
810
|
+
tone: b
|
|
811
|
+
} : g?.stage === "thinking" ? { text: i("collab.member.thinking"), tone: b } : g?.stage === "responding" ? { text: i("collab.member.responding"), tone: b } : { text: i("collab.member.starting"), tone: b };
|
|
812
|
+
}
|
|
813
|
+
case "cancelled":
|
|
814
|
+
return { text: i("collab.member.cancelled"), tone: _ };
|
|
815
|
+
case "failed":
|
|
816
|
+
return {
|
|
817
|
+
text: d.error === "agent_run_stalled" ? i("collab.member.timedOut") : i("collab.member.failed"),
|
|
818
|
+
tone: _
|
|
819
|
+
};
|
|
820
|
+
default:
|
|
821
|
+
return { text: i("collab.member.done"), tone: l };
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
const Ye = tt(null);
|
|
825
|
+
function ua() {
|
|
826
|
+
const t = et(Ye);
|
|
827
|
+
return t ? /* @__PURE__ */ e("span", { className: p.composerHint, children: t }) : null;
|
|
828
|
+
}
|
|
829
|
+
function ga(t, m, i) {
|
|
830
|
+
const { description: d } = St(t.title);
|
|
831
|
+
return {
|
|
832
|
+
id: t.requestId,
|
|
833
|
+
title: t.title || i("collab.approval.title", { agent: m }),
|
|
834
|
+
content: [],
|
|
835
|
+
...d ? { rawInput: { description: d } } : {},
|
|
836
|
+
options: t.options.map(
|
|
837
|
+
(l) => ({
|
|
838
|
+
id: l.optionId,
|
|
839
|
+
label: l.name,
|
|
840
|
+
...l.kind ? { kind: l.kind } : {}
|
|
841
|
+
})
|
|
842
|
+
)
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
function pa({
|
|
846
|
+
thread: t,
|
|
847
|
+
agents: m,
|
|
848
|
+
pending: i,
|
|
849
|
+
onOpenAgentSession: d,
|
|
850
|
+
onCancelRun: l,
|
|
851
|
+
onOpenThread: _,
|
|
852
|
+
onAssign: b
|
|
853
|
+
}) {
|
|
854
|
+
const { t: g } = oe(), { live: H, past: O } = Ie(t.runs, g), M = Xe(H.length > 0), R = Je(t, m), [L, Z] = x({}), U = Ct(t.budget, g), y = t.status === "done" || t.status === "cancelled";
|
|
855
|
+
return /* @__PURE__ */ s("section", { className: p.team, "aria-label": g("collab.team.title"), children: [
|
|
856
|
+
/* @__PURE__ */ s("header", { className: p.teamHeader, children: [
|
|
857
|
+
/* @__PURE__ */ e("h2", { className: p.teamTitle, children: t.title }),
|
|
858
|
+
/* @__PURE__ */ e("p", { className: p.teamReason, children: Te(t.reason, g) }),
|
|
859
|
+
b ? /* @__PURE__ */ s("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
860
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: g("collab.form.assignee") }),
|
|
861
|
+
/* @__PURE__ */ s(Le, { children: [
|
|
862
|
+
/* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(
|
|
863
|
+
A,
|
|
864
|
+
{
|
|
865
|
+
variant: "outline",
|
|
866
|
+
size: "sm",
|
|
867
|
+
disabled: i || y,
|
|
868
|
+
"aria-label": g("collab.form.assignee"),
|
|
869
|
+
children: t.assigneeName ?? g("collab.team.noLead")
|
|
870
|
+
}
|
|
871
|
+
) }),
|
|
872
|
+
/* @__PURE__ */ s(De, { align: "start", className: "min-w-40", children: [
|
|
873
|
+
/* @__PURE__ */ s(de, { onSelect: () => b(void 0), children: [
|
|
874
|
+
t.assigneeName ? null : /* @__PURE__ */ e(we, { className: "size-4" }),
|
|
875
|
+
g("collab.team.noLead")
|
|
876
|
+
] }),
|
|
877
|
+
/* @__PURE__ */ e(Ue, {}),
|
|
878
|
+
m.filter((r) => r.enabled && !r.retiredAt).map((r) => /* @__PURE__ */ s(
|
|
879
|
+
de,
|
|
880
|
+
{
|
|
881
|
+
onSelect: () => b(r.name),
|
|
882
|
+
children: [
|
|
883
|
+
t.assigneeName === r.name ? /* @__PURE__ */ e(we, { className: "size-4" }) : null,
|
|
884
|
+
r.name
|
|
885
|
+
]
|
|
886
|
+
},
|
|
887
|
+
r.id
|
|
888
|
+
))
|
|
889
|
+
] })
|
|
890
|
+
] })
|
|
891
|
+
] }) : null,
|
|
892
|
+
t.parent && /* @__PURE__ */ e(
|
|
893
|
+
"button",
|
|
894
|
+
{
|
|
895
|
+
type: "button",
|
|
896
|
+
className: p.teamLink,
|
|
897
|
+
onClick: () => _(t.parent.id),
|
|
898
|
+
children: g("collab.team.parent", { title: t.parent.title })
|
|
899
|
+
}
|
|
900
|
+
)
|
|
901
|
+
] }),
|
|
902
|
+
t.acceptanceCriteria ? /* @__PURE__ */ s("div", { className: p.criteria, children: [
|
|
903
|
+
/* @__PURE__ */ e("h3", { className: p.sectionTitle, children: g("collab.detail.doneWhen") }),
|
|
904
|
+
/* @__PURE__ */ e("p", { className: p.criteriaText, children: t.acceptanceCriteria })
|
|
905
|
+
] }) : null,
|
|
906
|
+
/* @__PURE__ */ e("h3", { className: p.sectionTitle, children: g("collab.team.members", { count: R.length }) }),
|
|
907
|
+
R.length === 0 && /* @__PURE__ */ e("p", { className: p.muted, children: g("collab.team.empty") }),
|
|
908
|
+
/* @__PURE__ */ e("ul", { className: p.memberList, children: R.map((r) => {
|
|
909
|
+
const { text: f, tone: W } = ma(r, M, g), q = H.filter((E) => E.run.agentName === r.name), V = q.length > 0 || r.run !== void 0, $ = V && (L[r.name] ?? q.length > 0), F = r.run?.sessionId;
|
|
910
|
+
return /* @__PURE__ */ s("li", { className: p.member, children: [
|
|
911
|
+
/* @__PURE__ */ s("div", { className: p.memberHead, children: [
|
|
912
|
+
/* @__PURE__ */ s(
|
|
913
|
+
"button",
|
|
914
|
+
{
|
|
915
|
+
type: "button",
|
|
916
|
+
className: p.memberToggle,
|
|
917
|
+
"aria-expanded": V ? $ : void 0,
|
|
918
|
+
disabled: !V,
|
|
919
|
+
onClick: () => Z((E) => ({
|
|
920
|
+
...E,
|
|
921
|
+
[r.name]: !$
|
|
922
|
+
})),
|
|
923
|
+
children: [
|
|
924
|
+
/* @__PURE__ */ e(ge, { name: r.name, color: r.color }),
|
|
925
|
+
/* @__PURE__ */ s("span", { className: p.memberText, children: [
|
|
926
|
+
/* @__PURE__ */ s("span", { className: p.memberName, children: [
|
|
927
|
+
r.name,
|
|
928
|
+
r.lead && /* @__PURE__ */ e("span", { className: p.leadBadge, children: g("collab.team.lead") })
|
|
929
|
+
] }),
|
|
930
|
+
/* @__PURE__ */ e(
|
|
931
|
+
"span",
|
|
932
|
+
{
|
|
933
|
+
className: [p.memberStatus, W].filter(Boolean).join(" "),
|
|
934
|
+
children: f
|
|
935
|
+
}
|
|
936
|
+
)
|
|
937
|
+
] }),
|
|
938
|
+
V && /* @__PURE__ */ e(
|
|
939
|
+
Fe,
|
|
940
|
+
{
|
|
941
|
+
"aria-hidden": "true",
|
|
942
|
+
className: p.memberChevron
|
|
943
|
+
}
|
|
944
|
+
)
|
|
945
|
+
]
|
|
946
|
+
}
|
|
947
|
+
),
|
|
948
|
+
F && d ? /* @__PURE__ */ s(Le, { children: [
|
|
949
|
+
/* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(
|
|
950
|
+
A,
|
|
951
|
+
{
|
|
952
|
+
variant: "ghost",
|
|
953
|
+
size: "icon-xs",
|
|
954
|
+
"aria-label": g("collab.agent.more", {
|
|
955
|
+
name: r.name
|
|
956
|
+
}),
|
|
957
|
+
children: /* @__PURE__ */ e(Ve, {})
|
|
958
|
+
}
|
|
959
|
+
) }),
|
|
960
|
+
/* @__PURE__ */ e(De, { align: "end", className: "min-w-40", children: /* @__PURE__ */ e(
|
|
961
|
+
de,
|
|
962
|
+
{
|
|
963
|
+
onSelect: () => d(F),
|
|
964
|
+
children: g("collab.runRow.openSession", {
|
|
965
|
+
agent: r.name
|
|
966
|
+
})
|
|
967
|
+
}
|
|
968
|
+
) })
|
|
969
|
+
] }) : null
|
|
970
|
+
] }),
|
|
971
|
+
$ && /* @__PURE__ */ e("div", { className: p.memberDetail, children: (q.length > 0 ? q : Ie([r.run], g).past).map((E) => /* @__PURE__ */ e(
|
|
972
|
+
je,
|
|
973
|
+
{
|
|
974
|
+
row: E,
|
|
975
|
+
hideAgent: !0,
|
|
976
|
+
onOpenAgentSession: d,
|
|
977
|
+
onCancelRun: i ? void 0 : l
|
|
978
|
+
},
|
|
979
|
+
E.run.id
|
|
980
|
+
)) })
|
|
981
|
+
] }, r.name);
|
|
982
|
+
}) }),
|
|
983
|
+
!!t.children?.length && /* @__PURE__ */ s(xe, { children: [
|
|
984
|
+
/* @__PURE__ */ e("h3", { className: p.sectionTitle, children: g("collab.team.tasks", { count: t.children.length }) }),
|
|
985
|
+
/* @__PURE__ */ e("ul", { className: p.memberList, children: t.children.map((r) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
|
|
986
|
+
"button",
|
|
987
|
+
{
|
|
988
|
+
type: "button",
|
|
989
|
+
className: p.childRow,
|
|
990
|
+
onClick: () => _(r.id),
|
|
991
|
+
children: [
|
|
992
|
+
/* @__PURE__ */ e("span", { className: p.memberName, children: r.title }),
|
|
993
|
+
/* @__PURE__ */ e("span", { className: p.memberStatus, children: [r.assigneeName, Te(r.reason, g)].filter(Boolean).join(" · ") })
|
|
994
|
+
]
|
|
995
|
+
}
|
|
996
|
+
) }, r.id)) })
|
|
997
|
+
] }),
|
|
998
|
+
O.length > 0 && /* @__PURE__ */ s("details", { className: p.history, children: [
|
|
999
|
+
/* @__PURE__ */ e("summary", { className: p.sectionTitle, children: g("collab.team.history", { count: O.length }) }),
|
|
1000
|
+
O.map((r) => /* @__PURE__ */ e(
|
|
1001
|
+
je,
|
|
1002
|
+
{
|
|
1003
|
+
row: r,
|
|
1004
|
+
onOpenAgentSession: d
|
|
1005
|
+
},
|
|
1006
|
+
r.run.id
|
|
1007
|
+
))
|
|
1008
|
+
] }),
|
|
1009
|
+
/* @__PURE__ */ s("footer", { className: p.budget, children: [
|
|
1010
|
+
/* @__PURE__ */ e("span", { children: U.turns }),
|
|
1011
|
+
/* @__PURE__ */ e("span", { children: U.tokens }),
|
|
1012
|
+
/* @__PURE__ */ e("span", { children: U.scope })
|
|
1013
|
+
] })
|
|
1014
|
+
] });
|
|
1015
|
+
}
|
|
1016
|
+
function ba({
|
|
1017
|
+
thread: t,
|
|
1018
|
+
agents: m,
|
|
1019
|
+
preview: i,
|
|
1020
|
+
pending: d,
|
|
1021
|
+
onSend: l,
|
|
1022
|
+
onDraftChange: _,
|
|
1023
|
+
onOpenAgentSession: b,
|
|
1024
|
+
onCancelRun: g,
|
|
1025
|
+
onMarkDone: H,
|
|
1026
|
+
onOpenThread: O,
|
|
1027
|
+
onRespondPermission: M,
|
|
1028
|
+
onAssign: R,
|
|
1029
|
+
onBack: L,
|
|
1030
|
+
activityOnly: Z = !1,
|
|
1031
|
+
onOpenActivity: U,
|
|
1032
|
+
headerActionsContainer: y
|
|
1033
|
+
}) {
|
|
1034
|
+
const r = wt(), { t: f } = oe(), [W, q] = x(!1), [V, $] = x(/* @__PURE__ */ new Set()), [F, E] = x(!1), [X, re] = x(!0), [o, ae] = x({}), { live: C } = Ie(t.runs, f), B = Xe(C.length > 0), K = ne(() => {
|
|
1035
|
+
const c = /* @__PURE__ */ new Map();
|
|
1036
|
+
for (const a of t.runs) {
|
|
1037
|
+
const N = c.get(a.agentId);
|
|
1038
|
+
(!N || ye(a) >= ye(N)) && c.set(a.agentId, a);
|
|
1039
|
+
}
|
|
1040
|
+
return [...c.values()].filter((a) => {
|
|
1041
|
+
if (a.status !== "failed" || t.status === "done" || t.status === "cancelled")
|
|
1042
|
+
return !1;
|
|
1043
|
+
const N = m.find(
|
|
1044
|
+
(k) => k.id === a.agentId || k.name === a.agentName
|
|
1045
|
+
);
|
|
1046
|
+
return !N || !N.enabled || N.retiredAt !== void 0 ? !1 : !C.some(
|
|
1047
|
+
(k) => k.run.agentId === N.id || k.run.agentName === N.name
|
|
1048
|
+
);
|
|
1049
|
+
});
|
|
1050
|
+
}, [t.runs, t.status, C, m]), G = ne(() => {
|
|
1051
|
+
const c = /* @__PURE__ */ new Map();
|
|
1052
|
+
for (const a of m)
|
|
1053
|
+
a.color && c.set(a.name, a.color);
|
|
1054
|
+
for (const a of t.runs)
|
|
1055
|
+
a.agentColor && c.set(a.agentName, a.agentColor);
|
|
1056
|
+
return (a) => c.get(a);
|
|
1057
|
+
}, [m, t.runs]), ie = ne(() => {
|
|
1058
|
+
const c = (a, N = a) => {
|
|
1059
|
+
const k = G(a);
|
|
1060
|
+
return { name: N, ...k ? { color: k } : {} };
|
|
1061
|
+
};
|
|
1062
|
+
return [
|
|
1063
|
+
...t.body && !t.body.startsWith(Ae) ? [
|
|
1064
|
+
{
|
|
1065
|
+
id: `${t.id}:description`,
|
|
1066
|
+
role: "user",
|
|
1067
|
+
content: t.body
|
|
1068
|
+
}
|
|
1069
|
+
] : [],
|
|
1070
|
+
...t.posts.flatMap((a) => {
|
|
1071
|
+
const N = a.authorKind === "human" ? {
|
|
1072
|
+
id: a.id,
|
|
1073
|
+
role: "user",
|
|
1074
|
+
content: a.text,
|
|
1075
|
+
timestamp: a.at
|
|
1076
|
+
} : a.authorKind === "agent" ? {
|
|
1077
|
+
id: a.id,
|
|
1078
|
+
role: "assistant",
|
|
1079
|
+
content: a.text,
|
|
1080
|
+
author: c(
|
|
1081
|
+
a.authorName,
|
|
1082
|
+
a.authorDeleted ? f("collab.author.removed", {
|
|
1083
|
+
name: a.authorName
|
|
1084
|
+
}) : a.authorName
|
|
1085
|
+
),
|
|
1086
|
+
timestamp: a.at
|
|
1087
|
+
} : {
|
|
1088
|
+
id: a.id,
|
|
1089
|
+
role: "system",
|
|
1090
|
+
content: a.text,
|
|
1091
|
+
variant: "info",
|
|
1092
|
+
source: "agent_collaboration",
|
|
1093
|
+
timestamp: a.at
|
|
1094
|
+
}, k = (a.outcomes ?? []).filter(
|
|
1095
|
+
(I) => I.kind === "skip"
|
|
1096
|
+
);
|
|
1097
|
+
return [
|
|
1098
|
+
N,
|
|
1099
|
+
...k.map(
|
|
1100
|
+
(I, S) => ({
|
|
1101
|
+
id: `${a.id}:routing:${S}`,
|
|
1102
|
+
role: "system",
|
|
1103
|
+
content: Re(
|
|
1104
|
+
I.reason ?? "",
|
|
1105
|
+
I.agentName ?? "",
|
|
1106
|
+
f
|
|
1107
|
+
),
|
|
1108
|
+
variant: "warning",
|
|
1109
|
+
source: "agent_collaboration_routing",
|
|
1110
|
+
timestamp: a.at
|
|
1111
|
+
})
|
|
1112
|
+
)
|
|
1113
|
+
];
|
|
1114
|
+
}),
|
|
1115
|
+
...t.runs.filter((a) => a.progress?.thoughtText).map(
|
|
1116
|
+
(a) => ({
|
|
1117
|
+
id: `${a.id}:thought`,
|
|
1118
|
+
role: "thinking",
|
|
1119
|
+
content: a.progress.thoughtText,
|
|
1120
|
+
author: c(a.agentName),
|
|
1121
|
+
// Last update, not start: text being written now belongs
|
|
1122
|
+
// after anything the run posted along the way.
|
|
1123
|
+
timestamp: a.progress?.receivedAt ?? a.startedAt,
|
|
1124
|
+
isStreaming: a.status === "running" && a.progress?.stage === "thinking"
|
|
1125
|
+
})
|
|
1126
|
+
),
|
|
1127
|
+
...t.runs.filter(
|
|
1128
|
+
(a) => a.progress?.outputText && !t.posts.some(
|
|
1129
|
+
(N) => N.sourceRunId === a.id && N.text.trim() === a.progress?.outputText?.trim()
|
|
1130
|
+
)
|
|
1131
|
+
).map(
|
|
1132
|
+
(a) => ({
|
|
1133
|
+
id: `${a.id}:output`,
|
|
1134
|
+
role: "assistant",
|
|
1135
|
+
content: a.progress.outputText,
|
|
1136
|
+
author: c(a.agentName),
|
|
1137
|
+
// Last update, not start: text being written now belongs
|
|
1138
|
+
// after anything the run posted along the way.
|
|
1139
|
+
timestamp: a.progress?.receivedAt ?? a.startedAt,
|
|
1140
|
+
isStreaming: a.status === "running"
|
|
1141
|
+
})
|
|
1142
|
+
)
|
|
1143
|
+
].sort((a, N) => (a.timestamp ?? 0) - (N.timestamp ?? 0));
|
|
1144
|
+
}, [t.id, t.body, t.posts, t.runs, G, f]), n = ne(() => Je(t, m), [t, m]), w = ne(
|
|
1145
|
+
() => ({ ...r, renderComposerToolbarStart: ua }),
|
|
1146
|
+
[r]
|
|
1147
|
+
);
|
|
1148
|
+
if (Z)
|
|
1149
|
+
return /* @__PURE__ */ e(
|
|
1150
|
+
pa,
|
|
1151
|
+
{
|
|
1152
|
+
thread: t,
|
|
1153
|
+
agents: m,
|
|
1154
|
+
pending: d,
|
|
1155
|
+
onOpenAgentSession: b,
|
|
1156
|
+
onCancelRun: g,
|
|
1157
|
+
onOpenThread: O,
|
|
1158
|
+
...R ? { onAssign: R } : {}
|
|
1159
|
+
}
|
|
1160
|
+
);
|
|
1161
|
+
const D = /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
1162
|
+
t.status !== "done" && /* @__PURE__ */ e(
|
|
1163
|
+
A,
|
|
1164
|
+
{
|
|
1165
|
+
variant: "ghost",
|
|
1166
|
+
size: "icon",
|
|
1167
|
+
title: f("collab.markDone"),
|
|
1168
|
+
"aria-label": f("collab.markDone"),
|
|
1169
|
+
disabled: d,
|
|
1170
|
+
onClick: H,
|
|
1171
|
+
children: /* @__PURE__ */ e(we, { className: "size-4" })
|
|
1172
|
+
}
|
|
1173
|
+
),
|
|
1174
|
+
U && /* @__PURE__ */ e(
|
|
1175
|
+
A,
|
|
1176
|
+
{
|
|
1177
|
+
variant: "ghost",
|
|
1178
|
+
size: "icon",
|
|
1179
|
+
title: f("collab.team.title"),
|
|
1180
|
+
"aria-label": f("collab.team.title"),
|
|
1181
|
+
onClick: U,
|
|
1182
|
+
children: /* @__PURE__ */ e(Ee, { className: "size-4" })
|
|
1183
|
+
}
|
|
1184
|
+
)
|
|
1185
|
+
] }), j = C.flatMap(({ run: c }) => {
|
|
1186
|
+
const a = c.progress?.permission;
|
|
1187
|
+
if (!a || !c.sessionId || !M || V.has(a.requestId))
|
|
1188
|
+
return [];
|
|
1189
|
+
const N = c.sessionId;
|
|
1190
|
+
return [
|
|
1191
|
+
/* @__PURE__ */ s(
|
|
1192
|
+
"div",
|
|
1193
|
+
{
|
|
1194
|
+
role: "group",
|
|
1195
|
+
"aria-label": f("collab.approval.title", { agent: c.agentName }),
|
|
1196
|
+
className: p.approval,
|
|
1197
|
+
children: [
|
|
1198
|
+
/* @__PURE__ */ s("div", { className: p.approvalCaption, children: [
|
|
1199
|
+
/* @__PURE__ */ e(ge, { name: c.agentName, color: G(c.agentName) }),
|
|
1200
|
+
f("collab.approval.title", { agent: c.agentName })
|
|
1201
|
+
] }),
|
|
1202
|
+
/* @__PURE__ */ e(
|
|
1203
|
+
Tt,
|
|
1204
|
+
{
|
|
1205
|
+
request: ga(a, c.agentName, f),
|
|
1206
|
+
keyboardActive: !1,
|
|
1207
|
+
onConfirm: (k, I) => {
|
|
1208
|
+
$((Y) => /* @__PURE__ */ new Set([...Y, k]));
|
|
1209
|
+
const S = () => $((Y) => {
|
|
1210
|
+
const fe = new Set(Y);
|
|
1211
|
+
return fe.delete(k), fe;
|
|
1212
|
+
});
|
|
1213
|
+
M(N, k, I).then(
|
|
1214
|
+
(Y) => Y === !1 && S(),
|
|
1215
|
+
S
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
]
|
|
1221
|
+
},
|
|
1222
|
+
c.id
|
|
1223
|
+
)
|
|
1224
|
+
];
|
|
1225
|
+
}), P = C.filter(
|
|
1226
|
+
({ run: c }) => !(c.progress?.permission && c.sessionId && M && !V.has(c.progress.permission.requestId))
|
|
1227
|
+
), J = P.length > 0 || K.length > 0, ee = t.status === "blocked" || t.status === "in_review", be = i?.filter((c) => !c.willWake) ?? [], he = i ? da(i, n, f) : t.assigneeName ? f("collab.composer.hint", { name: t.assigneeName }) : null;
|
|
1228
|
+
return /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", children: [
|
|
1229
|
+
y ? Lt(D, y) : /* @__PURE__ */ s("header", { className: "flex items-center gap-2 border-b border-border px-4 py-2", children: [
|
|
1230
|
+
L && /* @__PURE__ */ e(
|
|
1231
|
+
A,
|
|
1232
|
+
{
|
|
1233
|
+
variant: "ghost",
|
|
1234
|
+
size: "icon-sm",
|
|
1235
|
+
"aria-label": f("collab.thread.back"),
|
|
1236
|
+
onClick: L,
|
|
1237
|
+
children: /* @__PURE__ */ e(Ge, {})
|
|
1238
|
+
}
|
|
1239
|
+
),
|
|
1240
|
+
/* @__PURE__ */ e("h1", { className: "min-w-0 flex-1 truncate text-sm font-semibold", children: t.title }),
|
|
1241
|
+
D
|
|
1242
|
+
] }),
|
|
1243
|
+
t.body.startsWith(Ae) && /* @__PURE__ */ s("div", { className: p.context, children: [
|
|
1244
|
+
/* @__PURE__ */ s(
|
|
1245
|
+
"button",
|
|
1246
|
+
{
|
|
1247
|
+
type: "button",
|
|
1248
|
+
className: T.summary,
|
|
1249
|
+
"aria-expanded": F,
|
|
1250
|
+
onClick: () => E((c) => !c),
|
|
1251
|
+
children: [
|
|
1252
|
+
/* @__PURE__ */ e("span", { className: T.summaryText, children: f("collab.thread.context") }),
|
|
1253
|
+
/* @__PURE__ */ e(
|
|
1254
|
+
"span",
|
|
1255
|
+
{
|
|
1256
|
+
className: `${F ? T.chevronDown : T.chevronRight} ${p.chevronShown}`,
|
|
1257
|
+
"aria-hidden": "true"
|
|
1258
|
+
}
|
|
1259
|
+
)
|
|
1260
|
+
]
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
F && /* @__PURE__ */ e("div", { className: `${T.group} ${p.contextBody}`, children: t.body.slice(Ae.length) })
|
|
1264
|
+
] }),
|
|
1265
|
+
/* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ e(
|
|
1266
|
+
Oe,
|
|
1267
|
+
{
|
|
1268
|
+
value: { ...r, collapseCompletedTurns: !1 },
|
|
1269
|
+
children: /* @__PURE__ */ e(
|
|
1270
|
+
yt,
|
|
1271
|
+
{
|
|
1272
|
+
messages: ie,
|
|
1273
|
+
pendingApproval: null,
|
|
1274
|
+
sessionKey: t.id,
|
|
1275
|
+
hideSessionTimeline: !0
|
|
1276
|
+
}
|
|
1277
|
+
)
|
|
1278
|
+
}
|
|
1279
|
+
) }),
|
|
1280
|
+
/* @__PURE__ */ s("div", { className: p.dock, children: [
|
|
1281
|
+
/* @__PURE__ */ s("div", { className: T.wrap, children: [
|
|
1282
|
+
/* @__PURE__ */ s(
|
|
1283
|
+
"button",
|
|
1284
|
+
{
|
|
1285
|
+
type: "button",
|
|
1286
|
+
className: T.summary,
|
|
1287
|
+
"aria-expanded": J ? X : void 0,
|
|
1288
|
+
"aria-disabled": J ? void 0 : !0,
|
|
1289
|
+
onClick: J ? () => re((c) => !c) : void 0,
|
|
1290
|
+
children: [
|
|
1291
|
+
/* @__PURE__ */ e("span", { className: T.summaryIcon, "aria-hidden": "true", children: /* @__PURE__ */ e(Ee, { className: "size-3.5" }) }),
|
|
1292
|
+
/* @__PURE__ */ e(
|
|
1293
|
+
"span",
|
|
1294
|
+
{
|
|
1295
|
+
className: P.length > 0 ? `${T.summaryText} ${T.summaryTextActive}` : ee ? `${T.summaryText} ${p.attention}` : T.summaryText,
|
|
1296
|
+
children: Te(t.reason, f)
|
|
1297
|
+
}
|
|
1298
|
+
),
|
|
1299
|
+
/* @__PURE__ */ e(
|
|
1300
|
+
"span",
|
|
1301
|
+
{
|
|
1302
|
+
className: X ? T.chevronDown : T.chevronRight,
|
|
1303
|
+
"aria-hidden": "true"
|
|
1304
|
+
}
|
|
1305
|
+
)
|
|
1306
|
+
]
|
|
1307
|
+
}
|
|
1308
|
+
),
|
|
1309
|
+
J && X && /* @__PURE__ */ e("div", { className: T.group, children: /* @__PURE__ */ s("div", { className: T.list, children: [
|
|
1310
|
+
P.map(({ run: c }) => {
|
|
1311
|
+
const a = ia(c, B, f), N = a.stalled && B >= (o[c.id] ?? 0), k = N ? a.text : a.stalled ? f("collab.run.working", {
|
|
1312
|
+
agent: c.agentName,
|
|
1313
|
+
elapsed: pe(
|
|
1314
|
+
B - (c.startedAt ?? B),
|
|
1315
|
+
f
|
|
1316
|
+
)
|
|
1317
|
+
}) : a.text, I = c.progress?.steps ?? [];
|
|
1318
|
+
return /* @__PURE__ */ s("div", { children: [
|
|
1319
|
+
/* @__PURE__ */ s(
|
|
1320
|
+
"div",
|
|
1321
|
+
{
|
|
1322
|
+
role: "status",
|
|
1323
|
+
className: `${T.row} ${p.row}`,
|
|
1324
|
+
"data-agent-status": N ? "failed" : "active",
|
|
1325
|
+
children: [
|
|
1326
|
+
/* @__PURE__ */ e(
|
|
1327
|
+
ge,
|
|
1328
|
+
{
|
|
1329
|
+
name: c.agentName,
|
|
1330
|
+
color: G(c.agentName)
|
|
1331
|
+
}
|
|
1332
|
+
),
|
|
1333
|
+
/* @__PURE__ */ e("span", { className: T.rowText, children: /* @__PURE__ */ e(
|
|
1334
|
+
"span",
|
|
1335
|
+
{
|
|
1336
|
+
className: `${T.rowActivity} ${N ? p.attention : p.rowText}`,
|
|
1337
|
+
children: k
|
|
1338
|
+
}
|
|
1339
|
+
) }),
|
|
1340
|
+
N && /* @__PURE__ */ e(
|
|
1341
|
+
A,
|
|
1342
|
+
{
|
|
1343
|
+
size: "xs",
|
|
1344
|
+
variant: "ghost",
|
|
1345
|
+
onClick: () => ae((S) => ({
|
|
1346
|
+
...S,
|
|
1347
|
+
[c.id]: B + He
|
|
1348
|
+
})),
|
|
1349
|
+
children: f("collab.run.keepWaiting")
|
|
1350
|
+
}
|
|
1351
|
+
),
|
|
1352
|
+
(N || c.status === "queued") && !d && /* @__PURE__ */ e(
|
|
1353
|
+
A,
|
|
1354
|
+
{
|
|
1355
|
+
size: "xs",
|
|
1356
|
+
variant: "ghost",
|
|
1357
|
+
onClick: () => g(c.id),
|
|
1358
|
+
children: f("collab.run.stop")
|
|
1359
|
+
}
|
|
1360
|
+
)
|
|
1361
|
+
]
|
|
1362
|
+
}
|
|
1363
|
+
),
|
|
1364
|
+
I.length > 0 && // One line per tool call, like a CI job's step list.
|
|
1365
|
+
/* @__PURE__ */ e(
|
|
1366
|
+
"ol",
|
|
1367
|
+
{
|
|
1368
|
+
"aria-label": f("collab.run.steps", {
|
|
1369
|
+
agent: c.agentName
|
|
1370
|
+
}),
|
|
1371
|
+
className: p.steps,
|
|
1372
|
+
children: I.map((S) => /* @__PURE__ */ s("li", { className: p.step, children: [
|
|
1373
|
+
S.status === "running" ? /* @__PURE__ */ e(
|
|
1374
|
+
ze,
|
|
1375
|
+
{
|
|
1376
|
+
"aria-label": f("collab.step.running"),
|
|
1377
|
+
className: "size-3 shrink-0 animate-spin motion-reduce:animate-none"
|
|
1378
|
+
}
|
|
1379
|
+
) : S.status === "done" ? /* @__PURE__ */ e(
|
|
1380
|
+
we,
|
|
1381
|
+
{
|
|
1382
|
+
"aria-label": f("collab.step.done"),
|
|
1383
|
+
className: "size-3 shrink-0 text-[var(--success-color)]"
|
|
1384
|
+
}
|
|
1385
|
+
) : /* @__PURE__ */ e(
|
|
1386
|
+
at,
|
|
1387
|
+
{
|
|
1388
|
+
"aria-label": f("collab.step.failed"),
|
|
1389
|
+
className: "size-3 shrink-0 text-destructive"
|
|
1390
|
+
}
|
|
1391
|
+
),
|
|
1392
|
+
/* @__PURE__ */ e(
|
|
1393
|
+
"span",
|
|
1394
|
+
{
|
|
1395
|
+
className: S.status === "running" ? `${p.stepText} text-foreground` : p.stepText,
|
|
1396
|
+
children: S.title || f("collab.step.untitled")
|
|
1397
|
+
}
|
|
1398
|
+
)
|
|
1399
|
+
] }, S.id))
|
|
1400
|
+
}
|
|
1401
|
+
)
|
|
1402
|
+
] }, c.id);
|
|
1403
|
+
}),
|
|
1404
|
+
K.map((c) => /* @__PURE__ */ s(
|
|
1405
|
+
"div",
|
|
1406
|
+
{
|
|
1407
|
+
role: "status",
|
|
1408
|
+
className: `${T.row} ${p.row}`,
|
|
1409
|
+
"data-agent-status": "failed",
|
|
1410
|
+
children: [
|
|
1411
|
+
/* @__PURE__ */ e(
|
|
1412
|
+
ge,
|
|
1413
|
+
{
|
|
1414
|
+
name: c.agentName,
|
|
1415
|
+
color: G(c.agentName)
|
|
1416
|
+
}
|
|
1417
|
+
),
|
|
1418
|
+
/* @__PURE__ */ e("span", { className: T.rowText, children: /* @__PURE__ */ e(
|
|
1419
|
+
"span",
|
|
1420
|
+
{
|
|
1421
|
+
className: `${T.rowActivity} ${p.attention}`,
|
|
1422
|
+
children: c.error === "agent_run_stalled" ? f("collab.run.timedOut", { agent: c.agentName }) : f("collab.run.failed", { agent: c.agentName })
|
|
1423
|
+
}
|
|
1424
|
+
) }),
|
|
1425
|
+
!d && /* @__PURE__ */ e(
|
|
1426
|
+
A,
|
|
1427
|
+
{
|
|
1428
|
+
size: "xs",
|
|
1429
|
+
variant: "ghost",
|
|
1430
|
+
onClick: () => void l(
|
|
1431
|
+
`@${c.agentName} ${f("collab.run.retryPrompt")}`
|
|
1432
|
+
),
|
|
1433
|
+
children: f("collab.run.retry")
|
|
1434
|
+
}
|
|
1435
|
+
)
|
|
1436
|
+
]
|
|
1437
|
+
},
|
|
1438
|
+
c.id
|
|
1439
|
+
))
|
|
1440
|
+
] }) })
|
|
1441
|
+
] }),
|
|
1442
|
+
j,
|
|
1443
|
+
W && /* @__PURE__ */ s("div", { role: "status", className: p.note, children: [
|
|
1444
|
+
/* @__PURE__ */ e(
|
|
1445
|
+
ze,
|
|
1446
|
+
{
|
|
1447
|
+
"aria-hidden": "true",
|
|
1448
|
+
className: "size-3.5 animate-spin motion-reduce:animate-none"
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
f("collab.sending")
|
|
1452
|
+
] }),
|
|
1453
|
+
be.length > 0 && /* @__PURE__ */ e("div", { role: "status", className: p.note, children: be.map((c) => /* @__PURE__ */ e("p", { children: Re(c.reason ?? "", c.agentName, f) }, `${c.agentName}:${c.reason}`)) }),
|
|
1454
|
+
/* @__PURE__ */ e(Ye.Provider, { value: he, children: /* @__PURE__ */ e(Oe, { value: w, children: /* @__PURE__ */ e(
|
|
1455
|
+
kt,
|
|
1456
|
+
{
|
|
1457
|
+
commands: [],
|
|
1458
|
+
builtinAtProviders: !1,
|
|
1459
|
+
visibleToolbarActions: [],
|
|
1460
|
+
atProviders: [
|
|
1461
|
+
{
|
|
1462
|
+
id: "agents",
|
|
1463
|
+
label: f("collab.mention.provider"),
|
|
1464
|
+
search: async ({ query: c }) => m.filter(
|
|
1465
|
+
(a) => a.enabled && !a.retiredAt && a.name.toLowerCase().includes(c.toLowerCase())
|
|
1466
|
+
).map((a) => ({
|
|
1467
|
+
id: a.id,
|
|
1468
|
+
label: a.name,
|
|
1469
|
+
insertText: `@${a.name} `
|
|
1470
|
+
}))
|
|
1471
|
+
}
|
|
1472
|
+
],
|
|
1473
|
+
placeholderText: f("collab.composer.placeholder"),
|
|
1474
|
+
disabled: d || t.status === "done" || t.status === "cancelled",
|
|
1475
|
+
onInputTextChange: _,
|
|
1476
|
+
onSubmit: (c, a, N, k) => (a?.length || N?.length || !c.trim() || (q(!0), l(c).then((I) => {
|
|
1477
|
+
I && k?.();
|
|
1478
|
+
}).finally(() => q(!1))), !1)
|
|
1479
|
+
}
|
|
1480
|
+
) }) })
|
|
1481
|
+
] })
|
|
1482
|
+
] });
|
|
1483
|
+
}
|
|
1484
|
+
function ha(t, m) {
|
|
1485
|
+
if (!t || t.id !== m.threadId) return t;
|
|
1486
|
+
let i = !1;
|
|
1487
|
+
const d = t.runs.map((l) => l.id !== m.runId || (l.progress?.attempt ?? 0) > m.attempt ? l : (i = !0, {
|
|
1488
|
+
...l,
|
|
1489
|
+
status: l.status === "queued" ? "running" : l.status,
|
|
1490
|
+
progress: {
|
|
1491
|
+
attempt: m.attempt,
|
|
1492
|
+
// The daemon stamps `receivedAt` with its own clock and `ThreadChat`
|
|
1493
|
+
// sorts it against daemon-written `post.at` / `run.startedAt`. Using the
|
|
1494
|
+
// browser clock here would order one transcript by two clocks, which a
|
|
1495
|
+
// remote daemon makes visible. `activityAt` is refreshed by the daemon
|
|
1496
|
+
// on exactly this frame, so it is the same instant on the same clock.
|
|
1497
|
+
receivedAt: m.activityAt,
|
|
1498
|
+
activityAt: m.activityAt,
|
|
1499
|
+
stage: m.stage,
|
|
1500
|
+
detail: m.detail,
|
|
1501
|
+
outputText: m.outputText,
|
|
1502
|
+
thoughtText: m.thoughtText,
|
|
1503
|
+
...m.permission ? { permission: m.permission } : {},
|
|
1504
|
+
...m.steps ? { steps: m.steps } : {}
|
|
1505
|
+
}
|
|
1506
|
+
}));
|
|
1507
|
+
return i ? { ...t, runs: d } : t;
|
|
1508
|
+
}
|
|
1509
|
+
const fa = 250, _a = 1e3, va = 150;
|
|
1510
|
+
function Sa({
|
|
1511
|
+
initialView: t,
|
|
1512
|
+
initialThreadId: m,
|
|
1513
|
+
workspaceCwd: i,
|
|
1514
|
+
chat: d = !1,
|
|
1515
|
+
activityOnly: l = !1,
|
|
1516
|
+
onOpenActivity: _,
|
|
1517
|
+
headerActionsContainer: b,
|
|
1518
|
+
onTitleChange: g,
|
|
1519
|
+
onOpenThreadChat: H,
|
|
1520
|
+
onOpenAgentSession: O,
|
|
1521
|
+
onOpenDefinitions: M
|
|
1522
|
+
}) {
|
|
1523
|
+
const R = st(), L = lt(), [Z, U] = x(), y = i ?? Z ?? L.workspaceCwd ?? R.capabilities?.workspaces?.find((u) => u.primary)?.cwd, r = ne(
|
|
1524
|
+
() => y ? At(R.baseUrl, R.token, y) : void 0,
|
|
1525
|
+
[R.baseUrl, R.token, y]
|
|
1526
|
+
), { t: f } = oe(), [W, q] = x([]), [V, $] = x(
|
|
1527
|
+
t === void 0 || t === "new-agent" ? "agents" : t
|
|
1528
|
+
), [F, E] = x(), [X, re] = x([]), [o, ae] = x(m), [C, B] = x();
|
|
1529
|
+
le(() => {
|
|
1530
|
+
d && !l && C && g?.(C.id, C.title);
|
|
1531
|
+
}, [d, l, C, g]);
|
|
1532
|
+
const [K, G] = x(""), [ie, n] = x(), [w, D] = x(), [j, P] = x(!1), [J, ee] = x(
|
|
1533
|
+
t === "new-agent"
|
|
1534
|
+
), [be, he] = x(), [c, a] = x(), N = c ?? be, k = ce(K);
|
|
1535
|
+
k.current = K;
|
|
1536
|
+
const I = ce(void 0), S = ne(() => ({ client: r, openId: o }), [r, o]), Y = ce(S);
|
|
1537
|
+
Y.current = S;
|
|
1538
|
+
const fe = ce(0), _e = ce(0);
|
|
1539
|
+
le(() => {
|
|
1540
|
+
t && t !== "new-agent" && $(t);
|
|
1541
|
+
}, [t]);
|
|
1542
|
+
const me = (u) => {
|
|
1543
|
+
ae(u), B(void 0), G(""), n(void 0), a(void 0);
|
|
1544
|
+
}, se = Ce(async () => {
|
|
1545
|
+
if (!r) return;
|
|
1546
|
+
const u = ++fe.current;
|
|
1547
|
+
try {
|
|
1548
|
+
const [v, te, ue] = await Promise.all([
|
|
1549
|
+
r.listAgents(),
|
|
1550
|
+
r.listThreads(),
|
|
1551
|
+
o ? r.getThread(o) : void 0
|
|
1552
|
+
]);
|
|
1553
|
+
if (Y.current !== S || u < _e.current)
|
|
1554
|
+
return;
|
|
1555
|
+
_e.current = u, q(v.agents), v.capabilities && E(v.capabilities), re(te.threads), B(ue), he(void 0);
|
|
1556
|
+
} catch (v) {
|
|
1557
|
+
if (Y.current !== S || u < _e.current)
|
|
1558
|
+
return;
|
|
1559
|
+
_e.current = u, he(v instanceof Error ? v.message : String(v));
|
|
1560
|
+
}
|
|
1561
|
+
}, [r, o, S]), ke = ce(se);
|
|
1562
|
+
ke.current = se, le(() => {
|
|
1563
|
+
se();
|
|
1564
|
+
}, [se]), le(() => {
|
|
1565
|
+
if (!r) return;
|
|
1566
|
+
let u, v;
|
|
1567
|
+
const te = () => {
|
|
1568
|
+
u ??= setInterval(() => void ke.current(), _a);
|
|
1569
|
+
};
|
|
1570
|
+
if (!r.subscribe)
|
|
1571
|
+
return te(), () => clearInterval(u);
|
|
1572
|
+
const ue = r.subscribe(
|
|
1573
|
+
(ve) => {
|
|
1574
|
+
if (ve.type === "progress") {
|
|
1575
|
+
B((Ze) => ha(Ze, ve));
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
v ??= setTimeout(() => {
|
|
1579
|
+
v = void 0, ke.current();
|
|
1580
|
+
}, va);
|
|
1581
|
+
},
|
|
1582
|
+
(ve) => {
|
|
1583
|
+
if (ve === "closed") {
|
|
1584
|
+
te();
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
clearInterval(u), u = void 0;
|
|
1588
|
+
}
|
|
1589
|
+
);
|
|
1590
|
+
return () => {
|
|
1591
|
+
ue(), clearInterval(u), clearTimeout(v);
|
|
1592
|
+
};
|
|
1593
|
+
}, [r]), le(() => {
|
|
1594
|
+
if (!r || !o || !K.trim()) {
|
|
1595
|
+
n(void 0);
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
const u = K;
|
|
1599
|
+
let v = !1;
|
|
1600
|
+
const te = setTimeout(() => {
|
|
1601
|
+
r.previewReply(o, u).then((ue) => {
|
|
1602
|
+
!v && k.current === u && n(ue.targets);
|
|
1603
|
+
}).catch(() => {
|
|
1604
|
+
v || n(void 0);
|
|
1605
|
+
});
|
|
1606
|
+
}, fa);
|
|
1607
|
+
return () => {
|
|
1608
|
+
v = !0, clearTimeout(te);
|
|
1609
|
+
};
|
|
1610
|
+
}, [r, K, o]);
|
|
1611
|
+
const Qe = Ce(
|
|
1612
|
+
(u) => {
|
|
1613
|
+
I.current = u, D(void 0), r && r.previewThread(u).then((v) => {
|
|
1614
|
+
I.current === u && D(v.targets);
|
|
1615
|
+
}).catch(() => {
|
|
1616
|
+
I.current === u && D(void 0);
|
|
1617
|
+
});
|
|
1618
|
+
},
|
|
1619
|
+
[r]
|
|
1620
|
+
), Q = Ce(
|
|
1621
|
+
async (u) => {
|
|
1622
|
+
P(!0), a(void 0);
|
|
1623
|
+
try {
|
|
1624
|
+
const v = await u();
|
|
1625
|
+
await se(), v !== null && typeof v == "object" && "dispatchError" in v && typeof v.dispatchError == "string" && a(
|
|
1626
|
+
f("collab.error.dispatchAfterSave", {
|
|
1627
|
+
error: v.dispatchError
|
|
1628
|
+
})
|
|
1629
|
+
);
|
|
1630
|
+
} catch (v) {
|
|
1631
|
+
return a(v instanceof Error ? v.message : String(v)), !1;
|
|
1632
|
+
} finally {
|
|
1633
|
+
P(!1);
|
|
1634
|
+
}
|
|
1635
|
+
return !0;
|
|
1636
|
+
},
|
|
1637
|
+
[se, f]
|
|
1638
|
+
);
|
|
1639
|
+
return r ? J ? /* @__PURE__ */ e(
|
|
1640
|
+
Rt,
|
|
1641
|
+
{
|
|
1642
|
+
initialScope: "workspace",
|
|
1643
|
+
workspaceCwd: y,
|
|
1644
|
+
onCancel: () => ee(!1),
|
|
1645
|
+
onCreated: () => ee(!1),
|
|
1646
|
+
onSaveWorkspaceAgent: async (u) => {
|
|
1647
|
+
await r.createAgent(u), await se();
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
) : o && C?.id !== o ? /* @__PURE__ */ s("div", { className: "flex flex-col items-start gap-2 p-4", children: [
|
|
1651
|
+
d ? null : /* @__PURE__ */ s(A, { variant: "ghost", size: "sm", onClick: () => me(), children: [
|
|
1652
|
+
/* @__PURE__ */ e(Ge, { "data-icon": "inline-start" }),
|
|
1653
|
+
f("collab.thread.back")
|
|
1654
|
+
] }),
|
|
1655
|
+
/* @__PURE__ */ e("p", { role: "status", className: "text-sm text-muted-foreground", children: N ?? f("collab.thread.loading") })
|
|
1656
|
+
] }) : o && C ? /* @__PURE__ */ s(xe, { children: [
|
|
1657
|
+
N && /* @__PURE__ */ e("p", { role: "alert", className: "px-4 py-2 text-sm text-destructive", children: N }),
|
|
1658
|
+
/* @__PURE__ */ e(
|
|
1659
|
+
ba,
|
|
1660
|
+
{
|
|
1661
|
+
activityOnly: l,
|
|
1662
|
+
headerActionsContainer: b,
|
|
1663
|
+
...d ? {} : { onBack: () => me() },
|
|
1664
|
+
onOpenActivity: _ && y ? () => _(C.id, y) : void 0,
|
|
1665
|
+
thread: C,
|
|
1666
|
+
agents: W,
|
|
1667
|
+
preview: ie,
|
|
1668
|
+
pending: j,
|
|
1669
|
+
onDraftChange: G,
|
|
1670
|
+
onAssign: (u) => void Q(() => r.assignThread(o, u)),
|
|
1671
|
+
onOpenAgentSession: O,
|
|
1672
|
+
onCancelRun: (u) => void Q(() => r.cancelRun(o, u)),
|
|
1673
|
+
onMarkDone: () => void Q(() => r.markDone(o)),
|
|
1674
|
+
...r.respondToPermission ? {
|
|
1675
|
+
onRespondPermission: (u, v, te) => Q(
|
|
1676
|
+
() => r.respondToPermission(u, v, te)
|
|
1677
|
+
)
|
|
1678
|
+
} : {},
|
|
1679
|
+
onOpenThread: (u) => {
|
|
1680
|
+
y && H ? H(u, y) : me(u);
|
|
1681
|
+
},
|
|
1682
|
+
onSend: (u) => Q(async () => {
|
|
1683
|
+
const v = await r.postReply(o, u);
|
|
1684
|
+
return G(""), n(void 0), v;
|
|
1685
|
+
})
|
|
1686
|
+
},
|
|
1687
|
+
C.id
|
|
1688
|
+
)
|
|
1689
|
+
] }) : /* @__PURE__ */ s(xe, { children: [
|
|
1690
|
+
N ? /* @__PURE__ */ e("p", { role: "alert", className: "mb-3 text-sm text-destructive", children: N }) : null,
|
|
1691
|
+
/* @__PURE__ */ e(
|
|
1692
|
+
un,
|
|
1693
|
+
{
|
|
1694
|
+
agents: W,
|
|
1695
|
+
threads: X,
|
|
1696
|
+
view: V,
|
|
1697
|
+
onViewChange: $,
|
|
1698
|
+
createPreview: w,
|
|
1699
|
+
pending: j,
|
|
1700
|
+
onOpenThread: (u) => {
|
|
1701
|
+
y && H ? H(u, y) : me(u);
|
|
1702
|
+
},
|
|
1703
|
+
onDeleteAgent: (u) => void Q(() => r.deleteAgent(u)),
|
|
1704
|
+
onSetAgentEnabled: (u, v) => void Q(() => r.setAgentEnabled(u, v)),
|
|
1705
|
+
onUpdateAgent: (u, v) => void Q(() => r.updateAgent(u, v)),
|
|
1706
|
+
onOpenAgentBuilder: () => ee(!0),
|
|
1707
|
+
...M ? { onOpenDefinitions: M } : {},
|
|
1708
|
+
...F ? { capabilities: F } : {},
|
|
1709
|
+
workspaceCwd: y,
|
|
1710
|
+
workspaces: R.capabilities?.workspaces ?? [],
|
|
1711
|
+
onWorkspaceChange: (u) => {
|
|
1712
|
+
U(u), q([]), D(void 0), I.current = void 0;
|
|
1713
|
+
},
|
|
1714
|
+
createError: N,
|
|
1715
|
+
onCreateThread: (u) => Q(async () => {
|
|
1716
|
+
const v = await r.createThread(u);
|
|
1717
|
+
return D(void 0), me(v.id), y && H?.(v.id, y), v;
|
|
1718
|
+
}),
|
|
1719
|
+
onPreviewThread: Qe
|
|
1720
|
+
}
|
|
1721
|
+
)
|
|
1722
|
+
] }) : /* @__PURE__ */ e("p", { role: "alert", children: f("collab.noWorkspace") });
|
|
1723
|
+
}
|
|
1724
|
+
export {
|
|
1725
|
+
Sa as ThreadsRoute
|
|
1726
|
+
};
|