@johpaz/hive-agents 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/hive.js +88127 -103024
- package/dist/tool-worker.js +13243 -17002
- package/dist/ui/assets/A2UIPage-CS0VPY6a.js +8 -0
- package/dist/ui/assets/AgentCreateForm-DXkjtXaS.js +1 -0
- package/dist/ui/assets/AgentDetailPage-DUIX_cuQ.js +1 -0
- package/dist/ui/assets/AgentNewPage-SNXz2wik.js +1 -0
- package/dist/ui/assets/AgentsPage-CGsdgx5F.js +10 -0
- package/dist/ui/assets/{ApiClientPage-6a6KFwsQ.js → ApiClientPage-MNMjfSDs.js} +2 -2
- package/dist/ui/assets/ChannelsPage-BEwxWUcE.js +8 -0
- package/dist/ui/assets/DashboardPage-D6cRFKWW.js +6 -0
- package/dist/ui/assets/LoginPage-ByYmIa2p.js +1 -0
- package/dist/ui/assets/LogsPage-Bmk9rohg.js +1 -0
- package/dist/ui/assets/MeetingPage-Dm97Mbiw.js +1 -0
- package/dist/ui/assets/ModelSelector-gubC8j_Q.js +1 -0
- package/dist/ui/assets/NotFound-PUg3gEO0.js +1 -0
- package/dist/ui/assets/{Office3DPage-C3SIzd2H.css → Office3DPage-31AMJ-LN.css} +1 -1
- package/dist/ui/assets/Office3DPage-Bfi-S2kG.js +727 -0
- package/dist/ui/assets/ProvidersPage-CSo0MYxd.js +1 -0
- package/dist/ui/assets/RecoverPage-YY2QU-qh.js +1 -0
- package/dist/ui/assets/SettingsPage-DrafhhKw.js +9 -0
- package/dist/ui/assets/SetupPage-LXnd2XbV.js +1 -0
- package/dist/ui/assets/Vignette-BcPWkNhm.js +4302 -0
- package/dist/ui/assets/VoicePage-p-hTMAq7.js +307 -0
- package/dist/ui/assets/VoicePage-uLWdtoD4.css +1 -0
- package/dist/ui/assets/WebChatPage-B61ZDjQ8.js +29 -0
- package/dist/ui/assets/agentCapabilities-PfTEVxG1.js +1 -0
- package/dist/ui/assets/alert-CjiX20jI.js +1 -0
- package/dist/ui/assets/badge-B5AKge1b.js +1 -0
- package/dist/ui/assets/bia-4LFKOyxR.webp +0 -0
- package/dist/ui/assets/bia-BFcUpOu3.glb +0 -0
- package/dist/ui/assets/card-mTJ4oZbL.js +1 -0
- package/dist/ui/assets/conversationsStore-BlwA3yd2.js +1 -0
- package/dist/ui/assets/dialog-B04KpdNt.js +1 -0
- package/dist/ui/assets/dist-js-Dh18rcg9.js +1 -0
- package/dist/ui/assets/{dist-js-CLxM1g2B.js → dist-js-q7C_AB0j.js} +1 -1
- package/dist/ui/assets/index-ByTufXPh.css +2 -0
- package/dist/ui/assets/index-DKJFLL3a.js +116 -0
- package/dist/ui/assets/label-D_fvqJyD.js +1 -0
- package/dist/ui/assets/lock-3IApZyVy.js +1 -0
- package/dist/ui/assets/{square-psq7k_CB.js → mic-CpDU_2as.js} +1 -1
- package/dist/ui/assets/pencil-L3Li7_pz.js +1 -0
- package/dist/ui/assets/rotate-ccw-LoM1AuqK.js +1 -0
- package/dist/ui/assets/scroll-area-CbH8FOo8.js +1 -0
- package/dist/ui/assets/select-v_3QBYrD.js +1 -0
- package/dist/ui/assets/slider-DXS4h1LB.js +1 -0
- package/dist/ui/assets/square-D5zdNkAY.js +1 -0
- package/dist/ui/assets/switch-ndx8VCpm.js +1 -0
- package/dist/ui/assets/tabs-epu-3Tl4.js +1 -0
- package/dist/ui/assets/textarea-BgZJFZTX.js +1 -0
- package/dist/ui/assets/useAudioDevices-B2stUHvr.js +41 -0
- package/dist/ui/assets/useHiveAgentsModelLoad-B4EjHvj4.js +1 -0
- package/dist/ui/assets/useOfficeModel-BaDn7U-X.js +1 -0
- package/dist/ui/assets/{useProviders-CiLSc05q.js → useProviders-B1NS24md.js} +1 -1
- package/dist/ui/assets/vendor-react-kUOwxn0g.js +1 -0
- package/dist/ui/assets/volume-2-EaA0JRvD.js +1 -0
- package/dist/ui/assets/volume-x-CROXNMGT.js +1 -0
- package/dist/ui/index.html +6 -6
- package/package.json +10 -6
- package/packages/cli/src/adapters/config.ts +11 -3
- package/packages/cli/src/commands/causal.ts +1 -1
- package/packages/cli/src/commands/doctor.ts +101 -46
- package/packages/cli/src/commands/onboard.ts +4 -2
- package/packages/core/src/agent/agent-catalog.ts +47 -47
- package/packages/core/src/agent/agent-loop.ts +67 -14
- package/packages/core/src/agent/capability-search.ts +2 -1
- package/packages/core/src/agent/compaction.ts +19 -7
- package/packages/core/src/agent/context-compiler.ts +166 -28
- package/packages/core/src/agent/conversation-store.ts +26 -2
- package/packages/core/src/agent/goal-runner.ts +2 -2
- package/packages/core/src/agent/jev-decisions.ts +148 -0
- package/packages/core/src/agent/jev-planner.ts +293 -0
- package/packages/core/src/agent/llm-client.ts +29 -7
- package/packages/core/src/agent/llm-providers/ollama.ts +17 -4
- package/packages/core/src/agent/llm-providers/openai-compat-base.ts +27 -12
- package/packages/core/src/agent/llm-providers/opencode-go.ts +37 -0
- package/packages/core/src/agent/prompt-builder.ts +1 -1
- package/packages/core/src/agent/realtime-providers/gemini-live.ts +233 -0
- package/packages/core/src/agent/realtime-providers/index.ts +29 -0
- package/packages/core/src/agent/realtime-providers/interface.ts +108 -0
- package/packages/core/src/agent/skill-selector.ts +5 -3
- package/packages/core/src/agent/thread-id.ts +71 -0
- package/packages/core/src/agent/thread-store.ts +230 -0
- package/packages/core/src/agent/tool-selector.ts +2 -0
- package/packages/core/src/agent/tracer.ts +2 -0
- package/packages/core/src/canvas/canvas-manager.ts +145 -27
- package/packages/core/src/canvas/emitter.ts +24 -0
- package/packages/core/src/channels/telegram.ts +19 -1
- package/packages/core/src/channels/webchat.ts +47 -45
- package/packages/core/src/config/loader.ts +9 -6
- package/packages/core/src/events/tool-narration.ts +1 -0
- package/packages/core/src/gateway/channel-notify.ts +24 -5
- package/packages/core/src/gateway/delegation-groups.ts +5 -5
- package/packages/core/src/gateway/delegation-notify.ts +34 -5
- package/packages/core/src/gateway/durable-queue.ts +22 -0
- package/packages/core/src/gateway/failure-notify.ts +8 -2
- package/packages/core/src/gateway/initializer.ts +17 -10
- package/packages/core/src/gateway/job-executors.ts +3 -3
- package/packages/core/src/gateway/realtime/bridge-tools.ts +470 -0
- package/packages/core/src/gateway/realtime/index.ts +305 -0
- package/packages/core/src/gateway/realtime/prompt.ts +182 -0
- package/packages/core/src/gateway/realtime/protocol.ts +60 -0
- package/packages/core/src/gateway/realtime/voice-session.ts +442 -0
- package/packages/core/src/gateway/resolver.ts +31 -4
- package/packages/core/src/gateway/routes/artifacts.ts +13 -0
- package/packages/core/src/gateway/routes/chat.ts +20 -4
- package/packages/core/src/gateway/routes/conversations.ts +121 -0
- package/packages/core/src/gateway/routes/providers.ts +16 -1
- package/packages/core/src/gateway/routes/setup.ts +25 -14
- package/packages/core/src/gateway/routes/system.ts +4 -2
- package/packages/core/src/gateway/routes/tts-local.ts +2 -1
- package/packages/core/src/gateway/server.ts +171 -13
- package/packages/core/src/gateway/slash-commands.ts +48 -10
- package/packages/core/src/gateway/tts/src/server.ts +2 -1
- package/packages/core/src/gateway/webchat-turn.ts +68 -10
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/scheduler/CronScheduler.ts +20 -8
- package/packages/core/src/scheduler/cron/cron-engine.test.ts +295 -0
- package/packages/core/src/scheduler/cron/expression.ts +165 -0
- package/packages/core/src/scheduler/cron/index.ts +10 -0
- package/packages/core/src/scheduler/cron/job.ts +340 -0
- package/packages/core/src/scheduler/cron/next-run.ts +121 -0
- package/packages/core/src/scheduler/cron/zoned-time.ts +139 -0
- package/packages/core/src/scheduler/integration.ts +16 -5
- package/packages/core/src/scheduler/types.ts +3 -18
- package/packages/core/src/storage/bootstrap.ts +23 -0
- package/packages/core/src/storage/collections.ts +38 -1
- package/packages/core/src/storage/crypto.ts +23 -12
- package/packages/core/src/storage/onboarding.ts +39 -39
- package/packages/core/src/storage/reconcile.ts +6 -1
- package/packages/core/src/storage/seed.ts +82 -8
- package/packages/core/src/storage/usage.ts +53 -1
- package/packages/core/src/tool-runtime/index.ts +19 -1
- package/packages/core/src/tools/a2ui/index.ts +65 -1
- package/packages/core/src/tools/agents/get-available-models.ts +3 -1
- package/packages/core/src/tools/core/index.ts +39 -4
- package/packages/core/src/tools/cron/index.ts +4 -4
- package/packages/core/src/tools/index.ts +2 -1
- package/packages/core/src/tools/office/office-escribir-xlsx.ts +2 -1
- package/packages/core/src/tools/office/office-leer-xlsx.ts +2 -1
- package/packages/core/src/tools/office/xlsx-loader.ts +19 -0
- package/packages/core/src/tools/web/browser-backend.ts +141 -44
- package/packages/core/src/tools/web/browser-click.ts +2 -2
- package/packages/core/src/tools/web/browser-extract.ts +2 -2
- package/packages/core/src/tools/web/browser-navigate.ts +2 -2
- package/packages/core/src/tools/web/browser-screenshot.ts +12 -5
- package/packages/core/src/tools/web/browser-script.ts +2 -2
- package/packages/core/src/tools/web/browser-service.ts +63 -384
- package/packages/core/src/tools/web/browser-session.ts +125 -0
- package/packages/core/src/tools/web/browser-type.ts +2 -2
- package/packages/core/src/tools/web/browser-wait.ts +2 -2
- package/packages/core/src/tools/web/computer-use.ts +553 -0
- package/packages/core/src/tools/web/index.ts +5 -1
- package/packages/core/src/tools/web/webview-backend.ts +559 -21
- package/packages/core/src/utils/port.ts +33 -0
- package/packages/core/src/voice/index.ts +2 -1
- package/packages/mcp/src/config.ts +2 -1
- package/packages/mcp/src/manager.ts +9 -0
- package/packages/mcp/src/transports/index.ts +42 -1
- package/packages/mcp/src/transports/sse.ts +11 -5
- package/packages/skills/src/bundled/a2ui/a2ui_dashboard/SKILL.md +2 -2
- package/packages/skills/src/bundled/a2ui/a2ui_form/SKILL.md +2 -2
- package/packages/skills/src/bundled/a2ui/a2ui_interactive/SKILL.md +4 -4
- package/packages/skills/src/bundled/agents/agent_spawner/SKILL.md +7 -7
- package/packages/skills/src/bundled/agents/memory_manager/SKILL.md +9 -9
- package/packages/skills/src/bundled/agents/research_and_remember/SKILL.md +8 -8
- package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +8 -8
- package/packages/skills/src/bundled/artifacts/artifact_reader/SKILL.md +104 -0
- package/packages/skills/src/bundled/cli/cli_pipeline/SKILL.md +6 -6
- package/packages/skills/src/bundled/cli/cli_safe_exec/SKILL.md +5 -5
- package/packages/skills/src/bundled/cron_manager/SKILL.md +29 -19
- package/packages/skills/src/bundled/cron_reminder/SKILL.md +5 -5
- package/packages/skills/src/bundled/filesystem/file_manager/SKILL.md +4 -4
- package/packages/skills/src/bundled/filesystem/file_read_and_summarize/SKILL.md +7 -7
- package/packages/skills/src/bundled/filesystem/file_writer/SKILL.md +10 -10
- package/packages/skills/src/bundled/search_knowledge/capability_discovery/SKILL.md +8 -8
- package/packages/skills/src/bundled/web/browser_automate/SKILL.md +21 -12
- package/packages/skills/src/bundled/web/browser_scrape/SKILL.md +28 -13
- package/packages/skills/src/bundled/web/web_monitor/SKILL.md +6 -6
- package/packages/skills/src/bundled/web/web_research/SKILL.md +5 -5
- package/packages/skills/src/bundled-data.generated.ts +837 -783
- package/dist/ui/assets/A2UIPage-7Ry5rHh9.js +0 -8
- package/dist/ui/assets/AgentCreateForm-Dh5W0q_t.js +0 -1
- package/dist/ui/assets/AgentDetailPage-CIoPjtsS.js +0 -1
- package/dist/ui/assets/AgentNewPage-BNsZcJQf.js +0 -1
- package/dist/ui/assets/AgentsPage-YZrDmgNI.js +0 -10
- package/dist/ui/assets/ChannelsPage-Dice4dkJ.js +0 -8
- package/dist/ui/assets/DashboardPage-B9r0sc0F.js +0 -6
- package/dist/ui/assets/LoginPage-BkAAX_tu.js +0 -1
- package/dist/ui/assets/LogsPage-8-H1OJs3.js +0 -1
- package/dist/ui/assets/MeetingPage-14JoQo71.js +0 -1
- package/dist/ui/assets/ModelSelector-CrgJQ7DG.js +0 -1
- package/dist/ui/assets/NotFound-B06kVW7N.js +0 -1
- package/dist/ui/assets/Office3DPage-BMUZWkFS.js +0 -4614
- package/dist/ui/assets/ProvidersPage-BiL3QxCs.js +0 -1
- package/dist/ui/assets/RecoverPage-D1o8yxNz.js +0 -1
- package/dist/ui/assets/SettingsPage-GP8UwQIL.js +0 -9
- package/dist/ui/assets/SetupPage-B_gU1YQU.js +0 -1
- package/dist/ui/assets/WebChatPage-Yahufnth.js +0 -29
- package/dist/ui/assets/agentCapabilities-Dg72UAFj.js +0 -1
- package/dist/ui/assets/alert-DChoEVJw.js +0 -1
- package/dist/ui/assets/badge-uRjRSt86.js +0 -1
- package/dist/ui/assets/card-DwQizslL.js +0 -1
- package/dist/ui/assets/dialog--mljnfAi.js +0 -1
- package/dist/ui/assets/dist-js-B0s_TDau.js +0 -1
- package/dist/ui/assets/index-BHHUQZJd.js +0 -116
- package/dist/ui/assets/index-CEFhf4dF.css +0 -2
- package/dist/ui/assets/label-BceoUB2w.js +0 -1
- package/dist/ui/assets/pencil-CUbpCfeG.js +0 -1
- package/dist/ui/assets/scroll-area-DMEaZZUp.js +0 -1
- package/dist/ui/assets/select-BBEBtcLm.js +0 -1
- package/dist/ui/assets/slider-DcmBdvYD.js +0 -1
- package/dist/ui/assets/switch-CgiDezVR.js +0 -1
- package/dist/ui/assets/tabs-gUXIjjZv.js +0 -1
- package/dist/ui/assets/textarea-DedxQYBx.js +0 -1
- package/dist/ui/assets/useHiveAgentsModelLoad-C7bhWPDG.js +0 -1
- package/dist/ui/assets/useOfficeModel-BAFasrg8.js +0 -1
- package/dist/ui/assets/vendor-react-DYyYpuMy.js +0 -1
- package/dist/ui/assets/volume-x-BDlMCDYT.js +0 -1
- /package/dist/ui/assets/{core-Sjunb8Z1.js → core-B_5cyOSV.js} +0 -0
- /package/dist/ui/assets/{download-D0aDV8Y_.js → download-BQXrpH0m.js} +0 -0
- /package/dist/ui/assets/{ellipsis-vertical-BOW_iEOO.js → ellipsis-vertical-D7uFJLGh.js} +0 -0
- /package/dist/ui/assets/{external-link-5cujQzfV.js → external-link-6oTH9pUM.js} +0 -0
- /package/dist/ui/assets/{eye-sRPY5qOa.js → eye-CxvxtQT5.js} +0 -0
- /package/dist/ui/assets/{file-text-DNSyNLUh.js → file-text-D5ZJEx3E.js} +0 -0
- /package/dist/ui/assets/{gateway-url-BZj_2-jf.js → gateway-url-BALS_wVh.js} +0 -0
- /package/dist/ui/assets/{gauge-C__zxC3_.js → gauge-CEu7PhTW.js} +0 -0
- /package/dist/ui/assets/{history-BHQWfE-7.js → history-DLK5rTlP.js} +0 -0
- /package/dist/ui/assets/{info-CG1VohyH.js → info-8ReWzubE.js} +0 -0
- /package/dist/ui/assets/{key-BC28VCjO.js → key-DPkOY-J0.js} +0 -0
- /package/dist/ui/assets/{lock-open-Bhp0UJlL.js → lock-open-v0EphssG.js} +0 -0
- /package/dist/ui/assets/{mail-Biwn8WrV.js → mail-vwCEHyhQ.js} +0 -0
- /package/dist/ui/assets/{pause-C2l5G2Py.js → pause-Cm9LzIZK.js} +0 -0
- /package/dist/ui/assets/{play-CMAscR3a.js → play-zqogwA2l.js} +0 -0
- /package/dist/ui/assets/{plus-DzvRxH4U.js → plus-Bm08ABhc.js} +0 -0
- /package/dist/ui/assets/{radio-DfGzov4y.js → radio-Cii1BjMt.js} +0 -0
- /package/dist/ui/assets/{refresh-cw-DZXu5FrG.js → refresh-cw-DXv3XgEt.js} +0 -0
- /package/dist/ui/assets/{search-ykSx-zZU.js → search-BMwCI-pX.js} +0 -0
- /package/dist/ui/assets/{send-DAhlz2i9.js → send-D6fgWV7m.js} +0 -0
- /package/dist/ui/assets/{settings-DL0REysC.js → settings-qV3kVkeG.js} +0 -0
- /package/dist/ui/assets/{shield-BPZZhjCT.js → shield-CIarwBvx.js} +0 -0
- /package/dist/ui/assets/{sparkles-BViXTAh7.js → sparkles-DVvY6jDT.js} +0 -0
- /package/dist/ui/assets/{terminal-CzxPKG-h.js → terminal-BEcTK780.js} +0 -0
- /package/dist/ui/assets/{trash-2-SgYCWiVk.js → trash-2-D6oziYAK.js} +0 -0
- /package/dist/ui/assets/{utils-SGUggNJc.js → utils-DEmd_M8c.js} +0 -0
- /package/dist/ui/assets/{vendor-router-Dsg8fxNQ.js → vendor-router-DP84b3LQ.js} +0 -0
- /package/dist/ui/assets/{wifi-CyPHteEm.js → wifi-BUJuOcgP.js} +0 -0
- /package/dist/ui/assets/{zap-OVVrfEHr.js → zap-DSoX9NDk.js} +0 -0
|
@@ -20,7 +20,13 @@ export class WebChatChannel extends BaseChannel {
|
|
|
20
20
|
config: WebChatConfig;
|
|
21
21
|
|
|
22
22
|
private explicitAccountId?: string;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Every open socket of a session. One user can hold several at once — the
|
|
25
|
+
* desktop app and a browser tab, or overlapping reconnects after a gateway
|
|
26
|
+
* restart. Keeping only the last one meant that closing it orphaned the
|
|
27
|
+
* sockets still open: the UI stayed "connected" while every reply was lost.
|
|
28
|
+
*/
|
|
29
|
+
private connections: Map<string, Set<ServerWebSocket<WebSocketData>>> = new Map();
|
|
24
30
|
private log = logger.child("webchat");
|
|
25
31
|
|
|
26
32
|
constructor(config: WebChatConfig) {
|
|
@@ -47,14 +53,39 @@ export class WebChatChannel extends BaseChannel {
|
|
|
47
53
|
|
|
48
54
|
registerConnection(ws: ServerWebSocket<WebSocketData>): void {
|
|
49
55
|
const data = ws.data as WebSocketData;
|
|
50
|
-
this.connections.
|
|
51
|
-
|
|
56
|
+
const sockets = this.connections.get(data.sessionId) ?? new Set();
|
|
57
|
+
sockets.add(ws);
|
|
58
|
+
this.connections.set(data.sessionId, sockets);
|
|
59
|
+
this.log.debug(`WebChat connection registered: ${data.sessionId} (${sockets.size} open)`);
|
|
52
60
|
}
|
|
53
61
|
|
|
62
|
+
/** Without `ws`, forgets every socket of the session. */
|
|
54
63
|
unregisterConnection(sessionId: string, ws?: ServerWebSocket<WebSocketData>): void {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
const sockets = this.connections.get(sessionId);
|
|
65
|
+
if (!sockets) return;
|
|
66
|
+
if (ws) sockets.delete(ws);
|
|
67
|
+
if (!ws || sockets.size === 0) this.connections.delete(sessionId);
|
|
68
|
+
this.log.debug(`WebChat connection unregistered: ${sessionId} (${ws ? sockets.size : 0} open)`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Sends `payload` to every open socket of the session; a socket that throws
|
|
73
|
+
* is dropped. Returns how many received it.
|
|
74
|
+
*/
|
|
75
|
+
private broadcast(sessionId: string, payload: string): number {
|
|
76
|
+
const sockets = this.connections.get(sessionId);
|
|
77
|
+
if (!sockets) return 0;
|
|
78
|
+
let delivered = 0;
|
|
79
|
+
for (const ws of [...sockets]) {
|
|
80
|
+
try {
|
|
81
|
+
ws.send(payload);
|
|
82
|
+
delivered++;
|
|
83
|
+
} catch {
|
|
84
|
+
sockets.delete(ws);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (sockets.size === 0) this.connections.delete(sessionId);
|
|
88
|
+
return delivered;
|
|
58
89
|
}
|
|
59
90
|
|
|
60
91
|
/** Returns the first active WebChat session ID, or undefined if no one is connected */
|
|
@@ -67,56 +98,27 @@ export class WebChatChannel extends BaseChannel {
|
|
|
67
98
|
}
|
|
68
99
|
|
|
69
100
|
async startTyping(sessionId: string): Promise<void> {
|
|
70
|
-
|
|
71
|
-
if (!ws) return;
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
ws.send(JSON.stringify({ type: "typing", isTyping: true }));
|
|
75
|
-
} catch {
|
|
76
|
-
// Connection closed
|
|
77
|
-
}
|
|
101
|
+
this.broadcast(sessionId, JSON.stringify({ type: "typing", isTyping: true }));
|
|
78
102
|
}
|
|
79
103
|
|
|
80
104
|
async stopTyping(sessionId: string): Promise<void> {
|
|
81
|
-
|
|
82
|
-
if (!ws) return;
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
ws.send(JSON.stringify({ type: "typing", isTyping: false }));
|
|
86
|
-
} catch {
|
|
87
|
-
// Connection closed
|
|
88
|
-
}
|
|
105
|
+
this.broadcast(sessionId, JSON.stringify({ type: "typing", isTyping: false }));
|
|
89
106
|
}
|
|
90
107
|
|
|
91
108
|
async send(sessionId: string, message: OutboundMessage): Promise<void> {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (!ws) {
|
|
109
|
+
if (this.broadcast(sessionId, JSON.stringify(message)) === 0) {
|
|
95
110
|
throw new Error(`No WebChat connection for session: ${sessionId}`);
|
|
96
111
|
}
|
|
97
|
-
|
|
98
|
-
ws.send(JSON.stringify(message));
|
|
99
112
|
}
|
|
100
113
|
|
|
101
114
|
async sendAudio(sessionId: string, audio: Buffer, mimeType: string): Promise<void> {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
const base64Audio = audio.toString("base64");
|
|
111
|
-
ws.send(JSON.stringify({
|
|
112
|
-
type: "audio",
|
|
113
|
-
sessionId,
|
|
114
|
-
audio: base64Audio,
|
|
115
|
-
mimeType,
|
|
116
|
-
}));
|
|
117
|
-
} catch (error) {
|
|
118
|
-
this.log.error(`Failed to send WebChat audio: ${(error as Error).message}`);
|
|
119
|
-
}
|
|
115
|
+
const delivered = this.broadcast(sessionId, JSON.stringify({
|
|
116
|
+
type: "audio",
|
|
117
|
+
sessionId,
|
|
118
|
+
audio: audio.toString("base64"),
|
|
119
|
+
mimeType,
|
|
120
|
+
}));
|
|
121
|
+
if (delivered === 0) this.log.warn(`No WebChat connection for session: ${sessionId}`);
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
createIncomingMessage(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolvePort } from "../utils/port";
|
|
1
2
|
import * as z from "zod";
|
|
2
3
|
import { mkdirSync, existsSync, readFileSync } from "node:fs";
|
|
3
4
|
import * as path from "node:path";
|
|
@@ -5,7 +6,7 @@ import { availableParallelism, homedir } from "node:os";
|
|
|
5
6
|
|
|
6
7
|
const LogLevelSchema = z.enum(["debug", "info", "warn", "error"]);
|
|
7
8
|
const DMPolicySchema = z.enum(["open", "pairing", "allowlist"]);
|
|
8
|
-
const TransportSchema = z.enum(["stdio", "sse", "websocket"]);
|
|
9
|
+
const TransportSchema = z.enum(["stdio", "sse", "websocket", "http"]);
|
|
9
10
|
|
|
10
11
|
export function loadEnv(hiveDir: string): void {
|
|
11
12
|
const envPath = path.join(hiveDir, ".env");
|
|
@@ -127,11 +128,13 @@ const BrowserConfigSchema = z.object({
|
|
|
127
128
|
headless: z.boolean().optional(),
|
|
128
129
|
timeoutMs: z.number().optional(),
|
|
129
130
|
sessionName: z.string().optional(),
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
// Lo pisa HIVE_BROWSER_BACKEND.
|
|
131
|
+
// Queda un solo backend: Bun.WebView in-process. La clave sobrevive para no
|
|
132
|
+
// romper configs viejas —"agent-browser" se acepta, avisa y usa el WebView—
|
|
133
|
+
// y se puede quitar sin más. Lo pisa HIVE_BROWSER_BACKEND.
|
|
134
134
|
backend: z.enum(["agent-browser", "webview", "auto"]).optional(),
|
|
135
|
+
// Guarda las cookies para que los logins sobrevivan a un reinicio. Default
|
|
136
|
+
// activo; apagarlo hace que cada arranque empiece sin historia.
|
|
137
|
+
persistSession: z.boolean().optional(),
|
|
135
138
|
});
|
|
136
139
|
|
|
137
140
|
const CanvasConfigSchema = z.object({
|
|
@@ -405,7 +408,7 @@ function buildDefaultConfig(): Config {
|
|
|
405
408
|
return {
|
|
406
409
|
gateway: {
|
|
407
410
|
host: process.env.HIVE_HOST || "127.0.0.1",
|
|
408
|
-
port:
|
|
411
|
+
port: resolvePort(process.env.HIVE_PORT, 18790),
|
|
409
412
|
pidFile: path.join(hiveDir, "gateway.pid"),
|
|
410
413
|
authToken: process.env.HIVE_AUTH_TOKEN || undefined,
|
|
411
414
|
tools: {
|
|
@@ -43,6 +43,7 @@ const TOOL_NARRATIONS: Record<string, string> = {
|
|
|
43
43
|
browser_click: "Haciendo clic...",
|
|
44
44
|
browser_type: "Escribiendo en la página...",
|
|
45
45
|
browser_screenshot: "Tomando captura de pantalla...",
|
|
46
|
+
computer_use_task: "Operando el navegador...",
|
|
46
47
|
browser_extract: "Extrayendo información de la página...",
|
|
47
48
|
// Artefactos
|
|
48
49
|
artifact_inspect: "Verificando el archivo generado...",
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
createNotification,
|
|
13
13
|
markNotificationDelivered,
|
|
14
14
|
} from "./notification-inbox"
|
|
15
|
+
import { parseThreadId } from "../agent/thread-id"
|
|
15
16
|
|
|
16
17
|
const log = logger.child("channel-notify")
|
|
17
18
|
|
|
@@ -36,17 +37,33 @@ export function setChannelSendFn(fn: SendFn): void {
|
|
|
36
37
|
* tipo conectadas, la respuesta debe salir por la misma.
|
|
37
38
|
* Necesario porque config.thread_id es el userId interno, no el chat ID externo.
|
|
38
39
|
*/
|
|
39
|
-
async function resolveSession(
|
|
40
|
+
async function resolveSession(
|
|
41
|
+
userId: string,
|
|
42
|
+
channel: string,
|
|
43
|
+
threadId?: string
|
|
44
|
+
): Promise<{ sessionId: string; accountId?: string }> {
|
|
45
|
+
let accountId: string | undefined
|
|
40
46
|
try {
|
|
41
47
|
const identitiesCol = await col<UserIdentityDoc>("userIdentities")
|
|
42
48
|
const identity = await identitiesCol.get(`${userId}:${channel}`)
|
|
49
|
+
accountId = identity?.doc.account_id
|
|
50
|
+
|
|
51
|
+
// El hilo manda sobre la identidad: `userIdentities` guarda UNA fila por
|
|
52
|
+
// (usuario, canal), así que con varios chats o grupos del mismo canal apunta
|
|
53
|
+
// siempre al último que escribió. El threadId sí sabe de qué conversación
|
|
54
|
+
// salió el aviso, y su peerId es justo el destino del canal.
|
|
55
|
+
const parts = threadId ? parseThreadId(threadId) : null
|
|
56
|
+
if (parts && parts.channel === channel && channel !== "webchat") {
|
|
57
|
+
return { sessionId: parts.peerId, accountId }
|
|
58
|
+
}
|
|
59
|
+
|
|
43
60
|
if (identity?.doc.channel_user_id) {
|
|
44
|
-
return { sessionId: identity.doc.channel_user_id, accountId
|
|
61
|
+
return { sessionId: identity.doc.channel_user_id, accountId }
|
|
45
62
|
}
|
|
46
63
|
} catch {
|
|
47
64
|
// DB no lista — fallback al userId
|
|
48
65
|
}
|
|
49
|
-
return { sessionId: userId }
|
|
66
|
+
return { sessionId: userId, accountId }
|
|
50
67
|
}
|
|
51
68
|
|
|
52
69
|
/**
|
|
@@ -56,7 +73,9 @@ async function resolveSession(userId: string, channel: string): Promise<{ sessio
|
|
|
56
73
|
export async function sendToUserChannel(
|
|
57
74
|
channel: string,
|
|
58
75
|
userId: string,
|
|
59
|
-
message: string
|
|
76
|
+
message: string,
|
|
77
|
+
/** Conversación de origen — decide a qué chat o grupo del canal vuelve el aviso. */
|
|
78
|
+
opts?: { threadId?: string }
|
|
60
79
|
): Promise<{ ok: boolean; queued?: boolean; notificationId?: string; error?: string }> {
|
|
61
80
|
let notificationId: string | undefined
|
|
62
81
|
if (channel === "webchat") {
|
|
@@ -79,7 +98,7 @@ export async function sendToUserChannel(
|
|
|
79
98
|
return { ok: false, error: "Channel send not initialized" }
|
|
80
99
|
}
|
|
81
100
|
|
|
82
|
-
const { sessionId, accountId } = await resolveSession(userId, channel)
|
|
101
|
+
const { sessionId, accountId } = await resolveSession(userId, channel, opts?.threadId)
|
|
83
102
|
log.info(`[channel-notify] Sending to ${channel}/${sessionId}: ${message.substring(0, 80)}`)
|
|
84
103
|
|
|
85
104
|
try {
|
|
@@ -129,12 +129,12 @@ function summaryPrompt(group: DelegationGroupDoc): string {
|
|
|
129
129
|
// framed at serialization time by formatInternalEvent (conversation-store.ts).
|
|
130
130
|
return [
|
|
131
131
|
"Todas las tareas delegadas de este turno alcanzaron estado terminal.",
|
|
132
|
-
"Para cada una,
|
|
133
|
-
'- checks.status="passed" → verificado determinísticamente,
|
|
132
|
+
"Para cada una, comprueba la entrega contra sus criterios de aceptación (`acceptance`):",
|
|
133
|
+
'- checks.status="passed" → verificado determinísticamente, acepta.',
|
|
134
134
|
'- checks.status="failed" → NO cumplió (ok=false). No lo reportes como éxito.',
|
|
135
|
-
'- checks.status="unchecked" o ausente →
|
|
136
|
-
"Si una entrega no cumple sus criterios:
|
|
137
|
-
"Si todas cumplen,
|
|
135
|
+
'- checks.status="unchecked" o ausente → júzgalo tú con el contenido y la evidencia adjunta.',
|
|
136
|
+
"Si una entrega no cumple sus criterios: usa `task_revise` con el task_id y un feedback concreto, o arréglala tú si es trivial y tienes las tools. No inventes trabajo ni evidencia, y no declares éxito para ok=false.",
|
|
137
|
+
"Si todas cumplen, escribe UNA sola respuesta final para el usuario, en lenguaje natural: nunca expongas task_id, worker_id, nombres de tools ni JSON crudo.",
|
|
138
138
|
JSON.stringify(factual),
|
|
139
139
|
].join("\n\n");
|
|
140
140
|
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
recordDelegationOutcome,
|
|
19
19
|
setDelegationSummaryEnqueuer,
|
|
20
20
|
} from "./delegation-groups";
|
|
21
|
+
import { parseThreadId } from "../agent/thread-id";
|
|
21
22
|
|
|
22
23
|
const log = logger.child("delegation-notify");
|
|
23
24
|
|
|
@@ -29,12 +30,34 @@ interface WorkerTaskPayload {
|
|
|
29
30
|
turnId?: string | null;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Hilo de origen en su forma canónica.
|
|
35
|
+
*
|
|
36
|
+
* Hasta la separación por canal, `createRun` guardaba `thread_id` como
|
|
37
|
+
* `webchat:${sessionId}` mientras `conversations` usaba el id pelado. Ese prefijo
|
|
38
|
+
* ya no se escribe, pero sigue vivo en los runs y jobs anteriores: sin quitarlo,
|
|
39
|
+
* el aviso iría a un hilo que no existe.
|
|
40
|
+
*/
|
|
41
|
+
function normalizeOriginThread(originThreadId: string): string {
|
|
34
42
|
const prefix = "webchat:";
|
|
35
43
|
return originThreadId.startsWith(prefix) ? originThreadId.slice(prefix.length) : originThreadId;
|
|
36
44
|
}
|
|
37
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Destino de TRANSPORTE de un aviso, derivado del hilo de origen.
|
|
48
|
+
*
|
|
49
|
+
* El hilo dice en qué conversación escribir; el sessionId, por dónde sale la
|
|
50
|
+
* respuesta: en la web el socket se identifica con el userId, en los demás canales
|
|
51
|
+
* con el contacto o grupo. Los hilos sin formato (el legacy previo a la separación
|
|
52
|
+
* por canal, y los jobs encolados con el viejo prefijo `webchat:`) se devuelven
|
|
53
|
+
* como estaban.
|
|
54
|
+
*/
|
|
55
|
+
function deriveSessionId(originThreadId: string): string {
|
|
56
|
+
const parts = parseThreadId(originThreadId);
|
|
57
|
+
if (parts) return parts.channel === "webchat" ? parts.userId : parts.peerId;
|
|
58
|
+
return normalizeOriginThread(originThreadId);
|
|
59
|
+
}
|
|
60
|
+
|
|
38
61
|
function summarize(value: unknown, maxLen = 500): string {
|
|
39
62
|
const text = typeof value === "string" ? value : JSON.stringify(value);
|
|
40
63
|
return text.length > maxLen ? `${text.slice(0, maxLen)}…` : text;
|
|
@@ -67,9 +90,13 @@ async function notifyWorkerTaskOutcome(job: JobDoc, outcome: JobTerminalOutcome)
|
|
|
67
90
|
: `El agente NO pudo completar la tarea "${taskName}". Motivo: ${summarize(outcome.error ?? "error desconocido")}`;
|
|
68
91
|
|
|
69
92
|
try {
|
|
93
|
+
// El aviso vuelve a la conversación que delegó, no a la más reciente del
|
|
94
|
+
// usuario: con un hilo por canal y contacto, adivinarlo desde el sessionId ya
|
|
95
|
+
// no es posible. La lane es la misma que usa el chat de esa conversación.
|
|
96
|
+
const originThread = normalizeOriginThread(payload.originThreadId);
|
|
70
97
|
await enqueueChatTurn({
|
|
71
|
-
lane:
|
|
72
|
-
payload: { source: "task_complete", sessionId, content },
|
|
98
|
+
lane: originThread,
|
|
99
|
+
payload: { source: "task_complete", sessionId, threadId: originThread, content },
|
|
73
100
|
});
|
|
74
101
|
log.info(`[notifyWorkerTaskOutcome] Enqueued task_complete notice for session ${sessionId} (job ${job.id}, ok=${outcome.ok})`);
|
|
75
102
|
} catch (err) {
|
|
@@ -84,11 +111,13 @@ export function initDelegationNotify(): void {
|
|
|
84
111
|
registerTerminalHook("worker_task", notifyWorkerTaskOutcome);
|
|
85
112
|
setDelegationSummaryEnqueuer(async (group, content, idempotencyKey) => {
|
|
86
113
|
const sessionId = group.session_id || deriveSessionId(group.thread_id);
|
|
114
|
+
const groupThread = normalizeOriginThread(group.thread_id);
|
|
87
115
|
return enqueueChatTurn({
|
|
88
|
-
lane:
|
|
116
|
+
lane: groupThread,
|
|
89
117
|
payload: {
|
|
90
118
|
source: "delegation_summary",
|
|
91
119
|
sessionId,
|
|
120
|
+
threadId: groupThread,
|
|
92
121
|
content,
|
|
93
122
|
rawContent: content,
|
|
94
123
|
userId: group.user_id,
|
|
@@ -109,6 +109,8 @@ export class DurableLaneQueue {
|
|
|
109
109
|
private jobRetryPolicy: JobRetryPolicy;
|
|
110
110
|
private runningCount = 0;
|
|
111
111
|
private runningAborts = new Map<string, { lane: string; controller: AbortController }>();
|
|
112
|
+
/** Lanes with a claim in flight: the gap between findPending and executeJob. */
|
|
113
|
+
private claimingLanes = new Set<string>();
|
|
112
114
|
private dispatchTimers = new Map<string, ReturnType<typeof setInterval>>();
|
|
113
115
|
private leaseCheckTimer: ReturnType<typeof setInterval> | null = null;
|
|
114
116
|
private bootId: string;
|
|
@@ -180,6 +182,12 @@ export class DurableLaneQueue {
|
|
|
180
182
|
if (entry.lane === lane) {
|
|
181
183
|
entry.controller.abort();
|
|
182
184
|
if (await cancelJob(jobId)) count++;
|
|
185
|
+
// Free the lane now: an executor can take a while to notice the abort
|
|
186
|
+
// (a local model mid-generation), and until executeJob's finally ran
|
|
187
|
+
// the one-job-per-lane rule kept the user's next message waiting behind
|
|
188
|
+
// a turn they had already cancelled. completeJob ignores cancelled jobs,
|
|
189
|
+
// so its late result is discarded.
|
|
190
|
+
this.runningAborts.delete(jobId);
|
|
183
191
|
}
|
|
184
192
|
}
|
|
185
193
|
const pending = await findPendingJobsByLane(lane, 100);
|
|
@@ -254,6 +262,20 @@ export class DurableLaneQueue {
|
|
|
254
262
|
* Dispatch pending jobs for a single lane, respecting global concurrency.
|
|
255
263
|
*/
|
|
256
264
|
private async dispatchLane(lane: string): Promise<void> {
|
|
265
|
+
// One running job per lane. Without this check a job enqueued while another
|
|
266
|
+
// ran in the same lane started right away: an A2UI action and a delegation
|
|
267
|
+
// summary ran as two concurrent Bee turns in one conversation, and both
|
|
268
|
+
// re-delegated the whole swarm. executeJob re-dispatches the lane on finish.
|
|
269
|
+
if (this.claimingLanes.has(lane) || [...this.runningAborts.values()].some((r) => r.lane === lane)) return;
|
|
270
|
+
this.claimingLanes.add(lane);
|
|
271
|
+
try {
|
|
272
|
+
await this.dispatchNextInLane(lane);
|
|
273
|
+
} finally {
|
|
274
|
+
this.claimingLanes.delete(lane);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
private async dispatchNextInLane(lane: string): Promise<void> {
|
|
257
279
|
for (;;) {
|
|
258
280
|
const pending = await findPendingJobsByLane(lane, 1);
|
|
259
281
|
if (pending.length === 0) break;
|
|
@@ -34,6 +34,7 @@ async function notifyChatTurnFailure(job: JobDoc, outcome: JobTerminalOutcome):
|
|
|
34
34
|
const payload = JSON.parse(job.payload_json) as WebchatTurnPayload;
|
|
35
35
|
const channel = payload.channel ?? "webchat";
|
|
36
36
|
let userId = payload.userId;
|
|
37
|
+
let threadId = payload.threadId;
|
|
37
38
|
|
|
38
39
|
if (!userId) {
|
|
39
40
|
// Live webchat turns ("message"/"audio"/"a2ui") never carry userId in the
|
|
@@ -41,6 +42,9 @@ async function notifyChatTurnFailure(job: JobDoc, outcome: JobTerminalOutcome):
|
|
|
41
42
|
try {
|
|
42
43
|
const ctx = await resolveContext({ channel: "webchat", channelUserId: payload.sessionId });
|
|
43
44
|
userId = ctx.userId;
|
|
45
|
+
// El hilo sólo afina a qué chat del canal vuelve el aviso: si no se puede
|
|
46
|
+
// averiguar, se manda igual por la identidad del canal.
|
|
47
|
+
threadId = threadId ?? ctx.threadId;
|
|
44
48
|
} catch (err) {
|
|
45
49
|
log.warn(`[notifyChatTurnFailure] Could not resolve a recipient for job ${job.id}: ${(err as Error).message}`);
|
|
46
50
|
return;
|
|
@@ -50,7 +54,8 @@ async function notifyChatTurnFailure(job: JobDoc, outcome: JobTerminalOutcome):
|
|
|
50
54
|
await sendToUserChannel(
|
|
51
55
|
channel,
|
|
52
56
|
userId,
|
|
53
|
-
"No pude completar tu solicitud por un error interno. Por favor
|
|
57
|
+
"No pude completar tu solicitud por un error interno. Por favor intenta de nuevo.",
|
|
58
|
+
{ threadId }
|
|
54
59
|
).catch((err) => log.warn(`[notifyChatTurnFailure] Delivery failed for job ${job.id}: ${(err as Error).message}`));
|
|
55
60
|
}
|
|
56
61
|
|
|
@@ -63,7 +68,8 @@ async function notifyGoalRunFailure(job: JobDoc, outcome: JobTerminalOutcome): P
|
|
|
63
68
|
await sendToUserChannel(
|
|
64
69
|
run.channel,
|
|
65
70
|
run.user_id,
|
|
66
|
-
`No pude completar la tarea. Motivo: ${outcome.error ?? "error desconocido"}
|
|
71
|
+
`No pude completar la tarea. Motivo: ${outcome.error ?? "error desconocido"}`,
|
|
72
|
+
{ threadId: run.thread_id }
|
|
67
73
|
).catch((err) => log.warn(`[notifyGoalRunFailure] Delivery failed for job ${job.id}: ${(err as Error).message}`));
|
|
68
74
|
}
|
|
69
75
|
|
|
@@ -262,20 +262,27 @@ export async function initializeGateway(
|
|
|
262
262
|
const agent = createAgentService();
|
|
263
263
|
await agent.initialize();
|
|
264
264
|
|
|
265
|
-
// 5b. Initialize Browser Service (
|
|
265
|
+
// 5b. Initialize Browser Service (Bun.WebView, in-process)
|
|
266
266
|
let browserAvailable = false;
|
|
267
267
|
|
|
268
268
|
try {
|
|
269
|
-
log.info("Initializing browser automation (
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
269
|
+
log.info("Initializing browser automation (Bun.WebView)...");
|
|
270
|
+
|
|
271
|
+
const { isWebViewSupported, browserInstallHint } = await import("../tools/web/browser-backend");
|
|
272
|
+
if (!isWebViewSupported()) {
|
|
273
|
+
// Sin navegador no hay nada que activar. Se dice acá, en el arranque,
|
|
274
|
+
// en vez de dejar que cada tool falle una por una en su primer uso.
|
|
275
|
+
log.warn("⚠️ No se encontró navegador — browser tools desactivadas");
|
|
276
|
+
log.warn(` ${browserInstallHint()}`);
|
|
276
277
|
} else {
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
const browserService = initializeBrowserService(config);
|
|
279
|
+
browserAvailable = await browserService.start();
|
|
280
|
+
|
|
281
|
+
if (browserAvailable) {
|
|
282
|
+
activateBrowserTools();
|
|
283
|
+
} else {
|
|
284
|
+
log.warn("⚠️ Browser tools desactivadas por configuración (tools.browser.enabled)");
|
|
285
|
+
}
|
|
279
286
|
}
|
|
280
287
|
} catch (error) {
|
|
281
288
|
log.warn(`Browser Service initialization skipped: ${(error as Error).message}`);
|
|
@@ -361,7 +361,7 @@ const goalRunExecutor: JobExecutor = async (job, signal) => {
|
|
|
361
361
|
|
|
362
362
|
const notify = async (text: string) => {
|
|
363
363
|
if (channel && notifyUserId) {
|
|
364
|
-
await sendToUserChannel(channel, notifyUserId, text).catch(() => {});
|
|
364
|
+
await sendToUserChannel(channel, notifyUserId, text, { threadId }).catch(() => {});
|
|
365
365
|
}
|
|
366
366
|
};
|
|
367
367
|
|
|
@@ -404,8 +404,8 @@ const goalRunExecutor: JobExecutor = async (job, signal) => {
|
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
const turnMessage = attempts === 0
|
|
407
|
-
? `Meta: ${goal}\n\
|
|
408
|
-
: `La meta aún no se verificó como cumplida.\nMeta: "${goal}"\nRazón del verificador: ${lastReason}\nPresupuesto restante: ${maxAttempts - attempts} intento(s), ${maxTurns - turnsUsed} turno(s).\
|
|
407
|
+
? `Meta: ${goal}\n\nTrabaja hasta cumplir esta meta. Explica el resultado al terminar.`
|
|
408
|
+
: `La meta aún no se verificó como cumplida.\nMeta: "${goal}"\nRazón del verificador: ${lastReason}\nPresupuesto restante: ${maxAttempts - attempts} intento(s), ${maxTurns - turnsUsed} turno(s).\nContinúa trabajando para cumplirla.`;
|
|
409
409
|
|
|
410
410
|
// One turn (non-durable: the goal row carries the durable state)
|
|
411
411
|
let turnTokens = 0;
|