@hachej/boring-workspace 0.1.24 → 0.1.27

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