@kilnai/runtime 0.19.0 → 0.21.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 (62) hide show
  1. package/dist/gateway/auth-middleware.d.ts +9 -0
  2. package/dist/gateway/auth-middleware.d.ts.map +1 -1
  3. package/dist/gateway/auth-middleware.js +24 -0
  4. package/dist/gateway/auth-middleware.js.map +1 -1
  5. package/dist/gateway/context-formatter.d.ts +1 -0
  6. package/dist/gateway/context-formatter.d.ts.map +1 -1
  7. package/dist/gateway/context-formatter.js +5 -0
  8. package/dist/gateway/context-formatter.js.map +1 -1
  9. package/dist/gateway/gateway-routes.d.ts +3 -0
  10. package/dist/gateway/gateway-routes.d.ts.map +1 -1
  11. package/dist/gateway/gateway-routes.js +17 -0
  12. package/dist/gateway/gateway-routes.js.map +1 -1
  13. package/dist/gateway/gateway-server.d.ts.map +1 -1
  14. package/dist/gateway/gateway-server.js +121 -7
  15. package/dist/gateway/gateway-server.js.map +1 -1
  16. package/dist/gateway/jwt-verifier.d.ts +28 -0
  17. package/dist/gateway/jwt-verifier.d.ts.map +1 -0
  18. package/dist/gateway/jwt-verifier.js +44 -0
  19. package/dist/gateway/jwt-verifier.js.map +1 -0
  20. package/dist/gateway/message-pipeline.d.ts +1 -0
  21. package/dist/gateway/message-pipeline.d.ts.map +1 -1
  22. package/dist/gateway/message-pipeline.js +8 -3
  23. package/dist/gateway/message-pipeline.js.map +1 -1
  24. package/dist/gateway/mode-b-routes.d.ts.map +1 -1
  25. package/dist/gateway/mode-b-routes.js +18 -1
  26. package/dist/gateway/mode-b-routes.js.map +1 -1
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +2 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/mcp/gateway-mcp-server.d.ts +49 -0
  32. package/dist/mcp/gateway-mcp-server.d.ts.map +1 -0
  33. package/dist/mcp/gateway-mcp-server.js +280 -0
  34. package/dist/mcp/gateway-mcp-server.js.map +1 -0
  35. package/dist/mcp/gateway-mcp-types.d.ts +68 -0
  36. package/dist/mcp/gateway-mcp-types.d.ts.map +1 -0
  37. package/dist/mcp/gateway-mcp-types.js +4 -0
  38. package/dist/mcp/gateway-mcp-types.js.map +1 -0
  39. package/dist/mcp/index.d.ts +6 -0
  40. package/dist/mcp/index.d.ts.map +1 -0
  41. package/dist/mcp/index.js +4 -0
  42. package/dist/mcp/index.js.map +1 -0
  43. package/dist/mcp/tool-schemas.d.ts +563 -0
  44. package/dist/mcp/tool-schemas.d.ts.map +1 -0
  45. package/dist/mcp/tool-schemas.js +268 -0
  46. package/dist/mcp/tool-schemas.js.map +1 -0
  47. package/dist/session/mode-b-session.d.ts +7 -0
  48. package/dist/session/mode-b-session.d.ts.map +1 -1
  49. package/dist/session/mode-b-session.js +20 -0
  50. package/dist/session/mode-b-session.js.map +1 -1
  51. package/dist/session/session-serializer.d.ts.map +1 -1
  52. package/dist/session/session-serializer.js +1 -0
  53. package/dist/session/session-serializer.js.map +1 -1
  54. package/dist/tenant/agent-resolver.d.ts +4 -4
  55. package/dist/tenant/agent-resolver.d.ts.map +1 -1
  56. package/dist/tenant/agent-resolver.js +18 -16
  57. package/dist/tenant/agent-resolver.js.map +1 -1
  58. package/dist/tenant/interpolate-user-tokens.d.ts +8 -0
  59. package/dist/tenant/interpolate-user-tokens.d.ts.map +1 -0
  60. package/dist/tenant/interpolate-user-tokens.js +13 -0
  61. package/dist/tenant/interpolate-user-tokens.js.map +1 -0
  62. package/package.json +9 -4
@@ -0,0 +1,563 @@
1
+ export declare const MEMORY_RECALL_SCHEMA: {
2
+ type: "object";
3
+ properties: {
4
+ scope: {
5
+ type: string;
6
+ description: string;
7
+ };
8
+ query: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ tags: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ };
17
+ required: string[];
18
+ };
19
+ export declare const MEMORY_STORE_SCHEMA: {
20
+ type: "object";
21
+ properties: {
22
+ scope: {
23
+ type: string;
24
+ description: string;
25
+ };
26
+ key: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ content: {
31
+ type: string;
32
+ description: string;
33
+ };
34
+ tags: {
35
+ type: string;
36
+ description: string;
37
+ };
38
+ };
39
+ required: string[];
40
+ };
41
+ export declare const MEMORY_DELETE_SCHEMA: {
42
+ type: "object";
43
+ properties: {
44
+ id: {
45
+ type: string;
46
+ description: string;
47
+ };
48
+ };
49
+ required: string[];
50
+ };
51
+ export declare const KNOWLEDGE_SEARCH_SCHEMA: {
52
+ type: "object";
53
+ properties: {
54
+ appName: {
55
+ type: string;
56
+ description: string;
57
+ };
58
+ query: {
59
+ type: string;
60
+ description: string;
61
+ };
62
+ limit: {
63
+ type: string;
64
+ description: string;
65
+ };
66
+ };
67
+ required: string[];
68
+ };
69
+ export declare const KNOWLEDGE_SOURCES_SCHEMA: {
70
+ type: "object";
71
+ properties: {
72
+ appName: {
73
+ type: string;
74
+ description: string;
75
+ };
76
+ };
77
+ required: string[];
78
+ };
79
+ export declare const COST_SUMMARY_SCHEMA: {
80
+ type: "object";
81
+ properties: {};
82
+ required: string[];
83
+ };
84
+ export declare const SAFETY_METRICS_SCHEMA: {
85
+ type: "object";
86
+ properties: {};
87
+ required: string[];
88
+ };
89
+ export declare const INTEGRATION_LIST_SCHEMA: {
90
+ type: "object";
91
+ properties: {};
92
+ required: string[];
93
+ };
94
+ export declare const INTEGRATION_EXECUTE_SCHEMA: {
95
+ type: "object";
96
+ properties: {
97
+ provider: {
98
+ type: string;
99
+ description: string;
100
+ };
101
+ operation: {
102
+ type: string;
103
+ description: string;
104
+ };
105
+ tenantId: {
106
+ type: string;
107
+ description: string;
108
+ };
109
+ input: {
110
+ type: string;
111
+ description: string;
112
+ };
113
+ };
114
+ required: string[];
115
+ };
116
+ export declare const ROUTING_TEST_SCHEMA: {
117
+ type: "object";
118
+ properties: {
119
+ tenantId: {
120
+ type: string;
121
+ description: string;
122
+ };
123
+ message: {
124
+ type: string;
125
+ description: string;
126
+ };
127
+ };
128
+ required: string[];
129
+ };
130
+ export declare const EVAL_SCORE_SCHEMA: {
131
+ type: "object";
132
+ properties: {
133
+ input: {
134
+ type: string;
135
+ description: string;
136
+ };
137
+ output: {
138
+ type: string;
139
+ description: string;
140
+ };
141
+ expected: {
142
+ type: string;
143
+ description: string;
144
+ };
145
+ scorers: {
146
+ type: string;
147
+ items: {
148
+ type: string;
149
+ };
150
+ description: string;
151
+ };
152
+ };
153
+ required: string[];
154
+ };
155
+ export declare const ENRICHMENT_GET_SCHEMA: {
156
+ type: "object";
157
+ properties: {
158
+ sessionId: {
159
+ type: string;
160
+ description: string;
161
+ };
162
+ };
163
+ required: string[];
164
+ };
165
+ export declare const ENRICHMENT_LIST_SCHEMA: {
166
+ type: "object";
167
+ properties: {
168
+ tenantId: {
169
+ type: string;
170
+ description: string;
171
+ };
172
+ limit: {
173
+ type: string;
174
+ description: string;
175
+ };
176
+ cursor: {
177
+ type: string;
178
+ description: string;
179
+ };
180
+ };
181
+ required: string[];
182
+ };
183
+ export declare const CROSS_AGENT_MEMORY_RECALL_SCHEMA: {
184
+ type: "object";
185
+ properties: {
186
+ key: {
187
+ type: string;
188
+ description: string;
189
+ };
190
+ query: {
191
+ type: string;
192
+ description: string;
193
+ };
194
+ };
195
+ required: string[];
196
+ };
197
+ export declare const CROSS_AGENT_MEMORY_STORE_SCHEMA: {
198
+ type: "object";
199
+ properties: {
200
+ key: {
201
+ type: string;
202
+ description: string;
203
+ };
204
+ content: {
205
+ type: string;
206
+ description: string;
207
+ };
208
+ tags: {
209
+ type: string;
210
+ description: string;
211
+ };
212
+ };
213
+ required: string[];
214
+ };
215
+ export declare const BUDGET_CHECK_SCHEMA: {
216
+ type: "object";
217
+ properties: {
218
+ tenantId: {
219
+ type: string;
220
+ description: string;
221
+ };
222
+ appName: {
223
+ type: string;
224
+ description: string;
225
+ };
226
+ };
227
+ required: string[];
228
+ };
229
+ export declare const BUDGET_REPORT_SCHEMA: {
230
+ type: "object";
231
+ properties: {
232
+ tenantId: {
233
+ type: string;
234
+ description: string;
235
+ };
236
+ appName: {
237
+ type: string;
238
+ description: string;
239
+ };
240
+ messages: {
241
+ type: string;
242
+ description: string;
243
+ };
244
+ tokens: {
245
+ type: string;
246
+ description: string;
247
+ };
248
+ model: {
249
+ type: string;
250
+ description: string;
251
+ };
252
+ };
253
+ required: string[];
254
+ };
255
+ /** All tool definitions for the gateway MCP server */
256
+ export declare const GATEWAY_MCP_TOOLS: readonly [{
257
+ readonly name: "memory_recall";
258
+ readonly description: "Recall memory entries by scope with optional FTS search query and tag filter";
259
+ readonly inputSchema: {
260
+ type: "object";
261
+ properties: {
262
+ scope: {
263
+ type: string;
264
+ description: string;
265
+ };
266
+ query: {
267
+ type: string;
268
+ description: string;
269
+ };
270
+ tags: {
271
+ type: string;
272
+ description: string;
273
+ };
274
+ };
275
+ required: string[];
276
+ };
277
+ }, {
278
+ readonly name: "memory_store";
279
+ readonly description: "Store a new memory entry with scope, key, content, and optional tags";
280
+ readonly inputSchema: {
281
+ type: "object";
282
+ properties: {
283
+ scope: {
284
+ type: string;
285
+ description: string;
286
+ };
287
+ key: {
288
+ type: string;
289
+ description: string;
290
+ };
291
+ content: {
292
+ type: string;
293
+ description: string;
294
+ };
295
+ tags: {
296
+ type: string;
297
+ description: string;
298
+ };
299
+ };
300
+ required: string[];
301
+ };
302
+ }, {
303
+ readonly name: "memory_delete";
304
+ readonly description: "Delete a memory entry by its ID";
305
+ readonly inputSchema: {
306
+ type: "object";
307
+ properties: {
308
+ id: {
309
+ type: string;
310
+ description: string;
311
+ };
312
+ };
313
+ required: string[];
314
+ };
315
+ }, {
316
+ readonly name: "knowledge_search";
317
+ readonly description: "Search the knowledge base using natural language. Returns ranked results with content and relevance scores.";
318
+ readonly inputSchema: {
319
+ type: "object";
320
+ properties: {
321
+ appName: {
322
+ type: string;
323
+ description: string;
324
+ };
325
+ query: {
326
+ type: string;
327
+ description: string;
328
+ };
329
+ limit: {
330
+ type: string;
331
+ description: string;
332
+ };
333
+ };
334
+ required: string[];
335
+ };
336
+ }, {
337
+ readonly name: "knowledge_sources";
338
+ readonly description: "List all knowledge sources registered for an app";
339
+ readonly inputSchema: {
340
+ type: "object";
341
+ properties: {
342
+ appName: {
343
+ type: string;
344
+ description: string;
345
+ };
346
+ };
347
+ required: string[];
348
+ };
349
+ }, {
350
+ readonly name: "cost_summary";
351
+ readonly description: "Get the current cost summary including total tokens, cost in USD, and per-role:model breakdown";
352
+ readonly inputSchema: {
353
+ type: "object";
354
+ properties: {};
355
+ required: string[];
356
+ };
357
+ }, {
358
+ readonly name: "safety_metrics";
359
+ readonly description: "Get safety pipeline metrics including PII detections, content classifications, and rail triggers";
360
+ readonly inputSchema: {
361
+ type: "object";
362
+ properties: {};
363
+ required: string[];
364
+ };
365
+ }, {
366
+ readonly name: "integration_list";
367
+ readonly description: "List all registered integration adapters and their available operations";
368
+ readonly inputSchema: {
369
+ type: "object";
370
+ properties: {};
371
+ required: string[];
372
+ };
373
+ }, {
374
+ readonly name: "integration_execute";
375
+ readonly description: "Execute an integration operation for a tenant using their stored credentials";
376
+ readonly inputSchema: {
377
+ type: "object";
378
+ properties: {
379
+ provider: {
380
+ type: string;
381
+ description: string;
382
+ };
383
+ operation: {
384
+ type: string;
385
+ description: string;
386
+ };
387
+ tenantId: {
388
+ type: string;
389
+ description: string;
390
+ };
391
+ input: {
392
+ type: string;
393
+ description: string;
394
+ };
395
+ };
396
+ required: string[];
397
+ };
398
+ }, {
399
+ readonly name: "routing_test";
400
+ readonly description: "Dry-run tenant message routing: returns agentId, tier, matched pattern, and per-rule diagnostics";
401
+ readonly inputSchema: {
402
+ type: "object";
403
+ properties: {
404
+ tenantId: {
405
+ type: string;
406
+ description: string;
407
+ };
408
+ message: {
409
+ type: string;
410
+ description: string;
411
+ };
412
+ };
413
+ required: string[];
414
+ };
415
+ }, {
416
+ readonly name: "eval_score";
417
+ readonly description: "Score a single input/output pair using the gateway's configured eval scorers";
418
+ readonly inputSchema: {
419
+ type: "object";
420
+ properties: {
421
+ input: {
422
+ type: string;
423
+ description: string;
424
+ };
425
+ output: {
426
+ type: string;
427
+ description: string;
428
+ };
429
+ expected: {
430
+ type: string;
431
+ description: string;
432
+ };
433
+ scorers: {
434
+ type: string;
435
+ items: {
436
+ type: string;
437
+ };
438
+ description: string;
439
+ };
440
+ };
441
+ required: string[];
442
+ };
443
+ }, {
444
+ readonly name: "enrichment_get";
445
+ readonly description: "Retrieve enrichment data for a completed conversation session";
446
+ readonly inputSchema: {
447
+ type: "object";
448
+ properties: {
449
+ sessionId: {
450
+ type: string;
451
+ description: string;
452
+ };
453
+ };
454
+ required: string[];
455
+ };
456
+ }, {
457
+ readonly name: "enrichment_list";
458
+ readonly description: "List enrichment records for a tenant with cursor-based pagination";
459
+ readonly inputSchema: {
460
+ type: "object";
461
+ properties: {
462
+ tenantId: {
463
+ type: string;
464
+ description: string;
465
+ };
466
+ limit: {
467
+ type: string;
468
+ description: string;
469
+ };
470
+ cursor: {
471
+ type: string;
472
+ description: string;
473
+ };
474
+ };
475
+ required: string[];
476
+ };
477
+ }, {
478
+ readonly name: "cross_agent_memory_recall";
479
+ readonly description: "Recall shared memory entries from the team scope, accessible by all agents";
480
+ readonly inputSchema: {
481
+ type: "object";
482
+ properties: {
483
+ key: {
484
+ type: string;
485
+ description: string;
486
+ };
487
+ query: {
488
+ type: string;
489
+ description: string;
490
+ };
491
+ };
492
+ required: string[];
493
+ };
494
+ }, {
495
+ readonly name: "cross_agent_memory_store";
496
+ readonly description: "Store a shared memory entry in the team scope so all agents can access it";
497
+ readonly inputSchema: {
498
+ type: "object";
499
+ properties: {
500
+ key: {
501
+ type: string;
502
+ description: string;
503
+ };
504
+ content: {
505
+ type: string;
506
+ description: string;
507
+ };
508
+ tags: {
509
+ type: string;
510
+ description: string;
511
+ };
512
+ };
513
+ required: string[];
514
+ };
515
+ }, {
516
+ readonly name: "budget_check";
517
+ readonly description: "Check remaining budget for a tenant against the app's billing endpoint";
518
+ readonly inputSchema: {
519
+ type: "object";
520
+ properties: {
521
+ tenantId: {
522
+ type: string;
523
+ description: string;
524
+ };
525
+ appName: {
526
+ type: string;
527
+ description: string;
528
+ };
529
+ };
530
+ required: string[];
531
+ };
532
+ }, {
533
+ readonly name: "budget_report";
534
+ readonly description: "Report token usage for a tenant to the app's billing endpoint";
535
+ readonly inputSchema: {
536
+ type: "object";
537
+ properties: {
538
+ tenantId: {
539
+ type: string;
540
+ description: string;
541
+ };
542
+ appName: {
543
+ type: string;
544
+ description: string;
545
+ };
546
+ messages: {
547
+ type: string;
548
+ description: string;
549
+ };
550
+ tokens: {
551
+ type: string;
552
+ description: string;
553
+ };
554
+ model: {
555
+ type: string;
556
+ description: string;
557
+ };
558
+ };
559
+ required: string[];
560
+ };
561
+ }];
562
+ export type GatewayMcpToolName = (typeof GATEWAY_MCP_TOOLS)[number]["name"];
563
+ //# sourceMappingURL=tool-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-schemas.d.ts","sourceRoot":"","sources":["../../src/mcp/tool-schemas.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAiBhC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;CAqB/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAShC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;CAiBnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;CASpC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;cAGd,MAAM,EAAE;CACzB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;cAGhB,MAAM,EAAE;CACzB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;cAGlB,MAAM,EAAE;CACzB,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;CAStC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;CAa7B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;CAMjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;CAQlC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;cAM3B,MAAM,EAAE;CACzB,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;CAQ3C,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;CAUhC,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA7GZ,MAAM,EAAE;;;;;;;;kBAMR,MAAM,EAAE;;;;;;;;kBAMR,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8DR,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyHhB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC"}