hive-intelligence 1.1.4 → 1.4.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 +30 -37
- 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-WMWFWXC7.js +16 -0
- package/build/{auth-Q5Q24IRI.js → auth-HRFQWQMZ.js} +3 -11
- package/build/browser-auth-KXIO5BHM.js +20 -0
- package/build/{cache-T6KC5YEY.js → cache-TBDQ7QBU.js} +2 -2
- package/build/chunk-3OZFBWFK.js +180 -0
- package/build/{chunk-POT2MBEK.js → chunk-6PC3HUAK.js} +10 -3
- package/build/{chunk-NP6NSOG2.js → chunk-725R3KLJ.js} +26 -3
- package/build/chunk-7DYHWY4Y.js +125 -0
- package/build/{chunk-ZXB53E7H.js → chunk-AEU43ACS.js} +31 -7
- package/build/chunk-AQQAPAER.js +197 -0
- package/build/chunk-EPF36Q3Z.js +71 -0
- package/build/{upgrade-DTUIHVPS.js → chunk-GHCYCBA3.js} +4 -5
- 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-7JWXBKEJ.js → chunk-P7NLFSZQ.js} +9 -60
- 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-FH3YGSY5.js → chunk-TNQ7GJ6Q.js} +0 -59
- package/build/{chunk-5XXI25JE.js → chunk-TVQJY47C.js} +12 -160
- package/build/{chunk-JTUKQWIO.js → chunk-UFTNBCSA.js} +35515 -14994
- package/build/{chunk-ZCU7XQKF.js → chunk-ZXKFJQDE.js} +7 -1
- package/build/cli.js +3342 -3423
- 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-GHUAUFS2.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-RG542NWG.js +427 -0
- package/build/mcpServer-D7OXUDU5.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-K3IT7DS4.js} +3 -3
- package/build/server.js +6396 -3220
- 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-D72ZH6P5.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-4S5XT5JG.js +14 -0
- package/build/{version-I6HDAF4L.js → version-Z4HJL4VV.js} +4 -2
- package/build/{watch-YNN255QX.js → watch-IOSRSCFE.js} +8 -7
- package/package.json +73 -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/api-client-EPF6FD7A.js +0 -28
- package/build/browser-auth-VPF5LZMZ.js +0 -8
- package/build/chunk-4F5CI6LX.js +0 -340
- package/build/chunk-CEWCB5YS.js +0 -71
- package/build/chunk-GZPDEXO4.js +0 -126
- package/build/chunk-IZPAMRHP.js +0 -43
- package/build/init-all-5SKNV75X.js +0 -273
- package/build/mcpServer-5TKKSKJM.js +0 -21
|
@@ -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
|
+
};
|
|
@@ -2,19 +2,17 @@ import { createRequire } from 'node:module'; const require = createRequire(impor
|
|
|
2
2
|
import {
|
|
3
3
|
fetchLatestVersion,
|
|
4
4
|
isNewerVersion
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-M6REON2I.js";
|
|
6
6
|
import {
|
|
7
7
|
REGISTRY_PACKAGE,
|
|
8
8
|
SERVER_VERSION
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZXKFJQDE.js";
|
|
10
10
|
import {
|
|
11
11
|
info,
|
|
12
12
|
shouldOutputJson,
|
|
13
13
|
successEnvelope,
|
|
14
14
|
writeOutput
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-POT2MBEK.js";
|
|
17
|
-
import "./chunk-3WYWXTNN.js";
|
|
15
|
+
} from "./chunk-725R3KLJ.js";
|
|
18
16
|
|
|
19
17
|
// src/cli/upgrade.ts
|
|
20
18
|
import { spawnSync } from "child_process";
|
|
@@ -165,6 +163,7 @@ Update available: ${SERVER_VERSION} -> ${latest}
|
|
|
165
163
|
"Restart your MCP client (Claude, Cursor, VS Code) to load the new version.\n"
|
|
166
164
|
);
|
|
167
165
|
}
|
|
166
|
+
|
|
168
167
|
export {
|
|
169
168
|
detectInstallMode,
|
|
170
169
|
runUpgrade
|
|
@@ -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";
|
|
@@ -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") {
|
|
@@ -177,58 +184,6 @@ async function fetchToolCatalog() {
|
|
|
177
184
|
}
|
|
178
185
|
};
|
|
179
186
|
}
|
|
180
|
-
async function authSignup(email, password) {
|
|
181
|
-
const url = buildApiUrl("/auth/signup");
|
|
182
|
-
const response = await fetchWithRetry(url, {
|
|
183
|
-
method: "POST",
|
|
184
|
-
headers: { "Content-Type": "application/json" },
|
|
185
|
-
body: JSON.stringify({ email, password })
|
|
186
|
-
});
|
|
187
|
-
return response.json();
|
|
188
|
-
}
|
|
189
|
-
async function authLogin(email, password) {
|
|
190
|
-
const url = buildApiUrl("/auth/login");
|
|
191
|
-
const response = await fetchWithRetry(url, {
|
|
192
|
-
method: "POST",
|
|
193
|
-
headers: { "Content-Type": "application/json" },
|
|
194
|
-
body: JSON.stringify({ email, password })
|
|
195
|
-
});
|
|
196
|
-
return response.json();
|
|
197
|
-
}
|
|
198
|
-
async function authMe(jwt) {
|
|
199
|
-
const url = buildApiUrl("/auth/me");
|
|
200
|
-
const response = await fetchWithRetry(url, {
|
|
201
|
-
headers: { Authorization: `Bearer ${jwt}` }
|
|
202
|
-
});
|
|
203
|
-
return response.json();
|
|
204
|
-
}
|
|
205
|
-
async function createKey(jwt, name) {
|
|
206
|
-
const url = buildApiUrl("/api/v1/keys");
|
|
207
|
-
const response = await fetchWithRetry(url, {
|
|
208
|
-
method: "POST",
|
|
209
|
-
headers: {
|
|
210
|
-
"Content-Type": "application/json",
|
|
211
|
-
Authorization: `Bearer ${jwt}`
|
|
212
|
-
},
|
|
213
|
-
body: JSON.stringify({ name })
|
|
214
|
-
});
|
|
215
|
-
return response.json();
|
|
216
|
-
}
|
|
217
|
-
async function listKeysApi(jwt) {
|
|
218
|
-
const url = buildApiUrl("/api/v1/keys");
|
|
219
|
-
const response = await fetchWithRetry(url, {
|
|
220
|
-
headers: { Authorization: `Bearer ${jwt}` }
|
|
221
|
-
});
|
|
222
|
-
return response.json();
|
|
223
|
-
}
|
|
224
|
-
async function revokeKeyApi(jwt, keyId) {
|
|
225
|
-
const url = buildApiUrl(`/api/v1/keys/${keyId}`);
|
|
226
|
-
const response = await fetchWithRetry(url, {
|
|
227
|
-
method: "DELETE",
|
|
228
|
-
headers: { Authorization: `Bearer ${jwt}` }
|
|
229
|
-
});
|
|
230
|
-
return response.json();
|
|
231
|
-
}
|
|
232
187
|
async function getUsage() {
|
|
233
188
|
const url = buildApiUrl("/api/v1/usage");
|
|
234
189
|
const apiKey = resolveApiKey();
|
|
@@ -242,11 +197,5 @@ export {
|
|
|
242
197
|
fetchWithRetry,
|
|
243
198
|
executeRemoteTool,
|
|
244
199
|
fetchToolCatalog,
|
|
245
|
-
authSignup,
|
|
246
|
-
authLogin,
|
|
247
|
-
authMe,
|
|
248
|
-
createKey,
|
|
249
|
-
listKeysApi,
|
|
250
|
-
revokeKeyApi,
|
|
251
200
|
getUsage
|
|
252
201
|
};
|