@agentvault/agentvault 0.14.2 → 0.14.4

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.
package/dist/cli.js CHANGED
@@ -49244,37 +49244,25 @@ function writeOpenClawConfig(home, config, backupSuffix) {
49244
49244
  copyFileSync(configPath, backupPath);
49245
49245
  writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
49246
49246
  }
49247
- function findNextPort(config, startPort = 18790) {
49247
+ function collectPorts(config) {
49248
49248
  const ports = [];
49249
- const plugins = config.plugins ?? [];
49250
- for (const plugin of plugins) {
49251
- const accounts = plugin.accounts ?? [];
49252
- for (const acct of accounts) {
49249
+ const accounts = config?.channels?.agentvault?.accounts;
49250
+ if (accounts && typeof accounts === "object") {
49251
+ for (const acct of Object.values(accounts)) {
49253
49252
  if (typeof acct.httpPort === "number") {
49254
49253
  ports.push(acct.httpPort);
49255
49254
  }
49256
49255
  }
49257
49256
  }
49258
- const rootAccounts = config.accounts ?? [];
49259
- for (const acct of rootAccounts) {
49260
- if (typeof acct.httpPort === "number") {
49261
- ports.push(acct.httpPort);
49262
- }
49263
- }
49257
+ return ports;
49258
+ }
49259
+ function findNextPort(config, startPort = 18800) {
49260
+ const ports = collectPorts(config);
49264
49261
  if (ports.length === 0) return startPort;
49265
49262
  return Math.max(...ports, startPort - 1) + 1;
49266
49263
  }
49267
49264
  function isPortInUse(config, port) {
49268
- const plugins = config.plugins ?? [];
49269
- for (const plugin of plugins) {
49270
- for (const acct of plugin.accounts ?? []) {
49271
- if (acct.httpPort === port) return true;
49272
- }
49273
- }
49274
- for (const acct of config.accounts ?? []) {
49275
- if (acct.httpPort === port) return true;
49276
- }
49277
- return false;
49265
+ return collectPorts(config).includes(port);
49278
49266
  }
49279
49267
  function generateWorkspaceFiles(name2) {
49280
49268
  const displayName = name2.charAt(0).toUpperCase() + name2.slice(1).toLowerCase();
@@ -49403,16 +49391,12 @@ async function runCreateCommand(options) {
49403
49391
  try {
49404
49392
  const freshConfig = readOpenClawConfig(home);
49405
49393
  let patched = false;
49406
- const plugins = freshConfig.plugins ?? [];
49407
- for (const plugin of plugins) {
49408
- if (plugin.id === "agentvault" || plugin.plugin === "agentvault" || plugin.name === "agentvault") {
49409
- const accounts = plugin.accounts ?? [];
49410
- for (const acct of accounts) {
49411
- if (acct.id === name2) {
49412
- acct.httpPort = port;
49413
- patched = true;
49414
- }
49415
- }
49394
+ const avChannel = freshConfig?.channels?.agentvault;
49395
+ if (avChannel?.accounts) {
49396
+ const acct = avChannel.accounts[name2];
49397
+ if (acct) {
49398
+ acct.httpPort = port;
49399
+ patched = true;
49416
49400
  }
49417
49401
  }
49418
49402
  if (patched) {
@@ -49420,7 +49404,7 @@ async function runCreateCommand(options) {
49420
49404
  console.log(` httpPort set to ${port}.
49421
49405
  `);
49422
49406
  } else {
49423
- console.log(` Warning: Could not find account '${name2}' to patch httpPort.`);
49407
+ console.log(` Warning: Could not find account '${name2}' in channels.agentvault.accounts.`);
49424
49408
  console.log(` You may need to manually set httpPort: ${port} in openclaw.json.
49425
49409
  `);
49426
49410
  }