replicas-engine 0.1.1318 → 0.1.1320

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,9 +8,9 @@ import {
8
8
  listRunningCodexModels,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-ORM5QECI.js";
11
+ } from "./chunk-VVU62H6B.js";
12
12
  import "./chunk-56WDCAN2.js";
13
- import "./chunk-QLDS5LTC.js";
13
+ import "./chunk-4S7JVNWL.js";
14
14
  import "./chunk-2MCGQBB5.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
16
  import "./chunk-LLSE2EKJ.js";
@@ -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.1318";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1320";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-QLDS5LTC.js";
17
+ } from "./chunk-4S7JVNWL.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
@@ -306,7 +306,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
306
306
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
307
307
  await this.applyCredentialsResponse(data);
308
308
  setAgentCredentialSnapshot("codex", data);
309
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ANSPVIFL.js");
309
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-TT2OBODF.js");
310
310
  await restartCodexAspHostIfRunning2();
311
311
  });
312
312
  await this.start(true);
@@ -328,7 +328,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
328
328
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
329
329
  await this.applyCredentialsResponse(data);
330
330
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
331
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ANSPVIFL.js");
331
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-TT2OBODF.js");
332
332
  await restartCodexAspHostIfRunning2();
333
333
  }
334
334
  setAgentCredentialSnapshot("codex", data);
@@ -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-QLDS5LTC.js";
6
+ } from "./chunk-4S7JVNWL.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -14,11 +14,11 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-I2O6UQT6.js";
17
+ } from "./chunk-Y5ZVU5DX.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-QLDS5LTC.js";
21
+ } from "./chunk-4S7JVNWL.js";
22
22
  import "./chunk-2MCGQBB5.js";
23
23
  import {
24
24
  AGENT,
package/dist/src/index.js CHANGED
@@ -65,7 +65,7 @@ import {
65
65
  spawnMuseMsp,
66
66
  startMuseSession,
67
67
  uuidV7
68
- } from "./chunk-I2O6UQT6.js";
68
+ } from "./chunk-Y5ZVU5DX.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
71
  } from "./chunk-RG6ZUUTP.js";
@@ -143,7 +143,7 @@ import {
143
143
  timestampFromSeconds,
144
144
  upsertCredentialFileLines,
145
145
  writeSecureCredentialFile
146
- } from "./chunk-ORM5QECI.js";
146
+ } from "./chunk-VVU62H6B.js";
147
147
  import {
148
148
  ENGINE_ENV,
149
149
  monolithRequest,
@@ -156,7 +156,7 @@ import {
156
156
  } from "./chunk-56WDCAN2.js";
157
157
  import {
158
158
  getCodexModelProvider
159
- } from "./chunk-QLDS5LTC.js";
159
+ } from "./chunk-4S7JVNWL.js";
160
160
  import {
161
161
  SUBPROCESS_MAX_BUFFER,
162
162
  execAsync,
@@ -12950,6 +12950,7 @@ var CLAUDE_SLASH_COMMANDS_CACHE_MS = 6e4;
12950
12950
  var CLAUDE_SLASH_COMMANDS_DISCOVERY_TIMEOUT_MS = 3e4;
12951
12951
  var CLAUDE_BACKGROUND_CONTINUATION_GRACE_MS = 1e4;
12952
12952
  var CLAUDE_BACKGROUND_RECOVERY_START_TIMEOUT_MS = 6e4;
12953
+ var CLAUDE_INTERRUPT_TIMEOUT_MS = 5e3;
12953
12954
  function supportsClaudeThinkingDisplay(model) {
12954
12955
  const normalized = (normalizeClaudeModel(model) ?? model).toLowerCase();
12955
12956
  return AGENT_MODELS.claude.includes(normalized) || /^claude-(?:opus|sonnet|haiku)-[4-9]/.test(normalized);
@@ -13112,6 +13113,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13112
13113
  sessionActivity = createClaudeSessionActivity();
13113
13114
  backgroundContinuationTimer = null;
13114
13115
  pendingInterrupt = false;
13116
+ // A turn started before a stop's teardown would run on the process being stopped and end with it.
13117
+ stopping = null;
13115
13118
  // Claude Code writes a started prompt to the session transcript even when the turn then fails, so a retry must not resend it.
13116
13119
  turnPromptRecorded = false;
13117
13120
  // Claude Code never sees a prompt stopped before it started, so it is sent again with the next message.
@@ -13159,8 +13162,20 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13159
13162
  }
13160
13163
  async interruptActiveTurn() {
13161
13164
  this.pendingInterrupt = true;
13162
- await this.abortAllPendingToolInputs();
13163
- await this.tearDownSession(true);
13165
+ const stopping = (async () => {
13166
+ await this.abortAllPendingToolInputs();
13167
+ const query2 = this.activeQuery;
13168
+ if (query2) {
13169
+ const interrupt = query2.interrupt.bind(query2);
13170
+ await raceWithTimeout(interrupt({ cancelQueued: true }).catch(() => {
13171
+ }), CLAUDE_INTERRUPT_TIMEOUT_MS);
13172
+ }
13173
+ await this.tearDownSession(true);
13174
+ })();
13175
+ this.stopping = stopping;
13176
+ await stopping.finally(() => {
13177
+ if (this.stopping === stopping) this.stopping = null;
13178
+ });
13164
13179
  }
13165
13180
  // Stop can tear a session down before its command_lifecycle event is read, so the transcript decides.
13166
13181
  async dropRecordedUnreadPrompt() {
@@ -13499,6 +13514,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13499
13514
  this.turnLoginFailure = null;
13500
13515
  await this.goalClear?.catch(() => {
13501
13516
  });
13517
+ await this.stopping?.catch(() => {
13518
+ });
13502
13519
  try {
13503
13520
  while (true) {
13504
13521
  const attemptedCredential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.claude;
@@ -13990,6 +14007,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13990
14007
  if (next.done || this.activeQuery !== response) break;
13991
14008
  const msg = next.value;
13992
14009
  if (!msg) break;
14010
+ if (this.pendingInterrupt) continue;
13993
14011
  if (msg.type === "rate_limit_event") {
13994
14012
  creditsRequired = msg.rate_limit_info.errorCode === "credits_required";
13995
14013
  if (msg.rate_limit_info.status === "rejected" && msg.rate_limit_info.resetsAt) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1318",
3
+ "version": "0.1.1320",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",