@johpaz/hive-agents 0.0.47 → 1.0.1
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/LICENSE +21 -0
- package/README.md +128 -897
- package/dist/hive.js +222237 -206295
- package/dist/tool-worker.js +226 -927
- package/dist/ui/assets/A2UIPage-D4nzp5NV.js +8 -0
- package/dist/ui/assets/AgentCreateForm-M2RhjeA1.js +1 -0
- package/dist/ui/assets/AgentDetailPage-DkFRtj8g.js +1 -0
- package/dist/ui/assets/AgentNewPage-CfBU7puz.js +1 -0
- package/dist/ui/assets/AgentsPage-Ctzq2LWx.js +10 -0
- package/dist/ui/assets/ApiClientPage-DKbGO1QW.js +3 -0
- package/dist/ui/assets/ChannelsPage-H6rgr8DQ.js +8 -0
- package/dist/ui/assets/DashboardPage-BIjYGf4m.js +6 -0
- package/dist/ui/assets/{LoginPage-BTxJdFVG.js → LoginPage-DazoxtBJ.js} +1 -1
- package/dist/ui/assets/{LogsPage-DVV2eHbh.js → LogsPage-DMZ6KtQ3.js} +1 -1
- package/dist/ui/assets/MeetingPage-CSLFvHL7.js +1 -0
- package/dist/ui/assets/ModelSelector-BCfvugHB.js +1 -0
- package/dist/ui/assets/{NotFound-BIUDlIXU.js → NotFound-Bpr12V51.js} +1 -1
- package/dist/ui/assets/Office3DPage-BE6Epe0d.js +4614 -0
- package/dist/ui/assets/Office3DPage-C3SIzd2H.css +1 -0
- package/dist/ui/assets/ProvidersPage-D0cApfM1.js +1 -0
- package/dist/ui/assets/{RecoverPage-7YDQysBL.js → RecoverPage-BVUPHG9z.js} +1 -1
- package/dist/ui/assets/SettingsPage-DCZ4nql4.js +9 -0
- package/dist/ui/assets/SetupPage-In19p30M.js +1 -0
- package/dist/ui/assets/WebChatPage-ByVBSzxL.js +29 -0
- package/dist/ui/assets/{activity-c3pNngT_.js → activity-BIIli7ET.js} +1 -1
- package/dist/ui/assets/agentCapabilities-D1PD9yFH.js +1 -0
- package/dist/ui/assets/alert-CQlRq6sv.js +1 -0
- package/dist/ui/assets/arrow-left-BfcnX8Er.js +1 -0
- package/dist/ui/assets/arrow-right-Q-dzAn8k.js +1 -0
- package/dist/ui/assets/arrow-up-right-Bf-8wrUQ.js +1 -0
- package/dist/ui/assets/badge-DKGZbVZJ.js +1 -0
- package/dist/ui/assets/{calendar-B-KZ9RQO.js → calendar-S9-_Q6QR.js} +1 -1
- package/dist/ui/assets/{card-CNf6BS2e.js → card-D3Nw3kh3.js} +1 -1
- package/dist/ui/assets/check-CryV78SQ.js +1 -0
- package/dist/ui/assets/chevron-down-QCtMs-Af.js +1 -0
- package/dist/ui/assets/chevron-left-dTGbyl5G.js +1 -0
- package/dist/ui/assets/chevron-right-D0GjXbnO.js +1 -0
- package/dist/ui/assets/chevron-up-Cg0jO8uT.js +1 -0
- package/dist/ui/assets/{circle-alert-KuAm2FWh.js → circle-alert-DTVW4R94.js} +1 -1
- package/dist/ui/assets/circle-check-BAolxswA.js +1 -0
- package/dist/ui/assets/{circle-x-DjLkFDO8.js → circle-x-CJXbXzRh.js} +1 -1
- package/dist/ui/assets/{copy-Bu5d7C-0.js → copy-X_TPpA-A.js} +1 -1
- package/dist/ui/assets/{dialog-Jk4bieO4.js → dialog-uUBz_NIB.js} +1 -1
- package/dist/ui/assets/dist-CD_qfA30.js +1 -0
- package/dist/ui/assets/{download-Cjbk4Rek.js → download-C-fXu08w.js} +1 -1
- package/dist/ui/assets/earth-CTsVjCmp.js +1 -0
- package/dist/ui/assets/ellipsis-vertical-5zBh5yzc.js +1 -0
- package/dist/ui/assets/{external-link-6sTlRDUR.js → external-link-CvpRhwC_.js} +1 -1
- package/dist/ui/assets/{eye-Df8o0tkC.js → eye-CM-HQEWU.js} +1 -1
- package/dist/ui/assets/{file-text-lnxnjBp0.js → file-text-lwkvYGtA.js} +1 -1
- package/dist/ui/assets/{gateway-url-DwzPmoc8.js → gateway-url-BlnabM5e.js} +1 -1
- package/dist/ui/assets/gauge-CB-cas-h.js +1 -0
- package/dist/ui/assets/{history-CAF_R34_.js → history-eSHspWRr.js} +1 -1
- package/dist/ui/assets/index-D489S18g.css +2 -0
- package/dist/ui/assets/index-ZjAc-KQS.js +116 -0
- package/dist/ui/assets/{info-WjromB4Y.js → info-DTgFQ_jA.js} +1 -1
- package/dist/ui/assets/key-CeM9JJkq.js +1 -0
- package/dist/ui/assets/label-k0jYxoWW.js +1 -0
- package/dist/ui/assets/loader-circle-Dtfz4FWw.js +1 -0
- package/dist/ui/assets/lock-open-B089GUAJ.js +1 -0
- package/dist/ui/assets/mail--gNFIe4M.js +1 -0
- package/dist/ui/assets/{pause-VqeUmp2Z.js → pause-DjT1nwQM.js} +1 -1
- package/dist/ui/assets/pencil-6PRgdjiU.js +1 -0
- package/dist/ui/assets/play-tOrP0xUJ.js +1 -0
- package/dist/ui/assets/plus-Cnom3j47.js +1 -0
- package/dist/ui/assets/progress-DrI2UDu-.js +1 -0
- package/dist/ui/assets/radio-D-joO9J0.js +1 -0
- package/dist/ui/assets/{refresh-cw-CCzDCAuz.js → refresh-cw-BRrzoHQW.js} +1 -1
- package/dist/ui/assets/scroll-area-CfHn94Vb.js +1 -0
- package/dist/ui/assets/search-D277MUP0.js +1 -0
- package/dist/ui/assets/select-BOR8MsSL.js +1 -0
- package/dist/ui/assets/{send-BPk9XbIq.js → send-DIlj81PT.js} +1 -1
- package/dist/ui/assets/{settings-BGfrZ_zM.js → settings-CkBjgAEm.js} +1 -1
- package/dist/ui/assets/{shield-CxhcUT39.js → shield-U0hIjGzm.js} +1 -1
- package/dist/ui/assets/slider-CmE_z1Ii.js +1 -0
- package/dist/ui/assets/{sparkles-BhwlS1pc.js → sparkles-VXHGDbNh.js} +1 -1
- package/dist/ui/assets/{square-DMNWw4Hi.js → square-OHeetvN3.js} +1 -1
- package/dist/ui/assets/switch-DXcELPsM.js +1 -0
- package/dist/ui/assets/tabs-CxiybXcw.js +1 -0
- package/dist/ui/assets/terminal-C6YPcJl_.js +1 -0
- package/dist/ui/assets/{textarea-B6Z1Zc6W.js → textarea-rp6vsOZl.js} +1 -1
- package/dist/ui/assets/{trash-2-xD2o4SgX.js → trash-2-DQxm7DUM.js} +1 -1
- package/dist/ui/assets/{triangle-alert-pVIJGjga.js → triangle-alert-Dj8ZhmWj.js} +1 -1
- package/dist/ui/assets/{useHiveAgentsModelLoad-BnC4jLE-.js → useHiveAgentsModelLoad-COLvs-Ho.js} +1 -1
- package/dist/ui/assets/useOfficeModel-Cy7cAyEn.js +1 -0
- package/dist/ui/assets/useProviders-q6iROeWE.js +1 -0
- package/dist/ui/assets/utils-Dyb7SC2_.js +1 -0
- package/dist/ui/assets/vendor-charts-K3xcRl0X.js +60 -0
- package/dist/ui/assets/{vendor-query-DsWPbQdG.js → vendor-query-Dj8xYhQD.js} +1 -1
- package/dist/ui/assets/vendor-radix-D0s_k6Gp.js +63 -0
- package/dist/ui/assets/vendor-react-CPJEWbIG.js +1 -0
- package/dist/ui/assets/{vendor-router-gqiZ7xhx.js → vendor-router-zpB-76nT.js} +1 -1
- package/dist/ui/assets/volume-x-Bm735CXN.js +1 -0
- package/dist/ui/assets/wifi-DklBfOZ6.js +1 -0
- package/dist/ui/assets/{zap-B4RaNNO5.js → zap-BEZNJ0i0.js} +1 -1
- package/dist/ui/index.html +16 -13
- package/dist/ui/logoblack.png +0 -0
- package/dist/ui/logocolor-dark.png +0 -0
- package/dist/ui/logocolorbg.png +0 -0
- package/dist/ui/logodoradobg.png +0 -0
- package/package.json +18 -15
- package/packages/cli/src/adapters/config.ts +1 -80
- package/packages/cli/src/adapters/factory.ts +0 -45
- package/packages/cli/src/adapters/index.ts +0 -8
- package/packages/cli/src/commands/doctor.ts +156 -1
- package/packages/cli/src/commands/gateway.ts +2 -9
- package/packages/cli/src/commands/onboard.ts +126 -59
- package/packages/cli/src/index.ts +9 -11
- package/packages/cli/src/ui-bundle.generated.ts +9 -92
- package/packages/core/src/agent/acceptance-checks.ts +172 -0
- package/packages/core/src/agent/agent-catalog.ts +348 -0
- package/packages/core/src/agent/agent-loop.ts +204 -28
- package/packages/core/src/agent/capability-search.ts +5 -5
- package/packages/core/src/agent/catalog-selector.ts +103 -0
- package/packages/core/src/agent/compaction.ts +52 -42
- package/packages/core/src/agent/context-compiler.ts +185 -63
- package/packages/core/src/agent/conversation-store.ts +56 -3
- package/packages/core/src/agent/curator.ts +129 -34
- package/packages/core/src/agent/delegation-runtime.ts +241 -0
- package/packages/core/src/agent/goal-runner.ts +111 -32
- package/packages/core/src/agent/index.ts +17 -0
- package/packages/core/src/agent/llm-client.ts +34 -2
- package/packages/core/src/agent/llm-providers/anthropic.ts +10 -7
- package/packages/core/src/agent/llm-providers/hiveagents.ts +1 -1
- package/packages/core/src/agent/llm-providers/interface.ts +16 -5
- package/packages/core/src/agent/llm-providers/modelscope.ts +5 -0
- package/packages/core/src/agent/llm-providers/openai-compat-base.ts +1 -1
- package/packages/core/src/agent/llm-providers/z-ai.ts +5 -0
- package/packages/core/src/agent/minimal-loadout.ts +47 -0
- package/packages/core/src/agent/playbook-selector.ts +1 -1
- package/packages/core/src/agent/prompt-builder.ts +4 -0
- package/packages/core/src/agent/proof-packet.ts +6 -1
- package/packages/core/src/agent/providers/index.ts +9 -4
- package/packages/core/src/agent/routing-intent.ts +22 -0
- package/packages/core/src/agent/run-store.ts +24 -3
- package/packages/core/src/agent/service.ts +2 -2
- package/packages/core/src/agent/skill-selector.ts +12 -31
- package/packages/core/src/agent/tool-selector.ts +61 -36
- package/packages/core/src/agent/tracer.ts +5 -1
- package/packages/core/src/artifacts/store.ts +162 -0
- package/packages/core/src/canvas/canvas-manager.ts +5 -234
- package/packages/core/src/canvas/emitter.ts +121 -69
- package/packages/core/src/canvas/index.ts +0 -2
- package/packages/core/src/channels/base.ts +3 -1
- package/packages/core/src/channels/manager.ts +117 -25
- package/packages/core/src/channels/webchat.ts +4 -8
- package/packages/core/src/channels/whatsapp.ts +6 -1
- package/packages/core/src/config/loader.ts +13 -23
- package/packages/core/src/events/agent-bus.ts +0 -31
- package/packages/core/src/events/channel-narration.ts +150 -0
- package/packages/core/src/events/narration.ts +82 -0
- package/packages/core/src/events/tool-narration.ts +62 -0
- package/packages/core/src/gateway/channel-notify.ts +43 -10
- package/packages/core/src/gateway/delegation-groups.ts +258 -0
- package/packages/core/src/gateway/delegation-notify.ts +103 -0
- package/packages/core/src/gateway/durable-queue.ts +33 -2
- package/packages/core/src/gateway/helpers/index.ts +2 -2
- package/packages/core/src/gateway/helpers/narration.ts +4 -57
- package/packages/core/src/gateway/helpers/redact.ts +1 -1
- package/packages/core/src/gateway/helpers/ui-source.ts +67 -0
- package/packages/core/src/gateway/initializer.ts +15 -13
- package/packages/core/src/gateway/job-executors.ts +197 -104
- package/packages/core/src/gateway/lane-queue.ts +1 -1
- package/packages/core/src/gateway/notification-inbox.ts +57 -0
- package/packages/core/src/gateway/resolver.ts +11 -25
- package/packages/core/src/gateway/routes/agents.ts +91 -1
- package/packages/core/src/gateway/routes/auth.ts +21 -42
- package/packages/core/src/gateway/routes/channels.ts +15 -1
- package/packages/core/src/gateway/routes/chat.ts +6 -6
- package/packages/core/src/gateway/routes/cron-api.ts +0 -4
- package/packages/core/src/gateway/routes/mcp.ts +0 -63
- package/packages/core/src/gateway/routes/meeting.ts +245 -0
- package/packages/core/src/gateway/routes/models.ts +69 -12
- package/packages/core/src/gateway/routes/providers.ts +111 -28
- package/packages/core/src/gateway/routes/setup.ts +92 -35
- package/packages/core/src/gateway/routes/skills.ts +2 -2
- package/packages/core/src/gateway/routes/system.ts +31 -10
- package/packages/core/src/gateway/routes/users.ts +24 -1
- package/packages/core/src/gateway/routes/voice.ts +3 -0
- package/packages/core/src/gateway/server.ts +207 -141
- package/packages/core/src/gateway/session.ts +6 -4
- package/packages/core/src/gateway/slash-commands.ts +7 -6
- package/packages/core/src/gateway/webchat-turn.ts +63 -13
- package/packages/core/src/index.ts +3 -0
- package/packages/core/src/mcp/hot-reload.ts +14 -7
- package/packages/core/src/mcp/singleton.ts +0 -3
- package/packages/core/src/mcp/tool-sync.ts +2 -2
- package/packages/core/src/resilience/retry.ts +1 -1
- package/packages/core/src/scheduler/CronScheduler.ts +3 -1
- package/packages/core/src/scheduler/integration.ts +1 -1
- package/packages/core/src/storage/bootstrap.ts +34 -10
- package/packages/core/src/storage/collections.ts +167 -27
- package/packages/core/src/storage/crypto.ts +147 -58
- package/packages/core/src/storage/hivedb.ts +9 -0
- package/packages/core/src/storage/model-id.ts +53 -0
- package/packages/core/src/storage/onboarding.ts +160 -34
- package/packages/core/src/storage/reconcile.ts +2 -5
- package/packages/core/src/storage/seed.ts +436 -158
- package/packages/core/src/storage/usage.ts +61 -132
- package/packages/core/src/storage/user-email.ts +11 -0
- package/packages/core/src/tool-runtime/index.ts +69 -23
- package/packages/core/src/tool-runtime/worker-tools.ts +4 -2
- package/packages/core/src/{canvas/a2ui-tools.ts → tools/a2ui/index.ts} +17 -8
- package/packages/core/src/tools/agents/index.ts +566 -85
- package/packages/core/src/tools/core/index.ts +28 -10
- package/packages/core/src/tools/cron/index.ts +1 -6
- package/packages/core/src/tools/index.ts +19 -46
- package/packages/core/src/tools/types.ts +1 -1
- package/packages/core/src/tools/web/artifact-inspect.ts +23 -0
- package/packages/core/src/tools/web/browser-backend.ts +129 -0
- package/packages/core/src/tools/web/browser-screenshot.ts +26 -5
- package/packages/core/src/tools/web/browser-service.ts +75 -35
- package/packages/core/src/tools/web/index.ts +3 -0
- package/packages/core/src/tools/web/webview-backend.ts +412 -0
- package/packages/core/src/utils/logger.ts +58 -30
- package/packages/core/src/utils/toon.ts +0 -20
- package/packages/core/src/voice/index.ts +108 -17
- package/packages/mcp/src/manager.ts +8 -7
- package/packages/mcp/src/transports/sse.ts +0 -4
- package/packages/mcp/src/transports/websocket.ts +0 -6
- package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_dashboard/SKILL.md +4 -4
- package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_form/SKILL.md +4 -4
- package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_interactive/SKILL.md +5 -5
- package/packages/skills/src/bundled/agents/agent_spawner/SKILL.md +24 -18
- package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +48 -148
- package/packages/skills/src/bundled/cli/cli_pipeline/SKILL.md +9 -10
- package/packages/skills/src/bundled/cli/cli_safe_exec/SKILL.md +1 -1
- package/packages/skills/src/bundled/cli/software_engineering/SKILL.md +23 -0
- package/packages/skills/src/bundled/cron_manager/SKILL.md +2 -2
- package/packages/skills/src/bundled/cron_reminder/SKILL.md +7 -7
- package/packages/skills/src/bundled/filesystem/file_read_and_summarize/SKILL.md +11 -10
- package/packages/skills/src/bundled/filesystem/file_writer/SKILL.md +29 -35
- package/packages/skills/src/bundled/filesystem/workspace_file_operator/SKILL.md +22 -0
- package/packages/skills/src/bundled/search_knowledge/capability_discovery/SKILL.md +5 -4
- package/packages/skills/src/bundled-data.generated.ts +640 -1226
- package/dist/ui/assets/AgentCreateForm-DzaIT-dA.js +0 -1
- package/dist/ui/assets/AgentDetailPage-DgqcJceY.js +0 -1
- package/dist/ui/assets/AgentNewPage-CNSpoOSA.js +0 -1
- package/dist/ui/assets/AgentsPage-BMUJzTD6.js +0 -10
- package/dist/ui/assets/ApiClientPage-Cum_a_3j.js +0 -3
- package/dist/ui/assets/CanvasPage-o6oCP6uq.js +0 -33
- package/dist/ui/assets/ChannelsPage-WrB0zwLq.js +0 -8
- package/dist/ui/assets/DashboardPage-BCd6kNw0.js +0 -6
- package/dist/ui/assets/MeetingPage-BULIAWzq.js +0 -1
- package/dist/ui/assets/ModelSelector-BMYOChYb.js +0 -1
- package/dist/ui/assets/ProvidersPage-BVN5UZrI.js +0 -1
- package/dist/ui/assets/SettingsPage-CYmpFfDn.js +0 -9
- package/dist/ui/assets/SetupPage-Dnmb1Lbv.js +0 -1
- package/dist/ui/assets/WebChatPage-DmmdFhIC.js +0 -16
- package/dist/ui/assets/accordion-CnLzKNHK.js +0 -1
- package/dist/ui/assets/alert-B9J6KHmt.js +0 -1
- package/dist/ui/assets/alert-dialog-KcYQWcJ6.js +0 -1
- package/dist/ui/assets/arrow-left-CBcbX5EZ.js +0 -1
- package/dist/ui/assets/badge-88dRb4M8.js +0 -1
- package/dist/ui/assets/bell-8BqRYmzf.js +0 -1
- package/dist/ui/assets/chevron-down-DIosfU_U.js +0 -1
- package/dist/ui/assets/chevron-left-D4U-5A27.js +0 -1
- package/dist/ui/assets/chevron-right-CR4Skrf3.js +0 -1
- package/dist/ui/assets/chevron-up-CI-W21Fy.js +0 -1
- package/dist/ui/assets/circle-check-6Ard1-2z.js +0 -1
- package/dist/ui/assets/dropdown-menu-DDiaHg5y.js +0 -1
- package/dist/ui/assets/es-4I-joeZz.js +0 -1
- package/dist/ui/assets/folder-open-DJBLDFjv.js +0 -1
- package/dist/ui/assets/format-DsLPBxvt.js +0 -1
- package/dist/ui/assets/gauge-B8Tj43rC.js +0 -1
- package/dist/ui/assets/hexagon-6L79pgVK.js +0 -1
- package/dist/ui/assets/index-BmwTAwOF.css +0 -2
- package/dist/ui/assets/index-Cyw7L0Li.js +0 -116
- package/dist/ui/assets/key-DyKOoQh5.js +0 -1
- package/dist/ui/assets/label-B_15zZlR.js +0 -1
- package/dist/ui/assets/loader-circle-BmBOgYze.js +0 -1
- package/dist/ui/assets/lock-BS6OLXPv.js +0 -1
- package/dist/ui/assets/play-zJpWuhrr.js +0 -1
- package/dist/ui/assets/plus-BZQX26Dr.js +0 -1
- package/dist/ui/assets/progress-D5c-Eilm.js +0 -1
- package/dist/ui/assets/scroll-area-CihOx0cb.js +0 -1
- package/dist/ui/assets/search-DzDptO9s.js +0 -1
- package/dist/ui/assets/select-BQCOjM2j.js +0 -1
- package/dist/ui/assets/slider-bcUiUfx0.js +0 -14
- package/dist/ui/assets/switch-BR30E4ej.js +0 -1
- package/dist/ui/assets/table-B3aGEaVp.js +0 -1
- package/dist/ui/assets/tabs-LQidMKRS.js +0 -1
- package/dist/ui/assets/terminal--7G943As.js +0 -1
- package/dist/ui/assets/useProviders-C1xVKLxB.js +0 -1
- package/dist/ui/assets/utils-3pnRFmFe.js +0 -1
- package/dist/ui/assets/vendor-charts-Bu2lyBKP.js +0 -65
- package/dist/ui/assets/vendor-radix-D6rA7xKY.js +0 -63
- package/dist/ui/assets/vendor-react-BU5iQU4f.js +0 -1
- package/dist/ui/assets/volume-2-BekVQl6P.js +0 -1
- package/packages/core/src/agent/context-guard.ts +0 -91
- package/packages/core/src/agent/hooks.ts +0 -166
- package/packages/core/src/agent/providers.ts +0 -1
- package/packages/core/src/auth/auth.ts +0 -111
- package/packages/core/src/auth/index.ts +0 -1
- package/packages/core/src/canvas/canvas-tools.ts +0 -448
- package/packages/core/src/gateway/router.ts +0 -126
- package/packages/core/src/scheduler/dag/AgentExecutor.ts +0 -53
- package/packages/core/src/scheduler/dag/DAGScheduler.ts +0 -250
- package/packages/core/src/scheduler/dag/EventBridge.ts +0 -122
- package/packages/core/src/scheduler/dag/TaskGraph.ts +0 -192
- package/packages/core/src/scheduler/dag/TaskNode.ts +0 -97
- package/packages/core/src/scheduler/dag/TaskResult.ts +0 -22
- package/packages/core/src/scheduler/dag/errors.ts +0 -37
- package/packages/core/src/scheduler/dag/index.ts +0 -26
- package/packages/core/src/scheduler/dag/presets/ResearchPreset.ts +0 -97
- package/packages/core/src/scheduler/dag/strategies/ParallelStrategy.ts +0 -21
- package/packages/core/src/scheduler/dag/strategies/PriorityStrategy.ts +0 -46
- package/packages/core/src/scheduler/index.ts +0 -22
- package/packages/core/src/scheduler/task-driver.ts +0 -216
- package/packages/core/src/tools/canvas/index.ts +0 -420
- package/packages/core/src/tools/meeting/index.ts +0 -336
- package/packages/core/src/tools/projects/index.ts +0 -348
- package/packages/core/src/tools/voice/index.ts +0 -104
- package/packages/core/src/utils/index.ts +0 -5
- package/packages/skills/src/bundled/agents/code_delegator/SKILL.md +0 -156
- package/packages/skills/src/bundled/canvas/canvas_dashboard/SKILL.md +0 -146
- package/packages/skills/src/bundled/canvas/canvas_interact/SKILL.md +0 -148
- package/packages/skills/src/bundled/canvas/canvas_report/SKILL.md +0 -146
- package/packages/skills/src/bundled/meeting/meeting_transcription/SKILL.md +0 -213
- package/packages/skills/src/bundled/voice/voice_assistant/SKILL.md +0 -174
- package/packages/skills/src/bundled/voice/voice_input/SKILL.md +0 -146
- package/packages/skills/src/bundled/voice/voice_output/SKILL.md +0 -151
|
@@ -20,6 +20,7 @@ import { createRun, type AcceptanceCriterion } from "./run-store";
|
|
|
20
20
|
import { clearOldToolResults } from "./compaction";
|
|
21
21
|
import { loadConfig } from "../config/loader";
|
|
22
22
|
import { getDurableQueue } from "../gateway/durable-queue";
|
|
23
|
+
import { recordLLMUsage } from "./tracer";
|
|
23
24
|
|
|
24
25
|
export type { AcceptanceCriterion } from "./run-store";
|
|
25
26
|
|
|
@@ -122,14 +123,92 @@ export async function runGoal(opts: GoalRunOptions): Promise<GoalRunResult> {
|
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
125
|
|
|
126
|
+
/** Runs a deterministic goal_check_tool, no LLM involved. */
|
|
127
|
+
async function runDeterministicCheck(checkTool: string, goal: string): Promise<{ met: boolean; reason: string } | null> {
|
|
128
|
+
try {
|
|
129
|
+
const { executeToolBatch } = await import("../tool-runtime");
|
|
130
|
+
const { createAllTools } = await import("../tools/index");
|
|
131
|
+
const allTools = createAllTools(loadConfig());
|
|
132
|
+
const toolDef = allTools.find((t) => t.name === checkTool);
|
|
133
|
+
if (!toolDef) {
|
|
134
|
+
log.warn(`[verifyGoal] Check tool "${checkTool}" not found in the tool registry — falling back to LLM verifier`);
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const toolResults = await executeToolBatch({
|
|
138
|
+
toolCalls: [{
|
|
139
|
+
id: "goal-check",
|
|
140
|
+
function: { name: checkTool, arguments: JSON.stringify({ goal }) },
|
|
141
|
+
}],
|
|
142
|
+
allTools,
|
|
143
|
+
toolConfig: {},
|
|
144
|
+
});
|
|
145
|
+
const result = toolResults[0];
|
|
146
|
+
if (result?.ok) return interpretCheckResult(result.result);
|
|
147
|
+
return { met: false, reason: `Check tool failed: ${result?.error?.message ?? "unknown"}` };
|
|
148
|
+
} catch (err) {
|
|
149
|
+
log.warn(`[verifyGoal] Check tool "${checkTool}" failed: ${(err as Error).message}`);
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Judges every criterion that has no deterministic checkTool with a SINGLE
|
|
156
|
+
* LLM call (not one call per criterion) — the model returns a verdict per
|
|
157
|
+
* criterion id in one structured response.
|
|
158
|
+
*/
|
|
159
|
+
async function judgeCriteriaWithLLM(
|
|
160
|
+
criteria: AcceptanceCriterion[],
|
|
161
|
+
messages: LLMMessage[],
|
|
162
|
+
providerCfg: any,
|
|
163
|
+
): Promise<AcceptanceResult[]> {
|
|
164
|
+
try {
|
|
165
|
+
const verificationMessages: LLMMessage[] = [
|
|
166
|
+
...clearOldToolResults(messages),
|
|
167
|
+
{
|
|
168
|
+
role: "user",
|
|
169
|
+
content: `Evaluá si cada uno de los siguientes criterios de aceptación se cumplió, basándote en la conversación anterior.\n\nCriterios:\n${criteria.map((c) => `- ${c.id}: ${c.description}`).join("\n")}\n\nRespondé en JSON estricto, un resultado por criterio:\n{"results":[{"id":"...","met":true/false,"reason":"explicación breve"}]}`,
|
|
170
|
+
},
|
|
171
|
+
];
|
|
172
|
+
|
|
173
|
+
const response = await callLLM({ ...providerCfg, messages: verificationMessages, tools: undefined });
|
|
174
|
+
if (providerCfg.provider && providerCfg.model && response.usage) {
|
|
175
|
+
recordLLMUsage({
|
|
176
|
+
provider: providerCfg.provider,
|
|
177
|
+
model: providerCfg.model,
|
|
178
|
+
inputTokens: response.usage.input_tokens ?? 0,
|
|
179
|
+
outputTokens: response.usage.output_tokens ?? 0,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Without this the error text falls through to JSON.parse and the catch below
|
|
184
|
+
// reports a bogus "Unexpected token" instead of the actual provider failure.
|
|
185
|
+
if (response.stop_reason === "error") {
|
|
186
|
+
throw new Error(response.error?.message ?? response.content);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const content = response.content?.trim() || "";
|
|
190
|
+
const candidate = content.slice(content.indexOf("{"), content.lastIndexOf("}") + 1);
|
|
191
|
+
const parsed = JSON.parse(candidate) as { results?: Array<{ id: string; met: boolean; reason?: string }> };
|
|
192
|
+
const byId = new Map((parsed.results ?? []).map((r) => [r.id, r]));
|
|
193
|
+
return criteria.map((c) => {
|
|
194
|
+
const r = byId.get(c.id);
|
|
195
|
+
return { id: c.id, description: c.description, met: r?.met === true, evidence: r?.reason || "El modelo no evaluó este criterio" };
|
|
196
|
+
});
|
|
197
|
+
} catch (err) {
|
|
198
|
+
log.warn(`[verifyGoal] LLM verification failed: ${(err as Error).message}`);
|
|
199
|
+
return criteria.map((c) => ({ id: c.id, description: c.description, met: false, evidence: `Verification error: ${(err as Error).message}` }));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
125
203
|
/**
|
|
126
204
|
* Verify whether a goal has been met using either:
|
|
127
205
|
* - A deterministic tool (goal_check_tool) — executes the tool and checks the result
|
|
128
206
|
* - An LLM verifier — asks the model to return JSON {met, reason}
|
|
129
207
|
*
|
|
130
|
-
* When `acceptance` criteria are supplied, each
|
|
131
|
-
*
|
|
132
|
-
*
|
|
208
|
+
* When `acceptance` criteria are supplied, each with its own checkTool is
|
|
209
|
+
* checked deterministically (no LLM), and every remaining criterion is
|
|
210
|
+
* judged together in a single LLM call — never one call per criterion. The
|
|
211
|
+
* overall verdict is the conjunction of all of them; the top-level
|
|
133
212
|
* `goal`/`checkTool` are ignored in that case.
|
|
134
213
|
*/
|
|
135
214
|
export async function verifyGoal(
|
|
@@ -141,10 +220,21 @@ export async function verifyGoal(
|
|
|
141
220
|
): Promise<{ met: boolean; reason: string; acceptanceResults?: AcceptanceResult[] }> {
|
|
142
221
|
if (acceptance && acceptance.length > 0) {
|
|
143
222
|
const results: AcceptanceResult[] = [];
|
|
223
|
+
const needsLLMJudgment: AcceptanceCriterion[] = [];
|
|
224
|
+
|
|
144
225
|
for (const criterion of acceptance) {
|
|
145
|
-
const
|
|
146
|
-
|
|
226
|
+
const deterministic = criterion.checkTool ? await runDeterministicCheck(criterion.checkTool, criterion.description) : null;
|
|
227
|
+
if (deterministic) {
|
|
228
|
+
results.push({ id: criterion.id, description: criterion.description, met: deterministic.met, evidence: deterministic.reason });
|
|
229
|
+
} else {
|
|
230
|
+
needsLLMJudgment.push(criterion);
|
|
231
|
+
}
|
|
147
232
|
}
|
|
233
|
+
|
|
234
|
+
if (needsLLMJudgment.length > 0) {
|
|
235
|
+
results.push(...(await judgeCriteriaWithLLM(needsLLMJudgment, messages, providerCfg)));
|
|
236
|
+
}
|
|
237
|
+
|
|
148
238
|
const met = results.every((r) => r.met);
|
|
149
239
|
const reason = results.map((r) => `${r.met ? "✅" : "❌"} ${r.description}: ${r.evidence}`).join("\n");
|
|
150
240
|
return { met, reason, acceptanceResults: results };
|
|
@@ -152,32 +242,9 @@ export async function verifyGoal(
|
|
|
152
242
|
|
|
153
243
|
// If we have a deterministic check tool, execute it
|
|
154
244
|
if (checkTool) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const allTools = createAllTools(loadConfig());
|
|
159
|
-
const toolDef = allTools.find((t) => t.name === checkTool);
|
|
160
|
-
if (!toolDef) {
|
|
161
|
-
log.warn(`[verifyGoal] Check tool "${checkTool}" not found in the tool registry — falling back to LLM verifier`);
|
|
162
|
-
} else {
|
|
163
|
-
const toolResults = await executeToolBatch({
|
|
164
|
-
toolCalls: [{
|
|
165
|
-
id: "goal-check",
|
|
166
|
-
function: { name: checkTool, arguments: JSON.stringify({ goal }) },
|
|
167
|
-
}],
|
|
168
|
-
allTools,
|
|
169
|
-
toolConfig: {},
|
|
170
|
-
});
|
|
171
|
-
const result = toolResults[0];
|
|
172
|
-
if (result?.ok) {
|
|
173
|
-
return interpretCheckResult(result.result);
|
|
174
|
-
}
|
|
175
|
-
return { met: false, reason: `Check tool failed: ${result?.error?.message ?? "unknown"}` };
|
|
176
|
-
}
|
|
177
|
-
} catch (err) {
|
|
178
|
-
log.warn(`[verifyGoal] Check tool "${checkTool}" failed: ${(err as Error).message}`);
|
|
179
|
-
// Fall through to LLM verifier
|
|
180
|
-
}
|
|
245
|
+
const deterministic = await runDeterministicCheck(checkTool, goal);
|
|
246
|
+
if (deterministic) return deterministic;
|
|
247
|
+
// Falls through to the LLM verifier when the tool is missing or errored.
|
|
181
248
|
}
|
|
182
249
|
|
|
183
250
|
// LLM verifier: ask the model to evaluate whether the goal is met
|
|
@@ -195,6 +262,18 @@ export async function verifyGoal(
|
|
|
195
262
|
messages: verificationMessages,
|
|
196
263
|
tools: undefined,
|
|
197
264
|
});
|
|
265
|
+
if (providerCfg.provider && providerCfg.model && response.usage) {
|
|
266
|
+
recordLLMUsage({
|
|
267
|
+
provider: providerCfg.provider,
|
|
268
|
+
model: providerCfg.model,
|
|
269
|
+
inputTokens: response.usage.input_tokens ?? 0,
|
|
270
|
+
outputTokens: response.usage.output_tokens ?? 0,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (response.stop_reason === "error") {
|
|
275
|
+
throw new Error(response.error?.message ?? response.content);
|
|
276
|
+
}
|
|
198
277
|
|
|
199
278
|
const content = response.content?.trim() || "";
|
|
200
279
|
// Extract JSON from the response
|
|
@@ -217,7 +296,7 @@ export async function verifyGoal(
|
|
|
217
296
|
* Interpret a check tool's result strictly: an object with a boolean `met`,
|
|
218
297
|
* a bare boolean, or a JSON string with `met` — anything else is not met.
|
|
219
298
|
*/
|
|
220
|
-
function interpretCheckResult(raw: unknown): { met: boolean; reason: string } {
|
|
299
|
+
export function interpretCheckResult(raw: unknown): { met: boolean; reason: string } {
|
|
221
300
|
if (typeof raw === "boolean") {
|
|
222
301
|
return { met: raw, reason: raw ? "Check tool returned true" : "Check tool returned false" };
|
|
223
302
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./acceptance-checks.ts";
|
|
2
|
+
export * from "./agent-catalog.ts";
|
|
3
|
+
export * from "./agent-loop.ts";
|
|
4
|
+
export * from "./capability-search.ts";
|
|
5
|
+
export * from "./catalog-selector.ts";
|
|
6
|
+
export * from "./context-compiler.ts";
|
|
7
|
+
export * from "./conversation-store.ts";
|
|
8
|
+
export * from "./delegation-runtime.ts";
|
|
9
|
+
export * from "./llm-client.ts";
|
|
10
|
+
export * from "./minimal-loadout.ts";
|
|
11
|
+
export * from "./playbook-selector.ts";
|
|
12
|
+
export * from "./prompt-builder.ts";
|
|
13
|
+
export * from "./proof-packet.ts";
|
|
14
|
+
export * from "./run-store.ts";
|
|
15
|
+
export * from "./service.ts";
|
|
16
|
+
export * from "./skill-selector.ts";
|
|
17
|
+
export * from "./tool-selector.ts";
|
|
@@ -28,6 +28,8 @@ import { QwenProvider } from "./llm-providers/qwen"
|
|
|
28
28
|
import { MiniMaxProvider } from "./llm-providers/minimax"
|
|
29
29
|
import { OpenCodeGoProvider } from "./llm-providers/opencode-go"
|
|
30
30
|
import { HiveAgentsProvider } from "./llm-providers/hiveagents"
|
|
31
|
+
import { ZaiProvider } from "./llm-providers/z-ai"
|
|
32
|
+
import { ModelScopeProvider } from "./llm-providers/modelscope"
|
|
31
33
|
import type { LLMProvider } from "./llm-providers/interface"
|
|
32
34
|
|
|
33
35
|
const log = logger.child("llm-client")
|
|
@@ -108,6 +110,18 @@ export interface LLMResponse {
|
|
|
108
110
|
thinking_content?: string
|
|
109
111
|
/** Anthropic extended thinking raw blocks — must be round-tripped verbatim when tool calls follow. */
|
|
110
112
|
thinking_blocks?: ThinkingBlock[]
|
|
113
|
+
/**
|
|
114
|
+
* Set only when stop_reason === "error". `content` carries a human-readable
|
|
115
|
+
* version of the same failure for display, but it is NOT model output —
|
|
116
|
+
* callers must check this field before persisting `content` anywhere durable
|
|
117
|
+
* (conversation history, summaries, task results).
|
|
118
|
+
*/
|
|
119
|
+
error?: {
|
|
120
|
+
message: string
|
|
121
|
+
status?: number
|
|
122
|
+
/** The model id no longer resolves at the provider (HTTP 404/410) — the config needs to change, retrying won't help. */
|
|
123
|
+
modelUnavailable?: boolean
|
|
124
|
+
}
|
|
111
125
|
}
|
|
112
126
|
|
|
113
127
|
// ─── Provider factory ─────────────────────────────────────────────────────────
|
|
@@ -129,6 +143,8 @@ function getProvider(provider: string): LLMProvider {
|
|
|
129
143
|
case "minimax": return new MiniMaxProvider()
|
|
130
144
|
case "opencode-go": return new OpenCodeGoProvider()
|
|
131
145
|
case "hiveagents": return new HiveAgentsProvider()
|
|
146
|
+
case "z-ai": return new ZaiProvider()
|
|
147
|
+
case "modelscope": return new ModelScopeProvider()
|
|
132
148
|
default:
|
|
133
149
|
log.warn(`[llm-client] Unknown provider "${provider}" — falling back to OpenAI-compatible endpoint`)
|
|
134
150
|
return new OpenAIProvider()
|
|
@@ -163,13 +179,29 @@ export async function callLLM(options: LLMCallOptions): Promise<LLMResponse> {
|
|
|
163
179
|
(err) => !options.signal?.aborted && isRetryableError(err)
|
|
164
180
|
)
|
|
165
181
|
} catch (err) {
|
|
166
|
-
const msg = (err as Error).message
|
|
167
182
|
const cleanModel = options.model.replace(new RegExp(`^${options.provider}\\/`), "")
|
|
183
|
+
const status = extractErrorStatus(err)
|
|
184
|
+
const modelUnavailable = status === 404 || status === 410
|
|
185
|
+
const msg = modelUnavailable
|
|
186
|
+
? `El modelo "${cleanModel}" ya no existe en ${options.provider} (HTTP ${status}). `
|
|
187
|
+
+ `El proveedor lo retiró de su catálogo; reintentar no sirve. `
|
|
188
|
+
+ `Elegí otro modelo en Ajustes → Proveedores.`
|
|
189
|
+
: (err as Error).message
|
|
168
190
|
log.error(`[llm-client] Error calling ${options.provider}/${cleanModel}: ${msg}`, err)
|
|
169
|
-
return {
|
|
191
|
+
return {
|
|
192
|
+
content: `[LLM Error] ${msg}`,
|
|
193
|
+
stop_reason: "error",
|
|
194
|
+
error: { message: msg, status, modelUnavailable },
|
|
195
|
+
}
|
|
170
196
|
}
|
|
171
197
|
}
|
|
172
198
|
|
|
199
|
+
/** Provider SDKs disagree on where the HTTP status lands; check every shape we've seen. */
|
|
200
|
+
function extractErrorStatus(err: unknown): number | undefined {
|
|
201
|
+
const e = err as { status?: number; statusCode?: number; response?: { status?: number } }
|
|
202
|
+
return e?.status ?? e?.statusCode ?? e?.response?.status
|
|
203
|
+
}
|
|
204
|
+
|
|
173
205
|
/**
|
|
174
206
|
* Default provider/model resolved from the DB, used when an agent has none configured:
|
|
175
207
|
* 1. the coordinator agent's config, 2. the first active LLM model of an active provider.
|
|
@@ -5,22 +5,25 @@ import type { ContentPart, LLMMessage } from "../llm-client"
|
|
|
5
5
|
|
|
6
6
|
const log = logger.child("llm-client")
|
|
7
7
|
|
|
8
|
-
// Models that
|
|
8
|
+
// Models that accept the explicit `thinking: { type: "enabled" }` parameter, per
|
|
9
|
+
// the "Extended thinking" row of platform.claude.com/docs/en/about-claude/models/overview.
|
|
10
|
+
// This is an allowlist on purpose: from Opus 4.7 onward Anthropic replaced extended
|
|
11
|
+
// thinking with *adaptive* thinking, which is server-side and always on — those models
|
|
12
|
+
// reject the parameter, so being absent here is the correct behavior, not an omission.
|
|
9
13
|
const THINKING_CAPABLE_MODELS = new Set([
|
|
10
14
|
"claude-3-7-sonnet-20250219",
|
|
11
15
|
"claude-sonnet-4-5",
|
|
12
|
-
"claude-sonnet-4-
|
|
16
|
+
"claude-sonnet-4-5-20250929",
|
|
17
|
+
"claude-sonnet-4-6", // deprecated but still accepted
|
|
13
18
|
"claude-opus-4-5",
|
|
14
|
-
"claude-opus-4-
|
|
15
|
-
"claude-opus-4-
|
|
19
|
+
"claude-opus-4-5-20251101",
|
|
20
|
+
"claude-opus-4-6", // deprecated but still accepted
|
|
16
21
|
"claude-haiku-4-5",
|
|
17
22
|
"claude-haiku-4-5-20251001",
|
|
18
23
|
])
|
|
19
24
|
|
|
20
25
|
function supportsThinking(model: string): boolean {
|
|
21
|
-
|
|
22
|
-
// Also match any claude-4.x or claude-3-7+ by prefix
|
|
23
|
-
return /^claude-(4|3-7)/.test(model)
|
|
26
|
+
return THINKING_CAPABLE_MODELS.has(model)
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
/** Anthropic's documented shape for context-length errors: 400 + invalid_request_error + a "too long"/"maximum" message. */
|
|
@@ -7,7 +7,7 @@ const log = logger.child("llm-client")
|
|
|
7
7
|
const DEFAULT_BASE = "https://llm.hiveagents.io"
|
|
8
8
|
|
|
9
9
|
/** Contexto por defecto que se solicita al backend de HiveAgents al cargar un modelo. */
|
|
10
|
-
|
|
10
|
+
const HIVEAGENTS_DEFAULT_LOAD_CTX = 50000
|
|
11
11
|
|
|
12
12
|
// Cloudflare blocks requests with the OpenAI SDK User-Agent and x-stainless-* fingerprint headers.
|
|
13
13
|
const BLOCKED_HEADERS = [
|
|
@@ -17,7 +17,7 @@ export interface LLMProvider {
|
|
|
17
17
|
// ─── Shared constants ─────────────────────────────────────────────────────────
|
|
18
18
|
|
|
19
19
|
// Models that only accept temperature=1 (reasoning/thinking models).
|
|
20
|
-
|
|
20
|
+
const FIXED_TEMPERATURE_1_MODELS = new Set(["kimi-k2.5", "kimi-k2", "kimi-k2-5"])
|
|
21
21
|
|
|
22
22
|
export const OPENAI_COMPAT_BASE_URLS: Record<string, string> = {
|
|
23
23
|
groq: "https://api.groq.com/openai/v1",
|
|
@@ -30,6 +30,11 @@ export const OPENAI_COMPAT_BASE_URLS: Record<string, string> = {
|
|
|
30
30
|
minimax: "https://api.minimaxi.com/v1",
|
|
31
31
|
"opencode-go": "https://opencode.ai/zen/go/v1",
|
|
32
32
|
hiveagents: "https://llm.hiveagents.io/v1",
|
|
33
|
+
"z-ai": "https://api.z.ai/api/paas/v4",
|
|
34
|
+
// OJO: `.ai`, no `.cn`. Son dos plataformas con cuentas y tokens distintos, y
|
|
35
|
+
// un token de la internacional da 401 contra el endpoint chino aunque el
|
|
36
|
+
// listado de modelos responda 200 en ambos (ese listado es público).
|
|
37
|
+
modelscope: "https://api-inference.modelscope.ai/v1",
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
// ─── Provider profiles ────────────────────────────────────────────────────────
|
|
@@ -58,14 +63,20 @@ const DEFAULT_PROFILE: ProviderProfile = {
|
|
|
58
63
|
retryWithoutToolsOnCodes: [],
|
|
59
64
|
}
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
const PROVIDER_PROFILES: Record<string, ProviderProfile> = {
|
|
62
67
|
openai: { ...DEFAULT_PROFILE, normalizeToolNames: true },
|
|
63
68
|
kimi: { ...DEFAULT_PROFILE, normalizeToolNames: true, disableParallelToolCalls: true, retryWithoutToolsOnCodes: [422] },
|
|
64
69
|
deepseek: { ...DEFAULT_PROFILE, normalizeToolNames: true },
|
|
65
70
|
groq: { ...DEFAULT_PROFILE, normalizeToolNames: true, retryWithoutToolsOnCodes: [400, 422] },
|
|
66
|
-
|
|
71
|
+
// tool_choice "any" *forces* a tool call on every request per docs.mistral.ai —
|
|
72
|
+
// it is not Mistral's spelling of "auto", which Mistral supports and defaults to.
|
|
73
|
+
// With "any" the agent could never answer in plain text: every turn had to end
|
|
74
|
+
// in a tool call, so the loop only stopped when it hit max iterations.
|
|
75
|
+
mistral: { ...DEFAULT_PROFILE, normalizeToolNames: true, stripAdditionalProperties: true },
|
|
67
76
|
openrouter: { ...DEFAULT_PROFILE, normalizeToolNames: true, retryWithoutToolsOnCodes: [400, 422] },
|
|
68
|
-
nvidia: { ...DEFAULT_PROFILE, normalizeToolNames: true },
|
|
77
|
+
nvidia: { ...DEFAULT_PROFILE, normalizeToolNames: true, retryWithoutToolsOnCodes: [400, 422] },
|
|
78
|
+
"z-ai": { ...DEFAULT_PROFILE, normalizeToolNames: true, retryWithoutToolsOnCodes: [400, 422] },
|
|
79
|
+
modelscope: { ...DEFAULT_PROFILE, normalizeToolNames: true, retryWithoutToolsOnCodes: [400, 422] },
|
|
69
80
|
qwen: { ...DEFAULT_PROFILE, normalizeToolNames: true, retryWithoutToolsOnCodes: [400, 422] },
|
|
70
81
|
minimax: { ...DEFAULT_PROFILE, normalizeToolNames: true, retryWithoutToolsOnCodes: [400, 422] },
|
|
71
82
|
"opencode-go": { ...DEFAULT_PROFILE, normalizeToolNames: true, retryWithoutToolsOnCodes: [400, 422] },
|
|
@@ -78,7 +89,7 @@ export function getProviderProfile(provider: string): ProviderProfile {
|
|
|
78
89
|
|
|
79
90
|
// ─── Models that don't support tool calling ───────────────────────────────────
|
|
80
91
|
|
|
81
|
-
|
|
92
|
+
const NO_TOOL_MODELS = new Set([
|
|
82
93
|
"deepseek-reasoner",
|
|
83
94
|
"deepseek/deepseek-r1:free",
|
|
84
95
|
])
|
|
@@ -339,7 +339,7 @@ export abstract class OpenAICompatBase implements LLMProvider {
|
|
|
339
339
|
* Extracts tool_calls from text when the model fails to emit native tool_calls.
|
|
340
340
|
* Supports common formats used by Gemma, Qwen, and other local models.
|
|
341
341
|
*/
|
|
342
|
-
|
|
342
|
+
function extractToolCallsFromText(
|
|
343
343
|
content: string,
|
|
344
344
|
toolNameMap: Map<string, string>,
|
|
345
345
|
knownToolNames?: Set<string>,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal loadout — the single source of truth for what the coordinator starts
|
|
3
|
+
* a turn with, and the rule that derives which skills ride along with it.
|
|
4
|
+
*
|
|
5
|
+
* Everything else is discovered at runtime through `search_knowledge`, which
|
|
6
|
+
* injects both the tool and its associated skill into the loadout
|
|
7
|
+
* (agent-loop.ts). So a skill that documents tools outside this set has nothing
|
|
8
|
+
* to teach a turn that hasn't discovered them yet — it only spends context.
|
|
9
|
+
*
|
|
10
|
+
* These used to be two hand-maintained lists (one here, one in skill-selector)
|
|
11
|
+
* and they drifted: 3 of the 4 "minimal" skills documented tools the agent did
|
|
12
|
+
* not have. The skill set is now derived from the tool set so it cannot.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Tools always present in the coordinator's loadout, without discovery. */
|
|
16
|
+
export const MINIMAL_TOOLS = new Set([
|
|
17
|
+
// Discovery — the entry point to everything else
|
|
18
|
+
"search_knowledge",
|
|
19
|
+
// Communication with the user
|
|
20
|
+
"notify",
|
|
21
|
+
"report_progress",
|
|
22
|
+
// Notes that survive context compaction
|
|
23
|
+
"save_note",
|
|
24
|
+
// Orchestration: the coordinator's own competency, not an optional capability
|
|
25
|
+
"task_delegate",
|
|
26
|
+
"task_revise",
|
|
27
|
+
"agent_find",
|
|
28
|
+
"task_status",
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
/** Splits a SkillDoc's comma-separated `tools` column into tool names. */
|
|
32
|
+
export function parseSkillTools(toolsCsv: string | null | undefined): string[] {
|
|
33
|
+
return (toolsCsv ?? "")
|
|
34
|
+
.split(",")
|
|
35
|
+
.map((name) => name.trim())
|
|
36
|
+
.filter(Boolean)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A skill is minimal when every tool it documents is already in the loadout.
|
|
41
|
+
* A skill that declares no tools is not minimal: it has no anchor to the
|
|
42
|
+
* always-available set, so it belongs to discovery like any other.
|
|
43
|
+
*/
|
|
44
|
+
export function isMinimalSkill(toolsCsv: string | null | undefined): boolean {
|
|
45
|
+
const tools = parseSkillTools(toolsCsv)
|
|
46
|
+
return tools.length > 0 && tools.every((name) => MINIMAL_TOOLS.has(name))
|
|
47
|
+
}
|
|
@@ -90,7 +90,7 @@ export async function selectPlaybookRules(message: string): Promise<PlaybookRule
|
|
|
90
90
|
* Sync active playbook rules to the HiveDB capability index.
|
|
91
91
|
* Replaces all `type=playbook` documents atomically.
|
|
92
92
|
*/
|
|
93
|
-
export async function
|
|
93
|
+
export async function syncPlaybookToIndex(): Promise<void> {
|
|
94
94
|
try {
|
|
95
95
|
// Step 1: Get active rules
|
|
96
96
|
const playbookCol = await col<PlaybookDoc>("playbook")
|
|
@@ -126,6 +126,7 @@ export async function buildSystemPrompt(opts: BuildSystemPromptOpts): Promise<st
|
|
|
126
126
|
const userData: Record<string, string | null> = {}
|
|
127
127
|
|
|
128
128
|
if (user.name) userData.Nombre = user.name
|
|
129
|
+
if (agent.role === "coordinator" && user.email) userData.CorreoPropio = user.email
|
|
129
130
|
if (user.language) userData.Idioma = user.language
|
|
130
131
|
if (user.timezone) userData.ZonaHoraria = user.timezone
|
|
131
132
|
if (user.occupation) userData.Ocupación = user.occupation
|
|
@@ -134,6 +135,9 @@ export async function buildSystemPrompt(opts: BuildSystemPromptOpts): Promise<st
|
|
|
134
135
|
// Usar TOON para comprimir datos del usuario
|
|
135
136
|
if (Object.keys(userData).length > 0) {
|
|
136
137
|
userSection += formatContext(userData) + "\n\n"
|
|
138
|
+
if (agent.role === "coordinator" && user.email) {
|
|
139
|
+
userSection += `Cuando el usuario diga "envíame", "mándame" o "a mi correo" sin indicar otro destinatario, usá CorreoPropio. Para terceras personas, resolvé su dirección por separado.\n\n`
|
|
140
|
+
}
|
|
137
141
|
} else {
|
|
138
142
|
userSection += `Usuario ID: ${userId}\n\n`
|
|
139
143
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* reviewer doesn't have to replay the whole run to trust its outcome.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { col, nextId } from "../storage/hive";
|
|
9
|
+
import { col, nextId, toIndexable } from "../storage/hive";
|
|
10
10
|
import type { ProofPacketDoc } from "../storage/collections";
|
|
11
11
|
import type { AcceptanceResult } from "./goal-runner";
|
|
12
12
|
import type { RunEpoch } from "./run-epoch";
|
|
@@ -25,9 +25,13 @@ export interface BuildProofPacketInput {
|
|
|
25
25
|
evidence: string[];
|
|
26
26
|
knownLimits?: string | null;
|
|
27
27
|
epoch?: RunEpoch | null;
|
|
28
|
+
catalogAgentId?: string | null;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export async function buildProofPacket(input: BuildProofPacketInput): Promise<ProofPacketDoc> {
|
|
32
|
+
if (input.met && (input.checksRun.length === 0 || input.evidence.length === 0)) {
|
|
33
|
+
throw new Error("A successful proof packet requires at least one check run and non-empty evidence");
|
|
34
|
+
}
|
|
31
35
|
const id = await nextId("proofPackets");
|
|
32
36
|
const acceptanceResults: AcceptanceResult[] =
|
|
33
37
|
input.acceptanceResults ?? [{ id: "goal", description: input.intendedOutcome, met: input.met, evidence: input.evidence.join("; ") || "n/a" }];
|
|
@@ -42,6 +46,7 @@ export async function buildProofPacket(input: BuildProofPacketInput): Promise<Pr
|
|
|
42
46
|
evidence_json: JSON.stringify(input.evidence),
|
|
43
47
|
known_limits: input.knownLimits ?? null,
|
|
44
48
|
epoch_json: input.epoch ? JSON.stringify(input.epoch) : null,
|
|
49
|
+
catalog_agent_id: toIndexable(input.catalogAgentId),
|
|
45
50
|
met: input.met,
|
|
46
51
|
created_at: Date.now(),
|
|
47
52
|
};
|
|
@@ -10,8 +10,9 @@ import { logger } from "../../utils/logger.ts"
|
|
|
10
10
|
import { getAgentLoop } from "../agent-loop"
|
|
11
11
|
import { resolveUserId, resolveAgentId } from "../../storage/onboarding"
|
|
12
12
|
import type { ContentPart } from "../../multimodal/types"
|
|
13
|
+
import type { TurnSource } from "../../storage/collections"
|
|
13
14
|
|
|
14
|
-
export type Provider = "openai" | "anthropic" | "gemini" | "mistral" | "kimi" | "ollama" | "openrouter" | "deepseek" | "nvidia" | "hiveagents"
|
|
15
|
+
export type Provider = "openai" | "anthropic" | "gemini" | "mistral" | "kimi" | "ollama" | "openrouter" | "deepseek" | "nvidia" | "hiveagents" | "z-ai" | "modelscope" | "minimax" | "qwen" | "groq" | "opencode-go"
|
|
15
16
|
|
|
16
17
|
export interface StepEvent {
|
|
17
18
|
type: "text" | "plan" | "tool_call" | "tool_result"
|
|
@@ -42,6 +43,10 @@ export interface ModelOptions {
|
|
|
42
43
|
runId?: string
|
|
43
44
|
resume?: boolean
|
|
44
45
|
durable?: boolean
|
|
46
|
+
turnId?: string
|
|
47
|
+
sessionId?: string
|
|
48
|
+
/** See AgentLoopOptions.historySource in agent-loop.ts. */
|
|
49
|
+
historySource?: TurnSource
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
export interface ModelResponse {
|
|
@@ -102,6 +107,9 @@ export class AgentRunner {
|
|
|
102
107
|
run_id: options.runId,
|
|
103
108
|
resume: options.resume,
|
|
104
109
|
durable: options.durable,
|
|
110
|
+
turn_id: options.turnId,
|
|
111
|
+
session_id: options.sessionId,
|
|
112
|
+
history_source: options.historySource,
|
|
105
113
|
},
|
|
106
114
|
signal: options.signal,
|
|
107
115
|
onToken: options.onToken,
|
|
@@ -208,6 +216,3 @@ export class AgentRunner {
|
|
|
208
216
|
}
|
|
209
217
|
}
|
|
210
218
|
|
|
211
|
-
export function createAgentRunner(config: Config): AgentRunner {
|
|
212
|
-
return new AgentRunner(config)
|
|
213
|
-
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function normalizeIntent(value: string): string {
|
|
2
|
+
return value
|
|
3
|
+
.normalize("NFD")
|
|
4
|
+
.replace(/\p{Diacritic}/gu, "")
|
|
5
|
+
.toLowerCase();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Calendar operations are external data mutations/lookups, not future Hive
|
|
10
|
+
* executions. Keep them out of the native cron tool and skill selectors so
|
|
11
|
+
* the coordinator can discover the configured calendar MCP server instead.
|
|
12
|
+
*/
|
|
13
|
+
export function isCalendarOperation(value: string): boolean {
|
|
14
|
+
const text = normalizeIntent(value);
|
|
15
|
+
const namesCalendar = /\b(calendario|calendar|agenda)\b/.test(text);
|
|
16
|
+
const calendarAction = /\b(crear?|agend\w*|anad\w*|agreg\w*|consult\w*|list\w*|modific\w*|mov\w*|cancel\w*|elimin\w*|invit\w*|reserv\w*|disponibilidad|availability)\b/.test(text);
|
|
17
|
+
if (namesCalendar && calendarAction) return true;
|
|
18
|
+
|
|
19
|
+
const directlySchedulesMeeting = /\b(crea(?:r)?|agenda(?:r)?|programa(?:r)?|reserva(?:r)?)\s+(?:un|una|la|el|nueva|nuevo)?\s*(reunion|cita|meeting)\b/.test(text);
|
|
20
|
+
const managesAttendees = /\b(invit\w*|asistente\w*|attendee\w*)\b.*\b(reunion|cita|meeting)\b|\b(reunion|cita|meeting)\b.*\b(invit\w*|asistente\w*|attendee\w*)\b/.test(text);
|
|
21
|
+
return directlySchedulesMeeting || managesAttendees;
|
|
22
|
+
}
|
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
* should write to a run; single-writer pattern keeps contention minimal.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { col, updateDoc, nextId } from "../storage/hive";
|
|
13
|
+
import { col, updateDoc, nextId, toIndexable } from "../storage/hive";
|
|
14
14
|
import type { AgentRunDoc } from "../storage/collections";
|
|
15
15
|
import { getBootId } from "../storage/boot-id";
|
|
16
16
|
import { logger } from "../utils/logger";
|
|
17
17
|
import { loadConfig } from "../config/loader";
|
|
18
18
|
import type { LLMMessage } from "./llm-client";
|
|
19
19
|
import type { RunEpoch } from "./run-epoch";
|
|
20
|
+
import { formatInternalEvent } from "./conversation-store";
|
|
20
21
|
|
|
21
22
|
const log = logger.child("run-store");
|
|
22
23
|
|
|
@@ -66,6 +67,7 @@ export interface CreateRunInput {
|
|
|
66
67
|
resume_policy?: AgentRunDoc["resume_policy"]
|
|
67
68
|
acceptance?: AcceptanceCriterion[]
|
|
68
69
|
epoch?: RunEpoch
|
|
70
|
+
catalog_agent_id?: string | null
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
export async function createRun(input: CreateRunInput): Promise<AgentRunDoc> {
|
|
@@ -98,6 +100,7 @@ export async function createRun(input: CreateRunInput): Promise<AgentRunDoc> {
|
|
|
98
100
|
resume_policy: input.resume_policy ?? "resume",
|
|
99
101
|
acceptance_json: input.acceptance ? JSON.stringify(input.acceptance) : null,
|
|
100
102
|
epoch_json: input.epoch ? JSON.stringify(input.epoch) : null,
|
|
103
|
+
catalog_agent_id: toIndexable(input.catalog_agent_id),
|
|
101
104
|
error: null,
|
|
102
105
|
created_at: now,
|
|
103
106
|
updated_at: now,
|
|
@@ -268,12 +271,30 @@ export function deserializeEpoch(run: AgentRunDoc): RunEpoch | null {
|
|
|
268
271
|
* run has no checkpoint (empty state_json — chat runs that never promoted
|
|
269
272
|
* to durable).
|
|
270
273
|
*/
|
|
274
|
+
/**
|
|
275
|
+
* Checkpoints written before `source`-based internal events existed may still
|
|
276
|
+
* carry a stray `role:"system"` message after index 0 — either the
|
|
277
|
+
* compaction summary (formerly prepended to `ctx.messages`) or a delegation
|
|
278
|
+
* fan-in notice. `messages[0]` is always the real system prompt and stays;
|
|
279
|
+
* anything after it must not reach the provider as a second system message
|
|
280
|
+
* (see gemini.ts/anthropic.ts, which hoist ALL role:"system" messages into a
|
|
281
|
+
* single system instruction). Rewrite those as wrapped user turns in place —
|
|
282
|
+
* this is a read-time fixup, not a migration, so no version bump is needed.
|
|
283
|
+
*/
|
|
284
|
+
function normalizeStraySystemMessages(messages: LLMMessage[]): LLMMessage[] {
|
|
285
|
+
return messages.map((m, i) => {
|
|
286
|
+
if (i === 0 || m.role !== "system" || typeof m.content !== "string") return m;
|
|
287
|
+
return { ...m, role: "user" as const, content: formatInternalEvent("legacy_internal", m.content) };
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
|
|
271
291
|
export function deserializeCheckpoint(run: AgentRunDoc): RunCheckpointState | null {
|
|
272
292
|
if (!run.state_json) return null;
|
|
273
293
|
try {
|
|
274
294
|
const raw = JSON.parse(run.state_json);
|
|
275
295
|
if (raw.version !== 1) return null;
|
|
276
|
-
|
|
296
|
+
const state = raw as RunCheckpointState;
|
|
297
|
+
return { ...state, messages: normalizeStraySystemMessages(state.messages) };
|
|
277
298
|
} catch {
|
|
278
299
|
log.warn(`[deserializeCheckpoint] Failed to parse state_json for run ${run.id}`);
|
|
279
300
|
return null;
|
|
@@ -371,4 +392,4 @@ export function stopLeaseRenewal(runId: string): void {
|
|
|
371
392
|
export function stopAllLeaseRenewals(): void {
|
|
372
393
|
for (const [, timer] of leaseTimers) clearInterval(timer);
|
|
373
394
|
leaseTimers.clear();
|
|
374
|
-
}
|
|
395
|
+
}
|
|
@@ -161,8 +161,8 @@ export class AgentService {
|
|
|
161
161
|
*/
|
|
162
162
|
async reloadSkills(): Promise<void> {
|
|
163
163
|
log.info("Reloading skills...")
|
|
164
|
-
const {
|
|
165
|
-
await
|
|
164
|
+
const { syncSkillsToIndex } = await import("./context-compiler")
|
|
165
|
+
await syncSkillsToIndex()
|
|
166
166
|
log.info("Skills reloaded")
|
|
167
167
|
}
|
|
168
168
|
|