@codemation/next-host 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/app/(shell)/credentials/page.tsx +5 -0
- package/app/(shell)/dashboard/page.tsx +14 -0
- package/app/(shell)/layout.tsx +11 -0
- package/app/(shell)/page.tsx +5 -0
- package/app/(shell)/users/page.tsx +5 -0
- package/app/(shell)/workflows/[workflowId]/page.tsx +19 -0
- package/app/(shell)/workflows/page.tsx +5 -0
- package/app/api/[[...path]]/route.ts +40 -0
- package/app/api/auth/[...nextauth]/route.ts +3 -0
- package/app/globals.css +997 -0
- package/app/invite/[token]/page.tsx +10 -0
- package/app/layout.tsx +65 -0
- package/app/login/layout.tsx +25 -0
- package/app/login/page.tsx +22 -0
- package/components.json +21 -0
- package/docs/FORMS.md +46 -0
- package/docs/TAILWIND_SHADCN_MIGRATION.md +89 -0
- package/eslint.config.mjs +56 -0
- package/middleware.ts +29 -0
- package/next-env.d.ts +6 -0
- package/next.config.ts +34 -0
- package/package.json +76 -0
- package/postcss.config.mjs +7 -0
- package/public/canvas-icons/builtin/openai.svg +5 -0
- package/src/api/CodemationApiClient.ts +107 -0
- package/src/api/CodemationApiHttpError.ts +17 -0
- package/src/auth/CodemationNextAuthConfigResolver.ts +14 -0
- package/src/auth/CodemationNextAuthOAuthProviderDescriptorMapper.ts +30 -0
- package/src/auth/CodemationNextAuthOAuthProviderSnapshotResolver.ts +17 -0
- package/src/auth/CodemationNextAuthProviderCatalog.ts +107 -0
- package/src/auth/codemationEdgeAuth.ts +25 -0
- package/src/auth/codemationNextAuth.ts +32 -0
- package/src/components/Codemation.tsx +6 -0
- package/src/components/CodemationDataTable.tsx +37 -0
- package/src/components/CodemationDialog.tsx +137 -0
- package/src/components/CodemationFormattedDateTime.tsx +46 -0
- package/src/components/GoogleColorGIcon.tsx +39 -0
- package/src/components/OauthProviderIcon.tsx +33 -0
- package/src/components/PasswordStrengthMeter.tsx +59 -0
- package/src/components/forms/index.ts +28 -0
- package/src/components/json/JsonMonacoEditor.tsx +75 -0
- package/src/components/oauthProviderIconData.ts +17 -0
- package/src/components/ui/alert.tsx +56 -0
- package/src/components/ui/badge.tsx +40 -0
- package/src/components/ui/button.tsx +64 -0
- package/src/components/ui/card.tsx +70 -0
- package/src/components/ui/collapsible.tsx +26 -0
- package/src/components/ui/dialog.tsx +137 -0
- package/src/components/ui/dropdown-menu.tsx +238 -0
- package/src/components/ui/form.tsx +147 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/scroll-area.tsx +47 -0
- package/src/components/ui/select.tsx +169 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/switch.tsx +28 -0
- package/src/components/ui/table.tsx +72 -0
- package/src/components/ui/tabs.tsx +76 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toggle.tsx +41 -0
- package/src/features/credentials/components/CredentialConfirmDialog.tsx +58 -0
- package/src/features/credentials/components/CredentialDialog.tsx +252 -0
- package/src/features/credentials/components/CredentialDialogFeedback.tsx +36 -0
- package/src/features/credentials/components/CredentialDialogFieldRows.tsx +257 -0
- package/src/features/credentials/components/CredentialDialogFormSections.tsx +230 -0
- package/src/features/credentials/components/CredentialEnvFieldStatusRow.tsx +64 -0
- package/src/features/credentials/components/CredentialFieldCopyButton.tsx +48 -0
- package/src/features/credentials/components/CredentialsScreenHealthBadge.tsx +21 -0
- package/src/features/credentials/components/CredentialsScreenInstancesTable.tsx +108 -0
- package/src/features/credentials/components/CredentialsScreenTestFailureAlert.tsx +33 -0
- package/src/features/credentials/hooks/useCredentialCreateDialog.ts +33 -0
- package/src/features/credentials/hooks/useCredentialDialogSession.ts +616 -0
- package/src/features/credentials/hooks/useCredentialsScreen.ts +213 -0
- package/src/features/credentials/lib/credentialFieldHelpers.ts +35 -0
- package/src/features/credentials/lib/credentialFormTypes.ts +1 -0
- package/src/features/credentials/lib/credentialInstanceTestPayloadParser.ts +10 -0
- package/src/features/credentials/screens/CredentialsScreen.tsx +187 -0
- package/src/features/invite/screens/InviteAcceptScreen.tsx +190 -0
- package/src/features/users/components/UsersInviteDialog.tsx +121 -0
- package/src/features/users/components/UsersRegenerateDialog.tsx +81 -0
- package/src/features/users/components/UsersScreenUserStatusBadge.tsx +19 -0
- package/src/features/users/schemas/usersInviteFormSchema.ts +7 -0
- package/src/features/users/screens/UsersScreen.tsx +240 -0
- package/src/features/workflows/components/WorkflowListFolderSection.tsx +91 -0
- package/src/features/workflows/components/WorkflowListItemCard.tsx +67 -0
- package/src/features/workflows/components/WorkflowListRoot.tsx +39 -0
- package/src/features/workflows/components/WorkflowsListTree.tsx +28 -0
- package/src/features/workflows/components/canvas/CanvasNodeChromeTooltip.tsx +96 -0
- package/src/features/workflows/components/canvas/CanvasNodeIconSlot.tsx +25 -0
- package/src/features/workflows/components/canvas/VisibleNodeStatusResolver.tsx +84 -0
- package/src/features/workflows/components/canvas/WorkflowCanvas.tsx +248 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNode.tsx +182 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNodeAccents.tsx +73 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNodeAgentBottomSourceHandles.tsx +43 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNodeAgentLabels.tsx +47 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNodeCard.tsx +202 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNodeHandles.tsx +77 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNodeLabelBelow.tsx +51 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNodeMainGlyph.tsx +64 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasCodemationNodeToolbar.tsx +95 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasLoadingPlaceholder.tsx +69 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasNodeIcon.tsx +102 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasSimpleIconGlyph.tsx +21 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasStraightCountEdge.tsx +33 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasStructureSignature.tsx +7 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasSymmetricForkEdge.tsx +32 -0
- package/src/features/workflows/components/canvas/WorkflowCanvasToolbarIconButton.tsx +95 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasBuiltinIconRegistry.ts +26 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasEdgeCountResolver.ts +51 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasEdgeStyleResolver.ts +35 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasLabelLayoutEstimator.ts +42 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasOverlapResolver.ts +78 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasPortOrderResolver.ts +25 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasRoundedOrthogonalPathPlanner.ts +56 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasSiIconRegistry.ts +18 -0
- package/src/features/workflows/components/canvas/lib/WorkflowCanvasSymmetricForkPathPlanner.ts +43 -0
- package/src/features/workflows/components/canvas/lib/layoutWorkflow.ts +315 -0
- package/src/features/workflows/components/canvas/lib/workflowCanvasEdgeGeometry.ts +3 -0
- package/src/features/workflows/components/canvas/lib/workflowCanvasEmbeddedStyles.ts +62 -0
- package/src/features/workflows/components/canvas/lib/workflowCanvasFlowTypes.ts +10 -0
- package/src/features/workflows/components/canvas/lib/workflowCanvasNodeData.ts +41 -0
- package/src/features/workflows/components/canvas/lib/workflowCanvasNodeGeometry.ts +99 -0
- package/src/features/workflows/components/canvas/workflowCanvasNodeChrome.tsx +46 -0
- package/src/features/workflows/components/realtime/RealtimeContext.tsx +14 -0
- package/src/features/workflows/components/realtime/WorkflowRealtimeProvider.tsx +15 -0
- package/src/features/workflows/components/workflowDetail/NodeCredentialBindingRow.tsx +209 -0
- package/src/features/workflows/components/workflowDetail/NodeCredentialBindingsSection.tsx +227 -0
- package/src/features/workflows/components/workflowDetail/NodePropertiesConfigSection.tsx +51 -0
- package/src/features/workflows/components/workflowDetail/NodePropertiesPanelHeader.tsx +50 -0
- package/src/features/workflows/components/workflowDetail/NodePropertiesSlidePanel.tsx +134 -0
- package/src/features/workflows/components/workflowDetail/WorkflowActivationErrorDialog.tsx +71 -0
- package/src/features/workflows/components/workflowDetail/WorkflowActivationHeaderControl.tsx +64 -0
- package/src/features/workflows/components/workflowDetail/WorkflowDetailIcons.tsx +52 -0
- package/src/features/workflows/components/workflowDetail/WorkflowExecutionInspector.tsx +110 -0
- package/src/features/workflows/components/workflowDetail/WorkflowExecutionInspectorDetailBody.tsx +213 -0
- package/src/features/workflows/components/workflowDetail/WorkflowExecutionInspectorPanes.tsx +239 -0
- package/src/features/workflows/components/workflowDetail/WorkflowExecutionInspectorSidebarResizer.tsx +31 -0
- package/src/features/workflows/components/workflowDetail/WorkflowExecutionInspectorTreePanel.tsx +133 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorAttachmentGroupingPresenter.tsx +31 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorAttachmentList.tsx +118 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorBinaryView.tsx +15 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorErrorView.tsx +107 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorJsonView.tsx +114 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorPrettyTreePresenter.tsx +132 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorPrettyTreeViewRenderer.tsx +147 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorPrettyView.tsx +65 -0
- package/src/features/workflows/components/workflowDetail/WorkflowInspectorViews.tsx +5 -0
- package/src/features/workflows/components/workflowDetail/WorkflowJsonEditorBinaryAttachmentRow.tsx +74 -0
- package/src/features/workflows/components/workflowDetail/WorkflowJsonEditorBinaryUploadRow.tsx +69 -0
- package/src/features/workflows/components/workflowDetail/WorkflowJsonEditorDialog.tsx +254 -0
- package/src/features/workflows/components/workflowDetail/WorkflowRunsList.tsx +89 -0
- package/src/features/workflows/components/workflowDetail/WorkflowRunsSidebar.tsx +50 -0
- package/src/features/workflows/hooks/canvas/useWorkflowCanvasVisibleNodeStatuses.ts +14 -0
- package/src/features/workflows/hooks/realtime/realtime.tsx +271 -0
- package/src/features/workflows/hooks/realtime/runQueryPolling.ts +34 -0
- package/src/features/workflows/hooks/realtime/useWorkflowRealtimeInfrastructure.ts +541 -0
- package/src/features/workflows/hooks/realtime/useWorkflowRealtimeShowDisconnectedBadge.ts +9 -0
- package/src/features/workflows/hooks/workflowDetail/useWorkflowDetailController.tsx +1300 -0
- package/src/features/workflows/lib/realtime/realtimeApi.ts +78 -0
- package/src/features/workflows/lib/realtime/realtimeClientBridge.ts +52 -0
- package/src/features/workflows/lib/realtime/realtimeDomainTypes.ts +191 -0
- package/src/features/workflows/lib/realtime/realtimeQueryKeys.ts +15 -0
- package/src/features/workflows/lib/realtime/realtimeRunMutations.ts +167 -0
- package/src/features/workflows/lib/realtime/workflowTypes.ts +5 -0
- package/src/features/workflows/lib/workflowDetail/PersistedWorkflowSnapshotMapper.ts +205 -0
- package/src/features/workflows/lib/workflowDetail/WorkflowActivationHttpErrorFormat.ts +32 -0
- package/src/features/workflows/lib/workflowDetail/WorkflowDetailPresenter.ts +1017 -0
- package/src/features/workflows/lib/workflowDetail/WorkflowDetailUrlCodec.ts +70 -0
- package/src/features/workflows/lib/workflowDetail/workflowDetailTypes.ts +152 -0
- package/src/features/workflows/lib/workflowDetailTreeStyles.ts +65 -0
- package/src/features/workflows/screens/WorkflowDetailScreen.tsx +236 -0
- package/src/features/workflows/screens/WorkflowDetailScreenInspectorPanel.tsx +55 -0
- package/src/features/workflows/screens/WorkflowsList.tsx +35 -0
- package/src/features/workflows/screens/WorkflowsScreen.tsx +31 -0
- package/src/index.ts +1 -0
- package/src/lib/utils.ts +6 -0
- package/src/middleware/CodemationNextHostMiddlewarePathRules.ts +31 -0
- package/src/providers/CodemationSessionProvider.tsx +23 -0
- package/src/providers/Providers.tsx +36 -0
- package/src/providers/RealtimeBoundary.tsx +17 -0
- package/src/providers/WhitelabelProvider.tsx +22 -0
- package/src/server/CodemationAuthPrismaClient.ts +21 -0
- package/src/server/CodemationNextHost.ts +379 -0
- package/src/shell/AppLayout.tsx +141 -0
- package/src/shell/AppLayoutNavItems.tsx +129 -0
- package/src/shell/AppLayoutPageHeader.tsx +79 -0
- package/src/shell/AppLayoutSidebarBrand.tsx +33 -0
- package/src/shell/AppMainContent.tsx +17 -0
- package/src/shell/AppShellHeaderActions.tsx +12 -0
- package/src/shell/AppShellHeaderActionsAuthenticated.tsx +51 -0
- package/src/shell/CodemationNextClientShell.tsx +17 -0
- package/src/shell/CredentialsSignInRedirectResolver.ts +21 -0
- package/src/shell/LoginPageClient.tsx +231 -0
- package/src/shell/WorkflowDetailChromeContext.tsx +42 -0
- package/src/shell/WorkflowFolderTreeBuilder.ts +62 -0
- package/src/shell/WorkflowFolderUi.ts +42 -0
- package/src/shell/WorkflowSidebarNavFolder.tsx +112 -0
- package/src/shell/WorkflowSidebarNavTree.tsx +68 -0
- package/src/shell/appLayoutPageTitle.ts +16 -0
- package/src/shell/appLayoutSidebarIcons.tsx +108 -0
- package/src/whitelabel/CodemationWhitelabelSnapshot.ts +4 -0
- package/src/whitelabel/CodemationWhitelabelSnapshotFactory.ts +18 -0
- package/tsconfig.json +40 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vitest.config.ts +34 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
import { AlertCircle } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
import { Button } from "@/components/ui/button";
|
|
8
|
+
import {
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogContent,
|
|
11
|
+
DialogDescription,
|
|
12
|
+
DialogFooter,
|
|
13
|
+
DialogHeader,
|
|
14
|
+
DialogTitle,
|
|
15
|
+
} from "@/components/ui/dialog";
|
|
16
|
+
import { cn } from "@/lib/utils";
|
|
17
|
+
|
|
18
|
+
export function WorkflowActivationErrorDialog(
|
|
19
|
+
props: Readonly<{
|
|
20
|
+
open: boolean;
|
|
21
|
+
alertLines: ReadonlyArray<string>;
|
|
22
|
+
onDismiss: () => void;
|
|
23
|
+
}>,
|
|
24
|
+
): ReactNode {
|
|
25
|
+
return (
|
|
26
|
+
<Dialog
|
|
27
|
+
open={props.open}
|
|
28
|
+
onOpenChange={(next) => {
|
|
29
|
+
if (!next) {
|
|
30
|
+
props.onDismiss();
|
|
31
|
+
}
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<DialogContent
|
|
35
|
+
showCloseButton
|
|
36
|
+
data-testid="workflow-activation-error-dialog"
|
|
37
|
+
className={cn("gap-0 overflow-hidden p-0 sm:max-w-lg", "ring-1 ring-destructive/20")}
|
|
38
|
+
>
|
|
39
|
+
<DialogHeader className="flex flex-row gap-4 p-6 text-left sm:items-start">
|
|
40
|
+
<AlertCircle className="mt-0.5 size-5 shrink-0 text-destructive" strokeWidth={2.25} aria-hidden />
|
|
41
|
+
<div className="flex min-w-0 flex-col gap-2">
|
|
42
|
+
<DialogTitle className="text-base font-semibold">Could not update activation</DialogTitle>
|
|
43
|
+
<DialogDescription asChild>
|
|
44
|
+
<div className="text-muted-foreground">
|
|
45
|
+
{props.alertLines.length === 1 ? (
|
|
46
|
+
<p className="text-sm leading-snug" data-testid="workflow-activation-error-message">
|
|
47
|
+
{props.alertLines[0]}
|
|
48
|
+
</p>
|
|
49
|
+
) : (
|
|
50
|
+
<ul
|
|
51
|
+
className="list-inside list-disc space-y-1.5 text-sm leading-snug"
|
|
52
|
+
data-testid="workflow-activation-error-list"
|
|
53
|
+
>
|
|
54
|
+
{props.alertLines.map((line, index) => (
|
|
55
|
+
<li key={`${index}-${line}`}>{line}</li>
|
|
56
|
+
))}
|
|
57
|
+
</ul>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
</DialogDescription>
|
|
61
|
+
</div>
|
|
62
|
+
</DialogHeader>
|
|
63
|
+
<DialogFooter className="mx-0 mb-0 rounded-none border-t border-border bg-muted/40 px-6 py-4 sm:justify-end">
|
|
64
|
+
<Button type="button" data-testid="workflow-activation-error-dialog-ok" onClick={props.onDismiss}>
|
|
65
|
+
OK
|
|
66
|
+
</Button>
|
|
67
|
+
</DialogFooter>
|
|
68
|
+
</DialogContent>
|
|
69
|
+
</Dialog>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Switch } from "@/components/ui/switch";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { Loader2 } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
import { WorkflowActivationErrorDialog } from "./WorkflowActivationErrorDialog";
|
|
8
|
+
|
|
9
|
+
export type WorkflowActivationHeaderControlProps = Readonly<{
|
|
10
|
+
active: boolean;
|
|
11
|
+
pending: boolean;
|
|
12
|
+
onActiveChange: (next: boolean) => void;
|
|
13
|
+
alertLines: ReadonlyArray<string> | null;
|
|
14
|
+
onDismissAlert: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* `shell` — app header row (green track when active). `canvas` — legacy floating chrome on the canvas.
|
|
17
|
+
*/
|
|
18
|
+
variant?: "shell" | "canvas";
|
|
19
|
+
/** When false, only the switch row is rendered (errors shown by the parent, e.g. under the shell header). */
|
|
20
|
+
showErrorAlert?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
export function WorkflowActivationHeaderControl(props: WorkflowActivationHeaderControlProps) {
|
|
24
|
+
const variant = props.variant ?? "canvas";
|
|
25
|
+
const showErrorAlert = props.showErrorAlert ?? true;
|
|
26
|
+
const isShell = variant === "shell";
|
|
27
|
+
return (
|
|
28
|
+
<div className="pointer-events-auto flex min-w-0 flex-col gap-2">
|
|
29
|
+
<div
|
|
30
|
+
data-testid="workflow-activation-control"
|
|
31
|
+
className={cn(
|
|
32
|
+
"pointer-events-auto flex items-center gap-2",
|
|
33
|
+
isShell
|
|
34
|
+
? "py-0"
|
|
35
|
+
: "rounded-md border border-border/60 bg-background/90 px-2.5 py-1.5 shadow-sm backdrop-blur-sm",
|
|
36
|
+
)}
|
|
37
|
+
>
|
|
38
|
+
<span className="whitespace-nowrap text-xs font-semibold text-muted-foreground">Active</span>
|
|
39
|
+
{props.pending ? (
|
|
40
|
+
<Loader2
|
|
41
|
+
className="size-4 shrink-0 animate-spin text-muted-foreground"
|
|
42
|
+
aria-hidden
|
|
43
|
+
data-testid="workflow-activation-pending-indicator"
|
|
44
|
+
/>
|
|
45
|
+
) : null}
|
|
46
|
+
<Switch
|
|
47
|
+
checked={props.active}
|
|
48
|
+
onCheckedChange={props.onActiveChange}
|
|
49
|
+
disabled={props.pending}
|
|
50
|
+
aria-label={props.active ? "Deactivate workflow" : "Activate workflow"}
|
|
51
|
+
data-testid="workflow-activation-switch"
|
|
52
|
+
className={cn(
|
|
53
|
+
isShell &&
|
|
54
|
+
props.active &&
|
|
55
|
+
"data-[state=checked]:border-emerald-600 data-[state=checked]:bg-emerald-600 dark:data-[state=checked]:bg-emerald-600",
|
|
56
|
+
)}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
{showErrorAlert && props.alertLines && props.alertLines.length > 0 ? (
|
|
60
|
+
<WorkflowActivationErrorDialog open alertLines={props.alertLines} onDismiss={props.onDismissAlert} />
|
|
61
|
+
) : null}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Bot,
|
|
3
|
+
Boxes,
|
|
4
|
+
Brain,
|
|
5
|
+
CircleAlert,
|
|
6
|
+
CircleCheckBig,
|
|
7
|
+
Clock3,
|
|
8
|
+
GitBranch,
|
|
9
|
+
Globe,
|
|
10
|
+
LoaderCircle,
|
|
11
|
+
PlaySquare,
|
|
12
|
+
SquareStack,
|
|
13
|
+
Workflow,
|
|
14
|
+
Wrench,
|
|
15
|
+
type LucideIcon,
|
|
16
|
+
} from "lucide-react";
|
|
17
|
+
|
|
18
|
+
export function WorkflowStatusIcon(args: Readonly<{ status: string; size?: number }>) {
|
|
19
|
+
const { status, size = 16 } = args;
|
|
20
|
+
if (status === "completed") {
|
|
21
|
+
return <CircleCheckBig size={size} style={{ color: "#15803d" }} strokeWidth={2.1} />;
|
|
22
|
+
}
|
|
23
|
+
if (status === "failed") {
|
|
24
|
+
return <CircleAlert size={size} style={{ color: "#b91c1c" }} strokeWidth={2.1} />;
|
|
25
|
+
}
|
|
26
|
+
if (status === "running" || status === "queued") {
|
|
27
|
+
return (
|
|
28
|
+
<LoaderCircle
|
|
29
|
+
size={size}
|
|
30
|
+
style={{ color: "#2563eb", animation: "codemationSpin 1s linear infinite" }}
|
|
31
|
+
strokeWidth={2.1}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return <Clock3 size={size} style={{ color: "#6b7280" }} strokeWidth={2.1} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class WorkflowNodeIconResolver {
|
|
39
|
+
static resolveFallback(type: string, role?: string, icon?: string): LucideIcon {
|
|
40
|
+
if (icon?.toLowerCase() === "globe") return Globe;
|
|
41
|
+
if (role === "agent") return Bot;
|
|
42
|
+
if (role === "languageModel") return Brain;
|
|
43
|
+
if (role === "tool") return Wrench;
|
|
44
|
+
const normalizedType = type.toLowerCase();
|
|
45
|
+
if (normalizedType.includes("if")) return GitBranch;
|
|
46
|
+
if (normalizedType.includes("subworkflow")) return Workflow;
|
|
47
|
+
if (normalizedType.includes("map")) return SquareStack;
|
|
48
|
+
if (normalizedType.includes("trigger")) return PlaySquare;
|
|
49
|
+
if (normalizedType.includes("agent") || normalizedType.includes("ai")) return Bot;
|
|
50
|
+
return Boxes;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { WorkflowExecutionInspectorDetailBody } from "./WorkflowExecutionInspectorDetailBody";
|
|
3
|
+
import { WorkflowExecutionInspectorSidebarResizer } from "./WorkflowExecutionInspectorSidebarResizer";
|
|
4
|
+
import { WorkflowExecutionInspectorTreePanel } from "./WorkflowExecutionInspectorTreePanel";
|
|
5
|
+
import type {
|
|
6
|
+
WorkflowExecutionInspectorActions,
|
|
7
|
+
WorkflowExecutionInspectorFormatting,
|
|
8
|
+
WorkflowExecutionInspectorModel,
|
|
9
|
+
} from "../../lib/workflowDetail/workflowDetailTypes";
|
|
10
|
+
|
|
11
|
+
export function WorkflowExecutionInspector(
|
|
12
|
+
args: Readonly<{
|
|
13
|
+
model: WorkflowExecutionInspectorModel;
|
|
14
|
+
actions: WorkflowExecutionInspectorActions;
|
|
15
|
+
formatting: WorkflowExecutionInspectorFormatting;
|
|
16
|
+
}>,
|
|
17
|
+
) {
|
|
18
|
+
const { actions, formatting, model } = args;
|
|
19
|
+
const {
|
|
20
|
+
executionTreeData,
|
|
21
|
+
executionTreeExpandedKeys,
|
|
22
|
+
selectedExecutionTreeKey,
|
|
23
|
+
isLoading,
|
|
24
|
+
loadError,
|
|
25
|
+
selectedNodeId,
|
|
26
|
+
selectedRun,
|
|
27
|
+
selectedWorkflowNode,
|
|
28
|
+
viewContext,
|
|
29
|
+
} = model;
|
|
30
|
+
const { onSelectNode } = actions;
|
|
31
|
+
const TREE_PANEL_MIN_WIDTH_PX = 220;
|
|
32
|
+
const TREE_PANEL_DEFAULT_WIDTH_PX = 320;
|
|
33
|
+
const DETAIL_PANEL_MIN_WIDTH_PX = 320;
|
|
34
|
+
const TREE_RESIZE_HANDLE_WIDTH_PX = 8;
|
|
35
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
36
|
+
const resizeStartXRef = useRef<number | null>(null);
|
|
37
|
+
const resizeStartWidthRef = useRef(TREE_PANEL_DEFAULT_WIDTH_PX);
|
|
38
|
+
const [treePanelWidth, setTreePanelWidth] = useState(TREE_PANEL_DEFAULT_WIDTH_PX);
|
|
39
|
+
const [isTreePanelResizing, setIsTreePanelResizing] = useState(false);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!isTreePanelResizing) return;
|
|
43
|
+
const handleMouseMove = (event: MouseEvent) => {
|
|
44
|
+
if (resizeStartXRef.current === null) return;
|
|
45
|
+
const inspectorWidth = containerRef.current?.clientWidth ?? 0;
|
|
46
|
+
const maxTreePanelWidth = Math.max(
|
|
47
|
+
TREE_PANEL_MIN_WIDTH_PX,
|
|
48
|
+
inspectorWidth - DETAIL_PANEL_MIN_WIDTH_PX - TREE_RESIZE_HANDLE_WIDTH_PX,
|
|
49
|
+
);
|
|
50
|
+
const nextWidth = resizeStartWidthRef.current + (event.clientX - resizeStartXRef.current);
|
|
51
|
+
setTreePanelWidth(Math.max(TREE_PANEL_MIN_WIDTH_PX, Math.min(maxTreePanelWidth, nextWidth)));
|
|
52
|
+
};
|
|
53
|
+
const handleMouseUp = () => {
|
|
54
|
+
setIsTreePanelResizing(false);
|
|
55
|
+
resizeStartXRef.current = null;
|
|
56
|
+
};
|
|
57
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
58
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
59
|
+
return () => {
|
|
60
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
61
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
62
|
+
};
|
|
63
|
+
}, [isTreePanelResizing]);
|
|
64
|
+
|
|
65
|
+
if (isLoading && viewContext === "historical-run" && !selectedRun)
|
|
66
|
+
return <div style={{ opacity: 0.7 }}>Loading execution details…</div>;
|
|
67
|
+
if (isLoading && viewContext === "live-workflow" && !selectedWorkflowNode)
|
|
68
|
+
return <div style={{ opacity: 0.7 }}>Loading live workflow state…</div>;
|
|
69
|
+
if (loadError) return <div style={{ color: "#b91c1c" }}>{loadError}</div>;
|
|
70
|
+
if (!selectedNodeId) return <div style={{ opacity: 0.7 }}>Select a node to inspect.</div>;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
data-testid="workflow-execution-inspector"
|
|
75
|
+
ref={containerRef}
|
|
76
|
+
style={{
|
|
77
|
+
display: "grid",
|
|
78
|
+
gridTemplateColumns: `${treePanelWidth}px ${TREE_RESIZE_HANDLE_WIDTH_PX}px minmax(0, 1fr)`,
|
|
79
|
+
height: "100%",
|
|
80
|
+
minWidth: 0,
|
|
81
|
+
minHeight: 0,
|
|
82
|
+
overflow: "hidden",
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<WorkflowExecutionInspectorTreePanel
|
|
86
|
+
model={{
|
|
87
|
+
executionTreeData,
|
|
88
|
+
executionTreeExpandedKeys,
|
|
89
|
+
selectedExecutionTreeKey,
|
|
90
|
+
viewContext,
|
|
91
|
+
}}
|
|
92
|
+
formatting={{
|
|
93
|
+
formatDurationLabel: formatting.formatDurationLabel,
|
|
94
|
+
getNodeDisplayName: formatting.getNodeDisplayName,
|
|
95
|
+
}}
|
|
96
|
+
onSelectNode={onSelectNode}
|
|
97
|
+
/>
|
|
98
|
+
<WorkflowExecutionInspectorSidebarResizer
|
|
99
|
+
widthPx={treePanelWidth}
|
|
100
|
+
isResizing={isTreePanelResizing}
|
|
101
|
+
onResizeStart={(clientX, currentWidth) => {
|
|
102
|
+
resizeStartXRef.current = clientX;
|
|
103
|
+
resizeStartWidthRef.current = currentWidth;
|
|
104
|
+
setIsTreePanelResizing(true);
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
107
|
+
<WorkflowExecutionInspectorDetailBody model={model} actions={actions} formatting={formatting} />
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
}
|
package/src/features/workflows/components/workflowDetail/WorkflowExecutionInspectorDetailBody.tsx
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { WorkflowStatusIcon } from "./WorkflowDetailIcons";
|
|
2
|
+
import { WorkflowExecutionInspectorPanes } from "./WorkflowExecutionInspectorPanes";
|
|
3
|
+
import type {
|
|
4
|
+
WorkflowExecutionInspectorActions,
|
|
5
|
+
WorkflowExecutionInspectorFormatting,
|
|
6
|
+
WorkflowExecutionInspectorModel,
|
|
7
|
+
} from "../../lib/workflowDetail/workflowDetailTypes";
|
|
8
|
+
|
|
9
|
+
export function WorkflowExecutionInspectorDetailBody(
|
|
10
|
+
props: Readonly<{
|
|
11
|
+
model: Pick<
|
|
12
|
+
WorkflowExecutionInspectorModel,
|
|
13
|
+
| "inputPane"
|
|
14
|
+
| "outputPane"
|
|
15
|
+
| "selectedMode"
|
|
16
|
+
| "selectedNodeError"
|
|
17
|
+
| "selectedNodeId"
|
|
18
|
+
| "nodeActions"
|
|
19
|
+
| "selectedNodeSnapshot"
|
|
20
|
+
| "selectedPinnedOutput"
|
|
21
|
+
| "selectedWorkflowNode"
|
|
22
|
+
| "viewContext"
|
|
23
|
+
>;
|
|
24
|
+
formatting: Pick<
|
|
25
|
+
WorkflowExecutionInspectorFormatting,
|
|
26
|
+
| "formatDateTime"
|
|
27
|
+
| "formatDurationLabel"
|
|
28
|
+
| "getErrorClipboardText"
|
|
29
|
+
| "getErrorHeadline"
|
|
30
|
+
| "getErrorStack"
|
|
31
|
+
| "getNodeDisplayName"
|
|
32
|
+
| "getSnapshotTimestamp"
|
|
33
|
+
>;
|
|
34
|
+
actions: Pick<
|
|
35
|
+
WorkflowExecutionInspectorActions,
|
|
36
|
+
| "onClearPinnedOutput"
|
|
37
|
+
| "onEditSelectedOutput"
|
|
38
|
+
| "onSelectFormat"
|
|
39
|
+
| "onSelectInputPort"
|
|
40
|
+
| "onSelectMode"
|
|
41
|
+
| "onSelectOutputPort"
|
|
42
|
+
>;
|
|
43
|
+
}>,
|
|
44
|
+
) {
|
|
45
|
+
const { actions, formatting, model } = props;
|
|
46
|
+
const {
|
|
47
|
+
inputPane,
|
|
48
|
+
nodeActions,
|
|
49
|
+
outputPane,
|
|
50
|
+
selectedMode,
|
|
51
|
+
selectedNodeError,
|
|
52
|
+
selectedNodeId,
|
|
53
|
+
selectedNodeSnapshot,
|
|
54
|
+
selectedPinnedOutput,
|
|
55
|
+
selectedWorkflowNode,
|
|
56
|
+
viewContext,
|
|
57
|
+
} = model;
|
|
58
|
+
const {
|
|
59
|
+
formatDateTime,
|
|
60
|
+
formatDurationLabel,
|
|
61
|
+
getErrorClipboardText,
|
|
62
|
+
getErrorHeadline,
|
|
63
|
+
getErrorStack,
|
|
64
|
+
getNodeDisplayName,
|
|
65
|
+
getSnapshotTimestamp,
|
|
66
|
+
} = formatting;
|
|
67
|
+
const {
|
|
68
|
+
onClearPinnedOutput,
|
|
69
|
+
onEditSelectedOutput,
|
|
70
|
+
onSelectFormat,
|
|
71
|
+
onSelectInputPort,
|
|
72
|
+
onSelectMode,
|
|
73
|
+
onSelectOutputPort,
|
|
74
|
+
} = actions;
|
|
75
|
+
const paneActions = {
|
|
76
|
+
onClearPinnedOutput,
|
|
77
|
+
onEditSelectedOutput,
|
|
78
|
+
onSelectFormat,
|
|
79
|
+
onSelectInputPort,
|
|
80
|
+
onSelectOutputPort,
|
|
81
|
+
};
|
|
82
|
+
const errorFormatting = { getErrorClipboardText, getErrorHeadline, getErrorStack };
|
|
83
|
+
const isInputVisible = selectedMode === "input" || selectedMode === "split";
|
|
84
|
+
const isOutputVisible = selectedMode === "output" || selectedMode === "split";
|
|
85
|
+
const panes = isInputVisible && isOutputVisible ? [inputPane, outputPane] : [isInputVisible ? inputPane : outputPane];
|
|
86
|
+
const selectedNodeDurationLabel = formatDurationLabel(selectedNodeSnapshot);
|
|
87
|
+
|
|
88
|
+
const toggleInspectorPane = (tab: "input" | "output") => {
|
|
89
|
+
if (tab === "input") {
|
|
90
|
+
onSelectMode(isInputVisible ? "output" : isOutputVisible ? "split" : "input");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
onSelectMode(isOutputVisible ? "input" : isInputVisible ? "split" : "output");
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div style={{ display: "grid", gridTemplateRows: "auto 1fr", minWidth: 0, minHeight: 0, overflow: "hidden" }}>
|
|
98
|
+
<div style={{ display: "grid", gap: 8, padding: "10px 12px", borderBottom: "1px solid #d1d5db" }}>
|
|
99
|
+
<div
|
|
100
|
+
style={{ display: "flex", alignItems: "center", justifyContent: "space-between", flexWrap: "wrap", gap: 12 }}
|
|
101
|
+
>
|
|
102
|
+
<div style={{ minWidth: 0 }}>
|
|
103
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
|
104
|
+
<WorkflowStatusIcon status={selectedNodeSnapshot?.status ?? "pending"} />
|
|
105
|
+
<div
|
|
106
|
+
data-testid="selected-node-name"
|
|
107
|
+
style={{
|
|
108
|
+
fontWeight: 800,
|
|
109
|
+
fontSize: 14,
|
|
110
|
+
minWidth: 0,
|
|
111
|
+
overflow: "hidden",
|
|
112
|
+
textOverflow: "ellipsis",
|
|
113
|
+
whiteSpace: "nowrap",
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{getNodeDisplayName(selectedWorkflowNode, selectedNodeId)}
|
|
117
|
+
</div>
|
|
118
|
+
{selectedPinnedOutput ? (
|
|
119
|
+
<span
|
|
120
|
+
data-testid="selected-node-pinned-badge"
|
|
121
|
+
style={{
|
|
122
|
+
border: "1px solid #c4b5fd",
|
|
123
|
+
background: "#f5f3ff",
|
|
124
|
+
color: "#6d28d9",
|
|
125
|
+
fontSize: 11,
|
|
126
|
+
fontWeight: 800,
|
|
127
|
+
letterSpacing: 0.3,
|
|
128
|
+
textTransform: "uppercase",
|
|
129
|
+
padding: "2px 6px",
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
Pinned
|
|
133
|
+
</span>
|
|
134
|
+
) : null}
|
|
135
|
+
</div>
|
|
136
|
+
<div style={{ marginTop: 4, fontSize: 12, color: "#6b7280" }}>
|
|
137
|
+
{selectedNodeSnapshot ? (
|
|
138
|
+
<>
|
|
139
|
+
<span>{formatDateTime(getSnapshotTimestamp(selectedNodeSnapshot))}</span>
|
|
140
|
+
{selectedNodeDurationLabel ? (
|
|
141
|
+
<span data-testid="selected-node-duration">{` · ${selectedNodeDurationLabel}`}</span>
|
|
142
|
+
) : null}
|
|
143
|
+
</>
|
|
144
|
+
) : viewContext === "live-workflow" ? (
|
|
145
|
+
"Live workflow node"
|
|
146
|
+
) : (
|
|
147
|
+
"No execution snapshot yet"
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
<div style={{ display: "flex", minWidth: 0, flexWrap: "wrap", justifyContent: "flex-end", gap: 8 }}>
|
|
152
|
+
<div style={{ display: "flex", gap: 8 }}>
|
|
153
|
+
{[
|
|
154
|
+
{ tab: "input" as const, isSelected: isInputVisible, hasError: false },
|
|
155
|
+
{ tab: "output" as const, isSelected: isOutputVisible, hasError: Boolean(selectedNodeError) },
|
|
156
|
+
].map(({ tab, isSelected, hasError }) => (
|
|
157
|
+
<button
|
|
158
|
+
key={tab}
|
|
159
|
+
type="button"
|
|
160
|
+
role="checkbox"
|
|
161
|
+
data-testid={`inspector-tab-${tab}`}
|
|
162
|
+
onClick={() => toggleInspectorPane(tab)}
|
|
163
|
+
aria-checked={isSelected}
|
|
164
|
+
style={{
|
|
165
|
+
border: isSelected ? "1px solid #111827" : "1px solid #d1d5db",
|
|
166
|
+
background: isSelected ? "#111827" : "white",
|
|
167
|
+
color: isSelected ? "white" : hasError ? "#991b1b" : "#111827",
|
|
168
|
+
padding: "7px 11px",
|
|
169
|
+
fontWeight: 700,
|
|
170
|
+
fontSize: 12,
|
|
171
|
+
cursor: "pointer",
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
<span style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
|
|
175
|
+
<span>
|
|
176
|
+
{tab[0]!.toUpperCase()}
|
|
177
|
+
{tab.slice(1)}
|
|
178
|
+
</span>
|
|
179
|
+
{hasError ? (
|
|
180
|
+
<span
|
|
181
|
+
style={{
|
|
182
|
+
border: isSelected ? "1px solid rgba(255,255,255,0.28)" : "1px solid #fecaca",
|
|
183
|
+
background: isSelected ? "rgba(255,255,255,0.16)" : "#fef2f2",
|
|
184
|
+
color: isSelected ? "#ffffff" : "#991b1b",
|
|
185
|
+
fontSize: 10,
|
|
186
|
+
fontWeight: 800,
|
|
187
|
+
letterSpacing: 0.3,
|
|
188
|
+
textTransform: "uppercase",
|
|
189
|
+
padding: "1px 5px",
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
Error
|
|
193
|
+
</span>
|
|
194
|
+
) : null}
|
|
195
|
+
</span>
|
|
196
|
+
</button>
|
|
197
|
+
))}
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<WorkflowExecutionInspectorPanes
|
|
204
|
+
panes={panes}
|
|
205
|
+
nodeActions={nodeActions}
|
|
206
|
+
selectedPinnedOutput={selectedPinnedOutput}
|
|
207
|
+
selectedNodeError={selectedNodeError}
|
|
208
|
+
actions={paneActions}
|
|
209
|
+
formatting={errorFormatting}
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
);
|
|
213
|
+
}
|