@catalyst-cloud/cli 0.16.3 → 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 +8 -0
- package/dist/onboard-next.js +1 -0
- package/dist/onboard-runner-custody.js +680 -0
- package/dist/onboard-runner.js +181 -45
- 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 +21 -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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function factory(ports) {
|
|
2
|
+
return function arm({ workerPid, deadlineMs, onDeadline, onUnreaped }) {
|
|
3
|
+
if (!Number.isSafeInteger(workerPid) || workerPid <= 0 || !Number.isSafeInteger(deadlineMs))
|
|
4
|
+
throw Error("watchdog_arguments");
|
|
5
|
+
let expired = false;
|
|
6
|
+
let fallback;
|
|
7
|
+
const expire = () => {
|
|
8
|
+
if (expired) return;
|
|
9
|
+
expired = true;
|
|
10
|
+
onDeadline();
|
|
11
|
+
try {
|
|
12
|
+
ports.kill(-workerPid, "SIGKILL");
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (error.code !== "ESRCH") {
|
|
15
|
+
onUnreaped();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// SIGKILL being queued does not prove exit. Never wait on close forever.
|
|
20
|
+
fallback = ports.setTimeout(onUnreaped, 250);
|
|
21
|
+
};
|
|
22
|
+
const timer = ports.setTimeout(expire, Math.max(1, deadlineMs - ports.now()));
|
|
23
|
+
return {
|
|
24
|
+
expire,
|
|
25
|
+
cancel: () => {
|
|
26
|
+
ports.clearTimeout(timer);
|
|
27
|
+
if (fallback !== undefined) ports.clearTimeout(fallback);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export const armProducerDeadline = factory({
|
|
33
|
+
now: Date.now,
|
|
34
|
+
setTimeout,
|
|
35
|
+
clearTimeout,
|
|
36
|
+
kill: process.kill.bind(process),
|
|
37
|
+
});
|
|
38
|
+
/** Internal test seam, never selected by service arguments. */
|
|
39
|
+
export const createProducerDeadlineTestHarness = factory;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { isAbsolute, normalize, dirname } from "node:path";
|
|
4
|
+
import { armProducerDeadline } from "./watchdog-deadline.mjs";
|
|
5
|
+
|
|
6
|
+
// Separate process: blocked worker IO cannot prevent the absolute process-group kill.
|
|
7
|
+
function fail() {
|
|
8
|
+
process.stderr.write("darwin_thoughts_producer:service_refused\n");
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
if (
|
|
12
|
+
process.platform !== "darwin" ||
|
|
13
|
+
!process.getuid ||
|
|
14
|
+
!process.geteuid ||
|
|
15
|
+
process.getuid() <= 0 ||
|
|
16
|
+
process.getuid() !== process.geteuid() ||
|
|
17
|
+
process.argv.length !== 4
|
|
18
|
+
)
|
|
19
|
+
fail();
|
|
20
|
+
const [artifact, config] = process.argv.slice(2);
|
|
21
|
+
for (const path of [artifact, config]) {
|
|
22
|
+
if (
|
|
23
|
+
!isAbsolute(path) ||
|
|
24
|
+
normalize(path) !== path ||
|
|
25
|
+
path.endsWith("/") ||
|
|
26
|
+
path.includes("\0") ||
|
|
27
|
+
fs.realpathSync(path) !== path
|
|
28
|
+
)
|
|
29
|
+
fail();
|
|
30
|
+
const stat = fs.lstatSync(path);
|
|
31
|
+
const parent = fs.lstatSync(dirname(path));
|
|
32
|
+
if (
|
|
33
|
+
!stat.isFile() ||
|
|
34
|
+
stat.isSymbolicLink() ||
|
|
35
|
+
stat.uid !== process.getuid() ||
|
|
36
|
+
stat.nlink !== 1 ||
|
|
37
|
+
(stat.mode & 0o7777) !== 0o600 ||
|
|
38
|
+
!parent.isDirectory() ||
|
|
39
|
+
parent.isSymbolicLink() ||
|
|
40
|
+
parent.uid !== process.getuid() ||
|
|
41
|
+
(parent.mode & 0o7777) !== 0o700
|
|
42
|
+
)
|
|
43
|
+
fail();
|
|
44
|
+
}
|
|
45
|
+
const deadlineMs = Date.now() + 20_000;
|
|
46
|
+
const worker = spawn(process.execPath, [artifact, config, String(deadlineMs)], {
|
|
47
|
+
cwd: "/",
|
|
48
|
+
env: { PATH: "/usr/bin:/bin:/usr/sbin:/sbin" },
|
|
49
|
+
detached: true,
|
|
50
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
51
|
+
});
|
|
52
|
+
let bytes = 0;
|
|
53
|
+
let timedOut = false;
|
|
54
|
+
function kill() {
|
|
55
|
+
guard.expire();
|
|
56
|
+
}
|
|
57
|
+
const guard = armProducerDeadline({
|
|
58
|
+
workerPid: worker.pid,
|
|
59
|
+
deadlineMs: deadlineMs + 2000,
|
|
60
|
+
onDeadline: () => {
|
|
61
|
+
timedOut = true;
|
|
62
|
+
},
|
|
63
|
+
onUnreaped: fail,
|
|
64
|
+
});
|
|
65
|
+
for (const stream of [worker.stdout, worker.stderr]) {
|
|
66
|
+
stream.on("data", (chunk) => {
|
|
67
|
+
bytes += chunk.length;
|
|
68
|
+
if (bytes > 4096) kill();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
worker.on("error", () => {
|
|
72
|
+
guard.cancel();
|
|
73
|
+
fail();
|
|
74
|
+
});
|
|
75
|
+
worker.on("close", (code) => {
|
|
76
|
+
guard.cancel();
|
|
77
|
+
if (timedOut || code !== 0) fail();
|
|
78
|
+
process.exit(0);
|
|
79
|
+
});
|
|
80
|
+
process.on("SIGTERM", () => {
|
|
81
|
+
kill();
|
|
82
|
+
});
|
|
83
|
+
process.on("SIGINT", () => {
|
|
84
|
+
kill();
|
|
85
|
+
});
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"repository": "coalesce-labs/catalyst-cloud",
|
|
3
|
-
"commit": "
|
|
3
|
+
"commit": "3d657787e8d4a0295068d0ea67ea3e7a1f4707a2",
|
|
4
4
|
"sha256": {
|
|
5
|
-
"deploy/self-host/compose.yaml": "
|
|
5
|
+
"deploy/self-host/compose.yaml": "0ffb7671c7ea49d8490d6e97093ada0afcb31da3b00092a8768150b090cca0bc",
|
|
6
|
+
"deploy/self-host/compose.darwin-thoughts.yaml": "6269d66d6f487175ab8560d0648e65c8a0eccb86f69a8dc24daf41d8ae1dcf02",
|
|
7
|
+
"deploy/self-host/darwin-thoughts-custody/producer.mjs": "0e0f1bbdac23813e8ee57b6eb4ae3dfd24c3f1c51ebe0c3d119a1448734ea05e",
|
|
8
|
+
"deploy/self-host/darwin-thoughts-custody/verifier.mjs": "2d8c9b5c35e38a25a45098b7606a216109557fb0466113098f503e9d6c8f6b4c",
|
|
9
|
+
"deploy/self-host/darwin-thoughts-custody/verifier.d.mts": "624428ced2eb18b045b761b49e20b7f52c0fc6c3132689571103ece7b4a1083f",
|
|
10
|
+
"deploy/self-host/darwin-thoughts-custody/watchdog.mjs": "6b5c7204aacd296c85a216d4f1b3adbe2084024fe37200ec1d24dfc2dec2e12d",
|
|
11
|
+
"deploy/self-host/darwin-thoughts-custody/watchdog-deadline.mjs": "a642e6d8968f56f635056d3b258e5c4ad186c638a273c26b4528e85b7d2a6346",
|
|
12
|
+
"deploy/self-host/darwin-thoughts-custody/service.plist.in": "66e9a2c175d2500b1f7130e7c04a5ed07f22bc7425661777f514fa3f2a816496",
|
|
13
|
+
"deploy/self-host/darwin-thoughts-custody/manifest.json": "ee575635e8135bc2d9e735bb69795d011371e234af1139e30dfee6d4785f4fa4",
|
|
6
14
|
"deploy/self-host/linux-session-egress/session-egress.py": "a20cedfa1e883127ec461e4b7f9588d379fe1633b8244ecd703c81f589d3f142",
|
|
7
15
|
"deploy/self-host/linux-session-egress/catalyst-session-egress.service": "703c150ab23ec87aea47cfc394f63e061b66c4b8c1454a88a9be879c161ce2a5",
|
|
8
16
|
"deploy/self-host/linux-session-egress/catalyst-session-egress-attest.service": "94fa75ea0616f6a1172fc20ca637a5727c36456357e4a977d5bdd65f2fad2e8d",
|