@ancplua/qyl-api-schema 0.3.0 → 0.5.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 +50 -64
- package/api/routes.tsp +90 -943
- package/api/runner.tsp +74 -0
- package/api/streaming.tsp +13 -299
- package/common/errors.tsp +14 -1
- package/common/pagination.tsp +1 -1
- package/common/types.tsp +2 -39
- package/generated/ts-runtime/api.d.ts +734 -0
- package/generated/ts-runtime/api.js +219 -0
- package/index.tsp +7 -34
- package/models/health.tsp +22 -0
- package/models/runner-mcp.tsp +47 -0
- package/models/runner.tsp +37 -0
- package/models/session.tsp +1 -1
- package/otel/enums.tsp +1 -1
- package/otel/logs.tsp +1 -1
- package/otel/otel-conventions.tsp +0 -1
- package/otel/profiles.tsp +1 -1
- package/otel/resource.tsp +1 -1
- package/otel/span.tsp +1 -1
- package/package.json +46 -34
- package/VERSIONING.md +0 -84
- package/generated/README.md +0 -35
- package/intelligence/causal-rules.tsp +0 -34
- package/intelligence/diagnostic-patterns.tsp +0 -54
- package/intelligence/investigation-strategies.tsp +0 -37
- package/intelligence/main.tsp +0 -17
- package/intelligence/seed/patterns.tsp +0 -171
- package/intelligence/seed/rules.tsp +0 -43
- package/intelligence/seed/strategies.tsp +0 -55
- package/intelligence/signals.tsp +0 -60
- package/models/agent/agent-run.tsp +0 -154
- package/models/agent/tool-call.tsp +0 -122
- package/models/agent/workflow-checkpoint.tsp +0 -50
- package/models/agent/workflow-execution.tsp +0 -136
- package/models/alerting.tsp +0 -436
- package/models/configurator.tsp +0 -433
- package/models/control-graph.tsp +0 -197
- package/models/db.tsp +0 -810
- package/models/deployment.tsp +0 -365
- package/models/error.tsp +0 -433
- package/models/genai.tsp +0 -1322
- package/models/http.tsp +0 -600
- package/models/identity.tsp +0 -213
- package/models/issues.tsp +0 -484
- package/models/log.tsp +0 -140
- package/models/messaging.tsp +0 -304
- package/models/otel-config.tsp +0 -455
- package/models/retention.tsp +0 -240
- package/models/rpc.tsp +0 -309
- package/models/search.tsp +0 -243
- package/models/system.tsp +0 -400
- package/models/test.tsp +0 -346
- package/models/triage.tsp +0 -113
- package/models/workflow.tsp +0 -396
- package/models/workspace.tsp +0 -435
- package/otel/metrics.tsp +0 -358
- package/tspconfig.yaml +0 -49
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// <auto-generated/>
|
|
2
|
+
// Copyright (c) 2025-2026 ancplua
|
|
3
|
+
export const SortOrderValues = {
|
|
4
|
+
"asc": "asc",
|
|
5
|
+
"desc": "desc",
|
|
6
|
+
};
|
|
7
|
+
export const TimeBucketValues = {
|
|
8
|
+
"minute": "1m",
|
|
9
|
+
"fiveMinutes": "5m",
|
|
10
|
+
"fifteenMinutes": "15m",
|
|
11
|
+
"hour": "1h",
|
|
12
|
+
"day": "1d",
|
|
13
|
+
"week": "1w",
|
|
14
|
+
"auto": "auto",
|
|
15
|
+
};
|
|
16
|
+
export const SpanKindValues = {
|
|
17
|
+
"unspecified": 0,
|
|
18
|
+
"internal": 1,
|
|
19
|
+
"server": 2,
|
|
20
|
+
"client": 3,
|
|
21
|
+
"producer": 4,
|
|
22
|
+
"consumer": 5,
|
|
23
|
+
};
|
|
24
|
+
export const SpanStatusCodeValues = {
|
|
25
|
+
"unset": 0,
|
|
26
|
+
"ok": 1,
|
|
27
|
+
"error": 2,
|
|
28
|
+
};
|
|
29
|
+
export const SpanFlagsValues = {
|
|
30
|
+
"none": 0,
|
|
31
|
+
"sampled": 1,
|
|
32
|
+
"random": 2,
|
|
33
|
+
};
|
|
34
|
+
export const SeverityNumberValues = {
|
|
35
|
+
"unspecified": 0,
|
|
36
|
+
"trace": 1,
|
|
37
|
+
"trace2": 2,
|
|
38
|
+
"trace3": 3,
|
|
39
|
+
"trace4": 4,
|
|
40
|
+
"debug": 5,
|
|
41
|
+
"debug2": 6,
|
|
42
|
+
"debug3": 7,
|
|
43
|
+
"debug4": 8,
|
|
44
|
+
"info": 9,
|
|
45
|
+
"info2": 10,
|
|
46
|
+
"info3": 11,
|
|
47
|
+
"info4": 12,
|
|
48
|
+
"warn": 13,
|
|
49
|
+
"warn2": 14,
|
|
50
|
+
"warn3": 15,
|
|
51
|
+
"warn4": 16,
|
|
52
|
+
"error": 17,
|
|
53
|
+
"error2": 18,
|
|
54
|
+
"error3": 19,
|
|
55
|
+
"error4": 20,
|
|
56
|
+
"fatal": 21,
|
|
57
|
+
"fatal2": 22,
|
|
58
|
+
"fatal3": 23,
|
|
59
|
+
"fatal4": 24,
|
|
60
|
+
};
|
|
61
|
+
export const SeverityTextValues = {
|
|
62
|
+
"TRACE": "TRACE",
|
|
63
|
+
"DEBUG": "DEBUG",
|
|
64
|
+
"INFO": "INFO",
|
|
65
|
+
"WARN": "WARN",
|
|
66
|
+
"ERROR": "ERROR",
|
|
67
|
+
"FATAL": "FATAL",
|
|
68
|
+
};
|
|
69
|
+
export const MetricTypeValues = {
|
|
70
|
+
"gauge": "gauge",
|
|
71
|
+
"sum": "sum",
|
|
72
|
+
"histogram": "histogram",
|
|
73
|
+
"exponentialHistogram": "exponential_histogram",
|
|
74
|
+
"summary": "summary",
|
|
75
|
+
};
|
|
76
|
+
export const AggregationTemporalityValues = {
|
|
77
|
+
"unspecified": 0,
|
|
78
|
+
"delta": 1,
|
|
79
|
+
"cumulative": 2,
|
|
80
|
+
};
|
|
81
|
+
export const DataPointFlagsValues = {
|
|
82
|
+
"none": 0,
|
|
83
|
+
"noRecordedValue": 1,
|
|
84
|
+
};
|
|
85
|
+
export const InstrumentKindValues = {
|
|
86
|
+
"counter": "Counter",
|
|
87
|
+
"upDownCounter": "UpDownCounter",
|
|
88
|
+
"histogram": "Histogram",
|
|
89
|
+
"gauge": "Gauge",
|
|
90
|
+
"observableCounter": "ObservableCounter",
|
|
91
|
+
"observableGauge": "ObservableGauge",
|
|
92
|
+
"observableUpDownCounter": "ObservableUpDownCounter",
|
|
93
|
+
};
|
|
94
|
+
export const TelemetrySdkLanguageValues = {
|
|
95
|
+
"cpp": "cpp",
|
|
96
|
+
"dotnet": "dotnet",
|
|
97
|
+
"erlang": "erlang",
|
|
98
|
+
"go": "go",
|
|
99
|
+
"java": "java",
|
|
100
|
+
"nodejs": "nodejs",
|
|
101
|
+
"php": "php",
|
|
102
|
+
"python": "python",
|
|
103
|
+
"ruby": "ruby",
|
|
104
|
+
"rust": "rust",
|
|
105
|
+
"swift": "swift",
|
|
106
|
+
"webjs": "webjs",
|
|
107
|
+
};
|
|
108
|
+
export const ErrorTypeValues = {
|
|
109
|
+
"error": "_OTHER",
|
|
110
|
+
"timeout": "TIMEOUT",
|
|
111
|
+
"connectionRefused": "CONNECTION_REFUSED",
|
|
112
|
+
"dnsError": "DNS_ERROR",
|
|
113
|
+
"tlsError": "TLS_ERROR",
|
|
114
|
+
"authError": "AUTH_ERROR",
|
|
115
|
+
"permissionDenied": "PERMISSION_DENIED",
|
|
116
|
+
"notFound": "NOT_FOUND",
|
|
117
|
+
"resourceExhausted": "RESOURCE_EXHAUSTED",
|
|
118
|
+
"invalidArgument": "INVALID_ARGUMENT",
|
|
119
|
+
"cancelled": "CANCELLED",
|
|
120
|
+
};
|
|
121
|
+
export const EventDomainValues = {
|
|
122
|
+
"browser": "browser",
|
|
123
|
+
"device": "device",
|
|
124
|
+
"k8s": "k8s",
|
|
125
|
+
"session": "session",
|
|
126
|
+
"genAi": "gen_ai",
|
|
127
|
+
"exception": "exception",
|
|
128
|
+
"log": "log",
|
|
129
|
+
};
|
|
130
|
+
export const OriginalPayloadFormatValues = {
|
|
131
|
+
"pprof": "pprof",
|
|
132
|
+
"jfr": "jfr",
|
|
133
|
+
"linuxPerf": "linux_perf",
|
|
134
|
+
};
|
|
135
|
+
export const ProfileFrameTypeValues = {
|
|
136
|
+
"beam": "beam",
|
|
137
|
+
"cpython": "cpython",
|
|
138
|
+
"dotnet": "dotnet",
|
|
139
|
+
"go": "go",
|
|
140
|
+
"jvm": "jvm",
|
|
141
|
+
"kernel": "kernel",
|
|
142
|
+
"native": "native",
|
|
143
|
+
"perl": "perl",
|
|
144
|
+
"php": "php",
|
|
145
|
+
"ruby": "ruby",
|
|
146
|
+
"rust": "rust",
|
|
147
|
+
"v8js": "v8js",
|
|
148
|
+
};
|
|
149
|
+
export const CloudProviderValues = {
|
|
150
|
+
"alibabaCloud": "alibaba_cloud",
|
|
151
|
+
"aws": "aws",
|
|
152
|
+
"azure": "azure",
|
|
153
|
+
"gcp": "gcp",
|
|
154
|
+
"heroku": "heroku",
|
|
155
|
+
"ibmCloud": "ibm_cloud",
|
|
156
|
+
"tencentCloud": "tencent_cloud",
|
|
157
|
+
};
|
|
158
|
+
export const HostArchValues = {
|
|
159
|
+
"amd64": "amd64",
|
|
160
|
+
"arm32": "arm32",
|
|
161
|
+
"arm64": "arm64",
|
|
162
|
+
"ia64": "ia64",
|
|
163
|
+
"ppc32": "ppc32",
|
|
164
|
+
"ppc64": "ppc64",
|
|
165
|
+
"s390x": "s390x",
|
|
166
|
+
"x86": "x86",
|
|
167
|
+
};
|
|
168
|
+
export const OsTypeValues = {
|
|
169
|
+
"windows": "windows",
|
|
170
|
+
"linux": "linux",
|
|
171
|
+
"darwin": "darwin",
|
|
172
|
+
"freebsd": "freebsd",
|
|
173
|
+
"netbsd": "netbsd",
|
|
174
|
+
"openbsd": "openbsd",
|
|
175
|
+
"dragonflybsd": "dragonflybsd",
|
|
176
|
+
"hpux": "hpux",
|
|
177
|
+
"aix": "aix",
|
|
178
|
+
"solaris": "solaris",
|
|
179
|
+
"zOs": "z_os",
|
|
180
|
+
};
|
|
181
|
+
export const SessionEventNameValues = {
|
|
182
|
+
"sessionStart": "session.start",
|
|
183
|
+
"sessionEnd": "session.end",
|
|
184
|
+
};
|
|
185
|
+
export const SessionStateValues = {
|
|
186
|
+
"active": "active",
|
|
187
|
+
"idle": "idle",
|
|
188
|
+
"ended": "ended",
|
|
189
|
+
"timedOut": "timed_out",
|
|
190
|
+
"invalidated": "invalidated",
|
|
191
|
+
};
|
|
192
|
+
export const DeviceTypeValues = {
|
|
193
|
+
"desktop": "desktop",
|
|
194
|
+
"mobile": "mobile",
|
|
195
|
+
"tablet": "tablet",
|
|
196
|
+
"tv": "tv",
|
|
197
|
+
"console": "console",
|
|
198
|
+
"wearable": "wearable",
|
|
199
|
+
"iot": "iot",
|
|
200
|
+
"bot": "bot",
|
|
201
|
+
"unknown": "unknown",
|
|
202
|
+
};
|
|
203
|
+
export const HealthStatusValues = {
|
|
204
|
+
"healthy": "healthy",
|
|
205
|
+
"degraded": "degraded",
|
|
206
|
+
"unhealthy": "unhealthy",
|
|
207
|
+
};
|
|
208
|
+
export const RunnerResourceLifecycleValues = {
|
|
209
|
+
"pending": "pending",
|
|
210
|
+
"starting": "starting",
|
|
211
|
+
"ready": "ready",
|
|
212
|
+
"stopping": "stopping",
|
|
213
|
+
"stopped": "stopped",
|
|
214
|
+
"failed": "failed",
|
|
215
|
+
};
|
|
216
|
+
export const RunnerLogStreamValues = {
|
|
217
|
+
"stdout": "out",
|
|
218
|
+
"stderr": "err",
|
|
219
|
+
};
|
package/index.tsp
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// =============================================================================
|
|
4
|
-
// Consumer-facing barrel. Mirrors main.tsp minus local emit routing.
|
|
5
|
-
// The local emitters depend on `file:` packages
|
|
6
|
-
// (@ancplua/typespec-emit-*) which are not shipped to registry consumers and
|
|
7
|
-
// would break TypeSpec import resolution.
|
|
8
|
-
//
|
|
9
|
-
// Use main.tsp inside this repo for local `tsp compile`; downstream consumers
|
|
10
|
-
// reach the public surface through this file via the `.` export.
|
|
11
|
-
// =============================================================================
|
|
1
|
+
// @ancplua/qyl-api-schema — published TypeSpec entry point.
|
|
2
|
+
// Build-only emitter configuration belongs in main.tsp and is intentionally absent here.
|
|
12
3
|
|
|
4
|
+
import "@typespec/events";
|
|
13
5
|
import "@typespec/http";
|
|
14
|
-
import "@typespec/rest";
|
|
15
6
|
import "@typespec/openapi";
|
|
16
|
-
import "@typespec/openapi3";
|
|
17
|
-
import "@typespec/versioning";
|
|
18
7
|
import "@typespec/sse";
|
|
19
|
-
import "@typespec/events";
|
|
20
8
|
|
|
21
9
|
import "./generated/otel-keys.gen.tsp";
|
|
22
10
|
|
|
@@ -28,28 +16,13 @@ import "./otel/enums.tsp";
|
|
|
28
16
|
import "./otel/resource.tsp";
|
|
29
17
|
import "./otel/span.tsp";
|
|
30
18
|
import "./otel/logs.tsp";
|
|
31
|
-
import "./otel/metrics.tsp";
|
|
32
19
|
import "./otel/profiles.tsp";
|
|
33
20
|
|
|
34
|
-
import "./models/genai.tsp";
|
|
35
|
-
import "./models/http.tsp";
|
|
36
|
-
import "./models/rpc.tsp";
|
|
37
|
-
import "./models/messaging.tsp";
|
|
38
|
-
import "./models/db.tsp";
|
|
39
21
|
import "./models/session.tsp";
|
|
40
|
-
import "./models/
|
|
41
|
-
import "./models/
|
|
42
|
-
import "./models/
|
|
43
|
-
import "./models/test.tsp";
|
|
44
|
-
import "./models/deployment.tsp";
|
|
45
|
-
import "./models/system.tsp";
|
|
46
|
-
import "./models/identity.tsp";
|
|
47
|
-
import "./models/control-graph.tsp";
|
|
22
|
+
import "./models/health.tsp";
|
|
23
|
+
import "./models/runner.tsp";
|
|
24
|
+
import "./models/runner-mcp.tsp";
|
|
48
25
|
|
|
49
26
|
import "./api/routes.tsp";
|
|
50
27
|
import "./api/streaming.tsp";
|
|
51
|
-
|
|
52
|
-
using TypeSpec.Http;
|
|
53
|
-
using TypeSpec.Rest;
|
|
54
|
-
using TypeSpec.OpenAPI;
|
|
55
|
-
using TypeSpec.Versioning;
|
|
28
|
+
import "./api/runner.tsp";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
namespace Qyl.Api.Contracts.Health;
|
|
2
|
+
|
|
3
|
+
@doc("Health state reported by a qyl-managed process.")
|
|
4
|
+
enum HealthStatus {
|
|
5
|
+
healthy: "healthy",
|
|
6
|
+
degraded: "degraded",
|
|
7
|
+
unhealthy: "unhealthy",
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@doc("One named health-check result.")
|
|
11
|
+
model HealthCheckEntry {
|
|
12
|
+
status: HealthStatus;
|
|
13
|
+
description?: string;
|
|
14
|
+
durationMs: float64;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@doc("Readiness or liveness report returned by /health and /alive.")
|
|
18
|
+
model HealthReport {
|
|
19
|
+
status: HealthStatus;
|
|
20
|
+
totalDurationMs: float64;
|
|
21
|
+
entries: Record<HealthCheckEntry>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
namespace Qyl.Api.Contracts.Runner.Mcp;
|
|
2
|
+
|
|
3
|
+
@doc("Stable qyl projection of an MCP tool advertised by a runner resource.")
|
|
4
|
+
model RunnerMcpTool {
|
|
5
|
+
name: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
inputSchema?: Record<unknown>;
|
|
9
|
+
outputSchema?: Record<unknown>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@doc("MCP tools currently advertised by a runner resource.")
|
|
13
|
+
model RunnerMcpToolsResponse {
|
|
14
|
+
tools: RunnerMcpTool[];
|
|
15
|
+
nextCursor?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@doc("Tool call accepted by the runner's MCP projection.")
|
|
19
|
+
model RunnerMcpToolCallRequest {
|
|
20
|
+
name: string;
|
|
21
|
+
arguments?: Record<unknown>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@doc("One MCP content item projected onto a stable qyl JSON shape.")
|
|
25
|
+
model RunnerMcpContent {
|
|
26
|
+
type: string;
|
|
27
|
+
text?: string;
|
|
28
|
+
data?: string;
|
|
29
|
+
mimeType?: string;
|
|
30
|
+
uri?: url;
|
|
31
|
+
name?: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
@minValue(0)
|
|
35
|
+
size?: int64;
|
|
36
|
+
resource?: Record<unknown>;
|
|
37
|
+
annotations?: Record<unknown>;
|
|
38
|
+
@encodedName("application/json", "_meta")
|
|
39
|
+
metadata?: Record<unknown>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@doc("Stable qyl projection of an MCP tool-call result.")
|
|
43
|
+
model RunnerMcpToolCallResponse {
|
|
44
|
+
content: RunnerMcpContent[];
|
|
45
|
+
structuredContent?: Record<unknown>;
|
|
46
|
+
isError: boolean;
|
|
47
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
namespace Qyl.Api.Contracts.Runner;
|
|
2
|
+
|
|
3
|
+
@doc("Lifecycle state of a resource supervised by the local qyl runner.")
|
|
4
|
+
enum RunnerResourceLifecycle {
|
|
5
|
+
pending: "pending",
|
|
6
|
+
starting: "starting",
|
|
7
|
+
ready: "ready",
|
|
8
|
+
stopping: "stopping",
|
|
9
|
+
stopped: "stopped",
|
|
10
|
+
failed: "failed",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@doc("Current client-visible state of one runner resource.")
|
|
14
|
+
model RunnerResourceState {
|
|
15
|
+
name: string;
|
|
16
|
+
lifecycle: RunnerResourceLifecycle;
|
|
17
|
+
timestamp: utcDateTime;
|
|
18
|
+
kind?: string;
|
|
19
|
+
@minValue(1)
|
|
20
|
+
@maxValue(65535)
|
|
21
|
+
allocatedPort?: int32;
|
|
22
|
+
endpoint?: url;
|
|
23
|
+
lastError?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@doc("Origin stream for one captured child-process log line.")
|
|
27
|
+
enum RunnerLogStream {
|
|
28
|
+
stdout: "out",
|
|
29
|
+
stderr: "err",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@doc("One bounded child-process log line exposed by the runner.")
|
|
33
|
+
model RunnerLogLine {
|
|
34
|
+
resource: string;
|
|
35
|
+
stream: RunnerLogStream;
|
|
36
|
+
line: string;
|
|
37
|
+
}
|
package/models/session.tsp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
//
|
|
2
|
+
// Qyl session API contracts
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// User session telemetry attributes.
|
|
5
5
|
// =============================================================================
|
package/otel/enums.tsp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
//
|
|
2
|
+
// OpenTelemetry JSON projection enumerations
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// All OTel standard enumerations following OTel Semantic Conventions.
|
|
5
5
|
// =============================================================================
|
package/otel/logs.tsp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
//
|
|
2
|
+
// OpenTelemetry log JSON projection
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Structured logging following OTel log data model.
|
|
5
5
|
// =============================================================================
|
package/otel/profiles.tsp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
//
|
|
2
|
+
// OpenTelemetry profiles JSON projection (v1development)
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Continuous profiling signal following OTel Profiles proto specification.
|
|
5
5
|
// Proto package: opentelemetry.proto.profiles.v1development
|
package/otel/resource.tsp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
//
|
|
2
|
+
// OpenTelemetry resource JSON projection
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Resource attributes identifying the entity producing telemetry.
|
|
5
5
|
// =============================================================================
|
package/otel/span.tsp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
|
-
//
|
|
2
|
+
// OpenTelemetry span JSON projection
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Distributed tracing span representation following OTel specification.
|
|
5
5
|
// =============================================================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancplua/qyl-api-schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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": {
|
|
@@ -19,29 +19,48 @@
|
|
|
19
19
|
"openapi"
|
|
20
20
|
],
|
|
21
21
|
"type": "module",
|
|
22
|
+
"tspMain": "index.tsp",
|
|
22
23
|
"exports": {
|
|
23
|
-
".":
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"./
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"./generated/otel-keys":
|
|
24
|
+
".": {
|
|
25
|
+
"typespec": "./index.tsp",
|
|
26
|
+
"default": "./index.tsp"
|
|
27
|
+
},
|
|
28
|
+
"./otel": {
|
|
29
|
+
"typespec": "./otel/otel-conventions.tsp",
|
|
30
|
+
"default": "./otel/otel-conventions.tsp"
|
|
31
|
+
},
|
|
32
|
+
"./generated/otel-keys": {
|
|
33
|
+
"typespec": "./generated/otel-keys.gen.tsp",
|
|
34
|
+
"default": "./generated/otel-keys.gen.tsp"
|
|
35
|
+
},
|
|
36
|
+
"./types": {
|
|
37
|
+
"types": "./generated/ts-runtime/api.d.ts",
|
|
38
|
+
"import": "./generated/ts-runtime/api.js",
|
|
39
|
+
"default": "./generated/ts-runtime/api.js"
|
|
40
|
+
}
|
|
32
41
|
},
|
|
33
42
|
"files": [
|
|
34
43
|
"index.tsp",
|
|
35
|
-
"api
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
44
|
+
"api/routes.tsp",
|
|
45
|
+
"api/runner.tsp",
|
|
46
|
+
"api/streaming.tsp",
|
|
47
|
+
"common/errors.tsp",
|
|
48
|
+
"common/pagination.tsp",
|
|
49
|
+
"common/types.tsp",
|
|
50
|
+
"models/health.tsp",
|
|
51
|
+
"models/runner-mcp.tsp",
|
|
52
|
+
"models/runner.tsp",
|
|
53
|
+
"models/session.tsp",
|
|
54
|
+
"otel/enums.tsp",
|
|
55
|
+
"otel/logs.tsp",
|
|
56
|
+
"otel/otel-conventions.tsp",
|
|
57
|
+
"otel/profiles.tsp",
|
|
58
|
+
"otel/resource.tsp",
|
|
59
|
+
"otel/span.tsp",
|
|
60
|
+
"generated/otel-keys.gen.tsp",
|
|
61
|
+
"generated/ts-runtime/api.d.ts",
|
|
62
|
+
"generated/ts-runtime/api.js",
|
|
43
63
|
"README.md",
|
|
44
|
-
"VERSIONING.md",
|
|
45
64
|
"LICENSE"
|
|
46
65
|
],
|
|
47
66
|
"publishConfig": {
|
|
@@ -50,9 +69,12 @@
|
|
|
50
69
|
"registry": "https://registry.npmjs.org"
|
|
51
70
|
},
|
|
52
71
|
"scripts": {
|
|
53
|
-
"
|
|
72
|
+
"clean:generated": "node scripts/clean-generated.mjs",
|
|
73
|
+
"build:emitters": "tsc -p emitters/csharp && tsc -p emitters/ts-types",
|
|
74
|
+
"build:ts-runtime": "tsc -p tsconfig.contracts.json",
|
|
54
75
|
"prepare": "npm run build:emitters",
|
|
55
|
-
"
|
|
76
|
+
"prepack": "npm run compile",
|
|
77
|
+
"compile": "npm run clean:generated && npm run build:emitters && tsp compile main.tsp && npm run build:ts-runtime",
|
|
56
78
|
"watch": "tsp compile main.tsp --watch",
|
|
57
79
|
"format": "tsp format **/*.tsp",
|
|
58
80
|
"lint": "npm run build:emitters && tsp compile main.tsp --no-emit --warn-as-error",
|
|
@@ -64,29 +86,19 @@
|
|
|
64
86
|
"@typespec/http": "^1.13.0",
|
|
65
87
|
"@typespec/json-schema": "^1.13.0",
|
|
66
88
|
"@typespec/openapi": "^1.13.0",
|
|
67
|
-
"@typespec/
|
|
68
|
-
"@typespec/rest": "^0.83.0",
|
|
69
|
-
"@typespec/sse": "^0.83.0",
|
|
70
|
-
"@typespec/streams": "^0.83.0",
|
|
71
|
-
"@typespec/versioning": "^0.83.0"
|
|
89
|
+
"@typespec/sse": "^0.83.0"
|
|
72
90
|
},
|
|
73
91
|
"devDependencies": {
|
|
74
92
|
"@ancplua/typespec-emit-csharp": "file:./emitters/csharp",
|
|
75
93
|
"@ancplua/typespec-emit-ts-types": "file:./emitters/ts-types",
|
|
76
|
-
"@
|
|
77
|
-
"@qyl/telemetry-control-graph": "file:./emitters/telemetry-control-graph",
|
|
78
|
-
"@types/node": "25.9.4",
|
|
94
|
+
"@types/node": "25.9.5",
|
|
79
95
|
"@typespec/compiler": "1.13.0",
|
|
80
96
|
"@typespec/events": "0.83.0",
|
|
81
97
|
"@typespec/http": "1.13.0",
|
|
82
98
|
"@typespec/json-schema": "1.13.0",
|
|
83
99
|
"@typespec/openapi": "1.13.0",
|
|
84
100
|
"@typespec/openapi3": "1.13.0",
|
|
85
|
-
"@typespec/rest": "0.83.0",
|
|
86
101
|
"@typespec/sse": "0.83.0",
|
|
87
|
-
"
|
|
88
|
-
"@typespec/versioning": "0.83.0",
|
|
89
|
-
"typescript": "6.0.3",
|
|
90
|
-
"vitest": "4.1.9"
|
|
102
|
+
"typescript": "6.0.3"
|
|
91
103
|
}
|
|
92
104
|
}
|
package/VERSIONING.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# TypeSpec Versioning In qyl-api-schema
|
|
2
|
-
|
|
3
|
-
This repository uses `@typespec/versioning` to record when schema elements were added or removed across qyl API versions and OpenTelemetry compatibility-model pins. The annotations live in TypeSpec so schema evolution is reviewable at the contract source.
|
|
4
|
-
|
|
5
|
-
## Release versioning (the package version)
|
|
6
|
-
|
|
7
|
-
Separate from the `@typespec/versioning` schema annotations below: the published **package** version
|
|
8
|
-
(npm `@ancplua/qyl-api-schema` and NuGet `Qyl.Api.Contracts`) is **CI-owned and tag-derived** — no
|
|
9
|
-
hand-bumped version lives in any committed file. To cut a release, publish a GitHub Release whose tag
|
|
10
|
-
is `vMAJOR.MINOR.PATCH[-prerelease]`; `publish.yml` strips the leading `v` and stamps that single
|
|
11
|
-
version onto both npm and NuGet (no build metadata — npm rejects it and NuGet strips it), so the two
|
|
12
|
-
registries are lockstep by construction. The committed `package.json` version is the non-authoritative
|
|
13
|
-
placeholder `0.0.0-development`, and `packaging/Qyl.Api.Contracts.csproj` carries no `<Version>`.
|
|
14
|
-
|
|
15
|
-
## Where it is used
|
|
16
|
-
|
|
17
|
-
- `models/genai.tsp` for GenAI semantic-convention shaped models
|
|
18
|
-
- `models/db.tsp` for DB semantic-convention shaped models
|
|
19
|
-
- `models/http.tsp` for HTTP semantic-convention shaped models
|
|
20
|
-
- `api/routes.tsp` for API versioning
|
|
21
|
-
|
|
22
|
-
## Pattern: version registry + annotations
|
|
23
|
-
|
|
24
|
-
```tsp
|
|
25
|
-
import "@typespec/versioning";
|
|
26
|
-
using TypeSpec.Versioning;
|
|
27
|
-
|
|
28
|
-
@versioned(GenAiVersions)
|
|
29
|
-
namespace Qyl.Api.Contracts.Domains.AI.GenAi;
|
|
30
|
-
|
|
31
|
-
enum GenAiVersions {
|
|
32
|
-
v1_27: "1.27.0",
|
|
33
|
-
v1_28: "1.28.0",
|
|
34
|
-
v1_29: "1.29.0",
|
|
35
|
-
v1_37: "1.37.0",
|
|
36
|
-
v1_38: "1.38.0",
|
|
37
|
-
v1_39: "1.39.0",
|
|
38
|
-
v1_40: "1.40.0",
|
|
39
|
-
v1_41: "1.41.0",
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
model GenAiSpanAttributes {
|
|
43
|
-
@encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageInputTokens)
|
|
44
|
-
usageInputTokens?: TokenCount;
|
|
45
|
-
|
|
46
|
-
@encodedName("application/json", "gen_ai.usage.input_tokens.cached")
|
|
47
|
-
@added(GenAiVersions.v1_38)
|
|
48
|
-
usageInputTokensCached?: TokenCount;
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Note (v0.3.0): the pre-migration `gen_ai.*` fields that carried upstream-deleted
|
|
53
|
-
wire keys (`gen_ai.system`, `gen_ai.prompt`, `gen_ai.completion`,
|
|
54
|
-
`gen_ai.usage.prompt_tokens` / `.completion_tokens`, and the
|
|
55
|
-
`gen_ai.openai.*` vendor keys) were **removed from the contract surface**
|
|
56
|
-
when the OTel 1.42 GenAI-registry split was adopted. Old-key telemetry is a
|
|
57
|
-
collector *ingestion normalization* concern (mapping below), not a contract
|
|
58
|
-
field.
|
|
59
|
-
|
|
60
|
-
## Ingestion mapping (deprecated -> current)
|
|
61
|
-
|
|
62
|
-
Consumers can keep ingestion backward-compatible by normalizing deprecated attribute keys. Keep any downstream mapping aligned with the TypeSpec history.
|
|
63
|
-
|
|
64
|
-
```csharp
|
|
65
|
-
public static readonly FrozenDictionary<string, string> DeprecatedMappings =
|
|
66
|
-
new Dictionary<string, string>(StringComparer.Ordinal)
|
|
67
|
-
{
|
|
68
|
-
["gen_ai.system"] = "gen_ai.provider.name",
|
|
69
|
-
["gen_ai.usage.prompt_tokens"] = "gen_ai.usage.input_tokens",
|
|
70
|
-
["gen_ai.usage.completion_tokens"] = "gen_ai.usage.output_tokens",
|
|
71
|
-
["agents.tool.call_id"] = "gen_ai.tool.call.id",
|
|
72
|
-
["db.system"] = "db.system.name"
|
|
73
|
-
}.ToFrozenDictionary(StringComparer.Ordinal);
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Downstream consumers should cover these mappings in ingestion tests.
|
|
77
|
-
|
|
78
|
-
## Workflow for schema evolution
|
|
79
|
-
|
|
80
|
-
- Add a new version entry to the enum in the owning namespace.
|
|
81
|
-
- Mark additions and removals with `@added` and `@removed`.
|
|
82
|
-
- Update downstream normalization mappings to keep ingestion compatibility.
|
|
83
|
-
- Extend downstream ingestion tests to cover the new mapping.
|
|
84
|
-
- Run `npm run compile` after TypeSpec changes.
|