@vendian/cli 0.0.35 → 0.0.36

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/cli-wrapper.mjs +57 -12
  2. package/package.json +1 -1
package/cli-wrapper.mjs CHANGED
@@ -2363,7 +2363,7 @@ function buildLocalServeEventStreamArgs({ agentsDir: agentsDir2 = "./agents", co
2363
2363
  }
2364
2364
 
2365
2365
  // src/version.js
2366
- var CLI_VERSION = true ? "0.0.35" : process.env.npm_package_version || "0.0.0-dev";
2366
+ var CLI_VERSION = true ? "0.0.36" : process.env.npm_package_version || "0.0.0-dev";
2367
2367
 
2368
2368
  // src/dev-server.js
2369
2369
  var __dirname = path8.dirname(fileURLToPath(import.meta.url));
@@ -2604,6 +2604,8 @@ function apiAgents(req, res) {
2604
2604
  version: info.version || "",
2605
2605
  triggers: info.triggers || [],
2606
2606
  credentials: info.credentials || [],
2607
+ triggerCount: info.triggerCount || (info.triggers || []).length,
2608
+ credentialCount: info.credentialCount || (info.credentials || []).length,
2607
2609
  hasAgentPy: fs11.existsSync(path8.join(folder.absolutePath, "agent.py")),
2608
2610
  hasRequirements: fs11.existsSync(path8.join(folder.absolutePath, "requirements.txt")),
2609
2611
  runtimeStatus: runtime.status
@@ -2618,14 +2620,17 @@ function apiLogs(req, res, parsed) {
2618
2620
  }
2619
2621
  function apiAuth(req, res) {
2620
2622
  const active = activeCloudAuthStatus();
2623
+ const activeUrl = (active.activeApiUrl || active.apiUrl || "").replace(/\/$/, "");
2621
2624
  const backends = Object.entries(BACKEND_TARGETS).filter(([key]) => !["localhost", "production"].includes(key)).map(([key, url]) => {
2622
- const status = cloudAuthStatus({ backend: key });
2625
+ const canonicalUrl = url.replace(/\/$/, "");
2626
+ const status = cloudAuthStatus({ backend: key, env: { ...process.env, VENDIAN_API_URL: "" } });
2627
+ const isActive = Boolean(activeUrl && canonicalUrl === activeUrl && active.authenticated);
2623
2628
  return {
2624
2629
  key,
2625
2630
  url,
2626
2631
  authenticated: status.authenticated,
2627
2632
  email: status.email || null,
2628
- active: status.apiUrl === active.apiUrl && active.authenticated
2633
+ active: isActive
2629
2634
  };
2630
2635
  });
2631
2636
  jsonResponse(res, {
@@ -2818,29 +2823,69 @@ function parseManifestBasic(manifestPath) {
2818
2823
  const m = content.match(new RegExp(`^${key}\\s*:\\s*['"]?([^'"\\n#]+?)['"]?\\s*$`, "m"));
2819
2824
  return m ? m[1].trim() : "";
2820
2825
  };
2821
- const getList = (key) => {
2826
+ const countListItems = (key) => {
2827
+ const m = content.match(new RegExp(`^${key}\\s*:`, "m"));
2828
+ if (!m) return 0;
2829
+ const after = content.slice(m.index + m[0].length);
2830
+ const lines = after.split("\n");
2831
+ let count = 0;
2832
+ let firstIndent = -1;
2833
+ for (const line of lines) {
2834
+ if (/^\S/.test(line) && count > 0) break;
2835
+ const listMatch = line.match(/^(\s+)-\s/);
2836
+ if (listMatch) {
2837
+ const indent = listMatch[1].length;
2838
+ if (firstIndent < 0) firstIndent = indent;
2839
+ if (indent === firstIndent) count++;
2840
+ }
2841
+ }
2842
+ return count;
2843
+ };
2844
+ const getListLabels = (key) => {
2822
2845
  const m = content.match(new RegExp(`^${key}\\s*:`, "m"));
2823
2846
  if (!m) return [];
2824
2847
  const after = content.slice(m.index + m[0].length);
2825
2848
  const lines = after.split("\n");
2826
2849
  const items = [];
2850
+ let currentItem = null;
2851
+ let firstIndent = -1;
2827
2852
  for (const line of lines) {
2828
- if (/^\s+-\s/.test(line) || /^\s+\w+\s*:/.test(line)) {
2829
- const val = line.replace(/^\s+[-]?\s*/, "").replace(/:.*$/, "").trim();
2830
- if (val) items.push(val);
2831
- } else if (/^\S/.test(line) && items.length > 0) {
2832
- break;
2853
+ if (/^\S/.test(line) && items.length + (currentItem ? 1 : 0) > 0) break;
2854
+ const listMatch = line.match(/^(\s+)-\s*(.*)/);
2855
+ if (listMatch) {
2856
+ const indent = listMatch[1].length;
2857
+ if (firstIndent < 0) firstIndent = indent;
2858
+ if (indent === firstIndent) {
2859
+ if (currentItem) items.push(currentItem);
2860
+ const inlineValue = listMatch[2].trim();
2861
+ if (inlineValue && !inlineValue.includes(":")) {
2862
+ currentItem = { label: inlineValue };
2863
+ } else {
2864
+ currentItem = {};
2865
+ const kvMatch = inlineValue.match(/^(\w+)\s*:\s*(.+)/);
2866
+ if (kvMatch) currentItem[kvMatch[1]] = kvMatch[2].replace(/['"]*/g, "").trim();
2867
+ }
2868
+ } else if (currentItem) {
2869
+ const kvMatch = line.match(/^\s+(\w+)\s*:\s*(.+)/);
2870
+ if (kvMatch) currentItem[kvMatch[1]] = kvMatch[2].replace(/['"]*/g, "").trim();
2871
+ }
2872
+ } else if (currentItem && /^\s+\w+\s*:/.test(line)) {
2873
+ const kvMatch = line.match(/^\s+(\w+)\s*:\s*(.+)/);
2874
+ if (kvMatch) currentItem[kvMatch[1]] = kvMatch[2].replace(/['"]*/g, "").trim();
2833
2875
  }
2834
2876
  }
2835
- return items;
2877
+ if (currentItem) items.push(currentItem);
2878
+ return items.map((item) => item.label || item.type || item.id || Object.values(item)[0] || "").filter(Boolean);
2836
2879
  };
2837
2880
  return {
2838
2881
  id: get("id"),
2839
2882
  name: get("name"),
2840
2883
  description: get("description"),
2841
2884
  version: get("version"),
2842
- triggers: getList("triggers"),
2843
- credentials: getList("credentials")
2885
+ triggers: getListLabels("triggers"),
2886
+ credentials: getListLabels("credentials"),
2887
+ triggerCount: countListItems("triggers"),
2888
+ credentialCount: countListItems("credentials")
2844
2889
  };
2845
2890
  } catch {
2846
2891
  return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendian/cli",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "Public Vendian CLI bootstrapper and launcher",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,