@llmindset/hf-mcp 0.3.11 → 0.3.13
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/dataset-detail.js +1 -1
- package/dist/dataset-detail.js.map +1 -1
- package/dist/dataset-viewer-inspect.d.ts +48 -0
- package/dist/dataset-viewer-inspect.d.ts.map +1 -0
- package/dist/dataset-viewer-inspect.js +660 -0
- package/dist/dataset-viewer-inspect.js.map +1 -0
- package/dist/dataset-viewer-inspect.test.d.ts +2 -0
- package/dist/dataset-viewer-inspect.test.d.ts.map +1 -0
- package/dist/dataset-viewer-inspect.test.js +218 -0
- package/dist/dataset-viewer-inspect.test.js.map +1 -0
- package/dist/gradio-files.d.ts +2 -2
- package/dist/hub-inspect.d.ts +17 -0
- package/dist/hub-inspect.d.ts.map +1 -1
- package/dist/hub-inspect.js +68 -4
- package/dist/hub-inspect.js.map +1 -1
- package/dist/hub-inspect.test.d.ts +2 -0
- package/dist/hub-inspect.test.d.ts.map +1 -0
- package/dist/hub-inspect.test.js +24 -0
- package/dist/hub-inspect.test.js.map +1 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +2 -1
- 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/commands/run.d.ts.map +1 -1
- package/dist/jobs/commands/run.js +7 -1
- package/dist/jobs/commands/run.js.map +1 -1
- package/dist/jobs/commands/scheduled.d.ts.map +1 -1
- package/dist/jobs/commands/scheduled.js +2 -0
- package/dist/jobs/commands/scheduled.js.map +1 -1
- package/dist/jobs/commands/utils.d.ts +3 -1
- package/dist/jobs/commands/utils.d.ts.map +1 -1
- package/dist/jobs/commands/utils.js +76 -1
- package/dist/jobs/commands/utils.js.map +1 -1
- package/dist/jobs/jobs-tool.d.ts.map +1 -1
- package/dist/jobs/jobs-tool.js +60 -3
- package/dist/jobs/jobs-tool.js.map +1 -1
- package/dist/jobs/types.d.ts +22 -0
- package/dist/jobs/types.d.ts.map +1 -1
- package/dist/jobs/types.js +16 -1
- package/dist/jobs/types.js.map +1 -1
- package/dist/model-detail.js +1 -1
- package/dist/model-detail.js.map +1 -1
- package/dist/readme-utils.d.ts +1 -1
- package/dist/readme-utils.d.ts.map +1 -1
- package/dist/readme-utils.js +2 -13
- package/dist/readme-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/dataset-detail.ts +1 -1
- package/src/dataset-viewer-inspect.test.ts +234 -0
- package/src/dataset-viewer-inspect.ts +809 -0
- package/src/hub-inspect.test.ts +28 -0
- package/src/hub-inspect.ts +88 -4
- package/src/index.browser.ts +2 -1
- package/src/index.ts +1 -0
- package/src/jobs/commands/run.ts +7 -1
- package/src/jobs/commands/scheduled.ts +2 -0
- package/src/jobs/commands/utils.ts +95 -5
- package/src/jobs/jobs-tool.ts +60 -3
- package/src/jobs/types.ts +35 -1
- package/src/model-detail.ts +1 -1
- package/src/readme-utils.ts +2 -32
- package/test/jobs/command-translation.spec.ts +88 -2
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
parseTimeout,
|
|
4
|
+
parseImageSource,
|
|
5
|
+
parseCommand,
|
|
6
|
+
parseVolumes,
|
|
7
|
+
createJobSpec,
|
|
8
|
+
} from '../../src/jobs/commands/utils.js';
|
|
3
9
|
|
|
4
10
|
describe('Jobs Command Translation', () => {
|
|
5
11
|
describe('parseTimeout', () => {
|
|
@@ -104,7 +110,7 @@ describe('Jobs Command Translation', () => {
|
|
|
104
110
|
});
|
|
105
111
|
|
|
106
112
|
it('should handle single-quoted strings', () => {
|
|
107
|
-
const result = parseCommand(
|
|
113
|
+
const result = parseCommand('python -c \'print("Hello world!")\'');
|
|
108
114
|
expect(result.command).toEqual(['python', '-c', 'print("Hello world!")']);
|
|
109
115
|
});
|
|
110
116
|
|
|
@@ -203,6 +209,67 @@ describe('Jobs Command Translation', () => {
|
|
|
203
209
|
});
|
|
204
210
|
});
|
|
205
211
|
|
|
212
|
+
describe('parseVolumes', () => {
|
|
213
|
+
it('should parse explicit model volume', () => {
|
|
214
|
+
expect(parseVolumes(['hf://models/org/model:/model'])).toEqual([
|
|
215
|
+
{ type: 'model', source: 'org/model', mountPath: '/model' },
|
|
216
|
+
]);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('should parse implicit model volume with owner and name', () => {
|
|
220
|
+
expect(parseVolumes(['hf://org/model:/model'])).toEqual([
|
|
221
|
+
{ type: 'model', source: 'org/model', mountPath: '/model' },
|
|
222
|
+
]);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('should parse dataset volume with read-only suffix', () => {
|
|
226
|
+
expect(parseVolumes(['hf://datasets/org/ds:/data:ro'])).toEqual([
|
|
227
|
+
{ type: 'dataset', source: 'org/ds', mountPath: '/data', readOnly: true },
|
|
228
|
+
]);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it('should parse bucket subpath with read-write suffix', () => {
|
|
232
|
+
expect(parseVolumes(['hf://buckets/org/b/sub/dir:/output:rw'])).toEqual([
|
|
233
|
+
{
|
|
234
|
+
type: 'bucket',
|
|
235
|
+
source: 'org/b',
|
|
236
|
+
path: 'sub/dir',
|
|
237
|
+
mountPath: '/output',
|
|
238
|
+
readOnly: false,
|
|
239
|
+
},
|
|
240
|
+
]);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('should parse multiple volumes', () => {
|
|
244
|
+
expect(parseVolumes(['hf://datasets/org/ds:/data:ro', 'hf://buckets/org/b:/output'])).toEqual([
|
|
245
|
+
{ type: 'dataset', source: 'org/ds', mountPath: '/data', readOnly: true },
|
|
246
|
+
{ type: 'bucket', source: 'org/b', mountPath: '/output' },
|
|
247
|
+
]);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it('should omit empty volumes', () => {
|
|
251
|
+
expect(parseVolumes()).toBeUndefined();
|
|
252
|
+
expect(parseVolumes([])).toBeUndefined();
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should reject missing hf prefix', () => {
|
|
256
|
+
expect(() => parseVolumes(['datasets/org/ds:/data'])).toThrow(/Invalid volume.*hf:\/\//);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('should reject single-segment source ids', () => {
|
|
260
|
+
expect(() => parseVolumes(['hf://gpt2:/model'])).toThrow(/OWNER\/NAME/);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('should reject singular type prefixes', () => {
|
|
264
|
+
expect(() => parseVolumes(['hf://dataset/org/ds:/data'])).toThrow(/plural/);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('should reject invalid mount paths', () => {
|
|
268
|
+
expect(() => parseVolumes(['hf://datasets/org/ds:/'])).toThrow(/Mount path/);
|
|
269
|
+
expect(() => parseVolumes(['hf://datasets/org/ds:data'])).toThrow(/Missing mount path/);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
206
273
|
describe('createJobSpec', () => {
|
|
207
274
|
it('should create a basic job spec', () => {
|
|
208
275
|
const spec = createJobSpec({
|
|
@@ -327,5 +394,24 @@ describe('Jobs Command Translation', () => {
|
|
|
327
394
|
|
|
328
395
|
expect(spec.command).toEqual(['bash', '-c', 'echo hello']);
|
|
329
396
|
});
|
|
397
|
+
|
|
398
|
+
it('should include volumes when provided', () => {
|
|
399
|
+
const spec = createJobSpec({
|
|
400
|
+
image: 'python:3.12',
|
|
401
|
+
command: ['echo', 'hi'],
|
|
402
|
+
volumes: ['hf://datasets/org/ds:/data:ro'],
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
expect(spec.volumes).toEqual([{ type: 'dataset', source: 'org/ds', mountPath: '/data', readOnly: true }]);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it('should omit volumes when not provided', () => {
|
|
409
|
+
const spec = createJobSpec({
|
|
410
|
+
image: 'python:3.12',
|
|
411
|
+
command: ['echo', 'hi'],
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
expect(spec).not.toHaveProperty('volumes');
|
|
415
|
+
});
|
|
330
416
|
});
|
|
331
417
|
});
|