@oas-tools/oas-telemetry 0.7.0-alpha.5 → 0.7.1

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 (121) hide show
  1. package/.env.example +2 -0
  2. package/README.md +35 -17
  3. package/dist/cjs/config/bootConfig.cjs +3 -1
  4. package/dist/cjs/docs/openapi.yaml +1399 -0
  5. package/dist/cjs/index.cjs +1 -0
  6. package/dist/cjs/routesManager.cjs +1 -1
  7. package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.cjs +43 -13
  8. package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.cjs +10 -2
  9. package/dist/cjs/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.cjs +21 -16
  10. package/dist/cjs/telemetry/initializeTelemetry.cjs +39 -15
  11. package/dist/cjs/telemetry/telemetryConfigurator.cjs +6 -9
  12. package/dist/cjs/telemetry/telemetryRegistry.cjs +11 -8
  13. package/dist/cjs/tlm-ai/agent.cjs +54 -84
  14. package/dist/cjs/tlm-ai/aiController.cjs +69 -47
  15. package/dist/cjs/tlm-ai/aiRoutes.cjs +10 -3
  16. package/dist/cjs/tlm-ai/aiService.cjs +109 -0
  17. package/dist/cjs/tlm-ai/tools.cjs +30 -268
  18. package/dist/cjs/tlm-auth/authController.cjs +9 -9
  19. package/dist/cjs/tlm-auth/authMiddleware.cjs +1 -1
  20. package/dist/cjs/tlm-log/logController.cjs +30 -36
  21. package/dist/cjs/tlm-log/logRoutes.cjs +3 -2
  22. package/dist/cjs/tlm-metric/metricsController.cjs +15 -8
  23. package/dist/cjs/tlm-metric/metricsRoutes.cjs +2 -1
  24. package/dist/cjs/tlm-plugin/pluginController.cjs +11 -1
  25. package/dist/cjs/tlm-plugin/pluginProcess.cjs +4 -2
  26. package/dist/cjs/tlm-plugin/pluginService.cjs +3 -0
  27. package/dist/cjs/tlm-trace/traceController.cjs +16 -9
  28. package/dist/cjs/tlm-trace/traceRoutes.cjs +2 -1
  29. package/dist/cjs/tlm-util/utilController.cjs +23 -2
  30. package/dist/cjs/tlm-util/utilRoutes.cjs +44 -5
  31. package/dist/cjs/utils/logger.cjs +35 -13
  32. package/dist/esm/config/bootConfig.js +2 -0
  33. package/dist/esm/docs/openapi.yaml +1399 -0
  34. package/dist/esm/index.js +1 -0
  35. package/dist/esm/routesManager.js +1 -1
  36. package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.js +32 -11
  37. package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.js +10 -2
  38. package/dist/esm/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.js +20 -13
  39. package/dist/esm/telemetry/initializeTelemetry.js +22 -14
  40. package/dist/esm/telemetry/telemetryConfigurator.js +7 -10
  41. package/dist/esm/telemetry/telemetryRegistry.js +10 -7
  42. package/dist/esm/tlm-ai/agent.js +37 -78
  43. package/dist/esm/tlm-ai/aiController.js +56 -39
  44. package/dist/esm/tlm-ai/aiRoutes.js +11 -4
  45. package/dist/esm/tlm-ai/aiService.js +94 -0
  46. package/dist/esm/tlm-ai/tools.js +29 -255
  47. package/dist/esm/tlm-auth/authController.js +8 -8
  48. package/dist/esm/tlm-auth/authMiddleware.js +1 -1
  49. package/dist/esm/tlm-log/logController.js +26 -28
  50. package/dist/esm/tlm-log/logRoutes.js +4 -3
  51. package/dist/esm/tlm-metric/metricsController.js +10 -6
  52. package/dist/esm/tlm-metric/metricsRoutes.js +3 -2
  53. package/dist/esm/tlm-plugin/pluginController.js +2 -1
  54. package/dist/esm/tlm-plugin/pluginProcess.js +4 -2
  55. package/dist/esm/tlm-plugin/pluginService.js +4 -0
  56. package/dist/esm/tlm-trace/traceController.js +11 -7
  57. package/dist/esm/tlm-trace/traceRoutes.js +3 -2
  58. package/dist/esm/tlm-util/utilController.js +22 -0
  59. package/dist/esm/tlm-util/utilRoutes.js +40 -5
  60. package/dist/esm/utils/logger.js +35 -12
  61. package/dist/types/config/bootConfig.d.ts +1 -0
  62. package/dist/types/index.d.ts +2 -1
  63. package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbLogExporter.d.ts +7 -1
  64. package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbMetricExporter.d.ts +1 -0
  65. package/dist/types/telemetry/custom-implementations/exporters/InMemoryDbSpanExporter.d.ts +1 -0
  66. package/dist/types/telemetry/telemetryRegistry.d.ts +22 -6
  67. package/dist/types/tlm-ai/agent.d.ts +2 -2
  68. package/dist/types/tlm-ai/aiController.d.ts +5 -4
  69. package/dist/types/tlm-ai/aiRoutes.d.ts +1 -1
  70. package/dist/types/tlm-ai/aiService.d.ts +38 -0
  71. package/dist/types/tlm-ai/tools.d.ts +5 -14
  72. package/dist/types/tlm-log/logController.d.ts +2 -2
  73. package/dist/types/tlm-metric/metricsController.d.ts +2 -1
  74. package/dist/types/tlm-plugin/pluginService.d.ts +2 -0
  75. package/dist/types/tlm-trace/traceController.d.ts +2 -1
  76. package/dist/types/tlm-util/utilController.d.ts +1 -0
  77. package/dist/types/utils/logger.d.ts +5 -5
  78. package/dist/ui/assets/ApiDocsPage-C_VVPPHa.js +16 -0
  79. package/dist/ui/assets/CollapsibleCard-B3KR_8mL.js +1 -0
  80. package/dist/ui/assets/DevToolsPage-OyZcDcmw.js +1 -0
  81. package/dist/ui/assets/LandingPage-CppFBA6K.js +6 -0
  82. package/dist/ui/assets/LogsPage-9Fq8GArS.js +26 -0
  83. package/dist/ui/assets/NotFoundPage-B3quk3P1.js +1 -0
  84. package/dist/ui/assets/PluginCreatePage-X_aCH4t4.js +50 -0
  85. package/dist/ui/assets/PluginPage-DMDSihrZ.js +27 -0
  86. package/dist/ui/assets/alert-jQ9HCPIf.js +1133 -0
  87. package/dist/ui/assets/badge-CNq0-mH5.js +1 -0
  88. package/dist/ui/assets/card-DFAwwhN3.js +1 -0
  89. package/dist/ui/assets/chevron-down-CPsvsmqj.js +6 -0
  90. package/dist/ui/assets/chevron-up-Df9jMo1X.js +6 -0
  91. package/dist/ui/assets/circle-alert-DOPQPvU8.js +6 -0
  92. package/dist/ui/assets/index-BkD6DijD.js +15 -0
  93. package/dist/ui/assets/index-CERGVYZK.js +292 -0
  94. package/dist/ui/assets/index-CSIPf9qw.css +1 -0
  95. package/dist/ui/assets/input-Dzvg_ZEZ.js +1 -0
  96. package/dist/ui/assets/label-DuVnkZ4q.js +1 -0
  97. package/dist/ui/assets/loader-circle-CrvlRy5o.js +6 -0
  98. package/dist/ui/assets/loginPage-qa4V-B70.js +6 -0
  99. package/dist/ui/assets/select-DhS8YUtJ.js +1 -0
  100. package/dist/ui/assets/separator-isK4chBP.js +6 -0
  101. package/dist/ui/assets/severityOptions-O38dSOfk.js +11 -0
  102. package/dist/ui/assets/switch-Z3mImG9n.js +1 -0
  103. package/dist/ui/assets/tabs-_77MUUQe.js +16 -0
  104. package/dist/ui/assets/upload-C1LT4Gkb.js +16 -0
  105. package/dist/ui/assets/utilService-DNyqzwj0.js +1 -0
  106. package/dist/ui/index.html +2 -2
  107. package/package.json +24 -14
  108. package/dist/cjs/telemetry/custom-implementations/exporters/PluginLogExporter.cjs +0 -45
  109. package/dist/cjs/telemetry/custom-implementations/exporters/PluginMetricExporter.cjs +0 -46
  110. package/dist/cjs/telemetry/custom-implementations/exporters/PluginSpanExporter.cjs +0 -61
  111. package/dist/cjs/tlm-ai/knownMicroservices.cjs +0 -13
  112. package/dist/esm/telemetry/custom-implementations/exporters/PluginLogExporter.js +0 -36
  113. package/dist/esm/telemetry/custom-implementations/exporters/PluginMetricExporter.js +0 -35
  114. package/dist/esm/telemetry/custom-implementations/exporters/PluginSpanExporter.js +0 -52
  115. package/dist/esm/tlm-ai/knownMicroservices.js +0 -5
  116. package/dist/types/telemetry/custom-implementations/exporters/PluginLogExporter.d.ts +0 -8
  117. package/dist/types/telemetry/custom-implementations/exporters/PluginMetricExporter.d.ts +0 -12
  118. package/dist/types/telemetry/custom-implementations/exporters/PluginSpanExporter.d.ts +0 -14
  119. package/dist/types/tlm-ai/knownMicroservices.d.ts +0 -6
  120. package/dist/ui/assets/index-Bgd7fFFH.js +0 -1743
  121. package/dist/ui/assets/index-Cz3N1n1Q.css +0 -1
@@ -0,0 +1,1399 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: '@oas-tools/oas-telemetry'
4
+ version: 0.7.0-alpha.2
5
+ license:
6
+ name: Apache-2.0
7
+ description: |-
8
+ Automatically collects and stores telemetry data in memory using OpenTelemetry.
9
+ Just import the Express middleware to access it through the built-in REST API or web UI—no extra setup required.
10
+
11
+ components:
12
+ securitySchemes:
13
+ CookieAuth:
14
+ type: apiKey
15
+ in: cookie
16
+ name: oas-tlm-access-token
17
+
18
+ security:
19
+ - CookieAuth: []
20
+
21
+ servers:
22
+ - url: "{protocol}://{host}:{port}/{basePath}"
23
+ variables:
24
+ protocol:
25
+ default: http
26
+ enum:
27
+ - http
28
+ - https
29
+ host:
30
+ default: localhost
31
+ port:
32
+ default: "3000"
33
+ basePath:
34
+ default: telemetry
35
+ description: Base path for all endpoints. Can be customized, e.g. "myCustomTelemetryPath"
36
+
37
+ tags:
38
+ - name: traces
39
+ description: Operations for managing telemetry traces
40
+ - name: metrics
41
+ description: Operations for managing telemetry metrics
42
+ - name: logs
43
+ description: Operations for managing telemetry logs
44
+ - name: utils
45
+ description: Utility endpoints
46
+ - name: ui
47
+ description: User interface
48
+ - name: ai
49
+ description: AI-related operations
50
+ - name: plugins
51
+ description: Operations for managing plugins
52
+ - name: auth
53
+ description: Authentication operations
54
+
55
+ paths:
56
+ /:
57
+ get:
58
+ summary: Redirect to telemetry UI (Only works in production mode)
59
+ tags:
60
+ - ui
61
+ responses:
62
+ '302':
63
+ description: Found
64
+ content:
65
+ text/html:
66
+ schema:
67
+ type: string
68
+ example: <p>Found. Redirecting to /oas-telemetry-ui</p>
69
+
70
+ /oas-telemetry-ui:
71
+ get:
72
+ summary: OAS-Telemetry Web UI (Only works in production mode)
73
+ tags:
74
+ - ui
75
+ responses:
76
+ '200':
77
+ description: OK
78
+ content:
79
+ text/html:
80
+ schema:
81
+ type: string
82
+ example: <!DOCTYPE html><title>OAS-Telemetry UI</title></head><body><h1>Welcome to OAS-Telemetry UI</h1></body></html>
83
+
84
+ /traces:
85
+ get:
86
+ summary: Get collected traces
87
+ tags:
88
+ - traces
89
+ responses:
90
+ '200':
91
+ description: OK
92
+ content:
93
+ application/json:
94
+ schema:
95
+ type: object
96
+ properties:
97
+ spansCount:
98
+ type: number
99
+ example: 0
100
+ spans:
101
+ type: array
102
+ items:
103
+ type: object
104
+ example: []
105
+ post:
106
+ summary: Insert traces (optionally reset first)
107
+ description: |
108
+ Inserts traces. If the query parameter `reset=true` is provided, the trace database is reset before inserting.
109
+ The response message will indicate whether a reset occurred.
110
+ tags:
111
+ - traces
112
+ parameters:
113
+ - name: reset
114
+ in: query
115
+ required: false
116
+ schema:
117
+ type: string
118
+ enum:
119
+ - "true"
120
+ - "false"
121
+ description: If true, reset the database before inserting
122
+ requestBody:
123
+ required: true
124
+ content:
125
+ application/json:
126
+ schema:
127
+ type: object
128
+ properties:
129
+ spans:
130
+ type: array
131
+ items:
132
+ type: object
133
+ description: Array of trace objects to insert
134
+ example:
135
+ spans:
136
+ - traceId: "123"
137
+ spanId: "456"
138
+ responses:
139
+ '200':
140
+ description: OK
141
+ content:
142
+ application/json:
143
+ schema:
144
+ type: object
145
+ properties:
146
+ message:
147
+ type: string
148
+ example: Inserted 1 traces.
149
+ InsertedTracesCount:
150
+ type: number
151
+ example: 1
152
+ '400':
153
+ description: Bad Request
154
+ content:
155
+ application/json:
156
+ schema:
157
+ type: object
158
+ properties:
159
+ error:
160
+ type: string
161
+ example: Invalid data format. Expected an array of JSON objects.
162
+
163
+ /traces/find:
164
+ post:
165
+ summary: Find traces
166
+ tags:
167
+ - traces
168
+ requestBody:
169
+ required: true
170
+ description: Search criteria for traces.
171
+ content:
172
+ application/json:
173
+ schema:
174
+ type: object
175
+ properties:
176
+ query:
177
+ type: object
178
+ additionalProperties: true
179
+ description: Mongo-like query criteria
180
+ example:
181
+ attributes.http.target:
182
+ $regex: "^/api/v1/pets.*$"
183
+ attributes.http.method: "GET"
184
+ $or:
185
+ - attributes.http.status_code:
186
+ $lte: 400
187
+ responses:
188
+ '200':
189
+ description: OK
190
+ content:
191
+ application/json:
192
+ schema:
193
+ type: object
194
+ properties:
195
+ spansCount:
196
+ type: number
197
+ example: 0
198
+ spans:
199
+ type: array
200
+ items:
201
+ type: object
202
+ example: []
203
+ '400':
204
+ description: Bad Request
205
+ content:
206
+ application/json:
207
+ schema:
208
+ type: object
209
+ properties:
210
+ error:
211
+ type: string
212
+ example: Invalid regex in query
213
+
214
+ /traces/start:
215
+ post:
216
+ summary: Start trace collection
217
+ tags:
218
+ - traces
219
+ responses:
220
+ '200':
221
+ description: OK
222
+ content:
223
+ text/html:
224
+ schema:
225
+ type: string
226
+ example: Traces started
227
+
228
+ /traces/stop:
229
+ post:
230
+ summary: Stop trace collection
231
+ tags:
232
+ - traces
233
+ responses:
234
+ '200':
235
+ description: OK
236
+ content:
237
+ text/html:
238
+ schema:
239
+ type: string
240
+ example: Traces stopped
241
+
242
+ /traces/status:
243
+ get:
244
+ summary: Get trace collection status
245
+ tags:
246
+ - traces
247
+ responses:
248
+ '200':
249
+ description: OK
250
+ content:
251
+ application/json:
252
+ schema:
253
+ type: object
254
+ properties:
255
+ active:
256
+ type: boolean
257
+ example: true
258
+
259
+ /traces/reset:
260
+ post:
261
+ summary: Reset trace database
262
+ tags:
263
+ - traces
264
+ responses:
265
+ '200':
266
+ description: OK
267
+ content:
268
+ text/html:
269
+ schema:
270
+ type: string
271
+ example: Traces reset
272
+
273
+ /traces/retention-time:
274
+ get:
275
+ summary: Get trace retention time (seconds)
276
+ tags:
277
+ - traces
278
+ responses:
279
+ '200':
280
+ description: OK
281
+ content:
282
+ application/json:
283
+ schema:
284
+ type: object
285
+ properties:
286
+ retentionTimeInSeconds:
287
+ type: number
288
+ example: 3600
289
+ post:
290
+ summary: Set retention time for traces
291
+ tags:
292
+ - traces
293
+ requestBody:
294
+ required: true
295
+ description: Retention time in seconds.
296
+ content:
297
+ application/json:
298
+ schema:
299
+ type: object
300
+ properties:
301
+ retentionTimeInSeconds:
302
+ type: number
303
+ description: Retention time in seconds.
304
+ example: 3600
305
+ example:
306
+ retentionTimeInSeconds: 3600
307
+ responses:
308
+ '200':
309
+ description: OK
310
+ content:
311
+ application/json:
312
+ schema:
313
+ type: object
314
+ properties:
315
+ message:
316
+ type: string
317
+ example: Retention time set to 3600 seconds.
318
+ '400':
319
+ description: Bad Request
320
+ content:
321
+ application/json:
322
+ schema:
323
+ type: object
324
+ properties:
325
+ error:
326
+ type: string
327
+ example: Invalid retention time. Must be a positive number.
328
+
329
+ /metrics:
330
+ get:
331
+ summary: Get collected metrics
332
+ tags:
333
+ - metrics
334
+ responses:
335
+ '200':
336
+ description: OK
337
+ content:
338
+ application/json:
339
+ schema:
340
+ type: object
341
+ properties:
342
+ metricsCount:
343
+ type: number
344
+ example: 0
345
+ metrics:
346
+ type: array
347
+ items:
348
+ type: object
349
+ example: []
350
+ post:
351
+ summary: Insert metrics (optionally reset first)
352
+ description: |
353
+ Inserts metrics. If the query parameter `reset=true` is provided, the metrics database is reset before inserting.
354
+ The response message will indicate whether a reset occurred.
355
+ tags:
356
+ - metrics
357
+ parameters:
358
+ - name: reset
359
+ in: query
360
+ required: false
361
+ schema:
362
+ type: boolean
363
+ description: If true, reset the database before inserting
364
+ responses:
365
+ '200':
366
+ description: OK
367
+ content:
368
+ application/json:
369
+ schema:
370
+ type: object
371
+ properties:
372
+ message:
373
+ type: string
374
+ example: Inserted 25 metrics.
375
+ InsertedMetricsCount:
376
+ type: number
377
+ example: 25
378
+ '400':
379
+ description: Bad Request
380
+ content:
381
+ application/json:
382
+ schema:
383
+ type: object
384
+ properties:
385
+ error:
386
+ type: string
387
+ example: Invalid data format. Expected an array of JSON objects.
388
+
389
+ /metrics/find:
390
+ post:
391
+ summary: Find metrics
392
+ tags:
393
+ - metrics
394
+ requestBody:
395
+ required: true
396
+ description: Mongo-like (nedb) query object for metrics filtering.
397
+ content:
398
+ application/json:
399
+ schema:
400
+ type: object
401
+ properties:
402
+ query:
403
+ type: object
404
+ additionalProperties: true
405
+ description: Mongo-like query criteria
406
+ example:
407
+ metricId: "123"
408
+ responses:
409
+ '200':
410
+ description: OK
411
+ content:
412
+ application/json:
413
+ schema:
414
+ type: object
415
+ properties:
416
+ metricsCount:
417
+ type: number
418
+ example: 0
419
+ metrics:
420
+ type: array
421
+ items:
422
+ type: object
423
+ example: []
424
+ '400':
425
+ description: Bad Request
426
+ content:
427
+ application/json:
428
+ schema:
429
+ type: object
430
+ properties:
431
+ error:
432
+ type: string
433
+ example: Invalid regex in query
434
+
435
+
436
+ /metrics/start:
437
+ post:
438
+ summary: Start metrics collection
439
+ tags:
440
+ - metrics
441
+ responses:
442
+ '200':
443
+ description: OK
444
+ content:
445
+ text/html:
446
+ schema:
447
+ type: string
448
+ example: Metrics collection started
449
+
450
+ /metrics/stop:
451
+ post:
452
+ summary: Stop metrics collection
453
+ tags:
454
+ - metrics
455
+ responses:
456
+ '200':
457
+ description: OK
458
+ content:
459
+ text/html:
460
+ schema:
461
+ type: string
462
+ example: Metrics collection stopped
463
+
464
+ /metrics/status:
465
+ get:
466
+ summary: Get metrics collection status
467
+ tags:
468
+ - metrics
469
+ responses:
470
+ '200':
471
+ description: OK
472
+ content:
473
+ application/json:
474
+ schema:
475
+ type: object
476
+ properties:
477
+ active:
478
+ type: boolean
479
+ example: true
480
+
481
+ /metrics/reset:
482
+ post:
483
+ summary: Reset metrics database
484
+ tags:
485
+ - metrics
486
+ responses:
487
+ '200':
488
+ description: OK
489
+ content:
490
+ text/html:
491
+ schema:
492
+ type: string
493
+ example: Metrics reset
494
+
495
+ /metrics/retention-time:
496
+ get:
497
+ summary: Get metrics retention time (seconds)
498
+ tags:
499
+ - metrics
500
+ responses:
501
+ '200':
502
+ description: OK
503
+ content:
504
+ application/json:
505
+ schema:
506
+ type: object
507
+ properties:
508
+ retentionTimeInSeconds:
509
+ type: number
510
+ example: 3600
511
+ post:
512
+ summary: Set retention time for metrics
513
+ tags:
514
+ - metrics
515
+ requestBody:
516
+ required: true
517
+ description: Retention time in seconds.
518
+ content:
519
+ application/json:
520
+ schema:
521
+ type: object
522
+ properties:
523
+ retentionTimeInSeconds:
524
+ type: number
525
+ description: Retention time in seconds.
526
+ example: 3600
527
+ example:
528
+ retentionTimeInSeconds: 3600
529
+ responses:
530
+ '200':
531
+ description: OK
532
+ content:
533
+ application/json:
534
+ schema:
535
+ type: object
536
+ properties:
537
+ message:
538
+ type: string
539
+ example: Retention time set to 3600 seconds.
540
+ '400':
541
+ description: Bad Request
542
+ content:
543
+ application/json:
544
+ schema:
545
+ type: object
546
+ properties:
547
+ error:
548
+ type: string
549
+ example: Invalid retention time. Must be a positive number.
550
+
551
+ /logs:
552
+ get:
553
+ summary: Get collected logs
554
+ tags:
555
+ - logs
556
+ responses:
557
+ '200':
558
+ description: OK
559
+ content:
560
+ application/json:
561
+ schema:
562
+ type: object
563
+ properties:
564
+ items:
565
+ type: array
566
+ items: {}
567
+ example:
568
+ items: []
569
+ post:
570
+ summary: Insert logs (optionally reset first)
571
+ description: |
572
+ Inserts logs. If the query parameter `reset=true` is provided, the logs database is reset before inserting.
573
+ The response message will indicate whether a reset occurred.
574
+ tags:
575
+ - logs
576
+ parameters:
577
+ - name: reset
578
+ in: query
579
+ required: false
580
+ schema:
581
+ type: string
582
+ enum:
583
+ - "true"
584
+ - "false"
585
+ description: If true, reset the database before inserting
586
+ requestBody:
587
+ required: true
588
+ content:
589
+ application/json:
590
+ schema:
591
+ type: object
592
+ properties:
593
+ logs:
594
+ type: array
595
+ items:
596
+ type: object
597
+ description: Array of log objects to insert
598
+ example:
599
+ logs:
600
+ - body: "Hello World!"
601
+ responses:
602
+ '200':
603
+ description: OK
604
+ content:
605
+ application/json:
606
+ schema:
607
+ type: object
608
+ properties:
609
+ message:
610
+ type: string
611
+ example: Inserted 6 logs.
612
+ InsertedLogsCount:
613
+ type: number
614
+ example: 6
615
+ '400':
616
+ description: Bad Request
617
+ content:
618
+ application/json:
619
+ schema:
620
+ type: object
621
+ properties:
622
+ error:
623
+ type: string
624
+ example: Invalid data format. Expected an array of JSON objects.
625
+
626
+ /logs/find:
627
+ post:
628
+ summary: Find logs
629
+ tags:
630
+ - logs
631
+ requestBody:
632
+ required: true
633
+ description: Search criteria for logs. Supports textSearch, a Mongo-like (nedb) query, and sort.
634
+ content:
635
+ application/json:
636
+ schema:
637
+ type: object
638
+ properties:
639
+ textSearch:
640
+ type: string
641
+ description: Text that the log body must contain
642
+ query:
643
+ type: object
644
+ additionalProperties: true
645
+ description: Mongo-like query criteria
646
+ sort:
647
+ type: object
648
+ additionalProperties: true
649
+ description: Sort order for logs
650
+ example:
651
+ timestamp: -1
652
+ limit:
653
+ type: integer
654
+ description: Number of logs to return
655
+ default: 50
656
+ example:
657
+ textSearch: "World!"
658
+ query: {}
659
+ sort:
660
+ timestamp: -1
661
+ limit: 50
662
+ responses:
663
+ '200':
664
+ description: OK
665
+ content:
666
+ application/json:
667
+ schema:
668
+ type: object
669
+ properties:
670
+ items:
671
+ type: array
672
+ items: {}
673
+ example:
674
+ items: []
675
+ '400':
676
+ description: Bad Request
677
+ content:
678
+ application/json:
679
+ schema:
680
+ type: object
681
+ properties:
682
+ error:
683
+ type: string
684
+ example: Invalid regex in query
685
+
686
+ /utils/spec:
687
+ get:
688
+ summary: Get OpenAPI spec in JSON
689
+ tags:
690
+ - utils
691
+ responses:
692
+ '200':
693
+ description: OK
694
+ content:
695
+ application/json:
696
+ schema:
697
+ type: object
698
+ properties:
699
+ paths:
700
+ type: object
701
+
702
+ /utils/heapStats:
703
+ get:
704
+ summary: Get heap statistics
705
+ tags:
706
+ - utils
707
+ responses:
708
+ '200':
709
+ description: OK
710
+ content:
711
+ application/json:
712
+ schema:
713
+ type: object
714
+ properties:
715
+ total_heap_size:
716
+ type: number
717
+ total_heap_size_executable:
718
+ type: number
719
+ total_physical_size:
720
+ type: number
721
+ total_available_size:
722
+ type: number
723
+ used_heap_size:
724
+ type: number
725
+ heap_size_limit:
726
+ type: number
727
+ malloced_memory:
728
+ type: number
729
+ peak_malloced_memory:
730
+ type: number
731
+ does_zap_garbage:
732
+ type: integer
733
+ number_of_native_contexts:
734
+ type: integer
735
+ number_of_detached_contexts:
736
+ type: integer
737
+ total_global_handles_size:
738
+ type: number
739
+ used_global_handles_size:
740
+ type: number
741
+ external_memory:
742
+ type: number
743
+ units:
744
+ type: string
745
+ example:
746
+ total_heap_size: 46.418
747
+ total_heap_size_executable: 3
748
+ total_physical_size: 46.418
749
+ total_available_size: 4101.352
750
+ used_heap_size: 42.636
751
+ heap_size_limit: 4144
752
+ malloced_memory: 0.531
753
+ peak_malloced_memory: 67.936
754
+ does_zap_garbage: 0
755
+ number_of_native_contexts: 0
756
+ number_of_detached_contexts: 0
757
+ total_global_handles_size: 0.055
758
+ used_global_handles_size: 0.04
759
+ external_memory: 9.393
760
+ units: "MB"
761
+
762
+ /utils/generate-log:
763
+ post:
764
+ summary: Generate a sample log
765
+ tags:
766
+ - utils
767
+ requestBody:
768
+ required: true
769
+ content:
770
+ application/json:
771
+ schema:
772
+ type: object
773
+ properties:
774
+ log:
775
+ type: string
776
+ description: The log message to generate. Defaults to "Default log message" if not specified.
777
+ repeat:
778
+ type: integer
779
+ description: Number of times to repeat the log message.
780
+ default: 1
781
+ method:
782
+ type: string
783
+ description: Log method (log, warn, error, info, debug).
784
+ enum: [log, warn, error, info, debug]
785
+ default: log
786
+ example:
787
+ log: "Hello World!"
788
+ repeat: 2
789
+ method: "info"
790
+ responses:
791
+ '200':
792
+ description: OK
793
+ content:
794
+ application/json:
795
+ schema:
796
+ type: object
797
+ properties:
798
+ message:
799
+ type: string
800
+ example: Log generated
801
+ log:
802
+ type: string
803
+ example: Hello World!
804
+ '400':
805
+ description: Bad Request
806
+ content:
807
+ application/json:
808
+ schema:
809
+ type: object
810
+ properties:
811
+ error:
812
+ type: string
813
+ example: Invalid method. Use log, warn, error, info, or debug.
814
+
815
+ /utils/generate-mock-logs:
816
+ post:
817
+ summary: Generate mock logs
818
+ tags:
819
+ - utils
820
+ requestBody:
821
+ required: true
822
+ content:
823
+ application/json:
824
+ schema:
825
+ type: object
826
+ properties:
827
+ count:
828
+ type: integer
829
+ description: Number of mock logs to generate.
830
+ default: 50
831
+ example:
832
+ count: 100
833
+ responses:
834
+ '200':
835
+ description: OK
836
+ content:
837
+ application/json:
838
+ schema:
839
+ type: object
840
+ properties:
841
+ message:
842
+ type: string
843
+ example: Started generating mock logs
844
+
845
+ /utils/generate-wait/{seconds}:
846
+ get:
847
+ summary: Wait for the specified seconds
848
+ tags:
849
+ - utils
850
+ parameters:
851
+ - name: seconds
852
+ in: path
853
+ required: false
854
+ schema:
855
+ type: integer
856
+ default: 1
857
+ description: Number of seconds to wait. Defaults to 1 if not specified.
858
+ responses:
859
+ '200':
860
+ description: OK
861
+ content:
862
+ application/json:
863
+ schema:
864
+ type: object
865
+ properties:
866
+ waited:
867
+ type: number
868
+ example: 2
869
+
870
+ /health:
871
+ get:
872
+ summary: Health check
873
+ tags:
874
+ - utils
875
+ responses:
876
+ '200':
877
+ description: OK
878
+ content:
879
+ application/json:
880
+ schema:
881
+ type: object
882
+ properties:
883
+ status:
884
+ type: string
885
+ example: OK
886
+
887
+
888
+ /plugins:
889
+ get:
890
+ summary: List all registered plugins
891
+ tags:
892
+ - plugins
893
+ responses:
894
+ '200':
895
+ description: OK
896
+ content:
897
+ application/json:
898
+ schema:
899
+ type: object
900
+ properties:
901
+ pluginsCount:
902
+ type: integer
903
+ description: Number of plugins
904
+ plugins:
905
+ type: array
906
+ items:
907
+ type: object
908
+ properties:
909
+ id:
910
+ type: string
911
+ name:
912
+ type: string
913
+ url:
914
+ type: string
915
+ active:
916
+ type: boolean
917
+ example:
918
+ pluginsCount: 1
919
+ plugins:
920
+ - id: "plugin-1"
921
+ name: "Sample Plugin"
922
+ url: "https://example.com/plugin.js"
923
+ active: true
924
+ post:
925
+ summary: Register a new plugin
926
+ tags:
927
+ - plugins
928
+ requestBody:
929
+ required: true
930
+ description: Plugin registration details
931
+ content:
932
+ application/json:
933
+ schema:
934
+ type: object
935
+ required:
936
+ - id
937
+ - moduleFormat
938
+ properties:
939
+ id:
940
+ type: string
941
+ description: Unique identifier for the plugin
942
+ url:
943
+ type: string
944
+ description: URL of the plugin to register
945
+ code:
946
+ type: string
947
+ description: Inline code of the plugin (optional if URL is provided)
948
+ install:
949
+ type: object
950
+ description: Dependencies to install for the plugin
951
+ properties:
952
+ dependencies:
953
+ type: array
954
+ items:
955
+ type: string
956
+ description: List of dependencies
957
+ ignoreErrors:
958
+ type: boolean
959
+ description: Whether to ignore errors during installation
960
+ config:
961
+ type: object
962
+ description: Configuration for the plugin
963
+ moduleFormat:
964
+ type: string
965
+ description: Module format of the plugin (e.g., "ESM" or "CJS")
966
+ example:
967
+ id: "plugin-1"
968
+ name: "Sample Plugin"
969
+ description: "A sample plugin for demonstration"
970
+ code: "console.log('Hello from plugin');export const plugin = {load:()=>{console.log('Plugin loaded')}, isConfigured:()=>true};"
971
+ install:
972
+ dependencies: []
973
+ ignoreErrors: true
974
+ config:
975
+ key: "value"
976
+ moduleFormat: "ESM"
977
+ responses:
978
+ '201':
979
+ description: Plugin registered successfully
980
+ '400':
981
+ description: Bad Request
982
+ content:
983
+ application/json:
984
+ schema:
985
+ type: object
986
+ properties:
987
+ error:
988
+ type: string
989
+ example: "Plugin code or URL must be provided"
990
+
991
+ /plugins/{id}/activate:
992
+ post:
993
+ summary: Activate a plugin
994
+ tags:
995
+ - plugins
996
+ parameters:
997
+ - name: id
998
+ in: path
999
+ required: true
1000
+ schema:
1001
+ type: string
1002
+ description: Plugin ID
1003
+ responses:
1004
+ '200':
1005
+ description: Plugin activated
1006
+ content:
1007
+ text/plain:
1008
+ schema:
1009
+ type: string
1010
+ example: Plugin "plugin-1" activated.
1011
+ '404':
1012
+ description: Plugin not found
1013
+ content:
1014
+ text/plain:
1015
+ schema:
1016
+ type: string
1017
+ example: Plugin with id "plugin-1" not found.
1018
+
1019
+ /plugins/{id}/deactivate:
1020
+ post:
1021
+ summary: Deactivate a plugin
1022
+ tags:
1023
+ - plugins
1024
+ parameters:
1025
+ - name: id
1026
+ in: path
1027
+ required: true
1028
+ schema:
1029
+ type: string
1030
+ description: Plugin ID
1031
+ responses:
1032
+ '200':
1033
+ description: Plugin deactivated
1034
+ content:
1035
+ text/plain:
1036
+ schema:
1037
+ type: string
1038
+ example: Plugin "plugin-1" deactivated.
1039
+ '404':
1040
+ description: Plugin not found
1041
+ content:
1042
+ text/plain:
1043
+ schema:
1044
+ type: string
1045
+ example: Plugin with id "plugin-1" not found.
1046
+
1047
+ /plugins/{id}:
1048
+ delete:
1049
+ summary: Delete a plugin
1050
+ tags:
1051
+ - plugins
1052
+ parameters:
1053
+ - name: id
1054
+ in: path
1055
+ required: true
1056
+ schema:
1057
+ type: string
1058
+ description: Plugin ID
1059
+ responses:
1060
+ '200':
1061
+ description: Plugin deleted
1062
+ content:
1063
+ text/plain:
1064
+ schema:
1065
+ type: string
1066
+ example: Plugin "plugin-1" deleted.
1067
+ '404':
1068
+ description: Plugin not found
1069
+ content:
1070
+ text/plain:
1071
+ schema:
1072
+ type: string
1073
+ example: Plugin with id "plugin-1" not found.
1074
+
1075
+ /auth/login:
1076
+ post:
1077
+ summary: Login and obtain authentication cookies
1078
+ tags:
1079
+ - auth
1080
+ requestBody:
1081
+ required: true
1082
+ description: Login credentials
1083
+ content:
1084
+ application/json:
1085
+ schema:
1086
+ type: object
1087
+ properties:
1088
+ password:
1089
+ type: string
1090
+ description: Password for authentication
1091
+ required:
1092
+ - password
1093
+ example:
1094
+ password: "your-password"
1095
+ responses:
1096
+ '200':
1097
+ description: Login successful, cookies set
1098
+ headers:
1099
+ Set-Cookie:
1100
+ schema:
1101
+ type: string
1102
+ description: |
1103
+ Sets oas-tlm-access-token and oas-tlm-refresh-token cookies.
1104
+ content:
1105
+ application/json:
1106
+ schema:
1107
+ type: object
1108
+ properties:
1109
+ valid:
1110
+ type: boolean
1111
+ message:
1112
+ type: string
1113
+ example:
1114
+ valid: true
1115
+ message: Login successful
1116
+ '400':
1117
+ description: Invalid password
1118
+ content:
1119
+ application/json:
1120
+ schema:
1121
+ type: object
1122
+ properties:
1123
+ valid:
1124
+ type: boolean
1125
+ message:
1126
+ type: string
1127
+ example:
1128
+ valid: false
1129
+ message: Invalid password
1130
+
1131
+ /auth/logout:
1132
+ post:
1133
+ summary: Logout and clear authentication cookies
1134
+ tags:
1135
+ - auth
1136
+ responses:
1137
+ '200':
1138
+ description: Logout successful, cookies cleared
1139
+ headers:
1140
+ Set-Cookie:
1141
+ schema:
1142
+ type: string
1143
+ description: |
1144
+ Clears oas-tlm-access-token and oas-tlm-refresh-token cookies.
1145
+ content:
1146
+ application/json:
1147
+ schema:
1148
+ type: object
1149
+ properties:
1150
+ valid:
1151
+ type: boolean
1152
+ message:
1153
+ type: string
1154
+ example:
1155
+ valid: true
1156
+ message: Logged out
1157
+
1158
+ /auth/refresh:
1159
+ post:
1160
+ summary: Refresh access token using refresh token cookie
1161
+ tags:
1162
+ - auth
1163
+ responses:
1164
+ '200':
1165
+ description: Access token refreshed, new cookie set
1166
+ headers:
1167
+ Set-Cookie:
1168
+ schema:
1169
+ type: string
1170
+ description: |
1171
+ Sets a new oas-tlm-access-token cookie.
1172
+ content:
1173
+ application/json:
1174
+ schema:
1175
+ type: object
1176
+ properties:
1177
+ valid:
1178
+ type: boolean
1179
+ message:
1180
+ type: string
1181
+ example:
1182
+ valid: true
1183
+ message: Refreshed
1184
+ '401':
1185
+ description: Invalid or missing refresh token
1186
+ content:
1187
+ application/json:
1188
+ schema:
1189
+ type: object
1190
+ properties:
1191
+ valid:
1192
+ type: boolean
1193
+ message:
1194
+ type: string
1195
+ example:
1196
+ valid: false
1197
+ message: Invalid refresh token
1198
+
1199
+ /auth/enabled:
1200
+ get:
1201
+ summary: Check if authentication is enabled
1202
+ tags:
1203
+ - auth
1204
+ responses:
1205
+ '200':
1206
+ description: Returns whether authentication is enabled
1207
+ content:
1208
+ application/json:
1209
+ schema:
1210
+ type: object
1211
+ properties:
1212
+ enabled:
1213
+ type: boolean
1214
+ example:
1215
+ enabled: true
1216
+
1217
+ /ai/chat/health:
1218
+ get:
1219
+ summary: AI service health (alias)
1220
+ tags:
1221
+ - ai
1222
+ responses:
1223
+ '200':
1224
+ description: OK
1225
+ content:
1226
+ text/plain:
1227
+ schema:
1228
+ type: string
1229
+ example: AI service is healthy
1230
+
1231
+ /ai/chat:
1232
+ get:
1233
+ summary: List AI conversations (alias)
1234
+ tags:
1235
+ - ai
1236
+ responses:
1237
+ '200':
1238
+ description: OK
1239
+ content:
1240
+ application/json:
1241
+ schema:
1242
+ type: array
1243
+ items:
1244
+ type: object
1245
+ properties:
1246
+ id:
1247
+ type: string
1248
+ name:
1249
+ type: string
1250
+ example:
1251
+ - id: "conv-1"
1252
+ name: "Conversation 1"
1253
+ post:
1254
+ summary: Create a new AI conversation (alias)
1255
+ tags:
1256
+ - ai
1257
+ responses:
1258
+ '201':
1259
+ description: Created
1260
+ content:
1261
+ application/json:
1262
+ schema:
1263
+ type: object
1264
+ properties:
1265
+ id:
1266
+ type: string
1267
+ name:
1268
+ type: string
1269
+ example:
1270
+ id: "conv-123"
1271
+ name: "New Conversation"
1272
+
1273
+ /ai/chat/{conversationId}:
1274
+ parameters:
1275
+ - name: conversationId
1276
+ in: path
1277
+ required: true
1278
+ schema:
1279
+ type: string
1280
+ description: Conversation ID
1281
+ get:
1282
+ summary: Get conversation history (alias)
1283
+ tags:
1284
+ - ai
1285
+ responses:
1286
+ '200':
1287
+ description: OK
1288
+ content:
1289
+ application/json:
1290
+ schema:
1291
+ type: object
1292
+ properties:
1293
+ id:
1294
+ type: string
1295
+ messages:
1296
+ type: array
1297
+ items:
1298
+ type: object
1299
+ properties:
1300
+ role:
1301
+ type: string
1302
+ content:
1303
+ type: string
1304
+ example:
1305
+ id: "conv-123"
1306
+ messages:
1307
+ - role: "user"
1308
+ content: "Hello"
1309
+ - role: "assistant"
1310
+ content: "Hi, how can I help?"
1311
+ '404':
1312
+ description: Not found
1313
+ content:
1314
+ application/json:
1315
+ schema:
1316
+ type: object
1317
+ properties:
1318
+ error:
1319
+ type: string
1320
+ example:
1321
+ error: Not found
1322
+ delete:
1323
+ summary: Delete a conversation (alias)
1324
+ tags:
1325
+ - ai
1326
+ responses:
1327
+ '204':
1328
+ description: Deleted
1329
+ '404':
1330
+ description: Not found
1331
+ content:
1332
+ application/json:
1333
+ schema:
1334
+ type: object
1335
+ properties:
1336
+ error:
1337
+ type: string
1338
+ example:
1339
+ error: Not found
1340
+
1341
+ /ai/chat/{conversationId}/message:
1342
+ parameters:
1343
+ - name: conversationId
1344
+ in: path
1345
+ required: true
1346
+ schema:
1347
+ type: string
1348
+ description: Conversation ID
1349
+ post:
1350
+ summary: Send a message to a conversation (alias)
1351
+ tags:
1352
+ - ai
1353
+ requestBody:
1354
+ required: true
1355
+ content:
1356
+ application/json:
1357
+ schema:
1358
+ type: object
1359
+ properties:
1360
+ content:
1361
+ type: string
1362
+ required:
1363
+ - content
1364
+ example:
1365
+ content: "Hello, summarize my last request."
1366
+ responses:
1367
+ '200':
1368
+ description: Message sent, returns updated messages or assistant reply
1369
+ content:
1370
+ application/json:
1371
+ schema:
1372
+ type: object
1373
+ properties:
1374
+ messages:
1375
+ type: array
1376
+ items:
1377
+ type: object
1378
+ properties:
1379
+ role:
1380
+ type: string
1381
+ content:
1382
+ type: string
1383
+ example:
1384
+ messages:
1385
+ - role: "user"
1386
+ content: "Hello"
1387
+ - role: "assistant"
1388
+ content: "Here is a summary..."
1389
+ '400':
1390
+ description: Bad Request
1391
+ content:
1392
+ application/json:
1393
+ schema:
1394
+ type: object
1395
+ properties:
1396
+ error:
1397
+ type: string
1398
+ example:
1399
+ error: Missing content