@morehao/trendradar-contract 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morehao/trendradar-contract",
3
- "version": "0.6.0",
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",
@@ -1,7 +1,7 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
3
  title: trendradar serve API
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  description: |
6
6
  Read-only HTTP surface exposed by `trendradar serve`. All payloads reuse the
7
7
  contract schemas, so the plugin and any web UI consume the same shapes
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/morehao/trendradar/contract/schema/digest.v2.json",
4
- "title": "trendradar digest v2",
3
+ "$id": "https://github.com/morehao/trendradar/contract/schema/digest.v3.json",
4
+ "title": "trendradar digest v3",
5
5
  "description": "One day's rendered digest document. contentHash is stable across runs (generatedAt/coreVersion excluded); contentHashAlgo records which algorithm produced it.",
6
6
  "type": "object",
7
7
  "additionalProperties": true,
8
8
  "required": ["schema", "date", "period", "languages", "count", "degraded", "contentHash", "contentHashAlgo", "repos"],
9
9
  "properties": {
10
- "schema": { "const": 2 },
10
+ "schema": { "const": 3 },
11
11
  "date": { "type": "string", "format": "date" },
12
12
  "period": { "type": "string", "enum": ["daily", "weekly", "monthly"] },
13
13
  "languages": { "type": "array", "minItems": 1, "items": { "type": "string" } },
@@ -19,7 +19,7 @@
19
19
  "generatedAt": { "type": "string", "format": "date-time" },
20
20
  "repos": {
21
21
  "type": "array",
22
- "items": { "$ref": "model.v2.json#/$defs/RepoDigest" }
22
+ "items": { "$ref": "model.v3.json#/$defs/RepoDigest" }
23
23
  }
24
24
  }
25
25
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/morehao/trendradar/contract/schema/ipc.v3.json",
4
- "title": "trendradar ipc v3",
5
- "description": "Envelope exchanged between the trendradar core binary and the DSH plugin. Only RunRequest forbids extra fields. ipcSchema is const 3.",
3
+ "$id": "https://github.com/morehao/trendradar/contract/schema/ipc.v4.json",
4
+ "title": "trendradar ipc v4",
5
+ "description": "Envelope exchanged between the trendradar core binary and the DSH plugin. Only RunRequest forbids extra fields. ipcSchema is const 4.",
6
6
  "oneOf": [
7
7
  {
8
8
  "$ref": "#/$defs/RunRequest"
@@ -117,7 +117,7 @@
117
117
  ],
118
118
  "properties": {
119
119
  "ipcSchema": {
120
- "const": 3
120
+ "const": 4
121
121
  },
122
122
  "command": {
123
123
  "type": "string",
@@ -403,7 +403,7 @@
403
403
  ],
404
404
  "properties": {
405
405
  "ipcSchema": {
406
- "const": 3
406
+ "const": 4
407
407
  },
408
408
  "ok": {
409
409
  "type": "boolean"
@@ -465,13 +465,13 @@
465
465
  "$ref": "#/$defs/Usage"
466
466
  },
467
467
  "releases": {
468
- "$ref": "releases.v2.json#/$defs/ReleasesReport"
468
+ "$ref": "releases.v3.json#/$defs/ReleasesReport"
469
469
  },
470
470
  "subscriptions": {
471
- "$ref": "releases.v2.json#/$defs/SubscriptionList"
471
+ "$ref": "releases.v3.json#/$defs/SubscriptionList"
472
472
  },
473
473
  "subscriptionDoc": {
474
- "$ref": "releases.v2.json#/$defs/SubscriptionDoc"
474
+ "$ref": "releases.v3.json#/$defs/SubscriptionDoc"
475
475
  }
476
476
  }
477
477
  },
@@ -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
  },
@@ -561,7 +569,7 @@
561
569
  ],
562
570
  "properties": {
563
571
  "ipcSchema": {
564
- "const": 3
572
+ "const": 4
565
573
  },
566
574
  "stateSchema": {
567
575
  "const": 3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/morehao/trendradar/contract/schema/model.v2.json",
4
- "title": "trendradar model v2",
3
+ "$id": "https://github.com/morehao/trendradar/contract/schema/model.v3.json",
4
+ "title": "trendradar model v3",
5
5
  "description": "Domain model: a scraped repository snapshot (RepoSnapshot) and its digested form (RepoDigest). RepoDigest composes RepoSnapshot via allOf instead of flattening.",
6
6
  "$ref": "#/$defs/RepoDigest",
7
7
  "$defs": {
@@ -28,9 +28,10 @@
28
28
  {
29
29
  "type": "object",
30
30
  "additionalProperties": true,
31
- "required": ["summaryZh", "summarySource"],
31
+ "required": ["summary", "summaryLang", "summarySource"],
32
32
  "properties": {
33
- "summaryZh": { "type": "string" },
33
+ "summary": { "type": "string" },
34
+ "summaryLang": { "type": "string" },
34
35
  "summarySource": { "type": "string", "enum": ["model", "original"] }
35
36
  }
36
37
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/morehao/trendradar/contract/schema/releases.v2.json",
4
- "title": "trendradar releases v2",
5
- "description": "Repo release subscription documents. ReleaseDigest is the rendered on-disk document; ReleasesReport is the per-run diagnostic carried in RunResult.releases. Token cost lives in ReleasesReport.usage (always present), never in ReleaseDigest, because cost is a property of one run and cannot be reproduced from a stored document. schema=2 adds the per-repo weekly batch summary (repos[].summaryZh + periodStart/periodEnd); the per-item summaryZh stays readable for old documents but is no longer written.",
3
+ "$id": "https://github.com/morehao/trendradar/contract/schema/releases.v3.json",
4
+ "title": "trendradar releases v3",
5
+ "description": "Repo release subscription documents. ReleaseDigest is the rendered on-disk document; ReleasesReport is the per-run diagnostic carried in RunResult.releases. Token cost lives in ReleasesReport.usage (always present), never in ReleaseDigest, because cost is a property of one run and cannot be reproduced from a stored document. Older documents put one weekly summary per repo (repos[].summary); schema 3 cores write a per-version summary on each repos[].releases[].summary instead, and leave repos[].summary empty on new data (carrying summaryLang when non-empty). Both fields stay optional (readable old + new documents): consumers should prefer the per-item summary and fall back to the repo-level one for older documents.",
6
6
  "type": "object",
7
7
  "additionalProperties": true,
8
8
  "required": [
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "properties": {
19
19
  "schema": {
20
- "const": 2
20
+ "const": 3
21
21
  },
22
22
  "date": {
23
23
  "type": "string",
@@ -66,7 +66,7 @@
66
66
  "ReleaseItem": {
67
67
  "type": "object",
68
68
  "additionalProperties": true,
69
- "description": "One release or tag. kind distinguishes a GitHub release (has notes) from a tag fallback (commit message used as the summary basis). summaryZh is optional and no longer written by schema 2: the summary now lives once per repo per week in RepoReleases.summaryZh.",
69
+ "description": "One release or tag. kind distinguishes a GitHub release (has notes) from a tag fallback (commit message used as the summary basis). summary is this version's own summary in the configured output language, written per version by current cores (incremental). It stays optional so old documents (which only carry the repo-level RepoReleases.summary) remain valid; consumers should prefer this field and fall back to RepoReleases.summary.",
70
70
  "required": [
71
71
  "id",
72
72
  "tag",
@@ -114,9 +114,9 @@
114
114
  "type": "string",
115
115
  "description": "Truncated raw release notes. Untrusted text: display only, never execute."
116
116
  },
117
- "summaryZh": {
117
+ "summary": {
118
118
  "type": "string",
119
- "description": "Legacy per-item summary. Still accepted so documents written before schema 2 stay readable; schema 2 writers leave it empty."
119
+ "description": "This version's own summary in the configured output language (model or original text). Optional: older documents only carry the repo-level summary, and consumers should prefer this field and fall back to RepoReleases.summary."
120
120
  },
121
121
  "summarySource": {
122
122
  "type": "string",
@@ -130,7 +130,7 @@
130
130
  "RepoReleases": {
131
131
  "type": "object",
132
132
  "additionalProperties": true,
133
- "description": "One repo's release batch for one summary period. summaryZh covers the whole week in a single model call; periodStart/periodEnd bound that week so a consumer can label it without parsing dates.",
133
+ "description": "One repo's release batch for one summary period. periodStart/periodEnd bound the period (attributed to the versions' publish dates) so a consumer can label it without parsing dates. summary (repo-level, whole-week) plus optional summaryLang is kept for backward compatibility: current cores summarize per version (releases[].summary) and usually leave this empty on new data.",
134
134
  "required": [
135
135
  "fullName",
136
136
  "url",
@@ -162,9 +162,13 @@
162
162
  "type": "string",
163
163
  "format": "date"
164
164
  },
165
- "summaryZh": {
165
+ "summary": {
166
166
  "type": "string",
167
- "description": "One Chinese summary for every version in this period. Empty when no summary was produced."
167
+ "description": "Optional repo-level summary for the whole period. Current cores summarize per version (releases[].summary) and usually leave this empty. Kept optional for older documents; consumers should prefer releases[].summary and fall back to this."
168
+ },
169
+ "summaryLang": {
170
+ "type": "string",
171
+ "description": "BCP47 language of the repo-level summary above; present only when summary is. Item-level summaries inherit this / the configured output language."
168
172
  },
169
173
  "releases": {
170
174
  "type": "array",
@@ -240,7 +244,7 @@
240
244
  "minimum": 0
241
245
  },
242
246
  "usage": {
243
- "$ref": "ipc.v3.json#/$defs/Usage"
247
+ "$ref": "ipc.v4.json#/$defs/Usage"
244
248
  }
245
249
  }
246
250
  },
@@ -2,15 +2,15 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://github.com/morehao/trendradar/contract/schema/version-info.v2.json",
4
4
  "title": "trendradar version info v2",
5
- "description": "Handshake payload returned by `trendradar version --json`. The plugin requires ipcSchema===3 && digestSchema===2 && contractVersion major===0.",
5
+ "description": "Handshake payload returned by `trendradar version --json`. The plugin requires ipcSchema===4 && digestSchema===3 && contractVersion major===0.",
6
6
  "type": "object",
7
7
  "additionalProperties": true,
8
8
  "required": ["version", "commit", "ipcSchema", "digestSchema", "contractVersion", "supportedProviders"],
9
9
  "properties": {
10
10
  "version": { "type": "string" },
11
11
  "commit": { "type": "string" },
12
- "ipcSchema": { "const": 3 },
13
- "digestSchema": { "const": 2 },
12
+ "ipcSchema": { "const": 4 },
13
+ "digestSchema": { "const": 3 },
14
14
  "contractVersion": { "type": "string" },
15
15
  "supportedProviders": { "type": "array", "items": { "type": "string" } }
16
16
  }
package/version-map.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
- "digest.v2.json": {
2
+ "digest.v3.json": {
3
3
  "wireKey": "digestSchema",
4
- "current": 2,
4
+ "current": 3,
5
5
  "breakingBump": [
6
6
  "digestSchema",
7
7
  "packageMajor"
8
8
  ]
9
9
  },
10
- "model.v2.json": {
10
+ "model.v3.json": {
11
11
  "wireKey": null,
12
- "current": 2,
12
+ "current": 3,
13
13
  "propagatesTo": [
14
14
  "digestSchema"
15
15
  ],
@@ -26,29 +26,29 @@
26
26
  },
27
27
  "version-info.v2.json": {
28
28
  "wireKey": "contractVersion",
29
- "current": "0.6.0",
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.6.0",
36
+ "current": "0.7.1",
37
37
  "breakingBump": [
38
38
  "packageMajor"
39
39
  ]
40
40
  },
41
- "releases.v2.json": {
41
+ "releases.v3.json": {
42
42
  "wireKey": null,
43
- "current": 2,
43
+ "current": 3,
44
44
  "propagatesTo": [],
45
45
  "breakingBump": [
46
46
  "packageMajor"
47
47
  ]
48
48
  },
49
- "ipc.v3.json": {
49
+ "ipc.v4.json": {
50
50
  "wireKey": "ipcSchema",
51
- "current": 3,
51
+ "current": 4,
52
52
  "breakingBump": [
53
53
  "ipcSchema",
54
54
  "packageMajor"