@hachej/boring-workspace 0.1.22 → 0.1.24
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-nBvBA8m7.js → FileTree-DjPzfDMq.js} +114 -104
- package/dist/{MarkdownEditor-CeigBQee.js → MarkdownEditor-BbSy0bLV.js} +9 -9
- package/dist/{WorkspaceLoadingState-DuoIpOxl.js → WorkspaceLoadingState-fccm3AQg.js} +238 -218
- package/dist/WorkspaceProvider-BW4wzbpR.js +6264 -0
- package/dist/app-front.d.ts +114 -2
- package/dist/app-front.js +744 -323
- package/dist/app-server.d.ts +3 -3
- package/dist/app-server.js +85 -21
- package/dist/{createInMemoryBridge-CYNW1h_o.d.ts → createInMemoryBridge-DLckqafe.d.ts} +1 -1
- package/dist/events.d.ts +3 -0
- package/dist/{manifest-CyNNdfYz.d.ts → manifest-C2vVgH_e.d.ts} +2 -0
- package/dist/plugin.d.ts +8 -3
- package/dist/plugin.js +3 -2
- package/dist/server.d.ts +11 -4
- package/dist/server.js +37 -18
- package/dist/shared.d.ts +2 -2
- package/dist/{surface-COYagY2m.d.ts → surface-CEEkd81D.d.ts} +1 -0
- package/dist/testing.d.ts +1 -0
- package/dist/testing.js +409 -404
- package/dist/{ui-bridge-CT18yqwN.d.ts → ui-bridge-Bdgl2hR8.d.ts} +2 -0
- package/dist/workspace.css +151 -42
- package/dist/workspace.d.ts +228 -6
- package/dist/workspace.js +188 -179
- package/docs/INTERFACES.md +6 -0
- package/docs/plans/FULL_PAGE_PANEL_ROUTE_SPEC.md +633 -0
- package/package.json +6 -6
- package/dist/WorkspaceProvider-DihXY2wk.js +0 -5971
package/dist/app-front.js
CHANGED
|
@@ -1,350 +1,589 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useSyncExternalStore as
|
|
3
|
-
import { ChatPanel as
|
|
4
|
-
import {
|
|
5
|
-
import { T as
|
|
6
|
-
|
|
1
|
+
import { jsx as c, jsxs as xe, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { useSyncExternalStore as Xt, useEffect as w, useMemo as E, useState as G, useRef as O, useCallback as N, useLayoutEffect as Zt } from "react";
|
|
3
|
+
import { ChatPanel as er, useSessions as tr } from "@hachej/boring-agent/front";
|
|
4
|
+
import { as as rr, at as nr, U as lt, p as sr, au as or, u as mt, ag as ir, av as ar } from "./WorkspaceProvider-BW4wzbpR.js";
|
|
5
|
+
import { T as lr, C as cr, r as ct, w as ur, W as ut } from "./WorkspaceLoadingState-fccm3AQg.js";
|
|
6
|
+
import { ErrorState as dr } from "@hachej/boring-ui-kit";
|
|
7
|
+
function fr() {
|
|
7
8
|
const e = `s${Date.now()}`;
|
|
8
9
|
return {
|
|
9
10
|
sessions: [{ id: e, title: "New session", updatedAt: Date.now() }],
|
|
10
11
|
activeId: e
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
var
|
|
14
|
+
function pr(e, t) {
|
|
15
|
+
var r;
|
|
15
16
|
if (typeof localStorage > "u") return t();
|
|
16
17
|
try {
|
|
17
18
|
const s = localStorage.getItem(e);
|
|
18
19
|
if (s) {
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
return { sessions:
|
|
20
|
+
const n = JSON.parse(s), o = Array.isArray(n.sessions) ? n.sessions : Array.isArray(n.items) ? n.items : null;
|
|
21
|
+
if (o)
|
|
22
|
+
return { sessions: o, activeId: n.activeId ?? ((r = o[0]) == null ? void 0 : r.id) ?? "" };
|
|
22
23
|
}
|
|
23
24
|
} catch {
|
|
24
25
|
}
|
|
25
26
|
return t();
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function mr(e, t) {
|
|
28
29
|
if (!(typeof localStorage > "u"))
|
|
29
30
|
try {
|
|
30
31
|
localStorage.setItem(e, JSON.stringify(t));
|
|
31
32
|
} catch {
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
const t = e.storageKey ?? "workspace:sessions",
|
|
36
|
-
let s =
|
|
37
|
-
const
|
|
38
|
-
s =
|
|
35
|
+
function gr(e = {}) {
|
|
36
|
+
const t = e.storageKey ?? "workspace:sessions", r = e.initial ?? fr;
|
|
37
|
+
let s = pr(t, r);
|
|
38
|
+
const n = /* @__PURE__ */ new Set(), o = (i) => {
|
|
39
|
+
s = i, mr(t, s), n.forEach((l) => l());
|
|
39
40
|
};
|
|
40
41
|
return {
|
|
41
42
|
getState: () => s,
|
|
42
|
-
subscribe(
|
|
43
|
-
return
|
|
44
|
-
|
|
43
|
+
subscribe(i) {
|
|
44
|
+
return n.add(i), () => {
|
|
45
|
+
n.delete(i);
|
|
45
46
|
};
|
|
46
47
|
},
|
|
47
|
-
switchTo(
|
|
48
|
-
|
|
48
|
+
switchTo(i) {
|
|
49
|
+
o({ ...s, activeId: i });
|
|
49
50
|
},
|
|
50
51
|
create() {
|
|
51
|
-
const
|
|
52
|
-
id:
|
|
52
|
+
const i = `s${Date.now()}`, l = {
|
|
53
|
+
id: i,
|
|
53
54
|
title: "New session",
|
|
54
55
|
updatedAt: Date.now()
|
|
55
56
|
};
|
|
56
|
-
|
|
57
|
+
o({ sessions: [l, ...s.sessions], activeId: i });
|
|
57
58
|
},
|
|
58
|
-
remove(
|
|
59
|
-
var
|
|
60
|
-
const
|
|
61
|
-
|
|
59
|
+
remove(i) {
|
|
60
|
+
var g;
|
|
61
|
+
const l = s.sessions.filter((p) => p.id !== i), h = s.activeId === i ? ((g = l[0]) == null ? void 0 : g.id) ?? "" : s.activeId;
|
|
62
|
+
o({ sessions: l, activeId: h });
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
66
|
+
function hr(e) {
|
|
67
|
+
return Xt(e.subscribe, e.getState, e.getState);
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
const gt = ["/api/v1/tree?path=.", "/api/v1/agent/sessions"], yr = /* @__PURE__ */ new Set([
|
|
70
|
+
"WORKSPACE_NOT_READY",
|
|
71
|
+
"AGENT_RUNTIME_NOT_READY",
|
|
72
|
+
"RUNTIME_PROVISIONING_LOCKED"
|
|
73
|
+
]);
|
|
74
|
+
function ht(e, t) {
|
|
75
|
+
return /^https?:\/\//i.test(t) || !e ? t : `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
76
|
+
}
|
|
77
|
+
function le(e, t) {
|
|
78
|
+
const r = { ...t ?? {} };
|
|
79
|
+
for (const s of Object.keys(r))
|
|
80
|
+
s.toLowerCase() === "x-boring-workspace-id" && delete r[s];
|
|
81
|
+
return r["x-boring-workspace-id"] = e, r;
|
|
82
|
+
}
|
|
83
|
+
function yt(e) {
|
|
84
|
+
const t = new URL(e, "http://workspace.local");
|
|
85
|
+
return t.pathname !== "/api/v1/tree" ? null : t.searchParams.get("path") ?? ".";
|
|
86
|
+
}
|
|
87
|
+
function vt(e, t, r, s) {
|
|
88
|
+
const n = yt(r);
|
|
89
|
+
n === null || !s || !Array.isArray(s.entries) || rr(e, t, n, s.entries);
|
|
90
|
+
}
|
|
91
|
+
const vr = /* @__PURE__ */ new Set(["workspace-fs", "sandbox-exec", "ui-bridge"]);
|
|
92
|
+
function br(e) {
|
|
93
|
+
const t = e;
|
|
94
|
+
if (!t || typeof t != "object") return null;
|
|
95
|
+
const r = t.error ?? t, s = r.details ?? t.details ?? r;
|
|
96
|
+
return !s || typeof s != "object" ? null : {
|
|
97
|
+
code: s.code ?? r.code ?? t.code,
|
|
98
|
+
retryable: s.retryable ?? r.retryable,
|
|
99
|
+
requirement: s.requirement ?? r.requirement
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function bt(e) {
|
|
103
|
+
const t = br(e);
|
|
104
|
+
if (typeof (t == null ? void 0 : t.code) != "string" || !yr.has(t.code) || t.retryable !== !0) return null;
|
|
105
|
+
const r = typeof t.requirement == "string" && vr.has(t.requirement) ? t.requirement : void 0;
|
|
106
|
+
return r ? { requirement: r } : {};
|
|
107
|
+
}
|
|
108
|
+
function Pr(e) {
|
|
109
|
+
const t = new URL(e, "http://workspace.local");
|
|
110
|
+
return t.pathname === "/api/v1/agent/sessions" || t.pathname === "/api/v1/ready-status";
|
|
111
|
+
}
|
|
112
|
+
function ce(e) {
|
|
113
|
+
return new URL(e, "http://workspace.local").pathname === "/api/v1/ready-status";
|
|
114
|
+
}
|
|
115
|
+
function Pt(e, t) {
|
|
116
|
+
const r = t ? [...e, "/api/v1/ready-status"] : e.filter((s) => !Pr(s));
|
|
117
|
+
return Array.from(new Set(r));
|
|
118
|
+
}
|
|
119
|
+
function St(e) {
|
|
120
|
+
if (typeof e == "string") return e || null;
|
|
121
|
+
if (!e || typeof e != "object") return null;
|
|
122
|
+
const t = e;
|
|
123
|
+
if (typeof t.message == "string" && t.message) return t.message;
|
|
124
|
+
const r = t.error;
|
|
125
|
+
return typeof (r == null ? void 0 : r.message) == "string" && r.message ? r.message : null;
|
|
126
|
+
}
|
|
127
|
+
function wt(e) {
|
|
128
|
+
if (typeof e != "string" || !e.trim()) return null;
|
|
129
|
+
const t = e.split(/\n\n+/);
|
|
130
|
+
for (let r = t.length - 1; r >= 0; r -= 1) {
|
|
131
|
+
const s = t[r].split(`
|
|
132
|
+
`).filter((n) => n.startsWith("data:")).map((n) => n.slice(5).trim());
|
|
133
|
+
if (s.length !== 0)
|
|
134
|
+
try {
|
|
135
|
+
const n = JSON.parse(s.join(`
|
|
136
|
+
`));
|
|
137
|
+
return {
|
|
138
|
+
state: typeof n.state == "string" ? n.state : void 0,
|
|
139
|
+
message: typeof n.message == "string" ? n.message : void 0
|
|
140
|
+
};
|
|
141
|
+
} catch {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
async function Et(e) {
|
|
148
|
+
const t = await e.text().catch(() => "");
|
|
149
|
+
if (!t) return null;
|
|
150
|
+
try {
|
|
151
|
+
return JSON.parse(t);
|
|
152
|
+
} catch {
|
|
153
|
+
return t;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function Sr({
|
|
157
|
+
apiBaseUrl: e,
|
|
158
|
+
path: t,
|
|
159
|
+
headers: r,
|
|
160
|
+
signal: s,
|
|
161
|
+
workspaceId: n
|
|
162
|
+
}) {
|
|
163
|
+
const o = await fetch(ht(e, t), { headers: r, signal: s }), i = await Et(o);
|
|
164
|
+
if (!o.ok) {
|
|
165
|
+
const l = bt(i);
|
|
166
|
+
if (l) return { status: "preparing", ...l };
|
|
167
|
+
throw new Error(St(i) ?? `${t} failed with ${o.status}`);
|
|
168
|
+
}
|
|
169
|
+
if (ce(t)) {
|
|
170
|
+
const l = wt(i);
|
|
171
|
+
if ((l == null ? void 0 : l.state) === "degraded") throw new Error(l.message ?? "Workspace failed to prepare");
|
|
172
|
+
}
|
|
173
|
+
return i && typeof i == "object" && vt(e, r["x-boring-workspace-id"] ?? n, t, i), { status: "ready" };
|
|
174
|
+
}
|
|
175
|
+
function wr({
|
|
176
|
+
workspaceId: e,
|
|
177
|
+
requestHeaders: t,
|
|
178
|
+
apiBaseUrl: r,
|
|
179
|
+
preloadPaths: s = gt,
|
|
180
|
+
provisionWorkspace: n = !0,
|
|
181
|
+
onStatusChange: o
|
|
182
|
+
}) {
|
|
183
|
+
return w(() => {
|
|
184
|
+
let i = !1;
|
|
185
|
+
const l = new AbortController(), h = le(e, t);
|
|
186
|
+
async function g() {
|
|
187
|
+
o == null || o({ status: "preparing" });
|
|
188
|
+
try {
|
|
189
|
+
const p = Pt(s, n), x = (u) => Sr({
|
|
190
|
+
apiBaseUrl: r,
|
|
191
|
+
path: u,
|
|
192
|
+
headers: h,
|
|
193
|
+
signal: l.signal,
|
|
194
|
+
workspaceId: e
|
|
195
|
+
});
|
|
196
|
+
let P = await Promise.all(p.map(async (u) => ({ path: u, result: await x(u) })));
|
|
197
|
+
if (i || l.signal.aborted) return;
|
|
198
|
+
let _ = P.filter((u) => u.result.status === "preparing");
|
|
199
|
+
if (_.length > 0) {
|
|
200
|
+
let u;
|
|
201
|
+
for (const m of _)
|
|
202
|
+
if (m.result.status === "preparing" && m.result.requirement) {
|
|
203
|
+
u = m.result.requirement;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
if (o == null || o({ status: "preparing", message: "Workspace is still preparing", ...u ? { requirement: u } : {} }), p.some(ce)) {
|
|
207
|
+
if (P = await Promise.all(_.map(async (m) => ({ path: m.path, result: await x(m.path) }))), i || l.signal.aborted) return;
|
|
208
|
+
_ = P.filter((m) => m.result.status === "preparing");
|
|
209
|
+
}
|
|
210
|
+
if (_.length > 0) return;
|
|
211
|
+
}
|
|
212
|
+
o == null || o({ status: "ready" });
|
|
213
|
+
} catch (p) {
|
|
214
|
+
if (i || l.signal.aborted) return;
|
|
215
|
+
o == null || o({
|
|
216
|
+
status: "failed",
|
|
217
|
+
message: p instanceof Error ? p.message : "Workspace failed to prepare"
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return g(), () => {
|
|
222
|
+
i = !0, l.abort();
|
|
223
|
+
};
|
|
224
|
+
}, [r, o, s, n, t, e]), null;
|
|
225
|
+
}
|
|
226
|
+
function Er(e, t) {
|
|
69
227
|
return e.endsWith(":surface") ? e.slice(0, -8) : t;
|
|
70
228
|
}
|
|
71
|
-
function
|
|
72
|
-
const [s,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}, [e, t,
|
|
76
|
-
const
|
|
77
|
-
(
|
|
78
|
-
|
|
229
|
+
function De(e, t, r) {
|
|
230
|
+
const [s, n] = G(() => ct(e, t, r));
|
|
231
|
+
w(() => {
|
|
232
|
+
n(ct(e, t, r));
|
|
233
|
+
}, [e, t, r]);
|
|
234
|
+
const o = N(
|
|
235
|
+
(i) => {
|
|
236
|
+
n(i), ur(e, i, r);
|
|
79
237
|
},
|
|
80
|
-
[
|
|
238
|
+
[r, e]
|
|
81
239
|
);
|
|
82
|
-
return [s,
|
|
240
|
+
return [s, o];
|
|
83
241
|
}
|
|
84
|
-
const
|
|
242
|
+
const dt = {}, ft = { status: "preparing" }, pt = {
|
|
85
243
|
openTabs: [],
|
|
86
244
|
activeTab: null
|
|
87
245
|
};
|
|
88
|
-
function
|
|
246
|
+
function Ar({ status: e }) {
|
|
247
|
+
const t = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", s = r ? t === "workspace-fs" ? "Preparing files…" : t === "sandbox-exec" ? "Waking sandbox…" : t === "ui-bridge" ? "Connecting workspace UI…" : "Preparing workspace…" : "Workspace workbench failed", n = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
|
|
248
|
+
return /* @__PURE__ */ c("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ xe("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
249
|
+
r ? /* @__PURE__ */ c("div", { className: "mx-auto mb-3 h-7 w-7 rounded-full border-2 border-muted-foreground/20 border-t-foreground animate-spin", "aria-hidden": "true" }) : null,
|
|
250
|
+
/* @__PURE__ */ c("div", { className: "text-sm font-semibold text-foreground", children: s }),
|
|
251
|
+
/* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children: n }),
|
|
252
|
+
e.status === "failed" ? /* @__PURE__ */ c("p", { className: "mt-3 text-xs text-muted-foreground", children: "Reload the workspace to retry." }) : null
|
|
253
|
+
] }) });
|
|
254
|
+
}
|
|
255
|
+
function Nr(e) {
|
|
89
256
|
if (!e) return "/api/v1/ui";
|
|
90
|
-
const t = e.replace(/\/$/, ""),
|
|
91
|
-
return t.endsWith(
|
|
257
|
+
const t = e.replace(/\/$/, ""), r = "/api/v1/ui";
|
|
258
|
+
return t.endsWith(r) ? t : `${t}${r}`;
|
|
92
259
|
}
|
|
93
|
-
function
|
|
94
|
-
return `${
|
|
260
|
+
function _r(e) {
|
|
261
|
+
return `${Nr(e)}/state`;
|
|
95
262
|
}
|
|
96
|
-
function
|
|
263
|
+
function Lr(e) {
|
|
97
264
|
var s;
|
|
98
|
-
const t = e.openTabs.find((
|
|
99
|
-
return typeof
|
|
265
|
+
const t = e.openTabs.find((n) => n.id === e.activeTab), r = (s = t == null ? void 0 : t.params) == null ? void 0 : s.path;
|
|
266
|
+
return typeof r == "string" ? r : null;
|
|
100
267
|
}
|
|
101
|
-
function
|
|
268
|
+
function Rr({
|
|
102
269
|
bridgeEndpoint: e,
|
|
103
270
|
requestHeaders: t,
|
|
104
|
-
navOpen:
|
|
271
|
+
navOpen: r,
|
|
105
272
|
surfaceOpen: s,
|
|
106
|
-
snapshot:
|
|
273
|
+
snapshot: n
|
|
107
274
|
}) {
|
|
108
|
-
const
|
|
109
|
-
return
|
|
110
|
-
var
|
|
275
|
+
const o = mt(), i = O(null);
|
|
276
|
+
return w(() => {
|
|
277
|
+
var g;
|
|
111
278
|
if (e === null) return;
|
|
112
|
-
(
|
|
113
|
-
const
|
|
114
|
-
|
|
279
|
+
(g = i.current) == null || g.abort();
|
|
280
|
+
const l = new AbortController();
|
|
281
|
+
i.current = l;
|
|
115
282
|
const h = {
|
|
116
283
|
v: 1,
|
|
117
|
-
drawerOpen:
|
|
284
|
+
drawerOpen: r,
|
|
118
285
|
workbenchOpen: s,
|
|
119
|
-
openTabs:
|
|
120
|
-
activeTab:
|
|
121
|
-
activeFile:
|
|
122
|
-
availablePanels:
|
|
286
|
+
openTabs: n.openTabs,
|
|
287
|
+
activeTab: n.activeTab,
|
|
288
|
+
activeFile: Lr(n),
|
|
289
|
+
availablePanels: o.list().map((p) => p.id)
|
|
123
290
|
};
|
|
124
|
-
return fetch(
|
|
291
|
+
return fetch(_r(e), {
|
|
125
292
|
method: "PUT",
|
|
126
293
|
headers: { ...t, "Content-Type": "application/json" },
|
|
127
294
|
body: JSON.stringify({ state: h, causedBy: "user" }),
|
|
128
|
-
signal:
|
|
295
|
+
signal: l.signal
|
|
129
296
|
}).catch(() => {
|
|
130
297
|
}), () => {
|
|
131
|
-
|
|
298
|
+
l.abort();
|
|
132
299
|
};
|
|
133
|
-
}, [e,
|
|
300
|
+
}, [e, r, o, t, n, s]), null;
|
|
134
301
|
}
|
|
135
|
-
function
|
|
302
|
+
function Br({
|
|
136
303
|
workspaceId: e,
|
|
137
304
|
chatPanel: t,
|
|
138
|
-
useSessions:
|
|
139
|
-
requestHeaders: s
|
|
140
|
-
sessionStorageKey:
|
|
141
|
-
providerStorageKey:
|
|
142
|
-
surfaceStorageKey:
|
|
143
|
-
beforeShell:
|
|
305
|
+
useSessions: r,
|
|
306
|
+
requestHeaders: s,
|
|
307
|
+
sessionStorageKey: n,
|
|
308
|
+
providerStorageKey: o,
|
|
309
|
+
surfaceStorageKey: i,
|
|
310
|
+
beforeShell: l,
|
|
144
311
|
afterShell: h,
|
|
145
|
-
panels:
|
|
146
|
-
commands:
|
|
147
|
-
catalogs:
|
|
148
|
-
plugins:
|
|
149
|
-
excludeDefaults:
|
|
150
|
-
capabilities:
|
|
151
|
-
apiBaseUrl:
|
|
152
|
-
authHeaders:
|
|
153
|
-
apiTimeout:
|
|
154
|
-
defaultTheme:
|
|
155
|
-
onThemeChange:
|
|
156
|
-
persistenceEnabled:
|
|
157
|
-
bridgeEndpoint:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
312
|
+
panels: g,
|
|
313
|
+
commands: p,
|
|
314
|
+
catalogs: x,
|
|
315
|
+
plugins: P,
|
|
316
|
+
excludeDefaults: _,
|
|
317
|
+
capabilities: u,
|
|
318
|
+
apiBaseUrl: m,
|
|
319
|
+
authHeaders: b,
|
|
320
|
+
apiTimeout: y,
|
|
321
|
+
defaultTheme: W,
|
|
322
|
+
onThemeChange: At,
|
|
323
|
+
persistenceEnabled: Te,
|
|
324
|
+
bridgeEndpoint: ue,
|
|
325
|
+
fullPageBasePath: Nt,
|
|
326
|
+
onAuthError: _t,
|
|
327
|
+
sessions: ke,
|
|
328
|
+
activeSessionId: We,
|
|
329
|
+
onSwitchSession: Ue,
|
|
330
|
+
onCreateSession: Fe,
|
|
331
|
+
onDeleteSession: Ge,
|
|
332
|
+
onActiveSessionIdChange: H,
|
|
333
|
+
appTitle: Lt = "Boring",
|
|
334
|
+
defaultSessionTitle: M = "New session",
|
|
335
|
+
navEnabled: Me = !0,
|
|
336
|
+
defaultNavOpen: Rt = !1,
|
|
337
|
+
defaultSurfaceOpen: Dt,
|
|
338
|
+
defaultWorkbenchLeftTab: V,
|
|
339
|
+
surfaceInitialPanels: $e,
|
|
340
|
+
topBarLeft: Ot,
|
|
341
|
+
topBarRight: xt,
|
|
342
|
+
chatParams: D,
|
|
343
|
+
hotReloadEnabled: de,
|
|
344
|
+
frontPluginHotReload: Tt,
|
|
345
|
+
extraPanels: Ce,
|
|
346
|
+
extraCommands: Ie,
|
|
347
|
+
provisionWorkspace: fe,
|
|
348
|
+
bootPreloadPaths: kt,
|
|
349
|
+
onWorkspaceWarmupStatusChange: z,
|
|
350
|
+
onOpenNav: pe,
|
|
351
|
+
onOpenSurface: me,
|
|
352
|
+
surfaceButtonBottomOffset: Wt,
|
|
353
|
+
className: Ut
|
|
179
354
|
}) {
|
|
180
|
-
var
|
|
181
|
-
const
|
|
182
|
-
|
|
355
|
+
var it, at;
|
|
356
|
+
const ge = o ?? `boring-ui-v2:layout:${e}`, S = i ?? `${ge}:surface`, Y = Er(
|
|
357
|
+
S,
|
|
358
|
+
ge
|
|
359
|
+
), Q = Te !== !1, he = n ?? `boring-workspace:sessions:${e}`, $ = E(
|
|
360
|
+
() => le(e, s ?? dt),
|
|
361
|
+
[s, e]
|
|
362
|
+
), Ft = E(
|
|
363
|
+
() => le(e, b ?? dt),
|
|
364
|
+
[b, e]
|
|
365
|
+
), X = E(
|
|
366
|
+
() => gr({ storageKey: he }),
|
|
367
|
+
[he]
|
|
368
|
+
), Ke = hr(X), [qe, Gt] = G(() => ({
|
|
369
|
+
workspaceId: e,
|
|
370
|
+
status: ft
|
|
371
|
+
})), C = qe.workspaceId === e ? qe.status : ft, Mt = t ?? er, $t = r ?? tr, I = !t || !!r, ye = I && fe !== !1, ve = () => {
|
|
372
|
+
}, be = $t({
|
|
373
|
+
requestHeaders: $,
|
|
374
|
+
storageKey: he,
|
|
375
|
+
enabled: ye,
|
|
376
|
+
refreshKey: C.status === "ready" ? "workspace-ready" : void 0
|
|
377
|
+
}), Pe = ye && !be.loading && !be.error, K = ye && !Pe, f = I && Pe ? be : void 0, Se = ke !== void 0 || We !== void 0 || Ue !== void 0 || Fe !== void 0 || Ge !== void 0, Ct = f == null ? void 0 : f.sessions.map((a) => ({
|
|
378
|
+
...a,
|
|
379
|
+
title: a.title ?? "New session"
|
|
380
|
+
})), we = f ? Ct ?? [] : K ? [] : Se ? ke ?? [] : Ke.sessions, Ee = f ? f.activeSessionId ?? null : K ? null : Se ? We ?? null : Ke.activeId, U = (D == null ? void 0 : D.autoSubmitInitialDraft) === !0, Z = U && I && !Se, [L, q] = G(() => Z ? null : void 0), je = O(e), F = O(!1);
|
|
381
|
+
w(() => {
|
|
382
|
+
if (je.current !== e) {
|
|
383
|
+
je.current = e, F.current = !1, q(Z ? null : void 0);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
Z && L === void 0 && (F.current = !1, q(null));
|
|
387
|
+
}, [L, Z, e]), w(() => {
|
|
388
|
+
!f || L !== null || F.current || (F.current = !0, Promise.resolve(f.create({ title: M })).then((a) => {
|
|
389
|
+
if (typeof (a == null ? void 0 : a.id) != "string")
|
|
390
|
+
throw new Error("auto_submit_session_create_failed");
|
|
391
|
+
q(a.id);
|
|
392
|
+
}).catch(() => {
|
|
393
|
+
F.current = !1, q(void 0);
|
|
394
|
+
}));
|
|
395
|
+
}, [L, M, f]);
|
|
396
|
+
const A = L !== void 0 ? L ?? null : Ee, Je = K ? ve : (f == null ? void 0 : f.switch) ?? Ue ?? X.switchTo, It = N((a) => (A && a !== A && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: A } })), Je(a)), [A, Je]), Be = K ? ve : f ? () => f.create() : Fe ?? X.create, Kt = K ? ve : (f == null ? void 0 : f.delete) ?? Ge ?? X.remove, qt = ((it = we.find((a) => a.id === A)) == null ? void 0 : it.title) ?? void 0, [jt, He] = De(
|
|
397
|
+
`${Y}:drawer`,
|
|
398
|
+
Rt,
|
|
183
399
|
Q
|
|
184
|
-
),
|
|
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({
|
|
188
|
-
requestHeaders: s,
|
|
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(
|
|
194
|
-
`${L}:drawer`,
|
|
195
|
-
!0,
|
|
196
|
-
R
|
|
197
|
-
), [w, b] = se(
|
|
400
|
+
), Ve = Me && jt, [T, R] = De(
|
|
198
401
|
// Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
|
|
199
402
|
// layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
|
|
200
403
|
// key corrupts the JSON and drops the persisted workbench layout on reload.
|
|
201
|
-
`${
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
), [
|
|
205
|
-
`${
|
|
404
|
+
`${Y}:workbenchOpen`,
|
|
405
|
+
Dt ?? !1,
|
|
406
|
+
Q
|
|
407
|
+
), [Jt, j] = De(
|
|
408
|
+
`${Y}:workbenchLeftOpen`,
|
|
206
409
|
!0,
|
|
207
|
-
|
|
208
|
-
),
|
|
209
|
-
|
|
210
|
-
const [
|
|
211
|
-
key:
|
|
212
|
-
snapshot:
|
|
213
|
-
})),
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}, [e]),
|
|
217
|
-
if (!(!
|
|
218
|
-
if (
|
|
219
|
-
|
|
410
|
+
Q
|
|
411
|
+
), J = O(!1), k = O(T), ze = O(S), Ae = O(null);
|
|
412
|
+
ze.current = S;
|
|
413
|
+
const [Ye, Qe] = G(() => ({
|
|
414
|
+
key: S,
|
|
415
|
+
snapshot: pt
|
|
416
|
+
})), Bt = Ye.key === S ? Ye.snapshot : pt;
|
|
417
|
+
w(() => {
|
|
418
|
+
J.current = !1;
|
|
419
|
+
}, [e]), w(() => {
|
|
420
|
+
if (!(!f || f.loading) && L === void 0) {
|
|
421
|
+
if (f.sessions.length > 0) {
|
|
422
|
+
J.current = !1;
|
|
220
423
|
return;
|
|
221
424
|
}
|
|
222
|
-
|
|
223
|
-
|
|
425
|
+
J.current || (J.current = !0, Promise.resolve(f.create({ title: M })).catch(() => {
|
|
426
|
+
J.current = !1;
|
|
224
427
|
}));
|
|
225
428
|
}
|
|
226
|
-
}, [
|
|
227
|
-
|
|
228
|
-
}, [
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
key:
|
|
232
|
-
snapshot:
|
|
429
|
+
}, [L, M, f]), w(() => {
|
|
430
|
+
k.current = T;
|
|
431
|
+
}, [T]);
|
|
432
|
+
const Xe = N((a) => {
|
|
433
|
+
Ae.current = { key: S, api: a }, Qe({
|
|
434
|
+
key: S,
|
|
435
|
+
snapshot: a.getSnapshot()
|
|
233
436
|
});
|
|
234
|
-
}, [
|
|
235
|
-
|
|
236
|
-
key:
|
|
237
|
-
snapshot:
|
|
437
|
+
}, [S]), Ze = N((a) => {
|
|
438
|
+
Qe({
|
|
439
|
+
key: S,
|
|
440
|
+
snapshot: a
|
|
238
441
|
});
|
|
239
|
-
}, [
|
|
240
|
-
const
|
|
241
|
-
return (
|
|
242
|
-
}, []),
|
|
243
|
-
|
|
244
|
-
}, [
|
|
245
|
-
|
|
246
|
-
}, [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
442
|
+
}, [S]), ee = N(() => {
|
|
443
|
+
const a = Ae.current;
|
|
444
|
+
return (a == null ? void 0 : a.key) === ze.current ? a.api : null;
|
|
445
|
+
}, []), te = N(() => k.current, []), re = N(() => {
|
|
446
|
+
k.current = !0, R(!0);
|
|
447
|
+
}, [R]), ne = N(() => {
|
|
448
|
+
k.current = !0, R(!0), j(!0);
|
|
449
|
+
}, [R, j]), se = N(() => {
|
|
450
|
+
k.current = !1, Ae.current = null, R(!1);
|
|
451
|
+
}, [R]), oe = E(
|
|
452
|
+
() => (P == null ? void 0 : P.map(nr)) ?? [],
|
|
453
|
+
[P]
|
|
454
|
+
), Ne = E(
|
|
455
|
+
() => oe.some((a) => a.registrations.leftTabs.length > 0),
|
|
456
|
+
[oe]
|
|
457
|
+
), et = E(
|
|
458
|
+
() => oe.flatMap((a) => a.registrations.panels.map((ie) => ie.id)),
|
|
459
|
+
[oe]
|
|
460
|
+
), tt = E(
|
|
461
|
+
() => [...Ce ?? [], ...et],
|
|
462
|
+
[Ce, et]
|
|
463
|
+
), rt = A ?? (L !== void 0 ? "default" : ((at = we[0]) == null ? void 0 : at.id) ?? "default"), [Ht, _e] = G(U), nt = O(e);
|
|
464
|
+
w(() => {
|
|
465
|
+
if (nt.current !== e) {
|
|
466
|
+
nt.current = e, _e(U);
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
U && _e(!0);
|
|
470
|
+
}, [U, e]);
|
|
471
|
+
const st = U && I && !A, ot = !Ht && fe !== !1 && (I ? Pe && !!Ee : !0), Vt = N((a) => {
|
|
472
|
+
Gt({ workspaceId: e, status: a }), z == null || z(a);
|
|
473
|
+
}, [z, e]);
|
|
474
|
+
w(() => {
|
|
475
|
+
var ie;
|
|
476
|
+
const a = (ae) => {
|
|
477
|
+
const Re = ae.detail;
|
|
478
|
+
!Re || typeof Re != "object" || or(Re, {
|
|
479
|
+
surface: ee,
|
|
480
|
+
isWorkbenchOpen: te,
|
|
481
|
+
openWorkbench: re,
|
|
482
|
+
openWorkbenchSources: ne
|
|
267
483
|
});
|
|
268
484
|
};
|
|
269
|
-
return (
|
|
270
|
-
var
|
|
271
|
-
return (
|
|
485
|
+
return (ie = globalThis.addEventListener) == null || ie.call(globalThis, lt, a), () => {
|
|
486
|
+
var ae;
|
|
487
|
+
return (ae = globalThis.removeEventListener) == null ? void 0 : ae.call(globalThis, lt, a);
|
|
272
488
|
};
|
|
273
|
-
}, [
|
|
274
|
-
|
|
275
|
-
}, [
|
|
276
|
-
const
|
|
489
|
+
}, [ee, te, re, ne]), w(() => {
|
|
490
|
+
A && (H == null || H(A));
|
|
491
|
+
}, [A, H]);
|
|
492
|
+
const Le = C.status !== "ready", zt = Le ? /* @__PURE__ */ c(Ar, { status: C }) : void 0, Yt = E(
|
|
277
493
|
() => ({
|
|
278
|
-
...
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
494
|
+
...D,
|
|
495
|
+
...st ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
|
|
496
|
+
sessionId: rt,
|
|
497
|
+
requestHeaders: $,
|
|
498
|
+
bridgeEndpoint: ue,
|
|
499
|
+
getSurface: ee,
|
|
500
|
+
isWorkbenchOpen: te,
|
|
501
|
+
openWorkbench: re,
|
|
502
|
+
openWorkbenchSources: ne,
|
|
503
|
+
closeWorkbench: se,
|
|
504
|
+
extraCommands: Ie,
|
|
505
|
+
workspaceWarmupStatus: C,
|
|
506
|
+
hydrateMessages: ot,
|
|
507
|
+
onAutoSubmitInitialDraftSettled: () => {
|
|
508
|
+
F.current = !1, _e(!1), q(void 0);
|
|
509
|
+
const a = D == null ? void 0 : D.onAutoSubmitInitialDraftSettled;
|
|
510
|
+
typeof a == "function" && a();
|
|
511
|
+
},
|
|
287
512
|
// Forward the explicit prop when set. Omitting the key (when undefined)
|
|
288
513
|
// lets ChatPanel apply its own default (true) and avoids overriding a
|
|
289
514
|
// value passed through chatParams.
|
|
290
|
-
...
|
|
515
|
+
...de !== void 0 ? { hotReloadEnabled: de } : {}
|
|
291
516
|
}),
|
|
292
|
-
[ue,
|
|
293
|
-
),
|
|
294
|
-
storageKey:
|
|
295
|
-
defaultLeftTab:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
517
|
+
[D, st, rt, $, ue, ee, te, re, ne, se, Ie, C, ot, de]
|
|
518
|
+
), Qt = E(() => ({
|
|
519
|
+
storageKey: S,
|
|
520
|
+
defaultLeftTab: V,
|
|
521
|
+
initialPanels: $e,
|
|
522
|
+
extraPanels: tt,
|
|
523
|
+
onReady: Xe,
|
|
524
|
+
onChange: Ze,
|
|
525
|
+
onClose: se
|
|
300
526
|
}), [
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
527
|
+
se,
|
|
528
|
+
V,
|
|
529
|
+
$e,
|
|
530
|
+
Ze,
|
|
531
|
+
Xe,
|
|
532
|
+
S,
|
|
533
|
+
tt,
|
|
534
|
+
R
|
|
308
535
|
]);
|
|
309
|
-
return /* @__PURE__ */
|
|
310
|
-
|
|
536
|
+
return /* @__PURE__ */ c("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ xe(
|
|
537
|
+
sr,
|
|
311
538
|
{
|
|
312
|
-
chatPanel:
|
|
313
|
-
panels:
|
|
314
|
-
commands:
|
|
315
|
-
catalogs:
|
|
316
|
-
plugins:
|
|
317
|
-
excludeDefaults:
|
|
318
|
-
capabilities:
|
|
319
|
-
apiBaseUrl:
|
|
320
|
-
authHeaders:
|
|
321
|
-
apiTimeout:
|
|
322
|
-
defaultTheme:
|
|
323
|
-
onThemeChange:
|
|
539
|
+
chatPanel: Mt,
|
|
540
|
+
panels: g,
|
|
541
|
+
commands: p,
|
|
542
|
+
catalogs: x,
|
|
543
|
+
plugins: P,
|
|
544
|
+
excludeDefaults: _,
|
|
545
|
+
capabilities: u,
|
|
546
|
+
apiBaseUrl: m,
|
|
547
|
+
authHeaders: Ft,
|
|
548
|
+
apiTimeout: y,
|
|
549
|
+
defaultTheme: W,
|
|
550
|
+
onThemeChange: At,
|
|
324
551
|
workspaceId: e,
|
|
325
|
-
storageKey:
|
|
326
|
-
persistenceEnabled:
|
|
552
|
+
storageKey: ge,
|
|
553
|
+
persistenceEnabled: Te,
|
|
327
554
|
bridgeEndpoint: null,
|
|
328
|
-
onAuthError:
|
|
329
|
-
frontPluginHotReload:
|
|
555
|
+
onAuthError: _t,
|
|
556
|
+
frontPluginHotReload: Tt,
|
|
557
|
+
fullPageBasePath: Nt,
|
|
330
558
|
children: [
|
|
331
|
-
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
|
|
559
|
+
l,
|
|
560
|
+
/* @__PURE__ */ c(
|
|
561
|
+
wr,
|
|
562
|
+
{
|
|
563
|
+
workspaceId: e,
|
|
564
|
+
requestHeaders: $,
|
|
565
|
+
apiBaseUrl: m,
|
|
566
|
+
preloadPaths: kt,
|
|
567
|
+
provisionWorkspace: fe,
|
|
568
|
+
onStatusChange: Vt
|
|
569
|
+
}
|
|
570
|
+
),
|
|
571
|
+
/* @__PURE__ */ c(
|
|
572
|
+
Rr,
|
|
334
573
|
{
|
|
335
|
-
bridgeEndpoint:
|
|
336
|
-
requestHeaders:
|
|
337
|
-
navOpen:
|
|
338
|
-
surfaceOpen:
|
|
339
|
-
snapshot:
|
|
574
|
+
bridgeEndpoint: ue,
|
|
575
|
+
requestHeaders: $,
|
|
576
|
+
navOpen: Ve,
|
|
577
|
+
surfaceOpen: T,
|
|
578
|
+
snapshot: Bt
|
|
340
579
|
}
|
|
341
580
|
),
|
|
342
581
|
/* @__PURE__ */ xe("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
|
|
582
|
+
/* @__PURE__ */ c(
|
|
583
|
+
lr,
|
|
345
584
|
{
|
|
346
|
-
appTitle:
|
|
347
|
-
sessionTitle:
|
|
585
|
+
appTitle: Lt,
|
|
586
|
+
sessionTitle: qt ?? M,
|
|
348
587
|
onCommandPalette: () => {
|
|
349
588
|
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
350
589
|
key: "k",
|
|
@@ -354,43 +593,45 @@ function xt({
|
|
|
354
593
|
cancelable: !0
|
|
355
594
|
}));
|
|
356
595
|
},
|
|
357
|
-
onNewChat:
|
|
358
|
-
topBarLeft:
|
|
359
|
-
topBarRight:
|
|
596
|
+
onNewChat: Be,
|
|
597
|
+
topBarLeft: Ot,
|
|
598
|
+
topBarRight: xt
|
|
360
599
|
}
|
|
361
600
|
),
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
|
|
601
|
+
/* @__PURE__ */ c(
|
|
602
|
+
cr,
|
|
364
603
|
{
|
|
365
|
-
className:
|
|
366
|
-
nav:
|
|
604
|
+
className: Ut,
|
|
605
|
+
nav: Ve ? "session-list" : null,
|
|
367
606
|
navParams: {
|
|
368
|
-
sessions:
|
|
369
|
-
activeId:
|
|
370
|
-
onSwitch:
|
|
371
|
-
onCreate:
|
|
372
|
-
onDelete:
|
|
373
|
-
onClose: () =>
|
|
607
|
+
sessions: we,
|
|
608
|
+
activeId: Ee,
|
|
609
|
+
onSwitch: It,
|
|
610
|
+
onCreate: Be,
|
|
611
|
+
onDelete: Kt,
|
|
612
|
+
onClose: () => He(!1)
|
|
374
613
|
},
|
|
375
614
|
center: "chat",
|
|
376
|
-
centerParams:
|
|
377
|
-
surface:
|
|
378
|
-
surfaceParams:
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
615
|
+
centerParams: Yt,
|
|
616
|
+
surface: T ? "artifact-surface" : null,
|
|
617
|
+
surfaceParams: Qt,
|
|
618
|
+
surfaceOverlay: zt,
|
|
619
|
+
sidebar: T && !Le && Ne && Jt ? "workbench-left" : null,
|
|
620
|
+
sidebarParams: T && !Le && Ne ? {
|
|
621
|
+
...V ? { defaultTab: V } : {},
|
|
622
|
+
onClose: () => j(!1),
|
|
623
|
+
onCollapse: () => j(!1)
|
|
624
|
+
} : void 0,
|
|
625
|
+
storageKey: Q ? Y : void 0,
|
|
626
|
+
onOpenNav: Me ? () => {
|
|
627
|
+
He(!0), pe == null || pe();
|
|
384
628
|
} : void 0,
|
|
385
|
-
storageKey: R ? L : void 0,
|
|
386
|
-
onOpenNav: () => {
|
|
387
|
-
ye(!0), G == null || G();
|
|
388
|
-
},
|
|
389
629
|
onOpenSurface: () => {
|
|
390
|
-
|
|
630
|
+
k.current = !0, R(!0), me == null || me();
|
|
391
631
|
},
|
|
392
|
-
|
|
393
|
-
|
|
632
|
+
surfaceButtonBottomOffset: Wt,
|
|
633
|
+
onOpenSidebar: Ne ? () => {
|
|
634
|
+
k.current = !0, R(!0), j(!0);
|
|
394
635
|
} : void 0
|
|
395
636
|
}
|
|
396
637
|
)
|
|
@@ -400,75 +641,255 @@ function xt({
|
|
|
400
641
|
}
|
|
401
642
|
) });
|
|
402
643
|
}
|
|
403
|
-
|
|
404
|
-
function Pt(e, t) {
|
|
405
|
-
return /^https?:\/\//i.test(t) || !e ? t : `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
406
|
-
}
|
|
407
|
-
function kt(e) {
|
|
408
|
-
const t = new URL(e, "http://workspace.local");
|
|
409
|
-
return t.pathname !== "/api/v1/tree" ? null : t.searchParams.get("path") ?? ".";
|
|
410
|
-
}
|
|
411
|
-
function Wt({
|
|
644
|
+
function Hr({
|
|
412
645
|
workspaceId: e,
|
|
413
646
|
requestHeaders: t,
|
|
414
|
-
apiBaseUrl:
|
|
415
|
-
preloadPaths: s =
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
647
|
+
apiBaseUrl: r,
|
|
648
|
+
preloadPaths: s = gt,
|
|
649
|
+
provisionWorkspace: n = !0,
|
|
650
|
+
loadingFallback: o,
|
|
651
|
+
errorFallback: i,
|
|
652
|
+
children: l
|
|
419
653
|
}) {
|
|
420
|
-
const [
|
|
654
|
+
const [h, g] = G({
|
|
421
655
|
status: "loading",
|
|
422
656
|
label: "Waking workspace runtime"
|
|
423
657
|
});
|
|
424
|
-
return
|
|
425
|
-
const
|
|
426
|
-
async function
|
|
427
|
-
const
|
|
428
|
-
headers:
|
|
429
|
-
signal:
|
|
430
|
-
});
|
|
431
|
-
if (!
|
|
432
|
-
|
|
433
|
-
throw new Error(
|
|
658
|
+
return w(() => {
|
|
659
|
+
const p = new AbortController(), x = le(e, t);
|
|
660
|
+
async function P(u) {
|
|
661
|
+
const m = await fetch(ht(r, u), {
|
|
662
|
+
headers: x,
|
|
663
|
+
signal: p.signal
|
|
664
|
+
}), b = await Et(m);
|
|
665
|
+
if (!m.ok) {
|
|
666
|
+
if (bt(b)) return "preparing";
|
|
667
|
+
throw new Error(St(b) ?? `${u} failed with ${m.status}`);
|
|
434
668
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
669
|
+
if (ce(u)) {
|
|
670
|
+
const W = wt(b);
|
|
671
|
+
if ((W == null ? void 0 : W.state) === "degraded") throw new Error(W.message ?? "Workspace failed to prepare");
|
|
672
|
+
}
|
|
673
|
+
return yt(u) !== null && b && typeof b == "object" && vt(r, x["x-boring-workspace-id"] ?? e, u, b), "ready";
|
|
439
674
|
}
|
|
440
|
-
async function
|
|
441
|
-
|
|
675
|
+
async function _() {
|
|
676
|
+
g({ status: "loading", label: "Waking workspace runtime" });
|
|
442
677
|
try {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
if (u.
|
|
446
|
-
|
|
678
|
+
const u = Pt(s, n);
|
|
679
|
+
let m = await Promise.all(u.map(async (y) => ({ path: y, status: await P(y) }))), b = m.filter((y) => y.status === "preparing").map((y) => y.path);
|
|
680
|
+
if (b.length > 0 && u.some(ce) && (m = await Promise.all(b.map(async (y) => ({ path: y, status: await P(y) }))), b = m.filter((y) => y.status === "preparing").map((y) => y.path)), b.length > 0) {
|
|
681
|
+
g({ status: "loading", label: "Workspace is still preparing" });
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
p.signal.aborted || g({ status: "ready" });
|
|
685
|
+
} catch (u) {
|
|
686
|
+
if (p.signal.aborted) return;
|
|
687
|
+
g({
|
|
447
688
|
status: "error",
|
|
448
|
-
message:
|
|
689
|
+
message: u instanceof Error ? u.message : "Unknown workspace boot error"
|
|
449
690
|
});
|
|
450
691
|
}
|
|
451
692
|
}
|
|
452
|
-
return
|
|
453
|
-
}, [
|
|
454
|
-
|
|
693
|
+
return _(), () => p.abort();
|
|
694
|
+
}, [r, s, n, t, e]), h.status === "ready" ? /* @__PURE__ */ c(B, { children: l }) : h.status === "error" ? typeof i == "function" ? /* @__PURE__ */ c(B, { children: i(h.message) }) : i ? /* @__PURE__ */ c(B, { children: i }) : /* @__PURE__ */ c(
|
|
695
|
+
ut,
|
|
455
696
|
{
|
|
456
697
|
title: "Workspace failed to open",
|
|
457
|
-
description:
|
|
698
|
+
description: h.message,
|
|
458
699
|
status: "Retry by reloading the page"
|
|
459
700
|
}
|
|
460
|
-
) : typeof
|
|
461
|
-
|
|
701
|
+
) : typeof o == "function" ? /* @__PURE__ */ c(B, { children: o(h.label) }) : o ? /* @__PURE__ */ c(B, { children: o }) : /* @__PURE__ */ c(
|
|
702
|
+
ut,
|
|
462
703
|
{
|
|
463
704
|
title: "Opening workspace",
|
|
464
705
|
description: "Waking the sandbox and preparing files, sessions, and layout.",
|
|
465
|
-
status:
|
|
706
|
+
status: h.label
|
|
707
|
+
}
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
const Dr = "FULL_PAGE_PANEL_MISSING_COMPONENT", Or = "FULL_PAGE_PANEL_INVALID_PARAMS_JSON", xr = "FULL_PAGE_PANEL_PARAMS_NOT_OBJECT", Tr = "FULL_PAGE_PANEL_UNKNOWN_COMPONENT", kr = "FULL_PAGE_PANEL_NOT_SUPPORTED", Wr = "FULL_PAGE_PANEL_RENDER_FAILED";
|
|
711
|
+
function v() {
|
|
712
|
+
}
|
|
713
|
+
const Ur = { dispose: v }, d = () => Ur;
|
|
714
|
+
function Fr(e) {
|
|
715
|
+
return {
|
|
716
|
+
id: `full-page:${e}`,
|
|
717
|
+
title: e,
|
|
718
|
+
isFocused: !0,
|
|
719
|
+
isActive: !0,
|
|
720
|
+
isVisible: !0,
|
|
721
|
+
width: 0,
|
|
722
|
+
height: 0,
|
|
723
|
+
location: { type: "grid", referenceGroup: void 0 },
|
|
724
|
+
setActive: v,
|
|
725
|
+
setTitle: (t) => {
|
|
726
|
+
document.title = t;
|
|
727
|
+
},
|
|
728
|
+
setSize: v,
|
|
729
|
+
close: () => {
|
|
730
|
+
window.close();
|
|
731
|
+
},
|
|
732
|
+
moveTo: v,
|
|
733
|
+
maximize: v,
|
|
734
|
+
exitMaximized: v,
|
|
735
|
+
isMaximized: () => !1,
|
|
736
|
+
minimize: v,
|
|
737
|
+
onDidActiveChange: d,
|
|
738
|
+
onDidVisibilityChange: d,
|
|
739
|
+
onDidDimensionsChange: d,
|
|
740
|
+
onDidFocusChange: d,
|
|
741
|
+
onDidLocationChange: d,
|
|
742
|
+
onDidParametersChange: d,
|
|
743
|
+
onDidTitleChange: d,
|
|
744
|
+
onDidRenamed: d,
|
|
745
|
+
onWillFocus: d
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
function Gr() {
|
|
749
|
+
return {
|
|
750
|
+
width: window.innerWidth,
|
|
751
|
+
height: window.innerHeight,
|
|
752
|
+
minimumHeight: 0,
|
|
753
|
+
maximumHeight: 1 / 0,
|
|
754
|
+
minimumWidth: 0,
|
|
755
|
+
maximumWidth: 1 / 0,
|
|
756
|
+
activePanel: void 0,
|
|
757
|
+
panels: [],
|
|
758
|
+
groups: [],
|
|
759
|
+
activeGroup: void 0,
|
|
760
|
+
addPanel: v,
|
|
761
|
+
addGroup: v,
|
|
762
|
+
removePanel: v,
|
|
763
|
+
removeGroup: v,
|
|
764
|
+
getPanel: () => {
|
|
765
|
+
},
|
|
766
|
+
getGroup: () => {
|
|
767
|
+
},
|
|
768
|
+
moveGroupOrPanel: v,
|
|
769
|
+
fromJSON: v,
|
|
770
|
+
toJSON: () => ({}),
|
|
771
|
+
clear: v,
|
|
772
|
+
focus: v,
|
|
773
|
+
layout: v,
|
|
774
|
+
onDidLayoutChange: d,
|
|
775
|
+
onDidLayoutFromJSON: d,
|
|
776
|
+
onDidAddPanel: d,
|
|
777
|
+
onDidRemovePanel: d,
|
|
778
|
+
onDidActivePanelChange: d,
|
|
779
|
+
onDidAddGroup: d,
|
|
780
|
+
onDidRemoveGroup: d,
|
|
781
|
+
onDidActiveGroupChange: d,
|
|
782
|
+
onUnhandledDragOverEvent: d,
|
|
783
|
+
onDidDrop: d,
|
|
784
|
+
onWillDrop: d,
|
|
785
|
+
onWillDragGroup: d,
|
|
786
|
+
onWillDragPanel: d,
|
|
787
|
+
onDidActivePanelChange_: d
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
function Oe({ code: e, title: t, description: r }) {
|
|
791
|
+
return /* @__PURE__ */ c(
|
|
792
|
+
"div",
|
|
793
|
+
{
|
|
794
|
+
className: "flex min-h-screen items-center justify-center bg-background p-6 text-foreground",
|
|
795
|
+
"data-testid": "full-page-error-state",
|
|
796
|
+
"data-full-page-error-code": e,
|
|
797
|
+
children: /* @__PURE__ */ c(dr, { className: "w-full max-w-lg", title: t, description: r })
|
|
466
798
|
}
|
|
467
799
|
);
|
|
468
800
|
}
|
|
801
|
+
function Vr({ componentId: e, params: t = {} }) {
|
|
802
|
+
const r = mt(), { errors: s } = ir(), n = r.get(e), o = r.getComponents()[e];
|
|
803
|
+
Zt(() => {
|
|
804
|
+
document.title = (n == null ? void 0 : n.title) ?? e;
|
|
805
|
+
}, [e, n == null ? void 0 : n.title]);
|
|
806
|
+
const i = E(() => ({
|
|
807
|
+
params: t,
|
|
808
|
+
api: Fr(e),
|
|
809
|
+
containerApi: Gr(),
|
|
810
|
+
className: "h-full"
|
|
811
|
+
}), [e, t]), l = E(() => {
|
|
812
|
+
if (!n) return null;
|
|
813
|
+
const h = n.pluginId ?? n.id;
|
|
814
|
+
for (let g = s.length - 1; g >= 0; g -= 1) {
|
|
815
|
+
const p = s[g];
|
|
816
|
+
if (p.contributionKind === "panel" && p.contributionId === e && p.pluginId === h)
|
|
817
|
+
return p;
|
|
818
|
+
}
|
|
819
|
+
return null;
|
|
820
|
+
}, [e, s, n]);
|
|
821
|
+
return n ? !n.supportsFullPage || !o ? /* @__PURE__ */ c(
|
|
822
|
+
Oe,
|
|
823
|
+
{
|
|
824
|
+
code: kr,
|
|
825
|
+
title: "Panel does not support full-page mode",
|
|
826
|
+
description: `Panel "${e}" can render in the workspace, but it has not opted into the dedicated full-page pane route.`
|
|
827
|
+
}
|
|
828
|
+
) : l ? /* @__PURE__ */ c(
|
|
829
|
+
Oe,
|
|
830
|
+
{
|
|
831
|
+
code: Wr,
|
|
832
|
+
title: "Panel failed to render",
|
|
833
|
+
description: `Panel "${e}" crashed while rendering in full-page mode: ${l.error.message}`
|
|
834
|
+
}
|
|
835
|
+
) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(ar, { mode: "full-page", children: /* @__PURE__ */ c(o, { ...i }) }) }) : /* @__PURE__ */ c(
|
|
836
|
+
Oe,
|
|
837
|
+
{
|
|
838
|
+
code: Tr,
|
|
839
|
+
title: "Unknown panel",
|
|
840
|
+
description: `No full-page panel component is registered as "${e}".`
|
|
841
|
+
}
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
function zr(e) {
|
|
845
|
+
var o;
|
|
846
|
+
const t = new URLSearchParams(e), r = ((o = t.get("component")) == null ? void 0 : o.trim()) ?? "";
|
|
847
|
+
if (!r)
|
|
848
|
+
return {
|
|
849
|
+
componentId: null,
|
|
850
|
+
params: {},
|
|
851
|
+
error: {
|
|
852
|
+
code: Dr,
|
|
853
|
+
message: "Missing full-page panel component id."
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
const s = t.get("params");
|
|
857
|
+
if (!s)
|
|
858
|
+
return { componentId: r, params: {} };
|
|
859
|
+
let n;
|
|
860
|
+
try {
|
|
861
|
+
n = JSON.parse(s);
|
|
862
|
+
} catch {
|
|
863
|
+
return {
|
|
864
|
+
componentId: null,
|
|
865
|
+
params: {},
|
|
866
|
+
error: {
|
|
867
|
+
code: Or,
|
|
868
|
+
message: "Invalid full-page panel params JSON."
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
return n === null || Array.isArray(n) || typeof n != "object" ? {
|
|
873
|
+
componentId: null,
|
|
874
|
+
params: {},
|
|
875
|
+
error: {
|
|
876
|
+
code: xr,
|
|
877
|
+
message: "Full-page panel params must be a JSON object."
|
|
878
|
+
}
|
|
879
|
+
} : { componentId: r, params: n };
|
|
880
|
+
}
|
|
469
881
|
export {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
882
|
+
Or as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
|
|
883
|
+
Dr as FULL_PAGE_PANEL_MISSING_COMPONENT,
|
|
884
|
+
kr as FULL_PAGE_PANEL_NOT_SUPPORTED,
|
|
885
|
+
xr as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
|
|
886
|
+
Wr as FULL_PAGE_PANEL_RENDER_FAILED,
|
|
887
|
+
Tr as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
|
|
888
|
+
Br as WorkspaceAgentFront,
|
|
889
|
+
wr as WorkspaceBackgroundBoot,
|
|
890
|
+
Hr as WorkspaceBootGate,
|
|
891
|
+
Vr as WorkspaceFullPagePanel,
|
|
892
|
+
gr as createLocalStorageSessions,
|
|
893
|
+
zr as parseFullPagePanelLocation,
|
|
894
|
+
hr as useLocalStorageSessions
|
|
474
895
|
};
|