@algosuite/vo-mcp 0.2.0-beta.74 → 0.2.0-beta.75

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/index.js CHANGED
@@ -506,8 +506,8 @@ import { existsSync as existsSync8, readdirSync as readdirSync5, readFileSync as
506
506
  function extractMemoryTitle(fileName, content) {
507
507
  const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
508
508
  if (frontmatter) {
509
- const description24 = frontmatter[1].match(/^description:\s*(.+)$/m);
510
- if (description24 && description24[1].trim()) return description24[1].trim().slice(0, 200);
509
+ const description25 = frontmatter[1].match(/^description:\s*(.+)$/m);
510
+ if (description25 && description25[1].trim()) return description25[1].trim().slice(0, 200);
511
511
  }
512
512
  const heading = content.match(/^#\s+(.+)$/m);
513
513
  if (heading && heading[1].trim()) return heading[1].trim().slice(0, 200);
@@ -5759,9 +5759,9 @@ function resolveWindowsClaudeExecutable({
5759
5759
 
5760
5760
  // src/swarm/successor-windows-exe.ts
5761
5761
  var resolveWindowsClaudeExe = (bin, env) => resolveWindowsClaudeExecutable({ bin, env });
5762
- function resolveNativeWindowsExecutable(bin, env = process.env, resolve3 = resolveWindowsClaudeExe) {
5762
+ function resolveNativeWindowsExecutable(bin, env = process.env, resolve4 = resolveWindowsClaudeExe) {
5763
5763
  try {
5764
- return { ok: true, bin: resolve3(bin, env) };
5764
+ return { ok: true, bin: resolve4(bin, env) };
5765
5765
  } catch (error) {
5766
5766
  const message = error instanceof Error ? error.message : String(error);
5767
5767
  return {
@@ -5814,7 +5814,7 @@ function checkSuccessorLiveness(child, logPath, config, deps = {}) {
5814
5814
  const killChild = deps.killChild ?? defaultKillChild;
5815
5815
  const outputGateEnabled = Number.isFinite(config.noOutputMs) && config.noOutputMs > 0;
5816
5816
  const startedAt = now();
5817
- return new Promise((resolve3) => {
5817
+ return new Promise((resolve4) => {
5818
5818
  let settled = false;
5819
5819
  let pollTimer = null;
5820
5820
  const onExit = (code, signal) => {
@@ -5839,7 +5839,7 @@ function checkSuccessorLiveness(child, logPath, config, deps = {}) {
5839
5839
  } catch {
5840
5840
  }
5841
5841
  }
5842
- resolve3(result);
5842
+ resolve4(result);
5843
5843
  };
5844
5844
  if (typeof child.exitCode === "number" || typeof child.signalCode === "string" && child.signalCode.length > 0) {
5845
5845
  finish({
@@ -6445,8 +6445,8 @@ async function acquireMemorySyncLock(options) {
6445
6445
  const waitMs = positiveOr(options.waitMs, DEFAULT_LOCK_WAIT_MS);
6446
6446
  const ttlMs = positiveOr(options.ttlMs, DEFAULT_LOCK_TTL_MS);
6447
6447
  const now = options.now ?? Date.now;
6448
- const sleep = options.sleep ?? ((ms) => new Promise((resolve3) => {
6449
- setTimeout(resolve3, ms);
6448
+ const sleep = options.sleep ?? ((ms) => new Promise((resolve4) => {
6449
+ setTimeout(resolve4, ms);
6450
6450
  }));
6451
6451
  const isProcessAlive = options.isProcessAlive ?? defaultIsProcessAlive;
6452
6452
  const thisHost = hostname();
@@ -7272,7 +7272,7 @@ ${FRONTMATTER_DELIMITER}
7272
7272
  ${FRONTMATTER_DELIMITER}
7273
7273
  `.length);
7274
7274
  let name = "";
7275
- let description24 = "";
7275
+ let description25 = "";
7276
7276
  for (const line of frontmatterText.split("\n")) {
7277
7277
  const trimmed = line.trim();
7278
7278
  if (trimmed.length === 0) continue;
@@ -7281,15 +7281,15 @@ ${FRONTMATTER_DELIMITER}
7281
7281
  const key = trimmed.slice(0, colonIdx).trim();
7282
7282
  const value = trimmed.slice(colonIdx + 1).trim();
7283
7283
  if (key === "name") name = value;
7284
- else if (key === "description") description24 = value;
7284
+ else if (key === "description") description25 = value;
7285
7285
  }
7286
7286
  if (name.length === 0) {
7287
7287
  throw new InvalidSkillFrontmatterError(sourcePath, 'missing required field "name"');
7288
7288
  }
7289
- if (description24.length === 0) {
7289
+ if (description25.length === 0) {
7290
7290
  throw new InvalidSkillFrontmatterError(sourcePath, 'missing required field "description"');
7291
7291
  }
7292
- return { name, description: description24, body };
7292
+ return { name, description: description25, body };
7293
7293
  }
7294
7294
  function loadSkillsFromDir(skillsDir) {
7295
7295
  const entries = readdirSync6(skillsDir);
@@ -7310,8 +7310,8 @@ function loadSkillsFromDir(skillsDir) {
7310
7310
  } catch {
7311
7311
  continue;
7312
7312
  }
7313
- const { name, description: description24, body } = parseFrontmatter(raw, skillFile);
7314
- skills.push({ name, description: description24, body, sourcePath: skillFile });
7313
+ const { name, description: description25, body } = parseFrontmatter(raw, skillFile);
7314
+ skills.push({ name, description: description25, body, sourcePath: skillFile });
7315
7315
  }
7316
7316
  return [...skills].sort((a, b) => a.name.localeCompare(b.name));
7317
7317
  }
@@ -7425,6 +7425,103 @@ async function handleSkillGet(_deps, rawInput) {
7425
7425
  });
7426
7426
  }
7427
7427
 
7428
+ // src/tools/action-catalog.ts
7429
+ import { existsSync as existsSync11, statSync as statSync8 } from "node:fs";
7430
+ import { dirname as dirname6, isAbsolute as isAbsolute2, join as join14, resolve as resolve3 } from "node:path";
7431
+ import { pathToFileURL } from "node:url";
7432
+ var TOOL_NAME24 = "vo_action_catalog_lookup";
7433
+ var inputSchema24 = {
7434
+ type: "object",
7435
+ properties: {
7436
+ product: {
7437
+ type: "string",
7438
+ description: `Optional product key (e.g. "tax", "news"). Lists that product's actions. Ignored when actionId is set.`
7439
+ },
7440
+ actionId: {
7441
+ type: "string",
7442
+ description: 'Optional fully-qualified action id (e.g. "tax:ask-advisor"). Looks up exactly one action.'
7443
+ }
7444
+ },
7445
+ additionalProperties: false
7446
+ };
7447
+ var description24 = 'Read-only lookup over the HQ agent-executor ACTION_CATALOG (product -> callable action list). Call with no arguments to list every product and its action count, with `product` to list that product\'s actions, or with `actionId` to look up one action by id. An unknown actionId returns a named not-found result (reason "unknown_action_id" or "unknown_product"), never a throw or a silently empty result. Returns `catalog_available: false` when run outside a Nexus monorepo checkout.';
7448
+ function isToolInput23(v) {
7449
+ if (typeof v !== "object" || v === null) return false;
7450
+ const obj = v;
7451
+ if ("product" in obj && obj.product !== void 0 && typeof obj.product !== "string") return false;
7452
+ if ("actionId" in obj && obj.actionId !== void 0 && typeof obj.actionId !== "string") return false;
7453
+ return true;
7454
+ }
7455
+ var MAX_WALK_UP_LEVELS2 = 8;
7456
+ var RELATIVE_MODULE_PATH = ["scripts", "virtual-office", "action-catalog-data.mjs"];
7457
+ function resolveActionCatalogModulePath(env = process.env, startDir = process.cwd()) {
7458
+ const override = env.VO_ACTION_CATALOG_MODULE;
7459
+ if (typeof override === "string" && override.length > 0) {
7460
+ const abs = isAbsolute2(override) ? override : resolve3(startDir, override);
7461
+ return existsSync11(abs) && statSync8(abs).isFile() ? abs : null;
7462
+ }
7463
+ let dir = resolve3(startDir);
7464
+ for (let i = 0; i < MAX_WALK_UP_LEVELS2; i += 1) {
7465
+ const candidate = join14(dir, ...RELATIVE_MODULE_PATH);
7466
+ if (existsSync11(candidate) && statSync8(candidate).isFile()) return candidate;
7467
+ const parent = dirname6(dir);
7468
+ if (parent === dir) break;
7469
+ dir = parent;
7470
+ }
7471
+ return null;
7472
+ }
7473
+ var cachedCatalog = null;
7474
+ async function loadCatalogModule(refresh) {
7475
+ if (!refresh && cachedCatalog !== null) return cachedCatalog;
7476
+ const modulePath = resolveActionCatalogModulePath();
7477
+ if (modulePath === null) {
7478
+ cachedCatalog = { modulePath: null, mod: null };
7479
+ return cachedCatalog;
7480
+ }
7481
+ const mod = await import(pathToFileURL(modulePath).href);
7482
+ cachedCatalog = { modulePath, mod };
7483
+ return cachedCatalog;
7484
+ }
7485
+ async function handleActionCatalogLookup(_deps, rawInput, _signal) {
7486
+ if (!isToolInput23(rawInput)) {
7487
+ throw invalidParams(TOOL_NAME24, 'invalid input. Optional fields: "product" (string), "actionId" (string).');
7488
+ }
7489
+ const { modulePath, mod } = await loadCatalogModule(false);
7490
+ if (mod === null) {
7491
+ return jsonContent({
7492
+ catalog_available: false,
7493
+ unavailable_reason: "scripts/virtual-office/action-catalog-data.mjs was not found. Set VO_ACTION_CATALOG_MODULE or run inside a Nexus monorepo checkout.",
7494
+ module_path: modulePath
7495
+ });
7496
+ }
7497
+ if (rawInput.actionId) {
7498
+ const lookup = mod.findAction(rawInput.actionId);
7499
+ return jsonContent({ catalog_available: true, module_path: modulePath, lookup });
7500
+ }
7501
+ if (rawInput.product) {
7502
+ const actions = mod.ACTION_CATALOG[rawInput.product];
7503
+ if (!actions) {
7504
+ return jsonContent({
7505
+ catalog_available: true,
7506
+ module_path: modulePath,
7507
+ product: rawInput.product,
7508
+ found: false,
7509
+ reason: "unknown_product",
7510
+ known_products: Object.keys(mod.ACTION_CATALOG).sort()
7511
+ });
7512
+ }
7513
+ return jsonContent({
7514
+ catalog_available: true,
7515
+ module_path: modulePath,
7516
+ product: rawInput.product,
7517
+ found: true,
7518
+ actions
7519
+ });
7520
+ }
7521
+ const products = Object.entries(mod.ACTION_CATALOG).map(([key, actions]) => ({ product: key, action_count: actions.length })).sort((a, b) => a.product.localeCompare(b.product));
7522
+ return jsonContent({ catalog_available: true, module_path: modulePath, products });
7523
+ }
7524
+
7428
7525
  // src/server.ts
7429
7526
  function buildToolRegistry() {
7430
7527
  return {
@@ -7675,6 +7772,14 @@ function buildToolRegistry() {
7675
7772
  inputSchema: getInputSchema
7676
7773
  },
7677
7774
  handler: handleSkillGet
7775
+ },
7776
+ [TOOL_NAME24]: {
7777
+ definition: {
7778
+ name: TOOL_NAME24,
7779
+ description: description24,
7780
+ inputSchema: inputSchema24
7781
+ },
7782
+ handler: handleActionCatalogLookup
7678
7783
  }
7679
7784
  };
7680
7785
  }
@@ -7733,7 +7838,7 @@ function listToolNames() {
7733
7838
  // src/cache/sqlite-cache.ts
7734
7839
  import { createHash as createHash4 } from "node:crypto";
7735
7840
  import { chmodSync as chmodSync3, mkdirSync as mkdirSync7 } from "node:fs";
7736
- import { dirname as dirname6 } from "node:path";
7841
+ import { dirname as dirname7 } from "node:path";
7737
7842
  import { DatabaseSync } from "node:sqlite";
7738
7843
 
7739
7844
  // src/cache/canonicalize.ts
@@ -7778,7 +7883,7 @@ function normalizeString(s) {
7778
7883
  function createSqliteCache(options) {
7779
7884
  const fileBacked = options.dbPath !== ":memory:";
7780
7885
  if (fileBacked) {
7781
- mkdirSync7(dirname6(options.dbPath), { recursive: true, mode: 448 });
7886
+ mkdirSync7(dirname7(options.dbPath), { recursive: true, mode: 448 });
7782
7887
  }
7783
7888
  const versionNamespace = options.cacheVersionNamespace ?? "";
7784
7889
  const db = new DatabaseSync(options.dbPath);