@johpaz/hive-agents 1.0.3 → 1.0.4
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 +4 -4
- package/dist/hive.js +43711 -43411
- package/dist/ui/assets/A2UIPage-7Ry5rHh9.js +8 -0
- package/dist/ui/assets/AgentCreateForm-Dh5W0q_t.js +1 -0
- package/dist/ui/assets/AgentDetailPage-CIoPjtsS.js +1 -0
- package/dist/ui/assets/AgentNewPage-BNsZcJQf.js +1 -0
- package/dist/ui/assets/AgentsPage-YZrDmgNI.js +10 -0
- package/dist/ui/assets/ApiClientPage-6a6KFwsQ.js +3 -0
- package/dist/ui/assets/ChannelsPage-Dice4dkJ.js +8 -0
- package/dist/ui/assets/DashboardPage-B9r0sc0F.js +6 -0
- package/dist/ui/assets/LoginPage-BkAAX_tu.js +1 -0
- package/dist/ui/assets/{LogsPage-DyJOGQNy.js → LogsPage-8-H1OJs3.js} +1 -1
- package/dist/ui/assets/MeetingPage-14JoQo71.js +1 -0
- package/dist/ui/assets/ModelSelector-CrgJQ7DG.js +1 -0
- package/dist/ui/assets/{NotFound-Bpr12V51.js → NotFound-B06kVW7N.js} +1 -1
- package/dist/ui/assets/{Office3DPage-BvO66B0h.js → Office3DPage-BMUZWkFS.js} +2 -2
- package/dist/ui/assets/ProvidersPage-BiL3QxCs.js +1 -0
- package/dist/ui/assets/RecoverPage-D1o8yxNz.js +1 -0
- package/dist/ui/assets/SettingsPage-GP8UwQIL.js +9 -0
- package/dist/ui/assets/SetupPage-B_gU1YQU.js +1 -0
- package/dist/ui/assets/WebChatPage-Yahufnth.js +29 -0
- package/dist/ui/assets/activity-C_GS5wrG.js +1 -0
- package/dist/ui/assets/agentCapabilities-Dg72UAFj.js +1 -0
- package/dist/ui/assets/{alert-CQlRq6sv.js → alert-DChoEVJw.js} +1 -1
- package/dist/ui/assets/arrow-left-WyDPYZXU.js +1 -0
- package/dist/ui/assets/arrow-right-BuNjN-bk.js +1 -0
- package/dist/ui/assets/arrow-up-right-DWzTsCXj.js +1 -0
- package/dist/ui/assets/{badge-DKGZbVZJ.js → badge-uRjRSt86.js} +1 -1
- package/dist/ui/assets/calendar-B6x9cw-q.js +1 -0
- package/dist/ui/assets/{card-D3Nw3kh3.js → card-DwQizslL.js} +1 -1
- package/dist/ui/assets/check-C8pw-7Fx.js +1 -0
- package/dist/ui/assets/chevron-down-8GjmTjLR.js +1 -0
- package/dist/ui/assets/chevron-left-GK4EQOyZ.js +1 -0
- package/dist/ui/assets/chevron-right-BupZqrxu.js +1 -0
- package/dist/ui/assets/chevron-up-DZrzJIW8.js +1 -0
- package/dist/ui/assets/circle-alert-CtDbK2nl.js +1 -0
- package/dist/ui/assets/circle-check-BKNT2_q6.js +1 -0
- package/dist/ui/assets/circle-x-DfBjbztU.js +1 -0
- package/dist/ui/assets/copy-wR7o7Ly8.js +1 -0
- package/dist/ui/assets/core-Sjunb8Z1.js +1 -0
- package/dist/ui/assets/createLucideIcon-BRaPSYgN.js +1 -0
- package/dist/ui/assets/{dialog-Dn9hGPYl.js → dialog--mljnfAi.js} +1 -1
- package/dist/ui/assets/dist-js-B0s_TDau.js +1 -0
- package/dist/ui/assets/dist-js-CLxM1g2B.js +1 -0
- package/dist/ui/assets/download-D0aDV8Y_.js +1 -0
- package/dist/ui/assets/earth-BJRGJbVn.js +1 -0
- package/dist/ui/assets/ellipsis-vertical-BOW_iEOO.js +1 -0
- package/dist/ui/assets/external-link-5cujQzfV.js +1 -0
- package/dist/ui/assets/eye-sRPY5qOa.js +1 -0
- package/dist/ui/assets/file-text-DNSyNLUh.js +1 -0
- package/dist/ui/assets/gauge-C__zxC3_.js +1 -0
- package/dist/ui/assets/history-BHQWfE-7.js +1 -0
- package/dist/ui/assets/index-BHHUQZJd.js +116 -0
- package/dist/ui/assets/index-CEFhf4dF.css +2 -0
- package/dist/ui/assets/info-CG1VohyH.js +1 -0
- package/dist/ui/assets/key-BC28VCjO.js +1 -0
- package/dist/ui/assets/{label-k0jYxoWW.js → label-BceoUB2w.js} +1 -1
- package/dist/ui/assets/lock-open-Bhp0UJlL.js +1 -0
- package/dist/ui/assets/mail-Biwn8WrV.js +1 -0
- package/dist/ui/assets/pause-C2l5G2Py.js +1 -0
- package/dist/ui/assets/pencil-CUbpCfeG.js +1 -0
- package/dist/ui/assets/play-CMAscR3a.js +1 -0
- package/dist/ui/assets/plus-DzvRxH4U.js +1 -0
- package/dist/ui/assets/radio-DfGzov4y.js +1 -0
- package/dist/ui/assets/refresh-cw-DZXu5FrG.js +1 -0
- package/dist/ui/assets/scroll-area-DMEaZZUp.js +1 -0
- package/dist/ui/assets/search-ykSx-zZU.js +1 -0
- package/dist/ui/assets/{select-ot0a6art.js → select-BBEBtcLm.js} +1 -1
- package/dist/ui/assets/send-DAhlz2i9.js +1 -0
- package/dist/ui/assets/settings-DL0REysC.js +1 -0
- package/dist/ui/assets/shield-BPZZhjCT.js +1 -0
- package/dist/ui/assets/slider-DcmBdvYD.js +1 -0
- package/dist/ui/assets/sparkles-BViXTAh7.js +1 -0
- package/dist/ui/assets/square-psq7k_CB.js +1 -0
- package/dist/ui/assets/{switch-DXcELPsM.js → switch-CgiDezVR.js} +1 -1
- package/dist/ui/assets/tabs-gUXIjjZv.js +1 -0
- package/dist/ui/assets/terminal-CzxPKG-h.js +1 -0
- package/dist/ui/assets/{textarea-rp6vsOZl.js → textarea-DedxQYBx.js} +1 -1
- package/dist/ui/assets/trash-2-SgYCWiVk.js +1 -0
- package/dist/ui/assets/{useHiveAgentsModelLoad-BjnIsQKR.js → useHiveAgentsModelLoad-C7bhWPDG.js} +1 -1
- package/dist/ui/assets/useProviders-CiLSc05q.js +1 -0
- package/dist/ui/assets/vendor-radix-DUug7irY.js +63 -0
- package/dist/ui/assets/{vendor-react-CPJEWbIG.js → vendor-react-DYyYpuMy.js} +1 -1
- package/dist/ui/assets/volume-x-BDlMCDYT.js +1 -0
- package/dist/ui/assets/wifi-CyPHteEm.js +1 -0
- package/dist/ui/assets/zap-OVVrfEHr.js +1 -0
- package/dist/ui/index.html +8 -7
- package/package.json +1 -1
- package/packages/core/src/agent/agent-loop.ts +48 -0
- package/packages/core/src/agent/llm-client.ts +41 -6
- package/packages/core/src/agent/llm-providers/nvidia.ts +39 -0
- package/packages/core/src/agent/llm-providers/openai-compat-base.ts +38 -2
- package/packages/core/src/agent/mcp-result-normalizer.ts +42 -0
- package/packages/core/src/agent/tool-selector.ts +1 -0
- package/packages/core/src/artifacts/store.ts +65 -0
- package/packages/core/src/events/tool-narration.ts +3 -0
- package/packages/core/src/gateway/routes/system.ts +9 -4
- package/packages/core/src/gateway/webchat-turn.ts +34 -1
- package/packages/core/src/storage/seed.ts +1 -0
- package/packages/core/src/tool-runtime/embedded-worker.generated.ts +20 -0
- package/packages/core/src/tool-runtime/index.ts +56 -14
- package/packages/core/src/tools/index.ts +3 -2
- package/packages/core/src/tools/web/artifact-read.ts +162 -0
- package/packages/core/src/tools/web/index.ts +3 -0
- package/packages/skills/src/bundled-data.generated.ts +752 -752
- package/dist/ui/assets/A2UIPage-DExwevBV.js +0 -8
- package/dist/ui/assets/AgentCreateForm-7PPShsUn.js +0 -1
- package/dist/ui/assets/AgentDetailPage-CiV4tz4P.js +0 -1
- package/dist/ui/assets/AgentNewPage-D3TtVwQf.js +0 -1
- package/dist/ui/assets/AgentsPage-C2DThet7.js +0 -10
- package/dist/ui/assets/ApiClientPage-Cowdq-0f.js +0 -3
- package/dist/ui/assets/ChannelsPage-D4IgglwJ.js +0 -8
- package/dist/ui/assets/DashboardPage-DAgVB7Iy.js +0 -6
- package/dist/ui/assets/LoginPage-CpU61b3u.js +0 -1
- package/dist/ui/assets/MeetingPage-DLmqHmm2.js +0 -1
- package/dist/ui/assets/ModelSelector-D4OaICwN.js +0 -1
- package/dist/ui/assets/ProvidersPage-Bhb6Qr87.js +0 -1
- package/dist/ui/assets/RecoverPage-DaZrCpdB.js +0 -1
- package/dist/ui/assets/SettingsPage-BRD2F7up.js +0 -9
- package/dist/ui/assets/SetupPage-DKppgTja.js +0 -1
- package/dist/ui/assets/WebChatPage-CPtETNL5.js +0 -29
- package/dist/ui/assets/activity-BSosMryb.js +0 -1
- package/dist/ui/assets/agentCapabilities-VqxLmrF6.js +0 -1
- package/dist/ui/assets/arrow-left-C9Y6p4Jt.js +0 -1
- package/dist/ui/assets/arrow-right-BYfOLnTB.js +0 -1
- package/dist/ui/assets/arrow-up-right-D2trA3Ob.js +0 -1
- package/dist/ui/assets/calendar-rdd4nvY1.js +0 -1
- package/dist/ui/assets/check-DUq9uoNQ.js +0 -1
- package/dist/ui/assets/chevron-down-rPF4Pr1n.js +0 -1
- package/dist/ui/assets/chevron-left-Crzzf2sY.js +0 -1
- package/dist/ui/assets/chevron-right-DtMIvG9A.js +0 -1
- package/dist/ui/assets/chevron-up-CG0_KGBy.js +0 -1
- package/dist/ui/assets/circle-alert-CYt6gsDA.js +0 -1
- package/dist/ui/assets/circle-check-Zl32-jCa.js +0 -1
- package/dist/ui/assets/circle-x-BJXzKGmx.js +0 -1
- package/dist/ui/assets/copy-BmtJXmDe.js +0 -1
- package/dist/ui/assets/download-D3mYhuuL.js +0 -1
- package/dist/ui/assets/earth-BZzdDXFC.js +0 -1
- package/dist/ui/assets/ellipsis-vertical-BF705XvB.js +0 -1
- package/dist/ui/assets/external-link-gdpMTHUV.js +0 -1
- package/dist/ui/assets/eye-lSG04hI7.js +0 -1
- package/dist/ui/assets/file-text-CjQxcJvN.js +0 -1
- package/dist/ui/assets/gauge-DBryKhDK.js +0 -1
- package/dist/ui/assets/history-BC6ir9qU.js +0 -1
- package/dist/ui/assets/index-DyxoAvTq.js +0 -116
- package/dist/ui/assets/index-wML8DaUo.css +0 -2
- package/dist/ui/assets/info-BGBaIyKc.js +0 -1
- package/dist/ui/assets/key-D_CNJTY2.js +0 -1
- package/dist/ui/assets/loader-circle-RXdrfPsH.js +0 -1
- package/dist/ui/assets/lock-open-UB61lorP.js +0 -1
- package/dist/ui/assets/mail-C5bJ_dBt.js +0 -1
- package/dist/ui/assets/pause-BSTJvxDu.js +0 -1
- package/dist/ui/assets/pencil-C2B1Q7y2.js +0 -1
- package/dist/ui/assets/play-tcMbj-0p.js +0 -1
- package/dist/ui/assets/plus-BSZvyMND.js +0 -1
- package/dist/ui/assets/progress-DrI2UDu-.js +0 -1
- package/dist/ui/assets/radio-D9CrjAar.js +0 -1
- package/dist/ui/assets/refresh-cw-D7EB_fVv.js +0 -1
- package/dist/ui/assets/scroll-area-CfHn94Vb.js +0 -1
- package/dist/ui/assets/search-5S6LY69I.js +0 -1
- package/dist/ui/assets/send-Dax1tJ5b.js +0 -1
- package/dist/ui/assets/settings-97CL32lC.js +0 -1
- package/dist/ui/assets/shield-DwbCEZbF.js +0 -1
- package/dist/ui/assets/slider-CmE_z1Ii.js +0 -1
- package/dist/ui/assets/sparkles-CWMAzkpD.js +0 -1
- package/dist/ui/assets/square-B4dgTXI3.js +0 -1
- package/dist/ui/assets/tabs-CxiybXcw.js +0 -1
- package/dist/ui/assets/terminal-DoLedTPM.js +0 -1
- package/dist/ui/assets/trash-2-DxnVYOz8.js +0 -1
- package/dist/ui/assets/triangle-alert-Cka-BeIE.js +0 -1
- package/dist/ui/assets/useProviders-CueMz_mL.js +0 -1
- package/dist/ui/assets/vendor-radix-D0s_k6Gp.js +0 -63
- package/dist/ui/assets/volume-x-DLsli9cf.js +0 -1
- package/dist/ui/assets/wifi-BQRJGfLZ.js +0 -1
- package/dist/ui/assets/zap-DSR3CEce.js +0 -1
- /package/dist/ui/assets/{gateway-url-BlnabM5e.js → gateway-url-BZj_2-jf.js} +0 -0
- /package/dist/ui/assets/{useOfficeModel-Cy7cAyEn.js → useOfficeModel-BAFasrg8.js} +0 -0
- /package/dist/ui/assets/{utils-Dyb7SC2_.js → utils-SGUggNJc.js} +0 -0
- /package/dist/ui/assets/{vendor-router-zpB-76nT.js → vendor-router-Dsg8fxNQ.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-S-ySWqyJ.js";import{At as t}from"./vendor-radix-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-S-ySWqyJ.js";import{At as t}from"./vendor-radix-DUug7irY.js";var n=e((e=>{var n=t();e.createRoot=n.createRoot,e.hydrateRoot=n.hydrateRoot}));export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-BRaPSYgN.js";var t=e(`Volume2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),n=e(`VolumeX`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-BRaPSYgN.js";var t=e(`WifiOff`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),n=e(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-BRaPSYgN.js";var t=e(`Zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);export{t};
|
package/dist/ui/index.html
CHANGED
|
@@ -23,17 +23,18 @@
|
|
|
23
23
|
<meta name="twitter:title" content="Hive">
|
|
24
24
|
<meta property="og:description" content="Hive Agents">
|
|
25
25
|
<meta name="twitter:description" content="Hive Agents">
|
|
26
|
-
<script type="module" crossorigin src="/assets/index-
|
|
26
|
+
<script type="module" crossorigin src="/assets/index-BHHUQZJd.js"></script>
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-S-ySWqyJ.js">
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/vendor-charts-K3xcRl0X.js">
|
|
29
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-router-
|
|
29
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-router-Dsg8fxNQ.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/vendor-query-Dj8xYhQD.js">
|
|
31
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-radix-
|
|
31
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-radix-DUug7irY.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/dist-CD_qfA30.js">
|
|
33
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
34
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
35
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
36
|
-
<link rel="
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BRaPSYgN.js">
|
|
34
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-react-DYyYpuMy.js">
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/assets/utils-SGUggNJc.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-url-BZj_2-jf.js">
|
|
37
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CEFhf4dF.css">
|
|
37
38
|
</head>
|
|
38
39
|
|
|
39
40
|
<body>
|
package/package.json
CHANGED
|
@@ -95,6 +95,50 @@ export async function synthesizeFinalResponse(
|
|
|
95
95
|
)
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
type LoadoutContext = {
|
|
99
|
+
tools: Array<{ type: string; function?: { name?: string } }>
|
|
100
|
+
allTools: Array<{ name: string }>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Adds artifact_read to the loadout the moment a tool result hands the model an
|
|
105
|
+
* `artifact_ref` it will need to open.
|
|
106
|
+
*
|
|
107
|
+
* mcp-result-normalizer.ts moves oversized MCP text results out of the context
|
|
108
|
+
* window and leaves a reference behind. Discovery (search_knowledge) can find
|
|
109
|
+
* the reader, but that costs an iteration and assumes the model thinks to look:
|
|
110
|
+
* in the incident this comes from, it reached for artifact_inspect instead, got
|
|
111
|
+
* metadata, and burned the rest of its budget on `find` and `env` before the
|
|
112
|
+
* turn died on an empty synthesis. Image refs are excluded — those are carried
|
|
113
|
+
* to the UI, not read back by the model.
|
|
114
|
+
*
|
|
115
|
+
* Returns true when the loadout changed.
|
|
116
|
+
*/
|
|
117
|
+
export function injectArtifactReadIfNeeded(toolResult: unknown, ctx: LoadoutContext): boolean {
|
|
118
|
+
if (!Array.isArray(toolResult)) return false
|
|
119
|
+
|
|
120
|
+
const needsReader = toolResult.some((block) =>
|
|
121
|
+
!!block && typeof block === "object" &&
|
|
122
|
+
(block as { type?: unknown }).type === "artifact_ref" &&
|
|
123
|
+
!String((block as { mime_type?: unknown }).mime_type ?? "").startsWith("image/")
|
|
124
|
+
)
|
|
125
|
+
if (!needsReader) return false
|
|
126
|
+
if (ctx.tools.some((t) => t.function?.name === "artifact_read")) return false
|
|
127
|
+
|
|
128
|
+
const reader = ctx.allTools.find((t) => t.name === "artifact_read")
|
|
129
|
+
if (!reader) return false
|
|
130
|
+
|
|
131
|
+
ctx.tools.push({
|
|
132
|
+
type: "function",
|
|
133
|
+
function: {
|
|
134
|
+
name: reader.name,
|
|
135
|
+
description: (reader as any).description ?? "",
|
|
136
|
+
parameters: (reader as any).parameters ?? { type: "object", properties: {} },
|
|
137
|
+
},
|
|
138
|
+
} as LoadoutContext["tools"][number])
|
|
139
|
+
return true
|
|
140
|
+
}
|
|
141
|
+
|
|
98
142
|
/** Bounds a single async operation to its own timeout window, independent of any caller. */
|
|
99
143
|
export async function withTimeout<T>(op: () => Promise<T>, timeoutMs: number): Promise<T> {
|
|
100
144
|
let timer: ReturnType<typeof setTimeout>
|
|
@@ -672,6 +716,10 @@ export async function* runAgent(
|
|
|
672
716
|
}
|
|
673
717
|
}
|
|
674
718
|
|
|
719
|
+
if (injectArtifactReadIfNeeded(toolResultJS, ctx)) {
|
|
720
|
+
log.info("[agent-loop] Tool result carries an artifact_ref — injected artifact_read into loadout")
|
|
721
|
+
}
|
|
722
|
+
|
|
675
723
|
// Encode TOON only for LLM consumption (with cost calculation)
|
|
676
724
|
const toolResultLLM = formatToolResult(toolResultJS, cleanModel)
|
|
677
725
|
|
|
@@ -182,20 +182,55 @@ export async function callLLM(options: LLMCallOptions): Promise<LLMResponse> {
|
|
|
182
182
|
const cleanModel = options.model.replace(new RegExp(`^${options.provider}\\/`), "")
|
|
183
183
|
const status = extractErrorStatus(err)
|
|
184
184
|
const modelUnavailable = status === 404 || status === 410
|
|
185
|
-
const msg =
|
|
186
|
-
? `El modelo "${cleanModel}" ya no existe en ${options.provider} (HTTP ${status}). `
|
|
187
|
-
+ `El proveedor lo retiró de su catálogo; reintentar no sirve. `
|
|
188
|
-
+ `Elegí otro modelo en Ajustes → Proveedores.`
|
|
189
|
-
: (err as Error).message
|
|
185
|
+
const msg = describeProviderFailure(err, status, options.provider, cleanModel)
|
|
190
186
|
log.error(`[llm-client] Error calling ${options.provider}/${cleanModel}: ${msg}`, err)
|
|
191
187
|
return {
|
|
192
|
-
content:
|
|
188
|
+
content: `${LLM_ERROR_PREFIX} ${msg}`,
|
|
193
189
|
stop_reason: "error",
|
|
194
190
|
error: { message: msg, status, modelUnavailable },
|
|
195
191
|
}
|
|
196
192
|
}
|
|
197
193
|
}
|
|
198
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Marks content that is a provider failure rather than something the agent
|
|
197
|
+
* said. webchat-turn.ts keys the failed-turn UI off this prefix, and
|
|
198
|
+
* agent-loop.ts keeps such content out of the conversation history.
|
|
199
|
+
*/
|
|
200
|
+
export const LLM_ERROR_PREFIX = "[LLM Error]"
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Turns a provider failure into something the user can act on.
|
|
204
|
+
*
|
|
205
|
+
* The raw SDK text is written for whoever is reading a stack trace: "429 status
|
|
206
|
+
* code (no body)" showed up verbatim in the chat and says nothing about what
|
|
207
|
+
* happened (the account hit its rate limit) or what to do about it. Statuses
|
|
208
|
+
* without a specific mapping keep the original message — a wrong explanation is
|
|
209
|
+
* worse than a technical one.
|
|
210
|
+
*/
|
|
211
|
+
export function describeProviderFailure(
|
|
212
|
+
err: unknown,
|
|
213
|
+
status: number | undefined,
|
|
214
|
+
provider: string,
|
|
215
|
+
cleanModel: string,
|
|
216
|
+
): string {
|
|
217
|
+
if (status === 404 || status === 410) {
|
|
218
|
+
return `El modelo "${cleanModel}" ya no existe en ${provider} (HTTP ${status}). `
|
|
219
|
+
+ `El proveedor lo retiró de su catálogo; reintentar no sirve. `
|
|
220
|
+
+ `Elegí otro modelo en Ajustes → Proveedores.`
|
|
221
|
+
}
|
|
222
|
+
if (status === 429) {
|
|
223
|
+
return `${provider} está limitando las peticiones (HTTP 429) y los reintentos tampoco pasaron. `
|
|
224
|
+
+ `Es el límite de uso de tu cuenta, no un problema del modelo: esperá unos minutos, `
|
|
225
|
+
+ `revisá tu cuota con el proveedor, o cambiá de modelo en Ajustes → Proveedores.`
|
|
226
|
+
}
|
|
227
|
+
if (status === 401 || status === 403) {
|
|
228
|
+
return `${provider} rechazó la API key (HTTP ${status}). `
|
|
229
|
+
+ `Revisá que siga siendo válida y tenga acceso a "${cleanModel}" en Ajustes → Proveedores.`
|
|
230
|
+
}
|
|
231
|
+
return (err as Error).message
|
|
232
|
+
}
|
|
233
|
+
|
|
199
234
|
/** Provider SDKs disagree on where the HTTP status lands; check every shape we've seen. */
|
|
200
235
|
function extractErrorStatus(err: unknown): number | undefined {
|
|
201
236
|
const e = err as { status?: number; statusCode?: number; response?: { status?: number } }
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import { OpenAICompatBase } from "./openai-compat-base"
|
|
2
|
+
import type { LLMCallOptions } from "../llm-client"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* NIM mantiene el razonamiento APAGADO por defecto en su endpoint compatible
|
|
6
|
+
* con OpenAI, y el interruptor no es el `reasoning_effort` de OpenAI sino
|
|
7
|
+
* `chat_template_kwargs`, con una clave distinta por familia de modelo.
|
|
8
|
+
*
|
|
9
|
+
* Verificado en vivo contra integrate.api.nvidia.com (2026-08-15):
|
|
10
|
+
* `z-ai/glm-5.2` no emite un solo `reasoning_content` sin esto — el delta trae
|
|
11
|
+
* únicamente `role` y `content` — y sí lo emite con `enable_thinking`. Por eso
|
|
12
|
+
* la app no mostraba razonamiento con los modelos de NVIDIA: no llegaba.
|
|
13
|
+
*
|
|
14
|
+
* Las familias que no están acá se dejan en paz a propósito. Nemotron 3 ya
|
|
15
|
+
* emite `reasoning_content` sin ningún kwarg (también verificado), y mandarle
|
|
16
|
+
* una clave que su plantilla no acepta es justamente lo que rompe la llamada.
|
|
17
|
+
*/
|
|
18
|
+
const THINKING_KWARGS: Array<{ pattern: RegExp; kwargs: Record<string, unknown> }> = [
|
|
19
|
+
// Verificado con z-ai/glm-5.2.
|
|
20
|
+
{ pattern: /glm/i, kwargs: { enable_thinking: true, clear_thinking: false } },
|
|
21
|
+
// Verificado con minimaxai/minimax-m3.
|
|
22
|
+
{ pattern: /minimax/i, kwargs: { thinking_mode: "enabled" } },
|
|
23
|
+
// Documentado por NVIDIA, sin verificar: moonshotai/kimi-k2.6 responde 404
|
|
24
|
+
// en la cuenta con la que se probó. Si la plantilla lo rechaza, el reintento
|
|
25
|
+
// de openai-compat-base repite la llamada sin kwargs.
|
|
26
|
+
{ pattern: /kimi|deepseek/i, kwargs: { thinking: true } },
|
|
27
|
+
{ pattern: /qwen|qwq/i, kwargs: { enable_thinking: true } },
|
|
28
|
+
]
|
|
2
29
|
|
|
3
30
|
export class NvidiaProvider extends OpenAICompatBase {
|
|
4
31
|
constructor() { super("nvidia") }
|
|
32
|
+
|
|
33
|
+
protected modifyRequestBody(body: any, options: LLMCallOptions): any {
|
|
34
|
+
if (!options.thinking?.enabled) return body
|
|
35
|
+
|
|
36
|
+
const match = THINKING_KWARGS.find(({ pattern }) => pattern.test(options.model))
|
|
37
|
+
if (!match) return body
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
...body,
|
|
41
|
+
chat_template_kwargs: { ...(body.chat_template_kwargs ?? {}), ...match.kwargs },
|
|
42
|
+
}
|
|
43
|
+
}
|
|
5
44
|
}
|
|
@@ -9,6 +9,32 @@ import type { ContentPart, LLMMessage } from "../llm-client"
|
|
|
9
9
|
|
|
10
10
|
const log = logger.child("llm-client")
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Statuses that mean "this body is malformed or unsupported" — the only ones
|
|
14
|
+
* where dropping the provider extras can possibly help.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately narrow. A first version retried on any status and immediately
|
|
17
|
+
* misfired in production against a 429: a rate limit is not a body problem, so
|
|
18
|
+
* the retry spent a second request against the very limit that rejected the
|
|
19
|
+
* first, and turned thinking off for nothing. Same for 401/403 (auth) and 404
|
|
20
|
+
* (unknown model).
|
|
21
|
+
*/
|
|
22
|
+
const EXTRAS_REJECTED_CODES = [400, 422]
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Drops the non-standard fields a provider added on top of an OpenAI-shaped
|
|
26
|
+
* body, for use on a retry after the body itself was rejected. Right now that
|
|
27
|
+
* is only NIM's `chat_template_kwargs` (nvidia.ts): it enables the model's
|
|
28
|
+
* thinking, so losing it costs the reasoning display and nothing else — a far
|
|
29
|
+
* better outcome than a turn that dies because one model's chat template did
|
|
30
|
+
* not recognize the switch.
|
|
31
|
+
*/
|
|
32
|
+
function stripProviderExtras(body: any): any {
|
|
33
|
+
if (!body?.chat_template_kwargs) return body
|
|
34
|
+
const { chat_template_kwargs: _dropped, ...rest } = body
|
|
35
|
+
return rest
|
|
36
|
+
}
|
|
37
|
+
|
|
12
38
|
/** Matches both generic "context length exceeded" phrasing and llama.cpp's exceed_context_size_error shape. */
|
|
13
39
|
function isContextOverflowError(err: any, errMsg: string): boolean {
|
|
14
40
|
const status = err?.status ?? err?.response?.status
|
|
@@ -183,7 +209,14 @@ export abstract class OpenAICompatBase implements LLMProvider {
|
|
|
183
209
|
delete bodyNoTools.tools
|
|
184
210
|
delete bodyNoTools.tool_choice
|
|
185
211
|
delete bodyNoTools.parallel_tool_calls
|
|
186
|
-
response = await client.chat.completions.create(this.modifyRequestBody(bodyNoTools, options), { signal: options.signal })
|
|
212
|
+
response = await client.chat.completions.create(stripProviderExtras(this.modifyRequestBody(bodyNoTools, options)), { signal: options.signal })
|
|
213
|
+
}
|
|
214
|
+
// Retry 3: the provider-specific extras are the only other thing we added
|
|
215
|
+
// to an otherwise standard body (NIM's chat_template_kwargs — see
|
|
216
|
+
// nvidia.ts). Losing the reasoning display beats failing the turn.
|
|
217
|
+
else if (EXTRAS_REJECTED_CODES.includes(status) && this.modifyRequestBody(body, options).chat_template_kwargs) {
|
|
218
|
+
log.warn(`[llm-client] ${this.providerName}: request rejected (HTTP ${status}) — retrying without chat_template_kwargs`)
|
|
219
|
+
response = await client.chat.completions.create(stripProviderExtras(this.modifyRequestBody(body, options)), { signal: options.signal })
|
|
187
220
|
}
|
|
188
221
|
else {
|
|
189
222
|
throw err
|
|
@@ -254,7 +287,10 @@ export abstract class OpenAICompatBase implements LLMProvider {
|
|
|
254
287
|
delete bodyNoTools.tools
|
|
255
288
|
delete bodyNoTools.tool_choice
|
|
256
289
|
delete bodyNoTools.parallel_tool_calls
|
|
257
|
-
stream = await client.chat.completions.create({ ...this.modifyRequestBody(bodyNoTools, options), stream: true }, { signal: options.signal })
|
|
290
|
+
stream = await client.chat.completions.create({ ...stripProviderExtras(this.modifyRequestBody(bodyNoTools, options)), stream: true }, { signal: options.signal })
|
|
291
|
+
} else if (EXTRAS_REJECTED_CODES.includes(status) && this.modifyRequestBody(body, options).chat_template_kwargs) {
|
|
292
|
+
log.warn(`[llm-client] ${this.providerName}: request rejected (HTTP ${status}) — retrying stream without chat_template_kwargs`)
|
|
293
|
+
stream = await client.chat.completions.create({ ...stripProviderExtras(this.modifyRequestBody(body, options)), stream: true }, { signal: options.signal })
|
|
258
294
|
} else {
|
|
259
295
|
throw err
|
|
260
296
|
}
|
|
@@ -81,6 +81,42 @@ async function materializeBinary(
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/** Above this, parsing the text just to describe it costs more than it explains. */
|
|
85
|
+
const MAX_SHAPE_PROBE_CHARS = 5_000_000;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Describes the shape of a JSON payload so the model can aim `artifact_read`
|
|
89
|
+
* instead of paging blind.
|
|
90
|
+
*
|
|
91
|
+
* The 500-char preview alone is close to useless on the payload this was
|
|
92
|
+
* written for — a Gmail MCP result where the first message's `received`
|
|
93
|
+
* headers eat the whole window before a single subject line appears. Knowing
|
|
94
|
+
* "12 items, keyed id/threadId/labelIds/headers" is what turns a search into
|
|
95
|
+
* one call.
|
|
96
|
+
*/
|
|
97
|
+
function describeJsonShape(text: string): Record<string, unknown> {
|
|
98
|
+
if (text.length > MAX_SHAPE_PROBE_CHARS) return {};
|
|
99
|
+
const trimmed = text.trimStart();
|
|
100
|
+
if (!trimmed.startsWith("[") && !trimmed.startsWith("{")) return {};
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
const parsed = JSON.parse(text);
|
|
104
|
+
if (Array.isArray(parsed)) {
|
|
105
|
+
const first = parsed.find((item) => item && typeof item === "object" && !Array.isArray(item));
|
|
106
|
+
return {
|
|
107
|
+
json_items: parsed.length,
|
|
108
|
+
...(first ? { json_item_keys: Object.keys(first as Record<string, unknown>).slice(0, 25) } : {}),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (parsed && typeof parsed === "object") {
|
|
112
|
+
return { json_keys: Object.keys(parsed as Record<string, unknown>).slice(0, 25) };
|
|
113
|
+
}
|
|
114
|
+
} catch {
|
|
115
|
+
// Not JSON, or truncated JSON — the plain preview still stands.
|
|
116
|
+
}
|
|
117
|
+
return {};
|
|
118
|
+
}
|
|
119
|
+
|
|
84
120
|
async function materializeText(text: string, ctx: McpNormalizeContext): Promise<Record<string, unknown>> {
|
|
85
121
|
if (!ctx.userId) {
|
|
86
122
|
log.warn(`[materializeText] No user_id in tool context — truncating oversized text block (${text.length} chars) instead of creating an artifact`);
|
|
@@ -101,7 +137,13 @@ async function materializeText(text: string, ctx: McpNormalizeContext): Promise<
|
|
|
101
137
|
artifact_id: artifact.id,
|
|
102
138
|
mime_type: "text/plain",
|
|
103
139
|
size: artifact.size,
|
|
140
|
+
chars: text.length,
|
|
104
141
|
preview: text.length > 500 ? `${text.slice(0, 500)}…` : text,
|
|
142
|
+
...describeJsonShape(text),
|
|
143
|
+
// Without this the model only knows the data exists somewhere. It used to
|
|
144
|
+
// reach for artifact_inspect (metadata only), find nothing usable, and
|
|
145
|
+
// spend its remaining iterations guessing.
|
|
146
|
+
hint: "Full content is available via artifact_read (artifactId + offset/limit, or search).",
|
|
105
147
|
};
|
|
106
148
|
}
|
|
107
149
|
|
|
@@ -201,6 +201,7 @@ export const CORE_TOOL_CATALOG: ToolDescriptor[] = [
|
|
|
201
201
|
|
|
202
202
|
// Artifacts
|
|
203
203
|
{ name: "artifact_inspect", description: "Inspect a managed artifact's integrity and metadata without modifying it. Spanish keywords: inspeccionar artefacto, verificar archivo generado, metadatos artefacto, comprobar entrega", category: "web", abstractionLevel: "atomic" },
|
|
204
|
+
{ name: "artifact_read", description: "Read a managed artifact's text content in slices, or search inside it — the way to open any artifact_ref a tool returned. Spanish keywords: leer artefacto, ver contenido del artefacto, abrir resultado grande, buscar dentro del artefacto", category: "web", abstractionLevel: "atomic" },
|
|
204
205
|
|
|
205
206
|
// Office documents — read
|
|
206
207
|
{ name: "office_leer_pdf", description: "Read and extract text from a PDF document. Spanish keywords: leer pdf, extraer texto pdf, abrir pdf, contenido pdf", category: "office", abstractionLevel: "atomic" },
|
|
@@ -107,6 +107,71 @@ export async function readArtifactBytes(
|
|
|
107
107
|
return { bytes: readFileSync(entry.doc.path), mimeType: entry.doc.mime_type };
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/** Beyond this an artifact stops being something an agent can read into a context window. */
|
|
111
|
+
const MAX_TEXT_ARTIFACT_BYTES = 25 * 1024 * 1024;
|
|
112
|
+
|
|
113
|
+
function looksBinary(mimeType: string, bytes: Buffer): boolean {
|
|
114
|
+
if (/^(image|audio|video)\//.test(mimeType)) return true;
|
|
115
|
+
if (mimeType === "application/octet-stream") return true;
|
|
116
|
+
// A NUL byte in the first KB is the classic "this is not text" tell — a
|
|
117
|
+
// mislabelled text/plain artifact would otherwise decode to garbage.
|
|
118
|
+
return bytes.subarray(0, 1024).includes(0x00);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type ArtifactTextResult = {
|
|
122
|
+
ok: boolean;
|
|
123
|
+
text?: string;
|
|
124
|
+
artifact?: ArtifactDoc;
|
|
125
|
+
error?: string;
|
|
126
|
+
status?: string;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Decodes a text artifact for in-process consumers that need its *content*,
|
|
131
|
+
* not just its metadata (inspectArtifact) or its raw bytes (readArtifactBytes).
|
|
132
|
+
*
|
|
133
|
+
* This exists because mcp-result-normalizer.ts moves oversized MCP text results
|
|
134
|
+
* out of the context window and hands the model an `artifact_ref` instead. Until
|
|
135
|
+
* this, nothing could read that reference back: the agent held a receipt it
|
|
136
|
+
* could not cash, burned its iterations guessing, and the turn died on an empty
|
|
137
|
+
* synthesis. Ownership and status checks mirror inspectArtifact's.
|
|
138
|
+
*/
|
|
139
|
+
export async function readArtifactText(
|
|
140
|
+
artifactId: string,
|
|
141
|
+
options: { userId?: string } = {},
|
|
142
|
+
): Promise<ArtifactTextResult> {
|
|
143
|
+
const artifacts = await col<ArtifactDoc>("artifacts");
|
|
144
|
+
const entry = await artifacts.get(artifactId);
|
|
145
|
+
if (!entry) return { ok: false, error: "Artifact not found" };
|
|
146
|
+
const artifact = entry.doc;
|
|
147
|
+
|
|
148
|
+
if (options.userId && artifact.user_id && artifact.user_id !== options.userId) {
|
|
149
|
+
return { ok: false, error: "Artifact not accessible" };
|
|
150
|
+
}
|
|
151
|
+
if (artifact.status !== "active") {
|
|
152
|
+
return { ok: false, error: "Artifact binary has expired", status: artifact.status };
|
|
153
|
+
}
|
|
154
|
+
if (!existsSync(artifact.path)) {
|
|
155
|
+
return { ok: false, error: "Artifact binary is missing", status: "missing" };
|
|
156
|
+
}
|
|
157
|
+
if (artifact.size > MAX_TEXT_ARTIFACT_BYTES) {
|
|
158
|
+
return {
|
|
159
|
+
ok: false,
|
|
160
|
+
error: `Artifact is too large to read as text (${artifact.size} bytes, limit ${MAX_TEXT_ARTIFACT_BYTES})`,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const bytes = readFileSync(artifact.path);
|
|
165
|
+
if (looksBinary(detectedMime(bytes, artifact.mime_type), bytes)) {
|
|
166
|
+
return {
|
|
167
|
+
ok: false,
|
|
168
|
+
error: `Artifact is binary (${detectedMime(bytes, artifact.mime_type)}) — use artifact_inspect for its metadata`,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return { ok: true, text: bytes.toString("utf-8"), artifact };
|
|
173
|
+
}
|
|
174
|
+
|
|
110
175
|
export async function inspectArtifact(
|
|
111
176
|
artifactId: string,
|
|
112
177
|
options: { userId?: string } = {},
|
|
@@ -44,6 +44,9 @@ const TOOL_NARRATIONS: Record<string, string> = {
|
|
|
44
44
|
browser_type: "Escribiendo en la página...",
|
|
45
45
|
browser_screenshot: "Tomando captura de pantalla...",
|
|
46
46
|
browser_extract: "Extrayendo información de la página...",
|
|
47
|
+
// Artefactos
|
|
48
|
+
artifact_inspect: "Verificando el archivo generado...",
|
|
49
|
+
artifact_read: "Leyendo el resultado completo...",
|
|
47
50
|
// Canvas
|
|
48
51
|
canvas_add_node: "Actualizando canvas...",
|
|
49
52
|
canvas_update: "Actualizando canvas...",
|
|
@@ -211,13 +211,18 @@ export async function handleTriggerUpdate(
|
|
|
211
211
|
// escritorio (Tauri) — GitHub Releases ya no publica binarios
|
|
212
212
|
// standalone sueltos, así que no hay un "archivo" que reemplazar
|
|
213
213
|
// manualmente. La actualización real la maneja el updater de Tauri.
|
|
214
|
+
// El gateway no puede actualizarse a sí mismo acá: vive embebido en la
|
|
215
|
+
// app de escritorio, y quien descarga, verifica la firma e instala es
|
|
216
|
+
// el updater de Tauri desde la ventana (components/DesktopUpdater.tsx).
|
|
217
|
+
// Este endpoint solo explica dónde ocurre; prometer que "se actualiza
|
|
218
|
+
// sola" cuando nadie disparaba el chequeo fue el bug anterior.
|
|
214
219
|
return addCorsHeaders(Response.json({
|
|
215
220
|
success: false,
|
|
216
|
-
error: "La app de escritorio se actualiza
|
|
221
|
+
error: "La app de escritorio se actualiza desde su propia ventana, no desde el gateway.",
|
|
217
222
|
instructions: [
|
|
218
|
-
"1. La app revisa
|
|
219
|
-
"2.
|
|
220
|
-
"3.
|
|
223
|
+
"1. La app revisa si hay versión nueva al abrirse y cada 6 horas",
|
|
224
|
+
"2. Cuando la encuentra te muestra un aviso con las notas y un botón para instalarla; al terminar se reinicia sola",
|
|
225
|
+
"3. Si preferís hacerlo a mano, descargá el instalador de tu sistema desde https://github.com/johpaz/hive/releases/latest — conserva tus datos y agentes"
|
|
221
226
|
]
|
|
222
227
|
}), req)
|
|
223
228
|
|
|
@@ -22,6 +22,8 @@ import { getNarration } from "./helpers";
|
|
|
22
22
|
import { createRun, getRun } from "../agent/run-store";
|
|
23
23
|
import { getDurableQueue } from "./durable-queue";
|
|
24
24
|
import { sessionManager } from "./session";
|
|
25
|
+
import { publishNarration } from "../events/narration";
|
|
26
|
+
import { LLM_ERROR_PREFIX } from "../agent/llm-client";
|
|
25
27
|
import type { JobDoc, TurnSource } from "../storage/collections";
|
|
26
28
|
|
|
27
29
|
const log = logger.child("webchat-turn");
|
|
@@ -493,7 +495,13 @@ export async function runWebchatTurn(
|
|
|
493
495
|
}
|
|
494
496
|
}
|
|
495
497
|
|
|
496
|
-
if (
|
|
498
|
+
if (content.startsWith(LLM_ERROR_PREFIX)) {
|
|
499
|
+
// El turno terminó sin excepción pero lo que devuelve es una falla del
|
|
500
|
+
// proveedor (callLLM la entrega como contenido, no como throw). Cerrar la
|
|
501
|
+
// burbuja con "Listo" encima de un mensaje de error es decirle al usuario
|
|
502
|
+
// que salió bien algo que no salió.
|
|
503
|
+
processReporter?.error("El proveedor del modelo rechazó la petición");
|
|
504
|
+
} else if (delegationGroup) {
|
|
497
505
|
processReporter?.pending();
|
|
498
506
|
} else {
|
|
499
507
|
processReporter?.done("Listo");
|
|
@@ -501,6 +509,31 @@ export async function runWebchatTurn(
|
|
|
501
509
|
return content;
|
|
502
510
|
} catch (error) {
|
|
503
511
|
processReporter?.error("No se pudo completar la respuesta");
|
|
512
|
+
// La narración vive en su propia burbuja del chat (server.ts la entrega con
|
|
513
|
+
// messageId = turn_id, distinto del messageId de este turno) y solo se
|
|
514
|
+
// cierra cuando llega el tool_result de cada tool_call. Si el turno muere
|
|
515
|
+
// entre medio — como pasaba con "Tool worker entry not found" — ese
|
|
516
|
+
// tool_result nunca se publica y la burbuja queda en "Pensando" para
|
|
517
|
+
// siempre, aunque el processReporter ya haya marcado error. Este evento
|
|
518
|
+
// terminal la cierra, y a diferencia del processReporter no depende del
|
|
519
|
+
// socket del job: se entrega por sessionManager, así que también alcanza a
|
|
520
|
+
// los turnos rehidratados.
|
|
521
|
+
if (payload.turnId) {
|
|
522
|
+
await publishNarration({
|
|
523
|
+
turnId: payload.turnId,
|
|
524
|
+
threadId,
|
|
525
|
+
channel,
|
|
526
|
+
userId,
|
|
527
|
+
sessionId,
|
|
528
|
+
kind: "failed",
|
|
529
|
+
status: "error",
|
|
530
|
+
label: "No se pudo completar la respuesta",
|
|
531
|
+
detail: (error as Error).message,
|
|
532
|
+
dedupeKey: `turn_failed:${payload.turnId}`,
|
|
533
|
+
}).catch((err) =>
|
|
534
|
+
log.warn(`[runWebchatTurn] Could not publish the turn's failure narration: ${(err as Error).message}`)
|
|
535
|
+
);
|
|
536
|
+
}
|
|
504
537
|
// Detener typing aunque falle — nunca dejar el spinner infinito
|
|
505
538
|
send({ type: "typing", isTyping: false, sessionId });
|
|
506
539
|
send({ type: "error", sessionId, error: (error as Error).message });
|
|
@@ -55,6 +55,7 @@ export const SEED_DATA: SeedData = {
|
|
|
55
55
|
{ id: "browser_navigate", name: "browser_navigate", category: "web", description: "Navegar a una URL y obtener contenido renderizado (soporta JS). Sinónimos: abrir página, sitio web, navegar url, cargar página" },
|
|
56
56
|
{ id: "browser_screenshot", name: "browser_screenshot", category: "web", description: "Tomar captura de pantalla de la página actual. Sinónimos: screenshot, imagen de página, capturar pantalla, foto página" },
|
|
57
57
|
{ id: "artifact_inspect", name: "artifact_inspect", category: "web", description: "Inspeccionar integridad y metadatos de un artefacto administrado sin modificarlo. Sinónimos: inspeccionar artefacto, verificar archivo generado, metadatos artefacto, comprobar entrega" },
|
|
58
|
+
{ id: "artifact_read", name: "artifact_read", category: "web", description: "Leer por partes el contenido de texto de un artefacto administrado, o buscar dentro de él. Sinónimos: leer artefacto, ver contenido del artefacto, abrir resultado grande, buscar dentro del artefacto, leer artifact_ref" },
|
|
58
59
|
{ 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" },
|
|
59
60
|
{ 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" },
|
|
60
61
|
{ 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" },
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Auto-generado — NO EDITAR.
|
|
2
|
+
//
|
|
3
|
+
// Lo que se commitea es SIEMPRE este stub. `scripts/build-gateway.ts` lo
|
|
4
|
+
// reescribe justo antes de compilar el binario standalone con:
|
|
5
|
+
//
|
|
6
|
+
// import workerFile from "./tool-worker.generated.js" with { type: "file" }
|
|
7
|
+
// export const embeddedToolWorkerPath: string | null = workerFile
|
|
8
|
+
//
|
|
9
|
+
// y lo restaura al terminar. Ese `with { type: "file" }` es lo que hace que
|
|
10
|
+
// `bun build --compile` meta el bundle del tool worker dentro del ejecutable
|
|
11
|
+
// (queda en /$bunfs/root/...), porque `new Worker(new URL("./tool-worker.ts",
|
|
12
|
+
// import.meta.url))` NO se embebe solo: el path se resuelve en runtime y el
|
|
13
|
+
// bundler no lo ve. Sin esto, la app de escritorio se instala sin worker y
|
|
14
|
+
// cualquier turno con más de una tool call moría con "Tool worker entry not
|
|
15
|
+
// found" (v1.0.3 y anteriores).
|
|
16
|
+
//
|
|
17
|
+
// En dev y en el paquete npm este valor es null y no hace falta: el worker se
|
|
18
|
+
// resuelve desde disco (tool-worker.ts al lado de este archivo, o
|
|
19
|
+
// dist/tool-worker.js junto al bundle).
|
|
20
|
+
export const embeddedToolWorkerPath: string | null = null
|