@mcp-b/react-components 0.44.0 → 0.44.1
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/{Workspace-F3raHdYV.d.ts → Workspace-jdVZ9S0a.d.ts} +1 -1
- package/dist/{WorkspaceFile-BLaFmMrt.d.ts → WorkspaceFile-Dq-GC0_T.d.ts} +3 -1
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +2 -2
- package/dist/components/agents-sdk/Workspace.d.ts +1 -1
- package/dist/components/agents-sdk/Workspace.js +13 -3
- package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFile.d.ts +2 -2
- package/dist/components/agents-sdk/WorkspaceFile.js +18 -1
- package/dist/components/agents-sdk/WorkspaceFileView.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as WorkspaceMediaInfo, i as WorkspaceFileState, r as WorkspaceFileAssetResolver, t as WorkspaceFileAsset } from "./WorkspaceFile-
|
|
1
|
+
import { a as WorkspaceMediaInfo, i as WorkspaceFileState, r as WorkspaceFileAssetResolver, t as WorkspaceFileAsset } from "./WorkspaceFile-Dq-GC0_T.js";
|
|
2
2
|
import { DataTag, QueryKey, UnusedSkipTokenOptions } from "@tanstack/react-query";
|
|
3
3
|
import { WorkspaceLike } from "@cloudflare/think";
|
|
4
4
|
import { FileInfo, Workspace } from "@cloudflare/shell";
|
|
@@ -114,9 +114,11 @@ declare function inferWorkspaceMedia(path: string, mimeType?: string | null): Wo
|
|
|
114
114
|
*/
|
|
115
115
|
declare function inferWorkspaceMimeType(path: string): string | null;
|
|
116
116
|
declare function isWorkspaceMediaPath(path: string, mimeType?: string | null): boolean;
|
|
117
|
+
/** Identify files that are safe to decode and render as text. */
|
|
118
|
+
declare function isWorkspaceTextPath(path: string, mimeType?: string | null): boolean;
|
|
117
119
|
/** Parse and validate a workspace skill with the canonical Agent Skills SDK. */
|
|
118
120
|
declare function parseWorkspaceSkill(content: string): WorkspaceSkillDocument;
|
|
119
121
|
/** Best-effort syntax-highlighting language from a file path; unknown extensions render as plain text. */
|
|
120
122
|
declare function inferWorkspaceLanguage(path: string): CodeBlockLanguage;
|
|
121
123
|
//#endregion
|
|
122
|
-
export {
|
|
124
|
+
export { isWorkspaceTextPath as _, WorkspaceMediaInfo as a, WorkspaceMediaTrackKind as c, inferWorkspaceLanguage as d, inferWorkspaceMedia as f, isWorkspaceSkillPath as g, isWorkspaceMediaPath as h, WorkspaceFileState as i, WorkspaceSkillDocument as l, isWorkspaceMarkdownPath as m, WorkspaceFileAssetRequest as n, WorkspaceMediaKind as o, inferWorkspaceMimeType as p, WorkspaceFileAssetResolver as r, WorkspaceMediaTrack as s, WorkspaceFileAsset as t, getWorkspaceBasename as u, parseWorkspaceSkill as v };
|
|
@@ -4,8 +4,8 @@ import { n as McpPluginCatalogProps } from "../../McpPluginCatalog-mbGw8FTu.js";
|
|
|
4
4
|
import { ThinkChatMessagesProps } from "./ThinkChat.js";
|
|
5
5
|
import { n as ResponsiveSidebarShell, t as AppBarSlots } from "../../ResponsiveSidebarShell-DOXd5T-d.js";
|
|
6
6
|
import { ThinkThreadStatusSummary } from "./ThinkThreadPicker.js";
|
|
7
|
-
import { r as WorkspaceFileAssetResolver } from "../../WorkspaceFile-
|
|
8
|
-
import { v as WorkspaceSource } from "../../Workspace-
|
|
7
|
+
import { r as WorkspaceFileAssetResolver } from "../../WorkspaceFile-Dq-GC0_T.js";
|
|
8
|
+
import { v as WorkspaceSource } from "../../Workspace-jdVZ9S0a.js";
|
|
9
9
|
import { t as ThinkAgent } from "../../think-agent-Cip5KAPj.js";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { UIMessage } from "ai";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as workspaceQueryKey, C as workspaceBinaryFileQueryOptions, D as workspaceFileAssetQueryOptions, E as workspaceDirectoryQueryPrefix, O as workspaceFileStatQueryOptions, S as useWorkspace, T as workspaceDirectoryQueryOptions, _ as WorkspaceResolvedAsset, a as WorkspaceDirectoryQueryOptions, b as WorkspaceTextFileQueryKey, c as WorkspaceFileQueryKey, d as WorkspaceFileStatQueryOptions, f as WorkspaceFileVersion, g as WorkspaceQueryKey, h as WorkspaceInfoQueryOptions, i as WorkspaceDirectoryQueryKey, j as workspaceTextFileQueryOptions, k as workspaceInfoQueryOptions, l as WorkspaceFileReadTarget, m as WorkspaceInfoQueryKey, n as WorkspaceBinaryFileQueryKey, o as WorkspaceFileAssetQueryKey, p as WorkspaceInfo, r as WorkspaceBinaryFileQueryOptions, s as WorkspaceFileAssetQueryOptions, t as UseWorkspaceOptions, u as WorkspaceFileStatQueryKey, v as WorkspaceSource, w as workspaceDirectoryQueryKey, x as WorkspaceTextFileQueryOptions, y as WorkspaceState } from "../../Workspace-
|
|
1
|
+
import { A as workspaceQueryKey, C as workspaceBinaryFileQueryOptions, D as workspaceFileAssetQueryOptions, E as workspaceDirectoryQueryPrefix, O as workspaceFileStatQueryOptions, S as useWorkspace, T as workspaceDirectoryQueryOptions, _ as WorkspaceResolvedAsset, a as WorkspaceDirectoryQueryOptions, b as WorkspaceTextFileQueryKey, c as WorkspaceFileQueryKey, d as WorkspaceFileStatQueryOptions, f as WorkspaceFileVersion, g as WorkspaceQueryKey, h as WorkspaceInfoQueryOptions, i as WorkspaceDirectoryQueryKey, j as workspaceTextFileQueryOptions, k as workspaceInfoQueryOptions, l as WorkspaceFileReadTarget, m as WorkspaceInfoQueryKey, n as WorkspaceBinaryFileQueryKey, o as WorkspaceFileAssetQueryKey, p as WorkspaceInfo, r as WorkspaceBinaryFileQueryOptions, s as WorkspaceFileAssetQueryOptions, t as UseWorkspaceOptions, u as WorkspaceFileStatQueryKey, v as WorkspaceSource, w as workspaceDirectoryQueryKey, x as WorkspaceTextFileQueryOptions, y as WorkspaceState } from "../../Workspace-jdVZ9S0a.js";
|
|
2
2
|
export { UseWorkspaceOptions, WorkspaceBinaryFileQueryKey, WorkspaceBinaryFileQueryOptions, WorkspaceDirectoryQueryKey, WorkspaceDirectoryQueryOptions, WorkspaceFileAssetQueryKey, WorkspaceFileAssetQueryOptions, WorkspaceFileQueryKey, WorkspaceFileReadTarget, WorkspaceFileStatQueryKey, WorkspaceFileStatQueryOptions, WorkspaceFileVersion, WorkspaceInfo, WorkspaceInfoQueryKey, WorkspaceInfoQueryOptions, WorkspaceQueryKey, WorkspaceResolvedAsset, WorkspaceSource, WorkspaceState, WorkspaceTextFileQueryKey, WorkspaceTextFileQueryOptions, useWorkspace, workspaceBinaryFileQueryOptions, workspaceDirectoryQueryKey, workspaceDirectoryQueryOptions, workspaceDirectoryQueryPrefix, workspaceFileAssetQueryOptions, workspaceFileStatQueryOptions, workspaceInfoQueryOptions, workspaceQueryKey, workspaceTextFileQueryOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as formatErrorMessage } from "../../format-DB2mX9DA.js";
|
|
2
|
-
import { getWorkspaceBasename, inferWorkspaceMedia } from "./WorkspaceFile.js";
|
|
2
|
+
import { getWorkspaceBasename, inferWorkspaceMedia, isWorkspaceTextPath } from "./WorkspaceFile.js";
|
|
3
3
|
import { n as isWorkspacePathWithinRoot, t as canonicalizeAbsoluteWorkspacePath } from "../../workspace-path-L_KmjRjq.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { queryOptions, useQueries, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
@@ -245,6 +245,7 @@ async function refreshWorkspaceFile(queryClient, { source, sourceKey, root, sele
|
|
|
245
245
|
});
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
+
if (!isWorkspaceTextPath(target.readPath, target.info.mimeType)) return;
|
|
248
249
|
const options = workspaceTextFileQueryOptions(source, sourceKey, root, target);
|
|
249
250
|
if (queryClient.getQueryState(options.queryKey)) await queryClient.fetchQuery({
|
|
250
251
|
...options,
|
|
@@ -284,6 +285,7 @@ function useWorkspace({ source, sourceKey, root = "/", selectedPath, onSelectedP
|
|
|
284
285
|
info: INACTIVE_FILE_INFO,
|
|
285
286
|
media: null
|
|
286
287
|
};
|
|
288
|
+
const targetIsText = target ? isWorkspaceTextPath(target.readPath, target.info.mimeType) : false;
|
|
287
289
|
const assetQuery = useQuery({
|
|
288
290
|
...workspaceFileAssetQueryOptions(sourceKey, root, queryTarget, resolveFileAsset ?? INACTIVE_FILE_ASSET_RESOLVER),
|
|
289
291
|
enabled: statSettled && resolveFileAsset !== void 0
|
|
@@ -292,7 +294,7 @@ function useWorkspace({ source, sourceKey, root = "/", selectedPath, onSelectedP
|
|
|
292
294
|
const resolverSettled = !resolveFileAsset || assetQuery.isSuccess && !assetQuery.isFetching;
|
|
293
295
|
const textQuery = useQuery({
|
|
294
296
|
...workspaceTextFileQueryOptions(source, sourceKey, root, queryTarget),
|
|
295
|
-
enabled: statSettled && resolverSettled && !resolvedAsset && !target.media
|
|
297
|
+
enabled: statSettled && resolverSettled && !resolvedAsset && !target.media && targetIsText
|
|
296
298
|
});
|
|
297
299
|
const binaryQuery = useQuery({
|
|
298
300
|
...workspaceBinaryFileQueryOptions(source, sourceKey, root, queryTarget, normalizedMaxInlineAssetBytes),
|
|
@@ -349,7 +351,7 @@ function useWorkspace({ source, sourceKey, root = "/", selectedPath, onSelectedP
|
|
|
349
351
|
info: target.info,
|
|
350
352
|
error: null
|
|
351
353
|
};
|
|
352
|
-
else if (
|
|
354
|
+
else if (targetIsText && textQuery.isSuccess) selectedFile = {
|
|
353
355
|
path: selectedPath,
|
|
354
356
|
name: getWorkspaceBasename(selectedPath),
|
|
355
357
|
content: textQuery.data,
|
|
@@ -357,6 +359,14 @@ function useWorkspace({ source, sourceKey, root = "/", selectedPath, onSelectedP
|
|
|
357
359
|
info: target.info,
|
|
358
360
|
error: null
|
|
359
361
|
};
|
|
362
|
+
else if (!target.media && !targetIsText) selectedFile = {
|
|
363
|
+
path: selectedPath,
|
|
364
|
+
name: getWorkspaceBasename(selectedPath),
|
|
365
|
+
content: null,
|
|
366
|
+
asset: null,
|
|
367
|
+
info: target.info,
|
|
368
|
+
error: null
|
|
369
|
+
};
|
|
360
370
|
}
|
|
361
371
|
const loadingPaths = React.useMemo(() => {
|
|
362
372
|
const paths = /* @__PURE__ */ new Set();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as WorkspaceNavigationAdapter } from "../../WorkspaceLink-Bh9-Jo1r.js";
|
|
2
|
-
import { y as WorkspaceState } from "../../Workspace-
|
|
2
|
+
import { y as WorkspaceState } from "../../Workspace-jdVZ9S0a.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/agents-sdk/WorkspaceExplorer.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { WorkspaceFileAsset, WorkspaceFileAssetRequest, WorkspaceFileAssetResolver, WorkspaceFileState, WorkspaceMediaInfo, WorkspaceMediaKind, WorkspaceMediaTrack, WorkspaceMediaTrackKind, WorkspaceSkillDocument, getWorkspaceBasename, inferWorkspaceLanguage, inferWorkspaceMedia, inferWorkspaceMimeType, isWorkspaceMarkdownPath, isWorkspaceMediaPath, isWorkspaceSkillPath, parseWorkspaceSkill };
|
|
1
|
+
import { _ as isWorkspaceTextPath, a as WorkspaceMediaInfo, c as WorkspaceMediaTrackKind, d as inferWorkspaceLanguage, f as inferWorkspaceMedia, g as isWorkspaceSkillPath, h as isWorkspaceMediaPath, i as WorkspaceFileState, l as WorkspaceSkillDocument, m as isWorkspaceMarkdownPath, n as WorkspaceFileAssetRequest, o as WorkspaceMediaKind, p as inferWorkspaceMimeType, r as WorkspaceFileAssetResolver, s as WorkspaceMediaTrack, t as WorkspaceFileAsset, u as getWorkspaceBasename, v as parseWorkspaceSkill } from "../../WorkspaceFile-Dq-GC0_T.js";
|
|
2
|
+
export { WorkspaceFileAsset, WorkspaceFileAssetRequest, WorkspaceFileAssetResolver, WorkspaceFileState, WorkspaceMediaInfo, WorkspaceMediaKind, WorkspaceMediaTrack, WorkspaceMediaTrackKind, WorkspaceSkillDocument, getWorkspaceBasename, inferWorkspaceLanguage, inferWorkspaceMedia, inferWorkspaceMimeType, isWorkspaceMarkdownPath, isWorkspaceMediaPath, isWorkspaceSkillPath, isWorkspaceTextPath, parseWorkspaceSkill };
|
|
@@ -135,6 +135,17 @@ const GENERIC_MEDIA_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
|
135
135
|
"application/binary",
|
|
136
136
|
"binary/octet-stream"
|
|
137
137
|
]);
|
|
138
|
+
const TEXT_APPLICATION_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
139
|
+
"application/ecmascript",
|
|
140
|
+
"application/javascript",
|
|
141
|
+
"application/json",
|
|
142
|
+
"application/sql",
|
|
143
|
+
"application/toml",
|
|
144
|
+
"application/x-sh",
|
|
145
|
+
"application/x-yaml",
|
|
146
|
+
"application/xml",
|
|
147
|
+
"application/yaml"
|
|
148
|
+
]);
|
|
138
149
|
function normalizeWorkspaceMimeType(mimeType) {
|
|
139
150
|
return mimeType?.split(";", 1)[0]?.trim().toLowerCase() || null;
|
|
140
151
|
}
|
|
@@ -209,6 +220,12 @@ function inferWorkspaceMimeType(path) {
|
|
|
209
220
|
function isWorkspaceMediaPath(path, mimeType) {
|
|
210
221
|
return inferWorkspaceMedia(path, mimeType) !== null;
|
|
211
222
|
}
|
|
223
|
+
/** Identify files that are safe to decode and render as text. */
|
|
224
|
+
function isWorkspaceTextPath(path, mimeType) {
|
|
225
|
+
const normalizedMimeType = normalizeWorkspaceMimeType(mimeType);
|
|
226
|
+
if (!normalizedMimeType || GENERIC_MEDIA_MIME_TYPES.has(normalizedMimeType)) return LANGUAGE_BY_EXTENSION[workspaceExtension(path)] !== void 0;
|
|
227
|
+
return normalizedMimeType.startsWith("text/") || TEXT_APPLICATION_MIME_TYPES.has(normalizedMimeType) || normalizedMimeType.endsWith("+json") || normalizedMimeType.endsWith("+xml");
|
|
228
|
+
}
|
|
212
229
|
/** Parse and validate a workspace skill with the canonical Agent Skills SDK. */
|
|
213
230
|
function parseWorkspaceSkill(content) {
|
|
214
231
|
const validationErrors = validateSkillContent(content);
|
|
@@ -229,4 +246,4 @@ function inferWorkspaceLanguage(path) {
|
|
|
229
246
|
return LANGUAGE_BY_EXTENSION[workspaceExtension(path)] ?? "text";
|
|
230
247
|
}
|
|
231
248
|
//#endregion
|
|
232
|
-
export { getWorkspaceBasename, inferWorkspaceLanguage, inferWorkspaceMedia, inferWorkspaceMimeType, isWorkspaceMarkdownPath, isWorkspaceMediaPath, isWorkspaceSkillPath, parseWorkspaceSkill };
|
|
249
|
+
export { getWorkspaceBasename, inferWorkspaceLanguage, inferWorkspaceMedia, inferWorkspaceMimeType, isWorkspaceMarkdownPath, isWorkspaceMediaPath, isWorkspaceSkillPath, isWorkspaceTextPath, parseWorkspaceSkill };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/react-components",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.1",
|
|
4
4
|
"description": "MCP-B React components built on Base UI and shared design tokens, including Cloudflare Think chat primitives.",
|
|
5
5
|
"homepage": "https://design-system.sigvelo.com",
|
|
6
6
|
"bugs": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"streamdown": "^2.5.0",
|
|
54
54
|
"unist-util-visit": "^5.1.0",
|
|
55
55
|
"yet-another-react-lightbox": "^3.32.2",
|
|
56
|
-
"@mcp-b/design-tokens": "0.44.
|
|
56
|
+
"@mcp-b/design-tokens": "0.44.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@ai-sdk/react": "^3.0.249",
|