@hachej/boring-workspace 0.1.31 → 0.1.33

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,95 +1,113 @@
1
- import { jsx as c, jsxs as xe, Fragment as B } from "react/jsx-runtime";
2
- import { useSyncExternalStore as er, useEffect as w, useMemo as E, useState as W, useRef as T, useCallback as _, useLayoutEffect as tr } from "react";
3
- import { ChatPanel as rr, useSessions as nr } from "@hachej/boring-agent/front";
4
- import { as as sr, at as or, U as ct, p as ir, au as ar, u as mt, ag as lr, av as cr } from "./WorkspaceProvider-0V-2x7AH.js";
5
- import { T as ur, C as dr, r as ut, w as fr, W as dt } from "./WorkspaceLoadingState-DJF_4S4_.js";
6
- import { ErrorState as pr } from "@hachej/boring-ui-kit";
7
- function mr() {
1
+ import { jsx as c, jsxs as te, Fragment as K } from "react/jsx-runtime";
2
+ import { useEffect as v, useSyncExternalStore as Lr, useMemo as T, useState as _, useRef as k, useCallback as L, useLayoutEffect as Tr } from "react";
3
+ import { ChatPanel as xr, useSessions as Or } from "@hachej/boring-agent/front";
4
+ import { aj as Wr, as as Mr, at as kr, U as xt, q as Fr, au as Ur, u as Gt, ag as Gr, av as Cr } from "./WorkspaceProvider-CuIZx1ua.js";
5
+ import { T as $r, C as Ir, r as Ot, w as qr, W as Wt } from "./WorkspaceLoadingState-BlvZXmFg.js";
6
+ import { Sun as jr, Moon as Br } from "lucide-react";
7
+ import { IconButton as Kr, ErrorState as Jr } from "@hachej/boring-ui-kit";
8
+ function Hr() {
9
+ const { theme: e, toggleTheme: t } = Wr(), r = e === "dark";
10
+ return v(() => {
11
+ typeof document > "u" || document.documentElement.classList.toggle("dark", r);
12
+ }, [r]), /* @__PURE__ */ c(
13
+ Kr,
14
+ {
15
+ type: "button",
16
+ variant: "ghost",
17
+ size: "icon-sm",
18
+ onClick: t,
19
+ "aria-label": "Toggle theme",
20
+ title: r ? "Switch to light theme" : "Switch to dark theme",
21
+ children: r ? /* @__PURE__ */ c(jr, { className: "h-4 w-4" }) : /* @__PURE__ */ c(Br, { className: "h-4 w-4" })
22
+ }
23
+ );
24
+ }
25
+ function Vr() {
8
26
  const e = `s${Date.now()}`;
9
27
  return {
10
28
  sessions: [{ id: e, title: "New session", updatedAt: Date.now() }],
11
29
  activeId: e
12
30
  };
13
31
  }
14
- function gr(e, t) {
32
+ function zr(e, t) {
15
33
  var r;
16
34
  if (typeof localStorage > "u") return t();
17
35
  try {
18
36
  const n = localStorage.getItem(e);
19
37
  if (n) {
20
- const s = JSON.parse(n), o = Array.isArray(s.sessions) ? s.sessions : Array.isArray(s.items) ? s.items : null;
21
- if (o)
22
- return { sessions: o, activeId: s.activeId ?? ((r = o[0]) == null ? void 0 : r.id) ?? "" };
38
+ const i = JSON.parse(n), s = Array.isArray(i.sessions) ? i.sessions : Array.isArray(i.items) ? i.items : null;
39
+ if (s)
40
+ return { sessions: s, activeId: i.activeId ?? ((r = s[0]) == null ? void 0 : r.id) ?? "" };
23
41
  }
24
42
  } catch {
25
43
  }
26
44
  return t();
27
45
  }
28
- function br(e, t) {
46
+ function Yr(e, t) {
29
47
  if (!(typeof localStorage > "u"))
30
48
  try {
31
49
  localStorage.setItem(e, JSON.stringify(t));
32
50
  } catch {
33
51
  }
34
52
  }
35
- function hr(e = {}) {
36
- const t = e.storageKey ?? "workspace:sessions", r = e.initial ?? mr;
37
- let n = gr(t, r);
38
- const s = /* @__PURE__ */ new Set(), o = (i) => {
39
- n = i, br(t, n), s.forEach((l) => l());
53
+ function Qr(e = {}) {
54
+ const t = e.storageKey ?? "workspace:sessions", r = e.initial ?? Vr;
55
+ let n = zr(t, r);
56
+ const i = /* @__PURE__ */ new Set(), s = (a) => {
57
+ n = a, Yr(t, n), i.forEach((l) => l());
40
58
  };
41
59
  return {
42
60
  getState: () => n,
43
- subscribe(i) {
44
- return s.add(i), () => {
45
- s.delete(i);
61
+ subscribe(a) {
62
+ return i.add(a), () => {
63
+ i.delete(a);
46
64
  };
47
65
  },
48
- switchTo(i) {
49
- o({ ...n, activeId: i });
66
+ switchTo(a) {
67
+ s({ ...n, activeId: a });
50
68
  },
51
69
  create() {
52
- const i = `s${Date.now()}`, l = {
53
- id: i,
70
+ const a = `s${Date.now()}`, l = {
71
+ id: a,
54
72
  title: "New session",
55
73
  updatedAt: Date.now()
56
74
  };
57
- o({ sessions: [l, ...n.sessions], activeId: i });
75
+ s({ sessions: [l, ...n.sessions], activeId: a });
58
76
  },
59
- remove(i) {
60
- var b;
61
- const l = n.sessions.filter((u) => u.id !== i), g = n.activeId === i ? ((b = l[0]) == null ? void 0 : b.id) ?? "" : n.activeId;
62
- o({ sessions: l, activeId: g });
77
+ remove(a) {
78
+ var h;
79
+ const l = n.sessions.filter((f) => f.id !== a), p = n.activeId === a ? ((h = l[0]) == null ? void 0 : h.id) ?? "" : n.activeId;
80
+ s({ sessions: l, activeId: p });
63
81
  }
64
82
  };
65
83
  }
66
- function vr(e) {
67
- return er(e.subscribe, e.getState, e.getState);
84
+ function Xr(e) {
85
+ return Lr(e.subscribe, e.getState, e.getState);
68
86
  }
69
- const gt = ["/api/v1/tree?path=.", "/api/v1/agent/sessions"], yr = /* @__PURE__ */ new Set([
87
+ const Ct = ["/api/v1/tree?path=.", "/api/v1/agent/sessions"], Zr = /* @__PURE__ */ new Set([
70
88
  "WORKSPACE_NOT_READY",
71
89
  "AGENT_RUNTIME_NOT_READY",
72
90
  "RUNTIME_PROVISIONING_LOCKED"
73
91
  ]);
74
- function bt(e, t) {
92
+ function $t(e, t) {
75
93
  return /^https?:\/\//i.test(t) || !e ? t : `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
76
94
  }
77
- function le(e, t) {
95
+ function we(e, t) {
78
96
  const r = { ...t ?? {} };
79
97
  for (const n of Object.keys(r))
80
98
  n.toLowerCase() === "x-boring-workspace-id" && delete r[n];
81
99
  return r["x-boring-workspace-id"] = e, r;
82
100
  }
83
- function ht(e) {
101
+ function It(e) {
84
102
  const t = new URL(e, "http://workspace.local");
85
103
  return t.pathname !== "/api/v1/tree" ? null : t.searchParams.get("path") ?? ".";
86
104
  }
87
- function vt(e, t, r, n) {
88
- const s = ht(r);
89
- s === null || !n || !Array.isArray(n.entries) || sr(e, t, s, n.entries);
105
+ function qt(e, t, r, n) {
106
+ const i = It(r);
107
+ i === null || !n || !Array.isArray(n.entries) || Mr(e, t, i, n.entries);
90
108
  }
91
- const Pr = /* @__PURE__ */ new Set(["workspace-fs", "sandbox-exec", "ui-bridge"]);
92
- function wr(e) {
109
+ const en = /* @__PURE__ */ new Set(["workspace-fs", "sandbox-exec", "ui-bridge"]);
110
+ function tn(e) {
93
111
  const t = e;
94
112
  if (!t || typeof t != "object") return null;
95
113
  const r = t.error ?? t, n = r.details ?? t.details ?? r;
@@ -99,24 +117,24 @@ function wr(e) {
99
117
  requirement: n.requirement ?? r.requirement
100
118
  };
101
119
  }
102
- function yt(e) {
103
- const t = wr(e);
104
- if (typeof (t == null ? void 0 : t.code) != "string" || !yr.has(t.code) || t.retryable !== !0) return null;
105
- const r = typeof t.requirement == "string" && Pr.has(t.requirement) ? t.requirement : void 0;
120
+ function Ke(e) {
121
+ const t = tn(e);
122
+ if (typeof (t == null ? void 0 : t.code) != "string" || !Zr.has(t.code) || t.retryable !== !0) return null;
123
+ const r = typeof t.requirement == "string" && en.has(t.requirement) ? t.requirement : void 0;
106
124
  return r ? { requirement: r } : {};
107
125
  }
108
- function Sr(e) {
126
+ function rn(e) {
109
127
  const t = new URL(e, "http://workspace.local");
110
128
  return t.pathname === "/api/v1/agent/sessions" || t.pathname === "/api/v1/ready-status";
111
129
  }
112
- function Pt(e) {
130
+ function jt(e) {
113
131
  return new URL(e, "http://workspace.local").pathname === "/api/v1/ready-status";
114
132
  }
115
- function wt(e, t) {
116
- const r = t ? [...e, "/api/v1/ready-status"] : e.filter((n) => !Sr(n));
133
+ function Bt(e, t) {
134
+ const r = t ? [...e, "/api/v1/ready-status"] : e.filter((n) => !rn(n));
117
135
  return Array.from(new Set(r));
118
136
  }
119
- function St(e) {
137
+ function Je(e) {
120
138
  if (typeof e == "string") return e || null;
121
139
  if (!e || typeof e != "object") return null;
122
140
  const t = e;
@@ -124,27 +142,41 @@ function St(e) {
124
142
  const r = t.error;
125
143
  return typeof (r == null ? void 0 : r.message) == "string" && r.message ? r.message : null;
126
144
  }
127
- function Et(e) {
145
+ function Mt(e) {
146
+ var r, n, i, s, a, l, p, h, f, A;
147
+ if (!e || typeof e != "object") return null;
148
+ const t = e;
149
+ return {
150
+ state: typeof t.state == "string" ? t.state : void 0,
151
+ message: typeof t.message == "string" ? t.message : void 0,
152
+ chatState: typeof ((n = (r = t.capabilities) == null ? void 0 : r.chat) == null ? void 0 : n.state) == "string" ? t.capabilities.chat.state : void 0,
153
+ workspaceState: typeof ((s = (i = t.capabilities) == null ? void 0 : i.workspace) == null ? void 0 : s.state) == "string" ? t.capabilities.workspace.state : void 0,
154
+ runtimeDependenciesState: typeof ((l = (a = t.capabilities) == null ? void 0 : a.runtimeDependencies) == null ? void 0 : l.state) == "string" ? t.capabilities.runtimeDependencies.state : void 0,
155
+ runtimeDependenciesMessage: typeof ((h = (p = t.capabilities) == null ? void 0 : p.runtimeDependencies) == null ? void 0 : h.message) == "string" ? t.capabilities.runtimeDependencies.message : void 0,
156
+ runtimeDependenciesRequirement: typeof ((A = (f = t.capabilities) == null ? void 0 : f.runtimeDependencies) == null ? void 0 : A.requirement) == "string" ? t.capabilities.runtimeDependencies.requirement : void 0
157
+ };
158
+ }
159
+ function Pe(e) {
160
+ if (e && typeof e == "object") return Mt(e);
128
161
  if (typeof e != "string" || !e.trim()) return null;
129
162
  const t = e.split(/\n\n+/);
130
163
  for (let r = t.length - 1; r >= 0; r -= 1) {
131
164
  const n = t[r].split(`
132
- `).filter((s) => s.startsWith("data:")).map((s) => s.slice(5).trim());
165
+ `).filter((i) => i.startsWith("data:")).map((i) => i.slice(5).trim());
133
166
  if (n.length !== 0)
134
167
  try {
135
- const s = JSON.parse(n.join(`
136
- `));
137
- return {
138
- state: typeof s.state == "string" ? s.state : void 0,
139
- message: typeof s.message == "string" ? s.message : void 0
140
- };
168
+ return Mt(JSON.parse(n.join(`
169
+ `)));
141
170
  } catch {
142
171
  return null;
143
172
  }
144
173
  }
145
174
  return null;
146
175
  }
147
- async function At(e) {
176
+ function nn(e) {
177
+ return e ? e.chatState || e.workspaceState ? e.chatState === "ready" && e.workspaceState === "ready" : e.state === "ready" : !0;
178
+ }
179
+ async function Ee(e) {
148
180
  const t = await e.text().catch(() => "");
149
181
  if (!t) return null;
150
182
  try {
@@ -153,456 +185,569 @@ async function At(e) {
153
185
  return t;
154
186
  }
155
187
  }
156
- const Er = 500;
157
- function Ar(e) {
188
+ const sn = 500;
189
+ function kt(e) {
158
190
  return new Promise((t, r) => {
159
191
  let n;
160
- const s = () => {
161
- n && globalThis.clearTimeout(n), e.removeEventListener("abort", o);
162
- }, o = () => {
163
- s(), r(new DOMException("Warmup aborted", "AbortError"));
192
+ const i = () => {
193
+ n && globalThis.clearTimeout(n), e.removeEventListener("abort", s);
194
+ }, s = () => {
195
+ i(), r(new DOMException("Warmup aborted", "AbortError"));
164
196
  };
165
197
  if (e.aborted) {
166
- o();
198
+ s();
167
199
  return;
168
200
  }
169
201
  n = globalThis.setTimeout(() => {
170
- s(), t();
171
- }, Er), e.addEventListener("abort", o, { once: !0 });
202
+ i(), t();
203
+ }, sn), e.addEventListener("abort", s, { once: !0 });
172
204
  });
173
205
  }
174
- async function _r({
206
+ async function on(e) {
207
+ const t = e.body;
208
+ if (!t) return Pe(await Ee(e));
209
+ const r = t.getReader(), n = new TextDecoder();
210
+ let i = "";
211
+ try {
212
+ for (; ; ) {
213
+ const { done: s, value: a } = await r.read();
214
+ if (a) {
215
+ i += n.decode(a, { stream: !s });
216
+ const l = Pe(i);
217
+ if (l) return l;
218
+ }
219
+ if (s)
220
+ return i += n.decode(), Pe(i);
221
+ }
222
+ } finally {
223
+ await r.cancel().catch(() => {
224
+ });
225
+ }
226
+ }
227
+ function an(e) {
228
+ if (!((e == null ? void 0 : e.runtimeDependenciesState) !== "preparing" && (e == null ? void 0 : e.runtimeDependenciesState) !== "ready" && (e == null ? void 0 : e.runtimeDependenciesState) !== "failed"))
229
+ return {
230
+ state: e.runtimeDependenciesState,
231
+ ...e.runtimeDependenciesMessage ? { message: e.runtimeDependenciesMessage } : {},
232
+ ...e.runtimeDependenciesRequirement ? { requirement: e.runtimeDependenciesRequirement } : {}
233
+ };
234
+ }
235
+ async function ln(e) {
236
+ if (!e.ok) {
237
+ const i = await Ee(e);
238
+ if (Ke(i)) return { status: "preparing" };
239
+ throw new Error(Je(i) ?? `/api/v1/ready-status failed with ${e.status}`);
240
+ }
241
+ const t = await on(e), r = an(t), n = nn(t);
242
+ if ((t == null ? void 0 : t.state) === "degraded" || (t == null ? void 0 : t.state) === "failed") {
243
+ if (n && (r == null ? void 0 : r.state) === "failed")
244
+ return { status: "ready", runtimeDependencies: r };
245
+ throw new Error(t.message ?? "Workspace failed to prepare");
246
+ }
247
+ return n ? { status: "ready", ...r ? { runtimeDependencies: r } : {} } : { status: "preparing", ...r ? { runtimeDependencies: r } : {} };
248
+ }
249
+ async function cn({
175
250
  apiBaseUrl: e,
176
251
  path: t,
177
252
  headers: r,
178
253
  signal: n,
179
- workspaceId: s
254
+ workspaceId: i
180
255
  }) {
181
- const o = await fetch(bt(e, t), { headers: r, signal: n }), i = await At(o);
182
- if (!o.ok) {
183
- const l = yt(i);
256
+ const s = await fetch($t(e, t), { headers: r, signal: n });
257
+ if (jt(t)) return ln(s);
258
+ const a = await Ee(s);
259
+ if (!s.ok) {
260
+ const l = Ke(a);
184
261
  if (l) return { status: "preparing", ...l };
185
- throw new Error(St(i) ?? `${t} failed with ${o.status}`);
186
- }
187
- if (Pt(t)) {
188
- const l = Et(i);
189
- if ((l == null ? void 0 : l.state) === "degraded") throw new Error(l.message ?? "Workspace failed to prepare");
262
+ throw new Error(Je(a) ?? `${t} failed with ${s.status}`);
190
263
  }
191
- return i && typeof i == "object" && vt(e, r["x-boring-workspace-id"] ?? s, t, i), { status: "ready" };
264
+ return a && typeof a == "object" && qt(e, r["x-boring-workspace-id"] ?? i, t, a), { status: "ready" };
192
265
  }
193
- function Nr({
266
+ function un({
194
267
  workspaceId: e,
195
268
  requestHeaders: t,
196
269
  apiBaseUrl: r,
197
- preloadPaths: n = gt,
198
- provisionWorkspace: s = !0,
199
- onStatusChange: o
270
+ preloadPaths: n = Ct,
271
+ provisionWorkspace: i = !0,
272
+ onStatusChange: s
200
273
  }) {
201
- return w(() => {
202
- let i = !1;
203
- const l = new AbortController(), g = le(e, t);
204
- async function b() {
205
- o == null || o({ status: "preparing" });
274
+ return v(() => {
275
+ let a = !1;
276
+ const l = new AbortController(), p = we(e, t);
277
+ async function h() {
278
+ var f, A;
279
+ s == null || s({ status: "preparing" });
206
280
  try {
207
- const u = wt(n, s), N = (d) => _r({
281
+ const w = Bt(n, i), C = (d) => cn({
208
282
  apiBaseUrl: r,
209
283
  path: d,
210
- headers: g,
284
+ headers: p,
211
285
  signal: l.signal,
212
286
  workspaceId: e
213
287
  });
214
- let S = await Promise.all(u.map(async (d) => ({ path: d, result: await N(d) })));
215
- if (i || l.signal.aborted) return;
216
- let D = S.filter((d) => d.result.status === "preparing");
217
- for (; D.length > 0; ) {
288
+ let b = await Promise.all(w.map(async (d) => ({ path: d, result: await C(d) })));
289
+ if (a || l.signal.aborted) return;
290
+ let g = (f = b.find((d) => d.result.runtimeDependencies)) == null ? void 0 : f.result.runtimeDependencies, y = b.filter((d) => d.result.status === "preparing");
291
+ for (; y.length > 0; ) {
218
292
  let d;
219
- for (const m of D)
220
- if (m.result.status === "preparing" && m.result.requirement) {
221
- d = m.result.requirement;
293
+ for (const S of y)
294
+ if (S.result.status === "preparing" && S.result.requirement) {
295
+ d = S.result.requirement;
222
296
  break;
223
297
  }
224
- if (o == null || o({ status: "preparing", message: "Workspace is still preparing", ...d ? { requirement: d } : {} }), await Ar(l.signal), i || l.signal.aborted || (S = await Promise.all(D.map(async (m) => ({ path: m.path, result: await N(m.path) }))), i || l.signal.aborted)) return;
225
- D = S.filter((m) => m.result.status === "preparing");
298
+ if (s == null || s({ status: "preparing", message: "Workspace is still preparing", ...d ? { requirement: d } : {} }), await kt(l.signal), a || l.signal.aborted || (b = await Promise.all(y.map(async (S) => ({ path: S.path, result: await C(S.path) }))), a || l.signal.aborted)) return;
299
+ g = ((A = b.find((S) => S.result.runtimeDependencies)) == null ? void 0 : A.result.runtimeDependencies) ?? g, y = b.filter((S) => S.result.status === "preparing");
226
300
  }
227
- o == null || o({ status: "ready" });
228
- } catch (u) {
229
- if (i || l.signal.aborted) return;
230
- o == null || o({
301
+ for (s == null || s({ status: "ready", ...g ? { runtimeDependencies: g } : {} }); (g == null ? void 0 : g.state) === "preparing"; ) {
302
+ if (await kt(l.signal), a || l.signal.aborted) return;
303
+ const d = await C("/api/v1/ready-status");
304
+ if (a || l.signal.aborted) return;
305
+ g = d.runtimeDependencies, g && (s == null || s({ status: "ready", runtimeDependencies: g }));
306
+ }
307
+ } catch (w) {
308
+ if (a || l.signal.aborted) return;
309
+ s == null || s({
231
310
  status: "failed",
232
- message: u instanceof Error ? u.message : "Workspace failed to prepare"
311
+ message: w instanceof Error ? w.message : "Workspace failed to prepare"
233
312
  });
234
313
  }
235
314
  }
236
- return b(), () => {
237
- i = !0, l.abort();
315
+ return h(), () => {
316
+ a = !0, l.abort();
238
317
  };
239
- }, [r, o, n, s, t, e]), null;
318
+ }, [r, s, n, i, t, e]), null;
319
+ }
320
+ function dn(e, t) {
321
+ return !!(e && e.title === t && e.turnCount === 0);
240
322
  }
241
- function Rr(e, t) {
323
+ function fn(e, t) {
242
324
  return e.endsWith(":surface") ? e.slice(0, -8) : t;
243
325
  }
244
- function De(e, t, r) {
245
- const [n, s] = W(() => ut(e, t, r));
246
- w(() => {
247
- s(ut(e, t, r));
326
+ function qe(e, t, r) {
327
+ const [n, i] = _(() => Ot(e, t, r));
328
+ v(() => {
329
+ i(Ot(e, t, r));
248
330
  }, [e, t, r]);
249
- const o = _(
250
- (i) => {
251
- s(i), fr(e, i, r);
331
+ const s = L(
332
+ (a) => {
333
+ i(a), qr(e, a, r);
252
334
  },
253
335
  [r, e]
254
336
  );
255
- return [n, o];
337
+ return [n, s];
256
338
  }
257
- const Oe = {}, ft = { status: "preparing" }, pt = {
339
+ const je = {}, Ft = { status: "preparing" }, Ut = {
258
340
  openTabs: [],
259
341
  activeTab: null
260
342
  };
261
- function Lr({ status: e }) {
262
- const t = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", n = r ? t === "workspace-fs" ? "Preparing files…" : t === "sandbox-exec" ? "Waking sandbox…" : t === "ui-bridge" ? "Connecting workspace UI…" : "Preparing workspace…" : "Workspace workbench failed", s = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
263
- return /* @__PURE__ */ c("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ xe("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
343
+ function mn({ status: e }) {
344
+ const t = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", n = r ? t === "workspace-fs" ? "Preparing files…" : t === "sandbox-exec" ? "Waking sandbox…" : t === "ui-bridge" ? "Connecting workspace UI…" : "Preparing workspace…" : "Workspace workbench failed", i = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
345
+ return /* @__PURE__ */ c("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ te("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
264
346
  r ? /* @__PURE__ */ c("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,
265
347
  /* @__PURE__ */ c("div", { className: "text-sm font-semibold text-foreground", children: n }),
266
- /* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children: s }),
348
+ /* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children: i }),
267
349
  e.status === "failed" ? /* @__PURE__ */ c("p", { className: "mt-3 text-xs text-muted-foreground", children: "Reload the workspace to retry." }) : null
268
350
  ] }) });
269
351
  }
270
- function Dr(e) {
352
+ function pn(e) {
353
+ var t;
354
+ try {
355
+ return ((t = globalThis.localStorage) == null ? void 0 : t.getItem(e)) ?? null;
356
+ } catch {
357
+ return null;
358
+ }
359
+ }
360
+ function gn() {
361
+ return /* @__PURE__ */ c("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ te("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
362
+ /* @__PURE__ */ c("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" }),
363
+ /* @__PURE__ */ c("div", { className: "text-sm font-semibold text-foreground", children: "Loading sessions…" }),
364
+ /* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children: "Finding this workspace’s saved chats." })
365
+ ] }) });
366
+ }
367
+ function hn(e) {
271
368
  if (!e) return "/api/v1/ui";
272
369
  const t = e.replace(/\/$/, ""), r = "/api/v1/ui";
273
370
  return t.endsWith(r) ? t : `${t}${r}`;
274
371
  }
275
- function Or(e) {
276
- return `${Dr(e)}/state`;
372
+ function bn(e) {
373
+ return `${hn(e)}/state`;
277
374
  }
278
- function Tr(e) {
375
+ function yn(e) {
279
376
  var n;
280
- const t = e.openTabs.find((s) => s.id === e.activeTab), r = (n = t == null ? void 0 : t.params) == null ? void 0 : n.path;
377
+ const t = e.openTabs.find((i) => i.id === e.activeTab), r = (n = t == null ? void 0 : t.params) == null ? void 0 : n.path;
281
378
  return typeof r == "string" ? r : null;
282
379
  }
283
- function xr({
380
+ function Sn({
284
381
  bridgeEndpoint: e,
285
382
  requestHeaders: t,
286
383
  navOpen: r,
287
384
  surfaceOpen: n,
288
- surfaceReady: s,
289
- snapshot: o
385
+ surfaceReady: i,
386
+ snapshot: s
290
387
  }) {
291
- const i = mt(), l = T(null);
292
- return w(() => {
293
- var u;
294
- if (e === null || n && !s) return;
295
- (u = l.current) == null || u.abort();
296
- const g = new AbortController();
297
- l.current = g;
298
- const b = {
388
+ const a = Gt(), l = k(null);
389
+ return v(() => {
390
+ var f;
391
+ if (e === null || n && !i) return;
392
+ (f = l.current) == null || f.abort();
393
+ const p = new AbortController();
394
+ l.current = p;
395
+ const h = {
299
396
  v: 1,
300
397
  drawerOpen: r,
301
398
  workbenchOpen: n,
302
- openTabs: o.openTabs,
303
- activeTab: o.activeTab,
304
- activeFile: Tr(o),
305
- availablePanels: i.list().map((N) => N.id)
399
+ openTabs: s.openTabs,
400
+ activeTab: s.activeTab,
401
+ activeFile: yn(s),
402
+ availablePanels: a.list().map((A) => A.id)
306
403
  };
307
- return fetch(Or(e), {
404
+ return fetch(bn(e), {
308
405
  method: "PUT",
309
406
  headers: { ...t, "Content-Type": "application/json" },
310
- body: JSON.stringify({ state: b, causedBy: "user" }),
311
- signal: g.signal
407
+ body: JSON.stringify({ state: h, causedBy: "user" }),
408
+ signal: p.signal
312
409
  }).catch(() => {
313
410
  }), () => {
314
- g.abort();
411
+ p.abort();
315
412
  };
316
- }, [e, r, i, t, o, n, s]), null;
413
+ }, [e, r, a, t, s, n, i]), null;
317
414
  }
318
- function Xr({
415
+ function In({
319
416
  workspaceId: e,
320
417
  chatPanel: t,
321
418
  useSessions: r,
322
419
  requestHeaders: n,
323
- sessionStorageKey: s,
324
- providerStorageKey: o,
325
- surfaceStorageKey: i,
420
+ sessionStorageKey: i,
421
+ providerStorageKey: s,
422
+ surfaceStorageKey: a,
326
423
  beforeShell: l,
327
- afterShell: g,
328
- panels: b,
329
- commands: u,
330
- catalogs: N,
331
- plugins: S,
332
- excludeDefaults: D,
333
- capabilities: d,
334
- apiBaseUrl: m,
424
+ afterShell: p,
425
+ panels: h,
426
+ commands: f,
427
+ catalogs: A,
428
+ plugins: w,
429
+ excludeDefaults: C,
430
+ capabilities: b,
431
+ apiBaseUrl: g,
335
432
  authHeaders: y,
336
- apiTimeout: h,
337
- defaultTheme: U,
338
- onThemeChange: _t,
339
- persistenceEnabled: ke,
340
- bridgeEndpoint: ce,
341
- fullPageBasePath: Nt,
342
- onAuthError: Rt,
343
- sessions: We,
344
- activeSessionId: Ue,
345
- onSwitchSession: Fe,
346
- onCreateSession: Ge,
347
- onDeleteSession: Me,
348
- onActiveSessionIdChange: H,
349
- appTitle: Lt = "Boring",
350
- defaultSessionTitle: M = "New session",
351
- navEnabled: $e = !0,
352
- defaultNavOpen: Dt = !1,
353
- defaultSurfaceOpen: Ot,
354
- defaultWorkbenchLeftTab: V,
355
- surfaceInitialPanels: Ie,
356
- topBarLeft: Tt,
357
- topBarRight: xt,
358
- chatParams: O,
359
- hotReloadEnabled: ue,
360
- frontPluginHotReload: kt,
361
- extraPanels: Ce,
362
- extraCommands: Ke,
363
- provisionWorkspace: de,
364
- bootPreloadPaths: Wt,
365
- onWorkspaceWarmupStatusChange: Y,
366
- onOpenNav: fe,
367
- onOpenSurface: pe,
368
- surfaceButtonBottomOffset: Ut,
369
- className: Ft
433
+ apiTimeout: d,
434
+ defaultTheme: S,
435
+ onThemeChange: Kt,
436
+ persistenceEnabled: He,
437
+ bridgeEndpoint: Ae,
438
+ fullPageBasePath: Jt,
439
+ onAuthError: Ht,
440
+ sessions: Ve,
441
+ activeSessionId: ze,
442
+ onSwitchSession: Ye,
443
+ onCreateSession: Qe,
444
+ onDeleteSession: Xe,
445
+ onActiveSessionIdChange: re,
446
+ appTitle: Vt = "Boring",
447
+ defaultSessionTitle: q = "New session",
448
+ navEnabled: Ze = !0,
449
+ defaultNavOpen: zt = !1,
450
+ defaultSurfaceOpen: Yt,
451
+ defaultWorkbenchLeftTab: ne,
452
+ surfaceInitialPanels: et,
453
+ topBarLeft: Qt,
454
+ topBarRight: Xt,
455
+ showThemeToggle: Zt = !0,
456
+ chatParams: F,
457
+ hotReloadEnabled: De,
458
+ frontPluginHotReload: er,
459
+ extraPanels: tt,
460
+ extraCommands: rt,
461
+ provisionWorkspace: Ne,
462
+ bootPreloadPaths: tr,
463
+ onWorkspaceWarmupStatusChange: ie,
464
+ onOpenNav: Re,
465
+ onOpenSurface: _e,
466
+ surfaceButtonBottomOffset: rr,
467
+ className: nr
370
468
  }) {
371
- var at, lt;
372
- const me = o ?? `boring-ui-v2:layout:${e}`, P = i ?? `${me}:surface`, z = Rr(
373
- P,
374
- me
375
- ), Q = ke !== !1, ge = s ?? `boring-workspace:sessions:${e}`, $ = E(
376
- () => le(e, n ?? Oe),
469
+ var _t, Lt;
470
+ const Le = s ?? `boring-ui-v2:layout:${e}`, E = a ?? `${Le}:surface`, se = fn(
471
+ E,
472
+ Le
473
+ ), oe = He !== !1, ae = i ?? `boring-workspace:sessions:${e}`, J = T(
474
+ () => we(e, n ?? je),
377
475
  [n, e]
378
- ), Gt = E(
379
- () => le(e, { ...n ?? Oe, ...y ?? Oe }),
476
+ ), ir = T(
477
+ () => we(e, { ...n ?? je, ...y ?? je }),
380
478
  [y, n, e]
381
- ), X = E(
382
- () => hr({ storageKey: ge }),
383
- [ge]
384
- ), je = vr(X), [Je, Mt] = W(() => ({
479
+ ), le = T(
480
+ () => Qr({ storageKey: ae }),
481
+ [ae]
482
+ ), nt = Xr(le), [it, sr] = _(() => ({
483
+ workspaceId: e,
484
+ status: Ft
485
+ })), [ce, Te] = _(() => ({
486
+ workspaceId: e,
487
+ expired: !1
488
+ })), [st, ue] = _(() => ({
385
489
  workspaceId: e,
386
- status: ft
387
- })), I = Je.workspaceId === e ? Je.status : ft, $t = t ?? rr, It = r ?? nr, C = !t || !!r, be = C && de !== !1, he = () => {
388
- }, ve = It({
389
- requestHeaders: $,
390
- storageKey: ge,
391
- enabled: be,
392
- refreshKey: I.status === "ready" ? "workspace-ready" : void 0
393
- }), ye = be && !ve.loading && !ve.error, K = be && !ye, p = C && ye ? ve : void 0, Pe = We !== void 0 || Ue !== void 0 || Fe !== void 0 || Ge !== void 0 || Me !== void 0, Ct = p == null ? void 0 : p.sessions.map((a) => ({
394
- ...a,
395
- title: a.title ?? "New session"
396
- })), we = p ? Ct ?? [] : K ? [] : Pe ? We ?? [] : je.sessions, Se = p ? p.activeSessionId ?? null : K ? null : Pe ? Ue ?? null : je.activeId, F = (O == null ? void 0 : O.autoSubmitInitialDraft) === !0, Z = F && C && !Pe, [R, j] = W(() => Z ? null : void 0), qe = T(e), G = T(!1);
397
- w(() => {
398
- if (qe.current !== e) {
399
- qe.current = e, G.current = !1, j(Z ? null : void 0);
490
+ creating: !1
491
+ })), [ot, de] = _(() => ({
492
+ workspaceId: e,
493
+ failed: !1
494
+ })), [xe, at] = _(null), fe = it.workspaceId === e ? it.status : Ft, or = t ?? xr, ar = r ?? Or, H = !t || !!r, Oe = H && Ne !== !1, We = () => {
495
+ }, D = ar({
496
+ requestHeaders: J,
497
+ storageKey: ae,
498
+ enabled: Oe
499
+ }), U = Oe && !D.loading && !D.error, x = Oe && !U, [me, lr] = _(() => ({ workspaceId: e, sessions: [], activeSessionId: null }));
500
+ v(() => {
501
+ U && lr((o) => {
502
+ const R = o.workspaceId === e, M = o.activeSessionId === D.activeSessionId, ee = o.sessions.length === D.sessions.length && o.sessions.every((Rr, _r) => {
503
+ var Tt;
504
+ return Rr.id === ((Tt = D.sessions[_r]) == null ? void 0 : Tt.id);
505
+ });
506
+ return R && M && ee ? o : {
507
+ workspaceId: e,
508
+ sessions: D.sessions,
509
+ activeSessionId: D.activeSessionId
510
+ };
511
+ });
512
+ }, [D.activeSessionId, D.sessions, U, e]);
513
+ const Me = x && me.workspaceId === e && me.sessions.length > 0, ke = x ? pn(ae) : null, G = U ? D.sessions : Me ? me.sessions : [], cr = U ? D.activeSessionId : Me ? me.activeSessionId : null, u = H && (U || Me) ? D : void 0, V = Ve !== void 0 || ze !== void 0 || Ye !== void 0 || Qe !== void 0 || Xe !== void 0, lt = ce.workspaceId === e && ce.expired, z = k(!1), Y = !!(U && u && !V && G.length === 0 && !lt), ur = st.workspaceId === e && st.creating, dr = ot.workspaceId === e && ot.failed, fr = !!(U && u && !V && G.length === 0 && lt && !z.current && !dr), ct = Y || ur || fr;
514
+ v(() => {
515
+ if (!Y) {
516
+ ce.workspaceId !== e && Te({ workspaceId: e, expired: !1 });
517
+ return;
518
+ }
519
+ Te({ workspaceId: e, expired: !1 });
520
+ const o = globalThis.setTimeout(() => {
521
+ Te({ workspaceId: e, expired: !0 });
522
+ }, 2e3);
523
+ return () => globalThis.clearTimeout(o);
524
+ }, [ce.workspaceId, Y, e]);
525
+ const mr = u ? G.map((o) => ({
526
+ ...o,
527
+ title: o.title ?? "New session"
528
+ })) : void 0, pr = ke ? [{
529
+ id: ke,
530
+ title: "Loading sessions…",
531
+ createdAt: (/* @__PURE__ */ new Date(0)).toISOString(),
532
+ updatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
533
+ turnCount: 0
534
+ }] : [], Fe = u ? mr ?? [] : x ? pr : V ? Ve ?? [] : nt.sessions, ut = u ? cr ?? null : x ? ke : V ? ze ?? null : nt.activeId, j = (F == null ? void 0 : F.autoSubmitInitialDraft) === !0, pe = j && H && !V, [O, Q] = _(() => pe ? null : void 0), dt = k(e), B = k(!1);
535
+ v(() => {
536
+ if (dt.current !== e) {
537
+ dt.current = e, B.current = !1, Q(pe ? null : void 0);
400
538
  return;
401
539
  }
402
- Z && R === void 0 && (G.current = !1, j(null));
403
- }, [R, Z, e]), w(() => {
404
- !p || R !== null || G.current || (G.current = !0, Promise.resolve(p.create({ title: M })).then((a) => {
405
- if (typeof (a == null ? void 0 : a.id) != "string")
540
+ pe && O === void 0 && (B.current = !1, Q(null));
541
+ }, [O, pe, e]), v(() => {
542
+ !u || O !== null || B.current || (B.current = !0, Promise.resolve(u.create({ title: q })).then((o) => {
543
+ if (typeof (o == null ? void 0 : o.id) != "string")
406
544
  throw new Error("auto_submit_session_create_failed");
407
- j(a.id);
545
+ Q(o.id);
408
546
  }).catch(() => {
409
- G.current = !1, j(void 0);
547
+ B.current = !1, Q(void 0);
410
548
  }));
411
- }, [R, M, p]);
412
- const A = R !== void 0 ? R ?? null : Se, Be = K ? he : (p == null ? void 0 : p.switch) ?? Fe ?? X.switchTo, Kt = _((a) => (A && a !== A && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: A } })), Be(a)), [A, Be]), He = K ? he : p ? () => p.create() : Ge ?? X.create, jt = K ? he : (p == null ? void 0 : p.delete) ?? Me ?? X.remove, Jt = ((at = we.find((a) => a.id === A)) == null ? void 0 : at.title) ?? void 0, [qt, Ve] = De(
413
- `${z}:drawer`,
414
- Dt,
415
- Q
416
- ), Ye = $e && qt, [x, L] = De(
549
+ }, [O, q, u]);
550
+ const N = O !== void 0 ? O ?? null : ut, ft = x ? We : (u == null ? void 0 : u.switch) ?? Ye ?? le.switchTo, gr = L((o) => (N && o !== N && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: N } })), ft(o)), [N, ft]), mt = x ? We : u ? () => {
551
+ const o = G.find((M) => M.id === N && dn(M, q)), R = u.create();
552
+ return o && Promise.resolve(R).then(() => u.delete(o.id)).catch(() => {
553
+ }), R;
554
+ } : Qe ?? le.create, pt = x ? We : (u == null ? void 0 : u.delete) ?? Xe ?? le.remove, hr = L((o) => (u && G.length <= 1 && (z.current = !0), pt(o)), [G.length, pt, u]), br = ((_t = Fe.find((o) => o.id === N)) == null ? void 0 : _t.title) ?? void 0, [yr, gt] = qe(
555
+ `${se}:drawer`,
556
+ zt,
557
+ oe
558
+ ), ht = Ze && yr, [$, W] = qe(
417
559
  // Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
418
560
  // layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
419
561
  // key corrupts the JSON and drops the persisted workbench layout on reload.
420
- `${z}:workbenchOpen`,
421
- Ot ?? !1,
422
- Q
423
- ), [Bt, Ee] = W(!1), [Ht, J] = De(
424
- `${z}:workbenchLeftOpen`,
562
+ `${se}:workbenchOpen`,
563
+ Yt ?? !1,
564
+ oe
565
+ ), [Sr, Ue] = _(!1), [vr, X] = qe(
566
+ `${se}:workbenchLeftOpen`,
425
567
  !0,
426
- Q
427
- ), q = T(!1), k = T(x), ze = T(P), Ae = T(null);
428
- ze.current = P;
429
- const [Qe, Xe] = W(() => ({
430
- key: P,
431
- snapshot: pt
432
- })), Vt = Qe.key === P ? Qe.snapshot : pt;
433
- w(() => {
434
- q.current = !1;
435
- }, [e]), w(() => {
436
- Ee(!1);
437
- }, [P]), w(() => {
438
- if (!(!p || p.loading) && R === void 0) {
439
- if (p.sessions.length > 0) {
440
- q.current = !1;
568
+ oe
569
+ ), Z = k(!1), I = k($), bt = k(E), Ge = k(null);
570
+ bt.current = E;
571
+ const [yt, St] = _(() => ({
572
+ key: E,
573
+ snapshot: Ut
574
+ })), Pr = yt.key === E ? yt.snapshot : Ut;
575
+ v(() => {
576
+ Z.current = !1, z.current = !1, ue({ workspaceId: e, creating: !1 }), de({ workspaceId: e, failed: !1 }), at(null);
577
+ }, [e]), v(() => {
578
+ Ue(!1);
579
+ }, [E]), v(() => {
580
+ if (!(!u || u.loading) && !Y && O === void 0) {
581
+ if (G.length > 0) {
582
+ Z.current = !1, z.current = !1, ue((o) => o.workspaceId === e && o.creating ? { workspaceId: e, creating: !1 } : o), de((o) => o.workspaceId === e && o.failed ? { workspaceId: e, failed: !1 } : o);
441
583
  return;
442
584
  }
443
- q.current || (q.current = !0, Promise.resolve(p.create({ title: M })).catch(() => {
444
- q.current = !1;
585
+ z.current || Z.current || (Z.current = !0, ue({ workspaceId: e, creating: !0 }), de({ workspaceId: e, failed: !1 }), Promise.resolve(u.create({ title: q })).then((o) => {
586
+ const R = o == null ? void 0 : o.id;
587
+ typeof R == "string" && at({ workspaceId: e, id: R });
588
+ }).catch(() => {
589
+ Z.current = !1, ue({ workspaceId: e, creating: !1 }), de({ workspaceId: e, failed: !0 });
445
590
  }));
446
591
  }
447
- }, [R, M, p]), w(() => {
448
- k.current = x;
449
- }, [x]);
450
- const Ze = _((a) => {
451
- Ae.current = { key: P, api: a }, Ee(!0), Xe({
452
- key: P,
453
- snapshot: a.getSnapshot()
592
+ }, [G.length, O, q, Y, u, e]), v(() => {
593
+ I.current = $;
594
+ }, [$]);
595
+ const vt = L((o) => {
596
+ Ge.current = { key: E, api: o }, Ue(!0), St({
597
+ key: E,
598
+ snapshot: o.getSnapshot()
454
599
  });
455
- }, [P]), et = _((a) => {
456
- Xe({
457
- key: P,
458
- snapshot: a
600
+ }, [E]), Pt = L((o) => {
601
+ St({
602
+ key: E,
603
+ snapshot: o
459
604
  });
460
- }, [P]), ee = _(() => {
461
- const a = Ae.current;
462
- return (a == null ? void 0 : a.key) === ze.current ? a.api : null;
463
- }, []), te = _(() => k.current, []), re = _(() => {
464
- k.current = !0, L(!0);
465
- }, [L]), ne = _(() => {
466
- k.current = !0, L(!0), J(!0);
467
- }, [L, J]), se = _(() => {
468
- k.current = !1, Ae.current = null, Ee(!1), L(!1);
469
- }, [L]), oe = E(
470
- () => (S == null ? void 0 : S.map(or)) ?? [],
471
- [S]
472
- ), _e = E(
473
- () => oe.some((a) => a.registrations.leftTabs.length > 0),
474
- [oe]
475
- ), tt = E(
476
- () => oe.flatMap((a) => a.registrations.panels.map((ie) => ie.id)),
477
- [oe]
478
- ), rt = E(
479
- () => [...Ce ?? [], ...tt],
480
- [Ce, tt]
481
- ), nt = A ?? (R !== void 0 ? "default" : ((lt = we[0]) == null ? void 0 : lt.id) ?? "default"), [Yt, Ne] = W(F), st = T(e);
482
- w(() => {
483
- if (st.current !== e) {
484
- st.current = e, Ne(F);
605
+ }, [E]), ge = L(() => {
606
+ const o = Ge.current;
607
+ return (o == null ? void 0 : o.key) === bt.current ? o.api : null;
608
+ }, []), he = L(() => I.current, []), be = L(() => {
609
+ I.current = !0, W(!0);
610
+ }, [W]), ye = L(() => {
611
+ I.current = !0, W(!0), X(!0);
612
+ }, [W, X]), Se = L(() => {
613
+ I.current = !1, Ge.current = null, Ue(!1), W(!1);
614
+ }, [W]), ve = T(
615
+ () => (w == null ? void 0 : w.map(kr)) ?? [],
616
+ [w]
617
+ ), Ce = T(
618
+ () => ve.some((o) => o.registrations.leftTabs.length > 0),
619
+ [ve]
620
+ ), wt = T(
621
+ () => ve.flatMap((o) => o.registrations.panels.map((R) => R.id)),
622
+ [ve]
623
+ ), Et = T(
624
+ () => [...tt ?? [], ...wt],
625
+ [tt, wt]
626
+ ), At = N ?? (O !== void 0 ? "default" : ((Lt = Fe[0]) == null ? void 0 : Lt.id) ?? "default"), [wr, $e] = _(j), Dt = k(e);
627
+ v(() => {
628
+ if (Dt.current !== e) {
629
+ Dt.current = e, $e(j);
485
630
  return;
486
631
  }
487
- F && Ne(!0);
488
- }, [F, e]);
489
- const ot = F && C && !A, it = !Yt && de !== !1 && (C ? ye && !!Se : !0), zt = _((a) => {
490
- Mt({ workspaceId: e, status: a }), Y == null || Y(a);
491
- }, [Y, e]);
492
- w(() => {
493
- var ie;
494
- const a = (ae) => {
495
- const Le = ae.detail;
496
- !Le || typeof Le != "object" || ar(Le, {
497
- surface: ee,
498
- isWorkbenchOpen: te,
499
- openWorkbench: re,
500
- openWorkbenchSources: ne
632
+ j && $e(!0);
633
+ }, [j, e]);
634
+ const Nt = j && H && !N, Rt = !!!(xe && xe.workspaceId === e && xe.id === N) && !wr && Ne !== !1 && (H ? !!N : !0), Er = L((o) => {
635
+ sr({ workspaceId: e, status: o }), ie == null || ie(o);
636
+ }, [ie, e]);
637
+ v(() => {
638
+ var R;
639
+ const o = (M) => {
640
+ const ee = M.detail;
641
+ !ee || typeof ee != "object" || Ur(ee, {
642
+ surface: ge,
643
+ isWorkbenchOpen: he,
644
+ openWorkbench: be,
645
+ openWorkbenchSources: ye
501
646
  });
502
647
  };
503
- return (ie = globalThis.addEventListener) == null || ie.call(globalThis, ct, a), () => {
504
- var ae;
505
- return (ae = globalThis.removeEventListener) == null ? void 0 : ae.call(globalThis, ct, a);
648
+ return (R = globalThis.addEventListener) == null || R.call(globalThis, xt, o), () => {
649
+ var M;
650
+ return (M = globalThis.removeEventListener) == null ? void 0 : M.call(globalThis, xt, o);
506
651
  };
507
- }, [ee, te, re, ne]), w(() => {
508
- A && (H == null || H(A));
509
- }, [A, H]);
510
- const Re = I.status !== "ready", Qt = Re ? /* @__PURE__ */ c(Lr, { status: I }) : void 0, Xt = E(
652
+ }, [ge, he, be, ye]), v(() => {
653
+ x || re == null || re(N ?? null);
654
+ }, [N, re, x]);
655
+ const Ie = fe.status !== "ready", Ar = Ie ? /* @__PURE__ */ c(mn, { status: fe }) : void 0, Dr = T(
511
656
  () => ({
512
- ...O,
513
- ...ot ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
514
- sessionId: nt,
515
- requestHeaders: $,
516
- bridgeEndpoint: ce,
517
- getSurface: ee,
518
- isWorkbenchOpen: te,
519
- openWorkbench: re,
520
- openWorkbenchSources: ne,
521
- closeWorkbench: se,
522
- extraCommands: Ke,
523
- workspaceWarmupStatus: I,
524
- hydrateMessages: it,
657
+ ...F,
658
+ ...Nt ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
659
+ sessionId: At,
660
+ requestHeaders: J,
661
+ bridgeEndpoint: Ae,
662
+ getSurface: ge,
663
+ isWorkbenchOpen: he,
664
+ openWorkbench: be,
665
+ openWorkbenchSources: ye,
666
+ closeWorkbench: Se,
667
+ extraCommands: rt,
668
+ workspaceWarmupStatus: fe,
669
+ hydrateMessages: Rt,
525
670
  onAutoSubmitInitialDraftSettled: () => {
526
- G.current = !1, Ne(!1), j(void 0);
527
- const a = O == null ? void 0 : O.onAutoSubmitInitialDraftSettled;
528
- typeof a == "function" && a();
671
+ B.current = !1, $e(!1), Q(void 0);
672
+ const o = F == null ? void 0 : F.onAutoSubmitInitialDraftSettled;
673
+ typeof o == "function" && o();
529
674
  },
530
675
  // Forward the explicit prop when set. Omitting the key (when undefined)
531
676
  // lets ChatPanel apply its own default (true) and avoids overriding a
532
677
  // value passed through chatParams.
533
- ...ue !== void 0 ? { hotReloadEnabled: ue } : {}
678
+ ...De !== void 0 ? { hotReloadEnabled: De } : {}
534
679
  }),
535
- [O, ot, nt, $, ce, ee, te, re, ne, se, Ke, I, it, ue]
536
- ), Zt = E(() => ({
537
- storageKey: P,
538
- defaultLeftTab: V,
539
- initialPanels: Ie,
540
- extraPanels: rt,
541
- onReady: Ze,
542
- onChange: et,
543
- onClose: se
680
+ [F, Nt, At, J, Ae, ge, he, be, ye, Se, rt, fe, Rt, De]
681
+ ), Nr = T(() => ({
682
+ storageKey: E,
683
+ defaultLeftTab: ne,
684
+ initialPanels: et,
685
+ extraPanels: Et,
686
+ onReady: vt,
687
+ onChange: Pt,
688
+ onClose: Se
544
689
  }), [
545
- se,
546
- V,
547
- Ie,
690
+ Se,
691
+ ne,
548
692
  et,
549
- Ze,
550
- P,
551
- rt,
552
- L
693
+ Pt,
694
+ vt,
695
+ E,
696
+ Et,
697
+ W
553
698
  ]);
554
- return /* @__PURE__ */ c("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ xe(
555
- ir,
699
+ return /* @__PURE__ */ c("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ te(
700
+ Fr,
556
701
  {
557
- chatPanel: $t,
558
- panels: b,
559
- commands: u,
560
- catalogs: N,
561
- plugins: S,
562
- excludeDefaults: D,
563
- capabilities: d,
564
- apiBaseUrl: m,
565
- authHeaders: Gt,
566
- apiTimeout: h,
567
- defaultTheme: U,
568
- onThemeChange: _t,
702
+ chatPanel: or,
703
+ panels: h,
704
+ commands: f,
705
+ catalogs: A,
706
+ plugins: w,
707
+ excludeDefaults: C,
708
+ capabilities: b,
709
+ apiBaseUrl: g,
710
+ authHeaders: ir,
711
+ apiTimeout: d,
712
+ defaultTheme: S,
713
+ onThemeChange: Kt,
569
714
  workspaceId: e,
570
- storageKey: me,
571
- persistenceEnabled: ke,
715
+ storageKey: Le,
716
+ persistenceEnabled: He,
572
717
  bridgeEndpoint: null,
573
- onAuthError: Rt,
574
- frontPluginHotReload: kt,
575
- fullPageBasePath: Nt,
718
+ onAuthError: Ht,
719
+ frontPluginHotReload: er,
720
+ fullPageBasePath: Jt,
576
721
  children: [
577
722
  l,
578
723
  /* @__PURE__ */ c(
579
- Nr,
724
+ un,
580
725
  {
581
726
  workspaceId: e,
582
- requestHeaders: $,
583
- apiBaseUrl: m,
584
- preloadPaths: Wt,
585
- provisionWorkspace: de,
586
- onStatusChange: zt
727
+ requestHeaders: J,
728
+ apiBaseUrl: g,
729
+ preloadPaths: tr,
730
+ provisionWorkspace: Ne,
731
+ onStatusChange: Er
587
732
  }
588
733
  ),
589
734
  /* @__PURE__ */ c(
590
- xr,
735
+ Sn,
591
736
  {
592
- bridgeEndpoint: ce,
593
- requestHeaders: $,
594
- navOpen: Ye,
595
- surfaceOpen: x,
596
- surfaceReady: Bt,
597
- snapshot: Vt
737
+ bridgeEndpoint: Ae,
738
+ requestHeaders: J,
739
+ navOpen: ht,
740
+ surfaceOpen: $,
741
+ surfaceReady: Sr,
742
+ snapshot: Pr
598
743
  }
599
744
  ),
600
- /* @__PURE__ */ xe("div", { className: "flex h-full min-h-0 flex-col", children: [
745
+ /* @__PURE__ */ te("div", { className: "flex h-full min-h-0 flex-col", children: [
601
746
  /* @__PURE__ */ c(
602
- ur,
747
+ $r,
603
748
  {
604
- appTitle: Lt,
605
- sessionTitle: Jt ?? M,
749
+ appTitle: Vt,
750
+ sessionTitle: ct ? "Loading sessions…" : br ?? q,
606
751
  onCommandPalette: () => {
607
752
  document.dispatchEvent(new KeyboardEvent("keydown", {
608
753
  key: "k",
@@ -612,143 +757,149 @@ function Xr({
612
757
  cancelable: !0
613
758
  }));
614
759
  },
615
- onNewChat: He,
616
- topBarLeft: Tt,
617
- topBarRight: xt
760
+ onNewChat: mt,
761
+ topBarLeft: Qt,
762
+ topBarRight: /* @__PURE__ */ te(K, { children: [
763
+ Zt ? /* @__PURE__ */ c(Hr, {}) : null,
764
+ Xt
765
+ ] })
618
766
  }
619
767
  ),
620
- /* @__PURE__ */ c(
621
- dr,
768
+ ct ? /* @__PURE__ */ c(gn, {}) : /* @__PURE__ */ c(
769
+ Ir,
622
770
  {
623
- className: Ft,
624
- nav: Ye ? "session-list" : null,
771
+ className: nr,
772
+ nav: ht ? "session-list" : null,
625
773
  navParams: {
626
- sessions: we,
627
- activeId: Se,
628
- onSwitch: Kt,
629
- onCreate: He,
630
- onDelete: jt,
631
- onClose: () => Ve(!1)
774
+ sessions: Fe,
775
+ activeId: ut,
776
+ onSwitch: gr,
777
+ onCreate: mt,
778
+ onDelete: hr,
779
+ onLoadMore: u == null ? void 0 : u.loadMore,
780
+ hasMore: u == null ? void 0 : u.hasMore,
781
+ loadingMore: u == null ? void 0 : u.loadingMore,
782
+ onClose: () => gt(!1)
632
783
  },
633
784
  center: "chat",
634
- centerParams: Xt,
635
- surface: x ? "artifact-surface" : null,
636
- surfaceParams: Zt,
637
- surfaceOverlay: Qt,
638
- sidebar: x && !Re && _e && Ht ? "workbench-left" : null,
639
- sidebarParams: x && !Re && _e ? {
640
- ...V ? { defaultTab: V } : {},
641
- onClose: () => J(!1),
642
- onCollapse: () => J(!1)
785
+ centerParams: Dr,
786
+ surface: $ ? "artifact-surface" : null,
787
+ surfaceParams: Nr,
788
+ surfaceOverlay: Ar,
789
+ sidebar: $ && !Ie && Ce && vr ? "workbench-left" : null,
790
+ sidebarParams: $ && !Ie && Ce ? {
791
+ ...ne ? { defaultTab: ne } : {},
792
+ onClose: () => X(!1),
793
+ onCollapse: () => X(!1)
643
794
  } : void 0,
644
- storageKey: Q ? z : void 0,
645
- onOpenNav: $e ? () => {
646
- Ve(!0), fe == null || fe();
795
+ storageKey: oe ? se : void 0,
796
+ onOpenNav: Ze ? () => {
797
+ gt(!0), Re == null || Re();
647
798
  } : void 0,
648
799
  onOpenSurface: () => {
649
- k.current = !0, L(!0), pe == null || pe();
800
+ I.current = !0, W(!0), _e == null || _e();
650
801
  },
651
- surfaceButtonBottomOffset: Ut,
652
- onOpenSidebar: _e ? () => {
653
- k.current = !0, L(!0), J(!0);
802
+ surfaceButtonBottomOffset: rr,
803
+ onOpenSidebar: Ce ? () => {
804
+ I.current = !0, W(!0), X(!0);
654
805
  } : void 0
655
806
  }
656
807
  )
657
808
  ] }),
658
- g
809
+ p
659
810
  ]
660
811
  }
661
812
  ) });
662
813
  }
663
- const kr = 500;
664
- function Wr(e) {
814
+ const vn = 500;
815
+ function Pn(e) {
665
816
  return new Promise((t, r) => {
666
817
  let n;
667
- const s = () => {
668
- n && globalThis.clearTimeout(n), e.removeEventListener("abort", o);
669
- }, o = () => {
670
- s(), r(new DOMException("Workspace boot aborted", "AbortError"));
818
+ const i = () => {
819
+ n && globalThis.clearTimeout(n), e.removeEventListener("abort", s);
820
+ }, s = () => {
821
+ i(), r(new DOMException("Workspace boot aborted", "AbortError"));
671
822
  };
672
823
  if (e.aborted) {
673
- o();
824
+ s();
674
825
  return;
675
826
  }
676
827
  n = globalThis.setTimeout(() => {
677
- s(), t();
678
- }, kr), e.addEventListener("abort", o, { once: !0 });
828
+ i(), t();
829
+ }, vn), e.addEventListener("abort", s, { once: !0 });
679
830
  });
680
831
  }
681
- function Zr({
832
+ function qn({
682
833
  workspaceId: e,
683
834
  requestHeaders: t,
684
835
  apiBaseUrl: r,
685
- preloadPaths: n = gt,
686
- provisionWorkspace: s = !0,
687
- loadingFallback: o,
688
- errorFallback: i,
836
+ preloadPaths: n = Ct,
837
+ provisionWorkspace: i = !0,
838
+ loadingFallback: s,
839
+ errorFallback: a,
689
840
  children: l
690
841
  }) {
691
- const [g, b] = W({
842
+ const [p, h] = _({
692
843
  status: "loading",
693
844
  label: "Waking workspace runtime"
694
845
  });
695
- return w(() => {
696
- const u = new AbortController(), N = le(e, t);
697
- async function S(d) {
698
- const m = await fetch(bt(r, d), {
699
- headers: N,
700
- signal: u.signal
701
- }), y = await At(m);
702
- if (!m.ok) {
703
- if (yt(y)) return "preparing";
704
- throw new Error(St(y) ?? `${d} failed with ${m.status}`);
846
+ return v(() => {
847
+ const f = new AbortController(), A = we(e, t);
848
+ async function w(b) {
849
+ const g = await fetch($t(r, b), {
850
+ headers: A,
851
+ signal: f.signal
852
+ }), y = await Ee(g);
853
+ if (!g.ok) {
854
+ if (Ke(y)) return "preparing";
855
+ throw new Error(Je(y) ?? `${b} failed with ${g.status}`);
705
856
  }
706
- if (Pt(d)) {
707
- const U = Et(y);
708
- if ((U == null ? void 0 : U.state) === "degraded") throw new Error(U.message ?? "Workspace failed to prepare");
857
+ if (jt(b)) {
858
+ const S = Pe(y);
859
+ if ((S == null ? void 0 : S.state) === "degraded") throw new Error(S.message ?? "Workspace failed to prepare");
709
860
  }
710
- return ht(d) !== null && y && typeof y == "object" && vt(r, N["x-boring-workspace-id"] ?? e, d, y), "ready";
861
+ return It(b) !== null && y && typeof y == "object" && qt(r, A["x-boring-workspace-id"] ?? e, b, y), "ready";
711
862
  }
712
- async function D() {
713
- b({ status: "loading", label: "Waking workspace runtime" });
863
+ async function C() {
864
+ h({ status: "loading", label: "Waking workspace runtime" });
714
865
  try {
715
- const d = wt(n, s);
716
- let m = await Promise.all(d.map(async (h) => ({ path: h, status: await S(h) }))), y = m.filter((h) => h.status === "preparing").map((h) => h.path);
866
+ const b = Bt(n, i);
867
+ let g = await Promise.all(b.map(async (d) => ({ path: d, status: await w(d) }))), y = g.filter((d) => d.status === "preparing").map((d) => d.path);
717
868
  for (; y.length > 0; ) {
718
- if (b({ status: "loading", label: "Workspace is still preparing" }), await Wr(u.signal), u.signal.aborted) return;
719
- m = await Promise.all(y.map(async (h) => ({ path: h, status: await S(h) }))), y = m.filter((h) => h.status === "preparing").map((h) => h.path);
869
+ if (h({ status: "loading", label: "Workspace is still preparing" }), await Pn(f.signal), f.signal.aborted) return;
870
+ g = await Promise.all(y.map(async (d) => ({ path: d, status: await w(d) }))), y = g.filter((d) => d.status === "preparing").map((d) => d.path);
720
871
  }
721
- u.signal.aborted || b({ status: "ready" });
722
- } catch (d) {
723
- if (u.signal.aborted) return;
724
- b({
872
+ f.signal.aborted || h({ status: "ready" });
873
+ } catch (b) {
874
+ if (f.signal.aborted) return;
875
+ h({
725
876
  status: "error",
726
- message: d instanceof Error ? d.message : "Unknown workspace boot error"
877
+ message: b instanceof Error ? b.message : "Unknown workspace boot error"
727
878
  });
728
879
  }
729
880
  }
730
- return D(), () => u.abort();
731
- }, [r, n, s, t, e]), g.status === "ready" ? /* @__PURE__ */ c(B, { children: l }) : g.status === "error" ? typeof i == "function" ? /* @__PURE__ */ c(B, { children: i(g.message) }) : i ? /* @__PURE__ */ c(B, { children: i }) : /* @__PURE__ */ c(
732
- dt,
881
+ return C(), () => f.abort();
882
+ }, [r, n, i, t, e]), p.status === "ready" ? /* @__PURE__ */ c(K, { children: l }) : p.status === "error" ? typeof a == "function" ? /* @__PURE__ */ c(K, { children: a(p.message) }) : a ? /* @__PURE__ */ c(K, { children: a }) : /* @__PURE__ */ c(
883
+ Wt,
733
884
  {
734
885
  title: "Workspace failed to open",
735
- description: g.message,
886
+ description: p.message,
736
887
  status: "Retry by reloading the page"
737
888
  }
738
- ) : typeof o == "function" ? /* @__PURE__ */ c(B, { children: o(g.label) }) : o ? /* @__PURE__ */ c(B, { children: o }) : /* @__PURE__ */ c(
739
- dt,
889
+ ) : typeof s == "function" ? /* @__PURE__ */ c(K, { children: s(p.label) }) : s ? /* @__PURE__ */ c(K, { children: s }) : /* @__PURE__ */ c(
890
+ Wt,
740
891
  {
741
892
  title: "Opening workspace",
742
893
  description: "Waking the sandbox and preparing files, sessions, and layout.",
743
- status: g.label
894
+ status: p.label
744
895
  }
745
896
  );
746
897
  }
747
- const Ur = "FULL_PAGE_PANEL_MISSING_COMPONENT", Fr = "FULL_PAGE_PANEL_INVALID_PARAMS_JSON", Gr = "FULL_PAGE_PANEL_PARAMS_NOT_OBJECT", Mr = "FULL_PAGE_PANEL_UNKNOWN_COMPONENT", $r = "FULL_PAGE_PANEL_NOT_SUPPORTED", Ir = "FULL_PAGE_PANEL_RENDER_FAILED";
748
- function v() {
898
+ const wn = "FULL_PAGE_PANEL_MISSING_COMPONENT", En = "FULL_PAGE_PANEL_INVALID_PARAMS_JSON", An = "FULL_PAGE_PANEL_PARAMS_NOT_OBJECT", Dn = "FULL_PAGE_PANEL_UNKNOWN_COMPONENT", Nn = "FULL_PAGE_PANEL_NOT_SUPPORTED", Rn = "FULL_PAGE_PANEL_RENDER_FAILED";
899
+ function P() {
749
900
  }
750
- const Cr = { dispose: v }, f = () => Cr;
751
- function Kr(e) {
901
+ const _n = { dispose: P }, m = () => _n;
902
+ function Ln(e) {
752
903
  return {
753
904
  id: `full-page:${e}`,
754
905
  title: e,
@@ -758,31 +909,31 @@ function Kr(e) {
758
909
  width: 0,
759
910
  height: 0,
760
911
  location: { type: "grid", referenceGroup: void 0 },
761
- setActive: v,
912
+ setActive: P,
762
913
  setTitle: (t) => {
763
914
  document.title = t;
764
915
  },
765
- setSize: v,
916
+ setSize: P,
766
917
  close: () => {
767
918
  window.close();
768
919
  },
769
- moveTo: v,
770
- maximize: v,
771
- exitMaximized: v,
920
+ moveTo: P,
921
+ maximize: P,
922
+ exitMaximized: P,
772
923
  isMaximized: () => !1,
773
- minimize: v,
774
- onDidActiveChange: f,
775
- onDidVisibilityChange: f,
776
- onDidDimensionsChange: f,
777
- onDidFocusChange: f,
778
- onDidLocationChange: f,
779
- onDidParametersChange: f,
780
- onDidTitleChange: f,
781
- onDidRenamed: f,
782
- onWillFocus: f
924
+ minimize: P,
925
+ onDidActiveChange: m,
926
+ onDidVisibilityChange: m,
927
+ onDidDimensionsChange: m,
928
+ onDidFocusChange: m,
929
+ onDidLocationChange: m,
930
+ onDidParametersChange: m,
931
+ onDidTitleChange: m,
932
+ onDidRenamed: m,
933
+ onWillFocus: m
783
934
  };
784
935
  }
785
- function jr() {
936
+ function Tn() {
786
937
  return {
787
938
  width: window.innerWidth,
788
939
  height: window.innerHeight,
@@ -794,139 +945,139 @@ function jr() {
794
945
  panels: [],
795
946
  groups: [],
796
947
  activeGroup: void 0,
797
- addPanel: v,
798
- addGroup: v,
799
- removePanel: v,
800
- removeGroup: v,
948
+ addPanel: P,
949
+ addGroup: P,
950
+ removePanel: P,
951
+ removeGroup: P,
801
952
  getPanel: () => {
802
953
  },
803
954
  getGroup: () => {
804
955
  },
805
- moveGroupOrPanel: v,
806
- fromJSON: v,
956
+ moveGroupOrPanel: P,
957
+ fromJSON: P,
807
958
  toJSON: () => ({}),
808
- clear: v,
809
- focus: v,
810
- layout: v,
811
- onDidLayoutChange: f,
812
- onDidLayoutFromJSON: f,
813
- onDidAddPanel: f,
814
- onDidRemovePanel: f,
815
- onDidActivePanelChange: f,
816
- onDidAddGroup: f,
817
- onDidRemoveGroup: f,
818
- onDidActiveGroupChange: f,
819
- onUnhandledDragOverEvent: f,
820
- onDidDrop: f,
821
- onWillDrop: f,
822
- onWillDragGroup: f,
823
- onWillDragPanel: f,
824
- onDidActivePanelChange_: f
959
+ clear: P,
960
+ focus: P,
961
+ layout: P,
962
+ onDidLayoutChange: m,
963
+ onDidLayoutFromJSON: m,
964
+ onDidAddPanel: m,
965
+ onDidRemovePanel: m,
966
+ onDidActivePanelChange: m,
967
+ onDidAddGroup: m,
968
+ onDidRemoveGroup: m,
969
+ onDidActiveGroupChange: m,
970
+ onUnhandledDragOverEvent: m,
971
+ onDidDrop: m,
972
+ onWillDrop: m,
973
+ onWillDragGroup: m,
974
+ onWillDragPanel: m,
975
+ onDidActivePanelChange_: m
825
976
  };
826
977
  }
827
- function Te({ code: e, title: t, description: r }) {
978
+ function Be({ code: e, title: t, description: r }) {
828
979
  return /* @__PURE__ */ c(
829
980
  "div",
830
981
  {
831
982
  className: "flex min-h-screen items-center justify-center bg-background p-6 text-foreground",
832
983
  "data-testid": "full-page-error-state",
833
984
  "data-full-page-error-code": e,
834
- children: /* @__PURE__ */ c(pr, { className: "w-full max-w-lg", title: t, description: r })
985
+ children: /* @__PURE__ */ c(Jr, { className: "w-full max-w-lg", title: t, description: r })
835
986
  }
836
987
  );
837
988
  }
838
- function en({ componentId: e, params: t = {} }) {
839
- const r = mt(), { errors: n } = lr(), s = r.get(e), o = r.getComponents()[e];
840
- tr(() => {
841
- document.title = (s == null ? void 0 : s.title) ?? e;
842
- }, [e, s == null ? void 0 : s.title]);
843
- const i = E(() => ({
989
+ function jn({ componentId: e, params: t = {} }) {
990
+ const r = Gt(), { errors: n } = Gr(), i = r.get(e), s = r.getComponents()[e];
991
+ Tr(() => {
992
+ document.title = (i == null ? void 0 : i.title) ?? e;
993
+ }, [e, i == null ? void 0 : i.title]);
994
+ const a = T(() => ({
844
995
  params: t,
845
- api: Kr(e),
846
- containerApi: jr(),
996
+ api: Ln(e),
997
+ containerApi: Tn(),
847
998
  className: "h-full"
848
- }), [e, t]), l = E(() => {
849
- if (!s) return null;
850
- const g = s.pluginId ?? s.id;
851
- for (let b = n.length - 1; b >= 0; b -= 1) {
852
- const u = n[b];
853
- if (u.contributionKind === "panel" && u.contributionId === e && u.pluginId === g)
854
- return u;
999
+ }), [e, t]), l = T(() => {
1000
+ if (!i) return null;
1001
+ const p = i.pluginId ?? i.id;
1002
+ for (let h = n.length - 1; h >= 0; h -= 1) {
1003
+ const f = n[h];
1004
+ if (f.contributionKind === "panel" && f.contributionId === e && f.pluginId === p)
1005
+ return f;
855
1006
  }
856
1007
  return null;
857
- }, [e, n, s]);
858
- return s ? !s.supportsFullPage || !o ? /* @__PURE__ */ c(
859
- Te,
1008
+ }, [e, n, i]);
1009
+ return i ? !i.supportsFullPage || !s ? /* @__PURE__ */ c(
1010
+ Be,
860
1011
  {
861
- code: $r,
1012
+ code: Nn,
862
1013
  title: "Panel does not support full-page mode",
863
1014
  description: `Panel "${e}" can render in the workspace, but it has not opted into the dedicated full-page pane route.`
864
1015
  }
865
1016
  ) : l ? /* @__PURE__ */ c(
866
- Te,
1017
+ Be,
867
1018
  {
868
- code: Ir,
1019
+ code: Rn,
869
1020
  title: "Panel failed to render",
870
1021
  description: `Panel "${e}" crashed while rendering in full-page mode: ${l.error.message}`
871
1022
  }
872
- ) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(cr, { mode: "full-page", children: /* @__PURE__ */ c(o, { ...i }) }) }) : /* @__PURE__ */ c(
873
- Te,
1023
+ ) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(Cr, { mode: "full-page", children: /* @__PURE__ */ c(s, { ...a }) }) }) : /* @__PURE__ */ c(
1024
+ Be,
874
1025
  {
875
- code: Mr,
1026
+ code: Dn,
876
1027
  title: "Unknown panel",
877
1028
  description: `No full-page panel component is registered as "${e}".`
878
1029
  }
879
1030
  );
880
1031
  }
881
- function tn(e) {
882
- var o;
883
- const t = new URLSearchParams(e), r = ((o = t.get("component")) == null ? void 0 : o.trim()) ?? "";
1032
+ function Bn(e) {
1033
+ var s;
1034
+ const t = new URLSearchParams(e), r = ((s = t.get("component")) == null ? void 0 : s.trim()) ?? "";
884
1035
  if (!r)
885
1036
  return {
886
1037
  componentId: null,
887
1038
  params: {},
888
1039
  error: {
889
- code: Ur,
1040
+ code: wn,
890
1041
  message: "Missing full-page panel component id."
891
1042
  }
892
1043
  };
893
1044
  const n = t.get("params");
894
1045
  if (!n)
895
1046
  return { componentId: r, params: {} };
896
- let s;
1047
+ let i;
897
1048
  try {
898
- s = JSON.parse(n);
1049
+ i = JSON.parse(n);
899
1050
  } catch {
900
1051
  return {
901
1052
  componentId: null,
902
1053
  params: {},
903
1054
  error: {
904
- code: Fr,
1055
+ code: En,
905
1056
  message: "Invalid full-page panel params JSON."
906
1057
  }
907
1058
  };
908
1059
  }
909
- return s === null || Array.isArray(s) || typeof s != "object" ? {
1060
+ return i === null || Array.isArray(i) || typeof i != "object" ? {
910
1061
  componentId: null,
911
1062
  params: {},
912
1063
  error: {
913
- code: Gr,
1064
+ code: An,
914
1065
  message: "Full-page panel params must be a JSON object."
915
1066
  }
916
- } : { componentId: r, params: s };
1067
+ } : { componentId: r, params: i };
917
1068
  }
918
1069
  export {
919
- Fr as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
920
- Ur as FULL_PAGE_PANEL_MISSING_COMPONENT,
921
- $r as FULL_PAGE_PANEL_NOT_SUPPORTED,
922
- Gr as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
923
- Ir as FULL_PAGE_PANEL_RENDER_FAILED,
924
- Mr as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
925
- Xr as WorkspaceAgentFront,
926
- Nr as WorkspaceBackgroundBoot,
927
- Zr as WorkspaceBootGate,
928
- en as WorkspaceFullPagePanel,
929
- hr as createLocalStorageSessions,
930
- tn as parseFullPagePanelLocation,
931
- vr as useLocalStorageSessions
1070
+ En as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
1071
+ wn as FULL_PAGE_PANEL_MISSING_COMPONENT,
1072
+ Nn as FULL_PAGE_PANEL_NOT_SUPPORTED,
1073
+ An as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
1074
+ Rn as FULL_PAGE_PANEL_RENDER_FAILED,
1075
+ Dn as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
1076
+ In as WorkspaceAgentFront,
1077
+ un as WorkspaceBackgroundBoot,
1078
+ qn as WorkspaceBootGate,
1079
+ jn as WorkspaceFullPagePanel,
1080
+ Qr as createLocalStorageSessions,
1081
+ Bn as parseFullPagePanelLocation,
1082
+ Xr as useLocalStorageSessions
932
1083
  };