@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
|
@@ -0,0 +1,634 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Filter, Inbox as InboxIcon, List, RefreshCw } from "lucide-react";
|
|
3
|
+
import { useSearchParams } from "react-router-dom";
|
|
4
|
+
import { SolidButton, SolidDialog, SolidDialogBody, SolidSelect } from "../../../../components/shad-cn-ui";
|
|
5
|
+
import { Column, SolidDataTable } from "../../../../components/core/list/SolidDataTable";
|
|
6
|
+
import { historyToItems, isSameAssistantContent } from "../../../../components/core/solid-agent/agentEvents";
|
|
7
|
+
import { resolveAttachmentMedia } from "../../../../components/core/solid-agent/client/agentAttachmentMedia";
|
|
8
|
+
import { AgentComposer } from "../../../../components/core/solid-agent/composer/AgentComposer";
|
|
9
|
+
import { humanReviewAllowsChoice, humanReviewAnswerItem, humanReviewId, humanReviewItem, humanReviewText,
|
|
10
|
+
type HumanReview } from "../../../../components/core/solid-agent/humanReview";
|
|
11
|
+
import { AgentThread } from "../../../../components/core/solid-agent/thread/AgentThread";
|
|
12
|
+
import { AgentEventTypes, type AgentChatItem, type AgentWireFrame } from "../../../../components/core/solid-agent/types";
|
|
13
|
+
import chatStyles from "../../../../components/core/solid-agent/SolidAgent.module.css";
|
|
14
|
+
import { solidAxios } from "../../../../http/solidHttp";
|
|
15
|
+
import styles from "./AgentJobsInboxPage.module.css";
|
|
16
|
+
|
|
17
|
+
type Run = {
|
|
18
|
+
id: number;
|
|
19
|
+
sessionId: string;
|
|
20
|
+
agentId?: number | null;
|
|
21
|
+
agentTitle: string | null;
|
|
22
|
+
status: string;
|
|
23
|
+
trigger?: string;
|
|
24
|
+
runtime?: string | null;
|
|
25
|
+
configVersion?: number;
|
|
26
|
+
startedAt?: string;
|
|
27
|
+
hasJob?: boolean;
|
|
28
|
+
lastActiveAt: string;
|
|
29
|
+
turnCount?: number;
|
|
30
|
+
totalCost?: number;
|
|
31
|
+
endedAt?: string | null;
|
|
32
|
+
};
|
|
33
|
+
type RequestHistory = HumanReview & {
|
|
34
|
+
status: string;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
answeredAt: string | null;
|
|
37
|
+
answer: { choice?: string | null; text?: string | null } | null;
|
|
38
|
+
};
|
|
39
|
+
type RunDetail = {
|
|
40
|
+
status: string;
|
|
41
|
+
jobId: number | null;
|
|
42
|
+
jobStatus: string | null;
|
|
43
|
+
hasJob?: boolean;
|
|
44
|
+
agentName?: string | null;
|
|
45
|
+
result: string | null;
|
|
46
|
+
requests?: RequestHistory[];
|
|
47
|
+
error?: { code?: string; message?: string } | null;
|
|
48
|
+
pendingRequest: HumanReview | null;
|
|
49
|
+
};
|
|
50
|
+
type Inbox = { runs: Run[]; hasMore: boolean; total: number };
|
|
51
|
+
type InboxFilters = { review: boolean; agent: string; status: string; trigger: string; runtime: string; startedFrom: string; startedTo: string };
|
|
52
|
+
type Message = AgentWireFrame & { id: string; timestamp: string };
|
|
53
|
+
type HistoryPage = { messages: Message[]; has_more: boolean };
|
|
54
|
+
|
|
55
|
+
const historyPageSize = 100;
|
|
56
|
+
const ignoreAction = () => undefined;
|
|
57
|
+
|
|
58
|
+
function requestItems(requests: RequestHistory[], pendingId: number | undefined, submitting: boolean): AgentChatItem[] {
|
|
59
|
+
return requests.flatMap((request) => {
|
|
60
|
+
const active = request.requestId === pendingId;
|
|
61
|
+
const items = [humanReviewItem(request, Date.parse(request.createdAt), !active, active && submitting)];
|
|
62
|
+
if (request.answeredAt && request.answer) {
|
|
63
|
+
items.push(humanReviewAnswerItem(request.requestId, request.kind, request.answer.choice, request.answer.text,
|
|
64
|
+
Date.parse(request.answeredAt)));
|
|
65
|
+
}
|
|
66
|
+
return items;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const inboxPath = "/agent-session/inbox";
|
|
71
|
+
const initialPageSize = 25;
|
|
72
|
+
const pageSizeOptions = [10, 25, 50, 100];
|
|
73
|
+
const emptyFilters: InboxFilters = { review: false, agent: "", status: "", trigger: "", runtime: "", startedFrom: "", startedTo: "" };
|
|
74
|
+
const statuses = ["queued", "running", "active", "awaiting_input", "awaiting_approval", "completed", "failed", "cancelled", "expired"];
|
|
75
|
+
const triggers = ["api", "webhook"];
|
|
76
|
+
const runtimes = ["solidx", "agentHub"];
|
|
77
|
+
const inboxFilterKeys = ["review", "agent", "status", "trigger", "runtime", "startedFrom", "startedTo"] as const;
|
|
78
|
+
const sortOptions = [
|
|
79
|
+
{ label: "Recent activity", value: "last_active_desc" },
|
|
80
|
+
{ label: "Old activity", value: "last_active_asc" },
|
|
81
|
+
{ label: "Newly started", value: "started_desc" },
|
|
82
|
+
{ label: "Oldest started", value: "started_asc" },
|
|
83
|
+
{ label: "Agent A–Z", value: "agent_asc" },
|
|
84
|
+
];
|
|
85
|
+
type InboxSort = (typeof sortOptions)[number]["value"];
|
|
86
|
+
const defaultSort: InboxSort = "last_active_desc";
|
|
87
|
+
|
|
88
|
+
function readInboxFilters(search: string): InboxFilters {
|
|
89
|
+
const params = new URLSearchParams(search);
|
|
90
|
+
const readOption = (key: string, options: string[]) => {
|
|
91
|
+
const value = params.get(key) ?? "";
|
|
92
|
+
return options.includes(value) ? value : "";
|
|
93
|
+
};
|
|
94
|
+
const readDate = (key: string) => {
|
|
95
|
+
const value = params.get(key) ?? "";
|
|
96
|
+
const timestamp = Date.parse(value);
|
|
97
|
+
return /^\d{4}-\d{2}-\d{2}$/.test(value) && Number.isFinite(timestamp)
|
|
98
|
+
&& new Date(timestamp).toISOString().slice(0, 10) === value ? value : "";
|
|
99
|
+
};
|
|
100
|
+
const startedFrom = readDate("startedFrom");
|
|
101
|
+
const startedTo = readDate("startedTo");
|
|
102
|
+
return {
|
|
103
|
+
review: params.get("review") === "true",
|
|
104
|
+
agent: params.get("agent")?.trim() ?? "",
|
|
105
|
+
status: readOption("status", statuses),
|
|
106
|
+
trigger: readOption("trigger", triggers),
|
|
107
|
+
runtime: readOption("runtime", runtimes),
|
|
108
|
+
startedFrom,
|
|
109
|
+
startedTo: startedFrom && startedTo && startedTo < startedFrom ? "" : startedTo,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const statusLabel = (status: string) => ({
|
|
113
|
+
queued: "Queued",
|
|
114
|
+
running: "Running",
|
|
115
|
+
completed: "Completed",
|
|
116
|
+
failed: "Failed",
|
|
117
|
+
cancelled: "Cancelled",
|
|
118
|
+
expired: "Expired",
|
|
119
|
+
awaiting_input: "Needs an answer",
|
|
120
|
+
awaiting_approval: "Needs approval",
|
|
121
|
+
}[status] ?? status.replaceAll("_", " "));
|
|
122
|
+
|
|
123
|
+
function RunStatus({ status, hasJob }: { status: string; hasJob?: boolean }) {
|
|
124
|
+
const tone = hasJob === false || status === "failed" ? "error"
|
|
125
|
+
: ["awaiting_input", "awaiting_approval"].includes(status) ? "warning"
|
|
126
|
+
: status === "running" ? "active"
|
|
127
|
+
: status === "completed" ? "success" : "neutral";
|
|
128
|
+
return <span className={styles.status} data-tone={tone}>{hasJob === false ? "No linked job" : statusLabel(status)}</span>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function errorMessage(error: unknown, fallback: string) {
|
|
132
|
+
if (error && typeof error === "object" && "response" in error) {
|
|
133
|
+
const response = error.response as { data?: { message?: unknown } } | undefined;
|
|
134
|
+
if (typeof response?.data?.message === "string") return response.data.message;
|
|
135
|
+
}
|
|
136
|
+
return fallback;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function runFailureMessage(error: RunDetail["error"]): string | null {
|
|
140
|
+
if (!error) return null;
|
|
141
|
+
if (error.message) return error.message;
|
|
142
|
+
switch (error.code) {
|
|
143
|
+
case "model_unavailable":
|
|
144
|
+
return "The agent’s reasoning model is unavailable. Check its model selection and the provider credentials in AI Settings.";
|
|
145
|
+
case "timeout":
|
|
146
|
+
return "The agent run timed out before it could finish. Review the run and start a new job if needed.";
|
|
147
|
+
case "agent_error":
|
|
148
|
+
return "The agent run failed while continuing after a response. Check the AgentHub worker logs for the underlying error.";
|
|
149
|
+
default:
|
|
150
|
+
return "The agent run failed before it could complete. Check the AgentHub worker logs for details.";
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function OpenRun({ run, revision, onChange, hideHeader = false }: { run: Run; revision: number; onChange: () => void; hideHeader?: boolean }) {
|
|
155
|
+
const path = `${inboxPath}/${encodeURIComponent(run.sessionId)}`;
|
|
156
|
+
const [detail, setDetail] = React.useState<RunDetail | null>(null);
|
|
157
|
+
const [messages, setMessages] = React.useState<Message[]>([]);
|
|
158
|
+
const [transcript, setTranscript] = React.useState<AgentChatItem[]>([]);
|
|
159
|
+
const [hasOlder, setHasOlder] = React.useState(false);
|
|
160
|
+
const [loadingOlder, setLoadingOlder] = React.useState(false);
|
|
161
|
+
const [answerError, setAnswerError] = React.useState("");
|
|
162
|
+
const [submitting, setSubmitting] = React.useState(false);
|
|
163
|
+
const [resuming, setResuming] = React.useState(false);
|
|
164
|
+
const [accepted, setAccepted] = React.useState<RequestHistory | null>(null);
|
|
165
|
+
const submitLock = React.useRef(false);
|
|
166
|
+
const acceptedId = React.useRef<number | undefined>(undefined);
|
|
167
|
+
const historyPages = React.useRef(1);
|
|
168
|
+
const [error, setError] = React.useState("");
|
|
169
|
+
const [connection, setConnection] = React.useState("Connecting");
|
|
170
|
+
const read = React.useRef<() => Promise<void>>(async () => {});
|
|
171
|
+
const status = accepted && detail?.pendingRequest?.requestId === accepted.requestId
|
|
172
|
+
? "queued" : detail?.status ?? run.status;
|
|
173
|
+
const hasJob = detail?.hasJob ?? (detail ? detail.jobId !== null : run.hasJob);
|
|
174
|
+
const canConnect = hasJob === true && !["completed", "failed", "cancelled", "expired"].includes(status);
|
|
175
|
+
const runFailure = runFailureMessage(detail?.error);
|
|
176
|
+
|
|
177
|
+
React.useEffect(() => {
|
|
178
|
+
const abort = new AbortController();
|
|
179
|
+
let reading: Promise<void> | undefined;
|
|
180
|
+
let refreshAgain = false;
|
|
181
|
+
const loadPage = async (page: number) => {
|
|
182
|
+
const response = await solidAxios.get<{ data: HistoryPage }>(`/agent-session/${run.id}/messages`, {
|
|
183
|
+
params: { page, page_size: historyPageSize }, signal: abort.signal,
|
|
184
|
+
});
|
|
185
|
+
return response.data.data;
|
|
186
|
+
};
|
|
187
|
+
const loadHistory = async () => {
|
|
188
|
+
const first = await loadPage(1);
|
|
189
|
+
const pages = [first];
|
|
190
|
+
const count = historyPages.current;
|
|
191
|
+
for (let page = 2; page <= count && pages[pages.length - 1].has_more; page++) {
|
|
192
|
+
pages.push(await loadPage(page));
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
messages: Array.from(new Map(pages.reverse().flatMap((page) => page.messages).map((row) => [row.id, row])).values()),
|
|
196
|
+
hasMore: pages[0].has_more,
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
const refresh = async () => {
|
|
200
|
+
const [record, history] = await Promise.allSettled([
|
|
201
|
+
solidAxios.get<{ data: RunDetail }>(path, { signal: abort.signal }),
|
|
202
|
+
loadHistory(),
|
|
203
|
+
]);
|
|
204
|
+
if (abort.signal.aborted) return;
|
|
205
|
+
if (record.status === "fulfilled") setDetail(record.value.data.data);
|
|
206
|
+
if (history.status === "fulfilled") {
|
|
207
|
+
const next = history.value.messages;
|
|
208
|
+
setMessages((current) => current.length === next.length && current.every((row, index) => row.id === next[index].id)
|
|
209
|
+
? current : next);
|
|
210
|
+
setHasOlder(history.value.hasMore);
|
|
211
|
+
}
|
|
212
|
+
setError(record.status === "rejected" ? errorMessage(record.reason, "Could not load the run.")
|
|
213
|
+
: history.status === "rejected" ? "Could not load the conversation." : "");
|
|
214
|
+
};
|
|
215
|
+
read.current = () => {
|
|
216
|
+
if (abort.signal.aborted) return Promise.resolve();
|
|
217
|
+
if (reading) {
|
|
218
|
+
refreshAgain = true;
|
|
219
|
+
return reading;
|
|
220
|
+
}
|
|
221
|
+
reading = (async () => {
|
|
222
|
+
do {
|
|
223
|
+
refreshAgain = false;
|
|
224
|
+
await refresh();
|
|
225
|
+
} while (refreshAgain && !abort.signal.aborted);
|
|
226
|
+
})().finally(() => { reading = undefined; });
|
|
227
|
+
return reading;
|
|
228
|
+
};
|
|
229
|
+
const poll = window.setInterval(() => void read.current(), 8000);
|
|
230
|
+
return () => { abort.abort(); window.clearInterval(poll); };
|
|
231
|
+
}, [path, run.id]);
|
|
232
|
+
React.useEffect(() => { void read.current(); }, [path, run.id, revision]);
|
|
233
|
+
|
|
234
|
+
React.useEffect(() => {
|
|
235
|
+
let active = true;
|
|
236
|
+
const items = historyToItems(messages).map((item) => ({ ...item, final: true }));
|
|
237
|
+
setTranscript(items);
|
|
238
|
+
void resolveAttachmentMedia(items).then((resolved) => {
|
|
239
|
+
if (active) setTranscript(resolved);
|
|
240
|
+
}).catch(ignoreAction);
|
|
241
|
+
return () => { active = false; };
|
|
242
|
+
}, [messages]);
|
|
243
|
+
|
|
244
|
+
React.useEffect(() => {
|
|
245
|
+
if (!canConnect) return;
|
|
246
|
+
const abort = new AbortController();
|
|
247
|
+
let socket: WebSocket | undefined;
|
|
248
|
+
let retry: number | undefined;
|
|
249
|
+
let refresh: number | undefined;
|
|
250
|
+
let delay = 1000;
|
|
251
|
+
function reconnect() {
|
|
252
|
+
if (abort.signal.aborted || retry !== undefined) return;
|
|
253
|
+
setConnection("Reconnecting");
|
|
254
|
+
void read.current();
|
|
255
|
+
retry = window.setTimeout(() => { retry = undefined; void connect(); }, delay);
|
|
256
|
+
delay = Math.min(delay * 2, 15000);
|
|
257
|
+
}
|
|
258
|
+
async function connect() {
|
|
259
|
+
try {
|
|
260
|
+
const { data: { data: login } } = await solidAxios.post<{ data: { wsUrl: string; agentToken: string } }>(
|
|
261
|
+
`${path}/connect`, undefined, { signal: abort.signal });
|
|
262
|
+
if (abort.signal.aborted) return;
|
|
263
|
+
const ws = new WebSocket(login.wsUrl);
|
|
264
|
+
socket = ws;
|
|
265
|
+
ws.onopen = () => ws.send(JSON.stringify({
|
|
266
|
+
action: "resume_session", session_id: run.sessionId, agentToken: login.agentToken, runtime: "agentHub",
|
|
267
|
+
}));
|
|
268
|
+
ws.onmessage = ({ data }) => {
|
|
269
|
+
let frame: { type?: string; event_type?: string };
|
|
270
|
+
try { frame = JSON.parse(data); } catch { return; }
|
|
271
|
+
const type = frame.type ?? frame.event_type;
|
|
272
|
+
if (type === "session_started") { delay = 1000; setConnection("Live"); }
|
|
273
|
+
if (type === "human_request" || type === "turn_complete" || type === "error") setResuming(false);
|
|
274
|
+
if (type === "error" || type === "session_moved") { ws.close(); return; }
|
|
275
|
+
if (["session_started", "job_status", "human_request", "turn_complete"].includes(type ?? "")) {
|
|
276
|
+
if (refresh === undefined) refresh = window.setTimeout(() => {
|
|
277
|
+
refresh = undefined;
|
|
278
|
+
void read.current();
|
|
279
|
+
onChange();
|
|
280
|
+
}, 350);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
ws.onclose = reconnect;
|
|
284
|
+
} catch (error) {
|
|
285
|
+
if (abort.signal.aborted) return;
|
|
286
|
+
const status = (error as { response?: { status?: number } })?.response?.status;
|
|
287
|
+
if (status === 401 || status === 403 || status === 404) setConnection("Live updates unavailable");
|
|
288
|
+
else reconnect();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
void connect();
|
|
292
|
+
return () => { abort.abort(); socket?.close(); window.clearTimeout(retry); window.clearTimeout(refresh); };
|
|
293
|
+
}, [path, run.sessionId, canConnect, onChange]);
|
|
294
|
+
|
|
295
|
+
const awaitingResponse = status === "awaiting_input" || status === "awaiting_approval";
|
|
296
|
+
const request = hasJob && awaitingResponse && detail?.jobStatus === "awaiting_input"
|
|
297
|
+
&& detail.pendingRequest?.requestId !== accepted?.requestId ? detail.pendingRequest : null;
|
|
298
|
+
const requestId = request?.requestId;
|
|
299
|
+
React.useEffect(() => { setAnswerError(""); }, [requestId]);
|
|
300
|
+
React.useEffect(() => {
|
|
301
|
+
const waitingAgain = ["awaiting_input", "awaiting_approval"].includes(status)
|
|
302
|
+
&& detail?.pendingRequest?.requestId !== accepted?.requestId;
|
|
303
|
+
const terminal = ["completed", "failed", "cancelled", "expired"].includes(status);
|
|
304
|
+
if (waitingAgain || terminal) setResuming(false);
|
|
305
|
+
}, [accepted?.requestId, detail?.pendingRequest?.requestId, status]);
|
|
306
|
+
|
|
307
|
+
const submit = async (choice: string, text: string) => {
|
|
308
|
+
if (!request || submitLock.current || acceptedId.current === request.requestId) return;
|
|
309
|
+
submitLock.current = true;
|
|
310
|
+
setAnswerError("");
|
|
311
|
+
setSubmitting(true);
|
|
312
|
+
try {
|
|
313
|
+
await solidAxios.post(`${path}/requests/${request.requestId}/answer`, { choice, text });
|
|
314
|
+
acceptedId.current = request.requestId;
|
|
315
|
+
setResuming(true);
|
|
316
|
+
const historical = detail?.requests?.find((row) => row.requestId === request.requestId);
|
|
317
|
+
const now = new Date().toISOString();
|
|
318
|
+
setAccepted({ ...request, status: "answered", createdAt: historical?.createdAt ?? run.lastActiveAt,
|
|
319
|
+
answeredAt: now, answer: { choice, text } });
|
|
320
|
+
} catch (error) {
|
|
321
|
+
setAnswerError(errorMessage(error, "Could not submit your response."));
|
|
322
|
+
throw error;
|
|
323
|
+
} finally {
|
|
324
|
+
setSubmitting(false);
|
|
325
|
+
submitLock.current = false;
|
|
326
|
+
void read.current();
|
|
327
|
+
onChange();
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
const sendText = (text: string) => {
|
|
331
|
+
if (!request) return;
|
|
332
|
+
const answer = humanReviewText(request, text);
|
|
333
|
+
return submit(answer.choice, answer.text);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const loadOlder = async () => {
|
|
337
|
+
if (loadingOlder || !hasOlder) return;
|
|
338
|
+
historyPages.current += 1;
|
|
339
|
+
setLoadingOlder(true);
|
|
340
|
+
try { await read.current(); }
|
|
341
|
+
finally { setLoadingOlder(false); }
|
|
342
|
+
};
|
|
343
|
+
const items = React.useMemo(() => {
|
|
344
|
+
const requests = new Map((detail?.requests ?? []).map((row) => [row.requestId, row]));
|
|
345
|
+
if (request && !requests.has(request.requestId)) {
|
|
346
|
+
requests.set(request.requestId, { ...request, status: "pending", createdAt: run.lastActiveAt, answeredAt: null, answer: null });
|
|
347
|
+
}
|
|
348
|
+
if (accepted && requests.get(accepted.requestId)?.status !== "answered") requests.set(accepted.requestId, accepted);
|
|
349
|
+
const result = [...transcript, ...requestItems(Array.from(requests.values()), requestId, submitting)]
|
|
350
|
+
.sort((left, right) => left.at - right.at);
|
|
351
|
+
const jobResult = detail?.result;
|
|
352
|
+
if (!hasOlder && jobResult && !messages.some((row) => row.event_type === AgentEventTypes.turnComplete)
|
|
353
|
+
&& !transcript.some((item) => item.eventType === AgentEventTypes.llmComplete
|
|
354
|
+
&& isSameAssistantContent(item.eventData.content, jobResult))) {
|
|
355
|
+
result.push({ id: "job-result", at: Date.parse(run.lastActiveAt), eventType: AgentEventTypes.llmComplete,
|
|
356
|
+
eventData: { content: jobResult }, final: true });
|
|
357
|
+
}
|
|
358
|
+
return result;
|
|
359
|
+
}, [accepted, detail, hasOlder, messages, request, requestId, run.lastActiveAt, submitting, transcript]);
|
|
360
|
+
return <section className={styles.panel} aria-label="Selected run">
|
|
361
|
+
{!hideHeader && <header className={styles.runHeader}>
|
|
362
|
+
<div><h2>{run.agentTitle ?? "Agent run"}</h2>
|
|
363
|
+
<div className={styles.runMeta}><RunStatus status={status} hasJob={hasJob} />
|
|
364
|
+
{canConnect && <span role="status">{connection}</span>}
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
</header>}
|
|
368
|
+
<div className={styles.runBody}>
|
|
369
|
+
{hasJob === false && <p className={styles.notice}>This session has no job for a worker to run.</p>}
|
|
370
|
+
{error && <p className={styles.notice} role="alert">{error}</p>}
|
|
371
|
+
{runFailure && <p className={styles.notice} role="alert">{runFailure}</p>}
|
|
372
|
+
{answerError && <p className={styles.notice} role="alert">{answerError}</p>}
|
|
373
|
+
<div className={`${chatStyles.root} ${styles.chat}`}>
|
|
374
|
+
<AgentThread items={items} agentName={detail?.agentName ?? undefined}
|
|
375
|
+
thinking={resuming || status === "running" || status === "active"}
|
|
376
|
+
working={resuming || status === "running" || status === "active"}
|
|
377
|
+
hasMore={hasOlder} loadingOlder={loadingOlder} onLoadOlder={() => void loadOlder()}
|
|
378
|
+
emptyState={<p className={styles.listMessage}>No messages yet.</p>}
|
|
379
|
+
onReply={(widgetId, widget, value) => {
|
|
380
|
+
if (!request || widgetId !== humanReviewId(request.requestId) || widget !== "SolidQuestionChatWidget" && widget !== "question"
|
|
381
|
+
|| typeof value !== "string") return;
|
|
382
|
+
if (humanReviewAllowsChoice(request, value)) void submit(value, request.kind === "approval" ? "" : value).catch(ignoreAction);
|
|
383
|
+
}}
|
|
384
|
+
onPrompt={ignoreAction} />
|
|
385
|
+
{request && <AgentComposer key={request.requestId}
|
|
386
|
+
working={false} disabled={submitting} canAttach={false} commands={[]}
|
|
387
|
+
placeholder={request.kind === "approval" ? "Type Approve or Reject…" : "Type your answer…"}
|
|
388
|
+
onSend={sendText} onStop={ignoreAction} />}
|
|
389
|
+
</div>
|
|
390
|
+
</div>
|
|
391
|
+
</section>;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export function AgentJobsInboxPage() {
|
|
395
|
+
const [params, setParams] = useSearchParams();
|
|
396
|
+
const querySearch = params.get("q")?.trim() ?? "";
|
|
397
|
+
const currentSort = sortOptions.some((option) => option.value === params.get("sort"))
|
|
398
|
+
? params.get("sort") as InboxSort : defaultSort;
|
|
399
|
+
const [searchText, setSearchText] = React.useState(querySearch);
|
|
400
|
+
const filterSearch = new URLSearchParams(inboxFilterKeys.flatMap(key => params.has(key) ? [[key, params.get(key)!]] : [])).toString();
|
|
401
|
+
const filters = React.useMemo(() => readInboxFilters(filterSearch), [filterSearch]);
|
|
402
|
+
const [filterDraft, setFilterDraft] = React.useState<InboxFilters>(emptyFilters);
|
|
403
|
+
const [filterOpen, setFilterOpen] = React.useState(false);
|
|
404
|
+
const [layout, setLayout] = React.useState<"inbox" | "list">("inbox");
|
|
405
|
+
const [offset, setOffset] = React.useState(0);
|
|
406
|
+
const [pageSize, setPageSize] = React.useState(initialPageSize);
|
|
407
|
+
const [inbox, setInbox] = React.useState<Inbox | null>(null);
|
|
408
|
+
const [error, setError] = React.useState("");
|
|
409
|
+
const [revision, setRevision] = React.useState(0);
|
|
410
|
+
const refresh = React.useCallback(() => setRevision((current) => current + 1), []);
|
|
411
|
+
const selectedId = params.get("run");
|
|
412
|
+
const [selected, setSelected] = React.useState<Run>();
|
|
413
|
+
const [listSelected, setListSelected] = React.useState<Run | null>(null);
|
|
414
|
+
const [selectionError, setSelectionError] = React.useState("");
|
|
415
|
+
const appliedFilterCount = Object.entries(filters).filter(([key, value]) => key !== "review" && Boolean(value)).length;
|
|
416
|
+
const visibleRun = inbox?.runs.find((run) => run.sessionId === selectedId);
|
|
417
|
+
const open = visibleRun ?? (selected?.sessionId === selectedId ? selected : null);
|
|
418
|
+
React.useEffect(() => {
|
|
419
|
+
setSelectionError("");
|
|
420
|
+
if (visibleRun) { setSelected(visibleRun); return; }
|
|
421
|
+
if (!selectedId) return;
|
|
422
|
+
const abort = new AbortController();
|
|
423
|
+
solidAxios.get<{ data: Run }>(`${inboxPath}/${encodeURIComponent(selectedId)}`, { signal: abort.signal })
|
|
424
|
+
.then(({ data }) => { if (!abort.signal.aborted) setSelected(data.data); })
|
|
425
|
+
.catch((error) => { if (!abort.signal.aborted) setSelectionError(errorMessage(error, "Could not open the run.")); });
|
|
426
|
+
return () => abort.abort();
|
|
427
|
+
}, [selectedId, visibleRun]);
|
|
428
|
+
|
|
429
|
+
React.useEffect(() => {
|
|
430
|
+
setSearchText(querySearch);
|
|
431
|
+
}, [querySearch]);
|
|
432
|
+
|
|
433
|
+
React.useEffect(() => {
|
|
434
|
+
const nextSearch = searchText.trim();
|
|
435
|
+
if (nextSearch === querySearch) return;
|
|
436
|
+
const timer = window.setTimeout(() => {
|
|
437
|
+
const nextParams = new URLSearchParams(params);
|
|
438
|
+
if (nextSearch) nextParams.set("q", nextSearch);
|
|
439
|
+
else nextParams.delete("q");
|
|
440
|
+
setParams(nextParams, { replace: true });
|
|
441
|
+
setOffset(0);
|
|
442
|
+
}, 300);
|
|
443
|
+
return () => window.clearTimeout(timer);
|
|
444
|
+
}, [querySearch, searchText, params, setParams]);
|
|
445
|
+
|
|
446
|
+
React.useEffect(() => {
|
|
447
|
+
const abort = new AbortController();
|
|
448
|
+
let reading = false;
|
|
449
|
+
async function list() {
|
|
450
|
+
if (reading) return;
|
|
451
|
+
reading = true;
|
|
452
|
+
try {
|
|
453
|
+
const response = await solidAxios.get<{ data: Inbox }>(inboxPath, {
|
|
454
|
+
params: {
|
|
455
|
+
review: filters.review, offset, limit: pageSize,
|
|
456
|
+
...(querySearch ? { q: querySearch } : {}),
|
|
457
|
+
sort: currentSort,
|
|
458
|
+
...(filters.agent ? { agent: filters.agent } : {}),
|
|
459
|
+
...(filters.status ? { status: filters.status } : {}),
|
|
460
|
+
...(filters.trigger ? { trigger: filters.trigger } : {}),
|
|
461
|
+
...(filters.runtime ? { runtime: filters.runtime } : {}),
|
|
462
|
+
...(filters.startedFrom ? { startedFrom: filters.startedFrom } : {}),
|
|
463
|
+
...(filters.startedTo ? { startedTo: filters.startedTo } : {}),
|
|
464
|
+
}, signal: abort.signal,
|
|
465
|
+
});
|
|
466
|
+
if (!abort.signal.aborted) { setInbox(response.data.data); setError(""); }
|
|
467
|
+
} catch (error) {
|
|
468
|
+
if (!abort.signal.aborted) setError(errorMessage(error, "Could not load the jobs inbox."));
|
|
469
|
+
} finally {
|
|
470
|
+
reading = false;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
void list();
|
|
474
|
+
const poll = window.setInterval(() => void list(), 10000);
|
|
475
|
+
return () => { abort.abort(); window.clearInterval(poll); };
|
|
476
|
+
}, [offset, pageSize, filters, querySearch, currentSort, revision]);
|
|
477
|
+
|
|
478
|
+
const updateFilters = (next: InboxFilters) => {
|
|
479
|
+
const nextParams = new URLSearchParams(params);
|
|
480
|
+
for (const key of inboxFilterKeys) {
|
|
481
|
+
if (next[key]) nextParams.set(key, String(next[key]));
|
|
482
|
+
else nextParams.delete(key);
|
|
483
|
+
}
|
|
484
|
+
setParams(nextParams, { replace: true });
|
|
485
|
+
setOffset(0);
|
|
486
|
+
setFilterOpen(false);
|
|
487
|
+
};
|
|
488
|
+
const applyFilters = (event: React.FormEvent<HTMLFormElement>) => {
|
|
489
|
+
event.preventDefault();
|
|
490
|
+
if (filterDraft.startedFrom && filterDraft.startedTo && filterDraft.startedFrom > filterDraft.startedTo) return;
|
|
491
|
+
updateFilters({ ...filterDraft, agent: filterDraft.agent.trim() });
|
|
492
|
+
};
|
|
493
|
+
const clearFilters = () => {
|
|
494
|
+
setFilterDraft(emptyFilters);
|
|
495
|
+
updateFilters(emptyFilters);
|
|
496
|
+
};
|
|
497
|
+
const handlePage = (event: { first: number; rows: number }) => { setOffset(event.first); setPageSize(event.rows); };
|
|
498
|
+
const toggleReview = () => updateFilters({ ...filters, review: !filters.review });
|
|
499
|
+
const changeSort = (sort: InboxSort) => {
|
|
500
|
+
const nextParams = new URLSearchParams(params);
|
|
501
|
+
if (sort === defaultSort) nextParams.delete("sort");
|
|
502
|
+
else nextParams.set("sort", sort);
|
|
503
|
+
setParams(nextParams, { replace: true });
|
|
504
|
+
setOffset(0);
|
|
505
|
+
};
|
|
506
|
+
const selectRun = (sessionId: string) => {
|
|
507
|
+
const nextParams = new URLSearchParams(params);
|
|
508
|
+
nextParams.set("run", sessionId);
|
|
509
|
+
setParams(nextParams);
|
|
510
|
+
};
|
|
511
|
+
const first = inbox?.total ? offset + 1 : 0;
|
|
512
|
+
const last = inbox ? Math.min(offset + pageSize, inbox.total) : 0;
|
|
513
|
+
const reviewCountOnPage = inbox?.runs.filter((run) => ["awaiting_input", "awaiting_approval"].includes(run.status)).length ?? 0;
|
|
514
|
+
|
|
515
|
+
return <main className={styles.inbox}>
|
|
516
|
+
<header className={`page-header solid-list-toolbar ${styles.toolbar}`}>
|
|
517
|
+
<label className={styles.search} aria-label="Search runs">
|
|
518
|
+
<input type="search" value={searchText} onChange={(event) => setSearchText(event.currentTarget.value)}
|
|
519
|
+
placeholder="Search agent, session ID, or status" />
|
|
520
|
+
</label>
|
|
521
|
+
<div className="solid-list-toolbar-actions">
|
|
522
|
+
<SolidButton variant="secondary" size="sm" leftIcon={<RefreshCw size={16} />} onClick={refresh} aria-label="Refresh inbox" title="Refresh inbox" />
|
|
523
|
+
<span className={styles.filterAction}>
|
|
524
|
+
<SolidButton variant="secondary" size="sm" leftIcon={<Filter size={16} />} onClick={() => { setFilterDraft(filters); setFilterOpen(true); }}
|
|
525
|
+
aria-label={appliedFilterCount ? `Filters, ${appliedFilterCount} applied` : "Filters"} title="Filter runs" />
|
|
526
|
+
{appliedFilterCount > 0 && <span className={styles.filterCount} aria-hidden="true">{appliedFilterCount}</span>}
|
|
527
|
+
</span>
|
|
528
|
+
<SolidButton variant="secondary" size="sm" leftIcon={layout === "inbox" ? <List size={16} /> : <InboxIcon size={16} />}
|
|
529
|
+
onClick={() => setLayout((current) => current === "inbox" ? "list" : "inbox")}
|
|
530
|
+
aria-label={layout === "inbox" ? "Switch to list view" : "Switch to inbox view"}
|
|
531
|
+
title={layout === "inbox" ? "Switch to list view" : "Switch to inbox view"} />
|
|
532
|
+
</div>
|
|
533
|
+
</header>
|
|
534
|
+
{error && <p className={styles.notice} role="alert">{error}</p>}
|
|
535
|
+
{layout === "inbox" ? <div className={styles.columns}>
|
|
536
|
+
<section className={styles.panel} aria-label="Background runs">
|
|
537
|
+
<div className={styles.listHeader}>
|
|
538
|
+
<div className={styles.listHeaderTitle}><strong>Runs</strong><span>{inbox?.total ?? 0}</span></div>
|
|
539
|
+
<div className={styles.listHeaderControls}>
|
|
540
|
+
<SolidButton size="sm" variant={filters.review ? "primary" : "secondary"} aria-pressed={filters.review}
|
|
541
|
+
className={filters.review ? styles.reviewToggleActive : styles.reviewToggle} onClick={toggleReview}>Needs review</SolidButton>
|
|
542
|
+
<label className={styles.sortLabel}><span>Sort</span><SolidSelect value={currentSort} onChange={(event) => changeSort(event.value as InboxSort)}
|
|
543
|
+
className={styles.sortSelect} options={sortOptions} native={false} menuPlacement="bottom" /></label>
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
<div className={styles.listScroll}>
|
|
547
|
+
{!inbox && !error && <p className={styles.listMessage} role="status">Loading runs…</p>}
|
|
548
|
+
{inbox?.runs.length === 0 && <p className={styles.listMessage}>{filters.review ? "No runs need your review." : "No background runs match these filters."}</p>}
|
|
549
|
+
{inbox?.runs.map((run) => <button type="button" key={run.sessionId} aria-pressed={selectedId === run.sessionId}
|
|
550
|
+
className={styles.row} onClick={() => selectRun(run.sessionId)}>
|
|
551
|
+
<span className={styles.rowHeading}><strong>{run.agentTitle ?? "Agent run"}</strong><span className={styles.runId}>Run #{run.id}</span></span>
|
|
552
|
+
<span className={styles.runMeta}><RunStatus status={run.status} hasJob={run.hasJob} />
|
|
553
|
+
<span>Last active <time dateTime={run.lastActiveAt}>{new Date(run.lastActiveAt).toLocaleString()}</time></span></span>
|
|
554
|
+
</button>)}
|
|
555
|
+
</div>
|
|
556
|
+
<div className="solid-table-paginator solid-table-paginator-align-end flex items-center justify-end gap-3 text-sm rounded-md border border-border/60 px-2 sm:px-3 py-1.5 bg-background">
|
|
557
|
+
<div className="solid-paginator-meta flex items-center gap-2 sm:ml-auto"><span className="solid-paginator-label">Rows</span>
|
|
558
|
+
<SolidSelect value={pageSize} onChange={(event) => handlePage({ first: 0, rows: Number(event.value) })}
|
|
559
|
+
className="solid-paginator-select" options={pageSizeOptions.map((rows) => ({ label: String(rows), value: rows }))} native={false} menuPlacement="top" />
|
|
560
|
+
<span className="solid-paginator-report">{first}–{last} of {inbox?.total ?? 0}</span>
|
|
561
|
+
</div>
|
|
562
|
+
<div className="solid-paginator-actions flex items-center gap-2">
|
|
563
|
+
<button type="button" className="solid-paginator-btn" disabled={offset === 0}
|
|
564
|
+
onClick={() => setOffset(Math.max(0, offset - pageSize))}>Previous</button>
|
|
565
|
+
<button type="button" className="solid-paginator-btn" disabled={!inbox?.hasMore}
|
|
566
|
+
onClick={() => setOffset(offset + pageSize)}>Next</button>
|
|
567
|
+
</div>
|
|
568
|
+
</div>
|
|
569
|
+
</section>
|
|
570
|
+
{open ? <OpenRun key={open.sessionId} run={open} revision={revision} onChange={refresh} />
|
|
571
|
+
: <div className={`${styles.panel} ${styles.empty}`}>
|
|
572
|
+
<InboxIcon size={22} aria-hidden="true" />
|
|
573
|
+
<strong>{selectionError ? "Could not open run" : selectedId ? "Opening run…" : "Choose a run"}</strong>
|
|
574
|
+
<p role={selectionError ? "alert" : "status"}>{selectionError || (selectedId ? "Loading its latest messages and status." : "Select a run to see its messages, progress, and pending requests.")}</p>
|
|
575
|
+
{inbox && <span className={styles.reviewSummary}>{reviewCountOnPage} run{reviewCountOnPage === 1 ? "" : "s"} awaiting input or approval on this page</span>}
|
|
576
|
+
</div>}
|
|
577
|
+
</div> : <section className={`${styles.panel} ${styles.tablePanel}`} aria-label="Background runs list" style={{ flexDirection: "column" }}>
|
|
578
|
+
<div className={styles.tableControls}>
|
|
579
|
+
<SolidButton size="sm" variant={filters.review ? "primary" : "secondary"} aria-pressed={filters.review}
|
|
580
|
+
className={filters.review ? styles.reviewToggleActive : styles.reviewToggle} onClick={toggleReview}>Needs review</SolidButton>
|
|
581
|
+
<label className={styles.sortLabel}><span>Sort</span><SolidSelect value={currentSort} onChange={(event) => changeSort(event.value as InboxSort)}
|
|
582
|
+
className={styles.sortSelect} options={sortOptions} native={false} menuPlacement="bottom" /></label>
|
|
583
|
+
</div>
|
|
584
|
+
<div className="solid-datatable-wrapper solid-list-table-area min-h-0 flex-1 overflow-hidden">
|
|
585
|
+
<SolidDataTable value={inbox?.runs ?? []} dataKey="sessionId" rows={pageSize}
|
|
586
|
+
first={offset} totalRecords={inbox?.total ?? 0} rowsPerPageOptions={pageSizeOptions}
|
|
587
|
+
onPage={handlePage} onRowClick={({ data }) => setListSelected(data)}
|
|
588
|
+
rowClassName={() => styles.tableRow}
|
|
589
|
+
emptyMessage={error || (filters.review ? "No runs need your review." : "No background runs match these filters.")}>
|
|
590
|
+
<Column field="agentTitle" header="Agent" />
|
|
591
|
+
<Column field="status" header="Status" body={(run: Run) => <RunStatus status={run.status} hasJob={run.hasJob} />} />
|
|
592
|
+
<Column field="trigger" header="Trigger" />
|
|
593
|
+
<Column field="runtime" header="Runtime" body={(run: Run) => run.runtime ?? "Unknown"} />
|
|
594
|
+
<Column field="startedAt" header="Started" body={(run: Run) => run.startedAt ? new Date(run.startedAt).toLocaleString() : "—"} />
|
|
595
|
+
<Column field="lastActiveAt" header="Last active" body={(run: Run) => new Date(run.lastActiveAt).toLocaleString()} />
|
|
596
|
+
<Column field="turnCount" header="Turns" />
|
|
597
|
+
<Column field="totalCost" header="Cost" body={(run: Run) => typeof run.totalCost === "number" ? run.totalCost.toFixed(4) : "—"} />
|
|
598
|
+
</SolidDataTable>
|
|
599
|
+
</div>
|
|
600
|
+
</section>}
|
|
601
|
+
<SolidDialog className={styles.filterDialog} open={filterOpen} onOpenChange={setFilterOpen} header="Filter runs"
|
|
602
|
+
style={{ width: "min(30rem, 94vw)" }} footer={<>
|
|
603
|
+
<SolidButton variant="ghost" onClick={clearFilters}>Clear filters</SolidButton>
|
|
604
|
+
<SolidButton variant="primary" type="submit" form="agent-inbox-filter-form">Apply filters</SolidButton>
|
|
605
|
+
</>}>
|
|
606
|
+
<SolidDialogBody>
|
|
607
|
+
<form id="agent-inbox-filter-form" className={styles.filterForm} onSubmit={applyFilters}>
|
|
608
|
+
<label>Agent name<input value={filterDraft.agent} onChange={(event) => setFilterDraft((value) => ({ ...value, agent: event.currentTarget.value }))} placeholder="Search agent" /></label>
|
|
609
|
+
<label>Status<SelectFilter value={filterDraft.status} onChange={(status) => setFilterDraft((value) => ({ ...value, status }))}
|
|
610
|
+
options={statuses} /></label>
|
|
611
|
+
<label>Trigger<SelectFilter value={filterDraft.trigger} onChange={(trigger) => setFilterDraft((value) => ({ ...value, trigger }))} options={triggers} /></label>
|
|
612
|
+
<label>Runtime<SelectFilter value={filterDraft.runtime} onChange={(runtime) => setFilterDraft((value) => ({ ...value, runtime }))} options={runtimes} /></label>
|
|
613
|
+
<label>Started from<input type="date" value={filterDraft.startedFrom} onChange={(event) => setFilterDraft((value) => ({ ...value, startedFrom: event.currentTarget.value }))} /></label>
|
|
614
|
+
<label>Started to<input type="date" value={filterDraft.startedTo} onChange={(event) => setFilterDraft((value) => ({ ...value, startedTo: event.currentTarget.value }))} /></label>
|
|
615
|
+
{filterDraft.startedFrom && filterDraft.startedTo && filterDraft.startedFrom > filterDraft.startedTo &&
|
|
616
|
+
<span className={styles.filterError} role="alert">Start date must be on or before end date.</span>}
|
|
617
|
+
</form>
|
|
618
|
+
</SolidDialogBody>
|
|
619
|
+
</SolidDialog>
|
|
620
|
+
<SolidDialog open={Boolean(listSelected)} onOpenChange={(open) => { if (!open) setListSelected(null); }}
|
|
621
|
+
ariaLabel="Run conversation" header={listSelected?.agentTitle ?? "Run conversation"}
|
|
622
|
+
className={styles.runDetailDialog}
|
|
623
|
+
style={{ width: "min(78rem, 96vw)", maxHeight: "92dvh", overflowY: "auto" }}>
|
|
624
|
+
<SolidDialogBody className={styles.detailDialogBody}>
|
|
625
|
+
{listSelected && <OpenRun key={listSelected.sessionId} run={listSelected} revision={revision} onChange={refresh} hideHeader />}
|
|
626
|
+
</SolidDialogBody>
|
|
627
|
+
</SolidDialog>
|
|
628
|
+
</main>;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function SelectFilter({ value, options, onChange }: { value: string; options: string[]; onChange: (value: string) => void }) {
|
|
632
|
+
return <SolidSelect value={value} onChange={(event) => onChange(event.value)}
|
|
633
|
+
options={[{ label: "All", value: "" }, ...options.map((option) => ({ label: option.replaceAll("_", " "), value: option }))]} />;
|
|
634
|
+
}
|