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.
- package/README.md +182 -73
- package/agent-skills/.claude-plugin/plugin.json +4 -4
- package/agent-skills/.mcp.json +1 -4
- package/agent-skills/README.md +16 -10
- package/agent-skills/SKILL.md +30 -12
- package/agent-skills/package.json +1 -1
- package/agent-skills/packs/hive-build/SKILL.md +47 -19
- package/agent-skills/packs/hive-build/evals/evals.json +16 -3
- package/agent-skills/packs/hive-build/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-build-onboarding/SKILL.md +27 -34
- package/agent-skills/packs/hive-build-onboarding/evals/evals.json +1 -1
- package/agent-skills/packs/hive-build-onboarding/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-cli/SKILL.md +33 -35
- package/agent-skills/packs/hive-cli/evals/evals.json +1 -1
- package/agent-skills/packs/hive-cli/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-defi-research/SKILL.md +105 -19
- package/agent-skills/packs/hive-defi-research/evals/evals.json +6 -3
- package/agent-skills/packs/hive-defi-research/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-dex-pool-analysis/SKILL.md +106 -16
- package/agent-skills/packs/hive-dex-pool-analysis/evals/evals.json +5 -3
- package/agent-skills/packs/hive-dex-pool-analysis/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-market-research/SKILL.md +130 -21
- package/agent-skills/packs/hive-market-research/evals/evals.json +15 -2
- package/agent-skills/packs/hive-market-research/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-mcp/SKILL.md +69 -47
- package/agent-skills/packs/hive-mcp/evals/evals.json +3 -2
- package/agent-skills/packs/hive-mcp/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-mcp/references/client-install-matrix.md +62 -35
- package/agent-skills/packs/hive-mcp/references/clients.md +81 -68
- package/agent-skills/packs/hive-network-infrastructure/SKILL.md +105 -20
- package/agent-skills/packs/hive-network-infrastructure/evals/evals.json +4 -2
- package/agent-skills/packs/hive-network-infrastructure/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-nft-research/SKILL.md +105 -18
- package/agent-skills/packs/hive-nft-research/evals/evals.json +4 -2
- package/agent-skills/packs/hive-nft-research/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-prediction-markets/SKILL.md +108 -21
- package/agent-skills/packs/hive-prediction-markets/evals/evals.json +4 -2
- package/agent-skills/packs/hive-prediction-markets/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-query/SKILL.md +79 -33
- package/agent-skills/packs/hive-query/evals/evals.json +7 -5
- package/agent-skills/packs/hive-query/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-query/references/root-mcp-workflow.md +39 -18
- package/agent-skills/packs/hive-security-risk/SKILL.md +110 -19
- package/agent-skills/packs/hive-security-risk/evals/evals.json +4 -2
- package/agent-skills/packs/hive-security-risk/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-solana-analysis/SKILL.md +115 -19
- package/agent-skills/packs/hive-solana-analysis/evals/evals.json +4 -2
- package/agent-skills/packs/hive-solana-analysis/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-stateful-monitoring/SKILL.md +92 -47
- package/agent-skills/packs/hive-stateful-monitoring/evals/evals.json +7 -2
- package/agent-skills/packs/hive-stateful-monitoring/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-stateful-monitoring/references/b2b-subject-context.md +53 -0
- package/agent-skills/packs/hive-token-diligence/SKILL.md +119 -21
- package/agent-skills/packs/hive-token-diligence/evals/evals.json +6 -4
- package/agent-skills/packs/hive-token-diligence/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-tool-discovery/SKILL.md +48 -19
- package/agent-skills/packs/hive-tool-discovery/evals/evals.json +17 -3
- package/agent-skills/packs/hive-tool-discovery/evals/triggers.json +50 -0
- package/agent-skills/packs/hive-tool-discovery/references/discovery-surfaces.md +31 -6
- package/agent-skills/packs/hive-wallet-investigation/SKILL.md +111 -18
- package/agent-skills/packs/hive-wallet-investigation/evals/evals.json +5 -3
- package/agent-skills/packs/hive-wallet-investigation/evals/triggers.json +50 -0
- package/agent-skills/references/agents-routing.md +17 -7
- package/agent-skills/scripts/validate-agent-skills-package.mjs +68 -8
- package/bin/hive-mcp.js +5 -5
- package/build/{alias-3OPMQF4X.js → alias-BKAVOYQV.js} +2 -2
- package/build/{api-client-EPF6FD7A.js → api-client-FTVDFW5V.js} +4 -4
- package/build/{auth-Q5Q24IRI.js → auth-EZFJ5RYB.js} +3 -3
- package/build/{browser-auth-VPF5LZMZ.js → browser-auth-OJSUNFBI.js} +2 -2
- package/build/{cache-T6KC5YEY.js → cache-TBDQ7QBU.js} +2 -2
- package/build/{chunk-POT2MBEK.js → chunk-6PC3HUAK.js} +10 -3
- package/build/{chunk-NP6NSOG2.js → chunk-725R3KLJ.js} +26 -3
- package/build/{chunk-GZPDEXO4.js → chunk-7GD2MFYI.js} +57 -6
- package/build/{chunk-ZXB53E7H.js → chunk-AEU43ACS.js} +31 -7
- package/build/chunk-EPF36Q3Z.js +71 -0
- package/build/chunk-I5Z6FZRL.js +178 -0
- package/build/{chunk-3WYWXTNN.js → chunk-ILVPOLA7.js} +12 -3
- package/build/{chunk-VBOKVQ74.js → chunk-L326MQZP.js} +6 -5
- package/build/{chunk-FRXMGRZQ.js → chunk-M6REON2I.js} +2 -2
- package/build/chunk-N32UIHBU.js +125 -0
- package/build/{chunk-7JWXBKEJ.js → chunk-Q7VBYLX7.js} +9 -2
- package/build/chunk-QDZ7MAVN.js +447 -0
- package/build/{chunk-ZTJVOWDQ.js → chunk-R6YZTFQL.js} +2 -0
- package/build/{chunk-YZ2PXBJK.js → chunk-RU6QOFHH.js} +6 -9
- package/build/{chunk-5XXI25JE.js → chunk-RUHO24SX.js} +16 -9
- package/build/{chunk-FH3YGSY5.js → chunk-TNQ7GJ6Q.js} +0 -59
- package/build/{chunk-JTUKQWIO.js → chunk-W2QL7LYI.js} +34807 -15070
- package/build/{chunk-ZCU7XQKF.js → chunk-ZXKFJQDE.js} +7 -1
- package/build/cli.js +3337 -3407
- package/build/{completion-46K674EL.js → completion-7KBW243H.js} +4 -4
- package/build/{config-XE6Q5P4I.js → config-KAEUX6RM.js} +23 -3
- package/build/{config-dir-MAWX5AUF.js → config-dir-5IH7MOOT.js} +2 -2
- package/build/{doctor-HGMQE6IN.js → doctor-ORDOCGLM.js} +12 -12
- package/build/{errors-J2PH3NLJ.js → errors-HGHUF575.js} +2 -2
- package/build/{format-5X2HIVDT.js → format-H7FOQSYY.js} +1 -1
- package/build/{init-JMDNM7ZZ.js → init-UCTCUYFA.js} +52 -8
- package/build/init-all-BVWW3JVK.js +408 -0
- package/build/mcpServer-RUEOTTF7.js +34 -0
- package/build/monitor-worker.js +296 -40
- package/build/{namespace-FSX2G3NM.js → namespace-L5DGCY7K.js} +2 -2
- package/build/{open-5A6ZQMGC.js → open-V2RNA3QT.js} +1 -1
- package/build/{output-V3D4YZ6U.js → output-ITGLBKIG.js} +2 -2
- package/build/release.json +8 -0
- package/build/{serve-AGCOXXFM.js → serve-DKLR2WQH.js} +3 -3
- package/build/server.js +4481 -2319
- package/build/{setup-RMETGJWK.js → setup-PTYFMTK5.js} +60 -55
- package/build/stdio.js +7 -6
- package/build/{telemetry-WCME5XEU.js → telemetry-HPLDYR7U.js} +5 -4
- package/build/{tools-KAB6QBZC.js → tools-I7GLWTV6.js} +15 -15
- package/build/{uninstall-FLJMBBSC.js → uninstall-SAOIPL6K.js} +19 -10
- package/build/{update-check-LNZQK3XA.js → update-check-IEXPOYYR.js} +4 -4
- package/build/{upgrade-DTUIHVPS.js → upgrade-J4HIGCKE.js} +5 -5
- package/build/{version-I6HDAF4L.js → version-Z4HJL4VV.js} +4 -2
- package/build/{watch-YNN255QX.js → watch-WVR4CGCD.js} +8 -7
- package/package.json +71 -35
- package/agent-skills/packs/hive-defi-research/references/workflow.md +0 -41
- package/agent-skills/packs/hive-dex-pool-analysis/references/workflow.md +0 -42
- package/agent-skills/packs/hive-market-research/references/workflow.md +0 -47
- package/agent-skills/packs/hive-network-infrastructure/references/workflow.md +0 -41
- package/agent-skills/packs/hive-nft-research/references/workflow.md +0 -42
- package/agent-skills/packs/hive-prediction-markets/references/workflow.md +0 -42
- package/agent-skills/packs/hive-security-risk/references/workflow.md +0 -46
- package/agent-skills/packs/hive-solana-analysis/references/workflow.md +0 -42
- package/agent-skills/packs/hive-token-diligence/references/workflow.md +0 -45
- package/agent-skills/packs/hive-wallet-investigation/references/workflow.md +0 -45
- package/build/chunk-4F5CI6LX.js +0 -340
- package/build/chunk-CEWCB5YS.js +0 -71
- package/build/chunk-IZPAMRHP.js +0 -43
- package/build/init-all-5SKNV75X.js +0 -273
- package/build/mcpServer-5TKKSKJM.js +0 -21
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getClaudeDesktopConfigPath,
|
|
4
|
+
getCodexConfigPath,
|
|
4
5
|
getCursorConfigPath,
|
|
5
6
|
getVscodeConfigPath
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QDZ7MAVN.js";
|
|
7
8
|
import {
|
|
8
9
|
HIVE_AGENT_SKILLS
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-L326MQZP.js";
|
|
10
11
|
|
|
11
12
|
// src/cli/detect-clients.ts
|
|
12
13
|
import { existsSync } from "fs";
|
|
@@ -24,6 +25,9 @@ function getGeminiCliConfigPath() {
|
|
|
24
25
|
function detectClaudeCode() {
|
|
25
26
|
return existsSync(getClaudeCodeConfigPath()) || existsSync(join(homedir(), ".claude"));
|
|
26
27
|
}
|
|
28
|
+
function detectCodex() {
|
|
29
|
+
return existsSync(join(homedir(), ".codex"));
|
|
30
|
+
}
|
|
27
31
|
function detectClaudeDesktop() {
|
|
28
32
|
const configPath = getClaudeDesktopConfigPath();
|
|
29
33
|
if (existsSync(configPath)) return true;
|
|
@@ -61,6 +65,7 @@ function detectGeminiCli() {
|
|
|
61
65
|
function detectClients() {
|
|
62
66
|
const claudeCode = detectClaudeCode();
|
|
63
67
|
const claudeDesktop = detectClaudeDesktop();
|
|
68
|
+
const codex = detectCodex();
|
|
64
69
|
const cursor = detectCursor();
|
|
65
70
|
const vscode = detectVscode();
|
|
66
71
|
const windsurf = detectWindsurf();
|
|
@@ -79,8 +84,16 @@ function detectClients() {
|
|
|
79
84
|
name: "Claude Desktop",
|
|
80
85
|
configPath: getClaudeDesktopConfigPath(),
|
|
81
86
|
detected: claudeDesktop,
|
|
87
|
+
programmable: false,
|
|
88
|
+
hint: claudeDesktop ? "Add the hosted endpoint in Settings > Connectors; the local config file is stdio-only" : "Claude Desktop application directory not found"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "codex",
|
|
92
|
+
name: "OpenAI Codex",
|
|
93
|
+
configPath: getCodexConfigPath(),
|
|
94
|
+
detected: codex,
|
|
82
95
|
programmable: true,
|
|
83
|
-
hint:
|
|
96
|
+
hint: codex ? "Hive will use the official Codex MCP CLI and native OAuth login" : "~/.codex not found"
|
|
84
97
|
},
|
|
85
98
|
{
|
|
86
99
|
id: "cursor",
|
|
@@ -96,7 +109,7 @@ function detectClients() {
|
|
|
96
109
|
configPath: getVscodeConfigPath(),
|
|
97
110
|
detected: vscode,
|
|
98
111
|
programmable: true,
|
|
99
|
-
hint: vscode ?
|
|
112
|
+
hint: vscode ? "Hive will use the official code --add-mcp user-profile installer" : "VS Code user data dir not found"
|
|
100
113
|
},
|
|
101
114
|
{
|
|
102
115
|
id: "windsurf",
|
|
@@ -121,7 +134,15 @@ function detectClients() {
|
|
|
121
134
|
detected: false,
|
|
122
135
|
// No reliable filesystem signal — always print instructions
|
|
123
136
|
programmable: false,
|
|
124
|
-
hint: "
|
|
137
|
+
hint: "Create the Hive app manually in ChatGPT Settings > Apps, then complete OAuth."
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "grok",
|
|
141
|
+
name: "Grok",
|
|
142
|
+
configPath: "https://grok.com/connectors",
|
|
143
|
+
detected: false,
|
|
144
|
+
programmable: false,
|
|
145
|
+
hint: "Add Hive manually at grok.com/connectors, then complete OAuth."
|
|
125
146
|
}
|
|
126
147
|
];
|
|
127
148
|
}
|
|
@@ -143,17 +164,20 @@ function getClientSkillsDir(client) {
|
|
|
143
164
|
switch (client) {
|
|
144
165
|
case "claude-code":
|
|
145
166
|
return join2(homedir2(), ".claude", "skills");
|
|
167
|
+
case "codex":
|
|
168
|
+
return join2(homedir2(), ".codex", "skills");
|
|
146
169
|
case "cursor":
|
|
147
170
|
return join2(homedir2(), ".cursor", "skills");
|
|
148
171
|
case "vscode":
|
|
149
|
-
return
|
|
172
|
+
return join2(homedir2(), ".copilot", "skills");
|
|
150
173
|
case "windsurf":
|
|
151
174
|
return null;
|
|
152
175
|
case "gemini-cli":
|
|
153
|
-
return
|
|
176
|
+
return join2(homedir2(), ".gemini", "skills");
|
|
154
177
|
case "claude-desktop":
|
|
155
178
|
return join2(homedir2(), ".claude", "skills");
|
|
156
179
|
case "chatgpt-desktop":
|
|
180
|
+
case "grok":
|
|
157
181
|
return null;
|
|
158
182
|
}
|
|
159
183
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/telemetryContract.ts
|
|
4
|
+
var TOOL_CALL_ANALYTICS_FIELD_DISCLOSURES = {
|
|
5
|
+
ts: "server-side event timestamp",
|
|
6
|
+
toolName: "server-owned tool name; arguments are not included",
|
|
7
|
+
success: "whether the call returned a non-error result",
|
|
8
|
+
durationMs: "call duration in milliseconds",
|
|
9
|
+
transport: "server transport class (mcp | rest | health | dynamic)",
|
|
10
|
+
provider: "server-owned data-provider label",
|
|
11
|
+
category: "server-owned Hive tool category",
|
|
12
|
+
receiptId: "random per-call runtime receipt UUID",
|
|
13
|
+
requestId: "random per-request correlation id",
|
|
14
|
+
principalHash: "HMAC-SHA256 of the principal id keyed by HIVE_ANALYTICS_HMAC_KEY; null for keyless traffic",
|
|
15
|
+
authLane: "bounded authentication lane or null when unknown",
|
|
16
|
+
clientName: "bounded low-cardinality MCP client profile ('unknown' allowed)",
|
|
17
|
+
isMaterial: "billable non-discovery call per src/mcpBilling.ts",
|
|
18
|
+
isInternal: "canary / monitor / founder-and-staff traffic, excluded from all metrics"
|
|
19
|
+
};
|
|
20
|
+
var TOOL_CALL_ANALYTICS_PAYLOAD_FIELDS = Object.freeze(
|
|
21
|
+
Object.keys(TOOL_CALL_ANALYTICS_FIELD_DISCLOSURES)
|
|
22
|
+
);
|
|
23
|
+
var OAUTH_FIRST_MATERIAL_RECEIPT_EVENT = "mcp_first_material_receipt";
|
|
24
|
+
var OAUTH_FIRST_MATERIAL_RECEIPT_FIELD_DISCLOSURES = {
|
|
25
|
+
connectionIdHash: "stable SHA-256 digest of the OAuth account and client pair",
|
|
26
|
+
userIdHash: "stable SHA-256 digest of the OAuth account ID",
|
|
27
|
+
oauthClientIdHash: "stable SHA-256 digest of the OAuth client ID",
|
|
28
|
+
clientProfile: "bounded low-cardinality MCP client profile",
|
|
29
|
+
clientVersion: "bounded client software version or unknown",
|
|
30
|
+
toolName: "server-owned material tool name; arguments are not included",
|
|
31
|
+
provider: "server-owned data-provider label",
|
|
32
|
+
category: "server-owned Hive tool category",
|
|
33
|
+
runtimeStatus: "runtime receipt status",
|
|
34
|
+
cacheStatus: "runtime receipt cache status",
|
|
35
|
+
source: "runtime receipt source class",
|
|
36
|
+
serverVersion: "Hive server version",
|
|
37
|
+
receiptVersion: "Hive runtime-receipt schema version",
|
|
38
|
+
secondsSinceConsent: "bounded whole seconds from OAuth consent approval to first receipt when known",
|
|
39
|
+
authLane: "bounded authentication lane (oauth | api_key) that produced the activation"
|
|
40
|
+
};
|
|
41
|
+
var OAUTH_FIRST_MATERIAL_RECEIPT_PAYLOAD_FIELDS = Object.freeze(
|
|
42
|
+
Object.keys(OAUTH_FIRST_MATERIAL_RECEIPT_FIELD_DISCLOSURES)
|
|
43
|
+
);
|
|
44
|
+
var CLI_TELEMETRY_PRIVACY_POLICY_URL = "https://www.hiveintelligence.xyz/privacy-policy";
|
|
45
|
+
var CLI_TELEMETRY_FIELD_DISCLOSURES = {
|
|
46
|
+
command: "command name only (command arguments are not included)",
|
|
47
|
+
durationMs: "command duration in milliseconds",
|
|
48
|
+
errorCode: "bounded error category when a command fails; omitted otherwise",
|
|
49
|
+
cliVersion: "Hive CLI version",
|
|
50
|
+
os: "operating system name and release",
|
|
51
|
+
nodeVersion: "Node.js version"
|
|
52
|
+
};
|
|
53
|
+
var CLI_TELEMETRY_PAYLOAD_FIELDS = Object.freeze(
|
|
54
|
+
Object.keys(CLI_TELEMETRY_FIELD_DISCLOSURES)
|
|
55
|
+
);
|
|
56
|
+
var CLI_TELEMETRY_CONSENT_COPY = [
|
|
57
|
+
"Telemetry enabled. Thank you for helping improve Hive CLI.",
|
|
58
|
+
"The telemetry payload is limited to exactly these fields:",
|
|
59
|
+
...CLI_TELEMETRY_PAYLOAD_FIELDS.map(
|
|
60
|
+
(field) => ` - ${field}: ${CLI_TELEMETRY_FIELD_DISCLOSURES[field]}`
|
|
61
|
+
),
|
|
62
|
+
"The analytics relay assigns a new random identifier to each event. It does not derive this telemetry identifier from your IP address or User-Agent.",
|
|
63
|
+
"API keys, command arguments, prompts, wallet addresses, and request or response data are never included in telemetry events.",
|
|
64
|
+
`Privacy policy: ${CLI_TELEMETRY_PRIVACY_POLICY_URL}`,
|
|
65
|
+
""
|
|
66
|
+
].join("\n");
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
OAUTH_FIRST_MATERIAL_RECEIPT_EVENT,
|
|
70
|
+
CLI_TELEMETRY_CONSENT_COPY
|
|
71
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
createToolNotFoundResult,
|
|
4
|
+
executeEndpoint,
|
|
5
|
+
getAllWrappedEndpoints,
|
|
6
|
+
getSharedClients,
|
|
7
|
+
getSupabaseAdmin,
|
|
8
|
+
resolveEndpoint,
|
|
9
|
+
secureLogger
|
|
10
|
+
} from "./chunk-W2QL7LYI.js";
|
|
11
|
+
|
|
12
|
+
// src/services/wallet-service.ts
|
|
13
|
+
async function consumeCredits(args) {
|
|
14
|
+
const { userId, cost, idempotencyKey, requestId, keyId } = args;
|
|
15
|
+
const { data, error } = await getSupabaseAdmin().rpc("consume_credits", {
|
|
16
|
+
p_user_id: userId,
|
|
17
|
+
p_cost: cost,
|
|
18
|
+
p_idempotency_key: idempotencyKey,
|
|
19
|
+
p_request_id: requestId ?? null,
|
|
20
|
+
p_key_id: keyId ?? null
|
|
21
|
+
});
|
|
22
|
+
if (error) {
|
|
23
|
+
secureLogger.error("consume_credits RPC failed", error, { userId });
|
|
24
|
+
throw new Error(`consume_credits failed: ${error.message}`);
|
|
25
|
+
}
|
|
26
|
+
const row = Array.isArray(data) ? data[0] : data;
|
|
27
|
+
if (!row) {
|
|
28
|
+
throw new Error("consume_credits returned no row");
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
code: row.code,
|
|
32
|
+
balance: row.balance ?? null,
|
|
33
|
+
monthlyGrant: row.monthly_grant ?? 0,
|
|
34
|
+
cycleEnd: row.cycle_end ?? null
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
async function ensureWallet(userId, planId) {
|
|
38
|
+
const { error } = await getSupabaseAdmin().rpc("ensure_wallet", {
|
|
39
|
+
p_user_id: userId,
|
|
40
|
+
p_plan_id: planId
|
|
41
|
+
});
|
|
42
|
+
if (error) {
|
|
43
|
+
secureLogger.error("ensure_wallet RPC failed", error, { userId });
|
|
44
|
+
throw new Error(`ensure_wallet failed: ${error.message}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function getWalletStatus(userId) {
|
|
48
|
+
const { data, error } = await getSupabaseAdmin().from("credit_wallets").select(
|
|
49
|
+
"plan_id, balance, monthly_grant, cycle_start, cycle_end, updated_at"
|
|
50
|
+
).eq("user_id", userId).single();
|
|
51
|
+
if (error || !data) {
|
|
52
|
+
secureLogger.warn("getWalletStatus returned no row", {
|
|
53
|
+
userId,
|
|
54
|
+
hasError: !!error,
|
|
55
|
+
errorCode: error?.code,
|
|
56
|
+
errorMessage: error?.message
|
|
57
|
+
});
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
planId: data.plan_id,
|
|
62
|
+
balance: data.balance ?? null,
|
|
63
|
+
monthlyGrant: data.monthly_grant,
|
|
64
|
+
cycleStart: data.cycle_start,
|
|
65
|
+
cycleEnd: data.cycle_end,
|
|
66
|
+
updatedAt: data.updated_at
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async function applyPlanChange(args) {
|
|
70
|
+
const { data, error } = await getSupabaseAdmin().rpc("apply_plan_change", {
|
|
71
|
+
p_event_id: args.eventId,
|
|
72
|
+
p_event_type: args.eventType,
|
|
73
|
+
p_user_id: args.userId,
|
|
74
|
+
p_new_plan_id: args.newPlanId ?? null,
|
|
75
|
+
p_grant_credits: args.grantCredits ?? false,
|
|
76
|
+
p_cycle_start: args.cycleStart ?? null,
|
|
77
|
+
p_cycle_end: args.cycleEnd ?? null,
|
|
78
|
+
p_billing_status: args.billingStatus ?? null,
|
|
79
|
+
p_customer_id: args.customerId ?? null,
|
|
80
|
+
p_subscription_id: args.subscriptionId ?? null,
|
|
81
|
+
p_subscription_status: args.subscriptionStatus ?? null,
|
|
82
|
+
p_price_id: args.priceId ?? null,
|
|
83
|
+
p_ledger_reason: args.ledgerReason ?? "plan_change"
|
|
84
|
+
});
|
|
85
|
+
if (error) {
|
|
86
|
+
secureLogger.error("apply_plan_change RPC failed", error, {
|
|
87
|
+
userId: args.userId,
|
|
88
|
+
eventType: args.eventType
|
|
89
|
+
});
|
|
90
|
+
throw new Error(`apply_plan_change failed: ${error.message}`);
|
|
91
|
+
}
|
|
92
|
+
const row = Array.isArray(data) ? data[0] : data;
|
|
93
|
+
if (!row) {
|
|
94
|
+
throw new Error("apply_plan_change returned no row");
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
outcome: String(row.outcome ?? "applied"),
|
|
98
|
+
replayed: Boolean(row.replayed),
|
|
99
|
+
planId: row.plan_id ?? null,
|
|
100
|
+
balance: row.balance ?? null,
|
|
101
|
+
billingStatus: row.billing_status ?? null
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/services/tool-execution.ts
|
|
106
|
+
async function executeToolByName(toolName, args, options) {
|
|
107
|
+
const allEndpoints = getAllWrappedEndpoints();
|
|
108
|
+
const lookup = resolveEndpoint(allEndpoints, toolName);
|
|
109
|
+
if (!lookup.ok) {
|
|
110
|
+
const result2 = createToolNotFoundResult(toolName);
|
|
111
|
+
secureLogger.toolCall(toolName, false, result2.durationMs, {
|
|
112
|
+
transport: "rest",
|
|
113
|
+
runtimeStatus: "failing",
|
|
114
|
+
errorClass: "not_found",
|
|
115
|
+
receiptId: result2.hive.receipt_id,
|
|
116
|
+
receiptVersion: result2.hive.receipt_version,
|
|
117
|
+
requestId: options?.requestId,
|
|
118
|
+
serverVersion: result2.hive.server_version,
|
|
119
|
+
buildSha: result2.hive.build_sha,
|
|
120
|
+
inputDigest: result2.hive.input_digest,
|
|
121
|
+
resultDigest: result2.hive.result_digest
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
ok: false,
|
|
125
|
+
error: result2.error,
|
|
126
|
+
durationMs: result2.durationMs,
|
|
127
|
+
meta: result2.hive
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const result = await executeEndpoint(lookup.endpoint, args, {
|
|
131
|
+
transport: "rest",
|
|
132
|
+
requestId: options?.requestId,
|
|
133
|
+
clients: getSharedClients(),
|
|
134
|
+
beforeExecution: options?.beforeExecution
|
|
135
|
+
});
|
|
136
|
+
if (result.validationErrors) {
|
|
137
|
+
return {
|
|
138
|
+
ok: false,
|
|
139
|
+
error: result.error,
|
|
140
|
+
validationErrors: result.validationErrors,
|
|
141
|
+
durationMs: result.durationMs,
|
|
142
|
+
meta: result.hive
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (result.ok) {
|
|
146
|
+
return {
|
|
147
|
+
ok: true,
|
|
148
|
+
data: result.data,
|
|
149
|
+
durationMs: result.durationMs,
|
|
150
|
+
meta: result.hive
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (result.error?.code === "PROVIDER_UNAVAILABLE") {
|
|
154
|
+
return {
|
|
155
|
+
ok: false,
|
|
156
|
+
error: result.error,
|
|
157
|
+
durationMs: result.durationMs,
|
|
158
|
+
meta: result.hive
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
if (result.error?.code === "INTERNAL_ERROR") {
|
|
162
|
+
secureLogger.error(`[tool-execution] ${toolName} threw`, result.error, {});
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
ok: false,
|
|
166
|
+
error: result.error,
|
|
167
|
+
durationMs: result.durationMs,
|
|
168
|
+
meta: result.hive
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export {
|
|
173
|
+
consumeCredits,
|
|
174
|
+
ensureWallet,
|
|
175
|
+
getWalletStatus,
|
|
176
|
+
applyPlanChange,
|
|
177
|
+
executeToolByName
|
|
178
|
+
};
|
|
@@ -11,11 +11,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
11
11
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
12
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
13
|
});
|
|
14
|
-
var __esm = (fn, res) => function __init() {
|
|
15
|
-
|
|
14
|
+
var __esm = (fn, res, err) => function __init() {
|
|
15
|
+
if (err) throw err[0];
|
|
16
|
+
try {
|
|
17
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw err = [e], e;
|
|
20
|
+
}
|
|
16
21
|
};
|
|
17
22
|
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
-
|
|
23
|
+
try {
|
|
24
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
throw mod = 0, e;
|
|
27
|
+
}
|
|
19
28
|
};
|
|
20
29
|
var __export = (target, all) => {
|
|
21
30
|
for (var name in all)
|
|
@@ -5,7 +5,7 @@ var HIVE_AGENT_SKILLS = [
|
|
|
5
5
|
{
|
|
6
6
|
name: "hive-mcp",
|
|
7
7
|
label: "Install Hive MCP",
|
|
8
|
-
description: "Connect Hive's hosted remote MCP endpoint to Claude, Cursor, VS Code,
|
|
8
|
+
description: "Connect Hive's hosted remote MCP endpoint to Claude, ChatGPT/OpenAI, Grok, Cursor, VS Code, Codex, Gemini, and supported clients with OAuth-first interactive setup.",
|
|
9
9
|
path: "agent-skills/packs/hive-mcp/SKILL.md",
|
|
10
10
|
toolsetIds: ["search_discovery"],
|
|
11
11
|
useWhen: ["install hive", "connect mcp", "configure client"]
|
|
@@ -21,7 +21,7 @@ var HIVE_AGENT_SKILLS = [
|
|
|
21
21
|
{
|
|
22
22
|
name: "hive-build",
|
|
23
23
|
label: "Build With Hive",
|
|
24
|
-
description: "Use Hive from application code through REST, MCP clients, or the
|
|
24
|
+
description: "Use Hive from application code through REST, MCP clients, or the published TypeScript adapter.",
|
|
25
25
|
path: "agent-skills/packs/hive-build/SKILL.md",
|
|
26
26
|
toolsetIds: ["search_discovery"],
|
|
27
27
|
useWhen: ["integrate api", "backend", "sdk", "production app"]
|
|
@@ -50,6 +50,7 @@ var HIVE_AGENT_SKILLS = [
|
|
|
50
50
|
"network_infrastructure",
|
|
51
51
|
"solana_analysis",
|
|
52
52
|
"prediction_markets",
|
|
53
|
+
"rwa_perp_analysis",
|
|
53
54
|
"stateful_monitoring",
|
|
54
55
|
"search_discovery"
|
|
55
56
|
],
|
|
@@ -79,7 +80,7 @@ var HIVE_AGENT_SKILLS = [
|
|
|
79
80
|
{
|
|
80
81
|
name: "hive-tool-discovery",
|
|
81
82
|
label: "Tool Discovery",
|
|
82
|
-
description: "Use search_tools, hive://toolsets, schema lookup, and
|
|
83
|
+
description: "Use compact search_tools, exact hive://toolsets/{id} resources, schema lookup, separate read/write invokers, and validate_task_result correctly.",
|
|
83
84
|
path: "agent-skills/packs/hive-tool-discovery/SKILL.md",
|
|
84
85
|
toolsetIds: ["search_discovery"],
|
|
85
86
|
useWhen: [
|
|
@@ -94,9 +95,9 @@ var HIVE_AGENT_SKILLS = [
|
|
|
94
95
|
{
|
|
95
96
|
name: "hive-market-research",
|
|
96
97
|
label: "Market Research",
|
|
97
|
-
description: "Research prices, liquidity, exchanges, OHLC, order books, and derivatives context.",
|
|
98
|
+
description: "Research prices, liquidity, exchanges, OHLC, order books, and derivatives context, including tokenized-RWA perp funding.",
|
|
98
99
|
path: "agent-skills/packs/hive-market-research/SKILL.md",
|
|
99
|
-
toolsetIds: ["market_research"],
|
|
100
|
+
toolsetIds: ["market_research", "rwa_perp_analysis"],
|
|
100
101
|
useWhen: [
|
|
101
102
|
"price",
|
|
102
103
|
"market",
|
|
@@ -2,13 +2,13 @@ import { createRequire } from 'node:module'; const require = createRequire(impor
|
|
|
2
2
|
import {
|
|
3
3
|
REGISTRY_PACKAGE,
|
|
4
4
|
SERVER_VERSION
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZXKFJQDE.js";
|
|
6
6
|
import {
|
|
7
7
|
ensureConfigDir,
|
|
8
8
|
getConfigDir,
|
|
9
9
|
readJsonFile,
|
|
10
10
|
writeJsonFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6PC3HUAK.js";
|
|
12
12
|
|
|
13
13
|
// src/cli/update-check.ts
|
|
14
14
|
import { join } from "path";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
executeRemoteTool
|
|
4
|
+
} from "./chunk-Q7VBYLX7.js";
|
|
5
|
+
import {
|
|
6
|
+
trackCommand
|
|
7
|
+
} from "./chunk-RU6QOFHH.js";
|
|
8
|
+
import {
|
|
9
|
+
debug,
|
|
10
|
+
dim,
|
|
11
|
+
shouldOutputJson,
|
|
12
|
+
writeOutput
|
|
13
|
+
} from "./chunk-725R3KLJ.js";
|
|
14
|
+
import {
|
|
15
|
+
resolveApiKey
|
|
16
|
+
} from "./chunk-6PC3HUAK.js";
|
|
17
|
+
|
|
18
|
+
// src/cli/execute.ts
|
|
19
|
+
import ora from "ora";
|
|
20
|
+
|
|
21
|
+
// src/cli/keyless-heroes.ts
|
|
22
|
+
var CHAIN_ID_TO_NAME = {
|
|
23
|
+
"1": "ethereum",
|
|
24
|
+
"10": "optimism",
|
|
25
|
+
"56": "bsc",
|
|
26
|
+
"137": "polygon",
|
|
27
|
+
"8453": "base",
|
|
28
|
+
"42161": "arbitrum",
|
|
29
|
+
"43114": "avalanche"
|
|
30
|
+
};
|
|
31
|
+
var ALCHEMY_NETWORK_TO_CHAIN = {
|
|
32
|
+
"eth-mainnet": "ethereum",
|
|
33
|
+
"opt-mainnet": "optimism",
|
|
34
|
+
"bnb-mainnet": "bsc",
|
|
35
|
+
"polygon-mainnet": "polygon",
|
|
36
|
+
"base-mainnet": "base",
|
|
37
|
+
"arb-mainnet": "arbitrum",
|
|
38
|
+
"avax-mainnet": "avalanche"
|
|
39
|
+
};
|
|
40
|
+
function firstListEntry(value) {
|
|
41
|
+
if (typeof value !== "string") return null;
|
|
42
|
+
const parts = value.split(",").map((part) => part.trim()).filter(Boolean);
|
|
43
|
+
return parts.length === 1 ? parts[0] : null;
|
|
44
|
+
}
|
|
45
|
+
function remapForKeylessHero(toolName, args) {
|
|
46
|
+
if (toolName === "get_price") {
|
|
47
|
+
const token = firstListEntry(args.ids);
|
|
48
|
+
if (!token) return null;
|
|
49
|
+
const vsCurrency = firstListEntry(args.vs_currencies) ?? "usd";
|
|
50
|
+
return {
|
|
51
|
+
tool: "get_token_price",
|
|
52
|
+
args: { token, vs_currency: vsCurrency },
|
|
53
|
+
note: "no API key \u2014 routed through the keyless get_token_price hero"
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (toolName === "get_token_security") {
|
|
57
|
+
const address = firstListEntry(args.contract_addresses);
|
|
58
|
+
if (!address) return null;
|
|
59
|
+
const chainId = typeof args.chain_id === "string" || typeof args.chain_id === "number" ? String(args.chain_id) : null;
|
|
60
|
+
const chain = chainId ? CHAIN_ID_TO_NAME[chainId] ?? chainId : void 0;
|
|
61
|
+
return {
|
|
62
|
+
tool: "check_token_safety",
|
|
63
|
+
args: chain ? { address, chain } : { address },
|
|
64
|
+
note: "no API key \u2014 routed through the keyless check_token_safety hero"
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (toolName === "alchemy_get_tokens_by_wallet") {
|
|
68
|
+
const address = typeof args.address === "string" && args.address.trim() ? args.address.trim() : null;
|
|
69
|
+
if (!address) return null;
|
|
70
|
+
const network = typeof args.network === "string" ? args.network.trim() : null;
|
|
71
|
+
const chain = network ? ALCHEMY_NETWORK_TO_CHAIN[network] : void 0;
|
|
72
|
+
return {
|
|
73
|
+
tool: "get_wallet_portfolio",
|
|
74
|
+
args: chain ? { address, chain } : { address },
|
|
75
|
+
note: "no API key \u2014 routed through the keyless get_wallet_portfolio hero"
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/cli/execute.ts
|
|
82
|
+
async function executeTool(toolName, args, timeoutMs = 3e4) {
|
|
83
|
+
if (!resolveApiKey()) {
|
|
84
|
+
const remap = remapForKeylessHero(toolName, args);
|
|
85
|
+
if (remap) {
|
|
86
|
+
debug(remap.note);
|
|
87
|
+
toolName = remap.tool;
|
|
88
|
+
args = remap.args;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
debug(`Executing ${toolName} remotely`);
|
|
92
|
+
const showSpinner = !shouldOutputJson() && !!process.stderr.isTTY;
|
|
93
|
+
const spinner = showSpinner ? ora({ text: `Calling ${toolName}...`, stream: process.stderr }).start() : null;
|
|
94
|
+
const startMs = Date.now();
|
|
95
|
+
let response;
|
|
96
|
+
try {
|
|
97
|
+
response = await executeRemoteTool(toolName, args, timeoutMs);
|
|
98
|
+
spinner?.succeed(`${toolName} (${Date.now() - startMs}ms)`);
|
|
99
|
+
} catch (err) {
|
|
100
|
+
spinner?.fail(`${toolName} failed (${Date.now() - startMs}ms)`);
|
|
101
|
+
throw err;
|
|
102
|
+
}
|
|
103
|
+
trackCommand(
|
|
104
|
+
toolName,
|
|
105
|
+
Date.now() - startMs,
|
|
106
|
+
response.ok ? void 0 : response.error?.code
|
|
107
|
+
);
|
|
108
|
+
await writeOutput(response);
|
|
109
|
+
const quotaRemaining = response.meta?.quota_remaining;
|
|
110
|
+
if (typeof quotaRemaining === "number" && !resolveApiKey() && !shouldOutputJson()) {
|
|
111
|
+
process.stderr.write(
|
|
112
|
+
dim(
|
|
113
|
+
`${quotaRemaining} free call${quotaRemaining === 1 ? "" : "s"} left today \u2014 run \`hive auth login\` for a full key.`
|
|
114
|
+
) + "\n"
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
if (!response.ok) {
|
|
118
|
+
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;
|
|
119
|
+
process.exit(exitCode);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
executeTool
|
|
125
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
SERVER_VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZXKFJQDE.js";
|
|
5
5
|
import {
|
|
6
6
|
getNoRetry,
|
|
7
7
|
resolveApiKey,
|
|
8
8
|
resolveApiUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6PC3HUAK.js";
|
|
10
10
|
|
|
11
11
|
// src/cli/api-client.ts
|
|
12
12
|
var MAX_RETRIES = 3;
|
|
@@ -87,6 +87,13 @@ async function executeRemoteTool(toolName, args, timeoutMs = 3e4) {
|
|
|
87
87
|
signal: controller.signal
|
|
88
88
|
});
|
|
89
89
|
const data = await response.json();
|
|
90
|
+
const quotaHeader = response.headers?.get?.("x-quota-remaining");
|
|
91
|
+
if (quotaHeader != null && quotaHeader !== "") {
|
|
92
|
+
const quotaRemaining = Number.parseInt(quotaHeader, 10);
|
|
93
|
+
if (Number.isFinite(quotaRemaining)) {
|
|
94
|
+
data.meta = { ...data.meta ?? {}, quota_remaining: quotaRemaining };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
90
97
|
return data;
|
|
91
98
|
} catch (error) {
|
|
92
99
|
if (error instanceof Error && error.name === "AbortError") {
|