mcp-use 1.4.1 → 1.5.0-canary.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/.tsbuildinfo +1 -1
- package/dist/{chunk-RE7EYFDV.js → chunk-5XVM4A23.js} +446 -964
- package/dist/{chunk-35A6O3YH.js → chunk-MCF5P6GJ.js} +1 -1
- package/dist/{display-LIYVTGEU.js → display-YIYC6WJE.js} +77 -6
- package/dist/index.cjs +572 -1004
- package/dist/index.js +33 -12
- package/dist/src/agents/display.d.ts +5 -1
- package/dist/src/agents/display.d.ts.map +1 -1
- package/dist/src/agents/index.cjs +77 -6
- package/dist/src/agents/index.js +1 -1
- package/dist/src/browser.cjs +77 -6
- package/dist/src/browser.js +1 -1
- package/dist/src/client/codeExecutor.d.ts +1 -1
- package/dist/src/client/codeExecutor.d.ts.map +1 -1
- package/dist/src/client/executors/base.d.ts +10 -1
- package/dist/src/client/executors/base.d.ts.map +1 -1
- package/dist/src/client.d.ts +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/react/ErrorBoundary.d.ts +24 -0
- package/dist/src/react/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/react/Image.d.ts +11 -0
- package/dist/src/react/Image.d.ts.map +1 -0
- package/dist/src/react/McpUseProvider.d.ts +46 -0
- package/dist/src/react/McpUseProvider.d.ts.map +1 -0
- package/dist/src/react/ThemeProvider.d.ts +14 -0
- package/dist/src/react/ThemeProvider.d.ts.map +1 -0
- package/dist/src/react/WidgetControls.d.ts +44 -0
- package/dist/src/react/WidgetControls.d.ts.map +1 -0
- package/dist/src/react/index.cjs +474 -992
- package/dist/src/react/index.d.ts +9 -6
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/index.js +11 -5
- package/dist/src/react/useWidget.d.ts.map +1 -1
- package/dist/src/react/widget-types.d.ts +6 -0
- package/dist/src/react/widget-types.d.ts.map +1 -1
- package/dist/src/server/connect-adapter.d.ts.map +1 -1
- package/dist/src/server/index.cjs +232 -21
- package/dist/src/server/index.js +232 -21
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/package.json +6 -4
- package/dist/src/react/WidgetDebugger.d.ts +0 -31
- package/dist/src/react/WidgetDebugger.d.ts.map +0 -1
- package/dist/src/react/WidgetFullscreenWrapper.d.ts +0 -32
- package/dist/src/react/WidgetFullscreenWrapper.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -18,20 +18,23 @@ import {
|
|
|
18
18
|
ServerManager,
|
|
19
19
|
Telemetry,
|
|
20
20
|
setTelemetrySource
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MCF5P6GJ.js";
|
|
22
22
|
import {
|
|
23
23
|
CodeModeConnector,
|
|
24
24
|
PROMPTS
|
|
25
25
|
} from "./chunk-WERYJ6PF.js";
|
|
26
26
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
ErrorBoundary,
|
|
28
|
+
Image,
|
|
29
|
+
McpUseProvider,
|
|
30
|
+
ThemeProvider,
|
|
31
|
+
WidgetControls,
|
|
29
32
|
useMcp,
|
|
30
33
|
useWidget,
|
|
31
34
|
useWidgetProps,
|
|
32
35
|
useWidgetState,
|
|
33
36
|
useWidgetTheme
|
|
34
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5XVM4A23.js";
|
|
35
38
|
import {
|
|
36
39
|
BaseMCPClient,
|
|
37
40
|
BrowserOAuthClientProvider,
|
|
@@ -129,18 +132,17 @@ var BaseCodeExecutor = class {
|
|
|
129
132
|
createSearchToolsFunction() {
|
|
130
133
|
return async (query = "", detailLevel = "full") => {
|
|
131
134
|
const allTools = [];
|
|
135
|
+
const allNamespaces = /* @__PURE__ */ new Set();
|
|
132
136
|
const queryLower = query.toLowerCase();
|
|
133
137
|
const activeSessions = this.client.getAllActiveSessions();
|
|
134
138
|
for (const [serverName, session] of Object.entries(activeSessions)) {
|
|
135
139
|
if (serverName === "code_mode") continue;
|
|
136
140
|
try {
|
|
137
141
|
const tools = session.connector.tools;
|
|
142
|
+
if (tools && tools.length > 0) {
|
|
143
|
+
allNamespaces.add(serverName);
|
|
144
|
+
}
|
|
138
145
|
for (const tool of tools) {
|
|
139
|
-
if (query) {
|
|
140
|
-
const nameMatch = tool.name.toLowerCase().includes(queryLower);
|
|
141
|
-
const descMatch = tool.description?.toLowerCase().includes(queryLower);
|
|
142
|
-
if (!nameMatch && !descMatch) continue;
|
|
143
|
-
}
|
|
144
146
|
if (detailLevel === "names") {
|
|
145
147
|
allTools.push({ name: tool.name, server: serverName });
|
|
146
148
|
} else if (detailLevel === "descriptions") {
|
|
@@ -162,7 +164,23 @@ var BaseCodeExecutor = class {
|
|
|
162
164
|
logger.warn(`Failed to search tools in server ${serverName}: ${e}`);
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
|
-
|
|
167
|
+
let filteredTools = allTools;
|
|
168
|
+
if (query) {
|
|
169
|
+
filteredTools = allTools.filter((tool) => {
|
|
170
|
+
const nameMatch = tool.name.toLowerCase().includes(queryLower);
|
|
171
|
+
const descMatch = tool.description?.toLowerCase().includes(queryLower);
|
|
172
|
+
const serverMatch = tool.server.toLowerCase().includes(queryLower);
|
|
173
|
+
return nameMatch || descMatch || serverMatch;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
meta: {
|
|
178
|
+
total_tools: allTools.length,
|
|
179
|
+
namespaces: Array.from(allNamespaces).sort(),
|
|
180
|
+
result_count: filteredTools.length
|
|
181
|
+
},
|
|
182
|
+
results: filteredTools
|
|
183
|
+
};
|
|
166
184
|
};
|
|
167
185
|
}
|
|
168
186
|
};
|
|
@@ -1425,7 +1443,9 @@ export {
|
|
|
1425
1443
|
BrowserOAuthClientProvider,
|
|
1426
1444
|
ConnectMCPServerTool,
|
|
1427
1445
|
E2BCodeExecutor,
|
|
1446
|
+
ErrorBoundary,
|
|
1428
1447
|
HttpConnector,
|
|
1448
|
+
Image,
|
|
1429
1449
|
LINEAR_OAUTH_CONFIG,
|
|
1430
1450
|
LangChainAdapter,
|
|
1431
1451
|
ListMCPServersTool,
|
|
@@ -1433,6 +1453,7 @@ export {
|
|
|
1433
1453
|
MCPAgent,
|
|
1434
1454
|
MCPClient,
|
|
1435
1455
|
MCPSession,
|
|
1456
|
+
McpUseProvider,
|
|
1436
1457
|
OAuthHelper,
|
|
1437
1458
|
ObservabilityManager,
|
|
1438
1459
|
PROMPTS,
|
|
@@ -1441,10 +1462,10 @@ export {
|
|
|
1441
1462
|
ServerManager,
|
|
1442
1463
|
StdioConnector,
|
|
1443
1464
|
Telemetry,
|
|
1465
|
+
ThemeProvider,
|
|
1444
1466
|
VMCodeExecutor,
|
|
1445
1467
|
WebSocketConnector,
|
|
1446
|
-
|
|
1447
|
-
WidgetFullscreenWrapper,
|
|
1468
|
+
WidgetControls,
|
|
1448
1469
|
createOAuthMCPConfig,
|
|
1449
1470
|
createReadableStreamFromGenerator,
|
|
1450
1471
|
isVMAvailable,
|
|
@@ -41,7 +41,11 @@ export declare function formatSearchToolsAsTree(tools: Array<{
|
|
|
41
41
|
server: string;
|
|
42
42
|
name: string;
|
|
43
43
|
description?: string;
|
|
44
|
-
}
|
|
44
|
+
}>, meta?: {
|
|
45
|
+
total_tools?: number;
|
|
46
|
+
namespaces?: string[];
|
|
47
|
+
result_count?: number;
|
|
48
|
+
}, query?: string): string;
|
|
45
49
|
/**
|
|
46
50
|
* Handle tool end event with pretty printing
|
|
47
51
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../src/agents/display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAWtE,UAAU,iBAAiB;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AA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AAI,CAAC,CAoCpC"}
|
|
@@ -722,9 +722,27 @@ function extractToolMessageContent(output) {
|
|
|
722
722
|
}
|
|
723
723
|
return null;
|
|
724
724
|
}
|
|
725
|
-
function formatSearchToolsAsTree(tools) {
|
|
725
|
+
function formatSearchToolsAsTree(tools, meta, query) {
|
|
726
|
+
const metaLines = [];
|
|
727
|
+
if (meta) {
|
|
728
|
+
if (meta.total_tools !== void 0) {
|
|
729
|
+
metaLines.push(`Total tools: ${meta.total_tools}`);
|
|
730
|
+
}
|
|
731
|
+
if (meta.namespaces && meta.namespaces.length > 0) {
|
|
732
|
+
metaLines.push(`Namespaces: ${meta.namespaces.join(", ")}`);
|
|
733
|
+
}
|
|
734
|
+
if (meta.result_count !== void 0) {
|
|
735
|
+
metaLines.push(`Results: ${meta.result_count}`);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
726
738
|
if (!Array.isArray(tools) || tools.length === 0) {
|
|
727
|
-
|
|
739
|
+
const noResultsMsg = query ? `No tools found for query "${query}"` : "(no tools found)";
|
|
740
|
+
if (metaLines.length > 0) {
|
|
741
|
+
return `${metaLines.join("\n")}
|
|
742
|
+
|
|
743
|
+
${noResultsMsg}`;
|
|
744
|
+
}
|
|
745
|
+
return noResultsMsg;
|
|
728
746
|
}
|
|
729
747
|
const toolsByServer = {};
|
|
730
748
|
for (const tool of tools) {
|
|
@@ -735,6 +753,20 @@ function formatSearchToolsAsTree(tools) {
|
|
|
735
753
|
toolsByServer[server].push(tool);
|
|
736
754
|
}
|
|
737
755
|
const lines = [];
|
|
756
|
+
if (meta) {
|
|
757
|
+
if (meta.total_tools !== void 0) {
|
|
758
|
+
lines.push(`Total tools: ${meta.total_tools}`);
|
|
759
|
+
}
|
|
760
|
+
if (meta.namespaces && meta.namespaces.length > 0) {
|
|
761
|
+
lines.push(`Namespaces: ${meta.namespaces.join(", ")}`);
|
|
762
|
+
}
|
|
763
|
+
if (meta.result_count !== void 0) {
|
|
764
|
+
lines.push(`Results: ${meta.result_count}`);
|
|
765
|
+
}
|
|
766
|
+
if (lines.length > 0) {
|
|
767
|
+
lines.push("");
|
|
768
|
+
}
|
|
769
|
+
}
|
|
738
770
|
const servers = Object.keys(toolsByServer).sort();
|
|
739
771
|
for (let i = 0; i < servers.length; i++) {
|
|
740
772
|
const server = servers[i];
|
|
@@ -749,11 +781,34 @@ function formatSearchToolsAsTree(tools) {
|
|
|
749
781
|
const isLastTool = j === serverTools.length - 1;
|
|
750
782
|
const indent = isLastServer ? " " : "\u2502 ";
|
|
751
783
|
const toolPrefix = isLastTool ? "\u2514\u2500" : "\u251C\u2500";
|
|
752
|
-
|
|
784
|
+
const toolLine = `${indent}${toolPrefix} ${tool.name}`;
|
|
785
|
+
lines.push(toolLine);
|
|
753
786
|
if (tool.description) {
|
|
754
|
-
|
|
787
|
+
const descAlign = isLastTool ? " " : "\u2502 ";
|
|
788
|
+
const descriptionIndent = `${indent}${descAlign}`;
|
|
789
|
+
const indentLength = stripAnsi(descriptionIndent).length;
|
|
790
|
+
const availableWidth = Math.max(40, TERMINAL_WIDTH - indentLength - 4);
|
|
791
|
+
const words = tool.description.split(/(\s+)/);
|
|
792
|
+
const wrappedLines = [];
|
|
793
|
+
let currentLine = "";
|
|
794
|
+
for (const word of words) {
|
|
795
|
+
const testLine = currentLine + word;
|
|
796
|
+
if (stripAnsi(testLine).length <= availableWidth) {
|
|
797
|
+
currentLine = testLine;
|
|
798
|
+
} else {
|
|
799
|
+
if (currentLine) {
|
|
800
|
+
wrappedLines.push(currentLine.trimEnd());
|
|
801
|
+
}
|
|
802
|
+
currentLine = word.trimStart();
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (currentLine) {
|
|
806
|
+
wrappedLines.push(currentLine.trimEnd());
|
|
807
|
+
}
|
|
808
|
+
for (const descLine of wrappedLines) {
|
|
809
|
+
lines.push(`${descriptionIndent}${import_chalk.default.dim(descLine)}`);
|
|
810
|
+
}
|
|
755
811
|
}
|
|
756
|
-
lines.push(toolLine);
|
|
757
812
|
}
|
|
758
813
|
}
|
|
759
814
|
return lines.join("\n");
|
|
@@ -797,6 +852,8 @@ function handleToolEnd(event) {
|
|
|
797
852
|
}
|
|
798
853
|
}
|
|
799
854
|
if (toolName === "search_tools") {
|
|
855
|
+
const toolInput = event.data?.input;
|
|
856
|
+
const query = toolInput?.query;
|
|
800
857
|
let actualContent = content;
|
|
801
858
|
if (typeof content === "object" && content !== null && !Array.isArray(content) && "content" in content) {
|
|
802
859
|
const innerContent = content.content;
|
|
@@ -810,8 +867,22 @@ function handleToolEnd(event) {
|
|
|
810
867
|
}
|
|
811
868
|
}
|
|
812
869
|
}
|
|
870
|
+
if (typeof actualContent === "object" && actualContent !== null && !Array.isArray(actualContent) && "results" in actualContent && Array.isArray(actualContent.results)) {
|
|
871
|
+
const results = actualContent.results;
|
|
872
|
+
const contentWithMeta = actualContent;
|
|
873
|
+
const meta = contentWithMeta.meta;
|
|
874
|
+
const treeStr = formatSearchToolsAsTree(results, meta, query);
|
|
875
|
+
const statusText = status === "success" ? import_chalk.default.green("Success") : import_chalk.default.red("Error");
|
|
876
|
+
const title2 = `${statusText}: ${toolName} - Result`;
|
|
877
|
+
printBox(treeStr, title2, void 0, false);
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
813
880
|
if (Array.isArray(actualContent)) {
|
|
814
|
-
const treeStr = formatSearchToolsAsTree(
|
|
881
|
+
const treeStr = formatSearchToolsAsTree(
|
|
882
|
+
actualContent,
|
|
883
|
+
void 0,
|
|
884
|
+
query
|
|
885
|
+
);
|
|
815
886
|
const statusText = status === "success" ? import_chalk.default.green("Success") : import_chalk.default.red("Error");
|
|
816
887
|
const title2 = `${statusText}: ${toolName} - Result`;
|
|
817
888
|
printBox(treeStr, title2, void 0, false);
|
package/dist/src/agents/index.js
CHANGED
package/dist/src/browser.cjs
CHANGED
|
@@ -722,9 +722,27 @@ function extractToolMessageContent(output) {
|
|
|
722
722
|
}
|
|
723
723
|
return null;
|
|
724
724
|
}
|
|
725
|
-
function formatSearchToolsAsTree(tools) {
|
|
725
|
+
function formatSearchToolsAsTree(tools, meta, query) {
|
|
726
|
+
const metaLines = [];
|
|
727
|
+
if (meta) {
|
|
728
|
+
if (meta.total_tools !== void 0) {
|
|
729
|
+
metaLines.push(`Total tools: ${meta.total_tools}`);
|
|
730
|
+
}
|
|
731
|
+
if (meta.namespaces && meta.namespaces.length > 0) {
|
|
732
|
+
metaLines.push(`Namespaces: ${meta.namespaces.join(", ")}`);
|
|
733
|
+
}
|
|
734
|
+
if (meta.result_count !== void 0) {
|
|
735
|
+
metaLines.push(`Results: ${meta.result_count}`);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
726
738
|
if (!Array.isArray(tools) || tools.length === 0) {
|
|
727
|
-
|
|
739
|
+
const noResultsMsg = query ? `No tools found for query "${query}"` : "(no tools found)";
|
|
740
|
+
if (metaLines.length > 0) {
|
|
741
|
+
return `${metaLines.join("\n")}
|
|
742
|
+
|
|
743
|
+
${noResultsMsg}`;
|
|
744
|
+
}
|
|
745
|
+
return noResultsMsg;
|
|
728
746
|
}
|
|
729
747
|
const toolsByServer = {};
|
|
730
748
|
for (const tool of tools) {
|
|
@@ -735,6 +753,20 @@ function formatSearchToolsAsTree(tools) {
|
|
|
735
753
|
toolsByServer[server].push(tool);
|
|
736
754
|
}
|
|
737
755
|
const lines = [];
|
|
756
|
+
if (meta) {
|
|
757
|
+
if (meta.total_tools !== void 0) {
|
|
758
|
+
lines.push(`Total tools: ${meta.total_tools}`);
|
|
759
|
+
}
|
|
760
|
+
if (meta.namespaces && meta.namespaces.length > 0) {
|
|
761
|
+
lines.push(`Namespaces: ${meta.namespaces.join(", ")}`);
|
|
762
|
+
}
|
|
763
|
+
if (meta.result_count !== void 0) {
|
|
764
|
+
lines.push(`Results: ${meta.result_count}`);
|
|
765
|
+
}
|
|
766
|
+
if (lines.length > 0) {
|
|
767
|
+
lines.push("");
|
|
768
|
+
}
|
|
769
|
+
}
|
|
738
770
|
const servers = Object.keys(toolsByServer).sort();
|
|
739
771
|
for (let i = 0; i < servers.length; i++) {
|
|
740
772
|
const server = servers[i];
|
|
@@ -749,11 +781,34 @@ function formatSearchToolsAsTree(tools) {
|
|
|
749
781
|
const isLastTool = j === serverTools.length - 1;
|
|
750
782
|
const indent = isLastServer ? " " : "\u2502 ";
|
|
751
783
|
const toolPrefix = isLastTool ? "\u2514\u2500" : "\u251C\u2500";
|
|
752
|
-
|
|
784
|
+
const toolLine = `${indent}${toolPrefix} ${tool.name}`;
|
|
785
|
+
lines.push(toolLine);
|
|
753
786
|
if (tool.description) {
|
|
754
|
-
|
|
787
|
+
const descAlign = isLastTool ? " " : "\u2502 ";
|
|
788
|
+
const descriptionIndent = `${indent}${descAlign}`;
|
|
789
|
+
const indentLength = stripAnsi(descriptionIndent).length;
|
|
790
|
+
const availableWidth = Math.max(40, TERMINAL_WIDTH - indentLength - 4);
|
|
791
|
+
const words = tool.description.split(/(\s+)/);
|
|
792
|
+
const wrappedLines = [];
|
|
793
|
+
let currentLine = "";
|
|
794
|
+
for (const word of words) {
|
|
795
|
+
const testLine = currentLine + word;
|
|
796
|
+
if (stripAnsi(testLine).length <= availableWidth) {
|
|
797
|
+
currentLine = testLine;
|
|
798
|
+
} else {
|
|
799
|
+
if (currentLine) {
|
|
800
|
+
wrappedLines.push(currentLine.trimEnd());
|
|
801
|
+
}
|
|
802
|
+
currentLine = word.trimStart();
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (currentLine) {
|
|
806
|
+
wrappedLines.push(currentLine.trimEnd());
|
|
807
|
+
}
|
|
808
|
+
for (const descLine of wrappedLines) {
|
|
809
|
+
lines.push(`${descriptionIndent}${import_chalk.default.dim(descLine)}`);
|
|
810
|
+
}
|
|
755
811
|
}
|
|
756
|
-
lines.push(toolLine);
|
|
757
812
|
}
|
|
758
813
|
}
|
|
759
814
|
return lines.join("\n");
|
|
@@ -797,6 +852,8 @@ function handleToolEnd(event) {
|
|
|
797
852
|
}
|
|
798
853
|
}
|
|
799
854
|
if (toolName === "search_tools") {
|
|
855
|
+
const toolInput = event.data?.input;
|
|
856
|
+
const query = toolInput?.query;
|
|
800
857
|
let actualContent = content;
|
|
801
858
|
if (typeof content === "object" && content !== null && !Array.isArray(content) && "content" in content) {
|
|
802
859
|
const innerContent = content.content;
|
|
@@ -810,8 +867,22 @@ function handleToolEnd(event) {
|
|
|
810
867
|
}
|
|
811
868
|
}
|
|
812
869
|
}
|
|
870
|
+
if (typeof actualContent === "object" && actualContent !== null && !Array.isArray(actualContent) && "results" in actualContent && Array.isArray(actualContent.results)) {
|
|
871
|
+
const results = actualContent.results;
|
|
872
|
+
const contentWithMeta = actualContent;
|
|
873
|
+
const meta = contentWithMeta.meta;
|
|
874
|
+
const treeStr = formatSearchToolsAsTree(results, meta, query);
|
|
875
|
+
const statusText = status === "success" ? import_chalk.default.green("Success") : import_chalk.default.red("Error");
|
|
876
|
+
const title2 = `${statusText}: ${toolName} - Result`;
|
|
877
|
+
printBox(treeStr, title2, void 0, false);
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
813
880
|
if (Array.isArray(actualContent)) {
|
|
814
|
-
const treeStr = formatSearchToolsAsTree(
|
|
881
|
+
const treeStr = formatSearchToolsAsTree(
|
|
882
|
+
actualContent,
|
|
883
|
+
void 0,
|
|
884
|
+
query
|
|
885
|
+
);
|
|
815
886
|
const statusText = status === "success" ? import_chalk.default.green("Success") : import_chalk.default.red("Error");
|
|
816
887
|
const title2 = `${statusText}: ${toolName} - Result`;
|
|
817
888
|
printBox(treeStr, title2, void 0, false);
|
package/dist/src/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BaseCodeExecutor } from "./executors/base.js";
|
|
2
|
-
export type { ExecutionResult, SearchToolsFunction, ToolNamespaceInfo, ToolSearchResult, } from "./executors/base.js";
|
|
2
|
+
export type { ExecutionResult, SearchToolsFunction, ToolNamespaceInfo, ToolSearchResult, ToolSearchMeta, ToolSearchResponse, } from "./executors/base.js";
|
|
3
3
|
export { E2BCodeExecutor } from "./executors/e2b.js";
|
|
4
4
|
export { VMCodeExecutor, isVMAvailable } from "./executors/vm.js";
|
|
5
5
|
export { BaseCodeExecutor as CodeExecutor } from "./executors/base.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeExecutor.d.ts","sourceRoot":"","sources":["../../../src/client/codeExecutor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"codeExecutor.d.ts","sourceRoot":"","sources":["../../../src/client/codeExecutor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -12,7 +12,16 @@ export interface ToolSearchResult {
|
|
|
12
12
|
description?: string;
|
|
13
13
|
input_schema?: Tool["inputSchema"];
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export interface ToolSearchMeta {
|
|
16
|
+
total_tools: number;
|
|
17
|
+
namespaces: string[];
|
|
18
|
+
result_count: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ToolSearchResponse {
|
|
21
|
+
meta: ToolSearchMeta;
|
|
22
|
+
results: ToolSearchResult[];
|
|
23
|
+
}
|
|
24
|
+
export type SearchToolsFunction = (query?: string, detailLevel?: "names" | "descriptions" | "full") => Promise<ToolSearchResponse>;
|
|
16
25
|
export interface ToolNamespaceInfo {
|
|
17
26
|
serverName: string;
|
|
18
27
|
tools: Tool[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/client/executors/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,MAAM,KAC5C,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/client/executors/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,MAAM,KAC5C,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;CACd;AAED;;;GAGG;AACH,8BAAsB,gBAAgB;IACpC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;IAC5B,SAAS,CAAC,WAAW,EAAE,OAAO,CAAS;gBAE3B,MAAM,EAAE,SAAS;IAI7B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAE1E;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAEjC;;;OAGG;cACa,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IA+BvD;;;OAGG;IACH,SAAS,CAAC,iBAAiB,IAAI,iBAAiB,EAAE;IA6BlD;;;OAGG;IACI,yBAAyB,IAAI,mBAAmB;CAoExD"}
|
package/dist/src/client.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare class MCPClient extends BaseMCPClient {
|
|
|
58
58
|
/**
|
|
59
59
|
* Search available tools (used by code mode)
|
|
60
60
|
*/
|
|
61
|
-
searchTools(query?: string, detailLevel?: "names" | "descriptions" | "full"): Promise<import("./client/codeExecutor.js").
|
|
61
|
+
searchTools(query?: string, detailLevel?: "names" | "descriptions" | "full"): Promise<import("./client/codeExecutor.js").ToolSearchResponse>;
|
|
62
62
|
/**
|
|
63
63
|
* Override getServerNames to exclude internal code_mode server
|
|
64
64
|
*/
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EACL,gBAAgB,EAGjB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,MAAM,MAAM,oBAAoB,GAAG,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9B,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,KAAK,CAAC;AAG5C,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAErE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,gBAAgB,GAAG,oBAAoB,GAAG,gBAAgB,CAAC;IACtE,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EA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AG,CAAC,EACrC,OAAO,CAAC,EAAE,gBAAgB;WAuCd,QAAQ,CACpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxB,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS;WAIE,cAAc,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS;IAIZ;;OAEG;IACI,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQzC;;;OAGG;IACH,SAAS,CAAC,yBAAyB,CACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,aAAa;IAIhB,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,mBAAmB;IAkE3B;;OAEG;IACU,WAAW,CACtB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC;IAc3B;;OAEG;IACU,WAAW,CACtB,KAAK,GAAE,MAAW,EAClB,WAAW,GAAE,OAAO,GAAG,cAAc,GAAG,MAAe,GACtD,OAAO,CAAC,OAAO,0BAA0B,EAAE,kBAAkB,CAAC;IAUjE;;OAEG;IACI,cAAc,IAAI,MAAM,EAAE;IAOjC;;;OAGG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAUpC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* ErrorBoundary that catches React errors and displays a friendly error message
|
|
4
|
+
*
|
|
5
|
+
* This component catches JavaScript errors anywhere in the child component tree,
|
|
6
|
+
* logs those errors, and displays a fallback UI instead of crashing the entire app.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ErrorBoundary extends React.Component<{
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}, {
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
}> {
|
|
14
|
+
constructor(props: {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
});
|
|
17
|
+
static getDerivedStateFromError(error: Error): {
|
|
18
|
+
hasError: boolean;
|
|
19
|
+
error: Error;
|
|
20
|
+
};
|
|
21
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
22
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/react/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAChD;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,EAC7B;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CAAE,CAC3C;gBACa,KAAK,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;IAKhD,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK;;;;IAI5C,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS;IAI1D,MAAM;CAcP"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Image component that automatically handles absolute paths using the MCP public URL.
|
|
4
|
+
*
|
|
5
|
+
* If the src starts with /, it will be prefixed with the MCP public URL (e.g. http://localhost:3000/mcp-use/public).
|
|
6
|
+
* If the src is already absolute (starts with http or data:), it will be used as is.
|
|
7
|
+
*
|
|
8
|
+
* @param props Standard img props
|
|
9
|
+
*/
|
|
10
|
+
export declare const Image: React.FC<React.ImgHTMLAttributes<globalThis.HTMLImageElement>>;
|
|
11
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/react/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAC1B,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAqCrD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface McpUseProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Enable debug button in WidgetControls component
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
debugger?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Enable view controls (fullscreen/pip) in WidgetControls component
|
|
11
|
+
* - `true` = show both pip and fullscreen buttons
|
|
12
|
+
* - `"pip"` = show only pip button
|
|
13
|
+
* - `"fullscreen"` = show only fullscreen button
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
viewControls?: boolean | "pip" | "fullscreen";
|
|
17
|
+
/**
|
|
18
|
+
* Automatically notify OpenAI about container height changes for auto-sizing
|
|
19
|
+
* Uses ResizeObserver to monitor the children container and calls window.openai.notifyIntrinsicHeight()
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
autoSize?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Unified provider component that combines all common React setup for mcp-use widgets.
|
|
26
|
+
*
|
|
27
|
+
* Includes:
|
|
28
|
+
* - StrictMode (always)
|
|
29
|
+
* - ThemeProvider (always)
|
|
30
|
+
* - BrowserRouter with automatic basename calculation (always)
|
|
31
|
+
* - WidgetControls (if debugger={true} or viewControls is set)
|
|
32
|
+
* - ErrorBoundary (always)
|
|
33
|
+
* - Auto-sizing (if autoSize={true})
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <McpUseProvider debugger viewControls autoSize>
|
|
38
|
+
* <AppsSDKUIProvider linkComponent={Link}>
|
|
39
|
+
* <div>My widget content</div>
|
|
40
|
+
* </AppsSDKUIProvider>
|
|
41
|
+
* </McpUseProvider>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function McpUseProvider({ children, debugger: enableDebugger, viewControls, autoSize, }: McpUseProviderProps): React.JSX.Element;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=McpUseProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpUseProvider.d.ts","sourceRoot":"","sources":["../../../src/react/McpUseProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAwB1E,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EAAE,cAAsB,EAChC,YAAoB,EACpB,QAAgB,GACjB,EAAE,mBAAmB,qBAkIrB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* ThemeProvider that manages dark mode class on document root
|
|
4
|
+
*
|
|
5
|
+
* Priority:
|
|
6
|
+
* 1. useWidget theme (from OpenAI Apps SDK)
|
|
7
|
+
* 2. System preference (prefers-color-scheme: dark)
|
|
8
|
+
*
|
|
9
|
+
* Sets the "dark" class on document.documentElement when dark mode is active
|
|
10
|
+
*/
|
|
11
|
+
export declare const ThemeProvider: React.FC<{
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/react/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAGpE;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CA4CjE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper component that adds control buttons for widget debugging and view controls.
|
|
3
|
+
* Combines debug button and view controls (fullscreen/pip) with shared hover logic.
|
|
4
|
+
*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
type Position = "top-left" | "top-center" | "top-right" | "center-left" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
7
|
+
interface WidgetControlsProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
position?: Position;
|
|
11
|
+
attachTo?: HTMLElement | null;
|
|
12
|
+
showLabels?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Enable debug button to display widget debug information
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
debugger?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Enable fullscreen and pip view controls
|
|
20
|
+
* - `true` = show both pip and fullscreen buttons
|
|
21
|
+
* - `"pip"` = show only pip button
|
|
22
|
+
* - `"fullscreen"` = show only fullscreen button
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
viewControls?: boolean | "pip" | "fullscreen";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Wrapper component that adds control buttons for widget debugging and view controls.
|
|
29
|
+
* All buttons share the same hover logic and are rendered together.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const MyWidget: React.FC = () => {
|
|
34
|
+
* return (
|
|
35
|
+
* <WidgetControls debugger viewControls position="top-right">
|
|
36
|
+
* <div>My widget content</div>
|
|
37
|
+
* </WidgetControls>
|
|
38
|
+
* );
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function WidgetControls({ children, className, position, attachTo, showLabels, debugger: enableDebugger, viewControls, }: WidgetControlsProps): React.JSX.Element;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=WidgetControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WidgetControls.d.ts","sourceRoot":"","sources":["../../../src/react/WidgetControls.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,KAAK,QAAQ,GACT,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;CAC/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAc,EACd,QAAsB,EACtB,QAAQ,EACR,UAAiB,EACjB,QAAQ,EAAE,cAAsB,EAChC,YAAoB,GACrB,EAAE,mBAAmB,qBAmrBrB"}
|