@johpaz/hive-agents 0.0.44 → 0.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +88 -38
  2. package/dist/hive.js +1273 -846
  3. package/dist/tool-worker.js +30 -0
  4. package/dist/ui/assets/{AgentCreateForm-DyeTdXUs.js → AgentCreateForm-DzaIT-dA.js} +1 -1
  5. package/dist/ui/assets/{AgentDetailPage-dmLgf2x5.js → AgentDetailPage-DgqcJceY.js} +1 -1
  6. package/dist/ui/assets/AgentNewPage-CNSpoOSA.js +1 -0
  7. package/dist/ui/assets/{AgentsPage-ilEW_WjD.js → AgentsPage-BMUJzTD6.js} +1 -1
  8. package/dist/ui/assets/{ApiClientPage-CYur6xIG.js → ApiClientPage-Cum_a_3j.js} +1 -1
  9. package/dist/ui/assets/{CanvasPage-CvMRvq84.js → CanvasPage-o6oCP6uq.js} +1 -1
  10. package/dist/ui/assets/{ChannelsPage-D4PgfYd2.js → ChannelsPage-WrB0zwLq.js} +1 -1
  11. package/dist/ui/assets/{DashboardPage-a5UQKJCG.js → DashboardPage-BCd6kNw0.js} +1 -1
  12. package/dist/ui/assets/{LoginPage-BtMt11D2.js → LoginPage-BTxJdFVG.js} +1 -1
  13. package/dist/ui/assets/{LogsPage-BeuKjg7-.js → LogsPage-DVV2eHbh.js} +1 -1
  14. package/dist/ui/assets/{MeetingPage-ClhToyd9.js → MeetingPage-BULIAWzq.js} +1 -1
  15. package/dist/ui/assets/{ModelSelector-DoMPQbsp.js → ModelSelector-BMYOChYb.js} +1 -1
  16. package/dist/ui/assets/{ProvidersPage-D6YX7qH4.js → ProvidersPage-BVN5UZrI.js} +1 -1
  17. package/dist/ui/assets/{RecoverPage-CzouUsK3.js → RecoverPage-7YDQysBL.js} +1 -1
  18. package/dist/ui/assets/SettingsPage-CYmpFfDn.js +9 -0
  19. package/dist/ui/assets/{SetupPage-DhyJWZkx.js → SetupPage-Dnmb1Lbv.js} +1 -1
  20. package/dist/ui/assets/{WebChatPage-DJVJDa6u.js → WebChatPage-DmmdFhIC.js} +1 -1
  21. package/dist/ui/assets/{alert-CwfjnQnX.js → alert-B9J6KHmt.js} +1 -1
  22. package/dist/ui/assets/{alert-dialog-BModLupB.js → alert-dialog-KcYQWcJ6.js} +1 -1
  23. package/dist/ui/assets/{badge-Cn9me8rp.js → badge-88dRb4M8.js} +1 -1
  24. package/dist/ui/assets/{dialog-BVdxpXxW.js → dialog-Jk4bieO4.js} +1 -1
  25. package/dist/ui/assets/{es-Ce6Cl5pC.js → es-4I-joeZz.js} +1 -1
  26. package/dist/ui/assets/{index-CaoDouMU.js → index-Cyw7L0Li.js} +2 -2
  27. package/dist/ui/assets/{label-CRcJ7SgM.js → label-B_15zZlR.js} +1 -1
  28. package/dist/ui/assets/{useHiveAgentsModelLoad-mAw1534H.js → useHiveAgentsModelLoad-BnC4jLE-.js} +1 -1
  29. package/dist/ui/assets/{useProviders-am-lsXGu.js → useProviders-C1xVKLxB.js} +1 -1
  30. package/dist/ui/index.html +1 -1
  31. package/package.json +1 -1
  32. package/packages/core/src/agent/goal-runner.ts +31 -2
  33. package/packages/core/src/agent/llm-client.ts +22 -1
  34. package/packages/core/src/agent/proof-packet.ts +59 -0
  35. package/packages/core/src/agent/run-epoch.ts +33 -0
  36. package/packages/core/src/agent/run-store.ts +50 -8
  37. package/packages/core/src/channels/telegram.ts +31 -2
  38. package/packages/core/src/config/loader.ts +34 -0
  39. package/packages/core/src/gateway/durable-queue.ts +49 -4
  40. package/packages/core/src/gateway/job-executors.ts +50 -11
  41. package/packages/core/src/gateway/job-store.ts +142 -4
  42. package/packages/core/src/gateway/routes/cron-api.ts +3 -2
  43. package/packages/core/src/gateway/routes/users.ts +1 -0
  44. package/packages/core/src/gateway/server.ts +24 -2
  45. package/packages/core/src/resilience/retry.ts +95 -0
  46. package/packages/core/src/scheduler/integration.ts +19 -0
  47. package/packages/core/src/storage/bootstrap.ts +3 -0
  48. package/packages/core/src/storage/collections.ts +36 -0
  49. package/packages/core/src/storage/seed.ts +26 -22
  50. package/packages/core/src/tools/agents/get-available-models.ts +11 -3
  51. package/packages/core/src/tools/agents/index.ts +12 -3
  52. package/dist/ui/assets/AgentNewPage-CgGzBw7_.js +0 -1
  53. package/dist/ui/assets/SettingsPage-BtXGg87M.js +0 -9
@@ -162029,6 +162029,21 @@ var RetryConfigSchema = object({
162029
162029
  backoffMultiplier: number2().optional(),
162030
162030
  maxDelayMs: number2().optional()
162031
162031
  });
162032
+ var JobRetryConfigSchema = object({
162033
+ maxRetries: number2().optional(),
162034
+ initialDelayMs: number2().optional(),
162035
+ backoffMultiplier: number2().optional(),
162036
+ maxDelayMs: number2().optional(),
162037
+ jitter: number2().optional()
162038
+ });
162039
+ var HarnessConfigSchema = object({
162040
+ maxGlobalConcurrency: number2().optional(),
162041
+ taskTimeoutMs: number2().optional(),
162042
+ jobLeaseMs: number2().optional(),
162043
+ runLeaseMs: number2().optional(),
162044
+ leaseRenewMs: number2().optional(),
162045
+ jobRetry: JobRetryConfigSchema.optional()
162046
+ });
162032
162047
  var HooksConfigSchema = object({
162033
162048
  scripts: object({
162034
162049
  before_model_resolve: string2().optional(),
@@ -162123,6 +162138,7 @@ var ConfigSchema = object({
162123
162138
  cron: CronConfigSchema.optional(),
162124
162139
  causalLog: CausalLogConfigSchema.optional(),
162125
162140
  retry: RetryConfigSchema.optional(),
162141
+ harness: HarnessConfigSchema.optional(),
162126
162142
  security: SecurityConfigSchema.optional(),
162127
162143
  hooks: HooksConfigSchema.optional(),
162128
162144
  captcha: CaptchaConfigSchema.optional()
@@ -162262,6 +162278,20 @@ function buildDefaultConfig() {
162262
162278
  backoffMultiplier: 2,
162263
162279
  maxDelayMs: 30000
162264
162280
  },
162281
+ harness: {
162282
+ maxGlobalConcurrency: parseInt(process.env.HIVE_HARNESS_MAX_CONCURRENCY || "4", 10),
162283
+ taskTimeoutMs: parseInt(process.env.HIVE_HARNESS_TASK_TIMEOUT_MS || String(30 * 60 * 1000), 10),
162284
+ jobLeaseMs: parseInt(process.env.HIVE_HARNESS_JOB_LEASE_MS || String(30 * 60 * 1000), 10),
162285
+ runLeaseMs: parseInt(process.env.HIVE_HARNESS_RUN_LEASE_MS || String(2 * 60 * 1000), 10),
162286
+ leaseRenewMs: parseInt(process.env.HIVE_HARNESS_LEASE_RENEW_MS || "30000", 10),
162287
+ jobRetry: {
162288
+ maxRetries: parseInt(process.env.HIVE_HARNESS_JOB_MAX_RETRIES || "3", 10),
162289
+ initialDelayMs: parseInt(process.env.HIVE_HARNESS_JOB_RETRY_INITIAL_MS || "1000", 10),
162290
+ backoffMultiplier: parseFloat(process.env.HIVE_HARNESS_JOB_RETRY_MULTIPLIER || "2"),
162291
+ maxDelayMs: parseInt(process.env.HIVE_HARNESS_JOB_RETRY_MAX_MS || String(5 * 60 * 1000), 10),
162292
+ jitter: parseFloat(process.env.HIVE_HARNESS_JOB_RETRY_JITTER || "0.2")
162293
+ }
162294
+ },
162265
162295
  security: {
162266
162296
  maxMessageLength: {
162267
162297
  telegram: 4096,
@@ -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{c as i,i as a,n as o,o as s,s as c,t as l}from"./select-BQCOjM2j.js";import{t as u}from"./circle-alert-KuAm2FWh.js";import{t as d}from"./useProviders-am-lsXGu.js";import{t as f}from"./external-link-6sTlRDUR.js";import{t as p}from"./folder-open-DJBLDFjv.js";import{t as m}from"./loader-circle-BmBOgYze.js";import{n as ee,t as h}from"./ModelSelector-DoMPQbsp.js";import{t as g}from"./shield-CxhcUT39.js";import{t as _}from"./sparkles-BhwlS1pc.js";import{A as v,R as y,f as b,j as x,m as S,s as C,t as w}from"./index-CaoDouMU.js";import{t as T}from"./label-CRcJ7SgM.js";import{t as E}from"./textarea-B6Z1Zc6W.js";import{t as D}from"./switch-BR30E4ej.js";import{a as O,c as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dialog-BVdxpXxW.js";import{a as I,n as L,o as R,r as z,t as B}from"./card-CNf6BS2e.js";var V=e(t(),1),H=n(),U=[{value:`friendly`,label:`Amigable`},{value:`professional`,label:`Profesional`},{value:`casual`,label:`Casual`},{value:`formal`,label:`Formal`},{value:`creative`,label:`Creativo`}];function W({initialData:e,onSuccess:t,onCancel:n}){let{createAgent:W,updateAgent:G,isLoading:K,error:q}=w(),{activeProviders:te}=C(),[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 b(`/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 b(`/api/workspace/create`,{method:`POST`,body:{path:X.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await Q(X.workspace)}catch(e){S.fire(`Error`,e.message,`error`)}},re=async()=>{if(X.workspace)try{await b(`/api/workspace/open?path=${encodeURIComponent(X.workspace)}`,{method:`GET`})}catch(e){S.fire(`Error`,e.message,`error`)}},ie=async n=>{if(n.preventDefault(),!X.provider_id||!X.model_id){S.fire(`Incompleto`,`Por favor selecciona un proveedor y modelo`,`warning`);return}try{e?.id?await G(e.id,X):await W(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)(ee,{className:`h-5 w-5`}):(0,H.jsx)(_,{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)(x,{variant:`ghost`,size:`icon`,onClick:n,className:`text-white/40 hover:text-white hover:bg-white/5`,children:(0,H.jsx)(y,{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)(T,{htmlFor:`name`,className:`hive-label--field`,children:`Nombre del Agente`}),(0,H.jsx)(v,{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)(T,{htmlFor:`description`,className:`hive-label--field`,children:`Descripción / Rol`}),(0,H.jsx)(E,{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)(T,{htmlFor:`systemPrompt`,className:`hive-label--field`,children:`System Prompt`}),(0,H.jsxs)(F,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.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,H.jsxs)(N,{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)(M,{children:[(0,H.jsx)(P,{className:`text-xl`,children:`Editar System Prompt`}),(0,H.jsx)(A,{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)(E,{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)(j,{asChild:!0,children:(0,H.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:`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)(p,{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)(T,{htmlFor:`workspace`,className:`hive-label--field`,children:`Directorio de Trabajo del Agente`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(v,{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)(x,{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)(f,{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)(m,{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)(i,{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)(u,{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)(p,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio no existe`}),!J.error&&(0,H.jsx)(x,{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)(d,{className:`h-4 w-4 text-blue-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Motor de Inteligencia`})]}),(0,H.jsx)(h,{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)(T,{htmlFor:`tone`,className:`hive-label--field`,children:`Tono de Voz`}),(0,H.jsxs)(l,{value:X.tone,onValueChange:e=>Z({...X,tone:e}),disabled:K,children:[(0,H.jsx)(s,{className:`hive-select-trigger`,children:(0,H.jsx)(c,{placeholder:`Selecciona un tono`})}),(0,H.jsx)(o,{className:`hive-select-content`,children:U.map(e=>(0,H.jsx)(a,{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)(g,{className:`h-3.5 w-3.5 text-purple-400`}),(0,H.jsx)(T,{htmlFor:`role`,className:`text-xs font-medium text-white/70`,children:`Rol`})]}),(0,H.jsxs)(l,{value:X.role,onValueChange:e=>Z({...X,role:e}),disabled:K,children:[(0,H.jsx)(s,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,H.jsx)(c,{})}),(0,H.jsxs)(o,{className:`bg-zinc-900 border-white/10`,children:[(0,H.jsx)(a,{value:`coordinator`,children:`Coordinador`}),(0,H.jsx)(a,{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)(T,{htmlFor:`enabled`,className:`text-xs font-medium text-white/70`,children:`Habilitado`})]}),(0,H.jsx)(D,{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)(x,{type:`button`,variant:`outline`,onClick:n,disabled:K,className:`hive-btn--form-cancel`,children:`Cancelar`}),(0,H.jsx)(x,{type:`submit`,disabled:K,className:`hive-btn--form-submit`,children:K?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(m,{className:`mr-2 h-4 w-4 animate-spin`}),`Procesando...`]}):(0,H.jsx)(H.Fragment,{children:$?`Actualizar Agente`:`Desplegar Agente`})})]})]})})]})}export{W 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{c as i,i as a,n as o,o as s,s as c,t as l}from"./select-BQCOjM2j.js";import{t as u}from"./circle-alert-KuAm2FWh.js";import{t as d}from"./useProviders-C1xVKLxB.js";import{t as f}from"./external-link-6sTlRDUR.js";import{t as p}from"./folder-open-DJBLDFjv.js";import{t as m}from"./loader-circle-BmBOgYze.js";import{n as ee,t as h}from"./ModelSelector-BMYOChYb.js";import{t as g}from"./shield-CxhcUT39.js";import{t as _}from"./sparkles-BhwlS1pc.js";import{A as v,R as y,f as b,j as x,m as S,s as C,t as w}from"./index-Cyw7L0Li.js";import{t as T}from"./label-B_15zZlR.js";import{t as E}from"./textarea-B6Z1Zc6W.js";import{t as D}from"./switch-BR30E4ej.js";import{a as O,c as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dialog-Jk4bieO4.js";import{a as I,n as L,o as R,r as z,t as B}from"./card-CNf6BS2e.js";var V=e(t(),1),H=n(),U=[{value:`friendly`,label:`Amigable`},{value:`professional`,label:`Profesional`},{value:`casual`,label:`Casual`},{value:`formal`,label:`Formal`},{value:`creative`,label:`Creativo`}];function W({initialData:e,onSuccess:t,onCancel:n}){let{createAgent:W,updateAgent:G,isLoading:K,error:q}=w(),{activeProviders:te}=C(),[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 b(`/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 b(`/api/workspace/create`,{method:`POST`,body:{path:X.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await Q(X.workspace)}catch(e){S.fire(`Error`,e.message,`error`)}},re=async()=>{if(X.workspace)try{await b(`/api/workspace/open?path=${encodeURIComponent(X.workspace)}`,{method:`GET`})}catch(e){S.fire(`Error`,e.message,`error`)}},ie=async n=>{if(n.preventDefault(),!X.provider_id||!X.model_id){S.fire(`Incompleto`,`Por favor selecciona un proveedor y modelo`,`warning`);return}try{e?.id?await G(e.id,X):await W(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)(ee,{className:`h-5 w-5`}):(0,H.jsx)(_,{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)(x,{variant:`ghost`,size:`icon`,onClick:n,className:`text-white/40 hover:text-white hover:bg-white/5`,children:(0,H.jsx)(y,{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)(T,{htmlFor:`name`,className:`hive-label--field`,children:`Nombre del Agente`}),(0,H.jsx)(v,{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)(T,{htmlFor:`description`,className:`hive-label--field`,children:`Descripción / Rol`}),(0,H.jsx)(E,{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)(T,{htmlFor:`systemPrompt`,className:`hive-label--field`,children:`System Prompt`}),(0,H.jsxs)(F,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.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,H.jsxs)(N,{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)(M,{children:[(0,H.jsx)(P,{className:`text-xl`,children:`Editar System Prompt`}),(0,H.jsx)(A,{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)(E,{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)(j,{asChild:!0,children:(0,H.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:`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)(p,{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)(T,{htmlFor:`workspace`,className:`hive-label--field`,children:`Directorio de Trabajo del Agente`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(v,{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)(x,{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)(f,{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)(m,{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)(i,{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)(u,{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)(p,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio no existe`}),!J.error&&(0,H.jsx)(x,{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)(d,{className:`h-4 w-4 text-blue-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Motor de Inteligencia`})]}),(0,H.jsx)(h,{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)(T,{htmlFor:`tone`,className:`hive-label--field`,children:`Tono de Voz`}),(0,H.jsxs)(l,{value:X.tone,onValueChange:e=>Z({...X,tone:e}),disabled:K,children:[(0,H.jsx)(s,{className:`hive-select-trigger`,children:(0,H.jsx)(c,{placeholder:`Selecciona un tono`})}),(0,H.jsx)(o,{className:`hive-select-content`,children:U.map(e=>(0,H.jsx)(a,{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)(g,{className:`h-3.5 w-3.5 text-purple-400`}),(0,H.jsx)(T,{htmlFor:`role`,className:`text-xs font-medium text-white/70`,children:`Rol`})]}),(0,H.jsxs)(l,{value:X.role,onValueChange:e=>Z({...X,role:e}),disabled:K,children:[(0,H.jsx)(s,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,H.jsx)(c,{})}),(0,H.jsxs)(o,{className:`bg-zinc-900 border-white/10`,children:[(0,H.jsx)(a,{value:`coordinator`,children:`Coordinador`}),(0,H.jsx)(a,{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)(T,{htmlFor:`enabled`,className:`text-xs font-medium text-white/70`,children:`Habilitado`})]}),(0,H.jsx)(D,{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)(x,{type:`button`,variant:`outline`,onClick:n,disabled:K,className:`hive-btn--form-cancel`,children:`Cancelar`}),(0,H.jsx)(x,{type:`submit`,disabled:K,className:`hive-btn--form-submit`,children:K?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(m,{className:`mr-2 h-4 w-4 animate-spin`}),`Procesando...`]}):(0,H.jsx)(H.Fragment,{children:$?`Actualizar Agente`:`Desplegar Agente`})})]})]})})]})}export{W 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{c as s,i as c,n as l,o as u,s as d,t as f}from"./select-BQCOjM2j.js";import{t as p}from"./chevron-left-D4U-5A27.js";import{t as m}from"./circle-alert-KuAm2FWh.js";import{t as h}from"./useProviders-am-lsXGu.js";import{t as g}from"./external-link-6sTlRDUR.js";import{t as _}from"./folder-open-DJBLDFjv.js";import{t as v}from"./loader-circle-BmBOgYze.js";import{n as ee,t as te}from"./ModelSelector-DoMPQbsp.js";import{t as y}from"./shield-CxhcUT39.js";import{t as b}from"./sparkles-BhwlS1pc.js";import{t as x}from"./zap-B4RaNNO5.js";import{c as S,l as C}from"./vendor-router-gqiZ7xhx.js";import{A as w,V as ne,f as T,h as E,j as D,o as O,p as k,q as A,s as j,t as M}from"./index-CaoDouMU.js";import{t as N}from"./label-CRcJ7SgM.js";import{t as P}from"./textarea-B6Z1Zc6W.js";import{t as F}from"./switch-BR30E4ej.js";import{a as I,c as L,i as R,n as z,o as B,r as V,s as H,t as U}from"./dialog-BVdxpXxW.js";import{t as W}from"./badge-Cn9me8rp.js";import{n as G,t as K}from"./es-Ce6Cl5pC.js";import{t as q}from"./format-DsLPBxvt.js";var J=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`}]]),Y=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`}]]),X=e(t(),1),Z=n();function Q({icon:e,...t}){return(0,Z.jsx)(e,{...t})}function re({agentId:e}){let{agents:t,updateAgent:n,fetchAgents:r}=M(),{fetchProviders:o}=j(),{fetchModels:p}=O();(0,X.useEffect)(()=>{r(),o(),p()},[r,o,p]);let h=t.find(t=>t.id===e),[x,S]=(0,X.useState)({name:``,description:``,provider_id:``,model_id:``,tone:``,role:`coordinator`,enabled:!0,headers:``,systemPrompt:``,workspace:``}),[C,W]=(0,X.useState)({isValidating:!1,exists:!1,accessible:!1});(0,X.useEffect)(()=>{h&&(S({name:h.name||``,description:h.description||``,provider_id:h.provider_id||h.providerId||``,model_id:h.model_id||h.modelId||``,tone:h.tone||``,role:h.role||`coordinator`,enabled:!!h.enabled,headers:``,systemPrompt:h.systemPrompt||``,workspace:h.workspace||``}),h.workspace&&G(h.workspace))},[h]);let G=async e=>{if(!e||e.trim()===``){W({isValidating:!1,exists:!1,accessible:!1});return}W({isValidating:!0,exists:!1,accessible:!1});try{let t=await T(`/api/workspace/validate`,{method:`POST`,body:{path:e}});W({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){W({isValidating:!1,exists:!1,accessible:!1,error:e.message})}};return h?(0,Z.jsx)(`div`,{className:`space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,Z.jsxs)(`div`,{className:`lg:col-span-1 space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`p-2 rounded-xl bg-blue-500/10 border border-blue-500/20`,children:(0,Z.jsx)(Q,{icon:ne,className:`h-4 w-4 text-blue-400`})}),(0,Z.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Identidad Base`})]}),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(N,{htmlFor:`name`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Nombre Público`}),(0,Z.jsx)(w,{id:`name`,value:x.name,onChange:e=>S(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,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(N,{htmlFor:`tone`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Tono Cognitivo`}),(0,Z.jsx)(w,{id:`tone`,value:x.tone,onChange:e=>S(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,Z.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`p-2 rounded-xl bg-purple-500/10 border border-purple-500/20`,children:(0,Z.jsx)(Q,{icon:y,className:`h-4 w-4 text-purple-400`})}),(0,Z.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Permisos de Red`})]}),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(N,{className:`text-sm font-semibold`,children:`Rol`}),(0,Z.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Coordinador o Worker`})]}),(0,Z.jsxs)(f,{value:x.role,onValueChange:e=>S(t=>({...t,role:e})),children:[(0,Z.jsx)(u,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,Z.jsx)(d,{})}),(0,Z.jsxs)(l,{className:`bg-zinc-900 border-white/10`,children:[(0,Z.jsx)(c,{value:`coordinator`,children:`Coordinador`}),(0,Z.jsx)(c,{value:`worker`,children:`Worker`})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(N,{className:`text-sm font-semibold`,children:`Nodo Activo`}),(0,Z.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Disponible para la colmena`})]}),(0,Z.jsx)(F,{checked:x.enabled,onCheckedChange:e=>S(t=>({...t,enabled:e}))})]})]})]}),(0,Z.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20`,children:(0,Z.jsx)(Q,{icon:_,className:`h-4 w-4 text-emerald-400`})}),(0,Z.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Workspace Directory`})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(N,{htmlFor:`workspace`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directorio de Trabajo`}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(w,{id:`workspace`,value:x.workspace,onChange:e=>{S(t=>({...t,workspace:e.target.value})),G(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`}),x.workspace&&C.exists&&C.accessible&&(0,Z.jsx)(D,{type:`button`,variant:`outline`,size:`icon`,onClick:async()=>{if(x.workspace)try{await T(`/api/workspace/open?path=${encodeURIComponent(x.workspace)}`,{method:`GET`})}catch(e){k.fire({icon:`error`,title:e.message})}},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,Z.jsx)(g,{className:`h-4 w-4`})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente operará. Puede ser cualquier ubicación (disco, USB, red).`}),x.workspace&&x.workspace.trim()!==``&&(0,Z.jsxs)(`div`,{className:i(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,C.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!C.isValidating&&C.exists&&C.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!C.isValidating&&C.exists&&!C.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!C.isValidating&&!C.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[C.isValidating&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{className:`h-3.5 w-3.5 animate-spin`}),(0,Z.jsx)(`span`,{children:`Validando directorio...`})]}),!C.isValidating&&C.exists&&C.accessible&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(`span`,{children:C.message||`Directorio válido y accesible`})]}),!C.isValidating&&C.exists&&!C.accessible&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(`span`,{children:C.message||`Sin permisos de lectura/escritura`})]}),!C.isValidating&&!C.exists&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(`span`,{children:C.message||`El directorio no existe`}),!C.error&&(0,Z.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,onClick:async()=>{if(x.workspace)try{await T(`/api/workspace/create`,{method:`POST`,body:{path:x.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await G(x.workspace)}catch(e){k.fire({icon:`error`,title:e.message})}},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,Z.jsx)(`div`,{className:`lg:col-span-2 space-y-6`,children:(0,Z.jsxs)(`div`,{className:`p-8 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-8`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`p-2 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,Z.jsx)(Q,{icon:b,className:`h-4 w-4 text-amber-400`})}),(0,Z.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Configuración Cognitiva`})]}),(0,Z.jsxs)(D,{onClick:async()=>{E.show(`Sincronizando configuración del agente...`);try{await n(e,{...x,role:x.role,enabled:+!!x.enabled,workspace:x.workspace||null}),k.fire({icon:`success`,title:`Cambios sincronizados correctamente`})}catch(e){k.fire({icon:`error`,title:e instanceof Error?e.message:`Error al sincronizar cambios`})}finally{E.hide()}},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,Z.jsx)(Q,{icon:ee,className:`h-4 w-4`}),`Sincronizar Cambios`]})]}),(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(N,{htmlFor:`description`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directiva de Misión (Descripción)`}),(0,Z.jsx)(P,{id:`description`,value:x.description,onChange:e=>S(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,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,Z.jsx)(N,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`System Prompt (Markdown)`}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(L,{asChild:!0,children:(0,Z.jsx)(D,{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,Z.jsxs)(V,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(H,{className:`text-xl`,children:`Editar System Prompt`}),(0,Z.jsx)(R,{className:`text-sm text-white/50`,children:`El comportamiento principal del agente. Se recomienda usar Markdown.`})]}),(0,Z.jsx)(`div`,{className:`py-2`,children:(0,Z.jsx)(P,{value:x.systemPrompt,onChange:e=>S(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,Z.jsx)(I,{children:(0,Z.jsx)(z,{asChild:!0,children:(0,Z.jsx)(D,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Listo`})})})]})]})]}),x.systemPrompt?(0,Z.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,Z.jsx)(`p`,{className:`text-xs text-white/60 font-mono whitespace-pre-wrap italic`,children:x.systemPrompt})}):(0,Z.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4`,children:(0,Z.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})})]}),(0,Z.jsx)(te,{selectedProviderId:x.provider_id||void 0,selectedModelId:x.model_id||void 0,onProviderChange:e=>S(t=>({...t,provider_id:e,model_id:``})),onModelChange:e=>S(t=>({...t,model_id:e})),typeFilter:`llm`})]}),(0,Z.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,Z.jsx)(Q,{icon:A,className:`h-5 w-5 text-white/20 mt-0.5`}),(0,Z.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.`})]})]})})]})}):(0,Z.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,Z.jsx)(Q,{icon:a,className:`h-12 w-12 text-white/10 animate-pulse`}),(0,Z.jsx)(`p`,{className:`text-white/40 font-medium`,children:`Buscando nodo en la colmena...`})]})}function ie({agent:e}){let{providers:t}=j(),{models:n}=O(),r=e.role===`coordinator`,i=e.provider_id||e.providerId,s=e.model_id||e.modelId,c=e.created_at||e.createdAt,l=c?q(typeof c==`string`?new Date(c):new Date(c*1e3),`PPP`,{locale:K}):`Fecha desconocida`,u=t.find(e=>e.id===i)?.name||i,d=n.find(e=>e.id===s)?.name||s;return(0,Z.jsxs)(`div`,{className:`hive-card--internal group ${e.enabled?`hive-card--internal-active`:`hive-card--internal-disabled`}`,children:[e.enabled&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`relative flex flex-col md:flex-row gap-8 items-start justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`hive-icon-wrap--internal ${e.enabled?`hive-icon-wrap--internal-active`:`hive-icon-wrap--internal-disabled`}`,children:(0,Z.jsx)(J,{className:`h-6 w-6 ${e.enabled?`text-blue-400`:`text-white/20`}`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,Z.jsx)(`span`,{className:`hive-page-header__label ${!e.enabled&&`text-white/20`}`,children:`Identidad de Nodo`}),r&&(0,Z.jsx)(W,{className:`hive-tag--coordinator ${!e.enabled&&`bg-white/5 text-white/20 border-white/10`}`,children:`Coordinador`})]}),(0,Z.jsx)(`h1`,{className:`text-4xl font-black tracking-tighter ${e.enabled?`text-white`:`text-white/40`}`,children:e.name})]})]}),(0,Z.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,Z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,Z.jsx)($,{icon:h,label:`Infraestructura`,value:u,subValue:d,color:e.enabled?`text-blue-400`:`text-white/20`,enabled:e.enabled}),(0,Z.jsx)($,{icon:x,label:`Personalidad`,value:e.tone||`Neutral`,color:e.enabled?`text-purple-400`:`text-white/20`,enabled:e.enabled}),(0,Z.jsx)($,{icon:o,label:`Desplegado el`,value:l,color:e.enabled?`text-emerald-400`:`text-white/20`,enabled:e.enabled})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-center md:items-end gap-6 min-w-[200px]`,children:[(0,Z.jsxs)(`div`,{className:`text-center md:text-right space-y-2`,children:[(0,Z.jsx)(`span`,{className:`hive-label block`,children:`Estado Operativo`}),(0,Z.jsx)(G,{status:e.enabled?e.status:`hibernated`,className:`px-6 py-2 text-sm border-2`})]}),(0,Z.jsxs)(`div`,{className:`hive-network-panel md:w-auto`,children:[(0,Z.jsxs)(`div`,{className:`flex-1`,children:[(0,Z.jsx)(`p`,{className:`hive-label mb-1`,children:`Carga de Red`}),(0,Z.jsx)(`div`,{className:`hive-network-track`,children:e.enabled&&(0,Z.jsx)(`div`,{className:`hive-network-fill`})})]}),(0,Z.jsx)(a,{className:`h-5 w-5 ${e.enabled?`text-blue-400 animate-pulse`:`text-white/10`}`})]})]})]}),(0,Z.jsx)(`div`,{className:`hive-strip--bottom ${!e.enabled&&`opacity-20`}`}),(0,Z.jsxs)(`div`,{className:`absolute top-4 right-8 hive-mono hidden md:block`,children:[`NODE_UID: `,e.id]})]})}function $({icon:e,label:t,value:n,subValue:r,color:i,enabled:a}){return(0,Z.jsxs)(`div`,{className:`hive-info-card ${a?`hive-info-card--active`:`hive-info-card--disabled`}`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Z.jsx)(e,{className:`h-3.5 w-3.5 ${i}`}),(0,Z.jsx)(`span`,{className:`hive-info-card__label`,children:t})]}),(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`hive-info-card__value ${a?`text-white/80 group-hover/item:text-white`:`text-white/20`}`,children:n}),r&&(0,Z.jsx)(`p`,{className:`hive-info-card__sub ${a?`text-white/40`:`text-white/10`}`,children:r})]})]})}function ae(){let{id:e}=C(),t=S(),n=e??`unknown`,{agents:r,fetchAgents:i,isLoading:o}=M();(0,X.useEffect)(()=>{i()},[i]);let s=r.find(e=>e.id===n);return(0,Z.jsx)(`div`,{className:`min-h-screen bg-transparent pb-20`,children:(0,Z.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,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,Z.jsxs)(D,{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,Z.jsx)(p,{className:`h-4 w-4 transition-transform group-hover:-translate-x-1`}),(0,Z.jsx)(`span`,{className:`text-sm font-bold uppercase tracking-widest`,children:`Volver a la Colmena`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 text-white/20`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Y,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Agentes`})]}),(0,Z.jsx)(`div`,{className:`h-4 w-px bg-white/10`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(a,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Detalles Operativos`})]})]})]}),s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ie,{agent:s}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-8`,children:(0,Z.jsx)(re,{agentId:n})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[60vh] text-center space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`div`,{className:`h-24 w-24 rounded-full border-4 border-t-blue-500 border-white/5 animate-spin`}),(0,Z.jsx)(a,{className:`absolute inset-0 m-auto h-8 w-8 text-blue-400 animate-pulse`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-xl font-bold text-white mb-2`,children:`Sincronizando con el Nodo`}),(0,Z.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{ae 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{c as s,i as c,n as l,o as u,s as d,t as f}from"./select-BQCOjM2j.js";import{t as p}from"./chevron-left-D4U-5A27.js";import{t as m}from"./circle-alert-KuAm2FWh.js";import{t as h}from"./useProviders-C1xVKLxB.js";import{t as g}from"./external-link-6sTlRDUR.js";import{t as _}from"./folder-open-DJBLDFjv.js";import{t as v}from"./loader-circle-BmBOgYze.js";import{n as ee,t as te}from"./ModelSelector-BMYOChYb.js";import{t as y}from"./shield-CxhcUT39.js";import{t as b}from"./sparkles-BhwlS1pc.js";import{t as x}from"./zap-B4RaNNO5.js";import{c as S,l as C}from"./vendor-router-gqiZ7xhx.js";import{A as w,V as ne,f as T,h as E,j as D,o as O,p as k,q as A,s as j,t as M}from"./index-Cyw7L0Li.js";import{t as N}from"./label-B_15zZlR.js";import{t as P}from"./textarea-B6Z1Zc6W.js";import{t as F}from"./switch-BR30E4ej.js";import{a as I,c as L,i as R,n as z,o as B,r as V,s as H,t as U}from"./dialog-Jk4bieO4.js";import{t as W}from"./badge-88dRb4M8.js";import{n as G,t as K}from"./es-4I-joeZz.js";import{t as q}from"./format-DsLPBxvt.js";var J=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`}]]),Y=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`}]]),X=e(t(),1),Z=n();function Q({icon:e,...t}){return(0,Z.jsx)(e,{...t})}function re({agentId:e}){let{agents:t,updateAgent:n,fetchAgents:r}=M(),{fetchProviders:o}=j(),{fetchModels:p}=O();(0,X.useEffect)(()=>{r(),o(),p()},[r,o,p]);let h=t.find(t=>t.id===e),[x,S]=(0,X.useState)({name:``,description:``,provider_id:``,model_id:``,tone:``,role:`coordinator`,enabled:!0,headers:``,systemPrompt:``,workspace:``}),[C,W]=(0,X.useState)({isValidating:!1,exists:!1,accessible:!1});(0,X.useEffect)(()=>{h&&(S({name:h.name||``,description:h.description||``,provider_id:h.provider_id||h.providerId||``,model_id:h.model_id||h.modelId||``,tone:h.tone||``,role:h.role||`coordinator`,enabled:!!h.enabled,headers:``,systemPrompt:h.systemPrompt||``,workspace:h.workspace||``}),h.workspace&&G(h.workspace))},[h]);let G=async e=>{if(!e||e.trim()===``){W({isValidating:!1,exists:!1,accessible:!1});return}W({isValidating:!0,exists:!1,accessible:!1});try{let t=await T(`/api/workspace/validate`,{method:`POST`,body:{path:e}});W({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){W({isValidating:!1,exists:!1,accessible:!1,error:e.message})}};return h?(0,Z.jsx)(`div`,{className:`space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,Z.jsxs)(`div`,{className:`lg:col-span-1 space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`p-2 rounded-xl bg-blue-500/10 border border-blue-500/20`,children:(0,Z.jsx)(Q,{icon:ne,className:`h-4 w-4 text-blue-400`})}),(0,Z.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Identidad Base`})]}),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(N,{htmlFor:`name`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Nombre Público`}),(0,Z.jsx)(w,{id:`name`,value:x.name,onChange:e=>S(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,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(N,{htmlFor:`tone`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Tono Cognitivo`}),(0,Z.jsx)(w,{id:`tone`,value:x.tone,onChange:e=>S(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,Z.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`p-2 rounded-xl bg-purple-500/10 border border-purple-500/20`,children:(0,Z.jsx)(Q,{icon:y,className:`h-4 w-4 text-purple-400`})}),(0,Z.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Permisos de Red`})]}),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(N,{className:`text-sm font-semibold`,children:`Rol`}),(0,Z.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Coordinador o Worker`})]}),(0,Z.jsxs)(f,{value:x.role,onValueChange:e=>S(t=>({...t,role:e})),children:[(0,Z.jsx)(u,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,Z.jsx)(d,{})}),(0,Z.jsxs)(l,{className:`bg-zinc-900 border-white/10`,children:[(0,Z.jsx)(c,{value:`coordinator`,children:`Coordinador`}),(0,Z.jsx)(c,{value:`worker`,children:`Worker`})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(N,{className:`text-sm font-semibold`,children:`Nodo Activo`}),(0,Z.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Disponible para la colmena`})]}),(0,Z.jsx)(F,{checked:x.enabled,onCheckedChange:e=>S(t=>({...t,enabled:e}))})]})]})]}),(0,Z.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20`,children:(0,Z.jsx)(Q,{icon:_,className:`h-4 w-4 text-emerald-400`})}),(0,Z.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Workspace Directory`})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(N,{htmlFor:`workspace`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directorio de Trabajo`}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(w,{id:`workspace`,value:x.workspace,onChange:e=>{S(t=>({...t,workspace:e.target.value})),G(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`}),x.workspace&&C.exists&&C.accessible&&(0,Z.jsx)(D,{type:`button`,variant:`outline`,size:`icon`,onClick:async()=>{if(x.workspace)try{await T(`/api/workspace/open?path=${encodeURIComponent(x.workspace)}`,{method:`GET`})}catch(e){k.fire({icon:`error`,title:e.message})}},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,Z.jsx)(g,{className:`h-4 w-4`})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente operará. Puede ser cualquier ubicación (disco, USB, red).`}),x.workspace&&x.workspace.trim()!==``&&(0,Z.jsxs)(`div`,{className:i(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,C.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!C.isValidating&&C.exists&&C.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!C.isValidating&&C.exists&&!C.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!C.isValidating&&!C.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[C.isValidating&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{className:`h-3.5 w-3.5 animate-spin`}),(0,Z.jsx)(`span`,{children:`Validando directorio...`})]}),!C.isValidating&&C.exists&&C.accessible&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(`span`,{children:C.message||`Directorio válido y accesible`})]}),!C.isValidating&&C.exists&&!C.accessible&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(`span`,{children:C.message||`Sin permisos de lectura/escritura`})]}),!C.isValidating&&!C.exists&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(`span`,{children:C.message||`El directorio no existe`}),!C.error&&(0,Z.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,onClick:async()=>{if(x.workspace)try{await T(`/api/workspace/create`,{method:`POST`,body:{path:x.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await G(x.workspace)}catch(e){k.fire({icon:`error`,title:e.message})}},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,Z.jsx)(`div`,{className:`lg:col-span-2 space-y-6`,children:(0,Z.jsxs)(`div`,{className:`p-8 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-8`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`p-2 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,Z.jsx)(Q,{icon:b,className:`h-4 w-4 text-amber-400`})}),(0,Z.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Configuración Cognitiva`})]}),(0,Z.jsxs)(D,{onClick:async()=>{E.show(`Sincronizando configuración del agente...`);try{await n(e,{...x,role:x.role,enabled:+!!x.enabled,workspace:x.workspace||null}),k.fire({icon:`success`,title:`Cambios sincronizados correctamente`})}catch(e){k.fire({icon:`error`,title:e instanceof Error?e.message:`Error al sincronizar cambios`})}finally{E.hide()}},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,Z.jsx)(Q,{icon:ee,className:`h-4 w-4`}),`Sincronizar Cambios`]})]}),(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(N,{htmlFor:`description`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directiva de Misión (Descripción)`}),(0,Z.jsx)(P,{id:`description`,value:x.description,onChange:e=>S(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,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,Z.jsx)(N,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`System Prompt (Markdown)`}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(L,{asChild:!0,children:(0,Z.jsx)(D,{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,Z.jsxs)(V,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(H,{className:`text-xl`,children:`Editar System Prompt`}),(0,Z.jsx)(R,{className:`text-sm text-white/50`,children:`El comportamiento principal del agente. Se recomienda usar Markdown.`})]}),(0,Z.jsx)(`div`,{className:`py-2`,children:(0,Z.jsx)(P,{value:x.systemPrompt,onChange:e=>S(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,Z.jsx)(I,{children:(0,Z.jsx)(z,{asChild:!0,children:(0,Z.jsx)(D,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Listo`})})})]})]})]}),x.systemPrompt?(0,Z.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,Z.jsx)(`p`,{className:`text-xs text-white/60 font-mono whitespace-pre-wrap italic`,children:x.systemPrompt})}):(0,Z.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4`,children:(0,Z.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})})]}),(0,Z.jsx)(te,{selectedProviderId:x.provider_id||void 0,selectedModelId:x.model_id||void 0,onProviderChange:e=>S(t=>({...t,provider_id:e,model_id:``})),onModelChange:e=>S(t=>({...t,model_id:e})),typeFilter:`llm`})]}),(0,Z.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,Z.jsx)(Q,{icon:A,className:`h-5 w-5 text-white/20 mt-0.5`}),(0,Z.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.`})]})]})})]})}):(0,Z.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,Z.jsx)(Q,{icon:a,className:`h-12 w-12 text-white/10 animate-pulse`}),(0,Z.jsx)(`p`,{className:`text-white/40 font-medium`,children:`Buscando nodo en la colmena...`})]})}function ie({agent:e}){let{providers:t}=j(),{models:n}=O(),r=e.role===`coordinator`,i=e.provider_id||e.providerId,s=e.model_id||e.modelId,c=e.created_at||e.createdAt,l=c?q(typeof c==`string`?new Date(c):new Date(c*1e3),`PPP`,{locale:K}):`Fecha desconocida`,u=t.find(e=>e.id===i)?.name||i,d=n.find(e=>e.id===s)?.name||s;return(0,Z.jsxs)(`div`,{className:`hive-card--internal group ${e.enabled?`hive-card--internal-active`:`hive-card--internal-disabled`}`,children:[e.enabled&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`relative flex flex-col md:flex-row gap-8 items-start justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`hive-icon-wrap--internal ${e.enabled?`hive-icon-wrap--internal-active`:`hive-icon-wrap--internal-disabled`}`,children:(0,Z.jsx)(J,{className:`h-6 w-6 ${e.enabled?`text-blue-400`:`text-white/20`}`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,Z.jsx)(`span`,{className:`hive-page-header__label ${!e.enabled&&`text-white/20`}`,children:`Identidad de Nodo`}),r&&(0,Z.jsx)(W,{className:`hive-tag--coordinator ${!e.enabled&&`bg-white/5 text-white/20 border-white/10`}`,children:`Coordinador`})]}),(0,Z.jsx)(`h1`,{className:`text-4xl font-black tracking-tighter ${e.enabled?`text-white`:`text-white/40`}`,children:e.name})]})]}),(0,Z.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,Z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,Z.jsx)($,{icon:h,label:`Infraestructura`,value:u,subValue:d,color:e.enabled?`text-blue-400`:`text-white/20`,enabled:e.enabled}),(0,Z.jsx)($,{icon:x,label:`Personalidad`,value:e.tone||`Neutral`,color:e.enabled?`text-purple-400`:`text-white/20`,enabled:e.enabled}),(0,Z.jsx)($,{icon:o,label:`Desplegado el`,value:l,color:e.enabled?`text-emerald-400`:`text-white/20`,enabled:e.enabled})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-center md:items-end gap-6 min-w-[200px]`,children:[(0,Z.jsxs)(`div`,{className:`text-center md:text-right space-y-2`,children:[(0,Z.jsx)(`span`,{className:`hive-label block`,children:`Estado Operativo`}),(0,Z.jsx)(G,{status:e.enabled?e.status:`hibernated`,className:`px-6 py-2 text-sm border-2`})]}),(0,Z.jsxs)(`div`,{className:`hive-network-panel md:w-auto`,children:[(0,Z.jsxs)(`div`,{className:`flex-1`,children:[(0,Z.jsx)(`p`,{className:`hive-label mb-1`,children:`Carga de Red`}),(0,Z.jsx)(`div`,{className:`hive-network-track`,children:e.enabled&&(0,Z.jsx)(`div`,{className:`hive-network-fill`})})]}),(0,Z.jsx)(a,{className:`h-5 w-5 ${e.enabled?`text-blue-400 animate-pulse`:`text-white/10`}`})]})]})]}),(0,Z.jsx)(`div`,{className:`hive-strip--bottom ${!e.enabled&&`opacity-20`}`}),(0,Z.jsxs)(`div`,{className:`absolute top-4 right-8 hive-mono hidden md:block`,children:[`NODE_UID: `,e.id]})]})}function $({icon:e,label:t,value:n,subValue:r,color:i,enabled:a}){return(0,Z.jsxs)(`div`,{className:`hive-info-card ${a?`hive-info-card--active`:`hive-info-card--disabled`}`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Z.jsx)(e,{className:`h-3.5 w-3.5 ${i}`}),(0,Z.jsx)(`span`,{className:`hive-info-card__label`,children:t})]}),(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`hive-info-card__value ${a?`text-white/80 group-hover/item:text-white`:`text-white/20`}`,children:n}),r&&(0,Z.jsx)(`p`,{className:`hive-info-card__sub ${a?`text-white/40`:`text-white/10`}`,children:r})]})]})}function ae(){let{id:e}=C(),t=S(),n=e??`unknown`,{agents:r,fetchAgents:i,isLoading:o}=M();(0,X.useEffect)(()=>{i()},[i]);let s=r.find(e=>e.id===n);return(0,Z.jsx)(`div`,{className:`min-h-screen bg-transparent pb-20`,children:(0,Z.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,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,Z.jsxs)(D,{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,Z.jsx)(p,{className:`h-4 w-4 transition-transform group-hover:-translate-x-1`}),(0,Z.jsx)(`span`,{className:`text-sm font-bold uppercase tracking-widest`,children:`Volver a la Colmena`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 text-white/20`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Y,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Agentes`})]}),(0,Z.jsx)(`div`,{className:`h-4 w-px bg-white/10`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(a,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Detalles Operativos`})]})]})]}),s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ie,{agent:s}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-8`,children:(0,Z.jsx)(re,{agentId:n})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[60vh] text-center space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`div`,{className:`h-24 w-24 rounded-full border-4 border-t-blue-500 border-white/5 animate-spin`}),(0,Z.jsx)(a,{className:`absolute inset-0 m-auto h-8 w-8 text-blue-400 animate-pulse`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-xl font-bold text-white mb-2`,children:`Sincronizando con el Nodo`}),(0,Z.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{ae as AgentDetailPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./vendor-query-DsWPbQdG.js";import{t}from"./AgentCreateForm-DzaIT-dA.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-DDiaHg5y.js";import{t as d}from"./useProviders-am-lsXGu.js";import{t as f}from"./file-text-lnxnjBp0.js";import{t as p}from"./folder-open-DJBLDFjv.js";import{t as m}from"./gauge-B8Tj43rC.js";import{t as h}from"./lock-BS6OLXPv.js";import{t as g}from"./plus-BZQX26Dr.js";import{t as _}from"./refresh-cw-CCzDCAuz.js";import{t as v}from"./shield-CxhcUT39.js";import{t as y}from"./trash-2-xD2o4SgX.js";import{t as b}from"./zap-B4RaNNO5.js";import{c as x}from"./vendor-router-gqiZ7xhx.js";import{R as S,Y as C,j as w,m as T,o as E,s as D,t as O,z as k}from"./index-CaoDouMU.js";import{n as A,t as j}from"./es-Ce6Cl5pC.js";import{t as M}from"./format-DsLPBxvt.js";import{t as N}from"./AgentCreateForm-DyeTdXUs.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}=D(),{models:_}=E(),S=t=>{t.target.closest(`[role="menuitem"]`)||t.target.closest(`button`)||n(`/agents/${e.id}`)},C=async t=>{if(t.stopPropagation(),(await T.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
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-DDiaHg5y.js";import{t as d}from"./useProviders-C1xVKLxB.js";import{t as f}from"./file-text-lnxnjBp0.js";import{t as p}from"./folder-open-DJBLDFjv.js";import{t as m}from"./gauge-B8Tj43rC.js";import{t as h}from"./lock-BS6OLXPv.js";import{t as g}from"./plus-BZQX26Dr.js";import{t as _}from"./refresh-cw-CCzDCAuz.js";import{t as v}from"./shield-CxhcUT39.js";import{t as y}from"./trash-2-xD2o4SgX.js";import{t as b}from"./zap-B4RaNNO5.js";import{c as x}from"./vendor-router-gqiZ7xhx.js";import{R as S,Y as C,j as w,m as T,o as E,s as D,t as O,z as k}from"./index-Cyw7L0Li.js";import{n as A,t as j}from"./es-4I-joeZz.js";import{t as M}from"./format-DsLPBxvt.js";import{t as N}from"./AgentCreateForm-DzaIT-dA.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}=D(),{models:_}=E(),S=t=>{t.target.closest(`[role="menuitem"]`)||t.target.closest(`button`)||n(`/agents/${e.id}`)},C=async t=>{if(t.stopPropagation(),(await T.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
@@ -1,3 +1,3 @@
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{i,n as a,o,s,t as ee}from"./select-BQCOjM2j.js";import{t as c}from"./chevron-down-DIosfU_U.js";import{t as l}from"./chevron-right-CR4Skrf3.js";import{t as te}from"./circle-check-6Ard1-2z.js";import{t as u}from"./circle-x-DjLkFDO8.js";import{t as d}from"./copy-Bu5d7C-0.js";import{t as f}from"./history-CAF_R34_.js";import{t as p}from"./plus-BZQX26Dr.js";import{t as ne}from"./send-BPk9XbIq.js";import{t as m}from"./trash-2-xD2o4SgX.js";import{A as h,J as g,f as _,j as v,q as y}from"./index-CaoDouMU.js";import{t as b}from"./textarea-B6Z1Zc6W.js";import{a as x,n as S,o as C,t as w}from"./card-CNf6BS2e.js";import{t as T}from"./badge-Cn9me8rp.js";import{i as E,n as D,r as O,t as k}from"./tabs-LQidMKRS.js";import{t as A}from"./scroll-area-CihOx0cb.js";var j=e(t(),1),M=n(),re=[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`];function N(){return Math.random().toString(36).substring(2,9)}function P(){return{id:N(),key:``,value:``,enabled:!0}}function F(){let[e,t]=(0,j.useState)(`GET`),[n,F]=(0,j.useState)(``),[I,L]=(0,j.useState)([P()]),[R,z]=(0,j.useState)([P()]),[B,V]=(0,j.useState)(``),[H,U]=(0,j.useState)(null),[W,G]=(0,j.useState)(!1),[K,q]=(0,j.useState)(0),[J,Y]=(0,j.useState)([]),[X,ie]=(0,j.useState)(!1),[ae,oe]=(0,j.useState)(`body`);(0,j.useEffect)(()=>{try{let e=localStorage.getItem(`hive-api-client-history`);e&&Y(JSON.parse(e))}catch{}},[]);let se=(0,j.useCallback)(e=>{localStorage.setItem(`hive-api-client-history`,JSON.stringify(e.slice(0,50)))},[]),Z=(e,t,n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))},ce=(e,t)=>{t([...e,P()])},le=(e,t,n)=>{e.length===1?t([P()]):t(e.filter(e=>e.id!==n))},ue=()=>{let e={};for(let t of I)t.enabled&&t.key.trim()&&(e[t.key.trim()]=t.value);return e},de=()=>{let e={};for(let t of R)t.enabled&&t.key.trim()&&(e[t.key.trim()]=t.value);return e},Q=async()=>{if(!n.trim())return;G(!0),U(null);let t=performance.now();try{let r={method:e,url:n.trim(),headers:ue(),query_params:de()};B.trim()&&e!==`GET`&&e!==`HEAD`&&(r.body=B.trim());let i=await _(`/api/http-request`,{method:`POST`,body:r,showError:!1});q(Math.round(performance.now()-t)),U(i);let a=[{id:N(),method:e,url:n.trim(),timestamp:Date.now(),status:i.status,ok:i.ok},...J];Y(a),se(a)}catch(e){q(Math.round(performance.now()-t)),U({ok:!1,error:e.message||`Request failed`})}finally{G(!1)}},fe=e=>{t(e.method),F(e.url),U(null)},pe=e=>{navigator.clipboard.writeText(e)},me=e=>{if(e==null)return``;if(typeof e==`string`)try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}return JSON.stringify(e,null,2)},he=e=>e?e>=200&&e<300?`bg-green-500`:e>=300&&e<400?`bg-yellow-500`:e>=400&&e<500?`bg-orange-500`:`bg-red-500`:`bg-gray-500`,$=(e,t,n,r)=>(0,M.jsxs)(`div`,{className:`space-y-2`,children:[e.map(i=>(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:i.enabled,onChange:n=>Z(e,t,i.id,`enabled`,n.target.checked),className:`h-4 w-4 rounded border-white/20 bg-background`}),(0,M.jsx)(h,{placeholder:n,value:i.key,onChange:n=>Z(e,t,i.id,`key`,n.target.value),className:`h-8 text-xs bg-background/50`}),(0,M.jsx)(h,{placeholder:r,value:i.value,onChange:n=>Z(e,t,i.id,`value`,n.target.value),className:`h-8 text-xs bg-background/50`}),(0,M.jsx)(v,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground hover:text-red-400`,onClick:()=>le(e,t,i.id),children:(0,M.jsx)(m,{className:`h-3.5 w-3.5`})})]},i.id)),(0,M.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-xs text-muted-foreground hover:text-primary`,onClick:()=>ce(e,t),children:[(0,M.jsx)(p,{className:`h-3.5 w-3.5 mr-1`}),`Agregar`]})]});return(0,M.jsxs)(`div`,{className:`hive-page-container animate-fade-in mt-10`,children:[(0,M.jsx)(`div`,{className:`hive-page-header mb-6`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,M.jsx)(`div`,{className:`h-10 w-10 rounded-xl bg-purple-500/10 border border-purple-500/20 flex items-center justify-center text-purple-400`,children:(0,M.jsx)(y,{className:`h-6 w-6`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-3xl font-black text-white uppercase tracking-tighter`,children:`API Client`}),(0,M.jsx)(`p`,{className:`hive-subtitle`,children:`Cliente HTTP para probar endpoints REST directamente desde Hive.`})]})]})}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-6`,children:[(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(w,{className:`border-white/10 bg-card/50`,children:(0,M.jsx)(S,{className:`p-4`,children:(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(ee,{value:e,onValueChange:t,children:[(0,M.jsx)(o,{className:`w-[110px] h-10 text-xs font-bold tracking-wider`,children:(0,M.jsx)(s,{})}),(0,M.jsx)(a,{children:re.map(e=>(0,M.jsx)(i,{value:e,className:`text-xs font-bold`,children:e},e))})]}),(0,M.jsx)(h,{placeholder:`https://api.example.com/endpoint`,value:n,onChange:e=>F(e.target.value),onKeyDown:e=>e.key===`Enter`&&Q(),className:`h-10 text-sm bg-background/50 font-mono`}),(0,M.jsxs)(v,{onClick:Q,disabled:W||!n.trim(),className:`h-10 px-6 bg-purple-600 hover:bg-purple-500 text-white font-bold text-xs tracking-wider`,children:[W?(0,M.jsx)(g,{className:`h-4 w-4 animate-spin mr-2`}):(0,M.jsx)(ne,{className:`h-4 w-4 mr-2`}),`ENVIAR`]})]})})}),(0,M.jsx)(w,{className:`border-white/10 bg-card/50`,children:(0,M.jsx)(S,{className:`p-4`,children:(0,M.jsxs)(k,{defaultValue:`headers`,className:`w-full`,children:[(0,M.jsxs)(O,{className:`bg-background/50 h-8`,children:[(0,M.jsxs)(E,{value:`headers`,className:`text-xs h-7`,children:[`Headers (`,I.filter(e=>e.enabled&&e.key.trim()).length,`)`]}),(0,M.jsxs)(E,{value:`query`,className:`text-xs h-7`,children:[`Query Params (`,R.filter(e=>e.enabled&&e.key.trim()).length,`)`]}),(0,M.jsx)(E,{value:`body`,className:`text-xs h-7`,children:`Body`})]}),(0,M.jsx)(D,{value:`headers`,className:`mt-3`,children:$(I,L,`Header`,`Value`)}),(0,M.jsx)(D,{value:`query`,className:`mt-3`,children:$(R,z,`Key`,`Value`)}),(0,M.jsxs)(D,{value:`body`,className:`mt-3`,children:[(0,M.jsx)(b,{placeholder:`{
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{i,n as a,o,s,t as ee}from"./select-BQCOjM2j.js";import{t as c}from"./chevron-down-DIosfU_U.js";import{t as l}from"./chevron-right-CR4Skrf3.js";import{t as te}from"./circle-check-6Ard1-2z.js";import{t as u}from"./circle-x-DjLkFDO8.js";import{t as d}from"./copy-Bu5d7C-0.js";import{t as f}from"./history-CAF_R34_.js";import{t as p}from"./plus-BZQX26Dr.js";import{t as ne}from"./send-BPk9XbIq.js";import{t as m}from"./trash-2-xD2o4SgX.js";import{A as h,J as g,f as _,j as v,q as y}from"./index-Cyw7L0Li.js";import{t as b}from"./textarea-B6Z1Zc6W.js";import{a as x,n as S,o as C,t as w}from"./card-CNf6BS2e.js";import{t as T}from"./badge-88dRb4M8.js";import{i as E,n as D,r as O,t as k}from"./tabs-LQidMKRS.js";import{t as A}from"./scroll-area-CihOx0cb.js";var j=e(t(),1),M=n(),re=[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`];function N(){return Math.random().toString(36).substring(2,9)}function P(){return{id:N(),key:``,value:``,enabled:!0}}function F(){let[e,t]=(0,j.useState)(`GET`),[n,F]=(0,j.useState)(``),[I,L]=(0,j.useState)([P()]),[R,z]=(0,j.useState)([P()]),[B,V]=(0,j.useState)(``),[H,U]=(0,j.useState)(null),[W,G]=(0,j.useState)(!1),[K,q]=(0,j.useState)(0),[J,Y]=(0,j.useState)([]),[X,ie]=(0,j.useState)(!1),[ae,oe]=(0,j.useState)(`body`);(0,j.useEffect)(()=>{try{let e=localStorage.getItem(`hive-api-client-history`);e&&Y(JSON.parse(e))}catch{}},[]);let se=(0,j.useCallback)(e=>{localStorage.setItem(`hive-api-client-history`,JSON.stringify(e.slice(0,50)))},[]),Z=(e,t,n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))},ce=(e,t)=>{t([...e,P()])},le=(e,t,n)=>{e.length===1?t([P()]):t(e.filter(e=>e.id!==n))},ue=()=>{let e={};for(let t of I)t.enabled&&t.key.trim()&&(e[t.key.trim()]=t.value);return e},de=()=>{let e={};for(let t of R)t.enabled&&t.key.trim()&&(e[t.key.trim()]=t.value);return e},Q=async()=>{if(!n.trim())return;G(!0),U(null);let t=performance.now();try{let r={method:e,url:n.trim(),headers:ue(),query_params:de()};B.trim()&&e!==`GET`&&e!==`HEAD`&&(r.body=B.trim());let i=await _(`/api/http-request`,{method:`POST`,body:r,showError:!1});q(Math.round(performance.now()-t)),U(i);let a=[{id:N(),method:e,url:n.trim(),timestamp:Date.now(),status:i.status,ok:i.ok},...J];Y(a),se(a)}catch(e){q(Math.round(performance.now()-t)),U({ok:!1,error:e.message||`Request failed`})}finally{G(!1)}},fe=e=>{t(e.method),F(e.url),U(null)},pe=e=>{navigator.clipboard.writeText(e)},me=e=>{if(e==null)return``;if(typeof e==`string`)try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}return JSON.stringify(e,null,2)},he=e=>e?e>=200&&e<300?`bg-green-500`:e>=300&&e<400?`bg-yellow-500`:e>=400&&e<500?`bg-orange-500`:`bg-red-500`:`bg-gray-500`,$=(e,t,n,r)=>(0,M.jsxs)(`div`,{className:`space-y-2`,children:[e.map(i=>(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:i.enabled,onChange:n=>Z(e,t,i.id,`enabled`,n.target.checked),className:`h-4 w-4 rounded border-white/20 bg-background`}),(0,M.jsx)(h,{placeholder:n,value:i.key,onChange:n=>Z(e,t,i.id,`key`,n.target.value),className:`h-8 text-xs bg-background/50`}),(0,M.jsx)(h,{placeholder:r,value:i.value,onChange:n=>Z(e,t,i.id,`value`,n.target.value),className:`h-8 text-xs bg-background/50`}),(0,M.jsx)(v,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground hover:text-red-400`,onClick:()=>le(e,t,i.id),children:(0,M.jsx)(m,{className:`h-3.5 w-3.5`})})]},i.id)),(0,M.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-xs text-muted-foreground hover:text-primary`,onClick:()=>ce(e,t),children:[(0,M.jsx)(p,{className:`h-3.5 w-3.5 mr-1`}),`Agregar`]})]});return(0,M.jsxs)(`div`,{className:`hive-page-container animate-fade-in mt-10`,children:[(0,M.jsx)(`div`,{className:`hive-page-header mb-6`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,M.jsx)(`div`,{className:`h-10 w-10 rounded-xl bg-purple-500/10 border border-purple-500/20 flex items-center justify-center text-purple-400`,children:(0,M.jsx)(y,{className:`h-6 w-6`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-3xl font-black text-white uppercase tracking-tighter`,children:`API Client`}),(0,M.jsx)(`p`,{className:`hive-subtitle`,children:`Cliente HTTP para probar endpoints REST directamente desde Hive.`})]})]})}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-6`,children:[(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(w,{className:`border-white/10 bg-card/50`,children:(0,M.jsx)(S,{className:`p-4`,children:(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(ee,{value:e,onValueChange:t,children:[(0,M.jsx)(o,{className:`w-[110px] h-10 text-xs font-bold tracking-wider`,children:(0,M.jsx)(s,{})}),(0,M.jsx)(a,{children:re.map(e=>(0,M.jsx)(i,{value:e,className:`text-xs font-bold`,children:e},e))})]}),(0,M.jsx)(h,{placeholder:`https://api.example.com/endpoint`,value:n,onChange:e=>F(e.target.value),onKeyDown:e=>e.key===`Enter`&&Q(),className:`h-10 text-sm bg-background/50 font-mono`}),(0,M.jsxs)(v,{onClick:Q,disabled:W||!n.trim(),className:`h-10 px-6 bg-purple-600 hover:bg-purple-500 text-white font-bold text-xs tracking-wider`,children:[W?(0,M.jsx)(g,{className:`h-4 w-4 animate-spin mr-2`}):(0,M.jsx)(ne,{className:`h-4 w-4 mr-2`}),`ENVIAR`]})]})})}),(0,M.jsx)(w,{className:`border-white/10 bg-card/50`,children:(0,M.jsx)(S,{className:`p-4`,children:(0,M.jsxs)(k,{defaultValue:`headers`,className:`w-full`,children:[(0,M.jsxs)(O,{className:`bg-background/50 h-8`,children:[(0,M.jsxs)(E,{value:`headers`,className:`text-xs h-7`,children:[`Headers (`,I.filter(e=>e.enabled&&e.key.trim()).length,`)`]}),(0,M.jsxs)(E,{value:`query`,className:`text-xs h-7`,children:[`Query Params (`,R.filter(e=>e.enabled&&e.key.trim()).length,`)`]}),(0,M.jsx)(E,{value:`body`,className:`text-xs h-7`,children:`Body`})]}),(0,M.jsx)(D,{value:`headers`,className:`mt-3`,children:$(I,L,`Header`,`Value`)}),(0,M.jsx)(D,{value:`query`,className:`mt-3`,children:$(R,z,`Key`,`Value`)}),(0,M.jsxs)(D,{value:`body`,className:`mt-3`,children:[(0,M.jsx)(b,{placeholder:`{
2
2
  "key": "value"
3
3
  }`,value:B,onChange:e=>V(e.target.value),className:`min-h-[140px] font-mono text-xs bg-background/50`}),(0,M.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:`Se enviará como string crudo. Para JSON, asegurate de que sea válido.`})]})]})})}),H&&(0,M.jsxs)(w,{className:r(`border-white/10`,H.ok?`bg-green-500/[0.02]`:`bg-red-500/[0.02]`),children:[(0,M.jsx)(x,{className:`pb-3`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(C,{className:`text-sm font-bold tracking-wider`,children:`RESPUESTA`}),H.status!==void 0&&(0,M.jsxs)(T,{variant:`outline`,className:r(`text-xs font-bold border-none`,he(H.status),`text-white`),children:[H.status,` `,H.statusText||``]}),H.ok?(0,M.jsx)(te,{className:`h-4 w-4 text-green-500`}):(0,M.jsx)(u,{className:`h-4 w-4 text-red-500`}),(0,M.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[K,`ms`]})]}),(0,M.jsxs)(v,{variant:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:()=>pe(JSON.stringify(H,null,2)),children:[(0,M.jsx)(d,{className:`h-3 w-3 mr-1`}),`Copiar`]})]})}),(0,M.jsx)(S,{className:`pt-0`,children:(0,M.jsxs)(k,{value:ae,onValueChange:oe,children:[(0,M.jsxs)(O,{className:`bg-background/50 h-8`,children:[(0,M.jsx)(E,{value:`body`,className:`text-xs h-7`,children:`Body`}),(0,M.jsx)(E,{value:`headers`,className:`text-xs h-7`,children:`Headers`}),(0,M.jsx)(E,{value:`raw`,className:`text-xs h-7`,children:`Raw`})]}),(0,M.jsx)(D,{value:`body`,className:`mt-3`,children:(0,M.jsx)(A,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:(0,M.jsx)(`pre`,{className:`font-mono text-xs text-green-400 whitespace-pre-wrap`,children:me(H.body??H)})})}),(0,M.jsx)(D,{value:`headers`,className:`mt-3`,children:(0,M.jsx)(A,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:H.headers?(0,M.jsx)(`div`,{className:`space-y-1`,children:Object.entries(H.headers).map(([e,t])=>(0,M.jsxs)(`div`,{className:`flex gap-2 text-xs font-mono`,children:[(0,M.jsxs)(`span`,{className:`text-purple-400 shrink-0`,children:[e,`:`]}),(0,M.jsx)(`span`,{className:`text-white/70`,children:String(t)})]},e))}):(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No headers disponibles`})})}),(0,M.jsx)(D,{value:`raw`,className:`mt-3`,children:(0,M.jsx)(A,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:(0,M.jsx)(`pre`,{className:`font-mono text-xs text-white/60 whitespace-pre-wrap`,children:JSON.stringify(H,null,2)})})})]})})]})]}),(0,M.jsx)(`div`,{children:(0,M.jsxs)(w,{className:`border-white/10 bg-card/50`,children:[(0,M.jsx)(x,{className:`pb-3`,children:(0,M.jsxs)(`button`,{onClick:()=>ie(!X),className:`flex items-center justify-between w-full`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}),(0,M.jsx)(C,{className:`text-xs font-bold tracking-wider`,children:`HISTORIAL`})]}),X?(0,M.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}):(0,M.jsx)(l,{className:`h-4 w-4 text-muted-foreground`})]})}),X&&(0,M.jsxs)(S,{className:`pt-0`,children:[J.length===0?(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-4`,children:`No hay requests en el historial`}):(0,M.jsx)(A,{className:`h-[calc(100vh-300px)]`,children:(0,M.jsx)(`div`,{className:`space-y-1`,children:J.map(e=>(0,M.jsxs)(`button`,{onClick:()=>fe(e),className:`w-full text-left p-2 rounded-lg hover:bg-white/5 transition-colors group`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:r(`text-[10px] font-bold px-1.5 py-0.5 rounded`,e.ok?`bg-green-500/20 text-green-400`:`bg-red-500/20 text-red-400`),children:e.method}),e.status&&(0,M.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.status})]}),(0,M.jsx)(`p`,{className:`text-[10px] text-white/50 truncate mt-1 font-mono`,children:e.url}),(0,M.jsx)(`p`,{className:`text-[9px] text-white/30 mt-0.5`,children:new Date(e.timestamp).toLocaleTimeString()})]},e.id))})}),J.length>0&&(0,M.jsxs)(v,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-[10px] text-muted-foreground hover:text-red-400`,onClick:()=>{Y([]),localStorage.removeItem(`hive-api-client-history`)},children:[(0,M.jsx)(m,{className:`h-3 w-3 mr-1`}),`Limpiar historial`]})]})]})})]})]})}export{F as ApiClientPage};