@tini-works/inv-node 0.1.9 → 0.1.10

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/dist/cli.js +26 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1734,10 +1734,18 @@ var TOOL_DEFINITIONS = [
1734
1734
  },
1735
1735
  required: ["itemId"]
1736
1736
  }
1737
+ },
1738
+ {
1739
+ name: "inv_online_nodes",
1740
+ description: "List all other nodes currently online in this project. Use this to discover who you can communicate with.",
1741
+ inputSchema: {
1742
+ type: "object",
1743
+ properties: {}
1744
+ }
1737
1745
  }
1738
1746
  ];
1739
1747
  function buildToolHandlers(engine, config, wsClient) {
1740
- return (name, args) => {
1748
+ return async (name, args) => {
1741
1749
  const text = (s) => ({
1742
1750
  content: [{ type: "text", text: s }]
1743
1751
  });
@@ -1917,6 +1925,23 @@ function buildToolHandlers(engine, config, wsClient) {
1917
1925
  const items = engine.listChecklist(args.itemId ?? "");
1918
1926
  return text(JSON.stringify(items, null, 2));
1919
1927
  }
1928
+ case "inv_online_nodes": {
1929
+ if (!config.server.url || !config.server.token) {
1930
+ return text(JSON.stringify({ error: "Not configured for network" }));
1931
+ }
1932
+ const httpUrl = config.server.url.replace(/^ws/, "http").replace(/\/ws$/, "/api/online");
1933
+ const res = await fetch(`${httpUrl}?token=${config.server.token}`);
1934
+ if (!res.ok) {
1935
+ const err = await res.json();
1936
+ return text(JSON.stringify({ error: err.error ?? `HTTP ${res.status}` }));
1937
+ }
1938
+ const data = await res.json();
1939
+ return text(JSON.stringify({
1940
+ project: data.project,
1941
+ onlineNodes: data.nodes,
1942
+ count: data.nodes.length
1943
+ }, null, 2));
1944
+ }
1920
1945
  default:
1921
1946
  return text(JSON.stringify({ error: `Unknown tool: ${name}` }));
1922
1947
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tini-works/inv-node",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "bin": {
5
5
  "inv-node": "./dist/cli.js"
6
6
  },