replicas-engine 0.1.1603 → 0.1.1606

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-TBKSOXMC.js";
12
- import "./chunk-ZLENMDGD.js";
13
- import "./chunk-BO2GIGEJ.js";
14
- import "./chunk-IP4QQ2LD.js";
11
+ } from "./chunk-FWC6IREY.js";
12
+ import "./chunk-C3PFZKXL.js";
13
+ import "./chunk-2XVJPLAN.js";
14
+ import "./chunk-5SJ65PER.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-2ENRWARZ.js";
16
+ import "./chunk-V5AMWNUX.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -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-IP4QQ2LD.js";
6
+ } from "./chunk-5SJ65PER.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-2ENRWARZ.js";
9
+ } from "./chunk-V5AMWNUX.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.1603";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1606";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -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-2ENRWARZ.js";
6
+ } from "./chunk-V5AMWNUX.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-2ENRWARZ.js";
8
+ } from "./chunk-V5AMWNUX.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-IP4QQ2LD.js";
7
+ } from "./chunk-5SJ65PER.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-2ENRWARZ.js";
24
+ } from "./chunk-V5AMWNUX.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -12,15 +12,15 @@ import {
12
12
  resolveDiffBase,
13
13
  runGitCommand,
14
14
  setAgentCredentialSnapshot
15
- } from "./chunk-ZLENMDGD.js";
15
+ } from "./chunk-C3PFZKXL.js";
16
16
  import {
17
17
  AppServerProcess,
18
18
  buildCodexAgentEnv
19
- } from "./chunk-BO2GIGEJ.js";
19
+ } from "./chunk-2XVJPLAN.js";
20
20
  import {
21
21
  SUBPROCESS_MAX_BUFFER,
22
22
  execFileAsync
23
- } from "./chunk-IP4QQ2LD.js";
23
+ } from "./chunk-5SJ65PER.js";
24
24
  import {
25
25
  isRecord
26
26
  } from "./chunk-UZSNFLDQ.js";
@@ -61,7 +61,7 @@ import {
61
61
  shrunkImageSize,
62
62
  splitMothershipInstructions,
63
63
  withTimeout
64
- } from "./chunk-2ENRWARZ.js";
64
+ } from "./chunk-V5AMWNUX.js";
65
65
 
66
66
  // src/managers/codex-token-manager.ts
67
67
  import { promises as fs } from "fs";
@@ -461,7 +461,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
461
461
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
462
462
  await this.applyCredentialsResponse(data);
463
463
  setAgentCredentialSnapshot("codex", data);
464
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-SS2XJOIE.js");
464
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-RJMMUWAB.js");
465
465
  await restartCodexAspHostIfRunning2();
466
466
  });
467
467
  await this.start(true);
@@ -483,7 +483,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
483
483
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
484
484
  await this.applyCredentialsResponse(data);
485
485
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
486
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-SS2XJOIE.js");
486
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-RJMMUWAB.js");
487
487
  await restartCodexAspHostIfRunning2();
488
488
  }
489
489
  setAgentCredentialSnapshot("codex", data);
@@ -5,7 +5,7 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-ZLENMDGD.js";
8
+ } from "./chunk-C3PFZKXL.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
  withE2BRetry
21
- } from "./chunk-2ENRWARZ.js";
21
+ } from "./chunk-V5AMWNUX.js";
22
22
 
23
23
  // src/services/command-protection-service.ts
24
24
  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-BO2GIGEJ.js";
6
+ } from "./chunk-2XVJPLAN.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-2ENRWARZ.js";
18
+ } from "./chunk-V5AMWNUX.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -9377,6 +9377,7 @@ var WEB_APP_PATHS = {
9377
9377
  "audit-logs": `${DASHBOARD_PATH}/audit-logs`,
9378
9378
  accountAgents: `${DASHBOARD_PATH}/account/agents`,
9379
9379
  accountProfile: `${DASHBOARD_PATH}/account/profile`,
9380
+ accountAppearance: `${DASHBOARD_PATH}/account/appearance`,
9380
9381
  accountConnections: `${DASHBOARD_PATH}/account/connections`,
9381
9382
  accountIntegrations: `${DASHBOARD_PATH}/account/integrations`,
9382
9383
  accountApiKeys: `${DASHBOARD_PATH}/account/api-keys`,
@@ -20581,7 +20582,7 @@ var VOICE_WAVEFORM = {
20581
20582
  };
20582
20583
 
20583
20584
  // ../shared/src/e2b.ts
20584
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-16-v19";
20585
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-17-v2";
20585
20586
 
20586
20587
  // ../shared/src/e2b-retry.ts
20587
20588
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -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-RYXGSY24.js";
7
- import "./chunk-ZLENMDGD.js";
8
- import "./chunk-IP4QQ2LD.js";
6
+ } from "./chunk-HKOSS37G.js";
7
+ import "./chunk-C3PFZKXL.js";
8
+ import "./chunk-5SJ65PER.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-2ENRWARZ.js";
12
+ import "./chunk-V5AMWNUX.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-KT44NX2N.js";
17
+ } from "./chunk-PWHJWO2J.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-BO2GIGEJ.js";
22
- import "./chunk-IP4QQ2LD.js";
21
+ } from "./chunk-2XVJPLAN.js";
22
+ import "./chunk-5SJ65PER.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-2ENRWARZ.js";
32
+ } from "./chunk-V5AMWNUX.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-RYXGSY24.js";
30
+ } from "./chunk-HKOSS37G.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-KT44NX2N.js";
68
+ } from "./chunk-PWHJWO2J.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
- } from "./chunk-PI7M37BA.js";
71
+ } from "./chunk-BS7JLXOU.js";
72
72
  import {
73
73
  ACCOUNT_RATE_LIMITS_READ_METHOD,
74
74
  AsyncLock,
@@ -147,7 +147,7 @@ import {
147
147
  transcriptSecrets,
148
148
  upsertCredentialFileLines,
149
149
  writeSecureCredentialFile
150
- } from "./chunk-TBKSOXMC.js";
150
+ } from "./chunk-FWC6IREY.js";
151
151
  import {
152
152
  ENGINE_ENV,
153
153
  UNQUOTED_PATHS_CONFIG,
@@ -158,16 +158,16 @@ import {
158
158
  resolveDiffBase,
159
159
  setAgentCredentialSnapshot,
160
160
  setLinearSessionId
161
- } from "./chunk-ZLENMDGD.js";
161
+ } from "./chunk-C3PFZKXL.js";
162
162
  import {
163
163
  buildCodexAgentEnv,
164
164
  getCodexModelProvider
165
- } from "./chunk-BO2GIGEJ.js";
165
+ } from "./chunk-2XVJPLAN.js";
166
166
  import {
167
167
  SUBPROCESS_MAX_BUFFER,
168
168
  execAsync,
169
169
  execFileAsync
170
- } from "./chunk-IP4QQ2LD.js";
170
+ } from "./chunk-5SJ65PER.js";
171
171
  import {
172
172
  isRecord as isRecord2
173
173
  } from "./chunk-UZSNFLDQ.js";
@@ -463,7 +463,7 @@ import {
463
463
  workspaceTokenRequestSchema,
464
464
  workspaceTokenResponseSchema,
465
465
  wrapInTag
466
- } from "./chunk-2ENRWARZ.js";
466
+ } from "./chunk-V5AMWNUX.js";
467
467
  import {
468
468
  cloneMcpConfig,
469
469
  ensureCompatibilityImports,
@@ -11854,6 +11854,7 @@ Native subagent tools are disabled in this workspace. To delegate work to a suba
11854
11854
  var MAX_INTERRUPT_QUEUE_ITEMS = 1e3;
11855
11855
  var MAX_INTERRUPT_QUEUE_CHARS = 2e5;
11856
11856
  var MAX_REQUESTED_STOP_AGE_MS = 1e4;
11857
+ var PROMPT_START_WAIT_MS = 1e4;
11857
11858
  function toQueuedMessageInfo(message) {
11858
11859
  return {
11859
11860
  id: message.id,
@@ -11900,6 +11901,9 @@ var CodingAgentManager = class _CodingAgentManager {
11900
11901
  withdrawnSteers = /* @__PURE__ */ new WeakSet();
11901
11902
  earlySteerDelivery = new AsyncLock();
11902
11903
  turnOpen = false;
11904
+ reportsPromptStart = false;
11905
+ // A Send now waits for the turn's prompt to start, as an earlier cut cuts nothing; a command's turn has none, so it is never cut as it begins.
11906
+ promptStart = null;
11903
11907
  lastSenderKey;
11904
11908
  // Unset until this process sends a turn, so a restart can't mistake the first one for a change.
11905
11909
  sentTurn = false;
@@ -11989,7 +11993,7 @@ var CodingAgentManager = class _CodingAgentManager {
11989
11993
  initializeManager(processMessage) {
11990
11994
  this.messageQueue = new MessageQueueService(
11991
11995
  async (request, signal) => {
11992
- this.turnOpen = true;
11996
+ this.openTurn(request);
11993
11997
  try {
11994
11998
  await Promise.all([this.refreshSubagentMcp(), this.refreshAutoCompactTokens()]);
11995
11999
  const { request: delivered, senderKey } = this.withSenderLine(request);
@@ -12015,7 +12019,7 @@ var CodingAgentManager = class _CodingAgentManager {
12015
12019
  this.onProcessingChanged,
12016
12020
  // Opened before the turn-start event persists, since a follow-up can arrive while it does.
12017
12021
  async (message) => {
12018
- this.turnOpen = true;
12022
+ this.openTurn(message);
12019
12023
  try {
12020
12024
  await this.onMessageStarted(message);
12021
12025
  } catch (error) {
@@ -12235,6 +12239,8 @@ ${note}` };
12235
12239
  const queued = this.messageQueue.getQueue().some(({ id }) => id === messageId);
12236
12240
  if (!queued && !this.unreadSteers.has(messageId)) return { success: false, queue: this.getQueue() };
12237
12241
  if (this.messageQueue.isProcessing() && (!queued || (await this.steerFromQueue(messageId)).success)) {
12242
+ const start = this.unreadSteers.has(messageId) && !this.canDeliverSteersNow() ? this.promptStart : null;
12243
+ if (start && await raceWithTimeout(start.promise, PROMPT_START_WAIT_MS) === TIMEOUT) return { success: false, queue: this.getQueue() };
12238
12244
  const delivered = !this.unreadSteers.has(messageId) || !this.canDeliverSteersNow() || await this.deliverSteersNow();
12239
12245
  return { success: delivered, queue: this.getQueue() };
12240
12246
  }
@@ -12249,8 +12255,13 @@ ${note}` };
12249
12255
  }
12250
12256
  return { success: true, queue: this.getQueue() };
12251
12257
  }
12258
+ openTurn(message) {
12259
+ this.turnOpen = true;
12260
+ if (this.reportsPromptStart && takesTurnNotes(message)) this.promptStart ??= Promise.withResolvers();
12261
+ }
12252
12262
  closeTurn() {
12253
12263
  this.turnOpen = false;
12264
+ this.settlePromptStart();
12254
12265
  if (this.earlySteers.length > 0) this.requeueUnreadSteers();
12255
12266
  }
12256
12267
  requeueUnreadSteers() {
@@ -12275,6 +12286,10 @@ ${note}` };
12275
12286
  }
12276
12287
  return steer?.delivered ?? inFlight?.delivered ?? this.messageQueue.takeFromQueue(messageId)?.message;
12277
12288
  }
12289
+ settlePromptStart() {
12290
+ this.promptStart?.resolve();
12291
+ this.promptStart = null;
12292
+ }
12278
12293
  canDeliverSteersNow() {
12279
12294
  return false;
12280
12295
  }
@@ -13533,6 +13548,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13533
13548
  stopping = null;
13534
13549
  // Claude Code emits a stopped turn's partial reply only after acknowledging the interrupt, so teardown waits for the turn to end.
13535
13550
  stoppedTurnEnded = null;
13551
+ reportsPromptStart = true;
13536
13552
  // Claude Code writes a started prompt to the session transcript even when the turn then fails, so a retry must not resend it.
13537
13553
  turnPromptRecorded = false;
13538
13554
  endedReplies = /* @__PURE__ */ new Set();
@@ -14595,8 +14611,10 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14595
14611
  this.setAuthRetrying(false);
14596
14612
  const lifecycle2 = msg;
14597
14613
  if (isRecord(lifecycle2) && lifecycle2.type === "command_lifecycle" && lifecycle2.state === "started" && typeof lifecycle2.command_uuid === "string") {
14598
- if (this.pendingTurn?.userMessageUuids.has(lifecycle2.command_uuid)) this.turnPromptRecorded = true;
14599
- else if (!this.activePromptStream?.sentUuids.has(lifecycle2.command_uuid)) await this.recordPeerMessage(lifecycle2.command_uuid, response);
14614
+ if (this.pendingTurn?.userMessageUuids.has(lifecycle2.command_uuid)) {
14615
+ this.turnPromptRecorded = true;
14616
+ this.settlePromptStart();
14617
+ } else if (!this.activePromptStream?.sentUuids.has(lifecycle2.command_uuid)) await this.recordPeerMessage(lifecycle2.command_uuid, response);
14600
14618
  if (this.activeQuery !== response) break;
14601
14619
  await this.recordSteerRead(lifecycle2.command_uuid);
14602
14620
  }
@@ -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-PI7M37BA.js";
6
+ } from "./chunk-BS7JLXOU.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-2ENRWARZ.js";
12
+ } from "./chunk-V5AMWNUX.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-2ENRWARZ.js";
14
+ } from "./chunk-V5AMWNUX.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.1603",
3
+ "version": "0.1.1606",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",