@autorag/librarian 2.13.11 → 2.13.12

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,4 +1,4 @@
1
- import type { ClassifierApi, ClassifierContext, ClassifierModel, ClassifierResult, ModelsClassifierOptions } from "@earendil-works/pi-ai";
1
+ import { type ClassifierApi, type ClassifierContext, type ClassifierModel, type ClassifierResult, type ModelsClassifierOptions } from "@earendil-works/pi-ai";
2
2
  import { type BackendRequest, type BackendResponse, type JevBackend } from "jev-use";
3
3
  /**
4
4
  * Decision models come from pi's model catalog: pi-ai ships every provider's typed-question
@@ -1,4 +1,4 @@
1
- import type { Api, Model } from "@earendil-works/pi-ai";
1
+ import { type Api, type Model } from "@earendil-works/pi-ai";
2
2
  import { ModelRuntime } from "@earendil-works/pi-coding-agent";
3
3
  import type { AutoRAGAgentOptions, AutoRAGRefreshLimits, AutoRAGRetrievalLimits } from "../agent/agent.js";
4
4
  import { type LoadLocalAutoRAGModelOptions } from "../agent/local-model.js";
package/dist/cli/index.js CHANGED
@@ -1740,6 +1740,9 @@ import { homedir as homedir2 } from "node:os";
1740
1740
  import { join as join7 } from "node:path";
1741
1741
  import { parse as parse2 } from "smol-toml";
1742
1742
  function loadLocalAutoRAGModel(options = {}) {
1743
+ if (process.env.AUTORAG_AUTH_MODE === "environment") {
1744
+ throw new Error("External model config discovery is disabled; configure the model endpoint and its environment key explicitly.");
1745
+ }
1743
1746
  const configPath = options.configPath ?? join7(homedir2(), ".codex", "config.toml");
1744
1747
  const config = parse2(readFileSync7(configPath, "utf8"));
1745
1748
  const provider = config.model_provider;
@@ -2667,6 +2670,8 @@ var init_models = __esm(() => {
2667
2670
  import { join as join9 } from "node:path";
2668
2671
  import { getAgentDir, readStoredCredential } from "@earendil-works/pi-coding-agent";
2669
2672
  function readDazziLoginToken(agentDir = getAgentDir()) {
2673
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
2674
+ return;
2670
2675
  return resolveCredentialKey(readStoredCredential(PROVIDER_ID, join9(agentDir, "auth.json")));
2671
2676
  }
2672
2677
  function isDazziSignedIn(agentDir = getAgentDir()) {
@@ -15738,6 +15743,7 @@ var init_types3 = __esm(() => {
15738
15743
  import { randomUUID as randomUUID4 } from "node:crypto";
15739
15744
  import { existsSync as existsSync15, mkdirSync as mkdirSync13, readFileSync as readFileSync17, unlinkSync as unlinkSync2, writeFileSync as writeFileSync9 } from "node:fs";
15740
15745
  import { basename as basename6, dirname as dirname13, isAbsolute as isAbsolute6, join as join24, resolve as resolve7 } from "node:path";
15746
+ import { InMemoryCredentialStore } from "@earendil-works/pi-ai";
15741
15747
  import { findEnvKeys, getEnvApiKey } from "@earendil-works/pi-ai/compat";
15742
15748
  import { getAgentDir as getAgentDir2, ModelRuntime, SettingsManager } from "@earendil-works/pi-coding-agent";
15743
15749
  function resolveConfigPath(input) {
@@ -16781,10 +16787,20 @@ function resolveAgentDir(options) {
16781
16787
  return options.agentDir ?? getAgentDir2();
16782
16788
  }
16783
16789
  function getModelRuntime(agentDir) {
16784
- const cached = modelRuntimeCache.get(agentDir);
16790
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
16791
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
16792
+ const cached = modelRuntimeCache.get(cacheKey);
16785
16793
  if (cached !== undefined)
16786
16794
  return cached;
16787
16795
  const created = (async () => {
16796
+ if (environmentOnly) {
16797
+ return ModelRuntime.create({
16798
+ credentials: new InMemoryCredentialStore,
16799
+ modelsPath: null,
16800
+ allowModelNetwork: false,
16801
+ refreshOnCreate: false
16802
+ });
16803
+ }
16788
16804
  const runtime = await ModelRuntime.create({
16789
16805
  authPath: join24(agentDir, "auth.json"),
16790
16806
  modelsPath: join24(agentDir, "models.json"),
@@ -16793,9 +16809,9 @@ function getModelRuntime(agentDir) {
16793
16809
  await registerDazziProvider(runtime);
16794
16810
  return runtime;
16795
16811
  })();
16796
- modelRuntimeCache.set(agentDir, created);
16812
+ modelRuntimeCache.set(cacheKey, created);
16797
16813
  created.catch(() => {
16798
- modelRuntimeCache.delete(agentDir);
16814
+ modelRuntimeCache.delete(cacheKey);
16799
16815
  });
16800
16816
  return created;
16801
16817
  }
@@ -16826,6 +16842,8 @@ function localRuntimeAuth(local) {
16826
16842
  };
16827
16843
  }
16828
16844
  async function resolvePiDefaultModel(runtime, options) {
16845
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
16846
+ return;
16829
16847
  let provider;
16830
16848
  let id;
16831
16849
  try {
@@ -32152,17 +32170,21 @@ var init_datasource_skill = __esm(() => {
32152
32170
 
32153
32171
  // src/agent/decision-backends.ts
32154
32172
  import { join as join48 } from "node:path";
32173
+ import {
32174
+ InMemoryCredentialStore as InMemoryCredentialStore2
32175
+ } from "@earendil-works/pi-ai";
32155
32176
  import { getAgentDir as getAgentDir3, ModelRuntime as ModelRuntime3 } from "@earendil-works/pi-coding-agent";
32156
32177
  import { BackendError as BackendError3 } from "jev-use";
32157
32178
  function runtimeFor(agentDir) {
32158
- let runtime = runtimes.get(agentDir);
32179
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
32180
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
32181
+ let runtime = runtimes.get(cacheKey);
32159
32182
  if (runtime === undefined) {
32160
32183
  runtime = ModelRuntime3.create({
32161
- authPath: join48(agentDir, "auth.json"),
32162
- modelsPath: join48(agentDir, "models.json"),
32184
+ ...environmentOnly ? { credentials: new InMemoryCredentialStore2, modelsPath: null, refreshOnCreate: false } : { authPath: join48(agentDir, "auth.json"), modelsPath: join48(agentDir, "models.json") },
32163
32185
  allowModelNetwork: false
32164
32186
  });
32165
- runtimes.set(agentDir, runtime);
32187
+ runtimes.set(cacheKey, runtime);
32166
32188
  }
32167
32189
  return runtime;
32168
32190
  }
package/dist/core.js CHANGED
@@ -11569,6 +11569,8 @@ var init_models = __esm(() => {
11569
11569
  import { join as join28 } from "node:path";
11570
11570
  import { getAgentDir, readStoredCredential } from "@earendil-works/pi-coding-agent";
11571
11571
  function readDazziLoginToken(agentDir = getAgentDir()) {
11572
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
11573
+ return;
11572
11574
  return resolveCredentialKey(readStoredCredential(PROVIDER_ID, join28(agentDir, "auth.json")));
11573
11575
  }
11574
11576
  function isDazziSignedIn(agentDir = getAgentDir()) {
@@ -16776,6 +16778,9 @@ import { homedir as homedir3 } from "node:os";
16776
16778
  import { join as join32 } from "node:path";
16777
16779
  import { parse as parse2 } from "smol-toml";
16778
16780
  function loadLocalAutoRAGModel(options = {}) {
16781
+ if (process.env.AUTORAG_AUTH_MODE === "environment") {
16782
+ throw new Error("External model config discovery is disabled; configure the model endpoint and its environment key explicitly.");
16783
+ }
16779
16784
  const configPath = options.configPath ?? join32(homedir3(), ".codex", "config.toml");
16780
16785
  const config = parse2(readFileSync16(configPath, "utf8"));
16781
16786
  const provider = config.model_provider;
@@ -27929,6 +27934,7 @@ var init_factory = __esm(() => {
27929
27934
  import { randomUUID as randomUUID6 } from "node:crypto";
27930
27935
  import { existsSync as existsSync27, mkdirSync as mkdirSync21, readFileSync as readFileSync24, unlinkSync as unlinkSync3, writeFileSync as writeFileSync14 } from "node:fs";
27931
27936
  import { basename as basename13, dirname as dirname24, isAbsolute as isAbsolute11, join as join43, resolve as resolve15 } from "node:path";
27937
+ import { InMemoryCredentialStore } from "@earendil-works/pi-ai";
27932
27938
  import { findEnvKeys, getEnvApiKey } from "@earendil-works/pi-ai/compat";
27933
27939
  import { getAgentDir as getAgentDir2, ModelRuntime, SettingsManager } from "@earendil-works/pi-coding-agent";
27934
27940
  function resolveConfigPath(input) {
@@ -28972,10 +28978,20 @@ function resolveAgentDir(options) {
28972
28978
  return options.agentDir ?? getAgentDir2();
28973
28979
  }
28974
28980
  function getModelRuntime(agentDir) {
28975
- const cached = modelRuntimeCache.get(agentDir);
28981
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
28982
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
28983
+ const cached = modelRuntimeCache.get(cacheKey);
28976
28984
  if (cached !== undefined)
28977
28985
  return cached;
28978
28986
  const created = (async () => {
28987
+ if (environmentOnly) {
28988
+ return ModelRuntime.create({
28989
+ credentials: new InMemoryCredentialStore,
28990
+ modelsPath: null,
28991
+ allowModelNetwork: false,
28992
+ refreshOnCreate: false
28993
+ });
28994
+ }
28979
28995
  const runtime = await ModelRuntime.create({
28980
28996
  authPath: join43(agentDir, "auth.json"),
28981
28997
  modelsPath: join43(agentDir, "models.json"),
@@ -28984,9 +29000,9 @@ function getModelRuntime(agentDir) {
28984
29000
  await registerDazziProvider(runtime);
28985
29001
  return runtime;
28986
29002
  })();
28987
- modelRuntimeCache.set(agentDir, created);
29003
+ modelRuntimeCache.set(cacheKey, created);
28988
29004
  created.catch(() => {
28989
- modelRuntimeCache.delete(agentDir);
29005
+ modelRuntimeCache.delete(cacheKey);
28990
29006
  });
28991
29007
  return created;
28992
29008
  }
@@ -29017,6 +29033,8 @@ function localRuntimeAuth(local) {
29017
29033
  };
29018
29034
  }
29019
29035
  async function resolvePiDefaultModel(runtime, options) {
29036
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
29037
+ return;
29020
29038
  let provider;
29021
29039
  let id;
29022
29040
  try {
@@ -33957,17 +33975,21 @@ var init_datasource_skill = __esm(() => {
33957
33975
 
33958
33976
  // src/agent/decision-backends.ts
33959
33977
  import { join as join52 } from "node:path";
33978
+ import {
33979
+ InMemoryCredentialStore as InMemoryCredentialStore2
33980
+ } from "@earendil-works/pi-ai";
33960
33981
  import { getAgentDir as getAgentDir5, ModelRuntime as ModelRuntime4 } from "@earendil-works/pi-coding-agent";
33961
33982
  import { BackendError as BackendError3 } from "jev-use";
33962
33983
  function runtimeFor(agentDir) {
33963
- let runtime = runtimes.get(agentDir);
33984
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
33985
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
33986
+ let runtime = runtimes.get(cacheKey);
33964
33987
  if (runtime === undefined) {
33965
33988
  runtime = ModelRuntime4.create({
33966
- authPath: join52(agentDir, "auth.json"),
33967
- modelsPath: join52(agentDir, "models.json"),
33989
+ ...environmentOnly ? { credentials: new InMemoryCredentialStore2, modelsPath: null, refreshOnCreate: false } : { authPath: join52(agentDir, "auth.json"), modelsPath: join52(agentDir, "models.json") },
33968
33990
  allowModelNetwork: false
33969
33991
  });
33970
- runtimes.set(agentDir, runtime);
33992
+ runtimes.set(cacheKey, runtime);
33971
33993
  }
33972
33994
  return runtime;
33973
33995
  }
package/dist/index.js CHANGED
@@ -11569,6 +11569,8 @@ var init_models = __esm(() => {
11569
11569
  import { join as join28 } from "node:path";
11570
11570
  import { getAgentDir, readStoredCredential } from "@earendil-works/pi-coding-agent";
11571
11571
  function readDazziLoginToken(agentDir = getAgentDir()) {
11572
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
11573
+ return;
11572
11574
  return resolveCredentialKey(readStoredCredential(PROVIDER_ID, join28(agentDir, "auth.json")));
11573
11575
  }
11574
11576
  function isDazziSignedIn(agentDir = getAgentDir()) {
@@ -16776,6 +16778,9 @@ import { homedir as homedir3 } from "node:os";
16776
16778
  import { join as join32 } from "node:path";
16777
16779
  import { parse as parse2 } from "smol-toml";
16778
16780
  function loadLocalAutoRAGModel(options = {}) {
16781
+ if (process.env.AUTORAG_AUTH_MODE === "environment") {
16782
+ throw new Error("External model config discovery is disabled; configure the model endpoint and its environment key explicitly.");
16783
+ }
16779
16784
  const configPath = options.configPath ?? join32(homedir3(), ".codex", "config.toml");
16780
16785
  const config = parse2(readFileSync16(configPath, "utf8"));
16781
16786
  const provider = config.model_provider;
@@ -27929,6 +27934,7 @@ var init_factory = __esm(() => {
27929
27934
  import { randomUUID as randomUUID6 } from "node:crypto";
27930
27935
  import { existsSync as existsSync27, mkdirSync as mkdirSync21, readFileSync as readFileSync24, unlinkSync as unlinkSync3, writeFileSync as writeFileSync14 } from "node:fs";
27931
27936
  import { basename as basename13, dirname as dirname24, isAbsolute as isAbsolute11, join as join43, resolve as resolve15 } from "node:path";
27937
+ import { InMemoryCredentialStore } from "@earendil-works/pi-ai";
27932
27938
  import { findEnvKeys, getEnvApiKey } from "@earendil-works/pi-ai/compat";
27933
27939
  import { getAgentDir as getAgentDir2, ModelRuntime, SettingsManager } from "@earendil-works/pi-coding-agent";
27934
27940
  function resolveConfigPath(input) {
@@ -28972,10 +28978,20 @@ function resolveAgentDir(options) {
28972
28978
  return options.agentDir ?? getAgentDir2();
28973
28979
  }
28974
28980
  function getModelRuntime(agentDir) {
28975
- const cached = modelRuntimeCache.get(agentDir);
28981
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
28982
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
28983
+ const cached = modelRuntimeCache.get(cacheKey);
28976
28984
  if (cached !== undefined)
28977
28985
  return cached;
28978
28986
  const created = (async () => {
28987
+ if (environmentOnly) {
28988
+ return ModelRuntime.create({
28989
+ credentials: new InMemoryCredentialStore,
28990
+ modelsPath: null,
28991
+ allowModelNetwork: false,
28992
+ refreshOnCreate: false
28993
+ });
28994
+ }
28979
28995
  const runtime = await ModelRuntime.create({
28980
28996
  authPath: join43(agentDir, "auth.json"),
28981
28997
  modelsPath: join43(agentDir, "models.json"),
@@ -28984,9 +29000,9 @@ function getModelRuntime(agentDir) {
28984
29000
  await registerDazziProvider(runtime);
28985
29001
  return runtime;
28986
29002
  })();
28987
- modelRuntimeCache.set(agentDir, created);
29003
+ modelRuntimeCache.set(cacheKey, created);
28988
29004
  created.catch(() => {
28989
- modelRuntimeCache.delete(agentDir);
29005
+ modelRuntimeCache.delete(cacheKey);
28990
29006
  });
28991
29007
  return created;
28992
29008
  }
@@ -29017,6 +29033,8 @@ function localRuntimeAuth(local) {
29017
29033
  };
29018
29034
  }
29019
29035
  async function resolvePiDefaultModel(runtime, options) {
29036
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
29037
+ return;
29020
29038
  let provider;
29021
29039
  let id;
29022
29040
  try {
@@ -33957,17 +33975,21 @@ var init_datasource_skill = __esm(() => {
33957
33975
 
33958
33976
  // src/agent/decision-backends.ts
33959
33977
  import { join as join52 } from "node:path";
33978
+ import {
33979
+ InMemoryCredentialStore as InMemoryCredentialStore2
33980
+ } from "@earendil-works/pi-ai";
33960
33981
  import { getAgentDir as getAgentDir5, ModelRuntime as ModelRuntime4 } from "@earendil-works/pi-coding-agent";
33961
33982
  import { BackendError as BackendError3 } from "jev-use";
33962
33983
  function runtimeFor(agentDir) {
33963
- let runtime = runtimes.get(agentDir);
33984
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
33985
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
33986
+ let runtime = runtimes.get(cacheKey);
33964
33987
  if (runtime === undefined) {
33965
33988
  runtime = ModelRuntime4.create({
33966
- authPath: join52(agentDir, "auth.json"),
33967
- modelsPath: join52(agentDir, "models.json"),
33989
+ ...environmentOnly ? { credentials: new InMemoryCredentialStore2, modelsPath: null, refreshOnCreate: false } : { authPath: join52(agentDir, "auth.json"), modelsPath: join52(agentDir, "models.json") },
33968
33990
  allowModelNetwork: false
33969
33991
  });
33970
- runtimes.set(agentDir, runtime);
33992
+ runtimes.set(cacheKey, runtime);
33971
33993
  }
33972
33994
  return runtime;
33973
33995
  }
package/dist/mcp/index.js CHANGED
@@ -11570,6 +11570,8 @@ var init_models = __esm(() => {
11570
11570
  import { join as join28 } from "node:path";
11571
11571
  import { getAgentDir, readStoredCredential } from "@earendil-works/pi-coding-agent";
11572
11572
  function readDazziLoginToken(agentDir = getAgentDir()) {
11573
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
11574
+ return;
11573
11575
  return resolveCredentialKey(readStoredCredential(PROVIDER_ID, join28(agentDir, "auth.json")));
11574
11576
  }
11575
11577
  function isDazziSignedIn(agentDir = getAgentDir()) {
@@ -16777,6 +16779,9 @@ import { homedir as homedir3 } from "node:os";
16777
16779
  import { join as join32 } from "node:path";
16778
16780
  import { parse as parse2 } from "smol-toml";
16779
16781
  function loadLocalAutoRAGModel(options = {}) {
16782
+ if (process.env.AUTORAG_AUTH_MODE === "environment") {
16783
+ throw new Error("External model config discovery is disabled; configure the model endpoint and its environment key explicitly.");
16784
+ }
16780
16785
  const configPath = options.configPath ?? join32(homedir3(), ".codex", "config.toml");
16781
16786
  const config = parse2(readFileSync16(configPath, "utf8"));
16782
16787
  const provider = config.model_provider;
@@ -27930,6 +27935,7 @@ var init_factory = __esm(() => {
27930
27935
  import { randomUUID as randomUUID6 } from "node:crypto";
27931
27936
  import { existsSync as existsSync27, mkdirSync as mkdirSync21, readFileSync as readFileSync24, unlinkSync as unlinkSync3, writeFileSync as writeFileSync14 } from "node:fs";
27932
27937
  import { basename as basename13, dirname as dirname24, isAbsolute as isAbsolute11, join as join43, resolve as resolve15 } from "node:path";
27938
+ import { InMemoryCredentialStore } from "@earendil-works/pi-ai";
27933
27939
  import { findEnvKeys, getEnvApiKey } from "@earendil-works/pi-ai/compat";
27934
27940
  import { getAgentDir as getAgentDir2, ModelRuntime, SettingsManager } from "@earendil-works/pi-coding-agent";
27935
27941
  function resolveConfigPath(input) {
@@ -28973,10 +28979,20 @@ function resolveAgentDir(options) {
28973
28979
  return options.agentDir ?? getAgentDir2();
28974
28980
  }
28975
28981
  function getModelRuntime(agentDir) {
28976
- const cached = modelRuntimeCache.get(agentDir);
28982
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
28983
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
28984
+ const cached = modelRuntimeCache.get(cacheKey);
28977
28985
  if (cached !== undefined)
28978
28986
  return cached;
28979
28987
  const created = (async () => {
28988
+ if (environmentOnly) {
28989
+ return ModelRuntime.create({
28990
+ credentials: new InMemoryCredentialStore,
28991
+ modelsPath: null,
28992
+ allowModelNetwork: false,
28993
+ refreshOnCreate: false
28994
+ });
28995
+ }
28980
28996
  const runtime = await ModelRuntime.create({
28981
28997
  authPath: join43(agentDir, "auth.json"),
28982
28998
  modelsPath: join43(agentDir, "models.json"),
@@ -28985,9 +29001,9 @@ function getModelRuntime(agentDir) {
28985
29001
  await registerDazziProvider(runtime);
28986
29002
  return runtime;
28987
29003
  })();
28988
- modelRuntimeCache.set(agentDir, created);
29004
+ modelRuntimeCache.set(cacheKey, created);
28989
29005
  created.catch(() => {
28990
- modelRuntimeCache.delete(agentDir);
29006
+ modelRuntimeCache.delete(cacheKey);
28991
29007
  });
28992
29008
  return created;
28993
29009
  }
@@ -29018,6 +29034,8 @@ function localRuntimeAuth(local) {
29018
29034
  };
29019
29035
  }
29020
29036
  async function resolvePiDefaultModel(runtime, options) {
29037
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
29038
+ return;
29021
29039
  let provider;
29022
29040
  let id;
29023
29041
  try {
@@ -33958,17 +33976,21 @@ var init_datasource_skill = __esm(() => {
33958
33976
 
33959
33977
  // src/agent/decision-backends.ts
33960
33978
  import { join as join52 } from "node:path";
33979
+ import {
33980
+ InMemoryCredentialStore as InMemoryCredentialStore2
33981
+ } from "@earendil-works/pi-ai";
33961
33982
  import { getAgentDir as getAgentDir5, ModelRuntime as ModelRuntime4 } from "@earendil-works/pi-coding-agent";
33962
33983
  import { BackendError as BackendError3 } from "jev-use";
33963
33984
  function runtimeFor(agentDir) {
33964
- let runtime = runtimes.get(agentDir);
33985
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
33986
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
33987
+ let runtime = runtimes.get(cacheKey);
33965
33988
  if (runtime === undefined) {
33966
33989
  runtime = ModelRuntime4.create({
33967
- authPath: join52(agentDir, "auth.json"),
33968
- modelsPath: join52(agentDir, "models.json"),
33990
+ ...environmentOnly ? { credentials: new InMemoryCredentialStore2, modelsPath: null, refreshOnCreate: false } : { authPath: join52(agentDir, "auth.json"), modelsPath: join52(agentDir, "models.json") },
33969
33991
  allowModelNetwork: false
33970
33992
  });
33971
- runtimes.set(agentDir, runtime);
33993
+ runtimes.set(cacheKey, runtime);
33972
33994
  }
33973
33995
  return runtime;
33974
33996
  }
package/dist/profiles.js CHANGED
@@ -195,6 +195,9 @@ import { homedir } from "node:os";
195
195
  import { join } from "node:path";
196
196
  import { parse } from "smol-toml";
197
197
  function loadLocalAutoRAGModel(options = {}) {
198
+ if (process.env.AUTORAG_AUTH_MODE === "environment") {
199
+ throw new Error("External model config discovery is disabled; configure the model endpoint and its environment key explicitly.");
200
+ }
198
201
  const configPath = options.configPath ?? join(homedir(), ".codex", "config.toml");
199
202
  const config = parse(readFileSync(configPath, "utf8"));
200
203
  const provider = config.model_provider;
@@ -1122,6 +1125,8 @@ var init_models = __esm(() => {
1122
1125
  import { join as join3 } from "node:path";
1123
1126
  import { getAgentDir, readStoredCredential } from "@earendil-works/pi-coding-agent";
1124
1127
  function readDazziLoginToken(agentDir = getAgentDir()) {
1128
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
1129
+ return;
1125
1130
  return resolveCredentialKey(readStoredCredential(PROVIDER_ID, join3(agentDir, "auth.json")));
1126
1131
  }
1127
1132
  function isDazziSignedIn(agentDir = getAgentDir()) {
@@ -15274,6 +15279,7 @@ var init_types3 = __esm(() => {
15274
15279
  import { randomUUID as randomUUID4 } from "node:crypto";
15275
15280
  import { existsSync as existsSync13, mkdirSync as mkdirSync12, readFileSync as readFileSync15, unlinkSync as unlinkSync2, writeFileSync as writeFileSync9 } from "node:fs";
15276
15281
  import { basename as basename5, dirname as dirname11, isAbsolute as isAbsolute5, join as join22, resolve as resolve6 } from "node:path";
15282
+ import { InMemoryCredentialStore } from "@earendil-works/pi-ai";
15277
15283
  import { findEnvKeys, getEnvApiKey } from "@earendil-works/pi-ai/compat";
15278
15284
  import { getAgentDir as getAgentDir2, ModelRuntime, SettingsManager } from "@earendil-works/pi-coding-agent";
15279
15285
  function resolveConfigPath(input) {
@@ -16317,10 +16323,20 @@ function resolveAgentDir(options) {
16317
16323
  return options.agentDir ?? getAgentDir2();
16318
16324
  }
16319
16325
  function getModelRuntime(agentDir) {
16320
- const cached = modelRuntimeCache.get(agentDir);
16326
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
16327
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
16328
+ const cached = modelRuntimeCache.get(cacheKey);
16321
16329
  if (cached !== undefined)
16322
16330
  return cached;
16323
16331
  const created = (async () => {
16332
+ if (environmentOnly) {
16333
+ return ModelRuntime.create({
16334
+ credentials: new InMemoryCredentialStore,
16335
+ modelsPath: null,
16336
+ allowModelNetwork: false,
16337
+ refreshOnCreate: false
16338
+ });
16339
+ }
16324
16340
  const runtime = await ModelRuntime.create({
16325
16341
  authPath: join22(agentDir, "auth.json"),
16326
16342
  modelsPath: join22(agentDir, "models.json"),
@@ -16329,9 +16345,9 @@ function getModelRuntime(agentDir) {
16329
16345
  await registerDazziProvider(runtime);
16330
16346
  return runtime;
16331
16347
  })();
16332
- modelRuntimeCache.set(agentDir, created);
16348
+ modelRuntimeCache.set(cacheKey, created);
16333
16349
  created.catch(() => {
16334
- modelRuntimeCache.delete(agentDir);
16350
+ modelRuntimeCache.delete(cacheKey);
16335
16351
  });
16336
16352
  return created;
16337
16353
  }
@@ -16362,6 +16378,8 @@ function localRuntimeAuth(local) {
16362
16378
  };
16363
16379
  }
16364
16380
  async function resolvePiDefaultModel(runtime, options) {
16381
+ if (process.env.AUTORAG_AUTH_MODE === "environment")
16382
+ return;
16365
16383
  let provider;
16366
16384
  let id;
16367
16385
  try {
@@ -32518,17 +32536,21 @@ var init_datasource_skill = __esm(() => {
32518
32536
 
32519
32537
  // src/agent/decision-backends.ts
32520
32538
  import { join as join49 } from "node:path";
32539
+ import {
32540
+ InMemoryCredentialStore as InMemoryCredentialStore2
32541
+ } from "@earendil-works/pi-ai";
32521
32542
  import { getAgentDir as getAgentDir4, ModelRuntime as ModelRuntime3 } from "@earendil-works/pi-coding-agent";
32522
32543
  import { BackendError as BackendError3 } from "jev-use";
32523
32544
  function runtimeFor(agentDir) {
32524
- let runtime = runtimes.get(agentDir);
32545
+ const environmentOnly = process.env.AUTORAG_AUTH_MODE === "environment";
32546
+ const cacheKey = `${environmentOnly ? "environment" : "stored"}:${agentDir}`;
32547
+ let runtime = runtimes.get(cacheKey);
32525
32548
  if (runtime === undefined) {
32526
32549
  runtime = ModelRuntime3.create({
32527
- authPath: join49(agentDir, "auth.json"),
32528
- modelsPath: join49(agentDir, "models.json"),
32550
+ ...environmentOnly ? { credentials: new InMemoryCredentialStore2, modelsPath: null, refreshOnCreate: false } : { authPath: join49(agentDir, "auth.json"), modelsPath: join49(agentDir, "models.json") },
32529
32551
  allowModelNetwork: false
32530
32552
  });
32531
- runtimes.set(agentDir, runtime);
32553
+ runtimes.set(cacheKey, runtime);
32532
32554
  }
32533
32555
  return runtime;
32534
32556
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.13.11",
3
+ "version": "2.13.12",
4
4
  "description": "Personal librarian agent for office work on the Pi framework, with pluggable retrieval methods",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {