@ancplua/qyl-api-schema 0.2.3 → 0.3.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
@@ -14,7 +14,7 @@ open-telemetry/semantic-conventions @ v1.43.0 + semantic-conventions-genai (de
14
14
  | Weaver (Qyl.OpenTelemetry.SemanticConventions repo:
15
15
  | generate.sh -> resolved-registry.json -> emit_typespec_keys.py)
16
16
  v
17
- generated/otel-keys.gen.tsp (+ generated/otel-keys-legacy.tsp, hand-frozen wire keys)
17
+ generated/otel-keys.gen.tsp
18
18
  |
19
19
  | TypeSpec import / lockstep key projection
20
20
  v
@@ -31,8 +31,7 @@ qyl services, dashboard, tools, and generated clients
31
31
  The generic OpenTelemetry key projection is the checked-in
32
32
  `generated/otel-keys.gen.tsp` under
33
33
  `ANcpLua.OpenTelemetry.SemanticConventions.Keys.*`, regenerated by the
34
- `Qyl.OpenTelemetry.SemanticConventions` repo's Weaver pipeline (the retired
35
- `@ancplua/typespec-otel-semconv@1.41.0-2` package was its frozen predecessor).
34
+ `Qyl.OpenTelemetry.SemanticConventions` repo's Weaver pipeline.
36
35
  This repo defines qyl domain models, routes, and response contracts under
37
36
  `Qyl.Api.Contracts.*`.
38
37
 
package/VERSIONING.md CHANGED
@@ -40,14 +40,6 @@ enum GenAiVersions {
40
40
  }
41
41
 
42
42
  model GenAiSpanAttributes {
43
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.System)
44
- @removed(GenAiVersions.v1_37)
45
- system?: string;
46
-
47
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsagePromptTokens)
48
- @removed(GenAiVersions.v1_28)
49
- usagePromptTokens?: TokenCount;
50
-
51
43
  @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageInputTokens)
52
44
  usageInputTokens?: TokenCount;
53
45
 
@@ -57,6 +49,14 @@ model GenAiSpanAttributes {
57
49
  }
58
50
  ```
59
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
60
  ## Ingestion mapping (deprecated -> current)
61
61
 
62
62
  Consumers can keep ingestion backward-compatible by normalizing deprecated attribute keys. Keep any downstream mapping aligned with the TypeSpec history.
package/common/types.tsp CHANGED
@@ -2,7 +2,8 @@
2
2
  // qyl common types and scalars
3
3
  // =============================================================================
4
4
  // Foundational types used across qyl API contracts and OTel-compatible models.
5
- // OpenTelemetry semantic-convention references are pinned to v1.41.0.
5
+ // OpenTelemetry semantic-convention references are pinned to core v1.43.0
6
+ // (GenAI keys come from the dedicated GenAI registry since the 1.42 split).
6
7
  // =============================================================================
7
8
 
8
9
  import "@typespec/versioning";
@@ -42,8 +43,14 @@ enum OTelVersion {
42
43
  @doc("OTel Semconv v1.40 - Oracle DB split, RPC cleanup, GenAI cache tokens")
43
44
  v1_40: "1.40.0",
44
45
 
45
- @doc("OTel Semconv v1.41 - Current compatibility pin")
46
+ @doc("OTel Semconv v1.41 - GraphQL doc opt-in, RPC server client.* removal")
46
47
  v1_41: "1.41.0",
48
+
49
+ @doc("OTel Semconv v1.42 - GenAI conventions moved to the dedicated GenAI registry; k8s/container registry attrs stable")
50
+ v1_42: "1.42.0",
51
+
52
+ @doc("OTel Semconv v1.43 - Current compatibility pin (core; GenAI keys from the GenAI dev registry)")
53
+ v1_43: "1.43.0",
47
54
  }
48
55
 
49
56
  // =============================================================================
@@ -2,31 +2,23 @@
2
2
 
3
3
  This directory holds the semconv TypeSpec key projection and the emitter
4
4
  outputs. `otel-keys.gen.tsp` is Weaver-generated — **do not edit by hand**.
5
- `otel-keys-legacy.tsp` is the one deliberate exception: hand-maintained,
6
- see below.
7
5
 
8
6
  ## Files
9
7
 
10
8
  | File | Source | Regenerate via |
11
9
  | --- | --- | --- |
12
10
  | `otel-keys.gen.tsp` | OpenTelemetry semantic-conventions core **v1.43.0** + the GenAI dev registry (`open-telemetry/semantic-conventions-genai`, pinned commit), merged and projected by the `Qyl.OpenTelemetry.SemanticConventions` repo's Weaver pipeline | In that repo: `src/…SourceGeneration/scripts/generate.sh` (refresh `Resources/resolved-registry.json`), then `src/…SourceGeneration/scripts/emit_typespec_keys.py --write <path-to-this-file>` |
13
- | `otel-keys-legacy.tsp` | Hand-maintained. Frozen legacy wire keys (10 `gen_ai.*` consts) that upstream deleted at the 1.41→1.43 bump but that qyl's published contracts still carry on deprecated migration fields. Values are verbatim from the last registry that defined them (v1.41.0). | Never regenerated. Delete a const here only if upstream re-introduces the same name (the `VerifyKeysLockstep` Nuke target and the TypeSpec duplicate-declaration error both catch that). |
14
-
15
- The predecessor projection was the npm package
16
- [`@ancplua/typespec-otel-semconv@1.41.0-2`](https://github.com/ANcpLua/typespec-otel-semconv)
17
- — its source repo is archived/deleted, so 1.41.0-2 was its last possible
18
- release; it is no longer a dependency of this repo.
19
11
 
20
12
  ## What the key files provide
21
13
 
22
14
  One TypeSpec namespace per OpenTelemetry root group, each declaring `const <Name>: string = "<dotted.key>"`. Extracted `.tsp` models reference these consts inside `@encodedName(...)` instead of hand-typing dotted attribute keys.
23
15
 
24
16
  ```tsp
25
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.System)
26
- system?: string;
17
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ProviderName)
18
+ providerName?: string;
27
19
  ```
28
20
 
29
- Deprecated upstream attributes are emitted with `#deprecated "..."` so models that reference them produce a TypeSpec compiler warning matching upstream's own deprecation notes. The legacy file's consts are all `#deprecated` by construction.
21
+ Deprecated upstream attributes are emitted with `#deprecated "..."` so models that reference them produce a TypeSpec compiler warning matching upstream's own deprecation notes.
30
22
 
31
23
  ## Pin
32
24
 
package/index.tsp CHANGED
@@ -19,7 +19,6 @@ import "@typespec/sse";
19
19
  import "@typespec/events";
20
20
 
21
21
  import "./generated/otel-keys.gen.tsp";
22
- import "./generated/otel-keys-legacy.tsp";
23
22
 
24
23
  import "./common/types.tsp";
25
24
  import "./common/errors.tsp";
package/models/genai.tsp CHANGED
@@ -60,11 +60,6 @@ model GenAiSpanAttributes {
60
60
  @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.ProviderName)
61
61
  providerName: GenAiProvider;
62
62
 
63
- @doc("The name of the GenAI system/product (e.g., 'ChatGPT', 'Claude', 'Gemini')")
64
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.System)
65
- @removed(GenAiVersions.v1_37)
66
- system?: string;
67
-
68
63
  // ---------------------------------------------------------------------------
69
64
  // Operation Details
70
65
  // ---------------------------------------------------------------------------
@@ -184,20 +179,6 @@ model GenAiSpanAttributes {
184
179
  @added(GenAiVersions.v1_40)
185
180
  usageCacheCreationInputTokens?: TokenCount;
186
181
 
187
- // ---------------------------------------------------------------------------
188
- // Deprecated Attributes (for migration)
189
- // ---------------------------------------------------------------------------
190
-
191
- @doc("Prompt tokens (deprecated - use gen_ai.usage.input_tokens)")
192
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsagePromptTokens)
193
- @removed(GenAiVersions.v1_28)
194
- usagePromptTokens?: TokenCount;
195
-
196
- @doc("Completion tokens (deprecated - use gen_ai.usage.output_tokens)")
197
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.UsageCompletionTokens)
198
- @removed(GenAiVersions.v1_28)
199
- usageCompletionTokens?: TokenCount;
200
-
201
182
  // ---------------------------------------------------------------------------
202
183
  // Agent Attributes (v1.38+)
203
184
  // ---------------------------------------------------------------------------
@@ -294,10 +275,6 @@ model GenAiSpanAttributes {
294
275
  @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OutputType)
295
276
  outputType?: GenAiOutputType;
296
277
 
297
- @doc("Prompt content (may be redacted)")
298
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.Prompt)
299
- prompt?: string;
300
-
301
278
  @doc("Name of the prompt template being used")
302
279
  @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.PromptName)
303
280
  promptName?: string;
@@ -306,10 +283,6 @@ model GenAiSpanAttributes {
306
283
  @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.SystemInstructions)
307
284
  systemInstructions?: string;
308
285
 
309
- @doc("Completion content (may be redacted)")
310
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.Completion)
311
- completion?: string;
312
-
313
286
  // ---------------------------------------------------------------------------
314
287
  // Extended Request Attributes
315
288
  // ---------------------------------------------------------------------------
@@ -1329,40 +1302,21 @@ model LatencyPercentiles {
1329
1302
  // Vendor-Specific Extensions (OTel 1.40)
1330
1303
  // =============================================================================
1331
1304
 
1332
- @doc("OpenAI-specific request attributes")
1305
+ @doc("OpenAI-specific request attributes (OTel 1.42 moved these to the openai.* namespace; response_format and seed graduated to the generic gen_ai.output.type / gen_ai.request.seed)")
1333
1306
  model OpenAiRequestAttributes {
1334
- @doc("Response format requested (text, json_object, json_schema)")
1335
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiRequestResponseFormat)
1336
- responseFormat?: OpenAiResponseFormat;
1337
-
1338
- @doc("Random seed for deterministic generation")
1339
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiRequestSeed)
1340
- seed?: int64;
1341
-
1342
1307
  @doc("Service tier for the request (auto, default, etc.)")
1343
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiRequestServiceTier)
1308
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Openai.RequestServiceTier)
1344
1309
  serviceTier?: string;
1345
1310
  }
1346
1311
 
1347
1312
  @doc("OpenAI-specific response attributes")
1348
1313
  model OpenAiResponseAttributes {
1349
1314
  @doc("Service tier used for the response")
1350
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiResponseServiceTier)
1315
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Openai.ResponseServiceTier)
1351
1316
  serviceTier?: string;
1352
1317
 
1353
1318
  @doc("System fingerprint for reproducibility")
1354
- @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi.OpenaiResponseSystemFingerprint)
1319
+ @encodedName("application/json", ANcpLua.OpenTelemetry.SemanticConventions.Keys.Openai.ResponseSystemFingerprint)
1355
1320
  systemFingerprint?: string;
1356
1321
  }
1357
1322
 
1358
- @doc("OpenAI response format types")
1359
- enum OpenAiResponseFormat {
1360
- @doc("Plain text response")
1361
- text: "text",
1362
-
1363
- @doc("JSON object response")
1364
- jsonObject: "json_object",
1365
-
1366
- @doc("JSON schema-constrained response")
1367
- jsonSchema: "json_schema",
1368
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancplua/qyl-api-schema",
3
- "version": "0.2.3",
3
+ "version": "0.3.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": {
@@ -1,51 +0,0 @@
1
- // Hand-maintained companion to otel-keys.gen.tsp — NOT generated. Frozen legacy
2
- // wire keys that upstream removed from the registries at the 1.41→1.43 bump
3
- // (the GenAI split: gen_ai.system/prompt/completion/usage.{prompt,completion}_tokens
4
- // were dropped outright; of the gen_ai.openai.* vendor keys, service_tier ×2 and
5
- // response.system_fingerprint were renamed to openai.*, seed and
6
- // request.response_format were removed with no successor).
7
- //
8
- // qyl's public contracts still carry these dotted keys on deliberately-deprecated
9
- // migration fields (`@removed(GenAiVersions.…)` in models/genai.tsp). A wire name
10
- // is a published contract: it stays frozen even after upstream deletes the key.
11
- // The values below are verbatim from the last registry that defined them
12
- // (open-telemetry/semantic-conventions v1.41.0, via the retired
13
- // @ancplua/typespec-otel-semconv@1.41.0-2 projection).
14
- //
15
- // TypeSpec merges namespaces across files, so these consts land in the same
16
- // Keys.GenAi namespace the generated file populates — consuming models did not
17
- // change. If a future regeneration re-introduces one of these names, the
18
- // compiler will error on the duplicate: resolve by deleting it HERE.
19
-
20
- namespace ANcpLua.OpenTelemetry.SemanticConventions.Keys.GenAi {
21
- /** Frozen legacy wire key; removed from semconv (replaced by gen_ai.output.messages). */
22
- #deprecated "Removed upstream; frozen for contract compatibility."
23
- const Completion: string = "gen_ai.completion";
24
- /** Frozen legacy wire key; removed from semconv (no openai.* successor at 1.43). */
25
- #deprecated "Removed upstream; frozen for contract compatibility."
26
- const OpenaiRequestResponseFormat: string = "gen_ai.openai.request.response_format";
27
- /** Frozen legacy wire key; removed from semconv (no openai.* successor at 1.43). */
28
- #deprecated "Removed upstream; frozen for contract compatibility."
29
- const OpenaiRequestSeed: string = "gen_ai.openai.request.seed";
30
- /** Frozen legacy wire key; renamed upstream to openai.request.service_tier. */
31
- #deprecated "Renamed upstream to openai.request.service_tier; frozen for contract compatibility."
32
- const OpenaiRequestServiceTier: string = "gen_ai.openai.request.service_tier";
33
- /** Frozen legacy wire key; renamed upstream to openai.response.service_tier. */
34
- #deprecated "Renamed upstream to openai.response.service_tier; frozen for contract compatibility."
35
- const OpenaiResponseServiceTier: string = "gen_ai.openai.response.service_tier";
36
- /** Frozen legacy wire key; renamed upstream to openai.response.system_fingerprint. */
37
- #deprecated "Renamed upstream to openai.response.system_fingerprint; frozen for contract compatibility."
38
- const OpenaiResponseSystemFingerprint: string = "gen_ai.openai.response.system_fingerprint";
39
- /** Frozen legacy wire key; removed from semconv (replaced by gen_ai.input.messages). */
40
- #deprecated "Removed upstream; frozen for contract compatibility."
41
- const Prompt: string = "gen_ai.prompt";
42
- /** Frozen legacy wire key; removed from semconv (replaced by gen_ai.provider.name). */
43
- #deprecated "Replaced by gen_ai.provider.name; frozen for contract compatibility."
44
- const System: string = "gen_ai.system";
45
- /** Frozen legacy wire key; removed from semconv (replaced by gen_ai.usage.output_tokens). */
46
- #deprecated "Replaced by gen_ai.usage.output_tokens; frozen for contract compatibility."
47
- const UsageCompletionTokens: string = "gen_ai.usage.completion_tokens";
48
- /** Frozen legacy wire key; removed from semconv (replaced by gen_ai.usage.input_tokens). */
49
- #deprecated "Replaced by gen_ai.usage.input_tokens; frozen for contract compatibility."
50
- const UsagePromptTokens: string = "gen_ai.usage.prompt_tokens";
51
- }