@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.
Files changed (65) hide show
  1. package/dist/dataset-detail.js +1 -1
  2. package/dist/dataset-detail.js.map +1 -1
  3. package/dist/dataset-viewer-inspect.d.ts +48 -0
  4. package/dist/dataset-viewer-inspect.d.ts.map +1 -0
  5. package/dist/dataset-viewer-inspect.js +660 -0
  6. package/dist/dataset-viewer-inspect.js.map +1 -0
  7. package/dist/dataset-viewer-inspect.test.d.ts +2 -0
  8. package/dist/dataset-viewer-inspect.test.d.ts.map +1 -0
  9. package/dist/dataset-viewer-inspect.test.js +218 -0
  10. package/dist/dataset-viewer-inspect.test.js.map +1 -0
  11. package/dist/gradio-files.d.ts +2 -2
  12. package/dist/hub-inspect.d.ts +17 -0
  13. package/dist/hub-inspect.d.ts.map +1 -1
  14. package/dist/hub-inspect.js +68 -4
  15. package/dist/hub-inspect.js.map +1 -1
  16. package/dist/hub-inspect.test.d.ts +2 -0
  17. package/dist/hub-inspect.test.d.ts.map +1 -0
  18. package/dist/hub-inspect.test.js +24 -0
  19. package/dist/hub-inspect.test.js.map +1 -0
  20. package/dist/index.browser.d.ts.map +1 -1
  21. package/dist/index.browser.js +2 -1
  22. package/dist/index.browser.js.map +1 -1
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/jobs/commands/run.d.ts.map +1 -1
  28. package/dist/jobs/commands/run.js +7 -1
  29. package/dist/jobs/commands/run.js.map +1 -1
  30. package/dist/jobs/commands/scheduled.d.ts.map +1 -1
  31. package/dist/jobs/commands/scheduled.js +2 -0
  32. package/dist/jobs/commands/scheduled.js.map +1 -1
  33. package/dist/jobs/commands/utils.d.ts +3 -1
  34. package/dist/jobs/commands/utils.d.ts.map +1 -1
  35. package/dist/jobs/commands/utils.js +76 -1
  36. package/dist/jobs/commands/utils.js.map +1 -1
  37. package/dist/jobs/jobs-tool.d.ts.map +1 -1
  38. package/dist/jobs/jobs-tool.js +60 -3
  39. package/dist/jobs/jobs-tool.js.map +1 -1
  40. package/dist/jobs/types.d.ts +22 -0
  41. package/dist/jobs/types.d.ts.map +1 -1
  42. package/dist/jobs/types.js +16 -1
  43. package/dist/jobs/types.js.map +1 -1
  44. package/dist/model-detail.js +1 -1
  45. package/dist/model-detail.js.map +1 -1
  46. package/dist/readme-utils.d.ts +1 -1
  47. package/dist/readme-utils.d.ts.map +1 -1
  48. package/dist/readme-utils.js +2 -13
  49. package/dist/readme-utils.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/dataset-detail.ts +1 -1
  52. package/src/dataset-viewer-inspect.test.ts +234 -0
  53. package/src/dataset-viewer-inspect.ts +809 -0
  54. package/src/hub-inspect.test.ts +28 -0
  55. package/src/hub-inspect.ts +88 -4
  56. package/src/index.browser.ts +2 -1
  57. package/src/index.ts +1 -0
  58. package/src/jobs/commands/run.ts +7 -1
  59. package/src/jobs/commands/scheduled.ts +2 -0
  60. package/src/jobs/commands/utils.ts +95 -5
  61. package/src/jobs/jobs-tool.ts +60 -3
  62. package/src/jobs/types.ts +35 -1
  63. package/src/model-detail.ts +1 -1
  64. package/src/readme-utils.ts +2 -32
  65. package/test/jobs/command-translation.spec.ts +88 -2
@@ -1,5 +1,11 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { parseTimeout, parseImageSource, parseCommand, createJobSpec } from '../../src/jobs/commands/utils.js';
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("python -c 'print(\"Hello world!\")'");
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
  });