@axiom-lattice/protocols 2.1.19 → 2.1.21

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.
@@ -28,6 +28,8 @@ export interface MetricsServerConfig {
28
28
  headers?: Record<string, string>;
29
29
  /** Optional timeout in milliseconds (default: 30000) */
30
30
  timeout?: number;
31
+ /** Optional tenant ID for multi-tenant isolation */
32
+ tenantId?: string;
31
33
  }
32
34
 
33
35
  /**
@@ -220,6 +222,19 @@ export interface SemanticMetricsFilter {
220
222
  values: (string | number | boolean)[];
221
223
  }
222
224
 
225
+ /**
226
+ * Query result format options
227
+ */
228
+ export type QueryResultFormat = 'array' | 'object' | 'both';
229
+
230
+ /**
231
+ * Column definition
232
+ */
233
+ export interface MetricColumn {
234
+ name: string;
235
+ type: string; // 'date', 'numeric', 'string', 'varchar', 'boolean', etc.
236
+ }
237
+
223
238
  /**
224
239
  * Request body for semantic metrics query
225
240
  */
@@ -234,67 +249,45 @@ export interface SemanticMetricsQueryRequest {
234
249
  filters?: SemanticMetricsFilter[];
235
250
  /** Optional result limit */
236
251
  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;
252
+ /** Optional format specification - defaults to 'array' */
253
+ format?: QueryResultFormat;
284
254
  }
285
255
 
286
256
  /**
287
257
  * Response from semantic metrics query
258
+ *
259
+ * Note: The actual API response format has changed from the original design.
260
+ * It now returns a flat structure with columns and rows arrays.
261
+ *
262
+ * Based on format parameter:
263
+ * - 'array' (default): returns rows as array of arrays
264
+ * - 'object': returns rowsObject as array of objects
265
+ * - 'both': returns both formats
288
266
  */
289
267
  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;
268
+ /** Semantic model name that was queried */
269
+ semanticModel: string;
270
+ /** Column definitions with name and type */
271
+ columns: MetricColumn[];
272
+ /** Number of rows returned */
273
+ rowCount: number;
274
+ /** Execution time in milliseconds */
275
+ executionTimeMs?: number;
276
+ /**
277
+ * Data rows as arrays (each row is an array of values corresponding to columns)
278
+ * Present when format is 'array' or 'both'
279
+ */
280
+ rows?: Array<Array<unknown>>;
281
+ /**
282
+ * Data rows as objects (each row is {columnName: value})
283
+ * Present when format is 'object' or 'both'
284
+ */
285
+ rowsObject?: Array<Record<string, unknown>>;
286
+ /** Debug information (optional) */
287
+ debug?: {
288
+ sql?: string;
289
+ params?: unknown;
290
+ };
298
291
  }
299
292
 
300
293
  /**
@@ -309,23 +302,86 @@ export interface ExecuteSqlQueryRequest {
309
302
  params?: Record<string, string | number | boolean>;
310
303
  /** Optional result limit */
311
304
  limit?: number;
305
+ /** Optional format specification - defaults to 'object' */
306
+ format?: QueryResultFormat;
312
307
  }
313
308
 
314
309
  /**
315
310
  * Response from custom SQL query execution
311
+ *
312
+ * Based on format parameter:
313
+ * - 'object' (default): returns rowsObject as array of objects
314
+ * - 'array': returns rows as array of arrays
315
+ * - 'both': returns both formats
316
316
  */
317
317
  export interface ExecuteSqlQueryResponse {
318
318
  /** Data source ID that was queried */
319
319
  datasourceId: string | number;
320
320
  /** Data source name */
321
321
  datasourceName?: string;
322
- result: {
323
- executedSql: string;
324
- columns: string[];
325
- rows: Array<Record<string, unknown>>;
326
- rowCount: number;
327
- executionTimeMs: number;
328
- }
322
+ /** Name of the queried table (if applicable) */
323
+ tableName?: string;
324
+ /** Column names in order */
325
+ columns: string[];
326
+ /** Number of rows returned */
327
+ rowCount: number;
328
+ /** Execution time in milliseconds */
329
+ executionTimeMs: number;
330
+ /** Executed SQL query */
331
+ executedSql: string;
332
+ /**
333
+ * Data rows as arrays
334
+ * Present when format is 'array' or 'both'
335
+ */
336
+ rows?: Array<Array<unknown>>;
337
+ /**
338
+ * Data rows as objects (each row is {columnName: value})
339
+ * Present when format is 'object' or 'both'
340
+ */
341
+ rowsObject?: Array<Record<string, unknown>>;
342
+ }
343
+
344
+ /**
345
+ * Request body for table query
346
+ */
347
+ export interface TableQueryRequest {
348
+ /** Table name to query */
349
+ tableName: string;
350
+ /** Optional result limit */
351
+ limit?: number;
352
+ /** Optional format specification - defaults to 'object' */
353
+ format?: QueryResultFormat;
354
+ }
355
+
356
+ /**
357
+ * Response from table query
358
+ *
359
+ * Based on format parameter:
360
+ * - 'object' (default): returns rowsObject as array of objects (API native format)
361
+ * - 'array': returns rows as array of arrays
362
+ * - 'both': returns both formats
363
+ */
364
+ export interface TableQueryResponse {
365
+ /** Name of the queried table */
366
+ tableName: string;
367
+ /** Column names in order */
368
+ columns: string[];
369
+ /** Number of rows returned */
370
+ rowCount: number;
371
+ /** Execution time in milliseconds */
372
+ executionTimeMs: number;
373
+ /** Executed SQL query */
374
+ executedSql: string;
375
+ /**
376
+ * Data rows as arrays
377
+ * Present when format is 'array' or 'both'
378
+ */
379
+ rows?: Array<Array<unknown>>;
380
+ /**
381
+ * Data rows as objects (each row is {columnName: value})
382
+ * Present when format is 'object' or 'both' (API native format)
383
+ */
384
+ rowsObject?: Array<Record<string, unknown>>;
329
385
  }
330
386
 
331
387
  /**
@@ -24,6 +24,8 @@ export interface LLMConfig {
24
24
  apiKeyEnvName?: string;
25
25
  apiKey?: string;
26
26
  baseURL?: string;
27
+ modelKwargs?: Record<string, any>;
28
+ extra?: Record<string, any>
27
29
  }
28
30
 
29
31
  /**
@@ -194,6 +194,7 @@ export interface ScheduleStorage {
194
194
  * Get all tasks (with optional filters)
195
195
  */
196
196
  getAllTasks(filters?: {
197
+ tenantId?: string;
197
198
  status?: ScheduledTaskStatus;
198
199
  executionType?: ScheduleExecutionType;
199
200
  taskType?: string;
@@ -207,6 +208,7 @@ export interface ScheduleStorage {
207
208
  * Count tasks (with optional filters)
208
209
  */
209
210
  countTasks(filters?: {
211
+ tenantId?: string;
210
212
  status?: ScheduledTaskStatus;
211
213
  executionType?: ScheduleExecutionType;
212
214
  taskType?: string;
@@ -16,6 +16,11 @@ export interface Skill {
16
16
  */
17
17
  id: string;
18
18
 
19
+ /**
20
+ * Tenant identifier
21
+ */
22
+ tenantId: string;
23
+
19
24
  /**
20
25
  * Skill name
21
26
  */
@@ -114,95 +119,109 @@ export interface CreateSkillRequest {
114
119
  */
115
120
  export interface SkillStore {
116
121
  /**
117
- * Get all skills
118
- * @returns Array of all skills
122
+ * Get all skills for a tenant
123
+ * @param tenantId Tenant identifier
124
+ * @returns Array of all skills for the tenant
119
125
  */
120
- getAllSkills(): Promise<Skill[]>;
126
+ getAllSkills(tenantId: string): Promise<Skill[]>;
121
127
 
122
128
  /**
123
129
  * Get skill by ID
130
+ * @param tenantId Tenant identifier
124
131
  * @param id Skill identifier
125
132
  * @returns Skill if found, null otherwise
126
133
  */
127
- getSkillById(id: string): Promise<Skill | null>;
134
+ getSkillById(tenantId: string, id: string): Promise<Skill | null>;
128
135
 
129
136
  /**
130
137
  * Create a new skill
138
+ * @param tenantId Tenant identifier
131
139
  * @param id Skill identifier
132
140
  * @param data Skill creation data
133
141
  * @returns Created skill
134
142
  */
135
- createSkill(id: string, data: CreateSkillRequest): Promise<Skill>;
143
+ createSkill(tenantId: string, id: string, data: CreateSkillRequest): Promise<Skill>;
136
144
 
137
145
  /**
138
146
  * Update an existing skill
147
+ * @param tenantId Tenant identifier
139
148
  * @param id Skill identifier
140
149
  * @param updates Partial skill data to update
141
150
  * @returns Updated skill if found, null otherwise
142
151
  */
143
152
  updateSkill(
153
+ tenantId: string,
144
154
  id: string,
145
155
  updates: Partial<CreateSkillRequest>
146
156
  ): Promise<Skill | null>;
147
157
 
148
158
  /**
149
159
  * Delete a skill by ID
160
+ * @param tenantId Tenant identifier
150
161
  * @param id Skill identifier
151
162
  * @returns true if deleted, false otherwise
152
163
  */
153
- deleteSkill(id: string): Promise<boolean>;
164
+ deleteSkill(tenantId: string, id: string): Promise<boolean>;
154
165
 
155
166
  /**
156
167
  * Check if skill exists
168
+ * @param tenantId Tenant identifier
157
169
  * @param id Skill identifier
158
170
  * @returns true if skill exists, false otherwise
159
171
  */
160
- hasSkill(id: string): Promise<boolean>;
172
+ hasSkill(tenantId: string, id: string): Promise<boolean>;
161
173
 
162
174
  /**
163
- * Search skills by metadata
175
+ * Search skills by metadata within a tenant
176
+ * @param tenantId Tenant identifier
164
177
  * @param metadataKey Metadata key to search for
165
178
  * @param metadataValue Metadata value to match
166
179
  * @returns Array of matching skills
167
180
  */
168
181
  searchByMetadata(
182
+ tenantId: string,
169
183
  metadataKey: string,
170
184
  metadataValue: string
171
185
  ): Promise<Skill[]>;
172
186
 
173
187
  /**
174
- * Filter skills by compatibility
188
+ * Filter skills by compatibility within a tenant
189
+ * @param tenantId Tenant identifier
175
190
  * @param compatibility Compatibility string to filter by
176
191
  * @returns Array of matching skills
177
192
  */
178
- filterByCompatibility(compatibility: string): Promise<Skill[]>;
193
+ filterByCompatibility(tenantId: string, compatibility: string): Promise<Skill[]>;
179
194
 
180
195
  /**
181
- * Filter skills by license
196
+ * Filter skills by license within a tenant
197
+ * @param tenantId Tenant identifier
182
198
  * @param license License string to filter by
183
199
  * @returns Array of matching skills
184
200
  */
185
- filterByLicense(license: string): Promise<Skill[]>;
201
+ filterByLicense(tenantId: string, license: string): Promise<Skill[]>;
186
202
 
187
203
  /**
188
- * Get sub-skills of a parent skill
204
+ * Get sub-skills of a parent skill within a tenant
205
+ * @param tenantId Tenant identifier
189
206
  * @param parentSkillName Parent skill name
190
207
  * @returns Array of sub-skills if found, empty array otherwise
191
208
  */
192
- getSubSkills(parentSkillName: string): Promise<Skill[]>;
209
+ getSubSkills(tenantId: string, parentSkillName: string): Promise<Skill[]>;
193
210
 
194
211
  /**
195
212
  * List all resources in a skill's resources directory
213
+ * @param tenantId Tenant identifier
196
214
  * @param id Skill identifier
197
215
  * @returns Array of resource paths relative to resources/ directory
198
216
  */
199
- listSkillResources?(id: string): Promise<string[]>;
217
+ listSkillResources?(tenantId: string, id: string): Promise<string[]>;
200
218
 
201
219
  /**
202
220
  * Load a specific resource from a skill's resources directory
221
+ * @param tenantId Tenant identifier
203
222
  * @param id Skill identifier
204
223
  * @param resourcePath Path to the resource relative to resources/ directory
205
224
  * @returns The resource content as string, or null if not found
206
225
  */
207
- loadSkillResource?(id: string, resourcePath: string): Promise<string | null>;
226
+ loadSkillResource?(tenantId: string, id: string, resourcePath: string): Promise<string | null>;
208
227
  }
@@ -14,6 +14,11 @@ export interface Thread {
14
14
  */
15
15
  id: string;
16
16
 
17
+ /**
18
+ * Tenant identifier
19
+ */
20
+ tenantId: string;
21
+
17
22
  /**
18
23
  * Assistant identifier this thread belongs to
19
24
  */
@@ -48,35 +53,38 @@ export interface CreateThreadRequest {
48
53
  /**
49
54
  * ThreadStore interface
50
55
  * Provides CRUD operations for thread data
51
- * All operations are scoped to an assistant ID
56
+ * All operations are scoped to a tenant ID and assistant ID
52
57
  */
53
58
  export interface ThreadStore {
54
59
  /**
55
- * Get all threads for a specific assistant
60
+ * Get all threads for a specific tenant and assistant
61
+ * @param tenantId Tenant identifier
56
62
  * @param assistantId Assistant identifier
57
63
  * @returns Array of threads for the assistant
58
64
  */
59
- getThreadsByAssistantId(assistantId: string): Promise<Thread[]>;
65
+ getThreadsByAssistantId(tenantId: string, assistantId: string): Promise<Thread[]>;
60
66
 
61
67
  /**
62
- * Get a thread by ID for a specific assistant
63
- * @param assistantId Assistant identifier
68
+ * Get a thread by ID for a specific tenant
69
+ * @param tenantId Tenant identifier
64
70
  * @param threadId Thread identifier
65
71
  * @returns Thread if found, undefined otherwise
66
72
  */
67
73
  getThreadById(
68
- assistantId: string,
74
+ tenantId: string,
69
75
  threadId: string
70
76
  ): Promise<Thread | undefined>;
71
77
 
72
78
  /**
73
- * Create a new thread for an assistant
79
+ * Create a new thread for a tenant and assistant
80
+ * @param tenantId Tenant identifier
74
81
  * @param assistantId Assistant identifier
75
82
  * @param threadId Thread identifier
76
83
  * @param data Thread creation data
77
84
  * @returns Created thread
78
85
  */
79
86
  createThread(
87
+ tenantId: string,
80
88
  assistantId: string,
81
89
  threadId: string,
82
90
  data: CreateThreadRequest
@@ -84,30 +92,30 @@ export interface ThreadStore {
84
92
 
85
93
  /**
86
94
  * Update an existing thread
87
- * @param assistantId Assistant identifier
95
+ * @param tenantId Tenant identifier
88
96
  * @param threadId Thread identifier
89
97
  * @param updates Partial thread data to update
90
98
  * @returns Updated thread if found, null otherwise
91
99
  */
92
100
  updateThread(
93
- assistantId: string,
101
+ tenantId: string,
94
102
  threadId: string,
95
103
  updates: Partial<CreateThreadRequest>
96
104
  ): Promise<Thread | null>;
97
105
 
98
106
  /**
99
107
  * Delete a thread by ID
100
- * @param assistantId Assistant identifier
108
+ * @param tenantId Tenant identifier
101
109
  * @param threadId Thread identifier
102
110
  * @returns true if deleted, false otherwise
103
111
  */
104
- deleteThread(assistantId: string, threadId: string): Promise<boolean>;
112
+ deleteThread(tenantId: string, threadId: string): Promise<boolean>;
105
113
 
106
114
  /**
107
115
  * Check if thread exists
108
- * @param assistantId Assistant identifier
116
+ * @param tenantId Tenant identifier
109
117
  * @param threadId Thread identifier
110
118
  * @returns true if thread exists, false otherwise
111
119
  */
112
- hasThread(assistantId: string, threadId: string): Promise<boolean>;
120
+ hasThread(tenantId: string, threadId: string): Promise<boolean>;
113
121
  }