replicas-engine 0.1.663 → 0.1.665

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.
@@ -6332,7 +6332,7 @@ var DEFAULT_CODEX_ARGS = [
6332
6332
  var MIN_CODEX_CLI_VERSION = "0.144.6";
6333
6333
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
6334
6334
  var codexCliVersionEnsured = null;
6335
- var ENGINE_PACKAGE_VERSION = "0.1.663";
6335
+ var ENGINE_PACKAGE_VERSION = "0.1.665";
6336
6336
  var INITIALIZE_METHOD = "initialize";
6337
6337
  var INITIALIZED_NOTIFICATION = "initialized";
6338
6338
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -7,7 +7,7 @@ import {
7
7
  headlessAgentRequestSchema,
8
8
  putPresignedFile,
9
9
  recoverCompletedTurn
10
- } from "./chunk-R6UJFZCJ.js";
10
+ } from "./chunk-SBJ4HUPK.js";
11
11
 
12
12
  // src/headless-agent.ts
13
13
  import { createHash } from "crypto";
package/dist/src/index.js CHANGED
@@ -186,7 +186,7 @@ import {
186
186
  serializeCanvasContentResponse,
187
187
  shellQuotePosix,
188
188
  stripAgentDiagnosticErrors
189
- } from "./chunk-R6UJFZCJ.js";
189
+ } from "./chunk-SBJ4HUPK.js";
190
190
 
191
191
  // src/index.ts
192
192
  import { serve } from "@hono/node-server";
@@ -3317,7 +3317,7 @@ var AuthFallbackCoordinator = class {
3317
3317
  `${this.provider} ${reason === "out_of_credits" ? "is out of credits" : "hit its usage limit"}: ${detail}`,
3318
3318
  "exhausted"
3319
3319
  );
3320
- if (!swap.ok && swap.error.code === "no_credentials") return "unavailable";
3320
+ if (!swap.ok && swap.error.code === "no_credentials") return "not_configured";
3321
3321
  const applied = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS[this.provider] ?? exhausted;
3322
3322
  const moved = swap.ok && !(applied.method === exhausted.method && applied.scope === exhausted.scope);
3323
3323
  const payload = {
@@ -4925,7 +4925,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
4925
4925
  }
4926
4926
  async emitQuotaExhaustedEvent(kind, outcome, detail) {
4927
4927
  const limit = kind === "out_of_credits" ? "Claude ran out of credits on the credential this workspace is using." : "Claude hit the usage limit on the credential this workspace is using.";
4928
- const next = outcome === "failed" ? "Switching to the alternate credential failed. Check the credentials in Settings \u2192 Agents and try again." : "No other credential is available for this workspace. Add one in Settings \u2192 Agents, or try again once the limit resets.";
4928
+ const next = outcome === "failed" ? "The configured fallback credential could not be used. Check it in Settings \u2192 Agents and try again." : outcome === "not_configured" ? "No fallback credential is configured for this workspace. Add one in Settings \u2192 Agents, or try again once the limit resets." : "No other credential is available for this workspace. Check Settings \u2192 Agents, or try again once the limit resets.";
4929
4929
  await this.emitTerminalErrorResult(detail, [`${limit} ${next}`]);
4930
4930
  }
4931
4931
  async emitMidTurnExhaustedEvent(error) {
@@ -6482,15 +6482,9 @@ var CodexAspManager = class extends CodingAgentManager {
6482
6482
  this.initializeManager(this.processMessageInternal.bind(this));
6483
6483
  }
6484
6484
  async initialize() {
6485
- if (this.initialSessionId) {
6486
- this.currentThreadId = this.initialSessionId;
6487
- return;
6488
- }
6489
6485
  const replayed = await this.historyFile?.load();
6490
- if (replayed) {
6491
- if (replayed.transcript) {
6492
- this.mergeTranscriptSnapshot(replayed.transcript);
6493
- }
6486
+ if (replayed?.transcript && (!this.initialSessionId || replayed.transcript.threadId === this.initialSessionId)) {
6487
+ this.mergeTranscriptSnapshot(replayed.transcript);
6494
6488
  }
6495
6489
  this.currentThreadId = this.initialSessionId ?? replayed?.transcript?.threadId ?? null;
6496
6490
  }
@@ -6647,16 +6641,22 @@ var CodexAspManager = class extends CodingAgentManager {
6647
6641
  itemsView: "full"
6648
6642
  }
6649
6643
  );
6650
- const transcript = turnsToAspTranscript(
6644
+ const nativeTranscript = turnsToAspTranscript(
6651
6645
  this.currentThreadId,
6652
6646
  (/* @__PURE__ */ new Date()).toISOString(),
6653
6647
  response.data
6654
6648
  );
6655
- if (cursor === void 0) {
6656
- this.codexAspTranscript = transcript;
6657
- this.syncTranscriptSequence(transcript);
6658
- }
6659
- return { transcript, before: response.nextCursor };
6649
+ const mergedTranscript = mergeCodexAspTranscripts(this.codexAspTranscript, nativeTranscript) ?? nativeTranscript;
6650
+ this.codexAspTranscript = mergedTranscript;
6651
+ this.syncTranscriptSequence(mergedTranscript);
6652
+ const turnIds = new Set(response.data.map((turn) => turn.id));
6653
+ return {
6654
+ transcript: {
6655
+ ...mergedTranscript,
6656
+ turns: mergedTranscript.turns.filter((turn) => turnIds.has(turn.id))
6657
+ },
6658
+ before: response.nextCursor
6659
+ };
6660
6660
  }
6661
6661
  getGoal() {
6662
6662
  return this.currentGoal;
@@ -6723,6 +6723,7 @@ var CodexAspManager = class extends CodingAgentManager {
6723
6723
  this.recordCodexHistoryEvent("event_msg", {
6724
6724
  type: "user_message",
6725
6725
  message: request.message,
6726
+ ...request.messageId ? { [USER_MESSAGE_ID_PAYLOAD_KEY]: request.messageId } : {},
6726
6727
  ...images ? { images } : {},
6727
6728
  ...extraPayload
6728
6729
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.663",
3
+ "version": "0.1.665",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",