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