@datatechsolutions/ui 2.11.12 → 2.11.14

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.
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import '../chunk-JB6RNAD2.mjs';
3
3
  export { topologicalSortAgents, validateWorkflowGraph } from '../chunk-BLNXRUC4.mjs';
4
- import { Workspace, useModalStore, CATEGORY_COLORS, CATEGORY_PILL_COLORS, ICON_MAP, WorkflowCanvas, getEntityIcon, getEntityGradient, useWorkflowStore, LOGIC_ICON_MAP, LOGIC_NODE_GRADIENTS, getFrameworkMeta, getCompatibleModels, isModelCompatibleWithFramework, FRAMEWORK_META } from '../chunk-VWKBMTTC.mjs';
5
- export { AgentFlowNode, AgentToolFlowNode, AnswerFlowNode, AnthropicIcon, CodeFlowNode, CrewAIIcon, DocumentExtractorFlowNode, EndFlowNode, EntityFlowNode, FRAMEWORK_META, GoogleADKIcon, GroupFlowNode, HttpRequestFlowNode, IfElseFlowNode, IterationFlowNode, IterationStartFlowNode, KnowledgeBaseFlowNode, LOGIC_ICON_MAP, LOGIC_NODE_BADGE_COLORS, LOGIC_NODE_GRADIENTS, LOGIC_NODE_HANDLE_COLORS, LangChainIcon, ListOperatorFlowNode, LogicNodeModal, MINIMAP_NODE_COLORS, NodeCard, NodeContextMenu, NoteFlowNode, OpenAIIcon, PanelContextMenu, ParameterExtractorFlowNode, QuestionClassifierFlowNode, RuleFlowNode, SelectionContextMenu, StartFlowNode, StrandsIcon, TemplateTransformFlowNode, ToolFlowNode, VariableAggregatorFlowNode, VariableAssignerFlowNode, WorkflowBuilderProvider, Workspace, getCompatibleModels, getDefaultFrameworkForModel, getEntityBadgeColor, getEntityGradient, getEntityHandleColor, getEntityIcon, getEntityMinimapColor, getFrameworkMeta, isModelCompatibleWithFramework, useModalStore, useWorkflowBuilderClient, useWorkflowBuilderClientOptional, useWorkflowStore } from '../chunk-VWKBMTTC.mjs';
4
+ import { Workspace, useModalStore, CATEGORY_COLORS, CATEGORY_PILL_COLORS, ICON_MAP, WorkflowCanvas, getEntityIcon, getEntityGradient, useWorkflowStore, LOGIC_ICON_MAP, LOGIC_NODE_GRADIENTS, getFrameworkMeta, getCompatibleModels, isModelCompatibleWithFramework, FRAMEWORK_META } from '../chunk-OL7PEDJG.mjs';
5
+ export { AgentFlowNode, AgentToolFlowNode, AnswerFlowNode, AnthropicIcon, CodeFlowNode, CrewAIIcon, DocumentExtractorFlowNode, EndFlowNode, EntityFlowNode, FRAMEWORK_META, GoogleADKIcon, GroupFlowNode, HttpRequestFlowNode, IfElseFlowNode, IterationFlowNode, IterationStartFlowNode, KnowledgeBaseFlowNode, LOGIC_ICON_MAP, LOGIC_NODE_BADGE_COLORS, LOGIC_NODE_GRADIENTS, LOGIC_NODE_HANDLE_COLORS, LangChainIcon, ListOperatorFlowNode, LogicNodeModal, MINIMAP_NODE_COLORS, NodeCard, NodeContextMenu, NoteFlowNode, OpenAIIcon, PanelContextMenu, ParameterExtractorFlowNode, QuestionClassifierFlowNode, RuleFlowNode, SelectionContextMenu, StartFlowNode, StrandsIcon, TemplateTransformFlowNode, ToolFlowNode, VariableAggregatorFlowNode, VariableAssignerFlowNode, WorkflowBuilderProvider, Workspace, getCompatibleModels, getDefaultFrameworkForModel, getEntityBadgeColor, getEntityGradient, getEntityHandleColor, getEntityIcon, getEntityMinimapColor, getFrameworkMeta, isModelCompatibleWithFramework, useModalStore, useWorkflowBuilderClient, useWorkflowBuilderClientOptional, useWorkflowStore } from '../chunk-OL7PEDJG.mjs';
6
6
  import { GlassModalShell, Button, FormInput, FormTextarea, GlassFormModal, Input, DynamicIslandConfirm } from '../chunk-46ZM5VJJ.mjs';
7
7
  import '../chunk-QWG2FMUN.mjs';
8
8
  import '../chunk-D2JF6C3E.mjs';
@@ -547,6 +547,37 @@ function ResultsTab({ agentId, t }) {
547
547
  ] })
548
548
  ] });
549
549
  }
550
+ function ToolsTab({ agentTools, enabledToolIds, onToggle, t }) {
551
+ if (agentTools.length === 0) {
552
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center px-4 py-12 text-center", children: [
553
+ /* @__PURE__ */ jsx(CommandLineIcon, { className: "mb-2 h-8 w-8 text-gray-400 dark:text-gray-500" }),
554
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: t("agentDrawer.noToolsAvailable") })
555
+ ] });
556
+ }
557
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-2 p-4", children: [
558
+ /* @__PURE__ */ jsx("p", { className: "mb-3 text-xs text-gray-500 dark:text-gray-400", children: t("agentDrawer.toolsDescription") }),
559
+ agentTools.map((tool) => {
560
+ const isEnabled = enabledToolIds.has(tool.agentToolId);
561
+ return /* @__PURE__ */ jsxs(
562
+ "button",
563
+ {
564
+ type: "button",
565
+ onClick: () => onToggle(tool.agentToolId),
566
+ className: `flex w-full items-center gap-3 rounded-xl border px-4 py-3 text-left transition-all ${isEnabled ? "border-amber-500/30 bg-amber-50/50 dark:border-amber-400/20 dark:bg-amber-500/5" : "border-gray-200/50 bg-gray-50/30 hover:border-gray-300 dark:border-white/10 dark:bg-white/[0.02] dark:hover:border-white/20"}`,
567
+ children: [
568
+ /* @__PURE__ */ jsx("div", { className: `flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${isEnabled ? "bg-gradient-to-br from-amber-400 to-orange-500" : "bg-gray-200 dark:bg-gray-700"}`, children: /* @__PURE__ */ jsx(CommandLineIcon, { className: `h-4 w-4 ${isEnabled ? "text-white" : "text-gray-500 dark:text-gray-400"}` }) }),
569
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
570
+ /* @__PURE__ */ jsx("p", { className: `text-sm font-medium ${isEnabled ? "text-gray-900 dark:text-white" : "text-gray-600 dark:text-gray-400"}`, children: tool.name }),
571
+ tool.description && /* @__PURE__ */ jsx("p", { className: "truncate text-[10px] text-gray-400 dark:text-gray-500", children: tool.description })
572
+ ] }),
573
+ /* @__PURE__ */ jsx("div", { className: `flex h-5 w-5 shrink-0 items-center justify-center rounded-full transition-all ${isEnabled ? "bg-amber-500 text-white" : "border border-gray-300 dark:border-gray-600"}`, children: isEnabled && /* @__PURE__ */ jsx(CheckIcon, { className: "h-3 w-3" }) })
574
+ ]
575
+ },
576
+ tool.agentToolId
577
+ );
578
+ })
579
+ ] });
580
+ }
550
581
  function AgentModal({ onSaved }) {
551
582
  const t = useTranslations("agents.workflow");
552
583
  const activeModal = useModalStore((s) => s.activeModal);
@@ -555,6 +586,7 @@ function AgentModal({ onSaved }) {
555
586
  const open = activeModal === "agent";
556
587
  const agent = agentData?.agent ?? null;
557
588
  const models = agentData?.models ?? [];
589
+ const availableAgentTools = agentData?.agentTools ?? [];
558
590
  const isCreateMode = agentData?.isCreateMode ?? false;
559
591
  const [activeTab, setActiveTab] = useState("config");
560
592
  const [selectedModelId, setSelectedModelId] = useState("");
@@ -562,6 +594,7 @@ function AgentModal({ onSaved }) {
562
594
  const [temperature, setTemperature] = useState(0.7);
563
595
  const [elo, setElo] = useState(1e3);
564
596
  const [saved, setSaved] = useState(true);
597
+ const [enabledToolIds, setEnabledToolIds] = useState(/* @__PURE__ */ new Set());
565
598
  const agentId = agent?.agentId ?? agent?.id ?? "";
566
599
  useEffect(() => {
567
600
  if (!agent) return;
@@ -571,6 +604,8 @@ function AgentModal({ onSaved }) {
571
604
  setElo(Number(agent.elo ?? 1e3));
572
605
  setSaved(!isCreateMode);
573
606
  setActiveTab("config");
607
+ const agentToolIds = agent.agentToolIds;
608
+ setEnabledToolIds(new Set(agentToolIds ?? availableAgentTools.filter((t2) => t2.enabled).map((t2) => t2.agentToolId)));
574
609
  }, [agentId]);
575
610
  const dirty = !saved;
576
611
  const markDirty = useCallback(() => setSaved(false), []);
@@ -578,18 +613,31 @@ function AgentModal({ onSaved }) {
578
613
  const handleClose = useCallback(() => {
579
614
  closeModal();
580
615
  }, [closeModal]);
616
+ const handleToggleTool = useCallback((toolId) => {
617
+ setEnabledToolIds((previous) => {
618
+ const next = new Set(previous);
619
+ if (next.has(toolId)) next.delete(toolId);
620
+ else next.add(toolId);
621
+ return next;
622
+ });
623
+ markDirty();
624
+ }, [markDirty]);
581
625
  const handleMarkSaved = useCallback(() => {
582
626
  markSaved();
583
627
  onSaved?.();
584
628
  }, [markSaved, onSaved]);
585
629
  if (!agent) return null;
586
- const tabs = /* @__PURE__ */ jsx("div", { className: "flex border-b border-white/20 dark:border-white/10", children: ["config", "results"].map((tab) => /* @__PURE__ */ jsx(
630
+ const tabList = ["config", "tools", "results"];
631
+ const tabs = /* @__PURE__ */ jsx("div", { className: "flex border-b border-white/20 dark:border-white/10", children: tabList.map((tab) => /* @__PURE__ */ jsxs(
587
632
  "button",
588
633
  {
589
634
  type: "button",
590
635
  onClick: () => setActiveTab(tab),
591
636
  className: `flex-1 px-4 py-2 text-xs font-medium transition-colors ${activeTab === tab ? "border-b-2 border-blue-500 text-blue-600 dark:text-blue-400" : "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,
592
- children: t(tab === "config" ? "agentDrawer.configTab" : "agentDrawer.resultsTab")
637
+ children: [
638
+ t(tab === "config" ? "agentDrawer.configTab" : tab === "tools" ? "agentDrawer.toolsTab" : "agentDrawer.resultsTab"),
639
+ tab === "tools" && enabledToolIds.size > 0 && /* @__PURE__ */ jsx("span", { className: "ml-1 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-amber-500/20 px-1 text-[9px] font-bold text-amber-600 dark:text-amber-400", children: enabledToolIds.size })
640
+ ]
593
641
  },
594
642
  tab
595
643
  )) });
@@ -633,7 +681,9 @@ function AgentModal({ onSaved }) {
633
681
  closeLabel: t("agentDrawer.close"),
634
682
  children: [
635
683
  /* @__PURE__ */ jsx(AgentProfileHeader, { agent, models, t, selectedModelId, setSelectedModelId, selectedFramework, temperature, setTemperature, elo, setElo, onChanged: markDirty }),
636
- activeTab === "config" ? /* @__PURE__ */ jsx(ConfigTab, { agent, models, t, selectedModelId, setSelectedModelId, selectedFramework, setSelectedFramework: (fw) => setSelectedFramework(fw), temperature, setTemperature, dirty, markDirty, markSaved: handleMarkSaved }) : /* @__PURE__ */ jsx(ResultsTab, { agentId: agent.agentId, t })
684
+ activeTab === "config" && /* @__PURE__ */ jsx(ConfigTab, { agent, models, t, selectedModelId, setSelectedModelId, selectedFramework, setSelectedFramework: (fw) => setSelectedFramework(fw), temperature, setTemperature, dirty, markDirty, markSaved: handleMarkSaved }),
685
+ activeTab === "tools" && /* @__PURE__ */ jsx(ToolsTab, { agentTools: availableAgentTools, enabledToolIds, onToggle: handleToggleTool, t }),
686
+ activeTab === "results" && /* @__PURE__ */ jsx(ResultsTab, { agentId: agent.agentId, t })
637
687
  ]
638
688
  }
639
689
  );