@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/dist/jobs/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const CPU_FLAVORS: readonly ["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl"];
|
|
3
|
-
export declare const GPU_FLAVORS: readonly ["sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "
|
|
3
|
+
export declare const GPU_FLAVORS: readonly ["sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "a100x4", "a100x8"];
|
|
4
4
|
export declare const SPECIALIZED_FLAVORS: readonly ["inf2x6"];
|
|
5
|
-
export declare const ALL_FLAVORS: readonly ["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "
|
|
5
|
+
export declare const ALL_FLAVORS: readonly ["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "a100x4", "a100x8", "inf2x6"];
|
|
6
6
|
export type JobFlavor = (typeof ALL_FLAVORS)[number];
|
|
7
7
|
export type JobStage = 'RUNNING' | 'COMPLETED' | 'CANCELED' | 'ERROR' | 'DELETED';
|
|
8
8
|
export interface JobStatus {
|
|
@@ -67,28 +67,28 @@ export declare const runArgsSchema: z.ZodObject<{
|
|
|
67
67
|
} & {
|
|
68
68
|
image: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
69
69
|
command: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
70
|
-
flavor: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "
|
|
70
|
+
flavor: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "a100x4", "a100x8", "inf2x6"]>>>;
|
|
71
71
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
72
72
|
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
73
73
|
timeout: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
74
74
|
detach: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
75
75
|
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
timeout: string;
|
|
76
77
|
image: string;
|
|
77
78
|
command: string | string[];
|
|
78
|
-
flavor: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "
|
|
79
|
-
timeout: string;
|
|
79
|
+
flavor: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8";
|
|
80
80
|
detach: boolean;
|
|
81
81
|
namespace?: string | undefined;
|
|
82
82
|
env?: Record<string, string> | undefined;
|
|
83
83
|
secrets?: Record<string, string> | undefined;
|
|
84
84
|
}, {
|
|
85
85
|
command: string | string[];
|
|
86
|
+
timeout?: string | undefined;
|
|
86
87
|
image?: string | undefined;
|
|
87
88
|
namespace?: string | undefined;
|
|
88
|
-
flavor?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "
|
|
89
|
+
flavor?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8" | undefined;
|
|
89
90
|
env?: Record<string, string> | undefined;
|
|
90
91
|
secrets?: Record<string, string> | undefined;
|
|
91
|
-
timeout?: string | undefined;
|
|
92
92
|
detach?: boolean | undefined;
|
|
93
93
|
}>;
|
|
94
94
|
export declare const uvArgsSchema: z.ZodObject<{
|
|
@@ -98,15 +98,15 @@ export declare const uvArgsSchema: z.ZodObject<{
|
|
|
98
98
|
with_deps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
99
99
|
script_args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
100
100
|
python: z.ZodOptional<z.ZodString>;
|
|
101
|
-
flavor: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "
|
|
101
|
+
flavor: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "a100x4", "a100x8", "inf2x6"]>>>;
|
|
102
102
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
103
103
|
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
104
104
|
timeout: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
105
105
|
detach: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
106
106
|
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
script: string;
|
|
108
|
-
flavor: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "h100" | "h100x8";
|
|
109
107
|
timeout: string;
|
|
108
|
+
script: string;
|
|
109
|
+
flavor: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8";
|
|
110
110
|
detach: boolean;
|
|
111
111
|
namespace?: string | undefined;
|
|
112
112
|
env?: Record<string, string> | undefined;
|
|
@@ -116,11 +116,11 @@ export declare const uvArgsSchema: z.ZodObject<{
|
|
|
116
116
|
python?: string | undefined;
|
|
117
117
|
}, {
|
|
118
118
|
script: string;
|
|
119
|
+
timeout?: string | undefined;
|
|
119
120
|
namespace?: string | undefined;
|
|
120
|
-
flavor?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "
|
|
121
|
+
flavor?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8" | undefined;
|
|
121
122
|
env?: Record<string, string> | undefined;
|
|
122
123
|
secrets?: Record<string, string> | undefined;
|
|
123
|
-
timeout?: string | undefined;
|
|
124
124
|
detach?: boolean | undefined;
|
|
125
125
|
with_deps?: string[] | undefined;
|
|
126
126
|
script_args?: string[] | undefined;
|
|
@@ -136,8 +136,8 @@ export declare const psArgsSchema: z.ZodObject<{
|
|
|
136
136
|
status?: string | undefined;
|
|
137
137
|
namespace?: string | undefined;
|
|
138
138
|
}, {
|
|
139
|
-
all?: boolean | undefined;
|
|
140
139
|
status?: string | undefined;
|
|
140
|
+
all?: boolean | undefined;
|
|
141
141
|
namespace?: string | undefined;
|
|
142
142
|
}>;
|
|
143
143
|
export declare const logsArgsSchema: z.ZodObject<{
|
|
@@ -181,7 +181,7 @@ export declare const scheduledRunArgsSchema: z.ZodObject<{
|
|
|
181
181
|
} & {
|
|
182
182
|
image: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
183
183
|
command: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
184
|
-
flavor: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "
|
|
184
|
+
flavor: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "a100x4", "a100x8", "inf2x6"]>>>;
|
|
185
185
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
186
186
|
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
187
187
|
timeout: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -190,10 +190,10 @@ export declare const scheduledRunArgsSchema: z.ZodObject<{
|
|
|
190
190
|
schedule: z.ZodString;
|
|
191
191
|
suspend: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
192
192
|
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
timeout: string;
|
|
193
194
|
image: string;
|
|
194
195
|
command: string | string[];
|
|
195
|
-
flavor: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "
|
|
196
|
-
timeout: string;
|
|
196
|
+
flavor: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8";
|
|
197
197
|
detach: boolean;
|
|
198
198
|
schedule: string;
|
|
199
199
|
suspend: boolean;
|
|
@@ -203,12 +203,12 @@ export declare const scheduledRunArgsSchema: z.ZodObject<{
|
|
|
203
203
|
}, {
|
|
204
204
|
command: string | string[];
|
|
205
205
|
schedule: string;
|
|
206
|
+
timeout?: string | undefined;
|
|
206
207
|
image?: string | undefined;
|
|
207
208
|
namespace?: string | undefined;
|
|
208
|
-
flavor?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "
|
|
209
|
+
flavor?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8" | undefined;
|
|
209
210
|
env?: Record<string, string> | undefined;
|
|
210
211
|
secrets?: Record<string, string> | undefined;
|
|
211
|
-
timeout?: string | undefined;
|
|
212
212
|
detach?: boolean | undefined;
|
|
213
213
|
suspend?: boolean | undefined;
|
|
214
214
|
}>;
|
|
@@ -219,7 +219,7 @@ export declare const scheduledUvArgsSchema: z.ZodObject<{
|
|
|
219
219
|
with_deps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
220
220
|
script_args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
221
221
|
python: z.ZodOptional<z.ZodString>;
|
|
222
|
-
flavor: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "
|
|
222
|
+
flavor: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cpu-basic", "cpu-upgrade", "cpu-performance", "cpu-xl", "sprx8", "zero-a10g", "t4-small", "t4-medium", "l4x1", "l4x4", "l40sx1", "l40sx4", "l40sx8", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "a100x4", "a100x8", "inf2x6"]>>>;
|
|
223
223
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
224
224
|
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
225
225
|
timeout: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -228,9 +228,9 @@ export declare const scheduledUvArgsSchema: z.ZodObject<{
|
|
|
228
228
|
schedule: z.ZodString;
|
|
229
229
|
suspend: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
230
230
|
}, "strip", z.ZodTypeAny, {
|
|
231
|
-
script: string;
|
|
232
|
-
flavor: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "h100" | "h100x8";
|
|
233
231
|
timeout: string;
|
|
232
|
+
script: string;
|
|
233
|
+
flavor: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8";
|
|
234
234
|
detach: boolean;
|
|
235
235
|
schedule: string;
|
|
236
236
|
suspend: boolean;
|
|
@@ -243,11 +243,11 @@ export declare const scheduledUvArgsSchema: z.ZodObject<{
|
|
|
243
243
|
}, {
|
|
244
244
|
script: string;
|
|
245
245
|
schedule: string;
|
|
246
|
+
timeout?: string | undefined;
|
|
246
247
|
namespace?: string | undefined;
|
|
247
|
-
flavor?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "
|
|
248
|
+
flavor?: "cpu-basic" | "zero-a10g" | "cpu-upgrade" | "cpu-performance" | "cpu-xl" | "sprx8" | "inf2x6" | "t4-small" | "t4-medium" | "l4x1" | "l4x4" | "l40sx1" | "l40sx4" | "l40sx8" | "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" | "a100-large" | "a100x4" | "a100x8" | undefined;
|
|
248
249
|
env?: Record<string, string> | undefined;
|
|
249
250
|
secrets?: Record<string, string> | undefined;
|
|
250
|
-
timeout?: string | undefined;
|
|
251
251
|
detach?: boolean | undefined;
|
|
252
252
|
with_deps?: string[] | undefined;
|
|
253
253
|
script_args?: string[] | undefined;
|
package/dist/jobs/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/jobs/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/jobs/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,WAAW,oEAAqE,CAAC;AAE9F,eAAO,MAAM,WAAW,sMAiBd,CAAC;AAEX,eAAO,MAAM,mBAAmB,qBAAsB,CAAC;AAEvD,eAAO,MAAM,WAAW,yQAAoE,CAAC;AAE7F,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAYrD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAKlF,MAAM,WAAW,SAAS;IACzB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,IA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AC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
package/dist/jobs/types.js
CHANGED
|
@@ -15,11 +15,16 @@ export const GPU_FLAVORS = [
|
|
|
15
15
|
'a10g-largex2',
|
|
16
16
|
'a10g-largex4',
|
|
17
17
|
'a100-large',
|
|
18
|
-
'
|
|
19
|
-
'
|
|
18
|
+
'a100x4',
|
|
19
|
+
'a100x8',
|
|
20
20
|
];
|
|
21
21
|
export const SPECIALIZED_FLAVORS = ['inf2x6'];
|
|
22
22
|
export const ALL_FLAVORS = [...CPU_FLAVORS, ...GPU_FLAVORS, ...SPECIALIZED_FLAVORS];
|
|
23
|
+
function assertExhaustiveHardwareUnion(_value) {
|
|
24
|
+
void _value;
|
|
25
|
+
}
|
|
26
|
+
assertExhaustiveHardwareUnion();
|
|
27
|
+
assertExhaustiveHardwareUnion();
|
|
23
28
|
const commonArgsSchema = z.object({
|
|
24
29
|
namespace: z.string().optional().describe('Target namespace (username or organization). Defaults to current user.'),
|
|
25
30
|
});
|
package/dist/jobs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/jobs/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/jobs/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,CAAU,CAAC;AAE9F,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,UAAU;IACV,WAAW;IACX,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,QAAQ;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,CAAU,CAAC;AAEvD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAG,WAAW,EAAE,GAAG,WAAW,EAAE,GAAG,mBAAmB,CAAU,CAAC;AAI7F,SAAS,6BAA6B,CAAkB,MAAU;IACjE,KAAK,MAAM,CAAC;AACb,CAAC;AAED,6BAA6B,EAA2C,CAAC;AACzE,6BAA6B,EAA2C,CAAC;AAmGzE,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wEAAwE,CAAC;CACnH,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACpD,KAAK,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,CAAC,iFAAiF,CAAC;SAC3F,QA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MAAM,CAAC;IAC5D,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,mDAAmD,CAAC;CACxG,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAC7D,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;CACzD,CAAC,CAAC"}
|
package/dist/repo-search.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const REPO_SEARCH_TOOL_CONFIG: {
|
|
|
15
15
|
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
17
|
limit: number;
|
|
18
|
-
repo_types: ("
|
|
18
|
+
repo_types: ("space" | "dataset" | "model")[];
|
|
19
19
|
sort?: "createdAt" | "downloads" | "lastModified" | "likes" | "trendingScore" | undefined;
|
|
20
20
|
author?: string | undefined;
|
|
21
21
|
query?: string | undefined;
|
|
@@ -25,7 +25,7 @@ export declare const REPO_SEARCH_TOOL_CONFIG: {
|
|
|
25
25
|
author?: string | undefined;
|
|
26
26
|
query?: string | undefined;
|
|
27
27
|
limit?: number | undefined;
|
|
28
|
-
repo_types?: ("
|
|
28
|
+
repo_types?: ("space" | "dataset" | "model")[] | undefined;
|
|
29
29
|
filters?: string[] | undefined;
|
|
30
30
|
}>;
|
|
31
31
|
readonly annotations: {
|
package/dist/tool-ids.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const SPACE_SEARCH_TOOL_ID: "space_search";
|
|
2
2
|
export declare const MODEL_SEARCH_TOOL_ID: "model_search";
|
|
3
3
|
export declare const REPO_SEARCH_TOOL_ID: "hub_repo_search";
|
|
4
|
+
export declare const CREATE_REPO_TOOL_ID: "create_repo";
|
|
4
5
|
export declare const MODEL_DETAIL_TOOL_ID: "model_details";
|
|
5
6
|
export declare const PAPER_SEARCH_TOOL_ID: "paper_search";
|
|
6
7
|
export declare const DATASET_SEARCH_TOOL_ID: "dataset_search";
|
|
@@ -18,15 +19,15 @@ export declare const MODEL_DETAIL_PROMPT_ID: string;
|
|
|
18
19
|
export declare const DATASET_DETAIL_PROMPT_ID: string;
|
|
19
20
|
export declare const HF_JOBS_TOOL_ID: "hf_jobs";
|
|
20
21
|
export declare const DYNAMIC_SPACE_TOOL_ID: "dynamic_space";
|
|
21
|
-
export declare const ALL_BUILTIN_TOOL_IDS: readonly ["space_search", "model_search", "hub_repo_search", "model_details", "paper_search", "dataset_search", "dataset_details", "hub_repo_details", "duplicate_space", "space_info", "space_files", "hf_doc_search", "hf_doc_fetch", "use_space", "hf_jobs", "dynamic_space"];
|
|
22
|
+
export declare const ALL_BUILTIN_TOOL_IDS: readonly ["space_search", "model_search", "hub_repo_search", "create_repo", "model_details", "paper_search", "dataset_search", "dataset_details", "hub_repo_details", "duplicate_space", "space_info", "space_files", "hf_doc_search", "hf_doc_fetch", "use_space", "hf_jobs", "dynamic_space"];
|
|
22
23
|
export declare const TOOL_ID_GROUPS: {
|
|
23
24
|
readonly search: readonly ["space_search", "hub_repo_search", "paper_search", "hf_doc_search"];
|
|
24
25
|
readonly spaces: readonly ["space_search", "duplicate_space", "space_info", "space_files", "use_space"];
|
|
25
26
|
readonly detail: readonly ["model_details", "dataset_details", "hub_repo_details"];
|
|
26
27
|
readonly docs: readonly ["hf_doc_search", "hf_doc_fetch"];
|
|
27
|
-
readonly hf_api: readonly ["space_search", "hub_repo_search", "paper_search", "hub_repo_details", "hf_doc_search"];
|
|
28
|
+
readonly hf_api: readonly ["space_search", "hub_repo_search", "create_repo", "paper_search", "hub_repo_details", "hf_doc_search"];
|
|
28
29
|
readonly dynamic_space: readonly ["dynamic_space"];
|
|
29
|
-
readonly all: readonly ["space_search", "model_search", "hub_repo_search", "model_details", "paper_search", "dataset_search", "dataset_details", "hub_repo_details", "duplicate_space", "space_info", "space_files", "hf_doc_search", "hf_doc_fetch", "use_space", "hf_jobs", "dynamic_space"];
|
|
30
|
+
readonly all: readonly ["space_search", "model_search", "hub_repo_search", "create_repo", "model_details", "paper_search", "dataset_search", "dataset_details", "hub_repo_details", "duplicate_space", "space_info", "space_files", "hf_doc_search", "hf_doc_fetch", "use_space", "hf_jobs", "dynamic_space"];
|
|
30
31
|
};
|
|
31
32
|
export type BuiltinToolId = (typeof ALL_BUILTIN_TOOL_IDS)[number];
|
|
32
33
|
export declare function isValidBuiltinToolId(toolId: string): toolId is BuiltinToolId;
|
package/dist/tool-ids.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-ids.d.ts","sourceRoot":"","sources":["../src/tool-ids.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-ids.d.ts","sourceRoot":"","sources":["../src/tool-ids.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,oBAAoB,gBAAmC,CAAC;AACrE,eAAO,MAAM,oBAAoB,gBAAgC,CAAC;AAClE,eAAO,MAAM,mBAAmB,mBAA+B,CAAC;AAChE,eAAO,MAAM,mBAAmB,eAA+B,CAAC;AAChE,eAAO,MAAM,oBAAoB,iBAAgC,CAAC;AAClE,eAAO,MAAM,oBAAoB,gBAAgC,CAAC;AAClE,eAAO,MAAM,sBAAsB,kBAAkC,CAAC;AACtE,eAAO,MAAM,sBAAsB,mBAAkC,CAAC;AACtE,eAAO,MAAM,wBAAwB,oBAAoC,CAAC;AAC1E,eAAO,MAAM,uBAAuB,mBAAmC,CAAC;AACxE,eAAO,MAAM,kBAAkB,cAA8B,CAAC;AAC9D,eAAO,MAAM,mBAAmB,eAA+B,CAAC;AAChE,eAAO,MAAM,iBAAiB,aAA6B,CAAC;AAC5D,eAAO,MAAM,4BAA4B,iBAAmC,CAAC;AAC7E,eAAO,MAAM,iBAAiB,gBAAwB,CAAC;AACvD,eAAO,MAAM,sBAAsB,gBAAkC,CAAC;AACtE,eAAO,MAAM,uBAAuB,iBAAmC,CAAC;AACxE,eAAO,MAAM,sBAAsB,QAAkC,CAAC;AACtE,eAAO,MAAM,wBAAwB,QAAoC,CAAC;AAC1E,eAAO,MAAM,eAAe,WAA2B,CAAC;AACxD,eAAO,MAAM,qBAAqB,iBAAiC,CAAC;AAGpE,eAAO,MAAM,oBAAoB,iSAkBvB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;CAsBjB,CAAC;AAGX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAGlE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,aAAa,CAE5E"}
|
package/dist/tool-ids.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { SEMANTIC_SEARCH_TOOL_CONFIG, MODEL_SEARCH_TOOL_CONFIG, MODEL_DETAIL_TOOL_CONFIG, MODEL_DETAIL_PROMPT_CONFIG, PAPER_SEARCH_TOOL_CONFIG, REPO_SEARCH_TOOL_CONFIG, DATASET_SEARCH_TOOL_CONFIG, DATASET_DETAIL_TOOL_CONFIG, DATASET_DETAIL_PROMPT_CONFIG, HUB_REPO_DETAILS_TOOL_CONFIG, DUPLICATE_SPACE_TOOL_CONFIG, SPACE_INFO_TOOL_CONFIG, SPACE_FILES_TOOL_CONFIG, USER_SUMMARY_PROMPT_CONFIG, PAPER_SUMMARY_PROMPT_CONFIG, DOCS_SEMANTIC_SEARCH_CONFIG, DOC_FETCH_CONFIG, USE_SPACE_TOOL_CONFIG, HF_JOBS_TOOL_CONFIG, DYNAMIC_SPACE_TOOL_CONFIG, } from './index.js';
|
|
1
|
+
import { SEMANTIC_SEARCH_TOOL_CONFIG, MODEL_SEARCH_TOOL_CONFIG, MODEL_DETAIL_TOOL_CONFIG, MODEL_DETAIL_PROMPT_CONFIG, PAPER_SEARCH_TOOL_CONFIG, REPO_SEARCH_TOOL_CONFIG, CREATE_REPO_TOOL_CONFIG, DATASET_SEARCH_TOOL_CONFIG, DATASET_DETAIL_TOOL_CONFIG, DATASET_DETAIL_PROMPT_CONFIG, HUB_REPO_DETAILS_TOOL_CONFIG, DUPLICATE_SPACE_TOOL_CONFIG, SPACE_INFO_TOOL_CONFIG, SPACE_FILES_TOOL_CONFIG, USER_SUMMARY_PROMPT_CONFIG, PAPER_SUMMARY_PROMPT_CONFIG, DOCS_SEMANTIC_SEARCH_CONFIG, DOC_FETCH_CONFIG, USE_SPACE_TOOL_CONFIG, HF_JOBS_TOOL_CONFIG, DYNAMIC_SPACE_TOOL_CONFIG, } from './index.js';
|
|
2
2
|
export const SPACE_SEARCH_TOOL_ID = SEMANTIC_SEARCH_TOOL_CONFIG.name;
|
|
3
3
|
export const MODEL_SEARCH_TOOL_ID = MODEL_SEARCH_TOOL_CONFIG.name;
|
|
4
4
|
export const REPO_SEARCH_TOOL_ID = REPO_SEARCH_TOOL_CONFIG.name;
|
|
5
|
+
export const CREATE_REPO_TOOL_ID = CREATE_REPO_TOOL_CONFIG.name;
|
|
5
6
|
export const MODEL_DETAIL_TOOL_ID = MODEL_DETAIL_TOOL_CONFIG.name;
|
|
6
7
|
export const PAPER_SEARCH_TOOL_ID = PAPER_SEARCH_TOOL_CONFIG.name;
|
|
7
8
|
export const DATASET_SEARCH_TOOL_ID = DATASET_SEARCH_TOOL_CONFIG.name;
|
|
@@ -23,6 +24,7 @@ export const ALL_BUILTIN_TOOL_IDS = [
|
|
|
23
24
|
SPACE_SEARCH_TOOL_ID,
|
|
24
25
|
MODEL_SEARCH_TOOL_ID,
|
|
25
26
|
REPO_SEARCH_TOOL_ID,
|
|
27
|
+
CREATE_REPO_TOOL_ID,
|
|
26
28
|
MODEL_DETAIL_TOOL_ID,
|
|
27
29
|
PAPER_SEARCH_TOOL_ID,
|
|
28
30
|
DATASET_SEARCH_TOOL_ID,
|
|
@@ -51,6 +53,7 @@ export const TOOL_ID_GROUPS = {
|
|
|
51
53
|
hf_api: [
|
|
52
54
|
SPACE_SEARCH_TOOL_ID,
|
|
53
55
|
REPO_SEARCH_TOOL_ID,
|
|
56
|
+
CREATE_REPO_TOOL_ID,
|
|
54
57
|
PAPER_SEARCH_TOOL_ID,
|
|
55
58
|
HUB_REPO_DETAILS_TOOL_ID,
|
|
56
59
|
DOCS_SEMANTIC_SEARCH_TOOL_ID,
|
package/dist/tool-ids.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-ids.js","sourceRoot":"","sources":["../src/tool-ids.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC5B,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,GACzB,MAAM,YAAY,CAAC;AAGpB,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,IAAI,CAAC;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC,IAAI,CAAC;AAClE,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,IAAI,CAAC;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC,IAAI,CAAC;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC,IAAI,CAAC;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,0BAA0B,CAAC,IAAI,CAAC;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG,0BAA0B,CAAC,IAAI,CAAC;AACtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,4BAA4B,CAAC,IAAI,CAAC;AAC1E,MAAM,C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IACnB,4BAA4B;IAC5B,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,qBAAqB;CACZ,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,MAAM,EAAE,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,4BAA4B,CAAU;IAChH,MAAM,EAAE;QACP,oBAAoB;QACpB,uBAAuB;QACvB,kBAAkB;QAClB,mBAAmB;QACnB,iBAAiB;KACR;IACV,MAAM,EAAE,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,wBAAwB,CAAU;IACzF,IAAI,EAAE,CAAC,4BAA4B,EAAE,iBAAiB,CAAU;IAChE,MAAM,EAAE;QACP,oBAAoB;QACpB,mBAAmB;QACnB,mBAAmB;QACnB,oBAAoB;QACpB,wBAAwB;QACxB,4BAA4B;KAEnB;IACV,aAAa,EAAE,CAAC,qBAAqB,CAAU;IAC/C,GAAG,EAAE,CAAC,GAAG,oBAAoB,CAAU;CAC9B,CAAC;AAMX,MAAM,UAAU,oBAAoB,CAAC,MAAc;IAClD,OAAQ,oBAA0C,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACrE,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { createRepo } from '@huggingface/hub';
|
|
2
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { CreateRepoTool, formatCreateRepoResult } from './create-repo.js';
|
|
4
|
+
|
|
5
|
+
vi.mock('@huggingface/hub', () => ({
|
|
6
|
+
createRepo: vi.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
describe('CreateRepoTool', () => {
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
vi.mocked(createRepo).mockReset();
|
|
12
|
+
vi.mocked(createRepo).mockResolvedValue({
|
|
13
|
+
repoUrl: 'https://huggingface.co/alice/example-model',
|
|
14
|
+
id: '0123456789abcdef01234567',
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('creates a model repository with client-native repo params', async () => {
|
|
19
|
+
const tool = new CreateRepoTool('token');
|
|
20
|
+
const result = await tool.create({
|
|
21
|
+
name: 'alice/example-model',
|
|
22
|
+
repo_type: 'model',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
expect(createRepo).toHaveBeenCalledWith({
|
|
26
|
+
accessToken: 'token',
|
|
27
|
+
repo: { name: 'alice/example-model', type: 'model' },
|
|
28
|
+
private: undefined,
|
|
29
|
+
});
|
|
30
|
+
expect(result).toEqual({
|
|
31
|
+
url: 'https://huggingface.co/alice/example-model',
|
|
32
|
+
name: 'alice/example-model',
|
|
33
|
+
repoType: 'model',
|
|
34
|
+
id: '0123456789abcdef01234567',
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('defaults to model repositories', async () => {
|
|
39
|
+
const tool = new CreateRepoTool('token');
|
|
40
|
+
await tool.create({
|
|
41
|
+
name: 'alice/default-model',
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
expect(createRepo).toHaveBeenCalledWith({
|
|
45
|
+
accessToken: 'token',
|
|
46
|
+
repo: { name: 'alice/default-model', type: 'model' },
|
|
47
|
+
private: undefined,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('creates a dataset repository', async () => {
|
|
52
|
+
const tool = new CreateRepoTool('token');
|
|
53
|
+
await tool.create({
|
|
54
|
+
name: 'alice/example-dataset',
|
|
55
|
+
repo_type: 'dataset',
|
|
56
|
+
private: true,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(createRepo).toHaveBeenCalledWith({
|
|
60
|
+
accessToken: 'token',
|
|
61
|
+
repo: { name: 'alice/example-dataset', type: 'dataset' },
|
|
62
|
+
private: true,
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('creates a bucket repository', async () => {
|
|
67
|
+
vi.mocked(createRepo).mockResolvedValue({
|
|
68
|
+
repoUrl: 'https://huggingface.co/buckets/alice/example-bucket',
|
|
69
|
+
id: 'bucket-id',
|
|
70
|
+
});
|
|
71
|
+
const tool = new CreateRepoTool('token');
|
|
72
|
+
const result = await tool.create({
|
|
73
|
+
name: 'alice/example-bucket',
|
|
74
|
+
repo_type: 'bucket',
|
|
75
|
+
private: true,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
expect(createRepo).toHaveBeenCalledWith({
|
|
79
|
+
accessToken: 'token',
|
|
80
|
+
repo: { name: 'alice/example-bucket', type: 'bucket' },
|
|
81
|
+
private: true,
|
|
82
|
+
});
|
|
83
|
+
expect(result).toEqual({
|
|
84
|
+
url: 'https://huggingface.co/buckets/alice/example-bucket',
|
|
85
|
+
name: 'alice/example-bucket',
|
|
86
|
+
repoType: 'bucket',
|
|
87
|
+
id: 'bucket-id',
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('creates a Space repository with sdk', async () => {
|
|
92
|
+
vi.mocked(createRepo).mockResolvedValue({
|
|
93
|
+
repoUrl: 'https://huggingface.co/spaces/alice/demo',
|
|
94
|
+
id: 'abcdefabcdefabcdefabcdef',
|
|
95
|
+
});
|
|
96
|
+
const tool = new CreateRepoTool('token');
|
|
97
|
+
await tool.create({
|
|
98
|
+
name: 'alice/demo',
|
|
99
|
+
repo_type: 'space',
|
|
100
|
+
sdk: 'gradio',
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
expect(createRepo).toHaveBeenCalledWith({
|
|
104
|
+
accessToken: 'token',
|
|
105
|
+
repo: { name: 'alice/demo', type: 'space' },
|
|
106
|
+
private: undefined,
|
|
107
|
+
sdk: 'gradio',
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('creates a Streamlit Space repository', async () => {
|
|
112
|
+
vi.mocked(createRepo).mockResolvedValue({
|
|
113
|
+
repoUrl: 'https://huggingface.co/spaces/alice/streamlit-demo',
|
|
114
|
+
id: 'streamlit-space-id',
|
|
115
|
+
});
|
|
116
|
+
const tool = new CreateRepoTool('token');
|
|
117
|
+
await tool.create({
|
|
118
|
+
name: 'alice/streamlit-demo',
|
|
119
|
+
repo_type: 'space',
|
|
120
|
+
sdk: 'streamlit',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
expect(createRepo).toHaveBeenCalledWith({
|
|
124
|
+
accessToken: 'token',
|
|
125
|
+
repo: { name: 'alice/streamlit-demo', type: 'space' },
|
|
126
|
+
private: undefined,
|
|
127
|
+
sdk: 'streamlit',
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('requires sdk for Space repositories', async () => {
|
|
132
|
+
const tool = new CreateRepoTool('token');
|
|
133
|
+
await expect(
|
|
134
|
+
tool.create({
|
|
135
|
+
name: 'alice/demo',
|
|
136
|
+
repo_type: 'space',
|
|
137
|
+
})
|
|
138
|
+
).rejects.toThrow('sdk is required when repo_type is space');
|
|
139
|
+
expect(createRepo).not.toHaveBeenCalled();
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('requires fully-qualified repo names', async () => {
|
|
143
|
+
const tool = new CreateRepoTool('token');
|
|
144
|
+
await expect(
|
|
145
|
+
tool.create({
|
|
146
|
+
name: 'example-model',
|
|
147
|
+
repo_type: 'model',
|
|
148
|
+
})
|
|
149
|
+
).rejects.toThrow("name must be fully qualified in 'namespace/repo-name' format");
|
|
150
|
+
expect(createRepo).not.toHaveBeenCalled();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('requires an auth token', async () => {
|
|
154
|
+
const tool = new CreateRepoTool(undefined);
|
|
155
|
+
await expect(
|
|
156
|
+
tool.create({
|
|
157
|
+
name: 'alice/example-model',
|
|
158
|
+
repo_type: 'model',
|
|
159
|
+
})
|
|
160
|
+
).rejects.toThrow('Requires Authentication');
|
|
161
|
+
expect(createRepo).not.toHaveBeenCalled();
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('formats the created repository result', () => {
|
|
165
|
+
expect(
|
|
166
|
+
formatCreateRepoResult({
|
|
167
|
+
url: 'https://huggingface.co/alice/example-model',
|
|
168
|
+
name: 'alice/example-model',
|
|
169
|
+
repoType: 'model',
|
|
170
|
+
id: '0123456789abcdef01234567',
|
|
171
|
+
})
|
|
172
|
+
).toBe(
|
|
173
|
+
[
|
|
174
|
+
'Repository created.',
|
|
175
|
+
'Name: alice/example-model',
|
|
176
|
+
'Type: model',
|
|
177
|
+
'URL: https://huggingface.co/alice/example-model',
|
|
178
|
+
'ID: 0123456789abcdef01234567',
|
|
179
|
+
].join('\n')
|
|
180
|
+
);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { createRepo, type RepoType as HubRepoType, type SpaceSdk } from '@huggingface/hub';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { NO_TOKEN_INSTRUCTIONS } from './utilities.js';
|
|
4
|
+
|
|
5
|
+
const REPO_TYPES = ['model', 'dataset', 'space', 'bucket'] as const satisfies readonly HubRepoType[];
|
|
6
|
+
const SPACE_SDKS = ['streamlit', 'gradio', 'docker', 'static'] as const satisfies readonly SpaceSdk[];
|
|
7
|
+
|
|
8
|
+
export const CREATE_REPO_TOOL_CONFIG = {
|
|
9
|
+
name: 'create_repo',
|
|
10
|
+
description: '',
|
|
11
|
+
schema: z.object({
|
|
12
|
+
name: z.string().min(1).describe("Fully-qualified repository name in 'namespace/repo-name' format."),
|
|
13
|
+
repo_type: z.enum(REPO_TYPES).optional().default('bucket').describe('Repository type. Defaults to bucket.'),
|
|
14
|
+
private: z.boolean().optional().describe('Whether to create the repository as private.'),
|
|
15
|
+
sdk: z.enum(SPACE_SDKS).optional().default('static').describe("SDK type - only required for repo_type='space'."),
|
|
16
|
+
}),
|
|
17
|
+
annotations: {
|
|
18
|
+
title: 'Create Hugging Face Repository',
|
|
19
|
+
destructiveHint: false,
|
|
20
|
+
readOnlyHint: false,
|
|
21
|
+
openWorldHint: true,
|
|
22
|
+
},
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export type CreateRepoParams = z.input<typeof CREATE_REPO_TOOL_CONFIG.schema>;
|
|
26
|
+
type RepoType = (typeof REPO_TYPES)[number];
|
|
27
|
+
type SupportedSpaceSdk = (typeof SPACE_SDKS)[number];
|
|
28
|
+
|
|
29
|
+
function assertExhaustiveUnion<T extends never>(_value?: T): void {
|
|
30
|
+
void _value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
assertExhaustiveUnion<Exclude<HubRepoType, RepoType>>();
|
|
34
|
+
assertExhaustiveUnion<Exclude<RepoType, HubRepoType>>();
|
|
35
|
+
assertExhaustiveUnion<Exclude<SpaceSdk, SupportedSpaceSdk>>();
|
|
36
|
+
assertExhaustiveUnion<Exclude<SupportedSpaceSdk, SpaceSdk>>();
|
|
37
|
+
|
|
38
|
+
export interface CreateRepoResult {
|
|
39
|
+
url: string;
|
|
40
|
+
name: string;
|
|
41
|
+
repoType: RepoType;
|
|
42
|
+
id: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export class CreateRepoTool {
|
|
46
|
+
constructor(private readonly hfToken?: string) {}
|
|
47
|
+
|
|
48
|
+
static createToolConfig(): Omit<typeof CREATE_REPO_TOOL_CONFIG, 'description'> & { description: string } {
|
|
49
|
+
return {
|
|
50
|
+
...CREATE_REPO_TOOL_CONFIG,
|
|
51
|
+
description: 'Create a Hugging Face model, dataset, space, or bucket repository.',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async create(params: CreateRepoParams): Promise<CreateRepoResult> {
|
|
56
|
+
if (!this.hfToken) throw new Error(NO_TOKEN_INSTRUCTIONS);
|
|
57
|
+
|
|
58
|
+
const repoType = params.repo_type ?? 'model';
|
|
59
|
+
validateParams(params, repoType);
|
|
60
|
+
|
|
61
|
+
const result = await createRepo({
|
|
62
|
+
accessToken: this.hfToken,
|
|
63
|
+
repo: {
|
|
64
|
+
name: params.name,
|
|
65
|
+
type: repoType,
|
|
66
|
+
},
|
|
67
|
+
private: params.private,
|
|
68
|
+
...(repoType === 'space' ? { sdk: params.sdk } : {}),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
url: result.repoUrl,
|
|
73
|
+
name: params.name,
|
|
74
|
+
repoType,
|
|
75
|
+
id: result.id,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function validateParams(params: CreateRepoParams, repoType: RepoType): void {
|
|
81
|
+
if (!isFullyQualifiedRepoName(params.name)) {
|
|
82
|
+
throw new Error("name must be fully qualified in 'namespace/repo-name' format.");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (repoType === 'space' && !params.sdk) {
|
|
86
|
+
throw new Error('sdk is required when repo_type is space.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function isFullyQualifiedRepoName(name: string): boolean {
|
|
91
|
+
const parts = name.split('/');
|
|
92
|
+
return parts.length === 2 && parts.every((part) => part.length > 0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const formatCreateRepoResult = (result: CreateRepoResult): string => {
|
|
96
|
+
return [
|
|
97
|
+
'Repository created.',
|
|
98
|
+
`Name: ${result.name}`,
|
|
99
|
+
`Type: ${result.repoType}`,
|
|
100
|
+
`URL: ${result.url}`,
|
|
101
|
+
`ID: ${result.id}`,
|
|
102
|
+
].join('\n');
|
|
103
|
+
};
|