@hachej/boring-workspace 0.1.20 → 0.1.22
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-DHVB9rpk.js → FileTree-nBvBA8m7.js} +101 -90
- package/dist/{MarkdownEditor-L1KDH0bM.js → MarkdownEditor-CeigBQee.js} +1 -1
- package/dist/{WorkspaceLoadingState-DYDxUYnx.js → WorkspaceLoadingState-DuoIpOxl.js} +1 -1
- package/dist/{WorkspaceProvider-CDPaAO5u.js → WorkspaceProvider-DihXY2wk.js} +2 -2
- package/dist/app-front.js +2 -2
- package/dist/app-server.d.ts +8 -4
- package/dist/app-server.js +106 -16
- package/dist/{createInMemoryBridge-BDxDzihm.d.ts → createInMemoryBridge-CYNW1h_o.d.ts} +9 -5
- package/dist/server.d.ts +3 -3
- package/dist/server.js +27 -1
- package/dist/shared.d.ts +15 -1
- package/dist/shared.js +16 -1
- package/dist/testing.js +1 -1
- package/dist/{ui-bridge-Gfh1MMgl.d.ts → ui-bridge-CT18yqwN.d.ts} +1 -1
- package/dist/workspace.js +5 -5
- package/package.json +5 -3
|
@@ -1,61 +1,71 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as i, jsxs as B } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as T, useEffect as I, useMemo as R, useCallback as x, createContext as C, useContext as _ } from "react";
|
|
3
3
|
import { Tree as q } from "react-arborist";
|
|
4
|
-
import { FolderOpenIcon as z, FolderIcon as
|
|
5
|
-
import { I as
|
|
6
|
-
import { Input as
|
|
4
|
+
import { FolderOpenIcon as z, FolderIcon as S, ChevronRightIcon as J, Loader2Icon as K } from "lucide-react";
|
|
5
|
+
import { I as Q } from "./WorkspaceProvider-DihXY2wk.js";
|
|
6
|
+
import { Input as U } from "@hachej/boring-ui-kit";
|
|
7
7
|
import { c as v } from "./utils-B6yFEsav.js";
|
|
8
|
-
|
|
8
|
+
import { createDragDropManager as X } from "dnd-core";
|
|
9
|
+
import { HTML5Backend as Y } from "react-dnd-html5-backend";
|
|
10
|
+
const k = Symbol.for("@hachej/boring-workspace/file-tree-dnd-manager");
|
|
11
|
+
function Z() {
|
|
12
|
+
const r = globalThis;
|
|
13
|
+
return r[k] ?? (r[k] = X(
|
|
14
|
+
Y,
|
|
15
|
+
typeof window > "u" ? void 0 : window
|
|
16
|
+
)), r[k];
|
|
17
|
+
}
|
|
18
|
+
const y = /* @__PURE__ */ new Set(), D = C({
|
|
9
19
|
onContextMenu: void 0,
|
|
10
20
|
editing: null,
|
|
11
|
-
pendingPaths:
|
|
21
|
+
pendingPaths: y,
|
|
12
22
|
onSubmitEdit: void 0,
|
|
13
23
|
onCancelEdit: void 0
|
|
14
24
|
});
|
|
15
|
-
function
|
|
16
|
-
initialValue:
|
|
25
|
+
function $({
|
|
26
|
+
initialValue: r,
|
|
17
27
|
onSubmit: p,
|
|
18
28
|
onCancel: h,
|
|
19
29
|
isDraft: c
|
|
20
30
|
}) {
|
|
21
|
-
const t =
|
|
31
|
+
const t = T(null), u = T(!1);
|
|
22
32
|
I(() => {
|
|
23
33
|
const e = t.current;
|
|
24
34
|
if (e)
|
|
25
|
-
if (e.focus(), !c &&
|
|
26
|
-
const o =
|
|
35
|
+
if (e.focus(), !c && r.includes(".")) {
|
|
36
|
+
const o = r.lastIndexOf(".");
|
|
27
37
|
e.setSelectionRange(0, o);
|
|
28
38
|
} else
|
|
29
39
|
e.select();
|
|
30
|
-
}, [
|
|
31
|
-
const
|
|
40
|
+
}, [r, c]);
|
|
41
|
+
const d = () => {
|
|
32
42
|
var o;
|
|
33
43
|
if (u.current) return;
|
|
34
44
|
u.current = !0;
|
|
35
45
|
const e = ((o = t.current) == null ? void 0 : o.value.trim()) ?? "";
|
|
36
|
-
!e || e ===
|
|
46
|
+
!e || e === r ? h() : p(e);
|
|
37
47
|
};
|
|
38
48
|
return /* @__PURE__ */ i(
|
|
39
|
-
|
|
49
|
+
U,
|
|
40
50
|
{
|
|
41
51
|
ref: t,
|
|
42
52
|
type: "text",
|
|
43
|
-
defaultValue:
|
|
53
|
+
defaultValue: r,
|
|
44
54
|
"data-testid": "file-tree-edit-input",
|
|
45
55
|
"aria-label": c ? "Name" : "Rename",
|
|
46
56
|
onPointerDown: (e) => e.stopPropagation(),
|
|
47
57
|
onClick: (e) => e.stopPropagation(),
|
|
48
58
|
onKeyDown: (e) => {
|
|
49
|
-
e.stopPropagation(), e.key === "Enter" ? (e.preventDefault(),
|
|
59
|
+
e.stopPropagation(), e.key === "Enter" ? (e.preventDefault(), d()) : e.key === "Escape" && (e.preventDefault(), u.current = !0, h());
|
|
50
60
|
},
|
|
51
|
-
onBlur:
|
|
61
|
+
onBlur: d,
|
|
52
62
|
className: "h-5 min-w-0 flex-1 rounded-sm border-[color:var(--accent)]/60 px-1 text-[13px] leading-[1.2] focus-visible:ring-[color:var(--accent)]"
|
|
53
63
|
}
|
|
54
64
|
);
|
|
55
65
|
}
|
|
56
|
-
function
|
|
57
|
-
const { onContextMenu: c, editing: t, pendingPaths: u, onSubmitEdit:
|
|
58
|
-
return /* @__PURE__ */
|
|
66
|
+
function E({ node: r, style: p, dragHandle: h }) {
|
|
67
|
+
const { onContextMenu: c, editing: t, pendingPaths: u, onSubmitEdit: d, onCancelEdit: e } = _(D), o = r.data, f = o.kind === "dir", l = (t == null ? void 0 : t.path) === o.path, g = u.has(o.path), b = f ? r.isOpen ? z : S : Q(o.name || "untitled");
|
|
68
|
+
return /* @__PURE__ */ B(
|
|
59
69
|
"div",
|
|
60
70
|
{
|
|
61
71
|
ref: h,
|
|
@@ -63,23 +73,23 @@ function Q({ node: n, style: p, dragHandle: h }) {
|
|
|
63
73
|
className: v(
|
|
64
74
|
"group relative mx-1 flex items-center gap-1.5 rounded-md px-2 py-0.5 text-[13px] leading-[1.4] cursor-pointer select-none text-foreground",
|
|
65
75
|
"transition-colors duration-150 ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
66
|
-
!
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
!l && "hover:bg-foreground/[0.04]",
|
|
77
|
+
r.isSelected && !l && "bg-[oklch(from_var(--accent)_l_c_h/0.10)] text-foreground font-medium",
|
|
78
|
+
r.willReceiveDrop && "bg-foreground/5 outline outline-1 outline-border"
|
|
69
79
|
),
|
|
70
80
|
onClick: (s) => {
|
|
71
|
-
|
|
81
|
+
l || (s.stopPropagation(), f ? r.toggle() : (r.select(), r.activate()));
|
|
72
82
|
},
|
|
73
83
|
onContextMenu: (s) => {
|
|
74
|
-
|
|
84
|
+
l || o.isDraft || (s.preventDefault(), s.stopPropagation(), c == null || c(s, o));
|
|
75
85
|
},
|
|
76
86
|
children: [
|
|
77
87
|
f ? /* @__PURE__ */ i(
|
|
78
|
-
|
|
88
|
+
J,
|
|
79
89
|
{
|
|
80
90
|
className: v(
|
|
81
91
|
"h-3 w-3 shrink-0 text-muted-foreground/70 transition-transform duration-150 ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
82
|
-
|
|
92
|
+
r.isOpen && "rotate-90"
|
|
83
93
|
),
|
|
84
94
|
strokeWidth: 2
|
|
85
95
|
}
|
|
@@ -89,17 +99,17 @@ function Q({ node: n, style: p, dragHandle: h }) {
|
|
|
89
99
|
{
|
|
90
100
|
className: v(
|
|
91
101
|
"h-4 w-4 shrink-0",
|
|
92
|
-
|
|
102
|
+
r.isSelected ? "text-[color:var(--accent)]" : "text-muted-foreground/80"
|
|
93
103
|
),
|
|
94
104
|
strokeWidth: 1.5
|
|
95
105
|
}
|
|
96
106
|
),
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
l ? /* @__PURE__ */ i(
|
|
108
|
+
$,
|
|
99
109
|
{
|
|
100
110
|
initialValue: (t == null ? void 0 : t.initialValue) ?? o.name ?? "",
|
|
101
111
|
isDraft: !!(t != null && t.isDraft),
|
|
102
|
-
onSubmit: (s) =>
|
|
112
|
+
onSubmit: (s) => d == null ? void 0 : d(o.path, s),
|
|
103
113
|
onCancel: () => e == null ? void 0 : e()
|
|
104
114
|
}
|
|
105
115
|
) : /* @__PURE__ */ i(
|
|
@@ -107,12 +117,12 @@ function Q({ node: n, style: p, dragHandle: h }) {
|
|
|
107
117
|
{
|
|
108
118
|
className: v(
|
|
109
119
|
"truncate",
|
|
110
|
-
|
|
120
|
+
g && "text-muted-foreground italic"
|
|
111
121
|
),
|
|
112
122
|
children: o.name
|
|
113
123
|
}
|
|
114
124
|
),
|
|
115
|
-
|
|
125
|
+
g && !l && /* @__PURE__ */ i(
|
|
116
126
|
K,
|
|
117
127
|
{
|
|
118
128
|
"data-testid": "file-tree-pending-spinner",
|
|
@@ -125,102 +135,102 @@ function Q({ node: n, style: p, dragHandle: h }) {
|
|
|
125
135
|
}
|
|
126
136
|
);
|
|
127
137
|
}
|
|
128
|
-
function
|
|
129
|
-
files:
|
|
138
|
+
function ie({
|
|
139
|
+
files: r,
|
|
130
140
|
selectedPath: p,
|
|
131
141
|
searchQuery: h,
|
|
132
142
|
height: c = 400,
|
|
133
143
|
editing: t,
|
|
134
144
|
revealPath: u,
|
|
135
|
-
pendingPaths:
|
|
145
|
+
pendingPaths: d,
|
|
136
146
|
onSelect: e,
|
|
137
147
|
onExpand: o,
|
|
138
148
|
onCollapse: f,
|
|
139
|
-
onContextMenu:
|
|
140
|
-
onSubmitEdit:
|
|
149
|
+
onContextMenu: l,
|
|
150
|
+
onSubmitEdit: g,
|
|
141
151
|
onCancelEdit: b,
|
|
142
152
|
onDragDrop: s,
|
|
143
|
-
className:
|
|
153
|
+
className: P
|
|
144
154
|
}) {
|
|
145
|
-
const
|
|
155
|
+
const N = T(null);
|
|
146
156
|
I(() => {
|
|
147
157
|
if (!(t != null && t.isDraft)) return;
|
|
148
|
-
const
|
|
158
|
+
const n = requestAnimationFrame(() => {
|
|
149
159
|
var a;
|
|
150
|
-
(a =
|
|
160
|
+
(a = N.current) == null || a.scrollTo(t.path);
|
|
151
161
|
});
|
|
152
|
-
return () => cancelAnimationFrame(
|
|
162
|
+
return () => cancelAnimationFrame(n);
|
|
153
163
|
}, [t == null ? void 0 : t.isDraft, t == null ? void 0 : t.path]), I(() => {
|
|
154
164
|
if (!u) return;
|
|
155
|
-
const
|
|
165
|
+
const n = requestAnimationFrame(() => {
|
|
156
166
|
var a;
|
|
157
|
-
(a =
|
|
167
|
+
(a = N.current) == null || a.scrollTo(u);
|
|
158
168
|
});
|
|
159
|
-
return () => cancelAnimationFrame(
|
|
160
|
-
}, [
|
|
161
|
-
const
|
|
169
|
+
return () => cancelAnimationFrame(n);
|
|
170
|
+
}, [r, u]);
|
|
171
|
+
const F = R(
|
|
162
172
|
() => p || void 0,
|
|
163
173
|
[p]
|
|
164
|
-
),
|
|
165
|
-
(
|
|
166
|
-
|
|
174
|
+
), M = x(
|
|
175
|
+
(n) => {
|
|
176
|
+
n.data.kind === "file" && (e == null || e(n.data.path));
|
|
167
177
|
},
|
|
168
178
|
[e]
|
|
169
|
-
),
|
|
170
|
-
(
|
|
179
|
+
), A = x(
|
|
180
|
+
(n) => {
|
|
171
181
|
var m;
|
|
172
|
-
const a = (m =
|
|
182
|
+
const a = (m = N.current) == null ? void 0 : m.get(n);
|
|
173
183
|
a && (a.isOpen ? o == null || o(a.data.path) : f == null || f(a.data.path));
|
|
174
184
|
},
|
|
175
185
|
[o, f]
|
|
176
|
-
),
|
|
177
|
-
(
|
|
186
|
+
), O = x(
|
|
187
|
+
(n) => {
|
|
178
188
|
if (!s) return;
|
|
179
|
-
const a = !
|
|
180
|
-
if (!(!a &&
|
|
181
|
-
for (const
|
|
182
|
-
const
|
|
183
|
-
if (m ===
|
|
184
|
-
s(
|
|
189
|
+
const a = !n.parentNode || n.parentNode.isRoot, m = a ? "." : n.parentNode.data.path;
|
|
190
|
+
if (!(!a && n.parentNode.data.kind !== "dir"))
|
|
191
|
+
for (const L of n.dragNodes) {
|
|
192
|
+
const w = L.data.path;
|
|
193
|
+
if (m === w || m !== "." && m.startsWith(w + "/")) return;
|
|
194
|
+
s(w, m);
|
|
185
195
|
}
|
|
186
196
|
},
|
|
187
197
|
[s]
|
|
188
|
-
),
|
|
189
|
-
(
|
|
190
|
-
if (!
|
|
191
|
-
if (
|
|
192
|
-
for (const a of
|
|
193
|
-
if (
|
|
198
|
+
), W = x(
|
|
199
|
+
(n) => {
|
|
200
|
+
if (!n.parentNode || n.parentNode.isRoot) return !1;
|
|
201
|
+
if (n.parentNode.data.kind !== "dir") return !0;
|
|
202
|
+
for (const a of n.dragNodes)
|
|
203
|
+
if (n.parentNode.data.path === a.data.path || n.parentNode.data.path.startsWith(a.data.path + "/")) return !0;
|
|
194
204
|
return !1;
|
|
195
205
|
},
|
|
196
206
|
[]
|
|
197
|
-
),
|
|
198
|
-
(
|
|
207
|
+
), j = x(
|
|
208
|
+
(n, a) => n.data.name.toLowerCase().includes(a.toLowerCase()),
|
|
199
209
|
[]
|
|
200
|
-
),
|
|
210
|
+
), H = R(
|
|
201
211
|
() => ({
|
|
202
|
-
onContextMenu:
|
|
212
|
+
onContextMenu: l,
|
|
203
213
|
editing: t ?? null,
|
|
204
|
-
pendingPaths:
|
|
205
|
-
onSubmitEdit:
|
|
214
|
+
pendingPaths: d ?? y,
|
|
215
|
+
onSubmitEdit: g,
|
|
206
216
|
onCancelEdit: b
|
|
207
217
|
}),
|
|
208
|
-
[
|
|
218
|
+
[l, t, d, g, b]
|
|
209
219
|
);
|
|
210
|
-
return
|
|
220
|
+
return r.length === 0 ? /* @__PURE__ */ i(
|
|
211
221
|
"div",
|
|
212
222
|
{
|
|
213
223
|
className: v(
|
|
214
224
|
"flex h-full items-center justify-center text-sm text-muted-foreground",
|
|
215
|
-
|
|
225
|
+
P
|
|
216
226
|
),
|
|
217
227
|
children: "No files"
|
|
218
228
|
}
|
|
219
|
-
) : /* @__PURE__ */ i(
|
|
229
|
+
) : /* @__PURE__ */ i(D.Provider, { value: H, children: /* @__PURE__ */ i("div", { "data-boring-workspace-part": "file-tree", className: v("file-tree", P), children: /* @__PURE__ */ i(
|
|
220
230
|
q,
|
|
221
231
|
{
|
|
222
|
-
ref:
|
|
223
|
-
data:
|
|
232
|
+
ref: N,
|
|
233
|
+
data: r,
|
|
224
234
|
idAccessor: "path",
|
|
225
235
|
childrenAccessor: "children",
|
|
226
236
|
openByDefault: !1,
|
|
@@ -228,18 +238,19 @@ function te({
|
|
|
228
238
|
height: c,
|
|
229
239
|
rowHeight: 26,
|
|
230
240
|
indent: 14,
|
|
231
|
-
selection:
|
|
241
|
+
selection: F,
|
|
232
242
|
searchTerm: h ?? "",
|
|
233
|
-
searchMatch:
|
|
234
|
-
onActivate:
|
|
235
|
-
onToggle:
|
|
236
|
-
onMove:
|
|
237
|
-
disableDrop:
|
|
243
|
+
searchMatch: j,
|
|
244
|
+
onActivate: M,
|
|
245
|
+
onToggle: A,
|
|
246
|
+
onMove: O,
|
|
247
|
+
disableDrop: W,
|
|
238
248
|
disableEdit: !0,
|
|
239
|
-
|
|
249
|
+
dndManager: Z(),
|
|
250
|
+
children: E
|
|
240
251
|
}
|
|
241
252
|
) }) });
|
|
242
253
|
}
|
|
243
254
|
export {
|
|
244
|
-
|
|
255
|
+
ie as FileTree
|
|
245
256
|
};
|
|
@@ -15,7 +15,7 @@ import { TableHeader as ut } from "@tiptap/extension-table-header";
|
|
|
15
15
|
import { TableCell as gt } from "@tiptap/extension-table-cell";
|
|
16
16
|
import dt from "@tiptap/extension-image";
|
|
17
17
|
import { c as U } from "./utils-B6yFEsav.js";
|
|
18
|
-
import { ao as q, ap as _ } from "./WorkspaceProvider-
|
|
18
|
+
import { ao as q, ap as _ } from "./WorkspaceProvider-DihXY2wk.js";
|
|
19
19
|
import { uploadFile as ft } from "@hachej/boring-agent/front";
|
|
20
20
|
import mt from "@tiptap/extension-code-block-lowlight";
|
|
21
21
|
import { createLowlight as pt, common as ht } from "lowlight";
|
|
@@ -2,7 +2,7 @@ import { jsxs as l, jsx as a, Fragment as V } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback as b, useMemo as E, useEffect as z, useState as q, useSyncExternalStore as Q, Suspense as Y, useRef as ee } from "react";
|
|
3
3
|
import { LoadingState as te, ResizeHandle as ne, IconButton as Z, Button as re, Kbd as ae } from "@hachej/boring-ui-kit";
|
|
4
4
|
import { c as g } from "./utils-B6yFEsav.js";
|
|
5
|
-
import { $ as oe, a6 as ie, z as se, an as ce, al as de, u as le, ag as ue } from "./WorkspaceProvider-
|
|
5
|
+
import { $ as oe, a6 as ie, z as se, an as ce, al as de, u as le, ag as ue } from "./WorkspaceProvider-DihXY2wk.js";
|
|
6
6
|
import { Search as he, Plus as me } from "lucide-react";
|
|
7
7
|
function _e(e, t, r = !0) {
|
|
8
8
|
if (!r || typeof window > "u") return t;
|
|
@@ -2175,7 +2175,7 @@ async function ci(e) {
|
|
|
2175
2175
|
}
|
|
2176
2176
|
if (!n) throw new Error("Clipboard not available");
|
|
2177
2177
|
}
|
|
2178
|
-
const cr = () => import("./FileTree-
|
|
2178
|
+
const cr = () => import("./FileTree-nBvBA8m7.js").then((e) => ({ default: e.FileTree }));
|
|
2179
2179
|
function li() {
|
|
2180
2180
|
cr();
|
|
2181
2181
|
}
|
|
@@ -2974,7 +2974,7 @@ function dn({ params: e, api: t, className: n }) {
|
|
|
2974
2974
|
);
|
|
2975
2975
|
}
|
|
2976
2976
|
const Ii = Ze(
|
|
2977
|
-
() => import("./MarkdownEditor-
|
|
2977
|
+
() => import("./MarkdownEditor-CeigBQee.js").then((e) => ({ default: e.MarkdownEditor }))
|
|
2978
2978
|
);
|
|
2979
2979
|
function Ti({ params: e, api: t, className: n }) {
|
|
2980
2980
|
const r = typeof (e == null ? void 0 : e.path) == "string" ? e.path : "", {
|
package/dist/app-front.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as d, jsxs as xe, Fragment as $ } from "react/jsx-runtime";
|
|
2
2
|
import { useSyncExternalStore as qe, useMemo as P, useCallback as v, useRef as K, useState as re, useEffect as y } from "react";
|
|
3
3
|
import { ChatPanel as et, useSessions as tt } from "@hachej/boring-agent/front";
|
|
4
|
-
import { ak as st, U as We, o as rt, al as nt, u as ot, am as at } from "./WorkspaceProvider-
|
|
5
|
-
import { T as ct, C as it, r as Le, w as lt, W as Re } from "./WorkspaceLoadingState-
|
|
4
|
+
import { ak as st, U as We, o as rt, al as nt, u as ot, am as at } from "./WorkspaceProvider-DihXY2wk.js";
|
|
5
|
+
import { T as ct, C as it, r as Le, w as lt, W as Re } from "./WorkspaceLoadingState-DuoIpOxl.js";
|
|
6
6
|
function ut() {
|
|
7
7
|
const e = `s${Date.now()}`;
|
|
8
8
|
return {
|
package/dist/app-server.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { PiPackageSource, PiExtensionFactory, CreateAgentAppOptions } from '@hachej/boring-agent/server';
|
|
1
|
+
import { PiPackageSource, PiExtensionFactory, CreateAgentAppOptions, ProvisionWorkspaceRuntimeOptions } from '@hachej/boring-agent/server';
|
|
2
2
|
export { PiPackageSource as WorkspacePiPackageSource } from '@hachej/boring-agent/server';
|
|
3
3
|
import { FastifyInstance } from 'fastify';
|
|
4
|
-
import { W as WorkspaceServerPlugin, S as ServerBootstrapOptions, a as WorkspaceProvisioningContribution, b as WorkspaceRouteContribution, c as createInMemoryBridge } from './createInMemoryBridge-
|
|
5
|
-
|
|
4
|
+
import { W as WorkspaceServerPlugin, S as ServerBootstrapOptions, a as WorkspaceProvisioningContribution, b as WorkspaceRouteContribution, c as createInMemoryBridge } from './createInMemoryBridge-CYNW1h_o.js';
|
|
5
|
+
export { d as ServerWorkspaceRuntimeProvisioningInput } from './createInMemoryBridge-CYNW1h_o.js';
|
|
6
|
+
import './ui-bridge-CT18yqwN.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Directory-source entry: `{ dir, options?, hotReload? }`. Resolved via
|
|
@@ -132,6 +133,7 @@ interface CreateWorkspaceAgentServerOptions extends WorkspaceAgentCreateOptions,
|
|
|
132
133
|
}
|
|
133
134
|
interface WorkspaceAgentServerPluginCollection {
|
|
134
135
|
provisioningContributions: WorkspaceProvisioningContribution[];
|
|
136
|
+
runtimePlugins: WorkspaceRuntimeProvisioningInput[];
|
|
135
137
|
routeContributions: WorkspaceRouteContribution[];
|
|
136
138
|
preservedUiStateKeys: string[];
|
|
137
139
|
agentOptions: Pick<WorkspaceAgentCreateOptions, "extraTools" | "systemPromptAppend" | "pi">;
|
|
@@ -154,6 +156,8 @@ interface WorkspacePluginPackagePiSnapshot {
|
|
|
154
156
|
extensionPaths: string[];
|
|
155
157
|
systemPromptAppend?: string;
|
|
156
158
|
}
|
|
159
|
+
type WorkspaceRuntimeProvisioningInput = ProvisionWorkspaceRuntimeOptions["plugins"][number];
|
|
160
|
+
declare function readWorkspacePluginPackageRuntimePlugins(pluginDirs: string[]): WorkspaceRuntimeProvisioningInput[];
|
|
157
161
|
declare function readWorkspacePluginPackagePiSnapshot(pluginDirs: string[]): WorkspacePluginPackagePiSnapshot;
|
|
158
162
|
declare function createWorkspaceAgentServer(opts?: CreateWorkspaceAgentServerOptions): Promise<FastifyInstance>;
|
|
159
163
|
|
|
@@ -170,4 +174,4 @@ interface ResolveDefaultWorkspacePluginPackagePathsOptions {
|
|
|
170
174
|
*/
|
|
171
175
|
declare function resolveDefaultWorkspacePluginPackagePaths({ workspaceRoot, defaultPluginPackages, appPackageJsonPath, }?: ResolveDefaultWorkspacePluginPackagePathsOptions): string[];
|
|
172
176
|
|
|
173
|
-
export { type CollectWorkspaceAgentServerPluginsOptions, type CreateWorkspaceAgentServerOptions, type DirPluginEntry, type PluginResolveContext, type ResolveDefaultWorkspacePluginPackagePathsOptions, type WorkspaceAgentPiOptions, type WorkspaceAgentServerPluginCollection, type WorkspaceAgentServerPluginContext, type WorkspacePluginEntry, type WorkspacePluginPackagePiSnapshot, WorkspaceProvisioningContribution, WorkspaceRouteContribution, buildWorkspaceContextPrompt, collectWorkspaceAgentServerPlugins, createWorkspaceAgentServer, hasDirServerPlugin, provisionWorkspaceAgentServer, readWorkspacePluginPackagePiSnapshot, resolveDefaultWorkspacePluginPackagePaths, resolveOnePluginEntry };
|
|
177
|
+
export { type CollectWorkspaceAgentServerPluginsOptions, type CreateWorkspaceAgentServerOptions, type DirPluginEntry, type PluginResolveContext, type ResolveDefaultWorkspacePluginPackagePathsOptions, type WorkspaceAgentPiOptions, type WorkspaceAgentServerPluginCollection, type WorkspaceAgentServerPluginContext, type WorkspacePluginEntry, type WorkspacePluginPackagePiSnapshot, WorkspaceProvisioningContribution, WorkspaceRouteContribution, type WorkspaceRuntimeProvisioningInput, buildWorkspaceContextPrompt, collectWorkspaceAgentServerPlugins, createWorkspaceAgentServer, hasDirServerPlugin, provisionWorkspaceAgentServer, readWorkspacePluginPackagePiSnapshot, readWorkspacePluginPackageRuntimePlugins, resolveDefaultWorkspacePluginPackagePaths, resolveOnePluginEntry };
|
package/dist/app-server.js
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
autoDetectMode,
|
|
4
4
|
createAgentApp,
|
|
5
|
+
getBoringAgentRuntimePaths,
|
|
5
6
|
provisionRuntimeWorkspace,
|
|
6
|
-
|
|
7
|
+
provisionWorkspaceRuntime,
|
|
8
|
+
resolveMode,
|
|
9
|
+
VERCEL_SANDBOX_WORKSPACE_ROOT
|
|
7
10
|
} from "@hachej/boring-agent/server";
|
|
8
11
|
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "fs";
|
|
9
12
|
import { dirname as dirname7, join as join7 } from "path";
|
|
@@ -985,6 +988,20 @@ function validatePiPackages2(pluginId, piPackages) {
|
|
|
985
988
|
}
|
|
986
989
|
}
|
|
987
990
|
}
|
|
991
|
+
function validateSkills(pluginId, skills) {
|
|
992
|
+
for (let i = 0; i < skills.length; i++) {
|
|
993
|
+
const skill = skills[i];
|
|
994
|
+
if (!skill || typeof skill !== "object") {
|
|
995
|
+
fail(pluginId, `skills[${i}] must be an object`);
|
|
996
|
+
}
|
|
997
|
+
if (!skill.name || typeof skill.name !== "string") {
|
|
998
|
+
fail(pluginId, `skills[${i}].name must be a non-empty string`);
|
|
999
|
+
}
|
|
1000
|
+
if (!isPathLike(skill.source)) {
|
|
1001
|
+
fail(pluginId, `skills[${i}].source must be a string or URL`);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
988
1005
|
function validateProvisioning(pluginId, provisioning) {
|
|
989
1006
|
if (!provisioning || typeof provisioning !== "object") {
|
|
990
1007
|
fail(pluginId, "provisioning must be an object");
|
|
@@ -1024,7 +1041,7 @@ function validateProvisioning(pluginId, provisioning) {
|
|
|
1024
1041
|
if (!spec.packageName || typeof spec.packageName !== "string") {
|
|
1025
1042
|
fail(pluginId, `provisioning.nodePackages[${i}].packageName must be a non-empty string`);
|
|
1026
1043
|
}
|
|
1027
|
-
if (!isPathLike(spec.packageRoot)) {
|
|
1044
|
+
if (spec.packageRoot !== void 0 && !isPathLike(spec.packageRoot)) {
|
|
1028
1045
|
fail(pluginId, `provisioning.nodePackages[${i}].packageRoot must be a string or URL`);
|
|
1029
1046
|
}
|
|
1030
1047
|
}
|
|
@@ -1086,6 +1103,12 @@ function validateServerPlugin(plugin) {
|
|
|
1086
1103
|
}
|
|
1087
1104
|
});
|
|
1088
1105
|
}
|
|
1106
|
+
if (plugin.skills !== void 0) {
|
|
1107
|
+
if (!Array.isArray(plugin.skills)) {
|
|
1108
|
+
fail(plugin.id, "skills must be an array when provided");
|
|
1109
|
+
}
|
|
1110
|
+
validateSkills(plugin.id, plugin.skills);
|
|
1111
|
+
}
|
|
1089
1112
|
if (plugin.agentTools !== void 0) {
|
|
1090
1113
|
if (!Array.isArray(plugin.agentTools)) {
|
|
1091
1114
|
fail(plugin.id, "agentTools must be an array when provided");
|
|
@@ -1130,6 +1153,11 @@ function bootstrapServer(options) {
|
|
|
1130
1153
|
const piPackages = compactPiPackages(finalPlugins.flatMap((plugin) => plugin.piPackages ?? []));
|
|
1131
1154
|
const extensionPaths = finalPlugins.flatMap((p) => p.extensionPaths ?? []);
|
|
1132
1155
|
const provisioningContributions = finalPlugins.filter((p) => p.provisioning).map((p) => ({ id: p.id, provisioning: p.provisioning }));
|
|
1156
|
+
const runtimePlugins = finalPlugins.map((plugin) => ({
|
|
1157
|
+
id: plugin.id,
|
|
1158
|
+
...plugin.skills ? { skills: plugin.skills } : {},
|
|
1159
|
+
...plugin.provisioning ? { provisioning: plugin.provisioning } : {}
|
|
1160
|
+
}));
|
|
1133
1161
|
const routeContributions = finalPlugins.filter((p) => p.routes).map((p) => ({ id: p.id, routes: p.routes }));
|
|
1134
1162
|
const preservedUiStateKeys = [...new Set(finalPlugins.flatMap((p) => p.preservedUiStateKeys ?? []))];
|
|
1135
1163
|
return {
|
|
@@ -1138,6 +1166,7 @@ function bootstrapServer(options) {
|
|
|
1138
1166
|
piPackages,
|
|
1139
1167
|
extensionPaths,
|
|
1140
1168
|
agentTools,
|
|
1169
|
+
runtimePlugins,
|
|
1141
1170
|
provisioningContributions,
|
|
1142
1171
|
routeContributions,
|
|
1143
1172
|
preservedUiStateKeys
|
|
@@ -1885,8 +1914,9 @@ function buildWorkspaceContextPrompt() {
|
|
|
1885
1914
|
return [
|
|
1886
1915
|
"## Workspace",
|
|
1887
1916
|
"- Root: `$BORING_AGENT_WORKSPACE_ROOT` (exported into every bash invocation)",
|
|
1888
|
-
"-
|
|
1889
|
-
"-
|
|
1917
|
+
"- Generated plugin skills: `$BORING_AGENT_WORKSPACE_ROOT/.boring-agent/skills/` \u2014 readable with normal file tools",
|
|
1918
|
+
"- User workspace skills: `$BORING_AGENT_WORKSPACE_ROOT/.agents/skills/`",
|
|
1919
|
+
"- Runtime CLIs (`boring-ui`, `bm`, `python`, `pip`, `uv`) come from `.boring-agent/node`, `.boring-agent/venv`, and `.boring-agent/sdk/uv` and are already on PATH"
|
|
1890
1920
|
].join("\n");
|
|
1891
1921
|
}
|
|
1892
1922
|
function collectWorkspaceAgentServerPlugins(opts = {}) {
|
|
@@ -1900,13 +1930,20 @@ function collectWorkspaceAgentServerPlugins(opts = {}) {
|
|
|
1900
1930
|
const callerAdditional = opts.pi?.additionalSkillPaths ?? [];
|
|
1901
1931
|
const callerPiPackages = opts.pi?.packages ?? [];
|
|
1902
1932
|
const callerExtensionPaths = opts.pi?.extensionPaths ?? [];
|
|
1933
|
+
const builtinProvisioningContributions = [
|
|
1934
|
+
createWorkspacePackageProvisioningContribution(),
|
|
1935
|
+
createBoringPiPackageProvisioningContribution(),
|
|
1936
|
+
createBoringUiCliPackageProvisioningContribution()
|
|
1937
|
+
].filter((entry) => Boolean(entry));
|
|
1903
1938
|
return {
|
|
1904
1939
|
provisioningContributions: [
|
|
1905
|
-
|
|
1906
|
-
createBoringPiPackageProvisioningContribution(),
|
|
1907
|
-
createBoringUiCliPackageProvisioningContribution(),
|
|
1940
|
+
...builtinProvisioningContributions,
|
|
1908
1941
|
...result.provisioningContributions
|
|
1909
|
-
]
|
|
1942
|
+
],
|
|
1943
|
+
runtimePlugins: [
|
|
1944
|
+
...builtinProvisioningContributions,
|
|
1945
|
+
...result.runtimePlugins
|
|
1946
|
+
],
|
|
1910
1947
|
routeContributions: result.routeContributions,
|
|
1911
1948
|
preservedUiStateKeys: result.preservedUiStateKeys,
|
|
1912
1949
|
agentOptions: {
|
|
@@ -1947,9 +1984,42 @@ function collectBoringPluginDirs(workspaceRoot, pluginCollection) {
|
|
|
1947
1984
|
...pluginRoots
|
|
1948
1985
|
];
|
|
1949
1986
|
}
|
|
1987
|
+
function mergeRuntimeProvisioningInputs(plugins) {
|
|
1988
|
+
const byId = /* @__PURE__ */ new Map();
|
|
1989
|
+
for (const plugin of plugins) {
|
|
1990
|
+
const current = byId.get(plugin.id) ?? { id: plugin.id };
|
|
1991
|
+
byId.set(plugin.id, {
|
|
1992
|
+
id: plugin.id,
|
|
1993
|
+
skills: [...current.skills ?? [], ...plugin.skills ?? []],
|
|
1994
|
+
provisioning: {
|
|
1995
|
+
templateDirs: [...current.provisioning?.templateDirs ?? [], ...plugin.provisioning?.templateDirs ?? []],
|
|
1996
|
+
python: [...current.provisioning?.python ?? [], ...plugin.provisioning?.python ?? []],
|
|
1997
|
+
nodePackages: [...current.provisioning?.nodePackages ?? [], ...plugin.provisioning?.nodePackages ?? []]
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
return [...byId.values()];
|
|
2002
|
+
}
|
|
1950
2003
|
function emptyPackageJsonPiSnapshot() {
|
|
1951
2004
|
return { additionalSkillPaths: [], packages: [], extensionPaths: [] };
|
|
1952
2005
|
}
|
|
2006
|
+
function skillNameFromResolvedPath(path) {
|
|
2007
|
+
const leaf = path.split(/[\\/]/).filter(Boolean).at(-1) ?? "skill";
|
|
2008
|
+
if (leaf.toLowerCase() !== "skill.md") return leaf;
|
|
2009
|
+
return path.split(/[\\/]/).filter(Boolean).at(-2) ?? "skill";
|
|
2010
|
+
}
|
|
2011
|
+
function readWorkspacePluginPackageRuntimePlugins(pluginDirs) {
|
|
2012
|
+
const scan = scanBoringPlugins(pluginDirs);
|
|
2013
|
+
return scan.plugins.map((plugin) => ({
|
|
2014
|
+
id: plugin.id,
|
|
2015
|
+
...plugin.skillPaths?.length ? {
|
|
2016
|
+
skills: plugin.skillPaths.map((source) => ({
|
|
2017
|
+
name: skillNameFromResolvedPath(source),
|
|
2018
|
+
source
|
|
2019
|
+
}))
|
|
2020
|
+
} : {}
|
|
2021
|
+
}));
|
|
2022
|
+
}
|
|
1953
2023
|
function aggregatePluginSystemPromptsFromScan(scan) {
|
|
1954
2024
|
const prompts = scan.plugins.map((plugin) => plugin.pi?.systemPrompt?.trim()).filter((prompt) => Boolean(prompt));
|
|
1955
2025
|
if (prompts.length === 0) return void 0;
|
|
@@ -1980,7 +2050,8 @@ async function createWorkspaceAgentServer(opts = {}) {
|
|
|
1980
2050
|
const workspaceRoot = opts.workspaceRoot ?? process.cwd();
|
|
1981
2051
|
const bridge = createInMemoryBridge();
|
|
1982
2052
|
const resolvedMode = opts.runtimeModeAdapter?.id ?? opts.mode ?? autoDetectMode();
|
|
1983
|
-
const
|
|
2053
|
+
const modeAdapter = opts.runtimeModeAdapter ?? resolveMode(resolvedMode);
|
|
2054
|
+
const workspaceFsCapability = modeAdapter.workspaceFsCapability ?? "best-effort";
|
|
1984
2055
|
const validateUiPaths = opts.validateUiPaths ?? workspaceFsCapability === "strong";
|
|
1985
2056
|
const uiTools = createWorkspaceUiTools(bridge, {
|
|
1986
2057
|
workspaceRoot: validateUiPaths ? workspaceRoot : void 0
|
|
@@ -2004,13 +2075,6 @@ async function createWorkspaceAgentServer(opts = {}) {
|
|
|
2004
2075
|
...opts,
|
|
2005
2076
|
plugins: resolvedPlugins
|
|
2006
2077
|
});
|
|
2007
|
-
if (opts.provisionWorkspace !== false) {
|
|
2008
|
-
await provisionWorkspaceAgentServer({
|
|
2009
|
-
workspaceRoot,
|
|
2010
|
-
provisioningContributions: pluginCollection.provisioningContributions,
|
|
2011
|
-
force: opts.workspaceProvisioning?.force
|
|
2012
|
-
});
|
|
2013
|
-
}
|
|
2014
2078
|
const workspacePackagePiPackage = createBoringPiPackageSource(workspaceRoot);
|
|
2015
2079
|
const baseStaticPiSkillPaths = [
|
|
2016
2080
|
...resolveBoringPiSkillPaths(workspaceRoot),
|
|
@@ -2043,6 +2107,28 @@ async function createWorkspaceAgentServer(opts = {}) {
|
|
|
2043
2107
|
pluginDirs: boringPluginDirs,
|
|
2044
2108
|
errorRoot: join7(workspaceRoot, ".pi", "extensions")
|
|
2045
2109
|
});
|
|
2110
|
+
const buildRuntimeProvisioningInputs = () => mergeRuntimeProvisioningInputs([
|
|
2111
|
+
...pluginCollection.runtimePlugins,
|
|
2112
|
+
...readWorkspacePluginPackageRuntimePlugins(boringPluginDirs)
|
|
2113
|
+
]);
|
|
2114
|
+
let currentRuntimeProvisioning = opts.runtimeProvisioning;
|
|
2115
|
+
const runtimeWorkspaceRoot = resolvedMode === "vercel-sandbox" ? VERCEL_SANDBOX_WORKSPACE_ROOT : workspaceRoot;
|
|
2116
|
+
const runtimeLayout = getBoringAgentRuntimePaths(runtimeWorkspaceRoot);
|
|
2117
|
+
const runRuntimeProvisioning = async () => {
|
|
2118
|
+
if (opts.provisionWorkspace === false) return currentRuntimeProvisioning;
|
|
2119
|
+
const adapter = modeAdapter.createProvisioningAdapter?.(runtimeLayout, {
|
|
2120
|
+
workspaceRoot,
|
|
2121
|
+
sessionId: opts.sessionId ?? "default"
|
|
2122
|
+
});
|
|
2123
|
+
if (!adapter) return currentRuntimeProvisioning;
|
|
2124
|
+
currentRuntimeProvisioning = await provisionWorkspaceRuntime({
|
|
2125
|
+
plugins: buildRuntimeProvisioningInputs(),
|
|
2126
|
+
adapter,
|
|
2127
|
+
runtimeLayout
|
|
2128
|
+
});
|
|
2129
|
+
return currentRuntimeProvisioning;
|
|
2130
|
+
};
|
|
2131
|
+
await runRuntimeProvisioning();
|
|
2046
2132
|
const rebuildPlugins = async () => {
|
|
2047
2133
|
return rebuildServerPlugins({ entries: allPluginEntries, ctx });
|
|
2048
2134
|
};
|
|
@@ -2088,6 +2174,7 @@ async function createWorkspaceAgentServer(opts = {}) {
|
|
|
2088
2174
|
const rebuild = await rebuildPlugins();
|
|
2089
2175
|
diagnostics = [...scanDiagnostics, ...rebuild.diagnostics];
|
|
2090
2176
|
}
|
|
2177
|
+
await runRuntimeProvisioning();
|
|
2091
2178
|
const callerResult = await opts.beforeReload?.();
|
|
2092
2179
|
const callerRestartWarnings = callerResult && typeof callerResult === "object" ? callerResult.restart_warnings ?? [] : [];
|
|
2093
2180
|
const callerDiagnostics = callerResult && typeof callerResult === "object" ? callerResult.diagnostics ?? [] : [];
|
|
@@ -2099,6 +2186,8 @@ async function createWorkspaceAgentServer(opts = {}) {
|
|
|
2099
2186
|
...mergedDiagnostics.length > 0 ? { diagnostics: mergedDiagnostics } : {}
|
|
2100
2187
|
};
|
|
2101
2188
|
},
|
|
2189
|
+
runtimeProvisioning: currentRuntimeProvisioning,
|
|
2190
|
+
getRuntimeProvisioning: () => currentRuntimeProvisioning,
|
|
2102
2191
|
pi: {
|
|
2103
2192
|
...pluginCollection.agentOptions.pi,
|
|
2104
2193
|
additionalSkillPaths: staticPiSkillPaths,
|
|
@@ -2130,6 +2219,7 @@ export {
|
|
|
2130
2219
|
hasDirServerPlugin,
|
|
2131
2220
|
provisionWorkspaceAgentServer,
|
|
2132
2221
|
readWorkspacePluginPackagePiSnapshot,
|
|
2222
|
+
readWorkspacePluginPackageRuntimePlugins,
|
|
2133
2223
|
resolveDefaultWorkspacePluginPackagePaths,
|
|
2134
2224
|
resolveOnePluginEntry
|
|
2135
2225
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PiPackageSource,
|
|
1
|
+
import { PiPackageSource, PluginSkillSource, ProvisionWorkspaceRuntimeOptions } from '@hachej/boring-agent/server';
|
|
2
2
|
import { FastifyPluginAsync } from 'fastify';
|
|
3
|
-
import { A as AgentTool, U as UiBridge } from './ui-bridge-
|
|
3
|
+
import { A as AgentTool, U as UiBridge } from './ui-bridge-CT18yqwN.js';
|
|
4
4
|
|
|
5
|
+
type WorkspaceRuntimeProvisioning = NonNullable<ProvisionWorkspaceRuntimeOptions["plugins"][number]["provisioning"]>;
|
|
5
6
|
interface WorkspaceServerPlugin {
|
|
6
7
|
id: string;
|
|
7
8
|
label?: string;
|
|
@@ -18,8 +19,9 @@ interface WorkspaceServerPlugin {
|
|
|
18
19
|
*/
|
|
19
20
|
extensionPaths?: string[];
|
|
20
21
|
systemPrompt?: string;
|
|
22
|
+
skills?: PluginSkillSource[];
|
|
21
23
|
agentTools?: AgentTool[];
|
|
22
|
-
provisioning?:
|
|
24
|
+
provisioning?: WorkspaceRuntimeProvisioning;
|
|
23
25
|
routes?: FastifyPluginAsync;
|
|
24
26
|
/** UI state keys owned by this plugin that browser state PUTs must not overwrite. */
|
|
25
27
|
preservedUiStateKeys?: string[];
|
|
@@ -32,9 +34,10 @@ interface ServerBootstrapOptions {
|
|
|
32
34
|
defaults?: WorkspaceServerPlugin[];
|
|
33
35
|
excludeDefaults?: string[];
|
|
34
36
|
}
|
|
37
|
+
type WorkspaceRuntimeProvisioningInput = ProvisionWorkspaceRuntimeOptions["plugins"][number];
|
|
35
38
|
type WorkspaceProvisioningContribution = {
|
|
36
39
|
id: string;
|
|
37
|
-
provisioning:
|
|
40
|
+
provisioning: NonNullable<WorkspaceRuntimeProvisioningInput["provisioning"]>;
|
|
38
41
|
};
|
|
39
42
|
type WorkspaceRouteContribution = {
|
|
40
43
|
id: string;
|
|
@@ -46,6 +49,7 @@ interface ServerBootstrapResult {
|
|
|
46
49
|
piPackages: PiPackageSource[];
|
|
47
50
|
extensionPaths: string[];
|
|
48
51
|
agentTools: AgentTool[];
|
|
52
|
+
runtimePlugins: WorkspaceRuntimeProvisioningInput[];
|
|
49
53
|
provisioningContributions: WorkspaceProvisioningContribution[];
|
|
50
54
|
routeContributions: WorkspaceRouteContribution[];
|
|
51
55
|
preservedUiStateKeys: string[];
|
|
@@ -54,4 +58,4 @@ declare function bootstrapServer(options: ServerBootstrapOptions): ServerBootstr
|
|
|
54
58
|
|
|
55
59
|
declare function createInMemoryBridge(): UiBridge;
|
|
56
60
|
|
|
57
|
-
export { type ServerBootstrapOptions as S, type WorkspaceServerPlugin as W, type WorkspaceProvisioningContribution as a, type WorkspaceRouteContribution as b, createInMemoryBridge as c, type
|
|
61
|
+
export { type ServerBootstrapOptions as S, type WorkspaceServerPlugin as W, type WorkspaceProvisioningContribution as a, type WorkspaceRouteContribution as b, createInMemoryBridge as c, type WorkspaceRuntimeProvisioningInput as d, type ServerBootstrapResult as e, bootstrapServer as f, defineServerPlugin as g, validateServerPlugin as v };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { S as ServerBootstrapOptions,
|
|
1
|
+
export { S as ServerBootstrapOptions, e as ServerBootstrapResult, a as WorkspaceProvisioningContribution, b as WorkspaceRouteContribution, W as WorkspaceServerPlugin, f as bootstrapServer, c as createInMemoryBridge, g as defineServerPlugin, v as validateServerPlugin } from './createInMemoryBridge-CYNW1h_o.js';
|
|
2
2
|
import { FastifyRequest, FastifyInstance } from 'fastify';
|
|
3
|
-
import { U as UiBridge, A as AgentTool } from './ui-bridge-
|
|
4
|
-
export { C as CommandResult,
|
|
3
|
+
import { U as UiBridge, A as AgentTool } from './ui-bridge-CT18yqwN.js';
|
|
4
|
+
export { C as CommandResult, a as UiCommand, b as UiState } from './ui-bridge-CT18yqwN.js';
|
|
5
5
|
import { B as BoringPackageBoringField, a as BoringPackagePiField } from './manifest-CyNNdfYz.js';
|
|
6
6
|
export { PiPackageSource as WorkspacePiPackageSource } from '@hachej/boring-agent/server';
|
|
7
7
|
|
package/dist/server.js
CHANGED
|
@@ -516,6 +516,20 @@ function validatePiPackages(pluginId, piPackages) {
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
+
function validateSkills(pluginId, skills) {
|
|
520
|
+
for (let i = 0; i < skills.length; i++) {
|
|
521
|
+
const skill = skills[i];
|
|
522
|
+
if (!skill || typeof skill !== "object") {
|
|
523
|
+
fail(pluginId, `skills[${i}] must be an object`);
|
|
524
|
+
}
|
|
525
|
+
if (!skill.name || typeof skill.name !== "string") {
|
|
526
|
+
fail(pluginId, `skills[${i}].name must be a non-empty string`);
|
|
527
|
+
}
|
|
528
|
+
if (!isPathLike(skill.source)) {
|
|
529
|
+
fail(pluginId, `skills[${i}].source must be a string or URL`);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
519
533
|
function validateProvisioning(pluginId, provisioning) {
|
|
520
534
|
if (!provisioning || typeof provisioning !== "object") {
|
|
521
535
|
fail(pluginId, "provisioning must be an object");
|
|
@@ -555,7 +569,7 @@ function validateProvisioning(pluginId, provisioning) {
|
|
|
555
569
|
if (!spec.packageName || typeof spec.packageName !== "string") {
|
|
556
570
|
fail(pluginId, `provisioning.nodePackages[${i}].packageName must be a non-empty string`);
|
|
557
571
|
}
|
|
558
|
-
if (!isPathLike(spec.packageRoot)) {
|
|
572
|
+
if (spec.packageRoot !== void 0 && !isPathLike(spec.packageRoot)) {
|
|
559
573
|
fail(pluginId, `provisioning.nodePackages[${i}].packageRoot must be a string or URL`);
|
|
560
574
|
}
|
|
561
575
|
}
|
|
@@ -617,6 +631,12 @@ function validateServerPlugin(plugin) {
|
|
|
617
631
|
}
|
|
618
632
|
});
|
|
619
633
|
}
|
|
634
|
+
if (plugin.skills !== void 0) {
|
|
635
|
+
if (!Array.isArray(plugin.skills)) {
|
|
636
|
+
fail(plugin.id, "skills must be an array when provided");
|
|
637
|
+
}
|
|
638
|
+
validateSkills(plugin.id, plugin.skills);
|
|
639
|
+
}
|
|
620
640
|
if (plugin.agentTools !== void 0) {
|
|
621
641
|
if (!Array.isArray(plugin.agentTools)) {
|
|
622
642
|
fail(plugin.id, "agentTools must be an array when provided");
|
|
@@ -665,6 +685,11 @@ function bootstrapServer(options) {
|
|
|
665
685
|
const piPackages = compactPiPackages(finalPlugins.flatMap((plugin) => plugin.piPackages ?? []));
|
|
666
686
|
const extensionPaths = finalPlugins.flatMap((p) => p.extensionPaths ?? []);
|
|
667
687
|
const provisioningContributions = finalPlugins.filter((p) => p.provisioning).map((p) => ({ id: p.id, provisioning: p.provisioning }));
|
|
688
|
+
const runtimePlugins = finalPlugins.map((plugin) => ({
|
|
689
|
+
id: plugin.id,
|
|
690
|
+
...plugin.skills ? { skills: plugin.skills } : {},
|
|
691
|
+
...plugin.provisioning ? { provisioning: plugin.provisioning } : {}
|
|
692
|
+
}));
|
|
668
693
|
const routeContributions = finalPlugins.filter((p) => p.routes).map((p) => ({ id: p.id, routes: p.routes }));
|
|
669
694
|
const preservedUiStateKeys = [...new Set(finalPlugins.flatMap((p) => p.preservedUiStateKeys ?? []))];
|
|
670
695
|
return {
|
|
@@ -673,6 +698,7 @@ function bootstrapServer(options) {
|
|
|
673
698
|
piPackages,
|
|
674
699
|
extensionPaths,
|
|
675
700
|
agentTools,
|
|
701
|
+
runtimePlugins,
|
|
676
702
|
provisioningContributions,
|
|
677
703
|
routeContributions,
|
|
678
704
|
preservedUiStateKeys
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
export { A as AgentTool, C as CommandResult, J as JSONSchema, T as ToolExecContext,
|
|
1
|
+
export { A as AgentTool, C as CommandResult, J as JSONSchema, T as ToolExecContext, c as ToolResult, U as UiBridge, a as UiCommand, b as UiState } from './ui-bridge-CT18yqwN.js';
|
|
2
2
|
export { C as CommandConfig, P as PaneProps, a as PanelConfig, b as PanelRegistration, S as SurfaceOpenRequest, c as SurfacePanelResolution, d as SurfaceResolverConfig, e as SurfaceResolverRegistration, W as WORKSPACE_OPEN_PATH_SURFACE_KIND, f as definePanel } from './surface-COYagY2m.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'dockview-react';
|
|
5
|
+
|
|
6
|
+
interface TelemetrySink {
|
|
7
|
+
capture(event: TelemetryEvent): void | Promise<void>;
|
|
8
|
+
flush?(): void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
interface TelemetryEvent {
|
|
11
|
+
name: string;
|
|
12
|
+
distinctId?: string;
|
|
13
|
+
properties?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
declare const noopTelemetry: TelemetrySink;
|
|
16
|
+
declare function safeCapture(telemetry: TelemetrySink, event: TelemetryEvent): void;
|
|
17
|
+
|
|
18
|
+
export { type TelemetryEvent, type TelemetrySink, noopTelemetry, safeCapture };
|
package/dist/shared.js
CHANGED
|
@@ -5,7 +5,22 @@ var WORKSPACE_OPEN_PATH_SURFACE_KIND = "workspace.open.path";
|
|
|
5
5
|
function definePanel(config) {
|
|
6
6
|
return config;
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
// src/shared/telemetry.ts
|
|
10
|
+
var noopTelemetry = {
|
|
11
|
+
capture() {
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function safeCapture(telemetry, event) {
|
|
15
|
+
try {
|
|
16
|
+
void Promise.resolve(telemetry.capture(event)).catch(() => {
|
|
17
|
+
});
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
8
21
|
export {
|
|
9
22
|
WORKSPACE_OPEN_PATH_SURFACE_KIND,
|
|
10
|
-
definePanel
|
|
23
|
+
definePanel,
|
|
24
|
+
noopTelemetry,
|
|
25
|
+
safeCapture
|
|
11
26
|
};
|
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, o as fs, aj as ps } from "./WorkspaceProvider-
|
|
4
|
+
import { h as cs, o as fs, aj as ps } from "./WorkspaceProvider-DihXY2wk.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";
|
|
@@ -97,4 +97,4 @@ interface CommandResult {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
export type { AgentTool as A, CommandResult as C, JSONSchema as J, ToolExecContext as T, UiBridge as U,
|
|
100
|
+
export type { AgentTool as A, CommandResult as C, JSONSchema as J, ToolExecContext as T, UiBridge as U, UiCommand as a, UiState as b, ToolResult as c };
|
package/dist/workspace.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var X = Object.defineProperty;
|
|
2
2
|
var q = (e, r, t) => r in e ? X(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
3
|
var T = (e, r, t) => q(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
-
import { u as z, a as G, b as Q, D as Y } from "./WorkspaceProvider-
|
|
5
|
-
import { A as ze, C as Ke, c as je, d as $e, e as _e, F as He, f as Ue, M as Ae, g as Je, P as Ve, h as Xe, i as qe, j as Ge, k as Qe, R as Ye, S as Ze, l as et, m as tt, T as nt, U as rt, W as at, n as st, o as ot, p as it, q as lt, r as ct, s as dt, t as ut, v as pt, w as mt, x as ht, y as ft, z as gt, B as bt, E as yt, G as vt, H as xt, I as St, J as Ct, K as Pt, L as kt, N as wt, O as Nt, Q as Et, V as Rt, X as Tt, Y as Ot, Z as It, _ as Lt, $ as Mt, a0 as Bt, a1 as Ft, a2 as Wt, a3 as Dt, a4 as zt, a5 as Kt, a6 as jt, a7 as $t, a8 as _t, a9 as Ht, aa as Ut, ab as At, ac as Jt, ad as Vt, ae as Xt, af as qt, ag as Gt, ah as Qt, ai as Yt } from "./WorkspaceProvider-
|
|
4
|
+
import { u as z, a as G, b as Q, D as Y } from "./WorkspaceProvider-DihXY2wk.js";
|
|
5
|
+
import { A as ze, C as Ke, c as je, d as $e, e as _e, F as He, f as Ue, M as Ae, g as Je, P as Ve, h as Xe, i as qe, j as Ge, k as Qe, R as Ye, S as Ze, l as et, m as tt, T as nt, U as rt, W as at, n as st, o as ot, p as it, q as lt, r as ct, s as dt, t as ut, v as pt, w as mt, x as ht, y as ft, z as gt, B as bt, E as yt, G as vt, H as xt, I as St, J as Ct, K as Pt, L as kt, N as wt, O as Nt, Q as Et, V as Rt, X as Tt, Y as Ot, Z as It, _ as Lt, $ as Mt, a0 as Bt, a1 as Ft, a2 as Wt, a3 as Dt, a4 as zt, a5 as Kt, a6 as jt, a7 as $t, a8 as _t, a9 as Ht, aa as Ut, ab as At, ac as Jt, ad as Vt, ae as Xt, af as qt, ag as Gt, ah as Qt, ai as Yt } from "./WorkspaceProvider-DihXY2wk.js";
|
|
6
6
|
import { c as w } from "./utils-B6yFEsav.js";
|
|
7
|
-
import { C as en, T as tn, W as nn, b as rn } from "./WorkspaceLoadingState-
|
|
7
|
+
import { C as en, T as tn, W as nn, b as rn } from "./WorkspaceLoadingState-DuoIpOxl.js";
|
|
8
8
|
import { jsxs as b, jsx as n, Fragment as Z } from "react/jsx-runtime";
|
|
9
9
|
import { Button as P, Sheet as ee, SheetContent as te, SheetHeader as ne, SheetTitle as re, SheetDescription as ae, EmptyState as se, Kbd as O, ErrorState as oe, IconButton as I } from "@hachej/boring-ui-kit";
|
|
10
10
|
import { Toaster as sn, dismissToast as on, toast as ln } from "@hachej/boring-ui-kit";
|
|
11
11
|
import { useSyncExternalStore as K, useState as N, useEffect as S, useRef as k, useCallback as y, useMemo as C, Suspense as ie, Component as le } from "react";
|
|
12
12
|
import { C as dn, c as un } from "./CodeEditor-DQqOn4xz.js";
|
|
13
|
-
import { FileTree as mn } from "./FileTree-
|
|
14
|
-
import { MarkdownEditor as fn } from "./MarkdownEditor-
|
|
13
|
+
import { FileTree as mn } from "./FileTree-nBvBA8m7.js";
|
|
14
|
+
import { MarkdownEditor as fn } from "./MarkdownEditor-CeigBQee.js";
|
|
15
15
|
import { MenuIcon as ce, PanelLeftOpenIcon as de, PanelLeftCloseIcon as ue, PinIcon as pe, CheckIcon as me, CopyIcon as he } from "lucide-react";
|
|
16
16
|
import { d as bn } from "./panel-DnvDNQac.js";
|
|
17
17
|
function Te() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hachej/boring-workspace",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Workspace UI, plugin, and bridge package for composing chat, files, catalogs, editors, and app-specific panes.",
|
|
@@ -120,16 +120,18 @@
|
|
|
120
120
|
"clsx": "^2.1.0",
|
|
121
121
|
"cmdk": "^1.1.1",
|
|
122
122
|
"dockview-react": "^4.13.1",
|
|
123
|
+
"dnd-core": "^14.0.1",
|
|
123
124
|
"fastify": "^5.3.3",
|
|
124
125
|
"jiti": "^2.6.1",
|
|
125
126
|
"lowlight": "^3.3.0",
|
|
126
127
|
"lucide-react": "^1.8.0",
|
|
127
128
|
"react-arborist": "^3.4.0",
|
|
129
|
+
"react-dnd-html5-backend": "^14.1.0",
|
|
128
130
|
"tailwind-merge": "^2.0.0",
|
|
129
131
|
"zod": "^3.23.0",
|
|
130
132
|
"zustand": "^5.0.0",
|
|
131
|
-
"@hachej/boring-agent": "0.1.
|
|
132
|
-
"@hachej/boring-ui-kit": "0.1.
|
|
133
|
+
"@hachej/boring-agent": "0.1.22",
|
|
134
|
+
"@hachej/boring-ui-kit": "0.1.22"
|
|
133
135
|
},
|
|
134
136
|
"devDependencies": {
|
|
135
137
|
"@tailwindcss/postcss": "^4.0.0",
|