@johpaz/hive-agents 0.0.37 → 0.0.38
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 +16 -16
- package/dist/hive.js +107 -105
- package/dist/tool-worker.js +25 -36
- package/dist/ui/assets/{AgentCreateForm-tJZv9FZC.js → AgentCreateForm-0oFbN3gj.js} +1 -1
- package/dist/ui/assets/{AgentDetailPage-Du-mRcAX.js → AgentDetailPage-BJ4L2fNJ.js} +1 -1
- package/dist/ui/assets/AgentNewPage-B3n0LUck.js +1 -0
- package/dist/ui/{dist/assets/AgentsPage-YvSgWRiw.js → assets/AgentsPage-DGNLDXjR.js} +1 -1
- package/dist/ui/assets/{CanvasPage-DtMwGvxf.js → CanvasPage-CnMO1FN8.js} +1 -1
- package/dist/ui/assets/{ChannelsPage-BdBXWHjj.js → ChannelsPage-fbF8K4MR.js} +1 -1
- package/dist/ui/{dist/assets/DashboardPage-ghl1ZguH.js → assets/DashboardPage-VyXXp3U1.js} +1 -1
- package/dist/ui/assets/{LoginPage-CAmSI9Vy.js → LoginPage-DPj2s2Qq.js} +1 -1
- package/dist/ui/{dist/assets/LogsPage-DAPBHkwK.js → assets/LogsPage-B2lY9maY.js} +1 -1
- package/dist/ui/{dist/assets/MeetingPage-WjjGOqqU.js → assets/MeetingPage-2ky_hKiG.js} +1 -1
- package/dist/ui/{dist/assets/ProvidersPage-Ct6HsAi1.js → assets/ProvidersPage-CEyUM2tD.js} +1 -1
- package/dist/ui/{dist/assets/RecoverPage-DpW3l-yv.js → assets/RecoverPage-B-hDZUM2.js} +1 -1
- package/dist/ui/{dist/assets/SettingsPage-DBJ7_E6C.js → assets/SettingsPage-eO0i3g8p.js} +1 -1
- package/dist/ui/assets/{SetupPage-DKmLVUaj.js → SetupPage-ByYqTELb.js} +1 -1
- package/dist/ui/assets/WebChatPage-BuGT2AL0.js +16 -0
- package/dist/ui/assets/{alert-C-NE-P3s.js → alert-Bq6awLlW.js} +1 -1
- package/dist/ui/{dist/assets/alert-dialog-C5mzbHdP.js → assets/alert-dialog-DQvltYmf.js} +1 -1
- package/dist/ui/assets/{badge-ChpACfWO.js → badge-DXUDdTed.js} +1 -1
- package/dist/ui/assets/{dialog-QnZ0ad8O.js → dialog-bI9jImCS.js} +1 -1
- package/dist/ui/assets/{es-NQNoaWDx.js → es-Cg8zdT52.js} +1 -1
- package/dist/ui/{dist/assets/index-DMCjjdqf.js → assets/index-CQ7fn00w.js} +2 -2
- package/dist/ui/assets/{label-D2H1IR_J.js → label-CrH0Jj3v.js} +1 -1
- package/dist/ui/assets/useProviders-CnlC_qCS.js +1 -0
- package/dist/ui/dist/assets/{AgentCreateForm-tJZv9FZC.js → AgentCreateForm-0oFbN3gj.js} +1 -1
- package/dist/ui/dist/assets/{AgentDetailPage-Du-mRcAX.js → AgentDetailPage-BJ4L2fNJ.js} +1 -1
- package/dist/ui/dist/assets/AgentNewPage-B3n0LUck.js +1 -0
- package/dist/ui/{assets/AgentsPage-YvSgWRiw.js → dist/assets/AgentsPage-DGNLDXjR.js} +1 -1
- package/dist/ui/dist/assets/{CanvasPage-DtMwGvxf.js → CanvasPage-CnMO1FN8.js} +1 -1
- package/dist/ui/dist/assets/{ChannelsPage-BdBXWHjj.js → ChannelsPage-fbF8K4MR.js} +1 -1
- package/dist/ui/{assets/DashboardPage-ghl1ZguH.js → dist/assets/DashboardPage-VyXXp3U1.js} +1 -1
- package/dist/ui/dist/assets/{LoginPage-CAmSI9Vy.js → LoginPage-DPj2s2Qq.js} +1 -1
- package/dist/ui/{assets/LogsPage-DAPBHkwK.js → dist/assets/LogsPage-B2lY9maY.js} +1 -1
- package/dist/ui/{assets/MeetingPage-WjjGOqqU.js → dist/assets/MeetingPage-2ky_hKiG.js} +1 -1
- package/dist/ui/{assets/ProvidersPage-Ct6HsAi1.js → dist/assets/ProvidersPage-CEyUM2tD.js} +1 -1
- package/dist/ui/{assets/RecoverPage-DpW3l-yv.js → dist/assets/RecoverPage-B-hDZUM2.js} +1 -1
- package/dist/ui/{assets/SettingsPage-DBJ7_E6C.js → dist/assets/SettingsPage-eO0i3g8p.js} +1 -1
- package/dist/ui/dist/assets/{SetupPage-DKmLVUaj.js → SetupPage-ByYqTELb.js} +1 -1
- package/dist/ui/dist/assets/WebChatPage-BuGT2AL0.js +16 -0
- package/dist/ui/dist/assets/{alert-C-NE-P3s.js → alert-Bq6awLlW.js} +1 -1
- package/dist/ui/{assets/alert-dialog-C5mzbHdP.js → dist/assets/alert-dialog-DQvltYmf.js} +1 -1
- package/dist/ui/dist/assets/{badge-ChpACfWO.js → badge-DXUDdTed.js} +1 -1
- package/dist/ui/dist/assets/{dialog-QnZ0ad8O.js → dialog-bI9jImCS.js} +1 -1
- package/dist/ui/dist/assets/{es-NQNoaWDx.js → es-Cg8zdT52.js} +1 -1
- package/dist/ui/{assets/index-DMCjjdqf.js → dist/assets/index-CQ7fn00w.js} +2 -2
- package/dist/ui/dist/assets/{label-D2H1IR_J.js → label-CrH0Jj3v.js} +1 -1
- package/dist/ui/dist/assets/useProviders-CnlC_qCS.js +1 -0
- package/dist/ui/dist/index.html +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/packages/cli/src/commands/gateway.ts +1 -1
- package/packages/cli/src/commands/onboard.ts +1 -1
- package/packages/core/src/agent/agent-loop.ts +4 -14
- package/packages/core/src/agent/context-compiler.ts +1 -1
- package/packages/core/src/agent/conversation-store.ts +4 -5
- package/packages/core/src/agent/providers/index.ts +3 -4
- package/packages/core/src/agent/tool-selector.ts +3 -4
- package/packages/core/src/gateway/resolver.ts +5 -1
- package/packages/core/src/gateway/routes/chat.ts +16 -16
- package/packages/core/src/gateway/server.ts +44 -45
- package/packages/core/src/storage/seed.ts +39 -33
- package/packages/core/src/tool-runtime/index.ts +20 -0
- package/dist/ui/assets/AgentNewPage-DIFYd_Ys.js +0 -1
- package/dist/ui/assets/WebChatPage-CVRcKept.js +0 -16
- package/dist/ui/assets/useProviders-C6_QHsEi.js +0 -1
- package/dist/ui/dist/assets/AgentNewPage-DIFYd_Ys.js +0 -1
- package/dist/ui/dist/assets/WebChatPage-CVRcKept.js +0 -16
- package/dist/ui/dist/assets/useProviders-C6_QHsEi.js +0 -1
package/dist/tool-worker.js
CHANGED
|
@@ -52936,7 +52936,7 @@ function getRecentMessages(threadId, n) {
|
|
|
52936
52936
|
const db = getDb();
|
|
52937
52937
|
const rows = db.query(`
|
|
52938
52938
|
SELECT * FROM conversations
|
|
52939
|
-
WHERE thread_id = ?
|
|
52939
|
+
WHERE thread_id = ? AND role != 'tool'
|
|
52940
52940
|
ORDER BY id DESC
|
|
52941
52941
|
LIMIT ?
|
|
52942
52942
|
`).all(threadId, n);
|
|
@@ -52981,13 +52981,6 @@ function toAPIMessages(rows) {
|
|
|
52981
52981
|
} catch {}
|
|
52982
52982
|
}
|
|
52983
52983
|
const msg = { role: r.role, content };
|
|
52984
|
-
if (r.tool_calls_json) {
|
|
52985
|
-
try {
|
|
52986
|
-
msg.tool_calls = JSON.parse(r.tool_calls_json);
|
|
52987
|
-
} catch {}
|
|
52988
|
-
}
|
|
52989
|
-
if (r.tool_call_id)
|
|
52990
|
-
msg.tool_call_id = r.tool_call_id;
|
|
52991
52984
|
if (r.reasoning_content)
|
|
52992
52985
|
msg.reasoning_content = r.reasoning_content;
|
|
52993
52986
|
return msg;
|
|
@@ -53506,10 +53499,10 @@ var init_emitter = __esm(() => {
|
|
|
53506
53499
|
});
|
|
53507
53500
|
|
|
53508
53501
|
// packages/core/src/agent/tool-selector.ts
|
|
53509
|
-
function mcpToolFullName(
|
|
53502
|
+
function mcpToolFullName(serverName, toolName) {
|
|
53510
53503
|
const safe = (s2) => s2.replace(/\s+/g, "_").replace(/[^a-zA-Z0-9_\-]/g, "_");
|
|
53511
|
-
const
|
|
53512
|
-
const trimmed =
|
|
53504
|
+
const full = `${safe(serverName)}__${safe(toolName)}`;
|
|
53505
|
+
const trimmed = full.length > 64 ? full.substring(0, 64) : full;
|
|
53513
53506
|
return /^[a-zA-Z_]/.test(trimmed) ? trimmed : `_${trimmed}`.substring(0, 64);
|
|
53514
53507
|
}
|
|
53515
53508
|
var log39, STOPWORDS;
|
|
@@ -56033,14 +56026,6 @@ var init_seed = __esm(() => {
|
|
|
56033
56026
|
{ id: "browser_extract", name: "browser_extract", category: "web", description: "Extraer texto, enlaces o datos estructurados usando selectores CSS o XPath. Sin\xF3nimos: obtener datos, scraping, selectores, extraer informaci\xF3n" },
|
|
56034
56027
|
{ id: "browser_script", name: "browser_script", category: "web", description: "Ejecutar JavaScript arbitrario en el navegador y obtener resultado. Sin\xF3nimos: ejecutar javascript, script, c\xF3digo, funci\xF3n, evaluar" },
|
|
56035
56028
|
{ id: "browser_wait", name: "browser_wait", category: "web", description: "Esperar a que aparezca un elemento o se cumpla una condici\xF3n. Sin\xF3nimos: esperar, condici\xF3n, elemento, selector, pausa" },
|
|
56036
|
-
{ id: "project_create", name: "project_create", category: "projects", description: "Crear un nuevo proyecto con tareas en la base de datos. Sin\xF3nimos: nuevo proyecto, iniciar plan, crear proyecto" },
|
|
56037
|
-
{ id: "project_list", name: "project_list", category: "projects", description: "Listar todos los proyectos con su estado. Sin\xF3nimos: ver proyectos, historial, listar proyectos, mostrar proyectos" },
|
|
56038
|
-
{ id: "project_update", name: "project_update", category: "projects", description: "Actualizar progreso o metadatos del proyecto. Sin\xF3nimos: avance, porcentaje, estado, actualizar proyecto" },
|
|
56039
|
-
{ id: "project_done", name: "project_done", category: "projects", description: "Marcar proyecto como completado y archivarlo. Sin\xF3nimos: proyecto terminado, cerrar proyecto, completado, finalizar" },
|
|
56040
|
-
{ id: "project_fail", name: "project_fail", category: "projects", description: "Marcar proyecto como fallido y registrar raz\xF3n. Sin\xF3nimos: proyecto fallido, marcar fracaso, error, fall\xF3 proyecto" },
|
|
56041
|
-
{ id: "task_create", name: "task_create", category: "projects", description: "Agregar una tarea o subtarea a un proyecto existente. Sin\xF3nimos: crear tarea, agregar tarea, subtarea, pendiente" },
|
|
56042
|
-
{ id: "task_update", name: "task_update", category: "projects", description: "Actualizar estado de tarea (pendiente, en_progreso, hecho). Sin\xF3nimos: actualizar tarea, marcar completa, en progreso" },
|
|
56043
|
-
{ id: "task_evaluate", name: "task_evaluate", category: "projects", description: "Evaluar resultado de tarea contra criterios de aceptaci\xF3n. Sin\xF3nimos: validar resultado, criterios de aceptaci\xF3n, revisar tarea" },
|
|
56044
56029
|
{ id: "cron.create", name: "cron.create", category: "cron", description: "Crear tarea programada: recurrente (expresi\xF3n cron) o \xFAnica (fire_at). Requiere campo 'task' con instrucci\xF3n para el agente. Sin\xF3nimos: programar tarea, crear recordatorio, agendar, automatizar horario, tarea recurrente, una vez" },
|
|
56045
56030
|
{ id: "cron.list", name: "cron.list", category: "cron", description: "Listar todas las tareas programadas con pr\xF3ximos horarios de ejecuci\xF3n. Sin\xF3nimos: ver tareas programadas, listar cronograma, pr\xF3ximas ejecuciones" },
|
|
56046
56031
|
{ id: "cron.update", name: "cron.update", category: "cron", description: "Actualizar tarea programada existente: cambiar expresi\xF3n, instrucci\xF3n, canal, ventana temporal. Sin\xF3nimos: modificar cron, editar recordatorio, cambiar horario, actualizar tarea" },
|
|
@@ -56064,7 +56049,6 @@ var init_seed = __esm(() => {
|
|
|
56064
56049
|
{ id: "task_status", name: "task_status", category: "agents", description: "Obtener estado de ejecuci\xF3n de tareas delegadas. Sin\xF3nimos: estado tarea delegada, verificar progreso, consultar tarea" },
|
|
56065
56050
|
{ id: "bus_publish", name: "bus_publish", category: "agents", description: "Publicar mensaje en el Agent Bus para comunicaci\xF3n worker-to-worker. Sin\xF3nimos: publicar mensaje, comunicar workers, enviar bus" },
|
|
56066
56051
|
{ id: "bus_read", name: "bus_read", category: "agents", description: "Leer mensajes no le\xEDdos del Agent Bus. Sin\xF3nimos: leer mensajes bus, recibir mensajes, verificar bus" },
|
|
56067
|
-
{ id: "project_updates", name: "project_updates", category: "agents", description: "Obtener actualizaciones recientes de workers en el mismo proyecto. Sin\xF3nimos: actualizaciones proyecto, estado workers, progreso equipo" },
|
|
56068
56052
|
{ id: "canvas_render", name: "canvas_render", category: "canvas", description: "Renderizar un componente o visualizaci\xF3n en el canvas. Sin\xF3nimos: renderizar, visualizar, gr\xE1fico, diagrama" },
|
|
56069
56053
|
{ id: "canvas_ask", name: "canvas_ask", category: "canvas", description: "Mostrar formulario interactivo y esperar input del usuario. Sin\xF3nimos: formulario interactivo, preguntar usuario, input" },
|
|
56070
56054
|
{ id: "canvas_confirm", name: "canvas_confirm", category: "canvas", description: "Mostrar di\xE1logo de confirmaci\xF3n antes de ejecutar una acci\xF3n. Sin\xF3nimos: confirmar acci\xF3n, di\xE1logo, aprobar" },
|
|
@@ -56259,9 +56243,9 @@ Estos lineamientos tienen M\xC1XIMA prioridad sobre cualquier otra instrucci\xF3
|
|
|
56259
56243
|
applicable_to: JSON.stringify(["code", "development"])
|
|
56260
56244
|
},
|
|
56261
56245
|
{
|
|
56262
|
-
rule: "Al
|
|
56246
|
+
rule: "Al delegar trabajo complejo a workers, divide el objetivo en pasos at\xF3micos que puedan ejecutarse independientemente",
|
|
56263
56247
|
category: "agent_creation",
|
|
56264
|
-
applicable_to: JSON.stringify(["
|
|
56248
|
+
applicable_to: JSON.stringify(["delegation", "workers", "tasks"])
|
|
56265
56249
|
},
|
|
56266
56250
|
{
|
|
56267
56251
|
rule: "Guarda las preferencias importantes del usuario en el scratchpad usando la herramienta save_note para persistencia entre sesiones",
|
|
@@ -56907,7 +56891,7 @@ Focus ONLY on this task. Do not deviate.`;
|
|
|
56907
56891
|
skills: allSkills
|
|
56908
56892
|
};
|
|
56909
56893
|
}
|
|
56910
|
-
var log46, KEEP_LAST_N_MESSAGES2 =
|
|
56894
|
+
var log46, KEEP_LAST_N_MESSAGES2 = 30, DEFAULT_CONTEXT_WINDOW = 250000, COMPACT_RATIO = 0.8, MAX_SYSTEM_PROMPT_CHARS_CAP = 128000, MINIMAL_TOOLS, MINIMAL_SKILL_NAMES2;
|
|
56911
56895
|
var init_context_compiler = __esm(() => {
|
|
56912
56896
|
init_sqlite();
|
|
56913
56897
|
init_logger();
|
|
@@ -57254,6 +57238,24 @@ var DEFAULT_MAIN_THREAD_TOOL_NAMES, sharedPool = null, sharedPoolSize = 0;
|
|
|
57254
57238
|
var init_tool_runtime = __esm(() => {
|
|
57255
57239
|
init_loader();
|
|
57256
57240
|
DEFAULT_MAIN_THREAD_TOOL_NAMES = new Set([
|
|
57241
|
+
"search_knowledge",
|
|
57242
|
+
"save_note",
|
|
57243
|
+
"memory_write",
|
|
57244
|
+
"memory_read",
|
|
57245
|
+
"memory_list",
|
|
57246
|
+
"memory_search",
|
|
57247
|
+
"memory_delete",
|
|
57248
|
+
"agent_create",
|
|
57249
|
+
"agent_find",
|
|
57250
|
+
"agent_archive",
|
|
57251
|
+
"task_status",
|
|
57252
|
+
"bus_publish",
|
|
57253
|
+
"bus_read",
|
|
57254
|
+
"get_available_models",
|
|
57255
|
+
"meeting_start",
|
|
57256
|
+
"meeting_add_segment",
|
|
57257
|
+
"meeting_stop",
|
|
57258
|
+
"meeting_report",
|
|
57257
57259
|
"browser_navigate",
|
|
57258
57260
|
"browser_screenshot",
|
|
57259
57261
|
"browser_click",
|
|
@@ -57379,13 +57381,6 @@ async function* runAgent(opts) {
|
|
|
57379
57381
|
tool_calls: response.tool_calls,
|
|
57380
57382
|
reasoning_content: response.reasoning_content
|
|
57381
57383
|
});
|
|
57382
|
-
if (!opts.isolated) {
|
|
57383
|
-
addMessage(opts.threadId, "assistant", response.content || "", {
|
|
57384
|
-
channel: opts.channel,
|
|
57385
|
-
tool_calls: response.tool_calls,
|
|
57386
|
-
reasoning_content: response.reasoning_content
|
|
57387
|
-
});
|
|
57388
|
-
}
|
|
57389
57384
|
for (const tc of response.tool_calls) {
|
|
57390
57385
|
const toolName = tc.function.name;
|
|
57391
57386
|
emitCanvas("canvas:node_update", {
|
|
@@ -57449,12 +57444,6 @@ async function* runAgent(opts) {
|
|
|
57449
57444
|
content: toolResultLLM,
|
|
57450
57445
|
tool_call_id: tc.id
|
|
57451
57446
|
});
|
|
57452
|
-
if (!opts.isolated) {
|
|
57453
|
-
addMessage(opts.threadId, "tool", toolResultLLM, {
|
|
57454
|
-
channel: opts.channel,
|
|
57455
|
-
tool_call_id: tc.id
|
|
57456
|
-
});
|
|
57457
|
-
}
|
|
57458
57447
|
if (toolName === "search_knowledge") {
|
|
57459
57448
|
try {
|
|
57460
57449
|
const result = toolResultJS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{t as r}from"./utils-3pnRFmFe.js";import{a as i,c as a,l as o,n as s,r as c,s as l,t as u}from"./switch-BDwN8RYV.js";import{t as d}from"./circle-alert-CyHDwUj8.js";import{t as f}from"./cpu-Cdgc_B1K.js";import{t as p}from"./external-link-BvxYeTP1.js";import{t as m}from"./folder-open-BhH8y9ac.js";import{t as h}from"./loader-circle-CZNax6kS.js";import{t as g}from"./save-CUdYyHNy.js";import{n as _,t as v}from"./textarea-CXgXWKrT.js";import{t as y}from"./sparkles-yUEb-7oH.js";import{M as b,R as x,c as S,h as C,j as w,p as T,t as E}from"./index-DMCjjdqf.js";import{t as D}from"./label-D2H1IR_J.js";import{a as O,c as k,i as ee,n as A,o as j,r as M,s as N,t as P}from"./dialog-QnZ0ad8O.js";import{t as F}from"./badge-ChpACfWO.js";import{a as I,n as L,o as R,r as z,t as B}from"./card-CNf6BS2e.js";import"./useProviders-C6_QHsEi.js";var V=e(t(),1),H=n();function U({selectedProviderId:e,selectedModelId:t,onProviderChange:n,onModelChange:r,disabled:o=!1,typeFilter:u}){let{providers:d,models:f}=S(),p=e=>{if(e.id===`ollama`)return!0;let t=e.base_url||e.baseUrl||``;return t.includes(`localhost`)||t.includes(`127.0.0.1`)?!0:!!e.has_api_key},m=e=>{if(e.id===`ollama`)return!0;let t=e.base_url||e.baseUrl||``;return t.includes(`localhost`)||t.includes(`127.0.0.1`)},h=d.filter(e=>(e.enabled||e.active)&&p(e)),g=d.find(t=>t.id===e),_=!!g&&!h.some(e=>e.id===g.id),v=(0,V.useMemo)(()=>e?f.filter(t=>{let n=(t.provider_id||t.providerId)===e,r=!u||t.model_type===u;return n&&r}):[],[e,f,u]),y=(0,V.useMemo)(()=>v.filter(e=>e.enabled||e.active),[v]),b=v.find(e=>e.id===t),x=!!b&&!y.some(e=>e.id===b.id);(0,V.useEffect)(()=>{t&&v.length>0&&!v.find(e=>e.id===t)&&r(``)},[v,t,r]);let C=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}};return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`provider`,children:`Proveedor de IA`}),(0,H.jsxs)(s,{value:e||``,onValueChange:n,disabled:o||h.length===0,children:[(0,H.jsx)(l,{id:`provider`,className:`w-full`,children:(0,H.jsx)(a,{placeholder:`Selecciona un proveedor`,children:e&&g?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:g.name}),_&&(0,H.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`(inactivo)`}),m(g)?(0,H.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-400`,children:`LOCAL`}):(0,H.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400`,children:`API`})]}):`Selecciona un proveedor`})}),(0,H.jsx)(c,{children:h.length===0?(0,H.jsx)(i,{value:`none`,disabled:!0,children:`No hay proveedores configurados`}):h.map(e=>(0,H.jsx)(i,{value:e.id,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:e.name}),m(e)?(0,H.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-400`,children:`LOCAL`}):(0,H.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400`,children:`API`})]})},e.id))})]}),_&&g&&(0,H.jsxs)(`p`,{className:`text-[10px] text-amber-400/80`,children:[`El proveedor "`,g.name,`" está inactivo. Selecciona uno activo para cambiar.`]}),h.length===0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Configura un proveedor en`,` `,(0,H.jsx)(`a`,{href:`/providers`,className:`text-primary underline`,children:`Settings > Providers`})]})]}),e&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`model`,children:`Modelo`}),(0,H.jsxs)(s,{value:t||``,onValueChange:r,disabled:o||y.length===0,children:[(0,H.jsx)(l,{id:`model`,className:`w-full`,children:(0,H.jsx)(a,{placeholder:`Selecciona un modelo`,children:t&&b?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:b.name}),x&&(0,H.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`(inactivo)`})]}):`Selecciona un modelo`})}),(0,H.jsx)(c,{children:y.length===0?(0,H.jsx)(i,{value:`none`,disabled:!0,children:`No hay modelos disponibles`}):y.map(e=>(0,H.jsx)(i,{value:e.id,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:e.name}),e.contextWindow&&(0,H.jsxs)(F,{variant:`secondary`,className:`text-[10px]`,children:[(e.contextWindow/1e3).toFixed(0),`K ctx`]})]})},e.id))})]}),x&&b&&(0,H.jsxs)(`p`,{className:`text-[10px] text-amber-400/80`,children:[`El modelo "`,b.name,`" está inactivo. Selecciona uno activo para cambiar.`]}),t&&v.find(e=>e.id===t)&&(0,H.jsx)(B,{className:`mt-2`,children:(0,H.jsxs)(L,{className:`p-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:v.find(e=>e.id===t)?.name}),(0,H.jsx)(F,{variant:`outline`,children:d.find(t=>t.id===e)?.name})]}),(()=>{let e=C(v.find(e=>e.id===t)?.capabilities);return e.length>0?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.slice(0,5).map(e=>(0,H.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e},e))}):null})()]})})]})]})}var W=[{value:`friendly`,label:`Amigable`},{value:`professional`,label:`Profesional`},{value:`casual`,label:`Casual`},{value:`formal`,label:`Formal`},{value:`creative`,label:`Creativo`}];function G({initialData:e,onSuccess:t,onCancel:n}){let{createAgent:F,updateAgent:G,isLoading:K,error:q}=E(),{activeProviders:te}=S(),[J,Y]=(0,V.useState)({isValidating:!1,exists:!1,accessible:!1}),[X,Z]=(0,V.useState)({name:``,description:``,tone:`professional`,provider_id:``,model_id:``,role:`coordinator`,enabled:!0,systemPrompt:``,workspace:e?.workspace||``});(0,V.useEffect)(()=>{e&&Z({...e,provider_id:e.provider_id||e.providerId||``,model_id:e.model_id||e.modelId||``})},[e]);let Q=async e=>{if(!e||e.trim()===``){Y({isValidating:!1,exists:!1,accessible:!1});return}Y({isValidating:!0,exists:!1,accessible:!1});try{let t=await T(`/api/workspace/validate`,{method:`POST`,body:{path:e}});Y({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){Y({isValidating:!1,exists:!1,accessible:!1,error:e.message})}},ne=async()=>{if(X.workspace)try{await T(`/api/workspace/create`,{method:`POST`,body:{path:X.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await Q(X.workspace)}catch(e){C.fire(`Error`,e.message,`error`)}},re=async()=>{if(X.workspace)try{await T(`/api/workspace/open?path=${encodeURIComponent(X.workspace)}`,{method:`GET`})}catch(e){C.fire(`Error`,e.message,`error`)}},ie=async n=>{if(n.preventDefault(),!X.provider_id||!X.model_id){C.fire(`Incompleto`,`Por favor selecciona un proveedor y modelo`,`warning`);return}try{e?.id?await G(e.id,X):await F(X),t&&t()}catch(e){console.error(e)}},$=!!e?.id;return(0,H.jsxs)(B,{className:`hive-card--form group`,children:[(0,H.jsx)(`div`,{className:`hive-glow-blob--card absolute -top-24 -right-24 h-48 w-48 bg-blue-600/10 group-hover:bg-blue-600/20`,style:{borderRadius:`50%`,filter:`blur(80px)`}}),(0,H.jsx)(I,{className:`relative`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`hive-icon-wrap hive-icon-wrap--primary`,children:$?(0,H.jsx)(g,{className:`h-5 w-5`}):(0,H.jsx)(y,{className:`h-5 w-5`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(R,{className:`text-xl font-bold text-white/90`,children:$?`Configurar Nodo`:`Desplegar Nuevo Nodo`}),(0,H.jsx)(z,{className:`text-white/40`,children:$?`Ajusta los parámetros de tu agente inteligente.`:`Crea una nueva entidad inteligente para tu colmena.`})]})]}),n&&(0,H.jsx)(b,{variant:`ghost`,size:`icon`,onClick:n,className:`text-white/40 hover:text-white hover:bg-white/5`,children:(0,H.jsx)(x,{className:`h-5 w-5`})})]})}),(0,H.jsx)(L,{className:`relative space-y-6 pt-2`,children:(0,H.jsxs)(`form`,{onSubmit:ie,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`grid gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`name`,className:`hive-label--field`,children:`Nombre del Agente`}),(0,H.jsx)(w,{id:`name`,placeholder:`Ej: Analista de Mercado`,className:`hive-input`,value:X.name,onChange:e=>Z({...X,name:e.target.value}),disabled:K,required:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`description`,className:`hive-label--field`,children:`Descripción / Rol`}),(0,H.jsx)(v,{id:`description`,placeholder:`Describe qué hace este agente y cuáles son sus objetivos...`,className:`hive-textarea`,value:X.description,onChange:e=>Z({...X,description:e.target.value}),disabled:K})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(D,{htmlFor:`systemPrompt`,className:`hive-label--field`,children:`System Prompt`}),(0,H.jsxs)(P,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsx)(b,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,H.jsxs)(M,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,H.jsxs)(j,{children:[(0,H.jsx)(N,{className:`text-xl`,children:`Editar System Prompt`}),(0,H.jsx)(ee,{className:`text-sm text-white/50`,children:`El prompt base de comportamiento del agente. Se recomienda formato Markdown.`})]}),(0,H.jsx)(`div`,{className:`py-2`,children:(0,H.jsx)(v,{value:X.systemPrompt||``,onChange:e=>Z({...X,systemPrompt:e.target.value}),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`,disabled:K})}),(0,H.jsx)(O,{children:(0,H.jsx)(A,{asChild:!0,children:(0,H.jsx)(b,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Guardar Cambios`})})})]})]})]}),X.systemPrompt?(0,H.jsxs)(`p`,{className:`text-xs text-white/40 line-clamp-1 italic border border-white/5 bg-white/[0.02] p-2 rounded-md`,children:[`"`,X.systemPrompt,`"`]}):(0,H.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(m,{className:`h-4 w-4 text-emerald-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Workspace Directory`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`workspace`,className:`hive-label--field`,children:`Directorio de Trabajo del Agente`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(w,{id:`workspace`,placeholder:`Ej: /home/user/proyectos, D:\\Work, /Volumes/USB`,className:`hive-input flex-1 font-mono text-sm`,value:X.workspace,onChange:e=>{Z({...X,workspace:e.target.value}),Q(e.target.value)},disabled:K}),X.workspace&&J.exists&&J.accessible&&(0,H.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,onClick:re,className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10`,title:`Abrir en el explorador`,children:(0,H.jsx)(p,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente creará archivos, carpetas y ejecutará comandos. Puede ser cualquier ubicación en tu sistema (disco duro, USB, red, etc.).`}),X.workspace&&X.workspace.trim()!==``&&(0,H.jsxs)(`div`,{className:r(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,J.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!J.isValidating&&J.exists&&J.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!J.isValidating&&J.exists&&!J.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!J.isValidating&&!J.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[J.isValidating&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}),(0,H.jsx)(`span`,{children:`Validando directorio...`})]}),!J.isValidating&&J.exists&&J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(o,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`Directorio válido y accesible`})]}),!J.isValidating&&J.exists&&!J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(d,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio existe pero no tiene permisos de lectura/escritura`})]}),!J.isValidating&&!J.exists&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(m,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio no existe`}),!J.error&&(0,H.jsx)(b,{type:`button`,variant:`outline`,size:`sm`,onClick:ne,className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear directorio`})]})]})]})]}),(0,H.jsx)(`div`,{className:`hive-card-divider`}),(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(f,{className:`h-4 w-4 text-blue-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Motor de Inteligencia`})]}),(0,H.jsx)(U,{selectedProviderId:X.provider_id||void 0,selectedModelId:X.model_id||void 0,onProviderChange:e=>Z({...X,provider_id:e,model_id:``}),onModelChange:e=>Z({...X,model_id:e}),disabled:K,typeFilter:`llm`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`tone`,className:`hive-label--field`,children:`Tono de Voz`}),(0,H.jsxs)(s,{value:X.tone,onValueChange:e=>Z({...X,tone:e}),disabled:K,children:[(0,H.jsx)(l,{className:`hive-select-trigger`,children:(0,H.jsx)(a,{placeholder:`Selecciona un tono`})}),(0,H.jsx)(c,{className:`hive-select-content`,children:W.map(e=>(0,H.jsx)(i,{value:e.value,className:`hive-select-item`,children:e.label},e.value))})]})]}),(0,H.jsxs)(`div`,{className:`hive-toggle-panel`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(_,{className:`h-3.5 w-3.5 text-purple-400`}),(0,H.jsx)(D,{htmlFor:`role`,className:`text-xs font-medium text-white/70`,children:`Rol`})]}),(0,H.jsxs)(s,{value:X.role,onValueChange:e=>Z({...X,role:e}),disabled:K,children:[(0,H.jsx)(l,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,H.jsx)(a,{})}),(0,H.jsxs)(c,{className:`bg-zinc-900 border-white/10`,children:[(0,H.jsx)(i,{value:`coordinator`,children:`Coordinador`}),(0,H.jsx)(i,{value:`worker`,children:`Worker`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full ${X.enabled?`bg-blue-400`:`bg-zinc-600`}`}),(0,H.jsx)(D,{htmlFor:`enabled`,className:`text-xs font-medium text-white/70`,children:`Habilitado`})]}),(0,H.jsx)(u,{id:`enabled`,checked:X.enabled,onCheckedChange:e=>Z({...X,enabled:e}),disabled:K})]})]})]}),q&&(0,H.jsx)(`div`,{className:`hive-form-error`,children:q}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 pt-4`,children:[n&&(0,H.jsx)(b,{type:`button`,variant:`outline`,onClick:n,disabled:K,className:`hive-btn--form-cancel`,children:`Cancelar`}),(0,H.jsx)(b,{type:`submit`,disabled:K,className:`hive-btn--form-submit`,children:K?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h,{className:`mr-2 h-4 w-4 animate-spin`}),`Procesando...`]}):(0,H.jsx)(H.Fragment,{children:$?`Actualizar Agente`:`Desplegar Agente`})})]})]})})]})}export{G as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{t as r}from"./utils-3pnRFmFe.js";import{a as i,c as a,l as o,n as s,r as c,s as l,t as u}from"./switch-BDwN8RYV.js";import{t as d}from"./circle-alert-CyHDwUj8.js";import{t as f}from"./cpu-Cdgc_B1K.js";import{t as p}from"./external-link-BvxYeTP1.js";import{t as m}from"./folder-open-BhH8y9ac.js";import{t as h}from"./loader-circle-CZNax6kS.js";import{t as g}from"./save-CUdYyHNy.js";import{n as _,t as v}from"./textarea-CXgXWKrT.js";import{t as y}from"./sparkles-yUEb-7oH.js";import{M as b,R as x,c as S,h as C,j as w,p as T,t as E}from"./index-CQ7fn00w.js";import{t as D}from"./label-CrH0Jj3v.js";import{a as O,c as k,i as ee,n as A,o as j,r as M,s as N,t as P}from"./dialog-bI9jImCS.js";import{t as F}from"./badge-DXUDdTed.js";import{a as I,n as L,o as R,r as z,t as B}from"./card-CNf6BS2e.js";import"./useProviders-CnlC_qCS.js";var V=e(t(),1),H=n();function U({selectedProviderId:e,selectedModelId:t,onProviderChange:n,onModelChange:r,disabled:o=!1,typeFilter:u}){let{providers:d,models:f}=S(),p=e=>{if(e.id===`ollama`)return!0;let t=e.base_url||e.baseUrl||``;return t.includes(`localhost`)||t.includes(`127.0.0.1`)?!0:!!e.has_api_key},m=e=>{if(e.id===`ollama`)return!0;let t=e.base_url||e.baseUrl||``;return t.includes(`localhost`)||t.includes(`127.0.0.1`)},h=d.filter(e=>(e.enabled||e.active)&&p(e)),g=d.find(t=>t.id===e),_=!!g&&!h.some(e=>e.id===g.id),v=(0,V.useMemo)(()=>e?f.filter(t=>{let n=(t.provider_id||t.providerId)===e,r=!u||t.model_type===u;return n&&r}):[],[e,f,u]),y=(0,V.useMemo)(()=>v.filter(e=>e.enabled||e.active),[v]),b=v.find(e=>e.id===t),x=!!b&&!y.some(e=>e.id===b.id);(0,V.useEffect)(()=>{t&&v.length>0&&!v.find(e=>e.id===t)&&r(``)},[v,t,r]);let C=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}};return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`provider`,children:`Proveedor de IA`}),(0,H.jsxs)(s,{value:e||``,onValueChange:n,disabled:o||h.length===0,children:[(0,H.jsx)(l,{id:`provider`,className:`w-full`,children:(0,H.jsx)(a,{placeholder:`Selecciona un proveedor`,children:e&&g?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:g.name}),_&&(0,H.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`(inactivo)`}),m(g)?(0,H.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-400`,children:`LOCAL`}):(0,H.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400`,children:`API`})]}):`Selecciona un proveedor`})}),(0,H.jsx)(c,{children:h.length===0?(0,H.jsx)(i,{value:`none`,disabled:!0,children:`No hay proveedores configurados`}):h.map(e=>(0,H.jsx)(i,{value:e.id,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:e.name}),m(e)?(0,H.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-400`,children:`LOCAL`}):(0,H.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400`,children:`API`})]})},e.id))})]}),_&&g&&(0,H.jsxs)(`p`,{className:`text-[10px] text-amber-400/80`,children:[`El proveedor "`,g.name,`" está inactivo. Selecciona uno activo para cambiar.`]}),h.length===0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Configura un proveedor en`,` `,(0,H.jsx)(`a`,{href:`/providers`,className:`text-primary underline`,children:`Settings > Providers`})]})]}),e&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`model`,children:`Modelo`}),(0,H.jsxs)(s,{value:t||``,onValueChange:r,disabled:o||y.length===0,children:[(0,H.jsx)(l,{id:`model`,className:`w-full`,children:(0,H.jsx)(a,{placeholder:`Selecciona un modelo`,children:t&&b?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:b.name}),x&&(0,H.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`(inactivo)`})]}):`Selecciona un modelo`})}),(0,H.jsx)(c,{children:y.length===0?(0,H.jsx)(i,{value:`none`,disabled:!0,children:`No hay modelos disponibles`}):y.map(e=>(0,H.jsx)(i,{value:e.id,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{children:e.name}),e.contextWindow&&(0,H.jsxs)(F,{variant:`secondary`,className:`text-[10px]`,children:[(e.contextWindow/1e3).toFixed(0),`K ctx`]})]})},e.id))})]}),x&&b&&(0,H.jsxs)(`p`,{className:`text-[10px] text-amber-400/80`,children:[`El modelo "`,b.name,`" está inactivo. Selecciona uno activo para cambiar.`]}),t&&v.find(e=>e.id===t)&&(0,H.jsx)(B,{className:`mt-2`,children:(0,H.jsxs)(L,{className:`p-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:v.find(e=>e.id===t)?.name}),(0,H.jsx)(F,{variant:`outline`,children:d.find(t=>t.id===e)?.name})]}),(()=>{let e=C(v.find(e=>e.id===t)?.capabilities);return e.length>0?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.slice(0,5).map(e=>(0,H.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e},e))}):null})()]})})]})]})}var W=[{value:`friendly`,label:`Amigable`},{value:`professional`,label:`Profesional`},{value:`casual`,label:`Casual`},{value:`formal`,label:`Formal`},{value:`creative`,label:`Creativo`}];function G({initialData:e,onSuccess:t,onCancel:n}){let{createAgent:F,updateAgent:G,isLoading:K,error:q}=E(),{activeProviders:te}=S(),[J,Y]=(0,V.useState)({isValidating:!1,exists:!1,accessible:!1}),[X,Z]=(0,V.useState)({name:``,description:``,tone:`professional`,provider_id:``,model_id:``,role:`coordinator`,enabled:!0,systemPrompt:``,workspace:e?.workspace||``});(0,V.useEffect)(()=>{e&&Z({...e,provider_id:e.provider_id||e.providerId||``,model_id:e.model_id||e.modelId||``})},[e]);let Q=async e=>{if(!e||e.trim()===``){Y({isValidating:!1,exists:!1,accessible:!1});return}Y({isValidating:!0,exists:!1,accessible:!1});try{let t=await T(`/api/workspace/validate`,{method:`POST`,body:{path:e}});Y({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){Y({isValidating:!1,exists:!1,accessible:!1,error:e.message})}},ne=async()=>{if(X.workspace)try{await T(`/api/workspace/create`,{method:`POST`,body:{path:X.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await Q(X.workspace)}catch(e){C.fire(`Error`,e.message,`error`)}},re=async()=>{if(X.workspace)try{await T(`/api/workspace/open?path=${encodeURIComponent(X.workspace)}`,{method:`GET`})}catch(e){C.fire(`Error`,e.message,`error`)}},ie=async n=>{if(n.preventDefault(),!X.provider_id||!X.model_id){C.fire(`Incompleto`,`Por favor selecciona un proveedor y modelo`,`warning`);return}try{e?.id?await G(e.id,X):await F(X),t&&t()}catch(e){console.error(e)}},$=!!e?.id;return(0,H.jsxs)(B,{className:`hive-card--form group`,children:[(0,H.jsx)(`div`,{className:`hive-glow-blob--card absolute -top-24 -right-24 h-48 w-48 bg-blue-600/10 group-hover:bg-blue-600/20`,style:{borderRadius:`50%`,filter:`blur(80px)`}}),(0,H.jsx)(I,{className:`relative`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`hive-icon-wrap hive-icon-wrap--primary`,children:$?(0,H.jsx)(g,{className:`h-5 w-5`}):(0,H.jsx)(y,{className:`h-5 w-5`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(R,{className:`text-xl font-bold text-white/90`,children:$?`Configurar Nodo`:`Desplegar Nuevo Nodo`}),(0,H.jsx)(z,{className:`text-white/40`,children:$?`Ajusta los parámetros de tu agente inteligente.`:`Crea una nueva entidad inteligente para tu colmena.`})]})]}),n&&(0,H.jsx)(b,{variant:`ghost`,size:`icon`,onClick:n,className:`text-white/40 hover:text-white hover:bg-white/5`,children:(0,H.jsx)(x,{className:`h-5 w-5`})})]})}),(0,H.jsx)(L,{className:`relative space-y-6 pt-2`,children:(0,H.jsxs)(`form`,{onSubmit:ie,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`grid gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`name`,className:`hive-label--field`,children:`Nombre del Agente`}),(0,H.jsx)(w,{id:`name`,placeholder:`Ej: Analista de Mercado`,className:`hive-input`,value:X.name,onChange:e=>Z({...X,name:e.target.value}),disabled:K,required:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`description`,className:`hive-label--field`,children:`Descripción / Rol`}),(0,H.jsx)(v,{id:`description`,placeholder:`Describe qué hace este agente y cuáles son sus objetivos...`,className:`hive-textarea`,value:X.description,onChange:e=>Z({...X,description:e.target.value}),disabled:K})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(D,{htmlFor:`systemPrompt`,className:`hive-label--field`,children:`System Prompt`}),(0,H.jsxs)(P,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsx)(b,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,H.jsxs)(M,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,H.jsxs)(j,{children:[(0,H.jsx)(N,{className:`text-xl`,children:`Editar System Prompt`}),(0,H.jsx)(ee,{className:`text-sm text-white/50`,children:`El prompt base de comportamiento del agente. Se recomienda formato Markdown.`})]}),(0,H.jsx)(`div`,{className:`py-2`,children:(0,H.jsx)(v,{value:X.systemPrompt||``,onChange:e=>Z({...X,systemPrompt:e.target.value}),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`,disabled:K})}),(0,H.jsx)(O,{children:(0,H.jsx)(A,{asChild:!0,children:(0,H.jsx)(b,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Guardar Cambios`})})})]})]})]}),X.systemPrompt?(0,H.jsxs)(`p`,{className:`text-xs text-white/40 line-clamp-1 italic border border-white/5 bg-white/[0.02] p-2 rounded-md`,children:[`"`,X.systemPrompt,`"`]}):(0,H.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(m,{className:`h-4 w-4 text-emerald-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Workspace Directory`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`workspace`,className:`hive-label--field`,children:`Directorio de Trabajo del Agente`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(w,{id:`workspace`,placeholder:`Ej: /home/user/proyectos, D:\\Work, /Volumes/USB`,className:`hive-input flex-1 font-mono text-sm`,value:X.workspace,onChange:e=>{Z({...X,workspace:e.target.value}),Q(e.target.value)},disabled:K}),X.workspace&&J.exists&&J.accessible&&(0,H.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,onClick:re,className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10`,title:`Abrir en el explorador`,children:(0,H.jsx)(p,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente creará archivos, carpetas y ejecutará comandos. Puede ser cualquier ubicación en tu sistema (disco duro, USB, red, etc.).`}),X.workspace&&X.workspace.trim()!==``&&(0,H.jsxs)(`div`,{className:r(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,J.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!J.isValidating&&J.exists&&J.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!J.isValidating&&J.exists&&!J.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!J.isValidating&&!J.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[J.isValidating&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}),(0,H.jsx)(`span`,{children:`Validando directorio...`})]}),!J.isValidating&&J.exists&&J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(o,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`Directorio válido y accesible`})]}),!J.isValidating&&J.exists&&!J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(d,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio existe pero no tiene permisos de lectura/escritura`})]}),!J.isValidating&&!J.exists&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(m,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio no existe`}),!J.error&&(0,H.jsx)(b,{type:`button`,variant:`outline`,size:`sm`,onClick:ne,className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear directorio`})]})]})]})]}),(0,H.jsx)(`div`,{className:`hive-card-divider`}),(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(f,{className:`h-4 w-4 text-blue-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Motor de Inteligencia`})]}),(0,H.jsx)(U,{selectedProviderId:X.provider_id||void 0,selectedModelId:X.model_id||void 0,onProviderChange:e=>Z({...X,provider_id:e,model_id:``}),onModelChange:e=>Z({...X,model_id:e}),disabled:K,typeFilter:`llm`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(D,{htmlFor:`tone`,className:`hive-label--field`,children:`Tono de Voz`}),(0,H.jsxs)(s,{value:X.tone,onValueChange:e=>Z({...X,tone:e}),disabled:K,children:[(0,H.jsx)(l,{className:`hive-select-trigger`,children:(0,H.jsx)(a,{placeholder:`Selecciona un tono`})}),(0,H.jsx)(c,{className:`hive-select-content`,children:W.map(e=>(0,H.jsx)(i,{value:e.value,className:`hive-select-item`,children:e.label},e.value))})]})]}),(0,H.jsxs)(`div`,{className:`hive-toggle-panel`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(_,{className:`h-3.5 w-3.5 text-purple-400`}),(0,H.jsx)(D,{htmlFor:`role`,className:`text-xs font-medium text-white/70`,children:`Rol`})]}),(0,H.jsxs)(s,{value:X.role,onValueChange:e=>Z({...X,role:e}),disabled:K,children:[(0,H.jsx)(l,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,H.jsx)(a,{})}),(0,H.jsxs)(c,{className:`bg-zinc-900 border-white/10`,children:[(0,H.jsx)(i,{value:`coordinator`,children:`Coordinador`}),(0,H.jsx)(i,{value:`worker`,children:`Worker`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full ${X.enabled?`bg-blue-400`:`bg-zinc-600`}`}),(0,H.jsx)(D,{htmlFor:`enabled`,className:`text-xs font-medium text-white/70`,children:`Habilitado`})]}),(0,H.jsx)(u,{id:`enabled`,checked:X.enabled,onCheckedChange:e=>Z({...X,enabled:e}),disabled:K})]})]})]}),q&&(0,H.jsx)(`div`,{className:`hive-form-error`,children:q}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 pt-4`,children:[n&&(0,H.jsx)(b,{type:`button`,variant:`outline`,onClick:n,disabled:K,className:`hive-btn--form-cancel`,children:`Cancelar`}),(0,H.jsx)(b,{type:`submit`,disabled:K,className:`hive-btn--form-submit`,children:K?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h,{className:`mr-2 h-4 w-4 animate-spin`}),`Procesando...`]}):(0,H.jsx)(H.Fragment,{children:$?`Actualizar Agente`:`Desplegar Agente`})})]})]})})]})}export{G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{r,t as i}from"./utils-3pnRFmFe.js";import{t as a}from"./activity-c3pNngT_.js";import{t as o}from"./calendar-B-KZ9RQO.js";import{a as s,c,l,n as u,r as d,s as f,t as ee}from"./switch-BDwN8RYV.js";import{t as p}from"./chevron-left-D4U-5A27.js";import{t as te}from"./circle-alert-CyHDwUj8.js";import{t as m}from"./cpu-Cdgc_B1K.js";import{t as ne}from"./external-link-BvxYeTP1.js";import{t as h}from"./folder-open-BhH8y9ac.js";import{t as re}from"./globe-DeCQTCDJ.js";import{t as ie}from"./loader-circle-CZNax6kS.js";import{t as g}from"./save-CUdYyHNy.js";import{n as ae,t as _}from"./textarea-CXgXWKrT.js";import{t as oe}from"./sparkles-yUEb-7oH.js";import{t as v}from"./zap-hlXjpSeA.js";import{c as y,l as b}from"./vendor-router-C9pIYwbJ.js";import{M as x,V as se,c as S,g as C,j as w,m as T,p as E,s as D,t as O}from"./index-DMCjjdqf.js";import{t as k}from"./label-D2H1IR_J.js";import{a as A,c as j,i as M,n as N,o as P,r as F,s as ce,t as le}from"./dialog-QnZ0ad8O.js";import{t as I}from"./badge-ChpACfWO.js";import{n as L,t as R}from"./es-NQNoaWDx.js";import{t as z}from"./format-GVHeOyWI.js";var B=r(`Fingerprint`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),V=r(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),H=e(t(),1),U=n();function W({icon:e,...t}){return(0,U.jsx)(e,{...t})}function G({agentId:e}){let{agents:t,updateAgent:n,fetchAgents:r}=O(),{providers:o,fetchProviders:p}=S(),{models:m,fetchModels:v}=D();(0,H.useEffect)(()=>{r(),p(),v()},[r,p,v]);let y=t.find(t=>t.id===e),[b,I]=(0,H.useState)({name:``,description:``,provider_id:``,model_id:``,tone:``,role:`coordinator`,enabled:!0,headers:``,systemPrompt:``,workspace:``}),[L,R]=(0,H.useState)({isValidating:!1,exists:!1,accessible:!1});(0,H.useEffect)(()=>{y&&(I({name:y.name||``,description:y.description||``,provider_id:y.provider_id||y.providerId||``,model_id:y.model_id||y.modelId||``,tone:y.tone||``,role:y.role||`coordinator`,enabled:!!y.enabled,headers:``,systemPrompt:y.systemPrompt||``,workspace:y.workspace||``}),y.workspace&&z(y.workspace))},[y]);let z=async e=>{if(!e||e.trim()===``){R({isValidating:!1,exists:!1,accessible:!1});return}R({isValidating:!0,exists:!1,accessible:!1});try{let t=await E(`/api/workspace/validate`,{method:`POST`,body:{path:e}});R({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){R({isValidating:!1,exists:!1,accessible:!1,error:e.message})}},B=async()=>{if(b.workspace)try{await E(`/api/workspace/create`,{method:`POST`,body:{path:b.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await z(b.workspace)}catch(e){T.fire({icon:`error`,title:e.message})}},V=async()=>{if(b.workspace)try{await E(`/api/workspace/open?path=${encodeURIComponent(b.workspace)}`,{method:`GET`})}catch(e){T.fire({icon:`error`,title:e.message})}},G=async()=>{C.show(`Sincronizando configuración del agente...`);try{await n(e,{...b,role:b.role,enabled:+!!b.enabled,workspace:b.workspace||null}),T.fire({icon:`success`,title:`Cambios sincronizados correctamente`})}catch(e){T.fire({icon:`error`,title:e instanceof Error?e.message:`Error al sincronizar cambios`})}finally{C.hide()}};if(!y)return(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center space-y-4 rounded-3xl border border-dashed border-white/10 bg-white/5`,children:[(0,U.jsx)(W,{icon:a,className:`h-12 w-12 text-white/10 animate-pulse`}),(0,U.jsx)(`p`,{className:`text-white/40 font-medium`,children:`Buscando nodo en la colmena...`})]});let K=e=>{if(e.id===`ollama`)return!0;let t=e.base_url||e.baseUrl||``;return t.includes(`localhost`)||t.includes(`127.0.0.1`)?!0:!!e.has_api_key},q=e=>{if(e.id===`ollama`)return!0;let t=e.base_url||e.baseUrl||``;return t.includes(`localhost`)||t.includes(`127.0.0.1`)},J=o.filter(e=>(e.enabled||e.active)&&K(e)),Y=m.filter(e=>(e.provider_id||e.providerId)===b.provider_id&&(e.enabled||e.active)),X=o.find(e=>e.id===b.provider_id),Z=!!X&&!J.some(e=>e.id===X.id),Q=m.filter(e=>(e.provider_id||e.providerId)===b.provider_id).find(e=>e.id===b.model_id),$=!!Q&&!Y.some(e=>e.id===Q.id);return(0,U.jsx)(`div`,{className:`space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,U.jsxs)(`div`,{className:`lg:col-span-1 space-y-6`,children:[(0,U.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-xl bg-blue-500/10 border border-blue-500/20`,children:(0,U.jsx)(W,{icon:se,className:`h-4 w-4 text-blue-400`})}),(0,U.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Identidad Base`})]}),(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(k,{htmlFor:`name`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Nombre Público`}),(0,U.jsx)(w,{id:`name`,value:b.name,onChange:e=>I(t=>({...t,name:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Nombre del nodo`})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(k,{htmlFor:`tone`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Tono Cognitivo`}),(0,U.jsx)(w,{id:`tone`,value:b.tone,onChange:e=>I(t=>({...t,tone:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Ej: Analítico, Conciso...`})]})]})]}),(0,U.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-xl bg-purple-500/10 border border-purple-500/20`,children:(0,U.jsx)(W,{icon:ae,className:`h-4 w-4 text-purple-400`})}),(0,U.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Permisos de Red`})]}),(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(k,{className:`text-sm font-semibold`,children:`Rol`}),(0,U.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Coordinador o Worker`})]}),(0,U.jsxs)(u,{value:b.role,onValueChange:e=>I(t=>({...t,role:e})),children:[(0,U.jsx)(f,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,U.jsx)(c,{})}),(0,U.jsxs)(d,{className:`bg-zinc-900 border-white/10`,children:[(0,U.jsx)(s,{value:`coordinator`,children:`Coordinador`}),(0,U.jsx)(s,{value:`worker`,children:`Worker`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(k,{className:`text-sm font-semibold`,children:`Nodo Activo`}),(0,U.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Disponible para la colmena`})]}),(0,U.jsx)(ee,{checked:b.enabled,onCheckedChange:e=>I(t=>({...t,enabled:e}))})]})]})]}),(0,U.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20`,children:(0,U.jsx)(W,{icon:h,className:`h-4 w-4 text-emerald-400`})}),(0,U.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Workspace Directory`})]}),(0,U.jsx)(`div`,{className:`space-y-4`,children:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(k,{htmlFor:`workspace`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directorio de Trabajo`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(w,{id:`workspace`,value:b.workspace,onChange:e=>{I(t=>({...t,workspace:e.target.value})),z(e.target.value)},className:`bg-white/5 border-white/10 focus:border-emerald-500/50 rounded-xl h-11 font-mono text-sm flex-1`,placeholder:`Ej: /home/user/proyectos, D:\\Work`}),b.workspace&&L.exists&&L.accessible&&(0,U.jsx)(x,{type:`button`,variant:`outline`,size:`icon`,onClick:V,className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 h-11 w-11`,title:`Abrir en el explorador`,children:(0,U.jsx)(ne,{className:`h-4 w-4`})})]}),(0,U.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente operará. Puede ser cualquier ubicación (disco, USB, red).`}),b.workspace&&b.workspace.trim()!==``&&(0,U.jsxs)(`div`,{className:i(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,L.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!L.isValidating&&L.exists&&L.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!L.isValidating&&L.exists&&!L.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!L.isValidating&&!L.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[L.isValidating&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ie,{className:`h-3.5 w-3.5 animate-spin`}),(0,U.jsx)(`span`,{children:`Validando directorio...`})]}),!L.isValidating&&L.exists&&L.accessible&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:L.message||`Directorio válido y accesible`})]}),!L.isValidating&&L.exists&&!L.accessible&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(te,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:L.message||`Sin permisos de lectura/escritura`})]}),!L.isValidating&&!L.exists&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(h,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:L.message||`El directorio no existe`}),!L.error&&(0,U.jsx)(x,{type:`button`,variant:`outline`,size:`sm`,onClick:B,className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear`})]})]})]})})]})]}),(0,U.jsx)(`div`,{className:`lg:col-span-2 space-y-6`,children:(0,U.jsxs)(`div`,{className:`p-8 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-8`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,U.jsx)(W,{icon:oe,className:`h-4 w-4 text-amber-400`})}),(0,U.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Configuración Cognitiva`})]}),(0,U.jsxs)(x,{onClick:G,className:`bg-blue-600 hover:bg-blue-500 text-white font-bold rounded-xl px-6 shadow-[0_4px_15px_rgba(37,99,235,0.3)] transition-all active:scale-95 gap-2`,children:[(0,U.jsx)(W,{icon:g,className:`h-4 w-4`}),`Sincronizar Cambios`]})]}),(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(k,{htmlFor:`description`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directiva de Misión (Descripción)`}),(0,U.jsx)(_,{id:`description`,value:b.description,onChange:e=>I(t=>({...t,description:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-2xl min-h-[80px] resize-none`,placeholder:`Define el propósito general de este nodo...`})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,U.jsx)(k,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`System Prompt (Markdown)`}),(0,U.jsxs)(le,{children:[(0,U.jsx)(j,{asChild:!0,children:(0,U.jsx)(x,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,U.jsxs)(F,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,U.jsxs)(P,{children:[(0,U.jsx)(ce,{className:`text-xl`,children:`Editar System Prompt`}),(0,U.jsx)(M,{className:`text-sm text-white/50`,children:`El comportamiento principal del agente. Se recomienda usar Markdown.`})]}),(0,U.jsx)(`div`,{className:`py-2`,children:(0,U.jsx)(_,{value:b.systemPrompt,onChange:e=>I(t=>({...t,systemPrompt:e.target.value})),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`})}),(0,U.jsx)(A,{children:(0,U.jsx)(N,{asChild:!0,children:(0,U.jsx)(x,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Listo`})})})]})]})]}),b.systemPrompt?(0,U.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4 max-h-[120px] overflow-y-auto custom-scrollbar`,children:(0,U.jsx)(`p`,{className:`text-xs text-white/60 font-mono whitespace-pre-wrap italic`,children:b.systemPrompt})}):(0,U.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4`,children:(0,U.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,U.jsx)(k,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`Proveedor`}),J.length===0&&(0,U.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`Sin providers activos`})]}),(0,U.jsxs)(u,{value:b.provider_id,onValueChange:e=>I(t=>({...t,provider_id:e,model_id:``})),children:[(0,U.jsx)(f,{className:`bg-white/5 border-white/10 rounded-xl h-11`,children:(0,U.jsx)(c,{placeholder:`Seleccionar proveedor`,children:b.provider_id&&X?(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{children:X.name}),Z&&(0,U.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`(inactivo)`}),q(X)?(0,U.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-400`,children:`LOCAL`}):(0,U.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400`,children:`API`})]}):`Seleccionar proveedor`})}),(0,U.jsxs)(d,{className:`bg-zinc-900 border-white/10 text-white`,children:[J.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-white/30`,children:`Activa al menos un provider con API key en la sección de Providers`}),J.map(e=>{let t=q(e);return(0,U.jsx)(s,{value:e.id,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{children:e.name}),(0,U.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full ${t?`bg-amber-500/20 text-amber-400`:`bg-emerald-500/20 text-emerald-400`}`,children:t?`LOCAL`:`API`})]})},e.id)})]})]}),Z&&X&&(0,U.jsxs)(`p`,{className:`text-[10px] text-amber-400/80 pl-1`,children:[`El proveedor "`,X.name,`" está inactivo. Selecciona uno activo para cambiar.`]})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,U.jsx)(k,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`Modelo`}),b.provider_id&&Y.length===0&&(0,U.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`Sin modelos activos`})]}),(0,U.jsxs)(u,{value:b.model_id,onValueChange:e=>I(t=>({...t,model_id:e})),disabled:!b.provider_id||Y.length===0,children:[(0,U.jsx)(f,{className:`bg-white/5 border-white/10 rounded-xl h-11 disabled:opacity-50`,children:(0,U.jsx)(c,{placeholder:b.provider_id?Y.length===0?`Activa modelos en el provider`:`Seleccionar modelo`:`Primero selecciona un proveedor`,children:b.model_id&&Q?(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-sm`,children:Q.name}),$&&(0,U.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`(inactivo)`})]}):void 0})}),(0,U.jsx)(d,{className:`bg-zinc-900 border-white/10 text-white`,children:Y.map(e=>(0,U.jsx)(s,{value:e.id,children:(0,U.jsx)(`span`,{className:`font-mono text-sm`,children:e.name})},e.id))})]}),$&&Q&&(0,U.jsxs)(`p`,{className:`text-[10px] text-amber-400/80 pl-1`,children:[`El modelo "`,Q.name,`" está inactivo. Selecciona uno activo para cambiar.`]})]})]})]}),(0,U.jsxs)(`div`,{className:`mt-8 p-4 rounded-2xl bg-white/[0.03] border border-white/5 flex items-start gap-4 italic`,children:[(0,U.jsx)(W,{icon:re,className:`h-5 w-5 text-white/20 mt-0.5`}),(0,U.jsx)(`p`,{className:`text-[11px] text-white/30 leading-relaxed`,children:`Las credenciales de acceso y llaves de cifrado para los headers personalizados se gestionan en una capa segura y no son visibles en texto plano para mantener la integridad de la red.`})]})]})})]})})}function K({agent:e}){let{providers:t}=S(),{models:n}=D(),r=e.role===`coordinator`,i=e.provider_id||e.providerId,s=e.model_id||e.modelId,c=e.created_at||e.createdAt,l=c?z(typeof c==`string`?new Date(c):new Date(c*1e3),`PPP`,{locale:R}):`Fecha desconocida`,u=t.find(e=>e.id===i)?.name||i,d=n.find(e=>e.id===s)?.name||s;return(0,U.jsxs)(`div`,{className:`hive-card--internal group ${e.enabled?`hive-card--internal-active`:`hive-card--internal-disabled`}`,children:[e.enabled&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`absolute -top-24 -right-24 h-64 w-64 bg-blue-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-blue-600/20 transition-all duration-700`}),(0,U.jsx)(`div`,{className:`absolute -bottom-24 -left-24 h-64 w-64 bg-purple-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-purple-600/20 transition-all duration-700`})]}),(0,U.jsxs)(`div`,{className:`relative flex flex-col md:flex-row gap-8 items-start justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`hive-icon-wrap--internal ${e.enabled?`hive-icon-wrap--internal-active`:`hive-icon-wrap--internal-disabled`}`,children:(0,U.jsx)(B,{className:`h-6 w-6 ${e.enabled?`text-blue-400`:`text-white/20`}`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,U.jsx)(`span`,{className:`hive-page-header__label ${!e.enabled&&`text-white/20`}`,children:`Identidad de Nodo`}),r&&(0,U.jsx)(I,{className:`hive-tag--coordinator ${!e.enabled&&`bg-white/5 text-white/20 border-white/10`}`,children:`Coordinador`})]}),(0,U.jsx)(`h1`,{className:`text-4xl font-black tracking-tighter ${e.enabled?`text-white`:`text-white/40`}`,children:e.name})]})]}),(0,U.jsxs)(`p`,{className:`text-lg leading-relaxed max-w-2xl font-light italic ${e.enabled?`text-white/60`:`text-white/20`}`,children:[`"`,e.description||`Este agente no tiene una descripción definida aún.`,`"`]})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,U.jsx)(q,{icon:m,label:`Infraestructura`,value:u,subValue:d,color:e.enabled?`text-blue-400`:`text-white/20`,enabled:e.enabled}),(0,U.jsx)(q,{icon:v,label:`Personalidad`,value:e.tone||`Neutral`,color:e.enabled?`text-purple-400`:`text-white/20`,enabled:e.enabled}),(0,U.jsx)(q,{icon:o,label:`Desplegado el`,value:l,color:e.enabled?`text-emerald-400`:`text-white/20`,enabled:e.enabled})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col items-center md:items-end gap-6 min-w-[200px]`,children:[(0,U.jsxs)(`div`,{className:`text-center md:text-right space-y-2`,children:[(0,U.jsx)(`span`,{className:`hive-label block`,children:`Estado Operativo`}),(0,U.jsx)(L,{status:e.enabled?e.status:`hibernated`,className:`px-6 py-2 text-sm border-2`})]}),(0,U.jsxs)(`div`,{className:`hive-network-panel md:w-auto`,children:[(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(`p`,{className:`hive-label mb-1`,children:`Carga de Red`}),(0,U.jsx)(`div`,{className:`hive-network-track`,children:e.enabled&&(0,U.jsx)(`div`,{className:`hive-network-fill`})})]}),(0,U.jsx)(a,{className:`h-5 w-5 ${e.enabled?`text-blue-400 animate-pulse`:`text-white/10`}`})]})]})]}),(0,U.jsx)(`div`,{className:`hive-strip--bottom ${!e.enabled&&`opacity-20`}`}),(0,U.jsxs)(`div`,{className:`absolute top-4 right-8 hive-mono hidden md:block`,children:[`NODE_UID: `,e.id]})]})}function q({icon:e,label:t,value:n,subValue:r,color:i,enabled:a}){return(0,U.jsxs)(`div`,{className:`hive-info-card ${a?`hive-info-card--active`:`hive-info-card--disabled`}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,U.jsx)(e,{className:`h-3.5 w-3.5 ${i}`}),(0,U.jsx)(`span`,{className:`hive-info-card__label`,children:t})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(`p`,{className:`hive-info-card__value ${a?`text-white/80 group-hover/item:text-white`:`text-white/20`}`,children:n}),r&&(0,U.jsx)(`p`,{className:`hive-info-card__sub ${a?`text-white/40`:`text-white/10`}`,children:r})]})]})}function J(){let{id:e}=b(),t=y(),n=e??`unknown`,{agents:r,fetchAgents:i,isLoading:o}=O();(0,H.useEffect)(()=>{i()},[i]);let s=r.find(e=>e.id===n);return(0,U.jsx)(`div`,{className:`min-h-screen bg-transparent pb-20`,children:(0,U.jsxs)(`div`,{className:`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,U.jsxs)(x,{variant:`ghost`,onClick:()=>t(`/agents`),className:`group flex items-center gap-2 text-white/40 hover:text-white hover:bg-white/5 px-4 py-2 rounded-xl transition-all`,children:[(0,U.jsx)(p,{className:`h-4 w-4 transition-transform group-hover:-translate-x-1`}),(0,U.jsx)(`span`,{className:`text-sm font-bold uppercase tracking-widest`,children:`Volver a la Colmena`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-4 text-white/20`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(V,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Agentes`})]}),(0,U.jsx)(`div`,{className:`h-4 w-px bg-white/10`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(a,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Detalles Operativos`})]})]})]}),s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{agent:s}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-8`,children:(0,U.jsx)(G,{agentId:n})})]}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[60vh] text-center space-y-6`,children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`div`,{className:`h-24 w-24 rounded-full border-4 border-t-blue-500 border-white/5 animate-spin`}),(0,U.jsx)(a,{className:`absolute inset-0 m-auto h-8 w-8 text-blue-400 animate-pulse`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-xl font-bold text-white mb-2`,children:`Sincronizando con el Nodo`}),(0,U.jsx)(`p`,{className:`text-white/40 max-w-xs mx-auto`,children:`Estamos recuperando la configuración cuántica de este agente desde la base de datos central.`})]})]})]})})}export{J as AgentDetailPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{r,t as i}from"./utils-3pnRFmFe.js";import{t as a}from"./activity-c3pNngT_.js";import{t as o}from"./calendar-B-KZ9RQO.js";import{a as s,c,l,n as u,r as d,s as f,t as ee}from"./switch-BDwN8RYV.js";import{t as p}from"./chevron-left-D4U-5A27.js";import{t as te}from"./circle-alert-CyHDwUj8.js";import{t as m}from"./cpu-Cdgc_B1K.js";import{t as ne}from"./external-link-BvxYeTP1.js";import{t as h}from"./folder-open-BhH8y9ac.js";import{t as re}from"./globe-DeCQTCDJ.js";import{t as ie}from"./loader-circle-CZNax6kS.js";import{t as g}from"./save-CUdYyHNy.js";import{n as ae,t as _}from"./textarea-CXgXWKrT.js";import{t as oe}from"./sparkles-yUEb-7oH.js";import{t as v}from"./zap-hlXjpSeA.js";import{c as y,l as b}from"./vendor-router-C9pIYwbJ.js";import{M as x,V as se,c as S,g as C,j as w,m as T,p as E,s as D,t as O}from"./index-CQ7fn00w.js";import{t as k}from"./label-CrH0Jj3v.js";import{a as A,c as j,i as M,n as N,o as P,r as F,s as ce,t as le}from"./dialog-bI9jImCS.js";import{t as I}from"./badge-DXUDdTed.js";import{n as L,t as R}from"./es-Cg8zdT52.js";import{t as z}from"./format-GVHeOyWI.js";var B=r(`Fingerprint`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),V=r(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),H=e(t(),1),U=n();function W({icon:e,...t}){return(0,U.jsx)(e,{...t})}function G({agentId:e}){let{agents:t,updateAgent:n,fetchAgents:r}=O(),{providers:o,fetchProviders:p}=S(),{models:m,fetchModels:v}=D();(0,H.useEffect)(()=>{r(),p(),v()},[r,p,v]);let y=t.find(t=>t.id===e),[b,I]=(0,H.useState)({name:``,description:``,provider_id:``,model_id:``,tone:``,role:`coordinator`,enabled:!0,headers:``,systemPrompt:``,workspace:``}),[L,R]=(0,H.useState)({isValidating:!1,exists:!1,accessible:!1});(0,H.useEffect)(()=>{y&&(I({name:y.name||``,description:y.description||``,provider_id:y.provider_id||y.providerId||``,model_id:y.model_id||y.modelId||``,tone:y.tone||``,role:y.role||`coordinator`,enabled:!!y.enabled,headers:``,systemPrompt:y.systemPrompt||``,workspace:y.workspace||``}),y.workspace&&z(y.workspace))},[y]);let z=async e=>{if(!e||e.trim()===``){R({isValidating:!1,exists:!1,accessible:!1});return}R({isValidating:!0,exists:!1,accessible:!1});try{let t=await E(`/api/workspace/validate`,{method:`POST`,body:{path:e}});R({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){R({isValidating:!1,exists:!1,accessible:!1,error:e.message})}},B=async()=>{if(b.workspace)try{await E(`/api/workspace/create`,{method:`POST`,body:{path:b.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await z(b.workspace)}catch(e){T.fire({icon:`error`,title:e.message})}},V=async()=>{if(b.workspace)try{await E(`/api/workspace/open?path=${encodeURIComponent(b.workspace)}`,{method:`GET`})}catch(e){T.fire({icon:`error`,title:e.message})}},G=async()=>{C.show(`Sincronizando configuración del agente...`);try{await n(e,{...b,role:b.role,enabled:+!!b.enabled,workspace:b.workspace||null}),T.fire({icon:`success`,title:`Cambios sincronizados correctamente`})}catch(e){T.fire({icon:`error`,title:e instanceof Error?e.message:`Error al sincronizar cambios`})}finally{C.hide()}};if(!y)return(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center space-y-4 rounded-3xl border border-dashed border-white/10 bg-white/5`,children:[(0,U.jsx)(W,{icon:a,className:`h-12 w-12 text-white/10 animate-pulse`}),(0,U.jsx)(`p`,{className:`text-white/40 font-medium`,children:`Buscando nodo en la colmena...`})]});let K=e=>{if(e.id===`ollama`)return!0;let t=e.base_url||e.baseUrl||``;return t.includes(`localhost`)||t.includes(`127.0.0.1`)?!0:!!e.has_api_key},q=e=>{if(e.id===`ollama`)return!0;let t=e.base_url||e.baseUrl||``;return t.includes(`localhost`)||t.includes(`127.0.0.1`)},J=o.filter(e=>(e.enabled||e.active)&&K(e)),Y=m.filter(e=>(e.provider_id||e.providerId)===b.provider_id&&(e.enabled||e.active)),X=o.find(e=>e.id===b.provider_id),Z=!!X&&!J.some(e=>e.id===X.id),Q=m.filter(e=>(e.provider_id||e.providerId)===b.provider_id).find(e=>e.id===b.model_id),$=!!Q&&!Y.some(e=>e.id===Q.id);return(0,U.jsx)(`div`,{className:`space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,U.jsxs)(`div`,{className:`lg:col-span-1 space-y-6`,children:[(0,U.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-xl bg-blue-500/10 border border-blue-500/20`,children:(0,U.jsx)(W,{icon:se,className:`h-4 w-4 text-blue-400`})}),(0,U.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Identidad Base`})]}),(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(k,{htmlFor:`name`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Nombre Público`}),(0,U.jsx)(w,{id:`name`,value:b.name,onChange:e=>I(t=>({...t,name:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Nombre del nodo`})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(k,{htmlFor:`tone`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Tono Cognitivo`}),(0,U.jsx)(w,{id:`tone`,value:b.tone,onChange:e=>I(t=>({...t,tone:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Ej: Analítico, Conciso...`})]})]})]}),(0,U.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-xl bg-purple-500/10 border border-purple-500/20`,children:(0,U.jsx)(W,{icon:ae,className:`h-4 w-4 text-purple-400`})}),(0,U.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Permisos de Red`})]}),(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(k,{className:`text-sm font-semibold`,children:`Rol`}),(0,U.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Coordinador o Worker`})]}),(0,U.jsxs)(u,{value:b.role,onValueChange:e=>I(t=>({...t,role:e})),children:[(0,U.jsx)(f,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,U.jsx)(c,{})}),(0,U.jsxs)(d,{className:`bg-zinc-900 border-white/10`,children:[(0,U.jsx)(s,{value:`coordinator`,children:`Coordinador`}),(0,U.jsx)(s,{value:`worker`,children:`Worker`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(k,{className:`text-sm font-semibold`,children:`Nodo Activo`}),(0,U.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Disponible para la colmena`})]}),(0,U.jsx)(ee,{checked:b.enabled,onCheckedChange:e=>I(t=>({...t,enabled:e}))})]})]})]}),(0,U.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20`,children:(0,U.jsx)(W,{icon:h,className:`h-4 w-4 text-emerald-400`})}),(0,U.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Workspace Directory`})]}),(0,U.jsx)(`div`,{className:`space-y-4`,children:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(k,{htmlFor:`workspace`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directorio de Trabajo`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(w,{id:`workspace`,value:b.workspace,onChange:e=>{I(t=>({...t,workspace:e.target.value})),z(e.target.value)},className:`bg-white/5 border-white/10 focus:border-emerald-500/50 rounded-xl h-11 font-mono text-sm flex-1`,placeholder:`Ej: /home/user/proyectos, D:\\Work`}),b.workspace&&L.exists&&L.accessible&&(0,U.jsx)(x,{type:`button`,variant:`outline`,size:`icon`,onClick:V,className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 h-11 w-11`,title:`Abrir en el explorador`,children:(0,U.jsx)(ne,{className:`h-4 w-4`})})]}),(0,U.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente operará. Puede ser cualquier ubicación (disco, USB, red).`}),b.workspace&&b.workspace.trim()!==``&&(0,U.jsxs)(`div`,{className:i(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,L.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!L.isValidating&&L.exists&&L.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!L.isValidating&&L.exists&&!L.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!L.isValidating&&!L.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[L.isValidating&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ie,{className:`h-3.5 w-3.5 animate-spin`}),(0,U.jsx)(`span`,{children:`Validando directorio...`})]}),!L.isValidating&&L.exists&&L.accessible&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:L.message||`Directorio válido y accesible`})]}),!L.isValidating&&L.exists&&!L.accessible&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(te,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:L.message||`Sin permisos de lectura/escritura`})]}),!L.isValidating&&!L.exists&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(h,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:L.message||`El directorio no existe`}),!L.error&&(0,U.jsx)(x,{type:`button`,variant:`outline`,size:`sm`,onClick:B,className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear`})]})]})]})})]})]}),(0,U.jsx)(`div`,{className:`lg:col-span-2 space-y-6`,children:(0,U.jsxs)(`div`,{className:`p-8 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-8`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,U.jsx)(W,{icon:oe,className:`h-4 w-4 text-amber-400`})}),(0,U.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Configuración Cognitiva`})]}),(0,U.jsxs)(x,{onClick:G,className:`bg-blue-600 hover:bg-blue-500 text-white font-bold rounded-xl px-6 shadow-[0_4px_15px_rgba(37,99,235,0.3)] transition-all active:scale-95 gap-2`,children:[(0,U.jsx)(W,{icon:g,className:`h-4 w-4`}),`Sincronizar Cambios`]})]}),(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(k,{htmlFor:`description`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directiva de Misión (Descripción)`}),(0,U.jsx)(_,{id:`description`,value:b.description,onChange:e=>I(t=>({...t,description:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-2xl min-h-[80px] resize-none`,placeholder:`Define el propósito general de este nodo...`})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,U.jsx)(k,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`System Prompt (Markdown)`}),(0,U.jsxs)(le,{children:[(0,U.jsx)(j,{asChild:!0,children:(0,U.jsx)(x,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,U.jsxs)(F,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,U.jsxs)(P,{children:[(0,U.jsx)(ce,{className:`text-xl`,children:`Editar System Prompt`}),(0,U.jsx)(M,{className:`text-sm text-white/50`,children:`El comportamiento principal del agente. Se recomienda usar Markdown.`})]}),(0,U.jsx)(`div`,{className:`py-2`,children:(0,U.jsx)(_,{value:b.systemPrompt,onChange:e=>I(t=>({...t,systemPrompt:e.target.value})),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`})}),(0,U.jsx)(A,{children:(0,U.jsx)(N,{asChild:!0,children:(0,U.jsx)(x,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Listo`})})})]})]})]}),b.systemPrompt?(0,U.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4 max-h-[120px] overflow-y-auto custom-scrollbar`,children:(0,U.jsx)(`p`,{className:`text-xs text-white/60 font-mono whitespace-pre-wrap italic`,children:b.systemPrompt})}):(0,U.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4`,children:(0,U.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,U.jsx)(k,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`Proveedor`}),J.length===0&&(0,U.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`Sin providers activos`})]}),(0,U.jsxs)(u,{value:b.provider_id,onValueChange:e=>I(t=>({...t,provider_id:e,model_id:``})),children:[(0,U.jsx)(f,{className:`bg-white/5 border-white/10 rounded-xl h-11`,children:(0,U.jsx)(c,{placeholder:`Seleccionar proveedor`,children:b.provider_id&&X?(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{children:X.name}),Z&&(0,U.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`(inactivo)`}),q(X)?(0,U.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-400`,children:`LOCAL`}):(0,U.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400`,children:`API`})]}):`Seleccionar proveedor`})}),(0,U.jsxs)(d,{className:`bg-zinc-900 border-white/10 text-white`,children:[J.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-white/30`,children:`Activa al menos un provider con API key en la sección de Providers`}),J.map(e=>{let t=q(e);return(0,U.jsx)(s,{value:e.id,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{children:e.name}),(0,U.jsx)(`span`,{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full ${t?`bg-amber-500/20 text-amber-400`:`bg-emerald-500/20 text-emerald-400`}`,children:t?`LOCAL`:`API`})]})},e.id)})]})]}),Z&&X&&(0,U.jsxs)(`p`,{className:`text-[10px] text-amber-400/80 pl-1`,children:[`El proveedor "`,X.name,`" está inactivo. Selecciona uno activo para cambiar.`]})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,U.jsx)(k,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`Modelo`}),b.provider_id&&Y.length===0&&(0,U.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`Sin modelos activos`})]}),(0,U.jsxs)(u,{value:b.model_id,onValueChange:e=>I(t=>({...t,model_id:e})),disabled:!b.provider_id||Y.length===0,children:[(0,U.jsx)(f,{className:`bg-white/5 border-white/10 rounded-xl h-11 disabled:opacity-50`,children:(0,U.jsx)(c,{placeholder:b.provider_id?Y.length===0?`Activa modelos en el provider`:`Seleccionar modelo`:`Primero selecciona un proveedor`,children:b.model_id&&Q?(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-sm`,children:Q.name}),$&&(0,U.jsx)(`span`,{className:`text-[10px] text-amber-400/80`,children:`(inactivo)`})]}):void 0})}),(0,U.jsx)(d,{className:`bg-zinc-900 border-white/10 text-white`,children:Y.map(e=>(0,U.jsx)(s,{value:e.id,children:(0,U.jsx)(`span`,{className:`font-mono text-sm`,children:e.name})},e.id))})]}),$&&Q&&(0,U.jsxs)(`p`,{className:`text-[10px] text-amber-400/80 pl-1`,children:[`El modelo "`,Q.name,`" está inactivo. Selecciona uno activo para cambiar.`]})]})]})]}),(0,U.jsxs)(`div`,{className:`mt-8 p-4 rounded-2xl bg-white/[0.03] border border-white/5 flex items-start gap-4 italic`,children:[(0,U.jsx)(W,{icon:re,className:`h-5 w-5 text-white/20 mt-0.5`}),(0,U.jsx)(`p`,{className:`text-[11px] text-white/30 leading-relaxed`,children:`Las credenciales de acceso y llaves de cifrado para los headers personalizados se gestionan en una capa segura y no son visibles en texto plano para mantener la integridad de la red.`})]})]})})]})})}function K({agent:e}){let{providers:t}=S(),{models:n}=D(),r=e.role===`coordinator`,i=e.provider_id||e.providerId,s=e.model_id||e.modelId,c=e.created_at||e.createdAt,l=c?z(typeof c==`string`?new Date(c):new Date(c*1e3),`PPP`,{locale:R}):`Fecha desconocida`,u=t.find(e=>e.id===i)?.name||i,d=n.find(e=>e.id===s)?.name||s;return(0,U.jsxs)(`div`,{className:`hive-card--internal group ${e.enabled?`hive-card--internal-active`:`hive-card--internal-disabled`}`,children:[e.enabled&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`absolute -top-24 -right-24 h-64 w-64 bg-blue-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-blue-600/20 transition-all duration-700`}),(0,U.jsx)(`div`,{className:`absolute -bottom-24 -left-24 h-64 w-64 bg-purple-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-purple-600/20 transition-all duration-700`})]}),(0,U.jsxs)(`div`,{className:`relative flex flex-col md:flex-row gap-8 items-start justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`hive-icon-wrap--internal ${e.enabled?`hive-icon-wrap--internal-active`:`hive-icon-wrap--internal-disabled`}`,children:(0,U.jsx)(B,{className:`h-6 w-6 ${e.enabled?`text-blue-400`:`text-white/20`}`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,U.jsx)(`span`,{className:`hive-page-header__label ${!e.enabled&&`text-white/20`}`,children:`Identidad de Nodo`}),r&&(0,U.jsx)(I,{className:`hive-tag--coordinator ${!e.enabled&&`bg-white/5 text-white/20 border-white/10`}`,children:`Coordinador`})]}),(0,U.jsx)(`h1`,{className:`text-4xl font-black tracking-tighter ${e.enabled?`text-white`:`text-white/40`}`,children:e.name})]})]}),(0,U.jsxs)(`p`,{className:`text-lg leading-relaxed max-w-2xl font-light italic ${e.enabled?`text-white/60`:`text-white/20`}`,children:[`"`,e.description||`Este agente no tiene una descripción definida aún.`,`"`]})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,U.jsx)(q,{icon:m,label:`Infraestructura`,value:u,subValue:d,color:e.enabled?`text-blue-400`:`text-white/20`,enabled:e.enabled}),(0,U.jsx)(q,{icon:v,label:`Personalidad`,value:e.tone||`Neutral`,color:e.enabled?`text-purple-400`:`text-white/20`,enabled:e.enabled}),(0,U.jsx)(q,{icon:o,label:`Desplegado el`,value:l,color:e.enabled?`text-emerald-400`:`text-white/20`,enabled:e.enabled})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col items-center md:items-end gap-6 min-w-[200px]`,children:[(0,U.jsxs)(`div`,{className:`text-center md:text-right space-y-2`,children:[(0,U.jsx)(`span`,{className:`hive-label block`,children:`Estado Operativo`}),(0,U.jsx)(L,{status:e.enabled?e.status:`hibernated`,className:`px-6 py-2 text-sm border-2`})]}),(0,U.jsxs)(`div`,{className:`hive-network-panel md:w-auto`,children:[(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(`p`,{className:`hive-label mb-1`,children:`Carga de Red`}),(0,U.jsx)(`div`,{className:`hive-network-track`,children:e.enabled&&(0,U.jsx)(`div`,{className:`hive-network-fill`})})]}),(0,U.jsx)(a,{className:`h-5 w-5 ${e.enabled?`text-blue-400 animate-pulse`:`text-white/10`}`})]})]})]}),(0,U.jsx)(`div`,{className:`hive-strip--bottom ${!e.enabled&&`opacity-20`}`}),(0,U.jsxs)(`div`,{className:`absolute top-4 right-8 hive-mono hidden md:block`,children:[`NODE_UID: `,e.id]})]})}function q({icon:e,label:t,value:n,subValue:r,color:i,enabled:a}){return(0,U.jsxs)(`div`,{className:`hive-info-card ${a?`hive-info-card--active`:`hive-info-card--disabled`}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,U.jsx)(e,{className:`h-3.5 w-3.5 ${i}`}),(0,U.jsx)(`span`,{className:`hive-info-card__label`,children:t})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(`p`,{className:`hive-info-card__value ${a?`text-white/80 group-hover/item:text-white`:`text-white/20`}`,children:n}),r&&(0,U.jsx)(`p`,{className:`hive-info-card__sub ${a?`text-white/40`:`text-white/10`}`,children:r})]})]})}function J(){let{id:e}=b(),t=y(),n=e??`unknown`,{agents:r,fetchAgents:i,isLoading:o}=O();(0,H.useEffect)(()=>{i()},[i]);let s=r.find(e=>e.id===n);return(0,U.jsx)(`div`,{className:`min-h-screen bg-transparent pb-20`,children:(0,U.jsxs)(`div`,{className:`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,U.jsxs)(x,{variant:`ghost`,onClick:()=>t(`/agents`),className:`group flex items-center gap-2 text-white/40 hover:text-white hover:bg-white/5 px-4 py-2 rounded-xl transition-all`,children:[(0,U.jsx)(p,{className:`h-4 w-4 transition-transform group-hover:-translate-x-1`}),(0,U.jsx)(`span`,{className:`text-sm font-bold uppercase tracking-widest`,children:`Volver a la Colmena`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-4 text-white/20`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(V,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Agentes`})]}),(0,U.jsx)(`div`,{className:`h-4 w-px bg-white/10`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(a,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Detalles Operativos`})]})]})]}),s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{agent:s}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-8`,children:(0,U.jsx)(G,{agentId:n})})]}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[60vh] text-center space-y-6`,children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`div`,{className:`h-24 w-24 rounded-full border-4 border-t-blue-500 border-white/5 animate-spin`}),(0,U.jsx)(a,{className:`absolute inset-0 m-auto h-8 w-8 text-blue-400 animate-pulse`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-xl font-bold text-white mb-2`,children:`Sincronizando con el Nodo`}),(0,U.jsx)(`p`,{className:`text-white/40 max-w-xs mx-auto`,children:`Estamos recuperando la configuración cuántica de este agente desde la base de datos central.`})]})]})]})})}export{J as AgentDetailPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./vendor-query-DsWPbQdG.js";import{t}from"./AgentCreateForm-0oFbN3gj.js";var n=e();function r(){return(0,n.jsx)(t,{})}export{r as AgentNewPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{r}from"./utils-3pnRFmFe.js";import{t as i}from"./activity-c3pNngT_.js";import{t as a}from"./calendar-B-KZ9RQO.js";import{n as o,o as s,r as c,s as l,t as u}from"./dropdown-menu-BK-CO3Od.js";import{t as d}from"./cpu-Cdgc_B1K.js";import{t as f}from"./file-text-BT_9S9SM.js";import{t as p}from"./folder-open-BhH8y9ac.js";import{t as m}from"./gauge-D_TMa4i9.js";import{t as h}from"./lock-Ei1_J-Nq.js";import{t as g}from"./plus-CX1xyhp5.js";import{t as _}from"./refresh-cw-DaYdjQFk.js";import{n as v}from"./textarea-CXgXWKrT.js";import{t as y}from"./trash-2-CNjMkoq6.js";import{t as b}from"./zap-hlXjpSeA.js";import{c as x}from"./vendor-router-C9pIYwbJ.js";import{J as S,M as C,R as w,c as T,h as E,s as D,t as O,z as k}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{r}from"./utils-3pnRFmFe.js";import{t as i}from"./activity-c3pNngT_.js";import{t as a}from"./calendar-B-KZ9RQO.js";import{n as o,o as s,r as c,s as l,t as u}from"./dropdown-menu-BK-CO3Od.js";import{t as d}from"./cpu-Cdgc_B1K.js";import{t as f}from"./file-text-BT_9S9SM.js";import{t as p}from"./folder-open-BhH8y9ac.js";import{t as m}from"./gauge-D_TMa4i9.js";import{t as h}from"./lock-Ei1_J-Nq.js";import{t as g}from"./plus-CX1xyhp5.js";import{t as _}from"./refresh-cw-DaYdjQFk.js";import{n as v}from"./textarea-CXgXWKrT.js";import{t as y}from"./trash-2-CNjMkoq6.js";import{t as b}from"./zap-hlXjpSeA.js";import{c as x}from"./vendor-router-C9pIYwbJ.js";import{J as S,M as C,R as w,c as T,h as E,s as D,t as O,z as k}from"./index-CQ7fn00w.js";import{n as A,t as j}from"./es-Cg8zdT52.js";import{t as M}from"./format-GVHeOyWI.js";import{t as N}from"./AgentCreateForm-0oFbN3gj.js";var P=r(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),F=r(`Pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),I=e(t(),1),L=n();function R({agent:e,onEdit:t}){let n=x(),{deleteAgent:r}=O(),{providers:g}=T(),{models:_}=D(),S=t=>{t.target.closest(`[role="menuitem"]`)||t.target.closest(`button`)||n(`/agents/${e.id}`)},w=async t=>{if(t.stopPropagation(),(await E.fire({title:`¿Eliminar Agente?`,text:`¿Estás seguro de que deseas eliminar al agente "${e.name}"? Esta acción eliminará permanentemente su configuración.`,icon:`warning`,showCancelButton:!0,confirmButtonText:`Sí, eliminar`,cancelButtonText:`Cancelar`,reverseButtons:!0,background:`#09090b`,color:`#fff`,customClass:{popup:`border border-white/10 rounded-xl`,confirmButton:`bg-red-500 hover:bg-red-600 text-white`,cancelButton:`bg-white/10 hover:bg-white/20 text-white`}})).isConfirmed)try{await r(e.id)}catch(e){console.error(e)}},N=e.role===`coordinator`,I=e.provider_id||e.providerId,R=e.model_id||e.modelId,z=g.find(e=>e.id===I)?.name||I,B=_.find(e=>e.id===R)?.name||R,V=e.enabled?e.status:`hibernated`,H=e.toolsJson?JSON.parse(e.toolsJson):[],U=e.skillsJson?JSON.parse(e.skillsJson):[],W=H.length||0,G=U.length||0,K=!!e.systemPrompt,q=e.maxIterations||10,J=(e=>{if(!e)return null;try{return M(new Date(e),`dd MMM yyyy`,{locale:j})}catch{return null}})(e.created_at||e.createdAt);return(0,L.jsxs)(`div`,{role:`button`,tabIndex:0,className:`group relative overflow-hidden rounded-2xl border bg-black/40 backdrop-blur-xl transition-all duration-500 cursor-pointer flex flex-col h-full
|
|
2
2
|
${e.enabled?N?`border-purple-500/20 hover:border-purple-500/50 hover:bg-white/[0.03] hover:shadow-[0_0_30px_rgba(168,85,247,0.15)]`:`border-white/10 hover:border-blue-500/50 hover:bg-white/[0.03] hover:shadow-[0_0_30px_rgba(59,130,246,0.15)]`:`border-white/5 opacity-70 grayscale hover:grayscale-0`}
|
|
3
3
|
`,onClick:S,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&n(`/agents/${e.id}`)},children:[e.enabled&&(0,L.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent ${N?`via-purple-500/60`:`via-blue-500/50`} to-transparent`}),e.enabled&&(0,L.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-br ${N?`from-purple-500/10 via-transparent to-blue-500/5`:`from-blue-500/10 via-transparent to-purple-500/10`} opacity-0 transition-opacity duration-500 group-hover:opacity-100 pointer-events-none`}),(0,L.jsxs)(`div`,{className:`p-5 flex flex-col flex-1 relative z-10`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3 mb-4`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`w-11 h-11 rounded-xl flex items-center justify-center shrink-0 border transition-colors
|
|
4
4
|
${N?`bg-purple-500/10 border-purple-500/20 group-hover:border-purple-500/40`:`bg-blue-500/10 border-blue-500/20 group-hover:border-blue-500/40`}`,children:N?(0,L.jsx)(v,{className:`h-5 w-5 text-purple-400`}):(0,L.jsx)(d,{className:`h-5 w-5 text-blue-400`})}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h3`,{className:`text-base font-bold tracking-tight transition-colors truncate ${e.enabled?`text-white/95 group-hover:text-white`:`text-white/40`}`,children:e.name}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5 flex-wrap`,children:[(0,L.jsx)(`span`,{className:`text-[9px] px-2 py-0.5 rounded-full font-bold uppercase border
|