@ggakila/agentx-framework 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/CHANGELOG.md +107 -0
- package/LICENSE +21 -0
- package/README.md +335 -0
- package/dist/agent/Agent.d.ts +110 -0
- package/dist/agent/Agent.d.ts.map +1 -0
- package/dist/agent/Agent.js +291 -0
- package/dist/agent/Agent.js.map +1 -0
- package/dist/agent/index.d.ts +5 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +11 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/cli/CLI.d.ts +74 -0
- package/dist/cli/CLI.d.ts.map +1 -0
- package/dist/cli/CLI.js +255 -0
- package/dist/cli/CLI.js.map +1 -0
- package/dist/cli/InteractiveSetup.d.ts +104 -0
- package/dist/cli/InteractiveSetup.d.ts.map +1 -0
- package/dist/cli/InteractiveSetup.js +2225 -0
- package/dist/cli/InteractiveSetup.js.map +1 -0
- package/dist/cli/bin.d.ts +7 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +35 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/ProjectCommands.d.ts +23 -0
- package/dist/cli/commands/ProjectCommands.d.ts.map +1 -0
- package/dist/cli/commands/ProjectCommands.js +504 -0
- package/dist/cli/commands/ProjectCommands.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +21 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/credential/CredentialManager.d.ts +112 -0
- package/dist/credential/CredentialManager.d.ts.map +1 -0
- package/dist/credential/CredentialManager.js +343 -0
- package/dist/credential/CredentialManager.js.map +1 -0
- package/dist/credential/OAuth2Manager.d.ts +206 -0
- package/dist/credential/OAuth2Manager.d.ts.map +1 -0
- package/dist/credential/OAuth2Manager.js +463 -0
- package/dist/credential/OAuth2Manager.js.map +1 -0
- package/dist/credential/index.d.ts +6 -0
- package/dist/credential/index.d.ts.map +1 -0
- package/dist/credential/index.js +16 -0
- package/dist/credential/index.js.map +1 -0
- package/dist/error/ErrorHandler.d.ts +74 -0
- package/dist/error/ErrorHandler.d.ts.map +1 -0
- package/dist/error/ErrorHandler.js +279 -0
- package/dist/error/ErrorHandler.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/DatabaseTool.d.ts +149 -0
- package/dist/integrations/DatabaseTool.d.ts.map +1 -0
- package/dist/integrations/DatabaseTool.js +900 -0
- package/dist/integrations/DatabaseTool.js.map +1 -0
- package/dist/integrations/EmailTool.d.ts +142 -0
- package/dist/integrations/EmailTool.d.ts.map +1 -0
- package/dist/integrations/EmailTool.js +259 -0
- package/dist/integrations/EmailTool.js.map +1 -0
- package/dist/integrations/FileSystemTool.d.ts +153 -0
- package/dist/integrations/FileSystemTool.d.ts.map +1 -0
- package/dist/integrations/FileSystemTool.js +835 -0
- package/dist/integrations/FileSystemTool.js.map +1 -0
- package/dist/integrations/GoogleWorkspaceTool.d.ts +125 -0
- package/dist/integrations/GoogleWorkspaceTool.d.ts.map +1 -0
- package/dist/integrations/GoogleWorkspaceTool.js +765 -0
- package/dist/integrations/GoogleWorkspaceTool.js.map +1 -0
- package/dist/integrations/HttpTool.d.ts +55 -0
- package/dist/integrations/HttpTool.d.ts.map +1 -0
- package/dist/integrations/HttpTool.js +209 -0
- package/dist/integrations/HttpTool.js.map +1 -0
- package/dist/integrations/MessagingTool.d.ts +136 -0
- package/dist/integrations/MessagingTool.d.ts.map +1 -0
- package/dist/integrations/MessagingTool.js +503 -0
- package/dist/integrations/MessagingTool.js.map +1 -0
- package/dist/integrations/SchedulerTool.d.ts +147 -0
- package/dist/integrations/SchedulerTool.d.ts.map +1 -0
- package/dist/integrations/SchedulerTool.js +471 -0
- package/dist/integrations/SchedulerTool.js.map +1 -0
- package/dist/integrations/WebhookTool.d.ts +97 -0
- package/dist/integrations/WebhookTool.d.ts.map +1 -0
- package/dist/integrations/WebhookTool.js +351 -0
- package/dist/integrations/WebhookTool.js.map +1 -0
- package/dist/integrations/index.d.ts +13 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +60 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/llm/LLMProvider.d.ts +83 -0
- package/dist/llm/LLMProvider.d.ts.map +1 -0
- package/dist/llm/LLMProvider.js +370 -0
- package/dist/llm/LLMProvider.js.map +1 -0
- package/dist/llm/index.d.ts +5 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +14 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/payment/PaymentProvider.d.ts +157 -0
- package/dist/payment/PaymentProvider.d.ts.map +1 -0
- package/dist/payment/PaymentProvider.js +525 -0
- package/dist/payment/PaymentProvider.js.map +1 -0
- package/dist/payment/index.d.ts +5 -0
- package/dist/payment/index.d.ts.map +1 -0
- package/dist/payment/index.js +16 -0
- package/dist/payment/index.js.map +1 -0
- package/dist/plugin/PluginManager.d.ts +156 -0
- package/dist/plugin/PluginManager.d.ts.map +1 -0
- package/dist/plugin/PluginManager.js +288 -0
- package/dist/plugin/PluginManager.js.map +1 -0
- package/dist/plugin/index.d.ts +5 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +10 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/runtime/AgentXRuntime.d.ts +90 -0
- package/dist/runtime/AgentXRuntime.d.ts.map +1 -0
- package/dist/runtime/AgentXRuntime.js +469 -0
- package/dist/runtime/AgentXRuntime.js.map +1 -0
- package/dist/security/SecurityManager.d.ts +245 -0
- package/dist/security/SecurityManager.d.ts.map +1 -0
- package/dist/security/SecurityManager.js +512 -0
- package/dist/security/SecurityManager.js.map +1 -0
- package/dist/security/index.d.ts +5 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +14 -0
- package/dist/security/index.js.map +1 -0
- package/dist/tool/ToolRegistry.d.ts +58 -0
- package/dist/tool/ToolRegistry.d.ts.map +1 -0
- package/dist/tool/ToolRegistry.js +173 -0
- package/dist/tool/ToolRegistry.js.map +1 -0
- package/dist/tool/ToolValidator.d.ts +41 -0
- package/dist/tool/ToolValidator.d.ts.map +1 -0
- package/dist/tool/ToolValidator.js +158 -0
- package/dist/tool/ToolValidator.js.map +1 -0
- package/dist/tool/index.d.ts +6 -0
- package/dist/tool/index.d.ts.map +1 -0
- package/dist/tool/index.js +11 -0
- package/dist/tool/index.js.map +1 -0
- package/dist/transport/BaseTransport.d.ts +66 -0
- package/dist/transport/BaseTransport.d.ts.map +1 -0
- package/dist/transport/BaseTransport.js +103 -0
- package/dist/transport/BaseTransport.js.map +1 -0
- package/dist/transport/HttpTransport.d.ts +41 -0
- package/dist/transport/HttpTransport.d.ts.map +1 -0
- package/dist/transport/HttpTransport.js +160 -0
- package/dist/transport/HttpTransport.js.map +1 -0
- package/dist/transport/LocalTransport.d.ts +40 -0
- package/dist/transport/LocalTransport.d.ts.map +1 -0
- package/dist/transport/LocalTransport.js +157 -0
- package/dist/transport/LocalTransport.js.map +1 -0
- package/dist/transport/QueueTransport.d.ts +63 -0
- package/dist/transport/QueueTransport.d.ts.map +1 -0
- package/dist/transport/QueueTransport.js +194 -0
- package/dist/transport/QueueTransport.js.map +1 -0
- package/dist/transport/StdioTransport.d.ts +51 -0
- package/dist/transport/StdioTransport.d.ts.map +1 -0
- package/dist/transport/StdioTransport.js +216 -0
- package/dist/transport/StdioTransport.js.map +1 -0
- package/dist/transport/TransportFactory.d.ts +35 -0
- package/dist/transport/TransportFactory.d.ts.map +1 -0
- package/dist/transport/TransportFactory.js +100 -0
- package/dist/transport/TransportFactory.js.map +1 -0
- package/dist/transport/index.d.ts +10 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +19 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/types/agent.d.ts +66 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +3 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/config.d.ts +60 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +6 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/credential.d.ts +38 -0
- package/dist/types/credential.d.ts.map +1 -0
- package/dist/types/credential.js +3 -0
- package/dist/types/credential.js.map +1 -0
- package/dist/types/error.d.ts +136 -0
- package/dist/types/error.d.ts.map +1 -0
- package/dist/types/error.js +223 -0
- package/dist/types/error.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +27 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/llm.d.ts +43 -0
- package/dist/types/llm.d.ts.map +1 -0
- package/dist/types/llm.js +3 -0
- package/dist/types/llm.js.map +1 -0
- package/dist/types/payment.d.ts +129 -0
- package/dist/types/payment.d.ts.map +1 -0
- package/dist/types/payment.js +6 -0
- package/dist/types/payment.js.map +1 -0
- package/dist/types/runtime.d.ts +31 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +3 -0
- package/dist/types/runtime.js.map +1 -0
- package/dist/types/tool.d.ts +72 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/tool.js +3 -0
- package/dist/types/tool.js.map +1 -0
- package/dist/types/transport.d.ts +53 -0
- package/dist/types/transport.d.ts.map +1 -0
- package/dist/types/transport.js +3 -0
- package/dist/types/transport.js.map +1 -0
- package/dist/types/workflow.d.ts +72 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workflow.js +6 -0
- package/dist/types/workflow.js.map +1 -0
- package/dist/utils/factory.d.ts +14 -0
- package/dist/utils/factory.d.ts.map +1 -0
- package/dist/utils/factory.js +146 -0
- package/dist/utils/factory.js.map +1 -0
- package/dist/workflow/StateManager.d.ts +93 -0
- package/dist/workflow/StateManager.d.ts.map +1 -0
- package/dist/workflow/StateManager.js +223 -0
- package/dist/workflow/StateManager.js.map +1 -0
- package/dist/workflow/WorkflowDefinition.d.ts +49 -0
- package/dist/workflow/WorkflowDefinition.d.ts.map +1 -0
- package/dist/workflow/WorkflowDefinition.js +264 -0
- package/dist/workflow/WorkflowDefinition.js.map +1 -0
- package/dist/workflow/WorkflowExecutor.d.ts +42 -0
- package/dist/workflow/WorkflowExecutor.d.ts.map +1 -0
- package/dist/workflow/WorkflowExecutor.js +372 -0
- package/dist/workflow/WorkflowExecutor.js.map +1 -0
- package/dist/workflow/index.d.ts +7 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +17 -0
- package/dist/workflow/index.js.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stdio Transport Implementation
|
|
3
|
+
* Executes tools via subprocess communication (MCP-style)
|
|
4
|
+
*/
|
|
5
|
+
import { BaseTransport } from './BaseTransport';
|
|
6
|
+
import { StdioTransportConfig } from '../types/transport';
|
|
7
|
+
import { ToolSpec, ToolContext, ToolResult } from '../types/tool';
|
|
8
|
+
export declare class StdioTransport extends BaseTransport {
|
|
9
|
+
name: string;
|
|
10
|
+
private process;
|
|
11
|
+
private stdioConfig;
|
|
12
|
+
private pendingRequests;
|
|
13
|
+
private buffer;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize the stdio transport
|
|
16
|
+
*/
|
|
17
|
+
initialize(config: StdioTransportConfig): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Spawn the subprocess
|
|
20
|
+
*/
|
|
21
|
+
private spawnProcess;
|
|
22
|
+
/**
|
|
23
|
+
* Handle stdout data
|
|
24
|
+
*/
|
|
25
|
+
private handleStdout;
|
|
26
|
+
/**
|
|
27
|
+
* Handle JSON-RPC response
|
|
28
|
+
*/
|
|
29
|
+
private handleResponse;
|
|
30
|
+
/**
|
|
31
|
+
* Send a JSON-RPC request
|
|
32
|
+
*/
|
|
33
|
+
private sendRequest;
|
|
34
|
+
/**
|
|
35
|
+
* Execute a tool via stdio
|
|
36
|
+
*/
|
|
37
|
+
execute(tool: string, input: unknown, context: ToolContext): Promise<ToolResult>;
|
|
38
|
+
/**
|
|
39
|
+
* List tools from the subprocess
|
|
40
|
+
*/
|
|
41
|
+
listTools(): Promise<ToolSpec[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Health check for stdio transport
|
|
44
|
+
*/
|
|
45
|
+
healthCheck(): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Shutdown the stdio transport
|
|
48
|
+
*/
|
|
49
|
+
shutdown(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=StdioTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StdioTransport.d.ts","sourceRoot":"","sources":["../../src/transport/StdioTransport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAsBlE,qBAAa,cAAe,SAAQ,aAAa;IAC/C,IAAI,SAAW;IACf,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,eAAe,CAIR;IACf,OAAO,CAAC,MAAM,CAAc;IAE5B;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7D;;OAEG;YACW,YAAY;IAoD1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAqBpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAgBtB;;OAEG;YACW,WAAW;IA+BzB;;OAEG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAsCtF;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IActC;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAarC;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAgBhC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Stdio Transport Implementation
|
|
4
|
+
* Executes tools via subprocess communication (MCP-style)
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.StdioTransport = void 0;
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const BaseTransport_1 = require("./BaseTransport");
|
|
10
|
+
const error_1 = require("../types/error");
|
|
11
|
+
const uuid_1 = require("uuid");
|
|
12
|
+
class StdioTransport extends BaseTransport_1.BaseTransport {
|
|
13
|
+
name = 'stdio';
|
|
14
|
+
process = null;
|
|
15
|
+
stdioConfig;
|
|
16
|
+
pendingRequests = new Map();
|
|
17
|
+
buffer = '';
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the stdio transport
|
|
20
|
+
*/
|
|
21
|
+
async initialize(config) {
|
|
22
|
+
await super.initialize(config);
|
|
23
|
+
this.stdioConfig = config;
|
|
24
|
+
// Spawn the subprocess
|
|
25
|
+
await this.spawnProcess();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Spawn the subprocess
|
|
29
|
+
*/
|
|
30
|
+
async spawnProcess() {
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
try {
|
|
33
|
+
this.process = (0, child_process_1.spawn)(this.stdioConfig.config.command, this.stdioConfig.config.args || [], {
|
|
34
|
+
env: {
|
|
35
|
+
...process.env,
|
|
36
|
+
...this.stdioConfig.config.env,
|
|
37
|
+
},
|
|
38
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
39
|
+
});
|
|
40
|
+
// Handle stdout
|
|
41
|
+
this.process.stdout?.on('data', (data) => {
|
|
42
|
+
this.handleStdout(data.toString());
|
|
43
|
+
});
|
|
44
|
+
// Handle stderr
|
|
45
|
+
this.process.stderr?.on('data', (data) => {
|
|
46
|
+
if (this.logger) {
|
|
47
|
+
this.logger.warn(`Subprocess stderr: ${data.toString()}`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// Handle process exit
|
|
51
|
+
this.process.on('exit', (code) => {
|
|
52
|
+
if (this.logger) {
|
|
53
|
+
this.logger.info(`Subprocess exited with code: ${code}`);
|
|
54
|
+
}
|
|
55
|
+
this.process = null;
|
|
56
|
+
});
|
|
57
|
+
// Handle process error
|
|
58
|
+
this.process.on('error', (error) => {
|
|
59
|
+
if (this.logger) {
|
|
60
|
+
this.logger.error('Subprocess error', error);
|
|
61
|
+
}
|
|
62
|
+
reject(error);
|
|
63
|
+
});
|
|
64
|
+
// Wait for process to be ready
|
|
65
|
+
setTimeout(() => resolve(), 100);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
reject(error);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Handle stdout data
|
|
74
|
+
*/
|
|
75
|
+
handleStdout(data) {
|
|
76
|
+
this.buffer += data;
|
|
77
|
+
// Process complete JSON-RPC messages
|
|
78
|
+
const lines = this.buffer.split('\n');
|
|
79
|
+
this.buffer = lines.pop() || '';
|
|
80
|
+
for (const line of lines) {
|
|
81
|
+
if (line.trim()) {
|
|
82
|
+
try {
|
|
83
|
+
const response = JSON.parse(line);
|
|
84
|
+
this.handleResponse(response);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (this.logger) {
|
|
88
|
+
this.logger.warn('Failed to parse JSON-RPC response', { line, error });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Handle JSON-RPC response
|
|
96
|
+
*/
|
|
97
|
+
handleResponse(response) {
|
|
98
|
+
const pending = this.pendingRequests.get(response.id);
|
|
99
|
+
if (!pending) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
clearTimeout(pending.timeout);
|
|
103
|
+
this.pendingRequests.delete(response.id);
|
|
104
|
+
if (response.error) {
|
|
105
|
+
pending.reject(new Error(response.error.message));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
pending.resolve(response.result);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Send a JSON-RPC request
|
|
113
|
+
*/
|
|
114
|
+
async sendRequest(method, params) {
|
|
115
|
+
if (!this.process || !this.process.stdin) {
|
|
116
|
+
throw new error_1.TransportError('Subprocess is not running', error_1.ErrorCodes.CONNECTION_FAILED);
|
|
117
|
+
}
|
|
118
|
+
const id = (0, uuid_1.v4)();
|
|
119
|
+
const request = {
|
|
120
|
+
jsonrpc: '2.0',
|
|
121
|
+
id,
|
|
122
|
+
method,
|
|
123
|
+
params,
|
|
124
|
+
};
|
|
125
|
+
return new Promise((resolve, reject) => {
|
|
126
|
+
const timeout = setTimeout(() => {
|
|
127
|
+
this.pendingRequests.delete(id);
|
|
128
|
+
reject(new error_1.TransportError('Request timeout', error_1.ErrorCodes.REQUEST_TIMEOUT));
|
|
129
|
+
}, 30000);
|
|
130
|
+
this.pendingRequests.set(id, { resolve, reject, timeout });
|
|
131
|
+
this.process.stdin.write(JSON.stringify(request) + '\n');
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Execute a tool via stdio
|
|
136
|
+
*/
|
|
137
|
+
async execute(tool, input, context) {
|
|
138
|
+
this.ensureInitialized();
|
|
139
|
+
const startTime = Date.now();
|
|
140
|
+
try {
|
|
141
|
+
const result = await this.sendRequest('tools/call', {
|
|
142
|
+
name: tool,
|
|
143
|
+
arguments: input,
|
|
144
|
+
});
|
|
145
|
+
const toolResult = {
|
|
146
|
+
success: true,
|
|
147
|
+
data: result,
|
|
148
|
+
metadata: {
|
|
149
|
+
duration: Date.now() - startTime,
|
|
150
|
+
transport: 'stdio',
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
this.logExecution(tool, context, toolResult);
|
|
154
|
+
return toolResult;
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
const toolResult = this.createErrorResult(error.message, {
|
|
158
|
+
duration: Date.now() - startTime,
|
|
159
|
+
transport: 'stdio',
|
|
160
|
+
errorType: error.name,
|
|
161
|
+
});
|
|
162
|
+
this.logExecution(tool, context, toolResult);
|
|
163
|
+
return toolResult;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* List tools from the subprocess
|
|
168
|
+
*/
|
|
169
|
+
async listTools() {
|
|
170
|
+
this.ensureInitialized();
|
|
171
|
+
try {
|
|
172
|
+
const result = await this.sendRequest('tools/list');
|
|
173
|
+
return result.tools || [];
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
if (this.logger) {
|
|
177
|
+
this.logger.warn('Failed to list tools from stdio transport', { error });
|
|
178
|
+
}
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Health check for stdio transport
|
|
184
|
+
*/
|
|
185
|
+
async healthCheck() {
|
|
186
|
+
if (!this.isInitialized || !this.process) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
try {
|
|
190
|
+
await this.sendRequest('ping');
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Shutdown the stdio transport
|
|
199
|
+
*/
|
|
200
|
+
async shutdown() {
|
|
201
|
+
// Clear pending requests
|
|
202
|
+
for (const [id, pending] of this.pendingRequests) {
|
|
203
|
+
clearTimeout(pending.timeout);
|
|
204
|
+
pending.reject(new Error('Transport shutdown'));
|
|
205
|
+
}
|
|
206
|
+
this.pendingRequests.clear();
|
|
207
|
+
// Kill the subprocess
|
|
208
|
+
if (this.process) {
|
|
209
|
+
this.process.kill();
|
|
210
|
+
this.process = null;
|
|
211
|
+
}
|
|
212
|
+
await super.shutdown();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.StdioTransport = StdioTransport;
|
|
216
|
+
//# sourceMappingURL=StdioTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StdioTransport.js","sourceRoot":"","sources":["../../src/transport/StdioTransport.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAAoD;AACpD,mDAAgD;AAGhD,0CAA4D;AAC5D,+BAAoC;AAoBpC,MAAa,cAAe,SAAQ,6BAAa;IAC/C,IAAI,GAAG,OAAO,CAAC;IACP,OAAO,GAAwB,IAAI,CAAC;IACpC,WAAW,CAAwB;IACnC,eAAe,GAIlB,IAAI,GAAG,EAAE,CAAC;IACP,MAAM,GAAW,EAAE,CAAC;IAE5B;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,MAA4B;QAC3C,MAAM,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAE1B,uBAAuB;QACvB,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,YAAY;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC;gBACH,IAAI,CAAC,OAAO,GAAG,IAAA,qBAAK,EAClB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,EAC/B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,EAClC;oBACE,GAAG,EAAE;wBACH,GAAG,OAAO,CAAC,GAAG;wBACd,GAA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C;gBAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2CAA2C,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAC3E,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,yBAAyB;QACzB,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACjD,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,sBAAsB;QACtB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC;QAED,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;CACF;AAvPD,wCAuPC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport Factory
|
|
3
|
+
* Creates transport instances based on configuration
|
|
4
|
+
*/
|
|
5
|
+
import { Transport, TransportConfig, HttpTransportConfig } from '../types/transport';
|
|
6
|
+
import { Logger } from '../types/tool';
|
|
7
|
+
import { LocalTransport } from './LocalTransport';
|
|
8
|
+
import { HttpTransport } from './HttpTransport';
|
|
9
|
+
import { StdioTransport } from './StdioTransport';
|
|
10
|
+
import { QueueTransport } from './QueueTransport';
|
|
11
|
+
export declare class TransportFactory {
|
|
12
|
+
private logger;
|
|
13
|
+
constructor(logger: Logger);
|
|
14
|
+
/**
|
|
15
|
+
* Create a transport instance based on configuration
|
|
16
|
+
*/
|
|
17
|
+
create(config: TransportConfig): Promise<Transport>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a local transport
|
|
20
|
+
*/
|
|
21
|
+
createLocal(modulePath: string, className?: string): Promise<LocalTransport>;
|
|
22
|
+
/**
|
|
23
|
+
* Create an HTTP transport
|
|
24
|
+
*/
|
|
25
|
+
createHttp(baseUrl: string, options?: Partial<HttpTransportConfig['config']>): Promise<HttpTransport>;
|
|
26
|
+
/**
|
|
27
|
+
* Create a stdio transport
|
|
28
|
+
*/
|
|
29
|
+
createStdio(command: string, args?: string[], env?: Record<string, string>): Promise<StdioTransport>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a queue transport
|
|
32
|
+
*/
|
|
33
|
+
createQueue(queueUrl: string, requestQueue: string, responseQueue: string): Promise<QueueTransport>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=TransportFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransportFactory.d.ts","sourceRoot":"","sources":["../../src/transport/TransportFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAwB,mBAAmB,EAA8C,MAAM,oBAAoB,CAAC;AACvJ,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;IAwCzD;;OAEG;IACG,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAUlF;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAU3G;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAU1G;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAS1G"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Transport Factory
|
|
4
|
+
* Creates transport instances based on configuration
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TransportFactory = void 0;
|
|
8
|
+
const error_1 = require("../types/error");
|
|
9
|
+
const LocalTransport_1 = require("./LocalTransport");
|
|
10
|
+
const HttpTransport_1 = require("./HttpTransport");
|
|
11
|
+
const StdioTransport_1 = require("./StdioTransport");
|
|
12
|
+
const QueueTransport_1 = require("./QueueTransport");
|
|
13
|
+
class TransportFactory {
|
|
14
|
+
logger;
|
|
15
|
+
constructor(logger) {
|
|
16
|
+
this.logger = logger;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a transport instance based on configuration
|
|
20
|
+
*/
|
|
21
|
+
async create(config) {
|
|
22
|
+
let transport;
|
|
23
|
+
switch (config.type) {
|
|
24
|
+
case 'local':
|
|
25
|
+
transport = new LocalTransport_1.LocalTransport();
|
|
26
|
+
await transport.initialize(config);
|
|
27
|
+
break;
|
|
28
|
+
case 'http':
|
|
29
|
+
transport = new HttpTransport_1.HttpTransport();
|
|
30
|
+
await transport.initialize(config);
|
|
31
|
+
break;
|
|
32
|
+
case 'stdio':
|
|
33
|
+
transport = new StdioTransport_1.StdioTransport();
|
|
34
|
+
await transport.initialize(config);
|
|
35
|
+
break;
|
|
36
|
+
case 'queue':
|
|
37
|
+
transport = new QueueTransport_1.QueueTransport();
|
|
38
|
+
await transport.initialize(config);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
throw new error_1.ConfigurationError(`Unknown transport type: ${config.type}`, error_1.ErrorCodes.INVALID_CONFIG);
|
|
42
|
+
}
|
|
43
|
+
// Set logger on transport
|
|
44
|
+
if ('setLogger' in transport && typeof transport.setLogger === 'function') {
|
|
45
|
+
transport.setLogger(this.logger);
|
|
46
|
+
}
|
|
47
|
+
this.logger.info(`Created transport: ${config.type}`);
|
|
48
|
+
return transport;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create a local transport
|
|
52
|
+
*/
|
|
53
|
+
async createLocal(modulePath, className) {
|
|
54
|
+
const transport = new LocalTransport_1.LocalTransport();
|
|
55
|
+
await transport.initialize({
|
|
56
|
+
type: 'local',
|
|
57
|
+
config: { modulePath, className },
|
|
58
|
+
});
|
|
59
|
+
transport.setLogger(this.logger);
|
|
60
|
+
return transport;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create an HTTP transport
|
|
64
|
+
*/
|
|
65
|
+
async createHttp(baseUrl, options) {
|
|
66
|
+
const transport = new HttpTransport_1.HttpTransport();
|
|
67
|
+
await transport.initialize({
|
|
68
|
+
type: 'http',
|
|
69
|
+
config: { baseUrl, ...options },
|
|
70
|
+
});
|
|
71
|
+
transport.setLogger(this.logger);
|
|
72
|
+
return transport;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a stdio transport
|
|
76
|
+
*/
|
|
77
|
+
async createStdio(command, args, env) {
|
|
78
|
+
const transport = new StdioTransport_1.StdioTransport();
|
|
79
|
+
await transport.initialize({
|
|
80
|
+
type: 'stdio',
|
|
81
|
+
config: { command, args, env },
|
|
82
|
+
});
|
|
83
|
+
transport.setLogger(this.logger);
|
|
84
|
+
return transport;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Create a queue transport
|
|
88
|
+
*/
|
|
89
|
+
async createQueue(queueUrl, requestQueue, responseQueue) {
|
|
90
|
+
const transport = new QueueTransport_1.QueueTransport();
|
|
91
|
+
await transport.initialize({
|
|
92
|
+
type: 'queue',
|
|
93
|
+
config: { queueUrl, requestQueue, responseQueue },
|
|
94
|
+
});
|
|
95
|
+
transport.setLogger(this.logger);
|
|
96
|
+
return transport;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.TransportFactory = TransportFactory;
|
|
100
|
+
//# sourceMappingURL=TransportFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransportFactory.js","sourceRoot":"","sources":["../../src/transport/TransportFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0CAAgE;AAChE,qDAAkD;AAClD,mDAAgD;AAChD,qDAAkD;AAClD,qDAAkD;AAElD,MAAa,gBAAgB;IACnB,MAAM,CAAS;IAEvB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,MAAuB;QAClC,IAAI,SAAoB,CAAC;QAEzB,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,OAAO;gBACV,SAAS,G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B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,OAAgD;QAChF,MAAM,SAAS,GAAG,IAAI,6BAAa,EAAE,CAAC;QACtC,MAAM,SAAS,CAAC,UAAU,CAAC;YACzB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE;SAChC,CAAC,CAAC;QACH,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,IAAe,EAAE,GAA4B;QAC9E,MAAM,SAAS,GAAG,IAAI,+BAAc,EAAE,CAAC;QACvC,MAAM,SAAS,CAAC,UAAU,CAAC;YACzB,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE;SAC/B,CAAC,CAAC;QACH,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,QAAgB,EAAE,YAAoB,EAAE,aAAqB;QAC7E,MAAM,SAAS,GAAG,IAAI,+BAAc,EAAE,CAAC;QACvC,MAAM,SAAS,CAAC,UAAU,CAAC;YACzB,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE;SAClD,CAAC,CAAC;QACH,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArGD,4CAqGC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport System Exports
|
|
3
|
+
*/
|
|
4
|
+
export { BaseTransport } from './BaseTransport';
|
|
5
|
+
export { LocalTransport } from './LocalTransport';
|
|
6
|
+
export { HttpTransport } from './HttpTransport';
|
|
7
|
+
export { StdioTransport } from './StdioTransport';
|
|
8
|
+
export { QueueTransport, QueueStatistics } from './QueueTransport';
|
|
9
|
+
export { TransportFactory } from './TransportFactory';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Transport System Exports
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TransportFactory = exports.QueueTransport = exports.StdioTransport = exports.HttpTransport = exports.LocalTransport = exports.BaseTransport = void 0;
|
|
7
|
+
var BaseTransport_1 = require("./BaseTransport");
|
|
8
|
+
Object.defineProperty(exports, "BaseTransport", { enumerable: true, get: function () { return BaseTransport_1.BaseTransport; } });
|
|
9
|
+
var LocalTransport_1 = require("./LocalTransport");
|
|
10
|
+
Object.defineProperty(exports, "LocalTransport", { enumerable: true, get: function () { return LocalTransport_1.LocalTransport; } });
|
|
11
|
+
var HttpTransport_1 = require("./HttpTransport");
|
|
12
|
+
Object.defineProperty(exports, "HttpTransport", { enumerable: true, get: function () { return HttpTransport_1.HttpTransport; } });
|
|
13
|
+
var StdioTransport_1 = require("./StdioTransport");
|
|
14
|
+
Object.defineProperty(exports, "StdioTransport", { enumerable: true, get: function () { return StdioTransport_1.StdioTransport; } });
|
|
15
|
+
var QueueTransport_1 = require("./QueueTransport");
|
|
16
|
+
Object.defineProperty(exports, "QueueTransport", { enumerable: true, get: function () { return QueueTransport_1.QueueTransport; } });
|
|
17
|
+
var TransportFactory_1 = require("./TransportFactory");
|
|
18
|
+
Object.defineProperty(exports, "TransportFactory", { enumerable: true, get: function () { return TransportFactory_1.TransportFactory; } });
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,mDAAmE;AAA1D,gHAAA,cAAc,OAAA;AACvB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ToolSpec, Logger } from './tool';
|
|
2
|
+
/**
|
|
3
|
+
* AI Agent System Types
|
|
4
|
+
*/
|
|
5
|
+
export interface Agent {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
config: AgentConfig;
|
|
9
|
+
execute(goal: string, context: AgentContext): Promise<AgentResult>;
|
|
10
|
+
chat(messages: ChatMessage[], context: AgentContext): Promise<ChatResponse>;
|
|
11
|
+
saveMemory(key: string, value: unknown): Promise<void>;
|
|
12
|
+
getMemory(key: string): Promise<unknown>;
|
|
13
|
+
clearMemory(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface AgentConfig {
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
llmProvider: string;
|
|
19
|
+
model: string;
|
|
20
|
+
systemPrompt?: string;
|
|
21
|
+
allowedTools: string[];
|
|
22
|
+
maxIterations?: number;
|
|
23
|
+
temperature?: number;
|
|
24
|
+
memoryConfig?: MemoryConfig;
|
|
25
|
+
}
|
|
26
|
+
export interface AgentContext {
|
|
27
|
+
executionId: string;
|
|
28
|
+
workflowId: string;
|
|
29
|
+
stepId: string;
|
|
30
|
+
availableTools: ToolSpec[];
|
|
31
|
+
credentials: Record<string, unknown>;
|
|
32
|
+
logger: Logger;
|
|
33
|
+
}
|
|
34
|
+
export interface AgentResult {
|
|
35
|
+
success: boolean;
|
|
36
|
+
result?: unknown;
|
|
37
|
+
reasoning?: string;
|
|
38
|
+
toolCalls?: ToolCall[];
|
|
39
|
+
error?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ChatMessage {
|
|
42
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
43
|
+
content: string;
|
|
44
|
+
toolCalls?: ToolCall[];
|
|
45
|
+
toolCallId?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ChatResponse {
|
|
48
|
+
message: ChatMessage;
|
|
49
|
+
usage?: TokenUsage;
|
|
50
|
+
finishReason: 'stop' | 'length' | 'tool_calls';
|
|
51
|
+
}
|
|
52
|
+
export interface ToolCall {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
arguments: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
export interface TokenUsage {
|
|
58
|
+
promptTokens: number;
|
|
59
|
+
completionTokens: number;
|
|
60
|
+
totalTokens: number;
|
|
61
|
+
}
|
|
62
|
+
export interface MemoryConfig {
|
|
63
|
+
type: 'in_memory' | 'file' | 'database';
|
|
64
|
+
config: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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ACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAC;CAChD;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Types
|
|
3
|
+
*/
|
|
4
|
+
export interface AgentXConfig {
|
|
5
|
+
runtime: RuntimeConfig;
|
|
6
|
+
logging: LoggingConfig;
|
|
7
|
+
metrics: MetricsConfig;
|
|
8
|
+
security: SecurityConfig;
|
|
9
|
+
storage: StorageConfig;
|
|
10
|
+
}
|
|
11
|
+
export interface RuntimeConfig {
|
|
12
|
+
maxConcurrentWorkflows: number;
|
|
13
|
+
defaultTimeout: number;
|
|
14
|
+
retryPolicy: RetryPolicy;
|
|
15
|
+
rateLimiting: RateLimitConfig;
|
|
16
|
+
}
|
|
17
|
+
export interface RetryPolicy {
|
|
18
|
+
maxAttempts: number;
|
|
19
|
+
backoffStrategy: 'linear' | 'exponential' | 'fixed';
|
|
20
|
+
baseDelay: number;
|
|
21
|
+
maxDelay: number;
|
|
22
|
+
}
|
|
23
|
+
export interface RateLimitConfig {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
requestsPerSecond: number;
|
|
26
|
+
burstSize: number;
|
|
27
|
+
}
|
|
28
|
+
export interface LoggingConfig {
|
|
29
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
30
|
+
format: 'json' | 'text';
|
|
31
|
+
outputs: LogOutput[];
|
|
32
|
+
}
|
|
33
|
+
export interface LogOutput {
|
|
34
|
+
type: 'console' | 'file' | 'http';
|
|
35
|
+
config: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
export interface MetricsConfig {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
provider: 'prometheus' | 'statsd' | 'datadog';
|
|
40
|
+
config: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface SecurityConfig {
|
|
43
|
+
encryption: {
|
|
44
|
+
algorithm: string;
|
|
45
|
+
keySize: number;
|
|
46
|
+
};
|
|
47
|
+
authentication: {
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
providers: string[];
|
|
50
|
+
};
|
|
51
|
+
authorization: {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
defaultRole: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface StorageConfig {
|
|
57
|
+
type: 'memory' | 'file' | 'database';
|
|
58
|
+
config: Record<string, unknown>;
|
|
59
|
+
}
|
|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,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,EAAE;QACd,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,aAAa,EAAE;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ToolContext } from './tool';
|
|
2
|
+
/**
|
|
3
|
+
* Credential Management Types
|
|
4
|
+
*/
|
|
5
|
+
export interface CredentialManager {
|
|
6
|
+
setCredential(scope: string, credential: Credential): Promise<void>;
|
|
7
|
+
getCredential(scope: string): Promise<Credential | null>;
|
|
8
|
+
deleteCredential(scope: string): Promise<void>;
|
|
9
|
+
listCredentials(): Promise<string[]>;
|
|
10
|
+
injectCredentials(context: ToolContext): Promise<Record<string, unknown>>;
|
|
11
|
+
initiateOAuth2Flow(provider: string, scopes: string[]): Promise<string>;
|
|
12
|
+
completeOAuth2Flow(code: string, state: string): Promise<Credential>;
|
|
13
|
+
refreshToken(credential: OAuth2Credential): Promise<OAuth2Credential>;
|
|
14
|
+
}
|
|
15
|
+
export interface Credential {
|
|
16
|
+
type: 'api_key' | 'oauth2' | 'basic_auth' | 'custom';
|
|
17
|
+
data: Record<string, unknown>;
|
|
18
|
+
expiresAt?: Date;
|
|
19
|
+
scopes?: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface OAuth2Credential extends Credential {
|
|
22
|
+
type: 'oauth2';
|
|
23
|
+
data: {
|
|
24
|
+
accessToken: string;
|
|
25
|
+
refreshToken?: string;
|
|
26
|
+
tokenType: string;
|
|
27
|
+
expiresIn?: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface CredentialBackend {
|
|
31
|
+
name: string;
|
|
32
|
+
initialize(config: Record<string, unknown>): Promise<void>;
|
|
33
|
+
store(scope: string, credential: Credential): Promise<void>;
|
|
34
|
+
retrieve(scope: string): Promise<Credential | null>;
|
|
35
|
+
delete(scope: string): Promise<void>;
|
|
36
|
+
list(): Promise<string[]>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=credential.d.ts.map
|