@johpaz/hive 2.0.0 → 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.
Files changed (3) hide show
  1. package/README.md +16 -16
  2. package/dist/hive.js +138 -45
  3. 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.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.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.0 -o /media/usb/hive-image.tar
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.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.0-linux-x64` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.0-linux-x64) |
292
- | Linux ARM64 (Raspberry Pi, etc.) | `hive-v2.0.0-linux-arm64` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.0-linux-arm64) |
293
- | macOS Apple Silicon (M1/M2/M3/M4) | `hive-v2.0.0-macos-arm64` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.0-macos-arm64) |
294
- | macOS Intel | `hive-v2.0.0-macos-x64` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.0-macos-x64) |
295
- | Windows x64 | `hive-v2.0.0-windows-x64.exe` | [Descargar](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.0-windows-x64.exe) |
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.0-linux-x64
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.0-macos-arm64
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.0-macos-x64
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.0-windows-x64.exe`](https://github.com/johpaz/hive/releases/latest/download/hive-v2.0.0-windows-x64.exe) desde GitHub o desde [hiveagents.io](https://www.hiveagents.io/#installation).
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.0-windows-x64.exe start
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.0-windows-x64.exe C:\Windows\System32\hive.exe
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.0-linux-x64 /media/usb/hive
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 { randomUUID as randomUUID2 } from "crypto";
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;
@@ -555622,6 +555623,41 @@ function isSetupMode() {
555622
555623
  return true;
555623
555624
  }
555624
555625
  }
555626
+ function handleSetupProviders(addCorsHeaders, req) {
555627
+ const llmModelsByProvider = new Map;
555628
+ for (const model of SEED_DATA.models) {
555629
+ if (model.modelType !== "llm")
555630
+ continue;
555631
+ if (!llmModelsByProvider.has(model.providerId)) {
555632
+ llmModelsByProvider.set(model.providerId, []);
555633
+ }
555634
+ llmModelsByProvider.get(model.providerId).push({ id: model.id, name: model.name });
555635
+ }
555636
+ const result2 = SEED_DATA.providers.filter((p2) => llmModelsByProvider.has(p2.id) || p2.id === "ollama").map((p2) => ({
555637
+ id: p2.id,
555638
+ name: p2.name,
555639
+ models: llmModelsByProvider.get(p2.id) ?? []
555640
+ }));
555641
+ return addCorsHeaders(Response.json(result2), req);
555642
+ }
555643
+ function handleSetupEthics(addCorsHeaders, req) {
555644
+ try {
555645
+ const db = getDb();
555646
+ const ethics = db.query(`
555647
+ SELECT id, name, description, content, is_default, active FROM ethics ORDER BY id
555648
+ `).all();
555649
+ return addCorsHeaders(Response.json(ethics.map((e) => ({
555650
+ id: e.id,
555651
+ name: e.name,
555652
+ description: e.description,
555653
+ content: e.content,
555654
+ isDefault: e.is_default === 1,
555655
+ active: e.active === 1
555656
+ }))), req);
555657
+ } catch (error50) {
555658
+ return addCorsHeaders(Response.json({ error: error50.message }, { status: 500 }), req);
555659
+ }
555660
+ }
555625
555661
  async function handleSetupStatus() {
555626
555662
  const setupMode = isSetupMode();
555627
555663
  return Response.json({
@@ -555778,21 +555814,20 @@ async function handleCompleteSetup(req, config3, addCorsHeaders) {
555778
555814
  const body = await req.json().catch(() => ({}));
555779
555815
  try {
555780
555816
  initOnboardingDb();
555781
- const userId = `user_${randomUUID2().split("-")[0]}`;
555782
- const agentId = `agent_${randomUUID2().split("-")[0]}`;
555783
- const channelUserId = randomUUID2();
555784
- saveUserProfile({
555785
- userId,
555817
+ const userId = saveUserProfile({
555786
555818
  userName: body.userName || "User",
555787
555819
  userLanguage: body.userLanguage || "es",
555788
555820
  userTimezone: body.userTimezone || "UTC",
555789
555821
  userOccupation: body.userOccupation || "",
555790
- userNotes: body.userNotes || "",
555822
+ userNotes: body.userNotes || ""
555823
+ });
555824
+ const agentId = saveAgentConfig({
555825
+ userId,
555791
555826
  agentName: body.agentName || "Bee",
555792
- agentId,
555793
- agentDescription: body.agentDescription || "",
555794
- agentTone: "friendly",
555795
- channelUserId
555827
+ description: body.agentDescription || "",
555828
+ tone: "friendly",
555829
+ providerId: body.provider || "",
555830
+ modelId: body.model || ""
555796
555831
  });
555797
555832
  if (body.provider && body.apiKey) {
555798
555833
  await saveProviderConfig({
@@ -555804,7 +555839,6 @@ async function handleCompleteSetup(req, config3, addCorsHeaders) {
555804
555839
  }
555805
555840
  await activateChannel(userId, {
555806
555841
  channelId: "webchat",
555807
- channelUserId,
555808
555842
  config: {}
555809
555843
  });
555810
555844
  if (body.channels) {
@@ -555826,9 +555860,29 @@ async function handleCompleteSetup(req, config3, addCorsHeaders) {
555826
555860
  ttsProvider: body.ttsProvider || "elevenlabs"
555827
555861
  });
555828
555862
  }
555829
- activateEthics(userId, "default");
555830
- const authToken = randomUUID2().replace(/-/g, "");
555863
+ if (body.ethicsRules && typeof body.ethicsRules === "object") {
555864
+ for (const [ethicsId, enabled] of Object.entries(body.ethicsRules)) {
555865
+ if (enabled)
555866
+ activateEthics(userId, ethicsId);
555867
+ }
555868
+ } else {
555869
+ activateEthics(userId, "default");
555870
+ }
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 });
555831
555884
  process.env.HIVE_AUTH_TOKEN = authToken;
555885
+ setTimeout(() => process.exit(0), 800);
555832
555886
  return addCorsHeaders(Response.json({
555833
555887
  success: true,
555834
555888
  userId,
@@ -555845,7 +555899,9 @@ async function handleCompleteSetup(req, config3, addCorsHeaders) {
555845
555899
  }
555846
555900
  var init_setup = __esm(() => {
555847
555901
  init_sqlite();
555902
+ init_seed();
555848
555903
  init_onboarding();
555904
+ init_loader();
555849
555905
  });
555850
555906
 
555851
555907
  // packages/core/src/gateway/routes/agents.ts
@@ -556338,8 +556394,8 @@ async function handleCreateSkill(req, addCorsHeaders) {
556338
556394
  if (!name) {
556339
556395
  return addCorsHeaders(new Response("Missing name", { status: 400 }), req);
556340
556396
  }
556341
- const { randomUUID: randomUUID3 } = await import("crypto");
556342
- const id = randomUUID3();
556397
+ const { randomUUID: randomUUID2 } = await import("crypto");
556398
+ const id = randomUUID2();
556343
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);
556344
556400
  return addCorsHeaders(Response.json({ success: true, id }), req);
556345
556401
  }
@@ -556695,8 +556751,8 @@ async function handleCreateChannel(req, addCorsHeaders, channelManager) {
556695
556751
  id = seeded.id;
556696
556752
  getDb().query(`UPDATE channels SET config_encrypted = ?, config_iv = ?, enabled = 1, active = 1, status = 'connecting' WHERE id = ?`).run(encryptedData, configIv, id);
556697
556753
  } else {
556698
- const { randomUUID: randomUUID3 } = await import("crypto");
556699
- id = randomUUID3();
556754
+ const { randomUUID: randomUUID2 } = await import("crypto");
556755
+ id = randomUUID2();
556700
556756
  getDb().query(`
556701
556757
  INSERT INTO channels(id, type, config_encrypted, config_iv, enabled, active, status)
556702
556758
  VALUES(?, ?, ?, ?, 1, 1, 'connecting')
@@ -557823,7 +557879,7 @@ async function handleGetConfig(req, addCorsHeaders, config3) {
557823
557879
  var init_config = () => {};
557824
557880
 
557825
557881
  // packages/core/src/gateway/routes/workspace.ts
557826
- import { mkdirSync as mkdirSync9, existsSync as existsSync17, accessSync as accessSync2, constants as constants2 } from "fs";
557882
+ import { mkdirSync as mkdirSync10, existsSync as existsSync17, accessSync as accessSync2, constants as constants2 } from "fs";
557827
557883
  import * as path28 from "path";
557828
557884
  import { exec as exec2 } from "child_process";
557829
557885
  import { promisify as promisify4 } from "util";
@@ -557902,7 +557958,7 @@ async function handleCreateWorkspace(req, addCorsHeaders) {
557902
557958
  error: "El path debe ser absoluto"
557903
557959
  }), req);
557904
557960
  }
557905
- mkdirSync9(workspacePath, { recursive: true });
557961
+ mkdirSync10(workspacePath, { recursive: true });
557906
557962
  return addCorsHeaders(Response.json({
557907
557963
  ok: true,
557908
557964
  path: workspacePath,
@@ -557978,7 +558034,7 @@ Define ethical guidelines here.`
557978
558034
  async function handleUpdateWorkspace(req, addCorsHeaders, workspacePath, wsType, reloadFn) {
557979
558035
  const content = await req.text();
557980
558036
  const filePath = path28.join(workspacePath, `${wsType.toUpperCase()}.md`);
557981
- mkdirSync9(workspacePath, { recursive: true });
558037
+ mkdirSync10(workspacePath, { recursive: true });
557982
558038
  await Bun.write(filePath, content);
557983
558039
  if (reloadFn) {
557984
558040
  await reloadFn(wsType);
@@ -558056,7 +558112,7 @@ function addCorsHeaders(response, request3) {
558056
558112
  const origin = request3.headers.get("Origin");
558057
558113
  if (!origin)
558058
558114
  return response;
558059
- const isLocalhost = origin.includes("localhost") || origin.includes("127.0.0.1");
558115
+ const isLocalhost = origin.includes("localhost") || origin.includes("127.0.0.1") || origin.includes("0.0.0.0");
558060
558116
  const isCorsOrigin = CORS_ORIGINS.some((o2) => origin.includes(o2.replace("http://", "")));
558061
558117
  if (isCorsOrigin || isLocalhost) {
558062
558118
  const headers = new Headers(response.headers);
@@ -558969,10 +559025,10 @@ var init_scheduled_tasks = __esm(() => {
558969
559025
  });
558970
559026
 
558971
559027
  // packages/core/src/gateway/server.ts
558972
- 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";
558973
559029
  import * as path30 from "path";
558974
559030
  import { cpus as osCpus } from "os";
558975
- import { randomUUID as randomUUID3 } from "crypto";
559031
+ import { randomUUID as randomUUID2 } from "crypto";
558976
559032
  async function startGateway(config3) {
558977
559033
  const host = config3.gateway?.host ?? "127.0.0.1";
558978
559034
  const port = config3.gateway?.port ?? 18790;
@@ -558984,6 +559040,22 @@ async function startGateway(config3) {
558984
559040
  const log69 = logger.child("gateway");
558985
559041
  const mcpLog2 = logger.child("mcp:api");
558986
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
+ }
558987
559059
  let agent;
558988
559060
  let runner;
558989
559061
  let channelManager;
@@ -558995,7 +559067,7 @@ async function startGateway(config3) {
558995
559067
  hostname: host,
558996
559068
  fetch: (req) => {
558997
559069
  const origin = req.headers.get("Origin") ?? "";
558998
- const isLocalhost = origin.includes("localhost") || origin.includes("127.0.0.1");
559070
+ const isLocalhost = origin.includes("localhost") || origin.includes("127.0.0.1") || origin.includes("0.0.0.0");
558999
559071
  const corsHeaders = isLocalhost ? {
559000
559072
  "Access-Control-Allow-Origin": origin,
559001
559073
  "Access-Control-Allow-Methods": "GET, POST, PUT, PATCH, DELETE, OPTIONS",
@@ -559004,13 +559076,18 @@ async function startGateway(config3) {
559004
559076
  } : {};
559005
559077
  if (req.method === "OPTIONS")
559006
559078
  return new Response(null, { status: 204, headers: corsHeaders });
559007
- return Response.json({ status: "starting" }, { headers: corsHeaders });
559079
+ const pathname = new URL(req.url).pathname;
559080
+ if (pathname === "/health" || pathname === "/health/") {
559081
+ return Response.json({ status: "starting" }, { headers: corsHeaders });
559082
+ }
559083
+ return Response.json({ status: "starting" }, { status: 503, headers: corsHeaders });
559008
559084
  },
559009
559085
  websocket: { open() {}, message() {}, close() {} }
559010
559086
  });
559011
559087
  log69.info(`Port ${port} bound (initializing gateway...)`);
559012
559088
  try {
559013
559089
  initializeDatabase();
559090
+ seedAllData();
559014
559091
  } catch {}
559015
559092
  let gatewaySetupMode = false;
559016
559093
  try {
@@ -559246,6 +559323,8 @@ ${messageContent}`;
559246
559323
  function checkAuth(req, url3) {
559247
559324
  if (isDev)
559248
559325
  return true;
559326
+ if (url3.pathname.startsWith("/api/setup/"))
559327
+ return true;
559249
559328
  const activeToken = process.env.HIVE_AUTH_TOKEN;
559250
559329
  if (!activeToken)
559251
559330
  return true;
@@ -559268,7 +559347,7 @@ ${messageContent}`;
559268
559347
  const handleRequest = async () => {
559269
559348
  if (req.method === "OPTIONS") {
559270
559349
  const origin = req.headers.get("Origin");
559271
- if (origin && (origin.includes("localhost") || origin.includes("127.0.0.1") || CORS_ORIGINS.some((o2) => origin.includes(o2.replace("http://", ""))))) {
559350
+ if (origin && (origin.includes("localhost") || origin.includes("127.0.0.1") || origin.includes("0.0.0.0") || CORS_ORIGINS.some((o2) => origin.includes(o2.replace("http://", ""))))) {
559272
559351
  return new Response(null, {
559273
559352
  status: 204,
559274
559353
  headers: {
@@ -559283,10 +559362,17 @@ ${messageContent}`;
559283
559362
  return new Response(null, { status: 204 });
559284
559363
  }
559285
559364
  if (url3.pathname === "/ws" || url3.pathname === "/ws/") {
559286
- if (!isDev && !checkAuth(req, url3)) {
559287
- return new Response("Unauthorized", { status: 401 });
559288
- }
559289
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
+ }
559290
559376
  if (!sessionId) {
559291
559377
  return new Response("Missing session or user ID", { status: 400 });
559292
559378
  }
@@ -559380,11 +559466,17 @@ ${messageContent}`;
559380
559466
  }
559381
559467
  if (!checkAuth(req, url3)) {
559382
559468
  log69.warn(`[AUTH] Unauthorized request to ${url3.pathname} from ${req.headers.get("origin")} `);
559383
- return new Response("Unauthorized", { status: 401 });
559469
+ return addCorsHeaders(new Response("Unauthorized", { status: 401 }), req);
559384
559470
  }
559385
559471
  if (url3.pathname === "/api/setup/status" || url3.pathname === "/api/setup/status/") {
559386
559472
  return addCorsHeaders(await handleSetupStatus(), req);
559387
559473
  }
559474
+ if (url3.pathname === "/api/setup/providers" && req.method === "GET") {
559475
+ return handleSetupProviders(addCorsHeaders, req);
559476
+ }
559477
+ if (url3.pathname === "/api/setup/ethics" && req.method === "GET") {
559478
+ return handleSetupEthics(addCorsHeaders, req);
559479
+ }
559388
559480
  if (url3.pathname === "/api/setup/verify-provider" && req.method === "POST") {
559389
559481
  return addCorsHeaders(await handleVerifyProvider(req), req);
559390
559482
  }
@@ -559630,7 +559722,7 @@ ${messageContent}`;
559630
559722
  const { name, category, tools, triggers, body: bodyContent } = body;
559631
559723
  if (!name)
559632
559724
  return addCorsHeaders(new Response("Missing name", { status: 400 }), req);
559633
- const id = randomUUID3();
559725
+ const id = randomUUID2();
559634
559726
  getDb().query(`INSERT INTO skills(id, name, category, tools, triggers, body, version, active) VALUES(?, ?, ?, ?, ?, ?, 1, 1)`).run(id, name, category || "", tools || "", triggers || "", bodyContent || "");
559635
559727
  return addCorsHeaders(Response.json({ success: true, id }), req);
559636
559728
  }
@@ -559660,7 +559752,7 @@ ${messageContent}`;
559660
559752
  const { name, description, content, is_default: is_default2 } = body;
559661
559753
  if (!name || !content)
559662
559754
  return addCorsHeaders(Response.json({ success: false, error: "Missing name or content" }, { status: 400 }), req);
559663
- const id = randomUUID3();
559755
+ const id = randomUUID2();
559664
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);
559665
559757
  return addCorsHeaders(Response.json({ success: true, id }), req);
559666
559758
  }
@@ -560466,6 +560558,7 @@ var init_server = __esm(() => {
560466
560558
  init_lane_queue();
560467
560559
  init_slash_commands();
560468
560560
  init_sqlite();
560561
+ init_seed();
560469
560562
  init_canvas_manager();
560470
560563
  init_emitter();
560471
560564
  init_bridge_events();
@@ -561936,7 +562029,7 @@ var init_circuit_breaker = __esm(() => {
561936
562029
  circuitBreakerRegistry = new CircuitBreakerRegistry;
561937
562030
  });
561938
562031
  // packages/core/src/plugins/loader.ts
561939
- import { mkdirSync as mkdirSync11, readdirSync as readdirSync5, existsSync as existsSync19 } from "fs";
562032
+ import { mkdirSync as mkdirSync12, readdirSync as readdirSync5, existsSync as existsSync19 } from "fs";
561940
562033
  import * as path31 from "path";
561941
562034
 
561942
562035
  class PluginLoader {
@@ -561951,7 +562044,7 @@ class PluginLoader {
561951
562044
  constructor(options2) {
561952
562045
  this.options = options2;
561953
562046
  if (!existsSync19(options2.pluginDir)) {
561954
- mkdirSync11(options2.pluginDir, { recursive: true });
562047
+ mkdirSync12(options2.pluginDir, { recursive: true });
561955
562048
  }
561956
562049
  }
561957
562050
  async discover() {
@@ -562641,7 +562734,7 @@ __export(exports_gateway, {
562641
562734
  start: () => start,
562642
562735
  reload: () => reload
562643
562736
  });
562644
- import { existsSync as existsSync20, mkdirSync as mkdirSync12, writeFileSync as writeFileSync4, readFileSync as readFileSync9, unlinkSync as unlinkSync5, openSync } from "fs";
562737
+ import { existsSync as existsSync20, mkdirSync as mkdirSync13, writeFileSync as writeFileSync6, readFileSync as readFileSync10, unlinkSync as unlinkSync5, openSync } from "fs";
562645
562738
  import * as path32 from "path";
562646
562739
  import { spawn as spawn5 } from "child_process";
562647
562740
  function cleanup() {
@@ -562676,7 +562769,7 @@ async function getPidFile() {
562676
562769
  function ensureLogDir() {
562677
562770
  const logDir = path32.dirname(getLogFile());
562678
562771
  if (!existsSync20(logDir)) {
562679
- mkdirSync12(logDir, { recursive: true });
562772
+ mkdirSync13(logDir, { recursive: true });
562680
562773
  }
562681
562774
  }
562682
562775
  function openBrowser(url3) {
@@ -562714,7 +562807,7 @@ async function isRunning() {
562714
562807
  const pidFile = await getPidFile();
562715
562808
  if (!existsSync20(pidFile))
562716
562809
  return false;
562717
- const pid = parseInt(readFileSync9(pidFile, "utf-8").trim(), 10);
562810
+ const pid = parseInt(readFileSync10(pidFile, "utf-8").trim(), 10);
562718
562811
  if (isNaN(pid))
562719
562812
  return false;
562720
562813
  try {
@@ -562787,7 +562880,7 @@ async function start(flags) {
562787
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
562788
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
562789
562882
  \u2551 \u2551
562790
- \u2551 Personal Swarm AI Gateway \u2014 v2.0.0 \u2551
562883
+ \u2551 Personal Swarm AI Gateway \u2014 v2.0.2 \u2551
562791
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
562792
562885
  `);
562793
562886
  }
@@ -562799,7 +562892,7 @@ async function start(flags) {
562799
562892
  stdio: ["ignore", openSync(logFile, "a"), openSync(logFile, "a")]
562800
562893
  });
562801
562894
  child.unref();
562802
- writeFileSync4(await getPidFile(), child.pid?.toString() || "");
562895
+ writeFileSync6(await getPidFile(), child.pid?.toString() || "");
562803
562896
  console.log(`\u2705 Hive Gateway iniciado en modo daemon (PID: ${child.pid})`);
562804
562897
  console.log(` Logs: ${logFile}`);
562805
562898
  return;
@@ -562932,7 +563025,7 @@ async function stop() {
562932
563025
  return;
562933
563026
  }
562934
563027
  const pidFile = await getPidFile();
562935
- const pid = parseInt(readFileSync9(pidFile, "utf-8").trim(), 10);
563028
+ const pid = parseInt(readFileSync10(pidFile, "utf-8").trim(), 10);
562936
563029
  try {
562937
563030
  process.kill(pid, "SIGTERM");
562938
563031
  unlinkSync5(pidFile);
@@ -562950,7 +563043,7 @@ async function status(flags) {
562950
563043
  const pidFile = await getPidFile();
562951
563044
  console.log(`Estado: ${running ? "\u2705 Corriendo" : "\u23F9\uFE0F Detenido"}`);
562952
563045
  if (running) {
562953
- const pid = readFileSync9(pidFile, "utf-8").trim();
563046
+ const pid = readFileSync10(pidFile, "utf-8").trim();
562954
563047
  console.log(`PID: ${pid}`);
562955
563048
  }
562956
563049
  console.log(`Puerto: ${config4.gateway?.port || 18790}`);
@@ -562962,7 +563055,7 @@ async function status(flags) {
562962
563055
  console.log(`Logs: ${getLogFile()}`);
562963
563056
  if (flags.includes("--json")) {
562964
563057
  console.log(`
562965
- ` + JSON.stringify({ running, pid: running ? readFileSync9(pidFile, "utf-8").trim() : null, config: config4 }, null, 2));
563058
+ ` + JSON.stringify({ running, pid: running ? readFileSync10(pidFile, "utf-8").trim() : null, config: config4 }, null, 2));
562966
563059
  }
562967
563060
  }
562968
563061
  async function reload() {
@@ -562970,7 +563063,7 @@ async function reload() {
562970
563063
  console.log("\u26A0\uFE0F Hive Gateway no est\xE1 corriendo");
562971
563064
  return;
562972
563065
  }
562973
- const pid = parseInt(readFileSync9(await getPidFile(), "utf-8").trim(), 10);
563066
+ const pid = parseInt(readFileSync10(await getPidFile(), "utf-8").trim(), 10);
562974
563067
  try {
562975
563068
  process.kill(pid, "SIGHUP");
562976
563069
  console.log("\u2705 Configuraci\xF3n recargada");
@@ -564997,7 +565090,7 @@ async function executeAsync(gatewayUrl, payload, spinner) {
564997
565090
  }
564998
565091
 
564999
565092
  // packages/cli/src/index.ts
565000
- var VERSION4 = "2.0.0";
565093
+ var VERSION4 = "2.0.2";
565001
565094
  var HELP = `
565002
565095
  \uD83D\uDC1D Hive \u2014 Personal Swarm AI Gateway v${VERSION4}
565003
565096
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johpaz/hive",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
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": {