@ancplua/qyl-api-schema 0.2.1 → 0.2.3

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
@@ -9,11 +9,12 @@ owned by qyl.
9
9
  ## Contract pipeline
10
10
 
11
11
  ```text
12
- open-telemetry/semantic-conventions @ v1.41.0
12
+ open-telemetry/semantic-conventions @ v1.43.0 + semantic-conventions-genai (dev registry)
13
13
  |
14
- | Weaver
14
+ | Weaver (Qyl.OpenTelemetry.SemanticConventions repo:
15
+ | generate.sh -> resolved-registry.json -> emit_typespec_keys.py)
15
16
  v
16
- @ancplua/typespec-otel-semconv
17
+ generated/otel-keys.gen.tsp (+ generated/otel-keys-legacy.tsp, hand-frozen wire keys)
17
18
  |
18
19
  | TypeSpec import / lockstep key projection
19
20
  v
@@ -27,10 +28,13 @@ OpenAPI JSON + JSON Schema + Qyl.Api.Contracts + TS contract types
27
28
  qyl services, dashboard, tools, and generated clients
28
29
  ```
29
30
 
30
- The generic OpenTelemetry key projection lives in
31
- `@ancplua/typespec-otel-semconv` under
32
- `ANcpLua.OpenTelemetry.SemanticConventions.Keys.*`. This repo defines qyl domain
33
- models, routes, and response contracts under `Qyl.Api.Contracts.*`.
31
+ The generic OpenTelemetry key projection is the checked-in
32
+ `generated/otel-keys.gen.tsp` under
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).
36
+ This repo defines qyl domain models, routes, and response contracts under
37
+ `Qyl.Api.Contracts.*`.
34
38
 
35
39
  ## Published artifacts
36
40
 
@@ -84,6 +88,10 @@ npm run compile
84
88
 
85
89
  ## Publishing
86
90
 
87
- During normal operation, GitHub Releases publish npm and NuGet artifacts in lockstep. When GitHub
88
- Actions is unavailable, publish manually from locally verified artifacts using package tokens passed
89
- through environment variables. Never print tokens and never commit credentials.
91
+ Publishing is fully automated via GitHub Actions OIDC **trusted publishing** no stored secrets, no
92
+ API keys. Publish a GitHub Release whose tag is `vMAJOR.MINOR.PATCH[-prerelease]`; `publish.yml` then,
93
+ all-or-nothing, packs and validates the artifacts, stamps that single tag-derived version onto both,
94
+ pushes `Qyl.Api.Contracts` to nuget.org (NuGet/login OIDC) and publishes `@ancplua/qyl-api-schema` to
95
+ npmjs.org (npm trusted publishing + provenance). NuGet pushes first (idempotent) and npm last
96
+ (immutable), so a partial failure re-runs cleanly. See [VERSIONING.md](VERSIONING.md) for how the
97
+ version is derived from the tag. There are no long-lived publish tokens to manage or rotate.
package/VERSIONING.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
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
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
+
5
15
  ## Where it is used
6
16
 
7
17
  - `models/genai.tsp` for GenAI semantic-convention shaped models
@@ -1,14 +1,23 @@
1
1
  # generated
2
2
 
3
- This directory holds Weaver-generated TypeSpec files. **Do not edit by hand.**
3
+ This directory holds the semconv TypeSpec key projection and the emitter
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.
4
7
 
5
8
  ## Files
6
9
 
7
10
  | File | Source | Regenerate via |
8
11
  | --- | --- | --- |
9
- | `otel-keys.gen.tsp` | OpenTelemetry semantic-conventions v1.41.0 YAML model, converted by the upstream generator [`ANcpLua/typespec-otel-semconv`](https://github.com/ANcpLua/typespec-otel-semconv) (Weaver-based) | Re-run that generator's pipeline (`scripts/generate.mjs`) and replace this checked-in TypeSpec projection. Lockstep flip planned: this directory becomes a dep on `@ancplua/typespec-otel-semconv@<semconv-version>-<N>` and stops being a checked-in artifact. |
12
+ | `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). |
10
14
 
11
- ## What `otel-keys.gen.tsp` provides
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
+
20
+ ## What the key files provide
12
21
 
13
22
  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.
14
23
 
@@ -17,10 +26,18 @@ One TypeSpec namespace per OpenTelemetry root group, each declaring `const <Name
17
26
  system?: string;
18
27
  ```
19
28
 
20
- Deprecated upstream attributes are emitted with `#deprecated "..."` so models that reference them produce a TypeSpec compiler warning matching upstream's own deprecation notes.
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
30
 
22
31
  ## Pin
23
32
 
24
- The checked-in projection is pinned to upstream OpenTelemetry semantic-conventions v1.41.0.
25
-
26
- Bumping the pin requires regenerating this file from the upstream YAML model with Weaver — done in [`ANcpLua/typespec-otel-semconv`](https://github.com/ANcpLua/typespec-otel-semconv) — before updating this repository. Direction is one-way: this repo never invokes Weaver directly.
33
+ The checked-in projection is pinned to core semantic-conventions **v1.43.0**
34
+ (commit in the file header) plus the GenAI dev registry commit pinned in the
35
+ SemanticConventions repo's `generate.sh` (`SEMCONV_GENAI_REF`). The
36
+ `VerifyKeysLockstep` Nuke target asserts the header pin matches the
37
+ `OtelKeysVersion` parameter (`.nuke/parameters.json`).
38
+
39
+ Bumping the pin: update the refs in that repo's `generate.sh`, re-run it plus
40
+ `emit_typespec_keys.py --write`, replace this checked-in projection, and keep
41
+ `SemConvSchemaVersion` in that repo's `Version.props` in lockstep — the .NET
42
+ constants and this TypeSpec projection must cite the same registry versions.
43
+ Direction is one-way: this repo never invokes Weaver directly.
@@ -0,0 +1,51 @@
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
+ }