@ancplua/qyl-api-schema 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +89 -0
  3. package/VERSIONING.md +74 -0
  4. package/api/routes.tsp +1052 -0
  5. package/api/streaming.tsp +335 -0
  6. package/common/errors.tsp +206 -0
  7. package/common/pagination.tsp +254 -0
  8. package/common/types.tsp +345 -0
  9. package/generated/README.md +26 -0
  10. package/generated/otel-keys.gen.tsp +1648 -0
  11. package/index.tsp +55 -0
  12. package/intelligence/causal-rules.tsp +34 -0
  13. package/intelligence/diagnostic-patterns.tsp +54 -0
  14. package/intelligence/investigation-strategies.tsp +37 -0
  15. package/intelligence/main.tsp +19 -0
  16. package/intelligence/seed/patterns.tsp +172 -0
  17. package/intelligence/seed/rules.tsp +44 -0
  18. package/intelligence/seed/strategies.tsp +56 -0
  19. package/intelligence/signals.tsp +60 -0
  20. package/models/agent/agent-run.tsp +154 -0
  21. package/models/agent/tool-call.tsp +122 -0
  22. package/models/agent/workflow-checkpoint.tsp +50 -0
  23. package/models/agent/workflow-execution.tsp +136 -0
  24. package/models/alerting.tsp +436 -0
  25. package/models/configurator.tsp +433 -0
  26. package/models/control-graph.tsp +197 -0
  27. package/models/db.tsp +810 -0
  28. package/models/deployment.tsp +365 -0
  29. package/models/error.tsp +433 -0
  30. package/models/genai.tsp +1368 -0
  31. package/models/http.tsp +600 -0
  32. package/models/identity.tsp +213 -0
  33. package/models/issues.tsp +484 -0
  34. package/models/log.tsp +140 -0
  35. package/models/messaging.tsp +304 -0
  36. package/models/otel-config.tsp +455 -0
  37. package/models/retention.tsp +240 -0
  38. package/models/rpc.tsp +309 -0
  39. package/models/search.tsp +243 -0
  40. package/models/session.tsp +274 -0
  41. package/models/system.tsp +400 -0
  42. package/models/test.tsp +346 -0
  43. package/models/triage.tsp +113 -0
  44. package/models/workflow.tsp +396 -0
  45. package/models/workspace.tsp +435 -0
  46. package/otel/enums.tsp +392 -0
  47. package/otel/logs.tsp +135 -0
  48. package/otel/metrics.tsp +358 -0
  49. package/otel/otel-conventions.tsp +14 -0
  50. package/otel/profiles.tsp +335 -0
  51. package/otel/resource.tsp +257 -0
  52. package/otel/span.tsp +307 -0
  53. package/package.json +88 -0
  54. package/tspconfig.yaml +49 -0
@@ -0,0 +1,346 @@
1
+ // =============================================================================
2
+ // ANcpLua v2.0 - Test Semantic Conventions (OTel v1.40)
3
+ // =============================================================================
4
+ // Test execution telemetry attributes.
5
+ // =============================================================================
6
+
7
+ import "@typespec/openapi";
8
+ import "../common/types.tsp";
9
+
10
+ using TypeSpec.OpenAPI;
11
+ using Qyl.Api.Contracts.Common;
12
+
13
+ namespace Qyl.Api.Contracts.Domains.Observe.Test;
14
+
15
+ // =============================================================================
16
+ // Test Attributes
17
+ // =============================================================================
18
+
19
+ @doc("Test case attributes")
20
+ model TestAttributes {
21
+ @doc("Test case name")
22
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.CaseName)
23
+ caseName: string;
24
+
25
+ @doc("Test case result")
26
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.CaseResultStatus)
27
+ caseResultStatus?: TestResultStatus;
28
+
29
+ @doc("Test suite name")
30
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.SuiteName)
31
+ suiteName?: string;
32
+
33
+ @doc("Test suite run status")
34
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.SuiteRunStatus)
35
+ suiteRunStatus?: TestSuiteRunStatus;
36
+ }
37
+
38
+ // =============================================================================
39
+ // Test Enumerations
40
+ // =============================================================================
41
+
42
+ @doc("Test case result status")
43
+ enum TestResultStatus {
44
+ @doc("Test passed")
45
+ pass: "pass",
46
+
47
+ @doc("Test failed")
48
+ fail: "fail",
49
+ }
50
+
51
+ @doc("Test suite run status")
52
+ enum TestSuiteRunStatus {
53
+ @doc("Suite succeeded")
54
+ success: "success",
55
+
56
+ @doc("Suite failed")
57
+ failure: "failure",
58
+
59
+ @doc("Suite skipped")
60
+ skipped: "skipped",
61
+
62
+ @doc("Suite aborted")
63
+ aborted: "aborted",
64
+
65
+ @doc("Suite timed out")
66
+ timedOut: "timed_out",
67
+
68
+ @doc("Suite in progress")
69
+ inProgress: "in_progress",
70
+ }
71
+
72
+ // =============================================================================
73
+ // Test Run Entity
74
+ // =============================================================================
75
+
76
+ @doc("Test run entity")
77
+ @TypeSpec.OpenAPI.extension("x-csharp-type", "TestRunEntity")
78
+ model TestRunEntity {
79
+ @doc("Test run ID")
80
+ @key
81
+ @encodedName("application/json", "run_id")
82
+ runId: string;
83
+
84
+ @doc("Test suite name")
85
+ @encodedName("application/json", "suite_name")
86
+ suiteName: string;
87
+
88
+ @doc("Run status")
89
+ status: TestSuiteRunStatus;
90
+
91
+ @doc("Start time")
92
+ @encodedName("application/json", "start_time")
93
+ startTime: utcDateTime;
94
+
95
+ @doc("End time")
96
+ @encodedName("application/json", "end_time")
97
+ endTime?: utcDateTime;
98
+
99
+ @doc("Duration in milliseconds")
100
+ @encodedName("application/json", "duration_ms")
101
+ durationMs?: int64;
102
+
103
+ @doc("Total test count")
104
+ @encodedName("application/json", "total_count")
105
+ totalCount: int32;
106
+
107
+ @doc("Passed count")
108
+ @encodedName("application/json", "passed_count")
109
+ passedCount: int32;
110
+
111
+ @doc("Failed count")
112
+ @encodedName("application/json", "failed_count")
113
+ failedCount: int32;
114
+
115
+ @doc("Skipped count")
116
+ @encodedName("application/json", "skipped_count")
117
+ skippedCount: int32;
118
+
119
+ @doc("Flaky count")
120
+ @encodedName("application/json", "flaky_count")
121
+ flakyCount?: int32;
122
+
123
+ @doc("Test framework")
124
+ framework?: TestFramework;
125
+
126
+ @doc("CI/CD run ID")
127
+ @encodedName("application/json", "cicd_run_id")
128
+ cicdRunId?: string;
129
+
130
+ @doc("Git commit SHA")
131
+ @encodedName("application/json", "git_commit")
132
+ gitCommit?: string;
133
+
134
+ @doc("Git branch")
135
+ @encodedName("application/json", "git_branch")
136
+ gitBranch?: string;
137
+ }
138
+
139
+ @doc("Test frameworks")
140
+ enum TestFramework {
141
+ @doc("Jest")
142
+ jest: "jest",
143
+
144
+ @doc("Mocha")
145
+ mocha: "mocha",
146
+
147
+ @doc("Vitest")
148
+ vitest: "vitest",
149
+
150
+ @doc("Playwright")
151
+ playwright: "playwright",
152
+
153
+ @doc("Cypress")
154
+ cypress: "cypress",
155
+
156
+ @doc("Selenium")
157
+ selenium: "selenium",
158
+
159
+ @doc("pytest")
160
+ pytest: "pytest",
161
+
162
+ @doc("unittest")
163
+ unittest: "unittest",
164
+
165
+ @doc("JUnit")
166
+ junit: "junit",
167
+
168
+ @doc("TestNG")
169
+ testng: "testng",
170
+
171
+ @doc("xUnit")
172
+ xunit: "xunit",
173
+
174
+ @doc("NUnit")
175
+ nunit: "nunit",
176
+
177
+ @doc("MSTest")
178
+ mstest: "mstest",
179
+
180
+ @doc("RSpec")
181
+ rspec: "rspec",
182
+
183
+ @doc("Go testing")
184
+ goTest: "go_test",
185
+
186
+ @doc("Rust cargo test")
187
+ cargoTest: "cargo_test",
188
+
189
+ @doc("Other")
190
+ other: "other",
191
+ }
192
+
193
+ // =============================================================================
194
+ // Test Case Entity
195
+ // =============================================================================
196
+
197
+ @doc("Test case entity")
198
+ @TypeSpec.OpenAPI.extension("x-csharp-type", "TestCaseEntity")
199
+ model TestCaseEntity {
200
+ @doc("Test case ID")
201
+ @key
202
+ @encodedName("application/json", "case_id")
203
+ caseId: string;
204
+
205
+ @doc("Test run ID")
206
+ @encodedName("application/json", "run_id")
207
+ runId: string;
208
+
209
+ @doc("Test case name")
210
+ name: string;
211
+
212
+ @doc("Test file path")
213
+ @encodedName("application/json", "file_path")
214
+ filePath?: string;
215
+
216
+ @doc("Result status")
217
+ status: TestResultStatus;
218
+
219
+ @doc("Duration in milliseconds")
220
+ @encodedName("application/json", "duration_ms")
221
+ durationMs?: int64;
222
+
223
+ @doc("Error message (if failed)")
224
+ @encodedName("application/json", "error_message")
225
+ errorMessage?: string;
226
+
227
+ @doc("Error stack trace")
228
+ @encodedName("application/json", "stack_trace")
229
+ stackTrace?: string;
230
+
231
+ @doc("Retry count")
232
+ @encodedName("application/json", "retry_count")
233
+ retryCount?: int32;
234
+
235
+ @doc("Is flaky")
236
+ @encodedName("application/json", "is_flaky")
237
+ isFlaky?: boolean;
238
+
239
+ @doc("Tags")
240
+ tags?: string[];
241
+ }
242
+
243
+ // =============================================================================
244
+ // Test Metrics
245
+ // =============================================================================
246
+
247
+ @doc("Test run count metric")
248
+ model TestRunCountMetric {
249
+ @doc("Metric name")
250
+ name: "test.runs";
251
+
252
+ @doc("Metric unit")
253
+ unit: "{run}";
254
+
255
+ @doc("Suite name")
256
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.SuiteName)
257
+ suiteName: string;
258
+
259
+ @doc("Status")
260
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.SuiteRunStatus)
261
+ status: TestSuiteRunStatus;
262
+ }
263
+
264
+ @doc("Test case count metric")
265
+ model TestCaseCountMetric {
266
+ @doc("Metric name")
267
+ name: "test.cases";
268
+
269
+ @doc("Metric unit")
270
+ unit: "{test}";
271
+
272
+ @doc("Suite name")
273
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.SuiteName)
274
+ suiteName: string;
275
+
276
+ @doc("Result status")
277
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.CaseResultStatus)
278
+ resultStatus: TestResultStatus;
279
+ }
280
+
281
+ @doc("Test duration metric")
282
+ model TestDurationMetric {
283
+ @doc("Metric name")
284
+ name: "test.duration";
285
+
286
+ @doc("Metric unit (seconds)")
287
+ unit: "s";
288
+
289
+ @doc("Suite name")
290
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Test.SuiteName)
291
+ suiteName: string;
292
+ }
293
+
294
+ // =============================================================================
295
+ // Test Coverage
296
+ // =============================================================================
297
+
298
+ @doc("Code coverage report")
299
+ model CoverageReport {
300
+ @doc("Run ID")
301
+ @encodedName("application/json", "run_id")
302
+ runId: string;
303
+
304
+ @doc("Overall line coverage")
305
+ @encodedName("application/json", "line_coverage")
306
+ lineCoverage: Percentage;
307
+
308
+ @doc("Overall branch coverage")
309
+ @encodedName("application/json", "branch_coverage")
310
+ branchCoverage?: Percentage;
311
+
312
+ @doc("Overall function coverage")
313
+ @encodedName("application/json", "function_coverage")
314
+ functionCoverage?: Percentage;
315
+
316
+ @doc("Statement coverage")
317
+ @encodedName("application/json", "statement_coverage")
318
+ statementCoverage?: Percentage;
319
+
320
+ @doc("Coverage by file")
321
+ @encodedName("application/json", "by_file")
322
+ byFile?: FileCoverage[];
323
+ }
324
+
325
+ @doc("File coverage")
326
+ model FileCoverage {
327
+ @doc("File path")
328
+ @encodedName("application/json", "file_path")
329
+ filePath: string;
330
+
331
+ @doc("Line coverage")
332
+ @encodedName("application/json", "line_coverage")
333
+ lineCoverage: Percentage;
334
+
335
+ @doc("Covered lines")
336
+ @encodedName("application/json", "covered_lines")
337
+ coveredLines: int32;
338
+
339
+ @doc("Total lines")
340
+ @encodedName("application/json", "total_lines")
341
+ totalLines: int32;
342
+
343
+ @doc("Uncovered line numbers")
344
+ @encodedName("application/json", "uncovered_lines")
345
+ uncoveredLines?: int32[];
346
+ }
@@ -0,0 +1,113 @@
1
+ // =============================================================================
2
+ // ANcpLua v2.0 - Triage Models (Loom Pipeline)
3
+ // =============================================================================
4
+ // AI-powered triage pipeline: score fixability, summarize, and route errors.
5
+ // =============================================================================
6
+
7
+ import "@typespec/openapi";
8
+ import "../common/types.tsp";
9
+
10
+ using TypeSpec.OpenAPI;
11
+ using Qyl.Api.Contracts.Common;
12
+
13
+ namespace Qyl.Api.Contracts.Domains.Loom.Triage;
14
+
15
+ // =============================================================================
16
+ // Triage Automation Level
17
+ // =============================================================================
18
+
19
+ @doc("Automation level determined by fixability score")
20
+ enum TriageAutomationLevel {
21
+ @doc("Auto-fix: score >= 0.8, proceed without human review")
22
+ auto: "auto",
23
+
24
+ @doc("Assisted: 0.5 <= score < 0.8, suggest fix with human review")
25
+ assisted: "assisted",
26
+
27
+ @doc("Manual: 0.2 <= score < 0.5, provide context but human must fix")
28
+ manual: "manual",
29
+
30
+ @doc("Skip: score < 0.2, not actionable for automated fix")
31
+ skip: "skip",
32
+ }
33
+
34
+ // =============================================================================
35
+ // Triage Result Entity
36
+ // =============================================================================
37
+
38
+ @doc("AI triage assessment for an error issue")
39
+ @TypeSpec.OpenAPI.extension("x-csharp-type", "TriageResultEntity")
40
+ model TriageResultEntity {
41
+ @doc("Triage result ID")
42
+ @key
43
+ @encodedName("application/json", "triage_id")
44
+ triageId: string;
45
+
46
+ @doc("Associated error issue ID")
47
+ @encodedName("application/json", "issue_id")
48
+ issueId: string;
49
+
50
+ @doc("Fixability score (0.0 to 1.0)")
51
+ @encodedName("application/json", "fixability_score")
52
+ fixabilityScore: float64;
53
+
54
+ @doc("Automation level derived from score")
55
+ @encodedName("application/json", "automation_level")
56
+ automationLevel: TriageAutomationLevel;
57
+
58
+ @doc("AI-generated summary of the issue")
59
+ @encodedName("application/json", "ai_summary")
60
+ aiSummary?: string;
61
+
62
+ @doc("Root cause hypothesis from AI analysis")
63
+ @encodedName("application/json", "root_cause_hypothesis")
64
+ rootCauseHypothesis?: string;
65
+
66
+ @doc("What triggered this triage")
67
+ @encodedName("application/json", "triggered_by")
68
+ triggeredBy: TriageTrigger;
69
+
70
+ @doc("Linked fix run ID (if auto-routed)")
71
+ @encodedName("application/json", "fix_run_id")
72
+ fixRunId?: string;
73
+
74
+ @doc("Whether scoring was done by LLM or heuristic fallback")
75
+ @encodedName("application/json", "scoring_method")
76
+ scoringMethod: TriageScoringMethod;
77
+
78
+ @doc("When this triage was created")
79
+ @encodedName("application/json", "created_at")
80
+ createdAt: utcDateTime;
81
+ }
82
+
83
+ // =============================================================================
84
+ // Triage Trigger
85
+ // =============================================================================
86
+
87
+ @doc("What triggered the triage assessment")
88
+ enum TriageTrigger {
89
+ @doc("New issue created from error ingestion")
90
+ newIssue: "new_issue",
91
+
92
+ @doc("Previously resolved issue regressed")
93
+ regression: "regression",
94
+
95
+ @doc("Manually triggered by user or agent")
96
+ manual: "manual",
97
+
98
+ @doc("Re-triage due to updated context")
99
+ retriage: "retriage",
100
+ }
101
+
102
+ // =============================================================================
103
+ // Scoring Method
104
+ // =============================================================================
105
+
106
+ @doc("How the fixability score was determined")
107
+ enum TriageScoringMethod {
108
+ @doc("LLM-based structured scoring")
109
+ llm: "llm",
110
+
111
+ @doc("Heuristic fallback (no LLM configured)")
112
+ heuristic: "heuristic",
113
+ }