@hachej/boring-workspace 0.1.31 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FileTree-SmsE0Raq.js +289 -0
- package/dist/{MarkdownEditor-DPBSzTBz.js → MarkdownEditor-zbp8ezds.js} +1 -1
- package/dist/WorkspaceLoadingState-BlvZXmFg.js +719 -0
- package/dist/WorkspaceProvider-CuIZx1ua.js +6553 -0
- package/dist/app-front.d.ts +25 -2
- package/dist/app-front.js +697 -546
- 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 +84 -27
- package/dist/workspace.d.ts +92 -3
- 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/WorkspaceProvider-0V-2x7AH.js +0 -6357
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 k, 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 Mr, at as kr, U as xt, q as Fr, au as Ur, u as Gt, ag as Gr, av as Cr } from "./WorkspaceProvider-CuIZx1ua.js";
|
|
5
|
+
import { T as $r, C as Ir, r as Ot, w as qr, W as Wt } from "./WorkspaceLoadingState-BlvZXmFg.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
|
|
21
|
-
if (
|
|
22
|
-
return { sessions:
|
|
38
|
+
const i = JSON.parse(n), s = Array.isArray(i.sessions) ? i.sessions : Array.isArray(i.items) ? i.items : null;
|
|
39
|
+
if (s)
|
|
40
|
+
return { sessions: s, activeId: i.activeId ?? ((r = s[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
|
|
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 i = /* @__PURE__ */ new Set(), s = (a) => {
|
|
57
|
+
n = a, Yr(t, n), i.forEach((l) => l());
|
|
40
58
|
};
|
|
41
59
|
return {
|
|
42
60
|
getState: () => n,
|
|
43
|
-
subscribe(
|
|
44
|
-
return
|
|
45
|
-
|
|
61
|
+
subscribe(a) {
|
|
62
|
+
return i.add(a), () => {
|
|
63
|
+
i.delete(a);
|
|
46
64
|
};
|
|
47
65
|
},
|
|
48
|
-
switchTo(
|
|
49
|
-
|
|
66
|
+
switchTo(a) {
|
|
67
|
+
s({ ...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
|
+
s({ 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((f) => f.id !== a), p = n.activeId === a ? ((h = l[0]) == null ? void 0 : h.id) ?? "" : n.activeId;
|
|
80
|
+
s({ 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 we(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
|
|
89
|
-
|
|
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);
|
|
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,27 +142,41 @@ 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 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);
|
|
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) {
|
|
131
164
|
const n = t[r].split(`
|
|
132
|
-
`).filter((
|
|
165
|
+
`).filter((i) => i.startsWith("data:")).map((i) => i.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 Mt(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 Ee(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 kt(e) {
|
|
158
190
|
return new Promise((t, r) => {
|
|
159
191
|
let n;
|
|
160
|
-
const
|
|
161
|
-
n && globalThis.clearTimeout(n), e.removeEventListener("abort",
|
|
162
|
-
},
|
|
163
|
-
|
|
192
|
+
const i = () => {
|
|
193
|
+
n && globalThis.clearTimeout(n), e.removeEventListener("abort", s);
|
|
194
|
+
}, s = () => {
|
|
195
|
+
i(), r(new DOMException("Warmup aborted", "AbortError"));
|
|
164
196
|
};
|
|
165
197
|
if (e.aborted) {
|
|
166
|
-
|
|
198
|
+
s();
|
|
167
199
|
return;
|
|
168
200
|
}
|
|
169
201
|
n = globalThis.setTimeout(() => {
|
|
170
|
-
|
|
171
|
-
},
|
|
202
|
+
i(), t();
|
|
203
|
+
}, sn), e.addEventListener("abort", s, { once: !0 });
|
|
172
204
|
});
|
|
173
205
|
}
|
|
174
|
-
async function
|
|
206
|
+
async function on(e) {
|
|
207
|
+
const t = e.body;
|
|
208
|
+
if (!t) return Pe(await Ee(e));
|
|
209
|
+
const r = t.getReader(), n = new TextDecoder();
|
|
210
|
+
let i = "";
|
|
211
|
+
try {
|
|
212
|
+
for (; ; ) {
|
|
213
|
+
const { done: s, value: a } = await r.read();
|
|
214
|
+
if (a) {
|
|
215
|
+
i += n.decode(a, { stream: !s });
|
|
216
|
+
const l = Pe(i);
|
|
217
|
+
if (l) return l;
|
|
218
|
+
}
|
|
219
|
+
if (s)
|
|
220
|
+
return i += n.decode(), Pe(i);
|
|
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 i = await Ee(e);
|
|
238
|
+
if (Ke(i)) return { status: "preparing" };
|
|
239
|
+
throw new Error(Je(i) ?? `/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
|
-
workspaceId:
|
|
254
|
+
workspaceId: i
|
|
180
255
|
}) {
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
|
|
256
|
+
const s = await fetch($t(e, t), { headers: r, signal: n });
|
|
257
|
+
if (jt(t)) return ln(s);
|
|
258
|
+
const a = await Ee(s);
|
|
259
|
+
if (!s.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 ${s.status}`);
|
|
190
263
|
}
|
|
191
|
-
return
|
|
264
|
+
return a && typeof a == "object" && qt(e, r["x-boring-workspace-id"] ?? i, 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 =
|
|
198
|
-
provisionWorkspace:
|
|
199
|
-
onStatusChange:
|
|
270
|
+
preloadPaths: n = Ct,
|
|
271
|
+
provisionWorkspace: i = !0,
|
|
272
|
+
onStatusChange: s
|
|
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 = we(e, t);
|
|
277
|
+
async function h() {
|
|
278
|
+
var f, A;
|
|
279
|
+
s == null || s({ status: "preparing" });
|
|
206
280
|
try {
|
|
207
|
-
const
|
|
281
|
+
const w = Bt(n, i), C = (d) => cn({
|
|
208
282
|
apiBaseUrl: r,
|
|
209
283
|
path: d,
|
|
210
|
-
headers:
|
|
284
|
+
headers: p,
|
|
211
285
|
signal: l.signal,
|
|
212
286
|
workspaceId: e
|
|
213
287
|
});
|
|
214
|
-
let
|
|
215
|
-
if (
|
|
216
|
-
let
|
|
217
|
-
for (;
|
|
288
|
+
let b = await Promise.all(w.map(async (d) => ({ path: d, result: await C(d) })));
|
|
289
|
+
if (a || l.signal.aborted) return;
|
|
290
|
+
let g = (f = b.find((d) => d.result.runtimeDependencies)) == null ? void 0 : f.result.runtimeDependencies, y = b.filter((d) => d.result.status === "preparing");
|
|
291
|
+
for (; y.length > 0; ) {
|
|
218
292
|
let d;
|
|
219
|
-
for (const
|
|
220
|
-
if (
|
|
221
|
-
d =
|
|
293
|
+
for (const S of y)
|
|
294
|
+
if (S.result.status === "preparing" && S.result.requirement) {
|
|
295
|
+
d = S.result.requirement;
|
|
222
296
|
break;
|
|
223
297
|
}
|
|
224
|
-
if (
|
|
225
|
-
|
|
298
|
+
if (s == null || s({ status: "preparing", message: "Workspace is still preparing", ...d ? { requirement: d } : {} }), await kt(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 (s == null || s({ status: "ready", ...g ? { runtimeDependencies: g } : {} }); (g == null ? void 0 : g.state) === "preparing"; ) {
|
|
302
|
+
if (await kt(l.signal), a || l.signal.aborted) return;
|
|
303
|
+
const d = await C("/api/v1/ready-status");
|
|
304
|
+
if (a || l.signal.aborted) return;
|
|
305
|
+
g = d.runtimeDependencies, g && (s == null || s({ status: "ready", runtimeDependencies: g }));
|
|
306
|
+
}
|
|
307
|
+
} catch (w) {
|
|
308
|
+
if (a || l.signal.aborted) return;
|
|
309
|
+
s == null || s({
|
|
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, s, n, i, 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,
|
|
246
|
-
|
|
247
|
-
|
|
326
|
+
function qe(e, t, r) {
|
|
327
|
+
const [n, i] = _(() => Ot(e, t, r));
|
|
328
|
+
v(() => {
|
|
329
|
+
i(Ot(e, t, r));
|
|
248
330
|
}, [e, t, r]);
|
|
249
|
-
const
|
|
250
|
-
(
|
|
251
|
-
|
|
331
|
+
const s = L(
|
|
332
|
+
(a) => {
|
|
333
|
+
i(a), qr(e, a, r);
|
|
252
334
|
},
|
|
253
335
|
[r, e]
|
|
254
336
|
);
|
|
255
|
-
return [n,
|
|
337
|
+
return [n, s];
|
|
256
338
|
}
|
|
257
|
-
const
|
|
339
|
+
const je = {}, Ft = { status: "preparing" }, Ut = {
|
|
258
340
|
openTabs: [],
|
|
259
341
|
activeTab: null
|
|
260
342
|
};
|
|
261
|
-
function
|
|
262
|
-
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",
|
|
263
|
-
return /* @__PURE__ */ c("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */
|
|
343
|
+
function mn({ status: e }) {
|
|
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", i = e.status === "failed" ? e.message : "Chat is ready while files, tools, and workspace panels finish warming up.";
|
|
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
|
-
/* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children:
|
|
348
|
+
/* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children: i }),
|
|
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
|
-
const t = e.openTabs.find((
|
|
377
|
+
const t = e.openTabs.find((i) => i.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
|
-
surfaceReady:
|
|
289
|
-
snapshot:
|
|
385
|
+
surfaceReady: i,
|
|
386
|
+
snapshot: s
|
|
290
387
|
}) {
|
|
291
|
-
const
|
|
292
|
-
return
|
|
293
|
-
var
|
|
294
|
-
if (e === null || n && !
|
|
295
|
-
(
|
|
296
|
-
const
|
|
297
|
-
l.current =
|
|
298
|
-
const
|
|
388
|
+
const a = Gt(), l = k(null);
|
|
389
|
+
return v(() => {
|
|
390
|
+
var f;
|
|
391
|
+
if (e === null || n && !i) return;
|
|
392
|
+
(f = l.current) == null || f.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: s.openTabs,
|
|
400
|
+
activeTab: s.activeTab,
|
|
401
|
+
activeFile: yn(s),
|
|
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, s, n, i]), 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
|
-
sessionStorageKey:
|
|
324
|
-
providerStorageKey:
|
|
325
|
-
surfaceStorageKey:
|
|
420
|
+
sessionStorageKey: i,
|
|
421
|
+
providerStorageKey: s,
|
|
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: f,
|
|
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: d,
|
|
434
|
+
defaultTheme: S,
|
|
435
|
+
onThemeChange: Kt,
|
|
436
|
+
persistenceEnabled: He,
|
|
437
|
+
bridgeEndpoint: Ae,
|
|
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: F,
|
|
457
|
+
hotReloadEnabled: De,
|
|
458
|
+
frontPluginHotReload: er,
|
|
459
|
+
extraPanels: tt,
|
|
460
|
+
extraCommands: rt,
|
|
461
|
+
provisionWorkspace: Ne,
|
|
462
|
+
bootPreloadPaths: tr,
|
|
463
|
+
onWorkspaceWarmupStatusChange: ie,
|
|
464
|
+
onOpenNav: Re,
|
|
465
|
+
onOpenSurface: _e,
|
|
466
|
+
surfaceButtonBottomOffset: rr,
|
|
467
|
+
className: nr
|
|
370
468
|
}) {
|
|
371
|
-
var
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
),
|
|
376
|
-
() =>
|
|
469
|
+
var _t, Lt;
|
|
470
|
+
const Le = s ?? `boring-ui-v2:layout:${e}`, E = a ?? `${Le}:surface`, se = fn(
|
|
471
|
+
E,
|
|
472
|
+
Le
|
|
473
|
+
), oe = He !== !1, ae = i ?? `boring-workspace:sessions:${e}`, J = T(
|
|
474
|
+
() => we(e, n ?? je),
|
|
377
475
|
[n, e]
|
|
378
|
-
),
|
|
379
|
-
() =>
|
|
476
|
+
), ir = T(
|
|
477
|
+
() => we(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), [it, sr] = _(() => ({
|
|
483
|
+
workspaceId: e,
|
|
484
|
+
status: Ft
|
|
485
|
+
})), [ce, Te] = _(() => ({
|
|
486
|
+
workspaceId: e,
|
|
487
|
+
expired: !1
|
|
488
|
+
})), [st, 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
|
+
})), [xe, at] = _(null), fe = it.workspaceId === e ? it.status : Ft, or = t ?? xr, ar = r ?? Or, H = !t || !!r, Oe = H && Ne !== !1, We = () => {
|
|
495
|
+
}, D = ar({
|
|
496
|
+
requestHeaders: J,
|
|
497
|
+
storageKey: ae,
|
|
498
|
+
enabled: Oe
|
|
499
|
+
}), U = Oe && !D.loading && !D.error, x = Oe && !U, [me, lr] = _(() => ({ workspaceId: e, sessions: [], activeSessionId: null }));
|
|
500
|
+
v(() => {
|
|
501
|
+
U && lr((o) => {
|
|
502
|
+
const R = o.workspaceId === e, M = 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 && M && ee ? o : {
|
|
507
|
+
workspaceId: e,
|
|
508
|
+
sessions: D.sessions,
|
|
509
|
+
activeSessionId: D.activeSessionId
|
|
510
|
+
};
|
|
511
|
+
});
|
|
512
|
+
}, [D.activeSessionId, D.sessions, U, e]);
|
|
513
|
+
const Me = x && me.workspaceId === e && me.sessions.length > 0, ke = x ? pn(ae) : null, G = U ? D.sessions : Me ? me.sessions : [], cr = U ? D.activeSessionId : Me ? me.activeSessionId : null, u = H && (U || Me) ? 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 = k(!1), Y = !!(U && u && !V && G.length === 0 && !lt), ur = st.workspaceId === e && st.creating, dr = ot.workspaceId === e && ot.failed, fr = !!(U && u && !V && G.length === 0 && lt && !z.current && !dr), ct = Y || ur || fr;
|
|
514
|
+
v(() => {
|
|
515
|
+
if (!Y) {
|
|
516
|
+
ce.workspaceId !== e && Te({ workspaceId: e, expired: !1 });
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
Te({ workspaceId: e, expired: !1 });
|
|
520
|
+
const o = globalThis.setTimeout(() => {
|
|
521
|
+
Te({ workspaceId: e, expired: !0 });
|
|
522
|
+
}, 2e3);
|
|
523
|
+
return () => globalThis.clearTimeout(o);
|
|
524
|
+
}, [ce.workspaceId, Y, e]);
|
|
525
|
+
const mr = u ? G.map((o) => ({
|
|
526
|
+
...o,
|
|
527
|
+
title: o.title ?? "New session"
|
|
528
|
+
})) : void 0, pr = ke ? [{
|
|
529
|
+
id: ke,
|
|
530
|
+
title: "Loading sessions…",
|
|
531
|
+
createdAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
532
|
+
updatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
533
|
+
turnCount: 0
|
|
534
|
+
}] : [], Fe = u ? mr ?? [] : x ? pr : V ? Ve ?? [] : nt.sessions, ut = u ? cr ?? null : x ? ke : V ? ze ?? null : nt.activeId, j = (F == null ? void 0 : F.autoSubmitInitialDraft) === !0, pe = j && H && !V, [O, Q] = _(() => pe ? null : void 0), dt = k(e), B = k(!1);
|
|
535
|
+
v(() => {
|
|
536
|
+
if (dt.current !== e) {
|
|
537
|
+
dt.current = e, B.current = !1, Q(pe ? null : void 0);
|
|
400
538
|
return;
|
|
401
539
|
}
|
|
402
|
-
|
|
403
|
-
}, [
|
|
404
|
-
!
|
|
405
|
-
if (typeof (
|
|
540
|
+
pe && O === void 0 && (B.current = !1, Q(null));
|
|
541
|
+
}, [O, pe, e]), v(() => {
|
|
542
|
+
!u || O !== null || B.current || (B.current = !0, Promise.resolve(u.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, u]);
|
|
550
|
+
const N = O !== void 0 ? O ?? null : ut, ft = x ? We : (u == null ? void 0 : u.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 ? We : u ? () => {
|
|
551
|
+
const o = G.find((M) => M.id === N && dn(M, q)), R = u.create();
|
|
552
|
+
return o && Promise.resolve(R).then(() => u.delete(o.id)).catch(() => {
|
|
553
|
+
}), R;
|
|
554
|
+
} : Qe ?? le.create, pt = x ? We : (u == null ? void 0 : u.delete) ?? Xe ?? le.remove, hr = L((o) => (u && G.length <= 1 && (z.current = !0), pt(o)), [G.length, pt, u]), br = ((_t = Fe.find((o) => o.id === N)) == null ? void 0 : _t.title) ?? void 0, [yr, gt] = qe(
|
|
555
|
+
`${se}: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
|
+
`${se}:workbenchOpen`,
|
|
563
|
+
Yt ?? !1,
|
|
564
|
+
oe
|
|
565
|
+
), [Sr, Ue] = _(!1), [vr, X] = qe(
|
|
566
|
+
`${se}: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 = k(!1), I = k($), bt = k(E), Ge = k(null);
|
|
570
|
+
bt.current = E;
|
|
571
|
+
const [yt, St] = _(() => ({
|
|
572
|
+
key: E,
|
|
573
|
+
snapshot: Ut
|
|
574
|
+
})), Pr = yt.key === E ? yt.snapshot : Ut;
|
|
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
|
+
Ue(!1);
|
|
579
|
+
}, [E]), v(() => {
|
|
580
|
+
if (!(!u || u.loading) && !Y && O === void 0) {
|
|
581
|
+
if (G.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(u.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
|
+
}, [G.length, O, q, Y, u, e]), v(() => {
|
|
593
|
+
I.current = $;
|
|
594
|
+
}, [$]);
|
|
595
|
+
const vt = L((o) => {
|
|
596
|
+
Ge.current = { key: E, api: o }, Ue(!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]), ge = L(() => {
|
|
606
|
+
const o = Ge.current;
|
|
607
|
+
return (o == null ? void 0 : o.key) === bt.current ? o.api : null;
|
|
608
|
+
}, []), he = L(() => I.current, []), be = L(() => {
|
|
609
|
+
I.current = !0, W(!0);
|
|
610
|
+
}, [W]), ye = L(() => {
|
|
611
|
+
I.current = !0, W(!0), X(!0);
|
|
612
|
+
}, [W, X]), Se = L(() => {
|
|
613
|
+
I.current = !1, Ge.current = null, Ue(!1), W(!1);
|
|
614
|
+
}, [W]), ve = T(
|
|
615
|
+
() => (w == null ? void 0 : w.map(kr)) ?? [],
|
|
616
|
+
[w]
|
|
617
|
+
), Ce = T(
|
|
618
|
+
() => ve.some((o) => o.registrations.leftTabs.length > 0),
|
|
619
|
+
[ve]
|
|
620
|
+
), wt = T(
|
|
621
|
+
() => ve.flatMap((o) => o.registrations.panels.map((R) => R.id)),
|
|
622
|
+
[ve]
|
|
623
|
+
), Et = T(
|
|
624
|
+
() => [...tt ?? [], ...wt],
|
|
625
|
+
[tt, wt]
|
|
626
|
+
), At = N ?? (O !== void 0 ? "default" : ((Lt = Fe[0]) == null ? void 0 : Lt.id) ?? "default"), [wr, $e] = _(j), Dt = k(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 = !!!(xe && xe.workspaceId === e && xe.id === N) && !wr && Ne !== !1 && (H ? !!N : !0), Er = L((o) => {
|
|
635
|
+
sr({ workspaceId: e, status: o }), ie == null || ie(o);
|
|
636
|
+
}, [ie, e]);
|
|
637
|
+
v(() => {
|
|
638
|
+
var R;
|
|
639
|
+
const o = (M) => {
|
|
640
|
+
const ee = M.detail;
|
|
641
|
+
!ee || typeof ee != "object" || Ur(ee, {
|
|
642
|
+
surface: ge,
|
|
643
|
+
isWorkbenchOpen: he,
|
|
644
|
+
openWorkbench: be,
|
|
645
|
+
openWorkbenchSources: ye
|
|
501
646
|
});
|
|
502
647
|
};
|
|
503
|
-
return (
|
|
504
|
-
var
|
|
505
|
-
return (
|
|
648
|
+
return (R = globalThis.addEventListener) == null || R.call(globalThis, xt, o), () => {
|
|
649
|
+
var M;
|
|
650
|
+
return (M = globalThis.removeEventListener) == null ? void 0 : M.call(globalThis, xt, o);
|
|
506
651
|
};
|
|
507
|
-
}, [
|
|
508
|
-
|
|
509
|
-
}, [
|
|
510
|
-
const
|
|
652
|
+
}, [ge, he, be, ye]), 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
|
+
...F,
|
|
658
|
+
...Nt ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
|
|
659
|
+
sessionId: At,
|
|
660
|
+
requestHeaders: J,
|
|
661
|
+
bridgeEndpoint: Ae,
|
|
662
|
+
getSurface: ge,
|
|
663
|
+
isWorkbenchOpen: he,
|
|
664
|
+
openWorkbench: be,
|
|
665
|
+
openWorkbenchSources: ye,
|
|
666
|
+
closeWorkbench: Se,
|
|
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 = F == null ? void 0 : F.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
|
+
...De !== void 0 ? { hotReloadEnabled: De } : {}
|
|
534
679
|
}),
|
|
535
|
-
[
|
|
536
|
-
),
|
|
537
|
-
storageKey:
|
|
538
|
-
defaultLeftTab:
|
|
539
|
-
initialPanels:
|
|
540
|
-
extraPanels:
|
|
541
|
-
onReady:
|
|
542
|
-
onChange:
|
|
543
|
-
onClose:
|
|
680
|
+
[F, Nt, At, J, Ae, ge, he, be, ye, Se, rt, fe, Rt, De]
|
|
681
|
+
), Nr = T(() => ({
|
|
682
|
+
storageKey: E,
|
|
683
|
+
defaultLeftTab: ne,
|
|
684
|
+
initialPanels: et,
|
|
685
|
+
extraPanels: Et,
|
|
686
|
+
onReady: vt,
|
|
687
|
+
onChange: Pt,
|
|
688
|
+
onClose: Se
|
|
544
689
|
}), [
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
Ie,
|
|
690
|
+
Se,
|
|
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
|
+
Fr,
|
|
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: f,
|
|
705
|
+
catalogs: A,
|
|
706
|
+
plugins: w,
|
|
707
|
+
excludeDefaults: C,
|
|
708
|
+
capabilities: b,
|
|
709
|
+
apiBaseUrl: g,
|
|
710
|
+
authHeaders: ir,
|
|
711
|
+
apiTimeout: d,
|
|
712
|
+
defaultTheme: S,
|
|
713
|
+
onThemeChange: Kt,
|
|
569
714
|
workspaceId: e,
|
|
570
|
-
storageKey:
|
|
571
|
-
persistenceEnabled:
|
|
715
|
+
storageKey: Le,
|
|
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: Ne,
|
|
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: Ae,
|
|
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,149 @@ 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
|
-
|
|
774
|
+
sessions: Fe,
|
|
775
|
+
activeId: ut,
|
|
776
|
+
onSwitch: gr,
|
|
777
|
+
onCreate: mt,
|
|
778
|
+
onDelete: hr,
|
|
779
|
+
onLoadMore: u == null ? void 0 : u.loadMore,
|
|
780
|
+
hasMore: u == null ? void 0 : u.hasMore,
|
|
781
|
+
loadingMore: u == null ? void 0 : u.loadingMore,
|
|
782
|
+
onClose: () => gt(!1)
|
|
632
783
|
},
|
|
633
784
|
center: "chat",
|
|
634
|
-
centerParams:
|
|
635
|
-
surface:
|
|
636
|
-
surfaceParams:
|
|
637
|
-
surfaceOverlay:
|
|
638
|
-
sidebar:
|
|
639
|
-
sidebarParams:
|
|
640
|
-
...
|
|
641
|
-
onClose: () =>
|
|
642
|
-
onCollapse: () =>
|
|
785
|
+
centerParams: Dr,
|
|
786
|
+
surface: $ ? "artifact-surface" : null,
|
|
787
|
+
surfaceParams: Nr,
|
|
788
|
+
surfaceOverlay: Ar,
|
|
789
|
+
sidebar: $ && !Ie && Ce && vr ? "workbench-left" : null,
|
|
790
|
+
sidebarParams: $ && !Ie && Ce ? {
|
|
791
|
+
...ne ? { defaultTab: ne } : {},
|
|
792
|
+
onClose: () => X(!1),
|
|
793
|
+
onCollapse: () => X(!1)
|
|
643
794
|
} : void 0,
|
|
644
|
-
storageKey:
|
|
645
|
-
onOpenNav:
|
|
646
|
-
|
|
795
|
+
storageKey: oe ? se : void 0,
|
|
796
|
+
onOpenNav: Ze ? () => {
|
|
797
|
+
gt(!0), Re == null || Re();
|
|
647
798
|
} : void 0,
|
|
648
799
|
onOpenSurface: () => {
|
|
649
|
-
|
|
800
|
+
I.current = !0, W(!0), _e == null || _e();
|
|
650
801
|
},
|
|
651
|
-
surfaceButtonBottomOffset:
|
|
652
|
-
onOpenSidebar:
|
|
653
|
-
|
|
802
|
+
surfaceButtonBottomOffset: rr,
|
|
803
|
+
onOpenSidebar: Ce ? () => {
|
|
804
|
+
I.current = !0, W(!0), X(!0);
|
|
654
805
|
} : void 0
|
|
655
806
|
}
|
|
656
807
|
)
|
|
657
808
|
] }),
|
|
658
|
-
|
|
809
|
+
p
|
|
659
810
|
]
|
|
660
811
|
}
|
|
661
812
|
) });
|
|
662
813
|
}
|
|
663
|
-
const
|
|
664
|
-
function
|
|
814
|
+
const vn = 500;
|
|
815
|
+
function Pn(e) {
|
|
665
816
|
return new Promise((t, r) => {
|
|
666
817
|
let n;
|
|
667
|
-
const
|
|
668
|
-
n && globalThis.clearTimeout(n), e.removeEventListener("abort",
|
|
669
|
-
},
|
|
670
|
-
|
|
818
|
+
const i = () => {
|
|
819
|
+
n && globalThis.clearTimeout(n), e.removeEventListener("abort", s);
|
|
820
|
+
}, s = () => {
|
|
821
|
+
i(), r(new DOMException("Workspace boot aborted", "AbortError"));
|
|
671
822
|
};
|
|
672
823
|
if (e.aborted) {
|
|
673
|
-
|
|
824
|
+
s();
|
|
674
825
|
return;
|
|
675
826
|
}
|
|
676
827
|
n = globalThis.setTimeout(() => {
|
|
677
|
-
|
|
678
|
-
},
|
|
828
|
+
i(), t();
|
|
829
|
+
}, vn), e.addEventListener("abort", s, { once: !0 });
|
|
679
830
|
});
|
|
680
831
|
}
|
|
681
|
-
function
|
|
832
|
+
function qn({
|
|
682
833
|
workspaceId: e,
|
|
683
834
|
requestHeaders: t,
|
|
684
835
|
apiBaseUrl: r,
|
|
685
|
-
preloadPaths: n =
|
|
686
|
-
provisionWorkspace:
|
|
687
|
-
loadingFallback:
|
|
688
|
-
errorFallback:
|
|
836
|
+
preloadPaths: n = Ct,
|
|
837
|
+
provisionWorkspace: i = !0,
|
|
838
|
+
loadingFallback: s,
|
|
839
|
+
errorFallback: a,
|
|
689
840
|
children: l
|
|
690
841
|
}) {
|
|
691
|
-
const [
|
|
842
|
+
const [p, h] = _({
|
|
692
843
|
status: "loading",
|
|
693
844
|
label: "Waking workspace runtime"
|
|
694
845
|
});
|
|
695
|
-
return
|
|
696
|
-
const
|
|
697
|
-
async function
|
|
698
|
-
const
|
|
699
|
-
headers:
|
|
700
|
-
signal:
|
|
701
|
-
}), y = await
|
|
702
|
-
if (!
|
|
703
|
-
if (
|
|
704
|
-
throw new Error(
|
|
846
|
+
return v(() => {
|
|
847
|
+
const f = new AbortController(), A = we(e, t);
|
|
848
|
+
async function w(b) {
|
|
849
|
+
const g = await fetch($t(r, b), {
|
|
850
|
+
headers: A,
|
|
851
|
+
signal: f.signal
|
|
852
|
+
}), y = await Ee(g);
|
|
853
|
+
if (!g.ok) {
|
|
854
|
+
if (Ke(y)) return "preparing";
|
|
855
|
+
throw new Error(Je(y) ?? `${b} failed with ${g.status}`);
|
|
705
856
|
}
|
|
706
|
-
if (
|
|
707
|
-
const
|
|
708
|
-
if ((
|
|
857
|
+
if (jt(b)) {
|
|
858
|
+
const S = Pe(y);
|
|
859
|
+
if ((S == null ? void 0 : S.state) === "degraded") throw new Error(S.message ?? "Workspace failed to prepare");
|
|
709
860
|
}
|
|
710
|
-
return
|
|
861
|
+
return It(b) !== null && y && typeof y == "object" && qt(r, A["x-boring-workspace-id"] ?? e, b, y), "ready";
|
|
711
862
|
}
|
|
712
|
-
async function
|
|
713
|
-
|
|
863
|
+
async function C() {
|
|
864
|
+
h({ status: "loading", label: "Waking workspace runtime" });
|
|
714
865
|
try {
|
|
715
|
-
const
|
|
716
|
-
let
|
|
866
|
+
const b = Bt(n, i);
|
|
867
|
+
let g = await Promise.all(b.map(async (d) => ({ path: d, status: await w(d) }))), y = g.filter((d) => d.status === "preparing").map((d) => d.path);
|
|
717
868
|
for (; y.length > 0; ) {
|
|
718
|
-
if (
|
|
719
|
-
|
|
869
|
+
if (h({ status: "loading", label: "Workspace is still preparing" }), await Pn(f.signal), f.signal.aborted) return;
|
|
870
|
+
g = await Promise.all(y.map(async (d) => ({ path: d, status: await w(d) }))), y = g.filter((d) => d.status === "preparing").map((d) => d.path);
|
|
720
871
|
}
|
|
721
|
-
|
|
722
|
-
} catch (
|
|
723
|
-
if (
|
|
724
|
-
|
|
872
|
+
f.signal.aborted || h({ status: "ready" });
|
|
873
|
+
} catch (b) {
|
|
874
|
+
if (f.signal.aborted) return;
|
|
875
|
+
h({
|
|
725
876
|
status: "error",
|
|
726
|
-
message:
|
|
877
|
+
message: b instanceof Error ? b.message : "Unknown workspace boot error"
|
|
727
878
|
});
|
|
728
879
|
}
|
|
729
880
|
}
|
|
730
|
-
return
|
|
731
|
-
}, [r, n,
|
|
732
|
-
|
|
881
|
+
return C(), () => f.abort();
|
|
882
|
+
}, [r, n, i, 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(
|
|
883
|
+
Wt,
|
|
733
884
|
{
|
|
734
885
|
title: "Workspace failed to open",
|
|
735
|
-
description:
|
|
886
|
+
description: p.message,
|
|
736
887
|
status: "Retry by reloading the page"
|
|
737
888
|
}
|
|
738
|
-
) : typeof
|
|
739
|
-
|
|
889
|
+
) : typeof s == "function" ? /* @__PURE__ */ c(K, { children: s(p.label) }) : s ? /* @__PURE__ */ c(K, { children: s }) : /* @__PURE__ */ c(
|
|
890
|
+
Wt,
|
|
740
891
|
{
|
|
741
892
|
title: "Opening workspace",
|
|
742
893
|
description: "Waking the sandbox and preparing files, sessions, and layout.",
|
|
743
|
-
status:
|
|
894
|
+
status: p.label
|
|
744
895
|
}
|
|
745
896
|
);
|
|
746
897
|
}
|
|
747
|
-
const
|
|
748
|
-
function
|
|
898
|
+
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";
|
|
899
|
+
function P() {
|
|
749
900
|
}
|
|
750
|
-
const
|
|
751
|
-
function
|
|
901
|
+
const _n = { dispose: P }, m = () => _n;
|
|
902
|
+
function Ln(e) {
|
|
752
903
|
return {
|
|
753
904
|
id: `full-page:${e}`,
|
|
754
905
|
title: e,
|
|
@@ -758,31 +909,31 @@ function Kr(e) {
|
|
|
758
909
|
width: 0,
|
|
759
910
|
height: 0,
|
|
760
911
|
location: { type: "grid", referenceGroup: void 0 },
|
|
761
|
-
setActive:
|
|
912
|
+
setActive: P,
|
|
762
913
|
setTitle: (t) => {
|
|
763
914
|
document.title = t;
|
|
764
915
|
},
|
|
765
|
-
setSize:
|
|
916
|
+
setSize: P,
|
|
766
917
|
close: () => {
|
|
767
918
|
window.close();
|
|
768
919
|
},
|
|
769
|
-
moveTo:
|
|
770
|
-
maximize:
|
|
771
|
-
exitMaximized:
|
|
920
|
+
moveTo: P,
|
|
921
|
+
maximize: P,
|
|
922
|
+
exitMaximized: P,
|
|
772
923
|
isMaximized: () => !1,
|
|
773
|
-
minimize:
|
|
774
|
-
onDidActiveChange:
|
|
775
|
-
onDidVisibilityChange:
|
|
776
|
-
onDidDimensionsChange:
|
|
777
|
-
onDidFocusChange:
|
|
778
|
-
onDidLocationChange:
|
|
779
|
-
onDidParametersChange:
|
|
780
|
-
onDidTitleChange:
|
|
781
|
-
onDidRenamed:
|
|
782
|
-
onWillFocus:
|
|
924
|
+
minimize: P,
|
|
925
|
+
onDidActiveChange: m,
|
|
926
|
+
onDidVisibilityChange: m,
|
|
927
|
+
onDidDimensionsChange: m,
|
|
928
|
+
onDidFocusChange: m,
|
|
929
|
+
onDidLocationChange: m,
|
|
930
|
+
onDidParametersChange: m,
|
|
931
|
+
onDidTitleChange: m,
|
|
932
|
+
onDidRenamed: m,
|
|
933
|
+
onWillFocus: m
|
|
783
934
|
};
|
|
784
935
|
}
|
|
785
|
-
function
|
|
936
|
+
function Tn() {
|
|
786
937
|
return {
|
|
787
938
|
width: window.innerWidth,
|
|
788
939
|
height: window.innerHeight,
|
|
@@ -794,139 +945,139 @@ function jr() {
|
|
|
794
945
|
panels: [],
|
|
795
946
|
groups: [],
|
|
796
947
|
activeGroup: void 0,
|
|
797
|
-
addPanel:
|
|
798
|
-
addGroup:
|
|
799
|
-
removePanel:
|
|
800
|
-
removeGroup:
|
|
948
|
+
addPanel: P,
|
|
949
|
+
addGroup: P,
|
|
950
|
+
removePanel: P,
|
|
951
|
+
removeGroup: P,
|
|
801
952
|
getPanel: () => {
|
|
802
953
|
},
|
|
803
954
|
getGroup: () => {
|
|
804
955
|
},
|
|
805
|
-
moveGroupOrPanel:
|
|
806
|
-
fromJSON:
|
|
956
|
+
moveGroupOrPanel: P,
|
|
957
|
+
fromJSON: P,
|
|
807
958
|
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_:
|
|
959
|
+
clear: P,
|
|
960
|
+
focus: P,
|
|
961
|
+
layout: P,
|
|
962
|
+
onDidLayoutChange: m,
|
|
963
|
+
onDidLayoutFromJSON: m,
|
|
964
|
+
onDidAddPanel: m,
|
|
965
|
+
onDidRemovePanel: m,
|
|
966
|
+
onDidActivePanelChange: m,
|
|
967
|
+
onDidAddGroup: m,
|
|
968
|
+
onDidRemoveGroup: m,
|
|
969
|
+
onDidActiveGroupChange: m,
|
|
970
|
+
onUnhandledDragOverEvent: m,
|
|
971
|
+
onDidDrop: m,
|
|
972
|
+
onWillDrop: m,
|
|
973
|
+
onWillDragGroup: m,
|
|
974
|
+
onWillDragPanel: m,
|
|
975
|
+
onDidActivePanelChange_: m
|
|
825
976
|
};
|
|
826
977
|
}
|
|
827
|
-
function
|
|
978
|
+
function Be({ code: e, title: t, description: r }) {
|
|
828
979
|
return /* @__PURE__ */ c(
|
|
829
980
|
"div",
|
|
830
981
|
{
|
|
831
982
|
className: "flex min-h-screen items-center justify-center bg-background p-6 text-foreground",
|
|
832
983
|
"data-testid": "full-page-error-state",
|
|
833
984
|
"data-full-page-error-code": e,
|
|
834
|
-
children: /* @__PURE__ */ c(
|
|
985
|
+
children: /* @__PURE__ */ c(Jr, { className: "w-full max-w-lg", title: t, description: r })
|
|
835
986
|
}
|
|
836
987
|
);
|
|
837
988
|
}
|
|
838
|
-
function
|
|
839
|
-
const r =
|
|
840
|
-
|
|
841
|
-
document.title = (
|
|
842
|
-
}, [e,
|
|
843
|
-
const
|
|
989
|
+
function jn({ componentId: e, params: t = {} }) {
|
|
990
|
+
const r = Gt(), { errors: n } = Gr(), i = r.get(e), s = r.getComponents()[e];
|
|
991
|
+
Tr(() => {
|
|
992
|
+
document.title = (i == null ? void 0 : i.title) ?? e;
|
|
993
|
+
}, [e, i == null ? void 0 : i.title]);
|
|
994
|
+
const a = T(() => ({
|
|
844
995
|
params: t,
|
|
845
|
-
api:
|
|
846
|
-
containerApi:
|
|
996
|
+
api: Ln(e),
|
|
997
|
+
containerApi: Tn(),
|
|
847
998
|
className: "h-full"
|
|
848
|
-
}), [e, t]), l =
|
|
849
|
-
if (!
|
|
850
|
-
const
|
|
851
|
-
for (let
|
|
852
|
-
const
|
|
853
|
-
if (
|
|
854
|
-
return
|
|
999
|
+
}), [e, t]), l = T(() => {
|
|
1000
|
+
if (!i) return null;
|
|
1001
|
+
const p = i.pluginId ?? i.id;
|
|
1002
|
+
for (let h = n.length - 1; h >= 0; h -= 1) {
|
|
1003
|
+
const f = n[h];
|
|
1004
|
+
if (f.contributionKind === "panel" && f.contributionId === e && f.pluginId === p)
|
|
1005
|
+
return f;
|
|
855
1006
|
}
|
|
856
1007
|
return null;
|
|
857
|
-
}, [e, n,
|
|
858
|
-
return
|
|
859
|
-
|
|
1008
|
+
}, [e, n, i]);
|
|
1009
|
+
return i ? !i.supportsFullPage || !s ? /* @__PURE__ */ c(
|
|
1010
|
+
Be,
|
|
860
1011
|
{
|
|
861
|
-
code:
|
|
1012
|
+
code: Nn,
|
|
862
1013
|
title: "Panel does not support full-page mode",
|
|
863
1014
|
description: `Panel "${e}" can render in the workspace, but it has not opted into the dedicated full-page pane route.`
|
|
864
1015
|
}
|
|
865
1016
|
) : l ? /* @__PURE__ */ c(
|
|
866
|
-
|
|
1017
|
+
Be,
|
|
867
1018
|
{
|
|
868
|
-
code:
|
|
1019
|
+
code: Rn,
|
|
869
1020
|
title: "Panel failed to render",
|
|
870
1021
|
description: `Panel "${e}" crashed while rendering in full-page mode: ${l.error.message}`
|
|
871
1022
|
}
|
|
872
|
-
) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(
|
|
873
|
-
|
|
1023
|
+
) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(Cr, { mode: "full-page", children: /* @__PURE__ */ c(s, { ...a }) }) }) : /* @__PURE__ */ c(
|
|
1024
|
+
Be,
|
|
874
1025
|
{
|
|
875
|
-
code:
|
|
1026
|
+
code: Dn,
|
|
876
1027
|
title: "Unknown panel",
|
|
877
1028
|
description: `No full-page panel component is registered as "${e}".`
|
|
878
1029
|
}
|
|
879
1030
|
);
|
|
880
1031
|
}
|
|
881
|
-
function
|
|
882
|
-
var
|
|
883
|
-
const t = new URLSearchParams(e), r = ((
|
|
1032
|
+
function Bn(e) {
|
|
1033
|
+
var s;
|
|
1034
|
+
const t = new URLSearchParams(e), r = ((s = t.get("component")) == null ? void 0 : s.trim()) ?? "";
|
|
884
1035
|
if (!r)
|
|
885
1036
|
return {
|
|
886
1037
|
componentId: null,
|
|
887
1038
|
params: {},
|
|
888
1039
|
error: {
|
|
889
|
-
code:
|
|
1040
|
+
code: wn,
|
|
890
1041
|
message: "Missing full-page panel component id."
|
|
891
1042
|
}
|
|
892
1043
|
};
|
|
893
1044
|
const n = t.get("params");
|
|
894
1045
|
if (!n)
|
|
895
1046
|
return { componentId: r, params: {} };
|
|
896
|
-
let
|
|
1047
|
+
let i;
|
|
897
1048
|
try {
|
|
898
|
-
|
|
1049
|
+
i = JSON.parse(n);
|
|
899
1050
|
} catch {
|
|
900
1051
|
return {
|
|
901
1052
|
componentId: null,
|
|
902
1053
|
params: {},
|
|
903
1054
|
error: {
|
|
904
|
-
code:
|
|
1055
|
+
code: En,
|
|
905
1056
|
message: "Invalid full-page panel params JSON."
|
|
906
1057
|
}
|
|
907
1058
|
};
|
|
908
1059
|
}
|
|
909
|
-
return
|
|
1060
|
+
return i === null || Array.isArray(i) || typeof i != "object" ? {
|
|
910
1061
|
componentId: null,
|
|
911
1062
|
params: {},
|
|
912
1063
|
error: {
|
|
913
|
-
code:
|
|
1064
|
+
code: An,
|
|
914
1065
|
message: "Full-page panel params must be a JSON object."
|
|
915
1066
|
}
|
|
916
|
-
} : { componentId: r, params:
|
|
1067
|
+
} : { componentId: r, params: i };
|
|
917
1068
|
}
|
|
918
1069
|
export {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1070
|
+
En as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
|
|
1071
|
+
wn as FULL_PAGE_PANEL_MISSING_COMPONENT,
|
|
1072
|
+
Nn as FULL_PAGE_PANEL_NOT_SUPPORTED,
|
|
1073
|
+
An as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
|
|
1074
|
+
Rn as FULL_PAGE_PANEL_RENDER_FAILED,
|
|
1075
|
+
Dn as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
|
|
1076
|
+
In as WorkspaceAgentFront,
|
|
1077
|
+
un as WorkspaceBackgroundBoot,
|
|
1078
|
+
qn as WorkspaceBootGate,
|
|
1079
|
+
jn as WorkspaceFullPagePanel,
|
|
1080
|
+
Qr as createLocalStorageSessions,
|
|
1081
|
+
Bn as parseFullPagePanelLocation,
|
|
1082
|
+
Xr as useLocalStorageSessions
|
|
932
1083
|
};
|