@mcp-b/react-components 0.57.1 → 0.58.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.
Files changed (176) hide show
  1. package/dist/Card-BPkXIkBz.d.ts +46 -0
  2. package/dist/{CodeBlock-Bl-q7wMc.js → CodeBlock-Bs_Z03eC.js} +2 -1
  3. package/dist/{CodeBlock-CPotpyyM.d.ts → CodeBlock-DYp5V_4O.d.ts} +1 -1
  4. package/dist/{EmployeeChrome-CN99SVfF.d.ts → EmployeeChrome-DsdIek0l.d.ts} +2 -10
  5. package/dist/ExecutionBoard-DHfMvKlB.d.ts +64 -0
  6. package/dist/ExecutionResult-BSZsUbrL.js +279 -0
  7. package/dist/{FileTree-CfOhUyp3.js → FileTree-DyLBn7O_.js} +1 -1
  8. package/dist/{ManagerOffice-CMJ7laGe.js → ManagerOffice-C8AQcaXs.js} +5 -20
  9. package/dist/{McpConnectorForm-BPWCo9bU.d.ts → McpConnectorForm-D4bY-lm_.d.ts} +1 -1
  10. package/dist/{McpPluginCatalog-uSh0gGeY.d.ts → McpPluginCatalog-2FZDLCeK.d.ts} +2 -2
  11. package/dist/{SetupChecklist-BiWQkKEq.js → SetupChecklist-CKQ-mKYt.js} +2 -2
  12. package/dist/{ThinkRoutine-DGlKJbIy.d.ts → ThinkRoutine-DoZjbzyn.d.ts} +15 -3
  13. package/dist/{Workspace-Cr-aGDfx.d.ts → Workspace-iCkXvQRJ.d.ts} +1 -1
  14. package/dist/WorkspaceConcept-ByaG-kBq.d.ts +38 -0
  15. package/dist/WorkspaceExecutionTable-DNhj6YDX.d.ts +239 -0
  16. package/dist/{WorkspaceFile-DiwiJEwO.d.ts → WorkspaceFile-DkIZKoK6.d.ts} +1 -1
  17. package/dist/{WorkspaceFileView-CCe_o79q.js → WorkspaceFileView-M2jC2P4p.js} +217 -139
  18. package/dist/components/agents-sdk/AgentActivity.js +1 -1
  19. package/dist/components/agents-sdk/AgentChat.js +10 -10
  20. package/dist/components/agents-sdk/BrowserLiveScreen.js +1 -1
  21. package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
  22. package/dist/components/agents-sdk/BrowserReplay.js +1 -1
  23. package/dist/components/agents-sdk/BrowserRunPanel.js +1 -1
  24. package/dist/components/agents-sdk/EmployeeApp.d.ts +1 -1
  25. package/dist/components/agents-sdk/EmployeeApp.js +3 -7
  26. package/dist/components/agents-sdk/EmployeeChat.js +4 -4
  27. package/dist/components/agents-sdk/EmployeeChrome.d.ts +1 -1
  28. package/dist/components/agents-sdk/EmployeeChrome.js +78 -63
  29. package/dist/components/agents-sdk/EmployeeSchedules.d.ts +6 -3
  30. package/dist/components/agents-sdk/EmployeeSchedules.js +12 -10
  31. package/dist/components/agents-sdk/EmployeeStartScreen.d.ts +2 -2
  32. package/dist/components/agents-sdk/EmployeeStartScreen.js +3 -3
  33. package/dist/components/agents-sdk/ExecutionBoard.d.ts +2 -0
  34. package/dist/components/agents-sdk/ExecutionBoard.js +648 -0
  35. package/dist/components/agents-sdk/ManagerAccountActions.js +2 -2
  36. package/dist/components/agents-sdk/ManagerOffice.d.ts +1 -1
  37. package/dist/components/agents-sdk/ManagerOffice.js +1 -1
  38. package/dist/components/agents-sdk/ManagerOfficeScreens.d.ts +1 -1
  39. package/dist/components/agents-sdk/ManagerOfficeScreens.js +4 -3
  40. package/dist/components/agents-sdk/McpConnectionRequest.d.ts +1 -1
  41. package/dist/components/agents-sdk/McpConnectionRequest.js +2 -2
  42. package/dist/components/agents-sdk/McpConnectorForm.d.ts +1 -1
  43. package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
  44. package/dist/components/agents-sdk/McpPluginCatalog.d.ts +1 -1
  45. package/dist/components/agents-sdk/McpPluginCatalog.js +17 -8
  46. package/dist/components/agents-sdk/McpServerIcon.d.ts +1 -1
  47. package/dist/components/agents-sdk/McpServerPicker.d.ts +2 -2
  48. package/dist/components/agents-sdk/McpServerPicker.js +2 -2
  49. package/dist/components/agents-sdk/ModelEndpointDialog.js +1 -1
  50. package/dist/components/agents-sdk/ModelSelector.js +4 -4
  51. package/dist/components/agents-sdk/PromptInputApproval.js +1 -1
  52. package/dist/components/agents-sdk/PromptInputCommands.js +1 -1
  53. package/dist/components/agents-sdk/SubagentRunIndicator.js +1 -1
  54. package/dist/components/agents-sdk/SubagentRunPanel.js +2 -2
  55. package/dist/components/agents-sdk/SubagentRunSelector.js +1 -1
  56. package/dist/components/agents-sdk/ThinkChatActivity.js +2 -2
  57. package/dist/components/agents-sdk/ThinkChatToolPanels.js +238 -209
  58. package/dist/components/agents-sdk/ThinkExecutionDetail.js +14 -35
  59. package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
  60. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +3 -3
  61. package/dist/components/agents-sdk/ThinkRecoveryNotice.js +1 -1
  62. package/dist/components/agents-sdk/ThinkRoutine.d.ts +2 -2
  63. package/dist/components/agents-sdk/ThinkRoutineActions.d.ts +2 -2
  64. package/dist/components/agents-sdk/ThinkRoutineActions.js +25 -15
  65. package/dist/components/agents-sdk/ThinkRoutineBrowser.d.ts +1 -1
  66. package/dist/components/agents-sdk/ThinkRoutineBrowser.js +2 -2
  67. package/dist/components/agents-sdk/ThinkRoutineDetail.d.ts +5 -2
  68. package/dist/components/agents-sdk/ThinkRoutineDetail.js +13 -7
  69. package/dist/components/agents-sdk/ThinkRoutineForm.d.ts +23 -6
  70. package/dist/components/agents-sdk/ThinkRoutineForm.js +521 -214
  71. package/dist/components/agents-sdk/ThinkRoutineRuns.js +1 -1
  72. package/dist/components/agents-sdk/ThinkThreadPicker.js +2 -2
  73. package/dist/components/agents-sdk/TypeSafeConnectionDialog.d.ts +10 -0
  74. package/dist/components/agents-sdk/TypeSafeConnectionDialog.js +34 -0
  75. package/dist/components/agents-sdk/WorkbenchBack.js +1 -1
  76. package/dist/components/agents-sdk/Workspace.d.ts +1 -1
  77. package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
  78. package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
  79. package/dist/components/agents-sdk/WorkspaceConcept.d.ts +2 -37
  80. package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +2 -2
  81. package/dist/components/agents-sdk/WorkspaceCorrespondence.js +7 -6
  82. package/dist/components/agents-sdk/WorkspaceExecution.d.ts +2 -92
  83. package/dist/components/agents-sdk/WorkspaceExecution.js +650 -133
  84. package/dist/components/agents-sdk/WorkspaceExecutionTable.d.ts +2 -0
  85. package/dist/components/agents-sdk/WorkspaceExecutionTable.js +824 -0
  86. package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +3 -1
  87. package/dist/components/agents-sdk/WorkspaceExplorer.js +4 -3
  88. package/dist/components/agents-sdk/WorkspaceFile.d.ts +1 -1
  89. package/dist/components/agents-sdk/WorkspaceFileView.d.ts +4 -2
  90. package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
  91. package/dist/components/agents-sdk/WorkspaceHeader.js +1 -1
  92. package/dist/components/agents-sdk/WorkspaceLive.d.ts +2 -2
  93. package/dist/components/agents-sdk/WorkspaceMountManager.js +1 -1
  94. package/dist/components/agents-sdk/WorkspaceProject.d.ts +2 -2
  95. package/dist/components/agents-sdk/WorkspaceProject.js +6 -5
  96. package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +1 -1
  97. package/dist/components/agents-sdk/WorkspaceUserScript.js +5 -4
  98. package/dist/components/ai-sdk/Activity.js +1 -1
  99. package/dist/components/ai-sdk/AgentChatStartScreen.js +1 -1
  100. package/dist/components/ai-sdk/Approval.js +2 -2
  101. package/dist/components/ai-sdk/Artifact.js +1 -1
  102. package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
  103. package/dist/components/ai-sdk/ChainOfThought.js +1 -1
  104. package/dist/components/ai-sdk/Checkpoint.js +1 -1
  105. package/dist/components/ai-sdk/CodeBlock.d.ts +1 -1
  106. package/dist/components/ai-sdk/CodeBlock.js +1 -1
  107. package/dist/components/ai-sdk/ComposerLink.js +1 -1
  108. package/dist/components/ai-sdk/ConnectedAppCards.d.ts +1 -1
  109. package/dist/components/ai-sdk/ConnectedAppCards.js +3 -3
  110. package/dist/components/ai-sdk/Context.js +1 -1
  111. package/dist/components/ai-sdk/Conversation.js +1 -1
  112. package/dist/components/ai-sdk/Goal.js +1 -1
  113. package/dist/components/ai-sdk/MediaPreviewCard.d.ts +1 -1
  114. package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
  115. package/dist/components/ai-sdk/Message.js +2 -2
  116. package/dist/components/ai-sdk/MessageScroller.js +1 -1
  117. package/dist/components/ai-sdk/MessageScrollerVirtual.js +1 -1
  118. package/dist/components/ai-sdk/Plan.js +1 -1
  119. package/dist/components/ai-sdk/PromptInput.js +6 -6
  120. package/dist/components/ai-sdk/Queue.js +1 -1
  121. package/dist/components/ai-sdk/Reasoning.js +1 -1
  122. package/dist/components/ai-sdk/Sources.js +1 -1
  123. package/dist/components/ai-sdk/Task.js +1 -1
  124. package/dist/components/extension/ChatGptSignInScreen.js +2 -2
  125. package/dist/components/extension/CodexModelSelector.js +2 -2
  126. package/dist/components/extension/ConversationTabPicker.js +2 -2
  127. package/dist/components/foundations/Card.d.ts +2 -45
  128. package/dist/components/foundations/Checkbox.js +1 -1
  129. package/dist/components/foundations/Collapsible.js +1 -1
  130. package/dist/components/foundations/ContextMenu.js +1 -1
  131. package/dist/components/foundations/Menubar.js +1 -1
  132. package/dist/components/foundations/SearchField.js +1 -1
  133. package/dist/components/foundations/Select.js +1 -1
  134. package/dist/components/foundations/Stepper.js +1 -1
  135. package/dist/components/foundations/Toast.js +1 -1
  136. package/dist/components/foundations/icons.d.ts +2 -2
  137. package/dist/components/foundations/icons.js +2 -2
  138. package/dist/components/general-purpose/AccountSignInDialog.js +1 -1
  139. package/dist/components/general-purpose/Commit.js +2 -2
  140. package/dist/components/general-purpose/EnvironmentVariables.js +2 -2
  141. package/dist/components/general-purpose/FileTree.js +1 -1
  142. package/dist/components/general-purpose/PricingPlanCard.js +2 -2
  143. package/dist/components/general-purpose/PricingUsageCalculator.js +2 -2
  144. package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
  145. package/dist/components/general-purpose/SettingsFormDialog.js +2 -2
  146. package/dist/components/general-purpose/SetupChecklist.js +1 -1
  147. package/dist/components/general-purpose/Terminal.js +2 -2
  148. package/dist/components/general-purpose/TestResults.js +1 -1
  149. package/dist/components/general-purpose/ThemeModeControl.js +1 -1
  150. package/dist/components/general-purpose/WebPreview.js +2 -2
  151. package/dist/components/nanites/AgentConnection.js +2 -2
  152. package/dist/components/nanites/AgentToolDetail.js +1 -1
  153. package/dist/{copy-button-CSDuDfdP.js → copy-button-M4sAp9xS.js} +1 -1
  154. package/dist/execution-result-DWVmm-bL.js +80 -0
  155. package/dist/{icons-CUuD7iEh.d.ts → icons-Dj6id76o.d.ts} +2 -1
  156. package/dist/{icons-cuEtsgj9.js → icons-DvlrWt54.js} +4 -3
  157. package/dist/{mcp-server-catalog-DgA9BnL0.d.ts → mcp-server-catalog-kaMWaSAL.d.ts} +3 -1
  158. package/dist/styles/app-top-bar.css +2 -1
  159. package/dist/styles/base.css +1 -0
  160. package/dist/styles/chatgpt-sign-in-screen.css +8 -14
  161. package/dist/styles/description-list.css +12 -9
  162. package/dist/styles/execution-board.css +383 -0
  163. package/dist/styles/index.css +3 -0
  164. package/dist/styles/mcp-plugin-catalog.css +8 -7
  165. package/dist/styles/message-scroller.css +8 -0
  166. package/dist/styles/think-chat-tool-panels.css +1 -2
  167. package/dist/styles/think-execution-workbench.css +1 -12
  168. package/dist/styles/think-routine.css +39 -41
  169. package/dist/styles/workspace-concepts.css +441 -17
  170. package/dist/styles/workspace-explorer.css +18 -4
  171. package/dist/utils/mcp-server-catalog.d.ts +2 -2
  172. package/dist/utils/mcp-server-catalog.js +18 -1
  173. package/dist/utils/structured-code.d.ts +1 -1
  174. package/dist/{workspace-assets-Bg7XhPsk.js → workspace-assets-DVn0d-fN.js} +24 -81
  175. package/dist/workspace-delete-DfloiBWp.js +80 -0
  176. 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, Z as TerminalIcon, d as CheckIcon, z as PlayIcon } from "../../icons-cuEtsgj9.js";
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";
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
+ import { DescriptionList } from "../foundations/DescriptionList.js";
8
11
  import { Input } from "../foundations/Input.js";
9
12
  import { EmptyState } from "../foundations/EmptyState.js";
10
- import { DescriptionList } from "../foundations/DescriptionList.js";
11
- import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from "../foundations/Card.js";
13
+ import { i as executionResultSummary, t as executionErrorSummary } from "../../execution-result-DWVmm-bL.js";
14
+ import { a as httpUrl, i as WorkspaceComposerLink, n as Hint, t as FaviconMark } from "../../workspace-assets-DVn0d-fN.js";
15
+ import { t as ExecutionResult } from "../../ExecutionResult-BSZsUbrL.js";
16
+ import { ExecutionBoard } from "./ExecutionBoard.js";
12
17
  import { Checkbox } from "../foundations/Checkbox.js";
13
- import { i as WorkspaceDeleteControl, n as WorkspaceComposerLink, r as httpUrl, t as FaviconMark } from "../../workspace-assets-Bg7XhPsk.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(TerminalIcon, {});
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 RunDetails({ outcome, runs }) {
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 && runItems.length === 0 && outcome === void 0) return null;
97
- return /* @__PURE__ */ jsxs(DescriptionList.Root, {
123
+ if (visibleParameters.length === 0) return null;
124
+ return /* @__PURE__ */ jsx(DescriptionList.Root, {
98
125
  align: "start",
99
126
  variant: "divided",
100
- children: [visibleParameters.map((parameter) => {
127
+ children: visibleParameters.map((parameter) => {
101
128
  const id = `${fieldId}-${parameter.name}`;
102
- const parameterLabel = editing && parameter.required ? `${parameter.label} (required)` : parameter.label;
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
- id: parameter.type === "boolean" ? id : void 0,
106
- children: [href && !editing ? /* @__PURE__ */ jsx(FaviconMark, { href }) : null, editing && parameter.type !== "boolean" ? /* @__PURE__ */ jsx("label", {
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
- }) : parameterLabel]
110
- }), /* @__PURE__ */ jsx(DescriptionList.Details, { children: editing && parameter.type === "boolean" ? /* @__PURE__ */ jsx(Checkbox.Root, {
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) })] }, parameter.name);
127
- }), /* @__PURE__ */ jsx(RunDetails, {
128
- outcome,
129
- runs: runItems
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: "sigvelo-cluster",
176
+ className: "workspace-execution-card__actions",
137
177
  children: [
138
- module.onRun ? /* @__PURE__ */ jsx(IconButton, {
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.onOpen ? /* @__PURE__ */ jsx(IconButton, {
148
- label: `Open ${module.name}`,
149
- tooltip: module.path,
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
- onClick: module.onOpen,
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 [draft, setDraft] = React.useState(() => draftFrom(module.parameters));
178
- const formKey = executionFormKey(module);
179
- const [seenFormKey, setSeenFormKey] = React.useState(formKey);
180
- if (formKey !== seenFormKey) {
181
- setSeenFormKey(formKey);
182
- setDraft(draftFrom(module.parameters));
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]
204
- }),
205
- module.description ? /* @__PURE__ */ jsx(CardDescription, { children: module.description }) : null,
206
- /* @__PURE__ */ jsx(ExecutionActions, {
207
- busy,
208
- module
209
- })
210
- ] });
211
- const body = hasBody ? /* @__PURE__ */ jsxs(CardContent, { children: [
212
- /* @__PURE__ */ jsx(ExecutionFields, {
213
- draft: editing ? draft : void 0,
214
- outcome: runMutation.isSuccess ? runMutation.data : void 0,
215
- parameters: module.parameters,
216
- runs: module.runs,
217
- onDraftChange: editing ? (name, value) => setDraft((current) => ({
218
- ...current,
219
- [name]: value
220
- })) : void 0
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
221
354
  }),
222
- errorMessage ? /* @__PURE__ */ jsx(Field.Errors, { errors: [errorMessage] }) : null,
223
- /* @__PURE__ */ jsx("span", {
224
- className: "sigvelo-visually-hidden",
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) runMutation.mutate();
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
- * Workbench library. Same card as the inline placement. A query failure with
262
- * nothing loaded renders as a quiet inline error, never as an empty library.
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: "Executions",
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"] ?? "Executions",
274
- children: modules.length > 0 ? /* @__PURE__ */ jsx("ul", {
275
- className: "sigvelo-stack-list sigvelo-stack",
276
- children: modules.map((module) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(WorkspaceExecutionCard, { module: executionWithSource(module, source) }) }, module.path))
277
- }) : query.error ? /* @__PURE__ */ jsx(EmptyState, {
278
- icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
279
- title: "Executions unavailable",
280
- description: formatErrorMessage(query.error),
281
- children: /* @__PURE__ */ jsx(Button, {
282
- size: "sm",
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: () => void query.refetch(),
286
- children: "Retry"
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
- }) : query.isPending ? /* @__PURE__ */ jsx(EmptyState, {
289
- icon: /* @__PURE__ */ jsx(SpinnerIcon, {}),
290
- title: "Loading modules"
291
- }) : /* @__PURE__ */ jsx(EmptyState, {
292
- icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
293
- title: "No modules",
294
- description: "Ask your assistant to save a reusable workflow to find it here."
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
- }, JSON.stringify(source.queryOptions.queryKey));
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,