@ancplua/qyl-api-schema 2.1.0 → 4.0.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.
@@ -356,6 +356,12 @@ export declare const McpDataModeValues: {
356
356
  readonly demo: "demo";
357
357
  };
358
358
  export type McpDataMode = typeof McpDataModeValues[keyof typeof McpDataModeValues];
359
+ export declare const CiPhaseStatusValues: {
360
+ readonly ok: "ok";
361
+ readonly error: "error";
362
+ readonly unset: "unset";
363
+ };
364
+ export type CiPhaseStatus = typeof CiPhaseStatusValues[keyof typeof CiPhaseStatusValues];
359
365
  export declare const FetchTelemetryViewValues: {
360
366
  readonly traces: "traces";
361
367
  readonly trace: "trace";
@@ -531,8 +537,8 @@ export interface Span {
531
537
  "trace_state"?: string;
532
538
  "name": string;
533
539
  "kind": SpanKind;
534
- "start_time_unix_nano": number;
535
- "end_time_unix_nano": number;
540
+ "start_time_unix_nano": string;
541
+ "end_time_unix_nano": string;
536
542
  "attributes"?: Attribute[];
537
543
  "dropped_attributes_count"?: number;
538
544
  "events"?: SpanEvent[];
@@ -546,7 +552,7 @@ export interface Span {
546
552
  }
547
553
  export interface SpanEvent {
548
554
  "name": string;
549
- "time_unix_nano": number;
555
+ "time_unix_nano": string;
550
556
  "attributes"?: Attribute[];
551
557
  "dropped_attributes_count"?: number;
552
558
  }
@@ -566,7 +572,7 @@ export interface TraceSummary {
566
572
  "trace_id": TraceId;
567
573
  "root_span"?: Span;
568
574
  "span_count": number;
569
- "duration_ns": number;
575
+ "duration_ns": string;
570
576
  "start_time": string;
571
577
  "end_time": string;
572
578
  "services": string[];
@@ -582,8 +588,8 @@ export interface SpanQueryFilters {
582
588
  "kind"?: SpanKind;
583
589
  "service_name"?: string;
584
590
  "status_code"?: SpanStatusCode;
585
- "min_duration_ns"?: number;
586
- "max_duration_ns"?: number;
591
+ "min_duration_ns"?: string;
592
+ "max_duration_ns"?: string;
587
593
  "attribute"?: string;
588
594
  }
589
595
  export interface SpanStats {
@@ -591,11 +597,11 @@ export interface SpanStats {
591
597
  "error_count": number;
592
598
  "error_rate": number;
593
599
  "avg_duration_ns": number;
594
- "p50_duration_ns": number;
595
- "p90_duration_ns": number;
596
- "p99_duration_ns": number;
597
- "min_duration_ns": number;
598
- "max_duration_ns": number;
600
+ "p50_duration_ns": string;
601
+ "p90_duration_ns": string;
602
+ "p99_duration_ns": string;
603
+ "min_duration_ns": string;
604
+ "max_duration_ns": string;
599
605
  "throughput_per_second": number;
600
606
  "by_service"?: SpanStatsByDimension[];
601
607
  "by_operation"?: SpanStatsByDimension[];
@@ -607,8 +613,8 @@ export interface SpanStatsByDimension {
607
613
  "error_rate": number;
608
614
  }
609
615
  export interface LogRecord {
610
- "time_unix_nano": number;
611
- "observed_time_unix_nano": number;
616
+ "time_unix_nano": string;
617
+ "observed_time_unix_nano": string;
612
618
  "severity_number": SeverityNumber;
613
619
  "severity_text"?: SeverityText;
614
620
  "body": LogBody;
@@ -703,6 +709,7 @@ export interface HealthReport {
703
709
  "status": HealthStatus;
704
710
  "total_duration_ms": number;
705
711
  "entries": Record<string, HealthCheckEntry>;
712
+ "contract_revision": string;
706
713
  }
707
714
  export interface RunnerResourceState {
708
715
  "name": string;
@@ -1305,6 +1312,31 @@ export interface SearchLogsOutput {
1305
1312
  "logs": LogRecord[];
1306
1313
  "mode": McpDataMode;
1307
1314
  }
1315
+ export interface CiLogInput {
1316
+ "run_id"?: SessionId;
1317
+ "limit"?: number;
1318
+ }
1319
+ export interface CiRunSummary {
1320
+ "run_id": SessionId;
1321
+ "state": SessionState;
1322
+ "start_time": string;
1323
+ "duration_ms"?: number;
1324
+ "error_count": number;
1325
+ "services": string[];
1326
+ }
1327
+ export interface CiPhase {
1328
+ "leg": string;
1329
+ "phase": string;
1330
+ "status": CiPhaseStatus;
1331
+ "duration_ms": number;
1332
+ "message"?: string;
1333
+ }
1334
+ export interface CiLogOutput {
1335
+ "runs"?: CiRunSummary[];
1336
+ "run_id"?: SessionId;
1337
+ "phases"?: CiPhase[];
1338
+ "mode": McpDataMode;
1339
+ }
1308
1340
  export interface FetchTelemetryInput {
1309
1341
  "view": FetchTelemetryView;
1310
1342
  "trace_id"?: TraceId;
@@ -1354,3 +1386,5 @@ export interface CursorPageSessionEntity {
1354
1386
  "prev_cursor"?: string;
1355
1387
  "has_more": boolean;
1356
1388
  }
1389
+ /** Revision of the API contract these types were emitted from; compare against HealthReport.contract_revision. */
1390
+ export declare const CONTRACT_REVISION: string;
@@ -284,9 +284,17 @@ export const McpDataModeValues = {
284
284
  "live": "live",
285
285
  "demo": "demo",
286
286
  };
287
+ export const CiPhaseStatusValues = {
288
+ "ok": "ok",
289
+ "error": "error",
290
+ "unset": "unset",
291
+ };
287
292
  export const FetchTelemetryViewValues = {
288
293
  "traces": "traces",
289
294
  "trace": "trace",
290
295
  "logs": "logs",
291
296
  "mcpStats": "mcp_stats",
292
297
  };
298
+ // --- contract revision (scripts/emit-contract-revision.mjs) ---
299
+ /** Revision of the API contract these types were emitted from; compare against HealthReport.contract_revision. */
300
+ export const CONTRACT_REVISION = "sha256:9ba787d0bd3269a9";
package/models/health.tsp CHANGED
@@ -1,3 +1,7 @@
1
+ import "../common/types.tsp";
2
+
3
+ using Qyl.Api.Contracts.Common;
4
+
1
5
  namespace Qyl.Api.Contracts.Health;
2
6
 
3
7
  @doc("Health state reported by a qyl-managed process.")
@@ -21,4 +25,12 @@ model HealthReport {
21
25
  @encodedName("application/json", "total_duration_ms")
22
26
  totalDurationMs: float64;
23
27
  entries: Record<HealthCheckEntry>;
28
+
29
+ // The meta surface of the contract loop: first-party clients compare this to
30
+ // the revision baked into their own generated artifacts and refuse to run on
31
+ // a mismatch, so a redeployed collector cannot silently serve a contract its
32
+ // clients were not generated from.
33
+ @doc("Revision of the API contract this process serves, for the client-side startup handshake.")
34
+ @encodedName("application/json", "contract_revision")
35
+ contractRevision: ContractRevision;
24
36
  }
@@ -117,6 +117,76 @@ model SearchLogsOutput {
117
117
  mode: McpDataMode;
118
118
  }
119
119
 
120
+ @doc("Outcome of one CI phase span, projected from its OpenTelemetry span status.")
121
+ enum CiPhaseStatus {
122
+ ok: "ok",
123
+ error: "error",
124
+ unset: "unset",
125
+ }
126
+
127
+ @doc("Input for ci_log.")
128
+ model CiLogInput {
129
+ @doc("Session id of one CI run for a per-leg phase breakdown; omit to list recent runs.")
130
+ @encodedName("application/json", "run_id")
131
+ runId?: SessionId;
132
+
133
+ @doc("Maximum CI runs to list.")
134
+ @minValue(1)
135
+ @maxValue(50)
136
+ limit?: int32 = 10;
137
+ }
138
+
139
+ @doc("One CI run, summarized from the session its telemetry is grouped under.")
140
+ model CiRunSummary {
141
+ @encodedName("application/json", "run_id")
142
+ runId: SessionId;
143
+
144
+ state: SessionState;
145
+
146
+ @encodedName("application/json", "start_time")
147
+ startTime: utcDateTime;
148
+
149
+ @encodedName("application/json", "duration_ms")
150
+ durationMs?: DurationMs;
151
+
152
+ @doc("Spans in the run that ended with an error status.")
153
+ @encodedName("application/json", "error_count")
154
+ @minValue(0)
155
+ errorCount: int32;
156
+
157
+ @doc("Service names observed in the run, at least one of which is CI-emitted.")
158
+ services: string[];
159
+ }
160
+
161
+ @doc("One phase span of a CI run, attributed to the leg that executed it.")
162
+ model CiPhase {
163
+ @doc("Value of the span's ci.leg attribute, falling back to its service name.")
164
+ leg: string;
165
+
166
+ @doc("Span name, which the CI emitter convention sets to the phase name.")
167
+ phase: string;
168
+
169
+ status: CiPhaseStatus;
170
+
171
+ @encodedName("application/json", "duration_ms")
172
+ durationMs: DurationMs;
173
+
174
+ @doc("Span status message, present on a failed phase.")
175
+ message?: string;
176
+ }
177
+
178
+ @doc("Structured output for ci_log: recent runs, or one run's phases.")
179
+ model CiLogOutput {
180
+ runs?: CiRunSummary[];
181
+
182
+ @encodedName("application/json", "run_id")
183
+ runId?: SessionId;
184
+
185
+ phases?: CiPhase[];
186
+
187
+ mode: McpDataMode;
188
+ }
189
+
120
190
  @doc("Input for the app-only fetch_telemetry tool.")
121
191
  model FetchTelemetryInput {
122
192
  view: FetchTelemetryView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancplua/qyl-api-schema",
3
- "version": "2.1.0",
3
+ "version": "4.0.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": {
@@ -85,9 +85,10 @@
85
85
  "build:emitters": "tsc -p emitters/csharp && tsc -p emitters/ts-types && tsc -p emitters/qyl-lint",
86
86
  "build:ts-runtime": "tsc -p tsconfig.contracts.json",
87
87
  "build:json-schema": "node scripts/openapi-to-json-schema.mjs",
88
+ "emit:contract-revision": "node scripts/emit-contract-revision.mjs",
88
89
  "prepare": "npm run build:emitters",
89
90
  "prepack": "npm run compile",
90
- "compile": "npm run clean:generated && npm run build:emitters && tsp compile main.tsp && npm run build:json-schema && npm run build:ts-runtime",
91
+ "compile": "npm run clean:generated && npm run build:emitters && tsp compile main.tsp && npm run emit:contract-revision && npm run build:json-schema && npm run build:ts-runtime",
91
92
  "watch": "tsp compile main.tsp --watch",
92
93
  "format": "tsp format **/*.tsp",
93
94
  "lint": "npm run build:emitters && tsp compile main.tsp --no-emit --warn-as-error",
@@ -98,7 +99,7 @@
98
99
  },
99
100
  "peerDependencies": {
100
101
  "@typespec/compiler": "^1.13.0 || >=1.13.0-dev.0",
101
- "@typespec/events": "^0.83.0",
102
+ "@typespec/events": "^0.83.0 || ^0.84.0",
102
103
  "@typespec/http": "^1.13.0",
103
104
  "@typespec/openapi": "^1.13.0",
104
105
  "@typespec/openapi3": "^1.13.0",
@@ -128,13 +129,13 @@
128
129
  "@ancplua/typespec-emit-csharp": "file:./emitters/csharp",
129
130
  "@ancplua/typespec-emit-ts-types": "file:./emitters/ts-types",
130
131
  "@ancplua/typespec-qyl-lint": "file:./emitters/qyl-lint",
131
- "@types/node": "24.13.3",
132
+ "@types/node": "26.1.1",
132
133
  "@typespec/compiler": "1.14.0",
133
- "@typespec/events": "0.83.0",
134
- "@typespec/http": "1.13.0",
135
- "@typespec/openapi": "1.13.0",
136
- "@typespec/openapi3": "1.13.0",
137
- "@typespec/sse": "0.83.0",
134
+ "@typespec/events": "0.84.0",
135
+ "@typespec/http": "1.14.0",
136
+ "@typespec/openapi": "1.14.0",
137
+ "@typespec/openapi3": "1.14.0",
138
+ "@typespec/sse": "0.84.0",
138
139
  "ajv": "8.20.0",
139
140
  "typescript": "7.0.2"
140
141
  }