replicas-engine 0.1.1493 → 0.1.1494

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.
@@ -8,12 +8,12 @@ import {
8
8
  listCodexModelsForDetails,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-WYTSPCFP.js";
12
- import "./chunk-RHYD6KJA.js";
13
- import "./chunk-33FJPHU6.js";
14
- import "./chunk-TGP2OFJT.js";
11
+ } from "./chunk-QOAJHPFJ.js";
12
+ import "./chunk-OQZLK6BN.js";
13
+ import "./chunk-UEWCWES6.js";
14
+ import "./chunk-55SJSOI2.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-X6NO2TJZ.js";
16
+ import "./chunk-XKXYQAIA.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-X6NO2TJZ.js";
6
+ } from "./chunk-XKXYQAIA.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-X6NO2TJZ.js";
8
+ } from "./chunk-XKXYQAIA.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -6,7 +6,7 @@ import {
6
6
  getOriginDefaultBranch,
7
7
  monolithRequest,
8
8
  runGitCommand
9
- } from "./chunk-RHYD6KJA.js";
9
+ } from "./chunk-OQZLK6BN.js";
10
10
  import {
11
11
  extractCommandProtectionCommandText,
12
12
  findCommandProtectionGitLookups,
@@ -15,7 +15,7 @@ import {
15
15
  findScoutRepoWriteSignals,
16
16
  parseCommandProtectionRequest,
17
17
  withE2BRetry
18
- } from "./chunk-X6NO2TJZ.js";
18
+ } from "./chunk-XKXYQAIA.js";
19
19
 
20
20
  // src/services/command-protection-service.ts
21
21
  import { readFile, stat } from "fs/promises";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-33FJPHU6.js";
6
+ } from "./chunk-UEWCWES6.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -15,7 +15,7 @@ import {
15
15
  isRecord,
16
16
  readOllamaAuthEnv,
17
17
  readOpenAICompatibleAuthEnv
18
- } from "./chunk-X6NO2TJZ.js";
18
+ } from "./chunk-XKXYQAIA.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-TGP2OFJT.js";
7
+ } from "./chunk-55SJSOI2.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -21,7 +21,7 @@ import {
21
21
  provisionedDeviceSchema,
22
22
  readReplicasRuntimeEnv,
23
23
  serializePosixEnvFile
24
- } from "./chunk-X6NO2TJZ.js";
24
+ } from "./chunk-XKXYQAIA.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -11,15 +11,15 @@ import {
11
11
  resolveDiffBase,
12
12
  runGitCommand,
13
13
  setAgentCredentialSnapshot
14
- } from "./chunk-RHYD6KJA.js";
14
+ } from "./chunk-OQZLK6BN.js";
15
15
  import {
16
16
  AppServerProcess,
17
17
  buildCodexAgentEnv
18
- } from "./chunk-33FJPHU6.js";
18
+ } from "./chunk-UEWCWES6.js";
19
19
  import {
20
20
  SUBPROCESS_MAX_BUFFER,
21
21
  execFileAsync
22
- } from "./chunk-TGP2OFJT.js";
22
+ } from "./chunk-55SJSOI2.js";
23
23
  import {
24
24
  isRecord
25
25
  } from "./chunk-UZSNFLDQ.js";
@@ -57,7 +57,7 @@ import {
57
57
  resolveOpenAICompatibleModelsUrl,
58
58
  splitMothershipInstructions,
59
59
  withTimeout
60
- } from "./chunk-X6NO2TJZ.js";
60
+ } from "./chunk-XKXYQAIA.js";
61
61
 
62
62
  // src/managers/codex-token-manager.ts
63
63
  import { promises as fs } from "fs";
@@ -320,7 +320,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
320
320
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
321
321
  await this.applyCredentialsResponse(data);
322
322
  setAgentCredentialSnapshot("codex", data);
323
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-5LNUES7Y.js");
323
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QPONSSTK.js");
324
324
  await restartCodexAspHostIfRunning2();
325
325
  });
326
326
  await this.start(true);
@@ -342,7 +342,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
342
342
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
343
343
  await this.applyCredentialsResponse(data);
344
344
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
345
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-5LNUES7Y.js");
345
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QPONSSTK.js");
346
346
  await restartCodexAspHostIfRunning2();
347
347
  }
348
348
  setAgentCredentialSnapshot("codex", data);
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-TGP2OFJT.js";
6
+ } from "./chunk-55SJSOI2.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-X6NO2TJZ.js";
9
+ } from "./chunk-XKXYQAIA.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1493";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1494";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -8507,8 +8507,8 @@ var require_CronExpression = __commonJS({
8507
8507
  return false;
8508
8508
  }
8509
8509
  if (this.#checkDstTransition(currentDate)) {
8510
- const steps2 = reverse ? currentHour - nextHour : nextHour - currentHour;
8511
- for (let i = 0; i < steps2; i++) {
8510
+ const steps = reverse ? currentHour - nextHour : nextHour - currentHour;
8511
+ for (let i = 0; i < steps; i++) {
8512
8512
  currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Hour, hours.length);
8513
8513
  if (!reverse && currentDate.getHours() >= nextHour)
8514
8514
  break;
@@ -9096,8 +9096,8 @@ var require_CronFileParser = __commonJS({
9096
9096
  expressions: [],
9097
9097
  errors: {}
9098
9098
  };
9099
- for (const block2 of blocks) {
9100
- const entry = block2.trim();
9099
+ for (const block of blocks) {
9100
+ const entry = block.trim();
9101
9101
  if (entry.length === 0 || entry.startsWith("#")) {
9102
9102
  continue;
9103
9103
  }
@@ -11761,8 +11761,8 @@ var WORKSPACE_SEARCH_INDEX_PARAMS = {
11761
11761
  // ../shared/src/auth-fallback.ts
11762
11762
  function describeCredential(provider2, credential) {
11763
11763
  const { ownerName, email, ordinal: ordinal2 } = credential.account ?? {};
11764
- const label2 = `${getCredentialMethodLabel(provider2, credential.method)}${ordinal2 ? ` #${ordinal2}` : ""}`;
11765
- const owner = credential.scope === CREDENTIAL_SCOPE.USER ? ownerName ? `${ownerName}'s personal ${label2}` : `your ${label2}` : credential.scope === CREDENTIAL_SCOPE.ORG ? `the organization's ${label2}` : `the ${label2}`;
11764
+ const label = `${getCredentialMethodLabel(provider2, credential.method)}${ordinal2 ? ` #${ordinal2}` : ""}`;
11765
+ const owner = credential.scope === CREDENTIAL_SCOPE.USER ? ownerName ? `${ownerName}'s personal ${label}` : `your ${label}` : credential.scope === CREDENTIAL_SCOPE.ORG ? `the organization's ${label}` : `the ${label}`;
11766
11766
  return email ? `${owner} (${email})` : owner;
11767
11767
  }
11768
11768
  function describeAuthFallback(payload) {
@@ -11804,7 +11804,7 @@ var fallbackPlanStepSchema = z13.discriminatedUnion("kind", [
11804
11804
  fallbackHarnessStepSchema
11805
11805
  ]);
11806
11806
  var fallbackPlanResponseSchema = z13.object({
11807
- steps: z13.array(z13.unknown()).transform((steps2) => steps2.flatMap((step) => fallbackPlanStepSchema.safeParse(step).data ?? []))
11807
+ steps: z13.array(z13.unknown()).transform((steps) => steps.flatMap((step) => fallbackPlanStepSchema.safeParse(step).data ?? []))
11808
11808
  });
11809
11809
 
11810
11810
  // ../shared/src/chat-fork.ts
@@ -12164,6 +12164,7 @@ var REPLICAS_MCP_TOOLS = {
12164
12164
  waitForSubagents: "wait_for_subagents",
12165
12165
  getBoard: "get_board",
12166
12166
  updateBoard: "update_board",
12167
+ updateTicket: "update_ticket",
12167
12168
  sendToChat: "send_to_chat",
12168
12169
  getLinearRouting: "get_linear_routing",
12169
12170
  setLinearRouting: "set_linear_routing",
@@ -12201,7 +12202,11 @@ var automationToolInputSchema = z19.object({
12201
12202
  "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."
12202
12203
  )
12203
12204
  });
12205
+ var automationBackgroundSchema = z19.boolean().optional().describe(
12206
+ "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."
12207
+ );
12204
12208
  var automationCreateToolInputSchema = automationToolInputSchema.extend({
12209
+ background: automationBackgroundSchema,
12205
12210
  scope: z19.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
12206
12211
  });
12207
12212
  var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
@@ -12211,6 +12216,7 @@ var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend
12211
12216
  model: z19.string().nullable().optional(),
12212
12217
  thinking_level: z19.enum(VALID_THINKING_LEVELS).nullable().optional(),
12213
12218
  workspace_size: z19.enum(WORKSPACE_SIZES).optional(),
12219
+ background: automationBackgroundSchema,
12214
12220
  scope: z19.literal("org").optional().describe("`org` moves a personal automation to the organization so teammates can see and edit it. It cannot be moved back.")
12215
12221
  });
12216
12222
  var chatPath = { id: z19.string().describe("Workspace ID"), chat_id: z19.string().describe("Chat ID") };
@@ -14352,6 +14358,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
14352
14358
  | "What automations do I have?" | \`replicas automation list\` |
14353
14359
  | "Run my nightly automation now" | \`replicas automation run <id>\` |
14354
14360
  | "Check back on this in a week" | \`replicas automation create ... --in 1w --background --personal\` |
14361
+ | "Check this daily for a week" | \`replicas automation create ... --trigger-cron "0 9 * * *" --max-runs 7 --workspace current --background --personal\` |
14355
14362
  | "Make an automation that runs every weekday at 9am" | \`replicas automation create\` (interactive) or \`--trigger-cron "0 9 * * 1-5"\` |
14356
14363
  | "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\` |
14357
14364
  | "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\` |
@@ -14511,7 +14518,7 @@ replicas automation create "Re-check PR #142 CI" \\
14511
14518
  - \`--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).
14512
14519
  - 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\`.
14513
14520
  - 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.
14514
- - \`--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.
14521
+ - \`--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**.
14515
14522
  - \`--personal\` makes the automation the user's own. Omit it only when the follow-up belongs to the organization.
14516
14523
  - 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.
14517
14524
  - 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.
@@ -15047,19 +15054,15 @@ function removeTag(text4, tag) {
15047
15054
  function stripReplicasInstructionBlock(text4) {
15048
15055
  return removeTag(text4, REPLICAS_INSTRUCTIONS_TAG);
15049
15056
  }
15050
- var 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.`;
15057
+ var 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.`;
15051
15058
  var BOARD_ANSWER_NOTE = "The user answered on the board.";
15052
- var 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:
15053
- - 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.
15054
- - 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.
15055
- - Working (working): one table with columns Ship and Now: a ship block and a short line per active ship or deploy.
15056
- - 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.
15057
- - 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.
15058
- - 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.
15059
+ var 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.
15060
+ - 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.
15061
+ - 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.
15062
+ - 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.
15059
15063
  - 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.
15060
- - 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.
15061
- - 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.
15062
- - 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.
15064
+ - 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.
15065
+ - 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.
15063
15066
  `;
15064
15067
  var MOTHERSHIP_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MOTHERSHIP_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MOTHERSHIP_INSTRUCTIONS_TAG}>`);
15065
15068
  function splitMothershipInstructions(customInstructions) {
@@ -15204,11 +15207,11 @@ function coerceBackgroundTaskPayload(payload) {
15204
15207
  const workflowAgents = Array.isArray(payload.workflow_progress) ? payload.workflow_progress.flatMap((entry) => {
15205
15208
  if (!isRecord(entry) || entry.type !== "workflow_agent") return [];
15206
15209
  const agentId = optionalString(entry.agentId);
15207
- const label2 = optionalString(entry.label);
15208
- if (!agentId || !label2) return [];
15210
+ const label = optionalString(entry.label);
15211
+ if (!agentId || !label) return [];
15209
15212
  return [{
15210
15213
  agentId,
15211
- label: label2,
15214
+ label,
15212
15215
  model: optionalString(entry.model),
15213
15216
  state: optionalString(entry.state),
15214
15217
  promptPreview: optionalString(entry.promptPreview),
@@ -15859,24 +15862,24 @@ function lineCountFromOutput(output) {
15859
15862
  }
15860
15863
  return lines;
15861
15864
  }
15862
- function fileContentDiff(path, content, action2) {
15865
+ function fileContentDiff(path, content, action) {
15863
15866
  const lines = content.replace(/\n$/, "").split("\n");
15864
15867
  return [
15865
- `--- ${action2 === "add" ? "/dev/null" : `a/${path}`}`,
15866
- `+++ ${action2 === "add" ? `b/${path}` : "/dev/null"}`,
15867
- action2 === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
15868
- ...lines.map((line) => `${action2 === "add" ? "+" : "-"}${line}`)
15868
+ `--- ${action === "add" ? "/dev/null" : `a/${path}`}`,
15869
+ `+++ ${action === "add" ? `b/${path}` : "/dev/null"}`,
15870
+ action === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
15871
+ ...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
15869
15872
  ].join("\n");
15870
15873
  }
15871
- function isRawFileContent(diff, action2) {
15874
+ function isRawFileContent(diff, action) {
15872
15875
  const lines = diff.split("\n");
15873
- return !lines[0].startsWith("diff --git ") && !(lines[0].startsWith("--- ") && lines[1]?.startsWith("+++ ")) && !(action2 === "add" && lines.every((line) => line === "" || line.startsWith("+")));
15876
+ return !lines[0].startsWith("diff --git ") && !(lines[0].startsWith("--- ") && lines[1]?.startsWith("+++ ")) && !(action === "add" && lines.every((line) => line === "" || line.startsWith("+")));
15874
15877
  }
15875
- function operationDiffStats({ diff, action: action2 }) {
15878
+ function operationDiffStats({ diff, action }) {
15876
15879
  if (!diff) return void 0;
15877
- if (action2 === "update" || !isRawFileContent(diff, action2)) return getDiffStats(diff);
15880
+ if (action === "update" || !isRawFileContent(diff, action)) return getDiffStats(diff);
15878
15881
  const lines = diff.replace(/\n$/, "").split("\n").length;
15879
- return action2 === "add" ? { added: lines, removed: 0 } : { added: 0, removed: lines };
15882
+ return action === "add" ? { added: lines, removed: 0 } : { added: 0, removed: lines };
15880
15883
  }
15881
15884
  function getDiffStats(diff) {
15882
15885
  let added = 0;
@@ -16211,7 +16214,7 @@ function workspaceTargetFromToolOutput(output) {
16211
16214
  const value = output?.split(/\r?\n/).find((line) => line.startsWith("Workspace: "))?.slice("Workspace: ".length);
16212
16215
  if (!value) return null;
16213
16216
  const nameEnd = value.endsWith(")") ? value.lastIndexOf(" (") : -1;
16214
- const label2 = nameEnd > 0 ? value.slice(0, nameEnd) : "";
16217
+ const label = nameEnd > 0 ? value.slice(0, nameEnd) : "";
16215
16218
  const href = nameEnd > 0 ? value.slice(nameEnd + 2, -1) : value;
16216
16219
  try {
16217
16220
  const segments = new URL(href, DEFAULT_WEB_APP_URL).pathname.split("/").filter(Boolean);
@@ -16219,7 +16222,7 @@ function workspaceTargetFromToolOutput(output) {
16219
16222
  if (!id || !UUID_RE.test(id)) return null;
16220
16223
  return {
16221
16224
  id,
16222
- label: sanitizeTerminalLine(label2) || "Workspace",
16225
+ label: sanitizeTerminalLine(label) || "Workspace",
16223
16226
  href: getWorkspaceDashboardUrl(id, { webAppUrl: "" })
16224
16227
  };
16225
16228
  } catch {
@@ -16229,115 +16232,68 @@ function workspaceTargetFromToolOutput(output) {
16229
16232
 
16230
16233
  // ../shared/src/mothership-board.ts
16231
16234
  import { z as z26 } from "zod";
16232
- var MOTHERSHIP_BOARD_TONES = ["neutral", "needs_you", "warning", "success", "danger", "working", "done"];
16233
- var label = (max) => z26.string().trim().min(1).max(max);
16234
- var tone = z26.enum(MOTHERSHIP_BOARD_TONES);
16235
- var blockId = z26.string().regex(/^[\w.:-]{1,64}$/, "Use 1-64 letters, digits, _, -, . or :");
16235
+ var MOTHERSHIP_TICKET_LIMITS = {
16236
+ title: 80,
16237
+ task: 1e3,
16238
+ summary: 600,
16239
+ note: 100,
16240
+ overview: 160,
16241
+ question: 300,
16242
+ option: 60,
16243
+ options: 3,
16244
+ questions: 2,
16245
+ blocked: 200,
16246
+ media: 6,
16247
+ caption: 80,
16248
+ answer: 2e3
16249
+ };
16250
+ var L = MOTHERSHIP_TICKET_LIMITS;
16251
+ var tooLong = (max) => `At most ${max} characters. Keep it short; the user should take it in at a glance`;
16252
+ var text3 = (max) => z26.string().trim().min(1).max(max, tooLong(max));
16253
+ var clearable = (schema) => z26.union([schema, z26.literal("")]).optional();
16236
16254
  var httpsUrl = z26.url({ protocol: /^https$/, error: "Must be an https URL" });
16237
- var prUrl = httpsUrl.refine((url) => parseCodeHostPrUrl(url) !== null, "Must be a GitHub pull request or GitLab merge request URL");
16238
16255
  var linearIdentifier = z26.string().regex(/^[A-Za-z][A-Za-z0-9]{0,9}-\d{1,7}$/, "Use a Linear identifier such as REP-123");
16239
- var action = z26.discriminatedUnion("type", [
16240
- z26.object({ type: z26.literal("open_ship"), workspace_id: z26.uuid() }),
16241
- z26.object({ type: z26.literal("message_ship"), workspace_id: z26.uuid(), message: label(4e3) }),
16242
- z26.object({ type: z26.literal("open_pr"), url: prUrl }),
16243
- z26.object({ type: z26.literal("merge_pr"), url: prUrl }),
16244
- z26.object({ type: z26.literal("message_mothership"), message: label(4e3) }),
16245
- z26.object({ type: z26.literal("open_link"), url: httpsUrl })
16246
- ]);
16247
- var text3 = z26.object({ type: z26.literal("text"), id: blockId.optional(), text: label(2e3) });
16248
- var badge = z26.object({ type: z26.literal("badge"), id: blockId.optional(), label: label(40), tone: tone.optional() });
16249
- var pr = z26.object({ type: z26.literal("pr"), id: blockId.optional(), url: prUrl });
16250
- var ship = z26.object({ type: z26.literal("ship"), id: blockId.optional(), workspace_id: z26.uuid() });
16251
- var linear = z26.object({ type: z26.literal("linear"), id: blockId.optional(), identifier: linearIdentifier });
16252
- var button = z26.object({ type: z26.literal("button"), id: blockId.optional(), label: label(60), action, variant: z26.enum(["primary", "outline", "warning", "destructive"]).optional(), resolves: blockId.optional() });
16253
- var steps = z26.object({
16254
- type: z26.literal("steps"),
16255
- id: blockId.optional(),
16256
- steps: z26.array(z26.object({ label: label(30), state: z26.enum(["done", "current", "pending", "failed"]) })).min(1).max(8)
16256
+ var mediaSchema = z26.object({
16257
+ url: httpsUrl.describe("The URL `replicas media upload` printed."),
16258
+ caption: text3(L.caption).describe('What it shows, such as "After: the list stays pinned".'),
16259
+ kind: z26.enum(["image", "video"]).describe("video for recordings, image for screenshots and GIFs.")
16257
16260
  });
16258
- var inline = z26.discriminatedUnion("type", [text3, badge, pr, ship, linear, button, steps]);
16259
- var row = z26.object({ type: z26.literal("row"), id: blockId.optional(), cells: z26.array(z26.union([label(500), inline])).min(1).max(6) });
16260
- var blockTypes = {
16261
- text: text3,
16262
- badge,
16263
- pr,
16264
- ship,
16265
- linear,
16266
- button,
16267
- steps,
16268
- stat: z26.object({ type: z26.literal("stat"), id: blockId.optional(), label: label(40), value: label(40), tone: tone.optional() }),
16269
- divider: z26.object({ type: z26.literal("divider"), id: blockId.optional() }),
16270
- updated_at: z26.object({ type: z26.literal("updated_at"), id: blockId.optional() }),
16271
- choice: z26.object({
16272
- type: z26.literal("choice"),
16273
- id: blockId.optional(),
16274
- question: label(500),
16275
- options: z26.array(z26.object({ label: label(60), message: label(2e3).optional() })).min(2).max(6),
16276
- allow_custom: z26.boolean().optional(),
16277
- resolves: blockId.optional()
16278
- }),
16279
- button_group: z26.object({ type: z26.literal("button_group"), id: blockId.optional(), children: z26.array(button).min(1).max(8) }),
16280
- table: z26.object({ type: z26.literal("table"), id: blockId.optional(), columns: z26.array(label(40)).min(1).max(6), children: z26.array(row).max(100) }),
16281
- callout: z26.object({
16282
- type: z26.literal("callout"),
16283
- id: blockId.optional(),
16284
- tone,
16285
- title: label(120).optional(),
16286
- get children() {
16287
- return z26.array(block).max(20).optional();
16288
- }
16289
- }),
16290
- list: z26.object({
16291
- type: z26.literal("list"),
16292
- id: blockId.optional(),
16293
- ordered: z26.boolean().optional(),
16294
- get children() {
16295
- return z26.array(block).max(100);
16296
- }
16297
- }),
16298
- section: z26.object({
16299
- type: z26.literal("section"),
16300
- id: blockId.optional(),
16301
- title: label(120),
16302
- tone: tone.optional(),
16303
- collapsed: z26.boolean().optional(),
16304
- get children() {
16305
- return z26.array(block).max(100);
16306
- }
16307
- })
16308
- };
16309
- var blockSchemas = [text3, ...Object.values(blockTypes).filter((schema) => schema !== text3)];
16310
- var block = z26.discriminatedUnion("type", blockSchemas);
16311
- var MOTHERSHIP_BOARD_CONTAINER_TYPES = Object.entries(blockTypes).filter(([, schema]) => "children" in schema.shape).map(([type]) => type);
16312
- var mothershipBoardBlocksSchema = z26.array(block).max(100).superRefine((blocks, ctx) => {
16313
- const seen = /* @__PURE__ */ new Set();
16314
- const visit = (node, path) => {
16315
- if (typeof node === "string") return;
16316
- if (node.id) {
16317
- if (seen.has(node.id)) ctx.addIssue({ code: "custom", path: [...path, "id"], message: `Duplicate block id "${node.id}"` });
16318
- seen.add(node.id);
16319
- }
16320
- if (node.type === "table") {
16321
- node.children.forEach((child, index) => {
16322
- if (child.cells.length > node.columns.length) ctx.addIssue({ code: "custom", path: [...path, "children", index, "cells"], message: `Row has ${child.cells.length} cells but the table has ${node.columns.length} columns` });
16323
- });
16324
- }
16325
- if (node.type === "row") node.cells.forEach((cell, index) => visit(cell, [...path, "cells", index]));
16326
- else if ("children" in node) node.children?.forEach((child, index) => visit(child, [...path, "children", index]));
16327
- };
16328
- blocks.forEach((node, index) => visit(node, [index]));
16261
+ var questionSchema = z26.object({
16262
+ question: text3(L.question).describe("One question, with the context needed to answer it."),
16263
+ options: z26.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.")
16329
16264
  });
16330
- var mothershipBoardOperationsSchema = z26.array(z26.discriminatedUnion("op", [
16331
- z26.object({ op: z26.literal("replace"), blocks: z26.array(block) }),
16332
- z26.object({
16333
- op: z26.literal("upsert"),
16334
- block: z26.discriminatedUnion("type", [row, ...blockSchemas]).refine((value) => Boolean(value.id), { message: "Give the block an id", path: ["id"] }),
16335
- parent_id: blockId.optional(),
16336
- position: z26.number().int().min(0).optional()
16337
- }),
16338
- z26.object({ op: z26.literal("remove"), id: blockId })
16339
- ])).min(1).max(50);
16340
- var mothershipBoardItemRefSchema = z26.object({ mothershipId: z26.uuid(), block, occurrence: z26.number().int().min(0).optional() });
16265
+ var mothershipTicketTitleSchema = text3(L.title);
16266
+ var mothershipTicketTaskSchema = text3(L.task);
16267
+ var mothershipTicketMediaSchema = z26.array(mediaSchema);
16268
+ var mothershipTicketQuestionsSchema = z26.array(questionSchema.extend({ id: z26.string() }));
16269
+ var updateMothershipTicketRequestSchema = z26.object({
16270
+ 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.`),
16271
+ media: z26.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.`),
16272
+ questions: z26.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.`),
16273
+ blocked: clearable(text3(L.blocked)).describe('Why you cannot go on without the user, such as missing access. "" once unblocked.')
16274
+ });
16275
+ var updateMothershipBoardRequestSchema = z26.object({
16276
+ 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.`),
16277
+ tickets: z26.array(z26.object({
16278
+ id: z26.uuid(),
16279
+ title: mothershipTicketTitleSchema.optional(),
16280
+ 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.`),
16281
+ linear: clearable(linearIdentifier).describe('The Linear issue this ticket is for, such as REP-123. "" removes it.'),
16282
+ archived: z26.boolean().optional().describe("Take it off the board.")
16283
+ })).max(50).optional().describe("Changes to existing tickets."),
16284
+ order: z26.array(z26.uuid()).optional().describe("Ticket ids, most important first. Tickets left out keep their order after these."),
16285
+ create: z26.array(z26.object({
16286
+ title: mothershipTicketTitleSchema,
16287
+ task: mothershipTicketTaskSchema.optional(),
16288
+ questions: z26.array(questionSchema).max(L.questions).optional(),
16289
+ note: text3(L.note).optional()
16290
+ })).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.")
16291
+ });
16292
+ var answerMothershipTicketRequestSchema = z26.object({
16293
+ questionId: z26.string().min(1),
16294
+ answer: text3(L.answer)
16295
+ });
16296
+ var mothershipTicketAnswerRefSchema = z26.object({ mothershipId: z26.uuid(), ticketId: z26.uuid(), questionId: z26.string().min(1) });
16341
16297
  var LINEAR_ISSUE_SUMMARIES_MAX = 50;
16342
16298
  var linearIssueSummariesRequestSchema = z26.object({ identifiers: z26.array(linearIdentifier).min(1).max(LINEAR_ISSUE_SUMMARIES_MAX) });
16343
16299
 
@@ -16391,8 +16347,8 @@ function shellPayload(command) {
16391
16347
  function commandLabel(command) {
16392
16348
  const lines = shellPayload(command.slice(0, COMMAND_PARSE_LIMIT)).replace(/^cd\s+\S+\s*&&\s*/, "").split("\n").filter((line) => line.trim());
16393
16349
  const shown = lines.length > 1 && /(["']|<<-?\s*['"]?\w+['"]?)\s*$/.test(lines[0]) ? 2 : 1;
16394
- const label2 = lines.slice(0, shown).map((line) => line.trim()).join(" ");
16395
- return lines.length > shown ? `${label2} \u2026` : label2;
16350
+ const label = lines.slice(0, shown).map((line) => line.trim()).join(" ");
16351
+ return lines.length > shown ? `${label} \u2026` : label;
16396
16352
  }
16397
16353
  var BACKGROUND_META = {
16398
16354
  in_progress: "Running in background",
@@ -16553,6 +16509,7 @@ var REPLICAS_API_STEPS = {
16553
16509
  [REPLICAS_MCP_TOOLS.clearLinearRouting]: { icon: "trash", live: "Clearing Linear routing", done: "Cleared Linear routing" },
16554
16510
  [REPLICAS_MCP_TOOLS.getBoard]: { icon: "book", live: "Reading board", done: "Read board" },
16555
16511
  [REPLICAS_MCP_TOOLS.updateBoard]: { icon: "file-pen", live: "Updating board", done: "Updated board" },
16512
+ [REPLICAS_MCP_TOOLS.updateTicket]: { icon: "file-pen", live: "Updating ticket", done: "Updated ticket" },
16556
16513
  [REPLICAS_MCP_TOOLS.sendToChat]: { icon: "message", live: "Sending to chat", done: "Sent to chat" },
16557
16514
  [REPLICAS_MCP_TOOLS.mergeWhenReady]: { icon: "target", live: "Setting merge when ready", done: "Set merge when ready" }
16558
16515
  };
@@ -16607,13 +16564,13 @@ function describeToolCall(message2, base) {
16607
16564
  const command = replicasTool === REPLICAS_MCP_TOOLS.runCommand ? inputString(input, "command") : void 0;
16608
16565
  const name = inputString(input, "name") ?? inputString(replicaFields, "name");
16609
16566
  const workspaceId = inputString(input, "id") ?? inputString(replicaFields, "id");
16610
- const label2 = command ? commandLabel(command) : inputString(input, "title") ?? (replicasTool === REPLICAS_MCP_TOOLS.createAutomation ? name : void 0);
16567
+ const label = command ? commandLabel(command) : inputString(input, "title") ?? (replicasTool === REPLICAS_MCP_TOOLS.createAutomation ? name : void 0);
16611
16568
  return {
16612
16569
  ...base,
16613
16570
  key,
16614
16571
  category: "tool",
16615
16572
  ...replicasStep,
16616
- target: label2 ? { text: label2, plain: !command } : void 0,
16573
+ target: label ? { text: label, plain: !command } : void 0,
16617
16574
  workspace: workspaceId && UUID_RE.test(workspaceId) ? { id: workspaceId, name } : void 0,
16618
16575
  detail: message2.input || message2.output ? "io" : void 0
16619
16576
  };
@@ -16671,12 +16628,12 @@ function describeSteps(message2, { durations, backgroundTasks }) {
16671
16628
  const background = backgroundId ? backgroundTasks?.get(backgroundId) : void 0;
16672
16629
  const cached = stepCache.get(message2);
16673
16630
  if (cached && cached.durationMs === durationMs && cached.background === background) return cached.steps;
16674
- const steps2 = describeMessageSteps(message2, durationMs, background).map((step) => ({
16631
+ const steps = describeMessageSteps(message2, durationMs, background).map((step) => ({
16675
16632
  ...step,
16676
16633
  stats: step.operation && !step.failed ? operationDiffStats(step.operation) : void 0
16677
16634
  }));
16678
- stepCache.set(message2, { durationMs, background, steps: steps2 });
16679
- return steps2;
16635
+ stepCache.set(message2, { durationMs, background, steps });
16636
+ return steps;
16680
16637
  }
16681
16638
  var NO_DURATIONS = /* @__PURE__ */ new Map();
16682
16639
  function plainStepLabel(step) {
@@ -17336,7 +17293,7 @@ function parseCodexEvents(events) {
17336
17293
  // ../shared/src/display-message/parsers/cursor-parser.ts
17337
17294
  function getTextContent(value) {
17338
17295
  if (!Array.isArray(value)) return "";
17339
- return value.map((block2) => isRecord(block2) && block2.type === "text" && typeof block2.text === "string" ? block2.text : "").join("");
17296
+ return value.map((block) => isRecord(block) && block.type === "text" && typeof block.text === "string" ? block.text : "").join("");
17340
17297
  }
17341
17298
  function cursorStatusToDisplayStatus(status) {
17342
17299
  return status === "completed" || status === "FINISHED" ? "completed" : status === "error" || status === "ERROR" || status === "CANCELLED" || status === "EXPIRED" ? "failed" : "in_progress";
@@ -17597,8 +17554,8 @@ var SERVER_ERROR_TEXT_PATTERN = /internal ?server ?error|server ?error|service u
17597
17554
  var INFERENCE_ERROR_DETAIL_MAX = 600;
17598
17555
  var INFERENCE_ERROR_RETRY_HINT = "This is usually temporary \u2014 retry the message.";
17599
17556
  function formatInferenceError(message2, context = {}) {
17600
- const label2 = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
17601
- const source = label2 ? `${label2}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
17557
+ const label = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
17558
+ const source = label ? `${label}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
17602
17559
  let body = source ? message2 ? `${source}: ${message2}` : `${source}.` : message2;
17603
17560
  const detail = context.detail?.trim();
17604
17561
  if (detail && !body.includes(detail)) {
@@ -17982,7 +17939,7 @@ function normalizeContentBlocks(content) {
17982
17939
  if (typeof content === "string") {
17983
17940
  return content ? [{ type: "text", text: content }] : [];
17984
17941
  }
17985
- return Array.isArray(content) ? content.filter((block2) => isRecord(block2) && typeof block2.type === "string") : [];
17942
+ return Array.isArray(content) ? content.filter((block) => isRecord(block) && typeof block.type === "string") : [];
17986
17943
  }
17987
17944
  function parseStringField(value) {
17988
17945
  if (typeof value !== "string") return null;
@@ -18063,13 +18020,13 @@ var TaskAccumulator = class {
18063
18020
  }
18064
18021
  return out;
18065
18022
  }
18066
- processContentBlock(block2) {
18067
- if (!isRecord(block2)) return false;
18068
- if (block2.type === "tool_use" && typeof block2.name === "string" && typeof block2.id === "string") {
18069
- return this.processToolUse(block2.name, block2.id, toAccumulatorInput(block2.input));
18023
+ processContentBlock(block) {
18024
+ if (!isRecord(block)) return false;
18025
+ if (block.type === "tool_use" && typeof block.name === "string" && typeof block.id === "string") {
18026
+ return this.processToolUse(block.name, block.id, toAccumulatorInput(block.input));
18070
18027
  }
18071
- if (block2.type === "tool_result" && typeof block2.tool_use_id === "string") {
18072
- return this.processCreateResult(block2.tool_use_id, block2.content);
18028
+ if (block.type === "tool_result" && typeof block.tool_use_id === "string") {
18029
+ return this.processCreateResult(block.tool_use_id, block.content);
18073
18030
  }
18074
18031
  return false;
18075
18032
  }
@@ -18081,12 +18038,12 @@ var COMMAND_TOOL_NAMES = /* @__PURE__ */ new Set(["Bash", "bash", "shell"]);
18081
18038
  var FILE_TOOL_NAMES = /* @__PURE__ */ new Set(["Write", "Edit"]);
18082
18039
  var toolMessageTemplates = /* @__PURE__ */ new WeakMap();
18083
18040
  var toolResults = /* @__PURE__ */ new WeakMap();
18084
- function fileOrCommandMessage(block2, timestamp) {
18085
- let template = toolMessageTemplates.get(block2);
18041
+ function fileOrCommandMessage(block, timestamp) {
18042
+ let template = toolMessageTemplates.get(block);
18086
18043
  if (!template) {
18087
- const input = typeof block2.input === "string" ? safeJsonParse(block2.input, {}) : block2.input ?? {};
18088
- template = toolMessageTemplate(block2.name ?? "", block2.id ?? "", input);
18089
- toolMessageTemplates.set(block2, template);
18044
+ const input = typeof block.input === "string" ? safeJsonParse(block.input, {}) : block.input ?? {};
18045
+ template = toolMessageTemplate(block.name ?? "", block.id ?? "", input);
18046
+ toolMessageTemplates.set(block, template);
18090
18047
  }
18091
18048
  return { ...template, timestamp };
18092
18049
  }
@@ -18414,13 +18371,13 @@ function parseClaudeEvents(events, parentToolUseId) {
18414
18371
  if (liveStreamId !== null && liveStreamId !== messageId) {
18415
18372
  supersededStreamIds.add(liveStreamId);
18416
18373
  }
18417
- if (contentBlocks.some((block2) => block2.type === "text" && block2.text)) {
18374
+ if (contentBlocks.some((block) => block.type === "text" && block.text)) {
18418
18375
  completedStreamIds.add(messageId);
18419
18376
  liveStreamId = null;
18420
18377
  }
18421
18378
  }
18422
18379
  const thinkingBlocks = contentBlocks.flatMap(
18423
- (block2) => block2.type === "thinking" && typeof block2.thinking === "string" ? [block2.thinking] : []
18380
+ (block) => block.type === "thinking" && typeof block.thinking === "string" ? [block.thinking] : []
18424
18381
  );
18425
18382
  if (thinkingBlocks.length > 0) {
18426
18383
  const allThinking = [...assistantThinking.get(messageKey) ?? [], ...thinkingBlocks];
@@ -18439,14 +18396,14 @@ function parseClaudeEvents(events, parentToolUseId) {
18439
18396
  upsertMessage(reasoningMessage);
18440
18397
  }
18441
18398
  }
18442
- contentBlocks.forEach((block2) => {
18443
- if (block2.type === "text" && block2.text) {
18399
+ contentBlocks.forEach((block) => {
18400
+ if (block.type === "text" && block.text) {
18444
18401
  const textIndex = assistantTextCounts.get(messageKey) ?? 0;
18445
18402
  assistantTextCounts.set(messageKey, textIndex + 1);
18446
18403
  const agentMessage = {
18447
18404
  id: `agent-${messageKey}-${textIndex}`,
18448
18405
  type: "agent",
18449
- content: block2.text,
18406
+ content: block.text,
18450
18407
  timestamp: event.timestamp
18451
18408
  };
18452
18409
  if (streamRefs?.agent !== void 0) {
@@ -18456,10 +18413,10 @@ function parseClaudeEvents(events, parentToolUseId) {
18456
18413
  upsertMessage(agentMessage);
18457
18414
  }
18458
18415
  }
18459
- if (block2.type === "tool_use" && block2.id) {
18460
- const toolName = block2.name || "unknown";
18461
- const toolInput = block2.input || {};
18462
- const toolUseId = block2.id;
18416
+ if (block.type === "tool_use" && block.id) {
18417
+ const toolName = block.name || "unknown";
18418
+ const toolInput = block.input || {};
18419
+ const toolUseId = block.id;
18463
18420
  toolCallMap.set(toolUseId, {
18464
18421
  messageIndex: messages.length,
18465
18422
  toolName,
@@ -18478,9 +18435,9 @@ function parseClaudeEvents(events, parentToolUseId) {
18478
18435
  nestedEvents
18479
18436
  }));
18480
18437
  } else if (COMMAND_TOOL_NAMES.has(toolName) || FILE_TOOL_NAMES.has(toolName)) {
18481
- messages.push(fileOrCommandMessage(block2, event.timestamp));
18438
+ messages.push(fileOrCommandMessage(block, event.timestamp));
18482
18439
  } else if (toolName === "TaskCreate" || toolName === "TaskUpdate" || toolName === "TaskList") {
18483
- taskAccumulator.processContentBlock(block2);
18440
+ taskAccumulator.processContentBlock(block);
18484
18441
  const snapshot = taskSnapshot();
18485
18442
  if (snapshot.length > 0) {
18486
18443
  messages.push({
@@ -19285,17 +19242,17 @@ function compactChatHistoryEvent(event, record) {
19285
19242
  ...payload,
19286
19243
  message: {
19287
19244
  ...payload.message,
19288
- content: payload.message.content.map((block2) => {
19289
- if (!isRecord(block2)) return block2;
19290
- if (block2.type === "image") return compactImage(block2);
19291
- if (block2.type !== "tool_result") return block2;
19292
- const text4 = extractToolResultText(block2.content);
19293
- if (isStructuredToolOutput(text4)) return block2;
19245
+ content: payload.message.content.map((block) => {
19246
+ if (!isRecord(block)) return block;
19247
+ if (block.type === "image") return compactImage(block);
19248
+ if (block.type !== "tool_result") return block;
19249
+ const text4 = extractToolResultText(block.content);
19250
+ if (isStructuredToolOutput(text4)) return block;
19294
19251
  const omitted = omit(text4);
19295
- if (omitted) return { ...block2, content: text4.slice(0, COMPACT_PREVIEW_CHARS), ...omitted };
19296
- if (!Array.isArray(block2.content) || !block2.content.some((part) => isRecord(part) && part.type === "image") || sizeOf(block2.content) <= COMPACT_BODY_MAX_BYTES) return block2;
19252
+ if (omitted) return { ...block, content: text4.slice(0, COMPACT_PREVIEW_CHARS), ...omitted };
19253
+ if (!Array.isArray(block.content) || !block.content.some((part) => isRecord(part) && part.type === "image") || sizeOf(block.content) <= COMPACT_BODY_MAX_BYTES) return block;
19297
19254
  compacted = true;
19298
- return { ...block2, content: text4 };
19255
+ return { ...block, content: text4 };
19299
19256
  })
19300
19257
  }
19301
19258
  };
@@ -19372,11 +19329,11 @@ function createSubagentHistoryFilter() {
19372
19329
  if (coerceBackgroundTaskPayload(payload)) return true;
19373
19330
  const blocks = normalizeContentBlocks(isRecord(payload.message) ? payload.message.content : void 0);
19374
19331
  if (type === "claude-assistant") {
19375
- const spawns = blocks.filter((block2) => block2.type === "tool_use" && block2.id && CLAUDE_SUBAGENT_TOOL_NAMES.has(block2.name ?? ""));
19376
- for (const block2 of spawns) if (block2.id) spawnIds.add(block2.id);
19332
+ const spawns = blocks.filter((block) => block.type === "tool_use" && block.id && CLAUDE_SUBAGENT_TOOL_NAMES.has(block.name ?? ""));
19333
+ for (const block of spawns) if (block.id) spawnIds.add(block.id);
19377
19334
  return spawns.length > 0;
19378
19335
  }
19379
- return type === "claude-user" && blocks.some((block2) => block2.type === "tool_result" && spawnIds.has(block2.tool_use_id ?? ""));
19336
+ return type === "claude-user" && blocks.some((block) => block.type === "tool_result" && spawnIds.has(block.tool_use_id ?? ""));
19380
19337
  };
19381
19338
  }
19382
19339
  function readChatSubagentHistory({ size, compact, readRange }) {
@@ -19420,15 +19377,15 @@ function canonicalizeChatTranscriptBlocks(content, provider2, senders, beforeMes
19420
19377
  const end = beforeMessageId === void 0 ? messages.length : messages.findIndex(({ id }) => id === beforeMessageId);
19421
19378
  if (end === -1) throw new Error("That message is no longer in the chat history");
19422
19379
  return messages.slice(0, end).flatMap((message2) => {
19423
- let block2 = null;
19380
+ let block = null;
19424
19381
  if (message2.type === "user") {
19425
- block2 = `## User${message2.senderEmail ? ` (${message2.senderEmail})` : ""}
19382
+ block = `## User${message2.senderEmail ? ` (${message2.senderEmail})` : ""}
19426
19383
  ${message2.content}`;
19427
19384
  } else if (message2.type === "agent") {
19428
- block2 = `## Agent
19385
+ block = `## Agent
19429
19386
  ${message2.content}`;
19430
19387
  } else if (message2.type === "reasoning") {
19431
- block2 = `## Agent reasoning (unverified)
19388
+ block = `## Agent reasoning (unverified)
19432
19389
  Timestamp: ${message2.sourceTimestamp ?? message2.timestamp}
19433
19390
  ${message2.content}`;
19434
19391
  } else {
@@ -19443,19 +19400,19 @@ ${activity.items.map((item) => `- [${item.status}] ${item.text}`).join("\n")}`);
19443
19400
  if (activity.content) details.push(`Details:
19444
19401
  ${activity.content}`);
19445
19402
  if (message2.type === "command" && message2.exitCode != null) details.push(`Exit: ${message2.exitCode}`);
19446
- block2 = `## Activity
19403
+ block = `## Activity
19447
19404
  ${activity.title}${details.length > 0 ? `
19448
19405
  ${details.join("\n")}` : ""}`;
19449
19406
  }
19450
19407
  }
19451
- if (!block2) return [];
19452
- return [redactSecrets(block2)];
19408
+ if (!block) return [];
19409
+ return [redactSecrets(block)];
19453
19410
  });
19454
19411
  }
19455
19412
  function lastUserBlockText(blocks) {
19456
- const block2 = blocks.findLast((entry) => entry.startsWith("## User"));
19457
- if (!block2) return null;
19458
- const body = block2.slice(block2.indexOf("\n") + 1).trim();
19413
+ const block = blocks.findLast((entry) => entry.startsWith("## User"));
19414
+ if (!block) return null;
19415
+ const body = block.slice(block.indexOf("\n") + 1).trim();
19459
19416
  return body || null;
19460
19417
  }
19461
19418
 
@@ -19640,7 +19597,7 @@ var VOICE_WAVEFORM = {
19640
19597
  };
19641
19598
 
19642
19599
  // ../shared/src/e2b.ts
19643
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-13-v2";
19600
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-13-v3";
19644
19601
 
19645
19602
  // ../shared/src/e2b-retry.ts
19646
19603
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -19655,7 +19612,7 @@ function isTransientE2BError(error) {
19655
19612
  if (!/(^|[^0-9])5\d{2}(\s|:)/.test(message2)) return false;
19656
19613
  return TRANSIENT_E2B_MESSAGE_PATTERNS.some((pattern) => pattern.test(message2));
19657
19614
  }
19658
- async function withE2BRetry(label2, fn, options = {}) {
19615
+ async function withE2BRetry(label, fn, options = {}) {
19659
19616
  const backoffs = options.backoffsMs ?? DEFAULT_BACKOFFS_MS;
19660
19617
  const retryable = options.retryable ?? isTransientE2BError;
19661
19618
  const logPrefix = options.logPrefix ?? "e2b";
@@ -19671,7 +19628,7 @@ async function withE2BRetry(label2, fn, options = {}) {
19671
19628
  }
19672
19629
  const delayMs = backoffs[attempt - 1] ?? 5e3;
19673
19630
  console.warn(
19674
- `[${logPrefix}] ${label2}: retryable failure (attempt ${attempt}/${attempts}), retrying in ${delayMs}ms: ${error instanceof Error ? error.message : String(error)}`
19631
+ `[${logPrefix}] ${label}: retryable failure (attempt ${attempt}/${attempts}), retrying in ${delayMs}ms: ${error instanceof Error ? error.message : String(error)}`
19675
19632
  );
19676
19633
  const waitStartedAt = performance.now();
19677
19634
  await new Promise((resolve) => setTimeout(resolve, delayMs));
@@ -20298,10 +20255,10 @@ function parseCommitArgs(args) {
20298
20255
  const arg = args[index];
20299
20256
  const long = /^--([\w-]+)(?:=([\s\S]*))?$/.exec(arg);
20300
20257
  if (long) {
20301
- const [, name, inline2] = long;
20258
+ const [, name, inline] = long;
20302
20259
  if (name === "amend") amend = true;
20303
20260
  if (!COMMIT_VALUE_OPTIONS.has(name)) continue;
20304
- const value = inline2 ?? args[++index] ?? "";
20261
+ const value = inline ?? args[++index] ?? "";
20305
20262
  if (name === "message") messages.push(value);
20306
20263
  else if (name === "file") file = value;
20307
20264
  else if (name === "trailer") trailers.push(value);
@@ -20334,12 +20291,12 @@ function parsePushArgs(args) {
20334
20291
  positionals.push(...args.slice(index + 1));
20335
20292
  break;
20336
20293
  } else if (long) {
20337
- const [, name, inline2] = long;
20294
+ const [, name, inline] = long;
20338
20295
  all ||= ["all", "mirror", "branches"].includes(name);
20339
20296
  tags ||= name === "tags";
20340
20297
  repo ||= name === "repo";
20341
20298
  if (["repo", "push-option", "receive-pack", "exec"].includes(name)) {
20342
- const value = inline2 ?? args[++index] ?? "";
20299
+ const value = inline ?? args[++index] ?? "";
20343
20300
  if (name === "push-option") options.push(value);
20344
20301
  }
20345
20302
  } else if (/^-[^-]/.test(arg)) {
@@ -21183,6 +21140,7 @@ var workspaceEventSchemaByType = z34.discriminatedUnion("type", [
21183
21140
  subagent: z34.object({ id: z34.string(), name: z34.string(), prUrl: z34.string().nullable() }),
21184
21141
  ts: z34.string()
21185
21142
  }),
21143
+ z34.object({ type: z34.literal("mothership.board.changed"), workspaceId: z34.string(), ts: z34.string() }),
21186
21144
  z34.object({ type: z34.literal("needs-you.changed"), workspaceId: z34.string().nullable(), userId: z34.string().optional(), ts: z34.string() }),
21187
21145
  z34.object({
21188
21146
  type: z34.literal("workspace.shared"),
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-PB5LGUTC.js";
7
- import "./chunk-RHYD6KJA.js";
8
- import "./chunk-TGP2OFJT.js";
6
+ } from "./chunk-DVU6R5AN.js";
7
+ import "./chunk-OQZLK6BN.js";
8
+ import "./chunk-55SJSOI2.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-X6NO2TJZ.js";
12
+ import "./chunk-XKXYQAIA.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -14,12 +14,12 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-SUDWZCA2.js";
17
+ } from "./chunk-II4H6RG2.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-33FJPHU6.js";
22
- import "./chunk-TGP2OFJT.js";
21
+ } from "./chunk-UEWCWES6.js";
22
+ import "./chunk-55SJSOI2.js";
23
23
  import {
24
24
  AGENT,
25
25
  OPENCODE_GO_PROVIDER,
@@ -29,7 +29,7 @@ import {
29
29
  headlessAgentUsagePath,
30
30
  isRecord,
31
31
  withTimeout
32
- } from "./chunk-X6NO2TJZ.js";
32
+ } from "./chunk-XKXYQAIA.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  evaluateCommandProtection,
28
28
  extractToolCommand,
29
29
  reportCommandProtectionBlock
30
- } from "./chunk-PB5LGUTC.js";
30
+ } from "./chunk-DVU6R5AN.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -65,10 +65,10 @@ import {
65
65
  spawnMuseMsp,
66
66
  startMuseSession,
67
67
  uuidV7
68
- } from "./chunk-SUDWZCA2.js";
68
+ } from "./chunk-II4H6RG2.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
- } from "./chunk-XMYRKBUV.js";
71
+ } from "./chunk-DOAFMAYL.js";
72
72
  import {
73
73
  ACCOUNT_RATE_LIMITS_READ_METHOD,
74
74
  AsyncLock,
@@ -143,7 +143,7 @@ import {
143
143
  timestampFromSeconds,
144
144
  upsertCredentialFileLines,
145
145
  writeSecureCredentialFile
146
- } from "./chunk-WYTSPCFP.js";
146
+ } from "./chunk-QOAJHPFJ.js";
147
147
  import {
148
148
  ENGINE_ENV,
149
149
  UNQUOTED_PATHS_CONFIG,
@@ -154,15 +154,15 @@ import {
154
154
  resolveDiffBase,
155
155
  setAgentCredentialSnapshot,
156
156
  setLinearSessionId
157
- } from "./chunk-RHYD6KJA.js";
157
+ } from "./chunk-OQZLK6BN.js";
158
158
  import {
159
159
  getCodexModelProvider
160
- } from "./chunk-33FJPHU6.js";
160
+ } from "./chunk-UEWCWES6.js";
161
161
  import {
162
162
  SUBPROCESS_MAX_BUFFER,
163
163
  execAsync,
164
164
  execFileAsync
165
- } from "./chunk-TGP2OFJT.js";
165
+ } from "./chunk-55SJSOI2.js";
166
166
  import {
167
167
  isRecord as isRecord2
168
168
  } from "./chunk-UZSNFLDQ.js";
@@ -443,7 +443,7 @@ import {
443
443
  workspaceTokenRequestSchema,
444
444
  workspaceTokenResponseSchema,
445
445
  wrapInTag
446
- } from "./chunk-X6NO2TJZ.js";
446
+ } from "./chunk-XKXYQAIA.js";
447
447
  import {
448
448
  cloneMcpConfig,
449
449
  ensureCompatibilityImports,
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-XMYRKBUV.js";
6
+ } from "./chunk-DOAFMAYL.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-X6NO2TJZ.js";
12
+ } from "./chunk-XKXYQAIA.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -11,7 +11,7 @@ import {
11
11
  spawnSubagentRequestSchema,
12
12
  subagentResponseSchema,
13
13
  waitSubagentRequestSchema
14
- } from "./chunk-X6NO2TJZ.js";
14
+ } from "./chunk-XKXYQAIA.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1493",
3
+ "version": "0.1.1494",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",