@kopai/api 0.3.0 → 0.5.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.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
20
16
  }
21
17
  return to;
22
18
  };
@@ -24,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
20
  value: mod,
25
21
  enumerable: true
26
22
  }) : target, mod));
27
-
28
23
  //#endregion
29
24
  let _kopai_core = require("@kopai/core");
30
25
  let fastify_type_provider_zod = require("fastify-type-provider-zod");
@@ -32,15 +27,16 @@ require("fastify");
32
27
  let zod_v4 = require("zod/v4");
33
28
  let zod = require("zod");
34
29
  zod = __toESM(zod);
35
-
36
30
  //#region src/routes/errors.ts
37
- var SignalsApiError = class extends Error {
31
+ var ApiError = class extends Error {
38
32
  constructor(message, options) {
39
33
  super(message, options);
40
34
  Object.setPrototypeOf(this, new.target.prototype);
41
35
  }
42
36
  };
43
-
37
+ var DashboardNotFoundError = class extends ApiError {
38
+ code = "DASHBOARD_NOT_FOUND";
39
+ };
44
40
  //#endregion
45
41
  //#region src/routes/error-handler.ts
46
42
  function errorHandler(error, request, reply) {
@@ -50,8 +46,17 @@ function errorHandler(error, request, reply) {
50
46
  title: "Invalid data",
51
47
  detail: error.message
52
48
  });
49
+ if (error instanceof DashboardNotFoundError) {
50
+ request.log.info(error.message);
51
+ return reply.status(404).send({
52
+ type: "https://docs.kopai.app/errors/dashboard-not-found",
53
+ status: 404,
54
+ title: "Dashboard not found",
55
+ detail: error.message
56
+ });
57
+ }
53
58
  request.log.error(error);
54
- if (error instanceof SignalsApiError) return reply.status(500).send({
59
+ if (error instanceof ApiError) return reply.status(500).send({
55
60
  type: "https://docs.kopai.app/errors/signals-api-internal-error",
56
61
  status: 500,
57
62
  title: "Internal server error",
@@ -69,7 +74,6 @@ function isFastifyError(error) {
69
74
  function isClientError(error) {
70
75
  return isFastifyError(error) && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500;
71
76
  }
72
-
73
77
  //#endregion
74
78
  //#region src/routes/error-schema-zod.ts
75
79
  const problemDetailsSchema = zod.default.object({
@@ -79,7 +83,6 @@ const problemDetailsSchema = zod.default.object({
79
83
  detail: zod.default.string().optional().describe("Human-readable explanation specific to this occurrence"),
80
84
  instance: zod.default.string().optional().describe("URI reference identifying this specific occurrence")
81
85
  });
82
-
83
86
  //#endregion
84
87
  //#region src/routes/traces.ts
85
88
  const tracesRoutes = async function(fastify, opts) {
@@ -127,8 +130,66 @@ const tracesRoutes = async function(fastify, opts) {
127
130
  res.send(result);
128
131
  }
129
132
  });
133
+ fastify.route({
134
+ method: "GET",
135
+ url: "/signals/services",
136
+ schema: {
137
+ description: "List distinct service names",
138
+ response: {
139
+ 200: zod_v4.z.object({ services: zod_v4.z.array(zod_v4.z.string()) }),
140
+ "4xx": problemDetailsSchema,
141
+ "5xx": problemDetailsSchema
142
+ }
143
+ },
144
+ handler: async (req, res) => {
145
+ const result = await opts.readTracesDatasource.getServices({ requestContext: req.requestContext });
146
+ res.send(result);
147
+ }
148
+ });
149
+ fastify.route({
150
+ method: "GET",
151
+ url: "/signals/traces/operations",
152
+ schema: {
153
+ description: "List distinct operations for a service",
154
+ querystring: zod_v4.z.object({ serviceName: zod_v4.z.string() }),
155
+ response: {
156
+ 200: zod_v4.z.object({ operations: zod_v4.z.array(zod_v4.z.string()) }),
157
+ "4xx": problemDetailsSchema,
158
+ "5xx": problemDetailsSchema
159
+ }
160
+ },
161
+ handler: async (req, res) => {
162
+ const result = await opts.readTracesDatasource.getOperations({
163
+ serviceName: req.query.serviceName,
164
+ requestContext: req.requestContext
165
+ });
166
+ res.send(result);
167
+ }
168
+ });
169
+ fastify.route({
170
+ method: "POST",
171
+ url: "/signals/traces/summaries",
172
+ schema: {
173
+ description: "Search trace summaries",
174
+ body: _kopai_core.dataFilterSchemas.traceSummariesFilterSchema,
175
+ response: {
176
+ 200: zod_v4.z.object({
177
+ data: zod_v4.z.array(_kopai_core.dataFilterSchemas.traceSummaryRowSchema),
178
+ nextCursor: zod_v4.z.string().nullable()
179
+ }),
180
+ "4xx": problemDetailsSchema,
181
+ "5xx": problemDetailsSchema
182
+ }
183
+ },
184
+ handler: async (req, res) => {
185
+ const result = await opts.readTracesDatasource.getTraceSummaries({
186
+ ...req.body,
187
+ requestContext: req.requestContext
188
+ });
189
+ res.send(result);
190
+ }
191
+ });
130
192
  };
131
-
132
193
  //#endregion
133
194
  //#region src/routes/logs.ts
134
195
  const logsRoutes = async function(fastify, opts) {
@@ -157,7 +218,6 @@ const logsRoutes = async function(fastify, opts) {
157
218
  }
158
219
  });
159
220
  };
160
-
161
221
  //#endregion
162
222
  //#region src/routes/metrics.ts
163
223
  const metricsRoutes = async function(fastify, opts) {
@@ -222,7 +282,95 @@ const discoveredMetricSchema = zod_v4.z.object({
222
282
  resourceAttributes: discoveredAttributesSchema.describe("Resource attributes aggregated across all data points.")
223
283
  });
224
284
  const metricsDiscoveryResponseSchema = zod_v4.z.object({ metrics: zod_v4.z.array(discoveredMetricSchema) });
225
-
285
+ //#endregion
286
+ //#region src/routes/dashboards.ts
287
+ const dashboardsRoutes$1 = async function(fastify, opts) {
288
+ fastify.route({
289
+ method: "GET",
290
+ url: "/dashboards/schema",
291
+ schema: {
292
+ description: "Get UI tree schema as markdown prompt instructions for AI agents",
293
+ produces: ["text/markdown"],
294
+ response: {
295
+ 200: zod_v4.z.string().describe("Markdown prompt instructions"),
296
+ 404: zod_v4.z.string().describe("Prompt instructions not configured")
297
+ }
298
+ },
299
+ handler: async (_req, reply) => {
300
+ if (!opts.promptInstructions) return reply.status(404).send("Dashboard schema not configured");
301
+ reply.type("text/markdown").send(opts.promptInstructions);
302
+ }
303
+ });
304
+ fastify.route({
305
+ method: "POST",
306
+ url: "/dashboards",
307
+ schema: {
308
+ description: "Create a dashboard containing a uiTree",
309
+ body: _kopai_core.dashboardDatasource.createDashboardParams,
310
+ response: {
311
+ 201: _kopai_core.dashboardDatasource.dashboardSchema,
312
+ "4xx": problemDetailsSchema,
313
+ "5xx": problemDetailsSchema
314
+ }
315
+ },
316
+ handler: async (req, res) => {
317
+ const result = await opts.dynamicDashboardDatasource.createDashboard({
318
+ ...req.body,
319
+ requestContext: req.requestContext
320
+ });
321
+ res.status(201).send(result);
322
+ }
323
+ });
324
+ fastify.route({
325
+ method: "GET",
326
+ url: "/dashboards/:dashboardId",
327
+ schema: {
328
+ description: "Get a dashboard containing a uiTree to be rendered",
329
+ params: zod_v4.z.object({ dashboardId: zod_v4.z.string() }),
330
+ response: {
331
+ 200: _kopai_core.dashboardDatasource.dashboardSchema,
332
+ "4xx": problemDetailsSchema,
333
+ "5xx": problemDetailsSchema
334
+ }
335
+ },
336
+ handler: async (req, res) => {
337
+ try {
338
+ const result = await opts.dynamicDashboardDatasource.getDashboard({
339
+ id: req.params.dashboardId,
340
+ requestContext: req.requestContext
341
+ });
342
+ res.send(result);
343
+ } catch (error) {
344
+ if ((error instanceof Error ? error.message.toLowerCase() : "").includes("not found")) throw new DashboardNotFoundError(`Dashboard not found: ${req.params.dashboardId}`, { cause: error });
345
+ throw error;
346
+ }
347
+ }
348
+ });
349
+ const searchResponseSchema = zod_v4.z.object({
350
+ data: zod_v4.z.array(_kopai_core.dashboardDatasource.dashboardSchema),
351
+ nextCursor: zod_v4.z.string().nullable()
352
+ });
353
+ fastify.route({
354
+ method: "POST",
355
+ url: "/dashboards/search",
356
+ schema: {
357
+ description: "Search dashboards matching a filter",
358
+ body: _kopai_core.dashboardDatasource.searchDashboardsFilter,
359
+ response: {
360
+ 200: searchResponseSchema,
361
+ "4xx": problemDetailsSchema,
362
+ "5xx": problemDetailsSchema
363
+ }
364
+ },
365
+ handler: async (req, res) => {
366
+ const result = await opts.dynamicDashboardDatasource.searchDashboards({
367
+ ...req.body,
368
+ requestContext: req.requestContext
369
+ });
370
+ res.send(result);
371
+ }
372
+ });
373
+ };
226
374
  //#endregion
227
375
  //#region src/index.ts
228
376
  const signalsRoutes = async function(fastify, opts) {
@@ -233,6 +381,15 @@ const signalsRoutes = async function(fastify, opts) {
233
381
  fastify.register(logsRoutes, { readLogsDatasource: opts.readTelemetryDatasource });
234
382
  fastify.register(metricsRoutes, { readMetricsDatasource: opts.readTelemetryDatasource });
235
383
  };
236
-
384
+ const dashboardsRoutes = async function(fastify, opts) {
385
+ fastify.setValidatorCompiler(fastify_type_provider_zod.validatorCompiler);
386
+ fastify.setSerializerCompiler(fastify_type_provider_zod.serializerCompiler);
387
+ fastify.setErrorHandler(errorHandler);
388
+ fastify.register(dashboardsRoutes$1, {
389
+ dynamicDashboardDatasource: opts.dynamicDashboardDatasource,
390
+ promptInstructions: opts.promptInstructions
391
+ });
392
+ };
237
393
  //#endregion
238
- exports.signalsRoutes = signalsRoutes;
394
+ exports.dashboardsRoutes = dashboardsRoutes;
395
+ exports.signalsRoutes = signalsRoutes;
package/dist/index.d.cts CHANGED
@@ -1,15 +1,19 @@
1
1
  import { FastifyPluginAsyncZod } from "fastify-type-provider-zod";
2
- import { datasource } from "@kopai/core";
2
+ import { dashboardDatasource, datasource } from "@kopai/core";
3
3
 
4
4
  //#region src/index.d.ts
5
5
  declare const signalsRoutes: FastifyPluginAsyncZod<{
6
6
  readTelemetryDatasource: datasource.ReadTelemetryDatasource;
7
7
  }>;
8
+ declare const dashboardsRoutes: FastifyPluginAsyncZod<{
9
+ dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;
10
+ promptInstructions?: string;
11
+ }>;
8
12
  declare module "fastify" {
9
13
  interface FastifyRequest {
10
14
  requestContext?: unknown;
11
15
  }
12
16
  } //# sourceMappingURL=index.d.ts.map
13
17
  //#endregion
14
- export { signalsRoutes };
18
+ export { dashboardsRoutes, signalsRoutes };
15
19
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;cAYa,aAAA,EAAe,qBAAA;EAC1B,uBAAA,EAAyB,UAAA,CAAW,uBAAA;AAAA;AAAA;EAAA,UAoB1B,cAAA;IACR,cAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;cAaa,aAAA,EAAe,qBAAA;EAC1B,uBAAA,EAAyB,UAAA,CAAW,uBAAA;AAAA;AAAA,cAmBzB,gBAAA,EAAkB,qBAAA;EAC7B,0BAAA,EAA4B,mBAAA,CAAoB,0BAAA;EAChD,kBAAA;AAAA;AAAA;EAAA,UAaU,cAAA;IACR,cAAA;EAAA;AAAA"}
package/dist/index.d.mts CHANGED
@@ -1,15 +1,19 @@
1
- import { datasource } from "@kopai/core";
1
+ import { dashboardDatasource, datasource } from "@kopai/core";
2
2
  import { FastifyPluginAsyncZod } from "fastify-type-provider-zod";
3
3
 
4
4
  //#region src/index.d.ts
5
5
  declare const signalsRoutes: FastifyPluginAsyncZod<{
6
6
  readTelemetryDatasource: datasource.ReadTelemetryDatasource;
7
7
  }>;
8
+ declare const dashboardsRoutes: FastifyPluginAsyncZod<{
9
+ dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;
10
+ promptInstructions?: string;
11
+ }>;
8
12
  declare module "fastify" {
9
13
  interface FastifyRequest {
10
14
  requestContext?: unknown;
11
15
  }
12
16
  } //# sourceMappingURL=index.d.ts.map
13
17
  //#endregion
14
- export { signalsRoutes };
18
+ export { dashboardsRoutes, signalsRoutes };
15
19
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;cAYa,aAAA,EAAe,qBAAA;EAC1B,uBAAA,EAAyB,UAAA,CAAW,uBAAA;AAAA;AAAA;EAAA,UAoB1B,cAAA;IACR,cAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;cAaa,aAAA,EAAe,qBAAA;EAC1B,uBAAA,EAAyB,UAAA,CAAW,uBAAA;AAAA;AAAA,cAmBzB,gBAAA,EAAkB,qBAAA;EAC7B,0BAAA,EAA4B,mBAAA,CAAoB,0BAAA;EAChD,kBAAA;AAAA;AAAA;EAAA,UAaU,cAAA;IACR,cAAA;EAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -1,17 +1,18 @@
1
- import { dataFilterSchemas, denormalizedSignals } from "@kopai/core";
1
+ import { dashboardDatasource, dataFilterSchemas, denormalizedSignals } from "@kopai/core";
2
2
  import { serializerCompiler, validatorCompiler } from "fastify-type-provider-zod";
3
3
  import "fastify";
4
4
  import { z } from "zod/v4";
5
5
  import z$1 from "zod";
6
-
7
6
  //#region src/routes/errors.ts
8
- var SignalsApiError = class extends Error {
7
+ var ApiError = class extends Error {
9
8
  constructor(message, options) {
10
9
  super(message, options);
11
10
  Object.setPrototypeOf(this, new.target.prototype);
12
11
  }
13
12
  };
14
-
13
+ var DashboardNotFoundError = class extends ApiError {
14
+ code = "DASHBOARD_NOT_FOUND";
15
+ };
15
16
  //#endregion
16
17
  //#region src/routes/error-handler.ts
17
18
  function errorHandler(error, request, reply) {
@@ -21,8 +22,17 @@ function errorHandler(error, request, reply) {
21
22
  title: "Invalid data",
22
23
  detail: error.message
23
24
  });
25
+ if (error instanceof DashboardNotFoundError) {
26
+ request.log.info(error.message);
27
+ return reply.status(404).send({
28
+ type: "https://docs.kopai.app/errors/dashboard-not-found",
29
+ status: 404,
30
+ title: "Dashboard not found",
31
+ detail: error.message
32
+ });
33
+ }
24
34
  request.log.error(error);
25
- if (error instanceof SignalsApiError) return reply.status(500).send({
35
+ if (error instanceof ApiError) return reply.status(500).send({
26
36
  type: "https://docs.kopai.app/errors/signals-api-internal-error",
27
37
  status: 500,
28
38
  title: "Internal server error",
@@ -40,7 +50,6 @@ function isFastifyError(error) {
40
50
  function isClientError(error) {
41
51
  return isFastifyError(error) && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500;
42
52
  }
43
-
44
53
  //#endregion
45
54
  //#region src/routes/error-schema-zod.ts
46
55
  const problemDetailsSchema = z$1.object({
@@ -50,7 +59,6 @@ const problemDetailsSchema = z$1.object({
50
59
  detail: z$1.string().optional().describe("Human-readable explanation specific to this occurrence"),
51
60
  instance: z$1.string().optional().describe("URI reference identifying this specific occurrence")
52
61
  });
53
-
54
62
  //#endregion
55
63
  //#region src/routes/traces.ts
56
64
  const tracesRoutes = async function(fastify, opts) {
@@ -98,8 +106,66 @@ const tracesRoutes = async function(fastify, opts) {
98
106
  res.send(result);
99
107
  }
100
108
  });
109
+ fastify.route({
110
+ method: "GET",
111
+ url: "/signals/services",
112
+ schema: {
113
+ description: "List distinct service names",
114
+ response: {
115
+ 200: z.object({ services: z.array(z.string()) }),
116
+ "4xx": problemDetailsSchema,
117
+ "5xx": problemDetailsSchema
118
+ }
119
+ },
120
+ handler: async (req, res) => {
121
+ const result = await opts.readTracesDatasource.getServices({ requestContext: req.requestContext });
122
+ res.send(result);
123
+ }
124
+ });
125
+ fastify.route({
126
+ method: "GET",
127
+ url: "/signals/traces/operations",
128
+ schema: {
129
+ description: "List distinct operations for a service",
130
+ querystring: z.object({ serviceName: z.string() }),
131
+ response: {
132
+ 200: z.object({ operations: z.array(z.string()) }),
133
+ "4xx": problemDetailsSchema,
134
+ "5xx": problemDetailsSchema
135
+ }
136
+ },
137
+ handler: async (req, res) => {
138
+ const result = await opts.readTracesDatasource.getOperations({
139
+ serviceName: req.query.serviceName,
140
+ requestContext: req.requestContext
141
+ });
142
+ res.send(result);
143
+ }
144
+ });
145
+ fastify.route({
146
+ method: "POST",
147
+ url: "/signals/traces/summaries",
148
+ schema: {
149
+ description: "Search trace summaries",
150
+ body: dataFilterSchemas.traceSummariesFilterSchema,
151
+ response: {
152
+ 200: z.object({
153
+ data: z.array(dataFilterSchemas.traceSummaryRowSchema),
154
+ nextCursor: z.string().nullable()
155
+ }),
156
+ "4xx": problemDetailsSchema,
157
+ "5xx": problemDetailsSchema
158
+ }
159
+ },
160
+ handler: async (req, res) => {
161
+ const result = await opts.readTracesDatasource.getTraceSummaries({
162
+ ...req.body,
163
+ requestContext: req.requestContext
164
+ });
165
+ res.send(result);
166
+ }
167
+ });
101
168
  };
102
-
103
169
  //#endregion
104
170
  //#region src/routes/logs.ts
105
171
  const logsRoutes = async function(fastify, opts) {
@@ -128,7 +194,6 @@ const logsRoutes = async function(fastify, opts) {
128
194
  }
129
195
  });
130
196
  };
131
-
132
197
  //#endregion
133
198
  //#region src/routes/metrics.ts
134
199
  const metricsRoutes = async function(fastify, opts) {
@@ -193,7 +258,95 @@ const discoveredMetricSchema = z.object({
193
258
  resourceAttributes: discoveredAttributesSchema.describe("Resource attributes aggregated across all data points.")
194
259
  });
195
260
  const metricsDiscoveryResponseSchema = z.object({ metrics: z.array(discoveredMetricSchema) });
196
-
261
+ //#endregion
262
+ //#region src/routes/dashboards.ts
263
+ const dashboardsRoutes$1 = async function(fastify, opts) {
264
+ fastify.route({
265
+ method: "GET",
266
+ url: "/dashboards/schema",
267
+ schema: {
268
+ description: "Get UI tree schema as markdown prompt instructions for AI agents",
269
+ produces: ["text/markdown"],
270
+ response: {
271
+ 200: z.string().describe("Markdown prompt instructions"),
272
+ 404: z.string().describe("Prompt instructions not configured")
273
+ }
274
+ },
275
+ handler: async (_req, reply) => {
276
+ if (!opts.promptInstructions) return reply.status(404).send("Dashboard schema not configured");
277
+ reply.type("text/markdown").send(opts.promptInstructions);
278
+ }
279
+ });
280
+ fastify.route({
281
+ method: "POST",
282
+ url: "/dashboards",
283
+ schema: {
284
+ description: "Create a dashboard containing a uiTree",
285
+ body: dashboardDatasource.createDashboardParams,
286
+ response: {
287
+ 201: dashboardDatasource.dashboardSchema,
288
+ "4xx": problemDetailsSchema,
289
+ "5xx": problemDetailsSchema
290
+ }
291
+ },
292
+ handler: async (req, res) => {
293
+ const result = await opts.dynamicDashboardDatasource.createDashboard({
294
+ ...req.body,
295
+ requestContext: req.requestContext
296
+ });
297
+ res.status(201).send(result);
298
+ }
299
+ });
300
+ fastify.route({
301
+ method: "GET",
302
+ url: "/dashboards/:dashboardId",
303
+ schema: {
304
+ description: "Get a dashboard containing a uiTree to be rendered",
305
+ params: z.object({ dashboardId: z.string() }),
306
+ response: {
307
+ 200: dashboardDatasource.dashboardSchema,
308
+ "4xx": problemDetailsSchema,
309
+ "5xx": problemDetailsSchema
310
+ }
311
+ },
312
+ handler: async (req, res) => {
313
+ try {
314
+ const result = await opts.dynamicDashboardDatasource.getDashboard({
315
+ id: req.params.dashboardId,
316
+ requestContext: req.requestContext
317
+ });
318
+ res.send(result);
319
+ } catch (error) {
320
+ if ((error instanceof Error ? error.message.toLowerCase() : "").includes("not found")) throw new DashboardNotFoundError(`Dashboard not found: ${req.params.dashboardId}`, { cause: error });
321
+ throw error;
322
+ }
323
+ }
324
+ });
325
+ const searchResponseSchema = z.object({
326
+ data: z.array(dashboardDatasource.dashboardSchema),
327
+ nextCursor: z.string().nullable()
328
+ });
329
+ fastify.route({
330
+ method: "POST",
331
+ url: "/dashboards/search",
332
+ schema: {
333
+ description: "Search dashboards matching a filter",
334
+ body: dashboardDatasource.searchDashboardsFilter,
335
+ response: {
336
+ 200: searchResponseSchema,
337
+ "4xx": problemDetailsSchema,
338
+ "5xx": problemDetailsSchema
339
+ }
340
+ },
341
+ handler: async (req, res) => {
342
+ const result = await opts.dynamicDashboardDatasource.searchDashboards({
343
+ ...req.body,
344
+ requestContext: req.requestContext
345
+ });
346
+ res.send(result);
347
+ }
348
+ });
349
+ };
197
350
  //#endregion
198
351
  //#region src/index.ts
199
352
  const signalsRoutes = async function(fastify, opts) {
@@ -204,7 +357,16 @@ const signalsRoutes = async function(fastify, opts) {
204
357
  fastify.register(logsRoutes, { readLogsDatasource: opts.readTelemetryDatasource });
205
358
  fastify.register(metricsRoutes, { readMetricsDatasource: opts.readTelemetryDatasource });
206
359
  };
207
-
360
+ const dashboardsRoutes = async function(fastify, opts) {
361
+ fastify.setValidatorCompiler(validatorCompiler);
362
+ fastify.setSerializerCompiler(serializerCompiler);
363
+ fastify.setErrorHandler(errorHandler);
364
+ fastify.register(dashboardsRoutes$1, {
365
+ dynamicDashboardDatasource: opts.dynamicDashboardDatasource,
366
+ promptInstructions: opts.promptInstructions
367
+ });
368
+ };
208
369
  //#endregion
209
- export { signalsRoutes };
370
+ export { dashboardsRoutes, signalsRoutes };
371
+
210
372
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["z"],"sources":["../src/routes/errors.ts","../src/routes/error-handler.ts","../src/routes/error-schema-zod.ts","../src/routes/traces.ts","../src/routes/logs.ts","../src/routes/metrics.ts","../src/index.ts"],"sourcesContent":["export abstract class SignalsApiError extends Error {\n abstract readonly code: string;\n\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","import {\n type FastifyError,\n type FastifyReply,\n type FastifyRequest,\n} from \"fastify\";\nimport { SignalsApiError } from \"./errors.js\";\nimport type { SignalsApiErrorResponse } from \"./error-schema-zod.js\";\nexport function errorHandler(\n error: FastifyError | Error | string,\n request: FastifyRequest,\n reply: FastifyReply\n) {\n if (isClientError(error)) {\n return reply.status(400).send({\n // https://datatracker.ietf.org/doc/html/rfc9457\n // HTTP/1.1 422 Unprocessable Content\n // Content-Type: application/problem+json\n // Content-Language: en\n //\n // {\n // \"type\": \"https://example.net/validation-error\",\n // \"title\": \"Your request is not valid.\",\n // \"errors\": [\n // {\n // \"detail\": \"must be a positive integer\",\n // \"pointer\": \"#/age\"\n // },\n // {\n // \"detail\": \"must be 'green', 'red' or 'blue'\",\n // \"pointer\": \"#/profile/color\"\n // }\n // ]\n // }\n type: \"https://docs.kopai.app/errors/signals-api-validation-error\", // TODO: document error\n status: 400,\n title: \"Invalid data\",\n detail: error.message,\n } satisfies SignalsApiErrorResponse);\n }\n\n request.log.error(error);\n if (error instanceof SignalsApiError) {\n return reply.status(500).send({\n type: \"https://docs.kopai.app/errors/signals-api-internal-error\", // TODO: document error\n status: 500,\n title: \"Internal server error\",\n detail: error.message,\n } satisfies SignalsApiErrorResponse);\n }\n\n return reply.status(500).send({\n type: \"https://docs.kopai.app/errors/signals-api-internal-error\", // TODO: document error\n status: 500,\n title: \"Internal server error\",\n } satisfies SignalsApiErrorResponse);\n}\n\nfunction isFastifyError(error: unknown): error is FastifyError {\n return (\n error instanceof Error &&\n \"code\" in error &&\n typeof (error as FastifyError).code === \"string\"\n );\n}\n\nfunction isClientError(error: unknown): error is FastifyError {\n return (\n isFastifyError(error) &&\n typeof error.statusCode === \"number\" &&\n error.statusCode >= 400 &&\n error.statusCode < 500\n );\n}\n","import z from \"zod\";\n\nexport const problemDetailsSchema = z.object({\n type: z\n .url()\n .default(\"about:blank\")\n .describe(\"URI reference identifying the problem type\"),\n status: z\n .number()\n .int()\n .min(100)\n .max(599)\n .optional()\n .describe(\"HTTP status code generated by the origin server\"),\n title: z\n .string()\n .optional()\n .describe(\"Short human-readable summary of the problem type\"),\n detail: z\n .string()\n .optional()\n .describe(\"Human-readable explanation specific to this occurrence\"),\n instance: z\n .string()\n .optional()\n .describe(\"URI reference identifying this specific occurrence\"),\n});\n\nexport type SignalsApiErrorResponse = z.infer<typeof problemDetailsSchema>;\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const tracesRoutes: FastifyPluginAsyncZod<{\n readTracesDatasource: datasource.ReadTracesDatasource;\n}> = async function (fastify, opts) {\n fastify.route({\n method: \"GET\",\n url: \"/signals/traces/:traceId\",\n schema: {\n description: \"Get all spans for a trace by traceId\",\n params: z.object({\n traceId: z.string().describe(\"A TraceId of the trace\"),\n }),\n response: {\n 200: z.array(denormalizedSignals.otelTracesSchema),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraces({\n traceId: req.params.traceId,\n requestContext: req.requestContext,\n });\n res.send(result.data);\n },\n });\n\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelTracesSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/traces/search\",\n schema: {\n description: \"Search spans matching a filter\",\n body: dataFilterSchemas.tracesDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraces({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const logsRoutes: FastifyPluginAsyncZod<{\n readLogsDatasource: datasource.ReadLogsDatasource;\n}> = async function (fastify, opts) {\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelLogsSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/logs/search\",\n schema: {\n description: \"Search logs matching a filter\",\n body: dataFilterSchemas.logsDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readLogsDatasource.getLogs({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const metricsRoutes: FastifyPluginAsyncZod<{\n readMetricsDatasource: datasource.ReadMetricsDatasource;\n}> = async function (fastify, opts) {\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelMetricsSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/metrics/search\",\n schema: {\n description: \"Search metrics matching a filter\",\n body: dataFilterSchemas.metricsDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readMetricsDatasource.getMetrics({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/signals/metrics/discover\",\n schema: {\n description: \"Discover available metrics and their attributes\",\n response: {\n 200: metricsDiscoveryResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readMetricsDatasource.discoverMetrics({\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n\nconst metricTypeSchema = z.enum([\n \"Gauge\",\n \"Sum\",\n \"Histogram\",\n \"ExponentialHistogram\",\n \"Summary\",\n]);\n\nconst discoveredAttributesSchema = z.object({\n values: z\n .record(z.string(), z.array(z.string()))\n .describe(\"Attribute key/value pairs. Max 100 values per key.\"),\n _truncated: z\n .boolean()\n .optional()\n .describe(\"True if any attribute key exceeded 100 values.\"),\n});\n\nconst discoveredMetricSchema = z.object({\n name: z.string().describe(\"Metric name from MetricName field.\"),\n type: metricTypeSchema.describe(\n \"Metric type: Gauge, Sum, Histogram, ExponentialHistogram, or Summary.\"\n ),\n unit: z.string().optional().describe(\"Metric unit from MetricUnit field.\"),\n description: z\n .string()\n .optional()\n .describe(\"Metric description from MetricDescription field.\"),\n attributes: discoveredAttributesSchema.describe(\n \"Data point attributes aggregated across all data points.\"\n ),\n resourceAttributes: discoveredAttributesSchema.describe(\n \"Resource attributes aggregated across all data points.\"\n ),\n});\n\nconst metricsDiscoveryResponseSchema = z.object({\n metrics: z.array(discoveredMetricSchema),\n});\n","import type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { type datasource } from \"@kopai/core\";\n\nimport {\n serializerCompiler,\n validatorCompiler,\n} from \"fastify-type-provider-zod\";\nimport { errorHandler } from \"./routes/error-handler.js\";\nimport { tracesRoutes } from \"./routes/traces.js\";\nimport { logsRoutes } from \"./routes/logs.js\";\nimport { metricsRoutes } from \"./routes/metrics.js\";\n\nexport const signalsRoutes: FastifyPluginAsyncZod<{\n readTelemetryDatasource: datasource.ReadTelemetryDatasource;\n}> = async function (fastify, opts) {\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n fastify.setErrorHandler(errorHandler);\n\n fastify.register(tracesRoutes, {\n readTracesDatasource: opts.readTelemetryDatasource,\n });\n\n fastify.register(logsRoutes, {\n readLogsDatasource: opts.readTelemetryDatasource,\n });\n\n fastify.register(metricsRoutes, {\n readMetricsDatasource: opts.readTelemetryDatasource,\n });\n};\n\ndeclare module \"fastify\" {\n interface FastifyRequest {\n requestContext?: unknown;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAsB,kBAAtB,cAA8C,MAAM;CAGlD,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,SAAO,eAAe,MAAM,IAAI,OAAO,UAAU;;;;;;ACErD,SAAgB,aACd,OACA,SACA,OACA;AACA,KAAI,cAAc,MAAM,CACtB,QAAO,MAAM,OAAO,IAAI,CAAC,KAAK;EAoB5B,MAAM;EACN,QAAQ;EACR,OAAO;EACP,QAAQ,MAAM;EACf,CAAmC;AAGtC,SAAQ,IAAI,MAAM,MAAM;AACxB,KAAI,iBAAiB,gBACnB,QAAO,MAAM,OAAO,IAAI,CAAC,KAAK;EAC5B,MAAM;EACN,QAAQ;EACR,OAAO;EACP,QAAQ,MAAM;EACf,CAAmC;AAGtC,QAAO,MAAM,OAAO,IAAI,CAAC,KAAK;EAC5B,MAAM;EACN,QAAQ;EACR,OAAO;EACR,CAAmC;;AAGtC,SAAS,eAAe,OAAuC;AAC7D,QACE,iBAAiB,SACjB,UAAU,SACV,OAAQ,MAAuB,SAAS;;AAI5C,SAAS,cAAc,OAAuC;AAC5D,QACE,eAAe,MAAM,IACrB,OAAO,MAAM,eAAe,YAC5B,MAAM,cAAc,OACpB,MAAM,aAAa;;;;;ACpEvB,MAAa,uBAAuBA,IAAE,OAAO;CAC3C,MAAMA,IACH,KAAK,CACL,QAAQ,cAAc,CACtB,SAAS,6CAA6C;CACzD,QAAQA,IACL,QAAQ,CACR,KAAK,CACL,IAAI,IAAI,CACR,IAAI,IAAI,CACR,UAAU,CACV,SAAS,kDAAkD;CAC9D,OAAOA,IACJ,Q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CACT,UAAU,CACV,SAAS,iDAAiD;CAC9D,CAAC;AAEF,MAAM,yBAAyB,EAAE,OAAO;CACtC,MAAM,EAAE,QAAQ,CAAC,SAAS,qCAAqC;CAC/D,MAAM,iBAAiB,SACrB,wEACD;CACD,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,qCAAqC;CAC1E,aAAa,EACV,QAAQ,CACR,UAAU,CACV,SAAS,mDAAmD;CAC/D,YAAY,2BAA2B,SACrC,2DACD;CACD,oBAAoB,2BAA2B,SAC7C,yDACD;CACF,CAAC;AAEF,MAAM,iCAAiC,EAAE,OAAO,EAC9C,SAAS,EAAE,MAAM,uBAAuB,EACzC,CAAC;;;;ACpFF,MAAa,gBAER,eAAgB,SAAS,MAAM;AAClC,SAAQ,qBAAqB,kBAAkB;AAC/C,SAAQ,sBAAsB,mBAAmB;AACjD,SAAQ,gBAAgB,aAAa;AAErC,SAAQ,SAAS,cAAc,EAC7B,sBAAsB,KAAK,yBAC5B,CAAC;AAEF,SAAQ,SAAS,YAAY,EAC3B,oBAAoB,KAAK,yBAC1B,CAAC;AAEF,SAAQ,SAAS,eAAe,EAC9B,uBAAuB,KAAK,yBAC7B,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":["z","dashboardsRoutes","_dashboardsRoutes"],"sources":["../src/routes/errors.ts","../src/routes/error-handler.ts","../src/routes/error-schema-zod.ts","../src/routes/traces.ts","../src/routes/logs.ts","../src/routes/metrics.ts","../src/routes/dashboards.ts","../src/index.ts"],"sourcesContent":["export abstract class ApiError extends Error {\n abstract readonly code: string;\n\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport abstract class SignalsApiError extends ApiError {}\n\nexport class DashboardNotFoundError extends ApiError {\n readonly code = \"DASHBOARD_NOT_FOUND\";\n}\n","import {\n type FastifyError,\n type FastifyReply,\n type FastifyRequest,\n} from \"fastify\";\nimport { ApiError, DashboardNotFoundError } from \"./errors.js\";\nimport type { ApiErrorResponse } from \"./error-schema-zod.js\";\nexport function errorHandler(\n error: FastifyError | Error | string,\n request: FastifyRequest,\n reply: FastifyReply\n) {\n if (isClientError(error)) {\n return reply.status(400).send({\n // https://datatracker.ietf.org/doc/html/rfc9457\n // HTTP/1.1 422 Unprocessable Content\n // Content-Type: application/problem+json\n // Content-Language: en\n //\n // {\n // \"type\": \"https://example.net/validation-error\",\n // \"title\": \"Your request is not valid.\",\n // \"errors\": [\n // {\n // \"detail\": \"must be a positive integer\",\n // \"pointer\": \"#/age\"\n // },\n // {\n // \"detail\": \"must be 'green', 'red' or 'blue'\",\n // \"pointer\": \"#/profile/color\"\n // }\n // ]\n // }\n type: \"https://docs.kopai.app/errors/signals-api-validation-error\", // TODO: document error\n status: 400,\n title: \"Invalid data\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n\n if (error instanceof DashboardNotFoundError) {\n request.log.info(error.message);\n return reply.status(404).send({\n type: \"https://docs.kopai.app/errors/dashboard-not-found\",\n status: 404,\n title: \"Dashboard not found\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n request.log.error(error);\n if (error instanceof ApiError) {\n return reply.status(500).send({\n type: \"https://docs.kopai.app/errors/signals-api-internal-error\", // TODO: document error\n status: 500,\n title: \"Internal server error\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n\n return reply.status(500).send({\n type: \"https://docs.kopai.app/errors/signals-api-internal-error\", // TODO: document error\n status: 500,\n title: \"Internal server error\",\n } satisfies ApiErrorResponse);\n}\n\nfunction isFastifyError(error: unknown): error is FastifyError {\n return (\n error instanceof Error &&\n \"code\" in error &&\n typeof (error as FastifyError).code === \"string\"\n );\n}\n\nfunction isClientError(error: unknown): error is FastifyError {\n return (\n isFastifyError(error) &&\n typeof error.statusCode === \"number\" &&\n error.statusCode >= 400 &&\n error.statusCode < 500\n );\n}\n","import z from \"zod\";\n\nexport const problemDetailsSchema = z.object({\n type: z\n .url()\n .default(\"about:blank\")\n .describe(\"URI reference identifying the problem type\"),\n status: z\n .number()\n .int()\n .min(100)\n .max(599)\n .optional()\n .describe(\"HTTP status code generated by the origin server\"),\n title: z\n .string()\n .optional()\n .describe(\"Short human-readable summary of the problem type\"),\n detail: z\n .string()\n .optional()\n .describe(\"Human-readable explanation specific to this occurrence\"),\n instance: z\n .string()\n .optional()\n .describe(\"URI reference identifying this specific occurrence\"),\n});\n\nexport type ApiErrorResponse = z.infer<typeof problemDetailsSchema>;\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const tracesRoutes: FastifyPluginAsyncZod<{\n readTracesDatasource: datasource.ReadTracesDatasource &\n datasource.ReadTracesMetaDatasource;\n}> = async function (fastify, opts) {\n fastify.route({\n method: \"GET\",\n url: \"/signals/traces/:traceId\",\n schema: {\n description: \"Get all spans for a trace by traceId\",\n params: z.object({\n traceId: z.string().describe(\"A TraceId of the trace\"),\n }),\n response: {\n 200: z.array(denormalizedSignals.otelTracesSchema),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraces({\n traceId: req.params.traceId,\n requestContext: req.requestContext,\n });\n res.send(result.data);\n },\n });\n\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelTracesSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/traces/search\",\n schema: {\n description: \"Search spans matching a filter\",\n body: dataFilterSchemas.tracesDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraces({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/signals/services\",\n schema: {\n description: \"List distinct service names\",\n response: {\n 200: z.object({ services: z.array(z.string()) }),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getServices({\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/signals/traces/operations\",\n schema: {\n description: \"List distinct operations for a service\",\n querystring: z.object({ serviceName: z.string() }),\n response: {\n 200: z.object({ operations: z.array(z.string()) }),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getOperations({\n serviceName: req.query.serviceName,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/traces/summaries\",\n schema: {\n description: \"Search trace summaries\",\n body: dataFilterSchemas.traceSummariesFilterSchema,\n response: {\n 200: z.object({\n data: z.array(dataFilterSchemas.traceSummaryRowSchema),\n nextCursor: z.string().nullable(),\n }),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraceSummaries({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const logsRoutes: FastifyPluginAsyncZod<{\n readLogsDatasource: datasource.ReadLogsDatasource;\n}> = async function (fastify, opts) {\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelLogsSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/logs/search\",\n schema: {\n description: \"Search logs matching a filter\",\n body: dataFilterSchemas.logsDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readLogsDatasource.getLogs({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const metricsRoutes: FastifyPluginAsyncZod<{\n readMetricsDatasource: datasource.ReadMetricsDatasource;\n}> = async function (fastify, opts) {\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelMetricsSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/metrics/search\",\n schema: {\n description: \"Search metrics matching a filter\",\n body: dataFilterSchemas.metricsDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readMetricsDatasource.getMetrics({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/signals/metrics/discover\",\n schema: {\n description: \"Discover available metrics and their attributes\",\n response: {\n 200: metricsDiscoveryResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readMetricsDatasource.discoverMetrics({\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n\nconst metricTypeSchema = z.enum([\n \"Gauge\",\n \"Sum\",\n \"Histogram\",\n \"ExponentialHistogram\",\n \"Summary\",\n]);\n\nconst discoveredAttributesSchema = z.object({\n values: z\n .record(z.string(), z.array(z.string()))\n .describe(\"Attribute key/value pairs. Max 100 values per key.\"),\n _truncated: z\n .boolean()\n .optional()\n .describe(\"True if any attribute key exceeded 100 values.\"),\n});\n\nconst discoveredMetricSchema = z.object({\n name: z.string().describe(\"Metric name from MetricName field.\"),\n type: metricTypeSchema.describe(\n \"Metric type: Gauge, Sum, Histogram, ExponentialHistogram, or Summary.\"\n ),\n unit: z.string().optional().describe(\"Metric unit from MetricUnit field.\"),\n description: z\n .string()\n .optional()\n .describe(\"Metric description from MetricDescription field.\"),\n attributes: discoveredAttributesSchema.describe(\n \"Data point attributes aggregated across all data points.\"\n ),\n resourceAttributes: discoveredAttributesSchema.describe(\n \"Resource attributes aggregated across all data points.\"\n ),\n});\n\nconst metricsDiscoveryResponseSchema = z.object({\n metrics: z.array(discoveredMetricSchema),\n});\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { dashboardDatasource } from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\nimport { DashboardNotFoundError } from \"./errors.js\";\n\nexport const dashboardsRoutes: FastifyPluginAsyncZod<{\n dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;\n promptInstructions?: string;\n}> = async function (fastify, opts) {\n fastify.route({\n method: \"GET\",\n url: \"/dashboards/schema\",\n schema: {\n description:\n \"Get UI tree schema as markdown prompt instructions for AI agents\",\n produces: [\"text/markdown\"],\n response: {\n 200: z.string().describe(\"Markdown prompt instructions\"),\n 404: z.string().describe(\"Prompt instructions not configured\"),\n },\n },\n handler: async (_req, reply) => {\n if (!opts.promptInstructions) {\n return reply.status(404).send(\"Dashboard schema not configured\");\n }\n reply.type(\"text/markdown\").send(opts.promptInstructions);\n },\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/dashboards\",\n schema: {\n description: \"Create a dashboard containing a uiTree\",\n body: dashboardDatasource.createDashboardParams,\n response: {\n 201: dashboardDatasource.dashboardSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.dynamicDashboardDatasource.createDashboard({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.status(201).send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/dashboards/:dashboardId\",\n schema: {\n description: \"Get a dashboard containing a uiTree to be rendered\",\n params: z.object({\n dashboardId: z.string(),\n }),\n response: {\n 200: dashboardDatasource.dashboardSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n try {\n const result = await opts.dynamicDashboardDatasource.getDashboard({\n id: req.params.dashboardId,\n requestContext: req.requestContext,\n });\n res.send(result);\n } catch (error) {\n const msg = error instanceof Error ? error.message.toLowerCase() : \"\";\n if (msg.includes(\"not found\")) {\n throw new DashboardNotFoundError(\n `Dashboard not found: ${req.params.dashboardId}`,\n { cause: error }\n );\n }\n throw error;\n }\n },\n });\n\n const searchResponseSchema = z.object({\n data: z.array(dashboardDatasource.dashboardSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/dashboards/search\",\n schema: {\n description: \"Search dashboards matching a filter\",\n body: dashboardDatasource.searchDashboardsFilter,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.dynamicDashboardDatasource.searchDashboards({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { type datasource, type dashboardDatasource } from \"@kopai/core\";\n\nimport {\n serializerCompiler,\n validatorCompiler,\n} from \"fastify-type-provider-zod\";\nimport { errorHandler } from \"./routes/error-handler.js\";\nimport { tracesRoutes } from \"./routes/traces.js\";\nimport { logsRoutes } from \"./routes/logs.js\";\nimport { metricsRoutes } from \"./routes/metrics.js\";\nimport { dashboardsRoutes as _dashboardsRoutes } from \"./routes/dashboards.js\";\n\nexport const signalsRoutes: FastifyPluginAsyncZod<{\n readTelemetryDatasource: datasource.ReadTelemetryDatasource;\n}> = async function (fastify, opts) {\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n fastify.setErrorHandler(errorHandler);\n\n fastify.register(tracesRoutes, {\n readTracesDatasource: opts.readTelemetryDatasource,\n });\n\n fastify.register(logsRoutes, {\n readLogsDatasource: opts.readTelemetryDatasource,\n });\n\n fastify.register(metricsRoutes, {\n readMetricsDatasource: opts.readTelemetryDatasource,\n });\n};\n\nexport const dashboardsRoutes: FastifyPluginAsyncZod<{\n dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;\n promptInstructions?: string;\n}> = async function (fastify, opts) {\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n fastify.setErrorHandler(errorHandler);\n\n fastify.register(_dashboardsRoutes, {\n dynamicDashboardDatasource: opts.dynamicDashboardDatasource,\n promptInstructions: opts.promptInstructions,\n });\n};\n\ndeclare module \"fastify\" {\n interface FastifyRequest {\n requestContext?: unknown;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAsB,WAAtB,cAAuC,MAAM;CAG3C,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,SAAO,eAAe,MAAM,IAAI,OAAO,UAAU;;;AAMrD,IAAa,yBAAb,cAA4C,SAAS;CACnD,OAAgB;;;;ACLlB,SAAgB,aACd,OACA,SACA,OACA;AACA,KAAI,cAAc,MAAM,CACtB,QAAO,MAAM,OAAO,IAAI,CAAC,KAAK;EAoB5B,MAAM;EACN,QAAQ;EACR,OAAO;EACP,QAAQ,MAAM;EACf,CAA4B;AAG/B,KAAI,iBAAiB,wBAAwB;AAC3C,UAAQ,IAAI,KAAK,MAAM,QAAQ;AAC/B,SAAO,MAAM,OAAO,IAAI,CAAC,KAAK;GAC5B,MAAM;GACN,QAAQ;GACR,OAAO;GACP,QAAQ,MAAM;GACf,CAA4B;;AAE/B,SAAQ,IAAI,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AK;EACL,QAAQ;GACN,aAAa;GACb,MAAM,oBAAoB;GAC1B,UAAU;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACR;GACF;EACD,SAAS,OAAO,KAAK,QAAQ;GAC3B,MAAM,SAAS,MAAM,KAAK,2BAA2B,iBAAiB;IACpE,GAAG,IAAI;IACP,gBAAgB,IAAI;IACrB,CAAC;AACF,OAAI,KAAK,OAAO;;EAEnB,CAAC;;;;AChGJ,MAAa,gBAER,eAAgB,SAAS,MAAM;AAClC,SAAQ,qBAAqB,kBAAkB;AAC/C,SAAQ,sBAAsB,mBAAmB;AACjD,SAAQ,gBAAgB,aAAa;AAErC,SAAQ,SAAS,cAAc,EAC7B,sBAAsB,KAAK,yBAC5B,CAAC;AAEF,SAAQ,SAAS,YAAY,EAC3B,oBAAoB,KAAK,yBAC1B,CAAC;AAEF,SAAQ,SAAS,eAAe,EAC9B,uBAAuB,KAAK,yBAC7B,CAAC;;AAGJ,MAAa,mBAGR,eAAgB,SAAS,MAAM;AAClC,SAAQ,qBAAqB,kBAAkB;AAC/C,SAAQ,sBAAsB,mBAAmB;AACjD,SAAQ,gBAAgB,aAAa;AAErC,SAAQ,SAASC,oBAAmB;EAClC,4BAA4B,KAAK;EACjC,oBAAoB,KAAK;EAC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopai/api",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Vladimir Adamic",
6
6
  "repository": {
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "fastify-type-provider-zod": "^6.1.0",
35
- "@kopai/core": "0.6.0"
35
+ "@kopai/core": "0.8.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@fastify/swagger": "^9.7.0",
39
39
  "@fastify/swagger-ui": "^5.2.5",
40
- "tsdown": "^0.20.3",
40
+ "tsdown": "^0.21.2",
41
41
  "@kopai/tsconfig": "0.2.0"
42
42
  },
43
43
  "scripts": {