@mcp-b/react-components 0.17.0 → 0.19.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 → AgentActivity-D2SHSGFX.d.ts} +1 -1
- package/dist/{AgentChat-CRuMi1Pb.d.ts → AgentChat-ClxViuUM.d.ts} +1 -20
- package/dist/{Button-FX_hpqxm.d.ts → Button-DLGzHsjc.d.ts} +13 -7
- package/dist/{CodeBlock-Co1noLbC.js → CodeBlock-Bb-IPBc_.js} +9 -6
- package/dist/{CodeBlock-Dnpr88ZQ.d.ts → CodeBlock-gV4kZeCI.d.ts} +2 -9
- package/dist/{FileTree-B7bBsUyU.js → FileTree-CUlXfnmc.js} +42 -16
- package/dist/{Message-C4eYRogZ.js → Message-rZEaaD8Q.js} +13 -20
- package/dist/{ModelSelector-BNrZlY_Y.js → ModelSelector-4GsCWcZV.js} +15 -22
- package/dist/{PromptInput-OLfXPuHM.d.ts → PromptInput-Bdh9pqlo.d.ts} +4 -6
- package/dist/{Select-CwSqP07Y.d.ts → Select-B_13gg_J.d.ts} +2 -2
- package/dist/{Tabs-9zddXDQo.d.ts → Tabs-ColWK-XA.d.ts} +10 -2
- package/dist/{ThinkChat-DInElus-.js → ThinkChat-15EhfvYJ.js} +84 -61
- package/dist/{ThinkChatActivity-BgesTfZ4.d.ts → ThinkChatActivity-Bzot45kX.d.ts} +4 -7
- package/dist/{ThinkChatActivitySummary-BPmu9a-c.d.ts → ThinkChatActivitySummary-D1xOrNrq.d.ts} +1 -1
- package/dist/{Toggle-DaXpe1Lc.d.ts → Toggle-JKZ43D5S.d.ts} +1 -1
- package/dist/{ToggleGroup-yseEWkOC.d.ts → ToggleGroup-DNd6cDJZ.d.ts} +2 -2
- package/dist/Workspace-Jez8ffUj.d.ts +274 -0
- package/dist/{WorkspaceExplorer-sZewzT2O.d.ts → WorkspaceExplorer-B9dQWNVK.d.ts} +2 -2
- package/dist/{WorkspaceFile-C8UzuSH4.d.ts → WorkspaceFile-CzyHnESE.d.ts} +1 -1
- package/dist/{WorkspaceFileView-DNdGAEiX.js → WorkspaceFileView-CEdArlOT.js} +120 -127
- package/dist/{WorkspaceLink-B1ykV1dS.js → WorkspaceLink-BYYeTQLf.js} +6 -27
- package/dist/{WorkspaceLink-DK1DWMHe.d.ts → WorkspaceLink-O-EBKUJ8.d.ts} +6 -9
- package/dist/{class-names-Bk-QLWWI.js → class-names-BiMDVpUo.js} +4 -1
- package/dist/components/Accordion.js +7 -2
- package/dist/components/Activity.js +2 -2
- package/dist/components/AgentActivity.d.ts +1 -1
- package/dist/components/AgentActivity.js +4 -5
- package/dist/components/AgentActivityPreview.d.ts +9 -9
- package/dist/components/AgentActivityPreview.js +8 -12
- package/dist/components/AgentAttention.d.ts +1 -1
- package/dist/components/AgentAttention.js +1 -1
- package/dist/components/AgentChat.d.ts +1 -1
- package/dist/components/AgentChat.js +94 -62
- package/dist/components/AgentChatMessageEditor.js +2 -2
- package/dist/components/AgentChatTurnError.js +2 -2
- package/dist/components/AgentConnection.js +3 -3
- package/dist/components/AgentMessageParts.js +1 -1
- package/dist/components/AgentToolDetail.d.ts +6 -4
- package/dist/components/AgentToolDetail.js +12 -10
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/AppTopBar.d.ts +24 -7
- package/dist/components/AppTopBar.js +32 -8
- package/dist/components/Approval.js +4 -4
- package/dist/components/Artifact.d.ts +1 -1
- package/dist/components/Artifact.js +6 -4
- package/dist/components/Autocomplete.js +1 -1
- package/dist/components/Avatar.d.ts +1 -1
- package/dist/components/Avatar.js +2 -2
- package/dist/components/Badge.js +3 -0
- package/dist/components/BrowserLiveView.js +27 -12
- package/dist/components/BrowserReplay.js +4 -3
- package/dist/components/BrowserRunPanel.js +5 -5
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +14 -11
- package/dist/components/Card.d.ts +7 -8
- package/dist/components/Card.js +19 -10
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +2 -2
- package/dist/components/ChatGptSignInScreen.js +8 -8
- package/dist/components/Checkbox.js +2 -2
- package/dist/components/CheckboxGroup.js +1 -1
- package/dist/components/Checkpoint.js +2 -2
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.js +35 -15
- package/dist/components/Collapsible.js +2 -2
- package/dist/components/Combobox.js +1 -1
- package/dist/components/Commit.d.ts +1 -1
- package/dist/components/Commit.js +3 -3
- package/dist/components/Context.js +1 -1
- package/dist/components/ContextMenu.js +2 -2
- package/dist/components/Conversation.d.ts +1 -1
- package/dist/components/Conversation.js +5 -4
- package/dist/components/DescriptionListParts.js +1 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/EnvironmentVariables.d.ts +1 -1
- package/dist/components/EnvironmentVariables.js +3 -3
- package/dist/components/Field.js +5 -2
- package/dist/components/Fieldset.js +1 -1
- package/dist/components/FileTree.d.ts +6 -0
- package/dist/components/FileTree.js +1 -1
- package/dist/components/Form.js +1 -1
- package/dist/components/GithubMotionMark.js +1 -1
- package/dist/components/IconButton.d.ts +2 -3
- package/dist/components/IconButton.js +2 -1
- package/dist/components/InlineCitation.js +1 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/Marker.js +1 -1
- package/dist/components/McpConnectionRequest.js +2 -2
- package/dist/components/McpServerPicker.js +2 -2
- package/dist/components/MediaPreviewCard.d.ts +103 -0
- package/dist/components/MediaPreviewCard.js +193 -0
- package/dist/components/Menu.js +1 -1
- package/dist/components/Menubar.js +2 -2
- package/dist/components/Message.d.ts +4 -1
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.d.ts +1 -1
- package/dist/components/MessageScroller.js +5 -4
- package/dist/components/Meter.js +1 -1
- package/dist/components/ModelSelector.d.ts +4 -3
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NavigationMenu.js +1 -1
- package/dist/components/NumberField.js +1 -1
- package/dist/components/Plan.js +2 -2
- package/dist/components/Popover.js +1 -1
- package/dist/components/PreviewCard.js +1 -1
- package/dist/components/PricingBillingToggle.js +1 -1
- package/dist/components/PricingFAQ.js +1 -1
- package/dist/components/PricingPage.js +2 -1
- package/dist/components/PricingPlanCard.js +4 -3
- package/dist/components/PricingUsageCalculator.js +2 -2
- package/dist/components/Progress.js +1 -1
- package/dist/components/PromptInput.d.ts +1 -1
- package/dist/components/PromptInput.js +31 -18
- package/dist/components/Queue.d.ts +1 -1
- package/dist/components/Queue.js +2 -3
- package/dist/components/RadioGroup.js +1 -1
- package/dist/components/Reasoning.js +3 -6
- package/dist/components/ResizableSidePanel.js +1 -1
- package/dist/components/ResponsiveSidebarShell.js +16 -10
- package/dist/components/ScrollArea.js +2 -1
- package/dist/components/SearchField.d.ts +43 -0
- package/dist/components/SearchField.js +52 -0
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +5 -6
- package/dist/components/Separator.js +1 -1
- package/dist/components/Slider.js +1 -1
- package/dist/components/Sources.js +2 -2
- package/dist/components/Stepper.js +16 -9
- package/dist/components/SubagentRunDetails.js +1 -1
- package/dist/components/SubagentRunIndicator.js +2 -2
- package/dist/components/SubagentRunList.d.ts +3 -5
- package/dist/components/SubagentRunList.js +3 -4
- package/dist/components/SubagentRunSelector.d.ts +8 -12
- package/dist/components/SubagentRunSelector.js +17 -20
- package/dist/components/Switch.d.ts +2 -2
- package/dist/components/Switch.js +4 -5
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +12 -3
- package/dist/components/Task.js +2 -2
- package/dist/components/Terminal.d.ts +2 -2
- package/dist/components/Terminal.js +5 -4
- package/dist/components/TestResults.js +10 -6
- package/dist/components/Textarea.js +1 -1
- package/dist/components/ThemeModeControl.js +1 -1
- package/dist/components/ThinkChat.d.ts +33 -20
- package/dist/components/ThinkChat.js +4 -4
- package/dist/components/ThinkChatActivity.d.ts +2 -2
- package/dist/components/ThinkChatActivity.js +8 -10
- package/dist/components/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/ThinkChatActivitySummary.js +7 -3
- package/dist/components/ThinkChatToolPanels.js +26 -16
- package/dist/components/ThinkExecutionDetail.js +2 -2
- package/dist/components/ThinkExecutionStatus.js +2 -2
- package/dist/components/ThinkExecutionWorkbench.d.ts +30 -8
- package/dist/components/ThinkExecutionWorkbench.js +70 -134
- package/dist/components/ThinkFullApp.d.ts +36 -35
- package/dist/components/ThinkFullApp.js +156 -109
- package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
- package/dist/components/ThinkFullAppViewSwitch.js +1 -1
- package/dist/components/ThinkRecoveryNotice.js +18 -12
- package/dist/components/ThinkRoutineBrowser.d.ts +17 -9
- package/dist/components/ThinkRoutineBrowser.js +33 -40
- package/dist/components/ThinkRoutineDetail.d.ts +5 -2
- package/dist/components/ThinkRoutineDetail.js +4 -4
- package/dist/components/ThinkRoutineForm.d.ts +3 -2
- package/dist/components/ThinkRoutineForm.js +11 -10
- package/dist/components/ThinkRoutineLibrary.d.ts +24 -31
- package/dist/components/ThinkRoutineLibrary.js +57 -80
- package/dist/components/ThinkRoutineRuns.d.ts +3 -2
- package/dist/components/ThinkRoutineRuns.js +31 -24
- package/dist/components/ThinkThreadPicker.d.ts +17 -11
- package/dist/components/ThinkThreadPicker.js +163 -39
- package/dist/components/Toast.js +1 -1
- package/dist/components/Toggle.d.ts +1 -1
- package/dist/components/Toggle.js +9 -7
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +15 -13
- package/dist/components/ToolInvocation.js +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/Tooltip.d.ts +8 -1
- package/dist/components/Tooltip.js +11 -2
- package/dist/components/TransitionSurface.d.ts +27 -0
- package/dist/components/TransitionSurface.js +20 -0
- package/dist/components/WebPreview.d.ts +5 -5
- package/dist/components/WebPreview.js +68 -54
- package/dist/components/Workspace.d.ts +2 -2
- package/dist/components/Workspace.js +358 -328
- package/dist/components/WorkspaceBrowser.d.ts +4 -7
- package/dist/components/WorkspaceBrowser.js +15 -25
- package/dist/components/WorkspaceExplorer.d.ts +5 -5
- package/dist/components/WorkspaceExplorer.js +19 -32
- package/dist/components/WorkspaceFile.d.ts +1 -1
- package/dist/components/WorkspaceFileView.d.ts +14 -2
- package/dist/components/WorkspaceFileView.js +1 -1
- package/dist/components/WorkspaceHeader.d.ts +0 -8
- package/dist/components/WorkspaceHeader.js +3 -15
- package/dist/components/WorkspaceLink.d.ts +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-cYsJBauI.js → copy-button-BtRwhRks.js} +3 -2
- package/dist/{copy-button-CQx3LQAC.d.ts → copy-button-D7aAYA-2.d.ts} +1 -1
- package/dist/{icons--FqCZEc3.js → icons-DKXiSepE.js} +7 -3
- package/dist/{icons-DpUqY8Mp.d.ts → icons-DkRtZmvT.d.ts} +22 -2
- package/dist/navigation-link-Cob7KBlM.js +19 -0
- package/dist/styles/accordion.css +4 -19
- package/dist/styles/activity.css +48 -56
- package/dist/styles/agent-activity-preview.css +2 -0
- package/dist/styles/agent-chat.css +14 -22
- package/dist/styles/alert-dialog.css +16 -18
- package/dist/styles/app-top-bar.css +17 -9
- package/dist/styles/approval.css +11 -6
- package/dist/styles/artifact.css +6 -6
- package/dist/styles/autocomplete.css +2 -1
- package/dist/styles/avatar.css +35 -30
- package/dist/styles/badge.css +10 -10
- package/dist/styles/base-ui-motion.css +94 -39
- package/dist/styles/browser-control-overlay.css +0 -1
- package/dist/styles/browser-live-view.css +39 -22
- package/dist/styles/browser-replay.css +1 -1
- package/dist/styles/browser-run-panel.css +8 -4
- package/dist/styles/button.css +36 -33
- package/dist/styles/card.css +5 -6
- package/dist/styles/chain-of-thought.css +22 -16
- package/dist/styles/checkbox.css +18 -5
- package/dist/styles/codex-model-selector.css +46 -8
- package/dist/styles/collapsible.css +10 -10
- package/dist/styles/combobox.css +3 -2
- package/dist/styles/commit.css +19 -18
- package/dist/styles/composition-motion.css +83 -0
- package/dist/styles/context-menu.css +3 -3
- package/dist/styles/context.css +11 -10
- package/dist/styles/conversation.css +18 -23
- package/dist/styles/dialog.css +15 -15
- package/dist/styles/field.css +32 -12
- package/dist/styles/file-tree.css +69 -9
- package/dist/styles/form.css +1 -1
- package/dist/styles/index.css +5 -0
- package/dist/styles/input.css +2 -2
- package/dist/styles/marker.css +14 -13
- package/dist/styles/mcp-server-picker.css +20 -17
- package/dist/styles/media-preview-card.css +160 -0
- package/dist/styles/menu.css +11 -11
- package/dist/styles/menubar.css +12 -11
- package/dist/styles/message.css +27 -21
- package/dist/styles/meter.css +2 -2
- package/dist/styles/model-selector.css +16 -14
- package/dist/styles/motion-reduction.css +29 -0
- package/dist/styles/navigation-menu.css +14 -30
- package/dist/styles/number-field.css +22 -4
- package/dist/styles/plan.css +5 -0
- package/dist/styles/popover.css +15 -16
- package/dist/styles/preview-card.css +2 -32
- package/dist/styles/progress.css +8 -3
- package/dist/styles/prompt-input.css +87 -70
- package/dist/styles/queue.css +48 -32
- package/dist/styles/radio.css +19 -12
- package/dist/styles/reasoning.css +2 -1
- package/dist/styles/recipes.css +109 -37
- package/dist/styles/resizable-side-panel.css +4 -10
- package/dist/styles/responsive-sidebar-shell.css +16 -15
- package/dist/styles/scroll-area.css +32 -15
- package/dist/styles/search-field.css +21 -0
- package/dist/styles/select.css +19 -12
- package/dist/styles/slider.css +25 -29
- package/dist/styles/sources.css +3 -3
- package/dist/styles/stepper.css +36 -26
- package/dist/styles/subagent-run.css +1 -1
- package/dist/styles/switch.css +32 -29
- package/dist/styles/tabs.css +79 -23
- package/dist/styles/task.css +13 -9
- package/dist/styles/test-results.css +29 -23
- package/dist/styles/theme-mode-control.css +8 -0
- package/dist/styles/think-execution-workbench.css +18 -15
- package/dist/styles/think-full-app.css +45 -68
- package/dist/styles/think-routine-library.css +43 -24
- package/dist/styles/think-thread-picker.css +193 -51
- package/dist/styles/toast.css +48 -27
- package/dist/styles/toggle-group.css +2 -36
- package/dist/styles/toggle.css +29 -5
- package/dist/styles/toolbar.css +25 -27
- package/dist/styles/tooltip.css +2 -32
- package/dist/styles/transition-surface.css +55 -0
- package/dist/styles/workspace-explorer.css +99 -44
- package/dist/summarize-tool-input-CqTcGRYy.js +15 -0
- package/dist/utils/codex-model-catalog.d.ts +2 -8
- package/dist/utils/codex-model-catalog.js +2 -16
- package/dist/utils/mcp-server-catalog.d.ts +139 -0
- package/dist/utils/mcp-server-catalog.js +98 -0
- package/dist/utils/structured-code.d.ts +1 -1
- package/package.json +13 -7
- package/dist/Workspace-C9RFoxcu.d.ts +0 -62
- package/dist/summarize-tool-input-BUJsENSn.js +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as WorkspaceDestination } from "../WorkspaceLink-
|
|
2
|
-
import { s as AgentActivitySummary } from "../AgentActivity-
|
|
1
|
+
import { n as WorkspaceDestination } from "../WorkspaceLink-O-EBKUJ8.js";
|
|
2
|
+
import { s as AgentActivitySummary } from "../AgentActivity-D2SHSGFX.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/AgentActivityPreview.d.ts
|
|
@@ -17,12 +17,12 @@ type AgentActivityPreviewItem = Omit<AgentActivitySummary, "mode"> & {
|
|
|
17
17
|
interface AgentActivityPreviewProps extends Omit<React.HTMLAttributes<HTMLElement>, "children" | "onSelect"> {
|
|
18
18
|
/** Current agent summaries to show in the transient preview. */
|
|
19
19
|
items: readonly AgentActivityPreviewItem[];
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
20
|
+
/** App-authored TanStack Router Link for every durable agent destination. */
|
|
21
|
+
renderAgentLink: (item: AgentActivityPreviewItem) => React.ReactElement;
|
|
22
|
+
/** App-authored TanStack Router Link for a projected workspace file destination. */
|
|
23
|
+
renderWorkspaceFileLink?: (item: AgentActivityPreviewItem, destination: Extract<WorkspaceDestination, {
|
|
24
24
|
kind: "file";
|
|
25
|
-
}>) =>
|
|
25
|
+
}>) => React.ReactElement;
|
|
26
26
|
/** Hides the complete preview when the host supports dismissal. */
|
|
27
27
|
onDismiss?: () => void;
|
|
28
28
|
/** Product mark shown beside the agent rows. */
|
|
@@ -35,8 +35,8 @@ declare function AgentActivityPreview({
|
|
|
35
35
|
className,
|
|
36
36
|
items,
|
|
37
37
|
onDismiss,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
renderAgentLink,
|
|
39
|
+
renderWorkspaceFileLink,
|
|
40
40
|
ref,
|
|
41
41
|
...props
|
|
42
42
|
}: AgentActivityPreviewProps & {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { A as McpIcon, K as SpinnerIcon, Q as WarningIcon, S as FileIcon, et as XIcon } from "../icons-DKXiSepE.js";
|
|
3
3
|
import { ActivityHeader } from "./Activity.js";
|
|
4
4
|
import { AgentActivityFavicon, AgentActivityIcon } from "./AgentActivity.js";
|
|
5
|
+
import { t as NavigationLink } from "../navigation-link-Cob7KBlM.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/AgentActivityPreview.tsx
|
|
8
9
|
/** Compact multi-agent preview for a page overlay or secondary application rail. */
|
|
9
|
-
function AgentActivityPreview({ "aria-label": ariaLabel = "Agent activity", brandIcon = /* @__PURE__ */ jsx(McpIcon, {}), className, items, onDismiss,
|
|
10
|
+
function AgentActivityPreview({ "aria-label": ariaLabel = "Agent activity", brandIcon = /* @__PURE__ */ jsx(McpIcon, {}), className, items, onDismiss, renderAgentLink, renderWorkspaceFileLink, ref, ...props }) {
|
|
10
11
|
if (items.length === 0) return null;
|
|
11
12
|
return /* @__PURE__ */ jsxs("section", {
|
|
12
13
|
ref,
|
|
@@ -32,12 +33,11 @@ function AgentActivityPreview({ "aria-label": ariaLabel = "Agent activity", bran
|
|
|
32
33
|
role: "list",
|
|
33
34
|
children: items.map((item) => /* @__PURE__ */ jsxs("li", {
|
|
34
35
|
className: "agent-activity-preview__item",
|
|
35
|
-
children: [/* @__PURE__ */ jsx(
|
|
36
|
-
|
|
36
|
+
children: [/* @__PURE__ */ jsx(NavigationLink, {
|
|
37
|
+
render: renderAgentLink(item),
|
|
37
38
|
className: "agent-activity-preview__row",
|
|
38
39
|
"aria-label": `${item.label}. ${statusLabel(item.status)}. Open agent.`,
|
|
39
40
|
"data-status": item.status,
|
|
40
|
-
onClick: () => onSelect(item.id),
|
|
41
41
|
children: /* @__PURE__ */ jsx(ActivityHeader, {
|
|
42
42
|
icon: item.url ? /* @__PURE__ */ jsx(AgentActivityFavicon, {
|
|
43
43
|
url: item.url,
|
|
@@ -61,14 +61,10 @@ function AgentActivityPreview({ "aria-label": ariaLabel = "Agent activity", bran
|
|
|
61
61
|
}) : null, /* @__PURE__ */ jsx(StatusIcon, { status: item.status })]
|
|
62
62
|
})
|
|
63
63
|
})
|
|
64
|
-
}), item.workspaceDestination &&
|
|
65
|
-
|
|
64
|
+
}), item.workspaceDestination && renderWorkspaceFileLink ? /* @__PURE__ */ jsx(NavigationLink, {
|
|
65
|
+
render: renderWorkspaceFileLink(item, item.workspaceDestination),
|
|
66
66
|
className: "agent-activity-preview__file-action",
|
|
67
67
|
"aria-label": `Open ${item.workspaceDestination.path} in workspace`,
|
|
68
|
-
onClick: () => {
|
|
69
|
-
const destination = item.workspaceDestination;
|
|
70
|
-
if (destination) onOpenWorkspaceFile(item.id, destination);
|
|
71
|
-
},
|
|
72
68
|
children: /* @__PURE__ */ jsx(FileIcon, {})
|
|
73
69
|
}) : null]
|
|
74
70
|
}, item.id))
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PermissionModeControl, i as AgentChatRenderMessageContext, n as AgentChatComposerDraft, r as AgentChatProps, t as AgentChat } from "../AgentChat-
|
|
1
|
+
import { a as PermissionModeControl, i as AgentChatRenderMessageContext, n as AgentChatComposerDraft, r as AgentChatProps, t as AgentChat } from "../AgentChat-ClxViuUM.js";
|
|
2
2
|
export { AgentChat, AgentChatComposerDraft, AgentChatProps, AgentChatRenderMessageContext, PermissionModeControl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
3
|
-
import { n as MessageAction, r as MessageActions, t as Message } from "../Message-
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { H as QueueIcon, I as MoveToFrontIcon, U as RefreshIcon, V as PlusIcon, Z as TrashIcon, z as PencilIcon } from "../icons-DKXiSepE.js";
|
|
3
|
+
import { n as MessageAction, r as MessageActions, t as Message } from "../Message-rZEaaD8Q.js";
|
|
4
4
|
import { AgentMessageParts } from "./AgentMessageParts.js";
|
|
5
5
|
import { Context, ContextContent, ContextContentBody, ContextContentHeader, ContextTrigger, getContextUsage, getContextUsedTokens } from "./Context.js";
|
|
6
6
|
import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport } from "./MessageScroller.js";
|
|
@@ -8,8 +8,9 @@ import { ConversationEmptyState } from "./Conversation.js";
|
|
|
8
8
|
import { AgentChatMessageEditor } from "./AgentChatMessageEditor.js";
|
|
9
9
|
import { Marker, MarkerContent } from "./Marker.js";
|
|
10
10
|
import { Menu } from "./Menu.js";
|
|
11
|
+
import { TransitionSurface } from "./TransitionSurface.js";
|
|
11
12
|
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 { t as CopyButton } from "../copy-button-
|
|
13
|
+
import { t as CopyButton } from "../copy-button-BtRwhRks.js";
|
|
13
14
|
import * as React from "react";
|
|
14
15
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
16
|
import { isCompactionMessage } from "agents/experimental/memory/utils";
|
|
@@ -23,6 +24,15 @@ import { isReasoningUIPart, isTextUIPart } from "ai";
|
|
|
23
24
|
* the `SessionMessage` fields it reads, so use the upstream helper directly
|
|
24
25
|
* instead of duplicating the prefix contract locally.
|
|
25
26
|
*/
|
|
27
|
+
function observeAgentChatComposer(element) {
|
|
28
|
+
if (!element || typeof ResizeObserver === "undefined") return;
|
|
29
|
+
const root = element.parentElement;
|
|
30
|
+
const observer = new ResizeObserver(() => {
|
|
31
|
+
root?.style.setProperty("--agent-chat-composer-size", `${element.offsetHeight}px`);
|
|
32
|
+
});
|
|
33
|
+
observer.observe(element);
|
|
34
|
+
return () => observer.disconnect();
|
|
35
|
+
}
|
|
26
36
|
const EMPTY_PENDING_APPROVALS = [];
|
|
27
37
|
const EMPTY_SKIPPED_APPROVAL_IDS = [];
|
|
28
38
|
function createApprovalSessionState(thinkStub) {
|
|
@@ -52,12 +62,11 @@ function AgentChatAddMenu({ children }) {
|
|
|
52
62
|
children: [/* @__PURE__ */ jsxs(Menu.Group, { children: [/* @__PURE__ */ jsx(Menu.GroupLabel, { children: "Add" }), /* @__PURE__ */ jsx(PromptInputActionAddAttachments, {})] }), children]
|
|
53
63
|
})] });
|
|
54
64
|
}
|
|
55
|
-
function AgentChatSubmitAction({ status, onStop,
|
|
65
|
+
function AgentChatSubmitAction({ status, onStop, disabled, hasDraft }) {
|
|
56
66
|
const attachments = usePromptInputAttachments();
|
|
57
67
|
return /* @__PURE__ */ jsx(PromptInputSubmit, {
|
|
58
68
|
status,
|
|
59
69
|
onStop,
|
|
60
|
-
allowSubmitWhileBusy,
|
|
61
70
|
hasContent: hasDraft || attachments.files.length > 0,
|
|
62
71
|
disabled
|
|
63
72
|
});
|
|
@@ -78,13 +87,12 @@ function AgentChatAssistantActions({ message, responseNumber, showCopy, showRetr
|
|
|
78
87
|
label: `Copy response ${responseNumber}`,
|
|
79
88
|
tooltip: "Copy response",
|
|
80
89
|
text: copyText,
|
|
81
|
-
size: "
|
|
90
|
+
size: "sm",
|
|
82
91
|
onCopy: () => onCopyStatus(`Response ${responseNumber} copied.`),
|
|
83
92
|
onError: () => onCopyStatus(`Could not copy response ${responseNumber}. Try again.`)
|
|
84
93
|
}) : null, showRetry && onRegenerate ? /* @__PURE__ */ jsx(MessageAction, {
|
|
85
94
|
label: "Retry",
|
|
86
95
|
tooltip: "Regenerate response",
|
|
87
|
-
size: "icon-lg",
|
|
88
96
|
onClick: () => onRegenerate(message.id),
|
|
89
97
|
children: /* @__PURE__ */ jsx(RefreshIcon, { size: 14 })
|
|
90
98
|
}) : null]
|
|
@@ -100,10 +108,13 @@ function getEditableUserText(message) {
|
|
|
100
108
|
* transport. Product code that talks to a Cloudflare Think agent should render
|
|
101
109
|
* `ThinkChat`; use this directly only for plain AI SDK or read-only messages.
|
|
102
110
|
*/
|
|
103
|
-
function AgentChat({ className, messages,
|
|
111
|
+
function AgentChat({ className, messages, status = "ready", onSubmit, showComposer = onSubmit !== void 0, onStop, placeholder = "Ask anything...", disabled, emptyState, composerHeader, composerTools, slashCommands, mentionCommands, contextSelector, composerEndTools, voiceInput, beforeVoiceStart, composerAddMenuItems, notice, onRegenerate, onEditAndResend, onApprovalResponse, thinkStub, permissionModeControl, onExecutionSettled, pendingApprovals: durableApprovals = EMPTY_PENDING_APPROVALS, contextWindow, renderPart, renderMessageAfter, ref }) {
|
|
104
112
|
const [copyAnnouncement, setCopyAnnouncement] = React.useState("");
|
|
105
113
|
const [composerDraft, setComposerDraft] = React.useState("");
|
|
106
114
|
const [composerReferences, setComposerReferences] = React.useState([]);
|
|
115
|
+
const [pendingPrompts, setPendingPrompts] = React.useState([]);
|
|
116
|
+
const busy = status === "submitted" || status === "streaming";
|
|
117
|
+
const wasBusy = React.useRef(busy);
|
|
107
118
|
const addComposerReference = React.useCallback((reference) => {
|
|
108
119
|
setComposerReferences((current) => current.some((item) => item.id === reference.id && item.trigger === reference.trigger) ? current : [...current, reference]);
|
|
109
120
|
}, []);
|
|
@@ -123,14 +134,35 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
123
134
|
if (copyAnnouncementTimer.current !== null) window.clearTimeout(copyAnnouncementTimer.current);
|
|
124
135
|
}, []);
|
|
125
136
|
const handleSubmit = React.useCallback((message) => {
|
|
126
|
-
const
|
|
137
|
+
const prompt = {
|
|
127
138
|
...message,
|
|
128
139
|
...composerReferences.length ? { references: composerReferences } : {}
|
|
129
|
-
}
|
|
140
|
+
};
|
|
141
|
+
const submission = busy || pendingPrompts.length ? setPendingPrompts((current) => [...current, {
|
|
142
|
+
id: crypto.randomUUID(),
|
|
143
|
+
message: prompt
|
|
144
|
+
}]) : onSubmit?.(prompt);
|
|
130
145
|
setComposerDraft("");
|
|
131
146
|
setComposerReferences([]);
|
|
132
147
|
return submission;
|
|
133
|
-
}, [
|
|
148
|
+
}, [
|
|
149
|
+
busy,
|
|
150
|
+
composerReferences,
|
|
151
|
+
onSubmit,
|
|
152
|
+
pendingPrompts.length
|
|
153
|
+
]);
|
|
154
|
+
React.useEffect(() => {
|
|
155
|
+
const becameReady = wasBusy.current && !busy;
|
|
156
|
+
wasBusy.current = busy;
|
|
157
|
+
const next = pendingPrompts[0];
|
|
158
|
+
if (!becameReady || !next || !onSubmit) return;
|
|
159
|
+
setPendingPrompts((current) => current.slice(1));
|
|
160
|
+
onSubmit(next.message);
|
|
161
|
+
}, [
|
|
162
|
+
busy,
|
|
163
|
+
onSubmit,
|
|
164
|
+
pendingPrompts
|
|
165
|
+
]);
|
|
134
166
|
const selectComposerCommand = React.useCallback((command, trigger) => {
|
|
135
167
|
const reference = {
|
|
136
168
|
id: command.id,
|
|
@@ -180,16 +212,34 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
180
212
|
React.useLayoutEffect(() => {
|
|
181
213
|
setApprovalSession((previous) => previous.thinkStub === thinkStub ? previous : createApprovalSessionState(thinkStub));
|
|
182
214
|
}, [thinkStub]);
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
215
|
+
const skippedApprovalIdSet = React.useMemo(() => new Set(skippedApprovalIds), [skippedApprovalIds]);
|
|
216
|
+
const pendingApprovalItems = React.useMemo(() => {
|
|
217
|
+
return [...getPendingToolApprovals(messages, { pausedExecutions: Boolean(thinkStub) }).filter((part) => {
|
|
218
|
+
if (part.state === "approval-requested" && !onApprovalResponse) return false;
|
|
219
|
+
const id = getApprovalStateKey(part);
|
|
220
|
+
return Boolean(id) && !skippedApprovalIdSet.has(id);
|
|
221
|
+
}).map((part) => ({ part })), ...thinkStub ? durableApprovals.filter((approval) => approval.source === "action" && !skippedApprovalIdSet.has(approval.executionId)).map((approval) => ({ approval })) : []];
|
|
222
|
+
}, [
|
|
223
|
+
durableApprovals,
|
|
224
|
+
messages,
|
|
225
|
+
onApprovalResponse,
|
|
226
|
+
skippedApprovalIdSet,
|
|
227
|
+
thinkStub
|
|
228
|
+
]);
|
|
188
229
|
const approvalsWired = Boolean(onApprovalResponse || thinkStub);
|
|
189
230
|
const autoApprovedIds = React.useRef({
|
|
190
231
|
thinkStub,
|
|
191
232
|
ids: /* @__PURE__ */ new Set()
|
|
192
233
|
});
|
|
234
|
+
const respondToApproval = React.useEffectEvent((id) => {
|
|
235
|
+
onApprovalResponse?.({
|
|
236
|
+
id,
|
|
237
|
+
approved: true
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
const notifyExecutionSettled = React.useEffectEvent(() => {
|
|
241
|
+
onExecutionSettled?.();
|
|
242
|
+
});
|
|
193
243
|
React.useLayoutEffect(() => {
|
|
194
244
|
if (autoApprovedIds.current.thinkStub === thinkStub) return;
|
|
195
245
|
autoApprovedIds.current = {
|
|
@@ -204,35 +254,27 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
204
254
|
const key = "part" in item ? getApprovalStateKey(item.part) : item.approval.executionId;
|
|
205
255
|
if (!id || !key || autoApprovedIds.current.ids.has(key)) continue;
|
|
206
256
|
autoApprovedIds.current.ids.add(key);
|
|
207
|
-
if ("part" in item && item.part.state === "approval-requested")
|
|
208
|
-
id,
|
|
209
|
-
approved: true
|
|
210
|
-
});
|
|
257
|
+
if ("part" in item && item.part.state === "approval-requested") respondToApproval(id);
|
|
211
258
|
else if (thinkStub) thinkStub.approveExecution(id).finally(() => {
|
|
212
|
-
|
|
259
|
+
notifyExecutionSettled();
|
|
213
260
|
});
|
|
214
261
|
}
|
|
215
262
|
}, [
|
|
263
|
+
pendingApprovalItems,
|
|
216
264
|
permissionMode,
|
|
217
265
|
permissionModeControl,
|
|
218
|
-
|
|
219
|
-
durableApprovals,
|
|
220
|
-
onApprovalResponse,
|
|
221
|
-
thinkStub,
|
|
222
|
-
onExecutionSettled
|
|
266
|
+
thinkStub
|
|
223
267
|
]);
|
|
224
268
|
const pendingApproval = !permissionModeControl && permissionMode === "bypass" ? void 0 : pendingApprovalItems[0];
|
|
225
269
|
const contextUsage = contextWindow ? getContextUsage(messages) : void 0;
|
|
226
|
-
const
|
|
227
|
-
const transcriptMessages = queuedMessageIds.size ? messages.filter((message) => !queuedMessageIds.has(message.id)) : messages;
|
|
228
|
-
const newestAssistantIndex = transcriptMessages.findLastIndex((message) => message.role === "assistant" && !isCompactionMessage(message));
|
|
270
|
+
const newestAssistantIndex = messages.findLastIndex((message) => message.role === "assistant" && !isCompactionMessage(message));
|
|
229
271
|
const lastAssistantIndex = onRegenerate && status !== "streaming" && status !== "submitted" ? newestAssistantIndex : -1;
|
|
230
|
-
const lastUserIndex = onEditAndResend && !disabled && status !== "streaming" && status !== "submitted" ?
|
|
272
|
+
const lastUserIndex = onEditAndResend && !disabled && status !== "streaming" && status !== "submitted" ? messages.findLastIndex((message) => message.role === "user") : -1;
|
|
231
273
|
const [editingMessageId, setEditingMessageId] = React.useState();
|
|
232
274
|
const restoreEditFocus = React.useRef(false);
|
|
233
275
|
const editButtonRef = React.useRef(null);
|
|
234
276
|
let assistantResponseCount = 0;
|
|
235
|
-
const assistantResponseNumbers =
|
|
277
|
+
const assistantResponseNumbers = messages.map((message) => {
|
|
236
278
|
if (message.role !== "assistant" || isCompactionMessage(message)) return 0;
|
|
237
279
|
assistantResponseCount += 1;
|
|
238
280
|
return assistantResponseCount;
|
|
@@ -242,17 +284,9 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
242
284
|
editButtonRef.current?.focus();
|
|
243
285
|
restoreEditFocus.current = false;
|
|
244
286
|
}, [editingMessageId]);
|
|
245
|
-
|
|
246
|
-
if (!el || typeof ResizeObserver === "undefined") return;
|
|
247
|
-
const root = el.parentElement;
|
|
248
|
-
const observer = new ResizeObserver(() => {
|
|
249
|
-
root?.style.setProperty("--agent-chat-composer-size", `${el.offsetHeight}px`);
|
|
250
|
-
});
|
|
251
|
-
observer.observe(el);
|
|
252
|
-
return () => observer.disconnect();
|
|
253
|
-
};
|
|
254
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
287
|
+
return /* @__PURE__ */ jsxs(TransitionSurface, {
|
|
255
288
|
ref,
|
|
289
|
+
variant: "fade",
|
|
256
290
|
className: cx("agent-chat", className),
|
|
257
291
|
"data-composer-hidden": showComposer ? void 0 : "",
|
|
258
292
|
children: [
|
|
@@ -270,13 +304,13 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
270
304
|
children: [/* @__PURE__ */ jsx(MessageScrollerViewport, { children: /* @__PURE__ */ jsxs(MessageScrollerContent, {
|
|
271
305
|
"aria-busy": status === "streaming" || status === "submitted",
|
|
272
306
|
className: "agent-chat__transcript-content",
|
|
273
|
-
children: [
|
|
274
|
-
className: "
|
|
307
|
+
children: [messages.length === 0 ? /* @__PURE__ */ jsx(MessageScrollerItem, {
|
|
308
|
+
className: "conversation__empty-row",
|
|
275
309
|
children: emptyState ?? /* @__PURE__ */ jsx(ConversationEmptyState, {
|
|
276
310
|
title: "Start a conversation",
|
|
277
311
|
description: "Ask the agent to inspect, plan, or build."
|
|
278
312
|
})
|
|
279
|
-
}) : null,
|
|
313
|
+
}) : null, messages.map((message, messageIndex) => /* @__PURE__ */ jsx(MessageScrollerItem, {
|
|
280
314
|
messageId: message.id,
|
|
281
315
|
scrollAnchor: message.role === "user",
|
|
282
316
|
children: isCompactionMessage(message) ? /* @__PURE__ */ jsx(Marker, {
|
|
@@ -299,7 +333,7 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
299
333
|
}, message.id) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
300
334
|
/* @__PURE__ */ jsx(AgentMessageParts, {
|
|
301
335
|
message,
|
|
302
|
-
status: messageIndex ===
|
|
336
|
+
status: messageIndex === messages.length - 1 ? status : "ready",
|
|
303
337
|
renderPart
|
|
304
338
|
}),
|
|
305
339
|
renderMessageAfter?.({
|
|
@@ -312,7 +346,6 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
312
346
|
ref: editButtonRef,
|
|
313
347
|
label: "Edit message",
|
|
314
348
|
tooltip: "Edit and resend",
|
|
315
|
-
size: "icon-lg",
|
|
316
349
|
onClick: () => {
|
|
317
350
|
restoreEditFocus.current = false;
|
|
318
351
|
setEditingMessageId(message.id);
|
|
@@ -334,12 +367,12 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
334
367
|
}) }), /* @__PURE__ */ jsx(MessageScrollerButton, {
|
|
335
368
|
"aria-label": "Scroll to latest",
|
|
336
369
|
className: "agent-chat__scroll-button",
|
|
337
|
-
size: "
|
|
370
|
+
size: "sm"
|
|
338
371
|
})]
|
|
339
372
|
})
|
|
340
373
|
}),
|
|
341
374
|
showComposer ? /* @__PURE__ */ jsxs("div", {
|
|
342
|
-
ref:
|
|
375
|
+
ref: observeAgentChatComposer,
|
|
343
376
|
className: "agent-chat__composer",
|
|
344
377
|
children: [
|
|
345
378
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -348,13 +381,13 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
348
381
|
"aria-atomic": "true",
|
|
349
382
|
children: notice
|
|
350
383
|
}),
|
|
351
|
-
|
|
384
|
+
pendingPrompts.length ? /* @__PURE__ */ jsx("section", {
|
|
352
385
|
className: "agent-chat__queued",
|
|
353
386
|
"aria-label": "Queued messages",
|
|
354
387
|
children: /* @__PURE__ */ jsx("ul", {
|
|
355
388
|
className: "agent-chat__queued-list",
|
|
356
|
-
children:
|
|
357
|
-
const messageText =
|
|
389
|
+
children: pendingPrompts.map((pending) => {
|
|
390
|
+
const messageText = pending.message.text || "Queued message";
|
|
358
391
|
return /* @__PURE__ */ jsxs("li", {
|
|
359
392
|
className: "agent-chat__queued-message",
|
|
360
393
|
children: [
|
|
@@ -367,22 +400,22 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
367
400
|
className: "agent-chat__queued-text sigvelo-truncate",
|
|
368
401
|
children: messageText
|
|
369
402
|
}),
|
|
370
|
-
|
|
403
|
+
/* @__PURE__ */ jsxs("button", {
|
|
371
404
|
type: "button",
|
|
372
405
|
className: "agent-chat__queued-action",
|
|
373
|
-
"aria-label": `
|
|
374
|
-
onClick: () =>
|
|
375
|
-
children: [/* @__PURE__ */ jsx(
|
|
376
|
-
})
|
|
377
|
-
|
|
406
|
+
"aria-label": `Move queued message to front: ${messageText}`,
|
|
407
|
+
onClick: () => setPendingPrompts((current) => [pending, ...current.filter((item) => item !== pending)]),
|
|
408
|
+
children: [/* @__PURE__ */ jsx(MoveToFrontIcon, {}), "Move to front"]
|
|
409
|
+
}),
|
|
410
|
+
/* @__PURE__ */ jsx("button", {
|
|
378
411
|
type: "button",
|
|
379
412
|
className: "agent-chat__queued-action agent-chat__queued-remove",
|
|
380
413
|
"aria-label": `Remove queued message: ${messageText}`,
|
|
381
|
-
onClick: () =>
|
|
414
|
+
onClick: () => setPendingPrompts((current) => current.filter((item) => item !== pending)),
|
|
382
415
|
children: /* @__PURE__ */ jsx(TrashIcon, {})
|
|
383
|
-
})
|
|
416
|
+
})
|
|
384
417
|
]
|
|
385
|
-
},
|
|
418
|
+
}, pending.id);
|
|
386
419
|
})
|
|
387
420
|
})
|
|
388
421
|
}) : null,
|
|
@@ -452,7 +485,6 @@ function AgentChat({ className, messages, queuedMessages = [], onSteerQueuedMess
|
|
|
452
485
|
/* @__PURE__ */ jsx(AgentChatSubmitAction, {
|
|
453
486
|
status,
|
|
454
487
|
onStop,
|
|
455
|
-
allowSubmitWhileBusy: Boolean(allowSubmitWhileBusy),
|
|
456
488
|
disabled,
|
|
457
489
|
hasDraft: Boolean(composerDraft.trim() || composerReferences.length)
|
|
458
490
|
})
|
|
@@ -74,14 +74,14 @@ function AgentChatMessageEditor({ message, originalText, onCancel, onSubmit, onS
|
|
|
74
74
|
type: "button",
|
|
75
75
|
variant: "outline",
|
|
76
76
|
color: "neutral",
|
|
77
|
-
size: "
|
|
77
|
+
size: "sm",
|
|
78
78
|
disabled: isSubmitting,
|
|
79
79
|
onClick: onCancel,
|
|
80
80
|
children: "Cancel"
|
|
81
81
|
}), /* @__PURE__ */ jsx(Button, {
|
|
82
82
|
type: "submit",
|
|
83
83
|
color: "primary",
|
|
84
|
-
size: "
|
|
84
|
+
size: "sm",
|
|
85
85
|
disabled: !canSubmit,
|
|
86
86
|
children: isSubmitting ? "Resending…" : "Send"
|
|
87
87
|
})]
|
|
@@ -23,13 +23,13 @@ function AgentChatTurnError({ error, onDismiss, onRetry }) {
|
|
|
23
23
|
type: "button",
|
|
24
24
|
variant: "ghost",
|
|
25
25
|
color: "neutral",
|
|
26
|
-
size: "
|
|
26
|
+
size: "sm",
|
|
27
27
|
onClick: onDismiss,
|
|
28
28
|
children: "Dismiss"
|
|
29
29
|
}), onRetry ? /* @__PURE__ */ jsx(Button, {
|
|
30
30
|
type: "button",
|
|
31
31
|
color: "primary",
|
|
32
|
-
size: "
|
|
32
|
+
size: "sm",
|
|
33
33
|
onClick: onRetry,
|
|
34
34
|
children: "Try again"
|
|
35
35
|
}) : null]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { O as LinkIcon } from "../icons-DKXiSepE.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Popover } from "./Popover.js";
|
|
5
5
|
import { Field } from "./Field.js";
|
|
6
6
|
import { Form } from "./Form.js";
|
|
7
|
-
import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-
|
|
7
|
+
import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-Bb-IPBc_.js";
|
|
8
8
|
import { CUSTOM_MCP_SERVER_CARD } from "../utils/mcp-server-catalog.js";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as MessageContent, f as MessageResponse, i as MessageAttachment } from "../Message-
|
|
1
|
+
import { d as MessageContent, f as MessageResponse, i as MessageAttachment } from "../Message-rZEaaD8Q.js";
|
|
2
2
|
import { Reasoning, ReasoningContent, ReasoningTrigger } from "./Reasoning.js";
|
|
3
3
|
import { Source, Sources, SourcesContent, SourcesTrigger } from "./Sources.js";
|
|
4
4
|
import { ToolInvocation } from "./ToolInvocation.js";
|
|
@@ -13,7 +13,8 @@ interface AgentToolDetailProps<State = unknown, MessageT extends UIMessage = UIM
|
|
|
13
13
|
/** Whole child Think chat hook result; it owns the stored child transcript. */
|
|
14
14
|
chat: ThinkChatValue<State, MessageT>;
|
|
15
15
|
messages?: ThinkChatMessagesProps<MessageT>;
|
|
16
|
-
|
|
16
|
+
/** App-authored TanStack Router Link to the parent conversation. */
|
|
17
|
+
backLink?: React.ReactElement;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Live retained-child detail composed from upstream connection and chat values.
|
|
@@ -21,10 +22,10 @@ interface AgentToolDetailProps<State = unknown, MessageT extends UIMessage = UIM
|
|
|
21
22
|
* compact parent-side stream projection and is never promoted to fake history.
|
|
22
23
|
*/
|
|
23
24
|
declare function AgentToolDetail<State = unknown, MessageT extends UIMessage = UIMessage>({
|
|
25
|
+
backLink,
|
|
24
26
|
chat,
|
|
25
27
|
className,
|
|
26
28
|
messages,
|
|
27
|
-
onBack,
|
|
28
29
|
ref,
|
|
29
30
|
run,
|
|
30
31
|
...props
|
|
@@ -41,13 +42,14 @@ interface SelectedAgentToolChildProps<ParentAgentT extends ThinkAgent<ParentStat
|
|
|
41
42
|
*/
|
|
42
43
|
connectionOptions?: UseAgentOptions<ChildState>;
|
|
43
44
|
messages?: ThinkChatMessagesProps<MessageT>;
|
|
44
|
-
|
|
45
|
+
/** App-authored TanStack Router Link to the parent conversation. */
|
|
46
|
+
backLink?: React.ReactElement;
|
|
45
47
|
}
|
|
46
48
|
/** Lazily connects one selected retained child and renders its real Think chat. */
|
|
47
49
|
declare function SelectedAgentToolChild<ParentAgentT extends ThinkAgent<ParentState>, ParentState = unknown, ChildState = unknown, MessageT extends UIMessage = UIMessage>({
|
|
50
|
+
backLink,
|
|
48
51
|
connectionOptions,
|
|
49
52
|
messages,
|
|
50
|
-
onBack,
|
|
51
53
|
parentAgent,
|
|
52
54
|
run
|
|
53
55
|
}: SelectedAgentToolChildProps<ParentAgentT, ParentState, ChildState, MessageT>): React.JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { r as ArrowLeftIcon } from "../icons-DKXiSepE.js";
|
|
3
|
+
import { TransitionSurface } from "./TransitionSurface.js";
|
|
3
4
|
import { AppTopBar } from "./AppTopBar.js";
|
|
4
5
|
import { NaniteMark } from "./NaniteScene.js";
|
|
5
6
|
import { SubagentRunIndicator, getSubagentRunName } from "./SubagentRunIndicator.js";
|
|
6
7
|
import { SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress } from "./SubagentRunDetails.js";
|
|
7
|
-
import { t as ThinkChat } from "../ThinkChat-
|
|
8
|
+
import { t as ThinkChat } from "../ThinkChat-15EhfvYJ.js";
|
|
8
9
|
import * as React from "react";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
import { useAgentChat } from "@cloudflare/think/react";
|
|
@@ -15,15 +16,16 @@ import { useAgent } from "agents/react";
|
|
|
15
16
|
* The full child transcript comes from `chat.messages`; `run.parts` remains a
|
|
16
17
|
* compact parent-side stream projection and is never promoted to fake history.
|
|
17
18
|
*/
|
|
18
|
-
function AgentToolDetail({ chat, className, messages,
|
|
19
|
+
function AgentToolDetail({ backLink, chat, className, messages, ref, run, ...props }) {
|
|
19
20
|
const backRef = React.useRef(null);
|
|
20
21
|
const name = getSubagentRunName(run);
|
|
21
22
|
const progressLabel = run.progress?.message ?? run.progress?.phase;
|
|
22
23
|
React.useEffect(() => {
|
|
23
24
|
backRef.current?.focus();
|
|
24
25
|
}, [run.runId]);
|
|
25
|
-
return /* @__PURE__ */ jsxs(
|
|
26
|
+
return /* @__PURE__ */ jsxs(TransitionSurface, {
|
|
26
27
|
ref,
|
|
28
|
+
variant: "slide-inline",
|
|
27
29
|
"data-slot": "agent-tool-detail",
|
|
28
30
|
className: cx("agent-tool-detail", className),
|
|
29
31
|
...props,
|
|
@@ -31,10 +33,10 @@ function AgentToolDetail({ chat, className, messages, onBack, ref, run, ...props
|
|
|
31
33
|
/* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
32
34
|
"aria-label": `${name} controls`,
|
|
33
35
|
children: [
|
|
34
|
-
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [
|
|
36
|
+
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [backLink ? /* @__PURE__ */ jsx(AppTopBar.Link, {
|
|
35
37
|
ref: backRef,
|
|
36
38
|
label: "Back to parent conversation",
|
|
37
|
-
|
|
39
|
+
render: backLink,
|
|
38
40
|
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
39
41
|
}) : null, /* @__PURE__ */ jsx(NaniteMark, { index: run.order })] }),
|
|
40
42
|
/* @__PURE__ */ jsx(AppTopBar.Title, { children: /* @__PURE__ */ jsx("h2", {
|
|
@@ -79,7 +81,7 @@ function AgentToolDetail({ chat, className, messages, onBack, ref, run, ...props
|
|
|
79
81
|
});
|
|
80
82
|
}
|
|
81
83
|
/** Lazily connects one selected retained child and renders its real Think chat. */
|
|
82
|
-
function SelectedAgentToolChild({ connectionOptions, messages,
|
|
84
|
+
function SelectedAgentToolChild({ backLink, connectionOptions, messages, parentAgent, run }) {
|
|
83
85
|
const [root, ...parentSubPath] = parentAgent.path;
|
|
84
86
|
return /* @__PURE__ */ jsx(AgentToolDetail, {
|
|
85
87
|
run,
|
|
@@ -91,8 +93,8 @@ function SelectedAgentToolChild({ connectionOptions, messages, onBack, parentAge
|
|
|
91
93
|
sub: [...connectionOptions?.sub ?? parentSubPath, run.subAgent]
|
|
92
94
|
}) }),
|
|
93
95
|
messages,
|
|
94
|
-
|
|
95
|
-
});
|
|
96
|
+
backLink
|
|
97
|
+
}, run.runId);
|
|
96
98
|
}
|
|
97
99
|
//#endregion
|
|
98
100
|
export { AgentToolDetail, SelectedAgentToolChild };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as mergeBaseClassName } from "../class-names-
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-BiMDVpUo.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|