@mcp-b/react-components 0.57.1 → 0.58.0
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/Card-BPkXIkBz.d.ts +46 -0
- package/dist/{CodeBlock-Bl-q7wMc.js → CodeBlock-Bs_Z03eC.js} +2 -1
- package/dist/{CodeBlock-CPotpyyM.d.ts → CodeBlock-DYp5V_4O.d.ts} +1 -1
- package/dist/{EmployeeChrome-CN99SVfF.d.ts → EmployeeChrome-DsdIek0l.d.ts} +2 -10
- package/dist/ExecutionBoard-DHfMvKlB.d.ts +64 -0
- package/dist/ExecutionResult-BSZsUbrL.js +279 -0
- package/dist/{FileTree-CfOhUyp3.js → FileTree-DyLBn7O_.js} +1 -1
- package/dist/{ManagerOffice-CMJ7laGe.js → ManagerOffice-DHcLRhFu.js} +6 -21
- package/dist/{McpConnectorForm-BPWCo9bU.d.ts → McpConnectorForm-D4bY-lm_.d.ts} +1 -1
- package/dist/{McpPluginCatalog-uSh0gGeY.d.ts → McpPluginCatalog-2FZDLCeK.d.ts} +2 -2
- package/dist/{SetupChecklist-BiWQkKEq.js → SetupChecklist-CKQ-mKYt.js} +2 -2
- package/dist/{ThinkRoutine-DGlKJbIy.d.ts → ThinkRoutine-DoZjbzyn.d.ts} +15 -3
- package/dist/{Workspace-Cr-aGDfx.d.ts → Workspace-iCkXvQRJ.d.ts} +1 -1
- package/dist/WorkspaceConcept-ByaG-kBq.d.ts +38 -0
- package/dist/WorkspaceExecutionTable-DNhj6YDX.d.ts +239 -0
- package/dist/{WorkspaceFile-DiwiJEwO.d.ts → WorkspaceFile-DkIZKoK6.d.ts} +1 -1
- package/dist/{WorkspaceFileView-CCe_o79q.js → WorkspaceFileView-M2jC2P4p.js} +217 -139
- package/dist/components/agents-sdk/AgentActivity.js +1 -1
- package/dist/components/agents-sdk/AgentChat.js +11 -11
- package/dist/components/agents-sdk/AgentEvent.js +2 -2
- package/dist/components/agents-sdk/BrowserLiveScreen.js +1 -1
- package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
- package/dist/components/agents-sdk/BrowserReplay.js +1 -1
- package/dist/components/agents-sdk/BrowserRunPanel.js +1 -1
- package/dist/components/agents-sdk/EmployeeApp.d.ts +1 -1
- package/dist/components/agents-sdk/EmployeeApp.js +4 -8
- package/dist/components/agents-sdk/EmployeeChat.js +5 -5
- package/dist/components/agents-sdk/EmployeeChrome.d.ts +1 -1
- package/dist/components/agents-sdk/EmployeeChrome.js +81 -66
- package/dist/components/agents-sdk/EmployeeSchedules.d.ts +6 -3
- package/dist/components/agents-sdk/EmployeeSchedules.js +14 -12
- package/dist/components/agents-sdk/EmployeeStartScreen.d.ts +2 -2
- package/dist/components/agents-sdk/EmployeeStartScreen.js +4 -4
- package/dist/components/agents-sdk/ExecutionBoard.d.ts +2 -0
- package/dist/components/agents-sdk/ExecutionBoard.js +648 -0
- package/dist/components/agents-sdk/ManagerAccountActions.js +3 -3
- package/dist/components/agents-sdk/ManagerOffice.d.ts +1 -1
- package/dist/components/agents-sdk/ManagerOffice.js +1 -1
- package/dist/components/agents-sdk/ManagerOfficeScreens.d.ts +1 -1
- package/dist/components/agents-sdk/ManagerOfficeScreens.js +4 -3
- package/dist/components/agents-sdk/McpConnectionRequest.d.ts +1 -1
- package/dist/components/agents-sdk/McpConnectionRequest.js +2 -2
- package/dist/components/agents-sdk/McpConnectorForm.d.ts +1 -1
- package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.d.ts +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +18 -9
- package/dist/components/agents-sdk/McpServerIcon.d.ts +1 -1
- package/dist/components/agents-sdk/McpServerPicker.d.ts +2 -2
- package/dist/components/agents-sdk/McpServerPicker.js +2 -2
- package/dist/components/agents-sdk/ModelEndpointDialog.js +1 -1
- package/dist/components/agents-sdk/ModelSelector.js +4 -4
- package/dist/components/agents-sdk/PromptInputApproval.js +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.js +1 -1
- package/dist/components/agents-sdk/SubagentRunIndicator.js +1 -1
- package/dist/components/agents-sdk/SubagentRunPanel.js +2 -2
- package/dist/components/agents-sdk/SubagentRunSelector.js +1 -1
- package/dist/components/agents-sdk/ThinkChatActivity.js +3 -3
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +238 -209
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +14 -35
- package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +3 -3
- package/dist/components/agents-sdk/ThinkRecoveryNotice.js +1 -1
- package/dist/components/agents-sdk/ThinkRoutine.d.ts +2 -2
- package/dist/components/agents-sdk/ThinkRoutineActions.d.ts +2 -2
- package/dist/components/agents-sdk/ThinkRoutineActions.js +26 -16
- package/dist/components/agents-sdk/ThinkRoutineBrowser.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkRoutineBrowser.js +2 -2
- package/dist/components/agents-sdk/ThinkRoutineDetail.d.ts +5 -2
- package/dist/components/agents-sdk/ThinkRoutineDetail.js +14 -8
- package/dist/components/agents-sdk/ThinkRoutineForm.d.ts +23 -6
- package/dist/components/agents-sdk/ThinkRoutineForm.js +522 -215
- package/dist/components/agents-sdk/ThinkRoutineRuns.js +1 -1
- package/dist/components/agents-sdk/ThinkThreadPicker.js +3 -3
- package/dist/components/agents-sdk/TypeSafeConnectionDialog.d.ts +10 -0
- package/dist/components/agents-sdk/TypeSafeConnectionDialog.js +34 -0
- package/dist/components/agents-sdk/WorkbenchBack.js +1 -1
- package/dist/components/agents-sdk/Workspace.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
- package/dist/components/agents-sdk/WorkspaceConcept.d.ts +2 -37
- package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +2 -2
- package/dist/components/agents-sdk/WorkspaceCorrespondence.js +7 -6
- package/dist/components/agents-sdk/WorkspaceExecution.d.ts +2 -92
- package/dist/components/agents-sdk/WorkspaceExecution.js +651 -134
- package/dist/components/agents-sdk/WorkspaceExecutionTable.d.ts +2 -0
- package/dist/components/agents-sdk/WorkspaceExecutionTable.js +824 -0
- package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +3 -1
- package/dist/components/agents-sdk/WorkspaceExplorer.js +5 -4
- package/dist/components/agents-sdk/WorkspaceFile.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.d.ts +4 -2
- package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
- package/dist/components/agents-sdk/WorkspaceHeader.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLive.d.ts +2 -2
- package/dist/components/agents-sdk/WorkspaceMountManager.js +1 -1
- package/dist/components/agents-sdk/WorkspaceProject.d.ts +2 -2
- package/dist/components/agents-sdk/WorkspaceProject.js +6 -5
- package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceUserScript.js +5 -4
- package/dist/components/ai-sdk/Activity.js +1 -1
- package/dist/components/ai-sdk/AgentChatStartScreen.js +1 -1
- package/dist/components/ai-sdk/Approval.js +2 -2
- package/dist/components/ai-sdk/Artifact.js +1 -1
- package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
- package/dist/components/ai-sdk/ChainOfThought.js +1 -1
- package/dist/components/ai-sdk/Checkpoint.js +1 -1
- package/dist/components/ai-sdk/CodeBlock.d.ts +1 -1
- package/dist/components/ai-sdk/CodeBlock.js +1 -1
- package/dist/components/ai-sdk/ComposerLink.js +1 -1
- package/dist/components/ai-sdk/ConnectedAppCards.d.ts +1 -1
- package/dist/components/ai-sdk/ConnectedAppCards.js +3 -3
- package/dist/components/ai-sdk/Context.js +1 -1
- package/dist/components/ai-sdk/Conversation.js +1 -1
- package/dist/components/ai-sdk/Goal.js +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.d.ts +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
- package/dist/components/ai-sdk/Message.js +2 -2
- package/dist/components/ai-sdk/MessageScroller.js +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +1 -1
- package/dist/components/ai-sdk/Plan.js +1 -1
- package/dist/components/ai-sdk/PromptInput.js +6 -6
- package/dist/components/ai-sdk/Queue.js +1 -1
- package/dist/components/ai-sdk/Reasoning.js +1 -1
- package/dist/components/ai-sdk/Sources.js +1 -1
- package/dist/components/ai-sdk/Task.js +1 -1
- package/dist/components/extension/ChatGptSignInScreen.js +2 -2
- package/dist/components/extension/CodexModelSelector.js +2 -2
- package/dist/components/extension/ConversationTabPicker.js +2 -2
- package/dist/components/foundations/Card.d.ts +2 -45
- package/dist/components/foundations/Checkbox.js +1 -1
- package/dist/components/foundations/Collapsible.js +1 -1
- package/dist/components/foundations/ContextMenu.js +1 -1
- package/dist/components/foundations/Menubar.js +1 -1
- package/dist/components/foundations/SearchField.js +1 -1
- package/dist/components/foundations/Select.js +1 -1
- package/dist/components/foundations/Stepper.js +1 -1
- package/dist/components/foundations/Toast.js +1 -1
- package/dist/components/foundations/ToggleGroup.d.ts +1 -1
- package/dist/components/foundations/ToggleGroup.js +1 -1
- package/dist/components/foundations/icons.d.ts +2 -2
- package/dist/components/foundations/icons.js +2 -2
- package/dist/components/general-purpose/AccountSignInDialog.js +1 -1
- package/dist/components/general-purpose/Commit.js +2 -2
- package/dist/components/general-purpose/EnvironmentVariables.js +2 -2
- package/dist/components/general-purpose/FileTree.js +1 -1
- package/dist/components/general-purpose/PricingBillingToggle.js +1 -1
- package/dist/components/general-purpose/PricingPlanCard.js +2 -2
- package/dist/components/general-purpose/PricingUsageCalculator.js +2 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
- package/dist/components/general-purpose/SettingsFormDialog.js +2 -2
- package/dist/components/general-purpose/SetupChecklist.js +1 -1
- package/dist/components/general-purpose/Terminal.js +2 -2
- package/dist/components/general-purpose/TestResults.js +1 -1
- package/dist/components/general-purpose/ThemeModeControl.js +2 -2
- package/dist/components/general-purpose/WebPreview.js +2 -2
- package/dist/components/nanites/AgentConnection.js +2 -2
- package/dist/components/nanites/AgentToolDetail.js +5 -5
- package/dist/{copy-button-CSDuDfdP.js → copy-button-M4sAp9xS.js} +1 -1
- package/dist/execution-result-DWVmm-bL.js +80 -0
- package/dist/{icons-CUuD7iEh.d.ts → icons-Dj6id76o.d.ts} +2 -1
- package/dist/{icons-cuEtsgj9.js → icons-DvlrWt54.js} +4 -3
- package/dist/{mcp-server-catalog-DgA9BnL0.d.ts → mcp-server-catalog-kaMWaSAL.d.ts} +3 -1
- package/dist/styles/app-top-bar.css +2 -1
- package/dist/styles/base.css +1 -0
- package/dist/styles/chatgpt-sign-in-screen.css +8 -14
- package/dist/styles/description-list.css +12 -9
- package/dist/styles/execution-board.css +383 -0
- package/dist/styles/index.css +3 -0
- package/dist/styles/mcp-plugin-catalog.css +8 -7
- package/dist/styles/think-chat-tool-panels.css +1 -2
- package/dist/styles/think-execution-workbench.css +1 -12
- package/dist/styles/think-routine.css +39 -41
- package/dist/styles/workspace-concepts.css +441 -17
- package/dist/styles/workspace-explorer.css +18 -4
- package/dist/utils/mcp-server-catalog.d.ts +2 -2
- package/dist/utils/mcp-server-catalog.js +18 -1
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/{workspace-assets-Bg7XhPsk.js → workspace-assets-DVn0d-fN.js} +24 -81
- package/dist/workspace-delete-DfloiBWp.js +80 -0
- package/package.json +3 -2
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { K as SpinnerIcon, S as FileIcon,
|
|
2
|
+
import { K as SpinnerIcon, S as FileIcon, T as InfoIcon, V as QueueIcon, Y as StopIcon, d as CheckIcon, p as ChevronRightIcon, q as SplitIcon, r as ArrowLeftIcon, u as CalendarIcon, z as PlayIcon } from "../../icons-DvlrWt54.js";
|
|
3
3
|
import { Button } from "../foundations/Button.js";
|
|
4
|
-
import { IconButton } from "../foundations/IconButton.js";
|
|
5
|
-
import { a as formatErrorMessage, o as formatUnknownValue, r as firstLine } from "../../format-CWaZEp5o.js";
|
|
6
4
|
import { Field } from "../foundations/Field.js";
|
|
7
5
|
import { Form } from "../foundations/Form.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { Tabs } from "../foundations/Tabs.js";
|
|
7
|
+
import { IconButton } from "../foundations/IconButton.js";
|
|
8
|
+
import { a as formatErrorMessage, r as firstLine } from "../../format-CWaZEp5o.js";
|
|
9
|
+
import { Card, CardAction, CardContent, CardHeader, CardTitle } from "../foundations/Card.js";
|
|
10
10
|
import { DescriptionList } from "../foundations/DescriptionList.js";
|
|
11
|
-
import {
|
|
11
|
+
import { Input } from "../foundations/Input.js";
|
|
12
12
|
import { Checkbox } from "../foundations/Checkbox.js";
|
|
13
|
-
import {
|
|
13
|
+
import { EmptyState } from "../foundations/EmptyState.js";
|
|
14
|
+
import { i as executionResultSummary, t as executionErrorSummary } from "../../execution-result-DWVmm-bL.js";
|
|
15
|
+
import { a as httpUrl, i as WorkspaceComposerLink, n as Hint, t as FaviconMark } from "../../workspace-assets-DVn0d-fN.js";
|
|
16
|
+
import { t as ExecutionResult } from "../../ExecutionResult-BSZsUbrL.js";
|
|
17
|
+
import { ExecutionBoard } from "./ExecutionBoard.js";
|
|
18
|
+
import { t as WorkspaceDeleteControl } from "../../workspace-delete-DfloiBWp.js";
|
|
14
19
|
import { t as WorkspaceConceptPanel } from "../../WorkspaceConceptPanel-97ZyVpZI.js";
|
|
20
|
+
import { WorkspaceExecutionTable } from "./WorkspaceExecutionTable.js";
|
|
15
21
|
import * as React from "react";
|
|
16
22
|
import { createElement } from "react";
|
|
17
23
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
24
|
+
import { useMutation, useMutationState, useQuery } from "@tanstack/react-query";
|
|
19
25
|
//#region src/components/agents-sdk/WorkspaceExecution.tsx
|
|
20
26
|
function draftFrom(parameters) {
|
|
21
27
|
return Object.fromEntries(parameters.flatMap((parameter) => parameter.value === void 0 ? [] : [[parameter.name, parameter.type === "boolean" ? Boolean(parameter.value) : String(parameter.value)]]));
|
|
@@ -58,7 +64,47 @@ function snapshotValue(parameter) {
|
|
|
58
64
|
return String(parameter.value);
|
|
59
65
|
}
|
|
60
66
|
function ExecutionIcon({ module }) {
|
|
61
|
-
return module.icon ?? /* @__PURE__ */ jsx(
|
|
67
|
+
return module.icon ?? /* @__PURE__ */ jsx(QueueIcon, {});
|
|
68
|
+
}
|
|
69
|
+
function WorkflowApps({ graph, compact = false }) {
|
|
70
|
+
const apps = /* @__PURE__ */ new Map();
|
|
71
|
+
for (const node of graph?.nodes ?? []) for (const link of node.links ?? []) {
|
|
72
|
+
const href = httpUrl(link.href);
|
|
73
|
+
if (href && !apps.has(new URL(href).hostname)) apps.set(new URL(href).hostname, {
|
|
74
|
+
...link,
|
|
75
|
+
href
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (apps.size === 0) return null;
|
|
79
|
+
return /* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: "workspace-execution-apps",
|
|
81
|
+
"aria-label": "Apps used",
|
|
82
|
+
children: [...apps.values()].map((app) => /* @__PURE__ */ jsx(Hint, {
|
|
83
|
+
content: compact ? app.label : new URL(app.href).hostname,
|
|
84
|
+
children: /* @__PURE__ */ jsxs("a", {
|
|
85
|
+
href: app.href,
|
|
86
|
+
target: "_blank",
|
|
87
|
+
rel: "noreferrer",
|
|
88
|
+
"aria-label": app.label,
|
|
89
|
+
children: [/* @__PURE__ */ jsx(FaviconMark, {
|
|
90
|
+
href: app.href,
|
|
91
|
+
fallback: /* @__PURE__ */ jsx(QueueIcon, {})
|
|
92
|
+
}), !compact ? /* @__PURE__ */ jsx("span", { children: app.label }) : null]
|
|
93
|
+
})
|
|
94
|
+
}, app.href))
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function missingRequiredInput(parameters, draft) {
|
|
98
|
+
return parameters.some((parameter) => parameter.required && (draft[parameter.name] === void 0 || draft[parameter.name] === ""));
|
|
99
|
+
}
|
|
100
|
+
function RunOptions({ initiallyOpen, children, className }) {
|
|
101
|
+
const [open, setOpen] = React.useState(initiallyOpen);
|
|
102
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
103
|
+
className,
|
|
104
|
+
open,
|
|
105
|
+
onToggle: (event) => setOpen(event.currentTarget.open),
|
|
106
|
+
children: [/* @__PURE__ */ jsx("summary", { children: "Run options" }), children]
|
|
107
|
+
});
|
|
62
108
|
}
|
|
63
109
|
function RunLinks({ runs }) {
|
|
64
110
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -66,51 +112,44 @@ function RunLinks({ runs }) {
|
|
|
66
112
|
children: runs.map((run) => /* @__PURE__ */ jsx(WorkspaceComposerLink, {
|
|
67
113
|
value: run.path,
|
|
68
114
|
label: run.label,
|
|
69
|
-
hint: run.path,
|
|
70
115
|
onOpen: run.onOpen
|
|
71
116
|
}, run.path))
|
|
72
117
|
});
|
|
73
118
|
}
|
|
74
|
-
function
|
|
75
|
-
const completed = outcome !== void 0;
|
|
76
|
-
const result = outcome?.result != null ? firstLine(formatUnknownValue(outcome.result)) : "";
|
|
77
|
-
const log = outcome ? firstLine(outcome.logs.join("\n")) : "";
|
|
78
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79
|
-
completed ? /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [/* @__PURE__ */ jsx(DescriptionList.Term, { children: "Last run" }), /* @__PURE__ */ jsx(DescriptionList.Details, { children: /* @__PURE__ */ jsxs("div", {
|
|
80
|
-
className: "sigvelo-cluster",
|
|
81
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
82
|
-
className: "workspace-execution-outcome",
|
|
83
|
-
children: [/* @__PURE__ */ jsx(CheckIcon, { size: 14 }), "Completed"]
|
|
84
|
-
}), outcome.runs.length > 0 ? /* @__PURE__ */ jsx(RunLinks, { runs: outcome.runs }) : null]
|
|
85
|
-
}) })] }) : null,
|
|
86
|
-
result ? /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [/* @__PURE__ */ jsx(DescriptionList.Term, { children: "Result" }), /* @__PURE__ */ jsx(DescriptionList.Details, { children: result })] }) : null,
|
|
87
|
-
log ? /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [/* @__PURE__ */ jsx(DescriptionList.Term, { children: "Log" }), /* @__PURE__ */ jsx(DescriptionList.Details, { children: log })] }) : null,
|
|
88
|
-
runs.length > 0 ? /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [/* @__PURE__ */ jsx(DescriptionList.Term, { children: completed ? "Earlier" : runs.length === 1 ? "Last" : "Runs" }), /* @__PURE__ */ jsx(DescriptionList.Details, { children: /* @__PURE__ */ jsx(RunLinks, { runs }) })] }) : null
|
|
89
|
-
] });
|
|
90
|
-
}
|
|
91
|
-
function ExecutionFields({ draft, outcome, parameters, runs, onDraftChange }) {
|
|
119
|
+
function ExecutionFields({ draft, parameters, onDraftChange }) {
|
|
92
120
|
const fieldId = React.useId();
|
|
93
121
|
const editing = draft != null && onDraftChange != null;
|
|
94
|
-
const runItems = runs ?? [];
|
|
95
122
|
const visibleParameters = editing ? parameters : parameters.filter((parameter) => snapshotValue(parameter) !== "");
|
|
96
|
-
if (visibleParameters.length === 0
|
|
97
|
-
return /* @__PURE__ */
|
|
123
|
+
if (visibleParameters.length === 0) return null;
|
|
124
|
+
return /* @__PURE__ */ jsx(DescriptionList.Root, {
|
|
98
125
|
align: "start",
|
|
99
126
|
variant: "divided",
|
|
100
|
-
children:
|
|
127
|
+
children: visibleParameters.map((parameter) => {
|
|
101
128
|
const id = `${fieldId}-${parameter.name}`;
|
|
102
|
-
const parameterLabel =
|
|
129
|
+
const parameterLabel = parameter.label;
|
|
130
|
+
const help = [parameter.description, parameter.required ? "Required." : void 0].filter(Boolean).join(" ");
|
|
103
131
|
const href = parameter.type === "string" ? httpUrl(String(editing ? draft?.[parameter.name] ?? parameter.value : parameter.value)) : void 0;
|
|
104
|
-
return /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [/* @__PURE__ */ jsxs(DescriptionList.Term, {
|
|
105
|
-
|
|
106
|
-
|
|
132
|
+
return /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [/* @__PURE__ */ jsxs(DescriptionList.Term, { children: [
|
|
133
|
+
href && !editing ? /* @__PURE__ */ jsx(FaviconMark, { href }) : null,
|
|
134
|
+
editing && parameter.type !== "boolean" ? /* @__PURE__ */ jsx("label", {
|
|
107
135
|
htmlFor: id,
|
|
108
136
|
children: parameterLabel
|
|
109
|
-
}) :
|
|
110
|
-
|
|
137
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
138
|
+
id: parameter.type === "boolean" ? id : void 0,
|
|
139
|
+
children: parameterLabel
|
|
140
|
+
}),
|
|
141
|
+
help ? /* @__PURE__ */ jsx(IconButton, {
|
|
142
|
+
label: `About ${parameterLabel}`,
|
|
143
|
+
tooltip: help,
|
|
144
|
+
variant: "ghost",
|
|
145
|
+
color: "neutral",
|
|
146
|
+
children: /* @__PURE__ */ jsx(InfoIcon, {})
|
|
147
|
+
}) : null
|
|
148
|
+
] }), /* @__PURE__ */ jsxs(DescriptionList.Details, { children: [editing && parameter.type === "boolean" ? /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
111
149
|
checked: draft?.[parameter.name] === true,
|
|
112
150
|
indeterminate: draft?.[parameter.name] === void 0,
|
|
113
151
|
"aria-labelledby": id,
|
|
152
|
+
"aria-describedby": help ? `${id}-description` : void 0,
|
|
114
153
|
onCheckedChange: (checked) => {
|
|
115
154
|
if (typeof checked === "boolean") onDraftChange?.(parameter.name, checked);
|
|
116
155
|
},
|
|
@@ -118,39 +157,62 @@ function ExecutionFields({ draft, outcome, parameters, runs, onDraftChange }) {
|
|
|
118
157
|
}) : editing ? /* @__PURE__ */ jsx(Input, {
|
|
119
158
|
id,
|
|
120
159
|
name: parameter.name,
|
|
160
|
+
"aria-describedby": help ? `${id}-description` : void 0,
|
|
121
161
|
type: href ? "url" : void 0,
|
|
122
162
|
value: String(draft?.[parameter.name] ?? ""),
|
|
123
163
|
autoComplete: "off",
|
|
124
164
|
inputMode: parameter.type === "number" ? "decimal" : void 0,
|
|
125
165
|
onChange: (event) => onDraftChange?.(parameter.name, event.currentTarget.value)
|
|
126
|
-
}) : snapshotValue(parameter)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
166
|
+
}) : snapshotValue(parameter), help ? /* @__PURE__ */ jsx("span", {
|
|
167
|
+
id: `${id}-description`,
|
|
168
|
+
className: "sigvelo-visually-hidden",
|
|
169
|
+
children: help
|
|
170
|
+
}) : null] })] }, parameter.name);
|
|
171
|
+
})
|
|
131
172
|
});
|
|
132
173
|
}
|
|
133
|
-
function ExecutionActions({ busy, module }) {
|
|
134
|
-
if (module.onRun == null && module.onOpen == null && module.onDelete == null) return null;
|
|
174
|
+
function ExecutionActions({ busy, module, canQuickRun, onStop, stopping }) {
|
|
135
175
|
return /* @__PURE__ */ jsxs(CardAction, {
|
|
136
|
-
className: "
|
|
176
|
+
className: "workspace-execution-card__actions",
|
|
137
177
|
children: [
|
|
138
|
-
module.
|
|
178
|
+
module.trace?.status === "running" && module.onStop ? /* @__PURE__ */ jsx(IconButton, {
|
|
179
|
+
label: "Stop run",
|
|
180
|
+
variant: "ghost",
|
|
181
|
+
color: "neutral",
|
|
182
|
+
onClick: onStop,
|
|
183
|
+
disabled: stopping,
|
|
184
|
+
children: /* @__PURE__ */ jsx(StopIcon, {})
|
|
185
|
+
}) : module.onRun && canQuickRun ? /* @__PURE__ */ jsx(IconButton, {
|
|
139
186
|
type: "submit",
|
|
140
|
-
label: `Run ${module.name}`,
|
|
187
|
+
label: `Run now: ${module.name}`,
|
|
141
188
|
tooltip: "Run",
|
|
142
189
|
variant: "ghost",
|
|
143
190
|
color: "neutral",
|
|
144
191
|
disabled: busy,
|
|
145
|
-
children: /* @__PURE__ */ jsx(PlayIcon, {})
|
|
192
|
+
children: busy ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(PlayIcon, {})
|
|
193
|
+
}) : null,
|
|
194
|
+
module.onSchedule && !module.onOpenBoard ? /* @__PURE__ */ jsx(IconButton, {
|
|
195
|
+
label: `Schedule ${module.name}`,
|
|
196
|
+
tooltip: "Schedule",
|
|
197
|
+
variant: "ghost",
|
|
198
|
+
color: "neutral",
|
|
199
|
+
onClick: module.onSchedule,
|
|
200
|
+
children: /* @__PURE__ */ jsx(CalendarIcon, {})
|
|
201
|
+
}) : null,
|
|
202
|
+
module.onOpenBoard ? /* @__PURE__ */ jsx(IconButton, {
|
|
203
|
+
label: `Open workflow: ${module.name}`,
|
|
204
|
+
tooltip: "Open workflow",
|
|
205
|
+
variant: "ghost",
|
|
206
|
+
color: "neutral",
|
|
207
|
+
onClick: module.onOpenBoard,
|
|
208
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
146
209
|
}) : null,
|
|
147
|
-
module.
|
|
148
|
-
label: `
|
|
149
|
-
tooltip: module.
|
|
210
|
+
module.description && !module.onOpenBoard ? /* @__PURE__ */ jsx(IconButton, {
|
|
211
|
+
label: `About ${module.name}`,
|
|
212
|
+
tooltip: module.description,
|
|
150
213
|
variant: "ghost",
|
|
151
214
|
color: "neutral",
|
|
152
|
-
|
|
153
|
-
children: /* @__PURE__ */ jsx(FileIcon, {})
|
|
215
|
+
children: /* @__PURE__ */ jsx(InfoIcon, {})
|
|
154
216
|
}) : null,
|
|
155
217
|
module.onDelete ? /* @__PURE__ */ jsx(WorkspaceDeleteControl, {
|
|
156
218
|
name: module.name,
|
|
@@ -162,6 +224,50 @@ function ExecutionActions({ busy, module }) {
|
|
|
162
224
|
function executionFormKey(module) {
|
|
163
225
|
return `${module.path}:${JSON.stringify(module.parameters)}`;
|
|
164
226
|
}
|
|
227
|
+
function useExecutionSession(module) {
|
|
228
|
+
const localKey = React.useId();
|
|
229
|
+
const mutationKey = module.mutationKey ?? ["workspace-execution", localKey];
|
|
230
|
+
const runs = useMutationState({
|
|
231
|
+
filters: {
|
|
232
|
+
mutationKey,
|
|
233
|
+
exact: true
|
|
234
|
+
},
|
|
235
|
+
select: (mutation) => mutation.state
|
|
236
|
+
});
|
|
237
|
+
const [draft, setDraft] = React.useState(() => draftFrom(runs.at(-1)?.variables ?? module.parameters));
|
|
238
|
+
const formKey = executionFormKey(module);
|
|
239
|
+
const [seenFormKey, setSeenFormKey] = React.useState(formKey);
|
|
240
|
+
if (formKey !== seenFormKey) {
|
|
241
|
+
setSeenFormKey(formKey);
|
|
242
|
+
setDraft(draftFrom(module.parameters));
|
|
243
|
+
}
|
|
244
|
+
const runMutation = useMutation({
|
|
245
|
+
mutationKey,
|
|
246
|
+
onMutate: () => module.trace?.executionId,
|
|
247
|
+
mutationFn: async (parameters) => {
|
|
248
|
+
if (!module.onRun) throw new Error("Execution is no longer available.");
|
|
249
|
+
return module.onRun(parameters);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
const latestRun = runs.at(-1) ?? runMutation;
|
|
253
|
+
const busy = runMutation.isPending || latestRun.status === "pending" || module.trace?.status === "running";
|
|
254
|
+
const stopMutation = useMutation({
|
|
255
|
+
onMutate: () => module.trace?.executionId,
|
|
256
|
+
mutationFn: async () => module.onStop?.()
|
|
257
|
+
});
|
|
258
|
+
const superseded = module.trace !== void 0 && latestRun.status !== "pending" && module.trace.executionId !== latestRun.context && module.trace.executionId !== latestRun.data?.executionId;
|
|
259
|
+
const error = (stopMutation.context === module.trace?.executionId ? stopMutation.error : null) ?? (superseded ? null : latestRun.error);
|
|
260
|
+
return {
|
|
261
|
+
draft,
|
|
262
|
+
setDraft,
|
|
263
|
+
runMutation,
|
|
264
|
+
stopMutation,
|
|
265
|
+
busy,
|
|
266
|
+
errorMessage: error ? executionErrorSummary(formatErrorMessage(error)) : "",
|
|
267
|
+
outcome: !superseded && latestRun.status === "success" ? latestRun.data : void 0,
|
|
268
|
+
runStatus: latestRun.status
|
|
269
|
+
};
|
|
270
|
+
}
|
|
165
271
|
function WorkspaceExecutionCard({ module, ...props }) {
|
|
166
272
|
return /* @__PURE__ */ createElement(WorkspaceExecutionCardSession, {
|
|
167
273
|
...props,
|
|
@@ -169,69 +275,111 @@ function WorkspaceExecutionCard({ module, ...props }) {
|
|
|
169
275
|
module
|
|
170
276
|
});
|
|
171
277
|
}
|
|
278
|
+
function executionCardStatus(module, busy, hasError, hasOutcome) {
|
|
279
|
+
if (busy) return "Running";
|
|
280
|
+
if (hasError) return "Failed";
|
|
281
|
+
if (module.trace?.status === "aborted") return "Stopped";
|
|
282
|
+
if (module.trace?.status === "interrupted") return "Interrupted";
|
|
283
|
+
return hasOutcome ? "Completed" : void 0;
|
|
284
|
+
}
|
|
285
|
+
function WorkspaceExecutionCardMeta({ module, busy, cardError, cardOutcome }) {
|
|
286
|
+
const lastRun = cardOutcome?.runs[0] ?? module.runs?.[0];
|
|
287
|
+
const status = executionCardStatus(module, busy, Boolean(cardError), Boolean(cardOutcome));
|
|
288
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
289
|
+
className: "workspace-execution-card__meta",
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ jsx(WorkflowApps, {
|
|
292
|
+
graph: module.trace?.graph ?? module.graph,
|
|
293
|
+
compact: true
|
|
294
|
+
}),
|
|
295
|
+
status ? /* @__PURE__ */ jsxs("span", {
|
|
296
|
+
className: "workspace-execution-status",
|
|
297
|
+
role: "status",
|
|
298
|
+
"aria-atomic": "true",
|
|
299
|
+
children: [busy ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : cardOutcome && !cardError ? /* @__PURE__ */ jsx(CheckIcon, {}) : null, status]
|
|
300
|
+
}) : null,
|
|
301
|
+
lastRun ? /* @__PURE__ */ jsx(RunLinks, { runs: [lastRun] }) : null
|
|
302
|
+
]
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function WorkspaceExecutionCardBody({ module, draft, setDraft, busy, errorMessage, outcome }) {
|
|
306
|
+
const editing = module.onRun != null;
|
|
307
|
+
const cardOutcome = outcome ?? (module.trace?.status === "completed" ? {
|
|
308
|
+
result: module.trace.result,
|
|
309
|
+
logs: module.trace.logs,
|
|
310
|
+
runs: []
|
|
311
|
+
} : void 0);
|
|
312
|
+
const cardError = errorMessage || (module.trace?.error ? firstLine(executionErrorSummary(module.trace.error)) : "");
|
|
313
|
+
return /* @__PURE__ */ jsxs(CardContent, {
|
|
314
|
+
className: "workspace-execution-card__body",
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ jsx(WorkspaceExecutionCardMeta, {
|
|
317
|
+
module,
|
|
318
|
+
busy,
|
|
319
|
+
cardError,
|
|
320
|
+
cardOutcome
|
|
321
|
+
}),
|
|
322
|
+
!module.onOpenBoard && (cardOutcome?.result ?? module.trace?.result) != null ? /* @__PURE__ */ jsx("p", {
|
|
323
|
+
className: "workspace-execution-card__summary",
|
|
324
|
+
children: firstLine(executionResultSummary(cardOutcome?.result ?? module.trace?.result))
|
|
325
|
+
}) : null,
|
|
326
|
+
editing && !module.onOpenBoard && module.parameters.length > 0 ? /* @__PURE__ */ jsx(RunOptions, {
|
|
327
|
+
className: "workspace-execution-card__options",
|
|
328
|
+
initiallyOpen: missingRequiredInput(module.parameters, draft),
|
|
329
|
+
children: /* @__PURE__ */ jsx(ExecutionFields, {
|
|
330
|
+
draft,
|
|
331
|
+
parameters: module.parameters,
|
|
332
|
+
onDraftChange: (name, value) => setDraft((current) => ({
|
|
333
|
+
...current,
|
|
334
|
+
[name]: value
|
|
335
|
+
}))
|
|
336
|
+
})
|
|
337
|
+
}, executionFormKey(module)) : null,
|
|
338
|
+
cardError ? /* @__PURE__ */ jsx(Field.Errors, { errors: [cardError] }) : null
|
|
339
|
+
]
|
|
340
|
+
});
|
|
341
|
+
}
|
|
172
342
|
function WorkspaceExecutionCardSession({ className, module, ref, ...props }) {
|
|
173
343
|
const titleId = React.useId();
|
|
174
344
|
const ariaLabel = props["aria-label"];
|
|
175
345
|
const ariaLabelledBy = props["aria-labelledby"] ?? (ariaLabel ? void 0 : titleId);
|
|
176
346
|
const editing = module.onRun != null;
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const runMutation = useMutation({ mutationFn: async () => {
|
|
185
|
-
if (!module.onRun) throw new Error("Execution is no longer available.");
|
|
186
|
-
return module.onRun(collectRunParameters(module.parameters, draft));
|
|
187
|
-
} });
|
|
188
|
-
const busy = runMutation.isPending;
|
|
189
|
-
const errorMessage = runMutation.isError ? formatErrorMessage(runMutation.error) : "";
|
|
190
|
-
const hasBody = module.parameters.length > 0 || (module.runs?.length ?? 0) > 0 || runMutation.isSuccess || editing || Boolean(errorMessage);
|
|
191
|
-
const header = /* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
192
|
-
/* @__PURE__ */ jsxs(CardTitle, {
|
|
193
|
-
id: titleId,
|
|
194
|
-
className: "connected-app-card__title",
|
|
195
|
-
render: (props) => /* @__PURE__ */ jsx("h3", {
|
|
196
|
-
...props,
|
|
197
|
-
children: props.children
|
|
198
|
-
}),
|
|
199
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
200
|
-
className: "connected-app-card__icon",
|
|
201
|
-
"aria-hidden": "true",
|
|
202
|
-
children: /* @__PURE__ */ jsx(ExecutionIcon, { module })
|
|
203
|
-
}), module.name]
|
|
347
|
+
const { draft, setDraft, runMutation, stopMutation, busy, errorMessage, outcome } = useExecutionSession(module);
|
|
348
|
+
const header = /* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsxs(CardTitle, {
|
|
349
|
+
id: titleId,
|
|
350
|
+
className: "connected-app-card__title",
|
|
351
|
+
render: (props) => /* @__PURE__ */ jsx("h3", {
|
|
352
|
+
...props,
|
|
353
|
+
children: props.children
|
|
204
354
|
}),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
module
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
errorMessage
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
role: "status",
|
|
226
|
-
"aria-atomic": "true",
|
|
227
|
-
children: errorMessage || (busy ? "Running" : runMutation.isSuccess ? "Completed" : "")
|
|
228
|
-
})
|
|
229
|
-
] }) : null;
|
|
355
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
356
|
+
className: "connected-app-card__icon",
|
|
357
|
+
"aria-hidden": "true",
|
|
358
|
+
children: /* @__PURE__ */ jsx(ExecutionIcon, { module })
|
|
359
|
+
}), module.name]
|
|
360
|
+
}), /* @__PURE__ */ jsx(ExecutionActions, {
|
|
361
|
+
busy,
|
|
362
|
+
module,
|
|
363
|
+
canQuickRun: !module.onOpenBoard || !missingRequiredInput(module.parameters, draft),
|
|
364
|
+
onStop: () => stopMutation.mutate(),
|
|
365
|
+
stopping: stopMutation.isPending
|
|
366
|
+
})] });
|
|
367
|
+
const body = /* @__PURE__ */ jsx(WorkspaceExecutionCardBody, {
|
|
368
|
+
module,
|
|
369
|
+
draft,
|
|
370
|
+
setDraft,
|
|
371
|
+
busy,
|
|
372
|
+
errorMessage,
|
|
373
|
+
outcome
|
|
374
|
+
});
|
|
230
375
|
const inner = editing ? /* @__PURE__ */ jsxs(Form, {
|
|
231
376
|
noValidate: true,
|
|
232
377
|
onSubmit: (event) => {
|
|
233
378
|
event.preventDefault();
|
|
234
|
-
if (!busy)
|
|
379
|
+
if (!busy) {
|
|
380
|
+
stopMutation.reset();
|
|
381
|
+
runMutation.mutate(collectRunParameters(module.parameters, draft));
|
|
382
|
+
}
|
|
235
383
|
},
|
|
236
384
|
children: [header, body]
|
|
237
385
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [header, body] });
|
|
@@ -242,7 +390,7 @@ function WorkspaceExecutionCardSession({ className, module, ref, ...props }) {
|
|
|
242
390
|
"aria-labelledby": ariaLabelledBy,
|
|
243
391
|
"data-slot": "workspace-execution-card",
|
|
244
392
|
size: "sm",
|
|
245
|
-
className: cx("connected-app-card", className),
|
|
393
|
+
className: cx("connected-app-card", "workspace-execution-card", className),
|
|
246
394
|
children: inner
|
|
247
395
|
});
|
|
248
396
|
}
|
|
@@ -257,54 +405,423 @@ function WorkspaceExecutionFile({ fallback = null, path, source, ...props }) {
|
|
|
257
405
|
module: executionWithSource(module, source)
|
|
258
406
|
}, JSON.stringify(source.queryOptions.queryKey));
|
|
259
407
|
}
|
|
408
|
+
function workspaceExecutionModules(entries, source) {
|
|
409
|
+
const modules = entries.map((module) => executionWithSource(module, source));
|
|
410
|
+
const { trace, onOpenBoard, onStop } = source;
|
|
411
|
+
if (source.tableExecution && !modules.some((module) => module.path === source.tableExecution?.invocation.path)) modules.unshift(executionWithSource({
|
|
412
|
+
path: source.tableExecution.invocation.path,
|
|
413
|
+
name: source.tableExecution.name,
|
|
414
|
+
parameters: []
|
|
415
|
+
}, source));
|
|
416
|
+
if (trace && !modules.some((module) => module.path === trace.path)) modules.unshift({
|
|
417
|
+
path: trace.path,
|
|
418
|
+
name: "Current workflow",
|
|
419
|
+
parameters: [],
|
|
420
|
+
trace,
|
|
421
|
+
onOpenBoard: onOpenBoard ? () => onOpenBoard(trace.path) : void 0,
|
|
422
|
+
onStop: onStop ? () => onStop(trace.executionId) : void 0
|
|
423
|
+
});
|
|
424
|
+
return modules;
|
|
425
|
+
}
|
|
426
|
+
function WorkspaceExecutionLibrary({ modules, error, isPending, onRetry }) {
|
|
427
|
+
if (modules.length > 0) return /* @__PURE__ */ jsx("ul", {
|
|
428
|
+
className: "sigvelo-stack-list sigvelo-stack",
|
|
429
|
+
children: modules.map((module) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(WorkspaceExecutionCard, { module }) }, module.path))
|
|
430
|
+
});
|
|
431
|
+
if (error) return /* @__PURE__ */ jsx(EmptyState, {
|
|
432
|
+
icon: /* @__PURE__ */ jsx(QueueIcon, {}),
|
|
433
|
+
title: "Workflows unavailable",
|
|
434
|
+
description: executionErrorSummary(formatErrorMessage(error)),
|
|
435
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
436
|
+
size: "sm",
|
|
437
|
+
variant: "outline",
|
|
438
|
+
color: "neutral",
|
|
439
|
+
onClick: onRetry,
|
|
440
|
+
children: "Retry"
|
|
441
|
+
})
|
|
442
|
+
});
|
|
443
|
+
if (isPending) return /* @__PURE__ */ jsx(EmptyState, {
|
|
444
|
+
icon: /* @__PURE__ */ jsx(SpinnerIcon, {}),
|
|
445
|
+
title: "Loading workflows"
|
|
446
|
+
});
|
|
447
|
+
return /* @__PURE__ */ jsx(EmptyState, {
|
|
448
|
+
icon: /* @__PURE__ */ jsx(QueueIcon, {}),
|
|
449
|
+
title: "No workflows",
|
|
450
|
+
description: "Ask your assistant to save a reusable workflow to find it here."
|
|
451
|
+
});
|
|
452
|
+
}
|
|
260
453
|
/**
|
|
261
|
-
*
|
|
262
|
-
*
|
|
454
|
+
* Route-owned script workbench: compact discovery cards or one selected board.
|
|
455
|
+
* A query failure with nothing loaded is an error, never an empty library.
|
|
263
456
|
*/
|
|
264
|
-
function WorkspaceExecutionsPanel({ className, source, ref, ...props }) {
|
|
457
|
+
function WorkspaceExecutionsPanel({ className, source, selectedPath, selectedTrace, selectedGraph, onBack, ref, ...props }) {
|
|
265
458
|
const query = useQuery(source.queryOptions);
|
|
266
|
-
const modules = query.data ?? [];
|
|
459
|
+
const modules = workspaceExecutionModules(query.data ?? [], source);
|
|
460
|
+
const savedModule = selectedTrace ? modules.find((module) => module.path === selectedTrace.path) : void 0;
|
|
461
|
+
const selected = selectedTrace ? {
|
|
462
|
+
...savedModule,
|
|
463
|
+
path: selectedTrace.path,
|
|
464
|
+
name: savedModule?.name ?? "Saved workflow run",
|
|
465
|
+
parameters: savedModule?.parameters ?? [],
|
|
466
|
+
tableExecution: void 0,
|
|
467
|
+
trace: selectedTrace,
|
|
468
|
+
onStop: void 0
|
|
469
|
+
} : modules.find((module) => module.path === selectedPath) ?? (selectedPath ? {
|
|
470
|
+
path: selectedPath,
|
|
471
|
+
name: "Workflow",
|
|
472
|
+
parameters: [],
|
|
473
|
+
graph: selectedGraph
|
|
474
|
+
} : void 0);
|
|
475
|
+
if (selected) return /* @__PURE__ */ createElement(WorkspaceExecutionWorkbench, {
|
|
476
|
+
...props,
|
|
477
|
+
ref,
|
|
478
|
+
key: `${JSON.stringify(source.queryOptions.queryKey)}:${selectedPath ?? selected.path}`,
|
|
479
|
+
className,
|
|
480
|
+
module: {
|
|
481
|
+
...selected,
|
|
482
|
+
graph: selectedGraph ?? selected.graph
|
|
483
|
+
},
|
|
484
|
+
onBack
|
|
485
|
+
});
|
|
267
486
|
return /* @__PURE__ */ jsx(WorkspaceConceptPanel, {
|
|
268
|
-
heading: "
|
|
487
|
+
heading: "Workflows",
|
|
269
488
|
ref,
|
|
270
489
|
"data-slot": "workspace-executions-panel",
|
|
271
490
|
className: cx("workspace-concept-panel", className),
|
|
272
491
|
...props,
|
|
273
|
-
"aria-label": props["aria-label"] ?? "
|
|
274
|
-
children:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
492
|
+
"aria-label": props["aria-label"] ?? "Workflows",
|
|
493
|
+
children: /* @__PURE__ */ jsx(WorkspaceExecutionLibrary, {
|
|
494
|
+
modules,
|
|
495
|
+
error: query.error,
|
|
496
|
+
isPending: query.isPending,
|
|
497
|
+
onRetry: () => void query.refetch()
|
|
498
|
+
})
|
|
499
|
+
}, JSON.stringify(source.queryOptions.queryKey));
|
|
500
|
+
}
|
|
501
|
+
function workbenchPlaceholder(module, graph, busy, errorMessage) {
|
|
502
|
+
const traceError = module.trace?.error ? executionErrorSummary(module.trace.error) : "";
|
|
503
|
+
if (errorMessage || traceError) return {
|
|
504
|
+
icon: InfoIcon,
|
|
505
|
+
title: "This run could not finish",
|
|
506
|
+
description: traceError || errorMessage
|
|
507
|
+
};
|
|
508
|
+
if (module.trace?.status === "aborted" || module.trace?.status === "interrupted") return {
|
|
509
|
+
icon: StopIcon,
|
|
510
|
+
title: module.trace.status === "aborted" ? "Run stopped" : "Run interrupted"
|
|
511
|
+
};
|
|
512
|
+
if (!graph && !module.onRun) return {
|
|
513
|
+
icon: SpinnerIcon,
|
|
514
|
+
title: "Loading workflow"
|
|
515
|
+
};
|
|
516
|
+
return busy ? {
|
|
517
|
+
icon: SpinnerIcon,
|
|
518
|
+
title: "Running workflow",
|
|
519
|
+
description: "Follow the run in Steps."
|
|
520
|
+
} : {
|
|
521
|
+
icon: PlayIcon,
|
|
522
|
+
title: "Ready when you are",
|
|
523
|
+
description: "Run this workflow to see its results here."
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
function WorkbenchResult({ module, graph, busy, completed, errorMessage }) {
|
|
527
|
+
if (completed) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("p", {
|
|
528
|
+
className: "workspace-execution-status",
|
|
529
|
+
children: [/* @__PURE__ */ jsx(CheckIcon, {}), busy ? "Previous result" : "Completed"]
|
|
530
|
+
}), /* @__PURE__ */ jsx(ExecutionResult, { result: completed.result })] });
|
|
531
|
+
const placeholder = workbenchPlaceholder(module, graph, busy, errorMessage);
|
|
532
|
+
const Icon = placeholder.icon;
|
|
533
|
+
return /* @__PURE__ */ jsx(EmptyState, {
|
|
534
|
+
icon: /* @__PURE__ */ jsx(Icon, {}),
|
|
535
|
+
title: placeholder.title,
|
|
536
|
+
description: placeholder.description
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
function WorkbenchRunAction({ module, tableMode, busy, stopping, onStop }) {
|
|
540
|
+
if (tableMode) return null;
|
|
541
|
+
if (module.trace?.status === "running" && module.onStop) return /* @__PURE__ */ jsxs(Button, {
|
|
542
|
+
type: "button",
|
|
543
|
+
"aria-label": "Stop run",
|
|
544
|
+
color: "neutral",
|
|
545
|
+
onClick: onStop,
|
|
546
|
+
disabled: stopping,
|
|
547
|
+
children: [stopping ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(StopIcon, {}), stopping ? "Stopping…" : "Stop"]
|
|
548
|
+
});
|
|
549
|
+
if (!module.onRun) return null;
|
|
550
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
551
|
+
type: "submit",
|
|
552
|
+
"aria-label": `Run now: ${module.name}`,
|
|
553
|
+
disabled: busy,
|
|
554
|
+
children: [busy ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(PlayIcon, {}), busy ? "Running…" : "Run"]
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
function WorkbenchActions({ module, tableMode, onToggleTable, busy, stopping, onStop }) {
|
|
558
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
559
|
+
className: "workspace-execution-workbench__actions",
|
|
560
|
+
role: "toolbar",
|
|
561
|
+
"aria-label": "Workflow controls",
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ jsx(WorkbenchRunAction, {
|
|
564
|
+
module,
|
|
565
|
+
tableMode,
|
|
566
|
+
busy,
|
|
567
|
+
stopping,
|
|
568
|
+
onStop
|
|
569
|
+
}),
|
|
570
|
+
module.onSchedule && !tableMode ? /* @__PURE__ */ jsxs(Button, {
|
|
571
|
+
type: "button",
|
|
572
|
+
"aria-label": `Schedule ${module.name}`,
|
|
283
573
|
variant: "outline",
|
|
284
574
|
color: "neutral",
|
|
285
|
-
onClick:
|
|
286
|
-
children: "
|
|
575
|
+
onClick: module.onSchedule,
|
|
576
|
+
children: [/* @__PURE__ */ jsx(CalendarIcon, {}), "Schedule"]
|
|
577
|
+
}) : null,
|
|
578
|
+
module.onRunTable ? /* @__PURE__ */ jsxs(Button, {
|
|
579
|
+
type: "button",
|
|
580
|
+
size: "sm",
|
|
581
|
+
variant: "ghost",
|
|
582
|
+
color: "neutral",
|
|
583
|
+
disabled: busy || module.tableExecution?.status === "running",
|
|
584
|
+
onClick: onToggleTable,
|
|
585
|
+
children: [/* @__PURE__ */ jsx(QueueIcon, {}), tableMode ? "Single run" : "Run on a table"]
|
|
586
|
+
}) : null
|
|
587
|
+
]
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
function WorkbenchHeader({ module, graph, onBack, tableMode, onToggleTable, busy, stopping, onStop, errorMessage }) {
|
|
591
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
592
|
+
className: "workspace-execution-workbench__header",
|
|
593
|
+
children: [
|
|
594
|
+
onBack ? /* @__PURE__ */ jsxs(Button, {
|
|
595
|
+
className: "workspace-execution-workbench__back",
|
|
596
|
+
type: "button",
|
|
597
|
+
size: "sm",
|
|
598
|
+
variant: "ghost",
|
|
599
|
+
color: "neutral",
|
|
600
|
+
"aria-label": "Back to workflows",
|
|
601
|
+
onClick: onBack,
|
|
602
|
+
children: [/* @__PURE__ */ jsx(ArrowLeftIcon, {}), "Workflows"]
|
|
603
|
+
}) : null,
|
|
604
|
+
/* @__PURE__ */ jsxs("div", {
|
|
605
|
+
className: "workspace-execution-workbench__heading",
|
|
606
|
+
children: [/* @__PURE__ */ jsx("h2", { children: module.name }), module.description ? /* @__PURE__ */ jsx(IconButton, {
|
|
607
|
+
label: `About ${module.name}`,
|
|
608
|
+
tooltip: module.description,
|
|
609
|
+
variant: "ghost",
|
|
610
|
+
color: "neutral",
|
|
611
|
+
children: /* @__PURE__ */ jsx(InfoIcon, {})
|
|
612
|
+
}) : null]
|
|
613
|
+
}),
|
|
614
|
+
/* @__PURE__ */ jsx(WorkflowApps, { graph }),
|
|
615
|
+
/* @__PURE__ */ jsx(WorkbenchActions, {
|
|
616
|
+
module,
|
|
617
|
+
tableMode,
|
|
618
|
+
onToggleTable,
|
|
619
|
+
busy,
|
|
620
|
+
stopping,
|
|
621
|
+
onStop
|
|
622
|
+
}),
|
|
623
|
+
!tableMode && errorMessage ? /* @__PURE__ */ jsx(Field.Errors, { errors: [errorMessage] }) : null,
|
|
624
|
+
/* @__PURE__ */ jsx("span", {
|
|
625
|
+
className: "sigvelo-visually-hidden",
|
|
626
|
+
role: "status",
|
|
627
|
+
"aria-atomic": "true",
|
|
628
|
+
children: busy && module.trace?.status !== "running" ? "Starting run" : ""
|
|
287
629
|
})
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
630
|
+
]
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
function WorkbenchSingleRun({ module, graph, draft, setDraft, tab, setTab, busy, completed, errorMessage, outcome }) {
|
|
634
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
635
|
+
className: "workspace-execution-workbench__content",
|
|
636
|
+
children: [module.parameters.length > 0 ? /* @__PURE__ */ jsx(RunOptions, {
|
|
637
|
+
initiallyOpen: missingRequiredInput(module.parameters, draft),
|
|
638
|
+
className: "workspace-execution-workbench__inputs",
|
|
639
|
+
children: /* @__PURE__ */ jsx(ExecutionFields, {
|
|
640
|
+
draft: module.onRun ? draft : void 0,
|
|
641
|
+
parameters: module.parameters,
|
|
642
|
+
onDraftChange: module.onRun ? (name, value) => setDraft((current) => ({
|
|
643
|
+
...current,
|
|
644
|
+
[name]: value
|
|
645
|
+
})) : void 0
|
|
646
|
+
})
|
|
647
|
+
}, executionFormKey(module)) : null, /* @__PURE__ */ jsxs(Tabs.Root, {
|
|
648
|
+
value: tab,
|
|
649
|
+
onValueChange: (value) => setTab(String(value)),
|
|
650
|
+
className: "workspace-execution-workbench__tabs",
|
|
651
|
+
children: [
|
|
652
|
+
/* @__PURE__ */ jsxs(Tabs.List, {
|
|
653
|
+
variant: "line",
|
|
654
|
+
"aria-label": "Workflow view",
|
|
655
|
+
className: "workspace-execution-workbench__tab-list",
|
|
656
|
+
children: [/* @__PURE__ */ jsxs(Tabs.Tab, {
|
|
657
|
+
value: "results",
|
|
658
|
+
className: "workspace-execution-workbench__tab",
|
|
659
|
+
children: [/* @__PURE__ */ jsx(FileIcon, {}), "Results"]
|
|
660
|
+
}), /* @__PURE__ */ jsxs(Tabs.Tab, {
|
|
661
|
+
value: "steps",
|
|
662
|
+
className: "workspace-execution-workbench__tab",
|
|
663
|
+
children: [/* @__PURE__ */ jsx(SplitIcon, {}), "Steps"]
|
|
664
|
+
})]
|
|
665
|
+
}),
|
|
666
|
+
/* @__PURE__ */ jsxs(Tabs.Panel, {
|
|
667
|
+
value: "results",
|
|
668
|
+
className: "workspace-execution-workbench__results",
|
|
669
|
+
children: [
|
|
670
|
+
/* @__PURE__ */ jsx(WorkbenchResult, {
|
|
671
|
+
module,
|
|
672
|
+
graph,
|
|
673
|
+
busy,
|
|
674
|
+
completed,
|
|
675
|
+
errorMessage
|
|
676
|
+
}),
|
|
677
|
+
outcome?.runs.length ? /* @__PURE__ */ jsx(RunLinks, { runs: outcome.runs }) : null,
|
|
678
|
+
module.runs?.length ? /* @__PURE__ */ jsxs("details", {
|
|
679
|
+
className: "workspace-execution-workbench__history",
|
|
680
|
+
children: [/* @__PURE__ */ jsx("summary", { children: "Saved runs" }), /* @__PURE__ */ jsx(RunLinks, { runs: module.runs })]
|
|
681
|
+
}) : null
|
|
682
|
+
]
|
|
683
|
+
}),
|
|
684
|
+
/* @__PURE__ */ jsx(Tabs.Panel, {
|
|
685
|
+
value: "steps",
|
|
686
|
+
className: "workspace-execution-workbench__steps",
|
|
687
|
+
children: graph ? /* @__PURE__ */ jsx(ExecutionBoard, {
|
|
688
|
+
"aria-label": "Steps",
|
|
689
|
+
className: "workspace-execution-workbench__board",
|
|
690
|
+
graph,
|
|
691
|
+
trace: module.trace,
|
|
692
|
+
showResults: false
|
|
693
|
+
}) : /* @__PURE__ */ jsx(EmptyState, {
|
|
694
|
+
icon: /* @__PURE__ */ jsx(SpinnerIcon, {}),
|
|
695
|
+
title: "Loading workflow steps"
|
|
696
|
+
})
|
|
697
|
+
})
|
|
698
|
+
]
|
|
699
|
+
})]
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
function useWorkbenchTabs(trace, runStatus, busy) {
|
|
703
|
+
const [tab, setTab] = React.useState(busy ? "steps" : "results");
|
|
704
|
+
const [seenRunStatus, setSeenRunStatus] = React.useState(runStatus);
|
|
705
|
+
if (runStatus !== seenRunStatus) {
|
|
706
|
+
setSeenRunStatus(runStatus);
|
|
707
|
+
if (runStatus === "pending") setTab("steps");
|
|
708
|
+
else if (seenRunStatus === "pending" && runStatus === "success") setTab("results");
|
|
709
|
+
}
|
|
710
|
+
const [seenTrace, setSeenTrace] = React.useState(() => ({
|
|
711
|
+
executionId: trace?.executionId,
|
|
712
|
+
status: trace?.status
|
|
713
|
+
}));
|
|
714
|
+
if (seenTrace.executionId !== trace?.executionId || seenTrace.status !== trace?.status) {
|
|
715
|
+
setSeenTrace({
|
|
716
|
+
executionId: trace?.executionId,
|
|
717
|
+
status: trace?.status
|
|
718
|
+
});
|
|
719
|
+
if (trace?.status === "running") setTab("steps");
|
|
720
|
+
else if (trace?.status === "completed" && (seenTrace.executionId !== trace.executionId || seenTrace.status === "running")) setTab("results");
|
|
721
|
+
}
|
|
722
|
+
return [tab, setTab];
|
|
723
|
+
}
|
|
724
|
+
function WorkspaceExecutionWorkbench({ module, onBack, className, ref, ...props }) {
|
|
725
|
+
const { draft, setDraft, runMutation, stopMutation, busy, errorMessage, outcome, runStatus } = useExecutionSession(module);
|
|
726
|
+
const graph = module.trace?.graph ?? module.graph;
|
|
727
|
+
const [tableMode, setTableMode] = React.useState(Boolean(module.tableExecution));
|
|
728
|
+
const [seenTablePath, setSeenTablePath] = React.useState(module.tableExecution?.path);
|
|
729
|
+
if (module.tableExecution?.path !== seenTablePath) {
|
|
730
|
+
setSeenTablePath(module.tableExecution?.path);
|
|
731
|
+
if (module.tableExecution) setTableMode(true);
|
|
732
|
+
}
|
|
733
|
+
const [tab, setTab] = useWorkbenchTabs(module.trace, runStatus, busy);
|
|
734
|
+
const completed = outcome ?? (module.trace?.status === "completed" ? module.trace : void 0);
|
|
735
|
+
const [lastCompleted, setLastCompleted] = React.useState(completed);
|
|
736
|
+
if (completed && completed !== lastCompleted) setLastCompleted(completed);
|
|
737
|
+
const visibleCompleted = busy ? lastCompleted : completed;
|
|
738
|
+
const tableValues = new Map(collectRunParameters(module.parameters, draft).map(({ name, value }) => [name, value]));
|
|
739
|
+
return /* @__PURE__ */ jsx("section", {
|
|
740
|
+
...props,
|
|
741
|
+
ref,
|
|
742
|
+
"aria-label": props["aria-label"] ?? "Workflows",
|
|
743
|
+
"data-slot": "workspace-executions-panel",
|
|
744
|
+
className: cx("workspace-execution-workbench", className),
|
|
745
|
+
children: /* @__PURE__ */ jsxs(Form, {
|
|
746
|
+
noValidate: true,
|
|
747
|
+
onSubmit: (event) => {
|
|
748
|
+
event.preventDefault();
|
|
749
|
+
if (!tableMode && !busy && module.onRun) {
|
|
750
|
+
stopMutation.reset();
|
|
751
|
+
setTab("steps");
|
|
752
|
+
runMutation.mutate(collectRunParameters(module.parameters, draft));
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
children: [/* @__PURE__ */ jsx(WorkbenchHeader, {
|
|
756
|
+
module,
|
|
757
|
+
graph,
|
|
758
|
+
onBack,
|
|
759
|
+
tableMode,
|
|
760
|
+
onToggleTable: () => setTableMode((current) => !current),
|
|
761
|
+
busy,
|
|
762
|
+
stopping: stopMutation.isPending,
|
|
763
|
+
onStop: () => stopMutation.mutate(),
|
|
764
|
+
errorMessage
|
|
765
|
+
}), tableMode ? /* @__PURE__ */ jsx(WorkspaceExecutionTable, {
|
|
766
|
+
path: module.path,
|
|
767
|
+
parameters: module.parameters.map((parameter) => ({
|
|
768
|
+
...parameter,
|
|
769
|
+
value: tableValues.get(parameter.name)
|
|
770
|
+
})),
|
|
771
|
+
execution: module.tableExecution,
|
|
772
|
+
trace: module.trace,
|
|
773
|
+
graph,
|
|
774
|
+
onLoadTable: module.onLoadTable,
|
|
775
|
+
onRequestTableSource: module.onRequestTableSource,
|
|
776
|
+
onPrepareTable: module.onPrepareTable,
|
|
777
|
+
onRunTable: module.onRunTable,
|
|
778
|
+
onStopTable: module.onStopTable,
|
|
779
|
+
onLoadTableTrace: module.onLoadTableTrace,
|
|
780
|
+
onScheduleTable: module.onScheduleTable
|
|
781
|
+
}) : /* @__PURE__ */ jsx(WorkbenchSingleRun, {
|
|
782
|
+
module,
|
|
783
|
+
graph,
|
|
784
|
+
draft,
|
|
785
|
+
setDraft,
|
|
786
|
+
tab,
|
|
787
|
+
setTab,
|
|
788
|
+
busy,
|
|
789
|
+
completed: visibleCompleted,
|
|
790
|
+
errorMessage,
|
|
791
|
+
outcome
|
|
792
|
+
})]
|
|
295
793
|
})
|
|
296
|
-
}
|
|
794
|
+
});
|
|
297
795
|
}
|
|
298
796
|
function executionWithSource(module, source) {
|
|
299
|
-
const { onDelete, onOpen, onRun } = source;
|
|
797
|
+
const { onDelete, onOpen, onOpenBoard, onRun, onSchedule, onStop, trace } = source;
|
|
798
|
+
const moduleTrace = trace?.path === module.path ? trace : void 0;
|
|
300
799
|
const withOpen = (run) => ({
|
|
301
800
|
...run,
|
|
302
801
|
onOpen: onOpen ? () => onOpen(run.path) : void 0
|
|
303
802
|
});
|
|
304
803
|
return {
|
|
305
804
|
...module,
|
|
805
|
+
tableExecution: source.tableExecution?.invocation.path === module.path ? source.tableExecution : void 0,
|
|
806
|
+
onLoadTable: source.onLoadTable,
|
|
807
|
+
onRequestTableSource: source.onRequestTableSource,
|
|
808
|
+
onPrepareTable: source.onPrepareTable,
|
|
809
|
+
onRunTable: source.onRunTable,
|
|
810
|
+
onStopTable: source.onStopTable,
|
|
811
|
+
onLoadTableTrace: source.onLoadTableTrace,
|
|
812
|
+
onScheduleTable: source.onScheduleTable,
|
|
813
|
+
mutationKey: [
|
|
814
|
+
...source.queryOptions.queryKey,
|
|
815
|
+
"run",
|
|
816
|
+
module.path
|
|
817
|
+
],
|
|
818
|
+
trace: moduleTrace,
|
|
819
|
+
onStop: onStop && moduleTrace ? () => onStop(moduleTrace.executionId) : void 0,
|
|
820
|
+
onOpenBoard: onOpenBoard ? () => onOpenBoard(module.path) : void 0,
|
|
821
|
+
onSchedule: onSchedule ? () => onSchedule(module.path) : void 0,
|
|
306
822
|
runs: module.runs?.map(withOpen),
|
|
307
823
|
onRun: onRun ? async (parameters) => {
|
|
824
|
+
onOpenBoard?.(module.path);
|
|
308
825
|
const outcome = await onRun(module.path, parameters);
|
|
309
826
|
return {
|
|
310
827
|
...outcome,
|