@hachej/boring-workspace 0.1.48 → 0.1.50
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-CoZWkHqn.js → FileTree-GeEPOsUU.js} +1 -1
- package/dist/{MarkdownEditor-DOZy49fg.js → MarkdownEditor-PL9esiiq.js} +1 -1
- package/dist/{WorkspaceLoadingState-CjXix_Fa.js → WorkspaceLoadingState-Bi_qd29T.js} +1 -1
- package/dist/{WorkspaceProvider-CRd7lb76.js → WorkspaceProvider-CbvaXxgT.js} +1781 -1780
- package/dist/app-front.d.ts +1 -0
- package/dist/app-front.js +226 -225
- package/dist/testing.js +1 -1
- package/dist/workspace.d.ts +2 -1
- package/dist/workspace.js +5 -5
- package/package.json +4 -4
package/dist/app-front.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as d, jsxs as Pe, Fragment as de } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect as A, useSyncExternalStore as xr, useMemo as O, useState as x, useCallback as E, useRef as H, useLayoutEffect as Mr } from "react";
|
|
3
3
|
import { PiChatPanel as Fr, usePiSessions as Cr } from "@hachej/boring-agent/front";
|
|
4
|
-
import { aj as Wr, at as Ve, au as
|
|
5
|
-
import { T as jr, C as qr, r as
|
|
4
|
+
import { aj as Wr, at as Ve, au as _n, av as Ln, aw as On, ax as xn, ay as ke, az as bt, aA as St, aB as Mn, aC as Ir, aD as ze, aE as Sn, aF as Gr, U as yn, aG as $r, q as Ur, u as Fn, aH as Kr, ag as Hr, aI as Jr } from "./WorkspaceProvider-CbvaXxgT.js";
|
|
5
|
+
import { T as jr, C as qr, r as Pn, w as Br, W as En } from "./WorkspaceLoadingState-Bi_qd29T.js";
|
|
6
6
|
import { Sun as zr, Moon as Vr } from "lucide-react";
|
|
7
7
|
import { IconButton as kr, ErrorState as Yr } from "@hachej/boring-ui-kit";
|
|
8
8
|
function Xr() {
|
|
@@ -76,8 +76,8 @@ function ti(e = {}) {
|
|
|
76
76
|
},
|
|
77
77
|
remove(c) {
|
|
78
78
|
var y;
|
|
79
|
-
const u = i.sessions.filter((
|
|
80
|
-
o({ sessions: u, activeId:
|
|
79
|
+
const u = i.sessions.filter((S) => S.id !== c), b = i.activeId === c ? ((y = u[0]) == null ? void 0 : y.id) ?? "" : i.activeId;
|
|
80
|
+
o({ sessions: u, activeId: b });
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
}
|
|
@@ -85,7 +85,7 @@ function ni(e) {
|
|
|
85
85
|
return xr(e.subscribe, e.getState, e.getState);
|
|
86
86
|
}
|
|
87
87
|
const ri = 500, ii = 1e4;
|
|
88
|
-
function
|
|
88
|
+
function An(e) {
|
|
89
89
|
return new Promise((n, r) => {
|
|
90
90
|
let i;
|
|
91
91
|
const s = () => {
|
|
@@ -134,10 +134,10 @@ function oi(e) {
|
|
|
134
134
|
async function ai(e) {
|
|
135
135
|
if (!e.ok) {
|
|
136
136
|
const s = await ke(e);
|
|
137
|
-
if (
|
|
138
|
-
throw new Error(
|
|
137
|
+
if (bt(s)) return { status: "preparing" };
|
|
138
|
+
throw new Error(St(s) ?? `/api/v1/ready-status failed with ${e.status}`);
|
|
139
139
|
}
|
|
140
|
-
const n = await si(e), r = oi(n), i =
|
|
140
|
+
const n = await si(e), r = oi(n), i = Ir(n);
|
|
141
141
|
if ((n == null ? void 0 : n.state) === "degraded" || (n == null ? void 0 : n.state) === "failed") {
|
|
142
142
|
if (i && (r == null ? void 0 : r.state) === "failed")
|
|
143
143
|
return { status: "ready", runtimeDependencies: r };
|
|
@@ -155,19 +155,19 @@ async function li({
|
|
|
155
155
|
const o = new AbortController(), c = globalThis.setTimeout(() => o.abort(new DOMException("Warmup attempt timed out", "TimeoutError")), ii), u = () => o.abort(i.reason);
|
|
156
156
|
i.aborted && u(), i.addEventListener("abort", u, { once: !0 });
|
|
157
157
|
try {
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
const y = await ke(
|
|
161
|
-
if (!
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
throw new Error(
|
|
158
|
+
const b = await fetch(On(e, n), { headers: r, signal: o.signal });
|
|
159
|
+
if (xn(n)) return await ai(b);
|
|
160
|
+
const y = await ke(b);
|
|
161
|
+
if (!b.ok) {
|
|
162
|
+
const S = bt(y);
|
|
163
|
+
if (S) return { status: "preparing", ...S };
|
|
164
|
+
throw new Error(St(y) ?? `${n} failed with ${b.status}`);
|
|
165
165
|
}
|
|
166
|
-
return y && typeof y == "object" &&
|
|
167
|
-
} catch (
|
|
168
|
-
if (i.aborted) throw
|
|
169
|
-
if (o.signal.aborted ||
|
|
170
|
-
throw
|
|
166
|
+
return y && typeof y == "object" && Mn(e, r["x-boring-workspace-id"] ?? s, n, y), { status: "ready" };
|
|
167
|
+
} catch (b) {
|
|
168
|
+
if (i.aborted) throw b;
|
|
169
|
+
if (o.signal.aborted || b instanceof TypeError) return { status: "preparing" };
|
|
170
|
+
throw b;
|
|
171
171
|
} finally {
|
|
172
172
|
globalThis.clearTimeout(c), i.removeEventListener("abort", u);
|
|
173
173
|
}
|
|
@@ -176,39 +176,39 @@ function ci({
|
|
|
176
176
|
workspaceId: e,
|
|
177
177
|
requestHeaders: n,
|
|
178
178
|
apiBaseUrl: r,
|
|
179
|
-
preloadPaths: i =
|
|
179
|
+
preloadPaths: i = _n,
|
|
180
180
|
provisionWorkspace: s = !0,
|
|
181
181
|
onStatusChange: o
|
|
182
182
|
}) {
|
|
183
183
|
return A(() => {
|
|
184
184
|
let c = !1;
|
|
185
|
-
const u = new AbortController(),
|
|
185
|
+
const u = new AbortController(), b = Ve(e, n);
|
|
186
186
|
async function y() {
|
|
187
|
-
var
|
|
187
|
+
var S, j;
|
|
188
188
|
o == null || o({ status: "preparing" });
|
|
189
189
|
try {
|
|
190
|
-
const W =
|
|
190
|
+
const W = Ln(i, s), V = (p) => li({
|
|
191
191
|
apiBaseUrl: r,
|
|
192
192
|
path: p,
|
|
193
|
-
headers:
|
|
193
|
+
headers: b,
|
|
194
194
|
signal: u.signal,
|
|
195
195
|
workspaceId: e
|
|
196
196
|
});
|
|
197
|
-
let
|
|
197
|
+
let w = await Promise.all(W.map(async (p) => ({ path: p, result: await V(p) })));
|
|
198
198
|
if (c || u.signal.aborted) return;
|
|
199
|
-
let h = (
|
|
200
|
-
for (;
|
|
199
|
+
let h = (S = w.find((p) => p.result.runtimeDependencies)) == null ? void 0 : S.result.runtimeDependencies, T = w.filter((p) => p.result.status === "preparing");
|
|
200
|
+
for (; T.length > 0; ) {
|
|
201
201
|
let p;
|
|
202
|
-
for (const N of
|
|
202
|
+
for (const N of T)
|
|
203
203
|
if (N.result.status === "preparing" && N.result.requirement) {
|
|
204
204
|
p = N.result.requirement;
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
|
-
if (o == null || o({ status: "preparing", message: "Workspace is still preparing", ...p ? { requirement: p } : {} }), await
|
|
208
|
-
h = ((j =
|
|
207
|
+
if (o == null || o({ status: "preparing", message: "Workspace is still preparing", ...p ? { requirement: p } : {} }), await An(u.signal), c || u.signal.aborted || (w = await Promise.all(T.map(async (N) => ({ path: N.path, result: await V(N.path) }))), c || u.signal.aborted)) return;
|
|
208
|
+
h = ((j = w.find((N) => N.result.runtimeDependencies)) == null ? void 0 : j.result.runtimeDependencies) ?? h, T = w.filter((N) => N.result.status === "preparing");
|
|
209
209
|
}
|
|
210
210
|
for (o == null || o({ status: "ready", ...h ? { runtimeDependencies: h } : {} }); (h == null ? void 0 : h.state) === "preparing"; ) {
|
|
211
|
-
if (await
|
|
211
|
+
if (await An(u.signal), c || u.signal.aborted) return;
|
|
212
212
|
const p = await V("/api/v1/ready-status");
|
|
213
213
|
if (c || u.signal.aborted) return;
|
|
214
214
|
h = p.runtimeDependencies, h && (o == null || o({ status: "ready", runtimeDependencies: h }));
|
|
@@ -234,7 +234,7 @@ function Be(e, n, r) {
|
|
|
234
234
|
const i = n ? e.indexOf(n) : -1, s = i >= 0 ? i + 1 : e.length;
|
|
235
235
|
return [...e.slice(0, s), r, ...e.slice(s)];
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function Rn(e, n, r) {
|
|
238
238
|
if (e.includes(r)) return e;
|
|
239
239
|
if (e.length === 0) return [r];
|
|
240
240
|
const i = n ? e.indexOf(n) : -1, s = i >= 0 ? i : 0;
|
|
@@ -244,9 +244,9 @@ function di(e, n) {
|
|
|
244
244
|
return e.endsWith(":surface") ? e.slice(0, -8) : n;
|
|
245
245
|
}
|
|
246
246
|
function pt(e, n, r) {
|
|
247
|
-
const [i, s] = x(() =>
|
|
247
|
+
const [i, s] = x(() => Pn(e, n, r));
|
|
248
248
|
A(() => {
|
|
249
|
-
s(
|
|
249
|
+
s(Pn(e, n, r));
|
|
250
250
|
}, [e, n, r]);
|
|
251
251
|
const o = E(
|
|
252
252
|
(c) => {
|
|
@@ -256,7 +256,7 @@ function pt(e, n, r) {
|
|
|
256
256
|
);
|
|
257
257
|
return [i, o];
|
|
258
258
|
}
|
|
259
|
-
const ht = {}, fi = [],
|
|
259
|
+
const ht = {}, fi = [], wn = { status: "preparing" }, Tn = {
|
|
260
260
|
openTabs: [],
|
|
261
261
|
activeTab: null
|
|
262
262
|
};
|
|
@@ -300,7 +300,7 @@ function vi(e) {
|
|
|
300
300
|
return null;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function Nn(e, n) {
|
|
304
304
|
var r;
|
|
305
305
|
try {
|
|
306
306
|
const i = (r = globalThis.localStorage) == null ? void 0 : r.getItem(e);
|
|
@@ -313,7 +313,7 @@ function wn(e, n) {
|
|
|
313
313
|
return null;
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function bi(e, n) {
|
|
317
317
|
var r, i;
|
|
318
318
|
try {
|
|
319
319
|
if (n.ids.length === 0) {
|
|
@@ -327,7 +327,7 @@ function Si(e, n) {
|
|
|
327
327
|
} catch {
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function Dn(e, n) {
|
|
331
331
|
var r;
|
|
332
332
|
try {
|
|
333
333
|
const i = (r = globalThis.localStorage) == null ? void 0 : r.getItem(e);
|
|
@@ -338,7 +338,7 @@ function Nn(e, n) {
|
|
|
338
338
|
return null;
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Si(e, n) {
|
|
342
342
|
var r, i;
|
|
343
343
|
try {
|
|
344
344
|
if (n.length === 0) {
|
|
@@ -377,13 +377,13 @@ function Ri({
|
|
|
377
377
|
surfaceReady: s,
|
|
378
378
|
snapshot: o
|
|
379
379
|
}) {
|
|
380
|
-
const c =
|
|
380
|
+
const c = Fn(), u = H(null);
|
|
381
381
|
return A(() => {
|
|
382
|
-
var
|
|
382
|
+
var S;
|
|
383
383
|
if (e === null || i && !s) return;
|
|
384
|
-
(
|
|
385
|
-
const
|
|
386
|
-
u.current =
|
|
384
|
+
(S = u.current) == null || S.abort();
|
|
385
|
+
const b = new AbortController();
|
|
386
|
+
u.current = b;
|
|
387
387
|
const y = {
|
|
388
388
|
v: 1,
|
|
389
389
|
drawerOpen: r,
|
|
@@ -397,10 +397,10 @@ function Ri({
|
|
|
397
397
|
method: "PUT",
|
|
398
398
|
headers: { ...n, "Content-Type": "application/json" },
|
|
399
399
|
body: JSON.stringify({ state: y, causedBy: "user" }),
|
|
400
|
-
signal:
|
|
400
|
+
signal: b.signal
|
|
401
401
|
}).catch(() => {
|
|
402
402
|
}), () => {
|
|
403
|
-
|
|
403
|
+
b.abort();
|
|
404
404
|
};
|
|
405
405
|
}, [e, r, c, n, o, i, s]), null;
|
|
406
406
|
}
|
|
@@ -413,22 +413,22 @@ function zi({
|
|
|
413
413
|
providerStorageKey: o,
|
|
414
414
|
surfaceStorageKey: c,
|
|
415
415
|
beforeShell: u,
|
|
416
|
-
afterShell:
|
|
416
|
+
afterShell: b,
|
|
417
417
|
panels: y,
|
|
418
|
-
commands:
|
|
418
|
+
commands: S,
|
|
419
419
|
catalogs: j,
|
|
420
420
|
plugins: W,
|
|
421
421
|
excludeDefaults: V,
|
|
422
|
-
capabilities:
|
|
422
|
+
capabilities: w,
|
|
423
423
|
apiBaseUrl: h,
|
|
424
|
-
authHeaders:
|
|
424
|
+
authHeaders: T,
|
|
425
425
|
apiTimeout: p,
|
|
426
426
|
defaultTheme: N,
|
|
427
|
-
onThemeChange:
|
|
427
|
+
onThemeChange: Cn,
|
|
428
428
|
persistenceEnabled: yt,
|
|
429
|
-
debug:
|
|
429
|
+
debug: Wn,
|
|
430
430
|
bridgeEndpoint: Ye,
|
|
431
|
-
fullPageBasePath:
|
|
431
|
+
fullPageBasePath: In,
|
|
432
432
|
onAuthError: Gn,
|
|
433
433
|
sessions: Pt,
|
|
434
434
|
activeSessionId: Et,
|
|
@@ -436,7 +436,7 @@ function zi({
|
|
|
436
436
|
onCreateSession: Xe,
|
|
437
437
|
onDeleteSession: Rt,
|
|
438
438
|
onActiveSessionIdChange: Ee,
|
|
439
|
-
appTitle:
|
|
439
|
+
appTitle: wt = "Boring UI",
|
|
440
440
|
workspaceLabel: $n,
|
|
441
441
|
defaultSessionTitle: k = "New session",
|
|
442
442
|
navEnabled: Tt = !0,
|
|
@@ -444,7 +444,7 @@ function zi({
|
|
|
444
444
|
defaultSurfaceOpen: Kn,
|
|
445
445
|
defaultWorkbenchLeftTab: Ae,
|
|
446
446
|
defaultWorkbenchLeftOpen: Qe,
|
|
447
|
-
surfaceInitialPanels:
|
|
447
|
+
surfaceInitialPanels: Nt,
|
|
448
448
|
topBarLeft: Hn,
|
|
449
449
|
topBarRight: Jn,
|
|
450
450
|
showThemeToggle: jn = !0,
|
|
@@ -452,8 +452,8 @@ function zi({
|
|
|
452
452
|
externalPlugins: qn,
|
|
453
453
|
hotReloadEnabled: Bn,
|
|
454
454
|
frontPluginHotReload: zn,
|
|
455
|
-
extraPanels:
|
|
456
|
-
extraCommands:
|
|
455
|
+
extraPanels: Dt,
|
|
456
|
+
extraCommands: _t,
|
|
457
457
|
provisionWorkspace: Ze,
|
|
458
458
|
bootPreloadPaths: Vn,
|
|
459
459
|
onWorkspaceWarmupStatusChange: Re,
|
|
@@ -462,64 +462,64 @@ function zi({
|
|
|
462
462
|
surfaceButtonBottomOffset: kn,
|
|
463
463
|
className: Yn
|
|
464
464
|
}) {
|
|
465
|
-
var
|
|
466
|
-
const
|
|
467
|
-
|
|
465
|
+
var fn, gn;
|
|
466
|
+
const Lt = qn !== !1, Xn = Lt ? zn : !1, nt = Lt ? Bn : !1, rt = o ?? `boring-ui-v2:layout:${e}`, I = c ?? `${rt}:surface`, we = di(
|
|
467
|
+
I,
|
|
468
468
|
rt
|
|
469
|
-
), F = yt !== !1,
|
|
469
|
+
), F = yt !== !1, Te = s ?? `boring-workspace:sessions:${e}`, Y = O(
|
|
470
470
|
() => Ve(e, i ?? ht),
|
|
471
471
|
[i, e]
|
|
472
472
|
), Qn = O(
|
|
473
|
-
() => Ve(e, { ...i ?? ht, ...
|
|
474
|
-
[
|
|
473
|
+
() => Ve(e, { ...i ?? ht, ...T ?? ht }),
|
|
474
|
+
[T, i, e]
|
|
475
475
|
), Ne = O(
|
|
476
|
-
() => ti({ storageKey:
|
|
477
|
-
[
|
|
478
|
-
),
|
|
476
|
+
() => ti({ storageKey: Te }),
|
|
477
|
+
[Te]
|
|
478
|
+
), Ot = ni(Ne), [xt, Zn] = x(() => ({
|
|
479
479
|
workspaceId: e,
|
|
480
|
-
status:
|
|
480
|
+
status: wn
|
|
481
481
|
})), [De, it] = x(() => ({
|
|
482
482
|
workspaceId: e,
|
|
483
483
|
expired: !1
|
|
484
|
-
})), [
|
|
484
|
+
})), [Mt, _e] = x(() => ({
|
|
485
485
|
workspaceId: e,
|
|
486
486
|
creating: !1
|
|
487
|
-
})), [
|
|
487
|
+
})), [Ft, Le] = x(() => ({
|
|
488
488
|
workspaceId: e,
|
|
489
489
|
failed: !1
|
|
490
|
-
})), [st,
|
|
491
|
-
() => (F ?
|
|
492
|
-
), [ie,
|
|
490
|
+
})), [st, Ct] = x(null), fe = `boring-workspace:chat-panes:${e}`, [D, B] = x(
|
|
491
|
+
() => (F ? Nn(fe, e) : null) ?? { workspaceId: e, ids: [], activeId: null }
|
|
492
|
+
), [ie, Wt] = x(null);
|
|
493
493
|
A(() => {
|
|
494
494
|
if (!ie) return;
|
|
495
|
-
const t = setTimeout(() =>
|
|
495
|
+
const t = setTimeout(() => Wt(null), 700);
|
|
496
496
|
return () => clearTimeout(t);
|
|
497
497
|
}, [ie]);
|
|
498
|
-
const ge = `boring-workspace:pinned-sessions:${e}`, [
|
|
499
|
-
() => (F ?
|
|
500
|
-
), er =
|
|
498
|
+
const ge = `boring-workspace:pinned-sessions:${e}`, [It, Gt] = x(
|
|
499
|
+
() => (F ? Dn(ge, e) : null) ?? { workspaceId: e, ids: [] }
|
|
500
|
+
), er = It.workspaceId === e ? It.ids : fi;
|
|
501
501
|
A(() => {
|
|
502
|
-
Gt((t) => t.workspaceId === e ? t : (F ?
|
|
502
|
+
Gt((t) => t.workspaceId === e ? t : (F ? Dn(ge, e) : null) ?? { workspaceId: e, ids: [] });
|
|
503
503
|
}, [ge, F, e]);
|
|
504
504
|
const tr = E((t) => {
|
|
505
505
|
Gt((a) => {
|
|
506
506
|
const l = a.workspaceId === e ? a.ids : [], g = l.includes(t) ? l.filter((v) => v !== t) : [t, ...l];
|
|
507
|
-
return F &&
|
|
507
|
+
return F && Si(ge, g), { workspaceId: e, ids: g };
|
|
508
508
|
});
|
|
509
509
|
}, [ge, F, e]);
|
|
510
510
|
A(() => {
|
|
511
|
-
F && D.workspaceId === e &&
|
|
511
|
+
F && D.workspaceId === e && bi(fe, D);
|
|
512
512
|
}, [D, fe, F, e]), A(() => {
|
|
513
|
-
B((t) => t.workspaceId === e ? t : (F ?
|
|
513
|
+
B((t) => t.workspaceId === e ? t : (F ? Nn(fe, e) : null) ?? { workspaceId: e, ids: [], activeId: null });
|
|
514
514
|
}, [fe, F, e]);
|
|
515
|
-
const Oe =
|
|
515
|
+
const Oe = xt.workspaceId === e ? xt.status : wn, nr = n ?? Fr, rr = r ?? mi, X = !n || !!r, xe = X && Ze !== !1, ot = () => {
|
|
516
516
|
}, _ = rr({
|
|
517
517
|
requestHeaders: Y,
|
|
518
|
-
storageKey:
|
|
518
|
+
storageKey: Te,
|
|
519
519
|
workspaceId: e,
|
|
520
520
|
apiBaseUrl: h,
|
|
521
521
|
enabled: xe
|
|
522
|
-
}), [me, ir] = x(() => ({ workspaceId: e, sessions: [], activeSessionId: null })),
|
|
522
|
+
}), [me, ir] = x(() => ({ workspaceId: e, sessions: [], activeSessionId: null })), $t = xe && _.workspaceId != null && _.workspaceId !== e, z = xe && !_.loading && !_.error && !$t, C = xe && !z;
|
|
523
523
|
A(() => {
|
|
524
524
|
z && ir((t) => {
|
|
525
525
|
const a = t.workspaceId === e, l = t.activeSessionId === _.activeSessionId, g = t.sessions.length === _.sessions.length && t.sessions.every((v, R) => {
|
|
@@ -533,7 +533,7 @@ function zi({
|
|
|
533
533
|
};
|
|
534
534
|
});
|
|
535
535
|
}, [_.activeSessionId, _.sessions, z, e]);
|
|
536
|
-
const Me = C && me.workspaceId === e && me.sessions.length > 0, Fe = C ? vi(
|
|
536
|
+
const Me = C && me.workspaceId === e && me.sessions.length > 0, Fe = C ? vi(Te) : null, Ut = C && !$t ? _.activeSessionId ?? null : null, Q = z ? _.sessions : Me ? me.sessions : [], sr = z ? _.activeSessionId : Me ? me.activeSessionId : null, f = X && (z || Me) ? _ : void 0, se = Pt !== void 0 || Et !== void 0 || At !== void 0 || Xe !== void 0 || Rt !== void 0, Kt = De.workspaceId === e && De.expired, pe = H(!1), he = !!(z && f && !se && Q.length === 0 && !Kt), or = Mt.workspaceId === e && Mt.creating, ar = Ft.workspaceId === e && Ft.failed, lr = !!(z && f && !se && Q.length === 0 && Kt && !pe.current && !ar), Ce = !!(C && _.loading && !_.error && X && !se && !Me && !Fe && !Ut) || he || or || lr;
|
|
537
537
|
A(() => {
|
|
538
538
|
if (!he) {
|
|
539
539
|
De.workspaceId !== e && it({ workspaceId: e, expired: !1 });
|
|
@@ -554,10 +554,10 @@ function zi({
|
|
|
554
554
|
createdAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
555
555
|
updatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
556
556
|
turnCount: 0
|
|
557
|
-
}] : [], $ = f ? cr ?? [] : C ? ur : se ? Pt ?? [] :
|
|
557
|
+
}] : [], $ = f ? cr ?? [] : C ? ur : se ? Pt ?? [] : Ot.sessions, dr = f ? sr ?? null : C ? Fe ?? Ut : se ? Et ?? null : Ot.activeId, oe = (L == null ? void 0 : L.autoSubmitInitialDraft) === !0, We = oe && X && !se, [U, ve] = x(() => We ? null : void 0), Ht = H(e), ae = H(!1);
|
|
558
558
|
A(() => {
|
|
559
|
-
if (
|
|
560
|
-
|
|
559
|
+
if (Ht.current !== e) {
|
|
560
|
+
Ht.current = e, ae.current = !1, ve(We ? null : void 0);
|
|
561
561
|
return;
|
|
562
562
|
}
|
|
563
563
|
We && U === void 0 && (ae.current = !1, ve(null));
|
|
@@ -570,78 +570,78 @@ function zi({
|
|
|
570
570
|
ae.current = !1, ve(void 0);
|
|
571
571
|
}));
|
|
572
572
|
}, [U, k, f]);
|
|
573
|
-
const
|
|
574
|
-
`${
|
|
573
|
+
const G = U !== void 0 ? U ?? null : dr, J = C ? ot : (f == null ? void 0 : f.switch) ?? At ?? Ne.switchTo, Ie = E((t) => (G && t !== G && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: G } })), J(t)), [G, J]), at = C ? ot : f ? () => f.create() : Xe ? () => Xe() : () => Ne.create(), Jt = C ? ot : (f == null ? void 0 : f.delete) ?? Rt ?? Ne.remove, jt = E((t) => (f && Q.length <= 1 && (pe.current = !0), Jt(t)), [Q.length, Jt, f]), fr = ((fn = $.find((t) => t.id === G)) == null ? void 0 : fn.title) ?? void 0, [gr, qt] = pt(
|
|
574
|
+
`${we}:drawer`,
|
|
575
575
|
Un,
|
|
576
576
|
F
|
|
577
|
-
),
|
|
577
|
+
), Bt = Tt && gr, [Z, q] = pt(
|
|
578
578
|
// Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
|
|
579
579
|
// layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
|
|
580
580
|
// key corrupts the JSON and drops the persisted workbench layout on reload.
|
|
581
|
-
`${
|
|
581
|
+
`${we}:workbenchOpen`,
|
|
582
582
|
Kn ?? !1,
|
|
583
583
|
F
|
|
584
|
-
), [mr, lt] = x(!1), [pr,
|
|
585
|
-
`${
|
|
584
|
+
), [mr, lt] = x(!1), [pr, be] = pt(
|
|
585
|
+
`${we}:workbenchLeftOpen`,
|
|
586
586
|
Qe ?? !1,
|
|
587
587
|
F
|
|
588
|
-
), [hr,
|
|
589
|
-
|
|
590
|
-
const [
|
|
591
|
-
key:
|
|
588
|
+
), [hr, Ge] = x(() => Qe ?? !1), vr = Qe === !1 ? hr : pr, Se = H(!1), ee = H(null), te = H(Z), zt = H(I), ct = H(null), ut = H([]);
|
|
589
|
+
zt.current = I;
|
|
590
|
+
const [Vt, kt] = x(() => ({
|
|
591
|
+
key: I,
|
|
592
592
|
snapshot: Tn
|
|
593
|
-
})),
|
|
593
|
+
})), br = Vt.key === I ? Vt.snapshot : Tn;
|
|
594
594
|
A(() => {
|
|
595
|
-
|
|
595
|
+
Se.current = !1, pe.current = !1, _e({ workspaceId: e, creating: !1 }), Le({ workspaceId: e, failed: !1 }), Ct(null);
|
|
596
596
|
}, [e]), A(() => {
|
|
597
597
|
lt(!1), ut.current = [];
|
|
598
|
-
}, [
|
|
598
|
+
}, [I]), A(() => {
|
|
599
599
|
if (!(!f || f.loading) && !he && U === void 0) {
|
|
600
600
|
if (Q.length > 0) {
|
|
601
|
-
|
|
601
|
+
Se.current = !1, pe.current = !1, _e((t) => t.workspaceId === e && t.creating ? { workspaceId: e, creating: !1 } : t), Le((t) => t.workspaceId === e && t.failed ? { workspaceId: e, failed: !1 } : t);
|
|
602
602
|
return;
|
|
603
603
|
}
|
|
604
|
-
pe.current ||
|
|
604
|
+
pe.current || Se.current || (Se.current = !0, _e({ workspaceId: e, creating: !0 }), Le({ workspaceId: e, failed: !1 }), Promise.resolve(f.create({ title: k })).then((t) => {
|
|
605
605
|
const a = t == null ? void 0 : t.id;
|
|
606
|
-
typeof a == "string" &&
|
|
606
|
+
typeof a == "string" && Ct({ workspaceId: e, id: a });
|
|
607
607
|
}).catch(() => {
|
|
608
|
-
|
|
608
|
+
Se.current = !1, _e({ workspaceId: e, creating: !1 }), Le({ workspaceId: e, failed: !0 });
|
|
609
609
|
}));
|
|
610
610
|
}
|
|
611
611
|
}, [Q.length, U, k, he, f, e]), A(() => {
|
|
612
612
|
te.current = Z;
|
|
613
613
|
}, [Z]);
|
|
614
|
-
const
|
|
615
|
-
ct.current = { key:
|
|
616
|
-
key:
|
|
614
|
+
const Yt = E((t) => {
|
|
615
|
+
ct.current = { key: I, api: t }, lt(!0), kt({
|
|
616
|
+
key: I,
|
|
617
617
|
snapshot: t.getSnapshot()
|
|
618
618
|
});
|
|
619
619
|
const a = ut.current.splice(0);
|
|
620
620
|
for (const l of a) l(t);
|
|
621
|
-
}, [
|
|
621
|
+
}, [I]), Xt = E((t) => {
|
|
622
622
|
ut.current.push(t);
|
|
623
|
-
}, []),
|
|
624
|
-
|
|
625
|
-
key:
|
|
623
|
+
}, []), Qt = E((t) => {
|
|
624
|
+
kt({
|
|
625
|
+
key: I,
|
|
626
626
|
snapshot: t
|
|
627
627
|
});
|
|
628
|
-
}, [
|
|
628
|
+
}, [I]), $e = E(() => {
|
|
629
629
|
const t = ct.current;
|
|
630
|
-
return (t == null ? void 0 : t.key) ===
|
|
631
|
-
}, []),
|
|
630
|
+
return (t == null ? void 0 : t.key) === zt.current ? t.api : null;
|
|
631
|
+
}, []), Zt = E(() => te.current, []), en = E(() => {
|
|
632
632
|
te.current = !0, q(!0);
|
|
633
|
-
}, [q]),
|
|
634
|
-
te.current = !0, q(!0),
|
|
635
|
-
}, [q,
|
|
633
|
+
}, [q]), tn = E(() => {
|
|
634
|
+
te.current = !0, q(!0), be(!0), Ge(!0);
|
|
635
|
+
}, [q, be]), Ue = E(() => {
|
|
636
636
|
te.current = !1, ct.current = null, lt(!1), q(!1);
|
|
637
637
|
}, [q]), le = O(() => ({
|
|
638
638
|
surface: $e,
|
|
639
|
-
isWorkbenchOpen:
|
|
640
|
-
openWorkbench:
|
|
641
|
-
openWorkbenchSources:
|
|
639
|
+
isWorkbenchOpen: Zt,
|
|
640
|
+
openWorkbench: en,
|
|
641
|
+
openWorkbenchSources: tn,
|
|
642
642
|
closeWorkbench: Ue,
|
|
643
|
-
enqueue:
|
|
644
|
-
}), [$e,
|
|
643
|
+
enqueue: Xt
|
|
644
|
+
}), [$e, Zt, en, tn, Ue, Xt]), Sr = O(() => ({
|
|
645
645
|
openFile: async (t) => (Sn({ kind: "openFile", params: { path: t } }, le), { seq: 0, status: "ok" }),
|
|
646
646
|
getActiveFile: () => {
|
|
647
647
|
var t;
|
|
@@ -650,55 +650,55 @@ function zi({
|
|
|
650
650
|
select: () => () => {
|
|
651
651
|
}
|
|
652
652
|
}), [$e, le]), ce = O(
|
|
653
|
-
() => (W == null ? void 0 : W.map(
|
|
653
|
+
() => (W == null ? void 0 : W.map(Gr)) ?? [],
|
|
654
654
|
[W]
|
|
655
655
|
), dt = O(
|
|
656
656
|
() => ce.some((t) => t.registrations.leftTabs.length > 0),
|
|
657
657
|
[ce]
|
|
658
|
-
),
|
|
658
|
+
), nn = O(
|
|
659
659
|
() => ce.flatMap((t) => t.registrations.panels.map((a) => a.id)),
|
|
660
660
|
[ce]
|
|
661
|
-
),
|
|
661
|
+
), rn = O(() => {
|
|
662
662
|
const t = {};
|
|
663
663
|
for (const a of ce)
|
|
664
664
|
for (const l of a.registrations.toolRenderers)
|
|
665
665
|
t[l.id] = l.render;
|
|
666
666
|
return t;
|
|
667
|
-
}, [ce]),
|
|
668
|
-
() => [...
|
|
669
|
-
[
|
|
670
|
-
), m = X && !r && me.workspaceId !== e ? "default" :
|
|
667
|
+
}, [ce]), sn = O(
|
|
668
|
+
() => [...Dt ?? [], ...nn],
|
|
669
|
+
[Dt, nn]
|
|
670
|
+
), m = X && !r && me.workspaceId !== e ? "default" : G ?? (U !== void 0 ? "default" : ((gn = $[0]) == null ? void 0 : gn.id) ?? "default"), on = !(f != null && f.hasMore) && !C;
|
|
671
671
|
A(() => {
|
|
672
|
-
var ne,
|
|
672
|
+
var ne, mn;
|
|
673
673
|
if (Ce) return;
|
|
674
674
|
const t = ee.current, a = new Set($.map((K) => K.id)), l = t ? t.createdId ?? (a.has(m) && !t.knownIds.has(m) ? m : ((ne = $.find((K) => !t.knownIds.has(K.id))) == null ? void 0 : ne.id) ?? null) : null;
|
|
675
675
|
l && a.has(l) && (ee.current = null);
|
|
676
|
-
const g = m === "default" && U !== void 0, v =
|
|
676
|
+
const g = m === "default" && U !== void 0, v = on && a.size > 0 && !g, R = l ?? (v && !a.has(m) ? ((mn = $[0]) == null ? void 0 : mn.id) ?? m : m);
|
|
677
677
|
B((K) => {
|
|
678
678
|
const re = K.workspaceId === e ? K : { workspaceId: e, ids: [], activeId: null };
|
|
679
679
|
if (C && re.ids.length > 0 && !l) return re;
|
|
680
|
-
const
|
|
681
|
-
return K.workspaceId === e && K.activeId ===
|
|
680
|
+
const pn = re.ids.length > 0 ? re.ids : [R], hn = v ? pn.filter((qe) => a.has(qe) || qe === l) : pn, ue = hn.length > 0 ? hn : [R], vn = re.activeId && ue.includes(re.activeId) ? re.activeId : ue[0] ?? R, ye = l ? Be(ue, t == null ? void 0 : t.afterId, l) : R === vn || ue.includes(R) ? ue : Rn(ue, vn, R), bn = ye.includes(R) ? R : ye[0] ?? R;
|
|
681
|
+
return K.workspaceId === e && K.activeId === bn && K.ids.length === ye.length && K.ids.every((qe, Or) => qe === ye[Or]) ? K : { workspaceId: e, ids: ye, activeId: bn };
|
|
682
682
|
});
|
|
683
|
-
}, [U, m, C, Ce, $,
|
|
684
|
-
const
|
|
683
|
+
}, [U, m, C, Ce, $, on, e]);
|
|
684
|
+
const an = O(() => {
|
|
685
685
|
const t = /* @__PURE__ */ new Map();
|
|
686
686
|
for (const a of $) t.set(a.id, a.title);
|
|
687
687
|
return t;
|
|
688
688
|
}, [$]), ft = D.workspaceId === e ? D : { ids: [], activeId: null }, Ke = ft.ids.length > 0 ? ft.ids : [m], He = ft.activeId ?? Ke[0] ?? m, yr = E((t) => {
|
|
689
689
|
const l = (D.workspaceId === e ? D : { ids: [m] }).ids.includes(t);
|
|
690
690
|
return B((g) => {
|
|
691
|
-
const v = g.workspaceId === e ? g : { ids: [m], activeId: m }, R = v.ids.includes(t) ? v.ids :
|
|
691
|
+
const v = g.workspaceId === e ? g : { ids: [m], activeId: m }, R = v.ids.includes(t) ? v.ids : Rn(v.ids, v.activeId, t);
|
|
692
692
|
return { workspaceId: e, ids: R, activeId: t };
|
|
693
|
-
}), l ? J(t) :
|
|
694
|
-
}, [D, m, J,
|
|
693
|
+
}), l ? J(t) : Ie(t);
|
|
694
|
+
}, [D, m, J, Ie, e]), Pr = E((t) => (B((a) => {
|
|
695
695
|
const l = a.workspaceId === e ? a : { ids: [m], activeId: m };
|
|
696
696
|
return {
|
|
697
697
|
workspaceId: e,
|
|
698
698
|
ids: l.ids.includes(t) ? l.ids : Be(l.ids, l.activeId, t),
|
|
699
699
|
activeId: t
|
|
700
700
|
};
|
|
701
|
-
}), J(t)), [m, J, e]),
|
|
701
|
+
}), J(t)), [m, J, e]), ln = E((t) => ((D.workspaceId === e ? D : { ids: [m] }).ids.includes(t) && Wt({ workspaceId: e, id: t }), B((l) => {
|
|
702
702
|
const g = l.workspaceId === e ? l : { ids: [m], activeId: m };
|
|
703
703
|
return {
|
|
704
704
|
workspaceId: e,
|
|
@@ -737,18 +737,18 @@ function zi({
|
|
|
737
737
|
let g = a.activeId;
|
|
738
738
|
if (l >= 0) {
|
|
739
739
|
const v = a.ids.filter((R) => R !== t);
|
|
740
|
-
g = a.activeId === t ? v[Math.max(0, l - 1)] ?? v[0] ?? null : a.activeId, B({ workspaceId: e, ids: v, activeId: g }), g && a.activeId === t &&
|
|
740
|
+
g = a.activeId === t ? v[Math.max(0, l - 1)] ?? v[0] ?? null : a.activeId, B({ workspaceId: e, ids: v, activeId: g }), g && a.activeId === t && Ie(g);
|
|
741
741
|
}
|
|
742
|
-
return
|
|
743
|
-
}, [D, m,
|
|
742
|
+
return jt(t);
|
|
743
|
+
}, [D, m, jt, Ie, e]), [wr, gt] = x(oe), cn = H(e);
|
|
744
744
|
A(() => {
|
|
745
|
-
if (
|
|
746
|
-
|
|
745
|
+
if (cn.current !== e) {
|
|
746
|
+
cn.current = e, gt(oe);
|
|
747
747
|
return;
|
|
748
748
|
}
|
|
749
749
|
oe && gt(!0);
|
|
750
750
|
}, [oe, e]);
|
|
751
|
-
const
|
|
751
|
+
const un = oe && X && !G, dn = !!!(st && st.workspaceId === e && st.id === G) && !wr && Ze !== !1 && (X ? !!G : !0), Tr = E((t) => {
|
|
752
752
|
Zn({ workspaceId: e, status: t }), Re == null || Re(t);
|
|
753
753
|
}, [Re, e]);
|
|
754
754
|
A(() => {
|
|
@@ -757,13 +757,13 @@ function zi({
|
|
|
757
757
|
const g = l.detail;
|
|
758
758
|
!g || typeof g != "object" || Sn(g, le);
|
|
759
759
|
};
|
|
760
|
-
return (a = globalThis.addEventListener) == null || a.call(globalThis,
|
|
760
|
+
return (a = globalThis.addEventListener) == null || a.call(globalThis, yn, t), () => {
|
|
761
761
|
var l;
|
|
762
|
-
return (l = globalThis.removeEventListener) == null ? void 0 : l.call(globalThis,
|
|
762
|
+
return (l = globalThis.removeEventListener) == null ? void 0 : l.call(globalThis, yn, t);
|
|
763
763
|
};
|
|
764
764
|
}, [le]), A(() => {
|
|
765
|
-
C || Ee == null || Ee(
|
|
766
|
-
}, [
|
|
765
|
+
C || Ee == null || Ee(G ?? null);
|
|
766
|
+
}, [G, Ee, C]);
|
|
767
767
|
const mt = Oe.status !== "ready", Nr = mt ? /* @__PURE__ */ d(gi, { status: Oe }) : void 0, Je = E(async (t) => {
|
|
768
768
|
const a = `${(h == null ? void 0 : h.replace(/\/$/, "")) ?? ""}/api/v1/agent/reload`;
|
|
769
769
|
try {
|
|
@@ -784,7 +784,7 @@ function zi({
|
|
|
784
784
|
const l = a.bridgeEnabled ?? !0, g = L != null && L.toolRenderers && typeof L.toolRenderers == "object" ? L.toolRenderers : void 0;
|
|
785
785
|
return {
|
|
786
786
|
...L,
|
|
787
|
-
...
|
|
787
|
+
...un ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
|
|
788
788
|
sessionId: t,
|
|
789
789
|
apiBaseUrl: h,
|
|
790
790
|
workspaceId: e,
|
|
@@ -792,12 +792,12 @@ function zi({
|
|
|
792
792
|
requestHeaders: Y,
|
|
793
793
|
showSessions: !1,
|
|
794
794
|
onReloadAgentPlugins: (L == null ? void 0 : L.onReloadAgentPlugins) ?? (() => Je(t)),
|
|
795
|
-
toolRenderers: { ...
|
|
795
|
+
toolRenderers: { ...rn, ...g ?? {} },
|
|
796
796
|
bridgeEndpoint: l ? Ye : null,
|
|
797
797
|
surfaceDispatch: le,
|
|
798
|
-
extraCommands:
|
|
798
|
+
extraCommands: _t,
|
|
799
799
|
workspaceWarmupStatus: Oe,
|
|
800
|
-
hydrateMessages:
|
|
800
|
+
hydrateMessages: dn,
|
|
801
801
|
onAutoSubmitInitialDraftSettled: () => {
|
|
802
802
|
ae.current = !1, gt(!1), ve(void 0);
|
|
803
803
|
const v = L == null ? void 0 : L.onAutoSubmitInitialDraftSettled;
|
|
@@ -809,35 +809,35 @@ function zi({
|
|
|
809
809
|
...nt !== void 0 ? { hotReloadEnabled: nt } : {}
|
|
810
810
|
};
|
|
811
811
|
},
|
|
812
|
-
[h, L,
|
|
812
|
+
[h, L, un, Y, Ye, le, _t, Oe, dn, nt, rn, Je, e]
|
|
813
813
|
), Dr = O(
|
|
814
814
|
() => je(m),
|
|
815
815
|
[m, je]
|
|
816
816
|
), _r = O(() => Ke.map((t) => ({
|
|
817
817
|
id: t,
|
|
818
|
-
title:
|
|
818
|
+
title: an.get(t) ?? (t === "default" ? k : t),
|
|
819
819
|
panel: "chat",
|
|
820
820
|
params: je(t, { bridgeEnabled: t === He })
|
|
821
|
-
})), [He, Ke, k, je,
|
|
822
|
-
storageKey:
|
|
821
|
+
})), [He, Ke, k, je, an]), Lr = O(() => ({
|
|
822
|
+
storageKey: I,
|
|
823
823
|
defaultLeftTab: Ae,
|
|
824
|
-
initialPanels:
|
|
825
|
-
extraPanels:
|
|
826
|
-
onReloadAgentPlugins: () => Je(
|
|
827
|
-
onReady:
|
|
828
|
-
onChange:
|
|
824
|
+
initialPanels: Nt,
|
|
825
|
+
extraPanels: sn,
|
|
826
|
+
onReloadAgentPlugins: () => Je(G ?? m),
|
|
827
|
+
onReady: Yt,
|
|
828
|
+
onChange: Qt,
|
|
829
829
|
onClose: Ue
|
|
830
830
|
}), [
|
|
831
831
|
Ue,
|
|
832
832
|
Ae,
|
|
833
|
-
|
|
833
|
+
Nt,
|
|
834
834
|
Je,
|
|
835
|
-
I,
|
|
836
|
-
m,
|
|
837
|
-
Xt,
|
|
838
|
-
kt,
|
|
839
835
|
G,
|
|
840
|
-
|
|
836
|
+
m,
|
|
837
|
+
Qt,
|
|
838
|
+
Yt,
|
|
839
|
+
I,
|
|
840
|
+
sn,
|
|
841
841
|
q
|
|
842
842
|
]);
|
|
843
843
|
return /* @__PURE__ */ d("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ Pe(
|
|
@@ -845,25 +845,26 @@ function zi({
|
|
|
845
845
|
{
|
|
846
846
|
chatPanel: nr,
|
|
847
847
|
panels: y,
|
|
848
|
-
commands:
|
|
848
|
+
commands: S,
|
|
849
849
|
catalogs: j,
|
|
850
850
|
plugins: W,
|
|
851
851
|
excludeDefaults: V,
|
|
852
|
-
capabilities:
|
|
852
|
+
capabilities: w,
|
|
853
853
|
apiBaseUrl: h,
|
|
854
854
|
authHeaders: Qn,
|
|
855
855
|
apiTimeout: p,
|
|
856
856
|
defaultTheme: N,
|
|
857
|
-
onThemeChange:
|
|
857
|
+
onThemeChange: Cn,
|
|
858
858
|
workspaceId: e,
|
|
859
859
|
workspaceLabel: $n,
|
|
860
|
+
appTitle: wt,
|
|
860
861
|
storageKey: rt,
|
|
861
862
|
persistenceEnabled: yt,
|
|
862
|
-
debug:
|
|
863
|
+
debug: Wn,
|
|
863
864
|
bridgeEndpoint: null,
|
|
864
865
|
onAuthError: Gn,
|
|
865
866
|
frontPluginHotReload: Xn,
|
|
866
|
-
fullPageBasePath:
|
|
867
|
+
fullPageBasePath: In,
|
|
867
868
|
children: [
|
|
868
869
|
u,
|
|
869
870
|
/* @__PURE__ */ d(
|
|
@@ -874,7 +875,7 @@ function zi({
|
|
|
874
875
|
apiBaseUrl: h,
|
|
875
876
|
preloadPaths: Vn,
|
|
876
877
|
provisionWorkspace: Ze,
|
|
877
|
-
onStatusChange:
|
|
878
|
+
onStatusChange: Tr
|
|
878
879
|
}
|
|
879
880
|
),
|
|
880
881
|
/* @__PURE__ */ d(
|
|
@@ -882,17 +883,17 @@ function zi({
|
|
|
882
883
|
{
|
|
883
884
|
bridgeEndpoint: Ye,
|
|
884
885
|
requestHeaders: Y,
|
|
885
|
-
navOpen:
|
|
886
|
+
navOpen: Bt,
|
|
886
887
|
surfaceOpen: Z,
|
|
887
888
|
surfaceReady: mr,
|
|
888
|
-
snapshot:
|
|
889
|
+
snapshot: br
|
|
889
890
|
}
|
|
890
891
|
),
|
|
891
892
|
/* @__PURE__ */ Pe("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
892
893
|
/* @__PURE__ */ d(
|
|
893
894
|
jr,
|
|
894
895
|
{
|
|
895
|
-
appTitle:
|
|
896
|
+
appTitle: wt,
|
|
896
897
|
sessionTitle: Ce ? "Loading sessions…" : fr ?? k,
|
|
897
898
|
onCommandPalette: () => {
|
|
898
899
|
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
@@ -914,7 +915,7 @@ function zi({
|
|
|
914
915
|
qr,
|
|
915
916
|
{
|
|
916
917
|
className: Yn,
|
|
917
|
-
nav:
|
|
918
|
+
nav: Bt ? "session-list" : null,
|
|
918
919
|
navParams: {
|
|
919
920
|
sessions: $,
|
|
920
921
|
activeId: He,
|
|
@@ -922,13 +923,13 @@ function zi({
|
|
|
922
923
|
pinnedIds: er,
|
|
923
924
|
onTogglePin: tr,
|
|
924
925
|
onSwitch: yr,
|
|
925
|
-
onOpenAsTab:
|
|
926
|
+
onOpenAsTab: ln,
|
|
926
927
|
onCreate: at,
|
|
927
928
|
onDelete: Rr,
|
|
928
929
|
onLoadMore: f == null ? void 0 : f.loadMore,
|
|
929
930
|
hasMore: f == null ? void 0 : f.hasMore,
|
|
930
931
|
loadingMore: f == null ? void 0 : f.loadingMore,
|
|
931
|
-
onClose: () =>
|
|
932
|
+
onClose: () => qt(!1)
|
|
932
933
|
},
|
|
933
934
|
center: "chat",
|
|
934
935
|
centerParams: Dr,
|
|
@@ -937,7 +938,7 @@ function zi({
|
|
|
937
938
|
onActiveChatPaneChange: Pr,
|
|
938
939
|
onCloseChatPane: Er,
|
|
939
940
|
onCreateChatPaneAfter: Ar,
|
|
940
|
-
onDropChatSession:
|
|
941
|
+
onDropChatSession: ln,
|
|
941
942
|
flashChatPaneId: (ie == null ? void 0 : ie.workspaceId) === e ? ie.id : null,
|
|
942
943
|
surface: Z ? "artifact-surface" : null,
|
|
943
944
|
surfaceParams: Lr,
|
|
@@ -945,35 +946,35 @@ function zi({
|
|
|
945
946
|
sidebar: Z && !mt && dt && vr ? "workbench-left" : null,
|
|
946
947
|
sidebarParams: Z && !mt && dt ? {
|
|
947
948
|
...Ae ? { defaultTab: Ae } : {},
|
|
948
|
-
bridge:
|
|
949
|
+
bridge: Sr,
|
|
949
950
|
onClose: () => {
|
|
950
|
-
|
|
951
|
+
be(!1), Ge(!1);
|
|
951
952
|
},
|
|
952
953
|
onCollapse: () => {
|
|
953
|
-
|
|
954
|
+
be(!1), Ge(!1);
|
|
954
955
|
}
|
|
955
956
|
} : void 0,
|
|
956
|
-
storageKey: F ?
|
|
957
|
+
storageKey: F ? we : void 0,
|
|
957
958
|
onOpenNav: Tt ? () => {
|
|
958
|
-
|
|
959
|
+
qt(!0), et == null || et();
|
|
959
960
|
} : void 0,
|
|
960
961
|
onOpenSurface: () => {
|
|
961
962
|
te.current = !0, q(!0), tt == null || tt();
|
|
962
963
|
},
|
|
963
964
|
surfaceButtonBottomOffset: kn,
|
|
964
965
|
onOpenSidebar: dt ? () => {
|
|
965
|
-
te.current = !0, q(!0),
|
|
966
|
+
te.current = !0, q(!0), be(!0), Ge(!0);
|
|
966
967
|
} : void 0
|
|
967
968
|
}
|
|
968
969
|
)
|
|
969
970
|
] }),
|
|
970
|
-
|
|
971
|
+
b
|
|
971
972
|
]
|
|
972
973
|
}
|
|
973
974
|
) });
|
|
974
975
|
}
|
|
975
|
-
const
|
|
976
|
-
function
|
|
976
|
+
const wi = 500;
|
|
977
|
+
function Ti(e) {
|
|
977
978
|
return new Promise((n, r) => {
|
|
978
979
|
let i;
|
|
979
980
|
const s = () => {
|
|
@@ -987,72 +988,72 @@ function wi(e) {
|
|
|
987
988
|
}
|
|
988
989
|
i = globalThis.setTimeout(() => {
|
|
989
990
|
s(), n();
|
|
990
|
-
},
|
|
991
|
+
}, wi), e.addEventListener("abort", o, { once: !0 });
|
|
991
992
|
});
|
|
992
993
|
}
|
|
993
994
|
function Vi({
|
|
994
995
|
workspaceId: e,
|
|
995
996
|
requestHeaders: n,
|
|
996
997
|
apiBaseUrl: r,
|
|
997
|
-
preloadPaths: i =
|
|
998
|
+
preloadPaths: i = _n,
|
|
998
999
|
provisionWorkspace: s = !0,
|
|
999
1000
|
loadingFallback: o,
|
|
1000
1001
|
errorFallback: c,
|
|
1001
1002
|
children: u
|
|
1002
1003
|
}) {
|
|
1003
|
-
const [
|
|
1004
|
+
const [b, y] = x({
|
|
1004
1005
|
status: "loading",
|
|
1005
1006
|
label: "Waking workspace runtime"
|
|
1006
1007
|
});
|
|
1007
1008
|
return A(() => {
|
|
1008
|
-
const
|
|
1009
|
-
async function W(
|
|
1010
|
-
const h = await fetch(
|
|
1009
|
+
const S = new AbortController(), j = Ve(e, n);
|
|
1010
|
+
async function W(w) {
|
|
1011
|
+
const h = await fetch(On(r, w), {
|
|
1011
1012
|
headers: j,
|
|
1012
|
-
signal:
|
|
1013
|
-
}),
|
|
1013
|
+
signal: S.signal
|
|
1014
|
+
}), T = await ke(h);
|
|
1014
1015
|
if (!h.ok) {
|
|
1015
|
-
if (
|
|
1016
|
-
throw new Error(
|
|
1016
|
+
if (bt(T)) return "preparing";
|
|
1017
|
+
throw new Error(St(T) ?? `${w} failed with ${h.status}`);
|
|
1017
1018
|
}
|
|
1018
|
-
if (
|
|
1019
|
-
const N = ze(
|
|
1019
|
+
if (xn(w)) {
|
|
1020
|
+
const N = ze(T);
|
|
1020
1021
|
if ((N == null ? void 0 : N.state) === "degraded") throw new Error(N.message ?? "Workspace failed to prepare");
|
|
1021
1022
|
}
|
|
1022
|
-
return Kr(
|
|
1023
|
+
return Kr(w) !== null && T && typeof T == "object" && Mn(r, j["x-boring-workspace-id"] ?? e, w, T), "ready";
|
|
1023
1024
|
}
|
|
1024
1025
|
async function V() {
|
|
1025
1026
|
y({ status: "loading", label: "Waking workspace runtime" });
|
|
1026
1027
|
try {
|
|
1027
|
-
const
|
|
1028
|
-
let h = await Promise.all(
|
|
1029
|
-
for (;
|
|
1030
|
-
if (y({ status: "loading", label: "Workspace is still preparing" }), await
|
|
1031
|
-
h = await Promise.all(
|
|
1028
|
+
const w = Ln(i, s);
|
|
1029
|
+
let h = await Promise.all(w.map(async (p) => ({ path: p, status: await W(p) }))), T = h.filter((p) => p.status === "preparing").map((p) => p.path);
|
|
1030
|
+
for (; T.length > 0; ) {
|
|
1031
|
+
if (y({ status: "loading", label: "Workspace is still preparing" }), await Ti(S.signal), S.signal.aborted) return;
|
|
1032
|
+
h = await Promise.all(T.map(async (p) => ({ path: p, status: await W(p) }))), T = h.filter((p) => p.status === "preparing").map((p) => p.path);
|
|
1032
1033
|
}
|
|
1033
|
-
|
|
1034
|
-
} catch (
|
|
1035
|
-
if (
|
|
1034
|
+
S.signal.aborted || y({ status: "ready" });
|
|
1035
|
+
} catch (w) {
|
|
1036
|
+
if (S.signal.aborted) return;
|
|
1036
1037
|
y({
|
|
1037
1038
|
status: "error",
|
|
1038
|
-
message:
|
|
1039
|
+
message: w instanceof Error ? w.message : "Unknown workspace boot error"
|
|
1039
1040
|
});
|
|
1040
1041
|
}
|
|
1041
1042
|
}
|
|
1042
|
-
return V(), () =>
|
|
1043
|
-
}, [r, i, s, n, e]),
|
|
1044
|
-
|
|
1043
|
+
return V(), () => S.abort();
|
|
1044
|
+
}, [r, i, s, n, e]), b.status === "ready" ? /* @__PURE__ */ d(de, { children: u }) : b.status === "error" ? typeof c == "function" ? /* @__PURE__ */ d(de, { children: c(b.message) }) : c ? /* @__PURE__ */ d(de, { children: c }) : /* @__PURE__ */ d(
|
|
1045
|
+
En,
|
|
1045
1046
|
{
|
|
1046
1047
|
title: "Workspace failed to open",
|
|
1047
|
-
description:
|
|
1048
|
+
description: b.message,
|
|
1048
1049
|
status: "Retry by reloading the page"
|
|
1049
1050
|
}
|
|
1050
|
-
) : typeof o == "function" ? /* @__PURE__ */ d(de, { children: o(
|
|
1051
|
-
|
|
1051
|
+
) : typeof o == "function" ? /* @__PURE__ */ d(de, { children: o(b.label) }) : o ? /* @__PURE__ */ d(de, { children: o }) : /* @__PURE__ */ d(
|
|
1052
|
+
En,
|
|
1052
1053
|
{
|
|
1053
1054
|
title: "Opening workspace",
|
|
1054
1055
|
description: "Preparing secure runtime, files, sessions, and layout.",
|
|
1055
|
-
status:
|
|
1056
|
+
status: b.label
|
|
1056
1057
|
}
|
|
1057
1058
|
);
|
|
1058
1059
|
}
|
|
@@ -1148,7 +1149,7 @@ function vt({ code: e, title: n, description: r }) {
|
|
|
1148
1149
|
);
|
|
1149
1150
|
}
|
|
1150
1151
|
function ki({ componentId: e, params: n = {} }) {
|
|
1151
|
-
const r =
|
|
1152
|
+
const r = Fn(), { errors: i } = Hr(), s = r.get(e), o = r.getComponents()[e];
|
|
1152
1153
|
Mr(() => {
|
|
1153
1154
|
document.title = (s == null ? void 0 : s.title) ?? e;
|
|
1154
1155
|
}, [e, s == null ? void 0 : s.title]);
|
|
@@ -1159,11 +1160,11 @@ function ki({ componentId: e, params: n = {} }) {
|
|
|
1159
1160
|
className: "h-full"
|
|
1160
1161
|
}), [e, n]), u = O(() => {
|
|
1161
1162
|
if (!s) return null;
|
|
1162
|
-
const
|
|
1163
|
+
const b = s.pluginId ?? s.id;
|
|
1163
1164
|
for (let y = i.length - 1; y >= 0; y -= 1) {
|
|
1164
|
-
const
|
|
1165
|
-
if (
|
|
1166
|
-
return
|
|
1165
|
+
const S = i[y];
|
|
1166
|
+
if (S.contributionKind === "panel" && S.contributionId === e && S.pluginId === b)
|
|
1167
|
+
return S;
|
|
1167
1168
|
}
|
|
1168
1169
|
return null;
|
|
1169
1170
|
}, [e, i, s]);
|