@hachej/boring-workspace 0.1.53 → 0.1.55

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