@mcp-b/react-components 0.7.1 → 0.9.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.
Files changed (62) hide show
  1. package/dist/{AgentChat-403mckDG.d.ts → AgentChat-B9LD_WF1.d.ts} +67 -2
  2. package/dist/{CodeBlock-D9koxDA7.js → CodeBlock-XNQOupQ3.js} +1 -1
  3. package/dist/{FileTree-BdK93Uuu.js → FileTree-wMyZhhHO.js} +1 -1
  4. package/dist/{ModelSelector-MQvK-pNb.js → ModelSelector-9G_-GooI.js} +1 -1
  5. package/dist/{ThinkChatActivity-CeHzk6-K.d.ts → ThinkChatActivity-B2UD95My.d.ts} +1 -1
  6. package/dist/{ThinkChatContext-CC94HL4u.d.ts → ThinkChatContext-BLAAb8J5.d.ts} +1 -1
  7. package/dist/components/Activity.js +1 -1
  8. package/dist/components/AgentChat.d.ts +1 -1
  9. package/dist/components/AgentChat.js +107 -8
  10. package/dist/components/AgentConnection.js +2 -2
  11. package/dist/components/Artifact.js +1 -1
  12. package/dist/components/BrowserLiveView.js +1 -1
  13. package/dist/components/BrowserReplay.js +1 -1
  14. package/dist/components/ChainOfThought.d.ts +1 -1
  15. package/dist/components/ChainOfThought.js +1 -1
  16. package/dist/components/ChatGptSignInScreen.js +2 -2
  17. package/dist/components/CodeBlock.js +1 -1
  18. package/dist/components/Commit.js +1 -1
  19. package/dist/components/ContextMenu.js +1 -1
  20. package/dist/components/Conversation.js +1 -1
  21. package/dist/components/Dialog.js +1 -1
  22. package/dist/components/EnvironmentVariables.js +1 -1
  23. package/dist/components/FileTree.js +1 -1
  24. package/dist/components/McpServerPicker.js +7 -5
  25. package/dist/components/Menubar.js +1 -1
  26. package/dist/components/Message.js +1 -1
  27. package/dist/components/MessageScroller.js +1 -1
  28. package/dist/components/ModelSelector.js +1 -1
  29. package/dist/components/NavigationMenu.js +1 -1
  30. package/dist/components/PromptInput.js +6 -5
  31. package/dist/components/Queue.js +1 -1
  32. package/dist/components/Reasoning.js +1 -1
  33. package/dist/components/Select.js +1 -1
  34. package/dist/components/Sources.js +1 -1
  35. package/dist/components/Stepper.js +1 -1
  36. package/dist/components/Task.js +1 -1
  37. package/dist/components/Terminal.js +4 -3
  38. package/dist/components/TestResults.js +1 -1
  39. package/dist/components/ThinkChat.d.ts +8 -10
  40. package/dist/components/ThinkChatActivity.d.ts +1 -1
  41. package/dist/components/ThinkChatActivity.js +4 -3
  42. package/dist/components/ThinkChatContext.d.ts +1 -1
  43. package/dist/components/ThinkChatToolPanels.js +1 -1
  44. package/dist/components/ThinkChatToolParts.js +4 -4
  45. package/dist/components/ThinkExecutionWorkbench.d.ts +27 -0
  46. package/dist/components/ThinkExecutionWorkbench.js +450 -0
  47. package/dist/components/ThinkFullApp.d.ts +63 -9
  48. package/dist/components/ThinkFullApp.js +171 -73
  49. package/dist/components/ThinkThreadPicker.d.ts +88 -0
  50. package/dist/components/ThinkThreadPicker.js +282 -0
  51. package/dist/components/WebPreview.js +1 -1
  52. package/dist/components/WorkspaceExplorer.js +5 -4
  53. package/dist/components/icons.d.ts +2 -2
  54. package/dist/components/icons.js +2 -2
  55. package/dist/{copy-button-TVhDAroI.js → copy-button-C6JSKtFE.js} +1 -1
  56. package/dist/{icons-BRI54ATJ.d.ts → icons-CbjtbIJK.d.ts} +2 -1
  57. package/dist/{icons-BAlTbWWP.js → icons-D2Q5n5C1.js} +11 -1
  58. package/dist/styles/index.css +1 -0
  59. package/dist/styles/think-full-app.css +439 -26
  60. package/dist/styles/think-thread-picker.css +449 -0
  61. package/dist/utils/mcp-server-catalog.d.ts +5 -2
  62. package/package.json +7 -8
@@ -1,8 +1,8 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { I as XIcon, N as TerminalIcon } from "../icons-BAlTbWWP.js";
2
+ import { L as XIcon, P as TerminalIcon } from "../icons-D2Q5n5C1.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
5
- import { t as CopyButton } from "../copy-button-TVhDAroI.js";
5
+ import { t as CopyButton } from "../copy-button-C6JSKtFE.js";
6
6
  import { Badge } from "./Badge.js";
7
7
  import { ScrollArea } from "./ScrollArea.js";
8
8
  import * as React from "react";
@@ -165,7 +165,8 @@ function TerminalContent({ className, ref, ...props }) {
165
165
  ]);
166
166
  const handleScroll = (e) => {
167
167
  const target = e.currentTarget;
168
- setStickToBottom(target.scrollHeight - target.scrollTop - target.clientHeight < 8);
168
+ const atBottom = target.scrollHeight - target.scrollTop - target.clientHeight < 8;
169
+ setStickToBottom(atBottom);
169
170
  };
170
171
  return /* @__PURE__ */ jsxs(ScrollArea.Root, {
171
172
  ref,
@@ -1,6 +1,6 @@
1
1
  import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
2
2
  import { t as cx } from "../class-names-9UtZwb0J.js";
3
- import { I as XIcon, a as CheckIcon, c as ChevronRightIcon, j as SpinnerIcon } from "../icons-BAlTbWWP.js";
3
+ import { L as XIcon, M as SpinnerIcon, a as CheckIcon, c as ChevronRightIcon } from "../icons-D2Q5n5C1.js";
4
4
  import { Badge } from "./Badge.js";
5
5
  import * as React from "react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,24 +1,22 @@
1
1
  import { n as ExecutionApprovals } from "../PromptInput-D6-G24p7.js";
2
- import { a as AgentChatRenderPartContext, r as AgentChatProps } from "../AgentChat-403mckDG.js";
2
+ import { a as AgentChatRenderPartContext, r as AgentChatProps } from "../AgentChat-B9LD_WF1.js";
3
3
  import { n as BrowserLiveViewProps, t as BrowserLiveView } from "../BrowserLiveView-ZktFZiMD.js";
4
4
  import { n as BrowserReplayProps, t as BrowserReplay } from "../BrowserReplay-6G-mnwcn.js";
5
5
  import { _ as isThinkChatActivityPart } from "../ThinkChatToolParts-DnUiZgCC.js";
6
- import { a as ThinkChatToolRenderers, c as renderThinkChatActivityPart, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as describeThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-CeHzk6-K.js";
7
- import { n as ThinkChatValue } from "../ThinkChatContext-CC94HL4u.js";
6
+ import { a as ThinkChatToolRenderers, c as renderThinkChatActivityPart, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as describeThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-B2UD95My.js";
7
+ import { n as ThinkChatValue } from "../ThinkChatContext-BLAAb8J5.js";
8
8
  import { FileInfo, UseWorkspaceOptions, WorkspaceExplorer, WorkspaceExplorerProps, WorkspaceFileState, WorkspaceInfo, WorkspaceSource, WorkspaceState, inferWorkspaceLanguage, useWorkspace } from "./WorkspaceExplorer.js";
9
9
  import * as React from "react";
10
10
  import { UIMessage } from "ai";
11
11
  import { UseAgentOptions } from "agents/react";
12
- import { PendingApproval } from "@cloudflare/think";
12
+ import { PendingApproval, Think } from "@cloudflare/think";
13
+ import { AgentStub } from "agents/client";
13
14
 
14
15
  //#region src/components/ThinkChat.d.ts
15
- interface ThinkApprovalStub {
16
- pendingApprovals(executionId?: string): Promise<PendingApproval[]>;
17
- approveExecution(executionId: string): Promise<unknown>;
18
- rejectExecution(executionId: string, reason?: string): Promise<unknown>;
19
- }
16
+ type ThinkAgent<State> = Think<object, State>;
17
+ type ThinkApprovalStub<State = unknown> = AgentStub<ThinkAgent<State>>;
20
18
  interface ThinkChatProviderProps {
21
- /** The `useAgentChat` value from the `agents` SDK that descendants read. */
19
+ /** The `useAgentChat` value from `@cloudflare/think/react` that descendants read. */
22
20
  chat: ThinkChatValue;
23
21
  children: React.ReactNode;
24
22
  }
@@ -1,3 +1,3 @@
1
1
  import { _ as isThinkChatActivityPart } from "../ThinkChatToolParts-DnUiZgCC.js";
2
- import { a as ThinkChatToolRenderers, c as renderThinkChatActivityPart, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as describeThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-CeHzk6-K.js";
2
+ import { a as ThinkChatToolRenderers, c as renderThinkChatActivityPart, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as describeThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-B2UD95My.js";
3
3
  export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, describeThinkChatActivityPart, isThinkChatActivityPart, renderThinkChatActivityPart };
@@ -1,10 +1,11 @@
1
- import { A as SearchIcon, C as MonitorIcon, E as PencilIcon, F as WrenchIcon, N as TerminalIcon, P as WarningIcon, b as LinkIcon, h as FileIcon, y as InfoIcon } from "../icons-BAlTbWWP.js";
1
+ import { A as SearchIcon, C as MonitorIcon, E as PencilIcon, F as WarningIcon, I as WrenchIcon, P as TerminalIcon, b as LinkIcon, h as FileIcon, y as InfoIcon } from "../icons-D2Q5n5C1.js";
2
2
  import { Activity, ActivityContent, ActivityItem, ActivityItemGroup, ActivityText, ActivityTrigger } from "./Activity.js";
3
3
  import { ThinkChatContext } from "./ThinkChatContext.js";
4
4
  import { displayUrl, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSkillToolPart, isThinkChatActivityPart, isWorkspaceToolPart } from "./ThinkChatToolParts.js";
5
5
  import { ThinkChatBrowserPanel, ThinkChatExecutePanel, ThinkChatFetchPanel, ThinkChatSkillPanel, ThinkChatWorkspacePanel } from "./ThinkChatToolPanels.js";
6
6
  import * as React from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { getToolInput, getToolOutput } from "@cloudflare/think/react";
8
9
  import { getToolName, isReasoningUIPart, isToolUIPart } from "ai";
9
10
  //#region src/components/ThinkChatActivity.tsx
10
11
  function summarizeToolInput(input) {
@@ -114,13 +115,13 @@ function genericToolLabels(name, hasUrl) {
114
115
  function describeGenericToolPart(part) {
115
116
  const labels = genericToolLabels(getToolName(part), activityPartUrl(part) !== null);
116
117
  const label = isPartFailed(part) ? labels.failed : isPartWorking(part) ? labels.working : labels.done;
117
- const detail = summarizeToolInput(part.input);
118
+ const detail = summarizeToolInput(getToolInput(part));
118
119
  return detail ? `${label} · ${detail}` : label;
119
120
  }
120
121
  function activityPartUrl(part) {
121
122
  if (isFetchToolPart(part)) return firstHttpUrl(part.input?.url ?? part.input?.path);
122
123
  if (isBrowserToolPart(part) && part.type !== "tool-browser_execute") return firstHttpUrl(part.input?.url);
123
- if (isToolUIPart(part) && !isExecuteToolPart(part)) return firstHttpUrl(part.input) ?? (part.state === "output-available" ? firstHttpUrl(part.output) : null);
124
+ if (isToolUIPart(part) && !isExecuteToolPart(part)) return firstHttpUrl(getToolInput(part)) ?? (part.state === "output-available" ? firstHttpUrl(getToolOutput(part)) : null);
124
125
  return null;
125
126
  }
126
127
  function activityPartIconKind(part) {
@@ -1,2 +1,2 @@
1
- import { n as ThinkChatValue, r as useThinkChatContext, t as ThinkChatContext } from "../ThinkChatContext-CC94HL4u.js";
1
+ import { n as ThinkChatValue, r as useThinkChatContext, t as ThinkChatContext } from "../ThinkChatContext-BLAAb8J5.js";
2
2
  export { ThinkChatContext, ThinkChatValue, useThinkChatContext };
@@ -1,6 +1,6 @@
1
1
  import { ActivityOutput, ActivityPanel } from "./Activity.js";
2
2
  import { Tab, TabPanel, Tabs, TabsList } from "./Tabs.js";
3
- import { t as CodeBlock } from "../CodeBlock-D9koxDA7.js";
3
+ import { t as CodeBlock } from "../CodeBlock-XNQOupQ3.js";
4
4
  import { BrowserLiveView } from "./BrowserLiveView.js";
5
5
  import { displayUrl } from "./ThinkChatToolParts.js";
6
6
  import * as React from "react";
@@ -1,7 +1,7 @@
1
- import { getStaticToolName, getToolName, isReasoningUIPart, isStaticToolUIPart, isToolUIPart } from "ai";
2
1
  import { getToolPartState } from "@cloudflare/think/react";
2
+ import { getStaticToolName, getToolName, isReasoningUIPart, isStaticToolUIPart, isToolUIPart } from "ai";
3
3
  //#region src/components/ThinkChatToolParts.ts
4
- const WORKSPACE_TOOL_NAMES = new Set([
4
+ const WORKSPACE_TOOL_NAMES = /* @__PURE__ */ new Set([
5
5
  "read",
6
6
  "write",
7
7
  "edit",
@@ -14,7 +14,7 @@ const WORKSPACE_TOOL_NAMES = new Set([
14
14
  function isWorkspaceToolPart(part) {
15
15
  return isStaticToolUIPart(part) && WORKSPACE_TOOL_NAMES.has(getStaticToolName(part));
16
16
  }
17
- const SKILL_TOOL_NAMES = new Set([
17
+ const SKILL_TOOL_NAMES = /* @__PURE__ */ new Set([
18
18
  "activate_skill",
19
19
  "read_skill_resource",
20
20
  "run_skill_script"
@@ -25,7 +25,7 @@ function isSkillToolPart(part) {
25
25
  function isFetchToolPart(part) {
26
26
  return isStaticToolUIPart(part) && getStaticToolName(part).startsWith("fetch_");
27
27
  }
28
- const BROWSER_TOOL_NAMES = new Set([
28
+ const BROWSER_TOOL_NAMES = /* @__PURE__ */ new Set([
29
29
  "browser_execute",
30
30
  "browser_markdown",
31
31
  "browser_extract",
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import { Think } from "@cloudflare/think";
3
+ import { AgentStub } from "agents/client";
4
+
5
+ //#region src/components/ThinkExecutionWorkbench.d.ts
6
+ type ThinkExecutionAgent<State = unknown> = Think<object, State>;
7
+ type ThinkExecutionWorkbenchSource<State = unknown> = AgentStub<ThinkExecutionAgent<State>>;
8
+ interface ThinkExecutionWorkbenchProps<State = unknown> extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
9
+ /** Agents SDK client stub for a Think agent; this UI calls native submission/workflow methods. */
10
+ source: ThinkExecutionWorkbenchSource<State>;
11
+ title?: React.ReactNode;
12
+ backButton?: React.ReactNode;
13
+ pageSize?: number;
14
+ }
15
+ declare function ThinkExecutionWorkbench<State = unknown>({
16
+ backButton,
17
+ className,
18
+ pageSize,
19
+ ref,
20
+ source,
21
+ title,
22
+ ...props
23
+ }: ThinkExecutionWorkbenchProps<State> & {
24
+ ref?: React.Ref<HTMLDivElement>;
25
+ }): React.JSX.Element;
26
+ //#endregion
27
+ export { ThinkExecutionAgent, ThinkExecutionWorkbench, ThinkExecutionWorkbenchProps, ThinkExecutionWorkbenchSource };
@@ -0,0 +1,450 @@
1
+ import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { A as SearchIcon, D as PlayIcon, L as XIcon, N as SquareIcon, T as PauseIcon, k as RefreshIcon, u as DotIcon } from "../icons-D2Q5n5C1.js";
3
+ import { Button } from "./Button.js";
4
+ import { Badge } from "./Badge.js";
5
+ import * as React from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/ThinkExecutionWorkbench.tsx
8
+ const executionPanelPageSize = 20;
9
+ function formatTimestamp(value) {
10
+ if (value == null) return "Not recorded";
11
+ const date = value instanceof Date ? value : new Date(value);
12
+ return Number.isNaN(date.getTime()) ? "Not recorded" : date.toLocaleString();
13
+ }
14
+ function formatJson(value) {
15
+ return JSON.stringify(value, null, 2);
16
+ }
17
+ function getErrorMessage(error) {
18
+ return error instanceof Error ? error.message : String(error);
19
+ }
20
+ function submissionStatusColor(status) {
21
+ if (status === "completed") return "success";
22
+ if (status === "error") return "destructive";
23
+ if (status === "aborted" || status === "skipped") return "warning";
24
+ if (status === "running") return "primary";
25
+ return "neutral";
26
+ }
27
+ function workflowStatusColor(status) {
28
+ const value = String(status);
29
+ if (value === "complete") return "success";
30
+ if (value === "errored" || value === "terminated") return "destructive";
31
+ if (value === "paused" || value === "waiting") return "warning";
32
+ if (value === "running") return "primary";
33
+ return "neutral";
34
+ }
35
+ function StatusBadge({ children, color }) {
36
+ return /* @__PURE__ */ jsxs(Badge, {
37
+ className: "think-execution-workbench__status",
38
+ color,
39
+ size: "sm",
40
+ children: [/* @__PURE__ */ jsx(DotIcon, {}), /* @__PURE__ */ jsx("span", { children })]
41
+ });
42
+ }
43
+ function isSubmissionCancelable(status) {
44
+ return status === "pending" || status === "running";
45
+ }
46
+ function isWorkflowTerminal(status) {
47
+ const value = String(status);
48
+ return value === "complete" || value === "errored" || value === "terminated";
49
+ }
50
+ function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPanelPageSize, ref, source, title = "Execution", ...props }) {
51
+ const inspectionId = React.useId();
52
+ const submissionsId = React.useId();
53
+ const executionsId = React.useId();
54
+ const [busyAction, setBusyAction] = React.useState("refresh");
55
+ const [error, setError] = React.useState(null);
56
+ const [submissions, setSubmissions] = React.useState([]);
57
+ const [workflows, setWorkflows] = React.useState(null);
58
+ const [selectedSubmission, setSelectedSubmission] = React.useState(null);
59
+ const [selectedWorkflow, setSelectedWorkflow] = React.useState(null);
60
+ const loadData = React.useCallback(async () => {
61
+ const [nextSubmissions, nextWorkflows] = await Promise.all([source.listSubmissions({ limit: pageSize }), source.getWorkflows({
62
+ limit: pageSize,
63
+ orderBy: "desc"
64
+ })]);
65
+ setSubmissions(nextSubmissions);
66
+ setWorkflows(nextWorkflows);
67
+ }, [pageSize, source]);
68
+ const refresh = React.useCallback(async () => {
69
+ setBusyAction("refresh");
70
+ setError(null);
71
+ try {
72
+ await loadData();
73
+ } catch (nextError) {
74
+ setError(getErrorMessage(nextError));
75
+ } finally {
76
+ setBusyAction(null);
77
+ }
78
+ }, [loadData]);
79
+ const runAction = React.useCallback(async (key, action) => {
80
+ setBusyAction(key);
81
+ setError(null);
82
+ try {
83
+ await action();
84
+ await loadData();
85
+ } catch (nextError) {
86
+ setError(getErrorMessage(nextError));
87
+ } finally {
88
+ setBusyAction(null);
89
+ }
90
+ }, [loadData]);
91
+ React.useEffect(() => {
92
+ refresh();
93
+ }, [refresh]);
94
+ return /* @__PURE__ */ jsxs("div", {
95
+ ref,
96
+ className: cx("think-execution-workbench", className),
97
+ ...props,
98
+ children: [
99
+ /* @__PURE__ */ jsxs("header", {
100
+ className: "think-execution-workbench__header",
101
+ children: [/* @__PURE__ */ jsxs("div", {
102
+ className: "think-execution-workbench__heading",
103
+ children: [backButton, /* @__PURE__ */ jsx("h2", {
104
+ className: "think-execution-workbench__title",
105
+ children: title
106
+ })]
107
+ }), /* @__PURE__ */ jsxs(Button, {
108
+ type: "button",
109
+ variant: "outline",
110
+ color: "neutral",
111
+ size: "sm",
112
+ className: "think-execution-workbench__refresh",
113
+ "aria-label": "Refresh execution records",
114
+ disabled: busyAction !== null,
115
+ onClick: () => void refresh(),
116
+ children: [/* @__PURE__ */ jsx(RefreshIcon, {}), /* @__PURE__ */ jsx("span", { children: "Refresh" })]
117
+ })]
118
+ }),
119
+ error ? /* @__PURE__ */ jsx("div", {
120
+ className: "think-execution-workbench__error",
121
+ role: "alert",
122
+ children: error
123
+ }) : null,
124
+ /* @__PURE__ */ jsxs("div", {
125
+ className: "think-execution-workbench__sections",
126
+ "aria-busy": busyAction !== null,
127
+ children: [/* @__PURE__ */ jsxs("div", {
128
+ className: "think-execution-workbench__lists",
129
+ children: [/* @__PURE__ */ jsxs("section", {
130
+ className: "think-execution-workbench__section",
131
+ "aria-labelledby": submissionsId,
132
+ children: [/* @__PURE__ */ jsxs("div", {
133
+ className: "think-execution-workbench__section-header",
134
+ children: [/* @__PURE__ */ jsx("h3", {
135
+ id: submissionsId,
136
+ children: "Submissions"
137
+ }), /* @__PURE__ */ jsx(Badge, {
138
+ color: "neutral",
139
+ size: "sm",
140
+ children: submissions.length
141
+ })]
142
+ }), busyAction === "refresh" && submissions.length === 0 ? /* @__PURE__ */ jsx("p", {
143
+ className: "think-execution-workbench__empty",
144
+ role: "status",
145
+ children: "Loading submissions..."
146
+ }) : submissions.length === 0 ? /* @__PURE__ */ jsx("p", {
147
+ className: "think-execution-workbench__empty",
148
+ children: "No submissions."
149
+ }) : /* @__PURE__ */ jsx("ul", {
150
+ className: "think-execution-workbench__list",
151
+ role: "list",
152
+ children: submissions.map((submission) => /* @__PURE__ */ jsxs("li", {
153
+ className: "think-execution-workbench__item",
154
+ "data-selected": selectedSubmission?.submissionId === submission.submissionId ? "true" : void 0,
155
+ children: [/* @__PURE__ */ jsxs("div", {
156
+ className: "think-execution-workbench__row-main",
157
+ children: [
158
+ /* @__PURE__ */ jsxs("div", {
159
+ className: "think-execution-workbench__item-topline",
160
+ children: [/* @__PURE__ */ jsx("code", { children: submission.submissionId }), /* @__PURE__ */ jsx(StatusBadge, {
161
+ color: submissionStatusColor(submission.status),
162
+ children: submission.status
163
+ })]
164
+ }),
165
+ /* @__PURE__ */ jsxs("p", {
166
+ className: "think-execution-workbench__row-meta",
167
+ children: [/* @__PURE__ */ jsxs("span", { children: ["Created ", formatTimestamp(submission.createdAt)] }), submission.idempotencyKey ? /* @__PURE__ */ jsxs("span", { children: ["Idempotency ", submission.idempotencyKey] }) : null]
168
+ }),
169
+ submission.error ? /* @__PURE__ */ jsx("p", {
170
+ className: "think-execution-workbench__item-error",
171
+ children: submission.error
172
+ }) : null
173
+ ]
174
+ }), /* @__PURE__ */ jsxs("div", {
175
+ className: "think-execution-workbench__actions",
176
+ children: [
177
+ /* @__PURE__ */ jsx(Button, {
178
+ type: "button",
179
+ variant: "ghost",
180
+ color: "neutral",
181
+ size: "icon-xs",
182
+ "aria-label": `Inspect submission ${submission.submissionId}`,
183
+ disabled: busyAction !== null,
184
+ onClick: () => void runAction(`inspect-submission:${submission.submissionId}`, async () => {
185
+ setSelectedWorkflow(null);
186
+ setSelectedSubmission(await source.inspectSubmission(submission.submissionId));
187
+ }),
188
+ children: /* @__PURE__ */ jsx(SearchIcon, {})
189
+ }),
190
+ isSubmissionCancelable(submission.status) ? /* @__PURE__ */ jsx(Button, {
191
+ type: "button",
192
+ variant: "ghost",
193
+ color: "neutral",
194
+ size: "icon-xs",
195
+ "aria-label": `Cancel submission ${submission.submissionId}`,
196
+ disabled: busyAction !== null,
197
+ onClick: () => void runAction(`cancel-submission:${submission.submissionId}`, () => source.cancelSubmission(submission.submissionId)),
198
+ children: /* @__PURE__ */ jsx(SquareIcon, {})
199
+ }) : null,
200
+ /* @__PURE__ */ jsx(Button, {
201
+ type: "button",
202
+ variant: "ghost",
203
+ color: "destructive",
204
+ size: "icon-xs",
205
+ "aria-label": `Delete submission ${submission.submissionId}`,
206
+ disabled: busyAction !== null,
207
+ onClick: () => void runAction(`delete-submission:${submission.submissionId}`, () => source.deleteSubmission(submission.submissionId)),
208
+ children: /* @__PURE__ */ jsx(XIcon, {})
209
+ })
210
+ ]
211
+ })]
212
+ }, submission.submissionId))
213
+ })]
214
+ }), /* @__PURE__ */ jsxs("section", {
215
+ className: "think-execution-workbench__section",
216
+ "aria-labelledby": executionsId,
217
+ children: [/* @__PURE__ */ jsxs("div", {
218
+ className: "think-execution-workbench__section-header",
219
+ children: [/* @__PURE__ */ jsx("h3", {
220
+ id: executionsId,
221
+ children: "Tracked workflows"
222
+ }), /* @__PURE__ */ jsx(Badge, {
223
+ color: "neutral",
224
+ size: "sm",
225
+ children: workflows?.total ?? 0
226
+ })]
227
+ }), busyAction === "refresh" && workflows === null ? /* @__PURE__ */ jsx("p", {
228
+ className: "think-execution-workbench__empty",
229
+ role: "status",
230
+ children: "Loading workflows..."
231
+ }) : !workflows || workflows.workflows.length === 0 ? /* @__PURE__ */ jsx("p", {
232
+ className: "think-execution-workbench__empty",
233
+ children: "No tracked workflows."
234
+ }) : /* @__PURE__ */ jsx("ul", {
235
+ className: "think-execution-workbench__list",
236
+ role: "list",
237
+ children: workflows.workflows.map((workflow) => {
238
+ const workflowStatus = String(workflow.status);
239
+ return /* @__PURE__ */ jsxs("li", {
240
+ className: "think-execution-workbench__item",
241
+ "data-selected": selectedWorkflow?.workflowId === workflow.workflowId ? "true" : void 0,
242
+ children: [/* @__PURE__ */ jsxs("div", {
243
+ className: "think-execution-workbench__row-main",
244
+ children: [
245
+ /* @__PURE__ */ jsxs("div", {
246
+ className: "think-execution-workbench__item-topline",
247
+ children: [/* @__PURE__ */ jsx("code", { children: workflow.workflowName }), /* @__PURE__ */ jsx(StatusBadge, {
248
+ color: workflowStatusColor(workflow.status),
249
+ children: workflowStatus
250
+ })]
251
+ }),
252
+ /* @__PURE__ */ jsxs("p", {
253
+ className: "think-execution-workbench__row-meta",
254
+ children: [/* @__PURE__ */ jsx("span", { children: workflow.workflowId }), /* @__PURE__ */ jsxs("span", { children: ["Updated ", formatTimestamp(workflow.updatedAt)] })]
255
+ }),
256
+ workflow.error ? /* @__PURE__ */ jsxs("p", {
257
+ className: "think-execution-workbench__item-error",
258
+ children: [
259
+ workflow.error.name,
260
+ ": ",
261
+ workflow.error.message
262
+ ]
263
+ }) : null
264
+ ]
265
+ }), /* @__PURE__ */ jsxs("div", {
266
+ className: "think-execution-workbench__actions",
267
+ children: [
268
+ /* @__PURE__ */ jsx(Button, {
269
+ type: "button",
270
+ variant: "ghost",
271
+ color: "neutral",
272
+ size: "icon-xs",
273
+ "aria-label": `Inspect workflow ${workflow.workflowId}`,
274
+ disabled: busyAction !== null,
275
+ onClick: () => void runAction(`inspect-workflow:${workflow.workflowId}`, async () => {
276
+ setSelectedSubmission(null);
277
+ setSelectedWorkflow(await source.getWorkflow(workflow.workflowId) ?? workflow);
278
+ }),
279
+ children: /* @__PURE__ */ jsx(SearchIcon, {})
280
+ }),
281
+ /* @__PURE__ */ jsx(Button, {
282
+ type: "button",
283
+ variant: "ghost",
284
+ color: "neutral",
285
+ size: "icon-xs",
286
+ "aria-label": `Sync workflow ${workflow.workflowId} status`,
287
+ disabled: busyAction !== null,
288
+ onClick: () => void runAction(`sync-workflow:${workflow.workflowId}`, () => source.getWorkflowStatus(workflow.workflowName, workflow.workflowId)),
289
+ children: /* @__PURE__ */ jsx(RefreshIcon, {})
290
+ }),
291
+ workflowStatus === "running" ? /* @__PURE__ */ jsx(Button, {
292
+ type: "button",
293
+ variant: "ghost",
294
+ color: "neutral",
295
+ size: "icon-xs",
296
+ "aria-label": `Pause workflow ${workflow.workflowId}`,
297
+ disabled: busyAction !== null,
298
+ onClick: () => void runAction(`pause-workflow:${workflow.workflowId}`, () => source.pauseWorkflow(workflow.workflowId)),
299
+ children: /* @__PURE__ */ jsx(PauseIcon, {})
300
+ }) : null,
301
+ workflowStatus === "paused" ? /* @__PURE__ */ jsx(Button, {
302
+ type: "button",
303
+ variant: "ghost",
304
+ color: "neutral",
305
+ size: "icon-xs",
306
+ "aria-label": `Resume workflow ${workflow.workflowId}`,
307
+ disabled: busyAction !== null,
308
+ onClick: () => void runAction(`resume-workflow:${workflow.workflowId}`, () => source.resumeWorkflow(workflow.workflowId)),
309
+ children: /* @__PURE__ */ jsx(PlayIcon, {})
310
+ }) : null,
311
+ isWorkflowTerminal(workflow.status) ? /* @__PURE__ */ jsx(Button, {
312
+ type: "button",
313
+ variant: "ghost",
314
+ color: "neutral",
315
+ size: "icon-xs",
316
+ "aria-label": `Restart workflow ${workflow.workflowId}`,
317
+ disabled: busyAction !== null,
318
+ onClick: () => void runAction(`restart-workflow:${workflow.workflowId}`, () => source.restartWorkflow(workflow.workflowId)),
319
+ children: /* @__PURE__ */ jsx(RefreshIcon, {})
320
+ }) : null,
321
+ workflowStatus === "running" ? /* @__PURE__ */ jsx(Button, {
322
+ type: "button",
323
+ variant: "ghost",
324
+ color: "destructive",
325
+ size: "icon-xs",
326
+ "aria-label": `Terminate workflow ${workflow.workflowId}`,
327
+ disabled: busyAction !== null,
328
+ onClick: () => void runAction(`terminate-workflow:${workflow.workflowId}`, () => source.terminateWorkflow(workflow.workflowId)),
329
+ children: /* @__PURE__ */ jsx(SquareIcon, {})
330
+ }) : null,
331
+ /* @__PURE__ */ jsx(Button, {
332
+ type: "button",
333
+ variant: "ghost",
334
+ color: "destructive",
335
+ size: "icon-xs",
336
+ "aria-label": `Delete workflow ${workflow.workflowId}`,
337
+ disabled: busyAction !== null,
338
+ onClick: () => void runAction(`delete-workflow:${workflow.workflowId}`, () => source.deleteWorkflow(workflow.workflowId)),
339
+ children: /* @__PURE__ */ jsx(XIcon, {})
340
+ })
341
+ ]
342
+ })]
343
+ }, workflow.workflowId);
344
+ })
345
+ })]
346
+ })]
347
+ }), /* @__PURE__ */ jsx("div", {
348
+ className: "think-execution-workbench__detail",
349
+ "aria-labelledby": inspectionId,
350
+ children: selectedSubmission ? /* @__PURE__ */ jsxs(Fragment, { children: [
351
+ /* @__PURE__ */ jsxs("div", {
352
+ className: "think-execution-workbench__detail-header",
353
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
354
+ className: "think-execution-workbench__eyebrow",
355
+ children: "Submission inspection"
356
+ }), /* @__PURE__ */ jsx("h3", {
357
+ id: inspectionId,
358
+ children: /* @__PURE__ */ jsx("code", { children: selectedSubmission.submissionId })
359
+ })] }), /* @__PURE__ */ jsx(StatusBadge, {
360
+ color: submissionStatusColor(selectedSubmission.status),
361
+ children: selectedSubmission.status
362
+ })]
363
+ }),
364
+ /* @__PURE__ */ jsxs("dl", {
365
+ className: "think-execution-workbench__meta think-execution-workbench__meta--detail",
366
+ children: [
367
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Created" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedSubmission.createdAt) })] }),
368
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Started" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedSubmission.startedAt) })] }),
369
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Completed" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedSubmission.completedAt) })] }),
370
+ selectedSubmission.requestId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Request" }), /* @__PURE__ */ jsx("dd", { children: selectedSubmission.requestId })] }) : null,
371
+ selectedSubmission.idempotencyKey ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Idempotency" }), /* @__PURE__ */ jsx("dd", { children: selectedSubmission.idempotencyKey })] }) : null
372
+ ]
373
+ }),
374
+ selectedSubmission.error ? /* @__PURE__ */ jsx("p", {
375
+ className: "think-execution-workbench__item-error",
376
+ children: selectedSubmission.error
377
+ }) : null,
378
+ selectedSubmission.metadata ? /* @__PURE__ */ jsxs("div", {
379
+ className: "think-execution-workbench__inspection",
380
+ children: [/* @__PURE__ */ jsx("h4", { children: "Metadata" }), /* @__PURE__ */ jsx("pre", {
381
+ tabIndex: 0,
382
+ children: formatJson(selectedSubmission.metadata)
383
+ })]
384
+ }) : null,
385
+ /* @__PURE__ */ jsxs("div", {
386
+ className: "think-execution-workbench__inspection",
387
+ children: [/* @__PURE__ */ jsx("h4", { children: "Raw record" }), /* @__PURE__ */ jsx("pre", {
388
+ tabIndex: 0,
389
+ children: formatJson(selectedSubmission)
390
+ })]
391
+ })
392
+ ] }) : selectedWorkflow ? /* @__PURE__ */ jsxs(Fragment, { children: [
393
+ /* @__PURE__ */ jsxs("div", {
394
+ className: "think-execution-workbench__detail-header",
395
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
396
+ className: "think-execution-workbench__eyebrow",
397
+ children: "Workflow inspection"
398
+ }), /* @__PURE__ */ jsx("h3", {
399
+ id: inspectionId,
400
+ children: /* @__PURE__ */ jsx("code", { children: selectedWorkflow.workflowName })
401
+ })] }), /* @__PURE__ */ jsx(StatusBadge, {
402
+ color: workflowStatusColor(selectedWorkflow.status),
403
+ children: String(selectedWorkflow.status)
404
+ })]
405
+ }),
406
+ /* @__PURE__ */ jsxs("dl", {
407
+ className: "think-execution-workbench__meta think-execution-workbench__meta--detail",
408
+ children: [
409
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Instance" }), /* @__PURE__ */ jsx("dd", { children: selectedWorkflow.workflowId })] }),
410
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Created" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedWorkflow.createdAt) })] }),
411
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Updated" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedWorkflow.updatedAt) })] }),
412
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Completed" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedWorkflow.completedAt) })] })
413
+ ]
414
+ }),
415
+ selectedWorkflow.error ? /* @__PURE__ */ jsxs("p", {
416
+ className: "think-execution-workbench__item-error",
417
+ children: [
418
+ selectedWorkflow.error.name,
419
+ ": ",
420
+ selectedWorkflow.error.message
421
+ ]
422
+ }) : null,
423
+ selectedWorkflow.metadata ? /* @__PURE__ */ jsxs("div", {
424
+ className: "think-execution-workbench__inspection",
425
+ children: [/* @__PURE__ */ jsx("h4", { children: "Metadata" }), /* @__PURE__ */ jsx("pre", {
426
+ tabIndex: 0,
427
+ children: formatJson(selectedWorkflow.metadata)
428
+ })]
429
+ }) : null,
430
+ /* @__PURE__ */ jsxs("div", {
431
+ className: "think-execution-workbench__inspection",
432
+ children: [/* @__PURE__ */ jsx("h4", { children: "Raw record" }), /* @__PURE__ */ jsx("pre", {
433
+ tabIndex: 0,
434
+ children: formatJson(selectedWorkflow)
435
+ })]
436
+ })
437
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("h3", {
438
+ id: inspectionId,
439
+ children: "Inspection"
440
+ }), /* @__PURE__ */ jsx("p", {
441
+ className: "think-execution-workbench__empty think-execution-workbench__empty--detail",
442
+ children: "Inspect a submission or workflow."
443
+ })] })
444
+ })]
445
+ })
446
+ ]
447
+ });
448
+ }
449
+ //#endregion
450
+ export { ThinkExecutionWorkbench };