@mcp-b/react-components 0.14.1 → 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.
Files changed (241) hide show
  1. package/dist/AgentActivity-BNUNrP9O.d.ts +36 -0
  2. package/dist/{AgentChat-Cgb1xuT7.d.ts → AgentChat-CrlpbvQJ.d.ts} +62 -8
  3. package/dist/{CodeBlock-DUh9WOGo.d.ts → CodeBlock-BRajW4QU.d.ts} +1 -1
  4. package/dist/{CodeBlock-BUFXG8HW.js → CodeBlock-BmB4Xaqq.js} +15 -4
  5. package/dist/{FileTree-mpEIcfzA.js → FileTree-CkVbIMWV.js} +82 -89
  6. package/dist/Message-BkMdE3bS.js +375 -0
  7. package/dist/{ModelSelector-DVgVBdvw.js → ModelSelector-SlJNgwKY.js} +17 -8
  8. package/dist/{PromptInput-ClNqBiIw.d.ts → PromptInput-BWTuXMOD.d.ts} +123 -5
  9. package/dist/ResponsiveSidebarShell-Dd9DCcBT.d.ts +67 -0
  10. package/dist/{Select-Dl_vF_Bt.d.ts → Select-BeEsefzh.d.ts} +12 -2
  11. package/dist/{ThinkChat-7DQ2CogF.js → ThinkChat-CzC-zNGA.js} +27 -37
  12. package/dist/{ThinkChatActivity-m9orbdeI.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
  13. package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
  14. package/dist/{ThinkChatToolParts-Cv4o7j6F.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +62 -3
  15. package/dist/ThinkExecutionRun-ChhWhOoU.d.ts +30 -0
  16. package/dist/Toggle-CAAlNl-M.d.ts +69 -0
  17. package/dist/ToggleGroup-8hPv-b69.d.ts +73 -0
  18. package/dist/Workspace-D39LxGvP.d.ts +62 -0
  19. package/dist/WorkspaceFile-DOZkPwzu.d.ts +106 -0
  20. package/dist/WorkspaceFileView-rSN_yT0L.js +744 -0
  21. package/dist/WorkspaceLink-DIPbXrUM.js +337 -0
  22. package/dist/WorkspaceLink-DK1DWMHe.d.ts +89 -0
  23. package/dist/components/Activity.d.ts +27 -1
  24. package/dist/components/Activity.js +33 -15
  25. package/dist/components/AgentActivity.d.ts +2 -0
  26. package/dist/components/AgentActivity.js +45 -0
  27. package/dist/components/AgentActivityPreview.d.ts +46 -0
  28. package/dist/components/AgentActivityPreview.js +94 -0
  29. package/dist/components/AgentAttention.d.ts +73 -0
  30. package/dist/components/AgentAttention.js +85 -0
  31. package/dist/components/AgentChat.d.ts +2 -2
  32. package/dist/components/AgentChat.js +231 -205
  33. package/dist/components/AgentChatMessageEditor.d.ts +29 -0
  34. package/dist/components/AgentChatMessageEditor.js +92 -0
  35. package/dist/components/AgentChatTurnError.d.ts +17 -0
  36. package/dist/components/AgentChatTurnError.js +40 -0
  37. package/dist/components/AgentConnection.d.ts +12 -17
  38. package/dist/components/AgentConnection.js +99 -91
  39. package/dist/components/AppFrame.d.ts +24 -0
  40. package/dist/components/AppFrame.js +25 -0
  41. package/dist/components/AppTopBar.d.ts +71 -0
  42. package/dist/components/AppTopBar.js +82 -0
  43. package/dist/components/Artifact.js +1 -1
  44. package/dist/components/BrowserLiveView.js +1 -1
  45. package/dist/components/BrowserReplay.js +1 -1
  46. package/dist/components/BrowserRunPanel.js +1 -1
  47. package/dist/components/Card.d.ts +3 -0
  48. package/dist/components/Card.js +2 -1
  49. package/dist/components/ChainOfThought.d.ts +1 -1
  50. package/dist/components/ChainOfThought.js +1 -1
  51. package/dist/components/ChatGptSignInScreen.js +2 -2
  52. package/dist/components/Checkbox.js +5 -13
  53. package/dist/components/CheckboxGroup.d.ts +58 -2
  54. package/dist/components/CheckboxGroup.js +59 -1
  55. package/dist/components/CodeBlock.d.ts +1 -1
  56. package/dist/components/CodeBlock.js +1 -1
  57. package/dist/components/CodexModelSelector.js +1 -1
  58. package/dist/components/Commit.js +2 -2
  59. package/dist/components/ContextMenu.js +1 -1
  60. package/dist/components/Conversation.js +1 -1
  61. package/dist/components/DescriptionList.d.ts +12 -0
  62. package/dist/components/DescriptionList.js +11 -0
  63. package/dist/components/DescriptionListParts.d.ts +37 -0
  64. package/dist/components/DescriptionListParts.js +35 -0
  65. package/dist/components/EnvironmentVariables.js +2 -2
  66. package/dist/components/Fieldset.d.ts +13 -1
  67. package/dist/components/Fieldset.js +11 -2
  68. package/dist/components/FileTree.js +1 -1
  69. package/dist/components/IconButton.d.ts +33 -0
  70. package/dist/components/IconButton.js +27 -0
  71. package/dist/components/McpConnectionRequest.d.ts +44 -0
  72. package/dist/components/McpConnectionRequest.js +122 -0
  73. package/dist/components/McpServerPicker.d.ts +48 -23
  74. package/dist/components/McpServerPicker.js +238 -189
  75. package/dist/components/Menubar.js +1 -1
  76. package/dist/components/Message.d.ts +1 -0
  77. package/dist/components/Message.js +1 -285
  78. package/dist/components/MessageScroller.js +1 -1
  79. package/dist/components/ModelSelector.d.ts +15 -3
  80. package/dist/components/ModelSelector.js +1 -1
  81. package/dist/components/NaniteScene.d.ts +10 -1
  82. package/dist/components/NaniteScene.js +36 -1
  83. package/dist/components/Pricing.d.ts +37 -0
  84. package/dist/components/Pricing.js +17 -0
  85. package/dist/components/PricingBillingToggle.d.ts +23 -0
  86. package/dist/components/PricingBillingToggle.js +86 -0
  87. package/dist/components/PricingConfirmationDialog.d.ts +25 -0
  88. package/dist/components/PricingConfirmationDialog.js +57 -0
  89. package/dist/components/PricingFAQ.d.ts +18 -0
  90. package/dist/components/PricingFAQ.js +27 -0
  91. package/dist/components/PricingPage.d.ts +2 -38
  92. package/dist/components/PricingPage.js +39 -359
  93. package/dist/components/PricingPlanCard.d.ts +22 -0
  94. package/dist/components/PricingPlanCard.js +109 -0
  95. package/dist/components/PricingUsageCalculator.d.ts +22 -0
  96. package/dist/components/PricingUsageCalculator.js +96 -0
  97. package/dist/components/PromptInput.d.ts +2 -2
  98. package/dist/components/PromptInput.js +210 -15
  99. package/dist/components/Queue.js +1 -1
  100. package/dist/components/Reasoning.d.ts +2 -1
  101. package/dist/components/Reasoning.js +14 -29
  102. package/dist/components/ResizableSidePanel.d.ts +57 -0
  103. package/dist/components/ResizableSidePanel.js +151 -0
  104. package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
  105. package/dist/components/ResponsiveSidebarShell.js +129 -0
  106. package/dist/components/Select.d.ts +2 -2
  107. package/dist/components/Select.js +11 -2
  108. package/dist/components/Slider.d.ts +13 -1
  109. package/dist/components/Slider.js +11 -0
  110. package/dist/components/Sources.js +1 -1
  111. package/dist/components/Stepper.d.ts +4 -0
  112. package/dist/components/Stepper.js +5 -3
  113. package/dist/components/SubagentRun.d.ts +86 -0
  114. package/dist/components/SubagentRun.js +108 -0
  115. package/dist/components/SubagentRunDetails.d.ts +44 -0
  116. package/dist/components/SubagentRunDetails.js +48 -0
  117. package/dist/components/SubagentRunIndicator.d.ts +22 -0
  118. package/dist/components/SubagentRunIndicator.js +33 -0
  119. package/dist/components/SubagentRunList.d.ts +25 -0
  120. package/dist/components/SubagentRunList.js +26 -0
  121. package/dist/components/SubagentRunSelector.d.ts +47 -0
  122. package/dist/components/SubagentRunSelector.js +55 -0
  123. package/dist/components/Task.js +1 -1
  124. package/dist/components/Terminal.js +2 -2
  125. package/dist/components/TestResults.js +1 -1
  126. package/dist/components/Textarea.d.ts +21 -0
  127. package/dist/components/Textarea.js +19 -0
  128. package/dist/components/ThemeModeControl.d.ts +24 -0
  129. package/dist/components/ThemeModeControl.js +52 -0
  130. package/dist/components/ThemeProvider.d.ts +38 -0
  131. package/dist/components/ThemeProvider.js +80 -0
  132. package/dist/components/ThinkChat.d.ts +34 -7
  133. package/dist/components/ThinkChat.js +7 -4
  134. package/dist/components/ThinkChatActivity.d.ts +3 -2
  135. package/dist/components/ThinkChatActivity.js +18 -297
  136. package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
  137. package/dist/components/ThinkChatActivitySummary.js +421 -0
  138. package/dist/components/ThinkChatToolPanels.d.ts +15 -5
  139. package/dist/components/ThinkChatToolPanels.js +116 -9
  140. package/dist/components/ThinkChatToolParts.d.ts +2 -2
  141. package/dist/components/ThinkChatToolParts.js +51 -9
  142. package/dist/components/ThinkExecutionDetail.d.ts +20 -0
  143. package/dist/components/ThinkExecutionDetail.js +80 -0
  144. package/dist/components/ThinkExecutionRun.d.ts +2 -0
  145. package/dist/components/ThinkExecutionRun.js +72 -0
  146. package/dist/components/ThinkExecutionStatus.d.ts +22 -0
  147. package/dist/components/ThinkExecutionStatus.js +36 -0
  148. package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
  149. package/dist/components/ThinkExecutionWorkbench.js +69 -225
  150. package/dist/components/ThinkFullApp.d.ts +58 -14
  151. package/dist/components/ThinkFullApp.js +129 -160
  152. package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
  153. package/dist/components/ThinkFullAppViewSwitch.js +34 -0
  154. package/dist/components/ThinkRoutine.d.ts +36 -0
  155. package/dist/components/ThinkRoutine.js +15 -0
  156. package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
  157. package/dist/components/ThinkRoutineBrowser.js +156 -0
  158. package/dist/components/ThinkRoutineDetail.d.ts +24 -0
  159. package/dist/components/ThinkRoutineDetail.js +102 -0
  160. package/dist/components/ThinkRoutineForm.d.ts +32 -0
  161. package/dist/components/ThinkRoutineForm.js +151 -0
  162. package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
  163. package/dist/components/ThinkRoutineLibrary.js +178 -0
  164. package/dist/components/ThinkRoutineRuns.d.ts +24 -0
  165. package/dist/components/ThinkRoutineRuns.js +68 -0
  166. package/dist/components/ThinkThreadPicker.d.ts +18 -1
  167. package/dist/components/ThinkThreadPicker.js +51 -5
  168. package/dist/components/ThinkThreadShell.d.ts +12 -9
  169. package/dist/components/ThinkThreadShell.js +17 -137
  170. package/dist/components/Toggle.d.ts +1 -68
  171. package/dist/components/ToggleGroup.d.ts +1 -72
  172. package/dist/components/Tooltip.d.ts +3 -1
  173. package/dist/components/Tooltip.js +4 -2
  174. package/dist/components/WebPreview.js +1 -1
  175. package/dist/components/Workspace.d.ts +2 -0
  176. package/dist/components/Workspace.js +424 -0
  177. package/dist/components/WorkspaceBrowser.d.ts +32 -0
  178. package/dist/components/WorkspaceBrowser.js +103 -0
  179. package/dist/components/WorkspaceExplorer.d.ts +12 -79
  180. package/dist/components/WorkspaceExplorer.js +116 -330
  181. package/dist/components/WorkspaceFile.d.ts +2 -0
  182. package/dist/components/WorkspaceFile.js +195 -0
  183. package/dist/components/WorkspaceFileView.d.ts +26 -0
  184. package/dist/components/WorkspaceFileView.js +2 -0
  185. package/dist/components/WorkspaceHeader.d.ts +35 -0
  186. package/dist/components/WorkspaceHeader.js +51 -0
  187. package/dist/components/WorkspaceLink.d.ts +2 -0
  188. package/dist/components/WorkspaceLink.js +2 -0
  189. package/dist/components/icons.d.ts +2 -2
  190. package/dist/components/icons.js +2 -2
  191. package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
  192. package/dist/icons-CpfUer49.js +85 -0
  193. package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
  194. package/dist/styles/activity-header.css +75 -0
  195. package/dist/styles/activity.css +49 -63
  196. package/dist/styles/agent-activity-preview-overlay.css +80 -0
  197. package/dist/styles/agent-activity-preview.css +235 -0
  198. package/dist/styles/agent-attention.css +122 -0
  199. package/dist/styles/agent-chat.css +141 -4
  200. package/dist/styles/app-frame.css +15 -0
  201. package/dist/styles/app-top-bar.css +100 -0
  202. package/dist/styles/avatar.css +0 -1
  203. package/dist/styles/browser-control-overlay.css +184 -0
  204. package/dist/styles/card.css +21 -0
  205. package/dist/styles/checkbox-group.css +69 -0
  206. package/dist/styles/description-list.css +50 -0
  207. package/dist/styles/fieldset.css +11 -0
  208. package/dist/styles/index.css +15 -2
  209. package/dist/styles/mcp-connection-request.css +60 -0
  210. package/dist/styles/mcp-server-picker.css +95 -68
  211. package/dist/styles/message.css +4 -43
  212. package/dist/styles/nanite-scene.css +16 -0
  213. package/dist/styles/pricing-page.css +21 -27
  214. package/dist/styles/prompt-input.css +225 -32
  215. package/dist/styles/reasoning.css +1 -55
  216. package/dist/styles/recipes.css +23 -15
  217. package/dist/styles/resizable-side-panel.css +66 -0
  218. package/dist/styles/responsive-sidebar-shell.css +169 -0
  219. package/dist/styles/select.css +10 -0
  220. package/dist/styles/stepper.css +13 -0
  221. package/dist/styles/streamdown.css +0 -4
  222. package/dist/styles/subagent-run.css +205 -0
  223. package/dist/styles/textarea.css +20 -0
  224. package/dist/styles/theme-mode-control.css +72 -0
  225. package/dist/styles/think-execution-status.css +49 -0
  226. package/dist/styles/think-execution-workbench.css +8 -72
  227. package/dist/styles/think-full-app.css +106 -131
  228. package/dist/styles/think-routine-library.css +491 -0
  229. package/dist/styles/think-thread-picker.css +47 -3
  230. package/dist/styles/toggle-group.css +7 -0
  231. package/dist/styles/workspace-explorer.css +511 -64
  232. package/dist/utils/codex-model-catalog.d.ts +4 -4
  233. package/dist/utils/mcp-server-catalog.d.ts +82 -78
  234. package/dist/utils/mcp-server-catalog.js +64 -41
  235. package/dist/utils/structured-code.d.ts +1 -1
  236. package/dist/utils/theme.d.ts +22 -0
  237. package/dist/utils/theme.js +55 -0
  238. package/package.json +34 -28
  239. package/dist/icons-Ba9THQKz.js +0 -64
  240. package/dist/styles/think-resize-handle.css +0 -33
  241. package/dist/styles/think-thread-shell.css +0 -219
@@ -3,6 +3,9 @@ import { Select } from "@base-ui/react/select";
3
3
 
4
4
  //#region src/components/Select.d.ts
5
5
  type SelectProps<Value = unknown> = Select.Root.Props<Value>;
6
+ interface SelectLabelProps extends Omit<Select.Label.Props, "className"> {
7
+ className?: string;
8
+ }
6
9
  interface SelectTriggerProps extends Omit<Select.Trigger.Props, "className"> {
7
10
  className?: string;
8
11
  /**
@@ -80,6 +83,13 @@ interface SelectScrollDownArrowProps extends Omit<Select.ScrollDownArrow.Props,
80
83
  * @see {@link https://base-ui.com/react/components/select | Base UI Select}
81
84
  */
82
85
  declare function SelectRoot<Value>(props: SelectProps<Value>): React.JSX.Element;
86
+ declare function SelectLabel({
87
+ className,
88
+ ref,
89
+ ...props
90
+ }: SelectLabelProps & {
91
+ ref?: React.Ref<HTMLDivElement>;
92
+ }): React.JSX.Element;
83
93
  declare function SelectTrigger({
84
94
  size,
85
95
  className,
@@ -190,7 +200,7 @@ declare function SelectScrollDownArrow({
190
200
  }): React.JSX.Element;
191
201
  declare const Select$1: {
192
202
  Root: typeof SelectRoot;
193
- Label: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
203
+ Label: typeof SelectLabel;
194
204
  Trigger: typeof SelectTrigger;
195
205
  Value: typeof SelectValue;
196
206
  Icon: typeof SelectIcon;
@@ -210,4 +220,4 @@ declare const Select$1: {
210
220
  ScrollDownArrow: typeof SelectScrollDownArrow;
211
221
  };
212
222
  //#endregion
213
- export { SelectTriggerProps as _, SelectIconProps as a, SelectItemTextProps as c, SelectPortalProps as d, SelectPositionerProps as f, SelectSeparatorProps as g, SelectScrollUpArrowProps as h, SelectGroupProps as i, SelectListProps as l, SelectScrollDownArrowProps as m, SelectBackdropProps as n, SelectItemIndicatorProps as o, SelectProps as p, SelectGroupLabelProps as r, SelectItemProps as s, Select$1 as t, SelectPopupProps as u, SelectValueProps as v };
223
+ export { SelectSeparatorProps as _, SelectIconProps as a, SelectItemTextProps as c, SelectPopupProps as d, SelectPortalProps as f, SelectScrollUpArrowProps as g, SelectScrollDownArrowProps as h, SelectGroupProps as i, SelectLabelProps as l, SelectProps as m, SelectBackdropProps as n, SelectItemIndicatorProps as o, SelectPositionerProps as p, SelectGroupLabelProps as r, SelectItemProps as s, Select$1 as t, SelectListProps as u, SelectTriggerProps as v, SelectValueProps as y };
@@ -1,5 +1,5 @@
1
- import { Button } from "./components/Button.js";
2
1
  import { AgentChat } from "./components/AgentChat.js";
2
+ import { AgentChatTurnError } from "./components/AgentChatTurnError.js";
3
3
  import { ThinkChatContext, useThinkChatContext } from "./components/ThinkChatContext.js";
4
4
  import { ThinkChatActivity, createThinkChatActivityRenderer, renderThinkChatActivityPart } from "./components/ThinkChatActivity.js";
5
5
  import * as React from "react";
@@ -119,7 +119,9 @@ const ThinkChatApprovalsContext = React.createContext(null);
119
119
  * The full conversation surface — message list plus composer — with the
120
120
  * activity renderer as the default `renderPart`: runs of reasoning/tool parts
121
121
  * fold into one collapsed Activity block with derived labels and per-tool
122
- * panels. Extend for app-specific tools with `toolRenderers` (label/panel
122
+ * panels. Session-generated context/load/search tools are recognized from
123
+ * their upstream runtime schemas and keep their recorded inputs and outputs
124
+ * inspectable. Extend for app-specific tools with `toolRenderers` (label/panel
123
125
  * inside the log) or `excludeTools` + your own `renderPart` (standalone
124
126
  * card) — see README "App-specific tools" and the Custom Tool Panel story.
125
127
  */
@@ -140,44 +142,32 @@ function ThinkChatMessages({ renderPart, excludeTools, toolRenderers, thinkStub,
140
142
  excludeTools,
141
143
  toolRenderers
142
144
  }), [excludeTools, toolRenderers]);
145
+ const resolvedRenderPart = React.useMemo(() => renderPart ? (context) => {
146
+ const renderBuiltIn = () => {
147
+ const builtIn = defaultRenderPart(context);
148
+ return builtIn === void 0 ? context.defaultRender() : builtIn;
149
+ };
150
+ const custom = renderPart({
151
+ ...context,
152
+ defaultRender: renderBuiltIn
153
+ });
154
+ return custom === void 0 ? renderBuiltIn() : custom;
155
+ } : defaultRenderPart, [defaultRenderPart, renderPart]);
143
156
  const retryMessageId = chat.error ? chat.messages.findLast((message) => message.role !== "system")?.id : void 0;
144
157
  const defaultNotice = chat.isRecovering ? /* @__PURE__ */ jsx(Fragment, { children: "Reconnecting to the agent…" }) : chat.connectionError ? /* @__PURE__ */ jsxs("span", {
145
158
  "data-tone": "danger",
146
159
  children: ["Connection lost", chat.connectionError.reason ? ` — ${chat.connectionError.reason}` : ""]
147
- }) : chat.error ? /* @__PURE__ */ jsxs("div", {
148
- className: "agent-chat__turn-error",
149
- "data-tone": "danger",
150
- children: [/* @__PURE__ */ jsxs("p", {
151
- className: "agent-chat__turn-error-message",
152
- children: [
153
- /* @__PURE__ */ jsx("strong", { children: "Response failed." }),
154
- " ",
155
- chat.error.message.trim() || "The response could not be completed."
156
- ]
157
- }), /* @__PURE__ */ jsxs("div", {
158
- className: "agent-chat__turn-error-actions",
159
- children: [/* @__PURE__ */ jsx(Button, {
160
- type: "button",
161
- variant: "ghost",
162
- color: "neutral",
163
- size: "lg",
164
- onClick: chat.clearError,
165
- children: "Dismiss"
166
- }), retryMessageId ? /* @__PURE__ */ jsx(Button, {
167
- type: "button",
168
- color: "primary",
169
- size: "lg",
170
- onClick: () => {
171
- chat.clearError();
172
- chat.regenerate({ messageId: retryMessageId });
173
- },
174
- children: "Try again"
175
- }) : null]
176
- })]
160
+ }) : chat.error ? /* @__PURE__ */ jsx(AgentChatTurnError, {
161
+ error: chat.error,
162
+ onDismiss: chat.clearError,
163
+ onRetry: retryMessageId ? () => {
164
+ chat.clearError();
165
+ chat.regenerate({ messageId: retryMessageId });
166
+ } : void 0
177
167
  }) : void 0;
178
168
  return /* @__PURE__ */ jsx(AgentChat, {
179
169
  ...props,
180
- renderPart: renderPart ?? defaultRenderPart,
170
+ renderPart: resolvedRenderPart,
181
171
  messages: chat.messages,
182
172
  status,
183
173
  onStop: chat.stop,
@@ -187,10 +177,10 @@ function ThinkChatMessages({ renderPart, excludeTools, toolRenderers, thinkStub,
187
177
  pendingApprovals: resolvedApprovals.pendingApprovals,
188
178
  notice: notice ?? defaultNotice,
189
179
  onRegenerate: (messageId) => void chat.regenerate({ messageId }),
190
- onSubmit: ({ text, files }) => {
191
- const trimmed = text.trim();
192
- if (trimmed || files.length) chat.sendMessage({
193
- text: trimmed,
180
+ onSubmit: ({ text, files, references }) => {
181
+ const prompt = [...references?.map(({ trigger, value }) => trigger ? `${trigger}${value}` : value) ?? [], text.trim()].filter(Boolean).join(" ");
182
+ if (prompt || files.length) return chat.sendMessage({
183
+ text: prompt,
194
184
  files
195
185
  });
196
186
  }
@@ -1,5 +1,5 @@
1
- import { a as AgentChatRenderPartContext, r as AgentChatProps } from "./AgentChat-Cgb1xuT7.js";
2
- import { s as ThinkChatPart } from "./ThinkChatToolParts-Cv4o7j6F.js";
1
+ import { i as AgentChatProps, o as AgentChatRenderPartContext } from "./AgentChat-CrlpbvQJ.js";
2
+ import { l as ThinkChatPart } from "./ThinkChatToolParts-CSzVwMXf.js";
3
3
  import * as React from "react";
4
4
  import { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai";
5
5
 
@@ -27,13 +27,6 @@ interface ThinkChatActivityRendererOptions {
27
27
  /** Per-tool label/panel overrides inside the activity log, keyed by tool name. */
28
28
  toolRenderers?: ThinkChatToolRenderers;
29
29
  }
30
- /**
31
- * One-line natural-language label for an activity part ("Ran vp test",
32
- * "Fetched developers.cloudflare.com/agents/"); `null` for boundaries that
33
- * aren't steps (step-start). Exported so a custom `renderPart` can reuse the
34
- * built-in labels for tools it doesn't override.
35
- */
36
- declare function describeThinkChatActivityPart(part: ThinkChatPart, toolRenderers?: ThinkChatToolRenderers): string | null;
37
30
  interface ThinkChatActivityProps {
38
31
  /** Render with the log expanded. */
39
32
  defaultOpen?: boolean;
@@ -70,4 +63,4 @@ declare function createThinkChatActivityRenderer<MessageT extends UIMessage = UI
70
63
  /** Default activity renderer — `createThinkChatActivityRenderer()` with no overrides. */
71
64
  declare const renderThinkChatActivityPart: (context: AgentChatRenderPartContext<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>) => React.ReactNode | undefined;
72
65
  //#endregion
73
- export { ThinkChatToolRenderers as a, renderThinkChatActivityPart as c, ThinkChatToolRenderer as i, ThinkChatActivityProps as n, createThinkChatActivityRenderer as o, ThinkChatActivityRendererOptions as r, describeThinkChatActivityPart as s, ThinkChatActivity as t };
66
+ export { ThinkChatToolRenderers as a, ThinkChatToolRenderer as i, ThinkChatActivityProps as n, createThinkChatActivityRenderer as o, ThinkChatActivityRendererOptions as r, renderThinkChatActivityPart as s, ThinkChatActivity as t };
@@ -0,0 +1,39 @@
1
+ import { i as AgentActivityIconKind, s as AgentActivitySummary } from "./AgentActivity-BNUNrP9O.js";
2
+ import { l as ThinkChatPart } from "./ThinkChatToolParts-CSzVwMXf.js";
3
+ import { DynamicToolUIPart, ToolUIPart } from "ai";
4
+
5
+ //#region src/components/ThinkChatActivitySummary.d.ts
6
+ interface ThinkChatToolDescriber {
7
+ describe?: (part: ToolUIPart | DynamicToolUIPart) => string | null | undefined;
8
+ }
9
+ type ThinkChatToolDescribers = Record<string, ThinkChatToolDescriber>;
10
+ type ThinkChatActivityHeader = Omit<AgentActivitySummary, "mode">;
11
+ declare function activityPartUrl(part: ThinkChatPart): string | null;
12
+ declare function activityPartIconKind(part: ThinkChatPart): AgentActivityIconKind;
13
+ /**
14
+ * One-line natural-language label for an activity part ("Ran vp test",
15
+ * "Fetched developers.cloudflare.com/agents/"); `null` for boundaries that
16
+ * aren't steps (step-start). Exported so a custom `renderPart` can reuse the
17
+ * built-in labels for tools it doesn't override.
18
+ */
19
+ declare function describeThinkChatActivityPart(part: ThinkChatPart, toolRenderers?: ThinkChatToolDescribers): string | null;
20
+ declare function summarizeActivitySteps(parts: readonly ThinkChatPart[]): string;
21
+ interface ThinkChatToolLifecycleSnapshot {
22
+ toolName: string;
23
+ input?: unknown;
24
+ state: "working" | "succeeded" | "failed" | "approval-required";
25
+ output?: unknown;
26
+ error?: unknown;
27
+ }
28
+ /** Derive the serializable collapsed header from persisted AI SDK message parts. */
29
+ declare function deriveThinkChatActivityHeader(parts: readonly ThinkChatPart[], options?: {
30
+ isStreaming?: boolean;
31
+ toolDescribers?: ThinkChatToolDescribers;
32
+ }): ThinkChatActivityHeader | null;
33
+ /**
34
+ * Derive the same live header from a host lifecycle event without making the
35
+ * host manufacture an AI SDK UI message part.
36
+ */
37
+ declare function deriveThinkChatToolLifecycleHeader(snapshot: ThinkChatToolLifecycleSnapshot): ThinkChatActivityHeader;
38
+ //#endregion
39
+ export { activityPartIconKind as a, deriveThinkChatToolLifecycleHeader as c, ThinkChatToolLifecycleSnapshot as i, describeThinkChatActivityPart as l, ThinkChatToolDescriber as n, activityPartUrl as o, ThinkChatToolDescribers as r, deriveThinkChatActivityHeader as s, ThinkChatActivityHeader as t, summarizeActivitySteps as u };
@@ -1,4 +1,4 @@
1
- import { InferUITools, ToolUIPart, UIMessage } from "ai";
1
+ import { DynamicToolUIPart, InferUITools, ToolUIPart, UIMessage } from "ai";
2
2
  import { ProxyToolInput, ProxyToolOutput } from "@cloudflare/codemode";
3
3
  import { QuickActionExtractInput, QuickActionPage, QuickActionScrapeInput, QuickActionToolName } from "@cloudflare/think/tools/browser";
4
4
  import { FetchResponseMode, FetchResult } from "@cloudflare/think/tools/fetch";
@@ -6,6 +6,16 @@ import { WorkspaceTools } from "@cloudflare/think/tools/workspace";
6
6
 
7
7
  //#region src/components/ThinkChatToolParts.d.ts
8
8
  type ThinkChatPart = UIMessage["parts"][number];
9
+ type AnyToolUIPart = ToolUIPart | DynamicToolUIPart;
10
+ /** Prefer AI SDK's provider/tool-authored title over its transport-facing key. */
11
+ declare function getToolDisplayName(part: AnyToolUIPart): string;
12
+ /**
13
+ * Whole-part supplement to Think's simplified state mapping. Think maps every
14
+ * `output-available` part to complete, while AI SDK preliminary outputs remain
15
+ * in flight until a non-preliminary result arrives.
16
+ */
17
+ declare function isToolPartWorking(part: AnyToolUIPart): boolean;
18
+ declare function isToolPartFailed(part: AnyToolUIPart): boolean;
9
19
  type WorkspaceUITools = InferUITools<Required<WorkspaceTools>>;
10
20
  type WorkspaceToolPart = ToolUIPart<WorkspaceUITools>;
11
21
  type ThinkWorkspaceToolName = keyof WorkspaceUITools;
@@ -39,6 +49,55 @@ type SkillUITools = {
39
49
  };
40
50
  type SkillToolPart = ToolUIPart<SkillUITools>;
41
51
  declare function isSkillToolPart(part: ThinkChatPart): part is SkillToolPart;
52
+ type SetContextInput = {
53
+ label: string;
54
+ content: string;
55
+ action?: "replace" | "append";
56
+ metadata?: {
57
+ title?: string;
58
+ description?: string;
59
+ };
60
+ };
61
+ type SessionContextUITools = {
62
+ set_context: {
63
+ input: SetContextInput;
64
+ output: string;
65
+ };
66
+ load_context: {
67
+ input: {
68
+ label: string;
69
+ key: string;
70
+ };
71
+ output: string;
72
+ };
73
+ unload_context: {
74
+ input: {
75
+ label: string;
76
+ key: string;
77
+ };
78
+ output: string;
79
+ };
80
+ search_context: {
81
+ input: {
82
+ label: string;
83
+ query: string;
84
+ };
85
+ output: string;
86
+ };
87
+ session_search: {
88
+ input: {
89
+ query: string;
90
+ };
91
+ output: string;
92
+ };
93
+ };
94
+ type SessionContextToolPart = ToolUIPart<SessionContextUITools>;
95
+ type SessionContextToolName = keyof SessionContextUITools;
96
+ declare function isSessionContextToolPart(part: ThinkChatPart): part is SessionContextToolPart;
97
+ /** Session tools report provider failures as successful string outputs so the
98
+ model can recover. Treat that upstream `Error:` envelope as failed UI while
99
+ preserving the recorded tool state and output verbatim. */
100
+ declare function isSessionContextToolFailure(part: SessionContextToolPart): boolean;
42
101
  type FetchToolInput = {
43
102
  url: string;
44
103
  path?: never;
@@ -82,10 +141,10 @@ type ExecuteToolPart = ToolUIPart<{
82
141
  declare function isExecuteToolPart(part: ThinkChatPart): part is ExecuteToolPart;
83
142
  /** Agent work (reasoning, tool calls, step boundaries) vs. content shown to the user. */
84
143
  declare function isThinkChatActivityPart(part: ThinkChatPart | undefined, excludeTools?: ReadonlySet<string>): boolean;
85
- /** In-flight: the stream opened this part but hasn't delivered its result yet. */
144
+ /** In-flight: awaiting input, approval continuation, or a final tool result. */
86
145
  declare function isPartWorking(part: ThinkChatPart): boolean;
87
146
  /** Errored or denied — upstream's simplified tool-part state vocabulary. */
88
147
  declare function isPartFailed(part: ThinkChatPart): boolean;
89
148
  declare function displayUrl(url: string | undefined): string;
90
149
  //#endregion
91
- export { isThinkChatActivityPart as _, ThinkBashToolOutput as a, ThinkWorkspaceToolName as c, isBrowserToolPart as d, isExecuteToolPart as f, isSkillToolPart as g, isPartWorking as h, SkillToolPart as i, WorkspaceToolPart as l, isPartFailed as m, ExecuteToolPart as n, ThinkBashToolPart as o, isFetchToolPart as p, FetchToolPart as r, ThinkChatPart as s, BrowserToolPart as t, displayUrl as u, isWorkspaceToolPart as v };
150
+ export { isToolPartFailed as C, isThinkChatActivityPart as S, isWorkspaceToolPart as T, isPartFailed as _, SessionContextToolPart as a, isSessionContextToolPart as b, ThinkBashToolPart as c, WorkspaceToolPart as d, displayUrl as f, isFetchToolPart as g, isExecuteToolPart as h, SessionContextToolName as i, ThinkChatPart as l, isBrowserToolPart as m, ExecuteToolPart as n, SkillToolPart as o, getToolDisplayName as p, FetchToolPart as r, ThinkBashToolOutput as s, BrowserToolPart as t, ThinkWorkspaceToolName as u, isPartWorking as v, isToolPartWorking as w, isSkillToolPart as x, isSessionContextToolFailure as y };
@@ -0,0 +1,30 @@
1
+ import { ThinkSubmissionInspection } from "@cloudflare/think";
2
+ import { WorkflowInfo } from "agents/workflows";
3
+
4
+ //#region src/components/ThinkExecutionRun.d.ts
5
+ /** Whole upstream execution records displayed by Think routine and execution surfaces. */
6
+ type ThinkExecutionRun = ThinkSubmissionInspection | WorkflowInfo;
7
+ /** Narrows the direct upstream execution union without wrapping either record. */
8
+ declare function isThinkSubmissionRun(run: ThinkExecutionRun): run is ThinkSubmissionInspection;
9
+ type ThinkExecutionStatusTone = "success" | "danger" | "warning" | "primary" | "neutral";
10
+ declare function getThinkExecutionRunId(run: ThinkExecutionRun): string;
11
+ declare function getThinkExecutionRunTitle(run: ThinkExecutionRun): string;
12
+ declare function getThinkExecutionRunSubtitle(run: ThinkExecutionRun): string | undefined;
13
+ declare function getThinkExecutionRunProgressedAt(run: ThinkExecutionRun): number | Date | undefined;
14
+ declare function getThinkExecutionRunProgressedLabel(run: ThinkExecutionRun): "Started" | "Updated";
15
+ /**
16
+ * WorkflowInfo.status resolves through the Workers-only InstanceStatus ambient
17
+ * type, so browser consumers format the whole upstream record's runtime value
18
+ * instead of exporting a local mirror of that union.
19
+ */
20
+ declare function getThinkExecutionRunStatus(run: ThinkExecutionRun): string;
21
+ declare function getThinkExecutionRunStatusTone(run: ThinkExecutionRun): ThinkExecutionStatusTone;
22
+ declare function formatThinkExecutionStatus(status: string): string;
23
+ declare function formatThinkExecutionTimestamp(value: Date | number | null | undefined, fallback?: string): string;
24
+ declare function formatThinkExecutionShortTimestamp(value: Date | number | null | undefined, fallback?: string): string;
25
+ declare function formatThinkExecutionRunProgress(run: ThinkExecutionRun): string;
26
+ declare function getThinkExecutionRunAccessibleName(run: ThinkExecutionRun): string;
27
+ declare function getThinkExecutionRunError(run: ThinkExecutionRun): string | undefined;
28
+ declare function isSameThinkExecutionRun(first: ThinkExecutionRun | null, second: ThinkExecutionRun): boolean;
29
+ //#endregion
30
+ export { isThinkSubmissionRun as _, formatThinkExecutionStatus as a, getThinkExecutionRunError as c, getThinkExecutionRunProgressedLabel as d, getThinkExecutionRunStatus as f, isSameThinkExecutionRun as g, getThinkExecutionRunTitle as h, formatThinkExecutionShortTimestamp as i, getThinkExecutionRunId as l, getThinkExecutionRunSubtitle as m, ThinkExecutionStatusTone as n, formatThinkExecutionTimestamp as o, getThinkExecutionRunStatusTone as p, formatThinkExecutionRunProgress as r, getThinkExecutionRunAccessibleName as s, ThinkExecutionRun as t, getThinkExecutionRunProgressedAt as u };
@@ -0,0 +1,69 @@
1
+ import * as React from "react";
2
+ import { Toggle } from "@base-ui/react/toggle";
3
+
4
+ //#region src/components/Toggle.d.ts
5
+ interface ToggleVariantsOptions {
6
+ variant?: "default" | "outline" | null;
7
+ size?: "default" | "sm" | "lg" | null;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * Props for the Toggle component.
12
+ */
13
+ interface ToggleProps extends Omit<React.ComponentPropsWithoutRef<typeof Toggle>, "className">, ToggleVariantsOptions {}
14
+ declare function toggleVariants({
15
+ variant,
16
+ size,
17
+ className
18
+ }?: ToggleVariantsOptions): string;
19
+ /**
20
+ * A two-state button that can be on (pressed) or off.
21
+ * Useful for toggling a setting or mode.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * // Basic toggle
26
+ * <Toggle>
27
+ * Bold
28
+ * </Toggle>
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * // Controlled toggle
34
+ * const [pressed, setPressed] = useState(false);
35
+ *
36
+ * <Toggle pressed={pressed} onPressedChange={setPressed}>
37
+ * {pressed ? 'On' : 'Off'}
38
+ * </Toggle>
39
+ * ```
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * // With icons
44
+ * <Toggle>
45
+ * {({ pressed }) => pressed ? <BoldIcon filled /> : <BoldIcon />}
46
+ * </Toggle>
47
+ * ```
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * // Default pressed state
52
+ * <Toggle defaultPressed>
53
+ * Enabled
54
+ * </Toggle>
55
+ * ```
56
+ *
57
+ * @see {@link https://base-ui.com/react/components/toggle | Base UI Toggle}
58
+ */
59
+ declare function Toggle$1({
60
+ className,
61
+ variant,
62
+ size,
63
+ ref,
64
+ ...props
65
+ }: ToggleProps & {
66
+ ref?: React.Ref<HTMLButtonElement>;
67
+ }): React.JSX.Element;
68
+ //#endregion
69
+ export { toggleVariants as i, ToggleProps as n, ToggleVariantsOptions as r, Toggle$1 as t };
@@ -0,0 +1,73 @@
1
+ import { r as ToggleVariantsOptions } from "./Toggle-CAAlNl-M.js";
2
+ import * as React from "react";
3
+ import { ToggleGroup } from "@base-ui/react/toggle-group";
4
+ import { Toggle } from "@base-ui/react/toggle";
5
+
6
+ //#region src/components/ToggleGroup.d.ts
7
+ type ToggleGroupSize = ToggleVariantsOptions["size"] | "md";
8
+ interface ToggleGroupProps extends Omit<React.ComponentPropsWithRef<typeof ToggleGroup>, "className"> {
9
+ className?: string;
10
+ variant?: ToggleVariantsOptions["variant"];
11
+ /**
12
+ * The size of the toggle group.
13
+ * @default 'md'
14
+ */
15
+ size?: ToggleGroupSize;
16
+ spacing?: number;
17
+ }
18
+ interface ToggleGroupItemProps extends Omit<React.ComponentPropsWithRef<typeof Toggle>, "className">, ToggleVariantsOptions {}
19
+ /**
20
+ * A toggle group component for selecting one or multiple options.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * // Single selection (defaultValue is an array)
25
+ * <ToggleGroup defaultValue={["center"]}>
26
+ * <ToggleGroupItem value="left">Left</ToggleGroupItem>
27
+ * <ToggleGroupItem value="center">Center</ToggleGroupItem>
28
+ * <ToggleGroupItem value="right">Right</ToggleGroupItem>
29
+ * </ToggleGroup>
30
+ * ```
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * // Multiple selection
35
+ * <ToggleGroup multiple defaultValue={["bold", "italic"]}>
36
+ * <ToggleGroupItem value="bold">Bold</ToggleGroupItem>
37
+ * <ToggleGroupItem value="italic">Italic</ToggleGroupItem>
38
+ * <ToggleGroupItem value="underline">Underline</ToggleGroupItem>
39
+ * </ToggleGroup>
40
+ * ```
41
+ *
42
+ * @see {@link https://base-ui.com/react/components/toggle-group | Base UI Toggle Group}
43
+ */
44
+ declare function ToggleGroupRoot({
45
+ size,
46
+ spacing,
47
+ variant,
48
+ className,
49
+ children,
50
+ style,
51
+ ref,
52
+ ...props
53
+ }: ToggleGroupProps & {
54
+ ref?: React.Ref<HTMLDivElement>;
55
+ }): React.JSX.Element;
56
+ /**
57
+ * A single toggle item within a ToggleGroup.
58
+ */
59
+ declare function ToggleGroupItem({
60
+ className,
61
+ variant,
62
+ size,
63
+ ref,
64
+ ...props
65
+ }: ToggleGroupItemProps & {
66
+ ref?: React.Ref<HTMLButtonElement>;
67
+ }): React.JSX.Element;
68
+ declare const ToggleGroup$1: {
69
+ Root: typeof ToggleGroupRoot;
70
+ Item: typeof ToggleGroupItem;
71
+ };
72
+ //#endregion
73
+ export { ToggleGroupItemProps as n, ToggleGroupProps as r, ToggleGroup$1 as t };
@@ -0,0 +1,62 @@
1
+ import { i as WorkspaceFileState, r as WorkspaceFileAssetResolver } from "./WorkspaceFile-DOZkPwzu.js";
2
+ import { WorkspaceLike } from "@cloudflare/think";
3
+ import { FileInfo, Workspace } from "@cloudflare/shell";
4
+
5
+ //#region src/components/Workspace.d.ts
6
+ /** Workspace summary, as returned by `Workspace.getWorkspaceInfo()` upstream. */
7
+ type WorkspaceInfo = Awaited<ReturnType<Workspace["getWorkspaceInfo"]>>;
8
+ /** Whole upstream workspace shapes, accepted without narrowing or mirroring. */
9
+ type WorkspaceSource = Workspace | WorkspaceLike;
10
+ interface UseWorkspaceOptions {
11
+ /** Must be referentially stable (memoize in the app) — a new source resets the workspace. */
12
+ source: WorkspaceSource;
13
+ /** Root directory to list first. Defaults to "/". */
14
+ root?: string;
15
+ /**
16
+ * Optional host adapter called before text/binary reads. Return `null` for
17
+ * ordinary text files and prefer signed/range-friendly URLs for large media.
18
+ * The configured root scopes navigation; hosts must enforce authorization
19
+ * atomically when resolving assets across a trust boundary.
20
+ */
21
+ resolveFileAsset?: WorkspaceFileAssetResolver;
22
+ /** Maximum size for the built-in buffered-byte fallback. Defaults to 32 MiB. */
23
+ maxInlineAssetBytes?: number;
24
+ }
25
+ interface WorkspaceState {
26
+ root: string;
27
+ /** Loaded directory listings, keyed by directory path. */
28
+ entriesByDirectory: Readonly<Record<string, readonly FileInfo[]>>;
29
+ /** Every loaded entry, keyed by its path. */
30
+ entryByPath: ReadonlyMap<string, FileInfo>;
31
+ expandedPaths: ReadonlySet<string>;
32
+ /** Update expansion; newly expanded directories load lazily. */
33
+ setExpandedPaths: (next: Set<string>) => void;
34
+ selectedPath: string | null;
35
+ /** Select a file and load it. Text is cached; binary assets remain active-file only. */
36
+ selectFile: (path: string | null) => void;
37
+ /** The selected file once its read settles; null while loading. */
38
+ selectedFile: WorkspaceFileState | null;
39
+ /** Root listing in flight. */
40
+ isLoading: boolean;
41
+ /** Directory and file paths with a request in flight. */
42
+ loadingPaths: ReadonlySet<string>;
43
+ /** Root/directory listing failure. Per-file read errors live on the file state. */
44
+ error: string | null;
45
+ /** Workspace summary, when the source provides `getWorkspaceInfo`. */
46
+ info: WorkspaceInfo | null;
47
+ /** Reload the root, every expanded directory, and the selected file. */
48
+ refresh: () => void;
49
+ }
50
+ /**
51
+ * Headless state for browsing a Think workspace: lazy directory loading,
52
+ * cached file reads, expansion/selection, and refresh. Feed the result to
53
+ * `WorkspaceExplorer`, or compose `WorkspaceBrowser` and `WorkspaceFileView`.
54
+ */
55
+ declare function useWorkspace({
56
+ source,
57
+ root,
58
+ resolveFileAsset,
59
+ maxInlineAssetBytes
60
+ }: UseWorkspaceOptions): WorkspaceState;
61
+ //#endregion
62
+ export { useWorkspace as a, WorkspaceState as i, WorkspaceInfo as n, WorkspaceSource as r, UseWorkspaceOptions as t };
@@ -0,0 +1,106 @@
1
+ import { A as CodeBlockLanguage } from "./CodeBlock-BRajW4QU.js";
2
+ import { SkillParseResult } from "agent-skills-ts-sdk";
3
+ import { FileInfo } from "@cloudflare/shell";
4
+
5
+ //#region src/components/WorkspaceFile.d.ts
6
+ type WorkspaceMediaKind = "image" | "pdf" | "audio" | "video";
7
+ interface WorkspaceMediaInfo {
8
+ kind: WorkspaceMediaKind;
9
+ mimeType: string;
10
+ }
11
+ type WorkspaceMediaTrackKind = "subtitles" | "captions" | "descriptions" | "chapters" | "metadata";
12
+ /** Optional timed text supplied by a host alongside an audio or video asset. */
13
+ interface WorkspaceMediaTrack {
14
+ src: string;
15
+ kind: WorkspaceMediaTrackKind;
16
+ srcLang: string;
17
+ label: string;
18
+ default?: boolean;
19
+ }
20
+ interface WorkspaceFileAssetMetadata {
21
+ mimeType?: string;
22
+ size?: number;
23
+ /** Meaningful image alternative. Empty or omitted values fall back to the file name. */
24
+ alt?: string;
25
+ /** Optional video poster URL. */
26
+ posterUrl?: string;
27
+ /** CORS mode for audio/video and cross-origin timed-text tracks. */
28
+ crossOrigin?: "anonymous" | "use-credentials";
29
+ /** Optional caption, subtitle, description, chapter, or metadata tracks. */
30
+ tracks?: readonly WorkspaceMediaTrack[];
31
+ /** Optional transcript destination shown alongside audio and video previews. */
32
+ transcriptUrl?: string;
33
+ }
34
+ /** A host-owned URL or component-owned buffered data for the active workspace file. */
35
+ type WorkspaceFileAsset = (WorkspaceFileAssetMetadata & {
36
+ kind: "url";
37
+ /**
38
+ * HTTP(S), relative, or blob URL owned by the host. The component never
39
+ * revokes it, so it must remain valid for the preview lifetime. PDF URLs
40
+ * must serve `application/pdf` with `X-Content-Type-Options: nosniff`.
41
+ */
42
+ url: string;
43
+ /**
44
+ * Optional host-owned download destination. Cross-origin endpoints must
45
+ * use `Content-Disposition: attachment`; SVG also requires attachment
46
+ * semantics or an isolated asset origin.
47
+ */
48
+ downloadUrl?: string;
49
+ }) | (WorkspaceFileAssetMetadata & {
50
+ kind: "data"; /** Buffered data whose component-created object URL is revoked on replacement/unmount. */
51
+ data: Blob | ArrayBuffer | Uint8Array;
52
+ });
53
+ interface WorkspaceFileAssetRequest {
54
+ /**
55
+ * Canonical path reported by `source.stat()`. Use this path, not
56
+ * `requestedPath`, when issuing a host-owned asset URL.
57
+ */
58
+ path: string;
59
+ /** Path selected in the explorer. This can name a symlink. */
60
+ requestedPath: string;
61
+ /** Normalized navigation root configured on `useWorkspace`. */
62
+ root: string;
63
+ /** Fresh metadata from `source.stat()`. The resolver is never called without it. */
64
+ info: FileInfo;
65
+ signal: AbortSignal;
66
+ }
67
+ /**
68
+ * Host adapter for signed/range-friendly URLs or custom binary loading.
69
+ * `useWorkspace` performs defense-in-depth path checks, but its `stat()` and
70
+ * read calls are not atomic. Hosts that treat `root` as an authorization
71
+ * boundary must authorize and resolve the asset atomically in this callback
72
+ * (preferably by immutable file identity), then return its URL or bytes.
73
+ */
74
+ type WorkspaceFileAssetResolver = (request: WorkspaceFileAssetRequest) => WorkspaceFileAsset | null | Promise<WorkspaceFileAsset | null>;
75
+ interface WorkspaceFileState {
76
+ path: string;
77
+ name: string;
78
+ /** Text content. Media previews leave this `null` and populate `asset`. */
79
+ content: string | null;
80
+ /** Binary asset for a supported image, PDF, audio, or video file. */
81
+ asset?: WorkspaceFileAsset | null;
82
+ /** Upstream metadata when the file was present in a loaded directory. */
83
+ info?: FileInfo | null;
84
+ error: string | null;
85
+ }
86
+ /** Agent Skills SDK result attached to a workspace `SKILL.md` preview. */
87
+ interface WorkspaceSkillDocument {
88
+ parsed: SkillParseResult | null;
89
+ validationErrors: readonly string[];
90
+ }
91
+ declare function getWorkspaceBasename(path: string): string;
92
+ declare function isWorkspaceMarkdownPath(path: string): boolean;
93
+ declare function isWorkspaceSkillPath(path: string): boolean;
94
+ /**
95
+ * Identify supported browser-native media before reading a file as text.
96
+ * A precise supported MIME wins; extensions provide the fallback for stores
97
+ * that report generic values such as `application/octet-stream`.
98
+ */
99
+ declare function inferWorkspaceMedia(path: string, mimeType?: string | null): WorkspaceMediaInfo | null;
100
+ declare function isWorkspaceMediaPath(path: string, mimeType?: string | null): boolean;
101
+ /** Parse and validate a workspace skill with the canonical Agent Skills SDK. */
102
+ declare function parseWorkspaceSkill(content: string): WorkspaceSkillDocument;
103
+ /** Best-effort syntax-highlighting language from a file path; unknown extensions render as plain text. */
104
+ declare function inferWorkspaceLanguage(path: string): CodeBlockLanguage;
105
+ //#endregion
106
+ export { WorkspaceMediaInfo as a, WorkspaceMediaTrackKind as c, inferWorkspaceLanguage as d, inferWorkspaceMedia as f, parseWorkspaceSkill as g, isWorkspaceSkillPath as h, WorkspaceFileState as i, WorkspaceSkillDocument as l, isWorkspaceMediaPath as m, WorkspaceFileAssetRequest as n, WorkspaceMediaKind as o, isWorkspaceMarkdownPath as p, WorkspaceFileAssetResolver as r, WorkspaceMediaTrack as s, WorkspaceFileAsset as t, getWorkspaceBasename as u };