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