@mcp-b/react-components 0.14.2 → 0.16.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/AgentActivity-BNUNrP9O.d.ts +36 -0
- package/dist/{AgentChat-DQkqt82e.d.ts → AgentChat-CrlpbvQJ.d.ts} +58 -6
- package/dist/{CodeBlock-DUh9WOGo.d.ts → CodeBlock-BRajW4QU.d.ts} +1 -1
- package/dist/{CodeBlock-BUFXG8HW.js → CodeBlock-BmB4Xaqq.js} +15 -4
- package/dist/{FileTree-mpEIcfzA.js → FileTree-CkVbIMWV.js} +82 -89
- package/dist/Message-BkMdE3bS.js +375 -0
- package/dist/{ModelSelector-CPCpFAUt.js → ModelSelector-SlJNgwKY.js} +2 -2
- package/dist/{PromptInput-ClNqBiIw.d.ts → PromptInput-BWTuXMOD.d.ts} +123 -5
- package/dist/ResponsiveSidebarShell-Dd9DCcBT.d.ts +67 -0
- package/dist/{Select-Dl_vF_Bt.d.ts → Select-BeEsefzh.d.ts} +12 -2
- package/dist/{ThinkChat-BPcehdbP.js → ThinkChat-CzC-zNGA.js} +24 -36
- package/dist/{ThinkChatActivity-BmwuIigx.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
- package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
- package/dist/{ThinkChatToolParts-CDEjqS6A.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +13 -3
- package/dist/ThinkExecutionRun-ChhWhOoU.d.ts +30 -0
- package/dist/Toggle-CAAlNl-M.d.ts +69 -0
- package/dist/ToggleGroup-8hPv-b69.d.ts +73 -0
- package/dist/Workspace-D39LxGvP.d.ts +62 -0
- package/dist/WorkspaceFile-DOZkPwzu.d.ts +106 -0
- package/dist/WorkspaceFileView-rSN_yT0L.js +744 -0
- package/dist/WorkspaceLink-DIPbXrUM.js +337 -0
- package/dist/WorkspaceLink-DK1DWMHe.d.ts +89 -0
- package/dist/components/Activity.d.ts +27 -1
- package/dist/components/Activity.js +33 -15
- package/dist/components/AgentActivity.d.ts +2 -0
- package/dist/components/AgentActivity.js +45 -0
- package/dist/components/AgentActivityPreview.d.ts +46 -0
- package/dist/components/AgentActivityPreview.js +94 -0
- package/dist/components/AgentAttention.d.ts +73 -0
- package/dist/components/AgentAttention.js +85 -0
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +224 -200
- package/dist/components/AgentChatMessageEditor.d.ts +29 -0
- package/dist/components/AgentChatMessageEditor.js +92 -0
- package/dist/components/AgentChatTurnError.d.ts +17 -0
- package/dist/components/AgentChatTurnError.js +40 -0
- package/dist/components/AgentConnection.d.ts +12 -17
- package/dist/components/AgentConnection.js +99 -91
- package/dist/components/AppFrame.d.ts +24 -0
- package/dist/components/AppFrame.js +25 -0
- package/dist/components/AppTopBar.d.ts +71 -0
- package/dist/components/AppTopBar.js +82 -0
- package/dist/components/Artifact.js +1 -1
- package/dist/components/BrowserLiveView.js +1 -1
- package/dist/components/BrowserReplay.js +1 -1
- package/dist/components/BrowserRunPanel.js +1 -1
- package/dist/components/Card.d.ts +3 -0
- package/dist/components/Card.js +2 -1
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +1 -1
- package/dist/components/ChatGptSignInScreen.js +2 -2
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/CheckboxGroup.d.ts +58 -2
- package/dist/components/CheckboxGroup.js +59 -1
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.js +1 -1
- package/dist/components/Commit.js +2 -2
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/Conversation.js +1 -1
- package/dist/components/DescriptionList.d.ts +12 -0
- package/dist/components/DescriptionList.js +11 -0
- package/dist/components/DescriptionListParts.d.ts +37 -0
- package/dist/components/DescriptionListParts.js +35 -0
- package/dist/components/EnvironmentVariables.js +2 -2
- package/dist/components/Fieldset.d.ts +13 -1
- package/dist/components/Fieldset.js +11 -2
- package/dist/components/FileTree.js +1 -1
- package/dist/components/IconButton.d.ts +33 -0
- package/dist/components/IconButton.js +27 -0
- package/dist/components/McpConnectionRequest.d.ts +44 -0
- package/dist/components/McpConnectionRequest.js +122 -0
- package/dist/components/McpServerPicker.d.ts +48 -23
- package/dist/components/McpServerPicker.js +238 -189
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Message.d.ts +1 -0
- package/dist/components/Message.js +1 -285
- package/dist/components/MessageScroller.js +1 -1
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/Pricing.d.ts +37 -0
- package/dist/components/Pricing.js +17 -0
- package/dist/components/PricingBillingToggle.d.ts +23 -0
- package/dist/components/PricingBillingToggle.js +86 -0
- package/dist/components/PricingConfirmationDialog.d.ts +25 -0
- package/dist/components/PricingConfirmationDialog.js +57 -0
- package/dist/components/PricingFAQ.d.ts +18 -0
- package/dist/components/PricingFAQ.js +27 -0
- package/dist/components/PricingPage.d.ts +2 -38
- package/dist/components/PricingPage.js +39 -359
- package/dist/components/PricingPlanCard.d.ts +22 -0
- package/dist/components/PricingPlanCard.js +109 -0
- package/dist/components/PricingUsageCalculator.d.ts +22 -0
- package/dist/components/PricingUsageCalculator.js +96 -0
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +210 -15
- package/dist/components/Queue.js +1 -1
- package/dist/components/Reasoning.d.ts +2 -1
- package/dist/components/Reasoning.js +14 -29
- package/dist/components/ResizableSidePanel.d.ts +57 -0
- package/dist/components/ResizableSidePanel.js +151 -0
- package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
- package/dist/components/ResponsiveSidebarShell.js +129 -0
- package/dist/components/Select.d.ts +2 -2
- package/dist/components/Select.js +11 -2
- package/dist/components/Slider.d.ts +13 -1
- package/dist/components/Slider.js +11 -0
- package/dist/components/Sources.js +1 -1
- package/dist/components/Stepper.d.ts +4 -0
- package/dist/components/Stepper.js +5 -3
- package/dist/components/SubagentRun.d.ts +18 -19
- package/dist/components/SubagentRun.js +25 -18
- package/dist/components/SubagentRunIndicator.d.ts +22 -0
- package/dist/components/SubagentRunIndicator.js +33 -0
- package/dist/components/SubagentRunList.d.ts +25 -0
- package/dist/components/SubagentRunList.js +26 -0
- package/dist/components/SubagentRunSelector.d.ts +47 -0
- package/dist/components/SubagentRunSelector.js +55 -0
- package/dist/components/Task.js +1 -1
- package/dist/components/Terminal.js +2 -2
- package/dist/components/TestResults.js +1 -1
- package/dist/components/Textarea.d.ts +21 -0
- package/dist/components/Textarea.js +19 -0
- package/dist/components/ThemeModeControl.d.ts +24 -0
- package/dist/components/ThemeModeControl.js +52 -0
- package/dist/components/ThemeProvider.d.ts +38 -0
- package/dist/components/ThemeProvider.js +80 -0
- package/dist/components/ThinkChat.d.ts +29 -6
- package/dist/components/ThinkChat.js +7 -4
- package/dist/components/ThinkChatActivity.d.ts +3 -2
- package/dist/components/ThinkChatActivity.js +12 -318
- package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
- package/dist/components/ThinkChatActivitySummary.js +421 -0
- package/dist/components/ThinkChatToolPanels.d.ts +7 -5
- package/dist/components/ThinkChatToolPanels.js +70 -8
- package/dist/components/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/ThinkChatToolParts.js +36 -10
- package/dist/components/ThinkExecutionDetail.d.ts +20 -0
- package/dist/components/ThinkExecutionDetail.js +80 -0
- package/dist/components/ThinkExecutionRun.d.ts +2 -0
- package/dist/components/ThinkExecutionRun.js +72 -0
- package/dist/components/ThinkExecutionStatus.d.ts +22 -0
- package/dist/components/ThinkExecutionStatus.js +36 -0
- package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
- package/dist/components/ThinkExecutionWorkbench.js +69 -225
- package/dist/components/ThinkFullApp.d.ts +58 -14
- package/dist/components/ThinkFullApp.js +129 -160
- package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
- package/dist/components/ThinkFullAppViewSwitch.js +34 -0
- package/dist/components/ThinkRoutine.d.ts +36 -0
- package/dist/components/ThinkRoutine.js +15 -0
- package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
- package/dist/components/ThinkRoutineBrowser.js +156 -0
- package/dist/components/ThinkRoutineDetail.d.ts +24 -0
- package/dist/components/ThinkRoutineDetail.js +102 -0
- package/dist/components/ThinkRoutineForm.d.ts +32 -0
- package/dist/components/ThinkRoutineForm.js +151 -0
- package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
- package/dist/components/ThinkRoutineLibrary.js +178 -0
- package/dist/components/ThinkRoutineRuns.d.ts +24 -0
- package/dist/components/ThinkRoutineRuns.js +68 -0
- package/dist/components/ThinkThreadPicker.d.ts +18 -1
- package/dist/components/ThinkThreadPicker.js +51 -5
- package/dist/components/ThinkThreadShell.d.ts +12 -9
- package/dist/components/ThinkThreadShell.js +17 -137
- package/dist/components/Toggle.d.ts +1 -68
- package/dist/components/ToggleGroup.d.ts +1 -72
- package/dist/components/Tooltip.d.ts +3 -1
- package/dist/components/Tooltip.js +4 -2
- package/dist/components/WebPreview.js +1 -1
- package/dist/components/Workspace.d.ts +2 -0
- package/dist/components/Workspace.js +424 -0
- package/dist/components/WorkspaceBrowser.d.ts +32 -0
- package/dist/components/WorkspaceBrowser.js +103 -0
- package/dist/components/WorkspaceExplorer.d.ts +12 -79
- package/dist/components/WorkspaceExplorer.js +116 -330
- package/dist/components/WorkspaceFile.d.ts +2 -0
- package/dist/components/WorkspaceFile.js +195 -0
- package/dist/components/WorkspaceFileView.d.ts +26 -0
- package/dist/components/WorkspaceFileView.js +2 -0
- package/dist/components/WorkspaceHeader.d.ts +35 -0
- package/dist/components/WorkspaceHeader.js +51 -0
- package/dist/components/WorkspaceLink.d.ts +2 -0
- package/dist/components/WorkspaceLink.js +2 -0
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
- package/dist/icons-CpfUer49.js +85 -0
- package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
- package/dist/styles/activity-header.css +75 -0
- package/dist/styles/activity.css +49 -63
- package/dist/styles/agent-activity-preview-overlay.css +80 -0
- package/dist/styles/agent-activity-preview.css +235 -0
- package/dist/styles/agent-attention.css +122 -0
- package/dist/styles/agent-chat.css +133 -4
- package/dist/styles/app-frame.css +15 -0
- package/dist/styles/app-top-bar.css +100 -0
- package/dist/styles/avatar.css +0 -1
- package/dist/styles/browser-control-overlay.css +184 -0
- package/dist/styles/card.css +21 -0
- package/dist/styles/checkbox-group.css +69 -0
- package/dist/styles/description-list.css +50 -0
- package/dist/styles/fieldset.css +11 -0
- package/dist/styles/index.css +14 -2
- package/dist/styles/mcp-connection-request.css +60 -0
- package/dist/styles/mcp-server-picker.css +95 -68
- package/dist/styles/message.css +4 -43
- package/dist/styles/pricing-page.css +21 -27
- package/dist/styles/prompt-input.css +225 -32
- package/dist/styles/reasoning.css +1 -55
- package/dist/styles/recipes.css +23 -15
- package/dist/styles/resizable-side-panel.css +66 -0
- package/dist/styles/responsive-sidebar-shell.css +169 -0
- package/dist/styles/select.css +10 -0
- package/dist/styles/stepper.css +13 -0
- package/dist/styles/streamdown.css +0 -4
- package/dist/styles/subagent-run.css +55 -38
- package/dist/styles/textarea.css +20 -0
- package/dist/styles/theme-mode-control.css +72 -0
- package/dist/styles/think-execution-status.css +49 -0
- package/dist/styles/think-execution-workbench.css +8 -72
- package/dist/styles/think-full-app.css +104 -131
- package/dist/styles/think-routine-library.css +491 -0
- package/dist/styles/think-thread-picker.css +47 -3
- package/dist/styles/toggle-group.css +7 -0
- package/dist/styles/workspace-explorer.css +511 -64
- package/dist/utils/mcp-server-catalog.d.ts +82 -78
- package/dist/utils/mcp-server-catalog.js +64 -41
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/utils/theme.d.ts +22 -0
- package/dist/utils/theme.js +55 -0
- package/package.json +34 -28
- package/dist/icons-Ba9THQKz.js +0 -64
- package/dist/styles/think-resize-handle.css +0 -33
- package/dist/styles/think-thread-shell.css +0 -219
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { G as TerminalIcon, L as RefreshIcon, S as InfoIcon, Y as XIcon, o as CheckIcon, t as ArrowDownIcon, v as FileIcon } from "../icons-CpfUer49.js";
|
|
3
|
+
import { Activity, ActivityContent, ActivityItem, ActivityItemGroup, ActivityOutput, ActivityPanel, ActivityTrigger } from "./Activity.js";
|
|
4
|
+
import { formatThinkExecutionRunProgress, formatThinkExecutionStatus, formatThinkExecutionTimestamp, getThinkExecutionRunError, getThinkExecutionRunId, getThinkExecutionRunProgressedAt, getThinkExecutionRunProgressedLabel, getThinkExecutionRunStatus, getThinkExecutionRunTitle, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
|
|
5
|
+
import { ThinkExecutionStatus } from "./ThinkExecutionStatus.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ThinkExecutionDetail.tsx
|
|
9
|
+
function formatJson(value) {
|
|
10
|
+
return JSON.stringify(value, null, 2);
|
|
11
|
+
}
|
|
12
|
+
/** Native Think submission or Agents Workflow detail, reusable outside the execution workbench. */
|
|
13
|
+
function ThinkExecutionDetail({ className, emptyState = "Select a run to view its activity.", ref, run, ...props }) {
|
|
14
|
+
if (!run) return /* @__PURE__ */ jsx("section", {
|
|
15
|
+
ref,
|
|
16
|
+
className: cx("think-execution-detail", "think-execution-workbench__empty-detail", className),
|
|
17
|
+
role: "status",
|
|
18
|
+
...props,
|
|
19
|
+
children: /* @__PURE__ */ jsx("p", { children: emptyState })
|
|
20
|
+
});
|
|
21
|
+
const id = getThinkExecutionRunId(run);
|
|
22
|
+
const progressedAt = getThinkExecutionRunProgressedAt(run);
|
|
23
|
+
const error = getThinkExecutionRunError(run);
|
|
24
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
25
|
+
ref,
|
|
26
|
+
className: cx("think-execution-detail", className),
|
|
27
|
+
...props,
|
|
28
|
+
children: [/* @__PURE__ */ jsxs("header", {
|
|
29
|
+
className: "think-execution-workbench__detail-header",
|
|
30
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: getThinkExecutionRunTitle(run) }), !isThinkSubmissionRun(run) ? /* @__PURE__ */ jsx("code", { children: id }) : null] }), /* @__PURE__ */ jsxs("div", {
|
|
31
|
+
className: "think-execution-workbench__detail-status",
|
|
32
|
+
children: [/* @__PURE__ */ jsx(ThinkExecutionStatus, {
|
|
33
|
+
run,
|
|
34
|
+
className: "think-execution-workbench__icon"
|
|
35
|
+
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: formatThinkExecutionStatus(getThinkExecutionRunStatus(run)) }), /* @__PURE__ */ jsx("span", { children: formatThinkExecutionRunProgress(run) })] })]
|
|
36
|
+
})]
|
|
37
|
+
}), /* @__PURE__ */ jsxs(Activity, {
|
|
38
|
+
defaultOpen: true,
|
|
39
|
+
children: [/* @__PURE__ */ jsx(ActivityTrigger, {
|
|
40
|
+
icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
|
|
41
|
+
label: "Activity"
|
|
42
|
+
}), /* @__PURE__ */ jsxs(ActivityContent, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(ActivityItem, {
|
|
44
|
+
icon: /* @__PURE__ */ jsx(ArrowDownIcon, {}),
|
|
45
|
+
children: `Created ${formatThinkExecutionTimestamp(run.createdAt)}`
|
|
46
|
+
}),
|
|
47
|
+
progressedAt ? /* @__PURE__ */ jsx(ActivityItem, {
|
|
48
|
+
icon: /* @__PURE__ */ jsx(RefreshIcon, {}),
|
|
49
|
+
children: `${getThinkExecutionRunProgressedLabel(run)} ${formatThinkExecutionTimestamp(progressedAt)}`
|
|
50
|
+
}) : null,
|
|
51
|
+
run.completedAt ? /* @__PURE__ */ jsx(ActivityItem, {
|
|
52
|
+
icon: /* @__PURE__ */ jsx(CheckIcon, {}),
|
|
53
|
+
children: `Finished ${formatThinkExecutionTimestamp(run.completedAt)}`
|
|
54
|
+
}) : null,
|
|
55
|
+
error ? /* @__PURE__ */ jsx(ActivityItemGroup, {
|
|
56
|
+
icon: /* @__PURE__ */ jsx(XIcon, {}),
|
|
57
|
+
label: "Failure",
|
|
58
|
+
children: /* @__PURE__ */ jsx(ActivityPanel, {
|
|
59
|
+
label: "Error",
|
|
60
|
+
text: error,
|
|
61
|
+
status: "error",
|
|
62
|
+
error: true
|
|
63
|
+
})
|
|
64
|
+
}) : null,
|
|
65
|
+
run.metadata ? /* @__PURE__ */ jsx(ActivityItemGroup, {
|
|
66
|
+
icon: /* @__PURE__ */ jsx(InfoIcon, {}),
|
|
67
|
+
label: "Metadata",
|
|
68
|
+
children: /* @__PURE__ */ jsx(ActivityOutput, { children: formatJson(run.metadata) })
|
|
69
|
+
}) : null,
|
|
70
|
+
/* @__PURE__ */ jsx(ActivityItemGroup, {
|
|
71
|
+
icon: /* @__PURE__ */ jsx(FileIcon, {}),
|
|
72
|
+
label: "Raw record",
|
|
73
|
+
children: /* @__PURE__ */ jsx(ActivityOutput, { children: formatJson(run) })
|
|
74
|
+
})
|
|
75
|
+
] })]
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { ThinkExecutionDetail };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as isThinkSubmissionRun, a as formatThinkExecutionStatus, c as getThinkExecutionRunError, d as getThinkExecutionRunProgressedLabel, f as getThinkExecutionRunStatus, g as isSameThinkExecutionRun, h as getThinkExecutionRunTitle, i as formatThinkExecutionShortTimestamp, l as getThinkExecutionRunId, m as getThinkExecutionRunSubtitle, n as ThinkExecutionStatusTone, o as formatThinkExecutionTimestamp, p as getThinkExecutionRunStatusTone, r as formatThinkExecutionRunProgress, s as getThinkExecutionRunAccessibleName, t as ThinkExecutionRun, u as getThinkExecutionRunProgressedAt } from "../ThinkExecutionRun-ChhWhOoU.js";
|
|
2
|
+
export { ThinkExecutionRun, ThinkExecutionStatusTone, formatThinkExecutionRunProgress, formatThinkExecutionShortTimestamp, formatThinkExecutionStatus, formatThinkExecutionTimestamp, getThinkExecutionRunAccessibleName, getThinkExecutionRunError, getThinkExecutionRunId, getThinkExecutionRunProgressedAt, getThinkExecutionRunProgressedLabel, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone, getThinkExecutionRunSubtitle, getThinkExecutionRunTitle, isSameThinkExecutionRun, isThinkSubmissionRun };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region src/components/ThinkExecutionRun.ts
|
|
2
|
+
/** Narrows the direct upstream execution union without wrapping either record. */
|
|
3
|
+
function isThinkSubmissionRun(run) {
|
|
4
|
+
return "submissionId" in run;
|
|
5
|
+
}
|
|
6
|
+
function getThinkExecutionRunId(run) {
|
|
7
|
+
return isThinkSubmissionRun(run) ? run.submissionId : run.workflowId;
|
|
8
|
+
}
|
|
9
|
+
function getThinkExecutionRunTitle(run) {
|
|
10
|
+
return isThinkSubmissionRun(run) ? run.submissionId : run.workflowName;
|
|
11
|
+
}
|
|
12
|
+
function getThinkExecutionRunSubtitle(run) {
|
|
13
|
+
return isThinkSubmissionRun(run) ? void 0 : run.workflowId;
|
|
14
|
+
}
|
|
15
|
+
function getThinkExecutionRunProgressedAt(run) {
|
|
16
|
+
return isThinkSubmissionRun(run) ? run.startedAt : run.updatedAt;
|
|
17
|
+
}
|
|
18
|
+
function getThinkExecutionRunProgressedLabel(run) {
|
|
19
|
+
return isThinkSubmissionRun(run) ? "Started" : "Updated";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* WorkflowInfo.status resolves through the Workers-only InstanceStatus ambient
|
|
23
|
+
* type, so browser consumers format the whole upstream record's runtime value
|
|
24
|
+
* instead of exporting a local mirror of that union.
|
|
25
|
+
*/
|
|
26
|
+
function getThinkExecutionRunStatus(run) {
|
|
27
|
+
return String(run.status);
|
|
28
|
+
}
|
|
29
|
+
function getThinkExecutionRunStatusTone(run) {
|
|
30
|
+
const status = getThinkExecutionRunStatus(run);
|
|
31
|
+
if (status === "completed" || status === "complete") return "success";
|
|
32
|
+
if (status === "error" || status === "errored" || status === "terminated") return "danger";
|
|
33
|
+
if (status === "aborted" || status === "skipped" || status === "paused" || status === "waiting") return "warning";
|
|
34
|
+
if (status === "running" || status === "pending" || status === "queued" || status === "waitingForPause" || status === "rollingBack") return "primary";
|
|
35
|
+
return "neutral";
|
|
36
|
+
}
|
|
37
|
+
function formatThinkExecutionStatus(status) {
|
|
38
|
+
const words = status.replaceAll(/([a-z])([A-Z])/g, "$1 $2");
|
|
39
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
40
|
+
}
|
|
41
|
+
function formatThinkExecutionTimestamp(value, fallback = "Not recorded") {
|
|
42
|
+
if (value == null) return fallback;
|
|
43
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
44
|
+
return Number.isNaN(date.getTime()) ? fallback : date.toLocaleString();
|
|
45
|
+
}
|
|
46
|
+
function formatThinkExecutionShortTimestamp(value, fallback = "Not recorded") {
|
|
47
|
+
if (value == null) return fallback;
|
|
48
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
49
|
+
return Number.isNaN(date.getTime()) ? fallback : date.toLocaleString(void 0, {
|
|
50
|
+
month: "short",
|
|
51
|
+
day: "numeric",
|
|
52
|
+
hour: "numeric",
|
|
53
|
+
minute: "2-digit"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function formatThinkExecutionRunProgress(run) {
|
|
57
|
+
const progressedAt = getThinkExecutionRunProgressedAt(run);
|
|
58
|
+
return `${progressedAt ? getThinkExecutionRunProgressedLabel(run) : "Created"} ${formatThinkExecutionShortTimestamp(progressedAt ?? run.createdAt)}`;
|
|
59
|
+
}
|
|
60
|
+
function getThinkExecutionRunAccessibleName(run) {
|
|
61
|
+
const subtitle = getThinkExecutionRunSubtitle(run);
|
|
62
|
+
return `${getThinkExecutionRunTitle(run)}${subtitle ? ` ${subtitle}` : ""}. ${formatThinkExecutionStatus(getThinkExecutionRunStatus(run))}. ${formatThinkExecutionRunProgress(run)}`;
|
|
63
|
+
}
|
|
64
|
+
function getThinkExecutionRunError(run) {
|
|
65
|
+
return isThinkSubmissionRun(run) ? run.error : run.error ? `${run.error.name}: ${run.error.message}` : void 0;
|
|
66
|
+
}
|
|
67
|
+
function isSameThinkExecutionRun(first, second) {
|
|
68
|
+
if (!first || isThinkSubmissionRun(first) !== isThinkSubmissionRun(second)) return false;
|
|
69
|
+
return getThinkExecutionRunId(first) === getThinkExecutionRunId(second);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { formatThinkExecutionRunProgress, formatThinkExecutionShortTimestamp, formatThinkExecutionStatus, formatThinkExecutionTimestamp, getThinkExecutionRunAccessibleName, getThinkExecutionRunError, getThinkExecutionRunId, getThinkExecutionRunProgressedAt, getThinkExecutionRunProgressedLabel, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone, getThinkExecutionRunSubtitle, getThinkExecutionRunTitle, isSameThinkExecutionRun, isThinkSubmissionRun };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ThinkExecutionStatus.d.ts
|
|
5
|
+
interface ThinkExecutionStatusProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
6
|
+
/** Whole upstream Think submission or Agents workflow record. */
|
|
7
|
+
run: ThinkExecutionRun;
|
|
8
|
+
/** Accessible status label; derived from the run when omitted. */
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Shared status icon for whole upstream Think submission and Agents workflow records. */
|
|
12
|
+
declare function ThinkExecutionStatus({
|
|
13
|
+
className,
|
|
14
|
+
label,
|
|
15
|
+
run,
|
|
16
|
+
ref,
|
|
17
|
+
...props
|
|
18
|
+
}: ThinkExecutionStatusProps & {
|
|
19
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
20
|
+
}): React.JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ThinkExecutionStatus, ThinkExecutionStatusProps };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { B as SpinnerIcon, M as PauseIcon, S as InfoIcon, Y as XIcon, o as CheckIcon } from "../icons-CpfUer49.js";
|
|
3
|
+
import { Tooltip } from "./Tooltip.js";
|
|
4
|
+
import { formatThinkExecutionStatus, getThinkExecutionRunStatus, getThinkExecutionRunStatusTone } from "./ThinkExecutionRun.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/ThinkExecutionStatus.tsx
|
|
8
|
+
function statusIcon(tone) {
|
|
9
|
+
if (tone === "success") return /* @__PURE__ */ jsx(CheckIcon, {});
|
|
10
|
+
if (tone === "danger") return /* @__PURE__ */ jsx(XIcon, {});
|
|
11
|
+
if (tone === "warning") return /* @__PURE__ */ jsx(PauseIcon, {});
|
|
12
|
+
if (tone === "primary") return /* @__PURE__ */ jsx(SpinnerIcon, {});
|
|
13
|
+
return /* @__PURE__ */ jsx(InfoIcon, {});
|
|
14
|
+
}
|
|
15
|
+
/** Shared status icon for whole upstream Think submission and Agents workflow records. */
|
|
16
|
+
function ThinkExecutionStatus({ className, label, run, ref, ...props }) {
|
|
17
|
+
const status = getThinkExecutionRunStatus(run);
|
|
18
|
+
const tone = getThinkExecutionRunStatusTone(run);
|
|
19
|
+
const accessibleLabel = label ?? `Status: ${formatThinkExecutionStatus(status)}`;
|
|
20
|
+
return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { render: /* @__PURE__ */ jsx("span", {
|
|
21
|
+
ref,
|
|
22
|
+
"aria-label": accessibleLabel,
|
|
23
|
+
className: cx("think-execution-status", className),
|
|
24
|
+
"data-status": status,
|
|
25
|
+
"data-tone": tone,
|
|
26
|
+
role: "img",
|
|
27
|
+
...props,
|
|
28
|
+
children: statusIcon(tone)
|
|
29
|
+
}) }), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
30
|
+
side: "top",
|
|
31
|
+
sideOffset: 6,
|
|
32
|
+
children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: accessibleLabel })
|
|
33
|
+
}) })] });
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ThinkExecutionStatus };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { Think } from "@cloudflare/think";
|
|
3
4
|
import { AgentStub } from "agents/client";
|
|
@@ -9,6 +10,10 @@ interface ThinkExecutionWorkbenchProps extends Omit<React.HTMLAttributes<HTMLDiv
|
|
|
9
10
|
title?: React.ReactNode;
|
|
10
11
|
backButton?: React.ReactNode;
|
|
11
12
|
pageSize?: number;
|
|
13
|
+
/** Whole native execution selected by a parent-owned route or product record. */
|
|
14
|
+
selectedRun?: ThinkExecutionRun | null;
|
|
15
|
+
/** Receives the fully inspected native execution after a user selects a row. */
|
|
16
|
+
onSelectedRunChange?: (run: ThinkExecutionRun) => void;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* Unified execution history for native Think submissions and Agents workflows.
|
|
@@ -18,8 +23,10 @@ interface ThinkExecutionWorkbenchProps extends Omit<React.HTMLAttributes<HTMLDiv
|
|
|
18
23
|
declare function ThinkExecutionWorkbench({
|
|
19
24
|
backButton,
|
|
20
25
|
className,
|
|
26
|
+
onSelectedRunChange,
|
|
21
27
|
pageSize,
|
|
22
28
|
ref,
|
|
29
|
+
selectedRun: controlledSelectedRun,
|
|
23
30
|
source,
|
|
24
31
|
title,
|
|
25
32
|
...props
|