@llmindset/hf-mcp 0.2.32 → 0.2.34
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/docs-search/docs-semantic-search.d.ts +2 -2
- package/dist/docs-search/docs-semantic-search.d.ts.map +1 -1
- package/dist/docs-search/docs-semantic-search.js +56 -21
- package/dist/docs-search/docs-semantic-search.js.map +1 -1
- package/dist/hf-api-call.d.ts.map +1 -1
- package/dist/hf-api-call.js +4 -0
- package/dist/hf-api-call.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/api-client.d.ts +19 -0
- package/dist/jobs/api-client.d.ts.map +1 -0
- package/dist/jobs/api-client.js +104 -0
- package/dist/jobs/api-client.js.map +1 -0
- package/dist/jobs/commands/inspect.d.ts +5 -0
- package/dist/jobs/commands/inspect.d.ts.map +1 -0
- package/dist/jobs/commands/inspect.js +21 -0
- package/dist/jobs/commands/inspect.js.map +1 -0
- package/dist/jobs/commands/logs.d.ts +4 -0
- package/dist/jobs/commands/logs.d.ts.map +1 -0
- package/dist/jobs/commands/logs.js +24 -0
- package/dist/jobs/commands/logs.js.map +1 -0
- package/dist/jobs/commands/ps.d.ts +4 -0
- package/dist/jobs/commands/ps.d.ts.map +1 -0
- package/dist/jobs/commands/ps.js +23 -0
- package/dist/jobs/commands/ps.js.map +1 -0
- package/dist/jobs/commands/run.d.ts +5 -0
- package/dist/jobs/commands/run.d.ts.map +1 -0
- package/dist/jobs/commands/run.js +89 -0
- package/dist/jobs/commands/run.js.map +1 -0
- package/dist/jobs/commands/scheduled.d.ts +10 -0
- package/dist/jobs/commands/scheduled.d.ts.map +1 -0
- package/dist/jobs/commands/scheduled.js +111 -0
- package/dist/jobs/commands/scheduled.js.map +1 -0
- package/dist/jobs/commands/utils.d.ts +19 -0
- package/dist/jobs/commands/utils.d.ts.map +1 -0
- package/dist/jobs/commands/utils.js +99 -0
- package/dist/jobs/commands/utils.js.map +1 -0
- package/dist/jobs/formatters.d.ts +6 -0
- package/dist/jobs/formatters.d.ts.map +1 -0
- package/dist/jobs/formatters.js +98 -0
- package/dist/jobs/formatters.js.map +1 -0
- package/dist/jobs/sse-handler.d.ts +12 -0
- package/dist/jobs/sse-handler.d.ts.map +1 -0
- package/dist/jobs/sse-handler.js +80 -0
- package/dist/jobs/sse-handler.js.map +1 -0
- package/dist/jobs/tool.d.ts +35 -0
- package/dist/jobs/tool.d.ts.map +1 -0
- package/dist/jobs/tool.js +333 -0
- package/dist/jobs/tool.js.map +1 -0
- package/dist/jobs/types.d.ts +295 -0
- package/dist/jobs/types.d.ts.map +1 -0
- package/dist/jobs/types.js +95 -0
- package/dist/jobs/types.js.map +1 -0
- package/dist/tool-ids.d.ts +3 -2
- package/dist/tool-ids.d.ts.map +1 -1
- package/dist/tool-ids.js +10 -2
- package/dist/tool-ids.js.map +1 -1
- package/dist/types/tool-result.d.ts +1 -0
- package/dist/types/tool-result.d.ts.map +1 -1
- package/dist/use-space.d.ts +0 -1
- package/dist/use-space.d.ts.map +1 -1
- package/dist/use-space.js +0 -1
- package/dist/use-space.js.map +1 -1
- package/package.json +4 -2
- package/src/docs-search/docs-semantic-search.ts +71 -20
- package/src/hf-api-call.ts +6 -0
- package/src/index.ts +1 -0
- package/src/jobs/api-client.ts +195 -0
- package/src/jobs/commands/inspect.ts +38 -0
- package/src/jobs/commands/logs.ts +36 -0
- package/src/jobs/commands/ps.ts +40 -0
- package/src/jobs/commands/run.ts +134 -0
- package/src/jobs/commands/scheduled.ts +189 -0
- package/src/jobs/commands/utils.ts +158 -0
- package/src/jobs/formatters.ts +149 -0
- package/src/jobs/sse-handler.ts +144 -0
- package/src/jobs/tool.ts +435 -0
- package/src/jobs/types.ts +237 -0
- package/src/tool-ids.ts +11 -1
- package/src/types/tool-result.ts +6 -0
- package/src/use-space.ts +0 -1
- package/test/jobs/command-translation.spec.ts +277 -0
- package/test/jobs/formatters.spec.ts +267 -0
- package/test/jobs/uv-command.spec.ts +81 -0
- package/dist/types/mcp-ui-server-shim.d.ts +0 -37
- package/dist/types/mcp-ui-server-shim.d.ts.map +0 -1
- package/dist/types/mcp-ui-server-shim.js +0 -2
- package/dist/types/mcp-ui-server-shim.js.map +0 -1
- package/src/types/mcp-ui-server-shim.ts +0 -35
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CPU_FLAVORS = ['cpu-basic', 'cpu-upgrade', 'cpu-performance', 'cpu-xl'];
|
|
3
|
+
export const GPU_FLAVORS = [
|
|
4
|
+
'sprx8',
|
|
5
|
+
'zero-a10g',
|
|
6
|
+
't4-small',
|
|
7
|
+
't4-medium',
|
|
8
|
+
'l4x1',
|
|
9
|
+
'l4x4',
|
|
10
|
+
'l40sx1',
|
|
11
|
+
'l40sx4',
|
|
12
|
+
'l40sx8',
|
|
13
|
+
'a10g-small',
|
|
14
|
+
'a10g-large',
|
|
15
|
+
'a10g-largex2',
|
|
16
|
+
'a10g-largex4',
|
|
17
|
+
'a100-large',
|
|
18
|
+
'h100',
|
|
19
|
+
'h100x8',
|
|
20
|
+
];
|
|
21
|
+
export const SPECIALIZED_FLAVORS = ['inf2x6'];
|
|
22
|
+
export const ALL_FLAVORS = [...CPU_FLAVORS, ...GPU_FLAVORS, ...SPECIALIZED_FLAVORS];
|
|
23
|
+
const commonArgsSchema = z.object({
|
|
24
|
+
namespace: z.string().optional().describe('Target namespace (username or organization). Defaults to current user.'),
|
|
25
|
+
});
|
|
26
|
+
export const runArgsSchema = commonArgsSchema.extend({
|
|
27
|
+
image: z.string().describe('Docker image or HF Space URL (e.g., "python:3.12" or "hf.co/spaces/user/space")'),
|
|
28
|
+
command: z
|
|
29
|
+
.union([z.string(), z.array(z.string())])
|
|
30
|
+
.describe('Command to execute. Array format recommended (e.g., ["python", "script.py"]). ' +
|
|
31
|
+
'String format is parsed with POSIX shell semantics (quotes, escaping). ' +
|
|
32
|
+
'For multiline scripts, use array with newlines in arguments.'),
|
|
33
|
+
flavor: z
|
|
34
|
+
.enum(ALL_FLAVORS)
|
|
35
|
+
.optional()
|
|
36
|
+
.default('cpu-basic')
|
|
37
|
+
.describe(`Hardware flavor. Options: ${ALL_FLAVORS.join(', ')}`),
|
|
38
|
+
env: z.record(z.string()).optional().describe('Environment variables as key-value pairs'),
|
|
39
|
+
secrets: z.record(z.string()).optional().describe('Secret environment variables (encrypted server-side)'),
|
|
40
|
+
timeout: z
|
|
41
|
+
.string()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Max duration (e.g., "5m", "2h", "30s"). Default: 30m')
|
|
44
|
+
.default('30m'),
|
|
45
|
+
detach: z
|
|
46
|
+
.boolean()
|
|
47
|
+
.optional()
|
|
48
|
+
.default(true)
|
|
49
|
+
.describe('Run in background and return immediately (default: true)'),
|
|
50
|
+
});
|
|
51
|
+
export const uvArgsSchema = commonArgsSchema.extend({
|
|
52
|
+
script: z
|
|
53
|
+
.string()
|
|
54
|
+
.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
|
+
with_deps: z.array(z.string()).optional().describe('Additional package dependencies'),
|
|
57
|
+
script_args: z.array(z.string()).optional().describe('Arguments to pass to the script'),
|
|
58
|
+
python: z.string().optional().describe('Python interpreter version (e.g., "3.12")'),
|
|
59
|
+
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.record(z.string()).optional().describe('Secret environment variables'),
|
|
62
|
+
timeout: z.string().optional().default('30m').describe('Max duration'),
|
|
63
|
+
detach: z.boolean().optional().default(true).describe('Run in background'),
|
|
64
|
+
});
|
|
65
|
+
export const psArgsSchema = commonArgsSchema.extend({
|
|
66
|
+
all: z.boolean().optional().default(false).describe('Show all jobs (default: only running)'),
|
|
67
|
+
status: z.string().optional().describe('Filter by status (e.g., "RUNNING", "COMPLETED")'),
|
|
68
|
+
});
|
|
69
|
+
export const logsArgsSchema = commonArgsSchema.extend({
|
|
70
|
+
job_id: z.string().describe('Job ID to fetch logs from'),
|
|
71
|
+
tail: z.number().optional().default(20).describe('Number of lines to return (default: 20)'),
|
|
72
|
+
});
|
|
73
|
+
export const inspectArgsSchema = commonArgsSchema.extend({
|
|
74
|
+
job_id: z.union([z.string(), z.array(z.string())]).describe('Job ID(s) to inspect'),
|
|
75
|
+
});
|
|
76
|
+
export const cancelArgsSchema = commonArgsSchema.extend({
|
|
77
|
+
job_id: z.string().describe('Job ID to cancel'),
|
|
78
|
+
});
|
|
79
|
+
export const scheduledRunArgsSchema = runArgsSchema.extend({
|
|
80
|
+
schedule: z
|
|
81
|
+
.string()
|
|
82
|
+
.describe('Schedule: cron expression or shorthand (@hourly, @daily, @weekly, @monthly, @yearly)'),
|
|
83
|
+
suspend: z.boolean().optional().default(false).describe('Create in suspended state'),
|
|
84
|
+
});
|
|
85
|
+
export const scheduledUvArgsSchema = uvArgsSchema.extend({
|
|
86
|
+
schedule: z.string().describe('Schedule: cron expression or shorthand'),
|
|
87
|
+
suspend: z.boolean().optional().default(false).describe('Create in suspended state'),
|
|
88
|
+
});
|
|
89
|
+
export const scheduledPsArgsSchema = commonArgsSchema.extend({
|
|
90
|
+
all: z.boolean().optional().default(false).describe('Show all scheduled jobs (default: hide suspended)'),
|
|
91
|
+
});
|
|
92
|
+
export const scheduledJobArgsSchema = commonArgsSchema.extend({
|
|
93
|
+
scheduled_job_id: z.string().describe('Scheduled job ID'),
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +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,WAA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User Summary";
|
|
|
15
15
|
export declare const PAPER_SUMMARY_PROMPT_ID: "Paper Summary";
|
|
16
16
|
export declare const MODEL_DETAIL_PROMPT_ID: string;
|
|
17
17
|
export declare const DATASET_DETAIL_PROMPT_ID: string;
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const HF_JOBS_TOOL_ID: "hf_jobs";
|
|
19
|
+
export declare const ALL_BUILTIN_TOOL_IDS: readonly ["space_search", "model_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"];
|
|
19
20
|
export declare const TOOL_ID_GROUPS: {
|
|
20
21
|
readonly search: readonly ["space_search", "model_search", "dataset_search", "paper_search", "hf_doc_search"];
|
|
21
22
|
readonly spaces: readonly ["space_search", "duplicate_space", "space_info", "space_files", "use_space"];
|
|
22
23
|
readonly detail: readonly ["model_details", "dataset_details", "hub_repo_details"];
|
|
23
24
|
readonly docs: readonly ["hf_doc_search", "hf_doc_fetch"];
|
|
24
25
|
readonly hf_api: readonly ["space_search", "model_search", "dataset_search", "paper_search", "hub_repo_details", "hf_doc_search"];
|
|
25
|
-
readonly all: readonly ["space_search", "model_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"];
|
|
26
|
+
readonly all: readonly ["space_search", "model_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"];
|
|
26
27
|
};
|
|
27
28
|
export type BuiltinToolId = (typeof ALL_BUILTIN_TOOL_IDS)[number];
|
|
28
29
|
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":"AA2BA,eAAO,MAAM,oBAAoB,gBAAmC,CAAC;AACrE,eAAO,MAAM,oBAAoB,gBAAgC,CAAC;AAClE,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,mBAAmB,oBAA+B,CAAC;AAChE,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;AAGxD,eAAO,MAAM,oBAAoB,8OAevB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;CA2BjB,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,4 +1,4 @@
|
|
|
1
|
-
import { SEMANTIC_SEARCH_TOOL_CONFIG, MODEL_SEARCH_TOOL_CONFIG, MODEL_DETAIL_TOOL_CONFIG, MODEL_DETAIL_PROMPT_CONFIG, PAPER_SEARCH_TOOL_CONFIG, DATASET_SEARCH_TOOL_CONFIG, DATASET_DETAIL_TOOL_CONFIG, DATASET_DETAIL_PROMPT_CONFIG, HUB_INSPECT_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, } 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, DATASET_SEARCH_TOOL_CONFIG, DATASET_DETAIL_TOOL_CONFIG, DATASET_DETAIL_PROMPT_CONFIG, HUB_INSPECT_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, } 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 MODEL_DETAIL_TOOL_ID = MODEL_DETAIL_TOOL_CONFIG.name;
|
|
@@ -16,6 +16,7 @@ export const USER_SUMMARY_PROMPT_ID = USER_SUMMARY_PROMPT_CONFIG.name;
|
|
|
16
16
|
export const PAPER_SUMMARY_PROMPT_ID = PAPER_SUMMARY_PROMPT_CONFIG.name;
|
|
17
17
|
export const MODEL_DETAIL_PROMPT_ID = MODEL_DETAIL_PROMPT_CONFIG.name;
|
|
18
18
|
export const DATASET_DETAIL_PROMPT_ID = DATASET_DETAIL_PROMPT_CONFIG.name;
|
|
19
|
+
export const HF_JOBS_TOOL_ID = HF_JOBS_TOOL_CONFIG.name;
|
|
19
20
|
export const ALL_BUILTIN_TOOL_IDS = [
|
|
20
21
|
SPACE_SEARCH_TOOL_ID,
|
|
21
22
|
MODEL_SEARCH_TOOL_ID,
|
|
@@ -30,6 +31,7 @@ export const ALL_BUILTIN_TOOL_IDS = [
|
|
|
30
31
|
DOCS_SEMANTIC_SEARCH_TOOL_ID,
|
|
31
32
|
DOC_FETCH_TOOL_ID,
|
|
32
33
|
USE_SPACE_TOOL_ID,
|
|
34
|
+
HF_JOBS_TOOL_ID,
|
|
33
35
|
];
|
|
34
36
|
export const TOOL_ID_GROUPS = {
|
|
35
37
|
search: [
|
|
@@ -39,7 +41,13 @@ export const TOOL_ID_GROUPS = {
|
|
|
39
41
|
PAPER_SEARCH_TOOL_ID,
|
|
40
42
|
DOCS_SEMANTIC_SEARCH_TOOL_ID,
|
|
41
43
|
],
|
|
42
|
-
spaces: [
|
|
44
|
+
spaces: [
|
|
45
|
+
SPACE_SEARCH_TOOL_ID,
|
|
46
|
+
DUPLICATE_SPACE_TOOL_ID,
|
|
47
|
+
SPACE_INFO_TOOL_ID,
|
|
48
|
+
SPACE_FILES_TOOL_ID,
|
|
49
|
+
USE_SPACE_TOOL_ID,
|
|
50
|
+
],
|
|
43
51
|
detail: [MODEL_DETAIL_TOOL_ID, DATASET_DETAIL_TOOL_ID, HUB_INSPECT_TOOL_ID],
|
|
44
52
|
docs: [DOCS_SEMANTIC_SEARCH_TOOL_ID, DOC_FETCH_TOOL_ID],
|
|
45
53
|
hf_api: [
|
package/dist/tool-ids.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-ids.js","sourceRoot":"","sources":["../src/tool-ids.ts"],"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QACpB,oBAAoB;QACpB,sBAAsB;QACtB,oBAAoB;QACpB,mBAAmB;QACnB,4BAA4B;KAEnB;IACV,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result.d.ts","sourceRoot":"","sources":["../../src/types/tool-result.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IAI1B,SAAS,EAAE,MAAM,CAAC;IAOlB,YAAY,EAAE,MAAM,CAAC;IAQrB,aAAa,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-result.d.ts","sourceRoot":"","sources":["../../src/types/tool-result.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IAI1B,SAAS,EAAE,MAAM,CAAC;IAOlB,YAAY,EAAE,MAAM,CAAC;IAQrB,aAAa,EAAE,MAAM,CAAC;IAMtB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
package/dist/use-space.d.ts
CHANGED
package/dist/use-space.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-space.d.ts","sourceRoot":"","sources":["../src/use-space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-space.d.ts","sourceRoot":"","sources":["../src/use-space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,UAAU,cAAc;IACvB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAErB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IACrF,QAAQ,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;CAaxB,CAAC;AAEX,qBAAa,YAAa,SAAQ,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;gBAC9D,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAK7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IAE3B,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CA4D9D;AAED,eAAO,MAAM,oBAAoB,GAAU,MAAM,YAAY,EAAE,QAAQ,cAAc,KAAG,OAAO,CAAC,cAAc,CAE7G,CAAC"}
|
package/dist/use-space.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { HfApiCall } from './hf-api-call.js';
|
|
3
3
|
import { spaceInfo } from '@huggingface/hub';
|
|
4
|
-
import './types/mcp-ui-server-shim.js';
|
|
5
4
|
import { createUIResource } from '@mcp-ui/server';
|
|
6
5
|
export const USE_SPACE_TOOL_CONFIG = {
|
|
7
6
|
name: 'use_space',
|
package/dist/use-space.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-space.js","sourceRoot":"","sources":["../src/use-space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;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,KAAK,EAAE,CAAC;YAChB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,wCAAwC,OAAO,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACvF,CAAC;YACD,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,IAAkB,EAAE,MAAsB,EAA2B,EAAE;IACjH,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmindset/hf-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,13 +24,15 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@huggingface/hub": "^2.1.0",
|
|
27
|
-
"@mcp-ui/server": "^5.
|
|
27
|
+
"@mcp-ui/server": "^5.12.0",
|
|
28
|
+
"shell-quote": "^1.8.3",
|
|
28
29
|
"turndown": "^7.2.0",
|
|
29
30
|
"zod": "^3.24.4"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@eslint/js": "^9.25.0",
|
|
33
34
|
"@types/node": "^22.15.18",
|
|
35
|
+
"@types/shell-quote": "^1.7.5",
|
|
34
36
|
"@types/turndown": "^5.0.5",
|
|
35
37
|
"eslint": "^9.25.0",
|
|
36
38
|
"globals": "^16.0.0",
|
|
@@ -10,23 +10,34 @@ import type { ToolResult } from '../types/tool-result.js';
|
|
|
10
10
|
export const DOCS_SEMANTIC_SEARCH_CONFIG = {
|
|
11
11
|
name: 'hf_doc_search',
|
|
12
12
|
description:
|
|
13
|
-
'Search
|
|
14
|
-
'
|
|
13
|
+
'Search and Discover Hugging Face Product and Library documentation. Use an empty query to discover structure and navigation hints and tips. ' +
|
|
14
|
+
'You MUST consult this tool for the most up-to-date information when using Hugging Face libraries. Combine with the Product filter to focus results.',
|
|
15
15
|
schema: z.object({
|
|
16
16
|
query: z
|
|
17
17
|
.string()
|
|
18
|
-
.min(3, 'Supply at least one search term')
|
|
19
18
|
.max(200, 'Query too long')
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
.superRefine((value, ctx) => {
|
|
20
|
+
const trimmed = value.trim();
|
|
21
|
+
if (trimmed.length === 0) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (trimmed.length < 3) {
|
|
25
|
+
ctx.addIssue({
|
|
26
|
+
code: z.ZodIssueCode.too_small,
|
|
27
|
+
type: 'string',
|
|
28
|
+
minimum: 3,
|
|
29
|
+
inclusive: true,
|
|
30
|
+
message: 'Supply at least one search term',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
})
|
|
24
34
|
.describe(
|
|
25
|
-
'
|
|
35
|
+
'Start with an empty query for structure, endpoint discovery and navigation tips. Use semantic queries for targetted searches.'
|
|
26
36
|
),
|
|
37
|
+
product: z.string().optional().describe('Filter by Product. Supply when known for focused results'),
|
|
27
38
|
}),
|
|
28
39
|
annotations: {
|
|
29
|
-
title: 'Hugging Face Documentation
|
|
40
|
+
title: 'Hugging Face Documentation Search',
|
|
30
41
|
destructiveHint: false,
|
|
31
42
|
readOnlyHint: true,
|
|
32
43
|
openWorldHint: true,
|
|
@@ -49,9 +60,16 @@ interface DocSearchApiParams {
|
|
|
49
60
|
product?: string;
|
|
50
61
|
}
|
|
51
62
|
|
|
63
|
+
interface DocsIndexEntry {
|
|
64
|
+
id: string;
|
|
65
|
+
url: string;
|
|
66
|
+
category: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
52
69
|
// Token budget defaults
|
|
53
70
|
const DEFAULT_TOKEN_BUDGET = 12500;
|
|
54
71
|
const TRUNCATE_EXCERPT_LENGTH = 400; // chars for truncated excerpts
|
|
72
|
+
const DOCS_INDEX_URL = 'https://huggingface.co/api/docs';
|
|
55
73
|
|
|
56
74
|
/**
|
|
57
75
|
* Use the Hugging Face Semantic Document Search API
|
|
@@ -75,13 +93,13 @@ export class DocSearchTool extends HfApiCall<DocSearchApiParams, DocSearchResult
|
|
|
75
93
|
*/
|
|
76
94
|
async search(params: DocSearchParams): Promise<ToolResult> {
|
|
77
95
|
try {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
96
|
+
const query = params.query?.trim() ?? '';
|
|
97
|
+
if (query.length === 0) {
|
|
98
|
+
const docsIndex = await this.fetchFromApi<DocsIndexEntry[]>(DOCS_INDEX_URL);
|
|
99
|
+
return formatDocsIndex(docsIndex);
|
|
100
|
+
}
|
|
83
101
|
|
|
84
|
-
const apiParams: DocSearchApiParams = { q:
|
|
102
|
+
const apiParams: DocSearchApiParams = { q: query.toLowerCase() };
|
|
85
103
|
if (params.product) {
|
|
86
104
|
apiParams.product = params.product;
|
|
87
105
|
}
|
|
@@ -91,14 +109,14 @@ export class DocSearchTool extends HfApiCall<DocSearchApiParams, DocSearchResult
|
|
|
91
109
|
if (results.length === 0) {
|
|
92
110
|
return {
|
|
93
111
|
formatted: params.product
|
|
94
|
-
? `No documentation found for query '${
|
|
95
|
-
: `No documentation found for query '${
|
|
112
|
+
? `No documentation found for query '${query}' in product '${params.product}'`
|
|
113
|
+
: `No documentation found for query '${query}'`,
|
|
96
114
|
totalResults: 0,
|
|
97
|
-
resultsShared: 0
|
|
115
|
+
resultsShared: 0,
|
|
98
116
|
};
|
|
99
117
|
}
|
|
100
118
|
|
|
101
|
-
return formatSearchResults(
|
|
119
|
+
return formatSearchResults(query, results, params.product, this.tokenBudget);
|
|
102
120
|
} catch (error) {
|
|
103
121
|
if (error instanceof Error) {
|
|
104
122
|
throw new Error(`Failed to search documentation: ${error.message}`);
|
|
@@ -138,6 +156,39 @@ function groupResults(results: DocSearchResult[]): Map<string, Map<string, DocSe
|
|
|
138
156
|
return grouped;
|
|
139
157
|
}
|
|
140
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Format the documentation root index response for empty queries
|
|
161
|
+
*/
|
|
162
|
+
function formatDocsIndex(docsIndex: DocsIndexEntry[]): ToolResult {
|
|
163
|
+
if (!docsIndex.length) {
|
|
164
|
+
return {
|
|
165
|
+
formatted:
|
|
166
|
+
'No documentation categories are currently available. Try running the search again with specific terms.',
|
|
167
|
+
totalResults: 0,
|
|
168
|
+
resultsShared: 0,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const header = '### Hugging Face Documentation Products\n';
|
|
173
|
+
const tableHeader = '| Product | Category | Documentation |\n| --- | --- | --- |\n';
|
|
174
|
+
const rows = docsIndex
|
|
175
|
+
.map((entry) => {
|
|
176
|
+
const docsUrl = `https://huggingface.co${entry.url}`;
|
|
177
|
+
return `| \`${entry.id}\` | ${escapeMarkdown(entry.category)} | ${docsUrl} |`;
|
|
178
|
+
})
|
|
179
|
+
.join('\n');
|
|
180
|
+
|
|
181
|
+
const llmsNote =
|
|
182
|
+
'\n\nEach documentation root exposes an `llms.txt` endpoint (e.g. add `/llms.txt` to the documentation URL). ' +
|
|
183
|
+
'Use semantic search when you have a specific question for faster, more targeted results.';
|
|
184
|
+
|
|
185
|
+
return {
|
|
186
|
+
formatted: `${header}${tableHeader}${rows}${llmsNote}`,
|
|
187
|
+
totalResults: docsIndex.length,
|
|
188
|
+
resultsShared: docsIndex.length,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
141
192
|
/**
|
|
142
193
|
* Group page results by section (heading2)
|
|
143
194
|
*/
|
|
@@ -323,6 +374,6 @@ function formatSearchResults(
|
|
|
323
374
|
return {
|
|
324
375
|
formatted: lines.join('\n'),
|
|
325
376
|
totalResults: results.length,
|
|
326
|
-
resultsShared: results.length
|
|
377
|
+
resultsShared: results.length,
|
|
327
378
|
};
|
|
328
379
|
}
|
package/src/hf-api-call.ts
CHANGED
|
@@ -120,6 +120,12 @@ export class HfApiCall<TParams = Record<string, string | undefined>, TResponse =
|
|
|
120
120
|
// Ignore if we can't read the body
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
// Log the error for debugging
|
|
124
|
+
console.error(`[API Error] ${response.status} ${response.statusText}`);
|
|
125
|
+
if (responseBody) {
|
|
126
|
+
console.error('[API Error] Response:', responseBody);
|
|
127
|
+
}
|
|
128
|
+
|
|
123
129
|
throw new HfApiError(
|
|
124
130
|
`API request failed: ${response.status.toString()} ${response.statusText}`,
|
|
125
131
|
response.status,
|
package/src/index.ts
CHANGED
|
@@ -19,6 +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
23
|
|
|
23
24
|
// Export shared types
|
|
24
25
|
export * from './types/tool-result.js';
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { HfApiCall } from '../hf-api-call.js';
|
|
2
|
+
import type { JobInfo, JobSpec, ScheduledJobInfo, ScheduledJobSpec } from './types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface for whoami API response
|
|
6
|
+
*/
|
|
7
|
+
interface WhoAmIResponse {
|
|
8
|
+
name: string;
|
|
9
|
+
id: string;
|
|
10
|
+
type: 'user' | 'org';
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* API client for HuggingFace Jobs API
|
|
16
|
+
* Handles all HTTP interactions with the Jobs API endpoints
|
|
17
|
+
*/
|
|
18
|
+
export class JobsApiClient extends HfApiCall {
|
|
19
|
+
private namespaceCache: string | null = null;
|
|
20
|
+
|
|
21
|
+
constructor(hfToken?: string, namespace?: string) {
|
|
22
|
+
// Base URL is the main HF API, we'll construct specific endpoints
|
|
23
|
+
super('https://huggingface.co/api', hfToken);
|
|
24
|
+
// Initialize cache with provided namespace to avoid redundant whoami calls
|
|
25
|
+
this.namespaceCache = namespace || null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the namespace (username or org) for the current user
|
|
30
|
+
* Uses cached value from constructor or /api/whoami-v2 endpoint as fallback
|
|
31
|
+
*/
|
|
32
|
+
async getNamespace(namespace?: string): Promise<string> {
|
|
33
|
+
if (namespace) {
|
|
34
|
+
return namespace;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (this.namespaceCache) {
|
|
38
|
+
return this.namespaceCache;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Fetch from whoami endpoint only if not cached
|
|
42
|
+
const whoami = await this.fetchFromApi<WhoAmIResponse>('https://huggingface.co/api/whoami-v2');
|
|
43
|
+
this.namespaceCache = whoami.name;
|
|
44
|
+
return this.namespaceCache;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Run a job
|
|
49
|
+
* POST /api/jobs/{namespace}
|
|
50
|
+
*/
|
|
51
|
+
async runJob(jobSpec: JobSpec, namespace?: string): Promise<JobInfo> {
|
|
52
|
+
const ns = await this.getNamespace(namespace);
|
|
53
|
+
const url = `https://huggingface.co/api/jobs/${ns}`;
|
|
54
|
+
|
|
55
|
+
// Debug logging (will be visible in server logs)
|
|
56
|
+
console.error('[Jobs API] POST', url);
|
|
57
|
+
console.error('[Jobs API] Payload:', JSON.stringify(jobSpec, null, 2));
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
const result = await this.fetchFromApi<JobInfo>(url, {
|
|
61
|
+
method: 'POST',
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'application/json',
|
|
64
|
+
},
|
|
65
|
+
body: JSON.stringify(jobSpec),
|
|
66
|
+
});
|
|
67
|
+
console.error('[Jobs API] Success:', result.id);
|
|
68
|
+
return result;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error('[Jobs API] Error:', error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* List all jobs for a namespace
|
|
77
|
+
* GET /api/jobs/{namespace}
|
|
78
|
+
*/
|
|
79
|
+
async listJobs(namespace?: string): Promise<JobInfo[]> {
|
|
80
|
+
const ns = await this.getNamespace(namespace);
|
|
81
|
+
const url = `https://huggingface.co/api/jobs/${ns}`;
|
|
82
|
+
|
|
83
|
+
return this.fetchFromApi<JobInfo[]>(url);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get detailed information about a specific job
|
|
88
|
+
* GET /api/jobs/{namespace}/{jobId}
|
|
89
|
+
*/
|
|
90
|
+
async getJob(jobId: string, namespace?: string): Promise<JobInfo> {
|
|
91
|
+
const ns = await this.getNamespace(namespace);
|
|
92
|
+
const url = `https://huggingface.co/api/jobs/${ns}/${jobId}`;
|
|
93
|
+
|
|
94
|
+
return this.fetchFromApi<JobInfo>(url);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Cancel a running job
|
|
99
|
+
* POST /api/jobs/{namespace}/{jobId}/cancel
|
|
100
|
+
*/
|
|
101
|
+
async cancelJob(jobId: string, namespace?: string): Promise<void> {
|
|
102
|
+
const ns = await this.getNamespace(namespace);
|
|
103
|
+
const url = `https://huggingface.co/api/jobs/${ns}/${jobId}/cancel`;
|
|
104
|
+
|
|
105
|
+
await this.fetchFromApi<void>(url, {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Get logs URL for a job
|
|
112
|
+
* Returns the URL for SSE streaming - caller handles the actual streaming
|
|
113
|
+
*/
|
|
114
|
+
getLogsUrl(jobId: string, namespace: string): string {
|
|
115
|
+
return `https://huggingface.co/api/jobs/${namespace}/${jobId}/logs`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Create a scheduled job
|
|
120
|
+
* POST /api/scheduled-jobs/{namespace}
|
|
121
|
+
*/
|
|
122
|
+
async createScheduledJob(spec: ScheduledJobSpec, namespace?: string): Promise<ScheduledJobInfo> {
|
|
123
|
+
const ns = await this.getNamespace(namespace);
|
|
124
|
+
const url = `https://huggingface.co/api/scheduled-jobs/${ns}`;
|
|
125
|
+
|
|
126
|
+
return this.fetchFromApi<ScheduledJobInfo>(url, {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
headers: {
|
|
129
|
+
'Content-Type': 'application/json',
|
|
130
|
+
},
|
|
131
|
+
body: JSON.stringify(spec),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* List all scheduled jobs
|
|
137
|
+
* GET /api/scheduled-jobs/{namespace}
|
|
138
|
+
*/
|
|
139
|
+
async listScheduledJobs(namespace?: string): Promise<ScheduledJobInfo[]> {
|
|
140
|
+
const ns = await this.getNamespace(namespace);
|
|
141
|
+
const url = `https://huggingface.co/api/scheduled-jobs/${ns}`;
|
|
142
|
+
|
|
143
|
+
return this.fetchFromApi<ScheduledJobInfo[]>(url);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Get details of a scheduled job
|
|
148
|
+
* GET /api/scheduled-jobs/{namespace}/{scheduledJobId}
|
|
149
|
+
*/
|
|
150
|
+
async getScheduledJob(scheduledJobId: string, namespace?: string): Promise<ScheduledJobInfo> {
|
|
151
|
+
const ns = await this.getNamespace(namespace);
|
|
152
|
+
const url = `https://huggingface.co/api/scheduled-jobs/${ns}/${scheduledJobId}`;
|
|
153
|
+
console.error(url);
|
|
154
|
+
return this.fetchFromApi<ScheduledJobInfo>(url);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Delete a scheduled job
|
|
159
|
+
* DELETE /api/scheduled-jobs/{namespace}/{scheduledJobId}
|
|
160
|
+
*/
|
|
161
|
+
async deleteScheduledJob(scheduledJobId: string, namespace?: string): Promise<void> {
|
|
162
|
+
const ns = await this.getNamespace(namespace);
|
|
163
|
+
const url = `https://huggingface.co/api/scheduled-jobs/${ns}/${scheduledJobId}`;
|
|
164
|
+
|
|
165
|
+
await this.fetchFromApi<void>(url, {
|
|
166
|
+
method: 'DELETE',
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Suspend a scheduled job
|
|
172
|
+
* POST /api/scheduled-jobs/{namespace}/{scheduledJobId}/suspend
|
|
173
|
+
*/
|
|
174
|
+
async suspendScheduledJob(scheduledJobId: string, namespace?: string): Promise<void> {
|
|
175
|
+
const ns = await this.getNamespace(namespace);
|
|
176
|
+
const url = `https://huggingface.co/api/scheduled-jobs/${ns}/${scheduledJobId}/suspend`;
|
|
177
|
+
|
|
178
|
+
await this.fetchFromApi<void>(url, {
|
|
179
|
+
method: 'POST',
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Resume a suspended scheduled job
|
|
185
|
+
* POST /api/scheduled-jobs/{namespace}/{scheduledJobId}/resume
|
|
186
|
+
*/
|
|
187
|
+
async resumeScheduledJob(scheduledJobId: string, namespace?: string): Promise<void> {
|
|
188
|
+
const ns = await this.getNamespace(namespace);
|
|
189
|
+
const url = `https://huggingface.co/api/scheduled-jobs/${ns}/${scheduledJobId}/resume`;
|
|
190
|
+
|
|
191
|
+
await this.fetchFromApi<void>(url, {
|
|
192
|
+
method: 'POST',
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|