@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
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ generated/otel-keys.gen.tsp
|
|
|
16
16
|
v
|
|
17
17
|
authored Qyl TypeSpec
|
|
18
18
|
|
|
|
19
|
-
+----> OpenAPI
|
|
19
|
+
+----> OpenAPI ----> bundled JSON Schema
|
|
20
20
|
+----> Qyl.Api.Contracts
|
|
21
21
|
+----> generated TypeScript contracts
|
|
22
22
|
```
|
|
@@ -67,8 +67,10 @@ Important generated outputs include:
|
|
|
67
67
|
- `generated/contracts/**/*.cs`
|
|
68
68
|
- `generated/ts-types/**`
|
|
69
69
|
|
|
70
|
-
Generated files are not editing surfaces.
|
|
71
|
-
|
|
70
|
+
Generated files are not editing surfaces. OpenAPI comes from the official TypeSpec
|
|
71
|
+
emitter; the bundled JSON Schema is a deterministic projection of its component
|
|
72
|
+
schemas so both artifacts preserve the same wire names. Change TypeSpec or the
|
|
73
|
+
owning generator and regenerate.
|
|
72
74
|
|
|
73
75
|
## Publish
|
|
74
76
|
|
package/api/runner.tsp
CHANGED
|
@@ -45,12 +45,25 @@ namespace Qyl.Api.Contracts.Runner {
|
|
|
45
45
|
streamLogs(
|
|
46
46
|
@path resource: string,
|
|
47
47
|
): SSEStream<RunnerLogEvents> | NotFoundError | InternalServerError;
|
|
48
|
+
|
|
49
|
+
@post
|
|
50
|
+
@route("/{resource}/restart")
|
|
51
|
+
restart(
|
|
52
|
+
@path resource: string,
|
|
53
|
+
): RunnerActionAccepted | NotFoundError | ConflictError | InternalServerError;
|
|
54
|
+
|
|
55
|
+
@post
|
|
56
|
+
@route("/{resource}/stop")
|
|
57
|
+
stop(
|
|
58
|
+
@path resource: string,
|
|
59
|
+
): RunnerActionAccepted | NotFoundError | ConflictError | InternalServerError;
|
|
48
60
|
}
|
|
49
61
|
|
|
50
|
-
@route("/runner/mcp/{resource}
|
|
62
|
+
@route("/runner/mcp/{resource}")
|
|
51
63
|
@tag("Runner MCP")
|
|
52
64
|
interface RunnerMcpApi {
|
|
53
65
|
@get
|
|
66
|
+
@route("/tools")
|
|
54
67
|
listTools(
|
|
55
68
|
@path resource: string,
|
|
56
69
|
): RunnerMcpToolsResponse
|
|
@@ -60,7 +73,7 @@ namespace Qyl.Api.Contracts.Runner {
|
|
|
60
73
|
| InternalServerError;
|
|
61
74
|
|
|
62
75
|
@post
|
|
63
|
-
@route("/call")
|
|
76
|
+
@route("/tools/call")
|
|
64
77
|
callTool(
|
|
65
78
|
@path resource: string,
|
|
66
79
|
@body request: RunnerMcpToolCallRequest,
|
|
@@ -70,5 +83,17 @@ namespace Qyl.Api.Contracts.Runner {
|
|
|
70
83
|
| ConflictError
|
|
71
84
|
| BadGatewayError
|
|
72
85
|
| InternalServerError;
|
|
86
|
+
|
|
87
|
+
@post
|
|
88
|
+
@route("/resources/read")
|
|
89
|
+
readResource(
|
|
90
|
+
@path resource: string,
|
|
91
|
+
@body request: RunnerMcpResourceReadRequest,
|
|
92
|
+
): RunnerMcpResourceReadResponse
|
|
93
|
+
| ValidationError
|
|
94
|
+
| NotFoundError
|
|
95
|
+
| ConflictError
|
|
96
|
+
| BadGatewayError
|
|
97
|
+
| InternalServerError;
|
|
73
98
|
}
|
|
74
99
|
}
|
package/common/types.tsp
CHANGED
|
@@ -6,10 +6,8 @@
|
|
|
6
6
|
// (GenAI keys come from the dedicated GenAI registry since the 1.42 split).
|
|
7
7
|
// =============================================================================
|
|
8
8
|
|
|
9
|
-
import "@typespec/json-schema";
|
|
10
9
|
import "@typespec/openapi";
|
|
11
10
|
|
|
12
|
-
using TypeSpec.JsonSchema;
|
|
13
11
|
using TypeSpec.OpenAPI;
|
|
14
12
|
|
|
15
13
|
namespace Qyl.Api.Contracts.Common;
|
|
@@ -20,7 +18,6 @@ namespace Qyl.Api.Contracts.Common;
|
|
|
20
18
|
// The semantic-conventions pin lives in the generated keys header and is
|
|
21
19
|
// machine-checked; a hand-maintained enum of upstream releases would only drift.
|
|
22
20
|
|
|
23
|
-
@jsonSchema
|
|
24
21
|
@doc("Unique trace identifier (32 lowercase hex characters)")
|
|
25
22
|
@pattern("^[a-f0-9]{32}$")
|
|
26
23
|
@minLength(32)
|
|
@@ -30,7 +27,6 @@ namespace Qyl.Api.Contracts.Common;
|
|
|
30
27
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "TraceId")
|
|
31
28
|
scalar TraceId extends string;
|
|
32
29
|
|
|
33
|
-
@jsonSchema
|
|
34
30
|
@doc("Unique span identifier (16 lowercase hex characters)")
|
|
35
31
|
@pattern("^[a-f0-9]{16}$")
|
|
36
32
|
@minLength(16)
|
|
@@ -40,18 +36,15 @@ scalar TraceId extends string;
|
|
|
40
36
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "SpanId")
|
|
41
37
|
scalar SpanId extends string;
|
|
42
38
|
|
|
43
|
-
@jsonSchema
|
|
44
39
|
@doc("W3C Trace Context traceparent header format")
|
|
45
40
|
@pattern("^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$")
|
|
46
41
|
@example("00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01")
|
|
47
42
|
scalar TraceParent extends string;
|
|
48
43
|
|
|
49
|
-
@jsonSchema
|
|
50
44
|
@doc("W3C Trace Context tracestate header (vendor-specific key-value pairs)")
|
|
51
45
|
@example("rojo=00f067aa0ba902b7,congo=t61rcWkgMzE")
|
|
52
46
|
scalar TraceState extends string;
|
|
53
47
|
|
|
54
|
-
@jsonSchema
|
|
55
48
|
@doc("Unique session identifier")
|
|
56
49
|
@minLength(1)
|
|
57
50
|
@maxLength(128)
|
|
@@ -59,7 +52,6 @@ scalar TraceState extends string;
|
|
|
59
52
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "SessionId")
|
|
60
53
|
scalar SessionId extends string;
|
|
61
54
|
|
|
62
|
-
@jsonSchema
|
|
63
55
|
@doc("User identifier (pseudonymized for privacy)")
|
|
64
56
|
@minLength(1)
|
|
65
57
|
@maxLength(256)
|
|
@@ -69,35 +61,29 @@ scalar UserId extends string;
|
|
|
69
61
|
// Temporal Scalars - Timestamps & Durations
|
|
70
62
|
// =============================================================================
|
|
71
63
|
|
|
72
|
-
@jsonSchema
|
|
73
64
|
@doc("ISO 8601 timestamp with nanosecond precision (RFC 3339)")
|
|
74
65
|
@encode(DateTimeKnownEncoding.rfc3339)
|
|
75
66
|
scalar Timestamp extends utcDateTime;
|
|
76
67
|
|
|
77
|
-
@jsonSchema
|
|
78
68
|
@doc("Unsigned Unix timestamp in nanoseconds since epoch")
|
|
79
69
|
@minValue(0)
|
|
80
70
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "ulong")
|
|
81
71
|
scalar UnixNanos extends uint64;
|
|
82
72
|
|
|
83
|
-
@jsonSchema
|
|
84
73
|
@doc("Duration in nanoseconds")
|
|
85
74
|
@minValue(0)
|
|
86
75
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "ulong")
|
|
87
76
|
scalar DurationNs extends uint64;
|
|
88
77
|
|
|
89
|
-
@jsonSchema
|
|
90
78
|
@doc("Duration in milliseconds")
|
|
91
79
|
@minValue(0)
|
|
92
80
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "double")
|
|
93
81
|
scalar DurationMs extends float64;
|
|
94
82
|
|
|
95
|
-
@jsonSchema
|
|
96
83
|
@doc("Duration in seconds")
|
|
97
84
|
@minValue(0)
|
|
98
85
|
scalar DurationS extends float64;
|
|
99
86
|
|
|
100
|
-
@jsonSchema
|
|
101
87
|
@doc("ISO 8601 duration format (e.g., PT1H30M)")
|
|
102
88
|
@encode(DurationKnownEncoding.ISO8601)
|
|
103
89
|
scalar IsoDuration extends duration;
|
|
@@ -106,29 +92,24 @@ scalar IsoDuration extends duration;
|
|
|
106
92
|
// Network Scalars - IP Addresses & Ports
|
|
107
93
|
// =============================================================================
|
|
108
94
|
|
|
109
|
-
@jsonSchema
|
|
110
95
|
@doc("IPv4 address in dotted-decimal notation")
|
|
111
96
|
@pattern("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")
|
|
112
97
|
@example("192.168.1.1")
|
|
113
98
|
scalar IPv4Address extends string;
|
|
114
99
|
|
|
115
|
-
@jsonSchema
|
|
116
100
|
@doc("IPv6 address in standard notation")
|
|
117
101
|
@example("2001:0db8:85a3:0000:0000:8a2e:0370:7334")
|
|
118
102
|
scalar IPv6Address extends string;
|
|
119
103
|
|
|
120
|
-
@jsonSchema
|
|
121
104
|
@doc("IP address (IPv4 or IPv6)")
|
|
122
105
|
scalar IpAddress extends string;
|
|
123
106
|
|
|
124
|
-
@jsonSchema
|
|
125
107
|
@doc("Network port number (1-65535)")
|
|
126
108
|
@minValue(1)
|
|
127
109
|
@maxValue(65535)
|
|
128
110
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "int")
|
|
129
111
|
scalar Port extends int32;
|
|
130
112
|
|
|
131
|
-
@jsonSchema
|
|
132
113
|
@doc("MAC address in colon-separated hex notation")
|
|
133
114
|
@pattern("^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$")
|
|
134
115
|
@example("00:1A:2B:3C:4D:5E")
|
|
@@ -138,32 +119,27 @@ scalar MacAddress extends string;
|
|
|
138
119
|
// Size & Count Scalars
|
|
139
120
|
// =============================================================================
|
|
140
121
|
|
|
141
|
-
@jsonSchema
|
|
142
122
|
@doc("Size in bytes")
|
|
143
123
|
@minValue(0)
|
|
144
124
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "long")
|
|
145
125
|
scalar ByteSize extends int64;
|
|
146
126
|
|
|
147
|
-
@jsonSchema
|
|
148
127
|
@doc("Token count (for LLM operations)")
|
|
149
128
|
@minValue(0)
|
|
150
129
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "long")
|
|
151
130
|
scalar TokenCount extends int64;
|
|
152
131
|
|
|
153
|
-
@jsonSchema
|
|
154
132
|
@doc("Generic non-negative counter")
|
|
155
133
|
@minValue(0)
|
|
156
134
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "long")
|
|
157
135
|
scalar Count extends int64;
|
|
158
136
|
|
|
159
|
-
@jsonSchema
|
|
160
137
|
@doc("Percentage value (0.0 to 100.0)")
|
|
161
138
|
@minValue(0.0)
|
|
162
139
|
@maxValue(100.0)
|
|
163
140
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "double")
|
|
164
141
|
scalar Percentage extends float64;
|
|
165
142
|
|
|
166
|
-
@jsonSchema
|
|
167
143
|
@doc("Ratio value (0.0 to 1.0)")
|
|
168
144
|
@minValue(0.0)
|
|
169
145
|
@maxValue(1.0)
|
|
@@ -174,13 +150,11 @@ scalar Ratio extends float64;
|
|
|
174
150
|
// GenAI-Specific Scalars
|
|
175
151
|
// =============================================================================
|
|
176
152
|
|
|
177
|
-
@jsonSchema
|
|
178
153
|
@doc("Cost in USD (floating point)")
|
|
179
154
|
@minValue(0)
|
|
180
155
|
@TypeSpec.OpenAPI.extension("x-csharp-type", "double")
|
|
181
156
|
scalar CostUsd extends float64;
|
|
182
157
|
|
|
183
|
-
@jsonSchema
|
|
184
158
|
@doc("Temperature setting for LLM requests (0.0-2.0)")
|
|
185
159
|
@minValue(0)
|
|
186
160
|
@maxValue(2)
|
|
@@ -191,50 +165,41 @@ scalar Temperature extends float64;
|
|
|
191
165
|
// Semantic Scalars - Special Purpose Types
|
|
192
166
|
// =============================================================================
|
|
193
167
|
|
|
194
|
-
@jsonSchema
|
|
195
168
|
@doc("SHA-256 hash in lowercase hex")
|
|
196
169
|
@pattern("^[a-f0-9]{64}$")
|
|
197
170
|
@minLength(64)
|
|
198
171
|
@maxLength(64)
|
|
199
172
|
scalar Sha256Hash extends string;
|
|
200
173
|
|
|
201
|
-
@jsonSchema
|
|
202
174
|
@doc("Semantic version string (e.g., 1.2.3)")
|
|
203
175
|
@pattern("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$")
|
|
204
176
|
@example("2.1.0")
|
|
205
177
|
scalar SemVer extends string;
|
|
206
178
|
|
|
207
|
-
@jsonSchema
|
|
208
179
|
@doc("URL string (absolute)")
|
|
209
180
|
@format("uri")
|
|
210
181
|
scalar UrlString extends string;
|
|
211
182
|
|
|
212
|
-
@jsonSchema
|
|
213
183
|
@doc("URL path component")
|
|
214
184
|
@example("/api/v1/users")
|
|
215
185
|
scalar UrlPath extends string;
|
|
216
186
|
|
|
217
|
-
@jsonSchema
|
|
218
187
|
@doc("URL query string (without leading ?)")
|
|
219
188
|
@example("page=1&limit=100")
|
|
220
189
|
scalar UrlQuery extends string;
|
|
221
190
|
|
|
222
|
-
@jsonSchema
|
|
223
191
|
@doc("HTTP method name (uppercase)")
|
|
224
192
|
@example("GET")
|
|
225
193
|
scalar HttpMethod extends string;
|
|
226
194
|
|
|
227
|
-
@jsonSchema
|
|
228
195
|
@doc("MIME content type")
|
|
229
196
|
@example("application/json")
|
|
230
197
|
scalar ContentType extends string;
|
|
231
198
|
|
|
232
|
-
@jsonSchema
|
|
233
199
|
@doc("User agent string")
|
|
234
200
|
@example("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36")
|
|
235
201
|
scalar UserAgent extends string;
|
|
236
202
|
|
|
237
|
-
@jsonSchema
|
|
238
203
|
@doc("Language/locale code (BCP 47)")
|
|
239
204
|
@pattern("^[a-z]{2,3}(-[A-Z]{2})?$")
|
|
240
205
|
@example("en-US")
|