replicas-engine 0.1.867 → 0.1.868

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.
@@ -5,11 +5,11 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-244NLRXG.js";
9
- import "./chunk-VTF25WK2.js";
10
- import "./chunk-QVCFVOQC.js";
8
+ } from "./chunk-ZA44WMZK.js";
9
+ import "./chunk-AZVITHZV.js";
10
+ import "./chunk-WL5M6DWS.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-AEQP2BPA.js";
12
+ import "./chunk-IT5R5GJT.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
  export {
15
15
  getCodexAspHost,
@@ -15,7 +15,7 @@ import {
15
15
  isValidRelayBaseProvider,
16
16
  parsePosixEnvFile,
17
17
  readReplicasRuntimeEnv
18
- } from "./chunk-AEQP2BPA.js";
18
+ } from "./chunk-IT5R5GJT.js";
19
19
 
20
20
  // src/engine-env.ts
21
21
  import { readFileSync as readFileSync2 } from "fs";
@@ -3922,6 +3922,15 @@ function parseCodexEvents(events) {
3922
3922
  const pendingToolCalls = /* @__PURE__ */ new Map();
3923
3923
  const pendingPatches = /* @__PURE__ */ new Map();
3924
3924
  events.forEach((event, eventIndex) => {
3925
+ if (event.type === "codex-asp-error") {
3926
+ messages.push({
3927
+ id: displayId(event, eventIndex, "error"),
3928
+ type: "error",
3929
+ message: getPayloadString(event, "message") ?? "Codex run failed",
3930
+ timestamp: event.timestamp
3931
+ });
3932
+ return;
3933
+ }
3925
3934
  if (event.type === CODEX_QUOTA_STATUS_EVENT_TYPE) {
3926
3935
  const state = event.payload?.state;
3927
3936
  if (state) {
@@ -7993,6 +8002,7 @@ export {
7993
8002
  QUEUED_MESSAGE_REMOVED_EVENT_TYPE,
7994
8003
  REMOVED_MESSAGE_IDS_PAYLOAD_KEY,
7995
8004
  USER_MESSAGE_ID_PAYLOAD_KEY,
8005
+ CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
7996
8006
  CODEX_ASP_TRANSCRIPT_UPDATED_EVENT_TYPE,
7997
8007
  CODEX_QUOTA_STATUS_EVENT_TYPE,
7998
8008
  COMPACTION_STATUS_EVENT_TYPE,
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  shouldRefreshPullRequests
6
- } from "./chunk-AEQP2BPA.js";
6
+ } from "./chunk-IT5R5GJT.js";
7
7
 
8
8
  // src/services/post-tool-pr-notifier.ts
9
9
  async function notifyPostToolUse(toolName, toolInput) {
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  monolithRequest
6
- } from "./chunk-VTF25WK2.js";
6
+ } from "./chunk-AZVITHZV.js";
7
7
  import {
8
8
  extractCommandProtectionCommandText,
9
9
  findGitCommitSignals,
10
10
  findPrMergeSignals
11
- } from "./chunk-AEQP2BPA.js";
11
+ } from "./chunk-IT5R5GJT.js";
12
12
 
13
13
  // src/services/command-protection-service.ts
14
14
  var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES,
6
6
  isVersionBelow
7
- } from "./chunk-AEQP2BPA.js";
7
+ } from "./chunk-IT5R5GJT.js";
8
8
 
9
9
  // src/utils/codex-agent-env.ts
10
10
  function buildCodexAgentEnv(source = process.env) {
@@ -241,7 +241,7 @@ var DEFAULT_CODEX_ARGS = [
241
241
  var MIN_CODEX_CLI_VERSION = "0.153.3";
242
242
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
243
243
  var codexCliVersionEnsured = null;
244
- var ENGINE_PACKAGE_VERSION = "0.1.867";
244
+ var ENGINE_PACKAGE_VERSION = "0.1.868";
245
245
  var INITIALIZE_METHOD = "initialize";
246
246
  var INITIALIZED_NOTIFICATION = "initialized";
247
247
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -5,13 +5,13 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-VTF25WK2.js";
8
+ } from "./chunk-AZVITHZV.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  SUBPROCESS_MAX_BUFFER,
12
12
  buildCodexAgentEnv,
13
13
  execFileAsync
14
- } from "./chunk-QVCFVOQC.js";
14
+ } from "./chunk-WL5M6DWS.js";
15
15
  import {
16
16
  isRecord
17
17
  } from "./chunk-UZSNFLDQ.js";
@@ -23,7 +23,7 @@ import {
23
23
  createSuccessResult,
24
24
  listOpenAICompatibleModels,
25
25
  resolveOpenAICompatibleModelsUrl
26
- } from "./chunk-AEQP2BPA.js";
26
+ } from "./chunk-IT5R5GJT.js";
27
27
 
28
28
  // src/managers/codex-token-manager.ts
29
29
  import { promises as fs } from "fs";
@@ -244,7 +244,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
244
244
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
245
245
  await this.applyCredentialsResponse(data);
246
246
  if (data.scope) setAgentCredentialSnapshot("codex", { method: data.type, scope: data.scope, revision: data.revision });
247
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-KJEPE7V4.js");
247
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-BL3RFX2L.js");
248
248
  await restartCodexAspHostIfRunning2();
249
249
  });
250
250
  await this.start(true);
@@ -264,7 +264,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
264
264
  await this.applyCredentialUpdate(generation, async () => {
265
265
  await this.applyCredentialsResponse(data);
266
266
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
267
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-KJEPE7V4.js");
267
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-BL3RFX2L.js");
268
268
  await restartCodexAspHostIfRunning2();
269
269
  }
270
270
  if (data.scope) {
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-5KTPYXPW.js";
7
- import "./chunk-VTF25WK2.js";
6
+ } from "./chunk-RMSEJMO4.js";
7
+ import "./chunk-AZVITHZV.js";
8
8
  import {
9
9
  isRecord
10
10
  } from "./chunk-UZSNFLDQ.js";
11
- import "./chunk-AEQP2BPA.js";
11
+ import "./chunk-IT5R5GJT.js";
12
12
  import "./chunk-VEQXQN22.js";
13
13
 
14
14
  // src/command-protection-hook.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-5KTPYXPW.js";
6
+ } from "./chunk-RMSEJMO4.js";
7
7
  import {
8
8
  notifyPostToolUse
9
- } from "./chunk-62HG7KT6.js";
10
- import "./chunk-VTF25WK2.js";
9
+ } from "./chunk-MR5HFA2D.js";
10
+ import "./chunk-AZVITHZV.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-AEQP2BPA.js";
12
+ import "./chunk-IT5R5GJT.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/deepseek-command-protection-plugin.ts
@@ -8,12 +8,12 @@ import {
8
8
  import {
9
9
  AppServerProcess,
10
10
  buildCodexAgentEnv
11
- } from "./chunk-QVCFVOQC.js";
11
+ } from "./chunk-WL5M6DWS.js";
12
12
  import {
13
13
  AGENT,
14
14
  getMemoryOutputSafetyViolation,
15
15
  headlessAgentRequestSchema
16
- } from "./chunk-AEQP2BPA.js";
16
+ } from "./chunk-IT5R5GJT.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
 
19
19
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  evaluateCommandProtection,
92
92
  extractToolCommand,
93
93
  reportCommandProtectionBlock
94
- } from "./chunk-5KTPYXPW.js";
94
+ } from "./chunk-RMSEJMO4.js";
95
95
  import {
96
96
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
97
97
  AGENT_MESSAGE_DELTA_METHOD,
@@ -132,20 +132,20 @@ import {
132
132
  recordCredentialFallback,
133
133
  recordExhaustedCredential,
134
134
  restartCodexAspHost
135
- } from "./chunk-244NLRXG.js";
135
+ } from "./chunk-ZA44WMZK.js";
136
136
  import {
137
137
  ENGINE_ENV,
138
138
  IS_WARMING_MODE,
139
139
  monolithRequest,
140
140
  monolithService,
141
141
  setAgentCredentialSnapshot
142
- } from "./chunk-VTF25WK2.js";
142
+ } from "./chunk-AZVITHZV.js";
143
143
  import {
144
144
  AspClient,
145
145
  SUBPROCESS_MAX_BUFFER,
146
146
  execAsync,
147
147
  execFileAsync
148
- } from "./chunk-QVCFVOQC.js";
148
+ } from "./chunk-WL5M6DWS.js";
149
149
  import {
150
150
  isRecord as isRecord2
151
151
  } from "./chunk-UZSNFLDQ.js";
@@ -179,6 +179,7 @@ import {
179
179
  CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE,
180
180
  CLAUDE_SONNET_5_BEDROCK_MODEL,
181
181
  CLAUDE_SONNET_5_MODEL,
182
+ CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
182
183
  CODEX_ASP_TRANSCRIPT_UPDATED_EVENT_TYPE,
183
184
  CODEX_QUOTA_STATUS_EVENT_TYPE,
184
185
  COMPACTION_STATUS_EVENT_TYPE,
@@ -357,7 +358,7 @@ import {
357
358
  waitRelaySubagentRequestSchema,
358
359
  withTimeout,
359
360
  workspaceCredentialProviderSchema
360
- } from "./chunk-AEQP2BPA.js";
361
+ } from "./chunk-IT5R5GJT.js";
361
362
  import {
362
363
  __commonJS,
363
364
  __export,
@@ -14910,7 +14911,7 @@ function isCompactCommand(message) {
14910
14911
  var CodexAspManager = class extends CodingAgentManager {
14911
14912
  currentThreadId = null;
14912
14913
  activeTurnId = null;
14913
- threadAttached = false;
14914
+ attachedClient = null;
14914
14915
  attachedModel = null;
14915
14916
  attachedDeveloperInstructions = null;
14916
14917
  historyFile;
@@ -15255,8 +15256,11 @@ var CodexAspManager = class extends CodingAgentManager {
15255
15256
  terminalError = retryFailure.error;
15256
15257
  }
15257
15258
  }
15259
+ const message = terminalError instanceof Error ? terminalError.message : String(terminalError);
15260
+ const transcriptError = this.codexAspTranscript?.turns.find((turn) => turn.id === this.activeTurnId)?.items.find((item) => item.type === "error" && item.message === message);
15258
15261
  const event = this.recordCodexHistoryEvent("codex-asp-error", {
15259
- message: terminalError instanceof Error ? terminalError.message : String(terminalError)
15262
+ message,
15263
+ ...transcriptError ? { [CODEX_ASP_ITEM_ID_PAYLOAD_KEY]: transcriptError.id } : {}
15260
15264
  });
15261
15265
  this.onEvent(event);
15262
15266
  throw terminalError;
@@ -15316,11 +15320,15 @@ var CodexAspManager = class extends CodingAgentManager {
15316
15320
  this.emitQuotaEvent(this.quotaStatus.recordTurnSuccess());
15317
15321
  }
15318
15322
  async ensureThread(host, request, developerInstructions) {
15323
+ if (this.attachedClient !== host.client) {
15324
+ this.skillRegistriesApplied = false;
15325
+ this.modelServiceTierCache = null;
15326
+ }
15319
15327
  await this.applySkillRegistries(host);
15320
15328
  const existingThreadId = this.currentThreadId;
15321
15329
  const requestedModel = request.model ?? DEFAULT_MODEL;
15322
15330
  if (existingThreadId) {
15323
- if (!this.threadAttached || requestedModel !== this.attachedModel || (developerInstructions ?? null) !== this.attachedDeveloperInstructions) {
15331
+ if (this.attachedClient !== host.client || requestedModel !== this.attachedModel || (developerInstructions ?? null) !== this.attachedDeveloperInstructions) {
15324
15332
  const serviceTier2 = await this.resolveRequestedServiceTier(host, request);
15325
15333
  const response = await host.client.request(
15326
15334
  THREAD_RESUME_METHOD,
@@ -15328,7 +15336,7 @@ var CodexAspManager = class extends CodingAgentManager {
15328
15336
  );
15329
15337
  this.currentThreadId = response.thread.id;
15330
15338
  this.activeServiceTier = response.serviceTier;
15331
- this.threadAttached = true;
15339
+ this.attachedClient = host.client;
15332
15340
  this.attachedModel = requestedModel;
15333
15341
  this.attachedDeveloperInstructions = developerInstructions ?? null;
15334
15342
  this.seedHistoryFromThread(response.thread);
@@ -15344,7 +15352,7 @@ var CodexAspManager = class extends CodingAgentManager {
15344
15352
  const threadId = threadStartResponse.thread.id;
15345
15353
  this.currentThreadId = threadId;
15346
15354
  this.activeServiceTier = threadStartResponse.serviceTier;
15347
- this.threadAttached = true;
15355
+ this.attachedClient = host.client;
15348
15356
  this.attachedModel = requestedModel;
15349
15357
  this.attachedDeveloperInstructions = developerInstructions ?? null;
15350
15358
  await this.onSaveSessionId(this.currentThreadId);
@@ -15639,7 +15647,7 @@ var CodexAspManager = class extends CodingAgentManager {
15639
15647
  });
15640
15648
  };
15641
15649
  const onDispose = (reason) => {
15642
- this.threadAttached = false;
15650
+ this.attachedClient = null;
15643
15651
  this.activeTurnId = null;
15644
15652
  if (reason instanceof CodexAspAuthMethodChangedError) {
15645
15653
  rejectDisposed(reason);
@@ -15679,7 +15687,7 @@ var CodexAspManager = class extends CodingAgentManager {
15679
15687
  this.transcriptUpdateCoalescer.flushPending();
15680
15688
  await removeTempImageFiles(tempImagePaths);
15681
15689
  if (host.client.isDisposed) {
15682
- this.threadAttached = false;
15690
+ this.attachedClient = null;
15683
15691
  }
15684
15692
  }
15685
15693
  }
@@ -16233,7 +16241,7 @@ var CodexAspManager = class extends CodingAgentManager {
16233
16241
  async restartAndRetry(dispatch) {
16234
16242
  try {
16235
16243
  await restartCodexAspHost();
16236
- this.threadAttached = false;
16244
+ this.attachedClient = null;
16237
16245
  await dispatch();
16238
16246
  return null;
16239
16247
  } catch (error) {
@@ -3,11 +3,11 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  notifyPostToolUse
6
- } from "./chunk-62HG7KT6.js";
6
+ } from "./chunk-MR5HFA2D.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
- import "./chunk-AEQP2BPA.js";
10
+ import "./chunk-IT5R5GJT.js";
11
11
  import "./chunk-VEQXQN22.js";
12
12
 
13
13
  // src/post-tool-pr-hook.ts
@@ -11,7 +11,7 @@ import {
11
11
  relaySubagentResponseSchema,
12
12
  spawnRelaySubagentRequestSchema,
13
13
  waitRelaySubagentRequestSchema
14
- } from "./chunk-AEQP2BPA.js";
14
+ } from "./chunk-IT5R5GJT.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/relay-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.867",
3
+ "version": "0.1.868",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",