@qwen-code/web-shell 0.25.0 → 0.25.1-preview.1
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/dist/agents-route-DAa1HKQE.js +1546 -0
- package/dist/daemon-react-sdk.js +1 -1
- package/dist/{index-tVJkU24-.js → index-zUj3SlrB.js} +45814 -44258
- package/dist/index.js +22 -22
- package/dist/sw.js +1 -1
- package/dist/{toolNames-CAeFJ9L9.js → toolNames-B_KiYcXs.js} +3679 -3764
- package/dist/transcript.js +9608 -9312
- package/dist/types/adapters/messageTypes.d.ts +8 -1
- package/dist/types/adapters/transcriptAdapter.d.ts +1 -0
- package/dist/types/components/ChatContextHeader.d.ts +3 -1
- package/dist/types/components/agents/AgentCreatePage.d.ts +7 -1
- package/dist/types/components/agents/AgentsManagerPage.d.ts +4 -5
- package/dist/types/components/artifacts/ArtifactPanel.d.ts +1 -8
- package/dist/types/components/artifacts/TrajectoryFilters.d.ts +15 -0
- package/dist/types/components/artifacts/TrajectoryInspector.d.ts +3 -1
- package/dist/types/components/managed/generated/managed-agent-api.d.ts +191 -9
- package/dist/types/components/managed/java-managed-agent-client.d.ts +3 -1
- package/dist/types/components/managed/managed-agent-provider.d.ts +9 -0
- package/dist/types/components/messages/AssistantMessage.d.ts +3 -1
- package/dist/types/components/messages/UserMessage.d.ts +3 -1
- package/dist/types/components/messages/agent-message-details.d.ts +36 -0
- package/dist/types/components/messages/squad-tag.d.ts +16 -0
- package/dist/types/components/sidebar/WebShellSidebar.d.ts +2 -4
- package/dist/types/components/sidebar/WorkspaceSection.d.ts +1 -2
- package/dist/types/components/workspace-agents/ThreadsPage.d.ts +31 -55
- package/dist/types/components/workspace-agents/add-runtime-dialog.d.ts +34 -5
- package/dist/types/components/workspace-agents/agent-events.d.ts +4 -34
- package/dist/types/components/workspace-agents/agents-route.d.ts +19 -0
- package/dist/types/components/workspace-agents/agents-view-logic.d.ts +14 -163
- package/dist/types/components/workspace-agents/lazy-agents-route.d.ts +7 -0
- package/dist/types/components/workspace-agents/messages.d.ts +2 -2
- package/dist/types/components/workspace-agents/session-agent-live-runs.d.ts +96 -0
- package/dist/types/components/workspace-agents/session-agents-api.d.ts +39 -0
- package/dist/types/components/workspace-agents/squads-section.d.ts +28 -0
- package/dist/types/components/workspace-agents/threads-api.d.ts +25 -36
- package/dist/types/components/workspace-agents/use-session-agent-runs.d.ts +66 -0
- package/dist/types/components/workspace-agents/useAgentChatEntry.d.ts +74 -10
- package/dist/types/components/workspaces/WorkspaceHostProjects.d.ts +11 -0
- package/dist/types/components/workspaces/WorkspaceLocation.d.ts +7 -0
- package/dist/types/config/workspace-hosts.d.ts +11 -0
- package/dist/types/daemon/session/types.d.ts +19 -3
- package/dist/types/trajectory/filter-messages.d.ts +9 -0
- package/dist/types/trajectory/filter-messages.transcript-stub.d.ts +7 -0
- package/dist/types/trajectory/filterTrajectory.d.ts +22 -0
- package/dist/types/utils/cancelledTurn.d.ts +17 -0
- package/package.json +2 -1
- package/dist/ThreadsRoute-CtecWS_K.js +0 -2358
- package/dist/types/components/workspace-agents/LazyThreadsRoute.d.ts +0 -7
- package/dist/types/components/workspace-agents/ThreadChat.d.ts +0 -35
- package/dist/types/components/workspace-agents/ThreadView.d.ts +0 -72
- package/dist/types/components/workspace-agents/ThreadsRoute.d.ts +0 -23
- package/dist/types/components/workspace-agents/useProjectConversations.d.ts +0 -10
|
@@ -0,0 +1,1546 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useMemo as le, useEffect as re, useRef as ne, useId as Ke, useCallback as me } from "react";
|
|
3
|
+
import { W as F, T as Ve, m as Qe } from "./toolNames-B_KiYcXs.js";
|
|
4
|
+
import "@qwen-code/sdk/daemon";
|
|
5
|
+
import { CheckCircle2 as we, LoaderCircle as Ze, CopyIcon as qe, UsersIcon as Ie, MoreHorizontalIcon as Ae, PlusIcon as oe, ServerIcon as Xe } from "lucide-react";
|
|
6
|
+
import { D as ye, a as Le, b as He, c as $e, d as De, r as ae, p as se, I as ee, e as Te, B as _, w as Me, f as je, C as be, g as Ee, h as fe, i as ze, j as Ue, k as Pe, l as Fe, m as te, n as We, E as pe, o as ge, q as xe, s as ve, A as Ne, T as Ye, t as et, u as tt, v as ke, x as nt, y as at } from "./index-zUj3SlrB.js";
|
|
7
|
+
const lt = /^[A-Za-z0-9_-]{1,256}$/;
|
|
8
|
+
function rt(r) {
|
|
9
|
+
let s;
|
|
10
|
+
try {
|
|
11
|
+
s = new URL(r.trim());
|
|
12
|
+
} catch {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const m = s.pathname.lastIndexOf("/join/"), [g, ...u] = m >= 0 ? s.pathname.slice(m + 6).split("/") : [];
|
|
16
|
+
if (s.protocol !== "http:" && s.protocol !== "https:" || s.username || s.password || s.search || s.hash || !g || u.some(Boolean) || !lt.test(g))
|
|
17
|
+
return;
|
|
18
|
+
const f = s.pathname.slice(0, m).replace(/\/+$/, "");
|
|
19
|
+
return { serverUrl: `${s.origin}${f}`, workspaceId: g };
|
|
20
|
+
}
|
|
21
|
+
function ot(r, s, m) {
|
|
22
|
+
return `QWEN_AGENT_HOST_ENROLLMENT_TOKEN=${ce("<token>")} qwen agents join ${ce(r.trim())}${m ? " --allow-http" : ""}`;
|
|
23
|
+
}
|
|
24
|
+
function st(r, s, m, g) {
|
|
25
|
+
if (!r.some((u) => u.id === m))
|
|
26
|
+
return r.find(
|
|
27
|
+
(u) => u.kind === "external" && u.status === "online" && (g ? u.id === g : !s.has(u.id))
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function Ce(r) {
|
|
31
|
+
return new Set(
|
|
32
|
+
r.filter((s) => s.status === "online").map((s) => s.id)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const Be = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
|
|
36
|
+
function ce(r) {
|
|
37
|
+
return `'${r.replaceAll("'", `'"'"'`)}'`;
|
|
38
|
+
}
|
|
39
|
+
function Oe(r) {
|
|
40
|
+
const s = new URL(r);
|
|
41
|
+
if (!["http:", "https:"].includes(s.protocol) || s.username || s.password || s.search || s.hash)
|
|
42
|
+
throw new Error("Invalid coordinator address.");
|
|
43
|
+
return s;
|
|
44
|
+
}
|
|
45
|
+
function it(r, s) {
|
|
46
|
+
const m = Oe(r), u = `${`${m.origin}${m.pathname.replace(/\/+$/, "")}`}/join/${encodeURIComponent(s.workspaceId)}`, f = m.protocol === "http:" && !Be.has(m.hostname), x = `QWEN_AGENT_HOST_ENROLLMENT_TOKEN=${ce(s.token)}`, v = `serve --no-web --port 0 --join ${ce(u)}${f ? " --agent-host-allow-http" : ""}`;
|
|
47
|
+
return {
|
|
48
|
+
qwen: `${x} qwen ${v}`,
|
|
49
|
+
npx: `${x} npx -y @qwen-code/qwen-code@latest ${v}`,
|
|
50
|
+
insecure: f
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function ue({ text: r }) {
|
|
54
|
+
const { t: s } = F(), [m, g] = p(!1);
|
|
55
|
+
return /* @__PURE__ */ n("div", { className: "flex items-center gap-2 rounded-md border border-border bg-muted/40 py-1.5 pr-1.5 pl-3", children: [
|
|
56
|
+
/* @__PURE__ */ e("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: r }),
|
|
57
|
+
/* @__PURE__ */ n(
|
|
58
|
+
_,
|
|
59
|
+
{
|
|
60
|
+
size: "sm",
|
|
61
|
+
variant: "outline",
|
|
62
|
+
onClick: () => {
|
|
63
|
+
Me(r).then(
|
|
64
|
+
() => g(!0),
|
|
65
|
+
(u) => je(u)
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ e(qe, { "aria-hidden": "true" }),
|
|
70
|
+
s(m ? "collab.runtime.copied" : "collab.runtime.copy")
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
function ct({
|
|
77
|
+
open: r,
|
|
78
|
+
onOpenChange: s,
|
|
79
|
+
serverUrl: m,
|
|
80
|
+
runtimes: g,
|
|
81
|
+
onCreateJoinToken: u,
|
|
82
|
+
onConnectExisting: f,
|
|
83
|
+
onJoinCoordinator: x,
|
|
84
|
+
onCreateAgentOn: v,
|
|
85
|
+
replacementTarget: b
|
|
86
|
+
}) {
|
|
87
|
+
const { t: a } = F(), [N, $] = p(
|
|
88
|
+
"command"
|
|
89
|
+
), [S, A] = p(""), [h, k] = p(""), [D, R] = p(!1), [c, I] = p(), C = le(() => rt(S), [S]), l = x ? ["command", "existing", "join"] : ["command", "existing"], [y, K] = p(m), [L, V] = p(), [T, W] = p(), [Q, z] = p(), [U, H] = p(!1), [Z, Y] = p(() => Date.now()), M = b?.id, t = le(() => {
|
|
90
|
+
if (T)
|
|
91
|
+
return M ? st(
|
|
92
|
+
g,
|
|
93
|
+
T.known,
|
|
94
|
+
M,
|
|
95
|
+
L?.replacementHostId
|
|
96
|
+
) : g.find(
|
|
97
|
+
(d) => d.kind === "external" && d.status === "online" && !T.known.has(d.id)
|
|
98
|
+
);
|
|
99
|
+
}, [M, g, T, L?.replacementHostId]), q = r && T !== void 0 && !t;
|
|
100
|
+
re(() => {
|
|
101
|
+
if (!q) return;
|
|
102
|
+
const d = setInterval(() => Y(Date.now()), 1e3);
|
|
103
|
+
return () => clearInterval(d);
|
|
104
|
+
}, [q]);
|
|
105
|
+
const E = le(() => {
|
|
106
|
+
if (L)
|
|
107
|
+
try {
|
|
108
|
+
return it(y, L);
|
|
109
|
+
} catch {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
}, [y, L]), P = async () => {
|
|
113
|
+
H(!0), z(void 0);
|
|
114
|
+
try {
|
|
115
|
+
if (!_e(y)) throw new Error(a("collab.runtime.badAddress"));
|
|
116
|
+
V(await u(M)), W({
|
|
117
|
+
at: Date.now(),
|
|
118
|
+
known: M ? new Set(g.map((d) => d.id)) : Ce(g)
|
|
119
|
+
});
|
|
120
|
+
} catch (d) {
|
|
121
|
+
z(d instanceof Error ? d.message : String(d));
|
|
122
|
+
} finally {
|
|
123
|
+
H(!1);
|
|
124
|
+
}
|
|
125
|
+
}, B = async (d) => {
|
|
126
|
+
if (d.preventDefault(), !f) return;
|
|
127
|
+
const j = new FormData(d.currentTarget);
|
|
128
|
+
H(!0), z(void 0);
|
|
129
|
+
const i = Ce(g);
|
|
130
|
+
try {
|
|
131
|
+
await f({
|
|
132
|
+
remoteUrl: String(j.get("remoteUrl")),
|
|
133
|
+
remoteToken: String(j.get("remoteToken")),
|
|
134
|
+
remoteCwd: String(j.get("remoteCwd")),
|
|
135
|
+
serverUrl: y,
|
|
136
|
+
allowHttp: j.get("allowHttp") === "on"
|
|
137
|
+
}) && W({ at: Date.now(), known: i });
|
|
138
|
+
} finally {
|
|
139
|
+
H(!1);
|
|
140
|
+
}
|
|
141
|
+
}, O = async (d) => {
|
|
142
|
+
if (d.preventDefault(), !!x) {
|
|
143
|
+
if (!C) {
|
|
144
|
+
z(a("collab.runtime.joinBadLink"));
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
H(!0), z(void 0);
|
|
148
|
+
try {
|
|
149
|
+
await x({
|
|
150
|
+
serverUrl: C.serverUrl,
|
|
151
|
+
workspaceId: C.workspaceId,
|
|
152
|
+
enrollmentToken: h.trim(),
|
|
153
|
+
allowHttp: D
|
|
154
|
+
}) && (I(C.serverUrl), k(""));
|
|
155
|
+
} catch (j) {
|
|
156
|
+
z(j instanceof Error ? j.message : String(j));
|
|
157
|
+
} finally {
|
|
158
|
+
H(!1);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}, J = L ? Math.max(0, Math.ceil((L.expiresAt - Z) / 6e4)) : 0, X = L && J > 0 ? L : void 0, G = (d) => {
|
|
162
|
+
!d && t && (V(void 0), W(void 0)), !d && c && (I(void 0), A("")), s(d);
|
|
163
|
+
};
|
|
164
|
+
return /* @__PURE__ */ e(ye, { open: r, onOpenChange: G, children: /* @__PURE__ */ n(Le, { className: "grid-cols-[minmax(0,1fr)] sm:max-w-xl", children: [
|
|
165
|
+
/* @__PURE__ */ n(He, { children: [
|
|
166
|
+
/* @__PURE__ */ e($e, { children: b ? a("collab.runtime.replaceTitle", {
|
|
167
|
+
name: b.label
|
|
168
|
+
}) : a("collab.runtime.addTitle") }),
|
|
169
|
+
/* @__PURE__ */ e(De, { children: b ? a("collab.runtime.replaceDescription", {
|
|
170
|
+
name: b.label
|
|
171
|
+
}) : a("collab.runtime.addDescription") })
|
|
172
|
+
] }),
|
|
173
|
+
b ? /* @__PURE__ */ e("p", { className: "rounded-md border border-amber-500/30 bg-amber-500/10 p-3 text-sm text-muted-foreground", children: a("collab.runtime.replaceEffects") }) : null,
|
|
174
|
+
!t && b && L?.replacementHostId ? /* @__PURE__ */ e("p", { role: "status", className: "text-sm text-muted-foreground", children: a("collab.runtime.replaceRecovery", {
|
|
175
|
+
name: b.label,
|
|
176
|
+
id: b.id
|
|
177
|
+
}) }) : null,
|
|
178
|
+
c ? /* @__PURE__ */ n(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
role: "status",
|
|
182
|
+
className: "flex items-center gap-3 rounded-md border border-[var(--status-done-fg)]/30 bg-[var(--status-done-bg)] p-3",
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ e(
|
|
185
|
+
we,
|
|
186
|
+
{
|
|
187
|
+
"aria-hidden": "true",
|
|
188
|
+
className: "size-5 shrink-0 text-[var(--status-done-fg)]"
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ e("p", { className: "min-w-0 font-medium break-all", children: a("collab.runtime.joinConnected", { server: c }) })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
) : t ? /* @__PURE__ */ e("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-3 rounded-md border border-[var(--status-done-fg)]/30 bg-[var(--status-done-bg)] p-3", children: [
|
|
195
|
+
/* @__PURE__ */ e(
|
|
196
|
+
we,
|
|
197
|
+
{
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
className: "size-5 shrink-0 text-[var(--status-done-fg)]"
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
/* @__PURE__ */ n("div", { className: "min-w-0", children: [
|
|
203
|
+
/* @__PURE__ */ e("p", { className: "font-medium", children: b ? a("collab.runtime.replaced", {
|
|
204
|
+
oldName: b.label,
|
|
205
|
+
name: t.label
|
|
206
|
+
}) : a("collab.runtime.connected", {
|
|
207
|
+
name: t.label
|
|
208
|
+
}) }),
|
|
209
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("collab.runtime.offers", {
|
|
210
|
+
programs: ae(t).map(se).join(", ")
|
|
211
|
+
}) }),
|
|
212
|
+
b ? /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("collab.runtime.replaceCompleted") }) : null
|
|
213
|
+
] })
|
|
214
|
+
] }) }) : /* @__PURE__ */ n(ie, { children: [
|
|
215
|
+
b ? null : /* @__PURE__ */ e(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
role: "tablist",
|
|
219
|
+
className: "flex gap-4 border-b border-border text-sm",
|
|
220
|
+
children: l.map((d) => /* @__PURE__ */ e(
|
|
221
|
+
"button",
|
|
222
|
+
{
|
|
223
|
+
type: "button",
|
|
224
|
+
role: "tab",
|
|
225
|
+
"aria-selected": N === d,
|
|
226
|
+
onClick: () => $(d),
|
|
227
|
+
className: `-mb-px border-b-2 pb-2 ${N === d ? "border-foreground font-medium" : "border-transparent text-muted-foreground"}`,
|
|
228
|
+
children: a(d === "command" ? "collab.runtime.methodCommand" : d === "existing" ? "collab.runtime.methodExisting" : "collab.runtime.methodJoin")
|
|
229
|
+
},
|
|
230
|
+
d
|
|
231
|
+
))
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
N === "join" && !b ? null : /* @__PURE__ */ n("label", { className: "flex flex-col gap-1.5 text-sm", children: [
|
|
235
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: a("collab.runtime.address") }),
|
|
236
|
+
/* @__PURE__ */ e(
|
|
237
|
+
ee,
|
|
238
|
+
{
|
|
239
|
+
value: y,
|
|
240
|
+
onChange: (d) => K(d.target.value),
|
|
241
|
+
disabled: L !== void 0
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: Be.has(_e(y)) ? a("collab.runtime.loopbackHint") : a("collab.runtime.addressHint") })
|
|
245
|
+
] }),
|
|
246
|
+
b || N === "command" ? X && E ? /* @__PURE__ */ n("div", { className: "flex flex-col gap-3 text-sm", children: [
|
|
247
|
+
/* @__PURE__ */ e("p", { className: "font-medium", children: a("collab.runtime.runThis") }),
|
|
248
|
+
/* @__PURE__ */ e(ue, { text: E.qwen }),
|
|
249
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("collab.runtime.noQwen") }),
|
|
250
|
+
/* @__PURE__ */ e(ue, { text: E.npx }),
|
|
251
|
+
/* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground", children: [
|
|
252
|
+
a("collab.runtime.expires", { minutes: J }),
|
|
253
|
+
E.insecure && ` ${a("collab.runtime.httpHint")}`
|
|
254
|
+
] }),
|
|
255
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-3 rounded-md border border-dashed border-border p-3", children: [
|
|
256
|
+
/* @__PURE__ */ e(
|
|
257
|
+
Ze,
|
|
258
|
+
{
|
|
259
|
+
"aria-hidden": "true",
|
|
260
|
+
className: "size-4 shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none"
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ n("div", { children: [
|
|
264
|
+
/* @__PURE__ */ e("p", { className: "font-medium", children: a("collab.runtime.waiting") }),
|
|
265
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("collab.runtime.waitingFor", {
|
|
266
|
+
seconds: Math.max(
|
|
267
|
+
0,
|
|
268
|
+
Math.floor((Z - (T?.at ?? Z)) / 1e3)
|
|
269
|
+
)
|
|
270
|
+
}) })
|
|
271
|
+
] })
|
|
272
|
+
] })
|
|
273
|
+
] }) : null : N === "join" ? /* @__PURE__ */ n(
|
|
274
|
+
"form",
|
|
275
|
+
{
|
|
276
|
+
id: "join-coordinator",
|
|
277
|
+
className: "flex flex-col gap-3 text-sm",
|
|
278
|
+
onSubmit: (d) => void O(d),
|
|
279
|
+
children: [
|
|
280
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("collab.runtime.joinDescription") }),
|
|
281
|
+
/* @__PURE__ */ n("label", { className: "flex flex-col gap-1.5", children: [
|
|
282
|
+
a("collab.runtime.joinLink"),
|
|
283
|
+
/* @__PURE__ */ e(
|
|
284
|
+
ee,
|
|
285
|
+
{
|
|
286
|
+
name: "joinLink",
|
|
287
|
+
required: !0,
|
|
288
|
+
value: S,
|
|
289
|
+
onChange: (d) => A(d.target.value),
|
|
290
|
+
placeholder: "https://coordinator:4170/join/<workspace>",
|
|
291
|
+
"aria-invalid": S.trim() !== "" && !C ? !0 : void 0
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ n("label", { className: "flex flex-col gap-1.5", children: [
|
|
296
|
+
a("collab.runtime.joinToken"),
|
|
297
|
+
/* @__PURE__ */ e(
|
|
298
|
+
ee,
|
|
299
|
+
{
|
|
300
|
+
name: "enrollmentToken",
|
|
301
|
+
type: "password",
|
|
302
|
+
autoComplete: "off",
|
|
303
|
+
required: !0,
|
|
304
|
+
value: h,
|
|
305
|
+
onChange: (d) => k(d.target.value)
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
] }),
|
|
309
|
+
/* @__PURE__ */ n("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
310
|
+
/* @__PURE__ */ e(
|
|
311
|
+
"input",
|
|
312
|
+
{
|
|
313
|
+
type: "checkbox",
|
|
314
|
+
name: "allowHttp",
|
|
315
|
+
checked: D,
|
|
316
|
+
onChange: (d) => R(d.target.checked)
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
a("collab.runtime.allowHttp")
|
|
320
|
+
] }),
|
|
321
|
+
C ? /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5", children: [
|
|
322
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("collab.runtime.joinCli") }),
|
|
323
|
+
/* @__PURE__ */ e(
|
|
324
|
+
ue,
|
|
325
|
+
{
|
|
326
|
+
text: ot(S, "", D)
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
] }) : null
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
) : /* @__PURE__ */ n(
|
|
333
|
+
"form",
|
|
334
|
+
{
|
|
335
|
+
id: "connect-existing-runtime",
|
|
336
|
+
className: "flex flex-col gap-3 text-sm",
|
|
337
|
+
onSubmit: (d) => void B(d),
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ n("label", { className: "flex flex-col gap-1.5", children: [
|
|
340
|
+
a("collab.runtime.remoteUrl"),
|
|
341
|
+
/* @__PURE__ */ e(
|
|
342
|
+
ee,
|
|
343
|
+
{
|
|
344
|
+
name: "remoteUrl",
|
|
345
|
+
type: "url",
|
|
346
|
+
required: !0,
|
|
347
|
+
placeholder: "http://192.168.1.20:4170"
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
] }),
|
|
351
|
+
/* @__PURE__ */ n("label", { className: "flex flex-col gap-1.5", children: [
|
|
352
|
+
a("collab.runtime.remoteToken"),
|
|
353
|
+
/* @__PURE__ */ e(
|
|
354
|
+
ee,
|
|
355
|
+
{
|
|
356
|
+
name: "remoteToken",
|
|
357
|
+
type: "password",
|
|
358
|
+
autoComplete: "off",
|
|
359
|
+
required: !0
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
] }),
|
|
363
|
+
/* @__PURE__ */ n("label", { className: "flex flex-col gap-1.5", children: [
|
|
364
|
+
a("collab.runtime.remoteCwd"),
|
|
365
|
+
/* @__PURE__ */ e(
|
|
366
|
+
ee,
|
|
367
|
+
{
|
|
368
|
+
name: "remoteCwd",
|
|
369
|
+
required: !0,
|
|
370
|
+
placeholder: "/home/me/project"
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
] }),
|
|
374
|
+
/* @__PURE__ */ n("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
375
|
+
/* @__PURE__ */ e("input", { type: "checkbox", name: "allowHttp" }),
|
|
376
|
+
a("collab.runtime.allowHttp")
|
|
377
|
+
] })
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
)
|
|
381
|
+
] }),
|
|
382
|
+
Q && /* @__PURE__ */ e("p", { role: "alert", className: "text-sm text-destructive", children: Q }),
|
|
383
|
+
/* @__PURE__ */ e(Te, { children: c ? /* @__PURE__ */ e(_, { variant: "outline", onClick: () => G(!1), children: a("collab.runtime.done") }) : t ? /* @__PURE__ */ n(ie, { children: [
|
|
384
|
+
/* @__PURE__ */ e(_, { variant: "outline", onClick: () => G(!1), children: a("collab.runtime.done") }),
|
|
385
|
+
v && /* @__PURE__ */ e(
|
|
386
|
+
_,
|
|
387
|
+
{
|
|
388
|
+
onClick: () => {
|
|
389
|
+
G(!1), v(t.id);
|
|
390
|
+
},
|
|
391
|
+
children: a("collab.runtime.createAgentOn", { name: t.label })
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
] }) : b || N === "command" ? X ? /* @__PURE__ */ e(_, { variant: "outline", onClick: () => s(!1), children: a("collab.runtime.closeKeepLink") }) : /* @__PURE__ */ e(_, { disabled: U, onClick: () => void P(), children: a(
|
|
395
|
+
b && L ? "collab.runtime.refreshReplacement" : "collab.runtime.generate"
|
|
396
|
+
) }) : N === "join" ? /* @__PURE__ */ e(
|
|
397
|
+
_,
|
|
398
|
+
{
|
|
399
|
+
type: "submit",
|
|
400
|
+
form: "join-coordinator",
|
|
401
|
+
disabled: U || !C || !h.trim(),
|
|
402
|
+
children: a("collab.runtime.connect")
|
|
403
|
+
}
|
|
404
|
+
) : /* @__PURE__ */ e(
|
|
405
|
+
_,
|
|
406
|
+
{
|
|
407
|
+
type: "submit",
|
|
408
|
+
form: "connect-existing-runtime",
|
|
409
|
+
disabled: U || !f,
|
|
410
|
+
children: a("collab.runtime.connect")
|
|
411
|
+
}
|
|
412
|
+
) })
|
|
413
|
+
] }) });
|
|
414
|
+
}
|
|
415
|
+
function _e(r) {
|
|
416
|
+
try {
|
|
417
|
+
return Oe(r).hostname;
|
|
418
|
+
} catch {
|
|
419
|
+
return "";
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const dt = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
423
|
+
function mt(r) {
|
|
424
|
+
try {
|
|
425
|
+
return dt.has(new URL(r).hostname);
|
|
426
|
+
} catch {
|
|
427
|
+
return !1;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function ut(r) {
|
|
431
|
+
const s = JSON.stringify({
|
|
432
|
+
jsonrpc: "2.0",
|
|
433
|
+
id: 1,
|
|
434
|
+
method: "SendMessage",
|
|
435
|
+
params: {
|
|
436
|
+
message: {
|
|
437
|
+
role: "ROLE_USER",
|
|
438
|
+
messageId: "hello-1",
|
|
439
|
+
parts: [{ text: "Hello! What can you help with?" }]
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
return [
|
|
444
|
+
`curl -s ${r.endpoint}`,
|
|
445
|
+
"-H 'A2A-Version: 1.0'",
|
|
446
|
+
`-H 'Authorization: Bearer ${r.secret}'`,
|
|
447
|
+
`-H 'x-qwen-workspace-id: ${r.workspaceId}'`,
|
|
448
|
+
`-H 'x-qwen-caller-id: ${r.callerId}'`,
|
|
449
|
+
`-H 'x-qwen-agent-id: ${r.agentId}'`,
|
|
450
|
+
"-H 'content-type: application/json'",
|
|
451
|
+
`-d '${s}'`
|
|
452
|
+
].join(" ");
|
|
453
|
+
}
|
|
454
|
+
function he({ label: r, text: s }) {
|
|
455
|
+
const { t: m } = F(), [g, u] = p(!1);
|
|
456
|
+
return /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5 text-sm", children: [
|
|
457
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: r }),
|
|
458
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 rounded-md border border-border bg-muted/40 py-1.5 pr-1.5 pl-3", children: [
|
|
459
|
+
/* @__PURE__ */ e("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: s }),
|
|
460
|
+
/* @__PURE__ */ n(
|
|
461
|
+
_,
|
|
462
|
+
{
|
|
463
|
+
size: "sm",
|
|
464
|
+
variant: "outline",
|
|
465
|
+
onClick: () => void Me(s).then(
|
|
466
|
+
() => u(!0),
|
|
467
|
+
(f) => je(f)
|
|
468
|
+
),
|
|
469
|
+
children: [
|
|
470
|
+
/* @__PURE__ */ e(qe, { "aria-hidden": "true" }),
|
|
471
|
+
m(g ? "collab.share.copied" : "collab.share.copy")
|
|
472
|
+
]
|
|
473
|
+
}
|
|
474
|
+
)
|
|
475
|
+
] })
|
|
476
|
+
] });
|
|
477
|
+
}
|
|
478
|
+
function ht({
|
|
479
|
+
agentName: r,
|
|
480
|
+
open: s,
|
|
481
|
+
onOpenChange: m,
|
|
482
|
+
onCreate: g,
|
|
483
|
+
onList: u,
|
|
484
|
+
onRevoke: f
|
|
485
|
+
}) {
|
|
486
|
+
const { t: x } = F(), [v, b] = p(), [a, N] = p([]), [$, S] = p(), [A, h] = p(!1), k = ne(u);
|
|
487
|
+
k.current = u, re(() => {
|
|
488
|
+
s && (b(void 0), S(void 0), k.current().then(N, () => N([])));
|
|
489
|
+
}, [s]);
|
|
490
|
+
const D = async (R) => {
|
|
491
|
+
h(!0), S(void 0);
|
|
492
|
+
try {
|
|
493
|
+
await R(), N(await k.current());
|
|
494
|
+
} catch (c) {
|
|
495
|
+
S(c instanceof Error ? c.message : String(c));
|
|
496
|
+
} finally {
|
|
497
|
+
h(!1);
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
return /* @__PURE__ */ e(ye, { open: s, onOpenChange: m, children: /* @__PURE__ */ n(Le, { className: "grid-cols-[minmax(0,1fr)] sm:max-w-xl", children: [
|
|
501
|
+
/* @__PURE__ */ n(He, { children: [
|
|
502
|
+
/* @__PURE__ */ e($e, { children: x("collab.share.title", { name: r }) }),
|
|
503
|
+
/* @__PURE__ */ e(De, { children: x("collab.share.description") })
|
|
504
|
+
] }),
|
|
505
|
+
v && /* @__PURE__ */ n("div", { className: "flex flex-col gap-3", children: [
|
|
506
|
+
/* @__PURE__ */ e(
|
|
507
|
+
he,
|
|
508
|
+
{
|
|
509
|
+
label: x("collab.share.endpoint"),
|
|
510
|
+
text: v.endpoint
|
|
511
|
+
}
|
|
512
|
+
),
|
|
513
|
+
/* @__PURE__ */ e(he, { label: x("collab.share.token"), text: v.secret }),
|
|
514
|
+
/* @__PURE__ */ e(he, { label: x("collab.share.try"), text: ut(v) }),
|
|
515
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: v.expiresAt ? x("collab.share.onceUntil", {
|
|
516
|
+
date: new Date(v.expiresAt).toLocaleDateString()
|
|
517
|
+
}) : x("collab.share.once") }),
|
|
518
|
+
mt(v.endpoint) && /* @__PURE__ */ e("p", { role: "alert", className: "text-xs text-destructive", children: x("collab.share.loopback") })
|
|
519
|
+
] }),
|
|
520
|
+
a.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-col gap-1 text-sm", children: [
|
|
521
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: x("collab.share.active", { count: a.length }) }),
|
|
522
|
+
a.map((R) => /* @__PURE__ */ n(
|
|
523
|
+
"div",
|
|
524
|
+
{
|
|
525
|
+
className: "flex items-center gap-2 rounded-md px-2 py-1 hover:bg-muted",
|
|
526
|
+
children: [
|
|
527
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
528
|
+
R.callerId,
|
|
529
|
+
/* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: R.expiresAt ? x("collab.share.until", {
|
|
530
|
+
date: new Date(R.expiresAt).toLocaleDateString()
|
|
531
|
+
}) : "" })
|
|
532
|
+
] }),
|
|
533
|
+
/* @__PURE__ */ e(
|
|
534
|
+
_,
|
|
535
|
+
{
|
|
536
|
+
size: "sm",
|
|
537
|
+
variant: "ghost",
|
|
538
|
+
disabled: A,
|
|
539
|
+
onClick: () => void D(() => f(R.callerId)),
|
|
540
|
+
children: x("collab.share.revoke")
|
|
541
|
+
}
|
|
542
|
+
)
|
|
543
|
+
]
|
|
544
|
+
},
|
|
545
|
+
R.callerId
|
|
546
|
+
))
|
|
547
|
+
] }),
|
|
548
|
+
$ && /* @__PURE__ */ e("p", { role: "alert", className: "text-sm text-destructive", children: $ }),
|
|
549
|
+
/* @__PURE__ */ e(Te, { children: v ? /* @__PURE__ */ e(_, { onClick: () => m(!1), children: x("collab.share.done") }) : /* @__PURE__ */ e(
|
|
550
|
+
_,
|
|
551
|
+
{
|
|
552
|
+
disabled: A,
|
|
553
|
+
onClick: () => void D(async () => b(await g())),
|
|
554
|
+
children: x("collab.share.create")
|
|
555
|
+
}
|
|
556
|
+
) })
|
|
557
|
+
] }) });
|
|
558
|
+
}
|
|
559
|
+
const bt = "_formActions_1dh4x_4", ft = "_field_1dh4x_11", pt = "_roster_1dh4x_33", gt = "_agentCard_1dh4x_39", xt = "_agentRow_1dh4x_44", vt = "_agentRowDisabled_1dh4x_51", Nt = "_agentMain_1dh4x_55", wt = "_agentTitleLine_1dh4x_63", kt = "_statusBadge_1dh4x_70", Ct = "_agentActions_1dh4x_84", _t = "_agentConfig_1dh4x_93", St = "_configLabel_1dh4x_101", Rt = "_configNote_1dh4x_108", qt = "_runtimeCard_1dh4x_116", It = "_runtimeHeader_1dh4x_127", At = "_runtimeTitle_1dh4x_131", yt = "_runtimeStatus_1dh4x_137", Lt = "_runtimeFacts_1dh4x_147", Ht = "_fieldHint_1dh4x_182", $t = "_squadTile_1dh4x_188", Dt = "_squadRoster_1dh4x_208", Tt = "_squadRosterRow_1dh4x_223", Mt = "_squadRosterWho_1dh4x_231", jt = "_squadRosterName_1dh4x_267", Et = "_squadRosterRole_1dh4x_275", zt = "_squadMemberPicker_1dh4x_282", Ut = "_squadMemberLegend_1dh4x_292", Pt = "_squadMemberRow_1dh4x_301", Ft = "_squadMemberName_1dh4x_309", o = {
|
|
560
|
+
formActions: bt,
|
|
561
|
+
field: ft,
|
|
562
|
+
roster: pt,
|
|
563
|
+
agentCard: gt,
|
|
564
|
+
agentRow: xt,
|
|
565
|
+
agentRowDisabled: vt,
|
|
566
|
+
agentMain: Nt,
|
|
567
|
+
agentTitleLine: wt,
|
|
568
|
+
statusBadge: kt,
|
|
569
|
+
agentActions: Ct,
|
|
570
|
+
agentConfig: _t,
|
|
571
|
+
configLabel: St,
|
|
572
|
+
configNote: Rt,
|
|
573
|
+
runtimeCard: qt,
|
|
574
|
+
runtimeHeader: It,
|
|
575
|
+
runtimeTitle: At,
|
|
576
|
+
runtimeStatus: yt,
|
|
577
|
+
runtimeFacts: Lt,
|
|
578
|
+
fieldHint: Ht,
|
|
579
|
+
squadTile: $t,
|
|
580
|
+
squadRoster: Dt,
|
|
581
|
+
squadRosterRow: Tt,
|
|
582
|
+
squadRosterWho: Mt,
|
|
583
|
+
squadRosterName: jt,
|
|
584
|
+
squadRosterRole: Et,
|
|
585
|
+
squadMemberPicker: zt,
|
|
586
|
+
squadMemberLegend: Ut,
|
|
587
|
+
squadMemberRow: Pt,
|
|
588
|
+
squadMemberName: Ft
|
|
589
|
+
};
|
|
590
|
+
function Wt(r) {
|
|
591
|
+
return r.filter((s) => !s.retiredAt);
|
|
592
|
+
}
|
|
593
|
+
function Se({
|
|
594
|
+
squad: r,
|
|
595
|
+
agents: s,
|
|
596
|
+
pending: m,
|
|
597
|
+
onSubmit: g,
|
|
598
|
+
onCancel: u
|
|
599
|
+
}) {
|
|
600
|
+
const { t: f } = F(), x = Wt(s), v = Ke(), [b, a] = p(r?.name ?? ""), [N, $] = p(
|
|
601
|
+
r && !r.leaderIssue ? r.leaderAgentId : ""
|
|
602
|
+
), [S, A] = p(
|
|
603
|
+
() => new Map(
|
|
604
|
+
(r?.members ?? []).map((c) => [
|
|
605
|
+
c.agentId,
|
|
606
|
+
c.role ?? ""
|
|
607
|
+
])
|
|
608
|
+
)
|
|
609
|
+
), h = x.filter(
|
|
610
|
+
(c) => c.id !== N
|
|
611
|
+
), k = (c) => {
|
|
612
|
+
c.preventDefault();
|
|
613
|
+
const I = new FormData(c.currentTarget), C = (l) => {
|
|
614
|
+
const y = String(I.get(l) ?? "").trim();
|
|
615
|
+
return y === "" ? null : y;
|
|
616
|
+
};
|
|
617
|
+
g({
|
|
618
|
+
name: b.trim(),
|
|
619
|
+
description: C("description"),
|
|
620
|
+
instructions: C("instructions"),
|
|
621
|
+
leaderAgentId: N,
|
|
622
|
+
// A squad saved before leaders were kept out of the member list may
|
|
623
|
+
// still name its leader there.
|
|
624
|
+
members: [...S].filter(([l]) => l !== N).map(([l, y]) => ({
|
|
625
|
+
agentId: l,
|
|
626
|
+
...y.trim() ? { role: y.trim() } : {}
|
|
627
|
+
}))
|
|
628
|
+
});
|
|
629
|
+
}, D = `${v}-name-hint`, R = b.trim();
|
|
630
|
+
return /* @__PURE__ */ n(
|
|
631
|
+
"form",
|
|
632
|
+
{
|
|
633
|
+
className: o.agentConfig,
|
|
634
|
+
onSubmit: k,
|
|
635
|
+
"data-testid": "squad-form",
|
|
636
|
+
children: [
|
|
637
|
+
/* @__PURE__ */ n("div", { className: o.configLabel, children: [
|
|
638
|
+
/* @__PURE__ */ e("label", { htmlFor: `${v}-name`, children: f("collab.squad.name") }),
|
|
639
|
+
/* @__PURE__ */ e(
|
|
640
|
+
"input",
|
|
641
|
+
{
|
|
642
|
+
id: `${v}-name`,
|
|
643
|
+
className: o.field,
|
|
644
|
+
name: "name",
|
|
645
|
+
required: !0,
|
|
646
|
+
maxLength: 48,
|
|
647
|
+
"aria-describedby": D,
|
|
648
|
+
value: b,
|
|
649
|
+
onChange: (c) => a(c.target.value)
|
|
650
|
+
}
|
|
651
|
+
),
|
|
652
|
+
/* @__PURE__ */ e("span", { id: D, className: o.fieldHint, children: R ? f("collab.squad.calledAs", { name: R }) : f("collab.squad.nameHint") })
|
|
653
|
+
] }),
|
|
654
|
+
/* @__PURE__ */ n("label", { className: o.configLabel, children: [
|
|
655
|
+
f("collab.squad.leader"),
|
|
656
|
+
/* @__PURE__ */ n(
|
|
657
|
+
"select",
|
|
658
|
+
{
|
|
659
|
+
className: o.field,
|
|
660
|
+
required: !0,
|
|
661
|
+
value: N,
|
|
662
|
+
onChange: (c) => {
|
|
663
|
+
const I = c.target.value;
|
|
664
|
+
if ($(I), S.has(I)) {
|
|
665
|
+
const C = new Map(S);
|
|
666
|
+
C.delete(I), A(C);
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
children: [
|
|
670
|
+
/* @__PURE__ */ e("option", { value: "", disabled: !0, children: f("collab.squad.leaderPick") }),
|
|
671
|
+
x.filter((c) => c.enabled).map((c) => /* @__PURE__ */ e("option", { value: c.id, children: c.name }, c.id))
|
|
672
|
+
]
|
|
673
|
+
}
|
|
674
|
+
)
|
|
675
|
+
] }),
|
|
676
|
+
/* @__PURE__ */ n("fieldset", { className: o.squadMemberPicker, children: [
|
|
677
|
+
/* @__PURE__ */ e("legend", { className: o.squadMemberLegend, children: f("collab.squad.members") }),
|
|
678
|
+
h.map((c) => {
|
|
679
|
+
const I = S.has(c.id);
|
|
680
|
+
return /* @__PURE__ */ n("div", { className: o.squadMemberRow, children: [
|
|
681
|
+
/* @__PURE__ */ e(
|
|
682
|
+
"input",
|
|
683
|
+
{
|
|
684
|
+
id: `${v}-member-${c.id}`,
|
|
685
|
+
type: "checkbox",
|
|
686
|
+
checked: I,
|
|
687
|
+
onChange: (C) => {
|
|
688
|
+
const l = new Map(S);
|
|
689
|
+
C.target.checked ? l.set(c.id, "") : l.delete(c.id), A(l);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
/* @__PURE__ */ e(Ne, { name: c.name, color: c.color }),
|
|
694
|
+
/* @__PURE__ */ e(
|
|
695
|
+
"label",
|
|
696
|
+
{
|
|
697
|
+
htmlFor: `${v}-member-${c.id}`,
|
|
698
|
+
className: o.squadMemberName,
|
|
699
|
+
children: c.name
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
I ? /* @__PURE__ */ e(
|
|
703
|
+
"input",
|
|
704
|
+
{
|
|
705
|
+
className: o.field,
|
|
706
|
+
"aria-label": `${c.name} ${f("collab.squad.role")}`,
|
|
707
|
+
placeholder: f("collab.squad.role"),
|
|
708
|
+
maxLength: 200,
|
|
709
|
+
value: S.get(c.id) ?? "",
|
|
710
|
+
onChange: (C) => {
|
|
711
|
+
const l = new Map(S);
|
|
712
|
+
l.set(c.id, C.target.value), A(l);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
) : null
|
|
716
|
+
] }, c.id);
|
|
717
|
+
})
|
|
718
|
+
] }),
|
|
719
|
+
/* @__PURE__ */ n("label", { className: o.configLabel, children: [
|
|
720
|
+
f("collab.squad.instructions"),
|
|
721
|
+
/* @__PURE__ */ e(
|
|
722
|
+
"textarea",
|
|
723
|
+
{
|
|
724
|
+
className: o.field,
|
|
725
|
+
name: "instructions",
|
|
726
|
+
rows: 3,
|
|
727
|
+
defaultValue: r?.instructions ?? ""
|
|
728
|
+
}
|
|
729
|
+
)
|
|
730
|
+
] }),
|
|
731
|
+
/* @__PURE__ */ n("label", { className: o.configLabel, children: [
|
|
732
|
+
f("collab.squad.description"),
|
|
733
|
+
/* @__PURE__ */ e(
|
|
734
|
+
"input",
|
|
735
|
+
{
|
|
736
|
+
className: o.field,
|
|
737
|
+
name: "description",
|
|
738
|
+
defaultValue: r?.description ?? ""
|
|
739
|
+
}
|
|
740
|
+
)
|
|
741
|
+
] }),
|
|
742
|
+
/* @__PURE__ */ n("div", { className: o.formActions, children: [
|
|
743
|
+
/* @__PURE__ */ e(_, { type: "button", variant: "ghost", size: "sm", onClick: u, children: f("collab.form.cancel") }),
|
|
744
|
+
/* @__PURE__ */ e(
|
|
745
|
+
_,
|
|
746
|
+
{
|
|
747
|
+
type: "submit",
|
|
748
|
+
size: "sm",
|
|
749
|
+
disabled: m || N === "",
|
|
750
|
+
children: f("collab.squad.save")
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
] })
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
function Je() {
|
|
759
|
+
const { t: r } = F();
|
|
760
|
+
return /* @__PURE__ */ e(pe, { className: "border", children: /* @__PURE__ */ n(ge, { children: [
|
|
761
|
+
/* @__PURE__ */ e(xe, { variant: "icon", children: /* @__PURE__ */ e(Ie, {}) }),
|
|
762
|
+
/* @__PURE__ */ e(ve, { children: r("collab.squad.empty") })
|
|
763
|
+
] }) });
|
|
764
|
+
}
|
|
765
|
+
function Re({
|
|
766
|
+
name: r,
|
|
767
|
+
color: s,
|
|
768
|
+
role: m,
|
|
769
|
+
leader: g
|
|
770
|
+
}) {
|
|
771
|
+
const { t: u } = F(), f = g ? u("collab.squad.leads") : m;
|
|
772
|
+
return /* @__PURE__ */ n(
|
|
773
|
+
"li",
|
|
774
|
+
{
|
|
775
|
+
className: o.squadRosterRow,
|
|
776
|
+
"data-squad-role": g ? "leader" : "member",
|
|
777
|
+
children: [
|
|
778
|
+
/* @__PURE__ */ n("span", { className: o.squadRosterWho, children: [
|
|
779
|
+
/* @__PURE__ */ e(Ne, { name: r, color: s }),
|
|
780
|
+
/* @__PURE__ */ e("span", { className: o.squadRosterName, children: r })
|
|
781
|
+
] }),
|
|
782
|
+
f ? /* @__PURE__ */ e("span", { className: o.squadRosterRole, children: f }) : null
|
|
783
|
+
]
|
|
784
|
+
}
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
function Bt({
|
|
788
|
+
squads: r,
|
|
789
|
+
agents: s,
|
|
790
|
+
pending: m,
|
|
791
|
+
creating: g,
|
|
792
|
+
onCreatingChange: u,
|
|
793
|
+
onCreate: f,
|
|
794
|
+
onUpdate: x,
|
|
795
|
+
onRetire: v,
|
|
796
|
+
onMention: b
|
|
797
|
+
}) {
|
|
798
|
+
const { t: a } = F(), [N, $] = p(), S = r.filter((h) => !h.retiredAt), A = (h) => s.find((k) => k.id === h)?.color;
|
|
799
|
+
return /* @__PURE__ */ n("section", { className: o.roster, "data-testid": "squads-section", children: [
|
|
800
|
+
g ? /* @__PURE__ */ e(be, { size: "sm", className: o.agentCard, children: /* @__PURE__ */ e(
|
|
801
|
+
Se,
|
|
802
|
+
{
|
|
803
|
+
agents: s,
|
|
804
|
+
pending: m,
|
|
805
|
+
onCancel: () => u(!1),
|
|
806
|
+
onSubmit: async (h) => {
|
|
807
|
+
await f(h) && u(!1);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
) }) : null,
|
|
811
|
+
S.length === 0 && !g ? /* @__PURE__ */ e(Je, {}) : null,
|
|
812
|
+
S.map((h) => /* @__PURE__ */ n(
|
|
813
|
+
be,
|
|
814
|
+
{
|
|
815
|
+
size: "sm",
|
|
816
|
+
className: h.leaderIssue ? `${o.agentCard} ${o.agentRowDisabled}` : o.agentCard,
|
|
817
|
+
"data-testid": "squad-card",
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ n("div", { className: o.agentRow, children: [
|
|
820
|
+
/* @__PURE__ */ e("span", { className: o.squadTile, "aria-hidden": "true", children: /* @__PURE__ */ e(Ie, {}) }),
|
|
821
|
+
/* @__PURE__ */ n("div", { className: o.agentMain, children: [
|
|
822
|
+
/* @__PURE__ */ n("div", { className: o.agentTitleLine, children: [
|
|
823
|
+
/* @__PURE__ */ e(Ee, { className: "min-w-0 truncate", children: h.name }),
|
|
824
|
+
h.leaderIssue ? /* @__PURE__ */ e(
|
|
825
|
+
fe,
|
|
826
|
+
{
|
|
827
|
+
variant: "secondary",
|
|
828
|
+
className: o.statusBadge,
|
|
829
|
+
"data-status": "error",
|
|
830
|
+
children: h.leaderIssue === "disabled" ? a("collab.squad.leaderPaused") : a("collab.squad.needsLeader")
|
|
831
|
+
}
|
|
832
|
+
) : null
|
|
833
|
+
] }),
|
|
834
|
+
h.description ? /* @__PURE__ */ e(ze, { className: "truncate text-xs", children: h.description }) : null,
|
|
835
|
+
/* @__PURE__ */ n("ul", { className: o.squadRoster, children: [
|
|
836
|
+
h.leaderName ? /* @__PURE__ */ e(
|
|
837
|
+
Re,
|
|
838
|
+
{
|
|
839
|
+
name: h.leaderName,
|
|
840
|
+
color: A(h.leaderAgentId),
|
|
841
|
+
leader: !0
|
|
842
|
+
}
|
|
843
|
+
) : null,
|
|
844
|
+
h.members.map((k) => /* @__PURE__ */ e(
|
|
845
|
+
Re,
|
|
846
|
+
{
|
|
847
|
+
name: k.name,
|
|
848
|
+
color: A(k.agentId),
|
|
849
|
+
role: k.role
|
|
850
|
+
},
|
|
851
|
+
k.agentId
|
|
852
|
+
))
|
|
853
|
+
] })
|
|
854
|
+
] }),
|
|
855
|
+
/* @__PURE__ */ n("div", { className: o.agentActions, children: [
|
|
856
|
+
b ? /* @__PURE__ */ e(
|
|
857
|
+
_,
|
|
858
|
+
{
|
|
859
|
+
variant: "outline",
|
|
860
|
+
size: "sm",
|
|
861
|
+
disabled: !!h.leaderIssue || m,
|
|
862
|
+
onClick: () => b(h.name),
|
|
863
|
+
children: a("collab.agent.mentionIt")
|
|
864
|
+
}
|
|
865
|
+
) : null,
|
|
866
|
+
/* @__PURE__ */ n(Ue, { children: [
|
|
867
|
+
/* @__PURE__ */ e(Pe, { asChild: !0, children: /* @__PURE__ */ e(
|
|
868
|
+
_,
|
|
869
|
+
{
|
|
870
|
+
variant: "ghost",
|
|
871
|
+
size: "icon-sm",
|
|
872
|
+
"aria-label": a("collab.agent.more", { name: h.name }),
|
|
873
|
+
children: /* @__PURE__ */ e(Ae, { "aria-hidden": "true" })
|
|
874
|
+
}
|
|
875
|
+
) }),
|
|
876
|
+
/* @__PURE__ */ n(Fe, { align: "end", className: "min-w-40", children: [
|
|
877
|
+
/* @__PURE__ */ e(
|
|
878
|
+
te,
|
|
879
|
+
{
|
|
880
|
+
disabled: m,
|
|
881
|
+
onSelect: () => $(h.id),
|
|
882
|
+
children: a("collab.squad.edit")
|
|
883
|
+
}
|
|
884
|
+
),
|
|
885
|
+
/* @__PURE__ */ e(We, {}),
|
|
886
|
+
/* @__PURE__ */ e(
|
|
887
|
+
te,
|
|
888
|
+
{
|
|
889
|
+
variant: "destructive",
|
|
890
|
+
disabled: m,
|
|
891
|
+
onSelect: () => {
|
|
892
|
+
window.confirm(
|
|
893
|
+
a("collab.squad.retireConfirm", {
|
|
894
|
+
name: h.name
|
|
895
|
+
})
|
|
896
|
+
) && v(h.id);
|
|
897
|
+
},
|
|
898
|
+
children: a("collab.squad.retire")
|
|
899
|
+
}
|
|
900
|
+
)
|
|
901
|
+
] })
|
|
902
|
+
] })
|
|
903
|
+
] })
|
|
904
|
+
] }),
|
|
905
|
+
N === h.id ? /* @__PURE__ */ e(
|
|
906
|
+
Se,
|
|
907
|
+
{
|
|
908
|
+
squad: h,
|
|
909
|
+
agents: s,
|
|
910
|
+
pending: m,
|
|
911
|
+
onCancel: () => $(void 0),
|
|
912
|
+
onSubmit: async (k) => {
|
|
913
|
+
await x(h.id, k) && $(void 0);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
) : null
|
|
917
|
+
]
|
|
918
|
+
},
|
|
919
|
+
h.id
|
|
920
|
+
))
|
|
921
|
+
] });
|
|
922
|
+
}
|
|
923
|
+
const Ot = /* @__PURE__ */ new Set([
|
|
924
|
+
"online",
|
|
925
|
+
"idle",
|
|
926
|
+
"working",
|
|
927
|
+
"offline",
|
|
928
|
+
"error"
|
|
929
|
+
]);
|
|
930
|
+
function Jt({
|
|
931
|
+
agents: r,
|
|
932
|
+
runtimes: s,
|
|
933
|
+
view: m,
|
|
934
|
+
onViewChange: g,
|
|
935
|
+
onMentionAgent: u,
|
|
936
|
+
onDeleteAgent: f,
|
|
937
|
+
onSetAgentEnabled: x,
|
|
938
|
+
onUpdateAgent: v,
|
|
939
|
+
onOpenAgentBuilder: b,
|
|
940
|
+
onOpenDefinitions: a,
|
|
941
|
+
onCreateJoinToken: N,
|
|
942
|
+
onRemoveRuntime: $,
|
|
943
|
+
onConnectRemoteHost: S,
|
|
944
|
+
onJoinCoordinator: A,
|
|
945
|
+
hostServerUrl: h,
|
|
946
|
+
shares: k,
|
|
947
|
+
squads: D,
|
|
948
|
+
pending: R
|
|
949
|
+
}) {
|
|
950
|
+
const c = s ?? [], [I, C] = p(), { t: l } = F(), [y, K] = p(!1), [L, V] = p(), [T, W] = p(), [Q, z] = p(!1), U = (t) => Ot.has(t) ? l(`collab.agentStatus.${t}`) : t, H = (t) => !t || t.kind === "local" ? l("collab.agent.thisComputer") : t.label, Z = (t) => `${se(t.execution?.provider)} · ${H(t.runtime)}`, Y = (t) => (q) => {
|
|
951
|
+
if (q.preventDefault(), !v) return;
|
|
952
|
+
const E = new FormData(q.currentTarget), P = (i) => {
|
|
953
|
+
const w = String(E.get(i) ?? "").trim();
|
|
954
|
+
return w === "" ? null : w;
|
|
955
|
+
}, B = String(E.get("maxConcurrentRuns") ?? "").trim(), O = E.getAll("executionHostId").map((i) => String(i)), J = r.find((i) => i.id === t), X = J?.execution?.mode === "managed-host" ? J.execution.hostIds : [], G = O.length !== X.length || O.some((i) => !X.includes(i)), d = J?.execution?.provider, j = c.find(
|
|
956
|
+
(i) => i.kind === "local"
|
|
957
|
+
);
|
|
958
|
+
v(t, {
|
|
959
|
+
description: P("description"),
|
|
960
|
+
model: P("model"),
|
|
961
|
+
agentType: P("agentType"),
|
|
962
|
+
instructions: P("instructions"),
|
|
963
|
+
maxConcurrentRuns: B === "" ? null : Number(B),
|
|
964
|
+
...G ? {
|
|
965
|
+
execution: O.length > 0 ? {
|
|
966
|
+
mode: "managed-host",
|
|
967
|
+
hostIds: O,
|
|
968
|
+
...d ? { provider: d } : {}
|
|
969
|
+
} : {
|
|
970
|
+
mode: "local",
|
|
971
|
+
...d && j && ae(j).includes(d) ? { provider: d } : {}
|
|
972
|
+
}
|
|
973
|
+
} : {}
|
|
974
|
+
}), C(void 0);
|
|
975
|
+
}, M = (t) => {
|
|
976
|
+
g(t), C(void 0), z(!1);
|
|
977
|
+
};
|
|
978
|
+
return /* @__PURE__ */ n("div", { className: "flex w-full flex-col gap-6", children: [
|
|
979
|
+
/* @__PURE__ */ n("div", { className: "flex items-start justify-between gap-4", children: [
|
|
980
|
+
/* @__PURE__ */ n("div", { className: "min-w-0", children: [
|
|
981
|
+
/* @__PURE__ */ e("h1", { className: "text-xl font-semibold text-balance", children: l("agents.title") }),
|
|
982
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-muted-foreground", children: l(`collab.tabs.${m}Hint`) })
|
|
983
|
+
] }),
|
|
984
|
+
/* @__PURE__ */ n("div", { className: "flex shrink-0 gap-2", children: [
|
|
985
|
+
m === "agents" && a ? /* @__PURE__ */ e(_, { variant: "outline", onClick: a, children: l("collab.agent.roles") }) : null,
|
|
986
|
+
m === "agents" && b ? /* @__PURE__ */ n(_, { onClick: () => b(), children: [
|
|
987
|
+
/* @__PURE__ */ e(oe, { "data-icon": "inline-start" }),
|
|
988
|
+
l("collab.agent.new")
|
|
989
|
+
] }) : null,
|
|
990
|
+
m === "squads" && D ? /* @__PURE__ */ n(_, { disabled: R, onClick: () => z(!0), children: [
|
|
991
|
+
/* @__PURE__ */ e(oe, { "data-icon": "inline-start" }),
|
|
992
|
+
l("collab.squad.new")
|
|
993
|
+
] }) : null,
|
|
994
|
+
m === "runtime" && N ? /* @__PURE__ */ n(
|
|
995
|
+
_,
|
|
996
|
+
{
|
|
997
|
+
variant: "outline",
|
|
998
|
+
disabled: R,
|
|
999
|
+
onClick: () => {
|
|
1000
|
+
V(void 0), K(!0);
|
|
1001
|
+
},
|
|
1002
|
+
children: [
|
|
1003
|
+
/* @__PURE__ */ e(oe, { "data-icon": "inline-start" }),
|
|
1004
|
+
l("collab.runtime.addTitle")
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
1007
|
+
) : null
|
|
1008
|
+
] })
|
|
1009
|
+
] }),
|
|
1010
|
+
/* @__PURE__ */ e(
|
|
1011
|
+
Ye,
|
|
1012
|
+
{
|
|
1013
|
+
type: "single",
|
|
1014
|
+
value: m,
|
|
1015
|
+
onValueChange: (t) => {
|
|
1016
|
+
t && M(t);
|
|
1017
|
+
},
|
|
1018
|
+
variant: "outline",
|
|
1019
|
+
size: "sm",
|
|
1020
|
+
"aria-label": l("agents.title"),
|
|
1021
|
+
children: ["agents", "squads", "runtime"].map((t) => /* @__PURE__ */ e(et, { value: t, children: l(`collab.tabs.${t}`) }, t))
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
/* @__PURE__ */ n("div", { className: "contents", children: [
|
|
1025
|
+
/* @__PURE__ */ e("section", { className: o.roster, hidden: m !== "agents", children: r.length === 0 ? /* @__PURE__ */ e(pe, { className: "border", children: /* @__PURE__ */ n(ge, { children: [
|
|
1026
|
+
/* @__PURE__ */ e(xe, { variant: "icon", children: /* @__PURE__ */ e(oe, {}) }),
|
|
1027
|
+
/* @__PURE__ */ e(ve, { children: l("collab.agent.empty") })
|
|
1028
|
+
] }) }) : r.map((t) => /* @__PURE__ */ n(
|
|
1029
|
+
be,
|
|
1030
|
+
{
|
|
1031
|
+
size: "sm",
|
|
1032
|
+
className: t.enabled && !t.retiredAt ? o.agentCard : `${o.agentCard} ${o.agentRowDisabled}`,
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ n("div", { className: o.agentRow, children: [
|
|
1035
|
+
/* @__PURE__ */ e(
|
|
1036
|
+
Ne,
|
|
1037
|
+
{
|
|
1038
|
+
name: t.name,
|
|
1039
|
+
color: t.color,
|
|
1040
|
+
size: "md"
|
|
1041
|
+
}
|
|
1042
|
+
),
|
|
1043
|
+
/* @__PURE__ */ n("div", { className: o.agentMain, children: [
|
|
1044
|
+
/* @__PURE__ */ n("div", { className: o.agentTitleLine, children: [
|
|
1045
|
+
/* @__PURE__ */ e(Ee, { className: "min-w-0 truncate", children: t.name }),
|
|
1046
|
+
/* @__PURE__ */ e(
|
|
1047
|
+
fe,
|
|
1048
|
+
{
|
|
1049
|
+
variant: "secondary",
|
|
1050
|
+
className: o.statusBadge,
|
|
1051
|
+
"data-status": t.retiredAt || !t.enabled ? "off" : t.status,
|
|
1052
|
+
children: t.retiredAt ? l("collab.agentStatus.retired") : t.enabled ? U(t.status) : l("collab.agentStatus.paused")
|
|
1053
|
+
}
|
|
1054
|
+
),
|
|
1055
|
+
t.waiting ? /* @__PURE__ */ e(fe, { variant: "outline", className: "text-[10px]", children: l("collab.agent.waiting", { count: t.waiting }) }) : null
|
|
1056
|
+
] }),
|
|
1057
|
+
/* @__PURE__ */ e(ze, { className: "truncate text-xs", children: t.description || "—" }),
|
|
1058
|
+
/* @__PURE__ */ e("span", { className: "truncate text-xs text-muted-foreground", children: Z(t) })
|
|
1059
|
+
] }),
|
|
1060
|
+
t.retiredAt ? null : /* @__PURE__ */ n("div", { className: o.agentActions, children: [
|
|
1061
|
+
u ? /* @__PURE__ */ e(
|
|
1062
|
+
_,
|
|
1063
|
+
{
|
|
1064
|
+
variant: "outline",
|
|
1065
|
+
size: "sm",
|
|
1066
|
+
disabled: !t.enabled || R,
|
|
1067
|
+
onClick: () => u(t.name),
|
|
1068
|
+
children: l("collab.agent.mentionIt")
|
|
1069
|
+
}
|
|
1070
|
+
) : null,
|
|
1071
|
+
/* @__PURE__ */ n(Ue, { children: [
|
|
1072
|
+
/* @__PURE__ */ e(Pe, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1073
|
+
_,
|
|
1074
|
+
{
|
|
1075
|
+
variant: "ghost",
|
|
1076
|
+
size: "icon-sm",
|
|
1077
|
+
"aria-label": l("collab.agent.more", {
|
|
1078
|
+
name: t.name
|
|
1079
|
+
}),
|
|
1080
|
+
children: /* @__PURE__ */ e(Ae, { "aria-hidden": "true" })
|
|
1081
|
+
}
|
|
1082
|
+
) }),
|
|
1083
|
+
/* @__PURE__ */ n(Fe, { align: "end", className: "min-w-40", children: [
|
|
1084
|
+
v ? /* @__PURE__ */ e(
|
|
1085
|
+
te,
|
|
1086
|
+
{
|
|
1087
|
+
onSelect: () => C({
|
|
1088
|
+
id: t.id,
|
|
1089
|
+
hostIds: t.execution?.mode === "managed-host" ? [...t.execution.hostIds] : []
|
|
1090
|
+
}),
|
|
1091
|
+
children: l("collab.agent.configure")
|
|
1092
|
+
}
|
|
1093
|
+
) : null,
|
|
1094
|
+
k ? /* @__PURE__ */ e(
|
|
1095
|
+
te,
|
|
1096
|
+
{
|
|
1097
|
+
onSelect: () => W({ id: t.id, name: t.name }),
|
|
1098
|
+
children: l("collab.agent.share")
|
|
1099
|
+
}
|
|
1100
|
+
) : null,
|
|
1101
|
+
/* @__PURE__ */ e(
|
|
1102
|
+
te,
|
|
1103
|
+
{
|
|
1104
|
+
disabled: R,
|
|
1105
|
+
onSelect: () => x(t.id, !t.enabled),
|
|
1106
|
+
children: t.enabled ? l("collab.agent.pause") : l("collab.agent.resume")
|
|
1107
|
+
}
|
|
1108
|
+
),
|
|
1109
|
+
/* @__PURE__ */ e(We, {}),
|
|
1110
|
+
/* @__PURE__ */ e(
|
|
1111
|
+
te,
|
|
1112
|
+
{
|
|
1113
|
+
variant: "destructive",
|
|
1114
|
+
disabled: t.status === "working" || t.waiting > 0,
|
|
1115
|
+
onSelect: () => {
|
|
1116
|
+
window.confirm(
|
|
1117
|
+
l("collab.agent.retireConfirm", {
|
|
1118
|
+
name: t.name
|
|
1119
|
+
})
|
|
1120
|
+
) && f(t.id);
|
|
1121
|
+
},
|
|
1122
|
+
children: l("collab.agent.retire")
|
|
1123
|
+
}
|
|
1124
|
+
)
|
|
1125
|
+
] })
|
|
1126
|
+
] })
|
|
1127
|
+
] })
|
|
1128
|
+
] }),
|
|
1129
|
+
I?.id === t.id && v ? /* @__PURE__ */ n(
|
|
1130
|
+
"form",
|
|
1131
|
+
{
|
|
1132
|
+
className: o.agentConfig,
|
|
1133
|
+
onSubmit: Y(t.id),
|
|
1134
|
+
children: [
|
|
1135
|
+
/* @__PURE__ */ n("label", { className: o.configLabel, children: [
|
|
1136
|
+
l("collab.config.description"),
|
|
1137
|
+
/* @__PURE__ */ e(
|
|
1138
|
+
"input",
|
|
1139
|
+
{
|
|
1140
|
+
className: o.field,
|
|
1141
|
+
name: "description",
|
|
1142
|
+
defaultValue: t.description ?? "",
|
|
1143
|
+
placeholder: l("collab.config.descriptionHint")
|
|
1144
|
+
}
|
|
1145
|
+
)
|
|
1146
|
+
] }),
|
|
1147
|
+
/* @__PURE__ */ n("label", { className: o.configLabel, children: [
|
|
1148
|
+
l("collab.config.instructions"),
|
|
1149
|
+
/* @__PURE__ */ e(
|
|
1150
|
+
"textarea",
|
|
1151
|
+
{
|
|
1152
|
+
className: o.field,
|
|
1153
|
+
name: "instructions",
|
|
1154
|
+
rows: 4,
|
|
1155
|
+
defaultValue: t.instructions ?? "",
|
|
1156
|
+
placeholder: l("collab.config.instructionsHint")
|
|
1157
|
+
}
|
|
1158
|
+
)
|
|
1159
|
+
] }),
|
|
1160
|
+
/* @__PURE__ */ n("label", { className: o.configLabel, children: [
|
|
1161
|
+
l("collab.config.agentType"),
|
|
1162
|
+
/* @__PURE__ */ e(
|
|
1163
|
+
"input",
|
|
1164
|
+
{
|
|
1165
|
+
className: o.field,
|
|
1166
|
+
name: "agentType",
|
|
1167
|
+
disabled: I.hostIds.length > 0,
|
|
1168
|
+
defaultValue: t.agentType ?? "",
|
|
1169
|
+
placeholder: l("collab.config.workspaceDefault")
|
|
1170
|
+
}
|
|
1171
|
+
)
|
|
1172
|
+
] }),
|
|
1173
|
+
/* @__PURE__ */ n("label", { className: o.configLabel, children: [
|
|
1174
|
+
l("collab.config.model"),
|
|
1175
|
+
/* @__PURE__ */ e(
|
|
1176
|
+
"input",
|
|
1177
|
+
{
|
|
1178
|
+
className: o.field,
|
|
1179
|
+
name: "model",
|
|
1180
|
+
disabled: I.hostIds.length > 0,
|
|
1181
|
+
defaultValue: t.model ?? "",
|
|
1182
|
+
placeholder: l("collab.config.workspaceDefault")
|
|
1183
|
+
}
|
|
1184
|
+
)
|
|
1185
|
+
] }),
|
|
1186
|
+
/* @__PURE__ */ n("label", { className: o.configLabel, children: [
|
|
1187
|
+
l("collab.config.maxRuns"),
|
|
1188
|
+
/* @__PURE__ */ e(
|
|
1189
|
+
"input",
|
|
1190
|
+
{
|
|
1191
|
+
className: o.field,
|
|
1192
|
+
name: "maxConcurrentRuns",
|
|
1193
|
+
type: "number",
|
|
1194
|
+
min: 1,
|
|
1195
|
+
max: 8,
|
|
1196
|
+
defaultValue: t.maxConcurrentRuns ?? 1
|
|
1197
|
+
}
|
|
1198
|
+
)
|
|
1199
|
+
] }),
|
|
1200
|
+
c.some(
|
|
1201
|
+
(q) => q.kind === "external"
|
|
1202
|
+
) ? /* @__PURE__ */ n("fieldset", { className: o.configLabel, children: [
|
|
1203
|
+
/* @__PURE__ */ e("legend", { children: l("collab.config.runtimes") }),
|
|
1204
|
+
c.filter((q) => q.kind === "external").map((q) => /* @__PURE__ */ n("label", { children: [
|
|
1205
|
+
/* @__PURE__ */ e(
|
|
1206
|
+
"input",
|
|
1207
|
+
{
|
|
1208
|
+
name: "executionHostId",
|
|
1209
|
+
type: "checkbox",
|
|
1210
|
+
value: q.id,
|
|
1211
|
+
checked: I.hostIds.includes(q.id),
|
|
1212
|
+
disabled: !I.hostIds.includes(q.id) && !ae(q).includes(
|
|
1213
|
+
t.execution?.provider ?? "qwen"
|
|
1214
|
+
),
|
|
1215
|
+
onChange: (E) => {
|
|
1216
|
+
const P = E.target.checked ? [...I.hostIds, q.id] : I.hostIds.filter(
|
|
1217
|
+
(B) => B !== q.id
|
|
1218
|
+
);
|
|
1219
|
+
C({ id: t.id, hostIds: P });
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
),
|
|
1223
|
+
" ",
|
|
1224
|
+
H(q),
|
|
1225
|
+
" ·",
|
|
1226
|
+
" ",
|
|
1227
|
+
ae(q).map(se).join(", "),
|
|
1228
|
+
" ",
|
|
1229
|
+
"· ",
|
|
1230
|
+
U(q.status)
|
|
1231
|
+
] }, q.id)),
|
|
1232
|
+
/* @__PURE__ */ e("span", { className: o.configNote, children: l(
|
|
1233
|
+
I.hostIds.length > 0 ? "collab.agent.hostPersona" : "collab.config.runtimesHint"
|
|
1234
|
+
) })
|
|
1235
|
+
] }) : null,
|
|
1236
|
+
/* @__PURE__ */ e("p", { className: o.configNote, children: l("collab.config.note") }),
|
|
1237
|
+
/* @__PURE__ */ n("div", { className: o.formActions, children: [
|
|
1238
|
+
/* @__PURE__ */ e(
|
|
1239
|
+
_,
|
|
1240
|
+
{
|
|
1241
|
+
type: "button",
|
|
1242
|
+
variant: "ghost",
|
|
1243
|
+
size: "sm",
|
|
1244
|
+
onClick: () => C(void 0),
|
|
1245
|
+
children: l("collab.form.cancel")
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
/* @__PURE__ */ e(_, { type: "submit", size: "sm", disabled: R, children: l("collab.config.save") })
|
|
1249
|
+
] })
|
|
1250
|
+
]
|
|
1251
|
+
}
|
|
1252
|
+
) : null
|
|
1253
|
+
]
|
|
1254
|
+
},
|
|
1255
|
+
t.id
|
|
1256
|
+
)) }),
|
|
1257
|
+
m === "squads" ? D ? /* @__PURE__ */ e(
|
|
1258
|
+
Bt,
|
|
1259
|
+
{
|
|
1260
|
+
...D,
|
|
1261
|
+
agents: r,
|
|
1262
|
+
pending: R,
|
|
1263
|
+
creating: Q,
|
|
1264
|
+
onCreatingChange: z,
|
|
1265
|
+
...u ? { onMention: u } : {}
|
|
1266
|
+
}
|
|
1267
|
+
) : /* @__PURE__ */ e(Je, {}) : null,
|
|
1268
|
+
m === "runtime" && c.length > 0 ? c.map((t) => /* @__PURE__ */ n("section", { className: o.runtimeCard, children: [
|
|
1269
|
+
/* @__PURE__ */ n("div", { className: o.runtimeHeader, children: [
|
|
1270
|
+
/* @__PURE__ */ e("h2", { className: o.runtimeTitle, children: H(t) }),
|
|
1271
|
+
/* @__PURE__ */ e("p", { className: o.configNote, children: t.kind === "local" ? l("collab.runtime.localNote") : l("collab.runtime.remoteNote") })
|
|
1272
|
+
] }),
|
|
1273
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
1274
|
+
/* @__PURE__ */ e(
|
|
1275
|
+
"strong",
|
|
1276
|
+
{
|
|
1277
|
+
className: o.runtimeStatus,
|
|
1278
|
+
"data-runtime-status": t.status,
|
|
1279
|
+
children: U(t.status)
|
|
1280
|
+
}
|
|
1281
|
+
),
|
|
1282
|
+
t.kind === "external" && ($ || N) ? /* @__PURE__ */ n(ie, { children: [
|
|
1283
|
+
N ? /* @__PURE__ */ e(
|
|
1284
|
+
_,
|
|
1285
|
+
{
|
|
1286
|
+
size: "sm",
|
|
1287
|
+
variant: "outline",
|
|
1288
|
+
disabled: R,
|
|
1289
|
+
onClick: () => {
|
|
1290
|
+
V(t), K(!0);
|
|
1291
|
+
},
|
|
1292
|
+
children: l("collab.runtime.replace")
|
|
1293
|
+
}
|
|
1294
|
+
) : null,
|
|
1295
|
+
$ ? /* @__PURE__ */ e(
|
|
1296
|
+
_,
|
|
1297
|
+
{
|
|
1298
|
+
size: "sm",
|
|
1299
|
+
variant: "ghost",
|
|
1300
|
+
disabled: R,
|
|
1301
|
+
onClick: () => {
|
|
1302
|
+
window.confirm(
|
|
1303
|
+
l("collab.runtime.removeConfirm", {
|
|
1304
|
+
name: t.label
|
|
1305
|
+
})
|
|
1306
|
+
) && $(t.id);
|
|
1307
|
+
},
|
|
1308
|
+
children: l("collab.runtime.remove")
|
|
1309
|
+
}
|
|
1310
|
+
) : null
|
|
1311
|
+
] }) : null
|
|
1312
|
+
] }),
|
|
1313
|
+
/* @__PURE__ */ n("dl", { className: o.runtimeFacts, children: [
|
|
1314
|
+
/* @__PURE__ */ n("div", { children: [
|
|
1315
|
+
/* @__PURE__ */ e("dt", { children: l("collab.runtime.programs") }),
|
|
1316
|
+
/* @__PURE__ */ e("dd", { children: ae(t).map(se).join(", ") })
|
|
1317
|
+
] }),
|
|
1318
|
+
t.workspaceCwd ? /* @__PURE__ */ n("div", { children: [
|
|
1319
|
+
/* @__PURE__ */ e("dt", { children: l("collab.runtime.folder") }),
|
|
1320
|
+
/* @__PURE__ */ e("dd", { children: /* @__PURE__ */ e("code", { children: t.workspaceCwd }) })
|
|
1321
|
+
] }) : null,
|
|
1322
|
+
/* @__PURE__ */ n("div", { children: [
|
|
1323
|
+
/* @__PURE__ */ e("dt", { children: l("collab.runtime.agents") }),
|
|
1324
|
+
/* @__PURE__ */ e("dd", { children: t.agentCount ?? 0 })
|
|
1325
|
+
] }),
|
|
1326
|
+
/* @__PURE__ */ n("div", { children: [
|
|
1327
|
+
/* @__PURE__ */ e("dt", { children: l("collab.runtime.running") }),
|
|
1328
|
+
/* @__PURE__ */ e("dd", { children: t.runningTaskCount ?? 0 })
|
|
1329
|
+
] }),
|
|
1330
|
+
/* @__PURE__ */ n("div", { children: [
|
|
1331
|
+
/* @__PURE__ */ e("dt", { children: l("collab.runtime.queued") }),
|
|
1332
|
+
/* @__PURE__ */ e("dd", { children: t.queuedTaskCount ?? 0 })
|
|
1333
|
+
] })
|
|
1334
|
+
] }),
|
|
1335
|
+
/* @__PURE__ */ n("details", { className: "mt-4 text-xs text-muted-foreground", children: [
|
|
1336
|
+
/* @__PURE__ */ e("summary", { className: "cursor-pointer", children: l("collab.runtime.technical") }),
|
|
1337
|
+
/* @__PURE__ */ e("p", { children: l("collab.runtime.id", { id: t.id }) }),
|
|
1338
|
+
/* @__PURE__ */ e("p", { children: l("collab.runtime.sessions", {
|
|
1339
|
+
count: t.sessionCount ?? 0
|
|
1340
|
+
}) }),
|
|
1341
|
+
t.lastSeenAt && /* @__PURE__ */ e("p", { children: l("collab.runtime.lastSeen", {
|
|
1342
|
+
time: new Date(
|
|
1343
|
+
t.lastSeenAt
|
|
1344
|
+
).toLocaleTimeString()
|
|
1345
|
+
}) })
|
|
1346
|
+
] })
|
|
1347
|
+
] }, t.id)) : m === "runtime" ? /* @__PURE__ */ e(pe, { className: "border", children: /* @__PURE__ */ n(ge, { children: [
|
|
1348
|
+
/* @__PURE__ */ e(xe, { variant: "icon", children: /* @__PURE__ */ e(Xe, {}) }),
|
|
1349
|
+
/* @__PURE__ */ e(ve, { children: l("collab.runtime.empty") }),
|
|
1350
|
+
/* @__PURE__ */ e(tt, { children: l("collab.runtime.emptyHint") })
|
|
1351
|
+
] }) }) : null
|
|
1352
|
+
] }),
|
|
1353
|
+
N && /* @__PURE__ */ e(
|
|
1354
|
+
ct,
|
|
1355
|
+
{
|
|
1356
|
+
open: y,
|
|
1357
|
+
onOpenChange: (t) => {
|
|
1358
|
+
K(t), t || V(void 0);
|
|
1359
|
+
},
|
|
1360
|
+
serverUrl: h ?? "",
|
|
1361
|
+
runtimes: c,
|
|
1362
|
+
onCreateJoinToken: N,
|
|
1363
|
+
replacementTarget: L,
|
|
1364
|
+
...S ? { onConnectExisting: S } : {},
|
|
1365
|
+
...A ? { onJoinCoordinator: A } : {},
|
|
1366
|
+
...b ? {
|
|
1367
|
+
onCreateAgentOn: (t) => {
|
|
1368
|
+
K(!1), b(t);
|
|
1369
|
+
}
|
|
1370
|
+
} : {}
|
|
1371
|
+
},
|
|
1372
|
+
L?.id ?? "add-host"
|
|
1373
|
+
),
|
|
1374
|
+
k && T && /* @__PURE__ */ e(
|
|
1375
|
+
ht,
|
|
1376
|
+
{
|
|
1377
|
+
agentName: T.name,
|
|
1378
|
+
open: !0,
|
|
1379
|
+
onOpenChange: (t) => {
|
|
1380
|
+
t || W(void 0);
|
|
1381
|
+
},
|
|
1382
|
+
onCreate: () => k.create(T.id),
|
|
1383
|
+
onList: () => k.list(T.id),
|
|
1384
|
+
onRevoke: (t) => k.revoke(T.id, t)
|
|
1385
|
+
}
|
|
1386
|
+
)
|
|
1387
|
+
] });
|
|
1388
|
+
}
|
|
1389
|
+
const Gt = 2e3;
|
|
1390
|
+
function en({
|
|
1391
|
+
initialView: r,
|
|
1392
|
+
workspaceCwd: s,
|
|
1393
|
+
onOpenDefinitions: m,
|
|
1394
|
+
onMentionAgent: g
|
|
1395
|
+
}) {
|
|
1396
|
+
const u = Ve(), f = Qe(), x = le(
|
|
1397
|
+
() => (u.capabilities?.workspaces ?? []).filter(
|
|
1398
|
+
(i) => ke(
|
|
1399
|
+
u.capabilities,
|
|
1400
|
+
i.cwd
|
|
1401
|
+
)
|
|
1402
|
+
),
|
|
1403
|
+
[u.capabilities]
|
|
1404
|
+
), v = s ?? f.workspaceCwd ?? x.find((i) => i.primary)?.cwd ?? x[0]?.cwd, b = ke(
|
|
1405
|
+
u.capabilities,
|
|
1406
|
+
v
|
|
1407
|
+
) ? v : s ? void 0 : x.find((i) => i.primary)?.cwd ?? x[0]?.cwd, a = le(
|
|
1408
|
+
() => b ? nt(u.baseUrl, u.token, b) : void 0,
|
|
1409
|
+
[u.baseUrl, u.token, b]
|
|
1410
|
+
), { t: N } = F(), [$, S] = p([]), [A, h] = p([]), [k, D] = p(), [R, c] = p(
|
|
1411
|
+
r === void 0 || r === "new-agent" ? "agents" : r
|
|
1412
|
+
), [I, C] = p(!1), [l, y] = p(r === "new-agent" ? {} : void 0), [K, L] = p(), [V, T] = p(), W = V ?? K, Q = ne(a);
|
|
1413
|
+
Q.current = a;
|
|
1414
|
+
const z = ne(0), U = ne(0);
|
|
1415
|
+
re(() => {
|
|
1416
|
+
r && r !== "new-agent" && c(r);
|
|
1417
|
+
}, [r]);
|
|
1418
|
+
const H = me(async () => {
|
|
1419
|
+
if (!a) return;
|
|
1420
|
+
const i = ++z.current;
|
|
1421
|
+
try {
|
|
1422
|
+
const [w, de] = await Promise.all([
|
|
1423
|
+
a.listAgents(),
|
|
1424
|
+
// An older daemon has no squad routes: the Squads view shows empty.
|
|
1425
|
+
// A failed poll is not "no squads": keep the list (and an open form)
|
|
1426
|
+
// already on screen until a poll succeeds.
|
|
1427
|
+
a.listSquads ? a.listSquads().then(
|
|
1428
|
+
(Ge) => ({ list: Ge }),
|
|
1429
|
+
() => ({ failed: !0 })
|
|
1430
|
+
) : Promise.resolve(void 0)
|
|
1431
|
+
]);
|
|
1432
|
+
if (Q.current !== a || i < U.current)
|
|
1433
|
+
return;
|
|
1434
|
+
U.current = i, S(w.agents), h(w.runtimes ?? (w.runtime ? [w.runtime] : [])), de ? "list" in de && D(de.list?.squads) : D(void 0), L(void 0);
|
|
1435
|
+
} catch (w) {
|
|
1436
|
+
if (Q.current !== a || i < U.current)
|
|
1437
|
+
return;
|
|
1438
|
+
U.current = i, L(w instanceof Error ? w.message : String(w));
|
|
1439
|
+
}
|
|
1440
|
+
}, [a]), Z = ne(H);
|
|
1441
|
+
Z.current = H, re(() => {
|
|
1442
|
+
H();
|
|
1443
|
+
}, [H]), re(() => {
|
|
1444
|
+
if (!a) return;
|
|
1445
|
+
const i = setInterval(() => void Z.current(), Gt);
|
|
1446
|
+
return () => clearInterval(i);
|
|
1447
|
+
}, [a]);
|
|
1448
|
+
const Y = me(
|
|
1449
|
+
(i) => {
|
|
1450
|
+
const w = i !== null && typeof i == "object" ? i.dispatchError : void 0;
|
|
1451
|
+
typeof w == "string" && T(
|
|
1452
|
+
N("collab.error.dispatchAfterSave", { error: w })
|
|
1453
|
+
);
|
|
1454
|
+
},
|
|
1455
|
+
[N]
|
|
1456
|
+
), M = me(
|
|
1457
|
+
async (i) => {
|
|
1458
|
+
C(!0), T(void 0);
|
|
1459
|
+
try {
|
|
1460
|
+
const w = await i();
|
|
1461
|
+
await H(), Y(w);
|
|
1462
|
+
} catch (w) {
|
|
1463
|
+
return T(w instanceof Error ? w.message : String(w)), !1;
|
|
1464
|
+
} finally {
|
|
1465
|
+
C(!1);
|
|
1466
|
+
}
|
|
1467
|
+
return !0;
|
|
1468
|
+
},
|
|
1469
|
+
[H, Y]
|
|
1470
|
+
);
|
|
1471
|
+
if (!a)
|
|
1472
|
+
return /* @__PURE__ */ e("p", { role: "alert", children: N("collab.noWorkspace") });
|
|
1473
|
+
const t = A.find(
|
|
1474
|
+
(i) => i.kind === "local"
|
|
1475
|
+
)?.programs;
|
|
1476
|
+
if (l)
|
|
1477
|
+
return /* @__PURE__ */ e(
|
|
1478
|
+
at,
|
|
1479
|
+
{
|
|
1480
|
+
initialScope: "workspace",
|
|
1481
|
+
workspaceCwd: b,
|
|
1482
|
+
executionHosts: A.filter((i) => i.kind === "external"),
|
|
1483
|
+
...t ? { localPrograms: t } : {},
|
|
1484
|
+
...l.hostId ? { initialHostId: l.hostId } : {},
|
|
1485
|
+
onCancel: () => y(void 0),
|
|
1486
|
+
onCreated: () => y(void 0),
|
|
1487
|
+
onSaveWorkspaceAgent: async (i) => {
|
|
1488
|
+
const w = await a.createAgent(i);
|
|
1489
|
+
await H(), Y(w);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
);
|
|
1493
|
+
const {
|
|
1494
|
+
createShare: q,
|
|
1495
|
+
listShares: E,
|
|
1496
|
+
revokeShare: P,
|
|
1497
|
+
removeHost: B,
|
|
1498
|
+
connectRemoteHost: O,
|
|
1499
|
+
joinCoordinator: J,
|
|
1500
|
+
createSquad: X,
|
|
1501
|
+
updateSquad: G,
|
|
1502
|
+
retireSquad: d
|
|
1503
|
+
} = a, j = q && E && P ? {
|
|
1504
|
+
create: q,
|
|
1505
|
+
list: async (i) => (await E(i)).shares,
|
|
1506
|
+
revoke: P
|
|
1507
|
+
} : void 0;
|
|
1508
|
+
return /* @__PURE__ */ n(ie, { children: [
|
|
1509
|
+
W ? /* @__PURE__ */ e("p", { role: "alert", className: "mb-3 text-sm text-destructive", children: W }) : null,
|
|
1510
|
+
/* @__PURE__ */ e(
|
|
1511
|
+
Jt,
|
|
1512
|
+
{
|
|
1513
|
+
agents: $,
|
|
1514
|
+
view: R,
|
|
1515
|
+
onViewChange: c,
|
|
1516
|
+
runtimes: A,
|
|
1517
|
+
onConnectRemoteHost: O ? (i) => M(() => O(i)) : void 0,
|
|
1518
|
+
onJoinCoordinator: J ? async (i) => (await J(i), !0) : void 0,
|
|
1519
|
+
onMentionAgent: g,
|
|
1520
|
+
pending: I,
|
|
1521
|
+
onDeleteAgent: (i) => void M(() => a.deleteAgent(i)),
|
|
1522
|
+
onSetAgentEnabled: (i, w) => void M(() => a.setAgentEnabled(i, w)),
|
|
1523
|
+
onUpdateAgent: (i, w) => void M(() => a.updateAgent(i, w)),
|
|
1524
|
+
onOpenAgentBuilder: (i) => y({ hostId: i }),
|
|
1525
|
+
...a.createJoinToken ? { onCreateJoinToken: a.createJoinToken } : {},
|
|
1526
|
+
...B ? {
|
|
1527
|
+
onRemoveRuntime: (i) => void M(() => B(i))
|
|
1528
|
+
} : {},
|
|
1529
|
+
...j ? { shares: j } : {},
|
|
1530
|
+
...k && X && G && d ? {
|
|
1531
|
+
squads: {
|
|
1532
|
+
squads: k,
|
|
1533
|
+
onCreate: (i) => M(() => X(i)),
|
|
1534
|
+
onUpdate: (i, w) => M(() => G(i, w)),
|
|
1535
|
+
onRetire: (i) => void M(() => d(i))
|
|
1536
|
+
}
|
|
1537
|
+
} : {},
|
|
1538
|
+
...m ? { onOpenDefinitions: m } : {},
|
|
1539
|
+
hostServerUrl: u.baseUrl
|
|
1540
|
+
}
|
|
1541
|
+
)
|
|
1542
|
+
] });
|
|
1543
|
+
}
|
|
1544
|
+
export {
|
|
1545
|
+
en as AgentsRoute
|
|
1546
|
+
};
|