@nirvana-labs/nirvana-mcp 1.26.1 → 1.26.2
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/code-tool.d.mts +44 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +44 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +22 -153
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +22 -117
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +3 -0
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +3 -0
- package/docs-search-tool.mjs.map +1 -1
- package/package.json +2 -18
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/src/code-tool.ts +32 -148
- package/src/docs-search-tool.ts +7 -0
- package/src/server.ts +1 -1
- package/code-tool-paths.cjs +0 -6
- package/code-tool-paths.cjs.map +0 -1
- package/code-tool-paths.d.cts +0 -2
- package/code-tool-paths.d.cts.map +0 -1
- package/code-tool-worker.d.mts +0 -5
- package/code-tool-worker.d.mts.map +0 -1
- package/code-tool-worker.d.ts +0 -5
- package/code-tool-worker.d.ts.map +0 -1
- package/code-tool-worker.js +0 -329
- package/code-tool-worker.js.map +0 -1
- package/code-tool-worker.mjs +0 -324
- package/code-tool-worker.mjs.map +0 -1
- package/src/code-tool-paths.cts +0 -3
- package/src/code-tool-worker.ts +0 -377
package/src/code-tool.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import url from 'node:url';
|
|
5
|
-
import NirvanaLabs, { ClientOptions } from '@nirvana-labs/nirvana';
|
|
6
|
-
import { ContentBlock, Endpoint, Metadata, ToolCallResult } from './tools/types';
|
|
7
|
-
|
|
3
|
+
import { Metadata, ToolCallResult, asTextContentResult } from './tools/types';
|
|
8
4
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
5
|
+
import { readEnv } from './server';
|
|
6
|
+
import { WorkerSuccess } from './code-tool-types';
|
|
12
7
|
/**
|
|
13
8
|
* A tool that runs code against a copy of the SDK.
|
|
14
9
|
*
|
|
@@ -18,156 +13,45 @@ import { WorkerInput, WorkerError, WorkerSuccess } from './code-tool-types';
|
|
|
18
13
|
*
|
|
19
14
|
* @param endpoints - The endpoints to include in the list.
|
|
20
15
|
*/
|
|
21
|
-
export async function codeTool()
|
|
16
|
+
export async function codeTool() {
|
|
22
17
|
const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
23
18
|
const tool: Tool = {
|
|
24
19
|
name: 'execute',
|
|
25
20
|
description:
|
|
26
|
-
'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized
|
|
21
|
+
'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.\nWrite code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```\n\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
27
22
|
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
28
23
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
'
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const worker = await newDenoHTTPWorker(url.pathToFileURL(workerPath), {
|
|
45
|
-
runFlags: [
|
|
46
|
-
`--node-modules-dir=manual`,
|
|
47
|
-
`--allow-read=${allowRead}`,
|
|
48
|
-
`--allow-net=${baseURLHostname}`,
|
|
49
|
-
// Allow environment variables because instantiating the client will try to read from them,
|
|
50
|
-
// even though they are not set.
|
|
51
|
-
'--allow-env',
|
|
52
|
-
],
|
|
53
|
-
printOutput: true,
|
|
54
|
-
spawnOptions: {
|
|
55
|
-
cwd: path.dirname(workerPath),
|
|
24
|
+
const handler = async (_: unknown, args: any): Promise<ToolCallResult> => {
|
|
25
|
+
const code = args.code as string;
|
|
26
|
+
|
|
27
|
+
// this is not required, but passing a Stainless API key for the matching project_name
|
|
28
|
+
// will allow you to run code-mode queries against non-published versions of your SDK.
|
|
29
|
+
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
30
|
+
const codeModeEndpoint =
|
|
31
|
+
readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
|
|
32
|
+
|
|
33
|
+
const res = await fetch(codeModeEndpoint, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
headers: {
|
|
36
|
+
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
|
|
37
|
+
'Content-Type': 'application/json',
|
|
38
|
+
client_envs: JSON.stringify({ NIRVANA_LABS_API_KEY: readEnv('NIRVANA_LABS_API_KEY') }),
|
|
56
39
|
},
|
|
40
|
+
body: JSON.stringify({
|
|
41
|
+
project_name: 'nirvana',
|
|
42
|
+
code,
|
|
43
|
+
}),
|
|
57
44
|
});
|
|
58
45
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
const opts: ClientOptions = {
|
|
66
|
-
baseURL: client.baseURL,
|
|
67
|
-
apiKey: client.apiKey,
|
|
68
|
-
defaultHeaders: {
|
|
69
|
-
'X-Stainless-MCP': 'true',
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const req = worker.request(
|
|
74
|
-
'http://localhost',
|
|
75
|
-
{
|
|
76
|
-
headers: {
|
|
77
|
-
'content-type': 'application/json',
|
|
78
|
-
},
|
|
79
|
-
method: 'POST',
|
|
80
|
-
},
|
|
81
|
-
(resp) => {
|
|
82
|
-
const body: Uint8Array[] = [];
|
|
83
|
-
resp.on('error', (err) => {
|
|
84
|
-
reject(err);
|
|
85
|
-
});
|
|
86
|
-
resp.on('data', (chunk) => {
|
|
87
|
-
body.push(chunk);
|
|
88
|
-
});
|
|
89
|
-
resp.on('end', () => {
|
|
90
|
-
resolve(
|
|
91
|
-
new Response(Buffer.concat(body).toString(), {
|
|
92
|
-
status: resp.statusCode ?? 200,
|
|
93
|
-
headers: resp.headers as any,
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const body = JSON.stringify({
|
|
101
|
-
opts,
|
|
102
|
-
code,
|
|
103
|
-
} satisfies WorkerInput);
|
|
104
|
-
|
|
105
|
-
req.write(body, (err) => {
|
|
106
|
-
if (err != null) {
|
|
107
|
-
reject(err);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
req.end();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
if (resp.status === 200) {
|
|
115
|
-
const { result, logLines, errLines } = (await resp.json()) as WorkerSuccess;
|
|
116
|
-
const returnOutput: ContentBlock | null =
|
|
117
|
-
result == null ? null : (
|
|
118
|
-
{
|
|
119
|
-
type: 'text',
|
|
120
|
-
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
const logOutput: ContentBlock | null =
|
|
124
|
-
logLines.length === 0 ?
|
|
125
|
-
null
|
|
126
|
-
: {
|
|
127
|
-
type: 'text',
|
|
128
|
-
text: logLines.join('\n'),
|
|
129
|
-
};
|
|
130
|
-
const errOutput: ContentBlock | null =
|
|
131
|
-
errLines.length === 0 ?
|
|
132
|
-
null
|
|
133
|
-
: {
|
|
134
|
-
type: 'text',
|
|
135
|
-
text: 'Error output:\n' + errLines.join('\n'),
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
139
|
-
};
|
|
140
|
-
} else {
|
|
141
|
-
const { message, logLines, errLines } = (await resp.json()) as WorkerError;
|
|
142
|
-
const messageOutput: ContentBlock | null =
|
|
143
|
-
message == null ? null : (
|
|
144
|
-
{
|
|
145
|
-
type: 'text',
|
|
146
|
-
text: message,
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
const logOutput: ContentBlock | null =
|
|
150
|
-
logLines.length === 0 ?
|
|
151
|
-
null
|
|
152
|
-
: {
|
|
153
|
-
type: 'text',
|
|
154
|
-
text: logLines.join('\n'),
|
|
155
|
-
};
|
|
156
|
-
const errOutput: ContentBlock | null =
|
|
157
|
-
errLines.length === 0 ?
|
|
158
|
-
null
|
|
159
|
-
: {
|
|
160
|
-
type: 'text',
|
|
161
|
-
text: 'Error output:\n' + errLines.join('\n'),
|
|
162
|
-
};
|
|
163
|
-
return {
|
|
164
|
-
content: [messageOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
165
|
-
isError: true,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
} finally {
|
|
169
|
-
worker.terminate();
|
|
46
|
+
if (!res.ok) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`${res.status}: ${
|
|
49
|
+
res.statusText
|
|
50
|
+
} error when trying to contact Code Tool server. Details: ${await res.text()}`,
|
|
51
|
+
);
|
|
170
52
|
}
|
|
53
|
+
|
|
54
|
+
return asTextContentResult((await res.json()) as WorkerSuccess);
|
|
171
55
|
};
|
|
172
56
|
|
|
173
57
|
return { metadata, tool, handler };
|
package/src/docs-search-tool.ts
CHANGED
|
@@ -46,6 +46,13 @@ export const handler = async (_: unknown, args: Record<string, unknown> | undefi
|
|
|
46
46
|
const body = args as any;
|
|
47
47
|
const query = new URLSearchParams(body).toString();
|
|
48
48
|
const result = await fetch(`${docsSearchURL}?${query}`);
|
|
49
|
+
|
|
50
|
+
if (!result.ok) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`${result.status}: ${result.statusText} when using doc search tool. Details: ${await result.text()}`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
return asTextContentResult(await result.json());
|
|
50
57
|
};
|
|
51
58
|
|
package/src/server.ts
CHANGED
package/code-tool-paths.cjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.workerPath = void 0;
|
|
5
|
-
exports.workerPath = require.resolve('./code-tool-worker.mjs');
|
|
6
|
-
//# sourceMappingURL=code-tool-paths.cjs.map
|
package/code-tool-paths.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-paths.cjs","sourceRoot":"","sources":["src/code-tool-paths.cts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEzE,QAAA,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC"}
|
package/code-tool-paths.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-paths.d.cts","sourceRoot":"","sources":["src/code-tool-paths.cts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,QAA4C,CAAC"}
|
package/code-tool-worker.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-worker.d.mts","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";iBAsT0B,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAkErD,wBAAyB"}
|
package/code-tool-worker.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-worker.d.ts","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";iBAsT0B,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAkErD,wBAAyB"}
|
package/code-tool-worker.js
DELETED
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const node_util_1 = __importDefault(require("node:util"));
|
|
9
|
-
const fuse_js_1 = __importDefault(require("fuse.js"));
|
|
10
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
11
|
-
const nirvana_1 = require("@nirvana-labs/nirvana");
|
|
12
|
-
function getRunFunctionSource(code) {
|
|
13
|
-
const sourceFile = typescript_1.default.createSourceFile('code.ts', code, typescript_1.default.ScriptTarget.Latest, true);
|
|
14
|
-
const printer = typescript_1.default.createPrinter();
|
|
15
|
-
for (const statement of sourceFile.statements) {
|
|
16
|
-
// Check for top-level function declarations
|
|
17
|
-
if (typescript_1.default.isFunctionDeclaration(statement)) {
|
|
18
|
-
if (statement.name?.text === 'run') {
|
|
19
|
-
return {
|
|
20
|
-
type: 'declaration',
|
|
21
|
-
client: statement.parameters[0]?.name.getText(),
|
|
22
|
-
code: printer.printNode(typescript_1.default.EmitHint.Unspecified, statement.body, sourceFile),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// Check for variable declarations: const run = () => {} or const run = function() {}
|
|
27
|
-
if (typescript_1.default.isVariableStatement(statement)) {
|
|
28
|
-
for (const declaration of statement.declarationList.declarations) {
|
|
29
|
-
if (typescript_1.default.isIdentifier(declaration.name) &&
|
|
30
|
-
declaration.name.text === 'run' &&
|
|
31
|
-
// Check if it's initialized with a function
|
|
32
|
-
declaration.initializer &&
|
|
33
|
-
(typescript_1.default.isFunctionExpression(declaration.initializer) || typescript_1.default.isArrowFunction(declaration.initializer))) {
|
|
34
|
-
return {
|
|
35
|
-
type: 'expression',
|
|
36
|
-
client: declaration.initializer.parameters[0]?.name.getText(),
|
|
37
|
-
code: printer.printNode(typescript_1.default.EmitHint.Unspecified, declaration.initializer, sourceFile),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
function getTSDiagnostics(code) {
|
|
46
|
-
const functionSource = getRunFunctionSource(code);
|
|
47
|
-
const codeWithImport = [
|
|
48
|
-
'import { NirvanaLabs } from "@nirvana-labs/nirvana";',
|
|
49
|
-
functionSource.type === 'declaration' ?
|
|
50
|
-
`async function run(${functionSource.client}: NirvanaLabs)`
|
|
51
|
-
: `const run: (${functionSource.client}: NirvanaLabs) => Promise<unknown> =`,
|
|
52
|
-
functionSource.code,
|
|
53
|
-
].join('\n');
|
|
54
|
-
const sourcePath = node_path_1.default.resolve('code.ts');
|
|
55
|
-
const ast = typescript_1.default.createSourceFile(sourcePath, codeWithImport, typescript_1.default.ScriptTarget.Latest, true);
|
|
56
|
-
const options = typescript_1.default.getDefaultCompilerOptions();
|
|
57
|
-
options.target = typescript_1.default.ScriptTarget.Latest;
|
|
58
|
-
options.module = typescript_1.default.ModuleKind.NodeNext;
|
|
59
|
-
options.moduleResolution = typescript_1.default.ModuleResolutionKind.NodeNext;
|
|
60
|
-
const host = typescript_1.default.createCompilerHost(options, true);
|
|
61
|
-
const newHost = {
|
|
62
|
-
...host,
|
|
63
|
-
getSourceFile: (...args) => {
|
|
64
|
-
if (node_path_1.default.resolve(args[0]) === sourcePath) {
|
|
65
|
-
return ast;
|
|
66
|
-
}
|
|
67
|
-
return host.getSourceFile(...args);
|
|
68
|
-
},
|
|
69
|
-
readFile: (...args) => {
|
|
70
|
-
if (node_path_1.default.resolve(args[0]) === sourcePath) {
|
|
71
|
-
return codeWithImport;
|
|
72
|
-
}
|
|
73
|
-
return host.readFile(...args);
|
|
74
|
-
},
|
|
75
|
-
fileExists: (...args) => {
|
|
76
|
-
if (node_path_1.default.resolve(args[0]) === sourcePath) {
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
return host.fileExists(...args);
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
const program = typescript_1.default.createProgram({
|
|
83
|
-
options,
|
|
84
|
-
rootNames: [sourcePath],
|
|
85
|
-
host: newHost,
|
|
86
|
-
});
|
|
87
|
-
const diagnostics = typescript_1.default.getPreEmitDiagnostics(program, ast);
|
|
88
|
-
return diagnostics.map((d) => {
|
|
89
|
-
const message = typescript_1.default.flattenDiagnosticMessageText(d.messageText, '\n');
|
|
90
|
-
if (!d.file || !d.start)
|
|
91
|
-
return `- ${message}`;
|
|
92
|
-
const { line: tsLine } = typescript_1.default.getLineAndCharacterOfPosition(d.file, d.start);
|
|
93
|
-
// We add two lines in the beginning, for the client import and the function declaration.
|
|
94
|
-
// So the actual (zero-based) line number is tsLine - 2.
|
|
95
|
-
const lineNumber = tsLine - 2;
|
|
96
|
-
const line = code.split('\n').at(lineNumber)?.trim();
|
|
97
|
-
return line ? `- ${message}\n at line ${lineNumber + 1}\n ${line}` : `- ${message}`;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
const fuse = new fuse_js_1.default([
|
|
101
|
-
'client.user.get',
|
|
102
|
-
'client.apiKeys.create',
|
|
103
|
-
'client.apiKeys.delete',
|
|
104
|
-
'client.apiKeys.get',
|
|
105
|
-
'client.apiKeys.list',
|
|
106
|
-
'client.apiKeys.update',
|
|
107
|
-
'client.operations.get',
|
|
108
|
-
'client.operations.list',
|
|
109
|
-
'client.projects.create',
|
|
110
|
-
'client.projects.delete',
|
|
111
|
-
'client.projects.get',
|
|
112
|
-
'client.projects.list',
|
|
113
|
-
'client.projects.update',
|
|
114
|
-
'client.compute.vms.create',
|
|
115
|
-
'client.compute.vms.delete',
|
|
116
|
-
'client.compute.vms.get',
|
|
117
|
-
'client.compute.vms.list',
|
|
118
|
-
'client.compute.vms.restart',
|
|
119
|
-
'client.compute.vms.update',
|
|
120
|
-
'client.compute.vms.availability.create',
|
|
121
|
-
'client.compute.vms.availability.update',
|
|
122
|
-
'client.compute.vms.volumes.list',
|
|
123
|
-
'client.compute.vms.osImages.list',
|
|
124
|
-
'client.compute.volumes.create',
|
|
125
|
-
'client.compute.volumes.delete',
|
|
126
|
-
'client.compute.volumes.get',
|
|
127
|
-
'client.compute.volumes.list',
|
|
128
|
-
'client.compute.volumes.update',
|
|
129
|
-
'client.compute.volumes.availability.create',
|
|
130
|
-
'client.compute.volumes.availability.update',
|
|
131
|
-
'client.networking.vpcs.create',
|
|
132
|
-
'client.networking.vpcs.delete',
|
|
133
|
-
'client.networking.vpcs.get',
|
|
134
|
-
'client.networking.vpcs.list',
|
|
135
|
-
'client.networking.vpcs.update',
|
|
136
|
-
'client.networking.vpcs.availability.create',
|
|
137
|
-
'client.networking.vpcs.availability.update',
|
|
138
|
-
'client.networking.firewallRules.create',
|
|
139
|
-
'client.networking.firewallRules.delete',
|
|
140
|
-
'client.networking.firewallRules.get',
|
|
141
|
-
'client.networking.firewallRules.list',
|
|
142
|
-
'client.networking.firewallRules.update',
|
|
143
|
-
'client.networking.connect.connections.create',
|
|
144
|
-
'client.networking.connect.connections.delete',
|
|
145
|
-
'client.networking.connect.connections.get',
|
|
146
|
-
'client.networking.connect.connections.list',
|
|
147
|
-
'client.networking.connect.connections.update',
|
|
148
|
-
'client.networking.connect.routes.list',
|
|
149
|
-
'client.rpcNodes.flex.create',
|
|
150
|
-
'client.rpcNodes.flex.delete',
|
|
151
|
-
'client.rpcNodes.flex.get',
|
|
152
|
-
'client.rpcNodes.flex.list',
|
|
153
|
-
'client.rpcNodes.flex.update',
|
|
154
|
-
'client.rpcNodes.flex.blockchains.list',
|
|
155
|
-
'client.rpcNodes.dedicated.get',
|
|
156
|
-
'client.rpcNodes.dedicated.list',
|
|
157
|
-
'client.rpcNodes.dedicated.blockchains.list',
|
|
158
|
-
'client.vektor.registry.assets.list',
|
|
159
|
-
'client.vektor.registry.blockchains.list',
|
|
160
|
-
'client.vektor.registry.venues.list',
|
|
161
|
-
'client.vektor.registry.errors.list',
|
|
162
|
-
'client.vektor.registry.lendMarkets.list',
|
|
163
|
-
'client.vektor.registry.borrowMarkets.list',
|
|
164
|
-
'client.vektor.registry.lpPools.list',
|
|
165
|
-
'client.vektor.balances.list',
|
|
166
|
-
'client.vektor.balances.listHistorical',
|
|
167
|
-
'client.vektor.prices.list',
|
|
168
|
-
'client.vektor.prices.listHistorical',
|
|
169
|
-
'client.vektor.lend.markets.list',
|
|
170
|
-
'client.vektor.lend.markets.listHistorical',
|
|
171
|
-
'client.vektor.lend.positions.list',
|
|
172
|
-
'client.vektor.lend.positions.listHistorical',
|
|
173
|
-
'client.vektor.lend.lend.create',
|
|
174
|
-
'client.vektor.lend.withdraw.create',
|
|
175
|
-
'client.vektor.lend.setCollateral.create',
|
|
176
|
-
'client.vektor.borrow.markets.list',
|
|
177
|
-
'client.vektor.borrow.markets.listHistorical',
|
|
178
|
-
'client.vektor.borrow.positions.list',
|
|
179
|
-
'client.vektor.borrow.positions.listHistorical',
|
|
180
|
-
'client.vektor.borrow.accounts.list',
|
|
181
|
-
'client.vektor.borrow.accounts.listHistorical',
|
|
182
|
-
'client.vektor.borrow.borrow.create',
|
|
183
|
-
'client.vektor.borrow.repay.create',
|
|
184
|
-
'client.vektor.lp.pools.list',
|
|
185
|
-
'client.vektor.lp.pools.listHistorical',
|
|
186
|
-
'client.vektor.lp.positions.list',
|
|
187
|
-
'client.vektor.lp.positions.listHistorical',
|
|
188
|
-
'client.vektor.lp.depositQuote.create',
|
|
189
|
-
'client.vektor.lp.withdrawQuote.create',
|
|
190
|
-
'client.vektor.buy.quotes.list',
|
|
191
|
-
'client.vektor.buy.buy.create',
|
|
192
|
-
'client.vektor.sell.quotes.list',
|
|
193
|
-
'client.vektor.sell.sell.create',
|
|
194
|
-
'client.vektor.move.create',
|
|
195
|
-
'client.vektor.wrap.wrap.create',
|
|
196
|
-
'client.vektor.wrap.unwrap.create',
|
|
197
|
-
'client.vektor.bridge.quotes.list',
|
|
198
|
-
'client.vektor.lock.markets.list',
|
|
199
|
-
'client.vektor.lock.positions.list',
|
|
200
|
-
'client.vektor.vote.markets.list',
|
|
201
|
-
'client.vektor.vote.rewards.list',
|
|
202
|
-
'client.vektor.incentivize.list',
|
|
203
|
-
'client.vektor.executions.get',
|
|
204
|
-
'client.vektor.executions.list',
|
|
205
|
-
'client.vektor.executions.steps.get',
|
|
206
|
-
'client.vektor.executions.steps.sign',
|
|
207
|
-
], { threshold: 1, shouldSort: true });
|
|
208
|
-
function getMethodSuggestions(fullyQualifiedMethodName) {
|
|
209
|
-
return fuse
|
|
210
|
-
.search(fullyQualifiedMethodName)
|
|
211
|
-
.map(({ item }) => item)
|
|
212
|
-
.slice(0, 5);
|
|
213
|
-
}
|
|
214
|
-
const proxyToObj = new WeakMap();
|
|
215
|
-
const objToProxy = new WeakMap();
|
|
216
|
-
function makeSdkProxy(obj, { path, isBelievedBad = false }) {
|
|
217
|
-
let proxy = objToProxy.get(obj);
|
|
218
|
-
if (!proxy) {
|
|
219
|
-
proxy = new Proxy(obj, {
|
|
220
|
-
get(target, prop, receiver) {
|
|
221
|
-
const propPath = [...path, String(prop)];
|
|
222
|
-
const value = Reflect.get(target, prop, receiver);
|
|
223
|
-
if (isBelievedBad || (!(prop in target) && value === undefined)) {
|
|
224
|
-
// If we're accessing a path that doesn't exist, it will probably eventually error.
|
|
225
|
-
// Let's proxy it and mark it bad so that we can control the error message.
|
|
226
|
-
// We proxy an empty class so that an invocation or construction attempt is possible.
|
|
227
|
-
return makeSdkProxy(class {
|
|
228
|
-
}, { path: propPath, isBelievedBad: true });
|
|
229
|
-
}
|
|
230
|
-
if (value !== null && (typeof value === 'object' || typeof value === 'function')) {
|
|
231
|
-
return makeSdkProxy(value, { path: propPath, isBelievedBad });
|
|
232
|
-
}
|
|
233
|
-
return value;
|
|
234
|
-
},
|
|
235
|
-
apply(target, thisArg, args) {
|
|
236
|
-
if (isBelievedBad || typeof target !== 'function') {
|
|
237
|
-
const fullyQualifiedMethodName = path.join('.');
|
|
238
|
-
const suggestions = getMethodSuggestions(fullyQualifiedMethodName);
|
|
239
|
-
throw new Error(`${fullyQualifiedMethodName} is not a function. Did you mean: ${suggestions.join(', ')}`);
|
|
240
|
-
}
|
|
241
|
-
return Reflect.apply(target, proxyToObj.get(thisArg) ?? thisArg, args);
|
|
242
|
-
},
|
|
243
|
-
construct(target, args, newTarget) {
|
|
244
|
-
if (isBelievedBad || typeof target !== 'function') {
|
|
245
|
-
const fullyQualifiedMethodName = path.join('.');
|
|
246
|
-
const suggestions = getMethodSuggestions(fullyQualifiedMethodName);
|
|
247
|
-
throw new Error(`${fullyQualifiedMethodName} is not a constructor. Did you mean: ${suggestions.join(', ')}`);
|
|
248
|
-
}
|
|
249
|
-
return Reflect.construct(target, args, newTarget);
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
objToProxy.set(obj, proxy);
|
|
253
|
-
proxyToObj.set(proxy, obj);
|
|
254
|
-
}
|
|
255
|
-
return proxy;
|
|
256
|
-
}
|
|
257
|
-
function parseError(code, error) {
|
|
258
|
-
if (!(error instanceof Error))
|
|
259
|
-
return;
|
|
260
|
-
const message = error.name ? `${error.name}: ${error.message}` : error.message;
|
|
261
|
-
try {
|
|
262
|
-
// Deno uses V8; the first "<anonymous>:LINE:COLUMN" is the top of stack.
|
|
263
|
-
const lineNumber = error.stack?.match(/<anonymous>:([0-9]+):[0-9]+/)?.[1];
|
|
264
|
-
// -1 for the zero-based indexing
|
|
265
|
-
const line = lineNumber &&
|
|
266
|
-
code
|
|
267
|
-
.split('\n')
|
|
268
|
-
.at(parseInt(lineNumber, 10) - 1)
|
|
269
|
-
?.trim();
|
|
270
|
-
return line ? `${message}\n at line ${lineNumber}\n ${line}` : message;
|
|
271
|
-
}
|
|
272
|
-
catch {
|
|
273
|
-
return message;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
const fetch = async (req) => {
|
|
277
|
-
const { opts, code } = (await req.json());
|
|
278
|
-
const runFunctionSource = code ? getRunFunctionSource(code) : null;
|
|
279
|
-
if (!runFunctionSource) {
|
|
280
|
-
const message = code ?
|
|
281
|
-
'The code is missing a top-level `run` function.'
|
|
282
|
-
: 'The code argument is missing. Provide one containing a top-level `run` function.';
|
|
283
|
-
return Response.json({
|
|
284
|
-
message: `${message} Write code within this template:\n\n\`\`\`\nasync function run(client) {\n // Fill this out\n}\n\`\`\``,
|
|
285
|
-
logLines: [],
|
|
286
|
-
errLines: [],
|
|
287
|
-
}, { status: 400, statusText: 'Code execution error' });
|
|
288
|
-
}
|
|
289
|
-
const diagnostics = getTSDiagnostics(code);
|
|
290
|
-
if (diagnostics.length > 0) {
|
|
291
|
-
return Response.json({
|
|
292
|
-
message: `The code contains TypeScript diagnostics:\n${diagnostics.join('\n')}`,
|
|
293
|
-
logLines: [],
|
|
294
|
-
errLines: [],
|
|
295
|
-
}, { status: 400, statusText: 'Code execution error' });
|
|
296
|
-
}
|
|
297
|
-
const client = new nirvana_1.NirvanaLabs({
|
|
298
|
-
...opts,
|
|
299
|
-
});
|
|
300
|
-
const logLines = [];
|
|
301
|
-
const errLines = [];
|
|
302
|
-
const console = {
|
|
303
|
-
log: (...args) => {
|
|
304
|
-
logLines.push(node_util_1.default.format(...args));
|
|
305
|
-
},
|
|
306
|
-
error: (...args) => {
|
|
307
|
-
errLines.push(node_util_1.default.format(...args));
|
|
308
|
-
},
|
|
309
|
-
};
|
|
310
|
-
try {
|
|
311
|
-
let run_ = async (client) => { };
|
|
312
|
-
eval(`${code}\nrun_ = run;`);
|
|
313
|
-
const result = await run_(makeSdkProxy(client, { path: ['client'] }));
|
|
314
|
-
return Response.json({
|
|
315
|
-
result,
|
|
316
|
-
logLines,
|
|
317
|
-
errLines,
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
catch (e) {
|
|
321
|
-
return Response.json({
|
|
322
|
-
message: parseError(code, e),
|
|
323
|
-
logLines,
|
|
324
|
-
errLines,
|
|
325
|
-
}, { status: 400, statusText: 'Code execution error' });
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
exports.default = { fetch };
|
|
329
|
-
//# sourceMappingURL=code-tool-worker.js.map
|
package/code-tool-worker.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-worker.js","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;AAEtF,0DAA6B;AAC7B,0DAA6B;AAE7B,sDAA2B;AAC3B,4DAA4B;AAG5B,mDAAoD;AAEpD,SAAS,oBAAoB,CAAC,IAAY;IAKxC,MAAM,UAAU,GAAG,oBAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,oBAAE,CAAC,aAAa,EAAE,CAAC;IAEnC,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;QAC9C,4CAA4C;QAC5C,IAAI,oBAAE,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE,CAAC;YACxC,IAAI,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;gBACnC,OAAO;oBACL,IAAI,EAAE,aAAa;oBACnB,MAAM,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE;oBAC/C,IAAI,EAAE,O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