@hachej/boring-workspace 0.1.30 → 0.1.32
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/FileTree-BltQETt9.js +289 -0
- package/dist/{MarkdownEditor-DPBSzTBz.js → MarkdownEditor-heUJdK4j.js} +1 -1
- package/dist/WorkspaceLoadingState-InXsc_8G.js +719 -0
- package/dist/{WorkspaceProvider-0V-2x7AH.js → WorkspaceProvider-Cg-J1wxr.js} +2750 -2570
- package/dist/app-front.d.ts +22 -2
- package/dist/app-front.js +672 -524
- package/dist/app-server.d.ts +21 -4
- package/dist/app-server.js +277 -104
- package/dist/boring-workspace.css +1 -1
- package/dist/{createInMemoryBridge--ZFPAgXy.d.ts → createInMemoryBridge-HJopAIbo.d.ts} +12 -2
- package/dist/plugin.d.ts +2 -2
- package/dist/server.d.ts +62 -9
- package/dist/server.js +261 -46
- package/dist/shared.d.ts +2 -2
- package/dist/{surface-CEEkd81D.d.ts → surface-obE7YwJk.d.ts} +2 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.js +1 -1
- package/dist/{ui-bridge-Bdgl2hR8.d.ts → ui-bridge-DFNem0df.d.ts} +2 -2
- package/dist/workspace.css +79 -27
- package/dist/workspace.d.ts +88 -2
- package/dist/workspace.js +472 -386
- package/docs/PLUGIN_STRUCTURE.md +5 -4
- package/docs/PLUGIN_SYSTEM.md +6 -6
- package/docs/plans/archive/UNIFIED_PLUGIN_SYSTEM_PLAN.md +2 -2
- package/package.json +3 -3
- package/dist/FileTree-DUxjUbxL.js +0 -266
- package/dist/WorkspaceLoadingState-DJF_4S4_.js +0 -613
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
import { jsxs as u, jsx as r, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
+
import { useState as M, useCallback as p, useMemo as G, useEffect as k, useRef as T, useSyncExternalStore as fe, Suspense as me } from "react";
|
|
3
|
+
import { IconButton as E, LoadingState as ge, ResizeHandle as be, Button as we, Kbd as pe } from "@hachej/boring-ui-kit";
|
|
4
|
+
import { ChevronLeft as ve, MessageSquare as xe, Search as ke, Plus as ye } from "lucide-react";
|
|
5
|
+
import { c as m } from "./utils-B6yFEsav.js";
|
|
6
|
+
import { al as Ce, a2 as Se, ad as _e, G as Ne, aw as oe, au as We, a7 as Pe, u as Oe, ao as Ie } from "./WorkspaceProvider-Cg-J1wxr.js";
|
|
7
|
+
function Fe(e, t, a = !0) {
|
|
8
|
+
if (!a || 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 Ve(e, t, a = !0) {
|
|
18
|
+
if (!(!a || typeof window > "u"))
|
|
19
|
+
try {
|
|
20
|
+
window.localStorage.setItem(e, t ? "1" : "0");
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function ie(e, t, a = !0) {
|
|
25
|
+
if (!a || typeof window > "u") return t;
|
|
26
|
+
try {
|
|
27
|
+
const n = window.localStorage.getItem(e);
|
|
28
|
+
if (n === null) return t;
|
|
29
|
+
const c = Number(n);
|
|
30
|
+
return Number.isFinite(c) ? c : t;
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
function ze(e, t, a = !0) {
|
|
36
|
+
if (!(!a || typeof window > "u"))
|
|
37
|
+
try {
|
|
38
|
+
window.localStorage.setItem(e, String(Math.round(t)));
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function je(e = {}) {
|
|
43
|
+
const {
|
|
44
|
+
nav: t = "session-list",
|
|
45
|
+
navParams: a,
|
|
46
|
+
center: n = "chat",
|
|
47
|
+
centerParams: c,
|
|
48
|
+
surface: i,
|
|
49
|
+
surfaceParams: l,
|
|
50
|
+
sidebar: s,
|
|
51
|
+
sidebarParams: x
|
|
52
|
+
} = e, v = [];
|
|
53
|
+
return t && v.push({
|
|
54
|
+
id: "nav",
|
|
55
|
+
position: "left",
|
|
56
|
+
panel: t,
|
|
57
|
+
params: a,
|
|
58
|
+
locked: !0,
|
|
59
|
+
hideHeader: !0,
|
|
60
|
+
constraints: { minWidth: 60, maxWidth: 60 }
|
|
61
|
+
}), v.push({
|
|
62
|
+
id: "center",
|
|
63
|
+
position: "center",
|
|
64
|
+
panel: n,
|
|
65
|
+
params: c,
|
|
66
|
+
hideHeader: !0
|
|
67
|
+
}), s && v.push({
|
|
68
|
+
id: "sidebar",
|
|
69
|
+
position: "left",
|
|
70
|
+
panel: s,
|
|
71
|
+
params: x,
|
|
72
|
+
hideHeader: !0,
|
|
73
|
+
collapsible: !0,
|
|
74
|
+
collapsedWidth: 40,
|
|
75
|
+
constraints: { minWidth: 200, maxWidthViewportRatio: 0.5 }
|
|
76
|
+
}), i && v.push({
|
|
77
|
+
id: "surface",
|
|
78
|
+
position: "right",
|
|
79
|
+
panel: i,
|
|
80
|
+
params: l,
|
|
81
|
+
hideHeader: !0,
|
|
82
|
+
dynamic: !0,
|
|
83
|
+
placeholder: "empty"
|
|
84
|
+
}), { version: "2.0", groups: v };
|
|
85
|
+
}
|
|
86
|
+
function $e(e) {
|
|
87
|
+
var ne;
|
|
88
|
+
const t = e.nav !== null, a = e.surface !== void 0, n = !!e.surface, c = e.nav || "session-list", i = e.center ?? "chat", l = e.surface || "artifact-surface", s = Re(), [x, v] = se(
|
|
89
|
+
e.storageKey ? `${e.storageKey}:drawerWidth` : void 0,
|
|
90
|
+
260
|
|
91
|
+
), [le, ue] = se(
|
|
92
|
+
e.storageKey ? `${e.storageKey}:surfaceWidth` : void 0,
|
|
93
|
+
680
|
|
94
|
+
), [d, g] = Be(
|
|
95
|
+
e.storageKey ? `${e.storageKey}:chatCollapsed` : void 0,
|
|
96
|
+
!1
|
|
97
|
+
), [he, N] = M(!1), { blockers: H } = Ce(), b = Se(), K = D(x, 200, 360), Z = Math.max(480, Math.floor(s * 0.72)), F = D(le, 480, Z), V = S(e.centerParams, "getSurface"), j = S(e.centerParams, "isWorkbenchOpen"), $ = S(e.centerParams, "openWorkbench"), J = S(e.centerParams, "openWorkbenchSources"), Q = S(e.centerParams, "closeWorkbench"), w = A(e.navParams, "onClose"), f = A(e.surfaceParams, "onClose"), y = A(e.sidebarParams, "onClose"), U = A(e.navParams, "onCreate"), C = !!e.sidebar, W = t ? !!w : !!e.onOpenNav, P = n ? !!f : !!e.onOpenSurface, O = C ? !!y : !!e.onOpenSidebar, I = p(() => {
|
|
98
|
+
var o;
|
|
99
|
+
if (t) {
|
|
100
|
+
w == null || w();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
(o = e.onOpenNav) == null || o.call(e);
|
|
104
|
+
}, [w, t, e.onOpenNav]), z = p(() => {
|
|
105
|
+
var o;
|
|
106
|
+
if (n) {
|
|
107
|
+
f == null || f();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
(o = e.onOpenSurface) == null || o.call(e);
|
|
111
|
+
}, [f, e.onOpenSurface, n]), B = p(() => {
|
|
112
|
+
var o;
|
|
113
|
+
if (C) {
|
|
114
|
+
y == null || y();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
(o = e.onOpenSidebar) == null || o.call(e);
|
|
118
|
+
}, [y, e.onOpenSidebar, C]), R = p(() => {
|
|
119
|
+
d && g(!1), t && (w == null || w()), n && (f == null || f()), Y(), de();
|
|
120
|
+
}, [d, w, f, t, g, n]), L = p(() => {
|
|
121
|
+
g((o) => {
|
|
122
|
+
var re;
|
|
123
|
+
const h = !o;
|
|
124
|
+
return h && !n && ((re = e.onOpenSurface) == null || re.call(e)), h;
|
|
125
|
+
}), N(!1);
|
|
126
|
+
}, [g, n, e.onOpenSurface]);
|
|
127
|
+
_e({
|
|
128
|
+
shortcuts: G(() => {
|
|
129
|
+
const o = [];
|
|
130
|
+
return W && o.push({ key: "1", mod: !0, handler: I }), P && o.push({ key: "2", mod: !0, handler: z }), O && o.push({ key: "3", mod: !0, allowInEditable: !0, handler: B }), i === "chat" && (o.push({ key: "Escape", allowInEditable: !0, handler: R }), o.push({ key: "\\", mod: !0, allowInEditable: !0, handler: L })), o;
|
|
131
|
+
}, [W, O, P, i, R, L, I, B, z])
|
|
132
|
+
}), k(() => {
|
|
133
|
+
const o = "workspace:chat-layout", h = "agent:chat-layout";
|
|
134
|
+
return b.unregisterByPluginId(o), b.unregisterByPluginId(h), b.registerCommand({
|
|
135
|
+
id: "workspace:open-session-history",
|
|
136
|
+
title: t ? "Close Session History" : "Open Session History",
|
|
137
|
+
keywords: ["sessions", "history", "drawer", t ? "close" : "open"],
|
|
138
|
+
shortcut: "⌘1",
|
|
139
|
+
pluginId: o,
|
|
140
|
+
when: () => W,
|
|
141
|
+
run: I
|
|
142
|
+
}), b.registerCommand({
|
|
143
|
+
id: "workspace:open-workbench",
|
|
144
|
+
title: n ? "Close Workbench" : "Open Workbench",
|
|
145
|
+
keywords: ["surface", "artifacts", "sources", "workbench", n ? "close" : "open"],
|
|
146
|
+
shortcut: "⌘2",
|
|
147
|
+
pluginId: o,
|
|
148
|
+
when: () => P,
|
|
149
|
+
run: z
|
|
150
|
+
}), b.registerCommand({
|
|
151
|
+
id: "workspace:toggle-workbench-left-panel",
|
|
152
|
+
title: C ? "Close Workbench Left Panel" : "Open Workbench Left Panel",
|
|
153
|
+
keywords: ["left", "sidebar", "tabs", "workbench", C ? "close" : "open"],
|
|
154
|
+
shortcut: "⌘3",
|
|
155
|
+
pluginId: o,
|
|
156
|
+
when: () => O,
|
|
157
|
+
run: B
|
|
158
|
+
}), i === "chat" && b.registerCommand({
|
|
159
|
+
id: "agent:focus-chat",
|
|
160
|
+
title: "Focus Chat",
|
|
161
|
+
keywords: ["agent", "chat", "prompt", "composer", "input", "focus"],
|
|
162
|
+
pluginId: h,
|
|
163
|
+
run: R
|
|
164
|
+
}), U && b.registerCommand({
|
|
165
|
+
id: "agent:new-chat",
|
|
166
|
+
title: "New Chat",
|
|
167
|
+
keywords: ["agent", "chat", "session", "new"],
|
|
168
|
+
pluginId: h,
|
|
169
|
+
run: U
|
|
170
|
+
}), () => {
|
|
171
|
+
b.unregisterByPluginId(o), b.unregisterByPluginId(h);
|
|
172
|
+
};
|
|
173
|
+
}, [
|
|
174
|
+
b,
|
|
175
|
+
t,
|
|
176
|
+
i,
|
|
177
|
+
a,
|
|
178
|
+
n,
|
|
179
|
+
e.navParams,
|
|
180
|
+
e.surfaceParams,
|
|
181
|
+
e.onOpenNav,
|
|
182
|
+
e.onOpenSurface,
|
|
183
|
+
e.onOpenSidebar,
|
|
184
|
+
W,
|
|
185
|
+
P,
|
|
186
|
+
O,
|
|
187
|
+
w,
|
|
188
|
+
f,
|
|
189
|
+
y,
|
|
190
|
+
U,
|
|
191
|
+
R,
|
|
192
|
+
C,
|
|
193
|
+
I,
|
|
194
|
+
z,
|
|
195
|
+
B
|
|
196
|
+
]), k(() => {
|
|
197
|
+
if (!V || !j || !$) return;
|
|
198
|
+
const o = {
|
|
199
|
+
surface: V,
|
|
200
|
+
isWorkbenchOpen: j,
|
|
201
|
+
openWorkbench: $,
|
|
202
|
+
openWorkbenchSources: J,
|
|
203
|
+
closeWorkbench: Q
|
|
204
|
+
};
|
|
205
|
+
return Ne.on(oe.uiCommand, ({ command: h }) => {
|
|
206
|
+
We(h, o);
|
|
207
|
+
});
|
|
208
|
+
}, [V, j, $, J, Q]), Pe(oe.agentData, () => {
|
|
209
|
+
d && N(!0);
|
|
210
|
+
}), k(() => {
|
|
211
|
+
if (!d) {
|
|
212
|
+
N(!1);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
H.length > 0 && (g(!1), N(!1), de());
|
|
216
|
+
}, [H.length, d, g]);
|
|
217
|
+
const _ = (ne = e.centerParams) == null ? void 0 : ne.sessionId, ee = T(_);
|
|
218
|
+
k(() => {
|
|
219
|
+
const o = ee.current;
|
|
220
|
+
ee.current = _, o !== void 0 && _ !== void 0 && _ !== o && d && g(!1);
|
|
221
|
+
}, [_, d, g]);
|
|
222
|
+
const te = T(n);
|
|
223
|
+
return k(() => {
|
|
224
|
+
const o = te.current;
|
|
225
|
+
te.current = n, o && !n && d && g(!1);
|
|
226
|
+
}, [n, d, g]), /* @__PURE__ */ u(
|
|
227
|
+
"div",
|
|
228
|
+
{
|
|
229
|
+
"data-boring-workspace": "",
|
|
230
|
+
"data-boring-workspace-part": "shell",
|
|
231
|
+
className: m("relative flex h-full min-h-0 w-full overflow-hidden bg-background", e.className),
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ u(
|
|
234
|
+
"aside",
|
|
235
|
+
{
|
|
236
|
+
"data-boring-workspace-part": "session-drawer",
|
|
237
|
+
"data-boring-state": t ? "expanded" : "collapsed",
|
|
238
|
+
"aria-label": "Session browser",
|
|
239
|
+
"aria-hidden": !t,
|
|
240
|
+
className: m(
|
|
241
|
+
"relative h-full min-h-0 shrink-0 overflow-hidden bg-background",
|
|
242
|
+
"transition-[width,min-width,max-width] duration-[280ms] ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
243
|
+
t && "border-r border-[color:oklch(from_var(--border)_l_c_h/0.6)]"
|
|
244
|
+
),
|
|
245
|
+
style: {
|
|
246
|
+
width: t ? K : 0,
|
|
247
|
+
minWidth: t ? K : 0,
|
|
248
|
+
maxWidth: t ? K : 0,
|
|
249
|
+
willChange: "width"
|
|
250
|
+
},
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ r(
|
|
253
|
+
"div",
|
|
254
|
+
{
|
|
255
|
+
className: m(
|
|
256
|
+
"h-full min-h-0 overflow-hidden",
|
|
257
|
+
"transition-opacity duration-[200ms] ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
258
|
+
t ? "opacity-100" : "opacity-0"
|
|
259
|
+
),
|
|
260
|
+
children: /* @__PURE__ */ r(X, { id: c, params: e.navParams })
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
t ? /* @__PURE__ */ r(
|
|
264
|
+
ce,
|
|
265
|
+
{
|
|
266
|
+
side: "drawer-right",
|
|
267
|
+
ariaLabel: "Resize sessions drawer",
|
|
268
|
+
onResize: (o) => v((h) => D(h + o, 200, 360))
|
|
269
|
+
}
|
|
270
|
+
) : null
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
/* @__PURE__ */ u("div", { className: "relative flex h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-background", children: [
|
|
275
|
+
/* @__PURE__ */ u(
|
|
276
|
+
"main",
|
|
277
|
+
{
|
|
278
|
+
"data-boring-workspace-part": "chat-stage",
|
|
279
|
+
"data-boring-state": d ? "collapsed" : "expanded",
|
|
280
|
+
"aria-label": d ? "Collapsed chat" : "Chat",
|
|
281
|
+
"aria-hidden": d,
|
|
282
|
+
className: m(
|
|
283
|
+
"relative h-full min-h-0 min-w-0 overflow-hidden bg-background",
|
|
284
|
+
// Animate flex-grow (not just width) so the chat slides open/closed
|
|
285
|
+
// like the fixed-width nav/workbench panes instead of snapping.
|
|
286
|
+
"transition-[flex-grow,flex-basis,width,min-width,max-width] duration-[280ms] ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
287
|
+
d ? "min-w-0 flex-[0_0_0px]" : "flex-1 border-r border-[color:oklch(from_var(--border)_l_c_h/0.6)]"
|
|
288
|
+
),
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ r(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
className: m(
|
|
294
|
+
"h-full min-h-0 overflow-hidden",
|
|
295
|
+
"transition-opacity duration-[200ms] ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
296
|
+
d ? "opacity-0" : "opacity-100"
|
|
297
|
+
),
|
|
298
|
+
children: /* @__PURE__ */ r(X, { id: i, params: e.centerParams })
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
d ? null : /* @__PURE__ */ r(
|
|
302
|
+
E,
|
|
303
|
+
{
|
|
304
|
+
type: "button",
|
|
305
|
+
variant: "ghost",
|
|
306
|
+
size: "icon-xs",
|
|
307
|
+
onClick: L,
|
|
308
|
+
className: "absolute right-2 top-2 z-20",
|
|
309
|
+
"aria-label": "Collapse chat",
|
|
310
|
+
title: "Collapse chat (⌘\\\\)",
|
|
311
|
+
children: /* @__PURE__ */ r(ve, { className: "h-4 w-4", strokeWidth: 1.75 })
|
|
312
|
+
}
|
|
313
|
+
)
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
a ? /* @__PURE__ */ u(
|
|
318
|
+
"aside",
|
|
319
|
+
{
|
|
320
|
+
"data-boring-workspace-part": "workbench",
|
|
321
|
+
"data-boring-state": n ? "expanded" : "collapsed",
|
|
322
|
+
"aria-label": n ? "Surface" : void 0,
|
|
323
|
+
"aria-hidden": !n,
|
|
324
|
+
className: m(
|
|
325
|
+
"relative h-full min-h-0 overflow-hidden bg-background",
|
|
326
|
+
// When chat is collapsed the workbench grows to fill the freed
|
|
327
|
+
// space (full width); otherwise it's a fixed-width side panel.
|
|
328
|
+
d && n ? "min-w-0 flex-1" : "shrink-0",
|
|
329
|
+
"transition-[flex-grow,flex-basis,width,min-width,max-width] duration-[280ms] ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
330
|
+
n && "border-l border-[color:oklch(from_var(--border)_l_c_h/0.6)]"
|
|
331
|
+
),
|
|
332
|
+
style: d && n ? { willChange: "width" } : {
|
|
333
|
+
width: n ? F : 0,
|
|
334
|
+
minWidth: n ? F : 0,
|
|
335
|
+
maxWidth: n ? F : 0,
|
|
336
|
+
willChange: "width"
|
|
337
|
+
},
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ r(
|
|
340
|
+
"div",
|
|
341
|
+
{
|
|
342
|
+
className: m(
|
|
343
|
+
"h-full min-h-0 overflow-hidden",
|
|
344
|
+
"transition-[opacity,padding] duration-[200ms] ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
345
|
+
n ? "opacity-100" : "opacity-0",
|
|
346
|
+
// When the chat is collapsed the workbench fills the full width
|
|
347
|
+
// and the left-edge "expand chat" float button would sit on top
|
|
348
|
+
// of the filetree — inset the content to leave a clear gutter.
|
|
349
|
+
d && n && !t && "pl-14"
|
|
350
|
+
),
|
|
351
|
+
children: e.surfaceOverlay ? /* @__PURE__ */ u("div", { className: "relative h-full min-h-0", children: [
|
|
352
|
+
e.surfaceOverlay,
|
|
353
|
+
f ? /* @__PURE__ */ r(
|
|
354
|
+
E,
|
|
355
|
+
{
|
|
356
|
+
type: "button",
|
|
357
|
+
variant: "ghost",
|
|
358
|
+
size: "icon-sm",
|
|
359
|
+
onClick: f,
|
|
360
|
+
className: "absolute right-3 top-3 z-20 rounded-full bg-background/80 text-muted-foreground shadow-sm backdrop-blur hover:bg-muted hover:text-foreground",
|
|
361
|
+
"aria-label": "Close workbench",
|
|
362
|
+
title: "Close workbench (⌘2)",
|
|
363
|
+
children: /* @__PURE__ */ r("span", { "aria-hidden": "true", children: "›" })
|
|
364
|
+
}
|
|
365
|
+
) : null
|
|
366
|
+
] }) : /* @__PURE__ */ r(X, { id: l, params: e.surfaceParams })
|
|
367
|
+
}
|
|
368
|
+
),
|
|
369
|
+
n && !d ? /* @__PURE__ */ r(
|
|
370
|
+
ce,
|
|
371
|
+
{
|
|
372
|
+
side: "surface-left",
|
|
373
|
+
ariaLabel: "Resize workbench",
|
|
374
|
+
onResize: (o) => ue((h) => D(h - o, 480, Z))
|
|
375
|
+
}
|
|
376
|
+
) : null
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
) : null
|
|
380
|
+
] }),
|
|
381
|
+
!t && e.onOpenNav ? /* @__PURE__ */ r(
|
|
382
|
+
q,
|
|
383
|
+
{
|
|
384
|
+
side: "left",
|
|
385
|
+
icon: "sessions",
|
|
386
|
+
onClick: e.onOpenNav,
|
|
387
|
+
label: "Sessions",
|
|
388
|
+
hint: "⌘1"
|
|
389
|
+
}
|
|
390
|
+
) : null,
|
|
391
|
+
d ? /* @__PURE__ */ r(
|
|
392
|
+
q,
|
|
393
|
+
{
|
|
394
|
+
side: "left",
|
|
395
|
+
icon: "chat",
|
|
396
|
+
onClick: L,
|
|
397
|
+
label: "Expand chat",
|
|
398
|
+
hint: "⌘\\\\",
|
|
399
|
+
stackIndex: 1,
|
|
400
|
+
pulse: he || H.length > 0
|
|
401
|
+
}
|
|
402
|
+
) : null,
|
|
403
|
+
!n && e.onOpenSurface ? /* @__PURE__ */ r(
|
|
404
|
+
q,
|
|
405
|
+
{
|
|
406
|
+
side: "right",
|
|
407
|
+
icon: "workbench",
|
|
408
|
+
onClick: e.onOpenSurface,
|
|
409
|
+
label: "Workbench",
|
|
410
|
+
hint: "⌘2",
|
|
411
|
+
bottomOffset: e.surfaceButtonBottomOffset
|
|
412
|
+
}
|
|
413
|
+
) : null
|
|
414
|
+
]
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
function D(e, t, a) {
|
|
419
|
+
return Math.max(t, Math.min(a, e));
|
|
420
|
+
}
|
|
421
|
+
function se(e, t) {
|
|
422
|
+
const [a, n] = M(
|
|
423
|
+
() => e ? ie(e, t) : t
|
|
424
|
+
);
|
|
425
|
+
k(() => {
|
|
426
|
+
n(e ? ie(e, t) : t);
|
|
427
|
+
}, [e, t]);
|
|
428
|
+
const c = p(
|
|
429
|
+
(i) => {
|
|
430
|
+
n((l) => {
|
|
431
|
+
const s = typeof i == "function" ? i(l) : i;
|
|
432
|
+
return e && ze(e, s), s;
|
|
433
|
+
});
|
|
434
|
+
},
|
|
435
|
+
[e]
|
|
436
|
+
);
|
|
437
|
+
return [a, c];
|
|
438
|
+
}
|
|
439
|
+
function Be(e, t) {
|
|
440
|
+
const [a, n] = M(() => !e || typeof window > "u" ? t : window.localStorage.getItem(e) === "1");
|
|
441
|
+
k(() => {
|
|
442
|
+
if (!e || typeof window > "u") {
|
|
443
|
+
n(t);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
const i = window.localStorage.getItem(e);
|
|
447
|
+
n(i == null ? t : i === "1");
|
|
448
|
+
}, [e, t]);
|
|
449
|
+
const c = p(
|
|
450
|
+
(i) => {
|
|
451
|
+
n((l) => {
|
|
452
|
+
const s = typeof i == "function" ? i(l) : i;
|
|
453
|
+
return e && typeof window < "u" && window.localStorage.setItem(e, s ? "1" : "0"), s;
|
|
454
|
+
});
|
|
455
|
+
},
|
|
456
|
+
[e]
|
|
457
|
+
);
|
|
458
|
+
return [a, c];
|
|
459
|
+
}
|
|
460
|
+
function Re() {
|
|
461
|
+
const [e, t] = M(() => typeof window < "u" ? window.innerWidth : 1200);
|
|
462
|
+
return k(() => {
|
|
463
|
+
const a = () => t(window.innerWidth);
|
|
464
|
+
return window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
|
|
465
|
+
}, []), e;
|
|
466
|
+
}
|
|
467
|
+
function ce({ side: e, ariaLabel: t, onResize: a }) {
|
|
468
|
+
const n = T(null), c = p((s) => {
|
|
469
|
+
s.preventDefault(), n.current = s.clientX, s.currentTarget.setPointerCapture(s.pointerId), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
470
|
+
}, []), i = p((s) => {
|
|
471
|
+
if (n.current === null) return;
|
|
472
|
+
const x = s.clientX - n.current;
|
|
473
|
+
n.current = s.clientX, a(x);
|
|
474
|
+
}, [a]), l = p((s) => {
|
|
475
|
+
n.current !== null && (n.current = null, s.currentTarget.releasePointerCapture(s.pointerId), document.body.style.cursor = "", document.body.style.userSelect = "");
|
|
476
|
+
}, []);
|
|
477
|
+
return /* @__PURE__ */ r(
|
|
478
|
+
be,
|
|
479
|
+
{
|
|
480
|
+
"aria-label": t,
|
|
481
|
+
orientation: "vertical",
|
|
482
|
+
onResizeStart: c,
|
|
483
|
+
onPointerMove: i,
|
|
484
|
+
onPointerUp: l,
|
|
485
|
+
onPointerCancel: l,
|
|
486
|
+
className: m(
|
|
487
|
+
"absolute top-0 bottom-0 z-20 bg-transparent",
|
|
488
|
+
"transition-colors duration-200",
|
|
489
|
+
"hover:bg-border/70 hover:[transition-delay:150ms]",
|
|
490
|
+
"active:bg-muted-foreground/30",
|
|
491
|
+
e === "drawer-right" ? "right-0" : "left-0"
|
|
492
|
+
)
|
|
493
|
+
}
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
function S(e, t) {
|
|
497
|
+
const a = e == null ? void 0 : e[t];
|
|
498
|
+
return typeof a == "function" ? a : void 0;
|
|
499
|
+
}
|
|
500
|
+
function A(e, t) {
|
|
501
|
+
return S(e, t);
|
|
502
|
+
}
|
|
503
|
+
function Y() {
|
|
504
|
+
if (typeof document > "u") return;
|
|
505
|
+
const e = document.querySelector(
|
|
506
|
+
'[data-boring-agent] textarea[name="message"], textarea[name="message"]'
|
|
507
|
+
);
|
|
508
|
+
e == null || e.focus();
|
|
509
|
+
}
|
|
510
|
+
function de() {
|
|
511
|
+
typeof window > "u" || window.requestAnimationFrame(() => {
|
|
512
|
+
Y(), window.setTimeout(Y, 320);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
function X({ id: e, params: t }) {
|
|
516
|
+
const a = Oe(), { debug: n } = Ie(), c = fe(
|
|
517
|
+
a.subscribe,
|
|
518
|
+
a.getSnapshot,
|
|
519
|
+
a.getSnapshot
|
|
520
|
+
), l = G(() => a.getComponents(), [a, c])[e], s = G(() => Le(e), [e]);
|
|
521
|
+
return l ? /* @__PURE__ */ r(me, { fallback: /* @__PURE__ */ r(ge, { centered: !0 }), children: /* @__PURE__ */ r(
|
|
522
|
+
l,
|
|
523
|
+
{
|
|
524
|
+
params: { ...t, debug: n },
|
|
525
|
+
api: s,
|
|
526
|
+
containerApi: {}
|
|
527
|
+
}
|
|
528
|
+
) }) : null;
|
|
529
|
+
}
|
|
530
|
+
function Le(e) {
|
|
531
|
+
return {
|
|
532
|
+
id: e,
|
|
533
|
+
title: e,
|
|
534
|
+
setTitle: () => {
|
|
535
|
+
},
|
|
536
|
+
setActive: () => {
|
|
537
|
+
},
|
|
538
|
+
close: () => {
|
|
539
|
+
},
|
|
540
|
+
updateParameters: () => {
|
|
541
|
+
},
|
|
542
|
+
onDidParametersChange: () => ({ dispose() {
|
|
543
|
+
} }),
|
|
544
|
+
onDidActiveChange: () => ({ dispose() {
|
|
545
|
+
} }),
|
|
546
|
+
onDidDimensionsChange: () => ({ dispose() {
|
|
547
|
+
} }),
|
|
548
|
+
onDidLocationChange: () => ({ dispose() {
|
|
549
|
+
} }),
|
|
550
|
+
onDidTitleChange: () => ({ dispose() {
|
|
551
|
+
} }),
|
|
552
|
+
onWillFocus: () => ({ dispose() {
|
|
553
|
+
} }),
|
|
554
|
+
onDidFocus: () => ({ dispose() {
|
|
555
|
+
} }),
|
|
556
|
+
onDidBlur: () => ({ dispose() {
|
|
557
|
+
} }),
|
|
558
|
+
onWillVisibilityChange: () => ({ dispose() {
|
|
559
|
+
} }),
|
|
560
|
+
onDidVisibilityChange: () => ({ dispose() {
|
|
561
|
+
} }),
|
|
562
|
+
onDidConstraintsChange: () => ({ dispose() {
|
|
563
|
+
} })
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function q({
|
|
567
|
+
side: e,
|
|
568
|
+
icon: t,
|
|
569
|
+
onClick: a,
|
|
570
|
+
label: n,
|
|
571
|
+
hint: c,
|
|
572
|
+
bottomOffset: i,
|
|
573
|
+
stackIndex: l = 0,
|
|
574
|
+
pulse: s = !1
|
|
575
|
+
}) {
|
|
576
|
+
const x = e === "right" && i !== void 0, v = l * 44;
|
|
577
|
+
return /* @__PURE__ */ r(
|
|
578
|
+
E,
|
|
579
|
+
{
|
|
580
|
+
type: "button",
|
|
581
|
+
variant: "ghost",
|
|
582
|
+
size: "icon-sm",
|
|
583
|
+
onClick: a,
|
|
584
|
+
"aria-label": n,
|
|
585
|
+
title: c ? `${n} (${c})` : n,
|
|
586
|
+
className: m(
|
|
587
|
+
"absolute z-30 h-9 w-9 gap-0.5 rounded-lg bg-background text-muted-foreground",
|
|
588
|
+
e === "left" ? "left-2" : "right-2",
|
|
589
|
+
x ? "hover:-translate-y-0.5" : "top-1/2 hover:-translate-y-[1px]",
|
|
590
|
+
"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)]",
|
|
591
|
+
"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)]",
|
|
592
|
+
"focus-visible:ring-ring/40"
|
|
593
|
+
),
|
|
594
|
+
style: x ? { bottom: i } : { transform: `translateY(calc(-50% - ${v}px))` },
|
|
595
|
+
children: t === "sessions" ? /* @__PURE__ */ u("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
596
|
+
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", strokeWidth: "1.8" }),
|
|
597
|
+
/* @__PURE__ */ r("path", { d: "M12 7v5l3.2 2", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
598
|
+
] }) : t === "chat" ? /* @__PURE__ */ u("span", { className: "relative flex items-center justify-center", children: [
|
|
599
|
+
/* @__PURE__ */ r(xe, { className: "h-[15px] w-[15px]", strokeWidth: 1.8, "aria-hidden": "true" }),
|
|
600
|
+
s ? /* @__PURE__ */ r("span", { className: "absolute -right-1.5 -top-1.5 h-2 w-2 rounded-full bg-[color:var(--accent)]", "aria-hidden": "true" }) : null
|
|
601
|
+
] }) : /* @__PURE__ */ r("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ r("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" }) })
|
|
602
|
+
}
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
function Ue({
|
|
606
|
+
appTitle: e = "Boring",
|
|
607
|
+
sessionTitle: t,
|
|
608
|
+
onCommandPalette: a,
|
|
609
|
+
onNewChat: n,
|
|
610
|
+
topBarLeft: c,
|
|
611
|
+
topBarRight: i,
|
|
612
|
+
className: l
|
|
613
|
+
}) {
|
|
614
|
+
const s = i ?? null;
|
|
615
|
+
return /* @__PURE__ */ u(
|
|
616
|
+
"header",
|
|
617
|
+
{
|
|
618
|
+
"data-boring-workspace-part": "topbar",
|
|
619
|
+
className: m(
|
|
620
|
+
"relative flex h-11 items-center justify-between gap-2 px-3",
|
|
621
|
+
"bg-background border-b border-border",
|
|
622
|
+
l
|
|
623
|
+
),
|
|
624
|
+
"aria-label": "App top bar",
|
|
625
|
+
children: [
|
|
626
|
+
/* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 items-center gap-2.5 leading-none", children: c ?? /* @__PURE__ */ u(ae, { children: [
|
|
627
|
+
/* @__PURE__ */ r(
|
|
628
|
+
"span",
|
|
629
|
+
{
|
|
630
|
+
"aria-hidden": "true",
|
|
631
|
+
className: "grid size-[22px] shrink-0 place-items-center rounded-sm bg-foreground text-[11px] font-semibold leading-none tracking-tight text-background",
|
|
632
|
+
children: ((e == null ? void 0 : e[0]) ?? "B").toUpperCase()
|
|
633
|
+
}
|
|
634
|
+
),
|
|
635
|
+
t ? /* @__PURE__ */ u(ae, { children: [
|
|
636
|
+
/* @__PURE__ */ r("span", { className: "shrink-0 text-[13px] font-medium leading-none tracking-tight text-foreground/65", children: e }),
|
|
637
|
+
/* @__PURE__ */ r("span", { "aria-hidden": "true", className: "text-[13px] leading-none text-muted-foreground/45", children: "·" }),
|
|
638
|
+
/* @__PURE__ */ r("span", { className: "truncate text-[13px] font-medium leading-none tracking-tight text-foreground", children: t })
|
|
639
|
+
] }) : /* @__PURE__ */ r("span", { className: "truncate text-[13px] font-medium leading-none tracking-tight text-foreground", children: e })
|
|
640
|
+
] }) }),
|
|
641
|
+
/* @__PURE__ */ u(
|
|
642
|
+
we,
|
|
643
|
+
{
|
|
644
|
+
type: "button",
|
|
645
|
+
variant: "ghost",
|
|
646
|
+
size: "sm",
|
|
647
|
+
onClick: a,
|
|
648
|
+
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",
|
|
649
|
+
"aria-label": "Search catalogs and commands",
|
|
650
|
+
title: "Command palette (⌘K)",
|
|
651
|
+
children: [
|
|
652
|
+
/* @__PURE__ */ r(ke, { className: "h-3.5 w-3.5 shrink-0 opacity-80", strokeWidth: 1.75 }),
|
|
653
|
+
/* @__PURE__ */ r("span", { className: "font-normal tracking-tight", children: "Search" }),
|
|
654
|
+
/* @__PURE__ */ r(pe, { className: "ml-0.5 bg-muted/40 leading-none shadow-none", children: "⌘K" })
|
|
655
|
+
]
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
/* @__PURE__ */ u("div", { className: "flex flex-1 shrink-0 items-center justify-end gap-1", children: [
|
|
659
|
+
n && /* @__PURE__ */ r(
|
|
660
|
+
E,
|
|
661
|
+
{
|
|
662
|
+
type: "button",
|
|
663
|
+
variant: "ghost",
|
|
664
|
+
size: "icon-sm",
|
|
665
|
+
onClick: n,
|
|
666
|
+
"aria-label": "New chat",
|
|
667
|
+
title: "New chat",
|
|
668
|
+
children: /* @__PURE__ */ r(ye, { className: "h-4 w-4" })
|
|
669
|
+
}
|
|
670
|
+
),
|
|
671
|
+
s
|
|
672
|
+
] })
|
|
673
|
+
]
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
function Xe({
|
|
678
|
+
title: e = "Loading workspace",
|
|
679
|
+
description: t = "Preparing the workspace context.",
|
|
680
|
+
status: a = "Loading",
|
|
681
|
+
fullscreen: n = !0,
|
|
682
|
+
className: c
|
|
683
|
+
}) {
|
|
684
|
+
return /* @__PURE__ */ r(
|
|
685
|
+
"section",
|
|
686
|
+
{
|
|
687
|
+
role: "status",
|
|
688
|
+
"aria-live": "polite",
|
|
689
|
+
"aria-busy": "true",
|
|
690
|
+
className: m(
|
|
691
|
+
"flex h-full w-full items-center justify-center bg-background px-6 text-foreground",
|
|
692
|
+
n ? "min-h-screen" : "min-h-[240px]",
|
|
693
|
+
c
|
|
694
|
+
),
|
|
695
|
+
children: /* @__PURE__ */ u("div", { className: "flex w-full max-w-sm flex-col items-center gap-5 text-center", children: [
|
|
696
|
+
/* @__PURE__ */ r("div", { className: "flex h-11 w-11 items-center justify-center rounded-lg border border-border bg-card text-foreground", children: /* @__PURE__ */ r(
|
|
697
|
+
"span",
|
|
698
|
+
{
|
|
699
|
+
"aria-hidden": "true",
|
|
700
|
+
className: "h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent opacity-70"
|
|
701
|
+
}
|
|
702
|
+
) }),
|
|
703
|
+
/* @__PURE__ */ u("div", { className: "space-y-2", children: [
|
|
704
|
+
/* @__PURE__ */ r("h2", { className: "text-base font-medium text-foreground", children: e }),
|
|
705
|
+
t ? /* @__PURE__ */ r("p", { className: "text-sm leading-6 text-muted-foreground", children: t }) : null
|
|
706
|
+
] }),
|
|
707
|
+
a ? /* @__PURE__ */ r("p", { className: "text-xs font-medium text-muted-foreground/80", children: a }) : null
|
|
708
|
+
] })
|
|
709
|
+
}
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
export {
|
|
713
|
+
$e as C,
|
|
714
|
+
Ue as T,
|
|
715
|
+
Xe as W,
|
|
716
|
+
je as b,
|
|
717
|
+
Fe as r,
|
|
718
|
+
Ve as w
|
|
719
|
+
};
|