@johpaz/hive-agents 1.0.0 → 1.0.1
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 +25 -11
- package/dist/hive.js +22245 -6788
- package/dist/tool-worker.js +6 -2
- package/dist/ui/assets/{A2UIPage-D4nUFe5q.js → A2UIPage-D4nzp5NV.js} +1 -1
- package/dist/ui/assets/{AgentCreateForm-g1mQnIoJ.js → AgentCreateForm-M2RhjeA1.js} +1 -1
- package/dist/ui/assets/{AgentDetailPage-C3XkU4Ll.js → AgentDetailPage-DkFRtj8g.js} +1 -1
- package/dist/ui/assets/AgentNewPage-CfBU7puz.js +1 -0
- package/dist/ui/assets/{AgentsPage-CNA778Eo.js → AgentsPage-Ctzq2LWx.js} +1 -1
- package/dist/ui/assets/{ApiClientPage-t5DpKhmA.js → ApiClientPage-DKbGO1QW.js} +1 -1
- package/dist/ui/assets/{ChannelsPage-yY6t0YTU.js → ChannelsPage-H6rgr8DQ.js} +2 -2
- package/dist/ui/assets/{DashboardPage-BSeNSYg5.js → DashboardPage-BIjYGf4m.js} +2 -2
- package/dist/ui/assets/{LoginPage-eT5zDRDa.js → LoginPage-DazoxtBJ.js} +1 -1
- package/dist/ui/assets/{LogsPage-Gczzzsdh.js → LogsPage-DMZ6KtQ3.js} +1 -1
- package/dist/ui/assets/{MeetingPage-Bu4aMMNR.js → MeetingPage-CSLFvHL7.js} +1 -1
- package/dist/ui/assets/{ModelSelector-nNOrW3te.js → ModelSelector-BCfvugHB.js} +1 -1
- package/dist/ui/assets/{Office3DPage-B_iXEbyv.js → Office3DPage-BE6Epe0d.js} +2 -2
- package/dist/ui/assets/ProvidersPage-D0cApfM1.js +1 -0
- package/dist/ui/assets/{RecoverPage-DMqSasKk.js → RecoverPage-BVUPHG9z.js} +1 -1
- package/dist/ui/assets/{SettingsPage-B6FTSkOn.js → SettingsPage-DCZ4nql4.js} +1 -1
- package/dist/ui/assets/{SetupPage-DhcRbGgg.js → SetupPage-In19p30M.js} +1 -1
- package/dist/ui/assets/{WebChatPage-CWXjW4Hn.js → WebChatPage-ByVBSzxL.js} +1 -1
- package/dist/ui/assets/{activity-CQuPevhB.js → activity-BIIli7ET.js} +1 -1
- package/dist/ui/assets/{agentCapabilities-CDC6y91E.js → agentCapabilities-D1PD9yFH.js} +1 -1
- package/dist/ui/assets/arrow-left-BfcnX8Er.js +1 -0
- package/dist/ui/assets/arrow-right-Q-dzAn8k.js +1 -0
- package/dist/ui/assets/arrow-up-right-Bf-8wrUQ.js +1 -0
- package/dist/ui/assets/{calendar-Be23hQGc.js → calendar-S9-_Q6QR.js} +1 -1
- package/dist/ui/assets/check-CryV78SQ.js +1 -0
- package/dist/ui/assets/chevron-down-QCtMs-Af.js +1 -0
- package/dist/ui/assets/chevron-left-dTGbyl5G.js +1 -0
- package/dist/ui/assets/chevron-right-D0GjXbnO.js +1 -0
- package/dist/ui/assets/chevron-up-Cg0jO8uT.js +1 -0
- package/dist/ui/assets/{circle-alert-BDVHxmAz.js → circle-alert-DTVW4R94.js} +1 -1
- package/dist/ui/assets/circle-check-BAolxswA.js +1 -0
- package/dist/ui/assets/{circle-x-Cb2Yer4s.js → circle-x-CJXbXzRh.js} +1 -1
- package/dist/ui/assets/{copy-33tZrzc9.js → copy-X_TPpA-A.js} +1 -1
- package/dist/ui/assets/{dialog-KOZKWbib.js → dialog-uUBz_NIB.js} +1 -1
- package/dist/ui/assets/{download-CiQqqXyz.js → download-C-fXu08w.js} +1 -1
- package/dist/ui/assets/{earth-DCvN7ynm.js → earth-CTsVjCmp.js} +1 -1
- package/dist/ui/assets/{ellipsis-vertical-BybFZDk2.js → ellipsis-vertical-5zBh5yzc.js} +1 -1
- package/dist/ui/assets/{external-link-0iNNBvZm.js → external-link-CvpRhwC_.js} +1 -1
- package/dist/ui/assets/{eye-C8sKSSkg.js → eye-CM-HQEWU.js} +1 -1
- package/dist/ui/assets/{file-text-DO8jqiJK.js → file-text-lwkvYGtA.js} +1 -1
- package/dist/ui/assets/gauge-CB-cas-h.js +1 -0
- package/dist/ui/assets/{history-BtTD1kDo.js → history-eSHspWRr.js} +1 -1
- package/dist/ui/assets/index-D489S18g.css +2 -0
- package/dist/ui/assets/{index-Bejlp-R1.js → index-ZjAc-KQS.js} +4 -4
- package/dist/ui/assets/{info-mpk1tsNC.js → info-DTgFQ_jA.js} +1 -1
- package/dist/ui/assets/{key-CoQ0qtXt.js → key-CeM9JJkq.js} +1 -1
- package/dist/ui/assets/loader-circle-Dtfz4FWw.js +1 -0
- package/dist/ui/assets/{lock-open-Cd2aqwOd.js → lock-open-B089GUAJ.js} +1 -1
- package/dist/ui/assets/{mail-BG0RYSkL.js → mail--gNFIe4M.js} +1 -1
- package/dist/ui/assets/{pause-Cme88_9s.js → pause-DjT1nwQM.js} +1 -1
- package/dist/ui/assets/{pencil-f1nJ1xhs.js → pencil-6PRgdjiU.js} +1 -1
- package/dist/ui/assets/play-tOrP0xUJ.js +1 -0
- package/dist/ui/assets/plus-Cnom3j47.js +1 -0
- package/dist/ui/assets/{radio-B5SpKJ-J.js → radio-D-joO9J0.js} +1 -1
- package/dist/ui/assets/{refresh-cw-CroGQY62.js → refresh-cw-BRrzoHQW.js} +1 -1
- package/dist/ui/assets/search-D277MUP0.js +1 -0
- package/dist/ui/assets/{select-BhbW0stK.js → select-BOR8MsSL.js} +1 -1
- package/dist/ui/assets/{send-D6whYpw-.js → send-DIlj81PT.js} +1 -1
- package/dist/ui/assets/{settings-BX6q3MGB.js → settings-CkBjgAEm.js} +1 -1
- package/dist/ui/assets/{shield-BnGyu1xf.js → shield-U0hIjGzm.js} +1 -1
- package/dist/ui/assets/{sparkles-BcaOs_Jk.js → sparkles-VXHGDbNh.js} +1 -1
- package/dist/ui/assets/{square-ju5H8nrT.js → square-OHeetvN3.js} +1 -1
- package/dist/ui/assets/terminal-C6YPcJl_.js +1 -0
- package/dist/ui/assets/{trash-2-DjQXac_0.js → trash-2-DQxm7DUM.js} +1 -1
- package/dist/ui/assets/{triangle-alert-B04mgMcg.js → triangle-alert-Dj8ZhmWj.js} +1 -1
- package/dist/ui/assets/{useHiveAgentsModelLoad-DT5-4CCj.js → useHiveAgentsModelLoad-COLvs-Ho.js} +1 -1
- package/dist/ui/assets/{useProviders-DSX7eVsz.js → useProviders-q6iROeWE.js} +1 -1
- package/dist/ui/assets/{volume-x-qnVxkRSM.js → volume-x-Bm735CXN.js} +1 -1
- package/dist/ui/assets/{wifi-BA1m2dGO.js → wifi-DklBfOZ6.js} +1 -1
- package/dist/ui/assets/{zap-DT7cM7YS.js → zap-BEZNJ0i0.js} +1 -1
- package/dist/ui/index.html +8 -6
- package/dist/ui/logoblack.png +0 -0
- package/dist/ui/logocolor-dark.png +0 -0
- package/dist/ui/logocolorbg.png +0 -0
- package/dist/ui/logodoradobg.png +0 -0
- package/package.json +12 -8
- package/packages/cli/src/commands/doctor.ts +111 -0
- package/packages/cli/src/commands/onboard.ts +126 -59
- package/packages/cli/src/ui-bundle.generated.ts +9 -92
- package/packages/core/src/agent/acceptance-checks.ts +172 -0
- package/packages/core/src/agent/agent-catalog.ts +1 -37
- package/packages/core/src/agent/agent-loop.ts +21 -2
- package/packages/core/src/agent/catalog-selector.ts +0 -1
- package/packages/core/src/agent/compaction.ts +16 -1
- package/packages/core/src/agent/context-compiler.ts +3 -1
- package/packages/core/src/agent/conversation-store.ts +1 -1
- package/packages/core/src/agent/delegation-runtime.ts +1 -8
- package/packages/core/src/agent/goal-runner.ts +111 -32
- package/packages/core/src/agent/index.ts +1 -1
- package/packages/core/src/agent/llm-client.ts +34 -2
- package/packages/core/src/agent/llm-providers/anthropic.ts +10 -7
- package/packages/core/src/agent/llm-providers/interface.ts +13 -2
- package/packages/core/src/agent/llm-providers/modelscope.ts +5 -0
- package/packages/core/src/agent/llm-providers/z-ai.ts +5 -0
- package/packages/core/src/agent/minimal-loadout.ts +1 -0
- package/packages/core/src/agent/proof-packet.ts +2 -11
- package/packages/core/src/agent/providers/index.ts +1 -1
- package/packages/core/src/agent/tool-selector.ts +25 -1
- package/packages/core/src/canvas/emitter.ts +0 -44
- package/packages/core/src/channels/manager.ts +117 -25
- package/packages/core/src/channels/whatsapp.ts +6 -1
- package/packages/core/src/config/loader.ts +13 -1
- package/packages/core/src/events/channel-narration.ts +150 -0
- package/packages/core/src/events/tool-narration.ts +62 -0
- package/packages/core/src/gateway/channel-notify.ts +11 -7
- package/packages/core/src/gateway/delegation-groups.ts +24 -11
- package/packages/core/src/gateway/helpers/narration.ts +4 -62
- package/packages/core/src/gateway/helpers/ui-source.ts +67 -0
- package/packages/core/src/gateway/job-executors.ts +29 -67
- package/packages/core/src/gateway/resolver.ts +10 -2
- package/packages/core/src/gateway/routes/agents.ts +6 -6
- package/packages/core/src/gateway/routes/channels.ts +15 -1
- package/packages/core/src/gateway/routes/models.ts +69 -12
- package/packages/core/src/gateway/routes/providers.ts +110 -28
- package/packages/core/src/gateway/routes/setup.ts +63 -11
- package/packages/core/src/gateway/routes/system.ts +8 -5
- package/packages/core/src/gateway/routes/voice.ts +3 -0
- package/packages/core/src/gateway/server.ts +58 -28
- package/packages/core/src/gateway/webchat-turn.ts +29 -5
- package/packages/core/src/index.ts +1 -1
- package/packages/core/src/storage/bootstrap.ts +13 -9
- package/packages/core/src/storage/collections.ts +12 -46
- package/packages/core/src/storage/crypto.ts +147 -58
- package/packages/core/src/storage/hivedb.ts +9 -0
- package/packages/core/src/storage/model-id.ts +53 -0
- package/packages/core/src/storage/onboarding.ts +15 -4
- package/packages/core/src/storage/seed.ts +254 -138
- package/packages/core/src/storage/usage.ts +61 -123
- package/packages/core/src/tools/agents/index.ts +199 -27
- package/packages/core/src/tools/index.ts +2 -1
- package/packages/core/src/tools/web/browser-backend.ts +129 -0
- package/packages/core/src/tools/web/browser-service.ts +75 -35
- package/packages/core/src/tools/web/webview-backend.ts +412 -0
- package/packages/core/src/voice/index.ts +108 -17
- package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +2 -1
- package/packages/skills/src/bundled-data.generated.ts +2 -23
- package/dist/ui/assets/AgentNewPage-CEkLeA79.js +0 -1
- package/dist/ui/assets/ProvidersPage-BupHs5yO.js +0 -1
- package/dist/ui/assets/arrow-left-0EBE7nsF.js +0 -1
- package/dist/ui/assets/arrow-right-5QIaph-z.js +0 -1
- package/dist/ui/assets/arrow-up-right-DQQCY007.js +0 -1
- package/dist/ui/assets/check-Dp6tzwax.js +0 -1
- package/dist/ui/assets/chevron-down-33N886NY.js +0 -1
- package/dist/ui/assets/chevron-left-C6itJXh3.js +0 -1
- package/dist/ui/assets/chevron-right-CFodBS-b.js +0 -1
- package/dist/ui/assets/chevron-up-BvSmyBEs.js +0 -1
- package/dist/ui/assets/circle-check-BJWNbLuF.js +0 -1
- package/dist/ui/assets/gauge-BRGwuN8G.js +0 -1
- package/dist/ui/assets/index-XoTT41Hr.css +0 -2
- package/dist/ui/assets/loader-circle-BhqRN2nO.js +0 -1
- package/dist/ui/assets/play-CfYDHD6h.js +0 -1
- package/dist/ui/assets/plus-C5BxJeOX.js +0 -1
- package/dist/ui/assets/search-rfBcmohK.js +0 -1
- package/dist/ui/assets/terminal-Bjfu-TkS.js +0 -1
- package/packages/core/src/agent/acceptance-verifier.ts +0 -300
- package/packages/skills/src/bundled/agents/acceptance_verification/SKILL.md +0 -26
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { col } from "../storage/hive";
|
|
2
2
|
import type { ChannelDoc, ModelDoc } from "../storage/collections";
|
|
3
3
|
import { loadProviderApiKey } from "../storage/crypto";
|
|
4
|
+
import { wireModelId } from "../storage/model-id";
|
|
4
5
|
import { logger } from "../utils/logger";
|
|
5
6
|
|
|
6
7
|
export interface VoiceConfig {
|
|
@@ -103,15 +104,37 @@ class VoiceService {
|
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
/**
|
|
107
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Resuelve lo que el canal tiene guardado en `stt_provider`/`tts_provider` a un
|
|
109
|
+
* par (provider, modelo del catálogo).
|
|
110
|
+
*
|
|
111
|
+
* El campo se llama `*_provider` por historia: hoy guarda el id de un **modelo**,
|
|
112
|
+
* pero las configuraciones viejas guardaban el id del **provider**. En ese caso
|
|
113
|
+
* hay que elegir un modelo concreto acá; devolver sólo el provider hacía que su
|
|
114
|
+
* nombre terminara viajando al cable como si fuera un nombre de modelo.
|
|
115
|
+
*/
|
|
116
|
+
private async resolveVoiceModel(
|
|
117
|
+
stored: string,
|
|
118
|
+
type: "stt" | "tts",
|
|
119
|
+
): Promise<{ provider: string; modelId: string } | null> {
|
|
108
120
|
try {
|
|
109
121
|
const modelsCol = await col<ModelDoc>("models");
|
|
110
|
-
const model = await modelsCol.get(
|
|
111
|
-
if (model?.doc.provider_id) return model.doc.provider_id;
|
|
122
|
+
const model = await modelsCol.get(stored);
|
|
123
|
+
if (model?.doc.provider_id) return { provider: model.doc.provider_id, modelId: model.doc.id };
|
|
124
|
+
|
|
112
125
|
const providersCol = await col<import("../storage/collections").ProviderDoc>("providers");
|
|
113
|
-
const provider = await providersCol.get(
|
|
114
|
-
|
|
126
|
+
const provider = await providersCol.get(stored);
|
|
127
|
+
if (!provider?.doc.id) return null;
|
|
128
|
+
|
|
129
|
+
const candidates = (await modelsCol.findBy("model_type", type))
|
|
130
|
+
.filter((e) => e.doc.provider_id === provider.doc.id && e.doc.enabled);
|
|
131
|
+
const pick = candidates.find((e) => e.doc.active) ?? candidates[0];
|
|
132
|
+
if (!pick) return null;
|
|
133
|
+
|
|
134
|
+
log.warn(
|
|
135
|
+
`Canal con ${type}_provider="${stored}" (id de provider, formato viejo): usando ${pick.doc.id}`,
|
|
136
|
+
);
|
|
137
|
+
return { provider: provider.doc.id, modelId: pick.doc.id };
|
|
115
138
|
} catch {
|
|
116
139
|
return null;
|
|
117
140
|
}
|
|
@@ -134,19 +157,22 @@ class VoiceService {
|
|
|
134
157
|
}
|
|
135
158
|
|
|
136
159
|
async transcribe(audio: AudioInput, modelId: string): Promise<string> {
|
|
137
|
-
let
|
|
138
|
-
let resolvedModelId = modelId;
|
|
160
|
+
let resolved = await this.resolveVoiceModel(modelId, "stt");
|
|
139
161
|
|
|
140
|
-
if (!
|
|
162
|
+
if (!resolved) {
|
|
141
163
|
const fallback = await this.getFirstActiveVoiceModel("stt");
|
|
142
164
|
if (!fallback) throw new Error(`STT model "${modelId}" not found and no active STT models in the database`);
|
|
143
165
|
log.warn(`STT model ${modelId} not found in DB, falling back to ${fallback.provider}/${fallback.id}`);
|
|
144
|
-
|
|
145
|
-
resolvedModelId = fallback.id;
|
|
166
|
+
resolved = { provider: fallback.provider, modelId: fallback.id };
|
|
146
167
|
}
|
|
168
|
+
const { provider, modelId: resolvedModelId } = resolved;
|
|
147
169
|
|
|
148
170
|
switch (provider) {
|
|
149
|
-
|
|
171
|
+
// groq revende modelos de terceros, así que sus filas de catálogo llevan
|
|
172
|
+
// el prefijo `groq/` y eso es lo que el canal guarda en stt_provider. El
|
|
173
|
+
// prefijo es una clave de la BD, no un nombre de modelo: mandarlo al cable
|
|
174
|
+
// hacía que la API contestara 400 para CUALQUIER whisper de Groq.
|
|
175
|
+
case "groq": return this.transcribeWithGroq(audio, wireModelId(provider, resolvedModelId));
|
|
150
176
|
case "openai": return this.transcribeWithOpenAIWhisper(audio);
|
|
151
177
|
default:
|
|
152
178
|
throw new Error(`STT not supported for provider "${provider}" (model ${resolvedModelId})`);
|
|
@@ -257,16 +283,17 @@ class VoiceService {
|
|
|
257
283
|
}
|
|
258
284
|
|
|
259
285
|
async speak(text: string, modelId: string, voiceId?: string): Promise<AudioOutput> {
|
|
260
|
-
|
|
261
|
-
|
|
286
|
+
if (modelId === "piper-local") return this.speakWithPiper(text, voiceId);
|
|
287
|
+
|
|
288
|
+
let resolved = await this.resolveVoiceModel(modelId, "tts");
|
|
262
289
|
|
|
263
|
-
if (!
|
|
290
|
+
if (!resolved) {
|
|
264
291
|
const fallback = await this.getFirstActiveVoiceModel("tts");
|
|
265
292
|
if (!fallback) throw new Error(`TTS model "${modelId}" not found and no active TTS models in the database`);
|
|
266
293
|
log.warn(`TTS model ${modelId} not found in DB, falling back to ${fallback.provider}/${fallback.id}`);
|
|
267
|
-
|
|
268
|
-
resolvedModelId = fallback.id;
|
|
294
|
+
resolved = { provider: fallback.provider, modelId: fallback.id };
|
|
269
295
|
}
|
|
296
|
+
const { provider, modelId: resolvedModelId } = resolved;
|
|
270
297
|
|
|
271
298
|
switch (provider) {
|
|
272
299
|
case "piper": return this.speakWithPiper(text, voiceId);
|
|
@@ -274,6 +301,9 @@ class VoiceService {
|
|
|
274
301
|
case "openai": return this.speakWithOpenAI(text, resolvedModelId, voiceId);
|
|
275
302
|
case "gemini": return this.speakWithGemini(text, resolvedModelId, voiceId);
|
|
276
303
|
case "qwen": return this.speakWithQwen(text, resolvedModelId, voiceId);
|
|
304
|
+
// Mismo prefijo de revendedor que en STT: la fila es `groq/canopylabs/...`
|
|
305
|
+
// y al cable va sólo `canopylabs/...`.
|
|
306
|
+
case "groq": return this.speakWithGroq(text, wireModelId(provider, resolvedModelId), voiceId);
|
|
277
307
|
default:
|
|
278
308
|
throw new Error(`TTS not supported for provider "${provider}" (model ${resolvedModelId})`);
|
|
279
309
|
}
|
|
@@ -375,6 +405,67 @@ class VoiceService {
|
|
|
375
405
|
};
|
|
376
406
|
}
|
|
377
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Orpheus (Canopy Labs) sobre el endpoint OpenAI-compatible de Groq. Reemplazó
|
|
410
|
+
* a playai-tts, que Groq deprecó en diciembre de 2025.
|
|
411
|
+
*
|
|
412
|
+
* `wav` es el único `response_format` que Orpheus acepta hoy — no es un default
|
|
413
|
+
* elegido acá, mandar mp3 falla.
|
|
414
|
+
*/
|
|
415
|
+
private async speakWithGroq(text: string, modelId: string, voiceId?: string): Promise<AudioOutput> {
|
|
416
|
+
const key = await this.getProviderApiKey("groq") || process.env.GROQ_API_KEY;
|
|
417
|
+
if (!key) {
|
|
418
|
+
throw new Error("GROQ_API_KEY not configured. Configúrala en Proveedores o en las variables de entorno.");
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const isArabic = modelId.includes("arabic");
|
|
422
|
+
const voice = voiceId || (isArabic ? "abdullah" : "troy");
|
|
423
|
+
|
|
424
|
+
const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
|
|
425
|
+
method: "POST",
|
|
426
|
+
headers: {
|
|
427
|
+
"Content-Type": "application/json",
|
|
428
|
+
"Authorization": `Bearer ${key}`,
|
|
429
|
+
},
|
|
430
|
+
body: JSON.stringify({
|
|
431
|
+
model: modelId,
|
|
432
|
+
voice,
|
|
433
|
+
input: cleanTextForTTS(text),
|
|
434
|
+
response_format: "wav",
|
|
435
|
+
}),
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
if (!response.ok) {
|
|
439
|
+
const error = await response.text();
|
|
440
|
+
throw new Error(`Groq TTS failed: ${error}`);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const buffer = await response.arrayBuffer();
|
|
444
|
+
return {
|
|
445
|
+
type: "buffer",
|
|
446
|
+
data: Buffer.from(buffer),
|
|
447
|
+
mimeType: "audio/wav",
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** Las seis personas de Orpheus en inglés más las seis del modelo árabe saudí. */
|
|
452
|
+
getGroqVoices(): Array<{ id: string; name: string }> {
|
|
453
|
+
return [
|
|
454
|
+
{ id: "autumn", name: "Autumn (F, inglés)" },
|
|
455
|
+
{ id: "diana", name: "Diana (F, inglés)" },
|
|
456
|
+
{ id: "hannah", name: "Hannah (F, inglés)" },
|
|
457
|
+
{ id: "austin", name: "Austin (M, inglés)" },
|
|
458
|
+
{ id: "daniel", name: "Daniel (M, inglés)" },
|
|
459
|
+
{ id: "troy", name: "Troy (M, inglés)" },
|
|
460
|
+
{ id: "lulwa", name: "Lulwa (F, árabe saudí)" },
|
|
461
|
+
{ id: "noura", name: "Noura (F, árabe saudí)" },
|
|
462
|
+
{ id: "aisha", name: "Aisha (F, árabe saudí)" },
|
|
463
|
+
{ id: "abdullah", name: "Abdullah (M, árabe saudí)" },
|
|
464
|
+
{ id: "fahad", name: "Fahad (M, árabe saudí)" },
|
|
465
|
+
{ id: "sultan", name: "Sultan (M, árabe saudí)" },
|
|
466
|
+
];
|
|
467
|
+
}
|
|
468
|
+
|
|
378
469
|
private async speakWithGemini(text: string, modelId: string, voiceId?: string): Promise<AudioOutput> {
|
|
379
470
|
const key = process.env.GEMINI_API_KEY;
|
|
380
471
|
|
|
@@ -91,7 +91,8 @@ Para una integración MCP sin especialista, pedí autorización primero. Si el u
|
|
|
91
91
|
- ❌ Serializar tareas independientes en vez de fan-out paralelo
|
|
92
92
|
- ❌ Polling con `task_status` esperando el resultado — el fan-in llega solo
|
|
93
93
|
- ❌ Declarar éxito antes de recibir el `[Sistema]`, o presentar `ok=false` como éxito
|
|
94
|
-
- ❌
|
|
94
|
+
- ❌ Reportar éxito sin revisar `acceptance`/`checks` de la entrega, o ignorar un `checks.status="failed"`
|
|
95
|
+
- ❌ Corregir a mano lo que `task_revise` puede reencolar en el mismo worker
|
|
95
96
|
- ❌ Crear un worker que el catálogo ya cubre
|
|
96
97
|
- ❌ Delegar saludos, preguntas simples o la conversación
|
|
97
98
|
- ❌ Usar `delegate_task`, `find_agent`, `create_agent`, `get_task_status`, `publish_to_bus`, `get_bus_messages` — **no existen**
|
|
@@ -1164,7 +1164,8 @@ Para una integración MCP sin especialista, pedí autorización primero. Si el u
|
|
|
1164
1164
|
- ❌ Serializar tareas independientes en vez de fan-out paralelo
|
|
1165
1165
|
- ❌ Polling con \`task_status\` esperando el resultado — el fan-in llega solo
|
|
1166
1166
|
- ❌ Declarar éxito antes de recibir el \`[Sistema]\`, o presentar \`ok=false\` como éxito
|
|
1167
|
-
- ❌
|
|
1167
|
+
- ❌ Reportar éxito sin revisar \`acceptance\`/\`checks\` de la entrega, o ignorar un \`checks.status="failed"\`
|
|
1168
|
+
- ❌ Corregir a mano lo que \`task_revise\` puede reencolar en el mismo worker
|
|
1168
1169
|
- ❌ Crear un worker que el catálogo ya cubre
|
|
1169
1170
|
- ❌ Delegar saludos, preguntas simples o la conversación
|
|
1170
1171
|
- ❌ Usar \`delegate_task\`, \`find_agent\`, \`create_agent\`, \`get_task_status\`, \`publish_to_bus\`, \`get_bus_messages\` — **no existen**
|
|
@@ -1246,28 +1247,6 @@ agent_create({
|
|
|
1246
1247
|
- ❌ Tools en exceso ("por las dudas")
|
|
1247
1248
|
- ❌ System prompt genérico
|
|
1248
1249
|
- ❌ Nombres vagos ("worker1", "agent1")
|
|
1249
|
-
`,
|
|
1250
|
-
},
|
|
1251
|
-
{
|
|
1252
|
-
name: "acceptance_verification",
|
|
1253
|
-
description: `Independently verify acceptance criteria before Hive reports a delegated or effectful task as complete`,
|
|
1254
|
-
category: "agents",
|
|
1255
|
-
version: "1.0.0",
|
|
1256
|
-
tools: ["fs_read","fs_exists","fs_list","web_fetch","browser_navigate","browser_extract","browser_screenshot","office_leer_pdf","office_leer_docx","office_leer_xlsx","office_leer_pptx","cron.list","cron.history","task_status"],
|
|
1257
|
-
triggers: ["verificar cumplimiento","acceptance gate","audit result","proof packet"],
|
|
1258
|
-
body: `
|
|
1259
|
-
# Verificación independiente
|
|
1260
|
-
|
|
1261
|
-
Evalúa cada criterio por separado. Una afirmación del ejecutor no es evidencia independiente.
|
|
1262
|
-
|
|
1263
|
-
Orden de preferencia:
|
|
1264
|
-
|
|
1265
|
-
1. Check determinístico.
|
|
1266
|
-
2. Readback seguro del estado final.
|
|
1267
|
-
3. Inspección directa del artefacto.
|
|
1268
|
-
4. Evidencia trazada y consistente.
|
|
1269
|
-
|
|
1270
|
-
Devuelve \`verified\` únicamente cuando todos los criterios estén demostrados. Usa \`needs_evidence\` cuando podría demostrarse con información adicional y \`rejected\` cuando la evidencia contradiga el objetivo. Nunca repares la tarea.
|
|
1271
1250
|
`,
|
|
1272
1251
|
},
|
|
1273
1252
|
{
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./vendor-query-Dj8xYhQD.js";import{t}from"./AgentCreateForm-g1mQnIoJ.js";var n=e();function r(){return(0,n.jsx)(t,{})}export{r as AgentNewPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./check-Dp6tzwax.js";import{t as i}from"./chevron-down-33N886NY.js";import{t as a}from"./chevron-right-CFodBS-b.js";import{t as o}from"./circle-check-BJWNbLuF.js";import{t as s}from"./useProviders-DSX7eVsz.js";import{t as c}from"./download-CiQqqXyz.js";import{n as l,t as u}from"./eye-C8sKSSkg.js";import{n as d,t as f}from"./key-CoQ0qtXt.js";import{t as p}from"./loader-circle-BhqRN2nO.js";import{t as m}from"./lock-open-Cd2aqwOd.js";import{n as h,t as g}from"./pencil-f1nJ1xhs.js";import{n as _,t as v}from"./square-ju5H8nrT.js";import{t as y}from"./play-CfYDHD6h.js";import{t as b}from"./plus-C5BxJeOX.js";import{t as x}from"./refresh-cw-CroGQY62.js";import{t as S}from"./search-rfBcmohK.js";import{t as C}from"./settings-BX6q3MGB.js";import{t as ee}from"./terminal-Bjfu-TkS.js";import{t as w}from"./trash-2-DjQXac_0.js";import{n as te,t as T}from"./wifi-BA1m2dGO.js";import{t as E}from"./utils-Dyb7SC2_.js";import{H as D,K as O,M as k,O as A,R as j,f as ne,i as M,k as N,m as P,o as re,r as F,s as I,u as L}from"./index-Bejlp-R1.js";import{t as R}from"./badge-DKGZbVZJ.js";import{t as z}from"./scroll-area-CfHn94Vb.js";import{i as B,n as ie,r as ae,t as oe}from"./tabs-CxiybXcw.js";import{c as se,i as V,o as ce,r as le,s as ue,t as de}from"./dialog-KOZKWbib.js";import{t as H}from"./label-k0jYxoWW.js";import{i as U,n as fe,o as pe,s as me,t as he}from"./select-BhbW0stK.js";import{t as W}from"./switch-DXcELPsM.js";import{a as G,i as K,n as q,r as J,t as Y}from"./card-D3Nw3kh3.js";var ge=O(`Package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7`,key:`yx3hmr`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),X=e(t(),1),Z=n();function _e({provider:e,onSave:t,onCancel:n}){let[r,i]=(0,X.useState)(!1),[a,s]=(0,X.useState)(``),[c,d]=(0,X.useState)(e?.baseUrl||e?.base_url||``),[f,p]=(0,X.useState)(e?.config?.headers?JSON.stringify(e.config.headers,null,2):``),[m,h]=(0,X.useState)(e?.num_ctx?String(e.num_ctx):``),g=c||e?.baseUrl||e?.base_url||``,_=e?.id===`ollama`||g.includes(`localhost`)||g.includes(`127.0.0.1`),v=!!e?.has_api_key,y=!!e?.has_headers;return(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(H,{className:`hive-label`,children:`API Key`}),v&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-bold text-emerald-400`,children:[(0,Z.jsx)(o,{className:`h-3 w-3`}),`Configurada`]})]}),(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(A,{type:r?`text`:`password`,value:a,onChange:e=>s(e.target.value),placeholder:v?`•••••••••••••••• (dejar vacío para conservar)`:`sk-...`,className:`hive-input !h-8 text-xs pr-8`}),(0,Z.jsx)(N,{variant:`ghost`,size:`icon`,className:`absolute right-0 top-0 h-8 w-8 text-white/40 hover:text-white`,onClick:()=>i(!r),children:r?(0,Z.jsx)(l,{className:`h-3 w-3`}):(0,Z.jsx)(u,{className:`h-3 w-3`})})]})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(H,{className:`hive-label`,children:`Base URL (opcional)`}),(0,Z.jsx)(A,{value:c,onChange:e=>d(e.target.value),placeholder:`https://api.example.com`,className:`hive-input !h-8 text-xs`})]}),_&&(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(H,{className:`hive-label`,children:`Context Window (num_ctx)`}),(0,Z.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`tokens — por defecto 32 768`})]}),(0,Z.jsx)(A,{type:`number`,value:m,onChange:e=>h(e.target.value),placeholder:`8192`,min:512,step:512,className:`hive-input !h-8 text-xs font-mono`}),(0,Z.jsx)(`p`,{className:`text-[10px] text-amber-400/60`,children:`Aumenta si ves errores de contexto. Tu modelo soporta hasta 262 144 tokens.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(H,{className:`hive-label`,children:`Custom Headers (JSON)`}),y&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-bold text-emerald-400`,children:[(0,Z.jsx)(o,{className:`h-3 w-3`}),`Configurados`]})]}),(0,Z.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),placeholder:y?`{ ... } (dejar vacío para conservar)`:`{ "x-custom-header": "value" }`,rows:3,className:`w-full bg-white/5 border border-white/10 rounded-md p-2 text-xs text-white/70 focus:outline-none focus:border-blue-500/50 transition-all font-mono`})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,Z.jsx)(`button`,{className:`hive-btn hive-btn--form-cancel flex-1`,onClick:n,children:`Cancelar`}),(0,Z.jsx)(`button`,{className:`hive-btn hive-btn--form-submit flex-1`,onClick:()=>{let e;if(f.trim())try{e=JSON.parse(f.trim())}catch{P.fire(`Error`,`JSON de Headers inválido`,`error`);return}t&&t({apiKey:a,baseUrl:c||void 0,headers:e,numCtx:m.trim()?Number(m.trim()):null})},children:`Guardar`})]}),(0,Z.jsx)(`p`,{className:`text-[10px] text-white/20 pt-2`,children:`La API key se guarda cifrada en la base de datos.`})]})}var ve=C,ye=i,be=a,xe=s,Se=b,Ce=d,we=D,Te=x,Ee=g,De=w,Oe=r,ke=k;function Ae({provider:e,updateProvider:t,onManageModels:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(null),{models:x,toggleModel:S,createModel:C,syncModels:ee,deleteModel:w,updateModel:te}=re(),{toggleProvider:T}=I(),E=(0,X.useMemo)(()=>{let t=x.filter(t=>(t.providerId||t.provider_id)===e.id);return t.length>0?t:e.models||[]},[x,e.id,e.models]),D=E.filter(e=>e.enabled||e.active),O=n=>{t(e.id,n),i(!1)},k=async t=>{try{await T(e.id,t)}catch(e){console.error(`Failed to toggle provider:`,e)}},A=async(e,t)=>{try{await S(e.id,t)}catch(e){console.error(`Failed to toggle model:`,e)}},j=async()=>{f(!0);try{await ee(e.id),o(!0)}catch(e){console.error(`Failed to sync models:`,e)}finally{f(!1)}},ne=e=>{m(e.id),g(e.name),v(e.id)},M=()=>{m(null),g(``),v(``)},N=async e=>{let t=h.trim()||e.name,n=_.trim()||e.id;if(t===e.name&&n===e.id){M();return}try{await te(e.id,{name:t,id:n}),M()}catch(e){console.error(`Failed to update model:`,e)}},P=async e=>{b(e.id);try{await w(e.id)}catch(e){console.error(`Failed to delete model:`,e)}finally{b(null)}},F=async()=>{let t=s.trim();if(t){u(!0);try{await C(e.id,t),c(``)}catch(e){console.error(`Failed to add model:`,e)}finally{u(!1)}}},L=!!e.active,R=e.base_url||e.baseUrl,z=e.id===`ollama`||R?.includes(`localhost`)||R?.includes(`127.0.0.1`);return(0,Z.jsxs)(`div`,{className:`hive-card group overflow-hidden flex flex-col gap-0 transition-all duration-500 ${L?`hive-card--active`:`opacity-70 grayscale-[0.5] hover:grayscale-0 hover:opacity-100`}`,children:[(0,Z.jsx)(`div`,{className:`hive-card-body pb-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 h-10 w-10 sm:h-11 sm:w-11 rounded-xl flex items-center justify-center border transition-all duration-500 ${L?`bg-blue-500/10 border-blue-500/30 text-blue-400 shadow-[0_0_16px_rgba(59,130,246,0.15)]`:`bg-white/5 border-white/10 text-white/30`}`,children:(0,Z.jsx)(xe,{className:`h-5 w-5`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-0.5`,children:[(0,Z.jsx)(`h3`,{className:`font-black text-white tracking-tight text-base sm:text-lg uppercase leading-none truncate`,children:e.name}),L&&(0,Z.jsx)(`div`,{className:`hive-status-dot--active h-1.5 w-1.5 shrink-0`})]}),(0,Z.jsx)(`p`,{className:`text-[11px] text-white/35 font-medium leading-none truncate`,children:e.id})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,Z.jsx)(`span`,{className:`hidden sm:block text-[10px] font-black tracking-widest ${L?`text-blue-400`:`text-white/30`}`,children:L?`ON`:`OFF`}),(0,Z.jsx)(W,{checked:L,onCheckedChange:k,className:`data-[state=checked]:bg-blue-500`})]})]})}),(0,Z.jsxs)(`div`,{className:`px-5 pb-3 space-y-2 border-b border-white/5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Z.jsx)(Ce,{className:`h-3.5 w-3.5 shrink-0 ${e.has_api_key?`text-emerald-400`:z?`text-amber-400`:`text-white/20`}`}),(0,Z.jsx)(`span`,{className:`text-[11px] font-mono truncate`,children:e.masked_api_key?(0,Z.jsx)(`span`,{className:`text-white/50`,children:e.masked_api_key}):e.has_api_key?(0,Z.jsx)(`span`,{className:`text-white/50`,children:`••••••••••••••••`}):z?(0,Z.jsx)(`span`,{className:`text-amber-400/70`,children:`Local — sin API key`}):(0,Z.jsx)(`span`,{className:`text-white/25`,children:`Sin API key`})})]}),R&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Z.jsx)(we,{className:`h-3.5 w-3.5 shrink-0 text-white/20`}),(0,Z.jsx)(`span`,{className:`text-[11px] text-white/40 truncate font-mono`,children:R})]}),z&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Z.jsx)(xe,{className:`h-3.5 w-3.5 shrink-0 text-white/20`}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-white/40 font-mono`,children:[`ctx: `,(0,Z.jsx)(`span`,{className:e.num_ctx?`text-amber-400/70`:`text-white/25`,children:e.num_ctx?`${e.num_ctx.toLocaleString()} tokens`:`32 768 (default)`})]})]})]}),(0,Z.jsxs)(`div`,{className:`px-5 py-3 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 flex-1 text-left text-[10px] font-black uppercase tracking-widest text-white/40 hover:text-white transition-colors`,onClick:()=>o(!a),children:[a?(0,Z.jsx)(ye,{className:`h-3 w-3`}):(0,Z.jsx)(be,{className:`h-3 w-3`}),`MODELOS`,(0,Z.jsxs)(`span`,{className:`hive-tag scale-90 origin-left`,children:[D.length,`/`,E.length]})]}),z&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-[9px] font-semibold text-amber-400/70 bg-amber-400/10 border border-amber-400/20 rounded px-1.5 py-0.5 leading-none whitespace-nowrap`,children:`Actualiza modelos locales`}),(0,Z.jsx)(`button`,{type:`button`,onClick:j,disabled:d,title:`Sincronizar modelos instalados en Ollama`,className:`h-6 w-6 flex items-center justify-center rounded-md text-white/30 hover:text-amber-400 hover:bg-amber-400/10 disabled:opacity-40 transition-colors`,children:(0,Z.jsx)(Te,{className:`h-3 w-3 ${d?`animate-spin`:``}`})})]})]}),!a&&E.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[E.slice(0,3).map(e=>(0,Z.jsx)(`span`,{className:`hive-tag text-[10px] ${e.enabled||e.active?``:`opacity-40`}`,children:e.name.split(`/`).pop()||e.name},e.id)),E.length>3&&(0,Z.jsxs)(`span`,{className:`hive-tag text-[10px] text-white/30`,children:[`+`,E.length-3]})]}),a&&(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`hive-scroll max-h-44 overflow-y-auto flex flex-col gap-0.5 pr-1`,children:[E.length===0&&(0,Z.jsx)(`p`,{className:`text-[11px] text-white/25 py-2 text-center`,children:`Sin modelos configurados`}),E.map(e=>{let t=e.enabled||!!e.active,n=p===e.id;return(0,Z.jsx)(`div`,{className:`rounded-lg transition-colors ${t&&!n||n?`bg-white/5`:`bg-transparent opacity-40`}`,children:n?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 px-2.5 py-1.5`,children:[(0,Z.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Display name`,className:`w-full bg-white/5 border border-white/10 rounded-md px-2 h-7 text-[11px] text-white/70 placeholder-white/20 focus:outline-none focus:border-blue-500/50 transition-all`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`input`,{type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:`API model ID`,className:`flex-1 min-w-0 bg-white/5 border border-white/10 rounded-md px-2 h-7 text-[11px] text-white/70 placeholder-white/20 focus:outline-none focus:border-blue-500/50 transition-all font-mono`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>N(e),className:`shrink-0 h-7 w-7 flex items-center justify-center rounded-md bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 transition-colors`,children:(0,Z.jsx)(Oe,{className:`h-3 w-3`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:M,className:`shrink-0 h-7 w-7 flex items-center justify-center rounded-md bg-white/5 border border-white/10 text-white/40 hover:text-white hover:bg-white/10 transition-colors`,children:(0,Z.jsx)(ke,{className:`h-3 w-3`})})]})]}):(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-2.5 py-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-medium text-white truncate flex-1 mr-2`,children:e.name}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>ne(e),title:`Editar modelo`,className:`h-5 w-5 flex items-center justify-center rounded text-white/25 hover:text-blue-400 hover:bg-blue-400/10 transition-colors`,children:(0,Z.jsx)(Ee,{className:`h-3 w-3`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>P(e),disabled:y===e.id,title:`Eliminar modelo`,className:`h-5 w-5 flex items-center justify-center rounded text-white/25 hover:text-red-400 hover:bg-red-400/10 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:(0,Z.jsx)(De,{className:`h-3 w-3`})}),(0,Z.jsx)(W,{checked:t,onCheckedChange:t=>A(e,t),className:`scale-[0.7] origin-right data-[state=checked]:bg-blue-400 ml-0.5`})]})]})},e.id)})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 pt-1.5 border-t border-white/5`,children:[(0,Z.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Enter`&&F(),placeholder:`nombre-del-modelo`,className:`flex-1 min-w-0 bg-white/5 border border-white/10 rounded-md px-2 h-7 text-[11px] text-white/70 placeholder-white/20 focus:outline-none focus:border-blue-500/50 transition-all font-mono`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:F,disabled:l||!s.trim(),className:`shrink-0 h-7 px-2.5 flex items-center gap-1 rounded-md bg-blue-500/10 border border-blue-500/20 text-blue-400 text-[10px] font-black uppercase tracking-wider hover:bg-blue-500/20 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[(0,Z.jsx)(Se,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{className:`hidden xs:inline`,children:`ADD`})]})]})]})]}),(0,Z.jsxs)(`div`,{className:`px-4 py-3 border-t border-white/5 flex items-center justify-between gap-2 overflow-hidden`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 overflow-hidden`,children:[(0,Z.jsxs)(`div`,{className:`hive-stat shrink-0`,children:[(0,Z.jsx)(`span`,{className:`hive-stat__label`,children:`Uptime`}),(0,Z.jsx)(`span`,{className:`hive-stat__value`,children:`99.9%`})]}),(0,Z.jsxs)(`div`,{className:`hive-stat shrink-0`,children:[(0,Z.jsx)(`span`,{className:`hive-stat__label`,children:`Estado`}),(0,Z.jsx)(`span`,{className:`hive-stat__value ${L?`text-emerald-400`:`text-white/30`}`,children:L?`Activo`:`Inactivo`})]})]}),(0,Z.jsxs)(de,{open:r,onOpenChange:i,children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(`button`,{className:`hive-btn hive-btn--ghost h-8 px-2.5 text-[10px] font-black uppercase tracking-widest text-blue-400 shrink-0 flex items-center gap-1.5`,children:[(0,Z.jsx)(ve,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:`CONFIG`})]})}),(0,Z.jsxs)(le,{className:`rounded-xl border border-white/10 p-0 overflow-hidden w-[calc(100vw-2rem)] max-w-md bg-[#09090b]`,children:[(0,Z.jsxs)(`div`,{className:`p-5 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,Z.jsx)(`div`,{className:`absolute -top-10 -right-10 h-32 w-32 bg-blue-600/10 rounded-full blur-[80px] pointer-events-none`}),(0,Z.jsx)(ue,{className:`text-lg font-black text-white uppercase tracking-tighter`,children:e.name}),(0,Z.jsx)(V,{className:`text-xs text-white/40 font-medium mt-0.5`,children:`Autenticación y punto de enlace.`})]}),(0,Z.jsx)(`div`,{className:`p-5`,children:(0,Z.jsx)(_e,{provider:e,onSave:O,onCancel:()=>i(!1)})})]})]})]}),(0,Z.jsx)(`div`,{className:`hive-strip--bottom ${L?``:`opacity-20`}`})]})}function je(){let{providers:e,updateProvider:t}=I(),n=e.filter(e=>(e.category??`llm`)===`llm`),r=n.filter(e=>e.active).length;return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`h3`,{className:`hive-title-section`,children:`Providers de IA`}),(0,Z.jsxs)(`span`,{className:`hive-tag hive-tag--provider`,children:[r,` activos / `,n.length,` total`]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4 sm:gap-5`,children:[n.map(e=>(0,Z.jsx)(Ae,{provider:e,updateProvider:t},e.id)),n.length===0&&(0,Z.jsx)(`div`,{className:`hive-empty-state col-span-full`,children:`No hay providers disponibles.`})]})]})}function Me({onSave:e,onCancel:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``),[c,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(``),v=o.toLowerCase()===`ollama`||f.includes(`localhost`)||f.includes(`127.0.0.1`);return(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(H,{className:`hive-label`,children:`Nombre del Provider`}),(0,Z.jsx)(A,{value:i,onChange:e=>a(e.target.value),placeholder:`Mi Provider Personalizado`,className:`hive-input !h-8 text-xs`}),(0,Z.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Se usará como identificador interno`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(H,{className:`hive-label`,children:`Tipo de Provider`}),(0,Z.jsx)(A,{value:o,onChange:e=>s(e.target.value),placeholder:`openai, anthropic, ollama...`,className:`hive-input !h-8 text-xs`}),(0,Z.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Ej: openai, anthropic, ollama, custom...`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Z.jsx)(H,{className:`hive-label`,children:`API Key`})}),(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(A,{type:n?`text`:`password`,value:c,onChange:e=>d(e.target.value),placeholder:v?`Opcional para providers locales`:`sk-...`,className:`hive-input !h-8 text-xs pr-8`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`absolute right-0 top-0 h-8 w-8 flex items-center justify-center text-white/40 hover:text-white`,children:n?(0,Z.jsx)(l,{className:`h-3 w-3`}):(0,Z.jsx)(u,{className:`h-3 w-3`})})]})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(H,{className:`hive-label`,children:`Base URL (opcional)`}),(0,Z.jsx)(A,{value:f,onChange:e=>p(e.target.value),placeholder:`https://api.example.com o http://localhost:11434`,className:`hive-input !h-8 text-xs`})]}),v&&(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(H,{className:`hive-label`,children:`Context Window (num_ctx)`}),(0,Z.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`tokens — por defecto 32 768`})]}),(0,Z.jsx)(A,{type:`number`,value:g,onChange:e=>_(e.target.value),placeholder:`32768`,min:512,step:512,className:`hive-input !h-8 text-xs font-mono`}),(0,Z.jsx)(`p`,{className:`text-[10px] text-amber-400/60`,children:`Aumenta si ves errores de contexto.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Z.jsx)(H,{className:`hive-label`,children:`Custom Headers (JSON)`})}),(0,Z.jsx)(`textarea`,{value:m,onChange:e=>h(e.target.value),placeholder:`{ "x-custom-header": "value" }`,rows:3,className:`w-full bg-white/5 border border-white/10 rounded-md p-2 text-xs text-white/70 focus:outline-none focus:border-blue-500/50 transition-all font-mono`})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,Z.jsx)(`button`,{className:`hive-btn hive-btn--form-cancel flex-1`,onClick:t,children:`Cancelar`}),(0,Z.jsx)(`button`,{className:`hive-btn hive-btn--form-submit flex-1`,onClick:()=>{if(!i.trim()){P.fire(`Error`,`El nombre del provider es requerido`,`error`);return}if(!o){P.fire(`Error`,`Selecciona un tipo de provider`,`error`);return}if(!c.trim()&&!v){P.fire(`Error`,`La API Key es requerida para este provider`,`error`);return}let t;if(m.trim())try{t=JSON.parse(m.trim())}catch{P.fire(`Error`,`JSON de Headers inválido`,`error`);return}e({id:i.trim().toLowerCase().replace(/\s+/g,`-`),name:i.trim(),type:o,apiKey:c.trim()||``,baseUrl:f.trim()||void 0,headers:t,numCtx:g.trim()?Number(g.trim()):null})},children:`Crear Provider`})]}),(0,Z.jsx)(`p`,{className:`text-[10px] text-white/20 pt-2`,children:`La API key se guarda cifrada en la base de datos.`})]})}var Ne={chat:`Chat`,vision:`Vision`,json_mode:`JSON`,function_calling:`Functions`,streaming:`Stream`,embeddings:`Embed`,image_generation:`Imagen`,code:`Codigo`,reasoning:`Razonamiento`,transcription:`STT`,translation:`Traduccion`,tts:`TTS`,speech:`Voz`,high_quality:`HQ`,ocr:`OCR`};function Pe({capabilities:e}){let t=[];if(typeof e==`string`)try{t=JSON.parse(e)}catch{t=[]}else Array.isArray(e)&&(t=e);return t.length===0?null:(0,Z.jsx)(Z.Fragment,{children:t.map(e=>(0,Z.jsx)(R,{variant:`outline`,className:`text-[10px] py-0 h-4`,children:Ne[e]??e},e))})}function Fe({model:e}){let{toggleModel:t}=re();return(0,Z.jsx)(Y,{className:e.active?``:`opacity-70 bg-muted/30`,children:(0,Z.jsxs)(q,{className:`flex items-center gap-4 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-semibold`,children:e.name}),(0,Z.jsx)(R,{variant:`secondary`,className:`text-[10px]`,children:e.providerId||e.provider_id})]}),e.contextWindow&&(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(e.contextWindow/1e3).toFixed(0),`K tokens contexto`]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,children:(0,Z.jsx)(Pe,{capabilities:e.capabilities})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,Z.jsx)(W,{checked:!!e.active,onCheckedChange:n=>t(e.id,n)}),(0,Z.jsx)(R,{variant:e.active?`default`:`secondary`,className:`text-[10px]`,children:e.active?`Activo`:`Inactivo`})]})]})})}function Ie(e){if(!e)return[];if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Le(){let{availableModels:e,activeProviders:t}=I(),n=F(e=>e.fetchAll),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(`all`);(0,X.useEffect)(()=>{n(!0)},[n]);let s=(0,X.useMemo)(()=>e.filter(e=>{let t=Ie(e.capabilities),n=t.includes(`vision`)||t.includes(`image_generation`)||t.includes(`ocr`),i=e.name.toLowerCase().includes(r.toLowerCase())||e.id.toLowerCase().includes(r.toLowerCase()),o=a===`all`||e.providerId===a||e.provider_id===a;return n&&i&&o}),[e,r,a]);return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Modelos de Imagen / Vision`})}),(0,Z.jsx)(R,{variant:`secondary`,children:s.length})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Estos modelos pueden procesar imagenes y documentos visuales. Si el agente usa uno de estos modelos, las imagenes se envian directamente. Si no, se usa OCR para extraer el texto.`}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(S,{className:`absolute left-2 top-2 h-4 w-4 text-muted-foreground`}),(0,Z.jsx)(A,{placeholder:`Buscar modelo...`,className:`h-8 pl-8 text-sm`,value:r,onChange:e=>i(e.target.value)})]}),(0,Z.jsxs)(he,{value:a,onValueChange:o,children:[(0,Z.jsx)(pe,{className:`h-8 w-40 text-sm`,children:(0,Z.jsx)(me,{placeholder:`Provider`})}),(0,Z.jsxs)(fe,{children:[(0,Z.jsx)(U,{value:`all`,children:`Todos`}),t.map(e=>(0,Z.jsx)(U,{value:e.id,children:e.name},e.id))]})]})]}),(0,Z.jsx)(z,{className:`h-[calc(100vh-26rem)]`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[s.map(e=>(0,Z.jsx)(Fe,{model:e},e.id)),s.length===0&&(0,Z.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,Z.jsx)(u,{className:`h-8 w-8 mx-auto mb-2 text-muted-foreground`}),(0,Z.jsx)(`p`,{children:`No hay modelos con capacidad de vision.`}),(0,Z.jsx)(`p`,{className:`text-xs mt-1`,children:`Habilita modelos con capability "vision" en la tab Providers.`})]})]})})]})}var Re=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,Z.jsx)(`table`,{ref:n,className:E(`w-full caption-bottom text-sm`,e),...t})}));Re.displayName=`Table`;var ze=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`thead`,{ref:n,className:E(`[&_tr]:border-b`,e),...t}));ze.displayName=`TableHeader`;var Be=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`tbody`,{ref:n,className:E(`[&_tr:last-child]:border-0`,e),...t}));Be.displayName=`TableBody`;var Ve=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`tfoot`,{ref:n,className:E(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,e),...t}));Ve.displayName=`TableFooter`;var He=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`tr`,{ref:n,className:E(`border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50`,e),...t}));He.displayName=`TableRow`;var Q=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`th`,{ref:n,className:E(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,e),...t}));Q.displayName=`TableHead`;var $=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`td`,{ref:n,className:E(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,e),...t}));$.displayName=`TableCell`;var Ue=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`caption`,{ref:n,className:E(`mt-4 text-sm text-muted-foreground`,e),...t}));Ue.displayName=`TableCaption`;function We({open:e,onOpenChange:t}){let{availableTTSModels:n,fetchAvailableTTSModels:i,downloadTTSModel:a,isDownloadingModel:o,downloadLogs:s,fetchDownloadLogs:l}=M(),[u,d]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&f()},[e]);let f=async()=>{d(!0),await i(),d(!1)},m=async e=>{await a(e)},h=e=>{switch(e){case`high`:return`bg-green-500/20 text-green-400 border-green-500/30`;case`medium`:return`bg-yellow-500/20 text-yellow-400 border-yellow-500/30`;case`low`:return`bg-zinc-500/20 text-zinc-400 border-zinc-500/30`}};return(0,Z.jsx)(de,{open:e,onOpenChange:t,children:(0,Z.jsxs)(le,{className:`max-w-3xl max-h-[80vh] overflow-hidden flex flex-col`,children:[(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(ue,{className:`flex items-center gap-2`,children:`📦 Gestionar Modelos TTS`}),(0,Z.jsx)(V,{children:`Descarga modelos de voz adicionales para Piper TTS. Cada modelo incluye el archivo de voz (.onnx) y su configuración (.json).`})]}),(0,Z.jsxs)(`div`,{className:`flex-1 overflow-auto mt-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsxs)(R,{variant:`outline`,children:[n.filter(e=>e.installed).length,` / `,n.length,` instalados`]})}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:f,disabled:u||o,className:`gap-2`,children:[(0,Z.jsx)(x,{className:`h-4 w-4 ${u?`animate-spin`:``}`}),`Actualizar`]})]}),u&&!n.length?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Z.jsx)(p,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):n.length===0?(0,Z.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No hay modelos disponibles`}):(0,Z.jsxs)(Re,{children:[(0,Z.jsx)(ze,{children:(0,Z.jsxs)(He,{children:[(0,Z.jsx)(Q,{children:`Modelo`}),(0,Z.jsx)(Q,{children:`Idioma`}),(0,Z.jsx)(Q,{children:`Calidad`}),(0,Z.jsx)(Q,{children:`Tamaño`}),(0,Z.jsx)(Q,{children:`Estado`}),(0,Z.jsx)(Q,{className:`text-right`,children:`Acciones`})]})}),(0,Z.jsx)(Be,{children:n.map(e=>(0,Z.jsxs)(He,{children:[(0,Z.jsx)($,{className:`font-medium`,children:e.name}),(0,Z.jsx)($,{children:e.language}),(0,Z.jsx)($,{children:(0,Z.jsx)(R,{className:h(e.quality),children:e.quality})}),(0,Z.jsx)($,{className:`text-muted-foreground`,children:e.size}),(0,Z.jsx)($,{children:e.installed?(0,Z.jsxs)(R,{className:`bg-green-500/20 text-green-400 border-green-500/30 gap-1`,children:[(0,Z.jsx)(r,{className:`h-3 w-3`}),`Instalado`]}):o&&s.some(t=>t.includes(e.name))?(0,Z.jsxs)(R,{className:`bg-blue-500/20 text-blue-400 border-blue-500/30 gap-1`,children:[(0,Z.jsx)(p,{className:`h-3 w-3 animate-spin`}),`Descargando`]}):(0,Z.jsx)(R,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400`,children:`No instalado`})}),(0,Z.jsx)($,{className:`text-right`,children:e.installed?(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,disabled:!0,className:`gap-2 opacity-50`,children:[(0,Z.jsx)(r,{className:`h-4 w-4`}),`Instalado`]}):(0,Z.jsxs)(N,{size:`sm`,onClick:()=>m(e.id),disabled:o,className:`gap-2`,children:[(0,Z.jsx)(c,{className:`h-4 w-4`}),`Descargar`]})})]},e.id))})]}),s.length>0&&(0,Z.jsxs)(`div`,{className:`mt-4`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium mb-2`,children:`Progreso de descarga:`}),(0,Z.jsx)(`div`,{className:`bg-black/40 rounded-md border border-zinc-700/50 p-3 h-32 overflow-y-auto font-mono text-xs text-zinc-300`,children:s.map((e,t)=>(0,Z.jsx)(`div`,{className:e.startsWith(`[error]`)?`text-red-400`:e.startsWith(`✓`)?`text-green-400`:``,children:e},t))})]})]})]})})}function Ge(){let{localTTS:e,fetchLocalTTSStatus:t,installLocalTTS:n,startLocalTTS:r,stopLocalTTS:i}=M(),[a,o]=(0,X.useState)(!1),[s,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)([]),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(!1),g=(0,X.useRef)(null),_=(0,X.useRef)(null);(0,X.useEffect)(()=>{t()},[t]),(0,X.useEffect)(()=>(e.installing?g.current=setInterval(()=>{t(),s&&b()},3e3):g.current&&clearInterval(g.current),()=>{g.current&&clearInterval(g.current)}),[e.installing,s,t]),(0,X.useEffect)(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[u]);let b=async()=>{try{let e=await ne(`/api/tts-local/logs`);d(e.logs),p(e.ttsRoot)}catch{}},S=async()=>{o(!0),l(!0);try{await n(),await b()}finally{o(!1)}},C=async()=>{o(!0);try{await r()}finally{o(!1)}},w=async()=>{o(!0);try{await i()}finally{o(!1)}},E=async()=>{l(e=>!e),s||await b()},{installed:D,running:O,piperExists:k,voiceExists:A,port:j}=e,P=e.installing;return(0,Z.jsxs)(Y,{className:`relative overflow-hidden col-span-full ${O?`border-blue-500/30 bg-blue-500/[0.02]`:``}`,children:[(0,Z.jsx)(K,{children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between flex-wrap gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-3xl`,children:`🎙️`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(G,{className:`text-lg flex items-center gap-2`,children:[`Piper TTS`,(0,Z.jsx)(R,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-normal border-zinc-600 text-zinc-400`,children:`Local · Offline`})]}),(0,Z.jsx)(J,{className:`text-xs`,children:`TTS sin internet — binario nativo, sin Python, sin Docker. Fallback cuando no hay providers online.`})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[P?(0,Z.jsxs)(R,{className:`bg-yellow-500/20 text-yellow-400 border-yellow-500/30 gap-1`,children:[(0,Z.jsx)(x,{className:`h-3 w-3 animate-spin`}),`Instalando…`]}):D?(0,Z.jsx)(R,{className:`bg-green-500/20 text-green-400 border-green-500/30`,children:`Instalado`}):(0,Z.jsx)(R,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400`,children:`No instalado`}),D&&(O?(0,Z.jsxs)(R,{className:`bg-blue-500/20 text-blue-400 border-blue-500/30 gap-1`,children:[(0,Z.jsx)(T,{className:`h-3 w-3`}),`Servidor :`,j]}):(0,Z.jsxs)(R,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400 gap-1`,children:[(0,Z.jsx)(te,{className:`h-3 w-3`}),`Detenido`]}))]})]})}),(0,Z.jsxs)(q,{className:`space-y-4`,children:[!D&&!P&&(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 ${k?`text-green-400`:``}`,children:[(0,Z.jsx)(`span`,{children:k?`✓`:`○`}),` Binario Piper (~8 MB)`]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 ${A?`text-green-400`:``}`,children:[(0,Z.jsx)(`span`,{children:A?`✓`:`○`}),` Voz española (~60 MB)`]})]}),D&&(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Voz: `,(0,Z.jsx)(`code`,{className:`text-zinc-300`,children:e.voices?.[0]||`N/A`}),` · Puerto:`,` `,(0,Z.jsx)(`code`,{className:`text-zinc-300`,children:j}),` · Configurable con`,` `,(0,Z.jsx)(`code`,{className:`text-zinc-300`,children:`TTS_PORT`}),` / `,(0,Z.jsx)(`code`,{className:`text-zinc-300`,children:`TTS_VOICE`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!D&&!P&&(0,Z.jsxs)(N,{size:`sm`,onClick:S,disabled:a,className:`gap-2`,children:[(0,Z.jsx)(c,{className:`h-3.5 w-3.5`}),`Instalar Piper (~68 MB)`]}),P&&(0,Z.jsxs)(N,{size:`sm`,disabled:!0,className:`gap-2 opacity-70`,children:[(0,Z.jsx)(x,{className:`h-3.5 w-3.5 animate-spin`}),`Descargando…`]}),D&&!O&&(0,Z.jsxs)(N,{size:`sm`,onClick:C,disabled:a,className:`gap-2 bg-blue-600 hover:bg-blue-500 text-white`,children:[(0,Z.jsx)(y,{className:`h-3.5 w-3.5`}),`Iniciar servidor`]}),O&&(0,Z.jsxs)(N,{size:`sm`,variant:`outline`,onClick:w,disabled:a,className:`gap-2 border-red-500/40 text-red-400 hover:bg-red-500/10`,children:[(0,Z.jsx)(v,{className:`h-3.5 w-3.5`}),`Detener servidor`]}),D&&(0,Z.jsxs)(N,{size:`sm`,variant:`outline`,onClick:()=>h(!0),disabled:a,className:`gap-2`,children:[(0,Z.jsx)(ge,{className:`h-3.5 w-3.5`}),`Gestionar modelos`,e.voices&&e.voices.length>0&&(0,Z.jsx)(R,{variant:`secondary`,className:`ml-1 text-[10px] px-1`,children:e.voices.length})]}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:()=>t(),title:`Actualizar estado`,className:`text-zinc-400`,children:(0,Z.jsx)(x,{className:`h-3.5 w-3.5`})}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:E,className:`gap-1.5 text-zinc-400 text-xs`,children:[(0,Z.jsx)(ee,{className:`h-3.5 w-3.5`}),s?`Ocultar log`:`Ver log`]})]}),P&&(0,Z.jsx)(`p`,{className:`text-xs text-yellow-400/80`,children:`Descargando binario y modelo de voz… puede tardar 1-3 min. El estado se actualiza automáticamente.`}),s&&(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[f&&(0,Z.jsxs)(`p`,{className:`text-[10px] text-zinc-500 font-mono`,children:[`ruta: `,f]}),(0,Z.jsx)(`div`,{ref:_,className:`bg-black/40 rounded-md border border-zinc-700/50 p-3 h-40 overflow-y-auto font-mono text-[11px] text-zinc-300 leading-relaxed`,children:u.length===0?(0,Z.jsx)(`span`,{className:`text-zinc-600`,children:`Sin registros aún. Inicia la instalación para ver el progreso.`}):u.map((e,t)=>(0,Z.jsx)(`div`,{className:e.startsWith(`[stderr]`)||e.startsWith(`[error]`)?`text-red-400`:``,children:e},t))})]}),(0,Z.jsx)(We,{open:m,onOpenChange:h})]})]})}var Ke={groq:{logo:`🔴`,consoleUrl:`https://console.groq.com/keys`},elevenlabs:{logo:`🎙️`,consoleUrl:`https://elevenlabs.io/app/settings/api-keys`},openai:{logo:`🟢`,consoleUrl:`https://platform.openai.com/api-keys`},gemini:{logo:`🔵`,consoleUrl:`https://aistudio.google.com/app/apikey`},qwen:{logo:`🟣`,consoleUrl:`https://dashscope.console.aliyun.com/apiKey`},piper:{logo:`🖥️`}};function qe(){let{providers:e,availableModels:t,activeProviders:n}=I(),{voiceProviders:i,configuredVoiceProviders:a,fetchVoiceProviders:o,fetchConfiguredVoiceProviders:s,saveVoiceProviderKey:c}=L(),l=F(e=>e.fetchAll),[u,d]=(0,X.useState)(null),[p,g]=(0,X.useState)(``),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[C,ee]=(0,X.useState)(``),[w,te]=(0,X.useState)(`all`);(0,X.useEffect)(()=>{o(),s(),l(!0)},[o,s,l]);let T=async e=>{if(p.trim()){y(!0);try{await c(e,p.trim()),await s(),d(null),g(``)}catch(e){console.error(`Failed to save API key:`,e)}finally{y(!1)}}},E=t=>{let n=e.find(e=>e.id===t),r=(n?.models||[]).filter(e=>e.model_type===`stt`||e.model_type===`tts`),i=r.some(e=>e.model_type===`stt`),a=r.some(e=>e.model_type===`tts`),o=r.some(e=>Ie(e.capabilities).includes(`local`)),s=Ke[t]||{logo:`🔌`};return{name:n?.name||t,description:[i&&`STT (Speech-to-Text)`,a&&`TTS (Text-to-Speech)`].filter(Boolean).join(` / `),logo:s.logo,consoleUrl:s.consoleUrl,noApiKey:o}},D=i.filter(e=>!E(e).noApiKey),O=(0,X.useMemo)(()=>t.filter(e=>{let t=e.model_type===`stt`||e.model_type===`tts`,n=Ie(e.capabilities),r=n.includes(`transcription`)||n.includes(`tts`)||n.includes(`speech`),i=e.name.toLowerCase().includes(C.toLowerCase())||e.id.toLowerCase().includes(C.toLowerCase()),a=w===`all`||e.providerId===w||e.provider_id===w;return(t||r)&&i&&a}),[t,C,w]);return(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Modelos de Voz (STT / TTS)`}),(0,Z.jsx)(R,{variant:`secondary`,children:O.length})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(S,{className:`absolute left-2 top-2 h-4 w-4 text-muted-foreground`}),(0,Z.jsx)(A,{placeholder:`Buscar modelo...`,className:`h-8 pl-8 text-sm`,value:C,onChange:e=>ee(e.target.value)})]}),(0,Z.jsxs)(he,{value:w,onValueChange:te,children:[(0,Z.jsx)(pe,{className:`h-8 w-40 text-sm`,children:(0,Z.jsx)(me,{placeholder:`Provider`})}),(0,Z.jsxs)(fe,{children:[(0,Z.jsx)(U,{value:`all`,children:`Todos`}),n.map(e=>(0,Z.jsx)(U,{value:e.id,children:e.name},e.id))]})]})]}),(0,Z.jsx)(z,{className:`h-60`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[O.map(e=>(0,Z.jsx)(Fe,{model:e},e.id)),O.length===0&&(0,Z.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,Z.jsx)(_,{className:`h-8 w-8 mx-auto mb-2 text-muted-foreground`}),(0,Z.jsx)(`p`,{children:`No hay modelos de voz disponibles.`})]})]})})]}),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold`,children:`API Keys de Voz`}),(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(Ge,{}),D.map(e=>{let t=E(e),n=a[e]===!0,i=u===e;return(0,Z.jsxs)(Y,{className:`relative overflow-hidden ${n?`border-green-500/30 bg-green-500/[0.02]`:``}`,children:[(0,Z.jsx)(K,{children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-3xl`,children:t.logo}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(G,{className:`text-lg`,children:t.name}),(0,Z.jsx)(J,{className:`text-xs`,children:t.description})]})]}),t.noApiKey?(0,Z.jsx)(R,{variant:`outline`,className:`bg-zinc-700/40 text-zinc-300 border-zinc-600`,children:`Sin API key`}):n?(0,Z.jsxs)(R,{variant:`default`,className:`bg-green-500/20 text-green-400 border-green-500/30`,children:[(0,Z.jsx)(r,{className:`h-3 w-3 mr-1`}),`Configurado`]}):(0,Z.jsx)(R,{variant:`secondary`,className:`bg-yellow-500/20 text-yellow-400 border-yellow-500/30`,children:`Sin configurar`})]})}),(0,Z.jsx)(q,{className:`space-y-4`,children:t.noApiKey?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.description}):i?(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(H,{htmlFor:`api-key-${e}`,children:`API Key`}),(0,Z.jsxs)(`div`,{className:`flex gap-2 mt-1`,children:[(0,Z.jsx)(A,{id:`api-key-${e}`,type:b?`text`:`password`,placeholder:`sk-...`,value:p,onChange:e=>g(e.target.value),className:`flex-1 font-mono text-sm`,autoFocus:!0}),(0,Z.jsx)(N,{variant:`outline`,size:`icon`,onClick:()=>x(!b),title:b?`Ocultar`:`Mostrar`,children:b?(0,Z.jsx)(h,{className:`h-4 w-4`}):(0,Z.jsx)(m,{className:`h-4 w-4`})})]})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(N,{size:`sm`,onClick:()=>T(e),disabled:v||!p.trim(),className:`flex-1`,children:v?`Guardando...`:`Guardar`}),(0,Z.jsx)(N,{size:`sm`,variant:`outline`,onClick:()=>{d(null),g(``)},children:`Cancelar`})]})]}):(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[n?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(f,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{children:`API key guardada de forma segura (encriptada)`})]}):(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Necesitas una API key de `,t.name,` para usar esta funcionalidad.`]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[n?(0,Z.jsxs)(N,{size:`sm`,variant:`outline`,onClick:()=>{d(e),g(``)},className:`flex-1`,children:[(0,Z.jsx)(f,{className:`h-3 w-3 mr-2`}),`Actualizar API Key`]}):(0,Z.jsxs)(N,{size:`sm`,onClick:()=>{d(e),g(``)},className:`flex-1`,children:[(0,Z.jsx)(f,{className:`h-3 w-3 mr-2`}),`Configurar API Key`]}),t.consoleUrl&&(0,Z.jsx)(N,{size:`sm`,variant:`outline`,onClick:()=>window.open(t.consoleUrl,`_blank`),children:`Obtener Key`})]})]})})]},e)})]})]}),(0,Z.jsxs)(Y,{children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(G,{className:`text-lg`,children:`Como funciona?`}),(0,Z.jsx)(J,{children:`Configura las API keys de los providers de voz para habilitar STT y TTS en tus canales.`})]}),(0,Z.jsxs)(q,{className:`space-y-4 text-sm text-muted-foreground`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`strong`,{className:`text-foreground`,children:`STT (Speech-to-Text):`}),` Convierte el audio entrante en texto. Groq Whisper es recomendado por su velocidad.`]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`strong`,{className:`text-foreground`,children:`TTS (Text-to-Speech):`}),` Convierte las respuestas de texto en audio. ElevenLabs ofrece las voces mas naturales.`]}),(0,Z.jsx)(`div`,{className:`pt-2 border-t`,children:(0,Z.jsx)(`p`,{className:`text-xs`,children:`Las API keys se guardan encriptadas en la base de datos local de Hive.`})})]})]})]})}var Je=b,Ye=u,Xe=_,Ze=j;function Qe(){let{providers:e,createProvider:t}=I(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(`providers`);return(0,Z.jsxs)(`div`,{className:`space-y-4 mt-6 sm:mt-10`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,Z.jsx)(`div`,{className:`hive-page-header__dot`}),(0,Z.jsx)(`span`,{className:`hive-page-header__label`,children:`INFRAESTRUCTURA`})]}),(0,Z.jsxs)(`h2`,{className:`hive-title-page`,children:[`Providers de IA`,(0,Z.jsx)(`span`,{className:`hive-title-page__accent`,children:`.`})]})]}),(0,Z.jsxs)(de,{open:n,onOpenChange:e=>{r(e)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(`button`,{className:`hive-btn hive-btn--primary`,children:[(0,Z.jsx)(Je,{className:`mr-1 h-4 w-4`}),`Añadir Provider`]})}),(0,Z.jsxs)(le,{className:`max-w-md`,children:[(0,Z.jsxs)(ce,{className:`p-6 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,Z.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--blue -top-10 -right-10 h-32 w-32 opacity-20`}),(0,Z.jsx)(ue,{className:`text-xl font-black text-white uppercase tracking-tighter`,children:`Añadir Provider`}),(0,Z.jsx)(V,{className:`text-xs text-white/40 font-medium mt-1`,children:`Crea un nuevo provider de IA para tu infraestructura.`})]}),(0,Z.jsx)(`div`,{className:`p-6`,children:(0,Z.jsx)(Me,{onSave:async e=>{try{await t({id:e.id,name:e.name,base_url:e.baseUrl,api_key:e.apiKey,headers:e.headers,num_ctx:e.numCtx}),r(!1)}catch(e){console.error(`Error creating provider:`,e)}},onCancel:()=>r(!1)})})]})]})]}),(0,Z.jsxs)(oe,{value:i,onValueChange:a,className:`w-full`,children:[(0,Z.jsxs)(ae,{className:`w-full grid grid-cols-3 h-10`,children:[(0,Z.jsxs)(B,{value:`providers`,className:`gap-1.5 text-xs`,children:[(0,Z.jsx)(Ze,{className:`h-3.5 w-3.5`}),`Providers`]}),(0,Z.jsxs)(B,{value:`vision`,className:`gap-1.5 text-xs`,children:[(0,Z.jsx)(Ye,{className:`h-3.5 w-3.5`}),`Imagen`]}),(0,Z.jsxs)(B,{value:`voice`,className:`gap-1.5 text-xs`,children:[(0,Z.jsx)(Xe,{className:`h-3.5 w-3.5`}),`Voz`]})]}),(0,Z.jsx)(ie,{value:`providers`,className:`mt-4`,children:(0,Z.jsx)(je,{})}),(0,Z.jsx)(ie,{value:`vision`,className:`mt-4`,children:(0,Z.jsx)(Le,{})}),(0,Z.jsx)(ie,{value:`voice`,className:`mt-4`,children:(0,Z.jsx)(qe,{})})]})]})}export{Qe as ProvidersPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-Bejlp-R1.js";var t=e(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]);export{t};
|