@kadi.build/core 0.0.1-alpha.1 → 0.0.1-alpha.10
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/README.md +1387 -214
- package/dist/abilities/AbilityCache.d.ts +242 -0
- package/dist/abilities/AbilityCache.d.ts.map +1 -0
- package/dist/abilities/AbilityCache.js +285 -0
- package/dist/abilities/AbilityCache.js.map +1 -0
- package/dist/abilities/AbilityContext.d.ts +215 -0
- package/dist/abilities/AbilityContext.d.ts.map +1 -0
- package/dist/abilities/AbilityContext.js +36 -0
- package/dist/abilities/AbilityContext.js.map +1 -0
- package/dist/abilities/AbilityLoader.d.ts +177 -0
- package/dist/abilities/AbilityLoader.d.ts.map +1 -0
- package/dist/abilities/AbilityLoader.js +277 -0
- package/dist/abilities/AbilityLoader.js.map +1 -0
- package/dist/abilities/AbilityProxy.d.ts +463 -0
- package/dist/abilities/AbilityProxy.d.ts.map +1 -0
- package/dist/abilities/AbilityProxy.js +511 -0
- package/dist/abilities/AbilityProxy.js.map +1 -0
- package/dist/abilities/AbilityValidator.d.ts +172 -0
- package/dist/abilities/AbilityValidator.d.ts.map +1 -0
- package/dist/abilities/AbilityValidator.js +253 -0
- package/dist/abilities/AbilityValidator.js.map +1 -0
- package/dist/abilities/index.d.ts +26 -0
- package/dist/abilities/index.d.ts.map +1 -0
- package/dist/abilities/index.js +23 -0
- package/dist/abilities/index.js.map +1 -0
- package/dist/abilities/types.d.ts +156 -0
- package/dist/abilities/types.d.ts.map +1 -0
- package/dist/abilities/types.js +10 -0
- package/dist/abilities/types.js.map +1 -0
- package/dist/api/index.d.ts +92 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +124 -0
- package/dist/api/index.js.map +1 -0
- package/dist/broker/BrokerConnection.d.ts +253 -0
- package/dist/broker/BrokerConnection.d.ts.map +1 -0
- package/dist/broker/BrokerConnection.js +434 -0
- package/dist/broker/BrokerConnection.js.map +1 -0
- package/dist/broker/BrokerConnectionManager.d.ts +216 -0
- package/dist/broker/BrokerConnectionManager.d.ts.map +1 -0
- package/dist/broker/BrokerConnectionManager.js +305 -0
- package/dist/broker/BrokerConnectionManager.js.map +1 -0
- package/dist/broker/BrokerProtocol.d.ts +280 -0
- package/dist/broker/BrokerProtocol.d.ts.map +1 -0
- package/dist/broker/BrokerProtocol.js +466 -0
- package/dist/broker/BrokerProtocol.js.map +1 -0
- package/dist/broker/index.d.ts +9 -0
- package/dist/broker/index.d.ts.map +1 -0
- package/dist/broker/index.js +9 -0
- package/dist/broker/index.js.map +1 -0
- package/dist/client/KadiClient.d.ts +270 -0
- package/dist/client/KadiClient.d.ts.map +1 -0
- package/dist/client/KadiClient.js +492 -0
- package/dist/client/KadiClient.js.map +1 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/config/ConfigLoader.d.ts +138 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -0
- package/dist/config/ConfigLoader.js +226 -0
- package/dist/config/ConfigLoader.js.map +1 -0
- package/dist/config/ConfigResolver.d.ts +135 -0
- package/dist/config/ConfigResolver.d.ts.map +1 -0
- package/dist/config/ConfigResolver.js +282 -0
- package/dist/config/ConfigResolver.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -0
- package/dist/errors/index.d.ts +9 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +8 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/events/EventHub.d.ts +172 -0
- package/dist/events/EventHub.d.ts.map +1 -0
- package/dist/events/EventHub.js +333 -0
- package/dist/events/EventHub.js.map +1 -0
- package/dist/events/index.d.ts +7 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +7 -0
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/messages/index.d.ts +33 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +33 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/schemas/index.d.ts +19 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +25 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/kadi-extensions.d.ts +231 -0
- package/dist/schemas/kadi-extensions.d.ts.map +1 -0
- package/dist/schemas/kadi-extensions.js +14 -0
- package/dist/schemas/kadi-extensions.js.map +1 -0
- package/dist/schemas/mcp/schema.d.ts +1399 -0
- package/dist/schemas/mcp/schema.d.ts.map +1 -0
- package/dist/schemas/mcp/schema.js +53 -0
- package/dist/schemas/mcp/schema.js.map +1 -0
- package/dist/schemas/mcp/version.d.ts +37 -0
- package/dist/schemas/mcp/version.d.ts.map +1 -0
- package/dist/schemas/mcp/version.js +39 -0
- package/dist/schemas/mcp/version.js.map +1 -0
- package/dist/schemas/schema-builders.d.ts +178 -0
- package/dist/schemas/schema-builders.d.ts.map +1 -0
- package/dist/schemas/schema-builders.js +258 -0
- package/dist/schemas/schema-builders.js.map +1 -0
- package/dist/tools/ToolRegistry.d.ts +256 -0
- package/dist/tools/ToolRegistry.d.ts.map +1 -0
- package/dist/tools/ToolRegistry.js +340 -0
- package/dist/tools/ToolRegistry.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/transports/BrokerTransport.d.ts +151 -0
- package/dist/transports/BrokerTransport.d.ts.map +1 -0
- package/dist/transports/BrokerTransport.js +261 -0
- package/dist/transports/BrokerTransport.js.map +1 -0
- package/dist/transports/NativeTransport.d.ts +149 -0
- package/dist/transports/NativeTransport.d.ts.map +1 -0
- package/dist/transports/NativeTransport.js +302 -0
- package/dist/transports/NativeTransport.js.map +1 -0
- package/dist/transports/StdioTransport.d.ts +172 -0
- package/dist/transports/StdioTransport.d.ts.map +1 -0
- package/dist/transports/StdioTransport.js +410 -0
- package/dist/transports/StdioTransport.js.map +1 -0
- package/dist/transports/index.d.ts +10 -0
- package/dist/transports/index.d.ts.map +1 -0
- package/dist/transports/index.js +9 -0
- package/dist/transports/index.js.map +1 -0
- package/dist/types/broker.d.ts +301 -0
- package/dist/types/broker.d.ts.map +1 -0
- package/dist/types/broker.js +46 -0
- package/dist/types/broker.js.map +1 -0
- package/dist/types/config.d.ts +325 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +17 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/errors.d.ts +178 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +165 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/events.d.ts +210 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +8 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/protocol.d.ts +48 -0
- package/dist/types/protocol.d.ts.map +1 -0
- package/dist/types/protocol.js +11 -0
- package/dist/types/protocol.js.map +1 -0
- package/dist/types/tools.d.ts +67 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +16 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/transport.d.ts +250 -0
- package/dist/types/transport.d.ts.map +1 -0
- package/dist/types/transport.js +18 -0
- package/dist/types/transport.js.map +1 -0
- package/dist/validation/SchemaValidator.d.ts +208 -0
- package/dist/validation/SchemaValidator.d.ts.map +1 -0
- package/dist/validation/SchemaValidator.js +411 -0
- package/dist/validation/SchemaValidator.js.map +1 -0
- package/dist/validation/index.d.ts +11 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +10 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +69 -5
- package/agent.json +0 -18
- package/broker.js +0 -214
- package/index.js +0 -370
- package/ipc.js +0 -220
- package/ipcInterfaces/pythonAbilityIPC.py +0 -177
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stdio Transport
|
|
3
|
+
*
|
|
4
|
+
* Communicates with abilities running as child processes via stdin/stdout.
|
|
5
|
+
* Enables using abilities written in any language that supports JSON over stdio.
|
|
6
|
+
*
|
|
7
|
+
* @module transports/StdioTransport
|
|
8
|
+
*/
|
|
9
|
+
import { EventEmitter } from 'events';
|
|
10
|
+
import { spawn } from 'child_process';
|
|
11
|
+
import { StdioMessageType } from '../types/index.js';
|
|
12
|
+
import { KadiError, ErrorCode } from '../types/index.js';
|
|
13
|
+
/**
|
|
14
|
+
* Message ID counter
|
|
15
|
+
*/
|
|
16
|
+
let messageIdCounter = 0;
|
|
17
|
+
/**
|
|
18
|
+
* Stdio Transport
|
|
19
|
+
*
|
|
20
|
+
* Spawns a child process and communicates via JSON messages over stdin/stdout.
|
|
21
|
+
* Uses length-prefixed framing for reliable message boundaries.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const transport = new StdioTransport({
|
|
26
|
+
* abilityName: 'python-calculator',
|
|
27
|
+
* abilityPath: '/path/to/calculator',
|
|
28
|
+
* command: 'python3',
|
|
29
|
+
* args: ['main.py']
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* await transport.connect();
|
|
33
|
+
* const result = await transport.invoke('calculate', { expr: '2 + 2' });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export class StdioTransport extends EventEmitter {
|
|
37
|
+
/**
|
|
38
|
+
* Transport configuration
|
|
39
|
+
*/
|
|
40
|
+
options;
|
|
41
|
+
/**
|
|
42
|
+
* Child process instance
|
|
43
|
+
*/
|
|
44
|
+
process = null;
|
|
45
|
+
/**
|
|
46
|
+
* Discovered methods
|
|
47
|
+
*/
|
|
48
|
+
methods = [];
|
|
49
|
+
/**
|
|
50
|
+
* Method schemas
|
|
51
|
+
*/
|
|
52
|
+
schemas = new Map();
|
|
53
|
+
/**
|
|
54
|
+
* Whether transport is connected
|
|
55
|
+
*/
|
|
56
|
+
connected = false;
|
|
57
|
+
/**
|
|
58
|
+
* Pending requests waiting for responses
|
|
59
|
+
*/
|
|
60
|
+
pendingRequests = new Map();
|
|
61
|
+
/**
|
|
62
|
+
* Buffer for incomplete messages
|
|
63
|
+
*/
|
|
64
|
+
buffer = Buffer.alloc(0);
|
|
65
|
+
/**
|
|
66
|
+
* Create a new StdioTransport
|
|
67
|
+
*
|
|
68
|
+
* @param options - Stdio transport options
|
|
69
|
+
*/
|
|
70
|
+
constructor(options) {
|
|
71
|
+
super();
|
|
72
|
+
this.options = {
|
|
73
|
+
command: options.command ?? 'node',
|
|
74
|
+
args: options.args ?? ['index.js'],
|
|
75
|
+
env: options.env ?? {},
|
|
76
|
+
cwd: options.cwd ?? options.abilityPath,
|
|
77
|
+
timeout: options.timeout ?? 30000,
|
|
78
|
+
abilityPath: options.abilityPath,
|
|
79
|
+
abilityName: options.abilityName,
|
|
80
|
+
abilityVersion: options.abilityVersion ?? '1.0.0'
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Connect to the ability
|
|
85
|
+
*
|
|
86
|
+
* Spawns the child process and performs method discovery.
|
|
87
|
+
*
|
|
88
|
+
* @throws {KadiError} If process fails to start or discovery fails
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* await transport.connect();
|
|
93
|
+
* console.log('Process started');
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
async connect() {
|
|
97
|
+
if (this.connected) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
// Spawn the child process
|
|
102
|
+
this.process = spawn(this.options.command, this.options.args, {
|
|
103
|
+
cwd: this.options.cwd,
|
|
104
|
+
env: {
|
|
105
|
+
...process.env,
|
|
106
|
+
...this.options.env
|
|
107
|
+
},
|
|
108
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
109
|
+
});
|
|
110
|
+
// Set up error handling
|
|
111
|
+
this.process.on('error', (error) => {
|
|
112
|
+
this.handleProcessError(error);
|
|
113
|
+
});
|
|
114
|
+
this.process.on('exit', (code, signal) => {
|
|
115
|
+
this.handleProcessExit(code, signal);
|
|
116
|
+
});
|
|
117
|
+
// Set up stdout handling (receives messages)
|
|
118
|
+
if (this.process.stdout) {
|
|
119
|
+
this.process.stdout.on('data', (data) => {
|
|
120
|
+
this.handleData(data);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// Set up stderr handling (for debugging)
|
|
124
|
+
if (this.process.stderr) {
|
|
125
|
+
this.process.stderr.on('data', (data) => {
|
|
126
|
+
console.error(`[${this.options.abilityName}] stderr:`, data.toString());
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// Perform discovery
|
|
130
|
+
await this.discoverMethods();
|
|
131
|
+
this.connected = true;
|
|
132
|
+
this.emit('connected');
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
this.cleanup();
|
|
136
|
+
const kadiError = error instanceof KadiError
|
|
137
|
+
? error
|
|
138
|
+
: new KadiError(`Failed to start process: ${error instanceof Error ? error.message : String(error)}`, ErrorCode.STDIO_PROCESS_FAILED, 500, {
|
|
139
|
+
abilityName: this.options.abilityName,
|
|
140
|
+
command: this.options.command,
|
|
141
|
+
args: this.options.args,
|
|
142
|
+
originalError: error instanceof Error ? error.message : String(error)
|
|
143
|
+
});
|
|
144
|
+
this.emit('error', kadiError);
|
|
145
|
+
throw kadiError;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Invoke a method on the ability
|
|
150
|
+
*
|
|
151
|
+
* @template TInput - Input parameter type
|
|
152
|
+
* @template TOutput - Return type
|
|
153
|
+
*
|
|
154
|
+
* @param method - Method name
|
|
155
|
+
* @param params - Method parameters
|
|
156
|
+
* @returns Promise resolving to method result
|
|
157
|
+
*
|
|
158
|
+
* @throws {KadiError} If method doesn't exist or invocation fails
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const result = await transport.invoke('add', { a: 5, b: 3 });
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
async invoke(method, params) {
|
|
166
|
+
if (!this.connected || !this.process) {
|
|
167
|
+
throw new KadiError('Transport not connected', ErrorCode.TRANSPORT_NOT_CONNECTED, 503, { abilityName: this.options.abilityName });
|
|
168
|
+
}
|
|
169
|
+
// Check if method exists
|
|
170
|
+
if (!this.methods.includes(method)) {
|
|
171
|
+
throw new KadiError(`Method '${method}' not found on ability '${this.options.abilityName}'`, ErrorCode.ABILITY_METHOD_NOT_FOUND, 404, { abilityName: this.options.abilityName, method, availableMethods: this.methods });
|
|
172
|
+
}
|
|
173
|
+
const messageId = ++messageIdCounter;
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
const timeout = setTimeout(() => {
|
|
176
|
+
this.pendingRequests.delete(messageId);
|
|
177
|
+
reject(new KadiError(`Method invocation timeout after ${this.options.timeout}ms`, ErrorCode.TOOL_TIMEOUT, 408, { abilityName: this.options.abilityName, method, timeout: this.options.timeout }));
|
|
178
|
+
}, this.options.timeout);
|
|
179
|
+
this.pendingRequests.set(messageId, {
|
|
180
|
+
resolve: resolve,
|
|
181
|
+
reject,
|
|
182
|
+
timeout
|
|
183
|
+
});
|
|
184
|
+
// Send invoke message
|
|
185
|
+
this.sendMessage({
|
|
186
|
+
type: StdioMessageType.INVOKE,
|
|
187
|
+
id: messageId,
|
|
188
|
+
method,
|
|
189
|
+
params
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get list of available methods
|
|
195
|
+
*
|
|
196
|
+
* @returns Array of method names
|
|
197
|
+
*/
|
|
198
|
+
getMethods() {
|
|
199
|
+
return [...this.methods];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get schema for a specific method
|
|
203
|
+
*
|
|
204
|
+
* @param method - Method name
|
|
205
|
+
* @returns Method schema or undefined
|
|
206
|
+
*/
|
|
207
|
+
getMethodSchema(method) {
|
|
208
|
+
return this.schemas.get(method);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Disconnect from the ability
|
|
212
|
+
*
|
|
213
|
+
* Terminates the child process and cleans up resources.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* await transport.disconnect();
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
async disconnect() {
|
|
221
|
+
if (!this.connected) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
this.cleanup();
|
|
225
|
+
this.emit('disconnected');
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Publish an event from the ability
|
|
229
|
+
*
|
|
230
|
+
* @param eventName - Event name
|
|
231
|
+
* @param data - Event data
|
|
232
|
+
*/
|
|
233
|
+
publishEvent(eventName, data) {
|
|
234
|
+
this.emit('event', {
|
|
235
|
+
eventName,
|
|
236
|
+
data,
|
|
237
|
+
timestamp: Date.now(),
|
|
238
|
+
source: this.options.abilityName
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Discover methods by sending discovery request
|
|
243
|
+
*/
|
|
244
|
+
async discoverMethods() {
|
|
245
|
+
if (!this.process) {
|
|
246
|
+
throw new KadiError('Process not started', ErrorCode.STDIO_PROCESS_FAILED, 500, { abilityName: this.options.abilityName });
|
|
247
|
+
}
|
|
248
|
+
const messageId = ++messageIdCounter;
|
|
249
|
+
return new Promise((resolve, reject) => {
|
|
250
|
+
const timeout = setTimeout(() => {
|
|
251
|
+
this.pendingRequests.delete(messageId);
|
|
252
|
+
reject(new KadiError('Discovery timeout', ErrorCode.CONNECTION_TIMEOUT, 408, { abilityName: this.options.abilityName }));
|
|
253
|
+
}, this.options.timeout);
|
|
254
|
+
this.pendingRequests.set(messageId, {
|
|
255
|
+
resolve: (result) => {
|
|
256
|
+
const discovery = result;
|
|
257
|
+
this.methods = discovery.methods;
|
|
258
|
+
if (discovery.schemas) {
|
|
259
|
+
for (const [method, schema] of Object.entries(discovery.schemas)) {
|
|
260
|
+
this.schemas.set(method, schema);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
resolve();
|
|
264
|
+
},
|
|
265
|
+
reject,
|
|
266
|
+
timeout
|
|
267
|
+
});
|
|
268
|
+
// Send discovery message
|
|
269
|
+
this.sendMessage({
|
|
270
|
+
type: StdioMessageType.DISCOVER,
|
|
271
|
+
id: messageId
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Send a message to the child process
|
|
277
|
+
*
|
|
278
|
+
* Uses length-prefixed framing: [length:4 bytes][json message]
|
|
279
|
+
*
|
|
280
|
+
* @param message - Message to send
|
|
281
|
+
*/
|
|
282
|
+
sendMessage(message) {
|
|
283
|
+
if (!this.process || !this.process.stdin) {
|
|
284
|
+
throw new KadiError('Process stdin not available', ErrorCode.TRANSPORT_SEND_FAILED, 500, { abilityName: this.options.abilityName });
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
287
|
+
const json = JSON.stringify(message);
|
|
288
|
+
const messageBuffer = Buffer.from(json, 'utf-8');
|
|
289
|
+
const lengthBuffer = Buffer.allocUnsafe(4);
|
|
290
|
+
lengthBuffer.writeUInt32BE(messageBuffer.length, 0);
|
|
291
|
+
// Write length prefix + message
|
|
292
|
+
this.process.stdin.write(lengthBuffer);
|
|
293
|
+
this.process.stdin.write(messageBuffer);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
throw new KadiError(`Failed to send message: ${error instanceof Error ? error.message : String(error)}`, ErrorCode.TRANSPORT_SEND_FAILED, 500, { abilityName: this.options.abilityName });
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Handle incoming data from stdout
|
|
301
|
+
*
|
|
302
|
+
* Implements length-prefixed framing to extract complete messages.
|
|
303
|
+
*
|
|
304
|
+
* @param data - Raw data from stdout
|
|
305
|
+
*/
|
|
306
|
+
handleData(data) {
|
|
307
|
+
// Append to buffer
|
|
308
|
+
this.buffer = Buffer.concat([this.buffer, data]);
|
|
309
|
+
// Process complete messages
|
|
310
|
+
while (this.buffer.length >= 4) {
|
|
311
|
+
// Read message length (4 bytes, big-endian)
|
|
312
|
+
const messageLength = this.buffer.readUInt32BE(0);
|
|
313
|
+
// Check if we have the complete message
|
|
314
|
+
if (this.buffer.length < 4 + messageLength) {
|
|
315
|
+
break; // Wait for more data
|
|
316
|
+
}
|
|
317
|
+
// Extract message
|
|
318
|
+
const messageBuffer = this.buffer.subarray(4, 4 + messageLength);
|
|
319
|
+
this.buffer = this.buffer.subarray(4 + messageLength);
|
|
320
|
+
// Parse and handle message
|
|
321
|
+
try {
|
|
322
|
+
const message = JSON.parse(messageBuffer.toString('utf-8'));
|
|
323
|
+
this.handleMessage(message);
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
this.emit('error', new KadiError(`Failed to parse message: ${error instanceof Error ? error.message : String(error)}`, ErrorCode.STDIO_FRAMING_ERROR, 400, { abilityName: this.options.abilityName }));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Handle a parsed message
|
|
332
|
+
*
|
|
333
|
+
* @param message - Parsed message object
|
|
334
|
+
*/
|
|
335
|
+
handleMessage(message) {
|
|
336
|
+
// Handle result messages
|
|
337
|
+
if (message.type === StdioMessageType.RESULT && message.id !== undefined) {
|
|
338
|
+
const pending = this.pendingRequests.get(message.id);
|
|
339
|
+
if (pending) {
|
|
340
|
+
clearTimeout(pending.timeout);
|
|
341
|
+
this.pendingRequests.delete(message.id);
|
|
342
|
+
pending.resolve(message.result);
|
|
343
|
+
}
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
// Handle error messages
|
|
347
|
+
if (message.type === StdioMessageType.ERROR && message.id !== undefined) {
|
|
348
|
+
const pending = this.pendingRequests.get(message.id);
|
|
349
|
+
if (pending) {
|
|
350
|
+
clearTimeout(pending.timeout);
|
|
351
|
+
this.pendingRequests.delete(message.id);
|
|
352
|
+
pending.reject(new KadiError(String(message.error ?? 'Unknown error'), ErrorCode.TOOL_INVOCATION_FAILED, 500, { abilityName: this.options.abilityName }));
|
|
353
|
+
}
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
// Handle event messages
|
|
357
|
+
if (message.type === StdioMessageType.EVENT) {
|
|
358
|
+
this.emit('event', message.data);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
// Unknown message type
|
|
362
|
+
console.warn(`Unknown message type: ${message.type}`, message);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Handle process error
|
|
366
|
+
*
|
|
367
|
+
* @param error - Error from child process
|
|
368
|
+
*/
|
|
369
|
+
handleProcessError(error) {
|
|
370
|
+
this.emit('error', new KadiError(`Process error: ${error.message}`, ErrorCode.STDIO_PROCESS_FAILED, 500, { abilityName: this.options.abilityName, originalError: error.message }));
|
|
371
|
+
this.cleanup();
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Handle process exit
|
|
375
|
+
*
|
|
376
|
+
* @param code - Exit code
|
|
377
|
+
* @param signal - Exit signal
|
|
378
|
+
*/
|
|
379
|
+
handleProcessExit(code, signal) {
|
|
380
|
+
if (this.connected) {
|
|
381
|
+
this.emit('error', new KadiError(`Process exited unexpectedly`, ErrorCode.STDIO_PROCESS_EXITED, 500, { abilityName: this.options.abilityName, exitCode: code, signal }));
|
|
382
|
+
}
|
|
383
|
+
this.cleanup();
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Cleanup resources
|
|
387
|
+
*/
|
|
388
|
+
cleanup() {
|
|
389
|
+
// Reject all pending requests
|
|
390
|
+
for (const [_id, pending] of this.pendingRequests) {
|
|
391
|
+
clearTimeout(pending.timeout);
|
|
392
|
+
pending.reject(new KadiError('Process terminated', ErrorCode.STDIO_PROCESS_EXITED, 503, { abilityName: this.options.abilityName }));
|
|
393
|
+
}
|
|
394
|
+
this.pendingRequests.clear();
|
|
395
|
+
// Kill process if running
|
|
396
|
+
if (this.process) {
|
|
397
|
+
if (!this.process.killed) {
|
|
398
|
+
this.process.kill();
|
|
399
|
+
}
|
|
400
|
+
this.process.removeAllListeners();
|
|
401
|
+
this.process = null;
|
|
402
|
+
}
|
|
403
|
+
// Clear state
|
|
404
|
+
this.buffer = Buffer.alloc(0);
|
|
405
|
+
this.methods = [];
|
|
406
|
+
this.schemas.clear();
|
|
407
|
+
this.connected = false;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
//# sourceMappingURL=StdioTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StdioTransport.js","sourceRoot":"","sources":["../../src/transports/StdioTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAMpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;GAEG;AACH,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAWzB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,cAAe,SAAQ,YAAY;IAC9C;;OAEG;IACc,OAAO,CAAkC;IAE1D;;OAEG;IACK,OAAO,GAAwB,IAAI,CAAC;IAE5C;;OAEG;IACK,OAAO,GAAa,EAAE,CAAC;IAE/B;;OAEG;IACK,OAAO,GAAG,I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AAC,CAAC;YAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,CAC1B,oBAAoB,EACpB,SAAS,CAAC,oBAAoB,EAC9B,GAAG,EACH,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAC1C,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,0BAA0B;QAC1B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACzB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC;QAED,cAAc;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transports Module
|
|
3
|
+
*
|
|
4
|
+
* Exports for ability transport implementations.
|
|
5
|
+
*/
|
|
6
|
+
export { NativeTransport } from './NativeTransport.js';
|
|
7
|
+
export { StdioTransport } from './StdioTransport.js';
|
|
8
|
+
export { BrokerTransport } from './BrokerTransport.js';
|
|
9
|
+
export type { IBrokerClient } from './BrokerTransport.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transports/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transports Module
|
|
3
|
+
*
|
|
4
|
+
* Exports for ability transport implementations.
|
|
5
|
+
*/
|
|
6
|
+
export { NativeTransport } from './NativeTransport.js';
|
|
7
|
+
export { StdioTransport } from './StdioTransport.js';
|
|
8
|
+
export { BrokerTransport } from './BrokerTransport.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transports/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|