@hachej/boring-workspace 0.1.49 → 0.1.51

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/app-front.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx as d, jsxs as Pe, Fragment as de } from "react/jsx-runtime";
2
2
  import { useEffect as A, useSyncExternalStore as xr, useMemo as O, useState as x, useCallback as E, useRef as H, useLayoutEffect as Mr } from "react";
3
3
  import { PiChatPanel as Fr, usePiSessions as Cr } from "@hachej/boring-agent/front";
4
- import { aj as Wr, at as Ve, au as _n, av as Ln, aw as On, ax as xn, ay as ke, az as bt, aA as St, aB as Mn, aC as Ir, aD as ze, aE as Sn, aF as Gr, U as yn, aG as $r, q as Ur, u as Fn, aH as Kr, ag as Hr, aI as Jr } from "./WorkspaceProvider-CbvaXxgT.js";
5
- import { T as jr, C as qr, r as Pn, w as Br, W as En } from "./WorkspaceLoadingState-Bi_qd29T.js";
4
+ import { al as Wr, av as Ve, aw as _n, ax as Ln, ay as On, az as xn, aA as ke, aB as bt, aC as St, aD as Mn, aE as Ir, aF as ze, aG as Sn, aH as Gr, U as yn, aI as $r, r as Ur, u as Fn, aJ as Kr, ai as Hr, aK as Jr } from "./WorkspaceProvider-BvLlkZR_.js";
5
+ import { T as Br, C as jr, r as Pn, w as qr, W as En } from "./WorkspaceLoadingState-BfrLCML3.js";
6
6
  import { Sun as zr, Moon as Vr } from "lucide-react";
7
7
  import { IconButton as kr, ErrorState as Yr } from "@hachej/boring-ui-kit";
8
8
  function Xr() {
@@ -184,7 +184,7 @@ function ci({
184
184
  let c = !1;
185
185
  const u = new AbortController(), b = Ve(e, n);
186
186
  async function y() {
187
- var S, j;
187
+ var S, B;
188
188
  o == null || o({ status: "preparing" });
189
189
  try {
190
190
  const W = Ln(i, s), V = (p) => li({
@@ -205,7 +205,7 @@ function ci({
205
205
  break;
206
206
  }
207
207
  if (o == null || o({ status: "preparing", message: "Workspace is still preparing", ...p ? { requirement: p } : {} }), await An(u.signal), c || u.signal.aborted || (w = await Promise.all(T.map(async (N) => ({ path: N.path, result: await V(N.path) }))), c || u.signal.aborted)) return;
208
- h = ((j = w.find((N) => N.result.runtimeDependencies)) == null ? void 0 : j.result.runtimeDependencies) ?? h, T = w.filter((N) => N.result.status === "preparing");
208
+ h = ((B = w.find((N) => N.result.runtimeDependencies)) == null ? void 0 : B.result.runtimeDependencies) ?? h, T = w.filter((N) => N.result.status === "preparing");
209
209
  }
210
210
  for (o == null || o({ status: "ready", ...h ? { runtimeDependencies: h } : {} }); (h == null ? void 0 : h.state) === "preparing"; ) {
211
211
  if (await An(u.signal), c || u.signal.aborted) return;
@@ -229,7 +229,7 @@ function ci({
229
229
  function ui(e) {
230
230
  return typeof (e == null ? void 0 : e.id) == "string" ? e.id : null;
231
231
  }
232
- function Be(e, n, r) {
232
+ function qe(e, n, r) {
233
233
  if (e.includes(r)) return e;
234
234
  const i = n ? e.indexOf(n) : -1, s = i >= 0 ? i + 1 : e.length;
235
235
  return [...e.slice(0, s), r, ...e.slice(s)];
@@ -250,7 +250,7 @@ function pt(e, n, r) {
250
250
  }, [e, n, r]);
251
251
  const o = E(
252
252
  (c) => {
253
- s(c), Br(e, c, r);
253
+ s(c), qr(e, c, r);
254
254
  },
255
255
  [r, e]
256
256
  );
@@ -391,7 +391,7 @@ function Ri({
391
391
  openTabs: o.openTabs,
392
392
  activeTab: o.activeTab,
393
393
  activeFile: Ai(o),
394
- availablePanels: c.list().map((j) => j.id)
394
+ availablePanels: c.list().map((B) => B.id)
395
395
  };
396
396
  return fetch(Ei(e), {
397
397
  method: "PUT",
@@ -416,7 +416,7 @@ function zi({
416
416
  afterShell: b,
417
417
  panels: y,
418
418
  commands: S,
419
- catalogs: j,
419
+ catalogs: B,
420
420
  plugins: W,
421
421
  excludeDefaults: V,
422
422
  capabilities: w,
@@ -447,10 +447,10 @@ function zi({
447
447
  surfaceInitialPanels: Nt,
448
448
  topBarLeft: Hn,
449
449
  topBarRight: Jn,
450
- showThemeToggle: jn = !0,
450
+ showThemeToggle: Bn = !0,
451
451
  chatParams: L,
452
- externalPlugins: qn,
453
- hotReloadEnabled: Bn,
452
+ externalPlugins: jn,
453
+ hotReloadEnabled: qn,
454
454
  frontPluginHotReload: zn,
455
455
  extraPanels: Dt,
456
456
  extraCommands: _t,
@@ -463,7 +463,7 @@ function zi({
463
463
  className: Yn
464
464
  }) {
465
465
  var fn, gn;
466
- const Lt = qn !== !1, Xn = Lt ? zn : !1, nt = Lt ? Bn : !1, rt = o ?? `boring-ui-v2:layout:${e}`, I = c ?? `${rt}:surface`, we = di(
466
+ const Lt = jn !== !1, Xn = Lt ? zn : !1, nt = Lt ? qn : !1, rt = o ?? `boring-ui-v2:layout:${e}`, I = c ?? `${rt}:surface`, we = di(
467
467
  I,
468
468
  rt
469
469
  ), F = yt !== !1, Te = s ?? `boring-workspace:sessions:${e}`, Y = O(
@@ -487,7 +487,7 @@ function zi({
487
487
  })), [Ft, Le] = x(() => ({
488
488
  workspaceId: e,
489
489
  failed: !1
490
- })), [st, Ct] = x(null), fe = `boring-workspace:chat-panes:${e}`, [D, B] = x(
490
+ })), [st, Ct] = x(null), fe = `boring-workspace:chat-panes:${e}`, [D, q] = x(
491
491
  () => (F ? Nn(fe, e) : null) ?? { workspaceId: e, ids: [], activeId: null }
492
492
  ), [ie, Wt] = x(null);
493
493
  A(() => {
@@ -510,7 +510,7 @@ function zi({
510
510
  A(() => {
511
511
  F && D.workspaceId === e && bi(fe, D);
512
512
  }, [D, fe, F, e]), A(() => {
513
- B((t) => t.workspaceId === e ? t : (F ? Nn(fe, e) : null) ?? { workspaceId: e, ids: [], activeId: null });
513
+ q((t) => t.workspaceId === e ? t : (F ? Nn(fe, e) : null) ?? { workspaceId: e, ids: [], activeId: null });
514
514
  }, [fe, F, e]);
515
515
  const Oe = xt.workspaceId === e ? xt.status : wn, nr = n ?? Fr, rr = r ?? mi, X = !n || !!r, xe = X && Ze !== !1, ot = () => {
516
516
  }, _ = rr({
@@ -570,11 +570,11 @@ function zi({
570
570
  ae.current = !1, ve(void 0);
571
571
  }));
572
572
  }, [U, k, f]);
573
- const G = U !== void 0 ? U ?? null : dr, J = C ? ot : (f == null ? void 0 : f.switch) ?? At ?? Ne.switchTo, Ie = E((t) => (G && t !== G && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: G } })), J(t)), [G, J]), at = C ? ot : f ? () => f.create() : Xe ? () => Xe() : () => Ne.create(), Jt = C ? ot : (f == null ? void 0 : f.delete) ?? Rt ?? Ne.remove, jt = E((t) => (f && Q.length <= 1 && (pe.current = !0), Jt(t)), [Q.length, Jt, f]), fr = ((fn = $.find((t) => t.id === G)) == null ? void 0 : fn.title) ?? void 0, [gr, qt] = pt(
573
+ const G = U !== void 0 ? U ?? null : dr, J = C ? ot : (f == null ? void 0 : f.switch) ?? At ?? Ne.switchTo, Ie = E((t) => (G && t !== G && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: G } })), J(t)), [G, J]), at = C ? ot : f ? () => f.create() : Xe ? () => Xe() : () => Ne.create(), Jt = C ? ot : (f == null ? void 0 : f.delete) ?? Rt ?? Ne.remove, Bt = E((t) => (f && Q.length <= 1 && (pe.current = !0), Jt(t)), [Q.length, Jt, f]), fr = ((fn = $.find((t) => t.id === G)) == null ? void 0 : fn.title) ?? void 0, [gr, jt] = pt(
574
574
  `${we}:drawer`,
575
575
  Un,
576
576
  F
577
- ), Bt = Tt && gr, [Z, q] = pt(
577
+ ), qt = Tt && gr, [Z, j] = pt(
578
578
  // Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
579
579
  // layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
580
580
  // key corrupts the JSON and drops the persisted workbench layout on reload.
@@ -629,12 +629,12 @@ function zi({
629
629
  const t = ct.current;
630
630
  return (t == null ? void 0 : t.key) === zt.current ? t.api : null;
631
631
  }, []), Zt = E(() => te.current, []), en = E(() => {
632
- te.current = !0, q(!0);
633
- }, [q]), tn = E(() => {
634
- te.current = !0, q(!0), be(!0), Ge(!0);
635
- }, [q, be]), Ue = E(() => {
636
- te.current = !1, ct.current = null, lt(!1), q(!1);
637
- }, [q]), le = O(() => ({
632
+ te.current = !0, j(!0);
633
+ }, [j]), tn = E(() => {
634
+ te.current = !0, j(!0), be(!0), Ge(!0);
635
+ }, [j, be]), Ue = E(() => {
636
+ te.current = !1, ct.current = null, lt(!1), j(!1);
637
+ }, [j]), le = O(() => ({
638
638
  surface: $e,
639
639
  isWorkbenchOpen: Zt,
640
640
  openWorkbench: en,
@@ -674,11 +674,11 @@ function zi({
674
674
  const t = ee.current, a = new Set($.map((K) => K.id)), l = t ? t.createdId ?? (a.has(m) && !t.knownIds.has(m) ? m : ((ne = $.find((K) => !t.knownIds.has(K.id))) == null ? void 0 : ne.id) ?? null) : null;
675
675
  l && a.has(l) && (ee.current = null);
676
676
  const g = m === "default" && U !== void 0, v = on && a.size > 0 && !g, R = l ?? (v && !a.has(m) ? ((mn = $[0]) == null ? void 0 : mn.id) ?? m : m);
677
- B((K) => {
677
+ q((K) => {
678
678
  const re = K.workspaceId === e ? K : { workspaceId: e, ids: [], activeId: null };
679
679
  if (C && re.ids.length > 0 && !l) return re;
680
- const pn = re.ids.length > 0 ? re.ids : [R], hn = v ? pn.filter((qe) => a.has(qe) || qe === l) : pn, ue = hn.length > 0 ? hn : [R], vn = re.activeId && ue.includes(re.activeId) ? re.activeId : ue[0] ?? R, ye = l ? Be(ue, t == null ? void 0 : t.afterId, l) : R === vn || ue.includes(R) ? ue : Rn(ue, vn, R), bn = ye.includes(R) ? R : ye[0] ?? R;
681
- return K.workspaceId === e && K.activeId === bn && K.ids.length === ye.length && K.ids.every((qe, Or) => qe === ye[Or]) ? K : { workspaceId: e, ids: ye, activeId: bn };
680
+ const pn = re.ids.length > 0 ? re.ids : [R], hn = v ? pn.filter((je) => a.has(je) || je === l) : pn, ue = hn.length > 0 ? hn : [R], vn = re.activeId && ue.includes(re.activeId) ? re.activeId : ue[0] ?? R, ye = l ? qe(ue, t == null ? void 0 : t.afterId, l) : R === vn || ue.includes(R) ? ue : Rn(ue, vn, R), bn = ye.includes(R) ? R : ye[0] ?? R;
681
+ return K.workspaceId === e && K.activeId === bn && K.ids.length === ye.length && K.ids.every((je, Or) => je === ye[Or]) ? K : { workspaceId: e, ids: ye, activeId: bn };
682
682
  });
683
683
  }, [U, m, C, Ce, $, on, e]);
684
684
  const an = O(() => {
@@ -687,22 +687,22 @@ function zi({
687
687
  return t;
688
688
  }, [$]), ft = D.workspaceId === e ? D : { ids: [], activeId: null }, Ke = ft.ids.length > 0 ? ft.ids : [m], He = ft.activeId ?? Ke[0] ?? m, yr = E((t) => {
689
689
  const l = (D.workspaceId === e ? D : { ids: [m] }).ids.includes(t);
690
- return B((g) => {
690
+ return q((g) => {
691
691
  const v = g.workspaceId === e ? g : { ids: [m], activeId: m }, R = v.ids.includes(t) ? v.ids : Rn(v.ids, v.activeId, t);
692
692
  return { workspaceId: e, ids: R, activeId: t };
693
693
  }), l ? J(t) : Ie(t);
694
- }, [D, m, J, Ie, e]), Pr = E((t) => (B((a) => {
694
+ }, [D, m, J, Ie, e]), Pr = E((t) => (q((a) => {
695
695
  const l = a.workspaceId === e ? a : { ids: [m], activeId: m };
696
696
  return {
697
697
  workspaceId: e,
698
- ids: l.ids.includes(t) ? l.ids : Be(l.ids, l.activeId, t),
698
+ ids: l.ids.includes(t) ? l.ids : qe(l.ids, l.activeId, t),
699
699
  activeId: t
700
700
  };
701
- }), J(t)), [m, J, e]), ln = E((t) => ((D.workspaceId === e ? D : { ids: [m] }).ids.includes(t) && Wt({ workspaceId: e, id: t }), B((l) => {
701
+ }), J(t)), [m, J, e]), ln = E((t) => ((D.workspaceId === e ? D : { ids: [m] }).ids.includes(t) && Wt({ workspaceId: e, id: t }), q((l) => {
702
702
  const g = l.workspaceId === e ? l : { ids: [m], activeId: m };
703
703
  return {
704
704
  workspaceId: e,
705
- ids: Be(g.ids, g.activeId, t),
705
+ ids: qe(g.ids, g.activeId, t),
706
706
  activeId: t
707
707
  };
708
708
  }), J(t)), [D, m, J, e]), Er = E((t) => {
@@ -711,7 +711,7 @@ function zi({
711
711
  const l = a.ids.indexOf(t);
712
712
  if (l < 0) return;
713
713
  const g = a.ids.filter((R) => R !== t), v = a.activeId === t ? g[Math.max(0, l - 1)] ?? g[0] ?? null : a.activeId;
714
- B({ workspaceId: e, ids: g, activeId: v }), v && a.activeId === t && J(v);
714
+ q({ workspaceId: e, ids: g, activeId: v }), v && a.activeId === t && J(v);
715
715
  }, [D, m, J, e]), Ar = E((t) => {
716
716
  const a = {
717
717
  afterId: t,
@@ -721,11 +721,11 @@ function zi({
721
721
  const l = at();
722
722
  return Promise.resolve(l).then((g) => {
723
723
  const v = ui(g);
724
- v && (ee.current === a && (ee.current = { ...a, createdId: v }), B((R) => {
724
+ v && (ee.current === a && (ee.current = { ...a, createdId: v }), q((R) => {
725
725
  const ne = R.workspaceId === e ? R : { ids: [m] };
726
726
  return {
727
727
  workspaceId: e,
728
- ids: Be(ne.ids, t, v),
728
+ ids: qe(ne.ids, t, v),
729
729
  activeId: v
730
730
  };
731
731
  }));
@@ -737,10 +737,10 @@ function zi({
737
737
  let g = a.activeId;
738
738
  if (l >= 0) {
739
739
  const v = a.ids.filter((R) => R !== t);
740
- g = a.activeId === t ? v[Math.max(0, l - 1)] ?? v[0] ?? null : a.activeId, B({ workspaceId: e, ids: v, activeId: g }), g && a.activeId === t && Ie(g);
740
+ g = a.activeId === t ? v[Math.max(0, l - 1)] ?? v[0] ?? null : a.activeId, q({ workspaceId: e, ids: v, activeId: g }), g && a.activeId === t && Ie(g);
741
741
  }
742
- return jt(t);
743
- }, [D, m, jt, Ie, e]), [wr, gt] = x(oe), cn = H(e);
742
+ return Bt(t);
743
+ }, [D, m, Bt, Ie, e]), [wr, gt] = x(oe), cn = H(e);
744
744
  A(() => {
745
745
  if (cn.current !== e) {
746
746
  cn.current = e, gt(oe);
@@ -779,7 +779,7 @@ function zi({
779
779
  } catch (l) {
780
780
  return l instanceof Error ? l.message : "Agent plugin reload failed.";
781
781
  }
782
- }, [h, Y]), je = E(
782
+ }, [h, Y]), Be = E(
783
783
  (t, a = {}) => {
784
784
  const l = a.bridgeEnabled ?? !0, g = L != null && L.toolRenderers && typeof L.toolRenderers == "object" ? L.toolRenderers : void 0;
785
785
  return {
@@ -811,14 +811,14 @@ function zi({
811
811
  },
812
812
  [h, L, un, Y, Ye, le, _t, Oe, dn, nt, rn, Je, e]
813
813
  ), Dr = O(
814
- () => je(m),
815
- [m, je]
814
+ () => Be(m),
815
+ [m, Be]
816
816
  ), _r = O(() => Ke.map((t) => ({
817
817
  id: t,
818
818
  title: an.get(t) ?? (t === "default" ? k : t),
819
819
  panel: "chat",
820
- params: je(t, { bridgeEnabled: t === He })
821
- })), [He, Ke, k, je, an]), Lr = O(() => ({
820
+ params: Be(t, { bridgeEnabled: t === He })
821
+ })), [He, Ke, k, Be, an]), Lr = O(() => ({
822
822
  storageKey: I,
823
823
  defaultLeftTab: Ae,
824
824
  initialPanels: Nt,
@@ -838,7 +838,7 @@ function zi({
838
838
  Yt,
839
839
  I,
840
840
  sn,
841
- q
841
+ j
842
842
  ]);
843
843
  return /* @__PURE__ */ d("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ Pe(
844
844
  Ur,
@@ -846,7 +846,7 @@ function zi({
846
846
  chatPanel: nr,
847
847
  panels: y,
848
848
  commands: S,
849
- catalogs: j,
849
+ catalogs: B,
850
850
  plugins: W,
851
851
  excludeDefaults: V,
852
852
  capabilities: w,
@@ -883,7 +883,7 @@ function zi({
883
883
  {
884
884
  bridgeEndpoint: Ye,
885
885
  requestHeaders: Y,
886
- navOpen: Bt,
886
+ navOpen: qt,
887
887
  surfaceOpen: Z,
888
888
  surfaceReady: mr,
889
889
  snapshot: br
@@ -891,7 +891,7 @@ function zi({
891
891
  ),
892
892
  /* @__PURE__ */ Pe("div", { className: "flex h-full min-h-0 flex-col", children: [
893
893
  /* @__PURE__ */ d(
894
- jr,
894
+ Br,
895
895
  {
896
896
  appTitle: wt,
897
897
  sessionTitle: Ce ? "Loading sessions…" : fr ?? k,
@@ -906,16 +906,16 @@ function zi({
906
906
  },
907
907
  topBarLeft: Hn,
908
908
  topBarRight: /* @__PURE__ */ Pe(de, { children: [
909
- jn ? /* @__PURE__ */ d(Xr, {}) : null,
909
+ Bn ? /* @__PURE__ */ d(Xr, {}) : null,
910
910
  Jn
911
911
  ] })
912
912
  }
913
913
  ),
914
914
  Ce ? /* @__PURE__ */ d(yi, {}) : /* @__PURE__ */ d(
915
- qr,
915
+ jr,
916
916
  {
917
917
  className: Yn,
918
- nav: Bt ? "session-list" : null,
918
+ nav: qt ? "session-list" : null,
919
919
  navParams: {
920
920
  sessions: $,
921
921
  activeId: He,
@@ -929,7 +929,7 @@ function zi({
929
929
  onLoadMore: f == null ? void 0 : f.loadMore,
930
930
  hasMore: f == null ? void 0 : f.hasMore,
931
931
  loadingMore: f == null ? void 0 : f.loadingMore,
932
- onClose: () => qt(!1)
932
+ onClose: () => jt(!1)
933
933
  },
934
934
  center: "chat",
935
935
  centerParams: Dr,
@@ -956,14 +956,14 @@ function zi({
956
956
  } : void 0,
957
957
  storageKey: F ? we : void 0,
958
958
  onOpenNav: Tt ? () => {
959
- qt(!0), et == null || et();
959
+ jt(!0), et == null || et();
960
960
  } : void 0,
961
961
  onOpenSurface: () => {
962
- te.current = !0, q(!0), tt == null || tt();
962
+ te.current = !0, j(!0), tt == null || tt();
963
963
  },
964
964
  surfaceButtonBottomOffset: kn,
965
965
  onOpenSidebar: dt ? () => {
966
- te.current = !0, q(!0), be(!0), Ge(!0);
966
+ te.current = !0, j(!0), be(!0), Ge(!0);
967
967
  } : void 0
968
968
  }
969
969
  )
@@ -1006,10 +1006,10 @@ function Vi({
1006
1006
  label: "Waking workspace runtime"
1007
1007
  });
1008
1008
  return A(() => {
1009
- const S = new AbortController(), j = Ve(e, n);
1009
+ const S = new AbortController(), B = Ve(e, n);
1010
1010
  async function W(w) {
1011
1011
  const h = await fetch(On(r, w), {
1012
- headers: j,
1012
+ headers: B,
1013
1013
  signal: S.signal
1014
1014
  }), T = await ke(h);
1015
1015
  if (!h.ok) {
@@ -1020,7 +1020,7 @@ function Vi({
1020
1020
  const N = ze(T);
1021
1021
  if ((N == null ? void 0 : N.state) === "degraded") throw new Error(N.message ?? "Workspace failed to prepare");
1022
1022
  }
1023
- return Kr(w) !== null && T && typeof T == "object" && Mn(r, j["x-boring-workspace-id"] ?? e, w, T), "ready";
1023
+ return Kr(w) !== null && T && typeof T == "object" && Mn(r, B["x-boring-workspace-id"] ?? e, w, T), "ready";
1024
1024
  }
1025
1025
  async function V() {
1026
1026
  y({ status: "loading", label: "Waking workspace runtime" });
package/dist/testing.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as Ba } from "react/jsx-runtime";
2
2
  import * as Pa from "react";
3
3
  import { createElement as is, useMemo as wn, useLayoutEffect as us, isValidElement as ss, cloneElement as ds, useSyncExternalStore as Gi } from "react";
4
- import { h as cs, q as fs, o as ps } from "./WorkspaceProvider-CbvaXxgT.js";
4
+ import { i as cs, r as fs, q as ps } from "./WorkspaceProvider-BvLlkZR_.js";
5
5
  import { d as ms } from "./panel-DnvDNQac.js";
6
6
  import * as bs from "react-dom/test-utils";
7
7
  import ka from "react-dom";