@hachej/boring-workspace 0.1.59 → 0.1.60
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/{FileTree-ChkSU4gL.js → FileTree-BMXXbAgy.js} +11 -11
- package/dist/{MarkdownEditor-BlYGosmH.js → MarkdownEditor-P47F3En6.js} +222 -206
- package/dist/{WorkspaceLoadingState-BYTO4wdt.js → WorkspaceLoadingState-D9v0oLDq.js} +423 -333
- package/dist/WorkspaceProvider-Dxvh_Faj.js +8501 -0
- package/dist/app-front.d.ts +141 -37
- package/dist/app-front.js +2014 -918
- package/dist/boring-workspace.css +1 -1
- package/dist/events.d.ts +2 -2
- package/dist/plugin.d.ts +27 -33
- package/dist/plugin.js +15 -13
- package/dist/shared.d.ts +1 -1
- package/dist/{surface-DmIalUmP.d.ts → surface-CDklwi48.d.ts} +34 -6
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +20 -21
- package/dist/workspace.css +386 -140
- package/dist/workspace.d.ts +207 -33
- package/dist/workspace.js +259 -255
- package/docs/INTERFACES.md +2 -2
- package/docs/README.md +3 -3
- package/package.json +4 -4
- package/dist/WorkspaceProvider-Bp1Sm40K.js +0 -8004
- package/dist/panel-DnvDNQac.js +0 -6
package/dist/app-front.js
CHANGED
|
@@ -1,129 +1,1042 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as i, jsxs as b, Fragment as oe } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as _, useState as O, useCallback as k, useMemo as D, useRef as J, useSyncExternalStore as cn, useLayoutEffect as Gi } from "react";
|
|
3
|
+
import { Sun as zi, Moon as Ki, FileText as Hi, RefreshCw as _r, X as Dr, Sparkles as Lr, Plug as Or, Clock3 as Ji, Pin as Wr, MessageSquarePlus as Mr, ChevronRight as Bi, Plus as dn, MoreHorizontal as qi, PinOff as Vi, Settings as Yi, ExternalLink as Xi, Search as ji, PanelLeftOpen as Qi, PanelLeftClose as Zi } from "lucide-react";
|
|
4
|
+
import { searchPiSessions as es, PiChatPanel as ts, usePiSessions as ns } from "@hachej/boring-agent/front";
|
|
5
|
+
import { ax as rs, aE as Ir, p as is, aM as un, aN as ss, aO as os, aP as Dt, aQ as Fr, aR as $r, aS as Ur, aT as Gr, aU as Lt, aV as fn, aW as gn, aX as zr, aY as as, aZ as _t, u as Kr, aw as ls, a_ as cs, az as ds, Y as us, q as fs, a$ as xr, b0 as gs, U as yr, x as ms, b1 as ps, au as hs, b2 as bs } from "./WorkspaceProvider-Dxvh_Faj.js";
|
|
6
|
+
import { IconButton as st, DropdownMenu as vs, DropdownMenuTrigger as xs, DropdownMenuContent as ys, DropdownMenuItem as Rt, DropdownMenuSeparator as Ss, ErrorState as Ns } from "@hachej/boring-ui-kit";
|
|
7
|
+
import { c as V } from "./utils-B6yFEsav.js";
|
|
8
|
+
import { C as ws, r as Sr, w as Ps, a as Nr, c as Es, T as ks, W as wr } from "./WorkspaceLoadingState-D9v0oLDq.js";
|
|
9
|
+
function As() {
|
|
10
|
+
const { theme: e, toggleTheme: t } = rs(), n = e === "dark";
|
|
11
|
+
return _(() => {
|
|
12
|
+
typeof document > "u" || document.documentElement.classList.toggle("dark", n);
|
|
13
|
+
}, [n]), /* @__PURE__ */ i(
|
|
14
|
+
st,
|
|
14
15
|
{
|
|
15
16
|
type: "button",
|
|
16
17
|
variant: "ghost",
|
|
17
18
|
size: "icon-sm",
|
|
18
|
-
onClick:
|
|
19
|
+
onClick: t,
|
|
19
20
|
"aria-label": "Toggle theme",
|
|
20
|
-
title:
|
|
21
|
-
children:
|
|
21
|
+
title: n ? "Switch to light theme" : "Switch to dark theme",
|
|
22
|
+
children: n ? /* @__PURE__ */ i(zi, { className: "h-4 w-4" }) : /* @__PURE__ */ i(Ki, { className: "h-4 w-4" })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function Hr({
|
|
27
|
+
part: e,
|
|
28
|
+
icon: t,
|
|
29
|
+
title: n,
|
|
30
|
+
description: s,
|
|
31
|
+
actions: o,
|
|
32
|
+
headerInsetStart: a = !1,
|
|
33
|
+
headerInsetEnd: l = !1,
|
|
34
|
+
children: g
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ b("div", { "data-boring-workspace-part": e, className: "flex h-full min-h-0 flex-col bg-background", children: [
|
|
37
|
+
/* @__PURE__ */ b("header", { className: V(
|
|
38
|
+
"flex h-12 shrink-0 items-center justify-between border-b border-border/60",
|
|
39
|
+
a ? "pl-12" : "pl-4",
|
|
40
|
+
l ? "pr-16" : "pr-4"
|
|
41
|
+
), children: [
|
|
42
|
+
/* @__PURE__ */ b("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
43
|
+
t,
|
|
44
|
+
/* @__PURE__ */ b("div", { className: "min-w-0", children: [
|
|
45
|
+
/* @__PURE__ */ i("h2", { className: "truncate text-sm font-semibold tracking-tight text-foreground", children: n }),
|
|
46
|
+
/* @__PURE__ */ i("p", { className: "truncate text-xs text-muted-foreground", children: s })
|
|
47
|
+
] })
|
|
48
|
+
] }),
|
|
49
|
+
o ? /* @__PURE__ */ i("div", { className: "flex shrink-0 items-center gap-0.5", children: o }) : null
|
|
50
|
+
] }),
|
|
51
|
+
g
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
function Rs({ onClose: e, headerInsetStart: t = !1, headerInsetEnd: n = !1 }) {
|
|
55
|
+
const s = Ir(), [o, a] = O({ status: "loading", skills: [] }), l = k((d) => {
|
|
56
|
+
d.filePath && is({ kind: "openFile", params: { path: d.filePath, mode: "view" } });
|
|
57
|
+
}, []), g = k(async (d = !1) => {
|
|
58
|
+
a((m) => ({ status: "loading", skills: m.skills }));
|
|
59
|
+
try {
|
|
60
|
+
const m = await s.getJson(`/api/v1/agent/skills${d ? "?refresh=1" : ""}`, {
|
|
61
|
+
missingMessage: "Failed to load workspace skills."
|
|
62
|
+
}), A = Array.isArray(m.skills) ? m.skills.filter((R) => typeof (R == null ? void 0 : R.name) == "string" && R.name.length > 0) : [];
|
|
63
|
+
a({ status: "ready", skills: A });
|
|
64
|
+
} catch (m) {
|
|
65
|
+
a((A) => ({
|
|
66
|
+
status: "error",
|
|
67
|
+
skills: A.skills,
|
|
68
|
+
error: m instanceof Error ? m.message : "Failed to load workspace skills."
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}, [s]);
|
|
72
|
+
_(() => {
|
|
73
|
+
g(!1);
|
|
74
|
+
}, [g]);
|
|
75
|
+
const f = D(
|
|
76
|
+
() => [...o.skills].sort((d, m) => d.name.localeCompare(m.name)),
|
|
77
|
+
[o.skills]
|
|
78
|
+
);
|
|
79
|
+
return /* @__PURE__ */ i(
|
|
80
|
+
Hr,
|
|
81
|
+
{
|
|
82
|
+
part: "skills-page",
|
|
83
|
+
title: "Skills",
|
|
84
|
+
description: "Workspace skills available to slash commands",
|
|
85
|
+
headerInsetStart: t,
|
|
86
|
+
headerInsetEnd: n,
|
|
87
|
+
icon: /* @__PURE__ */ i("span", { className: "grid size-7 place-items-center rounded-lg bg-[color:oklch(from_var(--accent)_l_c_h/0.12)] text-[color:var(--accent)]", children: /* @__PURE__ */ i(Lr, { className: "h-4 w-4", strokeWidth: 1.75, "aria-hidden": "true" }) }),
|
|
88
|
+
actions: /* @__PURE__ */ b(oe, { children: [
|
|
89
|
+
/* @__PURE__ */ i(
|
|
90
|
+
st,
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
size: "icon-xs",
|
|
95
|
+
onClick: () => void g(!0),
|
|
96
|
+
disabled: o.status === "loading",
|
|
97
|
+
"aria-label": "Refresh skills",
|
|
98
|
+
title: "Refresh skills",
|
|
99
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
100
|
+
children: /* @__PURE__ */ i(_r, { className: V("size-3", o.status === "loading" && "animate-spin"), strokeWidth: 1.75 })
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
e ? /* @__PURE__ */ i(
|
|
104
|
+
st,
|
|
105
|
+
{
|
|
106
|
+
type: "button",
|
|
107
|
+
variant: "ghost",
|
|
108
|
+
size: "icon-xs",
|
|
109
|
+
onClick: e,
|
|
110
|
+
"aria-label": "Close skills",
|
|
111
|
+
title: "Close",
|
|
112
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
113
|
+
children: /* @__PURE__ */ i(Dr, { className: "size-3", strokeWidth: 1.75 })
|
|
114
|
+
}
|
|
115
|
+
) : null
|
|
116
|
+
] }),
|
|
117
|
+
children: /* @__PURE__ */ b("div", { className: "boring-scrollbar-discreet min-h-0 flex-1 overflow-y-auto p-4", "aria-live": "polite", children: [
|
|
118
|
+
o.status === "error" ? /* @__PURE__ */ i("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/8 px-3 py-2 text-sm text-destructive", children: o.error }) : null,
|
|
119
|
+
o.status === "loading" && f.length === 0 ? /* @__PURE__ */ i("div", { className: "flex h-full min-h-[180px] items-center justify-center text-sm text-muted-foreground", children: "Loading skills…" }) : f.length === 0 ? /* @__PURE__ */ i("div", { className: "flex h-full min-h-[180px] items-center justify-center text-center text-sm text-muted-foreground", children: /* @__PURE__ */ b("div", { children: [
|
|
120
|
+
/* @__PURE__ */ i("div", { className: "font-medium text-foreground/80", children: "No skills found" }),
|
|
121
|
+
/* @__PURE__ */ i("p", { className: "mt-1 max-w-xs", children: "Reload plugins or add workspace skills to make them available in chat." })
|
|
122
|
+
] }) }) : /* @__PURE__ */ i("ul", { role: "list", className: "grid gap-2", children: f.map((d) => /* @__PURE__ */ i(
|
|
123
|
+
"li",
|
|
124
|
+
{
|
|
125
|
+
className: "rounded-xl border border-border/60 bg-card/70 px-3 py-2.5 cursor-pointer transition-colors hover:border-border hover:bg-muted/60",
|
|
126
|
+
children: /* @__PURE__ */ i(
|
|
127
|
+
"button",
|
|
128
|
+
{
|
|
129
|
+
type: "button",
|
|
130
|
+
onClick: () => l(d),
|
|
131
|
+
title: "Open skill",
|
|
132
|
+
"aria-label": `Open skill ${d.name} in workspace`,
|
|
133
|
+
className: "block w-full text-left",
|
|
134
|
+
children: /* @__PURE__ */ b("div", { className: "flex items-start justify-between gap-3", children: [
|
|
135
|
+
/* @__PURE__ */ b("div", { className: "min-w-0", children: [
|
|
136
|
+
/* @__PURE__ */ b("div", { className: "truncate text-sm font-medium text-foreground", children: [
|
|
137
|
+
"/",
|
|
138
|
+
d.name
|
|
139
|
+
] }),
|
|
140
|
+
d.description ? /* @__PURE__ */ i("p", { className: "mt-1 line-clamp-2 text-xs leading-5 text-muted-foreground", children: d.description }) : null
|
|
141
|
+
] }),
|
|
142
|
+
/* @__PURE__ */ i(Hi, { className: "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground", strokeWidth: 1.75, "aria-hidden": "true" })
|
|
143
|
+
] })
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
},
|
|
147
|
+
d.name
|
|
148
|
+
)) })
|
|
149
|
+
] })
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function Pe(e) {
|
|
154
|
+
var t, n;
|
|
155
|
+
return ((t = e.boring) == null ? void 0 : t.label) || ((n = e.boring) == null ? void 0 : n.id) || e.id;
|
|
156
|
+
}
|
|
157
|
+
function Cs(e, t) {
|
|
158
|
+
const n = e.filter((s) => s.id !== t.id);
|
|
159
|
+
return n.push(t), n.sort((s, o) => Pe(s).localeCompare(Pe(o)));
|
|
160
|
+
}
|
|
161
|
+
function Ts({ onClose: e, onReloadExternalPlugins: t, headerInsetStart: n = !1, headerInsetEnd: s = !1 }) {
|
|
162
|
+
const o = Ir(), [a, l] = O({ status: "loading", plugins: [] }), [g, f] = O(() => /* @__PURE__ */ new Set()), [d, m] = O(!1), [A, R] = O(null), W = k(async () => {
|
|
163
|
+
l((p) => ({ status: "loading", plugins: p.plugins }));
|
|
164
|
+
try {
|
|
165
|
+
const p = await o.getJson("/api/v1/agent-plugins?external=1", {
|
|
166
|
+
missingMessage: "Failed to load external plugins."
|
|
167
|
+
}), h = Array.isArray(p) ? [...p].sort((x, L) => Pe(x).localeCompare(Pe(L))) : [];
|
|
168
|
+
l({ status: "ready", plugins: h });
|
|
169
|
+
} catch (p) {
|
|
170
|
+
const h = p instanceof Error ? p.message : "Failed to load external plugins.";
|
|
171
|
+
if (/\(404\)/.test(h)) {
|
|
172
|
+
l({ status: "ready", plugins: [] });
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
l((x) => ({
|
|
176
|
+
status: "error",
|
|
177
|
+
plugins: x.plugins,
|
|
178
|
+
error: h
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
}, [o]);
|
|
182
|
+
_(() => {
|
|
183
|
+
W();
|
|
184
|
+
}, [W]), _(() => {
|
|
185
|
+
const p = (h) => {
|
|
186
|
+
const x = h.detail;
|
|
187
|
+
if (!(!x || typeof x != "object"))
|
|
188
|
+
switch (x.type) {
|
|
189
|
+
case "boring.plugin.load":
|
|
190
|
+
l((L) => ({ ...L, plugins: Cs(L.plugins, x) })), f((L) => {
|
|
191
|
+
const F = new Set(L);
|
|
192
|
+
return F.delete(x.id), F;
|
|
193
|
+
});
|
|
194
|
+
break;
|
|
195
|
+
case "boring.plugin.unload":
|
|
196
|
+
l((L) => ({ ...L, plugins: L.plugins.filter((F) => F.id !== x.id) })), f((L) => {
|
|
197
|
+
const F = new Set(L);
|
|
198
|
+
return F.delete(x.id), F;
|
|
199
|
+
});
|
|
200
|
+
break;
|
|
201
|
+
case "boring.plugin.front-pending":
|
|
202
|
+
f((L) => new Set(L).add(x.id));
|
|
203
|
+
break;
|
|
204
|
+
case "boring.plugin.front-settled":
|
|
205
|
+
f((L) => {
|
|
206
|
+
const F = new Set(L);
|
|
207
|
+
return F.delete(x.id), F;
|
|
208
|
+
});
|
|
209
|
+
break;
|
|
210
|
+
case "boring.plugin.error":
|
|
211
|
+
case "boring.plugin.front-error":
|
|
212
|
+
R(x.message ? `${x.id}: ${x.message}` : `${x.id} failed to reload`), f((L) => {
|
|
213
|
+
const F = new Set(L);
|
|
214
|
+
return F.delete(x.id), F;
|
|
215
|
+
});
|
|
216
|
+
break;
|
|
217
|
+
case "boring.plugin.replay-complete":
|
|
218
|
+
W();
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
return window.addEventListener(un, p), () => window.removeEventListener(un, p);
|
|
223
|
+
}, [W]);
|
|
224
|
+
const E = D(() => [...a.plugins].sort((p, h) => Pe(p).localeCompare(Pe(h))), [a.plugins]), v = k(async () => {
|
|
225
|
+
m(!0), R(null);
|
|
226
|
+
try {
|
|
227
|
+
const p = t ? await t() : void 0;
|
|
228
|
+
R(p || "External plugins reloaded."), await W();
|
|
229
|
+
} catch (p) {
|
|
230
|
+
R(p instanceof Error ? p.message : "External plugin reload failed.");
|
|
231
|
+
} finally {
|
|
232
|
+
m(!1);
|
|
233
|
+
}
|
|
234
|
+
}, [W, t]);
|
|
235
|
+
return /* @__PURE__ */ i(
|
|
236
|
+
Hr,
|
|
237
|
+
{
|
|
238
|
+
part: "plugins-overlay",
|
|
239
|
+
title: "Plugins",
|
|
240
|
+
description: "External plugins loaded for this workspace",
|
|
241
|
+
headerInsetStart: n,
|
|
242
|
+
headerInsetEnd: s,
|
|
243
|
+
icon: /* @__PURE__ */ i("span", { className: "grid size-7 place-items-center rounded-lg bg-foreground/[0.06] text-muted-foreground", children: /* @__PURE__ */ i(Or, { className: "h-4 w-4", strokeWidth: 1.75, "aria-hidden": "true" }) }),
|
|
244
|
+
actions: /* @__PURE__ */ b(oe, { children: [
|
|
245
|
+
/* @__PURE__ */ i(
|
|
246
|
+
st,
|
|
247
|
+
{
|
|
248
|
+
type: "button",
|
|
249
|
+
variant: "ghost",
|
|
250
|
+
size: "icon-xs",
|
|
251
|
+
onClick: () => void v(),
|
|
252
|
+
disabled: d || a.status === "loading",
|
|
253
|
+
"aria-label": "Reload plugins",
|
|
254
|
+
title: "Reload plugins",
|
|
255
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
256
|
+
children: /* @__PURE__ */ i(_r, { className: V("size-3", (d || a.status === "loading") && "animate-spin"), strokeWidth: 1.75 })
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ i(
|
|
260
|
+
st,
|
|
261
|
+
{
|
|
262
|
+
type: "button",
|
|
263
|
+
variant: "ghost",
|
|
264
|
+
size: "icon-xs",
|
|
265
|
+
onClick: e,
|
|
266
|
+
"aria-label": "Close plugins",
|
|
267
|
+
title: "Close",
|
|
268
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
269
|
+
children: /* @__PURE__ */ i(Dr, { className: "size-3", strokeWidth: 1.75 })
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
] }),
|
|
273
|
+
children: /* @__PURE__ */ b("div", { className: "boring-scrollbar-discreet min-h-0 flex-1 overflow-y-auto p-4", "aria-live": "polite", children: [
|
|
274
|
+
a.status === "error" ? /* @__PURE__ */ i("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/8 px-3 py-2 text-sm text-destructive", children: a.error }) : null,
|
|
275
|
+
A ? /* @__PURE__ */ i("div", { className: "mb-4 rounded-lg border border-border/70 bg-muted/40 px-3 py-2 text-xs text-muted-foreground", children: A }) : null,
|
|
276
|
+
a.status === "loading" && E.length === 0 ? /* @__PURE__ */ i("div", { className: "flex h-full min-h-[180px] items-center justify-center text-sm text-muted-foreground", children: "Loading external plugins…" }) : E.length === 0 ? /* @__PURE__ */ i("div", { className: "flex h-full min-h-[180px] items-center justify-center text-center text-sm text-muted-foreground", children: /* @__PURE__ */ b("div", { children: [
|
|
277
|
+
/* @__PURE__ */ i("div", { className: "font-medium text-foreground/80", children: "No external plugins loaded" }),
|
|
278
|
+
/* @__PURE__ */ i("p", { className: "mt-1 max-w-xs", children: "Create or install an external plugin, then reload external plugins." })
|
|
279
|
+
] }) }) : /* @__PURE__ */ i("ul", { role: "list", className: "grid gap-2", children: E.map((p) => {
|
|
280
|
+
const h = g.has(p.id);
|
|
281
|
+
return /* @__PURE__ */ b(
|
|
282
|
+
"li",
|
|
283
|
+
{
|
|
284
|
+
className: "rounded-xl border border-border/60 bg-card/70 px-3 py-2.5",
|
|
285
|
+
children: [
|
|
286
|
+
/* @__PURE__ */ b("div", { className: "flex items-start justify-between gap-3", children: [
|
|
287
|
+
/* @__PURE__ */ b("div", { className: "min-w-0", children: [
|
|
288
|
+
/* @__PURE__ */ i("div", { className: "truncate text-sm font-medium text-foreground", children: Pe(p) }),
|
|
289
|
+
/* @__PURE__ */ i("div", { className: "mt-0.5 truncate text-[11px] text-muted-foreground/80", children: p.id })
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ b("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
292
|
+
h ? /* @__PURE__ */ i("span", { className: "rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground", children: "loading" }) : null,
|
|
293
|
+
p.frontTarget ? /* @__PURE__ */ i("span", { className: "rounded bg-foreground/[0.06] px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground", children: "front" }) : null,
|
|
294
|
+
typeof p.revision == "number" ? /* @__PURE__ */ b("span", { className: "rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground", children: [
|
|
295
|
+
"r",
|
|
296
|
+
p.revision
|
|
297
|
+
] }) : null
|
|
298
|
+
] })
|
|
299
|
+
] }),
|
|
300
|
+
p.version ? /* @__PURE__ */ b("div", { className: "mt-2 text-xs text-muted-foreground", children: [
|
|
301
|
+
"Version ",
|
|
302
|
+
p.version
|
|
303
|
+
] }) : null
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
p.id
|
|
307
|
+
);
|
|
308
|
+
}) })
|
|
309
|
+
] })
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
function _s({
|
|
314
|
+
appTitle: e,
|
|
315
|
+
workspaceLabel: t,
|
|
316
|
+
topSlot: n,
|
|
317
|
+
showBrand: s = !0
|
|
318
|
+
}) {
|
|
319
|
+
const o = e || "Boring UI";
|
|
320
|
+
return /* @__PURE__ */ b("div", { className: "shrink-0 px-2 pb-2 pt-2", children: [
|
|
321
|
+
s ? /* @__PURE__ */ b("div", { className: "flex h-8 min-w-0 items-center gap-2 pr-1", style: { paddingLeft: "2.5rem" }, children: [
|
|
322
|
+
/* @__PURE__ */ i(
|
|
323
|
+
"span",
|
|
324
|
+
{
|
|
325
|
+
"aria-hidden": "true",
|
|
326
|
+
className: "grid size-7 shrink-0 place-items-center rounded-lg bg-foreground text-[12px] font-semibold text-background",
|
|
327
|
+
children: (o[0] ?? "B").toUpperCase()
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
/* @__PURE__ */ i("span", { className: "truncate text-[15px] font-semibold tracking-tight text-foreground", "data-boring-workspace-part": "app-left-pane-brand", children: o })
|
|
331
|
+
] }) : null,
|
|
332
|
+
n ? /* @__PURE__ */ i(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
className: s ? "mt-1 min-w-0" : "min-w-0 pr-1",
|
|
336
|
+
style: s ? void 0 : { paddingLeft: "2.5rem" },
|
|
337
|
+
"data-boring-workspace-part": "app-left-pane-workspace",
|
|
338
|
+
children: n
|
|
339
|
+
}
|
|
340
|
+
) : t ? /* @__PURE__ */ i(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
className: "mt-0.5 flex min-h-8 items-center gap-2 rounded-md px-2 text-[13px] text-foreground/72",
|
|
344
|
+
"data-boring-workspace-part": "app-left-pane-workspace",
|
|
345
|
+
children: /* @__PURE__ */ i("span", { className: "truncate", children: t })
|
|
346
|
+
}
|
|
347
|
+
) : null
|
|
348
|
+
] });
|
|
349
|
+
}
|
|
350
|
+
function rn({
|
|
351
|
+
icon: e,
|
|
352
|
+
label: t,
|
|
353
|
+
onClick: n,
|
|
354
|
+
emphasis: s = !1,
|
|
355
|
+
trailing: o
|
|
356
|
+
}) {
|
|
357
|
+
return /* @__PURE__ */ b(
|
|
358
|
+
"button",
|
|
359
|
+
{
|
|
360
|
+
type: "button",
|
|
361
|
+
onClick: n,
|
|
362
|
+
className: V(
|
|
363
|
+
"flex h-8 w-full items-center gap-2 rounded-md px-2 text-left text-[13px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
364
|
+
s ? "bg-foreground/[0.06] text-foreground hover:bg-foreground/[0.1]" : "text-foreground/82 hover:bg-foreground/[0.055] hover:text-foreground"
|
|
365
|
+
),
|
|
366
|
+
children: [
|
|
367
|
+
/* @__PURE__ */ i("span", { className: V("grid size-5 shrink-0 place-items-center", s ? "text-foreground/90" : "text-muted-foreground"), "aria-hidden": "true", children: e }),
|
|
368
|
+
/* @__PURE__ */ i("span", { className: "min-w-0 flex-1 truncate", children: t }),
|
|
369
|
+
o ? /* @__PURE__ */ i("span", { className: "shrink-0", children: o }) : null
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
function Ds({ keys: e }) {
|
|
375
|
+
return /* @__PURE__ */ i("kbd", { "aria-hidden": "true", className: "rounded border border-border/60 bg-foreground/[0.08] px-1.5 py-px text-[10px] font-medium leading-[1.4] tracking-wide text-muted-foreground", children: e });
|
|
376
|
+
}
|
|
377
|
+
function Jr({
|
|
378
|
+
session: e,
|
|
379
|
+
state: t,
|
|
380
|
+
pinned: n,
|
|
381
|
+
canSplit: s = !0,
|
|
382
|
+
canPin: o = !0,
|
|
383
|
+
onSwitch: a,
|
|
384
|
+
onOpenAsPane: l,
|
|
385
|
+
onTogglePinned: g
|
|
386
|
+
}) {
|
|
387
|
+
const f = e.title || "Untitled", d = () => {
|
|
388
|
+
t !== "active" && a(e.id);
|
|
389
|
+
};
|
|
390
|
+
return /* @__PURE__ */ b(
|
|
391
|
+
"div",
|
|
392
|
+
{
|
|
393
|
+
"data-boring-workspace-part": "app-session-row",
|
|
394
|
+
"data-boring-session-state": t,
|
|
395
|
+
draggable: s,
|
|
396
|
+
onDragStart: s ? (m) => {
|
|
397
|
+
m.dataTransfer.setData(ss, e.id), m.dataTransfer.setData("text/plain", f), m.dataTransfer.effectAllowed = "copyMove";
|
|
398
|
+
} : void 0,
|
|
399
|
+
className: V(
|
|
400
|
+
"group flex min-h-8 w-full items-center gap-2 rounded-md border px-2.5 py-1 text-left transition-colors",
|
|
401
|
+
t === "active" ? "border-transparent bg-[color:oklch(from_var(--accent)_l_c_h/0.14)] text-foreground" : t === "open" ? "border-transparent bg-foreground/[0.05] text-foreground/90 hover:bg-foreground/[0.07]" : "border-transparent text-foreground/78 hover:bg-foreground/[0.055] hover:text-foreground"
|
|
402
|
+
),
|
|
403
|
+
children: [
|
|
404
|
+
/* @__PURE__ */ i(
|
|
405
|
+
Ji,
|
|
406
|
+
{
|
|
407
|
+
className: V(
|
|
408
|
+
"h-3.5 w-3.5 shrink-0",
|
|
409
|
+
t === "active" ? "text-[color:var(--accent)]" : "text-muted-foreground/65"
|
|
410
|
+
),
|
|
411
|
+
strokeWidth: 1.75,
|
|
412
|
+
"aria-hidden": "true"
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
/* @__PURE__ */ i(
|
|
416
|
+
"button",
|
|
417
|
+
{
|
|
418
|
+
type: "button",
|
|
419
|
+
onClick: d,
|
|
420
|
+
disabled: t === "active",
|
|
421
|
+
className: "min-w-0 flex-1 truncate rounded text-left text-[13px] font-medium leading-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-default",
|
|
422
|
+
title: f,
|
|
423
|
+
children: f
|
|
424
|
+
}
|
|
425
|
+
),
|
|
426
|
+
/* @__PURE__ */ b("span", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100", children: [
|
|
427
|
+
o ? /* @__PURE__ */ i(
|
|
428
|
+
"button",
|
|
429
|
+
{
|
|
430
|
+
type: "button",
|
|
431
|
+
"aria-label": n ? `Unpin ${f}` : `Pin ${f}`,
|
|
432
|
+
title: n ? "Unpin" : "Pin",
|
|
433
|
+
"aria-pressed": n,
|
|
434
|
+
onClick: () => g(e.id),
|
|
435
|
+
className: V(
|
|
436
|
+
"grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
437
|
+
n && "text-[color:var(--accent)]"
|
|
438
|
+
),
|
|
439
|
+
children: /* @__PURE__ */ i(Wr, { className: V("h-3.5 w-3.5", n && "fill-current"), strokeWidth: 1.75 })
|
|
440
|
+
}
|
|
441
|
+
) : null,
|
|
442
|
+
t === "normal" && s ? /* @__PURE__ */ i(
|
|
443
|
+
"button",
|
|
444
|
+
{
|
|
445
|
+
type: "button",
|
|
446
|
+
"aria-label": `Open ${f} in new chat pane`,
|
|
447
|
+
title: "Open in new chat pane",
|
|
448
|
+
onClick: () => l(e.id),
|
|
449
|
+
className: "grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
450
|
+
children: /* @__PURE__ */ i(Mr, { className: "h-3.5 w-3.5", strokeWidth: 1.75 })
|
|
451
|
+
}
|
|
452
|
+
) : null
|
|
453
|
+
] })
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
const Br = "boring-workspace:pinned-projects";
|
|
459
|
+
function Ls() {
|
|
460
|
+
var e;
|
|
461
|
+
try {
|
|
462
|
+
const t = (e = globalThis.localStorage) == null ? void 0 : e.getItem(Br);
|
|
463
|
+
if (!t) return [];
|
|
464
|
+
const n = JSON.parse(t);
|
|
465
|
+
return Array.isArray(n == null ? void 0 : n.ids) ? n.ids.filter((s) => typeof s == "string") : [];
|
|
466
|
+
} catch {
|
|
467
|
+
return [];
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
function Os(e) {
|
|
471
|
+
var t;
|
|
472
|
+
try {
|
|
473
|
+
(t = globalThis.localStorage) == null || t.setItem(Br, JSON.stringify({ ids: e }));
|
|
474
|
+
} catch {
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function Ws() {
|
|
478
|
+
const [e, t] = O(() => Ls());
|
|
479
|
+
return [e, (s) => t((o) => {
|
|
480
|
+
const a = o.includes(s) ? o.filter((l) => l !== s) : [...o, s];
|
|
481
|
+
return Os(a), a;
|
|
482
|
+
})];
|
|
483
|
+
}
|
|
484
|
+
function Ms({
|
|
485
|
+
projects: e,
|
|
486
|
+
activeProjectId: t,
|
|
487
|
+
fallbackName: n,
|
|
488
|
+
expandedIds: s,
|
|
489
|
+
onToggleExpanded: o,
|
|
490
|
+
pinnedProjectIds: a,
|
|
491
|
+
onTogglePinnedProject: l,
|
|
492
|
+
onOpenProjectSession: g,
|
|
493
|
+
onShowMoreProjectSessions: f,
|
|
494
|
+
onCreateProjectSession: d,
|
|
495
|
+
onOpenProjectSettings: m,
|
|
496
|
+
onOpenProjectInNewTab: A,
|
|
497
|
+
renderProjectSession: R
|
|
498
|
+
}) {
|
|
499
|
+
var E;
|
|
500
|
+
const W = t ?? ((E = e[0]) == null ? void 0 : E.id) ?? null;
|
|
501
|
+
return /* @__PURE__ */ i("div", { className: "space-y-0.5", children: e.map((v) => /* @__PURE__ */ i(
|
|
502
|
+
Is,
|
|
503
|
+
{
|
|
504
|
+
project: v,
|
|
505
|
+
fallbackName: n,
|
|
506
|
+
active: v.id === W,
|
|
507
|
+
expanded: s.has(v.id),
|
|
508
|
+
pinned: a.has(v.id),
|
|
509
|
+
onTogglePinned: () => l(v.id),
|
|
510
|
+
onToggleExpanded: () => o(v.id),
|
|
511
|
+
onActivate: () => o(v.id),
|
|
512
|
+
onOpenSession: g,
|
|
513
|
+
onShowMore: f,
|
|
514
|
+
onCreateSession: d,
|
|
515
|
+
onOpenSettings: m,
|
|
516
|
+
onOpenInNewTab: A,
|
|
517
|
+
renderProjectSession: R
|
|
518
|
+
},
|
|
519
|
+
v.id
|
|
520
|
+
)) });
|
|
521
|
+
}
|
|
522
|
+
function Is({
|
|
523
|
+
project: e,
|
|
524
|
+
fallbackName: t,
|
|
525
|
+
active: n,
|
|
526
|
+
expanded: s,
|
|
527
|
+
pinned: o,
|
|
528
|
+
onTogglePinned: a,
|
|
529
|
+
onToggleExpanded: l,
|
|
530
|
+
onActivate: g,
|
|
531
|
+
onOpenSession: f,
|
|
532
|
+
onShowMore: d,
|
|
533
|
+
onCreateSession: m,
|
|
534
|
+
onOpenSettings: A,
|
|
535
|
+
onOpenInNewTab: R,
|
|
536
|
+
renderProjectSession: W
|
|
537
|
+
}) {
|
|
538
|
+
const [E, v] = O(!1), p = e.sessions ?? [], h = e.blockedCount ?? 0, x = e.available === !1, L = e.name || t, he = !!(m || !0);
|
|
539
|
+
return /* @__PURE__ */ b("div", { className: "space-y-0.5", children: [
|
|
540
|
+
/* @__PURE__ */ b(
|
|
541
|
+
"div",
|
|
542
|
+
{
|
|
543
|
+
className: V(
|
|
544
|
+
"group relative flex min-h-8 w-full items-center gap-2 rounded-md py-1 pl-2 pr-2 transition-colors",
|
|
545
|
+
n ? "bg-foreground/[0.07] text-foreground" : x ? "text-muted-foreground/45" : "text-foreground/82 hover:bg-foreground/[0.05] hover:text-foreground"
|
|
546
|
+
),
|
|
547
|
+
children: [
|
|
548
|
+
/* @__PURE__ */ i(
|
|
549
|
+
"button",
|
|
550
|
+
{
|
|
551
|
+
type: "button",
|
|
552
|
+
"aria-label": s ? `Collapse ${L}` : `Expand ${L}`,
|
|
553
|
+
"aria-expanded": s,
|
|
554
|
+
onClick: l,
|
|
555
|
+
className: "grid size-5 shrink-0 place-items-center rounded text-muted-foreground/55 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
556
|
+
children: /* @__PURE__ */ i(Bi, { className: V("h-3.5 w-3.5 transition-transform duration-150", s && "rotate-90"), strokeWidth: 2, "aria-hidden": "true" })
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
/* @__PURE__ */ i(
|
|
560
|
+
"button",
|
|
561
|
+
{
|
|
562
|
+
type: "button",
|
|
563
|
+
"aria-current": n ? "page" : void 0,
|
|
564
|
+
disabled: x,
|
|
565
|
+
onClick: () => {
|
|
566
|
+
x || g();
|
|
567
|
+
},
|
|
568
|
+
className: "min-w-0 flex-1 truncate rounded text-left text-[13px] font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-default",
|
|
569
|
+
children: L
|
|
570
|
+
}
|
|
571
|
+
),
|
|
572
|
+
/* @__PURE__ */ b("span", { className: "relative flex h-6 w-[3.25rem] shrink-0 items-center justify-end", children: [
|
|
573
|
+
h > 0 ? /* @__PURE__ */ i("span", { className: V(
|
|
574
|
+
"pointer-events-none absolute inset-0 flex items-center justify-end transition-opacity",
|
|
575
|
+
he && "group-hover:opacity-0 group-focus-within:opacity-0",
|
|
576
|
+
E && "opacity-0"
|
|
577
|
+
), children: /* @__PURE__ */ i(
|
|
578
|
+
"span",
|
|
579
|
+
{
|
|
580
|
+
title: `${h} session${h === 1 ? "" : "s"} waiting`,
|
|
581
|
+
className: "grid min-w-5 place-items-center rounded-full bg-[color:oklch(from_var(--accent)_l_c_h/0.18)] px-1.5 py-0.5 text-[11px] font-semibold text-[color:var(--accent)]",
|
|
582
|
+
children: h > 99 ? "99+" : h
|
|
583
|
+
}
|
|
584
|
+
) }) : null,
|
|
585
|
+
he ? /* @__PURE__ */ b("span", { className: V(
|
|
586
|
+
"flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
587
|
+
E && "opacity-100"
|
|
588
|
+
), children: [
|
|
589
|
+
m ? /* @__PURE__ */ i(
|
|
590
|
+
"button",
|
|
591
|
+
{
|
|
592
|
+
type: "button",
|
|
593
|
+
"aria-label": `New chat in ${L}`,
|
|
594
|
+
title: "New chat",
|
|
595
|
+
onClick: (H) => {
|
|
596
|
+
H.stopPropagation(), m(e.id);
|
|
597
|
+
},
|
|
598
|
+
className: "grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-foreground/[0.08] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
599
|
+
children: /* @__PURE__ */ i(dn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
|
|
600
|
+
}
|
|
601
|
+
) : null,
|
|
602
|
+
/* @__PURE__ */ b(vs, { open: E, onOpenChange: v, children: [
|
|
603
|
+
/* @__PURE__ */ i(xs, { asChild: !0, children: /* @__PURE__ */ i(
|
|
604
|
+
"button",
|
|
605
|
+
{
|
|
606
|
+
type: "button",
|
|
607
|
+
"aria-label": `${L} options`,
|
|
608
|
+
title: "More",
|
|
609
|
+
onClick: (H) => H.stopPropagation(),
|
|
610
|
+
className: "grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-foreground/[0.08] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
611
|
+
children: /* @__PURE__ */ i(qi, { className: "h-3.5 w-3.5", strokeWidth: 2 })
|
|
612
|
+
}
|
|
613
|
+
) }),
|
|
614
|
+
/* @__PURE__ */ b(ys, { align: "end", sideOffset: 6, className: "w-48 border-border/50 shadow-[0_12px_28px_-6px_rgba(0,0,0,0.55)]", children: [
|
|
615
|
+
/* @__PURE__ */ b(Rt, { onSelect: a, className: "gap-2 text-[13px]", children: [
|
|
616
|
+
o ? /* @__PURE__ */ i(Vi, { className: "h-3.5 w-3.5", "aria-hidden": "true" }) : /* @__PURE__ */ i(Wr, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
617
|
+
o ? "Unpin project" : "Pin project"
|
|
618
|
+
] }),
|
|
619
|
+
m ? /* @__PURE__ */ b(Rt, { onSelect: () => m(e.id), className: "gap-2 text-[13px]", children: [
|
|
620
|
+
/* @__PURE__ */ i(Mr, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
621
|
+
"New chat"
|
|
622
|
+
] }) : null,
|
|
623
|
+
A ? /* @__PURE__ */ b(Rt, { onSelect: () => A(e.id), className: "gap-2 text-[13px]", children: [
|
|
624
|
+
/* @__PURE__ */ i(Yi, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
625
|
+
"Workspace settings"
|
|
626
|
+
] }) : null,
|
|
627
|
+
R ? /* @__PURE__ */ b(oe, { children: [
|
|
628
|
+
/* @__PURE__ */ i(Ss, {}),
|
|
629
|
+
/* @__PURE__ */ b(Rt, { onSelect: () => R(e.id), className: "gap-2 text-[13px]", children: [
|
|
630
|
+
/* @__PURE__ */ i(Xi, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
631
|
+
"Open in new tab"
|
|
632
|
+
] })
|
|
633
|
+
] }) : null
|
|
634
|
+
] })
|
|
635
|
+
] })
|
|
636
|
+
] }) : null
|
|
637
|
+
] })
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
),
|
|
641
|
+
s ? /* @__PURE__ */ b("div", { className: "space-y-0.5 pl-6", children: [
|
|
642
|
+
e.loadingSessions && p.length === 0 ? /* @__PURE__ */ i("div", { className: "px-1 py-1.5 text-xs text-muted-foreground", children: "Loading chats…" }) : p.length === 0 ? /* @__PURE__ */ i("div", { className: "px-1 py-1.5 text-xs text-muted-foreground", children: "No chats yet." }) : p.map((H) => /* @__PURE__ */ i("div", { children: W ? W(e, H) : /* @__PURE__ */ i(
|
|
643
|
+
Jr,
|
|
644
|
+
{
|
|
645
|
+
session: H,
|
|
646
|
+
state: "normal",
|
|
647
|
+
pinned: !1,
|
|
648
|
+
onSwitch: () => f == null ? void 0 : f(e.id, H.id),
|
|
649
|
+
onOpenAsPane: () => f == null ? void 0 : f(e.id, H.id),
|
|
650
|
+
onTogglePinned: () => {
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
) }, H.id)),
|
|
654
|
+
e.hasMoreSessions ? /* @__PURE__ */ i(
|
|
655
|
+
"button",
|
|
656
|
+
{
|
|
657
|
+
type: "button",
|
|
658
|
+
onClick: () => d == null ? void 0 : d(e.id),
|
|
659
|
+
className: "rounded-md px-1 py-1 text-left text-[13px] text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
660
|
+
children: "Show more"
|
|
661
|
+
}
|
|
662
|
+
) : null
|
|
663
|
+
] }) : null
|
|
664
|
+
] });
|
|
665
|
+
}
|
|
666
|
+
function sn({ title: e, empty: t, children: n }) {
|
|
667
|
+
const s = Array.isArray(n) ? n.length > 0 : !!n;
|
|
668
|
+
return !s && !t ? null : /* @__PURE__ */ b("div", { className: "space-y-1", children: [
|
|
669
|
+
/* @__PURE__ */ i("div", { className: "px-2 pb-0.5 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground/65", children: e }),
|
|
670
|
+
/* @__PURE__ */ i("div", { className: "space-y-0.5", children: s ? n : /* @__PURE__ */ i("div", { className: "px-2 py-1.5 text-xs text-muted-foreground/60", children: t }) })
|
|
671
|
+
] });
|
|
672
|
+
}
|
|
673
|
+
function Fs({
|
|
674
|
+
width: e = 268,
|
|
675
|
+
appTitle: t,
|
|
676
|
+
workspaceLabel: n,
|
|
677
|
+
workspaceSectionTitle: s = "Workspaces",
|
|
678
|
+
projects: o,
|
|
679
|
+
activeProjectId: a,
|
|
680
|
+
onOpenProjectSession: l,
|
|
681
|
+
onShowMoreProjectSessions: g,
|
|
682
|
+
onCreateProject: f,
|
|
683
|
+
onCreateProjectSession: d,
|
|
684
|
+
onOpenProjectSettings: m,
|
|
685
|
+
onOpenProjectInNewTab: A,
|
|
686
|
+
topSlot: R,
|
|
687
|
+
bottomSlot: W,
|
|
688
|
+
headerMode: E = "full",
|
|
689
|
+
sessions: v,
|
|
690
|
+
activeSessionId: p,
|
|
691
|
+
openSessionIds: h,
|
|
692
|
+
pinnedSessionIds: x,
|
|
693
|
+
onCreateSession: L,
|
|
694
|
+
onOpenCommandPalette: F,
|
|
695
|
+
onSwitchSession: he,
|
|
696
|
+
onOpenSessionAsPane: H,
|
|
697
|
+
onToggleSessionPinned: Ot,
|
|
698
|
+
actions: Wt = [],
|
|
699
|
+
layoutMode: ge = "single-project"
|
|
700
|
+
}) {
|
|
701
|
+
const ot = D(() => new Set(h), [h]), Ee = D(() => new Set(x), [x]), me = D(
|
|
702
|
+
() => x.map((y) => v.find((T) => T.id === y)).filter((y) => !!y),
|
|
703
|
+
[x, v]
|
|
704
|
+
), be = D(
|
|
705
|
+
() => v.filter((y) => !Ee.has(y.id)),
|
|
706
|
+
[Ee, v]
|
|
707
|
+
), ae = D(() => {
|
|
708
|
+
const y = o ?? [];
|
|
709
|
+
return ge !== "multi-project" ? y : y.map((T) => T.id !== a ? T : {
|
|
710
|
+
...T,
|
|
711
|
+
sessions: T.sessions ?? be.map((M) => ({
|
|
712
|
+
id: M.id,
|
|
713
|
+
title: M.title,
|
|
714
|
+
updatedAt: M.updatedAt
|
|
715
|
+
})),
|
|
716
|
+
sessionCount: T.sessionCount ?? be.length
|
|
717
|
+
});
|
|
718
|
+
}, [a, ge, o, be]), [$e, at] = O(() => {
|
|
719
|
+
var T;
|
|
720
|
+
const y = a ?? ((T = o == null ? void 0 : o[0]) == null ? void 0 : T.id);
|
|
721
|
+
return new Set(y ? [y] : []);
|
|
722
|
+
}), Mt = (y) => at((T) => {
|
|
723
|
+
const M = new Set(T);
|
|
724
|
+
return M.has(y) ? M.delete(y) : M.add(y), M;
|
|
725
|
+
}), [ke, It] = Ws(), Ue = D(() => new Set(ke), [ke]), Ae = D(
|
|
726
|
+
() => ke.map((y) => ae.find((T) => T.id === y)).filter((y) => !!y),
|
|
727
|
+
[ke, ae]
|
|
728
|
+
), Ge = D(
|
|
729
|
+
() => ae.filter((y) => !Ue.has(y.id)),
|
|
730
|
+
[ae, Ue]
|
|
731
|
+
), Ft = E !== "hidden" && (ge !== "multi-project" || E === "workspace"), $t = E === "full" && ge !== "multi-project", Re = (y, T, M = a ?? void 0) => {
|
|
732
|
+
const le = !M || M === a, Ut = le && y.id === p ? "active" : le && ot.has(y.id) ? "open" : "normal";
|
|
733
|
+
return /* @__PURE__ */ i(
|
|
734
|
+
Jr,
|
|
735
|
+
{
|
|
736
|
+
session: y,
|
|
737
|
+
state: Ut,
|
|
738
|
+
pinned: T,
|
|
739
|
+
canSplit: le,
|
|
740
|
+
canPin: le,
|
|
741
|
+
onSwitch: le ? he : () => l == null ? void 0 : l(M, y.id),
|
|
742
|
+
onOpenAsPane: le ? H : () => l == null ? void 0 : l(M, y.id),
|
|
743
|
+
onTogglePinned: Ot
|
|
744
|
+
},
|
|
745
|
+
y.id
|
|
746
|
+
);
|
|
747
|
+
}, lt = (y) => /* @__PURE__ */ i(
|
|
748
|
+
Ms,
|
|
749
|
+
{
|
|
750
|
+
projects: y,
|
|
751
|
+
activeProjectId: a,
|
|
752
|
+
fallbackName: n || t || "Boring UI",
|
|
753
|
+
expandedIds: $e,
|
|
754
|
+
onToggleExpanded: Mt,
|
|
755
|
+
pinnedProjectIds: Ue,
|
|
756
|
+
onTogglePinnedProject: It,
|
|
757
|
+
onOpenProjectSession: (T, M) => {
|
|
758
|
+
T === a ? he(M) : l == null || l(T, M);
|
|
759
|
+
},
|
|
760
|
+
onShowMoreProjectSessions: g,
|
|
761
|
+
onCreateProjectSession: d,
|
|
762
|
+
onOpenProjectSettings: m,
|
|
763
|
+
onOpenProjectInNewTab: A,
|
|
764
|
+
renderProjectSession: (T, M) => Re({
|
|
765
|
+
id: M.id,
|
|
766
|
+
title: M.title,
|
|
767
|
+
updatedAt: M.updatedAt
|
|
768
|
+
}, Ee.has(M.id), T.id)
|
|
769
|
+
}
|
|
770
|
+
);
|
|
771
|
+
return /* @__PURE__ */ b(
|
|
772
|
+
"aside",
|
|
773
|
+
{
|
|
774
|
+
"data-boring-workspace-part": "app-left-pane",
|
|
775
|
+
className: "flex h-full min-h-0 shrink-0 flex-col border-r border-border bg-[color:oklch(from_var(--background)_calc(l-0.012)_c_h)] text-sm",
|
|
776
|
+
style: { width: e, minWidth: e, maxWidth: e },
|
|
777
|
+
"aria-label": "App navigation",
|
|
778
|
+
children: [
|
|
779
|
+
Ft ? /* @__PURE__ */ i(
|
|
780
|
+
_s,
|
|
781
|
+
{
|
|
782
|
+
appTitle: t,
|
|
783
|
+
workspaceLabel: n,
|
|
784
|
+
topSlot: R,
|
|
785
|
+
showBrand: $t
|
|
786
|
+
}
|
|
787
|
+
) : /* @__PURE__ */ i("div", { className: "h-12 shrink-0", "aria-hidden": "true" }),
|
|
788
|
+
/* @__PURE__ */ b("nav", { className: "shrink-0 space-y-0.5 px-2 pb-1 pt-1", "aria-label": "Primary workspace actions", children: [
|
|
789
|
+
/* @__PURE__ */ i(rn, { icon: /* @__PURE__ */ i(dn, { className: "h-4 w-4", strokeWidth: 2 }), label: "New chat", onClick: L, emphasis: !0 }),
|
|
790
|
+
/* @__PURE__ */ i(rn, { icon: /* @__PURE__ */ i(ji, { className: "h-4 w-4", strokeWidth: 1.75 }), label: "Search", onClick: F, trailing: /* @__PURE__ */ i(Ds, { keys: "⌘K" }) }),
|
|
791
|
+
Wt.map((y) => /* @__PURE__ */ i(
|
|
792
|
+
rn,
|
|
793
|
+
{
|
|
794
|
+
icon: y.icon,
|
|
795
|
+
label: y.label,
|
|
796
|
+
onClick: y.onClick,
|
|
797
|
+
trailing: y.trailing,
|
|
798
|
+
emphasis: y.emphasis
|
|
799
|
+
},
|
|
800
|
+
y.id
|
|
801
|
+
))
|
|
802
|
+
] }),
|
|
803
|
+
/* @__PURE__ */ i("div", { className: "boring-scrollbar-discreet min-h-0 flex-1 overflow-y-auto px-2 py-2", children: ge === "multi-project" ? /* @__PURE__ */ b("div", { className: "space-y-3 py-1", children: [
|
|
804
|
+
me.length > 0 || Ae.length > 0 ? /* @__PURE__ */ b(sn, { title: "Pinned", children: [
|
|
805
|
+
me.map((y) => Re(y, !0)),
|
|
806
|
+
Ae.length > 0 ? lt(Ae) : null
|
|
807
|
+
] }) : null,
|
|
808
|
+
/* @__PURE__ */ b("section", { "data-boring-workspace-part": "app-left-pane-section", className: "space-y-1", children: [
|
|
809
|
+
/* @__PURE__ */ b("div", { className: "flex items-center justify-between gap-1 px-2 pb-0.5", children: [
|
|
810
|
+
/* @__PURE__ */ i("span", { className: "text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground/65", children: s }),
|
|
811
|
+
f ? /* @__PURE__ */ i(
|
|
812
|
+
"button",
|
|
813
|
+
{
|
|
814
|
+
type: "button",
|
|
815
|
+
"aria-label": "New project",
|
|
816
|
+
title: "New project",
|
|
817
|
+
onClick: f,
|
|
818
|
+
className: "grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-foreground/[0.055] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
819
|
+
children: /* @__PURE__ */ i(dn, { className: "h-3.5 w-3.5", strokeWidth: 2, "aria-hidden": "true" })
|
|
820
|
+
}
|
|
821
|
+
) : null
|
|
822
|
+
] }),
|
|
823
|
+
lt(Ge)
|
|
824
|
+
] })
|
|
825
|
+
] }) : (
|
|
826
|
+
/* Single-project: no "Chats" wrapper — the session list is the whole
|
|
827
|
+
point of the body, so show Pinned + Sessions directly. */
|
|
828
|
+
/* @__PURE__ */ b("div", { className: "space-y-4 py-1", children: [
|
|
829
|
+
me.length > 0 ? /* @__PURE__ */ i(sn, { title: "Pinned", children: me.map((y) => Re(y, !0)) }) : null,
|
|
830
|
+
/* @__PURE__ */ i(sn, { title: "Chats", empty: "No chats yet.", children: be.map((y) => Re(y, !1)) })
|
|
831
|
+
] })
|
|
832
|
+
) }),
|
|
833
|
+
W ? /* @__PURE__ */ i("footer", { className: "shrink-0 border-t border-border/40 p-2", children: W }) : null
|
|
834
|
+
]
|
|
835
|
+
}
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
function $s({
|
|
839
|
+
width: e,
|
|
840
|
+
minWidth: t,
|
|
841
|
+
maxWidth: n,
|
|
842
|
+
onResize: s
|
|
843
|
+
}) {
|
|
844
|
+
const o = J(null), a = k((d) => {
|
|
845
|
+
if (o.current == null) return;
|
|
846
|
+
const m = d.clientX - o.current;
|
|
847
|
+
o.current = d.clientX, m !== 0 && s(m);
|
|
848
|
+
}, [s]), l = k(() => {
|
|
849
|
+
o.current = null, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", l);
|
|
850
|
+
}, [a]), g = k((d) => {
|
|
851
|
+
var m, A;
|
|
852
|
+
d.preventDefault(), (A = (m = d.currentTarget).setPointerCapture) == null || A.call(m, d.pointerId), o.current = d.clientX, document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", window.addEventListener("pointermove", a), window.addEventListener("pointerup", l);
|
|
853
|
+
}, [a, l]), f = k((d) => {
|
|
854
|
+
d.key === "ArrowLeft" ? (d.preventDefault(), s(d.shiftKey ? -48 : -16)) : d.key === "ArrowRight" ? (d.preventDefault(), s(d.shiftKey ? 48 : 16)) : d.key === "Home" ? (d.preventDefault(), s(t - e)) : d.key === "End" && (d.preventDefault(), s(n - e));
|
|
855
|
+
}, [n, t, s, e]);
|
|
856
|
+
return /* @__PURE__ */ i(
|
|
857
|
+
"div",
|
|
858
|
+
{
|
|
859
|
+
role: "separator",
|
|
860
|
+
"aria-label": "Resize app navigation",
|
|
861
|
+
"aria-orientation": "vertical",
|
|
862
|
+
"aria-valuemin": t,
|
|
863
|
+
"aria-valuemax": n,
|
|
864
|
+
"aria-valuenow": e,
|
|
865
|
+
tabIndex: 0,
|
|
866
|
+
onKeyDown: f,
|
|
867
|
+
onPointerDown: g,
|
|
868
|
+
className: "group relative z-20 -ml-px w-1 shrink-0 cursor-col-resize touch-none bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
869
|
+
children: /* @__PURE__ */ i("span", { className: "absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors group-hover:bg-foreground/30 group-active:bg-foreground/45" })
|
|
870
|
+
}
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
function Us({
|
|
874
|
+
collapsed: e,
|
|
875
|
+
leftPane: t,
|
|
876
|
+
children: n,
|
|
877
|
+
onExpand: s,
|
|
878
|
+
onCollapse: o,
|
|
879
|
+
onResizeLeftPane: a,
|
|
880
|
+
leftPaneWidth: l,
|
|
881
|
+
minLeftPaneWidth: g = 220,
|
|
882
|
+
maxLeftPaneWidth: f = 420,
|
|
883
|
+
className: d
|
|
884
|
+
}) {
|
|
885
|
+
const [m, A] = O(!1);
|
|
886
|
+
return /* @__PURE__ */ b(
|
|
887
|
+
"div",
|
|
888
|
+
{
|
|
889
|
+
"data-boring-workspace-part": "plugin-tabs-shell",
|
|
890
|
+
"data-boring-state": e ? "collapsed" : "expanded",
|
|
891
|
+
className: V("relative flex h-full min-h-0 w-full overflow-hidden bg-background", d),
|
|
892
|
+
children: [
|
|
893
|
+
e ? null : t,
|
|
894
|
+
!e && a && l != null ? /* @__PURE__ */ i(
|
|
895
|
+
$s,
|
|
896
|
+
{
|
|
897
|
+
width: l,
|
|
898
|
+
minWidth: g,
|
|
899
|
+
maxWidth: f,
|
|
900
|
+
onResize: a
|
|
901
|
+
}
|
|
902
|
+
) : null,
|
|
903
|
+
/* @__PURE__ */ i("div", { className: "relative min-w-0 flex-1", children: n }),
|
|
904
|
+
e ? /* @__PURE__ */ b(oe, { children: [
|
|
905
|
+
/* @__PURE__ */ i(
|
|
906
|
+
"div",
|
|
907
|
+
{
|
|
908
|
+
"data-boring-workspace-part": "app-left-peek-trigger",
|
|
909
|
+
className: "absolute inset-y-0 left-0 z-[60] w-3",
|
|
910
|
+
onMouseEnter: () => A(!0),
|
|
911
|
+
"aria-hidden": "true"
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
m ? /* @__PURE__ */ i(
|
|
915
|
+
"div",
|
|
916
|
+
{
|
|
917
|
+
"data-boring-workspace-part": "app-left-peek",
|
|
918
|
+
"data-boring-state": "open",
|
|
919
|
+
onMouseLeave: () => A(!1),
|
|
920
|
+
className: "absolute inset-y-0 left-0 z-[65] flex shadow-2xl",
|
|
921
|
+
children: t
|
|
922
|
+
}
|
|
923
|
+
) : null
|
|
924
|
+
] }) : null,
|
|
925
|
+
/* @__PURE__ */ i("div", { className: "pointer-events-none absolute left-1.5 top-2 z-[70]", children: /* @__PURE__ */ i(
|
|
926
|
+
os,
|
|
927
|
+
{
|
|
928
|
+
label: e ? "Open app navigation" : "Hide app navigation",
|
|
929
|
+
side: "right",
|
|
930
|
+
onClick: e ? s : o,
|
|
931
|
+
children: e ? /* @__PURE__ */ i(Qi, { className: "h-4 w-4", strokeWidth: 1.75 }) : /* @__PURE__ */ i(Zi, { className: "h-4 w-4", strokeWidth: 1.75 })
|
|
932
|
+
}
|
|
933
|
+
) })
|
|
934
|
+
]
|
|
22
935
|
}
|
|
23
936
|
);
|
|
24
937
|
}
|
|
25
|
-
function
|
|
938
|
+
function Gs() {
|
|
26
939
|
const e = `s${Date.now()}`;
|
|
27
940
|
return {
|
|
28
941
|
sessions: [{ id: e, title: "New session", updatedAt: Date.now() }],
|
|
29
942
|
activeId: e
|
|
30
943
|
};
|
|
31
944
|
}
|
|
32
|
-
function
|
|
33
|
-
var
|
|
34
|
-
if (typeof localStorage > "u") return
|
|
945
|
+
function zs(e, t) {
|
|
946
|
+
var n;
|
|
947
|
+
if (typeof localStorage > "u") return t();
|
|
35
948
|
try {
|
|
36
949
|
const s = localStorage.getItem(e);
|
|
37
950
|
if (s) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return { sessions:
|
|
951
|
+
const o = JSON.parse(s), a = Array.isArray(o.sessions) ? o.sessions : Array.isArray(o.items) ? o.items : null;
|
|
952
|
+
if (a)
|
|
953
|
+
return { sessions: a, activeId: o.activeId ?? ((n = a[0]) == null ? void 0 : n.id) ?? "" };
|
|
41
954
|
}
|
|
42
955
|
} catch {
|
|
43
956
|
}
|
|
44
|
-
return
|
|
957
|
+
return t();
|
|
45
958
|
}
|
|
46
|
-
function
|
|
959
|
+
function Ks(e, t) {
|
|
47
960
|
if (!(typeof localStorage > "u"))
|
|
48
961
|
try {
|
|
49
|
-
localStorage.setItem(e, JSON.stringify(
|
|
962
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
50
963
|
} catch {
|
|
51
964
|
}
|
|
52
965
|
}
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
let s =
|
|
56
|
-
const
|
|
57
|
-
s =
|
|
966
|
+
function Hs(e = {}) {
|
|
967
|
+
const t = e.storageKey ?? "workspace:sessions", n = e.initial ?? Gs;
|
|
968
|
+
let s = zs(t, n);
|
|
969
|
+
const o = /* @__PURE__ */ new Set(), a = (l) => {
|
|
970
|
+
s = l, Ks(t, s), o.forEach((g) => g());
|
|
58
971
|
};
|
|
59
972
|
return {
|
|
60
973
|
getState: () => s,
|
|
61
|
-
subscribe(
|
|
62
|
-
return
|
|
63
|
-
|
|
974
|
+
subscribe(l) {
|
|
975
|
+
return o.add(l), () => {
|
|
976
|
+
o.delete(l);
|
|
64
977
|
};
|
|
65
978
|
},
|
|
66
|
-
switchTo(
|
|
67
|
-
|
|
979
|
+
switchTo(l) {
|
|
980
|
+
a({ ...s, activeId: l });
|
|
68
981
|
},
|
|
69
982
|
create() {
|
|
70
|
-
const
|
|
71
|
-
id:
|
|
983
|
+
const l = `s${Date.now()}`, g = {
|
|
984
|
+
id: l,
|
|
72
985
|
title: "New session",
|
|
73
986
|
updatedAt: Date.now()
|
|
74
987
|
};
|
|
75
|
-
|
|
988
|
+
a({ sessions: [g, ...s.sessions], activeId: l });
|
|
76
989
|
},
|
|
77
|
-
remove(
|
|
78
|
-
var
|
|
79
|
-
const
|
|
80
|
-
|
|
990
|
+
remove(l) {
|
|
991
|
+
var d;
|
|
992
|
+
const g = s.sessions.filter((m) => m.id !== l), f = s.activeId === l ? ((d = g[0]) == null ? void 0 : d.id) ?? "" : s.activeId;
|
|
993
|
+
a({ sessions: g, activeId: f });
|
|
81
994
|
}
|
|
82
995
|
};
|
|
83
996
|
}
|
|
84
|
-
function
|
|
85
|
-
return
|
|
997
|
+
function Js(e) {
|
|
998
|
+
return cn(e.subscribe, e.getState, e.getState);
|
|
86
999
|
}
|
|
87
|
-
const
|
|
88
|
-
function
|
|
89
|
-
return new Promise((
|
|
1000
|
+
const Bs = 500, qs = 1e4;
|
|
1001
|
+
function Pr(e) {
|
|
1002
|
+
return new Promise((t, n) => {
|
|
90
1003
|
let s;
|
|
91
|
-
const
|
|
92
|
-
s && globalThis.clearTimeout(s), e.removeEventListener("abort",
|
|
93
|
-
},
|
|
94
|
-
|
|
1004
|
+
const o = () => {
|
|
1005
|
+
s && globalThis.clearTimeout(s), e.removeEventListener("abort", a);
|
|
1006
|
+
}, a = () => {
|
|
1007
|
+
o(), n(new DOMException("Warmup aborted", "AbortError"));
|
|
95
1008
|
};
|
|
96
1009
|
if (e.aborted) {
|
|
97
|
-
|
|
1010
|
+
a();
|
|
98
1011
|
return;
|
|
99
1012
|
}
|
|
100
1013
|
s = globalThis.setTimeout(() => {
|
|
101
|
-
|
|
102
|
-
},
|
|
1014
|
+
o(), t();
|
|
1015
|
+
}, Bs), e.addEventListener("abort", a, { once: !0 });
|
|
103
1016
|
});
|
|
104
1017
|
}
|
|
105
|
-
async function
|
|
106
|
-
const
|
|
107
|
-
if (!
|
|
108
|
-
const
|
|
109
|
-
let
|
|
1018
|
+
async function Vs(e) {
|
|
1019
|
+
const t = e.body;
|
|
1020
|
+
if (!t) return _t(await Lt(e));
|
|
1021
|
+
const n = t.getReader(), s = new TextDecoder();
|
|
1022
|
+
let o = "";
|
|
110
1023
|
try {
|
|
111
1024
|
for (; ; ) {
|
|
112
|
-
const { done:
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
1025
|
+
const { done: a, value: l } = await n.read();
|
|
1026
|
+
if (l) {
|
|
1027
|
+
o += s.decode(l, { stream: !a });
|
|
1028
|
+
const g = _t(o);
|
|
1029
|
+
if (g) return g;
|
|
117
1030
|
}
|
|
118
|
-
if (
|
|
119
|
-
return
|
|
1031
|
+
if (a)
|
|
1032
|
+
return o += s.decode(), _t(o);
|
|
120
1033
|
}
|
|
121
1034
|
} finally {
|
|
122
|
-
await
|
|
1035
|
+
await n.cancel().catch(() => {
|
|
123
1036
|
});
|
|
124
1037
|
}
|
|
125
1038
|
}
|
|
126
|
-
function
|
|
1039
|
+
function Ys(e) {
|
|
127
1040
|
if (!((e == null ? void 0 : e.runtimeDependenciesState) !== "preparing" && (e == null ? void 0 : e.runtimeDependenciesState) !== "ready" && (e == null ? void 0 : e.runtimeDependenciesState) !== "failed"))
|
|
128
1041
|
return {
|
|
129
1042
|
state: e.runtimeDependenciesState,
|
|
@@ -131,975 +1044,1158 @@ function ds(e) {
|
|
|
131
1044
|
...e.runtimeDependenciesRequirement ? { requirement: e.runtimeDependenciesRequirement } : {}
|
|
132
1045
|
};
|
|
133
1046
|
}
|
|
134
|
-
async function
|
|
1047
|
+
async function Xs(e) {
|
|
135
1048
|
if (!e.ok) {
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
throw new Error(
|
|
1049
|
+
const o = await Lt(e);
|
|
1050
|
+
if (fn(o)) return { status: "preparing" };
|
|
1051
|
+
throw new Error(gn(o) ?? `/api/v1/ready-status failed with ${e.status}`);
|
|
139
1052
|
}
|
|
140
|
-
const
|
|
141
|
-
if ((
|
|
142
|
-
if (s && (
|
|
143
|
-
return { status: "ready", runtimeDependencies:
|
|
144
|
-
throw new Error(
|
|
1053
|
+
const t = await Vs(e), n = Ys(t), s = as(t);
|
|
1054
|
+
if ((t == null ? void 0 : t.state) === "degraded" || (t == null ? void 0 : t.state) === "failed") {
|
|
1055
|
+
if (s && (n == null ? void 0 : n.state) === "failed")
|
|
1056
|
+
return { status: "ready", runtimeDependencies: n };
|
|
1057
|
+
throw new Error(t.message ?? "Workspace failed to prepare");
|
|
145
1058
|
}
|
|
146
|
-
return s ? { status: "ready", ...
|
|
1059
|
+
return s ? { status: "ready", ...n ? { runtimeDependencies: n } : {} } : { status: "preparing", ...n ? { runtimeDependencies: n } : {} };
|
|
147
1060
|
}
|
|
148
|
-
async function
|
|
1061
|
+
async function js({
|
|
149
1062
|
apiBaseUrl: e,
|
|
150
|
-
path:
|
|
151
|
-
headers:
|
|
1063
|
+
path: t,
|
|
1064
|
+
headers: n,
|
|
152
1065
|
signal: s,
|
|
153
|
-
workspaceId:
|
|
1066
|
+
workspaceId: o
|
|
154
1067
|
}) {
|
|
155
|
-
const
|
|
156
|
-
s.aborted &&
|
|
1068
|
+
const a = new AbortController(), l = globalThis.setTimeout(() => a.abort(new DOMException("Warmup attempt timed out", "TimeoutError")), qs), g = () => a.abort(s.reason);
|
|
1069
|
+
s.aborted && g(), s.addEventListener("abort", g, { once: !0 });
|
|
157
1070
|
try {
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
throw new Error(
|
|
1071
|
+
const f = await fetch(Ur(e, t), { headers: n, signal: a.signal });
|
|
1072
|
+
if (Gr(t)) return await Xs(f);
|
|
1073
|
+
const d = await Lt(f);
|
|
1074
|
+
if (!f.ok) {
|
|
1075
|
+
const m = fn(d);
|
|
1076
|
+
if (m) return { status: "preparing", ...m };
|
|
1077
|
+
throw new Error(gn(d) ?? `${t} failed with ${f.status}`);
|
|
165
1078
|
}
|
|
166
|
-
return
|
|
167
|
-
} catch (
|
|
168
|
-
if (s.aborted) throw
|
|
169
|
-
if (
|
|
170
|
-
throw
|
|
1079
|
+
return d && typeof d == "object" && zr(e, n["x-boring-workspace-id"] ?? o, t, d), { status: "ready" };
|
|
1080
|
+
} catch (f) {
|
|
1081
|
+
if (s.aborted) throw f;
|
|
1082
|
+
if (a.signal.aborted || f instanceof TypeError) return { status: "preparing" };
|
|
1083
|
+
throw f;
|
|
171
1084
|
} finally {
|
|
172
|
-
globalThis.clearTimeout(
|
|
1085
|
+
globalThis.clearTimeout(l), s.removeEventListener("abort", g);
|
|
173
1086
|
}
|
|
174
1087
|
}
|
|
175
|
-
function
|
|
1088
|
+
function Qs({
|
|
176
1089
|
workspaceId: e,
|
|
177
|
-
requestHeaders:
|
|
178
|
-
apiBaseUrl:
|
|
179
|
-
preloadPaths: s =
|
|
180
|
-
provisionWorkspace:
|
|
181
|
-
onStatusChange:
|
|
1090
|
+
requestHeaders: t,
|
|
1091
|
+
apiBaseUrl: n,
|
|
1092
|
+
preloadPaths: s = Fr,
|
|
1093
|
+
provisionWorkspace: o = !0,
|
|
1094
|
+
onStatusChange: a
|
|
182
1095
|
}) {
|
|
183
|
-
return
|
|
184
|
-
let
|
|
185
|
-
const
|
|
186
|
-
async function
|
|
187
|
-
var
|
|
188
|
-
|
|
1096
|
+
return _(() => {
|
|
1097
|
+
let l = !1;
|
|
1098
|
+
const g = new AbortController(), f = Dt(e, t);
|
|
1099
|
+
async function d() {
|
|
1100
|
+
var m, A;
|
|
1101
|
+
a == null || a({ status: "preparing" });
|
|
189
1102
|
try {
|
|
190
|
-
const
|
|
191
|
-
apiBaseUrl:
|
|
1103
|
+
const R = $r(s, o), W = (h) => js({
|
|
1104
|
+
apiBaseUrl: n,
|
|
192
1105
|
path: h,
|
|
193
|
-
headers:
|
|
194
|
-
signal:
|
|
1106
|
+
headers: f,
|
|
1107
|
+
signal: g.signal,
|
|
195
1108
|
workspaceId: e
|
|
196
1109
|
});
|
|
197
|
-
let
|
|
198
|
-
if (
|
|
199
|
-
let
|
|
200
|
-
for (;
|
|
1110
|
+
let E = await Promise.all(R.map(async (h) => ({ path: h, result: await W(h) })));
|
|
1111
|
+
if (l || g.signal.aborted) return;
|
|
1112
|
+
let v = (m = E.find((h) => h.result.runtimeDependencies)) == null ? void 0 : m.result.runtimeDependencies, p = E.filter((h) => h.result.status === "preparing");
|
|
1113
|
+
for (; p.length > 0; ) {
|
|
201
1114
|
let h;
|
|
202
|
-
for (const
|
|
203
|
-
if (
|
|
204
|
-
h =
|
|
1115
|
+
for (const x of p)
|
|
1116
|
+
if (x.result.status === "preparing" && x.result.requirement) {
|
|
1117
|
+
h = x.result.requirement;
|
|
205
1118
|
break;
|
|
206
1119
|
}
|
|
207
|
-
if (
|
|
208
|
-
|
|
1120
|
+
if (a == null || a({ status: "preparing", message: "Workspace is still preparing", ...h ? { requirement: h } : {} }), await Pr(g.signal), l || g.signal.aborted || (E = await Promise.all(p.map(async (x) => ({ path: x.path, result: await W(x.path) }))), l || g.signal.aborted)) return;
|
|
1121
|
+
v = ((A = E.find((x) => x.result.runtimeDependencies)) == null ? void 0 : A.result.runtimeDependencies) ?? v, p = E.filter((x) => x.result.status === "preparing");
|
|
209
1122
|
}
|
|
210
|
-
for (
|
|
211
|
-
if (await
|
|
212
|
-
const h = await
|
|
213
|
-
if (
|
|
214
|
-
|
|
1123
|
+
for (a == null || a({ status: "ready", ...v ? { runtimeDependencies: v } : {} }); (v == null ? void 0 : v.state) === "preparing"; ) {
|
|
1124
|
+
if (await Pr(g.signal), l || g.signal.aborted) return;
|
|
1125
|
+
const h = await W("/api/v1/ready-status");
|
|
1126
|
+
if (l || g.signal.aborted) return;
|
|
1127
|
+
v = h.runtimeDependencies, v && (a == null || a({ status: "ready", runtimeDependencies: v }));
|
|
215
1128
|
}
|
|
216
|
-
} catch (
|
|
217
|
-
if (
|
|
218
|
-
|
|
1129
|
+
} catch (R) {
|
|
1130
|
+
if (l || g.signal.aborted) return;
|
|
1131
|
+
a == null || a({
|
|
219
1132
|
status: "failed",
|
|
220
|
-
message:
|
|
1133
|
+
message: R instanceof Error ? R.message : "Workspace failed to prepare"
|
|
221
1134
|
});
|
|
222
1135
|
}
|
|
223
1136
|
}
|
|
224
|
-
return
|
|
225
|
-
|
|
1137
|
+
return d(), () => {
|
|
1138
|
+
l = !0, g.abort();
|
|
1139
|
+
};
|
|
1140
|
+
}, [n, a, s, o, t, e]), null;
|
|
1141
|
+
}
|
|
1142
|
+
function Zs({ status: e }) {
|
|
1143
|
+
const t = e.status === "ready" ? void 0 : e.requirement, n = e.status !== "failed", s = n ? t === "workspace-fs" ? "Preparing files…" : t === "sandbox-exec" ? "Preparing secure runtime…" : t === "ui-bridge" ? "Connecting workspace…" : "Preparing workspace…" : "Workspace workbench failed", o = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
|
|
1144
|
+
return /* @__PURE__ */ i("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ b("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
1145
|
+
n ? /* @__PURE__ */ i("div", { className: "mx-auto mb-3 h-7 w-7 rounded-full border-2 border-muted-foreground/20 border-t-foreground animate-spin", "aria-hidden": "true" }) : null,
|
|
1146
|
+
/* @__PURE__ */ i("div", { className: "text-sm font-semibold text-foreground", children: s }),
|
|
1147
|
+
/* @__PURE__ */ i("p", { className: "mt-2 text-sm text-muted-foreground", children: o }),
|
|
1148
|
+
e.status === "failed" ? /* @__PURE__ */ i("p", { className: "mt-3 text-xs text-muted-foreground", children: "Reload the workspace to retry." }) : null
|
|
1149
|
+
] }) });
|
|
1150
|
+
}
|
|
1151
|
+
function eo() {
|
|
1152
|
+
return /* @__PURE__ */ i("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ b("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
1153
|
+
/* @__PURE__ */ i("div", { className: "mx-auto mb-3 h-7 w-7 rounded-full border-2 border-muted-foreground/20 border-t-foreground animate-spin", "aria-hidden": "true" }),
|
|
1154
|
+
/* @__PURE__ */ i("div", { className: "text-sm font-semibold text-foreground", children: "Loading sessions…" }),
|
|
1155
|
+
/* @__PURE__ */ i("p", { className: "mt-2 text-sm text-muted-foreground", children: "Finding this workspace’s saved chats." })
|
|
1156
|
+
] }) });
|
|
1157
|
+
}
|
|
1158
|
+
function to(e) {
|
|
1159
|
+
if (!e) return "/api/v1/ui";
|
|
1160
|
+
const t = e.replace(/\/$/, ""), n = "/api/v1/ui";
|
|
1161
|
+
return t.endsWith(n) ? t : `${t}${n}`;
|
|
1162
|
+
}
|
|
1163
|
+
function no(e) {
|
|
1164
|
+
return `${to(e)}/state`;
|
|
1165
|
+
}
|
|
1166
|
+
function ro(e) {
|
|
1167
|
+
var s;
|
|
1168
|
+
const t = e.openTabs.find((o) => o.id === e.activeTab), n = (s = t == null ? void 0 : t.params) == null ? void 0 : s.path;
|
|
1169
|
+
return typeof n == "string" ? n : null;
|
|
1170
|
+
}
|
|
1171
|
+
function io({
|
|
1172
|
+
bridgeEndpoint: e,
|
|
1173
|
+
requestHeaders: t,
|
|
1174
|
+
navOpen: n,
|
|
1175
|
+
surfaceOpen: s,
|
|
1176
|
+
surfaceReady: o,
|
|
1177
|
+
snapshot: a
|
|
1178
|
+
}) {
|
|
1179
|
+
const l = Kr(), g = ls(), f = cn(
|
|
1180
|
+
l.subscribe,
|
|
1181
|
+
l.getSnapshot,
|
|
1182
|
+
l.getSnapshot
|
|
1183
|
+
), d = cn(
|
|
1184
|
+
g.subscribe,
|
|
1185
|
+
g.getSnapshot,
|
|
1186
|
+
g.getSnapshot
|
|
1187
|
+
), m = J(null);
|
|
1188
|
+
return _(() => {
|
|
1189
|
+
var W;
|
|
1190
|
+
if (e === null || s && !o) return;
|
|
1191
|
+
(W = m.current) == null || W.abort();
|
|
1192
|
+
const A = new AbortController();
|
|
1193
|
+
m.current = A;
|
|
1194
|
+
const R = {
|
|
1195
|
+
v: 1,
|
|
1196
|
+
drawerOpen: n,
|
|
1197
|
+
workbenchOpen: s,
|
|
1198
|
+
openTabs: a.openTabs,
|
|
1199
|
+
activeTab: a.activeTab,
|
|
1200
|
+
activeFile: ro(a),
|
|
1201
|
+
availablePanels: f.map((E) => E.id),
|
|
1202
|
+
availableSurfaces: d.flatMap((E) => {
|
|
1203
|
+
const v = cs(E);
|
|
1204
|
+
return v ? [v] : [];
|
|
1205
|
+
})
|
|
1206
|
+
};
|
|
1207
|
+
return fetch(no(e), {
|
|
1208
|
+
method: "PUT",
|
|
1209
|
+
headers: { ...t, "Content-Type": "application/json" },
|
|
1210
|
+
body: JSON.stringify({ state: R, causedBy: "user" }),
|
|
1211
|
+
signal: A.signal
|
|
1212
|
+
}).catch(() => {
|
|
1213
|
+
}), () => {
|
|
1214
|
+
A.abort();
|
|
226
1215
|
};
|
|
227
|
-
}, [
|
|
1216
|
+
}, [e, n, f, t, a, s, o, d]), null;
|
|
1217
|
+
}
|
|
1218
|
+
function so({ onQuestionOpen: e }) {
|
|
1219
|
+
const { blockers: t } = ds(), n = t.some((o) => o.reason === "waiting_for_user_input"), s = J(!1);
|
|
1220
|
+
return _(() => {
|
|
1221
|
+
n && !s.current && e(), s.current = n;
|
|
1222
|
+
}, [n, e]), null;
|
|
228
1223
|
}
|
|
229
|
-
function
|
|
1224
|
+
function Er(e) {
|
|
230
1225
|
return typeof (e == null ? void 0 : e.id) == "string" ? e.id : null;
|
|
231
1226
|
}
|
|
232
|
-
function
|
|
233
|
-
if (e.includes(
|
|
234
|
-
const s =
|
|
235
|
-
return [...e.slice(0,
|
|
1227
|
+
function Ct(e, t, n) {
|
|
1228
|
+
if (e.includes(n)) return e;
|
|
1229
|
+
const s = t ? e.indexOf(t) : -1, o = s >= 0 ? s + 1 : e.length;
|
|
1230
|
+
return [...e.slice(0, o), n, ...e.slice(o)];
|
|
236
1231
|
}
|
|
237
|
-
function
|
|
238
|
-
if (e.includes(
|
|
239
|
-
if (e.length === 0) return [
|
|
240
|
-
const s =
|
|
241
|
-
return e.map((
|
|
1232
|
+
function on(e, t, n) {
|
|
1233
|
+
if (e.includes(n)) return e;
|
|
1234
|
+
if (e.length === 0) return [n];
|
|
1235
|
+
const s = t ? e.indexOf(t) : -1, o = s >= 0 ? s : 0;
|
|
1236
|
+
return e.map((a, l) => l === o ? n : a);
|
|
242
1237
|
}
|
|
243
|
-
function
|
|
244
|
-
return e.endsWith(":surface") ? e.slice(0, -8) :
|
|
1238
|
+
function oo(e, t) {
|
|
1239
|
+
return e.endsWith(":surface") ? e.slice(0, -8) : t;
|
|
1240
|
+
}
|
|
1241
|
+
function ao(e, t, n) {
|
|
1242
|
+
const [s, o] = O(() => Nr(e, t, n));
|
|
1243
|
+
_(() => {
|
|
1244
|
+
o(Nr(e, t, n));
|
|
1245
|
+
}, [e, t, n]);
|
|
1246
|
+
const a = k(
|
|
1247
|
+
(l) => {
|
|
1248
|
+
o((g) => {
|
|
1249
|
+
const f = typeof l == "function" ? l(g) : l;
|
|
1250
|
+
return Es(e, f, n), f;
|
|
1251
|
+
});
|
|
1252
|
+
},
|
|
1253
|
+
[n, e]
|
|
1254
|
+
);
|
|
1255
|
+
return [s, a];
|
|
245
1256
|
}
|
|
246
|
-
function
|
|
247
|
-
const [s,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}, [e,
|
|
251
|
-
const
|
|
252
|
-
(
|
|
253
|
-
|
|
1257
|
+
function Tt(e, t, n) {
|
|
1258
|
+
const [s, o] = O(() => Sr(e, t, n));
|
|
1259
|
+
_(() => {
|
|
1260
|
+
o(Sr(e, t, n));
|
|
1261
|
+
}, [e, t, n]);
|
|
1262
|
+
const a = k(
|
|
1263
|
+
(l) => {
|
|
1264
|
+
o(l), Ps(e, l, n);
|
|
254
1265
|
},
|
|
255
|
-
[
|
|
1266
|
+
[n, e]
|
|
256
1267
|
);
|
|
257
|
-
return [s,
|
|
1268
|
+
return [s, a];
|
|
258
1269
|
}
|
|
259
|
-
const
|
|
1270
|
+
const an = {}, lo = [], kr = { status: "preparing" };
|
|
1271
|
+
function Ar(e, t, n) {
|
|
1272
|
+
return Math.min(n, Math.max(t, e));
|
|
1273
|
+
}
|
|
1274
|
+
const Rr = {
|
|
260
1275
|
openTabs: [],
|
|
261
1276
|
activeTab: null
|
|
262
1277
|
};
|
|
263
|
-
function
|
|
264
|
-
const
|
|
265
|
-
return /* @__PURE__ */ f("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ Re("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
266
|
-
r ? /* @__PURE__ */ f("div", { className: "mx-auto mb-3 h-7 w-7 rounded-full border-2 border-muted-foreground/20 border-t-foreground animate-spin", "aria-hidden": "true" }) : null,
|
|
267
|
-
/* @__PURE__ */ f("div", { className: "text-sm font-semibold text-foreground", children: s }),
|
|
268
|
-
/* @__PURE__ */ f("p", { className: "mt-2 text-sm text-muted-foreground", children: i }),
|
|
269
|
-
e.status === "failed" ? /* @__PURE__ */ f("p", { className: "mt-3 text-xs text-muted-foreground", children: "Reload the workspace to retry." }) : null
|
|
270
|
-
] }) });
|
|
271
|
-
}
|
|
272
|
-
function bs(e) {
|
|
273
|
-
const n = e.workspaceId ?? ys(e.requestHeaders) ?? e.storageKey, r = Gr({
|
|
1278
|
+
function co(e) {
|
|
1279
|
+
const t = e.workspaceId ?? uo(e.requestHeaders) ?? e.storageKey, n = ns({
|
|
274
1280
|
apiBaseUrl: e.apiBaseUrl,
|
|
275
|
-
workspaceId:
|
|
276
|
-
storageScope:
|
|
1281
|
+
workspaceId: t,
|
|
1282
|
+
storageScope: t,
|
|
277
1283
|
requestHeaders: e.requestHeaders,
|
|
278
1284
|
enabled: e.enabled,
|
|
279
1285
|
connectActiveSession: !1,
|
|
280
1286
|
refreshKey: e.refreshKey
|
|
281
1287
|
});
|
|
282
|
-
return { ...
|
|
1288
|
+
return { ...n, workspaceId: n.dataStorageScope };
|
|
283
1289
|
}
|
|
284
|
-
function
|
|
1290
|
+
function uo(e) {
|
|
285
1291
|
return (e == null ? void 0 : e["x-boring-workspace-id"]) ?? (e == null ? void 0 : e["X-Boring-Workspace-Id"]) ?? null;
|
|
286
1292
|
}
|
|
287
|
-
function
|
|
288
|
-
const
|
|
289
|
-
return
|
|
1293
|
+
function fo(e) {
|
|
1294
|
+
const t = e.reloaded ? "Extensions reloaded." : "Extensions will reload on the next message.", n = Array.isArray(e.diagnostics) ? e.diagnostics.map((s) => s.message).filter((s) => !!s) : [];
|
|
1295
|
+
return n.length > 0 ? `${t}
|
|
290
1296
|
|
|
291
1297
|
Warnings:
|
|
292
|
-
${
|
|
293
|
-
`)}` :
|
|
1298
|
+
${n.join(`
|
|
1299
|
+
`)}` : t;
|
|
294
1300
|
}
|
|
295
|
-
function
|
|
296
|
-
var
|
|
1301
|
+
function go(e) {
|
|
1302
|
+
var t;
|
|
297
1303
|
try {
|
|
298
|
-
return ((
|
|
1304
|
+
return ((t = globalThis.localStorage) == null ? void 0 : t.getItem(e)) ?? null;
|
|
299
1305
|
} catch {
|
|
300
1306
|
return null;
|
|
301
1307
|
}
|
|
302
1308
|
}
|
|
303
|
-
function
|
|
304
|
-
var
|
|
1309
|
+
function Cr(e, t) {
|
|
1310
|
+
var n;
|
|
305
1311
|
try {
|
|
306
|
-
const s = (
|
|
1312
|
+
const s = (n = globalThis.localStorage) == null ? void 0 : n.getItem(e);
|
|
307
1313
|
if (!s) return null;
|
|
308
|
-
const
|
|
309
|
-
if (
|
|
310
|
-
const
|
|
311
|
-
return { workspaceId:
|
|
1314
|
+
const o = JSON.parse(s), a = Array.isArray(o.ids) ? o.ids.filter((g) => typeof g == "string" && g.length > 0) : [];
|
|
1315
|
+
if (a.length === 0) return null;
|
|
1316
|
+
const l = typeof o.activeId == "string" && a.includes(o.activeId) ? o.activeId : a[0];
|
|
1317
|
+
return { workspaceId: t, ids: a, activeId: l };
|
|
312
1318
|
} catch {
|
|
313
1319
|
return null;
|
|
314
1320
|
}
|
|
315
1321
|
}
|
|
316
|
-
function
|
|
317
|
-
var
|
|
1322
|
+
function mo(e, t) {
|
|
1323
|
+
var n, s;
|
|
318
1324
|
try {
|
|
319
|
-
if (
|
|
320
|
-
(
|
|
1325
|
+
if (t.ids.length === 0) {
|
|
1326
|
+
(n = globalThis.localStorage) == null || n.removeItem(e);
|
|
321
1327
|
return;
|
|
322
1328
|
}
|
|
323
1329
|
(s = globalThis.localStorage) == null || s.setItem(
|
|
324
1330
|
e,
|
|
325
|
-
JSON.stringify({ ids:
|
|
1331
|
+
JSON.stringify({ ids: t.ids, activeId: t.activeId })
|
|
326
1332
|
);
|
|
327
1333
|
} catch {
|
|
328
1334
|
}
|
|
329
1335
|
}
|
|
330
|
-
function
|
|
331
|
-
var
|
|
1336
|
+
function Tr(e, t) {
|
|
1337
|
+
var n;
|
|
332
1338
|
try {
|
|
333
|
-
const s = (
|
|
1339
|
+
const s = (n = globalThis.localStorage) == null ? void 0 : n.getItem(e);
|
|
334
1340
|
if (!s) return null;
|
|
335
|
-
const
|
|
336
|
-
return { workspaceId:
|
|
1341
|
+
const o = JSON.parse(s), a = Array.isArray(o.ids) ? o.ids.filter((l) => typeof l == "string" && l.length > 0) : [];
|
|
1342
|
+
return { workspaceId: t, ids: a };
|
|
337
1343
|
} catch {
|
|
338
1344
|
return null;
|
|
339
1345
|
}
|
|
340
1346
|
}
|
|
341
|
-
function
|
|
342
|
-
var
|
|
1347
|
+
function po(e, t) {
|
|
1348
|
+
var n, s;
|
|
343
1349
|
try {
|
|
344
|
-
if (
|
|
345
|
-
(
|
|
1350
|
+
if (t.length === 0) {
|
|
1351
|
+
(n = globalThis.localStorage) == null || n.removeItem(e);
|
|
346
1352
|
return;
|
|
347
1353
|
}
|
|
348
|
-
(s = globalThis.localStorage) == null || s.setItem(e, JSON.stringify({ ids:
|
|
1354
|
+
(s = globalThis.localStorage) == null || s.setItem(e, JSON.stringify({ ids: t }));
|
|
349
1355
|
} catch {
|
|
350
1356
|
}
|
|
351
1357
|
}
|
|
352
|
-
function
|
|
353
|
-
return /* @__PURE__ */ f("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ Re("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
354
|
-
/* @__PURE__ */ f("div", { className: "mx-auto mb-3 h-7 w-7 rounded-full border-2 border-muted-foreground/20 border-t-foreground animate-spin", "aria-hidden": "true" }),
|
|
355
|
-
/* @__PURE__ */ f("div", { className: "text-sm font-semibold text-foreground", children: "Loading sessions…" }),
|
|
356
|
-
/* @__PURE__ */ f("p", { className: "mt-2 text-sm text-muted-foreground", children: "Finding this workspace’s saved chats." })
|
|
357
|
-
] }) });
|
|
358
|
-
}
|
|
359
|
-
function ws(e) {
|
|
360
|
-
if (!e) return "/api/v1/ui";
|
|
361
|
-
const n = e.replace(/\/$/, ""), r = "/api/v1/ui";
|
|
362
|
-
return n.endsWith(r) ? n : `${n}${r}`;
|
|
363
|
-
}
|
|
364
|
-
function Ns(e) {
|
|
365
|
-
return `${ws(e)}/state`;
|
|
366
|
-
}
|
|
367
|
-
function Ds(e) {
|
|
368
|
-
var s;
|
|
369
|
-
const n = e.openTabs.find((i) => i.id === e.activeTab), r = (s = n == null ? void 0 : n.params) == null ? void 0 : s.path;
|
|
370
|
-
return typeof r == "string" ? r : null;
|
|
371
|
-
}
|
|
372
|
-
function _s({
|
|
373
|
-
bridgeEndpoint: e,
|
|
374
|
-
requestHeaders: n,
|
|
375
|
-
navOpen: r,
|
|
376
|
-
surfaceOpen: s,
|
|
377
|
-
surfaceReady: i,
|
|
378
|
-
snapshot: o
|
|
379
|
-
}) {
|
|
380
|
-
const c = In(), d = $(null);
|
|
381
|
-
return E(() => {
|
|
382
|
-
var y;
|
|
383
|
-
if (e === null || s && !i) return;
|
|
384
|
-
(y = d.current) == null || y.abort();
|
|
385
|
-
const b = new AbortController();
|
|
386
|
-
d.current = b;
|
|
387
|
-
const P = {
|
|
388
|
-
v: 1,
|
|
389
|
-
drawerOpen: r,
|
|
390
|
-
workbenchOpen: s,
|
|
391
|
-
openTabs: o.openTabs,
|
|
392
|
-
activeTab: o.activeTab,
|
|
393
|
-
activeFile: Ds(o),
|
|
394
|
-
availablePanels: c.list().map((B) => B.id)
|
|
395
|
-
};
|
|
396
|
-
return fetch(Ns(e), {
|
|
397
|
-
method: "PUT",
|
|
398
|
-
headers: { ...n, "Content-Type": "application/json" },
|
|
399
|
-
body: JSON.stringify({ state: P, causedBy: "user" }),
|
|
400
|
-
signal: b.signal
|
|
401
|
-
}).catch(() => {
|
|
402
|
-
}), () => {
|
|
403
|
-
b.abort();
|
|
404
|
-
};
|
|
405
|
-
}, [e, r, c, n, o, s, i]), null;
|
|
406
|
-
}
|
|
407
|
-
function Qs({
|
|
1358
|
+
function Fo({
|
|
408
1359
|
workspaceId: e,
|
|
409
|
-
chatPanel:
|
|
410
|
-
useSessions:
|
|
1360
|
+
chatPanel: t,
|
|
1361
|
+
useSessions: n,
|
|
411
1362
|
requestHeaders: s,
|
|
412
|
-
sessionStorageKey:
|
|
413
|
-
providerStorageKey:
|
|
414
|
-
surfaceStorageKey:
|
|
415
|
-
beforeShell:
|
|
416
|
-
afterShell:
|
|
417
|
-
panels:
|
|
418
|
-
commands:
|
|
419
|
-
catalogs:
|
|
420
|
-
plugins:
|
|
421
|
-
excludeDefaults:
|
|
422
|
-
capabilities:
|
|
423
|
-
apiBaseUrl:
|
|
424
|
-
authHeaders:
|
|
1363
|
+
sessionStorageKey: o,
|
|
1364
|
+
providerStorageKey: a,
|
|
1365
|
+
surfaceStorageKey: l,
|
|
1366
|
+
beforeShell: g,
|
|
1367
|
+
afterShell: f,
|
|
1368
|
+
panels: d,
|
|
1369
|
+
commands: m,
|
|
1370
|
+
catalogs: A,
|
|
1371
|
+
plugins: R,
|
|
1372
|
+
excludeDefaults: W,
|
|
1373
|
+
capabilities: E,
|
|
1374
|
+
apiBaseUrl: v,
|
|
1375
|
+
authHeaders: p,
|
|
425
1376
|
apiTimeout: h,
|
|
426
|
-
defaultTheme:
|
|
427
|
-
onThemeChange:
|
|
428
|
-
persistenceEnabled:
|
|
429
|
-
debug:
|
|
430
|
-
bridgeEndpoint:
|
|
431
|
-
fullPageBasePath:
|
|
432
|
-
onAuthError:
|
|
433
|
-
sessions:
|
|
434
|
-
activeSessionId:
|
|
435
|
-
onSwitchSession:
|
|
436
|
-
onCreateSession:
|
|
437
|
-
onDeleteSession:
|
|
438
|
-
onActiveSessionIdChange:
|
|
439
|
-
appTitle:
|
|
440
|
-
workspaceLabel:
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
1377
|
+
defaultTheme: x,
|
|
1378
|
+
onThemeChange: L,
|
|
1379
|
+
persistenceEnabled: F,
|
|
1380
|
+
debug: he,
|
|
1381
|
+
bridgeEndpoint: H,
|
|
1382
|
+
fullPageBasePath: Ot,
|
|
1383
|
+
onAuthError: Wt,
|
|
1384
|
+
sessions: ge,
|
|
1385
|
+
activeSessionId: ot,
|
|
1386
|
+
onSwitchSession: Ee,
|
|
1387
|
+
onCreateSession: me,
|
|
1388
|
+
onDeleteSession: be,
|
|
1389
|
+
onActiveSessionIdChange: ae,
|
|
1390
|
+
appTitle: $e = "Boring UI",
|
|
1391
|
+
workspaceLabel: at,
|
|
1392
|
+
workspaceSectionTitle: Mt = "Workspaces",
|
|
1393
|
+
appLeftLayoutMode: ke = "single-project",
|
|
1394
|
+
appLeftHeaderMode: It = "full",
|
|
1395
|
+
appLeftProjects: Ue,
|
|
1396
|
+
appLeftActiveProjectId: Ae,
|
|
1397
|
+
onSwitchAppLeftProject: Ge,
|
|
1398
|
+
onOpenAppLeftProjectSession: Ft,
|
|
1399
|
+
onShowMoreAppLeftProjectSessions: $t,
|
|
1400
|
+
onCreateAppLeftProject: Re,
|
|
1401
|
+
onOpenAppLeftProjectSettings: lt,
|
|
1402
|
+
onOpenAppLeftProjectInNewTab: y,
|
|
1403
|
+
defaultSessionTitle: T = "New session",
|
|
1404
|
+
workspaceLayout: M = "classic",
|
|
1405
|
+
navEnabled: le = !0,
|
|
1406
|
+
defaultNavOpen: Ut = !1,
|
|
1407
|
+
defaultSurfaceOpen: qr,
|
|
1408
|
+
defaultWorkbenchLeftTab: ct,
|
|
1409
|
+
defaultWorkbenchLeftOpen: Gt,
|
|
1410
|
+
surfaceInitialPanels: mn,
|
|
1411
|
+
topBarLeft: pn,
|
|
1412
|
+
topBarRight: hn,
|
|
1413
|
+
showThemeToggle: bn = !0,
|
|
1414
|
+
showSkills: Vr = !0,
|
|
1415
|
+
showPlugins: Yr = !0,
|
|
1416
|
+
appLeftActions: vn,
|
|
1417
|
+
chatParams: $,
|
|
1418
|
+
externalPlugins: Xr,
|
|
1419
|
+
hotReloadEnabled: jr,
|
|
1420
|
+
frontPluginHotReload: Qr,
|
|
1421
|
+
extraPanels: xn,
|
|
1422
|
+
extraCommands: yn,
|
|
1423
|
+
provisionWorkspace: zt,
|
|
1424
|
+
bootPreloadPaths: Zr,
|
|
1425
|
+
onWorkspaceWarmupStatusChange: dt,
|
|
1426
|
+
onOpenNav: Kt,
|
|
1427
|
+
onOpenSurface: ve,
|
|
1428
|
+
surfaceButtonBottomOffset: ei,
|
|
1429
|
+
className: ti
|
|
464
1430
|
}) {
|
|
465
|
-
var
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
),
|
|
470
|
-
() =>
|
|
1431
|
+
var gr, mr;
|
|
1432
|
+
const Sn = Xr !== !1, ni = Sn ? Qr : !1, Ht = Sn ? jr : !1, Jt = a ?? `boring-ui-v2:layout:${e}`, Y = l ?? `${Jt}:surface`, Ce = oo(
|
|
1433
|
+
Y,
|
|
1434
|
+
Jt
|
|
1435
|
+
), z = F !== !1, re = M === "plugin-tabs", ze = Vr !== !1, Ke = Yr !== !1, ri = d, ut = o ?? `boring-workspace:sessions:${e}`, xe = D(
|
|
1436
|
+
() => Dt(e, s ?? an),
|
|
471
1437
|
[s, e]
|
|
472
|
-
),
|
|
473
|
-
() =>
|
|
474
|
-
[
|
|
475
|
-
),
|
|
476
|
-
() =>
|
|
477
|
-
[
|
|
478
|
-
),
|
|
1438
|
+
), ii = D(
|
|
1439
|
+
() => Dt(e, { ...s ?? an, ...p ?? an }),
|
|
1440
|
+
[p, s, e]
|
|
1441
|
+
), ft = D(
|
|
1442
|
+
() => Hs({ storageKey: ut }),
|
|
1443
|
+
[ut]
|
|
1444
|
+
), Nn = Js(ft), [wn, si] = O(() => ({
|
|
479
1445
|
workspaceId: e,
|
|
480
|
-
status:
|
|
481
|
-
})), [
|
|
1446
|
+
status: kr
|
|
1447
|
+
})), [gt, Bt] = O(() => ({
|
|
482
1448
|
workspaceId: e,
|
|
483
1449
|
expired: !1
|
|
484
|
-
})), [
|
|
1450
|
+
})), [Pn, mt] = O(() => ({
|
|
485
1451
|
workspaceId: e,
|
|
486
1452
|
creating: !1
|
|
487
|
-
})), [
|
|
1453
|
+
})), [En, pt] = O(() => ({
|
|
488
1454
|
workspaceId: e,
|
|
489
1455
|
failed: !1
|
|
490
|
-
})),
|
|
491
|
-
() => (
|
|
492
|
-
), [
|
|
493
|
-
|
|
494
|
-
if (!
|
|
495
|
-
const
|
|
496
|
-
return () => clearTimeout(
|
|
497
|
-
}, [
|
|
498
|
-
const
|
|
499
|
-
() => (
|
|
500
|
-
),
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}, [
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
return
|
|
1456
|
+
})), He = `boring-workspace:chat-panes:${e}`, [U, ce] = O(
|
|
1457
|
+
() => (z ? Cr(He, e) : null) ?? { workspaceId: e, ids: [], activeId: null }
|
|
1458
|
+
), [Te, kn] = O(null);
|
|
1459
|
+
_(() => {
|
|
1460
|
+
if (!Te) return;
|
|
1461
|
+
const r = setTimeout(() => kn(null), 700);
|
|
1462
|
+
return () => clearTimeout(r);
|
|
1463
|
+
}, [Te]);
|
|
1464
|
+
const Je = `boring-workspace:pinned-sessions:${e}`, [An, Rn] = O(
|
|
1465
|
+
() => (z ? Tr(Je, e) : null) ?? { workspaceId: e, ids: [] }
|
|
1466
|
+
), Cn = An.workspaceId === e ? An.ids : lo;
|
|
1467
|
+
_(() => {
|
|
1468
|
+
Rn((r) => r.workspaceId === e ? r : (z ? Tr(Je, e) : null) ?? { workspaceId: e, ids: [] });
|
|
1469
|
+
}, [Je, z, e]);
|
|
1470
|
+
const Tn = k((r) => {
|
|
1471
|
+
Rn((c) => {
|
|
1472
|
+
const u = c.workspaceId === e ? c.ids : [], N = u.includes(r) ? u.filter((S) => S !== r) : [r, ...u];
|
|
1473
|
+
return z && po(Je, N), { workspaceId: e, ids: N };
|
|
508
1474
|
});
|
|
509
|
-
}, [
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}, [
|
|
513
|
-
|
|
514
|
-
}, [
|
|
515
|
-
const
|
|
516
|
-
},
|
|
517
|
-
requestHeaders:
|
|
518
|
-
storageKey:
|
|
1475
|
+
}, [Je, z, e]);
|
|
1476
|
+
_(() => {
|
|
1477
|
+
z && U.workspaceId === e && mo(He, U);
|
|
1478
|
+
}, [U, He, z, e]), _(() => {
|
|
1479
|
+
ce((r) => r.workspaceId === e ? r : (z ? Cr(He, e) : null) ?? { workspaceId: e, ids: [], activeId: null });
|
|
1480
|
+
}, [He, z, e]);
|
|
1481
|
+
const ht = wn.workspaceId === e ? wn.status : kr, oi = t ?? ts, ai = n ?? co, ye = !t || !!n, bt = ye && zt !== !1, qt = () => {
|
|
1482
|
+
}, G = ai({
|
|
1483
|
+
requestHeaders: xe,
|
|
1484
|
+
storageKey: ut,
|
|
519
1485
|
workspaceId: e,
|
|
520
|
-
apiBaseUrl:
|
|
521
|
-
enabled:
|
|
522
|
-
}), [
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
const
|
|
526
|
-
var
|
|
527
|
-
return
|
|
1486
|
+
apiBaseUrl: v,
|
|
1487
|
+
enabled: bt
|
|
1488
|
+
}), [Be, li] = O(() => ({ workspaceId: e, sessions: [], activeSessionId: null })), _n = bt && G.workspaceId != null && G.workspaceId !== e, ie = bt && !G.loading && !G.error && !_n, B = bt && !ie;
|
|
1489
|
+
_(() => {
|
|
1490
|
+
ie && li((r) => {
|
|
1491
|
+
const c = r.workspaceId === e, u = r.activeSessionId === G.activeSessionId, N = r.sessions.length === G.sessions.length && r.sessions.every((S, C) => {
|
|
1492
|
+
var j;
|
|
1493
|
+
return S.id === ((j = G.sessions[C]) == null ? void 0 : j.id);
|
|
528
1494
|
});
|
|
529
|
-
return
|
|
1495
|
+
return c && u && N ? r : {
|
|
530
1496
|
workspaceId: e,
|
|
531
|
-
sessions:
|
|
532
|
-
activeSessionId:
|
|
1497
|
+
sessions: G.sessions,
|
|
1498
|
+
activeSessionId: G.activeSessionId
|
|
533
1499
|
};
|
|
534
1500
|
});
|
|
535
|
-
}, [
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
if (!
|
|
539
|
-
|
|
1501
|
+
}, [G.activeSessionId, G.sessions, ie, e]);
|
|
1502
|
+
const vt = B && Be.workspaceId === e && Be.sessions.length > 0, xt = B ? go(ut) : null, Dn = B && !_n ? G.activeSessionId ?? null : null, de = ie ? G.sessions : vt ? Be.sessions : [], ci = ie ? G.activeSessionId : vt ? Be.activeSessionId : null, w = ye && (ie || vt) ? G : void 0, _e = ge !== void 0 || ot !== void 0 || Ee !== void 0 || me !== void 0 || be !== void 0, Ln = gt.workspaceId === e && gt.expired, qe = J(!1), Ve = !!(ie && w && !_e && de.length === 0 && !Ln), di = Pn.workspaceId === e && Pn.creating, ui = En.workspaceId === e && En.failed, fi = !!(ie && w && !_e && de.length === 0 && Ln && !qe.current && !ui), Ye = !!(B && G.loading && !G.error && ye && !_e && !vt && !xt && !Dn) || Ve || di || fi;
|
|
1503
|
+
_(() => {
|
|
1504
|
+
if (!Ve) {
|
|
1505
|
+
gt.workspaceId !== e && Bt({ workspaceId: e, expired: !1 });
|
|
540
1506
|
return;
|
|
541
1507
|
}
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
|
|
1508
|
+
Bt({ workspaceId: e, expired: !1 });
|
|
1509
|
+
const r = globalThis.setTimeout(() => {
|
|
1510
|
+
Bt({ workspaceId: e, expired: !0 });
|
|
545
1511
|
}, 2e3);
|
|
546
|
-
return () => globalThis.clearTimeout(
|
|
547
|
-
}, [
|
|
548
|
-
const
|
|
549
|
-
...
|
|
550
|
-
title:
|
|
551
|
-
})) : void 0,
|
|
552
|
-
id:
|
|
1512
|
+
return () => globalThis.clearTimeout(r);
|
|
1513
|
+
}, [gt.workspaceId, Ve, e]);
|
|
1514
|
+
const gi = w ? de.map((r) => ({
|
|
1515
|
+
...r,
|
|
1516
|
+
title: r.title ?? "New session"
|
|
1517
|
+
})) : void 0, mi = xt ? [{
|
|
1518
|
+
id: xt,
|
|
553
1519
|
title: "Loading sessions…",
|
|
554
1520
|
createdAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
555
1521
|
updatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
556
1522
|
turnCount: 0
|
|
557
|
-
}] : [],
|
|
558
|
-
|
|
559
|
-
if (
|
|
560
|
-
|
|
1523
|
+
}] : [], q = w ? gi ?? [] : B ? mi : _e ? ge ?? [] : Nn.sessions, pi = w ? ci ?? null : B ? xt ?? Dn : _e ? ot ?? null : Nn.activeId, De = ($ == null ? void 0 : $.autoSubmitInitialDraft) === !0, yt = De && ye && !_e, [ee, Xe] = O(() => yt ? null : void 0), On = J(e), Le = J(!1);
|
|
1524
|
+
_(() => {
|
|
1525
|
+
if (On.current !== e) {
|
|
1526
|
+
On.current = e, Le.current = !1, Xe(yt ? null : void 0);
|
|
561
1527
|
return;
|
|
562
1528
|
}
|
|
563
|
-
|
|
564
|
-
}, [
|
|
565
|
-
!
|
|
566
|
-
if (typeof (
|
|
1529
|
+
yt && ee === void 0 && (Le.current = !1, Xe(null));
|
|
1530
|
+
}, [ee, yt, e]), _(() => {
|
|
1531
|
+
!w || ee !== null || Le.current || (Le.current = !0, Promise.resolve(w.create({ title: T })).then((r) => {
|
|
1532
|
+
if (typeof (r == null ? void 0 : r.id) != "string")
|
|
567
1533
|
throw new Error("auto_submit_session_create_failed");
|
|
568
|
-
|
|
1534
|
+
Xe(r.id);
|
|
569
1535
|
}).catch(() => {
|
|
570
|
-
|
|
1536
|
+
Le.current = !1, Xe(void 0);
|
|
571
1537
|
}));
|
|
572
|
-
}, [
|
|
573
|
-
const
|
|
574
|
-
`${
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
),
|
|
1538
|
+
}, [ee, T, w]);
|
|
1539
|
+
const X = ee !== void 0 ? ee ?? null : pi, Q = B ? qt : (w == null ? void 0 : w.switch) ?? Ee ?? ft.switchTo, St = k((r) => (X && r !== X && us({ sessionId: X, reason: fs.sessionSwitch }), Q(r)), [X, Q]), je = B ? qt : w ? () => w.create() : me ? () => me() : () => ft.create(), Wn = B ? qt : (w == null ? void 0 : w.delete) ?? be ?? ft.remove, Mn = k((r) => (w && de.length <= 1 && (qe.current = !0), Wn(r)), [de.length, Wn, w]), In = ((gr = q.find((r) => r.id === X)) == null ? void 0 : gr.title) ?? void 0, [hi, Fn] = Tt(
|
|
1540
|
+
`${Ce}:drawer`,
|
|
1541
|
+
Ut,
|
|
1542
|
+
z
|
|
1543
|
+
), [Nt, $n] = Tt(
|
|
1544
|
+
`${Ce}:appLeftPaneCollapsed`,
|
|
1545
|
+
!1,
|
|
1546
|
+
z
|
|
1547
|
+
), [bi, vi] = ao(
|
|
1548
|
+
`${Ce}:appLeftPaneWidth`,
|
|
1549
|
+
268,
|
|
1550
|
+
z
|
|
1551
|
+
), Un = Ar(bi, 220, 420), [Qe, ue] = O(null);
|
|
1552
|
+
_(() => {
|
|
1553
|
+
(Qe === "skills" && !ze || Qe === "plugins" && !Ke) && ue(null);
|
|
1554
|
+
}, [Qe, Ke, ze]);
|
|
1555
|
+
const Gn = le && hi, [fe, te] = Tt(
|
|
578
1556
|
// Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
|
|
579
1557
|
// layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
|
|
580
1558
|
// key corrupts the JSON and drops the persisted workbench layout on reload.
|
|
581
|
-
`${
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
), [
|
|
585
|
-
`${
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
), [
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}, [
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
1559
|
+
`${Ce}:workbenchOpen`,
|
|
1560
|
+
qr ?? !1,
|
|
1561
|
+
z
|
|
1562
|
+
), [xi, Vt] = O(!1), [yi, Se] = Tt(
|
|
1563
|
+
`${Ce}:workbenchLeftOpen`,
|
|
1564
|
+
Gt ?? !1,
|
|
1565
|
+
z
|
|
1566
|
+
), [Si, Ze] = O(() => Gt ?? !1), Ni = Gt === !1 ? Si : yi, wi = k(() => {
|
|
1567
|
+
Se(!1), Ze(!1), ue(null);
|
|
1568
|
+
}, [Se]), et = J(!1), Ne = J(null), pe = J(fe), zn = J(Y), Yt = J(null), Xt = J([]);
|
|
1569
|
+
zn.current = Y;
|
|
1570
|
+
const [Kn, Hn] = O(() => ({
|
|
1571
|
+
key: Y,
|
|
1572
|
+
snapshot: Rr
|
|
1573
|
+
})), Pi = Kn.key === Y ? Kn.snapshot : Rr;
|
|
1574
|
+
_(() => {
|
|
1575
|
+
et.current = !1, qe.current = !1, mt({ workspaceId: e, creating: !1 }), pt({ workspaceId: e, failed: !1 });
|
|
1576
|
+
}, [e]), _(() => {
|
|
1577
|
+
Vt(!1), Xt.current = [];
|
|
1578
|
+
}, [Y]), _(() => {
|
|
1579
|
+
if (!(!w || w.loading) && !Ve && ee === void 0) {
|
|
1580
|
+
if (de.length > 0) {
|
|
1581
|
+
et.current = !1, qe.current = !1, mt((r) => r.workspaceId === e && r.creating ? { workspaceId: e, creating: !1 } : r), pt((r) => r.workspaceId === e && r.failed ? { workspaceId: e, failed: !1 } : r);
|
|
602
1582
|
return;
|
|
603
1583
|
}
|
|
604
|
-
|
|
605
|
-
|
|
1584
|
+
qe.current || et.current || (et.current = !0, mt({ workspaceId: e, creating: !0 }), pt({ workspaceId: e, failed: !1 }), Promise.resolve(w.create({ title: T })).catch(() => {
|
|
1585
|
+
et.current = !1, mt({ workspaceId: e, creating: !1 }), pt({ workspaceId: e, failed: !0 });
|
|
606
1586
|
}));
|
|
607
1587
|
}
|
|
608
|
-
}, [
|
|
609
|
-
|
|
610
|
-
}, [
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
key:
|
|
614
|
-
snapshot:
|
|
1588
|
+
}, [de.length, ee, T, Ve, w, e]), _(() => {
|
|
1589
|
+
pe.current = fe;
|
|
1590
|
+
}, [fe]);
|
|
1591
|
+
const Jn = k((r) => {
|
|
1592
|
+
Yt.current = { key: Y, api: r }, Vt(!0), Hn({
|
|
1593
|
+
key: Y,
|
|
1594
|
+
snapshot: r.getSnapshot()
|
|
615
1595
|
});
|
|
616
|
-
const
|
|
617
|
-
for (const
|
|
618
|
-
}, [
|
|
619
|
-
|
|
620
|
-
}, []),
|
|
621
|
-
|
|
622
|
-
key:
|
|
623
|
-
snapshot:
|
|
1596
|
+
const c = Xt.current.splice(0);
|
|
1597
|
+
for (const u of c) u(r);
|
|
1598
|
+
}, [Y]), wt = k((r) => {
|
|
1599
|
+
Xt.current.push(r);
|
|
1600
|
+
}, []), Bn = k((r) => {
|
|
1601
|
+
Hn({
|
|
1602
|
+
key: Y,
|
|
1603
|
+
snapshot: r
|
|
624
1604
|
});
|
|
625
|
-
}, [
|
|
626
|
-
const
|
|
627
|
-
return (
|
|
628
|
-
}, []),
|
|
629
|
-
|
|
630
|
-
}, [
|
|
631
|
-
|
|
632
|
-
}, [
|
|
633
|
-
|
|
634
|
-
}, [
|
|
635
|
-
const
|
|
636
|
-
if (!
|
|
637
|
-
const
|
|
638
|
-
return
|
|
639
|
-
}, []),
|
|
640
|
-
surface:
|
|
641
|
-
isWorkbenchOpen:
|
|
642
|
-
openWorkbench:
|
|
643
|
-
openWorkbenchSources:
|
|
644
|
-
closeWorkbench:
|
|
645
|
-
enqueue:
|
|
646
|
-
shouldOpenSurface:
|
|
647
|
-
}), [
|
|
648
|
-
|
|
1605
|
+
}, [Y]), Oe = k(() => {
|
|
1606
|
+
const r = Yt.current;
|
|
1607
|
+
return (r == null ? void 0 : r.key) === zn.current ? r.api : null;
|
|
1608
|
+
}, []), qn = k(() => pe.current, []), Vn = k(() => {
|
|
1609
|
+
pe.current = !0, te(!0);
|
|
1610
|
+
}, [te]), Yn = k(() => {
|
|
1611
|
+
pe.current = !0, te(!0), Se(!0), Ze(!0);
|
|
1612
|
+
}, [te, Se]), Pt = k(() => {
|
|
1613
|
+
pe.current = !1, Yt.current = null, Vt(!1), te(!1);
|
|
1614
|
+
}, [te]), Xn = J(/* @__PURE__ */ new Set()), jn = k((r) => {
|
|
1615
|
+
const c = r.meta;
|
|
1616
|
+
if (!c || c.openOnlyWhenSessionOpen !== !0) return !0;
|
|
1617
|
+
const u = typeof c.sessionId == "string" ? c.sessionId : null;
|
|
1618
|
+
return u ? Xn.current.has(u) : !1;
|
|
1619
|
+
}, []), We = D(() => ({
|
|
1620
|
+
surface: Oe,
|
|
1621
|
+
isWorkbenchOpen: qn,
|
|
1622
|
+
openWorkbench: Vn,
|
|
1623
|
+
openWorkbenchSources: Yn,
|
|
1624
|
+
closeWorkbench: Pt,
|
|
1625
|
+
enqueue: wt,
|
|
1626
|
+
shouldOpenSurface: jn
|
|
1627
|
+
}), [Oe, qn, Vn, Yn, Pt, wt, jn]);
|
|
1628
|
+
k((r) => {
|
|
1629
|
+
if (pe.current = !0, te(!0), ve == null || ve(), !r) return;
|
|
1630
|
+
const c = (N) => N.openPanel(r), u = Oe();
|
|
1631
|
+
u ? c(u) : wt(c);
|
|
1632
|
+
}, [wt, Oe, ve, te]);
|
|
1633
|
+
const Ei = D(() => ({
|
|
1634
|
+
openFile: async (r) => (xr({ kind: "openFile", params: { path: r } }, We), { seq: 0, status: "ok" }),
|
|
649
1635
|
getActiveFile: () => {
|
|
650
|
-
var
|
|
651
|
-
return ((
|
|
1636
|
+
var r;
|
|
1637
|
+
return ((r = Oe()) == null ? void 0 : r.getSnapshot().activeTab) ?? null;
|
|
652
1638
|
},
|
|
653
1639
|
select: () => () => {
|
|
654
1640
|
}
|
|
655
|
-
}), [
|
|
656
|
-
() => (
|
|
657
|
-
[
|
|
658
|
-
),
|
|
659
|
-
() =>
|
|
660
|
-
[
|
|
661
|
-
),
|
|
662
|
-
() =>
|
|
663
|
-
[
|
|
664
|
-
),
|
|
665
|
-
const
|
|
666
|
-
for (const
|
|
667
|
-
for (const
|
|
668
|
-
|
|
669
|
-
return
|
|
670
|
-
}, [
|
|
671
|
-
() => [...
|
|
672
|
-
[
|
|
673
|
-
),
|
|
674
|
-
|
|
675
|
-
var
|
|
676
|
-
if (
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
const
|
|
682
|
-
if (
|
|
683
|
-
const
|
|
684
|
-
return
|
|
1641
|
+
}), [Oe, We]), Me = D(
|
|
1642
|
+
() => (R == null ? void 0 : R.map(gs)) ?? [],
|
|
1643
|
+
[R]
|
|
1644
|
+
), jt = D(
|
|
1645
|
+
() => !re && Me.some((r) => r.registrations.workspaceSources.length > 0),
|
|
1646
|
+
[Me, re]
|
|
1647
|
+
), Qn = D(
|
|
1648
|
+
() => Me.flatMap((r) => r.registrations.panels.map((c) => c.id)),
|
|
1649
|
+
[Me]
|
|
1650
|
+
), Zn = D(() => {
|
|
1651
|
+
const r = {};
|
|
1652
|
+
for (const c of Me)
|
|
1653
|
+
for (const u of c.registrations.toolRenderers)
|
|
1654
|
+
r[u.id] = u.render;
|
|
1655
|
+
return r;
|
|
1656
|
+
}, [Me]), er = D(
|
|
1657
|
+
() => [...xn ?? [], ...Qn],
|
|
1658
|
+
[xn, Qn]
|
|
1659
|
+
), P = ye && !n && Be.workspaceId !== e ? "default" : X ?? (ee !== void 0 ? "default" : ((mr = q[0]) == null ? void 0 : mr.id) ?? "default"), tr = !(w != null && w.hasMore) && !B;
|
|
1660
|
+
_(() => {
|
|
1661
|
+
var j, rt;
|
|
1662
|
+
if (Ye) return;
|
|
1663
|
+
const r = Ne.current, c = new Set(q.map((ne) => ne.id)), u = r ? r.createdId ?? (c.has(P) && !r.knownIds.has(P) ? P : ((j = q.find((ne) => !r.knownIds.has(ne.id))) == null ? void 0 : j.id) ?? null) : null;
|
|
1664
|
+
u && c.has(u) && (Ne.current = null);
|
|
1665
|
+
const N = P === "default" && ee !== void 0, S = tr && c.size > 0 && !N, C = u ?? (S && !c.has(P) ? ((rt = q[0]) == null ? void 0 : rt.id) ?? P : P);
|
|
1666
|
+
ce((ne) => {
|
|
1667
|
+
const we = ne.workspaceId === e ? ne : { workspaceId: e, ids: [], activeId: null };
|
|
1668
|
+
if (B && we.ids.length > 0 && !u) return we;
|
|
1669
|
+
const pr = we.ids.length > 0 ? we.ids : [C], hr = S ? pr.filter((At) => c.has(At) || At === u) : pr, Fe = hr.length > 0 ? hr : [C], br = we.activeId && Fe.includes(we.activeId) ? we.activeId : Fe[0] ?? C, it = u ? Ct(Fe, r == null ? void 0 : r.afterId, u) : C === br || Fe.includes(C) ? Fe : on(Fe, br, C), vr = it.includes(C) ? C : it[0] ?? C;
|
|
1670
|
+
return ne.workspaceId === e && ne.activeId === vr && ne.ids.length === it.length && ne.ids.every((At, Ui) => At === it[Ui]) ? ne : { workspaceId: e, ids: it, activeId: vr };
|
|
685
1671
|
});
|
|
686
|
-
}, [
|
|
687
|
-
const
|
|
688
|
-
const
|
|
689
|
-
for (const
|
|
690
|
-
return
|
|
691
|
-
}, [
|
|
1672
|
+
}, [ee, P, B, Ye, q, tr, e]);
|
|
1673
|
+
const nr = D(() => {
|
|
1674
|
+
const r = /* @__PURE__ */ new Map();
|
|
1675
|
+
for (const c of q) r.set(c.id, c.title);
|
|
1676
|
+
return r;
|
|
1677
|
+
}, [q]), [Qt, rr] = O(() => ({
|
|
692
1678
|
workspaceId: e,
|
|
693
1679
|
ids: /* @__PURE__ */ new Set()
|
|
694
|
-
})),
|
|
695
|
-
const
|
|
696
|
-
if (!
|
|
697
|
-
const
|
|
698
|
-
for (const
|
|
699
|
-
|
|
700
|
-
return
|
|
701
|
-
}, [
|
|
702
|
-
|
|
703
|
-
|
|
1680
|
+
})), ir = D(() => {
|
|
1681
|
+
const r = /* @__PURE__ */ new Set();
|
|
1682
|
+
if (!ie) return r;
|
|
1683
|
+
const c = Qt.workspaceId === e ? Qt.ids : /* @__PURE__ */ new Set();
|
|
1684
|
+
for (const u of de)
|
|
1685
|
+
u.turnCount === 0 && !c.has(u.id) && r.add(u.id);
|
|
1686
|
+
return r;
|
|
1687
|
+
}, [de, Qt, ie, e]);
|
|
1688
|
+
_(() => {
|
|
1689
|
+
rr((r) => r.workspaceId === e ? r : { workspaceId: e, ids: /* @__PURE__ */ new Set() });
|
|
704
1690
|
}, [e]);
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
}, [
|
|
709
|
-
const
|
|
710
|
-
const
|
|
711
|
-
return
|
|
712
|
-
const
|
|
713
|
-
return { workspaceId: e, ids:
|
|
714
|
-
}),
|
|
715
|
-
}, [
|
|
716
|
-
const
|
|
1691
|
+
const Zt = U.workspaceId === e ? U : { ids: [], activeId: null }, Z = Zt.ids.length > 0 ? Zt.ids : [P];
|
|
1692
|
+
_(() => {
|
|
1693
|
+
Xn.current = new Set(Z);
|
|
1694
|
+
}, [Z]);
|
|
1695
|
+
const se = Zt.activeId ?? Z[0] ?? P, Et = k((r) => {
|
|
1696
|
+
const u = (U.workspaceId === e ? U : { ids: [P] }).ids.includes(r);
|
|
1697
|
+
return ce((N) => {
|
|
1698
|
+
const S = N.workspaceId === e ? N : { ids: [P], activeId: P }, C = S.ids.includes(r) ? S.ids : on(S.ids, S.activeId, r);
|
|
1699
|
+
return { workspaceId: e, ids: C, activeId: r };
|
|
1700
|
+
}), u ? Q(r) : St(r);
|
|
1701
|
+
}, [U, P, Q, St, e]), ki = k((r) => (ce((c) => {
|
|
1702
|
+
const u = c.workspaceId === e ? c : { ids: [P], activeId: P };
|
|
717
1703
|
return {
|
|
718
1704
|
workspaceId: e,
|
|
719
|
-
ids:
|
|
720
|
-
activeId:
|
|
1705
|
+
ids: u.ids.includes(r) ? u.ids : Ct(u.ids, u.activeId, r),
|
|
1706
|
+
activeId: r
|
|
721
1707
|
};
|
|
722
|
-
}),
|
|
723
|
-
const
|
|
1708
|
+
}), Q(r)), [P, Q, e]), tt = k((r) => ((U.workspaceId === e ? U : { ids: [P] }).ids.includes(r) && kn({ workspaceId: e, id: r }), ce((u) => {
|
|
1709
|
+
const N = u.workspaceId === e ? u : { ids: [P], activeId: P };
|
|
724
1710
|
return {
|
|
725
1711
|
workspaceId: e,
|
|
726
|
-
ids:
|
|
727
|
-
activeId:
|
|
1712
|
+
ids: Ct(N.ids, N.activeId, r),
|
|
1713
|
+
activeId: r
|
|
728
1714
|
};
|
|
729
|
-
}),
|
|
730
|
-
const
|
|
731
|
-
if (
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
}, [
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
|
|
1715
|
+
}), Q(r)), [U, P, Q, e]), Ai = k((r) => {
|
|
1716
|
+
const c = U.workspaceId === e ? U : { ids: [P], activeId: P };
|
|
1717
|
+
if (c.ids.length <= 1) return;
|
|
1718
|
+
const u = c.ids.indexOf(r);
|
|
1719
|
+
if (u < 0) return;
|
|
1720
|
+
const N = c.ids.filter((C) => C !== r), S = c.activeId === r ? N[Math.max(0, u - 1)] ?? N[0] ?? null : c.activeId;
|
|
1721
|
+
ce({ workspaceId: e, ids: N, activeId: S }), S && c.activeId === r && Q(S);
|
|
1722
|
+
}, [U, P, Q, e]), sr = k(() => {
|
|
1723
|
+
const r = je();
|
|
1724
|
+
return Promise.resolve(r).then((c) => {
|
|
1725
|
+
const u = Er(c);
|
|
1726
|
+
u && (ce((N) => {
|
|
1727
|
+
const S = N.workspaceId === e ? N : { ids: [P], activeId: P }, C = S.ids.length > 0 ? S.ids : [P], j = S.activeId ?? C[0] ?? P;
|
|
1728
|
+
return {
|
|
1729
|
+
workspaceId: e,
|
|
1730
|
+
ids: on(C, j, u),
|
|
1731
|
+
activeId: u
|
|
1732
|
+
};
|
|
1733
|
+
}), Q(u));
|
|
1734
|
+
}).catch(() => {
|
|
1735
|
+
}), r;
|
|
1736
|
+
}, [P, Q, je, e]), en = k((r) => {
|
|
1737
|
+
const c = {
|
|
1738
|
+
afterId: r,
|
|
1739
|
+
knownIds: new Set(q.map((N) => N.id))
|
|
740
1740
|
};
|
|
741
|
-
|
|
742
|
-
const
|
|
743
|
-
return Promise.resolve(
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
const
|
|
1741
|
+
Ne.current = c;
|
|
1742
|
+
const u = je();
|
|
1743
|
+
return Promise.resolve(u).then((N) => {
|
|
1744
|
+
const S = Er(N);
|
|
1745
|
+
S && (Ne.current === c && (Ne.current = { ...c, createdId: S }), ce((C) => {
|
|
1746
|
+
const j = C.workspaceId === e ? C : { ids: [P] };
|
|
747
1747
|
return {
|
|
748
1748
|
workspaceId: e,
|
|
749
|
-
ids:
|
|
750
|
-
activeId:
|
|
1749
|
+
ids: Ct(j.ids, r, S),
|
|
1750
|
+
activeId: S
|
|
751
1751
|
};
|
|
752
1752
|
}));
|
|
753
1753
|
}).catch(() => {
|
|
754
|
-
|
|
755
|
-
}),
|
|
756
|
-
}, [
|
|
757
|
-
const
|
|
758
|
-
let
|
|
759
|
-
if (
|
|
760
|
-
const
|
|
761
|
-
|
|
1754
|
+
Ne.current === c && (Ne.current = null);
|
|
1755
|
+
}), u;
|
|
1756
|
+
}, [P, je, q, e]), Ri = k((r) => {
|
|
1757
|
+
const c = U.workspaceId === e ? U : { ids: [P], activeId: P }, u = c.ids.indexOf(r);
|
|
1758
|
+
let N = c.activeId;
|
|
1759
|
+
if (u >= 0) {
|
|
1760
|
+
const S = c.ids.filter((C) => C !== r);
|
|
1761
|
+
N = c.activeId === r ? S[Math.max(0, u - 1)] ?? S[0] ?? null : c.activeId, ce({ workspaceId: e, ids: S, activeId: N }), N && c.activeId === r && St(N);
|
|
762
1762
|
}
|
|
763
|
-
return
|
|
764
|
-
}, [
|
|
765
|
-
|
|
766
|
-
if (
|
|
767
|
-
|
|
1763
|
+
return Mn(r);
|
|
1764
|
+
}, [U, P, Mn, St, e]), or = k(() => Z.length >= 2 ? en(se) : sr(), [se, Z.length, en, sr]), [Ci, tn] = O(De), ar = J(e);
|
|
1765
|
+
_(() => {
|
|
1766
|
+
if (ar.current !== e) {
|
|
1767
|
+
ar.current = e, tn(De);
|
|
768
1768
|
return;
|
|
769
1769
|
}
|
|
770
|
-
|
|
771
|
-
}, [
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
}, [
|
|
775
|
-
|
|
776
|
-
var
|
|
777
|
-
const
|
|
778
|
-
const
|
|
779
|
-
!
|
|
1770
|
+
De && tn(!0);
|
|
1771
|
+
}, [De, e]);
|
|
1772
|
+
const lr = De && ye && !X, cr = !Ci && zt !== !1 && (ye ? !!X : !0), Ti = k((r) => {
|
|
1773
|
+
si({ workspaceId: e, status: r }), dt == null || dt(r);
|
|
1774
|
+
}, [dt, e]);
|
|
1775
|
+
_(() => {
|
|
1776
|
+
var c;
|
|
1777
|
+
const r = (u) => {
|
|
1778
|
+
const N = u.detail;
|
|
1779
|
+
!N || typeof N != "object" || xr(N, We);
|
|
780
1780
|
};
|
|
781
|
-
return (
|
|
782
|
-
var
|
|
783
|
-
return (
|
|
1781
|
+
return (c = globalThis.addEventListener) == null || c.call(globalThis, yr, r), () => {
|
|
1782
|
+
var u;
|
|
1783
|
+
return (u = globalThis.removeEventListener) == null ? void 0 : u.call(globalThis, yr, r);
|
|
784
1784
|
};
|
|
785
|
-
}, [
|
|
786
|
-
|
|
787
|
-
}, [
|
|
788
|
-
const
|
|
789
|
-
const
|
|
1785
|
+
}, [We]), _(() => {
|
|
1786
|
+
B || ae == null || ae(X ?? null);
|
|
1787
|
+
}, [X, ae, B]);
|
|
1788
|
+
const nn = ht.status !== "ready", _i = nn ? /* @__PURE__ */ i(Zs, { status: ht }) : void 0, nt = k(async (r) => {
|
|
1789
|
+
const c = `${(v == null ? void 0 : v.replace(/\/$/, "")) ?? ""}/api/v1/agent/reload`;
|
|
790
1790
|
try {
|
|
791
|
-
const
|
|
1791
|
+
const u = await fetch(c, {
|
|
792
1792
|
method: "POST",
|
|
793
|
-
headers: { ...
|
|
794
|
-
body: JSON.stringify({ sessionId:
|
|
1793
|
+
headers: { ...xe, "content-type": "application/json" },
|
|
1794
|
+
body: JSON.stringify({ sessionId: r })
|
|
795
1795
|
});
|
|
796
|
-
if (!
|
|
797
|
-
return (await
|
|
798
|
-
const
|
|
799
|
-
return window.dispatchEvent(new CustomEvent(
|
|
800
|
-
} catch (
|
|
801
|
-
return
|
|
1796
|
+
if (!u.ok)
|
|
1797
|
+
return (await u.json().catch(() => ({}))).error || `reload failed (${u.status})`;
|
|
1798
|
+
const N = await u.json().catch(() => ({}));
|
|
1799
|
+
return window.dispatchEvent(new CustomEvent(un, { detail: N })), fo(N);
|
|
1800
|
+
} catch (u) {
|
|
1801
|
+
return u instanceof Error ? u.message : "Agent plugin reload failed.";
|
|
802
1802
|
}
|
|
803
|
-
}, [
|
|
804
|
-
(
|
|
805
|
-
const
|
|
1803
|
+
}, [v, xe]), Ie = k(
|
|
1804
|
+
(r, c = {}) => {
|
|
1805
|
+
const u = c.bridgeEnabled ?? !0, N = $ != null && $.toolRenderers && typeof $.toolRenderers == "object" ? $.toolRenderers : void 0;
|
|
806
1806
|
return {
|
|
807
|
-
|
|
808
|
-
...
|
|
809
|
-
sessionId:
|
|
810
|
-
apiBaseUrl:
|
|
1807
|
+
...$,
|
|
1808
|
+
...lr ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
|
|
1809
|
+
sessionId: r,
|
|
1810
|
+
apiBaseUrl: v,
|
|
811
1811
|
workspaceId: e,
|
|
812
1812
|
storageScope: e,
|
|
813
|
-
requestHeaders:
|
|
1813
|
+
requestHeaders: xe,
|
|
814
1814
|
showSessions: !1,
|
|
815
|
-
onReloadAgentPlugins: (
|
|
816
|
-
toolRenderers: { ...
|
|
817
|
-
bridgeEndpoint:
|
|
818
|
-
surfaceDispatch:
|
|
819
|
-
extraCommands:
|
|
820
|
-
workspaceWarmupStatus:
|
|
821
|
-
hydrateMessages:
|
|
822
|
-
allowPromptDuringInitialHydration:
|
|
823
|
-
onPromptSubmitStarted: ({ sessionId:
|
|
824
|
-
|
|
825
|
-
const
|
|
826
|
-
if (
|
|
827
|
-
const
|
|
828
|
-
return
|
|
1815
|
+
onReloadAgentPlugins: ($ == null ? void 0 : $.onReloadAgentPlugins) ?? (() => nt(r)),
|
|
1816
|
+
toolRenderers: { ...Zn, ...N ?? {} },
|
|
1817
|
+
bridgeEndpoint: u ? H : null,
|
|
1818
|
+
surfaceDispatch: We,
|
|
1819
|
+
extraCommands: yn,
|
|
1820
|
+
workspaceWarmupStatus: ht,
|
|
1821
|
+
hydrateMessages: cr,
|
|
1822
|
+
allowPromptDuringInitialHydration: ir.has(r),
|
|
1823
|
+
onPromptSubmitStarted: ({ sessionId: S }) => {
|
|
1824
|
+
rr((C) => {
|
|
1825
|
+
const j = C.workspaceId === e ? C.ids : /* @__PURE__ */ new Set();
|
|
1826
|
+
if (j.has(S)) return C.workspaceId === e ? C : { workspaceId: e, ids: j };
|
|
1827
|
+
const rt = new Set(j);
|
|
1828
|
+
return rt.add(S), { workspaceId: e, ids: rt };
|
|
829
1829
|
});
|
|
830
1830
|
},
|
|
831
1831
|
onTurnComplete: () => {
|
|
832
|
-
var
|
|
833
|
-
(
|
|
834
|
-
const
|
|
835
|
-
typeof
|
|
1832
|
+
var C;
|
|
1833
|
+
(C = w == null ? void 0 : w.refresh) == null || C.call(w, { background: !0 });
|
|
1834
|
+
const S = $ == null ? void 0 : $.onTurnComplete;
|
|
1835
|
+
typeof S == "function" && S();
|
|
836
1836
|
},
|
|
837
1837
|
onAutoSubmitInitialDraftSettled: () => {
|
|
838
|
-
|
|
839
|
-
const
|
|
840
|
-
typeof
|
|
1838
|
+
Le.current = !1, tn(!1), Xe(void 0);
|
|
1839
|
+
const S = $ == null ? void 0 : $.onAutoSubmitInitialDraftSettled;
|
|
1840
|
+
typeof S == "function" && S();
|
|
841
1841
|
},
|
|
842
1842
|
// Forward the explicit prop when set. Omitting the key (when undefined)
|
|
843
1843
|
// lets ChatPanel apply its own default (true) and avoids overriding a
|
|
844
1844
|
// value passed through chatParams.
|
|
845
|
-
...
|
|
1845
|
+
...Ht !== void 0 ? { hotReloadEnabled: Ht } : {}
|
|
846
1846
|
};
|
|
847
1847
|
},
|
|
848
|
-
[
|
|
849
|
-
),
|
|
850
|
-
() =>
|
|
851
|
-
[
|
|
852
|
-
),
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1848
|
+
[v, $, lr, xe, H, We, yn, ht, cr, ir, Ht, Zn, nt, w, e]
|
|
1849
|
+
), Di = D(
|
|
1850
|
+
() => Ie(P),
|
|
1851
|
+
[P, Ie]
|
|
1852
|
+
), kt = J(null), Li = D(() => {
|
|
1853
|
+
(!kt.current || kt.current.make !== Ie) && (kt.current = { make: Ie, cache: /* @__PURE__ */ new Map() });
|
|
1854
|
+
const { cache: r } = kt.current;
|
|
1855
|
+
return Z.map((c) => {
|
|
1856
|
+
const u = c === se, N = `${c}:${u}`;
|
|
1857
|
+
let S = r.get(N);
|
|
1858
|
+
return S || (S = Ie(c, { bridgeEnabled: u }), r.set(N, S)), {
|
|
1859
|
+
id: c,
|
|
1860
|
+
title: nr.get(c) ?? (c === "default" ? T : c),
|
|
1861
|
+
panel: "chat",
|
|
1862
|
+
params: S
|
|
1863
|
+
};
|
|
1864
|
+
});
|
|
1865
|
+
}, [se, Z, T, Ie, nr]), Oi = D(() => ({
|
|
1866
|
+
storageKey: Y,
|
|
1867
|
+
defaultLeftTab: ct,
|
|
1868
|
+
initialPanels: mn,
|
|
1869
|
+
extraPanels: er,
|
|
1870
|
+
onReloadAgentPlugins: () => nt(X ?? P),
|
|
1871
|
+
onReady: Jn,
|
|
1872
|
+
onChange: Bn,
|
|
1873
|
+
onClose: Pt,
|
|
1874
|
+
showCloseAction: !1
|
|
866
1875
|
}), [
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
])
|
|
879
|
-
|
|
880
|
-
|
|
1876
|
+
Pt,
|
|
1877
|
+
ct,
|
|
1878
|
+
mn,
|
|
1879
|
+
nt,
|
|
1880
|
+
X,
|
|
1881
|
+
P,
|
|
1882
|
+
Bn,
|
|
1883
|
+
Jn,
|
|
1884
|
+
Y,
|
|
1885
|
+
er,
|
|
1886
|
+
te
|
|
1887
|
+
]), dr = () => {
|
|
1888
|
+
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
1889
|
+
key: "k",
|
|
1890
|
+
metaKey: !0,
|
|
1891
|
+
ctrlKey: !0,
|
|
1892
|
+
bubbles: !0,
|
|
1893
|
+
cancelable: !0
|
|
1894
|
+
}));
|
|
1895
|
+
}, ur = /* @__PURE__ */ b(oe, { children: [
|
|
1896
|
+
bn ? /* @__PURE__ */ i(As, {}) : null,
|
|
1897
|
+
hn
|
|
1898
|
+
] }), Wi = {
|
|
1899
|
+
sessions: q,
|
|
1900
|
+
activeId: se,
|
|
1901
|
+
openIds: Z,
|
|
1902
|
+
pinnedIds: Cn,
|
|
1903
|
+
onTogglePin: Tn,
|
|
1904
|
+
onSwitch: Et,
|
|
1905
|
+
onOpenAsTab: tt,
|
|
1906
|
+
onCreate: je,
|
|
1907
|
+
onDelete: Ri,
|
|
1908
|
+
onLoadMore: w == null ? void 0 : w.loadMore,
|
|
1909
|
+
hasMore: w == null ? void 0 : w.hasMore,
|
|
1910
|
+
loadingMore: w == null ? void 0 : w.loadingMore,
|
|
1911
|
+
onClose: () => Fn(!1)
|
|
1912
|
+
}, Mi = D(() => re ? {
|
|
1913
|
+
sessions: q,
|
|
1914
|
+
activeId: se,
|
|
1915
|
+
openIds: Z,
|
|
1916
|
+
search: (r, c) => es(r, c, { limit: 8 }),
|
|
1917
|
+
onSwitch: Et,
|
|
1918
|
+
onOpenAsTab: tt
|
|
1919
|
+
} : void 0, [se, Z, re, tt, q, Et]), Ii = D(() => {
|
|
1920
|
+
const r = [...vn ?? []];
|
|
1921
|
+
return Ke && r.push({
|
|
1922
|
+
id: "plugins",
|
|
1923
|
+
label: "Plugins",
|
|
1924
|
+
icon: /* @__PURE__ */ i(Or, { className: "h-4 w-4", strokeWidth: 1.75 }),
|
|
1925
|
+
onClick: () => ue((c) => c === "plugins" ? null : "plugins")
|
|
1926
|
+
}), ze && r.push({
|
|
1927
|
+
id: "skills",
|
|
1928
|
+
label: "Skills",
|
|
1929
|
+
icon: /* @__PURE__ */ i(Lr, { className: "h-4 w-4", strokeWidth: 1.75 }),
|
|
1930
|
+
onClick: () => ue((c) => c === "skills" ? null : "skills")
|
|
1931
|
+
}), r;
|
|
1932
|
+
}, [vn, Ke, ze]), Fi = Qe === "skills" && ze ? /* @__PURE__ */ i(
|
|
1933
|
+
Rs,
|
|
1934
|
+
{
|
|
1935
|
+
onClose: () => ue(null),
|
|
1936
|
+
headerInsetStart: Nt,
|
|
1937
|
+
headerInsetEnd: !fe
|
|
1938
|
+
}
|
|
1939
|
+
) : Qe === "plugins" && Ke ? /* @__PURE__ */ i(
|
|
1940
|
+
Ts,
|
|
881
1941
|
{
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1942
|
+
onClose: () => ue(null),
|
|
1943
|
+
onReloadExternalPlugins: () => nt(X ?? P),
|
|
1944
|
+
headerInsetStart: Nt,
|
|
1945
|
+
headerInsetEnd: !fe
|
|
1946
|
+
}
|
|
1947
|
+
) : null, fr = Ye ? /* @__PURE__ */ i(eo, {}) : /* @__PURE__ */ i(
|
|
1948
|
+
ws,
|
|
1949
|
+
{
|
|
1950
|
+
className: ti,
|
|
1951
|
+
nav: re ? null : Gn ? "session-list" : null,
|
|
1952
|
+
navParams: Wi,
|
|
1953
|
+
center: "chat",
|
|
1954
|
+
centerParams: Di,
|
|
1955
|
+
chatPanes: Li,
|
|
1956
|
+
activeChatPaneId: se,
|
|
1957
|
+
onActiveChatPaneChange: ki,
|
|
1958
|
+
onCloseChatPane: Ai,
|
|
1959
|
+
onCreateChatPaneAfter: re ? void 0 : en,
|
|
1960
|
+
onDropChatSession: tt,
|
|
1961
|
+
flashChatPaneId: (Te == null ? void 0 : Te.workspaceId) === e ? Te.id : null,
|
|
1962
|
+
surface: fe ? "artifact-surface" : null,
|
|
1963
|
+
surfaceParams: Oi,
|
|
1964
|
+
chatOverlay: re ? Fi : null,
|
|
1965
|
+
onCloseChatOverlay: () => ue(null),
|
|
1966
|
+
surfaceOverlay: _i,
|
|
1967
|
+
sidebar: fe && !nn && jt && Ni ? "workbench-left" : null,
|
|
1968
|
+
sidebarParams: fe && !nn && jt ? {
|
|
1969
|
+
...ct ? { defaultTab: ct } : {},
|
|
1970
|
+
bridge: Ei,
|
|
1971
|
+
onClose: () => {
|
|
1972
|
+
Se(!1), Ze(!1);
|
|
1973
|
+
},
|
|
1974
|
+
onCollapse: () => {
|
|
1975
|
+
Se(!1), Ze(!1);
|
|
1976
|
+
}
|
|
1977
|
+
} : void 0,
|
|
1978
|
+
storageKey: z ? Ce : void 0,
|
|
1979
|
+
onOpenNav: !re && le ? () => {
|
|
1980
|
+
Fn(!0), Kt == null || Kt();
|
|
1981
|
+
} : void 0,
|
|
1982
|
+
onOpenSurface: () => {
|
|
1983
|
+
pe.current = !0, te(!0), ve == null || ve();
|
|
1984
|
+
},
|
|
1985
|
+
surfaceButtonBottomOffset: ei,
|
|
1986
|
+
onOpenSidebar: jt ? () => {
|
|
1987
|
+
pe.current = !0, te(!0), Se(!0), Ze(!0);
|
|
1988
|
+
} : void 0
|
|
1989
|
+
}
|
|
1990
|
+
), $i = re ? /* @__PURE__ */ i(
|
|
1991
|
+
Us,
|
|
1992
|
+
{
|
|
1993
|
+
collapsed: Nt,
|
|
1994
|
+
onExpand: () => $n(!1),
|
|
1995
|
+
onCollapse: () => $n(!0),
|
|
1996
|
+
onResizeLeftPane: (r) => vi((c) => Ar(c + r, 220, 420)),
|
|
1997
|
+
leftPaneWidth: Un,
|
|
1998
|
+
minLeftPaneWidth: 220,
|
|
1999
|
+
maxLeftPaneWidth: 420,
|
|
2000
|
+
leftPane: /* @__PURE__ */ i(
|
|
2001
|
+
Fs,
|
|
2002
|
+
{
|
|
2003
|
+
width: Un,
|
|
2004
|
+
appTitle: $e,
|
|
2005
|
+
workspaceLabel: at,
|
|
2006
|
+
workspaceSectionTitle: Mt,
|
|
2007
|
+
layoutMode: ke,
|
|
2008
|
+
headerMode: It,
|
|
2009
|
+
projects: Ue,
|
|
2010
|
+
activeProjectId: Ae ?? e,
|
|
2011
|
+
onOpenProjectSession: Ft,
|
|
2012
|
+
onShowMoreProjectSessions: $t,
|
|
2013
|
+
onCreateProject: Re,
|
|
2014
|
+
onCreateProjectSession: (r) => {
|
|
2015
|
+
r === (Ae ?? e) ? (ue(null), or()) : Ge == null || Ge(r);
|
|
2016
|
+
},
|
|
2017
|
+
onOpenProjectSettings: lt,
|
|
2018
|
+
onOpenProjectInNewTab: y,
|
|
2019
|
+
sessionTitle: Ye ? "Loading sessions…" : In ?? T,
|
|
2020
|
+
topSlot: pn,
|
|
2021
|
+
bottomSlot: bn || hn != null ? /* @__PURE__ */ i("div", { className: "flex w-full min-w-0 items-center gap-2", children: ur }) : void 0,
|
|
2022
|
+
sessions: q,
|
|
2023
|
+
activeSessionId: se,
|
|
2024
|
+
openSessionIds: Z,
|
|
2025
|
+
pinnedSessionIds: Cn,
|
|
2026
|
+
onCreateSession: () => {
|
|
2027
|
+
ue(null), or();
|
|
2028
|
+
},
|
|
2029
|
+
onOpenCommandPalette: dr,
|
|
2030
|
+
onSwitchSession: Et,
|
|
2031
|
+
onOpenSessionAsPane: tt,
|
|
2032
|
+
onToggleSessionPinned: Tn,
|
|
2033
|
+
actions: Ii
|
|
2034
|
+
}
|
|
2035
|
+
),
|
|
2036
|
+
children: fr
|
|
2037
|
+
}
|
|
2038
|
+
) : /* @__PURE__ */ b("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
2039
|
+
/* @__PURE__ */ i(
|
|
2040
|
+
ks,
|
|
2041
|
+
{
|
|
2042
|
+
appTitle: $e,
|
|
2043
|
+
sessionTitle: Ye ? "Loading sessions…" : In ?? T,
|
|
2044
|
+
onCommandPalette: dr,
|
|
2045
|
+
topBarLeft: pn,
|
|
2046
|
+
topBarRight: ur
|
|
2047
|
+
}
|
|
2048
|
+
),
|
|
2049
|
+
fr
|
|
2050
|
+
] });
|
|
2051
|
+
return /* @__PURE__ */ i("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ b(
|
|
2052
|
+
ms,
|
|
2053
|
+
{
|
|
2054
|
+
chatPanel: oi,
|
|
2055
|
+
panels: ri,
|
|
2056
|
+
commands: m,
|
|
2057
|
+
catalogs: A,
|
|
2058
|
+
plugins: R,
|
|
2059
|
+
excludeDefaults: W,
|
|
2060
|
+
capabilities: E,
|
|
2061
|
+
apiBaseUrl: v,
|
|
2062
|
+
authHeaders: ii,
|
|
891
2063
|
apiTimeout: h,
|
|
892
|
-
activeSessionId:
|
|
893
|
-
openSessionIds:
|
|
894
|
-
defaultTheme:
|
|
895
|
-
onThemeChange:
|
|
2064
|
+
activeSessionId: se,
|
|
2065
|
+
openSessionIds: Z,
|
|
2066
|
+
defaultTheme: x,
|
|
2067
|
+
onThemeChange: L,
|
|
896
2068
|
workspaceId: e,
|
|
897
|
-
workspaceLabel:
|
|
898
|
-
appTitle:
|
|
899
|
-
storageKey:
|
|
900
|
-
persistenceEnabled:
|
|
901
|
-
debug:
|
|
2069
|
+
workspaceLabel: at,
|
|
2070
|
+
appTitle: $e,
|
|
2071
|
+
storageKey: Jt,
|
|
2072
|
+
persistenceEnabled: F,
|
|
2073
|
+
debug: he,
|
|
902
2074
|
bridgeEndpoint: null,
|
|
903
|
-
onAuthError:
|
|
904
|
-
frontPluginHotReload:
|
|
905
|
-
fullPageBasePath:
|
|
2075
|
+
onAuthError: Wt,
|
|
2076
|
+
frontPluginHotReload: ni,
|
|
2077
|
+
fullPageBasePath: Ot,
|
|
2078
|
+
commandPaletteSessionSearch: Mi,
|
|
906
2079
|
children: [
|
|
907
|
-
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
|
|
2080
|
+
g,
|
|
2081
|
+
/* @__PURE__ */ i(
|
|
2082
|
+
Qs,
|
|
910
2083
|
{
|
|
911
2084
|
workspaceId: e,
|
|
912
|
-
requestHeaders:
|
|
913
|
-
apiBaseUrl:
|
|
914
|
-
preloadPaths:
|
|
915
|
-
provisionWorkspace:
|
|
916
|
-
onStatusChange:
|
|
2085
|
+
requestHeaders: xe,
|
|
2086
|
+
apiBaseUrl: v,
|
|
2087
|
+
preloadPaths: Zr,
|
|
2088
|
+
provisionWorkspace: zt,
|
|
2089
|
+
onStatusChange: Ti
|
|
917
2090
|
}
|
|
918
2091
|
),
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
|
|
2092
|
+
/* @__PURE__ */ i(
|
|
2093
|
+
io,
|
|
921
2094
|
{
|
|
922
|
-
bridgeEndpoint:
|
|
923
|
-
requestHeaders:
|
|
924
|
-
navOpen:
|
|
925
|
-
surfaceOpen:
|
|
926
|
-
surfaceReady:
|
|
927
|
-
snapshot:
|
|
2095
|
+
bridgeEndpoint: H,
|
|
2096
|
+
requestHeaders: xe,
|
|
2097
|
+
navOpen: re ? !Nt : Gn,
|
|
2098
|
+
surfaceOpen: fe,
|
|
2099
|
+
surfaceReady: xi,
|
|
2100
|
+
snapshot: Pi
|
|
928
2101
|
}
|
|
929
2102
|
),
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
{
|
|
934
|
-
appTitle: wt,
|
|
935
|
-
sessionTitle: Ge ? "Loading sessions…" : pr ?? Q,
|
|
936
|
-
onCommandPalette: () => {
|
|
937
|
-
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
938
|
-
key: "k",
|
|
939
|
-
metaKey: !0,
|
|
940
|
-
ctrlKey: !0,
|
|
941
|
-
bubbles: !0,
|
|
942
|
-
cancelable: !0
|
|
943
|
-
}));
|
|
944
|
-
},
|
|
945
|
-
topBarLeft: jn,
|
|
946
|
-
topBarRight: /* @__PURE__ */ Re(fe, { children: [
|
|
947
|
-
Vn ? /* @__PURE__ */ f(ns, {}) : null,
|
|
948
|
-
Bn
|
|
949
|
-
] })
|
|
950
|
-
}
|
|
951
|
-
),
|
|
952
|
-
Ge ? /* @__PURE__ */ f(Ts, {}) : /* @__PURE__ */ f(
|
|
953
|
-
kr,
|
|
954
|
-
{
|
|
955
|
-
className: Zn,
|
|
956
|
-
nav: Bt ? "session-list" : null,
|
|
957
|
-
navParams: {
|
|
958
|
-
sessions: U,
|
|
959
|
-
activeId: Pe,
|
|
960
|
-
openIds: re,
|
|
961
|
-
pinnedIds: rr,
|
|
962
|
-
onTogglePin: sr,
|
|
963
|
-
onSwitch: Ar,
|
|
964
|
-
onOpenAsTab: fn,
|
|
965
|
-
onCreate: at,
|
|
966
|
-
onDelete: Nr,
|
|
967
|
-
onLoadMore: u == null ? void 0 : u.loadMore,
|
|
968
|
-
hasMore: u == null ? void 0 : u.hasMore,
|
|
969
|
-
loadingMore: u == null ? void 0 : u.loadingMore,
|
|
970
|
-
onClose: () => jt(!1)
|
|
971
|
-
},
|
|
972
|
-
center: "chat",
|
|
973
|
-
centerParams: Lr,
|
|
974
|
-
chatPanes: xr,
|
|
975
|
-
activeChatPaneId: Pe,
|
|
976
|
-
onActiveChatPaneChange: Rr,
|
|
977
|
-
onCloseChatPane: Tr,
|
|
978
|
-
onCreateChatPaneAfter: wr,
|
|
979
|
-
onDropChatSession: fn,
|
|
980
|
-
flashChatPaneId: (ie == null ? void 0 : ie.workspaceId) === e ? ie.id : null,
|
|
981
|
-
surface: ee ? "artifact-surface" : null,
|
|
982
|
-
surfaceParams: Mr,
|
|
983
|
-
surfaceOverlay: Or,
|
|
984
|
-
sidebar: ee && !pt && dt && yr ? "workbench-left" : null,
|
|
985
|
-
sidebarParams: ee && !pt && dt ? {
|
|
986
|
-
...we ? { defaultTab: we } : {},
|
|
987
|
-
bridge: Er,
|
|
988
|
-
onClose: () => {
|
|
989
|
-
be(!1), Ke(!1);
|
|
990
|
-
},
|
|
991
|
-
onCollapse: () => {
|
|
992
|
-
be(!1), Ke(!1);
|
|
993
|
-
}
|
|
994
|
-
} : void 0,
|
|
995
|
-
storageKey: C ? De : void 0,
|
|
996
|
-
onOpenNav: Nt ? () => {
|
|
997
|
-
jt(!0), tt == null || tt();
|
|
998
|
-
} : void 0,
|
|
999
|
-
onOpenSurface: () => {
|
|
1000
|
-
ne.current = !0, z(!0), nt == null || nt();
|
|
1001
|
-
},
|
|
1002
|
-
surfaceButtonBottomOffset: Xn,
|
|
1003
|
-
onOpenSidebar: dt ? () => {
|
|
1004
|
-
ne.current = !0, z(!0), be(!0), Ke(!0);
|
|
1005
|
-
} : void 0
|
|
1006
|
-
}
|
|
1007
|
-
)
|
|
1008
|
-
] }),
|
|
1009
|
-
b
|
|
2103
|
+
/* @__PURE__ */ i(so, { onQuestionOpen: wi }),
|
|
2104
|
+
$i,
|
|
2105
|
+
f
|
|
1010
2106
|
]
|
|
1011
2107
|
}
|
|
1012
2108
|
) });
|
|
1013
2109
|
}
|
|
1014
|
-
const
|
|
1015
|
-
function
|
|
1016
|
-
return new Promise((
|
|
2110
|
+
const ho = 500;
|
|
2111
|
+
function bo(e) {
|
|
2112
|
+
return new Promise((t, n) => {
|
|
1017
2113
|
let s;
|
|
1018
|
-
const
|
|
1019
|
-
s && globalThis.clearTimeout(s), e.removeEventListener("abort",
|
|
1020
|
-
},
|
|
1021
|
-
|
|
2114
|
+
const o = () => {
|
|
2115
|
+
s && globalThis.clearTimeout(s), e.removeEventListener("abort", a);
|
|
2116
|
+
}, a = () => {
|
|
2117
|
+
o(), n(new DOMException("Workspace boot aborted", "AbortError"));
|
|
1022
2118
|
};
|
|
1023
2119
|
if (e.aborted) {
|
|
1024
|
-
|
|
2120
|
+
a();
|
|
1025
2121
|
return;
|
|
1026
2122
|
}
|
|
1027
2123
|
s = globalThis.setTimeout(() => {
|
|
1028
|
-
|
|
1029
|
-
},
|
|
2124
|
+
o(), t();
|
|
2125
|
+
}, ho), e.addEventListener("abort", a, { once: !0 });
|
|
1030
2126
|
});
|
|
1031
2127
|
}
|
|
1032
|
-
function
|
|
2128
|
+
function $o({
|
|
1033
2129
|
workspaceId: e,
|
|
1034
|
-
requestHeaders:
|
|
1035
|
-
apiBaseUrl:
|
|
1036
|
-
preloadPaths: s =
|
|
1037
|
-
provisionWorkspace:
|
|
1038
|
-
loadingFallback:
|
|
1039
|
-
errorFallback:
|
|
1040
|
-
children:
|
|
2130
|
+
requestHeaders: t,
|
|
2131
|
+
apiBaseUrl: n,
|
|
2132
|
+
preloadPaths: s = Fr,
|
|
2133
|
+
provisionWorkspace: o = !0,
|
|
2134
|
+
loadingFallback: a,
|
|
2135
|
+
errorFallback: l,
|
|
2136
|
+
children: g
|
|
1041
2137
|
}) {
|
|
1042
|
-
const [
|
|
2138
|
+
const [f, d] = O({
|
|
1043
2139
|
status: "loading",
|
|
1044
2140
|
label: "Waking workspace runtime"
|
|
1045
2141
|
});
|
|
1046
|
-
return
|
|
1047
|
-
const
|
|
1048
|
-
async function
|
|
1049
|
-
const
|
|
1050
|
-
headers:
|
|
1051
|
-
signal:
|
|
1052
|
-
}),
|
|
1053
|
-
if (!
|
|
1054
|
-
if (
|
|
1055
|
-
throw new Error(
|
|
2142
|
+
return _(() => {
|
|
2143
|
+
const m = new AbortController(), A = Dt(e, t);
|
|
2144
|
+
async function R(E) {
|
|
2145
|
+
const v = await fetch(Ur(n, E), {
|
|
2146
|
+
headers: A,
|
|
2147
|
+
signal: m.signal
|
|
2148
|
+
}), p = await Lt(v);
|
|
2149
|
+
if (!v.ok) {
|
|
2150
|
+
if (fn(p)) return "preparing";
|
|
2151
|
+
throw new Error(gn(p) ?? `${E} failed with ${v.status}`);
|
|
1056
2152
|
}
|
|
1057
|
-
if (
|
|
1058
|
-
const
|
|
1059
|
-
if ((
|
|
2153
|
+
if (Gr(E)) {
|
|
2154
|
+
const x = _t(p);
|
|
2155
|
+
if ((x == null ? void 0 : x.state) === "degraded") throw new Error(x.message ?? "Workspace failed to prepare");
|
|
1060
2156
|
}
|
|
1061
|
-
return
|
|
2157
|
+
return ps(E) !== null && p && typeof p == "object" && zr(n, A["x-boring-workspace-id"] ?? e, E, p), "ready";
|
|
1062
2158
|
}
|
|
1063
|
-
async function
|
|
1064
|
-
|
|
2159
|
+
async function W() {
|
|
2160
|
+
d({ status: "loading", label: "Waking workspace runtime" });
|
|
1065
2161
|
try {
|
|
1066
|
-
const
|
|
1067
|
-
let
|
|
1068
|
-
for (;
|
|
1069
|
-
if (
|
|
1070
|
-
|
|
2162
|
+
const E = $r(s, o);
|
|
2163
|
+
let v = await Promise.all(E.map(async (h) => ({ path: h, status: await R(h) }))), p = v.filter((h) => h.status === "preparing").map((h) => h.path);
|
|
2164
|
+
for (; p.length > 0; ) {
|
|
2165
|
+
if (d({ status: "loading", label: "Workspace is still preparing" }), await bo(m.signal), m.signal.aborted) return;
|
|
2166
|
+
v = await Promise.all(p.map(async (h) => ({ path: h, status: await R(h) }))), p = v.filter((h) => h.status === "preparing").map((h) => h.path);
|
|
1071
2167
|
}
|
|
1072
|
-
|
|
1073
|
-
} catch (
|
|
1074
|
-
if (
|
|
1075
|
-
|
|
2168
|
+
m.signal.aborted || d({ status: "ready" });
|
|
2169
|
+
} catch (E) {
|
|
2170
|
+
if (m.signal.aborted) return;
|
|
2171
|
+
d({
|
|
1076
2172
|
status: "error",
|
|
1077
|
-
message:
|
|
2173
|
+
message: E instanceof Error ? E.message : "Unknown workspace boot error"
|
|
1078
2174
|
});
|
|
1079
2175
|
}
|
|
1080
2176
|
}
|
|
1081
|
-
return
|
|
1082
|
-
}, [
|
|
1083
|
-
|
|
2177
|
+
return W(), () => m.abort();
|
|
2178
|
+
}, [n, s, o, t, e]), f.status === "ready" ? /* @__PURE__ */ i(oe, { children: g }) : f.status === "error" ? typeof l == "function" ? /* @__PURE__ */ i(oe, { children: l(f.message) }) : l ? /* @__PURE__ */ i(oe, { children: l }) : /* @__PURE__ */ i(
|
|
2179
|
+
wr,
|
|
1084
2180
|
{
|
|
1085
2181
|
title: "Workspace failed to open",
|
|
1086
|
-
description:
|
|
2182
|
+
description: f.message,
|
|
1087
2183
|
status: "Retry by reloading the page"
|
|
1088
2184
|
}
|
|
1089
|
-
) : typeof
|
|
1090
|
-
|
|
2185
|
+
) : typeof a == "function" ? /* @__PURE__ */ i(oe, { children: a(f.label) }) : a ? /* @__PURE__ */ i(oe, { children: a }) : /* @__PURE__ */ i(
|
|
2186
|
+
wr,
|
|
1091
2187
|
{
|
|
1092
2188
|
title: "Opening workspace",
|
|
1093
2189
|
description: "Preparing secure runtime, files, sessions, and layout.",
|
|
1094
|
-
status:
|
|
2190
|
+
status: f.label
|
|
1095
2191
|
}
|
|
1096
2192
|
);
|
|
1097
2193
|
}
|
|
1098
|
-
const
|
|
1099
|
-
function
|
|
2194
|
+
const vo = "FULL_PAGE_PANEL_MISSING_COMPONENT", xo = "FULL_PAGE_PANEL_INVALID_PARAMS_JSON", yo = "FULL_PAGE_PANEL_PARAMS_NOT_OBJECT", So = "FULL_PAGE_PANEL_UNKNOWN_COMPONENT", No = "FULL_PAGE_PANEL_NOT_SUPPORTED", wo = "FULL_PAGE_PANEL_RENDER_FAILED";
|
|
2195
|
+
function K() {
|
|
1100
2196
|
}
|
|
1101
|
-
const
|
|
1102
|
-
function
|
|
2197
|
+
const Po = { dispose: K }, I = () => Po;
|
|
2198
|
+
function Eo(e) {
|
|
1103
2199
|
return {
|
|
1104
2200
|
id: `full-page:${e}`,
|
|
1105
2201
|
title: e,
|
|
@@ -1109,31 +2205,31 @@ function $s(e) {
|
|
|
1109
2205
|
width: 0,
|
|
1110
2206
|
height: 0,
|
|
1111
2207
|
location: { type: "grid", referenceGroup: void 0 },
|
|
1112
|
-
setActive:
|
|
1113
|
-
setTitle: (
|
|
1114
|
-
document.title =
|
|
2208
|
+
setActive: K,
|
|
2209
|
+
setTitle: (t) => {
|
|
2210
|
+
document.title = t;
|
|
1115
2211
|
},
|
|
1116
|
-
setSize:
|
|
2212
|
+
setSize: K,
|
|
1117
2213
|
close: () => {
|
|
1118
2214
|
window.close();
|
|
1119
2215
|
},
|
|
1120
|
-
moveTo:
|
|
1121
|
-
maximize:
|
|
1122
|
-
exitMaximized:
|
|
2216
|
+
moveTo: K,
|
|
2217
|
+
maximize: K,
|
|
2218
|
+
exitMaximized: K,
|
|
1123
2219
|
isMaximized: () => !1,
|
|
1124
|
-
minimize:
|
|
1125
|
-
onDidActiveChange:
|
|
1126
|
-
onDidVisibilityChange:
|
|
1127
|
-
onDidDimensionsChange:
|
|
1128
|
-
onDidFocusChange:
|
|
1129
|
-
onDidLocationChange:
|
|
1130
|
-
onDidParametersChange:
|
|
1131
|
-
onDidTitleChange:
|
|
1132
|
-
onDidRenamed:
|
|
1133
|
-
onWillFocus:
|
|
2220
|
+
minimize: K,
|
|
2221
|
+
onDidActiveChange: I,
|
|
2222
|
+
onDidVisibilityChange: I,
|
|
2223
|
+
onDidDimensionsChange: I,
|
|
2224
|
+
onDidFocusChange: I,
|
|
2225
|
+
onDidLocationChange: I,
|
|
2226
|
+
onDidParametersChange: I,
|
|
2227
|
+
onDidTitleChange: I,
|
|
2228
|
+
onDidRenamed: I,
|
|
2229
|
+
onWillFocus: I
|
|
1134
2230
|
};
|
|
1135
2231
|
}
|
|
1136
|
-
function
|
|
2232
|
+
function ko() {
|
|
1137
2233
|
return {
|
|
1138
2234
|
width: window.innerWidth,
|
|
1139
2235
|
height: window.innerHeight,
|
|
@@ -1145,139 +2241,139 @@ function Us() {
|
|
|
1145
2241
|
panels: [],
|
|
1146
2242
|
groups: [],
|
|
1147
2243
|
activeGroup: void 0,
|
|
1148
|
-
addPanel:
|
|
1149
|
-
addGroup:
|
|
1150
|
-
removePanel:
|
|
1151
|
-
removeGroup:
|
|
2244
|
+
addPanel: K,
|
|
2245
|
+
addGroup: K,
|
|
2246
|
+
removePanel: K,
|
|
2247
|
+
removeGroup: K,
|
|
1152
2248
|
getPanel: () => {
|
|
1153
2249
|
},
|
|
1154
2250
|
getGroup: () => {
|
|
1155
2251
|
},
|
|
1156
|
-
moveGroupOrPanel:
|
|
1157
|
-
fromJSON:
|
|
2252
|
+
moveGroupOrPanel: K,
|
|
2253
|
+
fromJSON: K,
|
|
1158
2254
|
toJSON: () => ({}),
|
|
1159
|
-
clear:
|
|
1160
|
-
focus:
|
|
1161
|
-
layout:
|
|
1162
|
-
onDidLayoutChange:
|
|
1163
|
-
onDidLayoutFromJSON:
|
|
1164
|
-
onDidAddPanel:
|
|
1165
|
-
onDidRemovePanel:
|
|
1166
|
-
onDidActivePanelChange:
|
|
1167
|
-
onDidAddGroup:
|
|
1168
|
-
onDidRemoveGroup:
|
|
1169
|
-
onDidActiveGroupChange:
|
|
1170
|
-
onUnhandledDragOverEvent:
|
|
1171
|
-
onDidDrop:
|
|
1172
|
-
onWillDrop:
|
|
1173
|
-
onWillDragGroup:
|
|
1174
|
-
onWillDragPanel:
|
|
1175
|
-
onDidActivePanelChange_:
|
|
2255
|
+
clear: K,
|
|
2256
|
+
focus: K,
|
|
2257
|
+
layout: K,
|
|
2258
|
+
onDidLayoutChange: I,
|
|
2259
|
+
onDidLayoutFromJSON: I,
|
|
2260
|
+
onDidAddPanel: I,
|
|
2261
|
+
onDidRemovePanel: I,
|
|
2262
|
+
onDidActivePanelChange: I,
|
|
2263
|
+
onDidAddGroup: I,
|
|
2264
|
+
onDidRemoveGroup: I,
|
|
2265
|
+
onDidActiveGroupChange: I,
|
|
2266
|
+
onUnhandledDragOverEvent: I,
|
|
2267
|
+
onDidDrop: I,
|
|
2268
|
+
onWillDrop: I,
|
|
2269
|
+
onWillDragGroup: I,
|
|
2270
|
+
onWillDragPanel: I,
|
|
2271
|
+
onDidActivePanelChange_: I
|
|
1176
2272
|
};
|
|
1177
2273
|
}
|
|
1178
|
-
function
|
|
1179
|
-
return /* @__PURE__ */
|
|
2274
|
+
function ln({ code: e, title: t, description: n }) {
|
|
2275
|
+
return /* @__PURE__ */ i(
|
|
1180
2276
|
"div",
|
|
1181
2277
|
{
|
|
1182
2278
|
className: "flex min-h-screen items-center justify-center bg-background p-6 text-foreground",
|
|
1183
2279
|
"data-testid": "full-page-error-state",
|
|
1184
2280
|
"data-full-page-error-code": e,
|
|
1185
|
-
children: /* @__PURE__ */
|
|
2281
|
+
children: /* @__PURE__ */ i(Ns, { className: "w-full max-w-lg", title: t, description: n })
|
|
1186
2282
|
}
|
|
1187
2283
|
);
|
|
1188
2284
|
}
|
|
1189
|
-
function
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1192
|
-
document.title = (
|
|
1193
|
-
}, [e,
|
|
1194
|
-
const
|
|
1195
|
-
params:
|
|
1196
|
-
api:
|
|
1197
|
-
containerApi:
|
|
2285
|
+
function Uo({ componentId: e, params: t = {} }) {
|
|
2286
|
+
const n = Kr(), { errors: s } = hs(), o = n.get(e), a = n.getComponents()[e];
|
|
2287
|
+
Gi(() => {
|
|
2288
|
+
document.title = (o == null ? void 0 : o.title) ?? e;
|
|
2289
|
+
}, [e, o == null ? void 0 : o.title]);
|
|
2290
|
+
const l = D(() => ({
|
|
2291
|
+
params: t,
|
|
2292
|
+
api: Eo(e),
|
|
2293
|
+
containerApi: ko(),
|
|
1198
2294
|
className: "h-full"
|
|
1199
|
-
}), [e,
|
|
1200
|
-
if (!
|
|
1201
|
-
const
|
|
1202
|
-
for (let
|
|
1203
|
-
const
|
|
1204
|
-
if (
|
|
1205
|
-
return
|
|
2295
|
+
}), [e, t]), g = D(() => {
|
|
2296
|
+
if (!o) return null;
|
|
2297
|
+
const f = o.pluginId ?? o.id;
|
|
2298
|
+
for (let d = s.length - 1; d >= 0; d -= 1) {
|
|
2299
|
+
const m = s[d];
|
|
2300
|
+
if (m.contributionKind === "panel" && m.contributionId === e && m.pluginId === f)
|
|
2301
|
+
return m;
|
|
1206
2302
|
}
|
|
1207
2303
|
return null;
|
|
1208
|
-
}, [e, s,
|
|
1209
|
-
return
|
|
1210
|
-
|
|
2304
|
+
}, [e, s, o]);
|
|
2305
|
+
return o ? !o.supportsFullPage || !a ? /* @__PURE__ */ i(
|
|
2306
|
+
ln,
|
|
1211
2307
|
{
|
|
1212
|
-
code:
|
|
2308
|
+
code: No,
|
|
1213
2309
|
title: "Panel does not support full-page mode",
|
|
1214
2310
|
description: `Panel "${e}" can render in the workspace, but it has not opted into the dedicated full-page pane route.`
|
|
1215
2311
|
}
|
|
1216
|
-
) :
|
|
1217
|
-
|
|
2312
|
+
) : g ? /* @__PURE__ */ i(
|
|
2313
|
+
ln,
|
|
1218
2314
|
{
|
|
1219
|
-
code:
|
|
2315
|
+
code: wo,
|
|
1220
2316
|
title: "Panel failed to render",
|
|
1221
|
-
description: `Panel "${e}" crashed while rendering in full-page mode: ${
|
|
2317
|
+
description: `Panel "${e}" crashed while rendering in full-page mode: ${g.error.message}`
|
|
1222
2318
|
}
|
|
1223
|
-
) : /* @__PURE__ */
|
|
1224
|
-
|
|
2319
|
+
) : /* @__PURE__ */ i("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ i(bs, { mode: "full-page", children: /* @__PURE__ */ i(a, { ...l }) }) }) : /* @__PURE__ */ i(
|
|
2320
|
+
ln,
|
|
1225
2321
|
{
|
|
1226
|
-
code:
|
|
2322
|
+
code: So,
|
|
1227
2323
|
title: "Unknown panel",
|
|
1228
2324
|
description: `No full-page panel component is registered as "${e}".`
|
|
1229
2325
|
}
|
|
1230
2326
|
);
|
|
1231
2327
|
}
|
|
1232
|
-
function
|
|
1233
|
-
var
|
|
1234
|
-
const
|
|
1235
|
-
if (!
|
|
2328
|
+
function Go(e) {
|
|
2329
|
+
var a;
|
|
2330
|
+
const t = new URLSearchParams(e), n = ((a = t.get("component")) == null ? void 0 : a.trim()) ?? "";
|
|
2331
|
+
if (!n)
|
|
1236
2332
|
return {
|
|
1237
2333
|
componentId: null,
|
|
1238
2334
|
params: {},
|
|
1239
2335
|
error: {
|
|
1240
|
-
code:
|
|
2336
|
+
code: vo,
|
|
1241
2337
|
message: "Missing full-page panel component id."
|
|
1242
2338
|
}
|
|
1243
2339
|
};
|
|
1244
|
-
const s =
|
|
2340
|
+
const s = t.get("params");
|
|
1245
2341
|
if (!s)
|
|
1246
|
-
return { componentId:
|
|
1247
|
-
let
|
|
2342
|
+
return { componentId: n, params: {} };
|
|
2343
|
+
let o;
|
|
1248
2344
|
try {
|
|
1249
|
-
|
|
2345
|
+
o = JSON.parse(s);
|
|
1250
2346
|
} catch {
|
|
1251
2347
|
return {
|
|
1252
2348
|
componentId: null,
|
|
1253
2349
|
params: {},
|
|
1254
2350
|
error: {
|
|
1255
|
-
code:
|
|
2351
|
+
code: xo,
|
|
1256
2352
|
message: "Invalid full-page panel params JSON."
|
|
1257
2353
|
}
|
|
1258
2354
|
};
|
|
1259
2355
|
}
|
|
1260
|
-
return
|
|
2356
|
+
return o === null || Array.isArray(o) || typeof o != "object" ? {
|
|
1261
2357
|
componentId: null,
|
|
1262
2358
|
params: {},
|
|
1263
2359
|
error: {
|
|
1264
|
-
code:
|
|
2360
|
+
code: yo,
|
|
1265
2361
|
message: "Full-page panel params must be a JSON object."
|
|
1266
2362
|
}
|
|
1267
|
-
} : { componentId:
|
|
2363
|
+
} : { componentId: n, params: o };
|
|
1268
2364
|
}
|
|
1269
2365
|
export {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
2366
|
+
xo as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
|
|
2367
|
+
vo as FULL_PAGE_PANEL_MISSING_COMPONENT,
|
|
2368
|
+
No as FULL_PAGE_PANEL_NOT_SUPPORTED,
|
|
2369
|
+
yo as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
|
|
2370
|
+
wo as FULL_PAGE_PANEL_RENDER_FAILED,
|
|
2371
|
+
So as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
|
|
2372
|
+
Fo as WorkspaceAgentFront,
|
|
2373
|
+
Qs as WorkspaceBackgroundBoot,
|
|
2374
|
+
$o as WorkspaceBootGate,
|
|
2375
|
+
Uo as WorkspaceFullPagePanel,
|
|
2376
|
+
Hs as createLocalStorageSessions,
|
|
2377
|
+
Go as parseFullPagePanelLocation,
|
|
2378
|
+
Js as useLocalStorageSessions
|
|
1283
2379
|
};
|