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