@catalyst-cloud/cli 0.16.42 → 0.16.43
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/ask.js +26 -10
- package/dist/cli.js +1 -1
- package/dist/runner-update-fleet.js +7 -5
- package/package.json +1 -1
- package/skills/catalyst-github/SKILL.md +1 -1
- package/skills/catalyst-linear/SKILL.md +1 -1
- package/skills/catalyst-onboard/SKILL.md +1 -1
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.43
|
|
4
|
+
|
|
5
|
+
`catalyst ask accept` now waits for an answer that has not reached Catalyst yet, instead of failing. If you accept an ask a few seconds after answering it, Catalyst may not have your answer comment yet. The command used to stop with a refusal, and the same command worked when you ran it again. Now it waits as long as Catalyst asks and tries again, for up to 30 seconds. If the answer still has not arrived, it says so and tells you when to run the same command again. A refusal that will not change on retry is reported at once, with its reason.
|
|
6
|
+
|
|
3
7
|
## 0.16.42
|
|
4
8
|
|
|
5
9
|
A busy machine now takes a waiting release after one day. Before, a busy machine could keep putting off a release that cannot take over from running work in place. Now the next check asks Catalyst to send the machine no new work, waits for the running work to finish, then moves to the release and takes work again. `catalyst runner update --check` says when a machine is waiting like this, and `catalyst runner auto-update off` ends the wait. If the update cannot restore the machine's private thoughts storage, the machine keeps taking no new work, and `catalyst runner update` tells you what to do. This release also makes updates on Catalyst's own machines more reliable.
|
package/dist/ask.js
CHANGED
|
@@ -9,7 +9,7 @@ import { CliError, UsageError } from "./errors.js";
|
|
|
9
9
|
import { apiClient } from "./transport.js";
|
|
10
10
|
import { fetchAllPages } from "./pagination.js";
|
|
11
11
|
import { fetchWorkflowStates, postAgent, resolveIssue } from "./write.js";
|
|
12
|
-
export async function cmdAsk(args, ctx) {
|
|
12
|
+
export async function cmdAsk(args, ctx, deps = {}) {
|
|
13
13
|
const [sub, ...rest] = positionals(args);
|
|
14
14
|
if (!sub)
|
|
15
15
|
throw new UsageError("ask needs a subcommand: raise | accept | answer | proxy | disown | list");
|
|
@@ -33,7 +33,7 @@ export async function cmdAsk(args, ctx) {
|
|
|
33
33
|
case "raise":
|
|
34
34
|
return raise(args, ctx, doc, api);
|
|
35
35
|
case "accept":
|
|
36
|
-
return accept(args, ctx, doc, api, rest);
|
|
36
|
+
return accept(args, ctx, doc, api, rest, deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms))));
|
|
37
37
|
case "answer":
|
|
38
38
|
return answerByProxy(args, ctx, doc, api, proxyBody);
|
|
39
39
|
case "list":
|
|
@@ -128,20 +128,36 @@ function askGates(args, options, doc) {
|
|
|
128
128
|
}
|
|
129
129
|
return { repo, pr: pr.length === 1 ? pr[0] : pr, labels: labels.length ? labels : ["hold"], releasedBy: released };
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
/** The most `ask accept` waits, in total, for an answer comment the cloud has not copied yet. */
|
|
132
|
+
export const ASK_ACCEPT_RETRY_BUDGET_MS = 30_000;
|
|
133
|
+
async function accept(args, ctx, doc, api, rest, sleep) {
|
|
132
134
|
const askTicket = rest[0];
|
|
133
135
|
const answer = flagString(args, "answer");
|
|
134
136
|
const role = flagString(args, "role");
|
|
135
137
|
if (!askTicket || !answer || !role)
|
|
136
138
|
throw new UsageError("ask accept needs <askTicket> --answer <commentId> --role <role>");
|
|
137
139
|
const ask = await resolveIssue(api, askTicket);
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
const body = { askIssueId: ask.id, answerCommentId: answer, acceptedByRole: role };
|
|
141
|
+
// An answer posted seconds ago may not have reached the cloud yet. The cloud refuses that one case
|
|
142
|
+
// as retryable and says how long to wait; every other refusal is final and is not retried.
|
|
143
|
+
let waited = 0;
|
|
144
|
+
for (;;) {
|
|
145
|
+
const result = await postAgent(api, doc, "ask-accept", body, { accept: [409] });
|
|
146
|
+
if (result.outcome !== "refused") {
|
|
147
|
+
ctx.stdout(args.json ? JSON.stringify(result) : `ask ${ask.identifier}: answer ${answer} recorded by ${role}`);
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
const waitMs = Math.max(1, result.retryAfterSeconds ?? 10) * 1000;
|
|
151
|
+
if (result.retryable === true && waited + waitMs <= ASK_ACCEPT_RETRY_BUDGET_MS) {
|
|
152
|
+
await sleep(waitMs);
|
|
153
|
+
waited += waitMs;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const reason = result.reason ?? "refused";
|
|
157
|
+
throw new CliError(result.retryable === true
|
|
158
|
+
? `ask ${ask.identifier}: answer ${answer} has not reached the cloud yet (${reason}) after ${waited / 1000}s of retries; run the same command again in ${result.retryAfterSeconds ?? 10}s`
|
|
159
|
+
: `ask ${ask.identifier}: accept refused (${reason})`, result.retryable === true ? "ask-accept-retry" : "ask-accept-refused", 2, 409);
|
|
160
|
+
}
|
|
145
161
|
}
|
|
146
162
|
/** The cloud's bounds on an answer by proxy, checked here first so a refusal never costs a write. */
|
|
147
163
|
const QUOTE_MAX = 4000;
|
package/dist/cli.js
CHANGED
|
@@ -531,7 +531,7 @@ export async function main(argv, ctx = defaultCtx(), deps = {}) {
|
|
|
531
531
|
case "write":
|
|
532
532
|
return await cmdWrite(args, ctx, deps.write);
|
|
533
533
|
case "ask":
|
|
534
|
-
return await cmdAsk(args, ctx);
|
|
534
|
+
return await cmdAsk(args, ctx, { sleep: deps.sleep });
|
|
535
535
|
case "ready":
|
|
536
536
|
return await cmdReady(args, ctx, {
|
|
537
537
|
skillNames: CUSTOMER_SKILLS,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { existsSync, readFileSync, unlinkSync } from "node:fs";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { readManifest } from "./config.js";
|
|
4
5
|
import { dockerRunnerEngine, prepareRunnerImages, spawnDocker } from "./onboard-runner.js";
|
|
5
6
|
import { defaultRun } from "./runner-auto-update.js";
|
|
6
|
-
import { decideRelease, DESIRED_RELEASE_SCRIPT, HOST_ID, isRecord, readReleaseState, releaseLock, takeLock, writePrivateAtomic, writeReleaseState, } from "./runner-update.js";
|
|
7
|
+
import { decideRelease, DESIRED_RELEASE_SCRIPT, HOST_ID, isRecord, readReleaseState, releaseLock, takeLock, updateReport, writePrivateAtomic, writeReleaseState, } from "./runner-update.js";
|
|
7
8
|
// `catalyst runner update --fleet <dir>`: the same approved release, applied to a multi-team
|
|
8
9
|
// supervisor fleet (CTC-6530). One supervisor container serves several scopes from a Compose file
|
|
9
10
|
// written as JSON (`compose.json`), under one operator enrollment, and every host credential on the
|
|
@@ -391,7 +392,7 @@ async function update(engine, options, now) {
|
|
|
391
392
|
const project = isRecord(compose) && typeof compose.name === "string" ? compose.name : "";
|
|
392
393
|
if (!isRecord(compose) || current === null || !/^[a-z0-9][a-z0-9_-]*$/.test(project))
|
|
393
394
|
return done("failed", "fleet_compose_unrecognized", { exitCode: 1 });
|
|
394
|
-
const read = await engine.desiredRelease(dir, compose, signal);
|
|
395
|
+
const read = await engine.desiredRelease(dir, compose, signal, options.check ? undefined : updateReport(state, readManifest().version));
|
|
395
396
|
const decision = decideRelease(state.generation, read);
|
|
396
397
|
if (decision.action === "retain")
|
|
397
398
|
return decision.reason === "not_newer"
|
|
@@ -764,8 +765,8 @@ export function dockerFleetUpdateEngine(deps = {}) {
|
|
|
764
765
|
const compose = (dir, project, file = join(dir, FLEET_COMPOSE_FILE)) => ["compose", "--project-name", project, "--file", file];
|
|
765
766
|
return {
|
|
766
767
|
// Not `compose run`: that would mount the Docker socket and every scope's state. This container
|
|
767
|
-
// gets the credential alone, read-only,
|
|
768
|
-
async desiredRelease(_dir, file, signal) {
|
|
768
|
+
// gets the credential alone, read-only, the script's configuration and an optional update report.
|
|
769
|
+
async desiredRelease(_dir, file, signal, report) {
|
|
769
770
|
const service = isRecord(file.services) && isRecord(file.services.supervisor) ? file.services.supervisor : null;
|
|
770
771
|
const environment = service && isRecord(service.environment) ? service.environment : null;
|
|
771
772
|
const credential = environment?.CATALYST_HOST_CREDENTIAL_FILE;
|
|
@@ -776,9 +777,10 @@ export function dockerFleetUpdateEngine(deps = {}) {
|
|
|
776
777
|
if (!mount)
|
|
777
778
|
return { kind: "no_credential" };
|
|
778
779
|
const user = typeof service.user === "string" && /^[0-9]+(:[0-9]+)?$/.test(service.user) ? ["--user", service.user] : [];
|
|
780
|
+
const reportEnv = report ? ["--env", `CATALYST_UPDATE_REPORT=${report}`] : [];
|
|
779
781
|
const read = await docker(["run", "--rm", "--network", "bridge", "--read-only", "--tmpfs", "/tmp", "--cap-drop", "ALL",
|
|
780
782
|
"--security-opt", "no-new-privileges", ...user, "--mount", mount,
|
|
781
|
-
"--env", `CATALYST_HOST_CREDENTIAL_FILE=${credential}`, "--env", `CATALYST_MIRROR_URL=${mirror}`,
|
|
783
|
+
"--env", `CATALYST_HOST_CREDENTIAL_FILE=${credential}`, "--env", `CATALYST_MIRROR_URL=${mirror}`, ...reportEnv,
|
|
782
784
|
"--entrypoint", "bun", service.image, "-e", DESIRED_RELEASE_SCRIPT], { signal, timeoutMs: 120_000 });
|
|
783
785
|
if (read.code !== 0)
|
|
784
786
|
return { kind: "no_credential" };
|
package/package.json
CHANGED
|
@@ -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.43 — 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.43 — 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.43 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# Onboard me
|
|
10
10
|
|
|
@@ -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.43 — 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.43 — 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.43 — 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.43 — 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.43 — written in this repository for customer accounts -->
|
|
8
8
|
|
|
9
9
|
# What's happening
|
|
10
10
|
|