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