@ax-llm/ax-tools 16.1.12 → 17.0.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/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -25
- package/index.d.ts +2 -25
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;var _child_process = require('child_process');var _readline = require('readline'); var _readline2 = _interopRequireDefault(_readline);var o= (_class =class{__init() {this.pendingResponses=new Map}constructor(e){;_class.prototype.__init.call(this);this.process=_child_process.spawn.call(void 0, e.command,_nullishCoalesce(e.args, () => ([])),{env:e.env?{...process.env,...e.env}:process.env}),this.rl=_readline2.default.createInterface({input:this.process.stdout}),this.rl.on("line",r=>{try{let s=JSON.parse(r),t=this.pendingResponses.get(s.id);t&&(t(s),this.pendingResponses.delete(s.id))}catch (e2){console.warn("Non-JSON output from MCP server:",r)}})}async send(e){return new Promise(r=>{this.pendingResponses.set(e.id,s=>{r(s)}),this.process.stdin.write(`${JSON.stringify(e)}
|
|
2
2
|
`)})}async sendNotification(e){this.process.stdin.write(`${JSON.stringify(e)}
|
|
3
|
-
`)}async connect(){return Promise.resolve()}async terminate(){return this.rl.close(),this.process.kill(),new Promise(e=>{this.process.on("exit",()=>e())})}}, _class);function
|
|
3
|
+
`)}async connect(){return Promise.resolve()}async terminate(){return this.rl.close(),this.process.kill(),new Promise(e=>{this.process.on("exit",()=>e())})}}, _class);function i(n){return new o(n)}exports.AxMCPStdioTransport = o; exports.axCreateMCPStdioTransport = i;
|
|
4
4
|
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../mcp/stdioTransport.ts"
|
|
1
|
+
{"version":3,"sources":["../mcp/stdioTransport.ts"],"names":["AxMCPStdioTransport","config","spawn","readline","line","response","resolver","message","resolve","res"],"mappings":"AAAA,uUAA2D,wFACtC,IAeRA,CAAAA,WAAN,KAAoD,CACjD,eAEA,gBAAA,CAAmB,IAAI,IAAA,WAK/B,CAAYC,CAAAA,CAAwC,qCAClD,IAAA,CAAK,OAAA,CAAUC,kCAAAA,CAAMD,CAAO,OAAA,kBAASA,CAAAA,CAAO,IAAA,SAAQ,CAAC,GAAA,CAAG,CACtD,GAAA,CAAKA,CAAAA,CAAO,GAAA,CAAM,CAAE,GAAG,OAAA,CAAQ,GAAA,CAAK,GAAGA,CAAAA,CAAO,GAAI,CAAA,CAAI,OAAA,CAAQ,GAChE,CAAC,CAAA,CACD,IAAA,CAAK,EAAA,CAAKE,kBAAAA,CAAS,eAAA,CAAgB,CAAE,KAAA,CAAO,IAAA,CAAK,OAAA,CAAQ,MAAO,CAAC,CAAA,CACjE,IAAA,CAAK,EAAA,CAAG,EAAA,CAAG,MAAA,CAASC,CAAAA,EAAS,CAC3B,GAAI,CACF,IAAMC,CAAAA,CAAiC,IAAA,CAAK,KAAA,CAAMD,CAAI,CAAA,CAChDE,CAAAA,CAAW,IAAA,CAAK,gBAAA,CAAiB,GAAA,CAAID,CAAAA,CAAS,EAAE,CAAA,CAClDC,CAAAA,EAAAA,CACFA,CAAAA,CAASD,CAAQ,CAAA,CACjB,IAAA,CAAK,gBAAA,CAAiB,MAAA,CAAOA,CAAAA,CAAS,EAAE,CAAA,CAE5C,CAAA,UAAiB,CAEf,OAAA,CAAQ,IAAA,CAAK,kCAAA,CAAoCD,CAAI,CACvD,CACF,CAAC,CACH,CAEA,MAAM,IAAA,CACJG,CAAAA,CACwC,CACxC,OAAO,IAAI,OAAA,CAAwCC,CAAAA,EAAY,CAC7D,IAAA,CAAK,gBAAA,CAAiB,GAAA,CAAID,CAAAA,CAAQ,EAAA,CAAKE,CAAAA,EAA8B,CACnED,CAAAA,CAAQC,CAAoC,CAC9C,CAAC,CAAA,CACD,IAAA,CAAK,OAAA,CAAQ,KAAA,CAAM,KAAA,CAAM,CAAA,EAAA;AAOwB;AA6BvD","file":"/home/runner/work/ax/ax/src/tools/dist/index.cjs","sourcesContent":["import { type ChildProcessWithoutNullStreams, spawn } from 'node:child_process';\nimport readline from 'node:readline';\n\nimport type {\n AxMCPJSONRPCNotification,\n AxMCPJSONRPCRequest,\n AxMCPJSONRPCResponse,\n AxMCPTransport,\n} from '@ax-llm/ax';\n\nexport interface StdioTransportConfig {\n command: string;\n args?: string[];\n env?: NodeJS.ProcessEnv;\n}\n\nexport class AxMCPStdioTransport implements AxMCPTransport {\n private process: ChildProcessWithoutNullStreams;\n private rl: readline.Interface;\n private pendingResponses = new Map<\n string | number,\n (res: AxMCPJSONRPCResponse) => void\n >();\n\n constructor(config: Readonly<StdioTransportConfig>) {\n this.process = spawn(config.command, config.args ?? [], {\n env: config.env ? { ...process.env, ...config.env } : process.env,\n });\n this.rl = readline.createInterface({ input: this.process.stdout });\n this.rl.on('line', (line) => {\n try {\n const response: AxMCPJSONRPCResponse = JSON.parse(line);\n const resolver = this.pendingResponses.get(response.id);\n if (resolver) {\n resolver(response);\n this.pendingResponses.delete(response.id);\n }\n } catch (_error) {\n // Skip non-JSON lines (might be debug output from the MCP server)\n console.warn('Non-JSON output from MCP server:', line);\n }\n });\n }\n\n async send(\n message: Readonly<AxMCPJSONRPCRequest<unknown>>\n ): Promise<AxMCPJSONRPCResponse<unknown>> {\n return new Promise<AxMCPJSONRPCResponse<unknown>>((resolve) => {\n this.pendingResponses.set(message.id, (res: AxMCPJSONRPCResponse) => {\n resolve(res as AxMCPJSONRPCResponse<unknown>);\n });\n this.process.stdin.write(`${JSON.stringify(message)}\\n`);\n });\n }\n\n async sendNotification(\n message: Readonly<AxMCPJSONRPCNotification>\n ): Promise<void> {\n this.process.stdin.write(`${JSON.stringify(message)}\\n`);\n }\n\n async connect(): Promise<void> {\n // Connection is implicit when the process is spawned\n return Promise.resolve();\n }\n\n /**\n * Terminate the child process and clean up resources\n */\n async terminate(): Promise<void> {\n this.rl.close();\n this.process.kill();\n return new Promise((resolve) => {\n this.process.on('exit', () => resolve());\n });\n }\n}\n\n/**\n * Create a new AxMCPStdioTransport instance\n * @param config Configuration for the stdio transport\n * @returns A new AxMCPStdioTransport instance\n */\nexport function axCreateMCPStdioTransport(\n config: Readonly<StdioTransportConfig>\n): AxMCPStdioTransport {\n return new AxMCPStdioTransport(config);\n}\n"]}
|
package/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AxMCPTransport, AxMCPJSONRPCRequest, AxMCPJSONRPCResponse, AxMCPJSONRPCNotification
|
|
2
|
-
export { AxRLMJSInterpreter, AxRLMJSInterpreterPermission, axCreateRLMJSInterpreter } from '@ax-llm/ax';
|
|
1
|
+
import { AxMCPTransport, AxMCPJSONRPCRequest, AxMCPJSONRPCResponse, AxMCPJSONRPCNotification } from '@ax-llm/ax';
|
|
3
2
|
|
|
4
3
|
interface StdioTransportConfig {
|
|
5
4
|
command: string;
|
|
@@ -26,26 +25,4 @@ declare class AxMCPStdioTransport implements AxMCPTransport {
|
|
|
26
25
|
*/
|
|
27
26
|
declare function axCreateMCPStdioTransport(config: Readonly<StdioTransportConfig>): AxMCPStdioTransport;
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
FS = "node:fs",
|
|
31
|
-
NET = "net",
|
|
32
|
-
OS = "os",
|
|
33
|
-
CRYPTO = "crypto",
|
|
34
|
-
PROCESS = "process"
|
|
35
|
-
}
|
|
36
|
-
declare class AxJSInterpreter {
|
|
37
|
-
private permissions;
|
|
38
|
-
private timeout;
|
|
39
|
-
constructor({ permissions, timeout, }?: Readonly<{
|
|
40
|
-
permissions?: readonly AxJSInterpreterPermission[];
|
|
41
|
-
timeout?: number;
|
|
42
|
-
}> | undefined);
|
|
43
|
-
private codeInterpreterJavascript;
|
|
44
|
-
toFunction(): AxFunction;
|
|
45
|
-
}
|
|
46
|
-
declare function axCreateJSInterpreter(options?: Readonly<{
|
|
47
|
-
permissions?: readonly AxJSInterpreterPermission[];
|
|
48
|
-
timeout?: number;
|
|
49
|
-
}>): AxJSInterpreter;
|
|
50
|
-
|
|
51
|
-
export { AxJSInterpreter, AxJSInterpreterPermission, AxMCPStdioTransport, type StdioTransportConfig, axCreateJSInterpreter, axCreateMCPStdioTransport };
|
|
28
|
+
export { AxMCPStdioTransport, type StdioTransportConfig, axCreateMCPStdioTransport };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AxMCPTransport, AxMCPJSONRPCRequest, AxMCPJSONRPCResponse, AxMCPJSONRPCNotification
|
|
2
|
-
export { AxRLMJSInterpreter, AxRLMJSInterpreterPermission, axCreateRLMJSInterpreter } from '@ax-llm/ax';
|
|
1
|
+
import { AxMCPTransport, AxMCPJSONRPCRequest, AxMCPJSONRPCResponse, AxMCPJSONRPCNotification } from '@ax-llm/ax';
|
|
3
2
|
|
|
4
3
|
interface StdioTransportConfig {
|
|
5
4
|
command: string;
|
|
@@ -26,26 +25,4 @@ declare class AxMCPStdioTransport implements AxMCPTransport {
|
|
|
26
25
|
*/
|
|
27
26
|
declare function axCreateMCPStdioTransport(config: Readonly<StdioTransportConfig>): AxMCPStdioTransport;
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
FS = "node:fs",
|
|
31
|
-
NET = "net",
|
|
32
|
-
OS = "os",
|
|
33
|
-
CRYPTO = "crypto",
|
|
34
|
-
PROCESS = "process"
|
|
35
|
-
}
|
|
36
|
-
declare class AxJSInterpreter {
|
|
37
|
-
private permissions;
|
|
38
|
-
private timeout;
|
|
39
|
-
constructor({ permissions, timeout, }?: Readonly<{
|
|
40
|
-
permissions?: readonly AxJSInterpreterPermission[];
|
|
41
|
-
timeout?: number;
|
|
42
|
-
}> | undefined);
|
|
43
|
-
private codeInterpreterJavascript;
|
|
44
|
-
toFunction(): AxFunction;
|
|
45
|
-
}
|
|
46
|
-
declare function axCreateJSInterpreter(options?: Readonly<{
|
|
47
|
-
permissions?: readonly AxJSInterpreterPermission[];
|
|
48
|
-
timeout?: number;
|
|
49
|
-
}>): AxJSInterpreter;
|
|
50
|
-
|
|
51
|
-
export { AxJSInterpreter, AxJSInterpreterPermission, AxMCPStdioTransport, type StdioTransportConfig, axCreateJSInterpreter, axCreateMCPStdioTransport };
|
|
28
|
+
export { AxMCPStdioTransport, type StdioTransportConfig, axCreateMCPStdioTransport };
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{spawn as
|
|
1
|
+
import{spawn as p}from"child_process";import a from"readline";var o=class{process;rl;pendingResponses=new Map;constructor(e){this.process=p(e.command,e.args??[],{env:e.env?{...process.env,...e.env}:process.env}),this.rl=a.createInterface({input:this.process.stdout}),this.rl.on("line",r=>{try{let s=JSON.parse(r),t=this.pendingResponses.get(s.id);t&&(t(s),this.pendingResponses.delete(s.id))}catch{console.warn("Non-JSON output from MCP server:",r)}})}async send(e){return new Promise(r=>{this.pendingResponses.set(e.id,s=>{r(s)}),this.process.stdin.write(`${JSON.stringify(e)}
|
|
2
2
|
`)})}async sendNotification(e){this.process.stdin.write(`${JSON.stringify(e)}
|
|
3
|
-
`)}async connect(){return Promise.resolve()}async terminate(){return this.rl.close(),this.process.kill(),new Promise(e=>{this.process.on("exit",()=>e())})}};function
|
|
3
|
+
`)}async connect(){return Promise.resolve()}async terminate(){return this.rl.close(),this.process.kill(),new Promise(e=>{this.process.on("exit",()=>e())})}};function i(n){return new o(n)}export{o as AxMCPStdioTransport,i as axCreateMCPStdioTransport};
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../mcp/stdioTransport.ts"
|
|
1
|
+
{"version":3,"sources":["../mcp/stdioTransport.ts"],"sourcesContent":["import { type ChildProcessWithoutNullStreams, spawn } from 'node:child_process';\nimport readline from 'node:readline';\n\nimport type {\n AxMCPJSONRPCNotification,\n AxMCPJSONRPCRequest,\n AxMCPJSONRPCResponse,\n AxMCPTransport,\n} from '@ax-llm/ax';\n\nexport interface StdioTransportConfig {\n command: string;\n args?: string[];\n env?: NodeJS.ProcessEnv;\n}\n\nexport class AxMCPStdioTransport implements AxMCPTransport {\n private process: ChildProcessWithoutNullStreams;\n private rl: readline.Interface;\n private pendingResponses = new Map<\n string | number,\n (res: AxMCPJSONRPCResponse) => void\n >();\n\n constructor(config: Readonly<StdioTransportConfig>) {\n this.process = spawn(config.command, config.args ?? [], {\n env: config.env ? { ...process.env, ...config.env } : process.env,\n });\n this.rl = readline.createInterface({ input: this.process.stdout });\n this.rl.on('line', (line) => {\n try {\n const response: AxMCPJSONRPCResponse = JSON.parse(line);\n const resolver = this.pendingResponses.get(response.id);\n if (resolver) {\n resolver(response);\n this.pendingResponses.delete(response.id);\n }\n } catch (_error) {\n // Skip non-JSON lines (might be debug output from the MCP server)\n console.warn('Non-JSON output from MCP server:', line);\n }\n });\n }\n\n async send(\n message: Readonly<AxMCPJSONRPCRequest<unknown>>\n ): Promise<AxMCPJSONRPCResponse<unknown>> {\n return new Promise<AxMCPJSONRPCResponse<unknown>>((resolve) => {\n this.pendingResponses.set(message.id, (res: AxMCPJSONRPCResponse) => {\n resolve(res as AxMCPJSONRPCResponse<unknown>);\n });\n this.process.stdin.write(`${JSON.stringify(message)}\\n`);\n });\n }\n\n async sendNotification(\n message: Readonly<AxMCPJSONRPCNotification>\n ): Promise<void> {\n this.process.stdin.write(`${JSON.stringify(message)}\\n`);\n }\n\n async connect(): Promise<void> {\n // Connection is implicit when the process is spawned\n return Promise.resolve();\n }\n\n /**\n * Terminate the child process and clean up resources\n */\n async terminate(): Promise<void> {\n this.rl.close();\n this.process.kill();\n return new Promise((resolve) => {\n this.process.on('exit', () => resolve());\n });\n }\n}\n\n/**\n * Create a new AxMCPStdioTransport instance\n * @param config Configuration for the stdio transport\n * @returns A new AxMCPStdioTransport instance\n */\nexport function axCreateMCPStdioTransport(\n config: Readonly<StdioTransportConfig>\n): AxMCPStdioTransport {\n return new AxMCPStdioTransport(config);\n}\n"],"mappings":"AAAA,OAA8C,SAAAA,MAAa,gBAC3D,OAAOC,MAAc,WAed,IAAMC,EAAN,KAAoD,CACjD,QACA,GACA,iBAAmB,IAAI,IAK/B,YAAYC,EAAwC,CAClD,KAAK,QAAUH,EAAMG,EAAO,QAASA,EAAO,MAAQ,CAAC,EAAG,CACtD,IAAKA,EAAO,IAAM,CAAE,GAAG,QAAQ,IAAK,GAAGA,EAAO,GAAI,EAAI,QAAQ,GAChE,CAAC,EACD,KAAK,GAAKF,EAAS,gBAAgB,CAAE,MAAO,KAAK,QAAQ,MAAO,CAAC,EACjE,KAAK,GAAG,GAAG,OAASG,GAAS,CAC3B,GAAI,CACF,IAAMC,EAAiC,KAAK,MAAMD,CAAI,EAChDE,EAAW,KAAK,iBAAiB,IAAID,EAAS,EAAE,EAClDC,IACFA,EAASD,CAAQ,EACjB,KAAK,iBAAiB,OAAOA,EAAS,EAAE,EAE5C,MAAiB,CAEf,QAAQ,KAAK,mCAAoCD,CAAI,CACvD,CACF,CAAC,CACH,CAEA,MAAM,KACJG,EACwC,CACxC,OAAO,IAAI,QAAwCC,GAAY,CAC7D,KAAK,iBAAiB,IAAID,EAAQ,GAAKE,GAA8B,CACnED,EAAQC,CAAoC,CAC9C,CAAC,EACD,KAAK,QAAQ,MAAM,MAAM,GAAG,KAAK,UAAUF,CAAO,CAAC;AAAA,CAAI,CACzD,CAAC,CACH,CAEA,MAAM,iBACJA,EACe,CACf,KAAK,QAAQ,MAAM,MAAM,GAAG,KAAK,UAAUA,CAAO,CAAC;AAAA,CAAI,CACzD,CAEA,MAAM,SAAyB,CAE7B,OAAO,QAAQ,QAAQ,CACzB,CAKA,MAAM,WAA2B,CAC/B,YAAK,GAAG,MAAM,EACd,KAAK,QAAQ,KAAK,EACX,IAAI,QAASC,GAAY,CAC9B,KAAK,QAAQ,GAAG,OAAQ,IAAMA,EAAQ,CAAC,CACzC,CAAC,CACH,CACF,EAOO,SAASE,EACdP,EACqB,CACrB,OAAO,IAAID,EAAoBC,CAAM,CACvC","names":["spawn","readline","AxMCPStdioTransport","config","line","response","resolver","message","resolve","res","axCreateMCPStdioTransport"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ax-llm/ax-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ax tools package",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ax-llm/ax": "
|
|
16
|
+
"@ax-llm/ax": "17.0.0"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"**/*"
|