@llmindset/hf-mcp 0.3.9 → 0.3.11
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/create-repo.d.ts +47 -0
- package/dist/create-repo.d.ts.map +1 -0
- package/dist/create-repo.js +83 -0
- package/dist/create-repo.js.map +1 -0
- package/dist/create-repo.test.d.ts +2 -0
- package/dist/create-repo.test.d.ts.map +1 -0
- package/dist/create-repo.test.js +155 -0
- package/dist/create-repo.test.js.map +1 -0
- package/dist/gradio-files.d.ts +1 -24
- package/dist/gradio-files.d.ts.map +1 -1
- package/dist/gradio-files.js +1 -19
- package/dist/gradio-files.js.map +1 -1
- package/dist/hub-inspect.d.ts +2 -2
- package/dist/index.browser.d.ts +5 -3
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +14 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs/types.d.ts +23 -23
- package/dist/jobs/types.d.ts.map +1 -1
- package/dist/jobs/types.js +7 -2
- package/dist/jobs/types.js.map +1 -1
- package/dist/repo-search.d.ts +2 -2
- package/dist/tool-ids.d.ts +4 -3
- package/dist/tool-ids.d.ts.map +1 -1
- package/dist/tool-ids.js +4 -1
- package/dist/tool-ids.js.map +1 -1
- package/package.json +1 -1
- package/src/create-repo.test.ts +182 -0
- package/src/create-repo.ts +103 -0
- package/src/gradio-files.ts +1 -23
- package/src/index.browser.ts +16 -0
- package/src/index.ts +1 -0
- package/src/jobs/types.ts +10 -2
- package/src/tool-ids.ts +4 -0
- package/test/list-files.spec.ts +3 -4
package/src/gradio-files.ts
CHANGED
|
@@ -108,7 +108,7 @@ function matchesFileType(file: FileWithUrl, fileType: FileTypeFilter): boolean {
|
|
|
108
108
|
const FILE_TYPE_SCHEMA = z.enum(['all', 'image', 'audio', 'text']).optional().default('all').describe('Filter by type');
|
|
109
109
|
|
|
110
110
|
export const LIST_FILES_TOOL_CONFIG = {
|
|
111
|
-
name: '
|
|
111
|
+
name: 'gradio_files',
|
|
112
112
|
description:
|
|
113
113
|
'List files available to use as Gradio File/Image/Audio inputs. Prefer these URLs when a Space asks for a file input and the user has not provided an explicit URL.',
|
|
114
114
|
schema: z.object({
|
|
@@ -122,29 +122,7 @@ export const LIST_FILES_TOOL_CONFIG = {
|
|
|
122
122
|
},
|
|
123
123
|
} as const;
|
|
124
124
|
|
|
125
|
-
export const GRADIO_FILES_TOOL_CONFIG = {
|
|
126
|
-
name: 'gradio_files',
|
|
127
|
-
description:
|
|
128
|
-
'List available URLs that can be used for Gradio File Inputs. Use when an input is requested and an explicit URL has not been provided.', // This will be dynamically set with username
|
|
129
|
-
schema: z.object({
|
|
130
|
-
fileType: FILE_TYPE_SCHEMA,
|
|
131
|
-
}),
|
|
132
|
-
annotations: {
|
|
133
|
-
title: 'Gradio Files List',
|
|
134
|
-
destructiveHint: false,
|
|
135
|
-
readOnlyHint: true,
|
|
136
|
-
openWorldHint: true,
|
|
137
|
-
},
|
|
138
|
-
} as const;
|
|
139
|
-
|
|
140
|
-
export const GRADIO_FILES_PROMPT_CONFIG = {
|
|
141
|
-
name: 'Available Gradio Input Files',
|
|
142
|
-
description: 'Returns a list of files and their URLs to use as Gradio File Inputs.',
|
|
143
|
-
schema: z.object({}),
|
|
144
|
-
};
|
|
145
|
-
|
|
146
125
|
export type ListFilesParams = z.infer<typeof LIST_FILES_TOOL_CONFIG.schema>;
|
|
147
|
-
export type GradioFilesParams = z.infer<typeof GRADIO_FILES_TOOL_CONFIG.schema>;
|
|
148
126
|
|
|
149
127
|
/**
|
|
150
128
|
* Service for listing files from a Hugging Face Bucket or the legacy gradio-files dataset.
|
package/src/index.browser.ts
CHANGED
|
@@ -44,6 +44,19 @@ export const REPO_SEARCH_TOOL_CONFIG: BrowserToolConfig = {
|
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
export const CREATE_REPO_TOOL_CONFIG: BrowserToolConfig = {
|
|
48
|
+
name: 'create_repo',
|
|
49
|
+
description:
|
|
50
|
+
'Create a Hugging Face model, dataset, Space, or bucket repository. ' +
|
|
51
|
+
"name must be fully qualified, for example 'username/repo-name'.",
|
|
52
|
+
annotations: {
|
|
53
|
+
title: 'Create Hugging Face Repository',
|
|
54
|
+
destructiveHint: false,
|
|
55
|
+
readOnlyHint: false,
|
|
56
|
+
openWorldHint: true,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
47
60
|
export const PAPER_SEARCH_TOOL_CONFIG: BrowserToolConfig = {
|
|
48
61
|
name: 'paper_search',
|
|
49
62
|
description:
|
|
@@ -121,6 +134,7 @@ export const DOC_FETCH_CONFIG: BrowserToolConfig = {
|
|
|
121
134
|
export const SPACE_SEARCH_TOOL_ID = SEMANTIC_SEARCH_TOOL_CONFIG.name;
|
|
122
135
|
export const MODEL_SEARCH_TOOL_ID = 'model_search';
|
|
123
136
|
export const REPO_SEARCH_TOOL_ID = REPO_SEARCH_TOOL_CONFIG.name;
|
|
137
|
+
export const CREATE_REPO_TOOL_ID = CREATE_REPO_TOOL_CONFIG.name;
|
|
124
138
|
export const MODEL_DETAIL_TOOL_ID = 'model_details';
|
|
125
139
|
export const PAPER_SEARCH_TOOL_ID = PAPER_SEARCH_TOOL_CONFIG.name;
|
|
126
140
|
export const DATASET_SEARCH_TOOL_ID = 'dataset_search';
|
|
@@ -139,6 +153,7 @@ export const ALL_BUILTIN_TOOL_IDS = [
|
|
|
139
153
|
SPACE_SEARCH_TOOL_ID,
|
|
140
154
|
MODEL_SEARCH_TOOL_ID,
|
|
141
155
|
REPO_SEARCH_TOOL_ID,
|
|
156
|
+
CREATE_REPO_TOOL_ID,
|
|
142
157
|
MODEL_DETAIL_TOOL_ID,
|
|
143
158
|
PAPER_SEARCH_TOOL_ID,
|
|
144
159
|
DATASET_SEARCH_TOOL_ID,
|
|
@@ -168,6 +183,7 @@ export const TOOL_ID_GROUPS = {
|
|
|
168
183
|
hf_api: [
|
|
169
184
|
SPACE_SEARCH_TOOL_ID,
|
|
170
185
|
REPO_SEARCH_TOOL_ID,
|
|
186
|
+
CREATE_REPO_TOOL_ID,
|
|
171
187
|
PAPER_SEARCH_TOOL_ID,
|
|
172
188
|
HUB_REPO_DETAILS_TOOL_ID,
|
|
173
189
|
DOCS_SEMANTIC_SEARCH_TOOL_ID,
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './utilities.js';
|
|
|
8
8
|
export * from './paper-search.js';
|
|
9
9
|
export * from './dataset-search.js';
|
|
10
10
|
export * from './repo-search.js';
|
|
11
|
+
export * from './create-repo.js';
|
|
11
12
|
export * from './dataset-detail.js';
|
|
12
13
|
export * from './hub-inspect.js';
|
|
13
14
|
export * from './duplicate-space.js';
|
package/src/jobs/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SpaceHardwareFlavor } from '@huggingface/hub';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -20,8 +21,8 @@ export const GPU_FLAVORS = [
|
|
|
20
21
|
'a10g-largex2',
|
|
21
22
|
'a10g-largex4',
|
|
22
23
|
'a100-large',
|
|
23
|
-
'
|
|
24
|
-
'
|
|
24
|
+
'a100x4',
|
|
25
|
+
'a100x8',
|
|
25
26
|
] as const;
|
|
26
27
|
|
|
27
28
|
export const SPECIALIZED_FLAVORS = ['inf2x6'] as const;
|
|
@@ -30,6 +31,13 @@ export const ALL_FLAVORS = [...CPU_FLAVORS, ...GPU_FLAVORS, ...SPECIALIZED_FLAVO
|
|
|
30
31
|
|
|
31
32
|
export type JobFlavor = (typeof ALL_FLAVORS)[number];
|
|
32
33
|
|
|
34
|
+
function assertExhaustiveHardwareUnion<T extends never>(_value?: T): void {
|
|
35
|
+
void _value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
assertExhaustiveHardwareUnion<Exclude<SpaceHardwareFlavor, JobFlavor>>();
|
|
39
|
+
assertExhaustiveHardwareUnion<Exclude<JobFlavor, SpaceHardwareFlavor>>();
|
|
40
|
+
|
|
33
41
|
/**
|
|
34
42
|
* Job status stages (from OpenAPI spec)
|
|
35
43
|
*/
|
package/src/tool-ids.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
MODEL_DETAIL_PROMPT_CONFIG,
|
|
11
11
|
PAPER_SEARCH_TOOL_CONFIG,
|
|
12
12
|
REPO_SEARCH_TOOL_CONFIG,
|
|
13
|
+
CREATE_REPO_TOOL_CONFIG,
|
|
13
14
|
DATASET_SEARCH_TOOL_CONFIG,
|
|
14
15
|
DATASET_DETAIL_TOOL_CONFIG,
|
|
15
16
|
DATASET_DETAIL_PROMPT_CONFIG,
|
|
@@ -30,6 +31,7 @@ import {
|
|
|
30
31
|
export const SPACE_SEARCH_TOOL_ID = SEMANTIC_SEARCH_TOOL_CONFIG.name;
|
|
31
32
|
export const MODEL_SEARCH_TOOL_ID = MODEL_SEARCH_TOOL_CONFIG.name;
|
|
32
33
|
export const REPO_SEARCH_TOOL_ID = REPO_SEARCH_TOOL_CONFIG.name;
|
|
34
|
+
export const CREATE_REPO_TOOL_ID = CREATE_REPO_TOOL_CONFIG.name;
|
|
33
35
|
export const MODEL_DETAIL_TOOL_ID = MODEL_DETAIL_TOOL_CONFIG.name;
|
|
34
36
|
export const PAPER_SEARCH_TOOL_ID = PAPER_SEARCH_TOOL_CONFIG.name;
|
|
35
37
|
export const DATASET_SEARCH_TOOL_ID = DATASET_SEARCH_TOOL_CONFIG.name;
|
|
@@ -53,6 +55,7 @@ export const ALL_BUILTIN_TOOL_IDS = [
|
|
|
53
55
|
SPACE_SEARCH_TOOL_ID,
|
|
54
56
|
MODEL_SEARCH_TOOL_ID,
|
|
55
57
|
REPO_SEARCH_TOOL_ID,
|
|
58
|
+
CREATE_REPO_TOOL_ID,
|
|
56
59
|
MODEL_DETAIL_TOOL_ID,
|
|
57
60
|
PAPER_SEARCH_TOOL_ID,
|
|
58
61
|
DATASET_SEARCH_TOOL_ID,
|
|
@@ -82,6 +85,7 @@ export const TOOL_ID_GROUPS = {
|
|
|
82
85
|
hf_api: [
|
|
83
86
|
SPACE_SEARCH_TOOL_ID,
|
|
84
87
|
REPO_SEARCH_TOOL_ID,
|
|
88
|
+
CREATE_REPO_TOOL_ID,
|
|
85
89
|
PAPER_SEARCH_TOOL_ID,
|
|
86
90
|
HUB_REPO_DETAILS_TOOL_ID,
|
|
87
91
|
DOCS_SEMANTIC_SEARCH_TOOL_ID,
|
package/test/list-files.spec.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import * as hub from '@huggingface/hub';
|
|
3
3
|
import type { ListFileEntry } from '@huggingface/hub';
|
|
4
|
-
import { LIST_FILES_TOOL_CONFIG, ListFilesTool
|
|
4
|
+
import { LIST_FILES_TOOL_CONFIG, ListFilesTool } from '../src/gradio-files.js';
|
|
5
5
|
|
|
6
6
|
vi.mock('@huggingface/hub', () => ({
|
|
7
7
|
listFiles: vi.fn(),
|
|
@@ -113,9 +113,8 @@ describe('ListFilesTool', () => {
|
|
|
113
113
|
expect(markdown).not.toContain('private bucket URLs require authorization');
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
it('exposes
|
|
117
|
-
expect(LIST_FILES_TOOL_CONFIG.name).toBe('
|
|
116
|
+
it('exposes the gradio_files tool config', () => {
|
|
117
|
+
expect(LIST_FILES_TOOL_CONFIG.name).toBe('gradio_files');
|
|
118
118
|
expect(LIST_FILES_TOOL_CONFIG.annotations.readOnlyHint).toBe(true);
|
|
119
|
-
expect(GRADIO_FILES_TOOL_CONFIG.name).toBe('gradio_files');
|
|
120
119
|
});
|
|
121
120
|
});
|