@gradio/core 0.26.0 → 0.27.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/CHANGELOG.md +41 -0
- package/dist/src/Blocks.svelte +12 -21
- package/dist/src/Blocks.svelte.d.ts +11 -9
- package/dist/src/Embed.svelte.d.ts +4 -2
- package/dist/src/Login.svelte.d.ts +2 -0
- package/dist/src/MountComponents.svelte.d.ts +3 -1
- package/dist/src/Render.svelte +12 -13
- package/dist/src/Render.svelte.d.ts +3 -1
- package/dist/src/RenderComponent.svelte +3 -6
- package/dist/src/RenderComponent.svelte.d.ts +2 -0
- package/dist/src/api_docs/ApiBanner.svelte.d.ts +3 -1
- package/dist/src/api_docs/ApiDocs.svelte +11 -15
- package/dist/src/api_docs/ApiDocs.svelte.d.ts +3 -1
- package/dist/src/api_docs/ApiRecorder.svelte.d.ts +3 -1
- package/dist/src/api_docs/CodeSnippet.svelte +2 -4
- package/dist/src/api_docs/CodeSnippet.svelte.d.ts +3 -1
- package/dist/src/api_docs/CopyButton.svelte.d.ts +2 -0
- package/dist/src/api_docs/EndpointDetail.svelte.d.ts +4 -2
- package/dist/src/api_docs/InputPayload.svelte.d.ts +2 -0
- package/dist/src/api_docs/InstallSnippet.svelte.d.ts +2 -0
- package/dist/src/api_docs/MCPSnippet.svelte +53 -37
- package/dist/src/api_docs/MCPSnippet.svelte.d.ts +12 -2
- package/dist/src/api_docs/NoApi.svelte.d.ts +2 -0
- package/dist/src/api_docs/ParametersSnippet.svelte.d.ts +2 -0
- package/dist/src/api_docs/RecordingSnippet.svelte.d.ts +4 -2
- package/dist/src/api_docs/ResponseSnippet.svelte.d.ts +2 -0
- package/dist/src/api_docs/Settings.svelte.d.ts +4 -2
- package/dist/src/api_docs/SettingsBanner.svelte.d.ts +2 -0
- package/dist/src/api_docs/TryButton.svelte.d.ts +2 -0
- package/dist/src/api_docs/img/clear.svelte.d.ts +2 -0
- package/dist/src/init.js +0 -3
- package/dist/src/stories/I18nMultiLanguageTestComponent.svelte.d.ts +3 -3
- package/dist/src/stories/I18nTestSetup.svelte +1 -2
- package/dist/src/stories/I18nTestSetup.svelte.d.ts +3 -1
- package/package.json +53 -53
- package/src/api_docs/ApiDocs.svelte +5 -0
- package/src/api_docs/MCPSnippet.svelte +36 -10
- package/src/init.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @gradio/core
|
|
2
2
|
|
|
3
|
+
## 0.27.1
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#11767](https://github.com/gradio-app/gradio/pull/11767) [`f67faa4`](https://github.com/gradio-app/gradio/commit/f67faa464add0ef6a4a58d60eb2ae850125ebb87) - Use icons instead of Emojis in MCP page. Thanks @freddyaboulton!
|
|
8
|
+
|
|
9
|
+
### Dependency updates
|
|
10
|
+
|
|
11
|
+
- @gradio/icons@0.13.1
|
|
12
|
+
- @gradio/upload@0.16.16
|
|
13
|
+
|
|
14
|
+
## 0.27.0
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- [#11723](https://github.com/gradio-app/gradio/pull/11723) [`379f0c1`](https://github.com/gradio-app/gradio/commit/379f0c151943b5f269910eba4a4c7abc6145a11c) - Support MCP resources and prompts. Thanks @abidlabs!
|
|
19
|
+
|
|
20
|
+
### Fixes
|
|
21
|
+
|
|
22
|
+
- [#11725](https://github.com/gradio-app/gradio/pull/11725) [`080f888`](https://github.com/gradio-app/gradio/commit/080f888e3b173b5b2deef5eaf9754f2a63adf1aa) - Ensure it is possible to use `@render` to generate Tabs. Thanks @aliabid94!
|
|
23
|
+
|
|
24
|
+
### Dependency updates
|
|
25
|
+
|
|
26
|
+
- @gradio/code@0.14.15
|
|
27
|
+
- @gradio/statustracker@0.10.17
|
|
28
|
+
- @gradio/paramviewer@0.7.15
|
|
29
|
+
- @gradio/atoms@0.16.5
|
|
30
|
+
- @gradio/column@0.2.1
|
|
31
|
+
- @gradio/client@1.17.1
|
|
32
|
+
- @gradio/icons@0.13.0
|
|
33
|
+
- @gradio/upload@0.16.15
|
|
34
|
+
- @gradio/image@0.22.17
|
|
35
|
+
- @gradio/dropdown@0.10.2
|
|
36
|
+
- @gradio/textbox@0.10.20
|
|
37
|
+
- @gradio/button@0.5.11
|
|
38
|
+
- @gradio/gallery@0.15.31
|
|
39
|
+
- @gradio/plot@0.9.22
|
|
40
|
+
- @gradio/checkbox@0.4.28
|
|
41
|
+
- @gradio/file@0.12.28
|
|
42
|
+
- @gradio/video@0.15.0
|
|
43
|
+
|
|
3
44
|
## 0.26.0
|
|
4
45
|
|
|
5
46
|
### Features
|
package/dist/src/Blocks.svelte
CHANGED
|
@@ -53,17 +53,15 @@ let {
|
|
|
53
53
|
} = create_components({
|
|
54
54
|
initial_layout
|
|
55
55
|
});
|
|
56
|
-
$:
|
|
57
|
-
components, layout, dependencies, root, app, fill_height, target, run();
|
|
56
|
+
$: components, layout, dependencies, root, app, fill_height, target, run();
|
|
58
57
|
$: {
|
|
59
58
|
ready = !!$_layout;
|
|
60
59
|
}
|
|
61
60
|
let old_dependencies = dependencies;
|
|
62
|
-
$:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
61
|
+
$: if (dependencies !== old_dependencies && render_complete && !layout_creating) {
|
|
62
|
+
handle_load_triggers();
|
|
63
|
+
old_dependencies = dependencies;
|
|
64
|
+
}
|
|
67
65
|
let vibe_editor_width = 350;
|
|
68
66
|
async function run() {
|
|
69
67
|
await setupi18n(app.config?.i18n_translations || void 0);
|
|
@@ -94,10 +92,8 @@ async function loadApiDocs() {
|
|
|
94
92
|
if (!ApiDocs || !ApiRecorder) {
|
|
95
93
|
const api_docs_module = await import("./api_docs/ApiDocs.svelte");
|
|
96
94
|
const api_recorder_module = await import("./api_docs/ApiRecorder.svelte");
|
|
97
|
-
if (!ApiDocs)
|
|
98
|
-
|
|
99
|
-
if (!ApiRecorder)
|
|
100
|
-
ApiRecorder = api_recorder_module.default;
|
|
95
|
+
if (!ApiDocs) ApiDocs = api_docs_module.default;
|
|
96
|
+
if (!ApiRecorder) ApiRecorder = api_recorder_module.default;
|
|
101
97
|
}
|
|
102
98
|
}
|
|
103
99
|
async function loadApiRecorder() {
|
|
@@ -405,8 +401,7 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
|
|
|
405
401
|
);
|
|
406
402
|
} catch (e) {
|
|
407
403
|
const fn_index = 0;
|
|
408
|
-
if (app.closed)
|
|
409
|
-
return;
|
|
404
|
+
if (app.closed) return;
|
|
410
405
|
messages = [
|
|
411
406
|
new_message("Error", String(e), fn_index, "error"),
|
|
412
407
|
...messages
|
|
@@ -637,11 +632,9 @@ async function handle_mount() {
|
|
|
637
632
|
a[i].setAttribute("target", "_blank");
|
|
638
633
|
}
|
|
639
634
|
handle_load_triggers();
|
|
640
|
-
if (!target || render_complete)
|
|
641
|
-
return;
|
|
635
|
+
if (!target || render_complete) return;
|
|
642
636
|
target.addEventListener("prop_change", (e) => {
|
|
643
|
-
if (!isCustomEvent(e))
|
|
644
|
-
throw new Error("not a custom event");
|
|
637
|
+
if (!isCustomEvent(e)) throw new Error("not a custom event");
|
|
645
638
|
const { id, prop, value } = e.detail;
|
|
646
639
|
update_value([{ id, prop, value }]);
|
|
647
640
|
if (prop === "input_ready" && value === false) {
|
|
@@ -652,8 +645,7 @@ async function handle_mount() {
|
|
|
652
645
|
}
|
|
653
646
|
});
|
|
654
647
|
target.addEventListener("gradio", (e) => {
|
|
655
|
-
if (!isCustomEvent(e))
|
|
656
|
-
throw new Error("not a custom event");
|
|
648
|
+
if (!isCustomEvent(e)) throw new Error("not a custom event");
|
|
657
649
|
const { id, event, data } = e.detail;
|
|
658
650
|
if (event === "share") {
|
|
659
651
|
const { title: title2, description } = data;
|
|
@@ -701,8 +693,7 @@ const handle_load_triggers = () => {
|
|
|
701
693
|
}
|
|
702
694
|
});
|
|
703
695
|
};
|
|
704
|
-
$:
|
|
705
|
-
set_status($loading_status);
|
|
696
|
+
$: set_status($loading_status);
|
|
706
697
|
function update_status(id, status, data) {
|
|
707
698
|
data.status = status;
|
|
708
699
|
update_value([
|
|
@@ -9,34 +9,36 @@ declare const __propDef: {
|
|
|
9
9
|
components: ComponentMeta[];
|
|
10
10
|
layout: LayoutNode;
|
|
11
11
|
dependencies: Dependency[];
|
|
12
|
-
title?: string
|
|
12
|
+
title?: string;
|
|
13
13
|
target: HTMLElement;
|
|
14
14
|
autoscroll: boolean;
|
|
15
|
-
show_api?: boolean
|
|
16
|
-
show_footer?: boolean
|
|
17
|
-
control_page_title?: boolean
|
|
15
|
+
show_api?: boolean;
|
|
16
|
+
show_footer?: boolean;
|
|
17
|
+
control_page_title?: boolean;
|
|
18
18
|
app_mode: boolean;
|
|
19
19
|
theme_mode: ThemeMode;
|
|
20
20
|
app: Awaited<ReturnType<typeof Client.connect>>;
|
|
21
21
|
space_id: string | null;
|
|
22
22
|
version: string;
|
|
23
23
|
js: string | null;
|
|
24
|
-
fill_height?: boolean
|
|
24
|
+
fill_height?: boolean;
|
|
25
25
|
ready: boolean;
|
|
26
26
|
username: string | null;
|
|
27
|
-
api_prefix?: string
|
|
27
|
+
api_prefix?: string;
|
|
28
28
|
max_file_size?: number | undefined;
|
|
29
29
|
initial_layout?: ComponentMeta | undefined;
|
|
30
30
|
css?: string | null | undefined;
|
|
31
|
-
vibe_mode?: boolean
|
|
31
|
+
vibe_mode?: boolean;
|
|
32
32
|
search_params: URLSearchParams;
|
|
33
|
-
render_complete?: boolean
|
|
34
|
-
add_new_message?: (
|
|
33
|
+
render_complete?: boolean;
|
|
34
|
+
add_new_message?: (title: string, message: string, type: ToastMessage["type"]) => void;
|
|
35
35
|
};
|
|
36
36
|
events: {
|
|
37
37
|
[evt: string]: CustomEvent<any>;
|
|
38
38
|
};
|
|
39
39
|
slots: {};
|
|
40
|
+
exports?: {} | undefined;
|
|
41
|
+
bindings?: string | undefined;
|
|
40
42
|
};
|
|
41
43
|
export type BlocksProps = typeof __propDef.props;
|
|
42
44
|
export type BlocksEvents = typeof __propDef.events;
|
|
@@ -11,8 +11,8 @@ declare const __propDef: {
|
|
|
11
11
|
display: boolean;
|
|
12
12
|
info: boolean;
|
|
13
13
|
loaded: boolean;
|
|
14
|
-
pages?: [string, string][]
|
|
15
|
-
current_page?: string
|
|
14
|
+
pages?: [string, string][];
|
|
15
|
+
current_page?: string;
|
|
16
16
|
root: string;
|
|
17
17
|
};
|
|
18
18
|
events: {
|
|
@@ -21,6 +21,8 @@ declare const __propDef: {
|
|
|
21
21
|
slots: {
|
|
22
22
|
default: {};
|
|
23
23
|
};
|
|
24
|
+
exports?: {} | undefined;
|
|
25
|
+
bindings?: string | undefined;
|
|
24
26
|
};
|
|
25
27
|
export type EmbedProps = typeof __propDef.props;
|
|
26
28
|
export type EmbedEvents = typeof __propDef.events;
|
|
@@ -8,7 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
theme_mode: any;
|
|
9
9
|
version: any;
|
|
10
10
|
autoscroll: boolean;
|
|
11
|
-
max_file_size?:
|
|
11
|
+
max_file_size?: number | null;
|
|
12
12
|
client: Client;
|
|
13
13
|
};
|
|
14
14
|
events: {
|
|
@@ -17,6 +17,8 @@ declare const __propDef: {
|
|
|
17
17
|
[evt: string]: CustomEvent<any>;
|
|
18
18
|
};
|
|
19
19
|
slots: {};
|
|
20
|
+
exports?: {} | undefined;
|
|
21
|
+
bindings?: string | undefined;
|
|
20
22
|
};
|
|
21
23
|
export type MountComponentsProps = typeof __propDef.props;
|
|
22
24
|
export type MountComponentsEvents = typeof __propDef.events;
|
package/dist/src/Render.svelte
CHANGED
|
@@ -48,19 +48,18 @@ $: {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
$:
|
|
52
|
-
node.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
51
|
+
$: node.props.gradio = new Gradio(
|
|
52
|
+
node.id,
|
|
53
|
+
target,
|
|
54
|
+
theme_mode,
|
|
55
|
+
version,
|
|
56
|
+
root,
|
|
57
|
+
autoscroll,
|
|
58
|
+
max_file_size,
|
|
59
|
+
$reactive_formatter,
|
|
60
|
+
client,
|
|
61
|
+
load_component
|
|
62
|
+
);
|
|
64
63
|
</script>
|
|
65
64
|
|
|
66
65
|
{#if node.component}
|
|
@@ -5,7 +5,7 @@ declare const __propDef: {
|
|
|
5
5
|
props: {
|
|
6
6
|
root: string;
|
|
7
7
|
node: ComponentMeta;
|
|
8
|
-
parent?:
|
|
8
|
+
parent?: string | null;
|
|
9
9
|
target: HTMLElement;
|
|
10
10
|
theme_mode: ThemeMode;
|
|
11
11
|
version: string;
|
|
@@ -20,6 +20,8 @@ declare const __propDef: {
|
|
|
20
20
|
[evt: string]: CustomEvent<any>;
|
|
21
21
|
};
|
|
22
22
|
slots: {};
|
|
23
|
+
exports?: {} | undefined;
|
|
24
|
+
bindings?: string | undefined;
|
|
23
25
|
};
|
|
24
26
|
export type RenderProps = typeof __propDef.props;
|
|
25
27
|
export type RenderEvents = typeof __propDef.events;
|
|
@@ -20,8 +20,7 @@ function wrap(component2) {
|
|
|
20
20
|
const props = Object.keys(instance2.$$.props);
|
|
21
21
|
function report(props2) {
|
|
22
22
|
return function(propargs) {
|
|
23
|
-
if (!target)
|
|
24
|
-
return;
|
|
23
|
+
if (!target) return;
|
|
25
24
|
const ev = s(_id, props2, propargs);
|
|
26
25
|
target.dispatchEvent(ev);
|
|
27
26
|
};
|
|
@@ -50,10 +49,8 @@ function translate_prop(obj) {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
|
-
$:
|
|
54
|
-
|
|
55
|
-
$:
|
|
56
|
-
value = translate_if_needed(value);
|
|
52
|
+
$: translate_prop($$restProps);
|
|
53
|
+
$: value = translate_if_needed(value);
|
|
57
54
|
</script>
|
|
58
55
|
|
|
59
56
|
{#if visible}
|
|
@@ -3,7 +3,7 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
root: string;
|
|
5
5
|
api_count: number;
|
|
6
|
-
current_language?:
|
|
6
|
+
current_language?: "python" | "javascript" | "bash" | "mcp";
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
9
9
|
close: CustomEvent<any>;
|
|
@@ -11,6 +11,8 @@ declare const __propDef: {
|
|
|
11
11
|
[evt: string]: CustomEvent<any>;
|
|
12
12
|
};
|
|
13
13
|
slots: {};
|
|
14
|
+
exports?: {} | undefined;
|
|
15
|
+
bindings?: string | undefined;
|
|
14
16
|
};
|
|
15
17
|
export type ApiBannerProps = typeof __propDef.props;
|
|
16
18
|
export type ApiBannerEvents = typeof __propDef.events;
|
|
@@ -76,22 +76,17 @@ get_js_info().then((js_api_info) => {
|
|
|
76
76
|
js_info = js_api_info;
|
|
77
77
|
});
|
|
78
78
|
const dispatch = createEventDispatcher();
|
|
79
|
-
$:
|
|
80
|
-
|
|
81
|
-
$:
|
|
82
|
-
|
|
83
|
-
$:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (mcp_json_sse && selected_tools.size > 0) {
|
|
89
|
-
const baseUrl = selected_tools_array.length > 0 && selected_tools_array.length < tools.length ? `${root}gradio_api/mcp/sse?tools=${selected_tools_without_prefix.join(",")}` : `${root}gradio_api/mcp/sse`;
|
|
90
|
-
mcp_json_sse.mcpServers.gradio.url = baseUrl;
|
|
91
|
-
if (mcp_json_stdio) {
|
|
92
|
-
mcp_json_stdio.mcpServers.gradio.args[1] = baseUrl;
|
|
93
|
-
}
|
|
79
|
+
$: selected_tools_array = Array.from(selected_tools);
|
|
80
|
+
$: selected_tools_without_prefix = selected_tools_array.map(remove_tool_prefix);
|
|
81
|
+
$: mcp_server_url = `${root}gradio_api/mcp/sse`;
|
|
82
|
+
$: mcp_server_url_streamable = selected_tools_array.length > 0 && selected_tools_array.length < tools.length ? `${root}gradio_api/mcp/?tools=${selected_tools_without_prefix.join(",")}` : `${root}gradio_api/mcp/`;
|
|
83
|
+
$: if (mcp_json_sse && selected_tools.size > 0) {
|
|
84
|
+
const baseUrl = selected_tools_array.length > 0 && selected_tools_array.length < tools.length ? `${root}gradio_api/mcp/sse?tools=${selected_tools_without_prefix.join(",")}` : `${root}gradio_api/mcp/sse`;
|
|
85
|
+
mcp_json_sse.mcpServers.gradio.url = baseUrl;
|
|
86
|
+
if (mcp_json_stdio) {
|
|
87
|
+
mcp_json_stdio.mcpServers.gradio.args[1] = baseUrl;
|
|
94
88
|
}
|
|
89
|
+
}
|
|
95
90
|
let tools = [];
|
|
96
91
|
let headers = [];
|
|
97
92
|
let mcp_json_sse;
|
|
@@ -126,6 +121,7 @@ async function fetch_mcp_tools() {
|
|
|
126
121
|
name: tool.name,
|
|
127
122
|
description: tool.description || "",
|
|
128
123
|
parameters: tool.inputSchema?.properties || {},
|
|
124
|
+
meta: tool.meta,
|
|
129
125
|
expanded: false
|
|
130
126
|
}));
|
|
131
127
|
selected_tools = new Set(tools.map((tool) => tool.name));
|
|
@@ -10,7 +10,7 @@ declare const __propDef: {
|
|
|
10
10
|
space_id: string | null;
|
|
11
11
|
root_node: ComponentMeta;
|
|
12
12
|
username: string | null;
|
|
13
|
-
api_calls?: Payload[]
|
|
13
|
+
api_calls?: Payload[];
|
|
14
14
|
};
|
|
15
15
|
events: {
|
|
16
16
|
close: CustomEvent<any>;
|
|
@@ -18,6 +18,8 @@ declare const __propDef: {
|
|
|
18
18
|
[evt: string]: CustomEvent<any>;
|
|
19
19
|
};
|
|
20
20
|
slots: {};
|
|
21
|
+
exports?: {} | undefined;
|
|
22
|
+
bindings?: string | undefined;
|
|
21
23
|
};
|
|
22
24
|
export type ApiDocsProps = typeof __propDef.props;
|
|
23
25
|
export type ApiDocsEvents = typeof __propDef.events;
|
|
@@ -2,13 +2,15 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { Payload, Dependency } from "../types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
api_calls?: Payload[]
|
|
5
|
+
api_calls?: Payload[];
|
|
6
6
|
dependencies: Dependency[];
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
export type ApiRecorderProps = typeof __propDef.props;
|
|
14
16
|
export type ApiRecorderEvents = typeof __propDef.events;
|
|
@@ -21,10 +21,8 @@ let blob_components = ["Audio", "File", "Image", "Video"];
|
|
|
21
21
|
let blob_examples = endpoint_parameters.filter(
|
|
22
22
|
(param) => blob_components.includes(param.component)
|
|
23
23
|
);
|
|
24
|
-
$:
|
|
25
|
-
|
|
26
|
-
$:
|
|
27
|
-
normalised_root = root.replace(/\/$/, "");
|
|
24
|
+
$: normalised_api_prefix = api_prefix ? api_prefix : "/";
|
|
25
|
+
$: normalised_root = root.replace(/\/$/, "");
|
|
28
26
|
</script>
|
|
29
27
|
|
|
30
28
|
<div class="container">
|
|
@@ -9,12 +9,14 @@ declare const __propDef: {
|
|
|
9
9
|
endpoint_parameters: any;
|
|
10
10
|
username: string | null;
|
|
11
11
|
current_language: "python" | "javascript" | "bash";
|
|
12
|
-
api_description?:
|
|
12
|
+
api_description?: string | null;
|
|
13
13
|
};
|
|
14
14
|
events: {
|
|
15
15
|
[evt: string]: CustomEvent<any>;
|
|
16
16
|
};
|
|
17
17
|
slots: {};
|
|
18
|
+
exports?: {} | undefined;
|
|
19
|
+
bindings?: string | undefined;
|
|
18
20
|
};
|
|
19
21
|
export type CodeSnippetProps = typeof __propDef.props;
|
|
20
22
|
export type CodeSnippetEvents = typeof __propDef.events;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
api_name?:
|
|
5
|
-
description?:
|
|
4
|
+
api_name?: string | null;
|
|
5
|
+
description?: string | null;
|
|
6
6
|
};
|
|
7
7
|
events: {
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
9
9
|
};
|
|
10
10
|
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
11
13
|
};
|
|
12
14
|
export type EndpointDetailProps = typeof __propDef.props;
|
|
13
15
|
export type EndpointDetailEvents = typeof __propDef.events;
|
|
@@ -15,6 +15,8 @@ declare const __propDef: {
|
|
|
15
15
|
[evt: string]: CustomEvent<any>;
|
|
16
16
|
};
|
|
17
17
|
slots: {};
|
|
18
|
+
exports?: {} | undefined;
|
|
19
|
+
bindings?: string | undefined;
|
|
18
20
|
};
|
|
19
21
|
export type InputPayloadProps = typeof __propDef.props;
|
|
20
22
|
export type InputPayloadEvents = typeof __propDef.events;
|
|
@@ -7,6 +7,8 @@ declare const __propDef: {
|
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
8
8
|
};
|
|
9
9
|
slots: {};
|
|
10
|
+
exports?: {} | undefined;
|
|
11
|
+
bindings?: string | undefined;
|
|
10
12
|
};
|
|
11
13
|
export type InstallSnippetProps = typeof __propDef.props;
|
|
12
14
|
export type InstallSnippetEvents = typeof __propDef.events;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>import { Block } from "@gradio/atoms";
|
|
2
2
|
import CopyButton from "./CopyButton.svelte";
|
|
3
|
+
import { Tool, Prompt, Resource } from "@gradio/icons";
|
|
3
4
|
export let mcp_server_active;
|
|
4
5
|
export let mcp_server_url;
|
|
5
6
|
export let mcp_server_url_streamable;
|
|
@@ -17,11 +18,14 @@ const transports = [
|
|
|
17
18
|
["sse", "SSE"],
|
|
18
19
|
["stdio", "STDIO"]
|
|
19
20
|
];
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const tool_type_icons = {
|
|
22
|
+
tool: Tool,
|
|
23
|
+
resource: Resource,
|
|
24
|
+
prompt: Prompt
|
|
25
|
+
};
|
|
26
|
+
$: display_url = current_transport === "sse" ? mcp_server_url : mcp_server_url_streamable;
|
|
22
27
|
function update_config_with_file_upload(base_config, include_upload) {
|
|
23
|
-
if (!base_config)
|
|
24
|
-
return null;
|
|
28
|
+
if (!base_config) return null;
|
|
25
29
|
const config = JSON.parse(JSON.stringify(base_config));
|
|
26
30
|
if (include_upload && file_data_present) {
|
|
27
31
|
const upload_file_mcp_server = {
|
|
@@ -41,30 +45,27 @@ function update_config_with_file_upload(base_config, include_upload) {
|
|
|
41
45
|
}
|
|
42
46
|
return config;
|
|
43
47
|
}
|
|
44
|
-
$:
|
|
45
|
-
|
|
46
|
-
mcp_json_sse
|
|
47
|
-
|
|
48
|
-
mcpServers
|
|
49
|
-
|
|
50
|
-
gradio
|
|
51
|
-
|
|
52
|
-
url: mcp_server_url_streamable
|
|
53
|
-
}
|
|
48
|
+
$: mcp_json_streamable_http = update_config_with_file_upload(
|
|
49
|
+
mcp_json_sse ? {
|
|
50
|
+
...mcp_json_sse,
|
|
51
|
+
mcpServers: {
|
|
52
|
+
...mcp_json_sse.mcpServers,
|
|
53
|
+
gradio: {
|
|
54
|
+
...mcp_json_sse.mcpServers.gradio,
|
|
55
|
+
url: mcp_server_url_streamable
|
|
54
56
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
$:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
);
|
|
57
|
+
}
|
|
58
|
+
} : null,
|
|
59
|
+
include_file_upload
|
|
60
|
+
);
|
|
61
|
+
$: mcp_json_sse_updated = update_config_with_file_upload(
|
|
62
|
+
mcp_json_sse,
|
|
63
|
+
include_file_upload
|
|
64
|
+
);
|
|
65
|
+
$: mcp_json_stdio_updated = update_config_with_file_upload(
|
|
66
|
+
mcp_json_stdio,
|
|
67
|
+
include_file_upload
|
|
68
|
+
);
|
|
68
69
|
</script>
|
|
69
70
|
|
|
70
71
|
{#if mcp_server_active}
|
|
@@ -104,9 +105,15 @@ $:
|
|
|
104
105
|
{/if}
|
|
105
106
|
|
|
106
107
|
<div class="tool-selection">
|
|
107
|
-
<strong
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
<strong>
|
|
109
|
+
{all_tools.length > 0 ? all_tools.length : tools.length} Available MCP Tools
|
|
110
|
+
(<span style="display: inline-block; vertical-align: sub;"><Tool /></span
|
|
111
|
+
>), Resources (<span style="display: inline-block; vertical-align: sub;"
|
|
112
|
+
><Resource /></span
|
|
113
|
+
>), and Prompts (<span style="display: inline-block; vertical-align: sub;"
|
|
114
|
+
><Prompt /></span
|
|
115
|
+
>)
|
|
116
|
+
</strong>
|
|
110
117
|
{#if all_tools.length > 0}
|
|
111
118
|
<div class="tool-selection-controls">
|
|
112
119
|
<button
|
|
@@ -156,14 +163,23 @@ $:
|
|
|
156
163
|
class="tool-header"
|
|
157
164
|
on:click={() => (tool.expanded = !tool.expanded)}
|
|
158
165
|
>
|
|
159
|
-
<span
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
166
|
+
<span style="display: inline-block">
|
|
167
|
+
<span
|
|
168
|
+
style="display: inline-block; padding-right: 6px; vertical-align: sub"
|
|
169
|
+
>
|
|
170
|
+
{#if tool_type_icons[tool.meta.mcp_type]}
|
|
171
|
+
{@const Icon = tool_type_icons[tool.meta.mcp_type]}
|
|
172
|
+
<Icon />
|
|
173
|
+
{/if}
|
|
174
|
+
</span>
|
|
175
|
+
<span class="tool-name">{tool.name}</span>
|
|
176
|
+
|
|
177
|
+
<span class="tool-description">
|
|
178
|
+
{tool.description
|
|
163
179
|
? tool.description
|
|
164
|
-
: "⚠︎ No description provided in function docstring"}
|
|
165
|
-
|
|
166
|
-
>
|
|
180
|
+
: "⚠︎ No description provided in function docstring"}
|
|
181
|
+
</span>
|
|
182
|
+
</span>
|
|
167
183
|
<span class="tool-arrow">{tool.expanded ? "▼" : "▶"}</span>
|
|
168
184
|
</button>
|
|
169
185
|
</div>
|
|
@@ -15,6 +15,10 @@ declare const __propDef: {
|
|
|
15
15
|
default?: any;
|
|
16
16
|
}>;
|
|
17
17
|
expanded?: boolean;
|
|
18
|
+
meta: {
|
|
19
|
+
mcp_type: "tool" | "resource" | "prompt";
|
|
20
|
+
file_data_present: boolean;
|
|
21
|
+
};
|
|
18
22
|
}[];
|
|
19
23
|
all_tools?: {
|
|
20
24
|
name: string;
|
|
@@ -27,8 +31,12 @@ declare const __propDef: {
|
|
|
27
31
|
default?: any;
|
|
28
32
|
}>;
|
|
29
33
|
expanded?: boolean;
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
meta: {
|
|
35
|
+
mcp_type: "tool" | "resource" | "prompt";
|
|
36
|
+
file_data_present: boolean;
|
|
37
|
+
};
|
|
38
|
+
}[];
|
|
39
|
+
selected_tools?: Set<string>;
|
|
32
40
|
mcp_json_sse: any;
|
|
33
41
|
mcp_json_stdio: any;
|
|
34
42
|
file_data_present: boolean;
|
|
@@ -38,6 +46,8 @@ declare const __propDef: {
|
|
|
38
46
|
[evt: string]: CustomEvent<any>;
|
|
39
47
|
};
|
|
40
48
|
slots: {};
|
|
49
|
+
exports?: {} | undefined;
|
|
50
|
+
bindings?: string | undefined;
|
|
41
51
|
};
|
|
42
52
|
export type McpSnippetProps = typeof __propDef.props;
|
|
43
53
|
export type McpSnippetEvents = typeof __propDef.events;
|
|
@@ -10,6 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
export type ParametersSnippetProps = typeof __propDef.props;
|
|
15
17
|
export type ParametersSnippetEvents = typeof __propDef.events;
|
|
@@ -5,15 +5,17 @@ declare const __propDef: {
|
|
|
5
5
|
dependencies: Dependency[];
|
|
6
6
|
short_root: string;
|
|
7
7
|
root: string;
|
|
8
|
-
api_prefix?: string
|
|
8
|
+
api_prefix?: string;
|
|
9
9
|
current_language: "python" | "javascript" | "bash" | "mcp";
|
|
10
10
|
username: string | null;
|
|
11
|
-
api_calls?: Payload[]
|
|
11
|
+
api_calls?: Payload[];
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
14
14
|
[evt: string]: CustomEvent<any>;
|
|
15
15
|
};
|
|
16
16
|
slots: {};
|
|
17
|
+
exports?: {} | undefined;
|
|
18
|
+
bindings?: string | undefined;
|
|
17
19
|
};
|
|
18
20
|
export type RecordingSnippetProps = typeof __propDef.props;
|
|
19
21
|
export type RecordingSnippetEvents = typeof __propDef.events;
|
|
@@ -10,6 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
export type ResponseSnippetProps = typeof __propDef.props;
|
|
15
17
|
export type ResponseSnippetEvents = typeof __propDef.events;
|
|
@@ -4,8 +4,8 @@ declare const __propDef: {
|
|
|
4
4
|
root: string;
|
|
5
5
|
space_id: string | null;
|
|
6
6
|
pwa_enabled: boolean | undefined;
|
|
7
|
-
allow_zoom?: boolean
|
|
8
|
-
allow_video_trim?: boolean
|
|
7
|
+
allow_zoom?: boolean;
|
|
8
|
+
allow_video_trim?: boolean;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
11
|
close: CustomEvent<any>;
|
|
@@ -14,6 +14,8 @@ declare const __propDef: {
|
|
|
14
14
|
[evt: string]: CustomEvent<any>;
|
|
15
15
|
};
|
|
16
16
|
slots: {};
|
|
17
|
+
exports?: {} | undefined;
|
|
18
|
+
bindings?: string | undefined;
|
|
17
19
|
};
|
|
18
20
|
export type SettingsProps = typeof __propDef.props;
|
|
19
21
|
export type SettingsEvents = typeof __propDef.events;
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
export type SettingsBannerProps = typeof __propDef.props;
|
|
14
16
|
export type SettingsBannerEvents = typeof __propDef.events;
|
package/dist/src/init.js
CHANGED
|
@@ -104,9 +104,6 @@ export function create_components({ initial_layout = undefined } = {
|
|
|
104
104
|
* Rerender the layout when the config has been modified to attach new components
|
|
105
105
|
*/
|
|
106
106
|
function rerender_layout({ render_id, components, layout, root, dependencies }) {
|
|
107
|
-
// Update current layout and root for dynamic visibility recalculation
|
|
108
|
-
current_layout = layout;
|
|
109
|
-
current_root = root;
|
|
110
107
|
components.forEach((c) => {
|
|
111
108
|
for (const prop in c.props) {
|
|
112
109
|
if (c.props[prop] === null) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
|
-
props:
|
|
4
|
-
[x: string]: never;
|
|
5
|
-
};
|
|
3
|
+
props: Record<string, never>;
|
|
6
4
|
events: {
|
|
7
5
|
[evt: string]: CustomEvent<any>;
|
|
8
6
|
};
|
|
9
7
|
slots: {};
|
|
8
|
+
exports?: {} | undefined;
|
|
9
|
+
bindings?: string | undefined;
|
|
10
10
|
};
|
|
11
11
|
export type I18nMultiLanguageTestComponentProps = typeof __propDef.props;
|
|
12
12
|
export type I18nMultiLanguageTestComponentEvents = typeof __propDef.events;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
active?: boolean
|
|
4
|
+
active?: boolean;
|
|
5
5
|
};
|
|
6
6
|
events: {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
8
8
|
};
|
|
9
9
|
slots: {};
|
|
10
|
+
exports?: {} | undefined;
|
|
11
|
+
bindings?: string | undefined;
|
|
10
12
|
};
|
|
11
13
|
export type I18nTestSetupProps = typeof __propDef.props;
|
|
12
14
|
export type I18nTestSetupEvents = typeof __propDef.events;
|
package/package.json
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@gradio/accordion": "^0.5.
|
|
7
|
-
"@gradio/annotatedimage": "^0.9.
|
|
8
|
-
"@gradio/
|
|
9
|
-
"@gradio/box": "^0.2.
|
|
10
|
-
"@gradio/
|
|
6
|
+
"@gradio/accordion": "^0.5.22",
|
|
7
|
+
"@gradio/annotatedimage": "^0.9.29",
|
|
8
|
+
"@gradio/atoms": "^0.16.5",
|
|
9
|
+
"@gradio/box": "^0.2.23",
|
|
10
|
+
"@gradio/audio": "^0.17.25",
|
|
11
11
|
"@gradio/browserstate": "^0.3.2",
|
|
12
|
-
"@gradio/button": "^0.5.
|
|
13
|
-
"@gradio/chatbot": "^0.26.
|
|
14
|
-
"@gradio/checkbox": "^0.4.
|
|
15
|
-
"@gradio/checkboxgroup": "^0.6.
|
|
16
|
-
"@gradio/client": "^1.17.
|
|
17
|
-
"@gradio/code": "^0.14.
|
|
18
|
-
"@gradio/colorpicker": "^0.4.
|
|
19
|
-
"@gradio/dataframe": "^0.18.7",
|
|
20
|
-
"@gradio/dataset": "^0.4.31",
|
|
12
|
+
"@gradio/button": "^0.5.11",
|
|
13
|
+
"@gradio/chatbot": "^0.26.22",
|
|
14
|
+
"@gradio/checkbox": "^0.4.28",
|
|
15
|
+
"@gradio/checkboxgroup": "^0.6.27",
|
|
16
|
+
"@gradio/client": "^1.17.1",
|
|
17
|
+
"@gradio/code": "^0.14.15",
|
|
18
|
+
"@gradio/colorpicker": "^0.4.27",
|
|
21
19
|
"@gradio/column": "^0.2.1",
|
|
22
|
-
"@gradio/
|
|
23
|
-
"@gradio/
|
|
24
|
-
"@gradio/
|
|
25
|
-
"@gradio/
|
|
26
|
-
"@gradio/
|
|
27
|
-
"@gradio/
|
|
28
|
-
"@gradio/
|
|
29
|
-
"@gradio/
|
|
30
|
-
"@gradio/
|
|
20
|
+
"@gradio/dataframe": "^0.19.0",
|
|
21
|
+
"@gradio/dataset": "^0.4.32",
|
|
22
|
+
"@gradio/datetime": "^0.3.20",
|
|
23
|
+
"@gradio/downloadbutton": "^0.4.11",
|
|
24
|
+
"@gradio/fallback": "^0.4.27",
|
|
25
|
+
"@gradio/file": "^0.12.28",
|
|
26
|
+
"@gradio/dropdown": "^0.10.2",
|
|
27
|
+
"@gradio/fileexplorer": "^0.5.39",
|
|
28
|
+
"@gradio/form": "^0.2.23",
|
|
29
|
+
"@gradio/gallery": "^0.15.31",
|
|
31
30
|
"@gradio/group": "^0.2.0",
|
|
32
|
-
"@gradio/highlightedtext": "^0.9.
|
|
33
|
-
"@gradio/
|
|
34
|
-
"@gradio/image": "^0.22.
|
|
35
|
-
"@gradio/
|
|
36
|
-
"@gradio/
|
|
37
|
-
"@gradio/
|
|
38
|
-
"@gradio/json": "^0.5.
|
|
39
|
-
"@gradio/
|
|
40
|
-
"@gradio/
|
|
41
|
-
"@gradio/
|
|
42
|
-
"@gradio/
|
|
43
|
-
"@gradio/
|
|
44
|
-
"@gradio/
|
|
45
|
-
"@gradio/paramviewer": "^0.7.
|
|
46
|
-
"@gradio/
|
|
47
|
-
"@gradio/
|
|
31
|
+
"@gradio/highlightedtext": "^0.9.10",
|
|
32
|
+
"@gradio/html": "^0.7.0",
|
|
33
|
+
"@gradio/image": "^0.22.17",
|
|
34
|
+
"@gradio/icons": "^0.13.1",
|
|
35
|
+
"@gradio/imageeditor": "^0.16.5",
|
|
36
|
+
"@gradio/imageslider": "^0.2.13",
|
|
37
|
+
"@gradio/json": "^0.5.29",
|
|
38
|
+
"@gradio/label": "^0.5.19",
|
|
39
|
+
"@gradio/markdown": "^0.13.20",
|
|
40
|
+
"@gradio/model3d": "^0.14.25",
|
|
41
|
+
"@gradio/nativeplot": "^0.7.4",
|
|
42
|
+
"@gradio/number": "^0.6.4",
|
|
43
|
+
"@gradio/multimodaltextbox": "^0.10.17",
|
|
44
|
+
"@gradio/paramviewer": "^0.7.15",
|
|
45
|
+
"@gradio/plot": "^0.9.22",
|
|
46
|
+
"@gradio/radio": "^0.7.10",
|
|
48
47
|
"@gradio/row": "^0.2.1",
|
|
49
|
-
"@gradio/
|
|
50
|
-
"@gradio/
|
|
51
|
-
"@gradio/
|
|
52
|
-
"@gradio/
|
|
48
|
+
"@gradio/sidebar": "^0.1.20",
|
|
49
|
+
"@gradio/simpledropdown": "^0.3.27",
|
|
50
|
+
"@gradio/simpleimage": "^0.8.39",
|
|
51
|
+
"@gradio/simpletextbox": "^0.3.28",
|
|
52
|
+
"@gradio/sketchbox": "^0.6.15",
|
|
53
53
|
"@gradio/state": "^0.1.2",
|
|
54
|
-
"@gradio/
|
|
54
|
+
"@gradio/slider": "^0.6.16",
|
|
55
|
+
"@gradio/statustracker": "^0.10.17",
|
|
55
56
|
"@gradio/tabitem": "^0.5.0",
|
|
56
57
|
"@gradio/tabs": "^0.4.5",
|
|
57
|
-
"@gradio/textbox": "^0.10.
|
|
58
|
-
"@gradio/statustracker": "^0.10.16",
|
|
59
|
-
"@gradio/theme": "^0.4.0",
|
|
58
|
+
"@gradio/textbox": "^0.10.20",
|
|
60
59
|
"@gradio/timer": "^0.4.5",
|
|
61
|
-
"@gradio/
|
|
60
|
+
"@gradio/theme": "^0.4.0",
|
|
61
|
+
"@gradio/upload": "^0.16.16",
|
|
62
|
+
"@gradio/vibeeditor": "^0.2.2",
|
|
63
|
+
"@gradio/uploadbutton": "^0.9.11",
|
|
64
|
+
"@gradio/video": "^0.15.0",
|
|
62
65
|
"@gradio/utils": "^0.10.2",
|
|
63
|
-
"@gradio/
|
|
64
|
-
"@gradio/wasm": "^0.18.1",
|
|
65
|
-
"@gradio/vibeeditor": "^0.2.1",
|
|
66
|
-
"@gradio/video": "^0.14.24"
|
|
66
|
+
"@gradio/wasm": "^0.18.1"
|
|
67
67
|
},
|
|
68
68
|
"msw": {
|
|
69
69
|
"workerDirectory": "public"
|
|
@@ -145,6 +145,10 @@
|
|
|
145
145
|
description: string;
|
|
146
146
|
parameters: Record<string, ToolParameter>;
|
|
147
147
|
expanded?: boolean;
|
|
148
|
+
meta: {
|
|
149
|
+
mcp_type: "tool" | "resource" | "prompt";
|
|
150
|
+
file_data_present: boolean;
|
|
151
|
+
};
|
|
148
152
|
}
|
|
149
153
|
|
|
150
154
|
let tools: Tool[] = [];
|
|
@@ -187,6 +191,7 @@
|
|
|
187
191
|
name: tool.name,
|
|
188
192
|
description: tool.description || "",
|
|
189
193
|
parameters: tool.inputSchema?.properties || {},
|
|
194
|
+
meta: tool.meta,
|
|
190
195
|
expanded: false
|
|
191
196
|
}));
|
|
192
197
|
selected_tools = new Set(tools.map((tool) => tool.name));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Block } from "@gradio/atoms";
|
|
3
3
|
import CopyButton from "./CopyButton.svelte";
|
|
4
|
+
import { Tool, Prompt, Resource } from "@gradio/icons";
|
|
4
5
|
|
|
5
6
|
export let mcp_server_active: boolean;
|
|
6
7
|
export let mcp_server_url: string;
|
|
@@ -26,6 +27,10 @@
|
|
|
26
27
|
description: string;
|
|
27
28
|
parameters: Record<string, ToolParameter>;
|
|
28
29
|
expanded?: boolean;
|
|
30
|
+
meta: {
|
|
31
|
+
mcp_type: "tool" | "resource" | "prompt";
|
|
32
|
+
file_data_present: boolean;
|
|
33
|
+
};
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
type Transport = "streamable_http" | "sse" | "stdio";
|
|
@@ -38,6 +43,12 @@
|
|
|
38
43
|
["stdio", "STDIO"]
|
|
39
44
|
] as const;
|
|
40
45
|
|
|
46
|
+
const tool_type_icons: Record<Tool["meta"]["mcp_type"], typeof Tool> = {
|
|
47
|
+
tool: Tool,
|
|
48
|
+
resource: Resource,
|
|
49
|
+
prompt: Prompt
|
|
50
|
+
};
|
|
51
|
+
|
|
41
52
|
$: display_url =
|
|
42
53
|
current_transport === "sse" ? mcp_server_url : mcp_server_url_streamable;
|
|
43
54
|
|
|
@@ -135,9 +146,15 @@
|
|
|
135
146
|
{/if}
|
|
136
147
|
|
|
137
148
|
<div class="tool-selection">
|
|
138
|
-
<strong
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
<strong>
|
|
150
|
+
{all_tools.length > 0 ? all_tools.length : tools.length} Available MCP Tools
|
|
151
|
+
(<span style="display: inline-block; vertical-align: sub;"><Tool /></span
|
|
152
|
+
>), Resources (<span style="display: inline-block; vertical-align: sub;"
|
|
153
|
+
><Resource /></span
|
|
154
|
+
>), and Prompts (<span style="display: inline-block; vertical-align: sub;"
|
|
155
|
+
><Prompt /></span
|
|
156
|
+
>)
|
|
157
|
+
</strong>
|
|
141
158
|
{#if all_tools.length > 0}
|
|
142
159
|
<div class="tool-selection-controls">
|
|
143
160
|
<button
|
|
@@ -187,14 +204,23 @@
|
|
|
187
204
|
class="tool-header"
|
|
188
205
|
on:click={() => (tool.expanded = !tool.expanded)}
|
|
189
206
|
>
|
|
190
|
-
<span
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
207
|
+
<span style="display: inline-block">
|
|
208
|
+
<span
|
|
209
|
+
style="display: inline-block; padding-right: 6px; vertical-align: sub"
|
|
210
|
+
>
|
|
211
|
+
{#if tool_type_icons[tool.meta.mcp_type]}
|
|
212
|
+
{@const Icon = tool_type_icons[tool.meta.mcp_type]}
|
|
213
|
+
<Icon />
|
|
214
|
+
{/if}
|
|
215
|
+
</span>
|
|
216
|
+
<span class="tool-name">{tool.name}</span>
|
|
217
|
+
|
|
218
|
+
<span class="tool-description">
|
|
219
|
+
{tool.description
|
|
194
220
|
? tool.description
|
|
195
|
-
: "⚠︎ No description provided in function docstring"}
|
|
196
|
-
|
|
197
|
-
>
|
|
221
|
+
: "⚠︎ No description provided in function docstring"}
|
|
222
|
+
</span>
|
|
223
|
+
</span>
|
|
198
224
|
<span class="tool-arrow">{tool.expanded ? "▼" : "▶"}</span>
|
|
199
225
|
</button>
|
|
200
226
|
</div>
|
package/src/init.ts
CHANGED
|
@@ -216,10 +216,6 @@ export function create_components(
|
|
|
216
216
|
root: string;
|
|
217
217
|
dependencies: Dependency[];
|
|
218
218
|
}): void {
|
|
219
|
-
// Update current layout and root for dynamic visibility recalculation
|
|
220
|
-
current_layout = layout;
|
|
221
|
-
current_root = root;
|
|
222
|
-
|
|
223
219
|
components.forEach((c) => {
|
|
224
220
|
for (const prop in c.props) {
|
|
225
221
|
if (c.props[prop] === null) {
|