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

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 (101) hide show
  1. package/dist/assignments-Biqg1AT0.js +257 -0
  2. package/dist/assignments-tab.d.ts +4 -0
  3. package/dist/assignments.d.mts +40 -0
  4. package/dist/auth.d.ts +39 -0
  5. package/dist/bulk-ui.d.ts +49 -0
  6. package/dist/bulk.d.mts +14 -0
  7. package/dist/catalog-ChPGZP2a.js +1949 -0
  8. package/dist/catalog-url-Dr9e92Yq.js +19 -0
  9. package/dist/catalog-url.d.mts +4 -0
  10. package/dist/catalog.d.ts +40 -0
  11. package/dist/cell-filter.d.ts +10 -0
  12. package/dist/cell-sidebar.d.ts +26 -0
  13. package/dist/cells.d.mts +29 -0
  14. package/dist/cgroup-format.d.ts +17 -0
  15. package/dist/cgroup.d.ts +4 -0
  16. package/dist/config-form.d.mts +66 -0
  17. package/dist/connector-ui-CG9kLZ5s.js +2716 -0
  18. package/dist/connector-ui.d.ts +129 -0
  19. package/dist/connectors-page-C8459TcH.js +241 -0
  20. package/dist/connectors-page.d.ts +8 -0
  21. package/dist/connectors.d.mts +154 -0
  22. package/dist/container-log.d.ts +11 -0
  23. package/dist/create.d.ts +11 -0
  24. package/dist/creation-schema.d.mts +15 -0
  25. package/dist/daemon-DxP5hn4p.js +394 -0
  26. package/dist/daemon.d.ts +24 -0
  27. package/dist/display-name.d.ts +10 -0
  28. package/dist/drift-diff.d.ts +4 -0
  29. package/dist/exec.d.ts +15 -0
  30. package/dist/extensions.d.ts +111 -0
  31. package/dist/get-started.d.ts +9 -0
  32. package/dist/health.d.ts +22 -0
  33. package/dist/identities-page-CJ_ukj0Q.js +2137 -0
  34. package/dist/identities-page.d.ts +15 -0
  35. package/dist/identities.d.mts +24 -0
  36. package/dist/image-format.d.ts +6 -0
  37. package/dist/image-inventory.d.ts +12 -0
  38. package/dist/images.d.ts +5 -0
  39. package/dist/index.d.ts +5 -0
  40. package/dist/index.js +5241 -0
  41. package/dist/initialize-CAOkMhlL.js +146 -0
  42. package/dist/initialize.d.ts +21 -0
  43. package/dist/inventory.d.ts +66 -0
  44. package/dist/lifecycle-policy.d.ts +11 -0
  45. package/dist/lifecycle.d.ts +24 -0
  46. package/dist/log-buffer.d.ts +8 -0
  47. package/dist/main.d.ts +13 -0
  48. package/dist/majordomo-CikLz0g9.js +3064 -0
  49. package/dist/majordomo.d.ts +102 -0
  50. package/dist/manage-nav.d.ts +4 -0
  51. package/dist/manifest-diff.d.mts +11 -0
  52. package/dist/merged-values-CBzWsNOS.js +739 -0
  53. package/dist/merged-values.d.ts +24 -0
  54. package/dist/network-format.d.ts +30 -0
  55. package/dist/network.d.ts +13 -0
  56. package/dist/new-agent-BweyzBnY.js +201 -0
  57. package/dist/new-agent.d.ts +27 -0
  58. package/dist/new-cell-Iceq2Zfv.js +1985 -0
  59. package/dist/new-cell.d.ts +29 -0
  60. package/dist/new-config-C9NSC9Ou.js +1541 -0
  61. package/dist/new-config.d.ts +7 -0
  62. package/dist/notifications.d.ts +26 -0
  63. package/dist/onboarding-oZBJXTy0.js +395 -0
  64. package/dist/onboarding.d.mts +40 -0
  65. package/dist/panel-cells.d.mts +8 -0
  66. package/dist/registry-credentials.d.ts +13 -0
  67. package/dist/relationships.d.mts +12 -0
  68. package/dist/request.d.ts +16 -0
  69. package/dist/router.d.ts +12 -0
  70. package/dist/routes.d.ts +43 -0
  71. package/dist/schedule-DzQ3Homi.js +113 -0
  72. package/dist/schedule-format.d.mts +9 -0
  73. package/dist/schedule.d.ts +16 -0
  74. package/dist/scope-actions.d.ts +9 -0
  75. package/dist/screens.d.ts +6 -0
  76. package/dist/secret-form.d.ts +24 -0
  77. package/dist/settings-nav.d.ts +5 -0
  78. package/dist/settings-page.d.ts +4 -0
  79. package/dist/settings-values.d.mts +18 -0
  80. package/dist/settings.d.ts +50 -0
  81. package/dist/sidebar-shell.d.ts +55 -0
  82. package/dist/sources-page-CxMSM-sz.js +423 -0
  83. package/dist/sources-page.d.ts +5 -0
  84. package/dist/space-subnets.d.ts +3 -0
  85. package/dist/style.css +2 -0
  86. package/dist/team-form.d.mts +56 -0
  87. package/dist/team-plan-CFOIv1lN.js +735 -0
  88. package/dist/team-plan.d.ts +22 -0
  89. package/dist/team-wizard.d.ts +8 -0
  90. package/dist/teams-page-C6UGy4Fw.js +2216 -0
  91. package/dist/teams-page.d.ts +9 -0
  92. package/dist/teams.d.mts +114 -0
  93. package/dist/terminal-palette.d.ts +8 -0
  94. package/dist/terminal.d.ts +98 -0
  95. package/dist/unread.d.mts +19 -0
  96. package/dist/use-unread.d.ts +4 -0
  97. package/dist/user-menu.d.ts +7 -0
  98. package/dist/views.d.mts +8 -0
  99. package/dist/workbench.d.ts +16 -0
  100. package/package.json +45 -4
  101. package/README.md +0 -3
@@ -0,0 +1,1541 @@
1
+ import { $t as e, En as t, H as n, Ht as r, In as i, Kn as a, Ln as o, Mt as s, Tn as c, Un as l, Vt as u, Xt as d, a as f, cn as p, en as m, gn as h, kn as g, l as ee, mn as te, r as ne, s as re, y as ie, yn as ae } from "./connector-ui-CG9kLZ5s.js";
2
+ import { t as _ } from "./initialize-CAOkMhlL.js";
3
+ import { _ as oe, a as se, c as ce, f as v, g as le, h as ue, i as y, l as de, m as fe, o as pe, p as me, s as he, t as ge, u as _e, v as b, y as ve } from "./merged-values-CBzWsNOS.js";
4
+ import { t as ye } from "./catalog-url-Dr9e92Yq.js";
5
+ import { useEffect as be, useLayoutEffect as xe, useMemo as x, useRef as Se, useState as S } from "react";
6
+ import { apiFetch as Ce } from "@kukeon/api-client";
7
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
8
+ import { Disclosure as we } from "@kukeon/ui";
9
+ // src/new-config.tsx
10
+ var E = "This answer is required.", D = ["basic-auth", "ssh-key"], Te = ["ssh-key"];
11
+ function O(e) {
12
+ return [
13
+ e.realm,
14
+ e.space,
15
+ e.stack,
16
+ e.name
17
+ ].filter((e) => !!e);
18
+ }
19
+ function Ee(e, t) {
20
+ return s(`/${e}/` + t.map(encodeURIComponent).join("/"));
21
+ }
22
+ function k(...e) {
23
+ return "config-" + e.join("-").replace(/[^a-zA-Z0-9_-]/g, "-");
24
+ }
25
+ function A(e) {
26
+ return e?.name ? JSON.stringify([
27
+ e.realm ?? "",
28
+ e.space ?? "",
29
+ e.stack ?? "",
30
+ e.cell ?? "",
31
+ e.name
32
+ ]) : "";
33
+ }
34
+ function j({ label: e, value: t, onChange: n, choices: r, disabled: i, required: a, help: o, invalid: s }) {
35
+ let c = A(t), l = r.some((e) => A(e) === c), [u, d] = S(!!c && !l), f = k("secret", e);
36
+ return /* @__PURE__ */ T("div", {
37
+ className: "schema-field secret-picker",
38
+ children: [
39
+ /* @__PURE__ */ w("label", {
40
+ htmlFor: f,
41
+ children: /* @__PURE__ */ T("span", { children: [e, a && /* @__PURE__ */ w("b", {
42
+ "aria-label": "required",
43
+ children: " *"
44
+ })] })
45
+ }),
46
+ /* @__PURE__ */ T("select", {
47
+ id: f,
48
+ value: u ? "manual" : c,
49
+ disabled: i,
50
+ "aria-invalid": s || void 0,
51
+ onChange: (e) => {
52
+ if (e.target.value === "manual") {
53
+ d(!0), n({
54
+ name: "",
55
+ realm: "default"
56
+ });
57
+ return;
58
+ }
59
+ d(!1);
60
+ let t = r.find((t) => A(t) === e.target.value);
61
+ n(t ? {
62
+ name: t.name,
63
+ realm: t.realm,
64
+ space: t.space,
65
+ stack: t.stack,
66
+ cell: t.cell
67
+ } : void 0);
68
+ },
69
+ children: [
70
+ /* @__PURE__ */ w("option", {
71
+ value: "",
72
+ children: a ? "Select a secret…" : "None"
73
+ }),
74
+ r.map((e) => /* @__PURE__ */ T("option", {
75
+ value: A(e),
76
+ children: [
77
+ e.name,
78
+ " — ",
79
+ [
80
+ e.realm,
81
+ e.space,
82
+ e.stack,
83
+ e.cell
84
+ ].filter(Boolean).join(" / "),
85
+ " (",
86
+ e.type,
87
+ ")"
88
+ ]
89
+ }, A(e))),
90
+ /* @__PURE__ */ w("option", {
91
+ value: "manual",
92
+ children: "Name a secret…"
93
+ })
94
+ ]
95
+ }),
96
+ u && /* @__PURE__ */ T("div", {
97
+ className: "map-entry",
98
+ children: [/* @__PURE__ */ T("label", { children: ["Secret name", /* @__PURE__ */ w("input", {
99
+ value: t?.name ?? "",
100
+ disabled: i,
101
+ onChange: (e) => n({
102
+ ...t,
103
+ name: e.target.value
104
+ })
105
+ })] }), /* @__PURE__ */ T("label", { children: ["Realm", /* @__PURE__ */ w("input", {
106
+ value: t?.realm ?? "",
107
+ disabled: i,
108
+ onChange: (e) => n({
109
+ ...t,
110
+ realm: e.target.value
111
+ })
112
+ })] })]
113
+ }),
114
+ o && /* @__PURE__ */ w("small", { children: o }),
115
+ s && /* @__PURE__ */ w("small", {
116
+ className: "field-error",
117
+ children: E
118
+ })
119
+ ]
120
+ });
121
+ }
122
+ function M({ label: e, value: t, onChange: n, disabled: r }) {
123
+ return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("label", {
124
+ className: "schema-field",
125
+ children: [/* @__PURE__ */ T("span", { children: [e, " name"] }), /* @__PURE__ */ w("input", {
126
+ value: t?.name ?? "",
127
+ disabled: r,
128
+ onChange: (e) => n({
129
+ ...t,
130
+ name: e.target.value
131
+ })
132
+ })]
133
+ }), /* @__PURE__ */ T("label", {
134
+ className: "schema-field",
135
+ children: [/* @__PURE__ */ T("span", { children: [e, " email"] }), /* @__PURE__ */ w("input", {
136
+ type: "email",
137
+ value: t?.email ?? "",
138
+ disabled: r,
139
+ onChange: (e) => n({
140
+ ...t,
141
+ email: e.target.value
142
+ })
143
+ })]
144
+ })] });
145
+ }
146
+ function N({ value: e, onChange: t, disabled: n }) {
147
+ return /* @__PURE__ */ T(C, { children: [
148
+ /* @__PURE__ */ T("label", {
149
+ className: "schema-field",
150
+ children: [/* @__PURE__ */ w("span", { children: "SSH user" }), /* @__PURE__ */ w("input", {
151
+ value: e?.user ?? "",
152
+ placeholder: "git",
153
+ disabled: n,
154
+ onChange: (n) => t({
155
+ ...e,
156
+ user: n.target.value
157
+ })
158
+ })]
159
+ }),
160
+ /* @__PURE__ */ T("label", {
161
+ className: "schema-field",
162
+ children: [/* @__PURE__ */ w("span", { children: "SSH port" }), /* @__PURE__ */ w("input", {
163
+ type: "number",
164
+ min: 1,
165
+ max: 65535,
166
+ value: e?.port ?? "",
167
+ placeholder: "22",
168
+ disabled: n,
169
+ onChange: (n) => t({
170
+ ...e,
171
+ port: n.target.value
172
+ })
173
+ })]
174
+ }),
175
+ /* @__PURE__ */ T("label", {
176
+ className: "schema-field",
177
+ children: [/* @__PURE__ */ w("span", { children: "Host key policy" }), /* @__PURE__ */ T("select", {
178
+ value: e?.hostKeyPolicy ?? "",
179
+ disabled: n,
180
+ onChange: (n) => t({
181
+ ...e,
182
+ hostKeyPolicy: n.target.value
183
+ }),
184
+ children: [/* @__PURE__ */ w("option", {
185
+ value: "",
186
+ children: "Strict (pinned or built-in host keys)"
187
+ }), /* @__PURE__ */ w("option", {
188
+ value: "accept-new",
189
+ children: "Accept new host keys"
190
+ })]
191
+ })]
192
+ })
193
+ ] });
194
+ }
195
+ function P({ value: e, sign: t, onChange: n, secrets: r, disabled: i }) {
196
+ let a = t ?? [];
197
+ return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(j, {
198
+ label: "Signing key secret",
199
+ value: e?.secretRef,
200
+ choices: b(r, Te),
201
+ disabled: i,
202
+ help: "An ssh-key secret. Commits and tags are signed with SSH signing.",
203
+ onChange: (t) => n(t ? {
204
+ ...e,
205
+ secretRef: t
206
+ } : void 0, a)
207
+ }), e?.secretRef && /* @__PURE__ */ T("div", {
208
+ className: "schema-field",
209
+ children: [
210
+ /* @__PURE__ */ w("span", { children: "Sign" }),
211
+ ["commits", "tags"].map((t) => /* @__PURE__ */ T("label", {
212
+ className: "schema-check",
213
+ children: [/* @__PURE__ */ w("input", {
214
+ type: "checkbox",
215
+ checked: !a.length || a.includes(t),
216
+ disabled: i,
217
+ onChange: (r) => {
218
+ let i = a.length ? a : ["commits", "tags"];
219
+ n(e, r.target.checked ? [.../* @__PURE__ */ new Set([...i, t])] : i.filter((e) => e !== t));
220
+ }
221
+ }), t]
222
+ }, t)),
223
+ /* @__PURE__ */ w("small", { children: "With neither selected, both are signed." })
224
+ ]
225
+ })] });
226
+ }
227
+ function De({ item: e, value: t, onChange: n, disabled: r, images: i, required: a, invalid: o }) {
228
+ let s = k("param", e.name), c = `${s}-help`, l = e.required && !e.hasDefault, u = /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("small", {
229
+ id: c,
230
+ children: [
231
+ e.description,
232
+ e.description && " ",
233
+ e.hasDefault && e.type !== "bool" && /* @__PURE__ */ T(C, { children: ["Default: ", /* @__PURE__ */ w("code", { children: e.default || "(empty)" })] })
234
+ ]
235
+ }), o && /* @__PURE__ */ w("small", {
236
+ className: "field-error",
237
+ children: E
238
+ })] });
239
+ if (e.type === "bool") return /* @__PURE__ */ T("label", {
240
+ className: "schema-check",
241
+ children: [
242
+ /* @__PURE__ */ w("input", {
243
+ id: s,
244
+ type: "checkbox",
245
+ checked: typeof t == "boolean" ? t : e.default === "true",
246
+ disabled: r,
247
+ "aria-describedby": c,
248
+ onChange: (e) => n(e.target.checked)
249
+ }),
250
+ e.name,
251
+ u
252
+ ]
253
+ });
254
+ let d = typeof t == "string" ? t : "";
255
+ if (e.type === "enum") return /* @__PURE__ */ T("label", {
256
+ className: "schema-field",
257
+ htmlFor: s,
258
+ children: [
259
+ /* @__PURE__ */ T("span", { children: [e.name, l && /* @__PURE__ */ w("b", {
260
+ "aria-label": "required",
261
+ children: " *"
262
+ })] }),
263
+ /* @__PURE__ */ T("select", {
264
+ id: s,
265
+ value: d,
266
+ disabled: r,
267
+ "aria-invalid": o || void 0,
268
+ "aria-describedby": c,
269
+ onChange: (e) => n(e.target.value),
270
+ children: [/* @__PURE__ */ w("option", {
271
+ value: "",
272
+ children: e.hasDefault ? `Default (${e.default})` : "Select…"
273
+ }), e.enum.map((e) => /* @__PURE__ */ w("option", { children: e }, e))]
274
+ }),
275
+ u
276
+ ]
277
+ });
278
+ if (e.type === "image") {
279
+ let t = v(i, a), f = me(i, d || e.default, a);
280
+ return /* @__PURE__ */ T("div", {
281
+ className: "schema-field image-parameter",
282
+ children: [
283
+ /* @__PURE__ */ w("label", {
284
+ htmlFor: s,
285
+ children: /* @__PURE__ */ T("span", { children: [e.name, l && /* @__PURE__ */ w("b", {
286
+ "aria-label": "required",
287
+ children: " *"
288
+ })] })
289
+ }),
290
+ /* @__PURE__ */ w("input", {
291
+ id: s,
292
+ value: d,
293
+ placeholder: e.default,
294
+ disabled: r,
295
+ "aria-invalid": o || void 0,
296
+ "aria-describedby": c,
297
+ onChange: (e) => n(e.target.value)
298
+ }),
299
+ /* @__PURE__ */ T("select", {
300
+ "aria-label": `${e.name} from realm images`,
301
+ value: t.some((e) => e.name === d) ? d : "",
302
+ disabled: r || !t.length,
303
+ onChange: (e) => {
304
+ e.target.value && n(e.target.value);
305
+ },
306
+ children: [/* @__PURE__ */ w("option", {
307
+ value: "",
308
+ children: t.length ? "Choose from the realm's images…" : "No image in this realm provides the required capabilities"
309
+ }), t.map((e) => /* @__PURE__ */ T("option", {
310
+ value: e.name,
311
+ children: [e.name, e.status === "unknown" ? " — capabilities unknown" : ""]
312
+ }, e.name))]
313
+ }),
314
+ u,
315
+ /* @__PURE__ */ T("small", { children: [
316
+ "Required capabilities: ",
317
+ a.length ? a.map((e) => /* @__PURE__ */ T("code", { children: [e, " "] }, e)) : "none",
318
+ ". Images labelled without one of them are not offered; unlabelled images are offered as “capabilities unknown”. Any reference can still be typed."
319
+ ] }),
320
+ f.status === "missing" && /* @__PURE__ */ T("small", {
321
+ className: "field-error",
322
+ role: "alert",
323
+ children: [
324
+ "This image does not provide: ",
325
+ f.missing.join(", "),
326
+ ". The daemon will refuse to create a cell from it."
327
+ ]
328
+ }),
329
+ f.status === "unknown" && /* @__PURE__ */ w("small", { children: "This image declares no capabilities; the daemon cannot check it." })
330
+ ]
331
+ });
332
+ }
333
+ return /* @__PURE__ */ T("label", {
334
+ className: "schema-field",
335
+ htmlFor: s,
336
+ children: [
337
+ /* @__PURE__ */ T("span", { children: [e.name, l && /* @__PURE__ */ w("b", {
338
+ "aria-label": "required",
339
+ children: " *"
340
+ })] }),
341
+ /* @__PURE__ */ w("input", {
342
+ id: s,
343
+ value: d,
344
+ placeholder: e.default,
345
+ disabled: r,
346
+ "aria-invalid": o || void 0,
347
+ "aria-describedby": c,
348
+ onChange: (e) => n(e.target.value)
349
+ }),
350
+ u
351
+ ]
352
+ });
353
+ }
354
+ function Oe({ slot: e, value: t, onChange: n, secrets: r, disabled: i, invalid: a }) {
355
+ let o = t ?? {}, s = o.git ?? { enabled: !1 }, c = o.revision ?? "branch", l = (e) => n({
356
+ ...o,
357
+ git: e
358
+ });
359
+ return /* @__PURE__ */ T("fieldset", {
360
+ className: "schema-object",
361
+ children: [
362
+ /* @__PURE__ */ T("legend", { children: [
363
+ "Repository: ",
364
+ e.name,
365
+ e.required && /* @__PURE__ */ w("b", {
366
+ "aria-label": "required",
367
+ children: " *"
368
+ })
369
+ ] }),
370
+ /* @__PURE__ */ T("p", {
371
+ className: "description",
372
+ children: [e.required ? "Required." : "Optional — left blank, the repository is not cloned.", e.target && /* @__PURE__ */ T(C, { children: [
373
+ " Cloned to ",
374
+ /* @__PURE__ */ w("code", { children: e.target }),
375
+ "."
376
+ ] })]
377
+ }),
378
+ /* @__PURE__ */ T("div", {
379
+ className: "schema-fields",
380
+ children: [/* @__PURE__ */ T("label", {
381
+ className: "schema-field",
382
+ children: [
383
+ /* @__PURE__ */ T("span", { children: [
384
+ e.name,
385
+ " URL",
386
+ e.required && /* @__PURE__ */ w("b", {
387
+ "aria-label": "required",
388
+ children: " *"
389
+ })
390
+ ] }),
391
+ /* @__PURE__ */ w("input", {
392
+ id: k("repo", e.name, "url"),
393
+ value: o.url ?? "",
394
+ placeholder: "git@github.com:owner/repo.git or https://…",
395
+ disabled: i,
396
+ "aria-invalid": a || void 0,
397
+ onChange: (e) => n({
398
+ ...o,
399
+ url: e.target.value
400
+ })
401
+ }),
402
+ /* @__PURE__ */ w("small", { children: "The transport — SSH or HTTPS — follows the credential bound to this repository." }),
403
+ a && /* @__PURE__ */ w("small", {
404
+ className: "field-error",
405
+ children: E
406
+ })
407
+ ]
408
+ }), /* @__PURE__ */ T("div", {
409
+ className: "schema-field",
410
+ children: [/* @__PURE__ */ w("label", {
411
+ htmlFor: k("repo", e.name, "revision"),
412
+ children: /* @__PURE__ */ T("span", { children: [e.name, " revision"] })
413
+ }), /* @__PURE__ */ T("div", {
414
+ className: "map-entry",
415
+ children: [/* @__PURE__ */ T("select", {
416
+ id: k("repo", e.name, "revision"),
417
+ value: c,
418
+ disabled: i,
419
+ onChange: (e) => n({
420
+ ...o,
421
+ revision: e.target.value === "ref" ? "ref" : "branch"
422
+ }),
423
+ children: [/* @__PURE__ */ w("option", {
424
+ value: "branch",
425
+ children: "Branch"
426
+ }), /* @__PURE__ */ w("option", {
427
+ value: "ref",
428
+ children: "Tag or commit"
429
+ })]
430
+ }), /* @__PURE__ */ w("input", {
431
+ "aria-label": `${e.name} ${c === "ref" ? "tag or commit" : "branch"}`,
432
+ value: (c === "ref" ? o.ref : o.branch) ?? "",
433
+ placeholder: c === "ref" ? "v1.2.3 or a full commit SHA" : "Remote default branch",
434
+ disabled: i,
435
+ onChange: (e) => n(c === "ref" ? {
436
+ ...o,
437
+ ref: e.target.value
438
+ } : {
439
+ ...o,
440
+ branch: e.target.value
441
+ })
442
+ })]
443
+ })]
444
+ })]
445
+ }),
446
+ /* @__PURE__ */ T("label", {
447
+ className: "schema-check",
448
+ children: [
449
+ /* @__PURE__ */ w("input", {
450
+ type: "checkbox",
451
+ checked: s.enabled === !0,
452
+ disabled: i,
453
+ onChange: (e) => l({
454
+ ...s,
455
+ enabled: e.target.checked
456
+ })
457
+ }),
458
+ e.name,
459
+ " uses its own git identity",
460
+ /* @__PURE__ */ w("small", { children: "Otherwise it uses the default identity inherited from the Realm, Space, Stack or this Config. Unset fields below fall back to that default." })
461
+ ]
462
+ }),
463
+ s.enabled && /* @__PURE__ */ T("div", {
464
+ className: "schema-fields advanced-fields",
465
+ children: [
466
+ /* @__PURE__ */ w(M, {
467
+ label: "Author",
468
+ value: s.author,
469
+ disabled: i,
470
+ onChange: (e) => l({
471
+ ...s,
472
+ author: e
473
+ })
474
+ }),
475
+ /* @__PURE__ */ w(M, {
476
+ label: "Committer",
477
+ value: s.committer,
478
+ disabled: i,
479
+ onChange: (e) => l({
480
+ ...s,
481
+ committer: e
482
+ })
483
+ }),
484
+ /* @__PURE__ */ w(j, {
485
+ label: `${e.name} credential secret`,
486
+ value: s.credential?.secretRef,
487
+ choices: b(r, D),
488
+ disabled: i,
489
+ help: "A basic-auth secret (HTTPS) or an ssh-key secret (SSH). API tokens are never git credentials.",
490
+ onChange: (e) => l({
491
+ ...s,
492
+ credential: e ? {
493
+ ...s.credential,
494
+ secretRef: e
495
+ } : void 0
496
+ })
497
+ }),
498
+ s.credential?.secretRef && /* @__PURE__ */ w(N, {
499
+ value: s.credential,
500
+ disabled: i,
501
+ onChange: (e) => l({
502
+ ...s,
503
+ credential: e
504
+ })
505
+ }),
506
+ /* @__PURE__ */ w(P, {
507
+ value: s.signing,
508
+ sign: s.sign,
509
+ secrets: r,
510
+ disabled: i,
511
+ onChange: (e, t) => l({
512
+ ...s,
513
+ signing: e,
514
+ sign: t
515
+ })
516
+ })
517
+ ]
518
+ })
519
+ ]
520
+ });
521
+ }
522
+ function ke({ value: e, onChange: t, secrets: n, disabled: r }) {
523
+ let i = e ?? { enabled: !1 }, a = i.credentials ?? [];
524
+ return /* @__PURE__ */ T("fieldset", {
525
+ className: "schema-object",
526
+ children: [
527
+ /* @__PURE__ */ w("legend", { children: "Default git identity" }),
528
+ /* @__PURE__ */ w("p", {
529
+ className: "description",
530
+ children: "Cells inherit their git identity, credentials and signing from the Realm, Space and Stack defaults. Override them here only when this Config needs something different: identity and signing replace the inherited value, credentials merge by host."
531
+ }),
532
+ /* @__PURE__ */ T("label", {
533
+ className: "schema-check",
534
+ children: [/* @__PURE__ */ w("input", {
535
+ type: "checkbox",
536
+ checked: i.enabled === !0,
537
+ disabled: r,
538
+ onChange: (e) => t({
539
+ ...i,
540
+ enabled: e.target.checked
541
+ })
542
+ }), "Override the inherited default identity"]
543
+ }),
544
+ i.enabled && /* @__PURE__ */ T(C, { children: [
545
+ /* @__PURE__ */ T("div", {
546
+ className: "schema-fields advanced-fields",
547
+ children: [
548
+ /* @__PURE__ */ w(M, {
549
+ label: "Default author",
550
+ value: i.author,
551
+ disabled: r,
552
+ onChange: (e) => t({
553
+ ...i,
554
+ author: e
555
+ })
556
+ }),
557
+ /* @__PURE__ */ w(M, {
558
+ label: "Default committer",
559
+ value: i.committer,
560
+ disabled: r,
561
+ onChange: (e) => t({
562
+ ...i,
563
+ committer: e
564
+ })
565
+ }),
566
+ /* @__PURE__ */ w(P, {
567
+ value: i.signing,
568
+ sign: i.sign,
569
+ secrets: n,
570
+ disabled: r,
571
+ onChange: (e, n) => t({
572
+ ...i,
573
+ signing: e,
574
+ sign: n
575
+ })
576
+ })
577
+ ]
578
+ }),
579
+ a.map((e, o) => /* @__PURE__ */ T("section", {
580
+ className: "schema-array-item",
581
+ children: [/* @__PURE__ */ T("div", {
582
+ className: "schema-array-heading",
583
+ children: [/* @__PURE__ */ T("h4", { children: ["Credential ", o + 1] }), /* @__PURE__ */ w("button", {
584
+ type: "button",
585
+ className: "subtle-button",
586
+ disabled: r,
587
+ onClick: () => t({
588
+ ...i,
589
+ credentials: a.filter((e, t) => t !== o)
590
+ }),
591
+ children: "Remove"
592
+ })]
593
+ }), /* @__PURE__ */ T("div", {
594
+ className: "schema-fields",
595
+ children: [
596
+ /* @__PURE__ */ T("label", {
597
+ className: "schema-field",
598
+ children: [/* @__PURE__ */ w("span", { children: "Host" }), /* @__PURE__ */ w("input", {
599
+ value: e.host ?? "",
600
+ placeholder: "github.com or github.com/owner",
601
+ disabled: r,
602
+ onChange: (e) => t({
603
+ ...i,
604
+ credentials: a.map((t, n) => n === o ? {
605
+ ...t,
606
+ host: e.target.value
607
+ } : t)
608
+ })
609
+ })]
610
+ }),
611
+ /* @__PURE__ */ w(j, {
612
+ label: `Credential ${o + 1} secret`,
613
+ value: e.secretRef,
614
+ choices: b(n, D),
615
+ disabled: r,
616
+ onChange: (e) => t({
617
+ ...i,
618
+ credentials: a.map((t, n) => n === o ? {
619
+ ...t,
620
+ secretRef: e
621
+ } : t)
622
+ })
623
+ }),
624
+ /* @__PURE__ */ w(N, {
625
+ value: e,
626
+ disabled: r,
627
+ onChange: (e) => t({
628
+ ...i,
629
+ credentials: a.map((t, n) => n === o ? {
630
+ ...t,
631
+ ...e
632
+ } : t)
633
+ })
634
+ })
635
+ ]
636
+ })]
637
+ }, o)),
638
+ /* @__PURE__ */ w("button", {
639
+ type: "button",
640
+ disabled: r,
641
+ onClick: () => t({
642
+ ...i,
643
+ credentials: [...a, { host: "" }]
644
+ }),
645
+ children: "Add credential"
646
+ })
647
+ ] })
648
+ ]
649
+ });
650
+ }
651
+ function F({ blueprint: s, blueprintScope: l, form: _, revision: v, inventory: y, onCreated: ye }) {
652
+ let E = y.data?.rows[0] ?? [], [D, Te] = S(""), [O, A] = S(""), [M, N] = S(""), [P, F] = S(""), [I, Ae] = S(() => ce(_)), [je, Me] = S(""), [L, Ne] = S(), [R, Pe] = S(), [Fe, Ie] = S([]), [z, Le] = S(!1), [Re, ze] = S("preview"), [Be, Ve] = S(""), [He, B] = S({}), [Ue, We] = S(!1), [V, Ge] = S(), Ke = Se(/* @__PURE__ */ new Set()), qe = Se(null);
653
+ be(() => {
654
+ V?.id && document.getElementById(V.id)?.focus(), V?.element && (V.element.focus(), V.element.reportValidity());
655
+ }, [V]), be(() => {
656
+ L && qe.current?.scrollIntoView({ block: "nearest" });
657
+ }, [L]);
658
+ let Je = (y.data?.rows[1] ?? []).filter((e) => e.scope[0] === O), Ye = (y.data?.rows[2] ?? []).filter((e) => e.scope[0] === O && e.scope[1] === M);
659
+ be(() => {
660
+ if (!y.data || O) return;
661
+ let e = E.find((e) => e.scope[0] === "default") ?? E[0];
662
+ if (!e) return;
663
+ let t = y.data.rows[1].some((t) => t.scope[0] === e.scope[0] && t.scope[1] === "default"), n = t && y.data.rows[2].some((t) => t.scope[0] === e.scope[0] && t.scope[1] === "default" && t.scope[2] === "default");
664
+ A(e.scope[0]), N(t ? "default" : ""), F(n ? "default" : "");
665
+ }, [
666
+ y.data,
667
+ O,
668
+ E
669
+ ]);
670
+ let H = a("/catalog/secrets", v), Xe = a("/connectors/logins", v), U = a(O ? `/realms/${encodeURIComponent(O)}/image-inventory` : null, v), Ze = _.components.some((e) => e.connector), { groups: Qe, ungrouped: $e } = x(() => d(_.components), [_]), et = a(Ze ? "/connectors" : null, v), W = o({
671
+ realm: O,
672
+ space: M,
673
+ stack: P
674
+ }), G = a(Ze && O ? `/connectors/defaults?${t(W)}` : null, v), K = x(() => ({
675
+ ...I,
676
+ groups: {
677
+ ...u(_.components, et.data),
678
+ ...I.groups
679
+ }
680
+ }), [
681
+ I,
682
+ _,
683
+ et.data
684
+ ]), q = le(_, K, je), tt = de(_, K, q), J = oe(_, K), nt = [...fe(_, K, q), ...he(_, K, G.data, q).map((e) => `${e} identity`)], Y = _.modes.filter((e) => !I.modes.enabled.length || I.modes.enabled.includes(e)), rt = {
685
+ name: s.metadata.name,
686
+ realm: s.metadata.realm,
687
+ space: s.metadata.space,
688
+ stack: s.metadata.stack
689
+ };
690
+ function X() {
691
+ Ne(void 0), Pe(void 0), Ve("");
692
+ }
693
+ function Z(e) {
694
+ Ae((t) => ({
695
+ ...t,
696
+ ...e
697
+ })), X();
698
+ }
699
+ async function it(e) {
700
+ if (z) return;
701
+ Le(!0), ze(e ? "create" : "preview"), Ve("");
702
+ let t = [
703
+ O,
704
+ M,
705
+ P,
706
+ D.trim()
707
+ ].filter(Boolean);
708
+ try {
709
+ let n = {
710
+ config: {
711
+ name: D.trim(),
712
+ realm: O,
713
+ ...M ? { space: M } : {},
714
+ ...P ? { stack: P } : {}
715
+ },
716
+ spec: se(rt, _, K),
717
+ ...q ? { mode: q } : {},
718
+ ...e && L ? { preview: L.preview } : {}
719
+ }, r = await Ce(`/configs/from-blueprint/${e ? "create" : "preview"}`, {
720
+ method: "POST",
721
+ headers: {
722
+ "Content-Type": "application/json",
723
+ Accept: "application/json"
724
+ },
725
+ body: JSON.stringify(n)
726
+ }), i = await r.json();
727
+ if (!r.ok) {
728
+ let t = i.error?.message ?? i.message ?? `Request failed (HTTP ${r.status})`;
729
+ throw Error(e && (i.error?.code === "unavailable" || r.status >= 500) ? `The creation outcome could not be confirmed. Refresh the Configs list before retrying. ${t}` : t);
730
+ }
731
+ e ? (Pe(t), Ie(ae(i)), Ne(void 0), ye()) : Ne(i);
732
+ } catch (t) {
733
+ let n = t instanceof Error ? t.message : "The request could not reach the web server.";
734
+ Ve(e && t instanceof TypeError ? `The creation outcome could not be confirmed. Refresh the Configs list before retrying. ${n}` : n);
735
+ } finally {
736
+ Le(!1);
737
+ }
738
+ }
739
+ let at = new Set(fe(_, K, q)), ot = pe(_, K, G.data, q), st = (e) => typeof e == "boolean" || typeof e == "string" && e !== "", ct = (e) => e.required && !e.hasDefault && e.type !== "bool", lt = (e) => !!e.connector && !!e.component && i(e.connector.delivery), ut = (e) => [
740
+ ...e.parameters.filter((e) => ct(e) && at.has(e.name)).map((e) => k("param", e.name)),
741
+ ...lt(e) && !g(I.connectors[e.component]) && ot.includes(e.component) ? [k("identity", e.component)] : [],
742
+ ...lt(e) ? [] : e.secrets.filter((e) => e.required && at.has(e.name)).map((e) => k("secret", `${e.name} secret`))
743
+ ], dt = _.repoSlots.filter((e) => e.required && at.has(e.name)).map((e) => k("repo", e.name, "url")), ft = /* @__PURE__ */ new Set([...tt.flatMap(ut), ...dt]), Q = (e) => Ue && ft.has(e), $ = [];
744
+ ($e.length > 0 || Qe.length > 0) && $.push({
745
+ key: "components",
746
+ title: "Components",
747
+ essential: !1,
748
+ invalid: [],
749
+ warning: !1,
750
+ set: I.components.length + Object.keys(I.groups).length,
751
+ body: /* @__PURE__ */ T(C, { children: [
752
+ /* @__PURE__ */ w("p", {
753
+ className: "description",
754
+ children: "Optional components bundle the parameters, secrets and image capabilities of one concern. Their fields appear once enabled."
755
+ }),
756
+ Qe.length > 0 && /* @__PURE__ */ w("div", {
757
+ className: "schema-fields",
758
+ children: Qe.map(({ group: e, members: t }) => {
759
+ let n = t.find((t) => t.name === _e(_, K, e)), r = [...new Set(t.map((e) => e.connector?.title || e.connector?.name || ""))], i = `${r.length === 1 && r[0] ? r[0] : e} method`;
760
+ return /* @__PURE__ */ T("label", {
761
+ className: "schema-field",
762
+ children: [
763
+ /* @__PURE__ */ T("span", { children: [i, /* @__PURE__ */ w("b", {
764
+ "aria-label": "required",
765
+ children: " *"
766
+ })] }),
767
+ /* @__PURE__ */ w("select", {
768
+ "aria-label": i,
769
+ value: n?.name ?? "",
770
+ disabled: z,
771
+ onChange: (t) => Z({ groups: {
772
+ ...I.groups,
773
+ [e]: t.target.value
774
+ } }),
775
+ children: t.map((e) => /* @__PURE__ */ w("option", {
776
+ value: e.name,
777
+ children: e.connector?.method || e.name
778
+ }, e.name))
779
+ }),
780
+ /* @__PURE__ */ T("small", { children: [
781
+ n?.description,
782
+ n?.description && " ",
783
+ "The methods of the ",
784
+ /* @__PURE__ */ w("code", { children: e }),
785
+ " group are alternatives: a Config enables exactly one."
786
+ ] })
787
+ ]
788
+ }, e);
789
+ })
790
+ }),
791
+ $e.map((e) => /* @__PURE__ */ T("label", {
792
+ className: "schema-check",
793
+ children: [
794
+ /* @__PURE__ */ w("input", {
795
+ type: "checkbox",
796
+ checked: I.components.includes(e.name),
797
+ disabled: z,
798
+ onChange: (t) => Z({ components: t.target.checked ? [...I.components, e.name] : I.components.filter((t) => t !== e.name) })
799
+ }),
800
+ /* @__PURE__ */ T("span", { children: [
801
+ e.name,
802
+ " ",
803
+ /* @__PURE__ */ w("span", {
804
+ className: "badge",
805
+ children: e.kind
806
+ })
807
+ ] }),
808
+ /* @__PURE__ */ T("small", { children: [e.description, e.requires.length > 0 && /* @__PURE__ */ T(C, { children: [
809
+ " Requires: ",
810
+ e.requires.join(", "),
811
+ "."
812
+ ] })] })
813
+ ]
814
+ }, e.name))
815
+ ] })
816
+ }), _.modes.length > 0 && $.push({
817
+ key: "modes",
818
+ title: "Modes",
819
+ essential: !1,
820
+ invalid: [],
821
+ warning: !1,
822
+ set: +(Y.length < _.modes.length) + +!!I.modes.default,
823
+ body: /* @__PURE__ */ T(C, { children: [
824
+ /* @__PURE__ */ w("p", {
825
+ className: "description",
826
+ children: "A harness mode is picked per cell at create time, so one Config serves both an attached session and a dispatched run. Choose which modes this Config allows and its default."
827
+ }),
828
+ _.modes.map((e) => /* @__PURE__ */ T("label", {
829
+ className: "schema-check",
830
+ children: [
831
+ /* @__PURE__ */ w("input", {
832
+ type: "checkbox",
833
+ checked: Y.includes(e),
834
+ disabled: z || Y.length === 1 && Y[0] === e,
835
+ onChange: (t) => Z({ modes: {
836
+ ...I.modes,
837
+ enabled: _.modes.filter((n) => n === e ? t.target.checked : Y.includes(n))
838
+ } })
839
+ }),
840
+ "Allow ",
841
+ e,
842
+ " mode"
843
+ ]
844
+ }, e)),
845
+ /* @__PURE__ */ T("div", {
846
+ className: "schema-fields",
847
+ children: [/* @__PURE__ */ T("label", {
848
+ className: "schema-field",
849
+ children: [/* @__PURE__ */ w("span", { children: "Default mode" }), /* @__PURE__ */ T("select", {
850
+ value: Y.includes(I.modes.default) ? I.modes.default : "",
851
+ disabled: z,
852
+ onChange: (e) => Z({ modes: {
853
+ ...I.modes,
854
+ default: e.target.value
855
+ } }),
856
+ children: [/* @__PURE__ */ w("option", {
857
+ value: "",
858
+ children: "Blueprint default"
859
+ }), Y.map((e) => /* @__PURE__ */ w("option", { children: e }, e))]
860
+ })]
861
+ }), /* @__PURE__ */ T("label", {
862
+ className: "schema-field",
863
+ children: [
864
+ /* @__PURE__ */ w("span", { children: "Preview as mode" }),
865
+ /* @__PURE__ */ w("select", {
866
+ value: q,
867
+ disabled: z,
868
+ onChange: (e) => {
869
+ Me(e.target.value), X();
870
+ },
871
+ children: Y.map((e) => /* @__PURE__ */ w("option", { children: e }, e))
872
+ }),
873
+ /* @__PURE__ */ w("small", { children: "Shows that mode's own parameters and secrets and renders the preview cell in it." })
874
+ ]
875
+ })]
876
+ })
877
+ ] })
878
+ });
879
+ for (let t of tt) {
880
+ let n = lt(t), a = n && !!g(I.connectors[t.component]);
881
+ $.push({
882
+ key: t.key,
883
+ title: t.kind === "group" ? t.title[0].toUpperCase() + t.title.slice(1) : t.title,
884
+ badge: t.kind === "group" ? void 0 : t.kind,
885
+ essential: t.parameters.some(ct) || (n ? !t.connector.optional : t.secrets.some((e) => e.required)),
886
+ invalid: ut(t),
887
+ warning: t.parameters.some((e) => {
888
+ let t = I.values[e.name];
889
+ return e.type === "image" && me(U.data?.images, typeof t == "string" && t || e.default, J).status === "missing";
890
+ }),
891
+ set: t.parameters.filter((e) => st(I.values[e.name])).length + +!!a + (n ? 0 : t.secrets.filter((e) => !!I.secrets[e.name]).length),
892
+ body: /* @__PURE__ */ T(C, { children: [
893
+ t.description && /* @__PURE__ */ w("p", {
894
+ className: "description",
895
+ children: t.description
896
+ }),
897
+ t.kind === "mode" && /* @__PURE__ */ T("p", {
898
+ className: "description",
899
+ children: [
900
+ "Values entered here are saved in the Config as that mode's default; a cell can still set them with ",
901
+ /* @__PURE__ */ w("code", { children: "--param" }),
902
+ "."
903
+ ]
904
+ }),
905
+ /* @__PURE__ */ T("div", {
906
+ className: "schema-fields",
907
+ children: [
908
+ t.parameters.map((e) => /* @__PURE__ */ w(De, {
909
+ item: e,
910
+ invalid: Q(k("param", e.name)),
911
+ value: I.values[e.name],
912
+ disabled: z,
913
+ images: U.data?.images,
914
+ required: J,
915
+ onChange: (t) => Z({ values: {
916
+ ...I.values,
917
+ [e.name]: t
918
+ } })
919
+ }, e.name)),
920
+ t.connector && t.component && i(t.connector.delivery) && (() => {
921
+ let { connector: e, component: n } = t, i = e.title || e.name, a = r(G.data, {
922
+ connector: e.name,
923
+ component: n
924
+ }), o = g(I.connectors[n]), s = !!G.data && !a?.effective, l = G.data ? a?.effective ? `Default: ${h(a.effective)} (${te(a.origin)})` : e.optional ? "No default" : "No default — required" : "Default (inherited from the Realm, Space or Stack)", u = t.secrets[0]?.envName;
925
+ return /* @__PURE__ */ w(re, {
926
+ id: k("identity", n),
927
+ invalid: Q(k("identity", n)),
928
+ label: `${i} identity`,
929
+ identities: m(H.data, e.name),
930
+ value: I.connectors[n],
931
+ emptyLabel: l,
932
+ disabled: z,
933
+ required: !e.optional,
934
+ realm: O,
935
+ onChange: (e) => {
936
+ let t = { ...I.connectors };
937
+ e ? t[n] = e : delete t[n], Z({ connectors: t });
938
+ },
939
+ help: /* @__PURE__ */ T(C, { children: [
940
+ u && /* @__PURE__ */ T(C, { children: [
941
+ "Delivered as ",
942
+ u,
943
+ ". "
944
+ ] }),
945
+ "Choosing the default saves no fill: the Config keeps inheriting it from ",
946
+ c(W).join(" / "),
947
+ ".",
948
+ s && !o && !e.optional && /* @__PURE__ */ T("span", {
949
+ className: "field-error",
950
+ children: [
951
+ " Nothing resolves yet — pick an identity or ",
952
+ /* @__PURE__ */ w("a", {
953
+ href: ie(e.name, W),
954
+ children: "set a default"
955
+ }),
956
+ "."
957
+ ]
958
+ })
959
+ ] })
960
+ }, `connector:${n}`);
961
+ })(),
962
+ t.connector?.delivery === "stateVolume" && t.component && (() => {
963
+ let { connector: e, component: n } = t, r = e.title || e.name, i = g(I.connectors[n]);
964
+ return /* @__PURE__ */ w(ee, {
965
+ label: `${r} login identity`,
966
+ identities: p(Xe.data, e.name),
967
+ value: I.connectors[n],
968
+ emptyLabel: "The state volume named in this form",
969
+ disabled: z,
970
+ onChange: (e) => {
971
+ let t = { ...I.connectors };
972
+ e ? t[n] = e : delete t[n], Z({ connectors: t });
973
+ },
974
+ help: /* @__PURE__ */ T(C, { children: [
975
+ "The login is kept in a login identity — a Volume mounted as the harness state directory. ",
976
+ i ? /* @__PURE__ */ T(C, { children: [
977
+ "Cells of this Config keep their state in ",
978
+ /* @__PURE__ */ w("code", { children: h(i) }),
979
+ "; the state volume values below are set from it."
980
+ ] }) : /* @__PURE__ */ w(C, { children: "Pick one to reuse a login, or leave it and name a state volume of the Config's own below." }),
981
+ " ",
982
+ "A login identity normally serves one role; another role may share it at your risk (its start rewrites role content in the state directory, and a Codex refresh token is single-use).",
983
+ " ",
984
+ /* @__PURE__ */ T("a", {
985
+ href: ie(e.name, W),
986
+ children: [
987
+ "Create or log in to a ",
988
+ r,
989
+ " login identity"
990
+ ]
991
+ }),
992
+ "."
993
+ ] })
994
+ }, `login:${n}`);
995
+ })(),
996
+ t.connector && t.connector.harness && t.connector.delivery !== "stateVolume" && ue(_, K) && /* @__PURE__ */ T("label", {
997
+ className: "schema-field",
998
+ children: [
999
+ /* @__PURE__ */ w("span", { children: "Harness state" }),
1000
+ /* @__PURE__ */ w("select", {
1001
+ "aria-label": `${t.connector.title || t.connector.name} harness state`,
1002
+ value: ve(_, K) || "persistent",
1003
+ disabled: z,
1004
+ onChange: (e) => Z({ state: e.target.value === "ephemeral" ? "ephemeral" : "" }),
1005
+ children: e.map((e) => /* @__PURE__ */ T("option", {
1006
+ value: e,
1007
+ children: [e, e === "persistent" ? " (default)" : ""]
1008
+ }, e))
1009
+ }),
1010
+ /* @__PURE__ */ w("small", { children: ve(_, K) === "ephemeral" ? "Ephemeral: cells mount no state volume; the harness state directory lives and dies with each cell, which authenticates from its Secret." : "Persistent: cells mount the state volume named in this form, so sessions and settings survive a cell." })
1011
+ ]
1012
+ }),
1013
+ !(t.connector && i(t.connector.delivery)) && t.secrets.map((e) => /* @__PURE__ */ w(j, {
1014
+ label: `${e.name} secret`,
1015
+ invalid: Q(k("secret", `${e.name} secret`)),
1016
+ required: e.required,
1017
+ value: I.secrets[e.name],
1018
+ choices: b(H.data, ["opaque"]),
1019
+ disabled: z,
1020
+ help: e.envName ? `Delivered as ${e.envName}.` : void 0,
1021
+ onChange: (t) => {
1022
+ let n = { ...I.secrets };
1023
+ t ? n[e.name] = t : delete n[e.name], Z({ secrets: n });
1024
+ }
1025
+ }, e.name))
1026
+ ]
1027
+ })
1028
+ ] })
1029
+ });
1030
+ }
1031
+ $.push({
1032
+ key: "capabilities",
1033
+ title: "Image capabilities",
1034
+ essential: !1,
1035
+ invalid: [],
1036
+ warning: !1,
1037
+ set: +!!I.requires.trim(),
1038
+ body: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
1039
+ className: "schema-fields",
1040
+ children: /* @__PURE__ */ T("label", {
1041
+ className: "schema-field",
1042
+ children: [
1043
+ /* @__PURE__ */ w("span", { children: "Additional required capabilities" }),
1044
+ /* @__PURE__ */ w("input", {
1045
+ value: I.requires,
1046
+ placeholder: "go, node",
1047
+ disabled: z,
1048
+ onChange: (e) => Z({ requires: e.target.value })
1049
+ }),
1050
+ /* @__PURE__ */ T("small", { children: [
1051
+ "Added to the blueprint's and the enabled components'. Currently required: ",
1052
+ J.length ? J.join(", ") : "none",
1053
+ "."
1054
+ ] })
1055
+ ]
1056
+ })
1057
+ }), U.error && /* @__PURE__ */ T("p", {
1058
+ className: "stale",
1059
+ children: [
1060
+ "Realm images could not be loaded: ",
1061
+ U.error.message,
1062
+ ". Image references can still be typed."
1063
+ ]
1064
+ })] })
1065
+ }), _.repoSlots.length > 0 && $.push({
1066
+ key: "repositories",
1067
+ title: "Repositories",
1068
+ essential: _.repoSlots.some((e) => e.required),
1069
+ warning: !1,
1070
+ invalid: dt,
1071
+ set: _.repoSlots.filter((e) => !!I.repos[e.name]?.url?.trim()).length,
1072
+ body: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("p", {
1073
+ className: "description",
1074
+ children: "Each source is cloned by the cell with stored git credentials — nothing from the host is mounted. A source may state its own identity; otherwise it uses the default."
1075
+ }), _.repoSlots.map((e) => /* @__PURE__ */ w(Oe, {
1076
+ slot: e,
1077
+ invalid: Q(k("repo", e.name, "url")),
1078
+ value: I.repos[e.name],
1079
+ secrets: H.data,
1080
+ disabled: z,
1081
+ onChange: (t) => Z({ repos: {
1082
+ ...I.repos,
1083
+ [e.name]: t
1084
+ } })
1085
+ }, e.name))] })
1086
+ }), $.push({
1087
+ key: "git",
1088
+ title: "Default git identity",
1089
+ essential: !1,
1090
+ invalid: [],
1091
+ warning: !1,
1092
+ set: +!!I.git?.enabled,
1093
+ body: /* @__PURE__ */ w(C, { children: /* @__PURE__ */ w(ke, {
1094
+ value: I.git,
1095
+ secrets: H.data,
1096
+ disabled: z,
1097
+ onChange: (e) => Z({ git: e })
1098
+ }) })
1099
+ });
1100
+ let pt = [...$.filter((e) => e.essential), ...$.filter((e) => !e.essential)], mt = $.filter((e) => e.invalid.length > 0 || e.warning).map((e) => e.key).join("\n");
1101
+ xe(() => {
1102
+ let e = mt.split("\n").filter((e) => e && !Ke.current.has(e));
1103
+ if (e.length) {
1104
+ for (let t of e) Ke.current.add(t);
1105
+ B((t) => ({
1106
+ ...Object.fromEntries(e.map((e) => [e, !0])),
1107
+ ...t
1108
+ }));
1109
+ }
1110
+ }, [mt]);
1111
+ function ht(e) {
1112
+ let t = pt.flatMap((e) => e.invalid.map((t) => ({
1113
+ key: e.key,
1114
+ id: t
1115
+ })));
1116
+ if (t.length) {
1117
+ We(!0), B((e) => ({
1118
+ ...e,
1119
+ ...Object.fromEntries(t.map((e) => [e.key, !0]))
1120
+ })), Ge({ id: t[0].id });
1121
+ return;
1122
+ }
1123
+ let n = e.querySelector("input:invalid, select:invalid, textarea:invalid");
1124
+ if (n) {
1125
+ let e = n.closest("[data-section]")?.dataset.section;
1126
+ e && B((t) => ({
1127
+ ...t,
1128
+ [e]: !0
1129
+ })), Ge({ element: n });
1130
+ } else it(!1);
1131
+ }
1132
+ return R ? /* @__PURE__ */ T("section", {
1133
+ className: "panel",
1134
+ "aria-label": "Config created",
1135
+ children: [/* @__PURE__ */ T("div", {
1136
+ className: "panel-heading",
1137
+ children: [/* @__PURE__ */ w("h2", { children: "Config created" }), /* @__PURE__ */ w("span", {
1138
+ className: "badge",
1139
+ children: R.slice(0, -1).join(" / ")
1140
+ })]
1141
+ }), /* @__PURE__ */ T("div", {
1142
+ className: "panel-body creation-form",
1143
+ children: [
1144
+ /* @__PURE__ */ w("p", {
1145
+ className: "creation-success",
1146
+ role: "status",
1147
+ children: /* @__PURE__ */ T("span", { children: [
1148
+ "CellConfig ",
1149
+ /* @__PURE__ */ w("strong", { children: R.at(-1) }),
1150
+ " was saved. It answers the ",
1151
+ /* @__PURE__ */ w("strong", { children: s.metadata.name }),
1152
+ " blueprint's form; no cell was created."
1153
+ ] })
1154
+ }),
1155
+ Fe.map((e) => /* @__PURE__ */ w(f, { warning: e }, e)),
1156
+ /* @__PURE__ */ w("p", { children: /* @__PURE__ */ T("a", {
1157
+ className: "resource-name",
1158
+ href: Ee("configs", R),
1159
+ children: ["Open Config ", R.at(-1)]
1160
+ }) }),
1161
+ /* @__PURE__ */ T("a", {
1162
+ className: "new-cell-action config-create-action",
1163
+ href: n(R),
1164
+ children: ["Create a Cell from it ", /* @__PURE__ */ w("span", {
1165
+ "aria-hidden": "true",
1166
+ children: "→"
1167
+ })]
1168
+ }),
1169
+ /* @__PURE__ */ w("button", {
1170
+ type: "button",
1171
+ className: "subtle-button",
1172
+ onClick: () => {
1173
+ Pe(void 0), Te("");
1174
+ },
1175
+ children: "Create another Config from this Blueprint"
1176
+ })
1177
+ ]
1178
+ })]
1179
+ }) : /* @__PURE__ */ T("section", {
1180
+ className: "panel",
1181
+ children: [/* @__PURE__ */ T("div", {
1182
+ className: "panel-heading",
1183
+ children: [/* @__PURE__ */ T("h2", { children: [
1184
+ "Answer the ",
1185
+ s.metadata.name,
1186
+ " form"
1187
+ ] }), /* @__PURE__ */ w("span", {
1188
+ className: "badge",
1189
+ children: l.slice(0, -1).join(" / ")
1190
+ })]
1191
+ }), /* @__PURE__ */ T("form", {
1192
+ className: "panel-body creation-form",
1193
+ noValidate: !0,
1194
+ onSubmit: (e) => {
1195
+ e.preventDefault(), ht(e.currentTarget);
1196
+ },
1197
+ children: [
1198
+ /* @__PURE__ */ w("p", {
1199
+ className: "description",
1200
+ children: "A blueprint is a form; a config is the answers. Every field below comes from the blueprint document — its parameters, components, modes and repository and secret slots. Security posture (root, host mounts) is fixed by the blueprint and cannot be changed here."
1201
+ }),
1202
+ /* @__PURE__ */ T("div", {
1203
+ className: "schema-section",
1204
+ children: [/* @__PURE__ */ w("h3", { children: "Config" }), /* @__PURE__ */ T("div", {
1205
+ className: "schema-fields",
1206
+ children: [
1207
+ /* @__PURE__ */ T("label", {
1208
+ className: "schema-field",
1209
+ htmlFor: "config-name",
1210
+ children: [/* @__PURE__ */ T("span", { children: ["Config name ", /* @__PURE__ */ w("b", {
1211
+ "aria-label": "required",
1212
+ children: " *"
1213
+ })] }), /* @__PURE__ */ w("input", {
1214
+ id: "config-name",
1215
+ value: D,
1216
+ disabled: z,
1217
+ onChange: (e) => {
1218
+ Te(e.target.value), X();
1219
+ }
1220
+ })]
1221
+ }),
1222
+ /* @__PURE__ */ T("label", {
1223
+ className: "schema-field",
1224
+ children: [
1225
+ /* @__PURE__ */ w("span", { children: "Cell name prefix" }),
1226
+ /* @__PURE__ */ w("input", {
1227
+ value: I.prefix,
1228
+ placeholder: D || "Config name",
1229
+ disabled: z,
1230
+ onChange: (e) => Z({ prefix: e.target.value })
1231
+ }),
1232
+ /* @__PURE__ */ T("small", { children: [
1233
+ "Cells created without a name are called ",
1234
+ /* @__PURE__ */ w("code", { children: "<prefix>-<6hex>" }),
1235
+ "."
1236
+ ] })
1237
+ ]
1238
+ }),
1239
+ /* @__PURE__ */ T("label", {
1240
+ className: "schema-field",
1241
+ children: [/* @__PURE__ */ T("span", { children: ["Realm ", /* @__PURE__ */ w("b", {
1242
+ "aria-label": "required",
1243
+ children: " *"
1244
+ })] }), /* @__PURE__ */ T("select", {
1245
+ "aria-label": "Config realm",
1246
+ value: O,
1247
+ disabled: z,
1248
+ onChange: (e) => {
1249
+ A(e.target.value), N(""), F(""), X();
1250
+ },
1251
+ children: [/* @__PURE__ */ w("option", {
1252
+ value: "",
1253
+ children: "Select a Realm…"
1254
+ }), E.map((e) => /* @__PURE__ */ w("option", { children: e.scope[0] }, e.scope[0]))]
1255
+ })]
1256
+ }),
1257
+ /* @__PURE__ */ T("label", {
1258
+ className: "schema-field",
1259
+ children: [/* @__PURE__ */ w("span", { children: "Space" }), /* @__PURE__ */ T("select", {
1260
+ "aria-label": "Config space",
1261
+ value: M,
1262
+ disabled: z || !O,
1263
+ onChange: (e) => {
1264
+ N(e.target.value), F(""), X();
1265
+ },
1266
+ children: [/* @__PURE__ */ w("option", {
1267
+ value: "",
1268
+ children: "Realm-scoped"
1269
+ }), Je.map((e) => /* @__PURE__ */ w("option", { children: e.scope[1] }, e.scope[1]))]
1270
+ })]
1271
+ }),
1272
+ /* @__PURE__ */ T("label", {
1273
+ className: "schema-field",
1274
+ children: [
1275
+ /* @__PURE__ */ w("span", { children: "Stack" }),
1276
+ /* @__PURE__ */ T("select", {
1277
+ "aria-label": "Config stack",
1278
+ value: P,
1279
+ disabled: z || !M,
1280
+ onChange: (e) => {
1281
+ F(e.target.value), X();
1282
+ },
1283
+ children: [/* @__PURE__ */ w("option", {
1284
+ value: "",
1285
+ children: M ? "Space-scoped" : "Realm-scoped"
1286
+ }), Ye.map((e) => /* @__PURE__ */ w("option", { children: e.scope[2] }, e.scope[2]))]
1287
+ }),
1288
+ /* @__PURE__ */ T("small", { children: [
1289
+ "Cells land in the Config's scope; an open coordinate means ",
1290
+ /* @__PURE__ */ w("code", { children: "default" }),
1291
+ "."
1292
+ ] })
1293
+ ]
1294
+ })
1295
+ ]
1296
+ })]
1297
+ }),
1298
+ pt.map((e) => /* @__PURE__ */ w(we, {
1299
+ level: 3,
1300
+ className: "schema-disclosure",
1301
+ title: e.title,
1302
+ open: He[e.key] ?? !1,
1303
+ onToggle: (t) => B((n) => ({
1304
+ ...n,
1305
+ [e.key]: t
1306
+ })),
1307
+ badge: e.badge && /* @__PURE__ */ w("span", {
1308
+ className: "badge",
1309
+ children: e.badge
1310
+ }),
1311
+ summary: /* @__PURE__ */ T(C, { children: [e.set ? `${e.set} set` : "Defaults", e.invalid.length > 0 && /* @__PURE__ */ T("span", {
1312
+ className: "disclosure-required",
1313
+ children: [
1314
+ " · ",
1315
+ e.invalid.length,
1316
+ " required"
1317
+ ]
1318
+ })] }),
1319
+ children: /* @__PURE__ */ w("div", {
1320
+ className: "schema-section",
1321
+ "data-section": e.key,
1322
+ children: e.body
1323
+ })
1324
+ }, e.key)),
1325
+ H.error && /* @__PURE__ */ T("p", {
1326
+ className: "stale",
1327
+ children: [
1328
+ "Secrets could not be listed: ",
1329
+ H.error.message,
1330
+ ". Name a secret by hand instead."
1331
+ ]
1332
+ }),
1333
+ G.error && /* @__PURE__ */ T("p", {
1334
+ className: "stale",
1335
+ children: [
1336
+ "Connector defaults could not be loaded for ",
1337
+ c(W).join(" / "),
1338
+ ": ",
1339
+ G.error.message,
1340
+ ". A picker's Default still inherits whatever the scope sets."
1341
+ ]
1342
+ }),
1343
+ nt.length > 0 && /* @__PURE__ */ T("p", {
1344
+ className: "description",
1345
+ role: "note",
1346
+ children: [
1347
+ "Still required: ",
1348
+ nt.join(", "),
1349
+ "."
1350
+ ]
1351
+ }),
1352
+ Be && /* @__PURE__ */ w("p", {
1353
+ className: "error",
1354
+ role: "alert",
1355
+ children: Be
1356
+ }),
1357
+ z && /* @__PURE__ */ w("p", {
1358
+ role: "status",
1359
+ children: Re === "create" ? "Saving Config…" : "Preparing preview…"
1360
+ }),
1361
+ /* @__PURE__ */ w("button", {
1362
+ type: "submit",
1363
+ className: L ? void 0 : "primary-action",
1364
+ disabled: z || !D.trim() || !O,
1365
+ children: L ? "Refresh preview" : "Preview Config"
1366
+ }),
1367
+ L && /* @__PURE__ */ T("div", {
1368
+ className: "creation-review",
1369
+ ref: qe,
1370
+ children: [
1371
+ /* @__PURE__ */ w("h3", { children: "Review Config" }),
1372
+ /* @__PURE__ */ T("p", {
1373
+ className: "description",
1374
+ children: [
1375
+ "The daemon rendered a cell from these answers",
1376
+ q && /* @__PURE__ */ T(C, { children: [
1377
+ " in ",
1378
+ /* @__PURE__ */ w("strong", { children: q }),
1379
+ " mode"
1380
+ ] }),
1381
+ " without saving anything. Creating saves the Config below; no cell is created."
1382
+ ]
1383
+ }),
1384
+ L.connectors && /* @__PURE__ */ w(ne, { statuses: L.connectors }),
1385
+ L.values && /* @__PURE__ */ w(ge, {
1386
+ values: L.values,
1387
+ digest: L.digest
1388
+ }),
1389
+ /* @__PURE__ */ w("h4", { children: "CellConfig to save" }),
1390
+ /* @__PURE__ */ w("pre", {
1391
+ tabIndex: 0,
1392
+ "aria-label": "CellConfig to save",
1393
+ children: JSON.stringify(L.config, null, 2)
1394
+ }),
1395
+ /* @__PURE__ */ T("details", { children: [/* @__PURE__ */ w("summary", { children: "Cell this Config renders" }), /* @__PURE__ */ w("pre", {
1396
+ tabIndex: 0,
1397
+ "aria-label": "Cell preview",
1398
+ children: JSON.stringify(L.document, null, 2)
1399
+ })] }),
1400
+ /* @__PURE__ */ w("button", {
1401
+ type: "button",
1402
+ className: "primary-action",
1403
+ disabled: z,
1404
+ onClick: () => void it(!0),
1405
+ children: "Create Config"
1406
+ })
1407
+ ]
1408
+ })
1409
+ ]
1410
+ })]
1411
+ });
1412
+ }
1413
+ function I({ revision: e, inventory: t, blueprintScope: n, onCreated: r }) {
1414
+ let i = a("/catalog/blueprints", e), [o, s] = S(""), [c, u] = S(n?.length ? JSON.stringify(n) : ""), d = (i.data ?? []).map((e) => ({
1415
+ doc: e,
1416
+ scope: O(e.metadata)
1417
+ })), f = d.filter(({ scope: e }) => e.join(" / ").toLowerCase().includes(o.toLowerCase()) || JSON.stringify(e) === c), p = x(() => {
1418
+ try {
1419
+ let e = JSON.parse(c || "[]");
1420
+ return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
1421
+ } catch {
1422
+ return [];
1423
+ }
1424
+ }, [c]), m = a(p.length >= 2 ? ye("blueprints", p) : null, e), h = x(() => m.data ? y(m.data) : void 0, [m.data]);
1425
+ return /* @__PURE__ */ T("div", {
1426
+ className: "creation-layout",
1427
+ children: [/* @__PURE__ */ T("section", {
1428
+ className: "panel",
1429
+ children: [/* @__PURE__ */ T("div", {
1430
+ className: "panel-heading",
1431
+ children: [/* @__PURE__ */ w("h2", { children: "Choose a Blueprint" }), /* @__PURE__ */ w("span", {
1432
+ className: "badge",
1433
+ children: "Form source"
1434
+ })]
1435
+ }), /* @__PURE__ */ T("div", {
1436
+ className: "panel-body creation-form",
1437
+ children: [
1438
+ i.loading && /* @__PURE__ */ w("p", {
1439
+ role: "status",
1440
+ children: "Loading Blueprints…"
1441
+ }),
1442
+ i.error && /* @__PURE__ */ w(l, {
1443
+ error: i.error,
1444
+ kind: "Blueprint"
1445
+ }),
1446
+ i.error && i.data && /* @__PURE__ */ w("p", {
1447
+ className: "stale",
1448
+ children: "Showing stale Blueprints."
1449
+ }),
1450
+ /* @__PURE__ */ T("label", { children: ["Search Blueprints", /* @__PURE__ */ w("input", {
1451
+ type: "search",
1452
+ value: o,
1453
+ placeholder: "Name or full scope",
1454
+ onChange: (e) => s(e.target.value)
1455
+ })] }),
1456
+ /* @__PURE__ */ T("label", { children: ["Blueprint", /* @__PURE__ */ T("select", {
1457
+ value: c,
1458
+ onChange: (e) => u(e.target.value),
1459
+ children: [
1460
+ /* @__PURE__ */ w("option", {
1461
+ value: "",
1462
+ children: "Select a Blueprint…"
1463
+ }),
1464
+ f.map((e) => /* @__PURE__ */ T("option", {
1465
+ value: JSON.stringify(e.scope),
1466
+ children: [
1467
+ e.doc.metadata.name,
1468
+ " — ",
1469
+ e.scope.slice(0, -1).join(" / ")
1470
+ ]
1471
+ }, JSON.stringify(e.scope))),
1472
+ c && !d.some((e) => JSON.stringify(e.scope) === c) && /* @__PURE__ */ T("option", {
1473
+ value: c,
1474
+ children: [
1475
+ p.at(-1),
1476
+ " — ",
1477
+ p.slice(0, -1).join(" / ")
1478
+ ]
1479
+ })
1480
+ ]
1481
+ })] }),
1482
+ !i.loading && !i.error && !d.length && /* @__PURE__ */ T("div", {
1483
+ className: "initialize-empty",
1484
+ role: "note",
1485
+ children: [/* @__PURE__ */ T("p", {
1486
+ className: "description",
1487
+ children: [
1488
+ "No Blueprints are available. Initialize stores the ones kukeon ships, or apply one with ",
1489
+ /* @__PURE__ */ w("code", { children: "kuke apply" }),
1490
+ "."
1491
+ ]
1492
+ }), /* @__PURE__ */ w(_, {
1493
+ onChanged: r,
1494
+ subject: "the Blueprints and Configs of the kuke and default teams"
1495
+ })]
1496
+ }),
1497
+ p.length >= 2 && m.loading && !m.data && /* @__PURE__ */ w("p", {
1498
+ role: "status",
1499
+ children: "Loading the Blueprint's form…"
1500
+ }),
1501
+ m.error && /* @__PURE__ */ w(l, {
1502
+ error: m.error,
1503
+ kind: "Blueprint"
1504
+ }),
1505
+ m.data && /* @__PURE__ */ T("p", {
1506
+ className: "description",
1507
+ children: [
1508
+ "Form of ",
1509
+ /* @__PURE__ */ w("a", {
1510
+ className: "resource-name",
1511
+ href: Ee("blueprints", p),
1512
+ children: m.data.metadata.name
1513
+ }),
1514
+ h && /* @__PURE__ */ T(C, { children: [
1515
+ ": ",
1516
+ h.parameters.length,
1517
+ " parameters, ",
1518
+ h.components.length,
1519
+ " components, ",
1520
+ h.repoSlots.length,
1521
+ " repository slots."
1522
+ ] })
1523
+ ]
1524
+ }),
1525
+ t.data?.failures.length ? /* @__PURE__ */ w("p", {
1526
+ className: "stale",
1527
+ children: "Inventory is incomplete. Target scopes may be missing."
1528
+ }) : null
1529
+ ]
1530
+ })]
1531
+ }), m.data && h && /* @__PURE__ */ w(F, {
1532
+ blueprint: m.data,
1533
+ blueprintScope: p,
1534
+ form: h,
1535
+ revision: e,
1536
+ inventory: t,
1537
+ onCreated: r
1538
+ }, c)]
1539
+ });
1540
+ }
1541
+ export { I as NewConfigPage };