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