@johpaz/hive-agents 0.0.47 → 1.0.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/LICENSE +21 -0
- package/README.md +119 -902
- package/dist/hive.js +68840 -68355
- package/dist/tool-worker.js +220 -925
- package/dist/ui/assets/A2UIPage-D4nUFe5q.js +8 -0
- package/dist/ui/assets/AgentCreateForm-g1mQnIoJ.js +1 -0
- package/dist/ui/assets/AgentDetailPage-C3XkU4Ll.js +1 -0
- package/dist/ui/assets/AgentNewPage-CEkLeA79.js +1 -0
- package/dist/ui/assets/AgentsPage-CNA778Eo.js +10 -0
- package/dist/ui/assets/ApiClientPage-t5DpKhmA.js +3 -0
- package/dist/ui/assets/ChannelsPage-yY6t0YTU.js +8 -0
- package/dist/ui/assets/DashboardPage-BSeNSYg5.js +6 -0
- package/dist/ui/assets/{LoginPage-BTxJdFVG.js → LoginPage-eT5zDRDa.js} +1 -1
- package/dist/ui/assets/{LogsPage-DVV2eHbh.js → LogsPage-Gczzzsdh.js} +1 -1
- package/dist/ui/assets/MeetingPage-Bu4aMMNR.js +1 -0
- package/dist/ui/assets/ModelSelector-nNOrW3te.js +1 -0
- package/dist/ui/assets/{NotFound-BIUDlIXU.js → NotFound-Bpr12V51.js} +1 -1
- package/dist/ui/assets/Office3DPage-B_iXEbyv.js +4614 -0
- package/dist/ui/assets/Office3DPage-C3SIzd2H.css +1 -0
- package/dist/ui/assets/ProvidersPage-BupHs5yO.js +1 -0
- package/dist/ui/assets/{RecoverPage-7YDQysBL.js → RecoverPage-DMqSasKk.js} +1 -1
- package/dist/ui/assets/SettingsPage-B6FTSkOn.js +9 -0
- package/dist/ui/assets/SetupPage-DhcRbGgg.js +1 -0
- package/dist/ui/assets/WebChatPage-CWXjW4Hn.js +29 -0
- package/dist/ui/assets/{activity-c3pNngT_.js → activity-CQuPevhB.js} +1 -1
- package/dist/ui/assets/agentCapabilities-CDC6y91E.js +1 -0
- package/dist/ui/assets/alert-CQlRq6sv.js +1 -0
- package/dist/ui/assets/arrow-left-0EBE7nsF.js +1 -0
- package/dist/ui/assets/arrow-right-5QIaph-z.js +1 -0
- package/dist/ui/assets/arrow-up-right-DQQCY007.js +1 -0
- package/dist/ui/assets/badge-DKGZbVZJ.js +1 -0
- package/dist/ui/assets/{calendar-B-KZ9RQO.js → calendar-Be23hQGc.js} +1 -1
- package/dist/ui/assets/{card-CNf6BS2e.js → card-D3Nw3kh3.js} +1 -1
- package/dist/ui/assets/check-Dp6tzwax.js +1 -0
- package/dist/ui/assets/chevron-down-33N886NY.js +1 -0
- package/dist/ui/assets/chevron-left-C6itJXh3.js +1 -0
- package/dist/ui/assets/chevron-right-CFodBS-b.js +1 -0
- package/dist/ui/assets/chevron-up-BvSmyBEs.js +1 -0
- package/dist/ui/assets/{circle-alert-KuAm2FWh.js → circle-alert-BDVHxmAz.js} +1 -1
- package/dist/ui/assets/circle-check-BJWNbLuF.js +1 -0
- package/dist/ui/assets/{circle-x-DjLkFDO8.js → circle-x-Cb2Yer4s.js} +1 -1
- package/dist/ui/assets/{copy-Bu5d7C-0.js → copy-33tZrzc9.js} +1 -1
- package/dist/ui/assets/{dialog-Jk4bieO4.js → dialog-KOZKWbib.js} +1 -1
- package/dist/ui/assets/dist-CD_qfA30.js +1 -0
- package/dist/ui/assets/{download-Cjbk4Rek.js → download-CiQqqXyz.js} +1 -1
- package/dist/ui/assets/earth-DCvN7ynm.js +1 -0
- package/dist/ui/assets/ellipsis-vertical-BybFZDk2.js +1 -0
- package/dist/ui/assets/{external-link-6sTlRDUR.js → external-link-0iNNBvZm.js} +1 -1
- package/dist/ui/assets/{eye-Df8o0tkC.js → eye-C8sKSSkg.js} +1 -1
- package/dist/ui/assets/{file-text-lnxnjBp0.js → file-text-DO8jqiJK.js} +1 -1
- package/dist/ui/assets/{gateway-url-DwzPmoc8.js → gateway-url-BlnabM5e.js} +1 -1
- package/dist/ui/assets/gauge-BRGwuN8G.js +1 -0
- package/dist/ui/assets/{history-CAF_R34_.js → history-BtTD1kDo.js} +1 -1
- package/dist/ui/assets/index-Bejlp-R1.js +116 -0
- package/dist/ui/assets/index-XoTT41Hr.css +2 -0
- package/dist/ui/assets/{info-WjromB4Y.js → info-mpk1tsNC.js} +1 -1
- package/dist/ui/assets/key-CoQ0qtXt.js +1 -0
- package/dist/ui/assets/label-k0jYxoWW.js +1 -0
- package/dist/ui/assets/loader-circle-BhqRN2nO.js +1 -0
- package/dist/ui/assets/lock-open-Cd2aqwOd.js +1 -0
- package/dist/ui/assets/mail-BG0RYSkL.js +1 -0
- package/dist/ui/assets/{pause-VqeUmp2Z.js → pause-Cme88_9s.js} +1 -1
- package/dist/ui/assets/pencil-f1nJ1xhs.js +1 -0
- package/dist/ui/assets/play-CfYDHD6h.js +1 -0
- package/dist/ui/assets/plus-C5BxJeOX.js +1 -0
- package/dist/ui/assets/progress-DrI2UDu-.js +1 -0
- package/dist/ui/assets/radio-B5SpKJ-J.js +1 -0
- package/dist/ui/assets/{refresh-cw-CCzDCAuz.js → refresh-cw-CroGQY62.js} +1 -1
- package/dist/ui/assets/scroll-area-CfHn94Vb.js +1 -0
- package/dist/ui/assets/search-rfBcmohK.js +1 -0
- package/dist/ui/assets/select-BhbW0stK.js +1 -0
- package/dist/ui/assets/{send-BPk9XbIq.js → send-D6whYpw-.js} +1 -1
- package/dist/ui/assets/{settings-BGfrZ_zM.js → settings-BX6q3MGB.js} +1 -1
- package/dist/ui/assets/{shield-CxhcUT39.js → shield-BnGyu1xf.js} +1 -1
- package/dist/ui/assets/slider-CmE_z1Ii.js +1 -0
- package/dist/ui/assets/{sparkles-BhwlS1pc.js → sparkles-BcaOs_Jk.js} +1 -1
- package/dist/ui/assets/{square-DMNWw4Hi.js → square-ju5H8nrT.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-Bjfu-TkS.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-DjQXac_0.js} +1 -1
- package/dist/ui/assets/{triangle-alert-pVIJGjga.js → triangle-alert-B04mgMcg.js} +1 -1
- package/dist/ui/assets/{useHiveAgentsModelLoad-BnC4jLE-.js → useHiveAgentsModelLoad-DT5-4CCj.js} +1 -1
- package/dist/ui/assets/useOfficeModel-Cy7cAyEn.js +1 -0
- package/dist/ui/assets/useProviders-DSX7eVsz.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-qnVxkRSM.js +1 -0
- package/dist/ui/assets/wifi-BA1m2dGO.js +1 -0
- package/dist/ui/assets/{zap-B4RaNNO5.js → zap-DT7cM7YS.js} +1 -1
- package/dist/ui/index.html +10 -9
- package/package.json +8 -9
- 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 +45 -1
- package/packages/cli/src/commands/gateway.ts +2 -9
- package/packages/cli/src/index.ts +9 -11
- package/packages/core/src/agent/acceptance-verifier.ts +300 -0
- package/packages/core/src/agent/agent-catalog.ts +384 -0
- package/packages/core/src/agent/agent-loop.ts +185 -28
- package/packages/core/src/agent/capability-search.ts +5 -5
- package/packages/core/src/agent/catalog-selector.ts +104 -0
- package/packages/core/src/agent/compaction.ts +36 -41
- package/packages/core/src/agent/context-compiler.ts +182 -62
- 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 +248 -0
- package/packages/core/src/agent/index.ts +17 -0
- package/packages/core/src/agent/llm-providers/hiveagents.ts +1 -1
- package/packages/core/src/agent/llm-providers/interface.ts +3 -3
- package/packages/core/src/agent/llm-providers/openai-compat-base.ts +1 -1
- package/packages/core/src/agent/minimal-loadout.ts +46 -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 +15 -1
- package/packages/core/src/agent/providers/index.ts +8 -3
- 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 +36 -35
- 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 +165 -69
- package/packages/core/src/canvas/index.ts +0 -2
- package/packages/core/src/channels/base.ts +3 -1
- package/packages/core/src/channels/webchat.ts +4 -8
- package/packages/core/src/config/loader.ts +0 -22
- package/packages/core/src/events/agent-bus.ts +0 -31
- package/packages/core/src/events/narration.ts +82 -0
- package/packages/core/src/gateway/channel-notify.ts +34 -5
- package/packages/core/src/gateway/delegation-groups.ts +245 -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 +12 -7
- package/packages/core/src/gateway/helpers/redact.ts +1 -1
- package/packages/core/src/gateway/initializer.ts +15 -13
- package/packages/core/src/gateway/job-executors.ts +232 -101
- 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 +1 -23
- 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/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/providers.ts +1 -0
- package/packages/core/src/gateway/routes/setup.ts +29 -24
- package/packages/core/src/gateway/routes/skills.ts +2 -2
- package/packages/core/src/gateway/routes/system.ts +23 -5
- package/packages/core/src/gateway/routes/users.ts +24 -1
- package/packages/core/src/gateway/server.ts +153 -117
- 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 +34 -8
- 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 +25 -5
- package/packages/core/src/storage/collections.ts +201 -27
- package/packages/core/src/storage/onboarding.ts +147 -32
- package/packages/core/src/storage/reconcile.ts +2 -5
- package/packages/core/src/storage/seed.ts +196 -34
- package/packages/core/src/storage/usage.ts +0 -9
- 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 +392 -83
- 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 +17 -45
- 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-screenshot.ts +26 -5
- package/packages/core/src/tools/web/index.ts +3 -0
- package/packages/core/src/utils/logger.ts +58 -30
- package/packages/core/src/utils/toon.ts +0 -20
- 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/acceptance_verification/SKILL.md +26 -0
- package/packages/skills/src/bundled/agents/agent_spawner/SKILL.md +24 -18
- package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +47 -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 +690 -1255
- 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
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
UserDoc, ProviderDoc, ModelDoc, AgentDoc, ChannelDoc, McpServerDoc,
|
|
14
14
|
UserIdentityDoc, OnboardingProgressDoc, EthicsDoc, SkillDoc, ToolDoc,
|
|
15
15
|
} from "./collections";
|
|
16
|
+
import { normalizeUserEmail } from "./user-email";
|
|
16
17
|
|
|
17
18
|
export interface OnboardingSection {
|
|
18
19
|
step: "user" | "skills" | "ethics" | "tools" | "provider" | "model" | "channel" | "mcp" | "agent" | "complete";
|
|
@@ -26,54 +27,131 @@ const log = logger.child("onboarding");
|
|
|
26
27
|
const HIVE_SYSTEM_PROMPT = `
|
|
27
28
|
# HIVE — Agente Coordinador
|
|
28
29
|
|
|
29
|
-
Sos Bee, coordinador de Hive.
|
|
30
|
+
Sos Bee, coordinador de Hive. Sos el único agente que conversa con el usuario, y no trabajás solo: dirigís una colmena de workers especializados que corren en paralelo.
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
**Tu oficio es repartir trabajo, no hacerlo todo vos.** Ante cada pedido buscás primero quién puede resolverlo; solo lo hacés con tus propias manos cuando no hay nadie que lo cubra.
|
|
32
33
|
|
|
33
|
-
1.
|
|
34
|
-
2. **Confirmá antes de guardar** — Siempre verificá con el usuario antes de persistir datos en la BD.
|
|
35
|
-
3. **Buscá antes de crear** — Usá search_knowledge para capacidades, find_agent para workers.
|
|
36
|
-
4. **Mínimo privilegio** — Asigná solo las tools necesarias a cada worker.
|
|
37
|
-
5. **Nunca cli_exec para cron** — Usá siempre cron.create para tareas programadas.
|
|
38
|
-
6. **Preguntá si no encontrás nada** — Si \`search_knowledge\` no devuelve resultados y el pedido es corto o ambiguo, preguntale al usuario qué quiere decir o dónde buscar (web, sus archivos, una herramienta puntual) en vez de adivinar la intención y encadenar más búsquedas por tu cuenta. Una pregunta cuesta un turno; adivinar mal cuesta varios.
|
|
39
|
-
## 🔍 DISCOVERY — CÓMO ENCONTRAR MÁS CAPACIDADES
|
|
34
|
+
## 1. ANTES DE ACTUAR
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
Leé el pedido completo y mirá lo que ya sabés: la sección SCRATCHPAD trae tus notas de esta conversación y \`memory_read\` / \`memory_search\` lo guardado en conversaciones anteriores. No rehagas trabajo ya hecho ni vuelvas a preguntar algo que ya te dijeron.
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
- \`search_knowledge(type="mcp", query="listar bases datos")\` → herramientas MCP externas
|
|
45
|
-
- \`search_knowledge(type="skills", query="debuggear código")\` → skills (instrucciones de tareas)
|
|
46
|
-
- \`search_knowledge(type="playbook", query="seguridad")\` → playbook (buenas prácticas)
|
|
47
|
-
- \`search_knowledge(type="all", query="buscar web internet")\` → busca en todo
|
|
38
|
+
**Si es un saludo, una charla o una pregunta que respondés de memoria: respondé y terminá.** Eso no se delega nunca ni necesita herramientas.
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
## 2. DESCOMPONER
|
|
50
41
|
|
|
51
|
-
|
|
42
|
+
Separá el pedido en partes y clasificá cada una:
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
| Tipo de parte | Qué hacés |
|
|
45
|
+
|---|---|
|
|
46
|
+
| Independientes entre sí | Van juntas, en paralelo, en este mismo turno |
|
|
47
|
+
| Una necesita el resultado de otra | Va en una fase posterior |
|
|
48
|
+
| Trivial o conversacional | La resolvés vos, sin herramientas |
|
|
54
49
|
|
|
55
|
-
|
|
50
|
+
## 3. POR CADA PARTE: ¿HAY UN AGENTE QUE LA HAGA?
|
|
56
51
|
|
|
57
|
-
**
|
|
52
|
+
**Esta es la pregunta central de tu rol, y contestarla es gratis:** el roster está en la sección COLMENA DE AGENTES de este mismo prompt, no hace falta ninguna llamada para consultarlo.
|
|
58
53
|
|
|
59
|
-
|
|
54
|
+
1. **¿Encaja un agente de la colmena?** → \`task_delegate\`. Este es el camino por defecto.
|
|
55
|
+
2. **¿Ninguno encaja?** → \`agent_find\` por si existe un worker propio para esa especialidad.
|
|
56
|
+
3. **¿Tampoco hay?** → recién ahí \`search_knowledge\` para encontrar las herramientas. Preferí siempre herramientas nativas sobre MCP.
|
|
57
|
+
4. **Si encontraste una tool nativa** → resolvelo vos directamente.
|
|
58
|
+
5. **Si al menos una parte requiere MCP**:
|
|
59
|
+
- Agrupá las tools por \`server_id\` y usá \`agent_find\` para buscar un especialista del usuario que ya tenga ese servidor.
|
|
60
|
+
- Si existe y está habilitado, delegale la parte correspondiente. No preguntes ni crees otro.
|
|
61
|
+
- Si no existe, **antes de ejecutar cualquier tool de ese servidor**, preguntale al usuario si quiere crear un agente persistente para esa integración.
|
|
62
|
+
- Si acepta: usá \`get_available_models\`, descubrí \`agent_create\`, creá un worker con \`mcp_server_id\` y delegale la tarea actual. El agente recibe todas las tools actuales y futuras de ese servidor.
|
|
63
|
+
- Si rechaza: ejecutá vos directamente las tools MCP necesarias solo para esta solicitud.
|
|
64
|
+
- Si intervienen varios servidores sin especialista, tratá cada servidor por separado: un agente por servidor, nunca uno combinado.
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
### CALENDARIO NO ES CRON
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
- \`schedule_automation_agent\` administra jobs que Hive ejecutará después: tareas recurrentes, reportes automáticos, monitoreos y recordatorios de una sola ejecución.
|
|
69
|
+
- Crear, consultar o modificar eventos, citas o reuniones; invitar asistentes; o revisar disponibilidad pertenece al servidor de calendario y a su especialista MCP.
|
|
70
|
+
- Una frase como “agenda una reunión” significa calendario, no \`cron.create\`. Solo usá cron cuando el usuario quiere que Hive ejecute una instrucción en el futuro.
|
|
64
71
|
|
|
65
|
-
|
|
72
|
+
Si \`search_knowledge\` no devuelve nada y el pedido es corto o ambiguo, **preguntale al usuario** en vez de adivinar y encadenar más búsquedas. Una pregunta cuesta un turno; adivinar mal cuesta varios.
|
|
66
73
|
|
|
67
|
-
|
|
68
|
-
- \`memory_write\` / \`memory_read\` — Memoria cross-conversación por clave
|
|
69
|
-
- Playbook — Reglas aprendidas inyectadas automáticamente
|
|
74
|
+
## 4. DELEGAR EN PARALELO
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
Las partes independientes se lanzan **todas en el mismo turno**: una \`task_delegate\` por parte, con \`mode="async"\`. Hive las agrupa por turno y los workers corren simultáneamente.
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
Si el usuario pide tres cosas que no dependen entre sí, son tres \`task_delegate\` en la misma respuesta — no una, esperar, y después la siguiente. **Paralelizar es el caso normal, no la excepción.**
|
|
79
|
+
|
|
80
|
+
Cada delegación lleva: \`worker_id\`, una subtarea acotada, contexto mínimo y \`acceptance\` verificable. Antes de delegar, si el worker va a necesitar herramientas puntuales, buscalas con \`search_knowledge\` e incluilas en la instrucción. Reservá \`mode="sync"\` solo para un lookup cuyo resultado esperás en segundos.
|
|
81
|
+
|
|
82
|
+
## 5. ESPERAR: NO ESPERÁS
|
|
83
|
+
|
|
84
|
+
Después de delegar, contale al usuario en una línea qué pusiste a correr y **terminá tu turno**.
|
|
85
|
+
|
|
86
|
+
Cuando todas las tareas del turno alcanzan estado terminal, Hive te reinvoca automáticamente con un mensaje \`[Sistema]\` que trae el resultado de cada una.
|
|
87
|
+
|
|
88
|
+
- **No hagas polling** con \`task_status\` en loop. Usalo solo si el usuario pide el estado antes de tiempo.
|
|
89
|
+
- No anuncies resultados que todavía no tenés ni declares éxito antes del \`[Sistema]\`.
|
|
90
|
+
- No re-delegues una tarea porque "no contestó": ya está encolada.
|
|
91
|
+
|
|
92
|
+
## 6. CERRAR
|
|
93
|
+
|
|
94
|
+
Al recibir el \`[Sistema]\`, escribí **una sola** respuesta final integrando todo. Las entradas con \`ok=false\` se reportan con su motivo real, nunca como éxito.
|
|
95
|
+
|
|
96
|
+
Guardá lo que vaya a servir después: \`save_note\` para esta conversación, \`memory_write\` para lo que deba sobrevivir a ella. Confirmá con el usuario antes de persistir datos suyos.
|
|
97
|
+
|
|
98
|
+
## REGLAS PERMANENTES
|
|
99
|
+
|
|
100
|
+
1. **Ética primero** — Operás bajo un Código de Ética obligatorio que no podés ignorar.
|
|
101
|
+
2. **Verdad de ejecución** — \`TaskDoc\`/\`JobDoc\` son la fuente de verdad. \`agent_find\` solo descubre workers; nunca prueba si algo está corriendo: para eso están \`task_list\` y \`task_status\`. Si \`task_delegate\` devuelve \`ok=true\` con \`task_id\`, \`job_id\` y \`run_id\`, la tarea se persistió de verdad y no es una simulación. Si una herramienta falla, reportá su resultado exacto: no inventes IDs, estados ni ejecuciones.
|
|
102
|
+
3. **La verificación es automática** — toda entrega pasa por el verificador independiente antes de que \`task_delegate\` devuelva \`ok=true\`. Nunca delegues a \`acceptance_verifier\` vos mismo. Si un worker devuelve \`needs_input\`, vos formulás la pregunta al usuario con contexto.
|
|
103
|
+
4. **Buscá antes de crear** — nunca crees un worker si el catálogo ya cubre la tarea.
|
|
104
|
+
5. **Mínimo privilegio** — solo las herramientas necesarias a cada worker. La única excepción explícita es un especialista MCP aprobado por el usuario: recibe el servidor completo que figura en \`mcp_server_ids_json\`, nunca otros servidores.
|
|
105
|
+
6. **Nunca \`cli_exec\` para cron** — usá \`cron.create\`, y preguntá al usuario cada cuánto ejecutar.
|
|
106
|
+
7. **Calendario ≠ cron** — los eventos y reuniones van al especialista MCP de calendario; cron solo programa futuras ejecuciones de Hive.
|
|
107
|
+
|
|
108
|
+
## QUÉ HAY EN TU CONTEXTO
|
|
109
|
+
|
|
110
|
+
- **COLMENA DE AGENTES** — los workers disponibles ahora mismo. Consultalo antes de decidir nada.
|
|
111
|
+
- **HERRAMIENTAS SIEMPRE DISPONIBLES** — con las que arrancás cada turno. El resto se descubre con \`search_knowledge\` y queda usable de inmediato.
|
|
112
|
+
- **SCRATCHPAD** — tus notas de esta conversación; sobreviven a la compresión del historial.
|
|
113
|
+
- **PLAYBOOK APRENDIDO** — reglas aprendidas de turnos anteriores, ya filtradas por relevancia. Aplicalas.
|
|
114
|
+
- **SKILLS DESCUBIERTAS** — nombres de skills que el sistema considera relevantes para este pedido. Son una pista, no instrucciones: su contenido llega cuando descubrís sus herramientas con \`search_knowledge\`.
|
|
115
|
+
|
|
116
|
+
## CANALES
|
|
117
|
+
|
|
118
|
+
webchat (siempre activo) · telegram · discord · slack · whatsapp. Preferencia para cron: telegram > discord > webchat.
|
|
75
119
|
`
|
|
76
120
|
|
|
121
|
+
/**
|
|
122
|
+
* First line of every stock coordinator prompt ever shipped. Used to tell a
|
|
123
|
+
* stock prompt (safe to upgrade in place) from one the user rewrote through
|
|
124
|
+
* the agents API, which must never be clobbered.
|
|
125
|
+
*/
|
|
126
|
+
const HIVE_PROMPT_STOCK_HEADER = "# HIVE — Agente Coordinador";
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Upgrades coordinators still carrying an older stock prompt.
|
|
130
|
+
*
|
|
131
|
+
* HIVE_SYSTEM_PROMPT is only written during onboarding/setup, so an install
|
|
132
|
+
* created before a prompt change keeps the old text in `agents.system_prompt`
|
|
133
|
+
* forever — new coordinator behavior would never reach existing users. This
|
|
134
|
+
* runs on every boot and rewrites only rows whose prompt is verbatim stock
|
|
135
|
+
* (starts with the stock header and differs from the current text). A prompt
|
|
136
|
+
* the user customized doesn't match and is left untouched.
|
|
137
|
+
*/
|
|
138
|
+
export async function refreshCoordinatorPrompts(): Promise<number> {
|
|
139
|
+
const agentsCol = await col<AgentDoc>("agents");
|
|
140
|
+
let updated = 0;
|
|
141
|
+
for (const entry of await agentsCol.findBy("role", "coordinator")) {
|
|
142
|
+
const current = entry.doc.system_prompt ?? "";
|
|
143
|
+
if (current === HIVE_SYSTEM_PROMPT) continue;
|
|
144
|
+
if (!current.trimStart().startsWith(HIVE_PROMPT_STOCK_HEADER)) continue; // user-authored
|
|
145
|
+
await agentsCol.put(entry.id, {
|
|
146
|
+
...entry.doc,
|
|
147
|
+
system_prompt: HIVE_SYSTEM_PROMPT,
|
|
148
|
+
updated_at: Date.now(),
|
|
149
|
+
}, { expectedVersion: entry.version });
|
|
150
|
+
updated++;
|
|
151
|
+
}
|
|
152
|
+
return updated;
|
|
153
|
+
}
|
|
154
|
+
|
|
77
155
|
/** Generates a 32-char lowercase hex id, matching the old `lower(hex(randomblob(16)))` scheme. */
|
|
78
156
|
function genId(): string {
|
|
79
157
|
return crypto.randomUUID().replace(/-/g, "");
|
|
@@ -92,6 +170,7 @@ export async function initOnboardingDb(): Promise<void> {
|
|
|
92
170
|
export async function saveUserProfile(data: {
|
|
93
171
|
userId?: string;
|
|
94
172
|
userName?: string;
|
|
173
|
+
userEmail?: string;
|
|
95
174
|
userLanguage?: string;
|
|
96
175
|
userTimezone?: string;
|
|
97
176
|
userOccupation?: string;
|
|
@@ -105,6 +184,9 @@ export async function saveUserProfile(data: {
|
|
|
105
184
|
try {
|
|
106
185
|
const usersCol = await col<UserDoc>("users");
|
|
107
186
|
let finalUserId = data.userId;
|
|
187
|
+
const normalizedEmail = data.userEmail !== undefined
|
|
188
|
+
? normalizeUserEmail(data.userEmail)
|
|
189
|
+
: undefined;
|
|
108
190
|
|
|
109
191
|
if (!finalUserId) {
|
|
110
192
|
finalUserId = genId();
|
|
@@ -116,7 +198,7 @@ export async function saveUserProfile(data: {
|
|
|
116
198
|
occupation: data.userOccupation || null,
|
|
117
199
|
notes: data.userNotes || null,
|
|
118
200
|
master_key_hash: null,
|
|
119
|
-
email: null,
|
|
201
|
+
email: normalizedEmail ?? null,
|
|
120
202
|
password_hash: null,
|
|
121
203
|
preferred_cron_channel: "auto",
|
|
122
204
|
created_at: Date.now(),
|
|
@@ -132,7 +214,7 @@ export async function saveUserProfile(data: {
|
|
|
132
214
|
occupation: data.userOccupation ?? existing?.doc.occupation ?? null,
|
|
133
215
|
notes: data.userNotes ?? existing?.doc.notes ?? null,
|
|
134
216
|
master_key_hash: existing?.doc.master_key_hash ?? null,
|
|
135
|
-
email: existing?.doc.email ?? null,
|
|
217
|
+
email: normalizedEmail ?? existing?.doc.email ?? null,
|
|
136
218
|
password_hash: existing?.doc.password_hash ?? null,
|
|
137
219
|
preferred_cron_channel: existing?.doc.preferred_cron_channel ?? "auto",
|
|
138
220
|
created_at: existing?.doc.created_at ?? Date.now(),
|
|
@@ -285,6 +367,7 @@ export async function saveProviderConfig(data: {
|
|
|
285
367
|
await modelsCol.put(data.model, {
|
|
286
368
|
id: data.model, provider_id: "ollama", name: data.model, model_type: "llm",
|
|
287
369
|
context_window: 0, capabilities: null, enabled: true, active: true,
|
|
370
|
+
source: "discovered",
|
|
288
371
|
});
|
|
289
372
|
}
|
|
290
373
|
}
|
|
@@ -314,6 +397,30 @@ export async function activateMcpServers(userId: string, mcpIds: string[]): Prom
|
|
|
314
397
|
}
|
|
315
398
|
}
|
|
316
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Seeds every non-coordinator agent with the provider/model the user just
|
|
402
|
+
* configured for the coordinator. Onboarding is the one moment where
|
|
403
|
+
* overwriting is right: the user is (re)choosing the main model, so the whole
|
|
404
|
+
* hive follows it. The boot-time counterpart (`ensureAgentsConfigured`) only
|
|
405
|
+
* fills the blanks.
|
|
406
|
+
*
|
|
407
|
+
* Note: an agent with `model_override_json` (the acceptance verifier asks for
|
|
408
|
+
* a different model family) stops consulting that override once its row has
|
|
409
|
+
* an explicit pair — `resolveAgentModel()` returns the row first.
|
|
410
|
+
*/
|
|
411
|
+
export async function propagateCoordinatorModel(
|
|
412
|
+
userId: string,
|
|
413
|
+
providerId: string,
|
|
414
|
+
modelId: string,
|
|
415
|
+
): Promise<number> {
|
|
416
|
+
const { applyCoordinatorModel } = await import("../agent/agent-catalog");
|
|
417
|
+
const updated = await applyCoordinatorModel({ userId, providerId, modelId, overwrite: true });
|
|
418
|
+
if (updated > 0) {
|
|
419
|
+
log.info(`✅ ${updated} agente(s) sincronizados con el modelo del coordinador`, { providerId, modelId });
|
|
420
|
+
}
|
|
421
|
+
return updated;
|
|
422
|
+
}
|
|
423
|
+
|
|
317
424
|
export async function saveAgentConfig(data: {
|
|
318
425
|
userId: string;
|
|
319
426
|
agentId?: string;
|
|
@@ -375,6 +482,14 @@ export async function saveAgentConfig(data: {
|
|
|
375
482
|
}, existing ? { expectedVersion: existing.version } : undefined);
|
|
376
483
|
}
|
|
377
484
|
|
|
485
|
+
// Seed the rest of the hive (catalog personas + any worker) with the
|
|
486
|
+
// coordinator's pair. Skipped while the pair is still incomplete — the CLI
|
|
487
|
+
// onboarding creates the coordinator first and only picks provider/model a
|
|
488
|
+
// few steps later, and that later call re-enters here with both set.
|
|
489
|
+
if (safeProviderId && safeModelId) {
|
|
490
|
+
await propagateCoordinatorModel(data.userId, safeProviderId, safeModelId);
|
|
491
|
+
}
|
|
492
|
+
|
|
378
493
|
return finalAgentId;
|
|
379
494
|
} catch (e) {
|
|
380
495
|
log.error("⚠️ Error saving agent:", { error: (e as Error).message });
|
|
@@ -139,13 +139,10 @@ export async function reconcileOnBoot(bootId: string): Promise<ReconcileResult>
|
|
|
139
139
|
log.warn(`[reconcileOnBoot] Failed to repair jobQueue: ${(err as Error).message}`);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
// 5. tasks: in_progress
|
|
142
|
+
// 5. tasks: in_progress without a live job → pending (attempts+1) or failed
|
|
143
143
|
try {
|
|
144
144
|
const tasksCol = await col<TaskDoc>("tasks");
|
|
145
|
-
const inProgress =
|
|
146
|
-
...(await tasksCol.findBy("status", "in_progress")),
|
|
147
|
-
...(await tasksCol.findBy("status", "queued")),
|
|
148
|
-
];
|
|
145
|
+
const inProgress = await tasksCol.findBy("status", "in_progress");
|
|
149
146
|
const { getJob } = await import("../gateway/job-store");
|
|
150
147
|
for (const entry of inProgress) {
|
|
151
148
|
const task = entry.doc;
|
|
@@ -34,10 +34,12 @@ export const SEED_DATA: SeedData = {
|
|
|
34
34
|
// ─────────────────────────────────────────
|
|
35
35
|
// 2. WEB — Búsqueda, navegación + automatización
|
|
36
36
|
// ─────────────────────────────────────────
|
|
37
|
+
{ id: "api_request", name: "api_request", category: "api", description: "Ejecutar una petición HTTP autorizada contra un endpoint REST y validar la respuesta. Sinónimos: llamar api, request rest, consumir endpoint, petición http, hacer get, hacer post" },
|
|
37
38
|
{ id: "web_search", name: "web_search", category: "web", description: "Buscar en la web información actual y noticias. Sinónimos: búsqueda web, noticias, información, buscar en internet, google" },
|
|
38
39
|
{ 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" },
|
|
39
40
|
{ 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" },
|
|
40
41
|
{ 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" },
|
|
42
|
+
{ 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" },
|
|
41
43
|
{ 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" },
|
|
42
44
|
{ id: "browser_type", name: "browser_type", category: "web", description: "Escribir texto en un campo de formulario. Sinónimos: escribir formulario, tipear, campo de texto, input, llenar campo" },
|
|
43
45
|
{ id: "browser_extract", name: "browser_extract", category: "web", description: "Extraer texto, enlaces o datos estructurados usando selectores CSS o XPath. Sinónimos: obtener datos, scraping, selectores, extraer información" },
|
|
@@ -47,7 +49,7 @@ export const SEED_DATA: SeedData = {
|
|
|
47
49
|
// ─────────────────────────────────────────
|
|
48
50
|
// 3. CRON — Tareas programadas (Croner-based)
|
|
49
51
|
// ─────────────────────────────────────────
|
|
50
|
-
{ id: "cron.create", name: "cron.create", category: "cron", description: "Crear
|
|
52
|
+
{ 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" },
|
|
51
53
|
{ 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" },
|
|
52
54
|
{ id: "cron.update", name: "cron.update", category: "cron", description: "Actualizar tarea programada existente: cambiar expresión, instrucción, canal, ventana temporal. Sinónimos: modificar cron, editar recordatorio, cambiar horario, actualizar tarea" },
|
|
53
55
|
{ id: "cron.pause", name: "cron.pause", category: "cron", description: "Pausar temporalmente una tarea programada sin eliminarla. Sinónimos: pausar tarea programada, detener temporalmente, suspender recordatorio" },
|
|
@@ -70,39 +72,22 @@ export const SEED_DATA: SeedData = {
|
|
|
70
72
|
{ id: "memory_search", name: "memory_search", category: "agents", description: "Buscar memorias por palabra clave. Sinónimos: buscar memoria, encontrar recuerdo, buscar dato guardado" },
|
|
71
73
|
{ id: "memory_delete", name: "memory_delete", category: "agents", description: "Eliminar una entrada de memoria específica. Sinónimos: borrar memoria, eliminar recuerdo, quitar dato" },
|
|
72
74
|
{ id: "get_available_models", name: "get_available_models", category: "agents", description: "Obtener lista de providers y modelos activos de la BD. Sinónimos: ver modelos, listar providers, modelos disponibles, consultar modelos, provider activo, qué modelos tengo, modelos para código, modelos para chat" },
|
|
73
|
-
{ id: "agent_create", name: "agent_create", category: "agents", description: "Crear un nuevo agente worker especializado. Sinónimos: crear agente, nuevo worker, nuevo trabajador" },
|
|
74
|
-
{ id: "agent_find", name: "agent_find", category: "agents", description: "
|
|
75
|
+
{ id: "agent_create", name: "agent_create", category: "agents", description: "Crear un nuevo agente worker especializado; puede asignar un servidor MCP persistente después de la confirmación del usuario. Sinónimos: crear agente, nuevo worker, nuevo trabajador" },
|
|
76
|
+
{ id: "agent_find", name: "agent_find", category: "agents", description: "Descubrir agentes worker disponibles: catálogo global del sistema y workers privados del usuario. No indica ejecución; para eso usar task_list. Sinónimos: buscar agente, encontrar worker, localizar agente" },
|
|
75
77
|
{ id: "agent_archive", name: "agent_archive", category: "agents", description: "Archivar o terminar un agente worker. Sinónimos: archivar agente, terminar worker, desactivar agente" },
|
|
76
78
|
{ id: "task_delegate", name: "task_delegate", category: "agents", description: "Delegar una tarea general a un agente worker específico. Sinónimos: delegar tarea, asignar worker, ejecutar por agente" },
|
|
77
|
-
{ id: "
|
|
79
|
+
{ id: "task_list", name: "task_list", category: "agents", description: "Listar ejecuciones reales de tareas delegadas del usuario, consultando tareas y jobs persistidos. Sinónimos: listar tareas activas, ver subagentes trabajando, ejecuciones reales" },
|
|
78
80
|
{ id: "task_status", name: "task_status", category: "agents", description: "Obtener estado de ejecución de tareas delegadas. Sinónimos: estado tarea delegada, verificar progreso, consultar tarea" },
|
|
79
81
|
{ id: "bus_publish", name: "bus_publish", category: "agents", description: "Publicar mensaje en el Agent Bus para comunicación worker-to-worker. Sinónimos: publicar mensaje, comunicar workers, enviar bus" },
|
|
80
82
|
{ id: "bus_read", name: "bus_read", category: "agents", description: "Leer mensajes no leídos del Agent Bus. Sinónimos: leer mensajes bus, recibir mensajes, verificar bus" },
|
|
81
83
|
|
|
82
84
|
// ─────────────────────────────────────────
|
|
83
|
-
// 6.
|
|
84
|
-
// ─────────────────────────────────────────
|
|
85
|
-
{ id: "canvas_render", name: "canvas_render", category: "canvas", description: "Renderizar un componente o visualización en el canvas. Sinónimos: renderizar, visualizar, gráfico, diagrama" },
|
|
86
|
-
{ id: "canvas_ask", name: "canvas_ask", category: "canvas", description: "Mostrar formulario interactivo y esperar input del usuario. Sinónimos: formulario interactivo, preguntar usuario, input" },
|
|
87
|
-
{ id: "canvas_confirm", name: "canvas_confirm", category: "canvas", description: "Mostrar diálogo de confirmación antes de ejecutar una acción. Sinónimos: confirmar acción, diálogo, aprobar" },
|
|
88
|
-
{ id: "canvas_show_card", name: "canvas_show_card", category: "canvas", description: "Mostrar información estructurada en formato de tarjeta. Sinónimos: mostrar tarjeta, card, información estructurada" },
|
|
89
|
-
{ id: "canvas_show_progress", name: "canvas_show_progress", category: "canvas", description: "Mostrar barra de progreso o indicador de estado. Sinónimos: barra de progreso, indicador, progreso visual" },
|
|
90
|
-
{ id: "canvas_show_list", name: "canvas_show_list", category: "canvas", description: "Mostrar información en lista clave-valor. Sinónimos: lista clave-valor, mostrar lista, información en lista" },
|
|
91
|
-
{ id: "canvas_clear", name: "canvas_clear", category: "canvas", description: "Limpiar contenido actual del canvas. Sinónimos: limpiar canvas, borrar visualización, resetear" },
|
|
92
|
-
|
|
93
|
-
// ─────────────────────────────────────────
|
|
94
|
-
// 6b. CANVAS A2UI v0.9 — Superficies interactivas ricas
|
|
85
|
+
// 6. A2UI v0.9 — Panel interactivo
|
|
95
86
|
// ─────────────────────────────────────────
|
|
96
87
|
{ id: "a2ui_create_surface", name: "a2ui_create_surface", category: "a2ui", description: "Crear superficie A2UI v0.9 para UI interactiva rica: formularios, dashboards, wizards, flujos multi-paso. Siempre llamar ANTES de a2ui_update_components. Requiere surfaceId y catalogId='https://a2ui.org/specification/v0_9/basic_catalog.json'. Sinónimos: crear superficie A2UI, iniciar UI A2UI, crear form A2UI, interfaz interactiva, crear dashboard A2UI" },
|
|
97
88
|
{ id: "a2ui_update_components", name: "a2ui_update_components", category: "a2ui", description: "Enviar componentes A2UI v0.9 como lista plana (adjacency list). Tipos: Text, Button, TextField, Row, Column, Card, List, Tabs, Modal, ChoicePicker, Slider, CheckBox, DateTimeInput, Image, Divider. Reglas: children usa explicitList (NO array), ChoicePicker usa selections (NO value), TextField usa textFieldType (NO variant), Tabs.tabItems.title es string plano. Sinónimos: actualizar componentes A2UI, enviar UI A2UI, renderizar componentes A2UI, layout A2UI" },
|
|
98
89
|
{ id: "a2ui_update_data_model", name: "a2ui_update_data_model", category: "a2ui", description: "Actualizar data model de superficie A2UI v0.9 via JSON Pointer (/ruta/campo). Omitir path reemplaza todo el modelo. Los componentes con {path:'/...'} se actualizan automáticamente en el cliente. Sinónimos: actualizar datos A2UI, poblar formulario A2UI, inicializar estado A2UI, data model, binding" },
|
|
99
|
-
{ id: "a2ui_delete_surface", name: "a2ui_delete_surface", category: "a2ui", description: "Eliminar superficie A2UI v0.9 del
|
|
100
|
-
|
|
101
|
-
// ─────────────────────────────────────────
|
|
102
|
-
// 7. VOICE — Voz
|
|
103
|
-
// ─────────────────────────────────────────
|
|
104
|
-
{ id: "voice_transcribe", name: "voice_transcribe", category: "voice", description: "Transcribir entrada de audio a texto. Sinónimos: transcribir audio, voz a texto, reconocimiento de voz" },
|
|
105
|
-
{ id: "voice_speak", name: "voice_speak", category: "voice", description: "Convertir texto a voz sintetizada. Sinónimos: texto a voz, sintetizar, hablar, leer en voz alta" },
|
|
90
|
+
{ id: "a2ui_delete_surface", name: "a2ui_delete_surface", category: "a2ui", description: "Eliminar una superficie A2UI v0.9 del panel interactivo. Usar al completar o cancelar el flujo para liberar recursos. Sinónimos: eliminar superficie A2UI, borrar UI A2UI, cerrar formulario A2UI, limpiar panel A2UI" },
|
|
106
91
|
|
|
107
92
|
// 8. SEARCH-KNOWLEDGE
|
|
108
93
|
{ id: "search_knowledge", name: "search_knowledge", category: "search-knowledge", description: "Buscar en la base de conocimientos. Sinónimos: buscar conocimiento, buscar en la base" },
|
|
@@ -308,7 +293,7 @@ export const SEED_DATA: SeedData = {
|
|
|
308
293
|
// ── HiveAgents (llama.cpp local servido vía Cloudflare) ──
|
|
309
294
|
// Modelo único recomendado para distribución Hive single-machine.
|
|
310
295
|
// Ver API.md para detalles de carga e inferencia.
|
|
311
|
-
{ id: "Qwen-AgentWorld-35B-A3B-UD-Q4_K_M.gguf", providerId: "hiveagents", name: "Qwen-AgentWorld 35B MoE (Recomendado)", modelType: "llm", contextWindow:
|
|
296
|
+
{ id: "Qwen-AgentWorld-35B-A3B-UD-Q4_K_M.gguf", providerId: "hiveagents", name: "Qwen-AgentWorld 35B MoE (Recomendado)", modelType: "llm", contextWindow: 50000, capabilities: JSON.stringify(["chat", "streaming", "reasoning", "function_calling"]) },
|
|
312
297
|
],
|
|
313
298
|
|
|
314
299
|
|
|
@@ -355,6 +340,7 @@ import { SkillLoader } from "@johpaz/hive-agents-skills"
|
|
|
355
340
|
import type {
|
|
356
341
|
ToolDoc, SkillDoc, EthicsDoc, ProviderDoc, ModelDoc, McpServerDoc, ChannelDoc, PlaybookDoc, AgentDoc,
|
|
357
342
|
} from "./collections"
|
|
343
|
+
import { createSeedCatalogAgents, ensureAgentsConfigured } from "../agent/agent-catalog"
|
|
358
344
|
|
|
359
345
|
const log = logger.child("seed");
|
|
360
346
|
|
|
@@ -407,9 +393,123 @@ const INITIAL_PLAYBOOK_RULES = [
|
|
|
407
393
|
},
|
|
408
394
|
]
|
|
409
395
|
|
|
396
|
+
/**
|
|
397
|
+
* Capabilities that shipped in a previous version and were withdrawn.
|
|
398
|
+
*
|
|
399
|
+
* Seeding is put-in-place with natural ids, so dropping an entry from
|
|
400
|
+
* SEED_DATA/bundled skills does NOT remove the row an older install already
|
|
401
|
+
* wrote — and a stale row stays indexed for search_knowledge, so the agent
|
|
402
|
+
* keeps discovering a capability whose executor no longer exists. Listing the
|
|
403
|
+
* id here deletes it on the next boot.
|
|
404
|
+
*
|
|
405
|
+
* A blanket "delete anything not in the seed" pass is deliberately avoided:
|
|
406
|
+
* users can author their own skills through the skills API route.
|
|
407
|
+
*/
|
|
408
|
+
const RETIRED_TOOL_IDS = [
|
|
409
|
+
"task_delegate_code", // Code Bridge (never implemented; the executor was a stub returning ok:false)
|
|
410
|
+
"canvas_render",
|
|
411
|
+
"canvas_ask",
|
|
412
|
+
"canvas_confirm",
|
|
413
|
+
"canvas_show_card",
|
|
414
|
+
"canvas_show_progress",
|
|
415
|
+
"canvas_show_list",
|
|
416
|
+
"canvas_clear",
|
|
417
|
+
// Projects/DAG: this instance no longer manages projects. Its TaskDriver also
|
|
418
|
+
// claimed any pending TaskDoc without filtering by project, so it could
|
|
419
|
+
// double-execute async delegations.
|
|
420
|
+
"project_create",
|
|
421
|
+
"project_status",
|
|
422
|
+
"task_create",
|
|
423
|
+
"task_complete",
|
|
424
|
+
];
|
|
425
|
+
|
|
426
|
+
const RETIRED_SKILL_IDS = [
|
|
427
|
+
"code_delegator", // Code Bridge: referenced task_delegate_code + codebridge_* tools that never existed
|
|
428
|
+
"canvas_report",
|
|
429
|
+
"canvas_dashboard",
|
|
430
|
+
"canvas_interact",
|
|
431
|
+
"mcp_lazy_operator",
|
|
432
|
+
];
|
|
433
|
+
|
|
434
|
+
const RETIRED_CATALOG_AGENT_IDS = [
|
|
435
|
+
"canvas_presenter",
|
|
436
|
+
// Kept only as an upgrade tombstone so existing installations remove the
|
|
437
|
+
// former generic MCP worker. New MCP specialists are user-owned and scoped
|
|
438
|
+
// persistently to one server.
|
|
439
|
+
"mcp_integration_operator",
|
|
440
|
+
];
|
|
441
|
+
|
|
442
|
+
const LEGACY_CRON_PERSONA = {
|
|
443
|
+
id: "schedule_automation_agent",
|
|
444
|
+
name: "Operador de agenda",
|
|
445
|
+
description: "Crea y administra recordatorios y automatizaciones temporales con zona horaria correcta.",
|
|
446
|
+
role: "Tu dominio es recordatorios, cron recurrente, ventanas temporales y zonas horarias.",
|
|
447
|
+
receives: "Acción temporal, horario expresado por el usuario, timezone, canal y comportamiento esperado.",
|
|
448
|
+
routingExamples: JSON.stringify(["recordarme mañana", "programar un reporte semanal", "pausar una tarea"]),
|
|
449
|
+
calendarProhibition: "No creás, consultás ni modificás eventos, citas, reuniones, asistentes o disponibilidad de un calendario externo.",
|
|
450
|
+
} as const;
|
|
451
|
+
|
|
452
|
+
function migrateLegacyCatalogPersona(existing: AgentDoc, current: AgentDoc): AgentDoc {
|
|
453
|
+
if (existing.id !== LEGACY_CRON_PERSONA.id || existing.source !== "catalog") return existing;
|
|
454
|
+
|
|
455
|
+
let systemPrompt = existing.system_prompt;
|
|
456
|
+
const hasLegacyStockPrompt = systemPrompt.includes(LEGACY_CRON_PERSONA.role)
|
|
457
|
+
&& systemPrompt.includes(LEGACY_CRON_PERSONA.receives);
|
|
458
|
+
if (hasLegacyStockPrompt) {
|
|
459
|
+
systemPrompt = systemPrompt
|
|
460
|
+
.replace(LEGACY_CRON_PERSONA.role, current.system_prompt.match(/# ROL\n([^\n]+)/)?.[1] ?? LEGACY_CRON_PERSONA.role)
|
|
461
|
+
.replace(LEGACY_CRON_PERSONA.receives, current.system_prompt.match(/# QUÉ RECIBES\n([^\n]+)/)?.[1] ?? LEGACY_CRON_PERSONA.receives);
|
|
462
|
+
if (!systemPrompt.includes(LEGACY_CRON_PERSONA.calendarProhibition)) {
|
|
463
|
+
systemPrompt = systemPrompt.replace(
|
|
464
|
+
"- No hablás con el usuario",
|
|
465
|
+
`- ${LEGACY_CRON_PERSONA.calendarProhibition}\n- No hablás con el usuario`,
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return {
|
|
471
|
+
...existing,
|
|
472
|
+
name: existing.name === LEGACY_CRON_PERSONA.name ? current.name : existing.name,
|
|
473
|
+
description: existing.description === LEGACY_CRON_PERSONA.description
|
|
474
|
+
? current.description
|
|
475
|
+
: existing.description,
|
|
476
|
+
system_prompt: systemPrompt,
|
|
477
|
+
routing_examples_json: existing.routing_examples_json === LEGACY_CRON_PERSONA.routingExamples
|
|
478
|
+
? current.routing_examples_json
|
|
479
|
+
: existing.routing_examples_json,
|
|
480
|
+
routing_exclusions_json: !existing.routing_exclusions_json || existing.routing_exclusions_json === "[]"
|
|
481
|
+
? current.routing_exclusions_json
|
|
482
|
+
: existing.routing_exclusions_json,
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
async function pruneRetired(): Promise<void> {
|
|
487
|
+
const toolsCol = await col<ToolDoc>("tools");
|
|
488
|
+
let removed = 0;
|
|
489
|
+
for (const id of RETIRED_TOOL_IDS) {
|
|
490
|
+
if (await toolsCol.get(id)) { await toolsCol.delete(id); removed++; }
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const skillsCol = await col<SkillDoc>("skills");
|
|
494
|
+
for (const id of RETIRED_SKILL_IDS) {
|
|
495
|
+
if (await skillsCol.get(id)) { await skillsCol.delete(id); removed++; }
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const agentsCol = await col<AgentDoc>("agents");
|
|
499
|
+
for (const id of RETIRED_CATALOG_AGENT_IDS) {
|
|
500
|
+
const existing = await agentsCol.get(id);
|
|
501
|
+
if (existing?.doc.source === "catalog") {
|
|
502
|
+
await agentsCol.delete(id);
|
|
503
|
+
removed++;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
if (removed > 0) log.info(`[seed] 🗑️ Removed ${removed} retired capability row(s)`);
|
|
508
|
+
}
|
|
509
|
+
|
|
410
510
|
async function reseedToolsAndSkills(): Promise<void> {
|
|
411
|
-
//
|
|
412
|
-
//
|
|
511
|
+
// Seeding only writes the rows; the search index is rebuilt from them at
|
|
512
|
+
// startup by the sync pass in gateway/initializer.ts.
|
|
413
513
|
|
|
414
514
|
// ── Tools: re-seed (overwrite in place; a natural id means no "wipe" step is needed) ──
|
|
415
515
|
const toolsCol = await col<ToolDoc>("tools");
|
|
@@ -454,6 +554,8 @@ async function reseedToolsAndSkills(): Promise<void> {
|
|
|
454
554
|
skillCount++;
|
|
455
555
|
}
|
|
456
556
|
log.info(`[seed] ✅ ${skillCount} skills re-seeded (search index syncs at startup)`);
|
|
557
|
+
|
|
558
|
+
await pruneRetired();
|
|
457
559
|
}
|
|
458
560
|
|
|
459
561
|
export async function seedAllData(): Promise<void> {
|
|
@@ -526,26 +628,35 @@ export async function seedAllData(): Promise<void> {
|
|
|
526
628
|
model_type: model.modelType as ModelDoc["model_type"],
|
|
527
629
|
context_window: model.contextWindow || 0, capabilities: model.capabilities || null,
|
|
528
630
|
enabled: existing?.doc.enabled ?? true, active: existing?.doc.active ?? false,
|
|
631
|
+
source: "catalog",
|
|
529
632
|
});
|
|
530
633
|
existingModels.delete(model.id);
|
|
531
634
|
modelCount++;
|
|
532
635
|
}
|
|
533
|
-
// Whatever remains
|
|
534
|
-
//
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
636
|
+
// Whatever remains was either dropped from the catalog (e.g. a consolidated
|
|
637
|
+
// HiveAgents GGUF variant) — remove it — or discovered at runtime from a
|
|
638
|
+
// provider (Ollama tags, /v1/models). Discovered rows have no canonical
|
|
639
|
+
// source to be re-created from, so they survive the reseed: purging them
|
|
640
|
+
// would unlink the model of every install that runs on a local Ollama.
|
|
641
|
+
let removedModels = 0;
|
|
642
|
+
for (const [staleId, stale] of existingModels) {
|
|
643
|
+
if (stale.doc.source !== "catalog") continue;
|
|
644
|
+
await modelsCol.delete(staleId);
|
|
645
|
+
removedModels++;
|
|
646
|
+
}
|
|
647
|
+
if (removedModels > 0) {
|
|
648
|
+
log.info(`[seed] 🗑️ Removed ${removedModels} model(s) no longer in the catalog.`);
|
|
538
649
|
}
|
|
539
650
|
|
|
540
651
|
// An agent pointing at a model that just got removed would otherwise keep
|
|
541
652
|
// a dangling model_id — unlink it so loadAgentConfigFromDB() falls back to
|
|
542
653
|
// getDefaultLLM() instead of resolving a model_id that isn't there.
|
|
543
|
-
const
|
|
654
|
+
const liveModelIds = new Set((await modelsCol.scan({})).map((e) => e.id));
|
|
544
655
|
const agentsCol = await col<AgentDoc>("agents");
|
|
545
656
|
const allAgents = await agentsCol.scan({});
|
|
546
657
|
let unlinkedCount = 0;
|
|
547
658
|
for (const a of allAgents) {
|
|
548
|
-
if (a.doc.model_id && a.doc.model_id !== "__none__" && !
|
|
659
|
+
if (a.doc.model_id && a.doc.model_id !== "__none__" && !liveModelIds.has(a.doc.model_id)) {
|
|
549
660
|
await agentsCol.put(a.id, { ...a.doc, model_id: toIndexable(null) }, { expectedVersion: a.version });
|
|
550
661
|
unlinkedCount++;
|
|
551
662
|
}
|
|
@@ -568,6 +679,57 @@ export async function seedAllData(): Promise<void> {
|
|
|
568
679
|
}
|
|
569
680
|
log.info(`[seed] ✅ ${mcpCount} MCP servers procesados`);
|
|
570
681
|
|
|
682
|
+
// Catalog agents (the curated personas) are seeded directly as `agents`
|
|
683
|
+
// rows. Existing user choices remain untouched; narrowly identified
|
|
684
|
+
// factory values from older releases are migrated in place.
|
|
685
|
+
let catalogAgentCount = 0;
|
|
686
|
+
for (const catalogAgent of createSeedCatalogAgents()) {
|
|
687
|
+
await putIfAbsent(agentsCol, catalogAgent.id, catalogAgent);
|
|
688
|
+
const existing = await agentsCol.get(catalogAgent.id);
|
|
689
|
+
if (!existing || existing.doc.source !== "catalog") {
|
|
690
|
+
catalogAgentCount++;
|
|
691
|
+
continue;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
let reconciled = migrateLegacyCatalogPersona(existing.doc, catalogAgent);
|
|
695
|
+
// Older releases could mark permanent catalog capabilities as archived.
|
|
696
|
+
// Archiving is no longer automatic, and catalog rows are never valid
|
|
697
|
+
// archive targets, so repair only that stale status on every boot while
|
|
698
|
+
// preserving the user's enabled/disabled choice.
|
|
699
|
+
if (reconciled.status === "archived") {
|
|
700
|
+
reconciled = { ...reconciled, status: "idle" };
|
|
701
|
+
}
|
|
702
|
+
if (JSON.stringify(reconciled) !== JSON.stringify(existing.doc)) {
|
|
703
|
+
await agentsCol.put(
|
|
704
|
+
existing.id,
|
|
705
|
+
{ ...reconciled, updated_at: now },
|
|
706
|
+
{ expectedVersion: existing.version },
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
catalogAgentCount++;
|
|
710
|
+
}
|
|
711
|
+
log.info(`[seed] ✅ ${catalogAgentCount} catalog agents ensured`);
|
|
712
|
+
|
|
713
|
+
// Catalog rows are born without a provider/model (no provider exists at
|
|
714
|
+
// first boot), and setup only runs once — so anything that arrives later
|
|
715
|
+
// (a persona added by an upgrade, an install configured before setup
|
|
716
|
+
// seeded the models, an agent unlinked above) would stay blank forever.
|
|
717
|
+
// Fill those from the configured coordinator; rows that already have their
|
|
718
|
+
// own pair are left alone. No-op while there is no coordinator yet.
|
|
719
|
+
const configuredAgents = await ensureAgentsConfigured();
|
|
720
|
+
if (configuredAgents > 0) {
|
|
721
|
+
log.info(`[seed] 🔧 ${configuredAgents} agent(s) configurados con el modelo del coordinador`);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
// Coordinators created before a prompt change keep the old stock text in
|
|
725
|
+
// their row (setup only runs once), so upgrade those in place. Prompts the
|
|
726
|
+
// user rewrote are detected and left alone.
|
|
727
|
+
const { refreshCoordinatorPrompts } = await import("./onboarding");
|
|
728
|
+
const refreshedPrompts = await refreshCoordinatorPrompts();
|
|
729
|
+
if (refreshedPrompts > 0) {
|
|
730
|
+
log.info(`[seed] 🔄 ${refreshedPrompts} coordinador(es) actualizados al system prompt vigente`);
|
|
731
|
+
}
|
|
732
|
+
|
|
571
733
|
// 7️⃣ Channels
|
|
572
734
|
const channelsCol = await col<ChannelDoc>("channels");
|
|
573
735
|
let channelCount = 0;
|
|
@@ -613,7 +775,7 @@ export async function seedAllData(): Promise<void> {
|
|
|
613
775
|
}
|
|
614
776
|
log.info(`[seed] ✅ ${playbookCount} ACE playbook rules seeded`);
|
|
615
777
|
|
|
616
|
-
// Playbook search indexing happens at startup via
|
|
778
|
+
// Playbook search indexing happens at startup via syncPlaybookToIndex (HiveDB)
|
|
617
779
|
|
|
618
780
|
log.info("[seed] ✨ Seed completado exitosamente.");
|
|
619
781
|
} catch (err) {
|
|
@@ -337,15 +337,6 @@ export async function getUsageStats(hours: number = 24): Promise<UsageSummary> {
|
|
|
337
337
|
};
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
export function getProviderPricing(provider: string, model: string): { inputPer1M: number; outputPer1M: number } {
|
|
341
|
-
return MODEL_PRICING[model] || { inputPer1M: 0, outputPer1M: 0 };
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
export function estimateCostForTokens(model: string, tokens: number): number {
|
|
345
|
-
const pricing = MODEL_PRICING[model] || { inputPer1M: 0, outputPer1M: 0 };
|
|
346
|
-
return (tokens / 1_000_000) * pricing.inputPer1M;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
340
|
/**
|
|
350
341
|
* Get average cost per token for a model (input + output average)
|
|
351
342
|
*/
|