matvenus-cli 0.1.0

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 (47) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +201 -0
  3. package/README.md +408 -0
  4. package/bin/cli.js +3 -0
  5. package/dist/client.d.ts +13 -0
  6. package/dist/client.js +62 -0
  7. package/dist/commands/alphafold_protein_folding.d.ts +2 -0
  8. package/dist/commands/alphafold_protein_folding.js +262 -0
  9. package/dist/commands/cancel_tool_result.d.ts +2 -0
  10. package/dist/commands/cancel_tool_result.js +388 -0
  11. package/dist/commands/diffdock_protein_ligand_docking.d.ts +2 -0
  12. package/dist/commands/diffdock_protein_ligand_docking.js +252 -0
  13. package/dist/commands/esmfold_protein_folding.d.ts +2 -0
  14. package/dist/commands/esmfold_protein_folding.js +219 -0
  15. package/dist/commands/get_tool_result.d.ts +2 -0
  16. package/dist/commands/get_tool_result.js +388 -0
  17. package/dist/commands/gromacs_analysis.d.ts +2 -0
  18. package/dist/commands/gromacs_analysis.js +212 -0
  19. package/dist/commands/gromacs_md.d.ts +2 -0
  20. package/dist/commands/gromacs_md.js +236 -0
  21. package/dist/commands/index.d.ts +2 -0
  22. package/dist/commands/index.js +39 -0
  23. package/dist/commands/predict_functional_residue.d.ts +2 -0
  24. package/dist/commands/predict_functional_residue.js +234 -0
  25. package/dist/commands/predict_protein_properties.d.ts +2 -0
  26. package/dist/commands/predict_protein_properties.js +228 -0
  27. package/dist/commands/proteinmpnn_sequence_design.d.ts +2 -0
  28. package/dist/commands/proteinmpnn_sequence_design.js +271 -0
  29. package/dist/commands/rfdiffusion_protein_design.d.ts +2 -0
  30. package/dist/commands/rfdiffusion_protein_design.js +333 -0
  31. package/dist/commands/upload_file_base_64.d.ts +2 -0
  32. package/dist/commands/upload_file_base_64.js +212 -0
  33. package/dist/commands/venusg_protein_function_prediction.d.ts +2 -0
  34. package/dist/commands/venusg_protein_function_prediction.js +234 -0
  35. package/dist/commands/venusmine_protein_mining.d.ts +2 -0
  36. package/dist/commands/venusmine_protein_mining.js +212 -0
  37. package/dist/commands/venusprime_multipoint_prediction.d.ts +2 -0
  38. package/dist/commands/venusprime_multipoint_prediction.js +322 -0
  39. package/dist/commands/venusrem_mutation_prediction.d.ts +2 -0
  40. package/dist/commands/venusrem_mutation_prediction.js +260 -0
  41. package/dist/commands/venusx_functional_residue_prediction.d.ts +2 -0
  42. package/dist/commands/venusx_functional_residue_prediction.js +234 -0
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.js +125 -0
  45. package/dist/types.d.ts +12 -0
  46. package/dist/types.js +6 -0
  47. package/package.json +41 -0
package/dist/client.js ADDED
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.request = request;
4
+ exports.buildPath = buildPath;
5
+ exports.buildQuery = buildQuery;
6
+ async function request(config, options) {
7
+ const url = new URL(options.path, config.baseUrl.endsWith('/') ? config.baseUrl : config.baseUrl + '/');
8
+ const headers = {
9
+ ...(options.headers || {}),
10
+ };
11
+ if (!(options.body instanceof FormData) && !headers['Content-Type'] && options.method.toUpperCase() !== 'GET') {
12
+ headers['Content-Type'] = 'application/json';
13
+ }
14
+ // Add authentication from environment variables
15
+ // HTTPBearer: Bearer token
16
+ const HTTPBearerToken = process.env.API_BEARER_TOKEN;
17
+ if (HTTPBearerToken) {
18
+ headers['Authorization'] = `Bearer ${HTTPBearerToken}`;
19
+ }
20
+ const response = await fetch(url.toString(), {
21
+ method: options.method.toUpperCase(),
22
+ headers,
23
+ body: (options.body instanceof FormData || options.body?.pipe)
24
+ ? options.body
25
+ : (options.body ? JSON.stringify(options.body) : undefined),
26
+ });
27
+ if (!response.ok) {
28
+ const errorData = await response.json().catch(() => ({}));
29
+ const error = new Error(`API Error: ${response.status} ${response.statusText}`);
30
+ error.status = response.status;
31
+ error.data = errorData;
32
+ throw error;
33
+ }
34
+ if (options.isBinary) {
35
+ return response.body;
36
+ }
37
+ return response.json();
38
+ }
39
+ // Helper to handle path parameters
40
+ function buildPath(template, params) {
41
+ return template.replace(/\{(\w+)\}/g, (_, key) => {
42
+ if (params[key] === undefined) {
43
+ throw new Error(`Missing path parameter: ${key}`);
44
+ }
45
+ return encodeURIComponent(String(params[key]));
46
+ });
47
+ }
48
+ // Helper to build query string
49
+ function buildQuery(params) {
50
+ const searchParams = new URLSearchParams();
51
+ for (const [key, value] of Object.entries(params)) {
52
+ if (value !== undefined && value !== null) {
53
+ if (Array.isArray(value)) {
54
+ value.forEach((item) => searchParams.append(key, String(item)));
55
+ }
56
+ else {
57
+ searchParams.set(key, String(value));
58
+ }
59
+ }
60
+ }
61
+ return searchParams.toString();
62
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function register(program: Command, baseUrl: string): void;
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.register = register;
4
+ const client_1 = require("../client");
5
+ function register(program, baseUrl) {
6
+ program
7
+ .command('alphafold-protein-folding')
8
+ .description('Alphafold Folding')
9
+ .option('--body <json>', 'Request body as JSON string', (value) => value)
10
+ .option('--base-url <url>', 'Override base URL')
11
+ .option('--output <format>', 'Output format: json, table', 'json')
12
+ .option('--schema', 'Show API schema and exit')
13
+ .action(async (options) => {
14
+ if (options.schema) {
15
+ console.log(JSON.stringify({
16
+ "method": "post",
17
+ "operationId": "alphafold_protein_folding",
18
+ "summary": "Alphafold Folding",
19
+ "tags": [
20
+ "tools-predict"
21
+ ],
22
+ "parameters": [],
23
+ "requestBody": {
24
+ "required": true,
25
+ "contentType": "application/json",
26
+ "schema": {
27
+ "properties": {
28
+ "model_version": {
29
+ "type": "string",
30
+ "title": "Model Version",
31
+ "description": "AlphaFold version to use: 'alphafold2' or 'alphafold3'",
32
+ "default": "alphafold2"
33
+ },
34
+ "sequence": {
35
+ "anyOf": [
36
+ {
37
+ "type": "string"
38
+ },
39
+ {
40
+ "type": "null"
41
+ }
42
+ ],
43
+ "title": "Sequence",
44
+ "description": "Protein sequence in single letter amino acid code (for simple single-chain prediction)"
45
+ },
46
+ "fasta_file": {
47
+ "anyOf": [
48
+ {
49
+ "type": "string"
50
+ },
51
+ {
52
+ "type": "null"
53
+ }
54
+ ],
55
+ "title": "Fasta File",
56
+ "description": "OSS URL to FASTA file (.fasta, .fa, or .faa) (for simple single/multi-chain prediction)"
57
+ },
58
+ "sequences": {
59
+ "anyOf": [
60
+ {
61
+ "items": {
62
+ "additionalProperties": true,
63
+ "type": "object"
64
+ },
65
+ "type": "array"
66
+ },
67
+ {
68
+ "type": "null"
69
+ }
70
+ ],
71
+ "title": "Sequences",
72
+ "description": "List of sequence entities for multi-chain prediction. For AlphaFold2: Only protein chains are supported (DNA/RNA/ligands ignored). For AlphaFold3: Full support for proteins, DNA, RNA, and ligands. Each entity can be: {'protein': {'id': 'A', 'sequence': 'PVLSCGEWQL', 'description': 'Chain A', 'modifications': [{'ptmType': 'HY3', 'ptmPosition': 1}], 'unpairedMsa': '...', 'pairedMsa': '...', 'templates': [...]}} {'dna': {'id': 'C', 'sequence': 'GACCTCT', 'modifications': [{'modificationType': '6OG', 'basePosition': 1}], 'unpairedMsa': '...'}} (AF3 only) {'rna': {'id': 'E', 'sequence': 'AGCU', 'modifications': [{'modificationType': '2MG', 'basePosition': 1}], 'unpairedMsa': '...'}} (AF3 only) {'ligand': {'id': ['F', 'G'], 'ccdCodes': ['ATP']}} or {'ligand': {'id': 'Z', 'smiles': 'CC(=O)OC1C[NH+]2CCC1CC2'}} (AF3 only)"
73
+ },
74
+ "model_seeds": {
75
+ "anyOf": [
76
+ {
77
+ "items": {
78
+ "type": "integer"
79
+ },
80
+ "type": "array"
81
+ },
82
+ {
83
+ "type": "null"
84
+ }
85
+ ],
86
+ "title": "Model Seeds",
87
+ "description": "Random seeds for AlphaFold3 prediction (default: [42])",
88
+ "default": [
89
+ 42
90
+ ]
91
+ }
92
+ },
93
+ "type": "object",
94
+ "title": "AlphaFoldInput",
95
+ "description": "Input for AlphaFold2/3 protein structure prediction"
96
+ },
97
+ "isBinary": false
98
+ },
99
+ "responses": [
100
+ {
101
+ "statusCode": "200",
102
+ "description": "Successful Response",
103
+ "contentType": "application/json",
104
+ "schema": {
105
+ "properties": {
106
+ "tool_call_id": {
107
+ "type": "string",
108
+ "title": "Tool Call Id",
109
+ "description": "系统生成的调用唯一ID"
110
+ },
111
+ "status": {
112
+ "description": "调用状态: running, success, error 等",
113
+ "type": "string",
114
+ "enum": [
115
+ "pending",
116
+ "running",
117
+ "success",
118
+ "error"
119
+ ],
120
+ "title": "ToolResultStatus"
121
+ },
122
+ "result": {
123
+ "anyOf": [
124
+ {},
125
+ {
126
+ "type": "null"
127
+ }
128
+ ],
129
+ "title": "Result",
130
+ "description": "如果即时成功,这里是工具的返回结果字典"
131
+ },
132
+ "error_message": {
133
+ "anyOf": [
134
+ {
135
+ "type": "string"
136
+ },
137
+ {
138
+ "type": "null"
139
+ }
140
+ ],
141
+ "title": "Error Message",
142
+ "description": "如果有错误,提供错误信息"
143
+ },
144
+ "credits_cost": {
145
+ "anyOf": [
146
+ {
147
+ "type": "number"
148
+ },
149
+ {
150
+ "type": "null"
151
+ }
152
+ ],
153
+ "title": "Credits Cost",
154
+ "description": "消费积分"
155
+ },
156
+ "tool_name": {
157
+ "type": "string",
158
+ "title": "Tool Name",
159
+ "description": "执行的工具名"
160
+ }
161
+ },
162
+ "type": "object",
163
+ "required": [
164
+ "tool_call_id",
165
+ "status",
166
+ "tool_name"
167
+ ],
168
+ "title": "ToolInvokeResponse"
169
+ },
170
+ "isBinary": false
171
+ },
172
+ {
173
+ "statusCode": "422",
174
+ "description": "Validation Error",
175
+ "contentType": "application/json",
176
+ "schema": {
177
+ "properties": {
178
+ "detail": {
179
+ "items": {
180
+ "properties": {
181
+ "loc": {
182
+ "items": {
183
+ "anyOf": [
184
+ {
185
+ "type": "string"
186
+ },
187
+ {
188
+ "type": "integer"
189
+ }
190
+ ]
191
+ },
192
+ "type": "array",
193
+ "title": "Location"
194
+ },
195
+ "msg": {
196
+ "type": "string",
197
+ "title": "Message"
198
+ },
199
+ "type": {
200
+ "type": "string",
201
+ "title": "Error Type"
202
+ }
203
+ },
204
+ "type": "object",
205
+ "required": [
206
+ "loc",
207
+ "msg",
208
+ "type"
209
+ ],
210
+ "title": "ValidationError"
211
+ },
212
+ "type": "array",
213
+ "title": "Detail"
214
+ }
215
+ },
216
+ "type": "object",
217
+ "title": "HTTPValidationError"
218
+ },
219
+ "isBinary": false
220
+ }
221
+ ],
222
+ "security": [
223
+ "HTTPBearer"
224
+ ]
225
+ }, null, 2));
226
+ return;
227
+ }
228
+ try {
229
+ const currentBaseUrl = options.baseUrl || baseUrl;
230
+ const config = { baseUrl: currentBaseUrl };
231
+ const path = '/api/tools/predict/alphafold';
232
+ const url = path;
233
+ const body = options.body ? JSON.parse(options.body) : undefined;
234
+ const response = await (0, client_1.request)(config, {
235
+ method: 'post',
236
+ path: url,
237
+ headers: undefined,
238
+ body: body,
239
+ isBinary: false,
240
+ });
241
+ const data = response;
242
+ if (options.output === 'json') {
243
+ console.log(JSON.stringify(data, null, 2));
244
+ }
245
+ else {
246
+ console.log(data);
247
+ }
248
+ }
249
+ catch (error) {
250
+ if (error.status) {
251
+ console.error('API Error:', error.status, error.message);
252
+ if (error.data) {
253
+ console.error(JSON.stringify(error.data, null, 2));
254
+ }
255
+ }
256
+ else {
257
+ console.error('Error:', error.message);
258
+ }
259
+ process.exit(1);
260
+ }
261
+ });
262
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function register(program: Command, baseUrl: string): void;