@ancplua/qyl-api-schema 12.0.0 → 12.1.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/README.md CHANGED
@@ -158,3 +158,11 @@ How to build, lint, regenerate and publish is in [CONTRIBUTING.md](CONTRIBUTING.
158
158
  ## License
159
159
 
160
160
  Apache-2.0
161
+
162
+ ## Investigation contracts
163
+
164
+ The generated `Mcp.Tools` surface covers the 32-tool qyl MCP set. Each of the 26 read tools has a distinct, typed `POST /api/v1/analysis/<tool_name>` operation. Structured predicates support the shared matcher operators; read results carry the absolute `window` and `coverage` with nullable unknown counts. Existing trace, log, metric and session REST routes remain available.
165
+
166
+ Failure status is updated through `PATCH /api/v1/failures/{failure_id}` with `If-Match`. Failure handles, verification tokens and cursors are scoped and validated by the collector. Annotation contracts support failure targets, labels, classifications and retry keys. These contracts carry product data only; telemetry runtime dependencies remain in their producer repositories.
167
+
168
+ The schema gate checks all read operation/type pairs, answer-key result shapes and invalid inputs, then verifies the packed npm and NuGet consumers. Collector behavior and the seeded live tool answers are tested by the collector and MCP suites against the same generated contracts.
@@ -0,0 +1,165 @@
1
+ import "./routes.tsp";
2
+ import "../models/mcp-tools.tsp";
3
+ import "../models/mcp-analysis.tsp";
4
+ using TypeSpec.Http;
5
+ using TypeSpec.OpenAPI;
6
+ using Qyl.Api.Contracts.Common;
7
+ using Qyl.Api.Contracts.Common.Errors;
8
+ using Qyl.Api.Contracts.Mcp.Tools;
9
+ namespace Qyl.Api.Contracts;
10
+
11
+ @route("/api/v1/analysis")
12
+ @tag("Analysis")
13
+ @useAuth(QylApiKeyHeaderAuth)
14
+ interface AnalysisApi {
15
+ @doc("Read triage evidence in the authenticated project without changing telemetry or user resources.")
16
+ @post
17
+ @route("/triage")
18
+ @operationId("analysis_triage")
19
+ triage(...ProjectScopeHeader, @body request: TriageInput): TriageOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
20
+ @doc("Read list_failures evidence in the authenticated project without changing telemetry or user resources.")
21
+ @post
22
+ @route("/list_failures")
23
+ @operationId("analysis_list_failures")
24
+ list_failures(...ProjectScopeHeader, @body request: ListFailuresInput): ListFailuresOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
25
+ @doc("Read get_failure_context evidence in the authenticated project without changing telemetry or user resources.")
26
+ @post
27
+ @route("/get_failure_context")
28
+ @operationId("analysis_get_failure_context")
29
+ get_failure_context(...ProjectScopeHeader, @body request: GetFailureContextInput): GetFailureContextOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
30
+ @doc("Read compare_groups evidence in the authenticated project without changing telemetry or user resources.")
31
+ @post
32
+ @route("/compare_groups")
33
+ @operationId("analysis_compare_groups")
34
+ compare_groups(...ProjectScopeHeader, @body request: CompareGroupsInput): CompareGroupsOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
35
+ @doc("Read compare_traces evidence in the authenticated project without changing telemetry or user resources.")
36
+ @post
37
+ @route("/compare_traces")
38
+ @operationId("analysis_compare_traces")
39
+ compare_traces(...ProjectScopeHeader, @body request: CompareTracesInput): CompareTracesOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
40
+ @doc("Read verify_fix evidence in the authenticated project without changing telemetry or user resources.")
41
+ @post
42
+ @route("/verify_fix")
43
+ @operationId("analysis_verify_fix")
44
+ verify_fix(...ProjectScopeHeader, @body request: VerifyFixInput): VerifyFixOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
45
+ @doc("Read aggregate_telemetry evidence in the authenticated project without changing telemetry or user resources.")
46
+ @post
47
+ @route("/aggregate_telemetry")
48
+ @operationId("analysis_aggregate_telemetry")
49
+ aggregate_telemetry(...ProjectScopeHeader, @body request: AggregateTelemetryInput): AggregateTelemetryOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
50
+ @doc("Read discover_attributes evidence in the authenticated project without changing telemetry or user resources.")
51
+ @post
52
+ @route("/discover_attributes")
53
+ @operationId("analysis_discover_attributes")
54
+ discover_attributes(...ProjectScopeHeader, @body request: DiscoverAttributesInput): DiscoverAttributesOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
55
+ @doc("Read get_agent_run evidence in the authenticated project without changing telemetry or user resources.")
56
+ @post
57
+ @route("/get_agent_run")
58
+ @operationId("analysis_get_agent_run")
59
+ get_agent_run(...ProjectScopeHeader, @body request: GetAgentRunInput): GetAgentRunOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
60
+ @doc("Read list_releases evidence in the authenticated project without changing telemetry or user resources.")
61
+ @post
62
+ @route("/list_releases")
63
+ @operationId("analysis_list_releases")
64
+ list_releases(...ProjectScopeHeader, @body request: ListReleasesInput): ListReleasesOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
65
+ @doc("Read get_service_map evidence in the authenticated project without changing telemetry or user resources.")
66
+ @post
67
+ @route("/get_service_map")
68
+ @operationId("analysis_get_service_map")
69
+ get_service_map(...ProjectScopeHeader, @body request: GetServiceMapInput): GetServiceMapOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
70
+ @doc("Read check_telemetry_health evidence in the authenticated project without changing telemetry or user resources.")
71
+ @post
72
+ @route("/check_telemetry_health")
73
+ @operationId("analysis_check_telemetry_health")
74
+ check_telemetry_health(...ProjectScopeHeader, @body request: CheckTelemetryHealthInput): CheckTelemetryHealthOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
75
+ @doc("Read get_mcp_stats evidence in the authenticated project without changing telemetry or user resources.")
76
+ @post
77
+ @route("/get_mcp_stats")
78
+ @operationId("analysis_get_mcp_stats")
79
+ get_mcp_stats(...ProjectScopeHeader, @body request: GetMcpStatsInput): GetMcpStatsOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
80
+ @doc("Read list_sessions evidence in the authenticated project without changing telemetry or user resources.")
81
+ @post
82
+ @route("/list_sessions")
83
+ @operationId("analysis_list_sessions")
84
+ list_sessions(...ProjectScopeHeader, @body request: ListSessionsInput): ListSessionsOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
85
+ @doc("Read list_traces evidence in the authenticated project without changing telemetry or user resources.")
86
+ @post
87
+ @route("/list_traces")
88
+ @operationId("analysis_list_traces")
89
+ list_traces(...ProjectScopeHeader, @body request: ListTracesInput): ListTracesOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
90
+ @doc("Read get_trace evidence in the authenticated project without changing telemetry or user resources.")
91
+ @post
92
+ @route("/get_trace")
93
+ @operationId("analysis_get_trace")
94
+ get_trace(...ProjectScopeHeader, @body request: GetTraceInput): GetTraceOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
95
+ @doc("Read search_logs evidence in the authenticated project without changing telemetry or user resources.")
96
+ @post
97
+ @route("/search_logs")
98
+ @operationId("analysis_search_logs")
99
+ search_logs(...ProjectScopeHeader, @body request: SearchLogsInput): SearchLogsOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
100
+ @doc("Read list_metrics evidence in the authenticated project without changing telemetry or user resources.")
101
+ @post
102
+ @route("/list_metrics")
103
+ @operationId("analysis_list_metrics")
104
+ list_metrics(...ProjectScopeHeader, @body request: ListMetricsInput): ListMetricsOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
105
+ @doc("Read get_metric_series evidence in the authenticated project without changing telemetry or user resources.")
106
+ @post
107
+ @route("/get_metric_series")
108
+ @operationId("analysis_get_metric_series")
109
+ get_metric_series(...ProjectScopeHeader, @body request: GetMetricSeriesInput): GetMetricSeriesOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
110
+ @doc("Read query_metric evidence in the authenticated project without changing telemetry or user resources.")
111
+ @post
112
+ @route("/query_metric")
113
+ @operationId("analysis_query_metric")
114
+ query_metric(...ProjectScopeHeader, @body request: QueryMetricInput): QueryMetricOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
115
+ @doc("Read ci_log evidence in the authenticated project without changing telemetry or user resources.")
116
+ @post
117
+ @route("/ci_log")
118
+ @operationId("analysis_ci_log")
119
+ ci_log(...ProjectScopeHeader, @body request: CiLogInput): CiLogOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
120
+ @doc("Read list_saved_queries evidence in the authenticated project without changing telemetry or user resources.")
121
+ @post
122
+ @route("/list_saved_queries")
123
+ @operationId("analysis_list_saved_queries")
124
+ list_saved_queries(...ProjectScopeHeader, @body request: ListSavedQueriesInput): ListSavedQueriesOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
125
+ @doc("Read run_saved_query evidence in the authenticated project without changing telemetry or user resources.")
126
+ @post
127
+ @route("/run_saved_query")
128
+ @operationId("analysis_run_saved_query")
129
+ run_saved_query(...ProjectScopeHeader, @body request: RunSavedQueryInput): RunSavedQueryOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
130
+ @doc("Read display_traces evidence in the authenticated project without changing telemetry or user resources.")
131
+ @post
132
+ @route("/display_traces")
133
+ @operationId("analysis_display_traces")
134
+ display_traces(...ProjectScopeHeader, @body request: DisplayTracesInput): DisplayTracesOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
135
+ @doc("Read display_mcp_dashboard evidence in the authenticated project without changing telemetry or user resources.")
136
+ @post
137
+ @route("/display_mcp_dashboard")
138
+ @operationId("analysis_display_mcp_dashboard")
139
+ display_mcp_dashboard(...ProjectScopeHeader, @body request: DisplayMcpDashboardInput): DisplayMcpDashboardOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
140
+ @doc("Read fetch_telemetry evidence in the authenticated project without changing telemetry or user resources.")
141
+ @post
142
+ @route("/fetch_telemetry")
143
+ @operationId("analysis_fetch_telemetry")
144
+ fetch_telemetry(...ProjectScopeHeader, @body request: FetchTelemetryInput): FetchTelemetryOutput | ValidationError | NotFoundError | UnauthorizedError | CollectorServerErrorResponse;
145
+ }
146
+
147
+ @doc("Mutable status and assignee of a failure; its telemetry fingerprint never changes.")
148
+ model UpdateFailureStatusRequest {
149
+ status: FailureStatus;
150
+ @encodedName("application/json", "ignore_until")
151
+ ignoreUntil?: utcDateTime;
152
+ @maxLength(256)
153
+ assignee?: string;
154
+ }
155
+
156
+ @route("/api/v1/failures")
157
+ @tag("Failures")
158
+ interface FailuresApi {
159
+ @doc("Set a project's failure status or assignee using the version returned by list_failures.")
160
+ @useAuth(QylWriteKeyAuth)
161
+ @patch(#{ implicitOptionality: false })
162
+ @route("/{failure_id}")
163
+ update(...ProjectScopeHeader, ...IfMatchHeader, @path("failure_id") failureId: FailureId, @body request: UpdateFailureStatusRequest):
164
+ UpdateFailureStatusOutput | ValidationError | UnauthorizedError | ForbiddenError | NotFoundError | PreconditionFailedError | PreconditionRequiredError | CollectorServerErrorResponse;
165
+ }
@@ -0,0 +1,62 @@
1
+ import "./types.tsp";
2
+ using TypeSpec.OpenAPI;
3
+ namespace Qyl.Api.Contracts.Common;
4
+
5
+ @doc("Opaque project-scoped failure fingerprint issued and verified by the collector.")
6
+ @minLength(1)
7
+ @maxLength(512)
8
+ scalar FailureId extends string;
9
+
10
+ @doc("Signed self-contained project-scoped verification token issued by the collector.")
11
+ @minLength(1)
12
+ @maxLength(8192)
13
+ scalar VerifyId extends string;
14
+
15
+ @doc("A comparison operand preserves booleans and numbers rather than coercing them to strings.")
16
+ union MatcherValue { text: string, number: float64, boolean: boolean }
17
+
18
+ @doc("Supported predicate operators; equality and prefix retain their existing meaning.")
19
+ enum MatcherOp { eq, neq, `in`, prefix, contains, exists, gt, gte, lt, lte }
20
+
21
+ @doc("Attribute namespace in which the predicate is evaluated.")
22
+ enum MatcherScope { span, resource, log }
23
+
24
+ @doc("TelemetryMatcher contract.")
25
+ model TelemetryMatcher {
26
+ @minLength(1)
27
+ @maxLength(256)
28
+ key: string;
29
+ `op`: MatcherOp;
30
+ value?: MatcherValue;
31
+ @minItems(1)
32
+ @maxItems(256)
33
+ values?: MatcherValue[];
34
+ scope?: MatcherScope;
35
+ }
36
+
37
+ @doc("Absolute half-open window applied by the collector.")
38
+ model ToolWindow {
39
+ @encodedName("application/json", "start_time")
40
+ startTime: utcDateTime;
41
+ @encodedName("application/json", "end_time")
42
+ endTime: utcDateTime;
43
+ }
44
+
45
+ @doc("Scan coverage; unknown counts are null, never an invented zero.")
46
+ model ToolCoverage {
47
+ examined: Count | null;
48
+ matched: Count | null;
49
+ returned: Count | null;
50
+ truncated: boolean;
51
+ @encodedName("application/json", "scan_complete")
52
+ scanComplete: boolean;
53
+ @encodedName("application/json", "as_of")
54
+ asOf: utcDateTime;
55
+ }
56
+
57
+ @doc("ToolReadContext contract.")
58
+ model ToolReadContext {
59
+ window: ToolWindow;
60
+ coverage: ToolCoverage;
61
+ }
62
+