@injectivelabs/ainj 0.0.1 → 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.
- package/dist/cli/injectived-cli.js +3 -3
- package/dist/lib/cli.js +18 -2
- package/dist/mcp/main/index.js +2 -2
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import {
|
|
2
|
+
import { resolveBinaryCommand } from '../lib/cli.js';
|
|
3
3
|
|
|
4
4
|
export async function run(args) {
|
|
5
|
-
const
|
|
6
|
-
const child = spawn(
|
|
5
|
+
const { command, commandArguments } = resolveBinaryCommand(args);
|
|
6
|
+
const child = spawn(command, commandArguments, { stdio: 'inherit' });
|
|
7
7
|
const code = await new Promise((resolve) => {
|
|
8
8
|
child.on('close', resolve);
|
|
9
9
|
});
|
package/dist/lib/cli.js
CHANGED
|
@@ -28,9 +28,25 @@ export function resolveBinary() {
|
|
|
28
28
|
throw new Error('injectived not found: injective-core not installed and injectived not on $PATH');
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
export function resolveBinaryCommand(binaryArguments = []) {
|
|
32
|
+
const binaryPath = resolveBinary();
|
|
33
|
+
|
|
34
|
+
if (binaryPath.endsWith('.js')) {
|
|
35
|
+
return {
|
|
36
|
+
command: process.execPath,
|
|
37
|
+
commandArguments: [binaryPath, ...binaryArguments],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
command: binaryPath,
|
|
43
|
+
commandArguments: binaryArguments,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
31
47
|
async function cli(...args) {
|
|
32
|
-
const
|
|
33
|
-
const { stdout, stderr } = await execFile(
|
|
48
|
+
const { command, commandArguments } = resolveBinaryCommand(args);
|
|
49
|
+
const { stdout, stderr } = await execFile(command, commandArguments);
|
|
34
50
|
return { stdout, stderr };
|
|
35
51
|
}
|
|
36
52
|
|
package/dist/mcp/main/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createServer as createHttpServer } from 'node:http';
|
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
|
|
6
6
|
function resolveServerScript() {
|
|
7
|
-
return fileURLToPath(import.meta.resolve('@
|
|
7
|
+
return fileURLToPath(import.meta.resolve('@injectivelabs/mcp-server-core/mcp'));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
// Returns a child process with piped stdin/stdout.
|
|
@@ -22,7 +22,7 @@ export async function startHttp(port) {
|
|
|
22
22
|
const effectivePort = resolveHttpPort(port);
|
|
23
23
|
const script = resolveServerScript();
|
|
24
24
|
|
|
25
|
-
// Dynamic imports, transitively available when @
|
|
25
|
+
// Dynamic imports, transitively available when @injectivelabs/mcp-server-core is installed
|
|
26
26
|
const { Client } = await import('@modelcontextprotocol/sdk/client/index.js');
|
|
27
27
|
const { StdioClientTransport } = await import('@modelcontextprotocol/sdk/client/stdio.js');
|
|
28
28
|
const { Server } = await import('@modelcontextprotocol/sdk/server/index.js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/ainj",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "An AI SDK for Injective",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"injective",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@clack/prompts": "1.7.0",
|
|
39
|
-
"@
|
|
39
|
+
"@injectivelabs/mcp-server-core": "0.1.0",
|
|
40
40
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
41
41
|
"injective-core": "1.20.1",
|
|
42
42
|
"smol-toml": "1.7.0"
|