@catalyst-cloud/cli 0.16.4 → 0.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/onboard-next.js +1 -0
- package/dist/onboard-runner-custody.js +680 -0
- package/dist/onboard-runner.js +158 -40
- package/package.json +4 -4
- package/skills/catalyst-github/SKILL.md +1 -1
- package/skills/catalyst-linear/SKILL.md +1 -1
- package/skills/catalyst-onboard/SKILL.md +2 -1
- package/skills/catalyst-onboard/references/preserving-runner-replacement.md +26 -0
- package/skills/run-this-project/SKILL.md +1 -1
- package/skills/unstick/SKILL.md +1 -1
- package/skills/what-needs-me/SKILL.md +1 -1
- package/skills/what-this-repo-needs/SKILL.md +1 -1
- package/skills/whats-happening/SKILL.md +1 -1
- package/vendor/self-host/compose.darwin-thoughts.yaml +18 -0
- package/vendor/self-host/compose.yaml +4 -3
- package/vendor/self-host/darwin-thoughts-custody/manifest.json +18 -0
- package/vendor/self-host/darwin-thoughts-custody/producer.mjs +1202 -0
- package/vendor/self-host/darwin-thoughts-custody/service.plist.in +21 -0
- package/vendor/self-host/darwin-thoughts-custody/verifier.d.mts +157 -0
- package/vendor/self-host/darwin-thoughts-custody/verifier.mjs +755 -0
- package/vendor/self-host/darwin-thoughts-custody/watchdog-deadline.mjs +39 -0
- package/vendor/self-host/darwin-thoughts-custody/watchdog.mjs +85 -0
- package/vendor/self-host/provenance.json +10 -2
package/dist/onboard-runner.js
CHANGED
|
@@ -8,22 +8,24 @@ import { runnerAdmission, issueRunnerOrgKey, verifyRunnerRoutes } from "./onboar
|
|
|
8
8
|
import { verifyOnboardRoutes } from "./onboard-capabilities.js";
|
|
9
9
|
import { liveTeamKey, onboardTeamAdmission } from "./onboard-capacity.js";
|
|
10
10
|
import { runnerVmCapabilities } from "./onboard-runner-probes.js";
|
|
11
|
+
import { installDarwinThoughtsCustody } from "./onboard-runner-custody.js";
|
|
12
|
+
import { canonicalDarwinThoughtsJson, parseDarwinThoughtsAuthority } from "../vendor/self-host/darwin-thoughts-custody/verifier.mjs";
|
|
11
13
|
import { readExistingOnboardJson, readOnboardTeamInventory, selectedOnboardTeam, } from "./onboard-existing.js";
|
|
12
14
|
import { onboardStateRoot, } from "./onboard.js";
|
|
13
15
|
// "Run Catalyst's work on this machine": the self-hosted host from catalyst-cloud's deploy/self-host
|
|
14
16
|
// (a supervisor and a deadline watchdog under Compose), enrolled with the person's own owner or
|
|
15
|
-
// admin login. Never the operator token.
|
|
16
|
-
// disposable Docker config
|
|
17
|
+
// admin login. Never the operator token. Native Linux pulls missing images anonymously with an
|
|
18
|
+
// empty disposable Docker config; Darwin custody receives only already-cached pinned images.
|
|
17
19
|
/** The Compose project name the vendored file declares. */
|
|
18
20
|
export const RUNNER_PROJECT = "catalyst-host";
|
|
19
21
|
export const RUNNER_SESSION_NETWORK = "catalyst-session-v1";
|
|
20
|
-
/** Public multi-architecture images
|
|
21
|
-
* runner
|
|
22
|
+
/** Public multi-architecture images from main 3d657787e8: host run 38043266620,
|
|
23
|
+
* runner run 38042751509. Explicit environment image values override
|
|
22
24
|
* these pins; the runner also preserves a saved image before choosing its default. */
|
|
23
25
|
export const RUNNER_HOST_IMAGES = {
|
|
24
|
-
supervisor: "ghcr.io/coalesce-labs/catalyst-supervisor@sha256:
|
|
25
|
-
watchdog: "ghcr.io/coalesce-labs/catalyst-deadline-watchdog@sha256:
|
|
26
|
-
runner: "ghcr.io/coalesce-labs/catalyst-runner@sha256:
|
|
26
|
+
supervisor: "ghcr.io/coalesce-labs/catalyst-supervisor@sha256:a0a8f383b5869eddc8346b7d07fd98d92fe1cd4cfc57956cbbe9dc42d79a4727",
|
|
27
|
+
watchdog: "ghcr.io/coalesce-labs/catalyst-deadline-watchdog@sha256:a5999dbf229ac432b83c2ed3fe43fa251366baceb73af2f57590890a6a758f0d",
|
|
28
|
+
runner: "ghcr.io/coalesce-labs/catalyst-runner@sha256:88c6143f6c95f92fca9ca385f3c5145389e6d6d0532398c52d225d0edfcf2ea8",
|
|
27
29
|
};
|
|
28
30
|
const IMAGE_REF = /^[a-z0-9][a-z0-9._:/-]{0,255}@sha256:[0-9a-f]{64}$/;
|
|
29
31
|
const HOST_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/;
|
|
@@ -33,6 +35,31 @@ const JOIN_TOKENS = "/api/v1/hosts/join-tokens";
|
|
|
33
35
|
const CAPACITY = "/api/v1/me/runner-capacity";
|
|
34
36
|
const RUNNER_UID = "10001:10001";
|
|
35
37
|
const DIRS = ["slots", "thoughts", "locks"];
|
|
38
|
+
const CUSTODY_KEYS = [
|
|
39
|
+
"CATALYST_THOUGHTS_CUSTODY_AUTHORITY",
|
|
40
|
+
"CATALYST_THOUGHTS_CUSTODY_REQUESTS_DIR",
|
|
41
|
+
"CATALYST_THOUGHTS_CUSTODY_RESPONSES_DIR",
|
|
42
|
+
];
|
|
43
|
+
/** A persisted authority selects bindings, never substitutes for a fresh native proof. */
|
|
44
|
+
function persistedCustody(dir, values) {
|
|
45
|
+
const present = CUSTODY_KEYS.map(key => values?.[key] ?? "");
|
|
46
|
+
if (present.every(value => !value))
|
|
47
|
+
return "absent";
|
|
48
|
+
if (present.some(value => !value))
|
|
49
|
+
return "invalid";
|
|
50
|
+
try {
|
|
51
|
+
const authority = parseDarwinThoughtsAuthority(JSON.parse(present[0]));
|
|
52
|
+
return canonicalDarwinThoughtsJson(authority) === present[0] &&
|
|
53
|
+
authority.thoughtsRoot === join(dir, "thoughts") && authority.locksRoot === join(dir, "locks") &&
|
|
54
|
+
authority.requestsRoot === present[1] && authority.responsesRoot === present[2] &&
|
|
55
|
+
authority.requestsRoot === join(dir, "..", "darwin-thoughts-requests") &&
|
|
56
|
+
authority.responsesRoot === join(dir, "..", "darwin-thoughts-responses")
|
|
57
|
+
? "installed" : "invalid";
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return "invalid";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
36
63
|
const DISK_POLICY_KEYS = [
|
|
37
64
|
"CATALYST_SLOTS",
|
|
38
65
|
"CATALYST_SLOT_DISK_MODE", "CATALYST_SLOT_DISK_BUDGET_GIB", "CATALYST_DISK_BUDGET_GIB",
|
|
@@ -76,27 +103,38 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
76
103
|
return { code: 1, stdout: "" };
|
|
77
104
|
}
|
|
78
105
|
};
|
|
79
|
-
const compose = (dir) =>
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
const compose = (dir) => {
|
|
107
|
+
const custody = persistedCustody(dir, readEnvFile(join(dir, ".env")));
|
|
108
|
+
if (custody === "invalid")
|
|
109
|
+
return null;
|
|
110
|
+
return [
|
|
111
|
+
"compose",
|
|
112
|
+
"--project-name",
|
|
113
|
+
RUNNER_PROJECT,
|
|
114
|
+
"--file",
|
|
115
|
+
join(dir, "compose.yaml"),
|
|
116
|
+
...(custody === "installed" ? ["--file", join(dir, "compose.darwin-thoughts.yaml")] : []),
|
|
117
|
+
"--env-file",
|
|
118
|
+
join(dir, ".env"),
|
|
119
|
+
];
|
|
120
|
+
};
|
|
121
|
+
const supervisorShell = (dir, script) => {
|
|
122
|
+
const files = compose(dir);
|
|
123
|
+
if (!files)
|
|
124
|
+
return null;
|
|
125
|
+
return [
|
|
126
|
+
...files,
|
|
127
|
+
"run",
|
|
128
|
+
"--rm",
|
|
129
|
+
"-T",
|
|
130
|
+
"--no-deps",
|
|
131
|
+
"--entrypoint",
|
|
132
|
+
"sh",
|
|
133
|
+
"supervisor",
|
|
134
|
+
"-c",
|
|
135
|
+
script,
|
|
136
|
+
];
|
|
137
|
+
};
|
|
100
138
|
let nativeLocal = false;
|
|
101
139
|
const endpoint = async (signal) => {
|
|
102
140
|
// Reject conflicting selectors rather than infer precedence across Docker/Compose versions.
|
|
@@ -163,17 +201,37 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
163
201
|
const labels = config?.Labels;
|
|
164
202
|
const dir = labels?.["com.docker.compose.project.working_dir"];
|
|
165
203
|
if (config?.Image !== supervisorImage || labels?.["com.docker.compose.project"] !== RUNNER_PROJECT ||
|
|
166
|
-
labels?.["com.docker.compose.service"] !== "supervisor" || typeof dir !== "string" || !isAbsolute(dir)
|
|
167
|
-
labels?.["com.docker.compose.project.config_files"] !== join(dir, "compose.yaml"))
|
|
204
|
+
labels?.["com.docker.compose.service"] !== "supervisor" || typeof dir !== "string" || !isAbsolute(dir))
|
|
168
205
|
return "unverified";
|
|
169
206
|
const inHome = relative(realpathSync(home), realpathSync(dir));
|
|
170
207
|
if (inHome === ".." || inHome.startsWith("../") || isAbsolute(inHome) || !lstatSync(dir).isDirectory())
|
|
171
208
|
return "unverified";
|
|
209
|
+
const saved = readEnvFile(join(dir, ".env"));
|
|
210
|
+
const custody = persistedCustody(dir, saved);
|
|
211
|
+
if (custody === "invalid")
|
|
212
|
+
return "unverified";
|
|
213
|
+
const files = [join(dir, "compose.yaml"), ...(custody === "installed" ? [join(dir, "compose.darwin-thoughts.yaml")] : [])];
|
|
214
|
+
if (labels?.["com.docker.compose.project.config_files"] !== files.join(","))
|
|
215
|
+
return "unverified";
|
|
172
216
|
for (const path of [join(dir, "compose.yaml"), join(dir, ".env")]) {
|
|
173
217
|
const stat = lstatSync(path);
|
|
174
218
|
if (!stat.isFile() || stat.uid !== process.getuid?.() || (stat.mode & 0o022) !== 0)
|
|
175
219
|
return "unverified";
|
|
176
220
|
}
|
|
221
|
+
if (custody === "installed") {
|
|
222
|
+
for (const path of [join(dir, ".env"), join(dir, "compose.darwin-thoughts.yaml")]) {
|
|
223
|
+
const stat = lstatSync(path);
|
|
224
|
+
if (!stat.isFile() || stat.nlink !== 1 || stat.uid !== process.getuid?.() ||
|
|
225
|
+
(stat.mode & 0o7777) !== 0o600)
|
|
226
|
+
return "unverified";
|
|
227
|
+
}
|
|
228
|
+
for (const key of CUSTODY_KEYS.slice(1)) {
|
|
229
|
+
const stat = lstatSync(saved[key]);
|
|
230
|
+
if (!stat.isDirectory() || stat.uid !== process.getuid?.() ||
|
|
231
|
+
(stat.mode & 0o7777) !== 0o700)
|
|
232
|
+
return "unverified";
|
|
233
|
+
}
|
|
234
|
+
}
|
|
177
235
|
if (!Array.isArray(config.Env) || !config.Env.every((entry) => typeof entry === "string"))
|
|
178
236
|
return "unverified";
|
|
179
237
|
const names = config.Env.filter((entry) => entry.startsWith("CATALYST_HOST_NAME="));
|
|
@@ -261,6 +319,9 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
261
319
|
return runnerVmCapabilities({ paths: DIRS.map(sub => join(dir, sub)), image, baseUrl,
|
|
262
320
|
exec: docker, env, signal });
|
|
263
321
|
},
|
|
322
|
+
async nativeThoughtsCustody(input, signal) {
|
|
323
|
+
return installDarwinThoughtsCustody({ ...input, deadlineMs: Date.now() + 30_000 }, signal);
|
|
324
|
+
},
|
|
264
325
|
async socketGid() {
|
|
265
326
|
if (!nativeLocal)
|
|
266
327
|
return null;
|
|
@@ -272,8 +333,11 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
272
333
|
}
|
|
273
334
|
},
|
|
274
335
|
async claimDirs(dir, paths, signal) {
|
|
336
|
+
const files = compose(dir);
|
|
337
|
+
if (!files)
|
|
338
|
+
return false;
|
|
275
339
|
const args = [
|
|
276
|
-
...
|
|
340
|
+
...files,
|
|
277
341
|
"run",
|
|
278
342
|
"--rm",
|
|
279
343
|
"-T",
|
|
@@ -293,13 +357,19 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
293
357
|
0);
|
|
294
358
|
},
|
|
295
359
|
async hasVolumeFile(dir, variable, signal) {
|
|
296
|
-
|
|
360
|
+
const args = supervisorShell(dir, `test -s "$${variable}"`);
|
|
361
|
+
if (!args)
|
|
362
|
+
return false;
|
|
363
|
+
return ((await docker(args, {
|
|
297
364
|
cwd: dir,
|
|
298
365
|
signal,
|
|
299
366
|
timeoutMs: 120_000,
|
|
300
367
|
})).code === 0);
|
|
301
368
|
},
|
|
302
369
|
async enrollment(dir, signal) {
|
|
370
|
+
const files = compose(dir);
|
|
371
|
+
if (!files)
|
|
372
|
+
return null;
|
|
303
373
|
const script = `(() => { const {readFileSync}=require("node:fs");
|
|
304
374
|
try { const state=JSON.parse(readFileSync(process.env.CATALYST_HOST_CREDENTIAL_FILE,"utf8"));
|
|
305
375
|
if (state.version!==1 || typeof state.secret!=="string" || !/^[A-Za-z0-9_-]{32,256}$/.test(state.secret)) process.exit(1);
|
|
@@ -313,7 +383,7 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
313
383
|
if (!e) process.exit(1);
|
|
314
384
|
process.stdout.write(JSON.stringify({hostId:e.hostId,tenant:e.tenant,team:e.team,enrollmentKind:e.enrollmentKind}));
|
|
315
385
|
} catch { process.exit(1); } })();`;
|
|
316
|
-
const read = await docker([...
|
|
386
|
+
const read = await docker([...files, "run", "--rm", "-T", "--no-deps", "--entrypoint", "bun", "supervisor", "-e", script], { cwd: dir, signal, timeoutMs: 120_000 });
|
|
317
387
|
if (read.code !== 0)
|
|
318
388
|
return null;
|
|
319
389
|
try {
|
|
@@ -330,6 +400,9 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
330
400
|
}
|
|
331
401
|
},
|
|
332
402
|
async orgKeyStatus(dir, account, baseUrl, candidate, signal) {
|
|
403
|
+
const files = compose(dir);
|
|
404
|
+
if (!files)
|
|
405
|
+
return "unavailable";
|
|
333
406
|
// Only a status leaves the container. No stored key or provider response is printed.
|
|
334
407
|
const script = `(async () => {
|
|
335
408
|
const {readFileSync,lstatSync}=require("node:fs");
|
|
@@ -358,7 +431,7 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
358
431
|
return status(proposed && proposed!==stored ? "different" : "valid");
|
|
359
432
|
} catch { return status("unavailable"); }
|
|
360
433
|
})().catch(()=>process.stdout.write("unavailable"));`;
|
|
361
|
-
const read = await docker([...
|
|
434
|
+
const read = await docker([...files, "run", "--rm", "-T", "--no-deps", "--entrypoint", "bun", "supervisor", "-e", script, baseUrl, account], { cwd: dir, input: candidate ? `${candidate}\n` : undefined, signal, timeoutMs: 120_000 });
|
|
362
435
|
const status = read.stdout.trim();
|
|
363
436
|
return read.code === 0 && ["valid", "different", "missing", "invalid", "unavailable"].includes(status)
|
|
364
437
|
? status : "unavailable";
|
|
@@ -367,7 +440,10 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
367
440
|
if (variable !== "CATALYST_ORG_KEY_FILE")
|
|
368
441
|
return false;
|
|
369
442
|
const script = `umask 077 && tmp=$(mktemp "$${variable}.onboard.XXXXXX") && trap 'rm -f "$tmp"' EXIT && cat > "$tmp" && test -s "$tmp" && chmod 600 "$tmp" && mv -f "$tmp" "$${variable}"`;
|
|
370
|
-
|
|
443
|
+
const args = supervisorShell(dir, script);
|
|
444
|
+
if (!args)
|
|
445
|
+
return false;
|
|
446
|
+
return ((await docker(args, {
|
|
371
447
|
cwd: dir,
|
|
372
448
|
input: `${value}\n`,
|
|
373
449
|
signal,
|
|
@@ -375,11 +451,17 @@ export function dockerRunnerEngine(deps = {}) {
|
|
|
375
451
|
})).code === 0);
|
|
376
452
|
},
|
|
377
453
|
async composeUp(dir, signal) {
|
|
378
|
-
|
|
454
|
+
const files = compose(dir);
|
|
455
|
+
if (!files)
|
|
456
|
+
return false;
|
|
457
|
+
return ((await docker([...files, "up", "--detach"], { cwd: dir, signal, timeoutMs: 600_000 }))
|
|
379
458
|
.code === 0);
|
|
380
459
|
},
|
|
381
460
|
async composeRunning(dir, signal) {
|
|
382
|
-
const
|
|
461
|
+
const files = compose(dir);
|
|
462
|
+
if (!files)
|
|
463
|
+
return false;
|
|
464
|
+
const read = await docker([...files, "ps", "--status", "running", "--services"], { cwd: dir, signal });
|
|
383
465
|
return (read.code === 0 &&
|
|
384
466
|
read.stdout.split("\n").some((line) => line.trim() === "supervisor"));
|
|
385
467
|
},
|
|
@@ -479,6 +561,7 @@ export function onboardRunnerAdapter(input = {}) {
|
|
|
479
561
|
let mayAct = false;
|
|
480
562
|
let acted = false;
|
|
481
563
|
let chosenName;
|
|
564
|
+
let receivedCustody;
|
|
482
565
|
const selected = { selected: true };
|
|
483
566
|
async function decide(journal) {
|
|
484
567
|
if (decided !== undefined)
|
|
@@ -600,6 +683,11 @@ export function onboardRunnerAdapter(input = {}) {
|
|
|
600
683
|
CATALYST_SLOTS_DIR: join(p.dir, "slots"),
|
|
601
684
|
CATALYST_THOUGHTS_DIR: join(p.dir, "thoughts"),
|
|
602
685
|
CATALYST_POOL_LOCK_DIR: join(p.dir, "locks"),
|
|
686
|
+
...(p.info.vm && receivedCustody?.dir === p.dir ? {
|
|
687
|
+
CATALYST_THOUGHTS_CUSTODY_AUTHORITY: receivedCustody.result.envAuthority,
|
|
688
|
+
CATALYST_THOUGHTS_CUSTODY_REQUESTS_DIR: receivedCustody.result.requestsRoot,
|
|
689
|
+
CATALYST_THOUGHTS_CUSTODY_RESPONSES_DIR: receivedCustody.result.responsesRoot,
|
|
690
|
+
} : {}),
|
|
603
691
|
CATALYST_SESSION_EGRESS_DIR: p.info.vm ? join(p.dir, "session-egress") : NATIVE_EGRESS_DIR,
|
|
604
692
|
// Saved policy stays in merged(). An explicit value in this run overrides it.
|
|
605
693
|
...Object.fromEntries(DISK_POLICY_KEYS.flatMap(key => ctx.env[key] === undefined ? [] : [[key, ctx.env[key]]])),
|
|
@@ -677,6 +765,8 @@ export function onboardRunnerAdapter(input = {}) {
|
|
|
677
765
|
if (!want)
|
|
678
766
|
return waiting("runner_docker_socket_unreadable", selected);
|
|
679
767
|
const name = want.CATALYST_HOST_NAME;
|
|
768
|
+
if (p.info.vm && persistedCustody(p.dir, saved) !== "installed")
|
|
769
|
+
return mayAct && !afterAct ? { state: "pending" } : waiting(mayAct ? "runner_thoughts_custody_unavailable" : "runner_needs_runner_flag", { ...selected, hostName: name });
|
|
680
770
|
let enrolled = null;
|
|
681
771
|
const live = (hosts) => hosts?.find((host) => host.hostId === enrolled?.hostId && host.team === p.teamKey && !host.revoked);
|
|
682
772
|
let hosts = await listHosts(ctx, p, signal);
|
|
@@ -699,6 +789,8 @@ export function onboardRunnerAdapter(input = {}) {
|
|
|
699
789
|
let composeMatches = false;
|
|
700
790
|
try {
|
|
701
791
|
composeMatches = readFileSync(join(p.dir, "compose.yaml")).equals(readFileSync(join(packageRoot(), "vendor", "self-host", "compose.yaml")));
|
|
792
|
+
if (p.info.vm)
|
|
793
|
+
composeMatches = composeMatches && readFileSync(join(p.dir, "compose.darwin-thoughts.yaml")).equals(readFileSync(join(packageRoot(), "vendor", "self-host", "compose.darwin-thoughts.yaml")));
|
|
702
794
|
}
|
|
703
795
|
catch {
|
|
704
796
|
/* A missing or unreadable compose needs an explicitly authorized repair. */
|
|
@@ -778,11 +870,13 @@ export function onboardRunnerAdapter(input = {}) {
|
|
|
778
870
|
mkdirSync(p.dir, { recursive: true, mode: 0o700 });
|
|
779
871
|
if (lstatSync(p.dir).isSymbolicLink())
|
|
780
872
|
throw new Error("runner_directory_unsafe");
|
|
781
|
-
|
|
873
|
+
if (!p.info.vm)
|
|
874
|
+
chmodSync(p.dir, 0o700);
|
|
782
875
|
for (const sub of DIRS) {
|
|
783
876
|
mkdirSync(join(p.dir, sub), { recursive: true, mode: 0o700 });
|
|
784
877
|
// On native Linux the runner uid owns these after the first run; leave them alone.
|
|
785
|
-
|
|
878
|
+
// The native Darwin installer must receive existing thoughts custody without adoption.
|
|
879
|
+
if ((!p.info.vm || sub === "slots") && statSync(join(p.dir, sub)).uid === process.getuid?.())
|
|
786
880
|
chmodSync(join(p.dir, sub), 0o700);
|
|
787
881
|
}
|
|
788
882
|
// Mounted read-only into the supervisor (uid 10001), which reads the egress attestation.
|
|
@@ -833,7 +927,7 @@ export function onboardRunnerAdapter(input = {}) {
|
|
|
833
927
|
if (!writeEnv(want))
|
|
834
928
|
return { state: "failed", reason: "runner_directory_unavailable", evidence: selected };
|
|
835
929
|
for (const ref of Object.values(p.images)) {
|
|
836
|
-
if (!(await engine.imageArch(ref, signal))) {
|
|
930
|
+
if (!(await engine.imageArch(ref, signal)) && !p.info.vm) {
|
|
837
931
|
await engine.pull(ref, signal);
|
|
838
932
|
}
|
|
839
933
|
const arch = await engine.imageArch(ref, signal);
|
|
@@ -846,6 +940,30 @@ export function onboardRunnerAdapter(input = {}) {
|
|
|
846
940
|
const capability = await engine.vmCapabilities(p.dir, p.images.supervisor, p.baseUrl, signal);
|
|
847
941
|
if (capability !== "ready")
|
|
848
942
|
return waiting(capability, selected);
|
|
943
|
+
try {
|
|
944
|
+
if (!engine.nativeThoughtsCustody)
|
|
945
|
+
return waiting("runner_thoughts_custody_unavailable", selected);
|
|
946
|
+
const result = await engine.nativeThoughtsCustody({ dir: p.dir,
|
|
947
|
+
supervisorImage: p.images.supervisor, runnerImage: p.images.runner }, signal);
|
|
948
|
+
if (signal?.aborted)
|
|
949
|
+
return waiting("interrupted", selected);
|
|
950
|
+
const values = {
|
|
951
|
+
CATALYST_THOUGHTS_CUSTODY_AUTHORITY: result.envAuthority,
|
|
952
|
+
CATALYST_THOUGHTS_CUSTODY_REQUESTS_DIR: result.requestsRoot,
|
|
953
|
+
CATALYST_THOUGHTS_CUSTODY_RESPONSES_DIR: result.responsesRoot,
|
|
954
|
+
};
|
|
955
|
+
if (persistedCustody(p.dir, values) !== "installed" ||
|
|
956
|
+
canonicalDarwinThoughtsJson(result.authority) !== result.envAuthority)
|
|
957
|
+
return waiting("runner_thoughts_custody_unavailable", selected);
|
|
958
|
+
writePrivate(join(p.dir, "compose.darwin-thoughts.yaml"), readFileSync(join(packageRoot(), "vendor", "self-host", "compose.darwin-thoughts.yaml"), "utf8"));
|
|
959
|
+
receivedCustody = { dir: p.dir, result };
|
|
960
|
+
want = (await desiredEnv(p, ctx));
|
|
961
|
+
if (!writeEnv(want))
|
|
962
|
+
return { state: "failed", reason: "runner_directory_unavailable", evidence: selected };
|
|
963
|
+
}
|
|
964
|
+
catch {
|
|
965
|
+
return waiting(signal?.aborted ? "interrupted" : "runner_thoughts_custody_unavailable", selected);
|
|
966
|
+
}
|
|
849
967
|
}
|
|
850
968
|
const network = await engine.network(RUNNER_SESSION_NETWORK, signal);
|
|
851
969
|
if (network === "misshaped")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catalyst-cloud/cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.6",
|
|
4
4
|
"description": "Set up Catalyst Cloud, check your tickets and manage your account from the command line.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"prepublishOnly": "node scripts/release-train-check.mjs --publish cli"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@catalyst-cloud/sdk": "0.16.
|
|
56
|
+
"@catalyst-cloud/sdk": "0.16.3",
|
|
57
57
|
"@clack/prompts": "1.8.1",
|
|
58
58
|
"fast-string-width": "3.0.2",
|
|
59
59
|
"fast-wrap-ansi": "0.2.2",
|
|
60
60
|
"smol-toml": "^1.7.1",
|
|
61
61
|
"yaml": "^2.9.0",
|
|
62
|
-
"@catalyst-cloud/sdk-replica-node": "0.16.
|
|
62
|
+
"@catalyst-cloud/sdk-replica-node": "0.16.3"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@catalyst-cloud/schema": "0.16.
|
|
65
|
+
"@catalyst-cloud/schema": "0.16.2",
|
|
66
66
|
"@types/node": "^26.3.0",
|
|
67
67
|
"@vitest/coverage-v8": "^4.1.11",
|
|
68
68
|
"typescript": "^7.0.2",
|
|
@@ -4,7 +4,7 @@ description: >-
|
|
|
4
4
|
Catalyst's GitHub: show a ticket's pull request with its checks, reviews and review threads, say whether it is mergeable under this repository's policy, and explain what a PR accumulates as the ticket moves (the branch, the draft, the rewrite, the force-pushes, the labels, the queue). Use when someone asks "show me the PR", "what are the checks saying", "why hasn't it merged", "what does the queue need", "what does that label mean", or wants the branch and merge conventions Catalyst follows.
|
|
5
5
|
allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
|
|
6
6
|
---
|
|
7
|
-
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.
|
|
7
|
+
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.6 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# Catalyst's GitHub
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: >-
|
|
|
4
4
|
Catalyst's view of Linear on the customer's own cloud account. Reads a ticket with its comments, relations, labels, linked pull requests and agent sessions inline, from the cloud API by default, with local replica reads available as an explicit opt-in, always naming the source; searches tickets, PRs, projects and initiatives; writes comments, card moves, labels and new tickets through the account's agent proxy as the app actor, with every route, stage id, label id and marker read from the account's contract. Knows what a ticket accumulates as Catalyst works it (phase-outcome comments, the document per phase, the agent session, the labels, the single blocks relation, the bookkeeping marker, the eyes acknowledgement). Use when a person says "show me the ticket", "what did Catalyst write on it", "comment on it", "move it", "label it" or "file a ticket". Not for raising a decision for a human (what-needs-me) and not for pull requests (catalyst-github).
|
|
5
5
|
allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
|
|
6
6
|
---
|
|
7
|
-
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.
|
|
7
|
+
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.6 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# Catalyst Linear
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: >-
|
|
|
4
4
|
Set up Catalyst Cloud and say whether setup is working. Walks a person from nothing to their first ticket running, one step at a time: the coding account, the project, the integrations and connected accounts, each repository's settings file, then one real ticket moving. Also logs this machine in, reads the readiness verdict with who can fix each failure, and checks the optional local replica. Use when someone says "set me up", "onboard me", "I just signed up", "get me started", "what do I do first", "log me in", "which account is this machine on", "am I set up", "what is missing", "why does nothing happen" or "is the replica running", when a login expired, or when a skill script exits 2 saying this machine is not connected. Does every step a key can do through the catalyst CLI, hands over the exact page for the steps only a browser can do, and never claims a step it did not watch succeed.
|
|
5
5
|
allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
|
|
6
6
|
---
|
|
7
|
-
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.
|
|
7
|
+
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.6 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# Onboard me
|
|
10
10
|
|
|
@@ -55,6 +55,7 @@ Scripts are run, never read; each prints `--help`.
|
|
|
55
55
|
| logging in, a refused or expired login, which account this is, the Linear identity | `references/connecting-this-machine.md` |
|
|
56
56
|
| anything reports not ready, a check id, or who fixes something | `references/reading-ready.md` |
|
|
57
57
|
| the coding account or the `host` part, or before saying work can run | `references/what-a-phase-needs.md`; a credential to replace, `references/replacing-a-credential.md` |
|
|
58
|
+
| preserving an existing paused Darwin runner during owner-managed replacement | `references/preserving-runner-replacement.md` |
|
|
58
59
|
| which steps a command does and which need a browser, or confirming a page that said it worked | `references/what-the-browser-owns.md` |
|
|
59
60
|
| the repository's `.catalyst/catalyst.toml` and its approval; its AGENTS.md block and agent layout | `references/declaring-a-repository.md`; `references/repository-agent-setup.md` |
|
|
60
61
|
| the replica or event cache | `references/local-sync.md` |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Preserving a paused Darwin runner during replacement
|
|
2
|
+
|
|
3
|
+
An installation owner can replace a known paused supervisor through the existing `catalyst onboard --runner` path while retaining the installation directory and named volumes. This is an owner-managed recovery for the standard Darwin state layout. The CLI does not automatically upgrade an existing container whose image differs from its desired image.
|
|
4
|
+
|
|
5
|
+
Before changing the container, the installation owner must independently receive its full container ID, selected local daemon, paused state, Compose project/service labels, working directory and exact configuration-file list. Receive the owned Compose and private `.env` files without printing their contents. Match the retained host identity and team to the existing enrollment. Verify the named `catalyst-host_host-credential` and `catalyst-host_supervisor-state` volumes and their actual mounts. Keep the original files privately for operator recovery.
|
|
6
|
+
|
|
7
|
+
The working directory must be the actual operator's `~/.local/state/catalyst/runner`. Keep the same OS operator, home, Docker selector, directory, Compose project, host name, team and volumes. Any saved machine-path mapping or state-directory environment selector must still resolve to that same standard directory. Do not relocate state or replace the login. Custom state layouts and an existing native producer configured for another supervisor pin require a separate repair; the producer refuses a changed pin instead of rekeying or adopting it.
|
|
8
|
+
|
|
9
|
+
The new supervisor, watchdog and runner images must first be qualified and cached on that same daemon. Supply all three exact digest pins explicitly, including the runner pin: ordinary setup preserves a saved runner image. A runner must carry the Darwin thoughts custody capability required by the native installer. Qualification and cached bytes are prerequisites, not consequences of removing the old container.
|
|
10
|
+
|
|
11
|
+
Once those prerequisites are received, the installation owner removes only the independently verified paused supervisor by its full container ID. Keep the directory, `.env`, Compose files, native thoughts and locks, credential volume and supervisor-state volume. Do not run Compose down, remove volumes, change ownership or broaden permissions.
|
|
12
|
+
|
|
13
|
+
Resume the existing onboarding context with the same team and repository inputs and an explicit `--runner` in this invocation:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
CATALYST_SUPERVISOR_IMAGE="$QUALIFIED_SUPERVISOR_IMAGE" \
|
|
17
|
+
CATALYST_WATCHDOG_IMAGE="$QUALIFIED_WATCHDOG_IMAGE" \
|
|
18
|
+
CATALYST_RUNNER_IMAGE="$QUALIFIED_RUNNER_IMAGE" \
|
|
19
|
+
catalyst onboard --runner --only runner
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The CLI's actual installation port now observes no supervisor container. It selects the same standard state directory and keeps the saved host name, join token and tuning. Cached target receiving and a successful fresh native custody exchange precede the credential and admission steps and supervisor activation. The retained enrolled credential identifies the existing host; this recovery does not require a new enrollment or org key. Native thoughts and lock ownership and modes remain unchanged.
|
|
23
|
+
|
|
24
|
+
A cache miss or native custody refusal leaves the retained credentials and enrollment intact and does not activate the supervisor. Setup may already have refreshed Compose and `.env` with the selected target configuration. Keep the operator's original-file receipt until the replacement is accepted. A refusal must be repaired by its owner; do not substitute an old image, create a new producer key or erase the retained state.
|
|
25
|
+
|
|
26
|
+
Accept the recovery only after the installation owner receives the exact new supervisor image, original credential and volume identities, loaded native producer, fresh custody exchange, preserved native modes, and a real successful work attempt with publication. Source tests alone do not prove a native installation.
|
|
@@ -4,7 +4,7 @@ description: >-
|
|
|
4
4
|
Own one Catalyst Cloud project end to end until it closes. Use when the person says "run this project for me", "own this until it ships", "keep this moving", or hands you a project id or a set of tickets to drive. Subscribes to the account's event stream for the scope through the catalyst CLI, reacts to each change in the same turn, makes tickets ready and moves them to dispatch, parks what should stop, chases stalls, escalates inward, and keeps one status summary current. Writes to Linear as the app actor; never polls.
|
|
5
5
|
allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
|
|
6
6
|
---
|
|
7
|
-
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.
|
|
7
|
+
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.6 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# Run this project
|
|
10
10
|
|
package/skills/unstick/SKILL.md
CHANGED
|
@@ -4,7 +4,7 @@ description: >-
|
|
|
4
4
|
Get a stuck Catalyst Cloud ticket moving again. Use when the person asks "why is this parked and can you release it?", "unpark this", "get things flowing again", "the outage is over, retry what failed", or hands you a ticket that is not moving. Reads why nothing runs and what holds the ticket through the catalyst CLI, decides whether the recorded cause is fixed, previews the release, releases every governor holding the ticket the right way (or one failure class across a team), and raises an ask only for what a person has to do. Never releases a cause it cannot show changed without saying so.
|
|
5
5
|
allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
|
|
6
6
|
---
|
|
7
|
-
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.
|
|
7
|
+
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.6 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# Unstick
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: >-
|
|
|
4
4
|
The human's decision inbox on Catalyst Cloud, and the one way an agent raises a decision on their behalf. Use when the person asks "what needs me?", "what am I blocking?", or when active work is gated on a choice only they can make. Lists open asks ranked by how much open work each one holds, files an ask through the cloud's ask route with the account's own template, and records the answer so the held work releases. Never answers as the human, never duplicates an open ask.
|
|
5
5
|
allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
|
|
6
6
|
---
|
|
7
|
-
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.
|
|
7
|
+
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.6 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# What needs me
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: >-
|
|
|
4
4
|
What environment variable names does this repository need, and where does each one come from? Scans the repository offline (no login, no network) and lists the names in three groups (build/test, deploy-only, bindings), each with where it was found, what uses it, and where a local value would come from. Never reads a value or prints one. Also checks the environment variable table in `.catalyst/catalyst.toml` offline. Use when someone asks "what does catalyst.env.json mean", "what env vars does this repo need", "why does the container need this", or before reviewing or writing the declaration.
|
|
5
5
|
allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
|
|
6
6
|
---
|
|
7
|
-
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.
|
|
7
|
+
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.6 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# What this repository needs
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: >-
|
|
|
4
4
|
Use for "what's happening?", "what machines do we have?", "how much capacity do we have?", "where are we?", "why is that stuck?", "what closed?", "what's next?", "how does this work?", "why did it do that?", "how does it prioritise?" and "what does this setting do, where is it set?" in Catalyst Cloud, or asks for something to be done rather than known. Reads the contract via catalyst CLI. Read-only: route work/decisions, never answer as the human.
|
|
5
5
|
allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
|
|
6
6
|
---
|
|
7
|
-
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.
|
|
7
|
+
<!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.6 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# What's happening
|
|
10
10
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Installed Darwin custody channels. Include with compose.yaml only after native producer setup.
|
|
2
|
+
# The signing key and producer configuration remain on the native host, outside every mount.
|
|
3
|
+
services:
|
|
4
|
+
supervisor:
|
|
5
|
+
environment:
|
|
6
|
+
CATALYST_THOUGHTS_CUSTODY_AUTHORITY: ${CATALYST_THOUGHTS_CUSTODY_AUTHORITY:?set installed Darwin authority}
|
|
7
|
+
volumes:
|
|
8
|
+
- type: bind
|
|
9
|
+
source: ${CATALYST_THOUGHTS_CUSTODY_REQUESTS_DIR:?set installed Darwin requests root}
|
|
10
|
+
target: ${CATALYST_THOUGHTS_CUSTODY_REQUESTS_DIR:?set installed Darwin requests root}
|
|
11
|
+
bind:
|
|
12
|
+
create_host_path: false
|
|
13
|
+
- type: bind
|
|
14
|
+
source: ${CATALYST_THOUGHTS_CUSTODY_RESPONSES_DIR:?set installed Darwin responses root}
|
|
15
|
+
target: ${CATALYST_THOUGHTS_CUSTODY_RESPONSES_DIR:?set installed Darwin responses root}
|
|
16
|
+
read_only: true
|
|
17
|
+
bind:
|
|
18
|
+
create_host_path: false
|
|
@@ -70,9 +70,9 @@ services:
|
|
|
70
70
|
# engine resolves a bind source on the HOST. A path that exists only inside this container
|
|
71
71
|
# mounts an empty directory into the phase.
|
|
72
72
|
- ${CATALYST_SLOTS_DIR:-/srv/catalyst/slots}:${CATALYST_SLOTS_DIR:-/srv/catalyst/slots}
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
# runs under thoughts.lock. The supervisor keeps one subdirectory per tenant under each root,
|
|
73
|
+
# Shared tenant thoughts and pool locks. Native Linux sessions use a read-write checkout.
|
|
74
|
+
# Darwin custody sessions expose a read-only model alias and a protected root publisher alias.
|
|
75
|
+
# Every thoughts sync runs under thoughts.lock. The supervisor keeps one subdirectory per tenant under each root,
|
|
76
76
|
# so two projects on one engine never share a checkout or a lock. Same path on both sides for
|
|
77
77
|
# the same reason as the slots: the supervisor binds these into session containers, and the
|
|
78
78
|
# engine resolves bind sources on the host. Never mounted into a setup container.
|
|
@@ -100,6 +100,7 @@ services:
|
|
|
100
100
|
CATALYST_HOST_FREE_FLOOR_GIB: ${CATALYST_HOST_FREE_FLOOR_GIB:-25}
|
|
101
101
|
CATALYST_HOST_DISK_SAMPLE_FILE: ${CATALYST_HOST_DISK_SAMPLE_FILE:-}
|
|
102
102
|
CATALYST_THOUGHTS_DIR: ${CATALYST_THOUGHTS_DIR:-/srv/catalyst/thoughts}
|
|
103
|
+
CATALYST_THOUGHTS_CUSTODY_AUTHORITY: ${CATALYST_THOUGHTS_CUSTODY_AUTHORITY:-}
|
|
103
104
|
CATALYST_POOL_LOCK_DIR: ${CATALYST_POOL_LOCK_DIR:-/srv/catalyst/locks}
|
|
104
105
|
CATALYST_ORG_KEY_FILE: ${CATALYST_ORG_KEY_FILE:-/var/lib/catalyst/host-credential/org-key}
|
|
105
106
|
# `attempt`: sessions use their grant's own credential and the host holds no org key (CTC-4921).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"generator": "bun",
|
|
4
|
+
"inputs": {
|
|
5
|
+
"packages/host-isolation/src/darwin-thoughts-producer.ts": "038fb63d8121fb1665ec31869f45604aedd96dd7d9b15a415d578fea9a0ad507",
|
|
6
|
+
"packages/protocol/src/darwin-thoughts-custody.ts": "3515efc22b0a3cfb512ff1acaf649c6eafb978b894c724fabb01c325aea51075",
|
|
7
|
+
"packages/host-isolation/src/darwin-thoughts-custody.ts": "5d65d59d71205e2ce5551e99b4ad33364d53cbdd29993cf2f164fc214b83baf8",
|
|
8
|
+
"deploy/self-host/darwin-thoughts-custody/producer-entry.ts": "27c8ff591c8dc4d1a4c65dd154157df5191ead1fb0af673bfd7099d5226d37bc",
|
|
9
|
+
"deploy/self-host/darwin-thoughts-custody/verifier-entry.ts": "80bc1e72943e43bc33d76ba205bd79751f58ca34d622e35f7e50e3b661f65464",
|
|
10
|
+
"deploy/self-host/darwin-thoughts-custody/generate.ts": "bfe1bef175fa8243be0558e1ddee6ddbcfbd622922e3a5df850e8621f18e7b26",
|
|
11
|
+
"deploy/self-host/darwin-thoughts-custody/watchdog.mjs": "6b5c7204aacd296c85a216d4f1b3adbe2084024fe37200ec1d24dfc2dec2e12d",
|
|
12
|
+
"deploy/self-host/darwin-thoughts-custody/watchdog-deadline.mjs": "a642e6d8968f56f635056d3b258e5c4ad186c638a273c26b4528e85b7d2a6346",
|
|
13
|
+
"deploy/self-host/darwin-thoughts-custody/service.plist.in": "66e9a2c175d2500b1f7130e7c04a5ed07f22bc7425661777f514fa3f2a816496"
|
|
14
|
+
},
|
|
15
|
+
"artifactSha256": "0e0f1bbdac23813e8ee57b6eb4ae3dfd24c3f1c51ebe0c3d119a1448734ea05e",
|
|
16
|
+
"verifierSha256": "2d8c9b5c35e38a25a45098b7606a216109557fb0466113098f503e9d6c8f6b4c",
|
|
17
|
+
"verifierDeclarationsSha256": "624428ced2eb18b045b761b49e20b7f52c0fc6c3132689571103ece7b4a1083f"
|
|
18
|
+
}
|