replicas-engine 0.1.832 → 0.1.833

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-DSZMTRC3.js";
9
- import "./chunk-VZ6VMXC7.js";
10
- import "./chunk-X7NVCXNL.js";
8
+ } from "./chunk-ZF2XBT7I.js";
9
+ import "./chunk-LGL762JY.js";
10
+ import "./chunk-QSMI36PE.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-EJKLU7KX.js";
12
+ import "./chunk-VP6D4EBQ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
  export {
15
15
  getCodexAspHost,
@@ -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-EJKLU7KX.js";
6
+ } from "./chunk-VP6D4EBQ.js";
7
7
 
8
8
  // src/services/post-tool-pr-notifier.ts
9
9
  async function notifyPostToolUse(toolName, toolInput) {
@@ -15,7 +15,7 @@ import {
15
15
  isValidRelayBaseProvider,
16
16
  parsePosixEnvFile,
17
17
  readReplicasRuntimeEnv
18
- } from "./chunk-EJKLU7KX.js";
18
+ } from "./chunk-VP6D4EBQ.js";
19
19
 
20
20
  // src/engine-env.ts
21
21
  import { readFileSync as readFileSync2 } from "fs";
@@ -137,6 +137,7 @@ function loadEngineEnv() {
137
137
  ANTHROPIC_API_KEY: readEnv("ANTHROPIC_API_KEY"),
138
138
  OPENAI_API_KEY: readEnv("OPENAI_API_KEY"),
139
139
  CODEX_OPENAI_BASE_URL: readEnv("CODEX_OPENAI_BASE_URL"),
140
+ CODEX_OPENAI_MODELS_URL: readEnv("CODEX_OPENAI_MODELS_URL"),
140
141
  CODEX_OPENAI_AUTHORIZATION_HEADER: readEnv("CODEX_OPENAI_AUTHORIZATION_HEADER"),
141
142
  CURSOR_API_KEY: readEnv("CURSOR_API_KEY"),
142
143
  AI_GATEWAY_API_KEY: readEnv("AI_GATEWAY_API_KEY"),
@@ -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-EJKLU7KX.js";
7
+ } from "./chunk-VP6D4EBQ.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.832";
244
+ var ENGINE_PACKAGE_VERSION = "0.1.833";
245
245
  var INITIALIZE_METHOD = "initialize";
246
246
  var INITIALIZED_NOTIFICATION = "initialized";
247
247
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -658,6 +658,127 @@ function createErrorResult(error) {
658
658
  };
659
659
  }
660
660
 
661
+ // ../shared/src/external-api-host.ts
662
+ function validateExternalApiHost(url, providerLabel) {
663
+ let parsed;
664
+ try {
665
+ parsed = new URL(url);
666
+ } catch {
667
+ throw new Error(`Invalid ${providerLabel}: ${url}`);
668
+ }
669
+ if (parsed.protocol !== "https:") throw new Error(`${providerLabel} must use HTTPS`);
670
+ const hostname = parsed.hostname.toLowerCase();
671
+ if (hostname.includes(":") || hostname.startsWith("[")) {
672
+ throw new Error(`${providerLabel} cannot be an IP address literal`);
673
+ }
674
+ if (hostname === "localhost" || hostname === "127.0.0.1") {
675
+ throw new Error(`${providerLabel} cannot point to localhost`);
676
+ }
677
+ if (/^(10\.|127\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|169\.254\.|0\.)/.test(hostname)) {
678
+ throw new Error(`${providerLabel} cannot point to a private or internal IP address`);
679
+ }
680
+ if (hostname === "0.0.0.0" || hostname.endsWith(".internal") || hostname.endsWith(".local")) {
681
+ throw new Error(`${providerLabel} cannot point to a non-routable address`);
682
+ }
683
+ if (!hostname.includes(".")) throw new Error(`${providerLabel} must be a fully qualified domain name`);
684
+ }
685
+
686
+ // ../shared/src/credentials/openai.ts
687
+ function positiveInteger(value) {
688
+ return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : null;
689
+ }
690
+ var CONTEXT_WINDOW_KEYS = /* @__PURE__ */ new Set([
691
+ "context_window",
692
+ "context_length",
693
+ "contextWindow",
694
+ "contextLength",
695
+ "max_context_length",
696
+ "maxContextLength"
697
+ ]);
698
+ var MAX_CATALOG_PAGES = 20;
699
+ function getModelContextWindow(model) {
700
+ const directValues = Object.entries(model).flatMap(([key, value]) => {
701
+ const contextWindow = CONTEXT_WINDOW_KEYS.has(key) ? positiveInteger(value) : null;
702
+ return contextWindow === null ? [] : [contextWindow];
703
+ });
704
+ if (directValues.length > 0) return Math.max(...directValues);
705
+ const values = [];
706
+ const pending = Object.entries(model).filter(([key]) => !CONTEXT_WINDOW_KEYS.has(key)).map(([, value]) => value);
707
+ for (let inspected = 0; pending.length > 0 && inspected < 1e3; inspected += 1) {
708
+ const current = pending.pop();
709
+ if (Array.isArray(current)) {
710
+ pending.push(...current);
711
+ continue;
712
+ }
713
+ if (!isRecord(current)) continue;
714
+ if (current.availability_status !== void 0 && current.availability_status !== "available") continue;
715
+ for (const [key, value] of Object.entries(current)) {
716
+ if (CONTEXT_WINDOW_KEYS.has(key)) {
717
+ const contextWindow = positiveInteger(value);
718
+ if (contextWindow !== null) values.push(contextWindow);
719
+ } else if (Array.isArray(value) || isRecord(value)) {
720
+ pending.push(value);
721
+ }
722
+ }
723
+ }
724
+ return values.length > 0 ? Math.max(...values) : null;
725
+ }
726
+ function parseOpenAICompatibleModels(payload) {
727
+ if (!isRecord(payload) || !Array.isArray(payload.data)) {
728
+ throw new Error("The models endpoint returned an invalid catalog");
729
+ }
730
+ return [...new Map(payload.data.flatMap((value) => {
731
+ if (!isRecord(value) || value.availability_status !== void 0 && value.availability_status !== "available") {
732
+ return [];
733
+ }
734
+ const id = typeof value.id === "string" ? value.id : typeof value.model === "string" ? value.model : null;
735
+ if (!id) return [];
736
+ const displayName = typeof value.display_name === "string" ? value.display_name : typeof value.name === "string" ? value.name : id;
737
+ const contextWindow = getModelContextWindow(value);
738
+ return [[id, {
739
+ id,
740
+ displayName,
741
+ ...typeof value.description === "string" ? { description: value.description } : {},
742
+ ...contextWindow !== null ? { contextWindow } : {}
743
+ }]];
744
+ })).values()];
745
+ }
746
+ async function listOpenAICompatibleModels(credential) {
747
+ const models = /* @__PURE__ */ new Map();
748
+ const signal = AbortSignal.timeout(1e4);
749
+ let modelsUrl = resolveOpenAICompatibleModelsUrl({
750
+ baseUrl: credential.baseUrl ?? "",
751
+ modelsUrl: credential.modelsUrl ?? ""
752
+ });
753
+ for (let page = 0; page < MAX_CATALOG_PAGES; page += 1) {
754
+ validateExternalApiHost(modelsUrl, "Models endpoint");
755
+ const response = await fetch(modelsUrl, {
756
+ headers: {
757
+ Accept: "application/json",
758
+ Authorization: credential.authorizationHeader || `Bearer ${credential.apiKey}`
759
+ },
760
+ redirect: "error",
761
+ signal
762
+ });
763
+ if (!response.ok) throw new Error(`Models request failed with status ${response.status}`);
764
+ const payload = await response.json();
765
+ for (const model of parseOpenAICompatibleModels(payload)) models.set(model.id, model);
766
+ if (!isRecord(payload) || payload.has_more !== true) break;
767
+ if (page === MAX_CATALOG_PAGES - 1) throw new Error(`The models endpoint exceeded ${MAX_CATALOG_PAGES} pages`);
768
+ if (typeof payload.next_cursor !== "string" || !payload.next_cursor) {
769
+ throw new Error("The models endpoint did not return a cursor for the next page");
770
+ }
771
+ const nextUrl = new URL(modelsUrl);
772
+ nextUrl.searchParams.set("cursor", payload.next_cursor);
773
+ modelsUrl = nextUrl.toString();
774
+ }
775
+ if (models.size === 0) throw new Error("The models endpoint returned no available models");
776
+ return [...models.values()];
777
+ }
778
+ function resolveOpenAICompatibleModelsUrl(values) {
779
+ return values.modelsUrl || `${values.baseUrl}/models`;
780
+ }
781
+
661
782
  // ../shared/src/analytics/types.ts
662
783
  function hasAgentChatActivityFields(value) {
663
784
  return isRecord(value) && typeof value.chatId === "string" && typeof value.model === "string" && (value.credentialMethod === void 0 || isAuthMethod(value.credentialMethod)) && (value.credentialScope === void 0 || isCredentialScope(value.credentialScope)) && value.credentialMethod === void 0 === (value.credentialScope === void 0) && (value.senderUserId === void 0 || typeof value.senderUserId === "string") && typeof value.occurredAt === "string";
@@ -6697,6 +6818,7 @@ function hasChatStarted(chat) {
6697
6818
  var CODEX_AUTH_ENV_KEYS = [
6698
6819
  "OPENAI_API_KEY",
6699
6820
  "CODEX_OPENAI_BASE_URL",
6821
+ "CODEX_OPENAI_MODELS_URL",
6700
6822
  "CODEX_OPENAI_AUTHORIZATION_HEADER",
6701
6823
  "AZURE_OPENAI_API_KEY",
6702
6824
  "CODEX_FOUNDRY_BASE_URL",
@@ -6707,6 +6829,7 @@ function codexOpenAICompatibleAuthEnv(response) {
6707
6829
  return {
6708
6830
  ...response.apiKey && !response.authorizationHeader ? { OPENAI_API_KEY: response.apiKey } : {},
6709
6831
  ...response.baseUrl ? { CODEX_OPENAI_BASE_URL: response.baseUrl } : {},
6832
+ ...response.modelsUrl ? { CODEX_OPENAI_MODELS_URL: response.modelsUrl } : {},
6710
6833
  ...response.authorizationHeader ? { CODEX_OPENAI_AUTHORIZATION_HEADER: response.authorizationHeader } : {},
6711
6834
  REPLICAS_CODEX_AUTH_METHOD: "openai-compatible"
6712
6835
  };
@@ -6744,6 +6867,7 @@ var CODEX_AUTH_ENV_KEYS_BY_METHOD = {
6744
6867
  "openai-compatible": [
6745
6868
  "OPENAI_API_KEY",
6746
6869
  "CODEX_OPENAI_BASE_URL",
6870
+ "CODEX_OPENAI_MODELS_URL",
6747
6871
  "CODEX_OPENAI_AUTHORIZATION_HEADER",
6748
6872
  "REPLICAS_CODEX_AUTH_METHOD"
6749
6873
  ],
@@ -7662,6 +7786,8 @@ export {
7662
7786
  detectAgentQuotaLimit,
7663
7787
  CREDENTIAL_METHOD,
7664
7788
  AGENT_CREDENTIAL_METHODS_IN_ORDER,
7789
+ listOpenAICompatibleModels,
7790
+ resolveOpenAICompatibleModelsUrl,
7665
7791
  agentCredentialSnapshotSchema,
7666
7792
  isAgentChatTurnActivityRecord,
7667
7793
  isAgentChatSkillActivityRecord,
@@ -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-VZ6VMXC7.js";
6
+ } from "./chunk-LGL762JY.js";
7
7
  import {
8
8
  extractCommandProtectionCommandText,
9
9
  findGitCommitSignals,
10
10
  findPrMergeSignals
11
- } from "./chunk-EJKLU7KX.js";
11
+ } from "./chunk-VP6D4EBQ.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,25 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-VZ6VMXC7.js";
8
+ } from "./chunk-LGL762JY.js";
9
9
  import {
10
10
  AppServerProcess,
11
- buildCodexAgentEnv
12
- } from "./chunk-X7NVCXNL.js";
11
+ SUBPROCESS_MAX_BUFFER,
12
+ buildCodexAgentEnv,
13
+ execFileAsync
14
+ } from "./chunk-QSMI36PE.js";
15
+ import {
16
+ isRecord
17
+ } from "./chunk-UZSNFLDQ.js";
13
18
  import {
14
19
  CODEX_AUTH_ENV_KEYS,
15
20
  CODEX_AUTH_ENV_KEYS_BY_METHOD,
16
21
  codexAuthEnvFromResponse,
17
22
  createErrorResult,
18
- createSuccessResult
19
- } from "./chunk-EJKLU7KX.js";
23
+ createSuccessResult,
24
+ listOpenAICompatibleModels,
25
+ resolveOpenAICompatibleModelsUrl
26
+ } from "./chunk-VP6D4EBQ.js";
20
27
 
21
28
  // src/managers/codex-token-manager.ts
22
29
  import { promises as fs } from "fs";
@@ -24,7 +31,6 @@ import path from "path";
24
31
 
25
32
  // src/managers/auth-env-transition.ts
26
33
  function applyAuthEnvTransition(params) {
27
- const newOwned = new Set(params.authKeysByMethod[params.newMethod]);
28
34
  const prevOwned = new Set(params.authKeysByMethod[params.prevMethod]);
29
35
  for (const key of params.authKeys) {
30
36
  const value = params.newEnvVars[key];
@@ -32,7 +38,7 @@ function applyAuthEnvTransition(params) {
32
38
  for (const env of params.envs) {
33
39
  env[key] = value;
34
40
  }
35
- } else if (prevOwned.has(key) && !newOwned.has(key)) {
41
+ } else if (prevOwned.has(key)) {
36
42
  for (const env of params.envs) {
37
43
  delete env[key];
38
44
  }
@@ -232,7 +238,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
232
238
  const data = await response.json();
233
239
  await this.applyCredentialsResponse(data);
234
240
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
235
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-KKPQQCUV.js");
241
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ULQW33A7.js");
236
242
  await restartCodexAspHostIfRunning2();
237
243
  }
238
244
  if (data.scope) {
@@ -317,7 +323,6 @@ var CodexTokenManager = class extends BaseRefreshManager {
317
323
  const envVars = codexAuthEnvFromResponse(response);
318
324
  applyAuthEnvTransition({
319
325
  prevMethod: ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD ?? "none",
320
- newMethod: envVars.REPLICAS_CODEX_AUTH_METHOD ?? "none",
321
326
  authKeys: CODEX_AUTH_ENV_KEYS,
322
327
  authKeysByMethod: CODEX_AUTH_ENV_KEYS_BY_METHOD,
323
328
  newEnvVars: envVars,
@@ -353,6 +358,63 @@ var CodexTokenManager = class extends BaseRefreshManager {
353
358
  };
354
359
  var codexTokenManager = new CodexTokenManager();
355
360
 
361
+ // src/managers/codex-asp/openai-compatible-model-catalog.ts
362
+ import { writeFile } from "fs/promises";
363
+ import { tmpdir } from "os";
364
+ import { join } from "path";
365
+ var CATALOG_TTL_MS = 6e4;
366
+ var CODEX_MODEL_CATALOG_PATH = join(tmpdir(), "replicas-openai-compatible-model-catalog.json");
367
+ var cachedCatalog = null;
368
+ async function writeCodexModelCatalog(modelsUrl) {
369
+ const [models, { stdout }] = await Promise.all([
370
+ listOpenAICompatibleModels({
371
+ apiKey: ENGINE_ENV.OPENAI_API_KEY,
372
+ authorizationHeader: ENGINE_ENV.CODEX_OPENAI_AUTHORIZATION_HEADER,
373
+ baseUrl: ENGINE_ENV.CODEX_OPENAI_BASE_URL ?? "",
374
+ modelsUrl
375
+ }),
376
+ execFileAsync("codex", ["debug", "models"], { maxBuffer: SUBPROCESS_MAX_BUFFER })
377
+ ]);
378
+ const payload = JSON.parse(stdout);
379
+ const template = isRecord(payload) && Array.isArray(payload.models) ? payload.models.find((model) => isRecord(model) && model.slug === "gpt-5.2") ?? payload.models.find(isRecord) : null;
380
+ if (!isRecord(template)) throw new Error("Codex did not return a model catalog template");
381
+ await writeFile(CODEX_MODEL_CATALOG_PATH, JSON.stringify({
382
+ models: models.flatMap((model) => model.contextWindow ? [{
383
+ ...template,
384
+ slug: model.id,
385
+ display_name: model.displayName,
386
+ description: model.description ?? model.displayName,
387
+ context_window: model.contextWindow,
388
+ max_context_window: model.contextWindow,
389
+ effective_context_window_percent: 100,
390
+ auto_compact_token_limit: Math.floor(model.contextWindow * 0.9)
391
+ }] : [])
392
+ }));
393
+ return [
394
+ `model_catalog_json=${JSON.stringify(CODEX_MODEL_CATALOG_PATH)}`,
395
+ "features.remote_models=false"
396
+ ];
397
+ }
398
+ async function getOpenAICompatibleCodexModelCatalogConfig() {
399
+ if (ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD !== "openai-compatible" || !ENGINE_ENV.CODEX_OPENAI_BASE_URL) return [];
400
+ const modelsUrl = resolveOpenAICompatibleModelsUrl({
401
+ baseUrl: ENGINE_ENV.CODEX_OPENAI_BASE_URL,
402
+ modelsUrl: ENGINE_ENV.CODEX_OPENAI_MODELS_URL ?? ""
403
+ });
404
+ const key = `${modelsUrl}:${JSON.stringify(ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex ?? null)}`;
405
+ if (!cachedCatalog || cachedCatalog.key !== key || cachedCatalog.expiresAt <= Date.now()) {
406
+ cachedCatalog = {
407
+ key,
408
+ expiresAt: Date.now() + CATALOG_TTL_MS,
409
+ config: writeCodexModelCatalog(modelsUrl).catch((error) => {
410
+ console.warn("[CodexAspManager] Failed to prepare OpenAI-compatible model catalog:", error);
411
+ return [];
412
+ })
413
+ };
414
+ }
415
+ return cachedCatalog.config;
416
+ }
417
+
356
418
  // src/managers/codex-asp/asp-host.ts
357
419
  var hostPromise = null;
358
420
  var activeProcess = null;
@@ -367,6 +429,7 @@ async function getCodexAspHost() {
367
429
  const process2 = new AppServerProcess({
368
430
  cwd: ENGINE_ENV.WORKSPACE_ROOT,
369
431
  env: buildCodexAgentEnv(),
432
+ configOverrides: await getOpenAICompatibleCodexModelCatalogConfig(),
370
433
  ...oauthOptions
371
434
  });
372
435
  const { client } = await process2.start();
@@ -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-GLZE6UHB.js";
7
- import "./chunk-VZ6VMXC7.js";
6
+ } from "./chunk-YK5YMGOX.js";
7
+ import "./chunk-LGL762JY.js";
8
8
  import {
9
9
  isRecord
10
10
  } from "./chunk-UZSNFLDQ.js";
11
- import "./chunk-EJKLU7KX.js";
11
+ import "./chunk-VP6D4EBQ.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-GLZE6UHB.js";
6
+ } from "./chunk-YK5YMGOX.js";
7
7
  import {
8
8
  notifyPostToolUse
9
- } from "./chunk-3ZA72VWO.js";
10
- import "./chunk-VZ6VMXC7.js";
9
+ } from "./chunk-HIR3KMMQ.js";
10
+ import "./chunk-LGL762JY.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-EJKLU7KX.js";
12
+ import "./chunk-VP6D4EBQ.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-X7NVCXNL.js";
11
+ } from "./chunk-QSMI36PE.js";
12
12
  import {
13
13
  AGENT,
14
14
  getMemoryOutputSafetyViolation,
15
15
  headlessAgentRequestSchema
16
- } from "./chunk-EJKLU7KX.js";
16
+ } from "./chunk-VP6D4EBQ.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-GLZE6UHB.js";
94
+ } from "./chunk-YK5YMGOX.js";
95
95
  import {
96
96
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
97
97
  AGENT_MESSAGE_DELTA_METHOD,
@@ -131,20 +131,20 @@ import {
131
131
  recordCredentialFallback,
132
132
  recordExhaustedCredential,
133
133
  restartCodexAspHost
134
- } from "./chunk-DSZMTRC3.js";
134
+ } from "./chunk-ZF2XBT7I.js";
135
135
  import {
136
136
  ENGINE_ENV,
137
137
  IS_WARMING_MODE,
138
138
  monolithRequest,
139
139
  monolithService,
140
140
  setAgentCredentialSnapshot
141
- } from "./chunk-VZ6VMXC7.js";
141
+ } from "./chunk-LGL762JY.js";
142
142
  import {
143
143
  AspClient,
144
144
  SUBPROCESS_MAX_BUFFER,
145
145
  execAsync,
146
146
  execFileAsync
147
- } from "./chunk-X7NVCXNL.js";
147
+ } from "./chunk-QSMI36PE.js";
148
148
  import {
149
149
  isRecord as isRecord2
150
150
  } from "./chunk-UZSNFLDQ.js";
@@ -352,7 +352,7 @@ import {
352
352
  spawnRelaySubagentRequestSchema,
353
353
  stripAgentDiagnosticErrors,
354
354
  withTimeout
355
- } from "./chunk-EJKLU7KX.js";
355
+ } from "./chunk-VP6D4EBQ.js";
356
356
  import {
357
357
  __commonJS,
358
358
  __export,
@@ -9476,7 +9476,6 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
9476
9476
  const envVars = claudeAuthEnvFromResponse(response);
9477
9477
  applyAuthEnvTransition({
9478
9478
  prevMethod: ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD ?? "none",
9479
- newMethod: envVars.REPLICAS_CLAUDE_AUTH_METHOD ?? "none",
9480
9479
  authKeys: CLAUDE_AUTH_ENV_KEYS,
9481
9480
  authKeysByMethod: CLAUDE_AUTH_ENV_KEYS_BY_METHOD,
9482
9481
  newEnvVars: envVars,
@@ -14847,6 +14846,7 @@ var CodexAspManager = class extends CodingAgentManager {
14847
14846
  currentThreadId = null;
14848
14847
  activeTurnId = null;
14849
14848
  threadAttached = false;
14849
+ attachedModel = null;
14850
14850
  attachedDeveloperInstructions = null;
14851
14851
  historyFile;
14852
14852
  codexAspTranscript = null;
@@ -15253,8 +15253,9 @@ var CodexAspManager = class extends CodingAgentManager {
15253
15253
  async ensureThread(host, request, developerInstructions) {
15254
15254
  await this.applySkillRegistries(host);
15255
15255
  const existingThreadId = this.currentThreadId;
15256
+ const requestedModel = request.model ?? DEFAULT_MODEL;
15256
15257
  if (existingThreadId) {
15257
- if (!this.threadAttached || (developerInstructions ?? null) !== this.attachedDeveloperInstructions) {
15258
+ if (!this.threadAttached || requestedModel !== this.attachedModel || (developerInstructions ?? null) !== this.attachedDeveloperInstructions) {
15258
15259
  const serviceTier2 = await this.resolveRequestedServiceTier(host, request);
15259
15260
  const response = await host.client.request(
15260
15261
  THREAD_RESUME_METHOD,
@@ -15263,6 +15264,7 @@ var CodexAspManager = class extends CodingAgentManager {
15263
15264
  this.currentThreadId = response.thread.id;
15264
15265
  this.activeServiceTier = response.serviceTier;
15265
15266
  this.threadAttached = true;
15267
+ this.attachedModel = requestedModel;
15266
15268
  this.attachedDeveloperInstructions = developerInstructions ?? null;
15267
15269
  this.seedHistoryFromThread(response.thread);
15268
15270
  await this.onSaveSessionId(this.currentThreadId);
@@ -15278,6 +15280,7 @@ var CodexAspManager = class extends CodingAgentManager {
15278
15280
  this.currentThreadId = threadId;
15279
15281
  this.activeServiceTier = threadStartResponse.serviceTier;
15280
15282
  this.threadAttached = true;
15283
+ this.attachedModel = requestedModel;
15281
15284
  this.attachedDeveloperInstructions = developerInstructions ?? null;
15282
15285
  await this.onSaveSessionId(this.currentThreadId);
15283
15286
  return threadId;
@@ -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-3ZA72VWO.js";
6
+ } from "./chunk-HIR3KMMQ.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
- import "./chunk-EJKLU7KX.js";
10
+ import "./chunk-VP6D4EBQ.js";
11
11
  import "./chunk-VEQXQN22.js";
12
12
 
13
13
  // src/post-tool-pr-hook.ts
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  messageRelaySubagentRequestSchema,
9
9
  spawnRelaySubagentRequestSchema
10
- } from "./chunk-EJKLU7KX.js";
10
+ } from "./chunk-VP6D4EBQ.js";
11
11
  import "./chunk-VEQXQN22.js";
12
12
 
13
13
  // src/relay-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.832",
3
+ "version": "0.1.833",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",