@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,4 +1,4 @@
|
|
|
1
|
-
import { i as WorkspaceFileState, r as WorkspaceFileAssetResolver } from "./WorkspaceFile-
|
|
1
|
+
import { i as WorkspaceFileState, r as WorkspaceFileAssetResolver } from "./WorkspaceFile-C8UzuSH4.js";
|
|
2
2
|
import { WorkspaceLike } from "@cloudflare/think";
|
|
3
3
|
import { FileInfo, Workspace } from "@cloudflare/shell";
|
|
4
4
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { l as WorkspaceNavigationAdapter } from "./WorkspaceLink-DK1DWMHe.js";
|
|
2
|
+
import { i as WorkspaceState } from "./Workspace-C9RFoxcu.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/WorkspaceExplorer.d.ts
|
|
6
|
+
interface WorkspaceExplorerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
7
|
+
workspace: WorkspaceState;
|
|
8
|
+
/** Host-owned URL/history adapter shared by chat links and the file explorer. */
|
|
9
|
+
navigation: WorkspaceNavigationAdapter;
|
|
10
|
+
/** Header label. Defaults to "Workspace". */
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
/** Leading workspace control, such as a host-owned Back to chat button. */
|
|
13
|
+
leading?: React.ReactNode;
|
|
14
|
+
/** Extra header actions, rendered next to the built-in refresh button. */
|
|
15
|
+
actions?: React.ReactNode;
|
|
16
|
+
/** Show the file filter input. Hidden by default to keep the browser compact. */
|
|
17
|
+
showFilter?: boolean;
|
|
18
|
+
filterPlaceholder?: string;
|
|
19
|
+
emptyState?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convenience workspace application composed from `WorkspaceBrowser` and
|
|
23
|
+
* `WorkspaceFileView`. The host adapter owns URLs and history; the explorer
|
|
24
|
+
* only restores presentation state for stable navigation entry keys.
|
|
25
|
+
*/
|
|
26
|
+
declare function WorkspaceExplorer({
|
|
27
|
+
...props
|
|
28
|
+
}: WorkspaceExplorerProps & {
|
|
29
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
30
|
+
}): React.JSX.Element;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { WorkspaceExplorerProps as n, WorkspaceExplorer as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-
|
|
3
|
-
import { f as MessageResponse, m as createWorkspaceRehypePlugins } from "./Message-
|
|
4
|
-
import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-
|
|
1
|
+
import { J as WarningIcon, T as MaximizeIcon, _ as EyeIcon, d as CodeIcon, h as DownloadIcon, s as CheckIcon } from "./icons--FqCZEc3.js";
|
|
2
|
+
import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-B1ykV1dS.js";
|
|
3
|
+
import { f as MessageResponse, m as createWorkspaceRehypePlugins } from "./Message-C4eYRogZ.js";
|
|
4
|
+
import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-Co1noLbC.js";
|
|
5
5
|
import { AppTopBar } from "./components/AppTopBar.js";
|
|
6
6
|
import { WorkspaceHeader } from "./components/WorkspaceHeader.js";
|
|
7
7
|
import { inferWorkspaceLanguage, inferWorkspaceMedia, isWorkspaceMarkdownPath, isWorkspaceSkillPath, parseWorkspaceSkill } from "./components/WorkspaceFile.js";
|
|
@@ -273,7 +273,7 @@ function WorkspaceImagePreview({ asset, fileName, media, url }) {
|
|
|
273
273
|
onError: () => setLoadFailed(true)
|
|
274
274
|
})
|
|
275
275
|
}), /* @__PURE__ */ jsx("div", {
|
|
276
|
-
className: "workspace-explorer__visually-hidden",
|
|
276
|
+
className: "workspace-explorer__visually-hidden sigvelo-visually-hidden",
|
|
277
277
|
role: "status",
|
|
278
278
|
"aria-live": "polite",
|
|
279
279
|
"aria-atomic": "true",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as cx } from "./class-names-
|
|
1
|
+
import { t as cx } from "./class-names-Bk-QLWWI.js";
|
|
2
|
+
import { n as isWorkspacePathWithinRoot, t as canonicalizeAbsoluteWorkspacePath } from "./workspace-path-L_KmjRjq.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/_internal/workspace-navigation-context.tsx
|
|
@@ -120,24 +121,9 @@ function decodeUrlPart(value) {
|
|
|
120
121
|
return null;
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
for (const segment of path.split("/")) {
|
|
127
|
-
if (!segment || segment === ".") continue;
|
|
128
|
-
if (segment === "..") segments.pop();
|
|
129
|
-
else segments.push(segment);
|
|
130
|
-
}
|
|
131
|
-
return `/${segments.join("/")}`;
|
|
132
|
-
}
|
|
133
|
-
function normalizeRoot(root) {
|
|
134
|
-
if (!root || hasInvalidPathCharacter(root)) return null;
|
|
135
|
-
const pathname = canonicalizeAbsolutePath(root);
|
|
136
|
-
if (!pathname) return null;
|
|
137
|
-
return pathname === "/" ? pathname : pathname.replace(/\/+$/, "");
|
|
138
|
-
}
|
|
139
|
-
function isWithinRoot(path, root) {
|
|
140
|
-
return root === "/" || path === root || path.startsWith(`${root}/`);
|
|
124
|
+
function canonicalizeWorkspaceLinkPath(path) {
|
|
125
|
+
if (hasInvalidPathCharacter(path)) return null;
|
|
126
|
+
return canonicalizeAbsoluteWorkspacePath(path);
|
|
141
127
|
}
|
|
142
128
|
function getPathSegments(path) {
|
|
143
129
|
return path === "/" ? [] : path.slice(1).split("/");
|
|
@@ -188,10 +174,10 @@ function getExternalDestination(href) {
|
|
|
188
174
|
}
|
|
189
175
|
/** Resolve a Markdown link to a validated workspace file, external URL, or unavailable target. */
|
|
190
176
|
function resolveWorkspaceLink({ href, root, base }) {
|
|
191
|
-
const normalizedRoot =
|
|
192
|
-
const normalizedBase =
|
|
177
|
+
const normalizedRoot = canonicalizeWorkspaceLinkPath(root);
|
|
178
|
+
const normalizedBase = canonicalizeWorkspaceLinkPath(base.path);
|
|
193
179
|
const trimmedHref = href.trim();
|
|
194
|
-
if (!normalizedRoot || !normalizedBase || !
|
|
180
|
+
if (!normalizedRoot || !normalizedBase || !isWorkspacePathWithinRoot(normalizedBase, normalizedRoot) || !trimmedHref || hasInvalidPathCharacter(href)) return invalid(href, "invalid-path");
|
|
195
181
|
if (trimmedHref.startsWith("//")) return getExternalDestination(trimmedHref);
|
|
196
182
|
if (URL_SCHEME.test(trimmedHref)) return getExternalDestination(trimmedHref);
|
|
197
183
|
if (trimmedHref.startsWith("#") && base.kind === "directory") return invalid(href, "fragment-without-file");
|
|
@@ -204,7 +190,7 @@ function resolveWorkspaceLink({ href, root, base }) {
|
|
|
204
190
|
if (rawFragment !== null && rawFragment !== "" && fragment === null || fragment !== null && hasInvalidPathCharacter(fragment)) return invalid(href, "invalid-path");
|
|
205
191
|
const localPath = resolveLocalPath(rawPath, normalizedRoot, base, normalizedBase);
|
|
206
192
|
if ("reason" in localPath) return invalid(href, localPath.reason);
|
|
207
|
-
if (!
|
|
193
|
+
if (!isWorkspacePathWithinRoot(localPath.path, normalizedRoot)) return invalid(href, "outside-workspace");
|
|
208
194
|
return {
|
|
209
195
|
kind: "file",
|
|
210
196
|
path: localPath.path,
|
|
@@ -250,9 +236,9 @@ function UnavailableWorkspaceLink({ children, className }) {
|
|
|
250
236
|
"aria-hidden": "true",
|
|
251
237
|
children: "↛"
|
|
252
238
|
}),
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
className: "workspace-link__visually-hidden",
|
|
255
|
-
children: " (link unavailable)"
|
|
239
|
+
/* @__PURE__ */ jsxs("span", {
|
|
240
|
+
className: "workspace-link__visually-hidden sigvelo-visually-hidden",
|
|
241
|
+
children: [" ", "(link unavailable)"]
|
|
256
242
|
})
|
|
257
243
|
]
|
|
258
244
|
});
|
|
@@ -298,9 +284,9 @@ function WorkspaceFileLink({ children, className, download, href = "", node: _no
|
|
|
298
284
|
className: "workspace-link__external-mark",
|
|
299
285
|
"aria-hidden": "true",
|
|
300
286
|
children: "↗"
|
|
301
|
-
}), /* @__PURE__ */
|
|
302
|
-
className: "workspace-link__visually-hidden",
|
|
303
|
-
children: " (opens in a new tab)"
|
|
287
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
288
|
+
className: "workspace-link__visually-hidden sigvelo-visually-hidden",
|
|
289
|
+
children: [" ", "(opens in a new tab)"]
|
|
304
290
|
})] }) : null]
|
|
305
291
|
});
|
|
306
292
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/components/_internal/class-names.ts
|
|
2
|
+
function cx(...parts) {
|
|
3
|
+
if (parts.some((part) => typeof part === "function")) return (state) => parts.map((part) => typeof part === "function" ? part(state) : part).filter(Boolean).join(" ");
|
|
4
|
+
return parts.filter(Boolean).join(" ");
|
|
5
|
+
}
|
|
6
|
+
function mergeBaseClassName(stableClassName, className) {
|
|
7
|
+
if (typeof className === "function") return (state) => cx(stableClassName, className(state));
|
|
8
|
+
return cx(stableClassName, className);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { mergeBaseClassName as n, cx as t };
|
|
@@ -2,21 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Accordion.d.ts
|
|
5
|
-
interface AccordionProps extends
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
interface
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
interface AccordionTriggerProps extends Omit<React.ComponentPropsWithRef<typeof Accordion$1.Trigger>, "className"> {
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
interface AccordionHeaderProps extends Omit<Accordion$1.Header.Props, "className"> {
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
interface AccordionPanelProps extends Omit<React.ComponentPropsWithRef<typeof Accordion$1.Panel>, "className"> {
|
|
18
|
-
className?: string;
|
|
19
|
-
}
|
|
5
|
+
interface AccordionProps extends React.ComponentPropsWithRef<typeof Accordion$1.Root> {}
|
|
6
|
+
interface AccordionItemProps extends React.ComponentPropsWithRef<typeof Accordion$1.Item> {}
|
|
7
|
+
interface AccordionTriggerProps extends React.ComponentPropsWithRef<typeof Accordion$1.Trigger> {}
|
|
8
|
+
interface AccordionHeaderProps extends Accordion$1.Header.Props {}
|
|
9
|
+
interface AccordionPanelProps extends React.ComponentPropsWithRef<typeof Accordion$1.Panel> {}
|
|
20
10
|
/**
|
|
21
11
|
* An accordion component for showing collapsible content sections.
|
|
22
12
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-Bk-QLWWI.js";
|
|
1
2
|
import "react";
|
|
2
3
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -21,8 +22,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
21
22
|
*
|
|
22
23
|
* @see {@link https://base-ui.com/react/components/accordion | Base UI Accordion}
|
|
23
24
|
*/
|
|
24
|
-
function AccordionRoot({ className
|
|
25
|
-
const classes = ["accordion"
|
|
25
|
+
function AccordionRoot({ className, ref, ...props }) {
|
|
26
|
+
const classes = mergeBaseClassName(["accordion"].filter(Boolean).join(" "), className);
|
|
26
27
|
return /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
27
28
|
ref,
|
|
28
29
|
className: classes,
|
|
@@ -32,16 +33,16 @@ function AccordionRoot({ className = "", ref, ...props }) {
|
|
|
32
33
|
/**
|
|
33
34
|
* A single item within an Accordion.
|
|
34
35
|
*/
|
|
35
|
-
function AccordionItem({ className
|
|
36
|
-
const classes = ["accordion__item"
|
|
36
|
+
function AccordionItem({ className, ref, ...props }) {
|
|
37
|
+
const classes = mergeBaseClassName(["accordion__item"].filter(Boolean).join(" "), className);
|
|
37
38
|
return /* @__PURE__ */ jsx(Accordion$1.Item, {
|
|
38
39
|
ref,
|
|
39
40
|
className: classes,
|
|
40
41
|
...props
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
|
-
function AccordionHeader({ className
|
|
44
|
-
const classes = ["accordion__header"
|
|
44
|
+
function AccordionHeader({ className, ref, ...props }) {
|
|
45
|
+
const classes = mergeBaseClassName(["accordion__header"].filter(Boolean).join(" "), className);
|
|
45
46
|
return /* @__PURE__ */ jsx(Accordion$1.Header, {
|
|
46
47
|
ref,
|
|
47
48
|
className: classes,
|
|
@@ -54,8 +55,8 @@ function AccordionHeader({ className = "", ref, ...props }) {
|
|
|
54
55
|
/**
|
|
55
56
|
* The clickable trigger button within an AccordionItem.
|
|
56
57
|
*/
|
|
57
|
-
function AccordionTrigger({ className
|
|
58
|
-
const classes = ["accordion__trigger"
|
|
58
|
+
function AccordionTrigger({ className, ref, ...props }) {
|
|
59
|
+
const classes = mergeBaseClassName(["accordion__trigger"].filter(Boolean).join(" "), className);
|
|
59
60
|
return /* @__PURE__ */ jsx(Accordion$1.Trigger, {
|
|
60
61
|
ref,
|
|
61
62
|
className: classes,
|
|
@@ -65,8 +66,8 @@ function AccordionTrigger({ className = "", ref, ...props }) {
|
|
|
65
66
|
/**
|
|
66
67
|
* The collapsible content panel of an AccordionItem.
|
|
67
68
|
*/
|
|
68
|
-
function AccordionPanel({ className
|
|
69
|
-
const classes = ["accordion__panel"
|
|
69
|
+
function AccordionPanel({ className, ref, ...props }) {
|
|
70
|
+
const classes = mergeBaseClassName(["accordion__panel"].filter(Boolean).join(" "), className);
|
|
70
71
|
return /* @__PURE__ */ jsx(Accordion$1.Panel, {
|
|
71
72
|
ref,
|
|
72
73
|
className: classes,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Collapsible } from "
|
|
1
|
+
import { t as Collapsible } from "../Collapsible-N64ASIQr.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Activity.d.ts
|
|
5
|
-
interface ActivityProps extends Omit<React.ComponentProps<typeof Collapsible.Root>, "
|
|
6
|
-
className?: string;
|
|
5
|
+
interface ActivityProps extends Omit<React.ComponentProps<typeof Collapsible.Root>, "unstyled"> {
|
|
7
6
|
/** While true, the trigger label shimmers. */
|
|
8
7
|
isStreaming?: boolean;
|
|
9
8
|
}
|
|
@@ -36,8 +35,7 @@ declare function Activity({
|
|
|
36
35
|
}: ActivityProps & {
|
|
37
36
|
ref?: React.Ref<HTMLDivElement>;
|
|
38
37
|
}): React.JSX.Element;
|
|
39
|
-
interface ActivityTriggerProps extends Omit<React.ComponentProps<typeof Collapsible.Trigger>, "
|
|
40
|
-
className?: string;
|
|
38
|
+
interface ActivityTriggerProps extends Omit<React.ComponentProps<typeof Collapsible.Trigger>, "unstyled"> {
|
|
41
39
|
/** Header text. Defaults to "Working…". */
|
|
42
40
|
label?: React.ReactNode;
|
|
43
41
|
/** Optional leading icon for the header. */
|
|
@@ -83,9 +81,7 @@ declare function ActivityTrigger({
|
|
|
83
81
|
}: ActivityTriggerProps & {
|
|
84
82
|
ref?: React.Ref<HTMLButtonElement>;
|
|
85
83
|
}): React.JSX.Element;
|
|
86
|
-
interface ActivityContentProps extends Omit<React.ComponentProps<typeof Collapsible.Panel>, "
|
|
87
|
-
className?: string;
|
|
88
|
-
}
|
|
84
|
+
interface ActivityContentProps extends Omit<React.ComponentProps<typeof Collapsible.Panel>, "unstyled"> {}
|
|
89
85
|
/** The collapsible log of ActivityItem children. */
|
|
90
86
|
declare function ActivityContent({
|
|
91
87
|
className,
|
|
@@ -95,8 +91,7 @@ declare function ActivityContent({
|
|
|
95
91
|
}: ActivityContentProps & {
|
|
96
92
|
ref?: React.Ref<HTMLDivElement>;
|
|
97
93
|
}): React.JSX.Element;
|
|
98
|
-
interface ActivityItemGroupProps extends Omit<React.ComponentProps<typeof Collapsible.Root>, "
|
|
99
|
-
className?: string;
|
|
94
|
+
interface ActivityItemGroupProps extends Omit<React.ComponentProps<typeof Collapsible.Root>, "unstyled"> {
|
|
100
95
|
/** The row text, e.g. "Ran bash · vp test". */
|
|
101
96
|
label: React.ReactNode;
|
|
102
97
|
/** Optional leading icon for the row. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-Bk-QLWWI.js";
|
|
1
2
|
import { Collapsible } from "./Collapsible.js";
|
|
2
|
-
import {
|
|
3
|
-
import { l as ChevronRightIcon } from "../icons-CpfUer49.js";
|
|
3
|
+
import { u as ChevronRightIcon } from "../icons--FqCZEc3.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Activity.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as MonitorIcon, C as InfoIcon, J as WarningIcon, K as TerminalIcon, P as PencilIcon, Y as WrenchIcon, w as LinkIcon, y as FileIcon, z as SearchIcon } from "../icons--FqCZEc3.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/AgentActivity.tsx
|
|
@@ -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 { E as McpIcon, J as WarningIcon, V as SpinnerIcon, X as XIcon, y as FileIcon } from "../icons--FqCZEc3.js";
|
|
3
3
|
import { ActivityHeader } from "./Activity.js";
|
|
4
4
|
import { AgentActivityFavicon, AgentActivityIcon } from "./AgentActivity.js";
|
|
5
5
|
import "react";
|
|
@@ -37,7 +37,7 @@ declare function AgentAttentionHeader({
|
|
|
37
37
|
}: AgentAttentionHeaderProps & {
|
|
38
38
|
ref?: React.Ref<HTMLDivElement>;
|
|
39
39
|
}): React.JSX.Element;
|
|
40
|
-
interface AgentAttentionTriggerProps extends Omit<ButtonProps, "children" | "
|
|
40
|
+
interface AgentAttentionTriggerProps extends Omit<ButtonProps, "children" | "color" | "size" | "title" | "variant">, AgentAttentionHeadingProps {
|
|
41
41
|
className?: string;
|
|
42
42
|
}
|
|
43
43
|
/** Whole-surface trigger for opening the owning agent client or disclosure. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { AgentChat, AgentChatComposerDraft,
|
|
1
|
+
import { a as PermissionModeControl, i as AgentChatRenderMessageContext, n as AgentChatComposerDraft, r as AgentChatProps, t as AgentChat } from "../AgentChat-CRuMi1Pb.js";
|
|
2
|
+
export { AgentChat, AgentChatComposerDraft, AgentChatProps, AgentChatRenderMessageContext, PermissionModeControl };
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-Bk-QLWWI.js";
|
|
2
|
+
import { I as PlusIcon, L as QueueIcon, P as PencilIcon, R as RefreshIcon, U as SteerIcon, q as TrashIcon } from "../icons--FqCZEc3.js";
|
|
3
|
+
import { n as MessageAction, r as MessageActions, t as Message } from "../Message-C4eYRogZ.js";
|
|
4
|
+
import { AgentMessageParts } from "./AgentMessageParts.js";
|
|
4
5
|
import { Context, ContextContent, ContextContentBody, ContextContentHeader, ContextTrigger, getContextUsage, getContextUsedTokens } from "./Context.js";
|
|
5
6
|
import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport } from "./MessageScroller.js";
|
|
6
7
|
import { ConversationEmptyState } from "./Conversation.js";
|
|
7
|
-
import { d as MessageContent, f as MessageResponse, i as MessageAttachment, n as MessageAction, r as MessageActions, t as Message } from "../Message-BkMdE3bS.js";
|
|
8
8
|
import { AgentChatMessageEditor } from "./AgentChatMessageEditor.js";
|
|
9
9
|
import { Marker, MarkerContent } from "./Marker.js";
|
|
10
10
|
import { Menu } from "./Menu.js";
|
|
11
11
|
import { PromptInput, PromptInputActionAddAttachments, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuTrigger, PromptInputApproval, PromptInputAttachments, PromptInputBody, PromptInputButton, PromptInputCommandComposer, PromptInputContextSelector, PromptInputDictation, PromptInputFooter, PromptInputHeader, PromptInputPermissionSelector, PromptInputReferences, PromptInputSubmit, PromptInputTextarea, PromptInputTools, getApprovalRequestId, getApprovalStateKey, getPendingToolApprovals, usePromptInputAttachments } from "./PromptInput.js";
|
|
12
|
-
import {
|
|
13
|
-
import { Source, Sources, SourcesContent, SourcesTrigger } from "./Sources.js";
|
|
14
|
-
import { getToolDisplayName, isToolPartFailed, isToolPartWorking } from "./ThinkChatToolParts.js";
|
|
15
|
-
import { t as CopyButton } from "../copy-button-Dejn5heL.js";
|
|
16
|
-
import { t as summarizeToolInput } from "../summarize-tool-input-BUJsENSn.js";
|
|
12
|
+
import { t as CopyButton } from "../copy-button-cYsJBauI.js";
|
|
17
13
|
import * as React from "react";
|
|
18
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
15
|
import { isCompactionMessage } from "agents/experimental/memory/utils";
|
|
20
|
-
import {
|
|
21
|
-
import { isFileUIPart, isReasoningUIPart, isTextUIPart, isToolUIPart } from "ai";
|
|
16
|
+
import { isReasoningUIPart, isTextUIPart } from "ai";
|
|
22
17
|
//#region src/components/AgentChat.tsx
|
|
18
|
+
/**
|
|
19
|
+
* Agents exports this helper from `agents/sessions` after cloudflare/agents#1896;
|
|
20
|
+
* the current 0.17.4 release still publishes it from the experimental path.
|
|
21
|
+
* It checks the canonical `compaction_` id prefix used when Session history
|
|
22
|
+
* materializes a summary overlay. `UIMessage` is structurally compatible with
|
|
23
|
+
* the `SessionMessage` fields it reads, so use the upstream helper directly
|
|
24
|
+
* instead of duplicating the prefix contract locally.
|
|
25
|
+
*/
|
|
23
26
|
const EMPTY_PENDING_APPROVALS = [];
|
|
24
27
|
const EMPTY_SKIPPED_APPROVAL_IDS = [];
|
|
25
28
|
function createApprovalSessionState(thinkStub) {
|
|
@@ -45,10 +48,8 @@ function AgentChatAddMenu({ children }) {
|
|
|
45
48
|
sideOffset: 12,
|
|
46
49
|
collisionPadding: 8,
|
|
47
50
|
className: "agent-chat__add-menu",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
children: "Add"
|
|
51
|
-
}), /* @__PURE__ */ jsx(PromptInputActionAddAttachments, {})] }), children]
|
|
51
|
+
"data-recipe": "composer-command-surface wide-scroll-picker",
|
|
52
|
+
children: [/* @__PURE__ */ jsxs(Menu.Group, { children: [/* @__PURE__ */ jsx(Menu.GroupLabel, { children: "Add" }), /* @__PURE__ */ jsx(PromptInputActionAddAttachments, {})] }), children]
|
|
52
53
|
})] });
|
|
53
54
|
}
|
|
54
55
|
function AgentChatSubmitAction({ status, onStop, allowSubmitWhileBusy, disabled, hasDraft }) {
|
|
@@ -61,58 +62,6 @@ function AgentChatSubmitAction({ status, onStop, allowSubmitWhileBusy, disabled,
|
|
|
61
62
|
disabled
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Per-message row-size compaction marker from `AIChatAgent` persistence.
|
|
66
|
-
*
|
|
67
|
-
* This is distinct from Session history compaction overlays. When a single
|
|
68
|
-
* SQLite row approaches the Workers/SQLite size limit, Agents compacts large
|
|
69
|
-
* tool outputs and, if necessary, truncates text before persistence. The
|
|
70
|
-
* message remains in place and receives metadata keys documented by Agents:
|
|
71
|
-
* `compactedToolOutputs` lists tool-call ids whose outputs were summarized;
|
|
72
|
-
* `compactedTextParts` lists text-part indexes that were truncated. The UI
|
|
73
|
-
* reads those keys structurally because they are persisted metadata rather than
|
|
74
|
-
* exported AI SDK part variants, then adds a local visual note while preserving
|
|
75
|
-
* the original `UIMessage` and part shapes.
|
|
76
|
-
*
|
|
77
|
-
* @see https://github.com/cloudflare/agents/blob/main/docs/agents/chat-agents.md#row-size-protection
|
|
78
|
-
*/
|
|
79
|
-
function isCompactedPart(message, part, partIndex) {
|
|
80
|
-
const metadata = message.metadata;
|
|
81
|
-
if (isTextUIPart(part)) return Array.isArray(metadata?.compactedTextParts) && metadata.compactedTextParts.includes(partIndex);
|
|
82
|
-
if (isToolUIPart(part)) return Array.isArray(metadata?.compactedToolOutputs) && metadata.compactedToolOutputs.includes(part.toolCallId);
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
function getPartKey(part, partIndex) {
|
|
86
|
-
if (isToolUIPart(part)) return part.toolCallId;
|
|
87
|
-
if ("id" in part && typeof part.id === "string") return `${part.type}-${part.id}`;
|
|
88
|
-
return `${part.type}-${partIndex}`;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* AI SDK exports concrete source part types but no public source-part guard.
|
|
92
|
-
* Keep these local guards as exact discriminant checks, matching
|
|
93
|
-
* `ai/src/ui/ui-messages.ts` and `ai/src/ui/process-ui-message-stream.ts`.
|
|
94
|
-
* If AI SDK exports source or step guards later, replace these wrappers rather
|
|
95
|
-
* than widening the local transcript contract.
|
|
96
|
-
*/
|
|
97
|
-
function isSourceUrlPart(part) {
|
|
98
|
-
return part?.type === "source-url";
|
|
99
|
-
}
|
|
100
|
-
function isSourceDocumentPart(part) {
|
|
101
|
-
return part?.type === "source-document";
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Session compaction overlay marker from Agents Sessions.
|
|
105
|
-
*
|
|
106
|
-
* Agents exports `isCompactionMessage` from `agents/sessions`; it checks the canonical `compaction_`
|
|
107
|
-
* id prefix used when `Session.getHistory()` materializes a summary overlay.
|
|
108
|
-
* `UIMessage` is structurally compatible with the fields the helper reads, so
|
|
109
|
-
* keep this wrapper instead of duplicating the prefix test locally. The
|
|
110
|
-
* runtime import above stays on the deprecated compatibility path until this
|
|
111
|
-
* package raises its Agents dependency floor to the graduating release.
|
|
112
|
-
*/
|
|
113
|
-
function isCompactionMessage$1(message) {
|
|
114
|
-
return isCompactionMessage(message);
|
|
115
|
-
}
|
|
116
65
|
function getMessageText(message) {
|
|
117
66
|
return message.parts.filter((part) => isTextUIPart(part) || isReasoningUIPart(part)).map((part) => part.text).join("");
|
|
118
67
|
}
|
|
@@ -146,77 +95,6 @@ function getEditableUserText(message) {
|
|
|
146
95
|
const part = message.parts[0];
|
|
147
96
|
return isTextUIPart(part) && part.text.trim() ? part.text : void 0;
|
|
148
97
|
}
|
|
149
|
-
function formatSourceTitle(part) {
|
|
150
|
-
if (part.title) return part.title;
|
|
151
|
-
if (part.type === "source-document") return part.filename ?? part.mediaType;
|
|
152
|
-
try {
|
|
153
|
-
return new URL(part.url).hostname.replace(/^www\./, "");
|
|
154
|
-
} catch {
|
|
155
|
-
return part.url;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function renderSources(parts) {
|
|
159
|
-
return /* @__PURE__ */ jsxs(Sources, { children: [/* @__PURE__ */ jsx(SourcesTrigger, { count: parts.length }), /* @__PURE__ */ jsx(SourcesContent, { children: parts.map((part) => part.type === "source-url" ? /* @__PURE__ */ jsx(Source, {
|
|
160
|
-
href: part.url,
|
|
161
|
-
title: formatSourceTitle(part)
|
|
162
|
-
}, part.sourceId) : /* @__PURE__ */ jsx(Source, {
|
|
163
|
-
title: formatSourceTitle(part),
|
|
164
|
-
description: part.filename ?? part.mediaType
|
|
165
|
-
}, part.sourceId)) })] });
|
|
166
|
-
}
|
|
167
|
-
function getSourceRun(parts, start) {
|
|
168
|
-
const sources = [];
|
|
169
|
-
for (let index = start; index < parts.length; index++) {
|
|
170
|
-
const candidate = parts[index];
|
|
171
|
-
if (!isSourceUrlPart(candidate) && !isSourceDocumentPart(candidate)) break;
|
|
172
|
-
sources.push(candidate);
|
|
173
|
-
}
|
|
174
|
-
return sources;
|
|
175
|
-
}
|
|
176
|
-
function describeToolPart(part) {
|
|
177
|
-
const name = getToolDisplayName(part);
|
|
178
|
-
const verb = isToolPartFailed(part) ? `${name} failed` : isToolPartWorking(part) ? `Running ${name}` : `Ran ${name}`;
|
|
179
|
-
const detail = summarizeToolInput(getToolInput(part));
|
|
180
|
-
return detail ? `${verb} · ${detail}` : verb;
|
|
181
|
-
}
|
|
182
|
-
function formatToolValue(value) {
|
|
183
|
-
if (value === void 0) return void 0;
|
|
184
|
-
return typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
185
|
-
}
|
|
186
|
-
function renderToolActivity(part) {
|
|
187
|
-
const state = getToolPartState(part);
|
|
188
|
-
const failed = isToolPartFailed(part);
|
|
189
|
-
const deniedReason = part.state === "output-denied" ? part.approval.reason : void 0;
|
|
190
|
-
const output = state === "error" ? part.errorText : state === "denied" ? deniedReason ?? "Denied" : formatToolValue(getToolOutput(part));
|
|
191
|
-
return /* @__PURE__ */ jsxs(Activity, {
|
|
192
|
-
isStreaming: isToolPartWorking(part),
|
|
193
|
-
children: [/* @__PURE__ */ jsx(ActivityTrigger, { label: describeToolPart(part) }), /* @__PURE__ */ jsxs(ActivityContent, { children: [/* @__PURE__ */ jsx(ActivityPanel, {
|
|
194
|
-
label: getToolDisplayName(part),
|
|
195
|
-
text: formatToolValue(getToolInput(part))
|
|
196
|
-
}), output ? /* @__PURE__ */ jsx(ActivityPanel, {
|
|
197
|
-
label: "output",
|
|
198
|
-
text: output,
|
|
199
|
-
status: state === "denied" ? "denied" : failed ? "error" : void 0,
|
|
200
|
-
error: failed
|
|
201
|
-
}) : null] })]
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
function renderDefaultPart(message, part, partIndex, isLastMessage, status) {
|
|
205
|
-
if (isTextUIPart(part) && part.text) return /* @__PURE__ */ jsx(MessageResponse, { children: part.text });
|
|
206
|
-
if (isFileUIPart(part)) return /* @__PURE__ */ jsx(MessageAttachment, { part });
|
|
207
|
-
if (isReasoningUIPart(part)) {
|
|
208
|
-
if (partIndex !== message.parts.findIndex(isReasoningUIPart)) return null;
|
|
209
|
-
const reasoningText = message.parts.filter(isReasoningUIPart).map((reasoningPart) => reasoningPart.text).join("\n\n");
|
|
210
|
-
if (!reasoningText) return null;
|
|
211
|
-
const lastPart = message.parts.at(-1);
|
|
212
|
-
return /* @__PURE__ */ jsxs(Reasoning, {
|
|
213
|
-
isStreaming: isLastMessage && status === "streaming" && lastPart !== void 0 && isReasoningUIPart(lastPart) && lastPart.state === "streaming",
|
|
214
|
-
children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: reasoningText })]
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
if (isToolUIPart(part)) return renderToolActivity(part);
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
98
|
/**
|
|
221
99
|
* Low-level transcript/composer surface used by `ThinkChat`: props in, no
|
|
222
100
|
* transport. Product code that talks to a Cloudflare Think agent should render
|
|
@@ -302,11 +180,11 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
302
180
|
React.useLayoutEffect(() => {
|
|
303
181
|
setApprovalSession((previous) => previous.thinkStub === thinkStub ? previous : createApprovalSessionState(thinkStub));
|
|
304
182
|
}, [thinkStub]);
|
|
305
|
-
const pendingApprovalItems = [...getPendingToolApprovals(messages, { pausedExecutions: Boolean(thinkStub) }).filter((
|
|
183
|
+
const pendingApprovalItems = [...getPendingToolApprovals(messages, { pausedExecutions: Boolean(thinkStub) }).filter((part) => {
|
|
306
184
|
if (part.state === "approval-requested" && !onApprovalResponse) return false;
|
|
307
185
|
const id = getApprovalStateKey(part);
|
|
308
186
|
return Boolean(id) && !skippedApprovalIds.includes(id);
|
|
309
|
-
}).map((
|
|
187
|
+
}).map((part) => ({ part })), ...thinkStub ? durableApprovals.filter((approval) => approval.source === "action" && !skippedApprovalIds.includes(approval.executionId)).map((approval) => ({ approval })) : []];
|
|
310
188
|
const approvalsWired = Boolean(onApprovalResponse || thinkStub);
|
|
311
189
|
const autoApprovedIds = React.useRef({
|
|
312
190
|
thinkStub,
|
|
@@ -347,7 +225,7 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
347
225
|
const contextUsage = contextWindow ? getContextUsage(messages) : void 0;
|
|
348
226
|
const queuedMessageIds = new Set(queuedMessages.map((message) => message.id));
|
|
349
227
|
const transcriptMessages = queuedMessageIds.size ? messages.filter((message) => !queuedMessageIds.has(message.id)) : messages;
|
|
350
|
-
const newestAssistantIndex = transcriptMessages.findLastIndex((message) => message.role === "assistant" && !isCompactionMessage
|
|
228
|
+
const newestAssistantIndex = transcriptMessages.findLastIndex((message) => message.role === "assistant" && !isCompactionMessage(message));
|
|
351
229
|
const lastAssistantIndex = onRegenerate && status !== "streaming" && status !== "submitted" ? newestAssistantIndex : -1;
|
|
352
230
|
const lastUserIndex = onEditAndResend && !disabled && status !== "streaming" && status !== "submitted" ? transcriptMessages.findLastIndex((message) => message.role === "user") : -1;
|
|
353
231
|
const [editingMessageId, setEditingMessageId] = React.useState();
|
|
@@ -355,7 +233,7 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
355
233
|
const editButtonRef = React.useRef(null);
|
|
356
234
|
let assistantResponseCount = 0;
|
|
357
235
|
const assistantResponseNumbers = transcriptMessages.map((message) => {
|
|
358
|
-
if (message.role !== "assistant" || isCompactionMessage
|
|
236
|
+
if (message.role !== "assistant" || isCompactionMessage(message)) return 0;
|
|
359
237
|
assistantResponseCount += 1;
|
|
360
238
|
return assistantResponseCount;
|
|
361
239
|
});
|
|
@@ -379,7 +257,7 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
379
257
|
"data-composer-hidden": showComposer ? void 0 : "",
|
|
380
258
|
children: [
|
|
381
259
|
/* @__PURE__ */ jsx("span", {
|
|
382
|
-
className: "message__copy-status",
|
|
260
|
+
className: "message__copy-status sigvelo-visually-hidden",
|
|
383
261
|
role: "status",
|
|
384
262
|
"aria-atomic": "true",
|
|
385
263
|
children: copyAnnouncement
|
|
@@ -401,7 +279,7 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
401
279
|
}) : null, transcriptMessages.map((message, messageIndex) => /* @__PURE__ */ jsx(MessageScrollerItem, {
|
|
402
280
|
messageId: message.id,
|
|
403
281
|
scrollAnchor: message.role === "user",
|
|
404
|
-
children: isCompactionMessage
|
|
282
|
+
children: isCompactionMessage(message) ? /* @__PURE__ */ jsx(Marker, {
|
|
405
283
|
variant: "separator",
|
|
406
284
|
children: /* @__PURE__ */ jsx(MarkerContent, { children: getMessageText(message) || "Conversation compacted" })
|
|
407
285
|
}) : /* @__PURE__ */ jsx(Message, {
|
|
@@ -419,25 +297,10 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
419
297
|
setEditingMessageId(void 0);
|
|
420
298
|
}
|
|
421
299
|
}, message.id) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
part,
|
|
427
|
-
partIndex,
|
|
428
|
-
defaultRender
|
|
429
|
-
});
|
|
430
|
-
if (isSourceUrlPart(part) || isSourceDocumentPart(part)) {
|
|
431
|
-
if (custom !== void 0) return custom ? /* @__PURE__ */ jsx(MessageContent, { children: custom }, getPartKey(part, partIndex)) : null;
|
|
432
|
-
const previous = message.parts[partIndex - 1];
|
|
433
|
-
if (isSourceUrlPart(previous) || isSourceDocumentPart(previous)) return null;
|
|
434
|
-
return /* @__PURE__ */ jsx(MessageContent, { children: renderSources(getSourceRun(message.parts, partIndex)) }, getPartKey(part, partIndex));
|
|
435
|
-
}
|
|
436
|
-
const rendered = custom === void 0 ? defaultRender() : custom;
|
|
437
|
-
return rendered ? /* @__PURE__ */ jsxs(MessageContent, { children: [rendered, isCompactedPart(message, part, partIndex) ? /* @__PURE__ */ jsx("div", {
|
|
438
|
-
className: "message__compacted",
|
|
439
|
-
children: "Output truncated for storage"
|
|
440
|
-
}) : null] }, getPartKey(part, partIndex)) : null;
|
|
300
|
+
/* @__PURE__ */ jsx(AgentMessageParts, {
|
|
301
|
+
message,
|
|
302
|
+
status: messageIndex === transcriptMessages.length - 1 ? status : "ready",
|
|
303
|
+
renderPart
|
|
441
304
|
}),
|
|
442
305
|
renderMessageAfter?.({
|
|
443
306
|
message,
|
|
@@ -501,7 +364,7 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
501
364
|
children: /* @__PURE__ */ jsx(QueueIcon, {})
|
|
502
365
|
}),
|
|
503
366
|
/* @__PURE__ */ jsx("span", {
|
|
504
|
-
className: "agent-chat__queued-text",
|
|
367
|
+
className: "agent-chat__queued-text sigvelo-truncate",
|
|
505
368
|
children: messageText
|
|
506
369
|
}),
|
|
507
370
|
onSteerQueuedMessage ? /* @__PURE__ */ jsxs("button", {
|
|
@@ -66,7 +66,7 @@ function AgentChatMessageEditor({ message, originalText, onCancel, onSubmit, onS
|
|
|
66
66
|
onCancel();
|
|
67
67
|
}
|
|
68
68
|
}),
|
|
69
|
-
error ? /* @__PURE__ */ jsx(Field.
|
|
69
|
+
error ? /* @__PURE__ */ jsx(Field.Errors, { errors: [error] }) : null
|
|
70
70
|
]
|
|
71
71
|
}), /* @__PURE__ */ jsxs("div", {
|
|
72
72
|
className: "message__edit-actions",
|