@johpaz/hive-agents 1.0.1 → 1.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 (101) hide show
  1. package/README.md +3 -3
  2. package/dist/hive.js +521 -369
  3. package/dist/ui/assets/A2UIPage-BRpjnMss.js +8 -0
  4. package/dist/ui/assets/{AgentCreateForm-M2RhjeA1.js → AgentCreateForm-ASjKD7Js.js} +1 -1
  5. package/dist/ui/assets/{AgentDetailPage-DkFRtj8g.js → AgentDetailPage-bqJ-MS40.js} +1 -1
  6. package/dist/ui/assets/AgentNewPage-CPaf2C3u.js +1 -0
  7. package/dist/ui/assets/{AgentsPage-Ctzq2LWx.js → AgentsPage-BIpLG0V6.js} +1 -1
  8. package/dist/ui/assets/{ApiClientPage-DKbGO1QW.js → ApiClientPage-dRckcgrN.js} +1 -1
  9. package/dist/ui/assets/{ChannelsPage-H6rgr8DQ.js → ChannelsPage-BX_hPtiN.js} +1 -1
  10. package/dist/ui/assets/{DashboardPage-BIjYGf4m.js → DashboardPage-KMaMaFf4.js} +1 -1
  11. package/dist/ui/assets/{LoginPage-DazoxtBJ.js → LoginPage-Zchu-f16.js} +1 -1
  12. package/dist/ui/assets/{LogsPage-DMZ6KtQ3.js → LogsPage-6Po7_T2u.js} +1 -1
  13. package/dist/ui/assets/{MeetingPage-CSLFvHL7.js → MeetingPage-qrpYGVD-.js} +1 -1
  14. package/dist/ui/assets/{ModelSelector-BCfvugHB.js → ModelSelector-C8ny_pxu.js} +1 -1
  15. package/dist/ui/assets/{Office3DPage-BE6Epe0d.js → Office3DPage-BYwLMTCl.js} +1 -1
  16. package/dist/ui/assets/{ProvidersPage-D0cApfM1.js → ProvidersPage-DP9v_1ko.js} +1 -1
  17. package/dist/ui/assets/{RecoverPage-BVUPHG9z.js → RecoverPage-BXwjLfap.js} +1 -1
  18. package/dist/ui/assets/SettingsPage-DD7GKtS6.js +9 -0
  19. package/dist/ui/assets/{SetupPage-In19p30M.js → SetupPage-D7YX2io-.js} +1 -1
  20. package/dist/ui/assets/{WebChatPage-ByVBSzxL.js → WebChatPage-C3cgimxd.js} +1 -1
  21. package/dist/ui/assets/{activity-BIIli7ET.js → activity-DZKL7dg4.js} +1 -1
  22. package/dist/ui/assets/{agentCapabilities-D1PD9yFH.js → agentCapabilities-DuGs07XP.js} +1 -1
  23. package/dist/ui/assets/arrow-left-12JaXVoH.js +1 -0
  24. package/dist/ui/assets/arrow-right-Dbui5p0d.js +1 -0
  25. package/dist/ui/assets/arrow-up-right-CJBtXRrp.js +1 -0
  26. package/dist/ui/assets/{calendar-S9-_Q6QR.js → calendar-CkDsc4OJ.js} +1 -1
  27. package/dist/ui/assets/check-DxOMIDcl.js +1 -0
  28. package/dist/ui/assets/chevron-down-CObv-xyx.js +1 -0
  29. package/dist/ui/assets/chevron-left-C0mqwhLU.js +1 -0
  30. package/dist/ui/assets/chevron-right-jCt1h8Kw.js +1 -0
  31. package/dist/ui/assets/chevron-up-DX_5iw7O.js +1 -0
  32. package/dist/ui/assets/{circle-alert-DTVW4R94.js → circle-alert-BkP6x0zQ.js} +1 -1
  33. package/dist/ui/assets/circle-check-CXC2AiMS.js +1 -0
  34. package/dist/ui/assets/{circle-x-CJXbXzRh.js → circle-x-h4OJiHV3.js} +1 -1
  35. package/dist/ui/assets/{copy-X_TPpA-A.js → copy-BtpYEEvV.js} +1 -1
  36. package/dist/ui/assets/{dialog-uUBz_NIB.js → dialog-CO1WrPJc.js} +1 -1
  37. package/dist/ui/assets/{download-C-fXu08w.js → download-aPuVaZik.js} +1 -1
  38. package/dist/ui/assets/{earth-CTsVjCmp.js → earth-sc8YJMc0.js} +1 -1
  39. package/dist/ui/assets/{ellipsis-vertical-5zBh5yzc.js → ellipsis-vertical-DEBZJGzY.js} +1 -1
  40. package/dist/ui/assets/{external-link-CvpRhwC_.js → external-link-D_C_678M.js} +1 -1
  41. package/dist/ui/assets/{eye-CM-HQEWU.js → eye-BfN613fx.js} +1 -1
  42. package/dist/ui/assets/{file-text-lwkvYGtA.js → file-text-Bth5pPZX.js} +1 -1
  43. package/dist/ui/assets/gauge-DypSzSOE.js +1 -0
  44. package/dist/ui/assets/{history-eSHspWRr.js → history-njH_sPSo.js} +1 -1
  45. package/dist/ui/assets/{index-ZjAc-KQS.js → index-D-9yCvjP.js} +2 -2
  46. package/dist/ui/assets/index-wML8DaUo.css +2 -0
  47. package/dist/ui/assets/{info-DTgFQ_jA.js → info-Def2ZFeP.js} +1 -1
  48. package/dist/ui/assets/{key-CeM9JJkq.js → key-D8bkDl83.js} +1 -1
  49. package/dist/ui/assets/loader-circle-wLVzSdML.js +1 -0
  50. package/dist/ui/assets/{lock-open-B089GUAJ.js → lock-open-Cdopbw1b.js} +1 -1
  51. package/dist/ui/assets/{mail--gNFIe4M.js → mail-BQ_YA9_b.js} +1 -1
  52. package/dist/ui/assets/{pause-DjT1nwQM.js → pause-CvS_LzKx.js} +1 -1
  53. package/dist/ui/assets/{pencil-6PRgdjiU.js → pencil-C3tPvnCk.js} +1 -1
  54. package/dist/ui/assets/play-C-oR-PMH.js +1 -0
  55. package/dist/ui/assets/plus-CF9No2td.js +1 -0
  56. package/dist/ui/assets/{radio-D-joO9J0.js → radio-dsaiFxuT.js} +1 -1
  57. package/dist/ui/assets/{refresh-cw-BRrzoHQW.js → refresh-cw-BmYQwOhh.js} +1 -1
  58. package/dist/ui/assets/search-CTONpTyl.js +1 -0
  59. package/dist/ui/assets/{select-BOR8MsSL.js → select-BfRyBbi9.js} +1 -1
  60. package/dist/ui/assets/{send-DIlj81PT.js → send-C3o2wpLi.js} +1 -1
  61. package/dist/ui/assets/{settings-CkBjgAEm.js → settings-DEpdBuf2.js} +1 -1
  62. package/dist/ui/assets/{shield-U0hIjGzm.js → shield-gbUkSqfi.js} +1 -1
  63. package/dist/ui/assets/{sparkles-VXHGDbNh.js → sparkles-Ccd1JZ3s.js} +1 -1
  64. package/dist/ui/assets/{square-OHeetvN3.js → square-BrwQ6Mun.js} +1 -1
  65. package/dist/ui/assets/terminal-DP9j3HjM.js +1 -0
  66. package/dist/ui/assets/{trash-2-DQxm7DUM.js → trash-2-CfCs7RhJ.js} +1 -1
  67. package/dist/ui/assets/{triangle-alert-Dj8ZhmWj.js → triangle-alert-C3lWSnRr.js} +1 -1
  68. package/dist/ui/assets/{useHiveAgentsModelLoad-COLvs-Ho.js → useHiveAgentsModelLoad-D3s2U82M.js} +1 -1
  69. package/dist/ui/assets/{useProviders-q6iROeWE.js → useProviders-B3rT_xU9.js} +1 -1
  70. package/dist/ui/assets/{volume-x-Bm735CXN.js → volume-x-D2h9cyml.js} +1 -1
  71. package/dist/ui/assets/{wifi-DklBfOZ6.js → wifi-CGQECzu2.js} +1 -1
  72. package/dist/ui/assets/{zap-BEZNJ0i0.js → zap-B1azpiE7.js} +1 -1
  73. package/dist/ui/index.html +2 -2
  74. package/package.json +1 -1
  75. package/packages/cli/src/index.ts +23 -17
  76. package/packages/core/src/canvas/canvas-manager.ts +36 -7
  77. package/packages/core/src/gateway/routes/a2ui.ts +43 -0
  78. package/packages/core/src/gateway/routes/runtime.ts +58 -0
  79. package/packages/core/src/gateway/routes/setup.ts +127 -108
  80. package/packages/core/src/gateway/server.ts +16 -0
  81. package/packages/core/src/storage/onboarding.ts +23 -7
  82. package/packages/core/src/storage/seed.ts +31 -2
  83. package/dist/ui/assets/A2UIPage-D4nzp5NV.js +0 -8
  84. package/dist/ui/assets/AgentNewPage-CfBU7puz.js +0 -1
  85. package/dist/ui/assets/SettingsPage-DCZ4nql4.js +0 -9
  86. package/dist/ui/assets/arrow-left-BfcnX8Er.js +0 -1
  87. package/dist/ui/assets/arrow-right-Q-dzAn8k.js +0 -1
  88. package/dist/ui/assets/arrow-up-right-Bf-8wrUQ.js +0 -1
  89. package/dist/ui/assets/check-CryV78SQ.js +0 -1
  90. package/dist/ui/assets/chevron-down-QCtMs-Af.js +0 -1
  91. package/dist/ui/assets/chevron-left-dTGbyl5G.js +0 -1
  92. package/dist/ui/assets/chevron-right-D0GjXbnO.js +0 -1
  93. package/dist/ui/assets/chevron-up-Cg0jO8uT.js +0 -1
  94. package/dist/ui/assets/circle-check-BAolxswA.js +0 -1
  95. package/dist/ui/assets/gauge-CB-cas-h.js +0 -1
  96. package/dist/ui/assets/index-D489S18g.css +0 -2
  97. package/dist/ui/assets/loader-circle-Dtfz4FWw.js +0 -1
  98. package/dist/ui/assets/play-tOrP0xUJ.js +0 -1
  99. package/dist/ui/assets/plus-Cnom3j47.js +0 -1
  100. package/dist/ui/assets/search-D277MUP0.js +0 -1
  101. package/dist/ui/assets/terminal-C6YPcJl_.js +0 -1
package/dist/hive.js CHANGED
@@ -72895,7 +72895,9 @@ class CanvasManager {
72895
72895
  success: true
72896
72896
  });
72897
72897
  ws.send(JSON.stringify({ type: "canvas:connected", sessionId }));
72898
- for (const [surfaceId, cache] of this.a2uiCache) {
72898
+ const sessionSurfaces = this.a2uiCache.get(sessionId) ?? new Map;
72899
+ this.a2uiCache.set(sessionId, sessionSurfaces);
72900
+ for (const [surfaceId, cache] of sessionSurfaces) {
72899
72901
  try {
72900
72902
  ws.send(JSON.stringify({ type: "a2ui:createSurface", data: cache.createData }));
72901
72903
  if (cache.components && cache.components.length > 0) {
@@ -72919,14 +72921,16 @@ class CanvasManager {
72919
72921
  async sendA2UIMessage(sessionId, messageType, data) {
72920
72922
  const surfaceId = data.surfaceId;
72921
72923
  if (surfaceId) {
72924
+ const sessionSurfaces = this.a2uiCache.get(sessionId) ?? new Map;
72925
+ this.a2uiCache.set(sessionId, sessionSurfaces);
72922
72926
  if (messageType === "a2ui:createSurface") {
72923
- this.a2uiCache.set(surfaceId, { createData: data });
72927
+ sessionSurfaces.set(surfaceId, { createData: data });
72924
72928
  } else if (messageType === "a2ui:updateComponents") {
72925
- const cached2 = this.a2uiCache.get(surfaceId);
72929
+ const cached2 = sessionSurfaces.get(surfaceId);
72926
72930
  if (cached2)
72927
72931
  cached2.components = data.components;
72928
72932
  } else if (messageType === "a2ui:updateDataModel") {
72929
- const cached2 = this.a2uiCache.get(surfaceId);
72933
+ const cached2 = sessionSurfaces.get(surfaceId);
72930
72934
  if (cached2) {
72931
72935
  const path15 = data.path;
72932
72936
  const value = data.value;
@@ -72940,7 +72944,7 @@ class CanvasManager {
72940
72944
  }
72941
72945
  }
72942
72946
  } else if (messageType === "a2ui:deleteSurface") {
72943
- this.a2uiCache.delete(surfaceId);
72947
+ sessionSurfaces.delete(surfaceId);
72944
72948
  }
72945
72949
  }
72946
72950
  const ws = this.sessions.get(sessionId);
@@ -72965,6 +72969,18 @@ class CanvasManager {
72965
72969
  activeSessions: this.getConnectedSessions().length
72966
72970
  };
72967
72971
  }
72972
+ getA2UISurfaces(sessionId) {
72973
+ const surfaces = this.a2uiCache.get(sessionId);
72974
+ if (!surfaces)
72975
+ return [];
72976
+ return Array.from(surfaces.entries()).map(([surfaceId, cache]) => ({
72977
+ surfaceId,
72978
+ catalogId: cache.createData.catalogId,
72979
+ theme: cache.createData.theme,
72980
+ hasComponents: Boolean(cache.components?.length),
72981
+ hasDataModel: Boolean(cache.dataModel && Object.keys(cache.dataModel).length > 0)
72982
+ }));
72983
+ }
72968
72984
  clearAll() {
72969
72985
  this.stopHeartbeat();
72970
72986
  this.sessions.clear();
@@ -232223,6 +232239,14 @@ async function putIfAbsent(c, id, doc2) {
232223
232239
  if (!await c.get(id))
232224
232240
  await c.put(id, doc2);
232225
232241
  }
232242
+ function parseSkillList(value) {
232243
+ try {
232244
+ const parsed = value ? JSON.parse(value) : [];
232245
+ return Array.isArray(parsed) ? parsed.filter((id) => typeof id === "string") : [];
232246
+ } catch {
232247
+ return [];
232248
+ }
232249
+ }
232226
232250
  function migrateLegacyCatalogPersona(existing, current) {
232227
232251
  if (existing.id !== LEGACY_CRON_PERSONA.id || existing.source !== "catalog")
232228
232252
  return existing;
@@ -232465,6 +232489,7 @@ async function seedAllData() {
232465
232489
  }
232466
232490
  log72.info(`[seed] \u2705 ${mcpCount} MCP servers procesados`);
232467
232491
  let catalogAgentCount = 0;
232492
+ let repairedCatalogSkills = 0;
232468
232493
  for (const catalogAgent of createSeedCatalogAgents()) {
232469
232494
  await putIfAbsent(agentsCol, catalogAgent.id, catalogAgent);
232470
232495
  const existing = await agentsCol.get(catalogAgent.id);
@@ -232476,12 +232501,24 @@ async function seedAllData() {
232476
232501
  if (reconciled.status === "archived") {
232477
232502
  reconciled = { ...reconciled, status: "idle" };
232478
232503
  }
232504
+ const currentSkills = parseSkillList(reconciled.skills_json);
232505
+ const missingCatalogSkills = parseSkillList(catalogAgent.skills_json).filter((id) => !currentSkills.includes(id));
232506
+ if (missingCatalogSkills.length > 0) {
232507
+ reconciled = {
232508
+ ...reconciled,
232509
+ skills_json: JSON.stringify([...currentSkills, ...missingCatalogSkills])
232510
+ };
232511
+ repairedCatalogSkills += missingCatalogSkills.length;
232512
+ }
232479
232513
  if (JSON.stringify(reconciled) !== JSON.stringify(existing.doc)) {
232480
232514
  await agentsCol.put(existing.id, { ...reconciled, updated_at: now }, { expectedVersion: existing.version });
232481
232515
  }
232482
232516
  catalogAgentCount++;
232483
232517
  }
232484
232518
  log72.info(`[seed] \u2705 ${catalogAgentCount} catalog agents ensured`);
232519
+ if (repairedCatalogSkills > 0) {
232520
+ log72.info(`[seed] \uD83D\uDD27 Restauradas ${repairedCatalogSkills} dependencia(s) de skills en agentes de cat\xE1logo`);
232521
+ }
232485
232522
  const configuredAgents = await ensureAgentsConfigured();
232486
232523
  if (configuredAgents > 0) {
232487
232524
  log72.info(`[seed] \uD83D\uDD27 ${configuredAgents} agent(s) configurados con el modelo del coordinador`);
@@ -232752,7 +232789,6 @@ var init_seed = __esm(() => {
232752
232789
  { id: "minimaxai/minimax-m3", providerId: "nvidia", name: "MiniMax M3 (NVIDIA)", modelType: "llm", contextWindow: 1e6, capabilities: JSON.stringify(["chat", "code", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
232753
232790
  { id: "nvidia/nemotron-3-ultra-550b-a55b", providerId: "nvidia", name: "Nemotron 3 Ultra 550B", modelType: "llm", contextWindow: 1e6, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
232754
232791
  { id: "nvidia/nemotron-3-super-120b-a12b", providerId: "nvidia", name: "Nemotron 3 Super 120B", modelType: "llm", contextWindow: 1e6, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
232755
- { id: "deepseek-ai/deepseek-v4-pro", providerId: "nvidia", name: "DeepSeek V4 Pro (NVIDIA)", modelType: "llm", contextWindow: 1e6, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
232756
232792
  { id: "Qwen-Ambassador/Qwen3.8-Max", providerId: "modelscope", name: "Qwen3.8 Max (Embajador)", modelType: "llm", contextWindow: 1e6, capabilities: JSON.stringify(["chat", "code", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
232757
232793
  { id: "Qwen-Ambassador/Qwen3.7-Max", providerId: "modelscope", name: "Qwen3.7 Max (Embajador)", modelType: "llm", contextWindow: 1e6, capabilities: JSON.stringify(["chat", "code", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
232758
232794
  { id: "Qwen-Ambassador/Qwen3.7-Plus", providerId: "modelscope", name: "Qwen3.7 Plus (Embajador)", modelType: "llm", contextWindow: 1e6, capabilities: JSON.stringify(["chat", "code", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
@@ -233889,7 +233925,23 @@ Le\xE9 el pedido completo y mir\xE1 lo que ya sab\xE9s: la secci\xF3n SCRATCHPAD
233889
233925
 
233890
233926
  **Si es un saludo, una charla o una pregunta que respond\xE9s de memoria: respond\xE9 y termin\xE1.** Eso no se delega nunca ni necesita herramientas.
233891
233927
 
233892
- ## 2. DESCOMPONER
233928
+ ## 2. MAPA R\xC1PIDO DE ESPECIALISTAS
233929
+
233930
+ Para cualquier pedido operativo, comparalo primero con este mapa y deleg\xE1 al especialista m\xE1s cercano:
233931
+
233932
+ - \`web_researcher\`: investiga informaci\xF3n actual en la web y entrega fuentes.
233933
+ - \`browser_operator\`: navega sitios, completa formularios y verifica el resultado.
233934
+ - \`workspace_file_operator\`: crea, lee, edita y organiza archivos del workspace.
233935
+ - \`software_engineer\`: implementa, depura y prueba software en un repositorio.
233936
+ - \`office_document_agent\`: lee y genera PDF, Word, Excel y PowerPoint.
233937
+ - \`a2ui_builder\`: construye formularios, dashboards y flujos interactivos A2UI.
233938
+ - \`schedule_automation_agent\`: crea y administra jobs, recordatorios y automatizaciones de Hive.
233939
+ - \`api_operator\`: ejecuta y verifica operaciones contra APIs REST autorizadas.
233940
+ - Especialistas MCP del usuario: workers con integraciones espec\xEDficas; encontralos con \`agent_find\` antes de usar una tool MCP.
233941
+
233942
+ **Regla de prioridad:** primero eleg\xED un agente de este mapa y us\xE1 \`task_delegate\`, pero verific\xE1 antes que aparezca activo en la COLMENA; el mapa describe roles y no garantiza disponibilidad. Si no est\xE1 activo o ninguno encaja, busc\xE1 otro worker con \`agent_find\`; solo despu\xE9s descubr\xED herramientas y resolv\xE9 directamente. No delegues a un ID asumido ni elijas herramientas directas antes de hacer esta comprobaci\xF3n, salvo saludos, charla o preguntas que respond\xE9s de memoria.
233943
+
233944
+ ## 3. DESCOMPONER
233893
233945
 
233894
233946
  Separ\xE1 el pedido en partes y clasific\xE1 cada una:
233895
233947
 
@@ -233899,7 +233951,7 @@ Separ\xE1 el pedido en partes y clasific\xE1 cada una:
233899
233951
  | Una necesita el resultado de otra | Va en una fase posterior |
233900
233952
  | Trivial o conversacional | La resolv\xE9s vos, sin herramientas |
233901
233953
 
233902
- ## 3. POR CADA PARTE: \xBFHAY UN AGENTE QUE LA HAGA?
233954
+ ## 4. POR CADA PARTE: \xBFHAY UN AGENTE QUE LA HAGA?
233903
233955
 
233904
233956
  **Esta es la pregunta central de tu rol, y contestarla es gratis:** el roster est\xE1 en la secci\xF3n COLMENA DE AGENTES de este mismo prompt, no hace falta ninguna llamada para consultarlo.
233905
233957
 
@@ -233923,7 +233975,7 @@ Separ\xE1 el pedido en partes y clasific\xE1 cada una:
233923
233975
 
233924
233976
  Si \`search_knowledge\` no devuelve nada y el pedido es corto o ambiguo, **preguntale al usuario** en vez de adivinar y encadenar m\xE1s b\xFAsquedas. Una pregunta cuesta un turno; adivinar mal cuesta varios.
233925
233977
 
233926
- ## 4. DELEGAR EN PARALELO
233978
+ ## 5. DELEGAR EN PARALELO
233927
233979
 
233928
233980
  Las partes independientes se lanzan **todas en el mismo turno**: una \`task_delegate\` por parte, con \`mode="async"\`. Hive las agrupa por turno y los workers corren simult\xE1neamente.
233929
233981
 
@@ -233931,9 +233983,9 @@ Si el usuario pide tres cosas que no dependen entre s\xED, son tres \`task_deleg
233931
233983
 
233932
233984
  Cada delegaci\xF3n lleva: \`worker_id\`, una subtarea acotada, contexto m\xEDnimo y \`acceptance\` verificable. Antes de delegar, si el worker va a necesitar herramientas puntuales, buscalas con \`search_knowledge\` e incluilas en la instrucci\xF3n. Reserv\xE1 \`mode="sync"\` solo para un lookup cuyo resultado esper\xE1s en segundos.
233933
233985
 
233934
- Si m\xE1s adelante una entrega no cumple sus criterios, \`task_revise\` reencola al mismo worker sobre el mismo hilo (ver secci\xF3n 6) \u2014 no crees una delegaci\xF3n nueva para corregir algo ya delegado.
233986
+ Si m\xE1s adelante una entrega no cumple sus criterios, \`task_revise\` reencola al mismo worker sobre el mismo hilo (ver secci\xF3n 7) \u2014 no crees una delegaci\xF3n nueva para corregir algo ya delegado.
233935
233987
 
233936
- ## 5. ESPERAR: NO ESPER\xC1S
233988
+ ## 6. ESPERAR: NO ESPER\xC1S
233937
233989
 
233938
233990
  Despu\xE9s de delegar, contale al usuario en una l\xEDnea qu\xE9 pusiste a correr y **termin\xE1 tu turno**.
233939
233991
 
@@ -233943,7 +233995,7 @@ Cuando todas las tareas del turno alcanzan estado terminal, Hive te reinvoca aut
233943
233995
  - No anuncies resultados que todav\xEDa no ten\xE9s ni declares \xE9xito antes del \`[Sistema]\`.
233944
233996
  - No re-delegues una tarea porque "no contest\xF3": ya est\xE1 encolada.
233945
233997
 
233946
- ## 6. CERRAR
233998
+ ## 7. CERRAR
233947
233999
 
233948
234000
  Al recibir el \`[Sistema]\`, cada entrega trae sus \`acceptance\` (criterios) y sus \`checks\` (resultado determin\xEDstico, sin LLM, ya calculado):
233949
234001
 
@@ -233961,7 +234013,7 @@ Guard\xE1 lo que vaya a servir despu\xE9s: \`save_note\` para esta conversaci\xF
233961
234013
 
233962
234014
  1. **\xC9tica primero** \u2014 Oper\xE1s bajo un C\xF3digo de \xC9tica obligatorio que no pod\xE9s ignorar.
233963
234015
  2. **Verdad de ejecuci\xF3n** \u2014 \`TaskDoc\`/\`JobDoc\` son la fuente de verdad. \`agent_find\` solo descubre workers; nunca prueba si algo est\xE1 corriendo: para eso est\xE1n \`task_list\` y \`task_status\`. Si \`task_delegate\` devuelve \`ok=true\` con \`task_id\`, \`job_id\` y \`run_id\`, la tarea se persisti\xF3 de verdad y no es una simulaci\xF3n. Si una herramienta falla, report\xE1 su resultado exacto: no inventes IDs, estados ni ejecuciones.
233964
- 3. **Vos acept\xE1s las entregas** \u2014 cada entrega vuelve con sus criterios, su evidencia y el resultado de los checks determin\xEDsticos (ver secci\xF3n 6). Si cumple, la integr\xE1s; si no, \`task_revise\` con feedback concreto, o la correg\xEDs vos si es trivial. Si un worker devuelve \`needs_input\`, vos formul\xE1s la pregunta al usuario con contexto.
234016
+ 3. **Vos acept\xE1s las entregas** \u2014 cada entrega vuelve con sus criterios, su evidencia y el resultado de los checks determin\xEDsticos (ver secci\xF3n 7). Si cumple, la integr\xE1s; si no, \`task_revise\` con feedback concreto, o la correg\xEDs vos si es trivial. Si un worker devuelve \`needs_input\`, vos formul\xE1s la pregunta al usuario con contexto.
233965
234017
  4. **Busc\xE1 antes de crear** \u2014 nunca crees un worker si el cat\xE1logo ya cubre la tarea.
233966
234018
  5. **M\xEDnimo privilegio** \u2014 solo las herramientas necesarias a cada worker. La \xFAnica excepci\xF3n expl\xEDcita es un especialista MCP aprobado por el usuario: recibe el servidor completo que figura en \`mcp_server_ids_json\`, nunca otros servidores.
233967
234019
  6. **Nunca \`cli_exec\` para cron** \u2014 us\xE1 \`cron.create\`, y pregunt\xE1 al usuario cada cu\xE1nto ejecutar.
@@ -234167,7 +234219,7 @@ var package_default;
234167
234219
  var init_package = __esm(() => {
234168
234220
  package_default = {
234169
234221
  name: "@johpaz/hive-agents",
234170
- version: "1.0.1",
234222
+ version: "1.0.2",
234171
234223
  description: "Tu colmena de agentes IA. Local-first. Multi-canal. Open source. Construido desde Colombia para el mundo.",
234172
234224
  private: false,
234173
234225
  bin: {
@@ -483627,7 +483679,8 @@ async function providerBaseUrl(providerId) {
483627
483679
  }
483628
483680
  async function handleVerifyProvider(req) {
483629
483681
  const body = await req.json().catch(() => ({}));
483630
- const { provider, apiKey, model } = body;
483682
+ const { provider } = body;
483683
+ const apiKey = typeof body.apiKey === "string" ? body.apiKey.trim() : body.apiKey;
483631
483684
  if (!provider || !apiKey) {
483632
483685
  return Response.json({
483633
483686
  success: false,
@@ -483636,18 +483689,7 @@ async function handleVerifyProvider(req) {
483636
483689
  }
483637
483690
  try {
483638
483691
  let testUrl = null;
483639
- let testBody = null;
483640
483692
  let headers = {};
483641
- const testMessages = [{ role: "user", content: "Say 'ok' if you can read this." }];
483642
- let pingModel = model;
483643
- if (!pingModel) {
483644
- try {
483645
- const modelsCol = await col("models");
483646
- const candidates = (await modelsCol.findBy("provider_id", provider)).filter((e) => e.doc.model_type === "llm");
483647
- const best = [...candidates].sort((a, b2) => Number(b2.doc.active) - Number(a.doc.active))[0];
483648
- pingModel = best ? wireModelId(provider, best.doc.id) : undefined;
483649
- } catch {}
483650
- }
483651
483693
  if (provider === "ollama") {
483652
483694
  const ollamaUrl = process.env.OLLAMA_HOST || "http://localhost:11434";
483653
483695
  try {
@@ -483666,91 +483708,33 @@ async function handleVerifyProvider(req) {
483666
483708
  }
483667
483709
  }
483668
483710
  if (provider === "anthropic") {
483669
- testUrl = "https://api.anthropic.com/v1/messages";
483670
- testBody = {
483671
- model: pingModel || "claude-sonnet-5",
483672
- max_tokens: 10,
483673
- messages: testMessages
483674
- };
483711
+ testUrl = "https://api.anthropic.com/v1/models";
483675
483712
  headers = {
483676
- "Content-Type": "application/json",
483677
483713
  "x-api-key": apiKey,
483678
483714
  "anthropic-version": "2023-06-01",
483679
483715
  "anthropic-dangerous-direct-browser-access": "true"
483680
483716
  };
483681
483717
  } else if (provider === "openai") {
483682
- testUrl = "https://api.openai.com/v1/chat/completions";
483683
- testBody = {
483684
- model: pingModel || "gpt-5.6-luna",
483685
- max_tokens: 10,
483686
- messages: testMessages
483687
- };
483688
- headers = {
483689
- "Content-Type": "application/json",
483690
- Authorization: `Bearer ${apiKey}`
483691
- };
483718
+ testUrl = "https://api.openai.com/v1/models";
483719
+ headers = { Authorization: `Bearer ${apiKey}` };
483692
483720
  } else if (provider === "gemini") {
483693
- testUrl = `https://generativelanguage.googleapis.com/v1beta/models/${pingModel || "gemini-3.6-flash"}:generateContent?key=${apiKey}`;
483694
- testBody = {
483695
- contents: [{ parts: [{ text: "Say ok" }] }]
483696
- };
483697
- headers = { "Content-Type": "application/json" };
483721
+ testUrl = `https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}`;
483698
483722
  } else if (provider === "groq") {
483699
- testUrl = "https://api.groq.com/openai/v1/chat/completions";
483700
- testBody = {
483701
- model: pingModel || "llama-3.3-70b-versatile",
483702
- max_tokens: 10,
483703
- messages: testMessages
483704
- };
483705
- headers = {
483706
- "Content-Type": "application/json",
483707
- Authorization: `Bearer ${apiKey}`
483708
- };
483723
+ testUrl = "https://api.groq.com/openai/v1/models";
483724
+ headers = { Authorization: `Bearer ${apiKey}` };
483709
483725
  } else if (provider === "openrouter") {
483710
- testUrl = "https://openrouter.ai/api/v1/chat/completions";
483711
- testBody = {
483712
- model: pingModel || "anthropic/claude-sonnet-5",
483713
- max_tokens: 10,
483714
- messages: testMessages
483715
- };
483716
- headers = {
483717
- "Content-Type": "application/json",
483718
- Authorization: `Bearer ${apiKey}`
483719
- };
483726
+ testUrl = "https://openrouter.ai/api/v1/key";
483727
+ headers = { Authorization: `Bearer ${apiKey}` };
483720
483728
  } else if (provider === "mistral") {
483721
- testUrl = "https://api.mistral.ai/v1/chat/completions";
483722
- testBody = {
483723
- model: pingModel || "mistral-small-latest",
483724
- max_tokens: 10,
483725
- messages: testMessages
483726
- };
483727
- headers = {
483728
- "Content-Type": "application/json",
483729
- Authorization: `Bearer ${apiKey}`
483730
- };
483729
+ testUrl = "https://api.mistral.ai/v1/models";
483730
+ headers = { Authorization: `Bearer ${apiKey}` };
483731
483731
  } else if (provider === "deepseek") {
483732
- testUrl = "https://api.deepseek.com/v1/chat/completions";
483733
- testBody = {
483734
- model: pingModel || "deepseek-v4-flash",
483735
- max_tokens: 10,
483736
- messages: testMessages
483737
- };
483738
- headers = {
483739
- "Content-Type": "application/json",
483740
- Authorization: `Bearer ${apiKey}`
483741
- };
483732
+ testUrl = "https://api.deepseek.com/v1/models";
483733
+ headers = { Authorization: `Bearer ${apiKey}` };
483742
483734
  } else if (provider === "kimi") {
483743
- testUrl = "https://api.moonshot.ai/v1/chat/completions";
483744
- testBody = {
483745
- model: pingModel || "kimi-k3",
483746
- max_tokens: 10,
483747
- messages: testMessages
483748
- };
483749
- headers = {
483750
- "Content-Type": "application/json",
483751
- Authorization: `Bearer ${apiKey}`
483752
- };
483753
- } else if (OPENAI_COMPAT_PING.has(provider)) {
483735
+ testUrl = "https://api.moonshot.ai/v1/models";
483736
+ headers = { Authorization: `Bearer ${apiKey}` };
483737
+ } else if (PUBLIC_MODEL_LIST.has(provider)) {
483754
483738
  const baseUrl = (await providerBaseUrl(provider))?.replace(/\/+$/, "");
483755
483739
  if (!baseUrl) {
483756
483740
  return Response.json({
@@ -483758,22 +483742,61 @@ async function handleVerifyProvider(req) {
483758
483742
  error: `El provider "${provider}" no tiene base_url configurada. Agregala en su configuraci\xF3n.`
483759
483743
  });
483760
483744
  }
483761
- if (!pingModel) {
483745
+ let curatedModels = [];
483746
+ try {
483747
+ const modelsCol = await col("models");
483748
+ curatedModels = (await modelsCol.findBy("provider_id", provider)).filter((e) => e.doc.model_type === "llm").map((e) => wireModelId(provider, e.doc.id));
483749
+ } catch {}
483750
+ let liveModels = [];
483751
+ try {
483752
+ const listRes = await fetch(`${baseUrl}/models`, { signal: AbortSignal.timeout(1e4) });
483753
+ const listData = await listRes.json();
483754
+ const NON_CHAT = /embed|rerank|bge|colbert|clip|e5-|gte-|whisper|tts|guard/i;
483755
+ liveModels = (listData.data ?? []).map((m2) => m2.id).filter((id) => id && !NON_CHAT.test(id));
483756
+ } catch {}
483757
+ const candidates = [...new Set([...curatedModels, ...liveModels])].slice(0, 6);
483758
+ if (candidates.length === 0) {
483762
483759
  return Response.json({
483763
483760
  success: false,
483764
- error: `El provider "${provider}" no tiene modelos en el cat\xE1logo para probar la key.`
483761
+ error: `No se pudo obtener el cat\xE1logo de modelos de "${provider}" para probar la key.`
483765
483762
  });
483766
483763
  }
483767
- testUrl = `${baseUrl}/chat/completions`;
483768
- testBody = {
483769
- model: pingModel,
483770
- max_tokens: 10,
483771
- messages: testMessages
483772
- };
483773
- headers = {
483774
- "Content-Type": "application/json",
483775
- Authorization: `Bearer ${apiKey}`
483776
- };
483764
+ let lastStatus = 0;
483765
+ let lastBody = "";
483766
+ for (const candidate of candidates) {
483767
+ const pingRes = await fetch(`${baseUrl}/chat/completions`, {
483768
+ method: "POST",
483769
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
483770
+ body: JSON.stringify({
483771
+ model: candidate,
483772
+ max_tokens: 10,
483773
+ messages: [{ role: "user", content: "Say 'ok' if you can read this." }]
483774
+ }),
483775
+ signal: AbortSignal.timeout(1e4)
483776
+ });
483777
+ if (pingRes.ok)
483778
+ return Response.json({ success: true, error: null });
483779
+ lastStatus = pingRes.status;
483780
+ lastBody = (await pingRes.text()).slice(0, 300);
483781
+ if (pingRes.status === 401 || pingRes.status === 403)
483782
+ break;
483783
+ log81.warn(`verify-provider ${provider}: modelo=${candidate} status=${pingRes.status} body=${lastBody} \u2014 probando siguiente candidato`);
483784
+ }
483785
+ log81.warn(`verify-provider ${provider} fall\xF3 tras ${candidates.length} candidato(s): \xFAltimo status=${lastStatus} body=${lastBody}`);
483786
+ return Response.json({
483787
+ success: false,
483788
+ error: `API error: ${lastStatus}`
483789
+ });
483790
+ } else if (OPENAI_COMPAT_PING.has(provider)) {
483791
+ const baseUrl = (await providerBaseUrl(provider))?.replace(/\/+$/, "");
483792
+ if (!baseUrl) {
483793
+ return Response.json({
483794
+ success: false,
483795
+ error: `El provider "${provider}" no tiene base_url configurada. Agregala en su configuraci\xF3n.`
483796
+ });
483797
+ }
483798
+ testUrl = `${baseUrl}/models`;
483799
+ headers = { Authorization: `Bearer ${apiKey}` };
483777
483800
  }
483778
483801
  if (provider === "hiveagents") {
483779
483802
  const hiveUrl = (process.env.HIVEAGENTS_BASE_URL || "https://llm.hiveagents.io").replace(/\/+$/, "");
@@ -483801,19 +483824,24 @@ async function handleVerifyProvider(req) {
483801
483824
  }, { status: 400 });
483802
483825
  }
483803
483826
  const response = await fetch(testUrl, {
483804
- method: "POST",
483827
+ method: "GET",
483805
483828
  headers,
483806
- body: JSON.stringify(testBody),
483807
483829
  signal: AbortSignal.timeout(1e4)
483808
483830
  });
483831
+ if (!response.ok) {
483832
+ log81.warn(`verify-provider ${provider} fall\xF3: url=${testUrl} status=${response.status} body=${(await response.text()).slice(0, 300)}`);
483833
+ }
483809
483834
  return Response.json({
483810
483835
  success: response.ok,
483811
483836
  error: response.ok ? null : `API error: ${response.status}`
483812
483837
  });
483813
483838
  } catch (error54) {
483839
+ const message = error54.message;
483840
+ log81.warn(`verify-provider ${provider} excepci\xF3n: ${message}`);
483841
+ const isHeaderError = /header/i.test(message) && /invalid/i.test(message);
483814
483842
  return Response.json({
483815
483843
  success: false,
483816
- error: `Connection error: ${error54.message}`
483844
+ error: isHeaderError ? "La API key tiene caracteres inv\xE1lidos (revis\xE1 que no tenga saltos de l\xEDnea o espacios raros al copiarla)." : `Connection error: ${message}`
483817
483845
  });
483818
483846
  }
483819
483847
  }
@@ -483955,14 +483983,17 @@ async function handleCompleteSetup(req, config2, addCorsHeaders2) {
483955
483983
  }, { status: 500 }), req);
483956
483984
  }
483957
483985
  }
483958
- var OPENAI_COMPAT_PING;
483986
+ var log81, OPENAI_COMPAT_PING, PUBLIC_MODEL_LIST;
483959
483987
  var init_setup = __esm(() => {
483960
483988
  init_hive();
483961
483989
  init_onboarding();
483962
483990
  init_user_email();
483963
483991
  init_model_id();
483964
483992
  init_loader();
483965
- OPENAI_COMPAT_PING = new Set(["nvidia", "z-ai", "minimax", "qwen", "opencode-go", "modelscope"]);
483993
+ init_logger();
483994
+ log81 = logger.child("setup");
483995
+ OPENAI_COMPAT_PING = new Set(["z-ai", "minimax", "qwen", "opencode-go"]);
483996
+ PUBLIC_MODEL_LIST = new Set(["nvidia", "modelscope"]);
483966
483997
  });
483967
483998
 
483968
483999
  // packages/core/src/gateway/routes/auth.ts
@@ -484540,14 +484571,14 @@ async function handleLoadHiveAgentsModel(req, addCorsHeaders2) {
484540
484571
  return addCorsHeaders2(Response.json({ error: "API key not configured for hiveagents" }, { status: 400 }), req);
484541
484572
  }
484542
484573
  const baseUrl = providerEntry.doc.base_url ?? undefined;
484543
- log81.info(`[gateway] Loading hiveagents model ${modelId} with ctx=${ctx} via ${baseUrl || "https://llm.hiveagents.io"}`);
484574
+ log82.info(`[gateway] Loading hiveagents model ${modelId} with ctx=${ctx} via ${baseUrl || "https://llm.hiveagents.io"}`);
484544
484575
  const result = await loadHiveAgentsModel(modelId, apiKey, baseUrl, ctx);
484545
484576
  if (!result.success) {
484546
- log81.error(`[gateway] Failed to load hiveagents model ${modelId}: ${result.error}`);
484577
+ log82.error(`[gateway] Failed to load hiveagents model ${modelId}: ${result.error}`);
484547
484578
  return addCorsHeaders2(Response.json({ error: result.error }, { status: 502 }), req);
484548
484579
  }
484549
484580
  const isLoading = result.loading === true;
484550
- log81.info(`[gateway] hiveagents load request accepted for ${modelId} with ctx=${ctx}${isLoading ? " (timeout/backend still loading)" : ""}`);
484581
+ log82.info(`[gateway] hiveagents load request accepted for ${modelId} with ctx=${ctx}${isLoading ? " (timeout/backend still loading)" : ""}`);
484551
484582
  return addCorsHeaders2(Response.json({ success: true, loading: isLoading, model_id: modelId, ctx }), req);
484552
484583
  }
484553
484584
  async function handleGetHiveAgentsModelStatus(req, addCorsHeaders2) {
@@ -484563,14 +484594,14 @@ async function handleGetHiveAgentsModelStatus(req, addCorsHeaders2) {
484563
484594
  const status = await getHiveAgentsModelStatus(apiKey, providerEntry.doc.base_url ?? undefined);
484564
484595
  return addCorsHeaders2(Response.json({ success: true, ...status }), req);
484565
484596
  }
484566
- var log81;
484597
+ var log82;
484567
484598
  var init_providers2 = __esm(() => {
484568
484599
  init_hive();
484569
484600
  init_model_id();
484570
484601
  init_crypto();
484571
484602
  init_hiveagents();
484572
484603
  init_logger();
484573
- log81 = logger.child("gateway");
484604
+ log82 = logger.child("gateway");
484574
484605
  });
484575
484606
 
484576
484607
  // packages/core/src/gateway/routes/users.ts
@@ -484803,6 +484834,85 @@ var init_skills3 = __esm(() => {
484803
484834
  init_skill_selector();
484804
484835
  });
484805
484836
 
484837
+ // packages/core/src/gateway/routes/a2ui.ts
484838
+ async function handleGetA2UISurfaces(req, addCorsHeaders2) {
484839
+ const userId = await resolveUserId({});
484840
+ if (!userId) {
484841
+ return addCorsHeaders2(Response.json({ surfaces: [], sessionId: null }), req);
484842
+ }
484843
+ const sessionId = `canvas:${userId}`;
484844
+ return addCorsHeaders2(Response.json({
484845
+ sessionId,
484846
+ surfaces: canvasManager.getA2UISurfaces(sessionId)
484847
+ }), req);
484848
+ }
484849
+ async function handleDeleteA2UISurface(req, addCorsHeaders2) {
484850
+ const userId = await resolveUserId({});
484851
+ const surfaceId = decodeURIComponent(new URL(req.url).pathname.split("/").pop() ?? "");
484852
+ if (!userId || !surfaceId) {
484853
+ return addCorsHeaders2(Response.json({ success: false, error: "surfaceId required" }, { status: 400 }), req);
484854
+ }
484855
+ const sessionId = `canvas:${userId}`;
484856
+ const known = canvasManager.getA2UISurfaces(sessionId).some((surface) => surface.surfaceId === surfaceId);
484857
+ if (!known) {
484858
+ return addCorsHeaders2(Response.json({ success: false, error: "Surface not found", surfaceId }, { status: 404 }), req);
484859
+ }
484860
+ await canvasManager.sendA2UIMessage(sessionId, "a2ui:deleteSurface", { surfaceId });
484861
+ return addCorsHeaders2(Response.json({ success: true, sessionId, surfaceId }), req);
484862
+ }
484863
+ var init_a2ui2 = __esm(() => {
484864
+ init_canvas_manager();
484865
+ init_onboarding();
484866
+ });
484867
+
484868
+ // packages/core/src/gateway/routes/runtime.ts
484869
+ function parseSkillIds(value) {
484870
+ try {
484871
+ const parsed = value ? JSON.parse(value) : [];
484872
+ return Array.isArray(parsed) ? parsed.filter((id) => typeof id === "string") : [];
484873
+ } catch {
484874
+ return [];
484875
+ }
484876
+ }
484877
+ async function handleGetRuntimeStatus(req, addCorsHeaders2) {
484878
+ const skills = (await (await col("skills")).scan({})).map((entry) => entry.doc);
484879
+ const agents = (await (await col("agents")).scan({})).map((entry) => entry.doc);
484880
+ const byName = new Map(skills.map((skill) => [skill.name, skill]));
484881
+ const a2uiBuilder = agents.find((agent) => agent.id === "a2ui_builder");
484882
+ const required2 = REQUIRED_CATALOG_SKILLS.map((name) => ({
484883
+ name,
484884
+ present: byName.has(name),
484885
+ active: byName.get(name)?.active === true
484886
+ }));
484887
+ return addCorsHeaders2(Response.json({
484888
+ version: package_default.version,
484889
+ process: {
484890
+ execPath: process.execPath,
484891
+ nodeEnv: "development"
484892
+ },
484893
+ hiveHome: process.env.HIVE_HOME ?? getHiveDir(),
484894
+ skills: {
484895
+ total: skills.length,
484896
+ active: skills.filter((skill) => skill.active).length,
484897
+ required: required2
484898
+ },
484899
+ agents: {
484900
+ a2ui_builder: a2uiBuilder ? {
484901
+ enabled: a2uiBuilder.enabled,
484902
+ skills: parseSkillIds(a2uiBuilder.skills_json)
484903
+ } : null
484904
+ },
484905
+ healthy: required2.every((skill) => skill.present && skill.active)
484906
+ }), req);
484907
+ }
484908
+ var REQUIRED_CATALOG_SKILLS;
484909
+ var init_runtime = __esm(() => {
484910
+ init_hive();
484911
+ init_loader();
484912
+ init_package();
484913
+ REQUIRED_CATALOG_SKILLS = ["a2ui_form", "a2ui_dashboard", "a2ui_interactive"];
484914
+ });
484915
+
484806
484916
  // packages/core/src/gateway/routes/ethics.ts
484807
484917
  async function handleGetEthics(req, addCorsHeaders2) {
484808
484918
  const ethicsCol = await col("ethics");
@@ -484955,7 +485065,7 @@ async function resolveNarrationMode(channelType) {
484955
485065
  const row = (await channels.scan({})).find((e) => e.doc.type === channelType);
484956
485066
  mode = coerceMode(row?.doc.step_delivery_mode);
484957
485067
  } catch (error54) {
484958
- log82.debug(`Could not resolve narration mode for ${channelType}: ${error54.message}`);
485068
+ log83.debug(`Could not resolve narration mode for ${channelType}: ${error54.message}`);
484959
485069
  }
484960
485070
  modeCache.set(channelType, { mode, expiresAt: Date.now() + MODE_CACHE_TTL_MS });
484961
485071
  return mode;
@@ -484986,7 +485096,7 @@ ${detail}` : `${prefix} ${event.label}`;
484986
485096
  function enqueueChannelNarration(key, send) {
484987
485097
  const previous = sendQueues.get(key) ?? Promise.resolve();
484988
485098
  const next = previous.then(send).catch((error54) => {
484989
- log82.warn(`Narration delivery failed for ${key}: ${error54.message}`);
485099
+ log83.warn(`Narration delivery failed for ${key}: ${error54.message}`);
484990
485100
  }).finally(() => {
484991
485101
  if (sendQueues.get(key) === next)
484992
485102
  sendQueues.delete(key);
@@ -484996,11 +485106,11 @@ function enqueueChannelNarration(key, send) {
484996
485106
  async function awaitChannelNarration(key) {
484997
485107
  await (sendQueues.get(key) ?? Promise.resolve());
484998
485108
  }
484999
- var log82, DEFAULT_NARRATION_MODE = "milestones", MILESTONE_KINDS, KIND_PREFIX, DETAIL_MAX_CHARS = 200, MODE_CACHE_TTL_MS = 30000, modeCache, sendQueues;
485109
+ var log83, DEFAULT_NARRATION_MODE = "milestones", MILESTONE_KINDS, KIND_PREFIX, DETAIL_MAX_CHARS = 200, MODE_CACHE_TTL_MS = 30000, modeCache, sendQueues;
485000
485110
  var init_channel_narration = __esm(() => {
485001
485111
  init_hive();
485002
485112
  init_logger();
485003
- log82 = logger.child("narration:channel");
485113
+ log83 = logger.child("narration:channel");
485004
485114
  MILESTONE_KINDS = new Set([
485005
485115
  "delegated",
485006
485116
  "worker_started",
@@ -485026,27 +485136,27 @@ function setSchedulerForCleanup(scheduler) {
485026
485136
  _scheduler2 = scheduler;
485027
485137
  }
485028
485138
  async function executeScheduledTask(job) {
485029
- log83.info(`[execute] Processing job "${job.name}" (${job.id})`);
485139
+ log84.info(`[execute] Processing job "${job.name}" (${job.id})`);
485030
485140
  try {
485031
485141
  let payload;
485032
485142
  try {
485033
485143
  payload = JSON.parse(job.payload);
485034
485144
  } catch (err) {
485035
- log83.error(`[execute] Invalid payload JSON for job "${job.id}": ${err.message}`);
485145
+ log84.error(`[execute] Invalid payload JSON for job "${job.id}": ${err.message}`);
485036
485146
  return { success: false, error: "Invalid payload JSON" };
485037
485147
  }
485038
485148
  const prompt = payload.prompt || payload.message;
485039
485149
  if (!prompt && !payload._internal && !job.task) {
485040
- log83.error(`[execute] Job "${job.id}" has no prompt, message, or task instruction`);
485150
+ log84.error(`[execute] Job "${job.id}" has no prompt, message, or task instruction`);
485041
485151
  return { success: false, error: "Missing prompt, message, or task instruction" };
485042
485152
  }
485043
485153
  if (payload._internal === true && payload.action === "cleanup") {
485044
485154
  if (_scheduler2) {
485045
485155
  await _scheduler2.runCleanup();
485046
485156
  } else {
485047
- log83.warn("[execute] Cleanup job fired but scheduler instance not available");
485157
+ log84.warn("[execute] Cleanup job fired but scheduler instance not available");
485048
485158
  }
485049
- log83.info("[execute] Cleanup job executed");
485159
+ log84.info("[execute] Cleanup job executed");
485050
485160
  return { success: true, response: "Cleanup completed" };
485051
485161
  }
485052
485162
  const metadata = {
@@ -485060,7 +485170,7 @@ async function executeScheduledTask(job) {
485060
485170
  let targetAgentId = job.agent_id || null;
485061
485171
  if (!targetAgentId) {
485062
485172
  targetAgentId = await resolveAgentId(null);
485063
- log83.debug(`[execute] No agent specified, routing to Coordinator: ${targetAgentId}`);
485173
+ log84.debug(`[execute] No agent specified, routing to Coordinator: ${targetAgentId}`);
485064
485174
  }
485065
485175
  const usersCol = await col("users");
485066
485176
  const userEntry = (await usersCol.scan({ limit: 1 }))[0];
@@ -485095,7 +485205,7 @@ Type: ${job.task_type}
485095
485205
  Triggered at: ${hora_usuario} on ${fecha_usuario} (${userTimezone})
485096
485206
 
485097
485207
  ${prompt || `Execute tool: ${job.tool_name}`}`;
485098
- log83.debug(`[execute] Sending to agent ${targetAgentId}: "${contextPrompt.slice(0, 100)}..."`);
485208
+ log84.debug(`[execute] Sending to agent ${targetAgentId}: "${contextPrompt.slice(0, 100)}..."`);
485099
485209
  try {
485100
485210
  const agentLoop = buildAgentLoop({ mcpManager: undefined });
485101
485211
  const sessionId = `sched_${job.id}_${Date.now()}`;
@@ -485112,7 +485222,7 @@ ${prompt || `Execute tool: ${job.tool_name}`}`;
485112
485222
  await sendToUserChannel(agentChannel, user?.id || "", trimmed);
485113
485223
  }
485114
485224
  } catch (err) {
485115
- log83.warn(`[execute] Narration send failed: ${err.message}`);
485225
+ log84.warn(`[execute] Narration send failed: ${err.message}`);
485116
485226
  }
485117
485227
  };
485118
485228
  const messages2 = [{ role: "user", content: contextPrompt }];
@@ -485148,20 +485258,20 @@ ${prompt || `Execute tool: ${job.tool_name}`}`;
485148
485258
  if (hasError && !response) {
485149
485259
  throw new Error("Agent execution returned errors");
485150
485260
  }
485151
- log83.info(`[execute] Agent response received for job "${job.name}"`);
485261
+ log84.info(`[execute] Agent response received for job "${job.name}"`);
485152
485262
  return {
485153
485263
  success: true,
485154
485264
  response: response || "Task executed successfully"
485155
485265
  };
485156
485266
  } catch (agentErr) {
485157
- log83.error(`[execute] Agent execution failed: ${agentErr.message}`);
485267
+ log84.error(`[execute] Agent execution failed: ${agentErr.message}`);
485158
485268
  return {
485159
485269
  success: false,
485160
485270
  error: `Agent execution failed: ${agentErr.message}`
485161
485271
  };
485162
485272
  }
485163
485273
  } catch (err) {
485164
- log83.error(`[execute] Job execution failed: ${err.message}`);
485274
+ log84.error(`[execute] Job execution failed: ${err.message}`);
485165
485275
  return {
485166
485276
  success: false,
485167
485277
  error: err.message
@@ -485172,7 +485282,7 @@ async function notifyTaskCompletion(taskId, taskName, success2, response, error5
485172
485282
  const cronJobsCol = await col("cronJobs");
485173
485283
  const taskEntry = await cronJobsCol.get(taskId);
485174
485284
  if (!taskEntry) {
485175
- log83.warn(`[notify] Job "${taskId}" not found`);
485285
+ log84.warn(`[notify] Job "${taskId}" not found`);
485176
485286
  return;
485177
485287
  }
485178
485288
  const task = taskEntry.doc;
@@ -485181,24 +485291,24 @@ async function notifyTaskCompletion(taskId, taskName, success2, response, error5
485181
485291
  const userId = userEntry?.id || "";
485182
485292
  const explicitChannel = task.channel && task.channel !== "system" ? task.channel : undefined;
485183
485293
  const notifyChannel = await resolveBestChannel(userId, explicitChannel) || "webchat";
485184
- log83.info(`[notifyTaskCompletion] task.channel=${task.channel} explicit=${explicitChannel} resolved=${notifyChannel}`);
485294
+ log84.info(`[notifyTaskCompletion] task.channel=${task.channel} explicit=${explicitChannel} resolved=${notifyChannel}`);
485185
485295
  const status = success2 ? "\u2705" : "\u274C";
485186
485296
  const message = success2 ? `${status} Scheduled task "${taskName}" completed
485187
485297
  ${response || ""}` : `${status} Scheduled task "${taskName}" failed
485188
485298
  ${error54 || ""}`;
485189
- log83.info(`[notify] Sending notification to ${notifyChannel}: "${message.slice(0, 50)}..."`);
485299
+ log84.info(`[notify] Sending notification to ${notifyChannel}: "${message.slice(0, 50)}..."`);
485190
485300
  try {
485191
485301
  await addMessage(userId, "assistant", message, { channel: notifyChannel });
485192
485302
  } catch (e) {
485193
- log83.warn(`[notify] Failed to persist notification to DB: ${e.message}`);
485303
+ log84.warn(`[notify] Failed to persist notification to DB: ${e.message}`);
485194
485304
  }
485195
485305
  await sendToUserChannel(notifyChannel, userId, message);
485196
- log83.info(`[notify] Notification sent to ${notifyChannel}`);
485306
+ log84.info(`[notify] Notification sent to ${notifyChannel}`);
485197
485307
  }
485198
485308
  function createTaskHandler() {
485199
485309
  return executeScheduledTask;
485200
485310
  }
485201
- var log83, _scheduler2 = null;
485311
+ var log84, _scheduler2 = null;
485202
485312
  var init_integration = __esm(() => {
485203
485313
  init_logger();
485204
485314
  init_agent_loop();
@@ -485208,7 +485318,7 @@ var init_integration = __esm(() => {
485208
485318
  init_conversation_store();
485209
485319
  init_cron();
485210
485320
  init_hive();
485211
- log83 = logger.child("SchedulerIntegration");
485321
+ log84 = logger.child("SchedulerIntegration");
485212
485322
  });
485213
485323
 
485214
485324
  // packages/core/src/scheduler/CronScheduler.ts
@@ -485248,27 +485358,27 @@ class CronScheduler {
485248
485358
  misfireCount++;
485249
485359
  const withinGrace = misfireTime >= graceCutoff;
485250
485360
  if (misfirePolicy === "fire_once" && withinGrace) {
485251
- log84.info(`[boot:misfire] Job "${task.name}" (${task.id}) misfired at ${misfireTime.toISOString()} \u2014 executing now (fire_once, within grace)`);
485361
+ log85.info(`[boot:misfire] Job "${task.name}" (${task.id}) misfired at ${misfireTime.toISOString()} \u2014 executing now (fire_once, within grace)`);
485252
485362
  await this.activate(task);
485253
485363
  this.execute(task.id).catch((err) => {
485254
- log84.error(`[boot:misfire] Catch-up execution failed for "${task.name}": ${err.message}`);
485364
+ log85.error(`[boot:misfire] Catch-up execution failed for "${task.name}": ${err.message}`);
485255
485365
  });
485256
485366
  } else if (task.task_type === "one_shot") {
485257
- log84.warn(`[boot:misfire] One-shot "${task.name}" (${task.id}) missed at ${misfireTime.toISOString()} (policy=${misfirePolicy}${misfirePolicy === "fire_once" ? ", outside grace" : ""}) \u2192 failed`);
485367
+ log85.warn(`[boot:misfire] One-shot "${task.name}" (${task.id}) missed at ${misfireTime.toISOString()} (policy=${misfirePolicy}${misfirePolicy === "fire_once" ? ", outside grace" : ""}) \u2192 failed`);
485258
485368
  await this.updateJob(task.id, {
485259
485369
  status: "failed",
485260
485370
  last_error: `Missed while down (fire_at=${misfireTime.toISOString()}, policy=${misfirePolicy})`,
485261
485371
  updated_at: now.toISOString()
485262
485372
  });
485263
485373
  } else if (misfirePolicy === "fire_once" && !withinGrace) {
485264
- log84.warn(`[boot:misfire] Job "${task.name}" (${task.id}) misfired at ${misfireTime.toISOString()} \u2014 outside grace window (${graceMin}min), skipping catch-up`);
485374
+ log85.warn(`[boot:misfire] Job "${task.name}" (${task.id}) misfired at ${misfireTime.toISOString()} \u2014 outside grace window (${graceMin}min), skipping catch-up`);
485265
485375
  await this.updateJob(task.id, {
485266
485376
  last_error: `Missed run at ${misfireTime.toISOString()} (outside grace)`,
485267
485377
  updated_at: now.toISOString()
485268
485378
  });
485269
485379
  await this.activate(task);
485270
485380
  } else {
485271
- log84.info(`[boot:misfire] Job "${task.name}" (${task.id}) misfired at ${misfireTime.toISOString()} \u2014 skipping (misfire_policy=skip)`);
485381
+ log85.info(`[boot:misfire] Job "${task.name}" (${task.id}) misfired at ${misfireTime.toISOString()} \u2014 skipping (misfire_policy=skip)`);
485272
485382
  await this.updateJob(task.id, {
485273
485383
  last_error: `Missed run at ${misfireTime.toISOString()} (policy: skip)`,
485274
485384
  updated_at: now.toISOString()
@@ -485279,7 +485389,7 @@ class CronScheduler {
485279
485389
  await this.activate(task);
485280
485390
  }
485281
485391
  }
485282
- log84.info(`[boot] Loaded ${tasks.length} active job(s)${misfireCount > 0 ? `, ${misfireCount} misfire(s) detected` : ""}`);
485392
+ log85.info(`[boot] Loaded ${tasks.length} active job(s)${misfireCount > 0 ? `, ${misfireCount} misfire(s) detected` : ""}`);
485283
485393
  await this.ensureCleanupTask();
485284
485394
  }
485285
485395
  async activate(task) {
@@ -485287,10 +485397,10 @@ class CronScheduler {
485287
485397
  if (existingJob) {
485288
485398
  existingJob.stop();
485289
485399
  this.jobs.delete(task.id);
485290
- log84.debug(`[activate] Stopped existing job for task "${task.name}" (${task.id})`);
485400
+ log85.debug(`[activate] Stopped existing job for task "${task.name}" (${task.id})`);
485291
485401
  }
485292
485402
  if (task.status === "paused" || task.status === "completed" || task.status === "cancelled") {
485293
- log84.debug(`[activate] Skipping job "${task.name}" (${task.id}) - status: ${task.status}`);
485403
+ log85.debug(`[activate] Skipping job "${task.name}" (${task.id}) - status: ${task.status}`);
485294
485404
  return;
485295
485405
  }
485296
485406
  const MAX_ERRORS = 5;
@@ -485301,20 +485411,20 @@ class CronScheduler {
485301
485411
  last_error: `Auto-paused after ${MAX_ERRORS} consecutive errors`,
485302
485412
  updated_at: new Date().toISOString()
485303
485413
  });
485304
- log84.warn(`[activate] Job "${task.name}" (${task.id}) auto-paused (error_count=${task.error_count})`);
485414
+ log85.warn(`[activate] Job "${task.name}" (${task.id}) auto-paused (error_count=${task.error_count})`);
485305
485415
  return;
485306
485416
  }
485307
485417
  try {
485308
485418
  let pattern;
485309
485419
  if (task.task_type === "recurring") {
485310
485420
  if (!task.cron_expression) {
485311
- log84.error(`[activate] Job "${task.name}" (${task.id}) is recurring but has no cron_expression`);
485421
+ log85.error(`[activate] Job "${task.name}" (${task.id}) is recurring but has no cron_expression`);
485312
485422
  return;
485313
485423
  }
485314
485424
  pattern = task.cron_expression;
485315
485425
  } else {
485316
485426
  if (!task.fire_at) {
485317
- log84.error(`[activate] Job "${task.name}" (${task.id}) is one_shot but has no fire_at`);
485427
+ log85.error(`[activate] Job "${task.name}" (${task.id}) is one_shot but has no fire_at`);
485318
485428
  return;
485319
485429
  }
485320
485430
  pattern = task.fire_at;
@@ -485322,7 +485432,7 @@ class CronScheduler {
485322
485432
  try {
485323
485433
  new E(pattern);
485324
485434
  } catch (err) {
485325
- log84.error(`[activate] Invalid cron pattern "${pattern}" for job "${task.name}": ${err.message}`);
485435
+ log85.error(`[activate] Invalid cron pattern "${pattern}" for job "${task.name}": ${err.message}`);
485326
485436
  return;
485327
485437
  }
485328
485438
  const options2 = {
@@ -485350,12 +485460,12 @@ class CronScheduler {
485350
485460
  if (nextRun) {
485351
485461
  const nextRunIso = nextRun.toISOString();
485352
485462
  await this.updateJob(task.id, { next_run_at: nextRunIso, updated_at: new Date().toISOString() });
485353
- log84.info(`[activate] Job "${task.name}" (${task.id}) scheduled - next: ${nextRunIso}`);
485463
+ log85.info(`[activate] Job "${task.name}" (${task.id}) scheduled - next: ${nextRunIso}`);
485354
485464
  } else {
485355
- log84.warn(`[activate] Job "${task.name}" (${task.id}) has no next run date`);
485465
+ log85.warn(`[activate] Job "${task.name}" (${task.id}) has no next run date`);
485356
485466
  }
485357
485467
  } catch (err) {
485358
- log84.error(`[activate] Failed to activate job "${task.name}" (${task.id}): ${err.message}`);
485468
+ log85.error(`[activate] Failed to activate job "${task.name}" (${task.id}): ${err.message}`);
485359
485469
  }
485360
485470
  }
485361
485471
  async updateJob(taskId, patch) {
@@ -485376,14 +485486,14 @@ class CronScheduler {
485376
485486
  const cronJobsCol = await col("cronJobs");
485377
485487
  const taskEntry = await cronJobsCol.get(taskId);
485378
485488
  if (!taskEntry) {
485379
- log84.warn(`[execute] Job "${taskId}" not found in DB \u2014 skipping`);
485489
+ log85.warn(`[execute] Job "${taskId}" not found in DB \u2014 skipping`);
485380
485490
  return;
485381
485491
  }
485382
485492
  const task = fromDoc(taskEntry.doc);
485383
485493
  const runId = crypto.randomUUID().replace(/-/g, "").slice(0, 16);
485384
485494
  const startedAt = new Date().toISOString();
485385
485495
  const startTime = performance.now();
485386
- log84.info(`[execute] Starting job "${task.name}" (${task.id}) run #${runId}`);
485496
+ log85.info(`[execute] Starting job "${task.name}" (${task.id}) run #${runId}`);
485387
485497
  const taskRunsCol = await col("taskRuns");
485388
485498
  try {
485389
485499
  await taskRunsCol.put(runId, {
@@ -485398,7 +485508,7 @@ class CronScheduler {
485398
485508
  agent_response: null
485399
485509
  }, { expectedVersion: 0 });
485400
485510
  } catch (err) {
485401
- log84.error(`[execute] Failed to create task_run record: ${err.message}`);
485511
+ log85.error(`[execute] Failed to create task_run record: ${err.message}`);
485402
485512
  }
485403
485513
  try {
485404
485514
  const result = await this.handler(task);
@@ -485427,9 +485537,9 @@ class CronScheduler {
485427
485537
  if (task.task_type === "one_shot") {
485428
485538
  await this.updateJob(task.id, { status: "completed", completed_at: finishedAt });
485429
485539
  this.deactivate(task.id);
485430
- log84.info(`[execute] One-shot job "${task.name}" (${task.id}) completed`);
485540
+ log85.info(`[execute] One-shot job "${task.name}" (${task.id}) completed`);
485431
485541
  } else {
485432
- log84.info(`[execute] Job "${task.name}" (${task.id}) completed in ${Math.round(duration3)}ms`);
485542
+ log85.info(`[execute] Job "${task.name}" (${task.id}) completed in ${Math.round(duration3)}ms`);
485433
485543
  }
485434
485544
  } else {
485435
485545
  throw new Error(result.error || "Handler reported failure");
@@ -485448,12 +485558,12 @@ class CronScheduler {
485448
485558
  error_count: task.error_count + 1,
485449
485559
  last_error: errorMessage
485450
485560
  });
485451
- log84.error(`[execute] Job "${task.name}" (${task.id}) failed: ${errorMessage}`);
485561
+ log85.error(`[execute] Job "${task.name}" (${task.id}) failed: ${errorMessage}`);
485452
485562
  const MAX_ERRORS = 5;
485453
485563
  if (updated && updated.error_count >= MAX_ERRORS) {
485454
485564
  await this.updateJob(task.id, { status: "paused", updated_at: new Date().toISOString() });
485455
485565
  this.deactivate(task.id);
485456
- log84.warn(`[execute] Job "${task.name}" (${task.id}) auto-paused after ${MAX_ERRORS} errors`);
485566
+ log85.warn(`[execute] Job "${task.name}" (${task.id}) auto-paused after ${MAX_ERRORS} errors`);
485457
485567
  }
485458
485568
  await notifyTaskCompletion(task.id, task.name, false, undefined, errorMessage);
485459
485569
  }
@@ -485469,10 +485579,10 @@ class CronScheduler {
485469
485579
  return;
485470
485580
  } catch {}
485471
485581
  }
485472
- log84.warn(`[updateTaskRun] Too much contention on taskRuns/${runId}`);
485582
+ log85.warn(`[updateTaskRun] Too much contention on taskRuns/${runId}`);
485473
485583
  }
485474
485584
  handleError(task, error54) {
485475
- log84.error(`[error] Job "${task.name}" (${task.id}) error: ${error54.message}`);
485585
+ log85.error(`[error] Job "${task.name}" (${task.id}) error: ${error54.message}`);
485476
485586
  Promise.resolve().then(async () => {
485477
485587
  const runId = crypto.randomUUID().replace(/-/g, "").slice(0, 16);
485478
485588
  const now = new Date().toISOString();
@@ -485490,7 +485600,7 @@ class CronScheduler {
485490
485600
  agent_response: null
485491
485601
  }, { expectedVersion: 0 });
485492
485602
  } catch (e) {
485493
- log84.warn(`[handleError] Failed to insert task_run: ${e.message}`);
485603
+ log85.warn(`[handleError] Failed to insert task_run: ${e.message}`);
485494
485604
  }
485495
485605
  await this.updateJob(task.id, {
485496
485606
  error_count: task.error_count + 1,
@@ -485505,22 +485615,22 @@ class CronScheduler {
485505
485615
  }
485506
485616
  const updated = await this.updateJob(taskId, { status: "paused" });
485507
485617
  if (updated) {
485508
- log84.info(`[pause] Job "${taskId}" paused`);
485618
+ log85.info(`[pause] Job "${taskId}" paused`);
485509
485619
  return true;
485510
485620
  }
485511
- log84.warn(`[pause] Job "${taskId}" not found`);
485621
+ log85.warn(`[pause] Job "${taskId}" not found`);
485512
485622
  return false;
485513
485623
  }
485514
485624
  async resume(taskId) {
485515
485625
  const cronJobsCol = await col("cronJobs");
485516
485626
  const taskEntry = await cronJobsCol.get(taskId);
485517
485627
  if (!taskEntry) {
485518
- log84.warn(`[resume] Job "${taskId}" not found`);
485628
+ log85.warn(`[resume] Job "${taskId}" not found`);
485519
485629
  return false;
485520
485630
  }
485521
485631
  const updated = await this.updateJob(taskId, { status: "active" });
485522
485632
  await this.activate(fromDoc(updated));
485523
- log84.info(`[resume] Job "${taskId}" resumed`);
485633
+ log85.info(`[resume] Job "${taskId}" resumed`);
485524
485634
  return true;
485525
485635
  }
485526
485636
  deactivate(taskId) {
@@ -485528,7 +485638,7 @@ class CronScheduler {
485528
485638
  if (job) {
485529
485639
  job.stop();
485530
485640
  this.jobs.delete(taskId);
485531
- log84.debug(`[deactivate] Job "${taskId}" deactivated`);
485641
+ log85.debug(`[deactivate] Job "${taskId}" deactivated`);
485532
485642
  }
485533
485643
  }
485534
485644
  async delete(taskId) {
@@ -485536,11 +485646,11 @@ class CronScheduler {
485536
485646
  const cronJobsCol = await col("cronJobs");
485537
485647
  const existing = await cronJobsCol.get(taskId);
485538
485648
  if (!existing) {
485539
- log84.warn(`[delete] Job "${taskId}" not found`);
485649
+ log85.warn(`[delete] Job "${taskId}" not found`);
485540
485650
  return false;
485541
485651
  }
485542
485652
  await cronJobsCol.delete(taskId);
485543
- log84.info(`[delete] Job "${taskId}" deleted`);
485653
+ log85.info(`[delete] Job "${taskId}" deleted`);
485544
485654
  return true;
485545
485655
  }
485546
485656
  async create(input) {
@@ -485611,14 +485721,14 @@ class CronScheduler {
485611
485721
  await this.activate(fromDoc(doc2));
485612
485722
  const job = this.jobs.get(id);
485613
485723
  const nextRun = job?.nextRun()?.toISOString();
485614
- log84.info(`[create] Job "${input.name}" (${id}) created`);
485724
+ log85.info(`[create] Job "${input.name}" (${id}) created`);
485615
485725
  return { id, nextRun };
485616
485726
  }
485617
485727
  async update(taskId, changes) {
485618
485728
  const cronJobsCol = await col("cronJobs");
485619
485729
  const taskEntry = await cronJobsCol.get(taskId);
485620
485730
  if (!taskEntry) {
485621
- log84.warn(`[update] Job "${taskId}" not found`);
485731
+ log85.warn(`[update] Job "${taskId}" not found`);
485622
485732
  return false;
485623
485733
  }
485624
485734
  const patch = {};
@@ -485661,7 +485771,7 @@ class CronScheduler {
485661
485771
  }
485662
485772
  const updatedDoc = await this.updateJob(taskId, patch);
485663
485773
  await this.activate(fromDoc(updatedDoc));
485664
- log84.info(`[update] Job "${taskId}" updated`);
485774
+ log85.info(`[update] Job "${taskId}" updated`);
485665
485775
  return true;
485666
485776
  }
485667
485777
  async getStatus() {
@@ -485681,11 +485791,11 @@ class CronScheduler {
485681
485791
  trigger(taskId) {
485682
485792
  const job = this.jobs.get(taskId);
485683
485793
  if (!job) {
485684
- log84.warn(`[trigger] Job "${taskId}" has no active job`);
485794
+ log85.warn(`[trigger] Job "${taskId}" has no active job`);
485685
485795
  return false;
485686
485796
  }
485687
485797
  job.trigger();
485688
- log84.info(`[trigger] Job "${taskId}" manually triggered`);
485798
+ log85.info(`[trigger] Job "${taskId}" manually triggered`);
485689
485799
  return true;
485690
485800
  }
485691
485801
  shutdown() {
@@ -485693,14 +485803,14 @@ class CronScheduler {
485693
485803
  job.stop();
485694
485804
  }
485695
485805
  this.jobs.clear();
485696
- log84.info("[shutdown] All jobs stopped");
485806
+ log85.info("[shutdown] All jobs stopped");
485697
485807
  }
485698
485808
  async ensureCleanupTask() {
485699
485809
  const cronJobsCol = await col("cronJobs");
485700
485810
  const existing = (await cronJobsCol.scan({})).find((e) => e.doc.name === "_hive_cleanup_runs");
485701
485811
  if (existing) {
485702
485812
  this.cleanupTaskId = existing.id;
485703
- log84.debug("[ensureCleanupTask] Cleanup job already exists");
485813
+ log85.debug("[ensureCleanupTask] Cleanup job already exists");
485704
485814
  return;
485705
485815
  }
485706
485816
  try {
@@ -485714,9 +485824,9 @@ class CronScheduler {
485714
485824
  protect: true
485715
485825
  });
485716
485826
  this.cleanupTaskId = result.id;
485717
- log84.info("[ensureCleanupTask] Cleanup job created");
485827
+ log85.info("[ensureCleanupTask] Cleanup job created");
485718
485828
  } catch (err) {
485719
- log84.error(`[ensureCleanupTask] Failed to create cleanup job: ${err.message}`);
485829
+ log85.error(`[ensureCleanupTask] Failed to create cleanup job: ${err.message}`);
485720
485830
  }
485721
485831
  }
485722
485832
  async runCleanup() {
@@ -485750,7 +485860,7 @@ class CronScheduler {
485750
485860
  }
485751
485861
  }
485752
485862
  const artifacts = await expireArtifacts();
485753
- log84.info(`[runCleanup] Cleanup completed (expired artifacts=${artifacts.expired})`);
485863
+ log85.info(`[runCleanup] Cleanup completed (expired artifacts=${artifacts.expired})`);
485754
485864
  }
485755
485865
  async getHistory(taskId, limit2 = 50) {
485756
485866
  const taskRunsCol = await col("taskRuns");
@@ -485771,14 +485881,14 @@ class CronScheduler {
485771
485881
  return tasks;
485772
485882
  }
485773
485883
  }
485774
- var log84;
485884
+ var log85;
485775
485885
  var init_CronScheduler = __esm(() => {
485776
485886
  init_croner();
485777
485887
  init_logger();
485778
485888
  init_integration();
485779
485889
  init_hive();
485780
485890
  init_store();
485781
- log84 = logger.child("CronScheduler");
485891
+ log85 = logger.child("CronScheduler");
485782
485892
  });
485783
485893
 
485784
485894
  // packages/core/src/gateway/routes/cron-api.ts
@@ -486975,13 +487085,13 @@ import { existsSync as existsSync24, mkdirSync as mkdirSync14, readdirSync as re
486975
487085
  import { join as join20 } from "path";
486976
487086
  async function downloadFile2(url2, dest) {
486977
487087
  const filename = url2.split("/").pop();
486978
- log85.info(`Descargando ${filename}...`);
487088
+ log86.info(`Descargando ${filename}...`);
486979
487089
  const res = await fetch(url2);
486980
487090
  if (!res.ok)
486981
487091
  throw new Error(`HTTP ${res.status} al descargar ${url2}`);
486982
487092
  const buf = await res.arrayBuffer();
486983
487093
  await Bun.write(dest, buf);
486984
- log85.info(`${filename} \u2014 ${(buf.byteLength / 1024 / 1024).toFixed(1)} MB`);
487094
+ log86.info(`${filename} \u2014 ${(buf.byteLength / 1024 / 1024).toFixed(1)} MB`);
486985
487095
  }
486986
487096
  async function extractTarGz(archivePath, destDir) {
486987
487097
  const code2 = await Bun.spawn(["tar", "-xzf", archivePath, "-C", destDir], {
@@ -487018,9 +487128,9 @@ async function runInstall(ttsRoot) {
487018
487128
  const url2 = PIPER_URLS[platform2];
487019
487129
  const archiveExt = url2.endsWith(".zip") ? ".zip" : ".tar.gz";
487020
487130
  const archivePath = join20(BIN_DIR, `piper${archiveExt}`);
487021
- log85.info(`Instalando Piper para ${platform2}...`);
487131
+ log86.info(`Instalando Piper para ${platform2}...`);
487022
487132
  await downloadFile2(url2, archivePath);
487023
- log85.info("Extrayendo...");
487133
+ log86.info("Extrayendo...");
487024
487134
  if (archiveExt === ".zip") {
487025
487135
  await extractZip(archivePath, BIN_DIR);
487026
487136
  } else {
@@ -487041,26 +487151,26 @@ async function runInstall(ttsRoot) {
487041
487151
  if (!platform2.startsWith("windows")) {
487042
487152
  await Bun.spawn(["chmod", "+x", binaryPath]).exited;
487043
487153
  }
487044
- log85.info(`Piper instalado en ${BIN_DIR}`);
487154
+ log86.info(`Piper instalado en ${BIN_DIR}`);
487045
487155
  } else {
487046
- log85.info("Piper ya instalado, omitiendo descarga.");
487156
+ log86.info("Piper ya instalado, omitiendo descarga.");
487047
487157
  }
487048
487158
  const modelPath = join20(VOICES_DIR, `${DEFAULT_VOICE}.onnx`);
487049
487159
  const configPath = join20(VOICES_DIR, `${DEFAULT_VOICE}.onnx.json`);
487050
487160
  if (!existsSync24(modelPath) || !existsSync24(configPath)) {
487051
- log85.info(`Descargando modelo de voz ${DEFAULT_VOICE}...`);
487161
+ log86.info(`Descargando modelo de voz ${DEFAULT_VOICE}...`);
487052
487162
  await downloadFile2(VOICE_URLS.model, modelPath);
487053
487163
  await downloadFile2(VOICE_URLS.config, configPath);
487054
- log85.info(`Voz instalada en ${VOICES_DIR}`);
487164
+ log86.info(`Voz instalada en ${VOICES_DIR}`);
487055
487165
  } else {
487056
- log85.info("Modelo de voz ya instalado, omitiendo descarga.");
487166
+ log86.info("Modelo de voz ya instalado, omitiendo descarga.");
487057
487167
  }
487058
- log85.info("Hive TTS listo.");
487168
+ log86.info("Hive TTS listo.");
487059
487169
  }
487060
- var log85;
487170
+ var log86;
487061
487171
  var init_install = __esm(() => {
487062
487172
  init_detect();
487063
- log85 = {
487173
+ log86 = {
487064
487174
  info: (msg) => console.log(`[TTS] ${msg}`),
487065
487175
  warn: (msg) => console.warn(`[TTS] ${msg}`),
487066
487176
  error: (msg) => console.error(`[TTS] ${msg}`)
@@ -487111,7 +487221,7 @@ async function synthesize(text2, voice) {
487111
487221
  noiseScale = (inference.noise_scale ?? 0.667) * 0.9;
487112
487222
  noiseW = (inference.noise_w ?? 0.8) * 0.95;
487113
487223
  } catch (err) {
487114
- log86.warn(`No se pudo leer configuraci\xF3n del modelo: ${err}`);
487224
+ log87.warn(`No se pudo leer configuraci\xF3n del modelo: ${err}`);
487115
487225
  }
487116
487226
  }
487117
487227
  lengthScale = Number(process.env.PIPER_LENGTH_SCALE ?? lengthScale);
@@ -487221,15 +487331,15 @@ function startTTSServer(opts) {
487221
487331
  return Response.json({ error: "Not found" }, { status: 404, headers: CORS });
487222
487332
  }
487223
487333
  });
487224
- log86.info(`Hive TTS Server escuchando en http://localhost:${listenPort}`);
487225
- log86.info(`Voz por defecto: ${DEFAULT_VOICE_ENV}`);
487226
- log86.info(`Voces disponibles: ${listVoices().join(", ") || "ninguna (ejecuta install.ts primero)"}`);
487334
+ log87.info(`Hive TTS Server escuchando en http://localhost:${listenPort}`);
487335
+ log87.info(`Voz por defecto: ${DEFAULT_VOICE_ENV}`);
487336
+ log87.info(`Voces disponibles: ${listVoices().join(", ") || "ninguna (ejecuta install.ts primero)"}`);
487227
487337
  return server;
487228
487338
  }
487229
- var log86, TTS_ROOT, BIN_DIR, VOICES_DIR, PORT, DEFAULT_VOICE_ENV, CORS;
487339
+ var log87, TTS_ROOT, BIN_DIR, VOICES_DIR, PORT, DEFAULT_VOICE_ENV, CORS;
487230
487340
  var init_server = __esm(() => {
487231
487341
  init_detect();
487232
- log86 = {
487342
+ log87 = {
487233
487343
  info: (msg) => console.log(`[TTS] ${msg}`),
487234
487344
  warn: (msg) => console.warn(`[TTS] ${msg}`),
487235
487345
  error: (msg) => console.error(`[TTS] ${msg}`)
@@ -487622,13 +487732,13 @@ async function handleCreateMeeting(req, addCorsHeaders2) {
487622
487732
  };
487623
487733
  const sessionsCol = await col("meetingSessions");
487624
487734
  await sessionsCol.put(id, doc2, { expectedVersion: 0 });
487625
- log87.info(`Meeting session created: ${id}`);
487735
+ log88.info(`Meeting session created: ${id}`);
487626
487736
  return addCorsHeaders2(Response.json({
487627
487737
  ok: true,
487628
487738
  session: { id, title, status: doc2.status, stt_model: doc2.stt_model, started_at: doc2.started_at }
487629
487739
  }), req);
487630
487740
  } catch (error54) {
487631
- log87.error(`handleCreateMeeting: ${error54.message}`);
487741
+ log88.error(`handleCreateMeeting: ${error54.message}`);
487632
487742
  return addCorsHeaders2(Response.json({ ok: false, error: error54.message }, { status: 500 }), req);
487633
487743
  }
487634
487744
  }
@@ -487643,7 +487753,7 @@ async function handleListMeetings(req, addCorsHeaders2) {
487643
487753
  }));
487644
487754
  return addCorsHeaders2(Response.json({ ok: true, sessions: withCounts }), req);
487645
487755
  } catch (error54) {
487646
- log87.error(`handleListMeetings: ${error54.message}`);
487756
+ log88.error(`handleListMeetings: ${error54.message}`);
487647
487757
  return addCorsHeaders2(Response.json({ ok: false, error: error54.message }, { status: 500 }), req);
487648
487758
  }
487649
487759
  }
@@ -487658,7 +487768,7 @@ async function handleGetMeeting(req, addCorsHeaders2, sessionId) {
487658
487768
  const segments = (await segmentsCol.scan({ prefix: `${sessionId}:` })).map((e) => e.doc).sort((a, b2) => a.seq - b2.seq).map((s2) => ({ seq: s2.seq, speaker: s2.speaker, text: s2.text, created_at: s2.created_at }));
487659
487769
  return addCorsHeaders2(Response.json({ ok: true, session: sessionEntry.doc, segments }), req);
487660
487770
  } catch (error54) {
487661
- log87.error(`handleGetMeeting: ${error54.message}`);
487771
+ log88.error(`handleGetMeeting: ${error54.message}`);
487662
487772
  return addCorsHeaders2(Response.json({ ok: false, error: error54.message }, { status: 500 }), req);
487663
487773
  }
487664
487774
  }
@@ -487696,7 +487806,7 @@ async function handleAddMeetingSegment(req, addCorsHeaders2, sessionId) {
487696
487806
  }, { expectedVersion: 0 });
487697
487807
  return addCorsHeaders2(Response.json({ ok: true, seq, speaker, text: transcription }), req);
487698
487808
  } catch (error54) {
487699
- log87.error(`handleAddMeetingSegment: ${error54.message}`);
487809
+ log88.error(`handleAddMeetingSegment: ${error54.message}`);
487700
487810
  return addCorsHeaders2(Response.json({ ok: false, error: error54.message }, { status: 500 }), req);
487701
487811
  }
487702
487812
  }
@@ -487715,7 +487825,7 @@ async function handleStopMeeting(req, addCorsHeaders2, sessionId) {
487715
487825
  }
487716
487826
  await sessionsCol.put(sessionId, { ...session, status: "stopped", stopped_at: Date.now() }, { expectedVersion: sessionEntry.version });
487717
487827
  const count = (await segmentsCol.scan({ prefix: `${sessionId}:` })).length;
487718
- log87.info(`Meeting stopped: ${sessionId} \u2014 ${count} segments`);
487828
+ log88.info(`Meeting stopped: ${sessionId} \u2014 ${count} segments`);
487719
487829
  return addCorsHeaders2(Response.json({
487720
487830
  ok: true,
487721
487831
  session_id: sessionId,
@@ -487723,7 +487833,7 @@ async function handleStopMeeting(req, addCorsHeaders2, sessionId) {
487723
487833
  segment_count: count
487724
487834
  }), req);
487725
487835
  } catch (error54) {
487726
- log87.error(`handleStopMeeting: ${error54.message}`);
487836
+ log88.error(`handleStopMeeting: ${error54.message}`);
487727
487837
  return addCorsHeaders2(Response.json({ ok: false, error: error54.message }, { status: 500 }), req);
487728
487838
  }
487729
487839
  }
@@ -487778,10 +487888,10 @@ async function handleGenerateMeetingReport(req, addCorsHeaders2, sessionId) {
487778
487888
  return addCorsHeaders2(Response.json({ ok: false, error: result.error ?? "No se pudo generar el archivo DOCX." }, { status: 500 }), req);
487779
487889
  }
487780
487890
  await sessionsCol.put(sessionId, { ...session, status: "report_ready", report_path: result.ruta }, { expectedVersion: sessionEntry.version });
487781
- log87.info(`Meeting report generated: ${sessionId} \u2192 ${result.ruta}`);
487891
+ log88.info(`Meeting report generated: ${sessionId} \u2192 ${result.ruta}`);
487782
487892
  return addCorsHeaders2(Response.json({ ok: true, session_id: sessionId, report_path: result.ruta, status: "report_ready" }), req);
487783
487893
  } catch (error54) {
487784
- log87.error(`handleGenerateMeetingReport: ${error54.message}`);
487894
+ log88.error(`handleGenerateMeetingReport: ${error54.message}`);
487785
487895
  return addCorsHeaders2(Response.json({ ok: false, error: error54.message }, { status: 500 }), req);
487786
487896
  }
487787
487897
  }
@@ -487803,11 +487913,11 @@ async function handleDownloadMeetingReport(req, addCorsHeaders2, sessionId) {
487803
487913
  }
487804
487914
  }), req);
487805
487915
  } catch (error54) {
487806
- log87.error(`handleDownloadMeetingReport: ${error54.message}`);
487916
+ log88.error(`handleDownloadMeetingReport: ${error54.message}`);
487807
487917
  return addCorsHeaders2(Response.json({ ok: false, error: error54.message }, { status: 500 }), req);
487808
487918
  }
487809
487919
  }
487810
- var log87, REPORT_SECTIONS;
487920
+ var log88, REPORT_SECTIONS;
487811
487921
  var init_meeting = __esm(() => {
487812
487922
  init_voice();
487813
487923
  init_logger();
@@ -487815,7 +487925,7 @@ var init_meeting = __esm(() => {
487815
487925
  init_loader();
487816
487926
  init_llm_client();
487817
487927
  init_office_escribir_docx();
487818
- log87 = logger.child("meeting-routes");
487928
+ log88 = logger.child("meeting-routes");
487819
487929
  REPORT_SECTIONS = [
487820
487930
  "Resumen Ejecutivo",
487821
487931
  "Participantes Detectados",
@@ -488109,7 +488219,7 @@ async function handleChat(req, addCorsHeaders2) {
488109
488219
  const finalUserId = userId || await resolveUserId({ channel }) || "default";
488110
488220
  const finalAgentId = agentId || await resolveAgentId(null) || "main";
488111
488221
  const threadId = resolveChatThreadId(finalUserId, thread_id);
488112
- log88.info(`[chat] Processing message from user=${finalUserId} agent=${finalAgentId} thread=${threadId}`);
488222
+ log89.info(`[chat] Processing message from user=${finalUserId} agent=${finalAgentId} thread=${threadId}`);
488113
488223
  const usersCol = await col("users");
488114
488224
  const userRow = await usersCol.get(finalUserId);
488115
488225
  const userTimezone = userRow?.doc.timezone || "UTC";
@@ -488145,7 +488255,7 @@ ${message}`;
488145
488255
  channel
488146
488256
  }
488147
488257
  });
488148
- log88.info(`[chat] Enqueued chat_turn job ${job.id} for thread ${threadId}`);
488258
+ log89.info(`[chat] Enqueued chat_turn job ${job.id} for thread ${threadId}`);
488149
488259
  const startTime = Date.now();
488150
488260
  const timeout = 120000;
488151
488261
  for (;; ) {
@@ -488180,7 +488290,7 @@ ${message}`;
488180
488290
  await new Promise((resolve12) => setTimeout(resolve12, 150));
488181
488291
  }
488182
488292
  } catch (error54) {
488183
- log88.error(`[chat] Handler error: ${error54.message}`);
488293
+ log89.error(`[chat] Handler error: ${error54.message}`);
488184
488294
  return addCorsHeaders2(Response.json({
488185
488295
  success: false,
488186
488296
  error: error54.message,
@@ -488214,7 +488324,7 @@ async function handleGetNotes(req, addCorsHeaders2) {
488214
488324
  const notes = await listAllScratchpadNotes(50);
488215
488325
  return addCorsHeaders2(Response.json({ notes }), req);
488216
488326
  }
488217
- var log88, DEFAULT_CHAT_HISTORY_LIMIT = 40;
488327
+ var log89, DEFAULT_CHAT_HISTORY_LIMIT = 40;
488218
488328
  var init_chat3 = __esm(() => {
488219
488329
  init_onboarding();
488220
488330
  init_webchat_turn();
@@ -488223,7 +488333,7 @@ var init_chat3 = __esm(() => {
488223
488333
  init_logger();
488224
488334
  init_conversation_store();
488225
488335
  init_hive();
488226
- log88 = logger.child("api:chat");
488336
+ log89 = logger.child("api:chat");
488227
488337
  });
488228
488338
 
488229
488339
  // packages/core/src/gateway/routes/config.ts
@@ -488426,23 +488536,23 @@ async function startGateway(config2, embeddedUI) {
488426
488536
  const port = config2.gateway?.port ?? 18790;
488427
488537
  const pidFile = expandPath3(config2.gateway?.pidFile ?? "~/.hive/gateway.pid");
488428
488538
  const startTime = Date.now();
488429
- const log89 = logger.child("gateway");
488430
- log89.info(`Starting gateway on ${host}:${port}`);
488539
+ const log90 = logger.child("gateway");
488540
+ log90.info(`Starting gateway on ${host}:${port}`);
488431
488541
  const tokenFile = path30.join(getHiveDir(), ".auth_token");
488432
488542
  if (!process.env.HIVE_AUTH_TOKEN) {
488433
488543
  if (existsSync28(tokenFile)) {
488434
488544
  process.env.HIVE_AUTH_TOKEN = readFileSync15(tokenFile, "utf-8").trim();
488435
- log89.info("\uD83D\uDD11 Auth token loaded from persistent storage");
488545
+ log90.info("\uD83D\uDD11 Auth token loaded from persistent storage");
488436
488546
  } else {
488437
488547
  const generated = randomUUID4().replace(/-/g, "");
488438
488548
  process.env.HIVE_AUTH_TOKEN = generated;
488439
488549
  mkdirSync16(path30.dirname(tokenFile), { recursive: true });
488440
488550
  writeFileSync9(tokenFile, generated, { mode: 384 });
488441
- log89.info("\uD83D\uDD11 Auth token auto-generated and persisted");
488551
+ log90.info("\uD83D\uDD11 Auth token auto-generated and persisted");
488442
488552
  }
488443
488553
  } else {
488444
488554
  writeFileSync9(tokenFile, process.env.HIVE_AUTH_TOKEN, { mode: 384 });
488445
- log89.info("\uD83D\uDD11 Auth token loaded from environment variable");
488555
+ log90.info("\uD83D\uDD11 Auth token loaded from environment variable");
488446
488556
  }
488447
488557
  let agent;
488448
488558
  let runner;
@@ -488472,7 +488582,7 @@ async function startGateway(config2, embeddedUI) {
488472
488582
  },
488473
488583
  websocket: { open() {}, message() {}, close() {} }
488474
488584
  });
488475
- log89.info(`Port ${port} bound (initializing gateway...)`);
488585
+ log90.info(`Port ${port} bound (initializing gateway...)`);
488476
488586
  try {
488477
488587
  await ensureHiveDb();
488478
488588
  } catch {}
@@ -488530,9 +488640,9 @@ async function startGateway(config2, embeddedUI) {
488530
488640
  });
488531
488641
  });
488532
488642
  if (gatewaySetupMode) {
488533
- log89.info("\uD83C\uDF89 Setup mode: gateway running \u2014 open http://localhost:" + port + "/setup to configure");
488643
+ log90.info("\uD83C\uDF89 Setup mode: gateway running \u2014 open http://localhost:" + port + "/setup to configure");
488534
488644
  } else {
488535
- log89.info("\u2705 Gateway initialization completed successfully");
488645
+ log90.info("\u2705 Gateway initialization completed successfully");
488536
488646
  try {
488537
488647
  const bootId = getBootId();
488538
488648
  await reconcileOnBoot(bootId);
@@ -488550,25 +488660,25 @@ async function startGateway(config2, embeddedUI) {
488550
488660
  getModel: () => dbModel
488551
488661
  });
488552
488662
  initDelegationNotify();
488553
- log89.info(`\uD83D\uDD00 DurableQueue initialized (maxConcurrency=${durableQueue.getMaxGlobalConcurrency()})`);
488663
+ log90.info(`\uD83D\uDD00 DurableQueue initialized (maxConcurrency=${durableQueue.getMaxGlobalConcurrency()})`);
488554
488664
  const handler = createTaskHandler();
488555
488665
  const scheduler = new CronScheduler(handler);
488556
488666
  await scheduler.boot();
488557
488667
  setSchedulerInstance(scheduler);
488558
488668
  setSchedulerInstance2(scheduler);
488559
488669
  setSchedulerForCleanup(scheduler);
488560
- log89.info(`\uD83D\uDCC5 CronScheduler initialized with ${(await scheduler.getStatus()).length} task(s)`);
488670
+ log90.info(`\uD83D\uDCC5 CronScheduler initialized with ${(await scheduler.getStatus()).length} task(s)`);
488561
488671
  } catch (err) {
488562
- log89.error(`\u274C CronScheduler initialization failed: ${err.message}`);
488672
+ log90.error(`\u274C CronScheduler initialization failed: ${err.message}`);
488563
488673
  }
488564
488674
  }
488565
488675
  } catch (error54) {
488566
- log89.error(`\u274C Gateway initialization failed: ${error54.message}`);
488567
- log89.error("Stack trace:", error54.stack);
488676
+ log90.error(`\u274C Gateway initialization failed: ${error54.message}`);
488677
+ log90.error("Stack trace:", error54.stack);
488568
488678
  process.exit(1);
488569
488679
  }
488570
488680
  if (host === "0.0.0.0" && config2.security?.warnOnInsecureConfig !== false) {
488571
- log89.warn("Gateway binding to 0.0.0.0 exposes server to all network interfaces!");
488681
+ log90.warn("Gateway binding to 0.0.0.0 exposes server to all network interfaces!");
488572
488682
  }
488573
488683
  function prepareTools(agentInstance, sessionId) {
488574
488684
  return;
@@ -488638,8 +488748,8 @@ async function startGateway(config2, embeddedUI) {
488638
488748
  const watchers = [];
488639
488749
  if (!gatewaySetupMode)
488640
488750
  channelManager.onMessage(async (message) => {
488641
- log89.info(`\uD83D\uDCE5 Message from ${message.channel}:${message.accountId}`);
488642
- log89.info(` Session: ${message.sessionId}`);
488751
+ log90.info(`\uD83D\uDCE5 Message from ${message.channel}:${message.accountId}`);
488752
+ log90.info(` Session: ${message.sessionId}`);
488643
488753
  const voiceConfig = await voiceService.getChannelVoiceConfig(message.channel);
488644
488754
  const visionConfig = await multimodalService.getChannelVisionConfig(message.channel);
488645
488755
  let messageContent = message.content;
@@ -488648,9 +488758,9 @@ async function startGateway(config2, embeddedUI) {
488648
488758
  let sttProviderUsed = null;
488649
488759
  let contentParts;
488650
488760
  if (voiceConfig.voiceEnabled && message.audio) {
488651
- log89.info(`\uD83C\uDF99\uFE0F Voice enabled, processing audio...`);
488761
+ log90.info(`\uD83C\uDF99\uFE0F Voice enabled, processing audio...`);
488652
488762
  if (!voiceConfig.sttProvider) {
488653
- log89.warn(`\u26A0\uFE0F STT provider not configured for channel ${message.channel}`);
488763
+ log90.warn(`\u26A0\uFE0F STT provider not configured for channel ${message.channel}`);
488654
488764
  await channelManager.send(message.channel, message.sessionId, {
488655
488765
  content: `\uD83C\uDF99\uFE0F Para usar notas de voz, necesitas configurar el proveedor STT en la configuraci\xF3n del canal. Ve a Configuraci\xF3n > Canales > [Tu canal] y configura "Prov. STT" (ej: groq-whisper o openai)`
488656
488766
  });
@@ -488660,7 +488770,7 @@ async function startGateway(config2, embeddedUI) {
488660
488770
  const audioInput = voiceService.normalizeAudioFromChannel(message.channel, message.audio);
488661
488771
  sttProviderUsed = voiceConfig.sttProvider || "groq-whisper";
488662
488772
  messageContent = await voiceService.transcribe(audioInput, sttProviderUsed);
488663
- log89.info(`\uD83D\uDCDD Transcribed: ${messageContent.substring(0, 100)}...`);
488773
+ log90.info(`\uD83D\uDCDD Transcribed: ${messageContent.substring(0, 100)}...`);
488664
488774
  inputType = "audio_transcribed";
488665
488775
  preferAudioResponse = !!voiceConfig.ttsProvider;
488666
488776
  await channelManager.send(message.channel, message.sessionId, {
@@ -488668,7 +488778,7 @@ async function startGateway(config2, embeddedUI) {
488668
488778
  type: "message"
488669
488779
  });
488670
488780
  } catch (error54) {
488671
- log89.error(`\u274C Transcription failed: ${error54.message}`);
488781
+ log90.error(`\u274C Transcription failed: ${error54.message}`);
488672
488782
  await channelManager.send(message.channel, message.sessionId, {
488673
488783
  content: `Error al transcribir audio: ${error54.message}`
488674
488784
  });
@@ -488676,7 +488786,7 @@ async function startGateway(config2, embeddedUI) {
488676
488786
  }
488677
488787
  }
488678
488788
  if (message.image || message.document) {
488679
- log89.info(`\uD83D\uDDBC\uFE0F Multimodal content detected on channel ${message.channel}`);
488789
+ log90.info(`\uD83D\uDDBC\uFE0F Multimodal content detected on channel ${message.channel}`);
488680
488790
  if (message.image) {
488681
488791
  try {
488682
488792
  const imageInput = multimodalService.normalizeImageFromChannel(message.channel, message.image);
@@ -488686,20 +488796,20 @@ async function startGateway(config2, embeddedUI) {
488686
488796
  if (visionConfig.visionEnabled && modelHasVision) {
488687
488797
  contentParts = await multimodalService.processImage(imageInput, visionConfig.visionModelId || undefined);
488688
488798
  inputType = "image";
488689
- log89.info(`\uD83D\uDDBC\uFE0F Image sent as vision ContentParts (model supports vision)`);
488799
+ log90.info(`\uD83D\uDDBC\uFE0F Image sent as vision ContentParts (model supports vision)`);
488690
488800
  } else {
488691
488801
  const ocrProvider = visionConfig.ocrProvider || "openai";
488692
- log89.info(`\uD83D\uDDBC\uFE0F Model lacks vision, using OCR via ${ocrProvider}...`);
488802
+ log90.info(`\uD83D\uDDBC\uFE0F Model lacks vision, using OCR via ${ocrProvider}...`);
488693
488803
  const ocrText = await multimodalService.ocrImage(imageInput, ocrProvider);
488694
488804
  messageContent = ocrText ? `[Imagen adjunta \u2014 contenido extra\xEDdo por OCR]
488695
488805
  ${ocrText}
488696
488806
 
488697
488807
  ${messageContent || ""}` : messageContent || "";
488698
488808
  inputType = "image";
488699
- log89.info(`\uD83D\uDDBC\uFE0F OCR result: ${ocrText.substring(0, 100)}...`);
488809
+ log90.info(`\uD83D\uDDBC\uFE0F OCR result: ${ocrText.substring(0, 100)}...`);
488700
488810
  }
488701
488811
  } catch (imgError) {
488702
- log89.error(`\u274C Image processing failed: ${imgError.message}`);
488812
+ log90.error(`\u274C Image processing failed: ${imgError.message}`);
488703
488813
  await channelManager.send(message.channel, message.sessionId, {
488704
488814
  content: `\u26A0\uFE0F Error al procesar la imagen: ${imgError.message}`
488705
488815
  });
@@ -488709,7 +488819,7 @@ ${messageContent || ""}` : messageContent || "";
488709
488819
  try {
488710
488820
  const docInput = multimodalService.normalizeDocumentFromChannel(message.channel, message.document);
488711
488821
  const ocrProvider = visionConfig.ocrProvider || "openai";
488712
- log89.info(`\uD83D\uDCC4 Document detected, extracting text via OCR (${ocrProvider})...`);
488822
+ log90.info(`\uD83D\uDCC4 Document detected, extracting text via OCR (${ocrProvider})...`);
488713
488823
  const docImage = {
488714
488824
  type: docInput.type,
488715
488825
  data: docInput.data,
@@ -488722,16 +488832,16 @@ ${ocrText}
488722
488832
 
488723
488833
  ${messageContent || ""}` : messageContent || "";
488724
488834
  inputType = "document";
488725
- log89.info(`\uD83D\uDCC4 Document OCR result: ${ocrText.substring(0, 100)}...`);
488835
+ log90.info(`\uD83D\uDCC4 Document OCR result: ${ocrText.substring(0, 100)}...`);
488726
488836
  } catch (docError) {
488727
- log89.error(`\u274C Document processing failed: ${docError.message}`);
488837
+ log90.error(`\u274C Document processing failed: ${docError.message}`);
488728
488838
  await channelManager.send(message.channel, message.sessionId, {
488729
488839
  content: `\u26A0\uFE0F Error al procesar el documento: ${docError.message}`
488730
488840
  });
488731
488841
  }
488732
488842
  }
488733
488843
  }
488734
- log89.info(` Content: ${messageContent.substring(0, 150)}${messageContent.length > 150 ? "..." : ""}`);
488844
+ log90.info(` Content: ${messageContent.substring(0, 150)}${messageContent.length > 150 ? "..." : ""}`);
488735
488845
  const { userId, threadId: conversationThreadId } = await resolveContext({
488736
488846
  channel: message.channel,
488737
488847
  channelUserId: message.sessionId,
@@ -488764,7 +488874,7 @@ ${messageContent || ""}` : messageContent || "";
488764
488874
  ${messageContent}`;
488765
488875
  const messages2 = contentParts ? [{ role: "user", content: [{ type: "text", text: messageContentWithTime }, ...contentParts] }] : [{ role: "user", content: messageContentWithTime }];
488766
488876
  try {
488767
- log89.info(`\uD83E\uDD16 Routing to agent loop...`);
488877
+ log90.info(`\uD83E\uDD16 Routing to agent loop...`);
488768
488878
  const turnId = randomUUID4();
488769
488879
  const response = await runner.generate({
488770
488880
  provider: dbProvider,
@@ -488790,7 +488900,7 @@ ${messageContent}`;
488790
488900
  type: "progress"
488791
488901
  });
488792
488902
  } catch (err) {
488793
- log89.warn(`[onStep] Tool result send failed: ${err.message}`);
488903
+ log90.warn(`[onStep] Tool result send failed: ${err.message}`);
488794
488904
  }
488795
488905
  }
488796
488906
  } catch {}
@@ -488802,10 +488912,10 @@ ${messageContent}`;
488802
488912
  const delegationGroup = await sealDelegationGroup2(turnId);
488803
488913
  const responseContent = delegationGroup ? "" : response.content?.trim() || "";
488804
488914
  if (!responseContent) {
488805
- log89.warn(`\uD83D\uDCE4 LLM response: empty \u2014 skipping send`);
488915
+ log90.warn(`\uD83D\uDCE4 LLM response: empty \u2014 skipping send`);
488806
488916
  return;
488807
488917
  }
488808
- log89.info(`\uD83D\uDCE4 LLM response: ${responseContent.substring(0, 100)}${responseContent.length > 100 ? "..." : ""}`);
488918
+ log90.info(`\uD83D\uDCE4 LLM response: ${responseContent.substring(0, 100)}${responseContent.length > 100 ? "..." : ""}`);
488809
488919
  await awaitChannelNarration(`${message.channel}:${routingSessionId}`);
488810
488920
  const shouldSpeak = preferAudioResponse;
488811
488921
  let responseType = "text";
@@ -488814,7 +488924,7 @@ ${messageContent}`;
488814
488924
  if (responseContent) {
488815
488925
  if (shouldSpeak) {
488816
488926
  if (!voiceConfig.ttsProvider) {
488817
- log89.warn(`\u26A0\uFE0F TTS provider not configured, user requested audio`);
488927
+ log90.warn(`\u26A0\uFE0F TTS provider not configured, user requested audio`);
488818
488928
  await channelManager.send(message.channel, routingSessionId, {
488819
488929
  content: `${responseContent}
488820
488930
 
@@ -488822,7 +488932,7 @@ ${messageContent}`;
488822
488932
  });
488823
488933
  } else {
488824
488934
  try {
488825
- log89.info(`\uD83D\uDD0A TTS enabled, synthesizing audio...`);
488935
+ log90.info(`\uD83D\uDD0A TTS enabled, synthesizing audio...`);
488826
488936
  const audioOutput = await voiceService.speak(responseContent, voiceConfig.ttsProvider, voiceConfig.ttsVoiceId || undefined);
488827
488937
  ttsProviderUsed = voiceConfig.ttsProvider;
488828
488938
  ttsMimeType = audioOutput.mimeType;
@@ -488831,17 +488941,17 @@ ${messageContent}`;
488831
488941
  const channel = channelManager.getChannel(message.channel, message.accountId);
488832
488942
  if (channel?.sendAudio) {
488833
488943
  await channel.sendAudio(routingSessionId, audioOutput.data, audioOutput.mimeType);
488834
- log89.info(`\u2705 Audio sent to ${routingSessionId}`);
488944
+ log90.info(`\u2705 Audio sent to ${routingSessionId}`);
488835
488945
  } else {
488836
- log89.warn(`Channel ${message.channel} does not support audio, sending text`);
488946
+ log90.warn(`Channel ${message.channel} does not support audio, sending text`);
488837
488947
  await channelManager.send(message.channel, routingSessionId, { content: responseContent });
488838
488948
  }
488839
488949
  } catch (audioError) {
488840
- log89.error(`\u274C Audio send failed: ${audioError.message}, sending text instead`);
488950
+ log90.error(`\u274C Audio send failed: ${audioError.message}, sending text instead`);
488841
488951
  await channelManager.send(message.channel, routingSessionId, { content: responseContent });
488842
488952
  }
488843
488953
  } catch (ttsError) {
488844
- log89.error(`\u274C TTS failed: ${ttsError.message}, sending text instead`);
488954
+ log90.error(`\u274C TTS failed: ${ttsError.message}, sending text instead`);
488845
488955
  await channelManager.send(message.channel, routingSessionId, { content: responseContent });
488846
488956
  }
488847
488957
  }
@@ -488856,10 +488966,10 @@ ${messageContent}`;
488856
488966
  channel: message.channel
488857
488967
  };
488858
488968
  await channelManager.stopTyping(message.channel, routingSessionId);
488859
- log89.info(`\u2705 Response sent to ${routingSessionId} via ${message.channel}`);
488969
+ log90.info(`\u2705 Response sent to ${routingSessionId} via ${message.channel}`);
488860
488970
  } catch (error54) {
488861
488971
  await channelManager.stopTyping(message.channel, routingSessionId);
488862
- log89.error(`\u274C Error: ${error54.message} `);
488972
+ log90.error(`\u274C Error: ${error54.message} `);
488863
488973
  await channelManager.send(message.channel, routingSessionId, {
488864
488974
  content: `Error: ${error54.message} `
488865
488975
  });
@@ -488909,9 +489019,9 @@ ${messageContent}`;
488909
489019
  const method = req.method;
488910
489020
  const logRequest = (status, duration3) => {
488911
489021
  if (url2.pathname === "/health" || url2.pathname === "/health/") {
488912
- log89.debug(`${method} ${url2.pathname} - ${status} (${duration3}ms)`);
489022
+ log90.debug(`${method} ${url2.pathname} - ${status} (${duration3}ms)`);
488913
489023
  } else {
488914
- log89.info(`${method} ${url2.pathname} - ${status} (${duration3}ms)`);
489024
+ log90.info(`${method} ${url2.pathname} - ${status} (${duration3}ms)`);
488915
489025
  }
488916
489026
  };
488917
489027
  const handleRequest = async () => {
@@ -489103,12 +489213,22 @@ ${messageContent}`;
489103
489213
  return Response.redirect(`/ ui${tokenParam} `, 301);
489104
489214
  }
489105
489215
  if (!await checkAuth(req, url2)) {
489106
- log89.warn(`[AUTH] Unauthorized request to ${url2.pathname} from ${req.headers.get("origin")} `);
489216
+ log90.warn(`[AUTH] Unauthorized request to ${url2.pathname} from ${req.headers.get("origin")} `);
489107
489217
  return addCorsHeaders(new Response("Unauthorized", { status: 401 }), req);
489108
489218
  }
489109
489219
  if (url2.pathname === "/api/setup/status" || url2.pathname === "/api/setup/status/") {
489110
489220
  return addCorsHeaders(await handleSetupStatus(), req);
489111
489221
  }
489222
+ if ((url2.pathname === "/api/a2ui/surfaces" || url2.pathname === "/api/a2ui/surfaces/") && req.method === "GET") {
489223
+ return await handleGetA2UISurfaces(req, addCorsHeaders);
489224
+ }
489225
+ const a2uiSurfaceMatch = url2.pathname.match(/^\/api\/a2ui\/surfaces\/([^/]+)$/);
489226
+ if (a2uiSurfaceMatch && req.method === "DELETE") {
489227
+ return await handleDeleteA2UISurface(req, addCorsHeaders);
489228
+ }
489229
+ if ((url2.pathname === "/api/system/runtime" || url2.pathname === "/api/system/runtime/") && req.method === "GET") {
489230
+ return await handleGetRuntimeStatus(req, addCorsHeaders);
489231
+ }
489112
489232
  if (url2.pathname === "/api/setup/providers" && req.method === "GET") {
489113
489233
  return handleSetupProviders(addCorsHeaders, req);
489114
489234
  }
@@ -489302,7 +489422,7 @@ ${messageContent}`;
489302
489422
  return await handleApiReload(req, addCorsHeaders, agent);
489303
489423
  }
489304
489424
  if (url2.pathname === "/api/user/channels" && req.method === "POST") {
489305
- return await handleLinkUserChannel(req, addCorsHeaders, config2, log89);
489425
+ return await handleLinkUserChannel(req, addCorsHeaders, config2, log90);
489306
489426
  }
489307
489427
  if (url2.pathname === "/api/user/channels" && req.method === "GET") {
489308
489428
  return await handleGetUserChannels(req, addCorsHeaders, config2);
@@ -489474,7 +489594,7 @@ ${messageContent}`;
489474
489594
  if (active === undefined) {
489475
489595
  return addCorsHeaders(Response.json({ success: false, error: "Missing active field" }, { status: 400 }), req);
489476
489596
  }
489477
- log89.info(`[MCP] Toggle connection for ${mcpName}, active=${active}`);
489597
+ log90.info(`[MCP] Toggle connection for ${mcpName}, active=${active}`);
489478
489598
  const mcpServersColT = await col("mcpServers");
489479
489599
  const findMcpEntry = async (idOrName) => {
489480
489600
  const byId = await mcpServersColT.get(idOrName);
@@ -489489,11 +489609,11 @@ ${messageContent}`;
489489
489609
  try {
489490
489610
  const mcp = agent?.getMCPManager() ?? null;
489491
489611
  if (mcp) {
489492
- log89.info(`[MCP] Manager found, connecting ${mcpName}...`);
489612
+ log90.info(`[MCP] Manager found, connecting ${mcpName}...`);
489493
489613
  if (active) {
489494
489614
  const server3 = (await findMcpEntry(mcpName))?.doc;
489495
489615
  if (server3) {
489496
- log89.info(`[MCP] Server config: transport=${server3.transport}, url=${server3.url}`);
489616
+ log90.info(`[MCP] Server config: transport=${server3.transport}, url=${server3.url}`);
489497
489617
  const mcpServerConfig = {
489498
489618
  transport: server3.transport,
489499
489619
  command: server3.command,
@@ -489512,23 +489632,23 @@ ${messageContent}`;
489512
489632
  ...currentConfig,
489513
489633
  servers: newServersConfig
489514
489634
  });
489515
- log89.info(`[MCP] Server registered in MCP Manager`);
489635
+ log90.info(`[MCP] Server registered in MCP Manager`);
489516
489636
  await mcp.connectServer(mcpName).catch((err) => {
489517
- log89.error(`[MCP] Connect attempt failed for ${mcpName}: ${err.message}`);
489637
+ log90.error(`[MCP] Connect attempt failed for ${mcpName}: ${err.message}`);
489518
489638
  });
489519
489639
  const tools = mcp.getServerTools(mcpName) || [];
489520
489640
  const serverDetails = mcp.getServerDetails?.(mcpName);
489521
489641
  const serverStatus = serverDetails?.status ?? mcp.getServerStatus(mcpName);
489522
489642
  if (serverStatus === "error" && serverDetails?.error) {
489523
- log89.error(`[MCP] Connection error for ${mcpName}: ${serverDetails.error}`);
489643
+ log90.error(`[MCP] Connection error for ${mcpName}: ${serverDetails.error}`);
489524
489644
  }
489525
- log89.info(`[MCP] Connected! Tools: ${tools.length}, status: ${serverStatus}`);
489645
+ log90.info(`[MCP] Connected! Tools: ${tools.length}, status: ${serverStatus}`);
489526
489646
  const entryAfterConnect = await findMcpEntry(mcpName);
489527
489647
  if (entryAfterConnect) {
489528
489648
  await mcpServersColT.put(entryAfterConnect.id, { ...entryAfterConnect.doc, status: serverStatus === "connected" ? "connected" : "error", tools_count: tools.length }, { expectedVersion: entryAfterConnect.version });
489529
489649
  }
489530
489650
  } else {
489531
- log89.error(`[MCP] Server not found in DB: ${mcpName}`);
489651
+ log90.error(`[MCP] Server not found in DB: ${mcpName}`);
489532
489652
  }
489533
489653
  } else {
489534
489654
  await mcp.disconnectServer(mcpName);
@@ -489538,10 +489658,10 @@ ${messageContent}`;
489538
489658
  }
489539
489659
  }
489540
489660
  } else {
489541
- log89.error(`[MCP] No MCP Manager found`);
489661
+ log90.error(`[MCP] No MCP Manager found`);
489542
489662
  }
489543
489663
  } catch (error54) {
489544
- log89.error(`[MCP] Failed to connect ${mcpName}: ${error54.message}`);
489664
+ log90.error(`[MCP] Failed to connect ${mcpName}: ${error54.message}`);
489545
489665
  }
489546
489666
  return addCorsHeaders(Response.json({ success: true, active, message: active ? "Servidor MCP conectado" : "Servidor MCP desconectado" }), req);
489547
489667
  }
@@ -489578,7 +489698,7 @@ ${messageContent}`;
489578
489698
  if (active) {
489579
489699
  const server3 = (await findMcpEntry2(mcpName))?.doc;
489580
489700
  if (server3) {
489581
- log89.info(`[MCP] Server config: transport=${server3.transport}, url=${server3.url}`);
489701
+ log90.info(`[MCP] Server config: transport=${server3.transport}, url=${server3.url}`);
489582
489702
  const mcpServerConfig = {
489583
489703
  transport: server3.transport,
489584
489704
  command: server3.command,
@@ -489597,23 +489717,23 @@ ${messageContent}`;
489597
489717
  ...currentConfig,
489598
489718
  servers: newServersConfig
489599
489719
  });
489600
- log89.info(`[MCP] Server registered in MCP Manager`);
489720
+ log90.info(`[MCP] Server registered in MCP Manager`);
489601
489721
  await mcp.connectServer(mcpName).catch((err) => {
489602
- log89.error(`[MCP] Connect attempt failed for ${mcpName}: ${err.message}`);
489722
+ log90.error(`[MCP] Connect attempt failed for ${mcpName}: ${err.message}`);
489603
489723
  });
489604
489724
  const tools = mcp.getServerTools(mcpName) || [];
489605
489725
  const serverDetails2 = mcp.getServerDetails?.(mcpName);
489606
489726
  const serverStatus2 = serverDetails2?.status ?? mcp.getServerStatus(mcpName);
489607
489727
  if (serverStatus2 === "error" && serverDetails2?.error) {
489608
- log89.error(`[MCP] Connection error for ${mcpName}: ${serverDetails2.error}`);
489728
+ log90.error(`[MCP] Connection error for ${mcpName}: ${serverDetails2.error}`);
489609
489729
  }
489610
- log89.info(`[MCP] Connected! Tools: ${tools.length}, status: ${serverStatus2}`);
489730
+ log90.info(`[MCP] Connected! Tools: ${tools.length}, status: ${serverStatus2}`);
489611
489731
  const entryAfterConnect2 = await findMcpEntry2(mcpName);
489612
489732
  if (entryAfterConnect2) {
489613
489733
  await mcpServersColT2.put(entryAfterConnect2.id, { ...entryAfterConnect2.doc, status: serverStatus2 === "connected" ? "connected" : "error", tools_count: tools.length }, { expectedVersion: entryAfterConnect2.version });
489614
489734
  }
489615
489735
  } else {
489616
- log89.error(`[MCP] Server not found in DB: ${mcpName}`);
489736
+ log90.error(`[MCP] Server not found in DB: ${mcpName}`);
489617
489737
  }
489618
489738
  } else {
489619
489739
  await mcp.disconnectServer(mcpName);
@@ -489624,7 +489744,7 @@ ${messageContent}`;
489624
489744
  }
489625
489745
  }
489626
489746
  } catch (error54) {
489627
- log89.error(`[MCP] Failed to connect ${mcpName}: ${error54.message}`);
489747
+ log90.error(`[MCP] Failed to connect ${mcpName}: ${error54.message}`);
489628
489748
  }
489629
489749
  return addCorsHeaders(Response.json({ success: true, active, message: active ? "Servidor MCP conectado" : "Servidor MCP desconectado" }), req);
489630
489750
  }
@@ -489818,12 +489938,12 @@ ${messageContent}`;
489818
489938
  if (response) {
489819
489939
  logRequest(response.status, duration3);
489820
489940
  } else {
489821
- log89.info(`${method} ${url2.pathname} - 101 Switching Protocols(${duration3}ms)`);
489941
+ log90.info(`${method} ${url2.pathname} - 101 Switching Protocols(${duration3}ms)`);
489822
489942
  }
489823
489943
  return response;
489824
489944
  } catch (error54) {
489825
489945
  const duration3 = Date.now() - start;
489826
- log89.error(`${method} ${url2.pathname} - Internal Error(${duration3}ms): ${error54.message} `);
489946
+ log90.error(`${method} ${url2.pathname} - Internal Error(${duration3}ms): ${error54.message} `);
489827
489947
  return addCorsHeaders(Response.json({ success: false, error: error54.message, message: "Error interno del servidor" }, { status: 500 }), req);
489828
489948
  }
489829
489949
  },
@@ -489846,11 +489966,11 @@ ${messageContent}`;
489846
489966
  }, 25000);
489847
489967
  data._hbInterval = hbInterval;
489848
489968
  if (data.sessionId.startsWith("meeting:")) {
489849
- log89.info(`Meeting stream client connected: ${data.sessionId}`);
489969
+ log90.info(`Meeting stream client connected: ${data.sessionId}`);
489850
489970
  ws.send(JSON.stringify({ type: "meeting:connected", sessionId: data.sessionId, meetingSessionId: data.meetingSessionId }));
489851
489971
  return;
489852
489972
  }
489853
- log89.debug(`WebSocket connected: ${data.sessionId} `);
489973
+ log90.debug(`WebSocket connected: ${data.sessionId} `);
489854
489974
  sessionManager.create(data.sessionId, ws);
489855
489975
  const pingInterval = setInterval(() => {
489856
489976
  try {
@@ -489888,7 +490008,7 @@ ${messageContent}`;
489888
490008
  } : { enabled: false, sttProvider: null, ttsProvider: null }
489889
490009
  }));
489890
490010
  } catch (err) {
489891
- log89.error("Error sending welcome message:", err);
490011
+ log90.error("Error sending welcome message:", err);
489892
490012
  }
489893
490013
  },
489894
490014
  async message(ws, message) {
@@ -490021,7 +490141,7 @@ ${messageContent}`;
490021
490141
  const sourceComponentId = actionData.sourceComponentId ?? "unknown";
490022
490142
  const context = actionData.context ?? {};
490023
490143
  const interactionMsg = `[a2ui:action] surface=${surfaceId} action=${actionName} component=${sourceComponentId}${Object.keys(context).length > 0 ? ` context=${JSON.stringify(context)}` : ""}`;
490024
- log89.info(`A2UI action forwarded to agent: ${interactionMsg}`);
490144
+ log90.info(`A2UI action forwarded to agent: ${interactionMsg}`);
490025
490145
  const sessionId = data.sessionId;
490026
490146
  ws.send(JSON.stringify({ type: "typing", isTyping: true, sessionId }));
490027
490147
  enqueueChatTurn({
@@ -490031,7 +490151,7 @@ ${messageContent}`;
490031
490151
  }).catch((error54) => {
490032
490152
  ws.send(JSON.stringify({ type: "typing", isTyping: false, sessionId }));
490033
490153
  ws.send(JSON.stringify({ type: "error", sessionId, error: error54.message }));
490034
- log89.error(`A2UI action enqueue error: ${error54.message}`);
490154
+ log90.error(`A2UI action enqueue error: ${error54.message}`);
490035
490155
  });
490036
490156
  return;
490037
490157
  }
@@ -490044,17 +490164,17 @@ ${messageContent}`;
490044
490164
  }
490045
490165
  if (msg.type === "logs_subscribe") {
490046
490166
  logSubscribers.add(data.sessionId);
490047
- log89.debug(`Session ${data.sessionId} subscribed to logs`);
490167
+ log90.debug(`Session ${data.sessionId} subscribed to logs`);
490048
490168
  return;
490049
490169
  }
490050
490170
  if (msg.type === "logs_unsubscribe") {
490051
490171
  logSubscribers.delete(data.sessionId);
490052
- log89.debug(`Session ${data.sessionId} unsubscribed from logs`);
490172
+ log90.debug(`Session ${data.sessionId} unsubscribed from logs`);
490053
490173
  return;
490054
490174
  }
490055
490175
  if (msg.type === "stop") {
490056
490176
  const cancelled = await getDurableQueue().cancelLane(msg.sessionId) > 0;
490057
- log89.info(`[stop] Session ${msg.sessionId} \u2014 cancelled: ${cancelled}`);
490177
+ log90.info(`[stop] Session ${msg.sessionId} \u2014 cancelled: ${cancelled}`);
490058
490178
  ws.send(JSON.stringify({
490059
490179
  type: "typing",
490060
490180
  isTyping: false,
@@ -490070,7 +490190,7 @@ ${messageContent}`;
490070
490190
  return;
490071
490191
  }
490072
490192
  if (msg.type === "audio" && msg.audio) {
490073
- log89.info(`WebChat audio from session ${msg.sessionId}`);
490193
+ log90.info(`WebChat audio from session ${msg.sessionId}`);
490074
490194
  const voiceConfig = await voiceService.getChannelVoiceConfig("webchat");
490075
490195
  if (!voiceConfig.voiceEnabled) {
490076
490196
  ws.send(JSON.stringify({
@@ -490097,7 +490217,7 @@ ${messageContent}`;
490097
490217
  const audioInput = { type: "base64", data: msg.audio, mimeType: "audio/webm" };
490098
490218
  const sttProvider = voiceConfig.sttProvider || "groq-whisper";
490099
490219
  const messageContent = await voiceService.transcribe(audioInput, sttProvider);
490100
- log89.info(`\uD83D\uDCDD Transcribed: ${messageContent.substring(0, 100)}...`);
490220
+ log90.info(`\uD83D\uDCDD Transcribed: ${messageContent.substring(0, 100)}...`);
490101
490221
  ws.send(JSON.stringify({
490102
490222
  type: "message",
490103
490223
  sessionId: msg.sessionId,
@@ -490120,7 +490240,7 @@ ${messageContent}`;
490120
490240
  }).catch((error54) => {
490121
490241
  ws.send(JSON.stringify({ type: "typing", isTyping: false, sessionId: msg.sessionId }));
490122
490242
  ws.send(JSON.stringify({ type: "error", sessionId: msg.sessionId, error: error54.message }));
490123
- log89.error(`Audio turn enqueue error: ${error54.message}`);
490243
+ log90.error(`Audio turn enqueue error: ${error54.message}`);
490124
490244
  });
490125
490245
  } catch (error54) {
490126
490246
  ws.send(JSON.stringify({
@@ -490137,7 +490257,7 @@ ${messageContent}`;
490137
490257
  return;
490138
490258
  }
490139
490259
  if (msg.type === "message" && msg.content) {
490140
- log89.info(`WebChat message from session ${msg.sessionId}: ${msg.content.substring(0, 100)}`);
490260
+ log90.info(`WebChat message from session ${msg.sessionId}: ${msg.content.substring(0, 100)}`);
490141
490261
  ws.send(JSON.stringify({
490142
490262
  type: "typing",
490143
490263
  isTyping: true,
@@ -490160,7 +490280,7 @@ ${messageContent}`;
490160
490280
  sessionId: msg.sessionId,
490161
490281
  error: error54.message
490162
490282
  }));
490163
- log89.error(`Message turn enqueue error: ${error54.message}`);
490283
+ log90.error(`Message turn enqueue error: ${error54.message}`);
490164
490284
  });
490165
490285
  return;
490166
490286
  }
@@ -490186,14 +490306,14 @@ ${messageContent}`;
490186
490306
  data._hbInterval = null;
490187
490307
  }
490188
490308
  if (data.sessionId.startsWith("meeting:")) {
490189
- log89.info(`Meeting stream client disconnected: ${data.sessionId}`);
490309
+ log90.info(`Meeting stream client disconnected: ${data.sessionId}`);
490190
490310
  return;
490191
490311
  }
490192
490312
  if (data._pingInterval) {
490193
490313
  clearInterval(data._pingInterval);
490194
490314
  data._pingInterval = null;
490195
490315
  }
490196
- log89.debug(`WebSocket disconnected: ${data.sessionId}`);
490316
+ log90.debug(`WebSocket disconnected: ${data.sessionId}`);
490197
490317
  const wasCurrentSession = sessionManager.deleteIfOwner(data.sessionId, ws);
490198
490318
  if (wasCurrentSession)
490199
490319
  logSubscribers.delete(data.sessionId);
@@ -490226,28 +490346,28 @@ ${messageContent}`;
490226
490346
  }
490227
490347
  }
490228
490348
  });
490229
- log89.info(`Gateway started successfully`);
490349
+ log90.info(`Gateway started successfully`);
490230
490350
  const isGatewayChild = process.env.HIVE_GATEWAY_CHILD === "1";
490231
490351
  if (isDev) {
490232
490352
  const devUrl = gatewaySetupMode ? `http://localhost:${port}/setup` : `http://localhost:${port}`;
490233
- log89.info(`[gateway] UI: ${devUrl}`);
490234
- log89.info(`[gateway] API: http://${host}:${port}`);
490235
- log89.info(`[gateway] WebSocket: ws://${host}:${port}/ws`);
490236
- log89.info(`[gateway] Actividad: ws://${host}:${port}/canvas`);
490237
- log89.info(`[gateway] Modo: desarrollo`);
490353
+ log90.info(`[gateway] UI: ${devUrl}`);
490354
+ log90.info(`[gateway] API: http://${host}:${port}`);
490355
+ log90.info(`[gateway] WebSocket: ws://${host}:${port}/ws`);
490356
+ log90.info(`[gateway] Actividad: ws://${host}:${port}/canvas`);
490357
+ log90.info(`[gateway] Modo: desarrollo`);
490238
490358
  if (!isGatewayChild) {
490239
- log89.info(gatewaySetupMode ? `\uD83C\uDF89 Primer arranque \u2014 abriendo setup...` : `\uD83D\uDC1D Administra tu Hive aqu\xED: ${devUrl}`);
490359
+ log90.info(gatewaySetupMode ? `\uD83C\uDF89 Primer arranque \u2014 abriendo setup...` : `\uD83D\uDC1D Administra tu Hive aqu\xED: ${devUrl}`);
490240
490360
  }
490241
490361
  } else {
490242
490362
  const isSetupMode2 = gatewaySetupMode;
490243
490363
  const baseUrl = process.env.HIVE_PUBLIC_URL?.replace(/\/$/, "") ?? `http://${host}:${port}`;
490244
490364
  const uiUrl = isSetupMode2 ? `${baseUrl}/setup` : `${baseUrl}/ui`;
490245
- log89.info(`[gateway] UI: ${uiUrl}`);
490246
- log89.info(`[gateway] API: http://${host}:${port}`);
490247
- log89.info(`[gateway] WebSocket: ws://${host}:${port}/ws`);
490248
- log89.info(`[gateway] Actividad: ws://${host}:${port}/canvas`);
490365
+ log90.info(`[gateway] UI: ${uiUrl}`);
490366
+ log90.info(`[gateway] API: http://${host}:${port}`);
490367
+ log90.info(`[gateway] WebSocket: ws://${host}:${port}/ws`);
490368
+ log90.info(`[gateway] Actividad: ws://${host}:${port}/canvas`);
490249
490369
  if (!process.env.NO_BROWSER) {
490250
- log89.info(isSetupMode2 ? `\uD83C\uDF89 Primer arranque \u2014 abriendo wizard de configuraci\xF3n...` : `\uD83D\uDC1D Administra tu Hive aqu\xED: ${uiUrl}`);
490370
+ log90.info(isSetupMode2 ? `\uD83C\uDF89 Primer arranque \u2014 abriendo wizard de configuraci\xF3n...` : `\uD83D\uDC1D Administra tu Hive aqu\xED: ${uiUrl}`);
490251
490371
  try {
490252
490372
  const platform2 = process.platform;
490253
490373
  let shellCmd;
@@ -490267,14 +490387,14 @@ ${messageContent}`;
490267
490387
  });
490268
490388
  proc.unref();
490269
490389
  } catch (err) {
490270
- log89.warn(`Could not open browser: ${err.message}`);
490390
+ log90.warn(`Could not open browser: ${err.message}`);
490271
490391
  }
490272
490392
  }
490273
490393
  }
490274
490394
  if (!gatewaySetupMode)
490275
- log89.info(`Channels: ${channelManager.listChannels().map((c) => c.name).join(", ") || "none"}`);
490395
+ log90.info(`Channels: ${channelManager.listChannels().map((c) => c.name).join(", ") || "none"}`);
490276
490396
  process.on("SIGTERM", async () => {
490277
- log89.info("Received SIGTERM, shutting down gracefully...");
490397
+ log90.info("Received SIGTERM, shutting down gracefully...");
490278
490398
  watchers.forEach((close) => close());
490279
490399
  try {
490280
490400
  stopAllLeaseRenewals();
@@ -490286,54 +490406,54 @@ ${messageContent}`;
490286
490406
  await interruptRun(run.id, "Process shutdown (SIGTERM)").catch(() => {});
490287
490407
  }
490288
490408
  }
490289
- log89.info(`[SIGTERM] Interrupted ${activeRuns.length} active durable run(s)`);
490409
+ log90.info(`[SIGTERM] Interrupted ${activeRuns.length} active durable run(s)`);
490290
490410
  } catch (err) {
490291
- log89.warn(`[SIGTERM] Failed to cleanup durable runs: ${err.message}`);
490411
+ log90.warn(`[SIGTERM] Failed to cleanup durable runs: ${err.message}`);
490292
490412
  }
490293
490413
  try {
490294
490414
  shutdownToolRuntime();
490295
- log89.info("[SIGTERM] Tool runtime disposed");
490415
+ log90.info("[SIGTERM] Tool runtime disposed");
490296
490416
  } catch {}
490297
490417
  const mcp = agent?.getMCPManager();
490298
490418
  if (mcp) {
490299
- log89.info("Disconnecting MCP servers...");
490419
+ log90.info("Disconnecting MCP servers...");
490300
490420
  await mcp.disconnectAll().catch(() => {});
490301
490421
  }
490302
490422
  if (channelManager) {
490303
- log89.info("Stopping channels...");
490423
+ log90.info("Stopping channels...");
490304
490424
  await channelManager.stopAll();
490305
490425
  }
490306
490426
  try {
490307
490427
  const mod = await Promise.resolve().then(() => (init_browser_service(), exports_browser_service));
490308
490428
  mod.CDPClient.closeAll();
490309
- log89.info("Browser processes cleaned up");
490429
+ log90.info("Browser processes cleaned up");
490310
490430
  } catch {}
490311
490431
  try {
490312
490432
  canvasManager.clearAll();
490313
- log89.info("Canvas sessions cleaned up");
490433
+ log90.info("Canvas sessions cleaned up");
490314
490434
  } catch {}
490315
490435
  try {
490316
490436
  const { stopMCPHotReload: stopMCPHotReload2 } = await Promise.resolve().then(() => (init_hot_reload(), exports_hot_reload));
490317
490437
  stopMCPHotReload2();
490318
- log89.info("MCP hot-reload stopped");
490438
+ log90.info("MCP hot-reload stopped");
490319
490439
  } catch {}
490320
490440
  server.stop();
490321
490441
  try {
490322
490442
  unlinkSync5(pidFile);
490323
490443
  } catch {}
490324
- log89.info("Gateway shutdown complete");
490444
+ log90.info("Gateway shutdown complete");
490325
490445
  process.exit(0);
490326
490446
  });
490327
490447
  if (process.platform !== "win32")
490328
490448
  process.on("SIGHUP", async () => {
490329
- log89.info("Received SIGHUP, reloading configuration...");
490449
+ log90.info("Received SIGHUP, reloading configuration...");
490330
490450
  try {
490331
490451
  const newConfig = await loadConfig();
490332
490452
  await agent.updateConfig(newConfig);
490333
490453
  await agent.reload();
490334
- log89.info("Configuration reloaded successfully");
490454
+ log90.info("Configuration reloaded successfully");
490335
490455
  } catch (error54) {
490336
- log89.error(`Failed to reload configuration: ${error54.message}`);
490456
+ log90.error(`Failed to reload configuration: ${error54.message}`);
490337
490457
  }
490338
490458
  });
490339
490459
  }
@@ -490371,6 +490491,8 @@ var init_server2 = __esm(() => {
490371
490491
  init_providers2();
490372
490492
  init_users4();
490373
490493
  init_skills3();
490494
+ init_a2ui2();
490495
+ init_runtime();
490374
490496
  init_ethics();
490375
490497
  init_tools2();
490376
490498
  init_tasks();
@@ -494948,7 +495070,7 @@ async function runFullWizard() {
494948
495070
  userId: state3.userId,
494949
495071
  data: { userName: state3.userName, userLanguage: state3.userLanguage, userTimezone: state3.userTimezone, userOccupation: state3.userOccupation, userNotes: state3.userNotes }
494950
495072
  });
494951
- log89.success(`\u2705 Usuario guardado con ID: ${state3.userId}`);
495073
+ log90.success(`\u2705 Usuario guardado con ID: ${state3.userId}`);
494952
495074
  const nav = await askNavigation();
494953
495075
  if (nav === "cancel") {
494954
495076
  Nt("Onboarding cancelado.");
@@ -495012,7 +495134,7 @@ async function runFullWizard() {
495012
495134
  userId: state3.userId,
495013
495135
  data: { agentName: state3.agentName, agentDescription: state3.agentDescription, agentTone: state3.agentTone, agentId: state3.agentId }
495014
495136
  });
495015
- log89.success(`\u2705 Agente creado con ID: ${state3.agentId}`);
495137
+ log90.success(`\u2705 Agente creado con ID: ${state3.agentId}`);
495016
495138
  const nav = await askNavigation();
495017
495139
  if (nav === "cancel") {
495018
495140
  Nt("Onboarding cancelado.");
@@ -495031,7 +495153,7 @@ async function runFullWizard() {
495031
495153
  const ethicsOptions = await getAllEthics();
495032
495154
  console.log("\uD83D\uDCCB Ethics options:", ethicsOptions);
495033
495155
  if (ethicsOptions.length === 0) {
495034
- log89.warn("No hay \xE9ticas disponibles en la BD. Usando \xE9tica por defecto.");
495156
+ log90.warn("No hay \xE9ticas disponibles en la BD. Usando \xE9tica por defecto.");
495035
495157
  state3.ethicsId = "default";
495036
495158
  } else {
495037
495159
  const selectedEthics = await Jt({
@@ -495190,9 +495312,9 @@ async function runFullWizard() {
495190
495312
  GROQ_API_KEY=${groqKey}`;
495191
495313
  fs28.writeFileSync(envPath, newEnv);
495192
495314
  reloadEnvToProcess(hiveDir2);
495193
- log89.success("\u2705 API key de Groq guardada en .env");
495315
+ log90.success("\u2705 API key de Groq guardada en .env");
495194
495316
  } else {
495195
- log89.info("\u2705 GROQ_API_KEY ya configurada en .env");
495317
+ log90.info("\u2705 GROQ_API_KEY ya configurada en .env");
495196
495318
  sttApiKeyValue = groqKey;
495197
495319
  }
495198
495320
  } else if (isOpenAiStt) {
@@ -495219,9 +495341,9 @@ GROQ_API_KEY=${groqKey}`;
495219
495341
  OPENAI_API_KEY=${openaiKey}`;
495220
495342
  fs28.writeFileSync(envPath, newEnv);
495221
495343
  reloadEnvToProcess(hiveDir2);
495222
- log89.success("\u2705 API key de OpenAI guardada en .env");
495344
+ log90.success("\u2705 API key de OpenAI guardada en .env");
495223
495345
  } else {
495224
- log89.info("\u2705 OPENAI_API_KEY ya configurada en .env");
495346
+ log90.info("\u2705 OPENAI_API_KEY ya configurada en .env");
495225
495347
  sttApiKeyValue = openaiKey;
495226
495348
  }
495227
495349
  }
@@ -495263,9 +495385,9 @@ OPENAI_API_KEY=${openaiKey}`;
495263
495385
  GROQ_API_KEY=${groqKey}`;
495264
495386
  fs28.writeFileSync(envPath, newEnv);
495265
495387
  reloadEnvToProcess(hiveDir2);
495266
- log89.success("\u2705 API key de Groq guardada en .env");
495388
+ log90.success("\u2705 API key de Groq guardada en .env");
495267
495389
  } else {
495268
- log89.info("\u2705 GROQ_API_KEY ya configurada en .env");
495390
+ log90.info("\u2705 GROQ_API_KEY ya configurada en .env");
495269
495391
  }
495270
495392
  ttsApiKeyValue = groqKey;
495271
495393
  } else if (isElevenLabs) {
@@ -495292,9 +495414,9 @@ GROQ_API_KEY=${groqKey}`;
495292
495414
  ELEVENLABS_API_KEY=${elevenKey}`;
495293
495415
  fs28.writeFileSync(envPath, newEnv);
495294
495416
  reloadEnvToProcess(hiveDir2);
495295
- log89.success("\u2705 API key de ElevenLabs guardada en .env");
495417
+ log90.success("\u2705 API key de ElevenLabs guardada en .env");
495296
495418
  } else {
495297
- log89.info("\u2705 ELEVENLABS_API_KEY ya configurada en .env");
495419
+ log90.info("\u2705 ELEVENLABS_API_KEY ya configurada en .env");
495298
495420
  state3.elevenlabsApiKey = elevenKey;
495299
495421
  }
495300
495422
  ttsApiKeyValue = elevenKey;
@@ -495321,9 +495443,9 @@ ELEVENLABS_API_KEY=${elevenKey}`;
495321
495443
  OPENAI_API_KEY=${openaiKey}`;
495322
495444
  fs28.writeFileSync(envPath, newEnv);
495323
495445
  reloadEnvToProcess(hiveDir2);
495324
- log89.success("\u2705 API key de OpenAI guardada en .env");
495446
+ log90.success("\u2705 API key de OpenAI guardada en .env");
495325
495447
  } else {
495326
- log89.info("\u2705 OPENAI_API_KEY ya configurada en .env");
495448
+ log90.info("\u2705 OPENAI_API_KEY ya configurada en .env");
495327
495449
  }
495328
495450
  ttsApiKeyValue = openaiKey;
495329
495451
  } else if (isGemini) {
@@ -495349,9 +495471,9 @@ OPENAI_API_KEY=${openaiKey}`;
495349
495471
  GEMINI_API_KEY=${geminiKey}`;
495350
495472
  fs28.writeFileSync(envPath, newEnv);
495351
495473
  reloadEnvToProcess(hiveDir2);
495352
- log89.success("\u2705 API key de Gemini guardada en .env");
495474
+ log90.success("\u2705 API key de Gemini guardada en .env");
495353
495475
  } else {
495354
- log89.info("\u2705 GEMINI_API_KEY ya configurada en .env");
495476
+ log90.info("\u2705 GEMINI_API_KEY ya configurada en .env");
495355
495477
  }
495356
495478
  ttsApiKeyValue = geminiKey;
495357
495479
  } else if (isQwen) {
@@ -495377,9 +495499,9 @@ GEMINI_API_KEY=${geminiKey}`;
495377
495499
  DASHSCOPE_API_KEY=${qwenKey}`;
495378
495500
  fs28.writeFileSync(envPath, newEnv);
495379
495501
  reloadEnvToProcess(hiveDir2);
495380
- log89.success("\u2705 API key de Qwen guardada en .env");
495502
+ log90.success("\u2705 API key de Qwen guardada en .env");
495381
495503
  } else {
495382
- log89.info("\u2705 DASHSCOPE_API_KEY ya configurada en .env");
495504
+ log90.info("\u2705 DASHSCOPE_API_KEY ya configurada en .env");
495383
495505
  }
495384
495506
  ttsApiKeyValue = qwenKey;
495385
495507
  }
@@ -495392,7 +495514,7 @@ DASHSCOPE_API_KEY=${qwenKey}`;
495392
495514
  sttApiKey: sttApiKeyValue || undefined,
495393
495515
  ttsApiKey: ttsApiKeyValue || undefined
495394
495516
  });
495395
- log89.success("\u2705 Configuraci\xF3n de voz guardada en BD");
495517
+ log90.success("\u2705 Configuraci\xF3n de voz guardada en BD");
495396
495518
  }
495397
495519
  const nav2 = await askNavigation();
495398
495520
  if (nav2 === "cancel") {
@@ -495413,7 +495535,7 @@ DASHSCOPE_API_KEY=${qwenKey}`;
495413
495535
  channelId: "webchat",
495414
495536
  channelUserId: state3.sessionToken
495415
495537
  });
495416
- log89.success("\u2705 WebChat activado por defecto (http://localhost:18790/ui)");
495538
+ log90.success("\u2705 WebChat activado por defecto (http://localhost:18790/ui)");
495417
495539
  const activateTelegram = await Rt({
495418
495540
  message: "\xBFQuieres activar Telegram? (recomendado para notificaciones)",
495419
495541
  initialValue: false
@@ -495439,7 +495561,7 @@ DASHSCOPE_API_KEY=${qwenKey}`;
495439
495561
  channelId: "telegram",
495440
495562
  config: { botToken: state3.channelToken, dmPolicy: "open" }
495441
495563
  });
495442
- log89.success("\u2705 Telegram activado");
495564
+ log90.success("\u2705 Telegram activado");
495443
495565
  }
495444
495566
  await saveOnboardingProgress({
495445
495567
  step: "channel",
@@ -495517,7 +495639,7 @@ ${key}=${value}`;
495517
495639
  }
495518
495640
  fs28.writeFileSync(envPath, newEnvContent.trim() + `
495519
495641
  `);
495520
- log89.info(`IDs de identidad persistidos en ${envPath}`);
495642
+ log90.info(`IDs de identidad persistidos en ${envPath}`);
495521
495643
  step = TOTAL_STEPS + 1;
495522
495644
  break;
495523
495645
  }
@@ -495552,15 +495674,15 @@ ${key}=${value}`;
495552
495674
  initialValue: true
495553
495675
  });
495554
495676
  if (Ct(shouldStart) || !shouldStart) {
495555
- log89.info("\xA1Perfecto! Ejecuta 'hive start' cuando quieras iniciar.");
495677
+ log90.info("\xA1Perfecto! Ejecuta 'hive start' cuando quieras iniciar.");
495556
495678
  return;
495557
495679
  }
495558
- log89.info("\uD83D\uDE80 Iniciando Hive gateway...");
495680
+ log90.info("\uD83D\uDE80 Iniciando Hive gateway...");
495559
495681
  }
495560
495682
  async function onboard() {
495561
495683
  const hiveDir = getHiveDir();
495562
495684
  if (!fs28.existsSync(hiveDir)) {
495563
- log89.info(`\uD83D\uDCC1 Creando carpeta de configuraci\xF3n: ${hiveDir}`);
495685
+ log90.info(`\uD83D\uDCC1 Creando carpeta de configuraci\xF3n: ${hiveDir}`);
495564
495686
  fs28.mkdirSync(hiveDir, { recursive: true });
495565
495687
  }
495566
495688
  await initOnboardingDb();
@@ -495621,19 +495743,19 @@ async function onboard() {
495621
495743
  if (fs28.existsSync(dbPath)) {
495622
495744
  const backupPath = path42.join(hiveDir, `hivedb.backup.${Date.now()}`);
495623
495745
  fs28.cpSync(dbPath, backupPath, { recursive: true });
495624
- log89.info(`Backup BD creado: ${backupPath}`);
495746
+ log90.info(`Backup BD creado: ${backupPath}`);
495625
495747
  fs28.rmSync(dbPath, { recursive: true, force: true });
495626
- log89.info("Base de datos eliminada");
495748
+ log90.info("Base de datos eliminada");
495627
495749
  }
495628
495750
  await initOnboardingDb();
495629
- log89.success("BD reiniciada con datos del sistema");
495751
+ log90.success("BD reiniciada con datos del sistema");
495630
495752
  }
495631
495753
  await runFullWizard();
495632
495754
  } else {
495633
495755
  await runFullWizard();
495634
495756
  }
495635
495757
  }
495636
- var ONBOARDING_STT_OPTIONS, ONBOARDING_TTS_OPTIONS, log89, DEFAULT_MODELS, PROVIDER_BASE_URLS, API_KEY_LINKS, AVAILABLE_MODELS;
495758
+ var ONBOARDING_STT_OPTIONS, ONBOARDING_TTS_OPTIONS, log90, DEFAULT_MODELS, PROVIDER_BASE_URLS, API_KEY_LINKS, AVAILABLE_MODELS;
495637
495759
  var init_onboard = __esm(() => {
495638
495760
  init_dist14();
495639
495761
  init_onboarding();
@@ -495657,7 +495779,7 @@ var init_onboard = __esm(() => {
495657
495779
  { value: "gemini-2.5-flash-preview-tts", label: "Gemini 2.5 Flash TTS", hint: "Google" },
495658
495780
  { value: "gemini-2.5-pro-preview-tts", label: "Gemini 2.5 Pro TTS", hint: "Google Pro" }
495659
495781
  ];
495660
- log89 = {
495782
+ log90 = {
495661
495783
  success: (msg) => console.log(`\x1B[32m\u2714\x1B[0m ${msg}`),
495662
495784
  error: (msg) => console.log(`\x1B[31m\u2716\x1B[0m ${msg}`),
495663
495785
  warn: (msg) => console.log(`\x1B[33m\u26A0\x1B[0m ${msg}`),
@@ -498419,12 +498541,42 @@ Examples:
498419
498541
  hive update Actualizar a la \xFAltima versi\xF3n
498420
498542
  `;
498421
498543
  async function main() {
498422
- const isDev = process.argv[1]?.endsWith(".ts");
498423
- const args = process.argv.slice(isDev ? 2 : 1);
498424
- const normalizedArgs = args[0]?.includes("\\") || args[0]?.includes("/") ? args.slice(1) : args;
498544
+ const commandTokens = new Set([
498545
+ "dev",
498546
+ "start",
498547
+ "stop",
498548
+ "reload",
498549
+ "status",
498550
+ "chat",
498551
+ "logs",
498552
+ "message",
498553
+ "agent",
498554
+ "agents",
498555
+ "mcp",
498556
+ "skills",
498557
+ "config",
498558
+ "sessions",
498559
+ "cron",
498560
+ "causal",
498561
+ "doctor",
498562
+ "security",
498563
+ "install-service",
498564
+ "update",
498565
+ "migrate",
498566
+ "--version",
498567
+ "-v",
498568
+ "version",
498569
+ "--help",
498570
+ "-h",
498571
+ "help"
498572
+ ]);
498573
+ const rawArgs = process.argv.slice(1);
498574
+ const commandIndex = rawArgs.findIndex((arg) => commandTokens.has(arg));
498575
+ const normalizedArgs = commandIndex >= 0 ? rawArgs.slice(commandIndex) : rawArgs;
498425
498576
  const command = normalizedArgs[0];
498426
498577
  const subcommand = normalizedArgs[1];
498427
498578
  const flags3 = normalizedArgs.filter((a) => a.startsWith("--"));
498579
+ const commandArgs = normalizedArgs.slice(2);
498428
498580
  switch (command) {
498429
498581
  case "dev":
498430
498582
  await dev();
@@ -498448,31 +498600,31 @@ async function main() {
498448
498600
  await logs(flags3);
498449
498601
  break;
498450
498602
  case "message":
498451
- await message(subcommand, args.slice(2));
498603
+ await message(subcommand, commandArgs);
498452
498604
  break;
498453
498605
  case "agent":
498454
- await agent(subcommand, args.slice(2));
498606
+ await agent(subcommand, commandArgs);
498455
498607
  break;
498456
498608
  case "agents":
498457
- await agents(subcommand, args.slice(2));
498609
+ await agents(subcommand, commandArgs);
498458
498610
  break;
498459
498611
  case "mcp":
498460
- await mcp(subcommand, args.slice(2));
498612
+ await mcp(subcommand, commandArgs);
498461
498613
  break;
498462
498614
  case "skills":
498463
- await skills(subcommand, args.slice(2));
498615
+ await skills(subcommand, commandArgs);
498464
498616
  break;
498465
498617
  case "config":
498466
- await config3(subcommand, args.slice(2));
498618
+ await config3(subcommand, commandArgs);
498467
498619
  break;
498468
498620
  case "sessions":
498469
- await sessions(subcommand, args.slice(2));
498621
+ await sessions(subcommand, commandArgs);
498470
498622
  break;
498471
498623
  case "cron":
498472
- await cron(subcommand, args.slice(2));
498624
+ await cron(subcommand, commandArgs);
498473
498625
  break;
498474
498626
  case "causal":
498475
- await causal(subcommand, args.slice(2));
498627
+ await causal(subcommand, commandArgs);
498476
498628
  break;
498477
498629
  case "doctor":
498478
498630
  await doctor();