multicorn-shield 0.1.5 → 0.1.6

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.
@@ -499,6 +499,20 @@ function readConfig() {
499
499
  const pc = pluginConfig ?? {};
500
500
  let resolvedApiKey = asString(pc["apiKey"]) ?? process.env["MULTICORN_API_KEY"] ?? "";
501
501
  let resolvedBaseUrl = asString(pc["baseUrl"]) ?? process.env["MULTICORN_BASE_URL"] ?? "";
502
+ if (!resolvedApiKey) {
503
+ try {
504
+ const multicornConfigPath = path.join(os.homedir(), ".multicorn", "config.json");
505
+ const multicornConfigContent = fs.readFileSync(multicornConfigPath, "utf-8");
506
+ const multicornConfig = JSON.parse(multicornConfigContent);
507
+ if (multicornConfig && typeof multicornConfig.apiKey === "string" && multicornConfig.apiKey.length > 0) {
508
+ resolvedApiKey = multicornConfig.apiKey;
509
+ if (!resolvedBaseUrl) {
510
+ resolvedBaseUrl = multicornConfig.baseUrl ?? "https://api.multicorn.ai";
511
+ }
512
+ }
513
+ } catch {
514
+ }
515
+ }
502
516
  if (!resolvedApiKey) {
503
517
  try {
504
518
  const configPath = path.join(os.homedir(), ".openclaw", "openclaw.json");
@@ -829,7 +843,7 @@ var plugin = {
829
843
  const config = readConfig();
830
844
  if (config.apiKey.length === 0) {
831
845
  api.logger.error(
832
- "Multicorn Shield: No API key found. Set MULTICORN_API_KEY in your OpenClaw config (~/.openclaw/openclaw.json \u2192 plugins.entries.multicorn-shield.env.MULTICORN_API_KEY). Get a key from your Multicorn dashboard (Settings \u2192 API Keys)."
846
+ "Multicorn Shield: No API key found. Run `npx multicorn-proxy init` to set up your API key, or set MULTICORN_API_KEY in your OpenClaw config (~/.openclaw/openclaw.json \u2192 plugins.entries.multicorn-shield.env.MULTICORN_API_KEY). Get a key from your Multicorn dashboard (Settings \u2192 API Keys)."
833
847
  );
834
848
  } else {
835
849
  api.logger.info(`Multicorn Shield connecting to ${config.baseUrl}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicorn-shield",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "The control layer for AI agents: permissions, consent, spending limits, and audit logging.",
5
5
  "license": "MIT",
6
6
  "type": "module",