@hachej/boring-workspace 0.1.24 → 0.1.26
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-DjPzfDMq.js → FileTree-BZGu5Ap6.js} +1 -1
- package/dist/{MarkdownEditor-BbSy0bLV.js → MarkdownEditor-DshmttZM.js} +1 -1
- package/dist/{WorkspaceLoadingState-fccm3AQg.js → WorkspaceLoadingState-DVCLcOQu.js} +1 -1
- package/dist/{WorkspaceProvider-BW4wzbpR.js → WorkspaceProvider-DQ-325Qs.js} +2319 -2216
- package/dist/app-front.js +361 -328
- package/dist/app-server.d.ts +9 -2
- package/dist/app-server.js +667 -566
- package/dist/createInMemoryBridge--ZFPAgXy.d.ts +161 -0
- package/dist/server.d.ts +41 -68
- package/dist/server.js +155 -26
- package/dist/testing.js +1 -1
- package/dist/workspace.js +5 -5
- package/package.json +3 -3
- package/dist/createInMemoryBridge-DLckqafe.d.ts +0 -61
package/dist/app-front.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
2
|
-
import { useSyncExternalStore as Xt, useEffect as
|
|
1
|
+
import { jsx as c, jsxs as Te, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { useSyncExternalStore as Xt, useEffect as E, useMemo as S, useState as G, useRef as O, useCallback as _, useLayoutEffect as Zt } from "react";
|
|
3
3
|
import { ChatPanel as er, useSessions as tr } from "@hachej/boring-agent/front";
|
|
4
|
-
import { as as rr, at as nr, U as lt, p as
|
|
5
|
-
import { T as lr, C as cr, r as ct, w as ur, W as ut } from "./WorkspaceLoadingState-
|
|
4
|
+
import { as as rr, at as nr, U as lt, p as or, au as sr, u as pt, ag as ir, av as ar } from "./WorkspaceProvider-DQ-325Qs.js";
|
|
5
|
+
import { T as lr, C as cr, r as ct, w as ur, W as ut } from "./WorkspaceLoadingState-DVCLcOQu.js";
|
|
6
6
|
import { ErrorState as dr } from "@hachej/boring-ui-kit";
|
|
7
7
|
function fr() {
|
|
8
8
|
const e = `s${Date.now()}`;
|
|
@@ -15,11 +15,11 @@ function pr(e, t) {
|
|
|
15
15
|
var r;
|
|
16
16
|
if (typeof localStorage > "u") return t();
|
|
17
17
|
try {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const n = JSON.parse(
|
|
21
|
-
if (
|
|
22
|
-
return { sessions:
|
|
18
|
+
const o = localStorage.getItem(e);
|
|
19
|
+
if (o) {
|
|
20
|
+
const n = JSON.parse(o), s = Array.isArray(n.sessions) ? n.sessions : Array.isArray(n.items) ? n.items : null;
|
|
21
|
+
if (s)
|
|
22
|
+
return { sessions: s, activeId: n.activeId ?? ((r = s[0]) == null ? void 0 : r.id) ?? "" };
|
|
23
23
|
}
|
|
24
24
|
} catch {
|
|
25
25
|
}
|
|
@@ -34,19 +34,19 @@ function mr(e, t) {
|
|
|
34
34
|
}
|
|
35
35
|
function gr(e = {}) {
|
|
36
36
|
const t = e.storageKey ?? "workspace:sessions", r = e.initial ?? fr;
|
|
37
|
-
let
|
|
38
|
-
const n = /* @__PURE__ */ new Set(),
|
|
39
|
-
|
|
37
|
+
let o = pr(t, r);
|
|
38
|
+
const n = /* @__PURE__ */ new Set(), s = (i) => {
|
|
39
|
+
o = i, mr(t, o), n.forEach((l) => l());
|
|
40
40
|
};
|
|
41
41
|
return {
|
|
42
|
-
getState: () =>
|
|
42
|
+
getState: () => o,
|
|
43
43
|
subscribe(i) {
|
|
44
44
|
return n.add(i), () => {
|
|
45
45
|
n.delete(i);
|
|
46
46
|
};
|
|
47
47
|
},
|
|
48
48
|
switchTo(i) {
|
|
49
|
-
|
|
49
|
+
s({ ...o, activeId: i });
|
|
50
50
|
},
|
|
51
51
|
create() {
|
|
52
52
|
const i = `s${Date.now()}`, l = {
|
|
@@ -54,54 +54,54 @@ function gr(e = {}) {
|
|
|
54
54
|
title: "New session",
|
|
55
55
|
updatedAt: Date.now()
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
s({ sessions: [l, ...o.sessions], activeId: i });
|
|
58
58
|
},
|
|
59
59
|
remove(i) {
|
|
60
60
|
var g;
|
|
61
|
-
const l =
|
|
62
|
-
|
|
61
|
+
const l = o.sessions.filter((f) => f.id !== i), b = o.activeId === i ? ((g = l[0]) == null ? void 0 : g.id) ?? "" : o.activeId;
|
|
62
|
+
s({ sessions: l, activeId: b });
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function br(e) {
|
|
67
67
|
return Xt(e.subscribe, e.getState, e.getState);
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const mt = ["/api/v1/tree?path=.", "/api/v1/agent/sessions"], hr = /* @__PURE__ */ new Set([
|
|
70
70
|
"WORKSPACE_NOT_READY",
|
|
71
71
|
"AGENT_RUNTIME_NOT_READY",
|
|
72
72
|
"RUNTIME_PROVISIONING_LOCKED"
|
|
73
73
|
]);
|
|
74
|
-
function
|
|
74
|
+
function gt(e, t) {
|
|
75
75
|
return /^https?:\/\//i.test(t) || !e ? t : `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
76
76
|
}
|
|
77
77
|
function le(e, t) {
|
|
78
78
|
const r = { ...t ?? {} };
|
|
79
|
-
for (const
|
|
80
|
-
|
|
79
|
+
for (const o of Object.keys(r))
|
|
80
|
+
o.toLowerCase() === "x-boring-workspace-id" && delete r[o];
|
|
81
81
|
return r["x-boring-workspace-id"] = e, r;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function bt(e) {
|
|
84
84
|
const t = new URL(e, "http://workspace.local");
|
|
85
85
|
return t.pathname !== "/api/v1/tree" ? null : t.searchParams.get("path") ?? ".";
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const n =
|
|
89
|
-
n === null || !
|
|
87
|
+
function ht(e, t, r, o) {
|
|
88
|
+
const n = bt(r);
|
|
89
|
+
n === null || !o || !Array.isArray(o.entries) || rr(e, t, n, o.entries);
|
|
90
90
|
}
|
|
91
91
|
const vr = /* @__PURE__ */ new Set(["workspace-fs", "sandbox-exec", "ui-bridge"]);
|
|
92
|
-
function
|
|
92
|
+
function yr(e) {
|
|
93
93
|
const t = e;
|
|
94
94
|
if (!t || typeof t != "object") return null;
|
|
95
|
-
const r = t.error ?? t,
|
|
96
|
-
return !
|
|
97
|
-
code:
|
|
98
|
-
retryable:
|
|
99
|
-
requirement:
|
|
95
|
+
const r = t.error ?? t, o = r.details ?? t.details ?? r;
|
|
96
|
+
return !o || typeof o != "object" ? null : {
|
|
97
|
+
code: o.code ?? r.code ?? t.code,
|
|
98
|
+
retryable: o.retryable ?? r.retryable,
|
|
99
|
+
requirement: o.requirement ?? r.requirement
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
const t =
|
|
104
|
-
if (typeof (t == null ? void 0 : t.code) != "string" || !
|
|
102
|
+
function vt(e) {
|
|
103
|
+
const t = yr(e);
|
|
104
|
+
if (typeof (t == null ? void 0 : t.code) != "string" || !hr.has(t.code) || t.retryable !== !0) return null;
|
|
105
105
|
const r = typeof t.requirement == "string" && vr.has(t.requirement) ? t.requirement : void 0;
|
|
106
106
|
return r ? { requirement: r } : {};
|
|
107
107
|
}
|
|
@@ -109,14 +109,14 @@ function Pr(e) {
|
|
|
109
109
|
const t = new URL(e, "http://workspace.local");
|
|
110
110
|
return t.pathname === "/api/v1/agent/sessions" || t.pathname === "/api/v1/ready-status";
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function yt(e) {
|
|
113
113
|
return new URL(e, "http://workspace.local").pathname === "/api/v1/ready-status";
|
|
114
114
|
}
|
|
115
115
|
function Pt(e, t) {
|
|
116
|
-
const r = t ? [...e, "/api/v1/ready-status"] : e.filter((
|
|
116
|
+
const r = t ? [...e, "/api/v1/ready-status"] : e.filter((o) => !Pr(o));
|
|
117
117
|
return Array.from(new Set(r));
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function wt(e) {
|
|
120
120
|
if (typeof e == "string") return e || null;
|
|
121
121
|
if (!e || typeof e != "object") return null;
|
|
122
122
|
const t = e;
|
|
@@ -124,15 +124,15 @@ function St(e) {
|
|
|
124
124
|
const r = t.error;
|
|
125
125
|
return typeof (r == null ? void 0 : r.message) == "string" && r.message ? r.message : null;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Et(e) {
|
|
128
128
|
if (typeof e != "string" || !e.trim()) return null;
|
|
129
129
|
const t = e.split(/\n\n+/);
|
|
130
130
|
for (let r = t.length - 1; r >= 0; r -= 1) {
|
|
131
|
-
const
|
|
131
|
+
const o = t[r].split(`
|
|
132
132
|
`).filter((n) => n.startsWith("data:")).map((n) => n.slice(5).trim());
|
|
133
|
-
if (
|
|
133
|
+
if (o.length !== 0)
|
|
134
134
|
try {
|
|
135
|
-
const n = JSON.parse(
|
|
135
|
+
const n = JSON.parse(o.join(`
|
|
136
136
|
`));
|
|
137
137
|
return {
|
|
138
138
|
state: typeof n.state == "string" ? n.state : void 0,
|
|
@@ -144,7 +144,7 @@ function wt(e) {
|
|
|
144
144
|
}
|
|
145
145
|
return null;
|
|
146
146
|
}
|
|
147
|
-
async function
|
|
147
|
+
async function St(e) {
|
|
148
148
|
const t = await e.text().catch(() => "");
|
|
149
149
|
if (!t) return null;
|
|
150
150
|
try {
|
|
@@ -153,177 +153,192 @@ async function Et(e) {
|
|
|
153
153
|
return t;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
+
const wr = 500;
|
|
157
|
+
function Er(e) {
|
|
158
|
+
return new Promise((t, r) => {
|
|
159
|
+
let o;
|
|
160
|
+
const n = () => {
|
|
161
|
+
o && globalThis.clearTimeout(o), e.removeEventListener("abort", s);
|
|
162
|
+
}, s = () => {
|
|
163
|
+
n(), r(new DOMException("Warmup aborted", "AbortError"));
|
|
164
|
+
};
|
|
165
|
+
if (e.aborted) {
|
|
166
|
+
s();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
o = globalThis.setTimeout(() => {
|
|
170
|
+
n(), t();
|
|
171
|
+
}, wr), e.addEventListener("abort", s, { once: !0 });
|
|
172
|
+
});
|
|
173
|
+
}
|
|
156
174
|
async function Sr({
|
|
157
175
|
apiBaseUrl: e,
|
|
158
176
|
path: t,
|
|
159
177
|
headers: r,
|
|
160
|
-
signal:
|
|
178
|
+
signal: o,
|
|
161
179
|
workspaceId: n
|
|
162
180
|
}) {
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
165
|
-
const l =
|
|
181
|
+
const s = await fetch(gt(e, t), { headers: r, signal: o }), i = await St(s);
|
|
182
|
+
if (!s.ok) {
|
|
183
|
+
const l = vt(i);
|
|
166
184
|
if (l) return { status: "preparing", ...l };
|
|
167
|
-
throw new Error(
|
|
185
|
+
throw new Error(wt(i) ?? `${t} failed with ${s.status}`);
|
|
168
186
|
}
|
|
169
|
-
if (
|
|
170
|
-
const l =
|
|
187
|
+
if (yt(t)) {
|
|
188
|
+
const l = Et(i);
|
|
171
189
|
if ((l == null ? void 0 : l.state) === "degraded") throw new Error(l.message ?? "Workspace failed to prepare");
|
|
172
190
|
}
|
|
173
|
-
return i && typeof i == "object" &&
|
|
191
|
+
return i && typeof i == "object" && ht(e, r["x-boring-workspace-id"] ?? n, t, i), { status: "ready" };
|
|
174
192
|
}
|
|
175
|
-
function
|
|
193
|
+
function Ar({
|
|
176
194
|
workspaceId: e,
|
|
177
195
|
requestHeaders: t,
|
|
178
196
|
apiBaseUrl: r,
|
|
179
|
-
preloadPaths:
|
|
197
|
+
preloadPaths: o = mt,
|
|
180
198
|
provisionWorkspace: n = !0,
|
|
181
|
-
onStatusChange:
|
|
199
|
+
onStatusChange: s
|
|
182
200
|
}) {
|
|
183
|
-
return
|
|
201
|
+
return E(() => {
|
|
184
202
|
let i = !1;
|
|
185
|
-
const l = new AbortController(),
|
|
203
|
+
const l = new AbortController(), b = le(e, t);
|
|
186
204
|
async function g() {
|
|
187
|
-
|
|
205
|
+
s == null || s({ status: "preparing" });
|
|
188
206
|
try {
|
|
189
|
-
const
|
|
207
|
+
const f = Pt(o, n), T = (u) => Sr({
|
|
190
208
|
apiBaseUrl: r,
|
|
191
209
|
path: u,
|
|
192
|
-
headers:
|
|
210
|
+
headers: b,
|
|
193
211
|
signal: l.signal,
|
|
194
212
|
workspaceId: e
|
|
195
213
|
});
|
|
196
|
-
let P = await Promise.all(
|
|
214
|
+
let P = await Promise.all(f.map(async (u) => ({ path: u, result: await T(u) })));
|
|
197
215
|
if (i || l.signal.aborted) return;
|
|
198
|
-
let
|
|
199
|
-
|
|
216
|
+
let R = P.filter((u) => u.result.status === "preparing");
|
|
217
|
+
for (; R.length > 0; ) {
|
|
200
218
|
let u;
|
|
201
|
-
for (const m of
|
|
219
|
+
for (const m of R)
|
|
202
220
|
if (m.result.status === "preparing" && m.result.requirement) {
|
|
203
221
|
u = m.result.requirement;
|
|
204
222
|
break;
|
|
205
223
|
}
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
_ = P.filter((m) => m.result.status === "preparing");
|
|
209
|
-
}
|
|
210
|
-
if (_.length > 0) return;
|
|
224
|
+
if (s == null || s({ status: "preparing", message: "Workspace is still preparing", ...u ? { requirement: u } : {} }), await Er(l.signal), i || l.signal.aborted || (P = await Promise.all(R.map(async (m) => ({ path: m.path, result: await T(m.path) }))), i || l.signal.aborted)) return;
|
|
225
|
+
R = P.filter((m) => m.result.status === "preparing");
|
|
211
226
|
}
|
|
212
|
-
|
|
213
|
-
} catch (
|
|
227
|
+
s == null || s({ status: "ready" });
|
|
228
|
+
} catch (f) {
|
|
214
229
|
if (i || l.signal.aborted) return;
|
|
215
|
-
|
|
230
|
+
s == null || s({
|
|
216
231
|
status: "failed",
|
|
217
|
-
message:
|
|
232
|
+
message: f instanceof Error ? f.message : "Workspace failed to prepare"
|
|
218
233
|
});
|
|
219
234
|
}
|
|
220
235
|
}
|
|
221
236
|
return g(), () => {
|
|
222
237
|
i = !0, l.abort();
|
|
223
238
|
};
|
|
224
|
-
}, [r,
|
|
239
|
+
}, [r, s, o, n, t, e]), null;
|
|
225
240
|
}
|
|
226
|
-
function
|
|
241
|
+
function _r(e, t) {
|
|
227
242
|
return e.endsWith(":surface") ? e.slice(0, -8) : t;
|
|
228
243
|
}
|
|
229
|
-
function
|
|
230
|
-
const [
|
|
231
|
-
|
|
244
|
+
function Re(e, t, r) {
|
|
245
|
+
const [o, n] = G(() => ct(e, t, r));
|
|
246
|
+
E(() => {
|
|
232
247
|
n(ct(e, t, r));
|
|
233
248
|
}, [e, t, r]);
|
|
234
|
-
const
|
|
249
|
+
const s = _(
|
|
235
250
|
(i) => {
|
|
236
251
|
n(i), ur(e, i, r);
|
|
237
252
|
},
|
|
238
253
|
[r, e]
|
|
239
254
|
);
|
|
240
|
-
return [
|
|
255
|
+
return [o, s];
|
|
241
256
|
}
|
|
242
|
-
const
|
|
257
|
+
const De = {}, dt = { status: "preparing" }, ft = {
|
|
243
258
|
openTabs: [],
|
|
244
259
|
activeTab: null
|
|
245
260
|
};
|
|
246
|
-
function
|
|
247
|
-
const t = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed",
|
|
248
|
-
return /* @__PURE__ */ c("div", { className: "flex h-full min-h-0 items-center justify-center bg-background px-6 text-center", children: /* @__PURE__ */
|
|
261
|
+
function Nr({ status: e }) {
|
|
262
|
+
const t = e.status === "ready" ? void 0 : e.requirement, r = e.status !== "failed", o = r ? t === "workspace-fs" ? "Preparing files…" : t === "sandbox-exec" ? "Waking sandbox…" : t === "ui-bridge" ? "Connecting workspace UI…" : "Preparing workspace…" : "Workspace workbench failed", n = 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__ */ Te("div", { className: "max-w-sm rounded-2xl border border-border bg-card p-5 shadow-sm", children: [
|
|
249
264
|
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,
|
|
250
|
-
/* @__PURE__ */ c("div", { className: "text-sm font-semibold text-foreground", children:
|
|
265
|
+
/* @__PURE__ */ c("div", { className: "text-sm font-semibold text-foreground", children: o }),
|
|
251
266
|
/* @__PURE__ */ c("p", { className: "mt-2 text-sm text-muted-foreground", children: n }),
|
|
252
267
|
e.status === "failed" ? /* @__PURE__ */ c("p", { className: "mt-3 text-xs text-muted-foreground", children: "Reload the workspace to retry." }) : null
|
|
253
268
|
] }) });
|
|
254
269
|
}
|
|
255
|
-
function
|
|
270
|
+
function Lr(e) {
|
|
256
271
|
if (!e) return "/api/v1/ui";
|
|
257
272
|
const t = e.replace(/\/$/, ""), r = "/api/v1/ui";
|
|
258
273
|
return t.endsWith(r) ? t : `${t}${r}`;
|
|
259
274
|
}
|
|
260
|
-
function
|
|
261
|
-
return `${
|
|
275
|
+
function Rr(e) {
|
|
276
|
+
return `${Lr(e)}/state`;
|
|
262
277
|
}
|
|
263
|
-
function
|
|
264
|
-
var
|
|
265
|
-
const t = e.openTabs.find((n) => n.id === e.activeTab), r = (
|
|
278
|
+
function Dr(e) {
|
|
279
|
+
var o;
|
|
280
|
+
const t = e.openTabs.find((n) => n.id === e.activeTab), r = (o = t == null ? void 0 : t.params) == null ? void 0 : o.path;
|
|
266
281
|
return typeof r == "string" ? r : null;
|
|
267
282
|
}
|
|
268
|
-
function
|
|
283
|
+
function Or({
|
|
269
284
|
bridgeEndpoint: e,
|
|
270
285
|
requestHeaders: t,
|
|
271
286
|
navOpen: r,
|
|
272
|
-
surfaceOpen:
|
|
287
|
+
surfaceOpen: o,
|
|
273
288
|
snapshot: n
|
|
274
289
|
}) {
|
|
275
|
-
const
|
|
276
|
-
return
|
|
290
|
+
const s = pt(), i = O(null);
|
|
291
|
+
return E(() => {
|
|
277
292
|
var g;
|
|
278
293
|
if (e === null) return;
|
|
279
294
|
(g = i.current) == null || g.abort();
|
|
280
295
|
const l = new AbortController();
|
|
281
296
|
i.current = l;
|
|
282
|
-
const
|
|
297
|
+
const b = {
|
|
283
298
|
v: 1,
|
|
284
299
|
drawerOpen: r,
|
|
285
|
-
workbenchOpen:
|
|
300
|
+
workbenchOpen: o,
|
|
286
301
|
openTabs: n.openTabs,
|
|
287
302
|
activeTab: n.activeTab,
|
|
288
|
-
activeFile:
|
|
289
|
-
availablePanels:
|
|
303
|
+
activeFile: Dr(n),
|
|
304
|
+
availablePanels: s.list().map((f) => f.id)
|
|
290
305
|
};
|
|
291
|
-
return fetch(
|
|
306
|
+
return fetch(Rr(e), {
|
|
292
307
|
method: "PUT",
|
|
293
308
|
headers: { ...t, "Content-Type": "application/json" },
|
|
294
|
-
body: JSON.stringify({ state:
|
|
309
|
+
body: JSON.stringify({ state: b, causedBy: "user" }),
|
|
295
310
|
signal: l.signal
|
|
296
311
|
}).catch(() => {
|
|
297
312
|
}), () => {
|
|
298
313
|
l.abort();
|
|
299
314
|
};
|
|
300
|
-
}, [e, r,
|
|
315
|
+
}, [e, r, s, t, n, o]), null;
|
|
301
316
|
}
|
|
302
|
-
function
|
|
317
|
+
function zr({
|
|
303
318
|
workspaceId: e,
|
|
304
319
|
chatPanel: t,
|
|
305
320
|
useSessions: r,
|
|
306
|
-
requestHeaders:
|
|
321
|
+
requestHeaders: o,
|
|
307
322
|
sessionStorageKey: n,
|
|
308
|
-
providerStorageKey:
|
|
323
|
+
providerStorageKey: s,
|
|
309
324
|
surfaceStorageKey: i,
|
|
310
325
|
beforeShell: l,
|
|
311
|
-
afterShell:
|
|
326
|
+
afterShell: b,
|
|
312
327
|
panels: g,
|
|
313
|
-
commands:
|
|
314
|
-
catalogs:
|
|
328
|
+
commands: f,
|
|
329
|
+
catalogs: T,
|
|
315
330
|
plugins: P,
|
|
316
|
-
excludeDefaults:
|
|
331
|
+
excludeDefaults: R,
|
|
317
332
|
capabilities: u,
|
|
318
333
|
apiBaseUrl: m,
|
|
319
|
-
authHeaders:
|
|
320
|
-
apiTimeout:
|
|
334
|
+
authHeaders: y,
|
|
335
|
+
apiTimeout: h,
|
|
321
336
|
defaultTheme: W,
|
|
322
337
|
onThemeChange: At,
|
|
323
|
-
persistenceEnabled:
|
|
324
|
-
bridgeEndpoint:
|
|
325
|
-
fullPageBasePath:
|
|
326
|
-
onAuthError:
|
|
338
|
+
persistenceEnabled: xe,
|
|
339
|
+
bridgeEndpoint: ce,
|
|
340
|
+
fullPageBasePath: _t,
|
|
341
|
+
onAuthError: Nt,
|
|
327
342
|
sessions: ke,
|
|
328
343
|
activeSessionId: We,
|
|
329
344
|
onSwitchSession: Ue,
|
|
@@ -338,144 +353,144 @@ function Br({
|
|
|
338
353
|
defaultWorkbenchLeftTab: V,
|
|
339
354
|
surfaceInitialPanels: $e,
|
|
340
355
|
topBarLeft: Ot,
|
|
341
|
-
topBarRight:
|
|
356
|
+
topBarRight: Tt,
|
|
342
357
|
chatParams: D,
|
|
343
|
-
hotReloadEnabled:
|
|
344
|
-
frontPluginHotReload:
|
|
345
|
-
extraPanels:
|
|
346
|
-
extraCommands:
|
|
347
|
-
provisionWorkspace:
|
|
358
|
+
hotReloadEnabled: ue,
|
|
359
|
+
frontPluginHotReload: xt,
|
|
360
|
+
extraPanels: Ie,
|
|
361
|
+
extraCommands: Ce,
|
|
362
|
+
provisionWorkspace: de,
|
|
348
363
|
bootPreloadPaths: kt,
|
|
349
|
-
onWorkspaceWarmupStatusChange:
|
|
350
|
-
onOpenNav:
|
|
351
|
-
onOpenSurface:
|
|
364
|
+
onWorkspaceWarmupStatusChange: Y,
|
|
365
|
+
onOpenNav: fe,
|
|
366
|
+
onOpenSurface: pe,
|
|
352
367
|
surfaceButtonBottomOffset: Wt,
|
|
353
368
|
className: Ut
|
|
354
369
|
}) {
|
|
355
370
|
var it, at;
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
), Q =
|
|
360
|
-
() => le(e,
|
|
361
|
-
[
|
|
362
|
-
), Ft =
|
|
363
|
-
() => le(e,
|
|
364
|
-
[
|
|
365
|
-
), X =
|
|
366
|
-
() => gr({ storageKey:
|
|
367
|
-
[
|
|
368
|
-
), Ke =
|
|
371
|
+
const me = s ?? `boring-ui-v2:layout:${e}`, w = i ?? `${me}:surface`, z = _r(
|
|
372
|
+
w,
|
|
373
|
+
me
|
|
374
|
+
), Q = xe !== !1, ge = n ?? `boring-workspace:sessions:${e}`, $ = S(
|
|
375
|
+
() => le(e, o ?? De),
|
|
376
|
+
[o, e]
|
|
377
|
+
), Ft = S(
|
|
378
|
+
() => le(e, { ...o ?? De, ...y ?? De }),
|
|
379
|
+
[y, o, e]
|
|
380
|
+
), X = S(
|
|
381
|
+
() => gr({ storageKey: ge }),
|
|
382
|
+
[ge]
|
|
383
|
+
), Ke = br(X), [je, Gt] = G(() => ({
|
|
369
384
|
workspaceId: e,
|
|
370
|
-
status:
|
|
371
|
-
})),
|
|
372
|
-
},
|
|
385
|
+
status: dt
|
|
386
|
+
})), I = je.workspaceId === e ? je.status : dt, Mt = t ?? er, $t = r ?? tr, C = !t || !!r, be = C && de !== !1, he = () => {
|
|
387
|
+
}, ve = $t({
|
|
373
388
|
requestHeaders: $,
|
|
374
|
-
storageKey:
|
|
375
|
-
enabled:
|
|
376
|
-
refreshKey:
|
|
377
|
-
}),
|
|
389
|
+
storageKey: ge,
|
|
390
|
+
enabled: be,
|
|
391
|
+
refreshKey: I.status === "ready" ? "workspace-ready" : void 0
|
|
392
|
+
}), ye = be && !ve.loading && !ve.error, K = be && !ye, p = C && ye ? ve : void 0, Pe = ke !== void 0 || We !== void 0 || Ue !== void 0 || Fe !== void 0 || Ge !== void 0, It = p == null ? void 0 : p.sessions.map((a) => ({
|
|
378
393
|
...a,
|
|
379
394
|
title: a.title ?? "New session"
|
|
380
|
-
})), we =
|
|
381
|
-
|
|
382
|
-
if (
|
|
383
|
-
|
|
395
|
+
})), we = p ? It ?? [] : K ? [] : Pe ? ke ?? [] : Ke.sessions, Ee = p ? p.activeSessionId ?? null : K ? null : Pe ? We ?? null : Ke.activeId, U = (D == null ? void 0 : D.autoSubmitInitialDraft) === !0, Z = U && C && !Pe, [N, j] = G(() => Z ? null : void 0), Je = O(e), F = O(!1);
|
|
396
|
+
E(() => {
|
|
397
|
+
if (Je.current !== e) {
|
|
398
|
+
Je.current = e, F.current = !1, j(Z ? null : void 0);
|
|
384
399
|
return;
|
|
385
400
|
}
|
|
386
|
-
Z &&
|
|
387
|
-
}, [
|
|
388
|
-
!
|
|
401
|
+
Z && N === void 0 && (F.current = !1, j(null));
|
|
402
|
+
}, [N, Z, e]), E(() => {
|
|
403
|
+
!p || N !== null || F.current || (F.current = !0, Promise.resolve(p.create({ title: M })).then((a) => {
|
|
389
404
|
if (typeof (a == null ? void 0 : a.id) != "string")
|
|
390
405
|
throw new Error("auto_submit_session_create_failed");
|
|
391
|
-
|
|
406
|
+
j(a.id);
|
|
392
407
|
}).catch(() => {
|
|
393
|
-
F.current = !1,
|
|
408
|
+
F.current = !1, j(void 0);
|
|
394
409
|
}));
|
|
395
|
-
}, [
|
|
396
|
-
const A =
|
|
397
|
-
`${
|
|
410
|
+
}, [N, M, p]);
|
|
411
|
+
const A = N !== void 0 ? N ?? null : Ee, qe = K ? he : (p == null ? void 0 : p.switch) ?? Ue ?? X.switchTo, Ct = _((a) => (A && a !== A && window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: A } })), qe(a)), [A, qe]), Be = K ? he : p ? () => p.create() : Fe ?? X.create, Kt = K ? he : (p == null ? void 0 : p.delete) ?? Ge ?? X.remove, jt = ((it = we.find((a) => a.id === A)) == null ? void 0 : it.title) ?? void 0, [Jt, He] = Re(
|
|
412
|
+
`${z}:drawer`,
|
|
398
413
|
Rt,
|
|
399
414
|
Q
|
|
400
|
-
), Ve = Me &&
|
|
415
|
+
), Ve = Me && Jt, [x, L] = Re(
|
|
401
416
|
// Key must NOT match resolvedSurfaceStorageKey (which stores the dockview
|
|
402
417
|
// layout JSON at the same ":surface" suffix). Writing "1"/"0" to the same
|
|
403
418
|
// key corrupts the JSON and drops the persisted workbench layout on reload.
|
|
404
|
-
`${
|
|
419
|
+
`${z}:workbenchOpen`,
|
|
405
420
|
Dt ?? !1,
|
|
406
421
|
Q
|
|
407
|
-
), [
|
|
408
|
-
`${
|
|
422
|
+
), [qt, J] = Re(
|
|
423
|
+
`${z}:workbenchLeftOpen`,
|
|
409
424
|
!0,
|
|
410
425
|
Q
|
|
411
|
-
),
|
|
412
|
-
|
|
413
|
-
const [
|
|
414
|
-
key:
|
|
415
|
-
snapshot:
|
|
416
|
-
})), Bt =
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}, [e]),
|
|
420
|
-
if (!(!
|
|
421
|
-
if (
|
|
422
|
-
|
|
426
|
+
), q = O(!1), k = O(x), Ye = O(w), Se = O(null);
|
|
427
|
+
Ye.current = w;
|
|
428
|
+
const [ze, Qe] = G(() => ({
|
|
429
|
+
key: w,
|
|
430
|
+
snapshot: ft
|
|
431
|
+
})), Bt = ze.key === w ? ze.snapshot : ft;
|
|
432
|
+
E(() => {
|
|
433
|
+
q.current = !1;
|
|
434
|
+
}, [e]), E(() => {
|
|
435
|
+
if (!(!p || p.loading) && N === void 0) {
|
|
436
|
+
if (p.sessions.length > 0) {
|
|
437
|
+
q.current = !1;
|
|
423
438
|
return;
|
|
424
439
|
}
|
|
425
|
-
|
|
426
|
-
|
|
440
|
+
q.current || (q.current = !0, Promise.resolve(p.create({ title: M })).catch(() => {
|
|
441
|
+
q.current = !1;
|
|
427
442
|
}));
|
|
428
443
|
}
|
|
429
|
-
}, [
|
|
430
|
-
k.current =
|
|
431
|
-
}, [
|
|
432
|
-
const Xe =
|
|
433
|
-
|
|
434
|
-
key:
|
|
444
|
+
}, [N, M, p]), E(() => {
|
|
445
|
+
k.current = x;
|
|
446
|
+
}, [x]);
|
|
447
|
+
const Xe = _((a) => {
|
|
448
|
+
Se.current = { key: w, api: a }, Qe({
|
|
449
|
+
key: w,
|
|
435
450
|
snapshot: a.getSnapshot()
|
|
436
451
|
});
|
|
437
|
-
}, [
|
|
452
|
+
}, [w]), Ze = _((a) => {
|
|
438
453
|
Qe({
|
|
439
|
-
key:
|
|
454
|
+
key: w,
|
|
440
455
|
snapshot: a
|
|
441
456
|
});
|
|
442
|
-
}, [
|
|
443
|
-
const a =
|
|
444
|
-
return (a == null ? void 0 : a.key) ===
|
|
445
|
-
}, []), te =
|
|
446
|
-
k.current = !0,
|
|
447
|
-
}, [
|
|
448
|
-
k.current = !0,
|
|
449
|
-
}, [
|
|
450
|
-
k.current = !1,
|
|
451
|
-
}, [
|
|
457
|
+
}, [w]), ee = _(() => {
|
|
458
|
+
const a = Se.current;
|
|
459
|
+
return (a == null ? void 0 : a.key) === Ye.current ? a.api : null;
|
|
460
|
+
}, []), te = _(() => k.current, []), re = _(() => {
|
|
461
|
+
k.current = !0, L(!0);
|
|
462
|
+
}, [L]), ne = _(() => {
|
|
463
|
+
k.current = !0, L(!0), J(!0);
|
|
464
|
+
}, [L, J]), oe = _(() => {
|
|
465
|
+
k.current = !1, Se.current = null, L(!1);
|
|
466
|
+
}, [L]), se = S(
|
|
452
467
|
() => (P == null ? void 0 : P.map(nr)) ?? [],
|
|
453
468
|
[P]
|
|
454
|
-
),
|
|
455
|
-
() =>
|
|
456
|
-
[
|
|
457
|
-
), et =
|
|
458
|
-
() =>
|
|
459
|
-
[
|
|
460
|
-
), tt =
|
|
461
|
-
() => [...
|
|
462
|
-
[
|
|
463
|
-
), rt = A ?? (
|
|
464
|
-
|
|
469
|
+
), Ae = S(
|
|
470
|
+
() => se.some((a) => a.registrations.leftTabs.length > 0),
|
|
471
|
+
[se]
|
|
472
|
+
), et = S(
|
|
473
|
+
() => se.flatMap((a) => a.registrations.panels.map((ie) => ie.id)),
|
|
474
|
+
[se]
|
|
475
|
+
), tt = S(
|
|
476
|
+
() => [...Ie ?? [], ...et],
|
|
477
|
+
[Ie, et]
|
|
478
|
+
), rt = A ?? (N !== void 0 ? "default" : ((at = we[0]) == null ? void 0 : at.id) ?? "default"), [Ht, _e] = G(U), nt = O(e);
|
|
479
|
+
E(() => {
|
|
465
480
|
if (nt.current !== e) {
|
|
466
481
|
nt.current = e, _e(U);
|
|
467
482
|
return;
|
|
468
483
|
}
|
|
469
484
|
U && _e(!0);
|
|
470
485
|
}, [U, e]);
|
|
471
|
-
const
|
|
472
|
-
Gt({ workspaceId: e, status: a }),
|
|
473
|
-
}, [
|
|
474
|
-
|
|
486
|
+
const ot = U && C && !A, st = !Ht && de !== !1 && (C ? ye && !!Ee : !0), Vt = _((a) => {
|
|
487
|
+
Gt({ workspaceId: e, status: a }), Y == null || Y(a);
|
|
488
|
+
}, [Y, e]);
|
|
489
|
+
E(() => {
|
|
475
490
|
var ie;
|
|
476
491
|
const a = (ae) => {
|
|
477
|
-
const
|
|
478
|
-
!
|
|
492
|
+
const Le = ae.detail;
|
|
493
|
+
!Le || typeof Le != "object" || sr(Le, {
|
|
479
494
|
surface: ee,
|
|
480
495
|
isWorkbenchOpen: te,
|
|
481
496
|
openWorkbench: re,
|
|
@@ -486,104 +501,104 @@ function Br({
|
|
|
486
501
|
var ae;
|
|
487
502
|
return (ae = globalThis.removeEventListener) == null ? void 0 : ae.call(globalThis, lt, a);
|
|
488
503
|
};
|
|
489
|
-
}, [ee, te, re, ne]),
|
|
504
|
+
}, [ee, te, re, ne]), E(() => {
|
|
490
505
|
A && (H == null || H(A));
|
|
491
506
|
}, [A, H]);
|
|
492
|
-
const
|
|
507
|
+
const Ne = I.status !== "ready", Yt = Ne ? /* @__PURE__ */ c(Nr, { status: I }) : void 0, zt = S(
|
|
493
508
|
() => ({
|
|
494
509
|
...D,
|
|
495
|
-
...
|
|
510
|
+
...ot ? { autoSubmitInitialDraft: !1, initialDraft: void 0 } : {},
|
|
496
511
|
sessionId: rt,
|
|
497
512
|
requestHeaders: $,
|
|
498
|
-
bridgeEndpoint:
|
|
513
|
+
bridgeEndpoint: ce,
|
|
499
514
|
getSurface: ee,
|
|
500
515
|
isWorkbenchOpen: te,
|
|
501
516
|
openWorkbench: re,
|
|
502
517
|
openWorkbenchSources: ne,
|
|
503
|
-
closeWorkbench:
|
|
504
|
-
extraCommands:
|
|
505
|
-
workspaceWarmupStatus:
|
|
506
|
-
hydrateMessages:
|
|
518
|
+
closeWorkbench: oe,
|
|
519
|
+
extraCommands: Ce,
|
|
520
|
+
workspaceWarmupStatus: I,
|
|
521
|
+
hydrateMessages: st,
|
|
507
522
|
onAutoSubmitInitialDraftSettled: () => {
|
|
508
|
-
F.current = !1, _e(!1),
|
|
523
|
+
F.current = !1, _e(!1), j(void 0);
|
|
509
524
|
const a = D == null ? void 0 : D.onAutoSubmitInitialDraftSettled;
|
|
510
525
|
typeof a == "function" && a();
|
|
511
526
|
},
|
|
512
527
|
// Forward the explicit prop when set. Omitting the key (when undefined)
|
|
513
528
|
// lets ChatPanel apply its own default (true) and avoids overriding a
|
|
514
529
|
// value passed through chatParams.
|
|
515
|
-
...
|
|
530
|
+
...ue !== void 0 ? { hotReloadEnabled: ue } : {}
|
|
516
531
|
}),
|
|
517
|
-
[D,
|
|
518
|
-
), Qt =
|
|
519
|
-
storageKey:
|
|
532
|
+
[D, ot, rt, $, ce, ee, te, re, ne, oe, Ce, I, st, ue]
|
|
533
|
+
), Qt = S(() => ({
|
|
534
|
+
storageKey: w,
|
|
520
535
|
defaultLeftTab: V,
|
|
521
536
|
initialPanels: $e,
|
|
522
537
|
extraPanels: tt,
|
|
523
538
|
onReady: Xe,
|
|
524
539
|
onChange: Ze,
|
|
525
|
-
onClose:
|
|
540
|
+
onClose: oe
|
|
526
541
|
}), [
|
|
527
|
-
|
|
542
|
+
oe,
|
|
528
543
|
V,
|
|
529
544
|
$e,
|
|
530
545
|
Ze,
|
|
531
546
|
Xe,
|
|
532
|
-
|
|
547
|
+
w,
|
|
533
548
|
tt,
|
|
534
|
-
|
|
549
|
+
L
|
|
535
550
|
]);
|
|
536
|
-
return /* @__PURE__ */ c("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */
|
|
537
|
-
|
|
551
|
+
return /* @__PURE__ */ c("div", { className: "h-full bg-background text-foreground", children: /* @__PURE__ */ Te(
|
|
552
|
+
or,
|
|
538
553
|
{
|
|
539
554
|
chatPanel: Mt,
|
|
540
555
|
panels: g,
|
|
541
|
-
commands:
|
|
542
|
-
catalogs:
|
|
556
|
+
commands: f,
|
|
557
|
+
catalogs: T,
|
|
543
558
|
plugins: P,
|
|
544
|
-
excludeDefaults:
|
|
559
|
+
excludeDefaults: R,
|
|
545
560
|
capabilities: u,
|
|
546
561
|
apiBaseUrl: m,
|
|
547
562
|
authHeaders: Ft,
|
|
548
|
-
apiTimeout:
|
|
563
|
+
apiTimeout: h,
|
|
549
564
|
defaultTheme: W,
|
|
550
565
|
onThemeChange: At,
|
|
551
566
|
workspaceId: e,
|
|
552
|
-
storageKey:
|
|
553
|
-
persistenceEnabled:
|
|
567
|
+
storageKey: me,
|
|
568
|
+
persistenceEnabled: xe,
|
|
554
569
|
bridgeEndpoint: null,
|
|
555
|
-
onAuthError:
|
|
556
|
-
frontPluginHotReload:
|
|
557
|
-
fullPageBasePath:
|
|
570
|
+
onAuthError: Nt,
|
|
571
|
+
frontPluginHotReload: xt,
|
|
572
|
+
fullPageBasePath: _t,
|
|
558
573
|
children: [
|
|
559
574
|
l,
|
|
560
575
|
/* @__PURE__ */ c(
|
|
561
|
-
|
|
576
|
+
Ar,
|
|
562
577
|
{
|
|
563
578
|
workspaceId: e,
|
|
564
579
|
requestHeaders: $,
|
|
565
580
|
apiBaseUrl: m,
|
|
566
581
|
preloadPaths: kt,
|
|
567
|
-
provisionWorkspace:
|
|
582
|
+
provisionWorkspace: de,
|
|
568
583
|
onStatusChange: Vt
|
|
569
584
|
}
|
|
570
585
|
),
|
|
571
586
|
/* @__PURE__ */ c(
|
|
572
|
-
|
|
587
|
+
Or,
|
|
573
588
|
{
|
|
574
|
-
bridgeEndpoint:
|
|
589
|
+
bridgeEndpoint: ce,
|
|
575
590
|
requestHeaders: $,
|
|
576
591
|
navOpen: Ve,
|
|
577
|
-
surfaceOpen:
|
|
592
|
+
surfaceOpen: x,
|
|
578
593
|
snapshot: Bt
|
|
579
594
|
}
|
|
580
595
|
),
|
|
581
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ Te("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
582
597
|
/* @__PURE__ */ c(
|
|
583
598
|
lr,
|
|
584
599
|
{
|
|
585
600
|
appTitle: Lt,
|
|
586
|
-
sessionTitle:
|
|
601
|
+
sessionTitle: jt ?? M,
|
|
587
602
|
onCommandPalette: () => {
|
|
588
603
|
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
589
604
|
key: "k",
|
|
@@ -595,7 +610,7 @@ function Br({
|
|
|
595
610
|
},
|
|
596
611
|
onNewChat: Be,
|
|
597
612
|
topBarLeft: Ot,
|
|
598
|
-
topBarRight:
|
|
613
|
+
topBarRight: Tt
|
|
599
614
|
}
|
|
600
615
|
),
|
|
601
616
|
/* @__PURE__ */ c(
|
|
@@ -606,112 +621,130 @@ function Br({
|
|
|
606
621
|
navParams: {
|
|
607
622
|
sessions: we,
|
|
608
623
|
activeId: Ee,
|
|
609
|
-
onSwitch:
|
|
624
|
+
onSwitch: Ct,
|
|
610
625
|
onCreate: Be,
|
|
611
626
|
onDelete: Kt,
|
|
612
627
|
onClose: () => He(!1)
|
|
613
628
|
},
|
|
614
629
|
center: "chat",
|
|
615
|
-
centerParams:
|
|
616
|
-
surface:
|
|
630
|
+
centerParams: zt,
|
|
631
|
+
surface: x ? "artifact-surface" : null,
|
|
617
632
|
surfaceParams: Qt,
|
|
618
|
-
surfaceOverlay:
|
|
619
|
-
sidebar:
|
|
620
|
-
sidebarParams:
|
|
633
|
+
surfaceOverlay: Yt,
|
|
634
|
+
sidebar: x && !Ne && Ae && qt ? "workbench-left" : null,
|
|
635
|
+
sidebarParams: x && !Ne && Ae ? {
|
|
621
636
|
...V ? { defaultTab: V } : {},
|
|
622
|
-
onClose: () =>
|
|
623
|
-
onCollapse: () =>
|
|
637
|
+
onClose: () => J(!1),
|
|
638
|
+
onCollapse: () => J(!1)
|
|
624
639
|
} : void 0,
|
|
625
|
-
storageKey: Q ?
|
|
640
|
+
storageKey: Q ? z : void 0,
|
|
626
641
|
onOpenNav: Me ? () => {
|
|
627
|
-
He(!0),
|
|
642
|
+
He(!0), fe == null || fe();
|
|
628
643
|
} : void 0,
|
|
629
644
|
onOpenSurface: () => {
|
|
630
|
-
k.current = !0,
|
|
645
|
+
k.current = !0, L(!0), pe == null || pe();
|
|
631
646
|
},
|
|
632
647
|
surfaceButtonBottomOffset: Wt,
|
|
633
|
-
onOpenSidebar:
|
|
634
|
-
k.current = !0,
|
|
648
|
+
onOpenSidebar: Ae ? () => {
|
|
649
|
+
k.current = !0, L(!0), J(!0);
|
|
635
650
|
} : void 0
|
|
636
651
|
}
|
|
637
652
|
)
|
|
638
653
|
] }),
|
|
639
|
-
|
|
654
|
+
b
|
|
640
655
|
]
|
|
641
656
|
}
|
|
642
657
|
) });
|
|
643
658
|
}
|
|
644
|
-
|
|
659
|
+
const Tr = 500;
|
|
660
|
+
function xr(e) {
|
|
661
|
+
return new Promise((t, r) => {
|
|
662
|
+
let o;
|
|
663
|
+
const n = () => {
|
|
664
|
+
o && globalThis.clearTimeout(o), e.removeEventListener("abort", s);
|
|
665
|
+
}, s = () => {
|
|
666
|
+
n(), r(new DOMException("Workspace boot aborted", "AbortError"));
|
|
667
|
+
};
|
|
668
|
+
if (e.aborted) {
|
|
669
|
+
s();
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
o = globalThis.setTimeout(() => {
|
|
673
|
+
n(), t();
|
|
674
|
+
}, Tr), e.addEventListener("abort", s, { once: !0 });
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
function Qr({
|
|
645
678
|
workspaceId: e,
|
|
646
679
|
requestHeaders: t,
|
|
647
680
|
apiBaseUrl: r,
|
|
648
|
-
preloadPaths:
|
|
681
|
+
preloadPaths: o = mt,
|
|
649
682
|
provisionWorkspace: n = !0,
|
|
650
|
-
loadingFallback:
|
|
683
|
+
loadingFallback: s,
|
|
651
684
|
errorFallback: i,
|
|
652
685
|
children: l
|
|
653
686
|
}) {
|
|
654
|
-
const [
|
|
687
|
+
const [b, g] = G({
|
|
655
688
|
status: "loading",
|
|
656
689
|
label: "Waking workspace runtime"
|
|
657
690
|
});
|
|
658
|
-
return
|
|
659
|
-
const
|
|
691
|
+
return E(() => {
|
|
692
|
+
const f = new AbortController(), T = le(e, t);
|
|
660
693
|
async function P(u) {
|
|
661
|
-
const m = await fetch(
|
|
662
|
-
headers:
|
|
663
|
-
signal:
|
|
664
|
-
}),
|
|
694
|
+
const m = await fetch(gt(r, u), {
|
|
695
|
+
headers: T,
|
|
696
|
+
signal: f.signal
|
|
697
|
+
}), y = await St(m);
|
|
665
698
|
if (!m.ok) {
|
|
666
|
-
if (
|
|
667
|
-
throw new Error(
|
|
699
|
+
if (vt(y)) return "preparing";
|
|
700
|
+
throw new Error(wt(y) ?? `${u} failed with ${m.status}`);
|
|
668
701
|
}
|
|
669
|
-
if (
|
|
670
|
-
const W =
|
|
702
|
+
if (yt(u)) {
|
|
703
|
+
const W = Et(y);
|
|
671
704
|
if ((W == null ? void 0 : W.state) === "degraded") throw new Error(W.message ?? "Workspace failed to prepare");
|
|
672
705
|
}
|
|
673
|
-
return
|
|
706
|
+
return bt(u) !== null && y && typeof y == "object" && ht(r, T["x-boring-workspace-id"] ?? e, u, y), "ready";
|
|
674
707
|
}
|
|
675
|
-
async function
|
|
708
|
+
async function R() {
|
|
676
709
|
g({ status: "loading", label: "Waking workspace runtime" });
|
|
677
710
|
try {
|
|
678
|
-
const u = Pt(
|
|
679
|
-
let m = await Promise.all(u.map(async (
|
|
680
|
-
|
|
681
|
-
g({ status: "loading", label: "Workspace is still preparing" });
|
|
682
|
-
|
|
711
|
+
const u = Pt(o, n);
|
|
712
|
+
let m = await Promise.all(u.map(async (h) => ({ path: h, status: await P(h) }))), y = m.filter((h) => h.status === "preparing").map((h) => h.path);
|
|
713
|
+
for (; y.length > 0; ) {
|
|
714
|
+
if (g({ status: "loading", label: "Workspace is still preparing" }), await xr(f.signal), f.signal.aborted) return;
|
|
715
|
+
m = await Promise.all(y.map(async (h) => ({ path: h, status: await P(h) }))), y = m.filter((h) => h.status === "preparing").map((h) => h.path);
|
|
683
716
|
}
|
|
684
|
-
|
|
717
|
+
f.signal.aborted || g({ status: "ready" });
|
|
685
718
|
} catch (u) {
|
|
686
|
-
if (
|
|
719
|
+
if (f.signal.aborted) return;
|
|
687
720
|
g({
|
|
688
721
|
status: "error",
|
|
689
722
|
message: u instanceof Error ? u.message : "Unknown workspace boot error"
|
|
690
723
|
});
|
|
691
724
|
}
|
|
692
725
|
}
|
|
693
|
-
return
|
|
694
|
-
}, [r,
|
|
726
|
+
return R(), () => f.abort();
|
|
727
|
+
}, [r, o, n, t, e]), b.status === "ready" ? /* @__PURE__ */ c(B, { children: l }) : b.status === "error" ? typeof i == "function" ? /* @__PURE__ */ c(B, { children: i(b.message) }) : i ? /* @__PURE__ */ c(B, { children: i }) : /* @__PURE__ */ c(
|
|
695
728
|
ut,
|
|
696
729
|
{
|
|
697
730
|
title: "Workspace failed to open",
|
|
698
|
-
description:
|
|
731
|
+
description: b.message,
|
|
699
732
|
status: "Retry by reloading the page"
|
|
700
733
|
}
|
|
701
|
-
) : typeof
|
|
734
|
+
) : typeof s == "function" ? /* @__PURE__ */ c(B, { children: s(b.label) }) : s ? /* @__PURE__ */ c(B, { children: s }) : /* @__PURE__ */ c(
|
|
702
735
|
ut,
|
|
703
736
|
{
|
|
704
737
|
title: "Opening workspace",
|
|
705
738
|
description: "Waking the sandbox and preparing files, sessions, and layout.",
|
|
706
|
-
status:
|
|
739
|
+
status: b.label
|
|
707
740
|
}
|
|
708
741
|
);
|
|
709
742
|
}
|
|
710
|
-
const
|
|
743
|
+
const kr = "FULL_PAGE_PANEL_MISSING_COMPONENT", Wr = "FULL_PAGE_PANEL_INVALID_PARAMS_JSON", Ur = "FULL_PAGE_PANEL_PARAMS_NOT_OBJECT", Fr = "FULL_PAGE_PANEL_UNKNOWN_COMPONENT", Gr = "FULL_PAGE_PANEL_NOT_SUPPORTED", Mr = "FULL_PAGE_PANEL_RENDER_FAILED";
|
|
711
744
|
function v() {
|
|
712
745
|
}
|
|
713
|
-
const
|
|
714
|
-
function
|
|
746
|
+
const $r = { dispose: v }, d = () => $r;
|
|
747
|
+
function Ir(e) {
|
|
715
748
|
return {
|
|
716
749
|
id: `full-page:${e}`,
|
|
717
750
|
title: e,
|
|
@@ -745,7 +778,7 @@ function Fr(e) {
|
|
|
745
778
|
onWillFocus: d
|
|
746
779
|
};
|
|
747
780
|
}
|
|
748
|
-
function
|
|
781
|
+
function Cr() {
|
|
749
782
|
return {
|
|
750
783
|
width: window.innerWidth,
|
|
751
784
|
height: window.innerHeight,
|
|
@@ -798,73 +831,73 @@ function Oe({ code: e, title: t, description: r }) {
|
|
|
798
831
|
}
|
|
799
832
|
);
|
|
800
833
|
}
|
|
801
|
-
function
|
|
802
|
-
const r =
|
|
834
|
+
function Xr({ componentId: e, params: t = {} }) {
|
|
835
|
+
const r = pt(), { errors: o } = ir(), n = r.get(e), s = r.getComponents()[e];
|
|
803
836
|
Zt(() => {
|
|
804
837
|
document.title = (n == null ? void 0 : n.title) ?? e;
|
|
805
838
|
}, [e, n == null ? void 0 : n.title]);
|
|
806
|
-
const i =
|
|
839
|
+
const i = S(() => ({
|
|
807
840
|
params: t,
|
|
808
|
-
api:
|
|
809
|
-
containerApi:
|
|
841
|
+
api: Ir(e),
|
|
842
|
+
containerApi: Cr(),
|
|
810
843
|
className: "h-full"
|
|
811
|
-
}), [e, t]), l =
|
|
844
|
+
}), [e, t]), l = S(() => {
|
|
812
845
|
if (!n) return null;
|
|
813
|
-
const
|
|
814
|
-
for (let g =
|
|
815
|
-
const
|
|
816
|
-
if (
|
|
817
|
-
return
|
|
846
|
+
const b = n.pluginId ?? n.id;
|
|
847
|
+
for (let g = o.length - 1; g >= 0; g -= 1) {
|
|
848
|
+
const f = o[g];
|
|
849
|
+
if (f.contributionKind === "panel" && f.contributionId === e && f.pluginId === b)
|
|
850
|
+
return f;
|
|
818
851
|
}
|
|
819
852
|
return null;
|
|
820
|
-
}, [e,
|
|
821
|
-
return n ? !n.supportsFullPage || !
|
|
853
|
+
}, [e, o, n]);
|
|
854
|
+
return n ? !n.supportsFullPage || !s ? /* @__PURE__ */ c(
|
|
822
855
|
Oe,
|
|
823
856
|
{
|
|
824
|
-
code:
|
|
857
|
+
code: Gr,
|
|
825
858
|
title: "Panel does not support full-page mode",
|
|
826
859
|
description: `Panel "${e}" can render in the workspace, but it has not opted into the dedicated full-page pane route.`
|
|
827
860
|
}
|
|
828
861
|
) : l ? /* @__PURE__ */ c(
|
|
829
862
|
Oe,
|
|
830
863
|
{
|
|
831
|
-
code:
|
|
864
|
+
code: Mr,
|
|
832
865
|
title: "Panel failed to render",
|
|
833
866
|
description: `Panel "${e}" crashed while rendering in full-page mode: ${l.error.message}`
|
|
834
867
|
}
|
|
835
|
-
) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(ar, { mode: "full-page", children: /* @__PURE__ */ c(
|
|
868
|
+
) : /* @__PURE__ */ c("div", { className: "min-h-screen bg-background text-foreground", children: /* @__PURE__ */ c(ar, { mode: "full-page", children: /* @__PURE__ */ c(s, { ...i }) }) }) : /* @__PURE__ */ c(
|
|
836
869
|
Oe,
|
|
837
870
|
{
|
|
838
|
-
code:
|
|
871
|
+
code: Fr,
|
|
839
872
|
title: "Unknown panel",
|
|
840
873
|
description: `No full-page panel component is registered as "${e}".`
|
|
841
874
|
}
|
|
842
875
|
);
|
|
843
876
|
}
|
|
844
|
-
function
|
|
845
|
-
var
|
|
846
|
-
const t = new URLSearchParams(e), r = ((
|
|
877
|
+
function Zr(e) {
|
|
878
|
+
var s;
|
|
879
|
+
const t = new URLSearchParams(e), r = ((s = t.get("component")) == null ? void 0 : s.trim()) ?? "";
|
|
847
880
|
if (!r)
|
|
848
881
|
return {
|
|
849
882
|
componentId: null,
|
|
850
883
|
params: {},
|
|
851
884
|
error: {
|
|
852
|
-
code:
|
|
885
|
+
code: kr,
|
|
853
886
|
message: "Missing full-page panel component id."
|
|
854
887
|
}
|
|
855
888
|
};
|
|
856
|
-
const
|
|
857
|
-
if (!
|
|
889
|
+
const o = t.get("params");
|
|
890
|
+
if (!o)
|
|
858
891
|
return { componentId: r, params: {} };
|
|
859
892
|
let n;
|
|
860
893
|
try {
|
|
861
|
-
n = JSON.parse(
|
|
894
|
+
n = JSON.parse(o);
|
|
862
895
|
} catch {
|
|
863
896
|
return {
|
|
864
897
|
componentId: null,
|
|
865
898
|
params: {},
|
|
866
899
|
error: {
|
|
867
|
-
code:
|
|
900
|
+
code: Wr,
|
|
868
901
|
message: "Invalid full-page panel params JSON."
|
|
869
902
|
}
|
|
870
903
|
};
|
|
@@ -873,23 +906,23 @@ function zr(e) {
|
|
|
873
906
|
componentId: null,
|
|
874
907
|
params: {},
|
|
875
908
|
error: {
|
|
876
|
-
code:
|
|
909
|
+
code: Ur,
|
|
877
910
|
message: "Full-page panel params must be a JSON object."
|
|
878
911
|
}
|
|
879
912
|
} : { componentId: r, params: n };
|
|
880
913
|
}
|
|
881
914
|
export {
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
915
|
+
Wr as FULL_PAGE_PANEL_INVALID_PARAMS_JSON,
|
|
916
|
+
kr as FULL_PAGE_PANEL_MISSING_COMPONENT,
|
|
917
|
+
Gr as FULL_PAGE_PANEL_NOT_SUPPORTED,
|
|
918
|
+
Ur as FULL_PAGE_PANEL_PARAMS_NOT_OBJECT,
|
|
919
|
+
Mr as FULL_PAGE_PANEL_RENDER_FAILED,
|
|
920
|
+
Fr as FULL_PAGE_PANEL_UNKNOWN_COMPONENT,
|
|
921
|
+
zr as WorkspaceAgentFront,
|
|
922
|
+
Ar as WorkspaceBackgroundBoot,
|
|
923
|
+
Qr as WorkspaceBootGate,
|
|
924
|
+
Xr as WorkspaceFullPagePanel,
|
|
892
925
|
gr as createLocalStorageSessions,
|
|
893
|
-
|
|
894
|
-
|
|
926
|
+
Zr as parseFullPagePanelLocation,
|
|
927
|
+
br as useLocalStorageSessions
|
|
895
928
|
};
|