@datatechsolutions/ui 3.6.2 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
 
4
4
  var chunk3T2WGL47_js = require('../../chunk-3T2WGL47.js');
5
5
  var chunkUDYEUTJC_js = require('../../chunk-UDYEUTJC.js');
6
- var chunkDMPBNWJB_js = require('../../chunk-DMPBNWJB.js');
6
+ var chunk5ZLQTVSV_js = require('../../chunk-5ZLQTVSV.js');
7
7
  var chunkFUHNEP3Y_js = require('../../chunk-FUHNEP3Y.js');
8
8
  require('../../chunk-55H6WZQP.js');
9
9
  require('../../chunk-DJDZIRM6.js');
@@ -1188,7 +1188,7 @@ var SAMPLE_DATASOURCES = [
1188
1188
  ];
1189
1189
  function getDialectLabel(dialect) {
1190
1190
  if (!dialect) return "Unknown";
1191
- for (const category of chunkDMPBNWJB_js.DIALECT_CATEGORIES) {
1191
+ for (const category of chunk5ZLQTVSV_js.DIALECT_CATEGORIES) {
1192
1192
  const found = category.dialects.find((d) => d.value === dialect);
1193
1193
  if (found) return found.label;
1194
1194
  }
@@ -1196,12 +1196,12 @@ function getDialectLabel(dialect) {
1196
1196
  }
1197
1197
  function getDialectGradient(dialect) {
1198
1198
  if (!dialect) return "from-gray-400 to-gray-500";
1199
- const category = chunkDMPBNWJB_js.findCategory(dialect);
1199
+ const category = chunk5ZLQTVSV_js.findCategory(dialect);
1200
1200
  return category?.gradient ?? "from-gray-400 to-gray-500";
1201
1201
  }
1202
1202
  function getDialectIcon(dialect) {
1203
1203
  if (!dialect) return outline.CircleStackIcon;
1204
- const category = chunkDMPBNWJB_js.findCategory(dialect);
1204
+ const category = chunk5ZLQTVSV_js.findCategory(dialect);
1205
1205
  return category?.icon ?? outline.CircleStackIcon;
1206
1206
  }
1207
1207
  var DIALECT_LOGO = {
@@ -1351,7 +1351,7 @@ function DatasourcesPageView({
1351
1351
  );
1352
1352
  }) }),
1353
1353
  /* @__PURE__ */ jsxRuntime.jsx(
1354
- chunkDMPBNWJB_js.DatasourceModal,
1354
+ chunk5ZLQTVSV_js.DatasourceModal,
1355
1355
  {
1356
1356
  open: modalOpen,
1357
1357
  onClose: () => setModalOpen(false),
@@ -2169,6 +2169,663 @@ function CredentialsPageView({ labels, credentials, loading, onCreate, onRotate,
2169
2169
  )
2170
2170
  ] });
2171
2171
  }
2172
+ var LOCALE_OPTIONS2 = [
2173
+ { value: "en", label: "English" },
2174
+ { value: "pt-BR", label: "Portugu\xEAs (Brasil)" },
2175
+ { value: "es", label: "Espa\xF1ol" },
2176
+ { value: "fr", label: "Fran\xE7ais" },
2177
+ { value: "de", label: "Deutsch" },
2178
+ { value: "it", label: "Italiano" }
2179
+ ];
2180
+ function AgentsWorkspacePageView({
2181
+ labels,
2182
+ agents,
2183
+ models,
2184
+ tools,
2185
+ connections,
2186
+ loading,
2187
+ promptsByAgent = {},
2188
+ onSelectAgent,
2189
+ onCreateAgent,
2190
+ onUpdateAgent,
2191
+ onDeleteAgent,
2192
+ onCreatePrompt,
2193
+ onActivatePrompt,
2194
+ onAttachTool,
2195
+ onDetachTool,
2196
+ onUpdateModel
2197
+ }) {
2198
+ const [searchTerm, setSearchTerm] = react.useState("");
2199
+ const [createOpen, setCreateOpen] = react.useState(false);
2200
+ const [selectedId, setSelectedId] = react.useState(null);
2201
+ react.useEffect(() => {
2202
+ if (!selectedId && agents.length > 0) {
2203
+ const first = String(agents[0].agentId ?? agents[0].id ?? "");
2204
+ if (first) {
2205
+ setSelectedId(first);
2206
+ onSelectAgent?.(first);
2207
+ }
2208
+ }
2209
+ }, [agents, selectedId, onSelectAgent]);
2210
+ const filteredAgents = react.useMemo(() => {
2211
+ const term = searchTerm.trim().toLowerCase();
2212
+ if (!term) return agents;
2213
+ return agents.filter((a) => String(a.name ?? "").toLowerCase().includes(term));
2214
+ }, [agents, searchTerm]);
2215
+ const selectedAgent = react.useMemo(() => {
2216
+ if (!selectedId) return null;
2217
+ return agents.find((a) => String(a.agentId ?? a.id ?? "") === selectedId) ?? null;
2218
+ }, [agents, selectedId]);
2219
+ const isEmpty = agents.length === 0;
2220
+ const hero = /* @__PURE__ */ jsxRuntime.jsx(
2221
+ chunkR4EKPXX3_js.HeroSection,
2222
+ {
2223
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.CpuChipIcon, { className: "h-5 w-5" }),
2224
+ label: labels.title,
2225
+ title: labels.title,
2226
+ subtitle: labels.subtitle,
2227
+ gradient: "from-violet-500 to-indigo-700",
2228
+ actions: /* @__PURE__ */ jsxRuntime.jsx(
2229
+ chunkR4EKPXX3_js.CreateActionButton,
2230
+ {
2231
+ mode: "desktop",
2232
+ label: labels.addAgent,
2233
+ onClick: () => setCreateOpen(true),
2234
+ accent: "violet"
2235
+ }
2236
+ )
2237
+ }
2238
+ );
2239
+ const mobileAction = /* @__PURE__ */ jsxRuntime.jsx(
2240
+ chunkR4EKPXX3_js.CreateActionButton,
2241
+ {
2242
+ mode: "mobile",
2243
+ label: labels.addAgent,
2244
+ onClick: () => setCreateOpen(true),
2245
+ accent: "violet"
2246
+ }
2247
+ );
2248
+ const content = loading ? /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.PageLoadingState, {}) : isEmpty ? /* @__PURE__ */ jsxRuntime.jsx(
2249
+ chunkR4EKPXX3_js.PageEmptyState,
2250
+ {
2251
+ title: labels.empty,
2252
+ message: labels.emptyMessage,
2253
+ iconName: "folder-open"
2254
+ }
2255
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2256
+ /* @__PURE__ */ jsxRuntime.jsx(
2257
+ chunkR4EKPXX3_js.SearchBar,
2258
+ {
2259
+ searchTerm,
2260
+ onSearchChange: setSearchTerm,
2261
+ placeholder: labels.searchPlaceholder
2262
+ }
2263
+ ),
2264
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[20rem_minmax(0,1fr)]", children: [
2265
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:sticky lg:top-4", children: /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.ListCard, { variant: "glass", children: filteredAgents.map((agent) => {
2266
+ const id = String(agent.agentId ?? agent.id ?? "");
2267
+ const active = id === selectedId;
2268
+ const initials = deriveInitials(String(agent.name ?? id));
2269
+ const modelName = models.find((m) => m.id === String(agent.modelId ?? ""))?.name ?? String(agent.modelId ?? "");
2270
+ return /* @__PURE__ */ jsxRuntime.jsx(
2271
+ chunkR4EKPXX3_js.ListCardItem,
2272
+ {
2273
+ leading: /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.Avatar, { tone: active ? "violet" : "slate", initials }),
2274
+ trailing: agent.activePromptVersion > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(chunkBHOT22QL_js.Badge, { color: "emerald", children: [
2275
+ "v",
2276
+ agent.activePromptVersion
2277
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(chunkBHOT22QL_js.Badge, { color: "zinc", children: "draft" }),
2278
+ pressable: true,
2279
+ onPress: () => {
2280
+ setSelectedId(id);
2281
+ onSelectAgent?.(id);
2282
+ },
2283
+ className: active ? "bg-violet-500/5 dark:bg-violet-400/10" : "",
2284
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
2285
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100", children: String(agent.name ?? id) }),
2286
+ modelName && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs text-slate-500 dark:text-slate-400", children: modelName })
2287
+ ] })
2288
+ },
2289
+ id
2290
+ );
2291
+ }) }) }),
2292
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: selectedAgent ? /* @__PURE__ */ jsxRuntime.jsx(
2293
+ AgentDetail,
2294
+ {
2295
+ agent: selectedAgent,
2296
+ labels,
2297
+ models,
2298
+ tools,
2299
+ connections,
2300
+ prompts: promptsByAgent[String(selectedAgent.agentId ?? selectedAgent.id ?? "")] ?? [],
2301
+ onUpdateAgent,
2302
+ onDeleteAgent,
2303
+ onCreatePrompt,
2304
+ onActivatePrompt,
2305
+ onAttachTool,
2306
+ onDetachTool,
2307
+ onUpdateModel,
2308
+ onCleared: () => {
2309
+ setSelectedId(null);
2310
+ onSelectAgent?.(null);
2311
+ }
2312
+ },
2313
+ String(selectedAgent.agentId ?? selectedAgent.id ?? "")
2314
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2315
+ chunkR4EKPXX3_js.SectionCard,
2316
+ {
2317
+ header: {
2318
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.CpuChipIcon, { className: "h-4 w-4" }),
2319
+ title: labels.noSelection,
2320
+ subtitle: labels.noSelectionMessage
2321
+ },
2322
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2323
+ chunkR4EKPXX3_js.PageEmptyState,
2324
+ {
2325
+ title: labels.noSelection,
2326
+ message: labels.noSelectionMessage,
2327
+ iconName: "folder-open"
2328
+ }
2329
+ )
2330
+ }
2331
+ ) })
2332
+ ] })
2333
+ ] });
2334
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2335
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.ManagementPageLayout, { hero, content, mobileAction }),
2336
+ createOpen && /* @__PURE__ */ jsxRuntime.jsx(
2337
+ CreateAgentDialog,
2338
+ {
2339
+ labels,
2340
+ models,
2341
+ onClose: () => setCreateOpen(false),
2342
+ onSubmit: async (input) => {
2343
+ await onCreateAgent(input);
2344
+ setCreateOpen(false);
2345
+ }
2346
+ }
2347
+ )
2348
+ ] });
2349
+ }
2350
+ function AgentDetail({
2351
+ agent,
2352
+ labels,
2353
+ models,
2354
+ tools,
2355
+ connections,
2356
+ prompts,
2357
+ onUpdateAgent,
2358
+ onDeleteAgent,
2359
+ onCreatePrompt,
2360
+ onActivatePrompt,
2361
+ onAttachTool,
2362
+ onDetachTool,
2363
+ onUpdateModel,
2364
+ onCleared
2365
+ }) {
2366
+ const agentId = String(agent.agentId ?? agent.id ?? "");
2367
+ return /* @__PURE__ */ jsxRuntime.jsx(
2368
+ chunkR4EKPXX3_js.SectionCard,
2369
+ {
2370
+ header: {
2371
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.CpuChipIcon, { className: "h-4 w-4" }),
2372
+ title: String(agent.name ?? agentId),
2373
+ subtitle: String(agent.description ?? "")
2374
+ },
2375
+ actions: /* @__PURE__ */ jsxRuntime.jsxs(
2376
+ chunkBHOT22QL_js.Button,
2377
+ {
2378
+ type: "button",
2379
+ size: "sm",
2380
+ color: "rose",
2381
+ onClick: async () => {
2382
+ if (window.confirm(labels.deleteConfirm)) {
2383
+ await onDeleteAgent(agentId);
2384
+ onCleared();
2385
+ }
2386
+ },
2387
+ children: [
2388
+ /* @__PURE__ */ jsxRuntime.jsx(outline.TrashIcon, { className: "h-4 w-4" }),
2389
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1.5", children: labels.deleteAgent })
2390
+ ]
2391
+ }
2392
+ ),
2393
+ children: /* @__PURE__ */ jsxRuntime.jsxs(chunkR4EKPXX3_js.Tabs, { defaultValue: "general", className: "w-full", children: [
2394
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkR4EKPXX3_js.TabsList, { className: "bg-white/40 dark:bg-white/[0.06]", children: [
2395
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.TabsTrigger, { value: "general", children: labels.generalTab }),
2396
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.TabsTrigger, { value: "prompt", children: labels.promptTab }),
2397
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.TabsTrigger, { value: "tools", children: labels.toolsTab }),
2398
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.TabsTrigger, { value: "model", children: labels.modelTab })
2399
+ ] }),
2400
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.TabsContent, { value: "general", className: "space-y-4 pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(GeneralTab, { agent, labels, onSubmit: (input) => onUpdateAgent(agentId, input) }) }),
2401
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.TabsContent, { value: "prompt", className: "space-y-4 pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2402
+ PromptTab,
2403
+ {
2404
+ agent,
2405
+ labels,
2406
+ prompts,
2407
+ onCreate: (input) => onCreatePrompt(agentId, input),
2408
+ onActivate: (promptId) => onActivatePrompt(agentId, promptId)
2409
+ }
2410
+ ) }),
2411
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.TabsContent, { value: "tools", className: "space-y-4 pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2412
+ ToolsTab,
2413
+ {
2414
+ agent,
2415
+ labels,
2416
+ tools,
2417
+ onAttach: (toolId) => onAttachTool(agentId, toolId),
2418
+ onDetach: (toolId) => onDetachTool(agentId, toolId)
2419
+ }
2420
+ ) }),
2421
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.TabsContent, { value: "model", className: "space-y-4 pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2422
+ ModelTab,
2423
+ {
2424
+ agent,
2425
+ labels,
2426
+ models,
2427
+ connections,
2428
+ onSubmit: (modelId, connectionId) => onUpdateModel(agentId, modelId, connectionId)
2429
+ }
2430
+ ) })
2431
+ ] })
2432
+ }
2433
+ );
2434
+ }
2435
+ function GeneralTab({
2436
+ agent,
2437
+ labels,
2438
+ onSubmit
2439
+ }) {
2440
+ const [submitting, setSubmitting] = react.useState(false);
2441
+ const initial = {
2442
+ agentId: String(agent.agentId ?? agent.id ?? ""),
2443
+ name: String(agent.name ?? ""),
2444
+ modelId: String(agent.modelId ?? ""),
2445
+ systemPrompt: String(agent.systemPrompt ?? ""),
2446
+ maxTokens: Number(agent.maxTokens ?? 2048),
2447
+ temperature: Number(agent.temperature ?? 0.2)
2448
+ };
2449
+ const initialDescription = String(agent.description ?? "");
2450
+ const initialRole = String(agent.role ?? "");
2451
+ const initialStatus = String(agent.status ?? "draft");
2452
+ return /* @__PURE__ */ jsxRuntime.jsx(
2453
+ chunkR4EKPXX3_js.SectionCard,
2454
+ {
2455
+ variant: "glass",
2456
+ header: {
2457
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.CpuChipIcon, { className: "h-4 w-4" }),
2458
+ title: labels.generalSection
2459
+ },
2460
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
2461
+ "form",
2462
+ {
2463
+ onSubmit: async (event) => {
2464
+ event.preventDefault();
2465
+ setSubmitting(true);
2466
+ try {
2467
+ const form = new FormData(event.currentTarget);
2468
+ await onSubmit({
2469
+ agentId: initial.agentId,
2470
+ name: String(form.get("name") ?? "").trim() || initial.name,
2471
+ modelId: String(form.get("modelId") ?? initial.modelId),
2472
+ systemPrompt: initial.systemPrompt,
2473
+ maxTokens: Number(form.get("maxTokens") ?? initial.maxTokens),
2474
+ temperature: Number(form.get("temperature") ?? initial.temperature)
2475
+ });
2476
+ } finally {
2477
+ setSubmitting(false);
2478
+ }
2479
+ },
2480
+ className: "space-y-4",
2481
+ children: [
2482
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkR4EKPXX3_js.FormGrid, { children: [
2483
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormInput, { name: "name", label: labels.name, defaultValue: initial.name, required: true }),
2484
+ /* @__PURE__ */ jsxRuntime.jsx(
2485
+ chunkR4EKPXX3_js.FormSelect,
2486
+ {
2487
+ name: "status",
2488
+ label: labels.status,
2489
+ defaultValue: initialStatus,
2490
+ options: [
2491
+ { value: "draft", label: labels.statusDraft },
2492
+ { value: "active", label: labels.statusActive },
2493
+ { value: "archived", label: labels.statusArchived }
2494
+ ]
2495
+ }
2496
+ ),
2497
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormInput, { name: "role", label: labels.role, placeholder: labels.rolePlaceholder, defaultValue: initialRole }),
2498
+ /* @__PURE__ */ jsxRuntime.jsx(
2499
+ chunkR4EKPXX3_js.FormInput,
2500
+ {
2501
+ name: "maxTokens",
2502
+ label: labels.maxTokens,
2503
+ type: "number",
2504
+ defaultValue: String(initial.maxTokens)
2505
+ }
2506
+ ),
2507
+ /* @__PURE__ */ jsxRuntime.jsx(
2508
+ chunkR4EKPXX3_js.FormInput,
2509
+ {
2510
+ name: "temperature",
2511
+ label: labels.temperature,
2512
+ type: "number",
2513
+ step: 0.1,
2514
+ min: 0,
2515
+ max: 2,
2516
+ defaultValue: String(initial.temperature)
2517
+ }
2518
+ )
2519
+ ] }),
2520
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormTextarea, { name: "description", label: labels.description, defaultValue: initialDescription, rows: 3 }),
2521
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(chunkBHOT22QL_js.Button, { type: "submit", color: "indigo", disabled: submitting, children: submitting ? labels.saving : labels.save }) })
2522
+ ]
2523
+ }
2524
+ )
2525
+ }
2526
+ );
2527
+ }
2528
+ function PromptTab({
2529
+ agent,
2530
+ labels,
2531
+ prompts,
2532
+ onCreate,
2533
+ onActivate
2534
+ }) {
2535
+ const [addOpen, setAddOpen] = react.useState(false);
2536
+ const agentId = String(agent.agentId ?? agent.id ?? "");
2537
+ const currentSystem = String(agent.systemPrompt ?? "");
2538
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2539
+ /* @__PURE__ */ jsxRuntime.jsx(
2540
+ chunkR4EKPXX3_js.SectionCard,
2541
+ {
2542
+ variant: "glass",
2543
+ header: {
2544
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.ChatBubbleLeftEllipsisIcon, { className: "h-4 w-4" }),
2545
+ title: labels.promptSection,
2546
+ subtitle: labels.promptCurrent
2547
+ },
2548
+ children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap rounded-lg border border-slate-200/70 bg-slate-50/60 p-3 text-xs text-slate-700 dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-200", children: currentSystem || "\u2014" })
2549
+ }
2550
+ ),
2551
+ /* @__PURE__ */ jsxRuntime.jsx(
2552
+ chunkR4EKPXX3_js.SectionCard,
2553
+ {
2554
+ variant: "glass",
2555
+ header: {
2556
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.ChatBubbleLeftEllipsisIcon, { className: "h-4 w-4" }),
2557
+ title: labels.promptVersions
2558
+ },
2559
+ actions: /* @__PURE__ */ jsxRuntime.jsxs(chunkBHOT22QL_js.Button, { type: "button", size: "sm", outline: true, onClick: () => setAddOpen(true), children: [
2560
+ /* @__PURE__ */ jsxRuntime.jsx(outline.PlusIcon, { className: "h-4 w-4" }),
2561
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1.5", children: labels.addPrompt })
2562
+ ] }),
2563
+ children: prompts.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-slate-500 dark:text-slate-400", children: labels.promptVersionsEmpty }) : /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.ListCard, { children: prompts.map((prompt) => {
2564
+ const id = `${prompt.agentId}:${prompt.locale}:${prompt.version}`;
2565
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2566
+ chunkR4EKPXX3_js.ListCardItem,
2567
+ {
2568
+ leading: /* @__PURE__ */ jsxRuntime.jsxs(chunkBHOT22QL_js.Badge, { color: prompt.isActive ? "emerald" : "zinc", children: [
2569
+ "v",
2570
+ prompt.version
2571
+ ] }),
2572
+ trailing: prompt.isActive ? /* @__PURE__ */ jsxRuntime.jsx(chunkBHOT22QL_js.Badge, { color: "emerald", children: labels.activated }) : /* @__PURE__ */ jsxRuntime.jsx(chunkBHOT22QL_js.Button, { type: "button", size: "sm", outline: true, onClick: () => onActivate(id), children: labels.activate }),
2573
+ children: [
2574
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-slate-700 dark:text-slate-200", children: prompt.locale }),
2575
+ prompt.prompt && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 line-clamp-2 text-xs text-slate-500 dark:text-slate-400", children: prompt.prompt })
2576
+ ]
2577
+ },
2578
+ id
2579
+ );
2580
+ }) })
2581
+ }
2582
+ ),
2583
+ addOpen && /* @__PURE__ */ jsxRuntime.jsx(
2584
+ chunkR4EKPXX3_js.GlassModal,
2585
+ {
2586
+ open: true,
2587
+ onClose: () => setAddOpen(false),
2588
+ title: labels.addPrompt,
2589
+ maxWidth: "2xl",
2590
+ showFormFooter: true,
2591
+ submitLabel: labels.save,
2592
+ onSubmit: async (event) => {
2593
+ const form = new FormData(event.currentTarget);
2594
+ await onCreate({
2595
+ agentId,
2596
+ locale: String(form.get("locale") ?? "en"),
2597
+ prompt: String(form.get("prompt") ?? "").trim(),
2598
+ systemPrompt: String(form.get("systemPrompt") ?? "").trim() || void 0,
2599
+ userTemplate: String(form.get("userTemplate") ?? "").trim() || void 0,
2600
+ reason: String(form.get("reason") ?? "").trim() || void 0,
2601
+ isActive: String(form.get("isActive") ?? "true") === "true"
2602
+ });
2603
+ setAddOpen(false);
2604
+ },
2605
+ children: /* @__PURE__ */ jsxRuntime.jsxs(chunkR4EKPXX3_js.FormGrid, { children: [
2606
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormSelect, { name: "locale", label: labels.promptLocale, options: LOCALE_OPTIONS2, defaultValue: "en" }),
2607
+ /* @__PURE__ */ jsxRuntime.jsx(
2608
+ chunkR4EKPXX3_js.FormSelect,
2609
+ {
2610
+ name: "isActive",
2611
+ label: labels.promptIsActive,
2612
+ options: [
2613
+ { value: "true", label: labels.promptIsActive },
2614
+ { value: "false", label: "\u2014" }
2615
+ ],
2616
+ defaultValue: "true"
2617
+ }
2618
+ ),
2619
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormInput, { name: "reason", label: labels.promptReason }),
2620
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormTextarea, { name: "systemPrompt", label: labels.promptSystemPrompt, rows: 3 }),
2621
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormTextarea, { name: "userTemplate", label: labels.promptUserTemplate, rows: 3 }),
2622
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormTextarea, { name: "prompt", label: labels.promptText, rows: 6, required: true })
2623
+ ] })
2624
+ }
2625
+ )
2626
+ ] });
2627
+ }
2628
+ function ToolsTab({
2629
+ agent,
2630
+ labels,
2631
+ tools,
2632
+ onAttach,
2633
+ onDetach
2634
+ }) {
2635
+ const raw = agent;
2636
+ const attached = react.useMemo(() => {
2637
+ const ids = raw.enabledToolIds ?? raw.toolIds;
2638
+ return Array.isArray(ids) ? ids.filter((id) => typeof id === "string") : [];
2639
+ }, [raw]);
2640
+ const attachedSet = react.useMemo(() => new Set(attached), [attached]);
2641
+ const attachedTools = tools.filter((tool) => attachedSet.has(tool.agentToolId));
2642
+ const availableTools = tools.filter((tool) => !attachedSet.has(tool.agentToolId));
2643
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2644
+ /* @__PURE__ */ jsxRuntime.jsx(
2645
+ chunkR4EKPXX3_js.SectionCard,
2646
+ {
2647
+ variant: "glass",
2648
+ header: {
2649
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.WrenchScrewdriverIcon, { className: "h-4 w-4" }),
2650
+ title: labels.toolsAttached
2651
+ },
2652
+ children: attachedTools.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-slate-500 dark:text-slate-400", children: labels.toolsEmpty }) : /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.ListCard, { children: attachedTools.map((tool) => /* @__PURE__ */ jsxRuntime.jsxs(
2653
+ chunkR4EKPXX3_js.ListCardItem,
2654
+ {
2655
+ leading: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-amber-500/10 text-amber-600 dark:bg-amber-500/20 dark:text-amber-400", children: /* @__PURE__ */ jsxRuntime.jsx(outline.WrenchScrewdriverIcon, { className: "h-5 w-5" }) }),
2656
+ trailing: /* @__PURE__ */ jsxRuntime.jsx(chunkBHOT22QL_js.Button, { type: "button", size: "sm", outline: true, onClick: () => onDetach(tool.agentToolId), children: labels.detachTool }),
2657
+ children: [
2658
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-slate-700 dark:text-slate-200", children: tool.name }),
2659
+ tool.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 line-clamp-1 text-xs text-slate-500 dark:text-slate-400", children: tool.description })
2660
+ ]
2661
+ },
2662
+ tool.agentToolId
2663
+ )) })
2664
+ }
2665
+ ),
2666
+ /* @__PURE__ */ jsxRuntime.jsx(
2667
+ chunkR4EKPXX3_js.SectionCard,
2668
+ {
2669
+ variant: "glass",
2670
+ header: {
2671
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.WrenchScrewdriverIcon, { className: "h-4 w-4" }),
2672
+ title: labels.toolsAvailable
2673
+ },
2674
+ children: availableTools.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-slate-500 dark:text-slate-400", children: labels.toolsEmpty }) : /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.ListCard, { children: availableTools.map((tool) => /* @__PURE__ */ jsxRuntime.jsxs(
2675
+ chunkR4EKPXX3_js.ListCardItem,
2676
+ {
2677
+ leading: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-slate-500/10 text-slate-600 dark:bg-slate-500/20 dark:text-slate-300", children: /* @__PURE__ */ jsxRuntime.jsx(outline.WrenchScrewdriverIcon, { className: "h-5 w-5" }) }),
2678
+ trailing: /* @__PURE__ */ jsxRuntime.jsxs(chunkBHOT22QL_js.Button, { type: "button", size: "sm", color: "indigo", onClick: () => onAttach(tool.agentToolId), children: [
2679
+ /* @__PURE__ */ jsxRuntime.jsx(outline.PlusIcon, { className: "h-4 w-4" }),
2680
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1.5", children: labels.attachTool })
2681
+ ] }),
2682
+ children: [
2683
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-slate-700 dark:text-slate-200", children: tool.name }),
2684
+ tool.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 line-clamp-1 text-xs text-slate-500 dark:text-slate-400", children: tool.description })
2685
+ ]
2686
+ },
2687
+ tool.agentToolId
2688
+ )) })
2689
+ }
2690
+ )
2691
+ ] });
2692
+ }
2693
+ function ModelTab({
2694
+ agent,
2695
+ labels,
2696
+ models,
2697
+ connections,
2698
+ onSubmit
2699
+ }) {
2700
+ const initialModelId = String(agent.modelId ?? "");
2701
+ const initialConnectionId = String(agent.connectionId ?? "");
2702
+ const [modelId, setModelId] = react.useState(initialModelId);
2703
+ const [connectionId, setConnectionId] = react.useState(initialConnectionId);
2704
+ const [submitting, setSubmitting] = react.useState(false);
2705
+ const selectedModel = models.find((m) => m.id === modelId) ?? null;
2706
+ const matchingConnections = react.useMemo(() => {
2707
+ if (!selectedModel) return connections;
2708
+ const slug = selectedModel.provider;
2709
+ if (!slug) return connections;
2710
+ const matches = connections.filter(
2711
+ (c) => (c.providerSlug ?? "") === slug || (c.providerSlug ?? "").startsWith(String(slug))
2712
+ );
2713
+ return matches.length > 0 ? matches : connections;
2714
+ }, [selectedModel, connections]);
2715
+ return /* @__PURE__ */ jsxRuntime.jsx(
2716
+ chunkR4EKPXX3_js.SectionCard,
2717
+ {
2718
+ variant: "glass",
2719
+ header: {
2720
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.CubeTransparentIcon, { className: "h-4 w-4" }),
2721
+ title: labels.modelSection
2722
+ },
2723
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
2724
+ "form",
2725
+ {
2726
+ onSubmit: async (event) => {
2727
+ event.preventDefault();
2728
+ setSubmitting(true);
2729
+ try {
2730
+ await onSubmit(modelId, connectionId);
2731
+ } finally {
2732
+ setSubmitting(false);
2733
+ }
2734
+ },
2735
+ className: "space-y-4",
2736
+ children: [
2737
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkR4EKPXX3_js.FormGrid, { children: [
2738
+ /* @__PURE__ */ jsxRuntime.jsx(
2739
+ chunkR4EKPXX3_js.FormSelect,
2740
+ {
2741
+ label: labels.model,
2742
+ value: modelId,
2743
+ onValueChange: setModelId,
2744
+ options: models.length > 0 ? models.map((m) => ({ value: m.id, label: `${m.name} (${m.provider})` })) : [{ value: "", label: labels.modelEmpty }]
2745
+ }
2746
+ ),
2747
+ /* @__PURE__ */ jsxRuntime.jsx(
2748
+ chunkR4EKPXX3_js.FormSelect,
2749
+ {
2750
+ label: labels.connection,
2751
+ value: connectionId,
2752
+ onValueChange: setConnectionId,
2753
+ options: matchingConnections.length > 0 ? matchingConnections.map((c) => ({
2754
+ value: c.id,
2755
+ label: `${c.name}${c.providerSlug ? " \xB7 " + c.providerSlug : ""}`
2756
+ })) : [{ value: "", label: labels.connectionEmpty }],
2757
+ icon: /* @__PURE__ */ jsxRuntime.jsx(outline.LinkIcon, { className: "h-4 w-4" })
2758
+ }
2759
+ )
2760
+ ] }),
2761
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(chunkBHOT22QL_js.Button, { type: "submit", color: "indigo", disabled: submitting || !modelId, children: submitting ? labels.saving : labels.save }) })
2762
+ ]
2763
+ }
2764
+ )
2765
+ }
2766
+ );
2767
+ }
2768
+ function CreateAgentDialog({
2769
+ labels,
2770
+ models,
2771
+ onClose,
2772
+ onSubmit
2773
+ }) {
2774
+ const modelOptions = models.map((m) => ({ value: m.id, label: `${m.name} (${m.provider})` }));
2775
+ return /* @__PURE__ */ jsxRuntime.jsx(
2776
+ chunkR4EKPXX3_js.GlassModal,
2777
+ {
2778
+ open: true,
2779
+ onClose,
2780
+ title: labels.createAgentTitle,
2781
+ maxWidth: "lg",
2782
+ showFormFooter: true,
2783
+ submitLabel: labels.save,
2784
+ onSubmit: async (event) => {
2785
+ const form = new FormData(event.currentTarget);
2786
+ await onSubmit({
2787
+ name: String(form.get("name") ?? "").trim(),
2788
+ modelId: String(form.get("modelId") ?? modelOptions[0]?.value ?? ""),
2789
+ systemPrompt: "",
2790
+ maxTokens: Number(form.get("maxTokens") ?? 2048),
2791
+ temperature: Number(form.get("temperature") ?? 0.2)
2792
+ });
2793
+ },
2794
+ children: /* @__PURE__ */ jsxRuntime.jsxs(chunkR4EKPXX3_js.FormGrid, { children: [
2795
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormInput, { name: "name", label: labels.name, required: true }),
2796
+ /* @__PURE__ */ jsxRuntime.jsx(
2797
+ chunkR4EKPXX3_js.FormSelect,
2798
+ {
2799
+ name: "modelId",
2800
+ label: labels.model,
2801
+ options: modelOptions.length > 0 ? modelOptions : [{ value: "", label: labels.modelEmpty }],
2802
+ defaultValue: modelOptions[0]?.value ?? ""
2803
+ }
2804
+ ),
2805
+ /* @__PURE__ */ jsxRuntime.jsx(chunkR4EKPXX3_js.FormInput, { name: "maxTokens", label: labels.maxTokens, type: "number", defaultValue: "2048" }),
2806
+ /* @__PURE__ */ jsxRuntime.jsx(
2807
+ chunkR4EKPXX3_js.FormInput,
2808
+ {
2809
+ name: "temperature",
2810
+ label: labels.temperature,
2811
+ type: "number",
2812
+ step: 0.1,
2813
+ min: 0,
2814
+ max: 2,
2815
+ defaultValue: "0.2"
2816
+ }
2817
+ )
2818
+ ] })
2819
+ }
2820
+ );
2821
+ }
2822
+ function deriveInitials(name) {
2823
+ const trimmed = name.trim();
2824
+ if (!trimmed) return "?";
2825
+ const parts = trimmed.split(/\s+/);
2826
+ if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
2827
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
2828
+ }
2172
2829
 
2173
2830
  Object.defineProperty(exports, "RolesPageView", {
2174
2831
  enumerable: true,
@@ -2180,29 +2837,30 @@ Object.defineProperty(exports, "UsersPageView", {
2180
2837
  });
2181
2838
  Object.defineProperty(exports, "DIALECT_CATEGORIES", {
2182
2839
  enumerable: true,
2183
- get: function () { return chunkDMPBNWJB_js.DIALECT_CATEGORIES; }
2840
+ get: function () { return chunk5ZLQTVSV_js.DIALECT_CATEGORIES; }
2184
2841
  });
2185
2842
  Object.defineProperty(exports, "DatasourceFormModal", {
2186
2843
  enumerable: true,
2187
- get: function () { return chunkDMPBNWJB_js.DatasourceFormModal; }
2844
+ get: function () { return chunk5ZLQTVSV_js.DatasourceFormModal; }
2188
2845
  });
2189
2846
  Object.defineProperty(exports, "DatasourceModal", {
2190
2847
  enumerable: true,
2191
- get: function () { return chunkDMPBNWJB_js.DatasourceModal; }
2848
+ get: function () { return chunk5ZLQTVSV_js.DatasourceModal; }
2192
2849
  });
2193
2850
  Object.defineProperty(exports, "findCategory", {
2194
2851
  enumerable: true,
2195
- get: function () { return chunkDMPBNWJB_js.findCategory; }
2852
+ get: function () { return chunk5ZLQTVSV_js.findCategory; }
2196
2853
  });
2197
2854
  Object.defineProperty(exports, "findDialect", {
2198
2855
  enumerable: true,
2199
- get: function () { return chunkDMPBNWJB_js.findDialect; }
2856
+ get: function () { return chunk5ZLQTVSV_js.findDialect; }
2200
2857
  });
2201
2858
  exports.AgentsConfigPageView = AgentsConfigPageView;
2202
2859
  exports.AgentsIndexPageView = AgentsIndexPageView;
2203
2860
  exports.AgentsModelsPageView = AgentsModelsPageView;
2204
2861
  exports.AgentsPromptsPageView = AgentsPromptsPageView;
2205
2862
  exports.AgentsToolDefinitionsPageView = AgentsToolDefinitionsPageView;
2863
+ exports.AgentsWorkspacePageView = AgentsWorkspacePageView;
2206
2864
  exports.ConnectionsPageView = ConnectionsPageView;
2207
2865
  exports.CredentialsPageView = CredentialsPageView;
2208
2866
  exports.DashboardPageView = DashboardPageView;