@morehao/trendradar-contract 0.7.0 → 0.7.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/CHANGELOG.md +12 -0
- package/README.md +5 -5
- package/gen/ts/index.d.ts +2 -0
- package/gen/ts/index.js +10 -2
- package/package.json +1 -1
- package/schema/api.v2.yaml +1 -1
- package/schema/ipc.v4.json +8 -0
- package/version-map.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to `@morehao/trendradar-contract` are documented here.
|
|
4
4
|
This project adheres to a `contract/vX.Y.Z` tag per release (npm + Go submodule).
|
|
5
5
|
|
|
6
|
+
## 0.7.1
|
|
7
|
+
|
|
8
|
+
Additive, non-breaking. `Usage` gains two optional fields so the plugin can
|
|
9
|
+
show which model actually produced a run when a fallback chain is configured.
|
|
10
|
+
Wire integers unchanged (`ipcSchema=4`, `digestSchema=3`).
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `Usage.usedModel?: string` — the model that produced the run's summaries
|
|
14
|
+
(the primary when it succeeded, a fallback when one took over; absent when
|
|
15
|
+
every model failed and summaries degraded to the original text).
|
|
16
|
+
- `Usage.usedProvider?: string` — the vendor backing `usedModel`, when known.
|
|
17
|
+
|
|
6
18
|
## 0.7.0
|
|
7
19
|
|
|
8
20
|
Language-neutral summaries. **Breaking wire bump**: `ipcSchema` 3 → 4,
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @morehao/trendradar-contract (0.7.
|
|
1
|
+
# @morehao/trendradar-contract (0.7.1)
|
|
2
2
|
|
|
3
3
|
The single source of truth for the data shapes shared by the **trendradar Go
|
|
4
4
|
core** (`github.com/morehao/trendradar`) and the **DSH plugin**
|
|
@@ -12,7 +12,7 @@ artifacts from one tag:
|
|
|
12
12
|
|
|
13
13
|
Both are released together by the tag `contract/v0.Y.Z` (see `CHANGELOG.md`).
|
|
14
14
|
|
|
15
|
-
> Version model: the **package** is `0.7.
|
|
15
|
+
> Version model: the **package** is `0.7.1`, while the
|
|
16
16
|
> **wire format** it carries is the fourth generation — `ipcSchema=4`,
|
|
17
17
|
> `digestSchema=3`. The integers distinguish this contract from the legacy
|
|
18
18
|
> in-repo v1, the pre-inline `ipcSchema=2`, and the pre-language `ipcSchema=3`;
|
|
@@ -21,8 +21,8 @@ Both are released together by the tag `contract/v0.Y.Z` (see `CHANGELOG.md`).
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm i @morehao/trendradar-contract@0.7.
|
|
25
|
-
go get github.com/morehao/trendradar/contract@v0.7.
|
|
24
|
+
npm i @morehao/trendradar-contract@0.7.1
|
|
25
|
+
go get github.com/morehao/trendradar/contract@v0.7.1 # resolves tag contract/v0.7.1
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Layout
|
|
@@ -63,7 +63,7 @@ contract.SchemaFS // embedded schema/* files
|
|
|
63
63
|
## Versioning & compatibility
|
|
64
64
|
|
|
65
65
|
- `ipcSchema` (const 4) and `digestSchema` (const 3) are the wire integers;
|
|
66
|
-
`contractVersion` (`"0.7.
|
|
66
|
+
`contractVersion` (`"0.7.1"`) is the package handshake.
|
|
67
67
|
- Adding an **optional** field is a minor change. Removing/renaming a field,
|
|
68
68
|
changing a type, or tightening validation is **breaking**: bump the affected
|
|
69
69
|
wire integer and/or the package version, declared in `version-map.json`.
|
package/gen/ts/index.d.ts
CHANGED
package/gen/ts/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import Ajv from 'ajv/dist/2020.js'
|
|
3
3
|
import addFormats from 'ajv-formats'
|
|
4
4
|
|
|
5
|
-
export const contractVersion = "0.7.
|
|
5
|
+
export const contractVersion = "0.7.1"
|
|
6
6
|
|
|
7
7
|
export const errorCatalog = {
|
|
8
8
|
"INTERNAL": {
|
|
@@ -1626,6 +1626,14 @@ const ipc = {
|
|
|
1626
1626
|
"cacheHits": {
|
|
1627
1627
|
"type": "integer",
|
|
1628
1628
|
"minimum": 0
|
|
1629
|
+
},
|
|
1630
|
+
"usedModel": {
|
|
1631
|
+
"type": "string",
|
|
1632
|
+
"description": "The model that actually served this run. For a model.fallbacks chain this is the name of the member that produced the most recent successful completion (the primary when it worked, otherwise the first backup that did); empty when nothing is known (e.g. strict single-model runs that do not report it, or a run where no completion succeeded). Optional and additive: older consumers ignore it."
|
|
1633
|
+
},
|
|
1634
|
+
"usedProvider": {
|
|
1635
|
+
"type": "string",
|
|
1636
|
+
"description": "The provider (vendor) backing usedModel, when known. Optional and additive: older consumers ignore it."
|
|
1629
1637
|
}
|
|
1630
1638
|
}
|
|
1631
1639
|
},
|
|
@@ -2549,7 +2557,7 @@ const errors = {
|
|
|
2549
2557
|
}
|
|
2550
2558
|
}
|
|
2551
2559
|
}
|
|
2552
|
-
const api = "openapi: 3.1.0\ninfo:\n title: trendradar serve API\n version: 0.7.
|
|
2560
|
+
const api = "openapi: 3.1.0\ninfo:\n title: trendradar serve API\n version: 0.7.1\n description: |\n Read-only HTTP surface exposed by `trendradar serve`. All payloads reuse the\n contract schemas, so the plugin and any web UI consume the same shapes\n whether data comes from the filesystem or over HTTP. Historical v1 digests\n read from disk are normalized to the v2 shape with\n contentHashAlgo=legacy-struct-marshal-v1.\n\n Release endpoints are read-only. Token cost for a releases run is NOT part of\n a stored document (it describes one run and cannot be reproduced); it is\n reported in `releases.usage` of `trendradar run --json` and appended to\n `<repo>/.git/trendradar-usage.jsonl` with stage=\"releases\".\nservers:\n - url: http://127.0.0.1:8787\npaths:\n /api/v2/digests/{date}:\n get:\n operationId: getDigest\n summary: Fetch one day's digest\n parameters:\n - name: date\n in: path\n required: true\n schema:\n type: string\n format: date\n responses:\n \"200\":\n description: The digest document\n content:\n application/json:\n schema:\n $ref: \"./digest.v2.json\"\n \"404\":\n description: No digest for that date\n /api/v2/manifest:\n get:\n operationId: getManifest\n summary: List available dates and their content identity\n responses:\n \"200\":\n description: Manifest of available digests\n content:\n application/json:\n schema:\n type: object\n required: [entries]\n properties:\n coreVersion:\n type: string\n entries:\n type: array\n items:\n type: object\n required: [date, contentHash, schema, contentHashAlgo]\n properties:\n date:\n type: string\n format: date\n contentHash:\n type: string\n schema:\n type: integer\n contentHashAlgo:\n type: string\n enum: [jcs-sha256-v1, legacy-struct-marshal-v1]\n degraded:\n type: boolean\n /api/v2/releases:\n get:\n operationId: listReleases\n summary: List available release digests (newest first)\n description: |\n Returns an empty array (not 404) when no release digest exists yet.\n Entries carry no token cost because stored documents do not record it.\n parameters:\n - name: period\n in: query\n required: false\n schema:\n type: string\n enum: [daily, weekly, monthly]\n responses:\n \"200\":\n description: Manifest of release digests\n content:\n application/json:\n schema:\n type: array\n items:\n $ref: \"./releases.v2.json#/$defs/ReleaseManifestEntry\"\n /api/v2/releases/{date}:\n get:\n operationId: getReleases\n summary: Fetch one period's release digest\n parameters:\n - name: date\n in: path\n required: true\n schema:\n type: string\n format: date\n - name: period\n in: query\n required: false\n schema:\n type: string\n enum: [daily, weekly, monthly]\n responses:\n \"200\":\n description: The release digest document\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json\"\n \"404\":\n description: No release digest for that date\n /api/v2/subscriptions:\n get:\n operationId: listSubscriptions\n summary: List the repo subscriptions the core will poll\n description: |\n Read-only mirror of the IPC `subscribe list` command: both return the\n same SubscriptionList. `repos` is the legacy field; `items` adds the\n per-repo row detail (latest tag, last summary date, check status) and is\n optional, so an older core still satisfies this schema. Writing\n subscriptions stays on the CLI / IPC subscribe command and is never\n exposed over HTTP.\n responses:\n \"200\":\n description: Current subscription list\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json#/$defs/SubscriptionList\"\n /api/v2/repos/{owner}/{repo}/releases:\n get:\n operationId: getSubscriptionDoc\n summary: Read one repo's release document\n description: |\n Read-only mirror of the IPC `subscribe releases` command. Returns the\n exact markdown file content (plus the volume index) so a client renders\n what the data repo stores instead of re-summarizing it. `volume`\n defaults to the newest volume. Only repos matching\n ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ are served: the path is resolved\n inside the releases document root and never escapes it.\n parameters:\n - name: owner\n in: path\n required: true\n schema:\n type: string\n pattern: \"^[A-Za-z0-9_.-]+$\"\n - name: repo\n in: path\n required: true\n schema:\n type: string\n pattern: \"^[A-Za-z0-9_.-]+$\"\n - name: volume\n in: query\n required: false\n schema:\n type: integer\n minimum: 1\n responses:\n \"200\":\n description: The repo's release document\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json#/$defs/SubscriptionDoc\"\n \"400\":\n description: Malformed owner/repo or non-positive volume\n \"404\":\n description: The repo has no release document, or that volume is absent\n /feed.xml:\n get:\n operationId: getFeed\n summary: RSS feed of the most recent digests\n responses:\n \"200\":\n description: RSS 2.0 feed\n content:\n application/rss+xml:\n schema:\n type: string\n"
|
|
2553
2561
|
|
|
2554
2562
|
export const rawSchema = { model, ipc, digest, releases, errors, versionInfo, api }
|
|
2555
2563
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morehao/trendradar-contract",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Language-neutral contract (JSON Schema, fixtures, generated Go & TypeScript types) shared by the trendradar Go core and its DSH plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/schema/api.v2.yaml
CHANGED
package/schema/ipc.v4.json
CHANGED
|
@@ -524,6 +524,14 @@
|
|
|
524
524
|
"cacheHits": {
|
|
525
525
|
"type": "integer",
|
|
526
526
|
"minimum": 0
|
|
527
|
+
},
|
|
528
|
+
"usedModel": {
|
|
529
|
+
"type": "string",
|
|
530
|
+
"description": "The model that actually served this run. For a model.fallbacks chain this is the name of the member that produced the most recent successful completion (the primary when it worked, otherwise the first backup that did); empty when nothing is known (e.g. strict single-model runs that do not report it, or a run where no completion succeeded). Optional and additive: older consumers ignore it."
|
|
531
|
+
},
|
|
532
|
+
"usedProvider": {
|
|
533
|
+
"type": "string",
|
|
534
|
+
"description": "The provider (vendor) backing usedModel, when known. Optional and additive: older consumers ignore it."
|
|
527
535
|
}
|
|
528
536
|
}
|
|
529
537
|
},
|
package/version-map.json
CHANGED
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
},
|
|
27
27
|
"version-info.v2.json": {
|
|
28
28
|
"wireKey": "contractVersion",
|
|
29
|
-
"current": "0.7.
|
|
29
|
+
"current": "0.7.1",
|
|
30
30
|
"breakingBump": [
|
|
31
31
|
"packageMajor"
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
"api.v2.yaml": {
|
|
35
35
|
"wireKey": "info.version",
|
|
36
|
-
"current": "0.7.
|
|
36
|
+
"current": "0.7.1",
|
|
37
37
|
"breakingBump": [
|
|
38
38
|
"packageMajor"
|
|
39
39
|
]
|