@kadi.build/core 0.0.1-alpha.9 → 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.
Files changed (126) hide show
  1. package/README.md +362 -1305
  2. package/dist/client.d.ts +573 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +1673 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/errors.d.ts +107 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +147 -0
  9. package/dist/errors.js.map +1 -0
  10. package/dist/index.d.ts +37 -14
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +40 -23
  13. package/dist/index.js.map +1 -1
  14. package/dist/lockfile.d.ts +190 -0
  15. package/dist/lockfile.d.ts.map +1 -0
  16. package/dist/lockfile.js +373 -0
  17. package/dist/lockfile.js.map +1 -0
  18. package/dist/transports/broker.d.ts +75 -0
  19. package/dist/transports/broker.d.ts.map +1 -0
  20. package/dist/transports/broker.js +383 -0
  21. package/dist/transports/broker.js.map +1 -0
  22. package/dist/transports/native.d.ts +39 -0
  23. package/dist/transports/native.d.ts.map +1 -0
  24. package/dist/transports/native.js +189 -0
  25. package/dist/transports/native.js.map +1 -0
  26. package/dist/transports/stdio.d.ts +46 -0
  27. package/dist/transports/stdio.d.ts.map +1 -0
  28. package/dist/transports/stdio.js +460 -0
  29. package/dist/transports/stdio.js.map +1 -0
  30. package/dist/types.d.ts +664 -0
  31. package/dist/types.d.ts.map +1 -0
  32. package/dist/types.js +16 -0
  33. package/dist/types.js.map +1 -0
  34. package/dist/zod.d.ts +34 -0
  35. package/dist/zod.d.ts.map +1 -0
  36. package/dist/zod.js +60 -0
  37. package/dist/zod.js.map +1 -0
  38. package/package.json +13 -28
  39. package/dist/KadiClient.d.ts +0 -470
  40. package/dist/KadiClient.d.ts.map +0 -1
  41. package/dist/KadiClient.js +0 -1572
  42. package/dist/KadiClient.js.map +0 -1
  43. package/dist/errors/error-codes.d.ts +0 -985
  44. package/dist/errors/error-codes.d.ts.map +0 -1
  45. package/dist/errors/error-codes.js +0 -638
  46. package/dist/errors/error-codes.js.map +0 -1
  47. package/dist/loadAbility.d.ts +0 -105
  48. package/dist/loadAbility.d.ts.map +0 -1
  49. package/dist/loadAbility.js +0 -370
  50. package/dist/loadAbility.js.map +0 -1
  51. package/dist/messages/BrokerMessages.d.ts +0 -84
  52. package/dist/messages/BrokerMessages.d.ts.map +0 -1
  53. package/dist/messages/BrokerMessages.js +0 -125
  54. package/dist/messages/BrokerMessages.js.map +0 -1
  55. package/dist/messages/MessageBuilder.d.ts +0 -83
  56. package/dist/messages/MessageBuilder.d.ts.map +0 -1
  57. package/dist/messages/MessageBuilder.js +0 -144
  58. package/dist/messages/MessageBuilder.js.map +0 -1
  59. package/dist/schemas/events.schemas.d.ts +0 -177
  60. package/dist/schemas/events.schemas.d.ts.map +0 -1
  61. package/dist/schemas/events.schemas.js +0 -265
  62. package/dist/schemas/events.schemas.js.map +0 -1
  63. package/dist/schemas/index.d.ts +0 -3
  64. package/dist/schemas/index.d.ts.map +0 -1
  65. package/dist/schemas/index.js +0 -4
  66. package/dist/schemas/index.js.map +0 -1
  67. package/dist/schemas/kadi.schemas.d.ts +0 -70
  68. package/dist/schemas/kadi.schemas.d.ts.map +0 -1
  69. package/dist/schemas/kadi.schemas.js +0 -120
  70. package/dist/schemas/kadi.schemas.js.map +0 -1
  71. package/dist/transports/BrokerTransport.d.ts +0 -102
  72. package/dist/transports/BrokerTransport.d.ts.map +0 -1
  73. package/dist/transports/BrokerTransport.js +0 -177
  74. package/dist/transports/BrokerTransport.js.map +0 -1
  75. package/dist/transports/NativeTransport.d.ts +0 -82
  76. package/dist/transports/NativeTransport.d.ts.map +0 -1
  77. package/dist/transports/NativeTransport.js +0 -263
  78. package/dist/transports/NativeTransport.js.map +0 -1
  79. package/dist/transports/StdioTransport.d.ts +0 -112
  80. package/dist/transports/StdioTransport.d.ts.map +0 -1
  81. package/dist/transports/StdioTransport.js +0 -450
  82. package/dist/transports/StdioTransport.js.map +0 -1
  83. package/dist/transports/Transport.d.ts +0 -93
  84. package/dist/transports/Transport.d.ts.map +0 -1
  85. package/dist/transports/Transport.js +0 -13
  86. package/dist/transports/Transport.js.map +0 -1
  87. package/dist/types/broker.d.ts +0 -31
  88. package/dist/types/broker.d.ts.map +0 -1
  89. package/dist/types/broker.js +0 -6
  90. package/dist/types/broker.js.map +0 -1
  91. package/dist/types/core.d.ts +0 -139
  92. package/dist/types/core.d.ts.map +0 -1
  93. package/dist/types/core.js +0 -26
  94. package/dist/types/core.js.map +0 -1
  95. package/dist/types/events.d.ts +0 -186
  96. package/dist/types/events.d.ts.map +0 -1
  97. package/dist/types/events.js +0 -16
  98. package/dist/types/events.js.map +0 -1
  99. package/dist/types/index.d.ts +0 -9
  100. package/dist/types/index.d.ts.map +0 -1
  101. package/dist/types/index.js +0 -13
  102. package/dist/types/index.js.map +0 -1
  103. package/dist/types/protocol.d.ts +0 -160
  104. package/dist/types/protocol.d.ts.map +0 -1
  105. package/dist/types/protocol.js +0 -5
  106. package/dist/types/protocol.js.map +0 -1
  107. package/dist/utils/agentUtils.d.ts +0 -187
  108. package/dist/utils/agentUtils.d.ts.map +0 -1
  109. package/dist/utils/agentUtils.js +0 -185
  110. package/dist/utils/agentUtils.js.map +0 -1
  111. package/dist/utils/commandUtils.d.ts +0 -45
  112. package/dist/utils/commandUtils.d.ts.map +0 -1
  113. package/dist/utils/commandUtils.js +0 -145
  114. package/dist/utils/commandUtils.js.map +0 -1
  115. package/dist/utils/configUtils.d.ts +0 -55
  116. package/dist/utils/configUtils.d.ts.map +0 -1
  117. package/dist/utils/configUtils.js +0 -100
  118. package/dist/utils/configUtils.js.map +0 -1
  119. package/dist/utils/logger.d.ts +0 -59
  120. package/dist/utils/logger.d.ts.map +0 -1
  121. package/dist/utils/logger.js +0 -122
  122. package/dist/utils/logger.js.map +0 -1
  123. package/dist/utils/pathUtils.d.ts +0 -48
  124. package/dist/utils/pathUtils.d.ts.map +0 -1
  125. package/dist/utils/pathUtils.js +0 -128
  126. package/dist/utils/pathUtils.js.map +0 -1
@@ -1,105 +0,0 @@
1
- /**
2
- * Load an ability using the specified protocol
3
- *
4
- * Simplified implementation that focuses on the native protocol for now.
5
- * Stdio and broker support can be added back as needed.
6
- */
7
- import { EventEmitter } from 'events';
8
- export interface AbilityEvents extends EventEmitter {
9
- on(event: string, listener: (...args: any[]) => void): this;
10
- emit(event: string, ...args: any[]): boolean;
11
- }
12
- export interface LoadedAbility extends EventEmitter {
13
- events: AbilityEvents;
14
- __call(method: string, params: any): Promise<any>;
15
- __schema(method: string): {
16
- inputSchema?: any;
17
- outputSchema?: any;
18
- } | undefined;
19
- __disconnect(): Promise<void>;
20
- __discover?(options: {
21
- networks?: string[];
22
- includeProviders?: boolean;
23
- }): Promise<any[]>;
24
- [methodName: string]: any;
25
- }
26
- /**
27
- * Load an ability (standalone function)
28
- *
29
- * This is the core ability loading function that does the actual work. It's designed
30
- * as a standalone function for maximum flexibility - you can use it directly without
31
- * needing a KadiClient instance.
32
- *
33
- * Why standalone? This design allows:
34
- * - Simple ability loading without full KadiClient setup
35
- * - Use in lightweight scripts or utilities
36
- * - Direct control over all options without client configuration interference
37
- * - Testing and debugging individual ability loading scenarios
38
- *
39
- * The KadiClient.loadAbility() method is a convenient wrapper that calls this
40
- * function after resolving broker names from the client's configuration.
41
- *
42
- * @param nameOrPath - Which ability to load. Can be:
43
- * - "ability-name" - loads from your installed abilities folder
44
- * - "/absolute/path/to/ability" - loads from a specific directory path
45
- *
46
- * @param transportMode - How to connect to the ability:
47
- * - 'native': Load directly into this process (fastest, JavaScript/TypeScript only)
48
- * - 'stdio': Spawn as child process, communicate via stdin/stdout (any language)
49
- * - 'broker': Connect via broker WebSocket (ability runs anywhere, most flexible)
50
- *
51
- * @param options - Transport-specific configuration:
52
- *
53
- * existingClient: KadiClient instance to reuse (broker protocol only).
54
- * Used internally when called from KadiClient.loadAbility() to reuse connections.
55
- *
56
- * brokerUrl: Direct WebSocket URL (broker protocol only).
57
- * Example: 'ws://localhost:8080', 'wss://broker.company.com'
58
- * Must be provided when using broker protocol without existingClient.
59
- *
60
- * brokerName: Human-readable name for the broker (broker protocol only).
61
- * Used for logging and identification purposes.
62
- *
63
- * spawnAbility: Whether to start the ability process first (broker protocol only).
64
- * - true: Start the ability locally AND connect to it via broker
65
- * - false (default): Just connect to an already-running ability
66
- * Typically false in production where abilities run as separate processes.
67
- *
68
- * networks: Which KADI networks to search for the ability (broker protocol only).
69
- * Example: ['global', 'team-alpha', 'production']
70
- * Networks are like public/private rooms in the broker where clients register
71
- * and discover each other.
72
- * Defaults to ['global'] if not specified.
73
- *
74
- * @returns A proxy object that lets you call the ability's methods directly.
75
- * The proxy automatically handles protocol communication (native imports, stdio JSON-RPC,
76
- * or broker WebSocket messages) and presents a clean JavaScript API.
77
- *
78
- * @example
79
- * // Direct ability loading without KadiClient
80
- * import { loadAbility } from '@kadi.build/core';
81
- *
82
- * // Load local JavaScript ability
83
- * const mathLib = await loadAbility('math-utils', 'native');
84
- * const result = await mathLib.add({a: 5, b: 3});
85
- *
86
- * @example
87
- * // Load cross-language ability via stdio
88
- * const hashAbility = await loadAbility('hash-go', 'stdio');
89
- * const digest = await hashAbility.digest({text: "hello", algo: "sha256"});
90
- *
91
- * @example
92
- * // Load remote ability via direct broker connection
93
- * const aiAbility = await loadAbility('gpt-analyzer', 'broker', {
94
- * brokerUrl: 'wss://production-broker.company.com',
95
- * networks: ['ai-abilities', 'production']
96
- * });
97
- * const analysis = await aiAbility.analyze({text: "Hello world"});
98
- */
99
- export declare function loadAbility(nameOrPath: string, transportMode?: 'native' | 'stdio' | 'broker', options?: {
100
- brokerUrl?: string;
101
- brokerName?: string;
102
- networks?: string[];
103
- existingClient?: any;
104
- }): Promise<LoadedAbility>;
105
- //# sourceMappingURL=loadAbility.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadAbility.d.ts","sourceRoot":"","sources":["../src/loadAb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,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,GAAG,CAAC;CACjB,GACL,OAAO,CAAC,aAAa,CAAC,CA0LxB"}
@@ -1,370 +0,0 @@
1
- /**
2
- * Load an ability using the specified protocol
3
- *
4
- * Simplified implementation that focuses on the native protocol for now.
5
- * Stdio and broker support can be added back as needed.
6
- */
7
- import path from 'node:path';
8
- import fs from 'node:fs';
9
- import { EventEmitter } from 'events';
10
- import { NativeTransport } from './transports/NativeTransport.js';
11
- import { StdioTransport } from './transports/StdioTransport.js';
12
- import { BrokerTransport } from './transports/BrokerTransport.js';
13
- import { createComponentLogger } from './utils/logger.js';
14
- import { getAbilityJSON, getAbilitiesDir, getAbilityVersionFromArray, getProjectJSON } from './utils/agentUtils.js';
15
- import { KadiError, CoreErrorCodes } from './errors/error-codes.js';
16
- const logger = createComponentLogger('loadAbility');
17
- /**
18
- * Proxy object that provides method access to abilities
19
- */
20
- class AbilityProxy extends EventEmitter {
21
- name;
22
- transport;
23
- events;
24
- constructor(name, transport) {
25
- super();
26
- this.name = name;
27
- this.transport = transport;
28
- // Create events emitter for compatibility with examples
29
- this.events = new EventEmitter();
30
- // Forward events from transport if it supports them
31
- try {
32
- if (transport && typeof transport.on === 'function') {
33
- logger.trace('AbilityProxy', `Setting up transport event listener for ${name}`);
34
- transport.on('event', (eventData) => {
35
- logger.trace('AbilityProxy', `Received event from transport: ${JSON.stringify(eventData)}`);
36
- this.emit('event', eventData);
37
- this.events.emit('event', eventData);
38
- if (eventData.name) {
39
- logger.debug('AbilityProxy', `Emitting specific event: ${eventData.name}`);
40
- this.emit(eventData.name, eventData.data);
41
- this.events.emit(eventData.name, eventData.data);
42
- }
43
- });
44
- }
45
- else {
46
- logger.debug('AbilityProxy', `Transport doesn't support .on() method for ${name}`);
47
- }
48
- }
49
- catch (e) {
50
- // Handler doesn't support events, that's ok
51
- logger.debug('AbilityProxy', `Error setting up event listener for ${name}: ${e}`);
52
- }
53
- }
54
- async __call(method, params) {
55
- return this.transport.invoke(method, params);
56
- }
57
- /**
58
- * Get schema for a specific method (for TypeScript types)
59
- */
60
- __schema(method) {
61
- if ('getMethodSchema' in this.transport &&
62
- typeof this.transport.getMethodSchema === 'function') {
63
- const schema = this.transport.getMethodSchema(method);
64
- if (schema) {
65
- // Convert from handler's format to expected format
66
- return {
67
- inputSchema: schema.input || schema.inputSchema,
68
- outputSchema: schema.output || schema.outputSchema
69
- };
70
- }
71
- }
72
- return undefined;
73
- }
74
- async __disconnect() {
75
- await this.transport.disconnect();
76
- }
77
- /**
78
- * Get list of available tools/methods
79
- */
80
- getTools() {
81
- return this.transport.getMethods();
82
- }
83
- /**
84
- * Discover available methods from the broker (broker protocol only)
85
- */
86
- async __discover(options = {}) {
87
- if ('discoverMethods' in this.transport &&
88
- typeof this.transport.discoverMethods === 'function') {
89
- return this.transport.discoverMethods(options);
90
- }
91
- else {
92
- throw new Error(`Method discovery not supported for ${this.transport.constructor.name} protocol`);
93
- }
94
- }
95
- }
96
- /**
97
- * Resolve ability information from various sources
98
- */
99
- function resolveAbilityInfo(nameOrPath) {
100
- // Check if it's a direct path
101
- if (fs.existsSync(nameOrPath)) {
102
- const stats = fs.statSync(nameOrPath);
103
- if (stats.isDirectory()) {
104
- return {
105
- name: path.basename(nameOrPath),
106
- version: '1.0.0',
107
- dir: nameOrPath,
108
- agentJson: null
109
- };
110
- }
111
- }
112
- // Parse name@version format
113
- const match = nameOrPath.match(/^(.+?)(?:@(.+))?$/);
114
- if (!match) {
115
- throw new KadiError(CoreErrorCodes.CORE_ABILITY_PATH_INVALID.code, `Invalid ability name format: ${nameOrPath}`, {
116
- abilityName: nameOrPath
117
- });
118
- }
119
- const [, name, requestedVersion] = match;
120
- // Look for the ability in standard locations
121
- const abilitiesDir = getAbilitiesDir();
122
- const projectJSON = getProjectJSON();
123
- const abilities = projectJSON?.abilities;
124
- if (abilities && abilities[name]) {
125
- const versions = abilities[name];
126
- // Handle both array and string formats for versions
127
- const version = requestedVersion ||
128
- (Array.isArray(versions)
129
- ? getAbilityVersionFromArray(versions, name)
130
- : typeof versions === 'string'
131
- ? versions
132
- : '1.0.0');
133
- const dir = path.join(abilitiesDir, name, version);
134
- return {
135
- name,
136
- version,
137
- dir,
138
- agentJson: getAbilityJSON(name, version)
139
- };
140
- }
141
- // Check if it exists as a directory in abilities folder
142
- const abilityDir = path.join(abilitiesDir, name);
143
- if (fs.existsSync(abilityDir)) {
144
- return {
145
- name,
146
- version: requestedVersion || '1.0.0',
147
- dir: abilityDir,
148
- agentJson: null
149
- };
150
- }
151
- throw KadiError.abilityNotFound(name);
152
- }
153
- /**
154
- * Load an ability (standalone function)
155
- *
156
- * This is the core ability loading function that does the actual work. It's designed
157
- * as a standalone function for maximum flexibility - you can use it directly without
158
- * needing a KadiClient instance.
159
- *
160
- * Why standalone? This design allows:
161
- * - Simple ability loading without full KadiClient setup
162
- * - Use in lightweight scripts or utilities
163
- * - Direct control over all options without client configuration interference
164
- * - Testing and debugging individual ability loading scenarios
165
- *
166
- * The KadiClient.loadAbility() method is a convenient wrapper that calls this
167
- * function after resolving broker names from the client's configuration.
168
- *
169
- * @param nameOrPath - Which ability to load. Can be:
170
- * - "ability-name" - loads from your installed abilities folder
171
- * - "/absolute/path/to/ability" - loads from a specific directory path
172
- *
173
- * @param transportMode - How to connect to the ability:
174
- * - 'native': Load directly into this process (fastest, JavaScript/TypeScript only)
175
- * - 'stdio': Spawn as child process, communicate via stdin/stdout (any language)
176
- * - 'broker': Connect via broker WebSocket (ability runs anywhere, most flexible)
177
- *
178
- * @param options - Transport-specific configuration:
179
- *
180
- * existingClient: KadiClient instance to reuse (broker protocol only).
181
- * Used internally when called from KadiClient.loadAbility() to reuse connections.
182
- *
183
- * brokerUrl: Direct WebSocket URL (broker protocol only).
184
- * Example: 'ws://localhost:8080', 'wss://broker.company.com'
185
- * Must be provided when using broker protocol without existingClient.
186
- *
187
- * brokerName: Human-readable name for the broker (broker protocol only).
188
- * Used for logging and identification purposes.
189
- *
190
- * spawnAbility: Whether to start the ability process first (broker protocol only).
191
- * - true: Start the ability locally AND connect to it via broker
192
- * - false (default): Just connect to an already-running ability
193
- * Typically false in production where abilities run as separate processes.
194
- *
195
- * networks: Which KADI networks to search for the ability (broker protocol only).
196
- * Example: ['global', 'team-alpha', 'production']
197
- * Networks are like public/private rooms in the broker where clients register
198
- * and discover each other.
199
- * Defaults to ['global'] if not specified.
200
- *
201
- * @returns A proxy object that lets you call the ability's methods directly.
202
- * The proxy automatically handles protocol communication (native imports, stdio JSON-RPC,
203
- * or broker WebSocket messages) and presents a clean JavaScript API.
204
- *
205
- * @example
206
- * // Direct ability loading without KadiClient
207
- * import { loadAbility } from '@kadi.build/core';
208
- *
209
- * // Load local JavaScript ability
210
- * const mathLib = await loadAbility('math-utils', 'native');
211
- * const result = await mathLib.add({a: 5, b: 3});
212
- *
213
- * @example
214
- * // Load cross-language ability via stdio
215
- * const hashAbility = await loadAbility('hash-go', 'stdio');
216
- * const digest = await hashAbility.digest({text: "hello", algo: "sha256"});
217
- *
218
- * @example
219
- * // Load remote ability via direct broker connection
220
- * const aiAbility = await loadAbility('gpt-analyzer', 'broker', {
221
- * brokerUrl: 'wss://production-broker.company.com',
222
- * networks: ['ai-abilities', 'production']
223
- * });
224
- * const analysis = await aiAbility.analyze({text: "Hello world"});
225
- */
226
- export async function loadAbility(nameOrPath, transportMode = 'native', options = {}) {
227
- logger.lifecycle('loadAbility', `Loading ability: ${nameOrPath}`);
228
- if (transportMode !== 'native' &&
229
- transportMode !== 'stdio' &&
230
- transportMode !== 'broker') {
231
- throw new KadiError(CoreErrorCodes.CORE_PROTOCOL_UNSUPPORTED.code, `Transport '${transportMode}' not yet supported. Available: 'native', 'stdio', 'broker'`, {
232
- transport: transportMode,
233
- abilityName: nameOrPath
234
- });
235
- }
236
- // Resolve ability information depending on transport
237
- // For broker, we don't need local files (client-only mode)
238
- let name, version, abilityDir, agentJson;
239
- if (transportMode === 'broker') {
240
- name = nameOrPath;
241
- version = '1.0.0';
242
- abilityDir = null;
243
- agentJson = null;
244
- logger.info('Broker client mode', {
245
- targetAgent: name,
246
- transport: transportMode,
247
- brokerUrl: options.brokerUrl
248
- });
249
- }
250
- else {
251
- const resolved = resolveAbilityInfo(nameOrPath);
252
- name = resolved.name;
253
- version = resolved.version;
254
- abilityDir = resolved.dir;
255
- agentJson = resolved.agentJson;
256
- logger.info('Resolved ability', {
257
- name,
258
- version,
259
- dir: abilityDir,
260
- transport: transportMode
261
- });
262
- }
263
- // Create transport implementation based on the requested mode
264
- let selectedTransport;
265
- if (transportMode === 'native') {
266
- if (!abilityDir) {
267
- throw new KadiError(CoreErrorCodes.CORE_ABILITY_LOAD_FAILED.code, 'Native protocol requires local ability files', {
268
- transport: 'native',
269
- abilityName: name
270
- });
271
- }
272
- selectedTransport = new NativeTransport({
273
- abilityName: name,
274
- abilityVersion: version,
275
- abilityDir
276
- });
277
- }
278
- else if (transportMode === 'stdio') {
279
- if (!abilityDir) {
280
- throw new KadiError(CoreErrorCodes.CORE_ABILITY_LOAD_FAILED.code, 'Stdio protocol requires local ability files', {
281
- transport: 'stdio',
282
- abilityName: name
283
- });
284
- }
285
- const startCmd = agentJson?.scripts?.start;
286
- if (!startCmd) {
287
- throw new KadiError(CoreErrorCodes.CORE_CONFIG_MISSING.code, `Ability '${name}' is missing scripts.start in agent.json for stdio transport`, {
288
- transport: 'stdio',
289
- abilityName: name
290
- });
291
- }
292
- selectedTransport = new StdioTransport({
293
- abilityName: name,
294
- abilityVersion: version,
295
- abilityDir,
296
- startCmd
297
- });
298
- }
299
- else if (transportMode === 'broker') {
300
- // For broker protocol, get broker URL and other settings
301
- const brokerUrl = options.brokerUrl || 'ws://localhost:8080';
302
- // Get networks from options or default
303
- const networks = options.networks || ['global'];
304
- selectedTransport = new BrokerTransport({
305
- targetAgent: name, // The remote agent we want to call
306
- abilityName: name,
307
- abilityVersion: version,
308
- existingClient: options.existingClient, // Reuse existing client if provided
309
- brokerUrl,
310
- brokerName: options.brokerName,
311
- networks
312
- });
313
- }
314
- else {
315
- throw new KadiError(CoreErrorCodes.CORE_PROTOCOL_UNSUPPORTED.code, 'Unsupported transport mode', {
316
- transport: transportMode,
317
- abilityName: name
318
- });
319
- }
320
- // Connect
321
- try {
322
- await selectedTransport.connect();
323
- }
324
- catch (error) {
325
- if (error instanceof KadiError) {
326
- throw error; // Re-throw KadiErrors as-is
327
- }
328
- // For broker protocol, connection errors should be treated
329
- // as broker connection failures
330
- if (transportMode === 'broker') {
331
- throw KadiError.brokerUnavailable(options.brokerUrl || 'ws://localhost:8080', error);
332
- }
333
- // For other protocols, wrap in generic ability load failure
334
- throw KadiError.fromError(error, CoreErrorCodes.CORE_ABILITY_LOAD_FAILED.code, {
335
- transport: transportMode,
336
- abilityName: name,
337
- abilityVersion: version
338
- });
339
- }
340
- logger.info('Loaded ability', name);
341
- // Create and return proxy
342
- const proxy = new AbilityProxy(name, selectedTransport);
343
- // Use a JavaScript Proxy to intercept any method calls and relay them
344
- return new Proxy(proxy, {
345
- get(target, prop, receiver) {
346
- // If the property exists on the target, return it
347
- if (prop in target) {
348
- return Reflect.get(target, prop, receiver);
349
- }
350
- // Avoid being treated as a Promise/thenable
351
- if (prop === 'then')
352
- return undefined;
353
- // If it's a string and looks like a method name, create a method proxy
354
- if (typeof prop === 'string' && !prop.startsWith('_')) {
355
- return async (params) => {
356
- try {
357
- return await target.__call(prop, params);
358
- }
359
- catch (error) {
360
- throw new Error(`Failed to call method '${prop}' on ability '${name}'.\n` +
361
- `Original error: ${error instanceof Error ? error.message : String(error)}\n` +
362
- `Check if the method name is correct.`);
363
- }
364
- };
365
- }
366
- return undefined;
367
- }
368
- });
369
- }
370
- //# sourceMappingURL=loadAbility.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadAbility.js","sourceRoot":"","sources":["../src/loadAbility.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB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C,CAAC;IAExD,sEAAsE;IACtE,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE;QACtB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;YACxB,kDAAkD;YAClD,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;gBACnB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC7C,CAAC;YAED,4CAA4C;YAC5C,IAAI,IAAI,KAAK,MAAM;gBAAE,OAAO,SAAS,CAAC;YAEtC,uEAAuE;YACvE,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtD,OAAO,KAAK,EAAE,MAAW,EAAE,EAAE;oBAC3B,IAAI,CAAC;wBACH,OAAO,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;oBAC3C,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CACb,0BAA0B,IAAI,iBAAiB,IAAI,MAAM;4BACvD,mBAAmB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI;4BAC7E,sCAAsC,CACzC,CAAC;oBACJ,CAAC;gBACH,CAAC,CAAC;YACJ,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,84 +0,0 @@
1
- /**
2
- * TypeScript implementation of Broker message builders
3
- * Replaces the JavaScript BrokerMessageBuilder functionality
4
- */
5
- import { KadiRegisterCapabilitiesParams, KadiCallAbilityParams, KadiHelloParams, KadiAuthenticateParams, KadiAbilityResultParams } from '../types/broker.js';
6
- import { JsonRpcBuilder } from './MessageBuilder.js';
7
- /**
8
- * KADI Protocol message types (from kadi-broker)
9
- */
10
- export declare const KadiMessages: {
11
- readonly SESSION_HELLO: "kadi.session.hello";
12
- readonly SESSION_AUTHENTICATE: "kadi.session.authenticate";
13
- readonly SESSION_PING: "kadi.session.ping";
14
- readonly SESSION_GOODBYE: "kadi.session.goodbye";
15
- readonly AGENT_REGISTER: "kadi.agent.register";
16
- readonly AGENT_UPDATE: "kadi.agent.update";
17
- readonly AGENT_UNREGISTER: "kadi.agent.unregister";
18
- readonly ABILITY_INVOKE: "kadi.ability.invoke";
19
- readonly ABILITY_RESULT: "kadi.ability.result";
20
- readonly ABILITY_QUEUED: "kadi.ability.queued";
21
- readonly ABILITY_CANCEL: "kadi.ability.cancel";
22
- readonly ABILITY_LIST: "kadi.ability.list";
23
- readonly EVENT_SUBSCRIBE: "kadi.event.subscribe";
24
- readonly EVENT_UNSUBSCRIBE: "kadi.event.unsubscribe";
25
- readonly EVENT_PUBLISH: "kadi.event.publish";
26
- readonly EVENT_DELIVERY: "kadi.event.delivery";
27
- readonly EVENT_LIST: "kadi.event.list";
28
- readonly OBSERVE_SUBSCRIBE: "kadi.observe.subscribe";
29
- readonly OBSERVE_SNAPSHOT: "kadi.observe.snapshot";
30
- readonly OBSERVE_EVENT: "kadi.observe.event";
31
- readonly ERROR: "kadi.error";
32
- };
33
- /**
34
- * Broker message builder for KADI protocol messages
35
- */
36
- export declare class BrokerMessageBuilder {
37
- /**
38
- * Create hello message
39
- */
40
- static hello(params: KadiHelloParams): JsonRpcBuilder;
41
- /**
42
- * Create authenticate message
43
- */
44
- static authenticate(params: KadiAuthenticateParams): JsonRpcBuilder;
45
- /**
46
- * Create registerCapabilities message (maps to AGENT_REGISTER)
47
- */
48
- static registerCapabilities(params: KadiRegisterCapabilitiesParams): JsonRpcBuilder;
49
- /**
50
- * Create ping notification
51
- */
52
- static ping(): JsonRpcBuilder;
53
- /**
54
- * Create listTools message (maps to ABILITY_LIST)
55
- */
56
- static listTools(): JsonRpcBuilder;
57
- /**
58
- * Create callAbility message (maps to ABILITY_INVOKE)
59
- */
60
- static callAbility(params: KadiCallAbilityParams): JsonRpcBuilder;
61
- /**
62
- * Create abilityResult message
63
- */
64
- static abilityResult(params: KadiAbilityResultParams): JsonRpcBuilder;
65
- /**
66
- * Create agent register message (modern API)
67
- */
68
- static agentRegister(params: KadiRegisterCapabilitiesParams): JsonRpcBuilder;
69
- /**
70
- * Create ability invoke message (modern API)
71
- */
72
- static abilityInvoke(params: KadiCallAbilityParams): JsonRpcBuilder;
73
- /**
74
- * Create ability list message (modern API)
75
- */
76
- static abilityList(): JsonRpcBuilder;
77
- /**
78
- * Create session goodbye message
79
- */
80
- static goodbye(): JsonRpcBuilder;
81
- }
82
- export declare const Broker: typeof BrokerMessageBuilder;
83
- export { IdFactory, JsonRpcBuilder } from './MessageBuilder.js';
84
- //# sourceMappingURL=BrokerMessages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BrokerMessages.d.ts","sourceRoot":"","sources":["../../src/messages/BrokerMessages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;CAiCf,CAAC;AAeX;;GAEG;AACH,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,GAAG,cAAc;IAIrD;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,sBAAsB,GAAG,cAAc;IAInE;;OAEG;IACH,MAAM,CAAC,oBAAoB,CACzB,MAAM,EAAE,8BAA8B,GACrC,cAAc;IAIjB;;OAEG;IACH,MAAM,CAAC,IAAI,IAAI,cAAc;IAI7B;;OAEG;IACH,MAAM,CAAC,SAAS,IAAI,cAAc;IAIlC;;OAEG;IACH,MAAM,CAAC,W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