@hachej/boring-workspace 0.1.35 → 0.1.37

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