@kadi.build/core 0.0.1-alpha.10 → 0.0.1-alpha.12
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 +269 -1311
- package/dist/abilities/AbilityLoader.d.ts +26 -0
- package/dist/abilities/AbilityLoader.d.ts.map +1 -1
- package/dist/abilities/AbilityLoader.js +141 -18
- package/dist/abilities/AbilityLoader.js.map +1 -1
- package/dist/abilities/AbilityProxy.d.ts +33 -0
- package/dist/abilities/AbilityProxy.d.ts.map +1 -1
- package/dist/abilities/AbilityProxy.js +40 -0
- package/dist/abilities/AbilityProxy.js.map +1 -1
- package/dist/abilities/index.d.ts +1 -1
- package/dist/abilities/index.d.ts.map +1 -1
- package/dist/abilities/types.d.ts +67 -0
- package/dist/abilities/types.d.ts.map +1 -1
- package/dist/broker/BrokerProtocol.js +11 -11
- package/dist/broker/BrokerProtocol.js.map +1 -1
- package/dist/client/KadiClient.d.ts +191 -2
- package/dist/client/KadiClient.d.ts.map +1 -1
- package/dist/client/KadiClient.js +412 -2
- package/dist/client/KadiClient.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/messages/index.d.ts +1 -1
- package/dist/messages/index.js +1 -1
- package/dist/messages/index.js.map +1 -1
- package/dist/schemas/index.d.ts +3 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/zod-helpers.d.ts +129 -0
- package/dist/schemas/zod-helpers.d.ts.map +1 -0
- package/dist/schemas/zod-helpers.js +225 -0
- package/dist/schemas/zod-helpers.js.map +1 -0
- package/dist/schemas/zod-to-json-schema.d.ts +159 -0
- package/dist/schemas/zod-to-json-schema.d.ts.map +1 -0
- package/dist/schemas/zod-to-json-schema.js +154 -0
- package/dist/schemas/zod-to-json-schema.js.map +1 -0
- package/dist/transports/NativeTransport.d.ts +29 -0
- package/dist/transports/NativeTransport.d.ts.map +1 -1
- package/dist/transports/NativeTransport.js +98 -3
- package/dist/transports/NativeTransport.js.map +1 -1
- package/dist/transports/StdioTransport.d.ts +141 -63
- package/dist/transports/StdioTransport.d.ts.map +1 -1
- package/dist/transports/StdioTransport.js +309 -232
- package/dist/transports/StdioTransport.js.map +1 -1
- package/dist/types/broker.d.ts +0 -22
- package/dist/types/broker.d.ts.map +1 -1
- package/dist/types/broker.js +0 -27
- package/dist/types/broker.js.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/zod-tools.d.ts +198 -0
- package/dist/types/zod-tools.d.ts.map +1 -0
- package/dist/types/zod-tools.js +14 -0
- package/dist/types/zod-tools.js.map +1 -0
- package/dist/utils/LockfileResolver.d.ts +108 -0
- package/dist/utils/LockfileResolver.d.ts.map +1 -0
- package/dist/utils/LockfileResolver.js +230 -0
- package/dist/utils/LockfileResolver.js.map +1 -0
- package/dist/utils/StdioMessageReader.d.ts +122 -0
- package/dist/utils/StdioMessageReader.d.ts.map +1 -0
- package/dist/utils/StdioMessageReader.js +209 -0
- package/dist/utils/StdioMessageReader.js.map +1 -0
- package/dist/utils/StdioMessageWriter.d.ts +104 -0
- package/dist/utils/StdioMessageWriter.d.ts.map +1 -0
- package/dist/utils/StdioMessageWriter.js +162 -0
- package/dist/utils/StdioMessageWriter.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod to JSON Schema Conversion Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for converting Zod schemas to MCP-compliant
|
|
5
|
+
* JSON Schema. The conversion ensures that all generated schemas meet the
|
|
6
|
+
* requirements of the Model Context Protocol (MCP):
|
|
7
|
+
* - Root schemas must be type 'object'
|
|
8
|
+
* - All schemas must be valid JSON Schema Draft 7
|
|
9
|
+
* - No unsupported features (e.g., recursive types, transforms)
|
|
10
|
+
*
|
|
11
|
+
* @module schemas/zod-to-json-schema
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
/**
|
|
15
|
+
* JSON Schema object type
|
|
16
|
+
*
|
|
17
|
+
* Represents a JSON Schema (Draft 7) object. We use a permissive type here
|
|
18
|
+
* since JSON Schema structure is flexible and validated at runtime by AJV.
|
|
19
|
+
*/
|
|
20
|
+
export type JSONSchema = {
|
|
21
|
+
type: string;
|
|
22
|
+
properties?: Record<string, unknown>;
|
|
23
|
+
required?: string[];
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Options for Zod to JSON Schema conversion
|
|
28
|
+
*
|
|
29
|
+
* These options control how the conversion happens and what features are enabled.
|
|
30
|
+
*/
|
|
31
|
+
export interface ZodToJsonSchemaOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Schema name for $ref resolution
|
|
34
|
+
*
|
|
35
|
+
* If provided, the schema will use this name in $ref definitions.
|
|
36
|
+
* If not provided, $ref will be inlined (recommended for simplicity).
|
|
37
|
+
*
|
|
38
|
+
* @default undefined (inlines all $refs)
|
|
39
|
+
*/
|
|
40
|
+
name?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Include schema $id field
|
|
43
|
+
*
|
|
44
|
+
* If true, adds a $id field to the root schema for identification.
|
|
45
|
+
*
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
includeId?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Target JSON Schema version
|
|
51
|
+
*
|
|
52
|
+
* Specifies which JSON Schema draft to target.
|
|
53
|
+
*
|
|
54
|
+
* @default 'draft-7' (most compatible)
|
|
55
|
+
*/
|
|
56
|
+
target?: 'draft-4' | 'draft-7' | 'draft-2020-12' | 'openapi-3.0';
|
|
57
|
+
/**
|
|
58
|
+
* Enable strict mode
|
|
59
|
+
*
|
|
60
|
+
* If true, throws errors for Zod features that can't be fully represented
|
|
61
|
+
* in JSON Schema (e.g., transforms, refinements).
|
|
62
|
+
*
|
|
63
|
+
* @default false (converts best-effort)
|
|
64
|
+
*/
|
|
65
|
+
strict?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Convert Zod schema to MCP-compliant JSON Schema
|
|
69
|
+
*
|
|
70
|
+
* This function converts a Zod schema to JSON Schema format that complies with
|
|
71
|
+
* the Model Context Protocol (MCP) requirements:
|
|
72
|
+
* - Root schema must be type 'object'
|
|
73
|
+
* - No transforms or refinements (validation only)
|
|
74
|
+
* - Valid JSON Schema Draft 7
|
|
75
|
+
*
|
|
76
|
+
* The conversion preserves:
|
|
77
|
+
* - Type information (string, number, boolean, etc.)
|
|
78
|
+
* - Descriptions (from .describe())
|
|
79
|
+
* - Required/optional fields
|
|
80
|
+
* - Default values (from .default())
|
|
81
|
+
* - Enums (from z.enum())
|
|
82
|
+
* - Array items
|
|
83
|
+
* - Nested objects
|
|
84
|
+
*
|
|
85
|
+
* @param zodSchema - Zod schema to convert
|
|
86
|
+
* @param options - Conversion options
|
|
87
|
+
* @returns MCP-compliant JSON Schema
|
|
88
|
+
* @throws {KadiError} If schema is not an object type (MCP requirement)
|
|
89
|
+
* @throws {KadiError} If conversion fails
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* import { z } from 'zod';
|
|
94
|
+
*
|
|
95
|
+
* const schema = z.object({
|
|
96
|
+
* name: z.string().describe('User name'),
|
|
97
|
+
* age: z.number().int().positive().optional()
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* const jsonSchema = zodToJsonSchema(schema);
|
|
101
|
+
* // Result:
|
|
102
|
+
* // {
|
|
103
|
+
* // type: 'object',
|
|
104
|
+
* // properties: {
|
|
105
|
+
* // name: { type: 'string', description: 'User name' },
|
|
106
|
+
* // age: { type: 'integer', minimum: 0 }
|
|
107
|
+
* // },
|
|
108
|
+
* // required: ['name']
|
|
109
|
+
* // }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare function zodToJsonSchema(zodSchema: z.ZodTypeAny, options?: ZodToJsonSchemaOptions): JSONSchema;
|
|
113
|
+
/**
|
|
114
|
+
* Validate that a Zod schema can be converted to MCP-compliant JSON Schema
|
|
115
|
+
*
|
|
116
|
+
* This function checks whether a Zod schema can be successfully converted
|
|
117
|
+
* to JSON Schema without losing validation semantics. It's useful for
|
|
118
|
+
* providing early feedback to developers.
|
|
119
|
+
*
|
|
120
|
+
* Checks performed:
|
|
121
|
+
* - Schema is a Zod object type
|
|
122
|
+
* - No unsupported features (transforms, refinements with custom logic)
|
|
123
|
+
* - Can be converted to valid JSON Schema
|
|
124
|
+
*
|
|
125
|
+
* @param zodSchema - Zod schema to validate
|
|
126
|
+
* @returns Object with validation result and error message if invalid
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const schema = z.object({ name: z.string() });
|
|
131
|
+
* const result = validateZodSchema(schema);
|
|
132
|
+
*
|
|
133
|
+
* if (!result.valid) {
|
|
134
|
+
* console.error('Invalid schema:', result.error);
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export declare function validateZodSchema(zodSchema: z.ZodTypeAny): {
|
|
139
|
+
valid: boolean;
|
|
140
|
+
error?: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Check if a value is a Zod schema
|
|
144
|
+
*
|
|
145
|
+
* Type guard to determine if a value is a Zod schema. Useful for
|
|
146
|
+
* runtime detection of schema type.
|
|
147
|
+
*
|
|
148
|
+
* @param value - Value to check
|
|
149
|
+
* @returns True if value is a Zod schema, false otherwise
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* if (isZodSchema(value)) {
|
|
154
|
+
* const jsonSchema = zodToJsonSchema(value);
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export declare function isZodSchema(value: unknown): value is z.ZodTypeAny;
|
|
159
|
+
//# sourceMappingURL=zod-to-json-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-to-json-schema.d.ts","sourceRoot":"","sources":["../../src/schemas/zod-to-json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe,GAAG,aAAa,CAAC;IAEjE;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,CAAC,CAAC,UAAU,EACvB,OAAO,GAAE,sBAA2B,GACnC,UAAU,CA8CZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,CAAC,CAAC,UAAU,GACtB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAepC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,UAAU,CAOjE"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod to JSON Schema Conversion Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for converting Zod schemas to MCP-compliant
|
|
5
|
+
* JSON Schema. The conversion ensures that all generated schemas meet the
|
|
6
|
+
* requirements of the Model Context Protocol (MCP):
|
|
7
|
+
* - Root schemas must be type 'object'
|
|
8
|
+
* - All schemas must be valid JSON Schema Draft 7
|
|
9
|
+
* - No unsupported features (e.g., recursive types, transforms)
|
|
10
|
+
*
|
|
11
|
+
* @module schemas/zod-to-json-schema
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import { KadiError, ErrorCode } from '../errors/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* Convert Zod schema to MCP-compliant JSON Schema
|
|
17
|
+
*
|
|
18
|
+
* This function converts a Zod schema to JSON Schema format that complies with
|
|
19
|
+
* the Model Context Protocol (MCP) requirements:
|
|
20
|
+
* - Root schema must be type 'object'
|
|
21
|
+
* - No transforms or refinements (validation only)
|
|
22
|
+
* - Valid JSON Schema Draft 7
|
|
23
|
+
*
|
|
24
|
+
* The conversion preserves:
|
|
25
|
+
* - Type information (string, number, boolean, etc.)
|
|
26
|
+
* - Descriptions (from .describe())
|
|
27
|
+
* - Required/optional fields
|
|
28
|
+
* - Default values (from .default())
|
|
29
|
+
* - Enums (from z.enum())
|
|
30
|
+
* - Array items
|
|
31
|
+
* - Nested objects
|
|
32
|
+
*
|
|
33
|
+
* @param zodSchema - Zod schema to convert
|
|
34
|
+
* @param options - Conversion options
|
|
35
|
+
* @returns MCP-compliant JSON Schema
|
|
36
|
+
* @throws {KadiError} If schema is not an object type (MCP requirement)
|
|
37
|
+
* @throws {KadiError} If conversion fails
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { z } from 'zod';
|
|
42
|
+
*
|
|
43
|
+
* const schema = z.object({
|
|
44
|
+
* name: z.string().describe('User name'),
|
|
45
|
+
* age: z.number().int().positive().optional()
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* const jsonSchema = zodToJsonSchema(schema);
|
|
49
|
+
* // Result:
|
|
50
|
+
* // {
|
|
51
|
+
* // type: 'object',
|
|
52
|
+
* // properties: {
|
|
53
|
+
* // name: { type: 'string', description: 'User name' },
|
|
54
|
+
* // age: { type: 'integer', minimum: 0 }
|
|
55
|
+
* // },
|
|
56
|
+
* // required: ['name']
|
|
57
|
+
* // }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export function zodToJsonSchema(zodSchema, options = {}) {
|
|
61
|
+
try {
|
|
62
|
+
// Set default options for Zod 4's native toJSONSchema
|
|
63
|
+
const opts = {
|
|
64
|
+
target: options.target || 'draft-7',
|
|
65
|
+
unrepresentable: 'any', // Convert unsupported types to any
|
|
66
|
+
cycles: 'ref', // Use $ref for circular references
|
|
67
|
+
reused: 'inline' // Inline reused schemas
|
|
68
|
+
};
|
|
69
|
+
// Convert Zod schema to JSON Schema using Zod 4's native function
|
|
70
|
+
const jsonSchema = z.toJSONSchema(zodSchema, opts);
|
|
71
|
+
// MCP Requirement: Root schema must be type 'object'
|
|
72
|
+
if (jsonSchema.type !== 'object') {
|
|
73
|
+
throw new KadiError(`MCP requires schemas to be type 'object', got type '${jsonSchema.type}'. ` +
|
|
74
|
+
`Wrap your schema in z.object() if needed.`, ErrorCode.SCHEMA_VALIDATION_FAILED, 400, { schemaType: jsonSchema.type });
|
|
75
|
+
}
|
|
76
|
+
// Remove $schema field if present (not needed for MCP)
|
|
77
|
+
if ('$schema' in jsonSchema) {
|
|
78
|
+
delete jsonSchema.$schema;
|
|
79
|
+
}
|
|
80
|
+
return jsonSchema;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
// Re-throw KadiError as-is
|
|
84
|
+
if (error instanceof KadiError) {
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
// Wrap other errors in KadiError
|
|
88
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
89
|
+
throw new KadiError(`Failed to convert Zod schema to JSON Schema: ${errorMessage}`, ErrorCode.SCHEMA_VALIDATION_FAILED, 400, { originalError: error instanceof Error ? error.name : String(error) });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Validate that a Zod schema can be converted to MCP-compliant JSON Schema
|
|
94
|
+
*
|
|
95
|
+
* This function checks whether a Zod schema can be successfully converted
|
|
96
|
+
* to JSON Schema without losing validation semantics. It's useful for
|
|
97
|
+
* providing early feedback to developers.
|
|
98
|
+
*
|
|
99
|
+
* Checks performed:
|
|
100
|
+
* - Schema is a Zod object type
|
|
101
|
+
* - No unsupported features (transforms, refinements with custom logic)
|
|
102
|
+
* - Can be converted to valid JSON Schema
|
|
103
|
+
*
|
|
104
|
+
* @param zodSchema - Zod schema to validate
|
|
105
|
+
* @returns Object with validation result and error message if invalid
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const schema = z.object({ name: z.string() });
|
|
110
|
+
* const result = validateZodSchema(schema);
|
|
111
|
+
*
|
|
112
|
+
* if (!result.valid) {
|
|
113
|
+
* console.error('Invalid schema:', result.error);
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function validateZodSchema(zodSchema) {
|
|
118
|
+
try {
|
|
119
|
+
// Attempt conversion
|
|
120
|
+
zodToJsonSchema(zodSchema);
|
|
121
|
+
// If conversion succeeds, schema is valid
|
|
122
|
+
return { valid: true };
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
// Return validation error
|
|
126
|
+
return {
|
|
127
|
+
valid: false,
|
|
128
|
+
error: error instanceof Error ? error.message : String(error)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Check if a value is a Zod schema
|
|
134
|
+
*
|
|
135
|
+
* Type guard to determine if a value is a Zod schema. Useful for
|
|
136
|
+
* runtime detection of schema type.
|
|
137
|
+
*
|
|
138
|
+
* @param value - Value to check
|
|
139
|
+
* @returns True if value is a Zod schema, false otherwise
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* if (isZodSchema(value)) {
|
|
144
|
+
* const jsonSchema = zodToJsonSchema(value);
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export function isZodSchema(value) {
|
|
149
|
+
return (value !== null &&
|
|
150
|
+
typeof value === 'object' &&
|
|
151
|
+
'_def' in value &&
|
|
152
|
+
typeof value._def === 'object');
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=zod-to-json-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-to-json-schema.js","sourceRoot":"","sources":["../../src/schemas/zod-to-json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA4D1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAuB,EACvB,UAAkC,EAAE;IAEpC,IAAI,CAAC;QACH,sDAAsD;QACtD,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,OAAO,CAAC,MAAM,IAAK,SAAmB;YAC9C,eAAe,EAAE,KAAc,EAAE,mCAAmC;YACpE,MAAM,EAAE,KAAc,EAAY,mCAAmC;YACrE,MAAM,EAAE,QAAiB,CAAS,wBAAwB;SAC3D,CAAC;QAEF,kEAAkE;QAClE,MAAM,UAAU,GAAG,CAAC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A0B;QAC1B,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,CACL,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,IAAI,KAAK;QACf,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,CACvD,CAAC;AACJ,CAAC"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { EventEmitter } from 'events';
|
|
10
10
|
import type { AbilityTransport, NativeTransportOptions, MethodSchema } from '../types/index.js';
|
|
11
|
+
import type { AgentJson } from '../abilities/types.js';
|
|
11
12
|
/**
|
|
12
13
|
* Native Transport
|
|
13
14
|
*
|
|
@@ -36,6 +37,10 @@ export declare class NativeTransport extends EventEmitter implements AbilityTran
|
|
|
36
37
|
* Loaded ability module
|
|
37
38
|
*/
|
|
38
39
|
private ability;
|
|
40
|
+
/**
|
|
41
|
+
* Whether loaded module is a KadiClient instance
|
|
42
|
+
*/
|
|
43
|
+
private isKadiClientInstance;
|
|
39
44
|
/**
|
|
40
45
|
* Discovered methods
|
|
41
46
|
*/
|
|
@@ -115,6 +120,30 @@ export declare class NativeTransport extends EventEmitter implements AbilityTran
|
|
|
115
120
|
* ```
|
|
116
121
|
*/
|
|
117
122
|
getMethodSchema(method: string): MethodSchema | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Read agent.json representation (only for KadiClient instances)
|
|
125
|
+
*
|
|
126
|
+
* Returns the agent.json representation from KadiClient.readAgentJson() if
|
|
127
|
+
* the loaded module is a KadiClient instance. Returns undefined for legacy modules.
|
|
128
|
+
*
|
|
129
|
+
* **What this returns:**
|
|
130
|
+
* - Runtime representation of the ability's agent.json file
|
|
131
|
+
* - Contains name, version, description, and tools (mapped from agent.json's 'exports')
|
|
132
|
+
* - Used for type generation during `kadi install`
|
|
133
|
+
*
|
|
134
|
+
* @returns agent.json representation or undefined
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const agentJson = transport.readAgentJson();
|
|
139
|
+
* if (agentJson) {
|
|
140
|
+
* console.log('Ability:', agentJson.name, agentJson.version);
|
|
141
|
+
* console.log('Tools:', agentJson.tools.map(t => t.name));
|
|
142
|
+
* // This represents what's in the ability's agent.json file
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
readAgentJson(): AgentJson | undefined;
|
|
118
147
|
/**
|
|
119
148
|
* Disconnect from the ability
|
|
120
149
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTransport.d.ts","sourceRoot":"","sources":["../../src/transports/NativeTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACb,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeTransport.d.ts","sourceRoot":"","sources":["../../src/transports/NativeTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAiDvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAgB,SAAQ,YAAa,YAAW,gBAAgB;IAC3E;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;IAE3D;;OAEG;IACH,OAAO,CAAC,OAAO,CAAiB;IAEhC;;OAEG;IACH,OAAO,CAAC,oBAAoB,CAAS;IAErC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAgB;IAE/B;;OAEG;IACH,OAAO,CAAC,OAAO,CAAmC;IAElD;;OAEG;IACH,OAAO,CAAC,SAAS,CAAS;IAE1B;;;;OAIG;gBACS,OAAO,EAAE,sBAAsB;IAW3C;;;;;;;;;;;OAWG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAqE9B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EAC9C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC;IA+FnB;;;;;;;;;;OAUG;IACH,UAAU,IAAI,MAAM,EAAE;IAItB;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIzD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAAa,IAAI,SAAS,GAAG,SAAS;IAQtC;;;;;;;;;OASG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAcjC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;IASpD;;;;;OAKG;YACW,eAAe;CA6D9B"}
|
|
@@ -9,6 +9,36 @@
|
|
|
9
9
|
import { EventEmitter } from 'events';
|
|
10
10
|
import { resolve } from 'path';
|
|
11
11
|
import { KadiError, ErrorCode } from '../types/index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Type guard to check if loaded module is a KadiClient instance
|
|
14
|
+
*
|
|
15
|
+
* Detection strategy:
|
|
16
|
+
* - Has readAgentJson() method (returns agent.json representation with tools)
|
|
17
|
+
* - Has invoke() method (executes tools by name)
|
|
18
|
+
*
|
|
19
|
+
* This identifies abilities written using the Registration Pattern (Option A),
|
|
20
|
+
* where the ability has an agent.json file and uses KadiClient.registerTool().
|
|
21
|
+
*
|
|
22
|
+
* @param obj - Object to check
|
|
23
|
+
* @returns True if object is a KadiClient instance
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const module = await import('./ability.js');
|
|
28
|
+
* if (isKadiClient(module.default)) {
|
|
29
|
+
* const agentJson = module.default.readAgentJson();
|
|
30
|
+
* // { name: 'calculator', tools: [...] }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
function isKadiClient(obj) {
|
|
35
|
+
return (obj !== null &&
|
|
36
|
+
typeof obj === 'object' &&
|
|
37
|
+
'readAgentJson' in obj &&
|
|
38
|
+
typeof obj.readAgentJson === 'function' &&
|
|
39
|
+
'invoke' in obj &&
|
|
40
|
+
typeof obj.invoke === 'function');
|
|
41
|
+
}
|
|
12
42
|
/**
|
|
13
43
|
* Native Transport
|
|
14
44
|
*
|
|
@@ -37,6 +67,10 @@ export class NativeTransport extends EventEmitter {
|
|
|
37
67
|
* Loaded ability module
|
|
38
68
|
*/
|
|
39
69
|
ability = null;
|
|
70
|
+
/**
|
|
71
|
+
* Whether loaded module is a KadiClient instance
|
|
72
|
+
*/
|
|
73
|
+
isKadiClientInstance = false;
|
|
40
74
|
/**
|
|
41
75
|
* Discovered methods
|
|
42
76
|
*/
|
|
@@ -90,8 +124,27 @@ export class NativeTransport extends EventEmitter {
|
|
|
90
124
|
if (!this.ability || typeof this.ability !== 'object') {
|
|
91
125
|
throw new KadiError(`Ability module must export an object or class instance`, ErrorCode.ABILITY_LOAD_FAILED, 500, { abilityName: this.options.abilityName, modulePath });
|
|
92
126
|
}
|
|
93
|
-
//
|
|
94
|
-
|
|
127
|
+
// Check if it's a KadiClient instance (Registration Pattern - Option A)
|
|
128
|
+
this.isKadiClientInstance = isKadiClient(this.ability);
|
|
129
|
+
if (this.isKadiClientInstance) {
|
|
130
|
+
// KadiClient instance - read agent.json representation
|
|
131
|
+
const agentJson = this.ability.readAgentJson();
|
|
132
|
+
this.methods = agentJson.tools.map(tool => tool.name);
|
|
133
|
+
// Store schemas from tool definitions (agent.json's 'exports' → runtime 'tools')
|
|
134
|
+
for (const tool of agentJson.tools) {
|
|
135
|
+
if (tool.inputSchema || tool.outputSchema) {
|
|
136
|
+
this.schemas.set(tool.name, {
|
|
137
|
+
inputSchema: tool.inputSchema,
|
|
138
|
+
outputSchema: tool.outputSchema,
|
|
139
|
+
description: tool.description
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
// Legacy module - use introspection
|
|
146
|
+
await this.discoverMethods();
|
|
147
|
+
}
|
|
95
148
|
this.connected = true;
|
|
96
149
|
this.emit('connected');
|
|
97
150
|
}
|
|
@@ -136,7 +189,20 @@ export class NativeTransport extends EventEmitter {
|
|
|
136
189
|
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 });
|
|
137
190
|
}
|
|
138
191
|
try {
|
|
139
|
-
//
|
|
192
|
+
// KadiClient instance - use agent.json protocol (invoke by name)
|
|
193
|
+
if (this.isKadiClientInstance) {
|
|
194
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
195
|
+
setTimeout(() => {
|
|
196
|
+
reject(new KadiError(`Method invocation timeout after ${this.options.timeout}ms`, ErrorCode.TOOL_TIMEOUT, 408, { abilityName: this.options.abilityName, method, timeout: this.options.timeout }));
|
|
197
|
+
}, this.options.timeout);
|
|
198
|
+
});
|
|
199
|
+
const result = await Promise.race([
|
|
200
|
+
this.ability.invoke(method, params),
|
|
201
|
+
timeoutPromise
|
|
202
|
+
]);
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
// Legacy module - use direct method access
|
|
140
206
|
const handler = this.ability[method];
|
|
141
207
|
if (typeof handler !== 'function') {
|
|
142
208
|
throw new KadiError(`Method '${method}' is not a function`, ErrorCode.ABILITY_METHOD_NOT_FOUND, 500, { abilityName: this.options.abilityName, method, type: typeof handler });
|
|
@@ -198,6 +264,35 @@ export class NativeTransport extends EventEmitter {
|
|
|
198
264
|
getMethodSchema(method) {
|
|
199
265
|
return this.schemas.get(method);
|
|
200
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* Read agent.json representation (only for KadiClient instances)
|
|
269
|
+
*
|
|
270
|
+
* Returns the agent.json representation from KadiClient.readAgentJson() if
|
|
271
|
+
* the loaded module is a KadiClient instance. Returns undefined for legacy modules.
|
|
272
|
+
*
|
|
273
|
+
* **What this returns:**
|
|
274
|
+
* - Runtime representation of the ability's agent.json file
|
|
275
|
+
* - Contains name, version, description, and tools (mapped from agent.json's 'exports')
|
|
276
|
+
* - Used for type generation during `kadi install`
|
|
277
|
+
*
|
|
278
|
+
* @returns agent.json representation or undefined
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* const agentJson = transport.readAgentJson();
|
|
283
|
+
* if (agentJson) {
|
|
284
|
+
* console.log('Ability:', agentJson.name, agentJson.version);
|
|
285
|
+
* console.log('Tools:', agentJson.tools.map(t => t.name));
|
|
286
|
+
* // This represents what's in the ability's agent.json file
|
|
287
|
+
* }
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
readAgentJson() {
|
|
291
|
+
if (!this.isKadiClientInstance || !this.ability) {
|
|
292
|
+
return undefined;
|
|
293
|
+
}
|
|
294
|
+
return this.ability.readAgentJson();
|
|
295
|
+
}
|
|
201
296
|
/**
|
|
202
297
|
* Disconnect from the ability
|
|
203
298
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTransport.js","sourceRoot":"","sources":["../../src/transports/NativeTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM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