@morehao/trendradar-contract 0.4.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -3,9 +3,33 @@
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
- ## Unreleased
6
+ ## 0.6.0
7
7
 
8
- _Nothing yet._
8
+ Digest inlined in `RunResult`. **Breaking wire bump**: `ipcSchema` 2 → 3
9
+ (`digestSchema` stays 2). A core/plugin pair must both move to this contract
10
+ line; the plugin's handshake hard-rejects the mismatch.
11
+
12
+ ### Added
13
+ - `RunResult.digest` (optional): the digest document this run rendered —
14
+ `{ path, bytes, sha256, text }`. `bytes`/`sha256` describe `text`'s UTF-8 bytes
15
+ exactly as written to `path`; `text` is capped at 1 MiB.
16
+ Present whenever the digest stage rendered a document (including
17
+ `skipped=unchanged` and the `merged` / `pr-closed` early exits, which render
18
+ before the PR pre-check); absent for dry runs, release-only runs, and failures
19
+ before rendering. Consumers no longer need to read the output repository to
20
+ display the digest.
21
+
22
+ ## 0.5.0
23
+
24
+ Single-repo release analysis. Wire integers unchanged (`ipcSchema = 2` /
25
+ `digestSchema = 2`); additive at the envelope level, so a plugin/core built
26
+ against 0.4.0 keeps working.
27
+
28
+ ### Added
29
+ - `RunRequest.command=run` may now carry `repo`: with `stages` including
30
+ `releases`, the run analyzes only that one subscribed repository's releases.
31
+ `repo` requires `stages` to contain `releases`; `run` still must not carry
32
+ `action`/`volume`. `serve`/`config`/`version` still must not carry `repo`.
9
33
 
10
34
  ## 0.4.0
11
35
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @morehao/trendradar-contract (0.4.0)
1
+ # @morehao/trendradar-contract (0.6.0)
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,16 +12,17 @@ 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.4.0`, while the
16
- > **wire format** it carries is the second generation — `ipcSchema=2`,
17
- > `digestSchema=2`. The integers 2 distinguish this contract from the legacy
18
- > in-repo v1; they are intentionally decoupled from the package semver.
15
+ > Version model: the **package** is `0.6.0`, while the
16
+ > **wire format** it carries is the third generation — `ipcSchema=3`,
17
+ > `digestSchema=2`. The integers distinguish this contract from the legacy
18
+ > in-repo v1 and the pre-inline `ipcSchema=2`; they are intentionally decoupled
19
+ > from the package semver.
19
20
 
20
21
  ## Install
21
22
 
22
23
  ```bash
23
- npm i @morehao/trendradar-contract@0.4.0
24
- go get github.com/morehao/trendradar/contract@v0.4.0 # resolves tag contract/v0.4.0
24
+ npm i @morehao/trendradar-contract@0.6.0
25
+ go get github.com/morehao/trendradar/contract@v0.6.0 # resolves tag contract/v0.6.0
25
26
  ```
26
27
 
27
28
  ## Layout
@@ -29,7 +30,7 @@ go get github.com/morehao/trendradar/contract@v0.4.0 # resolves tag contract/v
29
30
  | Path | Purpose |
30
31
  |---|---|
31
32
  | `schema/model.v2.json` | `RepoSnapshot`; `RepoDigest` composes it via `allOf` |
32
- | `schema/ipc.v2.json` | `RunRequest` (strict), `RunResult`, `ErrorInfo`, `State`, `FileArtifact` |
33
+ | `schema/ipc.v3.json` | `RunRequest` (strict), `RunResult` (incl. inlined `DigestArtifact`), `ErrorInfo`, `State`, `FileArtifact` |
33
34
  | `schema/digest.v2.json` | rendered digest document, incl. `contentHashAlgo` |
34
35
  | `schema/releases.v2.json` | release-subscription document + `ReleasesReport` (run cost) |
35
36
  | `schema/errors.v2.json` | 17 error codes with `retriable`/`description` (single source of truth) |
package/gen/ts/index.d.ts CHANGED
@@ -36,8 +36,16 @@ export interface FileArtifact {
36
36
  [k: string]: unknown;
37
37
  }
38
38
 
39
+ export interface DigestArtifact {
40
+ "path": string;
41
+ "bytes": number;
42
+ "sha256": string;
43
+ "text": string;
44
+ [k: string]: unknown;
45
+ }
46
+
39
47
  export interface RunRequest {
40
- "ipcSchema": 2;
48
+ "ipcSchema": 3;
41
49
  "command": "run" | "serve" | "config" | "version" | "subscribe";
42
50
  "configPath"?: string;
43
51
  "date"?: string;
@@ -50,13 +58,14 @@ export interface RunRequest {
50
58
  }
51
59
 
52
60
  export interface RunResult {
53
- "ipcSchema": 2;
61
+ "ipcSchema": 3;
54
62
  "ok": boolean;
55
63
  "command": "run" | "serve" | "config" | "version" | "subscribe";
56
64
  "startedAt": string;
57
65
  "finishedAt": string;
58
66
  "skipped": boolean;
59
67
  "files": Array<FileArtifact>;
68
+ "digest"?: DigestArtifact;
60
69
  "branch"?: string;
61
70
  "commit"?: string;
62
71
  "prUrl"?: string;
@@ -92,8 +101,8 @@ export interface StateRun {
92
101
  }
93
102
 
94
103
  export interface State {
95
- "ipcSchema": 2;
96
- "stateSchema": 2;
104
+ "ipcSchema": 3;
105
+ "stateSchema": 3;
97
106
  "lastRun"?: StateRun;
98
107
  [k: string]: unknown;
99
108
  }
@@ -225,7 +234,7 @@ export interface ReleaseDigest {
225
234
  export interface VersionInfo {
226
235
  "version": string;
227
236
  "commit": string;
228
- "ipcSchema": 2;
237
+ "ipcSchema": 3;
229
238
  "digestSchema": 2;
230
239
  "contractVersion": string;
231
240
  "supportedProviders": Array<string>;
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.4.0"
5
+ export const contractVersion = "0.6.0"
6
6
 
7
7
  export const errorCatalog = {
8
8
  "INTERNAL": {
@@ -979,9 +979,9 @@ const model = {
979
979
  }
980
980
  const ipc = {
981
981
  "$schema": "https://json-schema.org/draft/2020-12/schema",
982
- "$id": "https://github.com/morehao/trendradar/contract/schema/ipc.v2.json",
983
- "title": "trendradar ipc v2",
984
- "description": "Envelope exchanged between the trendradar core binary and the DSH plugin. Only RunRequest forbids extra fields. ipcSchema is const 2.",
982
+ "$id": "https://github.com/morehao/trendradar/contract/schema/ipc.v3.json",
983
+ "title": "trendradar ipc v3",
984
+ "description": "Envelope exchanged between the trendradar core binary and the DSH plugin. Only RunRequest forbids extra fields. ipcSchema is const 3.",
985
985
  "oneOf": [
986
986
  {
987
987
  "$ref": "#/$defs/RunRequest"
@@ -1058,6 +1058,35 @@ const ipc = {
1058
1058
  }
1059
1059
  }
1060
1060
  },
1061
+ "DigestArtifact": {
1062
+ "type": "object",
1063
+ "additionalProperties": true,
1064
+ "description": "The digest document rendered by this run, inlined so the caller never reads the output repository. bytes/sha256 describe the UTF-8 bytes of text exactly as written to path.",
1065
+ "required": [
1066
+ "path",
1067
+ "bytes",
1068
+ "sha256",
1069
+ "text"
1070
+ ],
1071
+ "properties": {
1072
+ "path": {
1073
+ "type": "string"
1074
+ },
1075
+ "bytes": {
1076
+ "type": "integer",
1077
+ "minimum": 0,
1078
+ "maximum": 1048576
1079
+ },
1080
+ "sha256": {
1081
+ "type": "string",
1082
+ "pattern": "^sha256:[0-9a-f]{64}$"
1083
+ },
1084
+ "text": {
1085
+ "type": "string",
1086
+ "maxLength": 1048576
1087
+ }
1088
+ }
1089
+ },
1061
1090
  "RunRequest": {
1062
1091
  "type": "object",
1063
1092
  "additionalProperties": false,
@@ -1067,7 +1096,7 @@ const ipc = {
1067
1096
  ],
1068
1097
  "properties": {
1069
1098
  "ipcSchema": {
1070
- "const": 2
1099
+ "const": 3
1071
1100
  },
1072
1101
  "command": {
1073
1102
  "type": "string",
@@ -1103,7 +1132,8 @@ const ipc = {
1103
1132
  },
1104
1133
  "repo": {
1105
1134
  "type": "string",
1106
- "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
1135
+ "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
1136
+ "description": "command=subscribe: the target repo for action=add/remove/releases. command=run: with stages including 'releases', analyze only this repository's releases (absent = every subscribed repo)."
1107
1137
  },
1108
1138
  "volume": {
1109
1139
  "type": "integer",
@@ -1123,7 +1153,7 @@ const ipc = {
1123
1153
  }
1124
1154
  }
1125
1155
  },
1126
- "description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo; action=releases requires a repo and may name a volume. command=run may narrow its work with stages.",
1156
+ "description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo; action=releases requires a repo and may name a volume. command=run may narrow its work with stages; when stages includes 'releases', repo optionally restricts the release analysis to a single repository.",
1127
1157
  "allOf": [
1128
1158
  {
1129
1159
  "if": {
@@ -1229,7 +1259,57 @@ const ipc = {
1229
1259
  "properties": {
1230
1260
  "command": {
1231
1261
  "enum": [
1232
- "run",
1262
+ "run"
1263
+ ]
1264
+ }
1265
+ },
1266
+ "required": [
1267
+ "command"
1268
+ ]
1269
+ },
1270
+ "then": {
1271
+ "not": {
1272
+ "anyOf": [
1273
+ {
1274
+ "required": [
1275
+ "action"
1276
+ ]
1277
+ },
1278
+ {
1279
+ "required": [
1280
+ "volume"
1281
+ ]
1282
+ }
1283
+ ]
1284
+ },
1285
+ "allOf": [
1286
+ {
1287
+ "if": {
1288
+ "required": [
1289
+ "repo"
1290
+ ]
1291
+ },
1292
+ "then": {
1293
+ "required": [
1294
+ "stages"
1295
+ ],
1296
+ "properties": {
1297
+ "stages": {
1298
+ "contains": {
1299
+ "const": "releases"
1300
+ }
1301
+ }
1302
+ }
1303
+ }
1304
+ }
1305
+ ]
1306
+ }
1307
+ },
1308
+ {
1309
+ "if": {
1310
+ "properties": {
1311
+ "command": {
1312
+ "enum": [
1233
1313
  "serve",
1234
1314
  "config",
1235
1315
  "version"
@@ -1302,7 +1382,7 @@ const ipc = {
1302
1382
  ],
1303
1383
  "properties": {
1304
1384
  "ipcSchema": {
1305
- "const": 2
1385
+ "const": 3
1306
1386
  },
1307
1387
  "ok": {
1308
1388
  "type": "boolean"
@@ -1334,6 +1414,9 @@ const ipc = {
1334
1414
  "$ref": "#/$defs/FileArtifact"
1335
1415
  }
1336
1416
  },
1417
+ "digest": {
1418
+ "$ref": "#/$defs/DigestArtifact"
1419
+ },
1337
1420
  "branch": {
1338
1421
  "type": "string"
1339
1422
  },
@@ -1457,10 +1540,10 @@ const ipc = {
1457
1540
  ],
1458
1541
  "properties": {
1459
1542
  "ipcSchema": {
1460
- "const": 2
1543
+ "const": 3
1461
1544
  },
1462
1545
  "stateSchema": {
1463
- "const": 2
1546
+ "const": 3
1464
1547
  },
1465
1548
  "lastRun": {
1466
1549
  "$ref": "#/$defs/StateRun"
@@ -1785,7 +1868,7 @@ const releases = {
1785
1868
  "minimum": 0
1786
1869
  },
1787
1870
  "usage": {
1788
- "$ref": "https://github.com/morehao/trendradar/contract/schema/ipc.v2.json#/$defs/Usage"
1871
+ "$ref": "https://github.com/morehao/trendradar/contract/schema/ipc.v3.json#/$defs/Usage"
1789
1872
  }
1790
1873
  }
1791
1874
  },
@@ -1963,7 +2046,7 @@ const versionInfo = {
1963
2046
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1964
2047
  "$id": "https://github.com/morehao/trendradar/contract/schema/version-info.v2.json",
1965
2048
  "title": "trendradar version info v2",
1966
- "description": "Handshake payload returned by `trendradar version --json`. The plugin requires ipcSchema===2 && digestSchema===2 && contractVersion major===2.",
2049
+ "description": "Handshake payload returned by `trendradar version --json`. The plugin requires ipcSchema===3 && digestSchema===2 && contractVersion major===0.",
1967
2050
  "type": "object",
1968
2051
  "additionalProperties": true,
1969
2052
  "required": [
@@ -1982,7 +2065,7 @@ const versionInfo = {
1982
2065
  "type": "string"
1983
2066
  },
1984
2067
  "ipcSchema": {
1985
- "const": 2
2068
+ "const": 3
1986
2069
  },
1987
2070
  "digestSchema": {
1988
2071
  "const": 2
@@ -2002,7 +2085,7 @@ const errors = {
2002
2085
  "$schema": "https://json-schema.org/draft/2020-12/schema",
2003
2086
  "$id": "https://github.com/morehao/trendradar/contract/schema/errors.v2.json",
2004
2087
  "title": "trendradar errors v2",
2005
- "description": "Canonical error-code catalog. Each property is one error code whose retriable/description are consts, so this file is the single source of truth for retriability. ipc.v2.json ErrorCode enum must match these keys exactly.",
2088
+ "description": "Canonical error-code catalog. Each property is one error code whose retriable/description are consts, so this file is the single source of truth for retriability. ipc.v3.json ErrorCode enum must match these keys exactly.",
2006
2089
  "type": "object",
2007
2090
  "additionalProperties": false,
2008
2091
  "required": [
@@ -2339,7 +2422,7 @@ const errors = {
2339
2422
  }
2340
2423
  }
2341
2424
  }
2342
- const api = "openapi: 3.1.0\ninfo:\n title: trendradar serve API\n version: 0.4.0\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"
2425
+ const api = "openapi: 3.1.0\ninfo:\n title: trendradar serve API\n version: 0.6.0\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"
2343
2426
 
2344
2427
  export const rawSchema = { model, ipc, digest, releases, errors, versionInfo, api }
2345
2428
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morehao/trendradar-contract",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
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.4.0
4
+ version: 0.6.0
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
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://github.com/morehao/trendradar/contract/schema/errors.v2.json",
4
4
  "title": "trendradar errors v2",
5
- "description": "Canonical error-code catalog. Each property is one error code whose retriable/description are consts, so this file is the single source of truth for retriability. ipc.v2.json ErrorCode enum must match these keys exactly.",
5
+ "description": "Canonical error-code catalog. Each property is one error code whose retriable/description are consts, so this file is the single source of truth for retriability. ipc.v3.json ErrorCode enum must match these keys exactly.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "required": [
@@ -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.v2.json",
4
- "title": "trendradar ipc v2",
5
- "description": "Envelope exchanged between the trendradar core binary and the DSH plugin. Only RunRequest forbids extra fields. ipcSchema is const 2.",
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.",
6
6
  "oneOf": [
7
7
  {
8
8
  "$ref": "#/$defs/RunRequest"
@@ -79,6 +79,35 @@
79
79
  }
80
80
  }
81
81
  },
82
+ "DigestArtifact": {
83
+ "type": "object",
84
+ "additionalProperties": true,
85
+ "description": "The digest document rendered by this run, inlined so the caller never reads the output repository. bytes/sha256 describe the UTF-8 bytes of text exactly as written to path.",
86
+ "required": [
87
+ "path",
88
+ "bytes",
89
+ "sha256",
90
+ "text"
91
+ ],
92
+ "properties": {
93
+ "path": {
94
+ "type": "string"
95
+ },
96
+ "bytes": {
97
+ "type": "integer",
98
+ "minimum": 0,
99
+ "maximum": 1048576
100
+ },
101
+ "sha256": {
102
+ "type": "string",
103
+ "pattern": "^sha256:[0-9a-f]{64}$"
104
+ },
105
+ "text": {
106
+ "type": "string",
107
+ "maxLength": 1048576
108
+ }
109
+ }
110
+ },
82
111
  "RunRequest": {
83
112
  "type": "object",
84
113
  "additionalProperties": false,
@@ -88,7 +117,7 @@
88
117
  ],
89
118
  "properties": {
90
119
  "ipcSchema": {
91
- "const": 2
120
+ "const": 3
92
121
  },
93
122
  "command": {
94
123
  "type": "string",
@@ -124,7 +153,8 @@
124
153
  },
125
154
  "repo": {
126
155
  "type": "string",
127
- "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
156
+ "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
157
+ "description": "command=subscribe: the target repo for action=add/remove/releases. command=run: with stages including 'releases', analyze only this repository's releases (absent = every subscribed repo)."
128
158
  },
129
159
  "volume": {
130
160
  "type": "integer",
@@ -144,7 +174,7 @@
144
174
  }
145
175
  }
146
176
  },
147
- "description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo; action=releases requires a repo and may name a volume. command=run may narrow its work with stages.",
177
+ "description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo; action=releases requires a repo and may name a volume. command=run may narrow its work with stages; when stages includes 'releases', repo optionally restricts the release analysis to a single repository.",
148
178
  "allOf": [
149
179
  {
150
180
  "if": {
@@ -250,7 +280,57 @@
250
280
  "properties": {
251
281
  "command": {
252
282
  "enum": [
253
- "run",
283
+ "run"
284
+ ]
285
+ }
286
+ },
287
+ "required": [
288
+ "command"
289
+ ]
290
+ },
291
+ "then": {
292
+ "not": {
293
+ "anyOf": [
294
+ {
295
+ "required": [
296
+ "action"
297
+ ]
298
+ },
299
+ {
300
+ "required": [
301
+ "volume"
302
+ ]
303
+ }
304
+ ]
305
+ },
306
+ "allOf": [
307
+ {
308
+ "if": {
309
+ "required": [
310
+ "repo"
311
+ ]
312
+ },
313
+ "then": {
314
+ "required": [
315
+ "stages"
316
+ ],
317
+ "properties": {
318
+ "stages": {
319
+ "contains": {
320
+ "const": "releases"
321
+ }
322
+ }
323
+ }
324
+ }
325
+ }
326
+ ]
327
+ }
328
+ },
329
+ {
330
+ "if": {
331
+ "properties": {
332
+ "command": {
333
+ "enum": [
254
334
  "serve",
255
335
  "config",
256
336
  "version"
@@ -323,7 +403,7 @@
323
403
  ],
324
404
  "properties": {
325
405
  "ipcSchema": {
326
- "const": 2
406
+ "const": 3
327
407
  },
328
408
  "ok": {
329
409
  "type": "boolean"
@@ -355,6 +435,9 @@
355
435
  "$ref": "#/$defs/FileArtifact"
356
436
  }
357
437
  },
438
+ "digest": {
439
+ "$ref": "#/$defs/DigestArtifact"
440
+ },
358
441
  "branch": {
359
442
  "type": "string"
360
443
  },
@@ -478,10 +561,10 @@
478
561
  ],
479
562
  "properties": {
480
563
  "ipcSchema": {
481
- "const": 2
564
+ "const": 3
482
565
  },
483
566
  "stateSchema": {
484
- "const": 2
567
+ "const": 3
485
568
  },
486
569
  "lastRun": {
487
570
  "$ref": "#/$defs/StateRun"
@@ -240,7 +240,7 @@
240
240
  "minimum": 0
241
241
  },
242
242
  "usage": {
243
- "$ref": "ipc.v2.json#/$defs/Usage"
243
+ "$ref": "ipc.v3.json#/$defs/Usage"
244
244
  }
245
245
  }
246
246
  },
@@ -2,14 +2,14 @@
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===2 && digestSchema===2 && contractVersion major===2.",
5
+ "description": "Handshake payload returned by `trendradar version --json`. The plugin requires ipcSchema===3 && digestSchema===2 && 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": 2 },
12
+ "ipcSchema": { "const": 3 },
13
13
  "digestSchema": { "const": 2 },
14
14
  "contractVersion": { "type": "string" },
15
15
  "supportedProviders": { "type": "array", "items": { "type": "string" } }
package/version-map.json CHANGED
@@ -1,12 +1,4 @@
1
1
  {
2
- "ipc.v2.json": {
3
- "wireKey": "ipcSchema",
4
- "current": 2,
5
- "breakingBump": [
6
- "ipcSchema",
7
- "packageMajor"
8
- ]
9
- },
10
2
  "digest.v2.json": {
11
3
  "wireKey": "digestSchema",
12
4
  "current": 2,
@@ -34,14 +26,14 @@
34
26
  },
35
27
  "version-info.v2.json": {
36
28
  "wireKey": "contractVersion",
37
- "current": "0.4.0",
29
+ "current": "0.6.0",
38
30
  "breakingBump": [
39
31
  "packageMajor"
40
32
  ]
41
33
  },
42
34
  "api.v2.yaml": {
43
35
  "wireKey": "info.version",
44
- "current": "0.4.0",
36
+ "current": "0.6.0",
45
37
  "breakingBump": [
46
38
  "packageMajor"
47
39
  ]
@@ -53,5 +45,13 @@
53
45
  "breakingBump": [
54
46
  "packageMajor"
55
47
  ]
48
+ },
49
+ "ipc.v3.json": {
50
+ "wireKey": "ipcSchema",
51
+ "current": 3,
52
+ "breakingBump": [
53
+ "ipcSchema",
54
+ "packageMajor"
55
+ ]
56
56
  }
57
57
  }