multicorn-shield 0.2.2 → 0.6.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.
@@ -492,11 +492,22 @@ function loadMulticornConfig() {
492
492
  return null;
493
493
  }
494
494
  }
495
+ function agentNameFromOpenclawPlatform(cfg) {
496
+ if (cfg === null) return void 0;
497
+ const list = cfg.agents;
498
+ if (!Array.isArray(list)) return void 0;
499
+ for (const e of list) {
500
+ if (typeof e === "object" && e !== null && "platform" in e && "name" in e && e.platform === "openclaw" && typeof e.name === "string") {
501
+ return e.name;
502
+ }
503
+ }
504
+ return void 0;
505
+ }
495
506
  function readConfig() {
496
507
  const pc = pluginConfig ?? {};
497
508
  const resolvedApiKey = asString(cachedMulticornConfig?.apiKey) ?? asString(process.env["MULTICORN_API_KEY"]) ?? "";
498
509
  const resolvedBaseUrl = asString(cachedMulticornConfig?.baseUrl) ?? asString(process.env["MULTICORN_BASE_URL"]) ?? "https://api.multicorn.ai";
499
- const agentName = asString(pc["agentName"]) ?? process.env["MULTICORN_AGENT_NAME"] ?? asString(cachedMulticornConfig?.agentName) ?? null;
510
+ const agentName = asString(pc["agentName"]) ?? process.env["MULTICORN_AGENT_NAME"] ?? agentNameFromOpenclawPlatform(cachedMulticornConfig) ?? asString(cachedMulticornConfig?.agentName) ?? null;
500
511
  const failMode = "closed";
501
512
  return { apiKey: resolvedApiKey, baseUrl: resolvedBaseUrl, agentName, failMode };
502
513
  }