hive-intelligence 1.15.0 → 1.16.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/build/{api-client-POBN6Y5S.js → api-client-MK3CVNCH.js} +2 -2
- package/build/{auth-6XVL5CE3.js → auth-TZQC54EJ.js} +1 -1
- package/build/{call-args-BUB6YNHW.js → call-args-4YRVKOLV.js} +2 -2
- package/build/{chunk-ZSPPJW4G.js → chunk-4U4IL5KA.js} +15 -1
- package/build/{chunk-KQVPKTEO.js → chunk-AVTIJGWS.js} +2 -2
- package/build/{chunk-762ZUJ4Q.js → chunk-B53GNIWW.js} +1 -1
- package/build/chunk-MYSS5SBE.js +71 -0
- package/build/{chunk-YLHNUAFT.js → chunk-O5YKCM67.js} +22 -6
- package/build/{chunk-APBLB62S.js → chunk-PODCJTBV.js} +1 -1
- package/build/{chunk-GNZGLVFE.js → chunk-QSKFAT7Z.js} +466 -442
- package/build/{chunk-RNVZIPNY.js → chunk-VO6NWVJD.js} +1 -1
- package/build/{chunk-AZFOTKS2.js → chunk-WZ2NMSV3.js} +1 -1
- package/build/cli.js +31 -29
- package/build/{doctor-25WPHR4J.js → doctor-UKOGXRSW.js} +4 -4
- package/build/{errors-YQAVCXXO.js → errors-BPXK3KCR.js} +1 -1
- package/build/{feedback-G2DFCCI6.js → feedback-6XX2R75U.js} +2 -2
- package/build/{init-all-UDWHV2ER.js → init-all-XDQRGJ3D.js} +1 -1
- package/build/{mcpServer-O4KXRE62.js → mcpServer-77FPS534.js} +2 -1
- package/build/monitor-worker.js +3 -2
- package/build/release.json +4 -4
- package/build/{routing-4VKAVRYR.js → routing-S7DPEROC.js} +2 -2
- package/build/{serve-V2KPPJCD.js → serve-2NIEUCJN.js} +6 -4
- package/build/server.js +112 -105
- package/build/stdio.js +2 -1
- package/build/{tools-K2P77L4T.js → tools-NSHQSUIK.js} +5 -5
- package/build/{uninstall-I6ERJ2ED.js → uninstall-CECLA5YZ.js} +2 -2
- package/build/{watch-BUSEPVDM.js → watch-4VHBLAL6.js} +3 -3
- package/package.json +5 -15
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
getAnonQuota,
|
|
9
9
|
getUsage,
|
|
10
10
|
postFeedback
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-VO6NWVJD.js";
|
|
12
|
+
import "./chunk-4U4IL5KA.js";
|
|
13
13
|
import "./chunk-ZXKFJQDE.js";
|
|
14
14
|
import "./chunk-6PC3HUAK.js";
|
|
15
15
|
import "./chunk-OMO7XLC5.js";
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
parseFlagTokens,
|
|
11
11
|
planToolCall,
|
|
12
12
|
reservedOptionNames
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-WZ2NMSV3.js";
|
|
14
|
+
import "./chunk-4U4IL5KA.js";
|
|
15
15
|
import "./chunk-OMO7XLC5.js";
|
|
16
16
|
export {
|
|
17
17
|
ALWAYS_RESERVED_OPTIONS,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/cli/errors.ts
|
|
4
|
-
import { distance } from "fastest-levenshtein";
|
|
5
4
|
var ExitCode = {
|
|
6
5
|
SUCCESS: 0,
|
|
7
6
|
GENERAL_ERROR: 1,
|
|
@@ -109,6 +108,21 @@ function classifyError(error, toolName) {
|
|
|
109
108
|
}
|
|
110
109
|
return new CliError("API_ERROR", msg);
|
|
111
110
|
}
|
|
111
|
+
function distance(a, b) {
|
|
112
|
+
let prev = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
113
|
+
for (let i = 1; i <= a.length; i++) {
|
|
114
|
+
const cur = [i];
|
|
115
|
+
for (let j = 1; j <= b.length; j++) {
|
|
116
|
+
cur[j] = Math.min(
|
|
117
|
+
prev[j] + 1,
|
|
118
|
+
cur[j - 1] + 1,
|
|
119
|
+
prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
prev = cur;
|
|
123
|
+
}
|
|
124
|
+
return prev[b.length];
|
|
125
|
+
}
|
|
112
126
|
function suggestSimilarTools(input, toolNames, maxDistance = 3) {
|
|
113
127
|
return toolNames.map((name) => ({ name, dist: distance(input, name) })).filter((entry) => entry.dist <= maxDistance).sort((a, b) => a.dist - b.dist).slice(0, 3).map((entry) => entry.name);
|
|
114
128
|
}
|
|
@@ -294,11 +294,11 @@ async function runSwitch(name) {
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
async function runUsage() {
|
|
297
|
-
const { getUsage } = await import("./api-client-
|
|
297
|
+
const { getUsage } = await import("./api-client-MK3CVNCH.js");
|
|
298
298
|
const result = await getUsage();
|
|
299
299
|
if (!result.ok) {
|
|
300
300
|
const { outputError } = await import("./output-BBHBJI32.js");
|
|
301
|
-
const { CliError, classifyError } = await import("./errors-
|
|
301
|
+
const { CliError, classifyError } = await import("./errors-BPXK3KCR.js");
|
|
302
302
|
const code = result.error?.code;
|
|
303
303
|
const err = code === "AUTH_REQUIRED" || code === "INVALID_TOKEN" ? new CliError(
|
|
304
304
|
"AUTH_REQUIRED",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/config/env.ts
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
var nodeEnvSchema = z.enum(["development", "production", "test"]).catch("development");
|
|
6
|
+
var logLevelSchema = z.enum(["debug", "info", "warn", "error"]).catch("info");
|
|
7
|
+
var portSchema = z.coerce.number().int().min(1).max(65535);
|
|
8
|
+
var rateLimitMaxSchema = z.coerce.number().int().min(1).max(1e4);
|
|
9
|
+
function getEnvVar(name) {
|
|
10
|
+
const value = process.env[name]?.trim();
|
|
11
|
+
return value ? value : void 0;
|
|
12
|
+
}
|
|
13
|
+
function getRequiredEnvVar(name, message) {
|
|
14
|
+
const value = getEnvVar(name);
|
|
15
|
+
if (!value) {
|
|
16
|
+
throw new Error(message ?? `Missing required environment variable: ${name}`);
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
function hasEnvVars(...names) {
|
|
21
|
+
return names.every((name) => Boolean(getEnvVar(name)));
|
|
22
|
+
}
|
|
23
|
+
function loadEnvFile(path) {
|
|
24
|
+
try {
|
|
25
|
+
process.loadEnvFile(path);
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function getCsvEnv(name) {
|
|
30
|
+
const value = getEnvVar(name);
|
|
31
|
+
if (!value) return [];
|
|
32
|
+
return value.split(",").map((part) => part.trim()).filter(Boolean);
|
|
33
|
+
}
|
|
34
|
+
function getNodeEnv() {
|
|
35
|
+
return nodeEnvSchema.parse(process.env.NODE_ENV);
|
|
36
|
+
}
|
|
37
|
+
function isProduction() {
|
|
38
|
+
return getNodeEnv() === "production";
|
|
39
|
+
}
|
|
40
|
+
function getLogLevel() {
|
|
41
|
+
return logLevelSchema.parse(process.env.LOG_LEVEL);
|
|
42
|
+
}
|
|
43
|
+
function getPort() {
|
|
44
|
+
return portSchema.parse(process.env.PORT ?? 8080);
|
|
45
|
+
}
|
|
46
|
+
function getRateLimitMax() {
|
|
47
|
+
return rateLimitMaxSchema.parse(process.env.RATE_LIMIT_MAX ?? 30);
|
|
48
|
+
}
|
|
49
|
+
function getCredentialedRateLimitMax() {
|
|
50
|
+
return rateLimitMaxSchema.parse(
|
|
51
|
+
process.env.CREDENTIALED_RATE_LIMIT_MAX ?? 1500
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function getCorsAllowedOrigins() {
|
|
55
|
+
return getCsvEnv("CORS_ALLOWED_ORIGINS");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
getEnvVar,
|
|
60
|
+
getRequiredEnvVar,
|
|
61
|
+
hasEnvVars,
|
|
62
|
+
loadEnvFile,
|
|
63
|
+
getCsvEnv,
|
|
64
|
+
getNodeEnv,
|
|
65
|
+
isProduction,
|
|
66
|
+
getLogLevel,
|
|
67
|
+
getPort,
|
|
68
|
+
getRateLimitMax,
|
|
69
|
+
getCredentialedRateLimitMax,
|
|
70
|
+
getCorsAllowedOrigins
|
|
71
|
+
};
|
|
@@ -4,17 +4,19 @@ import {
|
|
|
4
4
|
} from "./chunk-XN3T6YOG.js";
|
|
5
5
|
import {
|
|
6
6
|
executeRemoteTool
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VO6NWVJD.js";
|
|
8
8
|
import {
|
|
9
9
|
trackCommand
|
|
10
10
|
} from "./chunk-RU6QOFHH.js";
|
|
11
11
|
import {
|
|
12
12
|
ExitCode
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4U4IL5KA.js";
|
|
14
14
|
import {
|
|
15
15
|
debug,
|
|
16
16
|
dim,
|
|
17
|
+
green,
|
|
17
18
|
isQuiet,
|
|
19
|
+
red,
|
|
18
20
|
shouldOutputJson,
|
|
19
21
|
writeOutput
|
|
20
22
|
} from "./chunk-ZDXMZPC6.js";
|
|
@@ -22,9 +24,6 @@ import {
|
|
|
22
24
|
resolveApiKey
|
|
23
25
|
} from "./chunk-6PC3HUAK.js";
|
|
24
26
|
|
|
25
|
-
// src/cli/execute.ts
|
|
26
|
-
import ora from "ora";
|
|
27
|
-
|
|
28
27
|
// src/cli/keyless-heroes.ts
|
|
29
28
|
var CHAIN_ID_TO_NAME = {
|
|
30
29
|
"1": "ethereum",
|
|
@@ -115,6 +114,23 @@ function creditFooter(meta, keyed) {
|
|
|
115
114
|
if (typeof meta.quota_remaining !== "number") return null;
|
|
116
115
|
return `free calls left today: ${meta.quota_remaining} (run \`hive auth login\` for a full key)`;
|
|
117
116
|
}
|
|
117
|
+
function startSpinner(text) {
|
|
118
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
119
|
+
let frame = 0;
|
|
120
|
+
const draw = () => process.stderr.write(`\r${frames[frame++ % frames.length]} ${text}`);
|
|
121
|
+
draw();
|
|
122
|
+
const timer = setInterval(draw, 80);
|
|
123
|
+
timer.unref();
|
|
124
|
+
const stop = (symbol, message) => {
|
|
125
|
+
clearInterval(timer);
|
|
126
|
+
process.stderr.write(`\r\x1B[2K${symbol} ${message}
|
|
127
|
+
`);
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
succeed: (message) => stop(green("\u2714"), message),
|
|
131
|
+
fail: (message) => stop(red("\u2716"), message)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
118
134
|
async function executeTool(toolName, args, timeoutMs = 3e4) {
|
|
119
135
|
const keyed = Boolean(resolveApiKey());
|
|
120
136
|
if (!keyed) {
|
|
@@ -127,7 +143,7 @@ async function executeTool(toolName, args, timeoutMs = 3e4) {
|
|
|
127
143
|
}
|
|
128
144
|
debug(`Executing ${toolName} remotely`);
|
|
129
145
|
const showSpinner = !shouldOutputJson() && !!process.stderr.isTTY;
|
|
130
|
-
const spinner = showSpinner ?
|
|
146
|
+
const spinner = showSpinner ? startSpinner(`Calling ${toolName}...`) : null;
|
|
131
147
|
const startMs = Date.now();
|
|
132
148
|
let response;
|
|
133
149
|
try {
|