@johpaz/hive-agents 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/hive.js +521 -369
- package/dist/ui/assets/A2UIPage-BRpjnMss.js +8 -0
- package/dist/ui/assets/{AgentCreateForm-M2RhjeA1.js → AgentCreateForm-ASjKD7Js.js} +1 -1
- package/dist/ui/assets/{AgentDetailPage-DkFRtj8g.js → AgentDetailPage-bqJ-MS40.js} +1 -1
- package/dist/ui/assets/AgentNewPage-CPaf2C3u.js +1 -0
- package/dist/ui/assets/{AgentsPage-Ctzq2LWx.js → AgentsPage-BIpLG0V6.js} +1 -1
- package/dist/ui/assets/{ApiClientPage-DKbGO1QW.js → ApiClientPage-dRckcgrN.js} +1 -1
- package/dist/ui/assets/{ChannelsPage-H6rgr8DQ.js → ChannelsPage-BX_hPtiN.js} +1 -1
- package/dist/ui/assets/{DashboardPage-BIjYGf4m.js → DashboardPage-KMaMaFf4.js} +1 -1
- package/dist/ui/assets/{LoginPage-DazoxtBJ.js → LoginPage-Zchu-f16.js} +1 -1
- package/dist/ui/assets/{LogsPage-DMZ6KtQ3.js → LogsPage-6Po7_T2u.js} +1 -1
- package/dist/ui/assets/{MeetingPage-CSLFvHL7.js → MeetingPage-qrpYGVD-.js} +1 -1
- package/dist/ui/assets/{ModelSelector-BCfvugHB.js → ModelSelector-C8ny_pxu.js} +1 -1
- package/dist/ui/assets/{Office3DPage-BE6Epe0d.js → Office3DPage-BYwLMTCl.js} +1 -1
- package/dist/ui/assets/{ProvidersPage-D0cApfM1.js → ProvidersPage-DP9v_1ko.js} +1 -1
- package/dist/ui/assets/{RecoverPage-BVUPHG9z.js → RecoverPage-BXwjLfap.js} +1 -1
- package/dist/ui/assets/SettingsPage-DD7GKtS6.js +9 -0
- package/dist/ui/assets/{SetupPage-In19p30M.js → SetupPage-D7YX2io-.js} +1 -1
- package/dist/ui/assets/{WebChatPage-ByVBSzxL.js → WebChatPage-C3cgimxd.js} +1 -1
- package/dist/ui/assets/{activity-BIIli7ET.js → activity-DZKL7dg4.js} +1 -1
- package/dist/ui/assets/{agentCapabilities-D1PD9yFH.js → agentCapabilities-DuGs07XP.js} +1 -1
- package/dist/ui/assets/arrow-left-12JaXVoH.js +1 -0
- package/dist/ui/assets/arrow-right-Dbui5p0d.js +1 -0
- package/dist/ui/assets/arrow-up-right-CJBtXRrp.js +1 -0
- package/dist/ui/assets/{calendar-S9-_Q6QR.js → calendar-CkDsc4OJ.js} +1 -1
- package/dist/ui/assets/check-DxOMIDcl.js +1 -0
- package/dist/ui/assets/chevron-down-CObv-xyx.js +1 -0
- package/dist/ui/assets/chevron-left-C0mqwhLU.js +1 -0
- package/dist/ui/assets/chevron-right-jCt1h8Kw.js +1 -0
- package/dist/ui/assets/chevron-up-DX_5iw7O.js +1 -0
- package/dist/ui/assets/{circle-alert-DTVW4R94.js → circle-alert-BkP6x0zQ.js} +1 -1
- package/dist/ui/assets/circle-check-CXC2AiMS.js +1 -0
- package/dist/ui/assets/{circle-x-CJXbXzRh.js → circle-x-h4OJiHV3.js} +1 -1
- package/dist/ui/assets/{copy-X_TPpA-A.js → copy-BtpYEEvV.js} +1 -1
- package/dist/ui/assets/{dialog-uUBz_NIB.js → dialog-CO1WrPJc.js} +1 -1
- package/dist/ui/assets/{download-C-fXu08w.js → download-aPuVaZik.js} +1 -1
- package/dist/ui/assets/{earth-CTsVjCmp.js → earth-sc8YJMc0.js} +1 -1
- package/dist/ui/assets/{ellipsis-vertical-5zBh5yzc.js → ellipsis-vertical-DEBZJGzY.js} +1 -1
- package/dist/ui/assets/{external-link-CvpRhwC_.js → external-link-D_C_678M.js} +1 -1
- package/dist/ui/assets/{eye-CM-HQEWU.js → eye-BfN613fx.js} +1 -1
- package/dist/ui/assets/{file-text-lwkvYGtA.js → file-text-Bth5pPZX.js} +1 -1
- package/dist/ui/assets/gauge-DypSzSOE.js +1 -0
- package/dist/ui/assets/{history-eSHspWRr.js → history-njH_sPSo.js} +1 -1
- package/dist/ui/assets/{index-ZjAc-KQS.js → index-D-9yCvjP.js} +2 -2
- package/dist/ui/assets/index-wML8DaUo.css +2 -0
- package/dist/ui/assets/{info-DTgFQ_jA.js → info-Def2ZFeP.js} +1 -1
- package/dist/ui/assets/{key-CeM9JJkq.js → key-D8bkDl83.js} +1 -1
- package/dist/ui/assets/loader-circle-wLVzSdML.js +1 -0
- package/dist/ui/assets/{lock-open-B089GUAJ.js → lock-open-Cdopbw1b.js} +1 -1
- package/dist/ui/assets/{mail--gNFIe4M.js → mail-BQ_YA9_b.js} +1 -1
- package/dist/ui/assets/{pause-DjT1nwQM.js → pause-CvS_LzKx.js} +1 -1
- package/dist/ui/assets/{pencil-6PRgdjiU.js → pencil-C3tPvnCk.js} +1 -1
- package/dist/ui/assets/play-C-oR-PMH.js +1 -0
- package/dist/ui/assets/plus-CF9No2td.js +1 -0
- package/dist/ui/assets/{radio-D-joO9J0.js → radio-dsaiFxuT.js} +1 -1
- package/dist/ui/assets/{refresh-cw-BRrzoHQW.js → refresh-cw-BmYQwOhh.js} +1 -1
- package/dist/ui/assets/search-CTONpTyl.js +1 -0
- package/dist/ui/assets/{select-BOR8MsSL.js → select-BfRyBbi9.js} +1 -1
- package/dist/ui/assets/{send-DIlj81PT.js → send-C3o2wpLi.js} +1 -1
- package/dist/ui/assets/{settings-CkBjgAEm.js → settings-DEpdBuf2.js} +1 -1
- package/dist/ui/assets/{shield-U0hIjGzm.js → shield-gbUkSqfi.js} +1 -1
- package/dist/ui/assets/{sparkles-VXHGDbNh.js → sparkles-Ccd1JZ3s.js} +1 -1
- package/dist/ui/assets/{square-OHeetvN3.js → square-BrwQ6Mun.js} +1 -1
- package/dist/ui/assets/terminal-DP9j3HjM.js +1 -0
- package/dist/ui/assets/{trash-2-DQxm7DUM.js → trash-2-CfCs7RhJ.js} +1 -1
- package/dist/ui/assets/{triangle-alert-Dj8ZhmWj.js → triangle-alert-C3lWSnRr.js} +1 -1
- package/dist/ui/assets/{useHiveAgentsModelLoad-COLvs-Ho.js → useHiveAgentsModelLoad-D3s2U82M.js} +1 -1
- package/dist/ui/assets/{useProviders-q6iROeWE.js → useProviders-B3rT_xU9.js} +1 -1
- package/dist/ui/assets/{volume-x-Bm735CXN.js → volume-x-D2h9cyml.js} +1 -1
- package/dist/ui/assets/{wifi-DklBfOZ6.js → wifi-CGQECzu2.js} +1 -1
- package/dist/ui/assets/{zap-BEZNJ0i0.js → zap-B1azpiE7.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/packages/cli/src/index.ts +23 -17
- package/packages/core/src/canvas/canvas-manager.ts +36 -7
- package/packages/core/src/gateway/routes/a2ui.ts +43 -0
- package/packages/core/src/gateway/routes/runtime.ts +58 -0
- package/packages/core/src/gateway/routes/setup.ts +127 -108
- package/packages/core/src/gateway/server.ts +16 -0
- package/packages/core/src/storage/onboarding.ts +23 -7
- package/packages/core/src/storage/seed.ts +31 -2
- package/dist/ui/assets/A2UIPage-D4nzp5NV.js +0 -8
- package/dist/ui/assets/AgentNewPage-CfBU7puz.js +0 -1
- package/dist/ui/assets/SettingsPage-DCZ4nql4.js +0 -9
- package/dist/ui/assets/arrow-left-BfcnX8Er.js +0 -1
- package/dist/ui/assets/arrow-right-Q-dzAn8k.js +0 -1
- package/dist/ui/assets/arrow-up-right-Bf-8wrUQ.js +0 -1
- package/dist/ui/assets/check-CryV78SQ.js +0 -1
- package/dist/ui/assets/chevron-down-QCtMs-Af.js +0 -1
- package/dist/ui/assets/chevron-left-dTGbyl5G.js +0 -1
- package/dist/ui/assets/chevron-right-D0GjXbnO.js +0 -1
- package/dist/ui/assets/chevron-up-Cg0jO8uT.js +0 -1
- package/dist/ui/assets/circle-check-BAolxswA.js +0 -1
- package/dist/ui/assets/gauge-CB-cas-h.js +0 -1
- package/dist/ui/assets/index-D489S18g.css +0 -2
- package/dist/ui/assets/loader-circle-Dtfz4FWw.js +0 -1
- package/dist/ui/assets/play-tOrP0xUJ.js +0 -1
- package/dist/ui/assets/plus-Cnom3j47.js +0 -1
- package/dist/ui/assets/search-D277MUP0.js +0 -1
- package/dist/ui/assets/terminal-C6YPcJl_.js +0 -1
|
@@ -14,6 +14,9 @@ import { normalizeUserEmail } from "../../storage/user-email"
|
|
|
14
14
|
import { catalogModelKey, wireModelId } from "../../storage/model-id"
|
|
15
15
|
import { getHiveDir } from "../../config/loader"
|
|
16
16
|
import type { Config } from "../../config/loader"
|
|
17
|
+
import { logger } from "../../utils/logger"
|
|
18
|
+
|
|
19
|
+
const log = logger.child("setup")
|
|
17
20
|
|
|
18
21
|
export async function handleSetupProviders(
|
|
19
22
|
addCorsHeaders: (response: Response, request: Request) => Response,
|
|
@@ -139,7 +142,17 @@ export async function handleSetupStatus(): Promise<Response> {
|
|
|
139
142
|
* Si el usuario apunta uno a un proxy propio, la verificación usa ese endpoint y
|
|
140
143
|
* no uno fijo en el código.
|
|
141
144
|
*/
|
|
142
|
-
const OPENAI_COMPAT_PING = new Set(["
|
|
145
|
+
const OPENAI_COMPAT_PING = new Set(["z-ai", "minimax", "qwen", "opencode-go"])
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Providers cuyo GET /models es público (no exige Authorization) — NVIDIA y
|
|
149
|
+
* ModelScope responden 200 con dummy key, así que ese endpoint sólo sirve para
|
|
150
|
+
* descubrir un modelo vivo, no para validar la key. Para eso se prueba una
|
|
151
|
+
* completion real con el primer modelo de ese mismo listado (nunca uno
|
|
152
|
+
* retirado, porque sale del catálogo vivo y no del seed) y se juzga la key por
|
|
153
|
+
* el status de esa respuesta.
|
|
154
|
+
*/
|
|
155
|
+
const PUBLIC_MODEL_LIST = new Set(["nvidia", "modelscope"])
|
|
143
156
|
|
|
144
157
|
/** base_url del provider tal como está en la BD. */
|
|
145
158
|
async function providerBaseUrl(providerId: string): Promise<string | null> {
|
|
@@ -153,7 +166,12 @@ async function providerBaseUrl(providerId: string): Promise<string | null> {
|
|
|
153
166
|
|
|
154
167
|
export async function handleVerifyProvider(req: Request): Promise<Response> {
|
|
155
168
|
const body = await req.json().catch(() => ({}))
|
|
156
|
-
const { provider
|
|
169
|
+
const { provider } = body
|
|
170
|
+
// Trim: un \n o espacio colgado del copy-paste (típico al pegar desde un
|
|
171
|
+
// .txt o la terminal) es invisible en el input pero hace que `fetch()`
|
|
172
|
+
// explote al armar el header `Authorization: Bearer <key>` — antes de
|
|
173
|
+
// mandar nada, con un error críptico del runtime en vez de un 401 claro.
|
|
174
|
+
const apiKey = typeof body.apiKey === "string" ? body.apiKey.trim() : body.apiKey
|
|
157
175
|
|
|
158
176
|
if (!provider || !apiKey) {
|
|
159
177
|
return Response.json({
|
|
@@ -163,25 +181,18 @@ export async function handleVerifyProvider(req: Request): Promise<Response> {
|
|
|
163
181
|
}
|
|
164
182
|
|
|
165
183
|
try {
|
|
184
|
+
// Verificación por listado de modelos (GET, sin costo) en vez de armar una
|
|
185
|
+
// completion real con un modelo "de prueba" adivinado del catálogo. Ese
|
|
186
|
+
// enfoque anterior fallaba con key válida cuando el modelo elegido estaba
|
|
187
|
+
// retirado (NVIDIA da 410 Gone en modelos de baja) o el provider exigía un
|
|
188
|
+
// parámetro distinto para ese modelo puntual (p.ej. modelos de razonamiento
|
|
189
|
+
// de OpenAI que rechazan `max_tokens`). El dashboard (agregar/editar
|
|
190
|
+
// provider) nunca tuvo este problema porque sólo lista modelos — acá se
|
|
191
|
+
// alinea a lo mismo, y de paso deja de gastar tokens en cada click de
|
|
192
|
+
// "Verificar".
|
|
166
193
|
let testUrl: string | null = null
|
|
167
|
-
let testBody: unknown = null
|
|
168
194
|
let headers: Record<string, string> = {}
|
|
169
195
|
|
|
170
|
-
const testMessages = [{ role: "user" as const, content: "Say 'ok' if you can read this." }]
|
|
171
|
-
|
|
172
|
-
// Modelo de prueba: el indicado en el request, o el primer modelo LLM del provider en la BD
|
|
173
|
-
let pingModel: string | undefined = model
|
|
174
|
-
if (!pingModel) {
|
|
175
|
-
try {
|
|
176
|
-
const modelsCol = await col<ModelDoc>("models")
|
|
177
|
-
const candidates = (await modelsCol.findBy("provider_id", provider)).filter(e => e.doc.model_type === "llm")
|
|
178
|
-
const best = [...candidates].sort((a, b) => Number(b.doc.active) - Number(a.doc.active))[0]
|
|
179
|
-
// El id de la BD viene prefijado en los providers revendedores; acá se
|
|
180
|
-
// arma el fetch a mano, así que hay que mandar el nombre del cable.
|
|
181
|
-
pingModel = best ? wireModelId(provider, best.doc.id) : undefined
|
|
182
|
-
} catch { /* DB may not be initialized yet during early setup — ignore */ }
|
|
183
|
-
}
|
|
184
|
-
|
|
185
196
|
if (provider === "ollama") {
|
|
186
197
|
const ollamaUrl = process.env.OLLAMA_HOST || "http://localhost:11434"
|
|
187
198
|
try {
|
|
@@ -201,95 +212,35 @@ export async function handleVerifyProvider(req: Request): Promise<Response> {
|
|
|
201
212
|
}
|
|
202
213
|
|
|
203
214
|
if (provider === "anthropic") {
|
|
204
|
-
testUrl = "https://api.anthropic.com/v1/
|
|
205
|
-
testBody = {
|
|
206
|
-
model: pingModel || "claude-sonnet-5",
|
|
207
|
-
max_tokens: 10,
|
|
208
|
-
messages: testMessages,
|
|
209
|
-
}
|
|
215
|
+
testUrl = "https://api.anthropic.com/v1/models"
|
|
210
216
|
headers = {
|
|
211
|
-
"Content-Type": "application/json",
|
|
212
217
|
"x-api-key": apiKey,
|
|
213
218
|
"anthropic-version": "2023-06-01",
|
|
214
219
|
"anthropic-dangerous-direct-browser-access": "true",
|
|
215
220
|
}
|
|
216
221
|
} else if (provider === "openai") {
|
|
217
|
-
testUrl = "https://api.openai.com/v1/
|
|
218
|
-
|
|
219
|
-
model: pingModel || "gpt-5.6-luna",
|
|
220
|
-
max_tokens: 10,
|
|
221
|
-
messages: testMessages,
|
|
222
|
-
}
|
|
223
|
-
headers = {
|
|
224
|
-
"Content-Type": "application/json",
|
|
225
|
-
"Authorization": `Bearer ${apiKey}`,
|
|
226
|
-
}
|
|
222
|
+
testUrl = "https://api.openai.com/v1/models"
|
|
223
|
+
headers = { "Authorization": `Bearer ${apiKey}` }
|
|
227
224
|
} else if (provider === "gemini") {
|
|
228
|
-
testUrl = `https://generativelanguage.googleapis.com/v1beta/models
|
|
229
|
-
testBody = {
|
|
230
|
-
contents: [{ parts: [{ text: "Say ok" }] }],
|
|
231
|
-
}
|
|
232
|
-
headers = { "Content-Type": "application/json" }
|
|
225
|
+
testUrl = `https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}`
|
|
233
226
|
} else if (provider === "groq") {
|
|
234
|
-
testUrl = "https://api.groq.com/openai/v1/
|
|
235
|
-
|
|
236
|
-
model: pingModel || "llama-3.3-70b-versatile",
|
|
237
|
-
max_tokens: 10,
|
|
238
|
-
messages: testMessages,
|
|
239
|
-
}
|
|
240
|
-
headers = {
|
|
241
|
-
"Content-Type": "application/json",
|
|
242
|
-
"Authorization": `Bearer ${apiKey}`,
|
|
243
|
-
}
|
|
227
|
+
testUrl = "https://api.groq.com/openai/v1/models"
|
|
228
|
+
headers = { "Authorization": `Bearer ${apiKey}` }
|
|
244
229
|
} else if (provider === "openrouter") {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
messages: testMessages,
|
|
250
|
-
}
|
|
251
|
-
headers = {
|
|
252
|
-
"Content-Type": "application/json",
|
|
253
|
-
"Authorization": `Bearer ${apiKey}`,
|
|
254
|
-
}
|
|
230
|
+
// /api/v1/models es público y responde 200 sin auth — no sirve para
|
|
231
|
+
// validar la key. /api/v1/key sí la exige.
|
|
232
|
+
testUrl = "https://openrouter.ai/api/v1/key"
|
|
233
|
+
headers = { "Authorization": `Bearer ${apiKey}` }
|
|
255
234
|
} else if (provider === "mistral") {
|
|
256
|
-
testUrl = "https://api.mistral.ai/v1/
|
|
257
|
-
|
|
258
|
-
model: pingModel || "mistral-small-latest",
|
|
259
|
-
max_tokens: 10,
|
|
260
|
-
messages: testMessages,
|
|
261
|
-
}
|
|
262
|
-
headers = {
|
|
263
|
-
"Content-Type": "application/json",
|
|
264
|
-
"Authorization": `Bearer ${apiKey}`,
|
|
265
|
-
}
|
|
235
|
+
testUrl = "https://api.mistral.ai/v1/models"
|
|
236
|
+
headers = { "Authorization": `Bearer ${apiKey}` }
|
|
266
237
|
} else if (provider === "deepseek") {
|
|
267
|
-
testUrl = "https://api.deepseek.com/v1/
|
|
268
|
-
|
|
269
|
-
model: pingModel || "deepseek-v4-flash",
|
|
270
|
-
max_tokens: 10,
|
|
271
|
-
messages: testMessages,
|
|
272
|
-
}
|
|
273
|
-
headers = {
|
|
274
|
-
"Content-Type": "application/json",
|
|
275
|
-
"Authorization": `Bearer ${apiKey}`,
|
|
276
|
-
}
|
|
238
|
+
testUrl = "https://api.deepseek.com/v1/models"
|
|
239
|
+
headers = { "Authorization": `Bearer ${apiKey}` }
|
|
277
240
|
} else if (provider === "kimi") {
|
|
278
|
-
testUrl = "https://api.moonshot.ai/v1/
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
max_tokens: 10,
|
|
282
|
-
messages: testMessages,
|
|
283
|
-
}
|
|
284
|
-
headers = {
|
|
285
|
-
"Content-Type": "application/json",
|
|
286
|
-
"Authorization": `Bearer ${apiKey}`,
|
|
287
|
-
}
|
|
288
|
-
} else if (OPENAI_COMPAT_PING.has(provider)) {
|
|
289
|
-
// Resto de providers OpenAI-compatibles: mismo shape de request, sólo
|
|
290
|
-
// cambia el host. Sin esto, verificar su API key devolvía "Unsupported
|
|
291
|
-
// provider" aunque el provider funcionara perfectamente.
|
|
292
|
-
// Host y modelo salen de la BD; no hay catálogo fijo acá.
|
|
241
|
+
testUrl = "https://api.moonshot.ai/v1/models"
|
|
242
|
+
headers = { "Authorization": `Bearer ${apiKey}` }
|
|
243
|
+
} else if (PUBLIC_MODEL_LIST.has(provider)) {
|
|
293
244
|
const baseUrl = (await providerBaseUrl(provider))?.replace(/\/+$/, "")
|
|
294
245
|
if (!baseUrl) {
|
|
295
246
|
return Response.json({
|
|
@@ -297,22 +248,79 @@ export async function handleVerifyProvider(req: Request): Promise<Response> {
|
|
|
297
248
|
error: `El provider "${provider}" no tiene base_url configurada. Agregala en su configuración.`,
|
|
298
249
|
})
|
|
299
250
|
}
|
|
300
|
-
|
|
251
|
+
// Modelos que ya verificamos manualmente como chat/tool-calling en el
|
|
252
|
+
// seed (storage/seed.ts) — van primero porque son los que más chance
|
|
253
|
+
// tienen de estar habilitados para la cuenta. El listado público de
|
|
254
|
+
// NVIDIA mezcla chat con embeddings/rerank (p.ej. `baai/bge-m3`), que
|
|
255
|
+
// jamás van a responder en /chat/completions sea cual sea la key.
|
|
256
|
+
let curatedModels: string[] = []
|
|
257
|
+
try {
|
|
258
|
+
const modelsCol = await col<ModelDoc>("models")
|
|
259
|
+
curatedModels = (await modelsCol.findBy("provider_id", provider))
|
|
260
|
+
.filter(e => e.doc.model_type === "llm")
|
|
261
|
+
.map(e => wireModelId(provider, e.doc.id))
|
|
262
|
+
} catch { /* DB puede no estar lista en early setup — se sigue con el catálogo vivo */ }
|
|
263
|
+
|
|
264
|
+
let liveModels: string[] = []
|
|
265
|
+
try {
|
|
266
|
+
const listRes = await fetch(`${baseUrl}/models`, { signal: AbortSignal.timeout(10000) })
|
|
267
|
+
const listData = await listRes.json() as { data?: Array<{ id: string }> }
|
|
268
|
+
const NON_CHAT = /embed|rerank|bge|colbert|clip|e5-|gte-|whisper|tts|guard/i
|
|
269
|
+
liveModels = (listData.data ?? [])
|
|
270
|
+
.map(m => m.id)
|
|
271
|
+
.filter(id => id && !NON_CHAT.test(id))
|
|
272
|
+
} catch { /* liveModels queda vacío, se sigue con lo curado si hay */ }
|
|
273
|
+
|
|
274
|
+
const candidates = [...new Set([...curatedModels, ...liveModels])].slice(0, 6)
|
|
275
|
+
if (candidates.length === 0) {
|
|
301
276
|
return Response.json({
|
|
302
277
|
success: false,
|
|
303
|
-
error: `
|
|
278
|
+
error: `No se pudo obtener el catálogo de modelos de "${provider}" para probar la key.`,
|
|
304
279
|
})
|
|
305
280
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
281
|
+
// El catálogo público de NVIDIA lista modelos que no siempre están
|
|
282
|
+
// habilitados para la cuenta puntual (404 "Function not found for
|
|
283
|
+
// account" aunque la key sea válida) — se prueban varios candidatos y
|
|
284
|
+
// sólo un 401/403 real se toma como key inválida. Cualquier otro error
|
|
285
|
+
// (404, 410, etc.) pasa al siguiente candidato.
|
|
286
|
+
let lastStatus = 0
|
|
287
|
+
let lastBody = ""
|
|
288
|
+
for (const candidate of candidates) {
|
|
289
|
+
const pingRes = await fetch(`${baseUrl}/chat/completions`, {
|
|
290
|
+
method: "POST",
|
|
291
|
+
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` },
|
|
292
|
+
body: JSON.stringify({
|
|
293
|
+
model: candidate,
|
|
294
|
+
max_tokens: 10,
|
|
295
|
+
messages: [{ role: "user", content: "Say 'ok' if you can read this." }],
|
|
296
|
+
}),
|
|
297
|
+
signal: AbortSignal.timeout(10000),
|
|
298
|
+
})
|
|
299
|
+
if (pingRes.ok) return Response.json({ success: true, error: null })
|
|
300
|
+
lastStatus = pingRes.status
|
|
301
|
+
lastBody = (await pingRes.text()).slice(0, 300)
|
|
302
|
+
if (pingRes.status === 401 || pingRes.status === 403) break // key inválida, no tiene sentido seguir probando
|
|
303
|
+
log.warn(`verify-provider ${provider}: modelo=${candidate} status=${pingRes.status} body=${lastBody} — probando siguiente candidato`)
|
|
311
304
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
305
|
+
log.warn(`verify-provider ${provider} falló tras ${candidates.length} candidato(s): último status=${lastStatus} body=${lastBody}`)
|
|
306
|
+
return Response.json({
|
|
307
|
+
success: false,
|
|
308
|
+
error: `API error: ${lastStatus}`,
|
|
309
|
+
})
|
|
310
|
+
} else if (OPENAI_COMPAT_PING.has(provider)) {
|
|
311
|
+
// Resto de providers OpenAI-compatibles: mismo shape de request, sólo
|
|
312
|
+
// cambia el host. Sin esto, verificar su API key devolvía "Unsupported
|
|
313
|
+
// provider" aunque el provider funcionara perfectamente.
|
|
314
|
+
// Host sale de la BD; no hay catálogo fijo acá.
|
|
315
|
+
const baseUrl = (await providerBaseUrl(provider))?.replace(/\/+$/, "")
|
|
316
|
+
if (!baseUrl) {
|
|
317
|
+
return Response.json({
|
|
318
|
+
success: false,
|
|
319
|
+
error: `El provider "${provider}" no tiene base_url configurada. Agregala en su configuración.`,
|
|
320
|
+
})
|
|
315
321
|
}
|
|
322
|
+
testUrl = `${baseUrl}/models`
|
|
323
|
+
headers = { "Authorization": `Bearer ${apiKey}` }
|
|
316
324
|
}
|
|
317
325
|
|
|
318
326
|
if (provider === "hiveagents") {
|
|
@@ -347,20 +355,31 @@ export async function handleVerifyProvider(req: Request): Promise<Response> {
|
|
|
347
355
|
}
|
|
348
356
|
|
|
349
357
|
const response = await fetch(testUrl, {
|
|
350
|
-
method: "
|
|
358
|
+
method: "GET",
|
|
351
359
|
headers,
|
|
352
|
-
body: JSON.stringify(testBody),
|
|
353
360
|
signal: AbortSignal.timeout(10000),
|
|
354
361
|
})
|
|
355
362
|
|
|
363
|
+
if (!response.ok) {
|
|
364
|
+
log.warn(`verify-provider ${provider} falló: url=${testUrl} status=${response.status} body=${(await response.text()).slice(0, 300)}`)
|
|
365
|
+
}
|
|
366
|
+
|
|
356
367
|
return Response.json({
|
|
357
368
|
success: response.ok,
|
|
358
369
|
error: response.ok ? null : `API error: ${response.status}`,
|
|
359
370
|
})
|
|
360
371
|
} catch (error) {
|
|
372
|
+
const message = (error as Error).message
|
|
373
|
+
log.warn(`verify-provider ${provider} excepción: ${message}`)
|
|
374
|
+
// fetch() rechaza el request antes de mandarlo si el header Authorization
|
|
375
|
+
// trae un carácter inválido (control chars, no-ASCII) — pasa con keys
|
|
376
|
+
// pegadas con basura invisible en el medio, no sólo al final.
|
|
377
|
+
const isHeaderError = /header/i.test(message) && /invalid/i.test(message)
|
|
361
378
|
return Response.json({
|
|
362
379
|
success: false,
|
|
363
|
-
error:
|
|
380
|
+
error: isHeaderError
|
|
381
|
+
? "La API key tiene caracteres inválidos (revisá que no tenga saltos de línea o espacios raros al copiarla)."
|
|
382
|
+
: `Connection error: ${message}`,
|
|
364
383
|
})
|
|
365
384
|
}
|
|
366
385
|
}
|
|
@@ -48,6 +48,8 @@ import { handleGetAgents, handleCreateAgent, handleUpdateAgent, handleDeleteAgen
|
|
|
48
48
|
import { handleGetProviders, handleCreateProvider, handleToggleProvider, handleUpdateProvider, handleSyncProviderModels, handleGetProviderAvailableModels, handleLoadHiveAgentsModel, handleGetHiveAgentsModelStatus } from "./routes/providers";
|
|
49
49
|
import { handleGetUsers, handleCreateUser, handleUpdateUserSettings, handleGetUserChannels, handleLinkUserChannel } from "./routes/users";
|
|
50
50
|
import { handleGetSkills, handleActivateSkill, handleUpdateSkill, handleDeleteSkill, handleCreateSkill } from "./routes/skills";
|
|
51
|
+
import { handleGetA2UISurfaces, handleDeleteA2UISurface } from "./routes/a2ui";
|
|
52
|
+
import { handleGetRuntimeStatus } from "./routes/runtime";
|
|
51
53
|
import { handleGetEthics, handleActivateEthics, handleDeleteEthics } from "./routes/ethics";
|
|
52
54
|
import { handleGetTools, handleActivateTool, handleUpdateTool } from "./routes/tools";
|
|
53
55
|
import { handleGetTasks, handleUpdateTask } from "./routes/tasks";
|
|
@@ -1007,6 +1009,20 @@ export async function startGateway(
|
|
|
1007
1009
|
return addCorsHeaders(await handleSetupStatus(), req)
|
|
1008
1010
|
}
|
|
1009
1011
|
|
|
1012
|
+
// GET /api/a2ui/surfaces — exact surface IDs for the authenticated canvas session
|
|
1013
|
+
if ((url.pathname === "/api/a2ui/surfaces" || url.pathname === "/api/a2ui/surfaces/") && req.method === "GET") {
|
|
1014
|
+
return await handleGetA2UISurfaces(req, addCorsHeaders)
|
|
1015
|
+
}
|
|
1016
|
+
const a2uiSurfaceMatch = url.pathname.match(/^\/api\/a2ui\/surfaces\/([^/]+)$/)
|
|
1017
|
+
if (a2uiSurfaceMatch && req.method === "DELETE") {
|
|
1018
|
+
return await handleDeleteA2UISurface(req, addCorsHeaders)
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// GET /api/system/runtime — catalog/sidecar diagnostics for desktop support
|
|
1022
|
+
if ((url.pathname === "/api/system/runtime" || url.pathname === "/api/system/runtime/") && req.method === "GET") {
|
|
1023
|
+
return await handleGetRuntimeStatus(req, addCorsHeaders)
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1010
1026
|
// GET /api/setup/providers
|
|
1011
1027
|
if (url.pathname === "/api/setup/providers" && req.method === "GET") {
|
|
1012
1028
|
return handleSetupProviders(addCorsHeaders, req)
|
|
@@ -37,7 +37,23 @@ Leé el pedido completo y mirá lo que ya sabés: la sección SCRATCHPAD trae tu
|
|
|
37
37
|
|
|
38
38
|
**Si es un saludo, una charla o una pregunta que respondés de memoria: respondé y terminá.** Eso no se delega nunca ni necesita herramientas.
|
|
39
39
|
|
|
40
|
-
## 2.
|
|
40
|
+
## 2. MAPA RÁPIDO DE ESPECIALISTAS
|
|
41
|
+
|
|
42
|
+
Para cualquier pedido operativo, comparalo primero con este mapa y delegá al especialista más cercano:
|
|
43
|
+
|
|
44
|
+
- \`web_researcher\`: investiga información actual en la web y entrega fuentes.
|
|
45
|
+
- \`browser_operator\`: navega sitios, completa formularios y verifica el resultado.
|
|
46
|
+
- \`workspace_file_operator\`: crea, lee, edita y organiza archivos del workspace.
|
|
47
|
+
- \`software_engineer\`: implementa, depura y prueba software en un repositorio.
|
|
48
|
+
- \`office_document_agent\`: lee y genera PDF, Word, Excel y PowerPoint.
|
|
49
|
+
- \`a2ui_builder\`: construye formularios, dashboards y flujos interactivos A2UI.
|
|
50
|
+
- \`schedule_automation_agent\`: crea y administra jobs, recordatorios y automatizaciones de Hive.
|
|
51
|
+
- \`api_operator\`: ejecuta y verifica operaciones contra APIs REST autorizadas.
|
|
52
|
+
- Especialistas MCP del usuario: workers con integraciones específicas; encontralos con \`agent_find\` antes de usar una tool MCP.
|
|
53
|
+
|
|
54
|
+
**Regla de prioridad:** primero elegí un agente de este mapa y usá \`task_delegate\`, pero verificá antes que aparezca activo en la COLMENA; el mapa describe roles y no garantiza disponibilidad. Si no está activo o ninguno encaja, buscá otro worker con \`agent_find\`; solo después descubrí herramientas y resolvé directamente. No delegues a un ID asumido ni elijas herramientas directas antes de hacer esta comprobación, salvo saludos, charla o preguntas que respondés de memoria.
|
|
55
|
+
|
|
56
|
+
## 3. DESCOMPONER
|
|
41
57
|
|
|
42
58
|
Separá el pedido en partes y clasificá cada una:
|
|
43
59
|
|
|
@@ -47,7 +63,7 @@ Separá el pedido en partes y clasificá cada una:
|
|
|
47
63
|
| Una necesita el resultado de otra | Va en una fase posterior |
|
|
48
64
|
| Trivial o conversacional | La resolvés vos, sin herramientas |
|
|
49
65
|
|
|
50
|
-
##
|
|
66
|
+
## 4. POR CADA PARTE: ¿HAY UN AGENTE QUE LA HAGA?
|
|
51
67
|
|
|
52
68
|
**Esta es la pregunta central de tu rol, y contestarla es gratis:** el roster está en la sección COLMENA DE AGENTES de este mismo prompt, no hace falta ninguna llamada para consultarlo.
|
|
53
69
|
|
|
@@ -71,7 +87,7 @@ Separá el pedido en partes y clasificá cada una:
|
|
|
71
87
|
|
|
72
88
|
Si \`search_knowledge\` no devuelve nada y el pedido es corto o ambiguo, **preguntale al usuario** en vez de adivinar y encadenar más búsquedas. Una pregunta cuesta un turno; adivinar mal cuesta varios.
|
|
73
89
|
|
|
74
|
-
##
|
|
90
|
+
## 5. DELEGAR EN PARALELO
|
|
75
91
|
|
|
76
92
|
Las partes independientes se lanzan **todas en el mismo turno**: una \`task_delegate\` por parte, con \`mode="async"\`. Hive las agrupa por turno y los workers corren simultáneamente.
|
|
77
93
|
|
|
@@ -79,9 +95,9 @@ Si el usuario pide tres cosas que no dependen entre sí, son tres \`task_delegat
|
|
|
79
95
|
|
|
80
96
|
Cada delegación lleva: \`worker_id\`, una subtarea acotada, contexto mínimo y \`acceptance\` verificable. Antes de delegar, si el worker va a necesitar herramientas puntuales, buscalas con \`search_knowledge\` e incluilas en la instrucción. Reservá \`mode="sync"\` solo para un lookup cuyo resultado esperás en segundos.
|
|
81
97
|
|
|
82
|
-
Si más adelante una entrega no cumple sus criterios, \`task_revise\` reencola al mismo worker sobre el mismo hilo (ver sección
|
|
98
|
+
Si más adelante una entrega no cumple sus criterios, \`task_revise\` reencola al mismo worker sobre el mismo hilo (ver sección 7) — no crees una delegación nueva para corregir algo ya delegado.
|
|
83
99
|
|
|
84
|
-
##
|
|
100
|
+
## 6. ESPERAR: NO ESPERÁS
|
|
85
101
|
|
|
86
102
|
Después de delegar, contale al usuario en una línea qué pusiste a correr y **terminá tu turno**.
|
|
87
103
|
|
|
@@ -91,7 +107,7 @@ Cuando todas las tareas del turno alcanzan estado terminal, Hive te reinvoca aut
|
|
|
91
107
|
- No anuncies resultados que todavía no tenés ni declares éxito antes del \`[Sistema]\`.
|
|
92
108
|
- No re-delegues una tarea porque "no contestó": ya está encolada.
|
|
93
109
|
|
|
94
|
-
##
|
|
110
|
+
## 7. CERRAR
|
|
95
111
|
|
|
96
112
|
Al recibir el \`[Sistema]\`, cada entrega trae sus \`acceptance\` (criterios) y sus \`checks\` (resultado determinístico, sin LLM, ya calculado):
|
|
97
113
|
|
|
@@ -109,7 +125,7 @@ Guardá lo que vaya a servir después: \`save_note\` para esta conversación, \`
|
|
|
109
125
|
|
|
110
126
|
1. **Ética primero** — Operás bajo un Código de Ética obligatorio que no podés ignorar.
|
|
111
127
|
2. **Verdad de ejecución** — \`TaskDoc\`/\`JobDoc\` son la fuente de verdad. \`agent_find\` solo descubre workers; nunca prueba si algo está corriendo: para eso están \`task_list\` y \`task_status\`. Si \`task_delegate\` devuelve \`ok=true\` con \`task_id\`, \`job_id\` y \`run_id\`, la tarea se persistió de verdad y no es una simulación. Si una herramienta falla, reportá su resultado exacto: no inventes IDs, estados ni ejecuciones.
|
|
112
|
-
3. **Vos aceptás las entregas** — cada entrega vuelve con sus criterios, su evidencia y el resultado de los checks determinísticos (ver sección
|
|
128
|
+
3. **Vos aceptás las entregas** — cada entrega vuelve con sus criterios, su evidencia y el resultado de los checks determinísticos (ver sección 7). Si cumple, la integrás; si no, \`task_revise\` con feedback concreto, o la corregís vos si es trivial. Si un worker devuelve \`needs_input\`, vos formulás la pregunta al usuario con contexto.
|
|
113
129
|
4. **Buscá antes de crear** — nunca crees un worker si el catálogo ya cubre la tarea.
|
|
114
130
|
5. **Mínimo privilegio** — solo las herramientas necesarias a cada worker. La única excepción explícita es un especialista MCP aprobado por el usuario: recibe el servidor completo que figura en \`mcp_server_ids_json\`, nunca otros servidores.
|
|
115
131
|
6. **Nunca \`cli_exec\` para cron** — usá \`cron.create\`, y preguntá al usuario cada cuánto ejecutar.
|
|
@@ -290,15 +290,17 @@ export const SEED_DATA: SeedData = {
|
|
|
290
290
|
// Solo los mejores modelos agénticos (tool calling) del catálogo vivo. NVIDIA
|
|
291
291
|
// retira modelos del endpoint sin avisar y responde 410 Gone al llamarlos, así
|
|
292
292
|
// que esta lista se valida contra /v1/models — no contra la web de build.nvidia.com,
|
|
293
|
-
// que sigue mostrando fichas de modelos ya retirados. Verificado 2026-08-
|
|
293
|
+
// que sigue mostrando fichas de modelos ya retirados. Verificado 2026-08-11.
|
|
294
294
|
// Nota: Qwen ya no tiene ningún modelo en el catálogo NVIDIA (todos retirados);
|
|
295
295
|
// para Qwen usar el provider `qwen` (DashScope) directamente.
|
|
296
|
+
// DeepSeek V4 Pro (deepseek-ai/deepseek-v4-pro) se sacó: devuelve 404
|
|
297
|
+
// "Function not found for account" en cuentas normales — no está habilitado
|
|
298
|
+
// de forma general aunque figure en el listado público de /v1/models.
|
|
296
299
|
{ id: "z-ai/glm-5.2", providerId: "nvidia", name: "GLM 5.2 (NVIDIA)", modelType: "llm", contextWindow: 200000, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
297
300
|
{ id: "moonshotai/kimi-k2.6", providerId: "nvidia", name: "Kimi K2.6 (NVIDIA)", modelType: "llm", contextWindow: 262144, capabilities: JSON.stringify(["chat", "code", "vision", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
298
301
|
{ id: "minimaxai/minimax-m3", providerId: "nvidia", name: "MiniMax M3 (NVIDIA)", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "code", "vision", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
299
302
|
{ id: "nvidia/nemotron-3-ultra-550b-a55b", providerId: "nvidia", name: "Nemotron 3 Ultra 550B", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
300
303
|
{ id: "nvidia/nemotron-3-super-120b-a12b", providerId: "nvidia", name: "Nemotron 3 Super 120B", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
301
|
-
{ id: "deepseek-ai/deepseek-v4-pro", providerId: "nvidia", name: "DeepSeek V4 Pro (NVIDIA)", modelType: "llm", contextWindow: 1000000, capabilities: JSON.stringify(["chat", "code", "json_mode", "function_calling", "streaming", "reasoning"]), inputPer1M: 0, outputPer1M: 0 },
|
|
302
304
|
|
|
303
305
|
// ── ModelScope Qwen (fuente: GET https://api-inference.modelscope.ai/v1/models) ──
|
|
304
306
|
// Endpoint gratuito dentro de cuota (2000 llamadas/día, ≤500 por modelo), por
|
|
@@ -513,6 +515,15 @@ const RETIRED_CATALOG_AGENT_IDS = [
|
|
|
513
515
|
"acceptance_verifier",
|
|
514
516
|
];
|
|
515
517
|
|
|
518
|
+
function parseSkillList(value: string | null | undefined): string[] {
|
|
519
|
+
try {
|
|
520
|
+
const parsed = value ? JSON.parse(value) : [];
|
|
521
|
+
return Array.isArray(parsed) ? parsed.filter((id): id is string => typeof id === "string") : [];
|
|
522
|
+
} catch {
|
|
523
|
+
return [];
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
516
527
|
const LEGACY_CRON_PERSONA = {
|
|
517
528
|
id: "schedule_automation_agent",
|
|
518
529
|
name: "Operador de agenda",
|
|
@@ -799,6 +810,7 @@ export async function seedAllData(): Promise<void> {
|
|
|
799
810
|
// rows. Existing user choices remain untouched; narrowly identified
|
|
800
811
|
// factory values from older releases are migrated in place.
|
|
801
812
|
let catalogAgentCount = 0;
|
|
813
|
+
let repairedCatalogSkills = 0;
|
|
802
814
|
for (const catalogAgent of createSeedCatalogAgents()) {
|
|
803
815
|
await putIfAbsent(agentsCol, catalogAgent.id, catalogAgent);
|
|
804
816
|
const existing = await agentsCol.get(catalogAgent.id);
|
|
@@ -815,6 +827,20 @@ export async function seedAllData(): Promise<void> {
|
|
|
815
827
|
if (reconciled.status === "archived") {
|
|
816
828
|
reconciled = { ...reconciled, status: "idle" };
|
|
817
829
|
}
|
|
830
|
+
|
|
831
|
+
// Catalog agents may survive upgrades with an older skills_json. Keep
|
|
832
|
+
// any user-added skills, but restore every canonical dependency so a
|
|
833
|
+
// worker cannot reach delegation with a stale/missing reference.
|
|
834
|
+
const currentSkills = parseSkillList(reconciled.skills_json);
|
|
835
|
+
const missingCatalogSkills = parseSkillList(catalogAgent.skills_json)
|
|
836
|
+
.filter((id) => !currentSkills.includes(id));
|
|
837
|
+
if (missingCatalogSkills.length > 0) {
|
|
838
|
+
reconciled = {
|
|
839
|
+
...reconciled,
|
|
840
|
+
skills_json: JSON.stringify([...currentSkills, ...missingCatalogSkills]),
|
|
841
|
+
};
|
|
842
|
+
repairedCatalogSkills += missingCatalogSkills.length;
|
|
843
|
+
}
|
|
818
844
|
if (JSON.stringify(reconciled) !== JSON.stringify(existing.doc)) {
|
|
819
845
|
await agentsCol.put(
|
|
820
846
|
existing.id,
|
|
@@ -825,6 +851,9 @@ export async function seedAllData(): Promise<void> {
|
|
|
825
851
|
catalogAgentCount++;
|
|
826
852
|
}
|
|
827
853
|
log.info(`[seed] ✅ ${catalogAgentCount} catalog agents ensured`);
|
|
854
|
+
if (repairedCatalogSkills > 0) {
|
|
855
|
+
log.info(`[seed] 🔧 Restauradas ${repairedCatalogSkills} dependencia(s) de skills en agentes de catálogo`);
|
|
856
|
+
}
|
|
828
857
|
|
|
829
858
|
// Catalog rows are born without a provider/model (no provider exists at
|
|
830
859
|
// first boot), and setup only runs once — so anything that arrives later
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./arrow-left-BfcnX8Er.js";import{t as i}from"./arrow-right-Q-dzAn8k.js";import{t as a}from"./calendar-S9-_Q6QR.js";import{t as o}from"./check-CryV78SQ.js";import{t as s}from"./circle-alert-DTVW4R94.js";import{t as c}from"./download-C-fXu08w.js";import{t as l}from"./ellipsis-vertical-5zBh5yzc.js";import{n as u,t as d}from"./eye-CM-HQEWU.js";import{t as f}from"./info-DTgFQ_jA.js";import{t as p}from"./lock-open-B089GUAJ.js";import{n as m,t as ee}from"./pencil-6PRgdjiU.js";import{t as te}from"./mail--gNFIe4M.js";import{t as ne}from"./plus-Cnom3j47.js";import{t as re}from"./refresh-cw-BRrzoHQW.js";import{t as h}from"./search-D277MUP0.js";import{t as g}from"./send-DIlj81PT.js";import{t as _}from"./settings-CkBjgAEm.js";import{t as ie}from"./trash-2-DQxm7DUM.js";import{t as ae}from"./triangle-alert-Dj8ZhmWj.js";import{n as oe,t as se}from"./wifi-DklBfOZ6.js";import{l as ce}from"./vendor-router-zpB-76nT.js";import{B as v,C as y,F as b,G as le,K as x,M as S,S as C,T as w,_ as T,b as E,d as D,v as O,w as k,x as A,y as j}from"./index-ZjAc-KQS.js";import{t as M}from"./badge-DKGZbVZJ.js";import{t as N}from"./scroll-area-CfHn94Vb.js";import{t as P}from"./slider-CmE_z1Ii.js";import{i as F,n as I,r as L,t as R}from"./tabs-CxiybXcw.js";import{c as z,i as B,r as V,s as H,t as U}from"./dialog-uUBz_NIB.js";var W=x(`Camera`,[[`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`,key:`1tc9qg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),G=x(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ue=x(`CreditCard`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),de=x(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),fe=x(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),K=x(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),pe=x(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),me=x(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),he=x(`MapPin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),ge=x(`Phone`,[[`path`,{d:`M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z`,key:`foiqr5`}]]),_e=x(`Printer`,[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]),ve=x(`Share2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),ye=x(`ShoppingCart`,[[`circle`,{cx:`8`,cy:`21`,r:`1`,key:`jimo8o`}],[`circle`,{cx:`19`,cy:`21`,r:`1`,key:`13723u`}],[`path`,{d:`M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12`,key:`9zh506`}]]),be=x(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),xe=x(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),q=e(t(),1),J=n(),Y={h1:`text-2xl font-black text-white`,h2:`text-xl font-bold text-white`,h3:`text-base font-bold text-white`,h4:`text-sm font-semibold text-white/90`,h5:`text-xs font-semibold text-white/80`,body:`text-sm text-white/70 leading-relaxed`,caption:`text-xs text-white/40`,label:`text-xs font-semibold text-white/50 uppercase tracking-wider`,code:`font-mono text-xs text-green-300 bg-black/40 rounded-lg p-3 leading-relaxed whitespace-pre-wrap break-all`};function Se({def:e,ctx:t}){let n=y(e.text,t.dataModel,t.scopeData),r=e.variant??e.usageHint??`body`,i=Y[r]??Y.body;if(r===`code`)return(0,J.jsx)(`pre`,{className:i,children:n});let a=n.split(/(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\n)/g);return(0,J.jsx)(`p`,{className:i,style:e.weight?{flex:e.weight}:void 0,children:a.map((e,t)=>e.startsWith(`**`)&&e.endsWith(`**`)?(0,J.jsx)(`strong`,{className:`font-bold`,children:e.slice(2,-2)},t):e.startsWith(`*`)&&e.endsWith(`*`)?(0,J.jsx)(`em`,{className:`italic`,children:e.slice(1,-1)},t):e.startsWith("`")&&e.endsWith("`")?(0,J.jsx)(`code`,{className:`font-mono text-green-300 bg-black/30 px-1 rounded text-[0.9em]`,children:e.slice(1,-1)},t):e===`
|
|
2
|
-
`?(0,J.jsx)(`br`,{},t):e)})}function Ce(e,t,n,r){let i=[];for(let a of e)X(a,t,n,r)||i.push({message:a.message??`Validation failed: ${a.call}`});return{valid:i.length===0,errors:i}}function X(e,t,n,r){if(e.condition)return O(e.condition,t,n,r)===!0;let i=O({call:e.call,args:e.args??{}},t,n,r);return i===!0||i===`true`}function we(e,t,n,r){if(!e||e.length===0)return!1;for(let i of e)if(!X(i,t,n,r))return!0;return!1}function Te({def:e,ctx:t}){let n=e.action,r=e.variant??`primary`,i=e.disabled===!0||we(e.checks,t.dataModel,t.scopeData),a=r===`primary`?`bg-blue-600 hover:bg-blue-500 text-white font-bold`:r===`borderless`?`text-white/70 hover:text-white hover:bg-white/5`:`bg-white/5 hover:bg-white/10 text-white/70 border border-white/10`;return(0,J.jsx)(`button`,{onClick:()=>{if(i)return;let r=n?.event??n,a=r?.name;if(!a)return;let o={},s=r.context??{};for(let[e,n]of Object.entries(s))E(n)?o[e]=w(n.path,t.dataModel,t.scopeData):j(n)?o[e]=O(n,t.dataModel,t.scopeData):o[e]=n;t.onAction(a,o,e.id)},disabled:i,className:`w-full py-2.5 rounded-xl text-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2 ${a}`,style:e.weight?{flex:e.weight}:void 0,children:e.child?(0,J.jsx)(Q,{...t,id:e.child}):y(e.text,t.dataModel,t.scopeData)||`Button`})}var Ee={start:`flex-start`,end:`flex-end`,center:`center`,spaceBetween:`space-between`,spaceAround:`space-around`,spaceEvenly:`space-evenly`};function De({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`flex flex-row gap-2`,style:{justifyContent:Ee[String(e.justify??e.distribution??`start`)]??`flex-start`,alignItems:(()=>{let t=e.align??e.alignment;return t===`center`?`center`:t===`end`?`flex-end`:t===`stretch`?`stretch`:`flex-start`})(),...e.weight?{flex:e.weight}:{}},children:$(e.children,t)})}var Oe={start:`flex-start`,end:`flex-end`,center:`center`,spaceBetween:`space-between`,spaceAround:`space-around`,spaceEvenly:`space-evenly`};function ke({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`flex flex-col gap-3`,style:{justifyContent:Oe[String(e.justify??e.distribution??`start`)]??`flex-start`,alignItems:(()=>{let t=e.align??e.alignment;return t===`center`?`center`:t===`end`?`flex-end`:t===`stretch`?`stretch`:`flex-start`})(),...e.weight?{flex:e.weight}:{}},children:$(e.children,t)})}function Ae({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`rounded-xl border p-4`,style:{background:`rgba(255,255,255,0.03)`,borderColor:`rgba(255,255,255,0.08)`,...e.weight?{flex:e.weight}:{}},children:e.child&&(0,J.jsx)(Q,{...t,id:e.child})})}function je({def:e,ctx:t}){let n=e.direction===`horizontal`?`flex-row`:`flex-col`;return e.children?(0,J.jsx)(`div`,{className:`flex ${n} gap-2 overflow-x-auto pb-1`,style:e.weight?{flex:e.weight}:void 0,children:$(e.children,t)}):e.child?(0,J.jsx)(Q,{...t,id:e.child}):null}function Me({def:e}){return(0,J.jsx)(`div`,{className:e.axis===`vertical`?`w-px bg-white/[0.06] self-stretch`:`h-px bg-white/[0.06] w-full`,style:e.weight?{flex:e.weight}:void 0})}var Ne={contain:`contain`,cover:`cover`,fill:`fill`,none:`none`,"scale-down":`scale-down`},Pe={icon:`w-8 h-8`,avatar:`w-12 h-12 rounded-full`,smallFeature:`w-24 h-24`,mediumFeature:`w-48 h-48`,largeFeature:`w-64 h-64`,header:`w-full h-48`};function Fe({def:e,ctx:t}){let n=y(e.url,t.dataModel,t.scopeData);if(!n)return null;let r=Ne[e.fit??`contain`]??`contain`,i=Pe[e.usageHint??``]??``,a=typeof e.alt==`string`?e.alt:``;return(0,J.jsx)(`div`,{className:`rounded-xl overflow-hidden border border-white/[0.08] ${i}`,style:e.weight?{flex:e.weight}:void 0,children:(0,J.jsx)(`img`,{src:n,alt:a,className:`w-full max-h-64 block`,style:{objectFit:r}})})}var Ie={settings:_,home:pe,search:h,mail:te,call:ge,camera:W,calendarToday:a,star:be,check:o,close:S,delete:ie,download:c,upload:xe,edit:ee,refresh:re,send:g,share:ve,shoppingCart:ye,warning:ae,info:f,error:s,favorite:K,favoriteOff:K,folder:fe,help:G,lock:m,lockOpen:p,visibility:d,visibilityOff:u,add:ne,arrowBack:r,arrowForward:i,accountCircle:b,notifications:le,moreVert:l,moreHoriz:de,locationOn:he,payment:ue,photo:me,print:_e,person:b};function Z({def:e,ctx:t}){return(0,J.jsx)(Ie[y(e.name,t.dataModel,t.scopeData)]??G,{className:`text-white/70`,style:e.weight?{flex:e.weight}:void 0})}function Le({def:e,ctx:t}){let[n,r]=(0,q.useState)(y((typeof e.value==`object`&&e.value,e.value),t.dataModel,t.scopeData)),i=y(e.label,t.dataModel,t.scopeData),a=y(e.placeholder,t.dataModel,t.scopeData),o=e.variant??e.textFieldType??`shortText`,s=o===`code`||o===`multiline_code`,c=o===`longText`||s||o===`multiline`,l=e.checks?Ce(e.checks,t.dataModel,t.scopeData):e.validationRegexp&&n?new RegExp(e.validationRegexp).test(n)?{valid:!0,errors:[]}:{valid:!1,errors:[{message:`Formato inválido`}]}:{valid:!0,errors:[]},u=n=>{if(r(n.target.value),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.value,t})}},d=n=>{let r=e.action,i=(r?.event??r)?.name;i&&t.onAction(i,{value:n},e.id)},f=e=>{d(e.target.value)},p=e=>{e.key===`Enter`&&!c&&d(e.target.value)},m=`w-full rounded-xl border px-3 py-2.5 text-sm resize-none outline-none transition-all
|
|
3
|
-
bg-white/[0.04] border-white/[0.08] focus:border-blue-500/50 focus:bg-white/[0.06]
|
|
4
|
-
disabled:opacity-50 placeholder:text-white/20
|
|
5
|
-
${s?`font-mono text-green-300 leading-relaxed`:`text-white/80 leading-relaxed`}
|
|
6
|
-
${l.valid?``:`border-red-500/50`}`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,style:e.weight?{flex:e.weight}:void 0,children:[i&&(0,J.jsx)(`label`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:i}),c?(0,J.jsx)(`textarea`,{value:n,onChange:u,onBlur:f,onKeyDown:p,placeholder:a,rows:s?5:3,className:m}):(0,J.jsx)(`input`,{type:o===`obscured`?`password`:o===`number`?`number`:`text`,value:n,onChange:u,onBlur:f,onKeyDown:p,placeholder:a,className:m}),!l.valid&&l.errors.length>0&&(0,J.jsx)(`p`,{className:`text-xs text-red-400`,children:l.errors[0].message})]})}function Re({def:e,ctx:t}){let n=y(e.label,t.dataModel,t.scopeData),[r,i]=(0,q.useState)(A(e.value,t.dataModel,t.scopeData));return(0,J.jsxs)(`label`,{className:`flex items-center gap-2.5 cursor-pointer`,style:e.weight?{flex:e.weight}:void 0,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:r,onChange:n=>{if(i(n.target.checked),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.checked,t})}},className:`w-4 h-4 rounded border-white/20 bg-white/5 text-blue-500 focus:ring-blue-500/30`}),(0,J.jsx)(`span`,{className:`text-sm text-white/70`,children:n})]})}function ze({def:e,ctx:t}){let n=e.variant===`mutuallyExclusive`?`single`:`multi`,r=e.maxAllowedSelections??(n===`single`?1:5),[i,a]=(0,q.useState)(k(e.selections??e.value,t.dataModel,t.scopeData)),o=e.options??[],s=i=>{a(a=>{let o;o=n===`single`?[i]:a.includes(i)?a.filter(e=>e!==i):a.length>=r?a:[...a,i];let s=e.selections??e.value;if(typeof s==`object`&&s&&`path`in s){let e=s.path;t.setDataModel(t=>{let n=structuredClone(t),r=e.replace(/^\//,``).split(`/`),i=n;for(let e=0;e<r.length-1;e++)i[r[e]]??(i[r[e]]={}),i=i[r[e]];return i[r[r.length-1]]=o,n})}let c=e.action,l=(c?.event??c)?.name;return l&&t.onAction(l,{selections:o,selected:o[0]??null},e.id),o})};return(0,J.jsx)(`div`,{className:`space-y-2`,style:e.weight?{flex:e.weight}:void 0,children:o.map((e,n)=>{let r=y(e.label,t.dataModel,t.scopeData),a=e.value??r,o=i.includes(a),c=String.fromCharCode(65+n);return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(a),className:`w-full text-left px-3 py-2.5 rounded-xl border text-sm transition-all flex items-center gap-2.5
|
|
7
|
-
${o?`bg-blue-500/15 border-blue-500/50 text-blue-100`:`bg-white/[0.03] border-white/[0.08] text-white/65 hover:border-white/20 hover:bg-white/[0.06]`}`,children:[(0,J.jsx)(`span`,{className:`text-xs font-bold w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0 transition-colors
|
|
8
|
-
${o?`bg-blue-500/40 text-blue-200`:`bg-white/5 text-white/40`}`,children:o?`✓`:c}),(0,J.jsx)(`span`,{className:`leading-snug`,children:r})]},n)})})}function Be({def:e,ctx:t}){let n=typeof e.min==`number`?e.min:e.minValue??0,r=typeof e.max==`number`?e.max:e.maxValue??100,i=typeof e.step==`number`?e.step:1,a=e.label,[o,s]=(0,q.useState)(C(e.value,t.dataModel,t.scopeData)),c=n=>{if(typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n,t})}};return(0,J.jsxs)(`div`,{className:`space-y-2`,style:e.weight?{flex:e.weight}:void 0,children:[a&&(0,J.jsx)(`span`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:a}),(0,J.jsxs)(`div`,{className:`flex justify-between text-xs text-white/40`,children:[(0,J.jsx)(`span`,{children:n}),(0,J.jsx)(`span`,{className:`text-white/70 font-mono`,children:o}),(0,J.jsx)(`span`,{children:r})]}),(0,J.jsx)(P,{value:[o],min:n,max:r,step:i,onValueChange:e=>{s(e[0]),c(e[0])},onValueCommit:n=>{let r=n[0],i=e.action,a=(i?.event??i)?.name;a&&t.onAction(a,{value:r},e.id)},className:`w-full`})]})}function Ve({def:e,ctx:t}){let[n,r]=(0,q.useState)(``),i=n=>{if(r(n.target.value),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.value,t})}},a=e.enableTime&&e.enableDate?`datetime-local`:e.enableDate?`date`:`time`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,style:e.weight?{flex:e.weight}:void 0,children:[e.label&&(0,J.jsx)(`label`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:typeof e.label==`string`?e.label:String(e.label)}),(0,J.jsx)(`input`,{type:a,value:n,onChange:i,className:`w-full rounded-xl border px-3 py-2.5 text-sm bg-white/[0.04] border-white/[0.08] focus:border-blue-500/50 focus:bg-white/[0.06] outline-none text-white/80`})]})}function He({def:e,ctx:t}){let n=Array.isArray(e.tabs)?e.tabs:e.tabItems??[];return(0,J.jsxs)(R,{defaultValue:n[0]?.title?y(n[0].title,t.dataModel,t.scopeData):``,style:e.weight?{flex:e.weight}:void 0,children:[(0,J.jsx)(L,{className:`w-full`,children:n.map((e,n)=>(0,J.jsx)(F,{value:y(e.title,t.dataModel,t.scopeData),children:y(e.title,t.dataModel,t.scopeData)},n))}),n.map((e,n)=>(0,J.jsx)(I,{value:y(e.title,t.dataModel,t.scopeData),children:(0,J.jsx)(Q,{...t,id:e.child})},n))]})}function Ue({def:e,ctx:t}){let[n,r]=(0,q.useState)(!1);return(0,J.jsxs)(U,{open:n,onOpenChange:r,children:[(e.trigger??e.entryPointChild)&&(0,J.jsx)(z,{asChild:!0,children:(0,J.jsx)(`div`,{className:`cursor-pointer`,children:(0,J.jsx)(Q,{...t,id:e.trigger??e.entryPointChild})})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{className:`sr-only`,children:`Interactive modal`}),(0,J.jsx)(B,{className:`sr-only`,children:`Interactive modal content generated by the agent.`}),(e.content??e.contentChild)&&(0,J.jsx)(Q,{...t,id:e.content??e.contentChild})]})]})}function We({def:e,ctx:t}){let n=y(e.url,t.dataModel,t.scopeData);return n?(0,J.jsx)(`div`,{className:`rounded-xl overflow-hidden border border-white/[0.08]`,style:e.weight?{flex:e.weight}:void 0,children:(0,J.jsx)(`video`,{src:n,controls:!0,className:`w-full max-h-96`,children:`Tu navegador no soporta video.`})}):null}function Ge({def:e,ctx:t}){let n=y(e.url,t.dataModel,t.scopeData),r=y(e.description,t.dataModel,t.scopeData);return n?(0,J.jsxs)(`div`,{className:`rounded-xl border border-white/[0.08] p-4 bg-white/[0.02]`,style:e.weight?{flex:e.weight}:void 0,children:[r&&(0,J.jsx)(`p`,{className:`text-xs text-white/40 mb-2`,children:r}),(0,J.jsx)(`audio`,{src:n,controls:!0,className:`w-full`,style:{height:40},children:`Tu navegador no soporta audio.`})]}):null}function Ke({surface:e,onAction:t,isLoading:n}){let{components:r,dataModel:i,rootId:a,theme:o}=e,[s,c]=(0,q.useState)(()=>structuredClone(i));(0,q.useEffect)(()=>{c(structuredClone(i))},[i]);let l=(0,q.useMemo)(()=>{let e=new Map;for(let t of r)e.set(t.id,t);return e},[r]),u=o?.primaryColor||`#3B82F6`,d=(0,q.useCallback)((n,r,i)=>{t&&t({name:n,surfaceId:e.surfaceId,sourceComponentId:i,timestamp:new Date().toISOString(),context:r})},[t,e.surfaceId]);return n?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,J.jsx)(`span`,{className:`text-white/30 text-sm animate-pulse`,children:`Cargando superficie...`})}):!a||!l.has(a)?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-8 text-white/20 text-sm`,children:`Sin contenido disponible`}):(0,J.jsx)(`div`,{className:`a2ui-surface`,style:{"--a2ui-primary":u},children:(0,J.jsx)(Q,{id:a,compMap:l,dataModel:s,setDataModel:c,scopeData:void 0,onAction:d})})}function Q(e){let t=e.compMap.get(e.id);if(!t)return null;let n=t.component?.replace(/[^\x00-\x7F]/g,``).trim();switch(n){case`Text`:return(0,J.jsx)(Se,{def:t,ctx:e});case`Button`:return(0,J.jsx)(Te,{def:t,ctx:e});case`Row`:return(0,J.jsx)(De,{def:t,ctx:e});case`Column`:return(0,J.jsx)(ke,{def:t,ctx:e});case`Card`:return(0,J.jsx)(Ae,{def:t,ctx:e});case`List`:return(0,J.jsx)(je,{def:t,ctx:e});case`Divider`:return(0,J.jsx)(Me,{def:t,ctx:e});case`Image`:return(0,J.jsx)(Fe,{def:t,ctx:e});case`Icon`:return(0,J.jsx)(Z,{def:t,ctx:e});case`TextField`:return(0,J.jsx)(Le,{def:t,ctx:e});case`CheckBox`:return(0,J.jsx)(Re,{def:t,ctx:e});case`ChoicePicker`:return(0,J.jsx)(ze,{def:t,ctx:e});case`Slider`:return(0,J.jsx)(Be,{def:t,ctx:e});case`DateTimeInput`:return(0,J.jsx)(Ve,{def:t,ctx:e});case`Tabs`:return(0,J.jsx)(He,{def:t,ctx:e});case`Modal`:return(0,J.jsx)(Ue,{def:t,ctx:e});case`Video`:return(0,J.jsx)(We,{def:t,ctx:e});case`AudioPlayer`:return(0,J.jsx)(Ge,{def:t,ctx:e});default:return(0,J.jsxs)(`div`,{className:`rounded-md border border-dashed border-white/10 px-3 py-2 text-xs text-white/30`,children:[`Unknown component: `,n]})}}function $(e,t){if(!e)return[];if(typeof e==`string`)return[(0,J.jsx)(Q,{...t,id:e},e)];if(Array.isArray(e))return e.map(e=>(0,J.jsx)(Q,{...t,id:e},e));if(`explicitList`in e||`array`in e)return(`explicitList`in e?e.explicitList:e.array).map(e=>(0,J.jsx)(Q,{...t,id:e},e));if(`path`in e&&`componentId`in e){let n=e,r=w(n.path,t.dataModel,t.scopeData);return Array.isArray(r)?r.map((e,r)=>{let i=typeof e==`object`&&e?e:{value:e,index:r};return(0,J.jsx)(Q,{...t,id:n.componentId,scopeData:i},`${n.componentId}_${r}`)}):[]}if(`template`in e){let n=e.template,r=w(n.dataBinding,t.dataModel,t.scopeData);return Array.isArray(r)?r.map((e,r)=>{let i=typeof e==`object`&&e?e:{value:e,index:r};return(0,J.jsx)(Q,{...t,id:n.componentId,scopeData:i},`${n.componentId}_${r}`)}):[]}return[]}function qe(){let e=T(e=>e.a2uiSurfaces),t=T(e=>e.sendA2UIAction),n=(0,q.useCallback)(e=>{t(e)},[t]),r=Array.from(e.values());return(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,style:{backgroundImage:`radial-gradient(circle, rgba(59,130,246,0.03) 1px, transparent 1px)`,backgroundSize:`40px 40px`},children:[r.length===0?(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-white/20`,children:[(0,J.jsx)(v,{className:`h-10 w-10 opacity-30`}),(0,J.jsx)(`p`,{className:`text-sm`,children:`Sin paneles interactivos activos`}),(0,J.jsx)(`p`,{className:`text-xs text-white/15`,children:`Los resultados y formularios creados por los agentes aparecerán aquí.`})]}):(0,J.jsx)(N,{className:`flex-1 p-6`,children:r.length>0&&(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:r.map(e=>(0,J.jsxs)(`div`,{className:`rounded-xl border border-blue-500/20 bg-[rgba(255,255,255,0.02)] backdrop-blur-sm p-4`,style:e.theme?.primaryColor?{borderColor:`${e.theme.primaryColor}33`}:void 0,children:[e.theme?.agentDisplayName&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 pb-3 border-b border-white/5`,children:[e.theme.iconUrl&&(0,J.jsx)(`img`,{src:e.theme.iconUrl,alt:``,className:`w-5 h-5 rounded-full`}),(0,J.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider`,style:{color:e.theme.primaryColor??`#93c5fd`},children:e.theme.agentDisplayName})]}),(0,J.jsx)(Ke,{surface:e,onAction:n})]},e.surfaceId))})}),(0,J.jsx)(`div`,{className:`border-t border-white/5 bg-white/[0.02] px-6 py-2.5`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(v,{className:`h-3 w-3 text-blue-400/50`}),(0,J.jsx)(`span`,{className:`hive-mono`,children:r.length>0?`${r.length} superficie${r.length>1?`s`:``} A2UI activa${r.length>1?`s`:``}`:`Panel interactivo · sin superficies`})]})})]})}function Je(){let{sessionId:e}=ce(),{currentUser:t}=D(),n=T(e=>e.isConnected),r=T(e=>e.markA2UISeen),i=e&&e!==`default`?e:t?.id;return(0,q.useEffect)(()=>{r()},[r]),i?(0,J.jsx)(`div`,{className:`flex h-[calc(100vh-4rem)] flex-col bg-background/50 backdrop-blur-sm`,children:(0,J.jsx)(`div`,{className:`flex-1 overflow-hidden p-4 lg:p-8`,children:(0,J.jsx)(`div`,{className:`mx-auto h-full max-w-7xl`,children:(0,J.jsxs)(`div`,{className:`hive-card flex h-full flex-col shadow-2xl`,children:[(0,J.jsxs)(`div`,{className:`flex flex-row items-center justify-between space-y-0 border-b border-white/5 bg-white/5 px-6 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`hive-icon-wrap hive-icon-wrap--primary`,children:(0,J.jsx)(v,{className:`h-5 w-5`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`hive-title-page !text-lg`,children:`Panel interactivo`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-white/40 mt-0.5`,children:[(0,J.jsx)(b,{className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`font-mono`,children:i})]})]})]}),(0,J.jsx)(M,{variant:`outline`,className:`flex items-center gap-1.5 px-3 py-1 transition-all duration-500 border ${n?`bg-emerald-500/15 text-emerald-500 border-emerald-500/20 hover:bg-emerald-500/20`:`bg-red-500/15 text-red-500 border-red-500/20 hover:bg-red-500/20`}`,children:n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(se,{className:`h-3.5 w-3.5 animate-pulse`}),(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-[10px]`,children:`Live`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(oe,{className:`h-3.5 w-3.5`}),(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-[10px]`,children:`Offline`})]})})]}),(0,J.jsx)(qe,{})]})})})}):(0,J.jsx)(`div`,{className:`flex h-[calc(100vh-4rem)] items-center justify-center`,children:(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Cargando sesión...`})]})})}export{Je as A2UIPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./vendor-query-Dj8xYhQD.js";import{t}from"./AgentCreateForm-M2RhjeA1.js";var n=e();function r(){return(0,n.jsx)(t,{})}export{r as AgentNewPage};
|