@johpaz/hive-agents 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/hive.js +85466 -101014
- package/dist/tool-worker.js +13241 -17001
- package/dist/ui/assets/A2UIPage-CS0VPY6a.js +8 -0
- package/dist/ui/assets/{AgentCreateForm-Bcp3HN8D.js → AgentCreateForm-DXkjtXaS.js} +1 -1
- package/dist/ui/assets/AgentDetailPage-DUIX_cuQ.js +1 -0
- package/dist/ui/assets/AgentNewPage-SNXz2wik.js +1 -0
- package/dist/ui/assets/AgentsPage-CGsdgx5F.js +10 -0
- package/dist/ui/assets/{ApiClientPage-DHfIlSAg.js → ApiClientPage-MNMjfSDs.js} +2 -2
- package/dist/ui/assets/ChannelsPage-BEwxWUcE.js +8 -0
- package/dist/ui/assets/DashboardPage-D6cRFKWW.js +6 -0
- package/dist/ui/assets/{LoginPage-BaX6cAPa.js → LoginPage-ByYmIa2p.js} +1 -1
- package/dist/ui/assets/LogsPage-Bmk9rohg.js +1 -0
- package/dist/ui/assets/MeetingPage-Dm97Mbiw.js +1 -0
- package/dist/ui/assets/ModelSelector-gubC8j_Q.js +1 -0
- package/dist/ui/assets/NotFound-PUg3gEO0.js +1 -0
- package/dist/ui/assets/{Office3DPage-C3SIzd2H.css → Office3DPage-31AMJ-LN.css} +1 -1
- package/dist/ui/assets/Office3DPage-Bfi-S2kG.js +727 -0
- package/dist/ui/assets/ProvidersPage-CSo0MYxd.js +1 -0
- package/dist/ui/assets/{RecoverPage-C_Id9WM-.js → RecoverPage-YY2QU-qh.js} +1 -1
- package/dist/ui/assets/SettingsPage-DrafhhKw.js +9 -0
- package/dist/ui/assets/SetupPage-LXnd2XbV.js +1 -0
- package/dist/ui/assets/{Vignette-Cyi27LQH.js → Vignette-BcPWkNhm.js} +17 -17
- package/dist/ui/assets/VoicePage-p-hTMAq7.js +307 -0
- package/dist/ui/assets/WebChatPage-B61ZDjQ8.js +29 -0
- package/dist/ui/assets/agentCapabilities-PfTEVxG1.js +1 -0
- package/dist/ui/assets/alert-CjiX20jI.js +1 -0
- package/dist/ui/assets/badge-B5AKge1b.js +1 -0
- package/dist/ui/assets/card-mTJ4oZbL.js +1 -0
- package/dist/ui/assets/conversationsStore-BlwA3yd2.js +1 -0
- package/dist/ui/assets/dialog-B04KpdNt.js +1 -0
- package/dist/ui/assets/dist-js-Dh18rcg9.js +1 -0
- package/dist/ui/assets/{dist-js-Bg0g3vPS.js → dist-js-q7C_AB0j.js} +1 -1
- package/dist/ui/assets/index-ByTufXPh.css +2 -0
- package/dist/ui/assets/index-DKJFLL3a.js +116 -0
- package/dist/ui/assets/label-D_fvqJyD.js +1 -0
- package/dist/ui/assets/lock-3IApZyVy.js +1 -0
- package/dist/ui/assets/pencil-L3Li7_pz.js +1 -0
- package/dist/ui/assets/scroll-area-CbH8FOo8.js +1 -0
- package/dist/ui/assets/select-v_3QBYrD.js +1 -0
- package/dist/ui/assets/slider-DXS4h1LB.js +1 -0
- package/dist/ui/assets/switch-ndx8VCpm.js +1 -0
- package/dist/ui/assets/tabs-epu-3Tl4.js +1 -0
- package/dist/ui/assets/textarea-BgZJFZTX.js +1 -0
- package/dist/ui/assets/useAudioDevices-B2stUHvr.js +41 -0
- package/dist/ui/assets/{useHiveAgentsModelLoad-CHmtvNp4.js → useHiveAgentsModelLoad-B4EjHvj4.js} +1 -1
- package/dist/ui/assets/useOfficeModel-BaDn7U-X.js +1 -0
- package/dist/ui/assets/{useProviders-C7FA6z4M.js → useProviders-B1NS24md.js} +1 -1
- package/dist/ui/assets/vendor-react-kUOwxn0g.js +1 -0
- package/dist/ui/index.html +6 -6
- package/package.json +10 -6
- package/packages/cli/src/adapters/config.ts +11 -3
- package/packages/cli/src/commands/causal.ts +1 -1
- package/packages/cli/src/commands/doctor.ts +2 -2
- package/packages/core/src/agent/agent-catalog.ts +31 -31
- package/packages/core/src/agent/agent-loop.ts +67 -14
- package/packages/core/src/agent/capability-search.ts +2 -1
- package/packages/core/src/agent/compaction.ts +19 -7
- package/packages/core/src/agent/context-compiler.ts +165 -27
- package/packages/core/src/agent/conversation-store.ts +12 -1
- package/packages/core/src/agent/goal-runner.ts +2 -2
- package/packages/core/src/agent/jev-decisions.ts +148 -0
- package/packages/core/src/agent/jev-planner.ts +293 -0
- package/packages/core/src/agent/llm-client.ts +27 -5
- package/packages/core/src/agent/llm-providers/ollama.ts +17 -4
- package/packages/core/src/agent/llm-providers/openai-compat-base.ts +27 -12
- package/packages/core/src/agent/llm-providers/opencode-go.ts +37 -0
- package/packages/core/src/agent/realtime-providers/gemini-live.ts +5 -2
- package/packages/core/src/agent/skill-selector.ts +4 -2
- package/packages/core/src/agent/thread-id.ts +71 -0
- package/packages/core/src/agent/thread-store.ts +230 -0
- package/packages/core/src/agent/tool-selector.ts +1 -0
- package/packages/core/src/agent/tracer.ts +2 -0
- package/packages/core/src/canvas/canvas-manager.ts +17 -1
- package/packages/core/src/canvas/emitter.ts +24 -0
- package/packages/core/src/channels/telegram.ts +19 -1
- package/packages/core/src/channels/webchat.ts +47 -45
- package/packages/core/src/config/loader.ts +3 -2
- package/packages/core/src/gateway/channel-notify.ts +24 -5
- package/packages/core/src/gateway/delegation-groups.ts +3 -3
- package/packages/core/src/gateway/delegation-notify.ts +34 -5
- package/packages/core/src/gateway/durable-queue.ts +22 -0
- package/packages/core/src/gateway/failure-notify.ts +8 -2
- package/packages/core/src/gateway/job-executors.ts +3 -3
- package/packages/core/src/gateway/realtime/bridge-tools.ts +106 -28
- package/packages/core/src/gateway/realtime/index.ts +63 -7
- package/packages/core/src/gateway/realtime/prompt.ts +45 -0
- package/packages/core/src/gateway/realtime/voice-session.ts +1 -0
- package/packages/core/src/gateway/resolver.ts +31 -4
- package/packages/core/src/gateway/routes/artifacts.ts +13 -0
- package/packages/core/src/gateway/routes/chat.ts +20 -4
- package/packages/core/src/gateway/routes/conversations.ts +121 -0
- package/packages/core/src/gateway/routes/providers.ts +15 -0
- package/packages/core/src/gateway/routes/setup.ts +22 -11
- package/packages/core/src/gateway/routes/system.ts +4 -2
- package/packages/core/src/gateway/routes/tts-local.ts +2 -1
- package/packages/core/src/gateway/server.ts +85 -12
- package/packages/core/src/gateway/slash-commands.ts +46 -10
- package/packages/core/src/gateway/tts/src/server.ts +2 -1
- package/packages/core/src/gateway/webchat-turn.ts +68 -10
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/scheduler/CronScheduler.ts +20 -8
- package/packages/core/src/scheduler/cron/cron-engine.test.ts +295 -0
- package/packages/core/src/scheduler/cron/expression.ts +165 -0
- package/packages/core/src/scheduler/cron/index.ts +10 -0
- package/packages/core/src/scheduler/cron/job.ts +340 -0
- package/packages/core/src/scheduler/cron/next-run.ts +121 -0
- package/packages/core/src/scheduler/cron/zoned-time.ts +139 -0
- package/packages/core/src/scheduler/integration.ts +16 -5
- package/packages/core/src/scheduler/types.ts +3 -18
- package/packages/core/src/storage/bootstrap.ts +23 -0
- package/packages/core/src/storage/collections.ts +29 -1
- package/packages/core/src/storage/crypto.ts +23 -12
- package/packages/core/src/storage/reconcile.ts +6 -1
- package/packages/core/src/storage/seed.ts +63 -7
- package/packages/core/src/storage/usage.ts +53 -1
- package/packages/core/src/tool-runtime/index.ts +19 -1
- package/packages/core/src/tools/a2ui/index.ts +65 -1
- package/packages/core/src/tools/agents/get-available-models.ts +3 -1
- package/packages/core/src/tools/core/index.ts +39 -4
- package/packages/core/src/tools/cron/index.ts +4 -4
- package/packages/core/src/tools/index.ts +1 -1
- package/packages/core/src/tools/office/office-escribir-xlsx.ts +2 -1
- package/packages/core/src/tools/office/office-leer-xlsx.ts +2 -1
- package/packages/core/src/tools/office/xlsx-loader.ts +19 -0
- package/packages/core/src/tools/web/webview-backend.ts +140 -20
- package/packages/core/src/utils/port.ts +33 -0
- package/packages/core/src/voice/index.ts +2 -1
- package/packages/mcp/src/config.ts +2 -1
- package/packages/mcp/src/manager.ts +9 -0
- package/packages/mcp/src/transports/index.ts +42 -1
- package/packages/mcp/src/transports/sse.ts +11 -5
- package/packages/skills/src/bundled/a2ui/a2ui_dashboard/SKILL.md +2 -2
- package/packages/skills/src/bundled/a2ui/a2ui_form/SKILL.md +2 -2
- package/packages/skills/src/bundled/a2ui/a2ui_interactive/SKILL.md +4 -4
- package/packages/skills/src/bundled/agents/agent_spawner/SKILL.md +7 -7
- package/packages/skills/src/bundled/agents/memory_manager/SKILL.md +9 -9
- package/packages/skills/src/bundled/agents/research_and_remember/SKILL.md +8 -8
- package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +8 -8
- package/packages/skills/src/bundled/artifacts/artifact_reader/SKILL.md +104 -0
- package/packages/skills/src/bundled/cli/cli_pipeline/SKILL.md +6 -6
- package/packages/skills/src/bundled/cli/cli_safe_exec/SKILL.md +5 -5
- package/packages/skills/src/bundled/cron_manager/SKILL.md +29 -19
- package/packages/skills/src/bundled/cron_reminder/SKILL.md +5 -5
- package/packages/skills/src/bundled/filesystem/file_manager/SKILL.md +4 -4
- package/packages/skills/src/bundled/filesystem/file_read_and_summarize/SKILL.md +7 -7
- package/packages/skills/src/bundled/filesystem/file_writer/SKILL.md +10 -10
- package/packages/skills/src/bundled/search_knowledge/capability_discovery/SKILL.md +8 -8
- package/packages/skills/src/bundled/web/browser_automate/SKILL.md +21 -12
- package/packages/skills/src/bundled/web/browser_scrape/SKILL.md +28 -13
- package/packages/skills/src/bundled/web/web_monitor/SKILL.md +6 -6
- package/packages/skills/src/bundled/web/web_research/SKILL.md +5 -5
- package/packages/skills/src/bundled-data.generated.ts +837 -783
- package/dist/ui/assets/A2UIPage-DTW79pyL.js +0 -8
- package/dist/ui/assets/AgentDetailPage-10XptMde.js +0 -1
- package/dist/ui/assets/AgentNewPage-CUt49rVS.js +0 -1
- package/dist/ui/assets/AgentsPage-1_e1a9xa.js +0 -10
- package/dist/ui/assets/ChannelsPage-BnCQAGZL.js +0 -8
- package/dist/ui/assets/DashboardPage-BsCCKHgg.js +0 -6
- package/dist/ui/assets/LogsPage-DiFBQt7o.js +0 -1
- package/dist/ui/assets/MeetingPage-Bpv5zVXf.js +0 -1
- package/dist/ui/assets/ModelSelector-DfExlPzx.js +0 -1
- package/dist/ui/assets/NotFound-C8HBdF73.js +0 -1
- package/dist/ui/assets/Office3DPage-ChsGMapf.js +0 -319
- package/dist/ui/assets/ProvidersPage-B39pfWHf.js +0 -1
- package/dist/ui/assets/SettingsPage-BgFqasyg.js +0 -9
- package/dist/ui/assets/SetupPage-YeJFfgbt.js +0 -1
- package/dist/ui/assets/VoicePage-Cp63Abj4.js +0 -307
- package/dist/ui/assets/WebChatPage-DxFLWgtM.js +0 -29
- package/dist/ui/assets/agentCapabilities-DOeepCty.js +0 -1
- package/dist/ui/assets/alert-Cj4DpKv6.js +0 -1
- package/dist/ui/assets/badge-DKpeVCpY.js +0 -1
- package/dist/ui/assets/card-Cag15G4h.js +0 -1
- package/dist/ui/assets/dialog-7E3EoEt3.js +0 -1
- package/dist/ui/assets/dist-js-DwLn9F4C.js +0 -1
- package/dist/ui/assets/index-Bi8qEmrK.js +0 -116
- package/dist/ui/assets/index-D2UhaSb0.css +0 -2
- package/dist/ui/assets/label-C6atPuIh.js +0 -1
- package/dist/ui/assets/pencil-CUbpCfeG.js +0 -1
- package/dist/ui/assets/scroll-area-CSoG2z53.js +0 -1
- package/dist/ui/assets/select-DlCT21_r.js +0 -1
- package/dist/ui/assets/slider-Bb_PHFJT.js +0 -1
- package/dist/ui/assets/switch-CUsGuBNi.js +0 -1
- package/dist/ui/assets/tabs-Ckfc7DGG.js +0 -1
- package/dist/ui/assets/textarea-BH6pI9Ax.js +0 -1
- package/dist/ui/assets/useAudioDevices-Dpr_hn6i.js +0 -41
- package/dist/ui/assets/useOfficeModel-Cc5VkReZ.js +0 -1
- package/dist/ui/assets/vendor-react-DYyYpuMy.js +0 -1
- /package/dist/ui/assets/{core-Dz04EE_8.js → core-B_5cyOSV.js} +0 -0
- /package/dist/ui/assets/{download-D0aDV8Y_.js → download-BQXrpH0m.js} +0 -0
- /package/dist/ui/assets/{ellipsis-vertical-BOW_iEOO.js → ellipsis-vertical-D7uFJLGh.js} +0 -0
- /package/dist/ui/assets/{external-link-5cujQzfV.js → external-link-6oTH9pUM.js} +0 -0
- /package/dist/ui/assets/{eye-sRPY5qOa.js → eye-CxvxtQT5.js} +0 -0
- /package/dist/ui/assets/{file-text-DNSyNLUh.js → file-text-D5ZJEx3E.js} +0 -0
- /package/dist/ui/assets/{gateway-url-BzQV75Ig.js → gateway-url-BALS_wVh.js} +0 -0
- /package/dist/ui/assets/{gauge-C__zxC3_.js → gauge-CEu7PhTW.js} +0 -0
- /package/dist/ui/assets/{history-BHQWfE-7.js → history-DLK5rTlP.js} +0 -0
- /package/dist/ui/assets/{info-CG1VohyH.js → info-8ReWzubE.js} +0 -0
- /package/dist/ui/assets/{key-BC28VCjO.js → key-DPkOY-J0.js} +0 -0
- /package/dist/ui/assets/{lock-open-Bhp0UJlL.js → lock-open-v0EphssG.js} +0 -0
- /package/dist/ui/assets/{mail-Biwn8WrV.js → mail-vwCEHyhQ.js} +0 -0
- /package/dist/ui/assets/{mic-Rq4BxU1R.js → mic-CpDU_2as.js} +0 -0
- /package/dist/ui/assets/{pause-C2l5G2Py.js → pause-Cm9LzIZK.js} +0 -0
- /package/dist/ui/assets/{play-CMAscR3a.js → play-zqogwA2l.js} +0 -0
- /package/dist/ui/assets/{plus-DzvRxH4U.js → plus-Bm08ABhc.js} +0 -0
- /package/dist/ui/assets/{radio-DfGzov4y.js → radio-Cii1BjMt.js} +0 -0
- /package/dist/ui/assets/{refresh-cw-DZXu5FrG.js → refresh-cw-DXv3XgEt.js} +0 -0
- /package/dist/ui/assets/{rotate-ccw-Dx92orJM.js → rotate-ccw-LoM1AuqK.js} +0 -0
- /package/dist/ui/assets/{search-DB4w9YHW.js → search-BMwCI-pX.js} +0 -0
- /package/dist/ui/assets/{send-xi8HzUdc.js → send-D6fgWV7m.js} +0 -0
- /package/dist/ui/assets/{settings-pV0cF8Kf.js → settings-qV3kVkeG.js} +0 -0
- /package/dist/ui/assets/{shield-nLNsomh_.js → shield-CIarwBvx.js} +0 -0
- /package/dist/ui/assets/{sparkles-CerRDYxk.js → sparkles-DVvY6jDT.js} +0 -0
- /package/dist/ui/assets/{square-CcWzRWyG.js → square-D5zdNkAY.js} +0 -0
- /package/dist/ui/assets/{terminal-C2SUZUAD.js → terminal-BEcTK780.js} +0 -0
- /package/dist/ui/assets/{trash-2-BZsMCfso.js → trash-2-D6oziYAK.js} +0 -0
- /package/dist/ui/assets/{utils-lc8H6VGT.js → utils-DEmd_M8c.js} +0 -0
- /package/dist/ui/assets/{vendor-router-DCsSv_I7.js → vendor-router-DP84b3LQ.js} +0 -0
- /package/dist/ui/assets/{volume-2-CBMYsuF3.js → volume-2-EaA0JRvD.js} +0 -0
- /package/dist/ui/assets/{volume-x-vNFf2e4-.js → volume-x-CROXNMGT.js} +0 -0
- /package/dist/ui/assets/{wifi-DNv53AfN.js → wifi-BUJuOcgP.js} +0 -0
- /package/dist/ui/assets/{zap-Yed86Sh8.js → zap-DSoX9NDk.js} +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloj de pared ↔ instante, en una zona horaria IANA.
|
|
3
|
+
*
|
|
4
|
+
* Es la parte difícil de un cron con zona horaria y la razón por la que no
|
|
5
|
+
* alcanza con `Bun.cron.parse()`, que resuelve en una sola zona —UTC hasta Bun
|
|
6
|
+
* 1.3, la local del proceso desde 1.4— y nunca en la del job. "Todos los días a
|
|
7
|
+
* las 9" significa las 9 **del reloj de la pared en Bogotá**, y ese instante se
|
|
8
|
+
* corre una hora dos veces al año en las zonas con horario de verano. Calcular
|
|
9
|
+
* el offset una sola vez y sumarlo produce un cron que se desfasa un día al año
|
|
10
|
+
* en marzo y otro en octubre — el tipo de error que aparece un domingo a las
|
|
11
|
+
* 2am y nadie sabe de dónde salió.
|
|
12
|
+
*
|
|
13
|
+
* Acá no se guarda ningún offset: se le pregunta a `Intl` en cada conversión,
|
|
14
|
+
* que es la única fuente que conoce las reglas de cada zona y sus cambios.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Los campos que muestra un reloj colgado en la pared de esa zona. */
|
|
18
|
+
export interface WallClock {
|
|
19
|
+
year: number
|
|
20
|
+
/** 1-12, no 0-11: acá no hay meses de base cero. */
|
|
21
|
+
month: number
|
|
22
|
+
day: number
|
|
23
|
+
hour: number
|
|
24
|
+
minute: number
|
|
25
|
+
second: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Día de la semana, 0 = domingo. */
|
|
29
|
+
export function wallClockWeekday(wall: WallClock): number {
|
|
30
|
+
return new Date(Date.UTC(wall.year, wall.month - 1, wall.day)).getUTCDay()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const formatters = new Map<string, Intl.DateTimeFormat>()
|
|
34
|
+
|
|
35
|
+
function formatter(timeZone: string): Intl.DateTimeFormat {
|
|
36
|
+
let f = formatters.get(timeZone)
|
|
37
|
+
if (!f) {
|
|
38
|
+
f = new Intl.DateTimeFormat("en-US", {
|
|
39
|
+
timeZone,
|
|
40
|
+
hourCycle: "h23",
|
|
41
|
+
year: "numeric",
|
|
42
|
+
month: "2-digit",
|
|
43
|
+
day: "2-digit",
|
|
44
|
+
hour: "2-digit",
|
|
45
|
+
minute: "2-digit",
|
|
46
|
+
second: "2-digit",
|
|
47
|
+
})
|
|
48
|
+
formatters.set(timeZone, f)
|
|
49
|
+
}
|
|
50
|
+
return f
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Valida una zona IANA. Lanza con un mensaje que dice cuál falló. */
|
|
54
|
+
export function assertTimeZone(timeZone: string): void {
|
|
55
|
+
try {
|
|
56
|
+
formatter(timeZone)
|
|
57
|
+
} catch {
|
|
58
|
+
throw new Error(`Zona horaria desconocida: "${timeZone}"`)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Qué marca el reloj de esa zona en ese instante. */
|
|
63
|
+
export function toWallClock(instant: Date, timeZone: string): WallClock {
|
|
64
|
+
const parts = formatter(timeZone).formatToParts(instant)
|
|
65
|
+
const campo = (tipo: string) => {
|
|
66
|
+
const p = parts.find((x) => x.type === tipo)
|
|
67
|
+
return p ? Number(p.value) : 0
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
year: campo("year"),
|
|
71
|
+
month: campo("month"),
|
|
72
|
+
day: campo("day"),
|
|
73
|
+
hour: campo("hour"),
|
|
74
|
+
minute: campo("minute"),
|
|
75
|
+
second: campo("second"),
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function asUTCMillis(wall: WallClock): number {
|
|
80
|
+
return Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute, wall.second)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function mismoReloj(a: WallClock, b: WallClock): boolean {
|
|
84
|
+
return (
|
|
85
|
+
a.year === b.year && a.month === b.month && a.day === b.day &&
|
|
86
|
+
a.hour === b.hour && a.minute === b.minute && a.second === b.second
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* El instante en que el reloj de esa zona marca `wall`.
|
|
92
|
+
*
|
|
93
|
+
* Devuelve `null` cuando ese momento **no existe**: al adelantar el horario de
|
|
94
|
+
* verano el reloj salta de 01:59 a 03:00, así que "las 2:30" no ocurre ese día.
|
|
95
|
+
* Un cron agendado ahí no debe correr a una hora inventada; el que llama decide
|
|
96
|
+
* si lo salta o lo corre al día siguiente.
|
|
97
|
+
*
|
|
98
|
+
* Cuando el reloj se atrasa, la misma hora ocurre dos veces y se devuelve la
|
|
99
|
+
* primera — correr una vez es lo que espera quien agendó, no dos.
|
|
100
|
+
*/
|
|
101
|
+
export function toInstant(wall: WallClock, timeZone: string): Date | null {
|
|
102
|
+
const objetivo = asUTCMillis(wall)
|
|
103
|
+
|
|
104
|
+
// Punto de partida: tratar el reloj de pared como si fuera UTC y corregir con
|
|
105
|
+
// la diferencia que reporte la zona. Dos pasadas alcanzan siempre — la primera
|
|
106
|
+
// acerca al offset correcto, la segunda absorbe el caso en que la corrección
|
|
107
|
+
// cruzó un cambio de horario y el offset de destino era otro.
|
|
108
|
+
let ts = objetivo
|
|
109
|
+
for (let i = 0; i < 3; i++) {
|
|
110
|
+
const diferencia = objetivo - asUTCMillis(toWallClock(new Date(ts), timeZone))
|
|
111
|
+
if (diferencia === 0) break
|
|
112
|
+
ts += diferencia
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// La comprobación no es defensiva: es cómo se detecta el hueco del cambio de
|
|
116
|
+
// horario. Si la hora pedida no existe, ninguna corrección converge y el
|
|
117
|
+
// reloj de `ts` marca otra cosa.
|
|
118
|
+
if (!mismoReloj(toWallClock(new Date(ts), timeZone), wall)) return null
|
|
119
|
+
|
|
120
|
+
// Cuando el reloj se atrasa, ese mismo reloj de pared ocurre dos veces y la
|
|
121
|
+
// convergencia de arriba aterriza en la segunda. Se busca hacia atrás la
|
|
122
|
+
// primera: correr al instante más temprano es lo que espera quien agendó "a
|
|
123
|
+
// las 2:30", y así el job no se corre una hora ese día del año.
|
|
124
|
+
for (const atras of DESFASES_POSIBLES) {
|
|
125
|
+
const antes = ts - atras
|
|
126
|
+
if (mismoReloj(toWallClock(new Date(antes), timeZone), wall)) return new Date(antes)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return new Date(ts)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Cuánto puede saltar un reloj al cambiar de horario, de mayor a menor.
|
|
134
|
+
*
|
|
135
|
+
* Casi todas las zonas mueven una hora, pero no todas: Lord Howe mueve media, y
|
|
136
|
+
* hubo zonas con saltos de dos. Se prueban de mayor a menor para quedarse con
|
|
137
|
+
* la ocurrencia más temprana.
|
|
138
|
+
*/
|
|
139
|
+
const DESFASES_POSIBLES = [2 * 3_600_000, 3_600_000, 1_800_000]
|
|
@@ -12,6 +12,8 @@ import { resolveAgentId } from "../storage/onboarding";
|
|
|
12
12
|
import { sendToUserChannel } from "../gateway/channel-notify";
|
|
13
13
|
import { getNarration } from "../gateway/helpers";
|
|
14
14
|
import { addMessage } from "../agent/conversation-store";
|
|
15
|
+
import { makeThreadId, CRON_CHANNEL } from "../agent/thread-id";
|
|
16
|
+
import { threadForChannel } from "../agent/thread-store";
|
|
15
17
|
import { resolveBestChannel } from "../tools/cron/index";
|
|
16
18
|
import { col } from "../storage/hive";
|
|
17
19
|
import type { UserDoc, CronJobDoc } from "../storage/collections";
|
|
@@ -123,7 +125,11 @@ ${prompt || `Execute tool: ${job.tool_name}`}`;
|
|
|
123
125
|
try {
|
|
124
126
|
const agentLoop = buildAgentLoop({ mcpManager: undefined });
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
// Un hilo estable por tarea programada. Antes era
|
|
129
|
+
// `sched_${job.id}_${Date.now()}`: cada disparo estrenaba un hilo, así que
|
|
130
|
+
// la tarea nunca recordaba sus ejecuciones anteriores y cada una dejaba
|
|
131
|
+
// mensajes huérfanos en `conversations` que ya nadie volvía a leer.
|
|
132
|
+
const sessionId = makeThreadId(user?.id || "default", CRON_CHANNEL, job.id);
|
|
127
133
|
|
|
128
134
|
const agentChannel = (job.channel && job.channel !== "system")
|
|
129
135
|
? job.channel
|
|
@@ -136,10 +142,10 @@ ${prompt || `Execute tool: ${job.tool_name}`}`;
|
|
|
136
142
|
if (!agentChannel) return;
|
|
137
143
|
try {
|
|
138
144
|
if (step.type === "tool_call" && step.toolName) {
|
|
139
|
-
await sendToUserChannel(agentChannel, user?.id || "", getNarration(step.toolName));
|
|
145
|
+
await sendToUserChannel(agentChannel, user?.id || "", getNarration(step.toolName), { threadId: sessionId });
|
|
140
146
|
} else if (step.type === "text" && step.message) {
|
|
141
147
|
const trimmed = step.message.trim();
|
|
142
|
-
if (trimmed) await sendToUserChannel(agentChannel, user?.id || "", trimmed);
|
|
148
|
+
if (trimmed) await sendToUserChannel(agentChannel, user?.id || "", trimmed, { threadId: sessionId });
|
|
143
149
|
}
|
|
144
150
|
} catch (err) {
|
|
145
151
|
log.warn(`[execute] Narration send failed: ${(err as Error).message}`);
|
|
@@ -239,13 +245,18 @@ export async function notifyTaskCompletion(
|
|
|
239
245
|
|
|
240
246
|
log.info(`[notify] Sending notification to ${notifyChannel}: "${message.slice(0, 50)}..."`);
|
|
241
247
|
|
|
248
|
+
// El aviso se guarda en el hilo donde el usuario lo va a leer —su conversación
|
|
249
|
+
// activa en la web, o el chat del canal— y no en el hilo del usuario, que desde
|
|
250
|
+
// la separación por canal ya no es donde mira nadie.
|
|
251
|
+
const notifyThreadId = (await threadForChannel(userId, notifyChannel)) ?? userId;
|
|
252
|
+
|
|
242
253
|
try {
|
|
243
|
-
await addMessage(
|
|
254
|
+
await addMessage(notifyThreadId, "assistant", message, { channel: notifyChannel });
|
|
244
255
|
} catch (e) {
|
|
245
256
|
log.warn(`[notify] Failed to persist notification to DB: ${(e as Error).message}`);
|
|
246
257
|
}
|
|
247
258
|
|
|
248
|
-
await sendToUserChannel(notifyChannel, userId, message);
|
|
259
|
+
await sendToUserChannel(notifyChannel, userId, message, { threadId: notifyThreadId });
|
|
249
260
|
log.info(`[notify] Notification sent to ${notifyChannel}`);
|
|
250
261
|
}
|
|
251
262
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hive Scheduler - Type Definitions
|
|
3
3
|
*
|
|
4
|
-
* Type interfaces for the
|
|
4
|
+
* Type interfaces for the scheduling system.
|
|
5
5
|
* All names use "CronJob" terminology (formerly ScheduledTask).
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { Cron } from "
|
|
8
|
+
import type { Cron } from "./cron";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Task type: recurring uses cron expression, one_shot uses fire_at
|
|
@@ -146,24 +146,9 @@ export interface CronJobExecutionResult {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
* Internal job wrapper holding
|
|
149
|
+
* Internal job wrapper holding the scheduled job and its metadata
|
|
150
150
|
*/
|
|
151
151
|
export interface CronJobEntry {
|
|
152
152
|
job: CronJob;
|
|
153
153
|
cron: Cron;
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Options for Croner job creation
|
|
158
|
-
*/
|
|
159
|
-
export interface CronerOptions {
|
|
160
|
-
timezone: string;
|
|
161
|
-
protect: boolean;
|
|
162
|
-
catch: boolean | ((error: Error) => void);
|
|
163
|
-
name: string;
|
|
164
|
-
maxRuns?: number;
|
|
165
|
-
interval?: number;
|
|
166
|
-
startAt?: string;
|
|
167
|
-
stopAt?: string;
|
|
168
|
-
domAndDow?: boolean;
|
|
169
|
-
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { getHiveDb, getOpenHiveDb } from "./hivedb";
|
|
15
15
|
import { col } from "./hive";
|
|
16
16
|
import { seedAllData } from "./seed";
|
|
17
|
+
import { ensureLegacyThread } from "../agent/thread-store";
|
|
17
18
|
import { ensureSecretsBackend } from "./crypto";
|
|
18
19
|
|
|
19
20
|
interface IndexSpec {
|
|
@@ -60,6 +61,9 @@ const INDEXES: IndexSpec[] = [
|
|
|
60
61
|
{ collection: "traces", field: "success" },
|
|
61
62
|
{ collection: "playbook", field: "active" },
|
|
62
63
|
{ collection: "playbook", field: "category" },
|
|
64
|
+
{ collection: "conversationThreads", field: "user_id" },
|
|
65
|
+
{ collection: "conversationThreads", field: "channel" },
|
|
66
|
+
{ collection: "conversationThreads", field: "archived" },
|
|
63
67
|
// Stage 5 — scheduler
|
|
64
68
|
{ collection: "cronJobs", field: "status" },
|
|
65
69
|
{ collection: "cronJobs", field: "task_type" },
|
|
@@ -128,6 +132,23 @@ async function ensureSeedData(): Promise<void> {
|
|
|
128
132
|
// tests or long-running processes open a fresh instance in the same runtime.
|
|
129
133
|
let bootstrappedDb: Awaited<ReturnType<typeof getHiveDb>> | null = null;
|
|
130
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Antes de la separación por canal todos los canales compartían un solo hilo cuyo
|
|
137
|
+
* `thread_id` era el `userId`. Esa conversación se registra —sin mover un solo
|
|
138
|
+
* mensaje— como una conversación más de la web, para que siga siendo legible desde
|
|
139
|
+
* la lista. Idempotente: no hace nada si ya está registrada o si no hay historial.
|
|
140
|
+
*/
|
|
141
|
+
async function ensureLegacyThreads(): Promise<void> {
|
|
142
|
+
try {
|
|
143
|
+
const users = await col<{ id: string }>("users");
|
|
144
|
+
for (const user of await users.scan({})) {
|
|
145
|
+
await ensureLegacyThread(user.id);
|
|
146
|
+
}
|
|
147
|
+
} catch {
|
|
148
|
+
// Base sin usuarios todavía (onboarding pendiente) — nada que registrar.
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
131
152
|
/**
|
|
132
153
|
* Idempotent entry point: opens the database, ensures indexes, reseeds the
|
|
133
154
|
* static catalogs, and records the schema version. Safe to call on every
|
|
@@ -142,6 +163,8 @@ export async function ensureHiveDb(): Promise<void> {
|
|
|
142
163
|
ensureSecretsBackend();
|
|
143
164
|
await ensureSeedData();
|
|
144
165
|
|
|
166
|
+
await ensureLegacyThreads();
|
|
167
|
+
|
|
145
168
|
const meta = await col<{ value: number }>("meta");
|
|
146
169
|
const existing = await meta.get("schemaVersion");
|
|
147
170
|
if (!existing) await meta.put("schemaVersion", { value: 1 }, { expectedVersion: 0 });
|
|
@@ -41,7 +41,7 @@ export interface ModelDoc {
|
|
|
41
41
|
provider_id: string
|
|
42
42
|
name: string
|
|
43
43
|
/** "realtime": voz full-duplex (Live API), no confundir con stt+tts encadenados. */
|
|
44
|
-
model_type: "llm" | "stt" | "tts" | "vision" | "embedding" | "realtime"
|
|
44
|
+
model_type: "llm" | "stt" | "tts" | "vision" | "embedding" | "realtime" | "decision"
|
|
45
45
|
context_window: number
|
|
46
46
|
capabilities: string | null
|
|
47
47
|
enabled: boolean
|
|
@@ -307,6 +307,28 @@ export interface SummaryDoc {
|
|
|
307
307
|
last_message_id: string | null
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
/**
|
|
311
|
+
* Una conversación: el registro de un `conversations.thread_id`, con lo necesario
|
|
312
|
+
* para listarla en la web sin escanear los mensajes. `id` ES el threadId
|
|
313
|
+
* (`${user}/${canal}/${peer}` — ver agent/thread-id.ts), salvo la fila del hilo
|
|
314
|
+
* legacy anterior a la separación por canal, cuyo id es el userId pelado.
|
|
315
|
+
*/
|
|
316
|
+
export interface ConversationThreadDoc {
|
|
317
|
+
id: string
|
|
318
|
+
user_id: string
|
|
319
|
+
channel: string
|
|
320
|
+
/** Contacto/grupo del canal, o el id de conversación en la web. */
|
|
321
|
+
peer_id: string
|
|
322
|
+
peer_kind: "direct" | "group"
|
|
323
|
+
/** null hasta el primer mensaje del usuario, de donde se deriva. */
|
|
324
|
+
title: string | null
|
|
325
|
+
/** Borrado suave: sigue en la base pero no se lista ni se reabre. */
|
|
326
|
+
archived: boolean
|
|
327
|
+
created_at: number
|
|
328
|
+
last_message_at: number
|
|
329
|
+
message_count: number
|
|
330
|
+
}
|
|
331
|
+
|
|
310
332
|
export interface TraceDoc {
|
|
311
333
|
id: string
|
|
312
334
|
thread_id: string
|
|
@@ -682,6 +704,12 @@ export interface UsageRollupDoc {
|
|
|
682
704
|
toonJsonBytes: number
|
|
683
705
|
byProvider: Record<string, { inputTokens: number; outputTokens: number; costUsd: number }>
|
|
684
706
|
byModel: Record<string, { inputTokens: number; outputTokens: number; costUsd: number }>
|
|
707
|
+
/** Jev decision plane; absent on hours before it existed. Savings are estimates (chars/4) priced at the advised agent's model. */
|
|
708
|
+
jevDecisions?: number
|
|
709
|
+
jevCostUsd?: number
|
|
710
|
+
jevSavedTokens?: number
|
|
711
|
+
jevSavedCostUsd?: number
|
|
712
|
+
jevByAgent?: Record<string, { jevDecisions: number; jevCostUsd: number; jevSavedTokens: number; jevSavedCostUsd: number }>
|
|
685
713
|
}
|
|
686
714
|
|
|
687
715
|
export interface ActivityRollupDoc {
|
|
@@ -27,6 +27,10 @@ interface SecretDoc {
|
|
|
27
27
|
// restart in production.
|
|
28
28
|
|
|
29
29
|
const _mem = new Map<string, string>()
|
|
30
|
+
// Bumped by every write and delete. A read that was already in flight when the
|
|
31
|
+
// secret changed must not cache what it found: that resurrected deleted keys
|
|
32
|
+
// in memory until restart.
|
|
33
|
+
const _epoch = new Map<string, number>()
|
|
30
34
|
let _keychainOk: boolean | null = null // null = untested
|
|
31
35
|
let _keychainApi: unknown = undefined
|
|
32
36
|
|
|
@@ -47,14 +51,19 @@ function _getKeychainApi(): any {
|
|
|
47
51
|
async function _get(name: string): Promise<string | null> {
|
|
48
52
|
const cached = _mem.get(name)
|
|
49
53
|
if (cached !== undefined) return cached
|
|
54
|
+
const epoch = _epoch.get(name) ?? 0
|
|
55
|
+
const cache = (value: string) => { if ((_epoch.get(name) ?? 0) === epoch) _mem.set(name, value) }
|
|
50
56
|
|
|
51
57
|
// Durable store first — it is the one every write goes to.
|
|
52
58
|
const stored = await _readCollectionSecret(name)
|
|
53
|
-
if (stored)
|
|
59
|
+
if (stored) {
|
|
60
|
+
cache(stored)
|
|
61
|
+
return stored
|
|
62
|
+
}
|
|
54
63
|
|
|
55
64
|
// Legacy/desktop installs may only have the value in the OS keychain.
|
|
56
65
|
const fromKeychain = await _keychainGet(name)
|
|
57
|
-
if (fromKeychain)
|
|
66
|
+
if (fromKeychain) cache(fromKeychain)
|
|
58
67
|
return fromKeychain
|
|
59
68
|
}
|
|
60
69
|
|
|
@@ -65,6 +74,7 @@ async function _get(name: string): Promise<string | null> {
|
|
|
65
74
|
* silently accepting a secret that dies with the process.
|
|
66
75
|
*/
|
|
67
76
|
async function _set(name: string, value: string): Promise<boolean> {
|
|
77
|
+
_epoch.set(name, (_epoch.get(name) ?? 0) + 1)
|
|
68
78
|
_mem.set(name, value)
|
|
69
79
|
const durable = await persistSecretToCollection(name, value)
|
|
70
80
|
const mirrored = await _keychainSet(name, value)
|
|
@@ -74,21 +84,13 @@ async function _set(name: string, value: string): Promise<boolean> {
|
|
|
74
84
|
return durable || mirrored
|
|
75
85
|
}
|
|
76
86
|
|
|
77
|
-
/**
|
|
78
|
-
* Read a secret from the `secrets` HiveDB collection — the durable store.
|
|
79
|
-
* Decrypted values are cached in memory for the rest of the process.
|
|
80
|
-
*/
|
|
87
|
+
/** Read a secret from the `secrets` HiveDB collection — the durable store. `_get` caches it. */
|
|
81
88
|
async function _readCollectionSecret(name: string): Promise<string | null> {
|
|
82
89
|
try {
|
|
83
90
|
const secrets = await col<SecretDoc>("secrets")
|
|
84
91
|
const entry = await secrets.get(name)
|
|
85
92
|
if (!entry) return null
|
|
86
|
-
|
|
87
|
-
if (plain) {
|
|
88
|
-
// Cache in memory for subsequent lookups in this process
|
|
89
|
-
_mem.set(name, plain)
|
|
90
|
-
}
|
|
91
|
-
return plain || null
|
|
93
|
+
return decryptSecret(entry.doc.ciphertext, entry.doc.iv) || null
|
|
92
94
|
} catch {
|
|
93
95
|
return null
|
|
94
96
|
}
|
|
@@ -121,6 +123,7 @@ async function _keychainSet(name: string, value: string): Promise<boolean> {
|
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
async function _del(name: string): Promise<void> {
|
|
126
|
+
_epoch.set(name, (_epoch.get(name) ?? 0) + 1)
|
|
124
127
|
_mem.delete(name)
|
|
125
128
|
try {
|
|
126
129
|
await (Bun as any).secrets.delete({ service: SERVICE, name })
|
|
@@ -133,6 +136,10 @@ async function _del(name: string): Promise<void> {
|
|
|
133
136
|
} catch {
|
|
134
137
|
// ignore — might not exist
|
|
135
138
|
}
|
|
139
|
+
// Again once the stores are empty: a read that started inside this window
|
|
140
|
+
// found the old value and must not cache it.
|
|
141
|
+
_epoch.set(name, (_epoch.get(name) ?? 0) + 1)
|
|
142
|
+
_mem.delete(name)
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
/**
|
|
@@ -181,6 +188,10 @@ export async function loadProviderApiKey(id: string): Promise<string> {
|
|
|
181
188
|
return (await _get(`provider:${id}:api_key`)) ?? ""
|
|
182
189
|
}
|
|
183
190
|
|
|
191
|
+
export async function deleteProviderApiKey(id: string): Promise<void> {
|
|
192
|
+
await _del(`provider:${id}:api_key`)
|
|
193
|
+
}
|
|
194
|
+
|
|
184
195
|
export async function storeProviderHeaders(id: string, headers: Record<string, unknown>): Promise<boolean> {
|
|
185
196
|
return await _set(`provider:${id}:headers`, JSON.stringify(headers))
|
|
186
197
|
}
|
|
@@ -100,7 +100,12 @@ export async function reconcileOnBoot(bootId: string): Promise<ReconcileResult>
|
|
|
100
100
|
result.runsInterrupted++;
|
|
101
101
|
try {
|
|
102
102
|
if (run.channel && run.user_id) {
|
|
103
|
-
await sendToUserChannel(
|
|
103
|
+
await sendToUserChannel(
|
|
104
|
+
run.channel,
|
|
105
|
+
run.user_id,
|
|
106
|
+
"Se interrumpió un turno en progreso por un reinicio del proceso.",
|
|
107
|
+
{ threadId: run.thread_id }
|
|
108
|
+
);
|
|
104
109
|
}
|
|
105
110
|
} catch {
|
|
106
111
|
// non-critical
|
|
@@ -64,7 +64,7 @@ export const SEED_DATA: SeedData = {
|
|
|
64
64
|
{ id: "browser_wait", name: "browser_wait", category: "web", description: "Esperar a que aparezca un elemento o se cumpla una condición. Sinónimos: esperar, condición, elemento, selector, pausa" },
|
|
65
65
|
|
|
66
66
|
// ─────────────────────────────────────────
|
|
67
|
-
// 3. CRON — Tareas programadas
|
|
67
|
+
// 3. CRON — Tareas programadas
|
|
68
68
|
// ─────────────────────────────────────────
|
|
69
69
|
{ id: "cron.create", name: "cron.create", category: "cron", description: "Crear una automatización de Hive programada: recurrente (expresión cron) o ejecución futura única (fire_at). Requiere 'task'. Sinónimos: programar tarea, crear automatización, ejecutar después, tarea recurrente, una vez" },
|
|
70
70
|
{ id: "cron.list", name: "cron.list", category: "cron", description: "Listar todas las tareas programadas con próximos horarios de ejecución. Sinónimos: ver tareas programadas, listar cronograma, próximas ejecuciones" },
|
|
@@ -114,6 +114,7 @@ export const SEED_DATA: SeedData = {
|
|
|
114
114
|
{ id: "notify", name: "notify", category: "core", description: "Enviar notificación al usuario. Sinónimos: notificar, enviar notificación, alertar, aviso" },
|
|
115
115
|
{ id: "save_note", name: "save_note", category: "core", description: "Guardar nota persistente en el scratchpad. Sinónimos: guardar nota, escribir nota, recordatorio rápido, apuntar" },
|
|
116
116
|
{ id: "report_progress", name: "report_progress", category: "core", description: "Reportar progreso actual al usuario. Sinónimos: reportar progreso, informar estado, actualizar progreso, porcentaje" },
|
|
117
|
+
{ id: "conversation_read", name: "conversation_read", category: "core", description: "Recuperar mensajes anteriores de esta conversación por ID o búsqueda de texto. Sinónimos: leer conversación, recuperar contexto, historial omitido" },
|
|
117
118
|
|
|
118
119
|
// ─────────────────────────────────────────
|
|
119
120
|
// 10. OFFICE — Archivos Office (PDF, DOCX, XLSX, PPTX)
|
|
@@ -180,6 +181,11 @@ export const SEED_DATA: SeedData = {
|
|
|
180
181
|
// Solo la generación 3.x: la familia 2.0 ya está apagada y la 2.5 quedó
|
|
181
182
|
// superada. `gemini-3.5-pro` y `gemini-3.1-flash-lite-preview` se quitaron:
|
|
182
183
|
// el primero no existe en el catálogo y el segundo ya salió de preview.
|
|
184
|
+
// 3.8 Flash tiene precio de lanzamiento hasta el 31-dic-2026 ($0.75 / $3.75).
|
|
185
|
+
// Desde el 1-ene-2027 pasa a $1.50 / $7.50: actualizar aquí ese día o el
|
|
186
|
+
// dashboard subestimará el costo y el ahorro de Jev a la mitad.
|
|
187
|
+
// contextWindow: el que reporta la propia API de modelos de Gemini.
|
|
188
|
+
{ id: "gemini-3.8-flash", providerId: "gemini", name: "Gemini 3.8 Flash", modelType: "llm", contextWindow: 1050000, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0.75, outputPer1M: 3.75 },
|
|
183
189
|
{ id: "gemini-3.6-flash", providerId: "gemini", name: "Gemini 3.6 Flash", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 1.5, outputPer1M: 7.5 },
|
|
184
190
|
{ id: "gemini-3.5-flash", providerId: "gemini", name: "Gemini 3.5 Flash", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 1.5, outputPer1M: 9 },
|
|
185
191
|
{ id: "gemini-3.5-flash-lite", providerId: "gemini", name: "Gemini 3.5 Flash Lite", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming"]), inputPer1M: 0.3, outputPer1M: 2.5 },
|
|
@@ -188,7 +194,11 @@ export const SEED_DATA: SeedData = {
|
|
|
188
194
|
|
|
189
195
|
// Realtime (voz en tiempo real, `bidiGenerateContent`). Audio nativo bidireccional:
|
|
190
196
|
// no es un pipeline STT→LLM→TTS, el modelo oye y habla directo.
|
|
191
|
-
|
|
197
|
+
// Gemini 3.8 Live reemplaza a 3.1 Flash Live (preview, marcado "legacy" por
|
|
198
|
+
// Google) al mismo precio. Al salir 3.1 del catálogo ninguna fila queda
|
|
199
|
+
// activa y resolveRealtimeModel toma el default: la voz pasa sola a 3.8.
|
|
200
|
+
// Para volver atrás basta con restaurar la línea de 3.1.
|
|
201
|
+
{ id: "gemini-3.8-live", providerId: "gemini", name: "Gemini 3.8 Live", modelType: "realtime", contextWindow: 128000, capabilities: JSON.stringify(["realtime", "audio_in", "audio_out", "function_calling", "transcription"]), inputPer1M: 3, outputPer1M: 12 },
|
|
192
202
|
{ id: "gemini-2.5-flash-native-audio-latest", providerId: "gemini", name: "Gemini 2.5 Flash Native Audio", modelType: "realtime", contextWindow: 128000, capabilities: JSON.stringify(["realtime", "audio_in", "audio_out", "function_calling", "async_function_calling", "transcription"]), inputPer1M: 3, outputPer1M: 12 },
|
|
193
203
|
|
|
194
204
|
// TTS
|
|
@@ -219,6 +229,7 @@ export const SEED_DATA: SeedData = {
|
|
|
219
229
|
{ id: "kimi-k2.6", providerId: "kimi", name: "Kimi K2.6", modelType: "llm", contextWindow: 262144, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "code"]), inputPer1M: 0.6, outputPer1M: 3.41 },
|
|
220
230
|
|
|
221
231
|
// ── OpenRouter (fuente: GET https://openrouter.ai/api/v1/models) ──
|
|
232
|
+
{ id: "typesafe/jev-1.13", providerId: "openrouter", name: "Jev 1.13 (Decisions)", modelType: "decision", contextWindow: 32000, capabilities: JSON.stringify(["choice", "noul", "score"]), inputPer1M: 0.042, outputPer1M: 0 },
|
|
222
233
|
// Solo modelos vivos con `tools` en supported_parameters y publicados desde
|
|
223
234
|
// 2025-07. contextWindow = context_length reportado por el propio catálogo.
|
|
224
235
|
// Anthropic
|
|
@@ -243,7 +254,9 @@ export const SEED_DATA: SeedData = {
|
|
|
243
254
|
// Z.ai / GLM
|
|
244
255
|
{ id: "z-ai/glm-5.2", providerId: "openrouter", name: "GLM 5.2 (OR)", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "json_mode", "function_calling", "streaming", "code", "reasoning"]), inputPer1M: 0.63, outputPer1M: 1.98 },
|
|
245
256
|
// Qwen
|
|
246
|
-
|
|
257
|
+
// OpenRouter renombró qwen/qwen3.8-max a su versión fechada: mismo contexto
|
|
258
|
+
// y precio, ahora también con imagen. Verificado 2026-09-10.
|
|
259
|
+
{ id: "qwen/qwen3.8-max-0902", providerId: "openrouter", name: "Qwen3.8 Max (OR)", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 2, outputPer1M: 6 },
|
|
247
260
|
{ id: "qwen/qwen3.7-flash", providerId: "openrouter", name: "Qwen3.7 Flash (OR)", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "json_mode", "function_calling", "streaming"]), inputPer1M: 0.03, outputPer1M: 0.13 },
|
|
248
261
|
// xAI
|
|
249
262
|
{ id: "x-ai/grok-4.5", providerId: "openrouter", name: "Grok 4.5 (OR)", modelType: "llm", contextWindow: 500000, capabilities: JSON.stringify(["chat", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 2, outputPer1M: 6 },
|
|
@@ -303,9 +316,17 @@ export const SEED_DATA: SeedData = {
|
|
|
303
316
|
// DeepSeek V4 Pro (deepseek-ai/deepseek-v4-pro) se sacó: devuelve 404
|
|
304
317
|
// "Function not found for account" en cuentas normales — no está habilitado
|
|
305
318
|
// de forma general aunque figure en el listado público de /v1/models.
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
319
|
+
// GLM 5.2 (z-ai/glm-5.2) y MiniMax M3 (minimaxai/minimax-m3) se sacaron:
|
|
320
|
+
// NVIDIA los retiró, responden 410 Gone y ya no figuran en /v1/models.
|
|
321
|
+
// Kimi K2.6 (moonshotai/kimi-k2.6) se sacó por lo mismo que DeepSeek V4 Pro:
|
|
322
|
+
// 404 "Function not found for account" en dos cuentas distintas.
|
|
323
|
+
// Kimi K3, DeepSeek V4 Flash 0731 y Muse Glimmer entraron: publicados en
|
|
324
|
+
// julio/agosto con "Free Endpoint" en el catálogo de NGC, y responden con
|
|
325
|
+
// tool calling en una cuenta gratuita. Contexto según la referencia de la API
|
|
326
|
+
// de NVIDIA (Kimi K3) y OpenRouter (el resto). Verificado 2026-09-10.
|
|
327
|
+
{ id: "moonshotai/kimi-k3", providerId: "nvidia", name: "Kimi K3 (NVIDIA)", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "code", "vision", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
328
|
+
{ id: "deepseek-ai/deepseek-v4-flash-0731", providerId: "nvidia", name: "DeepSeek V4 Flash (NVIDIA)", modelType: "llm", contextWindow: 1048576, capabilities: JSON.stringify(["chat", "code", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
329
|
+
{ id: "meta/muse-glimmer-30b", providerId: "nvidia", name: "Muse Glimmer 30B (NVIDIA)", modelType: "llm", contextWindow: 131072, capabilities: JSON.stringify(["chat", "vision", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
309
330
|
{ id: "nvidia/nemotron-3-ultra-550b-a55b", providerId: "nvidia", name: "Nemotron 3 Ultra 550B", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
310
331
|
{ id: "nvidia/nemotron-3-super-120b-a12b", providerId: "nvidia", name: "Nemotron 3 Super 120B", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
311
332
|
|
|
@@ -587,6 +608,38 @@ function migrateLegacyCatalogPersona(existing: AgentDoc, current: AgentDoc): Age
|
|
|
587
608
|
};
|
|
588
609
|
}
|
|
589
610
|
|
|
611
|
+
// Stock catalog prompts used Rioplatense voseo up to 1.0.5. Only the words that
|
|
612
|
+
// appeared in those prompts; the migration below validates every rewrite.
|
|
613
|
+
const VOSEO_TO_NEUTRAL: Record<string, string> = {
|
|
614
|
+
pedís: "pides", ampliás: "amplías", usás: "usas", declarás: "declaras", hablás: "hablas",
|
|
615
|
+
inventás: "inventas", exponés: "expones", automatizás: "automatizas", realizás: "realizas",
|
|
616
|
+
confirmás: "confirmas", ejecutás: "ejecutas", modificás: "modificas", sobrescribís: "sobrescribes",
|
|
617
|
+
publicás: "publicas", editás: "editas", interpretás: "interpretas", conversás: "conversas",
|
|
618
|
+
creás: "creas", consultás: "consultas", repetís: "repites", cambiás: "cambias",
|
|
619
|
+
Devolvé: "Devuelve", Convertí: "Convierte", Contrastá: "Contrasta", Inspeccioná: "Inspecciona",
|
|
620
|
+
Aplicá: "Aplica", Volvé: "Vuelve", Determiná: "Determina", modificá: "modifica",
|
|
621
|
+
Generá: "Genera", extraé: "extrae", Diseñá: "Diseña", Enviá: "Envía", liberá: "libera",
|
|
622
|
+
Normalizá: "Normaliza", Consultá: "Consulta", Validá: "Valida",
|
|
623
|
+
};
|
|
624
|
+
const VOSEO_PATTERN = new RegExp(`(?<!\\p{L})(${Object.keys(VOSEO_TO_NEUTRAL).join("|")})(?!\\p{L})`, "gu");
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Rewrites a stored catalog prompt line only when dropping the voseo turns it
|
|
628
|
+
* into a line of the current stock prompt, so user-written lines stay as they are.
|
|
629
|
+
*/
|
|
630
|
+
function migrateVoseoCatalogPrompt(existing: AgentDoc, current: AgentDoc): AgentDoc {
|
|
631
|
+
const stockLines = new Set(current.system_prompt.split("\n"));
|
|
632
|
+
const systemPrompt = existing.system_prompt
|
|
633
|
+
.split("\n")
|
|
634
|
+
.map((line) => {
|
|
635
|
+
if (stockLines.has(line)) return line;
|
|
636
|
+
const neutral = line.replace(VOSEO_PATTERN, (word) => VOSEO_TO_NEUTRAL[word]!);
|
|
637
|
+
return stockLines.has(neutral) ? neutral : line;
|
|
638
|
+
})
|
|
639
|
+
.join("\n");
|
|
640
|
+
return systemPrompt === existing.system_prompt ? existing : { ...existing, system_prompt: systemPrompt };
|
|
641
|
+
}
|
|
642
|
+
|
|
590
643
|
async function pruneRetired(): Promise<void> {
|
|
591
644
|
const toolsCol = await col<ToolDoc>("tools");
|
|
592
645
|
let removed = 0;
|
|
@@ -838,7 +891,10 @@ export async function seedAllData(): Promise<void> {
|
|
|
838
891
|
continue;
|
|
839
892
|
}
|
|
840
893
|
|
|
841
|
-
let reconciled =
|
|
894
|
+
let reconciled = migrateVoseoCatalogPrompt(
|
|
895
|
+
migrateLegacyCatalogPersona(existing.doc, catalogAgent),
|
|
896
|
+
catalogAgent,
|
|
897
|
+
);
|
|
842
898
|
// Older releases could mark permanent catalog capabilities as archived.
|
|
843
899
|
// Archiving is no longer automatic, and catalog rows are never valid
|
|
844
900
|
// archive targets, so repair only that stale status on every boot while
|