@fatagnus/dink-sdk 2.0.3 → 2.3.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.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Utility functions for working with introspection data.
3
+ * These functions provide formatting, validation, and search capabilities
4
+ * for ServiceDescriptor and MethodDescriptor types.
5
+ */
6
+ import type { ServiceDescriptor, MethodDescriptor } from './introspect.js';
7
+ /**
8
+ * Result of searching for methods across services.
9
+ */
10
+ export interface MethodSearchResult {
11
+ serviceName: string;
12
+ serviceVersion: string;
13
+ method: MethodDescriptor;
14
+ }
15
+ /**
16
+ * Result of validating a request against a schema.
17
+ */
18
+ export interface ValidationResult {
19
+ valid: boolean;
20
+ errors: string[];
21
+ }
22
+ /**
23
+ * Format a ServiceDescriptor as LLM-friendly text (llm.txt format).
24
+ * This format is optimized for AI agent consumption with full documentation.
25
+ */
26
+ export declare function formatAsLLMTxt(descriptor: ServiceDescriptor): string;
27
+ /**
28
+ * Format multiple ServiceDescriptors as a combined llm.txt document.
29
+ */
30
+ export declare function formatMultipleServicesAsLLMTxt(services: ServiceDescriptor[]): string;
31
+ /**
32
+ * Format a ServiceDescriptor in a minimal token format for AI agents.
33
+ * This is optimized for context window efficiency while preserving essential information.
34
+ */
35
+ export declare function formatAsCompactAI(descriptor: ServiceDescriptor): string;
36
+ /**
37
+ * Validate request data against a method's input schema.
38
+ * Returns a ValidationResult with valid=true if no schema or validation passes.
39
+ */
40
+ export declare function validateRequest(method: MethodDescriptor, data: Record<string, unknown>): ValidationResult;
41
+ /**
42
+ * Generate an example request object from a method's input schema.
43
+ * Returns an empty object if no schema is defined.
44
+ */
45
+ export declare function generateExampleRequest(method: MethodDescriptor): Record<string, unknown>;
46
+ /**
47
+ * Search services for methods matching a query.
48
+ * The query is matched case-insensitively against:
49
+ * - Service capabilities
50
+ * - Method names
51
+ * - Method descriptions
52
+ * - Method AI context (when_to_use, why_to_use, how_to_use)
53
+ */
54
+ export declare function findMethodsFor(services: ServiceDescriptor[], query: string): MethodSearchResult[];
55
+ //# sourceMappingURL=introspect-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspect-utils.d.ts","sourceRoot":"","sources":["../src/introspect-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAoHpE;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAUpF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAuCvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAUzG;AAwGD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMxF;AA6CD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAqEjG"}
@@ -0,0 +1,372 @@
1
+ /**
2
+ * Utility functions for working with introspection data.
3
+ * These functions provide formatting, validation, and search capabilities
4
+ * for ServiceDescriptor and MethodDescriptor types.
5
+ */
6
+ /**
7
+ * Format a ServiceDescriptor as LLM-friendly text (llm.txt format).
8
+ * This format is optimized for AI agent consumption with full documentation.
9
+ */
10
+ export function formatAsLLMTxt(descriptor) {
11
+ const lines = [];
12
+ // Header
13
+ lines.push(`# ${descriptor.name} LLM Reference`);
14
+ lines.push('');
15
+ // Description as blockquote
16
+ if (descriptor.description) {
17
+ lines.push(`> ${descriptor.description}`);
18
+ lines.push('');
19
+ }
20
+ // Service AI Context sections
21
+ if (descriptor.ai_context) {
22
+ if (descriptor.ai_context.overview) {
23
+ lines.push('## When to Use This Service');
24
+ lines.push('');
25
+ lines.push(descriptor.ai_context.overview);
26
+ lines.push('');
27
+ }
28
+ if (descriptor.ai_context.capabilities && descriptor.ai_context.capabilities.length > 0) {
29
+ lines.push('## Capabilities');
30
+ lines.push('');
31
+ for (const cap of descriptor.ai_context.capabilities) {
32
+ lines.push(`- ${cap}`);
33
+ }
34
+ lines.push('');
35
+ }
36
+ if (descriptor.ai_context.limitations && descriptor.ai_context.limitations.length > 0) {
37
+ lines.push('## Limitations');
38
+ lines.push('');
39
+ for (const lim of descriptor.ai_context.limitations) {
40
+ lines.push(`- ${lim}`);
41
+ }
42
+ lines.push('');
43
+ }
44
+ }
45
+ // Methods section
46
+ if (descriptor.methods && descriptor.methods.length > 0) {
47
+ lines.push('## Methods');
48
+ lines.push('');
49
+ for (const method of descriptor.methods) {
50
+ lines.push(`### ${method.name}`);
51
+ lines.push('');
52
+ if (method.description) {
53
+ lines.push(method.description);
54
+ lines.push('');
55
+ }
56
+ if (method.ai_context) {
57
+ if (method.ai_context.when_to_use) {
58
+ lines.push(`**When to use:** ${method.ai_context.when_to_use}`);
59
+ lines.push('');
60
+ }
61
+ if (method.ai_context.why_to_use) {
62
+ lines.push(`**Why:** ${method.ai_context.why_to_use}`);
63
+ lines.push('');
64
+ }
65
+ if (method.ai_context.how_to_use) {
66
+ lines.push(`**How:** ${method.ai_context.how_to_use}`);
67
+ lines.push('');
68
+ }
69
+ if (method.ai_context.preconditions && method.ai_context.preconditions.length > 0) {
70
+ lines.push('**Preconditions:**');
71
+ lines.push('');
72
+ for (const pre of method.ai_context.preconditions) {
73
+ lines.push(`- ${pre}`);
74
+ }
75
+ lines.push('');
76
+ }
77
+ if (method.ai_context.side_effects && method.ai_context.side_effects.length > 0) {
78
+ lines.push('**Side Effects:**');
79
+ lines.push('');
80
+ for (const effect of method.ai_context.side_effects) {
81
+ lines.push(`- ${effect}`);
82
+ }
83
+ lines.push('');
84
+ }
85
+ if (method.ai_context.related_methods && method.ai_context.related_methods.length > 0) {
86
+ lines.push(`**Related Methods:** ${method.ai_context.related_methods.join(', ')}`);
87
+ lines.push('');
88
+ }
89
+ }
90
+ if (method.input_schema && Object.keys(method.input_schema).length > 0) {
91
+ lines.push('#### Request Schema');
92
+ lines.push('');
93
+ lines.push('```json');
94
+ lines.push(JSON.stringify(method.input_schema, null, 2));
95
+ lines.push('```');
96
+ lines.push('');
97
+ }
98
+ if (method.output_schema && Object.keys(method.output_schema).length > 0) {
99
+ lines.push('#### Response Schema');
100
+ lines.push('');
101
+ lines.push('```json');
102
+ lines.push(JSON.stringify(method.output_schema, null, 2));
103
+ lines.push('```');
104
+ lines.push('');
105
+ }
106
+ }
107
+ }
108
+ // Related Services
109
+ if (descriptor.related_services && descriptor.related_services.length > 0) {
110
+ lines.push('## Related Services');
111
+ lines.push('');
112
+ for (const svc of descriptor.related_services) {
113
+ lines.push(`- ${svc}`);
114
+ }
115
+ lines.push('');
116
+ }
117
+ return lines.join('\n');
118
+ }
119
+ /**
120
+ * Format multiple ServiceDescriptors as a combined llm.txt document.
121
+ */
122
+ export function formatMultipleServicesAsLLMTxt(services) {
123
+ if (services.length === 0) {
124
+ return '';
125
+ }
126
+ const parts = [];
127
+ for (const svc of services) {
128
+ parts.push(formatAsLLMTxt(svc));
129
+ }
130
+ return parts.join('\n---\n\n');
131
+ }
132
+ /**
133
+ * Format a ServiceDescriptor in a minimal token format for AI agents.
134
+ * This is optimized for context window efficiency while preserving essential information.
135
+ */
136
+ export function formatAsCompactAI(descriptor) {
137
+ const lines = [];
138
+ // Compact header
139
+ let header = `${descriptor.name} v${descriptor.version}`;
140
+ if (descriptor.description) {
141
+ header += ` - ${descriptor.description}`;
142
+ }
143
+ lines.push(header);
144
+ // Compact AI context (one line each)
145
+ if (descriptor.ai_context) {
146
+ if (descriptor.ai_context.overview) {
147
+ lines.push(`Overview: ${descriptor.ai_context.overview}`);
148
+ }
149
+ if (descriptor.ai_context.capabilities && descriptor.ai_context.capabilities.length > 0) {
150
+ lines.push(`Capabilities: ${descriptor.ai_context.capabilities.join(', ')}`);
151
+ }
152
+ if (descriptor.ai_context.limitations && descriptor.ai_context.limitations.length > 0) {
153
+ lines.push(`Limitations: ${descriptor.ai_context.limitations.join(', ')}`);
154
+ }
155
+ }
156
+ // Compact methods list
157
+ if (descriptor.methods && descriptor.methods.length > 0) {
158
+ lines.push('Methods:');
159
+ for (const m of descriptor.methods) {
160
+ let methodLine = ` ${m.name}`;
161
+ if (m.description) {
162
+ methodLine += `: ${m.description}`;
163
+ }
164
+ lines.push(methodLine);
165
+ if (m.ai_context?.when_to_use) {
166
+ lines.push(` When: ${m.ai_context.when_to_use}`);
167
+ }
168
+ }
169
+ }
170
+ return lines.join('\n');
171
+ }
172
+ /**
173
+ * Validate request data against a method's input schema.
174
+ * Returns a ValidationResult with valid=true if no schema or validation passes.
175
+ */
176
+ export function validateRequest(method, data) {
177
+ if (!method.input_schema || Object.keys(method.input_schema).length === 0) {
178
+ return { valid: true, errors: [] };
179
+ }
180
+ const errors = validateAgainstSchema(method.input_schema, data, '');
181
+ return {
182
+ valid: errors.length === 0,
183
+ errors,
184
+ };
185
+ }
186
+ /**
187
+ * Internal function to validate data against a JSON schema.
188
+ */
189
+ function validateAgainstSchema(schema, data, path) {
190
+ const errors = [];
191
+ // Check required fields
192
+ const required = schema.required;
193
+ if (required && Array.isArray(required)) {
194
+ for (const fieldName of required) {
195
+ if (!(fieldName in data)) {
196
+ const fieldPath = path ? `${path}.${fieldName}` : fieldName;
197
+ errors.push(`missing required field: ${fieldPath}`);
198
+ }
199
+ }
200
+ }
201
+ // Check property types
202
+ const props = schema.properties;
203
+ if (props && typeof props === 'object') {
204
+ for (const [fieldName, value] of Object.entries(data)) {
205
+ const propSchema = props[fieldName];
206
+ if (!propSchema) {
207
+ continue;
208
+ }
209
+ const fieldPath = path ? `${path}.${fieldName}` : fieldName;
210
+ const typeErrors = validateType(propSchema, value, fieldPath);
211
+ errors.push(...typeErrors);
212
+ }
213
+ }
214
+ return errors;
215
+ }
216
+ /**
217
+ * Internal function to validate a value against its expected type.
218
+ */
219
+ function validateType(schema, value, path) {
220
+ const errors = [];
221
+ const expectedType = schema.type;
222
+ if (!expectedType) {
223
+ return errors;
224
+ }
225
+ switch (expectedType) {
226
+ case 'string':
227
+ if (typeof value !== 'string') {
228
+ errors.push(`${path}: expected string, got ${typeof value}`);
229
+ }
230
+ break;
231
+ case 'integer':
232
+ if (typeof value !== 'number' || !Number.isInteger(value)) {
233
+ errors.push(`${path}: expected integer, got ${typeof value}`);
234
+ }
235
+ break;
236
+ case 'number':
237
+ if (typeof value !== 'number') {
238
+ errors.push(`${path}: expected number, got ${typeof value}`);
239
+ }
240
+ break;
241
+ case 'boolean':
242
+ if (typeof value !== 'boolean') {
243
+ errors.push(`${path}: expected boolean, got ${typeof value}`);
244
+ }
245
+ break;
246
+ case 'object':
247
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
248
+ const nestedErrors = validateAgainstSchema(schema, value, path);
249
+ errors.push(...nestedErrors);
250
+ }
251
+ else {
252
+ errors.push(`${path}: expected object, got ${typeof value}`);
253
+ }
254
+ break;
255
+ case 'array':
256
+ if (!Array.isArray(value)) {
257
+ errors.push(`${path}: expected array, got ${typeof value}`);
258
+ }
259
+ break;
260
+ }
261
+ return errors;
262
+ }
263
+ /**
264
+ * Generate an example request object from a method's input schema.
265
+ * Returns an empty object if no schema is defined.
266
+ */
267
+ export function generateExampleRequest(method) {
268
+ if (!method.input_schema || Object.keys(method.input_schema).length === 0) {
269
+ return {};
270
+ }
271
+ return generateFromSchema(method.input_schema);
272
+ }
273
+ /**
274
+ * Internal function to generate example data from a JSON schema.
275
+ */
276
+ function generateFromSchema(schema) {
277
+ const schemaType = schema.type;
278
+ switch (schemaType) {
279
+ case 'object': {
280
+ const result = {};
281
+ const props = schema.properties;
282
+ if (props && typeof props === 'object') {
283
+ for (const [name, propSchema] of Object.entries(props)) {
284
+ result[name] = generateFromSchema(propSchema);
285
+ }
286
+ }
287
+ return result;
288
+ }
289
+ case 'array': {
290
+ const items = schema.items;
291
+ if (items) {
292
+ return [generateFromSchema(items)];
293
+ }
294
+ return [];
295
+ }
296
+ case 'string':
297
+ return 'example';
298
+ case 'integer':
299
+ return 0;
300
+ case 'number':
301
+ return 0.0;
302
+ case 'boolean':
303
+ return false;
304
+ default:
305
+ return null;
306
+ }
307
+ }
308
+ /**
309
+ * Search services for methods matching a query.
310
+ * The query is matched case-insensitively against:
311
+ * - Service capabilities
312
+ * - Method names
313
+ * - Method descriptions
314
+ * - Method AI context (when_to_use, why_to_use, how_to_use)
315
+ */
316
+ export function findMethodsFor(services, query) {
317
+ if (!query) {
318
+ return [];
319
+ }
320
+ const lowerQuery = query.toLowerCase();
321
+ const results = [];
322
+ for (const svc of services) {
323
+ // Check if service capabilities match
324
+ let serviceMatches = false;
325
+ if (svc.ai_context?.capabilities) {
326
+ for (const cap of svc.ai_context.capabilities) {
327
+ if (cap.toLowerCase().includes(lowerQuery)) {
328
+ serviceMatches = true;
329
+ break;
330
+ }
331
+ }
332
+ }
333
+ if (!svc.methods) {
334
+ continue;
335
+ }
336
+ for (const method of svc.methods) {
337
+ let methodMatches = false;
338
+ // If service capability matches, check if method relates to that capability
339
+ if (serviceMatches) {
340
+ if (method.name.toLowerCase().includes(lowerQuery) ||
341
+ (method.description?.toLowerCase().includes(lowerQuery) ?? false)) {
342
+ methodMatches = true;
343
+ }
344
+ }
345
+ // Check method name
346
+ if (method.name.toLowerCase().includes(lowerQuery)) {
347
+ methodMatches = true;
348
+ }
349
+ // Check method description
350
+ if (method.description?.toLowerCase().includes(lowerQuery)) {
351
+ methodMatches = true;
352
+ }
353
+ // Check method AI context
354
+ if (method.ai_context) {
355
+ if (method.ai_context.when_to_use?.toLowerCase().includes(lowerQuery) ||
356
+ method.ai_context.why_to_use?.toLowerCase().includes(lowerQuery) ||
357
+ method.ai_context.how_to_use?.toLowerCase().includes(lowerQuery)) {
358
+ methodMatches = true;
359
+ }
360
+ }
361
+ if (methodMatches) {
362
+ results.push({
363
+ serviceName: svc.name,
364
+ serviceVersion: svc.version,
365
+ method,
366
+ });
367
+ }
368
+ }
369
+ }
370
+ return results;
371
+ }
372
+ //# sourceMappingURL=introspect-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspect-utils.js","sourceRoot":"","sources":["../src/introspect-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,UAA6B;IAC1D,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,SAAS;IACT,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,IAAI,gBAAgB,CAAC,CAAC;IACjD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,4BAA4B;IAC5B,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,8BAA8B;IAC9B,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;QAC1B,IAAI,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YACnC,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC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types match the Go struct definitions in pkg/types/introspect.go
4
+ * Property names use snake_case to match Go JSON tags for wire compatibility.
5
+ */
6
+ /**
7
+ * CodeExample provides a code sample in a specific language.
8
+ */
9
+ export interface CodeExample {
10
+ /** Programming language of the example (e.g., 'typescript', 'go', 'python') */
11
+ language: string;
12
+ /** The code snippet */
13
+ code: string;
14
+ /** Optional description of what the example demonstrates */
15
+ description?: string;
16
+ }
17
+ /**
18
+ * MethodAIContext provides AI-specific guidance for understanding and using a method.
19
+ */
20
+ export interface MethodAIContext {
21
+ /** When this method should be called */
22
+ when_to_use?: string;
23
+ /** Why to use this method over alternatives */
24
+ why_to_use?: string;
25
+ /** Instructions on how to use this method correctly */
26
+ how_to_use?: string;
27
+ /** Conditions that must be true before calling this method */
28
+ preconditions?: string[];
29
+ /** Side effects that occur when calling this method */
30
+ side_effects?: string[];
31
+ /** Names of related methods that may be useful */
32
+ related_methods?: string[];
33
+ }
34
+ /**
35
+ * ServiceAIContext provides AI-specific guidance for understanding a service.
36
+ */
37
+ export interface ServiceAIContext {
38
+ /** High-level description of what this service does */
39
+ overview?: string;
40
+ /** List of capabilities this service provides */
41
+ capabilities?: string[];
42
+ /** Known limitations of this service */
43
+ limitations?: string[];
44
+ }
45
+ /**
46
+ * MethodDescriptor provides complete metadata about a service method for introspection
47
+ * and AI agent consumption.
48
+ */
49
+ export interface MethodDescriptor {
50
+ /** Method name */
51
+ name: string;
52
+ /** Human-readable description of what this method does */
53
+ description?: string;
54
+ /** JSON Schema describing the input parameters */
55
+ input_schema?: Record<string, unknown>;
56
+ /** JSON Schema describing the output */
57
+ output_schema?: Record<string, unknown>;
58
+ /** Code examples demonstrating method usage */
59
+ examples?: CodeExample[];
60
+ /** Tags for categorization and filtering */
61
+ tags?: string[];
62
+ /** AI-specific context for this method */
63
+ ai_context?: MethodAIContext;
64
+ /** Additional code examples */
65
+ code_examples?: CodeExample[];
66
+ }
67
+ /**
68
+ * ServiceDescriptor provides complete metadata about a service for introspection
69
+ * and AI agent consumption.
70
+ */
71
+ export interface ServiceDescriptor {
72
+ /** Service name */
73
+ name: string;
74
+ /** Service version (semver recommended) */
75
+ version: string;
76
+ /** Human-readable description of this service */
77
+ description?: string;
78
+ /** Methods provided by this service */
79
+ methods?: MethodDescriptor[];
80
+ /** AI-specific context for this service */
81
+ ai_context?: ServiceAIContext;
82
+ /** Names of related services */
83
+ related_services?: string[];
84
+ /** Code examples demonstrating service usage */
85
+ code_examples?: CodeExample[];
86
+ }
87
+ //# sourceMappingURL=introspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspect.d.ts","sourceRoot":"","sources":["../src/introspect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,kDAAkD;IAClD,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,+BAA+B;IAC/B,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,2CAA2C;IAC3C,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,gDAAgD;IAChD,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;CAC/B"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Service introspection types for AI agent support.
3
+ * These types match the Go struct definitions in pkg/types/introspect.go
4
+ * Property names use snake_case to match Go JSON tags for wire compatibility.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=introspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspect.js","sourceRoot":"","sources":["../src/introspect.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/dist/types.d.ts CHANGED
@@ -53,4 +53,49 @@ export interface CallOptions {
53
53
  retries?: number;
54
54
  retryDelay?: number;
55
55
  }
56
+ /**
57
+ * Quality level for connection health assessment.
58
+ */
59
+ export type ConnectionQualityLevel = 'excellent' | 'good' | 'fair' | 'poor' | 'unknown';
60
+ /**
61
+ * Connection state for edge/center clients.
62
+ */
63
+ export type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
64
+ /**
65
+ * Connection quality metrics.
66
+ * Provides real-time information about the health and performance of the connection.
67
+ */
68
+ export interface ConnectionQuality {
69
+ /** Current connection state */
70
+ readonly state: ConnectionState;
71
+ /** Round-trip latency in milliseconds (from last ping, or null if never measured) */
72
+ readonly latencyMs: number | null;
73
+ /** Average latency over the measurement window in milliseconds */
74
+ readonly avgLatencyMs: number | null;
75
+ /** Messages sent per second */
76
+ readonly messagesSentPerSecond: number;
77
+ /** Messages received per second */
78
+ readonly messagesReceivedPerSecond: number;
79
+ /** Total messages sent since connection started */
80
+ readonly totalMessagesSent: number;
81
+ /** Total messages received since connection started */
82
+ readonly totalMessagesReceived: number;
83
+ /** Timestamp of last successful ping */
84
+ readonly lastPingAt: number | null;
85
+ /** Quality assessment based on latency thresholds */
86
+ readonly qualityLevel: ConnectionQualityLevel;
87
+ }
88
+ /**
89
+ * Configuration for connection quality monitoring.
90
+ */
91
+ export interface ConnectionQualityConfig {
92
+ /** Interval in ms between automatic ping measurements (default: 30000, 0 to disable) */
93
+ readonly pingIntervalMs?: number;
94
+ /** Latency threshold in ms for 'excellent' quality (default: 50) */
95
+ readonly excellentLatencyMs?: number;
96
+ /** Latency threshold in ms for 'good' quality (default: 150) */
97
+ readonly goodLatencyMs?: number;
98
+ /** Latency threshold in ms for 'fair' quality (default: 300) */
99
+ readonly fairLatencyMs?: number;
100
+ }
56
101
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAA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D,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,uDAAuD;IACvD,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,wCAAwC;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,qDAAqD;IACrD,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,wFAAwF;IACxF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,gEAAgE;IAChE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,gEAAgE;IAChE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fatagnus/dink-sdk",
3
- "version": "2.0.3",
3
+ "version": "2.3.0",
4
4
  "description": "TypeScript SDK for Dink edge mesh platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",