@mcp-b/react-components 0.46.7 → 0.47.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.
Files changed (138) hide show
  1. package/dist/{CodeBlock-CcteqDvA.js → CodeBlock-DMHZiw86.js} +1 -1
  2. package/dist/{FileTree-jtP9471I.js → FileTree-BHebfvkK.js} +1 -1
  3. package/dist/{SetupChecklist-BXwSSorj.js → SetupChecklist-CwRjIDH4.js} +1 -1
  4. package/dist/ThinkChat-CwMdEum8.d.ts +185 -0
  5. package/dist/{ThinkChat-qztQ6Clo.js → ThinkChat-DLDta57t.js} +16 -16
  6. package/dist/ThinkThreadPicker-yFz4vvIf.d.ts +91 -0
  7. package/dist/{Workspace-DZusrEeP.d.ts → Workspace-C_zHq9KZ.d.ts} +1 -1
  8. package/dist/{WorkspaceFileView-D0HyoUV8.js → WorkspaceFileView-ChIJz-fl.js} +4 -4
  9. package/dist/{WorkspaceLink-DtH66bAY.js → WorkspaceLink-B1d2GIGl.js} +7 -2
  10. package/dist/WorkspaceLive-DLGhtIly.d.ts +49 -0
  11. package/dist/{WorkspaceMessageResponse-CJCmGvTx.js → WorkspaceMessageResponse-Dg_aNpoj.js} +76 -40
  12. package/dist/WorkspaceMessageResponse-kJYU8Onj.d.ts +48 -0
  13. package/dist/components/agents-sdk/AgentActivity.js +1 -1
  14. package/dist/components/agents-sdk/AgentChat.js +10 -10
  15. package/dist/components/agents-sdk/AgentEvent.js +1 -1
  16. package/dist/components/agents-sdk/BrowserLiveScreen.js +1 -1
  17. package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
  18. package/dist/components/agents-sdk/BrowserReplay.js +1 -1
  19. package/dist/components/agents-sdk/BrowserRunPanel.js +1 -1
  20. package/dist/components/agents-sdk/ManagerOffice.js +4 -4
  21. package/dist/components/agents-sdk/McpConnectionRequest.js +2 -2
  22. package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
  23. package/dist/components/agents-sdk/McpPluginCatalog.js +2 -2
  24. package/dist/components/agents-sdk/McpServerPicker.js +2 -2
  25. package/dist/components/agents-sdk/ModelSelector.js +3 -3
  26. package/dist/components/agents-sdk/PromptInputApproval.js +1 -1
  27. package/dist/components/agents-sdk/PromptInputCommands.js +1 -1
  28. package/dist/components/agents-sdk/SubagentRunIndicator.js +1 -1
  29. package/dist/components/agents-sdk/SubagentRunSelector.js +1 -1
  30. package/dist/components/agents-sdk/ThinkChat.d.ts +1 -180
  31. package/dist/components/agents-sdk/ThinkChat.js +1 -1
  32. package/dist/components/agents-sdk/ThinkChatActivity.js +1 -1
  33. package/dist/components/agents-sdk/ThinkChatToolPanels.js +2 -2
  34. package/dist/components/agents-sdk/ThinkExecutionDetail.js +2 -2
  35. package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
  36. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +3 -3
  37. package/dist/components/agents-sdk/ThinkFullApp.d.ts +13 -4
  38. package/dist/components/agents-sdk/ThinkFullApp.js +11 -4
  39. package/dist/components/agents-sdk/ThinkFullAppViewSwitch.js +1 -1
  40. package/dist/components/agents-sdk/ThinkRecoveryNotice.js +1 -1
  41. package/dist/components/agents-sdk/ThinkRoutineBrowser.js +2 -2
  42. package/dist/components/agents-sdk/ThinkRoutineDetail.js +1 -1
  43. package/dist/components/agents-sdk/ThinkRoutineForm.js +4 -4
  44. package/dist/components/agents-sdk/ThinkRoutineLibrary.js +3 -3
  45. package/dist/components/agents-sdk/ThinkRoutineRuns.js +1 -1
  46. package/dist/components/agents-sdk/ThinkSidepanel.d.ts +20 -5
  47. package/dist/components/agents-sdk/ThinkSidepanel.js +56 -44
  48. package/dist/components/agents-sdk/ThinkThreadPicker.d.ts +1 -90
  49. package/dist/components/agents-sdk/ThinkThreadPicker.js +4 -4
  50. package/dist/components/agents-sdk/Workspace.d.ts +2 -2
  51. package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
  52. package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
  53. package/dist/components/agents-sdk/WorkspaceConcept.d.ts +44 -0
  54. package/dist/components/agents-sdk/WorkspaceConcept.js +42 -0
  55. package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +100 -0
  56. package/dist/components/agents-sdk/WorkspaceCorrespondence.js +429 -0
  57. package/dist/components/agents-sdk/WorkspaceExecution.d.ts +106 -0
  58. package/dist/components/agents-sdk/WorkspaceExecution.js +393 -0
  59. package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +1 -1
  60. package/dist/components/agents-sdk/WorkspaceExplorer.js +2 -2
  61. package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
  62. package/dist/components/agents-sdk/WorkspaceHeader.js +1 -1
  63. package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
  64. package/dist/components/agents-sdk/WorkspaceLive.d.ts +2 -0
  65. package/dist/components/agents-sdk/WorkspaceLive.js +85 -0
  66. package/dist/components/agents-sdk/WorkspaceMessageResponse.d.ts +2 -2
  67. package/dist/components/agents-sdk/WorkspaceMessageResponse.js +2 -2
  68. package/dist/components/agents-sdk/WorkspaceMountManager.js +2 -2
  69. package/dist/components/agents-sdk/WorkspaceProject.d.ts +93 -0
  70. package/dist/components/agents-sdk/WorkspaceProject.js +201 -0
  71. package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +47 -0
  72. package/dist/components/agents-sdk/WorkspaceUserScript.js +146 -0
  73. package/dist/components/ai-sdk/Activity.js +1 -1
  74. package/dist/components/ai-sdk/AgentChatStartScreen.js +1 -1
  75. package/dist/components/ai-sdk/Approval.js +2 -2
  76. package/dist/components/ai-sdk/Artifact.js +1 -1
  77. package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
  78. package/dist/components/ai-sdk/ChainOfThought.js +1 -1
  79. package/dist/components/ai-sdk/Checkpoint.js +1 -1
  80. package/dist/components/ai-sdk/CodeBlock.js +1 -1
  81. package/dist/components/ai-sdk/ComposerLink.d.ts +4 -1
  82. package/dist/components/ai-sdk/ComposerLink.js +4 -3
  83. package/dist/components/ai-sdk/ConnectedAppCards.d.ts +22 -2
  84. package/dist/components/ai-sdk/ConnectedAppCards.js +50 -43
  85. package/dist/components/ai-sdk/Conversation.js +1 -1
  86. package/dist/components/ai-sdk/Goal.js +1 -1
  87. package/dist/components/ai-sdk/InlineCitation.js +1 -1
  88. package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
  89. package/dist/components/ai-sdk/Message.js +1 -1
  90. package/dist/components/ai-sdk/MessageScroller.js +1 -1
  91. package/dist/components/ai-sdk/MessageScrollerVirtual.js +1 -1
  92. package/dist/components/ai-sdk/Plan.js +1 -1
  93. package/dist/components/ai-sdk/PromptInput.js +5 -5
  94. package/dist/components/ai-sdk/Queue.js +1 -1
  95. package/dist/components/ai-sdk/Reasoning.js +1 -1
  96. package/dist/components/ai-sdk/Sources.js +1 -1
  97. package/dist/components/ai-sdk/Task.js +1 -1
  98. package/dist/components/extension/ChatGptSignInScreen.js +1 -1
  99. package/dist/components/extension/CodexModelSelector.js +2 -2
  100. package/dist/components/extension/ConversationTabPicker.js +2 -2
  101. package/dist/components/foundations/Checkbox.js +1 -1
  102. package/dist/components/foundations/Collapsible.js +1 -1
  103. package/dist/components/foundations/ContextMenu.js +1 -1
  104. package/dist/components/foundations/Menubar.js +1 -1
  105. package/dist/components/foundations/SearchField.js +1 -1
  106. package/dist/components/foundations/Select.js +1 -1
  107. package/dist/components/foundations/Stepper.js +1 -1
  108. package/dist/components/foundations/Toast.js +1 -1
  109. package/dist/components/foundations/ToggleGroup.d.ts +1 -1
  110. package/dist/components/foundations/ToggleGroup.js +1 -1
  111. package/dist/components/foundations/icons.d.ts +2 -2
  112. package/dist/components/foundations/icons.js +2 -2
  113. package/dist/components/general-purpose/Commit.js +2 -2
  114. package/dist/components/general-purpose/EnvironmentVariables.js +2 -2
  115. package/dist/components/general-purpose/FileTree.js +1 -1
  116. package/dist/components/general-purpose/PricingBillingToggle.js +1 -1
  117. package/dist/components/general-purpose/PricingPlanCard.js +2 -2
  118. package/dist/components/general-purpose/PricingUsageCalculator.js +2 -2
  119. package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
  120. package/dist/components/general-purpose/SettingsFormDialog.js +2 -2
  121. package/dist/components/general-purpose/SetupChecklist.js +1 -1
  122. package/dist/components/general-purpose/Terminal.js +2 -2
  123. package/dist/components/general-purpose/TestResults.js +1 -1
  124. package/dist/components/general-purpose/ThemeModeControl.js +2 -2
  125. package/dist/components/general-purpose/WebPreview.js +2 -2
  126. package/dist/components/nanites/AgentConnection.js +2 -2
  127. package/dist/components/nanites/AgentToolDetail.d.ts +1 -1
  128. package/dist/components/nanites/AgentToolDetail.js +5 -5
  129. package/dist/{copy-button-BABPlsc-.js → copy-button-CSDuDfdP.js} +1 -1
  130. package/dist/{icons-ChPpNMmU.d.ts → icons-CCZGYUwU.d.ts} +6 -1
  131. package/dist/{icons-BC4HZqSK.js → icons-cuEtsgj9.js} +4 -3
  132. package/dist/styles/connected-app-card.css +8 -0
  133. package/dist/styles/description-list.css +3 -1
  134. package/dist/styles/index.css +1 -0
  135. package/dist/styles/workspace-concepts.css +28 -0
  136. package/dist/workspace-assets-CxpEHsac.js +154 -0
  137. package/package.json +2 -2
  138. package/dist/WorkspaceMessageResponse-D66ty4FO.d.ts +0 -24
@@ -1,6 +1,6 @@
1
1
  import { t as cx } from "./class-names-BiMDVpUo.js";
2
+ import { t as CopyButton } from "./copy-button-CSDuDfdP.js";
2
3
  import { Select } from "./components/foundations/Select.js";
3
- import { t as CopyButton } from "./copy-button-BABPlsc-.js";
4
4
  import * as React from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { createHighlighter } from "shiki";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "./class-names-BiMDVpUo.js";
2
- import { C as FolderIcon, S as FileIcon, p as ChevronRightIcon, w as FolderOpenIcon } from "./icons-BC4HZqSK.js";
2
+ import { C as FolderIcon, S as FileIcon, p as ChevronRightIcon, w as FolderOpenIcon } from "./icons-cuEtsgj9.js";
3
3
  import { t as NavigationLink } from "./navigation-link-kqMa81v5.js";
4
4
  import * as React from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  import { n as mergeBaseClassName } from "./class-names-BiMDVpUo.js";
2
- import { $ as WarningIcon, B as PlusIcon, d as CheckIcon, f as ChevronDownIcon } from "./icons-BC4HZqSK.js";
2
+ import { B as PlusIcon, d as CheckIcon, et as WarningIcon, f as ChevronDownIcon } from "./icons-cuEtsgj9.js";
3
3
  import { Button } from "./components/foundations/Button.js";
4
4
  import { Menu } from "./components/foundations/Menu.js";
5
5
  import * as React from "react";
@@ -0,0 +1,185 @@
1
+ import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-C7L-Mv9U.js";
2
+ import { K as PromptInputMessage } from "./PromptInput-DtJHyp0S.js";
3
+ import { r as AgentChatProps } from "./AgentChat-BLmQghkt.js";
4
+ import { n as AgentToolEventsValue } from "./AgentToolRunsContext-jtmveaRE.js";
5
+ import { o as UseSessionCompactionResult } from "./SessionCompaction-CmTJFpzj.js";
6
+ import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "./ThinkChatActivity-B3lGVS-6.js";
7
+ import { i as ThinkChatValue } from "./ThinkChatContext-COIgzkYp.js";
8
+ import { t as ThinkRecoveryNotice } from "./ThinkRecoveryNotice-DGWr94rk.js";
9
+ import { n as WorkspaceFileRenderer } from "./WorkspaceMessageResponse-kJYU8Onj.js";
10
+ import * as React from "react";
11
+ import { UIMessage } from "ai";
12
+ import { UseAgentOptions } from "agents/react";
13
+ import { DataTag, UndefinedInitialDataOptions } from "@tanstack/react-query";
14
+ import { PendingApproval, Think } from "@cloudflare/think";
15
+ import { AgentStub } from "agents/client";
16
+
17
+ //#region src/components/agents-sdk/ThinkChat.d.ts
18
+ type ThinkPendingExecutionApprovalsQueryKey = readonly ["think", sourceKey: string, "pending-approvals"];
19
+ type ThinkPendingExecutionApprovalsQueryOptions = UndefinedInitialDataOptions<readonly PendingApproval[], Error, readonly PendingApproval[], ThinkPendingExecutionApprovalsQueryKey> & {
20
+ queryKey: DataTag<ThinkPendingExecutionApprovalsQueryKey, readonly PendingApproval[], Error>;
21
+ };
22
+ interface ThinkChatProviderProps<State = unknown, MessageT extends UIMessage = UIMessage> {
23
+ /** The `useAgentChat` value from `@cloudflare/think/react` that descendants read. */
24
+ chat: ThinkChatValue<State, MessageT>;
25
+ /** Optional whole `useAgentToolEvents` result when the app owns the parent connection. */
26
+ agentTools?: AgentToolEventsValue<MessageT["parts"][number]>;
27
+ children: React.ReactNode;
28
+ }
29
+ interface ThinkChatRootProps<State = unknown> {
30
+ /** Agent to connect to: a kebab-case class name, or full `useAgent` options. */
31
+ agent: string | UseAgentOptions<State>;
32
+ /** Disable durable pending-approval discovery. Also disable it on `ThinkChat.Messages`. */
33
+ approvalsEnabled?: boolean;
34
+ /** Instance name (e.g. a session or room id). Wins over `agent.name`. */
35
+ name?: string;
36
+ /**
37
+ * Stable, non-secret identity for the remote Think agent. Include endpoint,
38
+ * account or tenant scope, and agent path so sources cannot share cached data.
39
+ */
40
+ sourceKey: string;
41
+ children: React.ReactNode;
42
+ }
43
+ /**
44
+ * The first-turn surface with no conversation behind it. Supply this instead of
45
+ * a chat provider when the composer's submission is what creates the
46
+ * conversation: connecting early is what leaves empty threads behind.
47
+ */
48
+ interface ThinkChatDraft<MessageT extends UIMessage = UIMessage> {
49
+ /** Client-only transcript rows, such as a locally rendered guide. */
50
+ messages?: readonly MessageT[];
51
+ /** Receives the first message, normalized the same way a live thread's is. */
52
+ onSubmit: (message: {
53
+ text: string;
54
+ files: PromptInputMessage["files"];
55
+ }) => void | Promise<void>;
56
+ /** Set while the app is creating the conversation, so the composer reads busy. */
57
+ status?: AgentChatProps<MessageT>["status"];
58
+ }
59
+ type ThinkChatManagedAgentChatProp = "messages" | "onApprovalResponse" | "onRegenerate" | "onStop" | "onSubmit" | "status";
60
+ /**
61
+ * The AgentChat composition surface, minus the live values ThinkChat supplies
62
+ * from `useAgentChat`. Think-specific activity and draft/session inputs extend
63
+ * that owner instead of mirroring every AgentChat prop here.
64
+ */
65
+ type ThinkChatMessagesProps<MessageT extends UIMessage = UIMessage> = Omit<AgentChatProps<MessageT>, ThinkChatManagedAgentChatProp> & ThinkChatActivityRendererOptions<MessageT> & {
66
+ /**
67
+ * Renders without a chat provider, for the first turn of a conversation
68
+ * that does not exist yet.
69
+ */
70
+ draft?: ThinkChatDraft<MessageT>; /** Whole `useSessionCompaction` result for built-in progress and error notices. */
71
+ sessionCompaction?: UseSessionCompactionResult;
72
+ /**
73
+ * Promotes one standalone assistant workspace file link through a host
74
+ * callback. Return a node to replace the link, or `null` to keep it.
75
+ */
76
+ renderWorkspaceFile?: WorkspaceFileRenderer;
77
+ };
78
+ /** Shared pending-approval options for components and TanStack Router loaders. */
79
+ declare function thinkPendingExecutionApprovalsQueryOptions(stub: AgentStub<Think>, sourceKey: string): ThinkPendingExecutionApprovalsQueryOptions;
80
+ declare function useThinkPendingExecutionApprovals(stub: AgentStub<Think>, sourceKey: string, refreshSignal?: unknown, enabled?: boolean): {
81
+ pendingApprovals: readonly PendingApproval[];
82
+ refreshPendingApprovals: () => Promise<void>;
83
+ };
84
+ /**
85
+ * Chat UI for Cloudflare Think agents. Provide a `useAgentChat` value (or let
86
+ * `ThinkChat.Root` create one) and `ThinkChat.Messages` renders the message
87
+ * stream with agent work folded into collapsed Activity blocks.
88
+ */
89
+ declare function ThinkChatProvider<State = unknown, MessageT extends UIMessage = UIMessage>({
90
+ agentTools,
91
+ chat,
92
+ children
93
+ }: ThinkChatProviderProps<State, MessageT>): React.JSX.Element;
94
+ /**
95
+ * Batteries-included root: connects to the named Think agent (upstream's
96
+ * `useAgent` + `useAgentChat`) and provides the live chat to everything
97
+ * inside. Render it beneath the app's `QueryClientProvider`. If the app
98
+ * already owns the chat hook, use `ThinkChat.Provider`.
99
+ *
100
+ * @example
101
+ * ```tsx
102
+ * <QueryClientProvider client={queryClient}>
103
+ * <ThinkChat.Root
104
+ * agent="my-agent"
105
+ * name="session-1"
106
+ * sourceKey="api.example.com:account:acme:agent:session-1"
107
+ * >
108
+ * <ThinkChat.Messages />
109
+ * </ThinkChat.Root>
110
+ * </QueryClientProvider>
111
+ * ```
112
+ */
113
+ declare function ThinkChatRoot<State = unknown, MessageT extends UIMessage = UIMessage>({
114
+ agent: agentOption,
115
+ approvalsEnabled,
116
+ name,
117
+ sourceKey,
118
+ children
119
+ }: ThinkChatRootProps<State>): React.JSX.Element;
120
+ /**
121
+ * The full conversation surface — message list plus composer — with the
122
+ * activity renderer as the default `renderPart`: runs of reasoning/tool parts
123
+ * fold into one collapsed Activity block with derived labels and per-tool
124
+ * panels. Session-generated context/load/search tools are recognized from
125
+ * their upstream runtime schemas and keep their recorded inputs and outputs
126
+ * inspectable. Extend for app-specific tools with `toolRenderers` (label/panel
127
+ * inside the log) or `excludeTools` + your own `renderPart` (standalone
128
+ * card) — see README "App-specific tools" and the Custom Tool Panel story.
129
+ */
130
+ declare function ThinkChatMessages<State = unknown, MessageT extends UIMessage = UIMessage>({
131
+ draft,
132
+ loading,
133
+ renderPart,
134
+ excludeTools,
135
+ renderAgentToolRunLink,
136
+ renderWorkspaceFile,
137
+ toolRenderers,
138
+ thinkStub,
139
+ onExecutionSettled,
140
+ pendingApprovals,
141
+ notice,
142
+ sessionCompaction,
143
+ ...props
144
+ }: ThinkChatMessagesProps<MessageT>): React.JSX.Element;
145
+ /**
146
+ * The ambient chat value from `ThinkChat.Root`/`Provider` — for custom tool
147
+ * panels, cards, or composer actions that need `messages`, `status`, or
148
+ * `sendMessage`. Throws outside a provider.
149
+ */
150
+ declare function useThinkChat<State = unknown, MessageT extends UIMessage = UIMessage>(): Omit<import("@ai-sdk/react").UseChatHelpers<MessageT>, "addToolOutput"> & {
151
+ clearHistory: () => void;
152
+ addToolOutput: (opts: {
153
+ toolCallId: string;
154
+ toolName?: string;
155
+ output?: unknown;
156
+ state?: "output-available" | "output-error";
157
+ errorText?: string;
158
+ }) => void;
159
+ isServerStreaming: boolean;
160
+ isStreaming: boolean;
161
+ isRecovering: boolean;
162
+ isToolContinuation: boolean;
163
+ connectionError: (Error & {
164
+ code: number;
165
+ reason: string;
166
+ wasClean: boolean;
167
+ }) | null;
168
+ };
169
+ /**
170
+ * Namespace entry point. `Root` + `Messages` is the standard surface;
171
+ * `Provider` + `useThinkChat` when the app owns the chat hook; `Activity`,
172
+ * `renderActivityPart`, and `createActivityRenderer` for custom layouts and
173
+ * app-specific tools.
174
+ */
175
+ declare const ThinkChat: {
176
+ Provider: typeof ThinkChatProvider;
177
+ Root: typeof ThinkChatRoot;
178
+ Messages: typeof ThinkChatMessages;
179
+ Activity: typeof ThinkChatActivity;
180
+ RecoveryNotice: typeof ThinkRecoveryNotice;
181
+ renderActivityPart: (context: AgentMessageRenderPartContext<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>) => React.ReactNode | undefined;
182
+ createActivityRenderer: typeof createThinkChatActivityRenderer;
183
+ };
184
+ //#endregion
185
+ export { ThinkChatProvider as a, ThinkChatRootProps as c, thinkPendingExecutionApprovalsQueryOptions as d, useThinkChat as f, ThinkChatMessagesProps as i, ThinkPendingExecutionApprovalsQueryKey as l, ThinkChatDraft as n, ThinkChatProviderProps as o, useThinkPendingExecutionApprovals as p, ThinkChatMessages as r, ThinkChatRoot as s, ThinkChat as t, ThinkPendingExecutionApprovalsQueryOptions as u };
@@ -1,16 +1,16 @@
1
1
  import { composerDraftToPrompt, parseComposerLinks } from "./utils/composer-link.js";
2
- import { TransitionSurface } from "./components/foundations/TransitionSurface.js";
3
2
  import { AgentToolRunsProvider, useSourceScopedAgentToolEvents } from "./components/agents-sdk/AgentToolRunsContext.js";
3
+ import { TransitionSurface } from "./components/foundations/TransitionSurface.js";
4
4
  import { AgentChat, compactingNotice } from "./components/agents-sdk/AgentChat.js";
5
5
  import { ThinkChatContext, ThinkChatLiveContext, useOptionalThinkChatContext, useThinkChatContext } from "./components/agents-sdk/ThinkChatContext.js";
6
6
  import { ThinkChatActivity, createThinkChatActivityRenderer, renderThinkChatActivityPart } from "./components/agents-sdk/ThinkChatActivity.js";
7
7
  import { ThinkRecoveryNotice } from "./components/agents-sdk/ThinkRecoveryNotice.js";
8
- import { t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-CJCmGvTx.js";
8
+ import { n as WorkspaceMessageResponse, t as WorkspaceFileRendererProvider } from "./WorkspaceMessageResponse-Dg_aNpoj.js";
9
9
  import * as React from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { isTextUIPart } from "ai";
12
- import { useAgentChat } from "@cloudflare/think/react";
13
12
  import { useAgent } from "agents/react";
13
+ import { useAgentChat } from "@cloudflare/think/react";
14
14
  import { queryOptions, useQuery, useQueryClient } from "@tanstack/react-query";
15
15
  //#region src/components/_internal/think-approvals.ts
16
16
  /**
@@ -195,7 +195,7 @@ const ThinkChatApprovalsContext = React.createContext(null);
195
195
  * inside the log) or `excludeTools` + your own `renderPart` (standalone
196
196
  * card) — see README "App-specific tools" and the Custom Tool Panel story.
197
197
  */
198
- function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAgentToolRunLink, renderWorkspaceHtmlArtifact, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, sessionCompaction, ...props }) {
198
+ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAgentToolRunLink, renderWorkspaceFile, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, sessionCompaction, ...props }) {
199
199
  const chat = useOptionalThinkChatContext();
200
200
  const approvals = React.useContext(ThinkChatApprovalsContext);
201
201
  const resolvedApprovals = resolveThinkApprovalProps({
@@ -223,14 +223,10 @@ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAge
223
223
  return isTextUIPart(context.part) && context.part.text ? /* @__PURE__ */ jsx(WorkspaceMessageResponse, {
224
224
  animated: STREAMED_TEXT_ANIMATION,
225
225
  isAnimating: context.message.role === "assistant" && context.message.id === streamingMessageId && context.part.state === "streaming",
226
- renderWorkspaceHtmlArtifact: context.message.role === "assistant" ? renderWorkspaceHtmlArtifact : void 0,
226
+ promoteWorkspaceFiles: context.message.role === "assistant",
227
227
  children: context.part.text
228
228
  }) : void 0;
229
- }, [
230
- activityRenderPart,
231
- renderWorkspaceHtmlArtifact,
232
- streamingMessageId
233
- ]);
229
+ }, [activityRenderPart, streamingMessageId]);
234
230
  const resolvedRenderPart = React.useMemo(() => renderPart ? (context) => {
235
231
  const renderBuiltIn = () => {
236
232
  const builtIn = defaultRenderPart(context);
@@ -269,7 +265,11 @@ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAge
269
265
  files
270
266
  });
271
267
  };
272
- if (loading) return /* @__PURE__ */ jsx(AgentChat, {
268
+ const withWorkspaceFileRenderer = (lane) => /* @__PURE__ */ jsx(WorkspaceFileRendererProvider, {
269
+ renderWorkspaceFile,
270
+ children: lane
271
+ });
272
+ if (loading) return withWorkspaceFileRenderer(/* @__PURE__ */ jsx(AgentChat, {
273
273
  showComposer: true,
274
274
  ...props,
275
275
  renderPart: resolvedRenderPart,
@@ -277,19 +277,19 @@ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAge
277
277
  status: "ready",
278
278
  notice,
279
279
  loading: true
280
- });
280
+ }));
281
281
  if (!chat) {
282
282
  if (!draft) throw new Error("ThinkChat.Messages must be used inside <ThinkChat.Provider> or <ThinkChat.Root>, or given a `draft`, or set `loading` while one hydrates.");
283
- return /* @__PURE__ */ jsx(AgentChat, {
283
+ return withWorkspaceFileRenderer(/* @__PURE__ */ jsx(AgentChat, {
284
284
  ...props,
285
285
  renderPart: resolvedRenderPart,
286
286
  messages: draft.messages ?? EMPTY_DRAFT_MESSAGES,
287
287
  status: draft.status ?? "ready",
288
288
  notice: notice ?? sessionCompactionNotice,
289
289
  onSubmit: (message) => submit(message, draft.onSubmit)
290
- });
290
+ }));
291
291
  }
292
- return /* @__PURE__ */ jsx(AgentChat, {
292
+ return withWorkspaceFileRenderer(/* @__PURE__ */ jsx(AgentChat, {
293
293
  ...props,
294
294
  renderPart: resolvedRenderPart,
295
295
  messages: chat.messages,
@@ -302,7 +302,7 @@ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAge
302
302
  notice: notice ?? (recoveryActive ? defaultNotice : sessionCompactionNotice),
303
303
  onRegenerate: (messageId) => void chat.regenerate({ messageId }),
304
304
  onSubmit: (message) => submit(message, chat.sendMessage)
305
- });
305
+ }));
306
306
  }
307
307
  const EMPTY_DRAFT_MESSAGES = [];
308
308
  /**
@@ -0,0 +1,91 @@
1
+ import * as React from "react";
2
+
3
+ //#region src/components/agents-sdk/ThinkThreadPicker.d.ts
4
+ interface ThinkThreadItem {
5
+ /** Stable child-agent/thread id used by the app-authored link's route params. */
6
+ id: string;
7
+ /** Human-readable thread title, usually generated by the parent Think agent. */
8
+ title: string;
9
+ /** Optional parent-owned preview for apps that render their own richer sidebar. */
10
+ lastMessagePreview?: string;
11
+ /** Timestamp from the parent registry or metadata row. `updatedAt` wins over `createdAt`. */
12
+ createdAt?: Date | number;
13
+ /** Timestamp from parent-owned thread metadata when available. */
14
+ updatedAt?: Date | number;
15
+ /** Preformatted timestamp label when the app already has one, such as "14m". */
16
+ updatedAtLabel?: string;
17
+ /** Optional upstream/app status string. The picker only displays it; it does not derive it. */
18
+ status?: string;
19
+ /** Human label for `status` when the raw upstream value is not user-facing. */
20
+ statusLabel?: string;
21
+ }
22
+ interface ThinkThreadStatusSummary {
23
+ /** Threads currently processing a turn. */
24
+ running: number;
25
+ /** Completed or interrupted background threads that have not been reviewed. */
26
+ attention: number;
27
+ /** Threads whose latest turn failed. */
28
+ failed: number;
29
+ }
30
+ interface ThinkThreadStatusIndicatorsProps {
31
+ summary: ThinkThreadStatusSummary;
32
+ className?: string;
33
+ }
34
+ interface ThinkThreadPickerProps extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect" | "title"> {
35
+ /** Threads from the parent agent, already sorted in the order the app wants to show. */
36
+ threads: readonly ThinkThreadItem[];
37
+ /**
38
+ * Renders the application-owned TanStack Router Link for a thread.
39
+ *
40
+ * Put `to`, `params`, `search`, and active state on this element so they stay
41
+ * inferred from the consuming application's registered route tree.
42
+ */
43
+ renderThreadLink: (thread: ThinkThreadItem) => React.ReactElement;
44
+ /**
45
+ * App-authored TanStack Router Link to the new-thread screen. A thread
46
+ * created on click is an empty thread until someone writes in it.
47
+ */
48
+ createThreadLink?: React.ReactElement;
49
+ /**
50
+ * Notified on unmodified primary activation. The link still navigates — the
51
+ * route is the selection — so this is for side effects such as closing a
52
+ * compact drawer, never for performing the selection itself.
53
+ */
54
+ onSelect?: (thread: ThinkThreadItem) => void;
55
+ /** Optional parent-agent delete action, usually `parent.stub.deleteThread(thread.id)`. */
56
+ onDelete?: (thread: ThinkThreadItem) => void | Promise<void>;
57
+ /** Visible heading for the roster. */
58
+ title?: React.ReactNode;
59
+ /** Accessible label for the list navigation. */
60
+ "aria-label"?: string;
61
+ }
62
+ declare function summarizeThinkThreads(threads: readonly Pick<ThinkThreadItem, "status">[]): ThinkThreadStatusSummary;
63
+ declare function ThinkThreadStatusIndicators({
64
+ summary,
65
+ className
66
+ }: ThinkThreadStatusIndicatorsProps): React.JSX.Element | null;
67
+ /**
68
+ * Thread roster UI for sub-agent chat apps.
69
+ *
70
+ * This component does not call Think or Cloudflare RPC methods directly. Feed
71
+ * it from the parent agent's roster method, then render app-owned route links
72
+ * that select the child `useAgent({ sub: [...] })` name. Keep backend contract
73
+ * notes beside the parent Think agent because
74
+ * `listThreads()`/`createThread()`/`deleteThread()` are app-owned.
75
+ */
76
+ declare function ThinkThreadPicker({
77
+ threads,
78
+ renderThreadLink,
79
+ createThreadLink,
80
+ onSelect,
81
+ onDelete,
82
+ className,
83
+ title,
84
+ "aria-label": ariaLabel,
85
+ ref,
86
+ ...props
87
+ }: ThinkThreadPickerProps & {
88
+ ref?: React.Ref<HTMLElement>;
89
+ }): React.JSX.Element;
90
+ //#endregion
91
+ export { ThinkThreadStatusIndicatorsProps as a, ThinkThreadStatusIndicators as i, ThinkThreadPicker as n, ThinkThreadStatusSummary as o, ThinkThreadPickerProps as r, summarizeThinkThreads as s, ThinkThreadItem as t };
@@ -136,4 +136,4 @@ declare function useWorkspace({
136
136
  maxInlineAssetBytes
137
137
  }: UseWorkspaceOptions): WorkspaceState;
138
138
  //#endregion
139
- export { workspaceQueryKey as A, workspaceBinaryFileQueryOptions as C, workspaceFileAssetQueryOptions as D, workspaceDirectoryQueryPrefix as E, workspaceFileStatQueryOptions as O, useWorkspace as S, workspaceDirectoryQueryOptions as T, WorkspaceResolvedAsset as _, WorkspaceDirectoryQueryOptions as a, WorkspaceTextFileQueryKey as b, WorkspaceFileQueryKey as c, WorkspaceFileStatQueryOptions as d, WorkspaceFileVersion as f, WorkspaceQueryKey as g, WorkspaceInfoQueryOptions as h, WorkspaceDirectoryQueryKey as i, workspaceTextFileQueryOptions as j, workspaceInfoQueryOptions as k, WorkspaceFileReadTarget as l, WorkspaceInfoQueryKey as m, WorkspaceBinaryFileQueryKey as n, WorkspaceFileAssetQueryKey as o, WorkspaceInfo as p, WorkspaceBinaryFileQueryOptions as r, WorkspaceFileAssetQueryOptions as s, UseWorkspaceOptions as t, WorkspaceFileStatQueryKey as u, WorkspaceSource as v, workspaceDirectoryQueryKey as w, WorkspaceTextFileQueryOptions as x, WorkspaceState as y };
139
+ export { workspaceInfoQueryOptions as A, useWorkspace as C, workspaceDirectoryQueryPrefix as D, workspaceDirectoryQueryOptions as E, workspaceTextFileQueryOptions as M, workspaceFileAssetQueryOptions as O, WorkspaceTextFileQueryOptions as S, workspaceDirectoryQueryKey as T, WorkspaceQueryOptions as _, WorkspaceDirectoryQueryOptions as a, WorkspaceState as b, WorkspaceFileQueryKey as c, WorkspaceFileStatQueryOptions as d, WorkspaceFileVersion as f, WorkspaceQueryKey as g, WorkspaceInfoQueryOptions as h, WorkspaceDirectoryQueryKey as i, workspaceQueryKey as j, workspaceFileStatQueryOptions as k, WorkspaceFileReadTarget as l, WorkspaceInfoQueryKey as m, WorkspaceBinaryFileQueryKey as n, WorkspaceFileAssetQueryKey as o, WorkspaceInfo as p, WorkspaceBinaryFileQueryOptions as r, WorkspaceFileAssetQueryOptions as s, UseWorkspaceOptions as t, WorkspaceFileStatQueryKey as u, WorkspaceResolvedAsset as v, workspaceBinaryFileQueryOptions as w, WorkspaceTextFileQueryKey as x, WorkspaceSource as y };
@@ -1,10 +1,10 @@
1
- import { $ as WarningIcon, b as EyeIcon, d as CheckIcon, k as MaximizeIcon, m as CodeIcon, r as ArrowLeftIcon, v as DownloadIcon } from "./icons-BC4HZqSK.js";
1
+ import { b as EyeIcon, d as CheckIcon, et as WarningIcon, k as MaximizeIcon, m as CodeIcon, r as ArrowLeftIcon, v as DownloadIcon } from "./icons-cuEtsgj9.js";
2
2
  import { i as formatClock } from "./format-COCyV98Z.js";
3
- import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-CcteqDvA.js";
4
3
  import { AppTopBar } from "./components/general-purpose/AppTopBar.js";
4
+ import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-DMHZiw86.js";
5
5
  import { inferWorkspaceLanguage, inferWorkspaceMedia, isWorkspaceMarkdownPath, isWorkspaceSkillPath, parseWorkspaceSkill } from "./components/agents-sdk/WorkspaceFile.js";
6
- import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-DtH66bAY.js";
7
- import { n as createWorkspaceRehypePlugins, t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-CJCmGvTx.js";
6
+ import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-B1d2GIGl.js";
7
+ import { n as WorkspaceMessageResponse, r as createWorkspaceRehypePlugins } from "./WorkspaceMessageResponse-Dg_aNpoj.js";
8
8
  import { WorkspaceHeader } from "./components/agents-sdk/WorkspaceHeader.js";
9
9
  import * as React from "react";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -198,13 +198,18 @@ function resolveWorkspaceLink({ href, root, base }) {
198
198
  };
199
199
  }
200
200
  function WorkspaceNavigationProvider({ children, root, base, navigation }) {
201
+ const { kind: baseKind, path: basePath } = base;
201
202
  return /* @__PURE__ */ jsx(WorkspaceNavigationContext, {
202
203
  value: React.useMemo(() => ({
203
204
  root,
204
- base,
205
+ base: {
206
+ kind: baseKind,
207
+ path: basePath
208
+ },
205
209
  navigation
206
210
  }), [
207
- base,
211
+ baseKind,
212
+ basePath,
208
213
  navigation,
209
214
  root
210
215
  ]),
@@ -0,0 +1,49 @@
1
+ import { QueryClient } from "@tanstack/react-query";
2
+
3
+ //#region src/components/agents-sdk/WorkspaceLive.d.ts
4
+ type WorkspaceChange = {
5
+ type: "changed";
6
+ path: string;
7
+ movedFrom?: string;
8
+ } | {
9
+ type: "unknown";
10
+ };
11
+ /** Host adapter for a native workspace observer. */
12
+ interface WorkspaceChangeSource {
13
+ start?(): void | Promise<void>;
14
+ subscribe(listener: (change: WorkspaceChange) => void): () => void;
15
+ }
16
+ declare function invalidateWorkspaceDirectories(queryClient: QueryClient, sourceKey: string, directories: Iterable<string>, root: string): void;
17
+ interface UseWorkspaceLiveQueriesOptions {
18
+ /** Native observer adapter. Omit for hosts without workspace observation. */
19
+ changes?: WorkspaceChangeSource;
20
+ sourceKey: string | undefined;
21
+ /**
22
+ * The host's workspace boundary. Required, and the same value the concept
23
+ * options were built with: invalidation is prefix-matched on it, so a root
24
+ * that disagrees with the queries silently invalidates nothing.
25
+ */
26
+ root: string;
27
+ /**
28
+ * Disposable freshness tick for hosts without native observation — for
29
+ * example a serialization of settled-turn state. Every change of a defined
30
+ * value invalidates the source's concept queries. It never enters query
31
+ * identity, so data, mutation state, and form drafts survive the refresh.
32
+ */
33
+ revision?: string;
34
+ }
35
+ /**
36
+ * Synchronize external workspace freshness with the design system's Query
37
+ * resources. This is the one external-system effect: native observer events
38
+ * and host revision ticks both land here as targeted invalidation against
39
+ * stable query keys. Hosts only supply events; neither layer adds another
40
+ * watcher.
41
+ */
42
+ declare function useWorkspaceLiveQueries({
43
+ changes,
44
+ sourceKey,
45
+ root,
46
+ revision
47
+ }: UseWorkspaceLiveQueriesOptions): void;
48
+ //#endregion
49
+ export { useWorkspaceLiveQueries as a, invalidateWorkspaceDirectories as i, WorkspaceChange as n, WorkspaceChangeSource as r, UseWorkspaceLiveQueriesOptions as t };
@@ -1,7 +1,7 @@
1
1
  import { MessageResponse } from "./components/ai-sdk/Message.js";
2
- import { c as useWorkspaceNavigationContext, r as resolveWorkspaceLink, t as WorkspaceFileLink } from "./WorkspaceLink-DtH66bAY.js";
2
+ import { c as useWorkspaceNavigationContext, r as resolveWorkspaceLink, t as WorkspaceFileLink } from "./WorkspaceLink-B1d2GIGl.js";
3
3
  import * as React from "react";
4
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { defaultRehypePlugins } from "streamdown";
6
6
  import { visit } from "unist-util-visit";
7
7
  //#region src/components/_internal/workspace-markdown.ts
@@ -79,49 +79,85 @@ function createWorkspaceRehypePlugins(root, base) {
79
79
  }
80
80
  //#endregion
81
81
  //#region src/components/agents-sdk/WorkspaceMessageResponse.tsx
82
+ const WorkspaceFileRendererContext = React.createContext(null);
83
+ /**
84
+ * Ambient workspace-file renderer for every `WorkspaceMessageResponse` below,
85
+ * and the only way to supply one. The value is read inside the promoted
86
+ * paragraph, not by the response component, so a host handing down a fresh
87
+ * callback every render re-renders only the paragraphs — the memoized Markdown
88
+ * pipeline is untouched and promoted cards keep their state.
89
+ * `ThinkChat.Messages` provides it from its `renderWorkspaceFile` prop; hosts
90
+ * composing `WorkspaceMessageResponse` directly provide it once at their
91
+ * conversation root.
92
+ */
93
+ function WorkspaceFileRendererProvider({ children, renderWorkspaceFile }) {
94
+ return /* @__PURE__ */ jsx(WorkspaceFileRendererContext.Provider, {
95
+ value: renderWorkspaceFile ?? null,
96
+ children
97
+ });
98
+ }
99
+ /**
100
+ * The paragraph the promoted one falls back to — the caller's `components.p`
101
+ * where it gave one, otherwise a plain `<p>`. It travels by context so the
102
+ * promoted paragraph can be a module-scope component with a constant identity:
103
+ * defining it inside a memo made every context change a new element type, and
104
+ * React remounted every promoted card, discarding its draft and sent latch.
105
+ */
106
+ const FallbackParagraphContext = React.createContext("p");
82
107
  const workspaceComponents = {
83
108
  img: "img",
84
109
  a: WorkspaceFileLink
85
110
  };
111
+ function WorkspaceFileParagraph({ node, children, ...paragraphProps }) {
112
+ const workspace = useWorkspaceNavigationContext();
113
+ const renderFile = React.useContext(WorkspaceFileRendererContext);
114
+ const FallbackParagraph = React.useContext(FallbackParagraphContext);
115
+ const renderFallbackParagraph = (content) => React.createElement(FallbackParagraph, typeof FallbackParagraph === "string" ? paragraphProps : {
116
+ node,
117
+ ...paragraphProps
118
+ }, content);
119
+ if (!workspace || !renderFile) return renderFallbackParagraph(children);
120
+ const file = getStandaloneWorkspaceFileParagraph(node, workspace.root, workspace.base);
121
+ if (!file) return renderFallbackParagraph(children);
122
+ const promoted = renderFile({
123
+ label: file.label,
124
+ path: file.path,
125
+ sourceLink: /* @__PURE__ */ jsx(WorkspaceFileLink, { href: file.path })
126
+ });
127
+ if (promoted == null) return renderFallbackParagraph(children);
128
+ const remainingChildren = React.Children.toArray(children).filter((_child, index) => index !== file.childIndex);
129
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [file.showRemainingChildren ? renderFallbackParagraph(remainingChildren) : null, promoted] }, file.path);
130
+ }
86
131
  /** Adds workspace-aware Markdown links when rendered inside a workspace provider. */
87
- const WorkspaceMessageResponse = React.memo(function WorkspaceMessageResponse({ components, rehypePlugins, renderWorkspaceHtmlArtifact, ...props }) {
132
+ const WorkspaceMessageResponse = React.memo(function WorkspaceMessageResponse({ components, rehypePlugins, promoteWorkspaceFiles = true, ...props }) {
88
133
  const workspace = useWorkspaceNavigationContext();
89
- const resolvedRehypePlugins = React.useMemo(() => rehypePlugins ?? (workspace ? createWorkspaceRehypePlugins(workspace.root, workspace.base) : void 0), [rehypePlugins, workspace]);
90
- return /* @__PURE__ */ jsx(MessageResponse, {
91
- components: React.useMemo(() => {
92
- const merged = components ? {
93
- ...workspaceComponents,
94
- ...components
95
- } : workspaceComponents;
96
- if (!workspace || !renderWorkspaceHtmlArtifact) return merged;
97
- const FallbackParagraph = components?.p ?? "p";
98
- return {
99
- ...merged,
100
- p: function WorkspaceHtmlArtifactParagraph({ node, children, ...paragraphProps }) {
101
- const renderFallbackParagraph = (content) => React.createElement(FallbackParagraph, typeof FallbackParagraph === "string" ? paragraphProps : {
102
- node,
103
- ...paragraphProps
104
- }, content);
105
- const artifact = getWorkspaceHtmlArtifactParagraph(node, workspace.root, workspace.base);
106
- if (!artifact) return renderFallbackParagraph(children);
107
- const remainingChildren = React.Children.toArray(children).filter((_child, index) => index !== artifact.childIndex);
108
- return /* @__PURE__ */ jsxs(Fragment, { children: [artifact.showRemainingChildren ? renderFallbackParagraph(remainingChildren) : null, renderWorkspaceHtmlArtifact({
109
- label: artifact.label,
110
- path: artifact.path,
111
- sourceLink: /* @__PURE__ */ jsx(WorkspaceFileLink, { href: artifact.path })
112
- })] });
113
- }
114
- };
115
- }, [
116
- components,
117
- renderWorkspaceHtmlArtifact,
118
- workspace
119
- ]),
120
- rehypePlugins: resolvedRehypePlugins,
121
- ...props
134
+ const workspaceRoot = workspace?.root;
135
+ const workspaceBase = workspace?.base;
136
+ const resolvedRehypePlugins = React.useMemo(() => rehypePlugins ?? (workspaceRoot !== void 0 && workspaceBase !== void 0 ? createWorkspaceRehypePlugins(workspaceRoot, workspaceBase) : void 0), [
137
+ rehypePlugins,
138
+ workspaceBase,
139
+ workspaceRoot
140
+ ]);
141
+ const resolvedComponents = React.useMemo(() => {
142
+ const merged = components ? {
143
+ ...workspaceComponents,
144
+ ...components
145
+ } : workspaceComponents;
146
+ return promoteWorkspaceFiles ? {
147
+ ...merged,
148
+ p: WorkspaceFileParagraph
149
+ } : merged;
150
+ }, [components, promoteWorkspaceFiles]);
151
+ return /* @__PURE__ */ jsx(FallbackParagraphContext, {
152
+ value: components?.p ?? "p",
153
+ children: /* @__PURE__ */ jsx(MessageResponse, {
154
+ components: resolvedComponents,
155
+ rehypePlugins: resolvedRehypePlugins,
156
+ ...props
157
+ })
122
158
  });
123
159
  });
124
- function getWorkspaceHtmlArtifactParagraph(node, root, base) {
160
+ function getStandaloneWorkspaceFileParagraph(node, root, base) {
125
161
  if (!node || node.tagName !== "p") return null;
126
162
  const children = node.children;
127
163
  const matches = children.flatMap((child, childIndex) => {
@@ -133,7 +169,7 @@ function getWorkspaceHtmlArtifactParagraph(node, root, base) {
133
169
  root,
134
170
  base
135
171
  });
136
- if (destination.kind !== "file" || destination.fragment !== null || !destination.path.toLowerCase().endsWith(".html")) return [];
172
+ if (destination.kind !== "file" || destination.fragment !== null) return [];
137
173
  return [{
138
174
  anchor: child,
139
175
  childIndex,
@@ -145,7 +181,7 @@ function getWorkspaceHtmlArtifactParagraph(node, root, base) {
145
181
  return {
146
182
  childIndex,
147
183
  path,
148
- label: markdownText(anchor).trim() || path.split("/").at(-1) || "Interactive UI",
184
+ label: markdownText(anchor).trim() || path.split("/").at(-1) || "Workspace file",
149
185
  showRemainingChildren: children.some((child, index) => index !== childIndex && (child.type !== "text" || child.value.trim()))
150
186
  };
151
187
  }
@@ -154,4 +190,4 @@ function markdownText(node) {
154
190
  return node.type === "element" ? node.children.map(markdownText).join("") : "";
155
191
  }
156
192
  //#endregion
157
- export { createWorkspaceRehypePlugins as n, WorkspaceMessageResponse as t };
193
+ export { WorkspaceMessageResponse as n, createWorkspaceRehypePlugins as r, WorkspaceFileRendererProvider as t };