@ax-llm/ax-tools 13.0.8

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 ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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 s= (_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 t=JSON.parse(r),p=this.pendingResponses.get(t.id);p&&(p(t),this.pendingResponses.delete(t.id))}catch (e2){console.warn("Non-JSON output from MCP server:",r)}})}async send(e){return new Promise(r=>{this.pendingResponses.set(e.id,t=>{r(t)}),this.process.stdin.write(`${JSON.stringify(e)}
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 a(o){return new s(o)}var _fs = require('fs'); var u = _interopRequireWildcard(_fs);var _http = require('http'); var l = _interopRequireWildcard(_http);var _https = require('https'); var C = _interopRequireWildcard(_https);var _os = require('os'); var P = _interopRequireWildcard(_os);var _process = require('process'); var x = _interopRequireWildcard(_process);var _vm = require('vm');function S(){if(globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function")return globalThis.crypto;throw new Error("Web Crypto API with randomUUID support not available. Requires Node.js 16+ or modern browser.")}var c=(n=>(n.FS="node:fs",n.NET="net",n.OS="os",n.CRYPTO="crypto",n.PROCESS="process",n))(c||{}),i= exports.AxJSInterpreter =class{constructor({permissions:e=[]}={}){this.permissions=_nullishCoalesce(e, () => ([]))}codeInterpreterJavascript(e){let r={console};return this.permissions.includes("node:fs")&&(r.fs=u),this.permissions.includes("net")&&(r.http=l,r.https=C),this.permissions.includes("os")&&(r.os=P),this.permissions.includes("crypto")&&(r.crypto=S()),this.permissions.includes("process")&&(r.process=x),_vm.runInNewContext.call(void 0, `(function() { ${e} })()`,r)}toFunction(){return{name:"javascriptInterpreter",description:"Use this function to run Javascript code and get any expected return value",parameters:{type:"object",properties:{code:{type:"string",description:"JS code with a return value in the end."}},required:["code"]},func:({code:e})=>this.codeInterpreterJavascript(e)}}};function h(o){return new i(o)}exports.AxJSInterpreter = i; exports.AxJSInterpreterPermission = c; exports.AxMCPStdioTransport = s; exports.axCreateJSInterpreter = h; exports.axCreateMCPStdioTransport = a;
4
+ //# sourceMappingURL=index.cjs.map
package/index.cjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../mcp/stdioTransport.ts","../functions/jsInterpreter.ts"],"names":["AxMCPStdioTransport","config","spawn","readline","line","response","resolver","message","resolve","res"],"mappings":"AAAA,ylBAA2D,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;AC5CnD","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","import * as _fs from 'node:fs';\nimport * as _http from 'node:http';\nimport * as _https from 'node:https';\nimport * as _os from 'node:os';\nimport * as _process from 'node:process';\nimport { runInNewContext } from 'node:vm';\nimport type { AxFunction } from '@ax-llm/ax';\n\n// Local implementation of getCrypto since it's not exported from main package\nfunction getCrypto() {\n if (globalThis.crypto && typeof globalThis.crypto.randomUUID === 'function') {\n return globalThis.crypto;\n }\n throw new Error(\n 'Web Crypto API with randomUUID support not available. Requires Node.js 16+ or modern browser.'\n );\n}\n\nexport enum AxJSInterpreterPermission {\n FS = 'node:fs',\n NET = 'net',\n OS = 'os',\n CRYPTO = 'crypto',\n PROCESS = 'process',\n}\n\ntype Context = {\n console: Console;\n fs: unknown;\n http: unknown;\n https: unknown;\n os: unknown;\n crypto: unknown;\n process: unknown;\n};\n\nexport class AxJSInterpreter {\n private permissions: readonly AxJSInterpreterPermission[];\n\n constructor({\n permissions = [],\n }:\n | Readonly<{ permissions?: readonly AxJSInterpreterPermission[] }>\n | undefined = {}) {\n this.permissions = permissions ?? [];\n }\n\n private codeInterpreterJavascript(code: string): unknown {\n const context: Partial<Context> = { console };\n\n if (this.permissions.includes(AxJSInterpreterPermission.FS)) {\n context.fs = _fs;\n }\n\n if (this.permissions.includes(AxJSInterpreterPermission.NET)) {\n context.http = _http;\n context.https = _https;\n }\n\n if (this.permissions.includes(AxJSInterpreterPermission.OS)) {\n context.os = _os;\n }\n\n if (this.permissions.includes(AxJSInterpreterPermission.CRYPTO)) {\n context.crypto = getCrypto();\n }\n\n if (this.permissions.includes(AxJSInterpreterPermission.PROCESS)) {\n context.process = _process;\n }\n\n return runInNewContext(`(function() { ${code} })()`, context);\n }\n\n public toFunction(): AxFunction {\n return {\n name: 'javascriptInterpreter',\n description:\n 'Use this function to run Javascript code and get any expected return value',\n parameters: {\n type: 'object',\n properties: {\n code: {\n type: 'string',\n description: 'JS code with a return value in the end.',\n },\n },\n required: ['code'],\n },\n\n func: ({ code }: Readonly<{ code: string }>) =>\n this.codeInterpreterJavascript(code),\n };\n }\n}\n\n// Factory function following the same pattern as MCP\nexport function axCreateJSInterpreter(\n options?: Readonly<{ permissions?: readonly AxJSInterpreterPermission[] }>\n): AxJSInterpreter {\n return new AxJSInterpreter(options);\n}\n"]}
package/index.d.cts ADDED
@@ -0,0 +1,47 @@
1
+ import { AxMCPTransport, AxMCPJSONRPCRequest, AxMCPJSONRPCResponse, AxMCPJSONRPCNotification, AxFunction } from '@ax-llm/ax';
2
+
3
+ interface StdioTransportConfig {
4
+ command: string;
5
+ args?: string[];
6
+ env?: NodeJS.ProcessEnv;
7
+ }
8
+ declare class AxMCPStdioTransport implements AxMCPTransport {
9
+ private process;
10
+ private rl;
11
+ private pendingResponses;
12
+ constructor(config: Readonly<StdioTransportConfig>);
13
+ send(message: Readonly<AxMCPJSONRPCRequest<unknown>>): Promise<AxMCPJSONRPCResponse<unknown>>;
14
+ sendNotification(message: Readonly<AxMCPJSONRPCNotification>): Promise<void>;
15
+ connect(): Promise<void>;
16
+ /**
17
+ * Terminate the child process and clean up resources
18
+ */
19
+ terminate(): Promise<void>;
20
+ }
21
+ /**
22
+ * Create a new AxMCPStdioTransport instance
23
+ * @param config Configuration for the stdio transport
24
+ * @returns A new AxMCPStdioTransport instance
25
+ */
26
+ declare function axCreateMCPStdioTransport(config: Readonly<StdioTransportConfig>): AxMCPStdioTransport;
27
+
28
+ declare enum AxJSInterpreterPermission {
29
+ FS = "node:fs",
30
+ NET = "net",
31
+ OS = "os",
32
+ CRYPTO = "crypto",
33
+ PROCESS = "process"
34
+ }
35
+ declare class AxJSInterpreter {
36
+ private permissions;
37
+ constructor({ permissions, }?: Readonly<{
38
+ permissions?: readonly AxJSInterpreterPermission[];
39
+ }> | undefined);
40
+ private codeInterpreterJavascript;
41
+ toFunction(): AxFunction;
42
+ }
43
+ declare function axCreateJSInterpreter(options?: Readonly<{
44
+ permissions?: readonly AxJSInterpreterPermission[];
45
+ }>): AxJSInterpreter;
46
+
47
+ export { AxJSInterpreter, AxJSInterpreterPermission, AxMCPStdioTransport, type StdioTransportConfig, axCreateJSInterpreter, axCreateMCPStdioTransport };
package/index.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ import { AxMCPTransport, AxMCPJSONRPCRequest, AxMCPJSONRPCResponse, AxMCPJSONRPCNotification, AxFunction } from '@ax-llm/ax';
2
+
3
+ interface StdioTransportConfig {
4
+ command: string;
5
+ args?: string[];
6
+ env?: NodeJS.ProcessEnv;
7
+ }
8
+ declare class AxMCPStdioTransport implements AxMCPTransport {
9
+ private process;
10
+ private rl;
11
+ private pendingResponses;
12
+ constructor(config: Readonly<StdioTransportConfig>);
13
+ send(message: Readonly<AxMCPJSONRPCRequest<unknown>>): Promise<AxMCPJSONRPCResponse<unknown>>;
14
+ sendNotification(message: Readonly<AxMCPJSONRPCNotification>): Promise<void>;
15
+ connect(): Promise<void>;
16
+ /**
17
+ * Terminate the child process and clean up resources
18
+ */
19
+ terminate(): Promise<void>;
20
+ }
21
+ /**
22
+ * Create a new AxMCPStdioTransport instance
23
+ * @param config Configuration for the stdio transport
24
+ * @returns A new AxMCPStdioTransport instance
25
+ */
26
+ declare function axCreateMCPStdioTransport(config: Readonly<StdioTransportConfig>): AxMCPStdioTransport;
27
+
28
+ declare enum AxJSInterpreterPermission {
29
+ FS = "node:fs",
30
+ NET = "net",
31
+ OS = "os",
32
+ CRYPTO = "crypto",
33
+ PROCESS = "process"
34
+ }
35
+ declare class AxJSInterpreter {
36
+ private permissions;
37
+ constructor({ permissions, }?: Readonly<{
38
+ permissions?: readonly AxJSInterpreterPermission[];
39
+ }> | undefined);
40
+ private codeInterpreterJavascript;
41
+ toFunction(): AxFunction;
42
+ }
43
+ declare function axCreateJSInterpreter(options?: Readonly<{
44
+ permissions?: readonly AxJSInterpreterPermission[];
45
+ }>): AxJSInterpreter;
46
+
47
+ export { AxJSInterpreter, AxJSInterpreterPermission, AxMCPStdioTransport, type StdioTransportConfig, axCreateJSInterpreter, axCreateMCPStdioTransport };
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import{spawn as d}from"child_process";import m from"readline";var s=class{process;rl;pendingResponses=new Map;constructor(e){this.process=d(e.command,e.args??[],{env:e.env?{...process.env,...e.env}:process.env}),this.rl=m.createInterface({input:this.process.stdout}),this.rl.on("line",r=>{try{let t=JSON.parse(r),p=this.pendingResponses.get(t.id);p&&(p(t),this.pendingResponses.delete(t.id))}catch{console.warn("Non-JSON output from MCP server:",r)}})}async send(e){return new Promise(r=>{this.pendingResponses.set(e.id,t=>{r(t)}),this.process.stdin.write(`${JSON.stringify(e)}
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 a(o){return new s(o)}import*as u from"fs";import*as l from"http";import*as C from"https";import*as P from"os";import*as x from"process";import{runInNewContext as f}from"vm";function S(){if(globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function")return globalThis.crypto;throw new Error("Web Crypto API with randomUUID support not available. Requires Node.js 16+ or modern browser.")}var c=(n=>(n.FS="node:fs",n.NET="net",n.OS="os",n.CRYPTO="crypto",n.PROCESS="process",n))(c||{}),i=class{permissions;constructor({permissions:e=[]}={}){this.permissions=e??[]}codeInterpreterJavascript(e){let r={console};return this.permissions.includes("node:fs")&&(r.fs=u),this.permissions.includes("net")&&(r.http=l,r.https=C),this.permissions.includes("os")&&(r.os=P),this.permissions.includes("crypto")&&(r.crypto=S()),this.permissions.includes("process")&&(r.process=x),f(`(function() { ${e} })()`,r)}toFunction(){return{name:"javascriptInterpreter",description:"Use this function to run Javascript code and get any expected return value",parameters:{type:"object",properties:{code:{type:"string",description:"JS code with a return value in the end."}},required:["code"]},func:({code:e})=>this.codeInterpreterJavascript(e)}}};function h(o){return new i(o)}export{i as AxJSInterpreter,c as AxJSInterpreterPermission,s as AxMCPStdioTransport,h as axCreateJSInterpreter,a as axCreateMCPStdioTransport};
4
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../mcp/stdioTransport.ts","../functions/jsInterpreter.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","import * as _fs from 'node:fs';\nimport * as _http from 'node:http';\nimport * as _https from 'node:https';\nimport * as _os from 'node:os';\nimport * as _process from 'node:process';\nimport { runInNewContext } from 'node:vm';\nimport type { AxFunction } from '@ax-llm/ax';\n\n// Local implementation of getCrypto since it's not exported from main package\nfunction getCrypto() {\n if (globalThis.crypto && typeof globalThis.crypto.randomUUID === 'function') {\n return globalThis.crypto;\n }\n throw new Error(\n 'Web Crypto API with randomUUID support not available. Requires Node.js 16+ or modern browser.'\n );\n}\n\nexport enum AxJSInterpreterPermission {\n FS = 'node:fs',\n NET = 'net',\n OS = 'os',\n CRYPTO = 'crypto',\n PROCESS = 'process',\n}\n\ntype Context = {\n console: Console;\n fs: unknown;\n http: unknown;\n https: unknown;\n os: unknown;\n crypto: unknown;\n process: unknown;\n};\n\nexport class AxJSInterpreter {\n private permissions: readonly AxJSInterpreterPermission[];\n\n constructor({\n permissions = [],\n }:\n | Readonly<{ permissions?: readonly AxJSInterpreterPermission[] }>\n | undefined = {}) {\n this.permissions = permissions ?? [];\n }\n\n private codeInterpreterJavascript(code: string): unknown {\n const context: Partial<Context> = { console };\n\n if (this.permissions.includes(AxJSInterpreterPermission.FS)) {\n context.fs = _fs;\n }\n\n if (this.permissions.includes(AxJSInterpreterPermission.NET)) {\n context.http = _http;\n context.https = _https;\n }\n\n if (this.permissions.includes(AxJSInterpreterPermission.OS)) {\n context.os = _os;\n }\n\n if (this.permissions.includes(AxJSInterpreterPermission.CRYPTO)) {\n context.crypto = getCrypto();\n }\n\n if (this.permissions.includes(AxJSInterpreterPermission.PROCESS)) {\n context.process = _process;\n }\n\n return runInNewContext(`(function() { ${code} })()`, context);\n }\n\n public toFunction(): AxFunction {\n return {\n name: 'javascriptInterpreter',\n description:\n 'Use this function to run Javascript code and get any expected return value',\n parameters: {\n type: 'object',\n properties: {\n code: {\n type: 'string',\n description: 'JS code with a return value in the end.',\n },\n },\n required: ['code'],\n },\n\n func: ({ code }: Readonly<{ code: string }>) =>\n this.codeInterpreterJavascript(code),\n };\n }\n}\n\n// Factory function following the same pattern as MCP\nexport function axCreateJSInterpreter(\n options?: Readonly<{ permissions?: readonly AxJSInterpreterPermission[] }>\n): AxJSInterpreter {\n return new AxJSInterpreter(options);\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,CCvFA,UAAYQ,MAAS,KACrB,UAAYC,MAAW,OACvB,UAAYC,MAAY,QACxB,UAAYC,MAAS,KACrB,UAAYC,MAAc,UAC1B,OAAS,mBAAAC,MAAuB,KAIhC,SAASC,GAAY,CACnB,GAAI,WAAW,QAAU,OAAO,WAAW,OAAO,YAAe,WAC/D,OAAO,WAAW,OAEpB,MAAM,IAAI,MACR,+FACF,CACF,CAEO,IAAKC,OACVA,EAAA,GAAK,UACLA,EAAA,IAAM,MACNA,EAAA,GAAK,KACLA,EAAA,OAAS,SACTA,EAAA,QAAU,UALAA,OAAA,IAkBCC,EAAN,KAAsB,CACnB,YAER,YAAY,CACV,YAAAC,EAAc,CAAC,CACjB,EAEgB,CAAC,EAAG,CAClB,KAAK,YAAcA,GAAe,CAAC,CACrC,CAEQ,0BAA0BC,EAAuB,CACvD,IAAMC,EAA4B,CAAE,OAAQ,EAE5C,OAAI,KAAK,YAAY,SAAS,SAA4B,IACxDA,EAAQ,GAAKX,GAGX,KAAK,YAAY,SAAS,KAA6B,IACzDW,EAAQ,KAAOV,EACfU,EAAQ,MAAQT,GAGd,KAAK,YAAY,SAAS,IAA4B,IACxDS,EAAQ,GAAKR,GAGX,KAAK,YAAY,SAAS,QAAgC,IAC5DQ,EAAQ,OAASL,EAAU,GAGzB,KAAK,YAAY,SAAS,SAAiC,IAC7DK,EAAQ,QAAUP,GAGbC,EAAgB,iBAAiBK,CAAI,QAASC,CAAO,CAC9D,CAEO,YAAyB,CAC9B,MAAO,CACL,KAAM,wBACN,YACE,6EACF,WAAY,CACV,KAAM,SACN,WAAY,CACV,KAAM,CACJ,KAAM,SACN,YAAa,yCACf,CACF,EACA,SAAU,CAAC,MAAM,CACnB,EAEA,KAAM,CAAC,CAAE,KAAAD,CAAK,IACZ,KAAK,0BAA0BA,CAAI,CACvC,CACF,CACF,EAGO,SAASE,EACdC,EACiB,CACjB,OAAO,IAAIL,EAAgBK,CAAO,CACpC","names":["spawn","readline","AxMCPStdioTransport","config","line","response","resolver","message","resolve","res","axCreateMCPStdioTransport","_fs","_http","_https","_os","_process","runInNewContext","getCrypto","AxJSInterpreterPermission","AxJSInterpreter","permissions","code","context","axCreateJSInterpreter","options"]}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@ax-llm/ax-tools",
3
+ "version": "13.0.8",
4
+ "type": "module",
5
+ "description": "Ax tools package",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/ax-llm/ax.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "license": "Apache-2.0",
14
+ "keywords": [],
15
+ "dependencies": {
16
+ "@ax-llm/ax": "13.0.8"
17
+ },
18
+ "files": [
19
+ "**/*"
20
+ ],
21
+ "bugs": {
22
+ "url": "https://github.com/@ax-llm/ax/issues"
23
+ },
24
+ "homepage": "https://github.com/@ax-llm/ax#readme",
25
+ "author": "Vikram <https://twitter.com/dosco>",
26
+ "main": "./index.cjs",
27
+ "module": "./index.js",
28
+ "types": "./index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "import": "./index.js",
32
+ "require": "./index.cjs"
33
+ },
34
+ "./*": {
35
+ "import": "./*.js",
36
+ "require": "./*.cjs"
37
+ }
38
+ }
39
+ }