wicked-crew 0.18.9 → 0.18.11

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 (100) hide show
  1. package/README.md +13 -8
  2. package/dist/api/cluster-status.d.ts +84 -0
  3. package/dist/api/cluster-status.d.ts.map +1 -0
  4. package/dist/api/cluster-status.js +197 -0
  5. package/dist/api/cluster-status.js.map +1 -0
  6. package/dist/api/mcp.d.ts.map +1 -1
  7. package/dist/api/mcp.js +3 -1
  8. package/dist/api/mcp.js.map +1 -1
  9. package/dist/api/needs.d.ts.map +1 -1
  10. package/dist/api/needs.js +3 -1
  11. package/dist/api/needs.js.map +1 -1
  12. package/dist/api/requirements.d.ts +27 -0
  13. package/dist/api/requirements.d.ts.map +1 -1
  14. package/dist/api/requirements.js +45 -2
  15. package/dist/api/requirements.js.map +1 -1
  16. package/dist/api/roster-standing.d.ts +3 -0
  17. package/dist/api/roster-standing.d.ts.map +1 -1
  18. package/dist/api/roster-standing.js +5 -3
  19. package/dist/api/roster-standing.js.map +1 -1
  20. package/dist/api/routes.d.ts.map +1 -1
  21. package/dist/api/routes.js +31 -12
  22. package/dist/api/routes.js.map +1 -1
  23. package/dist/api/runtime-state.d.ts +20 -6
  24. package/dist/api/runtime-state.d.ts.map +1 -1
  25. package/dist/api/runtime-state.js +35 -14
  26. package/dist/api/runtime-state.js.map +1 -1
  27. package/dist/api/seat-container-login.d.ts +12 -0
  28. package/dist/api/seat-container-login.d.ts.map +1 -1
  29. package/dist/api/seat-container-login.js +37 -0
  30. package/dist/api/seat-container-login.js.map +1 -1
  31. package/dist/api/server.d.ts.map +1 -1
  32. package/dist/api/server.js +9 -1
  33. package/dist/api/server.js.map +1 -1
  34. package/dist/api/system-snapshot.d.ts.map +1 -1
  35. package/dist/api/system-snapshot.js +1 -0
  36. package/dist/api/system-snapshot.js.map +1 -1
  37. package/dist/apps-server/server/lib/bundle/server.mjs +22323 -22109
  38. package/dist/core/deliver-credentials.d.ts +9 -0
  39. package/dist/core/deliver-credentials.d.ts.map +1 -1
  40. package/dist/core/deliver-credentials.js +29 -8
  41. package/dist/core/deliver-credentials.js.map +1 -1
  42. package/dist/core/deliver-text.d.ts.map +1 -1
  43. package/dist/core/deliver-text.js +54 -15
  44. package/dist/core/deliver-text.js.map +1 -1
  45. package/dist/core/deliver.d.ts +5 -0
  46. package/dist/core/deliver.d.ts.map +1 -1
  47. package/dist/core/deliver.js +24 -0
  48. package/dist/core/deliver.js.map +1 -1
  49. package/dist/decisions/rules-brief.d.ts +23 -14
  50. package/dist/decisions/rules-brief.d.ts.map +1 -1
  51. package/dist/decisions/rules-brief.js +63 -60
  52. package/dist/decisions/rules-brief.js.map +1 -1
  53. package/dist/knowledge/trackers/gate-pm.d.ts.map +1 -1
  54. package/dist/knowledge/trackers/gate-pm.js +8 -1
  55. package/dist/knowledge/trackers/gate-pm.js.map +1 -1
  56. package/dist/mcp/broker.d.ts +1 -1
  57. package/dist/mcp/broker.d.ts.map +1 -1
  58. package/dist/mcp/broker.js +11 -3
  59. package/dist/mcp/broker.js.map +1 -1
  60. package/dist/mcp/estate-relay.d.ts +23 -1
  61. package/dist/mcp/estate-relay.d.ts.map +1 -1
  62. package/dist/mcp/estate-relay.js +60 -3
  63. package/dist/mcp/estate-relay.js.map +1 -1
  64. package/dist/mcp/registry.d.ts +11 -2
  65. package/dist/mcp/registry.d.ts.map +1 -1
  66. package/dist/mcp/registry.js +33 -6
  67. package/dist/mcp/registry.js.map +1 -1
  68. package/dist/mcp/secrets.d.ts +23 -2
  69. package/dist/mcp/secrets.d.ts.map +1 -1
  70. package/dist/mcp/secrets.js +64 -3
  71. package/dist/mcp/secrets.js.map +1 -1
  72. package/dist/projects/state-home-registry.d.ts.map +1 -1
  73. package/dist/projects/state-home-registry.js +2 -0
  74. package/dist/projects/state-home-registry.js.map +1 -1
  75. package/dist/skills/plugin-source.d.ts +11 -2
  76. package/dist/skills/plugin-source.d.ts.map +1 -1
  77. package/dist/skills/plugin-source.js +11 -2
  78. package/dist/skills/plugin-source.js.map +1 -1
  79. package/dist/sources/ask.d.ts +24 -1
  80. package/dist/sources/ask.d.ts.map +1 -1
  81. package/dist/sources/ask.js +164 -15
  82. package/dist/sources/ask.js.map +1 -1
  83. package/dist/studio/assets/{KnowledgeGraph-XPxkIReb.js → KnowledgeGraph-B2NelLEg.js} +1 -1
  84. package/dist/studio/assets/{index-3kldzSmP.js → index-BeEB56KG.js} +304 -304
  85. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  86. package/dist/studio/editors/wicked-apps/index.html +1 -1
  87. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  88. package/dist/studio/editors/wicked-deck/index.html +1 -1
  89. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  90. package/dist/studio/editors/wicked-doc/index.html +1 -1
  91. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  92. package/dist/studio/editors/wicked-insights/index.html +1 -1
  93. package/dist/studio/editors/wicked-page/editor.json +1 -1
  94. package/dist/studio/editors/wicked-page/index.html +1 -1
  95. package/dist/studio/editors/wicked-video/editor.json +1 -1
  96. package/dist/studio/editors/wicked-video/index.html +1 -1
  97. package/dist/studio/index.html +1 -1
  98. package/dist/studio/testid-inventory.json +1 -1
  99. package/endpoint-manifest.json +1 -1
  100. package/package.json +4 -4
package/README.md CHANGED
@@ -21,10 +21,15 @@ Local-first: loopback only, no accounts, no billing, no model reselling. Crew dr
21
21
  - **uv** — the daemon builds its skills environment with `uv sync` (once per skills baseline); without
22
22
  uv every job launch is refused (`venv-failed`). The family installer installs it for you (see below).
23
23
  - **git** — crew spawns it for every repository operation.
24
- - **A container runtime** (Rancher Desktop, Docker, Podman, Colima or OrbStack), running. Governed
25
- agents work in a hardened seat container, and you sign each one in from studio's Agents tab: Claude
26
- Code and GitHub Copilot in a login container, Codex, Pi and OpenCode with their host CLIs.
27
- `WICKED_SEAT_FLOOR=host` keeps the labelled interim host floor instead.
24
+ - **A local Kubernetes cluster** (Rancher Desktop, or Docker Desktop with Kubernetes on), running and
25
+ installed once for crew: `npx wicked-installer` (0.10.0 or later) runs the install, or by hand
26
+ `"$(npm root -g)/wicked-crew/node_modules/wicked-core-ts-<platform>/wicked-core" cluster install
27
+ --admin-context rancher-desktop --home ~/.wicked-crew`. On Rancher Desktop, choose the dockerd (moby)
28
+ container engine (Preferences → Container Engine). With containerd, crew's floor images aren't visible to the
29
+ kubelet and seats won't start (wicked-core#1449). Governed agents work in a hardened seat pod,
30
+ and you sign each one in from studio's Agents tab: Claude Code and GitHub Copilot in a login pod,
31
+ Codex, Pi and OpenCode with their host CLIs. `WICKED_SEAT_FLOOR=host` keeps the labelled interim host
32
+ floor instead.
28
33
  - **At least one coding-agent CLI** you can sign in (Claude Code, Codex, GitHub Copilot, OpenCode or Pi).
29
34
  - **wicked-estate** — the `wicked-estate` / `wicked-estate-mcp` binaries on PATH. Crew requires it:
30
35
  adding a repository in Studio runs onboarding's index phase on the `wicked-estate` tool, and it
@@ -32,7 +37,7 @@ Local-first: loopback only, no accounts, no billing, no model reselling. Crew dr
32
37
  sources' structure — never their values. `npx wicked-installer install wicked-estate`
33
38
  downloads a sha256-verified prebuilt binary into `~/.local/bin` (about 20 s) on macOS, glibc Linux
34
39
  (x64/arm64) and Windows x64; on other platforms it builds with cargo, which needs a Rust toolchain.
35
- - **wicked-garden ≥ 12.66.1**, the skills every governed worker follows (including the Apps skill an
40
+ - **wicked-garden ≥ 12.68.0**, the skills every governed worker follows (including the Apps skill an
36
41
  app's chat builds with). crew does not vendor it, and without it every launch is refused:
37
42
  `npx wicked-installer install wicked-garden`, then restart `wicked-crew serve`.
38
43
 
@@ -58,12 +63,12 @@ them:
58
63
  If your shell can't find `wicked-crew` itself, npm's global bin directory is not on PATH: add
59
64
  `$(npm prefix -g)/bin` (macOS, Linux) or the directory `npm prefix -g` prints (Windows).
60
65
 
61
- If a garden older than 12.66.1 is already installed, the installer may keep it; crew's blocking `skills.garden`
66
+ If a garden older than 12.68.0 is already installed, the installer may keep it; crew's blocking `skills.garden`
62
67
  finding then names its version and where it was found. Update that copy (for the npm package,
63
68
  `npm install -g wicked-garden@latest`) and restart `wicked-crew serve`.
64
69
 
65
70
  Or install crew by hand (advanced). It needs uv and the requirements above, including
66
- **wicked-garden 12.66.1 or later** (crew refuses every launch until it finds one):
71
+ **wicked-garden 12.68.0 or later** (crew refuses every launch until it finds one):
67
72
 
68
73
  ```bash
69
74
  npx wicked-installer install wicked-estate wicked-garden
@@ -72,7 +77,7 @@ wicked-crew serve
72
77
  # then open http://127.0.0.1:7701
73
78
  ```
74
79
 
75
- Crew uses the first usable garden source in this order (automatic sources need version ≥ 12.66.1):
80
+ Crew uses the first usable garden source in this order (automatic sources need version ≥ 12.68.0):
76
81
 
77
82
  1. `WICKED_CREW_SKILLS_SOURCE`, an explicit plugin root.
78
83
  2. The Claude marketplace cache under `$CLAUDE_CONFIG_DIR` or `~/.claude` (highest valid version).
@@ -0,0 +1,84 @@
1
+ /**
2
+ * The daemon's Kubernetes cluster, as the engine reads it (wicked-core `cluster status --json`, k8s
3
+ * runner B-5): the `cluster` row of the Nerve Center (`GET /system`), the gateway row (the model
4
+ * gateway is a Deployment in the daemon's namespace now, not a container), `GET /diagnostics.cluster`
5
+ * and the roster's reachability check (`runtime-state.ts`).
6
+ *
7
+ * The engine owns the reading: it uses its own scoped account (`<state home>/k8s/kubeconfig`),
8
+ * never the operator's current context, so crew runs the engine's CLI with `--home <state home>`
9
+ * rather than spelling kubectl itself. Reads are single-flight (each is several kubectl calls, and a
10
+ * studio poll can read `/system` and `/diagnostics` at once), never cached: a Re-check is fresh.
11
+ */
12
+ import type { SystemInfraRow } from '../core/types.js';
13
+ import { type Settled } from './system-snapshot.js';
14
+ /** One read's bound: `cluster status` is a `kubectl version` plus a few list calls (inside the
15
+ * snapshot's 8 s budget). */
16
+ export declare const CLUSTER_TIMEOUT_MS = 6000;
17
+ export type ClusterGateway = 'serving' | 'starting' | 'stopped' | 'absent';
18
+ /** `wicked-core cluster status --json`, only the fields crew reads (picked one by one). */
19
+ export interface ClusterStatus {
20
+ configured: boolean;
21
+ reachable: boolean;
22
+ /** Why it is not configured or not reachable: `no_cluster`, `cluster_unreachable`, … */
23
+ kind: string | null;
24
+ context: string | null;
25
+ controller: {
26
+ ready: boolean;
27
+ detail: string | null;
28
+ } | null;
29
+ controllerVersion: string | null;
30
+ gateway: ClusterGateway | null;
31
+ runNamespaces: number | null;
32
+ pendingPods: number | null;
33
+ /** The engine's own words when a read failed part-way (home paths spelled `~`). */
34
+ detail: string | null;
35
+ }
36
+ type ClusterExec = (file: string, args: string[], opts: {
37
+ timeout: number;
38
+ }) => Promise<{
39
+ stdout: string;
40
+ stderr: string;
41
+ }>;
42
+ /** Engine (or kubectl) words as they may cross the wire, whole text: credentials redacted and every
43
+ * home path (this user's, a foreign or a JSON-escaped one) spelled `~`, before anything is cut. */
44
+ export declare function publicText(raw: string): string;
45
+ /** One line of {@link publicText}, bounded (sanitized BEFORE the cut, so a cut never exposes a prefix). */
46
+ export declare function publicLine(v: unknown): string | null;
47
+ /** Parse the engine's status document; `null` when stdout is not one. */
48
+ export declare function parseClusterStatus(stdout: string): ClusterStatus | null;
49
+ export interface ClusterReadInput {
50
+ /** The engine CLI (`WICKED_CORE_EXE`); `null` when crew was started without one. */
51
+ exe: string | null;
52
+ /** The daemon's state home (the `--db` parent); `null` on a route set without a store. */
53
+ home: string | null;
54
+ exec: ClusterExec;
55
+ timeoutMs?: number;
56
+ }
57
+ /** Run `cluster status --json` once. It exits 1 with a document when the cluster is not configured
58
+ * or does not answer, so a failed exit's stdout is read too; no document at all throws. */
59
+ export declare function readClusterStatus(input: ClusterReadInput): Promise<ClusterStatus>;
60
+ /** Single-flight reader shared by `/system` and `/diagnostics`. The flight is the engine process
61
+ * itself, not a caller's wait: a caller that gives up (its own, shorter bound) leaves the one process
62
+ * running, and the next caller joins it rather than starting another. The process is bounded by the
63
+ * exec's own timeout ({@link CLUSTER_TIMEOUT_MS}), which kills it. */
64
+ export declare class ClusterStatusReader {
65
+ private readonly input;
66
+ private running;
67
+ constructor(input: () => ClusterReadInput);
68
+ /** Settle within `boundMs` (default and maximum: {@link CLUSTER_TIMEOUT_MS}). */
69
+ read(boundMs?: number): Promise<Settled<ClusterStatus>>;
70
+ }
71
+ /** `/diagnostics.cluster`: the document, or why there is none. */
72
+ export declare function clusterDiagnostics(read: Settled<ClusterStatus>): (ClusterStatus & {
73
+ read: 'ok';
74
+ }) | {
75
+ read: 'timeout' | 'error';
76
+ detail: string;
77
+ };
78
+ /** The `cluster` and `gateway` rows from one read. Off the container floor both are `off`. */
79
+ export declare function clusterRows(read: Settled<ClusterStatus> | null, containerFloor: boolean, startedAt: number): {
80
+ cluster: SystemInfraRow;
81
+ gateway: SystemInfraRow;
82
+ };
83
+ export {};
84
+ //# sourceMappingURL=cluster-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cluster-status.d.ts","sourceRoot":"","sources":["../../src/api/cluster-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE5E;8BAC8B;AAC9B,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AAExC,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE3E,2FAA2F;AAC3F,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,wFAAwF;IACxF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7D,iBAAiB,EAAE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AC,OAAO,CAAC,aAAa,CAAC,CAAC;CAU5E;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,GAAG;IAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAIjJ;AAcD,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAiEjK"}
@@ -0,0 +1,197 @@
1
+ import { redactString } from '../mcp/redact.js';
2
+ import { homeless } from './seat-standing.js';
3
+ import { scrubHomePaths } from './ui-text.js';
4
+ import { infraRow, settleWithin } from './system-snapshot.js';
5
+ /** One read's bound: `cluster status` is a `kubectl version` plus a few list calls (inside the
6
+ * snapshot's 8 s budget). */
7
+ export const CLUSTER_TIMEOUT_MS = 6_000;
8
+ const DETAIL_MAX = 240;
9
+ /** Credential spellings an upstream diagnostic (kubectl, a webhook, the engine) can carry beyond the
10
+ * shapes `redactString` knows: an Authorization header of any scheme, a credential-named field in
11
+ * JSON or YAML spelling, and URL userinfo. */
12
+ const CREDENTIAL_SPELLINGS = [
13
+ [/\b(authorization|proxy-authorization)\s*[:=]\s*(?:"[^"]*"|'[^']*'|[A-Za-z]+\s+[^\s,;"']+|[^\s,;"']+)/gi, '$1: [REDACTED]'],
14
+ [/(["']?)\b(token|access[_-]?token|refresh[_-]?token|id[_-]?token|password|passwd|secret|client[_-]?secret|api[_-]?key|private[_-]?key)\1(\s*[:=]\s*)(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^\s,;}\]]+)/gi, '$1$2$1$3[REDACTED]'],
15
+ [/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi, '$1[REDACTED]@'],
16
+ ];
17
+ /** Engine (or kubectl) words as they may cross the wire, whole text: credentials redacted and every
18
+ * home path (this user's, a foreign or a JSON-escaped one) spelled `~`, before anything is cut. */
19
+ export function publicText(raw) {
20
+ let out = redactString(raw);
21
+ for (const [re, to] of CREDENTIAL_SPELLINGS)
22
+ out = out.replace(re, to);
23
+ return homeless(scrubHomePaths(out.replace(/\\\\/g, '\\')));
24
+ }
25
+ /** One line of {@link publicText}, bounded (sanitized BEFORE the cut, so a cut never exposes a prefix). */
26
+ export function publicLine(v) {
27
+ if (typeof v !== 'string' || v.trim() === '')
28
+ return null;
29
+ const line = publicText(v).split(/[\r\n]/, 1)[0]?.trim() ?? '';
30
+ if (line === '')
31
+ return null;
32
+ return line.length <= DETAIL_MAX ? line : `${line.slice(0, DETAIL_MAX - 1)}…`;
33
+ }
34
+ const words = publicLine;
35
+ const count = (v) => (typeof v === 'number' && Number.isInteger(v) && v >= 0 ? v : null);
36
+ /** Parse the engine's status document; `null` when stdout is not one. */
37
+ export function parseClusterStatus(stdout) {
38
+ let raw;
39
+ try {
40
+ raw = JSON.parse(stdout.trim());
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
46
+ return null;
47
+ const o = raw;
48
+ if (typeof o['configured'] !== 'boolean' || typeof o['reachable'] !== 'boolean')
49
+ return null;
50
+ const c = o['controller'];
51
+ const gw = o['gateway'];
52
+ return {
53
+ configured: o['configured'],
54
+ reachable: o['reachable'],
55
+ kind: typeof o['kind'] === 'string' && /^[a-z_]{1,40}$/.test(o['kind']) ? o['kind'] : null,
56
+ context: words(o['context']),
57
+ controller: c !== null && typeof c === 'object' && typeof c['ready'] === 'boolean' ? { ready: c['ready'], detail: words(c['detail']) } : null,
58
+ controllerVersion: words(o['controllerVersion']),
59
+ gateway: gw === 'serving' || gw === 'starting' || gw === 'stopped' || gw === 'absent' ? gw : null,
60
+ runNamespaces: count(o['runNamespaces']),
61
+ pendingPods: count(o['pendingPods']),
62
+ detail: words(o['detail']),
63
+ };
64
+ }
65
+ /** Run `cluster status --json` once. It exits 1 with a document when the cluster is not configured
66
+ * or does not answer, so a failed exit's stdout is read too; no document at all throws. */
67
+ export async function readClusterStatus(input) {
68
+ if (input.exe === null)
69
+ throw new Error('the engine CLI (WICKED_CORE_EXE) is not set, so the cluster cannot be read');
70
+ if (input.home === null)
71
+ throw new Error('this daemon has no state home to read its cluster from');
72
+ const args = ['cluster', 'status', '--json', '--home', input.home];
73
+ let stdout;
74
+ try {
75
+ stdout = (await input.exec(input.exe, args, { timeout: input.timeoutMs ?? CLUSTER_TIMEOUT_MS })).stdout;
76
+ }
77
+ catch (err) {
78
+ const out = err.stdout;
79
+ const doc = typeof out === 'string' ? parseClusterStatus(out) : null;
80
+ if (doc !== null)
81
+ return doc;
82
+ throw err;
83
+ }
84
+ const doc = parseClusterStatus(stdout);
85
+ if (doc === null)
86
+ throw new Error('the engine answered `cluster status` with something that is not a status document');
87
+ return doc;
88
+ }
89
+ /** Single-flight reader shared by `/system` and `/diagnostics`. The flight is the engine process
90
+ * itself, not a caller's wait: a caller that gives up (its own, shorter bound) leaves the one process
91
+ * running, and the next caller joins it rather than starting another. The process is bounded by the
92
+ * exec's own timeout ({@link CLUSTER_TIMEOUT_MS}), which kills it. */
93
+ export class ClusterStatusReader {
94
+ input;
95
+ running = null;
96
+ constructor(input) {
97
+ this.input = input;
98
+ }
99
+ /** Settle within `boundMs` (default and maximum: {@link CLUSTER_TIMEOUT_MS}). */
100
+ read(boundMs = CLUSTER_TIMEOUT_MS) {
101
+ if (this.running === null) {
102
+ const run = readClusterStatus(this.input());
103
+ this.running = run;
104
+ // Cleared only when the process has really ended (a timed-out wait does not end it).
105
+ run.then(() => undefined, () => undefined).finally(() => { if (this.running === run)
106
+ this.running = null; });
107
+ }
108
+ const run = this.running;
109
+ return settleWithin(() => run, Math.max(0, Math.min(boundMs, CLUSTER_TIMEOUT_MS)));
110
+ }
111
+ }
112
+ /** `/diagnostics.cluster`: the document, or why there is none. */
113
+ export function clusterDiagnostics(read) {
114
+ if (read.kind === 'ok')
115
+ return { ...read.value, read: 'ok' };
116
+ if (read.kind === 'timeout')
117
+ return { read: 'timeout', detail: `no answer within ${Math.max(1, Math.round(read.ms / 1000))} s` };
118
+ return { read: 'error', detail: publicLine(read.full ?? read.error) ?? 'the cluster could not be read' };
119
+ }
120
+ const INSTALL = 'Run `wicked-core cluster install --admin-context <your cluster context> --home <this daemon\'s state home>`, then re-check.';
121
+ const BY_HAND = 'Re-check; if it persists, run `wicked-core cluster status --home <this daemon\'s state home>` by hand.';
122
+ const START = 'Start Rancher Desktop (or Docker Desktop) with Kubernetes on, then re-check.';
123
+ function detailsOf(s) {
124
+ return {
125
+ configured: s.configured, reachable: s.reachable, kind: s.kind, context: s.context,
126
+ controllerReady: s.controller?.ready ?? null, controllerVersion: s.controllerVersion,
127
+ gateway: s.gateway, runNamespaces: s.runNamespaces, pendingPods: s.pendingPods,
128
+ };
129
+ }
130
+ /** The `cluster` and `gateway` rows from one read. Off the container floor both are `off`. */
131
+ export function clusterRows(read, containerFloor, startedAt) {
132
+ if (!containerFloor || read === null) {
133
+ const why = 'not used: seats run on the host floor, not in pods';
134
+ return {
135
+ cluster: infraRow('cluster', 'off', why, null, startedAt, { floor: 'host' }),
136
+ gateway: infraRow('gateway', 'off', 'not used: seats run on the host floor, not in containers', null, startedAt, { floor: 'host' }),
137
+ };
138
+ }
139
+ if (read.kind === 'timeout') {
140
+ // The wait this caller gave it (the snapshot's remaining budget can be shorter than the engine's bound).
141
+ const waited = Math.max(1, Math.round(read.ms / 1000));
142
+ const why = `the cluster did not answer within ${waited} s`;
143
+ return {
144
+ cluster: infraRow('cluster', 'unknown', why, 'Re-check; a loaded host can slow kubectl down.', startedAt, {}, read.ms),
145
+ gateway: infraRow('gateway', 'unknown', `${why}, so the gateway could not be read`, 'Re-check.', startedAt, {}, read.ms),
146
+ };
147
+ }
148
+ if (read.kind === 'error') {
149
+ const why = publicLine(read.full ?? read.error) ?? 'no answer';
150
+ return {
151
+ cluster: infraRow('cluster', 'unknown', `the cluster could not be read: ${why}`, BY_HAND, startedAt, { error: why }),
152
+ gateway: infraRow('gateway', 'unknown', 'the cluster could not be read, so neither could the gateway', 'Re-check.', startedAt),
153
+ };
154
+ }
155
+ const s = read.value;
156
+ const d = detailsOf(s);
157
+ if (!s.configured) {
158
+ return {
159
+ cluster: infraRow('cluster', 'down', 'no Kubernetes cluster is configured for this daemon, so governed seats cannot start', INSTALL, startedAt, d),
160
+ gateway: infraRow('gateway', 'down', 'no cluster is configured, so there is no gateway', INSTALL, startedAt, d),
161
+ };
162
+ }
163
+ const ctx = s.context !== null ? ` (context ${s.context})` : '';
164
+ if (!s.reachable) {
165
+ // The API did not answer: pods already running (the gateway among them) may still serve, so the
166
+ // gateway is unobserved, not stopped.
167
+ return {
168
+ cluster: infraRow('cluster', 'down', `Kubernetes isn't answering${ctx}, so no seat can start`, START, startedAt, d),
169
+ gateway: infraRow('gateway', 'unknown', "the cluster isn't answering, so the gateway could not be read", START, startedAt, d),
170
+ };
171
+ }
172
+ // Each row from its own evidence: a known controller failure is never hidden by an unread gateway,
173
+ // nor a serving gateway by an unread controller.
174
+ const counted = (n, one, many) => (n === null ? null : `${n} ${n === 1 ? one : many}`);
175
+ const load = [
176
+ counted(s.runNamespaces, 'run namespace', 'run namespaces') ?? 'run namespaces not counted',
177
+ s.pendingPods === null ? 'pending pods not counted' : s.pendingPods > 0 ? counted(s.pendingPods, 'pod waiting to start', 'pods waiting to start') : null,
178
+ ].filter((x) => x !== null).join(', ');
179
+ const cluster = s.controller === null
180
+ ? infraRow('cluster', 'degraded', `answers${ctx}, but its sandbox controller could not be read${s.detail !== null ? `: ${s.detail}` : ''}`, BY_HAND, startedAt, d)
181
+ : !s.controller.ready
182
+ ? infraRow('cluster', 'down', `answers${ctx}, but its sandbox controller isn't ready${s.controller.detail !== null ? ` (${s.controller.detail})` : ''}: missing, still starting or not the pinned version, so no seat can be created`, `If it stays so, ${INSTALL.charAt(0).toLowerCase()}${INSTALL.slice(1)}`, startedAt, d)
183
+ : s.detail !== null
184
+ ? infraRow('cluster', 'degraded', `ready${ctx}, but part of it could not be read: ${s.detail}`, BY_HAND, startedAt, d)
185
+ : infraRow('cluster', 'ok', `ready${ctx}: ${load}`, null, startedAt, d);
186
+ const gateway = s.gateway === null
187
+ ? infraRow('gateway', 'unknown', 'the cluster answered, but the gateway could not be read', BY_HAND, startedAt, d)
188
+ : s.gateway === 'serving'
189
+ ? infraRow('gateway', 'ok', 'serving (in the cluster)', null, startedAt, d)
190
+ : s.gateway === 'starting'
191
+ ? infraRow('gateway', 'degraded', 'starting: its pod is not serving yet', 'Re-check in a minute; a run waits for it.', startedAt, d)
192
+ : s.gateway === 'stopped'
193
+ ? infraRow('gateway', 'down', 'stopped: scaled to no replicas (a quarantine), so seats have no route to their models', 'The engine starts it again before the next seat runs; a run that cannot says why on its gate.', startedAt, d)
194
+ : infraRow('gateway', 'degraded', 'not started yet: the engine starts it before the first seat runs', 'Nothing to do unless a run is waiting on it; a run that cannot start its gateway says why on its gate.', startedAt, d);
195
+ return { cluster, gateway };
196
+ }
197
+ //# sourceMappingURL=cluster-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cluster-status.js","sourceRoot":"","sources":["../../src/api/cluster-status.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAgB,MAAM,sBAAsB,CAAC;AAE5E;8BAC8B;AAC9B,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAsBxC,MAAM,UAAU,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;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA2BjK;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAohBhF"}
package/dist/api/mcp.js CHANGED
@@ -98,7 +98,7 @@ const secretValue = z
98
98
  .max(8192)
99
99
  .refine((v) => !/[\r\n\0]/.test(v), { error: 'a secret is one line' });
100
100
  const AuthSchema = z.strictObject({
101
- ref: z.string().refine((r) => parseSecretRef(r) !== null, { error: 'ref must be keychain:wicked-mcp/<name> or env:<NAME>' }),
101
+ ref: z.string().refine((r) => parseSecretRef(r) !== null, { error: 'ref must be keychain:wicked-mcp/<name>, env:<NAME> or gh-cli:<github login>' }),
102
102
  env: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/).optional(),
103
103
  header: z.string().regex(/^[A-Za-z0-9-]{1,64}$/).optional(),
104
104
  prefix: z.string().max(32).optional(),
@@ -182,6 +182,8 @@ export const McpServerConfigSchema = z.strictObject({
182
182
  return false;
183
183
  }
184
184
  };
185
+ if (c.auth != null && c.auth.ref.startsWith('gh-cli:') && c.pm?.system !== 'github')
186
+ issue('auth', 'a gh-cli credential is for a GitHub project-management source only (pm.system github)');
185
187
  if (c.kind !== 'rest' && (c.openapiUrl !== undefined || c.openapi !== undefined || c.operations !== undefined)) {
186
188
  issue('openapi', 'openapiUrl, openapi and operations are for a rest server');
187
189
  }