@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/app-front.js CHANGED
@@ -1,129 +1,1073 @@
1
- import { jsx as f, jsxs as Re, Fragment as fe } from "react/jsx-runtime";
2
- import { useEffect as E, useSyncExternalStore as Wr, useMemo as L, useState as x, useCallback as R, useRef as $, useLayoutEffect as Fr } from "react";
3
- import { PiChatPanel as Ir, usePiSessions as Gr } from "@hachej/boring-agent/front";
4
- import { at as $r, aG as Ye, aH as xn, aI as Mn, aJ as Cn, aK as Wn, aL as ke, aM as bt, aN as yt, aO as Fn, aP as Ur, aQ as ze, O as Kr, q as Hr, aR as En, aS as Jr, U as An, aT as qr, w as jr, u as In, aU as Br, aq as Vr, aV as zr } from "./WorkspaceProvider-Bp1Sm40K.js";
5
- import { T as Yr, C as kr, r as Rn, w as Qr, W as Tn } from "./WorkspaceLoadingState-BYTO4wdt.js";
6
- import { Sun as Xr, Moon as Zr } from "lucide-react";
7
- import { IconButton as es, ErrorState as ts } from "@hachej/boring-ui-kit";
8
- function ns() {
9
- const { theme: e, toggleTheme: n } = $r(), r = e === "dark";
10
- return E(() => {
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__ */ f(
13
- es,
13
+ }, [r]), /* @__PURE__ */ i(
14
+ st,
14
15
  {
15
16
  type: "button",
16
17
  variant: "ghost",
17
18
  size: "icon-sm",
18
- onClick: n,
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__ */ f(Xr, { className: "h-4 w-4" }) : /* @__PURE__ */ f(Zr, { className: "h-4 w-4" })
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 rs() {
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 ss(e, n) {
976
+ function Hs(e, t) {
33
977
  var r;
34
- if (typeof localStorage > "u") return n();
978
+ if (typeof localStorage > "u") return t();
35
979
  try {
36
980
  const s = localStorage.getItem(e);
37
981
  if (s) {
38
- const i = JSON.parse(s), o = Array.isArray(i.sessions) ? i.sessions : Array.isArray(i.items) ? i.items : null;
39
- if (o)
40
- return { sessions: o, activeId: i.activeId ?? ((r = o[0]) == null ? void 0 : r.id) ?? "" };
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 n();
988
+ return t();
45
989
  }
46
- function is(e, n) {
990
+ function Bs(e, t) {
47
991
  if (!(typeof localStorage > "u"))
48
992
  try {
49
- localStorage.setItem(e, JSON.stringify(n));
993
+ localStorage.setItem(e, JSON.stringify(t));
50
994
  } catch {
51
995
  }
52
996
  }
53
- function os(e = {}) {
54
- const n = e.storageKey ?? "workspace:sessions", r = e.initial ?? rs;
55
- let s = ss(n, r);
56
- const i = /* @__PURE__ */ new Set(), o = (c) => {
57
- s = c, is(n, s), i.forEach((d) => d());
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(c) {
62
- return i.add(c), () => {
63
- i.delete(c);
1005
+ subscribe(l) {
1006
+ return o.add(l), () => {
1007
+ o.delete(l);
64
1008
  };
65
1009
  },
66
- switchTo(c) {
67
- o({ ...s, activeId: c });
1010
+ switchTo(l) {
1011
+ a({ ...s, activeId: l });
68
1012
  },
69
1013
  create() {
70
- const c = `s${Date.now()}`, d = {
71
- id: c,
1014
+ const l = `s${Date.now()}`, f = {
1015
+ id: l,
72
1016
  title: "New session",
73
1017
  updatedAt: Date.now()
74
1018
  };
75
- o({ sessions: [d, ...s.sessions], activeId: c });
1019
+ a({ sessions: [f, ...s.sessions], activeId: l });
76
1020
  },
77
- remove(c) {
78
- var P;
79
- const d = s.sessions.filter((y) => y.id !== c), b = s.activeId === c ? ((P = d[0]) == null ? void 0 : P.id) ?? "" : s.activeId;
80
- o({ sessions: d, activeId: b });
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 as(e) {
85
- return Wr(e.subscribe, e.getState, e.getState);
1028
+ function qs(e) {
1029
+ return fn(e.subscribe, e.getState, e.getState);
86
1030
  }
87
- const ls = 500, cs = 1e4;
88
- function wn(e) {
89
- return new Promise((n, r) => {
1031
+ const Vs = 500, Ys = 1e4;
1032
+ function Rr(e) {
1033
+ return new Promise((t, r) => {
90
1034
  let s;
91
- const i = () => {
92
- s && globalThis.clearTimeout(s), e.removeEventListener("abort", o);
93
- }, o = () => {
94
- i(), r(new DOMException("Warmup aborted", "AbortError"));
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
- o();
1041
+ a();
98
1042
  return;
99
1043
  }
100
1044
  s = globalThis.setTimeout(() => {
101
- i(), n();
102
- }, ls), e.addEventListener("abort", o, { once: !0 });
1045
+ o(), t();
1046
+ }, Vs), e.addEventListener("abort", a, { once: !0 });
103
1047
  });
104
1048
  }
105
- async function us(e) {
106
- const n = e.body;
107
- if (!n) return ze(await ke(e));
108
- const r = n.getReader(), s = new TextDecoder();
109
- let i = "";
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: o, value: c } = await r.read();
113
- if (c) {
114
- i += s.decode(c, { stream: !o });
115
- const d = ze(i);
116
- if (d) return d;
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 (o)
119
- return i += s.decode(), ze(i);
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 ds(e) {
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 fs(e) {
1078
+ async function Qs(e) {
135
1079
  if (!e.ok) {
136
- const i = await ke(e);
137
- if (bt(i)) return { status: "preparing" };
138
- throw new Error(yt(i) ?? `/api/v1/ready-status failed with ${e.status}`);
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 n = await us(e), r = ds(n), s = Ur(n);
141
- if ((n == null ? void 0 : n.state) === "degraded" || (n == null ? void 0 : n.state) === "failed") {
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(n.message ?? "Workspace failed to prepare");
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 gs({
1092
+ async function Zs({
149
1093
  apiBaseUrl: e,
150
- path: n,
1094
+ path: t,
151
1095
  headers: r,
152
1096
  signal: s,
153
- workspaceId: i
1097
+ workspaceId: o
154
1098
  }) {
155
- const o = new AbortController(), c = globalThis.setTimeout(() => o.abort(new DOMException("Warmup attempt timed out", "TimeoutError")), cs), d = () => o.abort(s.reason);
156
- s.aborted && d(), s.addEventListener("abort", d, { once: !0 });
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 b = await fetch(Cn(e, n), { headers: r, signal: o.signal });
159
- if (Wn(n)) return await fs(b);
160
- const P = await ke(b);
161
- if (!b.ok) {
162
- const y = bt(P);
163
- if (y) return { status: "preparing", ...y };
164
- throw new Error(yt(P) ?? `${n} failed with ${b.status}`);
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 P && typeof P == "object" && Fn(e, r["x-boring-workspace-id"] ?? i, n, P), { status: "ready" };
167
- } catch (b) {
168
- if (s.aborted) throw b;
169
- if (o.signal.aborted || b instanceof TypeError) return { status: "preparing" };
170
- throw b;
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(c), s.removeEventListener("abort", d);
1116
+ globalThis.clearTimeout(l), s.removeEventListener("abort", f);
173
1117
  }
174
1118
  }
175
- function ms({
1119
+ function eo({
176
1120
  workspaceId: e,
177
- requestHeaders: n,
1121
+ requestHeaders: t,
178
1122
  apiBaseUrl: r,
179
- preloadPaths: s = xn,
180
- provisionWorkspace: i = !0,
181
- onStatusChange: o
1123
+ preloadPaths: s = Gr,
1124
+ provisionWorkspace: o = !0,
1125
+ onStatusChange: a
182
1126
  }) {
183
- return E(() => {
184
- let c = !1;
185
- const d = new AbortController(), b = Ye(e, n);
186
- async function P() {
187
- var y, B;
188
- o == null || o({ status: "preparing" });
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 F = Mn(s, i), k = (h) => gs({
1134
+ const R = zr(s, o), O = (b) => Zs({
191
1135
  apiBaseUrl: r,
192
- path: h,
193
- headers: b,
194
- signal: d.signal,
1136
+ path: b,
1137
+ headers: g,
1138
+ signal: f.signal,
195
1139
  workspaceId: e
196
1140
  });
197
- let w = await Promise.all(F.map(async (h) => ({ path: h, result: await k(h) })));
198
- if (c || d.signal.aborted) return;
199
- let S = (y = w.find((h) => h.result.runtimeDependencies)) == null ? void 0 : y.result.runtimeDependencies, N = w.filter((h) => h.result.status === "preparing");
200
- for (; N.length > 0; ) {
201
- let h;
202
- for (const D of N)
203
- if (D.result.status === "preparing" && D.result.requirement) {
204
- h = D.result.requirement;
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 (o == null || o({ status: "preparing", message: "Workspace is still preparing", ...h ? { requirement: h } : {} }), await wn(d.signal), c || d.signal.aborted || (w = await Promise.all(N.map(async (D) => ({ path: D.path, result: await k(D.path) }))), c || d.signal.aborted)) return;
208
- S = ((B = w.find((D) => D.result.runtimeDependencies)) == null ? void 0 : B.result.runtimeDependencies) ?? S, N = w.filter((D) => D.result.status === "preparing");
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 (o == null || o({ status: "ready", ...S ? { runtimeDependencies: S } : {} }); (S == null ? void 0 : S.state) === "preparing"; ) {
211
- if (await wn(d.signal), c || d.signal.aborted) return;
212
- const h = await k("/api/v1/ready-status");
213
- if (c || d.signal.aborted) return;
214
- S = h.runtimeDependencies, S && (o == null || o({ status: "ready", runtimeDependencies: S }));
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 (F) {
217
- if (c || d.signal.aborted) return;
218
- o == null || o({
1160
+ } catch (R) {
1161
+ if (l || f.signal.aborted) return;
1162
+ a == null || a({
219
1163
  status: "failed",
220
- message: F instanceof Error ? F.message : "Workspace failed to prepare"
1164
+ message: R instanceof Error ? R.message : "Workspace failed to prepare"
221
1165
  });
222
1166
  }
223
1167
  }
224
- return P(), () => {
225
- c = !0, d.abort();
1168
+ return d(), () => {
1169
+ l = !0, f.abort();
226
1170
  };
227
- }, [r, o, s, i, n, e]), null;
1171
+ }, [r, a, s, o, t, e]), null;
228
1172
  }
229
- function ps(e) {
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 Ve(e, n, r) {
1258
+ function _t(e, t, r) {
233
1259
  if (e.includes(r)) return e;
234
- const s = n ? e.indexOf(n) : -1, i = s >= 0 ? s + 1 : e.length;
235
- return [...e.slice(0, i), r, ...e.slice(i)];
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 Nn(e, n, r) {
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 = n ? e.indexOf(n) : -1, i = s >= 0 ? s : 0;
241
- return e.map((o, c) => c === i ? r : o);
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 hs(e, n) {
244
- return e.endsWith(":surface") ? e.slice(0, -8) : n;
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 ht(e, n, r) {
247
- const [s, i] = x(() => Rn(e, n, r));
248
- E(() => {
249
- i(Rn(e, n, r));
250
- }, [e, n, r]);
251
- const o = R(
252
- (c) => {
253
- i(c), Qr(e, c, r);
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, o];
1299
+ return [s, a];
258
1300
  }
259
- const St = {}, Ss = [], Dn = { status: "preparing" }, _n = {
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 vs({ status: e }) {
264
- const n = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", s = r ? n === "workspace-fs" ? "Preparing files…" : n === "sandbox-exec" ? "Preparing secure runtime…" : n === "ui-bridge" ? "Connecting workspace…" : "Preparing workspace…" : "Workspace workbench failed", i = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
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: n,
276
- storageScope: n,
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 ys(e) {
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 Ps(e) {
288
- const n = 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) : [];
289
- return r.length > 0 ? `${n}
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
- `)}` : n;
1330
+ `)}` : t;
294
1331
  }
295
- function Es(e) {
296
- var n;
1332
+ function po(e) {
1333
+ var t;
297
1334
  try {
298
- return ((n = globalThis.localStorage) == null ? void 0 : n.getItem(e)) ?? null;
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 On(e, n) {
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 i = JSON.parse(s), o = Array.isArray(i.ids) ? i.ids.filter((d) => typeof d == "string" && d.length > 0) : [];
309
- if (o.length === 0) return null;
310
- const c = typeof i.activeId == "string" && o.includes(i.activeId) ? i.activeId : o[0];
311
- return { workspaceId: n, ids: o, activeId: c };
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 As(e, n) {
1353
+ function ho(e, t) {
317
1354
  var r, s;
318
1355
  try {
319
- if (n.ids.length === 0) {
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: n.ids, activeId: n.activeId })
1362
+ JSON.stringify({ ids: t.ids, activeId: t.activeId })
326
1363
  );
327
1364
  } catch {
328
1365
  }
329
1366
  }
330
- function Ln(e, n) {
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 i = JSON.parse(s), o = Array.isArray(i.ids) ? i.ids.filter((c) => typeof c == "string" && c.length > 0) : [];
336
- return { workspaceId: n, ids: o };
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 Rs(e, n) {
1378
+ function bo(e, t) {
342
1379
  var r, s;
343
1380
  try {
344
- if (n.length === 0) {
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: n }));
1385
+ (s = globalThis.localStorage) == null || s.setItem(e, JSON.stringify({ ids: t }));
349
1386
  } catch {
350
1387
  }
351
1388
  }
352
- function Ts() {
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: n,
1391
+ chatPanel: t,
410
1392
  useSessions: r,
411
1393
  requestHeaders: s,
412
- sessionStorageKey: i,
413
- providerStorageKey: o,
414
- surfaceStorageKey: c,
415
- beforeShell: d,
416
- afterShell: b,
417
- panels: P,
418
- commands: y,
419
- catalogs: B,
420
- plugins: F,
421
- excludeDefaults: k,
422
- capabilities: w,
423
- apiBaseUrl: S,
424
- authHeaders: N,
425
- apiTimeout: h,
426
- defaultTheme: D,
427
- onThemeChange: Gn,
428
- persistenceEnabled: Pt,
429
- debug: $n,
430
- bridgeEndpoint: Qe,
431
- fullPageBasePath: Un,
432
- onAuthError: Kn,
433
- sessions: Et,
434
- activeSessionId: At,
435
- onSwitchSession: Rt,
436
- onCreateSession: Xe,
437
- onDeleteSession: Tt,
438
- onActiveSessionIdChange: Te,
439
- appTitle: wt = "Boring UI",
440
- workspaceLabel: Hn,
441
- defaultSessionTitle: Q = "New session",
442
- navEnabled: Nt = !0,
443
- defaultNavOpen: Jn = !1,
444
- defaultSurfaceOpen: qn,
445
- defaultWorkbenchLeftTab: we,
446
- defaultWorkbenchLeftOpen: Ze,
447
- surfaceInitialPanels: Dt,
448
- topBarLeft: jn,
449
- topBarRight: Bn,
450
- showThemeToggle: Vn = !0,
451
- chatParams: T,
452
- externalPlugins: zn,
453
- hotReloadEnabled: Yn,
454
- frontPluginHotReload: kn,
455
- extraPanels: _t,
456
- extraCommands: Ot,
457
- provisionWorkspace: et,
458
- bootPreloadPaths: Qn,
459
- onWorkspaceWarmupStatusChange: Ne,
460
- onOpenNav: tt,
461
- onOpenSurface: nt,
462
- surfaceButtonBottomOffset: Xn,
463
- className: Zn
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 hn, Sn;
466
- const Lt = zn !== !1, er = Lt ? kn : !1, rt = Lt ? Yn : !1, st = o ?? `boring-ui-v2:layout:${e}`, I = c ?? `${st}:surface`, De = hs(
467
- I,
468
- st
469
- ), C = Pt !== !1, _e = i ?? `boring-workspace:sessions:${e}`, X = L(
470
- () => Ye(e, s ?? St),
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
- ), tr = L(
473
- () => Ye(e, { ...s ?? St, ...N ?? St }),
474
- [N, s, e]
475
- ), Oe = L(
476
- () => os({ storageKey: _e }),
477
- [_e]
478
- ), xt = as(Oe), [Mt, nr] = x(() => ({
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: Dn
481
- })), [Le, it] = x(() => ({
1477
+ status: _r
1478
+ })), [mt, Yt] = L(() => ({
482
1479
  workspaceId: e,
483
1480
  expired: !1
484
- })), [Ct, xe] = x(() => ({
1481
+ })), [Rn, pt] = L(() => ({
485
1482
  workspaceId: e,
486
1483
  creating: !1
487
- })), [Wt, Me] = x(() => ({
1484
+ })), [Cn, Le] = L(() => ({
488
1485
  workspaceId: e,
489
1486
  failed: !1
490
- })), ge = `boring-workspace:chat-panes:${e}`, [_, Y] = x(
491
- () => (C ? On(ge, e) : null) ?? { workspaceId: e, ids: [], activeId: null }
492
- ), [ie, Ft] = x(null);
493
- E(() => {
494
- if (!ie) return;
495
- const t = setTimeout(() => Ft(null), 700);
496
- return () => clearTimeout(t);
497
- }, [ie]);
498
- const me = `boring-workspace:pinned-sessions:${e}`, [It, Gt] = x(
499
- () => (C ? Ln(me, e) : null) ?? { workspaceId: e, ids: [] }
500
- ), rr = It.workspaceId === e ? It.ids : Ss;
501
- E(() => {
502
- Gt((t) => t.workspaceId === e ? t : (C ? Ln(me, e) : null) ?? { workspaceId: e, ids: [] });
503
- }, [me, C, e]);
504
- const sr = R((t) => {
505
- Gt((l) => {
506
- const a = l.workspaceId === e ? l.ids : [], g = a.includes(t) ? a.filter((m) => m !== t) : [t, ...a];
507
- return C && Rs(me, g), { workspaceId: e, ids: g };
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
- }, [me, C, e]);
510
- E(() => {
511
- C && _.workspaceId === e && As(ge, _);
512
- }, [_, ge, C, e]), E(() => {
513
- Y((t) => t.workspaceId === e ? t : (C ? On(ge, e) : null) ?? { workspaceId: e, ids: [], activeId: null });
514
- }, [ge, C, e]);
515
- const Ce = Mt.workspaceId === e ? Mt.status : Dn, ir = n ?? Ir, or = r ?? bs, Z = !n || !!r, We = Z && et !== !1, ot = () => {
516
- }, O = or({
517
- requestHeaders: X,
518
- storageKey: _e,
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: S,
521
- enabled: We
522
- }), [pe, ar] = x(() => ({ workspaceId: e, sessions: [], activeSessionId: null })), $t = We && O.workspaceId != null && O.workspaceId !== e, q = We && !O.loading && !O.error && !$t, W = We && !q;
523
- E(() => {
524
- q && ar((t) => {
525
- const l = t.workspaceId === e, a = t.activeSessionId === O.activeSessionId, g = t.sessions.length === O.sessions.length && t.sessions.every((m, v) => {
526
- var H;
527
- return m.id === ((H = O.sessions[v]) == null ? void 0 : H.id);
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 l && a && g ? t : {
1526
+ return c && u && N ? n : {
530
1527
  workspaceId: e,
531
- sessions: O.sessions,
532
- activeSessionId: O.activeSessionId
1528
+ sessions: G.sessions,
1529
+ activeSessionId: G.activeSessionId
533
1530
  };
534
1531
  });
535
- }, [O.activeSessionId, O.sessions, q, e]);
536
- const Fe = W && pe.workspaceId === e && pe.sessions.length > 0, Ie = W ? Es(_e) : null, Ut = W && !$t ? O.activeSessionId ?? null : null, V = q ? O.sessions : Fe ? pe.sessions : [], lr = q ? O.activeSessionId : Fe ? pe.activeSessionId : null, u = Z && (q || Fe) ? O : void 0, oe = Et !== void 0 || At !== void 0 || Rt !== void 0 || Xe !== void 0 || Tt !== void 0, Kt = Le.workspaceId === e && Le.expired, he = $(!1), Se = !!(q && u && !oe && V.length === 0 && !Kt), cr = Ct.workspaceId === e && Ct.creating, ur = Wt.workspaceId === e && Wt.failed, dr = !!(q && u && !oe && V.length === 0 && Kt && !he.current && !ur), Ge = !!(W && O.loading && !O.error && Z && !oe && !Fe && !Ie && !Ut) || Se || cr || dr;
537
- E(() => {
538
- if (!Se) {
539
- Le.workspaceId !== e && it({ workspaceId: e, expired: !1 });
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
- it({ workspaceId: e, expired: !1 });
543
- const t = globalThis.setTimeout(() => {
544
- it({ workspaceId: e, expired: !0 });
1539
+ Yt({ workspaceId: e, expired: !1 });
1540
+ const n = globalThis.setTimeout(() => {
1541
+ Yt({ workspaceId: e, expired: !0 });
545
1542
  }, 2e3);
546
- return () => globalThis.clearTimeout(t);
547
- }, [Le.workspaceId, Se, e]);
548
- const fr = u ? V.map((t) => ({
549
- ...t,
550
- title: t.title ?? "New session"
551
- })) : void 0, gr = Ie ? [{
552
- id: Ie,
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
- }] : [], U = u ? fr ?? [] : W ? gr : oe ? Et ?? [] : xt.sessions, mr = u ? lr ?? null : W ? Ie ?? Ut : oe ? At ?? null : xt.activeId, ae = (T == null ? void 0 : T.autoSubmitInitialDraft) === !0, $e = ae && Z && !oe, [K, ve] = x(() => $e ? null : void 0), Ht = $(e), le = $(!1);
558
- E(() => {
559
- if (Ht.current !== e) {
560
- Ht.current = e, le.current = !1, ve($e ? null : void 0);
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
- $e && K === void 0 && (le.current = !1, ve(null));
564
- }, [K, $e, e]), E(() => {
565
- !u || K !== null || le.current || (le.current = !0, Promise.resolve(u.create({ title: Q })).then((t) => {
566
- if (typeof (t == null ? void 0 : t.id) != "string")
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
- ve(t.id);
1565
+ je(n.id);
569
1566
  }).catch(() => {
570
- le.current = !1, ve(void 0);
1567
+ Ie.current = !1, je(void 0);
571
1568
  }));
572
- }, [K, Q, u]);
573
- const G = K !== void 0 ? K ?? null : mr, j = W ? ot : (u == null ? void 0 : u.switch) ?? Rt ?? Oe.switchTo, Ue = R((t) => (G && t !== G && Kr({ sessionId: G, reason: Hr.sessionSwitch }), j(t)), [G, j]), at = W ? ot : u ? () => u.create() : Xe ? () => Xe() : () => Oe.create(), Jt = W ? ot : (u == null ? void 0 : u.delete) ?? Tt ?? Oe.remove, qt = R((t) => (u && V.length <= 1 && (he.current = !0), Jt(t)), [V.length, Jt, u]), pr = ((hn = U.find((t) => t.id === G)) == null ? void 0 : hn.title) ?? void 0, [hr, jt] = ht(
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
- Jn,
576
- C
577
- ), Bt = Nt && hr, [ee, z] = ht(
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
- qn ?? !1,
583
- C
584
- ), [Sr, lt] = x(!1), [vr, be] = ht(
1609
+ Kt ?? !1,
1610
+ K
1611
+ ), [Si, jt] = L(!1), [wi, Pe] = Tt(
585
1612
  `${De}:workbenchLeftOpen`,
586
- Ze ?? !1,
587
- C
588
- ), [br, Ke] = x(() => Ze ?? !1), yr = Ze === !1 ? br : vr, ye = $(!1), te = $(null), ne = $(ee), Vt = $(I), ct = $(null), ut = $([]);
589
- Vt.current = I;
590
- const [zt, Yt] = x(() => ({
591
- key: I,
592
- snapshot: _n
593
- })), Pr = zt.key === I ? zt.snapshot : _n;
594
- E(() => {
595
- ye.current = !1, he.current = !1, xe({ workspaceId: e, creating: !1 }), Me({ workspaceId: e, failed: !1 });
596
- }, [e]), E(() => {
597
- lt(!1), ut.current = [];
598
- }, [I]), E(() => {
599
- if (!(!u || u.loading) && !Se && K === void 0) {
600
- if (V.length > 0) {
601
- ye.current = !1, he.current = !1, xe((t) => t.workspaceId === e && t.creating ? { workspaceId: e, creating: !1 } : t), Me((t) => t.workspaceId === e && t.failed ? { workspaceId: e, failed: !1 } : t);
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
- he.current || ye.current || (ye.current = !0, xe({ workspaceId: e, creating: !0 }), Me({ workspaceId: e, failed: !1 }), Promise.resolve(u.create({ title: Q })).catch(() => {
605
- ye.current = !1, xe({ workspaceId: e, creating: !1 }), Me({ workspaceId: e, failed: !0 });
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
- }, [V.length, K, Q, Se, u, e]), E(() => {
609
- ne.current = ee;
610
- }, [ee]);
611
- const kt = R((t) => {
612
- ct.current = { key: I, api: t }, lt(!0), Yt({
613
- key: I,
614
- snapshot: t.getSnapshot()
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 l = ut.current.splice(0);
617
- for (const a of l) a(t);
618
- }, [I]), Qt = R((t) => {
619
- ut.current.push(t);
620
- }, []), Xt = R((t) => {
621
- Yt({
622
- key: I,
623
- snapshot: t
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
- }, [I]), He = R(() => {
626
- const t = ct.current;
627
- return (t == null ? void 0 : t.key) === Vt.current ? t.api : null;
628
- }, []), Zt = R(() => ne.current, []), en = R(() => {
629
- ne.current = !0, z(!0);
630
- }, [z]), tn = R(() => {
631
- ne.current = !0, z(!0), be(!0), Ke(!0);
632
- }, [z, be]), Je = R(() => {
633
- ne.current = !1, ct.current = null, lt(!1), z(!1);
634
- }, [z]), nn = $(/* @__PURE__ */ new Set()), rn = R((t) => {
635
- const l = t.meta;
636
- if (!l || l.openOnlyWhenSessionOpen !== !0) return !0;
637
- const a = typeof l.sessionId == "string" ? l.sessionId : null;
638
- return a ? nn.current.has(a) : !1;
639
- }, []), ce = L(() => ({
640
- surface: He,
641
- isWorkbenchOpen: Zt,
642
- openWorkbench: en,
643
- openWorkbenchSources: tn,
644
- closeWorkbench: Je,
645
- enqueue: Qt,
646
- shouldOpenSurface: rn
647
- }), [He, Zt, en, tn, Je, Qt, rn]), Er = L(() => ({
648
- openFile: async (t) => (En({ kind: "openFile", params: { path: t } }, ce), { seq: 0, status: "ok" }),
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 t;
651
- return ((t = He()) == null ? void 0 : t.getSnapshot().activeTab) ?? null;
1685
+ var n;
1686
+ return ((n = Fe()) == null ? void 0 : n.getSnapshot().activeTab) ?? null;
652
1687
  },
653
1688
  select: () => () => {
654
1689
  }
655
- }), [He, ce]), ue = L(
656
- () => (F == null ? void 0 : F.map(Jr)) ?? [],
657
- [F]
658
- ), dt = L(
659
- () => ue.some((t) => t.registrations.leftTabs.length > 0),
660
- [ue]
661
- ), sn = L(
662
- () => ue.flatMap((t) => t.registrations.panels.map((l) => l.id)),
663
- [ue]
664
- ), on = L(() => {
665
- const t = {};
666
- for (const l of ue)
667
- for (const a of l.registrations.toolRenderers)
668
- t[a.id] = a.render;
669
- return t;
670
- }, [ue]), an = L(
671
- () => [..._t ?? [], ...sn],
672
- [_t, sn]
673
- ), p = Z && !r && pe.workspaceId !== e ? "default" : G ?? (K !== void 0 ? "default" : ((Sn = U[0]) == null ? void 0 : Sn.id) ?? "default"), ln = !(u != null && u.hasMore) && !W;
674
- E(() => {
675
- var H, Ee;
676
- if (Ge) return;
677
- const t = te.current, l = new Set(U.map((J) => J.id)), a = t ? t.createdId ?? (l.has(p) && !t.knownIds.has(p) ? p : ((H = U.find((J) => !t.knownIds.has(J.id))) == null ? void 0 : H.id) ?? null) : null;
678
- a && l.has(a) && (te.current = null);
679
- const g = p === "default" && K !== void 0, m = ln && l.size > 0 && !g, v = a ?? (m && !l.has(p) ? ((Ee = U[0]) == null ? void 0 : Ee.id) ?? p : p);
680
- Y((J) => {
681
- const se = J.workspaceId === e ? J : { workspaceId: e, ids: [], activeId: null };
682
- if (W && se.ids.length > 0 && !a) return se;
683
- const vn = se.ids.length > 0 ? se.ids : [v], bn = m ? vn.filter((Be) => l.has(Be) || Be === a) : vn, de = bn.length > 0 ? bn : [v], yn = se.activeId && de.includes(se.activeId) ? se.activeId : de[0] ?? v, Ae = a ? Ve(de, t == null ? void 0 : t.afterId, a) : v === yn || de.includes(v) ? de : Nn(de, yn, v), Pn = Ae.includes(v) ? v : Ae[0] ?? v;
684
- return J.workspaceId === e && J.activeId === Pn && J.ids.length === Ae.length && J.ids.every((Be, Cr) => Be === Ae[Cr]) ? J : { workspaceId: e, ids: Ae, activeId: Pn };
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
- }, [K, p, W, Ge, U, ln, e]);
687
- const cn = L(() => {
688
- const t = /* @__PURE__ */ new Map();
689
- for (const l of U) t.set(l.id, l.title);
690
- return t;
691
- }, [U]), [ft, un] = x(() => ({
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
- })), dn = L(() => {
695
- const t = /* @__PURE__ */ new Set();
696
- if (!q) return t;
697
- const l = ft.workspaceId === e ? ft.ids : /* @__PURE__ */ new Set();
698
- for (const a of V)
699
- a.turnCount === 0 && !l.has(a.id) && t.add(a.id);
700
- return t;
701
- }, [V, ft, q, e]);
702
- E(() => {
703
- un((t) => t.workspaceId === e ? t : { workspaceId: e, ids: /* @__PURE__ */ new Set() });
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 gt = _.workspaceId === e ? _ : { ids: [], activeId: null }, re = gt.ids.length > 0 ? gt.ids : [p];
706
- E(() => {
707
- nn.current = new Set(re);
708
- }, [re]);
709
- const Pe = gt.activeId ?? re[0] ?? p, Ar = R((t) => {
710
- const a = (_.workspaceId === e ? _ : { ids: [p] }).ids.includes(t);
711
- return Y((g) => {
712
- const m = g.workspaceId === e ? g : { ids: [p], activeId: p }, v = m.ids.includes(t) ? m.ids : Nn(m.ids, m.activeId, t);
713
- return { workspaceId: e, ids: v, activeId: t };
714
- }), a ? j(t) : Ue(t);
715
- }, [_, p, j, Ue, e]), Rr = R((t) => (Y((l) => {
716
- const a = l.workspaceId === e ? l : { ids: [p], activeId: p };
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: a.ids.includes(t) ? a.ids : Ve(a.ids, a.activeId, t),
720
- activeId: t
1754
+ ids: u.ids.includes(n) ? u.ids : _t(u.ids, u.activeId, n),
1755
+ activeId: n
721
1756
  };
722
- }), j(t)), [p, j, e]), fn = R((t) => ((_.workspaceId === e ? _ : { ids: [p] }).ids.includes(t) && Ft({ workspaceId: e, id: t }), Y((a) => {
723
- const g = a.workspaceId === e ? a : { ids: [p], activeId: p };
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: Ve(g.ids, g.activeId, t),
727
- activeId: t
1761
+ ids: _t(N.ids, N.activeId, n),
1762
+ activeId: n
728
1763
  };
729
- }), j(t)), [_, p, j, e]), Tr = R((t) => {
730
- const l = _.workspaceId === e ? _ : { ids: [p], activeId: p };
731
- if (l.ids.length <= 1) return;
732
- const a = l.ids.indexOf(t);
733
- if (a < 0) return;
734
- const g = l.ids.filter((v) => v !== t), m = l.activeId === t ? g[Math.max(0, a - 1)] ?? g[0] ?? null : l.activeId;
735
- Y({ workspaceId: e, ids: g, activeId: m }), m && l.activeId === t && j(m);
736
- }, [_, p, j, e]), wr = R((t) => {
737
- const l = {
738
- afterId: t,
739
- knownIds: new Set(U.map((g) => g.id))
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
- te.current = l;
742
- const a = at();
743
- return Promise.resolve(a).then((g) => {
744
- const m = ps(g);
745
- m && (te.current === l && (te.current = { ...l, createdId: m }), Y((v) => {
746
- const H = v.workspaceId === e ? v : { ids: [p] };
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: Ve(H.ids, t, m),
750
- activeId: m
1798
+ ids: _t(j.ids, n, w),
1799
+ activeId: w
751
1800
  };
752
1801
  }));
753
1802
  }).catch(() => {
754
- te.current === l && (te.current = null);
755
- }), a;
756
- }, [p, at, U, e]), Nr = R((t) => {
757
- const l = _.workspaceId === e ? _ : { ids: [p], activeId: p }, a = l.ids.indexOf(t);
758
- let g = l.activeId;
759
- if (a >= 0) {
760
- const m = l.ids.filter((v) => v !== t);
761
- g = l.activeId === t ? m[Math.max(0, a - 1)] ?? m[0] ?? null : l.activeId, Y({ workspaceId: e, ids: m, activeId: g }), g && l.activeId === t && Ue(g);
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 qt(t);
764
- }, [_, p, qt, Ue, e]), [Dr, mt] = x(ae), gn = $(e);
765
- E(() => {
766
- if (gn.current !== e) {
767
- gn.current = e, mt(ae);
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
- ae && mt(!0);
771
- }, [ae, e]);
772
- const mn = ae && Z && !G, pn = !Dr && et !== !1 && (Z ? !!G : !0), _r = R((t) => {
773
- nr({ workspaceId: e, status: t }), Ne == null || Ne(t);
774
- }, [Ne, e]);
775
- E(() => {
776
- var l;
777
- const t = (a) => {
778
- const g = a.detail;
779
- !g || typeof g != "object" || En(g, ce);
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 (l = globalThis.addEventListener) == null || l.call(globalThis, An, t), () => {
782
- var a;
783
- return (a = globalThis.removeEventListener) == null ? void 0 : a.call(globalThis, An, t);
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
- }, [ce]), E(() => {
786
- W || Te == null || Te(G ?? null);
787
- }, [G, Te, W]);
788
- const pt = Ce.status !== "ready", Or = pt ? /* @__PURE__ */ f(vs, { status: Ce }) : void 0, qe = R(async (t) => {
789
- const l = `${(S == null ? void 0 : S.replace(/\/$/, "")) ?? ""}/api/v1/agent/reload`;
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 a = await fetch(l, {
1840
+ const u = await fetch(c, {
792
1841
  method: "POST",
793
- headers: { ...X, "content-type": "application/json" },
794
- body: JSON.stringify({ sessionId: t })
1842
+ headers: { ...Se, "content-type": "application/json" },
1843
+ body: JSON.stringify({ sessionId: n })
795
1844
  });
796
- if (!a.ok)
797
- return (await a.json().catch(() => ({}))).error || `reload failed (${a.status})`;
798
- const g = await a.json().catch(() => ({}));
799
- return window.dispatchEvent(new CustomEvent(qr, { detail: g })), Ps(g);
800
- } catch (a) {
801
- return a instanceof Error ? a.message : "Agent plugin reload failed.";
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
- }, [S, X]), je = R(
804
- (t, l = {}) => {
805
- const a = l.bridgeEnabled ?? !0, g = T != null && T.toolRenderers && typeof T.toolRenderers == "object" ? T.toolRenderers : void 0;
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
- ...T,
808
- ...mn ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
809
- sessionId: t,
810
- apiBaseUrl: S,
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: X,
1862
+ requestHeaders: Se,
814
1863
  showSessions: !1,
815
- onReloadAgentPlugins: (T == null ? void 0 : T.onReloadAgentPlugins) ?? (() => qe(t)),
816
- toolRenderers: { ...on, ...g ?? {} },
817
- bridgeEndpoint: a ? Qe : null,
818
- surfaceDispatch: ce,
819
- extraCommands: Ot,
820
- workspaceWarmupStatus: Ce,
821
- hydrateMessages: pn,
822
- allowPromptDuringInitialHydration: dn.has(t),
823
- onPromptSubmitStarted: ({ sessionId: m }) => {
824
- un((v) => {
825
- const H = v.workspaceId === e ? v.ids : /* @__PURE__ */ new Set();
826
- if (H.has(m)) return v.workspaceId === e ? v : { workspaceId: e, ids: H };
827
- const Ee = new Set(H);
828
- return Ee.add(m), { workspaceId: e, ids: Ee };
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 v;
833
- (v = u == null ? void 0 : u.refresh) == null || v.call(u, { background: !0 });
834
- const m = T == null ? void 0 : T.onTurnComplete;
835
- typeof m == "function" && m();
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
- le.current = !1, mt(!1), ve(void 0);
839
- const m = T == null ? void 0 : T.onAutoSubmitInitialDraftSettled;
840
- typeof m == "function" && m();
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
- ...rt !== void 0 ? { hotReloadEnabled: rt } : {}
1894
+ ...qt !== void 0 ? { hotReloadEnabled: qt } : {}
846
1895
  };
847
1896
  },
848
- [S, T, mn, X, Qe, ce, Ot, Ce, pn, dn, rt, on, qe, u, e]
849
- ), Lr = L(
850
- () => je(p),
851
- [p, je]
852
- ), xr = L(() => re.map((t) => ({
853
- id: t,
854
- title: cn.get(t) ?? (t === "default" ? Q : t),
855
- panel: "chat",
856
- params: je(t, { bridgeEnabled: t === Pe })
857
- })), [Pe, re, Q, je, cn]), Mr = L(() => ({
858
- storageKey: I,
859
- defaultLeftTab: we,
860
- initialPanels: Dt,
861
- extraPanels: an,
862
- onReloadAgentPlugins: () => qe(G ?? p),
863
- onReady: kt,
864
- onChange: Xt,
865
- onClose: Je
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
- Je,
868
- we,
869
- Dt,
870
- qe,
871
- G,
872
- p,
873
- Xt,
874
- kt,
875
- I,
876
- an,
877
- z
878
- ]);
879
- return /* @__PURE__ */ f("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ Re(
880
- jr,
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: ir,
883
- panels: P,
884
- commands: y,
885
- catalogs: B,
886
- plugins: F,
887
- excludeDefaults: k,
888
- capabilities: w,
889
- apiBaseUrl: S,
890
- authHeaders: tr,
891
- apiTimeout: h,
892
- activeSessionId: Pe,
893
- openSessionIds: re,
894
- defaultTheme: D,
895
- onThemeChange: Gn,
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: Hn,
898
- appTitle: wt,
899
- storageKey: st,
900
- persistenceEnabled: Pt,
901
- debug: $n,
2119
+ workspaceLabel: lt,
2120
+ appTitle: pe,
2121
+ storageKey: Vt,
2122
+ persistenceEnabled: $,
2123
+ debug: be,
902
2124
  bridgeEndpoint: null,
903
- onAuthError: Kn,
904
- frontPluginHotReload: er,
905
- fullPageBasePath: Un,
2125
+ onAuthError: Mt,
2126
+ frontPluginHotReload: ii,
2127
+ fullPageBasePath: Wt,
2128
+ commandPaletteSessionSearch: $i,
906
2129
  children: [
907
- d,
908
- /* @__PURE__ */ f(
909
- ms,
2130
+ f,
2131
+ /* @__PURE__ */ i(
2132
+ eo,
910
2133
  {
911
2134
  workspaceId: e,
912
- requestHeaders: X,
913
- apiBaseUrl: S,
914
- preloadPaths: Qn,
915
- provisionWorkspace: et,
916
- onStatusChange: _r
2135
+ requestHeaders: Se,
2136
+ apiBaseUrl: x,
2137
+ preloadPaths: ti,
2138
+ provisionWorkspace: Bt,
2139
+ onStatusChange: Ti
917
2140
  }
918
2141
  ),
919
- /* @__PURE__ */ f(
920
- _s,
2142
+ /* @__PURE__ */ i(
2143
+ oo,
921
2144
  {
922
- bridgeEndpoint: Qe,
923
- requestHeaders: X,
924
- navOpen: Bt,
925
- surfaceOpen: ee,
926
- surfaceReady: Sr,
927
- snapshot: Pr
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__ */ Re("div", { className: "flex h-full min-h-0 flex-col", children: [
931
- /* @__PURE__ */ f(
932
- Yr,
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 Os = 500;
1015
- function Ls(e) {
1016
- return new Promise((n, r) => {
2160
+ const vo = 500;
2161
+ function xo(e) {
2162
+ return new Promise((t, r) => {
1017
2163
  let s;
1018
- const i = () => {
1019
- s && globalThis.clearTimeout(s), e.removeEventListener("abort", o);
1020
- }, o = () => {
1021
- i(), r(new DOMException("Workspace boot aborted", "AbortError"));
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
- o();
2170
+ a();
1025
2171
  return;
1026
2172
  }
1027
2173
  s = globalThis.setTimeout(() => {
1028
- i(), n();
1029
- }, Os), e.addEventListener("abort", o, { once: !0 });
2174
+ o(), t();
2175
+ }, vo), e.addEventListener("abort", a, { once: !0 });
1030
2176
  });
1031
2177
  }
1032
- function Xs({
2178
+ function Go({
1033
2179
  workspaceId: e,
1034
- requestHeaders: n,
2180
+ requestHeaders: t,
1035
2181
  apiBaseUrl: r,
1036
- preloadPaths: s = xn,
1037
- provisionWorkspace: i = !0,
1038
- loadingFallback: o,
1039
- errorFallback: c,
1040
- children: d
2182
+ preloadPaths: s = Gr,
2183
+ provisionWorkspace: o = !0,
2184
+ loadingFallback: a,
2185
+ errorFallback: l,
2186
+ children: f
1041
2187
  }) {
1042
- const [b, P] = x({
2188
+ const [g, d] = L({
1043
2189
  status: "loading",
1044
2190
  label: "Waking workspace runtime"
1045
2191
  });
1046
- return E(() => {
1047
- const y = new AbortController(), B = Ye(e, n);
1048
- async function F(w) {
1049
- const S = await fetch(Cn(r, w), {
1050
- headers: B,
1051
- signal: y.signal
1052
- }), N = await ke(S);
1053
- if (!S.ok) {
1054
- if (bt(N)) return "preparing";
1055
- throw new Error(yt(N) ?? `${w} failed with ${S.status}`);
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 (Wn(w)) {
1058
- const D = ze(N);
1059
- if ((D == null ? void 0 : D.state) === "degraded") throw new Error(D.message ?? "Workspace failed to prepare");
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 Br(w) !== null && N && typeof N == "object" && Fn(r, B["x-boring-workspace-id"] ?? e, w, N), "ready";
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 k() {
1064
- P({ status: "loading", label: "Waking workspace runtime" });
2209
+ async function O() {
2210
+ d({ status: "loading", label: "Waking workspace runtime" });
1065
2211
  try {
1066
- const w = Mn(s, i);
1067
- let S = await Promise.all(w.map(async (h) => ({ path: h, status: await F(h) }))), N = S.filter((h) => h.status === "preparing").map((h) => h.path);
1068
- for (; N.length > 0; ) {
1069
- if (P({ status: "loading", label: "Workspace is still preparing" }), await Ls(y.signal), y.signal.aborted) return;
1070
- S = await Promise.all(N.map(async (h) => ({ path: h, status: await F(h) }))), N = S.filter((h) => h.status === "preparing").map((h) => h.path);
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
- y.signal.aborted || P({ status: "ready" });
1073
- } catch (w) {
1074
- if (y.signal.aborted) return;
1075
- P({
2218
+ m.signal.aborted || d({ status: "ready" });
2219
+ } catch (E) {
2220
+ if (m.signal.aborted) return;
2221
+ d({
1076
2222
  status: "error",
1077
- message: w instanceof Error ? w.message : "Unknown workspace boot error"
2223
+ message: E instanceof Error ? E.message : "Unknown workspace boot error"
1078
2224
  });
1079
2225
  }
1080
2226
  }
1081
- return k(), () => y.abort();
1082
- }, [r, s, i, n, e]), b.status === "ready" ? /* @__PURE__ */ f(fe, { children: d }) : b.status === "error" ? typeof c == "function" ? /* @__PURE__ */ f(fe, { children: c(b.message) }) : c ? /* @__PURE__ */ f(fe, { children: c }) : /* @__PURE__ */ f(
1083
- Tn,
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: b.message,
2232
+ description: g.message,
1087
2233
  status: "Retry by reloading the page"
1088
2234
  }
1089
- ) : typeof o == "function" ? /* @__PURE__ */ f(fe, { children: o(b.label) }) : o ? /* @__PURE__ */ f(fe, { children: o }) : /* @__PURE__ */ f(
1090
- Tn,
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: b.label
2240
+ status: g.label
1095
2241
  }
1096
2242
  );
1097
2243
  }
1098
- const xs = "FULL_PAGE_PANEL_MISSING_COMPONENT", Ms = "FULL_PAGE_PANEL_INVALID_PARAMS_JSON", Cs = "FULL_PAGE_PANEL_PARAMS_NOT_OBJECT", Ws = "FULL_PAGE_PANEL_UNKNOWN_COMPONENT", Fs = "FULL_PAGE_PANEL_NOT_SUPPORTED", Is = "FULL_PAGE_PANEL_RENDER_FAILED";
1099
- function M() {
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 Gs = { dispose: M }, A = () => Gs;
1102
- function $s(e) {
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: M,
1113
- setTitle: (n) => {
1114
- document.title = n;
2258
+ setActive: B,
2259
+ setTitle: (t) => {
2260
+ document.title = t;
1115
2261
  },
1116
- setSize: M,
2262
+ setSize: B,
1117
2263
  close: () => {
1118
2264
  window.close();
1119
2265
  },
1120
- moveTo: M,
1121
- maximize: M,
1122
- exitMaximized: M,
2266
+ moveTo: B,
2267
+ maximize: B,
2268
+ exitMaximized: B,
1123
2269
  isMaximized: () => !1,
1124
- minimize: M,
1125
- onDidActiveChange: A,
1126
- onDidVisibilityChange: A,
1127
- onDidDimensionsChange: A,
1128
- onDidFocusChange: A,
1129
- onDidLocationChange: A,
1130
- onDidParametersChange: A,
1131
- onDidTitleChange: A,
1132
- onDidRenamed: A,
1133
- onWillFocus: A
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 Us() {
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: M,
1149
- addGroup: M,
1150
- removePanel: M,
1151
- removeGroup: M,
2294
+ addPanel: B,
2295
+ addGroup: B,
2296
+ removePanel: B,
2297
+ removeGroup: B,
1152
2298
  getPanel: () => {
1153
2299
  },
1154
2300
  getGroup: () => {
1155
2301
  },
1156
- moveGroupOrPanel: M,
1157
- fromJSON: M,
2302
+ moveGroupOrPanel: B,
2303
+ fromJSON: B,
1158
2304
  toJSON: () => ({}),
1159
- clear: M,
1160
- focus: M,
1161
- layout: M,
1162
- onDidLayoutChange: A,
1163
- onDidLayoutFromJSON: A,
1164
- onDidAddPanel: A,
1165
- onDidRemovePanel: A,
1166
- onDidActivePanelChange: A,
1167
- onDidAddGroup: A,
1168
- onDidRemoveGroup: A,
1169
- onDidActiveGroupChange: A,
1170
- onUnhandledDragOverEvent: A,
1171
- onDidDrop: A,
1172
- onWillDrop: A,
1173
- onWillDragGroup: A,
1174
- onWillDragPanel: A,
1175
- onDidActivePanelChange_: A
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 vt({ code: e, title: n, description: r }) {
1179
- return /* @__PURE__ */ f(
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__ */ f(ts, { className: "w-full max-w-lg", title: n, description: r })
2331
+ children: /* @__PURE__ */ i(Ps, { className: "w-full max-w-lg", title: t, description: r })
1186
2332
  }
1187
2333
  );
1188
2334
  }
1189
- function Zs({ componentId: e, params: n = {} }) {
1190
- const r = In(), { errors: s } = Vr(), i = r.get(e), o = r.getComponents()[e];
1191
- Fr(() => {
1192
- document.title = (i == null ? void 0 : i.title) ?? e;
1193
- }, [e, i == null ? void 0 : i.title]);
1194
- const c = L(() => ({
1195
- params: n,
1196
- api: $s(e),
1197
- containerApi: Us(),
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, n]), d = L(() => {
1200
- if (!i) return null;
1201
- const b = i.pluginId ?? i.id;
1202
- for (let P = s.length - 1; P >= 0; P -= 1) {
1203
- const y = s[P];
1204
- if (y.contributionKind === "panel" && y.contributionId === e && y.pluginId === b)
1205
- return y;
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, i]);
1209
- return i ? !i.supportsFullPage || !o ? /* @__PURE__ */ f(
1210
- vt,
2354
+ }, [e, s, o]);
2355
+ return o ? !o.supportsFullPage || !a ? /* @__PURE__ */ i(
2356
+ un,
1211
2357
  {
1212
- code: Fs,
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
- ) : d ? /* @__PURE__ */ f(
1217
- vt,
2362
+ ) : f ? /* @__PURE__ */ i(
2363
+ un,
1218
2364
  {
1219
- code: Is,
2365
+ code: Eo,
1220
2366
  title: "Panel failed to render",
1221
- description: `Panel "${e}" crashed while rendering in full-page mode: ${d.error.message}`
2367
+ description: `Panel "${e}" crashed while rendering in full-page mode: ${f.error.message}`
1222
2368
  }
1223
- ) : /* @__PURE__ */ f("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ f(zr, { mode: "full-page", children: /* @__PURE__ */ f(o, { ...c }) }) }) : /* @__PURE__ */ f(
1224
- vt,
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: Ws,
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 ei(e) {
1233
- var o;
1234
- const n = new URLSearchParams(e), r = ((o = n.get("component")) == null ? void 0 : o.trim()) ?? "";
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: xs,
2386
+ code: yo,
1241
2387
  message: "Missing full-page panel component id."
1242
2388
  }
1243
2389
  };
1244
- const s = n.get("params");
2390
+ const s = t.get("params");
1245
2391
  if (!s)
1246
2392
  return { componentId: r, params: {} };
1247
- let i;
2393
+ let o;
1248
2394
  try {
1249
- i = JSON.parse(s);
2395
+ o = JSON.parse(s);
1250
2396
  } catch {
1251
2397
  return {
1252
2398
  componentId: null,
1253
2399
  params: {},
1254
2400
  error: {
1255
- code: Ms,
2401
+ code: So,
1256
2402
  message: "Invalid full-page panel params JSON."
1257
2403
  }
1258
2404
  };
1259
2405
  }
1260
- return i === null || Array.isArray(i) || typeof i != "object" ? {
2406
+ return o === null || Array.isArray(o) || typeof o != "object" ? {
1261
2407
  componentId: null,
1262
2408
  params: {},
1263
2409
  error: {
1264
- code: Cs,
2410
+ code: wo,
1265
2411
  message: "Full-page panel params must be a JSON object."
1266
2412
  }
1267
- } : { componentId: r, params: i };
2413
+ } : { componentId: r, params: o };
1268
2414
  }
1269
2415
  export {
1270
- Ms as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
1271
- xs as FULL_PAGE_PANEL_MISSING_COMPONENT,
1272
- Fs as FULL_PAGE_PANEL_NOT_SUPPORTED,
1273
- Cs as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
1274
- Is as FULL_PAGE_PANEL_RENDER_FAILED,
1275
- Ws as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
1276
- Qs as WorkspaceAgentFront,
1277
- ms as WorkspaceBackgroundBoot,
1278
- Xs as WorkspaceBootGate,
1279
- Zs as WorkspaceFullPagePanel,
1280
- os as createLocalStorageSessions,
1281
- ei as parseFullPagePanelLocation,
1282
- as as useLocalStorageSessions
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
  };