@hachej/boring-workspace 0.1.16 → 0.1.18
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/README.md +36 -34
- package/dist/{FileTree-Dl-qUAB0.js → FileTree-DHVB9rpk.js} +15 -15
- package/dist/MarkdownEditor-L1KDH0bM.js +534 -0
- package/dist/{WorkspaceLoadingState-CSZfENWe.js → WorkspaceLoadingState-DYDxUYnx.js} +114 -110
- package/dist/WorkspaceProvider-CDPaAO5u.js +5971 -0
- package/dist/app-front.d.ts +94 -107
- package/dist/app-front.js +243 -233
- package/dist/app-server.d.ts +130 -15
- package/dist/app-server.js +1569 -304
- package/dist/{bootstrapServer-BreQ9QBc.d.ts → createInMemoryBridge-BDxDzihm.d.ts} +11 -26
- package/dist/manifest-CyNNdfYz.d.ts +58 -0
- package/dist/plugin.d.ts +199 -0
- package/dist/plugin.js +300 -0
- package/dist/server.d.ts +239 -4
- package/dist/server.js +901 -78
- package/dist/shared.d.ts +4 -112
- package/dist/surface-COYagY2m.d.ts +111 -0
- package/dist/testing.d.ts +19 -1
- package/dist/testing.js +2 -2
- package/dist/{agent-tool-DEtfQPVB.d.ts → ui-bridge-Gfh1MMgl.d.ts} +30 -30
- package/dist/workspace.css +36 -0
- package/dist/workspace.d.ts +165 -120
- package/dist/workspace.js +330 -377
- package/docs/INTERFACES.md +9 -9
- package/docs/PLUGIN_STRUCTURE.md +39 -145
- package/docs/PLUGIN_SYSTEM.md +355 -0
- package/docs/README.md +6 -1
- package/docs/plans/README.md +1 -0
- package/docs/plans/archive/HOT_RELOADABLE_AGENT_PLUGINS_PLAN.md +218 -0
- package/docs/plans/archive/RELOAD_PLUGGABILITY_PLAN.md +174 -0
- package/docs/plans/archive/UNIFIED_PLUGIN_SYSTEM_PLAN.md +769 -0
- package/package.json +11 -5
- package/dist/CommandPalette-NOEOVkN2.js +0 -5714
- package/dist/MarkdownEditor-yc6mFsnI.js +0 -533
- package/docs/bridge.md +0 -135
- package/docs/panels.md +0 -102
- package/docs/plugins.md +0 -158
- /package/docs/plans/{MACRO_PLUGIN_GENERIC_HELPERS_AUDIT.md → archive/MACRO_PLUGIN_GENERIC_HELPERS_AUDIT.md} +0 -0
package/dist/app-front.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
2
|
-
import { useSyncExternalStore as
|
|
3
|
-
import { ChatPanel as
|
|
4
|
-
import { U as
|
|
5
|
-
import { T as
|
|
6
|
-
function
|
|
1
|
+
import { jsx as d, jsxs as xe, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useSyncExternalStore as qe, useMemo as P, useCallback as v, useRef as K, useState as re, useEffect as y } from "react";
|
|
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-CDPaAO5u.js";
|
|
5
|
+
import { T as ct, C as it, r as Le, w as lt, W as Re } from "./WorkspaceLoadingState-DYDxUYnx.js";
|
|
6
|
+
function ut() {
|
|
7
7
|
const e = `s${Date.now()}`;
|
|
8
8
|
return {
|
|
9
9
|
sessions: [{ id: e, title: "New session", updatedAt: Date.now() }],
|
|
10
10
|
activeId: e
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
var
|
|
13
|
+
function ft(e, t) {
|
|
14
|
+
var n;
|
|
15
15
|
if (typeof localStorage > "u") return t();
|
|
16
16
|
try {
|
|
17
17
|
const s = localStorage.getItem(e);
|
|
18
18
|
if (s) {
|
|
19
|
-
const
|
|
19
|
+
const r = JSON.parse(s), c = Array.isArray(r.sessions) ? r.sessions : Array.isArray(r.items) ? r.items : null;
|
|
20
20
|
if (c)
|
|
21
|
-
return { sessions: c, activeId:
|
|
21
|
+
return { sessions: c, activeId: r.activeId ?? ((n = c[0]) == null ? void 0 : n.id) ?? "" };
|
|
22
22
|
}
|
|
23
23
|
} catch {
|
|
24
24
|
}
|
|
25
25
|
return t();
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function dt(e, t) {
|
|
28
28
|
if (!(typeof localStorage > "u"))
|
|
29
29
|
try {
|
|
30
30
|
localStorage.setItem(e, JSON.stringify(t));
|
|
31
31
|
} catch {
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const t = e.storageKey ?? "workspace:sessions",
|
|
36
|
-
let s =
|
|
37
|
-
const
|
|
38
|
-
s = a,
|
|
34
|
+
function pt(e = {}) {
|
|
35
|
+
const t = e.storageKey ?? "workspace:sessions", n = e.initial ?? ut;
|
|
36
|
+
let s = ft(t, n);
|
|
37
|
+
const r = /* @__PURE__ */ new Set(), c = (a) => {
|
|
38
|
+
s = a, dt(t, s), r.forEach((i) => i());
|
|
39
39
|
};
|
|
40
40
|
return {
|
|
41
41
|
getState: () => s,
|
|
42
42
|
subscribe(a) {
|
|
43
|
-
return
|
|
44
|
-
|
|
43
|
+
return r.add(a), () => {
|
|
44
|
+
r.delete(a);
|
|
45
45
|
};
|
|
46
46
|
},
|
|
47
47
|
switchTo(a) {
|
|
@@ -62,54 +62,51 @@ function it(e = {}) {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
function ut(e) {
|
|
69
|
-
return e.type === "panel";
|
|
65
|
+
function ht(e) {
|
|
66
|
+
return qe(e.subscribe, e.getState, e.getState);
|
|
70
67
|
}
|
|
71
|
-
function
|
|
68
|
+
function mt(e, t) {
|
|
72
69
|
return e.endsWith(":surface") ? e.slice(0, -8) : t;
|
|
73
70
|
}
|
|
74
|
-
function
|
|
75
|
-
const [s,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, [e, t,
|
|
79
|
-
const c =
|
|
71
|
+
function se(e, t, n) {
|
|
72
|
+
const [s, r] = re(() => Le(e, t, n));
|
|
73
|
+
y(() => {
|
|
74
|
+
r(Le(e, t, n));
|
|
75
|
+
}, [e, t, n]);
|
|
76
|
+
const c = v(
|
|
80
77
|
(a) => {
|
|
81
|
-
|
|
78
|
+
r(a), lt(e, a, n);
|
|
82
79
|
},
|
|
83
|
-
[
|
|
80
|
+
[n, e]
|
|
84
81
|
);
|
|
85
82
|
return [s, c];
|
|
86
83
|
}
|
|
87
|
-
const
|
|
84
|
+
const gt = {}, De = {
|
|
88
85
|
openTabs: [],
|
|
89
86
|
activeTab: null
|
|
90
87
|
};
|
|
91
|
-
function
|
|
88
|
+
function vt(e) {
|
|
92
89
|
if (!e) return "/api/v1/ui";
|
|
93
|
-
const t = e.replace(/\/$/, ""),
|
|
94
|
-
return t.endsWith(
|
|
90
|
+
const t = e.replace(/\/$/, ""), n = "/api/v1/ui";
|
|
91
|
+
return t.endsWith(n) ? t : `${t}${n}`;
|
|
95
92
|
}
|
|
96
|
-
function
|
|
97
|
-
return `${
|
|
93
|
+
function yt(e) {
|
|
94
|
+
return `${vt(e)}/state`;
|
|
98
95
|
}
|
|
99
|
-
function
|
|
96
|
+
function St(e) {
|
|
100
97
|
var s;
|
|
101
|
-
const t = e.openTabs.find((
|
|
102
|
-
return typeof
|
|
98
|
+
const t = e.openTabs.find((r) => r.id === e.activeTab), n = (s = t == null ? void 0 : t.params) == null ? void 0 : s.path;
|
|
99
|
+
return typeof n == "string" ? n : null;
|
|
103
100
|
}
|
|
104
|
-
function
|
|
101
|
+
function wt({
|
|
105
102
|
bridgeEndpoint: e,
|
|
106
103
|
requestHeaders: t,
|
|
107
|
-
navOpen:
|
|
104
|
+
navOpen: n,
|
|
108
105
|
surfaceOpen: s,
|
|
109
|
-
snapshot:
|
|
106
|
+
snapshot: r
|
|
110
107
|
}) {
|
|
111
|
-
const c =
|
|
112
|
-
return
|
|
108
|
+
const c = ot(), a = K(null);
|
|
109
|
+
return y(() => {
|
|
113
110
|
var u;
|
|
114
111
|
if (e === null) return;
|
|
115
112
|
(u = a.current) == null || u.abort();
|
|
@@ -117,14 +114,14 @@ function gt({
|
|
|
117
114
|
a.current = i;
|
|
118
115
|
const h = {
|
|
119
116
|
v: 1,
|
|
120
|
-
drawerOpen:
|
|
117
|
+
drawerOpen: n,
|
|
121
118
|
workbenchOpen: s,
|
|
122
|
-
openTabs:
|
|
123
|
-
activeTab:
|
|
124
|
-
activeFile:
|
|
119
|
+
openTabs: r.openTabs,
|
|
120
|
+
activeTab: r.activeTab,
|
|
121
|
+
activeFile: St(r),
|
|
125
122
|
availablePanels: c.list().map((m) => m.id)
|
|
126
123
|
};
|
|
127
|
-
return fetch(
|
|
124
|
+
return fetch(yt(e), {
|
|
128
125
|
method: "PUT",
|
|
129
126
|
headers: { ...t, "Content-Type": "application/json" },
|
|
130
127
|
body: JSON.stringify({ state: h, causedBy: "user" }),
|
|
@@ -133,210 +130,221 @@ function gt({
|
|
|
133
130
|
}), () => {
|
|
134
131
|
i.abort();
|
|
135
132
|
};
|
|
136
|
-
}, [e,
|
|
133
|
+
}, [e, n, c, t, r, s]), null;
|
|
137
134
|
}
|
|
138
|
-
function
|
|
135
|
+
function xt({
|
|
139
136
|
workspaceId: e,
|
|
140
137
|
chatPanel: t,
|
|
141
|
-
useSessions:
|
|
142
|
-
requestHeaders: s =
|
|
143
|
-
sessionStorageKey:
|
|
138
|
+
useSessions: n,
|
|
139
|
+
requestHeaders: s = gt,
|
|
140
|
+
sessionStorageKey: r,
|
|
144
141
|
providerStorageKey: c,
|
|
145
142
|
surfaceStorageKey: a,
|
|
146
143
|
beforeShell: i,
|
|
147
144
|
afterShell: h,
|
|
148
145
|
panels: u,
|
|
149
146
|
commands: m,
|
|
150
|
-
catalogs:
|
|
147
|
+
catalogs: M,
|
|
151
148
|
plugins: S,
|
|
152
149
|
excludeDefaults: g,
|
|
153
150
|
capabilities: k,
|
|
154
|
-
apiBaseUrl:
|
|
151
|
+
apiBaseUrl: O,
|
|
155
152
|
authHeaders: E,
|
|
156
|
-
apiTimeout:
|
|
157
|
-
defaultTheme:
|
|
158
|
-
onThemeChange:
|
|
159
|
-
persistenceEnabled:
|
|
160
|
-
bridgeEndpoint:
|
|
161
|
-
onAuthError:
|
|
162
|
-
sessions:
|
|
163
|
-
activeSessionId:
|
|
164
|
-
onSwitchSession:
|
|
165
|
-
onCreateSession:
|
|
166
|
-
onDeleteSession:
|
|
167
|
-
onActiveSessionIdChange:
|
|
168
|
-
appTitle:
|
|
169
|
-
defaultSessionTitle:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
153
|
+
apiTimeout: J,
|
|
154
|
+
defaultTheme: Ne,
|
|
155
|
+
onThemeChange: Ie,
|
|
156
|
+
persistenceEnabled: ne,
|
|
157
|
+
bridgeEndpoint: V,
|
|
158
|
+
onAuthError: Ae,
|
|
159
|
+
sessions: oe,
|
|
160
|
+
activeSessionId: ae,
|
|
161
|
+
onSwitchSession: ce,
|
|
162
|
+
onCreateSession: ie,
|
|
163
|
+
onDeleteSession: le,
|
|
164
|
+
onActiveSessionIdChange: x,
|
|
165
|
+
appTitle: Ue = "Boring",
|
|
166
|
+
defaultSessionTitle: F = "New session",
|
|
167
|
+
defaultSurfaceOpen: Be,
|
|
168
|
+
defaultWorkbenchLeftTab: W,
|
|
169
|
+
topBarLeft: _e,
|
|
170
|
+
topBarRight: je,
|
|
171
|
+
chatParams: ue,
|
|
172
|
+
hotReloadEnabled: z,
|
|
173
|
+
frontPluginHotReload: Me,
|
|
174
|
+
extraPanels: fe,
|
|
175
|
+
extraCommands: de,
|
|
176
|
+
onOpenNav: G,
|
|
177
|
+
onOpenSurface: Y,
|
|
178
|
+
className: Je
|
|
178
179
|
}) {
|
|
179
|
-
var
|
|
180
|
-
const
|
|
180
|
+
var Ke, Oe;
|
|
181
|
+
const Q = c ?? `boring-ui-v2:layout:${e}`, f = a ?? `${Q}:surface`, L = mt(
|
|
181
182
|
f,
|
|
182
|
-
|
|
183
|
-
), R =
|
|
184
|
-
() =>
|
|
185
|
-
[
|
|
186
|
-
),
|
|
183
|
+
Q
|
|
184
|
+
), R = ne !== !1, X = r ?? `boring-workspace:sessions:${e}`, D = P(
|
|
185
|
+
() => pt({ storageKey: X }),
|
|
186
|
+
[X]
|
|
187
|
+
), pe = ht(D), Ve = t ?? et, Z = n ?? (t ? void 0 : tt), l = Z == null ? void 0 : Z({
|
|
187
188
|
requestHeaders: s,
|
|
188
|
-
storageKey:
|
|
189
|
-
}),
|
|
190
|
-
...
|
|
191
|
-
title:
|
|
192
|
-
})),
|
|
189
|
+
storageKey: X
|
|
190
|
+
}), he = oe !== void 0 || ae !== void 0 || ce !== void 0 || ie !== void 0 || le !== void 0, Fe = l == null ? void 0 : l.sessions.map((o) => ({
|
|
191
|
+
...o,
|
|
192
|
+
title: o.title ?? "New session"
|
|
193
|
+
})), H = l ? Fe ?? [] : he ? oe ?? [] : pe.sessions, p = l ? l.activeSessionId ?? null : he ? ae ?? null : pe.activeId, me = (l == null ? void 0 : l.switch) ?? ce ?? D.switchTo, ze = v((o) => (p && o !== p && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: p } })), me(o)), [me, p]), ge = l ? () => l.create() : ie ?? D.create, Ge = (l == null ? void 0 : l.delete) ?? le ?? D.remove, Ye = ((Ke = H.find((o) => o.id === p)) == null ? void 0 : Ke.title) ?? void 0, [ve, ye] = se(
|
|
193
194
|
`${L}:drawer`,
|
|
194
195
|
!0,
|
|
195
196
|
R
|
|
196
|
-
), [
|
|
197
|
+
), [w, b] = se(
|
|
197
198
|
// Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
|
|
198
199
|
// layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
|
|
199
200
|
// key corrupts the JSON and drops the persisted workbench layout on reload.
|
|
200
201
|
`${L}:workbenchOpen`,
|
|
201
|
-
!1,
|
|
202
|
+
Be ?? !1,
|
|
202
203
|
R
|
|
203
|
-
), [
|
|
204
|
+
), [Qe, q] = se(
|
|
204
205
|
`${L}:workbenchLeftOpen`,
|
|
205
206
|
!0,
|
|
206
207
|
R
|
|
207
|
-
),
|
|
208
|
-
|
|
209
|
-
const [
|
|
208
|
+
), C = K(!1), T = K(w), Se = K(f), we = K(null);
|
|
209
|
+
Se.current = f;
|
|
210
|
+
const [be, Pe] = re(() => ({
|
|
210
211
|
key: f,
|
|
211
|
-
snapshot:
|
|
212
|
-
})),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}, [e]),
|
|
212
|
+
snapshot: De
|
|
213
|
+
})), Xe = be.key === f ? be.snapshot : De;
|
|
214
|
+
y(() => {
|
|
215
|
+
C.current = !1;
|
|
216
|
+
}, [e]), y(() => {
|
|
216
217
|
if (!(!l || l.loading)) {
|
|
217
218
|
if (l.sessions.length > 0) {
|
|
218
|
-
|
|
219
|
+
C.current = !1;
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
C.current || (C.current = !0, Promise.resolve(l.create({ title: F })).catch(() => {
|
|
223
|
+
C.current = !1;
|
|
223
224
|
}));
|
|
224
225
|
}
|
|
225
|
-
}, [
|
|
226
|
-
T.current =
|
|
227
|
-
}, [
|
|
228
|
-
const
|
|
229
|
-
|
|
226
|
+
}, [F, l]), y(() => {
|
|
227
|
+
T.current = w;
|
|
228
|
+
}, [w]);
|
|
229
|
+
const ke = v((o) => {
|
|
230
|
+
we.current = { key: f, api: o }, Pe({
|
|
230
231
|
key: f,
|
|
231
|
-
snapshot:
|
|
232
|
+
snapshot: o.getSnapshot()
|
|
232
233
|
});
|
|
233
|
-
}, [f]),
|
|
234
|
-
|
|
234
|
+
}, [f]), Te = v((o) => {
|
|
235
|
+
Pe({
|
|
235
236
|
key: f,
|
|
236
|
-
snapshot:
|
|
237
|
+
snapshot: o
|
|
237
238
|
});
|
|
238
|
-
}, [f]),
|
|
239
|
-
const
|
|
240
|
-
return (
|
|
241
|
-
}, []),
|
|
242
|
-
T.current = !0,
|
|
243
|
-
}, [
|
|
244
|
-
T.current = !1,
|
|
245
|
-
}, [
|
|
246
|
-
() => (S == null ? void 0 : S.
|
|
239
|
+
}, [f]), N = v(() => {
|
|
240
|
+
const o = we.current;
|
|
241
|
+
return (o == null ? void 0 : o.key) === Se.current ? o.api : null;
|
|
242
|
+
}, []), I = v(() => T.current, []), A = v(() => {
|
|
243
|
+
T.current = !0, b(!0);
|
|
244
|
+
}, [b]), U = v(() => {
|
|
245
|
+
T.current = !1, b(!1);
|
|
246
|
+
}, [b]), B = P(
|
|
247
|
+
() => (S == null ? void 0 : S.map(st)) ?? [],
|
|
247
248
|
[S]
|
|
248
|
-
),
|
|
249
|
-
() =>
|
|
250
|
-
[
|
|
251
|
-
),
|
|
252
|
-
() =>
|
|
253
|
-
[
|
|
254
|
-
),
|
|
255
|
-
() => [...
|
|
256
|
-
[
|
|
257
|
-
),
|
|
258
|
-
|
|
259
|
-
var
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
!
|
|
263
|
-
surface:
|
|
264
|
-
isWorkbenchOpen:
|
|
249
|
+
), ee = P(
|
|
250
|
+
() => B.some((o) => o.registrations.leftTabs.length > 0),
|
|
251
|
+
[B]
|
|
252
|
+
), Ee = P(
|
|
253
|
+
() => B.flatMap((o) => o.registrations.panels.map((_) => _.id)),
|
|
254
|
+
[B]
|
|
255
|
+
), Ce = P(
|
|
256
|
+
() => [...fe ?? [], ...Ee],
|
|
257
|
+
[fe, Ee]
|
|
258
|
+
), $e = p ?? ((Oe = H[0]) == null ? void 0 : Oe.id) ?? "default";
|
|
259
|
+
y(() => {
|
|
260
|
+
var _;
|
|
261
|
+
const o = (j) => {
|
|
262
|
+
const te = j.detail;
|
|
263
|
+
!te || typeof te != "object" || nt(te, {
|
|
264
|
+
surface: N,
|
|
265
|
+
isWorkbenchOpen: I,
|
|
265
266
|
openWorkbench: A
|
|
266
267
|
});
|
|
267
268
|
};
|
|
268
|
-
return (
|
|
269
|
-
var
|
|
270
|
-
return (
|
|
269
|
+
return (_ = globalThis.addEventListener) == null || _.call(globalThis, We, o), () => {
|
|
270
|
+
var j;
|
|
271
|
+
return (j = globalThis.removeEventListener) == null ? void 0 : j.call(globalThis, We, o);
|
|
271
272
|
};
|
|
272
|
-
}, [
|
|
273
|
-
p && (
|
|
274
|
-
}, [p,
|
|
275
|
-
const
|
|
273
|
+
}, [N, I, A]), y(() => {
|
|
274
|
+
p && (x == null || x(p));
|
|
275
|
+
}, [p, x]);
|
|
276
|
+
const Ze = P(
|
|
276
277
|
() => ({
|
|
277
|
-
...
|
|
278
|
-
sessionId:
|
|
278
|
+
...ue,
|
|
279
|
+
sessionId: $e,
|
|
279
280
|
requestHeaders: s,
|
|
280
|
-
bridgeEndpoint:
|
|
281
|
-
getSurface:
|
|
282
|
-
isWorkbenchOpen:
|
|
281
|
+
bridgeEndpoint: V,
|
|
282
|
+
getSurface: N,
|
|
283
|
+
isWorkbenchOpen: I,
|
|
283
284
|
openWorkbench: A,
|
|
284
|
-
closeWorkbench:
|
|
285
|
-
extraCommands:
|
|
285
|
+
closeWorkbench: U,
|
|
286
|
+
extraCommands: de,
|
|
287
|
+
// Forward the explicit prop when set. Omitting the key (when undefined)
|
|
288
|
+
// lets ChatPanel apply its own default (true) and avoids overriding a
|
|
289
|
+
// value passed through chatParams.
|
|
290
|
+
...z !== void 0 ? { hotReloadEnabled: z } : {}
|
|
286
291
|
}),
|
|
287
|
-
[
|
|
288
|
-
),
|
|
292
|
+
[ue, $e, s, V, N, I, A, U, de, z]
|
|
293
|
+
), He = P(() => ({
|
|
289
294
|
storageKey: f,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
295
|
+
defaultLeftTab: W,
|
|
296
|
+
extraPanels: Ce,
|
|
297
|
+
onReady: ke,
|
|
298
|
+
onChange: Te,
|
|
299
|
+
onClose: U
|
|
294
300
|
}), [
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
301
|
+
U,
|
|
302
|
+
W,
|
|
303
|
+
Te,
|
|
304
|
+
ke,
|
|
298
305
|
f,
|
|
299
|
-
|
|
300
|
-
|
|
306
|
+
Ce,
|
|
307
|
+
b
|
|
301
308
|
]);
|
|
302
|
-
return /* @__PURE__ */ d("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */
|
|
303
|
-
|
|
309
|
+
return /* @__PURE__ */ d("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ xe(
|
|
310
|
+
rt,
|
|
304
311
|
{
|
|
305
|
-
chatPanel:
|
|
312
|
+
chatPanel: Ve,
|
|
306
313
|
panels: u,
|
|
307
314
|
commands: m,
|
|
308
|
-
catalogs:
|
|
315
|
+
catalogs: M,
|
|
309
316
|
plugins: S,
|
|
310
317
|
excludeDefaults: g,
|
|
311
318
|
capabilities: k,
|
|
312
|
-
apiBaseUrl:
|
|
319
|
+
apiBaseUrl: O,
|
|
313
320
|
authHeaders: E,
|
|
314
|
-
apiTimeout:
|
|
315
|
-
defaultTheme:
|
|
316
|
-
onThemeChange:
|
|
321
|
+
apiTimeout: J,
|
|
322
|
+
defaultTheme: Ne,
|
|
323
|
+
onThemeChange: Ie,
|
|
317
324
|
workspaceId: e,
|
|
318
|
-
storageKey:
|
|
319
|
-
persistenceEnabled:
|
|
325
|
+
storageKey: Q,
|
|
326
|
+
persistenceEnabled: ne,
|
|
320
327
|
bridgeEndpoint: null,
|
|
321
|
-
onAuthError:
|
|
328
|
+
onAuthError: Ae,
|
|
329
|
+
frontPluginHotReload: Me,
|
|
322
330
|
children: [
|
|
323
331
|
i,
|
|
324
332
|
/* @__PURE__ */ d(
|
|
325
|
-
|
|
333
|
+
wt,
|
|
326
334
|
{
|
|
327
|
-
bridgeEndpoint:
|
|
335
|
+
bridgeEndpoint: V,
|
|
328
336
|
requestHeaders: s,
|
|
329
|
-
navOpen:
|
|
330
|
-
surfaceOpen:
|
|
331
|
-
snapshot:
|
|
337
|
+
navOpen: ve,
|
|
338
|
+
surfaceOpen: w,
|
|
339
|
+
snapshot: Xe
|
|
332
340
|
}
|
|
333
341
|
),
|
|
334
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ xe("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
335
343
|
/* @__PURE__ */ d(
|
|
336
|
-
|
|
344
|
+
ct,
|
|
337
345
|
{
|
|
338
|
-
appTitle:
|
|
339
|
-
sessionTitle:
|
|
346
|
+
appTitle: Ue,
|
|
347
|
+
sessionTitle: Ye ?? F,
|
|
340
348
|
onCommandPalette: () => {
|
|
341
349
|
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
342
350
|
key: "k",
|
|
@@ -346,41 +354,43 @@ function Wt({
|
|
|
346
354
|
cancelable: !0
|
|
347
355
|
}));
|
|
348
356
|
},
|
|
349
|
-
onNewChat:
|
|
350
|
-
topBarLeft:
|
|
351
|
-
topBarRight:
|
|
357
|
+
onNewChat: ge,
|
|
358
|
+
topBarLeft: _e,
|
|
359
|
+
topBarRight: je
|
|
352
360
|
}
|
|
353
361
|
),
|
|
354
362
|
/* @__PURE__ */ d(
|
|
355
|
-
|
|
363
|
+
it,
|
|
356
364
|
{
|
|
357
|
-
className:
|
|
358
|
-
nav:
|
|
365
|
+
className: Je,
|
|
366
|
+
nav: ve ? "session-list" : null,
|
|
359
367
|
navParams: {
|
|
360
|
-
sessions:
|
|
368
|
+
sessions: H,
|
|
361
369
|
activeId: p,
|
|
362
|
-
onSwitch:
|
|
363
|
-
onCreate:
|
|
364
|
-
onDelete:
|
|
365
|
-
onClose: () =>
|
|
370
|
+
onSwitch: ze,
|
|
371
|
+
onCreate: ge,
|
|
372
|
+
onDelete: Ge,
|
|
373
|
+
onClose: () => ye(!1)
|
|
366
374
|
},
|
|
367
375
|
center: "chat",
|
|
368
|
-
centerParams:
|
|
369
|
-
surface:
|
|
370
|
-
surfaceParams:
|
|
371
|
-
sidebar:
|
|
372
|
-
sidebarParams: {
|
|
373
|
-
|
|
374
|
-
|
|
376
|
+
centerParams: Ze,
|
|
377
|
+
surface: w ? "artifact-surface" : null,
|
|
378
|
+
surfaceParams: He,
|
|
379
|
+
sidebar: w && ee && Qe ? "workbench-left" : null,
|
|
380
|
+
sidebarParams: w && ee ? {
|
|
381
|
+
...W ? { defaultTab: W } : {},
|
|
382
|
+
onClose: () => q(!1),
|
|
383
|
+
onCollapse: () => q(!1)
|
|
384
|
+
} : void 0,
|
|
375
385
|
storageKey: R ? L : void 0,
|
|
376
386
|
onOpenNav: () => {
|
|
377
|
-
|
|
387
|
+
ye(!0), G == null || G();
|
|
378
388
|
},
|
|
379
389
|
onOpenSurface: () => {
|
|
380
|
-
T.current = !0,
|
|
390
|
+
T.current = !0, b(!0), Y == null || Y();
|
|
381
391
|
},
|
|
382
|
-
onOpenSidebar:
|
|
383
|
-
T.current = !0,
|
|
392
|
+
onOpenSidebar: ee ? () => {
|
|
393
|
+
T.current = !0, b(!0), q(!0);
|
|
384
394
|
} : void 0
|
|
385
395
|
}
|
|
386
396
|
)
|
|
@@ -390,47 +400,47 @@ function Wt({
|
|
|
390
400
|
}
|
|
391
401
|
) });
|
|
392
402
|
}
|
|
393
|
-
const
|
|
394
|
-
function
|
|
403
|
+
const bt = ["/api/v1/tree?path=.", "/api/v1/agent/sessions"];
|
|
404
|
+
function Pt(e, t) {
|
|
395
405
|
return /^https?:\/\//i.test(t) || !e ? t : `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
396
406
|
}
|
|
397
|
-
function
|
|
407
|
+
function kt(e) {
|
|
398
408
|
const t = new URL(e, "http://workspace.local");
|
|
399
409
|
return t.pathname !== "/api/v1/tree" ? null : t.searchParams.get("path") ?? ".";
|
|
400
410
|
}
|
|
401
|
-
function
|
|
411
|
+
function Wt({
|
|
402
412
|
workspaceId: e,
|
|
403
413
|
requestHeaders: t,
|
|
404
|
-
apiBaseUrl:
|
|
405
|
-
preloadPaths: s =
|
|
406
|
-
loadingFallback:
|
|
414
|
+
apiBaseUrl: n,
|
|
415
|
+
preloadPaths: s = bt,
|
|
416
|
+
loadingFallback: r,
|
|
407
417
|
errorFallback: c,
|
|
408
418
|
children: a
|
|
409
419
|
}) {
|
|
410
|
-
const [i, h] =
|
|
420
|
+
const [i, h] = re({
|
|
411
421
|
status: "loading",
|
|
412
422
|
label: "Waking workspace runtime"
|
|
413
423
|
});
|
|
414
|
-
return
|
|
424
|
+
return y(() => {
|
|
415
425
|
const u = new AbortController(), m = t ?? { "x-boring-workspace-id": e };
|
|
416
|
-
async function
|
|
417
|
-
const k = await fetch(
|
|
426
|
+
async function M(g) {
|
|
427
|
+
const k = await fetch(Pt(n, g), {
|
|
418
428
|
headers: m,
|
|
419
429
|
signal: u.signal
|
|
420
430
|
});
|
|
421
431
|
if (!k.ok) {
|
|
422
|
-
const
|
|
423
|
-
throw new Error(
|
|
432
|
+
const J = await k.text().catch(() => "");
|
|
433
|
+
throw new Error(J || `${g} failed with ${k.status}`);
|
|
424
434
|
}
|
|
425
|
-
const
|
|
426
|
-
if (
|
|
435
|
+
const O = kt(g);
|
|
436
|
+
if (O === null) return;
|
|
427
437
|
const E = await k.clone().json().catch(() => null);
|
|
428
|
-
!E || !Array.isArray(E.entries) ||
|
|
438
|
+
!E || !Array.isArray(E.entries) || at(n, m["x-boring-workspace-id"] ?? e, O, E.entries);
|
|
429
439
|
}
|
|
430
440
|
async function S() {
|
|
431
441
|
h({ status: "loading", label: "Waking workspace runtime" });
|
|
432
442
|
try {
|
|
433
|
-
await Promise.all(s.map(
|
|
443
|
+
await Promise.all(s.map(M)), u.signal.aborted || h({ status: "ready" });
|
|
434
444
|
} catch (g) {
|
|
435
445
|
if (u.signal.aborted) return;
|
|
436
446
|
h({
|
|
@@ -440,15 +450,15 @@ function $t({
|
|
|
440
450
|
}
|
|
441
451
|
}
|
|
442
452
|
return S(), () => u.abort();
|
|
443
|
-
}, [
|
|
444
|
-
|
|
453
|
+
}, [n, s, t, e]), i.status === "ready" ? /* @__PURE__ */ d($, { children: a }) : i.status === "error" ? typeof c == "function" ? /* @__PURE__ */ d($, { children: c(i.message) }) : c ? /* @__PURE__ */ d($, { children: c }) : /* @__PURE__ */ d(
|
|
454
|
+
Re,
|
|
445
455
|
{
|
|
446
456
|
title: "Workspace failed to open",
|
|
447
457
|
description: i.message,
|
|
448
458
|
status: "Retry by reloading the page"
|
|
449
459
|
}
|
|
450
|
-
) : typeof
|
|
451
|
-
|
|
460
|
+
) : typeof r == "function" ? /* @__PURE__ */ d($, { children: r(i.label) }) : r ? /* @__PURE__ */ d($, { children: r }) : /* @__PURE__ */ d(
|
|
461
|
+
Re,
|
|
452
462
|
{
|
|
453
463
|
title: "Opening workspace",
|
|
454
464
|
description: "Waking the sandbox and preparing files, sessions, and layout.",
|
|
@@ -457,8 +467,8 @@ function $t({
|
|
|
457
467
|
);
|
|
458
468
|
}
|
|
459
469
|
export {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
470
|
+
xt as WorkspaceAgentFront,
|
|
471
|
+
Wt as WorkspaceBootGate,
|
|
472
|
+
pt as createLocalStorageSessions,
|
|
473
|
+
ht as useLocalStorageSessions
|
|
464
474
|
};
|