@catalyst-cloud/cli 0.16.27 → 0.16.29

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.
@@ -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.27 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.29 — 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.27 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.29 — written in this repository for customer accounts -->
8
8
 
9
9
  # Catalyst Linear
10
10
 
@@ -14,6 +14,8 @@ Cloud reads are the default on every machine. They need no local writer and no l
14
14
  | Find a ticket by words | `node scripts/search.mjs <terms>` |
15
15
  | What happened to it, event by event? | `catalyst events query --ticket <KEY-123>` |
16
16
  | Wait until its phase finishes | `catalyst events wait-for --ticket <KEY-123> --type relay.phase.completed --after <head> --timeout 300` |
17
+ | Wait until its branch or PR changes | `catalyst events wait-for --ref <owner/name:branch> --type pr.* --after <head> --timeout 14400` |
18
+ | What messages were sent to it? | `catalyst messages read --ticket <KEY-123>` |
17
19
 
18
20
  ## Reading the answer
19
21
 
@@ -28,7 +30,9 @@ A smaller read is coming: the cloud will answer a ticket or its execution histor
28
30
  `catalyst events` reads the cloud by default and needs no local file.
29
31
 
30
32
  - `catalyst events query --ticket <KEY-123>` prints the ticket's events, newest first. Add `--type`, `--limit` (up to 200), `--order asc` and `--before` or `--after` to page. An empty page says which sequences the cloud has indexed, so "no match" is not "never happened".
31
- - To wait for something to happen, first run `catalyst events status --json` and keep its `head`. Then run `catalyst events wait-for --ticket <KEY-123> --type relay.phase.completed --after <head> --timeout 300`. Exit 0 prints the event, exit 1 is a timeout, and exit 4 means the cloud was unreachable.
33
+ - To wait for something to happen, first run `catalyst events status --json` and keep its `head`. Then run `catalyst events wait-for --ticket <KEY-123> --type relay.phase.completed --after <head> --timeout 300`. Exit 0 prints the event, exit 1 is a timeout, exit 2 is a refusal with its reason, and exit 4 means the cloud was unreachable.
34
+ - To wait on a branch, a pull request, a repository, a phase session or messages addressed to you, use `--ref <owner/name:branch>`, `--pr <owner/name#n>`, `--repo <owner/name>`, `--session <KEY-123/phase#n>` or `--to me`, with `--type pr.*` for a family of types. Such a wait prints nothing until a match, so `--timeout 14400` costs nothing while it waits. On a timeout, stderr names the `--after` to resume from.
35
+ - `catalyst messages read --ticket <KEY-123> [--since <sequence>]` prints the messages sent to the ticket, with sender and time.
32
36
  - `catalyst events tail --ticket <KEY-123>` stays in the foreground and prints one JSON line per new event.
33
37
 
34
38
  The ticket filter reads the event's ticket entity, `payload.ticket`, and the lease that caused it. `--from-cache` reads this machine's local event cache instead. It exists only where local sync is on, and it pays off when several agents on one machine share it.
@@ -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.27 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.29 — written in this repository for customer accounts -->
8
8
 
9
9
  # Onboard me
10
10
 
@@ -64,6 +64,7 @@ Each failing line prints its own fix.
64
64
  | `cliRelease` | the CLI is not behind the newest release; a note |
65
65
  | `skillsRelease` | the skill files are not behind the newest bundle; "could not run" means the registry was unreachable |
66
66
  | `sdk` | the SDK loads, so the replica and the watch are available; reads work through the API meanwhile |
67
+ | `runner:disk` | when this machine runs Catalyst's work, the disk Docker uses has a fresh measurement with at least 25 GiB free (`CATALYST_HOST_FREE_FLOOR_GIB` changes the amount), so it can take work. A failing line says how much is free or why there is no measurement, with its fix, usually `catalyst setup --runner`; on a Mac that command also starts the LaunchAgent that measures the disk. A note means `ready` could not verify the installation to read it. Absent when this machine does not run Catalyst's work |
67
68
  | `replica` | the optional replica is fresh; a note (`references/local-sync.md`) |
68
69
 
69
70
  ## Setting up one team at a time
@@ -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.27 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.29 — written in this repository for customer accounts -->
8
8
 
9
9
  # Run this project
10
10
 
@@ -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.27 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.29 — 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.27 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.29 — 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.27 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.29 — 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.27 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.29 — written in this repository for customer accounts -->
8
8
 
9
9
  # What's happening
10
10
 
@@ -13,9 +13,11 @@ Cloud reads are the default everywhere and need no local writer or database. Eac
13
13
  | what changed since a point | `catalyst query changes --since head` |
14
14
  | a ticket's events, newest first | `catalyst events query --ticket KEY-123` |
15
15
  | wait for a phase to finish | `catalyst events wait-for --ticket KEY-123 --type relay.phase.completed --after <head> --timeout 300` |
16
+ | wait on a branch or PR | `catalyst events wait-for --ref owner/name:branch --type pr.* --after <head> --timeout 14400` |
17
+ | read a ticket's messages | `catalyst messages read --ticket KEY-123` |
16
18
 
17
19
  A status-only read of a ticket and of its execution history is coming. No CLI flag selects it yet; read the full record.
18
20
 
19
- Events: `catalyst events` reads the cloud by default. `events status --json` gives the `head` to wait after. Exit 4 from `wait-for` is an outage, not a timeout. `--from-cache` reads the local event cache, which exists only where local sync is on.
21
+ Events: `catalyst events` reads the cloud by default. `events status --json` gives the `head` to wait after. Exit 4 from `wait-for` is an outage, not a timeout; exit 2 is a refusal, with the reason. A wait on `--repo`, `--ref`, `--pr`, `--session` or `--to me` prints nothing until a match, so a long timeout costs nothing. `--from-cache` reads the local event cache, which exists only where local sync is on.
20
22
 
21
23
  Local SQL: `references/local-replica.md`, only when `configured: true`.
@@ -4,7 +4,7 @@
4
4
  "inputs": {
5
5
  "packages/host-isolation/src/darwin-thoughts-producer.ts": "038fb63d8121fb1665ec31869f45604aedd96dd7d9b15a415d578fea9a0ad507",
6
6
  "packages/protocol/src/darwin-thoughts-custody.ts": "3515efc22b0a3cfb512ff1acaf649c6eafb978b894c724fabb01c325aea51075",
7
- "packages/host-isolation/src/darwin-thoughts-custody.ts": "8165e058f6bed990fe35ce30685db0f4634746c3b22d51f81a9c77cd9745735f",
7
+ "packages/host-isolation/src/darwin-thoughts-custody.ts": "305e5ddfa3786f6db6b55b9e62b07e28370fb59bf0cd3660011321225dfcba7e",
8
8
  "deploy/self-host/darwin-thoughts-custody/producer-entry.ts": "27c8ff591c8dc4d1a4c65dd154157df5191ead1fb0af673bfd7099d5226d37bc",
9
9
  "deploy/self-host/darwin-thoughts-custody/verifier-entry.ts": "80bc1e72943e43bc33d76ba205bd79751f58ca34d622e35f7e50e3b661f65464",
10
10
  "deploy/self-host/darwin-thoughts-custody/generate.ts": "bfe1bef175fa8243be0558e1ddee6ddbcfbd622922e3a5df850e8621f18e7b26",
@@ -13,6 +13,6 @@
13
13
  "deploy/self-host/darwin-thoughts-custody/service.plist.in": "66e9a2c175d2500b1f7130e7c04a5ed07f22bc7425661777f514fa3f2a816496"
14
14
  },
15
15
  "artifactSha256": "0e0f1bbdac23813e8ee57b6eb4ae3dfd24c3f1c51ebe0c3d119a1448734ea05e",
16
- "verifierSha256": "322b838917b9f7e1d9b7d9705a75143697ca093553bf0dcca7e7f5d4a88bbdc0",
16
+ "verifierSha256": "0229509c107ec7a509a7bdbb7fa19d21f06a3f9075e53f4890f6d316d518518b",
17
17
  "verifierDeclarationsSha256": "624428ced2eb18b045b761b49e20b7f52c0fc6c3132689571103ece7b4a1083f"
18
18
  }
@@ -457,7 +457,57 @@ function cleanPath(path) {
457
457
  throw failure("directory");
458
458
  }
459
459
  }
460
- function directory(path, privateChannel = false) {
460
+ var DARWIN_THOUGHTS_UNSAFE_DIRECTORY_SUBCHECKS = [
461
+ "not_directory",
462
+ "authority_changed",
463
+ "special_bits",
464
+ "group_other_write",
465
+ "owner_rwx",
466
+ "private_bits",
467
+ "private_owner",
468
+ "bootstrap_other_bits"
469
+ ];
470
+ var BOOTSTRAP_LEVELS = [
471
+ ["thoughts_root", "thoughts_tenant", "thoughts_owner", "thoughts_repository"],
472
+ ["locks_root", "locks_tenant"],
473
+ ["requests_root", "requests_tenant", "requests_owner", "requests_repository"],
474
+ ["responses_root", "responses_tenant", "responses_owner", "responses_repository"]
475
+ ];
476
+ var DARWIN_THOUGHTS_DIRECTORY_ROLES = [
477
+ "requests_channel",
478
+ "responses_channel",
479
+ "checkout",
480
+ "lock",
481
+ "git",
482
+ "thoughts_root_wait",
483
+ "locks_root_wait",
484
+ ...BOOTSTRAP_LEVELS.flat()
485
+ ];
486
+ function bootstrapRole(index, level) {
487
+ const role = BOOTSTRAP_LEVELS[index]?.[level];
488
+ if (!role)
489
+ throw failure("bootstrap_path");
490
+ return role;
491
+ }
492
+ function unsafeDirectory(role, subcheck) {
493
+ if (!DARWIN_THOUGHTS_DIRECTORY_ROLES.includes(role) || !DARWIN_THOUGHTS_UNSAFE_DIRECTORY_SUBCHECKS.includes(subcheck))
494
+ return failure("unsafe_directory");
495
+ return failure(`unsafe_directory:${role}:${subcheck}`);
496
+ }
497
+ function darwinThoughtsUnsafeDirectorySubcheck(stat, privateChannel) {
498
+ if ((stat.mode & 0o7000n) !== 0n)
499
+ return "special_bits";
500
+ if ((stat.mode & 0o022n) !== 0n)
501
+ return "group_other_write";
502
+ if ((stat.mode & 0o700n) !== 0o700n)
503
+ return "owner_rwx";
504
+ if (privateChannel && (stat.mode & 0o077n) !== 0n)
505
+ return "private_bits";
506
+ if (privateChannel && stat.uid !== 0n && stat.uid !== 10001n)
507
+ return "private_owner";
508
+ return;
509
+ }
510
+ function directory(path, role, privateChannel = false) {
461
511
  return guarded(() => {
462
512
  cleanPath(path);
463
513
  const named = fs.lstatSync(path, { bigint: true });
@@ -465,17 +515,21 @@ function directory(path, privateChannel = false) {
465
515
  try {
466
516
  const opened = fs.fstatSync(fd, { bigint: true });
467
517
  const after = fs.lstatSync(path, { bigint: true });
468
- if (!opened.isDirectory() || !sameDirectoryAuthority(named, opened) || !sameDirectoryAuthority(opened, after) || (opened.mode & 0o7022n) !== 0n || (opened.mode & 0o700n) !== 0o700n || privateChannel && ((opened.mode & 0o077n) !== 0n || opened.uid !== 0n && opened.uid !== 10001n)) {
469
- throw failure("unsafe_directory");
470
- }
518
+ if (!opened.isDirectory())
519
+ throw unsafeDirectory(role, "not_directory");
520
+ if (!sameDirectoryAuthority(named, opened) || !sameDirectoryAuthority(opened, after))
521
+ throw unsafeDirectory(role, "authority_changed");
522
+ const subcheck = darwinThoughtsUnsafeDirectorySubcheck(opened, privateChannel);
523
+ if (subcheck)
524
+ throw unsafeDirectory(role, subcheck);
471
525
  return opened;
472
526
  } finally {
473
527
  fs.closeSync(fd);
474
528
  }
475
529
  });
476
530
  }
477
- function currentIdentity(path, logicalPath) {
478
- const stat = directory(path);
531
+ function currentIdentity(path, logicalPath, role) {
532
+ const stat = directory(path, role);
479
533
  return {
480
534
  path: logicalPath,
481
535
  device: stat.dev.toString(),
@@ -534,7 +588,7 @@ function isInitialGuestOwnerProjection(before, current, stagedFile) {
534
588
  return before.dev === current.dev && before.ino === current.ino && before.mode === current.mode && before.uid === 0n && before.gid === 0n && current.uid === 10001n && current.gid === 10001n && process.getuid?.() === 10001 && process.geteuid?.() === 10001 && process.getgid?.() === 10001 && stagedFile.uid === 10001n && stagedFile.gid === 10001n;
535
589
  }
536
590
  function receiveStagingChannel(path, before, stagedFile, observedAncestors) {
537
- const current = directory(path, true);
591
+ const current = directory(path, "requests_channel", true);
538
592
  if (sameDirectoryAuthority(before, current))
539
593
  return current;
540
594
  if (!isInitialGuestOwnerProjection(before, current, stagedFile))
@@ -549,16 +603,20 @@ function receiveStagingChannel(path, before, stagedFile, observedAncestors) {
549
603
  function receiveWaitingResponseChannel(path, before, stagedFile, observedAncestors, responsePath, bootstrapRoots, authenticatePresentResponse, bootstrapProjection) {
550
604
  const maxPasses = bootstrapRoots ? 4 : 2;
551
605
  for (let pass = 0;pass < maxPasses; pass += 1) {
552
- const current = directory(path, true);
553
- const projections = [{ path, before, current, privateChannel: true }];
554
- for (const root of bootstrapRoots ? [bootstrapRoots.thoughtsRoot, bootstrapRoots.locksRoot] : []) {
606
+ const current = directory(path, "responses_channel", true);
607
+ const projections = [{ path, role: "responses_channel", before, current, privateChannel: true }];
608
+ for (const [root, role] of bootstrapRoots ? [
609
+ [bootstrapRoots.thoughtsRoot, "thoughts_root_wait"],
610
+ [bootstrapRoots.locksRoot, "locks_root_wait"]
611
+ ] : []) {
555
612
  const captured = observedAncestors.find((ancestor) => ancestor.path === root);
556
613
  if (!captured)
557
614
  throw failure("ancestor_identity");
558
615
  projections.push({
559
616
  path: root,
617
+ role,
560
618
  before: captured.stat,
561
- current: directory(root),
619
+ current: directory(root, role),
562
620
  privateChannel: false
563
621
  });
564
622
  }
@@ -589,7 +647,7 @@ function receiveWaitingResponseChannel(path, before, stagedFile, observedAncesto
589
647
  checkAncestors(observedAncestors.filter((ancestor) => !projections.some((projection) => projection.path === ancestor.path)), bootstrapProjection);
590
648
  let resample = false;
591
649
  for (const projection of projections) {
592
- const next = directory(projection.path, projection.privateChannel);
650
+ const next = directory(projection.path, projection.role, projection.privateChannel);
593
651
  if (sameDirectoryAuthority(projection.current, next))
594
652
  continue;
595
653
  if (!receiveProjection(projection.current, next, stagedFile))
@@ -660,9 +718,10 @@ function checkBootstrapDirectories(paths, allowMissing) {
660
718
  throw failure("bootstrap_path");
661
719
  let current = root;
662
720
  const components = ["", ...leaf.slice(root.length + 1).split("/")];
663
- for (const component of components) {
721
+ for (const [level, component] of components.entries()) {
664
722
  if (component)
665
723
  current = join(current, component);
724
+ const role = bootstrapRole(index, level);
666
725
  try {
667
726
  fs.lstatSync(current);
668
727
  } catch (error) {
@@ -670,11 +729,11 @@ function checkBootstrapDirectories(paths, allowMissing) {
670
729
  break;
671
730
  throw failure("bootstrap_directory", error);
672
731
  }
673
- const stat = directory(current, index >= 2);
732
+ const stat = directory(current, role, index >= 2);
674
733
  if (stat.uid !== 0n && stat.uid !== 10001n)
675
734
  throw failure("bootstrap_owner");
676
735
  if ((stat.mode & 0o007n) !== 0n)
677
- throw failure("unsafe_directory");
736
+ throw unsafeDirectory(role, "bootstrap_other_bits");
678
737
  }
679
738
  }
680
739
  }
@@ -695,21 +754,21 @@ async function exchange(options, bootstrap) {
695
754
  issuedAtMs,
696
755
  expiresAtMs: options.deadlineMs
697
756
  }));
698
- let requests = directory(options.requestDir, true);
699
- let responses = directory(options.responseDir, true);
757
+ let requests = directory(options.requestDir, "requests_channel", true);
758
+ let responses = directory(options.responseDir, "responses_channel", true);
700
759
  const creationPaths = bootstrap ? bootstrapPaths(authority, options.tenant, options.repository) : [];
701
760
  if (bootstrap)
702
761
  checkBootstrapDirectories(creationPaths, true);
703
762
  else {
704
- currentIdentity(options.checkoutPath, targets.checkoutSource);
705
- currentIdentity(options.lockPath, targets.lockSource);
763
+ currentIdentity(options.checkoutPath, targets.checkoutSource, "checkout");
764
+ currentIdentity(options.lockPath, targets.lockSource, "lock");
706
765
  }
707
766
  const gitPath = join(options.checkoutPath, ".git");
708
767
  if (options.gitPath !== undefined && options.gitPath !== gitPath)
709
768
  throw failure("git_path");
710
769
  const initialGitPresent = options.gitPath !== undefined || gitPresent(gitPath);
711
770
  if (initialGitPresent)
712
- currentIdentity(gitPath, join(targets.checkoutSource, ".git"));
771
+ currentIdentity(gitPath, join(targets.checkoutSource, ".git"), "git");
713
772
  const aliasAncestors = guarded(() => ancestors([
714
773
  options.requestDir,
715
774
  options.responseDir,
@@ -745,11 +804,11 @@ async function exchange(options, bootstrap) {
745
804
  authority,
746
805
  request,
747
806
  nowMs: now(),
748
- engineCheckout: currentIdentity(options.checkoutPath, targets.checkoutSource),
749
- engineLock: currentIdentity(options.lockPath, targets.lockSource)
807
+ engineCheckout: currentIdentity(options.checkoutPath, targets.checkoutSource, "checkout"),
808
+ engineLock: currentIdentity(options.lockPath, targets.lockSource, "lock")
750
809
  };
751
810
  if (gitPresent(gitPath))
752
- expectation.engineGit = currentIdentity(gitPath, join(targets.checkoutSource, ".git"));
811
+ expectation.engineGit = currentIdentity(gitPath, join(targets.checkoutSource, ".git"), "git");
753
812
  verifyDarwinThoughtsCustodyResponse(bytes, expectation);
754
813
  };
755
814
  const projection = () => {
@@ -789,7 +848,7 @@ async function exchange(options, bootstrap) {
789
848
  }
790
849
  requests = receiveStagingChannel(options.requestDir, requests, owned, aliasAncestors);
791
850
  checkAncestors(aliasAncestors);
792
- if (!sameDirectoryAuthority(requests, directory(options.requestDir, true)))
851
+ if (!sameDirectoryAuthority(requests, directory(options.requestDir, "requests_channel", true)))
793
852
  throw failure("channel_identity");
794
853
  try {
795
854
  fs.lstatSync(finalPath);
@@ -814,11 +873,11 @@ async function exchange(options, bootstrap) {
814
873
  throw failure("ancestor_identity");
815
874
  requests = receivedRequest.stat;
816
875
  }
817
- for (const [path, expected] of [
818
- [options.requestDir, requests],
819
- [options.responseDir, responses]
876
+ for (const [path, role, expected] of [
877
+ [options.requestDir, "requests_channel", requests],
878
+ [options.responseDir, "responses_channel", responses]
820
879
  ]) {
821
- const current = directory(path, true);
880
+ const current = directory(path, role, true);
822
881
  if (!sameDirectoryAuthority(current, expected))
823
882
  throw failure("channel_identity");
824
883
  }
@@ -841,11 +900,11 @@ async function exchange(options, bootstrap) {
841
900
  authority,
842
901
  request,
843
902
  nowMs: 0,
844
- engineCheckout: currentIdentity(options.checkoutPath, targets.checkoutSource),
845
- engineLock: currentIdentity(options.lockPath, targets.lockSource)
903
+ engineCheckout: currentIdentity(options.checkoutPath, targets.checkoutSource, "checkout"),
904
+ engineLock: currentIdentity(options.lockPath, targets.lockSource, "lock")
846
905
  };
847
906
  if (receivedGitPresent)
848
- expectation.engineGit = currentIdentity(gitPath, join(targets.checkoutSource, ".git"));
907
+ expectation.engineGit = currentIdentity(gitPath, join(targets.checkoutSource, ".git"), "git");
849
908
  checkAncestors(aliasAncestors, projection());
850
909
  checkAncestors(receivedGitAncestors, projection());
851
910
  expectation.nowMs = now();
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env python3
2
+ """Publish native filesystem headroom for a supervisor inside a VM."""
3
+ import argparse
4
+ import json
5
+ import os
6
+ from pathlib import Path
7
+ import sys
8
+ import tempfile
9
+ import time
10
+
11
+
12
+ def publish(path: Path, output: Path) -> dict:
13
+ filesystem = os.statvfs(path)
14
+ sample = {
15
+ "schemaVersion": 1,
16
+ "path": str(path.resolve(strict=True)),
17
+ "observedAtMs": time.time_ns() // 1_000_000,
18
+ "availableBytes": filesystem.f_bavail * filesystem.f_frsize,
19
+ "totalBytes": filesystem.f_blocks * filesystem.f_frsize,
20
+ }
21
+ output.parent.mkdir(parents=True, exist_ok=True)
22
+ temporary = None
23
+ try:
24
+ with tempfile.NamedTemporaryFile(mode="w", dir=output.parent, delete=False) as stream:
25
+ temporary = Path(stream.name)
26
+ json.dump(sample, stream)
27
+ stream.write("\n")
28
+ stream.flush()
29
+ os.fsync(stream.fileno())
30
+ os.fchmod(stream.fileno(), 0o644)
31
+ os.replace(temporary, output)
32
+ temporary = None
33
+ finally:
34
+ if temporary is not None:
35
+ temporary.unlink(missing_ok=True)
36
+ return sample
37
+
38
+
39
+ if __name__ == "__main__":
40
+ parser = argparse.ArgumentParser(description=__doc__)
41
+ parser.add_argument("--path", required=True, type=Path, help="Native filesystem backing the VM disk")
42
+ parser.add_argument("--output", required=True, type=Path, help="Sample in a read-only supervisor bind")
43
+ parser.add_argument("--interval", type=float, help="Publish every INTERVAL seconds until stopped")
44
+ args = parser.parse_args()
45
+ if args.interval is None:
46
+ publish(args.path, args.output)
47
+ sys.exit(0)
48
+ if args.interval <= 0:
49
+ parser.error("--interval must be positive")
50
+ # launchd keeps this loop alive instead of firing a timer: an agent bootstrapped over SSH can
51
+ # leave every StartInterval launch pended (CTC-5929), and the supervisor then refuses all work.
52
+ while True:
53
+ try:
54
+ publish(args.path, args.output)
55
+ except OSError as error:
56
+ print(f"host-disk sample failed: {error}", file=sys.stderr, flush=True)
57
+ time.sleep(args.interval)
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>Label</key><string>dev.catalystcloud.host-disk</string>
6
+ <key>ProgramArguments</key>
7
+ <array>
8
+ <string>__PYTHON__</string>
9
+ <string>__SCRIPT__</string>
10
+ <string>--path</string><string>__PATH__</string>
11
+ <string>--output</string><string>__OUTPUT__</string>
12
+ <string>--interval</string><string>10</string>
13
+ </array>
14
+ <key>RunAtLoad</key><true/>
15
+ <key>KeepAlive</key><true/>
16
+ <key>ThrottleInterval</key><integer>10</integer>
17
+ </dict>
18
+ </plist>
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "repository": "coalesce-labs/catalyst-cloud",
3
- "commit": "ee729b12ea821310c48de7bbc753a59d60cc45d6",
3
+ "commit": "d002c356d5476ab4c3718152dac16931d293afe7",
4
4
  "sha256": {
5
5
  "deploy/self-host/compose.yaml": "0ffb7671c7ea49d8490d6e97093ada0afcb31da3b00092a8768150b090cca0bc",
6
6
  "deploy/self-host/compose.darwin-thoughts.yaml": "6269d66d6f487175ab8560d0648e65c8a0eccb86f69a8dc24daf41d8ae1dcf02",
7
7
  "deploy/self-host/darwin-thoughts-custody/producer.mjs": "0e0f1bbdac23813e8ee57b6eb4ae3dfd24c3f1c51ebe0c3d119a1448734ea05e",
8
- "deploy/self-host/darwin-thoughts-custody/verifier.mjs": "322b838917b9f7e1d9b7d9705a75143697ca093553bf0dcca7e7f5d4a88bbdc0",
8
+ "deploy/self-host/darwin-thoughts-custody/verifier.mjs": "0229509c107ec7a509a7bdbb7fa19d21f06a3f9075e53f4890f6d316d518518b",
9
9
  "deploy/self-host/darwin-thoughts-custody/verifier.d.mts": "624428ced2eb18b045b761b49e20b7f52c0fc6c3132689571103ece7b4a1083f",
10
10
  "deploy/self-host/darwin-thoughts-custody/watchdog.mjs": "6b5c7204aacd296c85a216d4f1b3adbe2084024fe37200ec1d24dfc2dec2e12d",
11
11
  "deploy/self-host/darwin-thoughts-custody/watchdog-deadline.mjs": "a642e6d8968f56f635056d3b258e5c4ad186c638a273c26b4528e85b7d2a6346",
12
12
  "deploy/self-host/darwin-thoughts-custody/service.plist.in": "66e9a2c175d2500b1f7130e7c04a5ed07f22bc7425661777f514fa3f2a816496",
13
- "deploy/self-host/darwin-thoughts-custody/manifest.json": "b2525e457dcd82326a71a873df95f6845d8d3231bf2afc20119a6034ddb98852",
13
+ "deploy/self-host/darwin-thoughts-custody/manifest.json": "d2df9f7abe9f4cece147d4b9d66a442b7ebfa8c881e2b1d268eb27bc5c1aa3bb",
14
14
  "deploy/self-host/linux-session-egress/session-egress.py": "a20cedfa1e883127ec461e4b7f9588d379fe1633b8244ecd703c81f589d3f142",
15
15
  "deploy/self-host/linux-session-egress/catalyst-session-egress.service": "703c150ab23ec87aea47cfc394f63e061b66c4b8c1454a88a9be879c161ce2a5",
16
16
  "deploy/self-host/linux-session-egress/catalyst-session-egress-attest.service": "94fa75ea0616f6a1172fc20ca637a5727c36456357e4a977d5bdd65f2fad2e8d",
17
- "deploy/self-host/linux-session-egress/catalyst-session-egress-attest.timer": "176622c11c835601b95f36e375ba3c2e993136976c67e5d49559f13a3454fef9"
17
+ "deploy/self-host/linux-session-egress/catalyst-session-egress-attest.timer": "176622c11c835601b95f36e375ba3c2e993136976c67e5d49559f13a3454fef9",
18
+ "deploy/self-host/host-disk-sample.py": "8ebb1c6b74c0d15f7758c1dfb47be8594c8db161db74b29556365644965f71a7",
19
+ "deploy/self-host/launchd/dev.catalystcloud.host-disk.plist": "dc9da55e2f85c026e276ab5cf2b130a719c74127a53e0a1b26cc72de0faacb01"
18
20
  }
19
21
  }