@johpaz/hive-agents 0.0.36 → 0.0.37
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 +16 -16
- package/dist/hive.js +109 -90
- package/dist/tool-worker.js +218406 -0
- package/package.json +3 -2
- package/packages/cli/src/commands/gateway.ts +1 -1
- package/packages/cli/src/commands/onboard.ts +1 -1
- package/packages/core/src/tool-runtime/index.ts +29 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johpaz/hive-agents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "Tu colmena de agentes IA. Local-first. Multi-canal. Open source. Construido desde Colombia para el mundo.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"bin": {
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"files": [
|
|
66
66
|
"dist/hive.js",
|
|
67
|
+
"dist/tool-worker.js",
|
|
67
68
|
"dist/hive.cmd",
|
|
68
69
|
"dist/hive.ps1",
|
|
69
70
|
"dist/ui",
|
|
@@ -103,7 +104,7 @@
|
|
|
103
104
|
"doctor:dev": "HIVE_HOME=$HOME/.hive-dev HIVE_DEV=true bun run packages/cli/src/index.ts doctor",
|
|
104
105
|
"dev:keep": "HIVE_HOME=$HOME/.hive-dev HIVE_DEV=true HIVE_DEV_CLEAN=false bun run packages/cli/src/index.ts dev",
|
|
105
106
|
"start": "bun run packages/cli/src/index.ts start",
|
|
106
|
-
"build": "bun packages/skills/scripts/generate-bundle.ts && bun build packages/cli/src/index.ts --bundle --outfile dist/hive.js --target bun && cd packages/hive-ui && bun run build && cd ../.. && cp -r packages/hive-ui/dist dist/ui && bun packages/cli/scripts/postbuild.ts",
|
|
107
|
+
"build": "bun packages/skills/scripts/generate-bundle.ts && bun build packages/cli/src/index.ts --bundle --outfile dist/hive.js --target bun && bun build packages/core/src/tool-runtime/tool-worker.ts --outfile dist/tool-worker.js --target bun && cd packages/hive-ui && bun run build && cd ../.. && cp -r packages/hive-ui/dist dist/ui && bun packages/cli/scripts/postbuild.ts",
|
|
107
108
|
"build:binary": "cd packages/hive-ui && bun run build && cd ../cli && bun scripts/generate-ui-bundle.ts && bun build src/index.ts --compile --outfile ../../dist/hive-binary",
|
|
108
109
|
"prepublishOnly": "bun run build",
|
|
109
110
|
"test": "bun test",
|
|
@@ -319,7 +319,7 @@ export async function start(flags: string[]): Promise<void> {
|
|
|
319
319
|
║ ██║ ██║██║ ╚████╔╝ ███████╗ ║
|
|
320
320
|
║ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚══════╝ ║
|
|
321
321
|
║ ║
|
|
322
|
-
║ Personal Swarm AI Gateway — v0.0.
|
|
322
|
+
║ Personal Swarm AI Gateway — v0.0.37 ║
|
|
323
323
|
╚════════════════════════════════════════════╝
|
|
324
324
|
|
|
325
325
|
📦 Installation: ${adapter.name}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { existsSync } from "node:fs"
|
|
2
|
+
import { fileURLToPath } from "node:url"
|
|
1
3
|
import { availableParallelism } from "node:os"
|
|
2
4
|
import type { Config } from "../config/loader.ts"
|
|
3
5
|
import { loadConfig } from "../config/loader.ts"
|
|
@@ -94,6 +96,25 @@ type WorkerSlot = {
|
|
|
94
96
|
job?: QueuedJob
|
|
95
97
|
}
|
|
96
98
|
|
|
99
|
+
function resolveWorkerEntry(): string {
|
|
100
|
+
const candidates = [
|
|
101
|
+
new URL("./tool-worker.js", import.meta.url),
|
|
102
|
+
new URL("./tool-worker.ts", import.meta.url),
|
|
103
|
+
new URL("../packages/core/src/tool-runtime/tool-worker.js", import.meta.url),
|
|
104
|
+
new URL("../packages/core/src/tool-runtime/tool-worker.ts", import.meta.url),
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
for (const candidate of candidates) {
|
|
108
|
+
if (existsSync(fileURLToPath(candidate))) {
|
|
109
|
+
return candidate.href
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
throw new Error(
|
|
114
|
+
`Tool worker entry not found. Tried: ${candidates.map((candidate) => fileURLToPath(candidate)).join(", ")}`
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
97
118
|
function serializeError(error: unknown): SerializedError {
|
|
98
119
|
const err = error instanceof Error ? error : new Error(String(error))
|
|
99
120
|
return {
|
|
@@ -260,7 +281,7 @@ class ToolWorkerPool {
|
|
|
260
281
|
}
|
|
261
282
|
|
|
262
283
|
private createSlot(): WorkerSlot {
|
|
263
|
-
const worker = new Worker(
|
|
284
|
+
const worker = new Worker(resolveWorkerEntry(), { type: "module" })
|
|
264
285
|
const slot: WorkerSlot = { worker, busy: false }
|
|
265
286
|
|
|
266
287
|
worker.onmessage = (event: MessageEvent<WorkerMessage>) => {
|
|
@@ -287,13 +308,18 @@ class ToolWorkerPool {
|
|
|
287
308
|
const job = slot.job
|
|
288
309
|
if (!job) return
|
|
289
310
|
|
|
311
|
+
const location = [event.filename, event.lineno, event.colno].filter(Boolean).join(":")
|
|
312
|
+
const message = location
|
|
313
|
+
? `${event.message || "Tool worker failed"} (${location})`
|
|
314
|
+
: (event.message || "Tool worker failed")
|
|
315
|
+
|
|
290
316
|
this.finishJob(slot, {
|
|
291
317
|
toolCall: job.toolCall,
|
|
292
318
|
toolName: job.toolCall.function.name,
|
|
293
|
-
result: toolErrorResult(job.toolCall.function.name,
|
|
319
|
+
result: toolErrorResult(job.toolCall.function.name, message),
|
|
294
320
|
ok: false,
|
|
295
321
|
durationMs: Math.round(performance.now() - job.startedAt),
|
|
296
|
-
error: { name: "WorkerError", message
|
|
322
|
+
error: { name: "WorkerError", message },
|
|
297
323
|
}, true)
|
|
298
324
|
}
|
|
299
325
|
|