@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/dist/hive.js CHANGED
@@ -231350,7 +231350,23 @@ var init_context_compiler = __esm(() => {
231350
231350
  });
231351
231351
 
231352
231352
  // packages/core/src/tool-runtime/index.ts
231353
+ import { existsSync as existsSync23 } from "fs";
231354
+ import { fileURLToPath } from "url";
231353
231355
  import { availableParallelism as availableParallelism2 } from "os";
231356
+ function resolveWorkerEntry() {
231357
+ const candidates = [
231358
+ new URL("./tool-worker.js", import.meta.url),
231359
+ new URL("./tool-worker.ts", import.meta.url),
231360
+ new URL("../packages/core/src/tool-runtime/tool-worker.js", import.meta.url),
231361
+ new URL("../packages/core/src/tool-runtime/tool-worker.ts", import.meta.url)
231362
+ ];
231363
+ for (const candidate of candidates) {
231364
+ if (existsSync23(fileURLToPath(candidate))) {
231365
+ return candidate.href;
231366
+ }
231367
+ }
231368
+ throw new Error(`Tool worker entry not found. Tried: ${candidates.map((candidate) => fileURLToPath(candidate)).join(", ")}`);
231369
+ }
231354
231370
  function serializeError(error54) {
231355
231371
  const err = error54 instanceof Error ? error54 : new Error(String(error54));
231356
231372
  return {
@@ -231462,7 +231478,7 @@ class ToolWorkerPool {
231462
231478
  return slot;
231463
231479
  }
231464
231480
  createSlot() {
231465
- const worker = new Worker(new URL("./tool-worker.ts", import.meta.url).href, { type: "module" });
231481
+ const worker = new Worker(resolveWorkerEntry(), { type: "module" });
231466
231482
  const slot = { worker, busy: false };
231467
231483
  worker.onmessage = (event) => {
231468
231484
  const message = event.data;
@@ -231486,13 +231502,15 @@ class ToolWorkerPool {
231486
231502
  const job = slot.job;
231487
231503
  if (!job)
231488
231504
  return;
231505
+ const location = [event.filename, event.lineno, event.colno].filter(Boolean).join(":");
231506
+ const message = location ? `${event.message || "Tool worker failed"} (${location})` : event.message || "Tool worker failed";
231489
231507
  this.finishJob(slot, {
231490
231508
  toolCall: job.toolCall,
231491
231509
  toolName: job.toolCall.function.name,
231492
- result: toolErrorResult(job.toolCall.function.name, event.message || "Tool worker failed"),
231510
+ result: toolErrorResult(job.toolCall.function.name, message),
231493
231511
  ok: false,
231494
231512
  durationMs: Math.round(performance.now() - job.startedAt),
231495
- error: { name: "WorkerError", message: event.message || "Tool worker failed" }
231513
+ error: { name: "WorkerError", message }
231496
231514
  }, true);
231497
231515
  };
231498
231516
  return slot;
@@ -245615,7 +245633,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
245615
245633
  }
245616
245634
  __name(getDefaultStrategy, "getDefaultStrategy");
245617
245635
  var import_node_http = __require("http");
245618
- var import_node_url = __require("url");
245636
+ var import_node_url2 = __require("url");
245619
245637
  var import_node_util3 = __require("util");
245620
245638
  var import_undici = __require("undici");
245621
245639
  async function makeRequest(url2, init) {
@@ -245654,7 +245672,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
245654
245672
  return body;
245655
245673
  } else if (import_node_util3.types.isArrayBuffer(body)) {
245656
245674
  return new Uint8Array(body);
245657
- } else if (body instanceof import_node_url.URLSearchParams) {
245675
+ } else if (body instanceof import_node_url2.URLSearchParams) {
245658
245676
  return body.toString();
245659
245677
  } else if (body instanceof DataView) {
245660
245678
  return new Uint8Array(body.buffer);
@@ -268299,7 +268317,7 @@ var require_dist12 = __commonJS((exports2, module2) => {
268299
268317
  var import_node_events2 = __require("events");
268300
268318
  var import_node_timers = __require("timers");
268301
268319
  var import_promises22 = __require("timers/promises");
268302
- var import_node_url = __require("url");
268320
+ var import_node_url2 = __require("url");
268303
268321
  var import_node_util3 = __require("util");
268304
268322
  var import_node_zlib = __require("zlib");
268305
268323
  var import_collection5 = require_dist5();
@@ -268484,7 +268502,7 @@ var require_dist12 = __commonJS((exports2, module2) => {
268484
268502
  throw new Error("Tried to connect a shard that wasn't idle");
268485
268503
  }
268486
268504
  const { version: version22, encoding, compression } = this.strategy.options;
268487
- const params = new import_node_url.URLSearchParams({ v: version22, encoding });
268505
+ const params = new import_node_url2.URLSearchParams({ v: version22, encoding });
268488
268506
  if (compression) {
268489
268507
  const zlib = await getZlibSync();
268490
268508
  if (zlib) {
@@ -418130,7 +418148,7 @@ var require_main = __commonJS((exports2, module2) => {
418130
418148
  });
418131
418149
 
418132
418150
  // packages/core/src/channels/whatsapp.ts
418133
- import { existsSync as existsSync23, mkdirSync as mkdirSync11, rmSync as rmSync2 } from "fs";
418151
+ import { existsSync as existsSync24, mkdirSync as mkdirSync11, rmSync as rmSync2 } from "fs";
418134
418152
  import * as path21 from "path";
418135
418153
  function createWhatsAppChannel(config2) {
418136
418154
  return new WhatsAppChannel(config2);
@@ -418171,7 +418189,7 @@ var init_whatsapp = __esm(() => {
418171
418189
  getAuthPath(agentId, accountId) {
418172
418190
  const baseDir = process.env.HOME ?? "";
418173
418191
  const authDir = path21.join(baseDir, ".hive", "agents", agentId, "whatsapp", accountId);
418174
- if (!existsSync23(authDir)) {
418192
+ if (!existsSync24(authDir)) {
418175
418193
  mkdirSync11(authDir, { recursive: true });
418176
418194
  }
418177
418195
  return authDir;
@@ -418273,7 +418291,7 @@ var init_whatsapp = __esm(() => {
418273
418291
  }
418274
418292
  hasCredentials() {
418275
418293
  const credsFile = path21.join(this.authPath, "creds.json");
418276
- return existsSync23(credsFile);
418294
+ return existsSync24(credsFile);
418277
418295
  }
418278
418296
  getConnectionState() {
418279
418297
  return { ...this.connectionState };
@@ -477264,10 +477282,10 @@ var init_migrate = __esm(() => {
477264
477282
  });
477265
477283
 
477266
477284
  // packages/core/src/gateway/initializer.ts
477267
- import { mkdirSync as mkdirSync12, existsSync as existsSync24 } from "fs";
477285
+ import { mkdirSync as mkdirSync12, existsSync as existsSync25 } from "fs";
477268
477286
  import * as path23 from "path";
477269
477287
  async function verifyDatabaseUsers() {
477270
- if (!existsSync24(getDbPathLazy())) {
477288
+ if (!existsSync25(getDbPathLazy())) {
477271
477289
  log67.info("Setup mode: no database found \u2014 gateway will serve web setup at /setup");
477272
477290
  return;
477273
477291
  }
@@ -479426,7 +479444,7 @@ class ParallelStrategy {
479426
479444
  }
479427
479445
 
479428
479446
  // packages/core/src/scheduler/dag/DAGScheduler.ts
479429
- import { writeFileSync as writeFileSync9, mkdirSync as mkdirSync14, existsSync as existsSync25 } from "fs";
479447
+ import { writeFileSync as writeFileSync9, mkdirSync as mkdirSync14, existsSync as existsSync26 } from "fs";
479430
479448
  import * as path26 from "path";
479431
479449
 
479432
479450
  class DAGScheduler {
@@ -479567,7 +479585,7 @@ class DAGScheduler {
479567
479585
  if (!silent) {
479568
479586
  try {
479569
479587
  const logDir = path26.join(process.cwd(), "packages", "core", "logs");
479570
- if (!existsSync25(logDir))
479588
+ if (!existsSync26(logDir))
479571
479589
  mkdirSync14(logDir, { recursive: true });
479572
479590
  const logFile = path26.join(logDir, `dag-${sessionId.slice(0, 8)}.log`);
479573
479591
  writeFileSync9(logFile, output + `
@@ -481004,7 +481022,7 @@ var init_detect = __esm(() => {
481004
481022
  });
481005
481023
 
481006
481024
  // packages/core/src/gateway/tts/src/install.ts
481007
- import { existsSync as existsSync26, mkdirSync as mkdirSync15, readdirSync as readdirSync4, renameSync as renameSync2 } from "fs";
481025
+ import { existsSync as existsSync27, mkdirSync as mkdirSync15, readdirSync as readdirSync4, renameSync as renameSync2 } from "fs";
481008
481026
  import { join as join18 } from "path";
481009
481027
  async function downloadFile3(url2, dest) {
481010
481028
  const filename = url2.split("/").pop();
@@ -481042,7 +481060,7 @@ async function runInstall(ttsRoot) {
481042
481060
  const platform2 = detectPlatform2();
481043
481061
  const binaryName = getPiperBinaryName(platform2);
481044
481062
  const binaryPath = join18(BIN_DIR2, binaryName);
481045
- if (!existsSync26(binaryPath)) {
481063
+ if (!existsSync27(binaryPath)) {
481046
481064
  const url2 = PIPER_URLS[platform2];
481047
481065
  const archiveExt = url2.endsWith(".zip") ? ".zip" : ".tar.gz";
481048
481066
  const archivePath = join18(BIN_DIR2, `piper${archiveExt}`);
@@ -481055,7 +481073,7 @@ async function runInstall(ttsRoot) {
481055
481073
  await extractTarGz(archivePath, BIN_DIR2);
481056
481074
  }
481057
481075
  const piperSubdir = join18(BIN_DIR2, "piper");
481058
- if (existsSync26(piperSubdir)) {
481076
+ if (existsSync27(piperSubdir)) {
481059
481077
  const tempDir = join18(BIN_DIR2, "_piper_tmp");
481060
481078
  renameSync2(piperSubdir, tempDir);
481061
481079
  for (const entry of readdirSync4(tempDir)) {
@@ -481063,7 +481081,7 @@ async function runInstall(ttsRoot) {
481063
481081
  }
481064
481082
  await Bun.spawn(["rm", "-rf", tempDir]).exited;
481065
481083
  }
481066
- if (!existsSync26(binaryPath)) {
481084
+ if (!existsSync27(binaryPath)) {
481067
481085
  throw new Error(`Binario no encontrado tras extracci\xF3n: ${binaryPath}`);
481068
481086
  }
481069
481087
  if (!platform2.startsWith("windows")) {
@@ -481075,7 +481093,7 @@ async function runInstall(ttsRoot) {
481075
481093
  }
481076
481094
  const modelPath = join18(VOICES_DIR, `${DEFAULT_VOICE}.onnx`);
481077
481095
  const configPath = join18(VOICES_DIR, `${DEFAULT_VOICE}.onnx.json`);
481078
- if (!existsSync26(modelPath) || !existsSync26(configPath)) {
481096
+ if (!existsSync27(modelPath) || !existsSync27(configPath)) {
481079
481097
  log71.info(`Descargando modelo de voz ${DEFAULT_VOICE}...`);
481080
481098
  await downloadFile3(VOICE_URLS.model, modelPath);
481081
481099
  await downloadFile3(VOICE_URLS.config, configPath);
@@ -481097,20 +481115,20 @@ var init_install = __esm(() => {
481097
481115
  });
481098
481116
 
481099
481117
  // packages/core/src/gateway/tts/src/server.ts
481100
- import { existsSync as existsSync27, readdirSync as readdirSync5, readFileSync as readFileSync11 } from "fs";
481118
+ import { existsSync as existsSync28, readdirSync as readdirSync5, readFileSync as readFileSync11 } from "fs";
481101
481119
  import { join as join19 } from "path";
481102
481120
  import { homedir as homedir3 } from "os";
481103
481121
  function getPiperPath() {
481104
481122
  const platform2 = detectPlatform2();
481105
481123
  const binaryName = getPiperBinaryName(platform2);
481106
481124
  const binaryPath = join19(BIN_DIR2, binaryName);
481107
- if (!existsSync27(binaryPath)) {
481125
+ if (!existsSync28(binaryPath)) {
481108
481126
  throw new Error("Piper no instalado. Ejecuta: bun run src/install.ts");
481109
481127
  }
481110
481128
  return binaryPath;
481111
481129
  }
481112
481130
  function listVoices() {
481113
- if (!existsSync27(VOICES_DIR))
481131
+ if (!existsSync28(VOICES_DIR))
481114
481132
  return [];
481115
481133
  return readdirSync5(VOICES_DIR).filter((f2) => f2.endsWith(".onnx")).map((f2) => f2.replace(".onnx", ""));
481116
481134
  }
@@ -481118,12 +481136,12 @@ async function synthesize(text2, voice) {
481118
481136
  const piperPath = getPiperPath();
481119
481137
  let modelPath = join19(VOICES_DIR, `${voice}.onnx`);
481120
481138
  let configPath = join19(VOICES_DIR, `${voice}.onnx.json`);
481121
- if (!existsSync27(modelPath)) {
481139
+ if (!existsSync28(modelPath)) {
481122
481140
  console.warn(`[TTS] Voz no encontrada: ${voice}. Usando por defecto: ${DEFAULT_VOICE}`);
481123
481141
  voice = DEFAULT_VOICE;
481124
481142
  modelPath = join19(VOICES_DIR, `${voice}.onnx`);
481125
481143
  configPath = join19(VOICES_DIR, `${voice}.onnx.json`);
481126
- if (!existsSync27(modelPath)) {
481144
+ if (!existsSync28(modelPath)) {
481127
481145
  throw new Error(`Ni siquiera la voz por defecto se encuentra: ${voice}`);
481128
481146
  }
481129
481147
  }
@@ -481131,7 +481149,7 @@ async function synthesize(text2, voice) {
481131
481149
  let noiseScale = 0.6;
481132
481150
  let noiseW = 0.75;
481133
481151
  let sentenceSilence = 0.2;
481134
- if (existsSync27(configPath)) {
481152
+ if (existsSync28(configPath)) {
481135
481153
  try {
481136
481154
  const config2 = JSON.parse(readFileSync11(configPath, "utf-8"));
481137
481155
  const inference = config2.inference || {};
@@ -481276,16 +481294,16 @@ var init_server = __esm(() => {
481276
481294
  });
481277
481295
 
481278
481296
  // packages/core/src/gateway/routes/tts-local.ts
481279
- import { existsSync as existsSync28, readdirSync as readdirSync6, readFileSync as readFileSync12 } from "fs";
481297
+ import { existsSync as existsSync29, readdirSync as readdirSync6, readFileSync as readFileSync12 } from "fs";
481280
481298
  import { join as join20 } from "path";
481281
481299
  import { homedir as homedir4 } from "os";
481282
481300
  function isInstalled() {
481283
- const piperExists = existsSync28(BIN_PATH);
481301
+ const piperExists = existsSync29(BIN_PATH);
481284
481302
  const voiceExists = getInstalledVoices().length > 0;
481285
481303
  return { piperExists, voiceExists, installed: piperExists && voiceExists };
481286
481304
  }
481287
481305
  function getInstalledVoices() {
481288
- if (!existsSync28(VOICES_DIR2))
481306
+ if (!existsSync29(VOICES_DIR2))
481289
481307
  return [];
481290
481308
  const files = readdirSync6(VOICES_DIR2);
481291
481309
  return files.filter((f2) => f2.endsWith(".onnx")).map((f2) => f2.replace(".onnx", ""));
@@ -481463,7 +481481,7 @@ async function handleGetInstalledVoices(req, addCors) {
481463
481481
  const model = getModelById(id);
481464
481482
  let inferenceConfig = { length_scale: 1, noise_scale: 0.667, noise_w: 0.8 };
481465
481483
  const configPath = join20(VOICES_DIR2, `${id}.onnx.json`);
481466
- if (existsSync28(configPath)) {
481484
+ if (existsSync29(configPath)) {
481467
481485
  try {
481468
481486
  const config2 = JSON.parse(readFileSync12(configPath, "utf-8"));
481469
481487
  inferenceConfig = { ...inferenceConfig, ...config2.inference };
@@ -481557,7 +481575,7 @@ var init_tts_local = __esm(() => {
481557
481575
  });
481558
481576
 
481559
481577
  // packages/core/src/gateway/routes/llm-local.ts
481560
- import { existsSync as existsSync29 } from "fs";
481578
+ import { existsSync as existsSync30 } from "fs";
481561
481579
  import { join as join21 } from "path";
481562
481580
  import { homedir as homedir5 } from "os";
481563
481581
  async function getInstalledStatus() {
@@ -481565,7 +481583,7 @@ async function getInstalledStatus() {
481565
481583
  const gpu = await detectGPU();
481566
481584
  const ext = process.platform === "win32" ? ".exe" : "";
481567
481585
  const binaryPath = join21(BIN_DIR_PATH, `llama-${LLAMA_CPP_DEFAULT_VER2}/llama-server${ext}`);
481568
- const binaryExists = existsSync29(binaryPath);
481586
+ const binaryExists = existsSync30(binaryPath);
481569
481587
  const models = listLocalModels();
481570
481588
  const anyModelExists = models.some((m2) => m2.downloaded);
481571
481589
  const activeServers = llamaManager.getStatus();
@@ -481866,7 +481884,7 @@ var package_default;
481866
481884
  var init_package = __esm(() => {
481867
481885
  package_default = {
481868
481886
  name: "@johpaz/hive-agents",
481869
- version: "0.0.36",
481887
+ version: "0.0.37",
481870
481888
  description: "Tu colmena de agentes IA. Local-first. Multi-canal. Open source. Construido desde Colombia para el mundo.",
481871
481889
  private: false,
481872
481890
  bin: {
@@ -481930,6 +481948,7 @@ var init_package = __esm(() => {
481930
481948
  },
481931
481949
  files: [
481932
481950
  "dist/hive.js",
481951
+ "dist/tool-worker.js",
481933
481952
  "dist/hive.cmd",
481934
481953
  "dist/hive.ps1",
481935
481954
  "dist/ui",
@@ -481969,7 +481988,7 @@ var init_package = __esm(() => {
481969
481988
  "doctor:dev": "HIVE_HOME=$HOME/.hive-dev HIVE_DEV=true bun run packages/cli/src/index.ts doctor",
481970
481989
  "dev:keep": "HIVE_HOME=$HOME/.hive-dev HIVE_DEV=true HIVE_DEV_CLEAN=false bun run packages/cli/src/index.ts dev",
481971
481990
  start: "bun run packages/cli/src/index.ts start",
481972
- 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",
481991
+ 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",
481973
481992
  "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",
481974
481993
  prepublishOnly: "bun run build",
481975
481994
  test: "bun test",
@@ -482542,7 +482561,7 @@ async function handleGetConfig(req, addCorsHeaders, config2) {
482542
482561
  var init_config = () => {};
482543
482562
 
482544
482563
  // packages/core/src/gateway/routes/workspace.ts
482545
- import { mkdirSync as mkdirSync16, existsSync as existsSync30, accessSync, constants as constants2 } from "fs";
482564
+ import { mkdirSync as mkdirSync16, existsSync as existsSync31, accessSync, constants as constants2 } from "fs";
482546
482565
  import * as path27 from "path";
482547
482566
  import { exec as exec2 } from "child_process";
482548
482567
  import { promisify as promisify4 } from "util";
@@ -482568,7 +482587,7 @@ async function handleValidateWorkspace(req, addCorsHeaders) {
482568
482587
  isAbsolute: false
482569
482588
  }), req);
482570
482589
  }
482571
- const exists = existsSync30(workspacePath);
482590
+ const exists = existsSync31(workspacePath);
482572
482591
  if (!exists) {
482573
482592
  return addCorsHeaders(Response.json({
482574
482593
  ok: true,
@@ -482650,7 +482669,7 @@ async function handleOpenWorkspace(req, addCorsHeaders) {
482650
482669
  error: "El path debe ser absoluto"
482651
482670
  }), req);
482652
482671
  }
482653
- if (!existsSync30(workspacePath)) {
482672
+ if (!existsSync31(workspacePath)) {
482654
482673
  return addCorsHeaders(Response.json({
482655
482674
  ok: false,
482656
482675
  error: "El directorio no existe"
@@ -482931,7 +482950,7 @@ var init_server2 = __esm(() => {
482931
482950
  });
482932
482951
 
482933
482952
  // packages/core/src/gateway/server.ts
482934
- import { mkdirSync as mkdirSync17, unlinkSync as unlinkSync4, existsSync as existsSync31, writeFileSync as writeFileSync10, readFileSync as readFileSync13 } from "fs";
482953
+ import { mkdirSync as mkdirSync17, unlinkSync as unlinkSync4, existsSync as existsSync32, writeFileSync as writeFileSync10, readFileSync as readFileSync13 } from "fs";
482935
482954
  import * as path29 from "path";
482936
482955
  import { cpus as osCpus } from "os";
482937
482956
  import { randomUUID as randomUUID2 } from "crypto";
@@ -482947,7 +482966,7 @@ async function startGateway(config2) {
482947
482966
  log75.info(`Starting gateway on ${host}:${port}`);
482948
482967
  const tokenFile = path29.join(getHiveDir(), ".auth_token");
482949
482968
  if (!process.env.HIVE_AUTH_TOKEN) {
482950
- if (existsSync31(tokenFile)) {
482969
+ if (existsSync32(tokenFile)) {
482951
482970
  process.env.HIVE_AUTH_TOKEN = readFileSync13(tokenFile, "utf-8").trim();
482952
482971
  log75.info("\uD83D\uDD11 Auth token loaded from persistent storage");
482953
482972
  } else {
@@ -483414,7 +483433,7 @@ ${messageContent}`;
483414
483433
  if (isDev) {
483415
483434
  const uiDir2 = path29.join(process.cwd(), "packages/hive-ui/dist");
483416
483435
  const indexPath = path29.join(uiDir2, "index.html");
483417
- if (!existsSync31(indexPath)) {
483436
+ if (!existsSync32(indexPath)) {
483418
483437
  return new Response(`UI build not found. Please run: cd packages/hive-ui && bun run build
483419
483438
 
483420
483439
  ` + "Or use: bun run dev (from root) which builds automatically.", { status: 503, headers: { "Content-Type": "text/plain" } });
@@ -483454,7 +483473,7 @@ ${messageContent}`;
483454
483473
  const uiDirFromHive = path29.join(getHiveDir(), "ui");
483455
483474
  const uiDirFromDist = process.env.HIVE_DIST_DIR ? path29.join(process.env.HIVE_DIST_DIR, "ui") : null;
483456
483475
  const uiDirFromCwd = path29.join(process.cwd(), "packages/hive-ui/dist");
483457
- const uiDir = uiDirFromEnv || (existsSync31(path29.join(uiDirFromHive, "index.html")) ? uiDirFromHive : uiDirFromDist && existsSync31(path29.join(uiDirFromDist, "index.html")) ? uiDirFromDist : uiDirFromCwd);
483476
+ const uiDir = uiDirFromEnv || (existsSync32(path29.join(uiDirFromHive, "index.html")) ? uiDirFromHive : uiDirFromDist && existsSync32(path29.join(uiDirFromDist, "index.html")) ? uiDirFromDist : uiDirFromCwd);
483458
483477
  let subPath = url2.pathname;
483459
483478
  if (gatewaySetupMode && (subPath === "/" || subPath === "/ui" || subPath === "/ui/")) {
483460
483479
  const _publicBase = process.env.HIVE_PUBLIC_URL?.replace(/\/$/, "") ?? `http://${host === "0.0.0.0" ? "localhost" : host}:${port}`;
@@ -486502,7 +486521,7 @@ var init_circuit_breaker = __esm(() => {
486502
486521
  circuitBreakerRegistry = new CircuitBreakerRegistry;
486503
486522
  });
486504
486523
  // packages/core/src/plugins/loader.ts
486505
- import { mkdirSync as mkdirSync18, readdirSync as readdirSync8, existsSync as existsSync32 } from "fs";
486524
+ import { mkdirSync as mkdirSync18, readdirSync as readdirSync8, existsSync as existsSync33 } from "fs";
486506
486525
  import * as path30 from "path";
486507
486526
 
486508
486527
  class PluginLoader {
@@ -486516,7 +486535,7 @@ class PluginLoader {
486516
486535
  log = logger.child("plugins");
486517
486536
  constructor(options2) {
486518
486537
  this.options = options2;
486519
- if (!existsSync32(options2.pluginDir)) {
486538
+ if (!existsSync33(options2.pluginDir)) {
486520
486539
  mkdirSync18(options2.pluginDir, { recursive: true });
486521
486540
  }
486522
486541
  }
@@ -486528,7 +486547,7 @@ class PluginLoader {
486528
486547
  for (const entry of entries) {
486529
486548
  if (entry.isDirectory()) {
486530
486549
  const manifestPath = path30.join(pluginDir, entry.name, "manifest.json");
486531
- if (existsSync32(manifestPath)) {
486550
+ if (existsSync33(manifestPath)) {
486532
486551
  discovered.push(entry.name);
486533
486552
  }
486534
486553
  }
@@ -486904,7 +486923,7 @@ var init_types6 = __esm(() => {
486904
486923
 
486905
486924
  // packages/cli/src/adapters/config.ts
486906
486925
  import * as path31 from "path";
486907
- import { existsSync as existsSync33, readFileSync as readFileSync14 } from "fs";
486926
+ import { existsSync as existsSync34, readFileSync as readFileSync14 } from "fs";
486908
486927
  function getHiveDir2(customDir) {
486909
486928
  if (customDir) {
486910
486929
  return path31.resolve(customDir);
@@ -486932,7 +486951,7 @@ function getDefaultPaths(hiveDir) {
486932
486951
  }
486933
486952
  function loadEnvFile(envPath) {
486934
486953
  const filePath = envPath || path31.join(process.cwd(), ".env");
486935
- if (!existsSync33(filePath)) {
486954
+ if (!existsSync34(filePath)) {
486936
486955
  return {};
486937
486956
  }
486938
486957
  try {
@@ -487004,7 +487023,7 @@ function getDistDir() {
487004
487023
  return dir;
487005
487024
  }
487006
487025
  const distPath = path31.join(dir, "dist");
487007
- if (existsSync33(distPath)) {
487026
+ if (existsSync34(distPath)) {
487008
487027
  return distPath;
487009
487028
  }
487010
487029
  return null;
@@ -487026,7 +487045,7 @@ __export(exports_docker, {
487026
487045
  });
487027
487046
  import { spawn as spawn3, execSync } from "child_process";
487028
487047
  import * as path32 from "path";
487029
- import { existsSync as existsSync34 } from "fs";
487048
+ import { existsSync as existsSync35 } from "fs";
487030
487049
 
487031
487050
  class DockerAdapter {
487032
487051
  type = "docker";
@@ -487046,7 +487065,7 @@ class DockerAdapter {
487046
487065
  path32.join(process.env.HOME || "", ".hive", "docker-compose.yml")
487047
487066
  ];
487048
487067
  for (const composePath of standardPaths) {
487049
- if (existsSync34(composePath)) {
487068
+ if (existsSync35(composePath)) {
487050
487069
  return composePath;
487051
487070
  }
487052
487071
  }
@@ -487056,7 +487075,7 @@ class DockerAdapter {
487056
487075
  try {
487057
487076
  execSync("docker --version", { stdio: "ignore" });
487058
487077
  execSync("docker compose version", { stdio: "ignore" });
487059
- if (!existsSync34(this.composeFile)) {
487078
+ if (!existsSync35(this.composeFile)) {
487060
487079
  return false;
487061
487080
  }
487062
487081
  try {
@@ -487188,7 +487207,7 @@ class DockerAdapter {
487188
487207
  } catch {
487189
487208
  errors6.push("Docker Compose is not installed");
487190
487209
  }
487191
- if (!existsSync34(this.composeFile)) {
487210
+ if (!existsSync35(this.composeFile)) {
487192
487211
  errors6.push(`docker-compose.yml not found at ${this.composeFile}`);
487193
487212
  } else {
487194
487213
  info3.push(`Compose file: ${this.composeFile}`);
@@ -487228,7 +487247,7 @@ var init_docker = __esm(() => {
487228
487247
  // packages/cli/src/adapters/bun-global.ts
487229
487248
  import { spawn as spawn4, execSync as execSync2 } from "child_process";
487230
487249
  import * as path33 from "path";
487231
- import { existsSync as existsSync35, readFileSync as readFileSync15, unlinkSync as unlinkSync5 } from "fs";
487250
+ import { existsSync as existsSync36, readFileSync as readFileSync15, unlinkSync as unlinkSync5 } from "fs";
487232
487251
 
487233
487252
  class BunGlobalAdapter {
487234
487253
  type = "bun-global";
@@ -487248,7 +487267,7 @@ class BunGlobalAdapter {
487248
487267
  stdio: ["ignore", "pipe", "ignore"]
487249
487268
  });
487250
487269
  const hivePath = output.trim();
487251
- if (hivePath && existsSync35(hivePath)) {
487270
+ if (hivePath && existsSync36(hivePath)) {
487252
487271
  return true;
487253
487272
  }
487254
487273
  } catch {
@@ -487276,13 +487295,13 @@ class BunGlobalAdapter {
487276
487295
  }).trim();
487277
487296
  const distDir = path33.dirname(hivePath);
487278
487297
  const potentialUiDir = path33.join(distDir, "ui");
487279
- if (existsSync35(potentialUiDir)) {
487298
+ if (existsSync36(potentialUiDir)) {
487280
487299
  uiDir = potentialUiDir;
487281
487300
  }
487282
487301
  } catch {}
487283
487302
  if (!uiDir) {
487284
487303
  const cwdUiDir = path33.join(process.cwd(), "packages/hive-ui/dist");
487285
- if (existsSync35(cwdUiDir)) {
487304
+ if (existsSync36(cwdUiDir)) {
487286
487305
  uiDir = cwdUiDir;
487287
487306
  }
487288
487307
  }
@@ -487333,7 +487352,7 @@ class BunGlobalAdapter {
487333
487352
  }
487334
487353
  async stop() {
487335
487354
  try {
487336
- if (existsSync35(this.pidFile)) {
487355
+ if (existsSync36(this.pidFile)) {
487337
487356
  const pid = parseInt(readFileSync15(this.pidFile, "utf-8").trim(), 10);
487338
487357
  if (!isNaN(pid)) {
487339
487358
  try {
@@ -487366,7 +487385,7 @@ class BunGlobalAdapter {
487366
487385
  }
487367
487386
  async isRunning() {
487368
487387
  try {
487369
- if (existsSync35(this.pidFile)) {
487388
+ if (existsSync36(this.pidFile)) {
487370
487389
  const pid = parseInt(readFileSync15(this.pidFile, "utf-8").trim(), 10);
487371
487390
  if (!isNaN(pid)) {
487372
487391
  try {
@@ -487388,7 +487407,7 @@ class BunGlobalAdapter {
487388
487407
  }
487389
487408
  async getPid() {
487390
487409
  try {
487391
- if (existsSync35(this.pidFile)) {
487410
+ if (existsSync36(this.pidFile)) {
487392
487411
  const pid = parseInt(readFileSync15(this.pidFile, "utf-8").trim(), 10);
487393
487412
  if (!isNaN(pid) && pid > 0) {
487394
487413
  try {
@@ -487430,11 +487449,11 @@ class BunGlobalAdapter {
487430
487449
  encoding: "utf-8",
487431
487450
  stdio: ["ignore", "pipe", "ignore"]
487432
487451
  }).trim();
487433
- if (hivePath && existsSync35(hivePath)) {
487452
+ if (hivePath && existsSync36(hivePath)) {
487434
487453
  info3.push(`Hive binary: ${hivePath}`);
487435
487454
  const distDir = path33.dirname(hivePath);
487436
487455
  const uiDir = path33.join(distDir, "ui");
487437
- if (existsSync35(uiDir)) {
487456
+ if (existsSync36(uiDir)) {
487438
487457
  info3.push(`UI directory: ${uiDir}`);
487439
487458
  } else {
487440
487459
  warnings.push("UI directory not found - may use embedded UI");
@@ -487445,7 +487464,7 @@ class BunGlobalAdapter {
487445
487464
  } catch {
487446
487465
  errors6.push("Hive is not installed globally (try: bun install -g @johpaz/hive-agents)");
487447
487466
  }
487448
- if (existsSync35(this.hiveDir)) {
487467
+ if (existsSync36(this.hiveDir)) {
487449
487468
  info3.push(`Hive home: ${this.hiveDir}`);
487450
487469
  } else {
487451
487470
  warnings.push(`Hive home directory does not exist: ${this.hiveDir}`);
@@ -487487,7 +487506,7 @@ var init_bun_global = __esm(() => {
487487
487506
  // packages/cli/src/adapters/binary.ts
487488
487507
  import { spawn as spawn5, execSync as execSync3 } from "child_process";
487489
487508
  import * as path34 from "path";
487490
- import { existsSync as existsSync36, readFileSync as readFileSync16, unlinkSync as unlinkSync6 } from "fs";
487509
+ import { existsSync as existsSync37, readFileSync as readFileSync16, unlinkSync as unlinkSync6 } from "fs";
487491
487510
 
487492
487511
  class BinaryAdapter {
487493
487512
  type = "binary";
@@ -487499,7 +487518,7 @@ class BinaryAdapter {
487499
487518
  this.hiveDir = options2?.hiveDir || getHiveDir2();
487500
487519
  this.pidFile = path34.join(this.hiveDir, "gateway.pid");
487501
487520
  this.binaryPath = options2?.binaryPath || this.findBinary();
487502
- this.isDockerContainer = process.env.HIVE_UI_DIR === "/app/ui" || process.env.HIVE_HOST === "0.0.0.0" || existsSync36("/.dockerenv");
487521
+ this.isDockerContainer = process.env.HIVE_UI_DIR === "/app/ui" || process.env.HIVE_HOST === "0.0.0.0" || existsSync37("/.dockerenv");
487503
487522
  }
487504
487523
  get name() {
487505
487524
  return this.isDockerContainer ? "Docker Container" : "Standalone Binary";
@@ -487510,15 +487529,15 @@ class BinaryAdapter {
487510
487529
  const dir = path34.dirname(scriptPath);
487511
487530
  if (path34.basename(dir) === "dist") {
487512
487531
  const binaryInDist = path34.join(dir, "hive");
487513
- if (existsSync36(binaryInDist)) {
487532
+ if (existsSync37(binaryInDist)) {
487514
487533
  return binaryInDist;
487515
487534
  }
487516
487535
  const binaryWindows = path34.join(dir, "hive.exe");
487517
- if (existsSync36(binaryWindows)) {
487536
+ if (existsSync37(binaryWindows)) {
487518
487537
  return binaryWindows;
487519
487538
  }
487520
487539
  }
487521
- if (existsSync36(scriptPath) && !scriptPath.endsWith(".ts")) {
487540
+ if (existsSync37(scriptPath) && !scriptPath.endsWith(".ts")) {
487522
487541
  return scriptPath;
487523
487542
  }
487524
487543
  }
@@ -487531,7 +487550,7 @@ class BinaryAdapter {
487531
487550
  path34.join(process.env.HOME || "", ".bun", "bin", "hive")
487532
487551
  ];
487533
487552
  for (const binaryPath of commonPaths) {
487534
- if (existsSync36(binaryPath)) {
487553
+ if (existsSync37(binaryPath)) {
487535
487554
  return binaryPath;
487536
487555
  }
487537
487556
  }
@@ -487545,7 +487564,7 @@ class BinaryAdapter {
487545
487564
  if (scriptPath.endsWith(".ts")) {
487546
487565
  return false;
487547
487566
  }
487548
- if (existsSync36(this.binaryPath)) {
487567
+ if (existsSync37(this.binaryPath)) {
487549
487568
  return true;
487550
487569
  }
487551
487570
  try {
@@ -487557,7 +487576,7 @@ class BinaryAdapter {
487557
487576
  const distDir = getDistDir();
487558
487577
  if (distDir) {
487559
487578
  const uiDir = path34.join(distDir, "ui");
487560
- if (existsSync36(uiDir)) {
487579
+ if (existsSync37(uiDir)) {
487561
487580
  return true;
487562
487581
  }
487563
487582
  }
@@ -487573,7 +487592,7 @@ class BinaryAdapter {
487573
487592
  const distDir = getDistDir();
487574
487593
  if (distDir) {
487575
487594
  const uiDir = path34.join(distDir, "ui");
487576
- if (existsSync36(uiDir)) {
487595
+ if (existsSync37(uiDir)) {
487577
487596
  paths.uiDir = uiDir;
487578
487597
  }
487579
487598
  }
@@ -487640,7 +487659,7 @@ class BinaryAdapter {
487640
487659
  }
487641
487660
  async stop() {
487642
487661
  try {
487643
- if (existsSync36(this.pidFile)) {
487662
+ if (existsSync37(this.pidFile)) {
487644
487663
  const pid = parseInt(readFileSync16(this.pidFile, "utf-8").trim(), 10);
487645
487664
  if (!isNaN(pid)) {
487646
487665
  try {
@@ -487674,7 +487693,7 @@ class BinaryAdapter {
487674
487693
  }
487675
487694
  async isRunning() {
487676
487695
  try {
487677
- if (existsSync36(this.pidFile)) {
487696
+ if (existsSync37(this.pidFile)) {
487678
487697
  const pid = parseInt(readFileSync16(this.pidFile, "utf-8").trim(), 10);
487679
487698
  if (!isNaN(pid)) {
487680
487699
  try {
@@ -487696,7 +487715,7 @@ class BinaryAdapter {
487696
487715
  }
487697
487716
  async getPid() {
487698
487717
  try {
487699
- if (existsSync36(this.pidFile)) {
487718
+ if (existsSync37(this.pidFile)) {
487700
487719
  const pid = parseInt(readFileSync16(this.pidFile, "utf-8").trim(), 10);
487701
487720
  if (!isNaN(pid) && pid > 0) {
487702
487721
  try {
@@ -487729,7 +487748,7 @@ class BinaryAdapter {
487729
487748
  const errors6 = [];
487730
487749
  const warnings = [];
487731
487750
  const info3 = [];
487732
- if (existsSync36(this.binaryPath)) {
487751
+ if (existsSync37(this.binaryPath)) {
487733
487752
  info3.push(`Binary: ${this.binaryPath}`);
487734
487753
  try {
487735
487754
  const stat3 = await import("fs/promises").then((m2) => m2.stat(this.binaryPath));
@@ -487752,13 +487771,13 @@ class BinaryAdapter {
487752
487771
  const distDir = getDistDir();
487753
487772
  if (distDir) {
487754
487773
  const uiDir = path34.join(distDir, "ui");
487755
- if (existsSync36(uiDir)) {
487774
+ if (existsSync37(uiDir)) {
487756
487775
  info3.push(`UI directory: ${uiDir}`);
487757
487776
  } else if (!hasEmbeddedUI) {
487758
487777
  warnings.push("UI directory not found and no embedded UI");
487759
487778
  }
487760
487779
  }
487761
- if (existsSync36(this.hiveDir)) {
487780
+ if (existsSync37(this.hiveDir)) {
487762
487781
  info3.push(`Hive home: ${this.hiveDir}`);
487763
487782
  } else {
487764
487783
  warnings.push(`Hive home directory does not exist: ${this.hiveDir}`);
@@ -487776,7 +487795,7 @@ class BinaryAdapter {
487776
487795
  } else {
487777
487796
  warnings.push("Hive Gateway is not running");
487778
487797
  }
487779
- if (process.platform !== "win32" && existsSync36(this.binaryPath)) {
487798
+ if (process.platform !== "win32" && existsSync37(this.binaryPath)) {
487780
487799
  try {
487781
487800
  execSync3(`test -x "${this.binaryPath}"`, { stdio: "ignore" });
487782
487801
  info3.push("Binary is executable");
@@ -487882,7 +487901,7 @@ __export(exports_gateway, {
487882
487901
  resetAdapter: () => resetAdapter,
487883
487902
  reload: () => reload
487884
487903
  });
487885
- import { existsSync as existsSync37, mkdirSync as mkdirSync19, writeFileSync as writeFileSync11, readFileSync as readFileSync17, unlinkSync as unlinkSync7, openSync } from "fs";
487904
+ import { existsSync as existsSync38, mkdirSync as mkdirSync19, writeFileSync as writeFileSync11, readFileSync as readFileSync17, unlinkSync as unlinkSync7, openSync } from "fs";
487886
487905
  import * as path35 from "path";
487887
487906
  import { spawn as spawn6 } from "child_process";
487888
487907
  async function getAdapter() {
@@ -487925,7 +487944,7 @@ async function getPidFile() {
487925
487944
  }
487926
487945
  function ensureLogDir() {
487927
487946
  const logDir = path35.dirname(getLogFile());
487928
- if (!existsSync37(logDir)) {
487947
+ if (!existsSync38(logDir)) {
487929
487948
  mkdirSync19(logDir, { recursive: true });
487930
487949
  }
487931
487950
  }
@@ -487958,7 +487977,7 @@ function openBrowser(url2) {
487958
487977
  async function isSetupMode2() {
487959
487978
  const hiveDir = getHiveDir();
487960
487979
  const dbPath = path35.join(hiveDir, "data", "hive.db");
487961
- return !existsSync37(dbPath);
487980
+ return !existsSync38(dbPath);
487962
487981
  }
487963
487982
  async function isRunning2() {
487964
487983
  try {
@@ -487969,7 +487988,7 @@ async function isRunning2() {
487969
487988
  }
487970
487989
  } catch {}
487971
487990
  const pidFile = await getPidFile();
487972
- if (!existsSync37(pidFile))
487991
+ if (!existsSync38(pidFile))
487973
487992
  return false;
487974
487993
  const pid = parseInt(readFileSync17(pidFile, "utf-8").trim(), 10);
487975
487994
  if (isNaN(pid))
@@ -488033,7 +488052,7 @@ async function start(flags3) {
488033
488052
  \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
488034
488053
  \u2551 \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551
488035
488054
  \u2551 \u2551
488036
- \u2551 Personal Swarm AI Gateway \u2014 v0.0.36 \u2551
488055
+ \u2551 Personal Swarm AI Gateway \u2014 v0.0.37 \u2551
488037
488056
  \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
488038
488057
 
488039
488058
  \uD83D\uDCE6 Installation: ${adapter.name}
@@ -488067,7 +488086,7 @@ async function handleDevMode(adapter, gatewayConfig, daemon) {
488067
488086
  return;
488068
488087
  }
488069
488088
  const hiveUiPath = path35.join(process.cwd(), "packages/hive-ui");
488070
- const hasVite = existsSync37(path35.join(hiveUiPath, "package.json"));
488089
+ const hasVite = existsSync38(path35.join(hiveUiPath, "package.json"));
488071
488090
  if (hasVite) {
488072
488091
  console.log(`\uD83C\uDFA8 Iniciando Vite (UI)...
488073
488092
  `);
@@ -488252,7 +488271,7 @@ async function handleProductionMode(adapter, gatewayConfig, daemon) {
488252
488271
  } catch {
488253
488272
  const hiveDir = getHiveDir();
488254
488273
  const dbPath = path35.join(hiveDir, "data", "hive.db");
488255
- needsSetup = !existsSync37(dbPath);
488274
+ needsSetup = !existsSync38(dbPath);
488256
488275
  }
488257
488276
  const url2 = needsSetup ? `http://localhost:${uiPort}/setup` : `http://localhost:${uiPort}`;
488258
488277
  if (needsSetup) {
@@ -489092,11 +489111,11 @@ async function updateSkills() {
489092
489111
  } else {
489093
489112
  console.log(` \u2705 Todas las skills est\xE1n actualizadas`);
489094
489113
  }
489095
- const { existsSync: existsSync41 } = await import("fs");
489114
+ const { existsSync: existsSync42 } = await import("fs");
489096
489115
  const { getHiveDir: getHiveDir3 } = await Promise.resolve().then(() => (init_loader(), exports_loader));
489097
489116
  const path39 = await import("path");
489098
489117
  const pidFile = path39.join(getHiveDir3(), "gateway.pid");
489099
- if (existsSync41(pidFile)) {
489118
+ if (existsSync42(pidFile)) {
489100
489119
  console.log(`
489101
489120
  \uD83D\uDCA1 El gateway est\xE1 corriendo. Ejecuta 'hive reload' para aplicar cambios.`);
489102
489121
  }
@@ -490291,8 +490310,8 @@ var MAIN_PACKAGE = "@johpaz/hive-agents";
490291
490310
  async function update() {
490292
490311
  console.log(`\uD83D\uDD04 Actualizando Hive...
490293
490312
  `);
490294
- const { existsSync: existsSync47 } = await import("fs");
490295
- const isGitRepo = existsSync47(".git") && existsSync47("package.json");
490313
+ const { existsSync: existsSync48 } = await import("fs");
490314
+ const isGitRepo = existsSync48(".git") && existsSync48("package.json");
490296
490315
  if (isGitRepo) {
490297
490316
  await updateFromGitRepo();
490298
490317
  } else {
@@ -490394,11 +490413,11 @@ Descargando ${MAIN_PACKAGE}@latest (via ${packageManager})...`);
490394
490413
  }
490395
490414
  }
490396
490415
  async function applyDatabaseUpdates() {
490397
- const { existsSync: existsSync47 } = await import("fs");
490416
+ const { existsSync: existsSync48 } = await import("fs");
490398
490417
  const { getHiveDir: getHiveDir3 } = await Promise.resolve().then(() => (init_loader(), exports_loader));
490399
490418
  const path44 = await import("path");
490400
490419
  const dbPath = path44.join(getHiveDir3(), "data", "hive.db");
490401
- if (!existsSync47(dbPath)) {
490420
+ if (!existsSync48(dbPath)) {
490402
490421
  console.log(` \u2139\uFE0F No se encontr\xF3 base de datos existente. Se crear\xE1 en el pr\xF3ximo 'hive start'.`);
490403
490422
  return;
490404
490423
  }
@@ -490436,7 +490455,7 @@ async function applyDatabaseUpdates() {
490436
490455
  }
490437
490456
  const hiveDir = getHiveDir3();
490438
490457
  const pidFile = path44.join(hiveDir, "gateway.pid");
490439
- if (existsSync47(pidFile)) {
490458
+ if (existsSync48(pidFile)) {
490440
490459
  console.log(`
490441
490460
  \uD83D\uDCA1 El gateway est\xE1 corriendo. Ejecuta 'hive reload' para aplicar cambios.`);
490442
490461
  }