@mcp-b/react-components 0.16.0 → 0.17.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/{AgentChat-CrlpbvQJ.d.ts → AgentChat-CRuMi1Pb.d.ts} +4 -10
- package/dist/AgentMessageParts-CyD2UB3V.d.ts +46 -0
- package/dist/AgentToolRunsContext-BVe4stgw.d.ts +21 -0
- package/dist/{CodeBlock-BmB4Xaqq.js → CodeBlock-Co1noLbC.js} +2 -2
- package/dist/{CodeBlock-BRajW4QU.d.ts → CodeBlock-Dnpr88ZQ.d.ts} +2 -2
- package/dist/Collapsible-N64ASIQr.d.ts +119 -0
- package/dist/{Combobox-B9Fcd6q-.d.ts → Combobox-CYc37s5l.d.ts} +11 -33
- package/dist/{FileTree-CkVbIMWV.js → FileTree-B7bBsUyU.js} +7 -7
- package/dist/{Menu-Bgu-ufb5.d.ts → Menu-L6MZm-7N.d.ts} +15 -56
- package/dist/{Message-BkMdE3bS.js → Message-C4eYRogZ.js} +3 -3
- package/dist/{ModelSelector-SlJNgwKY.js → ModelSelector-BNrZlY_Y.js} +5 -5
- package/dist/{PromptInput-BWTuXMOD.d.ts → PromptInput-OLfXPuHM.d.ts} +39 -67
- package/dist/{ResponsiveSidebarShell-Dd9DCcBT.d.ts → ResponsiveSidebarShell-CsAh4NyL.d.ts} +1 -0
- package/dist/{Select-BeEsefzh.d.ts → Select-CwSqP07Y.d.ts} +14 -42
- package/dist/{Tabs-3Zc4tb9D.d.ts → Tabs-9zddXDQo.d.ts} +5 -19
- package/dist/{ThinkChat-CzC-zNGA.js → ThinkChat-DInElus-.js} +53 -26
- package/dist/{ThinkChatActivity-BFQnb2ct.d.ts → ThinkChatActivity-BgesTfZ4.d.ts} +12 -4
- package/dist/{ThinkChatContext-C3Eb1Xpi.d.ts → ThinkChatContext-DrsZqdaO.d.ts} +1 -1
- package/dist/ThinkRecoveryNotice-DFIcG9UX.d.ts +19 -0
- package/dist/{Toggle-CAAlNl-M.d.ts → Toggle-DaXpe1Lc.d.ts} +1 -1
- package/dist/{ToggleGroup-8hPv-b69.d.ts → ToggleGroup-yseEWkOC.d.ts} +3 -4
- package/dist/{Workspace-D39LxGvP.d.ts → Workspace-C9RFoxcu.d.ts} +1 -1
- package/dist/WorkspaceExplorer-sZewzT2O.d.ts +32 -0
- package/dist/{WorkspaceFile-DOZkPwzu.d.ts → WorkspaceFile-C8UzuSH4.d.ts} +1 -1
- package/dist/{WorkspaceFileView-rSN_yT0L.js → WorkspaceFileView-DNdGAEiX.js} +5 -5
- package/dist/{WorkspaceLink-DIPbXrUM.js → WorkspaceLink-B1ykV1dS.js} +15 -29
- package/dist/class-names-Bk-QLWWI.js +11 -0
- package/dist/components/Accordion.d.ts +5 -15
- package/dist/components/Accordion.js +11 -10
- package/dist/components/Activity.d.ts +5 -10
- package/dist/components/Activity.js +2 -2
- package/dist/components/AgentActivity.js +1 -1
- package/dist/components/AgentActivityPreview.js +2 -2
- package/dist/components/AgentAttention.d.ts +1 -1
- package/dist/components/AgentAttention.js +1 -1
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +27 -164
- package/dist/components/AgentChatMessageEditor.js +1 -1
- package/dist/components/AgentConnection.js +4 -4
- package/dist/components/AgentMessageParts.d.ts +2 -0
- package/dist/components/AgentMessageParts.js +119 -0
- package/dist/components/AgentToolDetail.d.ts +55 -0
- package/dist/components/AgentToolDetail.js +98 -0
- package/dist/components/AgentToolRunsContext.d.ts +2 -0
- package/dist/components/AgentToolRunsContext.js +16 -0
- package/dist/components/AlertDialog.d.ts +7 -19
- package/dist/components/AlertDialog.js +21 -32
- package/dist/components/AppTopBar.d.ts +4 -1
- package/dist/components/AppTopBar.js +5 -5
- package/dist/components/Approval.d.ts +102 -0
- package/dist/components/Approval.js +227 -0
- package/dist/components/Artifact.d.ts +2 -4
- package/dist/components/Artifact.js +3 -3
- package/dist/components/Autocomplete.d.ts +11 -33
- package/dist/components/Autocomplete.js +23 -30
- package/dist/components/Avatar.d.ts +3 -11
- package/dist/components/Avatar.js +13 -12
- package/dist/components/BrowserLiveView.js +2 -2
- package/dist/components/BrowserReplay.js +2 -2
- package/dist/components/BrowserRunPanel.js +58 -78
- package/dist/components/Button.js +4 -9
- package/dist/components/ChainOfThought.d.ts +5 -11
- package/dist/components/ChainOfThought.js +3 -2
- package/dist/components/ChatGptSignInScreen.js +3 -3
- package/dist/components/Checkbox.d.ts +2 -4
- package/dist/components/Checkbox.js +6 -5
- package/dist/components/CheckboxGroup.d.ts +1 -3
- package/dist/components/CheckboxGroup.js +15 -14
- package/dist/components/Checkpoint.d.ts +64 -0
- package/dist/components/Checkpoint.js +63 -0
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.d.ts +1 -1
- package/dist/components/CodexModelSelector.js +2 -2
- package/dist/components/Collapsible.d.ts +1 -124
- package/dist/components/Collapsible.js +7 -10
- package/dist/components/Combobox.d.ts +1 -1
- package/dist/components/Combobox.js +23 -30
- package/dist/components/Commit.d.ts +5 -11
- package/dist/components/Commit.js +6 -5
- package/dist/components/Context.js +1 -1
- package/dist/components/ContextMenu.d.ts +21 -37
- package/dist/components/ContextMenu.js +34 -51
- package/dist/components/Conversation.d.ts +2 -4
- package/dist/components/Conversation.js +2 -2
- package/dist/components/DescriptionListParts.js +1 -1
- package/dist/components/Dialog.d.ts +6 -17
- package/dist/components/Dialog.js +17 -24
- package/dist/components/EnvironmentVariables.d.ts +1 -1
- package/dist/components/EnvironmentVariables.js +4 -3
- package/dist/components/Field.d.ts +17 -20
- package/dist/components/Field.js +16 -16
- package/dist/components/Fieldset.d.ts +2 -7
- package/dist/components/Fieldset.js +7 -6
- package/dist/components/FileTree.js +1 -1
- package/dist/components/Form.d.ts +1 -4
- package/dist/components/Form.js +3 -2
- package/dist/components/GithubMotionMark.js +1 -1
- package/dist/components/InlineCitation.d.ts +66 -0
- package/dist/components/InlineCitation.js +142 -0
- package/dist/components/Input.d.ts +1 -4
- package/dist/components/Input.js +3 -2
- package/dist/components/Marker.js +1 -1
- package/dist/components/McpConnectionRequest.js +2 -2
- package/dist/components/McpServerPicker.d.ts +1 -1
- package/dist/components/McpServerPicker.js +6 -5
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/Menu.js +33 -52
- package/dist/components/Menubar.d.ts +22 -43
- package/dist/components/Menubar.js +36 -53
- package/dist/components/Message.d.ts +3 -6
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.d.ts +1 -1
- package/dist/components/MessageScroller.js +3 -3
- package/dist/components/Meter.d.ts +5 -20
- package/dist/components/Meter.js +11 -10
- package/dist/components/ModelSelector.d.ts +2 -6
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NavigationMenu.d.ts +11 -33
- package/dist/components/NavigationMenu.js +23 -30
- package/dist/components/NumberField.d.ts +6 -24
- package/dist/components/NumberField.js +13 -12
- package/dist/components/Plan.d.ts +103 -0
- package/dist/components/Plan.js +113 -0
- package/dist/components/Popover.d.ts +9 -36
- package/dist/components/Popover.js +23 -34
- package/dist/components/PreviewCard.d.ts +6 -24
- package/dist/components/PreviewCard.js +13 -24
- package/dist/components/PricingBillingToggle.js +1 -1
- package/dist/components/PricingFAQ.js +1 -1
- package/dist/components/PricingPlanCard.js +3 -3
- package/dist/components/PricingUsageCalculator.js +2 -2
- package/dist/components/Progress.d.ts +3 -8
- package/dist/components/Progress.js +7 -10
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +52 -200
- package/dist/components/Queue.d.ts +6 -16
- package/dist/components/Queue.js +2 -2
- package/dist/components/RadioGroup.d.ts +3 -8
- package/dist/components/RadioGroup.js +7 -10
- package/dist/components/Reasoning.d.ts +4 -8
- package/dist/components/Reasoning.js +3 -3
- package/dist/components/ResizableSidePanel.js +2 -2
- package/dist/components/ResponsiveSidebarShell.d.ts +1 -1
- package/dist/components/ResponsiveSidebarShell.js +4 -3
- package/dist/components/ScrollArea.d.ts +5 -20
- package/dist/components/ScrollArea.js +11 -10
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +32 -55
- package/dist/components/Separator.d.ts +1 -5
- package/dist/components/Separator.js +3 -6
- package/dist/components/Slider.d.ts +6 -19
- package/dist/components/Slider.js +15 -14
- package/dist/components/Sources.d.ts +4 -9
- package/dist/components/Sources.js +3 -2
- package/dist/components/Stepper.js +2 -2
- package/dist/components/SubagentRunDetails.js +1 -1
- package/dist/components/SubagentRunIndicator.js +2 -2
- package/dist/components/SubagentRunList.js +1 -2
- package/dist/components/SubagentRunSelector.d.ts +2 -11
- package/dist/components/SubagentRunSelector.js +16 -15
- package/dist/components/Switch.d.ts +2 -5
- package/dist/components/Switch.js +5 -8
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +10 -16
- package/dist/components/Task.d.ts +4 -9
- package/dist/components/Task.js +4 -3
- package/dist/components/Terminal.d.ts +2 -3
- package/dist/components/Terminal.js +3 -3
- package/dist/components/TestResults.d.ts +4 -9
- package/dist/components/TestResults.js +3 -2
- package/dist/components/Textarea.js +1 -1
- package/dist/components/ThemeModeControl.js +1 -1
- package/dist/components/ThinkChat.d.ts +21 -11
- package/dist/components/ThinkChat.js +5 -3
- package/dist/components/ThinkChatActivity.d.ts +1 -1
- package/dist/components/ThinkChatActivity.js +26 -7
- package/dist/components/ThinkChatContext.d.ts +1 -1
- package/dist/components/ThinkChatToolPanels.js +2 -2
- package/dist/components/ThinkExecutionDetail.js +2 -2
- package/dist/components/ThinkExecutionStatus.js +2 -2
- package/dist/components/ThinkExecutionWorkbench.js +2 -2
- package/dist/components/ThinkFullApp.d.ts +33 -9
- package/dist/components/ThinkFullApp.js +118 -64
- package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
- package/dist/components/ThinkFullAppViewSwitch.js +2 -2
- package/dist/components/ThinkPendingApproval.d.ts +60 -0
- package/dist/components/ThinkPendingApproval.js +99 -0
- package/dist/components/ThinkRecoveryNotice.d.ts +2 -0
- package/dist/components/ThinkRecoveryNotice.js +40 -0
- package/dist/components/ThinkRoutine.js +1 -0
- package/dist/components/ThinkRoutineBrowser.js +6 -6
- package/dist/components/ThinkRoutineDetail.js +1 -1
- package/dist/components/ThinkRoutineForm.js +2 -2
- package/dist/components/ThinkRoutineLibrary.d.ts +9 -0
- package/dist/components/ThinkRoutineLibrary.js +67 -20
- package/dist/components/ThinkRoutineRuns.js +1 -1
- package/dist/components/ThinkThreadPicker.js +2 -2
- package/dist/components/ThinkThreadShell.d.ts +1 -1
- package/dist/components/Toast.d.ts +7 -28
- package/dist/components/Toast.js +15 -14
- package/dist/components/Toggle.d.ts +1 -1
- package/dist/components/Toggle.js +5 -5
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +8 -15
- package/dist/components/ToolApproval.d.ts +28 -0
- package/dist/components/ToolApproval.js +35 -0
- package/dist/components/ToolInvocation.d.ts +26 -0
- package/dist/components/ToolInvocation.js +72 -0
- package/dist/components/Toolbar.d.ts +6 -24
- package/dist/components/Toolbar.js +13 -12
- package/dist/components/Tooltip.d.ts +3 -9
- package/dist/components/Tooltip.js +7 -10
- package/dist/components/WebPreview.d.ts +1 -2
- package/dist/components/WebPreview.js +4 -3
- package/dist/components/Workspace.d.ts +1 -1
- package/dist/components/Workspace.js +5 -20
- package/dist/components/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/WorkspaceBrowser.js +3 -3
- package/dist/components/WorkspaceExplorer.d.ts +3 -31
- package/dist/components/WorkspaceExplorer.js +3 -3
- package/dist/components/WorkspaceFile.d.ts +1 -1
- package/dist/components/WorkspaceFileView.d.ts +1 -1
- package/dist/components/WorkspaceFileView.js +1 -1
- package/dist/components/WorkspaceHeader.js +1 -1
- package/dist/components/WorkspaceLink.js +1 -1
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DtPMgN7e.d.ts → copy-button-CQx3LQAC.d.ts} +1 -2
- package/dist/{copy-button-Dejn5heL.js → copy-button-cYsJBauI.js} +1 -1
- package/dist/{icons-CpfUer49.js → icons--FqCZEc3.js} +3 -2
- package/dist/{icons-GQd1xF4e.d.ts → icons-DpUqY8Mp.d.ts} +6 -1
- package/dist/styles/agent-activity-preview.css +13 -11
- package/dist/styles/agent-attention.css +19 -13
- package/dist/styles/agent-chat.css +0 -41
- package/dist/styles/agent-connection.css +9 -21
- package/dist/styles/agent-tool-detail.css +54 -0
- package/dist/styles/alert-dialog.css +11 -11
- package/dist/styles/app-top-bar.css +9 -7
- package/dist/styles/approval.css +172 -0
- package/dist/styles/artifact.css +0 -12
- package/dist/styles/browser-run-panel.css +5 -2
- package/dist/styles/card.css +8 -8
- package/dist/styles/chain-of-thought.css +5 -13
- package/dist/styles/checkpoint.css +58 -0
- package/dist/styles/codex-model-selector.css +3 -3
- package/dist/styles/combobox.css +3 -2
- package/dist/styles/commit.css +0 -21
- package/dist/styles/context-menu.css +1 -9
- package/dist/styles/dialog.css +11 -11
- package/dist/styles/environment-variables.css +0 -13
- package/dist/styles/field.css +14 -14
- package/dist/styles/fieldset.css +5 -5
- package/dist/styles/file-tree.css +0 -16
- package/dist/styles/index.css +8 -4
- package/dist/styles/inline-citation.css +107 -0
- package/dist/styles/mcp-connection-request.css +3 -3
- package/dist/styles/mcp-server-picker.css +1 -30
- package/dist/styles/menu.css +1 -30
- package/dist/styles/menubar.css +0 -8
- package/dist/styles/message-scroller.css +0 -12
- package/dist/styles/message.css +0 -12
- package/dist/styles/model-selector.css +18 -32
- package/dist/styles/plan.css +127 -0
- package/dist/styles/popover.css +7 -43
- package/dist/styles/preview-card.css +1 -1
- package/dist/styles/prompt-input.css +2 -195
- package/dist/styles/recipes.css +139 -12
- package/dist/styles/responsive-sidebar-shell.css +16 -19
- package/dist/styles/select.css +3 -3
- package/dist/styles/sources.css +6 -14
- package/dist/styles/subagent-run.css +12 -70
- package/dist/styles/task.css +17 -26
- package/dist/styles/test-results.css +17 -23
- package/dist/styles/textarea.css +1 -1
- package/dist/styles/think-execution-workbench.css +9 -9
- package/dist/styles/think-full-app.css +49 -33
- package/dist/styles/think-routine-library.css +30 -38
- package/dist/styles/think-thread-picker.css +15 -0
- package/dist/styles/toast.css +4 -11
- package/dist/styles/tooltip.css +1 -1
- package/dist/styles/utilities.css +31 -0
- package/dist/styles/web-preview.css +0 -21
- package/dist/styles/workspace-explorer.css +20 -65
- package/dist/think-agent-Cip5KAPj.d.ts +7 -0
- package/dist/utils/codex-model-catalog.d.ts +4 -4
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/workspace-path-L_KmjRjq.js +26 -0
- package/package.json +3 -4
- package/dist/class-names-9UtZwb0J.js +0 -12
- package/dist/components/AppFrame.d.ts +0 -24
- package/dist/components/AppFrame.js +0 -25
- package/dist/components/Shell.d.ts +0 -163
- package/dist/components/Shell.js +0 -137
- package/dist/components/SubagentRun.d.ts +0 -86
- package/dist/components/SubagentRun.js +0 -108
- package/dist/styles/app-frame.css +0 -15
- package/dist/styles/shell.css +0 -122
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-Bk-QLWWI.js";
|
|
2
|
+
import { V as SpinnerIcon } from "../icons--FqCZEc3.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Field } from "./Field.js";
|
|
5
5
|
import { Form } from "./Form.js";
|
|
@@ -27,8 +27,14 @@ interface ThinkRoutineLibraryProps<TRoutine extends ThinkRoutine = ThinkRoutine>
|
|
|
27
27
|
defaultSelectedRoutineId?: string;
|
|
28
28
|
/** Called when the user selects a routine from the collection. */
|
|
29
29
|
onSelectedRoutineIdChange?: (routineId: string) => void;
|
|
30
|
+
/** Product navigation rendered after the built-in schedule navigation control. */
|
|
31
|
+
appBarLeading?: React.ReactNode;
|
|
32
|
+
/** Opens a host-owned create route instead of the library's built-in form. */
|
|
33
|
+
onCreateRoutineRequest?: () => void;
|
|
30
34
|
/** Creates an app-owned routine from a whole native Think scheduled task. */
|
|
31
35
|
onCreateRoutine?: (request: ThinkRoutineCreateRequest) => void | Promise<void>;
|
|
36
|
+
/** Opens a host-owned editor for the selected routine. */
|
|
37
|
+
onEditRoutine?: (routine: TRoutine) => void;
|
|
32
38
|
/** Starts the selected routine immediately. */
|
|
33
39
|
onRunRoutine?: (routine: TRoutine) => void | Promise<void>;
|
|
34
40
|
/** Activates or pauses the selected app-owned routine. */
|
|
@@ -52,10 +58,13 @@ interface ThinkRoutineLibraryProps<TRoutine extends ThinkRoutine = ThinkRoutine>
|
|
|
52
58
|
* surfaces independently.
|
|
53
59
|
*/
|
|
54
60
|
declare function ThinkRoutineLibrary<TRoutine extends ThinkRoutine = ThinkRoutine>({
|
|
61
|
+
appBarLeading,
|
|
55
62
|
className,
|
|
56
63
|
defaultSelectedRoutineId,
|
|
57
64
|
onCreateRoutine,
|
|
65
|
+
onCreateRoutineRequest,
|
|
58
66
|
onDeleteRoutine,
|
|
67
|
+
onEditRoutine,
|
|
59
68
|
onRoutineEnabledChange,
|
|
60
69
|
onRunRoutine,
|
|
61
70
|
onRunSelect,
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-Bk-QLWWI.js";
|
|
2
|
+
import { F as PlayIcon, J as WarningIcon, V as SpinnerIcon, g as EllipsisIcon, n as ArrowLeftIcon } from "../icons--FqCZEc3.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
3
4
|
import { Menu } from "./Menu.js";
|
|
4
5
|
import { AppTopBar } from "./AppTopBar.js";
|
|
6
|
+
import { AlertDialog } from "./AlertDialog.js";
|
|
5
7
|
import { ResponsiveSidebarShell } from "./ResponsiveSidebarShell.js";
|
|
6
8
|
import { ThinkRoutineBrowser } from "./ThinkRoutineBrowser.js";
|
|
7
9
|
import { ThinkRoutineDetail } from "./ThinkRoutineDetail.js";
|
|
8
10
|
import { ThinkRoutineForm } from "./ThinkRoutineForm.js";
|
|
9
11
|
import * as React from "react";
|
|
10
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
13
|
//#region src/components/ThinkRoutineLibrary.tsx
|
|
12
14
|
function errorMessage(error) {
|
|
13
15
|
return error instanceof Error ? error.message : String(error);
|
|
14
16
|
}
|
|
15
|
-
function RoutineTopBarActions({ busy, onDelete, onRun }) {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
function RoutineTopBarActions({ busy, onDelete, onEdit, onRun, routineName }) {
|
|
18
|
+
const [deleteOpen, setDeleteOpen] = React.useState(false);
|
|
19
|
+
const moreActionsRef = React.useRef(null);
|
|
20
|
+
const hasMenu = Boolean(onEdit || onDelete);
|
|
21
|
+
if (!onRun && !hasMenu) return null;
|
|
22
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(AppTopBar.Trailing, {
|
|
18
23
|
"aria-label": "Schedule actions",
|
|
19
24
|
children: [onRun ? /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
20
25
|
label: "Run schedule",
|
|
@@ -22,23 +27,52 @@ function RoutineTopBarActions({ busy, onDelete, onRun }) {
|
|
|
22
27
|
disabled: busy,
|
|
23
28
|
onClick: onRun,
|
|
24
29
|
children: busy ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(PlayIcon, {})
|
|
25
|
-
}) : null,
|
|
30
|
+
}) : null, hasMenu ? /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
26
31
|
label: "More schedule actions",
|
|
27
32
|
tooltip: "More actions",
|
|
28
33
|
disabled: busy,
|
|
29
|
-
render: /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
34
|
+
render: /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
35
|
+
ref: moreActionsRef,
|
|
36
|
+
unstyled: true
|
|
37
|
+
}),
|
|
30
38
|
children: /* @__PURE__ */ jsx(EllipsisIcon, {})
|
|
31
39
|
}), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
32
40
|
align: "end",
|
|
33
41
|
sideOffset: 4,
|
|
34
|
-
children: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ jsxs(Menu.Popup, { children: [onEdit ? /* @__PURE__ */ jsx(Menu.Item, {
|
|
43
|
+
onClick: onEdit,
|
|
44
|
+
children: "Edit schedule"
|
|
45
|
+
}) : null, onDelete ? /* @__PURE__ */ jsx(Menu.Item, {
|
|
35
46
|
variant: "destructive",
|
|
36
47
|
disabled: busy,
|
|
37
|
-
onClick:
|
|
48
|
+
onClick: () => setDeleteOpen(true),
|
|
38
49
|
children: "Delete schedule"
|
|
39
|
-
}) })
|
|
50
|
+
}) : null] })
|
|
40
51
|
}) })] }) : null]
|
|
41
|
-
})
|
|
52
|
+
}), onDelete ? /* @__PURE__ */ jsx(AlertDialog.Root, {
|
|
53
|
+
open: deleteOpen,
|
|
54
|
+
onOpenChange: setDeleteOpen,
|
|
55
|
+
children: /* @__PURE__ */ jsxs(AlertDialog.Portal, { children: [/* @__PURE__ */ jsx(AlertDialog.Backdrop, {}), /* @__PURE__ */ jsx(AlertDialog.Viewport, { children: /* @__PURE__ */ jsxs(AlertDialog.Popup, {
|
|
56
|
+
finalFocus: moreActionsRef,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsxs(AlertDialog.Title, { children: [
|
|
59
|
+
"Delete ",
|
|
60
|
+
routineName,
|
|
61
|
+
"?"
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsx(AlertDialog.Description, { children: "This permanently deletes the schedule and stops its future runs." }),
|
|
64
|
+
/* @__PURE__ */ jsxs(AlertDialog.Footer, { children: [/* @__PURE__ */ jsx(AlertDialog.Close, {
|
|
65
|
+
disabled: busy,
|
|
66
|
+
children: "Cancel"
|
|
67
|
+
}), /* @__PURE__ */ jsx(AlertDialog.Close, {
|
|
68
|
+
variant: "destructive",
|
|
69
|
+
disabled: busy,
|
|
70
|
+
onClick: onDelete,
|
|
71
|
+
children: "Delete schedule"
|
|
72
|
+
})] })
|
|
73
|
+
]
|
|
74
|
+
}) })] })
|
|
75
|
+
}) : null] });
|
|
42
76
|
}
|
|
43
77
|
/**
|
|
44
78
|
* Full-page, cross-agent routine library. This intentionally does not live in
|
|
@@ -48,7 +82,7 @@ function RoutineTopBarActions({ busy, onDelete, onRun }) {
|
|
|
48
82
|
* `ThinkRoutineRuns`, and `ThinkRoutineForm`; consumers may also use those
|
|
49
83
|
* surfaces independently.
|
|
50
84
|
*/
|
|
51
|
-
function ThinkRoutineLibrary({ className, defaultSelectedRoutineId, onCreateRoutine, onDeleteRoutine, onRoutineEnabledChange, onRunRoutine, onRunSelect, onSelectedRoutineIdChange, owners, renderRoutineDetail, schedules, ref, routines, selectedRoutineId, ...props }) {
|
|
85
|
+
function ThinkRoutineLibrary({ appBarLeading, className, defaultSelectedRoutineId, onCreateRoutine, onCreateRoutineRequest, onDeleteRoutine, onEditRoutine, onRoutineEnabledChange, onRunRoutine, onRunSelect, onSelectedRoutineIdChange, owners, renderRoutineDetail, schedules, ref, routines, selectedRoutineId, ...props }) {
|
|
52
86
|
const [view, setView] = React.useState("library");
|
|
53
87
|
const [innerSelectedId, setInnerSelectedId] = React.useState(defaultSelectedRoutineId ?? routines[0]?.id ?? "");
|
|
54
88
|
const [busy, setBusy] = React.useState(false);
|
|
@@ -56,6 +90,7 @@ function ThinkRoutineLibrary({ className, defaultSelectedRoutineId, onCreateRout
|
|
|
56
90
|
const [error, setError] = React.useState(null);
|
|
57
91
|
const activeId = selectedRoutineId ?? innerSelectedId;
|
|
58
92
|
const selectedRoutine = routines.find((routine) => routine.id === activeId) ?? (selectedRoutineId === void 0 ? routines[0] : void 0);
|
|
93
|
+
const requestCreate = onCreateRoutineRequest ?? (onCreateRoutine ? () => setView("create") : void 0);
|
|
59
94
|
const selectRoutine = (id) => {
|
|
60
95
|
if (selectedRoutineId === void 0) setInnerSelectedId(id);
|
|
61
96
|
onSelectedRoutineIdChange?.(id);
|
|
@@ -92,11 +127,11 @@ function ThinkRoutineLibrary({ className, defaultSelectedRoutineId, onCreateRout
|
|
|
92
127
|
}) : null,
|
|
93
128
|
/* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
94
129
|
"aria-label": "Schedule editor controls",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
130
|
+
children: [/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [/* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
96
131
|
label: "Back to schedules",
|
|
97
132
|
onClick: () => setView("library"),
|
|
98
133
|
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
99
|
-
}) }), /* @__PURE__ */ jsx(AppTopBar.Title, { children: "New schedule" })]
|
|
134
|
+
}), appBarLeading] }), /* @__PURE__ */ jsx(AppTopBar.Title, { children: "New schedule" })]
|
|
100
135
|
}),
|
|
101
136
|
/* @__PURE__ */ jsx(ThinkRoutineForm, {
|
|
102
137
|
busy,
|
|
@@ -111,7 +146,7 @@ function ThinkRoutineLibrary({ className, defaultSelectedRoutineId, onCreateRout
|
|
|
111
146
|
}
|
|
112
147
|
}),
|
|
113
148
|
/* @__PURE__ */ jsx("div", {
|
|
114
|
-
className: "think-routine-library__status",
|
|
149
|
+
className: "think-routine-library__status sigvelo-visually-hidden",
|
|
115
150
|
role: "status",
|
|
116
151
|
"aria-atomic": "true",
|
|
117
152
|
children: announcement
|
|
@@ -136,11 +171,13 @@ function ThinkRoutineLibrary({ className, defaultSelectedRoutineId, onCreateRout
|
|
|
136
171
|
topBar: ({ sidebarToggle }) => /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
137
172
|
"aria-label": "Schedule controls",
|
|
138
173
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [sidebarToggle, appBarLeading] }),
|
|
140
175
|
/* @__PURE__ */ jsx(AppTopBar.Title, { children: selectedRoutine?.name ?? "Schedules" }),
|
|
141
176
|
/* @__PURE__ */ jsx(RoutineTopBarActions, {
|
|
142
177
|
busy,
|
|
178
|
+
routineName: selectedRoutine?.name ?? "schedule",
|
|
143
179
|
onRun: selectedRoutine && onRunRoutine ? () => void perform(() => onRunRoutine(selectedRoutine), `Started ${selectedRoutine.name}.`) : void 0,
|
|
180
|
+
onEdit: selectedRoutine && onEditRoutine ? () => onEditRoutine(selectedRoutine) : void 0,
|
|
144
181
|
onDelete: selectedRoutine && onDeleteRoutine ? () => void perform(() => onDeleteRoutine(selectedRoutine), `Deleted ${selectedRoutine.name}.`) : void 0
|
|
145
182
|
})
|
|
146
183
|
]
|
|
@@ -148,7 +185,7 @@ function ThinkRoutineLibrary({ className, defaultSelectedRoutineId, onCreateRout
|
|
|
148
185
|
sidebar: ({ closeSidebarOnCompact }) => /* @__PURE__ */ jsx(ThinkRoutineBrowser, {
|
|
149
186
|
routines,
|
|
150
187
|
selectedRoutineId: selectedRoutine?.id,
|
|
151
|
-
onCreateRoutine:
|
|
188
|
+
onCreateRoutine: requestCreate,
|
|
152
189
|
onSelectedRoutineIdChange: (id) => {
|
|
153
190
|
selectRoutine(id);
|
|
154
191
|
closeSidebarOnCompact();
|
|
@@ -161,12 +198,22 @@ function ThinkRoutineLibrary({ className, defaultSelectedRoutineId, onCreateRout
|
|
|
161
198
|
defaultDetail: /* @__PURE__ */ jsx(ThinkRoutineDetail, { ...detailProps })
|
|
162
199
|
}) : /* @__PURE__ */ jsx(ThinkRoutineDetail, { ...detailProps }) }, detailProps.routine.id) : /* @__PURE__ */ jsxs("div", {
|
|
163
200
|
className: "think-routine-library__empty-detail",
|
|
164
|
-
children: [
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ jsx("h1", { children: routines.length ? "Schedule unavailable" : "No schedules yet" }),
|
|
203
|
+
/* @__PURE__ */ jsx("p", { children: routines.length ? "Select an available schedule." : "Create a schedule to run recurring Think prompts." }),
|
|
204
|
+
!routines.length && requestCreate ? /* @__PURE__ */ jsx(Button, {
|
|
205
|
+
className: "think-routine-library__empty-action",
|
|
206
|
+
type: "button",
|
|
207
|
+
color: "primary",
|
|
208
|
+
onClick: requestCreate,
|
|
209
|
+
children: "Create schedule"
|
|
210
|
+
}) : null
|
|
211
|
+
]
|
|
165
212
|
})
|
|
166
213
|
})
|
|
167
214
|
}),
|
|
168
215
|
/* @__PURE__ */ jsx("div", {
|
|
169
|
-
className: "think-routine-library__status",
|
|
216
|
+
className: "think-routine-library__status sigvelo-visually-hidden",
|
|
170
217
|
role: "status",
|
|
171
218
|
"aria-atomic": "true",
|
|
172
219
|
children: announcement
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
1
|
+
import { t as cx } from "../class-names-Bk-QLWWI.js";
|
|
2
2
|
import { Button } from "./Button.js";
|
|
3
3
|
import { Badge } from "./Badge.js";
|
|
4
4
|
import { formatThinkExecutionShortTimestamp, getThinkExecutionRunId, getThinkExecutionRunStatus, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-Bk-QLWWI.js";
|
|
2
|
+
import { I as PlusIcon, J as WarningIcon, V as SpinnerIcon, m as DotIcon } from "../icons--FqCZEc3.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { ScrollArea } from "./ScrollArea.js";
|
|
5
5
|
import "react";
|
|
@@ -9,52 +9,31 @@ interface ToastProviderProps extends React.ComponentPropsWithoutRef<typeof Toast
|
|
|
9
9
|
/**
|
|
10
10
|
* Props for the Toast.Viewport component.
|
|
11
11
|
*/
|
|
12
|
-
interface ToastViewportProps extends
|
|
13
|
-
/** Additional CSS class names */
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
12
|
+
interface ToastViewportProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Viewport> {}
|
|
16
13
|
/**
|
|
17
14
|
* Props for the Toast.Root component.
|
|
18
15
|
*/
|
|
19
|
-
interface ToastRootProps extends
|
|
20
|
-
/** Additional CSS class names */
|
|
21
|
-
className?: string;
|
|
22
|
-
}
|
|
16
|
+
interface ToastRootProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Root> {}
|
|
23
17
|
/**
|
|
24
18
|
* Props for the Toast.Content component.
|
|
25
19
|
*/
|
|
26
|
-
interface ToastContentProps extends
|
|
27
|
-
/** Additional CSS class names */
|
|
28
|
-
className?: string;
|
|
29
|
-
}
|
|
20
|
+
interface ToastContentProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Content> {}
|
|
30
21
|
/**
|
|
31
22
|
* Props for the Toast.Title component.
|
|
32
23
|
*/
|
|
33
|
-
interface ToastTitleProps extends
|
|
34
|
-
/** Additional CSS class names */
|
|
35
|
-
className?: string;
|
|
36
|
-
}
|
|
24
|
+
interface ToastTitleProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Title> {}
|
|
37
25
|
/**
|
|
38
26
|
* Props for the Toast.Description component.
|
|
39
27
|
*/
|
|
40
|
-
interface ToastDescriptionProps extends
|
|
41
|
-
/** Additional CSS class names */
|
|
42
|
-
className?: string;
|
|
43
|
-
}
|
|
28
|
+
interface ToastDescriptionProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Description> {}
|
|
44
29
|
/**
|
|
45
30
|
* Props for the Toast.Action component.
|
|
46
31
|
*/
|
|
47
|
-
interface ToastActionProps extends
|
|
48
|
-
/** Additional CSS class names */
|
|
49
|
-
className?: string;
|
|
50
|
-
}
|
|
32
|
+
interface ToastActionProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Action> {}
|
|
51
33
|
/**
|
|
52
34
|
* Props for the Toast.Close component.
|
|
53
35
|
*/
|
|
54
|
-
interface ToastCloseProps extends
|
|
55
|
-
/** Additional CSS class names */
|
|
56
|
-
className?: string;
|
|
57
|
-
}
|
|
36
|
+
interface ToastCloseProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Close> {}
|
|
58
37
|
/**
|
|
59
38
|
* Container for displaying toasts.
|
|
60
39
|
*/
|
package/dist/components/Toast.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-Bk-QLWWI.js";
|
|
1
2
|
import "react";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { Toast as Toast$1 } from "@base-ui/react/toast";
|
|
@@ -21,8 +22,8 @@ const ToastProvider = (props) => {
|
|
|
21
22
|
/**
|
|
22
23
|
* Container for displaying toasts.
|
|
23
24
|
*/
|
|
24
|
-
function ToastViewport({ className
|
|
25
|
-
const classes = ["toast__viewport"
|
|
25
|
+
function ToastViewport({ className, ref, ...props }) {
|
|
26
|
+
const classes = mergeBaseClassName(["toast__viewport"].filter(Boolean).join(" "), className);
|
|
26
27
|
return /* @__PURE__ */ jsx(Toast$1.Viewport, {
|
|
27
28
|
ref,
|
|
28
29
|
"data-slot": "toast-viewport",
|
|
@@ -33,8 +34,8 @@ function ToastViewport({ className = "", ref, ...props }) {
|
|
|
33
34
|
/**
|
|
34
35
|
* Individual toast wrapper.
|
|
35
36
|
*/
|
|
36
|
-
function ToastRoot({ className
|
|
37
|
-
const classes = ["toast"
|
|
37
|
+
function ToastRoot({ className, ref, ...props }) {
|
|
38
|
+
const classes = mergeBaseClassName(["toast"].filter(Boolean).join(" "), className);
|
|
38
39
|
return /* @__PURE__ */ jsx(Toast$1.Root, {
|
|
39
40
|
ref,
|
|
40
41
|
"data-slot": "toast",
|
|
@@ -45,8 +46,8 @@ function ToastRoot({ className = "", ref, ...props }) {
|
|
|
45
46
|
/**
|
|
46
47
|
* Container for the contents of a toast.
|
|
47
48
|
*/
|
|
48
|
-
function ToastContent({ className
|
|
49
|
-
const classes = ["toast__content"
|
|
49
|
+
function ToastContent({ className, ref, ...props }) {
|
|
50
|
+
const classes = mergeBaseClassName(["toast__content"].filter(Boolean).join(" "), className);
|
|
50
51
|
return /* @__PURE__ */ jsx(Toast$1.Content, {
|
|
51
52
|
ref,
|
|
52
53
|
"data-slot": "toast-content",
|
|
@@ -57,8 +58,8 @@ function ToastContent({ className = "", ref, ...props }) {
|
|
|
57
58
|
/**
|
|
58
59
|
* Title that labels the toast. Renders an `<h2>` element.
|
|
59
60
|
*/
|
|
60
|
-
function ToastTitle({ className
|
|
61
|
-
const classes = ["toast__title"
|
|
61
|
+
function ToastTitle({ className, ref, ...props }) {
|
|
62
|
+
const classes = mergeBaseClassName(["toast__title"].filter(Boolean).join(" "), className);
|
|
62
63
|
return /* @__PURE__ */ jsx(Toast$1.Title, {
|
|
63
64
|
ref,
|
|
64
65
|
"data-slot": "toast-title",
|
|
@@ -69,8 +70,8 @@ function ToastTitle({ className = "", ref, ...props }) {
|
|
|
69
70
|
/**
|
|
70
71
|
* Description text for the toast. Renders a `<p>` element.
|
|
71
72
|
*/
|
|
72
|
-
function ToastDescription({ className
|
|
73
|
-
const classes = ["toast__description"
|
|
73
|
+
function ToastDescription({ className, ref, ...props }) {
|
|
74
|
+
const classes = mergeBaseClassName(["toast__description"].filter(Boolean).join(" "), className);
|
|
74
75
|
return /* @__PURE__ */ jsx(Toast$1.Description, {
|
|
75
76
|
ref,
|
|
76
77
|
"data-slot": "toast-description",
|
|
@@ -81,8 +82,8 @@ function ToastDescription({ className = "", ref, ...props }) {
|
|
|
81
82
|
/**
|
|
82
83
|
* Action button within the toast.
|
|
83
84
|
*/
|
|
84
|
-
function ToastAction({ className
|
|
85
|
-
const classes = ["toast__action"
|
|
85
|
+
function ToastAction({ className, ref, ...props }) {
|
|
86
|
+
const classes = mergeBaseClassName(["toast__action"].filter(Boolean).join(" "), className);
|
|
86
87
|
return /* @__PURE__ */ jsx(Toast$1.Action, {
|
|
87
88
|
ref,
|
|
88
89
|
"data-slot": "toast-action",
|
|
@@ -93,8 +94,8 @@ function ToastAction({ className = "", ref, ...props }) {
|
|
|
93
94
|
/**
|
|
94
95
|
* Close button that dismisses the toast.
|
|
95
96
|
*/
|
|
96
|
-
function ToastClose({ className
|
|
97
|
-
const classes = ["toast__close"
|
|
97
|
+
function ToastClose({ className, ref, ...props }) {
|
|
98
|
+
const classes = mergeBaseClassName(["toast__close"].filter(Boolean).join(" "), className);
|
|
98
99
|
return /* @__PURE__ */ jsx(Toast$1.Close, {
|
|
99
100
|
ref,
|
|
100
101
|
"data-slot": "toast-close",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as toggleVariants, n as ToggleProps, r as ToggleVariantsOptions, t as Toggle } from "../Toggle-
|
|
1
|
+
import { i as toggleVariants, n as ToggleProps, r as ToggleVariantsOptions, t as Toggle } from "../Toggle-DaXpe1Lc.js";
|
|
2
2
|
export { Toggle, ToggleProps, ToggleVariantsOptions, toggleVariants };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-Bk-QLWWI.js";
|
|
1
2
|
import "react";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
@@ -50,15 +51,14 @@ function toggleVariants({ variant = "default", size = "default", className } = {
|
|
|
50
51
|
*
|
|
51
52
|
* @see {@link https://base-ui.com/react/components/toggle | Base UI Toggle}
|
|
52
53
|
*/
|
|
53
|
-
function Toggle({ className
|
|
54
|
+
function Toggle({ className, variant, size, ref, ...props }) {
|
|
54
55
|
return /* @__PURE__ */ jsx(Toggle$1, {
|
|
55
56
|
ref,
|
|
56
57
|
"data-slot": "toggle",
|
|
57
|
-
className: toggleVariants({
|
|
58
|
+
className: mergeBaseClassName(toggleVariants({
|
|
58
59
|
variant,
|
|
59
|
-
size
|
|
60
|
-
|
|
61
|
-
}),
|
|
60
|
+
size
|
|
61
|
+
}), className),
|
|
62
62
|
...props
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ToggleGroupItemProps, r as ToggleGroupProps, t as ToggleGroup } from "../ToggleGroup-
|
|
1
|
+
import { n as ToggleGroupItemProps, r as ToggleGroupProps, t as ToggleGroup } from "../ToggleGroup-yseEWkOC.js";
|
|
2
2
|
export { ToggleGroup, ToggleGroupItemProps, ToggleGroupProps };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-Bk-QLWWI.js";
|
|
1
2
|
import { toggleVariants } from "./Toggle.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -37,7 +38,7 @@ function normalizeSize(size) {
|
|
|
37
38
|
*
|
|
38
39
|
* @see {@link https://base-ui.com/react/components/toggle-group | Base UI Toggle Group}
|
|
39
40
|
*/
|
|
40
|
-
function ToggleGroupRoot({ size = "md", spacing = 0, variant = "default", className
|
|
41
|
+
function ToggleGroupRoot({ size = "md", spacing = 0, variant = "default", className, children, style, ref, ...props }) {
|
|
41
42
|
const normalizedSize = normalizeSize(size);
|
|
42
43
|
const gap = `${spacing * .25}rem`;
|
|
43
44
|
const groupStyle = typeof style === "function" ? (state) => ({
|
|
@@ -53,11 +54,7 @@ function ToggleGroupRoot({ size = "md", spacing = 0, variant = "default", classN
|
|
|
53
54
|
"data-slot": "toggle-group",
|
|
54
55
|
"data-spacing": spacing,
|
|
55
56
|
"data-variant": variant,
|
|
56
|
-
className: [
|
|
57
|
-
"toggle-group",
|
|
58
|
-
size !== "md" && `toggle-group--${size}`,
|
|
59
|
-
className
|
|
60
|
-
].filter(Boolean).join(" "),
|
|
57
|
+
className: mergeBaseClassName(["toggle-group", size !== "md" && `toggle-group--${size}`].filter(Boolean).join(" "), className),
|
|
61
58
|
style: groupStyle,
|
|
62
59
|
...props,
|
|
63
60
|
children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, {
|
|
@@ -73,18 +70,14 @@ function ToggleGroupRoot({ size = "md", spacing = 0, variant = "default", classN
|
|
|
73
70
|
/**
|
|
74
71
|
* A single toggle item within a ToggleGroup.
|
|
75
72
|
*/
|
|
76
|
-
function ToggleGroupItem({ className
|
|
73
|
+
function ToggleGroupItem({ className, variant, size, ref, ...props }) {
|
|
77
74
|
const context = React.useContext(ToggleGroupContext);
|
|
78
75
|
const itemVariant = variant ?? context.variant;
|
|
79
76
|
const itemSize = size ?? context.size;
|
|
80
|
-
const classes = [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
size: itemSize
|
|
85
|
-
}),
|
|
86
|
-
className
|
|
87
|
-
].filter(Boolean).join(" ");
|
|
77
|
+
const classes = mergeBaseClassName(["toggle-group__item", toggleVariants({
|
|
78
|
+
variant: itemVariant,
|
|
79
|
+
size: itemSize
|
|
80
|
+
})].filter(Boolean).join(" "), className);
|
|
88
81
|
return /* @__PURE__ */ jsx(Toggle, {
|
|
89
82
|
ref,
|
|
90
83
|
"data-size": itemSize,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ChatAddToolApproveResponseFunction, DynamicToolUIPart, ToolUIPart } from "ai";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ToolApproval.d.ts
|
|
5
|
+
interface ToolApprovalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "part"> {
|
|
6
|
+
/** Whole upstream AI SDK tool part. Non-request states render nothing. */
|
|
7
|
+
part: ToolUIPart | DynamicToolUIPart;
|
|
8
|
+
/** Pass `addToolApprovalResponse` from the chat hook directly. */
|
|
9
|
+
onRespond: ChatAddToolApproveResponseFunction;
|
|
10
|
+
question?: React.ReactNode;
|
|
11
|
+
count?: number;
|
|
12
|
+
onSkip?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/** Actionable adapter for an AI SDK `approval-requested` tool part. */
|
|
15
|
+
declare function ToolApproval({
|
|
16
|
+
className,
|
|
17
|
+
count,
|
|
18
|
+
onRespond,
|
|
19
|
+
onSkip,
|
|
20
|
+
part,
|
|
21
|
+
question,
|
|
22
|
+
ref,
|
|
23
|
+
...props
|
|
24
|
+
}: ToolApprovalProps & {
|
|
25
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
26
|
+
}): React.JSX.Element | null;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ToolApproval, ToolApprovalProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Approval, ApprovalCount, ApprovalDecision, ApprovalHeader, ApprovalInputPreview, ApprovalQuestion } from "./Approval.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { getToolName } from "ai";
|
|
5
|
+
//#region src/components/ToolApproval.tsx
|
|
6
|
+
/** Actionable adapter for an AI SDK `approval-requested` tool part. */
|
|
7
|
+
function ToolApproval({ className, count, onRespond, onSkip, part, question, ref, ...props }) {
|
|
8
|
+
if (part.state !== "approval-requested") return null;
|
|
9
|
+
const toolName = part.title ?? getToolName(part);
|
|
10
|
+
return /* @__PURE__ */ jsxs(Approval, {
|
|
11
|
+
ref,
|
|
12
|
+
className,
|
|
13
|
+
"aria-label": `Approve ${toolName}`,
|
|
14
|
+
...props,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(ApprovalHeader, { children: [/* @__PURE__ */ jsx(ApprovalQuestion, { children: question ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
+
"Do you want to allow the agent to run ",
|
|
18
|
+
/* @__PURE__ */ jsx("code", { children: toolName }),
|
|
19
|
+
"?"
|
|
20
|
+
] }) }), count && count > 1 ? /* @__PURE__ */ jsxs(ApprovalCount, { children: ["1 of ", count] }) : null] }),
|
|
21
|
+
/* @__PURE__ */ jsx(ApprovalInputPreview, { input: part.input }),
|
|
22
|
+
/* @__PURE__ */ jsx(ApprovalDecision, {
|
|
23
|
+
subject: toolName,
|
|
24
|
+
onSkip,
|
|
25
|
+
onDecision: ({ approved, reason }) => onRespond({
|
|
26
|
+
id: part.approval.id,
|
|
27
|
+
approved,
|
|
28
|
+
reason
|
|
29
|
+
})
|
|
30
|
+
}, part.approval.id)
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ToolApproval };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DynamicToolUIPart, ToolUIPart } from "ai";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ToolInvocation.d.ts
|
|
4
|
+
/** One whole static or dynamic AI SDK tool UI part. */
|
|
5
|
+
type ToolInvocationPart = ToolUIPart | DynamicToolUIPart;
|
|
6
|
+
interface ToolInvocationProps {
|
|
7
|
+
/** The whole upstream AI SDK tool part, kept intact across every tool state. */
|
|
8
|
+
part: ToolInvocationPart;
|
|
9
|
+
/** Render the existing Activity disclosure expanded initially. */
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Read-only generic disclosure for one upstream AI SDK tool invocation.
|
|
14
|
+
*
|
|
15
|
+
* The component derives its name, state, input, output, denial, and error
|
|
16
|
+
* presentation from the whole `ToolUIPart | DynamicToolUIPart`. Approval
|
|
17
|
+
* response controls belong to transport-aware adapters rather than this
|
|
18
|
+
* transcript renderer. ThinkChat may replace this fallback with richer panels
|
|
19
|
+
* for known workspace, browser, fetch, session, skill, and execute tools.
|
|
20
|
+
*/
|
|
21
|
+
declare function ToolInvocation({
|
|
22
|
+
part,
|
|
23
|
+
defaultOpen
|
|
24
|
+
}: ToolInvocationProps): import("react").JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ToolInvocation, ToolInvocationPart, ToolInvocationProps };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Activity, ActivityContent, ActivityPanel, ActivityTrigger } from "./Activity.js";
|
|
2
|
+
import { getToolDisplayName, isToolPartFailed, isToolPartWorking } from "./ThinkChatToolParts.js";
|
|
3
|
+
import { t as summarizeToolInput } from "../summarize-tool-input-BUJsENSn.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { getToolName } from "ai";
|
|
6
|
+
import { getToolInput, getToolOutput, getToolPartState } from "@cloudflare/think/react";
|
|
7
|
+
//#region src/components/ToolInvocation.tsx
|
|
8
|
+
function formatToolValue(value) {
|
|
9
|
+
if (value === void 0) return void 0;
|
|
10
|
+
return typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
11
|
+
}
|
|
12
|
+
function describeToolPart(part) {
|
|
13
|
+
const name = getToolDisplayName(part);
|
|
14
|
+
let action;
|
|
15
|
+
switch (part.state) {
|
|
16
|
+
case "approval-requested":
|
|
17
|
+
action = `${name} awaiting approval`;
|
|
18
|
+
break;
|
|
19
|
+
case "approval-responded":
|
|
20
|
+
action = part.approval.approved ? `Running ${name}` : `${name} denied`;
|
|
21
|
+
break;
|
|
22
|
+
case "output-error":
|
|
23
|
+
action = `${name} failed`;
|
|
24
|
+
break;
|
|
25
|
+
case "output-denied":
|
|
26
|
+
action = `${name} denied`;
|
|
27
|
+
break;
|
|
28
|
+
case "output-available":
|
|
29
|
+
action = part.preliminary ? `Running ${name}` : `Ran ${name}`;
|
|
30
|
+
break;
|
|
31
|
+
case "input-streaming":
|
|
32
|
+
case "input-available":
|
|
33
|
+
action = `Running ${name}`;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
const detail = summarizeToolInput(getToolInput(part));
|
|
37
|
+
return detail ? `${action} · ${detail}` : action;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Read-only generic disclosure for one upstream AI SDK tool invocation.
|
|
41
|
+
*
|
|
42
|
+
* The component derives its name, state, input, output, denial, and error
|
|
43
|
+
* presentation from the whole `ToolUIPart | DynamicToolUIPart`. Approval
|
|
44
|
+
* response controls belong to transport-aware adapters rather than this
|
|
45
|
+
* transcript renderer. ThinkChat may replace this fallback with richer panels
|
|
46
|
+
* for known workspace, browser, fetch, session, skill, and execute tools.
|
|
47
|
+
*/
|
|
48
|
+
function ToolInvocation({ part, defaultOpen }) {
|
|
49
|
+
const state = getToolPartState(part);
|
|
50
|
+
const failed = isToolPartFailed(part);
|
|
51
|
+
const deniedReason = part.state === "output-denied" ? part.approval.reason : void 0;
|
|
52
|
+
const output = state === "error" ? part.errorText : state === "denied" ? deniedReason ?? "Denied" : formatToolValue(getToolOutput(part));
|
|
53
|
+
const inputStatus = part.state === "approval-requested" ? "awaiting approval" : part.state === "approval-responded" ? part.approval.approved ? "approved" : "denied" : void 0;
|
|
54
|
+
const outputStatus = state === "denied" ? "denied" : failed ? "error" : part.state === "output-available" && part.preliminary ? "preliminary" : void 0;
|
|
55
|
+
return /* @__PURE__ */ jsxs(Activity, {
|
|
56
|
+
isStreaming: isToolPartWorking(part),
|
|
57
|
+
defaultOpen,
|
|
58
|
+
children: [/* @__PURE__ */ jsx(ActivityTrigger, { label: describeToolPart(part) }), /* @__PURE__ */ jsxs(ActivityContent, { children: [/* @__PURE__ */ jsx(ActivityPanel, {
|
|
59
|
+
label: part.title ?? getToolName(part),
|
|
60
|
+
text: formatToolValue(getToolInput(part)),
|
|
61
|
+
status: inputStatus,
|
|
62
|
+
error: inputStatus === "denied"
|
|
63
|
+
}), output !== void 0 ? /* @__PURE__ */ jsx(ActivityPanel, {
|
|
64
|
+
label: "output",
|
|
65
|
+
text: output,
|
|
66
|
+
status: outputStatus,
|
|
67
|
+
error: failed
|
|
68
|
+
}) : null] })]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { ToolInvocation };
|