@johpaz/hive 2.0.1 → 2.0.2
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 +77 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,7 +114,7 @@ docker run -d \
|
|
|
114
114
|
-v hive-data:/root/.hive \
|
|
115
115
|
--name hive \
|
|
116
116
|
--restart unless-stopped \
|
|
117
|
-
johpaz/hive:2.0.
|
|
117
|
+
johpaz/hive:2.0.2
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
**Variables de entorno disponibles:**
|
|
@@ -188,10 +188,10 @@ En el equipo donde tienes conexión a internet:
|
|
|
188
188
|
|
|
189
189
|
```bash
|
|
190
190
|
# Descargar la imagen si no la tienes
|
|
191
|
-
docker pull johpaz/hive:2.0.
|
|
191
|
+
docker pull johpaz/hive:2.0.2
|
|
192
192
|
|
|
193
193
|
# Exportar a archivo tar (cabe en cualquier USB de 512 MB+)
|
|
194
|
-
docker save johpaz/hive:2.0.
|
|
194
|
+
docker save johpaz/hive:2.0.2 -o /media/usb/hive-image.tar
|
|
195
195
|
```
|
|
196
196
|
|
|
197
197
|
**Paso 2 — Crear la estructura en la USB**
|
|
@@ -209,7 +209,7 @@ Crea el `docker-compose.yml` en la USB con el volumen apuntando a la USB:
|
|
|
209
209
|
```yaml
|
|
210
210
|
services:
|
|
211
211
|
hive:
|
|
212
|
-
image: johpaz/hive:2.0.
|
|
212
|
+
image: johpaz/hive:2.0.2
|
|
213
213
|
ports:
|
|
214
214
|
- "18790:18790"
|
|
215
215
|
volumes:
|
|
@@ -288,11 +288,11 @@ Descarga manual de cualquier plataforma o versión específica.
|
|
|
288
288
|
|
|
289
289
|
| Plataforma | Archivo | Descarga directa |
|
|
290
290
|
|------------|---------|------------------|
|
|
291
|
-
| Linux x64 | `hive-v2.0.
|
|
292
|
-
| Linux ARM64 (Raspberry Pi, etc.) | `hive-v2.0.
|
|
293
|
-
| macOS Apple Silicon (M1/M2/M3/M4) | `hive-v2.0.
|
|
294
|
-
| macOS Intel | `hive-v2.0.
|
|
295
|
-
| Windows x64 | `hive-v2.0.
|
|
291
|
+
| Linux x64 | `hive-v2.0.2-linux-x64` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-linux-x64) |
|
|
292
|
+
| Linux ARM64 (Raspberry Pi, etc.) | `hive-v2.0.2-linux-arm64` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-linux-arm64) |
|
|
293
|
+
| macOS Apple Silicon (M1/M2/M3/M4) | `hive-v2.0.2-macos-arm64` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-macos-arm64) |
|
|
294
|
+
| macOS Intel | `hive-v2.0.2-macos-x64` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-macos-x64) |
|
|
295
|
+
| Windows x64 | `hive-v2.0.2-windows-x64.exe` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-windows-x64.exe) |
|
|
296
296
|
|
|
297
297
|
> Los links anteriores siempre apuntan a la última versión publicada. Si necesitas una versión específica, visita la [página de releases](https://github.com/johpaz/hive/releases).
|
|
298
298
|
|
|
@@ -302,7 +302,7 @@ Descarga manual de cualquier plataforma o versión específica.
|
|
|
302
302
|
|
|
303
303
|
```bash
|
|
304
304
|
# 1. Descargar el binario (reemplaza "linux-x64" por "linux-arm64" si es ARM)
|
|
305
|
-
curl -L -o hive https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.
|
|
305
|
+
curl -L -o hive https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-linux-x64
|
|
306
306
|
|
|
307
307
|
# 2. Dar permisos de ejecución
|
|
308
308
|
chmod +x hive
|
|
@@ -334,7 +334,7 @@ hive start
|
|
|
334
334
|
|
|
335
335
|
```bash
|
|
336
336
|
# 1. Descargar
|
|
337
|
-
curl -L -o hive https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.
|
|
337
|
+
curl -L -o hive https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-macos-arm64
|
|
338
338
|
|
|
339
339
|
# 2. Dar permisos de ejecución
|
|
340
340
|
chmod +x hive
|
|
@@ -374,7 +374,7 @@ hive start
|
|
|
374
374
|
Igual que Apple Silicon pero descarga `macos-x64`:
|
|
375
375
|
|
|
376
376
|
```bash
|
|
377
|
-
curl -L -o hive https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.
|
|
377
|
+
curl -L -o hive https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-macos-x64
|
|
378
378
|
chmod +x hive
|
|
379
379
|
xattr -d com.apple.quarantine hive
|
|
380
380
|
curl -L https://github.com/johpaz/hive/releases/latest/download/ui-dist.tar.gz \
|
|
@@ -389,7 +389,7 @@ mkdir -p ~/.hive/ui && cp -r ui-dist/* ~/.hive/ui/
|
|
|
389
389
|
|
|
390
390
|
**Paso 1 — Descargar el binario**
|
|
391
391
|
|
|
392
|
-
Descarga [`hive-v2.0.
|
|
392
|
+
Descarga [`hive-v2.0.2-windows-x64.exe`](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.2-windows-x64.exe) desde GitHub o desde [hiveagents.io](https://www.hiveagents.io/#installation).
|
|
393
393
|
|
|
394
394
|
**Paso 2 — Windows SmartScreen**
|
|
395
395
|
|
|
@@ -419,7 +419,7 @@ tar -xzf ui-dist.tar.gz -C "$env:USERPROFILE\.hive\ui"
|
|
|
419
419
|
**Paso 4 — Ejecutar**
|
|
420
420
|
|
|
421
421
|
```powershell
|
|
422
|
-
.\hive-v2.0.
|
|
422
|
+
.\hive-v2.0.2-windows-x64.exe start
|
|
423
423
|
```
|
|
424
424
|
|
|
425
425
|
El navegador se abre automáticamente en `http://localhost:18790`.
|
|
@@ -428,7 +428,7 @@ El navegador se abre automáticamente en `http://localhost:18790`.
|
|
|
428
428
|
|
|
429
429
|
```powershell
|
|
430
430
|
# Mover a una carpeta ya en el PATH, por ejemplo:
|
|
431
|
-
Move-Item .\hive-v2.0.
|
|
431
|
+
Move-Item .\hive-v2.0.2-windows-x64.exe C:\Windows\System32\hive.exe
|
|
432
432
|
|
|
433
433
|
# Luego ejecutar desde cualquier lugar:
|
|
434
434
|
hive start
|
|
@@ -479,7 +479,7 @@ El binario standalone es ideal para llevarlo en una USB. Tu agente viaja contigo
|
|
|
479
479
|
**Preparar la USB:**
|
|
480
480
|
|
|
481
481
|
```bash
|
|
482
|
-
cp hive-v2.0.
|
|
482
|
+
cp hive-v2.0.2-linux-x64 /media/usb/hive
|
|
483
483
|
chmod +x /media/usb/hive
|
|
484
484
|
cp -r ui-dist/* /media/usb/ui/
|
|
485
485
|
|
package/dist/hive.js
CHANGED
|
@@ -313669,6 +313669,7 @@ class BrowserService {
|
|
|
313669
313669
|
const puppeteer3 = await Promise.resolve().then(() => (init_puppeteer2(), exports_puppeteer2));
|
|
313670
313670
|
this.browser = await puppeteer3.launch({
|
|
313671
313671
|
headless: true,
|
|
313672
|
+
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH,
|
|
313672
313673
|
args: [
|
|
313673
313674
|
"--no-sandbox",
|
|
313674
313675
|
"--disable-setuid-sandbox",
|
|
@@ -555613,7 +555614,7 @@ var init_initializer = __esm(() => {
|
|
|
555613
555614
|
});
|
|
555614
555615
|
|
|
555615
555616
|
// packages/core/src/gateway/routes/setup.ts
|
|
555616
|
-
import {
|
|
555617
|
+
import { writeFileSync as writeFileSync4, mkdirSync as mkdirSync9 } from "fs";
|
|
555617
555618
|
function isSetupMode() {
|
|
555618
555619
|
try {
|
|
555619
555620
|
const count = getDb().query("SELECT COUNT(*) as count FROM users").get().count;
|
|
@@ -555813,21 +555814,20 @@ async function handleCompleteSetup(req, config3, addCorsHeaders) {
|
|
|
555813
555814
|
const body = await req.json().catch(() => ({}));
|
|
555814
555815
|
try {
|
|
555815
555816
|
initOnboardingDb();
|
|
555816
|
-
const userId =
|
|
555817
|
-
const agentId = `agent_${randomUUID2().split("-")[0]}`;
|
|
555818
|
-
const channelUserId = randomUUID2();
|
|
555819
|
-
saveUserProfile({
|
|
555820
|
-
userId,
|
|
555817
|
+
const userId = saveUserProfile({
|
|
555821
555818
|
userName: body.userName || "User",
|
|
555822
555819
|
userLanguage: body.userLanguage || "es",
|
|
555823
555820
|
userTimezone: body.userTimezone || "UTC",
|
|
555824
555821
|
userOccupation: body.userOccupation || "",
|
|
555825
|
-
userNotes: body.userNotes || ""
|
|
555822
|
+
userNotes: body.userNotes || ""
|
|
555823
|
+
});
|
|
555824
|
+
const agentId = saveAgentConfig({
|
|
555825
|
+
userId,
|
|
555826
555826
|
agentName: body.agentName || "Bee",
|
|
555827
|
-
|
|
555828
|
-
|
|
555829
|
-
|
|
555830
|
-
|
|
555827
|
+
description: body.agentDescription || "",
|
|
555828
|
+
tone: "friendly",
|
|
555829
|
+
providerId: body.provider || "",
|
|
555830
|
+
modelId: body.model || ""
|
|
555831
555831
|
});
|
|
555832
555832
|
if (body.provider && body.apiKey) {
|
|
555833
555833
|
await saveProviderConfig({
|
|
@@ -555839,7 +555839,6 @@ async function handleCompleteSetup(req, config3, addCorsHeaders) {
|
|
|
555839
555839
|
}
|
|
555840
555840
|
await activateChannel(userId, {
|
|
555841
555841
|
channelId: "webchat",
|
|
555842
|
-
channelUserId,
|
|
555843
555842
|
config: {}
|
|
555844
555843
|
});
|
|
555845
555844
|
if (body.channels) {
|
|
@@ -555869,7 +555868,19 @@ async function handleCompleteSetup(req, config3, addCorsHeaders) {
|
|
|
555869
555868
|
} else {
|
|
555870
555869
|
activateEthics(userId, "default");
|
|
555871
555870
|
}
|
|
555872
|
-
const authToken =
|
|
555871
|
+
const authToken = userId;
|
|
555872
|
+
const hiveDir = getHiveDir();
|
|
555873
|
+
const envContent = [
|
|
555874
|
+
"# Hive configuration \u2014 auto-generated during setup",
|
|
555875
|
+
`HIVE_HOST=${process.env.HIVE_HOST || "0.0.0.0"}`,
|
|
555876
|
+
`HIVE_PORT=${process.env.HIVE_PORT || "18790"}`,
|
|
555877
|
+
`HIVE_LOG_LEVEL=${process.env.HIVE_LOG_LEVEL || "info"}`,
|
|
555878
|
+
`HIVE_AUTH_TOKEN=${authToken}`,
|
|
555879
|
+
""
|
|
555880
|
+
].join(`
|
|
555881
|
+
`);
|
|
555882
|
+
mkdirSync9(hiveDir, { recursive: true });
|
|
555883
|
+
writeFileSync4(`${hiveDir}/.env`, envContent, { mode: 384 });
|
|
555873
555884
|
process.env.HIVE_AUTH_TOKEN = authToken;
|
|
555874
555885
|
setTimeout(() => process.exit(0), 800);
|
|
555875
555886
|
return addCorsHeaders(Response.json({
|
|
@@ -555890,6 +555901,7 @@ var init_setup = __esm(() => {
|
|
|
555890
555901
|
init_sqlite();
|
|
555891
555902
|
init_seed();
|
|
555892
555903
|
init_onboarding();
|
|
555904
|
+
init_loader();
|
|
555893
555905
|
});
|
|
555894
555906
|
|
|
555895
555907
|
// packages/core/src/gateway/routes/agents.ts
|
|
@@ -556382,8 +556394,8 @@ async function handleCreateSkill(req, addCorsHeaders) {
|
|
|
556382
556394
|
if (!name) {
|
|
556383
556395
|
return addCorsHeaders(new Response("Missing name", { status: 400 }), req);
|
|
556384
556396
|
}
|
|
556385
|
-
const { randomUUID:
|
|
556386
|
-
const id =
|
|
556397
|
+
const { randomUUID: randomUUID2 } = await import("crypto");
|
|
556398
|
+
const id = randomUUID2();
|
|
556387
556399
|
getDb().query(`INSERT INTO skills(id, name, category, tools, triggers, body, version, active) VALUES(?, ?, ?, ?, ?, ?, 1, 1)`).run(id, name, category || "", tools || "", triggers || "", bodyContent || "", 1);
|
|
556388
556400
|
return addCorsHeaders(Response.json({ success: true, id }), req);
|
|
556389
556401
|
}
|
|
@@ -556739,8 +556751,8 @@ async function handleCreateChannel(req, addCorsHeaders, channelManager) {
|
|
|
556739
556751
|
id = seeded.id;
|
|
556740
556752
|
getDb().query(`UPDATE channels SET config_encrypted = ?, config_iv = ?, enabled = 1, active = 1, status = 'connecting' WHERE id = ?`).run(encryptedData, configIv, id);
|
|
556741
556753
|
} else {
|
|
556742
|
-
const { randomUUID:
|
|
556743
|
-
id =
|
|
556754
|
+
const { randomUUID: randomUUID2 } = await import("crypto");
|
|
556755
|
+
id = randomUUID2();
|
|
556744
556756
|
getDb().query(`
|
|
556745
556757
|
INSERT INTO channels(id, type, config_encrypted, config_iv, enabled, active, status)
|
|
556746
556758
|
VALUES(?, ?, ?, ?, 1, 1, 'connecting')
|
|
@@ -557867,7 +557879,7 @@ async function handleGetConfig(req, addCorsHeaders, config3) {
|
|
|
557867
557879
|
var init_config = () => {};
|
|
557868
557880
|
|
|
557869
557881
|
// packages/core/src/gateway/routes/workspace.ts
|
|
557870
|
-
import { mkdirSync as
|
|
557882
|
+
import { mkdirSync as mkdirSync10, existsSync as existsSync17, accessSync as accessSync2, constants as constants2 } from "fs";
|
|
557871
557883
|
import * as path28 from "path";
|
|
557872
557884
|
import { exec as exec2 } from "child_process";
|
|
557873
557885
|
import { promisify as promisify4 } from "util";
|
|
@@ -557946,7 +557958,7 @@ async function handleCreateWorkspace(req, addCorsHeaders) {
|
|
|
557946
557958
|
error: "El path debe ser absoluto"
|
|
557947
557959
|
}), req);
|
|
557948
557960
|
}
|
|
557949
|
-
|
|
557961
|
+
mkdirSync10(workspacePath, { recursive: true });
|
|
557950
557962
|
return addCorsHeaders(Response.json({
|
|
557951
557963
|
ok: true,
|
|
557952
557964
|
path: workspacePath,
|
|
@@ -558022,7 +558034,7 @@ Define ethical guidelines here.`
|
|
|
558022
558034
|
async function handleUpdateWorkspace(req, addCorsHeaders, workspacePath, wsType, reloadFn) {
|
|
558023
558035
|
const content = await req.text();
|
|
558024
558036
|
const filePath = path28.join(workspacePath, `${wsType.toUpperCase()}.md`);
|
|
558025
|
-
|
|
558037
|
+
mkdirSync10(workspacePath, { recursive: true });
|
|
558026
558038
|
await Bun.write(filePath, content);
|
|
558027
558039
|
if (reloadFn) {
|
|
558028
558040
|
await reloadFn(wsType);
|
|
@@ -559013,10 +559025,10 @@ var init_scheduled_tasks = __esm(() => {
|
|
|
559013
559025
|
});
|
|
559014
559026
|
|
|
559015
559027
|
// packages/core/src/gateway/server.ts
|
|
559016
|
-
import { unlinkSync as unlinkSync4, existsSync as existsSync18 } from "fs";
|
|
559028
|
+
import { mkdirSync as mkdirSync11, unlinkSync as unlinkSync4, existsSync as existsSync18, writeFileSync as writeFileSync5, readFileSync as readFileSync9 } from "fs";
|
|
559017
559029
|
import * as path30 from "path";
|
|
559018
559030
|
import { cpus as osCpus } from "os";
|
|
559019
|
-
import { randomUUID as
|
|
559031
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
559020
559032
|
async function startGateway(config3) {
|
|
559021
559033
|
const host = config3.gateway?.host ?? "127.0.0.1";
|
|
559022
559034
|
const port = config3.gateway?.port ?? 18790;
|
|
@@ -559028,6 +559040,22 @@ async function startGateway(config3) {
|
|
|
559028
559040
|
const log69 = logger.child("gateway");
|
|
559029
559041
|
const mcpLog2 = logger.child("mcp:api");
|
|
559030
559042
|
log69.info(`Starting gateway on ${host}:${port}`);
|
|
559043
|
+
const tokenFile = path30.join(getHiveDir(), ".auth_token");
|
|
559044
|
+
if (!process.env.HIVE_AUTH_TOKEN) {
|
|
559045
|
+
if (existsSync18(tokenFile)) {
|
|
559046
|
+
process.env.HIVE_AUTH_TOKEN = readFileSync9(tokenFile, "utf-8").trim();
|
|
559047
|
+
log69.info("\uD83D\uDD11 Auth token loaded from persistent storage");
|
|
559048
|
+
} else {
|
|
559049
|
+
const generated = randomUUID2().replace(/-/g, "");
|
|
559050
|
+
process.env.HIVE_AUTH_TOKEN = generated;
|
|
559051
|
+
mkdirSync11(path30.dirname(tokenFile), { recursive: true });
|
|
559052
|
+
writeFileSync5(tokenFile, generated, { mode: 384 });
|
|
559053
|
+
log69.info("\uD83D\uDD11 Auth token auto-generated and persisted");
|
|
559054
|
+
}
|
|
559055
|
+
} else {
|
|
559056
|
+
writeFileSync5(tokenFile, process.env.HIVE_AUTH_TOKEN, { mode: 384 });
|
|
559057
|
+
log69.info("\uD83D\uDD11 Auth token loaded from environment variable");
|
|
559058
|
+
}
|
|
559031
559059
|
let agent;
|
|
559032
559060
|
let runner;
|
|
559033
559061
|
let channelManager;
|
|
@@ -559295,6 +559323,8 @@ ${messageContent}`;
|
|
|
559295
559323
|
function checkAuth(req, url3) {
|
|
559296
559324
|
if (isDev)
|
|
559297
559325
|
return true;
|
|
559326
|
+
if (url3.pathname.startsWith("/api/setup/"))
|
|
559327
|
+
return true;
|
|
559298
559328
|
const activeToken = process.env.HIVE_AUTH_TOKEN;
|
|
559299
559329
|
if (!activeToken)
|
|
559300
559330
|
return true;
|
|
@@ -559332,10 +559362,17 @@ ${messageContent}`;
|
|
|
559332
559362
|
return new Response(null, { status: 204 });
|
|
559333
559363
|
}
|
|
559334
559364
|
if (url3.pathname === "/ws" || url3.pathname === "/ws/") {
|
|
559335
|
-
if (!isDev && !checkAuth(req, url3)) {
|
|
559336
|
-
return new Response("Unauthorized", { status: 401 });
|
|
559337
|
-
}
|
|
559338
559365
|
const sessionId = url3.searchParams.get("session") || resolveUserId({}) || "default";
|
|
559366
|
+
if (!isDev) {
|
|
559367
|
+
try {
|
|
559368
|
+
const userExists = getDb().query("SELECT 1 FROM users WHERE id = ? LIMIT 1").get(sessionId);
|
|
559369
|
+
if (!userExists) {
|
|
559370
|
+
return new Response("Unauthorized", { status: 401 });
|
|
559371
|
+
}
|
|
559372
|
+
} catch {
|
|
559373
|
+
return new Response("Unauthorized", { status: 401 });
|
|
559374
|
+
}
|
|
559375
|
+
}
|
|
559339
559376
|
if (!sessionId) {
|
|
559340
559377
|
return new Response("Missing session or user ID", { status: 400 });
|
|
559341
559378
|
}
|
|
@@ -559429,7 +559466,7 @@ ${messageContent}`;
|
|
|
559429
559466
|
}
|
|
559430
559467
|
if (!checkAuth(req, url3)) {
|
|
559431
559468
|
log69.warn(`[AUTH] Unauthorized request to ${url3.pathname} from ${req.headers.get("origin")} `);
|
|
559432
|
-
return new Response("Unauthorized", { status: 401 });
|
|
559469
|
+
return addCorsHeaders(new Response("Unauthorized", { status: 401 }), req);
|
|
559433
559470
|
}
|
|
559434
559471
|
if (url3.pathname === "/api/setup/status" || url3.pathname === "/api/setup/status/") {
|
|
559435
559472
|
return addCorsHeaders(await handleSetupStatus(), req);
|
|
@@ -559685,7 +559722,7 @@ ${messageContent}`;
|
|
|
559685
559722
|
const { name, category, tools, triggers, body: bodyContent } = body;
|
|
559686
559723
|
if (!name)
|
|
559687
559724
|
return addCorsHeaders(new Response("Missing name", { status: 400 }), req);
|
|
559688
|
-
const id =
|
|
559725
|
+
const id = randomUUID2();
|
|
559689
559726
|
getDb().query(`INSERT INTO skills(id, name, category, tools, triggers, body, version, active) VALUES(?, ?, ?, ?, ?, ?, 1, 1)`).run(id, name, category || "", tools || "", triggers || "", bodyContent || "");
|
|
559690
559727
|
return addCorsHeaders(Response.json({ success: true, id }), req);
|
|
559691
559728
|
}
|
|
@@ -559715,7 +559752,7 @@ ${messageContent}`;
|
|
|
559715
559752
|
const { name, description, content, is_default: is_default2 } = body;
|
|
559716
559753
|
if (!name || !content)
|
|
559717
559754
|
return addCorsHeaders(Response.json({ success: false, error: "Missing name or content" }, { status: 400 }), req);
|
|
559718
|
-
const id =
|
|
559755
|
+
const id = randomUUID2();
|
|
559719
559756
|
getDb().query(`INSERT INTO ethics(id, name, description, content, is_default, enabled, active) VALUES(?, ?, ?, ?, ?, 1, 1)`).run(id, name, description || "", content, is_default2 ? 1 : 0);
|
|
559720
559757
|
return addCorsHeaders(Response.json({ success: true, id }), req);
|
|
559721
559758
|
}
|
|
@@ -561992,7 +562029,7 @@ var init_circuit_breaker = __esm(() => {
|
|
|
561992
562029
|
circuitBreakerRegistry = new CircuitBreakerRegistry;
|
|
561993
562030
|
});
|
|
561994
562031
|
// packages/core/src/plugins/loader.ts
|
|
561995
|
-
import { mkdirSync as
|
|
562032
|
+
import { mkdirSync as mkdirSync12, readdirSync as readdirSync5, existsSync as existsSync19 } from "fs";
|
|
561996
562033
|
import * as path31 from "path";
|
|
561997
562034
|
|
|
561998
562035
|
class PluginLoader {
|
|
@@ -562007,7 +562044,7 @@ class PluginLoader {
|
|
|
562007
562044
|
constructor(options2) {
|
|
562008
562045
|
this.options = options2;
|
|
562009
562046
|
if (!existsSync19(options2.pluginDir)) {
|
|
562010
|
-
|
|
562047
|
+
mkdirSync12(options2.pluginDir, { recursive: true });
|
|
562011
562048
|
}
|
|
562012
562049
|
}
|
|
562013
562050
|
async discover() {
|
|
@@ -562697,7 +562734,7 @@ __export(exports_gateway, {
|
|
|
562697
562734
|
start: () => start,
|
|
562698
562735
|
reload: () => reload
|
|
562699
562736
|
});
|
|
562700
|
-
import { existsSync as existsSync20, mkdirSync as
|
|
562737
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync13, writeFileSync as writeFileSync6, readFileSync as readFileSync10, unlinkSync as unlinkSync5, openSync } from "fs";
|
|
562701
562738
|
import * as path32 from "path";
|
|
562702
562739
|
import { spawn as spawn5 } from "child_process";
|
|
562703
562740
|
function cleanup() {
|
|
@@ -562732,7 +562769,7 @@ async function getPidFile() {
|
|
|
562732
562769
|
function ensureLogDir() {
|
|
562733
562770
|
const logDir = path32.dirname(getLogFile());
|
|
562734
562771
|
if (!existsSync20(logDir)) {
|
|
562735
|
-
|
|
562772
|
+
mkdirSync13(logDir, { recursive: true });
|
|
562736
562773
|
}
|
|
562737
562774
|
}
|
|
562738
562775
|
function openBrowser(url3) {
|
|
@@ -562770,7 +562807,7 @@ async function isRunning() {
|
|
|
562770
562807
|
const pidFile = await getPidFile();
|
|
562771
562808
|
if (!existsSync20(pidFile))
|
|
562772
562809
|
return false;
|
|
562773
|
-
const pid = parseInt(
|
|
562810
|
+
const pid = parseInt(readFileSync10(pidFile, "utf-8").trim(), 10);
|
|
562774
562811
|
if (isNaN(pid))
|
|
562775
562812
|
return false;
|
|
562776
562813
|
try {
|
|
@@ -562843,7 +562880,7 @@ async function start(flags) {
|
|
|
562843
562880
|
\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
562844
562881
|
\u2551 \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551
|
|
562845
562882
|
\u2551 \u2551
|
|
562846
|
-
\u2551 Personal Swarm AI Gateway \u2014 v2.0.
|
|
562883
|
+
\u2551 Personal Swarm AI Gateway \u2014 v2.0.2 \u2551
|
|
562847
562884
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
562848
562885
|
`);
|
|
562849
562886
|
}
|
|
@@ -562855,7 +562892,7 @@ async function start(flags) {
|
|
|
562855
562892
|
stdio: ["ignore", openSync(logFile, "a"), openSync(logFile, "a")]
|
|
562856
562893
|
});
|
|
562857
562894
|
child.unref();
|
|
562858
|
-
|
|
562895
|
+
writeFileSync6(await getPidFile(), child.pid?.toString() || "");
|
|
562859
562896
|
console.log(`\u2705 Hive Gateway iniciado en modo daemon (PID: ${child.pid})`);
|
|
562860
562897
|
console.log(` Logs: ${logFile}`);
|
|
562861
562898
|
return;
|
|
@@ -562988,7 +563025,7 @@ async function stop() {
|
|
|
562988
563025
|
return;
|
|
562989
563026
|
}
|
|
562990
563027
|
const pidFile = await getPidFile();
|
|
562991
|
-
const pid = parseInt(
|
|
563028
|
+
const pid = parseInt(readFileSync10(pidFile, "utf-8").trim(), 10);
|
|
562992
563029
|
try {
|
|
562993
563030
|
process.kill(pid, "SIGTERM");
|
|
562994
563031
|
unlinkSync5(pidFile);
|
|
@@ -563006,7 +563043,7 @@ async function status(flags) {
|
|
|
563006
563043
|
const pidFile = await getPidFile();
|
|
563007
563044
|
console.log(`Estado: ${running ? "\u2705 Corriendo" : "\u23F9\uFE0F Detenido"}`);
|
|
563008
563045
|
if (running) {
|
|
563009
|
-
const pid =
|
|
563046
|
+
const pid = readFileSync10(pidFile, "utf-8").trim();
|
|
563010
563047
|
console.log(`PID: ${pid}`);
|
|
563011
563048
|
}
|
|
563012
563049
|
console.log(`Puerto: ${config4.gateway?.port || 18790}`);
|
|
@@ -563018,7 +563055,7 @@ async function status(flags) {
|
|
|
563018
563055
|
console.log(`Logs: ${getLogFile()}`);
|
|
563019
563056
|
if (flags.includes("--json")) {
|
|
563020
563057
|
console.log(`
|
|
563021
|
-
` + JSON.stringify({ running, pid: running ?
|
|
563058
|
+
` + JSON.stringify({ running, pid: running ? readFileSync10(pidFile, "utf-8").trim() : null, config: config4 }, null, 2));
|
|
563022
563059
|
}
|
|
563023
563060
|
}
|
|
563024
563061
|
async function reload() {
|
|
@@ -563026,7 +563063,7 @@ async function reload() {
|
|
|
563026
563063
|
console.log("\u26A0\uFE0F Hive Gateway no est\xE1 corriendo");
|
|
563027
563064
|
return;
|
|
563028
563065
|
}
|
|
563029
|
-
const pid = parseInt(
|
|
563066
|
+
const pid = parseInt(readFileSync10(await getPidFile(), "utf-8").trim(), 10);
|
|
563030
563067
|
try {
|
|
563031
563068
|
process.kill(pid, "SIGHUP");
|
|
563032
563069
|
console.log("\u2705 Configuraci\xF3n recargada");
|
|
@@ -565053,7 +565090,7 @@ async function executeAsync(gatewayUrl, payload, spinner) {
|
|
|
565053
565090
|
}
|
|
565054
565091
|
|
|
565055
565092
|
// packages/cli/src/index.ts
|
|
565056
|
-
var VERSION4 = "2.0.
|
|
565093
|
+
var VERSION4 = "2.0.2";
|
|
565057
565094
|
var HELP = `
|
|
565058
565095
|
\uD83D\uDC1D Hive \u2014 Personal Swarm AI Gateway v${VERSION4}
|
|
565059
565096
|
|