@kukeon/console 0.0.0-stage → 0.10.0-edge.g21af9f59

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.
Files changed (93) hide show
  1. package/dist/auth.d.ts +39 -0
  2. package/dist/bulk-ui.d.ts +49 -0
  3. package/dist/bulk.d.mts +14 -0
  4. package/dist/catalog-CBVxh9uQ.js +5005 -0
  5. package/dist/catalog-url-Dr9e92Yq.js +19 -0
  6. package/dist/catalog-url.d.mts +4 -0
  7. package/dist/catalog.d.ts +40 -0
  8. package/dist/cell-filter.d.ts +10 -0
  9. package/dist/cell-sidebar.d.ts +26 -0
  10. package/dist/cells.d.mts +29 -0
  11. package/dist/cgroup-format.d.ts +17 -0
  12. package/dist/cgroup.d.ts +4 -0
  13. package/dist/config-form.d.mts +66 -0
  14. package/dist/connector-ui-lYy-1M3l.js +2692 -0
  15. package/dist/connector-ui.d.ts +127 -0
  16. package/dist/connectors-page-Z7acjRvr.js +1460 -0
  17. package/dist/connectors-page.d.ts +14 -0
  18. package/dist/connectors.d.mts +153 -0
  19. package/dist/container-log.d.ts +11 -0
  20. package/dist/create.d.ts +11 -0
  21. package/dist/creation-schema.d.mts +15 -0
  22. package/dist/daemon.d.ts +24 -0
  23. package/dist/display-name.d.ts +10 -0
  24. package/dist/drift-diff.d.ts +4 -0
  25. package/dist/exec.d.ts +15 -0
  26. package/dist/extensions.d.ts +111 -0
  27. package/dist/get-started.d.ts +9 -0
  28. package/dist/health.d.ts +22 -0
  29. package/dist/image-format.d.ts +6 -0
  30. package/dist/image-inventory.d.ts +12 -0
  31. package/dist/images.d.ts +5 -0
  32. package/dist/index.d.ts +5 -0
  33. package/dist/index.js +5595 -0
  34. package/dist/initialize-CGmYWoaj.js +146 -0
  35. package/dist/initialize.d.ts +21 -0
  36. package/dist/inventory.d.ts +66 -0
  37. package/dist/lifecycle-policy.d.ts +11 -0
  38. package/dist/lifecycle.d.ts +24 -0
  39. package/dist/log-buffer.d.ts +8 -0
  40. package/dist/main.d.ts +13 -0
  41. package/dist/majordomo.d.ts +102 -0
  42. package/dist/manage-nav.d.ts +4 -0
  43. package/dist/manifest-diff.d.mts +11 -0
  44. package/dist/merged-values-BhW2-nlA.js +739 -0
  45. package/dist/merged-values.d.ts +24 -0
  46. package/dist/network-format.d.ts +30 -0
  47. package/dist/network.d.ts +13 -0
  48. package/dist/new-agent-24Fcf0PI.js +201 -0
  49. package/dist/new-agent.d.ts +27 -0
  50. package/dist/new-cell-u87hB9wV.js +1985 -0
  51. package/dist/new-cell.d.ts +29 -0
  52. package/dist/new-config-B_uf4R4e.js +1541 -0
  53. package/dist/new-config.d.ts +7 -0
  54. package/dist/notifications.d.ts +26 -0
  55. package/dist/onboarding-CPDpnS7K.js +395 -0
  56. package/dist/onboarding.d.mts +40 -0
  57. package/dist/panel-cells.d.mts +8 -0
  58. package/dist/registry-credentials.d.ts +13 -0
  59. package/dist/relationships.d.mts +12 -0
  60. package/dist/request.d.ts +16 -0
  61. package/dist/router.d.ts +12 -0
  62. package/dist/routes.d.ts +41 -0
  63. package/dist/schedule-B08uvsJe.js +113 -0
  64. package/dist/schedule-format.d.mts +9 -0
  65. package/dist/schedule.d.ts +16 -0
  66. package/dist/scope-actions.d.ts +9 -0
  67. package/dist/screens.d.ts +6 -0
  68. package/dist/secret-form.d.ts +24 -0
  69. package/dist/settings-nav.d.ts +5 -0
  70. package/dist/settings-page.d.ts +4 -0
  71. package/dist/settings-values.d.mts +18 -0
  72. package/dist/settings.d.ts +50 -0
  73. package/dist/sidebar-shell.d.ts +55 -0
  74. package/dist/sources-page-C4t29wxJ.js +423 -0
  75. package/dist/sources-page.d.ts +5 -0
  76. package/dist/space-subnets.d.ts +3 -0
  77. package/dist/style.css +2 -0
  78. package/dist/team-form.d.mts +56 -0
  79. package/dist/team-plan-CaBIrof0.js +735 -0
  80. package/dist/team-plan.d.ts +22 -0
  81. package/dist/team-wizard.d.ts +8 -0
  82. package/dist/teams-page-CLdQhhgo.js +2206 -0
  83. package/dist/teams-page.d.ts +9 -0
  84. package/dist/teams.d.mts +112 -0
  85. package/dist/terminal-palette.d.ts +8 -0
  86. package/dist/terminal.d.ts +98 -0
  87. package/dist/unread.d.mts +19 -0
  88. package/dist/use-unread.d.ts +4 -0
  89. package/dist/user-menu.d.ts +7 -0
  90. package/dist/views.d.mts +8 -0
  91. package/dist/workbench.d.ts +16 -0
  92. package/package.json +45 -4
  93. package/README.md +0 -3
@@ -0,0 +1,1460 @@
1
+ import { $t as e, At as t, Bn as n, Bt as r, C as i, Cn as a, En as o, Ht as s, I as c, In as l, It as u, Ln as d, O as f, Ot as p, Pn as m, Qt as h, S as g, Sn as _, T as v, Un as y, Zt as b, _ as x, an as S, b as C, bn as w, c as T, cn as E, en as D, f as O, fn as k, jt as A, kn as j, m as M, mn as N, nn as P, o as F, p as I, pn as L, rn as ee, s as te, sn as R, u as ne, v as z, vn as B, w as V, x as re, xn as H, y as U, yn as ie, zn as ae } from "./connector-ui-lYy-1M3l.js";
2
+ import { a as oe, c as se, l as ce, o as le, s as ue, t as de } from "./catalog-CBVxh9uQ.js";
3
+ import { n as fe } from "./catalog-url-Dr9e92Yq.js";
4
+ import { o as pe, r as me } from "./onboarding-CPDpnS7K.js";
5
+ import { useEffect as W, useState as G } from "react";
6
+ import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
7
+ import { Disclosure as he } from "@kukeon/ui";
8
+ // src/connectors-page.tsx
9
+ function Y(e) {
10
+ return e.delivery === "env" ? `environment variable ${e.envName ?? ""}`.trim() : e.delivery === "file" ? `file ${e.mountPath ?? ""}`.trim() : e.delivery === "stateVolume" ? "login kept in a login identity (a Volume mounted as the harness state directory)" : e.delivery === "git" ? "the cell's git identity (author, committer, credentials, signing)" : e.delivery === "registry" ? "image pulls of a Realm" : e.delivery;
11
+ }
12
+ function ge(e) {
13
+ return t("/secrets/" + [...N(e), e.name].map(encodeURIComponent).join("/"));
14
+ }
15
+ function X(e) {
16
+ return t("/configs/" + [
17
+ e.realm,
18
+ e.space,
19
+ e.stack,
20
+ e.name
21
+ ].filter((e) => !!e).map(encodeURIComponent).join("/"));
22
+ }
23
+ function _e(e) {
24
+ let t = e.data?.rows[0] ?? [];
25
+ return (t.find((e) => e.scope[0] === "default") ?? t[0])?.scope[0] ?? "";
26
+ }
27
+ function Z(e, t) {
28
+ let [n, r] = G(t ?? { realm: "" }), i = _e(e);
29
+ return W(() => {
30
+ !n.realm && i && r({ realm: i });
31
+ }, [n.realm, i]), [n, r];
32
+ }
33
+ function ve({ connectors: e, usage: t, secrets: n, logins: r }) {
34
+ return /* @__PURE__ */ J("section", {
35
+ className: "panel",
36
+ "aria-label": "Connectors list",
37
+ children: [/* @__PURE__ */ q("div", {
38
+ className: "table-scroll",
39
+ children: /* @__PURE__ */ J("table", { children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ J("tr", { children: [
40
+ /* @__PURE__ */ q("th", { children: "Connector" }),
41
+ /* @__PURE__ */ q("th", { children: "Delivered as" }),
42
+ /* @__PURE__ */ q("th", { children: "Identities" }),
43
+ /* @__PURE__ */ q("th", { children: "Configs requiring it" }),
44
+ /* @__PURE__ */ q("th", { children: "Configs without an identity" })
45
+ ] }) }), /* @__PURE__ */ q("tbody", { children: e.map((e) => {
46
+ let { configs: i, missing: a } = ae(t, e.name);
47
+ return /* @__PURE__ */ J("tr", { children: [
48
+ /* @__PURE__ */ J("td", { children: [
49
+ /* @__PURE__ */ q("a", {
50
+ className: "resource-name",
51
+ href: z(e.name),
52
+ children: e.title || e.name
53
+ }),
54
+ " ",
55
+ /* @__PURE__ */ q("span", {
56
+ className: "badge",
57
+ children: e.name
58
+ }),
59
+ e.description && /* @__PURE__ */ q("p", {
60
+ className: "description",
61
+ children: e.description
62
+ })
63
+ ] }),
64
+ /* @__PURE__ */ q("td", { children: e.methods.length ? e.methods.map((e) => /* @__PURE__ */ J("div", { children: [
65
+ /* @__PURE__ */ q("code", { children: e.name }),
66
+ " — ",
67
+ Y(e)
68
+ ] }, e.name)) : Y({ delivery: e.delivery ?? "" }) }),
69
+ /* @__PURE__ */ J("td", { children: [n ? b(n, e.name).length + S(r, e.name).length : "—", n && r && !me(e, n, r) && /* @__PURE__ */ J(K, { children: [" ", /* @__PURE__ */ q("span", {
70
+ className: "badge not-set-up",
71
+ title: pe(e),
72
+ children: "Not set up — recommended"
73
+ })] })] }),
74
+ /* @__PURE__ */ q("td", { children: t ? i : "—" }),
75
+ /* @__PURE__ */ q("td", { children: t ? a.length ? /* @__PURE__ */ J(K, { children: [
76
+ /* @__PURE__ */ q("strong", { children: a.length }),
77
+ " ",
78
+ /* @__PURE__ */ q("span", {
79
+ className: "badge needs-connector",
80
+ children: "Needs a default"
81
+ }),
82
+ " ",
83
+ /* @__PURE__ */ q("a", {
84
+ className: "document-action",
85
+ href: z(e.name, m(a[0].config)),
86
+ "aria-label": `Set a default for ${e.title || e.name}`,
87
+ children: "Set a default"
88
+ })
89
+ ] }) : "0" : "—" })
90
+ ] }, e.name);
91
+ }) })] })
92
+ }), !e.length && /* @__PURE__ */ q("div", {
93
+ className: "empty-state",
94
+ children: /* @__PURE__ */ q("h3", { children: "No connectors are defined" })
95
+ })]
96
+ });
97
+ }
98
+ function ye({ connector: e, inventory: t, initiallyOpen: r = !1, onChanged: i }) {
99
+ let a = e.title || e.name, [o, s] = G(r), [c, l] = Z(t, void 0), [u, d] = G({
100
+ hosts: "",
101
+ name: "",
102
+ key: "",
103
+ passphraseFile: "",
104
+ makeDefault: !0
105
+ }), [p, m] = G(!1), [_, v] = G(), [y, b] = G(), { notify: S } = f(), C = (e) => {
106
+ d((t) => ({
107
+ ...t,
108
+ ...e
109
+ })), v(void 0);
110
+ };
111
+ async function w(t) {
112
+ if (t.preventDefault(), !p) {
113
+ m(!0), v(void 0), b(void 0);
114
+ try {
115
+ let t = await g(x(e.name, "import"), h({
116
+ ...u,
117
+ realm: c.realm
118
+ }));
119
+ b(t);
120
+ let n = t.secrets.find((e) => e.name === t.name)?.action === "updated" ? "updated" : "imported";
121
+ S({
122
+ key: `identity-import:${e.name}`,
123
+ tone: "success",
124
+ message: `${a} identity ${t.name} ${n} in ${t.realm}${t.default ? `; it is now the ${t.realm} default` : ""}.`
125
+ }), i();
126
+ } catch (e) {
127
+ v(V(e));
128
+ } finally {
129
+ m(!1);
130
+ }
131
+ }
132
+ }
133
+ return /* @__PURE__ */ J("div", {
134
+ className: "connector-import",
135
+ children: [/* @__PURE__ */ q("div", {
136
+ className: "connector-actions",
137
+ children: /* @__PURE__ */ q("button", {
138
+ type: "button",
139
+ className: "subtle-button",
140
+ "aria-expanded": o,
141
+ onClick: () => s((e) => !e),
142
+ children: o ? "Hide import" : "Import from host"
143
+ })
144
+ }), o && /* @__PURE__ */ J("form", {
145
+ className: "creation-form identity-form",
146
+ "aria-label": `Import ${a} identity from host`,
147
+ method: "post",
148
+ autoComplete: "off",
149
+ onSubmit: w,
150
+ children: [
151
+ /* @__PURE__ */ q("h3", { children: "Import from this machine" }),
152
+ /* @__PURE__ */ J("p", {
153
+ className: "description",
154
+ children: [
155
+ "Reads the SSH key and global git configuration of the account running ",
156
+ /* @__PURE__ */ q("code", { children: "kuke serve" }),
157
+ " and stores them as one ",
158
+ a,
159
+ " identity: an SSH key identity when a key is found, else an author-only one. Rerunning updates it in place. Key material goes to the daemon only — it is never shown here."
160
+ ]
161
+ }),
162
+ /* @__PURE__ */ q(I, {
163
+ label: "Import",
164
+ inventory: t,
165
+ levels: [H[0]],
166
+ value: c,
167
+ disabled: p,
168
+ onChange: l
169
+ }),
170
+ /* @__PURE__ */ J("div", {
171
+ className: "schema-fields",
172
+ children: [
173
+ /* @__PURE__ */ J("label", {
174
+ className: "schema-field",
175
+ children: [
176
+ /* @__PURE__ */ q("span", { children: "Hosts" }),
177
+ /* @__PURE__ */ q("input", {
178
+ value: u.hosts,
179
+ placeholder: "github.com",
180
+ disabled: p,
181
+ autoComplete: "off",
182
+ spellCheck: !1,
183
+ onChange: (e) => C({ hosts: e.target.value })
184
+ }),
185
+ /* @__PURE__ */ q("small", { children: "Comma-separated hosts or URL prefixes the key authenticates." })
186
+ ]
187
+ }),
188
+ /* @__PURE__ */ J("label", {
189
+ className: "schema-field",
190
+ children: [/* @__PURE__ */ q("span", { children: "Identity name" }), /* @__PURE__ */ q("input", {
191
+ value: u.name,
192
+ placeholder: "git-ssh, or git-author without a key",
193
+ disabled: p,
194
+ autoComplete: "off",
195
+ spellCheck: !1,
196
+ onChange: (e) => C({ name: e.target.value })
197
+ })]
198
+ }),
199
+ /* @__PURE__ */ J("label", {
200
+ className: "schema-field",
201
+ children: [
202
+ /* @__PURE__ */ q("span", { children: "Key" }),
203
+ /* @__PURE__ */ q("input", {
204
+ value: u.key,
205
+ placeholder: ".ssh/id_ed25519",
206
+ disabled: p,
207
+ autoComplete: "off",
208
+ spellCheck: !1,
209
+ onChange: (e) => C({ key: e.target.value })
210
+ }),
211
+ /* @__PURE__ */ q("small", { children: "A file in the server account's home directory. Empty: the key git signs with, else id_ed25519, id_ecdsa, id_rsa." })
212
+ ]
213
+ }),
214
+ /* @__PURE__ */ J("label", {
215
+ className: "schema-field",
216
+ children: [
217
+ /* @__PURE__ */ q("span", { children: "Passphrase file" }),
218
+ /* @__PURE__ */ q("input", {
219
+ value: u.passphraseFile,
220
+ placeholder: ".ssh/passphrase",
221
+ disabled: p,
222
+ autoComplete: "off",
223
+ spellCheck: !1,
224
+ onChange: (e) => C({ passphraseFile: e.target.value })
225
+ }),
226
+ /* @__PURE__ */ q("small", { children: "For a passphrase-protected key: a file in the server account's home directory." })
227
+ ]
228
+ }),
229
+ /* @__PURE__ */ J("label", {
230
+ className: "schema-check",
231
+ children: [/* @__PURE__ */ q("input", {
232
+ type: "checkbox",
233
+ checked: u.makeDefault,
234
+ disabled: p,
235
+ onChange: (e) => C({ makeDefault: e.target.checked })
236
+ }), "Make it the Realm default"]
237
+ })
238
+ ]
239
+ }),
240
+ /* @__PURE__ */ q("div", {
241
+ className: "connector-actions",
242
+ children: /* @__PURE__ */ q("button", {
243
+ type: "submit",
244
+ disabled: p || !c.realm,
245
+ children: p ? "Importing…" : "Import identity"
246
+ })
247
+ }),
248
+ _ && /* @__PURE__ */ q(n, {
249
+ error: _,
250
+ kind: "Identity"
251
+ }),
252
+ y && /* @__PURE__ */ J("div", {
253
+ className: "connector-import-result",
254
+ role: "status",
255
+ "aria-label": "Imported identity",
256
+ children: [/* @__PURE__ */ J("dl", {
257
+ className: "details-grid",
258
+ children: [
259
+ /* @__PURE__ */ q("dt", { children: "Identity" }),
260
+ /* @__PURE__ */ J("dd", { children: [
261
+ /* @__PURE__ */ q("code", { children: y.name }),
262
+ " ",
263
+ /* @__PURE__ */ q("span", {
264
+ className: "description",
265
+ children: y.realm
266
+ }),
267
+ " ",
268
+ /* @__PURE__ */ q("span", {
269
+ className: "badge",
270
+ children: y.type
271
+ })
272
+ ] }),
273
+ /* @__PURE__ */ q("dt", { children: "Read from" }),
274
+ /* @__PURE__ */ J("dd", { children: [y.home, y.keyPath ? /* @__PURE__ */ J(K, { children: [" — key ", /* @__PURE__ */ q("code", { children: y.keyPath })] }) : /* @__PURE__ */ q(K, { children: " — no SSH key: author-only" })] }),
275
+ Object.keys(y.identity).length > 0 && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("dt", { children: "Fields" }), /* @__PURE__ */ q("dd", { children: Object.entries(y.identity).map(([e, t]) => /* @__PURE__ */ J("span", {
276
+ className: "badge label-badge",
277
+ children: [
278
+ e,
279
+ ": ",
280
+ t
281
+ ]
282
+ }, e)) })] }),
283
+ y.default && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("dt", { children: "Realm default" }), /* @__PURE__ */ J("dd", { children: [y.default.identity?.name, y.default.previous && y.default.previous.name !== y.default.identity?.name && /* @__PURE__ */ J(K, { children: [
284
+ " (replaces ",
285
+ /* @__PURE__ */ q("code", { children: y.default.previous.name }),
286
+ ")"
287
+ ] })] })] })
288
+ ]
289
+ }), !!y.notes?.length && /* @__PURE__ */ q("ul", {
290
+ className: "description",
291
+ children: y.notes.map((e) => /* @__PURE__ */ q("li", { children: e }, e))
292
+ })]
293
+ })
294
+ ]
295
+ })]
296
+ });
297
+ }
298
+ var Q = se("identity", "identities");
299
+ function be({ connector: e, identities: t, secretsError: n, revision: r, inventory: i, target: a, onChanged: s }) {
300
+ let c = e.title || e.name, l = D(e), [u, d] = G(), [p, m] = G(() => /* @__PURE__ */ new Set()), [h, _] = G([]), { notify: v } = f(), y = e.fields.map((e) => e.name);
301
+ async function b(e, t = !1) {
302
+ let n = o(e), r = k(n), i = L(n);
303
+ if (p.has(r)) return {
304
+ ok: !1,
305
+ message: "A delete of it is still running."
306
+ };
307
+ m((e) => new Set(e).add(r)), _((e) => e.filter((e) => e.target !== i));
308
+ try {
309
+ return await g(fe("secrets", [...N(n), n.name]), "{}"), t || v({
310
+ key: `identity-delete:${r}`,
311
+ tone: "success",
312
+ message: `${c} identity ${n.name} deleted.`
313
+ }), {
314
+ ok: !0,
315
+ message: ""
316
+ };
317
+ } catch (e) {
318
+ let n = V(e).message;
319
+ return t || _((e) => [...e, {
320
+ target: i,
321
+ message: n
322
+ }]), {
323
+ ok: !1,
324
+ message: n
325
+ };
326
+ } finally {
327
+ m((e) => {
328
+ let t = new Set(e);
329
+ return t.delete(r), t;
330
+ }), s();
331
+ }
332
+ }
333
+ let x = new Map(t.map((e) => [k(e), e])), S = ce([...x.keys()], !n), w = t.filter((e) => S.has(k(e))).map((e) => ({
334
+ key: k(e),
335
+ scope: [...N(e), e.name],
336
+ label: L(e),
337
+ identity: e
338
+ })), T = [{
339
+ name: "delete",
340
+ verb: "Delete",
341
+ danger: !0,
342
+ consequence: `Deletes each ${c} identity's Secret; a cell or team that uses one loses its credential.`,
343
+ reasonOf: (e) => p.has(e.key) ? "a delete of it is still running" : "",
344
+ acknowledgment: "I understand this permanently deletes every identity listed."
345
+ }];
346
+ return /* @__PURE__ */ J("section", {
347
+ className: "panel connector-identities",
348
+ "aria-label": `${c} identities`,
349
+ children: [
350
+ /* @__PURE__ */ J("div", {
351
+ className: "panel-heading",
352
+ children: [
353
+ /* @__PURE__ */ q("h2", { children: "Identities" }),
354
+ /* @__PURE__ */ J("span", {
355
+ className: "badge",
356
+ children: [t.length, " stored"]
357
+ }),
358
+ !l && /* @__PURE__ */ q("a", {
359
+ className: "document-action",
360
+ href: C(e.name, a),
361
+ children: "New identity"
362
+ })
363
+ ]
364
+ }),
365
+ /* @__PURE__ */ J("div", {
366
+ className: "panel-body",
367
+ children: [
368
+ /* @__PURE__ */ J("p", {
369
+ className: "description",
370
+ children: [
371
+ "An identity is a Secret tagged ",
372
+ /* @__PURE__ */ q("code", { children: e.name }),
373
+ ". Only its name, scope, type and readable fields are shown: values are write-only and never returned to the browser."
374
+ ]
375
+ }),
376
+ n && /* @__PURE__ */ J("p", {
377
+ className: "stale",
378
+ children: ["Identities could not be listed: ", n.message]
379
+ }),
380
+ h.map((e) => /* @__PURE__ */ J("div", {
381
+ className: "error",
382
+ role: "alert",
383
+ children: [/* @__PURE__ */ J("strong", { children: ["Delete failed: ", e.target] }), /* @__PURE__ */ q("p", { children: e.message })]
384
+ }, e.target)),
385
+ /* @__PURE__ */ q(oe, {
386
+ rows: w,
387
+ actions: T,
388
+ noun: Q,
389
+ selection: S,
390
+ run: (e) => b(e.identity, !0)
391
+ }),
392
+ t.length ? /* @__PURE__ */ q("div", {
393
+ className: "table-scroll",
394
+ children: /* @__PURE__ */ J("table", {
395
+ "aria-label": `${c} identities`,
396
+ children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ J("tr", { children: [
397
+ /* @__PURE__ */ q("th", {
398
+ scope: "col",
399
+ className: "bulk-column",
400
+ children: /* @__PURE__ */ q(le, {
401
+ selection: S,
402
+ matching: [...x.keys()],
403
+ label: `Select all ${Q(t.length)}`
404
+ })
405
+ }),
406
+ /* @__PURE__ */ q("th", {
407
+ scope: "col",
408
+ children: "Name"
409
+ }),
410
+ /* @__PURE__ */ q("th", {
411
+ scope: "col",
412
+ children: "Scope"
413
+ }),
414
+ /* @__PURE__ */ q("th", {
415
+ scope: "col",
416
+ children: "Type"
417
+ }),
418
+ /* @__PURE__ */ q("th", {
419
+ scope: "col",
420
+ children: "Identity"
421
+ }),
422
+ /* @__PURE__ */ q("th", {
423
+ scope: "col",
424
+ children: /* @__PURE__ */ q("span", {
425
+ className: "sr-only",
426
+ children: "Actions"
427
+ })
428
+ })
429
+ ] }) }), /* @__PURE__ */ q("tbody", { children: t.map((t) => /* @__PURE__ */ J("tr", { children: [
430
+ /* @__PURE__ */ q("td", {
431
+ className: "bulk-column",
432
+ children: /* @__PURE__ */ q(ue, {
433
+ selection: S,
434
+ rowKey: k(t),
435
+ label: `Select ${c} identity ${L(t)}`
436
+ })
437
+ }),
438
+ /* @__PURE__ */ q("td", { children: /* @__PURE__ */ q("a", {
439
+ className: "resource-name",
440
+ href: ge(t),
441
+ children: t.name
442
+ }) }),
443
+ /* @__PURE__ */ q("td", {
444
+ className: "scope-cell",
445
+ children: N(t).join(" / ")
446
+ }),
447
+ /* @__PURE__ */ q("td", { children: t.type }),
448
+ /* @__PURE__ */ J("td", { children: [[...y.filter((e) => e in t.identity), ...Object.keys(t.identity).filter((e) => !y.includes(e))].map((e) => /* @__PURE__ */ J("span", {
449
+ className: "badge label-badge",
450
+ children: [
451
+ e,
452
+ ": ",
453
+ t.identity[e]
454
+ ]
455
+ }, e)), !Object.keys(t.identity).length && /* @__PURE__ */ q("span", {
456
+ className: "description",
457
+ children: "—"
458
+ })] }),
459
+ /* @__PURE__ */ J("td", {
460
+ className: "connector-row-actions",
461
+ children: [/* @__PURE__ */ q("a", {
462
+ className: "subtle-button",
463
+ href: re(e.name, t, a),
464
+ "aria-label": `Rotate ${c} identity ${L(t)}`,
465
+ children: "Rotate"
466
+ }), /* @__PURE__ */ q("button", {
467
+ type: "button",
468
+ className: "subtle-button danger-action",
469
+ "aria-label": `Delete ${c} identity ${L(t)}`,
470
+ disabled: p.has(k(t)),
471
+ onClick: () => d(t),
472
+ children: p.has(k(t)) ? "Deleting…" : "Delete"
473
+ })]
474
+ })
475
+ ] }, k(t))) })]
476
+ })
477
+ }) : /* @__PURE__ */ J("p", { children: [
478
+ "No ",
479
+ c,
480
+ " identities are stored.",
481
+ !l && /* @__PURE__ */ J(K, { children: [
482
+ " ",
483
+ /* @__PURE__ */ q("a", {
484
+ href: C(e.name, a),
485
+ children: "Create one"
486
+ }),
487
+ "."
488
+ ] })
489
+ ] })
490
+ ]
491
+ }),
492
+ u && /* @__PURE__ */ q(de, {
493
+ kind: "secrets",
494
+ doc: { metadata: {
495
+ name: u.name,
496
+ realm: u.realm,
497
+ ...u.space ? { space: u.space } : {},
498
+ ...u.stack ? { stack: u.stack } : {}
499
+ } },
500
+ revision: r,
501
+ inventory: i,
502
+ onCancel: () => d(void 0),
503
+ onConfirm: () => {
504
+ let e = u;
505
+ d(void 0), b(e);
506
+ }
507
+ })
508
+ ]
509
+ });
510
+ }
511
+ function xe({ connector: e, logins: t, loginsError: r, inventory: a, target: o, onChanged: s }) {
512
+ let c = e.title || e.name, l = R(e), [u, d] = G(!1), [p, m] = G(""), [h, y] = G(""), [b, S] = Z(a, o && B(o, H[0])), [C, w] = G(""), [D, A] = G(), { notify: M } = f(), P = E(p), F = t.some((e) => k(e.volume) === k({
513
+ name: p.trim(),
514
+ ...b
515
+ }));
516
+ async function L(t, n) {
517
+ if (t.preventDefault(), !C) {
518
+ if (P || !b.realm) A({
519
+ code: "invalid_request",
520
+ message: P || "Choose where the login identity is stored."
521
+ });
522
+ else {
523
+ w(n ? "login" : "create"), A(void 0);
524
+ try {
525
+ n ? await i(e.name, {
526
+ name: p.trim(),
527
+ ...b
528
+ }, h || void 0) : (await g(x(e.name, "logins"), ee(p, b, h || void 0)), M({
529
+ key: `login-identity:${e.name}:${p.trim()}`,
530
+ tone: "success",
531
+ message: `${c} login identity ${p.trim()} created in ${_(b).join(" / ")}.`
532
+ }), m(""), d(!1)), s();
533
+ } catch (e) {
534
+ A(V(e));
535
+ } finally {
536
+ w("");
537
+ }
538
+ }
539
+ }
540
+ }
541
+ return /* @__PURE__ */ J("section", {
542
+ className: "panel connector-logins",
543
+ "aria-label": `${c} login identities`,
544
+ children: [/* @__PURE__ */ J("div", {
545
+ className: "panel-heading",
546
+ children: [
547
+ /* @__PURE__ */ q("h2", { children: "Login identities" }),
548
+ /* @__PURE__ */ J("span", {
549
+ className: "badge",
550
+ children: [t.length, " stored"]
551
+ }),
552
+ /* @__PURE__ */ q("button", {
553
+ type: "button",
554
+ className: "document-action",
555
+ "aria-expanded": u,
556
+ onClick: () => {
557
+ d((e) => !e), A(void 0);
558
+ },
559
+ children: u ? "Hide new login identity" : "New login identity"
560
+ })
561
+ ]
562
+ }), /* @__PURE__ */ J("div", {
563
+ className: "panel-body",
564
+ children: [
565
+ /* @__PURE__ */ J("p", {
566
+ className: "description",
567
+ children: [
568
+ "A login identity is a Volume tagged ",
569
+ /* @__PURE__ */ q("code", { children: e.name }),
570
+ ": the harness keeps its login in its state directory, and that directory is the Volume. ",
571
+ /* @__PURE__ */ q("strong", { children: "Log in" }),
572
+ " opens a short-lived identity cell that mounts only that Volume and runs the ",
573
+ c,
574
+ " login; the cell is deleted when the login ends. Only whether a login is present is shown — never the login itself. ",
575
+ j
576
+ ]
577
+ }),
578
+ r && /* @__PURE__ */ J("p", {
579
+ className: "stale",
580
+ children: ["Login identities could not be listed: ", r.message]
581
+ }),
582
+ u && /* @__PURE__ */ J("form", {
583
+ className: "creation-form identity-form",
584
+ "aria-label": `New ${c} login identity`,
585
+ method: "post",
586
+ autoComplete: "off",
587
+ onSubmit: (e) => void L(e, !1),
588
+ children: [
589
+ /* @__PURE__ */ J("h3", { children: [
590
+ "New ",
591
+ c,
592
+ " login identity"
593
+ ] }),
594
+ /* @__PURE__ */ q(O, {
595
+ title: "Login identity scope",
596
+ description: /* @__PURE__ */ q(K, { children: "Where the Volume is stored: a Realm, or a Space or Stack of it." }),
597
+ children: /* @__PURE__ */ q(I, {
598
+ label: "Login identity",
599
+ inventory: a,
600
+ levels: H,
601
+ value: b,
602
+ disabled: !!C,
603
+ onChange: S
604
+ })
605
+ }),
606
+ /* @__PURE__ */ J("div", {
607
+ className: "schema-fields",
608
+ children: [/* @__PURE__ */ J("label", {
609
+ className: "schema-field",
610
+ children: [
611
+ /* @__PURE__ */ J("span", { children: ["Login identity name", /* @__PURE__ */ q("b", {
612
+ "aria-label": "required",
613
+ children: " *"
614
+ })] }),
615
+ /* @__PURE__ */ q("input", {
616
+ value: p,
617
+ placeholder: "personal",
618
+ disabled: !!C,
619
+ autoComplete: "off",
620
+ spellCheck: !1,
621
+ "aria-invalid": !!p && !!P || void 0,
622
+ onChange: (e) => {
623
+ m(e.target.value), A(void 0);
624
+ }
625
+ }),
626
+ /* @__PURE__ */ q("small", { children: F ? "A login identity of this name already exists here: logging in logs in to it again." : "The Volume's name. It is created retained, so it outlives a purge of its scope." })
627
+ ]
628
+ }), l.length > 1 && /* @__PURE__ */ J("label", {
629
+ className: "schema-field",
630
+ children: [/* @__PURE__ */ q("span", { children: "Login method" }), /* @__PURE__ */ J("select", {
631
+ "aria-label": `${c} login method`,
632
+ value: h,
633
+ disabled: !!C,
634
+ onChange: (e) => y(e.target.value),
635
+ children: [/* @__PURE__ */ q("option", {
636
+ value: "",
637
+ children: "Default"
638
+ }), l.map((e) => /* @__PURE__ */ q("option", {
639
+ value: e.name,
640
+ children: e.name
641
+ }, e.name))]
642
+ })]
643
+ })]
644
+ }),
645
+ /* @__PURE__ */ J("div", {
646
+ className: "connector-actions",
647
+ children: [
648
+ /* @__PURE__ */ q("button", {
649
+ type: "button",
650
+ disabled: !!C || !b.realm || !p.trim(),
651
+ onClick: (e) => void L(e, !0),
652
+ children: C === "login" ? "Starting…" : "Create and log in"
653
+ }),
654
+ /* @__PURE__ */ q("button", {
655
+ type: "submit",
656
+ className: "subtle-button",
657
+ disabled: !!C || !b.realm || !p.trim(),
658
+ children: C === "create" ? "Creating…" : "Create without logging in"
659
+ }),
660
+ /* @__PURE__ */ q("button", {
661
+ type: "button",
662
+ className: "subtle-button",
663
+ disabled: !!C,
664
+ onClick: () => d(!1),
665
+ children: "Cancel"
666
+ })
667
+ ]
668
+ }),
669
+ D && /* @__PURE__ */ q(n, {
670
+ error: D,
671
+ kind: "Identity"
672
+ })
673
+ ]
674
+ }),
675
+ t.length ? /* @__PURE__ */ q("div", {
676
+ className: "table-scroll",
677
+ children: /* @__PURE__ */ J("table", {
678
+ "aria-label": `${c} login identities`,
679
+ children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ J("tr", { children: [
680
+ /* @__PURE__ */ q("th", {
681
+ scope: "col",
682
+ children: "Name"
683
+ }),
684
+ /* @__PURE__ */ q("th", {
685
+ scope: "col",
686
+ children: "Scope"
687
+ }),
688
+ /* @__PURE__ */ q("th", {
689
+ scope: "col",
690
+ children: "Status"
691
+ }),
692
+ /* @__PURE__ */ q("th", {
693
+ scope: "col",
694
+ children: "Used by"
695
+ }),
696
+ /* @__PURE__ */ q("th", {
697
+ scope: "col",
698
+ children: /* @__PURE__ */ q("span", {
699
+ className: "sr-only",
700
+ children: "Actions"
701
+ })
702
+ })
703
+ ] }) }), /* @__PURE__ */ q("tbody", { children: t.map((t) => /* @__PURE__ */ J("tr", { children: [
704
+ /* @__PURE__ */ J("td", { children: [
705
+ t.exists ? /* @__PURE__ */ q("a", {
706
+ className: "resource-name",
707
+ href: v(t.volume),
708
+ children: t.volume.name
709
+ }) : /* @__PURE__ */ q("span", {
710
+ className: "resource-name",
711
+ children: t.volume.name
712
+ }),
713
+ !t.exists && /* @__PURE__ */ J(K, { children: [" ", /* @__PURE__ */ q("span", {
714
+ className: "badge",
715
+ children: "Not created yet"
716
+ })] }),
717
+ t.session && /* @__PURE__ */ J(K, { children: [" ", /* @__PURE__ */ q("span", {
718
+ className: "badge",
719
+ children: "Login running"
720
+ })] })
721
+ ] }),
722
+ /* @__PURE__ */ q("td", {
723
+ className: "scope-cell",
724
+ children: N(t.volume).join(" / ")
725
+ }),
726
+ /* @__PURE__ */ J("td", { children: [/* @__PURE__ */ q(ne, { state: t.state }), t.since && /* @__PURE__ */ J("span", {
727
+ className: "description",
728
+ children: [" since ", new Date(t.since).toLocaleString()]
729
+ })] }),
730
+ /* @__PURE__ */ q("td", { children: t.usedBy.length ? t.usedBy.map((e) => /* @__PURE__ */ q("a", {
731
+ className: "badge label-badge",
732
+ href: X(e),
733
+ children: e.name
734
+ }, X(e))) : /* @__PURE__ */ q("span", {
735
+ className: "description",
736
+ children: "—"
737
+ }) }),
738
+ /* @__PURE__ */ q("td", {
739
+ className: "connector-row-actions",
740
+ children: /* @__PURE__ */ q(T, {
741
+ connector: e.name,
742
+ title: c,
743
+ volume: t.volume,
744
+ state: t.state,
745
+ running: !!t.session,
746
+ method: t.method || void 0,
747
+ onStarted: s
748
+ })
749
+ })
750
+ ] }, k(t.volume))) })]
751
+ })
752
+ }) : /* @__PURE__ */ J("p", { children: [
753
+ "No ",
754
+ c,
755
+ " login identities are stored.",
756
+ !u && /* @__PURE__ */ J(K, { children: [
757
+ " ",
758
+ /* @__PURE__ */ q("button", {
759
+ type: "button",
760
+ className: "subtle-button",
761
+ onClick: () => d(!0),
762
+ children: "Create one"
763
+ }),
764
+ "."
765
+ ] })
766
+ ] })
767
+ ]
768
+ })]
769
+ });
770
+ }
771
+ var Se = "import", $ = "manual";
772
+ function Ce({ connector: e, tokenConnector: t, target: n, choice: r, onChoose: i }) {
773
+ let a = e.title || e.name, o = t ? t.title || t.name : "", s = (e, t, n) => /* @__PURE__ */ J("button", {
774
+ type: "button",
775
+ className: `identity-choice${r === e ? " is-selected" : ""}`,
776
+ "aria-pressed": r === e,
777
+ onClick: () => i(e),
778
+ children: [/* @__PURE__ */ q("strong", { children: t }), /* @__PURE__ */ q("span", {
779
+ className: "description",
780
+ children: n
781
+ })]
782
+ });
783
+ return /* @__PURE__ */ J("div", {
784
+ className: "identity-choices",
785
+ role: "group",
786
+ "aria-label": `How to add a ${a} identity`,
787
+ children: [
788
+ s(Se, "Import from this machine", "The SSH key and git author of the account running kuke serve: clone, push and sign."),
789
+ t && /* @__PURE__ */ J("a", {
790
+ className: "identity-choice",
791
+ href: C(t.name, n),
792
+ children: [/* @__PURE__ */ J("strong", { children: [
793
+ "Use a ",
794
+ o,
795
+ " token"
796
+ ] }), /* @__PURE__ */ J("span", {
797
+ className: "description",
798
+ children: [
799
+ "One personal access token for the ",
800
+ o,
801
+ " API and for git over HTTPS on ",
802
+ d(t)?.hosts.join(", "),
803
+ ". No signing."
804
+ ]
805
+ })]
806
+ }),
807
+ s($, "Enter a key or password", "Paste an SSH key, a username with a password or token, or store an author only.")
808
+ ]
809
+ });
810
+ }
811
+ function we({ connector: t, connectors: n, action: r, identity: i, target: a, identities: s, secrets: c, secretsLoading: f, inventory: m, onChanged: h }) {
812
+ let g = t.title || t.name, v = z(t.name, a), y = () => {
813
+ p(v);
814
+ }, b = () => {
815
+ h(), y();
816
+ }, x = u(t), [S, C] = Z(m, a && B(a, x.includes(H[0]) ? H[0] : x[0])), T = !!S.realm && x.includes(w(S)), E = r === "rotate-identity", D = i ? k({
817
+ name: i.at(-1) ?? "",
818
+ ...ie(i.slice(0, -1))
819
+ }) : "", O = E ? s.find((e) => k(e) === D) : void 0, A = e(t), [j, N] = G(A ? "" : $);
820
+ return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("div", {
821
+ className: "detail-actions",
822
+ children: /* @__PURE__ */ J("a", {
823
+ href: v,
824
+ children: ["← Back to ", g]
825
+ })
826
+ }), /* @__PURE__ */ q("section", {
827
+ className: "panel connector-identity-page",
828
+ "aria-label": E ? `Rotate ${g} identity` : `New ${g} identity`,
829
+ children: /* @__PURE__ */ q("div", {
830
+ className: "panel-body",
831
+ children: E ? O ? /* @__PURE__ */ q(F, {
832
+ connector: t,
833
+ scope: o(O),
834
+ existing: O,
835
+ secrets: c,
836
+ onSaved: b,
837
+ onCancel: y
838
+ }, `rotate:${k(O)}`) : f ? /* @__PURE__ */ q("p", {
839
+ role: "status",
840
+ children: "Loading identities…"
841
+ }) : /* @__PURE__ */ J("div", {
842
+ className: "error",
843
+ role: "alert",
844
+ children: [/* @__PURE__ */ q("strong", { children: "Identity not found" }), /* @__PURE__ */ J("p", { children: [
845
+ "No ",
846
+ g,
847
+ " identity ",
848
+ i?.at(-1) ? /* @__PURE__ */ q("code", { children: i.at(-1) }) : "",
849
+ " is stored",
850
+ i && i.length > 1 ? /* @__PURE__ */ J(K, { children: [" in ", i.slice(0, -1).join(" / ")] }) : "",
851
+ ". ",
852
+ /* @__PURE__ */ J("a", {
853
+ href: v,
854
+ children: ["Back to ", g]
855
+ })
856
+ ] })]
857
+ }) : /* @__PURE__ */ J(K, { children: [
858
+ A && /* @__PURE__ */ q(Ce, {
859
+ connector: t,
860
+ tokenConnector: l(n).find((e) => d(e)?.connector === t.name),
861
+ target: a,
862
+ choice: j,
863
+ onChoose: N
864
+ }),
865
+ j === $ && /* @__PURE__ */ J(K, { children: [
866
+ /* @__PURE__ */ q(M, {
867
+ label: "Identity",
868
+ connector: t,
869
+ inventory: m,
870
+ value: S,
871
+ onChange: C
872
+ }),
873
+ S.realm && !T && /* @__PURE__ */ J("p", {
874
+ className: "field-error",
875
+ role: "alert",
876
+ children: [
877
+ g,
878
+ " identities are stored at ",
879
+ x.join(" or "),
880
+ " level."
881
+ ]
882
+ }),
883
+ /* @__PURE__ */ q(F, {
884
+ connector: t,
885
+ scope: S,
886
+ secrets: c,
887
+ onSaved: b,
888
+ onCancel: y
889
+ }, `new:${_(S).join("/")}`)
890
+ ] }),
891
+ j === Se && /* @__PURE__ */ q(ye, {
892
+ connector: t,
893
+ inventory: m,
894
+ initiallyOpen: !0,
895
+ onChanged: h
896
+ })
897
+ ] })
898
+ })
899
+ })] });
900
+ }
901
+ function Te({ connector: e, target: t, scope: r, row: i, identities: a, onChanged: s }) {
902
+ let c = e.title || e.name, l = t.method ? `${c} ${t.method}` : c, d = A(e, r), p = H.filter((e) => w(B(r, e)) === e), [m, h] = G(""), [v, y] = G(), [b, S] = G(!1), [T, E] = G(!1), [D, O] = G(), { notify: k } = f(), j = d.includes(m) ? m : d.at(-1) ?? "", M = o(v);
903
+ async function P(n, i) {
904
+ if (!T && n) {
905
+ E(!0), O(void 0);
906
+ try {
907
+ await g(x(e.name, "defaults"), {
908
+ scope: B(r, n),
909
+ ...t.method ? { method: t.method } : {},
910
+ identity: i
911
+ }), k({
912
+ key: `connector-default:${e.name}:${t.method}`,
913
+ tone: "success",
914
+ message: i ? `${l} default set to ${i.name} at ${U(n, r)}.` : `${l} default cleared at ${U(n, r)}.`
915
+ }), y(void 0), s();
916
+ } catch (e) {
917
+ O(V(e));
918
+ } finally {
919
+ E(!1);
920
+ }
921
+ }
922
+ }
923
+ let F = p.filter((e) => i?.levels?.[e]).length;
924
+ return /* @__PURE__ */ J("div", {
925
+ className: "connector-default",
926
+ role: "group",
927
+ "aria-label": `${l} default`,
928
+ children: [
929
+ /* @__PURE__ */ q("h3", { children: t.method ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("code", { children: t.method }), " method"] }) : "Resolves to" }),
930
+ /* @__PURE__ */ q("p", {
931
+ className: `connector-effective${i?.effective ? "" : " is-unresolved"}`,
932
+ role: "status",
933
+ children: i?.effective ? /* @__PURE__ */ J(K, { children: [
934
+ /* @__PURE__ */ q("strong", {
935
+ className: "connector-effective-name",
936
+ children: i.effective.name
937
+ }),
938
+ " ",
939
+ /* @__PURE__ */ q("span", {
940
+ className: "description",
941
+ children: N(i.effective).join(" / ")
942
+ }),
943
+ " ",
944
+ /* @__PURE__ */ q("span", {
945
+ className: "badge",
946
+ children: i.origin ? `${i.origin[0].toUpperCase()}${i.origin.slice(1)} default` : "Default"
947
+ }),
948
+ i.origin && /* @__PURE__ */ J("span", {
949
+ className: "description",
950
+ children: [
951
+ " — from the ",
952
+ U(i.origin, r),
953
+ " level"
954
+ ]
955
+ })
956
+ ] }) : /* @__PURE__ */ J(K, { children: [
957
+ /* @__PURE__ */ q("strong", {
958
+ className: "connector-effective-name",
959
+ children: "No default resolves in this scope."
960
+ }),
961
+ " ",
962
+ /* @__PURE__ */ q("span", {
963
+ className: "description",
964
+ children: "A Config here that picks no identity cannot create cells."
965
+ })
966
+ ] })
967
+ }),
968
+ /* @__PURE__ */ J("p", {
969
+ className: "description",
970
+ children: [
971
+ "Delivered as ",
972
+ Y({
973
+ delivery: t.delivery,
974
+ ...e.methods.find((e) => e.name === t.method)
975
+ }),
976
+ ".",
977
+ t.description && /* @__PURE__ */ J(K, { children: [" ", t.description] })
978
+ ]
979
+ }),
980
+ /* @__PURE__ */ J("div", {
981
+ className: "schema-fields",
982
+ children: [/* @__PURE__ */ J("label", {
983
+ className: "schema-field",
984
+ children: [/* @__PURE__ */ q("span", { children: "Level" }), /* @__PURE__ */ q("select", {
985
+ "aria-label": `${l} default level`,
986
+ value: j,
987
+ disabled: T || !d.length,
988
+ onChange: (e) => h(e.target.value),
989
+ children: d.map((e) => /* @__PURE__ */ q("option", {
990
+ value: e,
991
+ children: U(e, r)
992
+ }, e))
993
+ })]
994
+ }), a.length ? /* @__PURE__ */ q(te, {
995
+ label: `${l} default identity`,
996
+ identities: a,
997
+ value: v,
998
+ emptyLabel: "Select an identity…",
999
+ disabled: T,
1000
+ realm: r.realm,
1001
+ onChange: y
1002
+ }) : /* @__PURE__ */ J("div", {
1003
+ className: "schema-field",
1004
+ children: [/* @__PURE__ */ q("span", { children: "Identity" }), /* @__PURE__ */ J("p", {
1005
+ className: "description",
1006
+ children: [
1007
+ "No ",
1008
+ c,
1009
+ " identity is stored. ",
1010
+ /* @__PURE__ */ q("a", {
1011
+ href: C(e.name, r),
1012
+ children: "Create an identity"
1013
+ }),
1014
+ " to set it as the default."
1015
+ ]
1016
+ })]
1017
+ })]
1018
+ }),
1019
+ a.length > 0 && /* @__PURE__ */ q("div", {
1020
+ className: "connector-actions",
1021
+ children: /* @__PURE__ */ q("button", {
1022
+ type: "button",
1023
+ disabled: !M || !j || T,
1024
+ onClick: () => void P(j, M ?? null),
1025
+ children: T ? "Saving…" : "Set default"
1026
+ })
1027
+ }),
1028
+ D && /* @__PURE__ */ q(n, {
1029
+ error: D,
1030
+ kind: "Scope"
1031
+ }),
1032
+ /* @__PURE__ */ q(he, {
1033
+ level: 3,
1034
+ className: "connector-default-levels",
1035
+ title: "Defaults by level",
1036
+ summary: `${F} of ${p.length} set`,
1037
+ label: `${l} defaults by level`,
1038
+ open: b,
1039
+ onToggle: S,
1040
+ children: /* @__PURE__ */ q("div", {
1041
+ className: "table-scroll",
1042
+ children: /* @__PURE__ */ J("table", {
1043
+ "aria-label": `${l} defaults by level`,
1044
+ children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ J("tr", { children: [
1045
+ /* @__PURE__ */ q("th", {
1046
+ scope: "col",
1047
+ children: "Level"
1048
+ }),
1049
+ /* @__PURE__ */ q("th", {
1050
+ scope: "col",
1051
+ children: "Scope"
1052
+ }),
1053
+ /* @__PURE__ */ q("th", {
1054
+ scope: "col",
1055
+ children: "Default identity"
1056
+ }),
1057
+ /* @__PURE__ */ q("th", {
1058
+ scope: "col",
1059
+ children: /* @__PURE__ */ q("span", {
1060
+ className: "sr-only",
1061
+ children: "Actions"
1062
+ })
1063
+ })
1064
+ ] }) }), /* @__PURE__ */ q("tbody", { children: p.map((t) => {
1065
+ let n = i?.levels?.[t];
1066
+ return /* @__PURE__ */ J("tr", { children: [
1067
+ /* @__PURE__ */ q("td", { children: t }),
1068
+ /* @__PURE__ */ q("td", {
1069
+ className: "scope-cell",
1070
+ children: _(B(r, t)).join(" / ")
1071
+ }),
1072
+ /* @__PURE__ */ J("td", { children: [n ? /* @__PURE__ */ J(K, { children: [
1073
+ /* @__PURE__ */ q("code", { children: n.name }),
1074
+ " ",
1075
+ /* @__PURE__ */ q("span", {
1076
+ className: "description",
1077
+ children: N(n).join(" / ")
1078
+ })
1079
+ ] }) : d.includes(t) ? /* @__PURE__ */ q("span", {
1080
+ className: "description",
1081
+ children: "Not set"
1082
+ }) : /* @__PURE__ */ J("span", {
1083
+ className: "description",
1084
+ children: [
1085
+ "Not available: ",
1086
+ c,
1087
+ " defaults are set at ",
1088
+ u(e).join(" or "),
1089
+ " level"
1090
+ ]
1091
+ }), i?.origin === t && /* @__PURE__ */ J(K, { children: [" ", /* @__PURE__ */ q("span", {
1092
+ className: "badge",
1093
+ children: "Effective"
1094
+ })] })] }),
1095
+ /* @__PURE__ */ q("td", {
1096
+ className: "connector-row-actions",
1097
+ children: n && d.includes(t) && /* @__PURE__ */ q("button", {
1098
+ type: "button",
1099
+ className: "subtle-button",
1100
+ "aria-label": `Clear ${l} default at ${t} level`,
1101
+ disabled: T,
1102
+ onClick: () => void P(t, null),
1103
+ children: "Clear"
1104
+ })
1105
+ })
1106
+ ] }, t);
1107
+ }) })]
1108
+ })
1109
+ })
1110
+ })
1111
+ ]
1112
+ });
1113
+ }
1114
+ function Ee({ connector: e, identities: t, revision: i, inventory: o, initialScope: c, onChanged: l }) {
1115
+ let d = e.title || e.name, f = s(e), [p, m] = Z(o, c), h = y(p.realm && f.length ? `/connectors/defaults?${a(p)}` : null, i);
1116
+ if (!f.length) return null;
1117
+ let g = u(e);
1118
+ return /* @__PURE__ */ J("section", {
1119
+ className: "panel connector-defaults",
1120
+ "aria-label": `${d} default identity`,
1121
+ children: [/* @__PURE__ */ J("div", {
1122
+ className: "panel-heading",
1123
+ children: [/* @__PURE__ */ q("h2", { children: "Default identity" }), /* @__PURE__ */ q("span", {
1124
+ className: "badge",
1125
+ children: g.join(" · ")
1126
+ })]
1127
+ }), /* @__PURE__ */ J("div", {
1128
+ className: "panel-body",
1129
+ children: [
1130
+ /* @__PURE__ */ J("p", {
1131
+ className: "description",
1132
+ children: [
1133
+ "A default fills ",
1134
+ d,
1135
+ " for every Config in the scope that picked no identity. The deepest level wins: Stack over Space over Realm. Changing one takes effect at once — no Config is re-rendered."
1136
+ ]
1137
+ }),
1138
+ /* @__PURE__ */ q(O, {
1139
+ title: "Which cells?",
1140
+ description: /* @__PURE__ */ q(K, { children: "Pick a Realm, or a Space or Stack in it, to see the identity its cells get when they pick none, and to change it." }),
1141
+ children: /* @__PURE__ */ q(I, {
1142
+ label: "Default",
1143
+ inventory: o,
1144
+ levels: g,
1145
+ value: p,
1146
+ onChange: m
1147
+ })
1148
+ }),
1149
+ p.realm ? /* @__PURE__ */ J(K, { children: [
1150
+ h.loading && !h.data && /* @__PURE__ */ q("p", {
1151
+ role: "status",
1152
+ children: "Loading defaults…"
1153
+ }),
1154
+ h.error && /* @__PURE__ */ q(n, {
1155
+ error: h.error,
1156
+ kind: "Scope"
1157
+ }),
1158
+ h.error && h.data && /* @__PURE__ */ q("p", {
1159
+ className: "stale",
1160
+ children: "Showing stale defaults — refresh failed."
1161
+ }),
1162
+ f.map((n) => /* @__PURE__ */ q(Te, {
1163
+ connector: e,
1164
+ target: n,
1165
+ scope: p,
1166
+ row: r(h.data, {
1167
+ connector: e.name,
1168
+ component: n.component,
1169
+ method: n.method
1170
+ }),
1171
+ identities: t,
1172
+ onChanged: l
1173
+ }, `${n.method}:${_(p).join("/")}`))
1174
+ ] }) : /* @__PURE__ */ q("p", {
1175
+ className: "description",
1176
+ children: "Choose a Realm to see and set its defaults."
1177
+ })
1178
+ ]
1179
+ })]
1180
+ });
1181
+ }
1182
+ function De({ connector: e, connectors: t, usage: n, secrets: r, logins: i, loginsError: a, secretsError: o, secretsLoading: l, target: d, action: f, identity: p, revision: h, inventory: g, onChanged: v }) {
1183
+ let y = e.title || e.name, { configs: x, missing: C } = ae(n, e.name), w = b(r, e.name), T = D(e), E = T || s(e).length > 0, O = R(e).length > 0, k = S(i, e.name);
1184
+ return f && E && !T ? /* @__PURE__ */ q(we, {
1185
+ connector: e,
1186
+ connectors: t,
1187
+ action: f,
1188
+ identity: p,
1189
+ target: d,
1190
+ identities: w,
1191
+ secrets: r,
1192
+ secretsLoading: l,
1193
+ inventory: g,
1194
+ onChanged: v
1195
+ }) : /* @__PURE__ */ J(K, { children: [
1196
+ /* @__PURE__ */ q("div", {
1197
+ className: "detail-actions",
1198
+ children: /* @__PURE__ */ q("a", {
1199
+ href: z(),
1200
+ children: "← Back to connectors"
1201
+ })
1202
+ }),
1203
+ /* @__PURE__ */ J("section", {
1204
+ className: "panel",
1205
+ "aria-label": `${y} connector`,
1206
+ children: [/* @__PURE__ */ J("div", {
1207
+ className: "panel-heading",
1208
+ children: [/* @__PURE__ */ q("h2", { children: y }), C.length ? /* @__PURE__ */ q("span", {
1209
+ className: "badge needs-connector",
1210
+ children: "Needs a default"
1211
+ }) : /* @__PURE__ */ q("span", {
1212
+ className: "badge",
1213
+ children: e.name
1214
+ })]
1215
+ }), /* @__PURE__ */ J("div", {
1216
+ className: "panel-body",
1217
+ children: [
1218
+ e.description && /* @__PURE__ */ q("p", { children: e.description }),
1219
+ !T && r && i && !me(e, r, i) && /* @__PURE__ */ q("p", {
1220
+ className: "connector-not-set-up",
1221
+ role: "note",
1222
+ children: pe(e)
1223
+ }),
1224
+ /* @__PURE__ */ J("dl", {
1225
+ className: "details-grid",
1226
+ children: [
1227
+ /* @__PURE__ */ q("dt", { children: "Name" }),
1228
+ /* @__PURE__ */ q("dd", { children: /* @__PURE__ */ q("code", { children: e.name }) }),
1229
+ /* @__PURE__ */ q("dt", { children: "Delivered as" }),
1230
+ /* @__PURE__ */ q("dd", { children: e.methods.length ? /* @__PURE__ */ q("ul", {
1231
+ className: "connector-methods",
1232
+ children: e.methods.map((e) => /* @__PURE__ */ J("li", { children: [
1233
+ /* @__PURE__ */ q("code", { children: e.name }),
1234
+ e.default && /* @__PURE__ */ J(K, { children: [" ", /* @__PURE__ */ q("span", {
1235
+ className: "badge",
1236
+ children: "default method"
1237
+ })] }),
1238
+ " — ",
1239
+ Y(e),
1240
+ e.description && /* @__PURE__ */ J("span", {
1241
+ className: "description",
1242
+ children: [" ", e.description]
1243
+ })
1244
+ ] }, e.name))
1245
+ }) : Y({ delivery: e.delivery ?? "" }) }),
1246
+ /* @__PURE__ */ q("dt", { children: "Identity" }),
1247
+ /* @__PURE__ */ q("dd", { children: E ? /* @__PURE__ */ J(K, { children: [
1248
+ e.secretTypes.join(" or "),
1249
+ " Secret",
1250
+ e.fields.length > 0 && /* @__PURE__ */ J(K, { children: [" with ", e.fields.map((e) => e.name).join(", ")] }),
1251
+ O && /* @__PURE__ */ J(K, { children: [
1252
+ ", or a login identity (a Volume) for the ",
1253
+ R(e).map((e) => e.name).join(", "),
1254
+ " method"
1255
+ ] })
1256
+ ] }) : O ? "A login identity — a Volume holding the harness login" : "None" }),
1257
+ /* @__PURE__ */ q("dt", { children: "Default scopes" }),
1258
+ /* @__PURE__ */ q("dd", { children: u(e).join(", ") }),
1259
+ e.harness && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("dt", { children: "Harness" }), /* @__PURE__ */ q("dd", { children: e.harness })] }),
1260
+ e.group && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("dt", { children: "Method group" }), /* @__PURE__ */ J("dd", { children: [e.group, " — a Config enables exactly one method"] })] }),
1261
+ /* @__PURE__ */ q("dt", { children: "Configs" }),
1262
+ /* @__PURE__ */ q("dd", { children: n ? /* @__PURE__ */ J(K, { children: [
1263
+ x,
1264
+ " require it",
1265
+ e.optional && " (a cell starts without it)"
1266
+ ] }) : "Not loaded" })
1267
+ ]
1268
+ }),
1269
+ O && /* @__PURE__ */ J("p", {
1270
+ className: "description",
1271
+ children: [
1272
+ "The ",
1273
+ R(e).map((e) => e.name).join(", "),
1274
+ " method keeps its login in a login identity. Create one and log in below; every cell of the role that uses it then starts logged in."
1275
+ ]
1276
+ })
1277
+ ]
1278
+ })]
1279
+ }),
1280
+ C.length > 0 && /* @__PURE__ */ J("section", {
1281
+ className: "panel connector-missing",
1282
+ "aria-label": `Configs without a ${y} identity`,
1283
+ children: [/* @__PURE__ */ J("div", {
1284
+ className: "panel-heading",
1285
+ children: [/* @__PURE__ */ q("h2", { children: "Needs a default" }), /* @__PURE__ */ J("span", {
1286
+ className: "badge needs-connector",
1287
+ children: [
1288
+ C.length,
1289
+ " ",
1290
+ C.length === 1 ? "Config" : "Configs",
1291
+ " without an identity"
1292
+ ]
1293
+ })]
1294
+ }), /* @__PURE__ */ J("div", {
1295
+ className: "panel-body",
1296
+ children: [/* @__PURE__ */ J("p", {
1297
+ className: "description",
1298
+ children: [
1299
+ "No cell can be created from these Configs until ",
1300
+ y,
1301
+ " has an identity. Set a default below for their scope, or pick one in the Config."
1302
+ ]
1303
+ }), /* @__PURE__ */ q("ul", {
1304
+ className: "state-list",
1305
+ children: C.map((t) => /* @__PURE__ */ J("li", { children: [/* @__PURE__ */ J("div", { children: [
1306
+ /* @__PURE__ */ q("a", {
1307
+ className: "resource-name",
1308
+ href: X(t.config),
1309
+ children: t.config.name
1310
+ }),
1311
+ /* @__PURE__ */ J("p", {
1312
+ className: "description",
1313
+ children: [[
1314
+ t.config.realm,
1315
+ t.config.space,
1316
+ t.config.stack
1317
+ ].filter(Boolean).join(" / "), t.method && /* @__PURE__ */ J(K, { children: [
1318
+ " · ",
1319
+ t.method,
1320
+ " method"
1321
+ ] })]
1322
+ }),
1323
+ t.message && /* @__PURE__ */ q("p", {
1324
+ className: "setup-error",
1325
+ children: t.message
1326
+ })
1327
+ ] }), /* @__PURE__ */ q("a", {
1328
+ className: "document-action",
1329
+ href: z(e.name, m(t.config)),
1330
+ "aria-label": `Set a ${y} default for the scope of ${t.config.name}`,
1331
+ children: "Set a default for its scope"
1332
+ })] }, `${X(t.config)}:${t.component}`))
1333
+ })]
1334
+ })]
1335
+ }),
1336
+ /* @__PURE__ */ q(Ee, {
1337
+ connector: e,
1338
+ identities: w,
1339
+ revision: h,
1340
+ inventory: g,
1341
+ initialScope: d,
1342
+ onChanged: v
1343
+ }, `defaults:${_(d).join("/")}`),
1344
+ T && /* @__PURE__ */ q("section", {
1345
+ className: "panel connector-registry-notice",
1346
+ "aria-label": `${y} on the Images page`,
1347
+ children: /* @__PURE__ */ q("div", {
1348
+ className: "panel-body",
1349
+ children: /* @__PURE__ */ J("p", {
1350
+ role: "note",
1351
+ children: [
1352
+ "A registry credential authenticates a Realm's image pulls; nothing of it is injected into a cell. Registry credentials are listed and added on the ",
1353
+ /* @__PURE__ */ q("a", {
1354
+ href: c(d?.realm),
1355
+ children: "Images"
1356
+ }),
1357
+ " page, per Realm."
1358
+ ]
1359
+ })
1360
+ })
1361
+ }),
1362
+ O && /* @__PURE__ */ q(xe, {
1363
+ connector: e,
1364
+ logins: k,
1365
+ loginsError: a,
1366
+ inventory: g,
1367
+ target: d,
1368
+ onChanged: v
1369
+ }),
1370
+ E && !T && /* @__PURE__ */ q(be, {
1371
+ connector: e,
1372
+ identities: w,
1373
+ secretsError: o,
1374
+ revision: h,
1375
+ inventory: g,
1376
+ target: d,
1377
+ onChanged: v
1378
+ })
1379
+ ] });
1380
+ }
1381
+ function Oe({ name: e, target: t, action: r, identity: i, revision: a, inventory: o, onChanged: s, onTitle: c }) {
1382
+ let l = y("/connectors", a), u = y("/connectors/status", a), d = y("/catalog/secrets", a), [f, p] = G(0), m = y("/connectors/logins", a + f), h = (m.data ?? []).some((e) => !!e?.session);
1383
+ W(() => {
1384
+ if (!h) return;
1385
+ let e = window.setInterval(() => p((e) => e + 1), 3e3);
1386
+ return () => window.clearInterval(e);
1387
+ }, [h]);
1388
+ let g = e ? l.data?.find((t) => t.name === e) : void 0, _ = t?.length ? ie(t) : void 0, v = g?.name, b = g?.title;
1389
+ return W(() => {
1390
+ v && c?.({
1391
+ name: v,
1392
+ title: b || v
1393
+ });
1394
+ }, [
1395
+ v,
1396
+ b,
1397
+ c
1398
+ ]), /* @__PURE__ */ J(K, { children: [
1399
+ l.loading && !l.data && /* @__PURE__ */ q("p", {
1400
+ role: "status",
1401
+ children: "Loading connectors…"
1402
+ }),
1403
+ l.error && /* @__PURE__ */ q(n, {
1404
+ error: l.error,
1405
+ kind: "Connector"
1406
+ }),
1407
+ l.error && l.data && /* @__PURE__ */ q("p", {
1408
+ className: "stale",
1409
+ children: "Stale connector catalog — refresh failed."
1410
+ }),
1411
+ u.error && /* @__PURE__ */ J("p", {
1412
+ className: "stale",
1413
+ children: ["Config usage could not be loaded: ", u.error.message]
1414
+ }),
1415
+ !e && d.error && /* @__PURE__ */ J("p", {
1416
+ className: "stale",
1417
+ children: ["Identities could not be listed: ", d.error.message]
1418
+ }),
1419
+ !e && /* @__PURE__ */ q("p", {
1420
+ className: "description connectors-intro",
1421
+ children: "A connector is a kind of access a cell needs. An identity is the stored credential that fills it — chosen per cell or per Config, or inherited from a Realm, Space or Stack default."
1422
+ }),
1423
+ l.data && !e && /* @__PURE__ */ q(ve, {
1424
+ connectors: P(l.data),
1425
+ usage: u.data,
1426
+ secrets: d.data,
1427
+ logins: m.data
1428
+ }),
1429
+ l.data && e && !g && /* @__PURE__ */ J("div", {
1430
+ className: "error",
1431
+ role: "alert",
1432
+ children: [/* @__PURE__ */ q("strong", { children: "Unknown connector" }), /* @__PURE__ */ J("p", { children: [
1433
+ "No connector named ",
1434
+ e,
1435
+ " is defined. ",
1436
+ /* @__PURE__ */ q("a", {
1437
+ href: z(),
1438
+ children: "Back to connectors"
1439
+ })
1440
+ ] })]
1441
+ }),
1442
+ g && /* @__PURE__ */ q(De, {
1443
+ connector: g,
1444
+ connectors: l.data ?? [],
1445
+ usage: u.data,
1446
+ secrets: d.data,
1447
+ logins: m.data,
1448
+ loginsError: m.error,
1449
+ secretsError: d.error,
1450
+ secretsLoading: d.loading && !d.data,
1451
+ target: _,
1452
+ action: r,
1453
+ identity: i,
1454
+ revision: a,
1455
+ inventory: o,
1456
+ onChanged: s
1457
+ }, g.name)
1458
+ ] });
1459
+ }
1460
+ export { Oe as ConnectorsPage };