@ancplua/qyl-api-schema 0.4.0 → 0.5.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 (61) hide show
  1. package/README.md +52 -64
  2. package/api/routes.tsp +90 -943
  3. package/api/runner.tsp +99 -0
  4. package/api/streaming.tsp +13 -299
  5. package/common/errors.tsp +14 -1
  6. package/common/pagination.tsp +1 -1
  7. package/common/types.tsp +2 -41
  8. package/generated/json-schema/qyl-api-schema.json +3868 -0
  9. package/generated/openapi/qyl.openapi.json +6919 -0
  10. package/generated/ts-runtime/api.d.ts +886 -0
  11. package/generated/ts-runtime/api.js +237 -0
  12. package/index.tsp +8 -34
  13. package/models/health.tsp +22 -0
  14. package/models/mcp-tools.tsp +217 -0
  15. package/models/runner-mcp.tsp +76 -0
  16. package/models/runner.tsp +67 -0
  17. package/models/session.tsp +1 -1
  18. package/otel/enums.tsp +1 -1
  19. package/otel/logs.tsp +1 -1
  20. package/otel/otel-conventions.tsp +0 -1
  21. package/otel/profiles.tsp +1 -1
  22. package/otel/resource.tsp +1 -1
  23. package/otel/span.tsp +9 -6
  24. package/package.json +56 -36
  25. package/VERSIONING.md +0 -88
  26. package/generated/README.md +0 -35
  27. package/intelligence/causal-rules.tsp +0 -34
  28. package/intelligence/diagnostic-patterns.tsp +0 -54
  29. package/intelligence/investigation-strategies.tsp +0 -37
  30. package/intelligence/main.tsp +0 -17
  31. package/intelligence/seed/patterns.tsp +0 -171
  32. package/intelligence/seed/rules.tsp +0 -43
  33. package/intelligence/seed/strategies.tsp +0 -55
  34. package/intelligence/signals.tsp +0 -60
  35. package/models/agent/agent-run.tsp +0 -154
  36. package/models/agent/tool-call.tsp +0 -122
  37. package/models/agent/workflow-checkpoint.tsp +0 -50
  38. package/models/agent/workflow-execution.tsp +0 -136
  39. package/models/alerting.tsp +0 -436
  40. package/models/configurator.tsp +0 -433
  41. package/models/control-graph.tsp +0 -197
  42. package/models/db.tsp +0 -767
  43. package/models/deployment.tsp +0 -365
  44. package/models/error.tsp +0 -433
  45. package/models/genai.tsp +0 -1305
  46. package/models/http.tsp +0 -547
  47. package/models/identity.tsp +0 -213
  48. package/models/issues.tsp +0 -484
  49. package/models/log.tsp +0 -140
  50. package/models/messaging.tsp +0 -304
  51. package/models/otel-config.tsp +0 -455
  52. package/models/retention.tsp +0 -240
  53. package/models/rpc.tsp +0 -309
  54. package/models/search.tsp +0 -243
  55. package/models/system.tsp +0 -400
  56. package/models/test.tsp +0 -346
  57. package/models/triage.tsp +0 -113
  58. package/models/workflow.tsp +0 -396
  59. package/models/workspace.tsp +0 -435
  60. package/otel/metrics.tsp +0 -358
  61. package/tspconfig.yaml +0 -49
package/otel/metrics.tsp DELETED
@@ -1,358 +0,0 @@
1
- // =============================================================================
2
- // ANcpLua v2.0 - OpenTelemetry Metrics Model
3
- // =============================================================================
4
- // Metrics data model with discriminated unions for different metric types.
5
- // =============================================================================
6
-
7
- import "@typespec/http";
8
- import "../common/types.tsp";
9
- import "./enums.tsp";
10
- import "./resource.tsp";
11
-
12
- using TypeSpec.Http;
13
- using Qyl.Api.Contracts.Common;
14
- using Qyl.Api.Contracts.OTel.Enums;
15
- using Qyl.Api.Contracts.OTel.Resource;
16
-
17
- namespace Qyl.Api.Contracts.OTel.Metrics;
18
-
19
- // =============================================================================
20
- // Metric Model
21
- // =============================================================================
22
-
23
- @doc("OpenTelemetry Metric containing measurement data")
24
- model Metric {
25
- @doc("Metric name (e.g., http.server.request.duration)")
26
- @minLength(1)
27
- name: string;
28
-
29
- @doc("Metric description")
30
- description?: string;
31
-
32
- @doc("Metric unit (e.g., 's', 'By', '1')")
33
- unit?: string;
34
-
35
- @doc("Metric data (discriminated by type)")
36
- data: MetricData;
37
-
38
- @doc("Metric metadata attributes")
39
- metadata?: Attribute[];
40
-
41
- @doc("Resource describing the entity that produced this metric")
42
- resource: Qyl.Api.Contracts.OTel.Resource.Resource;
43
-
44
- @doc("Instrumentation scope")
45
- @encodedName("application/json", "instrumentation_scope")
46
- instrumentationScope?: InstrumentationScope;
47
- }
48
-
49
- // =============================================================================
50
- // Metric Data Types (Discriminated Union)
51
- // =============================================================================
52
-
53
- @doc("Metric data discriminated by type")
54
- @discriminator("type")
55
- model MetricData {
56
- @doc("Metric type discriminator")
57
- type: MetricType;
58
- }
59
-
60
- @doc("Gauge metric - instantaneous value at a point in time")
61
- model GaugeData extends MetricData {
62
- /** Discriminator identifying this as gauge metric data */
63
- type: MetricType.gauge;
64
-
65
- @doc("Gauge data points")
66
- @encodedName("application/json", "data_points")
67
- dataPoints: NumberDataPoint[];
68
- }
69
-
70
- @doc("Sum metric - cumulative or delta counter")
71
- model SumData extends MetricData {
72
- /** Discriminator identifying this as sum metric data */
73
- type: MetricType.sum;
74
-
75
- @doc("Sum data points")
76
- @encodedName("application/json", "data_points")
77
- dataPoints: NumberDataPoint[];
78
-
79
- @doc("Whether the sum is monotonically increasing")
80
- @encodedName("application/json", "is_monotonic")
81
- isMonotonic: boolean;
82
-
83
- @doc("Aggregation temporality")
84
- @encodedName("application/json", "aggregation_temporality")
85
- aggregationTemporality: AggregationTemporality;
86
- }
87
-
88
- @doc("Histogram metric - distribution of values in buckets")
89
- model HistogramData extends MetricData {
90
- /** Discriminator identifying this as histogram metric data */
91
- type: MetricType.histogram;
92
-
93
- @doc("Histogram data points")
94
- @encodedName("application/json", "data_points")
95
- dataPoints: HistogramDataPoint[];
96
-
97
- @doc("Aggregation temporality")
98
- @encodedName("application/json", "aggregation_temporality")
99
- aggregationTemporality: AggregationTemporality;
100
- }
101
-
102
- @doc("Exponential histogram metric - distribution with exponential bucket boundaries")
103
- model ExponentialHistogramData extends MetricData {
104
- /** Discriminator identifying this as exponential histogram metric data */
105
- type: MetricType.exponentialHistogram;
106
-
107
- @doc("Exponential histogram data points")
108
- @encodedName("application/json", "data_points")
109
- dataPoints: ExponentialHistogramDataPoint[];
110
-
111
- @doc("Aggregation temporality")
112
- @encodedName("application/json", "aggregation_temporality")
113
- aggregationTemporality: AggregationTemporality;
114
- }
115
-
116
- @doc("Summary metric - pre-aggregated quantile distribution")
117
- model SummaryData extends MetricData {
118
- /** Discriminator identifying this as summary metric data */
119
- type: MetricType.summary;
120
-
121
- @doc("Summary data points")
122
- @encodedName("application/json", "data_points")
123
- dataPoints: SummaryDataPoint[];
124
- }
125
-
126
- // =============================================================================
127
- // Data Point Models
128
- // =============================================================================
129
-
130
- @doc("Base data point with common fields")
131
- model DataPointBase {
132
- @doc("Start timestamp in nanoseconds since epoch")
133
- @encodedName("application/json", "start_time_unix_nano")
134
- startTimeUnixNano: UnixNanos;
135
-
136
- @doc("End timestamp in nanoseconds since epoch")
137
- @encodedName("application/json", "time_unix_nano")
138
- timeUnixNano: UnixNanos;
139
-
140
- @doc("Data point attributes")
141
- attributes?: Attribute[];
142
-
143
- @doc("Data point flags")
144
- flags?: DataPointFlags;
145
- }
146
-
147
- @doc("Numeric data point (for Gauge and Sum)")
148
- model NumberDataPoint extends DataPointBase {
149
- @doc("Value as integer")
150
- @encodedName("application/json", "as_int")
151
- asInt?: int64;
152
-
153
- @doc("Value as double")
154
- @encodedName("application/json", "as_double")
155
- asDouble?: float64;
156
-
157
- @doc("Exemplars for the data point")
158
- exemplars?: Exemplar[];
159
- }
160
-
161
- @doc("Histogram data point")
162
- model HistogramDataPoint extends DataPointBase {
163
- @doc("Number of values in the histogram")
164
- count: int64;
165
-
166
- @doc("Sum of all values")
167
- sum?: float64;
168
-
169
- @doc("Bucket counts")
170
- @encodedName("application/json", "bucket_counts")
171
- bucketCounts: int64[];
172
-
173
- @doc("Explicit bucket boundaries")
174
- @encodedName("application/json", "explicit_bounds")
175
- explicitBounds: float64[];
176
-
177
- @doc("Minimum value")
178
- min?: float64;
179
-
180
- @doc("Maximum value")
181
- max?: float64;
182
-
183
- @doc("Exemplars for the data point")
184
- exemplars?: Exemplar[];
185
- }
186
-
187
- @doc("Exponential histogram data point")
188
- model ExponentialHistogramDataPoint extends DataPointBase {
189
- @doc("Number of values")
190
- count: int64;
191
-
192
- @doc("Sum of all values")
193
- sum?: float64;
194
-
195
- @doc("Scale factor for bucket boundaries")
196
- scale: int32;
197
-
198
- @doc("Zero count")
199
- @encodedName("application/json", "zero_count")
200
- zeroCount: int64;
201
-
202
- @doc("Zero threshold")
203
- @encodedName("application/json", "zero_threshold")
204
- zeroThreshold?: float64;
205
-
206
- @doc("Positive bucket counts")
207
- positive: ExponentialBuckets;
208
-
209
- @doc("Negative bucket counts")
210
- negative: ExponentialBuckets;
211
-
212
- @doc("Minimum value")
213
- min?: float64;
214
-
215
- @doc("Maximum value")
216
- max?: float64;
217
-
218
- @doc("Exemplars for the data point")
219
- exemplars?: Exemplar[];
220
- }
221
-
222
- @doc("Exponential histogram buckets")
223
- model ExponentialBuckets {
224
- @doc("Offset of the first bucket")
225
- offset: int32;
226
-
227
- @doc("Bucket counts")
228
- @encodedName("application/json", "bucket_counts")
229
- bucketCounts: int64[];
230
- }
231
-
232
- @doc("Summary data point")
233
- model SummaryDataPoint extends DataPointBase {
234
- @doc("Number of values")
235
- count: int64;
236
-
237
- @doc("Sum of all values")
238
- sum: float64;
239
-
240
- @doc("Quantile values")
241
- @encodedName("application/json", "quantile_values")
242
- quantileValues: QuantileValue[];
243
- }
244
-
245
- @doc("Quantile value for summary")
246
- model QuantileValue {
247
- @doc("Quantile (0.0 to 1.0)")
248
- @minValue(0.0)
249
- @maxValue(1.0)
250
- quantile: float64;
251
-
252
- @doc("Value at this quantile")
253
- value: float64;
254
- }
255
-
256
- @doc("Exemplar - sample trace linked to metric")
257
- model Exemplar {
258
- @doc("Timestamp in nanoseconds since epoch")
259
- @encodedName("application/json", "time_unix_nano")
260
- timeUnixNano: UnixNanos;
261
-
262
- @doc("Value as integer")
263
- @encodedName("application/json", "as_int")
264
- asInt?: int64;
265
-
266
- @doc("Value as double")
267
- @encodedName("application/json", "as_double")
268
- asDouble?: float64;
269
-
270
- @doc("Span ID of the exemplar")
271
- @encodedName("application/json", "span_id")
272
- spanId?: SpanId;
273
-
274
- @doc("Trace ID of the exemplar")
275
- @encodedName("application/json", "trace_id")
276
- traceId?: TraceId;
277
-
278
- @doc("Filtered attributes")
279
- @encodedName("application/json", "filtered_attributes")
280
- filteredAttributes?: Attribute[];
281
- }
282
-
283
- // =============================================================================
284
- // Metric Query & Aggregation
285
- // =============================================================================
286
-
287
- @doc("Metric query filters")
288
- model MetricQueryFilters {
289
- @doc("Filter by metric name (supports wildcards)")
290
- @query
291
- name?: string;
292
-
293
- @doc("Filter by metric type")
294
- @query
295
- type?: MetricType;
296
-
297
- @doc("Filter by service name")
298
- @query
299
- @encodedName("application/json", "service_name")
300
- serviceName?: string;
301
-
302
- @doc("Filter by attribute key-value pair")
303
- @query
304
- attribute?: string;
305
-
306
- @doc("Aggregation function")
307
- @query
308
- @encodedName("application/json", "agg_func")
309
- aggFunc?: AggregationFunction;
310
- }
311
-
312
- @doc("Aggregation functions for metrics")
313
- enum AggregationFunction {
314
- @doc("Sum of values")
315
- sum: "sum",
316
-
317
- @doc("Average of values")
318
- avg: "avg",
319
-
320
- @doc("Minimum value")
321
- min: "min",
322
-
323
- @doc("Maximum value")
324
- max: "max",
325
-
326
- @doc("Count of values")
327
- count: "count",
328
-
329
- @doc("Latest value")
330
- last: "last",
331
-
332
- @doc("Rate of change per second")
333
- rate: "rate",
334
-
335
- @doc("Increase over time range")
336
- increase: "increase",
337
- }
338
-
339
- @doc("Time series data for graphing")
340
- model TimeSeries {
341
- @doc("Metric name")
342
- metric: string;
343
-
344
- @doc("Dimension labels")
345
- labels: Attribute[];
346
-
347
- @doc("Data points over time")
348
- points: TimeSeriesPoint[];
349
- }
350
-
351
- @doc("Single point in a time series")
352
- model TimeSeriesPoint {
353
- @doc("Timestamp")
354
- timestamp: utcDateTime;
355
-
356
- @doc("Value")
357
- value: float64;
358
- }
package/tspconfig.yaml DELETED
@@ -1,49 +0,0 @@
1
- # qyl-api-schema TypeSpec configuration.
2
- # This repo is a contract source, not a server implementation. It emits schema
3
- # and DTO artifacts only; qyl owns runtime services and physical storage schemas.
4
-
5
- emit:
6
- - "@qyl/telemetry-control-graph"
7
- - "@ancplua/typespec-emit-csharp"
8
- - "@ancplua/typespec-emit-ts-types"
9
- - "@typespec/openapi3"
10
- - "@typespec/json-schema"
11
-
12
- options:
13
- "@qyl/telemetry-control-graph":
14
- emitter-output-dir: "{project-root}/generated/control-graph"
15
- file-types:
16
- - json
17
- - yaml
18
- include-schema: true
19
- include-conformance-plan: true
20
- include-report: true
21
-
22
- "@ancplua/typespec-emit-csharp":
23
- emitter-output-dir: "{project-root}/generated/contracts"
24
-
25
- "@ancplua/typespec-emit-ts-types":
26
- emitter-output-dir: "{project-root}/generated/ts-types"
27
-
28
- "@typespec/openapi3":
29
- emitter-output-dir: "{project-root}/generated/openapi"
30
- output-file: "qyl.openapi.json"
31
- file-type: json
32
- openapi-versions:
33
- - "3.2.0"
34
- omit-unreachable-types: true
35
- operation-id-strategy: parent-container
36
-
37
- "@typespec/json-schema":
38
- emitter-output-dir: "{project-root}/generated/json-schema"
39
- file-type: json
40
- bundleId: qyl-api-schema
41
-
42
- linter:
43
- extends:
44
- - "@typespec/http/all"
45
- - "@ancplua/typespec-otelconventions-lint/recommended"
46
- enable:
47
- "@ancplua/typespec-otelconventions-lint/graph-attribute-key":
48
- pattern: "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
49
- allowedRoots: ["qyl", "ancplua"]