@ancplua/qyl-api-schema 0.5.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.
- package/README.md +5 -3
- package/api/runner.tsp +27 -2
- package/common/types.tsp +0 -35
- package/generated/json-schema/qyl-api-schema.json +3868 -0
- package/generated/openapi/qyl.openapi.json +6919 -0
- package/generated/ts-runtime/api.d.ts +156 -4
- package/generated/ts-runtime/api.js +18 -0
- package/index.tsp +1 -0
- package/models/mcp-tools.tsp +217 -0
- package/models/runner-mcp.tsp +30 -1
- package/models/runner.tsp +31 -1
- package/otel/span.tsp +8 -5
- package/package.json +12 -4
|
@@ -247,11 +247,32 @@ export declare const RunnerResourceLifecycleValues: {
|
|
|
247
247
|
readonly failed: "failed";
|
|
248
248
|
};
|
|
249
249
|
export type RunnerResourceLifecycle = typeof RunnerResourceLifecycleValues[keyof typeof RunnerResourceLifecycleValues];
|
|
250
|
+
export declare const RunnerResourceKindValues: {
|
|
251
|
+
readonly collector: "collector";
|
|
252
|
+
readonly project: "project";
|
|
253
|
+
readonly command: "command";
|
|
254
|
+
readonly stdio: "stdio";
|
|
255
|
+
readonly http: "http";
|
|
256
|
+
readonly inproc: "inproc";
|
|
257
|
+
};
|
|
258
|
+
export type RunnerResourceKind = typeof RunnerResourceKindValues[keyof typeof RunnerResourceKindValues];
|
|
250
259
|
export declare const RunnerLogStreamValues: {
|
|
251
260
|
readonly stdout: "out";
|
|
252
261
|
readonly stderr: "err";
|
|
253
262
|
};
|
|
254
263
|
export type RunnerLogStream = typeof RunnerLogStreamValues[keyof typeof RunnerLogStreamValues];
|
|
264
|
+
export declare const McpDataModeValues: {
|
|
265
|
+
readonly live: "live";
|
|
266
|
+
readonly demo: "demo";
|
|
267
|
+
};
|
|
268
|
+
export type McpDataMode = typeof McpDataModeValues[keyof typeof McpDataModeValues];
|
|
269
|
+
export declare const FetchTelemetryViewValues: {
|
|
270
|
+
readonly traces: "traces";
|
|
271
|
+
readonly trace: "trace";
|
|
272
|
+
readonly logs: "logs";
|
|
273
|
+
readonly mcpStats: "mcp_stats";
|
|
274
|
+
};
|
|
275
|
+
export type FetchTelemetryView = typeof FetchTelemetryViewValues[keyof typeof FetchTelemetryViewValues];
|
|
255
276
|
export type AttributeValue = string | boolean | number | string[] | boolean[] | number[];
|
|
256
277
|
export type ApiError = NotFoundError | ValidationError | UnauthorizedError | ForbiddenError | ConflictError | RateLimitError | InternalServerError | BadGatewayError | ServiceUnavailableError;
|
|
257
278
|
export type LogBody = LogBodyString | LogBodyKvList | LogBodyArray | LogBodyBytes;
|
|
@@ -422,9 +443,8 @@ export interface SpanStatus {
|
|
|
422
443
|
"code": SpanStatusCode;
|
|
423
444
|
"message"?: string;
|
|
424
445
|
}
|
|
425
|
-
export interface
|
|
446
|
+
export interface TraceSummary {
|
|
426
447
|
"trace_id": TraceId;
|
|
427
|
-
"spans": Span[];
|
|
428
448
|
"root_span"?: Span;
|
|
429
449
|
"span_count": number;
|
|
430
450
|
"duration_ns": number;
|
|
@@ -433,6 +453,9 @@ export interface Trace {
|
|
|
433
453
|
"services": string[];
|
|
434
454
|
"has_error": boolean;
|
|
435
455
|
}
|
|
456
|
+
export interface Trace extends TraceSummary {
|
|
457
|
+
"spans": Span[];
|
|
458
|
+
}
|
|
436
459
|
export interface SpanQueryFilters {
|
|
437
460
|
"trace_id"?: TraceId;
|
|
438
461
|
"parent_span_id"?: SpanId;
|
|
@@ -651,14 +674,21 @@ export interface HealthReport {
|
|
|
651
674
|
"totalDurationMs": number;
|
|
652
675
|
"entries": Record<string, HealthCheckEntry>;
|
|
653
676
|
}
|
|
677
|
+
export interface RunnerMcpServerInfo {
|
|
678
|
+
"name": string;
|
|
679
|
+
"version": string;
|
|
680
|
+
}
|
|
654
681
|
export interface RunnerResourceState {
|
|
655
682
|
"name": string;
|
|
656
683
|
"lifecycle": RunnerResourceLifecycle;
|
|
657
684
|
"timestamp": string;
|
|
658
|
-
"kind"?:
|
|
685
|
+
"kind"?: RunnerResourceKind;
|
|
659
686
|
"allocatedPort"?: number;
|
|
660
687
|
"endpoint"?: string;
|
|
661
688
|
"lastError"?: string;
|
|
689
|
+
"serverInfo"?: RunnerMcpServerInfo;
|
|
690
|
+
"toolCount"?: number;
|
|
691
|
+
"restarts"?: number;
|
|
662
692
|
}
|
|
663
693
|
export interface RunnerLogLine {
|
|
664
694
|
"resource": string;
|
|
@@ -669,12 +699,15 @@ export interface RunnerMcpTool {
|
|
|
669
699
|
"name": string;
|
|
670
700
|
"title"?: string;
|
|
671
701
|
"description"?: string;
|
|
672
|
-
"inputSchema"
|
|
702
|
+
"inputSchema": Record<string, unknown>;
|
|
673
703
|
"outputSchema"?: Record<string, unknown>;
|
|
704
|
+
"annotations"?: Record<string, unknown>;
|
|
705
|
+
"_meta"?: Record<string, unknown>;
|
|
674
706
|
}
|
|
675
707
|
export interface RunnerMcpToolsResponse {
|
|
676
708
|
"tools": RunnerMcpTool[];
|
|
677
709
|
"nextCursor"?: string;
|
|
710
|
+
"_meta"?: Record<string, unknown>;
|
|
678
711
|
}
|
|
679
712
|
export interface RunnerMcpToolCallRequest {
|
|
680
713
|
"name": string;
|
|
@@ -698,6 +731,125 @@ export interface RunnerMcpToolCallResponse {
|
|
|
698
731
|
"content": RunnerMcpContent[];
|
|
699
732
|
"structuredContent"?: Record<string, unknown>;
|
|
700
733
|
"isError": boolean;
|
|
734
|
+
"_meta"?: Record<string, unknown>;
|
|
735
|
+
}
|
|
736
|
+
export interface RunnerMcpResourceReadRequest {
|
|
737
|
+
"uri": string;
|
|
738
|
+
}
|
|
739
|
+
export interface RunnerMcpResourceContent {
|
|
740
|
+
"uri": string;
|
|
741
|
+
"mimeType"?: string;
|
|
742
|
+
"text"?: string;
|
|
743
|
+
"blob"?: string;
|
|
744
|
+
"_meta"?: Record<string, unknown>;
|
|
745
|
+
}
|
|
746
|
+
export interface RunnerMcpResourceReadResponse {
|
|
747
|
+
"contents": RunnerMcpResourceContent[];
|
|
748
|
+
"_meta"?: Record<string, unknown>;
|
|
749
|
+
}
|
|
750
|
+
export interface DisplayTracesInput {
|
|
751
|
+
"trace_id"?: TraceId;
|
|
752
|
+
"session_id"?: SessionId;
|
|
753
|
+
"limit"?: number;
|
|
754
|
+
}
|
|
755
|
+
export interface DisplayTracesOutput {
|
|
756
|
+
"traces": Trace[];
|
|
757
|
+
"selected_trace_id"?: TraceId;
|
|
758
|
+
"mode": McpDataMode;
|
|
759
|
+
}
|
|
760
|
+
export interface DisplayMcpDashboardInput {
|
|
761
|
+
"hours"?: number;
|
|
762
|
+
}
|
|
763
|
+
export interface DisplayMcpDashboardOutput {
|
|
764
|
+
"stats": McpDashboardStats;
|
|
765
|
+
}
|
|
766
|
+
export interface McpDashboardStats {
|
|
767
|
+
"window": McpDashboardWindow;
|
|
768
|
+
"buckets": McpDashboardBucket[];
|
|
769
|
+
"totals": McpDashboardTotals;
|
|
770
|
+
"by_server": McpNameRequestCount[];
|
|
771
|
+
"by_transport": McpNameRequestCount[];
|
|
772
|
+
"by_method": McpNameRequestCount[];
|
|
773
|
+
"tools": McpToolStats[];
|
|
774
|
+
"span_count_analyzed": number;
|
|
775
|
+
"truncated": boolean;
|
|
776
|
+
"mode": McpDataMode;
|
|
777
|
+
}
|
|
778
|
+
export interface McpDashboardWindow {
|
|
779
|
+
"start": string;
|
|
780
|
+
"end": string;
|
|
781
|
+
"bucket_ms": number;
|
|
782
|
+
}
|
|
783
|
+
export interface McpDashboardBucket {
|
|
784
|
+
"start": string;
|
|
785
|
+
"requests": number;
|
|
786
|
+
"errors": number;
|
|
787
|
+
}
|
|
788
|
+
export interface McpDashboardTotals {
|
|
789
|
+
"requests": number;
|
|
790
|
+
"errors": number;
|
|
791
|
+
"error_rate": number;
|
|
792
|
+
}
|
|
793
|
+
export interface McpNameRequestCount {
|
|
794
|
+
"name": string;
|
|
795
|
+
"requests": number;
|
|
796
|
+
}
|
|
797
|
+
export interface McpToolStats {
|
|
798
|
+
"name": string;
|
|
799
|
+
"requests": number;
|
|
800
|
+
"errors": number;
|
|
801
|
+
"error_rate": number;
|
|
802
|
+
"avg_ms": number;
|
|
803
|
+
"p95_ms": number;
|
|
804
|
+
}
|
|
805
|
+
export interface ListTracesInput {
|
|
806
|
+
"limit"?: number;
|
|
807
|
+
}
|
|
808
|
+
export interface ListTracesOutput {
|
|
809
|
+
"traces": TraceSummary[];
|
|
810
|
+
"mode": McpDataMode;
|
|
811
|
+
}
|
|
812
|
+
export interface GetTraceInput {
|
|
813
|
+
"trace_id": TraceId;
|
|
814
|
+
}
|
|
815
|
+
export interface GetTraceOutput {
|
|
816
|
+
"trace": Trace;
|
|
817
|
+
"mode": McpDataMode;
|
|
818
|
+
}
|
|
819
|
+
export interface ListSessionsInput {
|
|
820
|
+
"limit"?: number;
|
|
821
|
+
"active_only"?: boolean;
|
|
822
|
+
}
|
|
823
|
+
export interface ListSessionsOutput {
|
|
824
|
+
"sessions": SessionEntity[];
|
|
825
|
+
"mode": McpDataMode;
|
|
826
|
+
}
|
|
827
|
+
export interface SearchLogsInput {
|
|
828
|
+
"trace_id"?: TraceId;
|
|
829
|
+
"service_name"?: string;
|
|
830
|
+
"severity_min"?: number;
|
|
831
|
+
"query"?: string;
|
|
832
|
+
"limit"?: number;
|
|
833
|
+
}
|
|
834
|
+
export interface SearchLogsOutput {
|
|
835
|
+
"logs": LogRecord[];
|
|
836
|
+
"mode": McpDataMode;
|
|
837
|
+
}
|
|
838
|
+
export interface FetchTelemetryInput {
|
|
839
|
+
"view": FetchTelemetryView;
|
|
840
|
+
"trace_id"?: TraceId;
|
|
841
|
+
"service_name"?: string;
|
|
842
|
+
"severity_min"?: number;
|
|
843
|
+
"query"?: string;
|
|
844
|
+
"limit"?: number;
|
|
845
|
+
"hours"?: number;
|
|
846
|
+
}
|
|
847
|
+
export interface FetchTelemetryOutput {
|
|
848
|
+
"traces"?: Trace[];
|
|
849
|
+
"trace"?: Trace;
|
|
850
|
+
"logs"?: LogRecord[];
|
|
851
|
+
"stats"?: McpDashboardStats;
|
|
852
|
+
"mode": McpDataMode;
|
|
701
853
|
}
|
|
702
854
|
export interface LogStreamEvent {
|
|
703
855
|
"type": "log";
|
|
@@ -213,7 +213,25 @@ export const RunnerResourceLifecycleValues = {
|
|
|
213
213
|
"stopped": "stopped",
|
|
214
214
|
"failed": "failed",
|
|
215
215
|
};
|
|
216
|
+
export const RunnerResourceKindValues = {
|
|
217
|
+
"collector": "collector",
|
|
218
|
+
"project": "project",
|
|
219
|
+
"command": "command",
|
|
220
|
+
"stdio": "stdio",
|
|
221
|
+
"http": "http",
|
|
222
|
+
"inproc": "inproc",
|
|
223
|
+
};
|
|
216
224
|
export const RunnerLogStreamValues = {
|
|
217
225
|
"stdout": "out",
|
|
218
226
|
"stderr": "err",
|
|
219
227
|
};
|
|
228
|
+
export const McpDataModeValues = {
|
|
229
|
+
"live": "live",
|
|
230
|
+
"demo": "demo",
|
|
231
|
+
};
|
|
232
|
+
export const FetchTelemetryViewValues = {
|
|
233
|
+
"traces": "traces",
|
|
234
|
+
"trace": "trace",
|
|
235
|
+
"logs": "logs",
|
|
236
|
+
"mcpStats": "mcp_stats",
|
|
237
|
+
};
|
package/index.tsp
CHANGED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import "../common/types.tsp";
|
|
2
|
+
import "../otel/logs.tsp";
|
|
3
|
+
import "../otel/span.tsp";
|
|
4
|
+
import "./session.tsp";
|
|
5
|
+
|
|
6
|
+
using Qyl.Api.Contracts.Common;
|
|
7
|
+
using Qyl.Api.Contracts.Domains.Observe.Session;
|
|
8
|
+
using Qyl.Api.Contracts.OTel.Logs;
|
|
9
|
+
using Qyl.Api.Contracts.OTel.Traces;
|
|
10
|
+
|
|
11
|
+
namespace Qyl.Api.Contracts.Mcp.Tools;
|
|
12
|
+
|
|
13
|
+
@doc("Whether a qyl MCP tool read live collector data or the explicit demo dataset.")
|
|
14
|
+
enum McpDataMode {
|
|
15
|
+
live: "live",
|
|
16
|
+
demo: "demo",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@doc("Data projection requested by the app-only fetch_telemetry tool.")
|
|
20
|
+
enum FetchTelemetryView {
|
|
21
|
+
traces: "traces",
|
|
22
|
+
trace: "trace",
|
|
23
|
+
logs: "logs",
|
|
24
|
+
mcpStats: "mcp_stats",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@doc("Input for display_traces.")
|
|
28
|
+
model DisplayTracesInput {
|
|
29
|
+
@encodedName("application/json", "trace_id")
|
|
30
|
+
traceId?: TraceId;
|
|
31
|
+
@encodedName("application/json", "session_id")
|
|
32
|
+
sessionId?: SessionId;
|
|
33
|
+
@minValue(1)
|
|
34
|
+
@maxValue(100)
|
|
35
|
+
limit?: int32 = 20;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@doc("Structured output for display_traces.")
|
|
39
|
+
model DisplayTracesOutput {
|
|
40
|
+
traces: Trace[];
|
|
41
|
+
@encodedName("application/json", "selected_trace_id")
|
|
42
|
+
selectedTraceId?: TraceId;
|
|
43
|
+
mode: McpDataMode;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@doc("Input for display_mcp_dashboard.")
|
|
47
|
+
model DisplayMcpDashboardInput {
|
|
48
|
+
@minValue(1)
|
|
49
|
+
@maxValue(168)
|
|
50
|
+
hours?: float64 = 24;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@doc("Structured output for display_mcp_dashboard.")
|
|
54
|
+
model DisplayMcpDashboardOutput {
|
|
55
|
+
stats: McpDashboardStats;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@doc("Input for list_traces.")
|
|
59
|
+
model ListTracesInput {
|
|
60
|
+
@minValue(1)
|
|
61
|
+
@maxValue(100)
|
|
62
|
+
limit?: int32 = 20;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@doc("Structured output for list_traces.")
|
|
66
|
+
model ListTracesOutput {
|
|
67
|
+
traces: TraceSummary[];
|
|
68
|
+
mode: McpDataMode;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@doc("Input for get_trace.")
|
|
72
|
+
model GetTraceInput {
|
|
73
|
+
@encodedName("application/json", "trace_id")
|
|
74
|
+
traceId: TraceId;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@doc("Structured output for get_trace.")
|
|
78
|
+
model GetTraceOutput {
|
|
79
|
+
trace: Trace;
|
|
80
|
+
mode: McpDataMode;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@doc("Input for list_sessions.")
|
|
84
|
+
model ListSessionsInput {
|
|
85
|
+
@minValue(1)
|
|
86
|
+
@maxValue(100)
|
|
87
|
+
limit?: int32 = 20;
|
|
88
|
+
@encodedName("application/json", "active_only")
|
|
89
|
+
activeOnly?: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@doc("Structured output for list_sessions.")
|
|
93
|
+
model ListSessionsOutput {
|
|
94
|
+
sessions: SessionEntity[];
|
|
95
|
+
mode: McpDataMode;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@doc("Input for search_logs.")
|
|
99
|
+
model SearchLogsInput {
|
|
100
|
+
@encodedName("application/json", "trace_id")
|
|
101
|
+
traceId?: TraceId;
|
|
102
|
+
@encodedName("application/json", "service_name")
|
|
103
|
+
serviceName?: string;
|
|
104
|
+
@encodedName("application/json", "severity_min")
|
|
105
|
+
@minValue(1)
|
|
106
|
+
@maxValue(24)
|
|
107
|
+
severityMin?: int32;
|
|
108
|
+
query?: string;
|
|
109
|
+
@minValue(1)
|
|
110
|
+
@maxValue(200)
|
|
111
|
+
limit?: int32 = 50;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@doc("Structured output for search_logs.")
|
|
115
|
+
model SearchLogsOutput {
|
|
116
|
+
logs: LogRecord[];
|
|
117
|
+
mode: McpDataMode;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@doc("Input for the app-only fetch_telemetry tool.")
|
|
121
|
+
model FetchTelemetryInput {
|
|
122
|
+
view: FetchTelemetryView;
|
|
123
|
+
@encodedName("application/json", "trace_id")
|
|
124
|
+
traceId?: TraceId;
|
|
125
|
+
@encodedName("application/json", "service_name")
|
|
126
|
+
serviceName?: string;
|
|
127
|
+
@encodedName("application/json", "severity_min")
|
|
128
|
+
@minValue(1)
|
|
129
|
+
@maxValue(24)
|
|
130
|
+
severityMin?: int32;
|
|
131
|
+
query?: string;
|
|
132
|
+
@minValue(1)
|
|
133
|
+
@maxValue(200)
|
|
134
|
+
limit?: int32;
|
|
135
|
+
@minValue(1)
|
|
136
|
+
@maxValue(168)
|
|
137
|
+
hours?: float64;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@doc("Structured output for the app-only fetch_telemetry tool.")
|
|
141
|
+
model FetchTelemetryOutput {
|
|
142
|
+
traces?: Trace[];
|
|
143
|
+
trace?: Trace;
|
|
144
|
+
logs?: LogRecord[];
|
|
145
|
+
stats?: McpDashboardStats;
|
|
146
|
+
mode: McpDataMode;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@doc("Aggregate MCP traffic statistics shown by qyl.mcp.")
|
|
150
|
+
model McpDashboardStats {
|
|
151
|
+
window: McpDashboardWindow;
|
|
152
|
+
buckets: McpDashboardBucket[];
|
|
153
|
+
totals: McpDashboardTotals;
|
|
154
|
+
@encodedName("application/json", "by_server")
|
|
155
|
+
byServer: McpNameRequestCount[];
|
|
156
|
+
@encodedName("application/json", "by_transport")
|
|
157
|
+
byTransport: McpNameRequestCount[];
|
|
158
|
+
@encodedName("application/json", "by_method")
|
|
159
|
+
byMethod: McpNameRequestCount[];
|
|
160
|
+
tools: McpToolStats[];
|
|
161
|
+
@encodedName("application/json", "span_count_analyzed")
|
|
162
|
+
@minValue(0)
|
|
163
|
+
spanCountAnalyzed: int32;
|
|
164
|
+
truncated: boolean;
|
|
165
|
+
mode: McpDataMode;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
model McpDashboardWindow {
|
|
169
|
+
start: utcDateTime;
|
|
170
|
+
end: utcDateTime;
|
|
171
|
+
@encodedName("application/json", "bucket_ms")
|
|
172
|
+
@minValue(0)
|
|
173
|
+
bucketMs: float64;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
model McpDashboardBucket {
|
|
177
|
+
start: utcDateTime;
|
|
178
|
+
@minValue(0)
|
|
179
|
+
requests: int32;
|
|
180
|
+
@minValue(0)
|
|
181
|
+
errors: int32;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
model McpDashboardTotals {
|
|
185
|
+
@minValue(0)
|
|
186
|
+
requests: int32;
|
|
187
|
+
@minValue(0)
|
|
188
|
+
errors: int32;
|
|
189
|
+
@encodedName("application/json", "error_rate")
|
|
190
|
+
@minValue(0)
|
|
191
|
+
@maxValue(1)
|
|
192
|
+
errorRate: float64;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
model McpNameRequestCount {
|
|
196
|
+
name: string;
|
|
197
|
+
@minValue(0)
|
|
198
|
+
requests: int32;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
model McpToolStats {
|
|
202
|
+
name: string;
|
|
203
|
+
@minValue(0)
|
|
204
|
+
requests: int32;
|
|
205
|
+
@minValue(0)
|
|
206
|
+
errors: int32;
|
|
207
|
+
@encodedName("application/json", "error_rate")
|
|
208
|
+
@minValue(0)
|
|
209
|
+
@maxValue(1)
|
|
210
|
+
errorRate: float64;
|
|
211
|
+
@encodedName("application/json", "avg_ms")
|
|
212
|
+
@minValue(0)
|
|
213
|
+
avgMs: float64;
|
|
214
|
+
@encodedName("application/json", "p95_ms")
|
|
215
|
+
@minValue(0)
|
|
216
|
+
p95Ms: float64;
|
|
217
|
+
}
|
package/models/runner-mcp.tsp
CHANGED
|
@@ -5,14 +5,19 @@ model RunnerMcpTool {
|
|
|
5
5
|
name: string;
|
|
6
6
|
title?: string;
|
|
7
7
|
description?: string;
|
|
8
|
-
inputSchema
|
|
8
|
+
inputSchema: Record<unknown>;
|
|
9
9
|
outputSchema?: Record<unknown>;
|
|
10
|
+
annotations?: Record<unknown>;
|
|
11
|
+
@encodedName("application/json", "_meta")
|
|
12
|
+
metadata?: Record<unknown>;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
@doc("MCP tools currently advertised by a runner resource.")
|
|
13
16
|
model RunnerMcpToolsResponse {
|
|
14
17
|
tools: RunnerMcpTool[];
|
|
15
18
|
nextCursor?: string;
|
|
19
|
+
@encodedName("application/json", "_meta")
|
|
20
|
+
metadata?: Record<unknown>;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
@doc("Tool call accepted by the runner's MCP projection.")
|
|
@@ -44,4 +49,28 @@ model RunnerMcpToolCallResponse {
|
|
|
44
49
|
content: RunnerMcpContent[];
|
|
45
50
|
structuredContent?: Record<unknown>;
|
|
46
51
|
isError: boolean;
|
|
52
|
+
@encodedName("application/json", "_meta")
|
|
53
|
+
metadata?: Record<unknown>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@doc("Resource URI accepted by the runner's MCP projection.")
|
|
57
|
+
model RunnerMcpResourceReadRequest {
|
|
58
|
+
uri: url;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@doc("Text or base64 resource content returned by an MCP server. Exactly one of text or blob is present.")
|
|
62
|
+
model RunnerMcpResourceContent {
|
|
63
|
+
uri: url;
|
|
64
|
+
mimeType?: string;
|
|
65
|
+
text?: string;
|
|
66
|
+
blob?: string;
|
|
67
|
+
@encodedName("application/json", "_meta")
|
|
68
|
+
metadata?: Record<unknown>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@doc("Stable qyl projection of an MCP resources/read result.")
|
|
72
|
+
model RunnerMcpResourceReadResponse {
|
|
73
|
+
contents: RunnerMcpResourceContent[];
|
|
74
|
+
@encodedName("application/json", "_meta")
|
|
75
|
+
metadata?: Record<unknown>;
|
|
47
76
|
}
|
package/models/runner.tsp
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "@typespec/http";
|
|
2
|
+
|
|
3
|
+
using TypeSpec.Http;
|
|
4
|
+
|
|
1
5
|
namespace Qyl.Api.Contracts.Runner;
|
|
2
6
|
|
|
3
7
|
@doc("Lifecycle state of a resource supervised by the local qyl runner.")
|
|
@@ -10,17 +14,43 @@ enum RunnerResourceLifecycle {
|
|
|
10
14
|
failed: "failed",
|
|
11
15
|
}
|
|
12
16
|
|
|
17
|
+
@doc("Kind of process or connection supervised by the local qyl runner.")
|
|
18
|
+
enum RunnerResourceKind {
|
|
19
|
+
collector: "collector",
|
|
20
|
+
project: "project",
|
|
21
|
+
command: "command",
|
|
22
|
+
stdio: "stdio",
|
|
23
|
+
http: "http",
|
|
24
|
+
inproc: "inproc",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@doc("Identity reported by a connected MCP server during initialization.")
|
|
28
|
+
model RunnerMcpServerInfo {
|
|
29
|
+
name: string;
|
|
30
|
+
version: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
13
33
|
@doc("Current client-visible state of one runner resource.")
|
|
14
34
|
model RunnerResourceState {
|
|
15
35
|
name: string;
|
|
16
36
|
lifecycle: RunnerResourceLifecycle;
|
|
17
37
|
timestamp: utcDateTime;
|
|
18
|
-
kind?:
|
|
38
|
+
kind?: RunnerResourceKind;
|
|
19
39
|
@minValue(1)
|
|
20
40
|
@maxValue(65535)
|
|
21
41
|
allocatedPort?: int32;
|
|
22
42
|
endpoint?: url;
|
|
23
43
|
lastError?: string;
|
|
44
|
+
serverInfo?: RunnerMcpServerInfo;
|
|
45
|
+
@minValue(0)
|
|
46
|
+
toolCount?: int32;
|
|
47
|
+
@minValue(0)
|
|
48
|
+
restarts?: int32;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@doc("A runner lifecycle action was accepted and continues asynchronously.")
|
|
52
|
+
model RunnerActionAccepted {
|
|
53
|
+
@statusCode statusCode: 202;
|
|
24
54
|
}
|
|
25
55
|
|
|
26
56
|
@doc("Origin stream for one captured child-process log line.")
|
package/otel/span.tsp
CHANGED
|
@@ -147,16 +147,13 @@ model SpanLink {
|
|
|
147
147
|
// Trace Model (Collection of Spans)
|
|
148
148
|
// =============================================================================
|
|
149
149
|
|
|
150
|
-
@doc("
|
|
151
|
-
model
|
|
150
|
+
@doc("Trace summary without the full span collection")
|
|
151
|
+
model TraceSummary {
|
|
152
152
|
@doc("Trace identifier")
|
|
153
153
|
@key
|
|
154
154
|
@encodedName("application/json", "trace_id")
|
|
155
155
|
traceId: TraceId;
|
|
156
156
|
|
|
157
|
-
@doc("All spans in this trace")
|
|
158
|
-
spans: Span[];
|
|
159
|
-
|
|
160
157
|
@doc("Root span of the trace")
|
|
161
158
|
@encodedName("application/json", "root_span")
|
|
162
159
|
rootSpan?: Span;
|
|
@@ -185,6 +182,12 @@ model Trace {
|
|
|
185
182
|
hasError: boolean;
|
|
186
183
|
}
|
|
187
184
|
|
|
185
|
+
@doc("Complete trace containing all related spans")
|
|
186
|
+
model Trace extends TraceSummary {
|
|
187
|
+
@doc("All spans in this trace")
|
|
188
|
+
spans: Span[];
|
|
189
|
+
}
|
|
190
|
+
|
|
188
191
|
// =============================================================================
|
|
189
192
|
// Span Query Filters
|
|
190
193
|
// =============================================================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancplua/qyl-api-schema",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "TypeSpec source of truth for qyl API contracts. Emits OpenAPI, JSON Schema, Qyl.Api.Contracts DTOs, and TypeScript contract types; not an OpenTelemetry package, storage schema, or server implementation.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
"types": "./generated/ts-runtime/api.d.ts",
|
|
38
38
|
"import": "./generated/ts-runtime/api.js",
|
|
39
39
|
"default": "./generated/ts-runtime/api.js"
|
|
40
|
+
},
|
|
41
|
+
"./openapi": {
|
|
42
|
+
"default": "./generated/openapi/qyl.openapi.json"
|
|
43
|
+
},
|
|
44
|
+
"./json-schema": {
|
|
45
|
+
"default": "./generated/json-schema/qyl-api-schema.json"
|
|
40
46
|
}
|
|
41
47
|
},
|
|
42
48
|
"files": [
|
|
@@ -50,6 +56,7 @@
|
|
|
50
56
|
"models/health.tsp",
|
|
51
57
|
"models/runner-mcp.tsp",
|
|
52
58
|
"models/runner.tsp",
|
|
59
|
+
"models/mcp-tools.tsp",
|
|
53
60
|
"models/session.tsp",
|
|
54
61
|
"otel/enums.tsp",
|
|
55
62
|
"otel/logs.tsp",
|
|
@@ -60,6 +67,8 @@
|
|
|
60
67
|
"generated/otel-keys.gen.tsp",
|
|
61
68
|
"generated/ts-runtime/api.d.ts",
|
|
62
69
|
"generated/ts-runtime/api.js",
|
|
70
|
+
"generated/openapi/qyl.openapi.json",
|
|
71
|
+
"generated/json-schema/qyl-api-schema.json",
|
|
63
72
|
"README.md",
|
|
64
73
|
"LICENSE"
|
|
65
74
|
],
|
|
@@ -72,9 +81,10 @@
|
|
|
72
81
|
"clean:generated": "node scripts/clean-generated.mjs",
|
|
73
82
|
"build:emitters": "tsc -p emitters/csharp && tsc -p emitters/ts-types",
|
|
74
83
|
"build:ts-runtime": "tsc -p tsconfig.contracts.json",
|
|
84
|
+
"build:json-schema": "node scripts/openapi-to-json-schema.mjs",
|
|
75
85
|
"prepare": "npm run build:emitters",
|
|
76
86
|
"prepack": "npm run compile",
|
|
77
|
-
"compile": "npm run clean:generated && npm run build:emitters && tsp compile main.tsp && npm run build:ts-runtime",
|
|
87
|
+
"compile": "npm run clean:generated && npm run build:emitters && tsp compile main.tsp && npm run build:json-schema && npm run build:ts-runtime",
|
|
78
88
|
"watch": "tsp compile main.tsp --watch",
|
|
79
89
|
"format": "tsp format **/*.tsp",
|
|
80
90
|
"lint": "npm run build:emitters && tsp compile main.tsp --no-emit --warn-as-error",
|
|
@@ -84,7 +94,6 @@
|
|
|
84
94
|
"@typespec/compiler": "^1.13.0 || >=1.13.0-dev.0",
|
|
85
95
|
"@typespec/events": "^0.83.0",
|
|
86
96
|
"@typespec/http": "^1.13.0",
|
|
87
|
-
"@typespec/json-schema": "^1.13.0",
|
|
88
97
|
"@typespec/openapi": "^1.13.0",
|
|
89
98
|
"@typespec/sse": "^0.83.0"
|
|
90
99
|
},
|
|
@@ -95,7 +104,6 @@
|
|
|
95
104
|
"@typespec/compiler": "1.13.0",
|
|
96
105
|
"@typespec/events": "0.83.0",
|
|
97
106
|
"@typespec/http": "1.13.0",
|
|
98
|
-
"@typespec/json-schema": "1.13.0",
|
|
99
107
|
"@typespec/openapi": "1.13.0",
|
|
100
108
|
"@typespec/openapi3": "1.13.0",
|
|
101
109
|
"@typespec/sse": "0.83.0",
|