@hachej/boring-workspace 0.1.17 → 0.1.20

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.
Files changed (37) hide show
  1. package/README.md +36 -34
  2. package/dist/{FileTree-Dvaud3jU.js → FileTree-DHVB9rpk.js} +15 -15
  3. package/dist/{MarkdownEditor-sLkqTXDj.js → MarkdownEditor-L1KDH0bM.js} +1 -1
  4. package/dist/{WorkspaceLoadingState-zLzh1tGc.js → WorkspaceLoadingState-DYDxUYnx.js} +114 -110
  5. package/dist/WorkspaceProvider-CDPaAO5u.js +5971 -0
  6. package/dist/app-front.d.ts +94 -107
  7. package/dist/app-front.js +243 -233
  8. package/dist/app-server.d.ts +130 -15
  9. package/dist/app-server.js +1569 -304
  10. package/dist/{bootstrapServer-BreQ9QBc.d.ts → createInMemoryBridge-BDxDzihm.d.ts} +11 -26
  11. package/dist/manifest-CyNNdfYz.d.ts +58 -0
  12. package/dist/plugin.d.ts +199 -0
  13. package/dist/plugin.js +300 -0
  14. package/dist/server.d.ts +239 -4
  15. package/dist/server.js +901 -78
  16. package/dist/shared.d.ts +4 -112
  17. package/dist/surface-COYagY2m.d.ts +111 -0
  18. package/dist/testing.d.ts +19 -1
  19. package/dist/testing.js +2 -2
  20. package/dist/{agent-tool-DEtfQPVB.d.ts → ui-bridge-Gfh1MMgl.d.ts} +30 -30
  21. package/dist/workspace.css +36 -0
  22. package/dist/workspace.d.ts +165 -120
  23. package/dist/workspace.js +330 -377
  24. package/docs/INTERFACES.md +9 -9
  25. package/docs/PLUGIN_STRUCTURE.md +39 -145
  26. package/docs/PLUGIN_SYSTEM.md +355 -0
  27. package/docs/README.md +6 -1
  28. package/docs/plans/README.md +1 -0
  29. package/docs/plans/archive/HOT_RELOADABLE_AGENT_PLUGINS_PLAN.md +218 -0
  30. package/docs/plans/archive/RELOAD_PLUGGABILITY_PLAN.md +174 -0
  31. package/docs/plans/archive/UNIFIED_PLUGIN_SYSTEM_PLAN.md +769 -0
  32. package/package.json +11 -5
  33. package/dist/CommandPalette-CJHuTJlD.js +0 -5716
  34. package/docs/bridge.md +0 -135
  35. package/docs/panels.md +0 -102
  36. package/docs/plugins.md +0 -158
  37. /package/docs/plans/{MACRO_PLUGIN_GENERIC_HELPERS_AUDIT.md → archive/MACRO_PLUGIN_GENERIC_HELPERS_AUDIT.md} +0 -0
package/dist/app-front.js CHANGED
@@ -1,47 +1,47 @@
1
- import { jsx as d, jsxs as $e, Fragment as W } from "react/jsx-runtime";
2
- import { useSyncExternalStore as Qe, useMemo as b, useCallback as y, useRef as $, useState as H, useEffect as v } from "react";
3
- import { ChatPanel as Xe, useSessions as Ze } from "@hachej/boring-agent/front";
4
- import { U as Ce, p as He, al as qe, u as et, am as tt } from "./CommandPalette-CJHuTJlD.js";
5
- import { T as st, C as nt, r as Ke, w as rt, W as Le } from "./WorkspaceLoadingState-zLzh1tGc.js";
6
- function ot() {
1
+ import { jsx as d, jsxs as xe, Fragment as $ } from "react/jsx-runtime";
2
+ import { useSyncExternalStore as qe, useMemo as P, useCallback as v, useRef as K, useState as re, useEffect as y } from "react";
3
+ import { ChatPanel as et, useSessions as tt } from "@hachej/boring-agent/front";
4
+ import { ak as st, U as We, o as rt, al as nt, u as ot, am as at } from "./WorkspaceProvider-CDPaAO5u.js";
5
+ import { T as ct, C as it, r as Le, w as lt, W as Re } from "./WorkspaceLoadingState-DYDxUYnx.js";
6
+ function ut() {
7
7
  const e = `s${Date.now()}`;
8
8
  return {
9
9
  sessions: [{ id: e, title: "New session", updatedAt: Date.now() }],
10
10
  activeId: e
11
11
  };
12
12
  }
13
- function at(e, t) {
14
- var o;
13
+ function ft(e, t) {
14
+ var n;
15
15
  if (typeof localStorage > "u") return t();
16
16
  try {
17
17
  const s = localStorage.getItem(e);
18
18
  if (s) {
19
- const n = JSON.parse(s), c = Array.isArray(n.sessions) ? n.sessions : Array.isArray(n.items) ? n.items : null;
19
+ const r = JSON.parse(s), c = Array.isArray(r.sessions) ? r.sessions : Array.isArray(r.items) ? r.items : null;
20
20
  if (c)
21
- return { sessions: c, activeId: n.activeId ?? ((o = c[0]) == null ? void 0 : o.id) ?? "" };
21
+ return { sessions: c, activeId: r.activeId ?? ((n = c[0]) == null ? void 0 : n.id) ?? "" };
22
22
  }
23
23
  } catch {
24
24
  }
25
25
  return t();
26
26
  }
27
- function ct(e, t) {
27
+ function dt(e, t) {
28
28
  if (!(typeof localStorage > "u"))
29
29
  try {
30
30
  localStorage.setItem(e, JSON.stringify(t));
31
31
  } catch {
32
32
  }
33
33
  }
34
- function it(e = {}) {
35
- const t = e.storageKey ?? "workspace:sessions", o = e.initial ?? ot;
36
- let s = at(t, o);
37
- const n = /* @__PURE__ */ new Set(), c = (a) => {
38
- s = a, ct(t, s), n.forEach((i) => i());
34
+ function pt(e = {}) {
35
+ const t = e.storageKey ?? "workspace:sessions", n = e.initial ?? ut;
36
+ let s = ft(t, n);
37
+ const r = /* @__PURE__ */ new Set(), c = (a) => {
38
+ s = a, dt(t, s), r.forEach((i) => i());
39
39
  };
40
40
  return {
41
41
  getState: () => s,
42
42
  subscribe(a) {
43
- return n.add(a), () => {
44
- n.delete(a);
43
+ return r.add(a), () => {
44
+ r.delete(a);
45
45
  };
46
46
  },
47
47
  switchTo(a) {
@@ -62,54 +62,51 @@ function it(e = {}) {
62
62
  }
63
63
  };
64
64
  }
65
- function lt(e) {
66
- return Qe(e.subscribe, e.getState, e.getState);
67
- }
68
- function ut(e) {
69
- return e.type === "panel";
65
+ function ht(e) {
66
+ return qe(e.subscribe, e.getState, e.getState);
70
67
  }
71
- function ft(e, t) {
68
+ function mt(e, t) {
72
69
  return e.endsWith(":surface") ? e.slice(0, -8) : t;
73
70
  }
74
- function Z(e, t, o) {
75
- const [s, n] = H(() => Ke(e, t, o));
76
- v(() => {
77
- n(Ke(e, t, o));
78
- }, [e, t, o]);
79
- const c = y(
71
+ function se(e, t, n) {
72
+ const [s, r] = re(() => Le(e, t, n));
73
+ y(() => {
74
+ r(Le(e, t, n));
75
+ }, [e, t, n]);
76
+ const c = v(
80
77
  (a) => {
81
- n(a), rt(e, a, o);
78
+ r(a), lt(e, a, n);
82
79
  },
83
- [o, e]
80
+ [n, e]
84
81
  );
85
82
  return [s, c];
86
83
  }
87
- const dt = {}, Re = {
84
+ const gt = {}, De = {
88
85
  openTabs: [],
89
86
  activeTab: null
90
87
  };
91
- function pt(e) {
88
+ function vt(e) {
92
89
  if (!e) return "/api/v1/ui";
93
- const t = e.replace(/\/$/, ""), o = "/api/v1/ui";
94
- return t.endsWith(o) ? t : `${t}${o}`;
90
+ const t = e.replace(/\/$/, ""), n = "/api/v1/ui";
91
+ return t.endsWith(n) ? t : `${t}${n}`;
95
92
  }
96
- function ht(e) {
97
- return `${pt(e)}/state`;
93
+ function yt(e) {
94
+ return `${vt(e)}/state`;
98
95
  }
99
- function mt(e) {
96
+ function St(e) {
100
97
  var s;
101
- const t = e.openTabs.find((n) => n.id === e.activeTab), o = (s = t == null ? void 0 : t.params) == null ? void 0 : s.path;
102
- return typeof o == "string" ? o : null;
98
+ const t = e.openTabs.find((r) => r.id === e.activeTab), n = (s = t == null ? void 0 : t.params) == null ? void 0 : s.path;
99
+ return typeof n == "string" ? n : null;
103
100
  }
104
- function gt({
101
+ function wt({
105
102
  bridgeEndpoint: e,
106
103
  requestHeaders: t,
107
- navOpen: o,
104
+ navOpen: n,
108
105
  surfaceOpen: s,
109
- snapshot: n
106
+ snapshot: r
110
107
  }) {
111
- const c = et(), a = $(null);
112
- return v(() => {
108
+ const c = ot(), a = K(null);
109
+ return y(() => {
113
110
  var u;
114
111
  if (e === null) return;
115
112
  (u = a.current) == null || u.abort();
@@ -117,14 +114,14 @@ function gt({
117
114
  a.current = i;
118
115
  const h = {
119
116
  v: 1,
120
- drawerOpen: o,
117
+ drawerOpen: n,
121
118
  workbenchOpen: s,
122
- openTabs: n.openTabs,
123
- activeTab: n.activeTab,
124
- activeFile: mt(n),
119
+ openTabs: r.openTabs,
120
+ activeTab: r.activeTab,
121
+ activeFile: St(r),
125
122
  availablePanels: c.list().map((m) => m.id)
126
123
  };
127
- return fetch(ht(e), {
124
+ return fetch(yt(e), {
128
125
  method: "PUT",
129
126
  headers: { ...t, "Content-Type": "application/json" },
130
127
  body: JSON.stringify({ state: h, causedBy: "user" }),
@@ -133,210 +130,221 @@ function gt({
133
130
  }), () => {
134
131
  i.abort();
135
132
  };
136
- }, [e, o, c, t, n, s]), null;
133
+ }, [e, n, c, t, r, s]), null;
137
134
  }
138
- function Wt({
135
+ function xt({
139
136
  workspaceId: e,
140
137
  chatPanel: t,
141
- useSessions: o,
142
- requestHeaders: s = dt,
143
- sessionStorageKey: n,
138
+ useSessions: n,
139
+ requestHeaders: s = gt,
140
+ sessionStorageKey: r,
144
141
  providerStorageKey: c,
145
142
  surfaceStorageKey: a,
146
143
  beforeShell: i,
147
144
  afterShell: h,
148
145
  panels: u,
149
146
  commands: m,
150
- catalogs: _,
147
+ catalogs: M,
151
148
  plugins: S,
152
149
  excludeDefaults: g,
153
150
  capabilities: k,
154
- apiBaseUrl: C,
151
+ apiBaseUrl: O,
155
152
  authHeaders: E,
156
- apiTimeout: j,
157
- defaultTheme: xe,
158
- onThemeChange: De,
159
- persistenceEnabled: q,
160
- bridgeEndpoint: M,
161
- onAuthError: Ne,
162
- sessions: ee,
163
- activeSessionId: te,
164
- onSwitchSession: se,
165
- onCreateSession: ne,
166
- onDeleteSession: re,
167
- onActiveSessionIdChange: K,
168
- appTitle: Ae = "Boring",
169
- defaultSessionTitle: J = "New session",
170
- topBarLeft: Ie,
171
- topBarRight: Ue,
172
- chatParams: oe,
173
- extraPanels: ae,
174
- extraCommands: ce,
175
- onOpenNav: V,
176
- onOpenSurface: z,
177
- className: Be
153
+ apiTimeout: J,
154
+ defaultTheme: Ne,
155
+ onThemeChange: Ie,
156
+ persistenceEnabled: ne,
157
+ bridgeEndpoint: V,
158
+ onAuthError: Ae,
159
+ sessions: oe,
160
+ activeSessionId: ae,
161
+ onSwitchSession: ce,
162
+ onCreateSession: ie,
163
+ onDeleteSession: le,
164
+ onActiveSessionIdChange: x,
165
+ appTitle: Ue = "Boring",
166
+ defaultSessionTitle: F = "New session",
167
+ defaultSurfaceOpen: Be,
168
+ defaultWorkbenchLeftTab: W,
169
+ topBarLeft: _e,
170
+ topBarRight: je,
171
+ chatParams: ue,
172
+ hotReloadEnabled: z,
173
+ frontPluginHotReload: Me,
174
+ extraPanels: fe,
175
+ extraCommands: de,
176
+ onOpenNav: G,
177
+ onOpenSurface: Y,
178
+ className: Je
178
179
  }) {
179
- var Ee, Oe;
180
- const F = c ?? `boring-ui-v2:layout:${e}`, f = a ?? `${F}:surface`, L = ft(
180
+ var Ke, Oe;
181
+ const Q = c ?? `boring-ui-v2:layout:${e}`, f = a ?? `${Q}:surface`, L = mt(
181
182
  f,
182
- F
183
- ), R = q !== !1, G = n ?? `boring-workspace:sessions:${e}`, x = b(
184
- () => it({ storageKey: G }),
185
- [G]
186
- ), ie = lt(x), _e = t ?? Xe, Y = o ?? (t ? void 0 : Ze), l = Y == null ? void 0 : Y({
183
+ Q
184
+ ), R = ne !== !1, X = r ?? `boring-workspace:sessions:${e}`, D = P(
185
+ () => pt({ storageKey: X }),
186
+ [X]
187
+ ), pe = ht(D), Ve = t ?? et, Z = n ?? (t ? void 0 : tt), l = Z == null ? void 0 : Z({
187
188
  requestHeaders: s,
188
- storageKey: G
189
- }), le = ee !== void 0 || te !== void 0 || se !== void 0 || ne !== void 0 || re !== void 0, je = l == null ? void 0 : l.sessions.map((r) => ({
190
- ...r,
191
- title: r.title ?? "New session"
192
- })), Q = l ? je ?? [] : le ? ee ?? [] : ie.sessions, p = l ? l.activeSessionId ?? null : le ? te ?? null : ie.activeId, ue = (l == null ? void 0 : l.switch) ?? se ?? x.switchTo, Me = y((r) => (p && r !== p && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: p } })), ue(r)), [ue, p]), fe = l ? () => l.create() : ne ?? x.create, Je = (l == null ? void 0 : l.delete) ?? re ?? x.remove, Ve = ((Ee = Q.find((r) => r.id === p)) == null ? void 0 : Ee.title) ?? void 0, [de, pe] = Z(
189
+ storageKey: X
190
+ }), he = oe !== void 0 || ae !== void 0 || ce !== void 0 || ie !== void 0 || le !== void 0, Fe = l == null ? void 0 : l.sessions.map((o) => ({
191
+ ...o,
192
+ title: o.title ?? "New session"
193
+ })), H = l ? Fe ?? [] : he ? oe ?? [] : pe.sessions, p = l ? l.activeSessionId ?? null : he ? ae ?? null : pe.activeId, me = (l == null ? void 0 : l.switch) ?? ce ?? D.switchTo, ze = v((o) => (p && o !== p && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: p } })), me(o)), [me, p]), ge = l ? () => l.create() : ie ?? D.create, Ge = (l == null ? void 0 : l.delete) ?? le ?? D.remove, Ye = ((Ke = H.find((o) => o.id === p)) == null ? void 0 : Ke.title) ?? void 0, [ve, ye] = se(
193
194
  `${L}:drawer`,
194
195
  !0,
195
196
  R
196
- ), [P, w] = Z(
197
+ ), [w, b] = se(
197
198
  // Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
198
199
  // layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
199
200
  // key corrupts the JSON and drops the persisted workbench layout on reload.
200
201
  `${L}:workbenchOpen`,
201
- !1,
202
+ Be ?? !1,
202
203
  R
203
- ), [ze, he] = Z(
204
+ ), [Qe, q] = se(
204
205
  `${L}:workbenchLeftOpen`,
205
206
  !0,
206
207
  R
207
- ), O = $(!1), T = $(P), me = $(f), ge = $(null);
208
- me.current = f;
209
- const [ye, ve] = H(() => ({
208
+ ), C = K(!1), T = K(w), Se = K(f), we = K(null);
209
+ Se.current = f;
210
+ const [be, Pe] = re(() => ({
210
211
  key: f,
211
- snapshot: Re
212
- })), Fe = ye.key === f ? ye.snapshot : Re;
213
- v(() => {
214
- O.current = !1;
215
- }, [e]), v(() => {
212
+ snapshot: De
213
+ })), Xe = be.key === f ? be.snapshot : De;
214
+ y(() => {
215
+ C.current = !1;
216
+ }, [e]), y(() => {
216
217
  if (!(!l || l.loading)) {
217
218
  if (l.sessions.length > 0) {
218
- O.current = !1;
219
+ C.current = !1;
219
220
  return;
220
221
  }
221
- O.current || (O.current = !0, Promise.resolve(l.create({ title: J })).catch(() => {
222
- O.current = !1;
222
+ C.current || (C.current = !0, Promise.resolve(l.create({ title: F })).catch(() => {
223
+ C.current = !1;
223
224
  }));
224
225
  }
225
- }, [J, l]), v(() => {
226
- T.current = P;
227
- }, [P]);
228
- const Se = y((r) => {
229
- ge.current = { key: f, api: r }, ve({
226
+ }, [F, l]), y(() => {
227
+ T.current = w;
228
+ }, [w]);
229
+ const ke = v((o) => {
230
+ we.current = { key: f, api: o }, Pe({
230
231
  key: f,
231
- snapshot: r.getSnapshot()
232
+ snapshot: o.getSnapshot()
232
233
  });
233
- }, [f]), we = y((r) => {
234
- ve({
234
+ }, [f]), Te = v((o) => {
235
+ Pe({
235
236
  key: f,
236
- snapshot: r
237
+ snapshot: o
237
238
  });
238
- }, [f]), D = y(() => {
239
- const r = ge.current;
240
- return (r == null ? void 0 : r.key) === me.current ? r.api : null;
241
- }, []), N = y(() => T.current, []), A = y(() => {
242
- T.current = !0, w(!0);
243
- }, [w]), I = y(() => {
244
- T.current = !1, w(!1);
245
- }, [w]), U = b(
246
- () => (S == null ? void 0 : S.flatMap((r) => r.outputs ?? [])) ?? [],
239
+ }, [f]), N = v(() => {
240
+ const o = we.current;
241
+ return (o == null ? void 0 : o.key) === Se.current ? o.api : null;
242
+ }, []), I = v(() => T.current, []), A = v(() => {
243
+ T.current = !0, b(!0);
244
+ }, [b]), U = v(() => {
245
+ T.current = !1, b(!1);
246
+ }, [b]), B = P(
247
+ () => (S == null ? void 0 : S.map(st)) ?? [],
247
248
  [S]
248
- ), be = b(
249
- () => U.some((r) => r.type === "left-tab"),
250
- [U]
251
- ), ke = b(
252
- () => U.filter(ut).map((r) => r.panel.id),
253
- [U]
254
- ), Pe = b(
255
- () => [...ae ?? [], ...ke],
256
- [ae, ke]
257
- ), Te = p ?? ((Oe = Q[0]) == null ? void 0 : Oe.id) ?? "default";
258
- v(() => {
259
- var We;
260
- const r = (B) => {
261
- const X = B.detail;
262
- !X || typeof X != "object" || qe(X, {
263
- surface: D,
264
- isWorkbenchOpen: N,
249
+ ), ee = P(
250
+ () => B.some((o) => o.registrations.leftTabs.length > 0),
251
+ [B]
252
+ ), Ee = P(
253
+ () => B.flatMap((o) => o.registrations.panels.map((_) => _.id)),
254
+ [B]
255
+ ), Ce = P(
256
+ () => [...fe ?? [], ...Ee],
257
+ [fe, Ee]
258
+ ), $e = p ?? ((Oe = H[0]) == null ? void 0 : Oe.id) ?? "default";
259
+ y(() => {
260
+ var _;
261
+ const o = (j) => {
262
+ const te = j.detail;
263
+ !te || typeof te != "object" || nt(te, {
264
+ surface: N,
265
+ isWorkbenchOpen: I,
265
266
  openWorkbench: A
266
267
  });
267
268
  };
268
- return (We = globalThis.addEventListener) == null || We.call(globalThis, Ce, r), () => {
269
- var B;
270
- return (B = globalThis.removeEventListener) == null ? void 0 : B.call(globalThis, Ce, r);
269
+ return (_ = globalThis.addEventListener) == null || _.call(globalThis, We, o), () => {
270
+ var j;
271
+ return (j = globalThis.removeEventListener) == null ? void 0 : j.call(globalThis, We, o);
271
272
  };
272
- }, [D, N, A]), v(() => {
273
- p && (K == null || K(p));
274
- }, [p, K]);
275
- const Ge = b(
273
+ }, [N, I, A]), y(() => {
274
+ p && (x == null || x(p));
275
+ }, [p, x]);
276
+ const Ze = P(
276
277
  () => ({
277
- ...oe,
278
- sessionId: Te,
278
+ ...ue,
279
+ sessionId: $e,
279
280
  requestHeaders: s,
280
- bridgeEndpoint: M,
281
- getSurface: D,
282
- isWorkbenchOpen: N,
281
+ bridgeEndpoint: V,
282
+ getSurface: N,
283
+ isWorkbenchOpen: I,
283
284
  openWorkbench: A,
284
- closeWorkbench: I,
285
- extraCommands: ce
285
+ closeWorkbench: U,
286
+ extraCommands: de,
287
+ // Forward the explicit prop when set. Omitting the key (when undefined)
288
+ // lets ChatPanel apply its own default (true) and avoids overriding a
289
+ // value passed through chatParams.
290
+ ...z !== void 0 ? { hotReloadEnabled: z } : {}
286
291
  }),
287
- [oe, Te, s, M, D, N, A, I, ce]
288
- ), Ye = b(() => ({
292
+ [ue, $e, s, V, N, I, A, U, de, z]
293
+ ), He = P(() => ({
289
294
  storageKey: f,
290
- extraPanels: Pe,
291
- onReady: Se,
292
- onChange: we,
293
- onClose: I
295
+ defaultLeftTab: W,
296
+ extraPanels: Ce,
297
+ onReady: ke,
298
+ onChange: Te,
299
+ onClose: U
294
300
  }), [
295
- I,
296
- we,
297
- Se,
301
+ U,
302
+ W,
303
+ Te,
304
+ ke,
298
305
  f,
299
- Pe,
300
- w
306
+ Ce,
307
+ b
301
308
  ]);
302
- return /* @__PURE__ */ d("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ $e(
303
- He,
309
+ return /* @__PURE__ */ d("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ xe(
310
+ rt,
304
311
  {
305
- chatPanel: _e,
312
+ chatPanel: Ve,
306
313
  panels: u,
307
314
  commands: m,
308
- catalogs: _,
315
+ catalogs: M,
309
316
  plugins: S,
310
317
  excludeDefaults: g,
311
318
  capabilities: k,
312
- apiBaseUrl: C,
319
+ apiBaseUrl: O,
313
320
  authHeaders: E,
314
- apiTimeout: j,
315
- defaultTheme: xe,
316
- onThemeChange: De,
321
+ apiTimeout: J,
322
+ defaultTheme: Ne,
323
+ onThemeChange: Ie,
317
324
  workspaceId: e,
318
- storageKey: F,
319
- persistenceEnabled: q,
325
+ storageKey: Q,
326
+ persistenceEnabled: ne,
320
327
  bridgeEndpoint: null,
321
- onAuthError: Ne,
328
+ onAuthError: Ae,
329
+ frontPluginHotReload: Me,
322
330
  children: [
323
331
  i,
324
332
  /* @__PURE__ */ d(
325
- gt,
333
+ wt,
326
334
  {
327
- bridgeEndpoint: M,
335
+ bridgeEndpoint: V,
328
336
  requestHeaders: s,
329
- navOpen: de,
330
- surfaceOpen: P,
331
- snapshot: Fe
337
+ navOpen: ve,
338
+ surfaceOpen: w,
339
+ snapshot: Xe
332
340
  }
333
341
  ),
334
- /* @__PURE__ */ $e("div", { className: "flex h-full min-h-0 flex-col", children: [
342
+ /* @__PURE__ */ xe("div", { className: "flex h-full min-h-0 flex-col", children: [
335
343
  /* @__PURE__ */ d(
336
- st,
344
+ ct,
337
345
  {
338
- appTitle: Ae,
339
- sessionTitle: Ve ?? J,
346
+ appTitle: Ue,
347
+ sessionTitle: Ye ?? F,
340
348
  onCommandPalette: () => {
341
349
  document.dispatchEvent(new KeyboardEvent("keydown", {
342
350
  key: "k",
@@ -346,41 +354,43 @@ function Wt({
346
354
  cancelable: !0
347
355
  }));
348
356
  },
349
- onNewChat: fe,
350
- topBarLeft: Ie,
351
- topBarRight: Ue
357
+ onNewChat: ge,
358
+ topBarLeft: _e,
359
+ topBarRight: je
352
360
  }
353
361
  ),
354
362
  /* @__PURE__ */ d(
355
- nt,
363
+ it,
356
364
  {
357
- className: Be,
358
- nav: de ? "session-list" : null,
365
+ className: Je,
366
+ nav: ve ? "session-list" : null,
359
367
  navParams: {
360
- sessions: Q,
368
+ sessions: H,
361
369
  activeId: p,
362
- onSwitch: Me,
363
- onCreate: fe,
364
- onDelete: Je,
365
- onClose: () => pe(!1)
370
+ onSwitch: ze,
371
+ onCreate: ge,
372
+ onDelete: Ge,
373
+ onClose: () => ye(!1)
366
374
  },
367
375
  center: "chat",
368
- centerParams: Ge,
369
- surface: P ? "artifact-surface" : null,
370
- surfaceParams: Ye,
371
- sidebar: P && be && ze ? "workbench-left" : null,
372
- sidebarParams: {
373
- onClose: () => he(!1)
374
- },
376
+ centerParams: Ze,
377
+ surface: w ? "artifact-surface" : null,
378
+ surfaceParams: He,
379
+ sidebar: w && ee && Qe ? "workbench-left" : null,
380
+ sidebarParams: w && ee ? {
381
+ ...W ? { defaultTab: W } : {},
382
+ onClose: () => q(!1),
383
+ onCollapse: () => q(!1)
384
+ } : void 0,
375
385
  storageKey: R ? L : void 0,
376
386
  onOpenNav: () => {
377
- pe(!0), V == null || V();
387
+ ye(!0), G == null || G();
378
388
  },
379
389
  onOpenSurface: () => {
380
- T.current = !0, w(!0), z == null || z();
390
+ T.current = !0, b(!0), Y == null || Y();
381
391
  },
382
- onOpenSidebar: be ? () => {
383
- T.current = !0, w(!0), he(!0);
392
+ onOpenSidebar: ee ? () => {
393
+ T.current = !0, b(!0), q(!0);
384
394
  } : void 0
385
395
  }
386
396
  )
@@ -390,47 +400,47 @@ function Wt({
390
400
  }
391
401
  ) });
392
402
  }
393
- const yt = ["/api/v1/tree?path=.", "/api/v1/agent/sessions"];
394
- function vt(e, t) {
403
+ const bt = ["/api/v1/tree?path=.", "/api/v1/agent/sessions"];
404
+ function Pt(e, t) {
395
405
  return /^https?:\/\//i.test(t) || !e ? t : `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
396
406
  }
397
- function St(e) {
407
+ function kt(e) {
398
408
  const t = new URL(e, "http://workspace.local");
399
409
  return t.pathname !== "/api/v1/tree" ? null : t.searchParams.get("path") ?? ".";
400
410
  }
401
- function $t({
411
+ function Wt({
402
412
  workspaceId: e,
403
413
  requestHeaders: t,
404
- apiBaseUrl: o,
405
- preloadPaths: s = yt,
406
- loadingFallback: n,
414
+ apiBaseUrl: n,
415
+ preloadPaths: s = bt,
416
+ loadingFallback: r,
407
417
  errorFallback: c,
408
418
  children: a
409
419
  }) {
410
- const [i, h] = H({
420
+ const [i, h] = re({
411
421
  status: "loading",
412
422
  label: "Waking workspace runtime"
413
423
  });
414
- return v(() => {
424
+ return y(() => {
415
425
  const u = new AbortController(), m = t ?? { "x-boring-workspace-id": e };
416
- async function _(g) {
417
- const k = await fetch(vt(o, g), {
426
+ async function M(g) {
427
+ const k = await fetch(Pt(n, g), {
418
428
  headers: m,
419
429
  signal: u.signal
420
430
  });
421
431
  if (!k.ok) {
422
- const j = await k.text().catch(() => "");
423
- throw new Error(j || `${g} failed with ${k.status}`);
432
+ const J = await k.text().catch(() => "");
433
+ throw new Error(J || `${g} failed with ${k.status}`);
424
434
  }
425
- const C = St(g);
426
- if (C === null) return;
435
+ const O = kt(g);
436
+ if (O === null) return;
427
437
  const E = await k.clone().json().catch(() => null);
428
- !E || !Array.isArray(E.entries) || tt(o, m["x-boring-workspace-id"] ?? e, C, E.entries);
438
+ !E || !Array.isArray(E.entries) || at(n, m["x-boring-workspace-id"] ?? e, O, E.entries);
429
439
  }
430
440
  async function S() {
431
441
  h({ status: "loading", label: "Waking workspace runtime" });
432
442
  try {
433
- await Promise.all(s.map(_)), u.signal.aborted || h({ status: "ready" });
443
+ await Promise.all(s.map(M)), u.signal.aborted || h({ status: "ready" });
434
444
  } catch (g) {
435
445
  if (u.signal.aborted) return;
436
446
  h({
@@ -440,15 +450,15 @@ function $t({
440
450
  }
441
451
  }
442
452
  return S(), () => u.abort();
443
- }, [o, s, t, e]), i.status === "ready" ? /* @__PURE__ */ d(W, { children: a }) : i.status === "error" ? typeof c == "function" ? /* @__PURE__ */ d(W, { children: c(i.message) }) : c ? /* @__PURE__ */ d(W, { children: c }) : /* @__PURE__ */ d(
444
- Le,
453
+ }, [n, s, t, e]), i.status === "ready" ? /* @__PURE__ */ d($, { children: a }) : i.status === "error" ? typeof c == "function" ? /* @__PURE__ */ d($, { children: c(i.message) }) : c ? /* @__PURE__ */ d($, { children: c }) : /* @__PURE__ */ d(
454
+ Re,
445
455
  {
446
456
  title: "Workspace failed to open",
447
457
  description: i.message,
448
458
  status: "Retry by reloading the page"
449
459
  }
450
- ) : typeof n == "function" ? /* @__PURE__ */ d(W, { children: n(i.label) }) : n ? /* @__PURE__ */ d(W, { children: n }) : /* @__PURE__ */ d(
451
- Le,
460
+ ) : typeof r == "function" ? /* @__PURE__ */ d($, { children: r(i.label) }) : r ? /* @__PURE__ */ d($, { children: r }) : /* @__PURE__ */ d(
461
+ Re,
452
462
  {
453
463
  title: "Opening workspace",
454
464
  description: "Waking the sandbox and preparing files, sessions, and layout.",
@@ -457,8 +467,8 @@ function $t({
457
467
  );
458
468
  }
459
469
  export {
460
- Wt as WorkspaceAgentFront,
461
- $t as WorkspaceBootGate,
462
- it as createLocalStorageSessions,
463
- lt as useLocalStorageSessions
470
+ xt as WorkspaceAgentFront,
471
+ Wt as WorkspaceBootGate,
472
+ pt as createLocalStorageSessions,
473
+ ht as useLocalStorageSessions
464
474
  };