replicas-engine 0.1.1696 → 0.1.1700

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,13 +8,13 @@ import {
8
8
  listCodexModelsForDetails,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-7ORABTNV.js";
12
- import "./chunk-4OOGVEO3.js";
13
- import "./chunk-O5JMVETO.js";
14
- import "./chunk-XKA6VZSF.js";
15
- import "./chunk-TNE3QK42.js";
11
+ } from "./chunk-KF3MD76W.js";
12
+ import "./chunk-2UYPE3JQ.js";
13
+ import "./chunk-4IIA4LHK.js";
14
+ import "./chunk-YUTD43BJ.js";
15
+ import "./chunk-4RBWVNB4.js";
16
16
  import "./chunk-UZSNFLDQ.js";
17
- import "./chunk-LV6TPXQ7.js";
17
+ import "./chunk-BONRQV3P.js";
18
18
  import "./chunk-VEQXQN22.js";
19
19
  export {
20
20
  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
  SUBAGENT_MCP_TOOL_NAMES
6
- } from "./chunk-LV6TPXQ7.js";
6
+ } from "./chunk-BONRQV3P.js";
7
7
 
8
8
  // src/managers/subagent-mcp-config.ts
9
9
  import { existsSync } from "fs";
@@ -5,7 +5,7 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-O5JMVETO.js";
8
+ } from "./chunk-4IIA4LHK.js";
9
9
  import {
10
10
  COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
11
11
  COMMAND_PROTECTION_REPO_GIT_ARGS,
@@ -18,7 +18,7 @@ import {
18
18
  parseCommandProtectionRequest,
19
19
  toCommandProtectionRepoState,
20
20
  withRetry
21
- } from "./chunk-LV6TPXQ7.js";
21
+ } from "./chunk-BONRQV3P.js";
22
22
 
23
23
  // src/services/command-protection-service.ts
24
24
  import { readFile, stat } from "fs/promises";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-TNE3QK42.js";
7
+ } from "./chunk-4RBWVNB4.js";
8
8
  import {
9
9
  isRecord
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -21,7 +21,7 @@ import {
21
21
  provisionedDeviceSchema,
22
22
  readReplicasRuntimeEnv,
23
23
  serializePosixEnvFile
24
- } from "./chunk-LV6TPXQ7.js";
24
+ } from "./chunk-BONRQV3P.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -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-LV6TPXQ7.js";
6
+ } from "./chunk-BONRQV3P.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-7ZDAVYTV.js";
7
7
  import {
8
8
  AspClient
9
- } from "./chunk-XKA6VZSF.js";
9
+ } from "./chunk-YUTD43BJ.js";
10
10
  import {
11
11
  ASTER_BASE_URL,
12
12
  ASTER_PROVIDER,
@@ -18,7 +18,7 @@ import {
18
18
  isRecord,
19
19
  readOllamaAuthEnv,
20
20
  readOpenAICompatibleAuthEnv
21
- } from "./chunk-LV6TPXQ7.js";
21
+ } from "./chunk-BONRQV3P.js";
22
22
 
23
23
  // src/managers/codex-asp/notification-dispatch.ts
24
24
  var TURN_STARTED_METHOD = "turn/started";
@@ -16436,29 +16436,6 @@ function stripAgentInstructionBlocks(text4) {
16436
16436
  else spans(prose, text4.length);
16437
16437
  return stripInstructionBlocksOutside(text4, quoted);
16438
16438
  }
16439
- var managerEventChatNote = (then) => `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 ${then}end with a one-line note.`;
16440
- var MANAGER_EVENT_CHAT_NOTE = managerEventChatNote("update the board if its order, notes or overview changed, and ");
16441
- var BOARD_ANSWER_NOTE = "The user answered on the board.";
16442
- var MANAGER_ISSUE_EVENT_CHAT_NOTE = managerEventChatNote("");
16443
- var MERGE_RULE = `- 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.`;
16444
- var chatRule = (view, news) => `- The chat is like texting an assistant. In a turn the user typed, they see the text you write between tool calls as it streams, your final reply, what you send with \`${REPLICAS_MCP_TOOLS.sendToChat}\`, and your \`${REPLICAS_MCP_TOOLS.setStatus}\` line, never your tool calls. Unless you can answer right away, open with one line on what you'll do first and roughly how long it takes. Then call \`${REPLICAS_MCP_TOOLS.setStatus}\` with a few words on your current step, such as "Reading the billing webhook", and again each time you move to a new step. Before your final reply, write only what they'd want to know now: ${news}. Never narrate tool calls or say you're still working. When they message you mid-turn, reply in one line before anything else, then fold it into your work. Write in a line or two with links and any media inline, and never restate ${view} in chat.`;
16445
- var BOARD_RULES = `- The board in the Ships pane beside this chat is the user's one view of the work: one ticket per task they ask for, holding only that task's pull requests. Replicas fills in each ticket's title, summaries, section and pull requests from the task, the ship's reports and its pull requests, so never restate what a ticket shows, and correct one with \`${REPLICAS_MCP_TOOLS.updateBoard}\` only when it's wrong.
16446
- - Keep the board organized with \`${REPLICAS_MCP_TOOLS.updateBoard}\`: tickets in order, most important first; one short note per ticket only when it adds something, such as "Merge after #12"; and one overview line on where the work as a whole stands. Archive tickets the user no longer needs.
16447
- - 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.
16448
- - 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.
16449
- ${MERGE_RULE}
16450
- - On every ship event and board answer, act with tools on whatever it unblocks, such as starting the next task once a pull request merges, and update the board if it changed. The user sees nothing you write in these turns unless a message they typed is still unanswered; otherwise reach them only with \`${REPLICAS_MCP_TOOLS.sendToChat}\`, and only for what they'd want right now: a deliverable they asked for, with its media, links or answer; a blocker that needs them, also on the board; or a request of theirs being done. Never for status, such as "PR #12 merged" or "I asked the ship to\u2026". End the turn with a one-line note of what you did.
16451
- ${chatRule("the board", "a finding that changes the answer, a ship you started, or a decision you need")}
16452
- `;
16453
- var ISSUE_RULES = `- Your work lives in issues in your slice of the organization's Issues, which the Issues tab beside this chat shows the user. Before delegating, turn a request into issues with \`replicas issue create\`: one per independent task, so five small bugs are five issues, and a parent with sub-issues for a big project. Reuse an issue the request is about; find it with \`replicas issue list\`. A title says what the task is about, never a ship, branch or pull request name.
16454
- - Spawn ships with \`issue\`, and pass \`issue\` to \`${REPLICAS_MCP_TOOLS.messageSubagent}\` to point a ship at another one: it is assigned, subscribed and told. Several ships can share an issue. Replicas moves an issue to In progress when a ship starts it. Ships link their pull requests with \`replicas issue link-pr\`, move the issue to Review themselves, and comment their progress, so never restate what an issue shows. Linked pull requests then move the status: Replicas moves an issue to Approved when every linked pull request is approved, and to Done when every one is merged, and each move reaches you as an \`<issue_event>\`. Nothing links on its own, so when a ship is asleep, link its pull request yourself if it isn't linked, and move the issue back when a move isn't really true. Give a ship one issue per pull request where you can. Statuses mean exactly this: In progress, work underway (a failing check, conflicts, review comments to answer, missing work, or waiting on another pull request); Review, waiting only on a person, with a linked pull request open, no conflicts and nothing failing (CI rerunning after a push is fine), and the person who must review or approve it assigned (move it back to In progress only for a conflict, a failing check or missing work, never just because something was pushed, so issues don't bounce); Approved, every linked pull request approved but not yet merged or live; Done, every linked pull request it needs merged (and deployed when that matters) and nothing left; Canceled, dropped, with a comment saying why. Keep every property true at all times: status, assignee, linked pull requests (link only the pull requests that do this issue's work; unlink wrong ones with \`replicas issue unlink-pr\` or the app), and the description, when the plan changes. Before ending a turn, check that your issues' statuses match reality, including those of ships that are asleep. Order, reprioritize or cancel issues with \`replicas issue update\`.
16455
- - You are subscribed to every issue in your slice: comments and changes by ships and people arrive as \`<issue_event>\` blocks. Act on them like ship events. Ships assigned to an issue get its comments too, so never relay a comment to them; pass it only to a ship that isn't on the issue.
16456
- - 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 decision or merge only they can give, assign them to the issue with \`replicas issue assign\` and comment the question with \`replicas issue comment\`; their reply comes back as an \`<issue_event>\`. Once they answer a question you asked, unassign them with \`replicas issue unassign\` so the issue leaves their "Assigned to you"; they stay subscribed. Ships ask and unassign for their own questions, so leave those to them.
16457
- - 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 assign the user only if you can't decide. On \`ready\` for a pull request that needs a person's review, assign the user with a one-line comment.
16458
- ${MERGE_RULE}
16459
- - On every ship and issue event, act with tools on whatever it unblocks, such as starting the next task once a pull request merges. The user sees nothing you write in these turns unless a message they typed is still unanswered; otherwise reach them only with \`${REPLICAS_MCP_TOOLS.sendToChat}\`, and only for what they'd want right now: a deliverable they asked for, with its media, links or answer; a blocker that needs them, also assigned to them on its issue; or a request of theirs being done. Never for status, such as "PR #12 merged" or "I asked the ship to\u2026". End the turn with a one-line note of what you did, or only \`No action needed.\` when an issue event needs nothing from you.
16460
- ${chatRule("the Issues tab", "the issues you created, a ship you started, a finding that changes the answer, or a decision you need")}
16461
- `;
16462
16439
  function splitTaggedBlock(text4, tag) {
16463
16440
  const match = text4?.match(new RegExp(`\\s*<${tag}>\\n([\\s\\S]*?)\\n</${tag}>`));
16464
16441
  return { rest: match ? text4?.replace(match[0], "").trim() || void 0 : text4, block: match?.[1] };
@@ -16471,8 +16448,6 @@ function splitTurnInstructions(customInstructions) {
16471
16448
  const { rest, block } = splitTaggedBlock(customInstructions, TURN_INSTRUCTIONS_TAG);
16472
16449
  return { customInstructions: rest, turnInstructions: block };
16473
16450
  }
16474
- var MANAGER_TICKET_MESSAGE_NOTE = `The user sent this from your ticket on the Manager's board and reads your answer there, not in this chat. Answer them with \`${REPLICAS_MCP_TOOLS.replyOnTicket}\`: briefly, with a link or screenshot if it helps, and a follow-up question only if you need one. Keep longer work and detail in this chat.`;
16475
- var MANAGER_TICKET_REPLY_NUDGE = `The user is still waiting for your answer on your ticket, and they only read the ticket. Answer them now with \`${REPLICAS_MCP_TOOLS.replyOnTicket}\`, briefly.`;
16476
16451
  var T = REPLICAS_MCP_TOOLS;
16477
16452
  var SCOUT_LINEAR_RULES = `Linear issue triage: team instructions define what is actionable. Use \`replicas.linear.graphql\` from \`@replicas/sdk\` for every Linear read and mutation, never a Replicas CLI command. Choose exactly one:
16478
16453
  1. **Ignore** issues the team instructions leave to humans or that should not start work: do nothing and write nothing to Linear. If \`agent_session_id\` is set because you asked a question earlier, create a \`response\` Agent Activity on it with one short closing response.
@@ -16484,6 +16459,25 @@ var SCOUT_PRIOR_UNTAGGED_RULES = `\`prior_untagged_ignored=<ts>\`: the untagged
16484
16459
  var SCOUT_JOINED_RULES = `\`event=joined\`: you were just added to this channel; reply in this envelope's thread. If the channel's name or purpose points to a clear role (#triage, #bugs, #incidents, #support, #customer-*, a customer's shared channel), follow **Channel instructions** in the \`${SCOUT_SETTINGS_SKILL_NAME}\` skill to offer one concrete behavior. Otherwise do nothing at all.`;
16485
16460
  var SCOUT_REACTION_RULES = `\`event=reaction:\u2026\`: someone reacted to a message you posted. A thumbs-down or similar on a reply you posted unasked is frustration: follow **Frustration** in the \`${SCOUT_SETTINGS_SKILL_NAME}\` skill. On a reply someone asked for, it is about the answer: leave it. Otherwise do nothing.`;
16486
16461
 
16462
+ // ../shared/src/manager-prompts-common.ts
16463
+ var managerEventChatNote = (then) => `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 ${then}end with a one-line note.`;
16464
+ var managerChatRule = (view, news) => `- The chat is like texting an assistant. In a turn the user typed, they see the text you write between tool calls as it streams, your final reply, what you send with \`${REPLICAS_MCP_TOOLS.sendToChat}\`, and your \`${REPLICAS_MCP_TOOLS.setStatus}\` line, never your tool calls. Unless you can answer right away, open with one line on what you'll do first and roughly how long it takes. Then call \`${REPLICAS_MCP_TOOLS.setStatus}\` with a few words on your current step, such as "Reading the billing webhook", and again each time you move to a new step. Before your final reply, write only what they'd want to know now: ${news}. Never narrate tool calls or say you're still working. When they message you mid-turn, reply in one line before anything else, then fold it into your work. Write in a line or two with links and any media inline, and never restate ${view} in chat.`;
16465
+
16466
+ // ../shared/src/manager-prompts-legacy.ts
16467
+ var MANAGER_EVENT_CHAT_NOTE = managerEventChatNote("update the board if its order, notes or overview changed, and ");
16468
+ var BOARD_ANSWER_NOTE = "The user answered on the board.";
16469
+ var MERGE_RULE = `- 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.`;
16470
+ var BOARD_RULES = `- The board in the Ships pane beside this chat is the user's one view of the work: one ticket per task they ask for, holding only that task's pull requests. Replicas fills in each ticket's title, summaries, section and pull requests from the task, the ship's reports and its pull requests, so never restate what a ticket shows, and correct one with \`${REPLICAS_MCP_TOOLS.updateBoard}\` only when it's wrong.
16471
+ - Keep the board organized with \`${REPLICAS_MCP_TOOLS.updateBoard}\`: tickets in order, most important first; one short note per ticket only when it adds something, such as "Merge after #12"; and one overview line on where the work as a whole stands. Archive tickets the user no longer needs.
16472
+ - 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.
16473
+ - 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.
16474
+ ${MERGE_RULE}
16475
+ - On every ship event and board answer, act with tools on whatever it unblocks, such as starting the next task once a pull request merges, and update the board if it changed. The user sees nothing you write in these turns unless a message they typed is still unanswered; otherwise reach them only with \`${REPLICAS_MCP_TOOLS.sendToChat}\`, and only for what they'd want right now: a deliverable they asked for, with its media, links or answer; a blocker that needs them, also on the board; or a request of theirs being done. Never for status, such as "PR #12 merged" or "I asked the ship to\u2026". End the turn with a one-line note of what you did.
16476
+ ${managerChatRule("the board", "a finding that changes the answer, a ship you started, or a decision you need")}
16477
+ `;
16478
+ var MANAGER_TICKET_MESSAGE_NOTE = `The user sent this from your ticket on the Manager's board and reads your answer there, not in this chat. Answer them with \`${REPLICAS_MCP_TOOLS.replyOnTicket}\`: briefly, with a link or screenshot if it helps, and a follow-up question only if you need one. Keep longer work and detail in this chat.`;
16479
+ var MANAGER_TICKET_REPLY_NUDGE = `The user is still waiting for your answer on your ticket, and they only read the ticket. Answer them now with \`${REPLICAS_MCP_TOOLS.replyOnTicket}\`, briefly.`;
16480
+
16487
16481
  // ../shared/src/message-origin.ts
16488
16482
  var UUID = UUID_RE.source.slice(1, -1);
16489
16483
  var WORKSPACE_SENDER = new RegExp(String.raw`^\s*<${REPLICAS_INSTRUCTIONS_TAG}>\nFrom the workspace ("(?:[^"\\\n]|\\.)*") \((${UUID})\)\.\n</${REPLICAS_INSTRUCTIONS_TAG}>`);
@@ -20800,15 +20794,22 @@ function applyInterruptions(messages, events) {
20800
20794
  }
20801
20795
  function applyEngineNotices(messages, events) {
20802
20796
  const notices = [];
20803
- events.forEach((event, index) => {
20797
+ const sameTime = /* @__PURE__ */ new Map();
20798
+ const noticeId = (kind, timestamp2) => {
20799
+ const id = `${kind}-${timestamp2}`;
20800
+ const ordinal2 = sameTime.get(id) ?? 0;
20801
+ sameTime.set(id, ordinal2 + 1);
20802
+ return `${id}-${ordinal2}`;
20803
+ };
20804
+ events.forEach((event) => {
20804
20805
  if (event.type === MANAGER_EVENT_TYPE) {
20805
20806
  const parsed = typeof event.payload.text === "string" ? parseManagerEvents(event.payload.text) : null;
20806
- if (parsed) notices.push({ id: `multitask-event-${event.timestamp}-${index}`, type: "multitask_event", events: parsed, timestamp: event.timestamp });
20807
+ if (parsed) notices.push({ id: noticeId("multitask-event", event.timestamp), type: "multitask_event", events: parsed, timestamp: event.timestamp });
20807
20808
  return;
20808
20809
  }
20809
20810
  if (event.type === CHAT_MESSAGE_REJECTED_EVENT_TYPE) {
20810
20811
  notices.push({
20811
- id: `message-rejected-${event.timestamp}-${index}`,
20812
+ id: noticeId("message-rejected", event.timestamp),
20812
20813
  type: "error",
20813
20814
  message: typeof event.payload.message === "string" ? event.payload.message : "Message was rejected",
20814
20815
  rejectedMessageId: typeof event.payload[REJECTED_MESSAGE_ID_PAYLOAD_KEY] === "string" ? event.payload[REJECTED_MESSAGE_ID_PAYLOAD_KEY] : void 0,
@@ -20819,7 +20820,7 @@ function applyEngineNotices(messages, events) {
20819
20820
  }
20820
20821
  if (event.type === CHAT_TURN_LOST_EVENT_TYPE) {
20821
20822
  notices.push({
20822
- id: `turn-lost-${event.timestamp}-${index}`,
20823
+ id: noticeId("turn-lost", event.timestamp),
20823
20824
  type: "error",
20824
20825
  message: CHAT_TURN_LOST_MESSAGE,
20825
20826
  timestamp: event.timestamp
@@ -20831,7 +20832,7 @@ function applyEngineNotices(messages, events) {
20831
20832
  if (!payload) return;
20832
20833
  notices.push({
20833
20834
  ...payload,
20834
- id: `auth-fallback-${event.timestamp}-${index}`,
20835
+ id: noticeId("auth-fallback", event.timestamp),
20835
20836
  type: "auth_fallback",
20836
20837
  timestamp: event.timestamp
20837
20838
  });
@@ -21655,7 +21656,7 @@ async function withRetry(label, fn, options) {
21655
21656
  }
21656
21657
 
21657
21658
  // ../shared/src/tensorlake.ts
21658
- var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-20-v53";
21659
+ var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-20-v58";
21659
21660
  var TENSORLAKE_DISK_MB = 100 * 1024;
21660
21661
 
21661
21662
  // ../shared/src/egress.ts
@@ -22024,6 +22025,9 @@ var MAC_KEY_LABELS = {
22024
22025
  };
22025
22026
  var OTHER_KEY_LABELS = { ...MAC_KEY_LABELS, Enter: "Enter", Tab: "Tab", Backspace: "Backspace", Shift: "Shift", Alt: "Alt", Mod: "Ctrl" };
22026
22027
 
22028
+ // ../shared/src/manager-prompts-issues.ts
22029
+ var ISSUES_MANAGER_EVENT_CHAT_NOTE = managerEventChatNote("");
22030
+
22027
22031
  // ../shared/src/image-attachments.ts
22028
22032
  var MAX_LONG_EDGE = 2576;
22029
22033
  var MAX_PIXELS = 375e4;
@@ -22359,7 +22363,7 @@ function isClaudeAuthErrorText(text4) {
22359
22363
  function isCodexAuthError(error) {
22360
22364
  const msg = error instanceof Error ? error.message : String(error);
22361
22365
  const lower = msg.toLowerCase();
22362
- return isAuthenticationErrorText(msg) || lower.includes("authentication") || lower.includes("incorrect api key") || lower.includes("api key") && lower.includes("invalid") || lower.includes("401") || lower.includes('codexerrorinfo="unauthorized"') || lower.includes("codexerrorinfo=unauthorized") || lower.includes("failed to refresh token") || lower.includes("your session has ended");
22366
+ return isAuthenticationErrorText(msg) || lower.includes("authentication") || lower.includes("incorrect api key") || lower.includes("api key") && lower.includes("invalid") || /"httpstatuscode":401\b/.test(lower) || lower.includes('codexerrorinfo="unauthorized"') || lower.includes("codexerrorinfo=unauthorized") || lower.includes("failed to refresh token") || lower.includes("your session has ended");
22363
22367
  }
22364
22368
 
22365
22369
  // ../shared/src/muse-auth.ts
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-LV6TPXQ7.js";
8
+ } from "./chunk-BONRQV3P.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-7ZDAVYTV.js";
7
7
  import {
8
8
  engineScriptProcess
9
- } from "./chunk-4OOGVEO3.js";
9
+ } from "./chunk-2UYPE3JQ.js";
10
10
  import {
11
11
  isRecord
12
12
  } from "./chunk-UZSNFLDQ.js";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  subagentCodexMcpConfig
6
- } from "./chunk-4OOGVEO3.js";
6
+ } from "./chunk-2UYPE3JQ.js";
7
7
  import {
8
8
  ENGINE_ENV,
9
9
  UNQUOTED_PATHS_CONFIG,
@@ -15,15 +15,15 @@ import {
15
15
  resolveDiffBase,
16
16
  runGitCommand,
17
17
  setAgentCredentialSnapshot
18
- } from "./chunk-O5JMVETO.js";
18
+ } from "./chunk-4IIA4LHK.js";
19
19
  import {
20
20
  AppServerProcess,
21
21
  buildCodexAgentEnv
22
- } from "./chunk-XKA6VZSF.js";
22
+ } from "./chunk-YUTD43BJ.js";
23
23
  import {
24
24
  SUBPROCESS_MAX_BUFFER,
25
25
  execFileAsync
26
- } from "./chunk-TNE3QK42.js";
26
+ } from "./chunk-4RBWVNB4.js";
27
27
  import {
28
28
  isRecord
29
29
  } from "./chunk-UZSNFLDQ.js";
@@ -63,7 +63,7 @@ import {
63
63
  shrunkImageSize,
64
64
  splitManagerInstructions,
65
65
  withTimeout
66
- } from "./chunk-LV6TPXQ7.js";
66
+ } from "./chunk-BONRQV3P.js";
67
67
 
68
68
  // src/managers/codex-token-manager.ts
69
69
  import { promises as fs } from "fs";
@@ -463,7 +463,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
463
463
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
464
464
  await this.applyCredentialsResponse(data);
465
465
  setAgentCredentialSnapshot("codex", data);
466
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-KQGRENES.js");
466
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-UZCWDFTA.js");
467
467
  await restartCodexAspHostIfRunning2();
468
468
  });
469
469
  await this.start(true);
@@ -485,7 +485,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
485
485
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
486
486
  await this.applyCredentialsResponse(data);
487
487
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
488
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-KQGRENES.js");
488
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-UZCWDFTA.js");
489
489
  await restartCodexAspHostIfRunning2();
490
490
  }
491
491
  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-TNE3QK42.js";
6
+ } from "./chunk-4RBWVNB4.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-LV6TPXQ7.js";
9
+ } from "./chunk-BONRQV3P.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -244,7 +244,7 @@ function getCodexModelProvider(method) {
244
244
  if (method === "foundry") return "azure";
245
245
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
246
246
  }
247
- var ENGINE_PACKAGE_VERSION = "0.1.1696";
247
+ var ENGINE_PACKAGE_VERSION = "0.1.1700";
248
248
  var INITIALIZE_METHOD = "initialize";
249
249
  var INITIALIZED_NOTIFICATION = "initialized";
250
250
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -4,15 +4,15 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  getManagedPiMcpServers,
6
6
  managedMcpServerProcess
7
- } from "./chunk-TI72IE3Z.js";
7
+ } from "./chunk-IO54MNKJ.js";
8
8
  import "./chunk-7ZDAVYTV.js";
9
- import "./chunk-4OOGVEO3.js";
9
+ import "./chunk-2UYPE3JQ.js";
10
10
  import {
11
11
  isRecord
12
12
  } from "./chunk-UZSNFLDQ.js";
13
13
  import {
14
14
  rankToolsByQuery
15
- } from "./chunk-LV6TPXQ7.js";
15
+ } from "./chunk-BONRQV3P.js";
16
16
  import "./chunk-VEQXQN22.js";
17
17
 
18
18
  // src/codemode-mcp.ts
@@ -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-KJNDG5RY.js";
7
- import "./chunk-O5JMVETO.js";
8
- import "./chunk-TNE3QK42.js";
6
+ } from "./chunk-2Z55GTLE.js";
7
+ import "./chunk-4IIA4LHK.js";
8
+ import "./chunk-4RBWVNB4.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-LV6TPXQ7.js";
12
+ import "./chunk-BONRQV3P.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -14,13 +14,13 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-FHNMJBRB.js";
17
+ } from "./chunk-7KSPT62G.js";
18
18
  import "./chunk-7ZDAVYTV.js";
19
19
  import {
20
20
  AppServerProcess,
21
21
  buildCodexAgentEnv
22
- } from "./chunk-XKA6VZSF.js";
23
- import "./chunk-TNE3QK42.js";
22
+ } from "./chunk-YUTD43BJ.js";
23
+ import "./chunk-4RBWVNB4.js";
24
24
  import {
25
25
  AGENT,
26
26
  OPENCODE_GO_PROVIDER,
@@ -30,7 +30,7 @@ import {
30
30
  headlessAgentUsagePath,
31
31
  isRecord,
32
32
  withTimeout
33
- } from "./chunk-LV6TPXQ7.js";
33
+ } from "./chunk-BONRQV3P.js";
34
34
  import "./chunk-VEQXQN22.js";
35
35
 
36
36
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -90,12 +90,12 @@ import {
90
90
  import {
91
91
  getManagedPiMcpServers,
92
92
  managedMcpServerProcess
93
- } from "./chunk-TI72IE3Z.js";
93
+ } from "./chunk-IO54MNKJ.js";
94
94
  import {
95
95
  evaluateCommandProtection,
96
96
  extractToolCommand,
97
97
  reportCommandProtectionBlock
98
- } from "./chunk-KJNDG5RY.js";
98
+ } from "./chunk-2Z55GTLE.js";
99
99
  import {
100
100
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
101
101
  AGENT_MESSAGE_DELTA_METHOD,
@@ -129,7 +129,7 @@ import {
129
129
  spawnMuseMsp,
130
130
  startMuseSession,
131
131
  uuidV7
132
- } from "./chunk-FHNMJBRB.js";
132
+ } from "./chunk-7KSPT62G.js";
133
133
  import {
134
134
  MUSE_AUTH_PATH,
135
135
  OPENCODE_AUTH_PATH,
@@ -137,7 +137,7 @@ import {
137
137
  } from "./chunk-7ZDAVYTV.js";
138
138
  import {
139
139
  publishedPullRequestUrls
140
- } from "./chunk-KTJEFLNI.js";
140
+ } from "./chunk-GQOYWYVG.js";
141
141
  import {
142
142
  ACCOUNT_RATE_LIMITS_READ_METHOD,
143
143
  AsyncLock,
@@ -215,12 +215,12 @@ import {
215
215
  transcriptSecrets,
216
216
  upsertCredentialFileLines,
217
217
  writeSecureCredentialFile
218
- } from "./chunk-7ORABTNV.js";
218
+ } from "./chunk-KF3MD76W.js";
219
219
  import {
220
220
  SUBAGENT_MCP_TOOL_TIMEOUT_MS,
221
221
  engineScriptProcess,
222
222
  subagentMcpProcessConfig
223
- } from "./chunk-4OOGVEO3.js";
223
+ } from "./chunk-2UYPE3JQ.js";
224
224
  import {
225
225
  ENGINE_ENV,
226
226
  UNQUOTED_PATHS_CONFIG,
@@ -231,18 +231,18 @@ import {
231
231
  resolveDiffBase,
232
232
  setAgentCredentialSnapshot,
233
233
  setLinearSessionId
234
- } from "./chunk-O5JMVETO.js";
234
+ } from "./chunk-4IIA4LHK.js";
235
235
  import {
236
236
  AspRequestTimeoutError,
237
237
  AspResponseError,
238
238
  buildCodexAgentEnv,
239
239
  getCodexModelProvider
240
- } from "./chunk-XKA6VZSF.js";
240
+ } from "./chunk-YUTD43BJ.js";
241
241
  import {
242
242
  SUBPROCESS_MAX_BUFFER,
243
243
  execAsync,
244
244
  execFileAsync
245
- } from "./chunk-TNE3QK42.js";
245
+ } from "./chunk-4RBWVNB4.js";
246
246
  import {
247
247
  isRecord
248
248
  } from "./chunk-UZSNFLDQ.js";
@@ -543,7 +543,7 @@ import {
543
543
  workspaceTokenRequestSchema,
544
544
  workspaceTokenResponseSchema,
545
545
  wrapInTag
546
- } from "./chunk-LV6TPXQ7.js";
546
+ } from "./chunk-BONRQV3P.js";
547
547
  import {
548
548
  __commonJS,
549
549
  __export,
@@ -11793,6 +11793,9 @@ var MessageQueueService = class {
11793
11793
  isStopped(signal) {
11794
11794
  return this.stoppedTurns.has(signal);
11795
11795
  }
11796
+ isRequeued(signal) {
11797
+ return this.activeTurn?.controller.signal === signal && this.activeTurn.requeueAfter !== void 0;
11798
+ }
11796
11799
  markDelivered() {
11797
11800
  if (this.activeTurn) this.activeTurn.delivered = true;
11798
11801
  }
@@ -11906,6 +11909,8 @@ var CodingAgentManager = class _CodingAgentManager {
11906
11909
  steerSettlements = /* @__PURE__ */ new Set();
11907
11910
  earlySteers = [];
11908
11911
  withdrawnSteers = /* @__PURE__ */ new WeakSet();
11912
+ // The agent can still read a steer while a Stop that took it waits on the agent.
11913
+ steersBeingStopped = /* @__PURE__ */ new Map();
11909
11914
  earlySteerDelivery = new AsyncLock();
11910
11915
  turnOpen = false;
11911
11916
  // The chat places a message and times its turn by the harness's record of it, which is written only once the agent has the message, so that record keeps this time.
@@ -12016,7 +12021,7 @@ var CodingAgentManager = class _CodingAgentManager {
12016
12021
  const { request: delivered, senderKey } = this.withSenderLine(request);
12017
12022
  const stopped = signal.aborted;
12018
12023
  if (!stopped) this.harnessTurns.add(signal);
12019
- if (stopped && (request.engineTurn || this.isStopped(signal) || !await this.keepStoppedRequest(delivered, signal))) return;
12024
+ if (stopped && (request.engineTurn || this.isStopped(signal) || this.isRequeued(signal) || !await this.keepStoppedRequest(delivered, signal))) return;
12020
12025
  await this.saveLastSenderKey(senderKey);
12021
12026
  if (stopped) return;
12022
12027
  const takesNotes = takesTurnNotes(request);
@@ -12075,6 +12080,10 @@ var CodingAgentManager = class _CodingAgentManager {
12075
12080
  return { sent: Promise.resolve([]), putBack: () => {
12076
12081
  } };
12077
12082
  }
12083
+ /** Whether this message's turn takes along a message the agent was not given. When it cannot, that message runs again after it. */
12084
+ carriesKeptRequests(_request) {
12085
+ return false;
12086
+ }
12078
12087
  oweNotes(message) {
12079
12088
  const notes = this.turnNotes.get(message);
12080
12089
  if (!notes) return;
@@ -12085,6 +12094,10 @@ var CodingAgentManager = class _CodingAgentManager {
12085
12094
  isStopped(signal) {
12086
12095
  return !!signal && this.messageQueue.isStopped(signal);
12087
12096
  }
12097
+ /** Its message runs again after the one that cut it, so nothing of this turn is kept or written to the chat. */
12098
+ isRequeued(signal) {
12099
+ return !!signal && this.messageQueue.isRequeued(signal);
12100
+ }
12088
12101
  // A harness calls this with nothing awaited before it hands the message over, or a Stop in between would still send a withdrawn message.
12089
12102
  deliver(signal) {
12090
12103
  if (signal.aborted) return false;
@@ -12139,8 +12152,8 @@ ${request.message}` }, senderKey };
12139
12152
  const requested = requestedStoppedAt ? Date.parse(requestedStoppedAt) : NaN;
12140
12153
  const stoppedAt = new Date(requested <= now && requested > now - MAX_REQUESTED_STOP_AGE_MS ? requested : now).toISOString();
12141
12154
  const queuedMessages = this.messageQueue.drainQueue();
12142
- const unreadSteers = [...this.unreadSteers.values()];
12143
- const steersInFlight = [...this.steersInFlight.values()].filter(({ read }) => !read);
12155
+ let unreadSteers = [...this.unreadSteers.values()];
12156
+ let steersInFlight = [...this.steersInFlight.values()].filter(({ read }) => !read);
12144
12157
  for (const { message } of steersInFlight) this.steersInFlight.delete(message.id);
12145
12158
  const earlySteers = this.earlySteers.splice(0);
12146
12159
  for (const steer of [...earlySteers, ...steersInFlight.map(({ delivered }) => delivered)]) this.withdrawnSteers.add(steer);
@@ -12150,6 +12163,7 @@ ${request.message}` }, senderKey };
12150
12163
  const turn = this.messageQueue.cancelActiveTurn(true);
12151
12164
  const kept = this.takeKeptRequests();
12152
12165
  const isProcessing = this.isProcessing() || (this.hasActiveBackgroundTasks?.() ?? false);
12166
+ for (const { message, delivered } of [...unreadSteers, ...steersInFlight]) this.steersBeingStopped.set(message.id, delivered);
12153
12167
  let failure = null;
12154
12168
  if (isProcessing) {
12155
12169
  try {
@@ -12158,8 +12172,15 @@ ${request.message}` }, senderKey };
12158
12172
  failure = { error };
12159
12173
  }
12160
12174
  }
12161
- const keptRequests = await kept.sent;
12162
- const withdrawn = turn && !turn.message.engineTurn && !turn.delivered && !await this.readStoppedMessage(turn.controller.signal) ? [turn.message] : [];
12175
+ let keptRequests;
12176
+ let withdrawn;
12177
+ try {
12178
+ keptRequests = await kept.sent;
12179
+ withdrawn = turn && !turn.message.engineTurn && !turn.delivered && !await this.readStoppedMessage(turn.controller.signal) ? [turn.message] : [];
12180
+ } finally {
12181
+ unreadSteers = unreadSteers.filter(({ message }) => this.steersBeingStopped.delete(message.id));
12182
+ steersInFlight = steersInFlight.filter(({ message }) => this.steersBeingStopped.delete(message.id));
12183
+ }
12163
12184
  if (failure && withdrawn.length === 0) {
12164
12185
  kept.putBack();
12165
12186
  for (const steer of unreadSteers) this.unreadSteers.set(steer.message.id, steer);
@@ -12330,7 +12351,7 @@ ${request.message}` }, senderKey };
12330
12351
  if (!taken) return { success: true, queue: this.getQueue() };
12331
12352
  this.messageQueue.restoreToQueue(taken.message, 0);
12332
12353
  if (this.messageQueue.isProcessing() && !this.messageQueue.stoppedTurn()) {
12333
- const requeued = this.keepStoppedRequest === _CodingAgentManager.prototype.keepStoppedRequest ? this.messageQueue.requeueActiveTurnAfter(messageId) : null;
12354
+ const requeued = this.carriesKeptRequests(taken.message) ? null : this.messageQueue.requeueActiveTurnAfter(messageId);
12334
12355
  if (requeued) {
12335
12356
  this.oweNotes(requeued.message);
12336
12357
  this.onMessageRequeued(requeued.message, requeued.afterId);
@@ -12371,7 +12392,9 @@ ${request.message}` }, senderKey };
12371
12392
  inFlight.read = true;
12372
12393
  this.onQueueChanged();
12373
12394
  }
12374
- return steer?.delivered ?? inFlight?.delivered ?? this.messageQueue.takeFromQueue(messageId)?.message;
12395
+ const beingStopped = this.steersBeingStopped.get(messageId);
12396
+ this.steersBeingStopped.delete(messageId);
12397
+ return steer?.delivered ?? inFlight?.delivered ?? beingStopped ?? this.messageQueue.takeFromQueue(messageId)?.message;
12375
12398
  }
12376
12399
  settlePromptStart() {
12377
12400
  this.promptStart?.resolve();
@@ -13679,6 +13702,10 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13679
13702
  async dropRecordedUnreadPrompt() {
13680
13703
  if (this.unreadPrompt && await this.promptRecorded(this.unreadPrompt.uuid)) this.unreadPrompt = null;
13681
13704
  }
13705
+ // Claude Code makes everything sent with a slash command part of that command's own entry, which the model does not answer.
13706
+ carriesKeptRequests(request) {
13707
+ return takesTurnNotes(request);
13708
+ }
13682
13709
  async readStoppedMessage(signal) {
13683
13710
  return this.sentPrompt?.signal === signal && this.promptRecorded(this.sentPrompt.uuid);
13684
13711
  }
@@ -14358,7 +14385,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14358
14385
  }
14359
14386
  await this.dropRecordedUnreadPrompt();
14360
14387
  const prompt = goalCommand ? [{ type: "text", text: `/goal ${goalObjective ?? "clear"}` }] : userMessage.message.content;
14361
- const notedCutOffs = [...this.cutOffTools.keys()];
14388
+ const takesUnread = this.carriesKeptRequests(request);
14389
+ const notedCutOffs = takesUnread ? [...this.cutOffTools.keys()] : [];
14362
14390
  const cutOffNote = notedCutOffs.length > 0 ? [{
14363
14391
  type: "text",
14364
14392
  text: wrapInTag(`The user pressed Stop while these tool calls were running: ${[...new Set(this.cutOffTools.values())].map((name) => `\`${name}\``).join(", ")}. Claude Code reports a call cut off this way as "The user doesn't want to proceed with this tool use. The tool use was rejected", but nobody rejected or declined them: they were stopped mid-run. Describe them as stopped or interrupted, never as rejected. They may or may not have taken effect, so check before relying on or repeating them.`, REPLICAS_INSTRUCTIONS_TAG)
@@ -14366,12 +14394,13 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14366
14394
  const dropNotedCutOffs = () => {
14367
14395
  for (const id of notedCutOffs) this.cutOffTools.delete(id);
14368
14396
  };
14369
- const content = appendUserContent(appendUserContent(cutOffNote, this.unreadPrompt?.content ?? []), prompt);
14397
+ const unsent = appendUserContent(appendUserContent(cutOffNote, this.unreadPrompt?.content ?? []), prompt);
14398
+ const content = takesUnread ? unsent : prompt;
14370
14399
  if (this.pendingInterrupt || options.signal?.aborted) {
14371
14400
  this.pendingInterrupt = false;
14372
- if (!options.engineTurn && !this.isStopped(options.signal)) {
14401
+ if (!options.engineTurn && !this.isStopped(options.signal) && !this.isRequeued(options.signal)) {
14373
14402
  await recordPrompt?.();
14374
- this.keepUnreadPrompt(userMessage.uuid, content);
14403
+ this.keepUnreadPrompt(userMessage.uuid, unsent);
14375
14404
  dropNotedCutOffs();
14376
14405
  }
14377
14406
  return;
@@ -14395,13 +14424,14 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14395
14424
  void this.deliverEarlySteers();
14396
14425
  });
14397
14426
  } finally {
14398
- const carried = options.signal?.aborted && !options.engineTurn && !this.isStopped(options.signal);
14427
+ const requeued = this.isRequeued(options.signal);
14428
+ const carried = options.signal?.aborted && !options.engineTurn && !requeued && !this.isStopped(options.signal);
14399
14429
  if (this.turnPromptRecorded || carried) dropNotedCutOffs();
14400
- if (this.turnPromptRecorded) this.unreadPrompt = null;
14401
- else if (carried) this.keepUnreadPrompt(userMessage.uuid, content);
14402
- else if (this.unreadPrompt && options.signal?.aborted) this.unreadPrompt = { ...this.unreadPrompt, uuid: userMessage.uuid };
14430
+ if (!this.turnPromptRecorded && carried) this.keepUnreadPrompt(userMessage.uuid, unsent);
14431
+ else if (takesUnread && this.turnPromptRecorded) this.unreadPrompt = null;
14432
+ else if (takesUnread && this.unreadPrompt && options.signal?.aborted) this.unreadPrompt = { ...this.unreadPrompt, uuid: userMessage.uuid };
14403
14433
  if (this.sentPrompt?.record) {
14404
- if (!this.isStopped(options.signal) || await this.promptRecorded(userMessage.uuid)) await this.recordSentPrompt();
14434
+ if (!requeued && (!this.isStopped(options.signal) || await this.promptRecorded(userMessage.uuid))) await this.recordSentPrompt();
14405
14435
  else this.sentPrompt.record = void 0;
14406
14436
  }
14407
14437
  }
@@ -14707,7 +14737,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14707
14737
  if (isRecord2(lifecycle2) && lifecycle2.type === "command_lifecycle" && lifecycle2.state === "started" && typeof lifecycle2.command_uuid === "string") {
14708
14738
  if (this.pendingTurn?.userMessageUuids.has(lifecycle2.command_uuid)) {
14709
14739
  this.turnPromptRecorded = true;
14710
- if (lifecycle2.command_uuid === this.sentPrompt?.uuid) {
14740
+ if (lifecycle2.command_uuid === this.sentPrompt?.uuid && !this.isRequeued(this.sentPrompt.signal)) {
14711
14741
  this.messageQueue.markDelivered();
14712
14742
  await this.recordSentPrompt();
14713
14743
  }
@@ -15475,9 +15505,13 @@ var CodexAspManager = class extends CodingAgentManager {
15475
15505
  `, sent: this.turnRequest });
15476
15506
  return true;
15477
15507
  }
15508
+ // `/compact` and a goal's clear or pause send Codex no input; a goal being set or resumed does.
15509
+ carriesKeptRequests(request) {
15510
+ const command = getGoalCommand(request.message, request.goalMode)?.type;
15511
+ return !isCompactCommand(request.message) && command !== "clear" && command !== "pause";
15512
+ }
15478
15513
  takeKeptRequests() {
15479
- const command = this.turnRequest && getGoalCommand(this.turnRequest.message, this.turnRequest.goalMode)?.type;
15480
- if (this.turnRequest && (isCompactCommand(this.turnRequest.message) || command && command !== "set")) return { sent: Promise.resolve([]), putBack: () => {
15514
+ if (this.turnRequest && !this.carriesKeptRequests(this.turnRequest)) return { sent: Promise.resolve([]), putBack: () => {
15481
15515
  } };
15482
15516
  const unread = this.unreadRequests;
15483
15517
  this.unreadRequests = [];
@@ -15888,7 +15922,7 @@ var CodexAspManager = class extends CodingAgentManager {
15888
15922
  const threadId = await this.ensureThread(host, request, developerInstructions);
15889
15923
  await this.lateStartStopped(signal);
15890
15924
  const delivered = this.deliver(signal);
15891
- if (delivered || !this.isStopped(signal)) recordUserMessage({ command: "goal" });
15925
+ if (delivered || !(this.isStopped(signal) || this.isRequeued(signal))) recordUserMessage({ command: "goal" });
15892
15926
  return delivered ? { host, threadId } : null;
15893
15927
  }
15894
15928
  // The app-server takes a start written behind one still in flight into that one's turn, so the next one waits until that one is stopped, undelivered: a Stop meanwhile still withdraws it.
@@ -15922,7 +15956,7 @@ var CodexAspManager = class extends CodingAgentManager {
15922
15956
  await this.lateStartStopped(signal);
15923
15957
  if (!this.deliver(signal)) {
15924
15958
  await removeTempImageFiles(tempImagePaths);
15925
- if (this.isStopped(signal)) return;
15959
+ if (this.isStopped(signal) || this.isRequeued(signal)) return;
15926
15960
  recordUserMessage(options.userMessagePayload);
15927
15961
  if (!options.runTurn && !options.continuation) await this.keepStoppedRequest(request);
15928
15962
  return;
@@ -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-KTJEFLNI.js";
6
+ } from "./chunk-GQOYWYVG.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-LV6TPXQ7.js";
12
+ } from "./chunk-BONRQV3P.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-LV6TPXQ7.js";
14
+ } from "./chunk-BONRQV3P.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.1696",
3
+ "version": "0.1.1700",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",