replicas-engine 0.1.757 → 0.1.758

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-QCFJKMNS.js";
9
- import "./chunk-ONBZ7L3S.js";
10
- import "./chunk-A2656WZ4.js";
8
+ } from "./chunk-EQEWL6FF.js";
9
+ import "./chunk-WTNFZX53.js";
10
+ import "./chunk-IHGPS5IS.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-VAXA2XOP.js";
12
+ import "./chunk-24FE3TDH.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
  export {
15
15
  getCodexAspHost,
@@ -465,6 +465,7 @@ var CREDENTIAL_SCOPE_PRIORITY = [CREDENTIAL_SCOPE.USER, CREDENTIAL_SCOPE.ORG];
465
465
  var CREDENTIAL_METHOD = {
466
466
  OAUTH: "oauth",
467
467
  API_KEY: "api_key",
468
+ OPENAI_COMPATIBLE: "openai-compatible",
468
469
  FOUNDRY: "foundry",
469
470
  BEDROCK: "bedrock",
470
471
  OPENCODE_GO: "opencode-go",
@@ -480,6 +481,7 @@ var CREDENTIAL_TYPE = {
480
481
  CLAUDE_BEDROCK: "claude_bedrock",
481
482
  CODEX_OAUTH: "codex",
482
483
  OPENAI_API_KEY: "openai_api_key",
484
+ OPENAI_COMPATIBLE: "openai_compatible",
483
485
  CODEX_FOUNDRY: "codex_foundry",
484
486
  CURSOR_API_KEY: "cursor_api_key",
485
487
  OPENCODE_GO_API_KEY: "opencode_go_api_key",
@@ -503,6 +505,7 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
503
505
  [AGENT.CODEX]: [
504
506
  { method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CODEX_OAUTH },
505
507
  { method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.OPENAI_API_KEY },
508
+ { method: CREDENTIAL_METHOD.OPENAI_COMPATIBLE, credentialType: CREDENTIAL_TYPE.OPENAI_COMPATIBLE },
506
509
  { method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CODEX_FOUNDRY }
507
510
  ],
508
511
  [AGENT.CURSOR]: [
@@ -539,6 +542,8 @@ function getCredentialMethodLabel(agent, method) {
539
542
  if (agent === AGENT.CODEX) return "OpenAI API key";
540
543
  if (agent === AGENT.CURSOR) return "Cursor API key";
541
544
  return "Anthropic API key";
545
+ case CREDENTIAL_METHOD.OPENAI_COMPATIBLE:
546
+ return "OpenAI-compatible endpoint";
542
547
  case CREDENTIAL_METHOD.FOUNDRY:
543
548
  return "Microsoft Foundry";
544
549
  case CREDENTIAL_METHOD.BEDROCK:
@@ -6468,17 +6473,28 @@ var CODEX_AUTH_ENV_KEYS = [
6468
6473
  "CODEX_FOUNDRY_MODEL",
6469
6474
  "REPLICAS_CODEX_AUTH_METHOD"
6470
6475
  ];
6476
+ function codexOpenAICompatibleAuthEnv(response) {
6477
+ return {
6478
+ ...response.apiKey && !response.authorizationHeader ? { OPENAI_API_KEY: response.apiKey } : {},
6479
+ ...response.baseUrl ? { CODEX_OPENAI_BASE_URL: response.baseUrl } : {},
6480
+ ...response.authorizationHeader ? { CODEX_OPENAI_AUTHORIZATION_HEADER: response.authorizationHeader } : {},
6481
+ REPLICAS_CODEX_AUTH_METHOD: "openai-compatible"
6482
+ };
6483
+ }
6471
6484
  function codexAuthEnvFromResponse(response) {
6472
6485
  switch (response.type) {
6473
6486
  case "oauth":
6474
6487
  return { REPLICAS_CODEX_AUTH_METHOD: "oauth" };
6475
6488
  case "api_key":
6489
+ if (response.baseUrl) {
6490
+ return codexOpenAICompatibleAuthEnv(response);
6491
+ }
6476
6492
  return {
6477
- ...response.apiKey && !response.authorizationHeader ? { OPENAI_API_KEY: response.apiKey } : {},
6478
- ...response.baseUrl ? { CODEX_OPENAI_BASE_URL: response.baseUrl } : {},
6479
- ...response.authorizationHeader ? { CODEX_OPENAI_AUTHORIZATION_HEADER: response.authorizationHeader } : {},
6493
+ ...response.apiKey ? { OPENAI_API_KEY: response.apiKey } : {},
6480
6494
  REPLICAS_CODEX_AUTH_METHOD: "api_key"
6481
6495
  };
6496
+ case "openai-compatible":
6497
+ return codexOpenAICompatibleAuthEnv(response);
6482
6498
  case "foundry":
6483
6499
  return {
6484
6500
  AZURE_OPENAI_API_KEY: response.apiKey,
@@ -6492,6 +6508,10 @@ var CODEX_AUTH_ENV_KEYS_BY_METHOD = {
6492
6508
  none: [],
6493
6509
  oauth: ["REPLICAS_CODEX_AUTH_METHOD"],
6494
6510
  api_key: [
6511
+ "OPENAI_API_KEY",
6512
+ "REPLICAS_CODEX_AUTH_METHOD"
6513
+ ],
6514
+ "openai-compatible": [
6495
6515
  "OPENAI_API_KEY",
6496
6516
  "CODEX_OPENAI_BASE_URL",
6497
6517
  "CODEX_OPENAI_AUTHORIZATION_HEADER",
@@ -6548,6 +6568,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
6548
6568
  none: [],
6549
6569
  oauth: ["REPLICAS_CLAUDE_AUTH_METHOD"],
6550
6570
  api_key: ["ANTHROPIC_API_KEY", "REPLICAS_CLAUDE_AUTH_METHOD"],
6571
+ "openai-compatible": [],
6551
6572
  bedrock: [
6552
6573
  "CLAUDE_CODE_USE_BEDROCK",
6553
6574
  "AWS_ACCESS_KEY_ID",
@@ -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-ONBZ7L3S.js";
6
+ } from "./chunk-WTNFZX53.js";
7
7
  import {
8
8
  extractCommandProtectionCommandText,
9
9
  findGitCommitSignals,
10
10
  findPrMergeSignals
11
- } from "./chunk-VAXA2XOP.js";
11
+ } from "./chunk-24FE3TDH.js";
12
12
 
13
13
  // src/services/command-protection-service.ts
14
14
  var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
@@ -5,18 +5,18 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-ONBZ7L3S.js";
8
+ } from "./chunk-WTNFZX53.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-A2656WZ4.js";
12
+ } from "./chunk-IHGPS5IS.js";
13
13
  import {
14
14
  CODEX_AUTH_ENV_KEYS,
15
15
  CODEX_AUTH_ENV_KEYS_BY_METHOD,
16
16
  codexAuthEnvFromResponse,
17
17
  createErrorResult,
18
18
  createSuccessResult
19
- } from "./chunk-VAXA2XOP.js";
19
+ } from "./chunk-24FE3TDH.js";
20
20
 
21
21
  // src/managers/codex-token-manager.ts
22
22
  import { promises as fs } from "fs";
@@ -223,7 +223,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
223
223
  const previousEnv = CODEX_AUTH_ENV_KEYS.map((key) => process.env[key]);
224
224
  console.log("[CodexTokenManager] Refreshing Codex credentials...");
225
225
  const response = await monolithRequest("/v1/engine/codex/refresh-credentials", {
226
- body: request
226
+ body: { supportsOpenAICompatibleAuth: true, ...request }
227
227
  });
228
228
  if (!response.ok) {
229
229
  const errorText = await response.text();
@@ -232,7 +232,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
232
232
  const data = await response.json();
233
233
  await this.applyCredentialsResponse(data);
234
234
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
235
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2UNVLNRC.js");
235
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WE57RJ6E.js");
236
236
  await restartCodexAspHostIfRunning2();
237
237
  }
238
238
  if (data.scope) {
@@ -293,14 +293,14 @@ var CodexTokenManager = class extends BaseRefreshManager {
293
293
  }
294
294
  }
295
295
  async fetchFreshCredentials(failureReason, failureKind = "rejected", failedCredential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex, allowedMethods) {
296
- const failedMethod = failedCredential?.method === "oauth" || failedCredential?.method === "api_key" || failedCredential?.method === "foundry" ? failedCredential.method : ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD;
296
+ const failedMethod = failedCredential?.method === "oauth" || failedCredential?.method === "api_key" || failedCredential?.method === "openai-compatible" || failedCredential?.method === "foundry" ? failedCredential.method : ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD;
297
297
  return this.swapCredentials({
298
298
  provider: "codex",
299
299
  failureKind,
300
300
  allowedMethods,
301
301
  refresh: async (exclusions) => {
302
302
  await this.refreshWithRequest(
303
- failedMethod === "oauth" || failedMethod === "api_key" || failedMethod === "foundry" ? {
303
+ failedMethod === "oauth" || failedMethod === "api_key" || failedMethod === "openai-compatible" || failedMethod === "foundry" ? {
304
304
  failedMethod,
305
305
  ...failedCredential?.method === failedMethod ? { failedCredential } : {},
306
306
  failureReason,
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  findCodeHostPullRequestUrls,
6
6
  mayCreatePullRequest
7
- } from "./chunk-VAXA2XOP.js";
7
+ } from "./chunk-24FE3TDH.js";
8
8
 
9
9
  // src/services/post-tool-pr-notifier.ts
10
10
  async function notifyPostToolUse(toolName, toolInput, toolResult) {
@@ -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-VAXA2XOP.js";
7
+ } from "./chunk-24FE3TDH.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.757";
244
+ var ENGINE_PACKAGE_VERSION = "0.1.758";
245
245
  var INITIALIZE_METHOD = "initialize";
246
246
  var INITIALIZED_NOTIFICATION = "initialized";
247
247
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -276,7 +276,7 @@ var AppServerProcess = class {
276
276
  "-c",
277
277
  'model_providers.azure.wire_api="responses"'
278
278
  ];
279
- } else if (!options.args && options.env.REPLICAS_CODEX_AUTH_METHOD === "api_key" && options.env.CODEX_OPENAI_BASE_URL) {
279
+ } else if (!options.args && options.env.REPLICAS_CODEX_AUTH_METHOD === "openai-compatible") {
280
280
  baseArgs = [
281
281
  ...DEFAULT_CODEX_ARGS,
282
282
  "-c",
@@ -15,7 +15,7 @@ import {
15
15
  isValidRelayBaseProvider,
16
16
  parsePosixEnvFile,
17
17
  readReplicasRuntimeEnv
18
- } from "./chunk-VAXA2XOP.js";
18
+ } from "./chunk-24FE3TDH.js";
19
19
 
20
20
  // src/engine-env.ts
21
21
  import { readFileSync as readFileSync2 } from "fs";
@@ -84,7 +84,7 @@ function parseClaudeAuthMethod(value) {
84
84
  return void 0;
85
85
  }
86
86
  function parseCodexAuthMethod(value) {
87
- if (value === "oauth" || value === "api_key" || value === "foundry") {
87
+ if (value === "oauth" || value === "api_key" || value === "openai-compatible" || value === "foundry") {
88
88
  return value;
89
89
  }
90
90
  return void 0;
@@ -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-ZZYDVS4Z.js";
7
- import "./chunk-ONBZ7L3S.js";
6
+ } from "./chunk-2N4HGHFZ.js";
7
+ import "./chunk-WTNFZX53.js";
8
8
  import {
9
9
  isRecord
10
10
  } from "./chunk-UZSNFLDQ.js";
11
- import "./chunk-VAXA2XOP.js";
11
+ import "./chunk-24FE3TDH.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-ZZYDVS4Z.js";
6
+ } from "./chunk-2N4HGHFZ.js";
7
7
  import {
8
8
  notifyPostToolUse
9
- } from "./chunk-63OSLNBW.js";
10
- import "./chunk-ONBZ7L3S.js";
9
+ } from "./chunk-FTXE5FES.js";
10
+ import "./chunk-WTNFZX53.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-VAXA2XOP.js";
12
+ import "./chunk-24FE3TDH.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-A2656WZ4.js";
11
+ } from "./chunk-IHGPS5IS.js";
12
12
  import {
13
13
  AGENT,
14
14
  getMemoryOutputSafetyViolation,
15
15
  headlessAgentRequestSchema
16
- } from "./chunk-VAXA2XOP.js";
16
+ } from "./chunk-24FE3TDH.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-ZZYDVS4Z.js";
94
+ } from "./chunk-2N4HGHFZ.js";
95
95
  import {
96
96
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
97
97
  AGENT_MESSAGE_DELTA_METHOD,
@@ -124,20 +124,20 @@ import {
124
124
  recordCredentialFallback,
125
125
  recordExhaustedCredential,
126
126
  restartCodexAspHost
127
- } from "./chunk-QCFJKMNS.js";
127
+ } from "./chunk-EQEWL6FF.js";
128
128
  import {
129
129
  ENGINE_ENV,
130
130
  IS_WARMING_MODE,
131
131
  monolithRequest,
132
132
  monolithService,
133
133
  setAgentCredentialSnapshot
134
- } from "./chunk-ONBZ7L3S.js";
134
+ } from "./chunk-WTNFZX53.js";
135
135
  import {
136
136
  AspClient,
137
137
  SUBPROCESS_MAX_BUFFER,
138
138
  execAsync,
139
139
  execFileAsync
140
- } from "./chunk-A2656WZ4.js";
140
+ } from "./chunk-IHGPS5IS.js";
141
141
  import {
142
142
  isRecord as isRecord2
143
143
  } from "./chunk-UZSNFLDQ.js";
@@ -331,7 +331,7 @@ import {
331
331
  spawnRelaySubagentRequestSchema,
332
332
  stripAgentDiagnosticErrors,
333
333
  withTimeout
334
- } from "./chunk-VAXA2XOP.js";
334
+ } from "./chunk-24FE3TDH.js";
335
335
  import {
336
336
  __commonJS,
337
337
  __export,
@@ -9422,12 +9422,13 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
9422
9422
  console.log(`[ClaudeTokenManager] Credentials refreshed (method=${data.type})`);
9423
9423
  }
9424
9424
  async fetchFreshCredentials(failureReason, failureKind = "rejected", failedCredential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.claude, allowedMethods) {
9425
- const failedMethod = failedCredential?.method === "oauth" || failedCredential?.method === "api_key" || failedCredential?.method === "bedrock" || failedCredential?.method === "foundry" ? failedCredential.method : ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD;
9425
+ const configuredMethod = ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD;
9426
+ const failedMethod = failedCredential?.method === "oauth" || failedCredential?.method === "api_key" || failedCredential?.method === "bedrock" || failedCredential?.method === "foundry" ? failedCredential.method : configuredMethod === "oauth" || configuredMethod === "api_key" || configuredMethod === "bedrock" || configuredMethod === "foundry" ? configuredMethod : void 0;
9426
9427
  return this.swapCredentials({
9427
9428
  provider: "claude",
9428
9429
  failureKind,
9429
9430
  allowedMethods,
9430
- refresh: (exclusions) => this.refreshWithRequest(failedMethod && failedMethod !== "none" ? {
9431
+ refresh: (exclusions) => this.refreshWithRequest(failedMethod ? {
9431
9432
  failedMethod,
9432
9433
  ...failedCredential?.method === failedMethod ? { failedCredential } : {},
9433
9434
  failureReason,
@@ -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-63OSLNBW.js";
6
+ } from "./chunk-FTXE5FES.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
- import "./chunk-VAXA2XOP.js";
10
+ import "./chunk-24FE3TDH.js";
11
11
  import "./chunk-VEQXQN22.js";
12
12
 
13
13
  // src/post-tool-pr-hook.ts
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  messageRelaySubagentRequestSchema,
6
6
  spawnRelaySubagentRequestSchema
7
- } from "./chunk-VAXA2XOP.js";
7
+ } from "./chunk-24FE3TDH.js";
8
8
  import "./chunk-VEQXQN22.js";
9
9
 
10
10
  // src/relay-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.757",
3
+ "version": "0.1.758",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",