@kukeon/console 0.0.0-stage → 0.10.0-edge.g4f69f964
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/assignments-Biqg1AT0.js +257 -0
- package/dist/assignments-tab.d.ts +4 -0
- package/dist/assignments.d.mts +40 -0
- package/dist/auth.d.ts +39 -0
- package/dist/bulk-ui.d.ts +49 -0
- package/dist/bulk.d.mts +14 -0
- package/dist/catalog-B29wwZiy.js +1949 -0
- package/dist/catalog-url-Dr9e92Yq.js +19 -0
- package/dist/catalog-url.d.mts +4 -0
- package/dist/catalog.d.ts +40 -0
- package/dist/cell-filter.d.ts +10 -0
- package/dist/cell-sidebar.d.ts +26 -0
- package/dist/cells.d.mts +29 -0
- package/dist/cgroup-format.d.ts +17 -0
- package/dist/cgroup.d.ts +4 -0
- package/dist/config-form.d.mts +66 -0
- package/dist/connector-ui-CG9kLZ5s.js +2716 -0
- package/dist/connector-ui.d.ts +129 -0
- package/dist/connectors-page-ZyuSRdHC.js +241 -0
- package/dist/connectors-page.d.ts +8 -0
- package/dist/connectors.d.mts +154 -0
- package/dist/container-log.d.ts +11 -0
- package/dist/create.d.ts +11 -0
- package/dist/creation-schema.d.mts +15 -0
- package/dist/daemon-CLdOLhDb.js +394 -0
- package/dist/daemon.d.ts +24 -0
- package/dist/display-name.d.ts +10 -0
- package/dist/drift-diff.d.ts +4 -0
- package/dist/exec.d.ts +15 -0
- package/dist/extensions.d.ts +111 -0
- package/dist/get-started.d.ts +9 -0
- package/dist/health.d.ts +22 -0
- package/dist/identities-page-CyW0d5n2.js +2137 -0
- package/dist/identities-page.d.ts +15 -0
- package/dist/identities.d.mts +24 -0
- package/dist/image-format.d.ts +6 -0
- package/dist/image-inventory.d.ts +12 -0
- package/dist/images.d.ts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5241 -0
- package/dist/initialize-CAOkMhlL.js +146 -0
- package/dist/initialize.d.ts +21 -0
- package/dist/inventory.d.ts +66 -0
- package/dist/lifecycle-policy.d.ts +11 -0
- package/dist/lifecycle.d.ts +24 -0
- package/dist/log-buffer.d.ts +8 -0
- package/dist/main.d.ts +13 -0
- package/dist/majordomo-p7giptj3.js +3782 -0
- package/dist/majordomo.d.ts +102 -0
- package/dist/manage-nav.d.ts +4 -0
- package/dist/manifest-diff.d.mts +11 -0
- package/dist/merged-values-CBzWsNOS.js +739 -0
- package/dist/merged-values.d.ts +24 -0
- package/dist/network-format.d.ts +30 -0
- package/dist/network.d.ts +13 -0
- package/dist/new-agent-BweyzBnY.js +201 -0
- package/dist/new-agent.d.ts +27 -0
- package/dist/new-cell-Iceq2Zfv.js +1985 -0
- package/dist/new-cell.d.ts +29 -0
- package/dist/new-config-C9NSC9Ou.js +1541 -0
- package/dist/new-config.d.ts +7 -0
- package/dist/notifications.d.ts +26 -0
- package/dist/onboarding-oZBJXTy0.js +395 -0
- package/dist/onboarding.d.mts +40 -0
- package/dist/panel-cells.d.mts +8 -0
- package/dist/recording-source.d.ts +37 -0
- package/dist/recording.d.mts +24 -0
- package/dist/registry-credentials.d.ts +13 -0
- package/dist/relationships.d.mts +12 -0
- package/dist/replay.d.ts +14 -0
- package/dist/request.d.ts +16 -0
- package/dist/router.d.ts +12 -0
- package/dist/routes.d.ts +43 -0
- package/dist/schedule-DzQ3Homi.js +113 -0
- package/dist/schedule-format.d.mts +9 -0
- package/dist/schedule.d.ts +16 -0
- package/dist/scope-actions.d.ts +9 -0
- package/dist/screens.d.ts +6 -0
- package/dist/secret-form.d.ts +24 -0
- package/dist/settings-nav.d.ts +5 -0
- package/dist/settings-page.d.ts +4 -0
- package/dist/settings-values.d.mts +18 -0
- package/dist/settings.d.ts +50 -0
- package/dist/sidebar-shell.d.ts +55 -0
- package/dist/sources-page-CxMSM-sz.js +423 -0
- package/dist/sources-page.d.ts +5 -0
- package/dist/space-subnets.d.ts +3 -0
- package/dist/style.css +2 -0
- package/dist/team-form.d.mts +56 -0
- package/dist/team-plan-CFOIv1lN.js +735 -0
- package/dist/team-plan.d.ts +22 -0
- package/dist/team-wizard.d.ts +8 -0
- package/dist/teams-page-C6UGy4Fw.js +2216 -0
- package/dist/teams-page.d.ts +9 -0
- package/dist/teams.d.mts +114 -0
- package/dist/terminal-palette.d.ts +8 -0
- package/dist/terminal.d.ts +98 -0
- package/dist/unread.d.mts +19 -0
- package/dist/use-unread.d.ts +4 -0
- package/dist/user-menu.d.ts +7 -0
- package/dist/views.d.mts +8 -0
- package/dist/workbench.d.ts +16 -0
- package/package.json +45 -4
- package/README.md +0 -3
|
@@ -0,0 +1,3782 @@
|
|
|
1
|
+
import { $ as e, B as t, Bt as n, Gn as r, Kn as i, L as a, T as o, Un as s, Wn as c, bn as l, cn as u, in as d, j as f, zt as p } from "./connector-ui-CG9kLZ5s.js";
|
|
2
|
+
import { A as m, C as h, E as g, L as _, P as v, T as y, _ as b, g as x, w as S, x as C, y as w } from "./onboarding-oZBJXTy0.js";
|
|
3
|
+
import { t as T } from "./initialize-CAOkMhlL.js";
|
|
4
|
+
import { createContext as E, useCallback as D, useContext as ee, useEffect as O, useId as k, useMemo as A, useRef as j, useState as M, useSyncExternalStore as N } from "react";
|
|
5
|
+
import { apiFetch as P, apiSocket as te, onUnauthorized as F } from "@kukeon/api-client";
|
|
6
|
+
import { Fragment as ne, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
7
|
+
import { DriftBadge as R, Icon as z, RollupDot as B, ScopePath as V, StateBadge as H, rememberFocus as re, stateTone as U, useModalDialog as W } from "@kukeon/ui";
|
|
8
|
+
import { createPortal as ie } from "react-dom";
|
|
9
|
+
import { Terminal as G } from "@xterm/xterm";
|
|
10
|
+
import { FitAddon as K } from "@xterm/addon-fit";
|
|
11
|
+
// src/cgroup-format.js
|
|
12
|
+
var q = "Unlimited", J = "Not available (controller not enabled)", ae = "Unreadable", Y = "Not set", X = 1024, oe = [
|
|
13
|
+
"B",
|
|
14
|
+
"KiB",
|
|
15
|
+
"MiB",
|
|
16
|
+
"GiB",
|
|
17
|
+
"TiB"
|
|
18
|
+
];
|
|
19
|
+
function Z(e) {
|
|
20
|
+
let t = e, n = 0;
|
|
21
|
+
for (; Math.abs(t) >= X && n < oe.length - 1;) t /= X, n++;
|
|
22
|
+
return n === 0 ? `${t} B` : `${Number(t.toFixed(t >= 100 ? 0 : t >= 10 ? 1 : 2))} ${oe[n]}`;
|
|
23
|
+
}
|
|
24
|
+
function se(e) {
|
|
25
|
+
if (!e || e.state === "absent") return J;
|
|
26
|
+
if (e.state === "unreadable") return ae;
|
|
27
|
+
if (e.state === "max") return q;
|
|
28
|
+
}
|
|
29
|
+
function ce(e, t = "count") {
|
|
30
|
+
let n = se(e);
|
|
31
|
+
if (n) return {
|
|
32
|
+
text: n,
|
|
33
|
+
raw: e?.raw
|
|
34
|
+
};
|
|
35
|
+
if (typeof e.value != "number") return {
|
|
36
|
+
text: e.raw || "Not available (controller not enabled)",
|
|
37
|
+
raw: e.raw
|
|
38
|
+
};
|
|
39
|
+
let r = e.value;
|
|
40
|
+
return t === "bytes" ? {
|
|
41
|
+
text: Z(r),
|
|
42
|
+
raw: e.raw
|
|
43
|
+
} : t === "weight" ? {
|
|
44
|
+
text: r === 100 ? "100 (default)" : String(r),
|
|
45
|
+
raw: e.raw
|
|
46
|
+
} : t === "usec" ? {
|
|
47
|
+
text: `${Number((r / 1e6).toFixed(r >= 1e8 ? 0 : 2))} s`,
|
|
48
|
+
raw: e.raw
|
|
49
|
+
} : {
|
|
50
|
+
text: String(r),
|
|
51
|
+
raw: e.raw
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function Q(e) {
|
|
55
|
+
let t = se(e);
|
|
56
|
+
if (t) return {
|
|
57
|
+
text: t,
|
|
58
|
+
raw: e?.raw
|
|
59
|
+
};
|
|
60
|
+
if (typeof e.quotaMicros != "number" || typeof e.periodMicros != "number" || e.periodMicros <= 0) return {
|
|
61
|
+
text: e.raw || "Not available (controller not enabled)",
|
|
62
|
+
raw: e.raw
|
|
63
|
+
};
|
|
64
|
+
let n = e.quotaMicros / e.periodMicros;
|
|
65
|
+
return {
|
|
66
|
+
text: `${Number(n.toFixed(2))} CPU (${Number((n * 100).toFixed(1))}%)`,
|
|
67
|
+
raw: e.raw
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function le(e) {
|
|
71
|
+
return se(e) || (e.values?.length ? e.values.join(" ") : "None");
|
|
72
|
+
}
|
|
73
|
+
function ue(e) {
|
|
74
|
+
let t = se(e);
|
|
75
|
+
return t ? [t] : e.entries?.length ? e.entries.map((e) => `${e.device} ${Object.entries(e.limits ?? {}).map(([e, t]) => `${e}=${t === "max" ? q : t}`).join(" ")}`) : ["No device limits"];
|
|
76
|
+
}
|
|
77
|
+
var de = {
|
|
78
|
+
container: "Container spec",
|
|
79
|
+
"space-default": "Inherited space default"
|
|
80
|
+
};
|
|
81
|
+
function fe(e) {
|
|
82
|
+
return !e || e.source === "unset" || typeof e.value != "number" ? {
|
|
83
|
+
text: Y,
|
|
84
|
+
source: Y
|
|
85
|
+
} : {
|
|
86
|
+
text: e.field === "memoryLimitBytes" ? Z(e.value) : String(e.value),
|
|
87
|
+
source: de[e.source] ?? e.source
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function pe(e) {
|
|
91
|
+
if (!e?.exists) return "Cgroup not present";
|
|
92
|
+
let t = e.live?.memory, n = [e.ready ? "Ready" : "Not ready"], r = t?.current?.state === "set" ? ce(t.current, "bytes").text : "", i = ["set", "max"].includes(t?.max?.state) ? ce(t.max, "bytes").text : "";
|
|
93
|
+
r ? n.push(`memory ${r}${i ? ` / ${i}` : ""}`) : i && n.push(`memory limit ${i}`);
|
|
94
|
+
let a = e.live?.pids?.current;
|
|
95
|
+
return a?.state === "set" && typeof a.value == "number" && n.push(`${a.value} ${a.value === 1 ? "PID" : "PIDs"}`), n.join(" · ");
|
|
96
|
+
}
|
|
97
|
+
// src/unread.mjs
|
|
98
|
+
var me = 3e3, he = "kukeon-terminal-seen", ge = (e) => !!e && typeof e == "object" && typeof e.startedAt == "string" && Number.isFinite(e.bytes) && e.bytes >= 0;
|
|
99
|
+
function _e(e) {
|
|
100
|
+
if (typeof e != "string") return {};
|
|
101
|
+
let t;
|
|
102
|
+
try {
|
|
103
|
+
t = JSON.parse(e);
|
|
104
|
+
} catch {
|
|
105
|
+
return {};
|
|
106
|
+
}
|
|
107
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
108
|
+
let n = {};
|
|
109
|
+
for (let [e, r] of Object.entries(t)) ge(r) && (n[e] = {
|
|
110
|
+
startedAt: r.startedAt,
|
|
111
|
+
bytes: r.bytes
|
|
112
|
+
});
|
|
113
|
+
return n;
|
|
114
|
+
}
|
|
115
|
+
function ve(e) {
|
|
116
|
+
let t = {}, n = e && typeof e == "object" && Array.isArray(e.cells) ? e.cells : [];
|
|
117
|
+
for (let e of n) {
|
|
118
|
+
if (!e || !Array.isArray(e.scope) || e.scope.length !== 4 || !e.scope.every((e) => typeof e == "string")) continue;
|
|
119
|
+
let n = JSON.stringify(e.scope);
|
|
120
|
+
typeof e.unavailable == "string" ? t[n] = { unavailable: e.unavailable } : typeof e.startedAt == "string" && Number.isFinite(e.bytesOut) && e.bytesOut >= 0 && Number.isFinite(e.idleMs) && (t[n] = {
|
|
121
|
+
startedAt: e.startedAt,
|
|
122
|
+
bytesOut: e.bytesOut,
|
|
123
|
+
idleMs: e.idleMs
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return t;
|
|
127
|
+
}
|
|
128
|
+
var ye = (e) => !!e && !e.unavailable;
|
|
129
|
+
function be(e, t, n) {
|
|
130
|
+
return ye(t) ? n || !e ? {
|
|
131
|
+
startedAt: t.startedAt,
|
|
132
|
+
bytes: t.bytesOut
|
|
133
|
+
} : e.startedAt === t.startedAt ? e : {
|
|
134
|
+
startedAt: t.startedAt,
|
|
135
|
+
bytes: 0
|
|
136
|
+
} : e;
|
|
137
|
+
}
|
|
138
|
+
function xe(e, t) {
|
|
139
|
+
return !ye(t) || !e ? 0 : e.startedAt === t.startedAt ? Math.max(0, t.bytesOut - e.bytes) : t.bytesOut;
|
|
140
|
+
}
|
|
141
|
+
function Se(e, t, n = me) {
|
|
142
|
+
return e > 0 && t >= n;
|
|
143
|
+
}
|
|
144
|
+
function Ce(e, t) {
|
|
145
|
+
let n = new Set(t), r = {};
|
|
146
|
+
for (let [t, i] of Object.entries(e)) n.has(t) && (r[t] = i);
|
|
147
|
+
return r;
|
|
148
|
+
}
|
|
149
|
+
function we(e, t, n) {
|
|
150
|
+
let r = { ...e }, i = [];
|
|
151
|
+
for (let [a, o] of Object.entries(t)) {
|
|
152
|
+
let t = be(e[a], o, n.has(a));
|
|
153
|
+
!t || e[a] && t.startedAt === e[a].startedAt && t.bytes === e[a].bytes || (r[a] = t, i.push(a));
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
markers: r,
|
|
157
|
+
changed: i
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function Te(e) {
|
|
161
|
+
return [...new Set(e.filter(Boolean))];
|
|
162
|
+
}
|
|
163
|
+
function Ee(e, t) {
|
|
164
|
+
let n = new Set(t);
|
|
165
|
+
return [...new Set(e)].filter((e) => !n.has(e));
|
|
166
|
+
}
|
|
167
|
+
function De(e, t, n, r = me) {
|
|
168
|
+
let i = {};
|
|
169
|
+
for (let [a, o] of Object.entries(t)) {
|
|
170
|
+
if (!ye(o) || n.has(a)) continue;
|
|
171
|
+
let t = xe(be(e[a], o, !1), o), s = Se(t, o.idleMs, r);
|
|
172
|
+
s && (i[a] = {
|
|
173
|
+
unreadBytes: t,
|
|
174
|
+
marked: s
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return i;
|
|
178
|
+
}
|
|
179
|
+
function Oe(e, t) {
|
|
180
|
+
return e > 0 ? t ? `, ${Z(e)} unread output` : ", unread output" : "";
|
|
181
|
+
}
|
|
182
|
+
function ke(e) {
|
|
183
|
+
return Z(e);
|
|
184
|
+
}
|
|
185
|
+
// src/cell-sidebar.tsx
|
|
186
|
+
var Ae = "kukeon-cell-collapsed-groups", je = 100, Me = 25, Ne = "others";
|
|
187
|
+
function Pe() {
|
|
188
|
+
try {
|
|
189
|
+
let e = JSON.parse(localStorage.getItem(Ae) ?? "[]");
|
|
190
|
+
return Array.isArray(e) && e.every((e) => typeof e == "string") ? e : [];
|
|
191
|
+
} catch {
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function Fe(e, t) {
|
|
196
|
+
try {
|
|
197
|
+
localStorage.setItem(e, t);
|
|
198
|
+
} catch {}
|
|
199
|
+
}
|
|
200
|
+
var Ie = (e, t) => t.length === 4 && e.every((e, n) => e === t[n]);
|
|
201
|
+
function Le({ bytes: e, showBytes: t }) {
|
|
202
|
+
return /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I("span", {
|
|
203
|
+
className: "unread-dot",
|
|
204
|
+
"aria-hidden": "true"
|
|
205
|
+
}), t && /* @__PURE__ */ I("span", {
|
|
206
|
+
className: "cell-unread-count",
|
|
207
|
+
"aria-hidden": "true",
|
|
208
|
+
children: ke(e)
|
|
209
|
+
})] });
|
|
210
|
+
}
|
|
211
|
+
function Re(e, t) {
|
|
212
|
+
return e.reduce((e, n) => e + (t[JSON.stringify(n.scope)]?.unreadBytes ?? 0), 0);
|
|
213
|
+
}
|
|
214
|
+
function ze({ hidden: e }) {
|
|
215
|
+
return e > 0 ? /* @__PURE__ */ L("a", {
|
|
216
|
+
className: "cell-stopped-link",
|
|
217
|
+
href: t(3, [], "inactive"),
|
|
218
|
+
children: ["Stopped · ", e]
|
|
219
|
+
}) : null;
|
|
220
|
+
}
|
|
221
|
+
function Be({ row: t, selectedScope: n, terminalStates: r, showScope: i, showTerminalStatus: a, labels: o, unread: s, showUnreadBytes: c }) {
|
|
222
|
+
let l = t.scope.join(" / "), u = r[JSON.stringify(t.scope)], d = o.get(JSON.stringify(t.scope)), f = s[JSON.stringify(t.scope)]?.unreadBytes ?? 0;
|
|
223
|
+
return /* @__PURE__ */ I("li", { children: /* @__PURE__ */ L("a", {
|
|
224
|
+
className: `cell-link${f ? " has-unread" : ""}`,
|
|
225
|
+
href: e(t.scope),
|
|
226
|
+
"aria-current": Ie(t.scope, n) ? "page" : void 0,
|
|
227
|
+
"aria-label": `Open ${d ? `${d} (${l})` : l}${Oe(f, c)}`,
|
|
228
|
+
title: l,
|
|
229
|
+
children: [
|
|
230
|
+
/* @__PURE__ */ L("span", {
|
|
231
|
+
className: "cell-link-name",
|
|
232
|
+
children: [d ?? t.doc.metadata.name, f > 0 && /* @__PURE__ */ I(Le, {
|
|
233
|
+
bytes: f,
|
|
234
|
+
showBytes: c
|
|
235
|
+
})]
|
|
236
|
+
}),
|
|
237
|
+
d && /* @__PURE__ */ I("span", {
|
|
238
|
+
className: "cell-link-cell mono-id",
|
|
239
|
+
children: t.doc.metadata.name
|
|
240
|
+
}),
|
|
241
|
+
i && /* @__PURE__ */ I("span", {
|
|
242
|
+
className: "cell-link-scope",
|
|
243
|
+
children: /* @__PURE__ */ I(V, { parts: t.scope.slice(0, 3) })
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ I(H, { state: t.doc.status?.state }),
|
|
246
|
+
/* @__PURE__ */ I(R, { status: t.doc.status }),
|
|
247
|
+
a && u && /* @__PURE__ */ L("span", {
|
|
248
|
+
className: `cell-terminal-state ${u}`,
|
|
249
|
+
children: ["Terminal ", u]
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
}) });
|
|
253
|
+
}
|
|
254
|
+
function Ve({ inventory: t, selectedScope: n, terminalStates: r, filter: i, listStyle: a = "default", showSearch: o = !0, showGroupBy: s = !0, showScope: c = !0, showTerminalStatus: l = !0, unread: u = {}, showUnreadBytes: d = !1 }) {
|
|
255
|
+
let { search: f, setSearch: p, groupBy: _, setGroupBy: v } = i, C = a === "agent", [T, E] = M(Pe), [D, ee] = M({}), [O, k] = M(Me), j = t.data?.rows[3] ?? [], N = A(() => x(j, n), [j, n]), P = j.length - N.length, te = A(() => y(N, _), [N, _]), F = A(() => N.filter((e) => w(e, f)), [N, f]), H = A(() => S(F, _), [F, _]), re = t.data?.configs, U = A(() => b(N, re), [N, re]), { agents: W, others: ie } = A(() => h(U, (e) => w(e, f)), [U, f]), G = A(() => new Map(U.agents.map((e) => [e.id, e.rows.length])), [U]), K = A(() => C ? g(j, re) : /* @__PURE__ */ new Map(), [
|
|
256
|
+
C,
|
|
257
|
+
j,
|
|
258
|
+
re
|
|
259
|
+
]), q = F.length && F.every((e) => e.scope.slice(0, 3).join(" / ") === F[0].scope.slice(0, 3).join(" / ")) ? F[0].scope.slice(0, 3).join(" / ") : "", J = !!t.error || !!t.data?.failures.length, ae = {
|
|
260
|
+
selectedScope: n,
|
|
261
|
+
terminalStates: r,
|
|
262
|
+
showScope: c && !q,
|
|
263
|
+
showTerminalStatus: l,
|
|
264
|
+
labels: K,
|
|
265
|
+
unread: u,
|
|
266
|
+
showUnreadBytes: d
|
|
267
|
+
}, Y = s && !C;
|
|
268
|
+
function X() {
|
|
269
|
+
ee({}), k(Me);
|
|
270
|
+
}
|
|
271
|
+
function oe(e) {
|
|
272
|
+
let t = T.includes(e) ? T.filter((t) => t !== e) : [...T, e];
|
|
273
|
+
E(t), Fe(Ae, JSON.stringify(t));
|
|
274
|
+
}
|
|
275
|
+
function Z(e, t, n) {
|
|
276
|
+
let r = D[e] ?? je;
|
|
277
|
+
return /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I("ul", {
|
|
278
|
+
className: n,
|
|
279
|
+
children: t.slice(0, r).map((e) => /* @__PURE__ */ I(Be, {
|
|
280
|
+
row: e,
|
|
281
|
+
...ae
|
|
282
|
+
}, JSON.stringify(e.scope)))
|
|
283
|
+
}), t.length > r && /* @__PURE__ */ L("button", {
|
|
284
|
+
className: "cell-more",
|
|
285
|
+
onClick: () => ee((t) => ({
|
|
286
|
+
...t,
|
|
287
|
+
[e]: r + je
|
|
288
|
+
})),
|
|
289
|
+
children: [
|
|
290
|
+
"Show ",
|
|
291
|
+
Math.min(je, t.length - r),
|
|
292
|
+
" more cells"
|
|
293
|
+
]
|
|
294
|
+
})] });
|
|
295
|
+
}
|
|
296
|
+
let se = [...W.map((e) => ({
|
|
297
|
+
id: e.id,
|
|
298
|
+
agent: e
|
|
299
|
+
})), ...ie.length ? [{
|
|
300
|
+
id: Ne,
|
|
301
|
+
agent: void 0
|
|
302
|
+
}] : []], ce = se.slice(0, O), Q = C ? se.length : H.length;
|
|
303
|
+
return /* @__PURE__ */ L("section", {
|
|
304
|
+
className: "cell-navigation",
|
|
305
|
+
"aria-label": "All cells",
|
|
306
|
+
children: [
|
|
307
|
+
/* @__PURE__ */ L("div", {
|
|
308
|
+
className: "cell-navigation-heading",
|
|
309
|
+
children: [/* @__PURE__ */ I("h2", { children: "Cells" }), /* @__PURE__ */ I("span", { children: N.length })]
|
|
310
|
+
}),
|
|
311
|
+
(o || Y) && /* @__PURE__ */ L("div", {
|
|
312
|
+
className: "cell-navigation-controls",
|
|
313
|
+
children: [o && /* @__PURE__ */ L("label", { children: ["Search cells", /* @__PURE__ */ I("input", {
|
|
314
|
+
type: "search",
|
|
315
|
+
value: f,
|
|
316
|
+
placeholder: "Name or scope",
|
|
317
|
+
onChange: (e) => {
|
|
318
|
+
p(e.target.value), X();
|
|
319
|
+
}
|
|
320
|
+
})] }), Y && /* @__PURE__ */ L("label", { children: ["Group by", /* @__PURE__ */ L("select", {
|
|
321
|
+
value: _,
|
|
322
|
+
onChange: (e) => {
|
|
323
|
+
v(e.target.value), X();
|
|
324
|
+
},
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ I("option", {
|
|
327
|
+
value: "",
|
|
328
|
+
children: "None"
|
|
329
|
+
}),
|
|
330
|
+
te.map((e) => /* @__PURE__ */ I("option", {
|
|
331
|
+
value: e,
|
|
332
|
+
children: e
|
|
333
|
+
}, e)),
|
|
334
|
+
_ && !te.includes(_) && /* @__PURE__ */ L("option", {
|
|
335
|
+
value: _,
|
|
336
|
+
children: [_, " (not in current inventory)"]
|
|
337
|
+
})
|
|
338
|
+
]
|
|
339
|
+
})] })]
|
|
340
|
+
}),
|
|
341
|
+
/* @__PURE__ */ L("div", {
|
|
342
|
+
className: "cell-navigation-results",
|
|
343
|
+
"aria-live": "polite",
|
|
344
|
+
children: [
|
|
345
|
+
t.loading && !t.data && /* @__PURE__ */ I("p", {
|
|
346
|
+
role: "status",
|
|
347
|
+
children: "Loading cells…"
|
|
348
|
+
}),
|
|
349
|
+
J && /* @__PURE__ */ I("p", {
|
|
350
|
+
className: "cell-inventory-warning",
|
|
351
|
+
children: t.data ? "Inventory incomplete or stale. Refresh to retry." : "Cells unavailable. Refresh to retry."
|
|
352
|
+
}),
|
|
353
|
+
!t.loading && !J && !N.length && /* @__PURE__ */ I("p", { children: P ? "No active cells." : "No cells found." }),
|
|
354
|
+
!!N.length && !F.length && /* @__PURE__ */ I("p", { children: "No matching cells." }),
|
|
355
|
+
!!F.length && /* @__PURE__ */ L("p", {
|
|
356
|
+
className: "cell-result-count",
|
|
357
|
+
children: [
|
|
358
|
+
F.length,
|
|
359
|
+
" ",
|
|
360
|
+
F.length === 1 ? "cell" : "cells",
|
|
361
|
+
J ? " in retained inventory" : ""
|
|
362
|
+
]
|
|
363
|
+
})
|
|
364
|
+
]
|
|
365
|
+
}),
|
|
366
|
+
/* @__PURE__ */ L("nav", {
|
|
367
|
+
className: "cell-navigation-list",
|
|
368
|
+
"aria-label": "Cell navigation",
|
|
369
|
+
children: [
|
|
370
|
+
c && q && /* @__PURE__ */ I("p", {
|
|
371
|
+
className: "cell-group-scope",
|
|
372
|
+
title: "Scope shared by every listed cell",
|
|
373
|
+
children: /* @__PURE__ */ I(V, { parts: F[0].scope.slice(0, 3) })
|
|
374
|
+
}),
|
|
375
|
+
C ? /* @__PURE__ */ L(ne, { children: [W.length > 0 && /* @__PURE__ */ I("h3", {
|
|
376
|
+
className: "cell-list-heading",
|
|
377
|
+
children: "Agents"
|
|
378
|
+
}), ce.map(({ id: t, agent: i }) => {
|
|
379
|
+
if (!i) return /* @__PURE__ */ L("section", {
|
|
380
|
+
className: "cell-group",
|
|
381
|
+
"aria-label": "Other cells",
|
|
382
|
+
children: [/* @__PURE__ */ I("h3", {
|
|
383
|
+
className: "cell-list-heading",
|
|
384
|
+
children: "Other cells"
|
|
385
|
+
}), Z(t, ie)]
|
|
386
|
+
}, t);
|
|
387
|
+
let a = Re(i.rows, u), o = Oe(a, d), s = a ? " has-unread" : "", c = /* @__PURE__ */ L("span", {
|
|
388
|
+
className: "agent-name",
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ I(z, { name: "agent" }),
|
|
391
|
+
/* @__PURE__ */ L("span", { children: [i.displayName, a > 0 && /* @__PURE__ */ I(Le, {
|
|
392
|
+
bytes: a,
|
|
393
|
+
showBytes: d
|
|
394
|
+
})] }),
|
|
395
|
+
i.named && /* @__PURE__ */ I("span", {
|
|
396
|
+
className: "agent-internal mono-id",
|
|
397
|
+
children: i.name
|
|
398
|
+
}),
|
|
399
|
+
i.context && /* @__PURE__ */ I("span", {
|
|
400
|
+
className: "agent-context",
|
|
401
|
+
children: i.context
|
|
402
|
+
})
|
|
403
|
+
]
|
|
404
|
+
}), f = /* @__PURE__ */ L("small", { children: [i.rows.length, /* @__PURE__ */ L("span", {
|
|
405
|
+
className: "sr-only",
|
|
406
|
+
children: [" ", i.rows.length === 1 ? "instance" : "instances"]
|
|
407
|
+
})] }), p = m(i.rows);
|
|
408
|
+
if (G.get(t) === 1) {
|
|
409
|
+
let a = i.rows[0], u = a.scope.join(" / "), d = r[JSON.stringify(a.scope)];
|
|
410
|
+
return /* @__PURE__ */ I("section", {
|
|
411
|
+
className: "cell-group cell-agent",
|
|
412
|
+
"aria-label": `${i.displayName} agent`,
|
|
413
|
+
children: /* @__PURE__ */ L("a", {
|
|
414
|
+
className: `agent-row agent-link${s}`,
|
|
415
|
+
href: e(a.scope),
|
|
416
|
+
"aria-current": Ie(a.scope, n) ? "page" : void 0,
|
|
417
|
+
"aria-label": `${i.displayName}: open ${u} (${p || "state not reported"})${o}`,
|
|
418
|
+
title: u,
|
|
419
|
+
children: [
|
|
420
|
+
c,
|
|
421
|
+
f,
|
|
422
|
+
/* @__PURE__ */ I(B, { state: p }),
|
|
423
|
+
/* @__PURE__ */ I(R, { status: a.doc.status }),
|
|
424
|
+
l && d && /* @__PURE__ */ L("span", {
|
|
425
|
+
className: `cell-terminal-state ${d}`,
|
|
426
|
+
children: ["Terminal ", d]
|
|
427
|
+
})
|
|
428
|
+
]
|
|
429
|
+
})
|
|
430
|
+
}, t);
|
|
431
|
+
}
|
|
432
|
+
let h = T.includes(t), g = h && i.rows.some((e) => Ie(e.scope, n));
|
|
433
|
+
return /* @__PURE__ */ L("section", {
|
|
434
|
+
className: "cell-group cell-agent",
|
|
435
|
+
"aria-label": `${i.displayName} agent`,
|
|
436
|
+
children: [/* @__PURE__ */ L("button", {
|
|
437
|
+
className: `cell-group-toggle agent-row${g ? " has-current" : ""}${s}`,
|
|
438
|
+
"aria-expanded": !h,
|
|
439
|
+
onClick: () => oe(t),
|
|
440
|
+
children: [
|
|
441
|
+
/* @__PURE__ */ I("span", {
|
|
442
|
+
"aria-hidden": "true",
|
|
443
|
+
children: h ? "▸" : "▾"
|
|
444
|
+
}),
|
|
445
|
+
c,
|
|
446
|
+
g && /* @__PURE__ */ I("span", {
|
|
447
|
+
className: "sr-only",
|
|
448
|
+
children: ", contains the open cell"
|
|
449
|
+
}),
|
|
450
|
+
f,
|
|
451
|
+
/* @__PURE__ */ I(B, { state: p }),
|
|
452
|
+
o && /* @__PURE__ */ I("span", {
|
|
453
|
+
className: "sr-only",
|
|
454
|
+
children: o
|
|
455
|
+
})
|
|
456
|
+
]
|
|
457
|
+
}), !h && Z(t, i.rows, "agent-instances")]
|
|
458
|
+
}, t);
|
|
459
|
+
})] }) : H.slice(0, O).map(({ id: e, label: t, rows: n }) => {
|
|
460
|
+
let r = !!_ && T.includes(e);
|
|
461
|
+
return /* @__PURE__ */ L("section", {
|
|
462
|
+
className: "cell-group",
|
|
463
|
+
"aria-label": _ ? `${t} group` : void 0,
|
|
464
|
+
children: [_ && /* @__PURE__ */ L("button", {
|
|
465
|
+
className: "cell-group-toggle",
|
|
466
|
+
"aria-expanded": !r,
|
|
467
|
+
onClick: () => oe(e),
|
|
468
|
+
children: [
|
|
469
|
+
/* @__PURE__ */ I("span", {
|
|
470
|
+
"aria-hidden": "true",
|
|
471
|
+
children: r ? "▸" : "▾"
|
|
472
|
+
}),
|
|
473
|
+
/* @__PURE__ */ I("span", { children: t }),
|
|
474
|
+
/* @__PURE__ */ I("small", { children: n.length })
|
|
475
|
+
]
|
|
476
|
+
}), !r && Z(e, n)]
|
|
477
|
+
}, e);
|
|
478
|
+
}),
|
|
479
|
+
Q > O && /* @__PURE__ */ L("button", {
|
|
480
|
+
className: "cell-more",
|
|
481
|
+
onClick: () => k((e) => e + Me),
|
|
482
|
+
children: [
|
|
483
|
+
"Show ",
|
|
484
|
+
Math.min(Me, Q - O),
|
|
485
|
+
" more groups"
|
|
486
|
+
]
|
|
487
|
+
})
|
|
488
|
+
]
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ I(ze, { hidden: P })
|
|
491
|
+
]
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
// src/sidebar-shell.tsx
|
|
495
|
+
var He = "kukeon-sidebar-collapsed", Ue = "kukeon-sidebar-width", We = {
|
|
496
|
+
min: 208,
|
|
497
|
+
max: 480,
|
|
498
|
+
initial: 264,
|
|
499
|
+
step: 16
|
|
500
|
+
};
|
|
501
|
+
function Ge(e) {
|
|
502
|
+
return Math.round(Math.min(We.max, Math.max(We.min, e)));
|
|
503
|
+
}
|
|
504
|
+
function Ke() {
|
|
505
|
+
try {
|
|
506
|
+
return localStorage.getItem(He) === "true";
|
|
507
|
+
} catch {
|
|
508
|
+
return !1;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function qe() {
|
|
512
|
+
try {
|
|
513
|
+
let e = Number(localStorage.getItem(Ue));
|
|
514
|
+
return Number.isFinite(e) && e > 0 ? Ge(e) : We.initial;
|
|
515
|
+
} catch {
|
|
516
|
+
return We.initial;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
function Je(e, t) {
|
|
520
|
+
try {
|
|
521
|
+
localStorage.setItem(e, t);
|
|
522
|
+
} catch {}
|
|
523
|
+
}
|
|
524
|
+
function Ye() {
|
|
525
|
+
let [e, t] = M(Ke), [n, r] = M(qe);
|
|
526
|
+
return O(() => {
|
|
527
|
+
Je(He, String(e));
|
|
528
|
+
}, [e]), O(() => {
|
|
529
|
+
Je(Ue, String(n));
|
|
530
|
+
}, [n]), {
|
|
531
|
+
collapsed: e,
|
|
532
|
+
setCollapsed: t,
|
|
533
|
+
width: n,
|
|
534
|
+
setWidth: (e) => r(Ge(e))
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function Xe() {
|
|
538
|
+
return /* @__PURE__ */ I("span", {
|
|
539
|
+
className: "mark",
|
|
540
|
+
"aria-hidden": "true",
|
|
541
|
+
children: /* @__PURE__ */ I(z, { name: "tornado" })
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
function Ze({ collapsed: e, onToggle: t }) {
|
|
545
|
+
let n = e ? "Expand sidebar" : "Collapse sidebar";
|
|
546
|
+
return /* @__PURE__ */ I("button", {
|
|
547
|
+
type: "button",
|
|
548
|
+
className: "icon-button sidebar-toggle",
|
|
549
|
+
"aria-label": n,
|
|
550
|
+
title: n,
|
|
551
|
+
"aria-expanded": !e,
|
|
552
|
+
"aria-controls": "cell-sidebar",
|
|
553
|
+
onClick: t,
|
|
554
|
+
children: /* @__PURE__ */ I(z, { name: e ? "sidebarExpand" : "sidebarCollapse" })
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
function Qe({ width: e, onResize: t }) {
|
|
558
|
+
let n = j(null);
|
|
559
|
+
function r(t) {
|
|
560
|
+
t.button === 0 && (t.preventDefault(), n.current = {
|
|
561
|
+
x: t.clientX,
|
|
562
|
+
width: e
|
|
563
|
+
}, t.currentTarget.setPointerCapture(t.pointerId));
|
|
564
|
+
}
|
|
565
|
+
function i(e) {
|
|
566
|
+
n.current && t(n.current.width + e.clientX - n.current.x);
|
|
567
|
+
}
|
|
568
|
+
function a(e) {
|
|
569
|
+
n.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
|
|
570
|
+
}
|
|
571
|
+
function o(n) {
|
|
572
|
+
let r = n.key === "ArrowLeft" ? e - We.step : n.key === "ArrowRight" ? e + We.step : n.key === "Home" ? We.min : n.key === "End" ? We.max : null;
|
|
573
|
+
r !== null && (n.preventDefault(), t(r));
|
|
574
|
+
}
|
|
575
|
+
return /* @__PURE__ */ I("div", {
|
|
576
|
+
className: "sidebar-resizer",
|
|
577
|
+
role: "separator",
|
|
578
|
+
"aria-orientation": "vertical",
|
|
579
|
+
"aria-label": "Resize sidebar",
|
|
580
|
+
"aria-controls": "cell-sidebar",
|
|
581
|
+
"aria-valuenow": e,
|
|
582
|
+
"aria-valuemin": We.min,
|
|
583
|
+
"aria-valuemax": We.max,
|
|
584
|
+
tabIndex: 0,
|
|
585
|
+
onPointerDown: r,
|
|
586
|
+
onPointerMove: i,
|
|
587
|
+
onPointerUp: a,
|
|
588
|
+
onPointerCancel: a,
|
|
589
|
+
onKeyDown: o
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
function $e(e) {
|
|
593
|
+
return e ? e.startsWith("v") ? e : `v${e}` : void 0;
|
|
594
|
+
}
|
|
595
|
+
function et(e, t) {
|
|
596
|
+
let n = $e(e), r = $e(t), i = !!n && !!r && n !== r;
|
|
597
|
+
return {
|
|
598
|
+
web: n,
|
|
599
|
+
daemon: r,
|
|
600
|
+
mismatch: i,
|
|
601
|
+
summary: `web ${n ?? "unknown"} · daemon ${r ?? "unknown"}`,
|
|
602
|
+
warning: i ? `Version mismatch: web ${n} ≠ daemon ${r}` : ""
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
function tt({ label: e }) {
|
|
606
|
+
return /* @__PURE__ */ I("span", {
|
|
607
|
+
className: "version-warning",
|
|
608
|
+
role: "img",
|
|
609
|
+
"aria-label": e,
|
|
610
|
+
title: e,
|
|
611
|
+
children: /* @__PURE__ */ I(z, { name: "warning" })
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
function nt({ info: e }) {
|
|
615
|
+
return /* @__PURE__ */ L("div", {
|
|
616
|
+
className: "connection-versions",
|
|
617
|
+
children: [/* @__PURE__ */ L("dl", {
|
|
618
|
+
"aria-label": "Versions",
|
|
619
|
+
children: [/* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("dt", { children: "web" }), /* @__PURE__ */ I("dd", { children: e.web ?? "unknown" })] }), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("dt", { children: "daemon" }), /* @__PURE__ */ I("dd", { children: e.daemon ?? "unknown" })] })]
|
|
620
|
+
}), e.mismatch && /* @__PURE__ */ I(tt, { label: e.warning })]
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
function rt({ view: t, inventory: n, selectedScope: r, connection: i, onExpand: o, majordomo: s, listStyle: c = "default", unread: l = {}, showUnreadBytes: u = !1 }) {
|
|
624
|
+
let d = x(n.data?.rows[3] ?? [], r), f = n.data?.configs, { agents: p, others: h } = b(d, f), _ = c === "agent" ? g(n.data?.rows[3] ?? [], f) : /* @__PURE__ */ new Map(), v = `Daemon: ${i.status} · ${i.info.summary}`, y = (e) => r.length === 4 && e.scope.every((e, t) => e === r[t]), S = (t) => {
|
|
625
|
+
let n = t.doc.status?.state, r = _.get(JSON.stringify(t.scope)), i = l[JSON.stringify(t.scope)]?.unreadBytes ?? 0, a = `Open ${r ? `${r} (${t.scope.join(" / ")})` : t.scope.join(" / ")} (${n || "state not reported"})${Oe(i, u)}`;
|
|
626
|
+
return /* @__PURE__ */ I("li", { children: /* @__PURE__ */ I("a", {
|
|
627
|
+
className: `rail-cell tone-${U(n)}${i ? " has-unread" : ""}`,
|
|
628
|
+
href: e(t.scope),
|
|
629
|
+
"aria-label": a,
|
|
630
|
+
title: a,
|
|
631
|
+
"aria-current": y(t) ? "page" : void 0,
|
|
632
|
+
children: /* @__PURE__ */ I("span", {
|
|
633
|
+
className: "state-dot",
|
|
634
|
+
"aria-hidden": "true"
|
|
635
|
+
})
|
|
636
|
+
}) }, JSON.stringify(t.scope));
|
|
637
|
+
};
|
|
638
|
+
return /* @__PURE__ */ L("div", {
|
|
639
|
+
className: "sidebar-rail",
|
|
640
|
+
children: [
|
|
641
|
+
/* @__PURE__ */ I("a", {
|
|
642
|
+
className: "rail-brand",
|
|
643
|
+
href: a(),
|
|
644
|
+
"aria-label": "kukeon home",
|
|
645
|
+
title: "kukeon",
|
|
646
|
+
children: /* @__PURE__ */ I(Xe, {})
|
|
647
|
+
}),
|
|
648
|
+
/* @__PURE__ */ I(Ze, {
|
|
649
|
+
collapsed: !0,
|
|
650
|
+
onToggle: o
|
|
651
|
+
}),
|
|
652
|
+
s,
|
|
653
|
+
t === "workbench" ? /* @__PURE__ */ I("nav", {
|
|
654
|
+
className: "rail-cells",
|
|
655
|
+
"aria-label": "Cell shortcuts",
|
|
656
|
+
children: c === "agent" ? /* @__PURE__ */ L("ul", { children: [p.map((t) => {
|
|
657
|
+
let n = `${t.rows.length} ${t.rows.length === 1 ? "instance" : "instances"}`, r = Re(t.rows, l), i = Oe(r, u), a = `Agent ${t.displayName}${t.context ? ` (${t.context})` : ""}, ${n}`, o = `rail-agent-glyph tone-${U(m(t.rows))}${r ? " has-unread" : ""}`;
|
|
658
|
+
if (t.rows.length === 1) {
|
|
659
|
+
let n = t.rows[0], r = `${a}: open ${n.scope.join(" / ")} (${n.doc.status?.state || "state not reported"})${i}`;
|
|
660
|
+
return /* @__PURE__ */ I("li", {
|
|
661
|
+
className: "rail-agent",
|
|
662
|
+
children: /* @__PURE__ */ I("a", {
|
|
663
|
+
className: o,
|
|
664
|
+
href: e(n.scope),
|
|
665
|
+
"aria-label": r,
|
|
666
|
+
title: r,
|
|
667
|
+
"aria-current": y(n) ? "page" : void 0,
|
|
668
|
+
children: /* @__PURE__ */ I(z, { name: "agent" })
|
|
669
|
+
})
|
|
670
|
+
}, t.id);
|
|
671
|
+
}
|
|
672
|
+
return /* @__PURE__ */ L("li", {
|
|
673
|
+
className: "rail-agent",
|
|
674
|
+
children: [/* @__PURE__ */ I("span", {
|
|
675
|
+
className: o,
|
|
676
|
+
role: "img",
|
|
677
|
+
"aria-label": a + i,
|
|
678
|
+
title: a + i,
|
|
679
|
+
children: /* @__PURE__ */ I(z, { name: "agent" })
|
|
680
|
+
}), /* @__PURE__ */ I("ul", { children: t.rows.map(S) })]
|
|
681
|
+
}, t.id);
|
|
682
|
+
}), h.length > 0 && /* @__PURE__ */ I("li", {
|
|
683
|
+
className: "rail-others",
|
|
684
|
+
children: /* @__PURE__ */ I("ul", {
|
|
685
|
+
"aria-label": "Other cells",
|
|
686
|
+
children: h.map(S)
|
|
687
|
+
})
|
|
688
|
+
})] }) : /* @__PURE__ */ I("ul", { children: d.map(S) })
|
|
689
|
+
}) : /* @__PURE__ */ I("div", { className: "rail-spacer" }),
|
|
690
|
+
/* @__PURE__ */ L("div", {
|
|
691
|
+
className: "rail-connection",
|
|
692
|
+
children: [/* @__PURE__ */ I("span", {
|
|
693
|
+
className: "rail-connection-dot",
|
|
694
|
+
role: "status",
|
|
695
|
+
"aria-label": v,
|
|
696
|
+
title: v,
|
|
697
|
+
children: /* @__PURE__ */ I("span", {
|
|
698
|
+
className: `dot ${i.tone}`,
|
|
699
|
+
"aria-hidden": "true"
|
|
700
|
+
})
|
|
701
|
+
}), i.info.mismatch && /* @__PURE__ */ I(tt, { label: i.info.warning })]
|
|
702
|
+
})
|
|
703
|
+
]
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
// src/auth.tsx
|
|
707
|
+
var it = "root", at = "kuke get secret web-ui-admin --realm kuke-system -o yaml";
|
|
708
|
+
async function ot(e) {
|
|
709
|
+
try {
|
|
710
|
+
let t = await e.json();
|
|
711
|
+
if (t?.error && typeof t.error.code == "string") return {
|
|
712
|
+
code: t.error.code,
|
|
713
|
+
message: String(t.error.message ?? "")
|
|
714
|
+
};
|
|
715
|
+
} catch {}
|
|
716
|
+
return {
|
|
717
|
+
code: e.status === 401 ? "unauthenticated" : "unavailable",
|
|
718
|
+
message: `HTTP ${e.status}`
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
var st = {
|
|
722
|
+
async session() {
|
|
723
|
+
try {
|
|
724
|
+
let e = await P("/session", { headers: { Accept: "application/json" } });
|
|
725
|
+
if (e.ok) {
|
|
726
|
+
let t = await e.json();
|
|
727
|
+
return {
|
|
728
|
+
phase: "signed-in",
|
|
729
|
+
user: typeof t?.user == "string" ? t.user : it
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
return e.status === 401 ? { phase: "signed-out" } : {
|
|
733
|
+
phase: "unavailable",
|
|
734
|
+
error: await ot(e)
|
|
735
|
+
};
|
|
736
|
+
} catch (e) {
|
|
737
|
+
return {
|
|
738
|
+
phase: "unavailable",
|
|
739
|
+
error: r(e)
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
async signOut() {
|
|
744
|
+
try {
|
|
745
|
+
await P("/logout", {
|
|
746
|
+
method: "POST",
|
|
747
|
+
headers: {
|
|
748
|
+
Accept: "application/json",
|
|
749
|
+
"Content-Type": "application/json"
|
|
750
|
+
},
|
|
751
|
+
body: "{}"
|
|
752
|
+
});
|
|
753
|
+
} catch {}
|
|
754
|
+
},
|
|
755
|
+
endsSession: (e) => e !== "/login",
|
|
756
|
+
SignIn: ht
|
|
757
|
+
}, ct = st;
|
|
758
|
+
function lt(e = st) {
|
|
759
|
+
ct = e;
|
|
760
|
+
}
|
|
761
|
+
function ut() {
|
|
762
|
+
return ct;
|
|
763
|
+
}
|
|
764
|
+
var dt = /* @__PURE__ */ new Set();
|
|
765
|
+
function ft() {
|
|
766
|
+
for (let e of [...dt]) e();
|
|
767
|
+
}
|
|
768
|
+
function pt() {
|
|
769
|
+
ct.session().then((e) => {
|
|
770
|
+
e.phase === "signed-out" && ft();
|
|
771
|
+
}, () => {});
|
|
772
|
+
}
|
|
773
|
+
function mt() {
|
|
774
|
+
let [e, t] = M({ phase: "checking" }), n = D(async () => {
|
|
775
|
+
t({ phase: "checking" });
|
|
776
|
+
try {
|
|
777
|
+
t(await ct.session());
|
|
778
|
+
} catch (e) {
|
|
779
|
+
t({
|
|
780
|
+
phase: "unavailable",
|
|
781
|
+
error: r(e)
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
}, []);
|
|
785
|
+
return O(() => {
|
|
786
|
+
n();
|
|
787
|
+
}, [n]), O(() => {
|
|
788
|
+
let e = () => t((e) => e.phase === "signed-in" ? { phase: "signed-out" } : e), n = F((t) => {
|
|
789
|
+
ct.endsSession(t) && e();
|
|
790
|
+
});
|
|
791
|
+
return dt.add(e), () => {
|
|
792
|
+
n(), dt.delete(e);
|
|
793
|
+
};
|
|
794
|
+
}, []), {
|
|
795
|
+
session: e,
|
|
796
|
+
retry: n,
|
|
797
|
+
signedIn: D((e) => t({
|
|
798
|
+
phase: "signed-in",
|
|
799
|
+
user: e
|
|
800
|
+
}), []),
|
|
801
|
+
signOut: D(async () => {
|
|
802
|
+
try {
|
|
803
|
+
await ct.signOut();
|
|
804
|
+
} catch {}
|
|
805
|
+
t({ phase: "signed-out" });
|
|
806
|
+
}, [])
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
function ht({ notice: e, checking: t, onRetry: n, onSignedIn: i }) {
|
|
810
|
+
let [a, o] = M(it), [s, l] = M(""), [u, d] = M(), [f, p] = M(!1);
|
|
811
|
+
async function m(e) {
|
|
812
|
+
if (e.preventDefault(), !f) {
|
|
813
|
+
p(!0), d(void 0);
|
|
814
|
+
try {
|
|
815
|
+
let e = await P("/login", {
|
|
816
|
+
method: "POST",
|
|
817
|
+
headers: {
|
|
818
|
+
Accept: "application/json",
|
|
819
|
+
"Content-Type": "application/json"
|
|
820
|
+
},
|
|
821
|
+
body: JSON.stringify({
|
|
822
|
+
username: a,
|
|
823
|
+
password: s
|
|
824
|
+
})
|
|
825
|
+
});
|
|
826
|
+
if (e.ok) {
|
|
827
|
+
let t = await e.json().catch(() => ({}));
|
|
828
|
+
i(typeof t?.user == "string" ? t.user : a);
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
d(await ot(e)), l("");
|
|
832
|
+
} catch (e) {
|
|
833
|
+
d(r(e));
|
|
834
|
+
} finally {
|
|
835
|
+
p(!1);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
return /* @__PURE__ */ I("main", {
|
|
840
|
+
className: "login-screen",
|
|
841
|
+
id: "main-content",
|
|
842
|
+
children: /* @__PURE__ */ L("form", {
|
|
843
|
+
className: "login-card",
|
|
844
|
+
onSubmit: m,
|
|
845
|
+
"aria-labelledby": "login-title",
|
|
846
|
+
children: [
|
|
847
|
+
/* @__PURE__ */ L("div", {
|
|
848
|
+
className: "login-brand",
|
|
849
|
+
children: [/* @__PURE__ */ I(Xe, {}), /* @__PURE__ */ I("span", {
|
|
850
|
+
className: "brand-title",
|
|
851
|
+
children: "kukeon"
|
|
852
|
+
})]
|
|
853
|
+
}),
|
|
854
|
+
/* @__PURE__ */ I("h1", {
|
|
855
|
+
id: "login-title",
|
|
856
|
+
children: "Sign in"
|
|
857
|
+
}),
|
|
858
|
+
t && /* @__PURE__ */ I("p", {
|
|
859
|
+
className: "login-status",
|
|
860
|
+
role: "status",
|
|
861
|
+
children: "Checking session…"
|
|
862
|
+
}),
|
|
863
|
+
e && /* @__PURE__ */ L("div", {
|
|
864
|
+
className: "error",
|
|
865
|
+
role: "alert",
|
|
866
|
+
children: [
|
|
867
|
+
/* @__PURE__ */ I("strong", { children: c(e) }),
|
|
868
|
+
/* @__PURE__ */ I("p", { children: e.message }),
|
|
869
|
+
/* @__PURE__ */ I("button", {
|
|
870
|
+
type: "button",
|
|
871
|
+
onClick: n,
|
|
872
|
+
children: "Retry"
|
|
873
|
+
})
|
|
874
|
+
]
|
|
875
|
+
}),
|
|
876
|
+
/* @__PURE__ */ L("label", { children: ["User", /* @__PURE__ */ I("input", {
|
|
877
|
+
name: "username",
|
|
878
|
+
autoComplete: "username",
|
|
879
|
+
value: a,
|
|
880
|
+
onChange: (e) => o(e.target.value),
|
|
881
|
+
required: !0
|
|
882
|
+
})] }),
|
|
883
|
+
/* @__PURE__ */ L("label", { children: ["Password", /* @__PURE__ */ I("input", {
|
|
884
|
+
name: "password",
|
|
885
|
+
type: "password",
|
|
886
|
+
autoComplete: "current-password",
|
|
887
|
+
value: s,
|
|
888
|
+
onChange: (e) => l(e.target.value),
|
|
889
|
+
required: !0,
|
|
890
|
+
autoFocus: !0
|
|
891
|
+
})] }),
|
|
892
|
+
u && /* @__PURE__ */ I("div", {
|
|
893
|
+
className: "error",
|
|
894
|
+
role: "alert",
|
|
895
|
+
children: /* @__PURE__ */ I("p", { children: u.message })
|
|
896
|
+
}),
|
|
897
|
+
/* @__PURE__ */ I("button", {
|
|
898
|
+
className: "primary-action",
|
|
899
|
+
type: "submit",
|
|
900
|
+
disabled: f,
|
|
901
|
+
children: f ? "Signing in…" : "Sign in"
|
|
902
|
+
}),
|
|
903
|
+
/* @__PURE__ */ L("p", {
|
|
904
|
+
className: "login-hint",
|
|
905
|
+
children: ["Print the password on the host with ", /* @__PURE__ */ I("code", { children: at })]
|
|
906
|
+
})
|
|
907
|
+
]
|
|
908
|
+
})
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
// src/container-log.tsx
|
|
912
|
+
var gt = 262144, _t = 2e3, vt = 8;
|
|
913
|
+
async function yt(e, t, n, r) {
|
|
914
|
+
let i = `${f(e)}/containers/${encodeURIComponent(t)}/log?offset=${n}&maxBytes=${gt}`, a = await P(i, {
|
|
915
|
+
signal: r,
|
|
916
|
+
headers: { Accept: "application/json" }
|
|
917
|
+
}), o = {};
|
|
918
|
+
try {
|
|
919
|
+
o = await a.json();
|
|
920
|
+
} catch {}
|
|
921
|
+
if (a.status === 404 && o.error?.code === "log_unavailable") return null;
|
|
922
|
+
if (!a.ok) throw o.error ?? {
|
|
923
|
+
code: "http_error",
|
|
924
|
+
message: `HTTP ${a.status}`
|
|
925
|
+
};
|
|
926
|
+
return o;
|
|
927
|
+
}
|
|
928
|
+
var bt = (e) => e ? Uint8Array.from(atob(e), (e) => e.charCodeAt(0)) : /* @__PURE__ */ new Uint8Array();
|
|
929
|
+
function xt({ scope: e, container: t, attachable: n, live: i, cellState: a, revision: o, theme: c, expanded: l }) {
|
|
930
|
+
let u = j(null), d = j(null), f = j(() => {}), p = j(null), m = j(null), h = j(!1), g = j(!1), _ = j(!1), [v, y] = M(!1), [b, x] = M(!1), [S, C] = M();
|
|
931
|
+
async function w(n) {
|
|
932
|
+
if (h.current) g.current = !0;
|
|
933
|
+
else {
|
|
934
|
+
h.current = !0;
|
|
935
|
+
try {
|
|
936
|
+
for (let r = 0; r < vt; r++) {
|
|
937
|
+
let r = m.current === null, i = await yt(e, t, r ? -1 : m.current, n);
|
|
938
|
+
if (n.aborted) return;
|
|
939
|
+
if (C(void 0), i === null) {
|
|
940
|
+
y(!0);
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
if (!r && (i.size ?? 0) < m.current) {
|
|
944
|
+
m.current = null;
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
r && (d.current?.reset(), x(!!i.truncated), _.current = !1);
|
|
948
|
+
let a = bt(i.data);
|
|
949
|
+
if (a.length && (d.current?.write(a), _.current = !0), m.current = i.next ?? m.current, y(!_.current && !i.truncated && !i.more), !i.more) return;
|
|
950
|
+
}
|
|
951
|
+
} catch (e) {
|
|
952
|
+
n.aborted || C(r(e));
|
|
953
|
+
} finally {
|
|
954
|
+
h.current = !1;
|
|
955
|
+
let e = p.current?.signal;
|
|
956
|
+
g.current && e && !e.aborted && (g.current = !1, w(e));
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
let T = j(w);
|
|
961
|
+
return T.current = w, O(() => {
|
|
962
|
+
if (!u.current) return;
|
|
963
|
+
let e = new G({
|
|
964
|
+
disableStdin: !0,
|
|
965
|
+
cursorBlink: !1,
|
|
966
|
+
cursorStyle: "underline",
|
|
967
|
+
cursorInactiveStyle: "none",
|
|
968
|
+
convertEol: !n,
|
|
969
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace",
|
|
970
|
+
fontSize: 14,
|
|
971
|
+
scrollback: 1e4,
|
|
972
|
+
theme: Fn(c)
|
|
973
|
+
}), t = new K();
|
|
974
|
+
d.current = e, p.current = new AbortController(), m.current = null, e.loadAddon(t), e.open(u.current);
|
|
975
|
+
let r = 0, i = () => {
|
|
976
|
+
r && cancelAnimationFrame(r), r = requestAnimationFrame(() => {
|
|
977
|
+
r = 0, u.current?.clientWidth && u.current.clientHeight && t.fit();
|
|
978
|
+
});
|
|
979
|
+
};
|
|
980
|
+
f.current = i;
|
|
981
|
+
let a = new ResizeObserver(i);
|
|
982
|
+
return a.observe(u.current), u.current.parentElement && a.observe(u.current.parentElement), window.addEventListener("resize", i), window.visualViewport?.addEventListener("resize", i), () => {
|
|
983
|
+
a.disconnect(), window.removeEventListener("resize", i), window.visualViewport?.removeEventListener("resize", i), r && cancelAnimationFrame(r), p.current?.abort(), p.current = null, e.dispose(), d.current = null, f.current = () => {};
|
|
984
|
+
};
|
|
985
|
+
}, []), O(() => {
|
|
986
|
+
let e = () => {
|
|
987
|
+
d.current && (d.current.options.theme = Fn(c));
|
|
988
|
+
};
|
|
989
|
+
if (e(), c !== "system") return;
|
|
990
|
+
let t = window.matchMedia("(prefers-color-scheme: dark)");
|
|
991
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
992
|
+
}, [c]), O(() => {
|
|
993
|
+
let e = requestAnimationFrame(() => f.current());
|
|
994
|
+
return () => cancelAnimationFrame(e);
|
|
995
|
+
}, [l]), O(() => {
|
|
996
|
+
let e = p.current?.signal;
|
|
997
|
+
e && T.current(e);
|
|
998
|
+
}, [o, a]), O(() => {
|
|
999
|
+
if (!i) return;
|
|
1000
|
+
let e = setInterval(() => {
|
|
1001
|
+
let e = p.current?.signal;
|
|
1002
|
+
e && document.visibilityState === "visible" && T.current(e);
|
|
1003
|
+
}, _t);
|
|
1004
|
+
return () => clearInterval(e);
|
|
1005
|
+
}, [i]), /* @__PURE__ */ L("div", {
|
|
1006
|
+
className: "terminal-session terminal-log",
|
|
1007
|
+
children: [
|
|
1008
|
+
v && !S && /* @__PURE__ */ I("p", {
|
|
1009
|
+
className: "empty-state terminal-empty",
|
|
1010
|
+
role: "status",
|
|
1011
|
+
children: "No output yet."
|
|
1012
|
+
}),
|
|
1013
|
+
S && /* @__PURE__ */ I(s, {
|
|
1014
|
+
error: S,
|
|
1015
|
+
kind: "Container log"
|
|
1016
|
+
}),
|
|
1017
|
+
b && !v && /* @__PURE__ */ I("p", {
|
|
1018
|
+
className: "terminal-log-omitted",
|
|
1019
|
+
children: "Earlier output is not shown."
|
|
1020
|
+
}),
|
|
1021
|
+
/* @__PURE__ */ I("div", {
|
|
1022
|
+
className: "terminal-screen",
|
|
1023
|
+
hidden: v,
|
|
1024
|
+
"aria-label": `Log for ${e.join(" / ")} / ${t}`,
|
|
1025
|
+
children: /* @__PURE__ */ I("div", {
|
|
1026
|
+
ref: u,
|
|
1027
|
+
className: "terminal-mount"
|
|
1028
|
+
})
|
|
1029
|
+
})
|
|
1030
|
+
]
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
// src/exec.tsx
|
|
1034
|
+
var St = [{
|
|
1035
|
+
id: "run",
|
|
1036
|
+
label: "Run command"
|
|
1037
|
+
}, {
|
|
1038
|
+
id: "terminal",
|
|
1039
|
+
label: "Terminal"
|
|
1040
|
+
}];
|
|
1041
|
+
function Ct({ container: e, open: t, reason: n, onToggle: r }) {
|
|
1042
|
+
let i = n || (t ? `Close Exec for ${e}` : `Exec: run a command or open a shell in ${e}`);
|
|
1043
|
+
return /* @__PURE__ */ I("button", {
|
|
1044
|
+
type: "button",
|
|
1045
|
+
className: "icon-button exec-button",
|
|
1046
|
+
"aria-label": "Exec",
|
|
1047
|
+
"aria-expanded": t,
|
|
1048
|
+
title: i,
|
|
1049
|
+
"data-tooltip": i,
|
|
1050
|
+
disabled: !!n,
|
|
1051
|
+
onClick: r,
|
|
1052
|
+
children: /* @__PURE__ */ I(z, { name: "exec" })
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
function wt({ target: e, onCancel: t, onConfirm: n }) {
|
|
1056
|
+
let r = j(null);
|
|
1057
|
+
return W(r), /* @__PURE__ */ I("dialog", {
|
|
1058
|
+
className: "cell-action-dialog exec-root-dialog",
|
|
1059
|
+
ref: r,
|
|
1060
|
+
"aria-labelledby": "exec-root-dialog-title",
|
|
1061
|
+
"aria-describedby": "exec-root-dialog-description",
|
|
1062
|
+
onCancel: (e) => {
|
|
1063
|
+
e.preventDefault(), t();
|
|
1064
|
+
},
|
|
1065
|
+
onClick: (e) => {
|
|
1066
|
+
e.target === e.currentTarget && t();
|
|
1067
|
+
},
|
|
1068
|
+
children: /* @__PURE__ */ L("form", {
|
|
1069
|
+
onSubmit: (e) => {
|
|
1070
|
+
e.preventDefault(), n();
|
|
1071
|
+
},
|
|
1072
|
+
children: [
|
|
1073
|
+
/* @__PURE__ */ I("h2", {
|
|
1074
|
+
id: "exec-root-dialog-title",
|
|
1075
|
+
children: "Run as root"
|
|
1076
|
+
}),
|
|
1077
|
+
/* @__PURE__ */ I("p", {
|
|
1078
|
+
id: "exec-root-dialog-description",
|
|
1079
|
+
children: "Commands and shells started from this panel will run as root (uid 0, gid 0) inside the container, whatever user the container itself runs as. kukeond records every root exec in its log. Changes made this way are lost when the cell is recreated."
|
|
1080
|
+
}),
|
|
1081
|
+
/* @__PURE__ */ L("dl", {
|
|
1082
|
+
className: "cell-action-target",
|
|
1083
|
+
children: [/* @__PURE__ */ I("dt", { children: "Container" }), /* @__PURE__ */ I("dd", { children: /* @__PURE__ */ I("code", { children: e }) })]
|
|
1084
|
+
}),
|
|
1085
|
+
/* @__PURE__ */ L("div", {
|
|
1086
|
+
className: "cell-action-dialog-buttons",
|
|
1087
|
+
children: [/* @__PURE__ */ I("button", {
|
|
1088
|
+
type: "button",
|
|
1089
|
+
onClick: t,
|
|
1090
|
+
children: "Cancel"
|
|
1091
|
+
}), /* @__PURE__ */ I("button", {
|
|
1092
|
+
className: "danger-action",
|
|
1093
|
+
type: "submit",
|
|
1094
|
+
children: "Run as root"
|
|
1095
|
+
})]
|
|
1096
|
+
})
|
|
1097
|
+
]
|
|
1098
|
+
})
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose: o }) {
|
|
1102
|
+
let c = k(), l = [...e, t].join(" / "), u = `${f(e)}/containers/${encodeURIComponent(t)}/exec`, d = j(null), p = j(null), [m, h] = M("container"), [g, _] = M(!1), [v, y] = M(!1), [b, x] = M("run"), [S, C] = M(""), [w, T] = M(!1), [E, ee] = M(), [N, te] = M(), [F, R] = M(!1), [z, B] = M({
|
|
1103
|
+
generation: 0,
|
|
1104
|
+
state: "connecting",
|
|
1105
|
+
message: "Connecting…"
|
|
1106
|
+
}), V = m === "root" && g;
|
|
1107
|
+
O(() => {
|
|
1108
|
+
let e = re();
|
|
1109
|
+
return p.current?.focus(), e;
|
|
1110
|
+
}, []);
|
|
1111
|
+
let H = (e) => {
|
|
1112
|
+
e !== m && (e === "root" && !g ? y(!0) : (h(e), W()));
|
|
1113
|
+
}, U = () => {
|
|
1114
|
+
y(!1), _(!0), h("root"), W();
|
|
1115
|
+
}, W = () => B((e) => ({
|
|
1116
|
+
generation: e.generation + 1,
|
|
1117
|
+
state: "connecting",
|
|
1118
|
+
message: "Connecting…"
|
|
1119
|
+
}));
|
|
1120
|
+
async function ie(e) {
|
|
1121
|
+
if (e.preventDefault(), !w && S.trim()) {
|
|
1122
|
+
T(!0), te(void 0);
|
|
1123
|
+
try {
|
|
1124
|
+
let e = await P(u, {
|
|
1125
|
+
method: "POST",
|
|
1126
|
+
headers: {
|
|
1127
|
+
Accept: "application/json",
|
|
1128
|
+
"Content-Type": "application/json"
|
|
1129
|
+
},
|
|
1130
|
+
body: JSON.stringify({
|
|
1131
|
+
command: S,
|
|
1132
|
+
identity: V ? "root" : "container",
|
|
1133
|
+
...V ? { confirmRoot: !0 } : {}
|
|
1134
|
+
})
|
|
1135
|
+
}), t = await e.json();
|
|
1136
|
+
if (!e.ok) throw t.error ?? {
|
|
1137
|
+
code: "http_error",
|
|
1138
|
+
message: `HTTP ${e.status}`
|
|
1139
|
+
};
|
|
1140
|
+
ee(t);
|
|
1141
|
+
} catch (e) {
|
|
1142
|
+
ee(void 0), te(r(e));
|
|
1143
|
+
} finally {
|
|
1144
|
+
T(!1);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
let G = JSON.stringify(e), K = A(() => ({
|
|
1149
|
+
id: `exec:${Mn(e, t)}`,
|
|
1150
|
+
scope: e,
|
|
1151
|
+
container: t,
|
|
1152
|
+
view: "main",
|
|
1153
|
+
state: z.state,
|
|
1154
|
+
message: z.message,
|
|
1155
|
+
generation: z.generation
|
|
1156
|
+
}), [
|
|
1157
|
+
G,
|
|
1158
|
+
t,
|
|
1159
|
+
z.state,
|
|
1160
|
+
z.message,
|
|
1161
|
+
z.generation
|
|
1162
|
+
]), q = D((e, t, n, r) => {
|
|
1163
|
+
B((e) => e.generation === t ? {
|
|
1164
|
+
...e,
|
|
1165
|
+
state: n,
|
|
1166
|
+
message: r
|
|
1167
|
+
} : e);
|
|
1168
|
+
}, []), J = A(() => ({
|
|
1169
|
+
path: `${u}/terminal?identity=${V ? "root&confirmRoot=1" : "container"}`,
|
|
1170
|
+
label: `Exec terminal for ${l}`
|
|
1171
|
+
}), [
|
|
1172
|
+
u,
|
|
1173
|
+
V,
|
|
1174
|
+
l
|
|
1175
|
+
]), ae = (e) => {
|
|
1176
|
+
x(e), e === "terminal" && R(!0);
|
|
1177
|
+
};
|
|
1178
|
+
function Y(e) {
|
|
1179
|
+
let t = St.findIndex((e) => e.id === b), n = e.key === "ArrowRight" ? t + 1 : e.key === "ArrowLeft" ? t - 1 : e.key === "Home" ? 0 : e.key === "End" ? St.length - 1 : null;
|
|
1180
|
+
n !== null && (e.preventDefault(), ae(St[(n + St.length) % St.length].id), requestAnimationFrame(() => d.current?.querySelector("[role=\"tab\"][aria-selected=\"true\"]")?.focus()));
|
|
1181
|
+
}
|
|
1182
|
+
function X(e) {
|
|
1183
|
+
e.key !== "Escape" || e.target.closest(".terminal-screen, dialog") || (e.preventDefault(), e.stopPropagation(), o());
|
|
1184
|
+
}
|
|
1185
|
+
let oe = z.state === "disconnected";
|
|
1186
|
+
return /* @__PURE__ */ L("section", {
|
|
1187
|
+
className: `exec-panel${a ? " is-expanded" : ""}`,
|
|
1188
|
+
ref: d,
|
|
1189
|
+
role: "group",
|
|
1190
|
+
"aria-labelledby": `${c}-title`,
|
|
1191
|
+
onKeyDown: X,
|
|
1192
|
+
children: [
|
|
1193
|
+
/* @__PURE__ */ L("header", {
|
|
1194
|
+
className: "exec-panel-header",
|
|
1195
|
+
children: [
|
|
1196
|
+
/* @__PURE__ */ L("h2", {
|
|
1197
|
+
id: `${c}-title`,
|
|
1198
|
+
children: ["Exec in ", /* @__PURE__ */ I("code", { children: t })]
|
|
1199
|
+
}),
|
|
1200
|
+
/* @__PURE__ */ L("fieldset", {
|
|
1201
|
+
className: "exec-identity",
|
|
1202
|
+
children: [
|
|
1203
|
+
/* @__PURE__ */ I("legend", { children: "Run as" }),
|
|
1204
|
+
/* @__PURE__ */ L("label", { children: [/* @__PURE__ */ I("input", {
|
|
1205
|
+
type: "radio",
|
|
1206
|
+
name: `${c}-identity`,
|
|
1207
|
+
checked: m === "container",
|
|
1208
|
+
onChange: () => H("container")
|
|
1209
|
+
}), "Container user"] }),
|
|
1210
|
+
/* @__PURE__ */ L("label", { children: [/* @__PURE__ */ I("input", {
|
|
1211
|
+
type: "radio",
|
|
1212
|
+
name: `${c}-identity`,
|
|
1213
|
+
checked: m === "root",
|
|
1214
|
+
onChange: () => H("root")
|
|
1215
|
+
}), "root"] })
|
|
1216
|
+
]
|
|
1217
|
+
}),
|
|
1218
|
+
/* @__PURE__ */ I("div", {
|
|
1219
|
+
className: "exec-tabs",
|
|
1220
|
+
role: "tablist",
|
|
1221
|
+
"aria-label": "Exec mode",
|
|
1222
|
+
onKeyDown: Y,
|
|
1223
|
+
children: St.map((e) => /* @__PURE__ */ I("button", {
|
|
1224
|
+
type: "button",
|
|
1225
|
+
role: "tab",
|
|
1226
|
+
className: "exec-tab",
|
|
1227
|
+
id: `${c}-tab-${e.id}`,
|
|
1228
|
+
"aria-selected": b === e.id,
|
|
1229
|
+
"aria-controls": `${c}-panel-${e.id}`,
|
|
1230
|
+
tabIndex: b === e.id ? 0 : -1,
|
|
1231
|
+
onClick: () => ae(e.id),
|
|
1232
|
+
children: e.label
|
|
1233
|
+
}, e.id))
|
|
1234
|
+
}),
|
|
1235
|
+
/* @__PURE__ */ I("button", {
|
|
1236
|
+
type: "button",
|
|
1237
|
+
className: "exec-close",
|
|
1238
|
+
"aria-label": "Close Exec",
|
|
1239
|
+
onClick: o,
|
|
1240
|
+
children: "Close"
|
|
1241
|
+
})
|
|
1242
|
+
]
|
|
1243
|
+
}),
|
|
1244
|
+
/* @__PURE__ */ L("div", {
|
|
1245
|
+
className: "exec-run",
|
|
1246
|
+
role: "tabpanel",
|
|
1247
|
+
id: `${c}-panel-run`,
|
|
1248
|
+
"aria-labelledby": `${c}-tab-run`,
|
|
1249
|
+
hidden: b !== "run",
|
|
1250
|
+
children: [
|
|
1251
|
+
/* @__PURE__ */ L("form", {
|
|
1252
|
+
className: "exec-run-form",
|
|
1253
|
+
onSubmit: ie,
|
|
1254
|
+
children: [/* @__PURE__ */ L("label", {
|
|
1255
|
+
htmlFor: `${c}-command`,
|
|
1256
|
+
children: ["Command ", /* @__PURE__ */ L("span", {
|
|
1257
|
+
className: "exec-hint",
|
|
1258
|
+
children: [
|
|
1259
|
+
"one line, run as ",
|
|
1260
|
+
/* @__PURE__ */ I("code", { children: "sh -c" }),
|
|
1261
|
+
V ? " as root" : ""
|
|
1262
|
+
]
|
|
1263
|
+
})]
|
|
1264
|
+
}), /* @__PURE__ */ L("div", {
|
|
1265
|
+
className: "exec-run-line",
|
|
1266
|
+
children: [/* @__PURE__ */ I("input", {
|
|
1267
|
+
ref: p,
|
|
1268
|
+
id: `${c}-command`,
|
|
1269
|
+
className: "mono-id",
|
|
1270
|
+
autoComplete: "off",
|
|
1271
|
+
autoCapitalize: "off",
|
|
1272
|
+
spellCheck: !1,
|
|
1273
|
+
placeholder: "id -u",
|
|
1274
|
+
value: S,
|
|
1275
|
+
onChange: (e) => C(e.target.value)
|
|
1276
|
+
}), /* @__PURE__ */ I("button", {
|
|
1277
|
+
type: "submit",
|
|
1278
|
+
className: "primary-action",
|
|
1279
|
+
disabled: w || !S.trim(),
|
|
1280
|
+
children: w ? "Running…" : "Run"
|
|
1281
|
+
})]
|
|
1282
|
+
})]
|
|
1283
|
+
}),
|
|
1284
|
+
N && /* @__PURE__ */ I(s, {
|
|
1285
|
+
error: N,
|
|
1286
|
+
kind: "Container"
|
|
1287
|
+
}),
|
|
1288
|
+
E && /* @__PURE__ */ L("div", {
|
|
1289
|
+
className: "exec-result",
|
|
1290
|
+
role: "status",
|
|
1291
|
+
children: [
|
|
1292
|
+
/* @__PURE__ */ I("p", {
|
|
1293
|
+
className: "exec-exit",
|
|
1294
|
+
children: E.timedOut ? "Stopped after the time limit; no exit code." : /* @__PURE__ */ L(ne, { children: ["Exit code ", /* @__PURE__ */ I("code", { children: E.exitCode })] })
|
|
1295
|
+
}),
|
|
1296
|
+
E.timedOut && /* @__PURE__ */ I("p", {
|
|
1297
|
+
className: "stale",
|
|
1298
|
+
children: "The command ran longer than 60 seconds and was killed. The output up to that point is below."
|
|
1299
|
+
}),
|
|
1300
|
+
E.truncated && /* @__PURE__ */ I("p", {
|
|
1301
|
+
className: "stale",
|
|
1302
|
+
children: "Output above 1 MiB per stream was dropped."
|
|
1303
|
+
}),
|
|
1304
|
+
/* @__PURE__ */ I("h3", {
|
|
1305
|
+
id: `${c}-stdout`,
|
|
1306
|
+
children: "stdout"
|
|
1307
|
+
}),
|
|
1308
|
+
/* @__PURE__ */ I("pre", {
|
|
1309
|
+
className: "exec-output",
|
|
1310
|
+
"aria-labelledby": `${c}-stdout`,
|
|
1311
|
+
tabIndex: 0,
|
|
1312
|
+
children: E.stdout || /* @__PURE__ */ I("span", {
|
|
1313
|
+
className: "exec-empty",
|
|
1314
|
+
children: "(empty)"
|
|
1315
|
+
})
|
|
1316
|
+
}),
|
|
1317
|
+
/* @__PURE__ */ I("h3", {
|
|
1318
|
+
id: `${c}-stderr`,
|
|
1319
|
+
children: "stderr"
|
|
1320
|
+
}),
|
|
1321
|
+
/* @__PURE__ */ I("pre", {
|
|
1322
|
+
className: "exec-output",
|
|
1323
|
+
"aria-labelledby": `${c}-stderr`,
|
|
1324
|
+
tabIndex: 0,
|
|
1325
|
+
children: E.stderr || /* @__PURE__ */ I("span", {
|
|
1326
|
+
className: "exec-empty",
|
|
1327
|
+
children: "(empty)"
|
|
1328
|
+
})
|
|
1329
|
+
})
|
|
1330
|
+
]
|
|
1331
|
+
})
|
|
1332
|
+
]
|
|
1333
|
+
}),
|
|
1334
|
+
/* @__PURE__ */ L("div", {
|
|
1335
|
+
className: "exec-terminal",
|
|
1336
|
+
role: "tabpanel",
|
|
1337
|
+
id: `${c}-panel-terminal`,
|
|
1338
|
+
"aria-labelledby": `${c}-tab-terminal`,
|
|
1339
|
+
hidden: b !== "terminal",
|
|
1340
|
+
children: [/* @__PURE__ */ L("div", {
|
|
1341
|
+
className: "exec-terminal-status",
|
|
1342
|
+
children: [/* @__PURE__ */ L("p", {
|
|
1343
|
+
role: "status",
|
|
1344
|
+
children: [z.message, V && !oe ? " (root)" : ""]
|
|
1345
|
+
}), oe && /* @__PURE__ */ I("button", {
|
|
1346
|
+
type: "button",
|
|
1347
|
+
onClick: W,
|
|
1348
|
+
children: "New shell"
|
|
1349
|
+
})]
|
|
1350
|
+
}), F && /* @__PURE__ */ I(Rn, {
|
|
1351
|
+
session: K,
|
|
1352
|
+
active: i && b === "terminal",
|
|
1353
|
+
expanded: a,
|
|
1354
|
+
theme: n,
|
|
1355
|
+
update: q,
|
|
1356
|
+
endpoint: J
|
|
1357
|
+
}, `${m}:${z.generation}`)]
|
|
1358
|
+
}),
|
|
1359
|
+
v && /* @__PURE__ */ I(wt, {
|
|
1360
|
+
target: l,
|
|
1361
|
+
onCancel: () => y(!1),
|
|
1362
|
+
onConfirm: U
|
|
1363
|
+
})
|
|
1364
|
+
]
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
var Et = 10;
|
|
1368
|
+
function Dt() {
|
|
1369
|
+
let e = new TextDecoder(), t = [], n = 0;
|
|
1370
|
+
return {
|
|
1371
|
+
push(r) {
|
|
1372
|
+
let i = [], a = 0;
|
|
1373
|
+
for (let o = r.indexOf(Et); o !== -1; o = r.indexOf(Et, a)) {
|
|
1374
|
+
let s = r.subarray(a, o);
|
|
1375
|
+
if (n) {
|
|
1376
|
+
let e = new Uint8Array(n + s.length), r = 0;
|
|
1377
|
+
for (let n of t) e.set(n, r), r += n.length;
|
|
1378
|
+
e.set(s, r), s = e, t = [], n = 0;
|
|
1379
|
+
}
|
|
1380
|
+
i.push(e.decode(s)), a = o + 1;
|
|
1381
|
+
}
|
|
1382
|
+
return a < r.length && (t.push(r.slice(a)), n += r.length - a), i;
|
|
1383
|
+
},
|
|
1384
|
+
get pending() {
|
|
1385
|
+
return n;
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
function Ot(e) {
|
|
1390
|
+
let t = e.trim();
|
|
1391
|
+
if (!t) return null;
|
|
1392
|
+
try {
|
|
1393
|
+
if (t[0] === "{") {
|
|
1394
|
+
let e = JSON.parse(t);
|
|
1395
|
+
return e?.version === 2 ? { header: {
|
|
1396
|
+
width: kt(e.width, 80),
|
|
1397
|
+
height: kt(e.height, 24),
|
|
1398
|
+
timestamp: Number(e.timestamp) || 0
|
|
1399
|
+
} } : null;
|
|
1400
|
+
}
|
|
1401
|
+
if (t[0] === "[") {
|
|
1402
|
+
let [e, n, r] = JSON.parse(t);
|
|
1403
|
+
return typeof e != "number" || !Number.isFinite(e) || typeof n != "string" || typeof r != "string" ? null : { event: {
|
|
1404
|
+
time: e,
|
|
1405
|
+
code: n,
|
|
1406
|
+
data: r
|
|
1407
|
+
} };
|
|
1408
|
+
}
|
|
1409
|
+
} catch {}
|
|
1410
|
+
return null;
|
|
1411
|
+
}
|
|
1412
|
+
var kt = (e, t) => Number.isInteger(e) && e > 0 ? e : t;
|
|
1413
|
+
function At(e) {
|
|
1414
|
+
let t = /^(\d+)x(\d+)$/.exec(e);
|
|
1415
|
+
if (!t) return null;
|
|
1416
|
+
let n = Number(t[1]), r = Number(t[2]);
|
|
1417
|
+
return n > 0 && r > 0 ? {
|
|
1418
|
+
cols: n,
|
|
1419
|
+
rows: r
|
|
1420
|
+
} : null;
|
|
1421
|
+
}
|
|
1422
|
+
function jt() {
|
|
1423
|
+
return {
|
|
1424
|
+
runs: [],
|
|
1425
|
+
ops: [],
|
|
1426
|
+
play: {
|
|
1427
|
+
idle: [],
|
|
1428
|
+
full: []
|
|
1429
|
+
},
|
|
1430
|
+
cols: 0,
|
|
1431
|
+
rows: 0,
|
|
1432
|
+
lastT: 0
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
function Mt(e, t) {
|
|
1436
|
+
let { ops: n, play: r } = e, i = n.at(-1);
|
|
1437
|
+
if (!i) r.idle.push(0), r.full.push(0);
|
|
1438
|
+
else if (i.run !== t.run) r.idle.push(r.idle.at(-1) + 1), r.full.push(r.full.at(-1) + 1);
|
|
1439
|
+
else {
|
|
1440
|
+
let e = Math.max(0, t.t - i.t);
|
|
1441
|
+
r.idle.push(r.idle.at(-1) + Math.min(e, 2)), r.full.push(r.full.at(-1) + e);
|
|
1442
|
+
}
|
|
1443
|
+
n.push(t);
|
|
1444
|
+
}
|
|
1445
|
+
function Nt(e, t, n, r) {
|
|
1446
|
+
(t !== e.cols || n !== e.rows) && (e.cols = t, e.rows = n, Mt(e, {
|
|
1447
|
+
kind: "size",
|
|
1448
|
+
run: e.runs.length - 1,
|
|
1449
|
+
t: r,
|
|
1450
|
+
cols: t,
|
|
1451
|
+
rows: n
|
|
1452
|
+
}));
|
|
1453
|
+
}
|
|
1454
|
+
function Pt(e, t) {
|
|
1455
|
+
if (!t) return;
|
|
1456
|
+
let n = e.runs.at(-1);
|
|
1457
|
+
if (t.header) {
|
|
1458
|
+
let { width: r, height: i, timestamp: a } = t.header;
|
|
1459
|
+
!n || n.timestamp !== a ? (e.runs.push({
|
|
1460
|
+
timestamp: a,
|
|
1461
|
+
firstOp: e.ops.length
|
|
1462
|
+
}), e.lastT = 0, e.cols = 0, Nt(e, r, i, 0)) : Nt(e, r, i, e.lastT);
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1465
|
+
let { event: r } = t;
|
|
1466
|
+
n || (e.runs.push({
|
|
1467
|
+
timestamp: 0,
|
|
1468
|
+
firstOp: e.ops.length
|
|
1469
|
+
}), e.cols = 0, Nt(e, 80, 24, 0));
|
|
1470
|
+
let i = Math.max(r.time, e.lastT);
|
|
1471
|
+
if (e.lastT = i, r.code === "o") Mt(e, {
|
|
1472
|
+
kind: "o",
|
|
1473
|
+
run: e.runs.length - 1,
|
|
1474
|
+
t: i,
|
|
1475
|
+
data: r.data
|
|
1476
|
+
});
|
|
1477
|
+
else if (r.code === "r") {
|
|
1478
|
+
let t = At(r.data);
|
|
1479
|
+
t && Nt(e, t.cols, t.rows, i);
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
function Ft(e, t) {
|
|
1483
|
+
for (let n of t) Pt(e, Ot(n));
|
|
1484
|
+
}
|
|
1485
|
+
var It = (e) => e ? "idle" : "full";
|
|
1486
|
+
function Lt(e, t) {
|
|
1487
|
+
return e.play[It(t)].at(-1) ?? 0;
|
|
1488
|
+
}
|
|
1489
|
+
function Rt(e, t, n) {
|
|
1490
|
+
let r = e.play[It(t)], i = 0, a = r.length;
|
|
1491
|
+
for (; i < a;) {
|
|
1492
|
+
let e = i + a >> 1;
|
|
1493
|
+
r[e] <= n ? i = e + 1 : a = e;
|
|
1494
|
+
}
|
|
1495
|
+
return i;
|
|
1496
|
+
}
|
|
1497
|
+
function zt(e, t, n) {
|
|
1498
|
+
return n > 0 ? e.play[It(t)][n - 1] : 0;
|
|
1499
|
+
}
|
|
1500
|
+
function Bt(e, t) {
|
|
1501
|
+
for (let n = Math.min(t, e.ops.length) - 1; n >= 0; n--) {
|
|
1502
|
+
let t = e.ops[n];
|
|
1503
|
+
if (t.kind === "size") return {
|
|
1504
|
+
cols: t.cols,
|
|
1505
|
+
rows: t.rows
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
let n = e.ops.find((e) => e.kind === "size");
|
|
1509
|
+
return n ? {
|
|
1510
|
+
cols: n.cols,
|
|
1511
|
+
rows: n.rows
|
|
1512
|
+
} : {
|
|
1513
|
+
cols: 80,
|
|
1514
|
+
rows: 24
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
function Vt(e, t, n) {
|
|
1518
|
+
let { ops: r, runs: i } = e;
|
|
1519
|
+
if (!r.length) return null;
|
|
1520
|
+
let a = e.play[It(t)], o = Math.max(1, Rt(e, t, n)), s = r[o - 1], c = s.t, l = r[o];
|
|
1521
|
+
return l && l.run === s.run && a[o] > a[o - 1] && (c += (l.t - s.t) * Math.min(1, Math.max(0, (n - a[o - 1]) / (a[o] - a[o - 1])))), i[s.run].timestamp + c;
|
|
1522
|
+
}
|
|
1523
|
+
function Ht(e, t) {
|
|
1524
|
+
let n = e.play[It(t)];
|
|
1525
|
+
return e.runs.map((e, t) => ({
|
|
1526
|
+
index: t,
|
|
1527
|
+
position: n[e.firstOp] ?? 0,
|
|
1528
|
+
timestamp: e.timestamp
|
|
1529
|
+
}));
|
|
1530
|
+
}
|
|
1531
|
+
function Ut(e, t, n, r = Infinity) {
|
|
1532
|
+
let i = [], a = "";
|
|
1533
|
+
for (let o = t; o < n; o++) {
|
|
1534
|
+
let t = e.ops[o];
|
|
1535
|
+
t.kind === "size" ? (a &&= (i.push({ data: a }), ""), i.push({
|
|
1536
|
+
cols: t.cols,
|
|
1537
|
+
rows: t.rows
|
|
1538
|
+
})) : (a += t.data, a.length >= r && (i.push({ data: a }), a = ""));
|
|
1539
|
+
}
|
|
1540
|
+
return a && i.push({ data: a }), i;
|
|
1541
|
+
}
|
|
1542
|
+
var Wt = (e) => Math.round(e * 1e6) / 1e6;
|
|
1543
|
+
function Gt(e) {
|
|
1544
|
+
let t = e.ops.find((e) => e.kind === "size") ?? {
|
|
1545
|
+
cols: 80,
|
|
1546
|
+
rows: 24
|
|
1547
|
+
}, n = {
|
|
1548
|
+
version: 2,
|
|
1549
|
+
width: t.cols,
|
|
1550
|
+
height: t.rows
|
|
1551
|
+
};
|
|
1552
|
+
e.runs[0]?.timestamp && (n.timestamp = e.runs[0].timestamp);
|
|
1553
|
+
let r = [JSON.stringify(n)], i = t.cols, a = t.rows;
|
|
1554
|
+
return e.ops.forEach((t, n) => {
|
|
1555
|
+
let o = Wt(e.play.full[n]);
|
|
1556
|
+
t.kind === "o" ? r.push(JSON.stringify([
|
|
1557
|
+
o,
|
|
1558
|
+
"o",
|
|
1559
|
+
t.data
|
|
1560
|
+
])) : (t.cols !== i || t.rows !== a) && (i = t.cols, a = t.rows, r.push(JSON.stringify([
|
|
1561
|
+
o,
|
|
1562
|
+
"r",
|
|
1563
|
+
`${i}x${a}`
|
|
1564
|
+
])));
|
|
1565
|
+
}), r.join("\n") + "\n";
|
|
1566
|
+
}
|
|
1567
|
+
// src/recording-source.ts
|
|
1568
|
+
var Kt = 1 << 20, qt = 2e3, Jt = 2e3;
|
|
1569
|
+
function Yt(e) {
|
|
1570
|
+
if (!e) return /* @__PURE__ */ new Uint8Array();
|
|
1571
|
+
let t = atob(e), n = new Uint8Array(t.length);
|
|
1572
|
+
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
1573
|
+
return n;
|
|
1574
|
+
}
|
|
1575
|
+
var Xt = () => new Promise((e) => setTimeout(e, 0));
|
|
1576
|
+
async function Zt(e) {
|
|
1577
|
+
let t = new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"));
|
|
1578
|
+
return new Uint8Array(await new Response(t).arrayBuffer());
|
|
1579
|
+
}
|
|
1580
|
+
function Qt(e) {
|
|
1581
|
+
let t = new Uint8Array(e.reduce((e, t) => e + t.length, 0)), n = 0;
|
|
1582
|
+
for (let r of e) t.set(r, n), n += r.length;
|
|
1583
|
+
return t;
|
|
1584
|
+
}
|
|
1585
|
+
var $t = class {
|
|
1586
|
+
handlers;
|
|
1587
|
+
following;
|
|
1588
|
+
base;
|
|
1589
|
+
controller = new AbortController();
|
|
1590
|
+
format = "asciicast";
|
|
1591
|
+
held = /* @__PURE__ */ new Map();
|
|
1592
|
+
lastSeq = -1;
|
|
1593
|
+
live = null;
|
|
1594
|
+
busy = !1;
|
|
1595
|
+
timer = 0;
|
|
1596
|
+
constructor(e, t, n, r) {
|
|
1597
|
+
this.handlers = n, this.following = r, this.base = `${f(e)}/containers/${encodeURIComponent(t)}/recording`;
|
|
1598
|
+
}
|
|
1599
|
+
start() {
|
|
1600
|
+
this.run(async () => {
|
|
1601
|
+
let e = await this.list();
|
|
1602
|
+
this.format = e.format, this.handlers.begin(e.format, (e.segments[0]?.seq ?? 0) > 0), await this.readNew(e, !0);
|
|
1603
|
+
}), this.timer = window.setInterval(() => {
|
|
1604
|
+
this.following() && document.visibilityState === "visible" && this.run(() => this.follow());
|
|
1605
|
+
}, qt);
|
|
1606
|
+
}
|
|
1607
|
+
close() {
|
|
1608
|
+
window.clearInterval(this.timer), this.controller.abort();
|
|
1609
|
+
}
|
|
1610
|
+
async run(e) {
|
|
1611
|
+
if (!(this.busy || this.controller.signal.aborted)) {
|
|
1612
|
+
this.busy = !0;
|
|
1613
|
+
try {
|
|
1614
|
+
await e();
|
|
1615
|
+
} catch (e) {
|
|
1616
|
+
this.controller.signal.aborted || this.handlers.error(e);
|
|
1617
|
+
} finally {
|
|
1618
|
+
this.busy = !1;
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
async get(e) {
|
|
1623
|
+
let t = await P(e, {
|
|
1624
|
+
signal: this.controller.signal,
|
|
1625
|
+
headers: { Accept: "application/json" }
|
|
1626
|
+
}), n = {};
|
|
1627
|
+
try {
|
|
1628
|
+
n = await t.json();
|
|
1629
|
+
} catch {}
|
|
1630
|
+
if (!t.ok) throw n.error ?? {
|
|
1631
|
+
code: "http_error",
|
|
1632
|
+
message: `HTTP ${t.status}`
|
|
1633
|
+
};
|
|
1634
|
+
return n;
|
|
1635
|
+
}
|
|
1636
|
+
list() {
|
|
1637
|
+
return this.get(this.base);
|
|
1638
|
+
}
|
|
1639
|
+
chunk(e, t) {
|
|
1640
|
+
return this.get(`${this.base}/segments/${e}?offset=${t}&maxBytes=${Kt}`);
|
|
1641
|
+
}
|
|
1642
|
+
async readNew(e, t) {
|
|
1643
|
+
let n = e.segments.filter((e) => e.seq > this.lastSeq || e.seq === this.live?.seq), r = 0;
|
|
1644
|
+
for (let e of n) {
|
|
1645
|
+
if (this.controller.signal.aborted) return;
|
|
1646
|
+
e.seq === this.live?.seq ? (await this.follow(), r++) : (e.live ? (this.live = this.hold(e.seq), await this.readLive() || (this.live = null, await this.readClosed(e.seq))) : await this.readClosed(e.seq), this.lastSeq = Math.max(this.lastSeq, e.seq), r++, t && this.handlers.progress(r, n.length, !1));
|
|
1647
|
+
}
|
|
1648
|
+
t && this.handlers.progress(n.length, n.length, !0);
|
|
1649
|
+
}
|
|
1650
|
+
hold(e) {
|
|
1651
|
+
let t = this.held.get(e);
|
|
1652
|
+
return t || (t = {
|
|
1653
|
+
seq: e,
|
|
1654
|
+
splitter: Dt(),
|
|
1655
|
+
lines: 0,
|
|
1656
|
+
bytes: 0,
|
|
1657
|
+
offset: 0
|
|
1658
|
+
}, this.held.set(e, t)), t;
|
|
1659
|
+
}
|
|
1660
|
+
async readClosed(e) {
|
|
1661
|
+
let t = [], n = 0, r = !1;
|
|
1662
|
+
for (;;) {
|
|
1663
|
+
let i;
|
|
1664
|
+
try {
|
|
1665
|
+
i = await this.chunk(e, n);
|
|
1666
|
+
} catch (e) {
|
|
1667
|
+
if (e.code === "segment_gone") return;
|
|
1668
|
+
throw e;
|
|
1669
|
+
}
|
|
1670
|
+
if (r = i.compressed, t.push(Yt(i.data)), n = i.next, !i.more) break;
|
|
1671
|
+
}
|
|
1672
|
+
let i = Qt(t), a = r ? await Zt(i) : i, o = this.held.get(e);
|
|
1673
|
+
if (this.held.delete(e), this.format === "raw") {
|
|
1674
|
+
let e = a.subarray(o?.bytes ?? 0);
|
|
1675
|
+
e.length && this.handlers.bytes(e);
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
let s = Dt().push(a).slice(o?.lines ?? 0);
|
|
1679
|
+
for (let e = 0; e < s.length; e += Jt) this.handlers.lines(s.slice(e, e + Jt)), e + Jt < s.length && await Xt();
|
|
1680
|
+
}
|
|
1681
|
+
async readLive() {
|
|
1682
|
+
let e = this.live;
|
|
1683
|
+
for (;;) {
|
|
1684
|
+
let t = await this.chunk(e.seq, e.offset);
|
|
1685
|
+
if (!t.live) return !1;
|
|
1686
|
+
if (t.size < e.offset) {
|
|
1687
|
+
e.offset = 0;
|
|
1688
|
+
continue;
|
|
1689
|
+
}
|
|
1690
|
+
let n = Yt(t.data);
|
|
1691
|
+
if (e.offset = t.next, this.format === "raw") e.bytes += n.length, n.length && this.handlers.bytes(n);
|
|
1692
|
+
else {
|
|
1693
|
+
let t = e.splitter.push(n);
|
|
1694
|
+
e.lines += t.length, t.length && this.handlers.lines(t);
|
|
1695
|
+
}
|
|
1696
|
+
if (!t.more) return !0;
|
|
1697
|
+
await Xt();
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
async follow() {
|
|
1701
|
+
if (!this.live) {
|
|
1702
|
+
await this.readNew(await this.list(), !1);
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
let e;
|
|
1706
|
+
try {
|
|
1707
|
+
e = await this.readLive();
|
|
1708
|
+
} catch (t) {
|
|
1709
|
+
if (t.code !== "segment_gone") throw t;
|
|
1710
|
+
e = !1;
|
|
1711
|
+
}
|
|
1712
|
+
if (e) return;
|
|
1713
|
+
let t = this.live.seq;
|
|
1714
|
+
this.live = null, await this.readClosed(t), this.lastSeq = Math.max(this.lastSeq, t), await this.readNew(await this.list(), !1);
|
|
1715
|
+
}
|
|
1716
|
+
}, en = [
|
|
1717
|
+
1,
|
|
1718
|
+
2,
|
|
1719
|
+
4,
|
|
1720
|
+
8
|
|
1721
|
+
], tn = 5, nn = 262144, rn = 2, an = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace";
|
|
1722
|
+
function on({ container: e, open: t, onToggle: n }) {
|
|
1723
|
+
let r = t ? `Close Replay for ${e}` : `Replay the recorded terminal of ${e}`;
|
|
1724
|
+
return /* @__PURE__ */ I("button", {
|
|
1725
|
+
type: "button",
|
|
1726
|
+
className: "icon-button replay-button",
|
|
1727
|
+
"aria-label": "Replay",
|
|
1728
|
+
"aria-expanded": t,
|
|
1729
|
+
title: r,
|
|
1730
|
+
"data-tooltip": r,
|
|
1731
|
+
onClick: n,
|
|
1732
|
+
children: /* @__PURE__ */ I(z, { name: "replay" })
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
var sn = (e) => {
|
|
1736
|
+
let t = Math.max(0, Math.floor(e)), n = Math.floor(t / 3600), r = Math.floor(t / 60) % 60, i = t % 60;
|
|
1737
|
+
return `${n ? `${n}:${String(r).padStart(2, "0")}` : r}:${String(i).padStart(2, "0")}`;
|
|
1738
|
+
}, cn = (e) => e ? (/* @__PURE__ */ new Date(e * 1e3)).toLocaleString() : "";
|
|
1739
|
+
function ln({ scope: e, container: t, live: n, theme: r, expanded: i, onClose: a }) {
|
|
1740
|
+
let o = k(), s = j(null), c = j(null), l = j(null), u = j(null), d = j(null), f = j(jt()), [p, m] = M(null), [h, g] = M(!1), [_, v] = M({
|
|
1741
|
+
phase: "loading",
|
|
1742
|
+
read: 0,
|
|
1743
|
+
total: 0
|
|
1744
|
+
}), [, y] = M(0), [b, x] = M(!1), [S, C] = M(0), [w, T] = M(1), [E, ee] = M(!0), [A, N] = M(!1), P = j({
|
|
1745
|
+
written: 0,
|
|
1746
|
+
position: 0,
|
|
1747
|
+
playing: !1,
|
|
1748
|
+
speed: 1,
|
|
1749
|
+
idleSkip: !0,
|
|
1750
|
+
base: 0,
|
|
1751
|
+
baseAt: 0,
|
|
1752
|
+
pending: 0,
|
|
1753
|
+
seekGeneration: 0,
|
|
1754
|
+
seeking: !1,
|
|
1755
|
+
following: !1
|
|
1756
|
+
}), te = j(n);
|
|
1757
|
+
te.current = n;
|
|
1758
|
+
let F = D(() => {
|
|
1759
|
+
let e = u.current?.element;
|
|
1760
|
+
if (!e || !c.current || !l.current) return;
|
|
1761
|
+
if (d.current) {
|
|
1762
|
+
l.current.clientWidth && l.current.clientHeight && d.current.fit();
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
l.current.style.transform = "";
|
|
1766
|
+
let t = e.offsetWidth, n = e.offsetHeight, r = c.current.getBoundingClientRect();
|
|
1767
|
+
if (!t || !n || !r.width || !r.height) return;
|
|
1768
|
+
let i = Math.min(1, (r.width - 20) / t, (r.height - 20) / n);
|
|
1769
|
+
l.current.style.transform = `scale(${i})`;
|
|
1770
|
+
}, []), ne = D((e) => {
|
|
1771
|
+
let t = P.current;
|
|
1772
|
+
t.pending++, u.current?.write(e, () => {
|
|
1773
|
+
t.pending--;
|
|
1774
|
+
});
|
|
1775
|
+
}, []), R = D((e, t) => {
|
|
1776
|
+
u.current?.write("", () => {
|
|
1777
|
+
!u.current || u.current.cols === e && u.current.rows === t || (u.current.resize(e, t), requestAnimationFrame(F));
|
|
1778
|
+
});
|
|
1779
|
+
}, [F]), B = D((e, t, n) => {
|
|
1780
|
+
for (let r of Ut(f.current, e, t, n)) r.data === void 0 ? R(r.cols, r.rows) : ne(r.data);
|
|
1781
|
+
}, [ne, R]), V = () => new Promise((e) => {
|
|
1782
|
+
u.current ? u.current.write("", e) : e();
|
|
1783
|
+
}), H = D(async (e) => {
|
|
1784
|
+
let t = P.current, n = f.current, r = Lt(n, t.idleSkip);
|
|
1785
|
+
e = Math.min(Math.max(0, e), r);
|
|
1786
|
+
let i = ++t.seekGeneration;
|
|
1787
|
+
if (t.seeking = !0, N(!0), t.position = e, t.base = e, t.baseAt = performance.now(), t.following = !1, C(e), await V(), i !== t.seekGeneration || !u.current) return;
|
|
1788
|
+
let a = Rt(n, t.idleSkip, e);
|
|
1789
|
+
if (a < t.written) {
|
|
1790
|
+
u.current.reset();
|
|
1791
|
+
let e = Bt(n, 0);
|
|
1792
|
+
(u.current.cols !== e.cols || u.current.rows !== e.rows) && (u.current.resize(e.cols, e.rows), F()), t.written = 0;
|
|
1793
|
+
}
|
|
1794
|
+
for (; t.written < a;) {
|
|
1795
|
+
let e = Math.min(a, t.written + 2e3);
|
|
1796
|
+
if (B(t.written, e, nn), t.written = e, await V(), i !== t.seekGeneration) return;
|
|
1797
|
+
}
|
|
1798
|
+
t.base = t.position, t.baseAt = performance.now(), t.seeking = !1, N(!1);
|
|
1799
|
+
}, [F, B]), U = j(H);
|
|
1800
|
+
U.current = H, O(() => {
|
|
1801
|
+
if (!l.current) return;
|
|
1802
|
+
let e = new G({
|
|
1803
|
+
disableStdin: !0,
|
|
1804
|
+
cursorBlink: !1,
|
|
1805
|
+
cursorStyle: "underline",
|
|
1806
|
+
cursorInactiveStyle: "none",
|
|
1807
|
+
fontFamily: an,
|
|
1808
|
+
fontSize: 14,
|
|
1809
|
+
scrollback: 1e3,
|
|
1810
|
+
cols: 80,
|
|
1811
|
+
rows: 24,
|
|
1812
|
+
theme: Fn(r)
|
|
1813
|
+
});
|
|
1814
|
+
u.current = e, e.open(l.current);
|
|
1815
|
+
let t = new ResizeObserver(() => requestAnimationFrame(F));
|
|
1816
|
+
return c.current && t.observe(c.current), () => {
|
|
1817
|
+
t.disconnect(), e.dispose(), u.current = null, d.current = null;
|
|
1818
|
+
};
|
|
1819
|
+
}, []), O(() => {
|
|
1820
|
+
let e = () => {
|
|
1821
|
+
u.current && (u.current.options.theme = Fn(r));
|
|
1822
|
+
};
|
|
1823
|
+
if (e(), r !== "system") return;
|
|
1824
|
+
let t = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1825
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
1826
|
+
}, [r]), O(() => {
|
|
1827
|
+
let e = requestAnimationFrame(F);
|
|
1828
|
+
return () => cancelAnimationFrame(e);
|
|
1829
|
+
}, [i, F]), O(() => {
|
|
1830
|
+
let n = !0, r = 0, i = () => {
|
|
1831
|
+
r ||= requestAnimationFrame(() => {
|
|
1832
|
+
r = 0, y((e) => e + 1);
|
|
1833
|
+
});
|
|
1834
|
+
}, a = new $t(e, t, {
|
|
1835
|
+
begin(e, t) {
|
|
1836
|
+
if (m(e), g(t), e === "raw" && u.current && l.current) {
|
|
1837
|
+
u.current.options.scrollback = 1e4;
|
|
1838
|
+
let e = new K();
|
|
1839
|
+
d.current = e, u.current.loadAddon(e), requestAnimationFrame(F);
|
|
1840
|
+
}
|
|
1841
|
+
},
|
|
1842
|
+
lines(e) {
|
|
1843
|
+
let t = f.current;
|
|
1844
|
+
if (Ft(t, e), n && t.ops.length) {
|
|
1845
|
+
n = !1;
|
|
1846
|
+
let e = Bt(t, 0);
|
|
1847
|
+
u.current?.resize(e.cols, e.rows), requestAnimationFrame(F);
|
|
1848
|
+
}
|
|
1849
|
+
let r = P.current;
|
|
1850
|
+
if (r.following && !r.seeking) {
|
|
1851
|
+
let e = t.ops.length;
|
|
1852
|
+
B(r.written, e), r.written = e, r.position = Lt(t, r.idleSkip), r.base = r.position, r.baseAt = performance.now(), C(r.position);
|
|
1853
|
+
}
|
|
1854
|
+
i();
|
|
1855
|
+
},
|
|
1856
|
+
bytes(e) {
|
|
1857
|
+
u.current?.write(e);
|
|
1858
|
+
},
|
|
1859
|
+
progress(e, t, n) {
|
|
1860
|
+
v({
|
|
1861
|
+
phase: n ? "ready" : "loading",
|
|
1862
|
+
read: e,
|
|
1863
|
+
total: t
|
|
1864
|
+
});
|
|
1865
|
+
},
|
|
1866
|
+
error(e) {
|
|
1867
|
+
v({
|
|
1868
|
+
phase: "error",
|
|
1869
|
+
error: e
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
}, () => te.current);
|
|
1873
|
+
return a.start(), () => {
|
|
1874
|
+
a.close(), r && cancelAnimationFrame(r);
|
|
1875
|
+
};
|
|
1876
|
+
}, [e.join("/"), t]), O(() => {
|
|
1877
|
+
if (!b) return;
|
|
1878
|
+
let e = P.current;
|
|
1879
|
+
e.playing = !0, e.base = e.position, e.baseAt = performance.now();
|
|
1880
|
+
let t = 0, n = 0, r = (i) => {
|
|
1881
|
+
if (t = requestAnimationFrame(r), e.seeking) return;
|
|
1882
|
+
let a = f.current, o = Lt(a, e.idleSkip), s = e.base + (i - e.baseAt) / 1e3 * e.speed;
|
|
1883
|
+
if (s >= o) {
|
|
1884
|
+
if (s = o, te.current) e.following = !0;
|
|
1885
|
+
else {
|
|
1886
|
+
B(e.written, a.ops.length), e.written = a.ops.length, e.position = o, C(o), x(!1);
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
if (e.pending < rn) {
|
|
1891
|
+
let t = Rt(a, e.idleSkip, s);
|
|
1892
|
+
t > e.written && (B(e.written, t), e.written = t), e.position = s;
|
|
1893
|
+
}
|
|
1894
|
+
i - n > 100 && (n = i, C(e.position));
|
|
1895
|
+
};
|
|
1896
|
+
return t = requestAnimationFrame(r), () => {
|
|
1897
|
+
cancelAnimationFrame(t), e.playing = !1, e.following = !1, C(e.position);
|
|
1898
|
+
};
|
|
1899
|
+
}, [b, B]), O(() => {
|
|
1900
|
+
let e = P.current;
|
|
1901
|
+
e.base = e.position, e.baseAt = performance.now(), e.speed = w;
|
|
1902
|
+
}, [w]), O(() => {
|
|
1903
|
+
let e = P.current;
|
|
1904
|
+
e.idleSkip !== E && (e.idleSkip = E, e.position = zt(f.current, E, e.written), e.base = e.position, e.baseAt = performance.now(), C(e.position));
|
|
1905
|
+
}, [E]), O(() => {
|
|
1906
|
+
let e = re();
|
|
1907
|
+
return s.current?.querySelector(".replay-play")?.focus(), e;
|
|
1908
|
+
}, []);
|
|
1909
|
+
function W() {
|
|
1910
|
+
let n = new Blob([Gt(f.current)], { type: "application/x-asciicast" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
1911
|
+
i.href = r, i.download = `${[...e, t].join("_")}.cast`, document.body.append(i), i.click(), i.remove(), setTimeout(() => URL.revokeObjectURL(r), 1e3);
|
|
1912
|
+
}
|
|
1913
|
+
let ie = f.current, q = Lt(ie, E), J = () => {
|
|
1914
|
+
b ? x(!1) : (!n && S >= q && q > 0 && H(0), x(!0));
|
|
1915
|
+
};
|
|
1916
|
+
function ae(e) {
|
|
1917
|
+
let t = e.target;
|
|
1918
|
+
e.key === "Escape" && !t.closest("select") ? (e.preventDefault(), e.stopPropagation(), a()) : p !== "asciicast" || t.closest("select, input[type=checkbox]") || (e.key === " " && !t.closest("button") ? (e.preventDefault(), J()) : (e.key === "ArrowRight" || e.key === "ArrowLeft") && (e.preventDefault(), H(P.current.position + (e.key === "ArrowRight" ? tn : -5))));
|
|
1919
|
+
}
|
|
1920
|
+
let Y = _.phase === "error" ? _.error : null, X = Y?.code === "daemon_outdated", oe = _.phase === "loading", Z = p === "asciicast", se = Z ? Ht(ie, E) : [], ce = _.phase === "ready" && (Z ? !ie.ops.some((e) => e.kind === "o") : !1), Q = Z ? Vt(ie, E, S) : null, le = X ? "" : Y ? Y.message : oe ? `Loading the recording…${_.total ? ` (${_.read} of ${_.total} segments)` : ""}` : A ? "Seeking…" : "";
|
|
1921
|
+
return /* @__PURE__ */ L("section", {
|
|
1922
|
+
className: `replay-panel${i ? " is-expanded" : ""}`,
|
|
1923
|
+
ref: s,
|
|
1924
|
+
role: "group",
|
|
1925
|
+
"aria-labelledby": `${o}-title`,
|
|
1926
|
+
onKeyDown: ae,
|
|
1927
|
+
children: [
|
|
1928
|
+
/* @__PURE__ */ L("header", {
|
|
1929
|
+
className: "replay-panel-header",
|
|
1930
|
+
children: [/* @__PURE__ */ L("h2", {
|
|
1931
|
+
id: `${o}-title`,
|
|
1932
|
+
children: ["Replay of ", /* @__PURE__ */ I("code", { children: t })]
|
|
1933
|
+
}), /* @__PURE__ */ L("div", {
|
|
1934
|
+
className: "replay-actions",
|
|
1935
|
+
children: [
|
|
1936
|
+
Z && /* @__PURE__ */ I("button", {
|
|
1937
|
+
type: "button",
|
|
1938
|
+
onClick: W,
|
|
1939
|
+
disabled: !ie.ops.length,
|
|
1940
|
+
children: "Download"
|
|
1941
|
+
}),
|
|
1942
|
+
n && /* @__PURE__ */ I("button", {
|
|
1943
|
+
type: "button",
|
|
1944
|
+
onClick: a,
|
|
1945
|
+
children: "Live"
|
|
1946
|
+
}),
|
|
1947
|
+
/* @__PURE__ */ I("button", {
|
|
1948
|
+
type: "button",
|
|
1949
|
+
className: "replay-close",
|
|
1950
|
+
"aria-label": "Close Replay",
|
|
1951
|
+
onClick: a,
|
|
1952
|
+
children: "Close"
|
|
1953
|
+
})
|
|
1954
|
+
]
|
|
1955
|
+
})]
|
|
1956
|
+
}),
|
|
1957
|
+
X && /* @__PURE__ */ I("p", {
|
|
1958
|
+
className: "replay-notice",
|
|
1959
|
+
role: "alert",
|
|
1960
|
+
children: "kukeond must be upgraded to replay this terminal. The terminal and its log keep working."
|
|
1961
|
+
}),
|
|
1962
|
+
h && /* @__PURE__ */ I("p", {
|
|
1963
|
+
className: "replay-notice",
|
|
1964
|
+
children: "Earlier output was dropped by retention: the recording starts at its oldest retained output."
|
|
1965
|
+
}),
|
|
1966
|
+
p === "raw" && /* @__PURE__ */ I("p", {
|
|
1967
|
+
className: "replay-notice",
|
|
1968
|
+
children: "This recording has no timing: the container started before recordings were timed. Its output is shown from the oldest retained byte."
|
|
1969
|
+
}),
|
|
1970
|
+
ce && /* @__PURE__ */ I("p", {
|
|
1971
|
+
className: "replay-notice",
|
|
1972
|
+
role: "status",
|
|
1973
|
+
children: "No output recorded yet."
|
|
1974
|
+
}),
|
|
1975
|
+
Z && /* @__PURE__ */ L("div", {
|
|
1976
|
+
className: "replay-controls",
|
|
1977
|
+
children: [
|
|
1978
|
+
/* @__PURE__ */ I("button", {
|
|
1979
|
+
type: "button",
|
|
1980
|
+
className: "icon-button replay-play",
|
|
1981
|
+
"aria-label": b ? "Pause" : "Play",
|
|
1982
|
+
"data-tooltip": b ? "Pause (space)" : "Play (space)",
|
|
1983
|
+
onClick: J,
|
|
1984
|
+
disabled: !ie.ops.length,
|
|
1985
|
+
children: /* @__PURE__ */ I(z, { name: b ? "pause" : "start" })
|
|
1986
|
+
}),
|
|
1987
|
+
/* @__PURE__ */ L("div", {
|
|
1988
|
+
className: "replay-timeline",
|
|
1989
|
+
children: [/* @__PURE__ */ I("input", {
|
|
1990
|
+
type: "range",
|
|
1991
|
+
"aria-label": "Position",
|
|
1992
|
+
min: 0,
|
|
1993
|
+
max: q || 0,
|
|
1994
|
+
step: "any",
|
|
1995
|
+
value: Math.min(S, q),
|
|
1996
|
+
disabled: !ie.ops.length,
|
|
1997
|
+
"aria-valuetext": `${sn(S)} of ${sn(q)}${Q ? `, ${cn(Q)}` : ""}`,
|
|
1998
|
+
onChange: (e) => void H(Number(e.target.value))
|
|
1999
|
+
}), /* @__PURE__ */ I("div", {
|
|
2000
|
+
className: "replay-marks",
|
|
2001
|
+
"aria-hidden": "true",
|
|
2002
|
+
children: se.map((e) => /* @__PURE__ */ I("span", {
|
|
2003
|
+
className: "replay-mark",
|
|
2004
|
+
style: { left: `${q ? e.position / q * 100 : 0}%` },
|
|
2005
|
+
title: `Run ${e.index + 1}: ${cn(e.timestamp)}`
|
|
2006
|
+
}, e.index))
|
|
2007
|
+
})]
|
|
2008
|
+
}),
|
|
2009
|
+
/* @__PURE__ */ L("span", {
|
|
2010
|
+
className: "replay-time",
|
|
2011
|
+
"aria-live": "off",
|
|
2012
|
+
children: [/* @__PURE__ */ L("span", {
|
|
2013
|
+
className: "replay-elapsed",
|
|
2014
|
+
children: [
|
|
2015
|
+
sn(S),
|
|
2016
|
+
" / ",
|
|
2017
|
+
sn(q)
|
|
2018
|
+
]
|
|
2019
|
+
}), Q ? /* @__PURE__ */ I("time", {
|
|
2020
|
+
className: "replay-wall",
|
|
2021
|
+
dateTime: (/* @__PURE__ */ new Date(Q * 1e3)).toISOString(),
|
|
2022
|
+
children: cn(Q)
|
|
2023
|
+
}) : null]
|
|
2024
|
+
}),
|
|
2025
|
+
se.length > 1 && /* @__PURE__ */ L("span", {
|
|
2026
|
+
className: "replay-runs",
|
|
2027
|
+
children: [se.length, " runs"]
|
|
2028
|
+
}),
|
|
2029
|
+
/* @__PURE__ */ L("label", {
|
|
2030
|
+
className: "replay-speed",
|
|
2031
|
+
children: ["Speed ", /* @__PURE__ */ I("select", {
|
|
2032
|
+
value: w,
|
|
2033
|
+
onChange: (e) => T(Number(e.target.value)),
|
|
2034
|
+
children: en.map((e) => /* @__PURE__ */ L("option", {
|
|
2035
|
+
value: e,
|
|
2036
|
+
children: [e, "×"]
|
|
2037
|
+
}, e))
|
|
2038
|
+
})]
|
|
2039
|
+
}),
|
|
2040
|
+
/* @__PURE__ */ L("label", {
|
|
2041
|
+
className: "replay-idle",
|
|
2042
|
+
children: [/* @__PURE__ */ I("input", {
|
|
2043
|
+
type: "checkbox",
|
|
2044
|
+
checked: E,
|
|
2045
|
+
onChange: (e) => ee(e.target.checked)
|
|
2046
|
+
}), "Skip idle"]
|
|
2047
|
+
})
|
|
2048
|
+
]
|
|
2049
|
+
}),
|
|
2050
|
+
le && /* @__PURE__ */ I("p", {
|
|
2051
|
+
className: "replay-status",
|
|
2052
|
+
role: "status",
|
|
2053
|
+
children: le
|
|
2054
|
+
}),
|
|
2055
|
+
/* @__PURE__ */ I("div", {
|
|
2056
|
+
className: "replay-screen",
|
|
2057
|
+
ref: c,
|
|
2058
|
+
hidden: X,
|
|
2059
|
+
"aria-label": `Replay for ${[...e, t].join(" / ")}`,
|
|
2060
|
+
children: /* @__PURE__ */ I("div", {
|
|
2061
|
+
ref: l,
|
|
2062
|
+
className: `replay-mount${p === "raw" ? " is-fitted" : ""}`
|
|
2063
|
+
})
|
|
2064
|
+
})
|
|
2065
|
+
]
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
// src/lifecycle-policy.js
|
|
2069
|
+
function un(e) {
|
|
2070
|
+
return e === "Ready" ? ["stop", "restart"] : ["start"];
|
|
2071
|
+
}
|
|
2072
|
+
function dn(e, t, n, r) {
|
|
2073
|
+
return e === "purge" ? n === r : t === !0;
|
|
2074
|
+
}
|
|
2075
|
+
function fn(e = !1, t = !1) {
|
|
2076
|
+
return {
|
|
2077
|
+
force: e === !0,
|
|
2078
|
+
cascade: t === !0
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
function pn(e, t) {
|
|
2082
|
+
return e === !0 || t === !1;
|
|
2083
|
+
}
|
|
2084
|
+
function mn(e) {
|
|
2085
|
+
return e.metadataDeleted === !0 && e.cgroupDeleted === !0;
|
|
2086
|
+
}
|
|
2087
|
+
function hn(e) {
|
|
2088
|
+
return e.purgeSucceeded === !0 && e.metadataDeleted === !0 && e.cgroupDeleted === !0;
|
|
2089
|
+
}
|
|
2090
|
+
var gn = "kuke-system";
|
|
2091
|
+
function _n(e) {
|
|
2092
|
+
return e.length >= 1 && e.length <= 3 && (e.length !== 1 || e[0] !== "kuke-system");
|
|
2093
|
+
}
|
|
2094
|
+
function vn(e) {
|
|
2095
|
+
return e[0] === gn;
|
|
2096
|
+
}
|
|
2097
|
+
function yn(e, t) {
|
|
2098
|
+
return t.length > e.length && e.every((e, n) => t[n] === e);
|
|
2099
|
+
}
|
|
2100
|
+
function bn(e, t) {
|
|
2101
|
+
let n = [];
|
|
2102
|
+
for (let r = t.length; r < 4; r++) n.push((e[r] ?? []).filter((e) => yn(t, e.scope)).length);
|
|
2103
|
+
return n;
|
|
2104
|
+
}
|
|
2105
|
+
function xn(e, t) {
|
|
2106
|
+
return (e[3] ?? []).filter((e) => yn(t, e.scope)).map((e) => e.scope);
|
|
2107
|
+
}
|
|
2108
|
+
// src/terminal-palette.js
|
|
2109
|
+
var Sn = "#0d1421", Cn = "#f8fafc", wn = {
|
|
2110
|
+
black: "#000000",
|
|
2111
|
+
red: "#cd0000",
|
|
2112
|
+
green: "#00cd00",
|
|
2113
|
+
yellow: "#cdcd00",
|
|
2114
|
+
blue: "#0000ee",
|
|
2115
|
+
magenta: "#cd00cd",
|
|
2116
|
+
cyan: "#00cdcd",
|
|
2117
|
+
white: "#e5e5e5",
|
|
2118
|
+
brightBlack: "#7f7f7f",
|
|
2119
|
+
brightRed: "#ff0000",
|
|
2120
|
+
brightGreen: "#00ff00",
|
|
2121
|
+
brightYellow: "#ffff00",
|
|
2122
|
+
brightBlue: "#5c5cff",
|
|
2123
|
+
brightMagenta: "#ff00ff",
|
|
2124
|
+
brightCyan: "#00ffff",
|
|
2125
|
+
brightWhite: "#ffffff"
|
|
2126
|
+
}, Tn = {
|
|
2127
|
+
black: "#1f2328",
|
|
2128
|
+
red: "#b3261e",
|
|
2129
|
+
green: "#1a7f37",
|
|
2130
|
+
yellow: "#8a6100",
|
|
2131
|
+
blue: "#0b57d0",
|
|
2132
|
+
magenta: "#8e24aa",
|
|
2133
|
+
cyan: "#00748a",
|
|
2134
|
+
white: "#6e7781",
|
|
2135
|
+
brightBlack: "#57606a",
|
|
2136
|
+
brightRed: "#d1242f",
|
|
2137
|
+
brightGreen: "#1f883d",
|
|
2138
|
+
brightYellow: "#9a6700",
|
|
2139
|
+
brightBlue: "#0969da",
|
|
2140
|
+
brightMagenta: "#a626a4",
|
|
2141
|
+
brightCyan: "#0e7d8f",
|
|
2142
|
+
brightWhite: "#808891"
|
|
2143
|
+
}, En = 20, Dn = 150, On = 2e3, kn = 20, An = [
|
|
2144
|
+
1e3,
|
|
2145
|
+
2e3,
|
|
2146
|
+
5e3
|
|
2147
|
+
], jn = 1e4, $ = (e) => JSON.stringify(e), Mn = (e, t, n = "main") => JSON.stringify([
|
|
2148
|
+
...e,
|
|
2149
|
+
t,
|
|
2150
|
+
n
|
|
2151
|
+
]), Nn = /* @__PURE__ */ new Set([
|
|
2152
|
+
"Stopped",
|
|
2153
|
+
"Stopping",
|
|
2154
|
+
"Exited",
|
|
2155
|
+
"Deleted",
|
|
2156
|
+
"Failed",
|
|
2157
|
+
"Error",
|
|
2158
|
+
"Pending",
|
|
2159
|
+
"Unknown"
|
|
2160
|
+
]), Pn = {
|
|
2161
|
+
cursorAccent: "#000000",
|
|
2162
|
+
selectionBackground: "#4d4d4d"
|
|
2163
|
+
};
|
|
2164
|
+
function Fn(e) {
|
|
2165
|
+
let t = e === "dark" || e === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2166
|
+
return {
|
|
2167
|
+
...Pn,
|
|
2168
|
+
...t ? wn : Tn,
|
|
2169
|
+
background: t ? Sn : Cn,
|
|
2170
|
+
foreground: t ? "#e5e6ec" : "#20232b",
|
|
2171
|
+
cursor: t ? "#e5e6ec" : "#20232b"
|
|
2172
|
+
};
|
|
2173
|
+
}
|
|
2174
|
+
function In(e) {
|
|
2175
|
+
let [t, n] = M([]), [r, i] = M({}), a = j(/* @__PURE__ */ new Set()), [o, s] = M({}), c = j(0), l = D((e, t) => {
|
|
2176
|
+
c.current += 1;
|
|
2177
|
+
let n = c.current;
|
|
2178
|
+
s((r) => ({
|
|
2179
|
+
...r,
|
|
2180
|
+
[e]: {
|
|
2181
|
+
text: t,
|
|
2182
|
+
nonce: n
|
|
2183
|
+
}
|
|
2184
|
+
}));
|
|
2185
|
+
}, []), u = D((e, t) => {
|
|
2186
|
+
s((n) => {
|
|
2187
|
+
if (n[e]?.nonce !== t) return n;
|
|
2188
|
+
let r = { ...n };
|
|
2189
|
+
return delete r[e], r;
|
|
2190
|
+
});
|
|
2191
|
+
}, []), d = j({}), f = (e) => {
|
|
2192
|
+
let t = Object.fromEntries(Object.entries(d.current).filter(([t]) => e(t)));
|
|
2193
|
+
Object.keys(t).length !== Object.keys(d.current).length && (d.current = t);
|
|
2194
|
+
}, p = D((e, t) => {
|
|
2195
|
+
d.current = {
|
|
2196
|
+
...d.current,
|
|
2197
|
+
[$(e)]: t
|
|
2198
|
+
}, i((n) => ({
|
|
2199
|
+
...n,
|
|
2200
|
+
[$(e)]: t
|
|
2201
|
+
}));
|
|
2202
|
+
}, []), m = D((e, t, r = "main") => {
|
|
2203
|
+
let i = Mn(e, t, r);
|
|
2204
|
+
n((n) => {
|
|
2205
|
+
let a = n.find((e) => e.id === i);
|
|
2206
|
+
return a?.state === "attached" || a?.state === "connecting" || n.filter((e) => e.state === "attached" || e.state === "connecting").length >= En || !a && n.length >= kn ? n : a ? n.map((e) => e.id === i ? {
|
|
2207
|
+
...e,
|
|
2208
|
+
generation: e.generation + 1,
|
|
2209
|
+
state: "connecting",
|
|
2210
|
+
message: "Connecting…"
|
|
2211
|
+
} : e) : [...n, {
|
|
2212
|
+
id: i,
|
|
2213
|
+
scope: [...e],
|
|
2214
|
+
container: t,
|
|
2215
|
+
view: r,
|
|
2216
|
+
state: "connecting",
|
|
2217
|
+
message: "Connecting…",
|
|
2218
|
+
generation: 0
|
|
2219
|
+
}];
|
|
2220
|
+
}), r === "main" && p(e, t);
|
|
2221
|
+
}, [p]), h = D((e, t, n) => {
|
|
2222
|
+
d.current[$(e)] === n && m(e, t);
|
|
2223
|
+
}, [m]), g = D((e) => n((t) => t.filter((t) => t.id !== e)), []), _ = D((e, t) => {
|
|
2224
|
+
let r = $(e);
|
|
2225
|
+
n((e) => e.some((e) => e.view === t && $(e.scope) === r) ? e.filter((e) => e.view !== t || $(e.scope) !== r) : e);
|
|
2226
|
+
}, []), v = D((e) => {
|
|
2227
|
+
let t = $(e);
|
|
2228
|
+
a.current.delete(t), n((e) => e.filter((e) => $(e.scope) !== t)), f((e) => e !== t), i((e) => {
|
|
2229
|
+
if (!(t in e)) return e;
|
|
2230
|
+
let n = { ...e };
|
|
2231
|
+
return delete n[t], n;
|
|
2232
|
+
});
|
|
2233
|
+
}, []), y = D((e, t, r = !1) => {
|
|
2234
|
+
let i = $(e);
|
|
2235
|
+
n((e) => e.map((e) => $(e.scope) === i ? {
|
|
2236
|
+
...e,
|
|
2237
|
+
generation: e.generation + 1,
|
|
2238
|
+
state: "interrupted",
|
|
2239
|
+
message: t,
|
|
2240
|
+
reattach: r
|
|
2241
|
+
} : e));
|
|
2242
|
+
}, []), b = D((e) => {
|
|
2243
|
+
let t = $(e);
|
|
2244
|
+
n((e) => e.filter((e) => $(e.scope) !== t || e.state !== "interrupted"));
|
|
2245
|
+
}, []), x = D((e) => {
|
|
2246
|
+
a.current.add($(e));
|
|
2247
|
+
}, []), S = D((e) => {
|
|
2248
|
+
a.current.delete($(e));
|
|
2249
|
+
}, []), C = D((e, t, r, i) => {
|
|
2250
|
+
n((n) => n.map((n) => n.id === e && n.generation === t ? {
|
|
2251
|
+
...n,
|
|
2252
|
+
state: r,
|
|
2253
|
+
message: i
|
|
2254
|
+
} : n));
|
|
2255
|
+
}, []);
|
|
2256
|
+
return O(() => {
|
|
2257
|
+
if (!e.data || e.loading || e.error || e.data.failures.length) return;
|
|
2258
|
+
let t = new Map(e.data.rows[3].map((e) => [$(e.scope), e.doc.status?.state ?? ""]));
|
|
2259
|
+
n((e) => e.filter((e) => {
|
|
2260
|
+
let n = $(e.scope), r = t.get(n);
|
|
2261
|
+
return r === void 0 ? !1 : a.current.has(n) ? !0 : !Nn.has(r) || e.state === "interrupted";
|
|
2262
|
+
})), f((e) => t.has(e)), i((e) => {
|
|
2263
|
+
let n = !1, r = { ...e };
|
|
2264
|
+
for (let e of Object.keys(r)) t.has(e) || (delete r[e], n = !0);
|
|
2265
|
+
return n ? r : e;
|
|
2266
|
+
});
|
|
2267
|
+
}, [
|
|
2268
|
+
e.data,
|
|
2269
|
+
e.loading,
|
|
2270
|
+
e.error
|
|
2271
|
+
]), {
|
|
2272
|
+
sessions: t,
|
|
2273
|
+
selection: r,
|
|
2274
|
+
select: p,
|
|
2275
|
+
attach: m,
|
|
2276
|
+
autoAttach: h,
|
|
2277
|
+
detach: g,
|
|
2278
|
+
detachView: _,
|
|
2279
|
+
removeCell: v,
|
|
2280
|
+
interruptCell: y,
|
|
2281
|
+
dropInterrupted: b,
|
|
2282
|
+
holdCell: x,
|
|
2283
|
+
releaseCell: S,
|
|
2284
|
+
update: C,
|
|
2285
|
+
cellStates: A(() => {
|
|
2286
|
+
let e = {};
|
|
2287
|
+
for (let n of t) {
|
|
2288
|
+
let t = $(n.scope);
|
|
2289
|
+
(n.state === "attached" || n.state === "connecting" && e[t] !== "attached" || !e[t]) && (e[t] = n.state);
|
|
2290
|
+
}
|
|
2291
|
+
return e;
|
|
2292
|
+
}, [t]),
|
|
2293
|
+
pastes: o,
|
|
2294
|
+
paste: l,
|
|
2295
|
+
pasteDelivered: u
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
function Ln(e, t, n) {
|
|
2299
|
+
let r = j({}), i = j(n);
|
|
2300
|
+
return i.current = n, O(() => {
|
|
2301
|
+
if (!e) return;
|
|
2302
|
+
let n = r.current[e.id] ??= { count: 0 };
|
|
2303
|
+
if (e.state === "attached") {
|
|
2304
|
+
n.attachedAt ??= Date.now();
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
if (e.state === "connecting" || (n.attachedAt !== void 0 && (Date.now() - n.attachedAt >= jn && (n.count = 0), n.attachedAt = void 0), e.state === "interrupted" && e.reattach && (n.count = 0), !t || e.state === "interrupted" && !e.reattach || n.count >= An.length)) return;
|
|
2308
|
+
let a = e, o = window.setTimeout(() => {
|
|
2309
|
+
n.count += 1, i.current(a);
|
|
2310
|
+
}, e.state === "interrupted" ? 0 : An[n.count]);
|
|
2311
|
+
return () => window.clearTimeout(o);
|
|
2312
|
+
}, [
|
|
2313
|
+
e?.id,
|
|
2314
|
+
e?.state,
|
|
2315
|
+
e?.generation,
|
|
2316
|
+
e?.reattach,
|
|
2317
|
+
t
|
|
2318
|
+
]), D((e) => {
|
|
2319
|
+
delete r.current[e];
|
|
2320
|
+
}, []);
|
|
2321
|
+
}
|
|
2322
|
+
function Rn({ session: e, active: t, expanded: n, theme: r, update: i, pending: a, onPasted: o, endpoint: s }) {
|
|
2323
|
+
let c = j(null), l = j(null), u = j(null), d = j(() => {}), p = j(""), m = j(t), h = j(!1), g = j({
|
|
2324
|
+
received: 0,
|
|
2325
|
+
parsed: 0
|
|
2326
|
+
}), [_, v] = M(0);
|
|
2327
|
+
m.current = t, O(() => {
|
|
2328
|
+
if (!c.current) return;
|
|
2329
|
+
let e = new G({
|
|
2330
|
+
cursorBlink: !0,
|
|
2331
|
+
cursorStyle: "underline",
|
|
2332
|
+
cursorInactiveStyle: "outline",
|
|
2333
|
+
convertEol: !1,
|
|
2334
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace",
|
|
2335
|
+
fontSize: 14,
|
|
2336
|
+
scrollback: 2e3,
|
|
2337
|
+
theme: Fn(r)
|
|
2338
|
+
}), t = new K();
|
|
2339
|
+
l.current = e, e.loadAddon(t), e.open(c.current);
|
|
2340
|
+
let n = 0, i = !1, a = (r = !1) => {
|
|
2341
|
+
m.current && (i ||= r, n && cancelAnimationFrame(n), n = requestAnimationFrame(() => {
|
|
2342
|
+
if (n = 0, !m.current || !c.current?.clientWidth || !c.current.clientHeight) return;
|
|
2343
|
+
t.fit();
|
|
2344
|
+
let r = `${e.cols}x${e.rows}`;
|
|
2345
|
+
u.current?.readyState !== WebSocket.OPEN || r === p.current && !i || (i = !1, p.current = r, u.current.send(JSON.stringify({
|
|
2346
|
+
type: "resize",
|
|
2347
|
+
cols: e.cols,
|
|
2348
|
+
rows: e.rows
|
|
2349
|
+
})));
|
|
2350
|
+
}));
|
|
2351
|
+
};
|
|
2352
|
+
d.current = a;
|
|
2353
|
+
let o = () => a(), s = () => a(!0), f = new ResizeObserver(o);
|
|
2354
|
+
f.observe(c.current), c.current.parentElement && f.observe(c.current.parentElement), window.addEventListener("resize", o), window.visualViewport?.addEventListener("resize", o);
|
|
2355
|
+
let h = c.current;
|
|
2356
|
+
h.addEventListener("focusin", s);
|
|
2357
|
+
let g = e.onData((e) => {
|
|
2358
|
+
m.current && u.current?.readyState === WebSocket.OPEN && u.current.send(new TextEncoder().encode(e));
|
|
2359
|
+
});
|
|
2360
|
+
return () => {
|
|
2361
|
+
f.disconnect(), window.removeEventListener("resize", o), window.visualViewport?.removeEventListener("resize", o), h.removeEventListener("focusin", s), n && cancelAnimationFrame(n), g.dispose(), e.dispose(), l.current = null, d.current = () => {};
|
|
2362
|
+
};
|
|
2363
|
+
}, []), O(() => {
|
|
2364
|
+
let e = () => {
|
|
2365
|
+
l.current && (l.current.options.theme = Fn(r));
|
|
2366
|
+
};
|
|
2367
|
+
if (e(), r !== "system") return;
|
|
2368
|
+
let t = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2369
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
2370
|
+
}, [r]), O(() => {
|
|
2371
|
+
e.state === "interrupted" ? (l.current?.reset(), l.current?.write(e.reattach ? "\r\nPrevious terminal session ended. Attaching to the current process…\r\n" : "\r\nPrevious terminal session ended. Reconnect to attach to the current process.\r\n"), h.current = !0) : e.state === "connecting" && h.current && (l.current?.reset(), h.current = !1);
|
|
2372
|
+
}, [e.state, e.generation]), O(() => {
|
|
2373
|
+
if (e.state === "disconnected" || e.state === "interrupted") return;
|
|
2374
|
+
let t;
|
|
2375
|
+
try {
|
|
2376
|
+
t = te(s?.path ?? `${f(e.scope)}/containers/${encodeURIComponent(e.container)}/attach`);
|
|
2377
|
+
} catch {
|
|
2378
|
+
i(e.id, e.generation, "disconnected", "Terminal connection failed. Check the server and retry.");
|
|
2379
|
+
return;
|
|
2380
|
+
}
|
|
2381
|
+
u.current = t, g.current = {
|
|
2382
|
+
received: 0,
|
|
2383
|
+
parsed: 0
|
|
2384
|
+
}, t.binaryType = "arraybuffer";
|
|
2385
|
+
let n = "", r = !1, a = !1, o = !1;
|
|
2386
|
+
t.onopen = () => {
|
|
2387
|
+
o = !0, p.current = "", d.current();
|
|
2388
|
+
}, t.onmessage = (o) => {
|
|
2389
|
+
if (o.data instanceof ArrayBuffer) {
|
|
2390
|
+
let t = g.current;
|
|
2391
|
+
t.received += 1, l.current?.write(new Uint8Array(o.data), () => {
|
|
2392
|
+
t.parsed += 1, g.current === t && t.parsed === t.received && v((e) => e + 1);
|
|
2393
|
+
}), a || (a = !0, r && i(e.id, e.generation, "attached", s ? "Connected" : "Attached"));
|
|
2394
|
+
} else if (typeof o.data == "string") {
|
|
2395
|
+
try {
|
|
2396
|
+
let t = JSON.parse(o.data);
|
|
2397
|
+
t.type === "ready" ? (r = !0, i(e.id, e.generation, "attached", s ? "Connected" : a ? "Attached" : "Attached — waiting for container output. A prompt appears when the container runs an interactive shell.")) : t.type === "exit" && s ? (n = `Process exited with code ${typeof t.code == "number" ? t.code : "unknown"}`, l.current?.write(`\r\n${n}\r\n`)) : n = t.type === "error" ? typeof t.message == "string" ? t.message : "Terminal server error." : "Invalid terminal response.";
|
|
2398
|
+
} catch {
|
|
2399
|
+
n = "Invalid terminal response.";
|
|
2400
|
+
}
|
|
2401
|
+
n && (i(e.id, e.generation, "disconnected", n), t.close());
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
let c = () => {
|
|
2405
|
+
o || (o = !0, pt());
|
|
2406
|
+
};
|
|
2407
|
+
return t.onerror = () => {
|
|
2408
|
+
c(), n ||= "Terminal connection failed. Check the server and retry.", i(e.id, e.generation, "disconnected", n), t.close();
|
|
2409
|
+
}, t.onclose = () => {
|
|
2410
|
+
c(), i(e.id, e.generation, "disconnected", n || (s ? "Terminal connection closed." : "Terminal connection closed. Reconnect to attach again."));
|
|
2411
|
+
}, () => {
|
|
2412
|
+
t.onopen = t.onmessage = t.onerror = t.onclose = null, t.close(), u.current === t && (u.current = null);
|
|
2413
|
+
};
|
|
2414
|
+
}, [
|
|
2415
|
+
e.id,
|
|
2416
|
+
e.generation,
|
|
2417
|
+
e.scope,
|
|
2418
|
+
e.container,
|
|
2419
|
+
i,
|
|
2420
|
+
s?.path
|
|
2421
|
+
]), O(() => {
|
|
2422
|
+
if (!t) {
|
|
2423
|
+
l.current?.blur();
|
|
2424
|
+
return;
|
|
2425
|
+
}
|
|
2426
|
+
let e = requestAnimationFrame(() => {
|
|
2427
|
+
d.current(!0), document.activeElement?.closest("[role=\"tablist\"]") || l.current?.focus();
|
|
2428
|
+
});
|
|
2429
|
+
return () => cancelAnimationFrame(e);
|
|
2430
|
+
}, [t]);
|
|
2431
|
+
let y = j(null);
|
|
2432
|
+
return O(() => {
|
|
2433
|
+
if (!a || !t || e.state !== "attached" || u.current?.readyState !== WebSocket.OPEN) return;
|
|
2434
|
+
y.current?.nonce !== a.nonce && (y.current = {
|
|
2435
|
+
nonce: a.nonce,
|
|
2436
|
+
at: Date.now()
|
|
2437
|
+
});
|
|
2438
|
+
let { received: n, parsed: r } = g.current, i = n > 0 && r === n, s = Math.max(0, y.current.at + On - Date.now()), c = setTimeout(() => {
|
|
2439
|
+
l.current?.paste(a.text), l.current?.focus(), o?.(e.id, a.nonce);
|
|
2440
|
+
}, i ? Math.min(Dn, s) : s);
|
|
2441
|
+
return () => clearTimeout(c);
|
|
2442
|
+
}, [
|
|
2443
|
+
a,
|
|
2444
|
+
t,
|
|
2445
|
+
e.state,
|
|
2446
|
+
e.id,
|
|
2447
|
+
o,
|
|
2448
|
+
_
|
|
2449
|
+
]), O(() => {
|
|
2450
|
+
if (!t || !n) return;
|
|
2451
|
+
let e = requestAnimationFrame(() => {
|
|
2452
|
+
d.current(), l.current?.focus();
|
|
2453
|
+
});
|
|
2454
|
+
return () => cancelAnimationFrame(e);
|
|
2455
|
+
}, [t, n]), /* @__PURE__ */ I("div", {
|
|
2456
|
+
className: "terminal-session",
|
|
2457
|
+
hidden: !t,
|
|
2458
|
+
"aria-hidden": !t,
|
|
2459
|
+
children: /* @__PURE__ */ I("div", {
|
|
2460
|
+
className: "terminal-screen",
|
|
2461
|
+
"aria-label": s?.label ?? `Terminal for ${e.scope.join(" / ")} / ${e.container}`,
|
|
2462
|
+
children: /* @__PURE__ */ I("div", {
|
|
2463
|
+
ref: c,
|
|
2464
|
+
className: "terminal-mount"
|
|
2465
|
+
})
|
|
2466
|
+
})
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
function zn({ scope: e, revision: t, inventory: n, manager: r, theme: a, autoAttach: o = !0, visible: c = !0, controlsHost: l, onExpandedChange: u, inPanel: d = !1, onOpenInPanel: p, operation: m, onLifecycleAction: h }) {
|
|
2470
|
+
let [g, _] = M(!1), [v, y] = M(""), [b, x] = M(""), [S, C] = M(""), w = j(null), T = j(null);
|
|
2471
|
+
O(() => {
|
|
2472
|
+
e || (_(!1), u(!1));
|
|
2473
|
+
}, [e, u]), O(() => {
|
|
2474
|
+
!c && g && (_(!1), u(!1));
|
|
2475
|
+
}, [
|
|
2476
|
+
c,
|
|
2477
|
+
g,
|
|
2478
|
+
u
|
|
2479
|
+
]), O(() => {
|
|
2480
|
+
if (!g) return;
|
|
2481
|
+
let e = (e) => {
|
|
2482
|
+
e.key !== "Escape" || T.current?.contains(e.target) || e.target?.closest?.("details[open]") || (e.preventDefault(), e.stopPropagation(), _(!1), u(!1), requestAnimationFrame(() => w.current?.focus()));
|
|
2483
|
+
};
|
|
2484
|
+
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
2485
|
+
}, [g]);
|
|
2486
|
+
let E = e?.length === 4 ? `${f(e)}/containers` : null, D = i(E, t), ee = D.data?.filter((e) => !e.root) ?? [], k = ee.filter((e) => e.attachable), A = ee.filter((e) => !e.attachable), N = e ? $(e) : "", P = r.sessions.filter((e) => e.view === "main"), te = P.filter((e) => $(e.scope) === N), F = [
|
|
2487
|
+
...k.map((e) => e.id),
|
|
2488
|
+
...A.map((e) => e.id),
|
|
2489
|
+
...te.map((e) => e.container).filter((e) => !ee.some((t) => t.id === e))
|
|
2490
|
+
], R = F.includes(r.selection[N]) ? r.selection[N] : F[0] ?? "", B = e && R ? Mn(e, R) : "", V = P.find((e) => e.id === B), H = k.some((e) => e.id === R), re = r.sessions.filter((e) => e.state === "attached" || e.state === "connecting").length, U = n.data?.rows[3].find((e) => $(e.scope) === N)?.doc.status?.state, W = U && Nn.has(U), G = ee.some((e) => e.id === R), K = (e && G && (!H || W) ? "logs" : "terminal") == "logs", q = !!B && b === B && G && !W, J = !q && !!B && S === B && H, ae = q || J, Y = !V && (re >= En || r.sessions.length >= kn), X = (V?.state === "disconnected" || V?.state === "interrupted") && re >= En;
|
|
2491
|
+
O(() => {
|
|
2492
|
+
y("");
|
|
2493
|
+
}, [N]);
|
|
2494
|
+
let oe = o && c && !!e && !K && !!n.data && !D.loading && !D.error && !!R && H && !W && m?.phase !== "pending" && v !== B;
|
|
2495
|
+
O(() => {
|
|
2496
|
+
!oe || Y || V || r.autoAttach(e, R, r.selection[N]);
|
|
2497
|
+
}, [
|
|
2498
|
+
oe,
|
|
2499
|
+
N,
|
|
2500
|
+
R,
|
|
2501
|
+
Y,
|
|
2502
|
+
V,
|
|
2503
|
+
r.autoAttach
|
|
2504
|
+
]);
|
|
2505
|
+
let Z = Ln(V, oe && !X, (e) => r.attach(e.scope, e.container)), se = !!B && !V && (v === B || !o), ce = K ? "Logs" : V?.state === "attached" ? "Attached" : V?.message || (v === B && B ? "Detached" : Y ? "Connection limit reached" : W ? `Unavailable: ${U}` : D.loading ? "Loading containers…" : D.error ? "Container list unavailable" : k.length ? H ? o ? "Connecting…" : "Detached" : "Container unavailable" : "No attachable containers"), Q = !!e && !D.loading && !D.error && !ee.length && !F.length, le = V?.state === "attached" || V?.state === "connecting", ue = "Terminal limit reached. Detach another terminal to free a connection or retained slot.", de = D.error && D.data ? "Container list is stale. Refresh before attaching." : "", fe = K ? W ? `Cell is ${U}. Showing the last output of ${R}.` : `Showing the output of ${R}.` : Y || X ? ue : W && !le ? `Terminal unavailable: cell is ${U}.` : D.error && !le ? `${ce}: ${D.error.message}` : de && !le ? de : V?.message || ce, pe = !e || Q || le || K || ae ? null : Y || X ? /* @__PURE__ */ I("p", {
|
|
2506
|
+
className: "terminal-limit",
|
|
2507
|
+
role: "status",
|
|
2508
|
+
children: ue
|
|
2509
|
+
}) : W ? /* @__PURE__ */ L("p", {
|
|
2510
|
+
className: "terminal-unavailable",
|
|
2511
|
+
role: "status",
|
|
2512
|
+
children: [
|
|
2513
|
+
"Terminal unavailable: cell is ",
|
|
2514
|
+
U,
|
|
2515
|
+
"."
|
|
2516
|
+
]
|
|
2517
|
+
}) : D.error ? /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I(s, {
|
|
2518
|
+
error: D.error,
|
|
2519
|
+
kind: "Containers"
|
|
2520
|
+
}), de && /* @__PURE__ */ I("p", {
|
|
2521
|
+
className: "stale",
|
|
2522
|
+
children: de
|
|
2523
|
+
})] }) : D.loading && !D.data ? /* @__PURE__ */ I("p", {
|
|
2524
|
+
role: "status",
|
|
2525
|
+
children: "Loading containers…"
|
|
2526
|
+
}) : null, me = K ? "logs" : V?.state ?? (v === B && B || Y || W || D.error || !k.length || !H || !o ? "disconnected" : "connecting"), he = () => {
|
|
2527
|
+
let e = !g;
|
|
2528
|
+
_(e), u(e);
|
|
2529
|
+
}, ge = () => {
|
|
2530
|
+
y(""), Z(B), r.attach(e, R);
|
|
2531
|
+
}, _e = (e, t, n) => /* @__PURE__ */ I("button", {
|
|
2532
|
+
type: "button",
|
|
2533
|
+
className: "icon-button",
|
|
2534
|
+
"aria-label": e,
|
|
2535
|
+
"data-tooltip": e,
|
|
2536
|
+
disabled: t,
|
|
2537
|
+
onClick: n,
|
|
2538
|
+
children: /* @__PURE__ */ I(z, { name: e === "Attach" ? "attach" : e === "Detach" ? "detach" : "reconnect" })
|
|
2539
|
+
}), ve = V?.state === "attached" || V?.state === "connecting" ? _e("Detach", !1, () => {
|
|
2540
|
+
y(V.id), r.detach(V.id);
|
|
2541
|
+
}) : V ? /* @__PURE__ */ L(ne, { children: [_e("Reconnect", X || !H || !!W || !!D.error, ge), _e("Detach", !1, () => {
|
|
2542
|
+
y(V.id), r.detach(V.id);
|
|
2543
|
+
})] }) : se ? _e("Attach", !!Y || !H || !!W || !!D.error, ge) : null, ye = (e) => k.some((t) => t.id === e) ? e : A.some((t) => t.id === e) ? `${e} (logs)` : `${e} (unavailable)`, be = e && /* @__PURE__ */ L("div", {
|
|
2544
|
+
className: "terminal-workspace-tools",
|
|
2545
|
+
children: [!Q && /* @__PURE__ */ L("span", {
|
|
2546
|
+
className: `terminal-connection-state ${me}`,
|
|
2547
|
+
role: "status",
|
|
2548
|
+
tabIndex: 0,
|
|
2549
|
+
title: fe,
|
|
2550
|
+
"data-tooltip": fe,
|
|
2551
|
+
children: [/* @__PURE__ */ I("span", {
|
|
2552
|
+
className: "state-dot",
|
|
2553
|
+
"aria-hidden": "true"
|
|
2554
|
+
}), /* @__PURE__ */ I("span", {
|
|
2555
|
+
className: "sr-only",
|
|
2556
|
+
children: ce
|
|
2557
|
+
})]
|
|
2558
|
+
}), /* @__PURE__ */ L("div", {
|
|
2559
|
+
className: "terminal-controls",
|
|
2560
|
+
children: [
|
|
2561
|
+
!!F.length && /* @__PURE__ */ L(ne, { children: [
|
|
2562
|
+
/* @__PURE__ */ I("label", {
|
|
2563
|
+
htmlFor: "terminal-container",
|
|
2564
|
+
className: "sr-only",
|
|
2565
|
+
children: "Container"
|
|
2566
|
+
}),
|
|
2567
|
+
/* @__PURE__ */ I("select", {
|
|
2568
|
+
id: "terminal-container",
|
|
2569
|
+
className: "mono-id",
|
|
2570
|
+
value: R,
|
|
2571
|
+
onChange: (t) => r.select(e, t.target.value),
|
|
2572
|
+
children: F.map((e) => /* @__PURE__ */ I("option", {
|
|
2573
|
+
value: e,
|
|
2574
|
+
children: ye(e)
|
|
2575
|
+
}, e))
|
|
2576
|
+
}),
|
|
2577
|
+
!K && ve,
|
|
2578
|
+
H && /* @__PURE__ */ I(on, {
|
|
2579
|
+
container: R,
|
|
2580
|
+
open: J,
|
|
2581
|
+
onToggle: () => {
|
|
2582
|
+
x(""), C(J ? "" : B);
|
|
2583
|
+
}
|
|
2584
|
+
}),
|
|
2585
|
+
G && /* @__PURE__ */ I(Ct, {
|
|
2586
|
+
container: R,
|
|
2587
|
+
open: q,
|
|
2588
|
+
reason: W ? `Exec unavailable: cell is ${U}.` : "",
|
|
2589
|
+
onToggle: () => {
|
|
2590
|
+
C(""), x(q ? "" : B);
|
|
2591
|
+
}
|
|
2592
|
+
})
|
|
2593
|
+
] }),
|
|
2594
|
+
!d && p && /* @__PURE__ */ I("button", {
|
|
2595
|
+
type: "button",
|
|
2596
|
+
className: "icon-button",
|
|
2597
|
+
"aria-label": "Open in side panel",
|
|
2598
|
+
"data-tooltip": "Open in side panel",
|
|
2599
|
+
onClick: () => p(e),
|
|
2600
|
+
children: /* @__PURE__ */ I(z, { name: "sidePanel" })
|
|
2601
|
+
}),
|
|
2602
|
+
!Q && /* @__PURE__ */ I("button", {
|
|
2603
|
+
ref: w,
|
|
2604
|
+
type: "button",
|
|
2605
|
+
className: "icon-button",
|
|
2606
|
+
"aria-label": g ? "Collapse terminal" : "Expand terminal",
|
|
2607
|
+
"data-tooltip": g ? "Collapse terminal" : "Expand terminal",
|
|
2608
|
+
"aria-expanded": g,
|
|
2609
|
+
"aria-controls": "terminal-screens",
|
|
2610
|
+
onClick: he,
|
|
2611
|
+
children: /* @__PURE__ */ I(z, { name: g ? "collapse" : "expand" })
|
|
2612
|
+
})
|
|
2613
|
+
]
|
|
2614
|
+
})]
|
|
2615
|
+
});
|
|
2616
|
+
return /* @__PURE__ */ L(ne, { children: [be && l && ie(be, l), /* @__PURE__ */ L("section", {
|
|
2617
|
+
className: `panel terminal-workspace${g ? " is-expanded" : ""}${Q ? " is-empty" : ""}`,
|
|
2618
|
+
id: "cell-terminal",
|
|
2619
|
+
hidden: !e,
|
|
2620
|
+
"aria-label": "Terminal workspace",
|
|
2621
|
+
children: [
|
|
2622
|
+
Q && /* @__PURE__ */ I("p", {
|
|
2623
|
+
className: "empty-state terminal-empty",
|
|
2624
|
+
role: "status",
|
|
2625
|
+
children: "No containers are available."
|
|
2626
|
+
}),
|
|
2627
|
+
pe && /* @__PURE__ */ I("div", {
|
|
2628
|
+
className: "terminal-overlay",
|
|
2629
|
+
children: pe
|
|
2630
|
+
}),
|
|
2631
|
+
K && W && /* @__PURE__ */ L("div", {
|
|
2632
|
+
className: "terminal-log-status",
|
|
2633
|
+
role: "status",
|
|
2634
|
+
children: [/* @__PURE__ */ L("span", { children: [
|
|
2635
|
+
"Cell is ",
|
|
2636
|
+
U,
|
|
2637
|
+
". Showing the last output of ",
|
|
2638
|
+
/* @__PURE__ */ I("code", { children: R }),
|
|
2639
|
+
"."
|
|
2640
|
+
] }), un(U).includes("start") && /* @__PURE__ */ I("button", {
|
|
2641
|
+
type: "button",
|
|
2642
|
+
disabled: m?.phase === "pending",
|
|
2643
|
+
onClick: () => h?.(e, "start", U),
|
|
2644
|
+
children: "Start"
|
|
2645
|
+
})]
|
|
2646
|
+
}),
|
|
2647
|
+
/* @__PURE__ */ L("div", {
|
|
2648
|
+
className: "terminal-screens",
|
|
2649
|
+
id: "terminal-screens",
|
|
2650
|
+
ref: T,
|
|
2651
|
+
children: [
|
|
2652
|
+
P.map((t) => /* @__PURE__ */ I(Rn, {
|
|
2653
|
+
session: t,
|
|
2654
|
+
active: !!e && c && !K && !ae && t.id === B,
|
|
2655
|
+
expanded: g,
|
|
2656
|
+
theme: a,
|
|
2657
|
+
update: r.update,
|
|
2658
|
+
pending: r.pastes[t.id],
|
|
2659
|
+
onPasted: r.pasteDelivered
|
|
2660
|
+
}, t.id)),
|
|
2661
|
+
c && K && !ae && /* @__PURE__ */ I(xt, {
|
|
2662
|
+
scope: e,
|
|
2663
|
+
container: R,
|
|
2664
|
+
attachable: H,
|
|
2665
|
+
live: !W,
|
|
2666
|
+
cellState: U,
|
|
2667
|
+
revision: t,
|
|
2668
|
+
theme: a,
|
|
2669
|
+
expanded: g
|
|
2670
|
+
}, Mn(e, R)),
|
|
2671
|
+
q && /* @__PURE__ */ I(Tt, {
|
|
2672
|
+
scope: e,
|
|
2673
|
+
container: R,
|
|
2674
|
+
theme: a,
|
|
2675
|
+
visible: c,
|
|
2676
|
+
expanded: g,
|
|
2677
|
+
onClose: () => x("")
|
|
2678
|
+
}, B),
|
|
2679
|
+
J && c && /* @__PURE__ */ I(ln, {
|
|
2680
|
+
scope: e,
|
|
2681
|
+
container: R,
|
|
2682
|
+
live: !W,
|
|
2683
|
+
theme: a,
|
|
2684
|
+
expanded: g,
|
|
2685
|
+
onClose: () => C("")
|
|
2686
|
+
}, B)
|
|
2687
|
+
]
|
|
2688
|
+
})
|
|
2689
|
+
]
|
|
2690
|
+
})] });
|
|
2691
|
+
}
|
|
2692
|
+
// src/settings-values.mjs
|
|
2693
|
+
function Bn(e, t) {
|
|
2694
|
+
let n = typeof e == "string" ? e.trim() : "";
|
|
2695
|
+
if (!/^\d+$/.test(n)) return;
|
|
2696
|
+
let r = Number(n);
|
|
2697
|
+
return t.includes(r) ? r : void 0;
|
|
2698
|
+
}
|
|
2699
|
+
var Vn = [
|
|
2700
|
+
5,
|
|
2701
|
+
10,
|
|
2702
|
+
30,
|
|
2703
|
+
60
|
|
2704
|
+
];
|
|
2705
|
+
function Hn(e) {
|
|
2706
|
+
return Bn(e, Vn);
|
|
2707
|
+
}
|
|
2708
|
+
var Un = [
|
|
2709
|
+
1,
|
|
2710
|
+
2,
|
|
2711
|
+
5,
|
|
2712
|
+
10,
|
|
2713
|
+
30
|
|
2714
|
+
];
|
|
2715
|
+
function Wn(e) {
|
|
2716
|
+
return Bn(e, Un);
|
|
2717
|
+
}
|
|
2718
|
+
var Gn = [
|
|
2719
|
+
2,
|
|
2720
|
+
5,
|
|
2721
|
+
10,
|
|
2722
|
+
30
|
|
2723
|
+
];
|
|
2724
|
+
function Kn(e) {
|
|
2725
|
+
return Bn(e, Gn);
|
|
2726
|
+
}
|
|
2727
|
+
var qn = [
|
|
2728
|
+
0,
|
|
2729
|
+
1,
|
|
2730
|
+
3,
|
|
2731
|
+
5,
|
|
2732
|
+
10
|
|
2733
|
+
];
|
|
2734
|
+
function Jn(e) {
|
|
2735
|
+
return Bn(e, qn);
|
|
2736
|
+
}
|
|
2737
|
+
function Yn(e) {
|
|
2738
|
+
if (e === "true" || e === "auto" || e === "shown") return !0;
|
|
2739
|
+
if (e === "false" || e === "hidden") return !1;
|
|
2740
|
+
}
|
|
2741
|
+
function Xn(e) {
|
|
2742
|
+
return e === "true" || e !== "false" && void 0;
|
|
2743
|
+
}
|
|
2744
|
+
// src/settings.ts
|
|
2745
|
+
var Zn = [
|
|
2746
|
+
"system",
|
|
2747
|
+
"light",
|
|
2748
|
+
"dark"
|
|
2749
|
+
], Qn = {
|
|
2750
|
+
system: "System",
|
|
2751
|
+
light: "Light",
|
|
2752
|
+
dark: "Dark"
|
|
2753
|
+
}, $n = ["agent", "default"], er = {
|
|
2754
|
+
agent: "Agent",
|
|
2755
|
+
default: "Default"
|
|
2756
|
+
}, tr = "Applies to the Default cell list style.", nr = (e, t, n, r) => ({
|
|
2757
|
+
key: e,
|
|
2758
|
+
label: t,
|
|
2759
|
+
defaultValue: n,
|
|
2760
|
+
note: r,
|
|
2761
|
+
parse: Xn,
|
|
2762
|
+
format: (e) => String(e)
|
|
2763
|
+
}), rr = {
|
|
2764
|
+
theme: {
|
|
2765
|
+
key: "kukeon-theme",
|
|
2766
|
+
label: "Appearance",
|
|
2767
|
+
defaultValue: "system",
|
|
2768
|
+
parse: (e) => Zn.includes(e) ? e : void 0,
|
|
2769
|
+
format: (e) => e
|
|
2770
|
+
},
|
|
2771
|
+
cellListStyle: {
|
|
2772
|
+
key: "kukeon-cell-list-style",
|
|
2773
|
+
label: "Cell list style",
|
|
2774
|
+
defaultValue: "agent",
|
|
2775
|
+
parse: (e) => $n.includes(e) ? e : void 0,
|
|
2776
|
+
format: (e) => e
|
|
2777
|
+
},
|
|
2778
|
+
defaultGroupBy: {
|
|
2779
|
+
key: "kukeon-default-group-by",
|
|
2780
|
+
label: "Default Group by",
|
|
2781
|
+
defaultValue: C,
|
|
2782
|
+
note: tr,
|
|
2783
|
+
parse: (e) => e,
|
|
2784
|
+
format: (e) => e
|
|
2785
|
+
},
|
|
2786
|
+
showCellScope: nr("kukeon-sidebar-show-scope", "Show cell scope in sidebar", !0),
|
|
2787
|
+
showTerminalStatus: nr("kukeon-sidebar-show-terminal-status", "Show terminal status in sidebar", !0),
|
|
2788
|
+
showUnreadBytes: nr("kukeon-show-unread-bytes", "Show unread bytes", !1),
|
|
2789
|
+
showSidebarSearch: nr("kukeon-sidebar-show-search", "Show search in sidebar", !1),
|
|
2790
|
+
showSidebarGroupBy: nr("kukeon-sidebar-show-group-by", "Show Group by in sidebar", !1, tr),
|
|
2791
|
+
showGridSearch: nr("kukeon-grid-show-search", "Show search in grid", !0),
|
|
2792
|
+
showGridGroupBy: nr("kukeon-grid-show-group-by", "Show Group by in grid", !0, tr),
|
|
2793
|
+
autoAttach: nr("kukeon-terminal-auto-attach", "Auto-attach terminals", !0),
|
|
2794
|
+
refreshSeconds: {
|
|
2795
|
+
key: "kukeon-refresh-seconds",
|
|
2796
|
+
label: "Refresh interval",
|
|
2797
|
+
defaultValue: 10,
|
|
2798
|
+
note: "How often the inventory is read while this tab is visible.",
|
|
2799
|
+
parse: Hn,
|
|
2800
|
+
format: (e) => String(e)
|
|
2801
|
+
},
|
|
2802
|
+
unreadPollSeconds: {
|
|
2803
|
+
key: "kukeon-unread-poll-seconds",
|
|
2804
|
+
label: "Unread check interval",
|
|
2805
|
+
defaultValue: 2,
|
|
2806
|
+
note: "How often terminal output is checked for the unread marks in the sidebar, the collapsed rail and the grid tile badges.",
|
|
2807
|
+
parse: Wn,
|
|
2808
|
+
format: (e) => String(e)
|
|
2809
|
+
},
|
|
2810
|
+
gridScreenSeconds: {
|
|
2811
|
+
key: "kukeon-grid-screen-seconds",
|
|
2812
|
+
label: "Thumbnail refresh interval",
|
|
2813
|
+
defaultValue: 5,
|
|
2814
|
+
note: "How often the Workbench grid tiles' terminal thumbnails are read.",
|
|
2815
|
+
parse: Kn,
|
|
2816
|
+
format: (e) => String(e)
|
|
2817
|
+
},
|
|
2818
|
+
unreadQuietSeconds: {
|
|
2819
|
+
key: "kukeon-unread-quiet-seconds",
|
|
2820
|
+
label: "Mark unread after quiet for",
|
|
2821
|
+
defaultValue: 0,
|
|
2822
|
+
note: "How long a terminal must be quiet before its new output marks the cell. Off marks it on the first new byte.",
|
|
2823
|
+
parse: Jn,
|
|
2824
|
+
format: (e) => String(e)
|
|
2825
|
+
},
|
|
2826
|
+
showGetStarted: {
|
|
2827
|
+
key: "kukeon-get-started",
|
|
2828
|
+
label: "Show Get started",
|
|
2829
|
+
defaultValue: !0,
|
|
2830
|
+
parse: Yn,
|
|
2831
|
+
format: (e) => String(e)
|
|
2832
|
+
}
|
|
2833
|
+
}, ir = [
|
|
2834
|
+
{
|
|
2835
|
+
title: "Appearance",
|
|
2836
|
+
settings: ["theme"]
|
|
2837
|
+
},
|
|
2838
|
+
{
|
|
2839
|
+
title: "Terminal",
|
|
2840
|
+
settings: ["autoAttach"]
|
|
2841
|
+
},
|
|
2842
|
+
{
|
|
2843
|
+
title: "Refresh",
|
|
2844
|
+
settings: [
|
|
2845
|
+
"refreshSeconds",
|
|
2846
|
+
"unreadPollSeconds",
|
|
2847
|
+
"gridScreenSeconds",
|
|
2848
|
+
"unreadQuietSeconds"
|
|
2849
|
+
]
|
|
2850
|
+
},
|
|
2851
|
+
{
|
|
2852
|
+
title: "Workbench",
|
|
2853
|
+
settings: ["showGetStarted"]
|
|
2854
|
+
},
|
|
2855
|
+
{
|
|
2856
|
+
title: "Cell list",
|
|
2857
|
+
settings: ["cellListStyle", "defaultGroupBy"]
|
|
2858
|
+
},
|
|
2859
|
+
{
|
|
2860
|
+
title: "Sidebar",
|
|
2861
|
+
settings: [
|
|
2862
|
+
"showCellScope",
|
|
2863
|
+
"showTerminalStatus",
|
|
2864
|
+
"showUnreadBytes",
|
|
2865
|
+
"showSidebarSearch",
|
|
2866
|
+
"showSidebarGroupBy"
|
|
2867
|
+
]
|
|
2868
|
+
},
|
|
2869
|
+
{
|
|
2870
|
+
title: "Workbench grid",
|
|
2871
|
+
settings: ["showGridSearch", "showGridGroupBy"]
|
|
2872
|
+
}
|
|
2873
|
+
];
|
|
2874
|
+
function ar(e) {
|
|
2875
|
+
let t = rr[e];
|
|
2876
|
+
try {
|
|
2877
|
+
let e = localStorage.getItem(t.key);
|
|
2878
|
+
return e === null ? t.defaultValue : t.parse(e) ?? t.defaultValue;
|
|
2879
|
+
} catch {
|
|
2880
|
+
return t.defaultValue;
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
function or() {
|
|
2884
|
+
return Object.fromEntries(Object.keys(rr).map((e) => [e, ar(e)]));
|
|
2885
|
+
}
|
|
2886
|
+
var sr = or(), cr = /* @__PURE__ */ new Set();
|
|
2887
|
+
function lr(e) {
|
|
2888
|
+
return cr.add(e), () => {
|
|
2889
|
+
cr.delete(e);
|
|
2890
|
+
};
|
|
2891
|
+
}
|
|
2892
|
+
function ur(e, t) {
|
|
2893
|
+
let n = rr[e];
|
|
2894
|
+
try {
|
|
2895
|
+
localStorage.setItem(n.key, n.format(t));
|
|
2896
|
+
} catch {}
|
|
2897
|
+
sr = {
|
|
2898
|
+
...sr,
|
|
2899
|
+
[e]: t
|
|
2900
|
+
};
|
|
2901
|
+
for (let e of cr) e();
|
|
2902
|
+
}
|
|
2903
|
+
function dr() {
|
|
2904
|
+
return [N(lr, () => sr), D((e, t) => ur(e, t), [])];
|
|
2905
|
+
}
|
|
2906
|
+
// src/panel-cells.mjs
|
|
2907
|
+
var fr = "kukeon-panel-cells", pr = (e) => Array.isArray(e) ? [...new Set(e.filter((e) => typeof e == "string" && e))] : [];
|
|
2908
|
+
function mr(e) {
|
|
2909
|
+
if (typeof e != "string") return {
|
|
2910
|
+
added: [],
|
|
2911
|
+
removed: []
|
|
2912
|
+
};
|
|
2913
|
+
let t;
|
|
2914
|
+
try {
|
|
2915
|
+
t = JSON.parse(e);
|
|
2916
|
+
} catch {
|
|
2917
|
+
return {
|
|
2918
|
+
added: [],
|
|
2919
|
+
removed: []
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
return !t || typeof t != "object" || Array.isArray(t) ? {
|
|
2923
|
+
added: [],
|
|
2924
|
+
removed: []
|
|
2925
|
+
} : {
|
|
2926
|
+
added: pr(t.added),
|
|
2927
|
+
removed: pr(t.removed)
|
|
2928
|
+
};
|
|
2929
|
+
}
|
|
2930
|
+
function hr(e, t, n) {
|
|
2931
|
+
let r = new Set(n.removed), i = new Set(e), a = new Set(t);
|
|
2932
|
+
return [...e.filter((e) => !r.has(e)), ...n.added.filter((e) => a.has(e) && !i.has(e))];
|
|
2933
|
+
}
|
|
2934
|
+
function gr(e, t, n) {
|
|
2935
|
+
let r = e.removed.filter((e) => e !== t);
|
|
2936
|
+
return n ? {
|
|
2937
|
+
added: e.added.filter((e) => e !== t),
|
|
2938
|
+
removed: r
|
|
2939
|
+
} : {
|
|
2940
|
+
added: e.added.includes(t) ? e.added : [...e.added, t],
|
|
2941
|
+
removed: r
|
|
2942
|
+
};
|
|
2943
|
+
}
|
|
2944
|
+
function _r(e, t, n) {
|
|
2945
|
+
let r = e.added.filter((e) => e !== t);
|
|
2946
|
+
return n ? {
|
|
2947
|
+
added: r,
|
|
2948
|
+
removed: e.removed.includes(t) ? e.removed : [...e.removed, t]
|
|
2949
|
+
} : {
|
|
2950
|
+
added: r,
|
|
2951
|
+
removed: e.removed.filter((e) => e !== t)
|
|
2952
|
+
};
|
|
2953
|
+
}
|
|
2954
|
+
function vr(e, t) {
|
|
2955
|
+
let n = new Set(t);
|
|
2956
|
+
return {
|
|
2957
|
+
added: e.added.filter((e) => n.has(e)),
|
|
2958
|
+
removed: e.removed.filter((e) => n.has(e))
|
|
2959
|
+
};
|
|
2960
|
+
}
|
|
2961
|
+
function yr(e, t) {
|
|
2962
|
+
return e.added.length === t.added.length && e.removed.length === t.removed.length && e.added.every((e, n) => e === t.added[n]) && e.removed.every((e, n) => e === t.removed[n]);
|
|
2963
|
+
}
|
|
2964
|
+
// src/majordomo.tsx
|
|
2965
|
+
var br = "kukeon.io/team", xr = "kukeon.io/role", Sr = "kukeon.io/task", Cr = "kukeon.io/harness", wr = "kuke", Tr = "majordomo", Er = Tr, Dr = "health-sweep", Or = "majordomo", kr = "kukeon-majordomo-active";
|
|
2966
|
+
function Ar(e) {
|
|
2967
|
+
return e?.[br] === wr && e?.[xr] === Er;
|
|
2968
|
+
}
|
|
2969
|
+
function jr(e) {
|
|
2970
|
+
return Ar(e.metadata.labels) && !e.metadata.labels?.[Sr];
|
|
2971
|
+
}
|
|
2972
|
+
function Mr(e) {
|
|
2973
|
+
return Ar(e.metadata.labels) && e.metadata.labels?.[Sr] === "health-sweep";
|
|
2974
|
+
}
|
|
2975
|
+
function Nr(e) {
|
|
2976
|
+
return Ar(e.metadata.labels) && !e.metadata.labels?.[Sr];
|
|
2977
|
+
}
|
|
2978
|
+
function Pr(e) {
|
|
2979
|
+
return [
|
|
2980
|
+
e.metadata.realm || "default",
|
|
2981
|
+
e.metadata.space || "default",
|
|
2982
|
+
e.metadata.stack || "default"
|
|
2983
|
+
];
|
|
2984
|
+
}
|
|
2985
|
+
function Fr(e) {
|
|
2986
|
+
return {
|
|
2987
|
+
name: e.metadata.name,
|
|
2988
|
+
realm: e.metadata.realm,
|
|
2989
|
+
space: e.metadata.space,
|
|
2990
|
+
stack: e.metadata.stack
|
|
2991
|
+
};
|
|
2992
|
+
}
|
|
2993
|
+
function Ir(e, t) {
|
|
2994
|
+
let n = v(e.doc);
|
|
2995
|
+
return n ? _(Fr(t), n) : e.doc.metadata.labels?.["kukeon.io/config"] === t.metadata.name && e.scope[0] === Pr(t)[0];
|
|
2996
|
+
}
|
|
2997
|
+
function Lr(e, t) {
|
|
2998
|
+
return t.find((t) => Ir(e, t));
|
|
2999
|
+
}
|
|
3000
|
+
function Rr(e) {
|
|
3001
|
+
let t = Date.parse(e.doc.status?.createdAt ?? "");
|
|
3002
|
+
return Number.isFinite(t) && !(e.doc.status?.createdAt ?? "").startsWith("0001-") ? t : 2 ** 53 - 1;
|
|
3003
|
+
}
|
|
3004
|
+
var zr = (e) => e.find((e) => e.doc.status?.state === "Ready") ?? e[0];
|
|
3005
|
+
function Br(e, t) {
|
|
3006
|
+
let n = i("/catalog/configs", t), [r, a] = M(() => Qr(kr) ?? ""), o = A(() => (e) => {
|
|
3007
|
+
a(e), $r(kr, e);
|
|
3008
|
+
}, []), [s, c] = M(() => mr(Qr(fr))), l = D((e) => c((t) => {
|
|
3009
|
+
let n = e(t);
|
|
3010
|
+
return yr(n, t) ? t : n;
|
|
3011
|
+
}), []);
|
|
3012
|
+
O(() => {
|
|
3013
|
+
$r(fr, JSON.stringify(s));
|
|
3014
|
+
}, [s]);
|
|
3015
|
+
let u = A(() => {
|
|
3016
|
+
let t = n.data ?? [], i = e.data?.rows[3] ?? [], a = i.filter((e) => Nr(e.doc)).sort((e, t) => Rr(e) - Rr(t) || e.scope.join("/").localeCompare(t.scope.join("/"))), c = new Map(i.map((e) => [$(e.scope), e])), u = a.map((e) => $(e.scope)), d = hr(u, c.keys(), s), f = d.map((e) => c.get(e)), p = f.find((e) => $(e.scope) === r) ?? zr(f), m = p && Nr(p.doc) ? p : zr(f.filter((e) => Nr(e.doc))) ?? zr(a), h = i.filter((e) => !d.includes($(e.scope))).sort((e, t) => e.scope.join("/").localeCompare(t.scope.join("/"))), g = t.filter(jr), _ = g.filter((e) => !a.some((t) => Ir(t, e)));
|
|
3017
|
+
return {
|
|
3018
|
+
configs: n,
|
|
3019
|
+
pairs: g,
|
|
3020
|
+
sweeps: t.filter(Mr),
|
|
3021
|
+
cells: a,
|
|
3022
|
+
cell: m,
|
|
3023
|
+
panel: f,
|
|
3024
|
+
active: p,
|
|
3025
|
+
candidates: h,
|
|
3026
|
+
unused: _,
|
|
3027
|
+
select: o,
|
|
3028
|
+
add: (e) => {
|
|
3029
|
+
l((t) => gr(t, e, u.includes(e))), o(e);
|
|
3030
|
+
},
|
|
3031
|
+
remove: (e) => l((t) => _r(t, e, u.includes(e)))
|
|
3032
|
+
};
|
|
3033
|
+
}, [
|
|
3034
|
+
n,
|
|
3035
|
+
e.data,
|
|
3036
|
+
r,
|
|
3037
|
+
o,
|
|
3038
|
+
s,
|
|
3039
|
+
l
|
|
3040
|
+
]), d = u.active ? $(u.active.scope) : "", f = !!e.data && !e.data.failures.length;
|
|
3041
|
+
O(() => {
|
|
3042
|
+
f && d && d !== r && !u.panel.some((e) => $(e.scope) === r) && o(d);
|
|
3043
|
+
}, [
|
|
3044
|
+
f,
|
|
3045
|
+
d,
|
|
3046
|
+
r,
|
|
3047
|
+
u.panel,
|
|
3048
|
+
o
|
|
3049
|
+
]);
|
|
3050
|
+
let p = f ? (e.data?.rows[3] ?? []).map((e) => $(e.scope)).join("\n") : null;
|
|
3051
|
+
return O(() => {
|
|
3052
|
+
p !== null && l((e) => vr(e, p ? p.split("\n") : []));
|
|
3053
|
+
}, [p, l]), u;
|
|
3054
|
+
}
|
|
3055
|
+
function Vr(e) {
|
|
3056
|
+
return e.replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
3057
|
+
}
|
|
3058
|
+
function Hr(e) {
|
|
3059
|
+
let t = [`state ${e?.state || "not reported"}`];
|
|
3060
|
+
return e?.reason && t.push(`reason: ${e.reason}`), e?.message && t.push(`message: ${e.message}`), e?.outOfSyncError ? t.push(`config comparison failed: ${e.outOfSyncError}`) : e?.outOfSync && t.push(`out of sync with its config: ${e.outOfSyncReason || "reason not reported"}`), t.join("; ");
|
|
3061
|
+
}
|
|
3062
|
+
function Ur(e, t) {
|
|
3063
|
+
return Vr(`About the cell ${e[3]} in realm ${e[0]}, space ${e[1]}, stack ${e[2]} (${Hr(t)}): what is going on with it, and what should I do?`);
|
|
3064
|
+
}
|
|
3065
|
+
function Wr(e, t, n) {
|
|
3066
|
+
let [r, i, a] = t.length === 4 ? t : [
|
|
3067
|
+
t[0],
|
|
3068
|
+
t[1],
|
|
3069
|
+
t[2]
|
|
3070
|
+
];
|
|
3071
|
+
return Vr(`About the ${e} ${t.at(-1)} in ${[
|
|
3072
|
+
`realm ${r}`,
|
|
3073
|
+
i && t.length > 2 ? `space ${i}` : "",
|
|
3074
|
+
a && t.length > 3 ? `stack ${a}` : ""
|
|
3075
|
+
].filter(Boolean).join(", ")} (${n}): explain what it is for and check whether anything is wrong with it.`);
|
|
3076
|
+
}
|
|
3077
|
+
var Gr = E(null), Kr = Gr.Provider;
|
|
3078
|
+
function qr({ question: e, subject: t, prominent: n = !1 }) {
|
|
3079
|
+
let r = ee(Gr);
|
|
3080
|
+
return r ? /* @__PURE__ */ L("button", {
|
|
3081
|
+
type: "button",
|
|
3082
|
+
className: `ask-majordomo${n ? " is-prominent" : ""}`,
|
|
3083
|
+
"aria-label": `Ask majordomo about ${t}`,
|
|
3084
|
+
title: "Opens the majordomo panel and pastes this question without sending it",
|
|
3085
|
+
onClick: () => r(e),
|
|
3086
|
+
children: [/* @__PURE__ */ I(z, { name: "majordomo" }), /* @__PURE__ */ I("span", { children: "Ask majordomo" })]
|
|
3087
|
+
}) : null;
|
|
3088
|
+
}
|
|
3089
|
+
var Jr = "kukeon-majordomo-open", Yr = "kukeon-majordomo-width", Xr = {
|
|
3090
|
+
min: 320,
|
|
3091
|
+
max: 960,
|
|
3092
|
+
initial: 480,
|
|
3093
|
+
step: 24
|
|
3094
|
+
};
|
|
3095
|
+
function Zr(e) {
|
|
3096
|
+
return Math.round(Math.min(Xr.max, Math.max(Xr.min, e)));
|
|
3097
|
+
}
|
|
3098
|
+
function Qr(e) {
|
|
3099
|
+
try {
|
|
3100
|
+
return localStorage.getItem(e);
|
|
3101
|
+
} catch {
|
|
3102
|
+
return null;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
function $r(e, t) {
|
|
3106
|
+
try {
|
|
3107
|
+
localStorage.setItem(e, t);
|
|
3108
|
+
} catch {}
|
|
3109
|
+
}
|
|
3110
|
+
function ei() {
|
|
3111
|
+
let [e, t] = M(() => window.innerWidth);
|
|
3112
|
+
return O(() => {
|
|
3113
|
+
let e = 0, n = () => {
|
|
3114
|
+
cancelAnimationFrame(e), e = requestAnimationFrame(() => t(window.innerWidth));
|
|
3115
|
+
};
|
|
3116
|
+
return window.addEventListener("resize", n), () => {
|
|
3117
|
+
cancelAnimationFrame(e), window.removeEventListener("resize", n);
|
|
3118
|
+
};
|
|
3119
|
+
}, []), e;
|
|
3120
|
+
}
|
|
3121
|
+
function ti(e, t) {
|
|
3122
|
+
let [n, r] = M(() => Qr(Jr) === "true"), [i, a] = M(() => {
|
|
3123
|
+
let e = Number(Qr(Yr));
|
|
3124
|
+
return Number.isFinite(e) && e > 0 ? Zr(e) : Xr.initial;
|
|
3125
|
+
}), [o, s] = M("");
|
|
3126
|
+
O(() => {
|
|
3127
|
+
$r(Jr, String(n));
|
|
3128
|
+
}, [n]), O(() => {
|
|
3129
|
+
$r(Yr, String(i));
|
|
3130
|
+
}, [i]);
|
|
3131
|
+
let c = e - t - 800, l = e <= 760 || c < Xr.min, u = Math.max(Xr.min, Math.min(Xr.max, l ? e : c));
|
|
3132
|
+
return {
|
|
3133
|
+
open: n,
|
|
3134
|
+
setOpen: r,
|
|
3135
|
+
width: i,
|
|
3136
|
+
effectiveWidth: Math.min(i, u),
|
|
3137
|
+
maxWidth: u,
|
|
3138
|
+
overlay: l,
|
|
3139
|
+
setWidth: (e) => a(Zr(e)),
|
|
3140
|
+
question: o,
|
|
3141
|
+
ask: (e) => {
|
|
3142
|
+
s(Vr(e)), r(!0);
|
|
3143
|
+
},
|
|
3144
|
+
clearQuestion: () => s("")
|
|
3145
|
+
};
|
|
3146
|
+
}
|
|
3147
|
+
function ni(e) {
|
|
3148
|
+
return e.cell ? {
|
|
3149
|
+
label: `${e.cell.doc.status?.state || "State not reported"}${e.cells.length > 1 ? `, ${e.cells.length} cells` : ""}`,
|
|
3150
|
+
state: e.cell.doc.status?.state
|
|
3151
|
+
} : e.configs.loading && !e.configs.data ? { label: "Checking…" } : e.configs.error && !e.configs.data ? { label: "Unavailable" } : { label: e.pairs.length ? "Not enabled" : "Not initialized" };
|
|
3152
|
+
}
|
|
3153
|
+
function ri(e) {
|
|
3154
|
+
return !e.cell && !!e.configs.data && !e.pairs.length;
|
|
3155
|
+
}
|
|
3156
|
+
function ii({ major: e, dock: t, onChanged: n }) {
|
|
3157
|
+
let { label: r, state: i } = ni(e);
|
|
3158
|
+
return /* @__PURE__ */ L("section", {
|
|
3159
|
+
className: "majordomo-entry",
|
|
3160
|
+
"aria-label": "Majordomo",
|
|
3161
|
+
children: [/* @__PURE__ */ L("button", {
|
|
3162
|
+
type: "button",
|
|
3163
|
+
className: "majordomo-entry-button",
|
|
3164
|
+
"aria-expanded": t.open,
|
|
3165
|
+
"aria-controls": "majordomo-panel",
|
|
3166
|
+
onClick: () => t.setOpen(!0),
|
|
3167
|
+
children: [
|
|
3168
|
+
/* @__PURE__ */ I(z, { name: "majordomo" }),
|
|
3169
|
+
/* @__PURE__ */ I("span", {
|
|
3170
|
+
className: "majordomo-entry-name",
|
|
3171
|
+
children: "Majordomo"
|
|
3172
|
+
}),
|
|
3173
|
+
i ? /* @__PURE__ */ I(H, { state: i }) : /* @__PURE__ */ I("span", {
|
|
3174
|
+
className: "badge",
|
|
3175
|
+
children: r
|
|
3176
|
+
}),
|
|
3177
|
+
e.cells.length > 1 && /* @__PURE__ */ I("span", {
|
|
3178
|
+
className: "badge majordomo-count",
|
|
3179
|
+
"aria-label": `${e.cells.length} majordomo cells`,
|
|
3180
|
+
title: `${e.cells.length} majordomo cells`,
|
|
3181
|
+
children: e.cells.length
|
|
3182
|
+
})
|
|
3183
|
+
]
|
|
3184
|
+
}), ri(e) && /* @__PURE__ */ I(T, {
|
|
3185
|
+
compact: !0,
|
|
3186
|
+
onChanged: n,
|
|
3187
|
+
subject: "majordomo and the agent templates"
|
|
3188
|
+
})]
|
|
3189
|
+
});
|
|
3190
|
+
}
|
|
3191
|
+
function ai({ major: e, dock: t }) {
|
|
3192
|
+
let n = `Majordomo (${ni(e).label})`;
|
|
3193
|
+
return /* @__PURE__ */ I("button", {
|
|
3194
|
+
type: "button",
|
|
3195
|
+
className: "icon-button rail-majordomo",
|
|
3196
|
+
"aria-label": n,
|
|
3197
|
+
title: n,
|
|
3198
|
+
"aria-expanded": t.open,
|
|
3199
|
+
"aria-controls": "majordomo-panel",
|
|
3200
|
+
onClick: () => t.setOpen(!0),
|
|
3201
|
+
children: /* @__PURE__ */ I(z, { name: "majordomo" })
|
|
3202
|
+
});
|
|
3203
|
+
}
|
|
3204
|
+
function oi({ dock: e }) {
|
|
3205
|
+
let t = e.open ? "Hide majordomo panel" : "Show majordomo panel";
|
|
3206
|
+
return /* @__PURE__ */ I("button", {
|
|
3207
|
+
type: "button",
|
|
3208
|
+
className: "icon-button majordomo-toolbar-button",
|
|
3209
|
+
"aria-label": t,
|
|
3210
|
+
title: t,
|
|
3211
|
+
"aria-pressed": e.open,
|
|
3212
|
+
"aria-controls": "majordomo-panel",
|
|
3213
|
+
onClick: () => e.setOpen(!e.open),
|
|
3214
|
+
children: /* @__PURE__ */ I(z, { name: "majordomo" })
|
|
3215
|
+
});
|
|
3216
|
+
}
|
|
3217
|
+
async function si(e, t) {
|
|
3218
|
+
let n = await P(e, {
|
|
3219
|
+
method: "POST",
|
|
3220
|
+
headers: t === void 0 ? { Accept: "application/json" } : {
|
|
3221
|
+
Accept: "application/json",
|
|
3222
|
+
"Content-Type": "application/json"
|
|
3223
|
+
},
|
|
3224
|
+
...t === void 0 ? {} : { body: JSON.stringify(t) }
|
|
3225
|
+
}), r = {};
|
|
3226
|
+
try {
|
|
3227
|
+
r = await n.json();
|
|
3228
|
+
} catch {}
|
|
3229
|
+
return {
|
|
3230
|
+
ok: n.ok,
|
|
3231
|
+
status: n.status,
|
|
3232
|
+
body: r
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
function ci({ width: e, max: t, onResize: n }) {
|
|
3236
|
+
let r = j(null);
|
|
3237
|
+
function i(t) {
|
|
3238
|
+
t.button === 0 && (t.preventDefault(), r.current = {
|
|
3239
|
+
x: t.clientX,
|
|
3240
|
+
width: e
|
|
3241
|
+
}, t.currentTarget.setPointerCapture(t.pointerId));
|
|
3242
|
+
}
|
|
3243
|
+
function a(e) {
|
|
3244
|
+
r.current && n(r.current.width - (e.clientX - r.current.x));
|
|
3245
|
+
}
|
|
3246
|
+
function o(e) {
|
|
3247
|
+
r.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
|
|
3248
|
+
}
|
|
3249
|
+
function s(t) {
|
|
3250
|
+
let r = t.key === "ArrowLeft" ? e + Xr.step : t.key === "ArrowRight" ? e - Xr.step : t.key === "Home" ? Xr.max : t.key === "End" ? Xr.min : null;
|
|
3251
|
+
r !== null && (t.preventDefault(), n(r));
|
|
3252
|
+
}
|
|
3253
|
+
return /* @__PURE__ */ I("div", {
|
|
3254
|
+
className: "majordomo-resizer",
|
|
3255
|
+
role: "separator",
|
|
3256
|
+
"aria-orientation": "vertical",
|
|
3257
|
+
"aria-label": "Resize majordomo panel",
|
|
3258
|
+
"aria-controls": "majordomo-panel",
|
|
3259
|
+
"aria-valuenow": e,
|
|
3260
|
+
"aria-valuemin": Xr.min,
|
|
3261
|
+
"aria-valuemax": t,
|
|
3262
|
+
tabIndex: 0,
|
|
3263
|
+
onPointerDown: i,
|
|
3264
|
+
onPointerMove: a,
|
|
3265
|
+
onPointerUp: o,
|
|
3266
|
+
onPointerCancel: o,
|
|
3267
|
+
onKeyDown: s
|
|
3268
|
+
});
|
|
3269
|
+
}
|
|
3270
|
+
function li(e) {
|
|
3271
|
+
return p(e).find((e) => d(e) && !!e.login);
|
|
3272
|
+
}
|
|
3273
|
+
function ui({ status: e, asking: t = !1, busy: r = !1, onContinue: a, onChanged: s }) {
|
|
3274
|
+
let [c, d] = M(!1), [f, p] = M(""), [m, h] = M(!1), [g, _] = M(0), v = i(m ? "/connectors/logins" : null, g), y = j(!1), b = j(0);
|
|
3275
|
+
O(() => {
|
|
3276
|
+
if (!m) return;
|
|
3277
|
+
let e = window.setInterval(() => _((e) => e + 1), 3e3);
|
|
3278
|
+
return () => window.clearInterval(e);
|
|
3279
|
+
}, [m]), O(() => {
|
|
3280
|
+
m && !v.loading && v.data && (u(v.data, e.connector).some((t) => l(t.volume, e.volumeRef) && !!t.session) ? (y.current = !0, b.current = 0) : (b.current += 1, (y.current || b.current >= 3) && (h(!1), s())));
|
|
3281
|
+
}, [
|
|
3282
|
+
m,
|
|
3283
|
+
v.data,
|
|
3284
|
+
v.loading
|
|
3285
|
+
]);
|
|
3286
|
+
let x = n(e), S = e.login?.state;
|
|
3287
|
+
async function C() {
|
|
3288
|
+
if (!c && e.volumeRef) {
|
|
3289
|
+
d(!0), p("");
|
|
3290
|
+
try {
|
|
3291
|
+
await o(e.connector, e.volumeRef, e.method), y.current = !1, b.current = 0, h(!0);
|
|
3292
|
+
} catch (e) {
|
|
3293
|
+
p(e?.message ?? "The login could not be started.");
|
|
3294
|
+
} finally {
|
|
3295
|
+
d(!1);
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
if (S !== "logged in" && S !== "empty") return null;
|
|
3300
|
+
let w = t && S === "empty";
|
|
3301
|
+
return /* @__PURE__ */ L("div", {
|
|
3302
|
+
className: `majordomo-login${w ? " is-asking" : ""}`,
|
|
3303
|
+
role: w ? "group" : void 0,
|
|
3304
|
+
"aria-label": w ? "Log in first" : void 0,
|
|
3305
|
+
children: [
|
|
3306
|
+
/* @__PURE__ */ L("p", {
|
|
3307
|
+
role: "status",
|
|
3308
|
+
"aria-label": `${x} login`,
|
|
3309
|
+
children: [
|
|
3310
|
+
/* @__PURE__ */ I("span", {
|
|
3311
|
+
className: `state-dot tone-${S === "logged in" ? "ok" : "stopped"}`,
|
|
3312
|
+
"aria-hidden": "true"
|
|
3313
|
+
}),
|
|
3314
|
+
x,
|
|
3315
|
+
": ",
|
|
3316
|
+
S === "logged in" ? "logged in" : "not logged in"
|
|
3317
|
+
]
|
|
3318
|
+
}),
|
|
3319
|
+
w && /* @__PURE__ */ L("p", {
|
|
3320
|
+
className: "majordomo-login-ask",
|
|
3321
|
+
children: [
|
|
3322
|
+
"Majordomo starts without a login, and ",
|
|
3323
|
+
x,
|
|
3324
|
+
" then asks for one in its terminal. Log in first, or continue."
|
|
3325
|
+
]
|
|
3326
|
+
}),
|
|
3327
|
+
S === "empty" && e.volumeRef && /* @__PURE__ */ I("button", {
|
|
3328
|
+
type: "button",
|
|
3329
|
+
className: "text-button",
|
|
3330
|
+
disabled: c || r,
|
|
3331
|
+
"aria-label": `Log in to ${x} for majordomo`,
|
|
3332
|
+
onClick: () => void C(),
|
|
3333
|
+
children: c ? "Starting…" : m ? "Open login session" : "Log in"
|
|
3334
|
+
}),
|
|
3335
|
+
w && /* @__PURE__ */ I("button", {
|
|
3336
|
+
type: "button",
|
|
3337
|
+
className: "text-button",
|
|
3338
|
+
disabled: r,
|
|
3339
|
+
onClick: a,
|
|
3340
|
+
children: "Continue anyway"
|
|
3341
|
+
}),
|
|
3342
|
+
f && /* @__PURE__ */ I("p", {
|
|
3343
|
+
className: "error",
|
|
3344
|
+
role: "alert",
|
|
3345
|
+
children: f
|
|
3346
|
+
})
|
|
3347
|
+
]
|
|
3348
|
+
});
|
|
3349
|
+
}
|
|
3350
|
+
function di({ major: e }) {
|
|
3351
|
+
let t = j(null), n = e.configs.data ?? [], r = e.active ? $(e.active.scope) : "";
|
|
3352
|
+
function i(n) {
|
|
3353
|
+
let i = e.panel.findIndex((e) => $(e.scope) === r), a = n.key === "ArrowRight" ? i + 1 : n.key === "ArrowLeft" ? i - 1 : n.key === "Home" ? 0 : n.key === "End" ? e.panel.length - 1 : null;
|
|
3354
|
+
if (a === null) return;
|
|
3355
|
+
n.preventDefault();
|
|
3356
|
+
let o = e.panel[(a + e.panel.length) % e.panel.length];
|
|
3357
|
+
e.select($(o.scope)), requestAnimationFrame(() => t.current?.querySelector("[aria-selected=\"true\"]")?.focus());
|
|
3358
|
+
}
|
|
3359
|
+
let a = (e) => Lr(e, n)?.metadata.name ?? v(e.doc)?.name ?? e.doc.metadata.labels?.["kukeon.io/config"] ?? e.doc.metadata.name, o = e.panel.filter((e) => Nr(e.doc)).map(a);
|
|
3360
|
+
return /* @__PURE__ */ I("div", {
|
|
3361
|
+
className: "majordomo-tabs",
|
|
3362
|
+
role: "tablist",
|
|
3363
|
+
"aria-label": "Panel cells",
|
|
3364
|
+
ref: t,
|
|
3365
|
+
onKeyDown: i,
|
|
3366
|
+
children: e.panel.map((t) => {
|
|
3367
|
+
let n = $(t.scope), i = n === r, s = Nr(t.doc) ? a(t) : "", c = s && o.indexOf(s) === o.lastIndexOf(s) ? s : t.doc.metadata.name, l = t.doc.status?.state, u = l === "Ready" ? "ok" : l && Nn.has(l) ? "stopped" : "pending";
|
|
3368
|
+
return /* @__PURE__ */ L("button", {
|
|
3369
|
+
type: "button",
|
|
3370
|
+
role: "tab",
|
|
3371
|
+
className: "majordomo-tab",
|
|
3372
|
+
"aria-selected": i,
|
|
3373
|
+
"aria-controls": "majordomo-screens",
|
|
3374
|
+
tabIndex: i ? 0 : -1,
|
|
3375
|
+
title: `${t.scope.join(" / ")} (${l || "state not reported"})`,
|
|
3376
|
+
onClick: () => e.select(n),
|
|
3377
|
+
children: [
|
|
3378
|
+
/* @__PURE__ */ I("span", {
|
|
3379
|
+
className: `state-dot tone-${u}`,
|
|
3380
|
+
"aria-hidden": "true"
|
|
3381
|
+
}),
|
|
3382
|
+
/* @__PURE__ */ I("span", {
|
|
3383
|
+
className: "majordomo-tab-label",
|
|
3384
|
+
children: c
|
|
3385
|
+
}),
|
|
3386
|
+
/* @__PURE__ */ L("span", {
|
|
3387
|
+
className: "sr-only",
|
|
3388
|
+
children: [", ", l || "state not reported"]
|
|
3389
|
+
})
|
|
3390
|
+
]
|
|
3391
|
+
}, n);
|
|
3392
|
+
})
|
|
3393
|
+
});
|
|
3394
|
+
}
|
|
3395
|
+
function fi({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o, onChanged: c }) {
|
|
3396
|
+
let l = e.active, u = l?.scope ?? null, d = u ? $(u) : "", p = !!l && Nr(l.doc), m = p ? "majordomo" : l?.doc.metadata.name ?? "", h = l?.doc.status?.state, g = !!u && !!h && !Nn.has(h), _ = i(u ? `${f(u)}/containers` : null, o), v = _.data?.filter((e) => e.attachable && !e.root) ?? [], y = v.some((e) => e.id === r.selection[d]) ? r.selection[d] : v[0]?.id ?? "", b = u && y ? Mn(u, y, "panel") : "", x = e.panel.map((e) => $(e.scope)), S = r.sessions.filter((e) => e.view === "panel" && x.includes($(e.scope))), C = S.find((e) => e.id === b), [w, E] = M({}), [D, ee] = M(""), [k, A] = M(!1), [j, N] = M(!1), [P, te] = M(""), [F, R] = M(""), [B, V] = M(""), [re, U] = M(!1), W = !l && !e.cells.length, ie = !l && !W && !j && !k, G = e.cells.length ? e.unused : e.pairs, K = G.find((e) => JSON.stringify([...Pr(e), e.metadata.name]) === D) ?? G[0], q = W || k, J = li(q ? K : p ? Lr(l, e.configs.data ?? []) : void 0), ae = q && J?.login?.state === "empty";
|
|
3397
|
+
O(() => {
|
|
3398
|
+
ae || U(!1);
|
|
3399
|
+
}, [ae]);
|
|
3400
|
+
let Y = !_.loading && !!_.data, X = e.candidates.some((e) => $(e.scope) === P) ? P : e.candidates[0] ? $(e.candidates[0].scope) : "", [{ autoAttach: oe }] = dr(), Z = oe && t.open && !!u && g && !!y && !w[d] && Y;
|
|
3401
|
+
O(() => {
|
|
3402
|
+
Z && !C && r.attach(u, y, "panel");
|
|
3403
|
+
}, [
|
|
3404
|
+
Z,
|
|
3405
|
+
d,
|
|
3406
|
+
y,
|
|
3407
|
+
C,
|
|
3408
|
+
r.attach
|
|
3409
|
+
]);
|
|
3410
|
+
let se = Ln(C, Z, (e) => r.attach(e.scope, e.container, "panel")), ce = e.cell ? $(e.cell.scope) : "", Q = x.includes(ce);
|
|
3411
|
+
O(() => {
|
|
3412
|
+
t.question && ce && !p && (Q ? e.select(ce) : e.add(ce));
|
|
3413
|
+
}, [
|
|
3414
|
+
t.question,
|
|
3415
|
+
ce,
|
|
3416
|
+
Q,
|
|
3417
|
+
p
|
|
3418
|
+
]), O(() => {
|
|
3419
|
+
t.question && p && C && C.state === "attached" && (r.paste(C.id, t.question), t.clearQuestion());
|
|
3420
|
+
}, [
|
|
3421
|
+
t.question,
|
|
3422
|
+
p,
|
|
3423
|
+
C?.id,
|
|
3424
|
+
C?.state
|
|
3425
|
+
]), O(() => {
|
|
3426
|
+
G.length || A(!1);
|
|
3427
|
+
}, [G.length]), O(() => {
|
|
3428
|
+
e.candidates.length || N(!1);
|
|
3429
|
+
}, [e.candidates.length]);
|
|
3430
|
+
async function le(e) {
|
|
3431
|
+
let t = await si(`${f(e)}/start`);
|
|
3432
|
+
if (!t.ok) throw Error(t.body.error?.message ?? `HTTP ${t.status}`);
|
|
3433
|
+
}
|
|
3434
|
+
async function ue(t = !1) {
|
|
3435
|
+
if (!K || F || !W && !k) return;
|
|
3436
|
+
if (ae && !t) {
|
|
3437
|
+
U(!0);
|
|
3438
|
+
return;
|
|
3439
|
+
}
|
|
3440
|
+
U(!1), R("enable"), V("");
|
|
3441
|
+
let r = e.cells.length ? K.metadata.name : Or;
|
|
3442
|
+
try {
|
|
3443
|
+
let t = {
|
|
3444
|
+
config: {
|
|
3445
|
+
name: K.metadata.name,
|
|
3446
|
+
realm: K.metadata.realm,
|
|
3447
|
+
space: K.metadata.space,
|
|
3448
|
+
stack: K.metadata.stack
|
|
3449
|
+
},
|
|
3450
|
+
name: r,
|
|
3451
|
+
env: [],
|
|
3452
|
+
ignoreDiskPressure: !1
|
|
3453
|
+
}, i = await si("/cells/from-config/preview", t);
|
|
3454
|
+
if (!i.ok) throw Error(i.body.error?.message ?? `HTTP ${i.status}`);
|
|
3455
|
+
let a = i.body.document, o = await si("/cells/from-config/create", {
|
|
3456
|
+
...t,
|
|
3457
|
+
resolvedName: a?.metadata.name,
|
|
3458
|
+
preview: i.body.preview
|
|
3459
|
+
});
|
|
3460
|
+
if (!o.ok) throw Error(o.body.error?.message ?? `HTTP ${o.status}`);
|
|
3461
|
+
let s = o.body;
|
|
3462
|
+
n.upsertCell(s);
|
|
3463
|
+
let c = [...Pr(K), s.metadata.name];
|
|
3464
|
+
e.select($(c)), A(!1), await le(c);
|
|
3465
|
+
} catch (e) {
|
|
3466
|
+
V(e instanceof Error ? e.message : "The request could not reach the web server.");
|
|
3467
|
+
} finally {
|
|
3468
|
+
R(""), c();
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
async function de() {
|
|
3472
|
+
if (u && !F) {
|
|
3473
|
+
R("start"), V("");
|
|
3474
|
+
try {
|
|
3475
|
+
await le(u);
|
|
3476
|
+
} catch (e) {
|
|
3477
|
+
V(e instanceof Error ? e.message : "The request could not reach the web server.");
|
|
3478
|
+
} finally {
|
|
3479
|
+
R(""), c();
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
function fe(t) {
|
|
3484
|
+
let n = $(t.scope);
|
|
3485
|
+
r.detachView(t.scope, "panel"), E((e) => {
|
|
3486
|
+
let t = { ...e };
|
|
3487
|
+
return delete t[n], t;
|
|
3488
|
+
}), V(""), e.remove(n);
|
|
3489
|
+
}
|
|
3490
|
+
function pe() {
|
|
3491
|
+
X && (e.add(X), N(!1), te(""));
|
|
3492
|
+
}
|
|
3493
|
+
let me = () => {
|
|
3494
|
+
A(!1), N((e) => !e);
|
|
3495
|
+
}, he = () => {
|
|
3496
|
+
N(!1), A((e) => !e);
|
|
3497
|
+
}, ge = C?.state === "attached" || C?.state === "connecting", _e = u ? g ? C ? {
|
|
3498
|
+
tone: C.state,
|
|
3499
|
+
label: C.state === "attached" ? "Attached" : C.state === "connecting" ? "Connecting…" : C.message || "Disconnected"
|
|
3500
|
+
} : w[d] ? {
|
|
3501
|
+
tone: "disconnected",
|
|
3502
|
+
label: "Detached"
|
|
3503
|
+
} : !_.loading && !v.length ? {
|
|
3504
|
+
tone: "disconnected",
|
|
3505
|
+
label: "No attachable container"
|
|
3506
|
+
} : oe ? {
|
|
3507
|
+
tone: "connecting",
|
|
3508
|
+
label: "Connecting…"
|
|
3509
|
+
} : {
|
|
3510
|
+
tone: "disconnected",
|
|
3511
|
+
label: "Detached"
|
|
3512
|
+
} : {
|
|
3513
|
+
tone: "disconnected",
|
|
3514
|
+
label: `Cell is ${h || "in an unknown state"}`
|
|
3515
|
+
} : {
|
|
3516
|
+
tone: "disconnected",
|
|
3517
|
+
label: W ? "No majordomo cell" : "No cell in the panel"
|
|
3518
|
+
}, ve = !!u && g && !!y && !ge, ye = () => {
|
|
3519
|
+
u && y && (E((e) => ({
|
|
3520
|
+
...e,
|
|
3521
|
+
[d]: !1
|
|
3522
|
+
})), se(b), r.attach(u, y, "panel"));
|
|
3523
|
+
}, be = (t, n) => /* @__PURE__ */ L(ne, { children: [
|
|
3524
|
+
/* @__PURE__ */ I("p", { children: t }),
|
|
3525
|
+
/* @__PURE__ */ L("label", { children: ["Harness", /* @__PURE__ */ I("select", {
|
|
3526
|
+
value: K ? JSON.stringify([...Pr(K), K.metadata.name]) : "",
|
|
3527
|
+
disabled: !!F,
|
|
3528
|
+
onChange: (e) => ee(e.target.value),
|
|
3529
|
+
children: G.map((e) => {
|
|
3530
|
+
let t = JSON.stringify([...Pr(e), e.metadata.name]);
|
|
3531
|
+
return /* @__PURE__ */ I("option", {
|
|
3532
|
+
value: t,
|
|
3533
|
+
children: e.metadata.name
|
|
3534
|
+
}, t);
|
|
3535
|
+
})
|
|
3536
|
+
})] }),
|
|
3537
|
+
/* @__PURE__ */ I("button", {
|
|
3538
|
+
type: "button",
|
|
3539
|
+
className: "majordomo-primary",
|
|
3540
|
+
disabled: !!F || !K,
|
|
3541
|
+
"aria-busy": F === "enable" || void 0,
|
|
3542
|
+
onClick: () => void ue(),
|
|
3543
|
+
children: F === "enable" ? e.cells.length ? "Adding majordomo…" : "Enabling majordomo…" : e.cells.length ? "Add majordomo" : "Enable majordomo"
|
|
3544
|
+
}),
|
|
3545
|
+
/* @__PURE__ */ I("small", { children: n })
|
|
3546
|
+
] }), xe = "Majordomo is kukeon's own assistant: ask it for help, and it changes things only when you ask.", Se = j ? /* @__PURE__ */ L("div", {
|
|
3547
|
+
className: "majordomo-setup majordomo-add",
|
|
3548
|
+
role: "group",
|
|
3549
|
+
"aria-label": "Add cell to the panel",
|
|
3550
|
+
children: [
|
|
3551
|
+
/* @__PURE__ */ I("p", { children: "Add a cell to the side panel. It stays open beside every page, and its cell screen keeps its own terminal." }),
|
|
3552
|
+
/* @__PURE__ */ L("label", { children: ["Cell", /* @__PURE__ */ I("select", {
|
|
3553
|
+
value: X,
|
|
3554
|
+
onChange: (e) => te(e.target.value),
|
|
3555
|
+
children: e.candidates.map((e) => {
|
|
3556
|
+
let t = $(e.scope);
|
|
3557
|
+
return /* @__PURE__ */ I("option", {
|
|
3558
|
+
value: t,
|
|
3559
|
+
children: e.scope.join(" / ")
|
|
3560
|
+
}, t);
|
|
3561
|
+
})
|
|
3562
|
+
})] }),
|
|
3563
|
+
/* @__PURE__ */ I("button", {
|
|
3564
|
+
type: "button",
|
|
3565
|
+
className: "majordomo-primary",
|
|
3566
|
+
disabled: !X,
|
|
3567
|
+
onClick: pe,
|
|
3568
|
+
children: "Add to panel"
|
|
3569
|
+
}),
|
|
3570
|
+
/* @__PURE__ */ I("button", {
|
|
3571
|
+
type: "button",
|
|
3572
|
+
className: "text-button",
|
|
3573
|
+
onClick: () => N(!1),
|
|
3574
|
+
children: "Cancel"
|
|
3575
|
+
})
|
|
3576
|
+
]
|
|
3577
|
+
}) : k ? /* @__PURE__ */ L("div", {
|
|
3578
|
+
className: "majordomo-setup majordomo-add",
|
|
3579
|
+
role: "group",
|
|
3580
|
+
"aria-label": "Add majordomo",
|
|
3581
|
+
children: [e.cells.length ? be("Add another majordomo with a different harness. Each runs in its own cell, in its own tab.", "Creates and starts a cell named after the selected config.") : be(xe, `Creates and starts one cell named ${Or} from the selected config.`), /* @__PURE__ */ I("button", {
|
|
3582
|
+
type: "button",
|
|
3583
|
+
className: "text-button",
|
|
3584
|
+
disabled: !!F,
|
|
3585
|
+
onClick: () => A(!1),
|
|
3586
|
+
children: "Cancel"
|
|
3587
|
+
})]
|
|
3588
|
+
}) : W ? /* @__PURE__ */ I("div", {
|
|
3589
|
+
className: "majordomo-setup",
|
|
3590
|
+
children: e.configs.loading && !e.configs.data ? /* @__PURE__ */ I("p", {
|
|
3591
|
+
role: "status",
|
|
3592
|
+
children: "Looking for majordomo configs…"
|
|
3593
|
+
}) : e.configs.error && !e.configs.data ? /* @__PURE__ */ I(s, {
|
|
3594
|
+
error: e.configs.error,
|
|
3595
|
+
kind: "Configs"
|
|
3596
|
+
}) : e.pairs.length ? be(xe, `Creates and starts one cell named ${Or} from the selected config.`) : /* @__PURE__ */ L("div", {
|
|
3597
|
+
className: "majordomo-missing",
|
|
3598
|
+
children: [/* @__PURE__ */ L("p", {
|
|
3599
|
+
role: "status",
|
|
3600
|
+
children: [/* @__PURE__ */ I("strong", { children: "Majordomo is not installed on this host." }), " Initialize applies its configs."]
|
|
3601
|
+
}), /* @__PURE__ */ I(T, {
|
|
3602
|
+
onChanged: c,
|
|
3603
|
+
subject: "majordomo and the agent templates"
|
|
3604
|
+
})]
|
|
3605
|
+
})
|
|
3606
|
+
}) : ie ? /* @__PURE__ */ L("div", {
|
|
3607
|
+
className: "majordomo-setup majordomo-empty",
|
|
3608
|
+
children: [/* @__PURE__ */ I("p", {
|
|
3609
|
+
role: "status",
|
|
3610
|
+
children: "The side panel holds no cells. Add any cell to it, majordomo included."
|
|
3611
|
+
}), /* @__PURE__ */ I("button", {
|
|
3612
|
+
type: "button",
|
|
3613
|
+
className: "majordomo-primary",
|
|
3614
|
+
disabled: !e.candidates.length,
|
|
3615
|
+
onClick: () => N(!0),
|
|
3616
|
+
children: "Add cell"
|
|
3617
|
+
})]
|
|
3618
|
+
}) : u && !g ? /* @__PURE__ */ L("div", {
|
|
3619
|
+
className: "majordomo-setup",
|
|
3620
|
+
children: [/* @__PURE__ */ L("p", {
|
|
3621
|
+
role: "status",
|
|
3622
|
+
children: [
|
|
3623
|
+
p ? "The majordomo cell" : "The cell",
|
|
3624
|
+
" ",
|
|
3625
|
+
/* @__PURE__ */ I("code", { children: u.join(" / ") }),
|
|
3626
|
+
" is ",
|
|
3627
|
+
/* @__PURE__ */ I(H, { state: h }),
|
|
3628
|
+
"."
|
|
3629
|
+
]
|
|
3630
|
+
}), /* @__PURE__ */ I("button", {
|
|
3631
|
+
type: "button",
|
|
3632
|
+
className: "majordomo-primary",
|
|
3633
|
+
disabled: !!F,
|
|
3634
|
+
"aria-busy": F === "start" || void 0,
|
|
3635
|
+
onClick: de,
|
|
3636
|
+
children: F === "start" ? "Starting…" : "Start"
|
|
3637
|
+
})]
|
|
3638
|
+
}) : null, Ce = e.panel.length > 1 || !!l && !p, we = k || j;
|
|
3639
|
+
return /* @__PURE__ */ L("aside", {
|
|
3640
|
+
className: "majordomo-panel",
|
|
3641
|
+
id: "majordomo-panel",
|
|
3642
|
+
"aria-label": "Majordomo panel",
|
|
3643
|
+
hidden: !t.open,
|
|
3644
|
+
style: { width: t.effectiveWidth },
|
|
3645
|
+
children: [
|
|
3646
|
+
/* @__PURE__ */ I(ci, {
|
|
3647
|
+
width: t.effectiveWidth,
|
|
3648
|
+
max: t.maxWidth,
|
|
3649
|
+
onResize: t.setWidth
|
|
3650
|
+
}),
|
|
3651
|
+
/* @__PURE__ */ L("header", {
|
|
3652
|
+
className: "majordomo-header",
|
|
3653
|
+
children: [
|
|
3654
|
+
/* @__PURE__ */ L("h2", { children: [/* @__PURE__ */ I(z, { name: "majordomo" }), "Majordomo"] }),
|
|
3655
|
+
/* @__PURE__ */ L("span", {
|
|
3656
|
+
className: `terminal-connection-state ${_e.tone}`,
|
|
3657
|
+
role: "status",
|
|
3658
|
+
title: _e.label,
|
|
3659
|
+
children: [/* @__PURE__ */ I("span", {
|
|
3660
|
+
className: "state-dot",
|
|
3661
|
+
"aria-hidden": "true"
|
|
3662
|
+
}), /* @__PURE__ */ I("span", {
|
|
3663
|
+
className: "majordomo-connection-label",
|
|
3664
|
+
children: _e.label
|
|
3665
|
+
})]
|
|
3666
|
+
}),
|
|
3667
|
+
/* @__PURE__ */ L("div", {
|
|
3668
|
+
className: "majordomo-header-actions",
|
|
3669
|
+
children: [
|
|
3670
|
+
e.candidates.length > 0 && !ie && /* @__PURE__ */ I("button", {
|
|
3671
|
+
type: "button",
|
|
3672
|
+
className: "icon-button",
|
|
3673
|
+
"aria-label": "Add cell",
|
|
3674
|
+
title: "Add a cell to the side panel",
|
|
3675
|
+
"aria-expanded": j,
|
|
3676
|
+
onClick: me,
|
|
3677
|
+
children: /* @__PURE__ */ I(z, { name: "sidePanel" })
|
|
3678
|
+
}),
|
|
3679
|
+
G.length > 0 && !W && /* @__PURE__ */ I("button", {
|
|
3680
|
+
type: "button",
|
|
3681
|
+
className: "icon-button",
|
|
3682
|
+
"aria-label": "Add majordomo",
|
|
3683
|
+
title: e.cells.length ? "Add majordomo with another harness" : "Enable majordomo",
|
|
3684
|
+
"aria-expanded": k,
|
|
3685
|
+
onClick: he,
|
|
3686
|
+
children: /* @__PURE__ */ I(z, { name: "create" })
|
|
3687
|
+
}),
|
|
3688
|
+
ve && /* @__PURE__ */ I("button", {
|
|
3689
|
+
type: "button",
|
|
3690
|
+
className: "icon-button",
|
|
3691
|
+
"aria-label": `Reconnect ${m}`,
|
|
3692
|
+
title: "Reconnect",
|
|
3693
|
+
onClick: ye,
|
|
3694
|
+
children: /* @__PURE__ */ I(z, { name: "reconnect" })
|
|
3695
|
+
}),
|
|
3696
|
+
ge && C && /* @__PURE__ */ I("button", {
|
|
3697
|
+
type: "button",
|
|
3698
|
+
className: "icon-button",
|
|
3699
|
+
"aria-label": `Detach ${m}`,
|
|
3700
|
+
title: "Detach",
|
|
3701
|
+
onClick: () => {
|
|
3702
|
+
E((e) => ({
|
|
3703
|
+
...e,
|
|
3704
|
+
[d]: !0
|
|
3705
|
+
})), r.detach(C.id);
|
|
3706
|
+
},
|
|
3707
|
+
children: /* @__PURE__ */ I(z, { name: "detach" })
|
|
3708
|
+
}),
|
|
3709
|
+
l && /* @__PURE__ */ I("button", {
|
|
3710
|
+
type: "button",
|
|
3711
|
+
className: "icon-button",
|
|
3712
|
+
"aria-label": `Remove ${l.doc.metadata.name} from the side panel`,
|
|
3713
|
+
title: "Remove from the side panel (the cell and its cell screen's terminal stay)",
|
|
3714
|
+
onClick: () => fe(l),
|
|
3715
|
+
children: /* @__PURE__ */ I(z, { name: "remove" })
|
|
3716
|
+
}),
|
|
3717
|
+
/* @__PURE__ */ I("button", {
|
|
3718
|
+
type: "button",
|
|
3719
|
+
className: "icon-button",
|
|
3720
|
+
"aria-label": "Collapse majordomo panel",
|
|
3721
|
+
title: "Collapse (the session stays attached)",
|
|
3722
|
+
onClick: () => t.setOpen(!1),
|
|
3723
|
+
children: /* @__PURE__ */ I(z, { name: "sidebarExpand" })
|
|
3724
|
+
})
|
|
3725
|
+
]
|
|
3726
|
+
})
|
|
3727
|
+
]
|
|
3728
|
+
}),
|
|
3729
|
+
Ce && /* @__PURE__ */ I(di, { major: e }),
|
|
3730
|
+
t.question && /* @__PURE__ */ L("p", {
|
|
3731
|
+
className: "majordomo-question",
|
|
3732
|
+
role: "status",
|
|
3733
|
+
children: [
|
|
3734
|
+
/* @__PURE__ */ I("strong", { children: "Waiting to paste:" }),
|
|
3735
|
+
" ",
|
|
3736
|
+
t.question,
|
|
3737
|
+
" ",
|
|
3738
|
+
/* @__PURE__ */ I("button", {
|
|
3739
|
+
type: "button",
|
|
3740
|
+
className: "text-button",
|
|
3741
|
+
onClick: t.clearQuestion,
|
|
3742
|
+
children: "Discard"
|
|
3743
|
+
})
|
|
3744
|
+
]
|
|
3745
|
+
}),
|
|
3746
|
+
J && /* @__PURE__ */ I(ui, {
|
|
3747
|
+
status: J,
|
|
3748
|
+
asking: re,
|
|
3749
|
+
busy: !!F,
|
|
3750
|
+
onContinue: () => void ue(!0),
|
|
3751
|
+
onChanged: c
|
|
3752
|
+
}, `${J.connector}/${JSON.stringify(J.volumeRef ?? null)}`),
|
|
3753
|
+
B && /* @__PURE__ */ L("div", {
|
|
3754
|
+
className: "error",
|
|
3755
|
+
role: "alert",
|
|
3756
|
+
children: [/* @__PURE__ */ I("strong", { children: u && !k ? p ? "Majordomo did not start" : "The cell did not start" : e.cells.length ? "Majordomo could not be added" : "Majordomo could not be enabled" }), /* @__PURE__ */ I("p", { children: B })]
|
|
3757
|
+
}),
|
|
3758
|
+
Se,
|
|
3759
|
+
u && g && !we && _.error && !ge && /* @__PURE__ */ I(s, {
|
|
3760
|
+
error: _.error,
|
|
3761
|
+
kind: "Containers"
|
|
3762
|
+
}),
|
|
3763
|
+
/* @__PURE__ */ I("div", {
|
|
3764
|
+
className: "majordomo-screens",
|
|
3765
|
+
id: "majordomo-screens",
|
|
3766
|
+
role: Ce ? "tabpanel" : void 0,
|
|
3767
|
+
"aria-label": l ? `Terminal of ${l.doc.metadata.name}` : void 0,
|
|
3768
|
+
hidden: !u || !g || we,
|
|
3769
|
+
children: S.map((e) => /* @__PURE__ */ I(Rn, {
|
|
3770
|
+
session: e,
|
|
3771
|
+
active: t.open && !we && e.id === b,
|
|
3772
|
+
expanded: !1,
|
|
3773
|
+
theme: a,
|
|
3774
|
+
update: r.update,
|
|
3775
|
+
pending: r.pastes[e.id],
|
|
3776
|
+
onPasted: r.pasteDelivered
|
|
3777
|
+
}, e.id))
|
|
3778
|
+
})
|
|
3779
|
+
]
|
|
3780
|
+
});
|
|
3781
|
+
}
|
|
3782
|
+
export { nt as $, Un as A, mn as B, dr as C, Wn as D, Hn as E, In as F, fn as G, vn as H, un as I, mt as J, ut as K, dn as L, zn as M, $ as N, Jn as O, Nn as P, Ze as Q, pn as R, Zn as S, Kn as T, _n as U, bn as V, hn as W, rt as X, Xe as Y, Qe as Z, er as _, fe as _t, ii as a, Ee as at, rr as b, Ur as c, _e as ct, Tr as d, ke as dt, Ye as et, Vr as f, Oe as ft, ei as g, ce as gt, ti as h, le as ht, ai as i, we as it, qn as j, Vn as k, Pr as l, Ce as lt, Br as m, Q as mt, Kr as n, Ve as nt, oi as o, he as ot, Dr as p, De as pt, lt as q, fi as r, ze as rt, Wr as s, ve as st, qr as t, et as tt, Cr as u, Te as ut, $n as v, ue as vt, Gn as w, Qn as x, ir as y, pe as yt, xn as z };
|