replicas-engine 0.1.1691 → 0.1.1692

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-4XN65A5I.js";
12
- import "./chunk-CTCJMQUE.js";
13
- import "./chunk-2QWCRIV5.js";
14
- import "./chunk-F4D2ZOED.js";
15
- import "./chunk-6NZ2BNFO.js";
11
+ } from "./chunk-SEEI46TQ.js";
12
+ import "./chunk-475D64MM.js";
13
+ import "./chunk-7JWCMNCT.js";
14
+ import "./chunk-X3NQWZYM.js";
15
+ import "./chunk-VACC2L5I.js";
16
16
  import "./chunk-UZSNFLDQ.js";
17
- import "./chunk-PHNKPAWA.js";
17
+ import "./chunk-6APWU5OT.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-PHNKPAWA.js";
6
+ } from "./chunk-6APWU5OT.js";
7
7
 
8
8
  // src/managers/subagent-mcp-config.ts
9
9
  import { existsSync } from "fs";
@@ -21655,7 +21655,7 @@ async function withRetry(label, fn, options) {
21655
21655
  }
21656
21656
 
21657
21657
  // ../shared/src/tensorlake.ts
21658
- var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-20-v44";
21658
+ var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-20-v46";
21659
21659
  var TENSORLAKE_DISK_MB = 100 * 1024;
21660
21660
 
21661
21661
  // ../shared/src/egress.ts
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-6NZ2BNFO.js";
7
+ } from "./chunk-VACC2L5I.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-PHNKPAWA.js";
24
+ } from "./chunk-6APWU5OT.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -5,7 +5,7 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-2QWCRIV5.js";
8
+ } from "./chunk-7JWCMNCT.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-PHNKPAWA.js";
21
+ } from "./chunk-6APWU5OT.js";
22
22
 
23
23
  // src/services/command-protection-service.ts
24
24
  import { readFile, stat } from "fs/promises";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-7ZDAVYTV.js";
7
7
  import {
8
8
  engineScriptProcess
9
- } from "./chunk-CTCJMQUE.js";
9
+ } from "./chunk-475D64MM.js";
10
10
  import {
11
11
  isRecord
12
12
  } from "./chunk-UZSNFLDQ.js";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-PHNKPAWA.js";
8
+ } from "./chunk-6APWU5OT.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -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-CTCJMQUE.js";
6
+ } from "./chunk-475D64MM.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-2QWCRIV5.js";
18
+ } from "./chunk-7JWCMNCT.js";
19
19
  import {
20
20
  AppServerProcess,
21
21
  buildCodexAgentEnv
22
- } from "./chunk-F4D2ZOED.js";
22
+ } from "./chunk-X3NQWZYM.js";
23
23
  import {
24
24
  SUBPROCESS_MAX_BUFFER,
25
25
  execFileAsync
26
- } from "./chunk-6NZ2BNFO.js";
26
+ } from "./chunk-VACC2L5I.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-PHNKPAWA.js";
66
+ } from "./chunk-6APWU5OT.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-6F6YGLQL.js");
466
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-U6UYWQZU.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-6F6YGLQL.js");
488
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-U6UYWQZU.js");
489
489
  await restartCodexAspHostIfRunning2();
490
490
  }
491
491
  setAgentCredentialSnapshot("codex", data);
@@ -1610,6 +1610,7 @@ var TURN_INTERRUPT_METHOD = "turn/interrupt";
1610
1610
  var TURN_STEER_METHOD = "turn/steer";
1611
1611
  var ACCOUNT_RATE_LIMITS_READ_METHOD = "account/rateLimits/read";
1612
1612
  var MODEL_LIST_METHOD = "model/list";
1613
+ var COLLABORATION_MODE_LIST_METHOD = "collaborationMode/list";
1613
1614
  var SKILLS_LIST_METHOD = "skills/list";
1614
1615
  var MAX_CODEX_ASP_TRANSCRIPT_OUTPUT_CHARS = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS;
1615
1616
  function getReconciledActiveTurnId(error, expectedTurnId) {
@@ -2167,7 +2168,7 @@ async function getCodexAspHost() {
2167
2168
  })();
2168
2169
  return hostPromise;
2169
2170
  }
2170
- async function restartCodexAspHost() {
2171
+ async function restartCodexAspHost(reason) {
2171
2172
  if (restartPromise) {
2172
2173
  return restartPromise;
2173
2174
  }
@@ -2176,7 +2177,7 @@ async function restartCodexAspHost() {
2176
2177
  hostPromise = null;
2177
2178
  activeProcess = null;
2178
2179
  if (process2) {
2179
- await process2.stop();
2180
+ await process2.stop(reason);
2180
2181
  }
2181
2182
  })();
2182
2183
  try {
@@ -2297,6 +2298,7 @@ export {
2297
2298
  TURN_INTERRUPT_METHOD,
2298
2299
  TURN_STEER_METHOD,
2299
2300
  ACCOUNT_RATE_LIMITS_READ_METHOD,
2301
+ COLLABORATION_MODE_LIST_METHOD,
2300
2302
  SKILLS_LIST_METHOD,
2301
2303
  getReconciledActiveTurnId,
2302
2304
  extractRateLimitsSnapshot,
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-7ZDAVYTV.js";
7
7
  import {
8
8
  AspClient
9
- } from "./chunk-F4D2ZOED.js";
9
+ } from "./chunk-X3NQWZYM.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-PHNKPAWA.js";
21
+ } from "./chunk-6APWU5OT.js";
22
22
 
23
23
  // src/managers/codex-asp/notification-dispatch.ts
24
24
  var TURN_STARTED_METHOD = "turn/started";
@@ -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-PHNKPAWA.js";
6
+ } from "./chunk-6APWU5OT.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -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-6NZ2BNFO.js";
6
+ } from "./chunk-VACC2L5I.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-PHNKPAWA.js";
9
+ } from "./chunk-6APWU5OT.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -34,6 +34,8 @@ function hasOwn(record, key) {
34
34
  }
35
35
  var AspRequestTimeoutError = class extends Error {
36
36
  };
37
+ var AspResponseError = class extends Error {
38
+ };
37
39
  var AspClient = class {
38
40
  stdin;
39
41
  stdout;
@@ -198,13 +200,13 @@ var AspClient = class {
198
200
  }
199
201
  createRpcError(method, error) {
200
202
  if (typeof error !== "object" || error === null || Array.isArray(error)) {
201
- return new Error(`ASP request failed for ${method}`);
203
+ return new AspResponseError(`ASP request failed for ${method}`);
202
204
  }
203
205
  const rpcError = error;
204
206
  const code = typeof rpcError.code === "number" ? ` ${rpcError.code}` : "";
205
207
  const message = typeof rpcError.message === "string" ? rpcError.message : "Unknown ASP error";
206
208
  const data = hasOwn(rpcError, "data") ? ` data=${JSON.stringify(rpcError.data)}` : "";
207
- return new Error(`ASP request failed for ${method}:${code} ${message}${data}`);
209
+ return new AspResponseError(`ASP request failed for ${method}:${code} ${message}${data}`);
208
210
  }
209
211
  write(message) {
210
212
  try {
@@ -242,7 +244,7 @@ function getCodexModelProvider(method) {
242
244
  if (method === "foundry") return "azure";
243
245
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
244
246
  }
245
- var ENGINE_PACKAGE_VERSION = "0.1.1691";
247
+ var ENGINE_PACKAGE_VERSION = "0.1.1692";
246
248
  var INITIALIZE_METHOD = "initialize";
247
249
  var INITIALIZED_NOTIFICATION = "initialized";
248
250
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -404,10 +406,10 @@ var AppServerProcess = class {
404
406
  throw error;
405
407
  }
406
408
  }
407
- async stop() {
409
+ async stop(reason = new Error("ASP process stopped")) {
408
410
  const child = this.child;
409
411
  this.shuttingDown = true;
410
- this.client?.dispose(new Error("ASP process stopped"));
412
+ this.client?.dispose(reason);
411
413
  this.client = null;
412
414
  this.child = null;
413
415
  if (!child || child.killed) {
@@ -482,6 +484,7 @@ var AppServerProcess = class {
482
484
  export {
483
485
  buildCodexAgentEnv,
484
486
  AspRequestTimeoutError,
487
+ AspResponseError,
485
488
  AspClient,
486
489
  getCodexModelProvider,
487
490
  AppServerProcess
@@ -4,15 +4,15 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  getManagedPiMcpServers,
6
6
  managedMcpServerProcess
7
- } from "./chunk-MJWJP6RQ.js";
7
+ } from "./chunk-MJMG4EWL.js";
8
8
  import "./chunk-7ZDAVYTV.js";
9
- import "./chunk-CTCJMQUE.js";
9
+ import "./chunk-475D64MM.js";
10
10
  import {
11
11
  isRecord
12
12
  } from "./chunk-UZSNFLDQ.js";
13
13
  import {
14
14
  rankToolsByQuery
15
- } from "./chunk-PHNKPAWA.js";
15
+ } from "./chunk-6APWU5OT.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-F2DLY4E6.js";
7
- import "./chunk-2QWCRIV5.js";
8
- import "./chunk-6NZ2BNFO.js";
6
+ } from "./chunk-LZBBDHPP.js";
7
+ import "./chunk-7JWCMNCT.js";
8
+ import "./chunk-VACC2L5I.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-PHNKPAWA.js";
12
+ import "./chunk-6APWU5OT.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-ZP6BBTFK.js";
17
+ } from "./chunk-SYK6RNTD.js";
18
18
  import "./chunk-7ZDAVYTV.js";
19
19
  import {
20
20
  AppServerProcess,
21
21
  buildCodexAgentEnv
22
- } from "./chunk-F4D2ZOED.js";
23
- import "./chunk-6NZ2BNFO.js";
22
+ } from "./chunk-X3NQWZYM.js";
23
+ import "./chunk-VACC2L5I.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-PHNKPAWA.js";
33
+ } from "./chunk-6APWU5OT.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-MJWJP6RQ.js";
93
+ } from "./chunk-MJMG4EWL.js";
94
94
  import {
95
95
  evaluateCommandProtection,
96
96
  extractToolCommand,
97
97
  reportCommandProtectionBlock
98
- } from "./chunk-F2DLY4E6.js";
98
+ } from "./chunk-LZBBDHPP.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-ZP6BBTFK.js";
132
+ } from "./chunk-SYK6RNTD.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-ZN4BSDP7.js";
140
+ } from "./chunk-OSC4P2BF.js";
141
141
  import {
142
142
  ACCOUNT_RATE_LIMITS_READ_METHOD,
143
143
  AsyncLock,
@@ -146,6 +146,7 @@ import {
146
146
  CLAUDE_HISTORY_DIR,
147
147
  CODEX_HISTORY_DIR,
148
148
  CODEX_ULTRAFAST_SERVICE_TIER,
149
+ COLLABORATION_MODE_LIST_METHOD,
149
150
  CURSOR_HISTORY_DIR,
150
151
  CodexAspAuthMethodChangedError,
151
152
  CodexQuotaStatusTracker,
@@ -214,12 +215,12 @@ import {
214
215
  transcriptSecrets,
215
216
  upsertCredentialFileLines,
216
217
  writeSecureCredentialFile
217
- } from "./chunk-4XN65A5I.js";
218
+ } from "./chunk-SEEI46TQ.js";
218
219
  import {
219
220
  SUBAGENT_MCP_TOOL_TIMEOUT_MS,
220
221
  engineScriptProcess,
221
222
  subagentMcpProcessConfig
222
- } from "./chunk-CTCJMQUE.js";
223
+ } from "./chunk-475D64MM.js";
223
224
  import {
224
225
  ENGINE_ENV,
225
226
  UNQUOTED_PATHS_CONFIG,
@@ -230,17 +231,18 @@ import {
230
231
  resolveDiffBase,
231
232
  setAgentCredentialSnapshot,
232
233
  setLinearSessionId
233
- } from "./chunk-2QWCRIV5.js";
234
+ } from "./chunk-7JWCMNCT.js";
234
235
  import {
235
236
  AspRequestTimeoutError,
237
+ AspResponseError,
236
238
  buildCodexAgentEnv,
237
239
  getCodexModelProvider
238
- } from "./chunk-F4D2ZOED.js";
240
+ } from "./chunk-X3NQWZYM.js";
239
241
  import {
240
242
  SUBPROCESS_MAX_BUFFER,
241
243
  execAsync,
242
244
  execFileAsync
243
- } from "./chunk-6NZ2BNFO.js";
245
+ } from "./chunk-VACC2L5I.js";
244
246
  import {
245
247
  isRecord
246
248
  } from "./chunk-UZSNFLDQ.js";
@@ -541,7 +543,7 @@ import {
541
543
  workspaceTokenRequestSchema,
542
544
  workspaceTokenResponseSchema,
543
545
  wrapInTag
544
- } from "./chunk-PHNKPAWA.js";
546
+ } from "./chunk-6APWU5OT.js";
545
547
  import {
546
548
  __commonJS,
547
549
  __export,
@@ -15342,12 +15344,21 @@ var CodexModelAtCapacityError = class extends Error {
15342
15344
  }
15343
15345
  turnId;
15344
15346
  };
15347
+ var CodexStoppedAnsweringError = class extends Error {
15348
+ constructor(stoppedTurnId) {
15349
+ super("Codex stopped answering and was restarted. This turn did not finish.");
15350
+ this.stoppedTurnId = stoppedTurnId;
15351
+ this.name = "CodexStoppedAnsweringError";
15352
+ }
15353
+ stoppedTurnId;
15354
+ };
15345
15355
  var MODEL_AT_CAPACITY_RETRIES = 5;
15346
15356
  var MODEL_AT_CAPACITY_RETRY_BASE_MS = 5e3;
15347
15357
  var MODEL_AT_CAPACITY_CONTINUE_PROMPT = "Your previous turn stopped because the model was at capacity. Continue from where you left off: first check what is already done, and do not repeat commands, edits, or messages you already completed.";
15348
15358
  var CODEX_SLASH_COMMANDS_CACHE_MS = 3e4;
15349
15359
  var POLICY_REASON_INJECTION_TIMEOUT_MS = 5e3;
15350
15360
  var CODEX_INTERRUPT_TIMEOUT_MS = 5e3;
15361
+ var CODEX_LIVENESS_TIMEOUT_MS = 2e3;
15351
15362
  var SUBAGENT_MCP_THREADS_DIR = join12(ENGINE_ENV.HOME_DIR, ".replicas", "codex", "subagent-mcp-threads");
15352
15363
  async function markSubagentMcpThread(threadId) {
15353
15364
  await mkdir8(SUBAGENT_MCP_THREADS_DIR, { recursive: true });
@@ -15400,6 +15411,8 @@ var CodexAspManager = class extends CodingAgentManager {
15400
15411
  onGoalChanged = null;
15401
15412
  lateStart = null;
15402
15413
  stopGiveUp = null;
15414
+ unansweredStop = null;
15415
+ unansweredStopAtPress = null;
15403
15416
  itemUpdateCoalescer = new ItemUpdateCoalescer((itemId) => {
15404
15417
  const item = this.liveTurn?.items.get(itemId);
15405
15418
  if (this.liveTurn && item) this.onEvent(codexItemEvent(this.liveTurn.id, item, true));
@@ -15443,12 +15456,17 @@ var CodexAspManager = class extends CodingAgentManager {
15443
15456
  return this.currentThreadId ? existsSync6(join12(SUBAGENT_MCP_THREADS_DIR, this.currentThreadId)) : enabled;
15444
15457
  }
15445
15458
  async interrupt(persistRemoval, requestedStoppedAt) {
15446
- if (this.currentGoal?.status === "active") {
15447
- await this.updateGoal({ status: "paused" }, CODEX_INTERRUPT_TIMEOUT_MS).catch((error) => {
15448
- console.error("[CodexAspManager] Failed to pause the goal on Stop:", error);
15449
- });
15450
- }
15451
- return super.interrupt(persistRemoval, requestedStoppedAt);
15459
+ const unansweredStop = this.unansweredStop;
15460
+ const pauseGoal = () => this.updateGoal({ status: "paused" }, CODEX_INTERRUPT_TIMEOUT_MS).catch((error) => {
15461
+ console.error("[CodexAspManager] Failed to pause the goal on Stop:", error);
15462
+ });
15463
+ if (this.currentGoal?.status === "active") await pauseGoal();
15464
+ this.unansweredStopAtPress = unansweredStop;
15465
+ const interrupting = super.interrupt(persistRemoval, requestedStoppedAt);
15466
+ this.unansweredStopAtPress = null;
15467
+ const response = await interrupting;
15468
+ if (this.currentGoal?.status === "active") await pauseGoal();
15469
+ return response;
15452
15470
  }
15453
15471
  async keepStoppedRequest(request) {
15454
15472
  if (!canSteerMessage("codex", request)) return false;
@@ -15478,9 +15496,12 @@ var CodexAspManager = class extends CodingAgentManager {
15478
15496
  const expectedTurnId = this.activeTurnId;
15479
15497
  const giveUp = stoppedAt ? this.stopGiveUp : null;
15480
15498
  giveUp?.hold();
15499
+ const unansweredBefore = stoppedAt ? this.unansweredStopAtPress : null;
15500
+ let client = null;
15481
15501
  let unanswered = null;
15482
15502
  try {
15483
- await (await getCodexAspHost()).client.request(
15503
+ client = (await getCodexAspHost()).client;
15504
+ await client.request(
15484
15505
  THREAD_BACKGROUND_TERMINALS_CLEAN_METHOD,
15485
15506
  { threadId },
15486
15507
  { timeoutMs: CODEX_INTERRUPT_TIMEOUT_MS }
@@ -15498,17 +15519,29 @@ var CodexAspManager = class extends CodingAgentManager {
15498
15519
  { timeoutMs: CODEX_INTERRUPT_TIMEOUT_MS }
15499
15520
  )
15500
15521
  );
15501
- void interrupting.then((result2) => {
15502
- if (giveUp === this.stopGiveUp && (result2.ok || !(result2.error.details instanceof AspRequestTimeoutError))) giveUp?.arm();
15522
+ void interrupting.then((result) => {
15523
+ if (giveUp === this.stopGiveUp && (result.ok || !(result.error.details instanceof AspRequestTimeoutError))) giveUp?.arm();
15503
15524
  });
15504
- if (stoppedAt && unanswered) throw unanswered;
15505
- const result = await interrupting;
15506
- if (result.ok) return;
15507
- console.warn(
15508
- result.error.code === "retry_failed" ? "[CodexAspManager] Failed to interrupt reconciled active turn; leaving shared Codex app-server running:" : "[CodexAspManager] Failed to interrupt active turn:",
15509
- result.error.details
15510
- );
15511
- if (stoppedAt && result.error.details instanceof AspRequestTimeoutError) throw result.error.details;
15525
+ if (!stoppedAt || !unanswered) {
15526
+ const result = await interrupting;
15527
+ if (!result.ok) {
15528
+ console.warn(
15529
+ result.error.code === "retry_failed" ? "[CodexAspManager] Failed to interrupt reconciled active turn; leaving shared Codex app-server running:" : "[CodexAspManager] Failed to interrupt active turn:",
15530
+ result.error.details
15531
+ );
15532
+ if (result.error.details instanceof AspRequestTimeoutError) unanswered = result.error.details;
15533
+ }
15534
+ }
15535
+ if (!stoppedAt) return;
15536
+ if (!unanswered) {
15537
+ this.unansweredStop = null;
15538
+ return;
15539
+ }
15540
+ if (client) this.unansweredStop = { client, turnId: expectedTurnId };
15541
+ if (unansweredBefore?.client !== client || unansweredBefore.turnId !== expectedTurnId) throw unanswered;
15542
+ const alive = await unansweredBefore.client.request(COLLABORATION_MODE_LIST_METHOD, {}, { timeoutMs: CODEX_LIVENESS_TIMEOUT_MS }).then(() => true, (error) => error instanceof AspResponseError);
15543
+ if (alive) throw unanswered;
15544
+ void restartCodexAspHost(new CodexStoppedAnsweringError(expectedTurnId));
15512
15545
  }
15513
15546
  async requestActiveTurnWithReconciliation(operation, expectedTurnId, request) {
15514
15547
  try {
@@ -16284,7 +16317,11 @@ ${text.slice(-24e3)}`
16284
16317
  const onDispose = (reason) => {
16285
16318
  this.attachedClient = null;
16286
16319
  this.activeTurnId = null;
16287
- if (reason instanceof CodexAspAuthMethodChangedError) {
16320
+ if (reason instanceof CodexStoppedAnsweringError && reason.stoppedTurnId === observedTurnId) {
16321
+ onNotification({ method: TURN_COMPLETED_METHOD, params: { threadId, turn: { id: observedTurnId, items: [], itemsView: "notLoaded", status: "interrupted", error: null, startedAt: null, completedAt: null, durationMs: null } } });
16322
+ return;
16323
+ }
16324
+ if (reason instanceof CodexAspAuthMethodChangedError || reason instanceof CodexStoppedAnsweringError) {
16288
16325
  rejectDisposed(reason);
16289
16326
  return;
16290
16327
  }
@@ -16353,6 +16390,7 @@ ${text.slice(-24e3)}`
16353
16390
  clearTimeout(stopTimer);
16354
16391
  signal.removeEventListener("abort", giveUpIfStopUnanswered);
16355
16392
  this.stopGiveUp = null;
16393
+ this.unansweredStop = null;
16356
16394
  this.onGoalChanged = null;
16357
16395
  this.itemUpdateCoalescer.flushPending();
16358
16396
  await removeTempImageFiles(tempImagePaths);
@@ -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-ZN4BSDP7.js";
6
+ } from "./chunk-OSC4P2BF.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-PHNKPAWA.js";
12
+ } from "./chunk-6APWU5OT.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-PHNKPAWA.js";
14
+ } from "./chunk-6APWU5OT.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.1691",
3
+ "version": "0.1.1692",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",