@hachej/boring-workspace 0.1.56 → 0.1.58
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/app-front.js +346 -349
- package/package.json +4 -4
package/dist/app-front.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as d, jsxs as Ae, Fragment as fe } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as A, useSyncExternalStore as
|
|
3
|
-
import { PiChatPanel as
|
|
4
|
-
import { at as
|
|
5
|
-
import { T as
|
|
6
|
-
import { Sun as
|
|
7
|
-
import { IconButton as
|
|
8
|
-
function
|
|
9
|
-
const { theme: e, toggleTheme: n } =
|
|
2
|
+
import { useEffect as A, useSyncExternalStore as xr, useMemo as L, useState as M, useCallback as E, useRef as $, useLayoutEffect as Mr } from "react";
|
|
3
|
+
import { PiChatPanel as Cr, usePiSessions as Wr } from "@hachej/boring-agent/front";
|
|
4
|
+
import { at as Fr, aG as ze, aH as _n, aI as On, aJ as Ln, aK as xn, aL as ke, aM as St, aN as vt, aO as Mn, aP as Ir, aQ as Ve, O as Gr, q as $r, aR as bn, aS as Ur, U as yn, aT as Kr, w as Hr, u as Cn, aU as Jr, aq as qr, aV as jr } from "./WorkspaceProvider-Bp1Sm40K.js";
|
|
5
|
+
import { T as Br, C as Vr, r as Pn, w as zr, W as En } from "./WorkspaceLoadingState-BYTO4wdt.js";
|
|
6
|
+
import { Sun as kr, Moon as Yr } from "lucide-react";
|
|
7
|
+
import { IconButton as Qr, ErrorState as Xr } from "@hachej/boring-ui-kit";
|
|
8
|
+
function Zr() {
|
|
9
|
+
const { theme: e, toggleTheme: n } = Fr(), r = e === "dark";
|
|
10
10
|
return A(() => {
|
|
11
11
|
typeof document > "u" || document.documentElement.classList.toggle("dark", r);
|
|
12
12
|
}, [r]), /* @__PURE__ */ d(
|
|
13
|
-
|
|
13
|
+
Qr,
|
|
14
14
|
{
|
|
15
15
|
type: "button",
|
|
16
16
|
variant: "ghost",
|
|
@@ -18,18 +18,18 @@ function ts() {
|
|
|
18
18
|
onClick: n,
|
|
19
19
|
"aria-label": "Toggle theme",
|
|
20
20
|
title: r ? "Switch to light theme" : "Switch to dark theme",
|
|
21
|
-
children: r ? /* @__PURE__ */ d(
|
|
21
|
+
children: r ? /* @__PURE__ */ d(kr, { className: "h-4 w-4" }) : /* @__PURE__ */ d(Yr, { className: "h-4 w-4" })
|
|
22
22
|
}
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function es() {
|
|
26
26
|
const e = `s${Date.now()}`;
|
|
27
27
|
return {
|
|
28
28
|
sessions: [{ id: e, title: "New session", updatedAt: Date.now() }],
|
|
29
29
|
activeId: e
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function ts(e, n) {
|
|
33
33
|
var r;
|
|
34
34
|
if (typeof localStorage > "u") return n();
|
|
35
35
|
try {
|
|
@@ -43,18 +43,18 @@ function rs(e, n) {
|
|
|
43
43
|
}
|
|
44
44
|
return n();
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function ns(e, n) {
|
|
47
47
|
if (!(typeof localStorage > "u"))
|
|
48
48
|
try {
|
|
49
49
|
localStorage.setItem(e, JSON.stringify(n));
|
|
50
50
|
} catch {
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const n = e.storageKey ?? "workspace:sessions", r = e.initial ??
|
|
55
|
-
let s =
|
|
53
|
+
function rs(e = {}) {
|
|
54
|
+
const n = e.storageKey ?? "workspace:sessions", r = e.initial ?? es;
|
|
55
|
+
let s = ts(n, r);
|
|
56
56
|
const i = /* @__PURE__ */ new Set(), o = (c) => {
|
|
57
|
-
s = c,
|
|
57
|
+
s = c, ns(n, s), i.forEach((u) => u());
|
|
58
58
|
};
|
|
59
59
|
return {
|
|
60
60
|
getState: () => s,
|
|
@@ -81,11 +81,11 @@ function is(e = {}) {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
return
|
|
84
|
+
function ss(e) {
|
|
85
|
+
return xr(e.subscribe, e.getState, e.getState);
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
function
|
|
87
|
+
const is = 500, os = 1e4;
|
|
88
|
+
function An(e) {
|
|
89
89
|
return new Promise((n, r) => {
|
|
90
90
|
let s;
|
|
91
91
|
const i = () => {
|
|
@@ -99,10 +99,10 @@ function Tn(e) {
|
|
|
99
99
|
}
|
|
100
100
|
s = globalThis.setTimeout(() => {
|
|
101
101
|
i(), n();
|
|
102
|
-
},
|
|
102
|
+
}, is), e.addEventListener("abort", o, { once: !0 });
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
async function
|
|
105
|
+
async function as(e) {
|
|
106
106
|
const n = e.body;
|
|
107
107
|
if (!n) return Ve(await ke(e));
|
|
108
108
|
const r = n.getReader(), s = new TextDecoder();
|
|
@@ -123,7 +123,7 @@ async function cs(e) {
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function ls(e) {
|
|
127
127
|
if (!((e == null ? void 0 : e.runtimeDependenciesState) !== "preparing" && (e == null ? void 0 : e.runtimeDependenciesState) !== "ready" && (e == null ? void 0 : e.runtimeDependenciesState) !== "failed"))
|
|
128
128
|
return {
|
|
129
129
|
state: e.runtimeDependenciesState,
|
|
@@ -131,13 +131,13 @@ function us(e) {
|
|
|
131
131
|
...e.runtimeDependenciesRequirement ? { requirement: e.runtimeDependenciesRequirement } : {}
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
async function
|
|
134
|
+
async function cs(e) {
|
|
135
135
|
if (!e.ok) {
|
|
136
136
|
const i = await ke(e);
|
|
137
|
-
if (
|
|
138
|
-
throw new Error(
|
|
137
|
+
if (St(i)) return { status: "preparing" };
|
|
138
|
+
throw new Error(vt(i) ?? `/api/v1/ready-status failed with ${e.status}`);
|
|
139
139
|
}
|
|
140
|
-
const n = await
|
|
140
|
+
const n = await as(e), r = ls(n), s = Ir(n);
|
|
141
141
|
if ((n == null ? void 0 : n.state) === "degraded" || (n == null ? void 0 : n.state) === "failed") {
|
|
142
142
|
if (s && (r == null ? void 0 : r.state) === "failed")
|
|
143
143
|
return { status: "ready", runtimeDependencies: r };
|
|
@@ -145,25 +145,25 @@ async function ds(e) {
|
|
|
145
145
|
}
|
|
146
146
|
return s ? { status: "ready", ...r ? { runtimeDependencies: r } : {} } : { status: "preparing", ...r ? { runtimeDependencies: r } : {} };
|
|
147
147
|
}
|
|
148
|
-
async function
|
|
148
|
+
async function us({
|
|
149
149
|
apiBaseUrl: e,
|
|
150
150
|
path: n,
|
|
151
151
|
headers: r,
|
|
152
152
|
signal: s,
|
|
153
153
|
workspaceId: i
|
|
154
154
|
}) {
|
|
155
|
-
const o = new AbortController(), c = globalThis.setTimeout(() => o.abort(new DOMException("Warmup attempt timed out", "TimeoutError")),
|
|
155
|
+
const o = new AbortController(), c = globalThis.setTimeout(() => o.abort(new DOMException("Warmup attempt timed out", "TimeoutError")), os), u = () => o.abort(s.reason);
|
|
156
156
|
s.aborted && u(), s.addEventListener("abort", u, { once: !0 });
|
|
157
157
|
try {
|
|
158
|
-
const v = await fetch(
|
|
159
|
-
if (
|
|
158
|
+
const v = await fetch(Ln(e, n), { headers: r, signal: o.signal });
|
|
159
|
+
if (xn(n)) return await cs(v);
|
|
160
160
|
const y = await ke(v);
|
|
161
161
|
if (!v.ok) {
|
|
162
|
-
const b =
|
|
162
|
+
const b = St(y);
|
|
163
163
|
if (b) return { status: "preparing", ...b };
|
|
164
|
-
throw new Error(
|
|
164
|
+
throw new Error(vt(y) ?? `${n} failed with ${v.status}`);
|
|
165
165
|
}
|
|
166
|
-
return y && typeof y == "object" &&
|
|
166
|
+
return y && typeof y == "object" && Mn(e, r["x-boring-workspace-id"] ?? i, n, y), { status: "ready" };
|
|
167
167
|
} catch (v) {
|
|
168
168
|
if (s.aborted) throw v;
|
|
169
169
|
if (o.signal.aborted || v instanceof TypeError) return { status: "preparing" };
|
|
@@ -172,11 +172,11 @@ async function fs({
|
|
|
172
172
|
globalThis.clearTimeout(c), s.removeEventListener("abort", u);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function ds({
|
|
176
176
|
workspaceId: e,
|
|
177
177
|
requestHeaders: n,
|
|
178
178
|
apiBaseUrl: r,
|
|
179
|
-
preloadPaths: s =
|
|
179
|
+
preloadPaths: s = _n,
|
|
180
180
|
provisionWorkspace: i = !0,
|
|
181
181
|
onStatusChange: o
|
|
182
182
|
}) {
|
|
@@ -187,14 +187,14 @@ function gs({
|
|
|
187
187
|
var b, q;
|
|
188
188
|
o == null || o({ status: "preparing" });
|
|
189
189
|
try {
|
|
190
|
-
const
|
|
190
|
+
const F = On(s, i), z = (p) => us({
|
|
191
191
|
apiBaseUrl: r,
|
|
192
192
|
path: p,
|
|
193
193
|
headers: v,
|
|
194
194
|
signal: u.signal,
|
|
195
195
|
workspaceId: e
|
|
196
196
|
});
|
|
197
|
-
let T = await Promise.all(
|
|
197
|
+
let T = await Promise.all(F.map(async (p) => ({ path: p, result: await z(p) })));
|
|
198
198
|
if (c || u.signal.aborted) return;
|
|
199
199
|
let h = (b = T.find((p) => p.result.runtimeDependencies)) == null ? void 0 : b.result.runtimeDependencies, w = T.filter((p) => p.result.status === "preparing");
|
|
200
200
|
for (; w.length > 0; ) {
|
|
@@ -204,20 +204,20 @@ function gs({
|
|
|
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
|
|
207
|
+
if (o == null || o({ status: "preparing", message: "Workspace is still preparing", ...p ? { requirement: p } : {} }), await An(u.signal), c || u.signal.aborted || (T = await Promise.all(w.map(async (N) => ({ path: N.path, result: await z(N.path) }))), c || u.signal.aborted)) return;
|
|
208
208
|
h = ((q = T.find((N) => N.result.runtimeDependencies)) == null ? void 0 : q.result.runtimeDependencies) ?? h, w = T.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 z("/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 }));
|
|
215
215
|
}
|
|
216
|
-
} catch (
|
|
216
|
+
} catch (F) {
|
|
217
217
|
if (c || u.signal.aborted) return;
|
|
218
218
|
o == null || o({
|
|
219
219
|
status: "failed",
|
|
220
|
-
message:
|
|
220
|
+
message: F instanceof Error ? F.message : "Workspace failed to prepare"
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -226,7 +226,7 @@ function gs({
|
|
|
226
226
|
};
|
|
227
227
|
}, [r, o, s, i, n, e]), null;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function fs(e) {
|
|
230
230
|
return typeof (e == null ? void 0 : e.id) == "string" ? e.id : null;
|
|
231
231
|
}
|
|
232
232
|
function Be(e, n, r) {
|
|
@@ -234,33 +234,33 @@ function Be(e, n, r) {
|
|
|
234
234
|
const s = n ? e.indexOf(n) : -1, i = s >= 0 ? s + 1 : e.length;
|
|
235
235
|
return [...e.slice(0, i), r, ...e.slice(i)];
|
|
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 s = n ? e.indexOf(n) : -1, i = s >= 0 ? s : 0;
|
|
241
241
|
return e.map((o, c) => c === i ? r : o);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function gs(e, n) {
|
|
244
244
|
return e.endsWith(":surface") ? e.slice(0, -8) : n;
|
|
245
245
|
}
|
|
246
|
-
function
|
|
247
|
-
const [s, i] =
|
|
246
|
+
function mt(e, n, r) {
|
|
247
|
+
const [s, i] = M(() => Pn(e, n, r));
|
|
248
248
|
A(() => {
|
|
249
|
-
i(
|
|
249
|
+
i(Pn(e, n, r));
|
|
250
250
|
}, [e, n, r]);
|
|
251
251
|
const o = E(
|
|
252
252
|
(c) => {
|
|
253
|
-
i(c),
|
|
253
|
+
i(c), zr(e, c, r);
|
|
254
254
|
},
|
|
255
255
|
[r, e]
|
|
256
256
|
);
|
|
257
257
|
return [s, o];
|
|
258
258
|
}
|
|
259
|
-
const
|
|
259
|
+
const pt = {}, ms = [], Tn = { status: "preparing" }, wn = {
|
|
260
260
|
openTabs: [],
|
|
261
261
|
activeTab: null
|
|
262
262
|
};
|
|
263
|
-
function
|
|
263
|
+
function ps({ status: e }) {
|
|
264
264
|
const n = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", s = r ? n === "workspace-fs" ? "Preparing files…" : n === "sandbox-exec" ? "Preparing secure runtime…" : n === "ui-bridge" ? "Connecting workspace…" : "Preparing workspace…" : "Workspace workbench failed", i = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
|
|
265
265
|
return /* @__PURE__ */ d("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ Ae("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
266
266
|
r ? /* @__PURE__ */ d("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,
|
|
@@ -269,8 +269,8 @@ function Ss({ status: e }) {
|
|
|
269
269
|
e.status === "failed" ? /* @__PURE__ */ d("p", { className: "mt-3 text-xs text-muted-foreground", children: "Reload the workspace to retry." }) : null
|
|
270
270
|
] }) });
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
const n = e.workspaceId ??
|
|
272
|
+
function hs(e) {
|
|
273
|
+
const n = e.workspaceId ?? Ss(e.requestHeaders) ?? e.storageKey, r = Wr({
|
|
274
274
|
apiBaseUrl: e.apiBaseUrl,
|
|
275
275
|
workspaceId: n,
|
|
276
276
|
storageScope: n,
|
|
@@ -281,10 +281,10 @@ function vs(e) {
|
|
|
281
281
|
});
|
|
282
282
|
return { ...r, workspaceId: r.dataStorageScope };
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function Ss(e) {
|
|
285
285
|
return (e == null ? void 0 : e["x-boring-workspace-id"]) ?? (e == null ? void 0 : e["X-Boring-Workspace-Id"]) ?? null;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function vs(e) {
|
|
288
288
|
const n = e.reloaded ? "Extensions reloaded." : "Extensions will reload on the next message.", r = Array.isArray(e.diagnostics) ? e.diagnostics.map((s) => s.message).filter((s) => !!s) : [];
|
|
289
289
|
return r.length > 0 ? `${n}
|
|
290
290
|
|
|
@@ -292,7 +292,7 @@ Warnings:
|
|
|
292
292
|
${r.join(`
|
|
293
293
|
`)}` : n;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function bs(e) {
|
|
296
296
|
var n;
|
|
297
297
|
try {
|
|
298
298
|
return ((n = globalThis.localStorage) == null ? void 0 : n.getItem(e)) ?? null;
|
|
@@ -300,7 +300,7 @@ function Ps(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 s = (r = globalThis.localStorage) == null ? void 0 : r.getItem(e);
|
|
@@ -313,7 +313,7 @@ function _n(e, n) {
|
|
|
313
313
|
return null;
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function ys(e, n) {
|
|
317
317
|
var r, s;
|
|
318
318
|
try {
|
|
319
319
|
if (n.ids.length === 0) {
|
|
@@ -327,7 +327,7 @@ function Es(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 s = (r = globalThis.localStorage) == null ? void 0 : r.getItem(e);
|
|
@@ -338,7 +338,7 @@ function On(e, n) {
|
|
|
338
338
|
return null;
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Ps(e, n) {
|
|
342
342
|
var r, s;
|
|
343
343
|
try {
|
|
344
344
|
if (n.length === 0) {
|
|
@@ -349,27 +349,27 @@ function As(e, n) {
|
|
|
349
349
|
} catch {
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function Es() {
|
|
353
353
|
return /* @__PURE__ */ d("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ Ae("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
354
354
|
/* @__PURE__ */ d("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" }),
|
|
355
355
|
/* @__PURE__ */ d("div", { className: "text-sm font-semibold text-foreground", children: "Loading sessions…" }),
|
|
356
356
|
/* @__PURE__ */ d("p", { className: "mt-2 text-sm text-muted-foreground", children: "Finding this workspace’s saved chats." })
|
|
357
357
|
] }) });
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function As(e) {
|
|
360
360
|
if (!e) return "/api/v1/ui";
|
|
361
361
|
const n = e.replace(/\/$/, ""), r = "/api/v1/ui";
|
|
362
362
|
return n.endsWith(r) ? n : `${n}${r}`;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
365
|
-
return `${
|
|
364
|
+
function Rs(e) {
|
|
365
|
+
return `${As(e)}/state`;
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function Ts(e) {
|
|
368
368
|
var s;
|
|
369
369
|
const n = e.openTabs.find((i) => i.id === e.activeTab), r = (s = n == null ? void 0 : n.params) == null ? void 0 : s.path;
|
|
370
370
|
return typeof r == "string" ? r : null;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function ws({
|
|
373
373
|
bridgeEndpoint: e,
|
|
374
374
|
requestHeaders: n,
|
|
375
375
|
navOpen: r,
|
|
@@ -377,7 +377,7 @@ function Ds({
|
|
|
377
377
|
surfaceReady: i,
|
|
378
378
|
snapshot: o
|
|
379
379
|
}) {
|
|
380
|
-
const c =
|
|
380
|
+
const c = Cn(), u = $(null);
|
|
381
381
|
return A(() => {
|
|
382
382
|
var b;
|
|
383
383
|
if (e === null || s && !i) return;
|
|
@@ -390,10 +390,10 @@ function Ds({
|
|
|
390
390
|
workbenchOpen: s,
|
|
391
391
|
openTabs: o.openTabs,
|
|
392
392
|
activeTab: o.activeTab,
|
|
393
|
-
activeFile:
|
|
393
|
+
activeFile: Ts(o),
|
|
394
394
|
availablePanels: c.list().map((q) => q.id)
|
|
395
395
|
};
|
|
396
|
-
return fetch(
|
|
396
|
+
return fetch(Rs(e), {
|
|
397
397
|
method: "PUT",
|
|
398
398
|
headers: { ...n, "Content-Type": "application/json" },
|
|
399
399
|
body: JSON.stringify({ state: y, causedBy: "user" }),
|
|
@@ -404,7 +404,7 @@ function Ds({
|
|
|
404
404
|
};
|
|
405
405
|
}, [e, r, c, n, o, s, i]), null;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function zs({
|
|
408
408
|
workspaceId: e,
|
|
409
409
|
chatPanel: n,
|
|
410
410
|
useSessions: r,
|
|
@@ -417,111 +417,111 @@ function Qs({
|
|
|
417
417
|
panels: y,
|
|
418
418
|
commands: b,
|
|
419
419
|
catalogs: q,
|
|
420
|
-
plugins:
|
|
420
|
+
plugins: F,
|
|
421
421
|
excludeDefaults: z,
|
|
422
422
|
capabilities: T,
|
|
423
423
|
apiBaseUrl: h,
|
|
424
424
|
authHeaders: w,
|
|
425
425
|
apiTimeout: p,
|
|
426
426
|
defaultTheme: N,
|
|
427
|
-
onThemeChange:
|
|
428
|
-
persistenceEnabled:
|
|
429
|
-
debug:
|
|
427
|
+
onThemeChange: Wn,
|
|
428
|
+
persistenceEnabled: bt,
|
|
429
|
+
debug: Fn,
|
|
430
430
|
bridgeEndpoint: Ye,
|
|
431
|
-
fullPageBasePath:
|
|
432
|
-
onAuthError:
|
|
433
|
-
sessions:
|
|
434
|
-
activeSessionId:
|
|
435
|
-
onSwitchSession:
|
|
431
|
+
fullPageBasePath: In,
|
|
432
|
+
onAuthError: Gn,
|
|
433
|
+
sessions: yt,
|
|
434
|
+
activeSessionId: Pt,
|
|
435
|
+
onSwitchSession: Et,
|
|
436
436
|
onCreateSession: Qe,
|
|
437
|
-
onDeleteSession:
|
|
437
|
+
onDeleteSession: At,
|
|
438
438
|
onActiveSessionIdChange: Re,
|
|
439
|
-
appTitle:
|
|
440
|
-
workspaceLabel:
|
|
439
|
+
appTitle: Rt = "Boring UI",
|
|
440
|
+
workspaceLabel: $n,
|
|
441
441
|
defaultSessionTitle: k = "New session",
|
|
442
|
-
navEnabled:
|
|
443
|
-
defaultNavOpen:
|
|
444
|
-
defaultSurfaceOpen:
|
|
442
|
+
navEnabled: Tt = !0,
|
|
443
|
+
defaultNavOpen: Un = !1,
|
|
444
|
+
defaultSurfaceOpen: Kn,
|
|
445
445
|
defaultWorkbenchLeftTab: Te,
|
|
446
446
|
defaultWorkbenchLeftOpen: Xe,
|
|
447
|
-
surfaceInitialPanels:
|
|
448
|
-
topBarLeft:
|
|
449
|
-
topBarRight:
|
|
450
|
-
showThemeToggle:
|
|
447
|
+
surfaceInitialPanels: wt,
|
|
448
|
+
topBarLeft: Hn,
|
|
449
|
+
topBarRight: Jn,
|
|
450
|
+
showThemeToggle: qn = !0,
|
|
451
451
|
chatParams: O,
|
|
452
|
-
externalPlugins:
|
|
453
|
-
hotReloadEnabled:
|
|
454
|
-
frontPluginHotReload:
|
|
455
|
-
extraPanels:
|
|
456
|
-
extraCommands:
|
|
452
|
+
externalPlugins: jn,
|
|
453
|
+
hotReloadEnabled: Bn,
|
|
454
|
+
frontPluginHotReload: Vn,
|
|
455
|
+
extraPanels: Nt,
|
|
456
|
+
extraCommands: Dt,
|
|
457
457
|
provisionWorkspace: Ze,
|
|
458
|
-
bootPreloadPaths:
|
|
458
|
+
bootPreloadPaths: zn,
|
|
459
459
|
onWorkspaceWarmupStatusChange: we,
|
|
460
460
|
onOpenNav: et,
|
|
461
461
|
onOpenSurface: tt,
|
|
462
|
-
surfaceButtonBottomOffset:
|
|
463
|
-
className:
|
|
462
|
+
surfaceButtonBottomOffset: kn,
|
|
463
|
+
className: Yn
|
|
464
464
|
}) {
|
|
465
|
-
var
|
|
466
|
-
const
|
|
465
|
+
var fn, gn;
|
|
466
|
+
const _t = jn !== !1, Qn = _t ? Vn : !1, nt = _t ? Bn : !1, rt = o ?? `boring-ui-v2:layout:${e}`, I = c ?? `${rt}:surface`, Ne = gs(
|
|
467
467
|
I,
|
|
468
468
|
rt
|
|
469
|
-
), C =
|
|
470
|
-
() => ze(e, s ??
|
|
469
|
+
), C = bt !== !1, De = i ?? `boring-workspace:sessions:${e}`, Y = L(
|
|
470
|
+
() => ze(e, s ?? pt),
|
|
471
471
|
[s, e]
|
|
472
|
-
),
|
|
473
|
-
() => ze(e, { ...s ??
|
|
472
|
+
), Xn = L(
|
|
473
|
+
() => ze(e, { ...s ?? pt, ...w ?? pt }),
|
|
474
474
|
[w, s, e]
|
|
475
475
|
), _e = L(
|
|
476
|
-
() =>
|
|
476
|
+
() => rs({ storageKey: De }),
|
|
477
477
|
[De]
|
|
478
|
-
),
|
|
478
|
+
), Ot = ss(_e), [Lt, Zn] = M(() => ({
|
|
479
479
|
workspaceId: e,
|
|
480
|
-
status:
|
|
481
|
-
})), [Oe, st] =
|
|
480
|
+
status: Tn
|
|
481
|
+
})), [Oe, st] = M(() => ({
|
|
482
482
|
workspaceId: e,
|
|
483
483
|
expired: !1
|
|
484
|
-
})), [
|
|
484
|
+
})), [xt, Le] = M(() => ({
|
|
485
485
|
workspaceId: e,
|
|
486
486
|
creating: !1
|
|
487
|
-
})), [
|
|
487
|
+
})), [Mt, xe] = M(() => ({
|
|
488
488
|
workspaceId: e,
|
|
489
489
|
failed: !1
|
|
490
|
-
})),
|
|
491
|
-
() => (C ?
|
|
492
|
-
), [ie,
|
|
490
|
+
})), ge = `boring-workspace:chat-panes:${e}`, [D, B] = M(
|
|
491
|
+
() => (C ? Nn(ge, e) : null) ?? { workspaceId: e, ids: [], activeId: null }
|
|
492
|
+
), [ie, Ct] = M(null);
|
|
493
493
|
A(() => {
|
|
494
494
|
if (!ie) return;
|
|
495
|
-
const t = setTimeout(() =>
|
|
495
|
+
const t = setTimeout(() => Ct(null), 700);
|
|
496
496
|
return () => clearTimeout(t);
|
|
497
497
|
}, [ie]);
|
|
498
|
-
const me = `boring-workspace:pinned-sessions:${e}`, [
|
|
499
|
-
() => (C ?
|
|
500
|
-
),
|
|
498
|
+
const me = `boring-workspace:pinned-sessions:${e}`, [Wt, Ft] = M(
|
|
499
|
+
() => (C ? Dn(me, e) : null) ?? { workspaceId: e, ids: [] }
|
|
500
|
+
), er = Wt.workspaceId === e ? Wt.ids : ms;
|
|
501
501
|
A(() => {
|
|
502
|
-
|
|
502
|
+
Ft((t) => t.workspaceId === e ? t : (C ? Dn(me, e) : null) ?? { workspaceId: e, ids: [] });
|
|
503
503
|
}, [me, C, e]);
|
|
504
|
-
const
|
|
505
|
-
|
|
504
|
+
const tr = E((t) => {
|
|
505
|
+
Ft((a) => {
|
|
506
506
|
const l = a.workspaceId === e ? a.ids : [], g = l.includes(t) ? l.filter((S) => S !== t) : [t, ...l];
|
|
507
|
-
return C &&
|
|
507
|
+
return C && Ps(me, g), { workspaceId: e, ids: g };
|
|
508
508
|
});
|
|
509
509
|
}, [me, C, e]);
|
|
510
510
|
A(() => {
|
|
511
|
-
C && D.workspaceId === e &&
|
|
511
|
+
C && D.workspaceId === e && ys(ge, D);
|
|
512
512
|
}, [D, ge, C, e]), A(() => {
|
|
513
|
-
B((t) => t.workspaceId === e ? t : (C ?
|
|
513
|
+
B((t) => t.workspaceId === e ? t : (C ? Nn(ge, e) : null) ?? { workspaceId: e, ids: [], activeId: null });
|
|
514
514
|
}, [ge, C, e]);
|
|
515
|
-
const Me =
|
|
516
|
-
}, _ =
|
|
515
|
+
const Me = Lt.workspaceId === e ? Lt.status : Tn, nr = n ?? Cr, rr = r ?? hs, Q = !n || !!r, Ce = Q && Ze !== !1, it = () => {
|
|
516
|
+
}, _ = rr({
|
|
517
517
|
requestHeaders: Y,
|
|
518
518
|
storageKey: De,
|
|
519
519
|
workspaceId: e,
|
|
520
520
|
apiBaseUrl: h,
|
|
521
521
|
enabled: Ce
|
|
522
|
-
}), [pe,
|
|
522
|
+
}), [pe, sr] = M(() => ({ workspaceId: e, sessions: [], activeSessionId: null })), It = Ce && _.workspaceId != null && _.workspaceId !== e, V = Ce && !_.loading && !_.error && !It, W = Ce && !V;
|
|
523
523
|
A(() => {
|
|
524
|
-
V &&
|
|
524
|
+
V && sr((t) => {
|
|
525
525
|
const a = t.workspaceId === e, l = t.activeSessionId === _.activeSessionId, g = t.sessions.length === _.sessions.length && t.sessions.every((S, R) => {
|
|
526
526
|
var re;
|
|
527
527
|
return S.id === ((re = _.sessions[R]) == null ? void 0 : re.id);
|
|
@@ -533,7 +533,7 @@ function Qs({
|
|
|
533
533
|
};
|
|
534
534
|
});
|
|
535
535
|
}, [_.activeSessionId, _.sessions, V, e]);
|
|
536
|
-
const
|
|
536
|
+
const We = W && pe.workspaceId === e && pe.sessions.length > 0, Fe = W ? bs(De) : null, Gt = W && !It ? _.activeSessionId ?? null : null, X = V ? _.sessions : We ? pe.sessions : [], ir = V ? _.activeSessionId : We ? pe.activeSessionId : null, f = Q && (V || We) ? _ : void 0, oe = yt !== void 0 || Pt !== void 0 || Et !== void 0 || Qe !== void 0 || At !== void 0, $t = Oe.workspaceId === e && Oe.expired, he = $(!1), Se = !!(V && f && !oe && X.length === 0 && !$t), or = xt.workspaceId === e && xt.creating, ar = Mt.workspaceId === e && Mt.failed, lr = !!(V && f && !oe && X.length === 0 && $t && !he.current && !ar), Ie = !!(W && _.loading && !_.error && Q && !oe && !We && !Fe && !Gt) || Se || or || lr;
|
|
537
537
|
A(() => {
|
|
538
538
|
if (!Se) {
|
|
539
539
|
Oe.workspaceId !== e && st({ workspaceId: e, expired: !1 });
|
|
@@ -545,19 +545,19 @@ function Qs({
|
|
|
545
545
|
}, 2e3);
|
|
546
546
|
return () => globalThis.clearTimeout(t);
|
|
547
547
|
}, [Oe.workspaceId, Se, e]);
|
|
548
|
-
const
|
|
548
|
+
const cr = f ? X.map((t) => ({
|
|
549
549
|
...t,
|
|
550
550
|
title: t.title ?? "New session"
|
|
551
|
-
})) : void 0,
|
|
552
|
-
id:
|
|
551
|
+
})) : void 0, ur = Fe ? [{
|
|
552
|
+
id: Fe,
|
|
553
553
|
title: "Loading sessions…",
|
|
554
554
|
createdAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
555
555
|
updatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
556
556
|
turnCount: 0
|
|
557
|
-
}] : [], U = f ?
|
|
557
|
+
}] : [], U = f ? cr ?? [] : W ? ur : oe ? yt ?? [] : Ot.sessions, dr = f ? ir ?? null : W ? Fe ?? Gt : oe ? Pt ?? null : Ot.activeId, ae = (O == null ? void 0 : O.autoSubmitInitialDraft) === !0, Ge = ae && Q && !oe, [K, ve] = M(() => Ge ? null : void 0), Ut = $(e), le = $(!1);
|
|
558
558
|
A(() => {
|
|
559
|
-
if (
|
|
560
|
-
|
|
559
|
+
if (Ut.current !== e) {
|
|
560
|
+
Ut.current = e, le.current = !1, ve(Ge ? null : void 0);
|
|
561
561
|
return;
|
|
562
562
|
}
|
|
563
563
|
Ge && K === void 0 && (le.current = !1, ve(null));
|
|
@@ -570,85 +570,82 @@ function Qs({
|
|
|
570
570
|
le.current = !1, ve(void 0);
|
|
571
571
|
}));
|
|
572
572
|
}, [K, k, f]);
|
|
573
|
-
const G = K !== void 0 ? K ?? null :
|
|
573
|
+
const G = K !== void 0 ? K ?? null : dr, J = W ? it : (f == null ? void 0 : f.switch) ?? Et ?? _e.switchTo, $e = E((t) => (G && t !== G && Gr({ sessionId: G, reason: $r.sessionSwitch }), J(t)), [G, J]), ot = W ? it : f ? () => f.create() : Qe ? () => Qe() : () => _e.create(), Kt = W ? it : (f == null ? void 0 : f.delete) ?? At ?? _e.remove, Ht = E((t) => (f && X.length <= 1 && (he.current = !0), Kt(t)), [X.length, Kt, f]), fr = ((fn = U.find((t) => t.id === G)) == null ? void 0 : fn.title) ?? void 0, [gr, Jt] = mt(
|
|
574
574
|
`${Ne}:drawer`,
|
|
575
|
-
|
|
575
|
+
Un,
|
|
576
576
|
C
|
|
577
|
-
),
|
|
577
|
+
), qt = Tt && gr, [Z, j] = mt(
|
|
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
|
`${Ne}:workbenchOpen`,
|
|
582
|
-
|
|
582
|
+
Kn ?? !1,
|
|
583
583
|
C
|
|
584
|
-
), [
|
|
584
|
+
), [mr, at] = M(!1), [pr, be] = mt(
|
|
585
585
|
`${Ne}:workbenchLeftOpen`,
|
|
586
586
|
Xe ?? !1,
|
|
587
587
|
C
|
|
588
|
-
), [
|
|
589
|
-
|
|
590
|
-
const [
|
|
588
|
+
), [hr, Ue] = M(() => Xe ?? !1), Sr = Xe === !1 ? hr : pr, ye = $(!1), ee = $(null), te = $(Z), jt = $(I), lt = $(null), ct = $([]);
|
|
589
|
+
jt.current = I;
|
|
590
|
+
const [Bt, Vt] = M(() => ({
|
|
591
591
|
key: I,
|
|
592
|
-
snapshot:
|
|
593
|
-
})),
|
|
592
|
+
snapshot: wn
|
|
593
|
+
})), vr = Bt.key === I ? Bt.snapshot : wn;
|
|
594
594
|
A(() => {
|
|
595
|
-
ye.current = !1, he.current = !1, Le({ workspaceId: e, creating: !1 }), xe({ workspaceId: e, failed: !1 })
|
|
595
|
+
ye.current = !1, he.current = !1, Le({ workspaceId: e, creating: !1 }), xe({ workspaceId: e, failed: !1 });
|
|
596
596
|
}, [e]), A(() => {
|
|
597
|
-
|
|
597
|
+
at(!1), ct.current = [];
|
|
598
598
|
}, [I]), A(() => {
|
|
599
599
|
if (!(!f || f.loading) && !Se && K === void 0) {
|
|
600
600
|
if (X.length > 0) {
|
|
601
601
|
ye.current = !1, he.current = !1, Le((t) => t.workspaceId === e && t.creating ? { workspaceId: e, creating: !1 } : t), xe((t) => t.workspaceId === e && t.failed ? { workspaceId: e, failed: !1 } : t);
|
|
602
602
|
return;
|
|
603
603
|
}
|
|
604
|
-
he.current || ye.current || (ye.current = !0, Le({ workspaceId: e, creating: !0 }), xe({ workspaceId: e, failed: !1 }), Promise.resolve(f.create({ title: k })).
|
|
605
|
-
const a = t == null ? void 0 : t.id;
|
|
606
|
-
typeof a == "string" && Ft({ workspaceId: e, id: a });
|
|
607
|
-
}).catch(() => {
|
|
604
|
+
he.current || ye.current || (ye.current = !0, Le({ workspaceId: e, creating: !0 }), xe({ workspaceId: e, failed: !1 }), Promise.resolve(f.create({ title: k })).catch(() => {
|
|
608
605
|
ye.current = !1, Le({ workspaceId: e, creating: !1 }), xe({ workspaceId: e, failed: !0 });
|
|
609
606
|
}));
|
|
610
607
|
}
|
|
611
608
|
}, [X.length, K, k, Se, f, e]), A(() => {
|
|
612
609
|
te.current = Z;
|
|
613
610
|
}, [Z]);
|
|
614
|
-
const
|
|
615
|
-
|
|
611
|
+
const zt = E((t) => {
|
|
612
|
+
lt.current = { key: I, api: t }, at(!0), Vt({
|
|
616
613
|
key: I,
|
|
617
614
|
snapshot: t.getSnapshot()
|
|
618
615
|
});
|
|
619
|
-
const a =
|
|
616
|
+
const a = ct.current.splice(0);
|
|
620
617
|
for (const l of a) l(t);
|
|
621
|
-
}, [I]),
|
|
622
|
-
|
|
623
|
-
}, []),
|
|
624
|
-
|
|
618
|
+
}, [I]), kt = E((t) => {
|
|
619
|
+
ct.current.push(t);
|
|
620
|
+
}, []), Yt = E((t) => {
|
|
621
|
+
Vt({
|
|
625
622
|
key: I,
|
|
626
623
|
snapshot: t
|
|
627
624
|
});
|
|
628
625
|
}, [I]), Ke = E(() => {
|
|
629
|
-
const t =
|
|
630
|
-
return (t == null ? void 0 : t.key) ===
|
|
631
|
-
}, []),
|
|
626
|
+
const t = lt.current;
|
|
627
|
+
return (t == null ? void 0 : t.key) === jt.current ? t.api : null;
|
|
628
|
+
}, []), Qt = E(() => te.current, []), Xt = E(() => {
|
|
632
629
|
te.current = !0, j(!0);
|
|
633
|
-
}, [j]),
|
|
630
|
+
}, [j]), Zt = E(() => {
|
|
634
631
|
te.current = !0, j(!0), be(!0), Ue(!0);
|
|
635
632
|
}, [j, be]), He = E(() => {
|
|
636
|
-
te.current = !1,
|
|
637
|
-
}, [j]),
|
|
633
|
+
te.current = !1, lt.current = null, at(!1), j(!1);
|
|
634
|
+
}, [j]), en = $(/* @__PURE__ */ new Set()), tn = E((t) => {
|
|
638
635
|
const a = t.meta;
|
|
639
636
|
if (!a || a.openOnlyWhenSessionOpen !== !0) return !0;
|
|
640
637
|
const l = typeof a.sessionId == "string" ? a.sessionId : null;
|
|
641
|
-
return l ?
|
|
638
|
+
return l ? en.current.has(l) : !1;
|
|
642
639
|
}, []), ce = L(() => ({
|
|
643
640
|
surface: Ke,
|
|
644
|
-
isWorkbenchOpen:
|
|
645
|
-
openWorkbench:
|
|
646
|
-
openWorkbenchSources:
|
|
641
|
+
isWorkbenchOpen: Qt,
|
|
642
|
+
openWorkbench: Xt,
|
|
643
|
+
openWorkbenchSources: Zt,
|
|
647
644
|
closeWorkbench: He,
|
|
648
|
-
enqueue:
|
|
649
|
-
shouldOpenSurface:
|
|
650
|
-
}), [Ke,
|
|
651
|
-
openFile: async (t) => (
|
|
645
|
+
enqueue: kt,
|
|
646
|
+
shouldOpenSurface: tn
|
|
647
|
+
}), [Ke, Qt, Xt, Zt, He, kt, tn]), br = L(() => ({
|
|
648
|
+
openFile: async (t) => (bn({ kind: "openFile", params: { path: t } }, ce), { seq: 0, status: "ok" }),
|
|
652
649
|
getActiveFile: () => {
|
|
653
650
|
var t;
|
|
654
651
|
return ((t = Ke()) == null ? void 0 : t.getSnapshot().activeTab) ?? null;
|
|
@@ -656,81 +653,81 @@ function Qs({
|
|
|
656
653
|
select: () => () => {
|
|
657
654
|
}
|
|
658
655
|
}), [Ke, ce]), ue = L(
|
|
659
|
-
() => (
|
|
660
|
-
[
|
|
661
|
-
),
|
|
656
|
+
() => (F == null ? void 0 : F.map(Ur)) ?? [],
|
|
657
|
+
[F]
|
|
658
|
+
), ut = L(
|
|
662
659
|
() => ue.some((t) => t.registrations.leftTabs.length > 0),
|
|
663
660
|
[ue]
|
|
664
|
-
),
|
|
661
|
+
), nn = L(
|
|
665
662
|
() => ue.flatMap((t) => t.registrations.panels.map((a) => a.id)),
|
|
666
663
|
[ue]
|
|
667
|
-
),
|
|
664
|
+
), rn = L(() => {
|
|
668
665
|
const t = {};
|
|
669
666
|
for (const a of ue)
|
|
670
667
|
for (const l of a.registrations.toolRenderers)
|
|
671
668
|
t[l.id] = l.render;
|
|
672
669
|
return t;
|
|
673
|
-
}, [ue]),
|
|
674
|
-
() => [...
|
|
675
|
-
[
|
|
676
|
-
), m = Q && !r && pe.workspaceId !== e ? "default" : G ?? (K !== void 0 ? "default" : ((
|
|
670
|
+
}, [ue]), sn = L(
|
|
671
|
+
() => [...Nt ?? [], ...nn],
|
|
672
|
+
[Nt, nn]
|
|
673
|
+
), m = Q && !r && pe.workspaceId !== e ? "default" : G ?? (K !== void 0 ? "default" : ((gn = U[0]) == null ? void 0 : gn.id) ?? "default"), on = !(f != null && f.hasMore) && !W;
|
|
677
674
|
A(() => {
|
|
678
|
-
var re,
|
|
675
|
+
var re, mn;
|
|
679
676
|
if (Ie) return;
|
|
680
677
|
const t = ee.current, a = new Set(U.map((H) => H.id)), l = t ? t.createdId ?? (a.has(m) && !t.knownIds.has(m) ? m : ((re = U.find((H) => !t.knownIds.has(H.id))) == null ? void 0 : re.id) ?? null) : null;
|
|
681
678
|
l && a.has(l) && (ee.current = null);
|
|
682
|
-
const g = m === "default" && K !== void 0, S =
|
|
679
|
+
const g = m === "default" && K !== void 0, S = on && a.size > 0 && !g, R = l ?? (S && !a.has(m) ? ((mn = U[0]) == null ? void 0 : mn.id) ?? m : m);
|
|
683
680
|
B((H) => {
|
|
684
681
|
const se = H.workspaceId === e ? H : { workspaceId: e, ids: [], activeId: null };
|
|
685
|
-
if (
|
|
686
|
-
const
|
|
687
|
-
return H.workspaceId === e && H.activeId ===
|
|
682
|
+
if (W && se.ids.length > 0 && !l) return se;
|
|
683
|
+
const pn = se.ids.length > 0 ? se.ids : [R], hn = S ? pn.filter((je) => a.has(je) || je === l) : pn, de = hn.length > 0 ? hn : [R], Sn = se.activeId && de.includes(se.activeId) ? se.activeId : de[0] ?? R, Ee = l ? Be(de, t == null ? void 0 : t.afterId, l) : R === Sn || de.includes(R) ? de : Rn(de, Sn, R), vn = Ee.includes(R) ? R : Ee[0] ?? R;
|
|
684
|
+
return H.workspaceId === e && H.activeId === vn && H.ids.length === Ee.length && H.ids.every((je, Lr) => je === Ee[Lr]) ? H : { workspaceId: e, ids: Ee, activeId: vn };
|
|
688
685
|
});
|
|
689
|
-
}, [K, m,
|
|
690
|
-
const
|
|
686
|
+
}, [K, m, W, Ie, U, on, e]);
|
|
687
|
+
const an = L(() => {
|
|
691
688
|
const t = /* @__PURE__ */ new Map();
|
|
692
689
|
for (const a of U) t.set(a.id, a.title);
|
|
693
690
|
return t;
|
|
694
|
-
}, [U]),
|
|
691
|
+
}, [U]), dt = D.workspaceId === e ? D : { ids: [], activeId: null }, ne = dt.ids.length > 0 ? dt.ids : [m];
|
|
695
692
|
A(() => {
|
|
696
|
-
|
|
693
|
+
en.current = new Set(ne);
|
|
697
694
|
}, [ne]);
|
|
698
|
-
const Pe =
|
|
695
|
+
const Pe = dt.activeId ?? ne[0] ?? m, yr = E((t) => {
|
|
699
696
|
const l = (D.workspaceId === e ? D : { ids: [m] }).ids.includes(t);
|
|
700
697
|
return B((g) => {
|
|
701
|
-
const S = g.workspaceId === e ? g : { ids: [m], activeId: m }, R = S.ids.includes(t) ? S.ids :
|
|
698
|
+
const S = g.workspaceId === e ? g : { ids: [m], activeId: m }, R = S.ids.includes(t) ? S.ids : Rn(S.ids, S.activeId, t);
|
|
702
699
|
return { workspaceId: e, ids: R, activeId: t };
|
|
703
700
|
}), l ? J(t) : $e(t);
|
|
704
|
-
}, [D, m, J, $e, e]),
|
|
701
|
+
}, [D, m, J, $e, e]), Pr = E((t) => (B((a) => {
|
|
705
702
|
const l = a.workspaceId === e ? a : { ids: [m], activeId: m };
|
|
706
703
|
return {
|
|
707
704
|
workspaceId: e,
|
|
708
705
|
ids: l.ids.includes(t) ? l.ids : Be(l.ids, l.activeId, t),
|
|
709
706
|
activeId: t
|
|
710
707
|
};
|
|
711
|
-
}), J(t)), [m, J, e]),
|
|
708
|
+
}), J(t)), [m, J, e]), ln = E((t) => ((D.workspaceId === e ? D : { ids: [m] }).ids.includes(t) && Ct({ workspaceId: e, id: t }), B((l) => {
|
|
712
709
|
const g = l.workspaceId === e ? l : { ids: [m], activeId: m };
|
|
713
710
|
return {
|
|
714
711
|
workspaceId: e,
|
|
715
712
|
ids: Be(g.ids, g.activeId, t),
|
|
716
713
|
activeId: t
|
|
717
714
|
};
|
|
718
|
-
}), J(t)), [D, m, J, e]),
|
|
715
|
+
}), J(t)), [D, m, J, e]), Er = E((t) => {
|
|
719
716
|
const a = D.workspaceId === e ? D : { ids: [m], activeId: m };
|
|
720
717
|
if (a.ids.length <= 1) return;
|
|
721
718
|
const l = a.ids.indexOf(t);
|
|
722
719
|
if (l < 0) return;
|
|
723
720
|
const g = a.ids.filter((R) => R !== t), S = a.activeId === t ? g[Math.max(0, l - 1)] ?? g[0] ?? null : a.activeId;
|
|
724
721
|
B({ workspaceId: e, ids: g, activeId: S }), S && a.activeId === t && J(S);
|
|
725
|
-
}, [D, m, J, e]),
|
|
722
|
+
}, [D, m, J, e]), Ar = E((t) => {
|
|
726
723
|
const a = {
|
|
727
724
|
afterId: t,
|
|
728
725
|
knownIds: new Set(U.map((g) => g.id))
|
|
729
726
|
};
|
|
730
727
|
ee.current = a;
|
|
731
|
-
const l =
|
|
728
|
+
const l = ot();
|
|
732
729
|
return Promise.resolve(l).then((g) => {
|
|
733
|
-
const S =
|
|
730
|
+
const S = fs(g);
|
|
734
731
|
S && (ee.current === a && (ee.current = { ...a, createdId: S }), B((R) => {
|
|
735
732
|
const re = R.workspaceId === e ? R : { ids: [m] };
|
|
736
733
|
return {
|
|
@@ -742,39 +739,39 @@ function Qs({
|
|
|
742
739
|
}).catch(() => {
|
|
743
740
|
ee.current === a && (ee.current = null);
|
|
744
741
|
}), l;
|
|
745
|
-
}, [m,
|
|
742
|
+
}, [m, ot, U, e]), Rr = E((t) => {
|
|
746
743
|
const a = D.workspaceId === e ? D : { ids: [m], activeId: m }, l = a.ids.indexOf(t);
|
|
747
744
|
let g = a.activeId;
|
|
748
745
|
if (l >= 0) {
|
|
749
746
|
const S = a.ids.filter((R) => R !== t);
|
|
750
747
|
g = a.activeId === t ? S[Math.max(0, l - 1)] ?? S[0] ?? null : a.activeId, B({ workspaceId: e, ids: S, activeId: g }), g && a.activeId === t && $e(g);
|
|
751
748
|
}
|
|
752
|
-
return
|
|
753
|
-
}, [D, m,
|
|
749
|
+
return Ht(t);
|
|
750
|
+
}, [D, m, Ht, $e, e]), [Tr, ft] = M(ae), cn = $(e);
|
|
754
751
|
A(() => {
|
|
755
|
-
if (
|
|
756
|
-
|
|
752
|
+
if (cn.current !== e) {
|
|
753
|
+
cn.current = e, ft(ae);
|
|
757
754
|
return;
|
|
758
755
|
}
|
|
759
|
-
ae &&
|
|
756
|
+
ae && ft(!0);
|
|
760
757
|
}, [ae, e]);
|
|
761
|
-
const
|
|
762
|
-
|
|
758
|
+
const un = ae && Q && !G, dn = !Tr && Ze !== !1 && (Q ? !!G : !0), wr = E((t) => {
|
|
759
|
+
Zn({ workspaceId: e, status: t }), we == null || we(t);
|
|
763
760
|
}, [we, e]);
|
|
764
761
|
A(() => {
|
|
765
762
|
var a;
|
|
766
763
|
const t = (l) => {
|
|
767
764
|
const g = l.detail;
|
|
768
|
-
!g || typeof g != "object" ||
|
|
765
|
+
!g || typeof g != "object" || bn(g, ce);
|
|
769
766
|
};
|
|
770
|
-
return (a = globalThis.addEventListener) == null || a.call(globalThis,
|
|
767
|
+
return (a = globalThis.addEventListener) == null || a.call(globalThis, yn, t), () => {
|
|
771
768
|
var l;
|
|
772
|
-
return (l = globalThis.removeEventListener) == null ? void 0 : l.call(globalThis,
|
|
769
|
+
return (l = globalThis.removeEventListener) == null ? void 0 : l.call(globalThis, yn, t);
|
|
773
770
|
};
|
|
774
771
|
}, [ce]), A(() => {
|
|
775
|
-
|
|
776
|
-
}, [G, Re,
|
|
777
|
-
const
|
|
772
|
+
W || Re == null || Re(G ?? null);
|
|
773
|
+
}, [G, Re, W]);
|
|
774
|
+
const gt = Me.status !== "ready", Nr = gt ? /* @__PURE__ */ d(ps, { status: Me }) : void 0, Je = E(async (t) => {
|
|
778
775
|
const a = `${(h == null ? void 0 : h.replace(/\/$/, "")) ?? ""}/api/v1/agent/reload`;
|
|
779
776
|
try {
|
|
780
777
|
const l = await fetch(a, {
|
|
@@ -785,7 +782,7 @@ function Qs({
|
|
|
785
782
|
if (!l.ok)
|
|
786
783
|
return (await l.json().catch(() => ({}))).error || `reload failed (${l.status})`;
|
|
787
784
|
const g = await l.json().catch(() => ({}));
|
|
788
|
-
return window.dispatchEvent(new CustomEvent(
|
|
785
|
+
return window.dispatchEvent(new CustomEvent(Kr, { detail: g })), vs(g);
|
|
789
786
|
} catch (l) {
|
|
790
787
|
return l instanceof Error ? l.message : "Agent plugin reload failed.";
|
|
791
788
|
}
|
|
@@ -794,7 +791,7 @@ function Qs({
|
|
|
794
791
|
const l = a.bridgeEnabled ?? !0, g = O != null && O.toolRenderers && typeof O.toolRenderers == "object" ? O.toolRenderers : void 0;
|
|
795
792
|
return {
|
|
796
793
|
...O,
|
|
797
|
-
...
|
|
794
|
+
...un ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
|
|
798
795
|
sessionId: t,
|
|
799
796
|
apiBaseUrl: h,
|
|
800
797
|
workspaceId: e,
|
|
@@ -802,14 +799,14 @@ function Qs({
|
|
|
802
799
|
requestHeaders: Y,
|
|
803
800
|
showSessions: !1,
|
|
804
801
|
onReloadAgentPlugins: (O == null ? void 0 : O.onReloadAgentPlugins) ?? (() => Je(t)),
|
|
805
|
-
toolRenderers: { ...
|
|
802
|
+
toolRenderers: { ...rn, ...g ?? {} },
|
|
806
803
|
bridgeEndpoint: l ? Ye : null,
|
|
807
804
|
surfaceDispatch: ce,
|
|
808
|
-
extraCommands:
|
|
805
|
+
extraCommands: Dt,
|
|
809
806
|
workspaceWarmupStatus: Me,
|
|
810
|
-
hydrateMessages:
|
|
807
|
+
hydrateMessages: dn,
|
|
811
808
|
onAutoSubmitInitialDraftSettled: () => {
|
|
812
|
-
le.current = !1,
|
|
809
|
+
le.current = !1, ft(!1), ve(void 0);
|
|
813
810
|
const S = O == null ? void 0 : O.onAutoSubmitInitialDraftSettled;
|
|
814
811
|
typeof S == "function" && S();
|
|
815
812
|
},
|
|
@@ -819,94 +816,94 @@ function Qs({
|
|
|
819
816
|
...nt !== void 0 ? { hotReloadEnabled: nt } : {}
|
|
820
817
|
};
|
|
821
818
|
},
|
|
822
|
-
[h, O,
|
|
823
|
-
),
|
|
819
|
+
[h, O, un, Y, Ye, ce, Dt, Me, dn, nt, rn, Je, e]
|
|
820
|
+
), Dr = L(
|
|
824
821
|
() => qe(m),
|
|
825
822
|
[m, qe]
|
|
826
|
-
),
|
|
823
|
+
), _r = L(() => ne.map((t) => ({
|
|
827
824
|
id: t,
|
|
828
|
-
title:
|
|
825
|
+
title: an.get(t) ?? (t === "default" ? k : t),
|
|
829
826
|
panel: "chat",
|
|
830
827
|
params: qe(t, { bridgeEnabled: t === Pe })
|
|
831
|
-
})), [Pe, ne, k, qe,
|
|
828
|
+
})), [Pe, ne, k, qe, an]), Or = L(() => ({
|
|
832
829
|
storageKey: I,
|
|
833
830
|
defaultLeftTab: Te,
|
|
834
|
-
initialPanels:
|
|
835
|
-
extraPanels:
|
|
831
|
+
initialPanels: wt,
|
|
832
|
+
extraPanels: sn,
|
|
836
833
|
onReloadAgentPlugins: () => Je(G ?? m),
|
|
837
|
-
onReady:
|
|
838
|
-
onChange:
|
|
834
|
+
onReady: zt,
|
|
835
|
+
onChange: Yt,
|
|
839
836
|
onClose: He
|
|
840
837
|
}), [
|
|
841
838
|
He,
|
|
842
839
|
Te,
|
|
843
|
-
|
|
840
|
+
wt,
|
|
844
841
|
Je,
|
|
845
842
|
G,
|
|
846
843
|
m,
|
|
847
|
-
Xt,
|
|
848
844
|
Yt,
|
|
845
|
+
zt,
|
|
849
846
|
I,
|
|
850
|
-
|
|
847
|
+
sn,
|
|
851
848
|
j
|
|
852
849
|
]);
|
|
853
850
|
return /* @__PURE__ */ d("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ Ae(
|
|
854
|
-
|
|
851
|
+
Hr,
|
|
855
852
|
{
|
|
856
|
-
chatPanel:
|
|
853
|
+
chatPanel: nr,
|
|
857
854
|
panels: y,
|
|
858
855
|
commands: b,
|
|
859
856
|
catalogs: q,
|
|
860
|
-
plugins:
|
|
857
|
+
plugins: F,
|
|
861
858
|
excludeDefaults: z,
|
|
862
859
|
capabilities: T,
|
|
863
860
|
apiBaseUrl: h,
|
|
864
|
-
authHeaders:
|
|
861
|
+
authHeaders: Xn,
|
|
865
862
|
apiTimeout: p,
|
|
866
863
|
activeSessionId: Pe,
|
|
867
864
|
openSessionIds: ne,
|
|
868
865
|
defaultTheme: N,
|
|
869
|
-
onThemeChange:
|
|
866
|
+
onThemeChange: Wn,
|
|
870
867
|
workspaceId: e,
|
|
871
|
-
workspaceLabel:
|
|
872
|
-
appTitle:
|
|
868
|
+
workspaceLabel: $n,
|
|
869
|
+
appTitle: Rt,
|
|
873
870
|
storageKey: rt,
|
|
874
|
-
persistenceEnabled:
|
|
875
|
-
debug:
|
|
871
|
+
persistenceEnabled: bt,
|
|
872
|
+
debug: Fn,
|
|
876
873
|
bridgeEndpoint: null,
|
|
877
|
-
onAuthError:
|
|
878
|
-
frontPluginHotReload:
|
|
879
|
-
fullPageBasePath:
|
|
874
|
+
onAuthError: Gn,
|
|
875
|
+
frontPluginHotReload: Qn,
|
|
876
|
+
fullPageBasePath: In,
|
|
880
877
|
children: [
|
|
881
878
|
u,
|
|
882
879
|
/* @__PURE__ */ d(
|
|
883
|
-
|
|
880
|
+
ds,
|
|
884
881
|
{
|
|
885
882
|
workspaceId: e,
|
|
886
883
|
requestHeaders: Y,
|
|
887
884
|
apiBaseUrl: h,
|
|
888
|
-
preloadPaths:
|
|
885
|
+
preloadPaths: zn,
|
|
889
886
|
provisionWorkspace: Ze,
|
|
890
|
-
onStatusChange:
|
|
887
|
+
onStatusChange: wr
|
|
891
888
|
}
|
|
892
889
|
),
|
|
893
890
|
/* @__PURE__ */ d(
|
|
894
|
-
|
|
891
|
+
ws,
|
|
895
892
|
{
|
|
896
893
|
bridgeEndpoint: Ye,
|
|
897
894
|
requestHeaders: Y,
|
|
898
|
-
navOpen:
|
|
895
|
+
navOpen: qt,
|
|
899
896
|
surfaceOpen: Z,
|
|
900
|
-
surfaceReady:
|
|
901
|
-
snapshot:
|
|
897
|
+
surfaceReady: mr,
|
|
898
|
+
snapshot: vr
|
|
902
899
|
}
|
|
903
900
|
),
|
|
904
901
|
/* @__PURE__ */ Ae("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
905
902
|
/* @__PURE__ */ d(
|
|
906
|
-
|
|
903
|
+
Br,
|
|
907
904
|
{
|
|
908
|
-
appTitle:
|
|
909
|
-
sessionTitle: Ie ? "Loading sessions…" :
|
|
905
|
+
appTitle: Rt,
|
|
906
|
+
sessionTitle: Ie ? "Loading sessions…" : fr ?? k,
|
|
910
907
|
onCommandPalette: () => {
|
|
911
908
|
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
912
909
|
key: "k",
|
|
@@ -916,49 +913,49 @@ function Qs({
|
|
|
916
913
|
cancelable: !0
|
|
917
914
|
}));
|
|
918
915
|
},
|
|
919
|
-
topBarLeft:
|
|
916
|
+
topBarLeft: Hn,
|
|
920
917
|
topBarRight: /* @__PURE__ */ Ae(fe, { children: [
|
|
921
|
-
|
|
922
|
-
|
|
918
|
+
qn ? /* @__PURE__ */ d(Zr, {}) : null,
|
|
919
|
+
Jn
|
|
923
920
|
] })
|
|
924
921
|
}
|
|
925
922
|
),
|
|
926
|
-
Ie ? /* @__PURE__ */ d(
|
|
927
|
-
|
|
923
|
+
Ie ? /* @__PURE__ */ d(Es, {}) : /* @__PURE__ */ d(
|
|
924
|
+
Vr,
|
|
928
925
|
{
|
|
929
|
-
className:
|
|
930
|
-
nav:
|
|
926
|
+
className: Yn,
|
|
927
|
+
nav: qt ? "session-list" : null,
|
|
931
928
|
navParams: {
|
|
932
929
|
sessions: U,
|
|
933
930
|
activeId: Pe,
|
|
934
931
|
openIds: ne,
|
|
935
|
-
pinnedIds:
|
|
936
|
-
onTogglePin:
|
|
937
|
-
onSwitch:
|
|
938
|
-
onOpenAsTab:
|
|
939
|
-
onCreate:
|
|
940
|
-
onDelete:
|
|
932
|
+
pinnedIds: er,
|
|
933
|
+
onTogglePin: tr,
|
|
934
|
+
onSwitch: yr,
|
|
935
|
+
onOpenAsTab: ln,
|
|
936
|
+
onCreate: ot,
|
|
937
|
+
onDelete: Rr,
|
|
941
938
|
onLoadMore: f == null ? void 0 : f.loadMore,
|
|
942
939
|
hasMore: f == null ? void 0 : f.hasMore,
|
|
943
940
|
loadingMore: f == null ? void 0 : f.loadingMore,
|
|
944
|
-
onClose: () =>
|
|
941
|
+
onClose: () => Jt(!1)
|
|
945
942
|
},
|
|
946
943
|
center: "chat",
|
|
947
|
-
centerParams:
|
|
948
|
-
chatPanes:
|
|
944
|
+
centerParams: Dr,
|
|
945
|
+
chatPanes: _r,
|
|
949
946
|
activeChatPaneId: Pe,
|
|
950
|
-
onActiveChatPaneChange:
|
|
951
|
-
onCloseChatPane:
|
|
952
|
-
onCreateChatPaneAfter:
|
|
953
|
-
onDropChatSession:
|
|
947
|
+
onActiveChatPaneChange: Pr,
|
|
948
|
+
onCloseChatPane: Er,
|
|
949
|
+
onCreateChatPaneAfter: Ar,
|
|
950
|
+
onDropChatSession: ln,
|
|
954
951
|
flashChatPaneId: (ie == null ? void 0 : ie.workspaceId) === e ? ie.id : null,
|
|
955
952
|
surface: Z ? "artifact-surface" : null,
|
|
956
|
-
surfaceParams:
|
|
957
|
-
surfaceOverlay:
|
|
958
|
-
sidebar: Z && !
|
|
959
|
-
sidebarParams: Z && !
|
|
953
|
+
surfaceParams: Or,
|
|
954
|
+
surfaceOverlay: Nr,
|
|
955
|
+
sidebar: Z && !gt && ut && Sr ? "workbench-left" : null,
|
|
956
|
+
sidebarParams: Z && !gt && ut ? {
|
|
960
957
|
...Te ? { defaultTab: Te } : {},
|
|
961
|
-
bridge:
|
|
958
|
+
bridge: br,
|
|
962
959
|
onClose: () => {
|
|
963
960
|
be(!1), Ue(!1);
|
|
964
961
|
},
|
|
@@ -967,14 +964,14 @@ function Qs({
|
|
|
967
964
|
}
|
|
968
965
|
} : void 0,
|
|
969
966
|
storageKey: C ? Ne : void 0,
|
|
970
|
-
onOpenNav:
|
|
971
|
-
|
|
967
|
+
onOpenNav: Tt ? () => {
|
|
968
|
+
Jt(!0), et == null || et();
|
|
972
969
|
} : void 0,
|
|
973
970
|
onOpenSurface: () => {
|
|
974
971
|
te.current = !0, j(!0), tt == null || tt();
|
|
975
972
|
},
|
|
976
|
-
surfaceButtonBottomOffset:
|
|
977
|
-
onOpenSidebar:
|
|
973
|
+
surfaceButtonBottomOffset: kn,
|
|
974
|
+
onOpenSidebar: ut ? () => {
|
|
978
975
|
te.current = !0, j(!0), be(!0), Ue(!0);
|
|
979
976
|
} : void 0
|
|
980
977
|
}
|
|
@@ -985,8 +982,8 @@ function Qs({
|
|
|
985
982
|
}
|
|
986
983
|
) });
|
|
987
984
|
}
|
|
988
|
-
const
|
|
989
|
-
function
|
|
985
|
+
const Ns = 500;
|
|
986
|
+
function Ds(e) {
|
|
990
987
|
return new Promise((n, r) => {
|
|
991
988
|
let s;
|
|
992
989
|
const i = () => {
|
|
@@ -1000,48 +997,48 @@ function Os(e) {
|
|
|
1000
997
|
}
|
|
1001
998
|
s = globalThis.setTimeout(() => {
|
|
1002
999
|
i(), n();
|
|
1003
|
-
},
|
|
1000
|
+
}, Ns), e.addEventListener("abort", o, { once: !0 });
|
|
1004
1001
|
});
|
|
1005
1002
|
}
|
|
1006
|
-
function
|
|
1003
|
+
function ks({
|
|
1007
1004
|
workspaceId: e,
|
|
1008
1005
|
requestHeaders: n,
|
|
1009
1006
|
apiBaseUrl: r,
|
|
1010
|
-
preloadPaths: s =
|
|
1007
|
+
preloadPaths: s = _n,
|
|
1011
1008
|
provisionWorkspace: i = !0,
|
|
1012
1009
|
loadingFallback: o,
|
|
1013
1010
|
errorFallback: c,
|
|
1014
1011
|
children: u
|
|
1015
1012
|
}) {
|
|
1016
|
-
const [v, y] =
|
|
1013
|
+
const [v, y] = M({
|
|
1017
1014
|
status: "loading",
|
|
1018
1015
|
label: "Waking workspace runtime"
|
|
1019
1016
|
});
|
|
1020
1017
|
return A(() => {
|
|
1021
1018
|
const b = new AbortController(), q = ze(e, n);
|
|
1022
|
-
async function
|
|
1023
|
-
const h = await fetch(
|
|
1019
|
+
async function F(T) {
|
|
1020
|
+
const h = await fetch(Ln(r, T), {
|
|
1024
1021
|
headers: q,
|
|
1025
1022
|
signal: b.signal
|
|
1026
1023
|
}), w = await ke(h);
|
|
1027
1024
|
if (!h.ok) {
|
|
1028
|
-
if (
|
|
1029
|
-
throw new Error(
|
|
1025
|
+
if (St(w)) return "preparing";
|
|
1026
|
+
throw new Error(vt(w) ?? `${T} failed with ${h.status}`);
|
|
1030
1027
|
}
|
|
1031
|
-
if (
|
|
1028
|
+
if (xn(T)) {
|
|
1032
1029
|
const N = Ve(w);
|
|
1033
1030
|
if ((N == null ? void 0 : N.state) === "degraded") throw new Error(N.message ?? "Workspace failed to prepare");
|
|
1034
1031
|
}
|
|
1035
|
-
return
|
|
1032
|
+
return Jr(T) !== null && w && typeof w == "object" && Mn(r, q["x-boring-workspace-id"] ?? e, T, w), "ready";
|
|
1036
1033
|
}
|
|
1037
1034
|
async function z() {
|
|
1038
1035
|
y({ status: "loading", label: "Waking workspace runtime" });
|
|
1039
1036
|
try {
|
|
1040
|
-
const T =
|
|
1041
|
-
let h = await Promise.all(T.map(async (p) => ({ path: p, status: await
|
|
1037
|
+
const T = On(s, i);
|
|
1038
|
+
let h = await Promise.all(T.map(async (p) => ({ path: p, status: await F(p) }))), w = h.filter((p) => p.status === "preparing").map((p) => p.path);
|
|
1042
1039
|
for (; w.length > 0; ) {
|
|
1043
|
-
if (y({ status: "loading", label: "Workspace is still preparing" }), await
|
|
1044
|
-
h = await Promise.all(w.map(async (p) => ({ path: p, status: await
|
|
1040
|
+
if (y({ status: "loading", label: "Workspace is still preparing" }), await Ds(b.signal), b.signal.aborted) return;
|
|
1041
|
+
h = await Promise.all(w.map(async (p) => ({ path: p, status: await F(p) }))), w = h.filter((p) => p.status === "preparing").map((p) => p.path);
|
|
1045
1042
|
}
|
|
1046
1043
|
b.signal.aborted || y({ status: "ready" });
|
|
1047
1044
|
} catch (T) {
|
|
@@ -1054,14 +1051,14 @@ function Xs({
|
|
|
1054
1051
|
}
|
|
1055
1052
|
return z(), () => b.abort();
|
|
1056
1053
|
}, [r, s, i, n, e]), v.status === "ready" ? /* @__PURE__ */ d(fe, { children: u }) : v.status === "error" ? typeof c == "function" ? /* @__PURE__ */ d(fe, { children: c(v.message) }) : c ? /* @__PURE__ */ d(fe, { children: c }) : /* @__PURE__ */ d(
|
|
1057
|
-
|
|
1054
|
+
En,
|
|
1058
1055
|
{
|
|
1059
1056
|
title: "Workspace failed to open",
|
|
1060
1057
|
description: v.message,
|
|
1061
1058
|
status: "Retry by reloading the page"
|
|
1062
1059
|
}
|
|
1063
1060
|
) : typeof o == "function" ? /* @__PURE__ */ d(fe, { children: o(v.label) }) : o ? /* @__PURE__ */ d(fe, { children: o }) : /* @__PURE__ */ d(
|
|
1064
|
-
|
|
1061
|
+
En,
|
|
1065
1062
|
{
|
|
1066
1063
|
title: "Opening workspace",
|
|
1067
1064
|
description: "Preparing secure runtime, files, sessions, and layout.",
|
|
@@ -1069,11 +1066,11 @@ function Xs({
|
|
|
1069
1066
|
}
|
|
1070
1067
|
);
|
|
1071
1068
|
}
|
|
1072
|
-
const
|
|
1073
|
-
function
|
|
1069
|
+
const _s = "FULL_PAGE_PANEL_MISSING_COMPONENT", Os = "FULL_PAGE_PANEL_INVALID_PARAMS_JSON", Ls = "FULL_PAGE_PANEL_PARAMS_NOT_OBJECT", xs = "FULL_PAGE_PANEL_UNKNOWN_COMPONENT", Ms = "FULL_PAGE_PANEL_NOT_SUPPORTED", Cs = "FULL_PAGE_PANEL_RENDER_FAILED";
|
|
1070
|
+
function x() {
|
|
1074
1071
|
}
|
|
1075
|
-
const
|
|
1076
|
-
function
|
|
1072
|
+
const Ws = { dispose: x }, P = () => Ws;
|
|
1073
|
+
function Fs(e) {
|
|
1077
1074
|
return {
|
|
1078
1075
|
id: `full-page:${e}`,
|
|
1079
1076
|
title: e,
|
|
@@ -1083,19 +1080,19 @@ function Gs(e) {
|
|
|
1083
1080
|
width: 0,
|
|
1084
1081
|
height: 0,
|
|
1085
1082
|
location: { type: "grid", referenceGroup: void 0 },
|
|
1086
|
-
setActive:
|
|
1083
|
+
setActive: x,
|
|
1087
1084
|
setTitle: (n) => {
|
|
1088
1085
|
document.title = n;
|
|
1089
1086
|
},
|
|
1090
|
-
setSize:
|
|
1087
|
+
setSize: x,
|
|
1091
1088
|
close: () => {
|
|
1092
1089
|
window.close();
|
|
1093
1090
|
},
|
|
1094
|
-
moveTo:
|
|
1095
|
-
maximize:
|
|
1096
|
-
exitMaximized:
|
|
1091
|
+
moveTo: x,
|
|
1092
|
+
maximize: x,
|
|
1093
|
+
exitMaximized: x,
|
|
1097
1094
|
isMaximized: () => !1,
|
|
1098
|
-
minimize:
|
|
1095
|
+
minimize: x,
|
|
1099
1096
|
onDidActiveChange: P,
|
|
1100
1097
|
onDidVisibilityChange: P,
|
|
1101
1098
|
onDidDimensionsChange: P,
|
|
@@ -1107,7 +1104,7 @@ function Gs(e) {
|
|
|
1107
1104
|
onWillFocus: P
|
|
1108
1105
|
};
|
|
1109
1106
|
}
|
|
1110
|
-
function
|
|
1107
|
+
function Is() {
|
|
1111
1108
|
return {
|
|
1112
1109
|
width: window.innerWidth,
|
|
1113
1110
|
height: window.innerHeight,
|
|
@@ -1119,20 +1116,20 @@ function $s() {
|
|
|
1119
1116
|
panels: [],
|
|
1120
1117
|
groups: [],
|
|
1121
1118
|
activeGroup: void 0,
|
|
1122
|
-
addPanel:
|
|
1123
|
-
addGroup:
|
|
1124
|
-
removePanel:
|
|
1125
|
-
removeGroup:
|
|
1119
|
+
addPanel: x,
|
|
1120
|
+
addGroup: x,
|
|
1121
|
+
removePanel: x,
|
|
1122
|
+
removeGroup: x,
|
|
1126
1123
|
getPanel: () => {
|
|
1127
1124
|
},
|
|
1128
1125
|
getGroup: () => {
|
|
1129
1126
|
},
|
|
1130
|
-
moveGroupOrPanel:
|
|
1131
|
-
fromJSON:
|
|
1127
|
+
moveGroupOrPanel: x,
|
|
1128
|
+
fromJSON: x,
|
|
1132
1129
|
toJSON: () => ({}),
|
|
1133
|
-
clear:
|
|
1134
|
-
focus:
|
|
1135
|
-
layout:
|
|
1130
|
+
clear: x,
|
|
1131
|
+
focus: x,
|
|
1132
|
+
layout: x,
|
|
1136
1133
|
onDidLayoutChange: P,
|
|
1137
1134
|
onDidLayoutFromJSON: P,
|
|
1138
1135
|
onDidAddPanel: P,
|
|
@@ -1149,26 +1146,26 @@ function $s() {
|
|
|
1149
1146
|
onDidActivePanelChange_: P
|
|
1150
1147
|
};
|
|
1151
1148
|
}
|
|
1152
|
-
function
|
|
1149
|
+
function ht({ code: e, title: n, description: r }) {
|
|
1153
1150
|
return /* @__PURE__ */ d(
|
|
1154
1151
|
"div",
|
|
1155
1152
|
{
|
|
1156
1153
|
className: "flex min-h-screen items-center justify-center bg-background p-6 text-foreground",
|
|
1157
1154
|
"data-testid": "full-page-error-state",
|
|
1158
1155
|
"data-full-page-error-code": e,
|
|
1159
|
-
children: /* @__PURE__ */ d(
|
|
1156
|
+
children: /* @__PURE__ */ d(Xr, { className: "w-full max-w-lg", title: n, description: r })
|
|
1160
1157
|
}
|
|
1161
1158
|
);
|
|
1162
1159
|
}
|
|
1163
|
-
function
|
|
1164
|
-
const r =
|
|
1165
|
-
|
|
1160
|
+
function Ys({ componentId: e, params: n = {} }) {
|
|
1161
|
+
const r = Cn(), { errors: s } = qr(), i = r.get(e), o = r.getComponents()[e];
|
|
1162
|
+
Mr(() => {
|
|
1166
1163
|
document.title = (i == null ? void 0 : i.title) ?? e;
|
|
1167
1164
|
}, [e, i == null ? void 0 : i.title]);
|
|
1168
1165
|
const c = L(() => ({
|
|
1169
1166
|
params: n,
|
|
1170
|
-
api:
|
|
1171
|
-
containerApi:
|
|
1167
|
+
api: Fs(e),
|
|
1168
|
+
containerApi: Is(),
|
|
1172
1169
|
className: "h-full"
|
|
1173
1170
|
}), [e, n]), u = L(() => {
|
|
1174
1171
|
if (!i) return null;
|
|
@@ -1181,29 +1178,29 @@ function Zs({ componentId: e, params: n = {} }) {
|
|
|
1181
1178
|
return null;
|
|
1182
1179
|
}, [e, s, i]);
|
|
1183
1180
|
return i ? !i.supportsFullPage || !o ? /* @__PURE__ */ d(
|
|
1184
|
-
|
|
1181
|
+
ht,
|
|
1185
1182
|
{
|
|
1186
|
-
code:
|
|
1183
|
+
code: Ms,
|
|
1187
1184
|
title: "Panel does not support full-page mode",
|
|
1188
1185
|
description: `Panel "${e}" can render in the workspace, but it has not opted into the dedicated full-page pane route.`
|
|
1189
1186
|
}
|
|
1190
1187
|
) : u ? /* @__PURE__ */ d(
|
|
1191
|
-
|
|
1188
|
+
ht,
|
|
1192
1189
|
{
|
|
1193
|
-
code:
|
|
1190
|
+
code: Cs,
|
|
1194
1191
|
title: "Panel failed to render",
|
|
1195
1192
|
description: `Panel "${e}" crashed while rendering in full-page mode: ${u.error.message}`
|
|
1196
1193
|
}
|
|
1197
|
-
) : /* @__PURE__ */ d("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ d(
|
|
1198
|
-
|
|
1194
|
+
) : /* @__PURE__ */ d("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ d(jr, { mode: "full-page", children: /* @__PURE__ */ d(o, { ...c }) }) }) : /* @__PURE__ */ d(
|
|
1195
|
+
ht,
|
|
1199
1196
|
{
|
|
1200
|
-
code:
|
|
1197
|
+
code: xs,
|
|
1201
1198
|
title: "Unknown panel",
|
|
1202
1199
|
description: `No full-page panel component is registered as "${e}".`
|
|
1203
1200
|
}
|
|
1204
1201
|
);
|
|
1205
1202
|
}
|
|
1206
|
-
function
|
|
1203
|
+
function Qs(e) {
|
|
1207
1204
|
var o;
|
|
1208
1205
|
const n = new URLSearchParams(e), r = ((o = n.get("component")) == null ? void 0 : o.trim()) ?? "";
|
|
1209
1206
|
if (!r)
|
|
@@ -1211,7 +1208,7 @@ function ei(e) {
|
|
|
1211
1208
|
componentId: null,
|
|
1212
1209
|
params: {},
|
|
1213
1210
|
error: {
|
|
1214
|
-
code:
|
|
1211
|
+
code: _s,
|
|
1215
1212
|
message: "Missing full-page panel component id."
|
|
1216
1213
|
}
|
|
1217
1214
|
};
|
|
@@ -1226,7 +1223,7 @@ function ei(e) {
|
|
|
1226
1223
|
componentId: null,
|
|
1227
1224
|
params: {},
|
|
1228
1225
|
error: {
|
|
1229
|
-
code:
|
|
1226
|
+
code: Os,
|
|
1230
1227
|
message: "Invalid full-page panel params JSON."
|
|
1231
1228
|
}
|
|
1232
1229
|
};
|
|
@@ -1235,23 +1232,23 @@ function ei(e) {
|
|
|
1235
1232
|
componentId: null,
|
|
1236
1233
|
params: {},
|
|
1237
1234
|
error: {
|
|
1238
|
-
code:
|
|
1235
|
+
code: Ls,
|
|
1239
1236
|
message: "Full-page panel params must be a JSON object."
|
|
1240
1237
|
}
|
|
1241
1238
|
} : { componentId: r, params: i };
|
|
1242
1239
|
}
|
|
1243
1240
|
export {
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1241
|
+
Os as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
|
|
1242
|
+
_s as FULL_PAGE_PANEL_MISSING_COMPONENT,
|
|
1243
|
+
Ms as FULL_PAGE_PANEL_NOT_SUPPORTED,
|
|
1244
|
+
Ls as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
|
|
1245
|
+
Cs as FULL_PAGE_PANEL_RENDER_FAILED,
|
|
1246
|
+
xs as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
|
|
1247
|
+
zs as WorkspaceAgentFront,
|
|
1248
|
+
ds as WorkspaceBackgroundBoot,
|
|
1249
|
+
ks as WorkspaceBootGate,
|
|
1250
|
+
Ys as WorkspaceFullPagePanel,
|
|
1251
|
+
rs as createLocalStorageSessions,
|
|
1252
|
+
Qs as parseFullPagePanelLocation,
|
|
1253
|
+
ss as useLocalStorageSessions
|
|
1257
1254
|
};
|