@mcp-b/react-components 0.47.0 → 0.49.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/AgentChatQueue-C_Jaw3Ia.d.ts +48 -0
- package/dist/AgentToolRunsContext-GMe_hSnD.d.ts +35 -0
- package/dist/Avatar-o2NO1fCG.d.ts +124 -0
- package/dist/{Button-CZt3yywF.d.ts → Button-DjONW5UW.d.ts} +1 -1
- package/dist/{CodeBlock-C380GD5t.d.ts → CodeBlock--r6GS8YV.d.ts} +8 -2
- package/dist/{CodeBlock-DMHZiw86.js → CodeBlock-g8sADidM.js} +7 -7
- package/dist/Correspondent-7K6uNLUm.d.ts +64 -0
- package/dist/{FileTree-BHebfvkK.js → FileTree-H8mMg4rV.js} +20 -29
- package/dist/{IconButton-BAUFhUk8.d.ts → IconButton-ByiyjkYE.d.ts} +2 -2
- package/dist/{Message-D_vCVEGB.d.ts → Message-DyaTBiV7.d.ts} +17 -4
- package/dist/MessageScrollerVirtual-D4afYwVB.d.ts +84 -0
- package/dist/{PromptInput-DtJHyp0S.d.ts → PromptInput-C4Mofitz.d.ts} +44 -31
- package/dist/PromptInputApproval-D2hpn54U.d.ts +44 -0
- package/dist/Separator-CzhtLYE1.d.ts +41 -0
- package/dist/Toolbar-CGY004u0.d.ts +155 -0
- package/dist/{Workspace-C_zHq9KZ.d.ts → Workspace-HzGrWDX3.d.ts} +14 -3
- package/dist/{WorkspaceFile-Dq-GC0_T.d.ts → WorkspaceFile-Bouauobc.d.ts} +1 -1
- package/dist/{WorkspaceFileView-ChIJz-fl.js → WorkspaceFileView-DYPtRVpM.js} +4 -3
- package/dist/{WorkspaceLink-B1d2GIGl.js → WorkspaceLink-BYZG-V_I.js} +8 -91
- package/dist/{WorkspaceMessageResponse-Dg_aNpoj.js → WorkspaceMessageResponse-CUJk9_P5.js} +6 -3
- package/dist/components/agents-sdk/AgentChat.d.ts +198 -2
- package/dist/components/agents-sdk/AgentChat.js +525 -670
- package/dist/components/agents-sdk/AgentChatQueue.d.ts +2 -0
- package/dist/components/agents-sdk/AgentChatQueue.js +206 -0
- package/dist/components/agents-sdk/AgentEvent.js +1 -1
- package/dist/components/agents-sdk/AgentToolRunsContext.d.ts +2 -2
- package/dist/components/agents-sdk/AgentToolRunsContext.js +1 -36
- package/dist/components/agents-sdk/BrowserLiveScreen.js +21 -13
- package/dist/components/agents-sdk/BrowserReplay.d.ts +1 -1
- package/dist/components/agents-sdk/BrowserRunPanel.d.ts +3 -0
- package/dist/components/agents-sdk/BrowserRunPanel.js +31 -30
- package/dist/components/agents-sdk/EmployeeChrome.d.ts +212 -0
- package/dist/components/agents-sdk/EmployeeChrome.js +555 -0
- package/dist/components/agents-sdk/ManagerOffice.d.ts +115 -85
- package/dist/components/agents-sdk/ManagerOffice.js +545 -1154
- package/dist/components/agents-sdk/McpConnectionRequest.d.ts +4 -4
- package/dist/components/agents-sdk/McpConnectionRequest.js +3 -2
- package/dist/components/agents-sdk/McpConnectorForm.d.ts +38 -1
- package/dist/components/agents-sdk/McpPluginCatalog.d.ts +93 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +3 -2
- package/dist/components/agents-sdk/McpServerIcon.d.ts +17 -0
- package/dist/components/agents-sdk/McpServerIcon.js +25 -0
- package/dist/components/agents-sdk/McpServerPicker.d.ts +4 -3
- package/dist/components/agents-sdk/McpServerPicker.js +2 -1
- package/dist/components/agents-sdk/ModelSelector.d.ts +4 -4
- package/dist/components/agents-sdk/ModelSelector.js +3 -3
- package/dist/components/agents-sdk/PromptInputApproval.d.ts +1 -43
- package/dist/components/agents-sdk/PromptInputCommands.d.ts +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.js +1 -2
- package/dist/components/agents-sdk/SessionCompaction.d.ts +88 -1
- package/dist/components/agents-sdk/SessionCompaction.js +2 -2
- package/dist/components/agents-sdk/SubagentRunDetails.d.ts +30 -1
- package/dist/components/agents-sdk/SubagentRunDetails.js +57 -1
- package/dist/components/agents-sdk/SubagentRunIndicator.d.ts +9 -9
- package/dist/components/agents-sdk/SubagentRunIndicator.js +18 -23
- package/dist/components/agents-sdk/SubagentRunList.d.ts +6 -3
- package/dist/components/agents-sdk/SubagentRunList.js +4 -2
- package/dist/components/agents-sdk/SubagentRunPanel.d.ts +60 -0
- package/dist/components/agents-sdk/SubagentRunPanel.js +255 -0
- package/dist/components/agents-sdk/SubagentRunSelector.d.ts +8 -4
- package/dist/components/agents-sdk/SubagentRunSelector.js +4 -2
- package/dist/components/agents-sdk/ThinkChat.d.ts +102 -2
- package/dist/components/agents-sdk/ThinkChat.js +233 -2
- package/dist/components/agents-sdk/ThinkChatActivity.d.ts +76 -1
- package/dist/components/agents-sdk/ThinkChatActivity.js +17 -9
- package/dist/components/agents-sdk/ThinkChatContext.d.ts +27 -1
- package/dist/components/agents-sdk/ThinkChatContext.js +1 -1
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +23 -18
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionStatus.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.d.ts +85 -28
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +158 -101
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +40 -158
- package/dist/components/agents-sdk/ThinkFullApp.js +71 -285
- package/dist/components/agents-sdk/ThinkRecoveryNotice.d.ts +18 -1
- package/dist/components/agents-sdk/ThinkRoutineActions.d.ts +51 -0
- package/dist/components/agents-sdk/ThinkRoutineActions.js +201 -0
- package/dist/components/agents-sdk/ThinkRoutineBrowser.d.ts +4 -1
- package/dist/components/agents-sdk/ThinkRoutineBrowser.js +16 -14
- package/dist/components/agents-sdk/ThinkRoutineDetail.js +12 -12
- package/dist/components/agents-sdk/ThinkRoutineForm.d.ts +2 -1
- package/dist/components/agents-sdk/ThinkRoutineForm.js +11 -11
- package/dist/components/agents-sdk/ThinkRoutineRuns.js +6 -6
- package/dist/components/agents-sdk/ThinkThreadPicker.d.ts +90 -1
- package/dist/components/agents-sdk/ThinkThreadPicker.js +2 -2
- package/dist/components/agents-sdk/Workspace.d.ts +2 -2
- package/dist/components/agents-sdk/Workspace.js +20 -23
- package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
- package/dist/components/agents-sdk/WorkspaceConcept.d.ts +3 -2
- package/dist/components/agents-sdk/WorkspaceConcept.js +3 -3
- package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +15 -10
- package/dist/components/agents-sdk/WorkspaceCorrespondence.js +43 -40
- package/dist/components/agents-sdk/WorkspaceExecution.d.ts +31 -31
- package/dist/components/agents-sdk/WorkspaceExecution.js +115 -192
- package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +5 -2
- package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -2
- package/dist/components/agents-sdk/WorkspaceFile.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLive.d.ts +60 -1
- package/dist/components/agents-sdk/WorkspaceLive.js +33 -5
- package/dist/components/agents-sdk/WorkspaceMessageResponse.d.ts +47 -1
- package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
- package/dist/components/agents-sdk/WorkspaceMountManager.d.ts +3 -2
- package/dist/components/agents-sdk/WorkspaceMountManager.js +5 -8
- package/dist/components/agents-sdk/WorkspaceNavigationRestoration.d.ts +38 -0
- package/dist/components/agents-sdk/WorkspaceNavigationRestoration.js +86 -0
- package/dist/components/agents-sdk/WorkspaceProject.d.ts +44 -15
- package/dist/components/agents-sdk/WorkspaceProject.js +74 -51
- package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceUserScript.js +5 -2
- package/dist/components/ai-sdk/Activity.d.ts +1 -1
- package/dist/components/ai-sdk/AgentAttention.d.ts +2 -2
- package/dist/components/ai-sdk/AgentChatStartScreen.d.ts +89 -2
- package/dist/components/ai-sdk/AgentChatStartScreen.js +63 -42
- package/dist/components/ai-sdk/AgentMessageParts.d.ts +45 -1
- package/dist/components/ai-sdk/Approval.d.ts +1 -1
- package/dist/components/ai-sdk/Artifact.d.ts +2 -2
- package/dist/components/ai-sdk/Artifact.js +2 -2
- package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
- package/dist/components/ai-sdk/CodeBlock.d.ts +1 -1
- package/dist/components/ai-sdk/CodeBlock.js +1 -1
- package/dist/components/ai-sdk/ComposerLink.js +1 -2
- package/dist/components/ai-sdk/ConnectedAppCards.d.ts +16 -1
- package/dist/components/ai-sdk/ConnectedAppCards.js +69 -94
- package/dist/components/ai-sdk/Context.d.ts +7 -3
- package/dist/components/ai-sdk/Context.js +7 -17
- package/dist/components/ai-sdk/Conversation.d.ts +2 -2
- package/dist/components/ai-sdk/Correspondent.d.ts +2 -0
- package/dist/components/ai-sdk/Correspondent.js +145 -0
- package/dist/components/ai-sdk/Goal.d.ts +3 -3
- package/dist/components/ai-sdk/Goal.js +2 -2
- package/dist/components/ai-sdk/InlineCitation.d.ts +1 -1
- package/dist/components/ai-sdk/InlineCitation.js +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.d.ts +1 -1
- package/dist/components/ai-sdk/Message.d.ts +2 -2
- package/dist/components/ai-sdk/Message.js +11 -2
- package/dist/components/ai-sdk/MessageScroller.d.ts +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.d.ts +2 -76
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +38 -4
- package/dist/components/ai-sdk/Plan.d.ts +1 -1
- package/dist/components/ai-sdk/PromptInput.d.ts +2 -2
- package/dist/components/ai-sdk/PromptInput.js +170 -226
- package/dist/components/ai-sdk/PromptInputComposerEditor.js +32 -9
- package/dist/components/ai-sdk/Queue.d.ts +28 -5
- package/dist/components/ai-sdk/Queue.js +19 -4
- package/dist/components/ai-sdk/Reasoning.d.ts +1 -1
- package/dist/components/ai-sdk/Reasoning.js +4 -4
- package/dist/components/ai-sdk/Sources.d.ts +1 -1
- package/dist/components/ai-sdk/Task.d.ts +1 -1
- package/dist/components/extension/ChatGptSignInScreen.d.ts +1 -1
- package/dist/components/extension/CodexModelSelector.d.ts +5 -0
- package/dist/components/extension/ConversationTabPicker.d.ts +1 -0
- package/dist/components/extension/ConversationTabPicker.js +1 -1
- package/dist/components/foundations/AlertDialog.d.ts +1 -1
- package/dist/components/foundations/AppIcon.d.ts +3 -2
- package/dist/components/foundations/Autocomplete.js +6 -1
- package/dist/components/foundations/Avatar.d.ts +1 -121
- package/dist/components/foundations/Button.d.ts +1 -1
- package/dist/components/foundations/Card.d.ts +22 -27
- package/dist/components/foundations/Card.js +51 -32
- package/dist/components/foundations/CheckboxGroup.d.ts +1 -1
- package/dist/components/foundations/Collapsible.d.ts +1 -1
- package/dist/components/foundations/Combobox.js +6 -1
- package/dist/components/foundations/Dialog.d.ts +106 -1
- package/dist/components/foundations/EmptyState.d.ts +1 -1
- package/dist/components/foundations/Field.d.ts +2 -1
- package/dist/components/foundations/Fieldset.d.ts +1 -1
- package/dist/components/foundations/Form.d.ts +4 -4
- package/dist/components/foundations/IconButton.d.ts +1 -1
- package/dist/components/foundations/Label.d.ts +1 -1
- package/dist/components/foundations/LinkButton.d.ts +2 -2
- package/dist/components/foundations/Meter.d.ts +1 -1
- package/dist/components/foundations/NumberField.d.ts +1 -1
- package/dist/components/foundations/ScrollArea.d.ts +1 -1
- package/dist/components/foundations/SearchField.d.ts +1 -1
- package/dist/components/foundations/Select.js +6 -1
- package/dist/components/foundations/Separator.d.ts +1 -40
- package/dist/components/foundations/Stepper.d.ts +1 -1
- package/dist/components/foundations/Textarea.d.ts +1 -1
- package/dist/components/foundations/Toast.d.ts +5 -1
- package/dist/components/foundations/Toggle.d.ts +70 -1
- package/dist/components/foundations/ToggleGroup.d.ts +3 -2
- package/dist/components/foundations/Toolbar.d.ts +1 -151
- package/dist/components/foundations/TransitionSurface.d.ts +1 -1
- package/dist/components/general-purpose/ActionGuide.d.ts +10 -26
- package/dist/components/general-purpose/ActionGuide.js +4 -18
- package/dist/components/general-purpose/AppTopBar.d.ts +4 -2
- package/dist/components/general-purpose/Commit.d.ts +2 -2
- package/dist/components/general-purpose/Commit.js +1 -1
- package/dist/components/general-purpose/EnvironmentVariables.d.ts +2 -2
- package/dist/components/general-purpose/FileTree.d.ts +1 -7
- package/dist/components/general-purpose/FileTree.js +1 -1
- package/dist/components/general-purpose/PricingBillingToggle.js +1 -1
- package/dist/components/general-purpose/PricingPlanCard.d.ts +4 -0
- package/dist/components/general-purpose/PricingUsageCalculator.js +1 -1
- package/dist/components/general-purpose/ResizableSidePanel.d.ts +2 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +128 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +119 -101
- package/dist/components/general-purpose/SettingsFormDialog.d.ts +14 -27
- package/dist/components/general-purpose/SettingsFormDialog.js +40 -70
- package/dist/components/general-purpose/SetupChecklist.d.ts +1 -0
- package/dist/components/general-purpose/SetupChecklist.js +76 -1
- package/dist/components/general-purpose/Terminal.d.ts +3 -3
- package/dist/components/general-purpose/Terminal.js +10 -5
- package/dist/components/general-purpose/TestResults.d.ts +23 -11
- package/dist/components/general-purpose/TestResults.js +48 -50
- package/dist/components/general-purpose/ThemeModeControl.d.ts +2 -0
- package/dist/components/general-purpose/WebPreview.d.ts +29 -4
- package/dist/components/general-purpose/WebPreview.js +37 -12
- package/dist/components/nanites/AgentConnection.js +1 -1
- package/dist/components/nanites/AgentToolDetail.d.ts +13 -11
- package/dist/components/nanites/AgentToolDetail.js +20 -41
- package/dist/{copy-button-C0JyjClr.d.ts → copy-button-OUwOdgEm.d.ts} +1 -1
- package/dist/mcp-server-mAErsxHU.js +27 -0
- package/dist/styles/activity.css +1 -96
- package/dist/styles/agent-chat.css +75 -102
- package/dist/styles/agent-tool-detail.css +0 -16
- package/dist/styles/base.css +3 -3
- package/dist/styles/browser-run-panel.css +1 -15
- package/dist/styles/button.css +7 -1
- package/dist/styles/code-block.css +12 -0
- package/dist/styles/composition-motion.css +0 -2
- package/dist/styles/correspondent.css +73 -0
- package/dist/styles/employee-chrome.css +43 -0
- package/dist/styles/file-tree.css +5 -0
- package/dist/styles/index.css +5 -2
- package/dist/styles/manager-office.css +380 -1086
- package/dist/styles/message.css +2 -10
- package/dist/styles/queue.css +71 -0
- package/dist/styles/subagent-run.css +122 -6
- package/dist/styles/test-results.css +2 -5
- package/dist/styles/think-chat-activity.css +13 -0
- package/dist/styles/think-chat-tool-panels.css +81 -0
- package/dist/styles/think-execution-workbench.css +2 -8
- package/dist/styles/think-full-app.css +42 -251
- package/dist/styles/{think-routine-library.css → think-routine.css} +64 -80
- package/dist/styles/web-preview.css +15 -1
- package/dist/utils/mcp-server-catalog.d.ts +1112 -2
- package/dist/utils/mcp-server-catalog.js +28 -9
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/{workspace-assets-CxpEHsac.js → workspace-assets-Bg7XhPsk.js} +16 -2
- package/package.json +7 -3
- package/dist/AgentChat-BLmQghkt.d.ts +0 -327
- package/dist/AgentChatStartScreen-Bkv7Avni.d.ts +0 -84
- package/dist/AgentMessageParts-C7L-Mv9U.d.ts +0 -46
- package/dist/AgentToolRunsContext-jtmveaRE.d.ts +0 -57
- package/dist/Dialog-B_FhRWaz.d.ts +0 -107
- package/dist/McpConnectorForm-CeYNY0MI.d.ts +0 -39
- package/dist/McpPluginCatalog-3qWu8oK1.d.ts +0 -92
- package/dist/ResponsiveSidebarShell-BTVPxLJK.d.ts +0 -123
- package/dist/SessionCompaction-CmTJFpzj.d.ts +0 -89
- package/dist/SetupChecklist-CwRjIDH4.js +0 -77
- package/dist/ThinkChat-CwMdEum8.d.ts +0 -185
- package/dist/ThinkChat-DLDta57t.js +0 -332
- package/dist/ThinkChatActivity-B3lGVS-6.d.ts +0 -77
- package/dist/ThinkChatContext-COIgzkYp.d.ts +0 -28
- package/dist/ThinkRecoveryNotice-DGWr94rk.d.ts +0 -19
- package/dist/ThinkThreadPicker-yFz4vvIf.d.ts +0 -91
- package/dist/Toggle-DLrIf5YH.d.ts +0 -69
- package/dist/WorkspaceLive-DLGhtIly.d.ts +0 -49
- package/dist/WorkspaceMessageResponse-kJYU8Onj.d.ts +0 -48
- package/dist/components/agents-sdk/ThinkFullAppViewSwitch.d.ts +0 -31
- package/dist/components/agents-sdk/ThinkFullAppViewSwitch.js +0 -34
- package/dist/components/agents-sdk/ThinkRoutineLibrary.d.ts +0 -80
- package/dist/components/agents-sdk/ThinkRoutineLibrary.js +0 -159
- package/dist/components/agents-sdk/ThinkSidepanel.d.ts +0 -200
- package/dist/components/agents-sdk/ThinkSidepanel.js +0 -775
- package/dist/mcp-server-7NR24ASj.js +0 -69
- package/dist/mcp-server-catalog-C_g7C-9o.d.ts +0 -1108
- package/dist/styles/think-sidepanel.css +0 -78
- package/dist/think-agent-Cip5KAPj.d.ts +0 -7
|
@@ -1,301 +1,87 @@
|
|
|
1
|
-
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { S as FileIcon, c as BoxIcon, r as ArrowLeftIcon, y as EllipsisIcon } from "../../icons-cuEtsgj9.js";
|
|
3
|
-
import { IconButton } from "../foundations/IconButton.js";
|
|
4
|
-
import { n as mergeRefs } from "../../merge-refs-DF_7w2x_.js";
|
|
5
|
-
import { Menu } from "../foundations/Menu.js";
|
|
1
|
+
import { n as mergeBaseClassName, t as cx } from "../../class-names-BiMDVpUo.js";
|
|
6
2
|
import { ResizableSidePanel } from "../general-purpose/ResizableSidePanel.js";
|
|
7
|
-
import { ResponsiveSidebarShell } from "../general-purpose/ResponsiveSidebarShell.js";
|
|
8
|
-
import { McpPluginCatalog } from "./McpPluginCatalog.js";
|
|
9
|
-
import { a as WorkspaceNavigationRestorationBoundary, i as WorkspaceNavigationFocusRestorer, n as WorkspaceNavigationProvider } from "../../WorkspaceLink-B1d2GIGl.js";
|
|
10
|
-
import { c as resolveThinkApprovalProps, s as useThinkPendingExecutionApprovals, t as ThinkChat } from "../../ThinkChat-DLDta57t.js";
|
|
11
|
-
import { ThinkFullAppViewSwitch } from "./ThinkFullAppViewSwitch.js";
|
|
12
|
-
import { ThinkThreadStatusIndicators } from "./ThinkThreadPicker.js";
|
|
13
|
-
import { useWorkspace } from "./Workspace.js";
|
|
14
|
-
import { WorkspaceExplorer } from "./WorkspaceExplorer.js";
|
|
15
|
-
import { useWorkspaceLiveQueries } from "./WorkspaceLive.js";
|
|
16
3
|
import * as React from "react";
|
|
17
|
-
import {
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
18
7
|
//#region src/components/agents-sdk/ThinkFullApp.tsx
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/** Keep in lockstep with --sigvelo-layout-break-compact / the 56rem @container. */
|
|
25
|
-
function compactBreakPx(el) {
|
|
26
|
-
const raw = getComputedStyle(el).getPropertyValue("--sigvelo-layout-break-compact").trim();
|
|
27
|
-
if (raw.endsWith("rem")) return Number.parseFloat(raw) * Number.parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
28
|
-
const px = Number.parseFloat(raw);
|
|
29
|
-
return Number.isFinite(px) ? px : 896;
|
|
30
|
-
}
|
|
31
|
-
function isCompactApp(el) {
|
|
32
|
-
return el.getBoundingClientRect().width <= compactBreakPx(el);
|
|
33
|
-
}
|
|
34
|
-
function ThinkFullAppCompactViewMenu({ activeView, onViewChange, views }) {
|
|
35
|
-
return /* @__PURE__ */ jsx("div", {
|
|
36
|
-
className: "think-full-app__compact-view-menu",
|
|
37
|
-
children: /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(IconButton, {
|
|
38
|
-
label: "More views",
|
|
39
|
-
tooltip: "More views",
|
|
40
|
-
render: /* @__PURE__ */ jsx(Menu.Trigger, { unstyled: true }),
|
|
41
|
-
variant: "ghost",
|
|
42
|
-
color: "neutral",
|
|
43
|
-
size: "sm",
|
|
44
|
-
children: /* @__PURE__ */ jsx(EllipsisIcon, {})
|
|
45
|
-
}), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
46
|
-
side: "bottom",
|
|
47
|
-
align: "end",
|
|
48
|
-
sideOffset: 4,
|
|
49
|
-
children: /* @__PURE__ */ jsx(Menu.Popup, { children: views.map((view) => /* @__PURE__ */ jsxs(Menu.Item, {
|
|
50
|
-
"aria-current": activeView === view.id ? "page" : void 0,
|
|
51
|
-
onClick: () => onViewChange(view.id),
|
|
52
|
-
children: [view.icon, view.label]
|
|
53
|
-
}, view.id)) })
|
|
54
|
-
}) })] })
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function WorkspacePanel({ config }) {
|
|
58
|
-
const selectedPath = config.navigation.current.destination.kind === "file" ? config.navigation.current.destination.path : null;
|
|
59
|
-
return /* @__PURE__ */ jsx(WorkspaceExplorer, {
|
|
60
|
-
className: "think-full-app__workbench",
|
|
61
|
-
workspace: useWorkspace({
|
|
62
|
-
source: config.source,
|
|
63
|
-
sourceKey: config.sourceKey,
|
|
64
|
-
root: config.root,
|
|
65
|
-
selectedPath,
|
|
66
|
-
resolveFileAsset: config.resolveFileAsset,
|
|
67
|
-
maxInlineAssetBytes: config.maxInlineAssetBytes
|
|
68
|
-
}),
|
|
69
|
-
navigation: config.navigation,
|
|
70
|
-
leading: config.leading,
|
|
71
|
-
actions: config.actions
|
|
72
|
-
});
|
|
8
|
+
const WorkbenchOpenContext = React.createContext(null);
|
|
9
|
+
function useWorkbenchOpen() {
|
|
10
|
+
const open = React.useContext(WorkbenchOpenContext);
|
|
11
|
+
if (open === null) throw new Error("ThinkFullApp parts must be inside ThinkFullApp.Root.");
|
|
12
|
+
return open;
|
|
73
13
|
}
|
|
74
14
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
15
|
+
* Conversation/workbench layout, independent of routing and SDK connections.
|
|
16
|
+
* Compose navigation outside the root. The conversation remains mounted while
|
|
17
|
+
* compact layouts show the workbench; ResizableSidePanel owns desktop resizing.
|
|
77
18
|
*/
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
messages
|
|
99
|
-
]);
|
|
100
|
-
return /* @__PURE__ */ jsx(ThinkChat.Provider, {
|
|
101
|
-
chat,
|
|
102
|
-
agentTools,
|
|
103
|
-
children: /* @__PURE__ */ jsx(ThinkChat.Messages, {
|
|
104
|
-
...resolvedMessages,
|
|
105
|
-
renderAgentToolRunLink
|
|
19
|
+
function ThinkFullAppRoot({ workbenchOpen, children, className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(WorkbenchOpenContext.Provider, {
|
|
21
|
+
value: workbenchOpen,
|
|
22
|
+
children: /* @__PURE__ */ jsx(ResizableSidePanel.Root, {
|
|
23
|
+
label: "conversation",
|
|
24
|
+
side: "start",
|
|
25
|
+
sizeVariable: "--think-full-app-conversation-size",
|
|
26
|
+
defaultSize: 392,
|
|
27
|
+
minSize: 320,
|
|
28
|
+
maxSize: 640,
|
|
29
|
+
keyboardStep: 24,
|
|
30
|
+
...props,
|
|
31
|
+
className: cx("think-full-app", className),
|
|
32
|
+
"data-has-workbench": workbenchOpen ? "true" : "false",
|
|
33
|
+
"data-mobile-view": workbenchOpen ? "workbench" : "chat",
|
|
34
|
+
"data-recipe": "fill-host",
|
|
35
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
36
|
+
className: "think-full-app__view-scope",
|
|
37
|
+
children
|
|
38
|
+
})
|
|
106
39
|
})
|
|
107
40
|
});
|
|
108
41
|
}
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const workbenchPanelRef = React.useRef(null);
|
|
121
|
-
const pendingPanelFocusRef = React.useRef(null);
|
|
122
|
-
const [innerView, setInnerView] = React.useState(defaultViewProp ?? "chat");
|
|
123
|
-
const userChoseView = React.useRef(defaultViewProp !== void 0 || view !== void 0);
|
|
124
|
-
const requestedView = view ?? innerView;
|
|
125
|
-
const setView = React.useCallback((next) => {
|
|
126
|
-
userChoseView.current = true;
|
|
127
|
-
if (view === void 0) setInnerView(next);
|
|
128
|
-
onViewChange?.(next);
|
|
129
|
-
}, [onViewChange, view]);
|
|
130
|
-
React.useLayoutEffect(() => {
|
|
131
|
-
if (view !== void 0 || defaultViewProp !== void 0 || userChoseView.current) return;
|
|
132
|
-
if (workspace === void 0) return;
|
|
133
|
-
const el = appRef.current;
|
|
134
|
-
if (!el) return;
|
|
135
|
-
const syncViewToWidth = () => {
|
|
136
|
-
if (userChoseView.current) return;
|
|
137
|
-
const next = isCompactApp(el) ? "chat" : "files";
|
|
138
|
-
setInnerView((current) => current === next ? current : next);
|
|
139
|
-
};
|
|
140
|
-
syncViewToWidth();
|
|
141
|
-
const observer = new ResizeObserver(syncViewToWidth);
|
|
142
|
-
observer.observe(el);
|
|
143
|
-
return () => observer.disconnect();
|
|
144
|
-
}, [
|
|
145
|
-
defaultViewProp,
|
|
146
|
-
view,
|
|
147
|
-
workspace
|
|
148
|
-
]);
|
|
149
|
-
const availableWorkbenchPanels = [];
|
|
150
|
-
if (workspace !== void 0) availableWorkbenchPanels.push({
|
|
151
|
-
id: "files",
|
|
152
|
-
label: "Files",
|
|
153
|
-
icon: /* @__PURE__ */ jsx(FileIcon, {}),
|
|
154
|
-
render: () => /* @__PURE__ */ jsx(WorkspacePanel, { config: workspace })
|
|
42
|
+
/** Persistent conversation lane. Its contents and SDK providers belong to the caller. */
|
|
43
|
+
function ThinkFullAppConversation({ render, className, ref, ...props }) {
|
|
44
|
+
useWorkbenchOpen();
|
|
45
|
+
return useRender({
|
|
46
|
+
defaultTagName: "section",
|
|
47
|
+
render,
|
|
48
|
+
ref,
|
|
49
|
+
props: mergeProps({
|
|
50
|
+
"aria-label": "Conversation",
|
|
51
|
+
className: mergeBaseClassName("think-full-app__chat-surface", className)
|
|
52
|
+
}, props)
|
|
155
53
|
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
54
|
+
}
|
|
55
|
+
/** The single raised output plane. Unmounts its content when the host closes it. */
|
|
56
|
+
function ThinkFullAppWorkbench({ render, className, ref, ...props }) {
|
|
57
|
+
const open = useWorkbenchOpen();
|
|
58
|
+
const element = useRender({
|
|
59
|
+
defaultTagName: "aside",
|
|
60
|
+
render,
|
|
61
|
+
ref,
|
|
62
|
+
props: mergeProps({
|
|
63
|
+
"aria-label": "Workbench",
|
|
64
|
+
tabIndex: -1,
|
|
65
|
+
className: mergeBaseClassName("think-full-app__aside", className)
|
|
66
|
+
}, props)
|
|
161
67
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const activeMobileView = hasWorkbench ? "workbench" : "chat";
|
|
166
|
-
const hasAppBarRow = Boolean(bar?.back || bar?.leading || bar?.compactLeading || bar?.title || bar?.actions || bar?.primary || bar?.views || threadSidebar) || availableWorkbenchPanels.length > 0;
|
|
167
|
-
React.useLayoutEffect(() => {
|
|
168
|
-
const pendingFocus = pendingPanelFocusRef.current;
|
|
169
|
-
if (!pendingFocus || pendingFocus.id !== activePanel?.id) return;
|
|
170
|
-
pendingPanelFocusRef.current = null;
|
|
171
|
-
Array.from(workbenchPanelRef.current?.querySelectorAll("button") ?? []).find((button) => button.getAttribute("aria-label") === pendingFocus.label)?.focus({ preventScroll: true });
|
|
172
|
-
}, [activePanel?.id]);
|
|
173
|
-
const updateView = (next) => {
|
|
174
|
-
const activeElement = document.activeElement;
|
|
175
|
-
const restorePanelSwitchFocus = activeElement instanceof HTMLElement && workbenchPanelRef.current?.contains(activeElement);
|
|
176
|
-
const nextLabel = availableWorkbenchPanels.find((panel) => panel.id === next)?.label;
|
|
177
|
-
pendingPanelFocusRef.current = restorePanelSwitchFocus && nextLabel ? {
|
|
178
|
-
id: next,
|
|
179
|
-
label: nextLabel
|
|
180
|
-
} : null;
|
|
181
|
-
React.startTransition(() => setView(next));
|
|
182
|
-
};
|
|
183
|
-
const viewSwitch = bar?.views === void 0 && availableWorkbenchPanels.length ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
|
|
184
|
-
views: availableWorkbenchPanels,
|
|
185
|
-
value: activePanel?.id,
|
|
186
|
-
allowEmpty: true,
|
|
187
|
-
"aria-label": "App views",
|
|
188
|
-
onValueChange: (next) => updateView(next ?? "chat")
|
|
189
|
-
}) : bar?.views ?? null;
|
|
190
|
-
const compactViewMenu = bar?.views === void 0 && availableWorkbenchPanels.length ? /* @__PURE__ */ jsx(ThinkFullAppCompactViewMenu, {
|
|
191
|
-
activeView: activePanel?.id,
|
|
192
|
-
views: availableWorkbenchPanels,
|
|
193
|
-
onViewChange: updateView
|
|
68
|
+
return open ? /* @__PURE__ */ jsx(React.ViewTransition, {
|
|
69
|
+
default: "sigvelo-layout-transition",
|
|
70
|
+
children: element
|
|
194
71
|
}) : null;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
] }) : void 0;
|
|
200
|
-
const compactLeading = bar?.compactLeading !== void 0 ? bar.compactLeading : activePanel ? /* @__PURE__ */ jsx(IconButton, {
|
|
201
|
-
type: "button",
|
|
202
|
-
label: "Back to chat",
|
|
203
|
-
tooltip: "Back to chat",
|
|
204
|
-
variant: "ghost",
|
|
205
|
-
color: "neutral",
|
|
206
|
-
size: "sm",
|
|
207
|
-
onClick: () => updateView("chat"),
|
|
208
|
-
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
209
|
-
}) : void 0;
|
|
210
|
-
const appContent = /* @__PURE__ */ jsxs(ResizableSidePanel.Root, {
|
|
211
|
-
ref: mergeRefs(appRef, ref),
|
|
212
|
-
className: cx("think-full-app", className),
|
|
213
|
-
label: "workbench",
|
|
214
|
-
side: "start",
|
|
215
|
-
sizeVariable: "--think-full-app-conversation-size",
|
|
216
|
-
defaultSize: conversationDefaultWidth,
|
|
217
|
-
minSize: conversationMinWidth,
|
|
218
|
-
maxSize: conversationMaxWidth,
|
|
219
|
-
keyboardStep: conversationKeyboardStep,
|
|
220
|
-
"data-has-workbench": hasWorkbench ? "true" : "false",
|
|
221
|
-
"data-mobile-view": activeMobileView,
|
|
222
|
-
style,
|
|
72
|
+
}
|
|
73
|
+
/** Keyboard and pointer resize control; absent while the workbench is closed. */
|
|
74
|
+
function ThinkFullAppResizeHandle({ className, ...props }) {
|
|
75
|
+
return useWorkbenchOpen() ? /* @__PURE__ */ jsx(ResizableSidePanel.Handle, {
|
|
223
76
|
...props,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
className: "think-full-app__view-scope",
|
|
227
|
-
"data-mobile-view": activeMobileView,
|
|
228
|
-
children: [/* @__PURE__ */ jsx("section", {
|
|
229
|
-
className: "think-full-app__chat-surface",
|
|
230
|
-
"data-workspace-restoration-scope": "chat",
|
|
231
|
-
"aria-label": "Chat",
|
|
232
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
233
|
-
className: "think-full-app__chat",
|
|
234
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
235
|
-
className: "think-full-app__chat-inner",
|
|
236
|
-
children: conversation ? /* @__PURE__ */ jsx(ThinkFullAppThreadChat, {
|
|
237
|
-
...conversation,
|
|
238
|
-
messages,
|
|
239
|
-
renderAgentToolRunLink,
|
|
240
|
-
sourceKey
|
|
241
|
-
}) : /* @__PURE__ */ jsx(ThinkChat.Messages, {
|
|
242
|
-
...messages,
|
|
243
|
-
renderAgentToolRunLink
|
|
244
|
-
})
|
|
245
|
-
})
|
|
246
|
-
})
|
|
247
|
-
}), activePanel ? /* @__PURE__ */ jsx("aside", {
|
|
248
|
-
className: "think-full-app__aside",
|
|
249
|
-
"aria-label": "Workbench",
|
|
250
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
251
|
-
className: "think-full-app__workbench-slot",
|
|
252
|
-
children: /* @__PURE__ */ jsx(React.ViewTransition, {
|
|
253
|
-
default: "sigvelo-layout-transition",
|
|
254
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
255
|
-
ref: workbenchPanelRef,
|
|
256
|
-
className: "think-full-app__workbench-panel",
|
|
257
|
-
tabIndex: -1,
|
|
258
|
-
children: activePanel.render()
|
|
259
|
-
})
|
|
260
|
-
})
|
|
261
|
-
})
|
|
262
|
-
}) : null]
|
|
263
|
-
}), activePanel ? /* @__PURE__ */ jsx(ResizableSidePanel.Handle, { className: "think-full-app__resizer" }) : null]
|
|
264
|
-
});
|
|
265
|
-
const app = workspace ? /* @__PURE__ */ jsx(WorkspaceNavigationProvider, {
|
|
266
|
-
root: workspace.root ?? "/",
|
|
267
|
-
base: {
|
|
268
|
-
kind: "directory",
|
|
269
|
-
path: workspace.root ?? "/"
|
|
270
|
-
},
|
|
271
|
-
navigation: workspace.navigation,
|
|
272
|
-
children: /* @__PURE__ */ jsxs(WorkspaceNavigationRestorationBoundary, { children: [/* @__PURE__ */ jsx(WorkspaceNavigationFocusRestorer, {
|
|
273
|
-
entryKey: workspace.navigation.current.key,
|
|
274
|
-
rootRef: appRef,
|
|
275
|
-
scope: "chat"
|
|
276
|
-
}), appContent] })
|
|
277
|
-
}) : appContent;
|
|
278
|
-
return /* @__PURE__ */ jsx(ResponsiveSidebarShell, {
|
|
279
|
-
className: "think-full-app-shell",
|
|
280
|
-
sidebar: threadSidebar,
|
|
281
|
-
sidebarLabel: "threads",
|
|
282
|
-
sidebarTogglePlacement,
|
|
283
|
-
showMainLabel: "Show selected thread",
|
|
284
|
-
bar: {
|
|
285
|
-
...bar,
|
|
286
|
-
actions: appBarActions,
|
|
287
|
-
compactLeading,
|
|
288
|
-
primary: bar?.primary,
|
|
289
|
-
className: "think-full-app__app-bar",
|
|
290
|
-
label: "Workbench controls",
|
|
291
|
-
hidden: !hasAppBarRow,
|
|
292
|
-
compactTitleTrigger: threadSidebar ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
293
|
-
className: "sigvelo-truncate",
|
|
294
|
-
children: bar?.title ?? "Threads"
|
|
295
|
-
}), threadStatusSummary ? /* @__PURE__ */ jsx(ThinkThreadStatusIndicators, { summary: threadStatusSummary }) : null] }) : void 0
|
|
296
|
-
},
|
|
297
|
-
children: app
|
|
298
|
-
});
|
|
77
|
+
className: mergeBaseClassName("think-full-app__resizer", className)
|
|
78
|
+
}) : null;
|
|
299
79
|
}
|
|
80
|
+
const ThinkFullApp = {
|
|
81
|
+
Root: ThinkFullAppRoot,
|
|
82
|
+
Conversation: ThinkFullAppConversation,
|
|
83
|
+
Workbench: ThinkFullAppWorkbench,
|
|
84
|
+
ResizeHandle: ThinkFullAppResizeHandle
|
|
85
|
+
};
|
|
300
86
|
//#endregion
|
|
301
87
|
export { ThinkFullApp };
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThinkChatValue } from "./ThinkChatContext.js";
|
|
2
|
+
import { UIMessage } from "ai";
|
|
3
|
+
|
|
4
|
+
//#region src/components/agents-sdk/ThinkRecoveryNotice.d.ts
|
|
5
|
+
interface ThinkRecoveryNoticeProps<State = unknown, MessageT extends UIMessage = UIMessage> {
|
|
6
|
+
/** The complete `useAgentChat` value from `@cloudflare/think/react`. */
|
|
7
|
+
chat: ThinkChatValue<State, MessageT>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Native Think recovery, connection, and turn-error content for AgentChat's
|
|
11
|
+
* persistent polite notice region. Think exposes no recovery phase, progress,
|
|
12
|
+
* checkpoint, attempt count, or timeline to the browser, so this adapter does
|
|
13
|
+
* not claim those details.
|
|
14
|
+
*/
|
|
15
|
+
declare function ThinkRecoveryNotice<State = unknown, MessageT extends UIMessage = UIMessage>({
|
|
16
|
+
chat
|
|
17
|
+
}: ThinkRecoveryNoticeProps<State, MessageT>): import("react").JSX.Element | null;
|
|
18
|
+
//#endregion
|
|
2
19
|
export { ThinkRecoveryNotice, ThinkRecoveryNoticeProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ThinkRoutine } from "./ThinkRoutine.js";
|
|
2
|
+
import { AppTopBar } from "../general-purpose/AppTopBar.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/agents-sdk/ThinkRoutineActions.d.ts
|
|
6
|
+
interface ThinkRoutineActionsRootProps<TRoutine extends ThinkRoutine = ThinkRoutine> {
|
|
7
|
+
/** Whole selected routine, including app-owned extensions and native task/run values. */
|
|
8
|
+
routine: TRoutine;
|
|
9
|
+
/** Stable non-secret identity of the source backing this routine. */
|
|
10
|
+
sourceKey: string;
|
|
11
|
+
/** Host mutation that runs the whole selected routine; its promise controls pending and error feedback. */
|
|
12
|
+
onRun?: (routine: TRoutine) => void | Promise<void>;
|
|
13
|
+
/** Host mutation for the requested enabled state; the host supplies the updated routine after success. */
|
|
14
|
+
onEnabledChange?: (routine: TRoutine, enabled: boolean) => void | Promise<void>;
|
|
15
|
+
/** Host removal invoked after confirmation; rejection keeps the confirmation open with its error. */
|
|
16
|
+
onDelete?: (routine: TRoutine) => void | Promise<void>;
|
|
17
|
+
/** Caller-composed controls and detail sharing this source/routine mutation scope; no layout is inserted. */
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/** Connect an independently mounted detail to its selected routine action scope. */
|
|
21
|
+
declare function useThinkRoutineActions(): {
|
|
22
|
+
busy: boolean;
|
|
23
|
+
onEnabledChange: ((enabled: boolean) => void) | undefined;
|
|
24
|
+
};
|
|
25
|
+
/** No layout or routing. Source/routine changes reset actions without remounting caller navigation. */
|
|
26
|
+
declare function ThinkRoutineActionsRoot<TRoutine extends ThinkRoutine>({
|
|
27
|
+
routine,
|
|
28
|
+
sourceKey,
|
|
29
|
+
onRun,
|
|
30
|
+
onEnabledChange,
|
|
31
|
+
onDelete,
|
|
32
|
+
children
|
|
33
|
+
}: ThinkRoutineActionsRootProps<TRoutine>): React.JSX.Element;
|
|
34
|
+
type ThinkRoutineActionProps = Omit<React.ComponentProps<typeof AppTopBar.Button>, "label"> & {
|
|
35
|
+
label?: string;
|
|
36
|
+
};
|
|
37
|
+
/** Explicit run control; preserves the complete shared button composition contract. */
|
|
38
|
+
declare function ThinkRoutineRun(props: ThinkRoutineActionProps): React.JSX.Element | null;
|
|
39
|
+
/** Delete confirmation stays open on failure; only its source-scoped action can settle it. */
|
|
40
|
+
declare function ThinkRoutineDelete(props: ThinkRoutineActionProps): React.JSX.Element | null;
|
|
41
|
+
declare function ThinkRoutineError(props: React.ComponentPropsWithRef<"div">): React.JSX.Element | null;
|
|
42
|
+
declare function ThinkRoutineStatus(props: React.ComponentPropsWithRef<"div">): React.JSX.Element;
|
|
43
|
+
declare const ThinkRoutineActions: {
|
|
44
|
+
Root: typeof ThinkRoutineActionsRoot;
|
|
45
|
+
Run: typeof ThinkRoutineRun;
|
|
46
|
+
Delete: typeof ThinkRoutineDelete;
|
|
47
|
+
Error: typeof ThinkRoutineError;
|
|
48
|
+
Status: typeof ThinkRoutineStatus;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { ThinkRoutineActionProps, ThinkRoutineActions, ThinkRoutineActionsRootProps, useThinkRoutineActions };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { K as SpinnerIcon, Q as TrashIcon, z as PlayIcon } from "../../icons-cuEtsgj9.js";
|
|
2
|
+
import { Button } from "../foundations/Button.js";
|
|
3
|
+
import { a as formatErrorMessage } from "../../format-COCyV98Z.js";
|
|
4
|
+
import { n as mergeRefs } from "../../merge-refs-DF_7w2x_.js";
|
|
5
|
+
import { AlertDialog } from "../foundations/AlertDialog.js";
|
|
6
|
+
import { AppTopBar } from "../general-purpose/AppTopBar.js";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
10
|
+
//#region src/components/agents-sdk/ThinkRoutineActions.tsx
|
|
11
|
+
const RoutineActionsContext = React.createContext(null);
|
|
12
|
+
/** Selected-routine mutation state for explicitly composed detail and controls. */
|
|
13
|
+
function useRoutineActions() {
|
|
14
|
+
const value = React.useContext(RoutineActionsContext);
|
|
15
|
+
if (!value) throw new Error("Routine actions require ThinkRoutineActions.Root.");
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
/** Connect an independently mounted detail to its selected routine action scope. */
|
|
19
|
+
function useThinkRoutineActions() {
|
|
20
|
+
const { busy, onEnabledChange } = useRoutineActions();
|
|
21
|
+
return {
|
|
22
|
+
busy,
|
|
23
|
+
onEnabledChange
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** No layout or routing. Source/routine changes reset actions without remounting caller navigation. */
|
|
27
|
+
function ThinkRoutineActionsRoot({ routine, sourceKey, onRun, onEnabledChange, onDelete, children }) {
|
|
28
|
+
const identity = JSON.stringify([sourceKey, routine.id]);
|
|
29
|
+
const initial = () => ({
|
|
30
|
+
scope: { identity },
|
|
31
|
+
busy: false,
|
|
32
|
+
error: null,
|
|
33
|
+
announcement: "",
|
|
34
|
+
action: null
|
|
35
|
+
});
|
|
36
|
+
const [state, setState] = React.useState(initial);
|
|
37
|
+
if (state.scope.identity !== identity) setState(initial());
|
|
38
|
+
const inFlight = React.useRef(null);
|
|
39
|
+
const value = React.useMemo(() => {
|
|
40
|
+
const perform = async (operation, action, success) => {
|
|
41
|
+
const scope = state.scope;
|
|
42
|
+
if (inFlight.current === scope) return false;
|
|
43
|
+
inFlight.current = scope;
|
|
44
|
+
setState((current) => current.scope === scope ? {
|
|
45
|
+
...current,
|
|
46
|
+
busy: true,
|
|
47
|
+
error: null,
|
|
48
|
+
announcement: "",
|
|
49
|
+
action: operation
|
|
50
|
+
} : current);
|
|
51
|
+
try {
|
|
52
|
+
await action();
|
|
53
|
+
setState((current) => current.scope === scope ? {
|
|
54
|
+
...current,
|
|
55
|
+
announcement: success
|
|
56
|
+
} : current);
|
|
57
|
+
return true;
|
|
58
|
+
} catch (next) {
|
|
59
|
+
setState((current) => current.scope === scope ? {
|
|
60
|
+
...current,
|
|
61
|
+
error: formatErrorMessage(next)
|
|
62
|
+
} : current);
|
|
63
|
+
return false;
|
|
64
|
+
} finally {
|
|
65
|
+
if (inFlight.current === scope) inFlight.current = null;
|
|
66
|
+
setState((current) => current.scope === scope ? {
|
|
67
|
+
...current,
|
|
68
|
+
busy: false
|
|
69
|
+
} : current);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
scope: state.scope,
|
|
74
|
+
name: routine.name,
|
|
75
|
+
busy: state.busy,
|
|
76
|
+
error: state.action === "delete" ? null : state.error,
|
|
77
|
+
deleteError: state.action === "delete" ? state.error : null,
|
|
78
|
+
announcement: state.announcement,
|
|
79
|
+
run: onRun ? () => perform("run", () => onRun(routine), `Started ${routine.name}.`) : void 0,
|
|
80
|
+
remove: onDelete ? () => perform("delete", () => onDelete(routine), `Deleted ${routine.name}.`) : void 0,
|
|
81
|
+
onEnabledChange: onEnabledChange ? (enabled) => {
|
|
82
|
+
perform("enable", () => onEnabledChange(routine, enabled), `${routine.name} ${enabled ? "activated" : "paused"}.`);
|
|
83
|
+
} : void 0
|
|
84
|
+
};
|
|
85
|
+
}, [
|
|
86
|
+
state,
|
|
87
|
+
routine,
|
|
88
|
+
onRun,
|
|
89
|
+
onDelete,
|
|
90
|
+
onEnabledChange
|
|
91
|
+
]);
|
|
92
|
+
return /* @__PURE__ */ jsx(RoutineActionsContext.Provider, {
|
|
93
|
+
value,
|
|
94
|
+
children
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/** Explicit run control; preserves the complete shared button composition contract. */
|
|
98
|
+
function ThinkRoutineRun(props) {
|
|
99
|
+
const { busy, run } = useRoutineActions();
|
|
100
|
+
if (!run) return null;
|
|
101
|
+
return /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
102
|
+
...mergeProps({
|
|
103
|
+
label: "Run schedule",
|
|
104
|
+
onClick: () => {
|
|
105
|
+
run();
|
|
106
|
+
},
|
|
107
|
+
children: busy ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(PlayIcon, {})
|
|
108
|
+
}, props),
|
|
109
|
+
label: props.label ?? "Run schedule",
|
|
110
|
+
disabled: busy || props.disabled
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/** Delete confirmation stays open on failure; only its source-scoped action can settle it. */
|
|
114
|
+
function ThinkRoutineDelete(props) {
|
|
115
|
+
const { scope, name, busy, deleteError: error, remove } = useRoutineActions();
|
|
116
|
+
const [dialog, setDialog] = React.useState({
|
|
117
|
+
scope,
|
|
118
|
+
open: false
|
|
119
|
+
});
|
|
120
|
+
if (dialog.scope !== scope) setDialog({
|
|
121
|
+
scope,
|
|
122
|
+
open: false
|
|
123
|
+
});
|
|
124
|
+
const open = dialog.scope === scope && dialog.open;
|
|
125
|
+
const setOpen = (open) => setDialog((current) => current.scope === scope ? {
|
|
126
|
+
scope,
|
|
127
|
+
open
|
|
128
|
+
} : current);
|
|
129
|
+
const triggerRef = React.useRef(null);
|
|
130
|
+
if (!remove) return null;
|
|
131
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
132
|
+
...mergeProps({
|
|
133
|
+
label: "Delete schedule",
|
|
134
|
+
onClick: () => setOpen(true),
|
|
135
|
+
children: /* @__PURE__ */ jsx(TrashIcon, {})
|
|
136
|
+
}, props),
|
|
137
|
+
ref: mergeRefs(triggerRef, props.ref),
|
|
138
|
+
label: props.label ?? "Delete schedule",
|
|
139
|
+
disabled: busy || props.disabled
|
|
140
|
+
}), /* @__PURE__ */ jsx(AlertDialog.Root, {
|
|
141
|
+
open,
|
|
142
|
+
onOpenChange: (next, details) => {
|
|
143
|
+
if (busy && !next) details.cancel();
|
|
144
|
+
else setOpen(next);
|
|
145
|
+
},
|
|
146
|
+
children: /* @__PURE__ */ jsxs(AlertDialog.Portal, { children: [/* @__PURE__ */ jsx(AlertDialog.Backdrop, {}), /* @__PURE__ */ jsx(AlertDialog.Viewport, { children: /* @__PURE__ */ jsxs(AlertDialog.Popup, {
|
|
147
|
+
finalFocus: triggerRef,
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsxs(AlertDialog.Title, { children: [
|
|
150
|
+
"Delete ",
|
|
151
|
+
name,
|
|
152
|
+
"?"
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsx(AlertDialog.Description, { children: "This permanently deletes the schedule and stops its future runs." }),
|
|
155
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
156
|
+
role: "alert",
|
|
157
|
+
children: error
|
|
158
|
+
}) : null,
|
|
159
|
+
/* @__PURE__ */ jsxs(AlertDialog.Footer, { children: [/* @__PURE__ */ jsx(AlertDialog.Close, {
|
|
160
|
+
disabled: busy,
|
|
161
|
+
children: "Cancel"
|
|
162
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
163
|
+
"aria-label": "Confirm delete schedule",
|
|
164
|
+
color: "destructive",
|
|
165
|
+
disabled: busy,
|
|
166
|
+
onClick: async () => {
|
|
167
|
+
if (await remove()) setOpen(false);
|
|
168
|
+
},
|
|
169
|
+
children: "Delete schedule"
|
|
170
|
+
})] })
|
|
171
|
+
]
|
|
172
|
+
}) })] })
|
|
173
|
+
})] });
|
|
174
|
+
}
|
|
175
|
+
function ThinkRoutineError(props) {
|
|
176
|
+
const { error } = useRoutineActions();
|
|
177
|
+
return error ? /* @__PURE__ */ jsx("div", {
|
|
178
|
+
role: "alert",
|
|
179
|
+
...props,
|
|
180
|
+
children: error
|
|
181
|
+
}) : null;
|
|
182
|
+
}
|
|
183
|
+
function ThinkRoutineStatus(props) {
|
|
184
|
+
const { announcement } = useRoutineActions();
|
|
185
|
+
return /* @__PURE__ */ jsx("div", {
|
|
186
|
+
role: "status",
|
|
187
|
+
"aria-atomic": "true",
|
|
188
|
+
className: "sigvelo-visually-hidden",
|
|
189
|
+
...props,
|
|
190
|
+
children: announcement
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const ThinkRoutineActions = {
|
|
194
|
+
Root: ThinkRoutineActionsRoot,
|
|
195
|
+
Run: ThinkRoutineRun,
|
|
196
|
+
Delete: ThinkRoutineDelete,
|
|
197
|
+
Error: ThinkRoutineError,
|
|
198
|
+
Status: ThinkRoutineStatus
|
|
199
|
+
};
|
|
200
|
+
//#endregion
|
|
201
|
+
export { ThinkRoutineActions, useThinkRoutineActions };
|
|
@@ -13,7 +13,10 @@ interface ThinkRoutineBrowserProps<TRoutine extends ThinkRoutine = ThinkRoutine>
|
|
|
13
13
|
renderRoutineLink: (routine: TRoutine) => React.ReactElement;
|
|
14
14
|
/** App-authored TanStack Router Link to the routine creation route. */
|
|
15
15
|
createRoutineLink?: React.ReactElement;
|
|
16
|
-
/**
|
|
16
|
+
/** UI-only response to ordinary same-tab activation, including keyboard clicks.
|
|
17
|
+
* Modified, non-primary, download, and other-target clicks leave this UI unchanged.
|
|
18
|
+
* Receives the original React anchor event; routing remains with the rendered link.
|
|
19
|
+
*/
|
|
17
20
|
onRoutineLinkClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
18
21
|
}
|
|
19
22
|
/** Searchable, filterable navigation for an app-owned collection of Think routines. */
|