@johpaz/hive 1.1.4 → 1.1.5

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.
Files changed (69) hide show
  1. package/package.json +5 -5
  2. package/packages/cli/dist/commands/agent-run.d.ts +1 -0
  3. package/packages/cli/dist/commands/agent-run.js +178 -0
  4. package/packages/cli/dist/commands/agents.d.ts +1 -0
  5. package/packages/cli/dist/commands/agents.js +372 -0
  6. package/packages/cli/dist/commands/chat.d.ts +1 -0
  7. package/packages/cli/dist/commands/chat.js +152 -0
  8. package/packages/cli/dist/commands/config.d.ts +1 -0
  9. package/packages/cli/dist/commands/config.js +49 -0
  10. package/packages/cli/dist/commands/cron.d.ts +1 -0
  11. package/packages/cli/dist/commands/cron.js +166 -0
  12. package/packages/cli/dist/commands/dev.d.ts +1 -0
  13. package/packages/cli/dist/commands/dev.js +120 -0
  14. package/packages/cli/dist/commands/doctor.d.ts +1 -0
  15. package/packages/cli/dist/commands/doctor.js +161 -0
  16. package/packages/cli/dist/commands/gateway.d.ts +4 -0
  17. package/packages/cli/dist/commands/gateway.js +444 -0
  18. package/packages/cli/dist/commands/logs.d.ts +1 -0
  19. package/packages/cli/dist/commands/logs.js +87 -0
  20. package/packages/cli/dist/commands/mcp.d.ts +1 -0
  21. package/packages/cli/dist/commands/mcp.js +175 -0
  22. package/packages/cli/dist/commands/message.d.ts +1 -0
  23. package/packages/cli/dist/commands/message.js +65 -0
  24. package/packages/cli/dist/commands/onboard.d.ts +1 -0
  25. package/packages/cli/dist/commands/onboard.js +1715 -0
  26. package/packages/cli/dist/commands/security.d.ts +1 -0
  27. package/packages/cli/dist/commands/security.js +155 -0
  28. package/packages/cli/dist/commands/service.d.ts +1 -0
  29. package/packages/cli/dist/commands/service.js +77 -0
  30. package/packages/cli/dist/commands/sessions.d.ts +1 -0
  31. package/packages/cli/dist/commands/sessions.js +132 -0
  32. package/packages/cli/dist/commands/skills.d.ts +1 -0
  33. package/packages/cli/dist/commands/skills.js +190 -0
  34. package/packages/cli/dist/commands/update.d.ts +1 -0
  35. package/packages/cli/dist/commands/update.js +27 -0
  36. package/packages/cli/dist/hive-binary +0 -0
  37. package/packages/cli/dist/index.d.ts +2 -0
  38. package/packages/cli/dist/index.js +184 -0
  39. package/packages/cli/dist/utils/token.d.ts +1 -0
  40. package/packages/cli/dist/utils/token.js +8 -0
  41. package/packages/cli/package.json +3 -1
  42. package/packages/core/package.json +9 -1
  43. package/packages/core/src/config/loader.d.ts +298 -0
  44. package/packages/core/src/config/loader.js +513 -0
  45. package/packages/core/src/storage/schema.d.ts +3 -0
  46. package/packages/core/src/storage/schema.js +541 -0
  47. package/packages/core/src/storage/sqlite.d.ts +51 -0
  48. package/packages/core/src/storage/sqlite.js +350 -0
  49. package/packages/core/src/utils/logger.d.ts +84 -0
  50. package/packages/core/src/utils/logger.js +352 -0
  51. package/packages/cli/src/commands/agent-run.ts +0 -168
  52. package/packages/cli/src/commands/agents.ts +0 -398
  53. package/packages/cli/src/commands/chat.ts +0 -142
  54. package/packages/cli/src/commands/config.ts +0 -50
  55. package/packages/cli/src/commands/cron.ts +0 -161
  56. package/packages/cli/src/commands/dev.ts +0 -95
  57. package/packages/cli/src/commands/doctor.ts +0 -133
  58. package/packages/cli/src/commands/gateway.ts +0 -443
  59. package/packages/cli/src/commands/logs.ts +0 -57
  60. package/packages/cli/src/commands/mcp.ts +0 -175
  61. package/packages/cli/src/commands/message.ts +0 -77
  62. package/packages/cli/src/commands/onboard.ts +0 -1868
  63. package/packages/cli/src/commands/security.ts +0 -144
  64. package/packages/cli/src/commands/service.ts +0 -50
  65. package/packages/cli/src/commands/sessions.ts +0 -116
  66. package/packages/cli/src/commands/skills.ts +0 -187
  67. package/packages/cli/src/commands/update.ts +0 -25
  68. package/packages/cli/src/index.ts +0 -185
  69. package/packages/cli/src/utils/token.ts +0 -6
@@ -0,0 +1,352 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.logger = exports.ChildLogger = exports.Logger = void 0;
37
+ exports.onLogEntry = onLogEntry;
38
+ exports.removeLogListener = removeLogListener;
39
+ exports.getLogger = getLogger;
40
+ const node_fs_1 = require("node:fs");
41
+ const path = __importStar(require("node:path"));
42
+ const loader_ts_1 = require("../config/loader.ts");
43
+ const _logListeners = new Set();
44
+ /** Subscribe to real-time log entries */
45
+ function onLogEntry(cb) {
46
+ _logListeners.add(cb);
47
+ }
48
+ /** Unsubscribe from real-time log entries */
49
+ function removeLogListener(cb) {
50
+ _logListeners.delete(cb);
51
+ }
52
+ function emitLogEntry(entry) {
53
+ for (const cb of _logListeners) {
54
+ try {
55
+ cb(entry);
56
+ }
57
+ catch { /* listener error should not crash logger */ }
58
+ }
59
+ }
60
+ const LOG_LEVELS = {
61
+ debug: 0,
62
+ info: 1,
63
+ warn: 2,
64
+ error: 3,
65
+ };
66
+ const SENSITIVE_PATTERNS = [
67
+ /api[_-]?key/i,
68
+ /token/i,
69
+ /secret/i,
70
+ /password/i,
71
+ /credential/i,
72
+ /auth/i,
73
+ ];
74
+ const COLORS = {
75
+ debug: "\x1b[36m",
76
+ info: "\x1b[32m",
77
+ warn: "\x1b[33m",
78
+ error: "\x1b[31m",
79
+ reset: "\x1b[0m",
80
+ dim: "\x1b[2m",
81
+ bright: "\x1b[1m",
82
+ };
83
+ function expandPath(p) {
84
+ if (p.startsWith("~")) {
85
+ return path.join(process.env.HOME || "", p.slice(1));
86
+ }
87
+ return p;
88
+ }
89
+ function redact(obj, seen = new WeakSet()) {
90
+ if (obj === null || typeof obj !== "object") {
91
+ return obj;
92
+ }
93
+ if (seen.has(obj)) {
94
+ return "[Circular]";
95
+ }
96
+ seen.add(obj);
97
+ if (Array.isArray(obj)) {
98
+ return obj.map((item) => redact(item, seen));
99
+ }
100
+ const result = {};
101
+ for (const [key, value] of Object.entries(obj)) {
102
+ const isSensitive = SENSITIVE_PATTERNS.some((p) => p.test(key));
103
+ if (isSensitive) {
104
+ result[key] = "[REDACTED]";
105
+ }
106
+ else if (typeof value === "object" && value !== null) {
107
+ result[key] = redact(value, seen);
108
+ }
109
+ else {
110
+ result[key] = value;
111
+ }
112
+ }
113
+ return result;
114
+ }
115
+ function formatTimestamp() {
116
+ return new Date().toISOString();
117
+ }
118
+ function formatMessage(level, message, meta, correlationId) {
119
+ const timestamp = formatTimestamp();
120
+ const corrStr = correlationId ? ` [${correlationId.slice(0, 8)}]` : "";
121
+ const metaStr = meta ? ` ${JSON.stringify(meta)}` : "";
122
+ return `[${timestamp}]${corrStr} [${level.toUpperCase()}] ${message}${metaStr}`;
123
+ }
124
+ class Logger {
125
+ constructor(config = {}) {
126
+ this.logFile = null;
127
+ this.currentSize = 0;
128
+ this.correlationContext = {};
129
+ this.config = {
130
+ level: config.level ?? "info",
131
+ dir: config.dir ?? path.join((0, loader_ts_1.getHiveDir)(), "logs"),
132
+ maxSizeMB: config.maxSizeMB ?? 10,
133
+ maxFiles: config.maxFiles ?? 5,
134
+ redactSensitive: config.redactSensitive ?? true,
135
+ console: config.console ?? true,
136
+ };
137
+ }
138
+ setCorrelationContext(context) {
139
+ this.correlationContext = { ...this.correlationContext, ...context };
140
+ }
141
+ clearCorrelationContext() {
142
+ this.correlationContext = {};
143
+ }
144
+ getCorrelationId() {
145
+ return this.correlationContext.correlationId;
146
+ }
147
+ withCorrelationId(id) {
148
+ this.correlationContext.correlationId = id;
149
+ return this;
150
+ }
151
+ initLogFile() {
152
+ const logDir = expandPath(this.config.dir);
153
+ try {
154
+ if (!(0, node_fs_1.existsSync)(logDir)) {
155
+ (0, node_fs_1.mkdirSync)(logDir, { recursive: true });
156
+ }
157
+ this.logFile = path.join(logDir, `hive-${new Date().toISOString().split("T")[0]}.log`);
158
+ const file = Bun.file(this.logFile);
159
+ this.currentSize = file.size ?? 0;
160
+ }
161
+ catch {
162
+ this.logFile = null;
163
+ }
164
+ }
165
+ shouldLog(level) {
166
+ return LOG_LEVELS[level] >= LOG_LEVELS[this.config.level];
167
+ }
168
+ writeToConsole(level, message, meta) {
169
+ if (!this.config.console)
170
+ return;
171
+ const color = COLORS[level];
172
+ const mergedMeta = this.mergeMeta(meta);
173
+ const displayMeta = this.config.redactSensitive && mergedMeta ? redact(mergedMeta) : mergedMeta;
174
+ const metaStr = displayMeta && Object.keys(displayMeta).length > 0
175
+ ? ` ${JSON.stringify(displayMeta)}`
176
+ : "";
177
+ const prefix = `${COLORS.dim}${formatTimestamp()}${COLORS.reset}`;
178
+ const corrStr = this.correlationContext.correlationId
179
+ ? ` ${COLORS.dim}[${this.correlationContext.correlationId.slice(0, 8)}]${COLORS.reset}`
180
+ : "";
181
+ const levelStr = `${color}${COLORS.bright}[${level.toUpperCase().padEnd(5)}]${COLORS.reset}`;
182
+ console.log(`${prefix}${corrStr} ${levelStr} ${message}${metaStr}`);
183
+ }
184
+ mergeMeta(meta) {
185
+ if (!meta && Object.keys(this.correlationContext).length === 0)
186
+ return undefined;
187
+ const contextWithoutCorrId = { ...this.correlationContext };
188
+ delete contextWithoutCorrId.correlationId;
189
+ if (!meta)
190
+ return contextWithoutCorrId;
191
+ if (typeof meta !== "object")
192
+ return meta;
193
+ return { ...contextWithoutCorrId, ...meta };
194
+ }
195
+ writeToFile(message) {
196
+ if (!this.logFile) {
197
+ this.initLogFile();
198
+ }
199
+ if (!this.logFile)
200
+ return;
201
+ try {
202
+ const line = message + "\n";
203
+ const bytes = Buffer.byteLength(line);
204
+ if (this.currentSize + bytes > this.config.maxSizeMB * 1024 * 1024) {
205
+ this.rotateLogs();
206
+ }
207
+ // Use sync append for logging reliability
208
+ const encoder = new TextEncoder();
209
+ const data = encoder.encode(line);
210
+ Bun.write(this.logFile, data).catch(() => { });
211
+ this.currentSize += bytes;
212
+ }
213
+ catch {
214
+ // Silently fail if we can't write to log file
215
+ }
216
+ }
217
+ rotateLogs() {
218
+ if (!this.logFile)
219
+ return;
220
+ const logDir = path.dirname(this.logFile);
221
+ const baseName = path.basename(this.logFile, ".log");
222
+ for (let i = this.config.maxFiles - 1; i >= 1; i--) {
223
+ const oldFile = path.join(logDir, `${baseName}.${i}.log`);
224
+ const newFile = path.join(logDir, `${baseName}.${i + 1}.log`);
225
+ try {
226
+ if ((0, node_fs_1.existsSync)(oldFile)) {
227
+ if (i === this.config.maxFiles - 1) {
228
+ (0, node_fs_1.unlinkSync)(oldFile);
229
+ }
230
+ else {
231
+ (0, node_fs_1.renameSync)(oldFile, newFile);
232
+ }
233
+ }
234
+ }
235
+ catch {
236
+ // Continue rotation even if one file fails
237
+ }
238
+ }
239
+ try {
240
+ (0, node_fs_1.renameSync)(this.logFile, path.join(logDir, `${baseName}.1.log`));
241
+ this.currentSize = 0;
242
+ }
243
+ catch {
244
+ // Continue even if rotation fails
245
+ }
246
+ }
247
+ debug(message, meta) {
248
+ if (!this.shouldLog("debug"))
249
+ return;
250
+ const mergedMeta = this.mergeMeta(meta);
251
+ const formatted = formatMessage("debug", message, mergedMeta, this.correlationContext.correlationId);
252
+ this.writeToConsole("debug", message, meta);
253
+ this.writeToFile(formatted);
254
+ emitLogEntry({ timestamp: formatTimestamp(), level: "debug", source: "core", message, meta: mergedMeta });
255
+ }
256
+ info(message, meta) {
257
+ if (!this.shouldLog("info"))
258
+ return;
259
+ const mergedMeta = this.mergeMeta(meta);
260
+ const formatted = formatMessage("info", message, mergedMeta, this.correlationContext.correlationId);
261
+ this.writeToConsole("info", message, meta);
262
+ this.writeToFile(formatted);
263
+ emitLogEntry({ timestamp: formatTimestamp(), level: "info", source: "core", message, meta: mergedMeta });
264
+ }
265
+ warn(message, meta) {
266
+ if (!this.shouldLog("warn"))
267
+ return;
268
+ const mergedMeta = this.mergeMeta(meta);
269
+ const formatted = formatMessage("warn", message, mergedMeta, this.correlationContext.correlationId);
270
+ this.writeToConsole("warn", message, meta);
271
+ this.writeToFile(formatted);
272
+ emitLogEntry({ timestamp: formatTimestamp(), level: "warn", source: "core", message, meta: mergedMeta });
273
+ }
274
+ error(message, meta) {
275
+ if (!this.shouldLog("error"))
276
+ return;
277
+ const mergedMeta = this.mergeMeta(meta);
278
+ const formatted = formatMessage("error", message, mergedMeta, this.correlationContext.correlationId);
279
+ this.writeToConsole("error", message, meta);
280
+ this.writeToFile(formatted);
281
+ emitLogEntry({ timestamp: formatTimestamp(), level: "error", source: "core", message, meta: mergedMeta });
282
+ }
283
+ child(context) {
284
+ return new ChildLogger(this, context, this.correlationContext);
285
+ }
286
+ setLevel(level) {
287
+ this.config.level = level;
288
+ }
289
+ }
290
+ exports.Logger = Logger;
291
+ class ChildLogger {
292
+ constructor(parent, context, correlationContext = {}) {
293
+ this.parent = parent;
294
+ this.context = context;
295
+ this.correlationContext = correlationContext;
296
+ }
297
+ prefix(message) {
298
+ return `[${this.context}] ${message}`;
299
+ }
300
+ withCorrelationId(id) {
301
+ this.correlationContext.correlationId = id;
302
+ return this;
303
+ }
304
+ setContext(context) {
305
+ this.correlationContext = { ...this.correlationContext, ...context };
306
+ }
307
+ debug(message, meta) {
308
+ this.parent.debug(this.prefix(message), this.mergeMeta(meta));
309
+ }
310
+ info(message, meta) {
311
+ this.parent.info(this.prefix(message), this.mergeMeta(meta));
312
+ }
313
+ warn(message, meta) {
314
+ this.parent.warn(this.prefix(message), this.mergeMeta(meta));
315
+ }
316
+ error(message, meta) {
317
+ this.parent.error(this.prefix(message), this.mergeMeta(meta));
318
+ }
319
+ child(subContext) {
320
+ return new ChildLogger(this.parent, `${this.context}:${subContext}`, this.correlationContext);
321
+ }
322
+ mergeMeta(meta) {
323
+ if (!meta && Object.keys(this.correlationContext).length === 0)
324
+ return undefined;
325
+ if (!meta)
326
+ return { ...this.correlationContext };
327
+ if (typeof meta !== "object")
328
+ return meta;
329
+ return { ...this.correlationContext, ...meta };
330
+ }
331
+ }
332
+ exports.ChildLogger = ChildLogger;
333
+ let _logger = null;
334
+ function getLogger() {
335
+ if (!_logger) {
336
+ _logger = new Logger();
337
+ }
338
+ return _logger;
339
+ }
340
+ exports.logger = {
341
+ child: (opts) => getLogger().child(opts),
342
+ debug: (msg, meta) => getLogger().debug(msg, meta),
343
+ info: (msg, meta) => getLogger().info(msg, meta),
344
+ warn: (msg, meta) => getLogger().warn(msg, meta),
345
+ error: (msg, meta) => getLogger().error(msg, meta),
346
+ setCorrelationContext: (ctx) => getLogger().setCorrelationContext(ctx),
347
+ clearCorrelationContext: () => getLogger().clearCorrelationContext(),
348
+ getCorrelationId: () => getLogger().getCorrelationId(),
349
+ withCorrelationId: (id) => getLogger().withCorrelationId(id),
350
+ setLevel: (level) => getLogger().setLevel(level),
351
+ setHandler: (handler) => { },
352
+ };
@@ -1,168 +0,0 @@
1
- import * as p from "@clack/prompts";
2
- import { loadConfig } from "@johpaz/hive-core/config/loader";
3
-
4
- function getGatewayUrl(config: any): string {
5
- const gateway = config?.gateway;
6
- const host = gateway?.host ?? "localhost";
7
- const port = gateway?.port ?? 3000;
8
- return `http://${host}:${port}`;
9
- }
10
-
11
- export async function agent(subcommand: string | undefined, args: string[]): Promise<void> {
12
- switch (subcommand) {
13
- case "run":
14
- await agentRun(args);
15
- break;
16
- default:
17
- console.log(`
18
- Usage: hive agent <command>
19
-
20
- Commands:
21
- run --message <text> Ejecutar agente con mensaje
22
- run --thinking <level> Nivel de razonamiento (low/medium/high)
23
- run --wait Esperar respuesta completa
24
- `);
25
- }
26
- }
27
-
28
- async function agentRun(args: string[]): Promise<void> {
29
- const messageIndex = args.indexOf("--message");
30
- const thinkingIndex = args.indexOf("--thinking");
31
- const toolsIndex = args.indexOf("--tools");
32
- const agentIndex = args.indexOf("--agent");
33
- const waitIndex = args.indexOf("--wait");
34
-
35
- if (messageIndex === -1) {
36
- const msg = await p.text({
37
- message: "Mensaje para el agente:",
38
- placeholder: "Analiza el archivo README.md",
39
- validate: (v) => (!v ? "El mensaje es requerido" : undefined),
40
- });
41
-
42
- if (p.isCancel(msg)) {
43
- p.cancel("Cancelado");
44
- return;
45
- }
46
-
47
- args.push("--message", msg as string);
48
- return agentRun(args);
49
- }
50
-
51
- const message = args[messageIndex + 1];
52
- const thinking = thinkingIndex !== -1 ? args[thinkingIndex + 1] : "medium";
53
- const tools = toolsIndex !== -1 ? args[toolsIndex + 1] : "all";
54
- const agentId = agentIndex !== -1 ? args[agentIndex + 1] : "main";
55
- const wait = waitIndex !== -1;
56
-
57
- if (!message) {
58
- console.log("❌ Mensaje requerido");
59
- return;
60
- }
61
-
62
- const config = loadConfig();
63
- const gatewayUrl = getGatewayUrl(config);
64
-
65
- const spinner = p.spinner();
66
- spinner.start("Conectando con el agente...");
67
-
68
- try {
69
- if (wait) {
70
- await executeWithStream(gatewayUrl, { message, thinking, tools, agentId }, spinner);
71
- } else {
72
- await executeAsync(gatewayUrl, { message, thinking, tools, agentId }, spinner);
73
- }
74
- } catch (error) {
75
- spinner.stop("Error");
76
- console.log(`❌ ${(error as Error).message}`);
77
- console.log(" ¿Está corriendo el Gateway? Ejecuta: hive start");
78
- }
79
- }
80
-
81
- async function executeWithStream(
82
- gatewayUrl: string,
83
- payload: { message: string; thinking: string; tools: string; agentId: string },
84
- spinner: ReturnType<typeof p.spinner>
85
- ): Promise<void> {
86
- const response = await fetch(`${gatewayUrl}/api/agent/execute`, {
87
- method: "POST",
88
- headers: { "Content-Type": "application/json" },
89
- body: JSON.stringify({ ...payload, stream: true }),
90
- });
91
-
92
- if (!response.ok) {
93
- throw new Error(`Error: ${response.statusText}`);
94
- }
95
-
96
- spinner.stop("Conectado");
97
-
98
- const reader = response.body?.getReader();
99
- if (!reader) {
100
- throw new Error("No se pudo obtener el stream");
101
- }
102
-
103
- const decoder = new TextDecoder();
104
- let buffer = "";
105
- let thinking = true;
106
-
107
- process.stdout.write("\n");
108
-
109
- while (true) {
110
- const { done, value } = await reader.read();
111
- if (done) break;
112
-
113
- buffer += decoder.decode(value, { stream: true });
114
- const lines = buffer.split("\n");
115
- buffer = lines.pop() ?? "";
116
-
117
- for (const line of lines) {
118
- if (!line.trim() || !line.startsWith("data: ")) continue;
119
-
120
- try {
121
- const data = JSON.parse(line.slice(6));
122
-
123
- if (data.type === "thinking" && thinking) {
124
- process.stdout.write(".");
125
- } else if (data.type === "response") {
126
- if (thinking) {
127
- process.stdout.write("\n\n");
128
- thinking = false;
129
- }
130
- process.stdout.write(data.content ?? "");
131
- } else if (data.type === "tool_call") {
132
- process.stdout.write(`\n[Tool: ${data.toolName}]`);
133
- } else if (data.type === "complete") {
134
- process.stdout.write("\n\n");
135
- }
136
- } catch {
137
- // Ignore parse errors
138
- }
139
- }
140
- }
141
- }
142
-
143
- async function executeAsync(
144
- gatewayUrl: string,
145
- payload: { message: string; thinking: string; tools: string; agentId: string },
146
- spinner: ReturnType<typeof p.spinner>
147
- ): Promise<void> {
148
- const response = await fetch(`${gatewayUrl}/api/agent/execute`, {
149
- method: "POST",
150
- headers: { "Content-Type": "application/json" },
151
- body: JSON.stringify({ ...payload, stream: false }),
152
- });
153
-
154
- if (!response.ok) {
155
- throw new Error(`Error: ${response.statusText}`);
156
- }
157
-
158
- const result = await response.json() as { taskId?: string; success: boolean };
159
-
160
- spinner.stop("Enviado");
161
-
162
- if (result.taskId) {
163
- console.log(`✓ Tarea enviada: ${result.taskId}`);
164
- console.log(" Usa `hive tasks list` para ver el estado");
165
- } else {
166
- console.log("✓ Tarea enviada");
167
- }
168
- }