@solidxai/core-ui 0.1.22-beta.3 → 0.1.22-beta.5
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/dist/adapters/auth/adminEmbedSession.d.ts +16 -0
- package/dist/adapters/auth/adminEmbedSession.d.ts.map +1 -0
- package/dist/adapters/auth/adminEmbedSession.js +72 -0
- package/dist/adapters/auth/adminEmbedSession.js.map +1 -0
- package/dist/adapters/auth/adminEmbedSession.ts +67 -0
- package/dist/adapters/auth/getSession.d.ts.map +1 -1
- package/dist/adapters/auth/getSession.js +4 -1
- package/dist/adapters/auth/getSession.js.map +1 -1
- package/dist/adapters/auth/getSession.ts +4 -1
- package/dist/adapters/auth/storage.d.ts +1 -0
- package/dist/adapters/auth/storage.d.ts.map +1 -1
- package/dist/adapters/auth/storage.js +9 -3
- package/dist/adapters/auth/storage.js.map +1 -1
- package/dist/adapters/auth/storage.ts +10 -2
- package/dist/components/auth/AuthLayout.js +1 -1
- package/dist/components/auth/AuthLayout.js.map +1 -1
- package/dist/components/auth/AuthLayout.tsx +1 -1
- package/dist/components/common/CancelButton.js +1 -1
- package/dist/components/common/CancelButton.js.map +1 -1
- package/dist/components/common/CancelButton.tsx +3 -3
- package/dist/components/common/Link.d.ts.map +1 -1
- package/dist/components/common/Link.js +3 -2
- package/dist/components/common/Link.js.map +1 -1
- package/dist/components/common/Link.tsx +3 -2
- package/dist/components/common/SolidModuleHome.js +1 -1
- package/dist/components/common/SolidModuleHome.js.map +1 -1
- package/dist/components/common/SolidModuleHome.tsx +1 -1
- package/dist/components/core/card/SolidCardView.js.map +1 -1
- package/dist/components/core/card/SolidCardView.tsx +1 -1
- package/dist/components/core/card/SolidCardViewConfigure.js +1 -1
- package/dist/components/core/card/SolidCardViewConfigure.js.map +1 -1
- package/dist/components/core/card/SolidCardViewConfigure.tsx +1 -1
- package/dist/components/core/common/SolidCreateButton.js +1 -1
- package/dist/components/core/common/SolidCreateButton.js.map +1 -1
- package/dist/components/core/common/SolidCreateButton.tsx +4 -4
- package/dist/components/core/extension/solid-core/agentRegistry/card/AgentRegistryCardWidget.module.css +51 -0
- package/dist/components/core/extension/solid-core/agentRegistry/card/AgentResourceCardWidget.d.ts +2 -0
- package/dist/components/core/extension/solid-core/agentRegistry/card/AgentResourceCardWidget.d.ts.map +1 -1
- package/dist/components/core/extension/solid-core/agentRegistry/card/AgentResourceCardWidget.js +20 -5
- package/dist/components/core/extension/solid-core/agentRegistry/card/AgentResourceCardWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/agentRegistry/card/AgentResourceCardWidget.tsx +32 -4
- package/dist/components/core/form/SolidFormActionHeader.js +18 -18
- package/dist/components/core/form/SolidFormActionHeader.js.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.tsx +28 -28
- package/dist/components/core/form/SolidFormFooter.js +2 -2
- package/dist/components/core/form/SolidFormFooter.js.map +1 -1
- package/dist/components/core/form/SolidFormFooter.tsx +2 -2
- package/dist/components/core/form/SolidFormViewShimmerLoading.js +1 -1
- package/dist/components/core/form/SolidFormViewShimmerLoading.js.map +1 -1
- package/dist/components/core/form/SolidFormViewShimmerLoading.tsx +2 -2
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +17 -15
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +7 -5
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +13 -11
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +8 -6
- package/dist/components/core/form/fields/widgets/SolidIconEditWidget.js +2 -2
- package/dist/components/core/form/fields/widgets/SolidIconEditWidget.js.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidIconEditWidget.tsx +2 -2
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +1 -1
- package/dist/components/core/kanban/SolidKanbanViewConfigure.js +1 -1
- package/dist/components/core/kanban/SolidKanbanViewConfigure.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanViewConfigure.tsx +1 -1
- package/dist/components/core/list/SolidListView.js +1 -1
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +2 -2
- package/dist/components/core/list/SolidListViewConfigure.js +1 -1
- package/dist/components/core/list/SolidListViewConfigure.js.map +1 -1
- package/dist/components/core/list/SolidListViewConfigure.tsx +2 -2
- package/dist/components/core/solid-agent/AgentWorkspaceAgentSelector.d.ts +10 -0
- package/dist/components/core/solid-agent/AgentWorkspaceAgentSelector.d.ts.map +1 -0
- package/dist/components/core/solid-agent/AgentWorkspaceAgentSelector.js +35 -0
- package/dist/components/core/solid-agent/AgentWorkspaceAgentSelector.js.map +1 -0
- package/dist/components/core/solid-agent/AgentWorkspaceAgentSelector.module.css +46 -0
- package/dist/components/core/solid-agent/AgentWorkspaceAgentSelector.tsx +57 -0
- package/dist/components/core/solid-agent/AgentWorkspaceHeaderActions.d.ts +3 -0
- package/dist/components/core/solid-agent/AgentWorkspaceHeaderActions.d.ts.map +1 -0
- package/dist/components/core/solid-agent/AgentWorkspaceHeaderActions.js +9 -0
- package/dist/components/core/solid-agent/AgentWorkspaceHeaderActions.js.map +1 -0
- package/dist/components/core/solid-agent/AgentWorkspaceHeaderActions.tsx +32 -0
- package/dist/components/core/solid-agent/SolidAgent.module.css +25 -0
- package/dist/components/core/solid-agent/SolidAgentChat.d.ts +4 -1
- package/dist/components/core/solid-agent/SolidAgentChat.d.ts.map +1 -1
- package/dist/components/core/solid-agent/SolidAgentChat.js +53 -50
- package/dist/components/core/solid-agent/SolidAgentChat.js.map +1 -1
- package/dist/components/core/solid-agent/SolidAgentChat.tsx +51 -64
- package/dist/components/core/solid-agent/SolidAgentEmbedded.d.ts +4 -0
- package/dist/components/core/solid-agent/SolidAgentEmbedded.d.ts.map +1 -1
- package/dist/components/core/solid-agent/SolidAgentEmbedded.js +1 -1
- package/dist/components/core/solid-agent/SolidAgentEmbedded.js.map +1 -1
- package/dist/components/core/solid-agent/SolidAgentEmbedded.tsx +6 -2
- package/dist/components/core/solid-agent/agentEvents.d.ts +4 -0
- package/dist/components/core/solid-agent/agentEvents.d.ts.map +1 -1
- package/dist/components/core/solid-agent/agentEvents.js +126 -32
- package/dist/components/core/solid-agent/agentEvents.js.map +1 -1
- package/dist/components/core/solid-agent/agentEvents.ts +94 -3
- package/dist/components/core/solid-agent/client/agentAuth.d.ts.map +1 -1
- package/dist/components/core/solid-agent/client/agentAuth.js +27 -11
- package/dist/components/core/solid-agent/client/agentAuth.js.map +1 -1
- package/dist/components/core/solid-agent/client/agentAuth.ts +10 -3
- package/dist/components/core/solid-agent/client/agentRuntime.d.ts +2 -1
- package/dist/components/core/solid-agent/client/agentRuntime.d.ts.map +1 -1
- package/dist/components/core/solid-agent/client/agentRuntime.js +66 -27
- package/dist/components/core/solid-agent/client/agentRuntime.js.map +1 -1
- package/dist/components/core/solid-agent/client/agentRuntime.ts +35 -3
- package/dist/components/core/solid-agent/client/agentSocket.d.ts.map +1 -1
- package/dist/components/core/solid-agent/client/agentSocket.js +6 -0
- package/dist/components/core/solid-agent/client/agentSocket.js.map +1 -1
- package/dist/components/core/solid-agent/client/agentSocket.ts +6 -0
- package/dist/components/core/solid-agent/embed/agentWorkspace.d.ts +16 -0
- package/dist/components/core/solid-agent/embed/agentWorkspace.d.ts.map +1 -0
- package/dist/components/core/solid-agent/embed/agentWorkspace.js +16 -0
- package/dist/components/core/solid-agent/embed/agentWorkspace.js.map +1 -0
- package/dist/components/core/solid-agent/embed/agentWorkspace.ts +29 -0
- package/dist/components/core/solid-agent/humanReview.d.ts +19 -0
- package/dist/components/core/solid-agent/humanReview.d.ts.map +1 -0
- package/dist/components/core/solid-agent/humanReview.js +54 -0
- package/dist/components/core/solid-agent/humanReview.js.map +1 -0
- package/dist/components/core/solid-agent/humanReview.ts +63 -0
- package/dist/components/core/solid-agent/thread/AgentThread.d.ts +2 -1
- package/dist/components/core/solid-agent/thread/AgentThread.d.ts.map +1 -1
- package/dist/components/core/solid-agent/thread/AgentThread.js +17 -68
- package/dist/components/core/solid-agent/thread/AgentThread.js.map +1 -1
- package/dist/components/core/solid-agent/thread/AgentThread.tsx +21 -106
- package/dist/components/core/solid-agent/thread/SolidAgentChatItem.d.ts +4 -2
- package/dist/components/core/solid-agent/thread/SolidAgentChatItem.d.ts.map +1 -1
- package/dist/components/core/solid-agent/thread/SolidAgentChatItem.js +34 -12
- package/dist/components/core/solid-agent/thread/SolidAgentChatItem.js.map +1 -1
- package/dist/components/core/solid-agent/thread/SolidAgentChatItem.tsx +33 -10
- package/dist/components/core/solid-agent/types.d.ts +6 -0
- package/dist/components/core/solid-agent/types.d.ts.map +1 -1
- package/dist/components/core/solid-agent/types.js.map +1 -1
- package/dist/components/core/solid-agent/types.ts +1 -0
- package/dist/components/core/solid-agent/useAgentChat.d.ts +1 -1
- package/dist/components/core/solid-agent/useAgentChat.d.ts.map +1 -1
- package/dist/components/core/solid-agent/useAgentChat.js +3 -3
- package/dist/components/core/solid-agent/useAgentChat.js.map +1 -1
- package/dist/components/core/solid-agent/useAgentChat.ts +3 -3
- package/dist/components/core/solid-agent/widgets/DefaultAgentChatHeaderWidget.d.ts +3 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentChatHeaderWidget.d.ts.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentChatHeaderWidget.js +24 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentChatHeaderWidget.js.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentChatHeaderWidget.tsx +60 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolCallWidget.d.ts +7 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolCallWidget.d.ts.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolCallWidget.js +39 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolCallWidget.js.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolCallWidget.tsx +96 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolGroupWidget.d.ts +4 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolGroupWidget.d.ts.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolGroupWidget.js +60 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolGroupWidget.js.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentToolGroupWidget.tsx +79 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWidget.d.ts +7 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWidget.d.ts.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWidget.js +18 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWidget.js.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWidget.tsx +30 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWrapperWidget.d.ts +4 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWrapperWidget.d.ts.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWrapperWidget.js +8 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWrapperWidget.js.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentTurnCompletionWrapperWidget.tsx +11 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentUserTurnCompletionWidget.d.ts +8 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentUserTurnCompletionWidget.d.ts.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentUserTurnCompletionWidget.js +41 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentUserTurnCompletionWidget.js.map +1 -0
- package/dist/components/core/solid-agent/widgets/DefaultAgentUserTurnCompletionWidget.tsx +99 -0
- package/dist/components/core/solid-agent/widgets/DefaultNoticeChatWidget.js +2 -2
- package/dist/components/core/solid-agent/widgets/DefaultNoticeChatWidget.js.map +1 -1
- package/dist/components/core/solid-agent/widgets/DefaultNoticeChatWidget.tsx +2 -2
- package/dist/components/core/solid-agent/widgets/SolidQuestionChatWidget.d.ts.map +1 -1
- package/dist/components/core/solid-agent/widgets/SolidQuestionChatWidget.js +12 -5
- package/dist/components/core/solid-agent/widgets/SolidQuestionChatWidget.js.map +1 -1
- package/dist/components/core/solid-agent/widgets/SolidQuestionChatWidget.tsx +31 -7
- package/dist/components/core/solid-agent/widgets/SolidToolActivityChatWidget.d.ts +1 -1
- package/dist/components/core/solid-agent/widgets/SolidToolActivityChatWidget.js +1 -1
- package/dist/components/core/solid-agent/widgets/SolidToolActivityChatWidget.js.map +1 -1
- package/dist/components/core/solid-agent/widgets/SolidToolActivityChatWidget.tsx +1 -1
- package/dist/components/core/tree/SolidTreeView.js +1 -1
- package/dist/components/core/tree/SolidTreeView.js.map +1 -1
- package/dist/components/core/tree/SolidTreeView.tsx +2 -2
- package/dist/components/layout/AdminHeaderActions.js +1 -1
- package/dist/components/layout/AdminHeaderActions.js.map +1 -1
- package/dist/components/layout/AdminHeaderActions.tsx +1 -1
- package/dist/components/layout/user-profile-menu.d.ts.map +1 -1
- package/dist/components/layout/user-profile-menu.js +7 -1
- package/dist/components/layout/user-profile-menu.js.map +1 -1
- package/dist/components/layout/user-profile-menu.tsx +21 -3
- package/dist/dummy.d.ts +2 -0
- package/dist/dummy.d.ts.map +1 -0
- package/dist/dummy.js +3 -0
- package/dist/dummy.js.map +1 -0
- package/dist/dummy.ts +2 -0
- package/dist/helpers/modelViewPersistence.d.ts +1 -1
- package/dist/helpers/modelViewPersistence.d.ts.map +1 -1
- package/dist/helpers/modelViewPersistence.js +5 -4
- package/dist/helpers/modelViewPersistence.js.map +1 -1
- package/dist/helpers/modelViewPersistence.ts +6 -4
- package/dist/helpers/registry.d.ts +13 -1
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +77 -25
- package/dist/helpers/registry.js.map +1 -1
- package/dist/helpers/registry.ts +75 -25
- package/dist/hooks/useRouter.d.ts.map +1 -1
- package/dist/hooks/useRouter.js +5 -3
- package/dist/hooks/useRouter.js.map +1 -1
- package/dist/hooks/useRouter.ts +5 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.ts +4 -0
- package/dist/redux/features/agentSlice.d.ts.map +1 -1
- package/dist/redux/features/agentSlice.js +4 -1
- package/dist/redux/features/agentSlice.js.map +1 -1
- package/dist/redux/features/agentSlice.ts +3 -1
- package/dist/resources/solid-custom.css +38 -1
- package/dist/resources/solid-responsive.css +13 -0
- package/dist/resources/solid-tailwind-generated.css +1 -1
- package/dist/routes/AppEventListener.js +1 -1
- package/dist/routes/AppEventListener.js.map +1 -1
- package/dist/routes/AppEventListener.tsx +1 -1
- package/dist/routes/pages/admin/core/AgentConfigComparisonPage.js +2 -2
- package/dist/routes/pages/admin/core/AgentConfigComparisonPage.js.map +1 -1
- package/dist/routes/pages/admin/core/AgentConfigComparisonPage.tsx +3 -3
- package/dist/routes/pages/admin/core/AgentDeploymentPanel.d.ts +12 -0
- package/dist/routes/pages/admin/core/AgentDeploymentPanel.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/AgentDeploymentPanel.js +18 -0
- package/dist/routes/pages/admin/core/AgentDeploymentPanel.js.map +1 -0
- package/dist/routes/pages/admin/core/AgentDeploymentPanel.tsx +50 -0
- package/dist/routes/pages/admin/core/AgentJobsInboxPage.d.ts +2 -0
- package/dist/routes/pages/admin/core/AgentJobsInboxPage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/AgentJobsInboxPage.js +662 -0
- package/dist/routes/pages/admin/core/AgentJobsInboxPage.js.map +1 -0
- package/dist/routes/pages/admin/core/AgentJobsInboxPage.module.css +163 -0
- package/dist/routes/pages/admin/core/AgentJobsInboxPage.tsx +634 -0
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.css +53 -9
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.js +131 -69
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.js.map +1 -1
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.tsx +133 -29
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.js +23 -20
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.js.map +1 -1
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.tsx +4 -2
- package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.js +25 -23
- package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.js.map +1 -1
- package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx +4 -2
- package/dist/routes/pages/embed/AdminEmbedPage.d.ts +7 -0
- package/dist/routes/pages/embed/AdminEmbedPage.d.ts.map +1 -0
- package/dist/routes/pages/embed/AdminEmbedPage.js +104 -0
- package/dist/routes/pages/embed/AdminEmbedPage.js.map +1 -0
- package/dist/routes/pages/embed/AdminEmbedPage.module.css +9 -0
- package/dist/routes/pages/embed/AdminEmbedPage.tsx +128 -0
- package/dist/routes/pages/embed/AgentEmbedPage.d.ts.map +1 -1
- package/dist/routes/pages/embed/AgentEmbedPage.js +13 -5
- package/dist/routes/pages/embed/AgentEmbedPage.js.map +1 -1
- package/dist/routes/pages/embed/AgentEmbedPage.tsx +10 -2
- package/dist/routes/solidRoutes.d.ts.map +1 -1
- package/dist/routes/solidRoutes.js +4 -0
- package/dist/routes/solidRoutes.js.map +1 -1
- package/dist/routes/solidRoutes.tsx +4 -0
- package/dist/types/extension-registry.d.ts +7 -1
- package/dist/types/extension-registry.d.ts.map +1 -1
- package/dist/types/extension-registry.js +9 -1
- package/dist/types/extension-registry.js.map +1 -1
- package/dist/types/extension-registry.ts +10 -1
- package/dist/types/index.d.ts +6 -0
- package/dist/types/solid-core.d.ts +30 -2
- package/package.json +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ArrowLeft, Eye, Pencil, RefreshCw } from "lucide-react";
|
|
3
3
|
import { useDispatch } from "react-redux";
|
|
4
|
-
import { useNavigate, useParams } from "react-router-dom";
|
|
4
|
+
import { useNavigate, useParams, useSearchParams } from "react-router-dom";
|
|
5
5
|
import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
|
|
6
6
|
import { showToast } from "../../../../redux/features/toastSlice";
|
|
7
7
|
import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
|
|
@@ -98,6 +98,8 @@ function skillAgents(record?: SkillRecord): AgentReference[] {
|
|
|
98
98
|
|
|
99
99
|
export function AgentSkillRegistryEditorPage() {
|
|
100
100
|
const { id = "" } = useParams<{ id: string }>();
|
|
101
|
+
const [searchParams] = useSearchParams();
|
|
102
|
+
const initialName = id === "new" ? searchParams.get("name") ?? "" : "";
|
|
101
103
|
const navigate = useNavigate();
|
|
102
104
|
const dispatch = useDispatch();
|
|
103
105
|
const entityApi = React.useMemo(() => createSolidEntityApi("agentSkillRegistry"), []);
|
|
@@ -137,7 +139,7 @@ export function AgentSkillRegistryEditorPage() {
|
|
|
137
139
|
React.useEffect(() => {
|
|
138
140
|
const nextTags = agentHubTagsFrom(record?.tags);
|
|
139
141
|
const nextModule = agentHubModuleFrom(record?.module);
|
|
140
|
-
setName(record?.name ??
|
|
142
|
+
setName(record?.name ?? initialName);
|
|
141
143
|
setType(record?.type ?? "custom");
|
|
142
144
|
setIconName(record?.iconName ?? "");
|
|
143
145
|
setDescription(record?.description ?? "");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentToolRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AA8D3C,wBAAgB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"AgentToolRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AA8D3C,wBAAgB,2BAA2B,4CA0N1C"}
|
|
@@ -58,7 +58,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
58
58
|
import React from "react";
|
|
59
59
|
import { ArrowLeft, RefreshCw } from "lucide-react";
|
|
60
60
|
import { useDispatch } from "react-redux";
|
|
61
|
-
import { useNavigate, useParams } from "react-router-dom";
|
|
61
|
+
import { useNavigate, useParams, useSearchParams } from "react-router-dom";
|
|
62
62
|
import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
|
|
63
63
|
import { hasAnyRole } from "../../../../helpers/rolesHelper";
|
|
64
64
|
import { useSession } from "../../../../hooks/useSession";
|
|
@@ -121,32 +121,34 @@ function getSaveErrorMessage(error) {
|
|
|
121
121
|
}
|
|
122
122
|
export function AgentToolRegistryEditorPage() {
|
|
123
123
|
var _this = this;
|
|
124
|
-
var _a, _b;
|
|
125
|
-
var
|
|
124
|
+
var _a, _b, _c;
|
|
125
|
+
var _d = useParams().id, id = _d === void 0 ? "" : _d;
|
|
126
|
+
var searchParams = useSearchParams()[0];
|
|
127
|
+
var initialName = id === "new" ? (_a = searchParams.get("name")) !== null && _a !== void 0 ? _a : "" : "";
|
|
126
128
|
var session = useSession().data;
|
|
127
|
-
var isAdmin = hasAnyRole((
|
|
129
|
+
var isAdmin = hasAnyRole((_b = session === null || session === void 0 ? void 0 : session.user) === null || _b === void 0 ? void 0 : _b.roles, ["Admin"]);
|
|
128
130
|
var navigate = useNavigate();
|
|
129
131
|
var dispatch = useDispatch();
|
|
130
132
|
var entityApi = React.useMemo(function () { return createSolidEntityApi("agentToolRegistry"); }, []);
|
|
131
133
|
var useCreateSolidEntityMutation = entityApi.useCreateSolidEntityMutation, useGetSolidEntityByIdQuery = entityApi.useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation = entityApi.useUpdateSolidEntityMutation;
|
|
132
|
-
var
|
|
133
|
-
var
|
|
134
|
-
var
|
|
134
|
+
var _e = useGetSolidEntityByIdQuery({ id: id, qs: "populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags&populate[3]=module" }, { skip: !id || id === "new" }), response = _e.data, isLoading = _e.isLoading, isFetching = _e.isFetching, refetch = _e.refetch;
|
|
135
|
+
var _f = useCreateSolidEntityMutation(), createTool = _f[0], isCreating = _f[1].isLoading;
|
|
136
|
+
var _g = useUpdateSolidEntityMutation(), updateTool = _g[0], isSaving = _g[1].isLoading;
|
|
135
137
|
var record = extractEntityRecord(response);
|
|
136
|
-
var
|
|
137
|
-
var
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
var
|
|
143
|
-
var
|
|
144
|
-
var
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
var
|
|
148
|
-
var
|
|
149
|
-
var
|
|
138
|
+
var _h = React.useState("general"), activeTab = _h[0], setActiveTab = _h[1];
|
|
139
|
+
var _j = React.useState(""), name = _j[0], setName = _j[1];
|
|
140
|
+
var _k = React.useState(""), iconName = _k[0], setIconName = _k[1];
|
|
141
|
+
var _l = React.useState(""), description = _l[0], setDescription = _l[1];
|
|
142
|
+
var _m = React.useState("custom"), type = _m[0], setType = _m[1];
|
|
143
|
+
var _o = React.useState(""), sourceCode = _o[0], setSourceCode = _o[1];
|
|
144
|
+
var _p = React.useState([]), tags = _p[0], setTags = _p[1];
|
|
145
|
+
var _q = React.useState(null), module = _q[0], setModule = _q[1];
|
|
146
|
+
var _r = React.useState(false), creatingTag = _r[0], setCreatingTag = _r[1];
|
|
147
|
+
var _s = React.useState({}), fieldErrors = _s[0], setFieldErrors = _s[1];
|
|
148
|
+
var _t = React.useState(0), auditRefreshVersion = _t[0], setAuditRefreshVersion = _t[1];
|
|
149
|
+
var _u = React.useState(false), confirmRefresh = _u[0], setConfirmRefresh = _u[1];
|
|
150
|
+
var _v = React.useState(false), activationOpen = _v[0], setActivationOpen = _v[1];
|
|
151
|
+
var _w = React.useState(null), activationTool = _w[0], setActivationTool = _w[1];
|
|
150
152
|
var preparingActivation = React.useRef(false);
|
|
151
153
|
var baseline = React.useRef("");
|
|
152
154
|
var currentForm = function () { var _a; return JSON.stringify({ name: name, iconName: iconName, description: description, type: type, sourceCode: sourceCode, tags: tags, moduleId: (_a = module === null || module === void 0 ? void 0 : module.id) !== null && _a !== void 0 ? _a : null }); };
|
|
@@ -154,7 +156,7 @@ export function AgentToolRegistryEditorPage() {
|
|
|
154
156
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
155
157
|
var nextTags = agentHubTagsFrom(record === null || record === void 0 ? void 0 : record.tags);
|
|
156
158
|
var nextModule = agentHubModuleFrom(record === null || record === void 0 ? void 0 : record.module);
|
|
157
|
-
setName((_a = record === null || record === void 0 ? void 0 : record.name) !== null && _a !== void 0 ? _a :
|
|
159
|
+
setName((_a = record === null || record === void 0 ? void 0 : record.name) !== null && _a !== void 0 ? _a : initialName);
|
|
158
160
|
setIconName((_b = record === null || record === void 0 ? void 0 : record.iconName) !== null && _b !== void 0 ? _b : "");
|
|
159
161
|
setDescription((_c = record === null || record === void 0 ? void 0 : record.description) !== null && _c !== void 0 ? _c : "");
|
|
160
162
|
setType((_d = record === null || record === void 0 ? void 0 : record.type) !== null && _d !== void 0 ? _d : "custom");
|
|
@@ -307,7 +309,7 @@ export function AgentToolRegistryEditorPage() {
|
|
|
307
309
|
}, [record === null || record === void 0 ? void 0 : record.agentTools]);
|
|
308
310
|
var sessionAgents = React.useMemo(function () { return agents.filter(function (agent) { return agent.id !== undefined && agent.id !== null; }); }, [agents]);
|
|
309
311
|
var tabs = __spreadArray([
|
|
310
|
-
{ value: "general", label: "General Info", content: _jsxs("fieldset", { className: "agent-tool-editor__general", disabled: isReadOnly, children: [isReadOnly && _jsx("p", { className: "agent-tool-editor__readonly-note", children: "SolidX tools cannot be edited." }), (record === null || record === void 0 ? void 0 : record.status) && _jsxs("section", { className: "agent-tool-editor__runtime-status".concat(record.status === "load_failed" ? " agent-tool-editor__runtime-status--failed" : ""), role: record.status === "load_failed" ? "alert" : "status", children: [_jsxs("div", { className: "agent-tool-editor__runtime-heading", children: [_jsx("strong", { children: "Runtime status" }), _jsx("span", { children: record.status.replace(/[_-]+/g, " ") })] }), record.status === "load_failed" ? _jsxs(_Fragment, { children: [_jsx("p", { children: "The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it." }), record.lastLoadError && _jsx("pre", { children: record.lastLoadError })] }) : _jsx("p", { children: record.lastLoadError || "No tool load error has been reported." })] }), _jsxs("div", { className: "agent-tool-editor__fields", children: [_jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Name ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: name, "aria-invalid": Boolean(fieldErrors.name), "aria-describedby": fieldErrors.name ? "agent-tool-name-error" : undefined, className: fieldErrors.name ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setName(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { name: "" })); }); } }), fieldErrors.name && _jsx("small", { id: "agent-tool-name-error", className: "agent-tool-editor__field-error", children: fieldErrors.name })] }), _jsxs("div", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Description ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: description, "aria-invalid": Boolean(fieldErrors.description), "aria-describedby": fieldErrors.description ? "agent-tool-description-error" : undefined, className: fieldErrors.description ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setDescription(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { description: "" })); }); } }), fieldErrors.description && _jsx("small", { id: "agent-tool-description-error", className: "agent-tool-editor__field-error", children: fieldErrors.description })] })] }), !(record === null || record === void 0 ? void 0 : record.id) && _jsxs("label", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Tool status" }), _jsx("select", { value: "inactive", disabled: true, "aria-label": "Tool status", children: _jsx("option", { value: "inactive", children: "Inactive" }) }), _jsx("small", { children: "New tools start inactive. Run configuration and initialization checks to activate." })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Tool type ", _jsx("b", { children: "*" })] }), _jsxs("select", { value: type, "aria-invalid": Boolean(fieldErrors.type), "aria-describedby": fieldErrors.type ? "agent-tool-type-error" : undefined, className: fieldErrors.type ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setType(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { type: "" })); }); }, children: [isReadOnly && _jsx("option", { value: "solidx", children: "SolidX" }), _jsx("option", { value: "thirdparty", children: "Third Party" }), _jsx("option", { value: "custom", children: "Custom" })] }), fieldErrors.type && _jsx("small", { id: "agent-tool-type-error", className: "agent-tool-editor__field-error", children: fieldErrors.type })] }), _jsx(AgentHubModuleField, { className: "agent-tool-editor__field", value: module, onChange: function (value) { setModule(value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { module: "" })); }); }, disabled: isReadOnly || isCreating || isSaving, clearable: false, required: true, error: fieldErrors.module }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, module: module, disabled: isReadOnly || isCreating || isSaving, onBusyChange: setCreatingTag }), (record === null || record === void 0 ? void 0 : record.id) && _jsxs("section", { className: "agent-tool-editor__workflow", "aria-labelledby": "agent-tool-lifecycle-title", children: [_jsx("div", { className: "agent-tool-editor__workflow-head", children: _jsxs("div", { children: [_jsx("h2", { id: "agent-tool-lifecycle-title", children: "Tool lifecycle" }), _jsx("p", { children: "Configuration and initialization must pass before this tool can be activated." })] }) }), _jsx("div", { className: "agent-tool-editor__workflow-stages", "aria-label": "Current tool stage: ".concat(((
|
|
312
|
+
{ value: "general", label: "General Info", content: _jsxs("fieldset", { className: "agent-tool-editor__general", disabled: isReadOnly, children: [isReadOnly && _jsx("p", { className: "agent-tool-editor__readonly-note", children: "SolidX tools cannot be edited." }), (record === null || record === void 0 ? void 0 : record.status) && _jsxs("section", { className: "agent-tool-editor__runtime-status".concat(record.status === "load_failed" ? " agent-tool-editor__runtime-status--failed" : ""), role: record.status === "load_failed" ? "alert" : "status", children: [_jsxs("div", { className: "agent-tool-editor__runtime-heading", children: [_jsx("strong", { children: "Runtime status" }), _jsx("span", { children: record.status.replace(/[_-]+/g, " ") })] }), record.status === "load_failed" ? _jsxs(_Fragment, { children: [_jsx("p", { children: "The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it." }), record.lastLoadError && _jsx("pre", { children: record.lastLoadError })] }) : _jsx("p", { children: record.lastLoadError || "No tool load error has been reported." })] }), _jsxs("div", { className: "agent-tool-editor__fields", children: [_jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Name ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: name, "aria-invalid": Boolean(fieldErrors.name), "aria-describedby": fieldErrors.name ? "agent-tool-name-error" : undefined, className: fieldErrors.name ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setName(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { name: "" })); }); } }), fieldErrors.name && _jsx("small", { id: "agent-tool-name-error", className: "agent-tool-editor__field-error", children: fieldErrors.name })] }), _jsxs("div", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Description ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: description, "aria-invalid": Boolean(fieldErrors.description), "aria-describedby": fieldErrors.description ? "agent-tool-description-error" : undefined, className: fieldErrors.description ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setDescription(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { description: "" })); }); } }), fieldErrors.description && _jsx("small", { id: "agent-tool-description-error", className: "agent-tool-editor__field-error", children: fieldErrors.description })] })] }), !(record === null || record === void 0 ? void 0 : record.id) && _jsxs("label", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Tool status" }), _jsx("select", { value: "inactive", disabled: true, "aria-label": "Tool status", children: _jsx("option", { value: "inactive", children: "Inactive" }) }), _jsx("small", { children: "New tools start inactive. Run configuration and initialization checks to activate." })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Tool type ", _jsx("b", { children: "*" })] }), _jsxs("select", { value: type, "aria-invalid": Boolean(fieldErrors.type), "aria-describedby": fieldErrors.type ? "agent-tool-type-error" : undefined, className: fieldErrors.type ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setType(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { type: "" })); }); }, children: [isReadOnly && _jsx("option", { value: "solidx", children: "SolidX" }), _jsx("option", { value: "thirdparty", children: "Third Party" }), _jsx("option", { value: "custom", children: "Custom" })] }), fieldErrors.type && _jsx("small", { id: "agent-tool-type-error", className: "agent-tool-editor__field-error", children: fieldErrors.type })] }), _jsx(AgentHubModuleField, { className: "agent-tool-editor__field", value: module, onChange: function (value) { setModule(value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { module: "" })); }); }, disabled: isReadOnly || isCreating || isSaving, clearable: false, required: true, error: fieldErrors.module }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, module: module, disabled: isReadOnly || isCreating || isSaving, onBusyChange: setCreatingTag }), (record === null || record === void 0 ? void 0 : record.id) && _jsxs("section", { className: "agent-tool-editor__workflow", "aria-labelledby": "agent-tool-lifecycle-title", children: [_jsx("div", { className: "agent-tool-editor__workflow-head", children: _jsxs("div", { children: [_jsx("h2", { id: "agent-tool-lifecycle-title", children: "Tool lifecycle" }), _jsx("p", { children: "Configuration and initialization must pass before this tool can be activated." })] }) }), _jsx("div", { className: "agent-tool-editor__workflow-stages", "aria-label": "Current tool stage: ".concat(((_c = record.status) !== null && _c !== void 0 ? _c : "inactive").replace(/[_-]+/g, " ")), children: [["active", "Active", "Enabled for loading into linked agents."], ["inactive", "Inactive", "Not loaded for linked agents."], ["load_failed", "Load failed", "AgentHub could not load this tool."]].map(function (_a, index) {
|
|
311
313
|
var _b;
|
|
312
314
|
var value = _a[0], label = _a[1], description = _a[2];
|
|
313
315
|
var currentStatus = (_b = record.status) !== null && _b !== void 0 ? _b : "inactive";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentToolRegistryEditorPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,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AAE,CAAC,EAAA;;gCAAtH,SAAsH,CAAC;gCACvH,sBAAsB,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,GAAG,CAAC,EAAX,CAAW,CAAC,CAAC;gCACjD,KAAK,OAAO,EAAE,CAAC;gCACf,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,iDAAiD,EAAE,CAAC,CAAC,CAAC;;;;qBACpI,GAAI,EACN,SAAS,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,4BAA4B,mCAAoB,CAAC,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,EAAC,CAAC,CAAC,CAC1F,KAAC,uBAAuB,IAAC,iBAAiB,EAAC,mBAAmB,EAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,YAChJ,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAC,yBAAyB,EAAC,aAAa,EAAC,6BAA6B,EAAC,cAAc,EAAC,8BAA8B,GAAG,GACzL,CAC3B,CAAC,CAAC,CAAC,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAC,yBAAyB,EAAC,aAAa,EAAC,6BAA6B,EAAC,cAAc,EAAC,8BAA8B,GAAG,IAChN,CAAC;AACV,CAAC","sourcesContent":["import React from \"react\";\nimport { ArrowLeft, RefreshCw } from \"lucide-react\";\nimport { useDispatch } from \"react-redux\";\nimport { useNavigate, useParams } from \"react-router-dom\";\nimport { createSolidEntityApi } from \"../../../../redux/api/solidEntityApi\";\nimport { hasAnyRole } from \"../../../../helpers/rolesHelper\";\nimport { useSession } from \"../../../../hooks/useSession\";\nimport { showToast } from \"../../../../redux/features/toastSlice\";\nimport { solidPatch } from \"../../../../http/solidHttp\";\nimport { AgentRegistryAuditPanel } from \"./AgentRegistryAuditPanel\";\nimport { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from \"./AgentHubTagsField\";\nimport { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload, type AgentHubModule } from \"./AgentHubModuleField\";\nimport { AgentToolActivationDialog } from \"./AgentToolActivationDialog\";\nimport { AgentToolSessionsPanel } from \"../../../../components/core/extension/solid-core/agentToolRegistry/AgentToolSessionsPanel\";\nimport { AgentRegistryCardWidget } from \"../../../../components/core/extension/solid-core/agentRegistry/card/AgentRegistryCardWidget\";\nimport { SolidButton, SolidCodeEditor, SolidDialog, SolidDialogBody, SolidIconPicker, SolidInput, SolidTabGroup } from \"../../../../components/shad-cn-ui\";\nimport \"./AgentToolRegistryEditorPage.css\";\n\nconst SharedAgentRegistryCard = AgentRegistryCardWidget as React.ComponentType<{ rowData: Record<string, any> }>;\n\ntype Agent = { id?: number | string; name?: string; title?: string; [key: string]: any };\ntype AgentToolLink = { agentRegistry?: Agent | number | string | null };\ntype ToolRecord = {\n id: number;\n name?: string;\n iconName?: string | null;\n description?: string;\n tags?: AgentHubTag[];\n module?: AgentHubModule | null;\n type?: string;\n status?: string | null;\n lastLoadError?: string | null;\n sourceCode?: string;\n checksum?: string;\n agentTools?: AgentToolLink[] | AgentToolLink | null;\n};\n\nfunction extractEntityRecord(response: unknown): Record<string, any> | undefined {\n let candidate: unknown = response;\n for (let depth = 0; depth < 3; depth += 1) {\n if (!candidate || typeof candidate !== \"object\") return undefined;\n const value = candidate as Record<string, unknown>;\n if (\"id\" in value || \"name\" in value) return value;\n candidate = value.data;\n }\n return candidate && typeof candidate === \"object\" ? candidate as Record<string, any> : undefined;\n}\n\nasync function sha256Hex(value: string): Promise<string> {\n const digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nfunction formatErrorMessage(value: unknown): string | undefined {\n if (typeof value === \"string\") return value.trim() || undefined;\n if (Array.isArray(value)) {\n const messages = value.map(formatErrorMessage).filter((message): message is string => Boolean(message));\n return messages.length ? messages.join(\"; \") : undefined;\n }\n if (value && typeof value === \"object\") {\n const error = value as Record<string, unknown>;\n return formatErrorMessage(error.message)\n ?? formatErrorMessage(error.constraints)\n ?? formatErrorMessage(error.error);\n }\n return undefined;\n}\n\nfunction getSaveErrorMessage(error: unknown): string {\n if (!error || typeof error !== \"object\") return \"Failed to save tool.\";\n const apiError = error as Record<string, any>;\n return formatErrorMessage(apiError.data?.data?.message)\n ?? formatErrorMessage(apiError.data?.message)\n ?? formatErrorMessage(apiError.data?.error)\n ?? formatErrorMessage(apiError.message)\n ?? \"Failed to save tool.\";\n}\n\nexport function AgentToolRegistryEditorPage() {\n const { id = \"\" } = useParams<{ id: string }>();\n const { data: session } = useSession();\n const isAdmin = hasAnyRole(session?.user?.roles, [\"Admin\"]);\n const navigate = useNavigate();\n const dispatch = useDispatch();\n const entityApi = React.useMemo(() => createSolidEntityApi(\"agentToolRegistry\"), []);\n const { useCreateSolidEntityMutation, useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation } = entityApi;\n const { data: response, isLoading, isFetching, refetch } = useGetSolidEntityByIdQuery(\n { id, qs: \"populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags&populate[3]=module\" },\n { skip: !id || id === \"new\" },\n );\n const [createTool, { isLoading: isCreating }] = useCreateSolidEntityMutation();\n const [updateTool, { isLoading: isSaving }] = useUpdateSolidEntityMutation();\n const record = extractEntityRecord(response) as ToolRecord | undefined;\n const [activeTab, setActiveTab] = React.useState(\"general\");\n const [name, setName] = React.useState(\"\");\n const [iconName, setIconName] = React.useState(\"\");\n const [description, setDescription] = React.useState(\"\");\n const [type, setType] = React.useState(\"custom\");\n const [sourceCode, setSourceCode] = React.useState(\"\");\n const [tags, setTags] = React.useState<AgentHubTag[]>([]);\n const [module, setModule] = React.useState<AgentHubModule | null>(null);\n const [creatingTag, setCreatingTag] = React.useState(false);\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({});\n const [auditRefreshVersion, setAuditRefreshVersion] = React.useState(0);\n const [confirmRefresh, setConfirmRefresh] = React.useState(false);\n const [activationOpen, setActivationOpen] = React.useState(false);\n const [activationTool, setActivationTool] = React.useState<{ id: number; checksum: string; name: string } | null>(null);\n const preparingActivation = React.useRef(false);\n const baseline = React.useRef(\"\");\n\n const currentForm = () => JSON.stringify({ name, iconName, description, type, sourceCode, tags, moduleId: module?.id ?? null });\n\n React.useEffect(() => {\n const nextTags = agentHubTagsFrom(record?.tags);\n const nextModule = agentHubModuleFrom(record?.module);\n setName(record?.name ?? \"\");\n setIconName(record?.iconName ?? \"\");\n setDescription(record?.description ?? \"\");\n setType(record?.type ?? \"custom\");\n setSourceCode(record?.sourceCode ?? \"\");\n setTags(nextTags);\n setModule(nextModule);\n baseline.current = JSON.stringify({ name: record?.name ?? \"\", iconName: record?.iconName ?? \"\", description: record?.description ?? \"\", type: record?.type ?? \"custom\", sourceCode: record?.sourceCode ?? \"\", tags: nextTags, moduleId: nextModule?.id ?? null });\n }, [record]);\n\n const isReadOnly = record?.type === \"solidx\";\n const isDirty = Boolean(record?.id) && currentForm() !== baseline.current;\n const requestRefresh = () => isDirty ? setConfirmRefresh(true) : void refetch();\n\n const save = async (nextStatus?: \"inactive\") => {\n if (creatingTag) return;\n const nextErrors: Record<string, string> = {};\n if (!name.trim()) nextErrors.name = \"Name is required.\";\n if (!description.trim()) nextErrors.description = \"Description is required.\";\n if (!type.trim()) nextErrors.type = \"Tool type is required.\";\n if (!sourceCode.trim()) nextErrors.sourceCode = \"Tool source code is required.\";\n if (!module) nextErrors.module = \"Module is required. Select a module before saving this tool.\";\n\n setFieldErrors(nextErrors);\n if (Object.keys(nextErrors).length > 0) {\n setActiveTab(nextErrors.sourceCode ? \"tool\" : \"general\");\n dispatch(showToast({ severity: \"error\", summary: \"Missing information\", detail: Object.values(nextErrors).join(\" \") }));\n return;\n }\n const payload = {\n name: name.trim(), iconName: iconName || null, description: description.trim(), type,\n sourceCode, ...agentHubTagsPayload(tags), ...agentHubModulePayload(module),\n ...([\"custom\", \"thirdparty\"].includes(type) ? { checksum: await sha256Hex(sourceCode) } : {}),\n status: nextStatus ?? (record && (sourceCode !== record.sourceCode || name.trim() !== record.name || type !== record.type)\n ? \"inactive\" : record?.status ?? \"inactive\"),\n };\n try {\n if (record?.id) {\n const result = await updateTool({ id: record.id, data: payload }).unwrap();\n dispatch(showToast({ severity: \"success\", summary: nextStatus ? \"Tool status updated\" : \"Saved\", detail: nextStatus ? `Tool moved to ${nextStatus}. Restart linked agent processes to apply the change.` : \"Tool updated successfully.\" }));\n setAuditRefreshVersion((version) => version + 1);\n refetch();\n return (extractEntityRecord(result) ?? { ...record, ...payload }) as ToolRecord;\n } else {\n const result: any = await createTool(payload).unwrap();\n const createdId = result?.data?.id ?? result?.id;\n dispatch(showToast({ severity: \"success\", summary: \"Created\", detail: \"Tool created successfully.\" }));\n if (createdId) navigate(`/admin/core/solid-core/agent-tool-registry/editor/${createdId}`, { replace: true });\n }\n } catch (error: any) {\n const errorDetail = getSaveErrorMessage(error);\n const serverFieldErrors: Record<string, string> = {};\n if (/required|not be empty|cannot be empty|should not be empty/i.test(errorDetail)) {\n for (const field of [\"name\", \"description\", \"type\", \"sourceCode\", \"module\"]) {\n if (!new RegExp(`\\\\b${field}\\\\b`, \"i\").test(errorDetail)) continue;\n const label = field === \"sourceCode\" ? \"Tool source code\" : field === \"module\" ? \"Module\" : field[0].toUpperCase() + field.slice(1);\n serverFieldErrors[field] = `${label} is required.`;\n }\n }\n if (Object.keys(serverFieldErrors).length > 0) {\n setFieldErrors(serverFieldErrors);\n setActiveTab(serverFieldErrors.sourceCode ? \"tool\" : \"general\");\n }\n dispatch(showToast({ severity: \"error\", summary: \"Save failed\", detail: errorDetail }));\n }\n };\n\n const beginActivation = async () => {\n if (isReadOnly) return;\n if (!record || activationOpen || isSaving || preparingActivation.current) return;\n preparingActivation.current = true;\n try {\n const saved = isDirty || record.status === \"load_failed\" ? await save(\"inactive\") : record;\n if (!saved?.id) return;\n const checksum = await sha256Hex(saved.sourceCode ?? sourceCode);\n setActivationTool({ id: saved.id, checksum, name: saved.name ?? name });\n setActivationOpen(true);\n } catch {\n dispatch(showToast({ severity: \"error\", summary: \"Activation failed\", detail: \"Could not prepare the saved tool source for checks.\" }));\n } finally {\n preparingActivation.current = false;\n }\n };\n\n const agents = React.useMemo(() => {\n const relatedTools = record?.agentTools;\n const links = Array.isArray(relatedTools) ? relatedTools : relatedTools ? [relatedTools] : [];\n const seen = new Set<string>();\n return links.map((link) => link.agentRegistry).filter((agent): agent is Agent => Boolean(agent && typeof agent === \"object\"))\n .filter((agent) => {\n const key = String(agent.id ?? agent.name ?? agent.title ?? \"\");\n if (!key || seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n }, [record?.agentTools]);\n const sessionAgents = React.useMemo(() => agents.filter((agent): agent is Agent & { id: number | string } => agent.id !== undefined && agent.id !== null), [agents]);\n const tabs = [\n { value: \"general\", label: \"General Info\", content: <fieldset className=\"agent-tool-editor__general\" disabled={isReadOnly}>\n {isReadOnly && <p className=\"agent-tool-editor__readonly-note\">SolidX tools cannot be edited.</p>}\n {record?.status && <section className={`agent-tool-editor__runtime-status${record.status === \"load_failed\" ? \" agent-tool-editor__runtime-status--failed\" : \"\"}`} role={record.status === \"load_failed\" ? \"alert\" : \"status\"}>\n <div className=\"agent-tool-editor__runtime-heading\"><strong>Runtime status</strong><span>{record.status.replace(/[_-]+/g, \" \")}</span></div>\n {record.status === \"load_failed\" ? <>\n <p>The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it.</p>\n {record.lastLoadError && <pre>{record.lastLoadError}</pre>}\n </> : <p>{record.lastLoadError || \"No tool load error has been reported.\"}</p>}\n </section>}\n <div className=\"agent-tool-editor__fields\">\n <label className=\"agent-tool-editor__field\"><span>Name <b>*</b></span><SolidInput value={name} aria-invalid={Boolean(fieldErrors.name)} aria-describedby={fieldErrors.name ? \"agent-tool-name-error\" : undefined} className={fieldErrors.name ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setName(e.target.value); setFieldErrors((current) => ({ ...current, name: \"\" })); }} />{fieldErrors.name && <small id=\"agent-tool-name-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.name}</small>}</label>\n <div className=\"agent-tool-editor__field\"><span>Icon</span><SolidIconPicker value={iconName} onChange={setIconName} /></div>\n <label className=\"agent-tool-editor__field\"><span>Description <b>*</b></span><SolidInput value={description} aria-invalid={Boolean(fieldErrors.description)} aria-describedby={fieldErrors.description ? \"agent-tool-description-error\" : undefined} className={fieldErrors.description ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setDescription(e.target.value); setFieldErrors((current) => ({ ...current, description: \"\" })); }} />{fieldErrors.description && <small id=\"agent-tool-description-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.description}</small>}</label>\n </div>\n {!record?.id && <label className=\"agent-tool-editor__field\"><span>Tool status</span><select value=\"inactive\" disabled aria-label=\"Tool status\"><option value=\"inactive\">Inactive</option></select><small>New tools start inactive. Run configuration and initialization checks to activate.</small></label>}\n <label className=\"agent-tool-editor__field\"><span>Tool type <b>*</b></span><select value={type} aria-invalid={Boolean(fieldErrors.type)} aria-describedby={fieldErrors.type ? \"agent-tool-type-error\" : undefined} className={fieldErrors.type ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setType(e.target.value); setFieldErrors((current) => ({ ...current, type: \"\" })); }}>\n {isReadOnly && <option value=\"solidx\">SolidX</option>}<option value=\"thirdparty\">Third Party</option><option value=\"custom\">Custom</option>\n </select>{fieldErrors.type && <small id=\"agent-tool-type-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.type}</small>}</label>\n <AgentHubModuleField className=\"agent-tool-editor__field\" value={module} onChange={(value) => { setModule(value); setFieldErrors((current) => ({ ...current, module: \"\" })); }} disabled={isReadOnly || isCreating || isSaving} clearable={false} required error={fieldErrors.module} />\n <AgentHubTagsField value={tags} onChange={setTags} module={module} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />\n {record?.id && <section className=\"agent-tool-editor__workflow\" aria-labelledby=\"agent-tool-lifecycle-title\">\n <div className=\"agent-tool-editor__workflow-head\"><div><h2 id=\"agent-tool-lifecycle-title\">Tool lifecycle</h2><p>Configuration and initialization must pass before this tool can be activated.</p></div></div>\n <div className=\"agent-tool-editor__workflow-stages\" aria-label={`Current tool stage: ${(record.status ?? \"inactive\").replace(/[_-]+/g, \" \")}`}>\n {([ [\"active\", \"Active\", \"Enabled for loading into linked agents.\"], [\"inactive\", \"Inactive\", \"Not loaded for linked agents.\"], [\"load_failed\", \"Load failed\", \"AgentHub could not load this tool.\"] ] as const).map(([value, label, description], index) => {\n const currentStatus = record.status ?? \"inactive\";\n const isCurrent = currentStatus === value;\n const canRetry = value === \"load_failed\" && isCurrent;\n const disabled = isReadOnly || activationOpen || isCreating || isSaving || (!canRetry && (value === \"load_failed\" || isCurrent));\n return <React.Fragment key={value}>\n {index > 0 && <div className=\"agent-tool-editor__workflow-connector\" aria-hidden=\"true\" />}\n <button type=\"button\" className={`agent-tool-editor__workflow-stage agent-tool-editor__workflow-stage--${value}${isCurrent ? \" is-current\" : \"\"}`}\n aria-current={isCurrent ? \"step\" : undefined} aria-pressed={isCurrent} disabled={disabled}\n onClick={() => value === \"inactive\" ? void save(\"inactive\") : void beginActivation()}>\n <span className=\"agent-tool-editor__workflow-mark\">{index + 1}</span>\n <span className=\"agent-tool-editor__workflow-copy\"><strong>{label}</strong><small>{description}</small><small className=\"agent-tool-editor__workflow-cta\">{canRetry ? \"Run checks and retry activation\" : isCurrent ? \"Current stage\" : value === \"load_failed\" ? \"Set automatically by AgentHub\" : value === \"active\" ? \"Run checks to activate\" : \"Click to deactivate\"}</small></span>\n {isCurrent && <span className=\"agent-tool-editor__workflow-current\">Current</span>}\n </button>\n </React.Fragment>;\n })}\n </div>\n {record.status === \"load_failed\" && <small className=\"agent-tool-editor__workflow-hint\">Fix the source or checksum, then run configuration and initialization checks before retrying activation.</small>}\n <small className=\"agent-tool-editor__workflow-hint\">Activation checks use the saved tool configuration. Restart linked agent processes to apply status changes.</small>\n </section>}\n </fieldset> },\n { value: \"tool\", label: \"Tool\", content: <div className=\"agent-tool-editor__tool\">\n <section className=\"agent-tool-editor__panel\">\n <header><h2>Tool source code <b>*</b></h2><p>Write the tool's Python code here.</p></header>\n <SolidCodeEditor value={sourceCode} onChange={(value) => { setSourceCode(value ?? \"\"); setFieldErrors((current) => ({ ...current, sourceCode: \"\" })); }} language=\"python\" wordWrap=\"on\" readOnly={isReadOnly} fontSize={11} height=\"max(32rem, calc(100dvh - 18rem))\" className={`agent-tool-editor__code${fieldErrors.sourceCode ? \" agent-tool-editor__code--invalid\" : \"\"}`} />\n {fieldErrors.sourceCode && <small className=\"agent-tool-editor__field-error agent-tool-editor__code-error\">{fieldErrors.sourceCode}</small>}\n </section>\n </div> },\n { value: \"agents\", label: \"Agents\", content: <section className=\"agent-tool-editor__agents\"><div><h2>Associated agents</h2><p>Agents linked to this tool. Associations are read-only here.</p></div>\n {isLoading ? <p>Loading associated agents…</p> : agents.length ? <div className=\"agent-tool-editor__agent-grid\">{agents.map((agent, index) => <div className=\"agent-tool-editor__agent-card\" key={String(agent.id ?? agent.name ?? index)}><SharedAgentRegistryCard rowData={agent} /></div>)}</div> : <div className=\"agent-tool-editor__empty\">No agents are currently associated with this tool.</div>}\n </section> },\n ...(isAdmin ? [{ value: \"sessions\", label: \"Sessions\", content: <AgentToolSessionsPanel agents={sessionAgents} /> }] : []),\n ];\n const visibleActiveTab = !isAdmin && activeTab === \"sessions\" ? \"general\" : activeTab;\n\n return <main className=\"agent-tool-editor\">\n <header className=\"agent-tool-editor__header\"><div><div className=\"agent-tool-editor__heading-with-refresh\"><h1>{record ? \"Edit Tool\" : \"Create Tool\"}</h1>{record?.id && <button type=\"button\" className={`agent-tool-editor__refresh${isFetching ? \" is-loading\" : \"\"}`} aria-label=\"Refresh tool\" title=\"Refresh tool\" disabled={isFetching || isSaving} onClick={requestRefresh}><RefreshCw size={14} /></button>}</div></div><div className=\"agent-tool-editor__actions\">\n <SolidButton variant=\"secondary\" leftIcon={<ArrowLeft size={16} />} onClick={() => navigate(-1)}>Back</SolidButton>\n {!isReadOnly && <SolidButton disabled={activationOpen || creatingTag} loading={isCreating || isSaving} onClick={() => void save()}>Save Tool</SolidButton>}\n </div></header>\n <SolidDialog open={confirmRefresh} onOpenChange={setConfirmRefresh} header=\"Discard unsaved changes?\" style={{ width: \"min(28rem, 94vw)\" }}\n footer={<><SolidButton type=\"button\" variant=\"secondary\" onClick={() => setConfirmRefresh(false)}>Cancel</SolidButton><SolidButton type=\"button\" disabled={isFetching} onClick={() => { setConfirmRefresh(false); void refetch(); }}>Refresh and discard</SolidButton></>}>\n <SolidDialogBody><p>You have unsaved changes. Refreshing will discard them and load the latest tool content.</p></SolidDialogBody>\n </SolidDialog>\n {activationOpen && activationTool && <AgentToolActivationDialog open={activationOpen} onOpenChange={setActivationOpen}\n toolId={activationTool.id} checksum={activationTool.checksum} toolName={activationTool.name}\n onActivated={async () => {\n await solidPatch(`/agent-tool-registry/${activationTool.id}`, { status: \"active\", checksum: activationTool.checksum });\n setAuditRefreshVersion((version) => version + 1);\n void refetch();\n dispatch(showToast({ severity: \"success\", summary: \"Tool activated\", detail: \"Configuration and initialization checks passed.\" }));\n }} />}\n {isLoading ? <div className=\"agent-tool-editor__loading\">Loading tool…</div> : record?.id ? (\n <AgentRegistryAuditPanel modelSingularName=\"agentToolRegistry\" recordId={record.id} refreshVersion={auditRefreshVersion} modelUserKey={record.name}>\n <SolidTabGroup tabs={tabs} value={visibleActiveTab} onValueChange={setActiveTab} className=\"agent-tool-editor__tabs\" listClassName=\"agent-tool-editor__tab-list\" panelClassName=\"agent-tool-editor__tab-panel\" />\n </AgentRegistryAuditPanel>\n ) : <SolidTabGroup tabs={tabs} value={visibleActiveTab} onValueChange={setActiveTab} className=\"agent-tool-editor__tabs\" listClassName=\"agent-tool-editor__tab-list\" panelClassName=\"agent-tool-editor__tab-panel\" />}\n </main>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AgentToolRegistryEditorPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB,EAAoB,MAAM,qBAAqB,CAAC;AACjH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAqB,EAAuB,MAAM,uBAAuB,CAAC;AAC5H,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2FAA2F,CAAC;AACnI,OAAO,EAAE,uBAAuB,E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AE,gBAAgB,EAAE,MAAM,EAAE,iDAAiD,EAAE,CAAC,CAAC,CAAC;;;;qBACpI,GAAI,EACN,SAAS,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,4BAA4B,mCAAoB,CAAC,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,EAAC,CAAC,CAAC,CAC1F,KAAC,uBAAuB,IAAC,iBAAiB,EAAC,mBAAmB,EAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,YAChJ,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAC,yBAAyB,EAAC,aAAa,EAAC,6BAA6B,EAAC,cAAc,EAAC,8BAA8B,GAAG,GACzL,CAC3B,CAAC,CAAC,CAAC,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAC,yBAAyB,EAAC,aAAa,EAAC,6BAA6B,EAAC,cAAc,EAAC,8BAA8B,GAAG,IAChN,CAAC;AACV,CAAC","sourcesContent":["import React from \"react\";\nimport { ArrowLeft, RefreshCw } from \"lucide-react\";\nimport { useDispatch } from \"react-redux\";\nimport { useNavigate, useParams, useSearchParams } from \"react-router-dom\";\nimport { createSolidEntityApi } from \"../../../../redux/api/solidEntityApi\";\nimport { hasAnyRole } from \"../../../../helpers/rolesHelper\";\nimport { useSession } from \"../../../../hooks/useSession\";\nimport { showToast } from \"../../../../redux/features/toastSlice\";\nimport { solidPatch } from \"../../../../http/solidHttp\";\nimport { AgentRegistryAuditPanel } from \"./AgentRegistryAuditPanel\";\nimport { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from \"./AgentHubTagsField\";\nimport { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload, type AgentHubModule } from \"./AgentHubModuleField\";\nimport { AgentToolActivationDialog } from \"./AgentToolActivationDialog\";\nimport { AgentToolSessionsPanel } from \"../../../../components/core/extension/solid-core/agentToolRegistry/AgentToolSessionsPanel\";\nimport { AgentRegistryCardWidget } from \"../../../../components/core/extension/solid-core/agentRegistry/card/AgentRegistryCardWidget\";\nimport { SolidButton, SolidCodeEditor, SolidDialog, SolidDialogBody, SolidIconPicker, SolidInput, SolidTabGroup } from \"../../../../components/shad-cn-ui\";\nimport \"./AgentToolRegistryEditorPage.css\";\n\nconst SharedAgentRegistryCard = AgentRegistryCardWidget as React.ComponentType<{ rowData: Record<string, any> }>;\n\ntype Agent = { id?: number | string; name?: string; title?: string; [key: string]: any };\ntype AgentToolLink = { agentRegistry?: Agent | number | string | null };\ntype ToolRecord = {\n id: number;\n name?: string;\n iconName?: string | null;\n description?: string;\n tags?: AgentHubTag[];\n module?: AgentHubModule | null;\n type?: string;\n status?: string | null;\n lastLoadError?: string | null;\n sourceCode?: string;\n checksum?: string;\n agentTools?: AgentToolLink[] | AgentToolLink | null;\n};\n\nfunction extractEntityRecord(response: unknown): Record<string, any> | undefined {\n let candidate: unknown = response;\n for (let depth = 0; depth < 3; depth += 1) {\n if (!candidate || typeof candidate !== \"object\") return undefined;\n const value = candidate as Record<string, unknown>;\n if (\"id\" in value || \"name\" in value) return value;\n candidate = value.data;\n }\n return candidate && typeof candidate === \"object\" ? candidate as Record<string, any> : undefined;\n}\n\nasync function sha256Hex(value: string): Promise<string> {\n const digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nfunction formatErrorMessage(value: unknown): string | undefined {\n if (typeof value === \"string\") return value.trim() || undefined;\n if (Array.isArray(value)) {\n const messages = value.map(formatErrorMessage).filter((message): message is string => Boolean(message));\n return messages.length ? messages.join(\"; \") : undefined;\n }\n if (value && typeof value === \"object\") {\n const error = value as Record<string, unknown>;\n return formatErrorMessage(error.message)\n ?? formatErrorMessage(error.constraints)\n ?? formatErrorMessage(error.error);\n }\n return undefined;\n}\n\nfunction getSaveErrorMessage(error: unknown): string {\n if (!error || typeof error !== \"object\") return \"Failed to save tool.\";\n const apiError = error as Record<string, any>;\n return formatErrorMessage(apiError.data?.data?.message)\n ?? formatErrorMessage(apiError.data?.message)\n ?? formatErrorMessage(apiError.data?.error)\n ?? formatErrorMessage(apiError.message)\n ?? \"Failed to save tool.\";\n}\n\nexport function AgentToolRegistryEditorPage() {\n const { id = \"\" } = useParams<{ id: string }>();\n const [searchParams] = useSearchParams();\n const initialName = id === \"new\" ? searchParams.get(\"name\") ?? \"\" : \"\";\n const { data: session } = useSession();\n const isAdmin = hasAnyRole(session?.user?.roles, [\"Admin\"]);\n const navigate = useNavigate();\n const dispatch = useDispatch();\n const entityApi = React.useMemo(() => createSolidEntityApi(\"agentToolRegistry\"), []);\n const { useCreateSolidEntityMutation, useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation } = entityApi;\n const { data: response, isLoading, isFetching, refetch } = useGetSolidEntityByIdQuery(\n { id, qs: \"populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags&populate[3]=module\" },\n { skip: !id || id === \"new\" },\n );\n const [createTool, { isLoading: isCreating }] = useCreateSolidEntityMutation();\n const [updateTool, { isLoading: isSaving }] = useUpdateSolidEntityMutation();\n const record = extractEntityRecord(response) as ToolRecord | undefined;\n const [activeTab, setActiveTab] = React.useState(\"general\");\n const [name, setName] = React.useState(\"\");\n const [iconName, setIconName] = React.useState(\"\");\n const [description, setDescription] = React.useState(\"\");\n const [type, setType] = React.useState(\"custom\");\n const [sourceCode, setSourceCode] = React.useState(\"\");\n const [tags, setTags] = React.useState<AgentHubTag[]>([]);\n const [module, setModule] = React.useState<AgentHubModule | null>(null);\n const [creatingTag, setCreatingTag] = React.useState(false);\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({});\n const [auditRefreshVersion, setAuditRefreshVersion] = React.useState(0);\n const [confirmRefresh, setConfirmRefresh] = React.useState(false);\n const [activationOpen, setActivationOpen] = React.useState(false);\n const [activationTool, setActivationTool] = React.useState<{ id: number; checksum: string; name: string } | null>(null);\n const preparingActivation = React.useRef(false);\n const baseline = React.useRef(\"\");\n\n const currentForm = () => JSON.stringify({ name, iconName, description, type, sourceCode, tags, moduleId: module?.id ?? null });\n\n React.useEffect(() => {\n const nextTags = agentHubTagsFrom(record?.tags);\n const nextModule = agentHubModuleFrom(record?.module);\n setName(record?.name ?? initialName);\n setIconName(record?.iconName ?? \"\");\n setDescription(record?.description ?? \"\");\n setType(record?.type ?? \"custom\");\n setSourceCode(record?.sourceCode ?? \"\");\n setTags(nextTags);\n setModule(nextModule);\n baseline.current = JSON.stringify({ name: record?.name ?? \"\", iconName: record?.iconName ?? \"\", description: record?.description ?? \"\", type: record?.type ?? \"custom\", sourceCode: record?.sourceCode ?? \"\", tags: nextTags, moduleId: nextModule?.id ?? null });\n }, [record]);\n\n const isReadOnly = record?.type === \"solidx\";\n const isDirty = Boolean(record?.id) && currentForm() !== baseline.current;\n const requestRefresh = () => isDirty ? setConfirmRefresh(true) : void refetch();\n\n const save = async (nextStatus?: \"inactive\") => {\n if (creatingTag) return;\n const nextErrors: Record<string, string> = {};\n if (!name.trim()) nextErrors.name = \"Name is required.\";\n if (!description.trim()) nextErrors.description = \"Description is required.\";\n if (!type.trim()) nextErrors.type = \"Tool type is required.\";\n if (!sourceCode.trim()) nextErrors.sourceCode = \"Tool source code is required.\";\n if (!module) nextErrors.module = \"Module is required. Select a module before saving this tool.\";\n\n setFieldErrors(nextErrors);\n if (Object.keys(nextErrors).length > 0) {\n setActiveTab(nextErrors.sourceCode ? \"tool\" : \"general\");\n dispatch(showToast({ severity: \"error\", summary: \"Missing information\", detail: Object.values(nextErrors).join(\" \") }));\n return;\n }\n const payload = {\n name: name.trim(), iconName: iconName || null, description: description.trim(), type,\n sourceCode, ...agentHubTagsPayload(tags), ...agentHubModulePayload(module),\n ...([\"custom\", \"thirdparty\"].includes(type) ? { checksum: await sha256Hex(sourceCode) } : {}),\n status: nextStatus ?? (record && (sourceCode !== record.sourceCode || name.trim() !== record.name || type !== record.type)\n ? \"inactive\" : record?.status ?? \"inactive\"),\n };\n try {\n if (record?.id) {\n const result = await updateTool({ id: record.id, data: payload }).unwrap();\n dispatch(showToast({ severity: \"success\", summary: nextStatus ? \"Tool status updated\" : \"Saved\", detail: nextStatus ? `Tool moved to ${nextStatus}. Restart linked agent processes to apply the change.` : \"Tool updated successfully.\" }));\n setAuditRefreshVersion((version) => version + 1);\n refetch();\n return (extractEntityRecord(result) ?? { ...record, ...payload }) as ToolRecord;\n } else {\n const result: any = await createTool(payload).unwrap();\n const createdId = result?.data?.id ?? result?.id;\n dispatch(showToast({ severity: \"success\", summary: \"Created\", detail: \"Tool created successfully.\" }));\n if (createdId) navigate(`/admin/core/solid-core/agent-tool-registry/editor/${createdId}`, { replace: true });\n }\n } catch (error: any) {\n const errorDetail = getSaveErrorMessage(error);\n const serverFieldErrors: Record<string, string> = {};\n if (/required|not be empty|cannot be empty|should not be empty/i.test(errorDetail)) {\n for (const field of [\"name\", \"description\", \"type\", \"sourceCode\", \"module\"]) {\n if (!new RegExp(`\\\\b${field}\\\\b`, \"i\").test(errorDetail)) continue;\n const label = field === \"sourceCode\" ? \"Tool source code\" : field === \"module\" ? \"Module\" : field[0].toUpperCase() + field.slice(1);\n serverFieldErrors[field] = `${label} is required.`;\n }\n }\n if (Object.keys(serverFieldErrors).length > 0) {\n setFieldErrors(serverFieldErrors);\n setActiveTab(serverFieldErrors.sourceCode ? \"tool\" : \"general\");\n }\n dispatch(showToast({ severity: \"error\", summary: \"Save failed\", detail: errorDetail }));\n }\n };\n\n const beginActivation = async () => {\n if (isReadOnly) return;\n if (!record || activationOpen || isSaving || preparingActivation.current) return;\n preparingActivation.current = true;\n try {\n const saved = isDirty || record.status === \"load_failed\" ? await save(\"inactive\") : record;\n if (!saved?.id) return;\n const checksum = await sha256Hex(saved.sourceCode ?? sourceCode);\n setActivationTool({ id: saved.id, checksum, name: saved.name ?? name });\n setActivationOpen(true);\n } catch {\n dispatch(showToast({ severity: \"error\", summary: \"Activation failed\", detail: \"Could not prepare the saved tool source for checks.\" }));\n } finally {\n preparingActivation.current = false;\n }\n };\n\n const agents = React.useMemo(() => {\n const relatedTools = record?.agentTools;\n const links = Array.isArray(relatedTools) ? relatedTools : relatedTools ? [relatedTools] : [];\n const seen = new Set<string>();\n return links.map((link) => link.agentRegistry).filter((agent): agent is Agent => Boolean(agent && typeof agent === \"object\"))\n .filter((agent) => {\n const key = String(agent.id ?? agent.name ?? agent.title ?? \"\");\n if (!key || seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n }, [record?.agentTools]);\n const sessionAgents = React.useMemo(() => agents.filter((agent): agent is Agent & { id: number | string } => agent.id !== undefined && agent.id !== null), [agents]);\n const tabs = [\n { value: \"general\", label: \"General Info\", content: <fieldset className=\"agent-tool-editor__general\" disabled={isReadOnly}>\n {isReadOnly && <p className=\"agent-tool-editor__readonly-note\">SolidX tools cannot be edited.</p>}\n {record?.status && <section className={`agent-tool-editor__runtime-status${record.status === \"load_failed\" ? \" agent-tool-editor__runtime-status--failed\" : \"\"}`} role={record.status === \"load_failed\" ? \"alert\" : \"status\"}>\n <div className=\"agent-tool-editor__runtime-heading\"><strong>Runtime status</strong><span>{record.status.replace(/[_-]+/g, \" \")}</span></div>\n {record.status === \"load_failed\" ? <>\n <p>The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it.</p>\n {record.lastLoadError && <pre>{record.lastLoadError}</pre>}\n </> : <p>{record.lastLoadError || \"No tool load error has been reported.\"}</p>}\n </section>}\n <div className=\"agent-tool-editor__fields\">\n <label className=\"agent-tool-editor__field\"><span>Name <b>*</b></span><SolidInput value={name} aria-invalid={Boolean(fieldErrors.name)} aria-describedby={fieldErrors.name ? \"agent-tool-name-error\" : undefined} className={fieldErrors.name ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setName(e.target.value); setFieldErrors((current) => ({ ...current, name: \"\" })); }} />{fieldErrors.name && <small id=\"agent-tool-name-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.name}</small>}</label>\n <div className=\"agent-tool-editor__field\"><span>Icon</span><SolidIconPicker value={iconName} onChange={setIconName} /></div>\n <label className=\"agent-tool-editor__field\"><span>Description <b>*</b></span><SolidInput value={description} aria-invalid={Boolean(fieldErrors.description)} aria-describedby={fieldErrors.description ? \"agent-tool-description-error\" : undefined} className={fieldErrors.description ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setDescription(e.target.value); setFieldErrors((current) => ({ ...current, description: \"\" })); }} />{fieldErrors.description && <small id=\"agent-tool-description-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.description}</small>}</label>\n </div>\n {!record?.id && <label className=\"agent-tool-editor__field\"><span>Tool status</span><select value=\"inactive\" disabled aria-label=\"Tool status\"><option value=\"inactive\">Inactive</option></select><small>New tools start inactive. Run configuration and initialization checks to activate.</small></label>}\n <label className=\"agent-tool-editor__field\"><span>Tool type <b>*</b></span><select value={type} aria-invalid={Boolean(fieldErrors.type)} aria-describedby={fieldErrors.type ? \"agent-tool-type-error\" : undefined} className={fieldErrors.type ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setType(e.target.value); setFieldErrors((current) => ({ ...current, type: \"\" })); }}>\n {isReadOnly && <option value=\"solidx\">SolidX</option>}<option value=\"thirdparty\">Third Party</option><option value=\"custom\">Custom</option>\n </select>{fieldErrors.type && <small id=\"agent-tool-type-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.type}</small>}</label>\n <AgentHubModuleField className=\"agent-tool-editor__field\" value={module} onChange={(value) => { setModule(value); setFieldErrors((current) => ({ ...current, module: \"\" })); }} disabled={isReadOnly || isCreating || isSaving} clearable={false} required error={fieldErrors.module} />\n <AgentHubTagsField value={tags} onChange={setTags} module={module} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />\n {record?.id && <section className=\"agent-tool-editor__workflow\" aria-labelledby=\"agent-tool-lifecycle-title\">\n <div className=\"agent-tool-editor__workflow-head\"><div><h2 id=\"agent-tool-lifecycle-title\">Tool lifecycle</h2><p>Configuration and initialization must pass before this tool can be activated.</p></div></div>\n <div className=\"agent-tool-editor__workflow-stages\" aria-label={`Current tool stage: ${(record.status ?? \"inactive\").replace(/[_-]+/g, \" \")}`}>\n {([ [\"active\", \"Active\", \"Enabled for loading into linked agents.\"], [\"inactive\", \"Inactive\", \"Not loaded for linked agents.\"], [\"load_failed\", \"Load failed\", \"AgentHub could not load this tool.\"] ] as const).map(([value, label, description], index) => {\n const currentStatus = record.status ?? \"inactive\";\n const isCurrent = currentStatus === value;\n const canRetry = value === \"load_failed\" && isCurrent;\n const disabled = isReadOnly || activationOpen || isCreating || isSaving || (!canRetry && (value === \"load_failed\" || isCurrent));\n return <React.Fragment key={value}>\n {index > 0 && <div className=\"agent-tool-editor__workflow-connector\" aria-hidden=\"true\" />}\n <button type=\"button\" className={`agent-tool-editor__workflow-stage agent-tool-editor__workflow-stage--${value}${isCurrent ? \" is-current\" : \"\"}`}\n aria-current={isCurrent ? \"step\" : undefined} aria-pressed={isCurrent} disabled={disabled}\n onClick={() => value === \"inactive\" ? void save(\"inactive\") : void beginActivation()}>\n <span className=\"agent-tool-editor__workflow-mark\">{index + 1}</span>\n <span className=\"agent-tool-editor__workflow-copy\"><strong>{label}</strong><small>{description}</small><small className=\"agent-tool-editor__workflow-cta\">{canRetry ? \"Run checks and retry activation\" : isCurrent ? \"Current stage\" : value === \"load_failed\" ? \"Set automatically by AgentHub\" : value === \"active\" ? \"Run checks to activate\" : \"Click to deactivate\"}</small></span>\n {isCurrent && <span className=\"agent-tool-editor__workflow-current\">Current</span>}\n </button>\n </React.Fragment>;\n })}\n </div>\n {record.status === \"load_failed\" && <small className=\"agent-tool-editor__workflow-hint\">Fix the source or checksum, then run configuration and initialization checks before retrying activation.</small>}\n <small className=\"agent-tool-editor__workflow-hint\">Activation checks use the saved tool configuration. Restart linked agent processes to apply status changes.</small>\n </section>}\n </fieldset> },\n { value: \"tool\", label: \"Tool\", content: <div className=\"agent-tool-editor__tool\">\n <section className=\"agent-tool-editor__panel\">\n <header><h2>Tool source code <b>*</b></h2><p>Write the tool's Python code here.</p></header>\n <SolidCodeEditor value={sourceCode} onChange={(value) => { setSourceCode(value ?? \"\"); setFieldErrors((current) => ({ ...current, sourceCode: \"\" })); }} language=\"python\" wordWrap=\"on\" readOnly={isReadOnly} fontSize={11} height=\"max(32rem, calc(100dvh - 18rem))\" className={`agent-tool-editor__code${fieldErrors.sourceCode ? \" agent-tool-editor__code--invalid\" : \"\"}`} />\n {fieldErrors.sourceCode && <small className=\"agent-tool-editor__field-error agent-tool-editor__code-error\">{fieldErrors.sourceCode}</small>}\n </section>\n </div> },\n { value: \"agents\", label: \"Agents\", content: <section className=\"agent-tool-editor__agents\"><div><h2>Associated agents</h2><p>Agents linked to this tool. Associations are read-only here.</p></div>\n {isLoading ? <p>Loading associated agents…</p> : agents.length ? <div className=\"agent-tool-editor__agent-grid\">{agents.map((agent, index) => <div className=\"agent-tool-editor__agent-card\" key={String(agent.id ?? agent.name ?? index)}><SharedAgentRegistryCard rowData={agent} /></div>)}</div> : <div className=\"agent-tool-editor__empty\">No agents are currently associated with this tool.</div>}\n </section> },\n ...(isAdmin ? [{ value: \"sessions\", label: \"Sessions\", content: <AgentToolSessionsPanel agents={sessionAgents} /> }] : []),\n ];\n const visibleActiveTab = !isAdmin && activeTab === \"sessions\" ? \"general\" : activeTab;\n\n return <main className=\"agent-tool-editor\">\n <header className=\"agent-tool-editor__header\"><div><div className=\"agent-tool-editor__heading-with-refresh\"><h1>{record ? \"Edit Tool\" : \"Create Tool\"}</h1>{record?.id && <button type=\"button\" className={`agent-tool-editor__refresh${isFetching ? \" is-loading\" : \"\"}`} aria-label=\"Refresh tool\" title=\"Refresh tool\" disabled={isFetching || isSaving} onClick={requestRefresh}><RefreshCw size={14} /></button>}</div></div><div className=\"agent-tool-editor__actions\">\n <SolidButton variant=\"secondary\" leftIcon={<ArrowLeft size={16} />} onClick={() => navigate(-1)}>Back</SolidButton>\n {!isReadOnly && <SolidButton disabled={activationOpen || creatingTag} loading={isCreating || isSaving} onClick={() => void save()}>Save Tool</SolidButton>}\n </div></header>\n <SolidDialog open={confirmRefresh} onOpenChange={setConfirmRefresh} header=\"Discard unsaved changes?\" style={{ width: \"min(28rem, 94vw)\" }}\n footer={<><SolidButton type=\"button\" variant=\"secondary\" onClick={() => setConfirmRefresh(false)}>Cancel</SolidButton><SolidButton type=\"button\" disabled={isFetching} onClick={() => { setConfirmRefresh(false); void refetch(); }}>Refresh and discard</SolidButton></>}>\n <SolidDialogBody><p>You have unsaved changes. Refreshing will discard them and load the latest tool content.</p></SolidDialogBody>\n </SolidDialog>\n {activationOpen && activationTool && <AgentToolActivationDialog open={activationOpen} onOpenChange={setActivationOpen}\n toolId={activationTool.id} checksum={activationTool.checksum} toolName={activationTool.name}\n onActivated={async () => {\n await solidPatch(`/agent-tool-registry/${activationTool.id}`, { status: \"active\", checksum: activationTool.checksum });\n setAuditRefreshVersion((version) => version + 1);\n void refetch();\n dispatch(showToast({ severity: \"success\", summary: \"Tool activated\", detail: \"Configuration and initialization checks passed.\" }));\n }} />}\n {isLoading ? <div className=\"agent-tool-editor__loading\">Loading tool…</div> : record?.id ? (\n <AgentRegistryAuditPanel modelSingularName=\"agentToolRegistry\" recordId={record.id} refreshVersion={auditRefreshVersion} modelUserKey={record.name}>\n <SolidTabGroup tabs={tabs} value={visibleActiveTab} onValueChange={setActiveTab} className=\"agent-tool-editor__tabs\" listClassName=\"agent-tool-editor__tab-list\" panelClassName=\"agent-tool-editor__tab-panel\" />\n </AgentRegistryAuditPanel>\n ) : <SolidTabGroup tabs={tabs} value={visibleActiveTab} onValueChange={setActiveTab} className=\"agent-tool-editor__tabs\" listClassName=\"agent-tool-editor__tab-list\" panelClassName=\"agent-tool-editor__tab-panel\" />}\n </main>;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ArrowLeft, RefreshCw } from "lucide-react";
|
|
3
3
|
import { useDispatch } from "react-redux";
|
|
4
|
-
import { useNavigate, useParams } from "react-router-dom";
|
|
4
|
+
import { useNavigate, useParams, useSearchParams } from "react-router-dom";
|
|
5
5
|
import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
|
|
6
6
|
import { hasAnyRole } from "../../../../helpers/rolesHelper";
|
|
7
7
|
import { useSession } from "../../../../hooks/useSession";
|
|
@@ -78,6 +78,8 @@ function getSaveErrorMessage(error: unknown): string {
|
|
|
78
78
|
|
|
79
79
|
export function AgentToolRegistryEditorPage() {
|
|
80
80
|
const { id = "" } = useParams<{ id: string }>();
|
|
81
|
+
const [searchParams] = useSearchParams();
|
|
82
|
+
const initialName = id === "new" ? searchParams.get("name") ?? "" : "";
|
|
81
83
|
const { data: session } = useSession();
|
|
82
84
|
const isAdmin = hasAnyRole(session?.user?.roles, ["Admin"]);
|
|
83
85
|
const navigate = useNavigate();
|
|
@@ -113,7 +115,7 @@ export function AgentToolRegistryEditorPage() {
|
|
|
113
115
|
React.useEffect(() => {
|
|
114
116
|
const nextTags = agentHubTagsFrom(record?.tags);
|
|
115
117
|
const nextModule = agentHubModuleFrom(record?.module);
|
|
116
|
-
setName(record?.name ??
|
|
118
|
+
setName(record?.name ?? initialName);
|
|
117
119
|
setIconName(record?.iconName ?? "");
|
|
118
120
|
setDescription(record?.description ?? "");
|
|
119
121
|
setType(record?.type ?? "custom");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type RouteObject } from "react-router-dom";
|
|
3
|
+
export declare function AdminEmbedPage({ routes, authGuard }: {
|
|
4
|
+
routes: RouteObject[];
|
|
5
|
+
authGuard?: ReactNode;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=AdminEmbedPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminEmbedPage.d.ts","sourceRoot":"","sources":["../../../../src/routes/pages/embed/AdminEmbedPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAEgE,KAAK,WAAW,EACtF,MAAM,kBAAkB,CAAC;AAyB1B,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;IAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,2CAkGrG"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { HashRouter, matchRoutes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_RouteContext, useLocation, useRoutes, } from "react-router-dom";
|
|
4
|
+
import { registerAdminEmbedSession } from "../../../adapters/auth/adminEmbedSession";
|
|
5
|
+
import { isAdminEmbedDocument } from "../../../adapters/auth/storage";
|
|
6
|
+
import SolidPopupContainer from "../../../components/common/SolidPopupContainer";
|
|
7
|
+
import { SolidToastProvider } from "../../../components/common/SolidToastProvider";
|
|
8
|
+
import { SolidLoadingState } from "../../../components/common/SolidLoadingState";
|
|
9
|
+
import { SolidRouteMetadataBoundary } from "../../SolidRouteMetadataBoundary";
|
|
10
|
+
import styles from "./AdminEmbedPage.module.css";
|
|
11
|
+
var channel = "solidx-admin-embed";
|
|
12
|
+
var emptyRouteContext = { outlet: null, matches: [], isDataRoute: false };
|
|
13
|
+
function EmbedRoutes(_a) {
|
|
14
|
+
var routes = _a.routes, authGuard = _a.authGuard;
|
|
15
|
+
return useRoutes([
|
|
16
|
+
{
|
|
17
|
+
element: authGuard,
|
|
18
|
+
children: [{
|
|
19
|
+
element: _jsx(SolidRouteMetadataBoundary, { routes: routes }),
|
|
20
|
+
children: routes,
|
|
21
|
+
}],
|
|
22
|
+
},
|
|
23
|
+
{ path: "*", element: _jsx("p", { role: "alert", children: "This SolidX admin screen could not be found." }) },
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
export function AdminEmbedPage(_a) {
|
|
27
|
+
var routes = _a.routes, authGuard = _a.authGuard;
|
|
28
|
+
var search = useLocation().search;
|
|
29
|
+
var _b = useState(false), ready = _b[0], setReady = _b[1];
|
|
30
|
+
var _c = useState(""), error = _c[0], setError = _c[1];
|
|
31
|
+
var initialRoutes = useRef(routes);
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
var params = new URLSearchParams(search);
|
|
35
|
+
var parentOrigin = (_a = params.get("parentOrigin")) !== null && _a !== void 0 ? _a : "";
|
|
36
|
+
var instanceId = (_b = params.get("instanceId")) !== null && _b !== void 0 ? _b : "";
|
|
37
|
+
var parent = URL.canParse(parentOrigin) ? new URL(parentOrigin) : null;
|
|
38
|
+
if (!isAdminEmbedDocument || window.parent === window || !instanceId || !parent
|
|
39
|
+
|| parent.origin !== parentOrigin || parentOrigin === window.location.origin
|
|
40
|
+
|| !["https:", "http:"].includes(parent.protocol)) {
|
|
41
|
+
setError("Open this screen using the SolidX admin embed SDK.");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
var target = window.location.hash.slice(1);
|
|
45
|
+
if (!/^\/admin(?:[/?#]|$)/.test(target) || !matchRoutes(initialRoutes.current, target)) {
|
|
46
|
+
setError("This SolidX admin screen could not be found.");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var pending;
|
|
50
|
+
function requestToken() {
|
|
51
|
+
return new Promise(function (resolve, reject) {
|
|
52
|
+
var requestId = crypto.randomUUID();
|
|
53
|
+
var timer = setTimeout(function () {
|
|
54
|
+
pending = undefined;
|
|
55
|
+
reject(new Error("The host application did not respond to the SolidX session request."));
|
|
56
|
+
}, 30000);
|
|
57
|
+
pending = { requestId: requestId, timer: timer, resolve: resolve, reject: reject };
|
|
58
|
+
window.parent.postMessage({ channel: channel, instanceId: instanceId, type: "token_request", requestId: requestId }, parentOrigin);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
var receive = function (event) {
|
|
62
|
+
var message = event.data;
|
|
63
|
+
if (event.source !== window.parent || event.origin !== parentOrigin
|
|
64
|
+
|| (message === null || message === void 0 ? void 0 : message.channel) !== channel || message.instanceId !== instanceId
|
|
65
|
+
|| !pending || message.requestId !== pending.requestId
|
|
66
|
+
|| !["token", "token_error"].includes(message.type))
|
|
67
|
+
return;
|
|
68
|
+
var request = pending;
|
|
69
|
+
pending = undefined;
|
|
70
|
+
clearTimeout(request.timer);
|
|
71
|
+
if (message.type === "token")
|
|
72
|
+
request.resolve(message.session);
|
|
73
|
+
else
|
|
74
|
+
request.reject(new Error("The host application could not authorize this SolidX screen."));
|
|
75
|
+
};
|
|
76
|
+
var auth = registerAdminEmbedSession(requestToken, function (failure) {
|
|
77
|
+
setReady(false);
|
|
78
|
+
setError(failure instanceof Error ? failure.message : "Unable to start a SolidX session.");
|
|
79
|
+
});
|
|
80
|
+
window.addEventListener("message", receive);
|
|
81
|
+
void auth.refresh().then(function (session) {
|
|
82
|
+
if (session)
|
|
83
|
+
setReady(true);
|
|
84
|
+
});
|
|
85
|
+
return function () {
|
|
86
|
+
auth.dispose();
|
|
87
|
+
window.removeEventListener("message", receive);
|
|
88
|
+
if (pending) {
|
|
89
|
+
clearTimeout(pending.timer);
|
|
90
|
+
pending.reject(new Error("Embedded screen closed."));
|
|
91
|
+
pending = undefined;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}, [search]);
|
|
95
|
+
if (error) {
|
|
96
|
+
return _jsxs("main", { className: styles.message, role: "alert", children: [_jsx("p", { children: error }), _jsx("button", { type: "button", onClick: function () { return window.location.reload(); }, children: "Reload screen" })] });
|
|
97
|
+
}
|
|
98
|
+
if (!ready)
|
|
99
|
+
return _jsx(SolidLoadingState, { title: "Opening SolidX", description: "Connecting to the host application." });
|
|
100
|
+
// Isolate the screen's route context while keeping the host UI's Redux and theme providers.
|
|
101
|
+
// The real document stays at /embed/admin, including on reload.
|
|
102
|
+
return _jsx(UNSAFE_LocationContext.Provider, { value: null, children: _jsx(UNSAFE_RouteContext.Provider, { value: emptyRouteContext, children: _jsx(UNSAFE_DataRouterContext.Provider, { value: null, children: _jsx(UNSAFE_DataRouterStateContext.Provider, { value: null, children: _jsx(HashRouter, { children: _jsxs("div", { className: "solidx-admin-embed", children: [_jsx(SolidPopupContainer, {}), _jsx(SolidToastProvider, {}), _jsx(EmbedRoutes, { routes: routes, authGuard: authGuard })] }) }) }) }) }) });
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=AdminEmbedPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminEmbedPage.js","sourceRoot":"","sources":["../../../../src/routes/pages/embed/AdminEmbedPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EACL,UAAU,EAAE,WAAW,EAAE,wBAAwB,EAAE,6BAA6B,EAChF,sBAAsB,EAAE,mBAAmB,EAAE,WAAW,EAAE,SAAS,GACpE,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAsB,MAAM,0CAA0C,CAAC;AACzG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,mBAAmB,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,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P,GACP,GACC,CAAC;AACrC,CAAC","sourcesContent":["import { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport {\n HashRouter, matchRoutes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext,\n UNSAFE_LocationContext, UNSAFE_RouteContext, useLocation, useRoutes, type RouteObject,\n} from \"react-router-dom\";\nimport { registerAdminEmbedSession, type PortalSession } from \"../../../adapters/auth/adminEmbedSession\";\nimport { isAdminEmbedDocument } from \"../../../adapters/auth/storage\";\nimport SolidPopupContainer from \"../../../components/common/SolidPopupContainer\";\nimport { SolidToastProvider } from \"../../../components/common/SolidToastProvider\";\nimport { SolidLoadingState } from \"../../../components/common/SolidLoadingState\";\nimport { SolidRouteMetadataBoundary } from \"../../SolidRouteMetadataBoundary\";\nimport styles from \"./AdminEmbedPage.module.css\";\n\nconst channel = \"solidx-admin-embed\";\nconst emptyRouteContext = { outlet: null, matches: [], isDataRoute: false };\n\nfunction EmbedRoutes({ routes, authGuard }: { routes: RouteObject[]; authGuard?: ReactNode }) {\n return useRoutes([\n {\n element: authGuard,\n children: [{\n element: <SolidRouteMetadataBoundary routes={routes} />,\n children: routes,\n }],\n },\n { path: \"*\", element: <p role=\"alert\">This SolidX admin screen could not be found.</p> },\n ]);\n}\n\nexport function AdminEmbedPage({ routes, authGuard }: { routes: RouteObject[]; authGuard?: ReactNode }) {\n const { search } = useLocation();\n const [ready, setReady] = useState(false);\n const [error, setError] = useState(\"\");\n const initialRoutes = useRef(routes);\n\n useEffect(() => {\n const params = new URLSearchParams(search);\n const parentOrigin = params.get(\"parentOrigin\") ?? \"\";\n const instanceId = params.get(\"instanceId\") ?? \"\";\n const parent = URL.canParse(parentOrigin) ? new URL(parentOrigin) : null;\n if (!isAdminEmbedDocument || window.parent === window || !instanceId || !parent\n || parent.origin !== parentOrigin || parentOrigin === window.location.origin\n || ![\"https:\", \"http:\"].includes(parent.protocol)) {\n setError(\"Open this screen using the SolidX admin embed SDK.\");\n return;\n }\n\n const target = window.location.hash.slice(1);\n if (!/^\\/admin(?:[/?#]|$)/.test(target) || !matchRoutes(initialRoutes.current, target)) {\n setError(\"This SolidX admin screen could not be found.\");\n return;\n }\n\n let pending: {\n requestId: string;\n timer: ReturnType<typeof setTimeout>;\n resolve: (token: PortalSession) => void;\n reject: (error: Error) => void;\n } | undefined;\n function requestToken(): Promise<PortalSession> {\n return new Promise((resolve, reject) => {\n const requestId = crypto.randomUUID();\n const timer = setTimeout(() => {\n pending = undefined;\n reject(new Error(\"The host application did not respond to the SolidX session request.\"));\n }, 30_000);\n pending = { requestId, timer, resolve, reject };\n window.parent.postMessage({ channel, instanceId, type: \"token_request\", requestId }, parentOrigin);\n });\n }\n const receive = (event: MessageEvent) => {\n const message = event.data;\n if (event.source !== window.parent || event.origin !== parentOrigin\n || message?.channel !== channel || message.instanceId !== instanceId\n || !pending || message.requestId !== pending.requestId\n || ![\"token\", \"token_error\"].includes(message.type)) return;\n const request = pending;\n pending = undefined;\n clearTimeout(request.timer);\n if (message.type === \"token\") request.resolve(message.session);\n else request.reject(new Error(\"The host application could not authorize this SolidX screen.\"));\n };\n const auth = registerAdminEmbedSession(requestToken, (failure) => {\n setReady(false);\n setError(failure instanceof Error ? failure.message : \"Unable to start a SolidX session.\");\n });\n window.addEventListener(\"message\", receive);\n void auth.refresh().then((session) => {\n if (session) setReady(true);\n });\n\n return () => {\n auth.dispose();\n window.removeEventListener(\"message\", receive);\n if (pending) {\n clearTimeout(pending.timer);\n pending.reject(new Error(\"Embedded screen closed.\"));\n pending = undefined;\n }\n };\n }, [search]);\n\n if (error) {\n return <main className={styles.message} role=\"alert\">\n <p>{error}</p>\n <button type=\"button\" onClick={() => window.location.reload()}>Reload screen</button>\n </main>;\n }\n if (!ready) return <SolidLoadingState title=\"Opening SolidX\" description=\"Connecting to the host application.\" />;\n\n // Isolate the screen's route context while keeping the host UI's Redux and theme providers.\n // The real document stays at /embed/admin, including on reload.\n return <UNSAFE_LocationContext.Provider value={null!}>\n <UNSAFE_RouteContext.Provider value={emptyRouteContext}>\n <UNSAFE_DataRouterContext.Provider value={null}>\n <UNSAFE_DataRouterStateContext.Provider value={null}>\n <HashRouter>\n <div className=\"solidx-admin-embed\">\n <SolidPopupContainer />\n <SolidToastProvider />\n <EmbedRoutes routes={routes} authGuard={authGuard} />\n </div>\n </HashRouter>\n </UNSAFE_DataRouterStateContext.Provider>\n </UNSAFE_DataRouterContext.Provider>\n </UNSAFE_RouteContext.Provider>\n </UNSAFE_LocationContext.Provider>;\n}\n"]}
|