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