@johpaz/hive-agents 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/hive.js +88127 -103024
- package/dist/tool-worker.js +13243 -17002
- package/dist/ui/assets/A2UIPage-CS0VPY6a.js +8 -0
- package/dist/ui/assets/AgentCreateForm-DXkjtXaS.js +1 -0
- package/dist/ui/assets/AgentDetailPage-DUIX_cuQ.js +1 -0
- package/dist/ui/assets/AgentNewPage-SNXz2wik.js +1 -0
- package/dist/ui/assets/AgentsPage-CGsdgx5F.js +10 -0
- package/dist/ui/assets/{ApiClientPage-6a6KFwsQ.js → ApiClientPage-MNMjfSDs.js} +2 -2
- package/dist/ui/assets/ChannelsPage-BEwxWUcE.js +8 -0
- package/dist/ui/assets/DashboardPage-D6cRFKWW.js +6 -0
- package/dist/ui/assets/LoginPage-ByYmIa2p.js +1 -0
- package/dist/ui/assets/LogsPage-Bmk9rohg.js +1 -0
- package/dist/ui/assets/MeetingPage-Dm97Mbiw.js +1 -0
- package/dist/ui/assets/ModelSelector-gubC8j_Q.js +1 -0
- package/dist/ui/assets/NotFound-PUg3gEO0.js +1 -0
- package/dist/ui/assets/{Office3DPage-C3SIzd2H.css → Office3DPage-31AMJ-LN.css} +1 -1
- package/dist/ui/assets/Office3DPage-Bfi-S2kG.js +727 -0
- package/dist/ui/assets/ProvidersPage-CSo0MYxd.js +1 -0
- package/dist/ui/assets/RecoverPage-YY2QU-qh.js +1 -0
- package/dist/ui/assets/SettingsPage-DrafhhKw.js +9 -0
- package/dist/ui/assets/SetupPage-LXnd2XbV.js +1 -0
- package/dist/ui/assets/Vignette-BcPWkNhm.js +4302 -0
- package/dist/ui/assets/VoicePage-p-hTMAq7.js +307 -0
- package/dist/ui/assets/VoicePage-uLWdtoD4.css +1 -0
- package/dist/ui/assets/WebChatPage-B61ZDjQ8.js +29 -0
- package/dist/ui/assets/agentCapabilities-PfTEVxG1.js +1 -0
- package/dist/ui/assets/alert-CjiX20jI.js +1 -0
- package/dist/ui/assets/badge-B5AKge1b.js +1 -0
- package/dist/ui/assets/bia-4LFKOyxR.webp +0 -0
- package/dist/ui/assets/bia-BFcUpOu3.glb +0 -0
- package/dist/ui/assets/card-mTJ4oZbL.js +1 -0
- package/dist/ui/assets/conversationsStore-BlwA3yd2.js +1 -0
- package/dist/ui/assets/dialog-B04KpdNt.js +1 -0
- package/dist/ui/assets/dist-js-Dh18rcg9.js +1 -0
- package/dist/ui/assets/{dist-js-CLxM1g2B.js → dist-js-q7C_AB0j.js} +1 -1
- package/dist/ui/assets/index-ByTufXPh.css +2 -0
- package/dist/ui/assets/index-DKJFLL3a.js +116 -0
- package/dist/ui/assets/label-D_fvqJyD.js +1 -0
- package/dist/ui/assets/lock-3IApZyVy.js +1 -0
- package/dist/ui/assets/{square-psq7k_CB.js → mic-CpDU_2as.js} +1 -1
- package/dist/ui/assets/pencil-L3Li7_pz.js +1 -0
- package/dist/ui/assets/rotate-ccw-LoM1AuqK.js +1 -0
- package/dist/ui/assets/scroll-area-CbH8FOo8.js +1 -0
- package/dist/ui/assets/select-v_3QBYrD.js +1 -0
- package/dist/ui/assets/slider-DXS4h1LB.js +1 -0
- package/dist/ui/assets/square-D5zdNkAY.js +1 -0
- package/dist/ui/assets/switch-ndx8VCpm.js +1 -0
- package/dist/ui/assets/tabs-epu-3Tl4.js +1 -0
- package/dist/ui/assets/textarea-BgZJFZTX.js +1 -0
- package/dist/ui/assets/useAudioDevices-B2stUHvr.js +41 -0
- package/dist/ui/assets/useHiveAgentsModelLoad-B4EjHvj4.js +1 -0
- package/dist/ui/assets/useOfficeModel-BaDn7U-X.js +1 -0
- package/dist/ui/assets/{useProviders-CiLSc05q.js → useProviders-B1NS24md.js} +1 -1
- package/dist/ui/assets/vendor-react-kUOwxn0g.js +1 -0
- package/dist/ui/assets/volume-2-EaA0JRvD.js +1 -0
- package/dist/ui/assets/volume-x-CROXNMGT.js +1 -0
- package/dist/ui/index.html +6 -6
- package/package.json +10 -6
- package/packages/cli/src/adapters/config.ts +11 -3
- package/packages/cli/src/commands/causal.ts +1 -1
- package/packages/cli/src/commands/doctor.ts +101 -46
- package/packages/cli/src/commands/onboard.ts +4 -2
- package/packages/core/src/agent/agent-catalog.ts +47 -47
- package/packages/core/src/agent/agent-loop.ts +67 -14
- package/packages/core/src/agent/capability-search.ts +2 -1
- package/packages/core/src/agent/compaction.ts +19 -7
- package/packages/core/src/agent/context-compiler.ts +166 -28
- package/packages/core/src/agent/conversation-store.ts +26 -2
- package/packages/core/src/agent/goal-runner.ts +2 -2
- package/packages/core/src/agent/jev-decisions.ts +148 -0
- package/packages/core/src/agent/jev-planner.ts +293 -0
- package/packages/core/src/agent/llm-client.ts +29 -7
- package/packages/core/src/agent/llm-providers/ollama.ts +17 -4
- package/packages/core/src/agent/llm-providers/openai-compat-base.ts +27 -12
- package/packages/core/src/agent/llm-providers/opencode-go.ts +37 -0
- package/packages/core/src/agent/prompt-builder.ts +1 -1
- package/packages/core/src/agent/realtime-providers/gemini-live.ts +233 -0
- package/packages/core/src/agent/realtime-providers/index.ts +29 -0
- package/packages/core/src/agent/realtime-providers/interface.ts +108 -0
- package/packages/core/src/agent/skill-selector.ts +5 -3
- package/packages/core/src/agent/thread-id.ts +71 -0
- package/packages/core/src/agent/thread-store.ts +230 -0
- package/packages/core/src/agent/tool-selector.ts +2 -0
- package/packages/core/src/agent/tracer.ts +2 -0
- package/packages/core/src/canvas/canvas-manager.ts +145 -27
- package/packages/core/src/canvas/emitter.ts +24 -0
- package/packages/core/src/channels/telegram.ts +19 -1
- package/packages/core/src/channels/webchat.ts +47 -45
- package/packages/core/src/config/loader.ts +9 -6
- package/packages/core/src/events/tool-narration.ts +1 -0
- package/packages/core/src/gateway/channel-notify.ts +24 -5
- package/packages/core/src/gateway/delegation-groups.ts +5 -5
- package/packages/core/src/gateway/delegation-notify.ts +34 -5
- package/packages/core/src/gateway/durable-queue.ts +22 -0
- package/packages/core/src/gateway/failure-notify.ts +8 -2
- package/packages/core/src/gateway/initializer.ts +17 -10
- package/packages/core/src/gateway/job-executors.ts +3 -3
- package/packages/core/src/gateway/realtime/bridge-tools.ts +470 -0
- package/packages/core/src/gateway/realtime/index.ts +305 -0
- package/packages/core/src/gateway/realtime/prompt.ts +182 -0
- package/packages/core/src/gateway/realtime/protocol.ts +60 -0
- package/packages/core/src/gateway/realtime/voice-session.ts +442 -0
- package/packages/core/src/gateway/resolver.ts +31 -4
- package/packages/core/src/gateway/routes/artifacts.ts +13 -0
- package/packages/core/src/gateway/routes/chat.ts +20 -4
- package/packages/core/src/gateway/routes/conversations.ts +121 -0
- package/packages/core/src/gateway/routes/providers.ts +16 -1
- package/packages/core/src/gateway/routes/setup.ts +25 -14
- package/packages/core/src/gateway/routes/system.ts +4 -2
- package/packages/core/src/gateway/routes/tts-local.ts +2 -1
- package/packages/core/src/gateway/server.ts +171 -13
- package/packages/core/src/gateway/slash-commands.ts +48 -10
- package/packages/core/src/gateway/tts/src/server.ts +2 -1
- package/packages/core/src/gateway/webchat-turn.ts +68 -10
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/scheduler/CronScheduler.ts +20 -8
- package/packages/core/src/scheduler/cron/cron-engine.test.ts +295 -0
- package/packages/core/src/scheduler/cron/expression.ts +165 -0
- package/packages/core/src/scheduler/cron/index.ts +10 -0
- package/packages/core/src/scheduler/cron/job.ts +340 -0
- package/packages/core/src/scheduler/cron/next-run.ts +121 -0
- package/packages/core/src/scheduler/cron/zoned-time.ts +139 -0
- package/packages/core/src/scheduler/integration.ts +16 -5
- package/packages/core/src/scheduler/types.ts +3 -18
- package/packages/core/src/storage/bootstrap.ts +23 -0
- package/packages/core/src/storage/collections.ts +38 -1
- package/packages/core/src/storage/crypto.ts +23 -12
- package/packages/core/src/storage/onboarding.ts +39 -39
- package/packages/core/src/storage/reconcile.ts +6 -1
- package/packages/core/src/storage/seed.ts +82 -8
- package/packages/core/src/storage/usage.ts +53 -1
- package/packages/core/src/tool-runtime/index.ts +19 -1
- package/packages/core/src/tools/a2ui/index.ts +65 -1
- package/packages/core/src/tools/agents/get-available-models.ts +3 -1
- package/packages/core/src/tools/core/index.ts +39 -4
- package/packages/core/src/tools/cron/index.ts +4 -4
- package/packages/core/src/tools/index.ts +2 -1
- package/packages/core/src/tools/office/office-escribir-xlsx.ts +2 -1
- package/packages/core/src/tools/office/office-leer-xlsx.ts +2 -1
- package/packages/core/src/tools/office/xlsx-loader.ts +19 -0
- package/packages/core/src/tools/web/browser-backend.ts +141 -44
- package/packages/core/src/tools/web/browser-click.ts +2 -2
- package/packages/core/src/tools/web/browser-extract.ts +2 -2
- package/packages/core/src/tools/web/browser-navigate.ts +2 -2
- package/packages/core/src/tools/web/browser-screenshot.ts +12 -5
- package/packages/core/src/tools/web/browser-script.ts +2 -2
- package/packages/core/src/tools/web/browser-service.ts +63 -384
- package/packages/core/src/tools/web/browser-session.ts +125 -0
- package/packages/core/src/tools/web/browser-type.ts +2 -2
- package/packages/core/src/tools/web/browser-wait.ts +2 -2
- package/packages/core/src/tools/web/computer-use.ts +553 -0
- package/packages/core/src/tools/web/index.ts +5 -1
- package/packages/core/src/tools/web/webview-backend.ts +559 -21
- package/packages/core/src/utils/port.ts +33 -0
- package/packages/core/src/voice/index.ts +2 -1
- package/packages/mcp/src/config.ts +2 -1
- package/packages/mcp/src/manager.ts +9 -0
- package/packages/mcp/src/transports/index.ts +42 -1
- package/packages/mcp/src/transports/sse.ts +11 -5
- package/packages/skills/src/bundled/a2ui/a2ui_dashboard/SKILL.md +2 -2
- package/packages/skills/src/bundled/a2ui/a2ui_form/SKILL.md +2 -2
- package/packages/skills/src/bundled/a2ui/a2ui_interactive/SKILL.md +4 -4
- package/packages/skills/src/bundled/agents/agent_spawner/SKILL.md +7 -7
- package/packages/skills/src/bundled/agents/memory_manager/SKILL.md +9 -9
- package/packages/skills/src/bundled/agents/research_and_remember/SKILL.md +8 -8
- package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +8 -8
- package/packages/skills/src/bundled/artifacts/artifact_reader/SKILL.md +104 -0
- package/packages/skills/src/bundled/cli/cli_pipeline/SKILL.md +6 -6
- package/packages/skills/src/bundled/cli/cli_safe_exec/SKILL.md +5 -5
- package/packages/skills/src/bundled/cron_manager/SKILL.md +29 -19
- package/packages/skills/src/bundled/cron_reminder/SKILL.md +5 -5
- package/packages/skills/src/bundled/filesystem/file_manager/SKILL.md +4 -4
- package/packages/skills/src/bundled/filesystem/file_read_and_summarize/SKILL.md +7 -7
- package/packages/skills/src/bundled/filesystem/file_writer/SKILL.md +10 -10
- package/packages/skills/src/bundled/search_knowledge/capability_discovery/SKILL.md +8 -8
- package/packages/skills/src/bundled/web/browser_automate/SKILL.md +21 -12
- package/packages/skills/src/bundled/web/browser_scrape/SKILL.md +28 -13
- package/packages/skills/src/bundled/web/web_monitor/SKILL.md +6 -6
- package/packages/skills/src/bundled/web/web_research/SKILL.md +5 -5
- package/packages/skills/src/bundled-data.generated.ts +837 -783
- package/dist/ui/assets/A2UIPage-7Ry5rHh9.js +0 -8
- package/dist/ui/assets/AgentCreateForm-Dh5W0q_t.js +0 -1
- package/dist/ui/assets/AgentDetailPage-CIoPjtsS.js +0 -1
- package/dist/ui/assets/AgentNewPage-BNsZcJQf.js +0 -1
- package/dist/ui/assets/AgentsPage-YZrDmgNI.js +0 -10
- package/dist/ui/assets/ChannelsPage-Dice4dkJ.js +0 -8
- package/dist/ui/assets/DashboardPage-B9r0sc0F.js +0 -6
- package/dist/ui/assets/LoginPage-BkAAX_tu.js +0 -1
- package/dist/ui/assets/LogsPage-8-H1OJs3.js +0 -1
- package/dist/ui/assets/MeetingPage-14JoQo71.js +0 -1
- package/dist/ui/assets/ModelSelector-CrgJQ7DG.js +0 -1
- package/dist/ui/assets/NotFound-B06kVW7N.js +0 -1
- package/dist/ui/assets/Office3DPage-BMUZWkFS.js +0 -4614
- package/dist/ui/assets/ProvidersPage-BiL3QxCs.js +0 -1
- package/dist/ui/assets/RecoverPage-D1o8yxNz.js +0 -1
- package/dist/ui/assets/SettingsPage-GP8UwQIL.js +0 -9
- package/dist/ui/assets/SetupPage-B_gU1YQU.js +0 -1
- package/dist/ui/assets/WebChatPage-Yahufnth.js +0 -29
- package/dist/ui/assets/agentCapabilities-Dg72UAFj.js +0 -1
- package/dist/ui/assets/alert-DChoEVJw.js +0 -1
- package/dist/ui/assets/badge-uRjRSt86.js +0 -1
- package/dist/ui/assets/card-DwQizslL.js +0 -1
- package/dist/ui/assets/dialog--mljnfAi.js +0 -1
- package/dist/ui/assets/dist-js-B0s_TDau.js +0 -1
- package/dist/ui/assets/index-BHHUQZJd.js +0 -116
- package/dist/ui/assets/index-CEFhf4dF.css +0 -2
- package/dist/ui/assets/label-BceoUB2w.js +0 -1
- package/dist/ui/assets/pencil-CUbpCfeG.js +0 -1
- package/dist/ui/assets/scroll-area-DMEaZZUp.js +0 -1
- package/dist/ui/assets/select-BBEBtcLm.js +0 -1
- package/dist/ui/assets/slider-DcmBdvYD.js +0 -1
- package/dist/ui/assets/switch-CgiDezVR.js +0 -1
- package/dist/ui/assets/tabs-gUXIjjZv.js +0 -1
- package/dist/ui/assets/textarea-DedxQYBx.js +0 -1
- package/dist/ui/assets/useHiveAgentsModelLoad-C7bhWPDG.js +0 -1
- package/dist/ui/assets/useOfficeModel-BAFasrg8.js +0 -1
- package/dist/ui/assets/vendor-react-DYyYpuMy.js +0 -1
- package/dist/ui/assets/volume-x-BDlMCDYT.js +0 -1
- /package/dist/ui/assets/{core-Sjunb8Z1.js → core-B_5cyOSV.js} +0 -0
- /package/dist/ui/assets/{download-D0aDV8Y_.js → download-BQXrpH0m.js} +0 -0
- /package/dist/ui/assets/{ellipsis-vertical-BOW_iEOO.js → ellipsis-vertical-D7uFJLGh.js} +0 -0
- /package/dist/ui/assets/{external-link-5cujQzfV.js → external-link-6oTH9pUM.js} +0 -0
- /package/dist/ui/assets/{eye-sRPY5qOa.js → eye-CxvxtQT5.js} +0 -0
- /package/dist/ui/assets/{file-text-DNSyNLUh.js → file-text-D5ZJEx3E.js} +0 -0
- /package/dist/ui/assets/{gateway-url-BZj_2-jf.js → gateway-url-BALS_wVh.js} +0 -0
- /package/dist/ui/assets/{gauge-C__zxC3_.js → gauge-CEu7PhTW.js} +0 -0
- /package/dist/ui/assets/{history-BHQWfE-7.js → history-DLK5rTlP.js} +0 -0
- /package/dist/ui/assets/{info-CG1VohyH.js → info-8ReWzubE.js} +0 -0
- /package/dist/ui/assets/{key-BC28VCjO.js → key-DPkOY-J0.js} +0 -0
- /package/dist/ui/assets/{lock-open-Bhp0UJlL.js → lock-open-v0EphssG.js} +0 -0
- /package/dist/ui/assets/{mail-Biwn8WrV.js → mail-vwCEHyhQ.js} +0 -0
- /package/dist/ui/assets/{pause-C2l5G2Py.js → pause-Cm9LzIZK.js} +0 -0
- /package/dist/ui/assets/{play-CMAscR3a.js → play-zqogwA2l.js} +0 -0
- /package/dist/ui/assets/{plus-DzvRxH4U.js → plus-Bm08ABhc.js} +0 -0
- /package/dist/ui/assets/{radio-DfGzov4y.js → radio-Cii1BjMt.js} +0 -0
- /package/dist/ui/assets/{refresh-cw-DZXu5FrG.js → refresh-cw-DXv3XgEt.js} +0 -0
- /package/dist/ui/assets/{search-ykSx-zZU.js → search-BMwCI-pX.js} +0 -0
- /package/dist/ui/assets/{send-DAhlz2i9.js → send-D6fgWV7m.js} +0 -0
- /package/dist/ui/assets/{settings-DL0REysC.js → settings-qV3kVkeG.js} +0 -0
- /package/dist/ui/assets/{shield-BPZZhjCT.js → shield-CIarwBvx.js} +0 -0
- /package/dist/ui/assets/{sparkles-BViXTAh7.js → sparkles-DVvY6jDT.js} +0 -0
- /package/dist/ui/assets/{terminal-CzxPKG-h.js → terminal-BEcTK780.js} +0 -0
- /package/dist/ui/assets/{trash-2-SgYCWiVk.js → trash-2-D6oziYAK.js} +0 -0
- /package/dist/ui/assets/{utils-SGUggNJc.js → utils-DEmd_M8c.js} +0 -0
- /package/dist/ui/assets/{vendor-router-Dsg8fxNQ.js → vendor-router-DP84b3LQ.js} +0 -0
- /package/dist/ui/assets/{wifi-CyPHteEm.js → wifi-BUJuOcgP.js} +0 -0
- /package/dist/ui/assets/{zap-OVVrfEHr.js → zap-DSoX9NDk.js} +0 -0
|
@@ -54,6 +54,7 @@ export const SEED_DATA: SeedData = {
|
|
|
54
54
|
{ id: "web_fetch", name: "web_fetch", category: "web", description: "Obtener contenido de texto de una URL (ligero, sin JS). Sinónimos: descargar página, extraer texto, obtener contenido, leer url" },
|
|
55
55
|
{ id: "browser_navigate", name: "browser_navigate", category: "web", description: "Navegar a una URL y obtener contenido renderizado (soporta JS). Sinónimos: abrir página, sitio web, navegar url, cargar página" },
|
|
56
56
|
{ id: "browser_screenshot", name: "browser_screenshot", category: "web", description: "Tomar captura de pantalla de la página actual. Sinónimos: screenshot, imagen de página, capturar pantalla, foto página" },
|
|
57
|
+
{ id: "computer_use_task", name: "computer_use_task", category: "web", description: "Operar el navegador de Hive mirando la pantalla: clic por coordenadas, escribir y navegar cuando no hay selector estable. Sinónimos: usar el navegador, hacer clic, operar una página, rellenar formulario, computer use" },
|
|
57
58
|
{ id: "artifact_inspect", name: "artifact_inspect", category: "web", description: "Inspeccionar integridad y metadatos de un artefacto administrado sin modificarlo. Sinónimos: inspeccionar artefacto, verificar archivo generado, metadatos artefacto, comprobar entrega" },
|
|
58
59
|
{ id: "artifact_read", name: "artifact_read", category: "web", description: "Leer por partes el contenido de texto de un artefacto administrado, o buscar dentro de él. Sinónimos: leer artefacto, ver contenido del artefacto, abrir resultado grande, buscar dentro del artefacto, leer artifact_ref" },
|
|
59
60
|
{ id: "browser_click", name: "browser_click", category: "web", description: "Hacer clic en un elemento de la página web. Sinónimos: botón, enlace, interactuar, presionar, seleccionar" },
|
|
@@ -63,7 +64,7 @@ export const SEED_DATA: SeedData = {
|
|
|
63
64
|
{ id: "browser_wait", name: "browser_wait", category: "web", description: "Esperar a que aparezca un elemento o se cumpla una condición. Sinónimos: esperar, condición, elemento, selector, pausa" },
|
|
64
65
|
|
|
65
66
|
// ─────────────────────────────────────────
|
|
66
|
-
// 3. CRON — Tareas programadas
|
|
67
|
+
// 3. CRON — Tareas programadas
|
|
67
68
|
// ─────────────────────────────────────────
|
|
68
69
|
{ id: "cron.create", name: "cron.create", category: "cron", description: "Crear una automatización de Hive programada: recurrente (expresión cron) o ejecución futura única (fire_at). Requiere 'task'. Sinónimos: programar tarea, crear automatización, ejecutar después, tarea recurrente, una vez" },
|
|
69
70
|
{ id: "cron.list", name: "cron.list", category: "cron", description: "Listar todas las tareas programadas con próximos horarios de ejecución. Sinónimos: ver tareas programadas, listar cronograma, próximas ejecuciones" },
|
|
@@ -113,6 +114,7 @@ export const SEED_DATA: SeedData = {
|
|
|
113
114
|
{ id: "notify", name: "notify", category: "core", description: "Enviar notificación al usuario. Sinónimos: notificar, enviar notificación, alertar, aviso" },
|
|
114
115
|
{ id: "save_note", name: "save_note", category: "core", description: "Guardar nota persistente en el scratchpad. Sinónimos: guardar nota, escribir nota, recordatorio rápido, apuntar" },
|
|
115
116
|
{ id: "report_progress", name: "report_progress", category: "core", description: "Reportar progreso actual al usuario. Sinónimos: reportar progreso, informar estado, actualizar progreso, porcentaje" },
|
|
117
|
+
{ id: "conversation_read", name: "conversation_read", category: "core", description: "Recuperar mensajes anteriores de esta conversación por ID o búsqueda de texto. Sinónimos: leer conversación, recuperar contexto, historial omitido" },
|
|
116
118
|
|
|
117
119
|
// ─────────────────────────────────────────
|
|
118
120
|
// 10. OFFICE — Archivos Office (PDF, DOCX, XLSX, PPTX)
|
|
@@ -179,12 +181,26 @@ export const SEED_DATA: SeedData = {
|
|
|
179
181
|
// Solo la generación 3.x: la familia 2.0 ya está apagada y la 2.5 quedó
|
|
180
182
|
// superada. `gemini-3.5-pro` y `gemini-3.1-flash-lite-preview` se quitaron:
|
|
181
183
|
// el primero no existe en el catálogo y el segundo ya salió de preview.
|
|
184
|
+
// 3.8 Flash tiene precio de lanzamiento hasta el 31-dic-2026 ($0.75 / $3.75).
|
|
185
|
+
// Desde el 1-ene-2027 pasa a $1.50 / $7.50: actualizar aquí ese día o el
|
|
186
|
+
// dashboard subestimará el costo y el ahorro de Jev a la mitad.
|
|
187
|
+
// contextWindow: el que reporta la propia API de modelos de Gemini.
|
|
188
|
+
{ id: "gemini-3.8-flash", providerId: "gemini", name: "Gemini 3.8 Flash", modelType: "llm", contextWindow: 1050000, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0.75, outputPer1M: 3.75 },
|
|
182
189
|
{ id: "gemini-3.6-flash", providerId: "gemini", name: "Gemini 3.6 Flash", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 1.5, outputPer1M: 7.5 },
|
|
183
190
|
{ id: "gemini-3.5-flash", providerId: "gemini", name: "Gemini 3.5 Flash", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 1.5, outputPer1M: 9 },
|
|
184
191
|
{ id: "gemini-3.5-flash-lite", providerId: "gemini", name: "Gemini 3.5 Flash Lite", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming"]), inputPer1M: 0.3, outputPer1M: 2.5 },
|
|
185
192
|
{ id: "gemini-3.1-pro-preview", providerId: "gemini", name: "Gemini 3.1 Pro Preview", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 2, outputPer1M: 12 },
|
|
186
193
|
{ id: "gemini-3.1-flash-lite", providerId: "gemini", name: "Gemini 3.1 Flash Lite", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming"]), inputPer1M: 0.25, outputPer1M: 1.5 },
|
|
187
194
|
|
|
195
|
+
// Realtime (voz en tiempo real, `bidiGenerateContent`). Audio nativo bidireccional:
|
|
196
|
+
// no es un pipeline STT→LLM→TTS, el modelo oye y habla directo.
|
|
197
|
+
// Gemini 3.8 Live reemplaza a 3.1 Flash Live (preview, marcado "legacy" por
|
|
198
|
+
// Google) al mismo precio. Al salir 3.1 del catálogo ninguna fila queda
|
|
199
|
+
// activa y resolveRealtimeModel toma el default: la voz pasa sola a 3.8.
|
|
200
|
+
// Para volver atrás basta con restaurar la línea de 3.1.
|
|
201
|
+
{ id: "gemini-3.8-live", providerId: "gemini", name: "Gemini 3.8 Live", modelType: "realtime", contextWindow: 128000, capabilities: JSON.stringify(["realtime", "audio_in", "audio_out", "function_calling", "transcription"]), inputPer1M: 3, outputPer1M: 12 },
|
|
202
|
+
{ id: "gemini-2.5-flash-native-audio-latest", providerId: "gemini", name: "Gemini 2.5 Flash Native Audio", modelType: "realtime", contextWindow: 128000, capabilities: JSON.stringify(["realtime", "audio_in", "audio_out", "function_calling", "async_function_calling", "transcription"]), inputPer1M: 3, outputPer1M: 12 },
|
|
203
|
+
|
|
188
204
|
// TTS
|
|
189
205
|
{ id: "gemini-2.5-flash-preview-tts", providerId: "gemini", name: "Gemini 2.5 Flash TTS", modelType: "tts", contextWindow: 0, capabilities: JSON.stringify(["tts", "speech"]) },
|
|
190
206
|
{ id: "gemini-2.5-pro-preview-tts", providerId: "gemini", name: "Gemini 2.5 Pro TTS", modelType: "tts", contextWindow: 0, capabilities: JSON.stringify(["tts", "speech", "high_quality"]) },
|
|
@@ -213,6 +229,7 @@ export const SEED_DATA: SeedData = {
|
|
|
213
229
|
{ id: "kimi-k2.6", providerId: "kimi", name: "Kimi K2.6", modelType: "llm", contextWindow: 262144, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "code"]), inputPer1M: 0.6, outputPer1M: 3.41 },
|
|
214
230
|
|
|
215
231
|
// ── OpenRouter (fuente: GET https://openrouter.ai/api/v1/models) ──
|
|
232
|
+
{ id: "typesafe/jev-1.13", providerId: "openrouter", name: "Jev 1.13 (Decisions)", modelType: "decision", contextWindow: 32000, capabilities: JSON.stringify(["choice", "noul", "score"]), inputPer1M: 0.042, outputPer1M: 0 },
|
|
216
233
|
// Solo modelos vivos con `tools` en supported_parameters y publicados desde
|
|
217
234
|
// 2025-07. contextWindow = context_length reportado por el propio catálogo.
|
|
218
235
|
// Anthropic
|
|
@@ -237,7 +254,9 @@ export const SEED_DATA: SeedData = {
|
|
|
237
254
|
// Z.ai / GLM
|
|
238
255
|
{ id: "z-ai/glm-5.2", providerId: "openrouter", name: "GLM 5.2 (OR)", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "json_mode", "function_calling", "streaming", "code", "reasoning"]), inputPer1M: 0.63, outputPer1M: 1.98 },
|
|
239
256
|
// Qwen
|
|
240
|
-
|
|
257
|
+
// OpenRouter renombró qwen/qwen3.8-max a su versión fechada: mismo contexto
|
|
258
|
+
// y precio, ahora también con imagen. Verificado 2026-09-10.
|
|
259
|
+
{ id: "qwen/qwen3.8-max-0902", providerId: "openrouter", name: "Qwen3.8 Max (OR)", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 2, outputPer1M: 6 },
|
|
241
260
|
{ id: "qwen/qwen3.7-flash", providerId: "openrouter", name: "Qwen3.7 Flash (OR)", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "json_mode", "function_calling", "streaming"]), inputPer1M: 0.03, outputPer1M: 0.13 },
|
|
242
261
|
// xAI
|
|
243
262
|
{ id: "x-ai/grok-4.5", providerId: "openrouter", name: "Grok 4.5 (OR)", modelType: "llm", contextWindow: 500000, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 2, outputPer1M: 6 },
|
|
@@ -297,9 +316,17 @@ export const SEED_DATA: SeedData = {
|
|
|
297
316
|
// DeepSeek V4 Pro (deepseek-ai/deepseek-v4-pro) se sacó: devuelve 404
|
|
298
317
|
// "Function not found for account" en cuentas normales — no está habilitado
|
|
299
318
|
// de forma general aunque figure en el listado público de /v1/models.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
319
|
+
// GLM 5.2 (z-ai/glm-5.2) y MiniMax M3 (minimaxai/minimax-m3) se sacaron:
|
|
320
|
+
// NVIDIA los retiró, responden 410 Gone y ya no figuran en /v1/models.
|
|
321
|
+
// Kimi K2.6 (moonshotai/kimi-k2.6) se sacó por lo mismo que DeepSeek V4 Pro:
|
|
322
|
+
// 404 "Function not found for account" en dos cuentas distintas.
|
|
323
|
+
// Kimi K3, DeepSeek V4 Flash 0731 y Muse Glimmer entraron: publicados en
|
|
324
|
+
// julio/agosto con "Free Endpoint" en el catálogo de NGC, y responden con
|
|
325
|
+
// tool calling en una cuenta gratuita. Contexto según la referencia de la API
|
|
326
|
+
// de NVIDIA (Kimi K3) y OpenRouter (el resto). Verificado 2026-09-10.
|
|
327
|
+
{ id: "moonshotai/kimi-k3", providerId: "nvidia", name: "Kimi K3 (NVIDIA)", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "code", "vision", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
328
|
+
{ id: "deepseek-ai/deepseek-v4-flash-0731", providerId: "nvidia", name: "DeepSeek V4 Flash (NVIDIA)", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "code", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
329
|
+
{ id: "meta/muse-glimmer-30b", providerId: "nvidia", name: "Muse Glimmer 30B (NVIDIA)", modelType: "llm", contextWindow: 131072, capabilities: JSON.stringify(["chat", "vision", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
303
330
|
{ id: "nvidia/nemotron-3-ultra-550b-a55b", providerId: "nvidia", name: "Nemotron 3 Ultra 550B", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
304
331
|
{ id: "nvidia/nemotron-3-super-120b-a12b", providerId: "nvidia", name: "Nemotron 3 Super 120B", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
305
332
|
|
|
@@ -350,14 +377,26 @@ export const SEED_DATA: SeedData = {
|
|
|
350
377
|
{ id: "hy3-preview", providerId: "opencode-go", name: "Hunyuan 3 Preview", modelType: "llm", contextWindow: 128000, capabilities: JSON.stringify(["chat", "code", "function_calling", "streaming"]), inputPer1M: 0, outputPer1M: 0 },
|
|
351
378
|
|
|
352
379
|
// ── HiveAgents (llama.cpp local servido vía Cloudflare) ──
|
|
353
|
-
//
|
|
354
|
-
//
|
|
380
|
+
// Los tres GGUF instalados en /data/models al 2026-08-18. `GET /api/models`
|
|
381
|
+
// del backend es la fuente de verdad si el inventario cambia; ver API.md
|
|
382
|
+
// (carga e inferencia) y BENCHMARK.md (cifras medidas).
|
|
383
|
+
//
|
|
384
|
+
// Sólo se puede tener UN modelo montado a la vez: seleccionar otro descarga
|
|
385
|
+
// el anterior para todos los clientes (ver CAPACITY.md).
|
|
355
386
|
//
|
|
356
387
|
// El id ES el nombre del archivo .gguf que sirve llama.cpp, así que cambia
|
|
357
388
|
// con cada bump del modelo. Al renombrarlo, el re-seed borra la fila vieja y
|
|
358
389
|
// crea la nueva desactivada, y desvincula a los agentes que apuntaban a la
|
|
359
390
|
// anterior: hay que volver a elegir el modelo en la UI una vez.
|
|
391
|
+
//
|
|
392
|
+
// context_window es el ctx que se pide en POST /api/load, no un tope del
|
|
393
|
+
// modelo: DeepSeek va a 32K porque sus 90.9 GB de pesos dejan poco margen
|
|
394
|
+
// de memoria para el KV cache.
|
|
360
395
|
{ id: "Qwen3.6-35B-A3B-UD-Q4_K_M.gguf", providerId: "hiveagents", name: "Qwen3.6 35B MoE (Recomendado)", modelType: "llm", contextWindow: 50000, capabilities: JSON.stringify(["chat", "streaming", "reasoning", "function_calling"]), inputPer1M: 0, outputPer1M: 0 },
|
|
396
|
+
{ id: "Qwen3.8-27B-UD-Q4_K_XL.gguf", providerId: "hiveagents", name: "Qwen3.8 27B Dense + MTP", modelType: "llm", contextWindow: 50000, capabilities: JSON.stringify(["chat", "streaming", "reasoning", "function_calling"]), inputPer1M: 0, outputPer1M: 0 },
|
|
397
|
+
// Se carga por el primer shard: llama.cpp descubre los otros dos solo.
|
|
398
|
+
// Sólo texto, y el más lento del inventario: ~91 s de carga y 12.8 t/s.
|
|
399
|
+
{ id: "DeepSeek-V4-Flash-UD-IQ2_XXS-00001-of-00003.gguf", providerId: "hiveagents", name: "DeepSeek V4 Flash 90 GB (lento)", modelType: "llm", contextWindow: 32768, capabilities: JSON.stringify(["chat", "streaming", "reasoning", "function_calling"]), inputPer1M: 0, outputPer1M: 0 },
|
|
361
400
|
],
|
|
362
401
|
|
|
363
402
|
|
|
@@ -569,6 +608,38 @@ function migrateLegacyCatalogPersona(existing: AgentDoc, current: AgentDoc): Age
|
|
|
569
608
|
};
|
|
570
609
|
}
|
|
571
610
|
|
|
611
|
+
// Stock catalog prompts used Rioplatense voseo up to 1.0.5. Only the words that
|
|
612
|
+
// appeared in those prompts; the migration below validates every rewrite.
|
|
613
|
+
const VOSEO_TO_NEUTRAL: Record<string, string> = {
|
|
614
|
+
pedís: "pides", ampliás: "amplías", usás: "usas", declarás: "declaras", hablás: "hablas",
|
|
615
|
+
inventás: "inventas", exponés: "expones", automatizás: "automatizas", realizás: "realizas",
|
|
616
|
+
confirmás: "confirmas", ejecutás: "ejecutas", modificás: "modificas", sobrescribís: "sobrescribes",
|
|
617
|
+
publicás: "publicas", editás: "editas", interpretás: "interpretas", conversás: "conversas",
|
|
618
|
+
creás: "creas", consultás: "consultas", repetís: "repites", cambiás: "cambias",
|
|
619
|
+
Devolvé: "Devuelve", Convertí: "Convierte", Contrastá: "Contrasta", Inspeccioná: "Inspecciona",
|
|
620
|
+
Aplicá: "Aplica", Volvé: "Vuelve", Determiná: "Determina", modificá: "modifica",
|
|
621
|
+
Generá: "Genera", extraé: "extrae", Diseñá: "Diseña", Enviá: "Envía", liberá: "libera",
|
|
622
|
+
Normalizá: "Normaliza", Consultá: "Consulta", Validá: "Valida",
|
|
623
|
+
};
|
|
624
|
+
const VOSEO_PATTERN = new RegExp(`(?<!\\p{L})(${Object.keys(VOSEO_TO_NEUTRAL).join("|")})(?!\\p{L})`, "gu");
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Rewrites a stored catalog prompt line only when dropping the voseo turns it
|
|
628
|
+
* into a line of the current stock prompt, so user-written lines stay as they are.
|
|
629
|
+
*/
|
|
630
|
+
function migrateVoseoCatalogPrompt(existing: AgentDoc, current: AgentDoc): AgentDoc {
|
|
631
|
+
const stockLines = new Set(current.system_prompt.split("\n"));
|
|
632
|
+
const systemPrompt = existing.system_prompt
|
|
633
|
+
.split("\n")
|
|
634
|
+
.map((line) => {
|
|
635
|
+
if (stockLines.has(line)) return line;
|
|
636
|
+
const neutral = line.replace(VOSEO_PATTERN, (word) => VOSEO_TO_NEUTRAL[word]!);
|
|
637
|
+
return stockLines.has(neutral) ? neutral : line;
|
|
638
|
+
})
|
|
639
|
+
.join("\n");
|
|
640
|
+
return systemPrompt === existing.system_prompt ? existing : { ...existing, system_prompt: systemPrompt };
|
|
641
|
+
}
|
|
642
|
+
|
|
572
643
|
async function pruneRetired(): Promise<void> {
|
|
573
644
|
const toolsCol = await col<ToolDoc>("tools");
|
|
574
645
|
let removed = 0;
|
|
@@ -820,7 +891,10 @@ export async function seedAllData(): Promise<void> {
|
|
|
820
891
|
continue;
|
|
821
892
|
}
|
|
822
893
|
|
|
823
|
-
let reconciled =
|
|
894
|
+
let reconciled = migrateVoseoCatalogPrompt(
|
|
895
|
+
migrateLegacyCatalogPersona(existing.doc, catalogAgent),
|
|
896
|
+
catalogAgent,
|
|
897
|
+
);
|
|
824
898
|
// Older releases could mark permanent catalog capabilities as archived.
|
|
825
899
|
// Archiving is no longer automatic, and catalog rows are never valid
|
|
826
900
|
// archive targets, so repair only that stale status on every boot while
|
|
@@ -57,7 +57,7 @@ export async function calculateCost(
|
|
|
57
57
|
const key = `${provider}/${model}`;
|
|
58
58
|
if (!unpricedModels.has(key)) {
|
|
59
59
|
unpricedModels.add(key);
|
|
60
|
-
log.warn(`[usage] Sin tarifa para ${key} — su costo se contará como $0.
|
|
60
|
+
log.warn(`[usage] Sin tarifa para ${key} — su costo se contará como $0. Agrega inputPer1M/outputPer1M en SEED_DATA.models (storage/seed.ts).`);
|
|
61
61
|
}
|
|
62
62
|
return 0;
|
|
63
63
|
}
|
|
@@ -154,6 +154,15 @@ export interface UsageRecord {
|
|
|
154
154
|
created_at: number;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
export interface JevUsageSummary {
|
|
158
|
+
decisions: number;
|
|
159
|
+
costUsd: number;
|
|
160
|
+
/** Estimated main-model input tokens avoided; negative when Jev added more than it removed. */
|
|
161
|
+
savedTokens: number;
|
|
162
|
+
savedCostUsd: number;
|
|
163
|
+
byAgent: Record<string, { decisions: number; costUsd: number; savedTokens: number; savedCostUsd: number }>;
|
|
164
|
+
}
|
|
165
|
+
|
|
157
166
|
export interface UsageSummary {
|
|
158
167
|
totalTokens: number;
|
|
159
168
|
totalInputTokens: number;
|
|
@@ -168,6 +177,7 @@ export interface UsageSummary {
|
|
|
168
177
|
toonSavingsPercent: number;
|
|
169
178
|
byProvider: Record<string, { tokens: number; costUsd: number; inputTokens: number; outputTokens: number }>;
|
|
170
179
|
byModel: Record<string, { tokens: number; costUsd: number; provider: string; inputTokens: number; outputTokens: number }>;
|
|
180
|
+
jev: JevUsageSummary;
|
|
171
181
|
recentRecords: UsageRecord[];
|
|
172
182
|
}
|
|
173
183
|
|
|
@@ -240,6 +250,7 @@ export async function getUsageStats(hours: number = 24): Promise<UsageSummary> {
|
|
|
240
250
|
let totalInput = 0, totalOutput = 0, totalCost = 0;
|
|
241
251
|
let toonSavedTokens = 0, toonSavedCost = 0, toonSavedBytes = 0;
|
|
242
252
|
let toonJsonTokens = 0, toonToonTokens = 0, toonJsonBytes = 0;
|
|
253
|
+
const jev: JevUsageSummary = { decisions: 0, costUsd: 0, savedTokens: 0, savedCostUsd: 0, byAgent: {} };
|
|
243
254
|
|
|
244
255
|
for (const r of rollups) {
|
|
245
256
|
totalInput += r.inputTokens;
|
|
@@ -251,6 +262,18 @@ export async function getUsageStats(hours: number = 24): Promise<UsageSummary> {
|
|
|
251
262
|
toonJsonTokens += r.toonJsonTokens;
|
|
252
263
|
toonToonTokens += r.toonToonTokens;
|
|
253
264
|
toonJsonBytes += r.toonJsonBytes;
|
|
265
|
+
jev.decisions += r.jevDecisions ?? 0;
|
|
266
|
+
jev.costUsd += r.jevCostUsd ?? 0;
|
|
267
|
+
jev.savedTokens += r.jevSavedTokens ?? 0;
|
|
268
|
+
jev.savedCostUsd += r.jevSavedCostUsd ?? 0;
|
|
269
|
+
for (const [agentId, a] of Object.entries(r.jevByAgent ?? {})) {
|
|
270
|
+
const cur = jev.byAgent[agentId] ?? { decisions: 0, costUsd: 0, savedTokens: 0, savedCostUsd: 0 };
|
|
271
|
+
cur.decisions += a.jevDecisions ?? 0;
|
|
272
|
+
cur.costUsd += a.jevCostUsd ?? 0;
|
|
273
|
+
cur.savedTokens += a.jevSavedTokens ?? 0;
|
|
274
|
+
cur.savedCostUsd += a.jevSavedCostUsd ?? 0;
|
|
275
|
+
jev.byAgent[agentId] = cur;
|
|
276
|
+
}
|
|
254
277
|
|
|
255
278
|
for (const [provider, p] of Object.entries(r.byProvider ?? {})) {
|
|
256
279
|
const cur = providerMap[provider] ?? { tokens: 0, costUsd: 0, inputTokens: 0, outputTokens: 0 };
|
|
@@ -301,10 +324,39 @@ export async function getUsageStats(hours: number = 24): Promise<UsageSummary> {
|
|
|
301
324
|
toonSavingsPercent,
|
|
302
325
|
byProvider: providerMap,
|
|
303
326
|
byModel: modelMap,
|
|
327
|
+
jev,
|
|
304
328
|
recentRecords
|
|
305
329
|
};
|
|
306
330
|
}
|
|
307
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Persists one Jev decision into the hourly rollup. The avoided tokens are
|
|
334
|
+
* priced with the advised agent's own model (input rate), through the same
|
|
335
|
+
* catalog lookup as real usage, so "saved" and "spent" are comparable.
|
|
336
|
+
*/
|
|
337
|
+
export function recordJevDecision(options: {
|
|
338
|
+
agentId: string;
|
|
339
|
+
provider: string;
|
|
340
|
+
model: string;
|
|
341
|
+
savedTokens: number;
|
|
342
|
+
costUsd: number;
|
|
343
|
+
}): void {
|
|
344
|
+
Promise.resolve().then(async () => {
|
|
345
|
+
try {
|
|
346
|
+
const unitCost = await calculateCost(options.provider, options.model, Math.abs(options.savedTokens), 0);
|
|
347
|
+
const savedCostUsd = Math.sign(options.savedTokens) * unitCost;
|
|
348
|
+
await bumpRollup("usageRollups", hourBucket(Date.now()), {
|
|
349
|
+
jevDecisions: 1,
|
|
350
|
+
jevCostUsd: options.costUsd,
|
|
351
|
+
jevSavedTokens: options.savedTokens,
|
|
352
|
+
jevSavedCostUsd: savedCostUsd,
|
|
353
|
+
}, { field: "jevByAgent", key: options.agentId });
|
|
354
|
+
} catch (error) {
|
|
355
|
+
log.warn(`[JEV] Failed to record decision:`, error);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
308
360
|
/**
|
|
309
361
|
* Record TOON savings for metrics tracking
|
|
310
362
|
* This updates the usage_records table with complete TOON compression metrics
|
|
@@ -46,6 +46,8 @@ export type ExecuteToolBatchOptions = {
|
|
|
46
46
|
}
|
|
47
47
|
hiveConfig?: Config
|
|
48
48
|
workerPool?: ToolRuntimeConfig
|
|
49
|
+
/** Per-batch decision. Undefined preserves the configured legacy behavior. */
|
|
50
|
+
parallelToolCalls?: boolean
|
|
49
51
|
mainThreadToolNames?: string[]
|
|
50
52
|
signal?: AbortSignal
|
|
51
53
|
}
|
|
@@ -198,6 +200,7 @@ const DEFAULT_MAIN_THREAD_TOOL_NAMES = new Set([
|
|
|
198
200
|
// These tools depend on process-local singleton state (HiveDB handle, live
|
|
199
201
|
// channel senders, schedulers, browser sessions, or in-memory services).
|
|
200
202
|
"search_knowledge",
|
|
203
|
+
"conversation_read",
|
|
201
204
|
"save_note",
|
|
202
205
|
"memory_write",
|
|
203
206
|
"memory_read",
|
|
@@ -597,6 +600,7 @@ function getPool(maxWorkers: number): ToolWorkerPool | null {
|
|
|
597
600
|
|
|
598
601
|
export async function executeToolBatch(options: ExecuteToolBatchOptions): Promise<ToolBatchResult[]> {
|
|
599
602
|
const runtimeConfig = resolveRuntimeConfig(options.workerPool)
|
|
603
|
+
const parallelToolCalls = options.parallelToolCalls ?? runtimeConfig.parallelToolCalls
|
|
600
604
|
const hiveConfig = options.hiveConfig ?? loadConfig()
|
|
601
605
|
const mainThreadToolNames = [
|
|
602
606
|
...DEFAULT_MAIN_THREAD_TOOL_NAMES,
|
|
@@ -617,11 +621,25 @@ export async function executeToolBatch(options: ExecuteToolBatchOptions): Promis
|
|
|
617
621
|
|
|
618
622
|
// A null pool means workers are disabled, unnecessary (single call), or
|
|
619
623
|
// unavailable in this build — all three degrade to the main thread.
|
|
620
|
-
const pool = runtimeConfig.enabled &&
|
|
624
|
+
const pool = runtimeConfig.enabled && parallelToolCalls && options.toolCalls.length > 1
|
|
621
625
|
? getPool(runtimeConfig.maxWorkers)
|
|
622
626
|
: null
|
|
623
627
|
|
|
624
628
|
if (!pool) {
|
|
629
|
+
if (options.parallelToolCalls === true && options.toolCalls.length > 1) {
|
|
630
|
+
return Promise.all(options.toolCalls.map(async (toolCall) => {
|
|
631
|
+
const startedAt = performance.now()
|
|
632
|
+
const effectiveTimeout = resolveToolTimeout(toolCall.function.name, options.allTools, hiveConfig, runtimeConfig.toolTimeoutMs)
|
|
633
|
+
const result = await executeInMainThreadWithTimeout({
|
|
634
|
+
toolCall, allTools: options.allTools, toolConfig: options.toolConfig, signal: options.signal,
|
|
635
|
+
}, effectiveTimeout)
|
|
636
|
+
return {
|
|
637
|
+
toolCall, toolName: toolCall.function.name, result,
|
|
638
|
+
ok: !(result && typeof result === "object" && (result as any).error === true),
|
|
639
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
640
|
+
}
|
|
641
|
+
}))
|
|
642
|
+
}
|
|
625
643
|
const results: ToolBatchResult[] = []
|
|
626
644
|
for (const toolCall of options.toolCalls) {
|
|
627
645
|
const startedAt = performance.now()
|
|
@@ -1,8 +1,62 @@
|
|
|
1
1
|
import type { Tool } from "../types.ts";
|
|
2
2
|
import type { Config } from "../../config/loader.ts";
|
|
3
|
-
import { canvasManager } from "../../canvas/canvas-manager.ts";
|
|
3
|
+
import { canvasManager, mergeComponentsById } from "../../canvas/canvas-manager.ts";
|
|
4
4
|
import { logger } from "../../utils/logger.ts";
|
|
5
5
|
|
|
6
|
+
/** Ids a component renders, in both the flat and the nested (`{ Card: {...} }`) forms. */
|
|
7
|
+
function childIds(component: Record<string, unknown>): string[] {
|
|
8
|
+
const nested = component.component && typeof component.component === "object" && !Array.isArray(component.component)
|
|
9
|
+
? Object.values(component.component as Record<string, unknown>)[0]
|
|
10
|
+
: undefined
|
|
11
|
+
const c = nested && typeof nested === "object" ? { ...component, ...(nested as Record<string, unknown>) } : component
|
|
12
|
+
const ids: unknown[] = []
|
|
13
|
+
const children = c.children
|
|
14
|
+
if (typeof children === "string") ids.push(children)
|
|
15
|
+
else if (Array.isArray(children)) ids.push(...children)
|
|
16
|
+
else if (children && typeof children === "object") {
|
|
17
|
+
const ch = children as Record<string, unknown>
|
|
18
|
+
if (Array.isArray(ch.explicitList)) ids.push(...ch.explicitList)
|
|
19
|
+
if (Array.isArray(ch.array)) ids.push(...ch.array)
|
|
20
|
+
ids.push(ch.componentId, (ch.template as Record<string, unknown> | undefined)?.componentId)
|
|
21
|
+
}
|
|
22
|
+
ids.push(c.child, c.trigger, c.content, c.entryPointChild, c.contentChild)
|
|
23
|
+
for (const tab of [...(Array.isArray(c.tabItems) ? c.tabItems : []), ...(Array.isArray(c.tabs) ? c.tabs : [])]) {
|
|
24
|
+
ids.push((tab as Record<string, unknown> | null)?.child)
|
|
25
|
+
}
|
|
26
|
+
return ids.filter((id): id is string => typeof id === "string" && id.length > 0)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* First cycle in the component tree ("card -> card"), or null. A component
|
|
31
|
+
* that contains itself or an ancestor made the panel recurse until the
|
|
32
|
+
* browser killed the tab.
|
|
33
|
+
*/
|
|
34
|
+
export function findComponentCycle(components: unknown[]): string[] | null {
|
|
35
|
+
const graph = new Map<string, string[]>()
|
|
36
|
+
for (const c of components) {
|
|
37
|
+
if (c && typeof c === "object" && typeof (c as { id?: unknown }).id === "string") {
|
|
38
|
+
graph.set((c as { id: string }).id, childIds(c as Record<string, unknown>))
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const done = new Set<string>()
|
|
42
|
+
const visit = (id: string, path: string[]): string[] | null => {
|
|
43
|
+
const loop = path.indexOf(id)
|
|
44
|
+
if (loop >= 0) return [...path.slice(loop), id]
|
|
45
|
+
if (done.has(id) || !graph.has(id)) return null
|
|
46
|
+
for (const child of graph.get(id)!) {
|
|
47
|
+
const cycle = visit(child, [...path, id])
|
|
48
|
+
if (cycle) return cycle
|
|
49
|
+
}
|
|
50
|
+
done.add(id)
|
|
51
|
+
return null
|
|
52
|
+
}
|
|
53
|
+
for (const id of graph.keys()) {
|
|
54
|
+
const cycle = visit(id, [])
|
|
55
|
+
if (cycle) return cycle
|
|
56
|
+
}
|
|
57
|
+
return null
|
|
58
|
+
}
|
|
59
|
+
|
|
6
60
|
export function createA2UISurfaceTool(_config: Config): Tool {
|
|
7
61
|
const log = logger.child("a2ui-surface");
|
|
8
62
|
|
|
@@ -148,6 +202,16 @@ Root component: usar id="root" explícito.`,
|
|
|
148
202
|
? (rawSessionId.startsWith("canvas:") ? rawSessionId : `canvas:${rawSessionId}`)
|
|
149
203
|
: (userId ? `canvas:${userId}` : (() => { throw new Error("No session or user ID provided"); })());
|
|
150
204
|
|
|
205
|
+
if (!Array.isArray(params.components)) throw new Error("components must be an array")
|
|
206
|
+
// Checked on the merged tree the client will render, not only this batch.
|
|
207
|
+
const cycle = findComponentCycle(mergeComponentsById(
|
|
208
|
+
canvasManager.getCachedComponents(sessionId, params.surfaceId as string),
|
|
209
|
+
params.components,
|
|
210
|
+
))
|
|
211
|
+
if (cycle) {
|
|
212
|
+
throw new Error(`Ciclo en los componentes: ${cycle.join(" -> ")}. Un componente no puede contenerse a sí mismo ni a un ancestro. Dale al hijo un id propio (por ejemplo "${cycle[0]}_contenido") y vuelve a enviar. No se publicó nada.`)
|
|
213
|
+
}
|
|
214
|
+
|
|
151
215
|
await canvasManager.sendA2UIMessage(sessionId, "a2ui:updateComponents", {
|
|
152
216
|
surfaceId: params.surfaceId as string,
|
|
153
217
|
components: params.components,
|
|
@@ -60,7 +60,9 @@ export const getAvailableModelsTool: Tool = {
|
|
|
60
60
|
.filter(m => m.enabled && providersById.has(m.provider_id));
|
|
61
61
|
|
|
62
62
|
if (providerId) models = models.filter(m => m.provider_id === providerId);
|
|
63
|
-
|
|
63
|
+
// Decision models (Jev) only answer the Decisions API, never chat: an
|
|
64
|
+
// agent assigned one would fail every turn.
|
|
65
|
+
models = modelType ? models.filter(m => m.model_type === modelType) : models.filter(m => m.model_type !== "decision");
|
|
64
66
|
if (capabilities) models = models.filter(m => (m.capabilities ?? "").includes(capabilities));
|
|
65
67
|
|
|
66
68
|
// Transformar a formato amigable
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type CapabilityType,
|
|
15
15
|
} from "../../agent/capability-search.ts";
|
|
16
16
|
import { CORE_TOOL_CATALOG } from "../../agent/tool-selector.ts";
|
|
17
|
-
import { saveScratchpadNote } from "../../agent/conversation-store.ts";
|
|
17
|
+
import { saveScratchpadNote, getRecentMessages, getScratchpad } from "../../agent/conversation-store.ts";
|
|
18
18
|
|
|
19
19
|
const log = logger.child("core");
|
|
20
20
|
|
|
@@ -353,7 +353,9 @@ export const notifyTool: Tool = {
|
|
|
353
353
|
|
|
354
354
|
log.info(`[notify] Sending to ${channel}/${userId}: ${message.substring(0, 80)}`);
|
|
355
355
|
|
|
356
|
-
const
|
|
356
|
+
const threadId = config?.configurable?.thread_id as string | undefined;
|
|
357
|
+
|
|
358
|
+
const result = await sendToUserChannel(channel, userId, message, { threadId })
|
|
357
359
|
if (!result.ok) throw new Error(`Channel send failed: ${result.error}`)
|
|
358
360
|
return result
|
|
359
361
|
},
|
|
@@ -448,13 +450,46 @@ export const reportProgressTool: Tool = {
|
|
|
448
450
|
|
|
449
451
|
// Send real-time update to the user's channel
|
|
450
452
|
const progressEmoji = progress >= 100 ? "✅" : progress >= 50 ? "⚙️" : "🔄";
|
|
451
|
-
const result = await sendToUserChannel(channel, userId, `${progressEmoji} ${progress}% — ${message}
|
|
453
|
+
const result = await sendToUserChannel(channel, userId, `${progressEmoji} ${progress}% — ${message}`, {
|
|
454
|
+
threadId: config?.configurable?.thread_id as string | undefined,
|
|
455
|
+
})
|
|
452
456
|
if (!result.ok) throw new Error(`Channel send failed: ${result.error}`)
|
|
453
457
|
|
|
454
458
|
return { ok: true, progress, message, task_id: taskId };
|
|
455
459
|
},
|
|
456
460
|
};
|
|
457
461
|
|
|
462
|
+
/** Recover a small, scoped slice of conversation omitted by Jev's context plan. */
|
|
463
|
+
export const conversationReadTool: Tool = {
|
|
464
|
+
name: "conversation_read",
|
|
465
|
+
description: "Read earlier messages from the current conversation by message IDs or text query when selected context is insufficient.",
|
|
466
|
+
parameters: {
|
|
467
|
+
type: "object",
|
|
468
|
+
properties: {
|
|
469
|
+
message_ids: { type: "array", description: "Message IDs shown in the context plan", items: { type: "number" } },
|
|
470
|
+
note_keys: { type: "array", description: "Scratchpad note keys shown in the context plan", items: { type: "string" } },
|
|
471
|
+
query: { type: "string", description: "Optional case-insensitive text to search in earlier messages" },
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
execute: async (params, config) => {
|
|
475
|
+
const threadId = config?.configurable?.thread_id as string | undefined
|
|
476
|
+
if (!threadId) return { ok: false, error: "Conversation scope unavailable" }
|
|
477
|
+
const ids = new Set(Array.isArray(params.message_ids) ? params.message_ids.map(Number).filter(Number.isFinite) : [])
|
|
478
|
+
const noteKeys = new Set(Array.isArray(params.note_keys) ? params.note_keys.map(String) : [])
|
|
479
|
+
const query = String(params.query ?? "").trim().toLocaleLowerCase()
|
|
480
|
+
if (!ids.size && !noteKeys.size && !query) return { ok: false, error: "Provide message_ids, note_keys or query" }
|
|
481
|
+
const rows = await getRecentMessages(threadId, 200)
|
|
482
|
+
const notes = await getScratchpad(threadId)
|
|
483
|
+
return {
|
|
484
|
+
ok: true,
|
|
485
|
+
messages: rows.filter(row => (ids.size && ids.has(row.id)) || (query && row.content.toLocaleLowerCase().includes(query)))
|
|
486
|
+
.slice(-8).map(row => ({ id: row.id, role: row.role, source: row.source, content: row.content.slice(0, 2000) })),
|
|
487
|
+
notes: notes.filter(note => noteKeys.has(note.key) || (query && `${note.key} ${note.value}`.toLocaleLowerCase().includes(query)))
|
|
488
|
+
.slice(0, 8).map(note => ({ key: note.key, value: note.value.slice(0, 2000) })),
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
};
|
|
492
|
+
|
|
458
493
|
export function createTools(): Tool[] {
|
|
459
|
-
return [searchKnowledgeTool, notifyTool, saveNoteTool, reportProgressTool];
|
|
494
|
+
return [searchKnowledgeTool, notifyTool, saveNoteTool, reportProgressTool, conversationReadTool];
|
|
460
495
|
}
|
|
@@ -12,7 +12,7 @@ import type { Tool } from "../types";
|
|
|
12
12
|
import { col, toIndexable } from "../../storage/hive";
|
|
13
13
|
import type { UserDoc, UserIdentityDoc, ChannelDoc, CronJobDoc, TaskRunDoc } from "../../storage/collections";
|
|
14
14
|
import { logger } from "../../utils/logger";
|
|
15
|
-
import { Cron } from "
|
|
15
|
+
import { Cron } from "../../scheduler/cron";
|
|
16
16
|
|
|
17
17
|
const log = logger.child("CronTools");
|
|
18
18
|
|
|
@@ -114,9 +114,9 @@ export const cronCreateTool: Tool = {
|
|
|
114
114
|
tool_name: { type: "string", description: "Specific tool to execute (optional)" },
|
|
115
115
|
max_runs: { type: "number", description: "Maximum executions (optional, null = unlimited)" },
|
|
116
116
|
channel: { type: "string", description: "Notification channel (system, telegram, discord, whatsapp, cli)" },
|
|
117
|
-
start_at: { type: "string", description: "ISO 8601 datetime: start of execution window
|
|
118
|
-
stop_at: { type: "string", description: "ISO 8601 datetime: end of execution window
|
|
119
|
-
dom_and_dow: { type: "boolean", description: "If true, both day-of-month AND day-of-week must match
|
|
117
|
+
start_at: { type: "string", description: "ISO 8601 datetime: start of execution window. Optional." },
|
|
118
|
+
stop_at: { type: "string", description: "ISO 8601 datetime: end of execution window. Optional." },
|
|
119
|
+
dom_and_dow: { type: "boolean", description: "If true, both day-of-month AND day-of-week must match. Default: false (OR logic)" },
|
|
120
120
|
},
|
|
121
121
|
required: ["name", "task", "task_type"],
|
|
122
122
|
},
|
|
@@ -14,7 +14,7 @@ import * as filesystem from "./filesystem/index.ts";
|
|
|
14
14
|
// Web (11)
|
|
15
15
|
import * as web from "./web/index.ts";
|
|
16
16
|
|
|
17
|
-
// Cron (8) -
|
|
17
|
+
// Cron (8) - scheduler tools
|
|
18
18
|
import * as cron from "./cron/index.ts";
|
|
19
19
|
|
|
20
20
|
// CLI (1)
|
|
@@ -118,6 +118,7 @@ export {
|
|
|
118
118
|
webFetchTool,
|
|
119
119
|
browserNavigateTool,
|
|
120
120
|
browserScreenshotTool,
|
|
121
|
+
computerUseTaskTool,
|
|
121
122
|
browserClickTool,
|
|
122
123
|
browserTypeTool,
|
|
123
124
|
browserExtractTool,
|
|
@@ -10,6 +10,7 @@ import type { Tool } from "../types.ts";
|
|
|
10
10
|
import { logger } from "../../utils/logger.ts";
|
|
11
11
|
import * as path from "node:path";
|
|
12
12
|
import * as fs from "node:fs";
|
|
13
|
+
import { cargarXlsx } from "./xlsx-loader";
|
|
13
14
|
|
|
14
15
|
const log = logger.child("office-escribir-xlsx");
|
|
15
16
|
|
|
@@ -55,7 +56,7 @@ export const officeEscribirXlsxTool: Tool = {
|
|
|
55
56
|
log.debug(`Generando XLSX: ${ruta}`);
|
|
56
57
|
|
|
57
58
|
try {
|
|
58
|
-
const XLSX = await
|
|
59
|
+
const XLSX = await cargarXlsx();
|
|
59
60
|
|
|
60
61
|
const workbook = XLSX.utils.book_new();
|
|
61
62
|
|
|
@@ -10,6 +10,7 @@ import type { Tool } from "../types.ts";
|
|
|
10
10
|
import { logger } from "../../utils/logger.ts";
|
|
11
11
|
import * as fs from "node:fs";
|
|
12
12
|
import * as path from "node:path";
|
|
13
|
+
import { cargarXlsx } from "./xlsx-loader";
|
|
13
14
|
|
|
14
15
|
const log = logger.child("office-leer-xlsx");
|
|
15
16
|
|
|
@@ -55,7 +56,7 @@ export const officeLeerXlsxTool: Tool = {
|
|
|
55
56
|
return { ok: false, error: `Archivo no encontrado: ${rutaAbsoluta}` };
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
const XLSX = await
|
|
59
|
+
const XLSX = await cargarXlsx();
|
|
59
60
|
const buffer = fs.readFileSync(rutaAbsoluta);
|
|
60
61
|
const workbook = XLSX.read(buffer, { type: "buffer" });
|
|
61
62
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carga el lector de hojas de cálculo, o explica por qué no puede.
|
|
3
|
+
*
|
|
4
|
+
* `xlsx` se importa en caliente para no pagarlo en cada arranque, y eso deja el
|
|
5
|
+
* fallo a merced del momento: si la dependencia no llegó a instalarse —su
|
|
6
|
+
* tarball se cayó una vez en mitad de un release— el usuario recibía un
|
|
7
|
+
* "Cannot find module" crudo en medio de una respuesta.
|
|
8
|
+
*/
|
|
9
|
+
export async function cargarXlsx(): Promise<typeof import("xlsx")> {
|
|
10
|
+
try {
|
|
11
|
+
return await import("xlsx");
|
|
12
|
+
} catch (error) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"El soporte de hojas de cálculo no está disponible en esta instalación: " +
|
|
15
|
+
`falta la dependencia «xlsx» (${(error as Error).message}). ` +
|
|
16
|
+
"Reinstala las dependencias con `bun install` para recuperarlo.",
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|