@hachej/boring-workspace 0.1.64 → 0.1.65

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 (36) hide show
  1. package/dist/FileTree-B_fRS4Om.js +230 -0
  2. package/dist/MarkdownEditor-C55gVDyW.js +743 -0
  3. package/dist/WorkspaceLoadingState-D3i4X-eH.js +847 -0
  4. package/dist/WorkspaceProvider-Ddx7GByq.js +8770 -0
  5. package/dist/app-front.d.ts +79 -2
  6. package/dist/app-front.js +3110 -2467
  7. package/dist/app-server.d.ts +2 -2
  8. package/dist/app-server.js +6 -4
  9. package/dist/boring-workspace.css +2 -1
  10. package/dist/charts.d.ts +6 -1
  11. package/dist/charts.js +131 -138
  12. package/dist/plugin.d.ts +64 -1
  13. package/dist/plugin.js +32 -0
  14. package/dist/rolldown-runtime-Dqa2HsxW.js +20 -0
  15. package/dist/{runtimeEnv-HolIkcoB.d.ts → runtimeEnv-CU-c4kaV.d.ts} +7 -0
  16. package/dist/server.d.ts +2 -2
  17. package/dist/server.js +4 -3
  18. package/dist/testing-e2e.d.ts +5 -0
  19. package/dist/testing-e2e.js +33 -42
  20. package/dist/testing.d.ts +6 -1
  21. package/dist/testing.js +9474 -10814
  22. package/dist/utils-BRcxFdrz.js +8 -0
  23. package/dist/workspace.css +2756 -290
  24. package/dist/workspace.d.ts +132 -15
  25. package/dist/workspace.js +568 -734
  26. package/docs/plans/archive/CODE_OWNERSHIP_CLEANUP_PLAN.md +1 -1
  27. package/docs/plans/archive/DECLARATIVE_LAYOUT_MIGRATION.md +4 -4
  28. package/docs/plans/archive/GENERIC_EXPLORER_PLUGIN_PLAN.md +10 -10
  29. package/docs/plans/archive/PLUGIN_MODEL.md +37 -37
  30. package/docs/plans/archive/WORKSPACE_V2_PLAN.md +2 -2
  31. package/package.json +50 -50
  32. package/dist/FileTree-DjhAzlg3.js +0 -315
  33. package/dist/MarkdownEditor-CeN7n6mw.js +0 -610
  34. package/dist/WorkspaceLoadingState-D4SB2awA.js +0 -867
  35. package/dist/WorkspaceProvider-CEZUOy1M.js +0 -8725
  36. package/dist/utils-B6yFEsav.js +0 -8
@@ -0,0 +1,847 @@
1
+ import { Bt as e, Gt as t, Rt as n, Ut as r, Y as i, _ as a, b as o, fn as s, it as c, o as l, pn as u, x as ee } from "./WorkspaceProvider-Ddx7GByq.js";
2
+ import { t as d } from "./utils-BRcxFdrz.js";
3
+ import { Suspense as f, createContext as te, createElement as p, useCallback as m, useContext as ne, useEffect as h, useMemo as g, useRef as _, useState as v, useSyncExternalStore as y } from "react";
4
+ import { Fragment as re, jsx as b, jsxs as x } from "react/jsx-runtime";
5
+ import { Maximize2 as ie, MessageSquare as ae, Minimize2 as oe, PanelRightClose as se, PanelRightOpen as ce, Plus as S, Search as C } from "lucide-react";
6
+ import { Button as le, IconButton as w, Kbd as T, LoadingState as E, ResizeHandle as ue } from "@hachej/boring-ui-kit";
7
+ //#region src/shared/plugins/appLeftOverlayChrome.ts
8
+ var de = te({
9
+ headerInsetStart: !1,
10
+ headerInsetEnd: !1
11
+ });
12
+ function D({ value: e, children: t }) {
13
+ return p(de.Provider, { value: e }, t);
14
+ }
15
+ function O() {
16
+ return ne(de);
17
+ }
18
+ //#endregion
19
+ //#region src/shared/plugins/workspaceShellCapabilities.ts
20
+ var k = (e) => ({
21
+ success: !1,
22
+ reason: "open-failed",
23
+ message: e
24
+ }), A = te({
25
+ openArtifact: () => ({
26
+ success: !1,
27
+ reason: "no-artifact",
28
+ message: "No artifact is available."
29
+ }),
30
+ openDetachedChat: () => k("Workspace shell capabilities are not available.")
31
+ });
32
+ function j({ value: e, children: t }) {
33
+ return p(A.Provider, { value: e }, t);
34
+ }
35
+ function M() {
36
+ return ne(A);
37
+ }
38
+ //#endregion
39
+ //#region src/front/store/localStorageValues.ts
40
+ function N(e, t, n = !0) {
41
+ if (!n || typeof window > "u") return t;
42
+ try {
43
+ let t = window.localStorage.getItem(e);
44
+ if (t === "1") return !0;
45
+ if (t === "0") return !1;
46
+ } catch {}
47
+ return t;
48
+ }
49
+ function P(e, t, n = !0) {
50
+ if (!(!n || typeof window > "u")) try {
51
+ window.localStorage.setItem(e, t ? "1" : "0");
52
+ } catch {}
53
+ }
54
+ function F(e, t, n = !0) {
55
+ if (!n || typeof window > "u") return t;
56
+ try {
57
+ let n = window.localStorage.getItem(e);
58
+ if (n === null) return t;
59
+ let r = Number(n);
60
+ return Number.isFinite(r) ? r : t;
61
+ } catch {}
62
+ return t;
63
+ }
64
+ function I(e, t, n = !0) {
65
+ if (!(!n || typeof window > "u")) try {
66
+ window.localStorage.setItem(e, String(Math.round(t)));
67
+ } catch {}
68
+ }
69
+ //#endregion
70
+ //#region src/front/layout/cornerChrome.tsx
71
+ var fe = "pointer-events-auto relative border border-border/70 bg-muted text-muted-foreground transition-colors hover:bg-foreground/[0.06] hover:text-foreground", L = "border-border bg-foreground/[0.09] text-foreground";
72
+ function R({ label: e, hint: t, side: n = "bottom", onClick: r, pressed: a, pulse: o = !1, children: s }) {
73
+ return /* @__PURE__ */ b(i, {
74
+ label: e,
75
+ hint: t,
76
+ side: n,
77
+ children: /* @__PURE__ */ x(w, {
78
+ type: "button",
79
+ variant: "ghost",
80
+ size: "icon-xs",
81
+ onClick: r,
82
+ "aria-label": e,
83
+ "aria-pressed": a,
84
+ title: e,
85
+ className: d(fe, a && L),
86
+ children: [s, o ? /* @__PURE__ */ b("span", {
87
+ className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-[color:var(--accent)] ring-1 ring-background",
88
+ "aria-hidden": "true"
89
+ }) : null]
90
+ })
91
+ });
92
+ }
93
+ //#endregion
94
+ //#region src/front/layout/ChatLayout.tsx
95
+ function z(e = {}) {
96
+ let { nav: t = "session-list", navParams: n, center: r = "chat", centerParams: i, surface: a, surfaceParams: o, sidebar: s, sidebarParams: c } = e, l = [];
97
+ return t && l.push({
98
+ id: "nav",
99
+ position: "left",
100
+ panel: t,
101
+ params: n,
102
+ locked: !0,
103
+ hideHeader: !0,
104
+ constraints: {
105
+ minWidth: 60,
106
+ maxWidth: 60
107
+ }
108
+ }), l.push({
109
+ id: "center",
110
+ position: "center",
111
+ panel: r,
112
+ params: i,
113
+ hideHeader: !0
114
+ }), s && l.push({
115
+ id: "sidebar",
116
+ position: "left",
117
+ panel: s,
118
+ params: c,
119
+ hideHeader: !0,
120
+ collapsible: !0,
121
+ collapsedWidth: 40,
122
+ constraints: {
123
+ minWidth: 200,
124
+ maxWidthViewportRatio: .5
125
+ }
126
+ }), a && l.push({
127
+ id: "surface",
128
+ position: "right",
129
+ panel: a,
130
+ params: o,
131
+ hideHeader: !0,
132
+ dynamic: !0,
133
+ placeholder: "empty"
134
+ }), {
135
+ version: "2.0",
136
+ groups: l
137
+ };
138
+ }
139
+ function B(i) {
140
+ let l = i.nav !== null, u = i.surface !== void 0, f = !!i.surface, te = i.nav || "session-list", p = i.center ?? "chat", ne = i.surface || "artifact-surface", y = he(), [re, ie] = pe(i.storageKey ? `${i.storageKey}:drawerWidth` : void 0, 260), [ae, oe] = pe(i.storageKey ? `${i.storageKey}:surfaceWidth` : void 0, 680), [se, ce] = pe(i.storageKey ? `${i.storageKey}:sidebarWidth` : void 0, 280), [S, C] = me(i.storageKey ? `${i.storageKey}:chatCollapsed` : void 0, !1), [le, w] = v(!1), { blockers: T } = o(), E = i.activeChatPaneId ?? i.centerParams?.sessionId, ue = g(() => T.filter((e) => !e.sessionId || !E || e.sessionId === E), [E, T]), de = g(() => T.some((e) => !!e.sessionId && !!ee(e)), [T]), D = s(), O = V(re, 200, 360), k = V(se, 200, Math.max(240, Math.floor(y * .5))), A = Math.max(480, Math.floor(y * .72)), j = V(ae, 480, A), M = H(i.centerParams, "getSurface"), N = H(i.centerParams, "isWorkbenchOpen"), P = H(i.centerParams, "openWorkbench"), F = H(i.centerParams, "openWorkbenchSources"), I = H(i.centerParams, "closeWorkbench"), fe = _e(i.centerParams, "surfaceDispatch"), L = U(i.navParams, "onClose"), R = U(i.surfaceParams, "onClose"), z = U(i.sidebarParams, "onClose"), B = U(i.navParams, "onCreate"), G = i.chatPanes?.filter((e) => e.id.length > 0) ?? [], Se = G.length > 0, K = !!i.sidebar, q = l ? !!L : !!i.onOpenNav, J = f ? !!R : !!i.onOpenSurface, Y = K ? !!z : !!i.onOpenSidebar, X = m(() => {
141
+ if (l) {
142
+ L?.();
143
+ return;
144
+ }
145
+ i.onOpenNav?.();
146
+ }, [
147
+ L,
148
+ l,
149
+ i.onOpenNav
150
+ ]), Z = m(() => {
151
+ if (f) {
152
+ R?.();
153
+ return;
154
+ }
155
+ i.onOpenSurface?.();
156
+ }, [
157
+ R,
158
+ i.onOpenSurface,
159
+ f
160
+ ]), Q = m(() => {
161
+ if (K) {
162
+ z?.();
163
+ return;
164
+ }
165
+ i.onOpenSidebar?.();
166
+ }, [
167
+ z,
168
+ i.onOpenSidebar,
169
+ K
170
+ ]), $ = m(() => {
171
+ S && C(!1), l && L?.(), f && R?.(), ve(), ye();
172
+ }, [
173
+ S,
174
+ L,
175
+ R,
176
+ l,
177
+ C,
178
+ f
179
+ ]), Ce = _(!1), we = m(() => {
180
+ !S && i.chatOverlay && (Ce.current = !0), C((e) => {
181
+ let t = !e;
182
+ return t && !f && i.onOpenSurface?.(), t;
183
+ }), w(!1);
184
+ }, [
185
+ S,
186
+ i.chatOverlay,
187
+ i.onOpenSurface,
188
+ C,
189
+ f
190
+ ]);
191
+ c({ shortcuts: g(() => {
192
+ let e = [];
193
+ return q && e.push({
194
+ key: "1",
195
+ mod: !0,
196
+ handler: X
197
+ }), J && e.push({
198
+ key: "2",
199
+ mod: !0,
200
+ handler: Z
201
+ }), Y && e.push({
202
+ key: "3",
203
+ mod: !0,
204
+ allowInEditable: !0,
205
+ handler: Q
206
+ }), p === "chat" && (e.push({
207
+ key: "Escape",
208
+ allowInEditable: !0,
209
+ handler: $
210
+ }), e.push({
211
+ key: "\\",
212
+ mod: !0,
213
+ allowInEditable: !0,
214
+ handler: we
215
+ })), e;
216
+ }, [
217
+ q,
218
+ Y,
219
+ J,
220
+ p,
221
+ $,
222
+ we,
223
+ X,
224
+ Q,
225
+ Z
226
+ ]) }), h(() => {
227
+ let e = "workspace:chat-layout", t = "agent:chat-layout";
228
+ return D.unregisterByPluginId(e), D.unregisterByPluginId(t), D.registerCommand({
229
+ id: "workspace:open-session-history",
230
+ title: l ? "Close Session History" : "Open Session History",
231
+ keywords: [
232
+ "sessions",
233
+ "history",
234
+ "drawer",
235
+ l ? "close" : "open"
236
+ ],
237
+ shortcut: "⌘1",
238
+ pluginId: e,
239
+ when: () => q,
240
+ run: X
241
+ }), D.registerCommand({
242
+ id: "workspace:open-workbench",
243
+ title: f ? "Close Workbench" : "Open Workbench",
244
+ keywords: [
245
+ "surface",
246
+ "artifacts",
247
+ "sources",
248
+ "workbench",
249
+ f ? "close" : "open"
250
+ ],
251
+ shortcut: "⌘2",
252
+ pluginId: e,
253
+ when: () => J,
254
+ run: Z
255
+ }), D.registerCommand({
256
+ id: "workspace:toggle-workbench-left-panel",
257
+ title: K ? "Close Workbench Left Panel" : "Open Workbench Left Panel",
258
+ keywords: [
259
+ "left",
260
+ "sidebar",
261
+ "tabs",
262
+ "workbench",
263
+ K ? "close" : "open"
264
+ ],
265
+ shortcut: "⌘3",
266
+ pluginId: e,
267
+ when: () => Y,
268
+ run: Q
269
+ }), p === "chat" && D.registerCommand({
270
+ id: "agent:focus-chat",
271
+ title: "Focus Chat",
272
+ keywords: [
273
+ "agent",
274
+ "chat",
275
+ "prompt",
276
+ "composer",
277
+ "input",
278
+ "focus"
279
+ ],
280
+ pluginId: t,
281
+ run: $
282
+ }), B && D.registerCommand({
283
+ id: "agent:new-chat",
284
+ title: "New Chat",
285
+ keywords: [
286
+ "agent",
287
+ "chat",
288
+ "session",
289
+ "new"
290
+ ],
291
+ pluginId: t,
292
+ run: B
293
+ }), () => {
294
+ D.unregisterByPluginId(e), D.unregisterByPluginId(t);
295
+ };
296
+ }, [
297
+ D,
298
+ l,
299
+ p,
300
+ u,
301
+ f,
302
+ i.navParams,
303
+ i.surfaceParams,
304
+ i.onOpenNav,
305
+ i.onOpenSurface,
306
+ i.onOpenSidebar,
307
+ q,
308
+ J,
309
+ Y,
310
+ L,
311
+ R,
312
+ z,
313
+ B,
314
+ $,
315
+ K,
316
+ X,
317
+ Z,
318
+ Q
319
+ ]), h(() => {
320
+ let e = fe ?? (M && N && P ? {
321
+ surface: M,
322
+ isWorkbenchOpen: N,
323
+ openWorkbench: P,
324
+ openWorkbenchSources: F,
325
+ closeWorkbench: I,
326
+ shouldOpenSurface: (e) => e.meta?.openOnlyWhenSessionOpen !== !0
327
+ } : void 0);
328
+ if (e) return n.on(r.uiCommand, ({ command: n }) => {
329
+ t(n, e);
330
+ });
331
+ }, [
332
+ fe,
333
+ M,
334
+ N,
335
+ P,
336
+ F,
337
+ I
338
+ ]), e(r.agentData, () => {
339
+ S && w(!0);
340
+ }), h(() => {
341
+ if (!S) {
342
+ w(!1);
343
+ return;
344
+ }
345
+ ue.length > 0 && (C(!1), w(!1), ye());
346
+ }, [
347
+ ue.length,
348
+ S,
349
+ C
350
+ ]);
351
+ let Te = _(E);
352
+ h(() => {
353
+ let e = Te.current;
354
+ Te.current = E, e !== void 0 && E !== void 0 && E !== e && S && C(!1);
355
+ }, [
356
+ E,
357
+ S,
358
+ C
359
+ ]), h(() => {
360
+ !f || S || i.chatOverlay || y < 1180 && C(!0);
361
+ }, [
362
+ S,
363
+ i.chatOverlay,
364
+ C,
365
+ f,
366
+ y
367
+ ]), h(() => {
368
+ if (!(!i.chatOverlay || !S)) {
369
+ if (Ce.current) {
370
+ Ce.current = !1;
371
+ return;
372
+ }
373
+ C(!1);
374
+ }
375
+ }, [
376
+ S,
377
+ i.chatOverlay,
378
+ C
379
+ ]);
380
+ let Ee = _(f);
381
+ return h(() => {
382
+ let e = Ee.current;
383
+ Ee.current = f, e && !f && S && C(!1);
384
+ }, [
385
+ f,
386
+ S,
387
+ C
388
+ ]), /* @__PURE__ */ x("div", {
389
+ "data-boring-workspace": "",
390
+ "data-boring-workspace-part": "shell",
391
+ className: d("relative flex h-full min-h-0 w-full overflow-hidden bg-background", i.className),
392
+ children: [
393
+ /* @__PURE__ */ x("aside", {
394
+ "data-boring-workspace-part": "session-drawer",
395
+ "data-boring-state": l ? "expanded" : "collapsed",
396
+ "aria-label": "Session browser",
397
+ "aria-hidden": !l,
398
+ className: d("relative h-full min-h-0 shrink-0 overflow-hidden bg-background", "transition-[width,min-width,max-width] duration-[280ms] ease-[cubic-bezier(0.22,1,0.36,1)]", l ? "z-30 border-r border-[color:oklch(from_var(--border)_l_c_h/0.6)]" : "pointer-events-none z-0"),
399
+ style: {
400
+ width: l ? O : 0,
401
+ minWidth: l ? O : 0,
402
+ maxWidth: l ? O : 0,
403
+ willChange: "width"
404
+ },
405
+ children: [/* @__PURE__ */ b("div", {
406
+ className: d("h-full min-h-0 overflow-hidden", "transition-opacity duration-[200ms] ease-[cubic-bezier(0.22,1,0.36,1)]", l ? "opacity-100" : "invisible pointer-events-none opacity-0"),
407
+ children: /* @__PURE__ */ b(W, {
408
+ id: te,
409
+ params: i.navParams
410
+ })
411
+ }), l ? /* @__PURE__ */ b(ge, {
412
+ side: "drawer-right",
413
+ ariaLabel: "Resize sessions drawer",
414
+ onResize: (e) => ie((t) => V(t + e, 200, 360))
415
+ }) : null]
416
+ }),
417
+ /* @__PURE__ */ x("aside", {
418
+ "data-boring-workspace-part": "workbench-left-shell",
419
+ "data-boring-state": K ? "expanded" : "collapsed",
420
+ "aria-label": K ? "Workbench left panel" : void 0,
421
+ "aria-hidden": !K,
422
+ className: d("relative h-full min-h-0 shrink-0 overflow-hidden bg-background", "transition-[width,min-width,max-width] duration-[280ms] ease-[cubic-bezier(0.22,1,0.36,1)]", K && "border-r border-[color:oklch(from_var(--border)_l_c_h/0.6)]"),
423
+ style: {
424
+ width: K ? k : 0,
425
+ minWidth: K ? k : 0,
426
+ maxWidth: K ? k : 0,
427
+ willChange: "width"
428
+ },
429
+ children: [/* @__PURE__ */ b("div", {
430
+ className: d("h-full min-h-0 overflow-hidden", "transition-opacity duration-[200ms] ease-[cubic-bezier(0.22,1,0.36,1)]", K ? "opacity-100" : "opacity-0"),
431
+ children: K ? /* @__PURE__ */ b(W, {
432
+ id: i.sidebar ?? "workbench-left",
433
+ params: i.sidebarParams
434
+ }) : null
435
+ }), K ? /* @__PURE__ */ b(ge, {
436
+ side: "drawer-right",
437
+ ariaLabel: "Resize workbench left panel",
438
+ onResize: (e) => ce((t) => V(t + e, 200, Math.max(240, Math.floor(y * .5))))
439
+ }) : null]
440
+ }),
441
+ /* @__PURE__ */ x("div", {
442
+ className: "relative flex h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-background",
443
+ children: [/* @__PURE__ */ x("main", {
444
+ "data-boring-workspace-part": "chat-stage",
445
+ "data-boring-state": S ? "collapsed" : "expanded",
446
+ "aria-label": S ? "Collapsed chat" : "Chat",
447
+ "aria-hidden": S,
448
+ className: d("relative h-full min-h-0 min-w-0 overflow-hidden bg-background", "transition-[flex-grow,flex-basis,width,min-width,max-width] duration-[280ms] ease-[cubic-bezier(0.22,1,0.36,1)]", S ? "min-w-0 flex-[0_0_0px]" : "flex-1 border-r border-[color:oklch(from_var(--border)_l_c_h/0.6)]"),
449
+ children: [/* @__PURE__ */ b("div", {
450
+ className: d("h-full min-h-0 overflow-hidden", "transition-opacity duration-[200ms] ease-[cubic-bezier(0.22,1,0.36,1)]", S ? "opacity-0" : "opacity-100"),
451
+ children: Se ? /* @__PURE__ */ b(a, {
452
+ panes: G,
453
+ topActions: i.chatTopActions,
454
+ activePaneId: i.activeChatPaneId,
455
+ onActivePaneChange: i.onActiveChatPaneChange,
456
+ onClosePane: i.onCloseChatPane,
457
+ flashPaneId: i.flashChatPaneId,
458
+ storageKey: i.storageKey,
459
+ onDropSession: i.onDropChatSession,
460
+ renderPane: (e) => /* @__PURE__ */ b(W, {
461
+ id: e.panel ?? p,
462
+ params: e.params ?? i.centerParams
463
+ })
464
+ }) : /* @__PURE__ */ b(W, {
465
+ id: p,
466
+ params: i.centerParams
467
+ })
468
+ }), i.chatOverlay ? /* @__PURE__ */ b("div", {
469
+ "data-boring-workspace-part": "chat-left-overlay",
470
+ "aria-hidden": S,
471
+ className: "absolute inset-0 z-40 flex bg-background",
472
+ children: /* @__PURE__ */ b("div", {
473
+ className: "flex h-full w-full flex-col border-r border-border bg-background",
474
+ children: i.chatOverlay
475
+ })
476
+ }) : null]
477
+ }), u ? /* @__PURE__ */ x("aside", {
478
+ "data-boring-workspace-part": "workbench",
479
+ "data-boring-state": f ? "expanded" : "collapsed",
480
+ "aria-label": f ? "Surface" : void 0,
481
+ "aria-hidden": !f,
482
+ className: d("relative h-full min-h-0 overflow-hidden bg-background", S && f ? "min-w-0 flex-1" : "shrink-0", "transition-[flex-grow,flex-basis,width,min-width,max-width] duration-[280ms] ease-[cubic-bezier(0.22,1,0.36,1)]", f && "border-l border-[color:oklch(from_var(--border)_l_c_h/0.6)]"),
483
+ style: S && f ? { willChange: "width" } : {
484
+ width: f ? j : 0,
485
+ minWidth: f ? j : 0,
486
+ maxWidth: f ? j : 0,
487
+ willChange: "width"
488
+ },
489
+ children: [/* @__PURE__ */ b("div", {
490
+ className: d("h-full min-h-0 overflow-hidden", "transition-[opacity,padding] duration-[200ms] ease-[cubic-bezier(0.22,1,0.36,1)]", f ? "opacity-100" : "opacity-0"),
491
+ children: i.surfaceOverlay ? /* @__PURE__ */ b("div", {
492
+ className: "relative h-full min-h-0",
493
+ children: i.surfaceOverlay
494
+ }) : /* @__PURE__ */ b(W, {
495
+ id: ne,
496
+ params: i.surfaceParams
497
+ })
498
+ }), f && !S ? /* @__PURE__ */ b(ge, {
499
+ side: "surface-left",
500
+ ariaLabel: "Resize workbench",
501
+ onResize: (e) => oe((t) => V(t - e, 480, A))
502
+ }) : null]
503
+ }) : null]
504
+ }),
505
+ /* @__PURE__ */ b(be, {
506
+ surfaceOpen: f,
507
+ canToggleSurface: J,
508
+ onToggleSurface: Z,
509
+ chatCollapsed: S,
510
+ canToggleChat: p === "chat" && (!u || f && !S),
511
+ onToggleChat: we,
512
+ chatPulse: le || T.length > 0,
513
+ surfaceConfigured: u
514
+ }),
515
+ !l && i.onOpenNav ? /* @__PURE__ */ b(xe, {
516
+ side: "left",
517
+ icon: "sessions",
518
+ onClick: i.onOpenNav,
519
+ label: "Sessions",
520
+ hint: "⌘1",
521
+ pulse: de
522
+ }) : null,
523
+ !S && !l && Se && i.onCreateChatPaneAfter ? /* @__PURE__ */ b(xe, {
524
+ side: "left",
525
+ icon: "plus",
526
+ onClick: () => {
527
+ let e = i.activeChatPaneId ?? G[G.length - 1]?.id;
528
+ e && i.onCreateChatPaneAfter?.(e);
529
+ },
530
+ label: "New chat",
531
+ stackIndex: +!!i.onOpenNav
532
+ }) : null
533
+ ]
534
+ });
535
+ }
536
+ function V(e, t, n) {
537
+ return Math.max(t, Math.min(n, e));
538
+ }
539
+ function pe(e, t) {
540
+ let [n, r] = v(() => e ? F(e, t) : t);
541
+ return h(() => {
542
+ r(e ? F(e, t) : t);
543
+ }, [e, t]), [n, m((t) => {
544
+ r((n) => {
545
+ let r = typeof t == "function" ? t(n) : t;
546
+ return e && I(e, r), r;
547
+ });
548
+ }, [e])];
549
+ }
550
+ function me(e, t) {
551
+ let [n, r] = v(() => !e || typeof window > "u" ? t : window.localStorage.getItem(e) === "1");
552
+ return h(() => {
553
+ if (!e || typeof window > "u") {
554
+ r(t);
555
+ return;
556
+ }
557
+ let n = window.localStorage.getItem(e);
558
+ r(n == null ? t : n === "1");
559
+ }, [e, t]), [n, m((t) => {
560
+ r((n) => {
561
+ let r = typeof t == "function" ? t(n) : t;
562
+ return e && typeof window < "u" && window.localStorage.setItem(e, r ? "1" : "0"), r;
563
+ });
564
+ }, [e])];
565
+ }
566
+ function he() {
567
+ let [e, t] = v(() => typeof window < "u" ? window.innerWidth : 1200);
568
+ return h(() => {
569
+ let e = () => t(window.innerWidth);
570
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
571
+ }, []), e;
572
+ }
573
+ function ge({ side: e, ariaLabel: t, onResize: n }) {
574
+ let r = _(null), i = m((e) => {
575
+ e.preventDefault(), r.current = e.clientX, e.currentTarget.setPointerCapture(e.pointerId), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
576
+ }, []), a = m((e) => {
577
+ if (r.current === null) return;
578
+ let t = e.clientX - r.current;
579
+ r.current = e.clientX, n(t);
580
+ }, [n]), o = m((e) => {
581
+ r.current !== null && (r.current = null, e.currentTarget.releasePointerCapture(e.pointerId), document.body.style.cursor = "", document.body.style.userSelect = "");
582
+ }, []);
583
+ return /* @__PURE__ */ b(ue, {
584
+ "aria-label": t,
585
+ orientation: "vertical",
586
+ onResizeStart: i,
587
+ onPointerMove: a,
588
+ onPointerUp: o,
589
+ onPointerCancel: o,
590
+ className: d("absolute -top-px -bottom-px z-20 w-3 bg-transparent hover:!bg-transparent active:!bg-transparent", "after:absolute after:inset-y-2 after:left-1/2 after:w-px after:-translate-x-1/2 after:rounded-full after:bg-border/55", "after:transition-[width,background-color] after:duration-150 hover:after:w-1 hover:after:bg-foreground/35 active:after:w-1 active:after:bg-foreground/50", e === "drawer-right" ? "right-0" : "-left-1.5")
591
+ });
592
+ }
593
+ function _e(e, t) {
594
+ let n = e?.[t];
595
+ if (!n || typeof n != "object") return;
596
+ let r = n;
597
+ return typeof r.surface == "function" && typeof r.isWorkbenchOpen == "function" && typeof r.openWorkbench == "function" ? r : void 0;
598
+ }
599
+ function H(e, t) {
600
+ let n = e?.[t];
601
+ return typeof n == "function" ? n : void 0;
602
+ }
603
+ function U(e, t) {
604
+ return H(e, t);
605
+ }
606
+ function ve() {
607
+ typeof document > "u" || (document.querySelector("[data-boring-workspace-part=\"chat-pane\"][data-boring-state=\"active\"]") ?? document).querySelector("[data-boring-agent] textarea[name=\"message\"], textarea[name=\"message\"]")?.focus();
608
+ }
609
+ function ye() {
610
+ typeof window > "u" || window.requestAnimationFrame(() => {
611
+ ve(), window.setTimeout(ve, 320);
612
+ });
613
+ }
614
+ function W({ id: e, params: t }) {
615
+ let n = u(), { debug: r } = l(), i = g(() => n.getComponents(), [n, y(n.subscribe, n.getSnapshot, n.getSnapshot)])[e], a = g(() => G(e), [e]);
616
+ return i ? /* @__PURE__ */ b(f, {
617
+ fallback: /* @__PURE__ */ b(E, { centered: !0 }),
618
+ children: /* @__PURE__ */ b(i, {
619
+ params: {
620
+ ...t,
621
+ debug: r
622
+ },
623
+ api: a,
624
+ containerApi: {}
625
+ })
626
+ }) : null;
627
+ }
628
+ function G(e) {
629
+ return {
630
+ id: e,
631
+ title: e,
632
+ setTitle: () => {},
633
+ setActive: () => {},
634
+ close: () => {},
635
+ updateParameters: () => {},
636
+ onDidParametersChange: () => ({ dispose() {} }),
637
+ onDidActiveChange: () => ({ dispose() {} }),
638
+ onDidDimensionsChange: () => ({ dispose() {} }),
639
+ onDidLocationChange: () => ({ dispose() {} }),
640
+ onDidTitleChange: () => ({ dispose() {} }),
641
+ onWillFocus: () => ({ dispose() {} }),
642
+ onDidFocus: () => ({ dispose() {} }),
643
+ onDidBlur: () => ({ dispose() {} }),
644
+ onWillVisibilityChange: () => ({ dispose() {} }),
645
+ onDidVisibilityChange: () => ({ dispose() {} }),
646
+ onDidConstraintsChange: () => ({ dispose() {} })
647
+ };
648
+ }
649
+ function be({ surfaceOpen: e, canToggleSurface: t, onToggleSurface: n, chatCollapsed: r, canToggleChat: i, onToggleChat: a, chatPulse: o, surfaceConfigured: s }) {
650
+ let c = t, l = i;
651
+ return !c && !l ? null : /* @__PURE__ */ x("div", {
652
+ className: "pointer-events-none absolute right-3 top-2.5 z-[70] flex items-center gap-1",
653
+ children: [l ? /* @__PURE__ */ b(R, {
654
+ label: r ? "Show chat" : s ? "Expand workbench" : "Collapse chat",
655
+ hint: "⌘\\\\",
656
+ onClick: a,
657
+ pressed: r,
658
+ pulse: o,
659
+ children: b(r ? oe : ie, {
660
+ className: "size-3",
661
+ strokeWidth: 1.75
662
+ })
663
+ }) : null, c ? /* @__PURE__ */ b(R, {
664
+ label: e ? "Close workbench" : "Open workbench",
665
+ hint: "⌘2",
666
+ onClick: n,
667
+ pressed: e,
668
+ children: b(e ? se : ce, {
669
+ className: "size-3",
670
+ strokeWidth: 1.75
671
+ })
672
+ }) : null]
673
+ });
674
+ }
675
+ function xe({ side: e, icon: t, onClick: n, label: r, hint: a, bottomOffset: o, stackIndex: s = 0, pulse: c = !1 }) {
676
+ let l = e === "right" && o !== void 0, u = s * 44;
677
+ return /* @__PURE__ */ b(i, {
678
+ label: r,
679
+ hint: a,
680
+ side: e === "left" ? "right" : "left",
681
+ children: /* @__PURE__ */ b(w, {
682
+ type: "button",
683
+ variant: "ghost",
684
+ size: "icon-sm",
685
+ onClick: n,
686
+ "aria-label": r,
687
+ className: d("absolute z-30 h-9 w-9 gap-0.5 rounded-lg bg-background text-muted-foreground", e === "left" ? "left-2" : "right-2", l ? "hover:-translate-y-0.5" : "top-1/2 hover:-translate-y-[1px]", "shadow-[0_1px_2px_-1px_oklch(0_0_0/0.08),0_2px_8px_-4px_oklch(0_0_0/0.10),inset_0_0_0_1px_oklch(from_var(--border)_l_c_h/0.7)]", "hover:bg-muted/60 hover:text-foreground hover:shadow-[0_2px_4px_-1px_oklch(0_0_0/0.08),0_4px_12px_-4px_oklch(0_0_0/0.10),inset_0_0_0_1px_oklch(from_var(--border)_l_c_h/0.9)]", "focus-visible:ring-ring/40"),
688
+ style: l ? { bottom: o } : { transform: `translateY(calc(-50% - ${u}px))` },
689
+ children: t === "sessions" ? /* @__PURE__ */ x("span", {
690
+ className: "relative flex items-center justify-center",
691
+ children: [/* @__PURE__ */ x("svg", {
692
+ width: "15",
693
+ height: "15",
694
+ viewBox: "0 0 24 24",
695
+ fill: "none",
696
+ "aria-hidden": "true",
697
+ children: [/* @__PURE__ */ b("circle", {
698
+ cx: "12",
699
+ cy: "12",
700
+ r: "9",
701
+ stroke: "currentColor",
702
+ strokeWidth: "1.8"
703
+ }), /* @__PURE__ */ b("path", {
704
+ d: "M12 7v5l3.2 2",
705
+ stroke: "currentColor",
706
+ strokeWidth: "1.8",
707
+ strokeLinecap: "round"
708
+ })]
709
+ }), c ? /* @__PURE__ */ b("span", {
710
+ className: "absolute -right-1.5 -top-1.5 h-2 w-2 rounded-full bg-[color:var(--accent)]",
711
+ "aria-hidden": "true",
712
+ "data-boring-workspace-part": "edge-attention-dot"
713
+ }) : null]
714
+ }) : t === "chat" ? /* @__PURE__ */ x("span", {
715
+ className: "relative flex items-center justify-center",
716
+ children: [/* @__PURE__ */ b(ae, {
717
+ className: "h-[15px] w-[15px]",
718
+ strokeWidth: 1.8,
719
+ "aria-hidden": "true"
720
+ }), c ? /* @__PURE__ */ b("span", {
721
+ className: "absolute -right-1.5 -top-1.5 h-2 w-2 rounded-full bg-[color:var(--accent)]",
722
+ "aria-hidden": "true"
723
+ }) : null]
724
+ }) : t === "plus" ? /* @__PURE__ */ b("svg", {
725
+ width: "15",
726
+ height: "15",
727
+ viewBox: "0 0 24 24",
728
+ fill: "none",
729
+ "aria-hidden": "true",
730
+ children: /* @__PURE__ */ b("path", {
731
+ d: "M12 5v14M5 12h14",
732
+ stroke: "currentColor",
733
+ strokeWidth: "1.8",
734
+ strokeLinecap: "round"
735
+ })
736
+ }) : /* @__PURE__ */ b("svg", {
737
+ width: "15",
738
+ height: "15",
739
+ viewBox: "0 0 24 24",
740
+ fill: "none",
741
+ "aria-hidden": "true",
742
+ children: /* @__PURE__ */ b("path", {
743
+ d: "M3 7.5 A1.5 1.5 0 0 1 4.5 6 h4 l2 2 h9 A1.5 1.5 0 0 1 21 9.5 V17.5 A1.5 1.5 0 0 1 19.5 19 H4.5 A1.5 1.5 0 0 1 3 17.5 Z",
744
+ stroke: "currentColor",
745
+ strokeWidth: "1.8",
746
+ strokeLinejoin: "round"
747
+ })
748
+ })
749
+ })
750
+ });
751
+ }
752
+ //#endregion
753
+ //#region src/front/layout/TopBar.tsx
754
+ function Se({ appTitle: e = "Boring", sessionTitle: t, onCommandPalette: n, onNewChat: r, topBarLeft: i, topBarRight: a, className: o }) {
755
+ let s = a ?? null, c = t || e;
756
+ return /* @__PURE__ */ x("header", {
757
+ "data-boring-workspace-part": "topbar",
758
+ className: d("relative flex h-11 items-center justify-between gap-2 px-3", "bg-background border-b border-border", o),
759
+ "aria-label": "App top bar",
760
+ children: [
761
+ /* @__PURE__ */ b("div", {
762
+ className: "flex min-w-0 flex-1 items-center gap-2.5 leading-none",
763
+ children: i ?? /* @__PURE__ */ x(re, { children: [/* @__PURE__ */ b("span", {
764
+ "aria-hidden": "true",
765
+ className: "grid size-[22px] shrink-0 place-items-center rounded-sm bg-foreground text-[11px] font-semibold leading-none tracking-tight text-background",
766
+ children: (c?.[0] ?? "B").toUpperCase()
767
+ }), /* @__PURE__ */ b("span", {
768
+ className: "truncate text-[13px] font-medium leading-none tracking-tight text-foreground",
769
+ children: c
770
+ })] })
771
+ }),
772
+ /* @__PURE__ */ x(le, {
773
+ type: "button",
774
+ variant: "ghost",
775
+ size: "sm",
776
+ onClick: n,
777
+ className: "group h-7 gap-1.5 px-2 text-[13px] leading-none text-muted-foreground/75 hover:bg-muted/70 hover:text-foreground focus-visible:text-foreground",
778
+ "aria-label": "Search catalogs and commands",
779
+ title: "Command palette (⌘K)",
780
+ children: [
781
+ /* @__PURE__ */ b(C, {
782
+ className: "h-3.5 w-3.5 shrink-0 opacity-80",
783
+ strokeWidth: 1.75
784
+ }),
785
+ /* @__PURE__ */ b("span", {
786
+ className: "font-normal tracking-tight",
787
+ children: "Search"
788
+ }),
789
+ /* @__PURE__ */ b(T, {
790
+ className: "ml-0.5 bg-muted/40 leading-none shadow-none",
791
+ children: "⌘K"
792
+ })
793
+ ]
794
+ }),
795
+ /* @__PURE__ */ x("div", {
796
+ className: "flex flex-1 shrink-0 items-center justify-end gap-1",
797
+ children: [r && /* @__PURE__ */ b(w, {
798
+ type: "button",
799
+ variant: "ghost",
800
+ size: "icon-sm",
801
+ onClick: r,
802
+ "aria-label": "New chat",
803
+ title: "New chat",
804
+ children: /* @__PURE__ */ b(S, { className: "h-4 w-4" })
805
+ }), s]
806
+ })
807
+ ]
808
+ });
809
+ }
810
+ //#endregion
811
+ //#region src/front/components/WorkspaceLoadingState.tsx
812
+ function K({ title: e = "Loading workspace", description: t = "Preparing the workspace context.", status: n = "Loading", fullscreen: r = !0, className: i }) {
813
+ return /* @__PURE__ */ b("section", {
814
+ role: "status",
815
+ "aria-live": "polite",
816
+ "aria-busy": "true",
817
+ className: d("flex h-full w-full items-center justify-center bg-background px-6 text-foreground", r ? "min-h-screen" : "min-h-[240px]", i),
818
+ children: /* @__PURE__ */ x("div", {
819
+ className: "flex w-full max-w-sm flex-col items-center gap-5 text-center",
820
+ children: [
821
+ /* @__PURE__ */ b("div", {
822
+ className: "flex h-11 w-11 items-center justify-center rounded-lg border border-border bg-card text-foreground",
823
+ children: /* @__PURE__ */ b("span", {
824
+ "aria-hidden": "true",
825
+ className: "h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent opacity-70"
826
+ })
827
+ }),
828
+ /* @__PURE__ */ x("div", {
829
+ className: "space-y-2",
830
+ children: [/* @__PURE__ */ b("h2", {
831
+ className: "text-base font-medium text-foreground",
832
+ children: e
833
+ }), t ? /* @__PURE__ */ b("p", {
834
+ className: "text-sm leading-6 text-muted-foreground",
835
+ children: t
836
+ }) : null]
837
+ }),
838
+ n ? /* @__PURE__ */ b("p", {
839
+ className: "text-xs font-medium text-muted-foreground/80",
840
+ children: n
841
+ }) : null
842
+ ]
843
+ })
844
+ });
845
+ }
846
+ //#endregion
847
+ export { N as a, I as c, D as d, O as f, z as i, j as l, Se as n, F as o, B as r, P as s, K as t, M as u };