@hachej/boring-workspace 0.1.32 → 0.1.33
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-BltQETt9.js → FileTree-SmsE0Raq.js} +1 -1
- package/dist/{MarkdownEditor-heUJdK4j.js → MarkdownEditor-zbp8ezds.js} +1 -1
- package/dist/{WorkspaceLoadingState-InXsc_8G.js → WorkspaceLoadingState-BlvZXmFg.js} +1 -1
- package/dist/{WorkspaceProvider-Cg-J1wxr.js → WorkspaceProvider-CuIZx1ua.js} +342 -326
- package/dist/app-front.d.ts +3 -0
- package/dist/app-front.js +237 -234
- package/dist/testing.js +1 -1
- package/dist/workspace.css +5 -0
- package/dist/workspace.d.ts +4 -1
- package/dist/workspace.js +5 -5
- package/package.json +3 -3
package/dist/app-front.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as c, jsxs as te, Fragment as K } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as v, useSyncExternalStore as Lr, useMemo as T, useState as _, useRef as
|
|
2
|
+
import { useEffect as v, useSyncExternalStore as Lr, useMemo as T, useState as _, useRef as k, useCallback as L, useLayoutEffect as Tr } from "react";
|
|
3
3
|
import { ChatPanel as xr, useSessions as Or } from "@hachej/boring-agent/front";
|
|
4
|
-
import { aj as Wr, as as
|
|
5
|
-
import { T as $r, C as Ir, r as Ot, w as qr, W as Wt } from "./WorkspaceLoadingState-
|
|
4
|
+
import { aj as Wr, as as Mr, at as kr, U as xt, q as Fr, au as Ur, u as Gt, ag as Gr, av as Cr } from "./WorkspaceProvider-CuIZx1ua.js";
|
|
5
|
+
import { T as $r, C as Ir, r as Ot, w as qr, W as Wt } from "./WorkspaceLoadingState-BlvZXmFg.js";
|
|
6
6
|
import { Sun as jr, Moon as Br } from "lucide-react";
|
|
7
7
|
import { IconButton as Kr, ErrorState as Jr } from "@hachej/boring-ui-kit";
|
|
8
8
|
function Hr() {
|
|
@@ -35,9 +35,9 @@ function zr(e, t) {
|
|
|
35
35
|
try {
|
|
36
36
|
const n = localStorage.getItem(e);
|
|
37
37
|
if (n) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return { sessions:
|
|
38
|
+
const i = JSON.parse(n), s = Array.isArray(i.sessions) ? i.sessions : Array.isArray(i.items) ? i.items : null;
|
|
39
|
+
if (s)
|
|
40
|
+
return { sessions: s, activeId: i.activeId ?? ((r = s[0]) == null ? void 0 : r.id) ?? "" };
|
|
41
41
|
}
|
|
42
42
|
} catch {
|
|
43
43
|
}
|
|
@@ -53,18 +53,18 @@ function Yr(e, t) {
|
|
|
53
53
|
function Qr(e = {}) {
|
|
54
54
|
const t = e.storageKey ?? "workspace:sessions", r = e.initial ?? Vr;
|
|
55
55
|
let n = zr(t, r);
|
|
56
|
-
const
|
|
57
|
-
n = a, Yr(t, n),
|
|
56
|
+
const i = /* @__PURE__ */ new Set(), s = (a) => {
|
|
57
|
+
n = a, Yr(t, n), i.forEach((l) => l());
|
|
58
58
|
};
|
|
59
59
|
return {
|
|
60
60
|
getState: () => n,
|
|
61
61
|
subscribe(a) {
|
|
62
|
-
return
|
|
63
|
-
|
|
62
|
+
return i.add(a), () => {
|
|
63
|
+
i.delete(a);
|
|
64
64
|
};
|
|
65
65
|
},
|
|
66
66
|
switchTo(a) {
|
|
67
|
-
|
|
67
|
+
s({ ...n, activeId: a });
|
|
68
68
|
},
|
|
69
69
|
create() {
|
|
70
70
|
const a = `s${Date.now()}`, l = {
|
|
@@ -72,12 +72,12 @@ function Qr(e = {}) {
|
|
|
72
72
|
title: "New session",
|
|
73
73
|
updatedAt: Date.now()
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
s({ sessions: [l, ...n.sessions], activeId: a });
|
|
76
76
|
},
|
|
77
77
|
remove(a) {
|
|
78
78
|
var h;
|
|
79
|
-
const l = n.sessions.filter((
|
|
80
|
-
|
|
79
|
+
const l = n.sessions.filter((f) => f.id !== a), p = n.activeId === a ? ((h = l[0]) == null ? void 0 : h.id) ?? "" : n.activeId;
|
|
80
|
+
s({ sessions: l, activeId: p });
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
}
|
|
@@ -92,7 +92,7 @@ const Ct = ["/api/v1/tree?path=.", "/api/v1/agent/sessions"], Zr = /* @__PURE__
|
|
|
92
92
|
function $t(e, t) {
|
|
93
93
|
return /^https?:\/\//i.test(t) || !e ? t : `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function we(e, t) {
|
|
96
96
|
const r = { ...t ?? {} };
|
|
97
97
|
for (const n of Object.keys(r))
|
|
98
98
|
n.toLowerCase() === "x-boring-workspace-id" && delete r[n];
|
|
@@ -103,8 +103,8 @@ function It(e) {
|
|
|
103
103
|
return t.pathname !== "/api/v1/tree" ? null : t.searchParams.get("path") ?? ".";
|
|
104
104
|
}
|
|
105
105
|
function qt(e, t, r, n) {
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const i = It(r);
|
|
107
|
+
i === null || !n || !Array.isArray(n.entries) || Mr(e, t, i, n.entries);
|
|
108
108
|
}
|
|
109
109
|
const en = /* @__PURE__ */ new Set(["workspace-fs", "sandbox-exec", "ui-bridge"]);
|
|
110
110
|
function tn(e) {
|
|
@@ -142,30 +142,30 @@ function Je(e) {
|
|
|
142
142
|
const r = t.error;
|
|
143
143
|
return typeof (r == null ? void 0 : r.message) == "string" && r.message ? r.message : null;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
var r, n,
|
|
145
|
+
function Mt(e) {
|
|
146
|
+
var r, n, i, s, a, l, p, h, f, A;
|
|
147
147
|
if (!e || typeof e != "object") return null;
|
|
148
148
|
const t = e;
|
|
149
149
|
return {
|
|
150
150
|
state: typeof t.state == "string" ? t.state : void 0,
|
|
151
151
|
message: typeof t.message == "string" ? t.message : void 0,
|
|
152
152
|
chatState: typeof ((n = (r = t.capabilities) == null ? void 0 : r.chat) == null ? void 0 : n.state) == "string" ? t.capabilities.chat.state : void 0,
|
|
153
|
-
workspaceState: typeof ((
|
|
153
|
+
workspaceState: typeof ((s = (i = t.capabilities) == null ? void 0 : i.workspace) == null ? void 0 : s.state) == "string" ? t.capabilities.workspace.state : void 0,
|
|
154
154
|
runtimeDependenciesState: typeof ((l = (a = t.capabilities) == null ? void 0 : a.runtimeDependencies) == null ? void 0 : l.state) == "string" ? t.capabilities.runtimeDependencies.state : void 0,
|
|
155
155
|
runtimeDependenciesMessage: typeof ((h = (p = t.capabilities) == null ? void 0 : p.runtimeDependencies) == null ? void 0 : h.message) == "string" ? t.capabilities.runtimeDependencies.message : void 0,
|
|
156
|
-
runtimeDependenciesRequirement: typeof ((A = (
|
|
156
|
+
runtimeDependenciesRequirement: typeof ((A = (f = t.capabilities) == null ? void 0 : f.runtimeDependencies) == null ? void 0 : A.requirement) == "string" ? t.capabilities.runtimeDependencies.requirement : void 0
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
if (e && typeof e == "object") return
|
|
159
|
+
function Pe(e) {
|
|
160
|
+
if (e && typeof e == "object") return Mt(e);
|
|
161
161
|
if (typeof e != "string" || !e.trim()) return null;
|
|
162
162
|
const t = e.split(/\n\n+/);
|
|
163
163
|
for (let r = t.length - 1; r >= 0; r -= 1) {
|
|
164
164
|
const n = t[r].split(`
|
|
165
|
-
`).filter((
|
|
165
|
+
`).filter((i) => i.startsWith("data:")).map((i) => i.slice(5).trim());
|
|
166
166
|
if (n.length !== 0)
|
|
167
167
|
try {
|
|
168
|
-
return
|
|
168
|
+
return Mt(JSON.parse(n.join(`
|
|
169
169
|
`)));
|
|
170
170
|
} catch {
|
|
171
171
|
return null;
|
|
@@ -176,7 +176,7 @@ function we(e) {
|
|
|
176
176
|
function nn(e) {
|
|
177
177
|
return e ? e.chatState || e.workspaceState ? e.chatState === "ready" && e.workspaceState === "ready" : e.state === "ready" : !0;
|
|
178
178
|
}
|
|
179
|
-
async function
|
|
179
|
+
async function Ee(e) {
|
|
180
180
|
const t = await e.text().catch(() => "");
|
|
181
181
|
if (!t) return null;
|
|
182
182
|
try {
|
|
@@ -186,38 +186,38 @@ async function Ae(e) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
const sn = 500;
|
|
189
|
-
function
|
|
189
|
+
function kt(e) {
|
|
190
190
|
return new Promise((t, r) => {
|
|
191
191
|
let n;
|
|
192
|
-
const
|
|
193
|
-
n && globalThis.clearTimeout(n), e.removeEventListener("abort",
|
|
194
|
-
},
|
|
195
|
-
|
|
192
|
+
const i = () => {
|
|
193
|
+
n && globalThis.clearTimeout(n), e.removeEventListener("abort", s);
|
|
194
|
+
}, s = () => {
|
|
195
|
+
i(), r(new DOMException("Warmup aborted", "AbortError"));
|
|
196
196
|
};
|
|
197
197
|
if (e.aborted) {
|
|
198
|
-
|
|
198
|
+
s();
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
201
|
n = globalThis.setTimeout(() => {
|
|
202
|
-
|
|
203
|
-
}, sn), e.addEventListener("abort",
|
|
202
|
+
i(), t();
|
|
203
|
+
}, sn), e.addEventListener("abort", s, { once: !0 });
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
async function on(e) {
|
|
207
207
|
const t = e.body;
|
|
208
|
-
if (!t) return
|
|
208
|
+
if (!t) return Pe(await Ee(e));
|
|
209
209
|
const r = t.getReader(), n = new TextDecoder();
|
|
210
|
-
let
|
|
210
|
+
let i = "";
|
|
211
211
|
try {
|
|
212
212
|
for (; ; ) {
|
|
213
|
-
const { done:
|
|
213
|
+
const { done: s, value: a } = await r.read();
|
|
214
214
|
if (a) {
|
|
215
|
-
|
|
216
|
-
const l =
|
|
215
|
+
i += n.decode(a, { stream: !s });
|
|
216
|
+
const l = Pe(i);
|
|
217
217
|
if (l) return l;
|
|
218
218
|
}
|
|
219
|
-
if (
|
|
220
|
-
return
|
|
219
|
+
if (s)
|
|
220
|
+
return i += n.decode(), Pe(i);
|
|
221
221
|
}
|
|
222
222
|
} finally {
|
|
223
223
|
await r.cancel().catch(() => {
|
|
@@ -234,9 +234,9 @@ function an(e) {
|
|
|
234
234
|
}
|
|
235
235
|
async function ln(e) {
|
|
236
236
|
if (!e.ok) {
|
|
237
|
-
const
|
|
238
|
-
if (Ke(
|
|
239
|
-
throw new Error(Je(
|
|
237
|
+
const i = await Ee(e);
|
|
238
|
+
if (Ke(i)) return { status: "preparing" };
|
|
239
|
+
throw new Error(Je(i) ?? `/api/v1/ready-status failed with ${e.status}`);
|
|
240
240
|
}
|
|
241
241
|
const t = await on(e), r = an(t), n = nn(t);
|
|
242
242
|
if ((t == null ? void 0 : t.state) === "degraded" || (t == null ? void 0 : t.state) === "failed") {
|
|
@@ -251,62 +251,62 @@ async function cn({
|
|
|
251
251
|
path: t,
|
|
252
252
|
headers: r,
|
|
253
253
|
signal: n,
|
|
254
|
-
workspaceId:
|
|
254
|
+
workspaceId: i
|
|
255
255
|
}) {
|
|
256
|
-
const
|
|
257
|
-
if (jt(t)) return ln(
|
|
258
|
-
const a = await
|
|
259
|
-
if (!
|
|
256
|
+
const s = await fetch($t(e, t), { headers: r, signal: n });
|
|
257
|
+
if (jt(t)) return ln(s);
|
|
258
|
+
const a = await Ee(s);
|
|
259
|
+
if (!s.ok) {
|
|
260
260
|
const l = Ke(a);
|
|
261
261
|
if (l) return { status: "preparing", ...l };
|
|
262
|
-
throw new Error(Je(a) ?? `${t} failed with ${
|
|
262
|
+
throw new Error(Je(a) ?? `${t} failed with ${s.status}`);
|
|
263
263
|
}
|
|
264
|
-
return a && typeof a == "object" && qt(e, r["x-boring-workspace-id"] ??
|
|
264
|
+
return a && typeof a == "object" && qt(e, r["x-boring-workspace-id"] ?? i, t, a), { status: "ready" };
|
|
265
265
|
}
|
|
266
266
|
function un({
|
|
267
267
|
workspaceId: e,
|
|
268
268
|
requestHeaders: t,
|
|
269
269
|
apiBaseUrl: r,
|
|
270
270
|
preloadPaths: n = Ct,
|
|
271
|
-
provisionWorkspace:
|
|
272
|
-
onStatusChange:
|
|
271
|
+
provisionWorkspace: i = !0,
|
|
272
|
+
onStatusChange: s
|
|
273
273
|
}) {
|
|
274
274
|
return v(() => {
|
|
275
275
|
let a = !1;
|
|
276
|
-
const l = new AbortController(), p =
|
|
276
|
+
const l = new AbortController(), p = we(e, t);
|
|
277
277
|
async function h() {
|
|
278
|
-
var
|
|
279
|
-
|
|
278
|
+
var f, A;
|
|
279
|
+
s == null || s({ status: "preparing" });
|
|
280
280
|
try {
|
|
281
|
-
const w = Bt(n,
|
|
281
|
+
const w = Bt(n, i), C = (d) => cn({
|
|
282
282
|
apiBaseUrl: r,
|
|
283
|
-
path:
|
|
283
|
+
path: d,
|
|
284
284
|
headers: p,
|
|
285
285
|
signal: l.signal,
|
|
286
286
|
workspaceId: e
|
|
287
287
|
});
|
|
288
|
-
let b = await Promise.all(w.map(async (
|
|
288
|
+
let b = await Promise.all(w.map(async (d) => ({ path: d, result: await C(d) })));
|
|
289
289
|
if (a || l.signal.aborted) return;
|
|
290
|
-
let g = (
|
|
290
|
+
let g = (f = b.find((d) => d.result.runtimeDependencies)) == null ? void 0 : f.result.runtimeDependencies, y = b.filter((d) => d.result.status === "preparing");
|
|
291
291
|
for (; y.length > 0; ) {
|
|
292
|
-
let
|
|
292
|
+
let d;
|
|
293
293
|
for (const S of y)
|
|
294
294
|
if (S.result.status === "preparing" && S.result.requirement) {
|
|
295
|
-
|
|
295
|
+
d = S.result.requirement;
|
|
296
296
|
break;
|
|
297
297
|
}
|
|
298
|
-
if (
|
|
298
|
+
if (s == null || s({ status: "preparing", message: "Workspace is still preparing", ...d ? { requirement: d } : {} }), await kt(l.signal), a || l.signal.aborted || (b = await Promise.all(y.map(async (S) => ({ path: S.path, result: await C(S.path) }))), a || l.signal.aborted)) return;
|
|
299
299
|
g = ((A = b.find((S) => S.result.runtimeDependencies)) == null ? void 0 : A.result.runtimeDependencies) ?? g, y = b.filter((S) => S.result.status === "preparing");
|
|
300
300
|
}
|
|
301
|
-
for (
|
|
302
|
-
if (await
|
|
303
|
-
const
|
|
301
|
+
for (s == null || s({ status: "ready", ...g ? { runtimeDependencies: g } : {} }); (g == null ? void 0 : g.state) === "preparing"; ) {
|
|
302
|
+
if (await kt(l.signal), a || l.signal.aborted) return;
|
|
303
|
+
const d = await C("/api/v1/ready-status");
|
|
304
304
|
if (a || l.signal.aborted) return;
|
|
305
|
-
g =
|
|
305
|
+
g = d.runtimeDependencies, g && (s == null || s({ status: "ready", runtimeDependencies: g }));
|
|
306
306
|
}
|
|
307
307
|
} catch (w) {
|
|
308
308
|
if (a || l.signal.aborted) return;
|
|
309
|
-
|
|
309
|
+
s == null || s({
|
|
310
310
|
status: "failed",
|
|
311
311
|
message: w instanceof Error ? w.message : "Workspace failed to prepare"
|
|
312
312
|
});
|
|
@@ -315,7 +315,7 @@ function un({
|
|
|
315
315
|
return h(), () => {
|
|
316
316
|
a = !0, l.abort();
|
|
317
317
|
};
|
|
318
|
-
}, [r,
|
|
318
|
+
}, [r, s, n, i, t, e]), null;
|
|
319
319
|
}
|
|
320
320
|
function dn(e, t) {
|
|
321
321
|
return !!(e && e.title === t && e.turnCount === 0);
|
|
@@ -324,28 +324,28 @@ function fn(e, t) {
|
|
|
324
324
|
return e.endsWith(":surface") ? e.slice(0, -8) : t;
|
|
325
325
|
}
|
|
326
326
|
function qe(e, t, r) {
|
|
327
|
-
const [n,
|
|
327
|
+
const [n, i] = _(() => Ot(e, t, r));
|
|
328
328
|
v(() => {
|
|
329
|
-
|
|
329
|
+
i(Ot(e, t, r));
|
|
330
330
|
}, [e, t, r]);
|
|
331
|
-
const
|
|
331
|
+
const s = L(
|
|
332
332
|
(a) => {
|
|
333
|
-
|
|
333
|
+
i(a), qr(e, a, r);
|
|
334
334
|
},
|
|
335
335
|
[r, e]
|
|
336
336
|
);
|
|
337
|
-
return [n,
|
|
337
|
+
return [n, s];
|
|
338
338
|
}
|
|
339
|
-
const je = {},
|
|
339
|
+
const je = {}, Ft = { status: "preparing" }, Ut = {
|
|
340
340
|
openTabs: [],
|
|
341
341
|
activeTab: null
|
|
342
342
|
};
|
|
343
343
|
function mn({ status: e }) {
|
|
344
|
-
const t = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", n = r ? t === "workspace-fs" ? "Preparing files…" : t === "sandbox-exec" ? "Waking sandbox…" : t === "ui-bridge" ? "Connecting workspace UI…" : "Preparing workspace…" : "Workspace workbench failed",
|
|
344
|
+
const t = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", n = r ? t === "workspace-fs" ? "Preparing files…" : t === "sandbox-exec" ? "Waking sandbox…" : t === "ui-bridge" ? "Connecting workspace UI…" : "Preparing workspace…" : "Workspace workbench failed", i = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
|
|
345
345
|
return /* @__PURE__ */ c("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ te("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
346
346
|
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,
|
|
347
347
|
/* @__PURE__ */ c("div", { className: "text-sm font-semibold text-foreground", children: n }),
|
|
348
|
-
/* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children:
|
|
348
|
+
/* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children: i }),
|
|
349
349
|
e.status === "failed" ? /* @__PURE__ */ c("p", { className: "mt-3 text-xs text-muted-foreground", children: "Reload the workspace to retry." }) : null
|
|
350
350
|
] }) });
|
|
351
351
|
}
|
|
@@ -374,7 +374,7 @@ function bn(e) {
|
|
|
374
374
|
}
|
|
375
375
|
function yn(e) {
|
|
376
376
|
var n;
|
|
377
|
-
const t = e.openTabs.find((
|
|
377
|
+
const t = e.openTabs.find((i) => i.id === e.activeTab), r = (n = t == null ? void 0 : t.params) == null ? void 0 : n.path;
|
|
378
378
|
return typeof r == "string" ? r : null;
|
|
379
379
|
}
|
|
380
380
|
function Sn({
|
|
@@ -382,23 +382,23 @@ function Sn({
|
|
|
382
382
|
requestHeaders: t,
|
|
383
383
|
navOpen: r,
|
|
384
384
|
surfaceOpen: n,
|
|
385
|
-
surfaceReady:
|
|
386
|
-
snapshot:
|
|
385
|
+
surfaceReady: i,
|
|
386
|
+
snapshot: s
|
|
387
387
|
}) {
|
|
388
|
-
const a =
|
|
388
|
+
const a = Gt(), l = k(null);
|
|
389
389
|
return v(() => {
|
|
390
|
-
var
|
|
391
|
-
if (e === null || n && !
|
|
392
|
-
(
|
|
390
|
+
var f;
|
|
391
|
+
if (e === null || n && !i) return;
|
|
392
|
+
(f = l.current) == null || f.abort();
|
|
393
393
|
const p = new AbortController();
|
|
394
394
|
l.current = p;
|
|
395
395
|
const h = {
|
|
396
396
|
v: 1,
|
|
397
397
|
drawerOpen: r,
|
|
398
398
|
workbenchOpen: n,
|
|
399
|
-
openTabs:
|
|
400
|
-
activeTab:
|
|
401
|
-
activeFile: yn(
|
|
399
|
+
openTabs: s.openTabs,
|
|
400
|
+
activeTab: s.activeTab,
|
|
401
|
+
activeFile: yn(s),
|
|
402
402
|
availablePanels: a.list().map((A) => A.id)
|
|
403
403
|
};
|
|
404
404
|
return fetch(bn(e), {
|
|
@@ -410,31 +410,31 @@ function Sn({
|
|
|
410
410
|
}), () => {
|
|
411
411
|
p.abort();
|
|
412
412
|
};
|
|
413
|
-
}, [e, r, a, t,
|
|
413
|
+
}, [e, r, a, t, s, n, i]), null;
|
|
414
414
|
}
|
|
415
415
|
function In({
|
|
416
416
|
workspaceId: e,
|
|
417
417
|
chatPanel: t,
|
|
418
418
|
useSessions: r,
|
|
419
419
|
requestHeaders: n,
|
|
420
|
-
sessionStorageKey:
|
|
421
|
-
providerStorageKey:
|
|
420
|
+
sessionStorageKey: i,
|
|
421
|
+
providerStorageKey: s,
|
|
422
422
|
surfaceStorageKey: a,
|
|
423
423
|
beforeShell: l,
|
|
424
424
|
afterShell: p,
|
|
425
425
|
panels: h,
|
|
426
|
-
commands:
|
|
426
|
+
commands: f,
|
|
427
427
|
catalogs: A,
|
|
428
428
|
plugins: w,
|
|
429
429
|
excludeDefaults: C,
|
|
430
430
|
capabilities: b,
|
|
431
431
|
apiBaseUrl: g,
|
|
432
432
|
authHeaders: y,
|
|
433
|
-
apiTimeout:
|
|
433
|
+
apiTimeout: d,
|
|
434
434
|
defaultTheme: S,
|
|
435
435
|
onThemeChange: Kt,
|
|
436
436
|
persistenceEnabled: He,
|
|
437
|
-
bridgeEndpoint:
|
|
437
|
+
bridgeEndpoint: Ae,
|
|
438
438
|
fullPageBasePath: Jt,
|
|
439
439
|
onAuthError: Ht,
|
|
440
440
|
sessions: Ve,
|
|
@@ -453,147 +453,147 @@ function In({
|
|
|
453
453
|
topBarLeft: Qt,
|
|
454
454
|
topBarRight: Xt,
|
|
455
455
|
showThemeToggle: Zt = !0,
|
|
456
|
-
chatParams:
|
|
457
|
-
hotReloadEnabled:
|
|
456
|
+
chatParams: F,
|
|
457
|
+
hotReloadEnabled: De,
|
|
458
458
|
frontPluginHotReload: er,
|
|
459
459
|
extraPanels: tt,
|
|
460
460
|
extraCommands: rt,
|
|
461
|
-
provisionWorkspace:
|
|
461
|
+
provisionWorkspace: Ne,
|
|
462
462
|
bootPreloadPaths: tr,
|
|
463
|
-
onWorkspaceWarmupStatusChange:
|
|
464
|
-
onOpenNav:
|
|
465
|
-
onOpenSurface:
|
|
463
|
+
onWorkspaceWarmupStatusChange: ie,
|
|
464
|
+
onOpenNav: Re,
|
|
465
|
+
onOpenSurface: _e,
|
|
466
466
|
surfaceButtonBottomOffset: rr,
|
|
467
467
|
className: nr
|
|
468
468
|
}) {
|
|
469
469
|
var _t, Lt;
|
|
470
|
-
const
|
|
470
|
+
const Le = s ?? `boring-ui-v2:layout:${e}`, E = a ?? `${Le}:surface`, se = fn(
|
|
471
471
|
E,
|
|
472
|
-
|
|
473
|
-
), oe = He !== !1, ae =
|
|
474
|
-
() =>
|
|
472
|
+
Le
|
|
473
|
+
), oe = He !== !1, ae = i ?? `boring-workspace:sessions:${e}`, J = T(
|
|
474
|
+
() => we(e, n ?? je),
|
|
475
475
|
[n, e]
|
|
476
|
-
),
|
|
477
|
-
() =>
|
|
476
|
+
), ir = T(
|
|
477
|
+
() => we(e, { ...n ?? je, ...y ?? je }),
|
|
478
478
|
[y, n, e]
|
|
479
479
|
), le = T(
|
|
480
480
|
() => Qr({ storageKey: ae }),
|
|
481
481
|
[ae]
|
|
482
|
-
), nt = Xr(le), [
|
|
482
|
+
), nt = Xr(le), [it, sr] = _(() => ({
|
|
483
483
|
workspaceId: e,
|
|
484
|
-
status:
|
|
485
|
-
})), [ce,
|
|
484
|
+
status: Ft
|
|
485
|
+
})), [ce, Te] = _(() => ({
|
|
486
486
|
workspaceId: e,
|
|
487
487
|
expired: !1
|
|
488
|
-
})), [
|
|
488
|
+
})), [st, ue] = _(() => ({
|
|
489
489
|
workspaceId: e,
|
|
490
490
|
creating: !1
|
|
491
491
|
})), [ot, de] = _(() => ({
|
|
492
492
|
workspaceId: e,
|
|
493
493
|
failed: !1
|
|
494
|
-
})), [
|
|
494
|
+
})), [xe, at] = _(null), fe = it.workspaceId === e ? it.status : Ft, or = t ?? xr, ar = r ?? Or, H = !t || !!r, Oe = H && Ne !== !1, We = () => {
|
|
495
495
|
}, D = ar({
|
|
496
496
|
requestHeaders: J,
|
|
497
497
|
storageKey: ae,
|
|
498
|
-
enabled:
|
|
499
|
-
}),
|
|
498
|
+
enabled: Oe
|
|
499
|
+
}), U = Oe && !D.loading && !D.error, x = Oe && !U, [me, lr] = _(() => ({ workspaceId: e, sessions: [], activeSessionId: null }));
|
|
500
500
|
v(() => {
|
|
501
|
-
|
|
502
|
-
const R = o.workspaceId === e,
|
|
501
|
+
U && lr((o) => {
|
|
502
|
+
const R = o.workspaceId === e, M = o.activeSessionId === D.activeSessionId, ee = o.sessions.length === D.sessions.length && o.sessions.every((Rr, _r) => {
|
|
503
503
|
var Tt;
|
|
504
504
|
return Rr.id === ((Tt = D.sessions[_r]) == null ? void 0 : Tt.id);
|
|
505
505
|
});
|
|
506
|
-
return R &&
|
|
506
|
+
return R && M && ee ? o : {
|
|
507
507
|
workspaceId: e,
|
|
508
508
|
sessions: D.sessions,
|
|
509
509
|
activeSessionId: D.activeSessionId
|
|
510
510
|
};
|
|
511
511
|
});
|
|
512
|
-
}, [D.activeSessionId, D.sessions,
|
|
513
|
-
const
|
|
512
|
+
}, [D.activeSessionId, D.sessions, U, e]);
|
|
513
|
+
const Me = x && me.workspaceId === e && me.sessions.length > 0, ke = x ? pn(ae) : null, G = U ? D.sessions : Me ? me.sessions : [], cr = U ? D.activeSessionId : Me ? me.activeSessionId : null, u = H && (U || Me) ? D : void 0, V = Ve !== void 0 || ze !== void 0 || Ye !== void 0 || Qe !== void 0 || Xe !== void 0, lt = ce.workspaceId === e && ce.expired, z = k(!1), Y = !!(U && u && !V && G.length === 0 && !lt), ur = st.workspaceId === e && st.creating, dr = ot.workspaceId === e && ot.failed, fr = !!(U && u && !V && G.length === 0 && lt && !z.current && !dr), ct = Y || ur || fr;
|
|
514
514
|
v(() => {
|
|
515
515
|
if (!Y) {
|
|
516
|
-
ce.workspaceId !== e &&
|
|
516
|
+
ce.workspaceId !== e && Te({ workspaceId: e, expired: !1 });
|
|
517
517
|
return;
|
|
518
518
|
}
|
|
519
|
-
|
|
519
|
+
Te({ workspaceId: e, expired: !1 });
|
|
520
520
|
const o = globalThis.setTimeout(() => {
|
|
521
|
-
|
|
521
|
+
Te({ workspaceId: e, expired: !0 });
|
|
522
522
|
}, 2e3);
|
|
523
523
|
return () => globalThis.clearTimeout(o);
|
|
524
524
|
}, [ce.workspaceId, Y, e]);
|
|
525
|
-
const mr =
|
|
525
|
+
const mr = u ? G.map((o) => ({
|
|
526
526
|
...o,
|
|
527
527
|
title: o.title ?? "New session"
|
|
528
|
-
})) : void 0, pr =
|
|
529
|
-
id:
|
|
528
|
+
})) : void 0, pr = ke ? [{
|
|
529
|
+
id: ke,
|
|
530
530
|
title: "Loading sessions…",
|
|
531
531
|
createdAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
532
532
|
updatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
533
533
|
turnCount: 0
|
|
534
|
-
}] : [],
|
|
534
|
+
}] : [], Fe = u ? mr ?? [] : x ? pr : V ? Ve ?? [] : nt.sessions, ut = u ? cr ?? null : x ? ke : V ? ze ?? null : nt.activeId, j = (F == null ? void 0 : F.autoSubmitInitialDraft) === !0, pe = j && H && !V, [O, Q] = _(() => pe ? null : void 0), dt = k(e), B = k(!1);
|
|
535
535
|
v(() => {
|
|
536
536
|
if (dt.current !== e) {
|
|
537
|
-
dt.current = e, B.current = !1, Q(
|
|
537
|
+
dt.current = e, B.current = !1, Q(pe ? null : void 0);
|
|
538
538
|
return;
|
|
539
539
|
}
|
|
540
|
-
|
|
541
|
-
}, [O,
|
|
542
|
-
!
|
|
540
|
+
pe && O === void 0 && (B.current = !1, Q(null));
|
|
541
|
+
}, [O, pe, e]), v(() => {
|
|
542
|
+
!u || O !== null || B.current || (B.current = !0, Promise.resolve(u.create({ title: q })).then((o) => {
|
|
543
543
|
if (typeof (o == null ? void 0 : o.id) != "string")
|
|
544
544
|
throw new Error("auto_submit_session_create_failed");
|
|
545
545
|
Q(o.id);
|
|
546
546
|
}).catch(() => {
|
|
547
547
|
B.current = !1, Q(void 0);
|
|
548
548
|
}));
|
|
549
|
-
}, [O, q,
|
|
550
|
-
const N = O !== void 0 ? O ?? null : ut, ft = x ?
|
|
551
|
-
const o =
|
|
552
|
-
return o && Promise.resolve(R).then(() =>
|
|
549
|
+
}, [O, q, u]);
|
|
550
|
+
const N = O !== void 0 ? O ?? null : ut, ft = x ? We : (u == null ? void 0 : u.switch) ?? Ye ?? le.switchTo, gr = L((o) => (N && o !== N && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: N } })), ft(o)), [N, ft]), mt = x ? We : u ? () => {
|
|
551
|
+
const o = G.find((M) => M.id === N && dn(M, q)), R = u.create();
|
|
552
|
+
return o && Promise.resolve(R).then(() => u.delete(o.id)).catch(() => {
|
|
553
553
|
}), R;
|
|
554
|
-
} : Qe ?? le.create, pt = x ?
|
|
555
|
-
`${
|
|
554
|
+
} : Qe ?? le.create, pt = x ? We : (u == null ? void 0 : u.delete) ?? Xe ?? le.remove, hr = L((o) => (u && G.length <= 1 && (z.current = !0), pt(o)), [G.length, pt, u]), br = ((_t = Fe.find((o) => o.id === N)) == null ? void 0 : _t.title) ?? void 0, [yr, gt] = qe(
|
|
555
|
+
`${se}:drawer`,
|
|
556
556
|
zt,
|
|
557
557
|
oe
|
|
558
558
|
), ht = Ze && yr, [$, W] = qe(
|
|
559
559
|
// Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
|
|
560
560
|
// layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
|
|
561
561
|
// key corrupts the JSON and drops the persisted workbench layout on reload.
|
|
562
|
-
`${
|
|
562
|
+
`${se}:workbenchOpen`,
|
|
563
563
|
Yt ?? !1,
|
|
564
564
|
oe
|
|
565
|
-
), [Sr,
|
|
566
|
-
`${
|
|
565
|
+
), [Sr, Ue] = _(!1), [vr, X] = qe(
|
|
566
|
+
`${se}:workbenchLeftOpen`,
|
|
567
567
|
!0,
|
|
568
568
|
oe
|
|
569
|
-
), Z =
|
|
569
|
+
), Z = k(!1), I = k($), bt = k(E), Ge = k(null);
|
|
570
570
|
bt.current = E;
|
|
571
571
|
const [yt, St] = _(() => ({
|
|
572
572
|
key: E,
|
|
573
|
-
snapshot:
|
|
574
|
-
})), Pr = yt.key === E ? yt.snapshot :
|
|
573
|
+
snapshot: Ut
|
|
574
|
+
})), Pr = yt.key === E ? yt.snapshot : Ut;
|
|
575
575
|
v(() => {
|
|
576
576
|
Z.current = !1, z.current = !1, ue({ workspaceId: e, creating: !1 }), de({ workspaceId: e, failed: !1 }), at(null);
|
|
577
577
|
}, [e]), v(() => {
|
|
578
|
-
|
|
578
|
+
Ue(!1);
|
|
579
579
|
}, [E]), v(() => {
|
|
580
|
-
if (!(!
|
|
581
|
-
if (
|
|
580
|
+
if (!(!u || u.loading) && !Y && O === void 0) {
|
|
581
|
+
if (G.length > 0) {
|
|
582
582
|
Z.current = !1, z.current = !1, ue((o) => o.workspaceId === e && o.creating ? { workspaceId: e, creating: !1 } : o), de((o) => o.workspaceId === e && o.failed ? { workspaceId: e, failed: !1 } : o);
|
|
583
583
|
return;
|
|
584
584
|
}
|
|
585
|
-
z.current || Z.current || (Z.current = !0, ue({ workspaceId: e, creating: !0 }), de({ workspaceId: e, failed: !1 }), Promise.resolve(
|
|
585
|
+
z.current || Z.current || (Z.current = !0, ue({ workspaceId: e, creating: !0 }), de({ workspaceId: e, failed: !1 }), Promise.resolve(u.create({ title: q })).then((o) => {
|
|
586
586
|
const R = o == null ? void 0 : o.id;
|
|
587
587
|
typeof R == "string" && at({ workspaceId: e, id: R });
|
|
588
588
|
}).catch(() => {
|
|
589
589
|
Z.current = !1, ue({ workspaceId: e, creating: !1 }), de({ workspaceId: e, failed: !0 });
|
|
590
590
|
}));
|
|
591
591
|
}
|
|
592
|
-
}, [
|
|
592
|
+
}, [G.length, O, q, Y, u, e]), v(() => {
|
|
593
593
|
I.current = $;
|
|
594
594
|
}, [$]);
|
|
595
595
|
const vt = L((o) => {
|
|
596
|
-
|
|
596
|
+
Ge.current = { key: E, api: o }, Ue(!0), St({
|
|
597
597
|
key: E,
|
|
598
598
|
snapshot: o.getSnapshot()
|
|
599
599
|
});
|
|
@@ -602,28 +602,28 @@ function In({
|
|
|
602
602
|
key: E,
|
|
603
603
|
snapshot: o
|
|
604
604
|
});
|
|
605
|
-
}, [E]),
|
|
606
|
-
const o =
|
|
605
|
+
}, [E]), ge = L(() => {
|
|
606
|
+
const o = Ge.current;
|
|
607
607
|
return (o == null ? void 0 : o.key) === bt.current ? o.api : null;
|
|
608
|
-
}, []),
|
|
608
|
+
}, []), he = L(() => I.current, []), be = L(() => {
|
|
609
609
|
I.current = !0, W(!0);
|
|
610
|
-
}, [W]),
|
|
610
|
+
}, [W]), ye = L(() => {
|
|
611
611
|
I.current = !0, W(!0), X(!0);
|
|
612
|
-
}, [W, X]),
|
|
613
|
-
I.current = !1,
|
|
614
|
-
}, [W]),
|
|
615
|
-
() => (w == null ? void 0 : w.map(
|
|
612
|
+
}, [W, X]), Se = L(() => {
|
|
613
|
+
I.current = !1, Ge.current = null, Ue(!1), W(!1);
|
|
614
|
+
}, [W]), ve = T(
|
|
615
|
+
() => (w == null ? void 0 : w.map(kr)) ?? [],
|
|
616
616
|
[w]
|
|
617
617
|
), Ce = T(
|
|
618
|
-
() =>
|
|
619
|
-
[
|
|
618
|
+
() => ve.some((o) => o.registrations.leftTabs.length > 0),
|
|
619
|
+
[ve]
|
|
620
620
|
), wt = T(
|
|
621
|
-
() =>
|
|
622
|
-
[
|
|
621
|
+
() => ve.flatMap((o) => o.registrations.panels.map((R) => R.id)),
|
|
622
|
+
[ve]
|
|
623
623
|
), Et = T(
|
|
624
624
|
() => [...tt ?? [], ...wt],
|
|
625
625
|
[tt, wt]
|
|
626
|
-
), At = N ?? (O !== void 0 ? "default" : ((Lt =
|
|
626
|
+
), At = N ?? (O !== void 0 ? "default" : ((Lt = Fe[0]) == null ? void 0 : Lt.id) ?? "default"), [wr, $e] = _(j), Dt = k(e);
|
|
627
627
|
v(() => {
|
|
628
628
|
if (Dt.current !== e) {
|
|
629
629
|
Dt.current = e, $e(j);
|
|
@@ -631,53 +631,53 @@ function In({
|
|
|
631
631
|
}
|
|
632
632
|
j && $e(!0);
|
|
633
633
|
}, [j, e]);
|
|
634
|
-
const Nt = j && H && !N, Rt = !!!(
|
|
635
|
-
|
|
636
|
-
}, [
|
|
634
|
+
const Nt = j && H && !N, Rt = !!!(xe && xe.workspaceId === e && xe.id === N) && !wr && Ne !== !1 && (H ? !!N : !0), Er = L((o) => {
|
|
635
|
+
sr({ workspaceId: e, status: o }), ie == null || ie(o);
|
|
636
|
+
}, [ie, e]);
|
|
637
637
|
v(() => {
|
|
638
638
|
var R;
|
|
639
|
-
const o = (
|
|
640
|
-
const ee =
|
|
641
|
-
!ee || typeof ee != "object" ||
|
|
642
|
-
surface:
|
|
643
|
-
isWorkbenchOpen:
|
|
644
|
-
openWorkbench:
|
|
645
|
-
openWorkbenchSources:
|
|
639
|
+
const o = (M) => {
|
|
640
|
+
const ee = M.detail;
|
|
641
|
+
!ee || typeof ee != "object" || Ur(ee, {
|
|
642
|
+
surface: ge,
|
|
643
|
+
isWorkbenchOpen: he,
|
|
644
|
+
openWorkbench: be,
|
|
645
|
+
openWorkbenchSources: ye
|
|
646
646
|
});
|
|
647
647
|
};
|
|
648
648
|
return (R = globalThis.addEventListener) == null || R.call(globalThis, xt, o), () => {
|
|
649
|
-
var
|
|
650
|
-
return (
|
|
649
|
+
var M;
|
|
650
|
+
return (M = globalThis.removeEventListener) == null ? void 0 : M.call(globalThis, xt, o);
|
|
651
651
|
};
|
|
652
|
-
}, [he, be, ye
|
|
652
|
+
}, [ge, he, be, ye]), v(() => {
|
|
653
653
|
x || re == null || re(N ?? null);
|
|
654
654
|
}, [N, re, x]);
|
|
655
655
|
const Ie = fe.status !== "ready", Ar = Ie ? /* @__PURE__ */ c(mn, { status: fe }) : void 0, Dr = T(
|
|
656
656
|
() => ({
|
|
657
|
-
...
|
|
657
|
+
...F,
|
|
658
658
|
...Nt ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
|
|
659
659
|
sessionId: At,
|
|
660
660
|
requestHeaders: J,
|
|
661
|
-
bridgeEndpoint:
|
|
662
|
-
getSurface:
|
|
663
|
-
isWorkbenchOpen:
|
|
664
|
-
openWorkbench:
|
|
665
|
-
openWorkbenchSources:
|
|
666
|
-
closeWorkbench:
|
|
661
|
+
bridgeEndpoint: Ae,
|
|
662
|
+
getSurface: ge,
|
|
663
|
+
isWorkbenchOpen: he,
|
|
664
|
+
openWorkbench: be,
|
|
665
|
+
openWorkbenchSources: ye,
|
|
666
|
+
closeWorkbench: Se,
|
|
667
667
|
extraCommands: rt,
|
|
668
668
|
workspaceWarmupStatus: fe,
|
|
669
669
|
hydrateMessages: Rt,
|
|
670
670
|
onAutoSubmitInitialDraftSettled: () => {
|
|
671
671
|
B.current = !1, $e(!1), Q(void 0);
|
|
672
|
-
const o =
|
|
672
|
+
const o = F == null ? void 0 : F.onAutoSubmitInitialDraftSettled;
|
|
673
673
|
typeof o == "function" && o();
|
|
674
674
|
},
|
|
675
675
|
// Forward the explicit prop when set. Omitting the key (when undefined)
|
|
676
676
|
// lets ChatPanel apply its own default (true) and avoids overriding a
|
|
677
677
|
// value passed through chatParams.
|
|
678
|
-
...
|
|
678
|
+
...De !== void 0 ? { hotReloadEnabled: De } : {}
|
|
679
679
|
}),
|
|
680
|
-
[
|
|
680
|
+
[F, Nt, At, J, Ae, ge, he, be, ye, Se, rt, fe, Rt, De]
|
|
681
681
|
), Nr = T(() => ({
|
|
682
682
|
storageKey: E,
|
|
683
683
|
defaultLeftTab: ne,
|
|
@@ -685,9 +685,9 @@ function In({
|
|
|
685
685
|
extraPanels: Et,
|
|
686
686
|
onReady: vt,
|
|
687
687
|
onChange: Pt,
|
|
688
|
-
onClose:
|
|
688
|
+
onClose: Se
|
|
689
689
|
}), [
|
|
690
|
-
|
|
690
|
+
Se,
|
|
691
691
|
ne,
|
|
692
692
|
et,
|
|
693
693
|
Pt,
|
|
@@ -697,22 +697,22 @@ function In({
|
|
|
697
697
|
W
|
|
698
698
|
]);
|
|
699
699
|
return /* @__PURE__ */ c("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ te(
|
|
700
|
-
|
|
700
|
+
Fr,
|
|
701
701
|
{
|
|
702
702
|
chatPanel: or,
|
|
703
703
|
panels: h,
|
|
704
|
-
commands:
|
|
704
|
+
commands: f,
|
|
705
705
|
catalogs: A,
|
|
706
706
|
plugins: w,
|
|
707
707
|
excludeDefaults: C,
|
|
708
708
|
capabilities: b,
|
|
709
709
|
apiBaseUrl: g,
|
|
710
|
-
authHeaders:
|
|
711
|
-
apiTimeout:
|
|
710
|
+
authHeaders: ir,
|
|
711
|
+
apiTimeout: d,
|
|
712
712
|
defaultTheme: S,
|
|
713
713
|
onThemeChange: Kt,
|
|
714
714
|
workspaceId: e,
|
|
715
|
-
storageKey:
|
|
715
|
+
storageKey: Le,
|
|
716
716
|
persistenceEnabled: He,
|
|
717
717
|
bridgeEndpoint: null,
|
|
718
718
|
onAuthError: Ht,
|
|
@@ -727,14 +727,14 @@ function In({
|
|
|
727
727
|
requestHeaders: J,
|
|
728
728
|
apiBaseUrl: g,
|
|
729
729
|
preloadPaths: tr,
|
|
730
|
-
provisionWorkspace:
|
|
730
|
+
provisionWorkspace: Ne,
|
|
731
731
|
onStatusChange: Er
|
|
732
732
|
}
|
|
733
733
|
),
|
|
734
734
|
/* @__PURE__ */ c(
|
|
735
735
|
Sn,
|
|
736
736
|
{
|
|
737
|
-
bridgeEndpoint:
|
|
737
|
+
bridgeEndpoint: Ae,
|
|
738
738
|
requestHeaders: J,
|
|
739
739
|
navOpen: ht,
|
|
740
740
|
surfaceOpen: $,
|
|
@@ -771,11 +771,14 @@ function In({
|
|
|
771
771
|
className: nr,
|
|
772
772
|
nav: ht ? "session-list" : null,
|
|
773
773
|
navParams: {
|
|
774
|
-
sessions:
|
|
774
|
+
sessions: Fe,
|
|
775
775
|
activeId: ut,
|
|
776
776
|
onSwitch: gr,
|
|
777
777
|
onCreate: mt,
|
|
778
778
|
onDelete: hr,
|
|
779
|
+
onLoadMore: u == null ? void 0 : u.loadMore,
|
|
780
|
+
hasMore: u == null ? void 0 : u.hasMore,
|
|
781
|
+
loadingMore: u == null ? void 0 : u.loadingMore,
|
|
779
782
|
onClose: () => gt(!1)
|
|
780
783
|
},
|
|
781
784
|
center: "chat",
|
|
@@ -789,12 +792,12 @@ function In({
|
|
|
789
792
|
onClose: () => X(!1),
|
|
790
793
|
onCollapse: () => X(!1)
|
|
791
794
|
} : void 0,
|
|
792
|
-
storageKey: oe ?
|
|
795
|
+
storageKey: oe ? se : void 0,
|
|
793
796
|
onOpenNav: Ze ? () => {
|
|
794
|
-
gt(!0),
|
|
797
|
+
gt(!0), Re == null || Re();
|
|
795
798
|
} : void 0,
|
|
796
799
|
onOpenSurface: () => {
|
|
797
|
-
I.current = !0, W(!0),
|
|
800
|
+
I.current = !0, W(!0), _e == null || _e();
|
|
798
801
|
},
|
|
799
802
|
surfaceButtonBottomOffset: rr,
|
|
800
803
|
onOpenSidebar: Ce ? () => {
|
|
@@ -812,18 +815,18 @@ const vn = 500;
|
|
|
812
815
|
function Pn(e) {
|
|
813
816
|
return new Promise((t, r) => {
|
|
814
817
|
let n;
|
|
815
|
-
const
|
|
816
|
-
n && globalThis.clearTimeout(n), e.removeEventListener("abort",
|
|
817
|
-
},
|
|
818
|
-
|
|
818
|
+
const i = () => {
|
|
819
|
+
n && globalThis.clearTimeout(n), e.removeEventListener("abort", s);
|
|
820
|
+
}, s = () => {
|
|
821
|
+
i(), r(new DOMException("Workspace boot aborted", "AbortError"));
|
|
819
822
|
};
|
|
820
823
|
if (e.aborted) {
|
|
821
|
-
|
|
824
|
+
s();
|
|
822
825
|
return;
|
|
823
826
|
}
|
|
824
827
|
n = globalThis.setTimeout(() => {
|
|
825
|
-
|
|
826
|
-
}, vn), e.addEventListener("abort",
|
|
828
|
+
i(), t();
|
|
829
|
+
}, vn), e.addEventListener("abort", s, { once: !0 });
|
|
827
830
|
});
|
|
828
831
|
}
|
|
829
832
|
function qn({
|
|
@@ -831,8 +834,8 @@ function qn({
|
|
|
831
834
|
requestHeaders: t,
|
|
832
835
|
apiBaseUrl: r,
|
|
833
836
|
preloadPaths: n = Ct,
|
|
834
|
-
provisionWorkspace:
|
|
835
|
-
loadingFallback:
|
|
837
|
+
provisionWorkspace: i = !0,
|
|
838
|
+
loadingFallback: s,
|
|
836
839
|
errorFallback: a,
|
|
837
840
|
children: l
|
|
838
841
|
}) {
|
|
@@ -841,18 +844,18 @@ function qn({
|
|
|
841
844
|
label: "Waking workspace runtime"
|
|
842
845
|
});
|
|
843
846
|
return v(() => {
|
|
844
|
-
const
|
|
847
|
+
const f = new AbortController(), A = we(e, t);
|
|
845
848
|
async function w(b) {
|
|
846
849
|
const g = await fetch($t(r, b), {
|
|
847
850
|
headers: A,
|
|
848
|
-
signal:
|
|
849
|
-
}), y = await
|
|
851
|
+
signal: f.signal
|
|
852
|
+
}), y = await Ee(g);
|
|
850
853
|
if (!g.ok) {
|
|
851
854
|
if (Ke(y)) return "preparing";
|
|
852
855
|
throw new Error(Je(y) ?? `${b} failed with ${g.status}`);
|
|
853
856
|
}
|
|
854
857
|
if (jt(b)) {
|
|
855
|
-
const S =
|
|
858
|
+
const S = Pe(y);
|
|
856
859
|
if ((S == null ? void 0 : S.state) === "degraded") throw new Error(S.message ?? "Workspace failed to prepare");
|
|
857
860
|
}
|
|
858
861
|
return It(b) !== null && y && typeof y == "object" && qt(r, A["x-boring-workspace-id"] ?? e, b, y), "ready";
|
|
@@ -860,30 +863,30 @@ function qn({
|
|
|
860
863
|
async function C() {
|
|
861
864
|
h({ status: "loading", label: "Waking workspace runtime" });
|
|
862
865
|
try {
|
|
863
|
-
const b = Bt(n,
|
|
864
|
-
let g = await Promise.all(b.map(async (
|
|
866
|
+
const b = Bt(n, i);
|
|
867
|
+
let g = await Promise.all(b.map(async (d) => ({ path: d, status: await w(d) }))), y = g.filter((d) => d.status === "preparing").map((d) => d.path);
|
|
865
868
|
for (; y.length > 0; ) {
|
|
866
|
-
if (h({ status: "loading", label: "Workspace is still preparing" }), await Pn(
|
|
867
|
-
g = await Promise.all(y.map(async (
|
|
869
|
+
if (h({ status: "loading", label: "Workspace is still preparing" }), await Pn(f.signal), f.signal.aborted) return;
|
|
870
|
+
g = await Promise.all(y.map(async (d) => ({ path: d, status: await w(d) }))), y = g.filter((d) => d.status === "preparing").map((d) => d.path);
|
|
868
871
|
}
|
|
869
|
-
|
|
872
|
+
f.signal.aborted || h({ status: "ready" });
|
|
870
873
|
} catch (b) {
|
|
871
|
-
if (
|
|
874
|
+
if (f.signal.aborted) return;
|
|
872
875
|
h({
|
|
873
876
|
status: "error",
|
|
874
877
|
message: b instanceof Error ? b.message : "Unknown workspace boot error"
|
|
875
878
|
});
|
|
876
879
|
}
|
|
877
880
|
}
|
|
878
|
-
return C(), () =>
|
|
879
|
-
}, [r, n,
|
|
881
|
+
return C(), () => f.abort();
|
|
882
|
+
}, [r, n, i, t, e]), p.status === "ready" ? /* @__PURE__ */ c(K, { children: l }) : p.status === "error" ? typeof a == "function" ? /* @__PURE__ */ c(K, { children: a(p.message) }) : a ? /* @__PURE__ */ c(K, { children: a }) : /* @__PURE__ */ c(
|
|
880
883
|
Wt,
|
|
881
884
|
{
|
|
882
885
|
title: "Workspace failed to open",
|
|
883
886
|
description: p.message,
|
|
884
887
|
status: "Retry by reloading the page"
|
|
885
888
|
}
|
|
886
|
-
) : typeof
|
|
889
|
+
) : typeof s == "function" ? /* @__PURE__ */ c(K, { children: s(p.label) }) : s ? /* @__PURE__ */ c(K, { children: s }) : /* @__PURE__ */ c(
|
|
887
890
|
Wt,
|
|
888
891
|
{
|
|
889
892
|
title: "Opening workspace",
|
|
@@ -984,26 +987,26 @@ function Be({ code: e, title: t, description: r }) {
|
|
|
984
987
|
);
|
|
985
988
|
}
|
|
986
989
|
function jn({ componentId: e, params: t = {} }) {
|
|
987
|
-
const r =
|
|
990
|
+
const r = Gt(), { errors: n } = Gr(), i = r.get(e), s = r.getComponents()[e];
|
|
988
991
|
Tr(() => {
|
|
989
|
-
document.title = (
|
|
990
|
-
}, [e,
|
|
992
|
+
document.title = (i == null ? void 0 : i.title) ?? e;
|
|
993
|
+
}, [e, i == null ? void 0 : i.title]);
|
|
991
994
|
const a = T(() => ({
|
|
992
995
|
params: t,
|
|
993
996
|
api: Ln(e),
|
|
994
997
|
containerApi: Tn(),
|
|
995
998
|
className: "h-full"
|
|
996
999
|
}), [e, t]), l = T(() => {
|
|
997
|
-
if (!
|
|
998
|
-
const p =
|
|
1000
|
+
if (!i) return null;
|
|
1001
|
+
const p = i.pluginId ?? i.id;
|
|
999
1002
|
for (let h = n.length - 1; h >= 0; h -= 1) {
|
|
1000
|
-
const
|
|
1001
|
-
if (
|
|
1002
|
-
return
|
|
1003
|
+
const f = n[h];
|
|
1004
|
+
if (f.contributionKind === "panel" && f.contributionId === e && f.pluginId === p)
|
|
1005
|
+
return f;
|
|
1003
1006
|
}
|
|
1004
1007
|
return null;
|
|
1005
|
-
}, [e, n,
|
|
1006
|
-
return
|
|
1008
|
+
}, [e, n, i]);
|
|
1009
|
+
return i ? !i.supportsFullPage || !s ? /* @__PURE__ */ c(
|
|
1007
1010
|
Be,
|
|
1008
1011
|
{
|
|
1009
1012
|
code: Nn,
|
|
@@ -1017,7 +1020,7 @@ function jn({ componentId: e, params: t = {} }) {
|
|
|
1017
1020
|
title: "Panel failed to render",
|
|
1018
1021
|
description: `Panel "${e}" crashed while rendering in full-page mode: ${l.error.message}`
|
|
1019
1022
|
}
|
|
1020
|
-
) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(Cr, { mode: "full-page", children: /* @__PURE__ */ c(
|
|
1023
|
+
) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(Cr, { mode: "full-page", children: /* @__PURE__ */ c(s, { ...a }) }) }) : /* @__PURE__ */ c(
|
|
1021
1024
|
Be,
|
|
1022
1025
|
{
|
|
1023
1026
|
code: Dn,
|
|
@@ -1027,8 +1030,8 @@ function jn({ componentId: e, params: t = {} }) {
|
|
|
1027
1030
|
);
|
|
1028
1031
|
}
|
|
1029
1032
|
function Bn(e) {
|
|
1030
|
-
var
|
|
1031
|
-
const t = new URLSearchParams(e), r = ((
|
|
1033
|
+
var s;
|
|
1034
|
+
const t = new URLSearchParams(e), r = ((s = t.get("component")) == null ? void 0 : s.trim()) ?? "";
|
|
1032
1035
|
if (!r)
|
|
1033
1036
|
return {
|
|
1034
1037
|
componentId: null,
|
|
@@ -1041,9 +1044,9 @@ function Bn(e) {
|
|
|
1041
1044
|
const n = t.get("params");
|
|
1042
1045
|
if (!n)
|
|
1043
1046
|
return { componentId: r, params: {} };
|
|
1044
|
-
let
|
|
1047
|
+
let i;
|
|
1045
1048
|
try {
|
|
1046
|
-
|
|
1049
|
+
i = JSON.parse(n);
|
|
1047
1050
|
} catch {
|
|
1048
1051
|
return {
|
|
1049
1052
|
componentId: null,
|
|
@@ -1054,14 +1057,14 @@ function Bn(e) {
|
|
|
1054
1057
|
}
|
|
1055
1058
|
};
|
|
1056
1059
|
}
|
|
1057
|
-
return
|
|
1060
|
+
return i === null || Array.isArray(i) || typeof i != "object" ? {
|
|
1058
1061
|
componentId: null,
|
|
1059
1062
|
params: {},
|
|
1060
1063
|
error: {
|
|
1061
1064
|
code: An,
|
|
1062
1065
|
message: "Full-page panel params must be a JSON object."
|
|
1063
1066
|
}
|
|
1064
|
-
} : { componentId: r, params:
|
|
1067
|
+
} : { componentId: r, params: i };
|
|
1065
1068
|
}
|
|
1066
1069
|
export {
|
|
1067
1070
|
En as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
|