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