@hachej/boring-workspace 0.1.35 → 0.1.36
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-CkCxHBDu.js → FileTree-GkaIEJ9n.js} +1 -1
- package/dist/{MarkdownEditor-CtPphEVP.js → MarkdownEditor-DjZZnHcU.js} +1 -1
- package/dist/{WorkspaceLoadingState-Bl-92Dly.js → WorkspaceLoadingState-C664sU-y.js} +12 -13
- package/dist/{WorkspaceProvider-BhRPFy5R.js → WorkspaceProvider-CpK401MG.js} +1847 -1961
- package/dist/agent-tool-CB0RQyx9.d.ts +32 -0
- package/dist/app-front.d.ts +1 -20
- package/dist/app-front.js +396 -388
- package/dist/app-server.d.ts +4 -3
- package/dist/app-server.js +26 -0
- package/dist/{createInMemoryBridge-zb8MpO60.d.ts → createInMemoryBridge-e7QdNLSA.d.ts} +2 -1
- package/dist/plugin.d.ts +65 -1
- package/dist/plugin.js +39 -0
- package/dist/server.d.ts +14 -5
- package/dist/server.js +10 -0
- package/dist/shared.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/dist/{ui-bridge-DFNem0df.d.ts → ui-bridge-LeBuZqfA.d.ts} +1 -32
- package/dist/workspace.css +0 -33
- package/dist/workspace.d.ts +0 -19
- package/dist/workspace.js +5 -5
- package/package.json +4 -4
package/dist/app-front.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as f, jsxs as ye, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { PiChatPanel as
|
|
4
|
-
import { aj as
|
|
5
|
-
import { T as
|
|
6
|
-
import { Sun as Mr, Moon as
|
|
7
|
-
import { IconButton as Wr, ErrorState as
|
|
8
|
-
function
|
|
9
|
-
const { theme: e, toggleTheme: n } =
|
|
10
|
-
return
|
|
2
|
+
import { useEffect as A, useSyncExternalStore as vr, useMemo as C, useState as O, useCallback as w, useRef as j, useLayoutEffect as Sr } from "react";
|
|
3
|
+
import { PiChatPanel as br, usePiSessions as yr } from "@hachej/boring-agent/front";
|
|
4
|
+
import { aj as Pr, at as qe, au as bn, av as yn, aw as Pn, ax as An, ay as ze, az as pt, aA as ht, aB as En, aC as Ar, aD as He, aE as Er, U as un, aF as wr, q as Tr, aG as Nr, u as wn, aH as Dr, ag as Rr, aI as _r } from "./WorkspaceProvider-CpK401MG.js";
|
|
5
|
+
import { T as Lr, C as Or, r as dn, w as xr, W as fn } from "./WorkspaceLoadingState-C664sU-y.js";
|
|
6
|
+
import { Sun as Mr, Moon as Cr } from "lucide-react";
|
|
7
|
+
import { IconButton as Wr, ErrorState as Fr } from "@hachej/boring-ui-kit";
|
|
8
|
+
function Gr() {
|
|
9
|
+
const { theme: e, toggleTheme: n } = Pr(), r = e === "dark";
|
|
10
|
+
return A(() => {
|
|
11
11
|
typeof document > "u" || document.documentElement.classList.toggle("dark", r);
|
|
12
12
|
}, [r]), /* @__PURE__ */ f(
|
|
13
13
|
Wr,
|
|
@@ -18,53 +18,53 @@ function Ir() {
|
|
|
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__ */ f(Mr, { className: "h-4 w-4" }) : /* @__PURE__ */ f(
|
|
21
|
+
children: r ? /* @__PURE__ */ f(Mr, { className: "h-4 w-4" }) : /* @__PURE__ */ f(Cr, { className: "h-4 w-4" })
|
|
22
22
|
}
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function Ir() {
|
|
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 $r(e, n) {
|
|
33
33
|
var r;
|
|
34
34
|
if (typeof localStorage > "u") return n();
|
|
35
35
|
try {
|
|
36
36
|
const i = localStorage.getItem(e);
|
|
37
37
|
if (i) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return { sessions:
|
|
38
|
+
const o = JSON.parse(i), s = Array.isArray(o.sessions) ? o.sessions : Array.isArray(o.items) ? o.items : null;
|
|
39
|
+
if (s)
|
|
40
|
+
return { sessions: s, activeId: o.activeId ?? ((r = s[0]) == null ? void 0 : r.id) ?? "" };
|
|
41
41
|
}
|
|
42
42
|
} catch {
|
|
43
43
|
}
|
|
44
44
|
return n();
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Ur(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 i =
|
|
56
|
-
const
|
|
57
|
-
i = c,
|
|
53
|
+
function Kr(e = {}) {
|
|
54
|
+
const n = e.storageKey ?? "workspace:sessions", r = e.initial ?? Ir;
|
|
55
|
+
let i = $r(n, r);
|
|
56
|
+
const o = /* @__PURE__ */ new Set(), s = (c) => {
|
|
57
|
+
i = c, Ur(n, i), o.forEach((u) => u());
|
|
58
58
|
};
|
|
59
59
|
return {
|
|
60
60
|
getState: () => i,
|
|
61
61
|
subscribe(c) {
|
|
62
|
-
return
|
|
63
|
-
|
|
62
|
+
return o.add(c), () => {
|
|
63
|
+
o.delete(c);
|
|
64
64
|
};
|
|
65
65
|
},
|
|
66
66
|
switchTo(c) {
|
|
67
|
-
|
|
67
|
+
s({ ...i, activeId: c });
|
|
68
68
|
},
|
|
69
69
|
create() {
|
|
70
70
|
const c = `s${Date.now()}`, u = {
|
|
@@ -72,51 +72,51 @@ function Jr(e = {}) {
|
|
|
72
72
|
title: "New session",
|
|
73
73
|
updatedAt: Date.now()
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
s({ sessions: [u, ...i.sessions], activeId: c });
|
|
76
76
|
},
|
|
77
77
|
remove(c) {
|
|
78
|
-
var
|
|
79
|
-
const u = i.sessions.filter((b) => b.id !== c),
|
|
80
|
-
|
|
78
|
+
var y;
|
|
79
|
+
const u = i.sessions.filter((b) => b.id !== c), S = i.activeId === c ? ((y = u[0]) == null ? void 0 : y.id) ?? "" : i.activeId;
|
|
80
|
+
s({ sessions: u, activeId: S });
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
return
|
|
84
|
+
function Jr(e) {
|
|
85
|
+
return vr(e.subscribe, e.getState, e.getState);
|
|
86
86
|
}
|
|
87
|
-
const Br =
|
|
87
|
+
const jr = 500, Br = 1e4;
|
|
88
88
|
function gn(e) {
|
|
89
89
|
return new Promise((n, r) => {
|
|
90
90
|
let i;
|
|
91
|
-
const
|
|
92
|
-
i && globalThis.clearTimeout(i), e.removeEventListener("abort",
|
|
93
|
-
},
|
|
94
|
-
|
|
91
|
+
const o = () => {
|
|
92
|
+
i && globalThis.clearTimeout(i), e.removeEventListener("abort", s);
|
|
93
|
+
}, s = () => {
|
|
94
|
+
o(), r(new DOMException("Warmup aborted", "AbortError"));
|
|
95
95
|
};
|
|
96
96
|
if (e.aborted) {
|
|
97
|
-
|
|
97
|
+
s();
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
i = globalThis.setTimeout(() => {
|
|
101
|
-
|
|
102
|
-
},
|
|
101
|
+
o(), n();
|
|
102
|
+
}, jr), e.addEventListener("abort", s, { once: !0 });
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
async function Hr(e) {
|
|
106
106
|
const n = e.body;
|
|
107
107
|
if (!n) return He(await ze(e));
|
|
108
108
|
const r = n.getReader(), i = new TextDecoder();
|
|
109
|
-
let
|
|
109
|
+
let o = "";
|
|
110
110
|
try {
|
|
111
111
|
for (; ; ) {
|
|
112
|
-
const { done:
|
|
112
|
+
const { done: s, value: c } = await r.read();
|
|
113
113
|
if (c) {
|
|
114
|
-
|
|
115
|
-
const u = He(
|
|
114
|
+
o += i.decode(c, { stream: !s });
|
|
115
|
+
const u = He(o);
|
|
116
116
|
if (u) return u;
|
|
117
117
|
}
|
|
118
|
-
if (
|
|
119
|
-
return
|
|
118
|
+
if (s)
|
|
119
|
+
return o += i.decode(), He(o);
|
|
120
120
|
}
|
|
121
121
|
} finally {
|
|
122
122
|
await r.cancel().catch(() => {
|
|
@@ -133,11 +133,11 @@ function qr(e) {
|
|
|
133
133
|
}
|
|
134
134
|
async function zr(e) {
|
|
135
135
|
if (!e.ok) {
|
|
136
|
-
const
|
|
137
|
-
if (pt(
|
|
138
|
-
throw new Error(ht(
|
|
136
|
+
const o = await ze(e);
|
|
137
|
+
if (pt(o)) return { status: "preparing" };
|
|
138
|
+
throw new Error(ht(o) ?? `/api/v1/ready-status failed with ${e.status}`);
|
|
139
139
|
}
|
|
140
|
-
const n = await Hr(e), r = qr(n), i =
|
|
140
|
+
const n = await Hr(e), r = qr(n), i = Ar(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 };
|
|
@@ -150,85 +150,95 @@ async function Vr({
|
|
|
150
150
|
path: n,
|
|
151
151
|
headers: r,
|
|
152
152
|
signal: i,
|
|
153
|
-
workspaceId:
|
|
153
|
+
workspaceId: o
|
|
154
154
|
}) {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
const s = new AbortController(), c = globalThis.setTimeout(() => s.abort(new DOMException("Warmup attempt timed out", "TimeoutError")), Br), u = () => s.abort(i.reason);
|
|
156
|
+
i.aborted && u(), i.addEventListener("abort", u, { once: !0 });
|
|
157
|
+
try {
|
|
158
|
+
const S = await fetch(Pn(e, n), { headers: r, signal: s.signal });
|
|
159
|
+
if (An(n)) return await zr(S);
|
|
160
|
+
const y = await ze(S);
|
|
161
|
+
if (!S.ok) {
|
|
162
|
+
const b = pt(y);
|
|
163
|
+
if (b) return { status: "preparing", ...b };
|
|
164
|
+
throw new Error(ht(y) ?? `${n} failed with ${S.status}`);
|
|
165
|
+
}
|
|
166
|
+
return y && typeof y == "object" && En(e, r["x-boring-workspace-id"] ?? o, n, y), { status: "ready" };
|
|
167
|
+
} catch (S) {
|
|
168
|
+
if (i.aborted) throw S;
|
|
169
|
+
if (s.signal.aborted || S instanceof TypeError) return { status: "preparing" };
|
|
170
|
+
throw S;
|
|
171
|
+
} finally {
|
|
172
|
+
globalThis.clearTimeout(c), i.removeEventListener("abort", u);
|
|
162
173
|
}
|
|
163
|
-
return c && typeof c == "object" && En(e, r["x-boring-workspace-id"] ?? s, n, c), { status: "ready" };
|
|
164
174
|
}
|
|
165
175
|
function Yr({
|
|
166
176
|
workspaceId: e,
|
|
167
177
|
requestHeaders: n,
|
|
168
178
|
apiBaseUrl: r,
|
|
169
179
|
preloadPaths: i = bn,
|
|
170
|
-
provisionWorkspace:
|
|
171
|
-
onStatusChange:
|
|
180
|
+
provisionWorkspace: o = !0,
|
|
181
|
+
onStatusChange: s
|
|
172
182
|
}) {
|
|
173
|
-
return
|
|
183
|
+
return A(() => {
|
|
174
184
|
let c = !1;
|
|
175
|
-
const u = new AbortController(),
|
|
176
|
-
async function
|
|
185
|
+
const u = new AbortController(), S = qe(e, n);
|
|
186
|
+
async function y() {
|
|
177
187
|
var b, B;
|
|
178
|
-
|
|
188
|
+
s == null || s({ status: "preparing" });
|
|
179
189
|
try {
|
|
180
|
-
const
|
|
190
|
+
const W = yn(i, o), k = (m) => Vr({
|
|
181
191
|
apiBaseUrl: r,
|
|
182
192
|
path: m,
|
|
183
|
-
headers:
|
|
193
|
+
headers: S,
|
|
184
194
|
signal: u.signal,
|
|
185
195
|
workspaceId: e
|
|
186
196
|
});
|
|
187
|
-
let
|
|
197
|
+
let T = await Promise.all(W.map(async (m) => ({ path: m, result: await k(m) })));
|
|
188
198
|
if (c || u.signal.aborted) return;
|
|
189
|
-
let h = (b =
|
|
199
|
+
let h = (b = T.find((m) => m.result.runtimeDependencies)) == null ? void 0 : b.result.runtimeDependencies, N = T.filter((m) => m.result.status === "preparing");
|
|
190
200
|
for (; N.length > 0; ) {
|
|
191
201
|
let m;
|
|
192
|
-
for (const
|
|
193
|
-
if (
|
|
194
|
-
m =
|
|
202
|
+
for (const D of N)
|
|
203
|
+
if (D.result.status === "preparing" && D.result.requirement) {
|
|
204
|
+
m = D.result.requirement;
|
|
195
205
|
break;
|
|
196
206
|
}
|
|
197
|
-
if (
|
|
198
|
-
h = ((B =
|
|
207
|
+
if (s == null || s({ status: "preparing", message: "Workspace is still preparing", ...m ? { requirement: m } : {} }), await gn(u.signal), c || u.signal.aborted || (T = await Promise.all(N.map(async (D) => ({ path: D.path, result: await k(D.path) }))), c || u.signal.aborted)) return;
|
|
208
|
+
h = ((B = T.find((D) => D.result.runtimeDependencies)) == null ? void 0 : B.result.runtimeDependencies) ?? h, N = T.filter((D) => D.result.status === "preparing");
|
|
199
209
|
}
|
|
200
|
-
for (
|
|
210
|
+
for (s == null || s({ status: "ready", ...h ? { runtimeDependencies: h } : {} }); (h == null ? void 0 : h.state) === "preparing"; ) {
|
|
201
211
|
if (await gn(u.signal), c || u.signal.aborted) return;
|
|
202
212
|
const m = await k("/api/v1/ready-status");
|
|
203
213
|
if (c || u.signal.aborted) return;
|
|
204
|
-
h = m.runtimeDependencies, h && (
|
|
214
|
+
h = m.runtimeDependencies, h && (s == null || s({ status: "ready", runtimeDependencies: h }));
|
|
205
215
|
}
|
|
206
|
-
} catch (
|
|
216
|
+
} catch (W) {
|
|
207
217
|
if (c || u.signal.aborted) return;
|
|
208
|
-
|
|
218
|
+
s == null || s({
|
|
209
219
|
status: "failed",
|
|
210
|
-
message:
|
|
220
|
+
message: W instanceof Error ? W.message : "Workspace failed to prepare"
|
|
211
221
|
});
|
|
212
222
|
}
|
|
213
223
|
}
|
|
214
|
-
return
|
|
224
|
+
return y(), () => {
|
|
215
225
|
c = !0, u.abort();
|
|
216
226
|
};
|
|
217
|
-
}, [r,
|
|
227
|
+
}, [r, s, i, o, n, e]), null;
|
|
218
228
|
}
|
|
219
229
|
function kr(e) {
|
|
220
230
|
return typeof (e == null ? void 0 : e.id) == "string" ? e.id : null;
|
|
221
231
|
}
|
|
222
232
|
function Be(e, n, r) {
|
|
223
233
|
if (e.includes(r)) return e;
|
|
224
|
-
const i = n ? e.indexOf(n) : -1,
|
|
225
|
-
return [...e.slice(0,
|
|
234
|
+
const i = n ? e.indexOf(n) : -1, o = i >= 0 ? i + 1 : e.length;
|
|
235
|
+
return [...e.slice(0, o), r, ...e.slice(o)];
|
|
226
236
|
}
|
|
227
237
|
function mn(e, n, r) {
|
|
228
238
|
if (e.includes(r)) return e;
|
|
229
239
|
if (e.length === 0) return [r];
|
|
230
|
-
const i = n ? e.indexOf(n) : -1,
|
|
231
|
-
return e.map((
|
|
240
|
+
const i = n ? e.indexOf(n) : -1, o = i >= 0 ? i : 0;
|
|
241
|
+
return e.map((s, c) => c === o ? r : s);
|
|
232
242
|
}
|
|
233
243
|
function Xr(e, n) {
|
|
234
244
|
return !!(e && e.title === n && e.turnCount === 0);
|
|
@@ -237,33 +247,33 @@ function Qr(e, n) {
|
|
|
237
247
|
return e.endsWith(":surface") ? e.slice(0, -8) : n;
|
|
238
248
|
}
|
|
239
249
|
function ft(e, n, r) {
|
|
240
|
-
const [i,
|
|
241
|
-
|
|
242
|
-
|
|
250
|
+
const [i, o] = O(() => dn(e, n, r));
|
|
251
|
+
A(() => {
|
|
252
|
+
o(dn(e, n, r));
|
|
243
253
|
}, [e, n, r]);
|
|
244
|
-
const
|
|
254
|
+
const s = w(
|
|
245
255
|
(c) => {
|
|
246
|
-
|
|
256
|
+
o(c), xr(e, c, r);
|
|
247
257
|
},
|
|
248
258
|
[r, e]
|
|
249
259
|
);
|
|
250
|
-
return [i,
|
|
260
|
+
return [i, s];
|
|
251
261
|
}
|
|
252
262
|
const gt = {}, Zr = [], pn = { status: "preparing" }, hn = {
|
|
253
263
|
openTabs: [],
|
|
254
264
|
activeTab: null
|
|
255
265
|
};
|
|
256
266
|
function ei({ status: e }) {
|
|
257
|
-
const n = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", i = r ? n === "workspace-fs" ? "Preparing files…" : n === "sandbox-exec" ? "Waking sandbox…" : n === "ui-bridge" ? "Connecting workspace UI…" : "Preparing workspace…" : "Workspace workbench failed",
|
|
267
|
+
const n = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", i = r ? n === "workspace-fs" ? "Preparing files…" : n === "sandbox-exec" ? "Waking sandbox…" : n === "ui-bridge" ? "Connecting workspace UI…" : "Preparing workspace…" : "Workspace workbench failed", o = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
|
|
258
268
|
return /* @__PURE__ */ f("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */ ye("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
259
269
|
r ? /* @__PURE__ */ f("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,
|
|
260
270
|
/* @__PURE__ */ f("div", { className: "text-sm font-semibold text-foreground", children: i }),
|
|
261
|
-
/* @__PURE__ */ f("p", { className: "mt-2 text-sm text-muted-foreground", children:
|
|
271
|
+
/* @__PURE__ */ f("p", { className: "mt-2 text-sm text-muted-foreground", children: o }),
|
|
262
272
|
e.status === "failed" ? /* @__PURE__ */ f("p", { className: "mt-3 text-xs text-muted-foreground", children: "Reload the workspace to retry." }) : null
|
|
263
273
|
] }) });
|
|
264
274
|
}
|
|
265
275
|
function ti(e) {
|
|
266
|
-
const n = e.workspaceId ?? ni(e.requestHeaders) ?? e.storageKey, r =
|
|
276
|
+
const n = e.workspaceId ?? ni(e.requestHeaders) ?? e.storageKey, r = yr({
|
|
267
277
|
apiBaseUrl: e.apiBaseUrl,
|
|
268
278
|
workspaceId: n,
|
|
269
279
|
storageScope: n,
|
|
@@ -298,15 +308,15 @@ function vn(e, n) {
|
|
|
298
308
|
try {
|
|
299
309
|
const i = (r = globalThis.localStorage) == null ? void 0 : r.getItem(e);
|
|
300
310
|
if (!i) return null;
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
const c = typeof
|
|
304
|
-
return { workspaceId: n, ids:
|
|
311
|
+
const o = JSON.parse(i), s = Array.isArray(o.ids) ? o.ids.filter((u) => typeof u == "string" && u.length > 0) : [];
|
|
312
|
+
if (s.length === 0) return null;
|
|
313
|
+
const c = typeof o.activeId == "string" && s.includes(o.activeId) ? o.activeId : s[0];
|
|
314
|
+
return { workspaceId: n, ids: s, activeId: c };
|
|
305
315
|
} catch {
|
|
306
316
|
return null;
|
|
307
317
|
}
|
|
308
318
|
}
|
|
309
|
-
function
|
|
319
|
+
function oi(e, n) {
|
|
310
320
|
var r, i;
|
|
311
321
|
try {
|
|
312
322
|
if (n.ids.length === 0) {
|
|
@@ -325,13 +335,13 @@ function Sn(e, n) {
|
|
|
325
335
|
try {
|
|
326
336
|
const i = (r = globalThis.localStorage) == null ? void 0 : r.getItem(e);
|
|
327
337
|
if (!i) return null;
|
|
328
|
-
const
|
|
329
|
-
return { workspaceId: n, ids:
|
|
338
|
+
const o = JSON.parse(i), s = Array.isArray(o.ids) ? o.ids.filter((c) => typeof c == "string" && c.length > 0) : [];
|
|
339
|
+
return { workspaceId: n, ids: s };
|
|
330
340
|
} catch {
|
|
331
341
|
return null;
|
|
332
342
|
}
|
|
333
343
|
}
|
|
334
|
-
function
|
|
344
|
+
function si(e, n) {
|
|
335
345
|
var r, i;
|
|
336
346
|
try {
|
|
337
347
|
if (n.length === 0) {
|
|
@@ -359,7 +369,7 @@ function ci(e) {
|
|
|
359
369
|
}
|
|
360
370
|
function ui(e) {
|
|
361
371
|
var i;
|
|
362
|
-
const n = e.openTabs.find((
|
|
372
|
+
const n = e.openTabs.find((o) => o.id === e.activeTab), r = (i = n == null ? void 0 : n.params) == null ? void 0 : i.path;
|
|
363
373
|
return typeof r == "string" ? r : null;
|
|
364
374
|
}
|
|
365
375
|
function di({
|
|
@@ -367,68 +377,68 @@ function di({
|
|
|
367
377
|
requestHeaders: n,
|
|
368
378
|
navOpen: r,
|
|
369
379
|
surfaceOpen: i,
|
|
370
|
-
surfaceReady:
|
|
371
|
-
snapshot:
|
|
380
|
+
surfaceReady: o,
|
|
381
|
+
snapshot: s
|
|
372
382
|
}) {
|
|
373
383
|
const c = wn(), u = j(null);
|
|
374
|
-
return
|
|
384
|
+
return A(() => {
|
|
375
385
|
var b;
|
|
376
|
-
if (e === null || i && !
|
|
386
|
+
if (e === null || i && !o) return;
|
|
377
387
|
(b = u.current) == null || b.abort();
|
|
378
|
-
const
|
|
379
|
-
u.current =
|
|
380
|
-
const
|
|
388
|
+
const S = new AbortController();
|
|
389
|
+
u.current = S;
|
|
390
|
+
const y = {
|
|
381
391
|
v: 1,
|
|
382
392
|
drawerOpen: r,
|
|
383
393
|
workbenchOpen: i,
|
|
384
|
-
openTabs:
|
|
385
|
-
activeTab:
|
|
386
|
-
activeFile: ui(
|
|
394
|
+
openTabs: s.openTabs,
|
|
395
|
+
activeTab: s.activeTab,
|
|
396
|
+
activeFile: ui(s),
|
|
387
397
|
availablePanels: c.list().map((B) => B.id)
|
|
388
398
|
};
|
|
389
399
|
return fetch(ci(e), {
|
|
390
400
|
method: "PUT",
|
|
391
401
|
headers: { ...n, "Content-Type": "application/json" },
|
|
392
|
-
body: JSON.stringify({ state:
|
|
393
|
-
signal:
|
|
402
|
+
body: JSON.stringify({ state: y, causedBy: "user" }),
|
|
403
|
+
signal: S.signal
|
|
394
404
|
}).catch(() => {
|
|
395
405
|
}), () => {
|
|
396
|
-
|
|
406
|
+
S.abort();
|
|
397
407
|
};
|
|
398
|
-
}, [e, r, c, n,
|
|
408
|
+
}, [e, r, c, n, s, i, o]), null;
|
|
399
409
|
}
|
|
400
|
-
function
|
|
410
|
+
function Mi({
|
|
401
411
|
workspaceId: e,
|
|
402
412
|
chatPanel: n,
|
|
403
413
|
useSessions: r,
|
|
404
414
|
requestHeaders: i,
|
|
405
|
-
sessionStorageKey:
|
|
406
|
-
providerStorageKey:
|
|
415
|
+
sessionStorageKey: o,
|
|
416
|
+
providerStorageKey: s,
|
|
407
417
|
surfaceStorageKey: c,
|
|
408
418
|
beforeShell: u,
|
|
409
|
-
afterShell:
|
|
410
|
-
panels:
|
|
419
|
+
afterShell: S,
|
|
420
|
+
panels: y,
|
|
411
421
|
commands: b,
|
|
412
422
|
catalogs: B,
|
|
413
|
-
plugins:
|
|
423
|
+
plugins: W,
|
|
414
424
|
excludeDefaults: k,
|
|
415
|
-
capabilities:
|
|
425
|
+
capabilities: T,
|
|
416
426
|
apiBaseUrl: h,
|
|
417
427
|
authHeaders: N,
|
|
418
428
|
apiTimeout: m,
|
|
419
|
-
defaultTheme:
|
|
420
|
-
onThemeChange:
|
|
429
|
+
defaultTheme: D,
|
|
430
|
+
onThemeChange: Tn,
|
|
421
431
|
persistenceEnabled: vt,
|
|
422
432
|
bridgeEndpoint: Ve,
|
|
423
|
-
fullPageBasePath:
|
|
424
|
-
onAuthError:
|
|
433
|
+
fullPageBasePath: Nn,
|
|
434
|
+
onAuthError: Dn,
|
|
425
435
|
sessions: St,
|
|
426
436
|
activeSessionId: bt,
|
|
427
437
|
onSwitchSession: yt,
|
|
428
438
|
onCreateSession: Pt,
|
|
429
439
|
onDeleteSession: At,
|
|
430
440
|
onActiveSessionIdChange: Pe,
|
|
431
|
-
appTitle:
|
|
441
|
+
appTitle: Rn = "Boring",
|
|
432
442
|
workspaceLabel: _n,
|
|
433
443
|
defaultSessionTitle: q = "New session",
|
|
434
444
|
navEnabled: Et = !0,
|
|
@@ -437,97 +447,96 @@ function Ci({
|
|
|
437
447
|
defaultWorkbenchLeftTab: Ae,
|
|
438
448
|
surfaceInitialPanels: wt,
|
|
439
449
|
topBarLeft: xn,
|
|
440
|
-
topBarRight:
|
|
441
|
-
showThemeToggle:
|
|
450
|
+
topBarRight: Mn,
|
|
451
|
+
showThemeToggle: Cn = !0,
|
|
442
452
|
chatParams: _,
|
|
443
453
|
hotReloadEnabled: Ye,
|
|
444
|
-
frontPluginHotReload:
|
|
445
|
-
extraPanels:
|
|
446
|
-
extraCommands:
|
|
454
|
+
frontPluginHotReload: Wn,
|
|
455
|
+
extraPanels: Tt,
|
|
456
|
+
extraCommands: Nt,
|
|
447
457
|
provisionWorkspace: ke,
|
|
448
|
-
bootPreloadPaths:
|
|
458
|
+
bootPreloadPaths: Fn,
|
|
449
459
|
onWorkspaceWarmupStatusChange: Ee,
|
|
450
460
|
onOpenNav: Xe,
|
|
451
461
|
onOpenSurface: Qe,
|
|
452
462
|
surfaceButtonBottomOffset: Gn,
|
|
453
|
-
|
|
454
|
-
className: $n
|
|
463
|
+
className: In
|
|
455
464
|
}) {
|
|
456
465
|
var nn, rn;
|
|
457
|
-
const Ze =
|
|
458
|
-
|
|
466
|
+
const Ze = s ?? `boring-ui-v2:layout:${e}`, F = c ?? `${Ze}:surface`, we = Qr(
|
|
467
|
+
F,
|
|
459
468
|
Ze
|
|
460
|
-
), x = vt !== !1,
|
|
469
|
+
), x = vt !== !1, Te = o ?? `boring-workspace:sessions:${e}`, X = C(
|
|
461
470
|
() => qe(e, i ?? gt),
|
|
462
471
|
[i, e]
|
|
463
|
-
),
|
|
472
|
+
), $n = C(
|
|
464
473
|
() => qe(e, { ...i ?? gt, ...N ?? gt }),
|
|
465
474
|
[N, i, e]
|
|
466
|
-
),
|
|
467
|
-
() =>
|
|
468
|
-
[
|
|
469
|
-
),
|
|
475
|
+
), Ne = C(
|
|
476
|
+
() => Kr({ storageKey: Te }),
|
|
477
|
+
[Te]
|
|
478
|
+
), Dt = Jr(Ne), [Rt, Un] = O(() => ({
|
|
470
479
|
workspaceId: e,
|
|
471
480
|
status: pn
|
|
472
|
-
})), [
|
|
481
|
+
})), [De, et] = O(() => ({
|
|
473
482
|
workspaceId: e,
|
|
474
483
|
expired: !1
|
|
475
|
-
})), [_t,
|
|
484
|
+
})), [_t, Re] = O(() => ({
|
|
476
485
|
workspaceId: e,
|
|
477
486
|
creating: !1
|
|
478
487
|
})), [Lt, _e] = O(() => ({
|
|
479
488
|
workspaceId: e,
|
|
480
489
|
failed: !1
|
|
481
|
-
})), [tt, Ot] = O(null), ue = `boring-workspace:chat-panes:${e}`, [
|
|
490
|
+
})), [tt, Ot] = O(null), ue = `boring-workspace:chat-panes:${e}`, [R, z] = O(
|
|
482
491
|
() => (x ? vn(ue, e) : null) ?? { workspaceId: e, ids: [], activeId: null }
|
|
483
492
|
), [re, xt] = O(null);
|
|
484
|
-
|
|
493
|
+
A(() => {
|
|
485
494
|
if (!re) return;
|
|
486
495
|
const t = setTimeout(() => xt(null), 700);
|
|
487
496
|
return () => clearTimeout(t);
|
|
488
497
|
}, [re]);
|
|
489
|
-
const de = `boring-workspace:pinned-sessions:${e}`, [
|
|
498
|
+
const de = `boring-workspace:pinned-sessions:${e}`, [Mt, Ct] = O(
|
|
490
499
|
() => (x ? Sn(de, e) : null) ?? { workspaceId: e, ids: [] }
|
|
491
|
-
),
|
|
492
|
-
|
|
493
|
-
|
|
500
|
+
), Kn = Mt.workspaceId === e ? Mt.ids : Zr;
|
|
501
|
+
A(() => {
|
|
502
|
+
Ct((t) => t.workspaceId === e ? t : (x ? Sn(de, e) : null) ?? { workspaceId: e, ids: [] });
|
|
494
503
|
}, [de, x, e]);
|
|
495
|
-
const
|
|
496
|
-
|
|
504
|
+
const Jn = w((t) => {
|
|
505
|
+
Ct((a) => {
|
|
497
506
|
const l = a.workspaceId === e ? a.ids : [], g = l.includes(t) ? l.filter((v) => v !== t) : [t, ...l];
|
|
498
|
-
return x &&
|
|
507
|
+
return x && si(de, g), { workspaceId: e, ids: g };
|
|
499
508
|
});
|
|
500
509
|
}, [de, x, e]);
|
|
501
|
-
|
|
502
|
-
x &&
|
|
503
|
-
}, [
|
|
510
|
+
A(() => {
|
|
511
|
+
x && R.workspaceId === e && oi(ue, R);
|
|
512
|
+
}, [R, ue, x, e]), A(() => {
|
|
504
513
|
z((t) => t.workspaceId === e ? t : (x ? vn(ue, e) : null) ?? { workspaceId: e, ids: [], activeId: null });
|
|
505
514
|
}, [ue, x, e]);
|
|
506
|
-
const Le =
|
|
507
|
-
},
|
|
515
|
+
const Le = Rt.workspaceId === e ? Rt.status : pn, jn = n ?? br, Bn = r ?? ti, ie = !n || !!r, Oe = ie && ke !== !1, nt = () => {
|
|
516
|
+
}, M = Bn({
|
|
508
517
|
requestHeaders: X,
|
|
509
|
-
storageKey:
|
|
518
|
+
storageKey: Te,
|
|
510
519
|
workspaceId: e,
|
|
511
520
|
apiBaseUrl: h,
|
|
512
521
|
enabled: Oe
|
|
513
|
-
}), [fe,
|
|
514
|
-
|
|
515
|
-
V &&
|
|
516
|
-
const a = t.workspaceId === e, l = t.activeSessionId ===
|
|
522
|
+
}), [fe, Hn] = O(() => ({ workspaceId: e, sessions: [], activeSessionId: null })), qn = Oe && M.workspaceId != null && M.workspaceId !== e, V = Oe && !M.loading && !M.error && !qn, G = Oe && !V;
|
|
523
|
+
A(() => {
|
|
524
|
+
V && Hn((t) => {
|
|
525
|
+
const a = t.workspaceId === e, l = t.activeSessionId === M.activeSessionId, g = t.sessions.length === M.sessions.length && t.sessions.every((v, E) => {
|
|
517
526
|
var te;
|
|
518
|
-
return v.id === ((te =
|
|
527
|
+
return v.id === ((te = M.sessions[E]) == null ? void 0 : te.id);
|
|
519
528
|
});
|
|
520
529
|
return a && l && g ? t : {
|
|
521
530
|
workspaceId: e,
|
|
522
|
-
sessions:
|
|
523
|
-
activeSessionId:
|
|
531
|
+
sessions: M.sessions,
|
|
532
|
+
activeSessionId: M.activeSessionId
|
|
524
533
|
};
|
|
525
534
|
});
|
|
526
|
-
}, [
|
|
527
|
-
const rt = G && fe.workspaceId === e && fe.sessions.length > 0, it = G ? ii(
|
|
528
|
-
|
|
535
|
+
}, [M.activeSessionId, M.sessions, V, e]);
|
|
536
|
+
const rt = G && fe.workspaceId === e && fe.sessions.length > 0, it = G ? ii(Te) : null, Y = V ? M.sessions : rt ? fe.sessions : [], zn = V ? M.activeSessionId : rt ? fe.activeSessionId : null, d = ie && (V || rt) ? M : void 0, ge = St !== void 0 || bt !== void 0 || yt !== void 0 || Pt !== void 0 || At !== void 0, Wt = De.workspaceId === e && De.expired, me = j(!1), pe = !!(V && d && !ge && Y.length === 0 && !Wt), Vn = _t.workspaceId === e && _t.creating, Yn = Lt.workspaceId === e && Lt.failed, kn = !!(V && d && !ge && Y.length === 0 && Wt && !me.current && !Yn), xe = pe || Vn || kn;
|
|
537
|
+
A(() => {
|
|
529
538
|
if (!pe) {
|
|
530
|
-
|
|
539
|
+
De.workspaceId !== e && et({ workspaceId: e, expired: !1 });
|
|
531
540
|
return;
|
|
532
541
|
}
|
|
533
542
|
et({ workspaceId: e, expired: !1 });
|
|
@@ -535,170 +544,170 @@ function Ci({
|
|
|
535
544
|
et({ workspaceId: e, expired: !0 });
|
|
536
545
|
}, 2e3);
|
|
537
546
|
return () => globalThis.clearTimeout(t);
|
|
538
|
-
}, [
|
|
539
|
-
const
|
|
547
|
+
}, [De.workspaceId, pe, e]);
|
|
548
|
+
const Xn = d ? Y.map((t) => ({
|
|
540
549
|
...t,
|
|
541
550
|
title: t.title ?? "New session"
|
|
542
|
-
})) : void 0,
|
|
551
|
+
})) : void 0, Qn = it ? [{
|
|
543
552
|
id: it,
|
|
544
553
|
title: "Loading sessions…",
|
|
545
554
|
createdAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
546
555
|
updatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
547
556
|
turnCount: 0
|
|
548
|
-
}] : [], $ = d ?
|
|
549
|
-
|
|
550
|
-
if (
|
|
551
|
-
|
|
557
|
+
}] : [], $ = d ? Xn ?? [] : G ? Qn : ge ? St ?? [] : Dt.sessions, Zn = d ? zn ?? null : G ? it : ge ? bt ?? null : Dt.activeId, oe = (_ == null ? void 0 : _.autoSubmitInitialDraft) === !0, Me = oe && ie && !ge, [U, he] = O(() => Me ? null : void 0), Ft = j(e), se = j(!1);
|
|
558
|
+
A(() => {
|
|
559
|
+
if (Ft.current !== e) {
|
|
560
|
+
Ft.current = e, se.current = !1, he(Me ? null : void 0);
|
|
552
561
|
return;
|
|
553
562
|
}
|
|
554
|
-
|
|
555
|
-
}, [U,
|
|
556
|
-
!d || U !== null ||
|
|
563
|
+
Me && U === void 0 && (se.current = !1, he(null));
|
|
564
|
+
}, [U, Me, e]), A(() => {
|
|
565
|
+
!d || U !== null || se.current || (se.current = !0, Promise.resolve(d.create({ title: q })).then((t) => {
|
|
557
566
|
if (typeof (t == null ? void 0 : t.id) != "string")
|
|
558
567
|
throw new Error("auto_submit_session_create_failed");
|
|
559
568
|
he(t.id);
|
|
560
569
|
}).catch(() => {
|
|
561
|
-
|
|
570
|
+
se.current = !1, he(void 0);
|
|
562
571
|
}));
|
|
563
572
|
}, [U, q, d]);
|
|
564
|
-
const I = U !== void 0 ? U ?? null :
|
|
573
|
+
const I = U !== void 0 ? U ?? null : Zn, J = G ? nt : (d == null ? void 0 : d.switch) ?? yt ?? Ne.switchTo, Ce = w((t) => (I && t !== I && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: I } })), J(t)), [I, J]), ot = G ? nt : d ? () => {
|
|
565
574
|
const t = Y.find((l) => l.id === I && Xr(l, q)), a = d.create();
|
|
566
575
|
return t && Promise.resolve(a).then(() => d.delete(t.id)).catch(() => {
|
|
567
576
|
}), a;
|
|
568
|
-
} : Pt ??
|
|
577
|
+
} : Pt ?? Ne.create, Gt = G ? nt : (d == null ? void 0 : d.delete) ?? At ?? Ne.remove, It = w((t) => (d && Y.length <= 1 && (me.current = !0), Gt(t)), [Y.length, Gt, d]), er = ((nn = $.find((t) => t.id === I)) == null ? void 0 : nn.title) ?? void 0, [tr, $t] = ft(
|
|
569
578
|
`${we}:drawer`,
|
|
570
579
|
Ln,
|
|
571
580
|
x
|
|
572
|
-
), Ut = Et &&
|
|
581
|
+
), Ut = Et && tr, [Q, H] = ft(
|
|
573
582
|
// Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
|
|
574
583
|
// layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
|
|
575
584
|
// key corrupts the JSON and drops the persisted workbench layout on reload.
|
|
576
585
|
`${we}:workbenchOpen`,
|
|
577
586
|
On ?? !1,
|
|
578
587
|
x
|
|
579
|
-
), [
|
|
588
|
+
), [nr, st] = O(!1), [rr, ve] = ft(
|
|
580
589
|
`${we}:workbenchLeftOpen`,
|
|
581
590
|
!0,
|
|
582
591
|
x
|
|
583
|
-
), Se = j(!1), Z = j(null), ee = j(Q), Kt = j(
|
|
584
|
-
Kt.current =
|
|
592
|
+
), Se = j(!1), Z = j(null), ee = j(Q), Kt = j(F), at = j(null);
|
|
593
|
+
Kt.current = F;
|
|
585
594
|
const [Jt, jt] = O(() => ({
|
|
586
|
-
key:
|
|
595
|
+
key: F,
|
|
587
596
|
snapshot: hn
|
|
588
|
-
})),
|
|
589
|
-
|
|
590
|
-
Se.current = !1, me.current = !1,
|
|
591
|
-
}, [e]),
|
|
592
|
-
|
|
593
|
-
}, [
|
|
597
|
+
})), ir = Jt.key === F ? Jt.snapshot : hn;
|
|
598
|
+
A(() => {
|
|
599
|
+
Se.current = !1, me.current = !1, Re({ workspaceId: e, creating: !1 }), _e({ workspaceId: e, failed: !1 }), Ot(null);
|
|
600
|
+
}, [e]), A(() => {
|
|
601
|
+
st(!1);
|
|
602
|
+
}, [F]), A(() => {
|
|
594
603
|
if (!(!d || d.loading) && !pe && U === void 0) {
|
|
595
604
|
if (Y.length > 0) {
|
|
596
|
-
Se.current = !1, me.current = !1,
|
|
605
|
+
Se.current = !1, me.current = !1, Re((t) => t.workspaceId === e && t.creating ? { workspaceId: e, creating: !1 } : t), _e((t) => t.workspaceId === e && t.failed ? { workspaceId: e, failed: !1 } : t);
|
|
597
606
|
return;
|
|
598
607
|
}
|
|
599
|
-
me.current || Se.current || (Se.current = !0,
|
|
608
|
+
me.current || Se.current || (Se.current = !0, Re({ workspaceId: e, creating: !0 }), _e({ workspaceId: e, failed: !1 }), Promise.resolve(d.create({ title: q })).then((t) => {
|
|
600
609
|
const a = t == null ? void 0 : t.id;
|
|
601
610
|
typeof a == "string" && Ot({ workspaceId: e, id: a });
|
|
602
611
|
}).catch(() => {
|
|
603
|
-
Se.current = !1,
|
|
612
|
+
Se.current = !1, Re({ workspaceId: e, creating: !1 }), _e({ workspaceId: e, failed: !0 });
|
|
604
613
|
}));
|
|
605
614
|
}
|
|
606
|
-
}, [Y.length, U, q, pe, d, e]),
|
|
615
|
+
}, [Y.length, U, q, pe, d, e]), A(() => {
|
|
607
616
|
ee.current = Q;
|
|
608
617
|
}, [Q]);
|
|
609
|
-
const Bt =
|
|
610
|
-
at.current = { key:
|
|
611
|
-
key:
|
|
618
|
+
const Bt = w((t) => {
|
|
619
|
+
at.current = { key: F, api: t }, st(!0), jt({
|
|
620
|
+
key: F,
|
|
612
621
|
snapshot: t.getSnapshot()
|
|
613
622
|
});
|
|
614
|
-
}, [
|
|
623
|
+
}, [F]), Ht = w((t) => {
|
|
615
624
|
jt({
|
|
616
|
-
key:
|
|
625
|
+
key: F,
|
|
617
626
|
snapshot: t
|
|
618
627
|
});
|
|
619
|
-
}, [
|
|
628
|
+
}, [F]), We = w(() => {
|
|
620
629
|
const t = at.current;
|
|
621
630
|
return (t == null ? void 0 : t.key) === Kt.current ? t.api : null;
|
|
622
|
-
}, []),
|
|
631
|
+
}, []), Fe = w(() => ee.current, []), Ge = w(() => {
|
|
623
632
|
ee.current = !0, H(!0);
|
|
624
|
-
}, [H]), Ie =
|
|
633
|
+
}, [H]), Ie = w(() => {
|
|
625
634
|
ee.current = !0, H(!0), ve(!0);
|
|
626
|
-
}, [H, ve]), $e =
|
|
627
|
-
ee.current = !1, at.current = null,
|
|
628
|
-
}, [H]), ae =
|
|
629
|
-
() => (
|
|
630
|
-
[
|
|
631
|
-
), lt =
|
|
635
|
+
}, [H, ve]), $e = w(() => {
|
|
636
|
+
ee.current = !1, at.current = null, st(!1), H(!1);
|
|
637
|
+
}, [H]), ae = C(
|
|
638
|
+
() => (W == null ? void 0 : W.map(Er)) ?? [],
|
|
639
|
+
[W]
|
|
640
|
+
), lt = C(
|
|
632
641
|
() => ae.some((t) => t.registrations.leftTabs.length > 0),
|
|
633
642
|
[ae]
|
|
634
|
-
), qt =
|
|
643
|
+
), qt = C(
|
|
635
644
|
() => ae.flatMap((t) => t.registrations.panels.map((a) => a.id)),
|
|
636
645
|
[ae]
|
|
637
|
-
), zt =
|
|
646
|
+
), zt = C(() => {
|
|
638
647
|
const t = {};
|
|
639
648
|
for (const a of ae)
|
|
640
649
|
for (const l of a.registrations.toolRenderers)
|
|
641
650
|
t[l.id] = l.render;
|
|
642
651
|
return t;
|
|
643
|
-
}, [ae]), Vt =
|
|
644
|
-
() => [...
|
|
645
|
-
[
|
|
652
|
+
}, [ae]), Vt = C(
|
|
653
|
+
() => [...Tt ?? [], ...qt],
|
|
654
|
+
[Tt, qt]
|
|
646
655
|
), p = ie && !r && fe.workspaceId !== e ? "default" : I ?? (U !== void 0 ? "default" : ((rn = $[0]) == null ? void 0 : rn.id) ?? "default"), Yt = !(d != null && d.hasMore) && !G;
|
|
647
|
-
|
|
648
|
-
var te,
|
|
656
|
+
A(() => {
|
|
657
|
+
var te, on;
|
|
649
658
|
if (xe) return;
|
|
650
659
|
const t = Z.current, a = new Set($.map((K) => K.id)), l = t ? t.createdId ?? (a.has(p) && !t.knownIds.has(p) ? p : ((te = $.find((K) => !t.knownIds.has(K.id))) == null ? void 0 : te.id) ?? null) : null;
|
|
651
660
|
l && a.has(l) && (Z.current = null);
|
|
652
|
-
const g = p === "default" && U !== void 0, v = Yt && a.size > 0 && !g,
|
|
661
|
+
const g = p === "default" && U !== void 0, v = Yt && a.size > 0 && !g, E = l ?? (v && !a.has(p) ? ((on = $[0]) == null ? void 0 : on.id) ?? p : p);
|
|
653
662
|
z((K) => {
|
|
654
663
|
const ne = K.workspaceId === e ? K : { workspaceId: e, ids: [], activeId: null };
|
|
655
664
|
if (G && ne.ids.length > 0 && !l) return ne;
|
|
656
|
-
const
|
|
657
|
-
return K.workspaceId === e && K.activeId === cn && K.ids.length === be.length && K.ids.every((je,
|
|
665
|
+
const sn = ne.ids.length > 0 ? ne.ids : [E], an = v ? sn.filter((je) => a.has(je) || je === l) : sn, le = an.length > 0 ? an : [E], ln = ne.activeId && le.includes(ne.activeId) ? ne.activeId : le[0] ?? E, be = l ? Be(le, t == null ? void 0 : t.afterId, l) : E === ln || le.includes(E) ? le : mn(le, ln, E), cn = be.includes(E) ? E : be[0] ?? E;
|
|
666
|
+
return K.workspaceId === e && K.activeId === cn && K.ids.length === be.length && K.ids.every((je, hr) => je === be[hr]) ? K : { workspaceId: e, ids: be, activeId: cn };
|
|
658
667
|
});
|
|
659
668
|
}, [U, p, G, xe, $, Yt, e]);
|
|
660
|
-
const kt =
|
|
669
|
+
const kt = C(() => {
|
|
661
670
|
const t = /* @__PURE__ */ new Map();
|
|
662
671
|
for (const a of $) t.set(a.id, a.title);
|
|
663
672
|
return t;
|
|
664
|
-
}, [$]), ct =
|
|
665
|
-
const l = (
|
|
673
|
+
}, [$]), ct = R.workspaceId === e ? R : { ids: [], activeId: null }, Ue = ct.ids.length > 0 ? ct.ids : [p], Ke = ct.activeId ?? Ue[0] ?? p, or = w((t) => {
|
|
674
|
+
const l = (R.workspaceId === e ? R : { ids: [p] }).ids.includes(t);
|
|
666
675
|
return z((g) => {
|
|
667
|
-
const v = g.workspaceId === e ? g : { ids: [p], activeId: p },
|
|
668
|
-
return { workspaceId: e, ids:
|
|
669
|
-
}), l ? J(t) :
|
|
670
|
-
}, [
|
|
676
|
+
const v = g.workspaceId === e ? g : { ids: [p], activeId: p }, E = v.ids.includes(t) ? v.ids : mn(v.ids, v.activeId, t);
|
|
677
|
+
return { workspaceId: e, ids: E, activeId: t };
|
|
678
|
+
}), l ? J(t) : Ce(t);
|
|
679
|
+
}, [R, p, J, Ce, e]), sr = w((t) => (z((a) => {
|
|
671
680
|
const l = a.workspaceId === e ? a : { ids: [p], activeId: p };
|
|
672
681
|
return {
|
|
673
682
|
workspaceId: e,
|
|
674
683
|
ids: l.ids.includes(t) ? l.ids : Be(l.ids, l.activeId, t),
|
|
675
684
|
activeId: t
|
|
676
685
|
};
|
|
677
|
-
}), J(t)), [p, J, e]), Xt =
|
|
686
|
+
}), J(t)), [p, J, e]), Xt = w((t) => ((R.workspaceId === e ? R : { ids: [p] }).ids.includes(t) && xt({ workspaceId: e, id: t }), z((l) => {
|
|
678
687
|
const g = l.workspaceId === e ? l : { ids: [p], activeId: p };
|
|
679
688
|
return {
|
|
680
689
|
workspaceId: e,
|
|
681
690
|
ids: Be(g.ids, g.activeId, t),
|
|
682
691
|
activeId: t
|
|
683
692
|
};
|
|
684
|
-
}), J(t)), [
|
|
685
|
-
const a =
|
|
693
|
+
}), J(t)), [R, p, J, e]), ar = w((t) => {
|
|
694
|
+
const a = R.workspaceId === e ? R : { ids: [p], activeId: p };
|
|
686
695
|
if (a.ids.length <= 1) return;
|
|
687
696
|
const l = a.ids.indexOf(t);
|
|
688
697
|
if (l < 0) return;
|
|
689
|
-
const g = a.ids.filter((
|
|
698
|
+
const g = a.ids.filter((E) => E !== t), v = a.activeId === t ? g[Math.max(0, l - 1)] ?? g[0] ?? null : a.activeId;
|
|
690
699
|
z({ workspaceId: e, ids: g, activeId: v }), v && a.activeId === t && J(v);
|
|
691
|
-
}, [
|
|
700
|
+
}, [R, p, J, e]), lr = w((t) => {
|
|
692
701
|
const a = {
|
|
693
702
|
afterId: t,
|
|
694
703
|
knownIds: new Set($.map((g) => g.id))
|
|
695
704
|
};
|
|
696
705
|
Z.current = a;
|
|
697
|
-
const l =
|
|
706
|
+
const l = ot();
|
|
698
707
|
return Promise.resolve(l).then((g) => {
|
|
699
708
|
const v = kr(g);
|
|
700
|
-
v && (Z.current === a && (Z.current = { ...a, createdId: v }), z((
|
|
701
|
-
const te =
|
|
709
|
+
v && (Z.current === a && (Z.current = { ...a, createdId: v }), z((E) => {
|
|
710
|
+
const te = E.workspaceId === e ? E : { ids: [p] };
|
|
702
711
|
return {
|
|
703
712
|
workspaceId: e,
|
|
704
713
|
ids: Be(te.ids, t, v),
|
|
@@ -708,32 +717,32 @@ function Ci({
|
|
|
708
717
|
}).catch(() => {
|
|
709
718
|
Z.current === a && (Z.current = null);
|
|
710
719
|
}), l;
|
|
711
|
-
}, [p,
|
|
712
|
-
const a =
|
|
720
|
+
}, [p, ot, $, e]), cr = w((t) => {
|
|
721
|
+
const a = R.workspaceId === e ? R : { ids: [p], activeId: p }, l = a.ids.indexOf(t);
|
|
713
722
|
let g = a.activeId;
|
|
714
723
|
if (l >= 0) {
|
|
715
|
-
const v = a.ids.filter((
|
|
716
|
-
g = a.activeId === t ? v[Math.max(0, l - 1)] ?? v[0] ?? null : a.activeId, z({ workspaceId: e, ids: v, activeId: g }), g && a.activeId === t &&
|
|
724
|
+
const v = a.ids.filter((E) => E !== t);
|
|
725
|
+
g = a.activeId === t ? v[Math.max(0, l - 1)] ?? v[0] ?? null : a.activeId, z({ workspaceId: e, ids: v, activeId: g }), g && a.activeId === t && Ce(g);
|
|
717
726
|
}
|
|
718
727
|
return It(t);
|
|
719
|
-
}, [
|
|
720
|
-
|
|
728
|
+
}, [R, p, It, Ce, e]), [ur, ut] = O(oe), Qt = j(e);
|
|
729
|
+
A(() => {
|
|
721
730
|
if (Qt.current !== e) {
|
|
722
|
-
Qt.current = e, ut(
|
|
731
|
+
Qt.current = e, ut(oe);
|
|
723
732
|
return;
|
|
724
733
|
}
|
|
725
|
-
|
|
726
|
-
}, [
|
|
727
|
-
const Zt =
|
|
728
|
-
|
|
734
|
+
oe && ut(!0);
|
|
735
|
+
}, [oe, e]);
|
|
736
|
+
const Zt = oe && ie && !I, en = !!!(tt && tt.workspaceId === e && tt.id === I) && !ur && ke !== !1 && (ie ? !!I : !0), dr = w((t) => {
|
|
737
|
+
Un({ workspaceId: e, status: t }), Ee == null || Ee(t);
|
|
729
738
|
}, [Ee, e]);
|
|
730
|
-
|
|
739
|
+
A(() => {
|
|
731
740
|
var a;
|
|
732
741
|
const t = (l) => {
|
|
733
742
|
const g = l.detail;
|
|
734
|
-
!g || typeof g != "object" ||
|
|
735
|
-
surface:
|
|
736
|
-
isWorkbenchOpen:
|
|
743
|
+
!g || typeof g != "object" || Nr(g, {
|
|
744
|
+
surface: We,
|
|
745
|
+
isWorkbenchOpen: Fe,
|
|
737
746
|
openWorkbench: Ge,
|
|
738
747
|
openWorkbenchSources: Ie
|
|
739
748
|
});
|
|
@@ -742,10 +751,10 @@ function Ci({
|
|
|
742
751
|
var l;
|
|
743
752
|
return (l = globalThis.removeEventListener) == null ? void 0 : l.call(globalThis, un, t);
|
|
744
753
|
};
|
|
745
|
-
}, [
|
|
754
|
+
}, [We, Fe, Ge, Ie]), A(() => {
|
|
746
755
|
G || Pe == null || Pe(I ?? null);
|
|
747
756
|
}, [I, Pe, G]);
|
|
748
|
-
const dt = Le.status !== "ready",
|
|
757
|
+
const dt = Le.status !== "ready", fr = dt ? /* @__PURE__ */ f(ei, { status: Le }) : void 0, tn = w(async (t) => {
|
|
749
758
|
const a = `${(h == null ? void 0 : h.replace(/\/$/, "")) ?? ""}/api/v1/agent/reload`;
|
|
750
759
|
try {
|
|
751
760
|
const l = await fetch(a, {
|
|
@@ -756,11 +765,11 @@ function Ci({
|
|
|
756
765
|
if (!l.ok)
|
|
757
766
|
return (await l.json().catch(() => ({}))).error || `reload failed (${l.status})`;
|
|
758
767
|
const g = await l.json().catch(() => ({}));
|
|
759
|
-
return window.dispatchEvent(new CustomEvent(
|
|
768
|
+
return window.dispatchEvent(new CustomEvent(wr, { detail: g })), ri(g);
|
|
760
769
|
} catch (l) {
|
|
761
770
|
return l instanceof Error ? l.message : "Agent plugin reload failed.";
|
|
762
771
|
}
|
|
763
|
-
}, [h, X]), Je =
|
|
772
|
+
}, [h, X]), Je = w(
|
|
764
773
|
(t, a = {}) => {
|
|
765
774
|
const l = a.bridgeEnabled ?? !0, g = _ != null && _.toolRenderers && typeof _.toolRenderers == "object" ? _.toolRenderers : void 0;
|
|
766
775
|
return {
|
|
@@ -775,16 +784,16 @@ function Ci({
|
|
|
775
784
|
onReloadAgentPlugins: (_ == null ? void 0 : _.onReloadAgentPlugins) ?? (() => tn(t)),
|
|
776
785
|
toolRenderers: { ...zt, ...g ?? {} },
|
|
777
786
|
bridgeEndpoint: l ? Ve : null,
|
|
778
|
-
getSurface:
|
|
779
|
-
isWorkbenchOpen:
|
|
787
|
+
getSurface: We,
|
|
788
|
+
isWorkbenchOpen: Fe,
|
|
780
789
|
openWorkbench: Ge,
|
|
781
790
|
openWorkbenchSources: Ie,
|
|
782
791
|
closeWorkbench: $e,
|
|
783
|
-
extraCommands:
|
|
792
|
+
extraCommands: Nt,
|
|
784
793
|
workspaceWarmupStatus: Le,
|
|
785
794
|
hydrateMessages: en,
|
|
786
795
|
onAutoSubmitInitialDraftSettled: () => {
|
|
787
|
-
|
|
796
|
+
se.current = !1, ut(!1), he(void 0);
|
|
788
797
|
const v = _ == null ? void 0 : _.onAutoSubmitInitialDraftSettled;
|
|
789
798
|
typeof v == "function" && v();
|
|
790
799
|
},
|
|
@@ -794,17 +803,17 @@ function Ci({
|
|
|
794
803
|
...Ye !== void 0 ? { hotReloadEnabled: Ye } : {}
|
|
795
804
|
};
|
|
796
805
|
},
|
|
797
|
-
[h, _, Zt, X, Ve,
|
|
798
|
-
),
|
|
806
|
+
[h, _, Zt, X, Ve, We, Fe, Ge, Ie, $e, Nt, Le, en, Ye, zt, tn, e]
|
|
807
|
+
), gr = C(
|
|
799
808
|
() => Je(p),
|
|
800
809
|
[p, Je]
|
|
801
|
-
),
|
|
810
|
+
), mr = C(() => Ue.map((t) => ({
|
|
802
811
|
id: t,
|
|
803
812
|
title: kt.get(t) ?? (t === "default" ? q : t),
|
|
804
813
|
panel: "chat",
|
|
805
814
|
params: Je(t, { bridgeEnabled: t === Ke })
|
|
806
|
-
})), [Ke, Ue, q, Je, kt]),
|
|
807
|
-
storageKey:
|
|
815
|
+
})), [Ke, Ue, q, Je, kt]), pr = C(() => ({
|
|
816
|
+
storageKey: F,
|
|
808
817
|
defaultLeftTab: Ae,
|
|
809
818
|
initialPanels: wt,
|
|
810
819
|
extraPanels: Vt,
|
|
@@ -817,33 +826,33 @@ function Ci({
|
|
|
817
826
|
wt,
|
|
818
827
|
Ht,
|
|
819
828
|
Bt,
|
|
820
|
-
|
|
829
|
+
F,
|
|
821
830
|
Vt,
|
|
822
831
|
H
|
|
823
832
|
]);
|
|
824
833
|
return /* @__PURE__ */ f("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ ye(
|
|
825
|
-
|
|
834
|
+
Tr,
|
|
826
835
|
{
|
|
827
|
-
chatPanel:
|
|
828
|
-
panels:
|
|
836
|
+
chatPanel: jn,
|
|
837
|
+
panels: y,
|
|
829
838
|
commands: b,
|
|
830
839
|
catalogs: B,
|
|
831
|
-
plugins:
|
|
840
|
+
plugins: W,
|
|
832
841
|
excludeDefaults: k,
|
|
833
|
-
capabilities:
|
|
842
|
+
capabilities: T,
|
|
834
843
|
apiBaseUrl: h,
|
|
835
|
-
authHeaders:
|
|
844
|
+
authHeaders: $n,
|
|
836
845
|
apiTimeout: m,
|
|
837
|
-
defaultTheme:
|
|
838
|
-
onThemeChange:
|
|
846
|
+
defaultTheme: D,
|
|
847
|
+
onThemeChange: Tn,
|
|
839
848
|
workspaceId: e,
|
|
840
849
|
workspaceLabel: _n,
|
|
841
850
|
storageKey: Ze,
|
|
842
851
|
persistenceEnabled: vt,
|
|
843
852
|
bridgeEndpoint: null,
|
|
844
|
-
onAuthError:
|
|
845
|
-
frontPluginHotReload:
|
|
846
|
-
fullPageBasePath:
|
|
853
|
+
onAuthError: Dn,
|
|
854
|
+
frontPluginHotReload: Wn,
|
|
855
|
+
fullPageBasePath: Nn,
|
|
847
856
|
children: [
|
|
848
857
|
u,
|
|
849
858
|
/* @__PURE__ */ f(
|
|
@@ -852,9 +861,9 @@ function Ci({
|
|
|
852
861
|
workspaceId: e,
|
|
853
862
|
requestHeaders: X,
|
|
854
863
|
apiBaseUrl: h,
|
|
855
|
-
preloadPaths:
|
|
864
|
+
preloadPaths: Fn,
|
|
856
865
|
provisionWorkspace: ke,
|
|
857
|
-
onStatusChange:
|
|
866
|
+
onStatusChange: dr
|
|
858
867
|
}
|
|
859
868
|
),
|
|
860
869
|
/* @__PURE__ */ f(
|
|
@@ -864,16 +873,16 @@ function Ci({
|
|
|
864
873
|
requestHeaders: X,
|
|
865
874
|
navOpen: Ut,
|
|
866
875
|
surfaceOpen: Q,
|
|
867
|
-
surfaceReady:
|
|
868
|
-
snapshot:
|
|
876
|
+
surfaceReady: nr,
|
|
877
|
+
snapshot: ir
|
|
869
878
|
}
|
|
870
879
|
),
|
|
871
880
|
/* @__PURE__ */ ye("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
872
881
|
/* @__PURE__ */ f(
|
|
873
|
-
|
|
882
|
+
Lr,
|
|
874
883
|
{
|
|
875
|
-
appTitle:
|
|
876
|
-
sessionTitle: xe ? "Loading sessions…" :
|
|
884
|
+
appTitle: Rn,
|
|
885
|
+
sessionTitle: xe ? "Loading sessions…" : er ?? q,
|
|
877
886
|
onCommandPalette: () => {
|
|
878
887
|
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
879
888
|
key: "k",
|
|
@@ -885,45 +894,44 @@ function Ci({
|
|
|
885
894
|
},
|
|
886
895
|
topBarLeft: xn,
|
|
887
896
|
topBarRight: /* @__PURE__ */ ye(ce, { children: [
|
|
888
|
-
|
|
889
|
-
|
|
897
|
+
Cn ? /* @__PURE__ */ f(Gr, {}) : null,
|
|
898
|
+
Mn
|
|
890
899
|
] })
|
|
891
900
|
}
|
|
892
901
|
),
|
|
893
902
|
xe ? /* @__PURE__ */ f(ai, {}) : /* @__PURE__ */ f(
|
|
894
|
-
|
|
903
|
+
Or,
|
|
895
904
|
{
|
|
896
|
-
className:
|
|
905
|
+
className: In,
|
|
897
906
|
nav: Ut ? "session-list" : null,
|
|
898
907
|
navParams: {
|
|
899
908
|
sessions: $,
|
|
900
909
|
activeId: Ke,
|
|
901
910
|
openIds: Ue,
|
|
902
|
-
pinnedIds:
|
|
903
|
-
onTogglePin:
|
|
911
|
+
pinnedIds: Kn,
|
|
912
|
+
onTogglePin: Jn,
|
|
904
913
|
onSwitch: or,
|
|
905
914
|
onOpenAsTab: Xt,
|
|
906
|
-
onCreate:
|
|
907
|
-
onDelete:
|
|
915
|
+
onCreate: ot,
|
|
916
|
+
onDelete: cr,
|
|
908
917
|
onLoadMore: d == null ? void 0 : d.loadMore,
|
|
909
918
|
hasMore: d == null ? void 0 : d.hasMore,
|
|
910
919
|
loadingMore: d == null ? void 0 : d.loadingMore,
|
|
911
920
|
onClose: () => $t(!1)
|
|
912
921
|
},
|
|
913
922
|
center: "chat",
|
|
914
|
-
centerParams:
|
|
915
|
-
chatPanes:
|
|
923
|
+
centerParams: gr,
|
|
924
|
+
chatPanes: mr,
|
|
916
925
|
activeChatPaneId: Ke,
|
|
917
|
-
onActiveChatPaneChange:
|
|
918
|
-
onCloseChatPane:
|
|
919
|
-
onCreateChatPaneAfter:
|
|
926
|
+
onActiveChatPaneChange: sr,
|
|
927
|
+
onCloseChatPane: ar,
|
|
928
|
+
onCreateChatPaneAfter: lr,
|
|
920
929
|
onDropChatSession: Xt,
|
|
921
930
|
flashChatPaneId: (re == null ? void 0 : re.workspaceId) === e ? re.id : null,
|
|
922
|
-
chatPaneEngine: In,
|
|
923
931
|
surface: Q ? "artifact-surface" : null,
|
|
924
|
-
surfaceParams:
|
|
925
|
-
surfaceOverlay:
|
|
926
|
-
sidebar: Q && !dt && lt &&
|
|
932
|
+
surfaceParams: pr,
|
|
933
|
+
surfaceOverlay: fr,
|
|
934
|
+
sidebar: Q && !dt && lt && rr ? "workbench-left" : null,
|
|
927
935
|
sidebarParams: Q && !dt && lt ? {
|
|
928
936
|
...Ae ? { defaultTab: Ae } : {},
|
|
929
937
|
onClose: () => ve(!1),
|
|
@@ -943,7 +951,7 @@ function Ci({
|
|
|
943
951
|
}
|
|
944
952
|
)
|
|
945
953
|
] }),
|
|
946
|
-
|
|
954
|
+
S
|
|
947
955
|
]
|
|
948
956
|
}
|
|
949
957
|
) });
|
|
@@ -952,90 +960,90 @@ const fi = 500;
|
|
|
952
960
|
function gi(e) {
|
|
953
961
|
return new Promise((n, r) => {
|
|
954
962
|
let i;
|
|
955
|
-
const
|
|
956
|
-
i && globalThis.clearTimeout(i), e.removeEventListener("abort",
|
|
957
|
-
},
|
|
958
|
-
|
|
963
|
+
const o = () => {
|
|
964
|
+
i && globalThis.clearTimeout(i), e.removeEventListener("abort", s);
|
|
965
|
+
}, s = () => {
|
|
966
|
+
o(), r(new DOMException("Workspace boot aborted", "AbortError"));
|
|
959
967
|
};
|
|
960
968
|
if (e.aborted) {
|
|
961
|
-
|
|
969
|
+
s();
|
|
962
970
|
return;
|
|
963
971
|
}
|
|
964
972
|
i = globalThis.setTimeout(() => {
|
|
965
|
-
|
|
966
|
-
}, fi), e.addEventListener("abort",
|
|
973
|
+
o(), n();
|
|
974
|
+
}, fi), e.addEventListener("abort", s, { once: !0 });
|
|
967
975
|
});
|
|
968
976
|
}
|
|
969
|
-
function
|
|
977
|
+
function Ci({
|
|
970
978
|
workspaceId: e,
|
|
971
979
|
requestHeaders: n,
|
|
972
980
|
apiBaseUrl: r,
|
|
973
981
|
preloadPaths: i = bn,
|
|
974
|
-
provisionWorkspace:
|
|
975
|
-
loadingFallback:
|
|
982
|
+
provisionWorkspace: o = !0,
|
|
983
|
+
loadingFallback: s,
|
|
976
984
|
errorFallback: c,
|
|
977
985
|
children: u
|
|
978
986
|
}) {
|
|
979
|
-
const [
|
|
987
|
+
const [S, y] = O({
|
|
980
988
|
status: "loading",
|
|
981
989
|
label: "Waking workspace runtime"
|
|
982
990
|
});
|
|
983
|
-
return
|
|
991
|
+
return A(() => {
|
|
984
992
|
const b = new AbortController(), B = qe(e, n);
|
|
985
|
-
async function
|
|
986
|
-
const h = await fetch(Pn(r,
|
|
993
|
+
async function W(T) {
|
|
994
|
+
const h = await fetch(Pn(r, T), {
|
|
987
995
|
headers: B,
|
|
988
996
|
signal: b.signal
|
|
989
997
|
}), N = await ze(h);
|
|
990
998
|
if (!h.ok) {
|
|
991
999
|
if (pt(N)) return "preparing";
|
|
992
|
-
throw new Error(ht(N) ?? `${
|
|
1000
|
+
throw new Error(ht(N) ?? `${T} failed with ${h.status}`);
|
|
993
1001
|
}
|
|
994
|
-
if (An(
|
|
995
|
-
const
|
|
996
|
-
if ((
|
|
1002
|
+
if (An(T)) {
|
|
1003
|
+
const D = He(N);
|
|
1004
|
+
if ((D == null ? void 0 : D.state) === "degraded") throw new Error(D.message ?? "Workspace failed to prepare");
|
|
997
1005
|
}
|
|
998
|
-
return
|
|
1006
|
+
return Dr(T) !== null && N && typeof N == "object" && En(r, B["x-boring-workspace-id"] ?? e, T, N), "ready";
|
|
999
1007
|
}
|
|
1000
1008
|
async function k() {
|
|
1001
|
-
|
|
1009
|
+
y({ status: "loading", label: "Waking workspace runtime" });
|
|
1002
1010
|
try {
|
|
1003
|
-
const
|
|
1004
|
-
let h = await Promise.all(
|
|
1011
|
+
const T = yn(i, o);
|
|
1012
|
+
let h = await Promise.all(T.map(async (m) => ({ path: m, status: await W(m) }))), N = h.filter((m) => m.status === "preparing").map((m) => m.path);
|
|
1005
1013
|
for (; N.length > 0; ) {
|
|
1006
|
-
if (
|
|
1007
|
-
h = await Promise.all(N.map(async (m) => ({ path: m, status: await
|
|
1014
|
+
if (y({ status: "loading", label: "Workspace is still preparing" }), await gi(b.signal), b.signal.aborted) return;
|
|
1015
|
+
h = await Promise.all(N.map(async (m) => ({ path: m, status: await W(m) }))), N = h.filter((m) => m.status === "preparing").map((m) => m.path);
|
|
1008
1016
|
}
|
|
1009
|
-
b.signal.aborted ||
|
|
1010
|
-
} catch (
|
|
1017
|
+
b.signal.aborted || y({ status: "ready" });
|
|
1018
|
+
} catch (T) {
|
|
1011
1019
|
if (b.signal.aborted) return;
|
|
1012
|
-
|
|
1020
|
+
y({
|
|
1013
1021
|
status: "error",
|
|
1014
|
-
message:
|
|
1022
|
+
message: T instanceof Error ? T.message : "Unknown workspace boot error"
|
|
1015
1023
|
});
|
|
1016
1024
|
}
|
|
1017
1025
|
}
|
|
1018
1026
|
return k(), () => b.abort();
|
|
1019
|
-
}, [r, i,
|
|
1027
|
+
}, [r, i, o, n, e]), S.status === "ready" ? /* @__PURE__ */ f(ce, { children: u }) : S.status === "error" ? typeof c == "function" ? /* @__PURE__ */ f(ce, { children: c(S.message) }) : c ? /* @__PURE__ */ f(ce, { children: c }) : /* @__PURE__ */ f(
|
|
1020
1028
|
fn,
|
|
1021
1029
|
{
|
|
1022
1030
|
title: "Workspace failed to open",
|
|
1023
|
-
description:
|
|
1031
|
+
description: S.message,
|
|
1024
1032
|
status: "Retry by reloading the page"
|
|
1025
1033
|
}
|
|
1026
|
-
) : typeof
|
|
1034
|
+
) : typeof s == "function" ? /* @__PURE__ */ f(ce, { children: s(S.label) }) : s ? /* @__PURE__ */ f(ce, { children: s }) : /* @__PURE__ */ f(
|
|
1027
1035
|
fn,
|
|
1028
1036
|
{
|
|
1029
1037
|
title: "Opening workspace",
|
|
1030
1038
|
description: "Waking the sandbox and preparing files, sessions, and layout.",
|
|
1031
|
-
status:
|
|
1039
|
+
status: S.label
|
|
1032
1040
|
}
|
|
1033
1041
|
);
|
|
1034
1042
|
}
|
|
1035
1043
|
const mi = "FULL_PAGE_PANEL_MISSING_COMPONENT", pi = "FULL_PAGE_PANEL_INVALID_PARAMS_JSON", hi = "FULL_PAGE_PANEL_PARAMS_NOT_OBJECT", vi = "FULL_PAGE_PANEL_UNKNOWN_COMPONENT", Si = "FULL_PAGE_PANEL_NOT_SUPPORTED", bi = "FULL_PAGE_PANEL_RENDER_FAILED";
|
|
1036
1044
|
function L() {
|
|
1037
1045
|
}
|
|
1038
|
-
const yi = { dispose: L },
|
|
1046
|
+
const yi = { dispose: L }, P = () => yi;
|
|
1039
1047
|
function Pi(e) {
|
|
1040
1048
|
return {
|
|
1041
1049
|
id: `full-page:${e}`,
|
|
@@ -1059,15 +1067,15 @@ function Pi(e) {
|
|
|
1059
1067
|
exitMaximized: L,
|
|
1060
1068
|
isMaximized: () => !1,
|
|
1061
1069
|
minimize: L,
|
|
1062
|
-
onDidActiveChange:
|
|
1063
|
-
onDidVisibilityChange:
|
|
1064
|
-
onDidDimensionsChange:
|
|
1065
|
-
onDidFocusChange:
|
|
1066
|
-
onDidLocationChange:
|
|
1067
|
-
onDidParametersChange:
|
|
1068
|
-
onDidTitleChange:
|
|
1069
|
-
onDidRenamed:
|
|
1070
|
-
onWillFocus:
|
|
1070
|
+
onDidActiveChange: P,
|
|
1071
|
+
onDidVisibilityChange: P,
|
|
1072
|
+
onDidDimensionsChange: P,
|
|
1073
|
+
onDidFocusChange: P,
|
|
1074
|
+
onDidLocationChange: P,
|
|
1075
|
+
onDidParametersChange: P,
|
|
1076
|
+
onDidTitleChange: P,
|
|
1077
|
+
onDidRenamed: P,
|
|
1078
|
+
onWillFocus: P
|
|
1071
1079
|
};
|
|
1072
1080
|
}
|
|
1073
1081
|
function Ai() {
|
|
@@ -1096,20 +1104,20 @@ function Ai() {
|
|
|
1096
1104
|
clear: L,
|
|
1097
1105
|
focus: L,
|
|
1098
1106
|
layout: L,
|
|
1099
|
-
onDidLayoutChange:
|
|
1100
|
-
onDidLayoutFromJSON:
|
|
1101
|
-
onDidAddPanel:
|
|
1102
|
-
onDidRemovePanel:
|
|
1103
|
-
onDidActivePanelChange:
|
|
1104
|
-
onDidAddGroup:
|
|
1105
|
-
onDidRemoveGroup:
|
|
1106
|
-
onDidActiveGroupChange:
|
|
1107
|
-
onUnhandledDragOverEvent:
|
|
1108
|
-
onDidDrop:
|
|
1109
|
-
onWillDrop:
|
|
1110
|
-
onWillDragGroup:
|
|
1111
|
-
onWillDragPanel:
|
|
1112
|
-
onDidActivePanelChange_:
|
|
1107
|
+
onDidLayoutChange: P,
|
|
1108
|
+
onDidLayoutFromJSON: P,
|
|
1109
|
+
onDidAddPanel: P,
|
|
1110
|
+
onDidRemovePanel: P,
|
|
1111
|
+
onDidActivePanelChange: P,
|
|
1112
|
+
onDidAddGroup: P,
|
|
1113
|
+
onDidRemoveGroup: P,
|
|
1114
|
+
onDidActiveGroupChange: P,
|
|
1115
|
+
onUnhandledDragOverEvent: P,
|
|
1116
|
+
onDidDrop: P,
|
|
1117
|
+
onWillDrop: P,
|
|
1118
|
+
onWillDragGroup: P,
|
|
1119
|
+
onWillDragPanel: P,
|
|
1120
|
+
onDidActivePanelChange_: P
|
|
1113
1121
|
};
|
|
1114
1122
|
}
|
|
1115
1123
|
function mt({ code: e, title: n, description: r }) {
|
|
@@ -1119,31 +1127,31 @@ function mt({ code: e, title: n, description: r }) {
|
|
|
1119
1127
|
className: "flex min-h-screen items-center justify-center bg-background p-6 text-foreground",
|
|
1120
1128
|
"data-testid": "full-page-error-state",
|
|
1121
1129
|
"data-full-page-error-code": e,
|
|
1122
|
-
children: /* @__PURE__ */ f(
|
|
1130
|
+
children: /* @__PURE__ */ f(Fr, { className: "w-full max-w-lg", title: n, description: r })
|
|
1123
1131
|
}
|
|
1124
1132
|
);
|
|
1125
1133
|
}
|
|
1126
|
-
function
|
|
1127
|
-
const r = wn(), { errors: i } =
|
|
1128
|
-
|
|
1129
|
-
document.title = (
|
|
1130
|
-
}, [e,
|
|
1131
|
-
const c =
|
|
1134
|
+
function Wi({ componentId: e, params: n = {} }) {
|
|
1135
|
+
const r = wn(), { errors: i } = Rr(), o = r.get(e), s = r.getComponents()[e];
|
|
1136
|
+
Sr(() => {
|
|
1137
|
+
document.title = (o == null ? void 0 : o.title) ?? e;
|
|
1138
|
+
}, [e, o == null ? void 0 : o.title]);
|
|
1139
|
+
const c = C(() => ({
|
|
1132
1140
|
params: n,
|
|
1133
1141
|
api: Pi(e),
|
|
1134
1142
|
containerApi: Ai(),
|
|
1135
1143
|
className: "h-full"
|
|
1136
|
-
}), [e, n]), u =
|
|
1137
|
-
if (!
|
|
1138
|
-
const
|
|
1139
|
-
for (let
|
|
1140
|
-
const b = i[
|
|
1141
|
-
if (b.contributionKind === "panel" && b.contributionId === e && b.pluginId ===
|
|
1144
|
+
}), [e, n]), u = C(() => {
|
|
1145
|
+
if (!o) return null;
|
|
1146
|
+
const S = o.pluginId ?? o.id;
|
|
1147
|
+
for (let y = i.length - 1; y >= 0; y -= 1) {
|
|
1148
|
+
const b = i[y];
|
|
1149
|
+
if (b.contributionKind === "panel" && b.contributionId === e && b.pluginId === S)
|
|
1142
1150
|
return b;
|
|
1143
1151
|
}
|
|
1144
1152
|
return null;
|
|
1145
|
-
}, [e, i,
|
|
1146
|
-
return
|
|
1153
|
+
}, [e, i, o]);
|
|
1154
|
+
return o ? !o.supportsFullPage || !s ? /* @__PURE__ */ f(
|
|
1147
1155
|
mt,
|
|
1148
1156
|
{
|
|
1149
1157
|
code: Si,
|
|
@@ -1157,7 +1165,7 @@ function Fi({ componentId: e, params: n = {} }) {
|
|
|
1157
1165
|
title: "Panel failed to render",
|
|
1158
1166
|
description: `Panel "${e}" crashed while rendering in full-page mode: ${u.error.message}`
|
|
1159
1167
|
}
|
|
1160
|
-
) : /* @__PURE__ */ f("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ f(
|
|
1168
|
+
) : /* @__PURE__ */ f("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ f(_r, { mode: "full-page", children: /* @__PURE__ */ f(s, { ...c }) }) }) : /* @__PURE__ */ f(
|
|
1161
1169
|
mt,
|
|
1162
1170
|
{
|
|
1163
1171
|
code: vi,
|
|
@@ -1166,9 +1174,9 @@ function Fi({ componentId: e, params: n = {} }) {
|
|
|
1166
1174
|
}
|
|
1167
1175
|
);
|
|
1168
1176
|
}
|
|
1169
|
-
function
|
|
1170
|
-
var
|
|
1171
|
-
const n = new URLSearchParams(e), r = ((
|
|
1177
|
+
function Fi(e) {
|
|
1178
|
+
var s;
|
|
1179
|
+
const n = new URLSearchParams(e), r = ((s = n.get("component")) == null ? void 0 : s.trim()) ?? "";
|
|
1172
1180
|
if (!r)
|
|
1173
1181
|
return {
|
|
1174
1182
|
componentId: null,
|
|
@@ -1181,9 +1189,9 @@ function Wi(e) {
|
|
|
1181
1189
|
const i = n.get("params");
|
|
1182
1190
|
if (!i)
|
|
1183
1191
|
return { componentId: r, params: {} };
|
|
1184
|
-
let
|
|
1192
|
+
let o;
|
|
1185
1193
|
try {
|
|
1186
|
-
|
|
1194
|
+
o = JSON.parse(i);
|
|
1187
1195
|
} catch {
|
|
1188
1196
|
return {
|
|
1189
1197
|
componentId: null,
|
|
@@ -1194,14 +1202,14 @@ function Wi(e) {
|
|
|
1194
1202
|
}
|
|
1195
1203
|
};
|
|
1196
1204
|
}
|
|
1197
|
-
return
|
|
1205
|
+
return o === null || Array.isArray(o) || typeof o != "object" ? {
|
|
1198
1206
|
componentId: null,
|
|
1199
1207
|
params: {},
|
|
1200
1208
|
error: {
|
|
1201
1209
|
code: hi,
|
|
1202
1210
|
message: "Full-page panel params must be a JSON object."
|
|
1203
1211
|
}
|
|
1204
|
-
} : { componentId: r, params:
|
|
1212
|
+
} : { componentId: r, params: o };
|
|
1205
1213
|
}
|
|
1206
1214
|
export {
|
|
1207
1215
|
pi as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
|
|
@@ -1210,11 +1218,11 @@ export {
|
|
|
1210
1218
|
hi as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
|
|
1211
1219
|
bi as FULL_PAGE_PANEL_RENDER_FAILED,
|
|
1212
1220
|
vi as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
|
|
1213
|
-
|
|
1221
|
+
Mi as WorkspaceAgentFront,
|
|
1214
1222
|
Yr as WorkspaceBackgroundBoot,
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1223
|
+
Ci as WorkspaceBootGate,
|
|
1224
|
+
Wi as WorkspaceFullPagePanel,
|
|
1225
|
+
Kr as createLocalStorageSessions,
|
|
1226
|
+
Fi as parseFullPagePanelLocation,
|
|
1227
|
+
Jr as useLocalStorageSessions
|
|
1220
1228
|
};
|