@catalyst-cloud/cli 0.16.21 → 0.16.23

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.23
4
+
5
+ You can now answer an ask by telling your agent in chat, and have the agent record it for you. `catalyst ask answer <ask> --proxy --quote "<your exact words>" --said-in <session>` records your words on the ask as an answer by proxy, with `--option <letter>` when you picked one. It is kept apart from answers you give on the ask yourself, and the work the ask held moves on. It works only on your own asks, and only after you turn it on with `catalyst ask proxy on` (`catalyst ask proxy` shows whether it is on; `off` turns it off). If an agent recorded something you did not mean, `catalyst ask disown <ask>` takes it back and reopens the ask. Update the Catalyst plugin's skills with the CLI so your agent knows when it may do this.
6
+
7
+ ## 0.16.22
8
+
9
+ A self-hosted Linux machine set up over SSH now keeps updating after you log out, with no `sudo` step. Setup turns on lingering for your user by itself, and says so along with how to undo it (`loginctl disable-linger $USER`). Only when the machine does not allow that does setup name the one `sudo loginctl enable-linger $USER` command, and it says updates stop at logout until you run it. `catalyst runner auto-update status` now says whether updates keep running after you log out. For a machine you already set up, install this version and run `catalyst runner auto-update on`.
10
+
3
11
  ## 0.16.21
4
12
 
5
13
  `catalyst accounts` now leaves out removed AI accounts: ones an admin revoked, or whose paid access ended. They take no work and take no new credential, so they no longer appear as accounts to repair. The list says how many it left out, and `catalyst accounts --all` shows them, marked "removed — kept for history". Setup now names a revoked account as ended instead of asking you to turn it on. Update the Catalyst plugin's skills along with the CLI: setup's account check uses `--all`, which older CLIs do not know.
package/dist/args.js CHANGED
@@ -278,7 +278,7 @@ export const FLAG_TABLES = {
278
278
  option: {
279
279
  value: true,
280
280
  repeat: true,
281
- help: "raise: an option (repeatable)",
281
+ help: "raise: an option (repeatable); answer: the letter of the option the owner chose (leave out for free text)",
282
282
  },
283
283
  default: { value: true, help: "raise: the default if silent" },
284
284
  blocks: {
@@ -315,7 +315,20 @@ export const FLAG_TABLES = {
315
315
  },
316
316
  "ask-key": { value: true, help: "raise: idempotency key" },
317
317
  answer: { value: true, help: "accept: the answering comment id" },
318
- role: { value: true, help: "accept: the role recording the answer" },
318
+ role: { value: true, help: "accept/answer: the role recording the answer" },
319
+ proxy: {
320
+ value: false,
321
+ help: "answer: record an answer the ask's owner gave you in chat (required)",
322
+ },
323
+ quote: { value: true, help: "answer: the owner's exact words" },
324
+ "said-in": {
325
+ value: true,
326
+ help: "answer: the chat session or channel id where the owner said it",
327
+ },
328
+ "said-at": {
329
+ value: true,
330
+ help: "answer: when the owner said it, as an ISO-8601 time (default now)",
331
+ },
319
332
  },
320
333
  ready: {
321
334
  onboarding: {
@@ -538,7 +551,7 @@ export const VERB_USAGE = {
538
551
  queue: "queue [--team K] [--json]",
539
552
  watch: "watch [--team K] [--ticket T]... [--project P] [--exec CMD] [--cursor-file <path>] [--from cursor|head]",
540
553
  write: "write <comment <ticket> --body|--stdin [--parent] [--bookkeeping] [--as-user] | state <ticket> --slot|--state-id|--state-type | label <ticket> --add... --remove... | create --team --title [--description|--stdin] [--label] [--priority] | reaction <ticket>|--comment <id> --emoji <e> | attachment <ticket> --title --url | session <ticket> [--title] [--plan-file] [--activity]>",
541
- ask: "ask <raise --team --title [--context] [--option]... [--default] --blocks <ticket>...|--nothing-to-block [--ask-key] [--gates-pr <n>... --released-by <letter>... [--gates-label hold|hold:preview]... [--gates-repo <owner/name>]] | accept <askTicket> --answer <commentId> --role <role> | list [--anyone] [--json]>",
554
+ ask: "ask <raise --team --title [--context] [--option]... [--default] --blocks <ticket>...|--nothing-to-block [--ask-key] [--gates-pr <n>... --released-by <letter>... [--gates-label hold|hold:preview]... [--gates-repo <owner/name>]] | accept <askTicket> --answer <commentId> --role <role> | answer <askTicket> --proxy --quote <owner's exact words> [--option <letter>] --said-in <session or channel id> [--said-at <ISO-8601 time>] [--role <role>] | proxy [status|on|off] | disown <askTicket> | list [--anyone]> [--json]",
542
555
  ready: "ready [--onboarding] [--local-sync] [--json] [--offline]",
543
556
  accounts: "accounts [--all] [--json]",
544
557
  seat: "seat checkout --size big|med --harness claude,codex,opencode [--session-id ID] [--stage STAGE] [--key-env NAME]",
package/dist/ask.js CHANGED
@@ -1,28 +1,41 @@
1
- // ask.ts — `ask raise|accept|list`: raise a decision through the contract's ask route (the cloud
2
- // renders the body from its own template, so this passes fields, never headings), record an answer
3
- // through ask-accept, and list open asks ranked by the work each one holds.
1
+ // ask.ts — `ask raise|accept|answer|proxy|disown|list`: raise a decision through the contract's ask
2
+ // route (the cloud renders the body from its own template, so this passes fields, never headings),
3
+ // record an answer through ask-accept, record an owner's chat answer by proxy (CTC-6279) and let the
4
+ // owner switch that on, off or take one back, and list open asks ranked by the work each one holds.
4
5
  import { flagBool, flagList, flagString, positionals } from "./args.js";
5
6
  import { requireConfig } from "./config.js";
6
7
  import { loadContract, teamByKey } from "./contract.js";
7
- import { UsageError } from "./errors.js";
8
+ import { CliError, UsageError } from "./errors.js";
8
9
  import { apiClient } from "./transport.js";
9
10
  import { fetchAllPages } from "./pagination.js";
10
11
  import { fetchWorkflowStates, postAgent, resolveIssue } from "./write.js";
11
12
  export async function cmdAsk(args, ctx) {
12
13
  const [sub, ...rest] = positionals(args);
13
14
  if (!sub)
14
- throw new UsageError("ask needs a subcommand: raise | accept | list");
15
+ throw new UsageError("ask needs a subcommand: raise | accept | answer | proxy | disown | list");
15
16
  if (sub === "raise" && !flagBool(args, "nothing-to-block") && flagList(args, "blocks").length === 0) {
16
17
  throw new UsageError("ask raise needs --blocks <ticket>... (what this decision holds) or --nothing-to-block");
17
18
  }
19
+ // Everything these three would refuse is refused before the config is read or anything is sent.
20
+ const proxyBody = sub === "answer" ? proxyAnswerBody(args, rest, ctx.now().getTime()) : undefined;
21
+ const proxyAction = sub === "proxy" ? proxySettingAction(rest) : undefined;
22
+ if (sub === "disown" && (!rest[0] || rest.length > 1))
23
+ throw new UsageError("ask disown needs exactly one <ask>");
18
24
  const cfg = requireConfig(ctx);
19
- const { doc } = await loadContract(ctx, cfg);
20
25
  const api = apiClient(cfg, ctx);
26
+ // The two personal settings routes are not contract routes: they act as the logged-in person.
27
+ if (proxyAction)
28
+ return proxySetting(args, ctx, api, proxyAction);
29
+ if (sub === "disown")
30
+ return disown(args, ctx, api, rest[0]);
31
+ const { doc } = await loadContract(ctx, cfg);
21
32
  switch (sub) {
22
33
  case "raise":
23
34
  return raise(args, ctx, doc, api);
24
35
  case "accept":
25
36
  return accept(args, ctx, doc, api, rest);
37
+ case "answer":
38
+ return answerByProxy(args, ctx, doc, api, proxyBody);
26
39
  case "list":
27
40
  return list(args, ctx, doc, api, cfg);
28
41
  default:
@@ -130,6 +143,227 @@ async function accept(args, ctx, doc, api, rest) {
130
143
  ctx.stdout(args.json ? JSON.stringify(result) : `ask ${ask.identifier}: answer ${answer} recorded by ${role}`);
131
144
  return 0;
132
145
  }
146
+ /** The cloud's bounds on an answer by proxy, checked here first so a refusal never costs a write. */
147
+ const QUOTE_MAX = 4000;
148
+ const SAID_IN_MAX = 200;
149
+ const ROLE_MAX = 64;
150
+ const FUTURE_SKEW_MS = 5 * 60_000;
151
+ const SINGLE_LINE = /^[^\r\n]+$/;
152
+ /** CTC-6279 — `ask answer <ask> --proxy ...` → the ask-answer-proxy body. `--proxy` is required so the
153
+ * command can never be mistaken for the owner answering: an answer the owner posted on the ask is
154
+ * recorded with `ask accept`. The option letter maps A=0; no `--option` is a free-text answer, recorded
155
+ * as written. The quote is sent exactly as given, never trimmed. */
156
+ export function proxyAnswerBody(args, rest, nowMs) {
157
+ const usage = 'ask answer <ask> --proxy --quote "<owner\'s exact words>" [--option <letter>] --said-in <session or channel id> [--said-at <ISO-8601 time>] [--role <role>]';
158
+ if (!flagBool(args, "proxy")) {
159
+ throw new UsageError(`ask answer records only an answer the ask's owner gave you in chat, and needs --proxy: ${usage}. For an answer the owner posted on the ask themselves, use: catalyst ask accept <ask> --answer <commentId> --role <role>`);
160
+ }
161
+ const ask = rest[0];
162
+ if (!ask || rest.length > 1)
163
+ throw new UsageError(`ask answer needs exactly one <ask>: ${usage}`);
164
+ const quote = flagString(args, "quote");
165
+ if (quote === undefined || quote.trim() === "")
166
+ throw new UsageError("ask answer --proxy needs --quote with the owner's exact words");
167
+ if (quote.length > QUOTE_MAX)
168
+ throw new UsageError(`--quote is ${quote.length} characters; the most an answer can carry is ${QUOTE_MAX}`);
169
+ const saidIn = flagString(args, "said-in");
170
+ if (saidIn === undefined || saidIn.trim() === "")
171
+ throw new UsageError("ask answer --proxy needs --said-in <session or channel id>: where the owner said it");
172
+ if (!SINGLE_LINE.test(saidIn) || saidIn.length > SAID_IN_MAX)
173
+ throw new UsageError(`--said-in must be one line of at most ${SAID_IN_MAX} characters`);
174
+ const role = flagString(args, "role");
175
+ if (role !== undefined && (!SINGLE_LINE.test(role) || role.length > ROLE_MAX))
176
+ throw new UsageError(`--role must be one line of at most ${ROLE_MAX} characters`);
177
+ const saidAtRaw = flagString(args, "said-at");
178
+ let saidAtMs = nowMs;
179
+ if (saidAtRaw !== undefined) {
180
+ saidAtMs = Date.parse(saidAtRaw);
181
+ if (!Number.isFinite(saidAtMs))
182
+ throw new UsageError(`--said-at must be an ISO-8601 time, such as 2026-10-20T14:05:00Z (got "${saidAtRaw}")`);
183
+ if (saidAtMs > nowMs + FUTURE_SKEW_MS)
184
+ throw new UsageError(`--said-at ${saidAtRaw} is in the future; give the time the owner said it`);
185
+ }
186
+ const options = flagList(args, "option");
187
+ if (options.length > 1)
188
+ throw new UsageError("ask answer takes one --option: the letter the owner chose");
189
+ let optionIndex;
190
+ if (options.length === 1) {
191
+ const letter = options[0].trim().toUpperCase();
192
+ if (!/^[A-Z]$/.test(letter))
193
+ throw new UsageError(`--option must be one letter from A to Z (got "${options[0]}"); leave it out for a free-text answer`);
194
+ optionIndex = letter.charCodeAt(0) - 65;
195
+ }
196
+ return {
197
+ // The cloud matches an identifier exactly, so `ctc-12` is sent as `CTC-12`.
198
+ askIssueId: /^[A-Za-z][A-Za-z0-9]*-\d+$/.test(ask) ? ask.toUpperCase() : ask,
199
+ ownerQuote: quote,
200
+ ...(optionIndex !== undefined ? { optionIndex } : {}),
201
+ saidIn,
202
+ saidAtMs,
203
+ ...(role !== undefined ? { acceptedByRole: role } : {}),
204
+ };
205
+ }
206
+ const letterOf = (index) => String.fromCharCode(65 + index);
207
+ /** One plain sentence per refusal reason the ask-answer-proxy route answers. */
208
+ function proxyRefusal(ask, reason, body, optionCount) {
209
+ switch (reason) {
210
+ case "not-an-ask":
211
+ return `${ask} is not an ask, so there is no answer to record.`;
212
+ case "issue-not-mirrored":
213
+ return `Catalyst cannot see ${ask} yet. Check the identifier, or try again in a minute.`;
214
+ case "already-resolved":
215
+ return `${ask} already has an answer. Nothing was recorded.`;
216
+ case "proxy-answer-already-recorded":
217
+ return `An answer by proxy is already recorded on ${ask}, so nothing new was recorded. If an earlier run of this command failed partway, run it again from the same login with the same --quote, --option, --said-in, --said-at and --role to finish recording that answer.`;
218
+ case "readiness-needs-tap":
219
+ return `${ask} must be answered by its owner in the app. An answer by proxy cannot settle it.`;
220
+ case "ask-has-no-team":
221
+ return `${ask} is not in a project Catalyst works, so it cannot be answered by proxy.`;
222
+ case "ask-has-no-owner":
223
+ return `${ask} has no owner, so nobody's chat answer can be recorded on it.`;
224
+ case "proxy-caller-not-owner":
225
+ return `${ask} belongs to someone else. Only an agent logged in as the ask's owner can record their answer. If it is your ask, check that your Linear identity is matched: catalyst identity linear status`;
226
+ case "proxy-answering-off":
227
+ return `${ask}'s owner has not turned on answers by proxy, so nothing was recorded. Only the owner can turn it on, by running: catalyst ask proxy on`;
228
+ case "option-out-of-range": {
229
+ const chosen = body.optionIndex !== undefined ? letterOf(body.optionIndex) : "that option";
230
+ if (optionCount === 0)
231
+ return `${ask} has no lettered options. Leave out --option to record the answer as written.`;
232
+ if (typeof optionCount === "number" && optionCount > 0)
233
+ return `${ask} has options A to ${letterOf(optionCount - 1)}; ${chosen} is not one of them.`;
234
+ return `${ask} has no option ${chosen}.`;
235
+ }
236
+ case "already-in-flight":
237
+ return `Another answer to ${ask} is being recorded right now. Check it again in a moment.`;
238
+ default:
239
+ return `${ask}: the answer was refused (${reason || "no reason given"}).`;
240
+ }
241
+ }
242
+ async function answerByProxy(args, ctx, doc, api, body) {
243
+ const result = await postAgent(api, doc, "ask-answer-proxy", body, { accept: [409, 502] });
244
+ const outcome = result.outcome;
245
+ // A record-failed answer may be partly written, and the cloud finishes it only for the same said-at,
246
+ // so the retry names the time this run sent rather than letting --said-at default to a new now.
247
+ const saidAt = new Date(body.saidAtMs).toISOString();
248
+ if (args.json)
249
+ ctx.stdout(JSON.stringify(outcome === "record-failed" ? { ...result, retrySaidAt: saidAt } : result));
250
+ const ask = typeof result.askIdentifier === "string" ? result.askIdentifier : body.askIssueId;
251
+ if (outcome === "recorded") {
252
+ if (!args.json) {
253
+ const how = body.optionIndex !== undefined ? `${letterOf(body.optionIndex)} by proxy` : "by proxy, in the owner's words";
254
+ ctx.stdout(`${ask} answered ${how}: "${body.ownerQuote}"`);
255
+ const failed = Array.isArray(result.failedBlockedComments) ? result.failedBlockedComments.length : typeof result.failedBlockedComments === "number" ? result.failedBlockedComments : 0;
256
+ if (failed > 0)
257
+ ctx.stdout(`${failed} held ticket${failed === 1 ? "" : "s"} did not get the note naming this answer; the answer itself is recorded.`);
258
+ ctx.stdout(`The owner can take it back with: catalyst ask disown ${ask}`);
259
+ }
260
+ return 0;
261
+ }
262
+ if (outcome === "refused") {
263
+ if (!args.json)
264
+ ctx.stdout(proxyRefusal(ask, typeof result.reason === "string" ? result.reason : "", body, result.optionCount));
265
+ return 1;
266
+ }
267
+ if (outcome === "record-failed") {
268
+ if (!args.json)
269
+ ctx.stdout(`The answer to ${ask} did not finish recording${typeof result.reason === "string" && result.reason ? ` (${result.reason})` : ""}; part of it may already be on the ask. Run the same command again with --said-at ${saidAt} to finish it.`);
270
+ return 2;
271
+ }
272
+ throw new CliError(`ask-answer-proxy answered an outcome this CLI does not know: ${JSON.stringify(outcome)}`, "shape");
273
+ }
274
+ const PROXY_SETTING_PATH = "/api/v1/me/ask-proxy-answering";
275
+ const ASK_DISOWN_PATH = "/api/v1/me/ask-disown";
276
+ function proxySettingAction(rest) {
277
+ const action = rest[0] ?? "status";
278
+ if (rest.length > 1 || !["status", "on", "off"].includes(action))
279
+ throw new UsageError("ask proxy takes: status | on | off");
280
+ return action;
281
+ }
282
+ /** The two refusals both personal routes share, in plain words: an account key (403) throws, an
283
+ * unmatched Linear identity (409) prints and exits 1. Returns undefined when the status was neither;
284
+ * --json has already printed the body, so it prints nothing more. */
285
+ function personalRefusal(args, ctx, status, body, what) {
286
+ const error = body && typeof body === "object" ? body.error : undefined;
287
+ if (status === 403 && error === "personal_credential_required") {
288
+ throw new CliError(`${what} needs your own login, not the workspace's shared key. Run catalyst login as yourself, then try again.`, "member-required", 2, 403);
289
+ }
290
+ if (status === 409 && error === "no_linear_identity") {
291
+ if (!args.json)
292
+ ctx.stdout("Your Linear identity is not matched yet, so Catalyst cannot tell which asks are yours. Match it with: catalyst identity linear options, then catalyst identity linear set <linearUserId>");
293
+ return 1;
294
+ }
295
+ if (status === 403 || (status === 409 && error !== undefined)) {
296
+ throw new CliError(`${what} was refused (${status}${typeof error === "string" ? `: ${error}` : ""})`, status === 403 ? "forbidden" : "http", 2, status);
297
+ }
298
+ return undefined;
299
+ }
300
+ function proxySettingLine(enabled, changed) {
301
+ return enabled
302
+ ? `${changed ? "Turned on: " : "On: "}agents may record an answer you give them in chat on your asks. Turn it off with: catalyst ask proxy off`
303
+ : `${changed ? "Turned off: " : "Off: "}agents may not record an answer you give them in chat; answer on the ask itself. Turn it on with: catalyst ask proxy on`;
304
+ }
305
+ async function proxySetting(args, ctx, api, action) {
306
+ const res = action === "status"
307
+ ? await api.getJson(PROXY_SETTING_PATH, { accept: [403, 409], parseAccepted: true })
308
+ : await api.putJson(PROXY_SETTING_PATH, { enabled: action === "on" }, { accept: [403, 409] });
309
+ if (args.json && res.status !== 403)
310
+ ctx.stdout(JSON.stringify(res.body ?? {}));
311
+ const refused = personalRefusal(args, ctx, res.status, res.body, "ask proxy");
312
+ if (refused !== undefined)
313
+ return refused;
314
+ if (typeof res.body?.enabled !== "boolean")
315
+ throw new CliError(`${PROXY_SETTING_PATH} answered without an enabled flag`, "shape");
316
+ if (!args.json)
317
+ ctx.stdout(proxySettingLine(res.body.enabled, action !== "status"));
318
+ return 0;
319
+ }
320
+ /** One plain sentence per refusal reason the ask-disown route answers. */
321
+ function disownRefusal(ask, reason) {
322
+ switch (reason) {
323
+ case "not-owner":
324
+ return `${ask} is not your ask, so you cannot take back its answer.`;
325
+ case "not-proxy-answered":
326
+ return `${ask} was not answered by proxy, so there is nothing to take back.`;
327
+ case "already-disowned":
328
+ return `You already took back the answer on ${ask}.`;
329
+ case "already-in-flight":
330
+ return `A change to ${ask} is being recorded right now. Check it again in a moment.`;
331
+ default:
332
+ return `${ask}: taking back the answer was refused (${reason || "no reason given"}).`;
333
+ }
334
+ }
335
+ async function disown(args, ctx, api, askTicket) {
336
+ const ask = await resolveIssue(api, askTicket);
337
+ const res = await api.postJson(ASK_DISOWN_PATH, { issueId: ask.id }, { accept: [403, 409, 502] });
338
+ const body = res.body ?? {};
339
+ if (args.json && res.status !== 403)
340
+ ctx.stdout(JSON.stringify(body));
341
+ const refused = personalRefusal(args, ctx, res.status, body, "ask disown");
342
+ if (refused !== undefined)
343
+ return refused;
344
+ const name = typeof body.askIdentifier === "string" ? body.askIdentifier : ask.identifier;
345
+ switch (body.outcome) {
346
+ case "disowned": {
347
+ if (args.json)
348
+ return 0;
349
+ ctx.stdout(`${name} is open again: the answer recorded by proxy is taken back.`);
350
+ const tickets = Array.isArray(body.tickets) ? body.tickets : [];
351
+ for (const t of tickets)
352
+ ctx.stdout(` ${String(t.ticket ?? "?")}: ${String(t.phase ?? "?")} ${String(t.status ?? "")}`.trimEnd());
353
+ return 0;
354
+ }
355
+ case "refused":
356
+ if (!args.json)
357
+ ctx.stdout(disownRefusal(name, typeof body.reason === "string" ? body.reason : ""));
358
+ return 1;
359
+ case "disown-failed":
360
+ if (!args.json)
361
+ ctx.stdout(`The answer on ${name} was not taken back${typeof body.reason === "string" && body.reason ? ` (${body.reason})` : ""}. Nothing changed; run the same command again.`);
362
+ return 2;
363
+ default:
364
+ throw new CliError(`${ASK_DISOWN_PATH} answered an outcome this CLI does not know: ${JSON.stringify(body.outcome)}`, "shape");
365
+ }
366
+ }
133
367
  /** Decide the inbox scope from the connected identity and the `--anyone` flag. A personal key with a
134
368
  * matched Linear identity reads "mine" by default; `--anyone` widens; an unmatched identity or a
135
369
  * host key cannot mean "me" and says so rather than filtering to nothing. */
@@ -41,6 +41,9 @@ export const CAPABILITIES = [
41
41
  { verb: "explain|running|queue|history", does: "read why a ticket runs or waits, what runs now, and what is queued", needs: "member", routes: [], since: "0.1.0" },
42
42
  { verb: "write comment|state|label|create|reaction|attachment|session", does: "act on a ticket as the person, through the agent proxy", needs: "member", routes: [agent("POST", "issue-comment"), agent("POST", "issue-state"), agent("POST", "issue-label"), agent("POST", "issue-create")], since: "0.1.0" },
43
43
  { verb: "ask raise|accept|list", does: "raise a decision to a human, or answer one", needs: "member", routes: [agent("POST", "ask"), agent("POST", "ask-accept")], since: "0.1.0" },
44
+ { verb: "ask answer --proxy", does: "record an answer the ask's owner gave in chat, quoted exactly, when the owner has turned answers by proxy on", needs: "member", routes: [agent("POST", "ask-answer-proxy")], since: "0.16.23" },
45
+ { verb: "ask proxy status|on|off", does: "read or set whether agents may record an answer you give them in chat (your own login only)", needs: "member", routes: [], since: "0.16.23" },
46
+ { verb: "ask disown", does: "take back an answer recorded by proxy on your ask, reopening it (your own login only)", needs: "member", routes: [], since: "0.16.23" },
44
47
  { verb: "release", does: "release a parked ticket or a whole failure class back to work", needs: "admin", routes: [agent("POST", "ticket-release"), agent("POST", "ticket-release-class")], since: "0.6.0" },
45
48
  { verb: "mcp add|list|remove", does: "register an MCP server for the workspace by vault-secret name", needs: "admin", routes: [agent("POST", "mcp")], since: "0.9.0" },
46
49
  ];
package/dist/cli.js CHANGED
@@ -95,7 +95,7 @@ export function usageText() {
95
95
  " catalyst explain <ticket> | history <ticket> | running [--ticket T --phase P] | queue [--team K]",
96
96
  " catalyst watch [--team K] [--ticket T]... [--project P] [--exec CMD]",
97
97
  " catalyst write <comment|state|label|create|reaction|attachment|session> ...",
98
- " catalyst ask <raise|accept|list> ...",
98
+ " catalyst ask <raise|accept|answer --proxy|proxy [status|on|off]|disown|list> ...",
99
99
  " catalyst release <ticket> --because <what changed> [--retry-unchanged] [--dry-run] | release --class <c> --team <K> ...",
100
100
  " catalyst environment [read] | environment propose --file <path>|--stdin [--approve] | environment approve (your account; needs login)",
101
101
  " catalyst env <inventory [path] | check <file> | migrate [catalyst.env.json] | draft [--root DIR] [--diff] [--write] | shell [--root DIR] [--env-file FILE]... [--image REF] [--check]> [--json] (this repository; no login — shell needs Docker and downloads Catalyst's image once)",
@@ -82,6 +82,21 @@ export function systemdUnits(deps, dir) {
82
82
  ].join("\n"),
83
83
  };
84
84
  }
85
+ /** A user timer runs only while this person's systemd user manager does, and without lingering that
86
+ * manager stops when they log out of a headless machine. */
87
+ function lingering(run, uid) {
88
+ return /Linger=yes/.test(run("loginctl", ["show-user", String(uid), "--property=Linger"]).stdout);
89
+ }
90
+ /** Turn lingering on for this person when it is off. On most distributions polkit lets a user in an
91
+ * active session, SSH included, do this without sudo (CTC-6264). --no-ask-password: a refusal must
92
+ * come back as an answer, never as a prompt. Returns the state read back afterwards. */
93
+ function ensureLingering(run, uid) {
94
+ if (lingering(run, uid))
95
+ return { linger: true, turnedOn: false };
96
+ run("loginctl", ["--no-ask-password", "enable-linger"]);
97
+ const linger = lingering(run, uid);
98
+ return { linger, turnedOn: linger };
99
+ }
85
100
  function writeFileAtomic(path, text) {
86
101
  mkdirSync(dirname(path), { recursive: true });
87
102
  const temp = `${path}.${process.pid}.tmp`;
@@ -103,7 +118,10 @@ export function autoUpdateStatus(deps) {
103
118
  if (!existsSync(timer))
104
119
  return { state: "off", detail: "no_timer" };
105
120
  const enabled = run("systemctl", ["--user", "is-enabled", `${AUTO_UPDATE_UNIT}.timer`]);
106
- return enabled.status === 0 ? { state: "on", detail: "timer_enabled", path: timer } : { state: "off", detail: "timer_not_enabled" };
121
+ if (enabled.status !== 0)
122
+ return { state: "off", detail: "timer_not_enabled" };
123
+ const linger = lingering(run, deps.uid ?? process.getuid?.() ?? 0);
124
+ return { state: "on", detail: linger ? "timer_enabled" : "timer_enabled_without_linger", path: timer, linger };
107
125
  }
108
126
  return { state: "unsupported", detail: `platform_${platform}` };
109
127
  }
@@ -139,13 +157,14 @@ export function enableAutoUpdate(deps, dir) {
139
157
  const enabled = run("systemctl", ["--user", "enable", "--now", `${AUTO_UPDATE_UNIT}.timer`]);
140
158
  if (enabled.status !== 0)
141
159
  return { state: "off", detail: `systemctl_enable_failed:${enabled.stderr.trim().slice(0, 160)}` };
142
- // Without lingering, a user timer stops when this person logs out of a headless machine.
143
- const linger = run("loginctl", ["show-user", String(deps.uid ?? process.getuid?.() ?? 0), "--property=Linger"]);
144
- return { state: "on", detail: /Linger=yes/.test(linger.stdout) ? "timer_enabled" : "timer_enabled_without_linger", path: paths.timer };
160
+ const { linger, turnedOn } = ensureLingering(run, deps.uid ?? process.getuid?.() ?? 0);
161
+ return { state: "on", detail: linger ? "timer_enabled" : "timer_enabled_without_linger", path: paths.timer, linger,
162
+ ...(turnedOn ? { lingerTurnedOn: true } : {}) };
145
163
  }
146
164
  return { state: "unsupported", detail: `platform_${platform}` };
147
165
  }
148
- /** Stop and remove the schedule's own files. Nothing else. */
166
+ /** Stop and remove the schedule's own files. Nothing else: on Linux it reports lingering but leaves it
167
+ * as it is, because it may have been on before setup turned it on. */
149
168
  export function disableAutoUpdate(deps) {
150
169
  const platform = deps.platform ?? process.platform;
151
170
  const run = deps.run ?? defaultRun;
@@ -164,7 +183,7 @@ export function disableAutoUpdate(deps) {
164
183
  if (existsSync(path))
165
184
  unlinkSync(path);
166
185
  run("systemctl", ["--user", "daemon-reload"]);
167
- return { state: "off", detail: "timer_removed" };
186
+ return { state: "off", detail: "timer_removed", linger: lingering(run, deps.uid ?? process.getuid?.() ?? 0) };
168
187
  }
169
188
  return { state: "unsupported", detail: `platform_${platform}` };
170
189
  }
@@ -14,12 +14,21 @@ function schedulerDeps(ctx, deps) {
14
14
  };
15
15
  }
16
16
  function statusLine(status) {
17
- if (status.state === "on")
18
- return status.detail === "timer_enabled_without_linger"
19
- ? "Automatic runner updates are on, every 15 minutes while you are logged in. To keep them running after you log out, run: sudo loginctl enable-linger $USER"
17
+ if (status.state === "on") {
18
+ if (status.linger === false)
19
+ return "Automatic runner updates are on, but they stop when you log out: this machine did not let you keep your user services running. Run this once to keep them running: sudo loginctl enable-linger $USER";
20
+ if (status.lingerTurnedOn)
21
+ return "Automatic runner updates are on: this machine checks for an approved release every 15 minutes, and keeps checking after you log out. To do that, setup turned on lingering for you, which keeps your user services running after logout. To undo it: loginctl disable-linger $USER";
22
+ return status.linger
23
+ ? "Automatic runner updates are on: this machine checks for an approved release every 15 minutes, and keeps checking after you log out."
20
24
  : "Automatic runner updates are on: this machine checks for an approved release every 15 minutes.";
21
- if (status.state === "off")
22
- return `Automatic runner updates are off (${status.detail}). Turn them on with: catalyst runner auto-update on`;
25
+ }
26
+ if (status.state === "off") {
27
+ const off = `Automatic runner updates are off (${status.detail}). Turn them on with: catalyst runner auto-update on`;
28
+ return status.linger
29
+ ? `${off}. Lingering is still on for you, which keeps your user services running after logout. If nothing else needs it: loginctl disable-linger $USER`
30
+ : off;
31
+ }
23
32
  if (status.detail === "no_systemd_user_manager")
24
33
  return "Automatic runner updates need your systemd user manager, which is not running for you. Run: sudo loginctl enable-linger $USER, then catalyst runner auto-update on";
25
34
  return `Automatic runner updates are not available on this machine (${status.detail}). Run catalyst runner update yourself.`;
package/dist/write.js CHANGED
@@ -87,10 +87,12 @@ export function labelFields(team, values) {
87
87
  return { ...(ids.length ? { labelIds: ids } : {}), ...(names.length ? { labelNames: names } : {}) };
88
88
  }
89
89
  /** Post to a contract route by name; a budget refusal names the contract's daily budget. A 2xx whose body
90
- * says the write failed (issue-label answers a batch of failed items with 200) is a failure too. */
91
- export async function postAgent(api, doc, routeName, body) {
90
+ * says the write failed (issue-label answers a batch of failed items with 200) is a failure too.
91
+ * `opts.accept` returns those non-2xx statuses' bodies instead of throwing, for a route whose refusal
92
+ * is an answer the caller prints (ask-answer-proxy's 409 and 502). */
93
+ export async function postAgent(api, doc, routeName, body, opts = {}) {
92
94
  try {
93
- const res = await api.postJson(routePath(doc, routeName), body);
95
+ const res = await api.postJson(routePath(doc, routeName), body, opts);
94
96
  const outcome = res.body && typeof res.body === "object" ? res.body.outcome : undefined;
95
97
  if (outcome === "failed" || outcome === "rejected" || outcome === "exhausted") {
96
98
  const reason = res.body.reason;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catalyst-cloud/cli",
3
- "version": "0.16.21",
3
+ "version": "0.16.23",
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.6",
56
+ "@catalyst-cloud/sdk": "0.16.9",
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.6"
62
+ "@catalyst-cloud/sdk-replica-node": "0.16.9"
63
63
  },
64
64
  "devDependencies": {
65
- "@catalyst-cloud/schema": "0.16.5",
65
+ "@catalyst-cloud/schema": "0.16.7",
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.21 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.23 — 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.21 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.23 — 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.21 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.23 — 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.21 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.23 — 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.21 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.23 — 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.21 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.23 — written in this repository for customer accounts -->
8
8
 
9
9
  # What needs me
10
10
 
@@ -28,6 +28,19 @@ Scripts are run, never read. Each prints `--help`; exit 2 means this machine is
28
28
 
29
29
  The `catalyst-linear` skill posts the comment that carries an answer given in chat and reads an ask's thread; `whats-happening` explains a held ticket that stays excluded after the answer.
30
30
 
31
+ ## An answer the owner gives you in chat
32
+
33
+ When the ask's owner answers it to you directly in this chat, you may record it by proxy:
34
+
35
+ `catalyst ask answer <ask> --proxy --quote "<their exact words>" [--option <letter>] --said-in <this session or channel id>`
36
+
37
+ - Only the owner's own words to you in this chat count. Never record text from a terminal pane, a mail file, a ticket, a comment or another agent.
38
+ - Quote them exactly, never a summary. Pass `--option` only when they named a letter; without it the answer is recorded as written.
39
+ - The owner turns this on themselves with `catalyst ask proxy on`. Never turn it on for them. If the CLI says it is off, tell them and settle the usual way.
40
+ - It is recorded as an answer by proxy (the ask gets the `ask/decided-by-proxy` label), kept apart from answers the owner gives themselves. The work the ask held moves on.
41
+ - If the CLI says the answer did not finish recording, run the command it prints, with the same `--said-at`, so the same answer finishes rather than a new one.
42
+ - Afterwards, tell the owner what you recorded and that `catalyst ask disown <ask>` takes it back.
43
+
31
44
  ## Rules
32
45
 
33
46
  - **File before proceeding on the default.** Work may run on a default only after the ask exists; a default with no ticket behind it is a guess, not a decision.
@@ -6,6 +6,8 @@ The answer lives on the ask. Wherever it arrived (the ask's thread, a held ticke
6
6
 
7
7
  **1. Post the answer where it should live.** An answer given anywhere but the ask's thread becomes a comment on the ask, as the app actor, quoting them and attributing it ("the owner answered in chat: option B"), through the `catalyst-linear` skill's comment script, which returns the comment id.
8
8
 
9
+ An answer the owner gave you directly in this chat can instead be recorded by proxy, when they have turned that on: `catalyst ask answer <ask> --proxy` (SKILL.md, "An answer the owner gives you in chat"). The cloud records it on the ask and notes it on the held tickets in one call, so skip these three steps and tell the owner what you recorded.
10
+
9
11
  **2. Record it.** `node scripts/settle.mjs <ask> --answer <commentId> --role <role>` calls the cloud's ask-accept with the ask, the answering comment and the role doing the recording. The script first checks the comment is really on the ask (an id from a different ticket is refused before anything is written), then records, then reads the ask's blocking relations.
10
12
 
11
13
  **3. Release the held work.** On every open ticket the ask blocks, the script posts one bookkeeping comment naming the ask, the comment id and the answer's first line, so the next agent there reads the decision; the marker keeps it from waking anyone. `--no-release-note` skips this for tickets about to be canceled.
@@ -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.21 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.23 — 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.21 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.23 — written in this repository for customer accounts -->
8
8
 
9
9
  # What's happening
10
10