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