replicas-engine 0.1.881 → 0.1.882

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,9 +5,9 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-VLMY3PUD.js";
8
+ } from "./chunk-H42KW3RC.js";
9
9
  import "./chunk-4CF465DO.js";
10
- import "./chunk-AKHJBXSS.js";
10
+ import "./chunk-SFWJXPG3.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
12
  import "./chunk-PYQVWR2X.js";
13
13
  import "./chunk-VEQXQN22.js";
@@ -11,7 +11,7 @@ import {
11
11
  SUBPROCESS_MAX_BUFFER,
12
12
  buildCodexAgentEnv,
13
13
  execFileAsync
14
- } from "./chunk-AKHJBXSS.js";
14
+ } from "./chunk-SFWJXPG3.js";
15
15
  import {
16
16
  isRecord
17
17
  } from "./chunk-UZSNFLDQ.js";
@@ -68,6 +68,11 @@ function listCredentialFallbacks() {
68
68
  function listExhaustedCredentials(provider) {
69
69
  return [...exhaustedByAgent.get(provider)?.values() ?? []];
70
70
  }
71
+ function routineRefreshExclusions(provider) {
72
+ const live = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS[provider];
73
+ const excludeCredentials = listExhaustedCredentials(provider).filter((spent) => spent.method !== live?.method || spent.scope !== live?.scope);
74
+ return excludeCredentials.length > 0 ? { excludeCredentials } : {};
75
+ }
71
76
  function recordExhaustedCredential(provider, credential) {
72
77
  const spent = exhaustedByAgent.get(provider) ?? /* @__PURE__ */ new Map();
73
78
  spent.set(`${credential.method}|${credential.scope}`, credential);
@@ -240,13 +245,13 @@ var CodexTokenManager = class extends BaseRefreshManager {
240
245
  return null;
241
246
  }
242
247
  async doRefresh(_config) {
243
- await this.refreshWithRequest(void 0, true);
248
+ await this.refreshWithRequest(routineRefreshExclusions("codex"), true);
244
249
  }
245
250
  async switchCredentials(data) {
246
251
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
247
252
  await this.applyCredentialsResponse(data);
248
253
  if (data.scope) setAgentCredentialSnapshot("codex", { method: data.type, scope: data.scope, revision: data.revision });
249
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ITDUH7G3.js");
254
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-AJ55PRBL.js");
250
255
  await restartCodexAspHostIfRunning2();
251
256
  });
252
257
  await this.start(true);
@@ -266,7 +271,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
266
271
  await this.applyCredentialUpdate(generation, async () => {
267
272
  await this.applyCredentialsResponse(data);
268
273
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
269
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ITDUH7G3.js");
274
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-AJ55PRBL.js");
270
275
  await restartCodexAspHostIfRunning2();
271
276
  }
272
277
  if (data.scope) {
@@ -505,6 +510,7 @@ export {
505
510
  clearCredentialFallbacks,
506
511
  recordCredentialFallback,
507
512
  listCredentialFallbacks,
513
+ routineRefreshExclusions,
508
514
  recordExhaustedCredential,
509
515
  BaseRefreshManager,
510
516
  applyAuthEnvTransition,
@@ -245,7 +245,7 @@ function getCodexModelProvider(method) {
245
245
  if (method === "foundry") return "azure";
246
246
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
247
247
  }
248
- var ENGINE_PACKAGE_VERSION = "0.1.881";
248
+ var ENGINE_PACKAGE_VERSION = "0.1.882";
249
249
  var INITIALIZE_METHOD = "initialize";
250
250
  var INITIALIZED_NOTIFICATION = "initialized";
251
251
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  AppServerProcess,
10
10
  buildCodexAgentEnv
11
- } from "./chunk-AKHJBXSS.js";
11
+ } from "./chunk-SFWJXPG3.js";
12
12
  import {
13
13
  AGENT,
14
14
  getMemoryOutputSafetyViolation,
package/dist/src/index.js CHANGED
@@ -131,8 +131,9 @@ import {
131
131
  listCredentialFallbacks,
132
132
  recordCredentialFallback,
133
133
  recordExhaustedCredential,
134
- restartCodexAspHost
135
- } from "./chunk-VLMY3PUD.js";
134
+ restartCodexAspHost,
135
+ routineRefreshExclusions
136
+ } from "./chunk-H42KW3RC.js";
136
137
  import {
137
138
  ENGINE_ENV,
138
139
  IS_WARMING_MODE,
@@ -146,7 +147,7 @@ import {
146
147
  execAsync,
147
148
  execFileAsync,
148
149
  getCodexModelProvider
149
- } from "./chunk-AKHJBXSS.js";
150
+ } from "./chunk-SFWJXPG3.js";
150
151
  import {
151
152
  isRecord as isRecord2
152
153
  } from "./chunk-UZSNFLDQ.js";
@@ -9431,7 +9432,7 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
9431
9432
  return null;
9432
9433
  }
9433
9434
  async doRefresh(_config) {
9434
- await this.refreshWithRequest();
9435
+ await this.refreshWithRequest(routineRefreshExclusions("claude"));
9435
9436
  }
9436
9437
  async switchCredentials(data) {
9437
9438
  await this.applyCredentialUpdate(++this.credentialGeneration, () => this.applyCredentialsResponse(data));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.881",
3
+ "version": "0.1.882",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",