replicas-engine 0.1.716 → 0.1.717

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  mayCreatePullRequest
4
- } from "./chunk-UF32U5Z4.js";
4
+ } from "./chunk-AIO4PUU7.js";
5
5
 
6
6
  // src/services/post-tool-pr-notifier.ts
7
7
  async function notifyPostToolUse(toolName, toolInput) {
@@ -3452,6 +3452,17 @@ function isTransientErrorText(text, options = {}) {
3452
3452
  return false;
3453
3453
  }
3454
3454
 
3455
+ // ../shared/src/auth-errors.ts
3456
+ var AUTHENTICATION_ERROR_PATTERNS = [
3457
+ /unauthorized/,
3458
+ /authentication error/,
3459
+ /invalid api key/
3460
+ ];
3461
+ function isAuthenticationErrorText(text, extraPatterns = []) {
3462
+ const normalized = text.toLowerCase();
3463
+ return AUTHENTICATION_ERROR_PATTERNS.some((pattern) => pattern.test(normalized)) || extraPatterns.some((pattern) => pattern.test(normalized));
3464
+ }
3465
+
3455
3466
  // ../shared/src/claude-auth.ts
3456
3467
  function isClaudeAuthErrorText(text) {
3457
3468
  const lower = text.toLowerCase();
@@ -3462,7 +3473,7 @@ function isClaudeAuthErrorText(text) {
3462
3473
  function isCodexAuthError(error) {
3463
3474
  const msg = error instanceof Error ? error.message : String(error);
3464
3475
  const lower = msg.toLowerCase();
3465
- return lower.includes("unauthorized") || lower.includes("authentication") || lower.includes("invalid api key") || lower.includes("incorrect api key") || lower.includes("api key") && lower.includes("invalid") || lower.includes("401") || lower.includes('codexerrorinfo="unauthorized"') || lower.includes("codexerrorinfo=unauthorized") || lower.includes("failed to refresh token") || lower.includes("your session has ended");
3476
+ return isAuthenticationErrorText(msg) || lower.includes("authentication") || lower.includes("incorrect api key") || lower.includes("api key") && lower.includes("invalid") || lower.includes("401") || lower.includes('codexerrorinfo="unauthorized"') || lower.includes("codexerrorinfo=unauthorized") || lower.includes("failed to refresh token") || lower.includes("your session has ended");
3466
3477
  }
3467
3478
 
3468
3479
  // ../shared/src/version.ts
@@ -6734,6 +6745,7 @@ export {
6734
6745
  headlessAgentRequestSchema,
6735
6746
  extractErrorText,
6736
6747
  isTransientErrorText,
6748
+ isAuthenticationErrorText,
6737
6749
  isClaudeAuthErrorText,
6738
6750
  isCodexAuthError,
6739
6751
  isVersionBelow,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  HOOK_EXEC_MAX_BUFFER_BYTES,
4
4
  isVersionBelow
5
- } from "./chunk-UF32U5Z4.js";
5
+ } from "./chunk-AIO4PUU7.js";
6
6
 
7
7
  // src/utils/presigned-upload.ts
8
8
  import { createReadStream } from "fs";
@@ -267,7 +267,7 @@ var DEFAULT_CODEX_ARGS = [
267
267
  var MIN_CODEX_CLI_VERSION = "0.144.6";
268
268
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
269
269
  var codexCliVersionEnsured = null;
270
- var ENGINE_PACKAGE_VERSION = "0.1.716";
270
+ var ENGINE_PACKAGE_VERSION = "0.1.717";
271
271
  var INITIALIZE_METHOD = "initialize";
272
272
  var INITIALIZED_NOTIFICATION = "initialized";
273
273
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -12,7 +12,7 @@ import {
12
12
  isValidAgentProvider,
13
13
  parsePosixEnvFile,
14
14
  readReplicasRuntimeEnv
15
- } from "./chunk-UF32U5Z4.js";
15
+ } from "./chunk-AIO4PUU7.js";
16
16
 
17
17
  // src/engine-env.ts
18
18
  import { readFileSync as readFileSync2 } from "fs";
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  evaluateCommandProtection
4
- } from "./chunk-TQQYZEKY.js";
4
+ } from "./chunk-Z4EWBCBT.js";
5
5
  import {
6
6
  isRecord
7
7
  } from "./chunk-2RB7SIP3.js";
8
- import "./chunk-UF32U5Z4.js";
8
+ import "./chunk-AIO4PUU7.js";
9
9
 
10
10
  // src/command-protection-hook.ts
11
11
  var provider = process.argv[2];
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  evaluateCommandProtection
4
- } from "./chunk-TQQYZEKY.js";
4
+ } from "./chunk-Z4EWBCBT.js";
5
5
  import {
6
6
  notifyPostToolUse
7
- } from "./chunk-LQ7KHFS5.js";
7
+ } from "./chunk-7ZCPXUQ3.js";
8
8
  import "./chunk-2RB7SIP3.js";
9
- import "./chunk-UF32U5Z4.js";
9
+ import "./chunk-AIO4PUU7.js";
10
10
 
11
11
  // src/deepseek-command-protection-plugin.ts
12
12
  function replicasCommandProtection(context) {
@@ -4,12 +4,12 @@ import {
4
4
  buildCodexAgentEnv,
5
5
  putPresignedFile,
6
6
  recoverCompletedTurn
7
- } from "./chunk-6KPIG34S.js";
7
+ } from "./chunk-R2MUWRL5.js";
8
8
  import {
9
9
  AGENT,
10
10
  getMemoryOutputSafetyViolation,
11
11
  headlessAgentRequestSchema
12
- } from "./chunk-UF32U5Z4.js";
12
+ } from "./chunk-AIO4PUU7.js";
13
13
 
14
14
  // src/headless-agent.ts
15
15
  import { createHash } from "crypto";
package/dist/src/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  monolithService,
9
9
  reportCommandProtectionBlock,
10
10
  setAgentCredentialSnapshot
11
- } from "./chunk-TQQYZEKY.js";
11
+ } from "./chunk-Z4EWBCBT.js";
12
12
  import {
13
13
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
14
14
  AGENT_MESSAGE_DELTA_METHOD,
@@ -35,7 +35,7 @@ import {
35
35
  execFileAsync,
36
36
  putPresignedFile,
37
37
  recoverCompletedTurn
38
- } from "./chunk-6KPIG34S.js";
38
+ } from "./chunk-R2MUWRL5.js";
39
39
  import {
40
40
  isRecord as isRecord2
41
41
  } from "./chunk-2RB7SIP3.js";
@@ -166,6 +166,7 @@ import {
166
166
  isAgentChatMcpActivityRecord,
167
167
  isAgentChatSkillActivityRecord,
168
168
  isAgentChatTurnActivityRecord,
169
+ isAuthenticationErrorText,
169
170
  isCanvasTextKind,
170
171
  isChatMessageSender,
171
172
  isClaudeAuthErrorText,
@@ -213,7 +214,7 @@ import {
213
214
  shellQuotePosix,
214
215
  stripAgentDiagnosticErrors,
215
216
  withTimeout
216
- } from "./chunk-UF32U5Z4.js";
217
+ } from "./chunk-AIO4PUU7.js";
217
218
 
218
219
  // src/index.ts
219
220
  import { serve } from "@hono/node-server";
@@ -8020,6 +8021,9 @@ var CURSOR_TRANSPORT_ERROR_PATTERNS = [
8020
8021
  function isCursorTransportError(text) {
8021
8022
  return isTransientErrorText(text, { extraPatterns: CURSOR_TRANSPORT_ERROR_PATTERNS });
8022
8023
  }
8024
+ function isCursorAuthenticationError(text) {
8025
+ return isAuthenticationErrorText(text, [/error_not_logged_in/]);
8026
+ }
8023
8027
  function finiteNumber(value) {
8024
8028
  return typeof value === "number" && Number.isFinite(value) ? value : 0;
8025
8029
  }
@@ -8287,7 +8291,15 @@ var CursorManager = class extends CodingAgentManager {
8287
8291
  detail: failure.text,
8288
8292
  transport: failure.transport
8289
8293
  });
8290
- const displayMessage = failure.transport ? sawCursorActivity ? "Cursor couldn't reconnect after its automatic retries. Retry the message to continue from the same chat." : run ? "Cursor couldn't connect after its automatic retries. Retry the message or start a new Cursor chat if the problem continues." : "The connection to Cursor failed. Retry the message or start a new Cursor chat if the problem continues." : failure.text;
8294
+ const credentialScope = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.cursor?.scope;
8295
+ const credentialLabel = credentialScope === "user" ? "personal API key or account" : credentialScope === "org" ? "organization API key or account" : "configured API key or account";
8296
+ const authenticationMessage = isCursorAuthenticationError(failure.text) ? [
8297
+ `Cursor rejected the ${credentialLabel} for this request.`,
8298
+ "Logging out and back in does not replace the Cursor API key stored in Replicas.",
8299
+ "Update it in Settings \u2192 Coding Agents before starting a new workspace.",
8300
+ failure.requestId ? `If a fresh key still fails, contact Cursor support with request ID ${failure.requestId}.` : ""
8301
+ ].filter(Boolean).join(" ") : null;
8302
+ const displayMessage = failure.transport ? sawCursorActivity ? "Cursor couldn't reconnect after its automatic retries. Retry the message to continue from the same chat." : run ? "Cursor couldn't connect after its automatic retries. Retry the message or start a new Cursor chat if the problem continues." : "The connection to Cursor failed. Retry the message or start a new Cursor chat if the problem continues." : authenticationMessage ?? failure.text;
8291
8303
  if (failure.transport) {
8292
8304
  this.activeRun = null;
8293
8305
  this.closeAgent();
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  notifyPostToolUse
4
- } from "./chunk-LQ7KHFS5.js";
4
+ } from "./chunk-7ZCPXUQ3.js";
5
5
  import {
6
6
  isRecord
7
7
  } from "./chunk-2RB7SIP3.js";
8
- import "./chunk-UF32U5Z4.js";
8
+ import "./chunk-AIO4PUU7.js";
9
9
 
10
10
  // src/post-tool-pr-hook.ts
11
11
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.716",
3
+ "version": "0.1.717",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",