hive-intelligence 1.1.4 → 1.3.0

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 (130) hide show
  1. package/README.md +182 -73
  2. package/agent-skills/.claude-plugin/plugin.json +4 -4
  3. package/agent-skills/.mcp.json +1 -4
  4. package/agent-skills/README.md +16 -10
  5. package/agent-skills/SKILL.md +30 -12
  6. package/agent-skills/package.json +1 -1
  7. package/agent-skills/packs/hive-build/SKILL.md +47 -19
  8. package/agent-skills/packs/hive-build/evals/evals.json +16 -3
  9. package/agent-skills/packs/hive-build/evals/triggers.json +50 -0
  10. package/agent-skills/packs/hive-build-onboarding/SKILL.md +27 -34
  11. package/agent-skills/packs/hive-build-onboarding/evals/evals.json +1 -1
  12. package/agent-skills/packs/hive-build-onboarding/evals/triggers.json +50 -0
  13. package/agent-skills/packs/hive-cli/SKILL.md +33 -35
  14. package/agent-skills/packs/hive-cli/evals/evals.json +1 -1
  15. package/agent-skills/packs/hive-cli/evals/triggers.json +50 -0
  16. package/agent-skills/packs/hive-defi-research/SKILL.md +105 -19
  17. package/agent-skills/packs/hive-defi-research/evals/evals.json +6 -3
  18. package/agent-skills/packs/hive-defi-research/evals/triggers.json +50 -0
  19. package/agent-skills/packs/hive-dex-pool-analysis/SKILL.md +106 -16
  20. package/agent-skills/packs/hive-dex-pool-analysis/evals/evals.json +5 -3
  21. package/agent-skills/packs/hive-dex-pool-analysis/evals/triggers.json +50 -0
  22. package/agent-skills/packs/hive-market-research/SKILL.md +130 -21
  23. package/agent-skills/packs/hive-market-research/evals/evals.json +15 -2
  24. package/agent-skills/packs/hive-market-research/evals/triggers.json +50 -0
  25. package/agent-skills/packs/hive-mcp/SKILL.md +69 -47
  26. package/agent-skills/packs/hive-mcp/evals/evals.json +3 -2
  27. package/agent-skills/packs/hive-mcp/evals/triggers.json +50 -0
  28. package/agent-skills/packs/hive-mcp/references/client-install-matrix.md +62 -35
  29. package/agent-skills/packs/hive-mcp/references/clients.md +81 -68
  30. package/agent-skills/packs/hive-network-infrastructure/SKILL.md +105 -20
  31. package/agent-skills/packs/hive-network-infrastructure/evals/evals.json +4 -2
  32. package/agent-skills/packs/hive-network-infrastructure/evals/triggers.json +50 -0
  33. package/agent-skills/packs/hive-nft-research/SKILL.md +105 -18
  34. package/agent-skills/packs/hive-nft-research/evals/evals.json +4 -2
  35. package/agent-skills/packs/hive-nft-research/evals/triggers.json +50 -0
  36. package/agent-skills/packs/hive-prediction-markets/SKILL.md +108 -21
  37. package/agent-skills/packs/hive-prediction-markets/evals/evals.json +4 -2
  38. package/agent-skills/packs/hive-prediction-markets/evals/triggers.json +50 -0
  39. package/agent-skills/packs/hive-query/SKILL.md +79 -33
  40. package/agent-skills/packs/hive-query/evals/evals.json +7 -5
  41. package/agent-skills/packs/hive-query/evals/triggers.json +50 -0
  42. package/agent-skills/packs/hive-query/references/root-mcp-workflow.md +39 -18
  43. package/agent-skills/packs/hive-security-risk/SKILL.md +110 -19
  44. package/agent-skills/packs/hive-security-risk/evals/evals.json +4 -2
  45. package/agent-skills/packs/hive-security-risk/evals/triggers.json +50 -0
  46. package/agent-skills/packs/hive-solana-analysis/SKILL.md +115 -19
  47. package/agent-skills/packs/hive-solana-analysis/evals/evals.json +4 -2
  48. package/agent-skills/packs/hive-solana-analysis/evals/triggers.json +50 -0
  49. package/agent-skills/packs/hive-stateful-monitoring/SKILL.md +92 -47
  50. package/agent-skills/packs/hive-stateful-monitoring/evals/evals.json +7 -2
  51. package/agent-skills/packs/hive-stateful-monitoring/evals/triggers.json +50 -0
  52. package/agent-skills/packs/hive-stateful-monitoring/references/b2b-subject-context.md +53 -0
  53. package/agent-skills/packs/hive-token-diligence/SKILL.md +119 -21
  54. package/agent-skills/packs/hive-token-diligence/evals/evals.json +6 -4
  55. package/agent-skills/packs/hive-token-diligence/evals/triggers.json +50 -0
  56. package/agent-skills/packs/hive-tool-discovery/SKILL.md +48 -19
  57. package/agent-skills/packs/hive-tool-discovery/evals/evals.json +17 -3
  58. package/agent-skills/packs/hive-tool-discovery/evals/triggers.json +50 -0
  59. package/agent-skills/packs/hive-tool-discovery/references/discovery-surfaces.md +31 -6
  60. package/agent-skills/packs/hive-wallet-investigation/SKILL.md +111 -18
  61. package/agent-skills/packs/hive-wallet-investigation/evals/evals.json +5 -3
  62. package/agent-skills/packs/hive-wallet-investigation/evals/triggers.json +50 -0
  63. package/agent-skills/references/agents-routing.md +17 -7
  64. package/agent-skills/scripts/validate-agent-skills-package.mjs +68 -8
  65. package/bin/hive-mcp.js +5 -5
  66. package/build/{alias-3OPMQF4X.js → alias-BKAVOYQV.js} +2 -2
  67. package/build/{api-client-EPF6FD7A.js → api-client-FTVDFW5V.js} +4 -4
  68. package/build/{auth-Q5Q24IRI.js → auth-EZFJ5RYB.js} +3 -3
  69. package/build/{browser-auth-VPF5LZMZ.js → browser-auth-OJSUNFBI.js} +2 -2
  70. package/build/{cache-T6KC5YEY.js → cache-TBDQ7QBU.js} +2 -2
  71. package/build/{chunk-POT2MBEK.js → chunk-6PC3HUAK.js} +10 -3
  72. package/build/{chunk-NP6NSOG2.js → chunk-725R3KLJ.js} +26 -3
  73. package/build/{chunk-GZPDEXO4.js → chunk-7GD2MFYI.js} +57 -6
  74. package/build/{chunk-ZXB53E7H.js → chunk-AEU43ACS.js} +31 -7
  75. package/build/chunk-EPF36Q3Z.js +71 -0
  76. package/build/chunk-I5Z6FZRL.js +178 -0
  77. package/build/{chunk-3WYWXTNN.js → chunk-ILVPOLA7.js} +12 -3
  78. package/build/{chunk-VBOKVQ74.js → chunk-L326MQZP.js} +6 -5
  79. package/build/{chunk-FRXMGRZQ.js → chunk-M6REON2I.js} +2 -2
  80. package/build/chunk-N32UIHBU.js +125 -0
  81. package/build/{chunk-7JWXBKEJ.js → chunk-Q7VBYLX7.js} +9 -2
  82. package/build/chunk-QDZ7MAVN.js +447 -0
  83. package/build/{chunk-ZTJVOWDQ.js → chunk-R6YZTFQL.js} +2 -0
  84. package/build/{chunk-YZ2PXBJK.js → chunk-RU6QOFHH.js} +6 -9
  85. package/build/{chunk-5XXI25JE.js → chunk-RUHO24SX.js} +16 -9
  86. package/build/{chunk-FH3YGSY5.js → chunk-TNQ7GJ6Q.js} +0 -59
  87. package/build/{chunk-JTUKQWIO.js → chunk-W2QL7LYI.js} +34807 -15070
  88. package/build/{chunk-ZCU7XQKF.js → chunk-ZXKFJQDE.js} +7 -1
  89. package/build/cli.js +3337 -3407
  90. package/build/{completion-46K674EL.js → completion-7KBW243H.js} +4 -4
  91. package/build/{config-XE6Q5P4I.js → config-KAEUX6RM.js} +23 -3
  92. package/build/{config-dir-MAWX5AUF.js → config-dir-5IH7MOOT.js} +2 -2
  93. package/build/{doctor-HGMQE6IN.js → doctor-ORDOCGLM.js} +12 -12
  94. package/build/{errors-J2PH3NLJ.js → errors-HGHUF575.js} +2 -2
  95. package/build/{format-5X2HIVDT.js → format-H7FOQSYY.js} +1 -1
  96. package/build/{init-JMDNM7ZZ.js → init-UCTCUYFA.js} +52 -8
  97. package/build/init-all-BVWW3JVK.js +408 -0
  98. package/build/mcpServer-RUEOTTF7.js +34 -0
  99. package/build/monitor-worker.js +296 -40
  100. package/build/{namespace-FSX2G3NM.js → namespace-L5DGCY7K.js} +2 -2
  101. package/build/{open-5A6ZQMGC.js → open-V2RNA3QT.js} +1 -1
  102. package/build/{output-V3D4YZ6U.js → output-ITGLBKIG.js} +2 -2
  103. package/build/release.json +8 -0
  104. package/build/{serve-AGCOXXFM.js → serve-DKLR2WQH.js} +3 -3
  105. package/build/server.js +4481 -2319
  106. package/build/{setup-RMETGJWK.js → setup-PTYFMTK5.js} +60 -55
  107. package/build/stdio.js +7 -6
  108. package/build/{telemetry-WCME5XEU.js → telemetry-HPLDYR7U.js} +5 -4
  109. package/build/{tools-KAB6QBZC.js → tools-I7GLWTV6.js} +15 -15
  110. package/build/{uninstall-FLJMBBSC.js → uninstall-SAOIPL6K.js} +19 -10
  111. package/build/{update-check-LNZQK3XA.js → update-check-IEXPOYYR.js} +4 -4
  112. package/build/{upgrade-DTUIHVPS.js → upgrade-J4HIGCKE.js} +5 -5
  113. package/build/{version-I6HDAF4L.js → version-Z4HJL4VV.js} +4 -2
  114. package/build/{watch-YNN255QX.js → watch-WVR4CGCD.js} +8 -7
  115. package/package.json +71 -35
  116. package/agent-skills/packs/hive-defi-research/references/workflow.md +0 -41
  117. package/agent-skills/packs/hive-dex-pool-analysis/references/workflow.md +0 -42
  118. package/agent-skills/packs/hive-market-research/references/workflow.md +0 -47
  119. package/agent-skills/packs/hive-network-infrastructure/references/workflow.md +0 -41
  120. package/agent-skills/packs/hive-nft-research/references/workflow.md +0 -42
  121. package/agent-skills/packs/hive-prediction-markets/references/workflow.md +0 -42
  122. package/agent-skills/packs/hive-security-risk/references/workflow.md +0 -46
  123. package/agent-skills/packs/hive-solana-analysis/references/workflow.md +0 -42
  124. package/agent-skills/packs/hive-token-diligence/references/workflow.md +0 -45
  125. package/agent-skills/packs/hive-wallet-investigation/references/workflow.md +0 -45
  126. package/build/chunk-4F5CI6LX.js +0 -340
  127. package/build/chunk-CEWCB5YS.js +0 -71
  128. package/build/chunk-IZPAMRHP.js +0 -43
  129. package/build/init-all-5SKNV75X.js +0 -273
  130. package/build/mcpServer-5TKKSKJM.js +0 -21
@@ -1,340 +0,0 @@
1
- import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
2
- import {
3
- resolveApiKey,
4
- resolveApiUrl
5
- } from "./chunk-POT2MBEK.js";
6
-
7
- // src/cli/config.ts
8
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
9
- import { homedir, platform } from "os";
10
- import { dirname, join } from "path";
11
- var DEFAULT_URL = "https://mcp.hiveintelligence.xyz";
12
- var SERVER_NAME = "hive";
13
- function getServerUrl() {
14
- return resolveApiUrl() || DEFAULT_URL;
15
- }
16
- function getApiKey() {
17
- return resolveApiKey() || "YOUR_HIVE_API_KEY";
18
- }
19
- function authHeader(key) {
20
- return { Authorization: `Bearer ${key}` };
21
- }
22
- function configClaudeDesktop() {
23
- const url = getServerUrl();
24
- const key = getApiKey();
25
- const config = {
26
- [SERVER_NAME]: {
27
- url: `${url}/mcp`,
28
- headers: authHeader(key)
29
- }
30
- };
31
- const p = getClaudeDesktopConfigPath();
32
- console.log(
33
- '\nAdd this to your claude_desktop_config.json under "mcpServers":\n'
34
- );
35
- console.log(`Config file: ${p}
36
- `);
37
- console.log(JSON.stringify(config, null, 2));
38
- if (key === "YOUR_HIVE_API_KEY") {
39
- console.log(
40
- "\nReplace YOUR_HIVE_API_KEY with your actual key from: hive auth login"
41
- );
42
- }
43
- }
44
- function configCursor() {
45
- const url = getServerUrl();
46
- const key = getApiKey();
47
- const config = {
48
- mcpServers: {
49
- [SERVER_NAME]: {
50
- url: `${url}/mcp`,
51
- headers: authHeader(key)
52
- }
53
- }
54
- };
55
- console.log("\nAdd to .cursor/mcp.json:\n");
56
- console.log(JSON.stringify(config, null, 2));
57
- }
58
- function configVscode() {
59
- const url = getServerUrl();
60
- const config = {
61
- inputs: [
62
- {
63
- type: "promptString",
64
- id: "hive-api-key",
65
- description: "Hive API Key (hive_live_...)",
66
- password: true
67
- }
68
- ],
69
- servers: {
70
- [SERVER_NAME]: {
71
- type: "http",
72
- url: `${url}/mcp`,
73
- headers: { Authorization: "Bearer ${input:hive-api-key}" }
74
- }
75
- }
76
- };
77
- console.log("\nAdd to .vscode/mcp.json:\n");
78
- console.log(JSON.stringify(config, null, 2));
79
- }
80
- function configClaudeCode() {
81
- const url = getServerUrl();
82
- const key = getApiKey();
83
- console.log("\nRun this command:\n");
84
- console.log(
85
- `claude mcp add --transport http --header "Authorization: Bearer ${key}" ${SERVER_NAME} ${url}/mcp`
86
- );
87
- }
88
- function configHttpUrl(url) {
89
- console.log(`
90
- Remote MCP server URL: ${url}/mcp`);
91
- console.log("\nFor Claude Code:");
92
- console.log(
93
- ` claude mcp add --transport http --header "Authorization: Bearer YOUR_HIVE_API_KEY" ${SERVER_NAME} ${url}/mcp`
94
- );
95
- console.log("\nFor Cursor / Claude Desktop:");
96
- console.log(
97
- JSON.stringify(
98
- {
99
- [SERVER_NAME]: {
100
- url: `${url}/mcp`,
101
- headers: authHeader("YOUR_HIVE_API_KEY")
102
- }
103
- },
104
- null,
105
- 2
106
- )
107
- );
108
- }
109
- function readJsonSafe(filePath) {
110
- if (!existsSync(filePath)) return {};
111
- const raw = readFileSync(filePath, "utf-8");
112
- try {
113
- return JSON.parse(raw);
114
- } catch {
115
- throw new Error(
116
- `Config file at ${filePath} contains invalid JSON. Fix it manually before running setup.`
117
- );
118
- }
119
- }
120
- function writeJsonSafe(filePath, data) {
121
- const dir = dirname(filePath);
122
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
123
- writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n", "utf-8");
124
- }
125
- function getClaudeDesktopConfigPath() {
126
- return platform() === "darwin" ? join(
127
- homedir(),
128
- "Library",
129
- "Application Support",
130
- "Claude",
131
- "claude_desktop_config.json"
132
- ) : platform() === "win32" ? join(
133
- homedir(),
134
- "AppData",
135
- "Roaming",
136
- "Claude",
137
- "claude_desktop_config.json"
138
- ) : join(homedir(), ".config", "Claude", "claude_desktop_config.json");
139
- }
140
- function getCursorConfigPath() {
141
- return join(homedir(), ".cursor", "mcp.json");
142
- }
143
- function getVscodeConfigPath() {
144
- return join(homedir(), ".vscode", "mcp.json");
145
- }
146
- function getWindsurfMcpConfigPath() {
147
- return join(homedir(), ".codeium", "windsurf", "mcp_config.json");
148
- }
149
- function getGeminiCliSettingsPath() {
150
- return join(homedir(), ".gemini", "settings.json");
151
- }
152
- function getClaudeCodeUserConfigPath() {
153
- return join(homedir(), ".claude.json");
154
- }
155
- function writeClaudeDesktopConfig() {
156
- const url = getServerUrl();
157
- const key = getApiKey();
158
- const p = getClaudeDesktopConfigPath();
159
- if (key === "YOUR_HIVE_API_KEY") {
160
- return { path: p, written: false };
161
- }
162
- const existing = readJsonSafe(p);
163
- const mcpServers = existing.mcpServers || {};
164
- mcpServers[SERVER_NAME] = {
165
- url: `${url}/mcp`,
166
- headers: authHeader(key)
167
- };
168
- existing.mcpServers = mcpServers;
169
- writeJsonSafe(p, existing);
170
- return { path: p, written: true };
171
- }
172
- function writeCursorConfig() {
173
- const url = getServerUrl();
174
- const key = getApiKey();
175
- const p = getCursorConfigPath();
176
- if (key === "YOUR_HIVE_API_KEY") {
177
- return { path: p, written: false };
178
- }
179
- const existing = readJsonSafe(p);
180
- const mcpServers = existing.mcpServers || {};
181
- mcpServers[SERVER_NAME] = {
182
- url: `${url}/mcp`,
183
- headers: authHeader(key)
184
- };
185
- existing.mcpServers = mcpServers;
186
- writeJsonSafe(p, existing);
187
- return { path: p, written: true };
188
- }
189
- function writeVscodeConfig() {
190
- const url = getServerUrl();
191
- const key = getApiKey();
192
- const p = getVscodeConfigPath();
193
- if (key === "YOUR_HIVE_API_KEY") {
194
- return { path: p, written: false };
195
- }
196
- const existing = readJsonSafe(p);
197
- const servers = existing.servers || {};
198
- servers[SERVER_NAME] = {
199
- type: "http",
200
- url: `${url}/mcp`,
201
- headers: authHeader(key)
202
- };
203
- existing.servers = servers;
204
- writeJsonSafe(p, existing);
205
- return { path: p, written: true };
206
- }
207
- function writeClaudeCodeConfig() {
208
- const url = getServerUrl();
209
- const key = getApiKey();
210
- return {
211
- command: `claude mcp add --transport http --header "Authorization: Bearer ${key}" ${SERVER_NAME} ${url}/mcp`
212
- };
213
- }
214
- function writeClaudeCodeUserConfig() {
215
- const url = getServerUrl();
216
- const key = getApiKey();
217
- const p = getClaudeCodeUserConfigPath();
218
- if (key === "YOUR_HIVE_API_KEY") {
219
- return { path: p, written: false };
220
- }
221
- const existing = readJsonSafe(p);
222
- const mcpServers = existing.mcpServers || {};
223
- mcpServers[SERVER_NAME] = {
224
- type: "http",
225
- url: `${url}/mcp`,
226
- headers: authHeader(key)
227
- };
228
- existing.mcpServers = mcpServers;
229
- writeJsonSafe(p, existing);
230
- return { path: p, written: true };
231
- }
232
- function writeWindsurfConfig() {
233
- const url = getServerUrl();
234
- const key = getApiKey();
235
- const p = getWindsurfMcpConfigPath();
236
- if (key === "YOUR_HIVE_API_KEY") {
237
- return { path: p, written: false };
238
- }
239
- const existing = readJsonSafe(p);
240
- const mcpServers = existing.mcpServers || {};
241
- mcpServers[SERVER_NAME] = {
242
- url: `${url}/mcp`,
243
- headers: authHeader(key)
244
- };
245
- existing.mcpServers = mcpServers;
246
- writeJsonSafe(p, existing);
247
- return { path: p, written: true };
248
- }
249
- function writeGeminiCliConfig() {
250
- const url = getServerUrl();
251
- const key = getApiKey();
252
- const p = getGeminiCliSettingsPath();
253
- if (key === "YOUR_HIVE_API_KEY") {
254
- return { path: p, written: false };
255
- }
256
- const existing = readJsonSafe(p);
257
- const mcpServers = existing.mcpServers || {};
258
- mcpServers[SERVER_NAME] = {
259
- url: `${url}/mcp`,
260
- headers: authHeader(key)
261
- };
262
- existing.mcpServers = mcpServers;
263
- writeJsonSafe(p, existing);
264
- return { path: p, written: true };
265
- }
266
- function printChatGptDesktopInstructions() {
267
- const url = getServerUrl();
268
- const key = getApiKey();
269
- const keyLabel = key === "YOUR_HIVE_API_KEY" ? "<YOUR_HIVE_API_KEY>" : key;
270
- return {
271
- manual: true,
272
- steps: [
273
- "Recommended: use OpenAI Responses API with a remote MCP tool",
274
- `server_url: ${url}/mcp`,
275
- `authorization: ${keyLabel}`,
276
- "Direct ChatGPT app connectors may require OAuth/CIMD; Hive has not shipped OAuth yet.",
277
- "For ChatGPT app testing, put an OAuth-compatible proxy in front of Hive and inject the Hive key server-side."
278
- ]
279
- };
280
- }
281
- function removeServerEntry(filePath, serversKey) {
282
- if (!existsSync(filePath)) return { removed: false, path: filePath };
283
- const existing = readJsonSafe(filePath);
284
- const servers = existing[serversKey] || {};
285
- if (!(SERVER_NAME in servers)) return { removed: false, path: filePath };
286
- delete servers[SERVER_NAME];
287
- if (Object.keys(servers).length === 0) {
288
- delete existing[serversKey];
289
- } else {
290
- existing[serversKey] = servers;
291
- }
292
- writeJsonSafe(filePath, existing);
293
- return { removed: true, path: filePath };
294
- }
295
- function removeClaudeDesktopConfig() {
296
- return removeServerEntry(getClaudeDesktopConfigPath(), "mcpServers");
297
- }
298
- function removeCursorConfig() {
299
- return removeServerEntry(getCursorConfigPath(), "mcpServers");
300
- }
301
- function removeVscodeConfig() {
302
- return removeServerEntry(getVscodeConfigPath(), "servers");
303
- }
304
- function removeClaudeCodeUserConfig() {
305
- return removeServerEntry(getClaudeCodeUserConfigPath(), "mcpServers");
306
- }
307
- function removeWindsurfConfig() {
308
- return removeServerEntry(getWindsurfMcpConfigPath(), "mcpServers");
309
- }
310
- function removeGeminiCliConfig() {
311
- return removeServerEntry(getGeminiCliSettingsPath(), "mcpServers");
312
- }
313
-
314
- export {
315
- configClaudeDesktop,
316
- configCursor,
317
- configVscode,
318
- configClaudeCode,
319
- configHttpUrl,
320
- getClaudeDesktopConfigPath,
321
- getCursorConfigPath,
322
- getVscodeConfigPath,
323
- getWindsurfMcpConfigPath,
324
- getGeminiCliSettingsPath,
325
- getClaudeCodeUserConfigPath,
326
- writeClaudeDesktopConfig,
327
- writeCursorConfig,
328
- writeVscodeConfig,
329
- writeClaudeCodeConfig,
330
- writeClaudeCodeUserConfig,
331
- writeWindsurfConfig,
332
- writeGeminiCliConfig,
333
- printChatGptDesktopInstructions,
334
- removeClaudeDesktopConfig,
335
- removeCursorConfig,
336
- removeVscodeConfig,
337
- removeClaudeCodeUserConfig,
338
- removeWindsurfConfig,
339
- removeGeminiCliConfig
340
- };
@@ -1,71 +0,0 @@
1
- import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
2
- import {
3
- createToolNotFoundResult,
4
- executeEndpoint,
5
- getAllWrappedEndpoints,
6
- getSharedClients,
7
- resolveEndpoint,
8
- secureLogger
9
- } from "./chunk-JTUKQWIO.js";
10
-
11
- // src/services/tool-execution.ts
12
- async function executeToolByName(toolName, args) {
13
- const allEndpoints = getAllWrappedEndpoints();
14
- const lookup = resolveEndpoint(allEndpoints, toolName);
15
- if (!lookup.ok) {
16
- const result2 = createToolNotFoundResult(toolName);
17
- secureLogger.toolCall(toolName, false, result2.durationMs, {
18
- transport: "rest",
19
- runtimeStatus: "failing",
20
- errorClass: "not_found"
21
- });
22
- return {
23
- ok: false,
24
- error: result2.error,
25
- durationMs: result2.durationMs,
26
- meta: result2.hive
27
- };
28
- }
29
- const result = await executeEndpoint(lookup.endpoint, args, {
30
- transport: "rest",
31
- clients: getSharedClients()
32
- });
33
- if (result.validationErrors) {
34
- return {
35
- ok: false,
36
- error: result.error,
37
- validationErrors: result.validationErrors,
38
- durationMs: result.durationMs,
39
- meta: result.hive
40
- };
41
- }
42
- if (result.ok) {
43
- return {
44
- ok: true,
45
- data: result.data,
46
- durationMs: result.durationMs,
47
- meta: result.hive
48
- };
49
- }
50
- if (result.error?.code === "PROVIDER_UNAVAILABLE") {
51
- return {
52
- ok: false,
53
- error: result.error,
54
- durationMs: result.durationMs,
55
- meta: result.hive
56
- };
57
- }
58
- if (result.error?.code === "INTERNAL_ERROR") {
59
- secureLogger.error(`[tool-execution] ${toolName} threw`, result.error, {});
60
- }
61
- return {
62
- ok: false,
63
- error: result.error,
64
- durationMs: result.durationMs,
65
- meta: result.hive
66
- };
67
- }
68
-
69
- export {
70
- executeToolByName
71
- };
@@ -1,43 +0,0 @@
1
- import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
2
- import {
3
- executeRemoteTool
4
- } from "./chunk-7JWXBKEJ.js";
5
- import {
6
- trackCommand
7
- } from "./chunk-YZ2PXBJK.js";
8
- import {
9
- debug,
10
- shouldOutputJson,
11
- writeOutput
12
- } from "./chunk-NP6NSOG2.js";
13
-
14
- // src/cli/execute.ts
15
- import ora from "ora";
16
- async function executeTool(toolName, args, timeoutMs = 3e4) {
17
- debug(`Executing ${toolName} remotely`);
18
- const showSpinner = !shouldOutputJson() && !!process.stderr.isTTY;
19
- const spinner = showSpinner ? ora({ text: `Calling ${toolName}...`, stream: process.stderr }).start() : null;
20
- const startMs = Date.now();
21
- let response;
22
- try {
23
- response = await executeRemoteTool(toolName, args, timeoutMs);
24
- spinner?.succeed(`${toolName} (${Date.now() - startMs}ms)`);
25
- } catch (err) {
26
- spinner?.fail(`${toolName} failed (${Date.now() - startMs}ms)`);
27
- throw err;
28
- }
29
- trackCommand(
30
- toolName,
31
- Date.now() - startMs,
32
- response.ok ? void 0 : response.error?.code
33
- );
34
- await writeOutput(response);
35
- if (!response.ok) {
36
- const exitCode = response.error?.code === "TOOL_NOT_FOUND" ? 3 : response.error?.code === "PROVIDER_UNAVAILABLE" ? 5 : response.error?.code === "RATE_LIMITED" ? 6 : response.error?.code === "TIMEOUT" ? 124 : 4;
37
- process.exit(exitCode);
38
- }
39
- }
40
-
41
- export {
42
- executeTool
43
- };