@securecoms/agent-runtime 0.3.0 → 0.4.0

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.
Files changed (2) hide show
  1. package/dist/bin.js +24 -8
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -830,7 +830,18 @@ function loadSkillsConfigFile(path, dataDir) {
830
830
  ...strings(rawTools.allow) ? { allow: strings(rawTools.allow) } : {},
831
831
  ...strings(rawTools.deny) ? { deny: strings(rawTools.deny) } : {}
832
832
  } : void 0;
833
- return { endpoints, databases, flags, ...tools ? { tools } : {} };
833
+ let search;
834
+ const s = src.search;
835
+ if (s && typeof s === "object") {
836
+ if (s.provider !== "brave" && s.provider !== "tavily") {
837
+ console.warn(`[skills-config] search in ${path} has an unknown provider; skipped`);
838
+ } else if (typeof s.keyFile !== "string" || s.keyFile === "") {
839
+ console.warn(`[skills-config] search in ${path} has no keyFile; skipped`);
840
+ } else {
841
+ search = { provider: s.provider, keyFile: abs2(s.keyFile, dataDir) };
842
+ }
843
+ }
844
+ return { endpoints, databases, flags, ...tools ? { tools } : {}, ...search ? { search } : {} };
834
845
  }
835
846
 
836
847
  // src/builtins/current-time.ts
@@ -2262,8 +2273,18 @@ async function main() {
2262
2273
  }
2263
2274
  return mem;
2264
2275
  };
2276
+ const managedDir = managedConfigDir(cfg.identityId);
2277
+ const currentSkillsConfig = () => {
2278
+ const managed = findConfigFile("skills.json", [managedDir]);
2279
+ return managed ? loadSkillsConfigFile(managed, cfg.dataDir) : loadSkillsConfigFile(cfg.skillsConfigPath, cfg.dataDir);
2280
+ };
2281
+ const keyFilePath = (which) => {
2282
+ const owner = currentSkillsConfig().search;
2283
+ if (owner && owner.provider === which) return owner.keyFile;
2284
+ return which === "brave" ? cfg.braveKeyFile : cfg.tavilyKeyFile;
2285
+ };
2265
2286
  const readKeyFile = (which) => {
2266
- const path = which === "brave" ? cfg.braveKeyFile : cfg.tavilyKeyFile;
2287
+ const path = keyFilePath(which);
2267
2288
  if (!path) return null;
2268
2289
  try {
2269
2290
  return readFileSync9(path, "utf8").trim() || null;
@@ -2273,15 +2294,10 @@ async function main() {
2273
2294
  }
2274
2295
  };
2275
2296
  const configDirs = configSearchPath(cfg.identityId, cfg.dataDir);
2276
- const managedDir = managedConfigDir(cfg.identityId);
2277
- const hasSearchKey = () => hasReadableKeyFile([cfg.braveKeyFile, cfg.tavilyKeyFile], (p) => readFileSync9(p, "utf8"));
2297
+ const hasSearchKey = () => hasReadableKeyFile([keyFilePath("brave"), keyFilePath("tavily")], (p) => readFileSync9(p, "utf8"));
2278
2298
  migrateMemoryIntoManaged(managedDir, cfg.dataDir);
2279
2299
  const reportLocalConfig = createLocalConfigReporter(managedDir, cfg.dataDir, () => /* @__PURE__ */ new Date());
2280
2300
  reportLocalConfig(hasSearchKey());
2281
- const currentSkillsConfig = () => {
2282
- const managed = findConfigFile("skills.json", [managedDir]);
2283
- return managed ? loadSkillsConfigFile(managed, cfg.dataDir) : loadSkillsConfigFile(cfg.skillsConfigPath, cfg.dataDir);
2284
- };
2285
2301
  const builtinCtx = {
2286
2302
  dataDir: cfg.dataDir,
2287
2303
  configDirs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@securecoms/agent-runtime",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "securecoms-agent": "dist/bin.js"