replicas-engine 0.1.510 → 0.1.511

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.
Files changed (2) hide show
  1. package/dist/src/index.js +14 -23
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -611,7 +611,7 @@ var WORKSPACE_SIZES = ["small", "large"];
611
611
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
612
612
 
613
613
  // ../shared/src/e2b.ts
614
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-27-v1";
614
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-27-v2";
615
615
 
616
616
  // ../shared/src/runtime-env.ts
617
617
  function shellQuotePosix(value) {
@@ -3529,7 +3529,6 @@ function parseAgentEventJsonlWithCodexAspTranscript(content, options = {}) {
3529
3529
  }
3530
3530
 
3531
3531
  // ../shared/src/display-message/parsers/utils.ts
3532
- var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
3533
3532
  function userMessageImages(value) {
3534
3533
  if (!Array.isArray(value)) return void 0;
3535
3534
  const images = value.filter((item) => isRecord(item) && item.type === "image" && typeof item.mediaType === "string" && typeof item.data === "string");
@@ -4315,14 +4314,21 @@ function parseMcpToolName(name) {
4315
4314
  }
4316
4315
 
4317
4316
  // ../shared/src/display-message/parsers/claude-parser.ts
4317
+ var ABORTED_TERMINAL_REASONS = /* @__PURE__ */ new Set(["aborted_streaming", "aborted_tools"]);
4318
4318
  function coerceClaudeResultPayload(payload) {
4319
4319
  return {
4320
4320
  is_error: typeof payload.is_error === "boolean" ? payload.is_error : void 0,
4321
4321
  subtype: typeof payload.subtype === "string" ? payload.subtype : void 0,
4322
- errors: Array.isArray(payload.errors) ? payload.errors.filter((e) => typeof e === "string") : void 0
4322
+ errors: Array.isArray(payload.errors) ? payload.errors.filter((e) => typeof e === "string") : void 0,
4323
+ terminal_reason: typeof payload.terminal_reason === "string" ? payload.terminal_reason : void 0
4323
4324
  };
4324
4325
  }
4326
+ function stripAgentDiagnosticErrors(errors) {
4327
+ return errors.filter((error) => !error.startsWith("[ede_diagnostic]"));
4328
+ }
4325
4329
  function isClaudeResultError(payload) {
4330
+ if (payload.terminal_reason && ABORTED_TERMINAL_REASONS.has(payload.terminal_reason)) return false;
4331
+ if (payload.errors?.length && stripAgentDiagnosticErrors(payload.errors).length === 0) return false;
4326
4332
  return Boolean(payload.is_error) || payload.subtype !== "success";
4327
4333
  }
4328
4334
  function upsertDisplayMessage(messages, message) {
@@ -4357,7 +4363,6 @@ function parseClaudeEvents(events, parentToolUseId) {
4357
4363
  return message?.type === "user" && areUserMessagesWithinMatchWindow(message, { content, timestamp });
4358
4364
  });
4359
4365
  };
4360
- let turnWasInterrupted = false;
4361
4366
  const taskAccumulator = new TaskAccumulator();
4362
4367
  const taskSnapshot = () => taskAccumulator.getTasks().map((task) => ({
4363
4368
  text: task.subject,
@@ -4436,7 +4441,6 @@ function parseClaudeEvents(events, parentToolUseId) {
4436
4441
  if (LOCAL_COMMAND_ECHO_REGEX.test(textContent.trim())) {
4437
4442
  return;
4438
4443
  }
4439
- turnWasInterrupted = INTERRUPTED_MESSAGE_REGEX.test(textContent.trim());
4440
4444
  const images = content.filter((c) => c.type === "image" && c.source).map((c) => {
4441
4445
  const source = c.source;
4442
4446
  return {
@@ -4685,26 +4689,12 @@ function parseClaudeEvents(events, parentToolUseId) {
4685
4689
  }
4686
4690
  if (event.type === "claude-result") {
4687
4691
  const payload = coerceClaudeResultPayload(event.payload);
4688
- const errorList = payload.errors || [];
4689
- if (turnWasInterrupted) {
4690
- turnWasInterrupted = false;
4691
- const genuineErrors = errorList.filter((e) => !e.includes("[ede_diagnostic]"));
4692
- if (genuineErrors.length > 0) {
4693
- messages.push({
4694
- id: `error-${event.timestamp}`,
4695
- type: "error",
4696
- message: genuineErrors.join("\n"),
4697
- timestamp: event.timestamp
4698
- });
4699
- }
4700
- return;
4701
- }
4702
4692
  if (isClaudeResultError(payload)) {
4703
- const errorMessage = errorList.length > 0 ? errorList.join("\n") : "Claude session encountered an unexpected error.";
4693
+ const genuineErrors = stripAgentDiagnosticErrors(payload.errors ?? []);
4704
4694
  messages.push({
4705
4695
  id: `error-${event.timestamp}`,
4706
4696
  type: "error",
4707
- message: errorMessage,
4697
+ message: genuineErrors.length > 0 ? genuineErrors.join("\n") : "Claude session encountered an unexpected error.",
4708
4698
  timestamp: event.timestamp
4709
4699
  });
4710
4700
  }
@@ -10081,7 +10071,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
10081
10071
  var MIN_CODEX_CLI_VERSION = "0.144.6";
10082
10072
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
10083
10073
  var codexCliVersionEnsured = null;
10084
- var ENGINE_PACKAGE_VERSION = "0.1.510";
10074
+ var ENGINE_PACKAGE_VERSION = "0.1.511";
10085
10075
  var INITIALIZE_METHOD = "initialize";
10086
10076
  var INITIALIZED_NOTIFICATION = "initialized";
10087
10077
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -14717,7 +14707,8 @@ function terminalErrorsFromEvent(event, provider, codexTranscript) {
14717
14707
  if (event.type === "claude-result") {
14718
14708
  const payload = coerceClaudeResultPayload(event.payload);
14719
14709
  if (!isClaudeResultError(payload)) return null;
14720
- return payload.errors?.length ? payload.errors : ["Claude run failed"];
14710
+ const errors2 = stripAgentDiagnosticErrors(payload.errors ?? []);
14711
+ return errors2.length > 0 ? errors2 : ["Claude run failed"];
14721
14712
  }
14722
14713
  if (event.type === CODEX_QUOTA_STATUS_EVENT_TYPE) {
14723
14714
  return event.payload.state === "out_of_credits" ? ["Codex is out of credits. Top up the connected OpenAI account to resume."] : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.510",
3
+ "version": "0.1.511",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",