replicas-cli 0.3.363 → 0.3.365

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.
Files changed (2) hide show
  1. package/dist/index.cjs +217 -295
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -214,62 +214,7 @@ function getOrganizationMediaPath(organizationId, mediaId) {
214
214
  function getOrganizationMediaUrl(organizationId, mediaId, webAppUrl2 = DEFAULT_WEB_APP_URL) {
215
215
  return `${webAppUrl2}${getOrganizationMediaPath(organizationId, mediaId)}`;
216
216
  }
217
- function parsePrUrl(url2) {
218
- const match = url2.match(PR_URL_REGEX);
219
- if (!match) return null;
220
- const [, owner, repo, numberStr] = match;
221
- const number4 = Number.parseInt(numberStr, 10);
222
- if (!Number.isFinite(number4)) return null;
223
- return { owner, repo, number: number4 };
224
- }
225
- function parseCodeHostPrUrl(url2) {
226
- const github = parsePrUrl(url2);
227
- if (github) {
228
- return {
229
- ...github,
230
- provider: "github",
231
- host: "github.com",
232
- repositoryPath: `${github.owner}/${github.repo}`,
233
- repoUrl: `https://github.com/${github.owner}/${github.repo}`
234
- };
235
- }
236
- let parsed;
237
- try {
238
- parsed = new URL(url2);
239
- } catch {
240
- return null;
241
- }
242
- if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
243
- const segments = parsed.pathname.split("/").filter(Boolean);
244
- const separatorIndex = segments.indexOf("-");
245
- if (separatorIndex <= 0 || segments[separatorIndex + 1] !== "merge_requests") return null;
246
- const number4 = Number.parseInt(segments[separatorIndex + 2] ?? "", 10);
247
- if (!Number.isFinite(number4)) return null;
248
- const repositorySegments = decodePathSegments(segments.slice(0, separatorIndex));
249
- const repo = repositorySegments[repositorySegments.length - 1];
250
- const owner = repositorySegments[0];
251
- if (!owner || !repo) return null;
252
- const repositoryPath = repositorySegments.join("/");
253
- return {
254
- provider: "gitlab",
255
- host: parsed.host.toLowerCase(),
256
- owner,
257
- repo,
258
- number: number4,
259
- repositoryPath,
260
- repoUrl: `${parsed.origin}/${repositoryPath}`
261
- };
262
- }
263
- function decodePathSegments(segments) {
264
- return segments.map((segment) => {
265
- try {
266
- return decodeURIComponent(segment);
267
- } catch {
268
- return segment;
269
- }
270
- });
271
- }
272
- var DEFAULT_WEB_APP_URL, DEFAULT_SUPABASE_URL, DEFAULT_SUPABASE_ANON_KEY, DASHBOARD_PATH, WEB_APP_PATHS, UUID_PATTERN, APP_LINK_PATHS, APP_LINK_PATTERNS, LEGACY_WEB_APP_PATHS, MEMBER_MENTION_PATTERN, PR_URL_REGEX;
217
+ var DEFAULT_WEB_APP_URL, DEFAULT_SUPABASE_URL, DEFAULT_SUPABASE_ANON_KEY, DASHBOARD_PATH, WEB_APP_PATHS, UUID_PATTERN, APP_LINK_PATHS, APP_LINK_PATTERNS, LEGACY_WEB_APP_PATHS, MEMBER_MENTION_PATTERN;
273
218
  var init_urls = __esm({
274
219
  "../shared/src/urls.ts"() {
275
220
  "use strict";
@@ -323,7 +268,6 @@ var init_urls = __esm({
323
268
  dashboardWorkspaces: `${DASHBOARD_PATH}/workspaces`
324
269
  };
325
270
  MEMBER_MENTION_PATTERN = new RegExp(String.raw`\[@((?:[^\]\\\n]|\\.)+)\]\(https?://[^\s/)]+${WEB_APP_PATHS.members}\?user=([0-9a-f-]{36})\)`, "g");
326
- PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
327
271
  }
328
272
  });
329
273
 
@@ -13664,9 +13608,9 @@ function codePointLengthVar(doc, ctx, accessor, inDoubt) {
13664
13608
  doc.write(`const ${v} = typeof ${accessor} === "string" && ${inDoubt} ? ${cpLen}(${accessor}) : ${accessor}.length;`);
13665
13609
  return v;
13666
13610
  }
13667
- function numericOperand(value, label2) {
13611
+ function numericOperand(value, label) {
13668
13612
  if (typeof value !== "number" || !Number.isFinite(value)) {
13669
- throw new ZodCompileUnsupportedError(`${label2} bound of type ${typeof value}`);
13613
+ throw new ZodCompileUnsupportedError(`${label} bound of type ${typeof value}`);
13670
13614
  }
13671
13615
  return `${value}`;
13672
13616
  }
@@ -21623,7 +21567,7 @@ var init_fallback_chains = __esm({
21623
21567
  fallbackHarnessStepSchema
21624
21568
  ]);
21625
21569
  fallbackPlanResponseSchema = external_exports.object({
21626
- steps: external_exports.array(external_exports.unknown()).transform((steps2) => steps2.flatMap((step) => fallbackPlanStepSchema.safeParse(step).data ?? []))
21570
+ steps: external_exports.array(external_exports.unknown()).transform((steps) => steps.flatMap((step) => fallbackPlanStepSchema.safeParse(step).data ?? []))
21627
21571
  });
21628
21572
  }
21629
21573
  });
@@ -23024,7 +22968,7 @@ var init_environment = __esm({
23024
22968
  });
23025
22969
 
23026
22970
  // ../shared/src/replicas-mcp.ts
23027
- var REPLICAS_MCP_TOOLS, automationToolInputSchema, automationCreateToolInputSchema, automationUpdateToolInputSchema, chatPath, provider, model, thinkingLevel, title, message, createChatToolInputSchema, forkChatToolInputSchema, renameChatToolInputSchema, runCommandToolInputSchema, environmentMcpPath, createEnvironmentMcpToolInputSchema, updateEnvironmentMcpToolInputSchema, createEnvironmentDeviceToolInputSchema;
22971
+ var REPLICAS_MCP_TOOLS, automationToolInputSchema, automationBackgroundSchema, automationCreateToolInputSchema, automationUpdateToolInputSchema, chatPath, provider, model, thinkingLevel, title, message, createChatToolInputSchema, forkChatToolInputSchema, renameChatToolInputSchema, runCommandToolInputSchema, environmentMcpPath, createEnvironmentMcpToolInputSchema, updateEnvironmentMcpToolInputSchema, createEnvironmentDeviceToolInputSchema;
23028
22972
  var init_replicas_mcp = __esm({
23029
22973
  "../shared/src/replicas-mcp.ts"() {
23030
22974
  "use strict";
@@ -23068,6 +23012,7 @@ var init_replicas_mcp = __esm({
23068
23012
  waitForSubagents: "wait_for_subagents",
23069
23013
  getBoard: "get_board",
23070
23014
  updateBoard: "update_board",
23015
+ updateTicket: "update_ticket",
23071
23016
  sendToChat: "send_to_chat",
23072
23017
  getLinearRouting: "get_linear_routing",
23073
23018
  setLinearRouting: "set_linear_routing",
@@ -23102,10 +23047,14 @@ var init_replicas_mcp = __esm({
23102
23047
  goal_mode: external_exports.boolean().optional(),
23103
23048
  fast_mode: external_exports.boolean().optional(),
23104
23049
  workspace_lifecycle_policy: external_exports.enum(AUTOMATION_LIFECYCLE_POLICIES).optional().describe(
23105
- "What happens to a run's workspace when the agent finishes. `delete_when_done` (default) when the output lives elsewhere (PR comments, checks, Slack posts); `sleep_when_done` when later runs reuse the workspace, like one per PR across pushes; `default` (keep alive) when people follow up in the workspace."
23050
+ "What happens to a run's workspace when the agent finishes. `delete_when_done` (default, except one-time runs, which default to `default`) when the output lives elsewhere (PR comments, checks, Slack posts); `sleep_when_done` when later runs reuse the workspace, like one per PR across pushes; `default` (keep alive) when people follow up in the workspace."
23106
23051
  )
23107
23052
  });
23053
+ automationBackgroundSchema = external_exports.boolean().optional().describe(
23054
+ "Marks this as an AI agent's own automation (a reminder, follow-up or recurring check-in for its task). Kept out of the main automations list."
23055
+ );
23108
23056
  automationCreateToolInputSchema = automationToolInputSchema.extend({
23057
+ background: automationBackgroundSchema,
23109
23058
  scope: external_exports.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
23110
23059
  });
23111
23060
  automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
@@ -23115,6 +23064,7 @@ var init_replicas_mcp = __esm({
23115
23064
  model: external_exports.string().nullable().optional(),
23116
23065
  thinking_level: external_exports.enum(VALID_THINKING_LEVELS).nullable().optional(),
23117
23066
  workspace_size: external_exports.enum(WORKSPACE_SIZES).optional(),
23067
+ background: automationBackgroundSchema,
23118
23068
  scope: external_exports.literal("org").optional().describe("`org` moves a personal automation to the organization so teammates can see and edit it. It cannot be moved back.")
23119
23069
  });
23120
23070
  chatPath = { id: external_exports.string().describe("Workspace ID"), chat_id: external_exports.string().describe("Chat ID") };
@@ -25440,6 +25390,7 @@ Take action *with* Replicas itself \u2014 manage automations, environments (vari
25440
25390
  **Reference:** \`references/REPLICAS.md\`
25441
25391
 
25442
25392
  Use this when:
25393
+ - The user asks you to start a new workspace or thread for a task \u2014 use \`replicas create\`, not an automation
25443
25394
  - The user asks you to create, edit, run, or delete an automation
25444
25395
  - The user asks you to come back to something later ("check back on this in a week", "remind me tomorrow", "tell me when CI is green") \u2014 schedule a follow-up (see *Follow-ups and reminders*)
25445
25396
  - The user asks you to manage environments, environment variables, or environment files
@@ -25470,11 +25421,13 @@ Workspace identity:
25470
25421
 
25471
25422
  If you get "Not logged in", the workspace is misconfigured \u2014 surface this to the user instead of trying to work around it.
25472
25423
 
25473
- In agent mode the CLI hides commands that don't make sense for in-workspace agents (\`login\`, \`logout\`, \`codex-auth\`, \`claude-auth\`, \`org switch\`, \`config\`, \`interact\`, \`code\`, replica/workspace top-level CRUD). What you have is:
25424
+ In agent mode the CLI hides commands that don't make sense for in-workspace agents (\`login\`, \`logout\`, \`codex-auth\`, \`claude-auth\`, \`org switch\`, \`config\`, \`interact\`, \`code\`). What you have includes:
25474
25425
 
25475
25426
  | Command | What it does |
25476
25427
  | --- | --- |
25477
25428
  | \`replicas whoami\` | Print the workspace + org identity |
25429
+ | \`replicas create <name> -e <env> -a <agent> -m "<prompt>"\` | Start a new workspace with its own agent (see *Starting a new workspace*) |
25430
+ | \`replicas get <id>\` / \`replicas list\` | Check a workspace's status, or find workspaces |
25478
25431
  | \`replicas identity token [--audience <aud>]\` | Print the current short-lived workspace identity token for an audience |
25479
25432
  | \`replicas identity token --format gcp --audience <aud>\` | Supply a current token to Google's executable credential source |
25480
25433
  | \`replicas identity aws-credentials --role-arn <arn> [--region <region>] [--source-identity]\` | Exchange the current token for AWS credential_process JSON (requires AWS CLI); \`--source-identity\` records the workspace ID in CloudTrail and needs \`sts:SetSourceIdentity\` in the role trust policy |
@@ -25498,6 +25451,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
25498
25451
 
25499
25452
  | User says... | Run |
25500
25453
  | --- | --- |
25454
+ | "Spin up a new workspace / thread to work on X" | \`replicas create <name> -e <env> -a <agent> -m "<prompt>"\` |
25501
25455
  | "What environments do I have?" | \`replicas environment list\` |
25502
25456
  | "Add API key X to my staging env" | \`replicas environment vars set <env> <KEY> <VALUE>\` |
25503
25457
  | You need a secret or API key you don't have | \`replicas environment vars request <KEY>... --reason "..."\` (see "Asking the user for variables") |
@@ -25506,6 +25460,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
25506
25460
  | "What automations do I have?" | \`replicas automation list\` |
25507
25461
  | "Run my nightly automation now" | \`replicas automation run <id>\` |
25508
25462
  | "Check back on this in a week" | \`replicas automation create ... --in 1w --background --personal\` |
25463
+ | "Check this daily for a week" | \`replicas automation create ... --trigger-cron "0 9 * * *" --max-runs 7 --workspace current --background --personal\` |
25509
25464
  | "Make an automation that runs every weekday at 9am" | \`replicas automation create\` (interactive) or \`--trigger-cron "0 9 * * 1-5"\` |
25510
25465
  | "Make an automation that runs when a PR opens on \`acme/web\`" | \`replicas automation create ... --trigger-github pull_request.opened --trigger-github-repos acme/web\` |
25511
25466
  | "Make an automation that runs when an MR opens on \`acme/web\`" | \`replicas automation create ... --trigger-gitlab merge_request.opened --trigger-gitlab-repos acme/web\` |
@@ -25579,6 +25534,19 @@ Constraints:
25579
25534
  - \`set\` is upsert (matched by destination path).
25580
25535
  - The display \`--name\` defaults to the basename of the destination path; override only if it would be unclear in the dashboard list.
25581
25536
 
25537
+ ## Starting a new workspace
25538
+
25539
+ When the user asks you to start a task in a new workspace or thread, create it now with \`replicas create\`. Don't use a one-time automation for this; those are for work that should start later.
25540
+
25541
+ \`\`\`bash
25542
+ replicas create fix-login-redirect -e <env-name-or-id> -a claude -m "Fix the login redirect loop on /settings. Open a PR when done."
25543
+ \`\`\`
25544
+
25545
+ - The name can't contain spaces. Pick the environment with \`replicas environment list\`; use this workspace's environment when the task is in the same repos. Use \`-a\` with this conversation's agent unless the user asked for another.
25546
+ - Write \`-m\` as the full task: the new agent can't see this conversation.
25547
+ - On success it prints the workspace ID and a **Link**. Run \`replicas get <id>\` to confirm the workspace exists and is starting, then give the user the link.
25548
+ - If the command fails (it exits non-zero and prints the reason), tell the user the exact error. Never say a workspace was created unless \`replicas get\` found it.
25549
+
25582
25550
  ## Automations
25583
25551
 
25584
25552
  Automations are saved prompts with one or more triggers (cron schedules and/or GitHub or GitLab events). When fired, they create a workspace using the configured environment and run the prompt with the user's coding agent.
@@ -25632,7 +25600,7 @@ replicas automation create ... --lifecycle default --auto-stop-minutes 30
25632
25600
  \`\`\`
25633
25601
 
25634
25602
  Pick the lifecycle by what happens after a run:
25635
- - \`delete_when_done\` (default): the output lives elsewhere and nobody opens the workspace, e.g. a PR "DRY code check" that posts a comment or check.
25603
+ - \`delete_when_done\` (default, except one-time \`--in\`/\`--at\` runs, which default to \`default\`): the output lives elsewhere and nobody opens the workspace, e.g. a PR "DRY code check" that posts a comment or check.
25636
25604
  - \`sleep_when_done\`: later runs reuse the workspace, e.g. one workspace per PR across pushes.
25637
25605
  - \`default\`: people read or follow up in the workspace, e.g. a weekly changelog the team replies to.
25638
25606
 
@@ -25652,7 +25620,7 @@ replicas automation create "Re-check PR #142 CI" \\
25652
25620
  - \`--in <duration>\` (\`30m\`, \`2h\`, \`3d\`, \`1w\`, \`1d12h\`) or \`--at <ISO-8601 with offset>\` (e.g. "tomorrow at 9am" \u2192 \`--at 2026-10-08T09:00:00-07:00\`, using the user's timezone if you know it; otherwise say which timezone you assumed).
25653
25621
  - Inside a workspace, one-time follow-ups default to \`--workspace current\`, so you resume with this conversation's context. Inside a workspace, \`--environment\` defaults to this workspace's environment (same repositories), including for \`--workspace new\` and \`reuse\`.
25654
25622
  - Write \`--prompt\` as instructions to your future self: the links, what to check, what "done" looks like, and how to report back (e.g. reply in the original Slack thread). It runs with no memory of why it was scheduled beyond what you write.
25655
- - \`--background\` keeps follow-ups out of the user's main automations list (they are still visible under **Background**). Use it for every one-time follow-up that reports back into this conversation, even one that leads to a big decision. Omit it only for recurring automations the user wants to see and manage, such as ongoing monitoring.
25623
+ - \`--background\` marks an AI agent's own automation: a reminder, follow-up or recurring check-in for its task. It stays out of the user's main automations list, under **Background**.
25656
25624
  - \`--personal\` makes the automation the user's own. Omit it only when the follow-up belongs to the organization.
25657
25625
  - Recurring with an end: \`--trigger-cron "0 9 * * *" --max-runs 5 --workspace current\` runs daily five times, then deletes itself. \`--workspace reuse\` creates one new workspace on the first run and sends every later run to it; \`--workspace new\` (the default for non-one-time automations) creates a fresh workspace per run.
25658
25626
  - Repeat \`--trigger-cron\` for different times on different days: \`--trigger-cron "0 9 * * 1" --trigger-cron "0 17 * * 5"\` runs Monday at 9 and Friday at 5.
@@ -26360,19 +26328,15 @@ var init_prompts = __esm({
26360
26328
  init_slack_response_style();
26361
26329
  REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
26362
26330
  MOTHERSHIP_INSTRUCTIONS_TAG = "multitask_instructions";
26363
- MOTHERSHIP_EVENT_CHAT_NOTE = `If a message the user typed in this turn is still unanswered, your final reply answers it and they see it. Otherwise they don't see text you write in this turn: if it brings something they asked for, or a blocker that needs them, send it with ${REPLICAS_MCP_TOOLS.sendToChat}; then update the board and end with a one-line note.`;
26331
+ MOTHERSHIP_EVENT_CHAT_NOTE = `If a message the user typed in this turn is still unanswered, your final reply answers it and they see it. Otherwise they don't see text you write in this turn: if it brings something they asked for, or a blocker that needs them, send it with ${REPLICAS_MCP_TOOLS.sendToChat}; then update the board if its order, notes or overview changed, and end with a one-line note.`;
26364
26332
  BOARD_ANSWER_NOTE = "The user answered on the board.";
26365
- BOARD_RULES = `- The board, a live status page you keep with \`${REPLICAS_MCP_TOOLS.updateBoard}\` in the Ships pane beside this chat, is the user's one view of the work: keep it covering every ship, pull request, deploy and blocker. Show ships, pull requests and Linear tickets as ship, pr and linear blocks, which stay current on their own, instead of describing their status. Keep exactly these sections, always in this order, leaving out any that are empty; when you add one, give it the position that keeps this order:
26366
- - Questions (needs_you): only decisions you truly can't make, and blocked ships. Give each your recommendation and a choice. Make routine calls yourself, such as retries, small scope choices or test cleanup, and note them on the ship's row instead of asking.
26367
- - Ready to review (success): one table with columns PR and What it does, even for a single pull request: a pr block and a short line per row. Never a callout per pull request, and never a review in Questions: a merge conflict on a pull request awaiting review is not a question.
26368
- - Working (working): one table with columns Ship and Now: a ship block and a short line per active ship or deploy.
26369
- - Done (done, collapsed): pull requests once deployed, and finished work. Move a row from Working to Done as soon as its deploy or work finishes.
26370
- - On every \`finished\` and \`archived\` event, move that ship's rows out of Working, or remove them, so Working only lists ships that are working.
26371
- - A ship with open pull requests is not done when it sends \`finished\`: Replicas fixes their CI failures and review comments automatically, then sends \`ready\` or \`needs_attention\`. On \`needs_attention\`, direct the ship, or add it to Questions only if you can't decide.
26333
+ BOARD_RULES = `- The board in the Ships pane beside this chat is the user's one view of the work. Each task is a ticket: spawning a ship creates its ticket, with the \`title\` and \`task\` you pass. The ship writes its ticket's summary, screenshots, recordings and questions, and Replicas files tickets under Needs you, Ready to review, Working or Done from the ship and its pull requests. Never restate what a ticket or pull request already shows.
26334
+ - You keep the board organized with \`${REPLICAS_MCP_TOOLS.updateBoard}\`: the order of tickets, most important first; one short note per ticket when it adds something the ticket doesn't say, such as "Merge after #12" or "Waiting on REP-40"; and one overview line at the top on where the work as a whole stands. Archive tickets the user no longer needs. When a ship continues another ship's task, pass that ticket's id as \`ticket\` to \`${REPLICAS_MCP_TOOLS.spawnSubagent}\` instead of making a new one.
26335
+ - Ask the user only for decisions you truly can't make. Make routine calls yourself, such as retries, small scope choices or test cleanup. For a question of your own, create a ticket with it; the user's answer comes to you here, marked "${BOARD_ANSWER_NOTE}". Answers to a ship's questions go straight to that ship.
26336
+ - A ship with open pull requests is not done when it sends \`finished\`: Replicas fixes their CI failures and review comments automatically, then sends \`ready\` or \`needs_attention\`. On \`needs_attention\`, direct the ship, or ask the user only if you can't decide.
26372
26337
  - When a pull request should merge once it's approved and CI passes, call \`${REPLICAS_MCP_TOOLS.mergeWhenReady}\`: Replicas merges it and sends \`merged\`, or \`needs_attention\` saying why it can't. Never watch CI or pull requests with \`gh\`, sleep loops or wait scripts, and merge one yourself only when the user wants it merged right away.
26373
- - On every ship event and every answer the user gives on the board (marked "${BOARD_ANSWER_NOTE}"), act with tools on the answer or on any work the event unblocks, such as starting the next task once a pull request merges, and update the board. The user sees nothing you write in these turns, unless a message they typed is still unanswered because it arrived during the turn: then your final reply answers it, as in any turn they start. Otherwise the only way to reach them is \`${REPLICAS_MCP_TOOLS.sendToChat}\`. Call it only for what they would want right now: a deliverable they asked for, with its media, links or answer (the finished video, the requested numbers); a failure or blocker that needs them, also on the board; or a request of theirs being done. Never for status, such as "PR #12 merged", "deploying", "it's on the board" or "I asked the ship to\u2026": the board and the chat's own rows show those. End the turn with a one-line note of what you did; only the activity log shows it.
26374
- - The chat is like texting an assistant: the user sees only your final reply to each message they type, plus what you send with \`${REPLICAS_MCP_TOOLS.sendToChat}\`, never your tool calls or earlier text. Answer every message they type in chat, even one that arrives during a ship event or board answer, and never only on the board: if they ask something while you handle an event, answer that question, not just the event. Write in a line or two with links, and include any media inline. Anything that needs the user later goes on the board. Never restate the board in chat: no status tables, per-ship lists or summaries of what ships did.
26375
- - When the user picks a choice or clicks a button that messages or merges, Replicas removes that item from the board for you. Add it back, or a new item, only if the user is still needed.
26338
+ - On every ship event and every answer the user gives on the board, act with tools on the answer or on any work the event unblocks, such as starting the next task once a pull request merges, and update the board if its order, notes or overview changed. The user sees nothing you write in these turns, unless a message they typed is still unanswered because it arrived during the turn: then your final reply answers it, as in any turn they start. Otherwise the only way to reach them is \`${REPLICAS_MCP_TOOLS.sendToChat}\`. Call it only for what they would want right now: a deliverable they asked for, with its media, links or answer (the finished video, the requested numbers); a failure or blocker that needs them, also on the board; or a request of theirs being done. Never for status, such as "PR #12 merged", "deploying", "it's on the board" or "I asked the ship to\u2026": the board and the chat's own rows show those. End the turn with a one-line note of what you did; only the activity log shows it.
26339
+ - The chat is like texting an assistant: the user sees only your final reply to each message they type, plus what you send with \`${REPLICAS_MCP_TOOLS.sendToChat}\`, never your tool calls or earlier text. Answer every message they type in chat, even one that arrives during a ship event or board answer, and never only on the board: if they ask something while you handle an event, answer that question, not just the event. Write in a line or two with links, and include any media inline. Never restate the board in chat: no status tables, per-ship lists or summaries of what ships did.
26376
26340
  `;
26377
26341
  MOTHERSHIP_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MOTHERSHIP_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MOTHERSHIP_INSTRUCTIONS_TAG}>`);
26378
26342
  T = REPLICAS_MCP_TOOLS;
@@ -26503,11 +26467,11 @@ function coerceBackgroundTaskPayload(payload) {
26503
26467
  const workflowAgents = Array.isArray(payload.workflow_progress) ? payload.workflow_progress.flatMap((entry) => {
26504
26468
  if (!isRecord(entry) || entry.type !== "workflow_agent") return [];
26505
26469
  const agentId = optionalString(entry.agentId);
26506
- const label2 = optionalString(entry.label);
26507
- if (!agentId || !label2) return [];
26470
+ const label = optionalString(entry.label);
26471
+ if (!agentId || !label) return [];
26508
26472
  return [{
26509
26473
  agentId,
26510
- label: label2,
26474
+ label,
26511
26475
  model: optionalString(entry.model),
26512
26476
  state: optionalString(entry.state),
26513
26477
  promptPreview: optionalString(entry.promptPreview),
@@ -27049,13 +27013,13 @@ var init_utils = __esm({
27049
27013
  });
27050
27014
 
27051
27015
  // ../shared/src/display-message/format.ts
27052
- function fileContentDiff(path10, content, action2) {
27016
+ function fileContentDiff(path10, content, action) {
27053
27017
  const lines = content.replace(/\n$/, "").split("\n");
27054
27018
  return [
27055
- `--- ${action2 === "add" ? "/dev/null" : `a/${path10}`}`,
27056
- `+++ ${action2 === "add" ? `b/${path10}` : "/dev/null"}`,
27057
- action2 === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
27058
- ...lines.map((line) => `${action2 === "add" ? "+" : "-"}${line}`)
27019
+ `--- ${action === "add" ? "/dev/null" : `a/${path10}`}`,
27020
+ `+++ ${action === "add" ? `b/${path10}` : "/dev/null"}`,
27021
+ action === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
27022
+ ...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
27059
27023
  ].join("\n");
27060
27024
  }
27061
27025
  function shellCommands(command) {
@@ -34573,121 +34537,74 @@ var init_workspace_target = __esm({
34573
34537
  });
34574
34538
 
34575
34539
  // ../shared/src/mothership-board.ts
34576
- var MOTHERSHIP_BOARD_TONES, label, tone, blockId, httpsUrl, prUrl, linearIdentifier, action, text3, badge, pr, ship, linear, button, steps, inline, row, blockTypes, blockSchemas, block, MOTHERSHIP_BOARD_CONTAINER_TYPES, mothershipBoardBlocksSchema, mothershipBoardOperationsSchema, mothershipBoardItemRefSchema, LINEAR_ISSUE_SUMMARIES_MAX, linearIssueSummariesRequestSchema;
34540
+ var MOTHERSHIP_TICKET_LIMITS, L, tooLong, text3, clearable, httpsUrl, linearIdentifier, mediaSchema, questionSchema, mothershipTicketTitleSchema, mothershipTicketTaskSchema, mothershipTicketMediaSchema, mothershipTicketQuestionsSchema, updateMothershipTicketRequestSchema, updateMothershipBoardRequestSchema, answerMothershipTicketRequestSchema, mothershipTicketAnswerRefSchema, LINEAR_ISSUE_SUMMARIES_MAX, linearIssueSummariesRequestSchema;
34577
34541
  var init_mothership_board = __esm({
34578
34542
  "../shared/src/mothership-board.ts"() {
34579
34543
  "use strict";
34580
34544
  init_zod();
34581
- init_urls();
34582
- MOTHERSHIP_BOARD_TONES = ["neutral", "needs_you", "warning", "success", "danger", "working", "done"];
34583
- label = (max) => external_exports.string().trim().min(1).max(max);
34584
- tone = external_exports.enum(MOTHERSHIP_BOARD_TONES);
34585
- blockId = external_exports.string().regex(/^[\w.:-]{1,64}$/, "Use 1-64 letters, digits, _, -, . or :");
34545
+ init_mothership();
34546
+ MOTHERSHIP_TICKET_LIMITS = {
34547
+ title: 80,
34548
+ task: 1e3,
34549
+ summary: 600,
34550
+ note: 100,
34551
+ overview: 160,
34552
+ question: 300,
34553
+ option: 60,
34554
+ options: 3,
34555
+ questions: 2,
34556
+ blocked: 200,
34557
+ media: 6,
34558
+ caption: 80,
34559
+ answer: 2e3
34560
+ };
34561
+ L = MOTHERSHIP_TICKET_LIMITS;
34562
+ tooLong = (max) => `At most ${max} characters. Keep it short; the user should take it in at a glance`;
34563
+ text3 = (max) => external_exports.string().trim().min(1).max(max, tooLong(max));
34564
+ clearable = (schema) => external_exports.union([schema, external_exports.literal("")]).optional();
34586
34565
  httpsUrl = external_exports.url({ protocol: /^https$/, error: "Must be an https URL" });
34587
- prUrl = httpsUrl.refine((url2) => parseCodeHostPrUrl(url2) !== null, "Must be a GitHub pull request or GitLab merge request URL");
34588
34566
  linearIdentifier = external_exports.string().regex(/^[A-Za-z][A-Za-z0-9]{0,9}-\d{1,7}$/, "Use a Linear identifier such as REP-123");
34589
- action = external_exports.discriminatedUnion("type", [
34590
- external_exports.object({ type: external_exports.literal("open_ship"), workspace_id: external_exports.uuid() }),
34591
- external_exports.object({ type: external_exports.literal("message_ship"), workspace_id: external_exports.uuid(), message: label(4e3) }),
34592
- external_exports.object({ type: external_exports.literal("open_pr"), url: prUrl }),
34593
- external_exports.object({ type: external_exports.literal("merge_pr"), url: prUrl }),
34594
- external_exports.object({ type: external_exports.literal("message_mothership"), message: label(4e3) }),
34595
- external_exports.object({ type: external_exports.literal("open_link"), url: httpsUrl })
34596
- ]);
34597
- text3 = external_exports.object({ type: external_exports.literal("text"), id: blockId.optional(), text: label(2e3) });
34598
- badge = external_exports.object({ type: external_exports.literal("badge"), id: blockId.optional(), label: label(40), tone: tone.optional() });
34599
- pr = external_exports.object({ type: external_exports.literal("pr"), id: blockId.optional(), url: prUrl });
34600
- ship = external_exports.object({ type: external_exports.literal("ship"), id: blockId.optional(), workspace_id: external_exports.uuid() });
34601
- linear = external_exports.object({ type: external_exports.literal("linear"), id: blockId.optional(), identifier: linearIdentifier });
34602
- button = external_exports.object({ type: external_exports.literal("button"), id: blockId.optional(), label: label(60), action, variant: external_exports.enum(["primary", "outline", "warning", "destructive"]).optional(), resolves: blockId.optional() });
34603
- steps = external_exports.object({
34604
- type: external_exports.literal("steps"),
34605
- id: blockId.optional(),
34606
- steps: external_exports.array(external_exports.object({ label: label(30), state: external_exports.enum(["done", "current", "pending", "failed"]) })).min(1).max(8)
34607
- });
34608
- inline = external_exports.discriminatedUnion("type", [text3, badge, pr, ship, linear, button, steps]);
34609
- row = external_exports.object({ type: external_exports.literal("row"), id: blockId.optional(), cells: external_exports.array(external_exports.union([label(500), inline])).min(1).max(6) });
34610
- blockTypes = {
34611
- text: text3,
34612
- badge,
34613
- pr,
34614
- ship,
34615
- linear,
34616
- button,
34617
- steps,
34618
- stat: external_exports.object({ type: external_exports.literal("stat"), id: blockId.optional(), label: label(40), value: label(40), tone: tone.optional() }),
34619
- divider: external_exports.object({ type: external_exports.literal("divider"), id: blockId.optional() }),
34620
- updated_at: external_exports.object({ type: external_exports.literal("updated_at"), id: blockId.optional() }),
34621
- choice: external_exports.object({
34622
- type: external_exports.literal("choice"),
34623
- id: blockId.optional(),
34624
- question: label(500),
34625
- options: external_exports.array(external_exports.object({ label: label(60), message: label(2e3).optional() })).min(2).max(6),
34626
- allow_custom: external_exports.boolean().optional(),
34627
- resolves: blockId.optional()
34628
- }),
34629
- button_group: external_exports.object({ type: external_exports.literal("button_group"), id: blockId.optional(), children: external_exports.array(button).min(1).max(8) }),
34630
- table: external_exports.object({ type: external_exports.literal("table"), id: blockId.optional(), columns: external_exports.array(label(40)).min(1).max(6), children: external_exports.array(row).max(100) }),
34631
- callout: external_exports.object({
34632
- type: external_exports.literal("callout"),
34633
- id: blockId.optional(),
34634
- tone,
34635
- title: label(120).optional(),
34636
- get children() {
34637
- return external_exports.array(block).max(20).optional();
34638
- }
34639
- }),
34640
- list: external_exports.object({
34641
- type: external_exports.literal("list"),
34642
- id: blockId.optional(),
34643
- ordered: external_exports.boolean().optional(),
34644
- get children() {
34645
- return external_exports.array(block).max(100);
34646
- }
34647
- }),
34648
- section: external_exports.object({
34649
- type: external_exports.literal("section"),
34650
- id: blockId.optional(),
34651
- title: label(120),
34652
- tone: tone.optional(),
34653
- collapsed: external_exports.boolean().optional(),
34654
- get children() {
34655
- return external_exports.array(block).max(100);
34656
- }
34657
- })
34658
- };
34659
- blockSchemas = [text3, ...Object.values(blockTypes).filter((schema) => schema !== text3)];
34660
- block = external_exports.discriminatedUnion("type", blockSchemas);
34661
- MOTHERSHIP_BOARD_CONTAINER_TYPES = Object.entries(blockTypes).filter(([, schema]) => "children" in schema.shape).map(([type]) => type);
34662
- mothershipBoardBlocksSchema = external_exports.array(block).max(100).superRefine((blocks, ctx) => {
34663
- const seen = /* @__PURE__ */ new Set();
34664
- const visit2 = (node2, path10) => {
34665
- if (typeof node2 === "string") return;
34666
- if (node2.id) {
34667
- if (seen.has(node2.id)) ctx.addIssue({ code: "custom", path: [...path10, "id"], message: `Duplicate block id "${node2.id}"` });
34668
- seen.add(node2.id);
34669
- }
34670
- if (node2.type === "table") {
34671
- node2.children.forEach((child, index) => {
34672
- if (child.cells.length > node2.columns.length) ctx.addIssue({ code: "custom", path: [...path10, "children", index, "cells"], message: `Row has ${child.cells.length} cells but the table has ${node2.columns.length} columns` });
34673
- });
34674
- }
34675
- if (node2.type === "row") node2.cells.forEach((cell, index) => visit2(cell, [...path10, "cells", index]));
34676
- else if ("children" in node2) node2.children?.forEach((child, index) => visit2(child, [...path10, "children", index]));
34677
- };
34678
- blocks.forEach((node2, index) => visit2(node2, [index]));
34679
- });
34680
- mothershipBoardOperationsSchema = external_exports.array(external_exports.discriminatedUnion("op", [
34681
- external_exports.object({ op: external_exports.literal("replace"), blocks: external_exports.array(block) }),
34682
- external_exports.object({
34683
- op: external_exports.literal("upsert"),
34684
- block: external_exports.discriminatedUnion("type", [row, ...blockSchemas]).refine((value) => Boolean(value.id), { message: "Give the block an id", path: ["id"] }),
34685
- parent_id: blockId.optional(),
34686
- position: external_exports.number().int().min(0).optional()
34687
- }),
34688
- external_exports.object({ op: external_exports.literal("remove"), id: blockId })
34689
- ])).min(1).max(50);
34690
- mothershipBoardItemRefSchema = external_exports.object({ mothershipId: external_exports.uuid(), block, occurrence: external_exports.number().int().min(0).optional() });
34567
+ mediaSchema = external_exports.object({
34568
+ url: httpsUrl.describe("The URL `replicas media upload` printed."),
34569
+ caption: text3(L.caption).describe('What it shows, such as "After: the list stays pinned".'),
34570
+ kind: external_exports.enum(["image", "video"]).describe("video for recordings, image for screenshots and GIFs.")
34571
+ });
34572
+ questionSchema = external_exports.object({
34573
+ question: text3(L.question).describe("One question, with the context needed to answer it."),
34574
+ options: external_exports.array(text3(L.option)).max(L.options).optional().describe("Up to three answers to pick from, recommended first. The user can always write their own.")
34575
+ });
34576
+ mothershipTicketTitleSchema = text3(L.title);
34577
+ mothershipTicketTaskSchema = text3(L.task);
34578
+ mothershipTicketMediaSchema = external_exports.array(mediaSchema);
34579
+ mothershipTicketQuestionsSchema = external_exports.array(questionSchema.extend({ id: external_exports.string() }));
34580
+ updateMothershipTicketRequestSchema = external_exports.object({
34581
+ summary: text3(L.summary).optional().describe(`What you did and what came of it, in two to four plain sentences a busy reader understands, with pull requests as #number. Markdown: **bold**, *italics*, \`code\` and [links](https://...). At most ${L.summary} characters.`),
34582
+ media: external_exports.array(mediaSchema).max(L.media).optional().describe(`Screenshots and recordings that show the result, uploaded with \`replicas media upload\`, at most ${L.media}. Replaces the ticket's media.`),
34583
+ questions: external_exports.array(questionSchema).max(L.questions).optional().describe(`Questions only the user can answer, at most ${L.questions}. Replaces the open ones; pass [] once they are answered. Their answer comes back to you in this chat.`),
34584
+ blocked: clearable(text3(L.blocked)).describe('Why you cannot go on without the user, such as missing access. "" once unblocked.')
34585
+ });
34586
+ updateMothershipBoardRequestSchema = external_exports.object({
34587
+ overview: clearable(text3(L.overview)).describe(`One line at the top of the board on where the work as a whole stands. "" removes it. At most ${L.overview} characters.`),
34588
+ tickets: external_exports.array(external_exports.object({
34589
+ id: external_exports.uuid(),
34590
+ title: mothershipTicketTitleSchema.optional(),
34591
+ note: clearable(text3(L.note)).describe(`Your one short comment on the ticket, shown under its row, replacing the last. "" removes it. At most ${L.note} characters.`),
34592
+ linear: clearable(linearIdentifier).describe('The Linear issue this ticket is for, such as REP-123. "" removes it.'),
34593
+ archived: external_exports.boolean().optional().describe("Take it off the board.")
34594
+ })).max(50).optional().describe("Changes to existing tickets."),
34595
+ order: external_exports.array(external_exports.uuid()).optional().describe("Ticket ids, most important first. Tickets left out keep their order after these."),
34596
+ create: external_exports.array(external_exports.object({
34597
+ title: mothershipTicketTitleSchema,
34598
+ task: mothershipTicketTaskSchema.optional(),
34599
+ questions: external_exports.array(questionSchema).max(L.questions).optional(),
34600
+ note: text3(L.note).optional()
34601
+ })).max(5).optional().describe("Tickets with no ship, for your own questions to the user or work no ship does. Their answers come to you.")
34602
+ });
34603
+ answerMothershipTicketRequestSchema = external_exports.object({
34604
+ questionId: external_exports.string().min(1),
34605
+ answer: text3(L.answer)
34606
+ });
34607
+ mothershipTicketAnswerRefSchema = external_exports.object({ mothershipId: external_exports.uuid(), ticketId: external_exports.uuid(), questionId: external_exports.string().min(1) });
34691
34608
  LINEAR_ISSUE_SUMMARIES_MAX = 50;
34692
34609
  linearIssueSummariesRequestSchema = external_exports.object({ identifiers: external_exports.array(linearIdentifier).min(1).max(LINEAR_ISSUE_SUMMARIES_MAX) });
34693
34610
  }
@@ -34792,6 +34709,7 @@ var init_steps = __esm({
34792
34709
  [REPLICAS_MCP_TOOLS.clearLinearRouting]: { icon: "trash", live: "Clearing Linear routing", done: "Cleared Linear routing" },
34793
34710
  [REPLICAS_MCP_TOOLS.getBoard]: { icon: "book", live: "Reading board", done: "Read board" },
34794
34711
  [REPLICAS_MCP_TOOLS.updateBoard]: { icon: "file-pen", live: "Updating board", done: "Updated board" },
34712
+ [REPLICAS_MCP_TOOLS.updateTicket]: { icon: "file-pen", live: "Updating ticket", done: "Updated ticket" },
34795
34713
  [REPLICAS_MCP_TOOLS.sendToChat]: { icon: "message", live: "Sending to chat", done: "Sent to chat" },
34796
34714
  [REPLICAS_MCP_TOOLS.mergeWhenReady]: { icon: "target", live: "Setting merge when ready", done: "Set merge when ready" }
34797
34715
  };
@@ -35491,7 +35409,7 @@ var init_codex_parser = __esm({
35491
35409
  // ../shared/src/display-message/parsers/cursor-parser.ts
35492
35410
  function getTextContent(value) {
35493
35411
  if (!Array.isArray(value)) return "";
35494
- return value.map((block2) => isRecord(block2) && block2.type === "text" && typeof block2.text === "string" ? block2.text : "").join("");
35412
+ return value.map((block) => isRecord(block) && block.type === "text" && typeof block.text === "string" ? block.text : "").join("");
35495
35413
  }
35496
35414
  function cursorStatusToDisplayStatus(status) {
35497
35415
  return status === "completed" || status === "FINISHED" ? "completed" : status === "error" || status === "ERROR" || status === "CANCELLED" || status === "EXPIRED" ? "failed" : "in_progress";
@@ -35731,8 +35649,8 @@ var init_errors3 = __esm({
35731
35649
 
35732
35650
  // ../shared/src/display-message/parsers/inference-error.ts
35733
35651
  function formatInferenceError(message2, context = {}) {
35734
- const label2 = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
35735
- const source = label2 ? `${label2}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
35652
+ const label = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
35653
+ const source = label ? `${label}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
35736
35654
  let body = source ? message2 ? `${source}: ${message2}` : `${source}.` : message2;
35737
35655
  const detail = context.detail?.trim();
35738
35656
  if (detail && !body.includes(detail)) {
@@ -35784,6 +35702,11 @@ function assistantError(info) {
35784
35702
  function parseOpencodeEvents(events) {
35785
35703
  const messages = [];
35786
35704
  const inputState = { requests: /* @__PURE__ */ new Map(), resolutions: /* @__PURE__ */ new Map(), requestedAt: /* @__PURE__ */ new Map() };
35705
+ const streamedParts = /* @__PURE__ */ new Map();
35706
+ const upsertStreamedPart = ({ id, type, text: text4, completed, timestamp }) => {
35707
+ if (!text4.trim()) return;
35708
+ upsertDisplayMessage(messages, type === "text" ? { id, type: "agent", content: text4, timestamp } : { id, type: "reasoning", content: text4, status: completed ? "completed" : "in_progress", timestamp });
35709
+ };
35787
35710
  for (const event of events) {
35788
35711
  if (event.type === "event_msg" && event.payload.type === "user_message") {
35789
35712
  const message2 = event.payload.message;
@@ -35799,10 +35722,11 @@ function parseOpencodeEvents(events) {
35799
35722
  continue;
35800
35723
  }
35801
35724
  if (event.type === "opencode-message.updated") {
35802
- const error62 = assistantError(event.payload.info);
35725
+ const { info } = event.payload;
35726
+ const error62 = assistantError(info);
35803
35727
  if (error62) {
35804
- messages.push({
35805
- id: `opencode-${event.type}-${event.timestamp}`,
35728
+ upsertDisplayMessage(messages, {
35729
+ id: isRecord(info) && typeof info.id === "string" ? `opencode-error-${info.id}` : `opencode-${event.type}-${event.timestamp}`,
35806
35730
  type: "error",
35807
35731
  message: error62,
35808
35732
  timestamp: event.timestamp
@@ -35810,6 +35734,15 @@ function parseOpencodeEvents(events) {
35810
35734
  }
35811
35735
  continue;
35812
35736
  }
35737
+ if (event.type === "opencode-message.part.delta") {
35738
+ const { partID, field: field2, delta } = event.payload;
35739
+ const streamed = typeof partID === "string" ? streamedParts.get(partID) : void 0;
35740
+ if (streamed && field2 === "text" && typeof delta === "string") {
35741
+ streamed.text += delta;
35742
+ upsertStreamedPart(streamed);
35743
+ }
35744
+ continue;
35745
+ }
35813
35746
  if (event.type === "opencode-error") {
35814
35747
  const message2 = typeof event.payload.message === "string" ? event.payload.message : "Opencode run failed";
35815
35748
  messages.push({
@@ -35846,29 +35779,16 @@ function parseOpencodeEvents(events) {
35846
35779
  else if (typeof part.id === "string") id = `opencode-${part.id}`;
35847
35780
  const time3 = isRecord(part.time) ? part.time : null;
35848
35781
  const timestamp = timestampFromMs(time3?.start, event.timestamp);
35849
- if (part.type === "text") {
35850
- const text4 = typeof part.text === "string" ? part.text : "";
35851
- if (text4.trim()) {
35852
- upsertDisplayMessage(messages, {
35853
- id,
35854
- type: "agent",
35855
- content: text4,
35856
- timestamp
35857
- });
35858
- }
35859
- continue;
35860
- }
35861
- if (part.type === "reasoning") {
35862
- const text4 = typeof part.text === "string" ? part.text : "";
35863
- if (text4.trim()) {
35864
- upsertDisplayMessage(messages, {
35865
- id,
35866
- type: "reasoning",
35867
- content: text4,
35868
- status: time3?.end ? "completed" : "in_progress",
35869
- timestamp
35870
- });
35871
- }
35782
+ if ((part.type === "text" || part.type === "reasoning") && typeof part.id === "string") {
35783
+ const streamed = {
35784
+ id,
35785
+ type: part.type,
35786
+ text: typeof part.text === "string" ? part.text : "",
35787
+ completed: Boolean(time3?.end),
35788
+ timestamp
35789
+ };
35790
+ streamedParts.set(part.id, streamed);
35791
+ upsertStreamedPart(streamed);
35872
35792
  continue;
35873
35793
  }
35874
35794
  if (part.type === "tool" && isRecord(part.state)) {
@@ -36153,7 +36073,7 @@ function normalizeContentBlocks(content) {
36153
36073
  if (typeof content === "string") {
36154
36074
  return content ? [{ type: "text", text: content }] : [];
36155
36075
  }
36156
- return Array.isArray(content) ? content.filter((block2) => isRecord(block2) && typeof block2.type === "string") : [];
36076
+ return Array.isArray(content) ? content.filter((block) => isRecord(block) && typeof block.type === "string") : [];
36157
36077
  }
36158
36078
  function parseStringField(value) {
36159
36079
  if (typeof value !== "string") return null;
@@ -36242,13 +36162,13 @@ var init_task_accumulator = __esm({
36242
36162
  }
36243
36163
  return out;
36244
36164
  }
36245
- processContentBlock(block2) {
36246
- if (!isRecord(block2)) return false;
36247
- if (block2.type === "tool_use" && typeof block2.name === "string" && typeof block2.id === "string") {
36248
- return this.processToolUse(block2.name, block2.id, toAccumulatorInput(block2.input));
36165
+ processContentBlock(block) {
36166
+ if (!isRecord(block)) return false;
36167
+ if (block.type === "tool_use" && typeof block.name === "string" && typeof block.id === "string") {
36168
+ return this.processToolUse(block.name, block.id, toAccumulatorInput(block.input));
36249
36169
  }
36250
- if (block2.type === "tool_result" && typeof block2.tool_use_id === "string") {
36251
- return this.processCreateResult(block2.tool_use_id, block2.content);
36170
+ if (block.type === "tool_result" && typeof block.tool_use_id === "string") {
36171
+ return this.processCreateResult(block.tool_use_id, block.content);
36252
36172
  }
36253
36173
  return false;
36254
36174
  }
@@ -36257,12 +36177,12 @@ var init_task_accumulator = __esm({
36257
36177
  });
36258
36178
 
36259
36179
  // ../shared/src/display-message/parsers/claude-parser.ts
36260
- function fileOrCommandMessage(block2, timestamp) {
36261
- let template = toolMessageTemplates.get(block2);
36180
+ function fileOrCommandMessage(block, timestamp) {
36181
+ let template = toolMessageTemplates.get(block);
36262
36182
  if (!template) {
36263
- const input2 = typeof block2.input === "string" ? safeJsonParse(block2.input, {}) : block2.input ?? {};
36264
- template = toolMessageTemplate(block2.name ?? "", block2.id ?? "", input2);
36265
- toolMessageTemplates.set(block2, template);
36183
+ const input2 = typeof block.input === "string" ? safeJsonParse(block.input, {}) : block.input ?? {};
36184
+ template = toolMessageTemplate(block.name ?? "", block.id ?? "", input2);
36185
+ toolMessageTemplates.set(block, template);
36266
36186
  }
36267
36187
  return { ...template, timestamp };
36268
36188
  }
@@ -36589,13 +36509,13 @@ function parseClaudeEvents(events, parentToolUseId) {
36589
36509
  if (liveStreamId !== null && liveStreamId !== messageId) {
36590
36510
  supersededStreamIds.add(liveStreamId);
36591
36511
  }
36592
- if (contentBlocks.some((block2) => block2.type === "text" && block2.text)) {
36512
+ if (contentBlocks.some((block) => block.type === "text" && block.text)) {
36593
36513
  completedStreamIds.add(messageId);
36594
36514
  liveStreamId = null;
36595
36515
  }
36596
36516
  }
36597
36517
  const thinkingBlocks = contentBlocks.flatMap(
36598
- (block2) => block2.type === "thinking" && typeof block2.thinking === "string" ? [block2.thinking] : []
36518
+ (block) => block.type === "thinking" && typeof block.thinking === "string" ? [block.thinking] : []
36599
36519
  );
36600
36520
  if (thinkingBlocks.length > 0) {
36601
36521
  const allThinking = [...assistantThinking.get(messageKey) ?? [], ...thinkingBlocks];
@@ -36614,14 +36534,14 @@ function parseClaudeEvents(events, parentToolUseId) {
36614
36534
  upsertMessage(reasoningMessage);
36615
36535
  }
36616
36536
  }
36617
- contentBlocks.forEach((block2) => {
36618
- if (block2.type === "text" && block2.text) {
36537
+ contentBlocks.forEach((block) => {
36538
+ if (block.type === "text" && block.text) {
36619
36539
  const textIndex = assistantTextCounts.get(messageKey) ?? 0;
36620
36540
  assistantTextCounts.set(messageKey, textIndex + 1);
36621
36541
  const agentMessage = {
36622
36542
  id: `agent-${messageKey}-${textIndex}`,
36623
36543
  type: "agent",
36624
- content: block2.text,
36544
+ content: block.text,
36625
36545
  timestamp: event.timestamp
36626
36546
  };
36627
36547
  if (streamRefs?.agent !== void 0) {
@@ -36631,10 +36551,10 @@ function parseClaudeEvents(events, parentToolUseId) {
36631
36551
  upsertMessage(agentMessage);
36632
36552
  }
36633
36553
  }
36634
- if (block2.type === "tool_use" && block2.id) {
36635
- const toolName = block2.name || "unknown";
36636
- const toolInput = block2.input || {};
36637
- const toolUseId = block2.id;
36554
+ if (block.type === "tool_use" && block.id) {
36555
+ const toolName = block.name || "unknown";
36556
+ const toolInput = block.input || {};
36557
+ const toolUseId = block.id;
36638
36558
  toolCallMap.set(toolUseId, {
36639
36559
  messageIndex: messages.length,
36640
36560
  toolName,
@@ -36653,9 +36573,9 @@ function parseClaudeEvents(events, parentToolUseId) {
36653
36573
  nestedEvents
36654
36574
  }));
36655
36575
  } else if (COMMAND_TOOL_NAMES.has(toolName) || FILE_TOOL_NAMES.has(toolName)) {
36656
- messages.push(fileOrCommandMessage(block2, event.timestamp));
36576
+ messages.push(fileOrCommandMessage(block, event.timestamp));
36657
36577
  } else if (toolName === "TaskCreate" || toolName === "TaskUpdate" || toolName === "TaskList") {
36658
- taskAccumulator.processContentBlock(block2);
36578
+ taskAccumulator.processContentBlock(block);
36659
36579
  const snapshot = taskSnapshot();
36660
36580
  if (snapshot.length > 0) {
36661
36581
  messages.push({
@@ -37766,7 +37686,7 @@ var CLI_VERSION;
37766
37686
  var init_cli_version = __esm({
37767
37687
  "../shared/src/cli-version.ts"() {
37768
37688
  "use strict";
37769
- CLI_VERSION = "0.3.363";
37689
+ CLI_VERSION = "0.3.365";
37770
37690
  }
37771
37691
  });
37772
37692
 
@@ -38667,6 +38587,7 @@ var init_workspace_events = __esm({
38667
38587
  subagent: external_exports.object({ id: external_exports.string(), name: external_exports.string(), prUrl: external_exports.string().nullable() }),
38668
38588
  ts: external_exports.string()
38669
38589
  }),
38590
+ external_exports.object({ type: external_exports.literal("mothership.board.changed"), workspaceId: external_exports.string(), ts: external_exports.string() }),
38670
38591
  external_exports.object({ type: external_exports.literal("needs-you.changed"), workspaceId: external_exports.string().nullable(), userId: external_exports.string().optional(), ts: external_exports.string() }),
38671
38592
  external_exports.object({
38672
38593
  type: external_exports.literal("workspace.shared"),
@@ -47394,8 +47315,8 @@ var require_CronExpression = __commonJS({
47394
47315
  return false;
47395
47316
  }
47396
47317
  if (__privateMethod(this, _CronExpression_instances, checkDstTransition_fn).call(this, currentDate)) {
47397
- const steps2 = reverse ? currentHour - nextHour : nextHour - currentHour;
47398
- for (let i = 0; i < steps2; i++) {
47318
+ const steps = reverse ? currentHour - nextHour : nextHour - currentHour;
47319
+ for (let i = 0; i < steps; i++) {
47399
47320
  currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Hour, hours.length);
47400
47321
  if (!reverse && currentDate.getHours() >= nextHour)
47401
47322
  break;
@@ -47886,8 +47807,8 @@ var require_CronFileParser = __commonJS({
47886
47807
  expressions: [],
47887
47808
  errors: {}
47888
47809
  };
47889
- for (const block2 of blocks) {
47890
- const entry = block2.trim();
47810
+ for (const block of blocks) {
47811
+ const entry = block.trim();
47891
47812
  if (entry.length === 0 || entry.startsWith("#")) {
47892
47813
  continue;
47893
47814
  }
@@ -49461,8 +49382,8 @@ var init_api2 = __esm({
49461
49382
  });
49462
49383
 
49463
49384
  // src/lib/oauth-flow-ui.ts
49464
- function field(label2, value) {
49465
- console.log(` ${import_chalk2.default.gray(label2.padEnd(LABEL_WIDTH))}${value}`);
49385
+ function field(label, value) {
49386
+ console.log(` ${import_chalk2.default.gray(label.padEnd(LABEL_WIDTH))}${value}`);
49466
49387
  }
49467
49388
  function appliesTo(target) {
49468
49389
  if (!target.isUserScoped) return "Organization Settings";
@@ -51066,8 +50987,8 @@ async function claudeAuthCommand(options = {}) {
51066
50987
  oauthSteps: 2,
51067
50988
  orgEndpoint: "/v1/claude/credentials",
51068
50989
  userEndpoint: "/v1/claude/user/credentials",
51069
- runOAuth: async (steps2, save) => {
51070
- await openForApproval("Replicas", await save(await runClaudeOAuthFlow(steps2)));
50990
+ runOAuth: async (steps, save) => {
50991
+ await openForApproval("Replicas", await save(await runClaudeOAuthFlow(steps)));
51071
50992
  },
51072
50993
  toRequestBody: (tokens) => ({
51073
50994
  access_token: tokens.accessToken,
@@ -51177,8 +51098,8 @@ async function museAuthCommand(options = {}) {
51177
51098
  oauthSteps: 1,
51178
51099
  orgEndpoint: "/v1/muse/credentials",
51179
51100
  userEndpoint: "/v1/muse/user/credentials",
51180
- runOAuth: async (steps2, save) => {
51181
- await openForApproval("Replicas", await save(await runMuseOAuthFlow(steps2)));
51101
+ runOAuth: async (steps, save) => {
51102
+ await openForApproval("Replicas", await save(await runMuseOAuthFlow(steps)));
51182
51103
  },
51183
51104
  toRequestBody: (tokens) => ({ access_token: tokens.accessToken })
51184
51105
  });
@@ -51345,8 +51266,8 @@ async function credentialsUsageCommand({ org: org2, user }) {
51345
51266
  `${Math.round(window.usedPercent)}%`,
51346
51267
  window.resetsAt && import_chalk17.default.gray(`(resets ${formatDate(window.resetsAt)})`)
51347
51268
  ].filter(Boolean).join(" ")).join(", ");
51348
- const label2 = [account.email ?? account.credentialId, account.planType].filter(Boolean).join(" ");
51349
- console.log(`${account.provider} ${scopeLabel({ org: account.scope === "org" })} ${label2} ${limits}`);
51269
+ const label = [account.email ?? account.credentialId, account.planType].filter(Boolean).join(" ");
51270
+ console.log(`${account.provider} ${scopeLabel({ org: account.scope === "org" })} ${label} ${limits}`);
51350
51271
  if (account.exhaustedUntil) console.log(import_chalk17.default.gray(` Workspaces skip this account until ${formatDate(account.exhaustedUntil)}`));
51351
51272
  }
51352
51273
  });
@@ -51965,15 +51886,15 @@ async function envHookTestCommand(envIdOrName, options, kind) {
51965
51886
  }
51966
51887
  );
51967
51888
  if (errorMessage) throw new Error(errorMessage);
51968
- const label2 = kind === "warm" ? "Warm" : "Start";
51889
+ const label = kind === "warm" ? "Warm" : "Start";
51969
51890
  const passed = !timedOut && exitCode === 0;
51970
51891
  output2({ passed, exit_code: exitCode, timed_out: timedOut, saved: passed && !!options.save, output: logs }, () => {
51971
51892
  if (passed) console.log(import_chalk20.default.green(`
51972
- ${label2} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
51893
+ ${label} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
51973
51894
  `));
51974
51895
  });
51975
- if (timedOut) throw new Error(`${label2} hook timed out.`);
51976
- if (!passed) throw new Error(`${label2} hook failed (exit code ${exitCode ?? "unknown"}).`);
51896
+ if (timedOut) throw new Error(`${label} hook timed out.`);
51897
+ if (!passed) throw new Error(`${label} hook failed (exit code ${exitCode ?? "unknown"}).`);
51977
51898
  }
51978
51899
  async function envHookRepositoryHooksCommand(envIdOrName, kind) {
51979
51900
  ensureOrgApiAuthenticated();
@@ -52318,8 +52239,8 @@ Replicas (Page ${response2.page} of ${response2.total_pages}, Total: ${response2
52318
52239
  console.log(import_chalk21.default.gray(` Created: ${formatDate(replica.created_at)}`));
52319
52240
  if (replica.pull_requests && replica.pull_requests.length > 0) {
52320
52241
  console.log(import_chalk21.default.gray(` Pull Requests:`));
52321
- for (const pr3 of replica.pull_requests) {
52322
- console.log(import_chalk21.default.cyan(` - ${pr3.repository} #${pr3.number}: ${pr3.url}`));
52242
+ for (const pr2 of replica.pull_requests) {
52243
+ console.log(import_chalk21.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
52323
52244
  }
52324
52245
  }
52325
52246
  console.log();
@@ -52352,8 +52273,8 @@ Replica: ${replica.name}
52352
52273
  }
52353
52274
  if (replica.pull_requests && replica.pull_requests.length > 0) {
52354
52275
  console.log(import_chalk21.default.gray(` Pull Requests:`));
52355
- for (const pr3 of replica.pull_requests) {
52356
- console.log(import_chalk21.default.cyan(` - ${pr3.repository} #${pr3.number}: ${pr3.url}`));
52276
+ for (const pr2 of replica.pull_requests) {
52277
+ console.log(import_chalk21.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
52357
52278
  }
52358
52279
  }
52359
52280
  console.log();
@@ -52458,6 +52379,7 @@ Created replica: ${replica.name}`));
52458
52379
  if (replica.repositories.length > 0) {
52459
52380
  console.log(import_chalk21.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
52460
52381
  }
52382
+ console.log(import_chalk21.default.cyan(` Link: ${getWorkspaceDashboardUrl(replica.id, { webAppUrl: process.env.REPLICAS_WEB_URL || DEFAULT_WEB_APP_URL })}`));
52461
52383
  console.log();
52462
52384
  });
52463
52385
  }
@@ -52587,10 +52509,10 @@ async function workspaceWakeCommand(id, options) {
52587
52509
  await orgAuthenticatedFetch(`/v1/replica/${id}/wake${options.restore ? "?restore=true" : ""}`, { method: "POST" });
52588
52510
  outputSuccess(`Waking workspace ${id}. Check progress with: replicas status ${id}`);
52589
52511
  }
52590
- function workspaceLifecycleCommand(action2) {
52512
+ function workspaceLifecycleCommand(action) {
52591
52513
  return async (id) => {
52592
- await orgAuthenticatedFetch(`/v1/replica/${id}/${action2}`, { method: "POST" });
52593
- outputSuccess(`Workspace ${id} ${action2 === "sleep" ? "is going to sleep" : "archived"}.`);
52514
+ await orgAuthenticatedFetch(`/v1/replica/${id}/${action}`, { method: "POST" });
52515
+ outputSuccess(`Workspace ${id} ${action === "sleep" ? "is going to sleep" : "archived"}.`);
52594
52516
  };
52595
52517
  }
52596
52518
  async function workspaceWaitCommand(id, options) {
@@ -52711,7 +52633,7 @@ async function shareRemoveCommand(id, userId) {
52711
52633
  outputSuccess(`Stopped sharing workspace ${id} with ${userId}`);
52712
52634
  }
52713
52635
  async function prViewCommand(id, prUrls) {
52714
- const urls = prUrls.length > 0 ? prUrls : (await orgAuthenticatedFetch(`/v1/replica/${id}`)).replica.pull_requests?.map((pr3) => pr3.url) ?? [];
52636
+ const urls = prUrls.length > 0 ? prUrls : (await orgAuthenticatedFetch(`/v1/replica/${id}`)).replica.pull_requests?.map((pr2) => pr2.url) ?? [];
52715
52637
  if (urls.length === 0) {
52716
52638
  output2({ pullRequests: [] }, () => console.log("No pull requests linked to this workspace."));
52717
52639
  return;
@@ -52735,15 +52657,15 @@ ${url2}`));
52735
52657
  }
52736
52658
  });
52737
52659
  }
52738
- async function prMergeCommand(id, prUrl2) {
52739
- const { queued } = await orgAuthenticatedFetch(`/v1/replica/${id}/pull-requests/merge`, { method: "POST", body: { prUrl: prUrl2 } });
52740
- outputSuccess(`${queued ? "Added to the merge queue:" : "Merged"} ${prUrl2}`);
52660
+ async function prMergeCommand(id, prUrl) {
52661
+ const { queued } = await orgAuthenticatedFetch(`/v1/replica/${id}/pull-requests/merge`, { method: "POST", body: { prUrl } });
52662
+ outputSuccess(`${queued ? "Added to the merge queue:" : "Merged"} ${prUrl}`);
52741
52663
  }
52742
- function prUpdateCommand(action2) {
52743
- return async (id, prUrl2) => {
52744
- const body = { prUrl: prUrl2, action: action2 };
52664
+ function prUpdateCommand(action) {
52665
+ return async (id, prUrl) => {
52666
+ const body = { prUrl, action };
52745
52667
  await orgAuthenticatedFetch(`/v1/replica/${id}/pull-requests/update`, { method: "POST", body });
52746
- outputSuccess(`${prUrl2}: ${action2.replaceAll("_", " ")} done`);
52668
+ outputSuccess(`${prUrl}: ${action.replaceAll("_", " ")} done`);
52747
52669
  };
52748
52670
  }
52749
52671
  async function canvasListCommand(id) {
@@ -52891,7 +52813,7 @@ var init_chat = __esm({
52891
52813
  chatQueueRemoveCommand = (id, chatId, messageId) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "DELETE");
52892
52814
  chatQueueEditCommand = (id, chatId, messageId, message2) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "PATCH", { message: message2 });
52893
52815
  chatQueueMoveCommand = (id, chatId, messageId, position) => mutateQueue(chatPath2(id, chatId, "/queue/reorder"), "PATCH", { messageId, position: Number(position) });
52894
- chatQueueActionCommand = (action2) => (id, chatId, messageId) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}/${action2}`), "POST");
52816
+ chatQueueActionCommand = (action) => (id, chatId, messageId) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}/${action}`), "POST");
52895
52817
  }
52896
52818
  });
52897
52819
 
@@ -52984,11 +52906,11 @@ async function environmentSetupStepCommand(key, status) {
52984
52906
  \u2713 ${key} \u2192 ${status}
52985
52907
  `)));
52986
52908
  }
52987
- function readJsonFile(file2, label2) {
52909
+ function readJsonFile(file2, label) {
52988
52910
  try {
52989
52911
  return JSON.parse(import_fs6.default.readFileSync(file2, "utf8"));
52990
52912
  } catch (error62) {
52991
- throw new Error(`Could not read ${label2} JSON from ${file2}: ${error62 instanceof Error ? error62.message : String(error62)}`);
52913
+ throw new Error(`Could not read ${label} JSON from ${file2}: ${error62 instanceof Error ? error62.message : String(error62)}`);
52992
52914
  }
52993
52915
  }
52994
52916
  async function environmentSetupProposeCommand(options) {
@@ -55431,17 +55353,17 @@ function registerSlackCommands(parent) {
55431
55353
  slackThread.command("switch <workspace>").description("Point the current Slack thread at another workspace ID or name").option("-c, --channel <channelId>", "Slack channel ID (defaults to REPLICAS_SLACK_CHANNEL_ID)").option("-t, --thread-ts <threadTs>", "Slack thread timestamp (defaults to REPLICAS_SLACK_THREAD_TS)").action(run(slackThreadSwitchCommand));
55432
55354
  }
55433
55355
  function registerEnvironmentHookCommands(parent, config3) {
55434
- const label2 = `${config3.kind} hook`;
55356
+ const label = `${config3.kind} hook`;
55435
55357
  const hooks = parent.command(`${config3.kind}-hooks`).description(config3.kind === "warm" ? "Manage env-level warm hooks (run while pre-warming workspaces)" : "Manage env-level start hooks (run on every workspace boot, before repo-level start hooks)");
55436
- hooks.command("get <env>").description(`Show the active ${label2} for an environment`).action(run(config3.get));
55437
- hooks.command("save <env>").description(`Save and activate a ${label2}${config3.kind === "warm" ? " without testing it" : ""}`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action(run(config3.save));
55438
- hooks.command("test <env>").description(`Run a ${label2} in an isolated sandbox without saving it`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action(run(config3.test));
55358
+ hooks.command("get <env>").description(`Show the active ${label} for an environment`).action(run(config3.get));
55359
+ hooks.command("save <env>").description(`Save and activate a ${label}${config3.kind === "warm" ? " without testing it" : ""}`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action(run(config3.save));
55360
+ hooks.command("test <env>").description(`Run a ${label} in an isolated sandbox without saving it`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action(run(config3.test));
55439
55361
  if (config3.saveTest) {
55440
- hooks.command("save-test <env>").description(`Test a ${label2} and save it only if the test passes`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action(run(config3.saveTest));
55362
+ hooks.command("save-test <env>").description(`Test a ${label} and save it only if the test passes`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action(run(config3.saveTest));
55441
55363
  }
55442
55364
  hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
55443
55365
  }
55444
- var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, org, config2, chat, chatQueue, share, pr2, canvas, credentials, automation, repos, plugins, skills, media, environment, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
55366
+ var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
55445
55367
  var init_src2 = __esm({
55446
55368
  "src/index.ts"() {
55447
55369
  "use strict";
@@ -55586,13 +55508,13 @@ var init_src2 = __esm({
55586
55508
  share.command("list <id>").description("List members a replica is shared with").action(run(shareListCommand));
55587
55509
  share.command("add <id> <userId>").description("Share a replica with a member").action(run(shareAddCommand));
55588
55510
  share.command("remove <id> <userId>").description("Stop sharing a replica with a member").action(run(shareRemoveCommand));
55589
- pr2 = program.command("pr").description("Inspect and act on pull requests linked to a replica");
55590
- pr2.command("view <id> [prUrls...]").description("Show state, CI, and mergeability (defaults to every linked pull request)").action(run(prViewCommand));
55591
- pr2.command("merge <id> <prUrl>").description("Merge a pull request").action(run(prMergeCommand));
55592
- pr2.command("approve <id> <prUrl>").description("Approve a pull request").action(run(prUpdateCommand("approve")));
55593
- pr2.command("close <id> <prUrl>").description("Close a pull request").action(run(prUpdateCommand("close")));
55594
- pr2.command("draft <id> <prUrl>").description("Convert a pull request to a draft").action(run(prUpdateCommand("convert_to_draft")));
55595
- pr2.command("ready <id> <prUrl>").description("Mark a draft pull request ready for review").action(run(prUpdateCommand("mark_ready_for_review")));
55511
+ pr = program.command("pr").description("Inspect and act on pull requests linked to a replica");
55512
+ pr.command("view <id> [prUrls...]").description("Show state, CI, and mergeability (defaults to every linked pull request)").action(run(prViewCommand));
55513
+ pr.command("merge <id> <prUrl>").description("Merge a pull request").action(run(prMergeCommand));
55514
+ pr.command("approve <id> <prUrl>").description("Approve a pull request").action(run(prUpdateCommand("approve")));
55515
+ pr.command("close <id> <prUrl>").description("Close a pull request").action(run(prUpdateCommand("close")));
55516
+ pr.command("draft <id> <prUrl>").description("Convert a pull request to a draft").action(run(prUpdateCommand("convert_to_draft")));
55517
+ pr.command("ready <id> <prUrl>").description("Mark a draft pull request ready for review").action(run(prUpdateCommand("mark_ready_for_review")));
55596
55518
  canvas = program.command("canvas").description("Read and edit files in a replica Canvas");
55597
55519
  canvas.command("list <id>").description("List Canvas files").action(run(canvasListCommand));
55598
55520
  canvas.command("get <id> <filename>").description("Print a Canvas text file").action(run(canvasGetCommand));
@@ -55606,8 +55528,8 @@ var init_src2 = __esm({
55606
55528
  automation = program.command("automation").alias("auto").description("Manage automations");
55607
55529
  automation.command("list").description("List all automations").option("-p, --page <page>", "Page number").option("-l, --limit <limit>", "Number of items per page").option("--owner <owner>", "Ownership filter: org, user, all").option("--trigger-type <type>", "Only automations with a trigger of this type (cron, github, gitlab, slack, sentry, linear, custom)").option("--enabled <enabled>", "Only enabled or disabled automations (true/false)").option("--search <search>", "Case-insensitive substring match on the name").option("--background <background>", "Only background (true) or main-list (false) automations").action(run(automationListCommand));
55608
55530
  automation.command("get <id>").description("Get automation details by ID").action(run(automationGetCommand));
55609
- automation.command("create [name]").description("Create a new automation").option("-p, --prompt <prompt>", "Prompt for the automation").option("-d, --description <description>", "Description shown with the automation").option("-e, --environment <environment>", "Environment name or ID").option("--size <size>", "Size of workspaces runs create (not a reused existing one): small (default), large, ultra").option("--trigger-cron <schedule>", 'Cron schedule expression, e.g. "0 9 * * 1-5" (repeatable)', collect, []).option("--trigger-cron-timezone <timezone>", "Timezone for cron schedules (default: UTC)").option("--trigger-github <event>", 'GitHub event, e.g. "pull_request.opened" (repeatable)', collect, []).option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-github-reviewers <users>", "Comma-separated GitHub usernames to fire for (required with pull_request.review_requested)").option("--trigger-gitlab <event>", 'GitLab event, e.g. "merge_request.opened" (repeatable)', collect, []).option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--github-checks <names>", "Comma-separated GitHub check names to create on matching PRs (requires a PR opened/updated trigger)").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done (default for new automations), sleep_when_done, archive_when_done, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode", "Run automation messages in plan mode").option("--goal-mode", "Set automation messages as goals").option("--fast-mode", "Run automation messages in fast mode").option("--personal", "Create a personal automation owned by the authenticated user").option("--in <duration>", "Run once after this long, e.g. 30m, 2h, 3d, 1w (inside a workspace, defaults --workspace to current)").option("--at <datetime>", "Run once at this ISO-8601 time with timezone, e.g. 2026-10-08T09:00:00-07:00").option("--max-runs <n>", 'Delete the automation after this many runs ("none" for unlimited)').option("--workspace <target>", "Where runs go: new (default, new workspace each run), reuse (one workspace created on the first run), current (this workspace), or a workspace ID").option("--background", "Keep it out of the main automations list (for offhand follow-ups)").option("--disabled", "Create in disabled state").action(run((name, options) => automationCreateCommand(name, { ...options, enabled: !options.disabled })));
55610
- automation.command("edit <id>").description("Edit an existing automation").option("-n, --name <name>", "New name").option("-p, --prompt <prompt>", "New prompt").option("-d, --description <description>", "New description (pass empty string to clear)").option("--size <size>", "Size of workspaces runs create (not a reused existing one): small, large, ultra").option("--enabled <enabled>", "Enable or disable (true/false)").option("--trigger-cron <schedule>", "Set cron schedule (repeatable; replaces existing triggers unless --keep-triggers)", collect, []).option("--trigger-cron-timezone <timezone>", "Timezone for cron schedules").option("--trigger-github <event>", "Set GitHub event (repeatable; replaces existing triggers unless --keep-triggers)", collect, []).option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-github-reviewers <users>", "Comma-separated GitHub usernames to fire for (required with pull_request.review_requested)").option("--trigger-gitlab <event>", "Set GitLab event (repeatable; replaces existing triggers unless --keep-triggers)", collect, []).option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--keep-triggers", "Add the --trigger-cron, --trigger-github, --trigger-gitlab, --in or --at triggers to the existing ones instead of replacing them").option("--github-checks <names>", "Comma-separated GitHub check names to create on matching PRs (replaces the current list; pass empty string to remove them)").option("--add-github-checks <names>", "Comma-separated GitHub check names to add, keeping the ones already configured").option("--environment <environment>", "Environment name or ID").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done (default for new automations), sleep_when_done, archive_when_done, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default)").option("--pr-followups <enabled>", "Allow follow-up actions on matching PRs (true/false)", parseBooleanOption).option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode <enabled>", "Run automation messages in plan mode (true/false)", parseBooleanOption).option("--goal-mode <enabled>", "Set automation messages as goals (true/false)", parseBooleanOption).option("--fast-mode <enabled>", "Run automation messages in fast mode (true/false)", parseBooleanOption).option("--in <duration>", "Replace triggers with a one-time run after this long, e.g. 30m, 2h, 3d, 1w").option("--at <datetime>", "Replace triggers with a one-time run at this ISO-8601 time with timezone").option("--max-runs <n>", 'Delete the automation after this many runs in total ("none" for unlimited)').option("--workspace <target>", "Where runs go: new, reuse, current, or a workspace ID").option("--background <enabled>", "Keep it out of the main automations list (true/false)", parseBooleanOption).option("--move-to-org", "Move a personal automation to the organization so teammates can see and edit it (cannot be undone)").action(run(automationEditCommand));
55531
+ automation.command("create [name]").description("Create a new automation").option("-p, --prompt <prompt>", "Prompt for the automation").option("-d, --description <description>", "Description shown with the automation").option("-e, --environment <environment>", "Environment name or ID").option("--size <size>", "Size of workspaces runs create (not a reused existing one): small (default), large, ultra").option("--trigger-cron <schedule>", 'Cron schedule expression, e.g. "0 9 * * 1-5" (repeatable)', collect, []).option("--trigger-cron-timezone <timezone>", "Timezone for cron schedules (default: UTC)").option("--trigger-github <event>", 'GitHub event, e.g. "pull_request.opened" (repeatable)', collect, []).option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-github-reviewers <users>", "Comma-separated GitHub usernames to fire for (required with pull_request.review_requested)").option("--trigger-gitlab <event>", 'GitLab event, e.g. "merge_request.opened" (repeatable)', collect, []).option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--github-checks <names>", "Comma-separated GitHub check names to create on matching PRs (requires a PR opened/updated trigger)").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done (default for new automations except one-time ones), sleep_when_done, archive_when_done, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode", "Run automation messages in plan mode").option("--goal-mode", "Set automation messages as goals").option("--fast-mode", "Run automation messages in fast mode").option("--personal", "Create a personal automation owned by the authenticated user").option("--in <duration>", "Run once after this long, e.g. 30m, 2h, 3d, 1w (inside a workspace, defaults --workspace to current)").option("--at <datetime>", "Run once at this ISO-8601 time with timezone, e.g. 2026-10-08T09:00:00-07:00").option("--max-runs <n>", 'Delete the automation after this many runs ("none" for unlimited)').option("--workspace <target>", "Where runs go: new (default, new workspace each run), reuse (one workspace created on the first run), current (this workspace), or a workspace ID").option("--background", "Mark this as an AI agent's own automation (a reminder, follow-up or recurring check-in for its task). Kept out of the main automations list").option("--disabled", "Create in disabled state").action(run((name, options) => automationCreateCommand(name, { ...options, enabled: !options.disabled })));
55532
+ automation.command("edit <id>").description("Edit an existing automation").option("-n, --name <name>", "New name").option("-p, --prompt <prompt>", "New prompt").option("-d, --description <description>", "New description (pass empty string to clear)").option("--size <size>", "Size of workspaces runs create (not a reused existing one): small, large, ultra").option("--enabled <enabled>", "Enable or disable (true/false)").option("--trigger-cron <schedule>", "Set cron schedule (repeatable; replaces existing triggers unless --keep-triggers)", collect, []).option("--trigger-cron-timezone <timezone>", "Timezone for cron schedules").option("--trigger-github <event>", "Set GitHub event (repeatable; replaces existing triggers unless --keep-triggers)", collect, []).option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-github-reviewers <users>", "Comma-separated GitHub usernames to fire for (required with pull_request.review_requested)").option("--trigger-gitlab <event>", "Set GitLab event (repeatable; replaces existing triggers unless --keep-triggers)", collect, []).option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--keep-triggers", "Add the --trigger-cron, --trigger-github, --trigger-gitlab, --in or --at triggers to the existing ones instead of replacing them").option("--github-checks <names>", "Comma-separated GitHub check names to create on matching PRs (replaces the current list; pass empty string to remove them)").option("--add-github-checks <names>", "Comma-separated GitHub check names to add, keeping the ones already configured").option("--environment <environment>", "Environment name or ID").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done (default for new automations except one-time ones), sleep_when_done, archive_when_done, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default)").option("--pr-followups <enabled>", "Allow follow-up actions on matching PRs (true/false)", parseBooleanOption).option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode <enabled>", "Run automation messages in plan mode (true/false)", parseBooleanOption).option("--goal-mode <enabled>", "Set automation messages as goals (true/false)", parseBooleanOption).option("--fast-mode <enabled>", "Run automation messages in fast mode (true/false)", parseBooleanOption).option("--in <duration>", "Replace triggers with a one-time run after this long, e.g. 30m, 2h, 3d, 1w").option("--at <datetime>", "Replace triggers with a one-time run at this ISO-8601 time with timezone").option("--max-runs <n>", 'Delete the automation after this many runs in total ("none" for unlimited)').option("--workspace <target>", "Where runs go: new, reuse, current, or a workspace ID").option("--background <enabled>", "Keep it out of the main automations list (true/false)", parseBooleanOption).option("--move-to-org", "Move a personal automation to the organization so teammates can see and edit it (cannot be undone)").action(run(automationEditCommand));
55611
55533
  automation.command("run <id>").description("Manually trigger an automation (cron-triggered automations only)").action(run(automationRunCommand));
55612
55534
  automation.command("delete <id>").description("Delete an automation").option("-f, --force", "Skip confirmation prompt").action(run(automationDeleteCommand));
55613
55535
  automation.command("check <checkRunId>").description("Report this automation run's verdict on one of its GitHub checks").requiredOption("--token <token>", "Ownership token for this check, exactly as given in the prompt").requiredOption("--conclusion <conclusion>", "success or failure").requiredOption("--title <title>", "One-line verdict shown on the check").option("--summary <summary>", "What was checked and why it passed or failed").action(run(automationCheckCommand));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.363",
3
+ "version": "0.3.365",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {