@llmindset/hf-mcp 0.2.35 → 0.2.37
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs/api-client.d.ts.map +1 -1
- package/dist/jobs/api-client.js.map +1 -1
- package/dist/jobs/commands/run.d.ts.map +1 -1
- package/dist/jobs/commands/run.js +3 -35
- 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 +3 -30
- package/dist/jobs/commands/scheduled.js.map +1 -1
- package/dist/jobs/commands/uv-utils.d.ts +9 -0
- package/dist/jobs/commands/uv-utils.d.ts.map +1 -0
- package/dist/jobs/commands/uv-utils.js +39 -0
- package/dist/jobs/commands/uv-utils.js.map +1 -0
- package/dist/jobs/{tool.d.ts → jobs-tool.d.ts} +2 -3
- package/dist/jobs/jobs-tool.d.ts.map +1 -0
- package/dist/jobs/{tool.js → jobs-tool.js} +103 -44
- package/dist/jobs/jobs-tool.js.map +1 -0
- package/dist/jobs/schema-help.d.ts +22 -0
- package/dist/jobs/schema-help.d.ts.map +1 -0
- package/dist/jobs/schema-help.js +155 -0
- package/dist/jobs/schema-help.js.map +1 -0
- package/dist/jobs/types.d.ts +0 -6
- package/dist/jobs/types.d.ts.map +1 -1
- package/dist/jobs/types.js +13 -14
- package/dist/jobs/types.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/jobs/api-client.ts +0 -2
- package/src/jobs/commands/run.ts +3 -52
- package/src/jobs/commands/scheduled.ts +3 -42
- package/src/jobs/commands/uv-utils.ts +54 -0
- package/src/jobs/{tool.ts → jobs-tool.ts} +112 -44
- package/src/jobs/schema-help.ts +230 -0
- package/src/jobs/types.ts +14 -14
- package/dist/jobs/tool.d.ts.map +0 -1
- package/dist/jobs/tool.js.map +0 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function unwrapType(zodType) {
|
|
3
|
+
let current = zodType;
|
|
4
|
+
let isOptional = false;
|
|
5
|
+
let isNullable = false;
|
|
6
|
+
let defaultValue;
|
|
7
|
+
while (true) {
|
|
8
|
+
if (current instanceof z.ZodOptional) {
|
|
9
|
+
isOptional = true;
|
|
10
|
+
current = current._def.innerType;
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
if (current instanceof z.ZodDefault) {
|
|
14
|
+
isOptional = true;
|
|
15
|
+
defaultValue = current._def.defaultValue();
|
|
16
|
+
current = current._def.innerType;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (current instanceof z.ZodNullable) {
|
|
20
|
+
isNullable = true;
|
|
21
|
+
current = current._def.innerType;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (current instanceof z.ZodEffects) {
|
|
25
|
+
current = current._def.schema;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
return { baseType: current, isOptional, isNullable, defaultValue };
|
|
31
|
+
}
|
|
32
|
+
function isZodType(value) {
|
|
33
|
+
return value instanceof z.ZodType;
|
|
34
|
+
}
|
|
35
|
+
function isPlainObject(value) {
|
|
36
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
37
|
+
}
|
|
38
|
+
export function labelForType(zodType) {
|
|
39
|
+
if (zodType instanceof z.ZodString) {
|
|
40
|
+
return 'string';
|
|
41
|
+
}
|
|
42
|
+
if (zodType instanceof z.ZodNumber) {
|
|
43
|
+
return 'number';
|
|
44
|
+
}
|
|
45
|
+
if (zodType instanceof z.ZodBoolean) {
|
|
46
|
+
return 'boolean';
|
|
47
|
+
}
|
|
48
|
+
if (zodType instanceof z.ZodEnum) {
|
|
49
|
+
return `enum(${zodType.options.join(', ')})`;
|
|
50
|
+
}
|
|
51
|
+
if (zodType instanceof z.ZodLiteral) {
|
|
52
|
+
return `literal(${JSON.stringify(zodType.value)})`;
|
|
53
|
+
}
|
|
54
|
+
if (zodType instanceof z.ZodArray) {
|
|
55
|
+
return `array<${labelForType(zodType._def.type)}>`;
|
|
56
|
+
}
|
|
57
|
+
if (zodType instanceof z.ZodRecord) {
|
|
58
|
+
return `record<string, ${labelForType(zodType._def.valueType)}>`;
|
|
59
|
+
}
|
|
60
|
+
if (zodType instanceof z.ZodUnion) {
|
|
61
|
+
const options = zodType._def.options;
|
|
62
|
+
const labels = options.map((opt) => labelForType(opt));
|
|
63
|
+
return labels.join(' | ');
|
|
64
|
+
}
|
|
65
|
+
if (zodType instanceof z.ZodObject) {
|
|
66
|
+
return 'object';
|
|
67
|
+
}
|
|
68
|
+
return zodType.constructor.name.replace(/^Zod/, '').toLowerCase();
|
|
69
|
+
}
|
|
70
|
+
export function extractFieldDetails(schema) {
|
|
71
|
+
if (!(schema instanceof z.ZodObject)) {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
const shape = schema.shape;
|
|
75
|
+
const keys = Object.keys(shape);
|
|
76
|
+
const details = [];
|
|
77
|
+
for (const key of keys) {
|
|
78
|
+
const candidate = shape[key];
|
|
79
|
+
if (!isZodType(candidate)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const fieldSchema = candidate;
|
|
83
|
+
const { baseType, isOptional, isNullable, defaultValue } = unwrapType(fieldSchema);
|
|
84
|
+
details.push({
|
|
85
|
+
key: String(key),
|
|
86
|
+
description: fieldSchema.description ?? baseType.description,
|
|
87
|
+
typeLabel: labelForType(baseType),
|
|
88
|
+
isOptional,
|
|
89
|
+
isNullable,
|
|
90
|
+
defaultValue,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return details;
|
|
94
|
+
}
|
|
95
|
+
export function formatDefaultValue(value) {
|
|
96
|
+
if (value === undefined) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
if (typeof value === 'string') {
|
|
100
|
+
return `"${value}"`;
|
|
101
|
+
}
|
|
102
|
+
if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {
|
|
103
|
+
return String(value);
|
|
104
|
+
}
|
|
105
|
+
if (typeof value === 'symbol') {
|
|
106
|
+
return value.description ? `Symbol(${value.description})` : 'Symbol()';
|
|
107
|
+
}
|
|
108
|
+
if (value === null) {
|
|
109
|
+
return 'null';
|
|
110
|
+
}
|
|
111
|
+
if (Array.isArray(value)) {
|
|
112
|
+
try {
|
|
113
|
+
return JSON.stringify(value);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return '[unserializable]';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (isPlainObject(value)) {
|
|
120
|
+
try {
|
|
121
|
+
return JSON.stringify(value);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return '[unserializable]';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return '[unsupported]';
|
|
128
|
+
}
|
|
129
|
+
export function formatCommandHelp(commandName, schema) {
|
|
130
|
+
if (!schema) {
|
|
131
|
+
return `No help available for '${commandName}'.`;
|
|
132
|
+
}
|
|
133
|
+
const fields = extractFieldDetails(schema);
|
|
134
|
+
if (fields.length === 0) {
|
|
135
|
+
return `No help available for '${commandName}'.`;
|
|
136
|
+
}
|
|
137
|
+
const header = `# Command help: ${commandName}\n\nArguments:\n`;
|
|
138
|
+
const lines = fields.map((field) => {
|
|
139
|
+
const parts = [];
|
|
140
|
+
parts.push(field.isOptional ? 'optional' : 'required');
|
|
141
|
+
parts.push(field.typeLabel);
|
|
142
|
+
if (field.isNullable) {
|
|
143
|
+
parts.push('nullable');
|
|
144
|
+
}
|
|
145
|
+
const defaultValue = formatDefaultValue(field.defaultValue);
|
|
146
|
+
if (defaultValue !== undefined) {
|
|
147
|
+
parts.push(`default: ${defaultValue}`);
|
|
148
|
+
}
|
|
149
|
+
const meta = parts.join(', ');
|
|
150
|
+
const description = field.description ?? 'No description provided.';
|
|
151
|
+
return `- \`${field.key}\` (${meta}): ${description}`;
|
|
152
|
+
});
|
|
153
|
+
return header + lines.join('\n');
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=schema-help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-help.js","sourceRoot":"","sources":["../../src/jobs/schema-help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,MAAM,UAAU,UAAU,CAAC,OAAmB;IAM7C,IAAI,OAAO,GAAG,OAAO,CAAC;IACtB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,YAAqB,CAAC;IAE1B,OAAO,IAAI,EAAE,CAAC;QACb,IAAI,OAAO,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;YACtC,UAAU,GAAG,IAAI,CAAC;YAClB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,SAAuB,CAAC;YAC/C,SAAS;QACV,CAAC;QAED,IAAI,OAAO,YAAY,CAAC,CAAC,UAAU,EAAE,CAAC;YACrC,UAAU,GAAG,IAAI,CAAC;YAClB,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC3C,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,SAAuB,CAAC;YAC/C,SAAS;QACV,CAAC;QAED,IAAI,OAAO,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;YACtC,UAAU,GAAG,IAAI,CAAC;YAClB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,SAAuB,CAAC;YAC/C,SAAS;QACV,CAAC;QAED,IAAI,OAAO,YAAY,CAAC,CAAC,UAAU,EAAE,CAAC;YACrC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,MAAoB,CAAC;YAC5C,SAAS;QACV,CAAC;QAED,MAAM;IACP,CAAC;IAED,OAAO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
package/dist/jobs/types.d.ts
CHANGED
|
@@ -95,7 +95,6 @@ export declare const uvArgsSchema: z.ZodObject<{
|
|
|
95
95
|
namespace: z.ZodOptional<z.ZodString>;
|
|
96
96
|
} & {
|
|
97
97
|
script: z.ZodString;
|
|
98
|
-
repo: z.ZodOptional<z.ZodString>;
|
|
99
98
|
with_deps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
100
99
|
script_args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
101
100
|
python: z.ZodOptional<z.ZodString>;
|
|
@@ -112,7 +111,6 @@ export declare const uvArgsSchema: z.ZodObject<{
|
|
|
112
111
|
namespace?: string | undefined;
|
|
113
112
|
env?: Record<string, string> | undefined;
|
|
114
113
|
secrets?: Record<string, string> | undefined;
|
|
115
|
-
repo?: string | undefined;
|
|
116
114
|
with_deps?: string[] | undefined;
|
|
117
115
|
script_args?: string[] | undefined;
|
|
118
116
|
python?: string | undefined;
|
|
@@ -124,7 +122,6 @@ export declare const uvArgsSchema: z.ZodObject<{
|
|
|
124
122
|
secrets?: Record<string, string> | undefined;
|
|
125
123
|
timeout?: string | undefined;
|
|
126
124
|
detach?: boolean | undefined;
|
|
127
|
-
repo?: string | undefined;
|
|
128
125
|
with_deps?: string[] | undefined;
|
|
129
126
|
script_args?: string[] | undefined;
|
|
130
127
|
python?: string | undefined;
|
|
@@ -219,7 +216,6 @@ export declare const scheduledUvArgsSchema: z.ZodObject<{
|
|
|
219
216
|
namespace: z.ZodOptional<z.ZodString>;
|
|
220
217
|
} & {
|
|
221
218
|
script: z.ZodString;
|
|
222
|
-
repo: z.ZodOptional<z.ZodString>;
|
|
223
219
|
with_deps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
224
220
|
script_args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
225
221
|
python: z.ZodOptional<z.ZodString>;
|
|
@@ -241,7 +237,6 @@ export declare const scheduledUvArgsSchema: z.ZodObject<{
|
|
|
241
237
|
namespace?: string | undefined;
|
|
242
238
|
env?: Record<string, string> | undefined;
|
|
243
239
|
secrets?: Record<string, string> | undefined;
|
|
244
|
-
repo?: string | undefined;
|
|
245
240
|
with_deps?: string[] | undefined;
|
|
246
241
|
script_args?: string[] | undefined;
|
|
247
242
|
python?: string | undefined;
|
|
@@ -254,7 +249,6 @@ export declare const scheduledUvArgsSchema: z.ZodObject<{
|
|
|
254
249
|
secrets?: Record<string, string> | undefined;
|
|
255
250
|
timeout?: string | undefined;
|
|
256
251
|
detach?: boolean | undefined;
|
|
257
|
-
repo?: string | undefined;
|
|
258
252
|
with_deps?: string[] | undefined;
|
|
259
253
|
script_args?: string[] | undefined;
|
|
260
254
|
python?: 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":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,WAAW,oEAAqE,CAAC;AAE9F,eAAO,MAAM,WAAW,oMAiBd,CAAC;AAEX,eAAO,MAAM,mBAAmB,qBAAsB,CAAC;AAEvD,eAAO,MAAM,WAAW,uQAAoE,CAAC;AAE7F,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAKrD,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,IAAI,CAAC;CACxB;AAKD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;CACrB;AAMD,MAAM,WAAW,OAAO;IACvB,EAAE,E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U,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
|
@@ -36,35 +36,36 @@ export const runArgsSchema = commonArgsSchema.extend({
|
|
|
36
36
|
.default('cpu-basic')
|
|
37
37
|
.describe(`Hardware flavor. Options: ${ALL_FLAVORS.join(', ')}`),
|
|
38
38
|
env: z.record(z.string()).optional().describe('Environment variables as key-value pairs'),
|
|
39
|
-
secrets: z
|
|
40
|
-
|
|
41
|
-
.string()
|
|
39
|
+
secrets: z
|
|
40
|
+
.record(z.string())
|
|
42
41
|
.optional()
|
|
43
|
-
.describe('
|
|
44
|
-
|
|
42
|
+
.describe('Secrets as key-value pairs. Use HF_TOKEN=$HF_TOKEN to include your token'),
|
|
43
|
+
timeout: z.string().optional().describe('Max duration (e.g., "5m", "2h", "30s"). Default: 30m').default('30m'),
|
|
45
44
|
detach: z
|
|
46
45
|
.boolean()
|
|
47
46
|
.optional()
|
|
48
47
|
.default(true)
|
|
49
|
-
.describe('Run in background and return
|
|
48
|
+
.describe('Run in background and return after 10 seconds (default: true)'),
|
|
50
49
|
});
|
|
51
50
|
export const uvArgsSchema = commonArgsSchema.extend({
|
|
52
51
|
script: z
|
|
53
52
|
.string()
|
|
54
53
|
.describe('Python script: local file path, URL, or inline code. UV will handle dependencies automatically.'),
|
|
55
|
-
repo: z.string().optional().describe('Persistent repository name for script storage'),
|
|
56
54
|
with_deps: z.array(z.string()).optional().describe('Additional package dependencies'),
|
|
57
55
|
script_args: z.array(z.string()).optional().describe('Arguments to pass to the script'),
|
|
58
56
|
python: z.string().optional().describe('Python interpreter version (e.g., "3.12")'),
|
|
59
57
|
flavor: z.enum(ALL_FLAVORS).optional().default('cpu-basic').describe('Hardware flavor'),
|
|
60
|
-
env: z.record(z.string()).optional().describe('Environment variables'),
|
|
61
|
-
secrets: z
|
|
58
|
+
env: z.record(z.string()).optional().describe('Environment variables as key-value pairs'),
|
|
59
|
+
secrets: z
|
|
60
|
+
.record(z.string())
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('Secrets as key-value pairs. Use HF_TOKEN=$HF_TOKEN to include your token'),
|
|
62
63
|
timeout: z.string().optional().default('30m').describe('Max duration'),
|
|
63
|
-
detach: z.boolean().optional().default(true).describe('Run in background'),
|
|
64
|
+
detach: z.boolean().optional().default(true).describe('Run in background and return after 10 seconds'),
|
|
64
65
|
});
|
|
65
66
|
export const psArgsSchema = commonArgsSchema.extend({
|
|
66
67
|
all: z.boolean().optional().default(false).describe('Show all jobs (default: only running)'),
|
|
67
|
-
status: z.string().optional().describe('Filter by status (
|
|
68
|
+
status: z.string().optional().describe('Filter by status ("RUNNING", "COMPLETED", "CANCELED", "ERROR", "DELETED")'),
|
|
68
69
|
});
|
|
69
70
|
export const logsArgsSchema = commonArgsSchema.extend({
|
|
70
71
|
job_id: z.string().describe('Job ID to fetch logs from'),
|
|
@@ -77,9 +78,7 @@ export const cancelArgsSchema = commonArgsSchema.extend({
|
|
|
77
78
|
job_id: z.string().describe('Job ID to cancel'),
|
|
78
79
|
});
|
|
79
80
|
export const scheduledRunArgsSchema = runArgsSchema.extend({
|
|
80
|
-
schedule: z
|
|
81
|
-
.string()
|
|
82
|
-
.describe('Schedule: cron expression or shorthand (@hourly, @daily, @weekly, @monthly, @yearly)'),
|
|
81
|
+
schedule: z.string().describe('Schedule: cron expression or shorthand (@hourly, @daily, @weekly, @monthly, @yearly)'),
|
|
83
82
|
suspend: z.boolean().optional().default(false).describe('Create in suspended state'),
|
|
84
83
|
});
|
|
85
84
|
export const scheduledUvArgsSchema = uvArgsSchema.extend({
|
package/dist/jobs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/jobs/types.ts"],"names":[],"mappings":"AAAA,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,MAAM;IACN,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;AAqG7F,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,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iFAAiF,CAAC;IAC7G,OAAO,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;SACxC,QAAQ,CACR,gF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BAAqB,GAAG,gBAAgB,CAAC,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/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ export * from './docs-search/docs-semantic-search.js';
|
|
|
19
19
|
export * from './docs-search/doc-fetch.js';
|
|
20
20
|
export * from './readme-utils.js';
|
|
21
21
|
export * from './use-space.js';
|
|
22
|
-
export * from './jobs/tool.js';
|
|
22
|
+
export * from './jobs/jobs-tool.js';
|
|
23
23
|
|
|
24
24
|
// Export shared types
|
|
25
25
|
export * from './types/tool-result.js';
|
package/src/jobs/api-client.ts
CHANGED
|
@@ -52,8 +52,6 @@ export class JobsApiClient extends HfApiCall {
|
|
|
52
52
|
const ns = await this.getNamespace(namespace);
|
|
53
53
|
const url = `https://huggingface.co/api/jobs/${ns}`;
|
|
54
54
|
|
|
55
|
-
// Debug logging (will be visible in server logs)
|
|
56
|
-
|
|
57
55
|
const result = await this.fetchFromApi<JobInfo>(url, {
|
|
58
56
|
method: 'POST',
|
|
59
57
|
headers: {
|
package/src/jobs/commands/run.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { RunArgs, UvArgs } from '../types.js';
|
|
|
2
2
|
import type { JobsApiClient } from '../api-client.js';
|
|
3
3
|
import { createJobSpec } from './utils.js';
|
|
4
4
|
import { fetchJobLogs } from '../sse-handler.js';
|
|
5
|
+
import { resolveUvCommand, UV_DEFAULT_IMAGE } from './uv-utils.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Execute the 'run' command
|
|
@@ -64,31 +65,10 @@ To inspect: \`hf_jobs("inspect", {"job_id": "${job.id}"})\``;
|
|
|
64
65
|
*/
|
|
65
66
|
export async function uvCommand(args: UvArgs, client: JobsApiClient, token?: string): Promise<string> {
|
|
66
67
|
// UV jobs use a standard UV image unless overridden
|
|
67
|
-
const image =
|
|
68
|
+
const image = UV_DEFAULT_IMAGE;
|
|
68
69
|
|
|
69
70
|
// Detect script source and build command
|
|
70
|
-
const
|
|
71
|
-
let command: string | string[];
|
|
72
|
-
|
|
73
|
-
// Check if script is a URL
|
|
74
|
-
if (scriptSource.startsWith('http://') || scriptSource.startsWith('https://')) {
|
|
75
|
-
// URL - download and run
|
|
76
|
-
command = buildUvCommand(scriptSource, args);
|
|
77
|
-
} else if (scriptSource.includes('\n')) {
|
|
78
|
-
// Inline multi-line script - encode it
|
|
79
|
-
const encoded = Buffer.from(scriptSource).toString('base64');
|
|
80
|
-
const depsPart =
|
|
81
|
-
args.with_deps && args.with_deps.length > 0
|
|
82
|
-
? args.with_deps.map(dep => `--with ${dep}`).join(' ')
|
|
83
|
-
: '';
|
|
84
|
-
const pythonPart = args.python ? `-p ${args.python}` : '';
|
|
85
|
-
const uvArgs = [depsPart, pythonPart].filter(Boolean).join(' ');
|
|
86
|
-
const shellSnippet = `echo "${encoded}" | base64 -d | uv run${uvArgs ? ` ${uvArgs}` : ''} -`;
|
|
87
|
-
command = ['/bin/sh', '-lc', shellSnippet];
|
|
88
|
-
} else {
|
|
89
|
-
// Assume it's a URL or path - UV will handle it
|
|
90
|
-
command = buildUvCommand(scriptSource, args);
|
|
91
|
-
}
|
|
71
|
+
const command = resolveUvCommand(args);
|
|
92
72
|
|
|
93
73
|
// Convert to run args
|
|
94
74
|
const runArgs: RunArgs = {
|
|
@@ -104,32 +84,3 @@ export async function uvCommand(args: UvArgs, client: JobsApiClient, token?: str
|
|
|
104
84
|
|
|
105
85
|
return runCommand(runArgs, client, token);
|
|
106
86
|
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Build UV command with options
|
|
110
|
-
*/
|
|
111
|
-
function buildUvCommand(script: string, args: UvArgs): string {
|
|
112
|
-
const parts: string[] = ['uv', 'run'];
|
|
113
|
-
|
|
114
|
-
// Add dependencies
|
|
115
|
-
if (args.with_deps && args.with_deps.length > 0) {
|
|
116
|
-
for (const dep of args.with_deps) {
|
|
117
|
-
parts.push('--with', dep);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Add Python version
|
|
122
|
-
if (args.python) {
|
|
123
|
-
parts.push('-p', args.python);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Add script
|
|
127
|
-
parts.push(script);
|
|
128
|
-
|
|
129
|
-
// Add script arguments
|
|
130
|
-
if (args.script_args && args.script_args.length > 0) {
|
|
131
|
-
parts.push(...args.script_args);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return parts.join(' ');
|
|
135
|
-
}
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
import type { JobsApiClient } from '../api-client.js';
|
|
9
9
|
import { formatScheduledJobsTable, formatScheduledJobDetails } from '../formatters.js';
|
|
10
10
|
import { createJobSpec } from './utils.js';
|
|
11
|
+
import { resolveUvCommand, UV_DEFAULT_IMAGE } from './uv-utils.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Execute 'scheduled run' command
|
|
@@ -60,22 +61,10 @@ export async function scheduledUvCommand(
|
|
|
60
61
|
token?: string
|
|
61
62
|
): Promise<string> {
|
|
62
63
|
// For UV, use standard UV image
|
|
63
|
-
const image =
|
|
64
|
+
const image = UV_DEFAULT_IMAGE;
|
|
64
65
|
|
|
65
66
|
// Build UV command (similar to regular uv command)
|
|
66
|
-
const
|
|
67
|
-
let command: string;
|
|
68
|
-
|
|
69
|
-
if (scriptSource.startsWith('http://') || scriptSource.startsWith('https://')) {
|
|
70
|
-
command = buildUvCommand(scriptSource, args);
|
|
71
|
-
} else if (scriptSource.includes('\n')) {
|
|
72
|
-
const encoded = Buffer.from(scriptSource).toString('base64');
|
|
73
|
-
const deps =
|
|
74
|
-
args.with_deps && args.with_deps.length > 0 ? args.with_deps.map((dep) => `--with ${dep}`).join(' ') + ' ' : '';
|
|
75
|
-
command = `echo "${encoded}" | base64 -d | uv run ${deps}${args.python ? `-p ${args.python}` : ''} -`;
|
|
76
|
-
} else {
|
|
77
|
-
command = buildUvCommand(scriptSource, args);
|
|
78
|
-
}
|
|
67
|
+
const command = resolveUvCommand(args);
|
|
79
68
|
|
|
80
69
|
// Convert to scheduled run args
|
|
81
70
|
const scheduledRunArgs: ScheduledRunArgs = {
|
|
@@ -94,34 +83,6 @@ export async function scheduledUvCommand(
|
|
|
94
83
|
return scheduledRunCommand(scheduledRunArgs, client, token);
|
|
95
84
|
}
|
|
96
85
|
|
|
97
|
-
/**
|
|
98
|
-
* Build UV command with options
|
|
99
|
-
*/
|
|
100
|
-
function buildUvCommand(
|
|
101
|
-
script: string,
|
|
102
|
-
args: { with_deps?: string[]; python?: string; script_args?: string[] }
|
|
103
|
-
): string {
|
|
104
|
-
const parts: string[] = ['uv', 'run'];
|
|
105
|
-
|
|
106
|
-
if (args.with_deps && args.with_deps.length > 0) {
|
|
107
|
-
for (const dep of args.with_deps) {
|
|
108
|
-
parts.push('--with', dep);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (args.python) {
|
|
113
|
-
parts.push('-p', args.python);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
parts.push(script);
|
|
117
|
-
|
|
118
|
-
if (args.script_args && args.script_args.length > 0) {
|
|
119
|
-
parts.push(...args.script_args);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return parts.join(' ');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
86
|
/**
|
|
126
87
|
* Execute 'scheduled ps' command
|
|
127
88
|
* Lists scheduled jobs
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { quote as shellQuote } from 'shell-quote';
|
|
2
|
+
import type { UvArgs } from '../types.js';
|
|
3
|
+
|
|
4
|
+
export const UV_DEFAULT_IMAGE = 'ghcr.io/astral-sh/uv:python3.12-bookworm';
|
|
5
|
+
|
|
6
|
+
type UvCommandOptions = Pick<UvArgs, 'with_deps' | 'python' | 'script_args'>;
|
|
7
|
+
type UvCommandLikeArgs = Pick<UvArgs, 'script' | 'with_deps' | 'python' | 'script_args'>;
|
|
8
|
+
|
|
9
|
+
export function buildUvCommand(script: string, args: UvCommandOptions): string[] {
|
|
10
|
+
const parts: string[] = ['uv', 'run'];
|
|
11
|
+
|
|
12
|
+
if (args.with_deps && args.with_deps.length > 0) {
|
|
13
|
+
for (const dep of args.with_deps) {
|
|
14
|
+
parts.push('--with', dep);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (args.python) {
|
|
19
|
+
parts.push('-p', args.python);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
parts.push(script);
|
|
23
|
+
|
|
24
|
+
if (args.script_args && args.script_args.length > 0) {
|
|
25
|
+
parts.push(...args.script_args);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return parts;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function wrapInlineScript(script: string, args: UvCommandOptions): string {
|
|
32
|
+
const encoded = Buffer.from(script, 'utf-8').toString('base64');
|
|
33
|
+
const baseCommand = shellQuote(buildUvCommand('-', args));
|
|
34
|
+
return `echo "${encoded}" | base64 -d | ${baseCommand}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function resolveUvCommand(args: UvCommandLikeArgs): string[] {
|
|
38
|
+
const options: UvCommandOptions = {
|
|
39
|
+
with_deps: args.with_deps,
|
|
40
|
+
python: args.python,
|
|
41
|
+
script_args: args.script_args,
|
|
42
|
+
};
|
|
43
|
+
const scriptSource = args.script;
|
|
44
|
+
|
|
45
|
+
if (scriptSource.startsWith('http://') || scriptSource.startsWith('https://')) {
|
|
46
|
+
return buildUvCommand(scriptSource, options);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (scriptSource.includes('\n')) {
|
|
50
|
+
return ['/bin/sh', '-lc', wrapInlineScript(scriptSource, options)];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return buildUvCommand(scriptSource, options);
|
|
54
|
+
}
|