@mcp-b/react-components 0.14.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentActivity-BNUNrP9O.d.ts +36 -0
- package/dist/{AgentChat-DQkqt82e.d.ts → AgentChat-CrlpbvQJ.d.ts} +58 -6
- package/dist/{CodeBlock-DUh9WOGo.d.ts → CodeBlock-BRajW4QU.d.ts} +1 -1
- package/dist/{CodeBlock-BUFXG8HW.js → CodeBlock-BmB4Xaqq.js} +15 -4
- package/dist/{FileTree-mpEIcfzA.js → FileTree-CkVbIMWV.js} +82 -89
- package/dist/Message-BkMdE3bS.js +375 -0
- package/dist/{ModelSelector-CPCpFAUt.js → ModelSelector-SlJNgwKY.js} +2 -2
- package/dist/{PromptInput-ClNqBiIw.d.ts → PromptInput-BWTuXMOD.d.ts} +123 -5
- package/dist/ResponsiveSidebarShell-Dd9DCcBT.d.ts +67 -0
- package/dist/{Select-Dl_vF_Bt.d.ts → Select-BeEsefzh.d.ts} +12 -2
- package/dist/{ThinkChat-BPcehdbP.js → ThinkChat-CzC-zNGA.js} +24 -36
- package/dist/{ThinkChatActivity-BmwuIigx.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
- package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
- package/dist/{ThinkChatToolParts-CDEjqS6A.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +13 -3
- package/dist/ThinkExecutionRun-ChhWhOoU.d.ts +30 -0
- package/dist/Toggle-CAAlNl-M.d.ts +69 -0
- package/dist/ToggleGroup-8hPv-b69.d.ts +73 -0
- package/dist/Workspace-D39LxGvP.d.ts +62 -0
- package/dist/WorkspaceFile-DOZkPwzu.d.ts +106 -0
- package/dist/WorkspaceFileView-rSN_yT0L.js +744 -0
- package/dist/WorkspaceLink-DIPbXrUM.js +337 -0
- package/dist/WorkspaceLink-DK1DWMHe.d.ts +89 -0
- package/dist/components/Activity.d.ts +27 -1
- package/dist/components/Activity.js +33 -15
- package/dist/components/AgentActivity.d.ts +2 -0
- package/dist/components/AgentActivity.js +45 -0
- package/dist/components/AgentActivityPreview.d.ts +46 -0
- package/dist/components/AgentActivityPreview.js +94 -0
- package/dist/components/AgentAttention.d.ts +73 -0
- package/dist/components/AgentAttention.js +85 -0
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +224 -200
- package/dist/components/AgentChatMessageEditor.d.ts +29 -0
- package/dist/components/AgentChatMessageEditor.js +92 -0
- package/dist/components/AgentChatTurnError.d.ts +17 -0
- package/dist/components/AgentChatTurnError.js +40 -0
- package/dist/components/AgentConnection.d.ts +12 -17
- package/dist/components/AgentConnection.js +99 -91
- package/dist/components/AppFrame.d.ts +24 -0
- package/dist/components/AppFrame.js +25 -0
- package/dist/components/AppTopBar.d.ts +71 -0
- package/dist/components/AppTopBar.js +82 -0
- package/dist/components/Artifact.js +1 -1
- package/dist/components/BrowserLiveView.js +1 -1
- package/dist/components/BrowserReplay.js +1 -1
- package/dist/components/BrowserRunPanel.js +1 -1
- package/dist/components/Card.d.ts +3 -0
- package/dist/components/Card.js +2 -1
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +1 -1
- package/dist/components/ChatGptSignInScreen.js +2 -2
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/CheckboxGroup.d.ts +58 -2
- package/dist/components/CheckboxGroup.js +59 -1
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.js +1 -1
- package/dist/components/Commit.js +2 -2
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/Conversation.js +1 -1
- package/dist/components/DescriptionList.d.ts +12 -0
- package/dist/components/DescriptionList.js +11 -0
- package/dist/components/DescriptionListParts.d.ts +37 -0
- package/dist/components/DescriptionListParts.js +35 -0
- package/dist/components/EnvironmentVariables.js +2 -2
- package/dist/components/Fieldset.d.ts +13 -1
- package/dist/components/Fieldset.js +11 -2
- package/dist/components/FileTree.js +1 -1
- package/dist/components/IconButton.d.ts +33 -0
- package/dist/components/IconButton.js +27 -0
- package/dist/components/McpConnectionRequest.d.ts +44 -0
- package/dist/components/McpConnectionRequest.js +122 -0
- package/dist/components/McpServerPicker.d.ts +48 -23
- package/dist/components/McpServerPicker.js +238 -189
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Message.d.ts +1 -0
- package/dist/components/Message.js +1 -285
- package/dist/components/MessageScroller.js +1 -1
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/Pricing.d.ts +37 -0
- package/dist/components/Pricing.js +17 -0
- package/dist/components/PricingBillingToggle.d.ts +23 -0
- package/dist/components/PricingBillingToggle.js +86 -0
- package/dist/components/PricingConfirmationDialog.d.ts +25 -0
- package/dist/components/PricingConfirmationDialog.js +57 -0
- package/dist/components/PricingFAQ.d.ts +18 -0
- package/dist/components/PricingFAQ.js +27 -0
- package/dist/components/PricingPage.d.ts +2 -38
- package/dist/components/PricingPage.js +39 -359
- package/dist/components/PricingPlanCard.d.ts +22 -0
- package/dist/components/PricingPlanCard.js +109 -0
- package/dist/components/PricingUsageCalculator.d.ts +22 -0
- package/dist/components/PricingUsageCalculator.js +96 -0
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +210 -15
- package/dist/components/Queue.js +1 -1
- package/dist/components/Reasoning.d.ts +2 -1
- package/dist/components/Reasoning.js +14 -29
- package/dist/components/ResizableSidePanel.d.ts +57 -0
- package/dist/components/ResizableSidePanel.js +151 -0
- package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
- package/dist/components/ResponsiveSidebarShell.js +129 -0
- package/dist/components/Select.d.ts +2 -2
- package/dist/components/Select.js +11 -2
- package/dist/components/Slider.d.ts +13 -1
- package/dist/components/Slider.js +11 -0
- package/dist/components/Sources.js +1 -1
- package/dist/components/Stepper.d.ts +4 -0
- package/dist/components/Stepper.js +5 -3
- package/dist/components/SubagentRun.d.ts +18 -19
- package/dist/components/SubagentRun.js +25 -18
- package/dist/components/SubagentRunIndicator.d.ts +22 -0
- package/dist/components/SubagentRunIndicator.js +33 -0
- package/dist/components/SubagentRunList.d.ts +25 -0
- package/dist/components/SubagentRunList.js +26 -0
- package/dist/components/SubagentRunSelector.d.ts +47 -0
- package/dist/components/SubagentRunSelector.js +55 -0
- package/dist/components/Task.js +1 -1
- package/dist/components/Terminal.js +2 -2
- package/dist/components/TestResults.js +1 -1
- package/dist/components/Textarea.d.ts +21 -0
- package/dist/components/Textarea.js +19 -0
- package/dist/components/ThemeModeControl.d.ts +24 -0
- package/dist/components/ThemeModeControl.js +52 -0
- package/dist/components/ThemeProvider.d.ts +38 -0
- package/dist/components/ThemeProvider.js +80 -0
- package/dist/components/ThinkChat.d.ts +29 -6
- package/dist/components/ThinkChat.js +7 -4
- package/dist/components/ThinkChatActivity.d.ts +3 -2
- package/dist/components/ThinkChatActivity.js +12 -318
- package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
- package/dist/components/ThinkChatActivitySummary.js +421 -0
- package/dist/components/ThinkChatToolPanels.d.ts +7 -5
- package/dist/components/ThinkChatToolPanels.js +70 -8
- package/dist/components/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/ThinkChatToolParts.js +36 -10
- package/dist/components/ThinkExecutionDetail.d.ts +20 -0
- package/dist/components/ThinkExecutionDetail.js +80 -0
- package/dist/components/ThinkExecutionRun.d.ts +2 -0
- package/dist/components/ThinkExecutionRun.js +72 -0
- package/dist/components/ThinkExecutionStatus.d.ts +22 -0
- package/dist/components/ThinkExecutionStatus.js +36 -0
- package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
- package/dist/components/ThinkExecutionWorkbench.js +69 -225
- package/dist/components/ThinkFullApp.d.ts +58 -14
- package/dist/components/ThinkFullApp.js +129 -160
- package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
- package/dist/components/ThinkFullAppViewSwitch.js +34 -0
- package/dist/components/ThinkRoutine.d.ts +36 -0
- package/dist/components/ThinkRoutine.js +15 -0
- package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
- package/dist/components/ThinkRoutineBrowser.js +156 -0
- package/dist/components/ThinkRoutineDetail.d.ts +24 -0
- package/dist/components/ThinkRoutineDetail.js +102 -0
- package/dist/components/ThinkRoutineForm.d.ts +32 -0
- package/dist/components/ThinkRoutineForm.js +151 -0
- package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
- package/dist/components/ThinkRoutineLibrary.js +178 -0
- package/dist/components/ThinkRoutineRuns.d.ts +24 -0
- package/dist/components/ThinkRoutineRuns.js +68 -0
- package/dist/components/ThinkThreadPicker.d.ts +18 -1
- package/dist/components/ThinkThreadPicker.js +51 -5
- package/dist/components/ThinkThreadShell.d.ts +12 -9
- package/dist/components/ThinkThreadShell.js +17 -137
- package/dist/components/Toggle.d.ts +1 -68
- package/dist/components/ToggleGroup.d.ts +1 -72
- package/dist/components/Tooltip.d.ts +3 -1
- package/dist/components/Tooltip.js +4 -2
- package/dist/components/WebPreview.js +1 -1
- package/dist/components/Workspace.d.ts +2 -0
- package/dist/components/Workspace.js +424 -0
- package/dist/components/WorkspaceBrowser.d.ts +32 -0
- package/dist/components/WorkspaceBrowser.js +103 -0
- package/dist/components/WorkspaceExplorer.d.ts +12 -79
- package/dist/components/WorkspaceExplorer.js +116 -330
- package/dist/components/WorkspaceFile.d.ts +2 -0
- package/dist/components/WorkspaceFile.js +195 -0
- package/dist/components/WorkspaceFileView.d.ts +26 -0
- package/dist/components/WorkspaceFileView.js +2 -0
- package/dist/components/WorkspaceHeader.d.ts +35 -0
- package/dist/components/WorkspaceHeader.js +51 -0
- package/dist/components/WorkspaceLink.d.ts +2 -0
- package/dist/components/WorkspaceLink.js +2 -0
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
- package/dist/icons-CpfUer49.js +85 -0
- package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
- package/dist/styles/activity-header.css +75 -0
- package/dist/styles/activity.css +49 -63
- package/dist/styles/agent-activity-preview-overlay.css +80 -0
- package/dist/styles/agent-activity-preview.css +235 -0
- package/dist/styles/agent-attention.css +122 -0
- package/dist/styles/agent-chat.css +133 -4
- package/dist/styles/app-frame.css +15 -0
- package/dist/styles/app-top-bar.css +100 -0
- package/dist/styles/avatar.css +0 -1
- package/dist/styles/browser-control-overlay.css +184 -0
- package/dist/styles/card.css +21 -0
- package/dist/styles/checkbox-group.css +69 -0
- package/dist/styles/description-list.css +50 -0
- package/dist/styles/fieldset.css +11 -0
- package/dist/styles/index.css +14 -2
- package/dist/styles/mcp-connection-request.css +60 -0
- package/dist/styles/mcp-server-picker.css +95 -68
- package/dist/styles/message.css +4 -43
- package/dist/styles/pricing-page.css +21 -27
- package/dist/styles/prompt-input.css +225 -32
- package/dist/styles/reasoning.css +1 -55
- package/dist/styles/recipes.css +23 -15
- package/dist/styles/resizable-side-panel.css +66 -0
- package/dist/styles/responsive-sidebar-shell.css +169 -0
- package/dist/styles/select.css +10 -0
- package/dist/styles/stepper.css +13 -0
- package/dist/styles/streamdown.css +0 -4
- package/dist/styles/subagent-run.css +55 -38
- package/dist/styles/textarea.css +20 -0
- package/dist/styles/theme-mode-control.css +72 -0
- package/dist/styles/think-execution-status.css +49 -0
- package/dist/styles/think-execution-workbench.css +8 -72
- package/dist/styles/think-full-app.css +104 -131
- package/dist/styles/think-routine-library.css +491 -0
- package/dist/styles/think-thread-picker.css +47 -3
- package/dist/styles/toggle-group.css +7 -0
- package/dist/styles/workspace-explorer.css +511 -64
- package/dist/utils/mcp-server-catalog.d.ts +82 -78
- package/dist/utils/mcp-server-catalog.js +64 -41
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/utils/theme.d.ts +22 -0
- package/dist/utils/theme.js +55 -0
- package/package.json +34 -28
- package/dist/icons-Ba9THQKz.js +0 -64
- package/dist/styles/think-resize-handle.css +0 -33
- package/dist/styles/think-thread-shell.css +0 -219
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { n as WorkspaceDestination } from "./WorkspaceLink-DK1DWMHe.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/AgentActivity.d.ts
|
|
5
|
+
type AgentActivityMode = "working" | "approval";
|
|
6
|
+
type AgentActivityIconKind = "thought" | "read" | "edit" | "search" | "web" | "command" | "browser" | "tool" | "approval";
|
|
7
|
+
/** Safe, serializable presentation state suitable for an Agents SDK state object. */
|
|
8
|
+
interface AgentActivitySummary<CustomIcon extends string = never> {
|
|
9
|
+
mode: AgentActivityMode;
|
|
10
|
+
label: string;
|
|
11
|
+
iconKind: AgentActivityIconKind | CustomIcon;
|
|
12
|
+
/** Optional presentation hint. Consumers decide whether exposing or fetching it is safe. */
|
|
13
|
+
url?: string;
|
|
14
|
+
/** Optional file target. Hosts validate it against their workspace before navigation. */
|
|
15
|
+
workspaceDestination?: Extract<WorkspaceDestination, {
|
|
16
|
+
kind: "file";
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
interface AgentActivityIconProps {
|
|
20
|
+
kind: string;
|
|
21
|
+
}
|
|
22
|
+
/** Built-in icon vocabulary shared by AI SDK activity and Agents SDK state summaries. */
|
|
23
|
+
declare function AgentActivityIcon({
|
|
24
|
+
kind
|
|
25
|
+
}: AgentActivityIconProps): React.JSX.Element;
|
|
26
|
+
interface AgentActivityFaviconProps {
|
|
27
|
+
url: string;
|
|
28
|
+
fallbackKind?: AgentActivityIconKind;
|
|
29
|
+
}
|
|
30
|
+
/** Site favicon for URL-backed activity, with the shared icon vocabulary as fallback. */
|
|
31
|
+
declare function AgentActivityFavicon({
|
|
32
|
+
fallbackKind,
|
|
33
|
+
url
|
|
34
|
+
}: AgentActivityFaviconProps): React.JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { AgentActivityIconProps as a, AgentActivityIconKind as i, AgentActivityFaviconProps as n, AgentActivityMode as o, AgentActivityIcon as r, AgentActivitySummary as s, AgentActivityFavicon as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as PromptInputContextSelectorProps, _t as PromptInputReference, dt as PromptInputMessage, et as PromptInputDictationProps, j as PromptInputCommandDefinition, r as PermissionMode } from "./PromptInput-BWTuXMOD.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { ChatAddToolApproveResponseFunction, ChatStatus, UIMessage } from "ai";
|
|
4
4
|
import { PendingApproval, Think } from "@cloudflare/think";
|
|
@@ -81,12 +81,41 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
|
|
|
81
81
|
showComposer?: boolean;
|
|
82
82
|
/** Called when the user hits stop while `status` is streaming/submitted. */
|
|
83
83
|
onStop?: () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Let a composed follow-up submit while a response is active. The single
|
|
86
|
+
* trailing action remains Stop until the draft contains content, then
|
|
87
|
+
* becomes Queue. The transport remains the queue owner.
|
|
88
|
+
*/
|
|
89
|
+
allowSubmitWhileBusy?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Authoritative user messages waiting behind the active turn. Their ids are
|
|
92
|
+
* excluded from the transcript and rendered as queued cards above the composer.
|
|
93
|
+
*/
|
|
94
|
+
queuedMessages?: readonly MessageT[];
|
|
95
|
+
/** Promote a queued message into the host's steering flow. */
|
|
96
|
+
onSteerQueuedMessage?: (message: MessageT) => void;
|
|
97
|
+
/** Remove a queued message through the host-owned queue transport. */
|
|
98
|
+
onRemoveQueuedMessage?: (message: MessageT) => void;
|
|
84
99
|
placeholder?: string;
|
|
85
100
|
disabled?: boolean;
|
|
86
101
|
/** Rendered in place of the transcript while `messages` is empty. */
|
|
87
102
|
emptyState?: React.ReactNode;
|
|
88
103
|
/** Extra controls rendered in the composer toolbar. */
|
|
89
104
|
composerTools?: React.ReactNode;
|
|
105
|
+
/** Controlled slash-command catalog and host-owned selection policy. */
|
|
106
|
+
slashCommands?: {
|
|
107
|
+
items: readonly PromptInputCommandDefinition[];
|
|
108
|
+
onSelect?: (command: PromptInputCommandDefinition, draft: AgentChatComposerDraft) => void;
|
|
109
|
+
};
|
|
110
|
+
/** Controlled MCP catalog revealed by `@`; selections become composer references. */
|
|
111
|
+
mentionCommands?: {
|
|
112
|
+
items: readonly PromptInputCommandDefinition[];
|
|
113
|
+
onSelect?: (command: PromptInputCommandDefinition, draft: AgentChatComposerDraft) => void;
|
|
114
|
+
};
|
|
115
|
+
/** Controlled folder or working-context picker rendered beside permission controls. */
|
|
116
|
+
contextSelector?: PromptInputContextSelectorProps;
|
|
117
|
+
/** Extra controls rendered at the trailing edge, before dictation and submit. */
|
|
118
|
+
composerEndTools?: React.ReactNode;
|
|
90
119
|
/** Whole upstream voice-input hook result used by the built-in dictation recorder. */
|
|
91
120
|
voiceInput?: UseVoiceInputReturn;
|
|
92
121
|
/** Host prerequisite run before the built-in recorder calls `voiceInput.start()`. */
|
|
@@ -132,6 +161,8 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
|
|
|
132
161
|
onApprovalResponse?: ChatAddToolApproveResponseFunction;
|
|
133
162
|
/** Whole upstream Think stub used to resolve paused and durable execution approvals. */
|
|
134
163
|
thinkStub?: AgentStub<Think>;
|
|
164
|
+
/** Parent-owned approval policy. Omit to keep AgentChat's session-local mode. */
|
|
165
|
+
permissionModeControl?: PermissionModeControl;
|
|
135
166
|
/** Called after a Think approve/reject RPC settles, including when it rejects. */
|
|
136
167
|
onExecutionSettled?: () => void | Promise<void>;
|
|
137
168
|
/** Think durable-pause approvals from `pendingApprovals()`, rendered when `thinkStub` is set. */
|
|
@@ -154,10 +185,10 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
|
|
|
154
185
|
* `isTextUIPart`, `isReasoningUIPart`, `isFileUIPart`, `isToolUIPart`,
|
|
155
186
|
* `getToolName`, and Think's `getToolPartState`/input/output accessors. It
|
|
156
187
|
* also renders native AI SDK `source-url`/`source-document` parts as a single
|
|
157
|
-
* grouped `Sources` block when they appear consecutively,
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* callback. If you override source rendering,
|
|
188
|
+
* grouped `Sources` block when they appear consecutively, consolidates native
|
|
189
|
+
* reasoning parts into one disclosure, and treats `step-start` as a silent
|
|
190
|
+
* structural boundary. App-defined `data-*` parts stay whole and should be
|
|
191
|
+
* narrowed with AI SDK's `isDataUIPart` inside this callback. If you override source rendering,
|
|
161
192
|
* return a React node for every source part you want to show; returning
|
|
162
193
|
* `undefined` lets `AgentChat` keep the upstream-shaped source-run grouping.
|
|
163
194
|
*/
|
|
@@ -165,6 +196,18 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
|
|
|
165
196
|
/** Rendered after each message's parts — for actions, citations, and the like. */
|
|
166
197
|
renderMessageAfter?: (context: AgentChatRenderMessageContext<MessageT>) => React.ReactNode;
|
|
167
198
|
}
|
|
199
|
+
interface AgentChatComposerDraft {
|
|
200
|
+
value: string;
|
|
201
|
+
references: readonly PromptInputReference[];
|
|
202
|
+
setValue: (value: string) => void;
|
|
203
|
+
clear: () => void;
|
|
204
|
+
addReference: (reference: PromptInputReference) => void;
|
|
205
|
+
removeReference: (reference: PromptInputReference) => void;
|
|
206
|
+
}
|
|
207
|
+
interface PermissionModeControl {
|
|
208
|
+
value: PermissionMode;
|
|
209
|
+
onChange: (mode: PermissionMode) => void | Promise<void>;
|
|
210
|
+
}
|
|
168
211
|
/**
|
|
169
212
|
* Low-level transcript/composer surface used by `ThinkChat`: props in, no
|
|
170
213
|
* transport. Product code that talks to a Cloudflare Think agent should render
|
|
@@ -173,15 +216,23 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
|
|
|
173
216
|
declare function AgentChat<MessageT extends UIMessage = UIMessage>({
|
|
174
217
|
className,
|
|
175
218
|
messages,
|
|
219
|
+
queuedMessages,
|
|
220
|
+
onSteerQueuedMessage,
|
|
221
|
+
onRemoveQueuedMessage,
|
|
176
222
|
status,
|
|
177
223
|
onSubmit,
|
|
178
224
|
showComposer,
|
|
179
225
|
onStop,
|
|
226
|
+
allowSubmitWhileBusy,
|
|
180
227
|
placeholder,
|
|
181
228
|
disabled,
|
|
182
229
|
emptyState,
|
|
183
230
|
composerHeader,
|
|
184
231
|
composerTools,
|
|
232
|
+
slashCommands,
|
|
233
|
+
mentionCommands,
|
|
234
|
+
contextSelector,
|
|
235
|
+
composerEndTools,
|
|
185
236
|
voiceInput,
|
|
186
237
|
beforeVoiceStart,
|
|
187
238
|
composerAddMenuItems,
|
|
@@ -190,6 +241,7 @@ declare function AgentChat<MessageT extends UIMessage = UIMessage>({
|
|
|
190
241
|
onEditAndResend,
|
|
191
242
|
onApprovalResponse,
|
|
192
243
|
thinkStub,
|
|
244
|
+
permissionModeControl,
|
|
193
245
|
onExecutionSettled,
|
|
194
246
|
pendingApprovals: durableApprovals,
|
|
195
247
|
contextWindow,
|
|
@@ -200,4 +252,4 @@ declare function AgentChat<MessageT extends UIMessage = UIMessage>({
|
|
|
200
252
|
ref?: React.Ref<HTMLDivElement>;
|
|
201
253
|
}): React.JSX.Element;
|
|
202
254
|
//#endregion
|
|
203
|
-
export {
|
|
255
|
+
export { AgentChatRenderMessageContext as a, AgentChatProps as i, AgentChatComposerDraft as n, AgentChatRenderPartContext as o, AgentChatPart as r, PermissionModeControl as s, AgentChat as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as SelectProps, t as Select } from "./Select-BeEsefzh.js";
|
|
2
2
|
import { t as CopyButtonProps } from "./copy-button-DtPMgN7e.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { BundledLanguage, ThemedToken } from "shiki";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as cx } from "./class-names-9UtZwb0J.js";
|
|
2
2
|
import { Select } from "./components/Select.js";
|
|
3
|
-
import { t as CopyButton } from "./copy-button-
|
|
3
|
+
import { t as CopyButton } from "./copy-button-Dejn5heL.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { createHighlighter } from "shiki";
|
|
@@ -308,18 +308,29 @@ function CodeBlockContainer({ className, children, ref, ...props }) {
|
|
|
308
308
|
function CodeBlockContent({ className, ref, ...props }) {
|
|
309
309
|
const { code, language, showLineNumbers, isStreaming } = useCodeBlockContext();
|
|
310
310
|
const [html, setHtml] = React.useState(null);
|
|
311
|
-
const [theme, setTheme] = React.useState(() =>
|
|
311
|
+
const [theme, setTheme] = React.useState(() => {
|
|
312
|
+
if (typeof document === "undefined") return "github-light-high-contrast";
|
|
313
|
+
const preference = document.documentElement.dataset.theme;
|
|
314
|
+
return preference === "dark" || preference === void 0 && window.matchMedia("(prefers-color-scheme: dark)").matches ? "github-dark-high-contrast" : "github-light-high-contrast";
|
|
315
|
+
});
|
|
312
316
|
React.useEffect(() => {
|
|
313
317
|
if (typeof document === "undefined") return;
|
|
318
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
314
319
|
const update = () => {
|
|
315
|
-
|
|
320
|
+
const preference = document.documentElement.dataset.theme;
|
|
321
|
+
const dark = preference === "dark" || preference === void 0 && mediaQuery.matches;
|
|
322
|
+
setTheme(dark ? "github-dark-high-contrast" : "github-light-high-contrast");
|
|
316
323
|
};
|
|
317
324
|
const observer = new MutationObserver(update);
|
|
318
325
|
observer.observe(document.documentElement, {
|
|
319
326
|
attributes: true,
|
|
320
327
|
attributeFilter: ["data-theme"]
|
|
321
328
|
});
|
|
322
|
-
|
|
329
|
+
mediaQuery.addEventListener("change", update);
|
|
330
|
+
return () => {
|
|
331
|
+
observer.disconnect();
|
|
332
|
+
mediaQuery.removeEventListener("change", update);
|
|
333
|
+
};
|
|
323
334
|
}, []);
|
|
324
335
|
React.useEffect(() => {
|
|
325
336
|
if (isStreaming) return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "./class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { b as FolderOpenIcon, l as ChevronRightIcon, v as FileIcon, y as FolderIcon } from "./icons-CpfUer49.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/_internal/use-file-tree-nav.ts
|
|
@@ -10,41 +10,11 @@ function useFileTreeContext() {
|
|
|
10
10
|
return ctx;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Builds a FileTreeContextValue that
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* Call `register` from every FileTreeFolder/FileTreeFile during render. The
|
|
17
|
-
* hook resets its internal list on each render pass so removed nodes don't
|
|
18
|
-
* leave stale entries.
|
|
13
|
+
* Builds a FileTreeContextValue that dispatches keyboard navigation per the
|
|
14
|
+
* WAI-ARIA Tree Pattern.
|
|
19
15
|
*/
|
|
20
|
-
function useFileTreeNav({ expanded, selectedPath, onSelect, onExpandedChange }) {
|
|
21
|
-
const [focusedPath, setFocusedPath] = React.useState(
|
|
22
|
-
const nodesRef = React.useRef([]);
|
|
23
|
-
nodesRef.current = [];
|
|
24
|
-
const register = React.useCallback((path, kind, parentExpanded) => {
|
|
25
|
-
nodesRef.current.push({
|
|
26
|
-
path,
|
|
27
|
-
kind,
|
|
28
|
-
visible: parentExpanded
|
|
29
|
-
});
|
|
30
|
-
}, []);
|
|
31
|
-
const visibleNodes = () => nodesRef.current.filter((n) => n.visible);
|
|
32
|
-
const moveFocus = React.useCallback((direction, from) => {
|
|
33
|
-
const visible = visibleNodes();
|
|
34
|
-
const idx = visible.findIndex((n) => n.path === from);
|
|
35
|
-
if (idx < 0) return;
|
|
36
|
-
const next = visible[Math.max(0, Math.min(visible.length - 1, idx + direction))];
|
|
37
|
-
if (next) setFocusedPath(next.path);
|
|
38
|
-
}, []);
|
|
39
|
-
const focusFirstVisibleNode = React.useCallback(() => {
|
|
40
|
-
const first = visibleNodes()[0];
|
|
41
|
-
if (first) setFocusedPath(first.path);
|
|
42
|
-
}, []);
|
|
43
|
-
const focusLastVisibleNode = React.useCallback(() => {
|
|
44
|
-
const visible = visibleNodes();
|
|
45
|
-
const last = visible[visible.length - 1];
|
|
46
|
-
if (last) setFocusedPath(last.path);
|
|
47
|
-
}, []);
|
|
16
|
+
function useFileTreeNav({ expanded, initialFocusedPath, selectedPath, onSelect, onExpandedChange }) {
|
|
17
|
+
const [focusedPath, setFocusedPath] = React.useState(initialFocusedPath);
|
|
48
18
|
const setFolderExpanded = React.useCallback((path, nextExpanded) => {
|
|
49
19
|
const next = new Set(expanded);
|
|
50
20
|
if (nextExpanded) next.add(path);
|
|
@@ -54,54 +24,52 @@ function useFileTreeNav({ expanded, selectedPath, onSelect, onExpandedChange })
|
|
|
54
24
|
const toggleFolderExpanded = React.useCallback((path) => {
|
|
55
25
|
setFolderExpanded(path, !expanded.has(path));
|
|
56
26
|
}, [expanded, setFolderExpanded]);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
27
|
+
const handleKeyDown = React.useCallback((event, path, kind) => {
|
|
28
|
+
const tree = event.currentTarget.closest("[role=\"tree\"]");
|
|
29
|
+
const nodes = tree ? [...tree.querySelectorAll(".file-tree__node")] : [];
|
|
30
|
+
const currentIndex = nodes.indexOf(event.currentTarget);
|
|
31
|
+
const focusAt = (index) => nodes[index]?.focus();
|
|
32
|
+
switch (event.key) {
|
|
33
|
+
case "ArrowDown":
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
focusAt(Math.min(nodes.length - 1, currentIndex + 1));
|
|
36
|
+
break;
|
|
37
|
+
case "ArrowUp":
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
focusAt(Math.max(0, currentIndex - 1));
|
|
40
|
+
break;
|
|
41
|
+
case "ArrowRight":
|
|
42
|
+
if (kind !== "folder") return;
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
if (expanded.has(path)) focusAt(currentIndex + 1);
|
|
45
|
+
else setFolderExpanded(path, true);
|
|
46
|
+
break;
|
|
47
|
+
case "ArrowLeft":
|
|
48
|
+
if (kind !== "folder" || !expanded.has(path)) return;
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
setFolderExpanded(path, false);
|
|
51
|
+
break;
|
|
52
|
+
case "Enter":
|
|
53
|
+
case " ":
|
|
54
|
+
event.preventDefault();
|
|
80
55
|
onSelect(path);
|
|
81
|
-
toggleFolderExpanded(path);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
56
|
+
if (kind === "folder") toggleFolderExpanded(path);
|
|
57
|
+
break;
|
|
58
|
+
case "Home":
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
focusAt(0);
|
|
61
|
+
break;
|
|
62
|
+
case "End":
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
focusAt(nodes.length - 1);
|
|
65
|
+
break;
|
|
89
66
|
}
|
|
90
|
-
}
|
|
67
|
+
}, [
|
|
91
68
|
expanded,
|
|
92
|
-
focusFirstVisibleNode,
|
|
93
|
-
focusLastVisibleNode,
|
|
94
|
-
moveFocus,
|
|
95
69
|
onSelect,
|
|
96
70
|
setFolderExpanded,
|
|
97
71
|
toggleFolderExpanded
|
|
98
72
|
]);
|
|
99
|
-
const handleKeyDown = React.useCallback((event, path, kind) => {
|
|
100
|
-
const keyHandler = keyHandlers[event.key];
|
|
101
|
-
if (!keyHandler) return;
|
|
102
|
-
event.preventDefault();
|
|
103
|
-
keyHandler(path, kind);
|
|
104
|
-
}, [keyHandlers]);
|
|
105
73
|
return {
|
|
106
74
|
focusedPath,
|
|
107
75
|
selectedPath,
|
|
@@ -113,12 +81,23 @@ function useFileTreeNav({ expanded, selectedPath, onSelect, onExpandedChange })
|
|
|
113
81
|
onExpandedChange: React.useCallback((path, next) => {
|
|
114
82
|
setFolderExpanded(path, next);
|
|
115
83
|
}, [setFolderExpanded]),
|
|
116
|
-
register,
|
|
117
84
|
handleKeyDown
|
|
118
85
|
};
|
|
119
86
|
}
|
|
120
87
|
//#endregion
|
|
121
88
|
//#region src/components/FileTree.tsx
|
|
89
|
+
function getFirstFileTreePath(children) {
|
|
90
|
+
let firstPath = null;
|
|
91
|
+
React.Children.forEach(children, (child) => {
|
|
92
|
+
if (firstPath || !React.isValidElement(child)) return;
|
|
93
|
+
if (child.type === FileTreeFolder || child.type === FileTreeFile) {
|
|
94
|
+
firstPath = child.props.path;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (child.type === React.Fragment) firstPath = getFirstFileTreePath(child.props.children);
|
|
98
|
+
});
|
|
99
|
+
return firstPath;
|
|
100
|
+
}
|
|
122
101
|
/**
|
|
123
102
|
* A keyboard-accessible hierarchical file browser. Compose with
|
|
124
103
|
* FileTreeFolder and FileTreeFile children.
|
|
@@ -146,14 +125,28 @@ function FileTree({ className, "aria-label": ariaLabel = "File tree", expanded,
|
|
|
146
125
|
if (!isControlled) setInternalExpanded(next);
|
|
147
126
|
onExpandedChange?.(next);
|
|
148
127
|
}, [isControlled, onExpandedChange]);
|
|
128
|
+
const handleSelect = React.useCallback((path) => {
|
|
129
|
+
onSelect?.(path);
|
|
130
|
+
}, [onSelect]);
|
|
149
131
|
const ctx = useFileTreeNav({
|
|
150
132
|
expanded: currentExpanded,
|
|
133
|
+
initialFocusedPath: getFirstFileTreePath(children),
|
|
151
134
|
selectedPath,
|
|
152
|
-
onSelect:
|
|
153
|
-
onSelect?.(path);
|
|
154
|
-
}, [onSelect]),
|
|
135
|
+
onSelect: handleSelect,
|
|
155
136
|
onExpandedChange: handleExpandedChange
|
|
156
137
|
});
|
|
138
|
+
const treeRef = React.useRef(null);
|
|
139
|
+
React.useLayoutEffect(() => {
|
|
140
|
+
const nodes = [...treeRef.current?.querySelectorAll(".file-tree__node") ?? []];
|
|
141
|
+
if (nodes.length === 0) return;
|
|
142
|
+
if (nodes.some((node) => node.dataset.workspacePath === ctx.focusedPath)) return;
|
|
143
|
+
const firstPath = nodes[0]?.dataset.workspacePath;
|
|
144
|
+
if (firstPath) ctx.onFocus(firstPath);
|
|
145
|
+
}, [
|
|
146
|
+
children,
|
|
147
|
+
ctx.focusedPath,
|
|
148
|
+
ctx.onFocus
|
|
149
|
+
]);
|
|
157
150
|
return /* @__PURE__ */ jsx(FileTreeContext.Provider, {
|
|
158
151
|
value: ctx,
|
|
159
152
|
children: /* @__PURE__ */ jsx("div", {
|
|
@@ -161,10 +154,10 @@ function FileTree({ className, "aria-label": ariaLabel = "File tree", expanded,
|
|
|
161
154
|
className: cx("file-tree", className),
|
|
162
155
|
...props,
|
|
163
156
|
children: /* @__PURE__ */ jsx("ul", {
|
|
157
|
+
ref: treeRef,
|
|
164
158
|
className: "file-tree__list",
|
|
165
159
|
role: "tree",
|
|
166
160
|
"aria-label": ariaLabel,
|
|
167
|
-
tabIndex: 0,
|
|
168
161
|
children
|
|
169
162
|
})
|
|
170
163
|
})
|
|
@@ -177,18 +170,17 @@ function renderNestedFileTreeChild(child, level) {
|
|
|
177
170
|
function dataFlag(enabled) {
|
|
178
171
|
return enabled ? "" : void 0;
|
|
179
172
|
}
|
|
180
|
-
function getFileTreeNodeTabIndex(focusedPath, path
|
|
181
|
-
return focusedPath === path
|
|
173
|
+
function getFileTreeNodeTabIndex(focusedPath, path) {
|
|
174
|
+
return focusedPath === path ? 0 : -1;
|
|
182
175
|
}
|
|
183
176
|
function getFileTreeNodeIndent(level, offset) {
|
|
184
177
|
return `${level * 1.125 + offset}rem`;
|
|
185
178
|
}
|
|
186
179
|
function FileTreeFolder({ className, path, name, level = 0, children, ref, ...props }) {
|
|
187
|
-
const { expanded, focusedPath, selectedPath, onFocus, onSelect,
|
|
180
|
+
const { expanded, focusedPath, selectedPath, onFocus, onSelect, handleKeyDown, onExpandedChange } = useFileTreeContext();
|
|
188
181
|
const isExpanded = expanded.has(path);
|
|
189
182
|
const isFocused = focusedPath === path;
|
|
190
183
|
const isSelected = selectedPath === path;
|
|
191
|
-
register(path, "folder", true);
|
|
192
184
|
const toggle = React.useCallback(() => {
|
|
193
185
|
onExpandedChange(path, !isExpanded);
|
|
194
186
|
}, [
|
|
@@ -216,7 +208,8 @@ function FileTreeFolder({ className, path, name, level = 0, children, ref, ...pr
|
|
|
216
208
|
className: "file-tree__node file-tree__node--folder",
|
|
217
209
|
"data-focused": dataFlag(isFocused),
|
|
218
210
|
"data-selected": dataFlag(isSelected),
|
|
219
|
-
|
|
211
|
+
"data-workspace-path": path,
|
|
212
|
+
tabIndex: getFileTreeNodeTabIndex(focusedPath, path),
|
|
220
213
|
onClick: handleClick,
|
|
221
214
|
onFocus: () => onFocus(path),
|
|
222
215
|
onKeyDown: (e) => handleKeyDown(e, path, "folder"),
|
|
@@ -245,10 +238,9 @@ function FileTreeFolder({ className, path, name, level = 0, children, ref, ...pr
|
|
|
245
238
|
});
|
|
246
239
|
}
|
|
247
240
|
function FileTreeFile({ className, path, name, icon, level = 0, ref, ...props }) {
|
|
248
|
-
const { selectedPath, focusedPath, onFocus, onSelect,
|
|
241
|
+
const { selectedPath, focusedPath, onFocus, onSelect, handleKeyDown } = useFileTreeContext();
|
|
249
242
|
const isSelected = selectedPath === path;
|
|
250
243
|
const isFocused = focusedPath === path;
|
|
251
|
-
register(path, "file", true);
|
|
252
244
|
return /* @__PURE__ */ jsx("li", {
|
|
253
245
|
ref,
|
|
254
246
|
role: "treeitem",
|
|
@@ -260,7 +252,8 @@ function FileTreeFile({ className, path, name, icon, level = 0, ref, ...props })
|
|
|
260
252
|
className: "file-tree__node file-tree__node--file",
|
|
261
253
|
"data-selected": dataFlag(isSelected),
|
|
262
254
|
"data-focused": dataFlag(isFocused),
|
|
263
|
-
|
|
255
|
+
"data-workspace-path": path,
|
|
256
|
+
tabIndex: getFileTreeNodeTabIndex(focusedPath, path),
|
|
264
257
|
onClick: () => onSelect(path),
|
|
265
258
|
onFocus: () => onFocus(path),
|
|
266
259
|
onKeyDown: (e) => handleKeyDown(e, path, "file"),
|