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