@axiom-lattice/protocols 2.1.13 → 2.1.15

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,189 @@
1
+ /**
2
+ * DatabaseConfigStoreProtocol
3
+ *
4
+ * Database configuration store protocol for the Axiom Lattice framework
5
+ * Provides standardized interfaces for database connection config management
6
+ */
7
+
8
+ /**
9
+ * Supported database types
10
+ */
11
+ export type DatabaseType = 'postgres' | 'mysql' | 'sqlite';
12
+
13
+ /**
14
+ * Database connection configuration
15
+ */
16
+ export interface DatabaseConfig {
17
+ type: DatabaseType;
18
+ host?: string;
19
+ port?: number;
20
+ database: string;
21
+ user?: string;
22
+ password?: string;
23
+ connectionString?: string;
24
+ ssl?: boolean;
25
+ }
26
+
27
+ /**
28
+ * Database configuration entry stored in the store
29
+ */
30
+ export interface DatabaseConfigEntry {
31
+ /**
32
+ * Unique identifier for the configuration
33
+ */
34
+ id: string;
35
+
36
+ /**
37
+ * Tenant identifier for multi-tenant isolation
38
+ */
39
+ tenantId: string;
40
+
41
+ /**
42
+ * Business key for the configuration (unique within tenant)
43
+ */
44
+ key: string;
45
+
46
+ /**
47
+ * Database connection configuration (password already decrypted)
48
+ */
49
+ config: DatabaseConfig;
50
+
51
+ /**
52
+ * Optional friendly name
53
+ */
54
+ name?: string;
55
+
56
+ /**
57
+ * Optional description
58
+ */
59
+ description?: string;
60
+
61
+ /**
62
+ * Creation timestamp
63
+ */
64
+ createdAt: Date;
65
+
66
+ /**
67
+ * Last update timestamp
68
+ */
69
+ updatedAt: Date;
70
+ }
71
+
72
+ /**
73
+ * Request to create a new database configuration
74
+ */
75
+ export interface CreateDatabaseConfigRequest {
76
+ /**
77
+ * Business key for the configuration (unique within tenant)
78
+ */
79
+ key: string;
80
+
81
+ /**
82
+ * Database connection configuration
83
+ */
84
+ config: DatabaseConfig;
85
+
86
+ /**
87
+ * Optional friendly name
88
+ */
89
+ name?: string;
90
+
91
+ /**
92
+ * Optional description
93
+ */
94
+ description?: string;
95
+ }
96
+
97
+ /**
98
+ * Request to update an existing database configuration
99
+ */
100
+ export interface UpdateDatabaseConfigRequest {
101
+ /**
102
+ * Business key for the configuration
103
+ */
104
+ key?: string;
105
+
106
+ /**
107
+ * Database connection configuration
108
+ */
109
+ config?: DatabaseConfig;
110
+
111
+ /**
112
+ * Optional friendly name
113
+ */
114
+ name?: string;
115
+
116
+ /**
117
+ * Optional description
118
+ */
119
+ description?: string;
120
+ }
121
+
122
+ /**
123
+ * DatabaseConfigStore interface
124
+ * Provides CRUD operations for database configuration data
125
+ */
126
+ export interface DatabaseConfigStore {
127
+ /**
128
+ * Get all database configurations for a tenant
129
+ * @param tenantId - Tenant identifier
130
+ * @returns Array of all database configurations
131
+ */
132
+ getAllConfigs(tenantId: string): Promise<DatabaseConfigEntry[]>;
133
+
134
+ /**
135
+ * Get all database configurations across all tenants
136
+ * @returns Array of all database configurations
137
+ */
138
+ getAllConfigsWithoutTenant(): Promise<DatabaseConfigEntry[]>;
139
+
140
+ /**
141
+ * Get database configuration by ID
142
+ * @param tenantId - Tenant identifier
143
+ * @param id - Configuration identifier
144
+ * @returns Configuration if found, null otherwise
145
+ */
146
+ getConfigById(tenantId: string, id: string): Promise<DatabaseConfigEntry | null>;
147
+
148
+ /**
149
+ * Get database configuration by business key
150
+ * @param tenantId - Tenant identifier
151
+ * @param key - Business key
152
+ * @returns Configuration if found, null otherwise
153
+ */
154
+ getConfigByKey(tenantId: string, key: string): Promise<DatabaseConfigEntry | null>;
155
+
156
+ /**
157
+ * Create a new database configuration
158
+ * @param tenantId - Tenant identifier
159
+ * @param id - Configuration identifier
160
+ * @param data - Configuration creation data
161
+ * @returns Created configuration
162
+ */
163
+ createConfig(tenantId: string, id: string, data: CreateDatabaseConfigRequest): Promise<DatabaseConfigEntry>;
164
+
165
+ /**
166
+ * Update an existing database configuration
167
+ * @param tenantId - Tenant identifier
168
+ * @param id - Configuration identifier
169
+ * @param updates - Partial configuration data to update
170
+ * @returns Updated configuration if found, null otherwise
171
+ */
172
+ updateConfig(tenantId: string, id: string, updates: Partial<UpdateDatabaseConfigRequest>): Promise<DatabaseConfigEntry | null>;
173
+
174
+ /**
175
+ * Delete a database configuration by ID
176
+ * @param tenantId - Tenant identifier
177
+ * @param id - Configuration identifier
178
+ * @returns true if deleted, false otherwise
179
+ */
180
+ deleteConfig(tenantId: string, id: string): Promise<boolean>;
181
+
182
+ /**
183
+ * Check if configuration exists
184
+ * @param tenantId - Tenant identifier
185
+ * @param id - Configuration identifier
186
+ * @returns true if configuration exists, false otherwise
187
+ */
188
+ hasConfig(tenantId: string, id: string): Promise<boolean>;
189
+ }
@@ -0,0 +1,367 @@
1
+ /**
2
+ * MetricsServerConfigStoreProtocol
3
+ *
4
+ * Metrics Server configuration store protocol for the Axiom Lattice framework
5
+ * Provides standardized interfaces for metrics server connection config management
6
+ */
7
+
8
+ /**
9
+ * Supported metrics server types
10
+ */
11
+ export type MetricsServerType = 'prometheus' | 'grafana' | 'custom' | 'semantic';
12
+
13
+ /**
14
+ * Metrics server connection configuration
15
+ */
16
+ export interface MetricsServerConfig {
17
+ /** Server type */
18
+ type: MetricsServerType;
19
+ /** Server base URL (e.g., http://localhost:9090) */
20
+ serverUrl: string;
21
+ /** Optional API key for authentication */
22
+ apiKey?: string;
23
+ /** Optional username for basic auth */
24
+ username?: string;
25
+ /** Optional password for basic auth */
26
+ password?: string;
27
+ /** Optional additional headers */
28
+ headers?: Record<string, string>;
29
+ /** Optional timeout in milliseconds (default: 30000) */
30
+ timeout?: number;
31
+ }
32
+
33
+ /**
34
+ * Metrics server configuration entry stored in the store
35
+ */
36
+ export interface MetricsServerConfigEntry {
37
+ /**
38
+ * Unique identifier for the configuration
39
+ */
40
+ id: string;
41
+
42
+ /**
43
+ * Tenant identifier for multi-tenant isolation
44
+ */
45
+ tenantId: string;
46
+
47
+ /**
48
+ * Business key for the configuration (unique within tenant)
49
+ */
50
+ key: string;
51
+
52
+ /**
53
+ * Metrics server connection configuration
54
+ */
55
+ config: MetricsServerConfig;
56
+
57
+ /**
58
+ * Optional friendly name
59
+ */
60
+ name?: string;
61
+
62
+ /**
63
+ * Optional description
64
+ */
65
+ description?: string;
66
+
67
+ /**
68
+ * Creation timestamp
69
+ */
70
+ createdAt: Date;
71
+
72
+ /**
73
+ * Last update timestamp
74
+ */
75
+ updatedAt: Date;
76
+ }
77
+
78
+ /**
79
+ * Request to create a new metrics server configuration
80
+ */
81
+ export interface CreateMetricsServerConfigRequest {
82
+ /**
83
+ * Business key for the configuration (unique within tenant)
84
+ */
85
+ key: string;
86
+
87
+ /**
88
+ * Metrics server connection configuration
89
+ */
90
+ config: MetricsServerConfig;
91
+
92
+ /**
93
+ * Optional friendly name
94
+ */
95
+ name?: string;
96
+
97
+ /**
98
+ * Optional description
99
+ */
100
+ description?: string;
101
+ }
102
+
103
+ /**
104
+ * Request to update an existing metrics server configuration
105
+ */
106
+ export interface UpdateMetricsServerConfigRequest {
107
+ /**
108
+ * Business key for the configuration
109
+ */
110
+ key?: string;
111
+
112
+ /**
113
+ * Metrics server connection configuration
114
+ */
115
+ config?: MetricsServerConfig;
116
+
117
+ /**
118
+ * Optional friendly name
119
+ */
120
+ name?: string;
121
+
122
+ /**
123
+ * Optional description
124
+ */
125
+ description?: string;
126
+ }
127
+
128
+ /**
129
+ * Metric metadata information
130
+ */
131
+ export interface MetricMeta {
132
+ /** Metric name */
133
+ name: string;
134
+ /** Metric type (gauge, counter, histogram, summary) */
135
+ type?: string;
136
+ /** Metric description/help text */
137
+ description?: string;
138
+ /** Available label names */
139
+ labels?: string[];
140
+ /** Unit of measurement */
141
+ unit?: string;
142
+ }
143
+
144
+ /**
145
+ * Metric data point
146
+ */
147
+ export interface MetricDataPoint {
148
+ /** Timestamp */
149
+ timestamp: number;
150
+ /** Metric value */
151
+ value: number;
152
+ /** Label values */
153
+ labels?: Record<string, string>;
154
+ }
155
+
156
+ /**
157
+ * Metric query result
158
+ */
159
+ export interface MetricQueryResult {
160
+ /** Metric name */
161
+ metricName: string;
162
+ /** Data points */
163
+ dataPoints: MetricDataPoint[];
164
+ /** Query metadata */
165
+ metadata?: {
166
+ startTime?: number;
167
+ endTime?: number;
168
+ step?: number;
169
+ };
170
+ }
171
+
172
+ /**
173
+ * Data source information for semantic metrics server
174
+ */
175
+ export interface DataSource {
176
+ /** Unique identifier for the data source */
177
+ id: string | number;
178
+ /** Display name of the data source */
179
+ name: string;
180
+ /** JDBC connection URL or similar */
181
+ url: string;
182
+ /** Username for connection */
183
+ username?: string;
184
+ /** Schema name in the database */
185
+ schemaName?: string;
186
+ /** Description of the data source */
187
+ description?: string;
188
+ /** Status code */
189
+ status: number;
190
+ /** Status label (e.g., "active", "inactive") */
191
+ statusLabel?: string;
192
+ /** Whether the data source is currently connected */
193
+ connected: boolean;
194
+ /** Creation timestamp */
195
+ createdAt?: string;
196
+ /** Last update timestamp */
197
+ updatedAt?: string;
198
+ }
199
+
200
+ /**
201
+ * Semantic metrics server configuration
202
+ * Extends base config with semantic-specific properties
203
+ */
204
+ export interface SemanticMetricsServerConfig extends MetricsServerConfig {
205
+ /** Must be 'semantic' */
206
+ type: 'semantic';
207
+ /** IDs of selected data sources */
208
+ selectedDataSources?: string[];
209
+ }
210
+
211
+ /**
212
+ * Filter definition for semantic metrics query
213
+ */
214
+ export interface SemanticMetricsFilter {
215
+ /** Dimension/column name to filter on */
216
+ dimension: string;
217
+ /** Operator (e.g., "BETWEEN", "=", ">", "<") */
218
+ operator: string;
219
+ /** Values for the filter */
220
+ values: (string | number | boolean)[];
221
+ }
222
+
223
+ /**
224
+ * Request body for semantic metrics query
225
+ */
226
+ export interface SemanticMetricsQueryRequest {
227
+ /** Data source ID to query */
228
+ datasourceId: string | number;
229
+ /** Array of metric names to query */
230
+ metrics: string[];
231
+ /** Optional group by dimensions */
232
+ groupBy?: string[];
233
+ /** Optional filters */
234
+ filters?: SemanticMetricsFilter[];
235
+ /** Optional result limit */
236
+ limit?: number;
237
+ }
238
+
239
+ /**
240
+ * Single data point in semantic metrics query response
241
+ */
242
+ export interface SemanticMetricDataPoint {
243
+ /** Timestamp in milliseconds */
244
+ timestamp?: number;
245
+ /** Metric value */
246
+ value: number;
247
+ /** Metric name */
248
+ metricName?: string;
249
+ /** Additional dimension values */
250
+ labels?: Record<string, string>;
251
+ /** Group by dimension values */
252
+ groupByValues?: Record<string, string>;
253
+ }
254
+
255
+ /**
256
+ * AI Hints for a single metric result
257
+ */
258
+ export interface SemanticMetricAiHints {
259
+ polarity: string;
260
+ valueInterpretation: string;
261
+ thresholds?: Array<{
262
+ metric: string;
263
+ operator: string;
264
+ value: number;
265
+ level: string;
266
+ }>;
267
+ suggestedFollowup?: string[];
268
+ }
269
+
270
+ /**
271
+ * Single metric result from semantic metrics query
272
+ */
273
+ export interface SemanticMetricResult {
274
+ metricName: string;
275
+ displayName: string;
276
+ dataType: string;
277
+ format: string;
278
+ polarity: string;
279
+ columns: string[];
280
+ rows: Array<Record<string, unknown>>;
281
+ rowCount: number;
282
+ executionTimeMs: number;
283
+ aiHints: SemanticMetricAiHints;
284
+ }
285
+
286
+ /**
287
+ * Response from semantic metrics query
288
+ */
289
+ export interface SemanticMetricsQueryResponse {
290
+ /** Data source ID that was queried */
291
+ datasourceId: string | number;
292
+ /** Data source name */
293
+ datasourceName?: string;
294
+ /** Query results for each metric */
295
+ results: SemanticMetricResult[];
296
+ /** Total execution time in ms */
297
+ totalExecutionTimeMs?: number;
298
+ }
299
+
300
+ /**
301
+ * MetricsServerConfigStore interface
302
+ * Provides CRUD operations for metrics server configuration data
303
+ */
304
+ export interface MetricsServerConfigStore {
305
+ /**
306
+ * Get all metrics server configurations for a tenant
307
+ * @param tenantId - Tenant identifier
308
+ * @returns Array of all metrics server configurations
309
+ */
310
+ getAllConfigs(tenantId: string): Promise<MetricsServerConfigEntry[]>;
311
+
312
+ /**
313
+ * Get all metrics server configurations across all tenants
314
+ * @returns Array of all metrics server configurations
315
+ */
316
+ getAllConfigsWithoutTenant(): Promise<MetricsServerConfigEntry[]>;
317
+
318
+ /**
319
+ * Get metrics server configuration by ID
320
+ * @param tenantId - Tenant identifier
321
+ * @param id - Configuration identifier
322
+ * @returns Configuration if found, null otherwise
323
+ */
324
+ getConfigById(tenantId: string, id: string): Promise<MetricsServerConfigEntry | null>;
325
+
326
+ /**
327
+ * Get metrics server configuration by business key
328
+ * @param tenantId - Tenant identifier
329
+ * @param key - Business key
330
+ * @returns Configuration if found, null otherwise
331
+ */
332
+ getConfigByKey(tenantId: string, key: string): Promise<MetricsServerConfigEntry | null>;
333
+
334
+ /**
335
+ * Create a new metrics server configuration
336
+ * @param tenantId - Tenant identifier
337
+ * @param id - Configuration identifier
338
+ * @param data - Configuration creation data
339
+ * @returns Created configuration
340
+ */
341
+ createConfig(tenantId: string, id: string, data: CreateMetricsServerConfigRequest): Promise<MetricsServerConfigEntry>;
342
+
343
+ /**
344
+ * Update an existing metrics server configuration
345
+ * @param tenantId - Tenant identifier
346
+ * @param id - Configuration identifier
347
+ * @param updates - Partial configuration data to update
348
+ * @returns Updated configuration if found, null otherwise
349
+ */
350
+ updateConfig(tenantId: string, id: string, updates: Partial<UpdateMetricsServerConfigRequest>): Promise<MetricsServerConfigEntry | null>;
351
+
352
+ /**
353
+ * Delete a metrics server configuration by ID
354
+ * @param tenantId - Tenant identifier
355
+ * @param id - Configuration identifier
356
+ * @returns true if deleted, false otherwise
357
+ */
358
+ deleteConfig(tenantId: string, id: string): Promise<boolean>;
359
+
360
+ /**
361
+ * Check if configuration exists
362
+ * @param tenantId - Tenant identifier
363
+ * @param id - Configuration identifier
364
+ * @returns true if configuration exists, false otherwise
365
+ */
366
+ hasConfig(tenantId: string, id: string): Promise<boolean>;
367
+ }
@@ -190,4 +190,19 @@ export interface SkillStore {
190
190
  * @returns Array of sub-skills if found, empty array otherwise
191
191
  */
192
192
  getSubSkills(parentSkillName: string): Promise<Skill[]>;
193
+
194
+ /**
195
+ * List all resources in a skill's resources directory
196
+ * @param id Skill identifier
197
+ * @returns Array of resource paths relative to resources/ directory
198
+ */
199
+ listSkillResources?(id: string): Promise<string[]>;
200
+
201
+ /**
202
+ * Load a specific resource from a skill's resources directory
203
+ * @param id Skill identifier
204
+ * @param resourcePath Path to the resource relative to resources/ directory
205
+ * @returns The resource content as string, or null if not found
206
+ */
207
+ loadSkillResource?(id: string, resourcePath: string): Promise<string | null>;
193
208
  }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * TenantStoreProtocol
3
+ *
4
+ * Tenant store protocol definitions
5
+ * for the Axiom Lattice framework
6
+ */
7
+
8
+ export type TenantStatus = 'active' | 'inactive' | 'suspended';
9
+
10
+ /**
11
+ * Tenant type definition
12
+ */
13
+ export interface Tenant {
14
+ id: string;
15
+ name: string;
16
+ description?: string;
17
+ status: TenantStatus;
18
+ metadata?: Record<string, any>;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+
23
+ /**
24
+ * Create tenant request type
25
+ */
26
+ export interface CreateTenantRequest {
27
+ name: string;
28
+ description?: string;
29
+ status?: TenantStatus;
30
+ metadata?: Record<string, any>;
31
+ }
32
+
33
+ /**
34
+ * Update tenant request type
35
+ */
36
+ export interface UpdateTenantRequest {
37
+ name?: string;
38
+ description?: string;
39
+ status?: TenantStatus;
40
+ metadata?: Record<string, any>;
41
+ }
42
+
43
+ /**
44
+ * TenantStore interface
45
+ * Provides CRUD operations for tenant data
46
+ * Note: Tenant is a top-level entity, so no tenantId parameter is needed
47
+ */
48
+ export interface TenantStore {
49
+ getAllTenants(): Promise<Tenant[]>;
50
+ getTenantById(id: string): Promise<Tenant | null>;
51
+ createTenant(id: string, data: CreateTenantRequest): Promise<Tenant>;
52
+ updateTenant(id: string, updates: UpdateTenantRequest): Promise<Tenant | null>;
53
+ deleteTenant(id: string): Promise<boolean>;
54
+ }
@@ -0,0 +1,34 @@
1
+ export type UserStatus = 'active' | 'pending' | 'suspended';
2
+
3
+ export interface User {
4
+ id: string;
5
+ email: string;
6
+ name: string;
7
+ status: UserStatus;
8
+ metadata?: Record<string, any>;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ }
12
+
13
+ export interface CreateUserRequest {
14
+ email: string;
15
+ name: string;
16
+ status?: UserStatus;
17
+ metadata?: Record<string, any>;
18
+ }
19
+
20
+ export interface UpdateUserRequest {
21
+ email?: string;
22
+ name?: string;
23
+ status?: UserStatus;
24
+ metadata?: Record<string, any>;
25
+ }
26
+
27
+ export interface UserStore {
28
+ getAllUsers(): Promise<User[]>;
29
+ getUserById(id: string): Promise<User | null>;
30
+ getUserByEmail(email: string): Promise<User | null>;
31
+ createUser(id: string, data: CreateUserRequest): Promise<User>;
32
+ updateUser(id: string, updates: UpdateUserRequest): Promise<User | null>;
33
+ deleteUser(id: string): Promise<boolean>;
34
+ }