@morehao/trendradar-contract 0.2.0 → 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/CHANGELOG.md +36 -0
- package/README.md +15 -9
- package/fixtures/release-degraded.json +30 -0
- package/fixtures/release-empty.json +10 -0
- package/fixtures/release-normal.json +53 -0
- package/gen/ts/index.d.ts +92 -2
- package/gen/ts/index.js +553 -5
- package/package.json +2 -3
- package/schema/api.v2.yaml +73 -4
- package/schema/ipc.v2.json +339 -42
- package/schema/releases.v2.json +278 -0
- package/version-map.json +55 -6
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.
|
|
5
|
+
export const contractVersion = "0.3.0"
|
|
6
6
|
|
|
7
7
|
export const errorCatalog = {
|
|
8
8
|
"INTERNAL": {
|
|
@@ -299,6 +299,99 @@ export const fixtures = {
|
|
|
299
299
|
"summarySource": "model"
|
|
300
300
|
}
|
|
301
301
|
]
|
|
302
|
+
},
|
|
303
|
+
"releaseNormal": {
|
|
304
|
+
"schema": 1,
|
|
305
|
+
"date": "2026-10-31",
|
|
306
|
+
"period": "daily",
|
|
307
|
+
"contentHash": "sha256:6ffddcbca4448be9db6dcdfcc407183516c35ed78001b32c3d567ad8a4b4ff42",
|
|
308
|
+
"contentHashAlgo": "jcs-sha256-v1",
|
|
309
|
+
"coreVersion": "0.5.0",
|
|
310
|
+
"generatedAt": "2026-10-31T13:04:00Z",
|
|
311
|
+
"count": 2,
|
|
312
|
+
"degraded": false,
|
|
313
|
+
"repos": [
|
|
314
|
+
{
|
|
315
|
+
"fullName": "infiniflow/ragflow",
|
|
316
|
+
"url": "https://github.com/infiniflow/ragflow",
|
|
317
|
+
"latestTag": "v1.0.0-rc3",
|
|
318
|
+
"newCount": 1,
|
|
319
|
+
"releases": [
|
|
320
|
+
{
|
|
321
|
+
"id": 428974489,
|
|
322
|
+
"tag": "v1.0.0-rc3",
|
|
323
|
+
"name": "v1.0.0-rc3",
|
|
324
|
+
"kind": "release",
|
|
325
|
+
"publishedAt": "2026-10-30T11:53:15Z",
|
|
326
|
+
"url": "https://github.com/infiniflow/ragflow/releases/tag/v1.0.0-rc3",
|
|
327
|
+
"prerelease": false,
|
|
328
|
+
"draft": false,
|
|
329
|
+
"bodyExcerpt": "1.0.0-rc3 fixes several issues found in rc2.",
|
|
330
|
+
"summaryZh": "新增证据充分性决策模型与 Categorize 组件,兼容 rc2 schema,可直接升级。",
|
|
331
|
+
"summarySource": "model"
|
|
332
|
+
}
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"fullName": "deepseek-ai/deepseek-harness",
|
|
337
|
+
"url": "https://github.com/deepseek-ai/deepseek-harness",
|
|
338
|
+
"latestTag": "dsh-v0.2.2-alpha.2",
|
|
339
|
+
"newCount": 1,
|
|
340
|
+
"releases": [
|
|
341
|
+
{
|
|
342
|
+
"id": 0,
|
|
343
|
+
"tag": "dsh-v0.2.2-alpha.2",
|
|
344
|
+
"name": "dsh-v0.2.2-alpha.2",
|
|
345
|
+
"kind": "tag",
|
|
346
|
+
"url": "https://github.com/deepseek-ai/deepseek-harness/tree/dsh-v0.2.2-alpha.2",
|
|
347
|
+
"prerelease": false,
|
|
348
|
+
"draft": false,
|
|
349
|
+
"summaryZh": "发布说明缺失,已回退到 commit 信息。",
|
|
350
|
+
"summarySource": "model"
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
"releaseDegraded": {
|
|
357
|
+
"schema": 1,
|
|
358
|
+
"date": "2026-10-31",
|
|
359
|
+
"period": "daily",
|
|
360
|
+
"contentHash": "sha256:f952f1607ff1708120c35e7a9551f0691ae747edf2ee959445edcd53bc0edf25",
|
|
361
|
+
"contentHashAlgo": "jcs-sha256-v1",
|
|
362
|
+
"count": 1,
|
|
363
|
+
"degraded": true,
|
|
364
|
+
"repos": [
|
|
365
|
+
{
|
|
366
|
+
"fullName": "acme/widget",
|
|
367
|
+
"url": "https://github.com/acme/widget",
|
|
368
|
+
"latestTag": "v2.0.0",
|
|
369
|
+
"newCount": 1,
|
|
370
|
+
"releases": [
|
|
371
|
+
{
|
|
372
|
+
"id": 0,
|
|
373
|
+
"tag": "v2.0.0",
|
|
374
|
+
"name": "v2.0.0",
|
|
375
|
+
"kind": "release",
|
|
376
|
+
"url": "https://github.com/acme/widget/releases/tag/v2.0.0",
|
|
377
|
+
"prerelease": false,
|
|
378
|
+
"draft": false,
|
|
379
|
+
"summaryZh": "版本 v2.0.0(未获取到变更说明)",
|
|
380
|
+
"summarySource": "original"
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
]
|
|
385
|
+
},
|
|
386
|
+
"releaseEmpty": {
|
|
387
|
+
"schema": 1,
|
|
388
|
+
"date": "2026-10-31",
|
|
389
|
+
"period": "daily",
|
|
390
|
+
"contentHash": "sha256:501d8c4be30af9d1dacdf15b2e48ccd3134cbe439695f7685deea11e00c24de8",
|
|
391
|
+
"contentHashAlgo": "jcs-sha256-v1",
|
|
392
|
+
"count": 0,
|
|
393
|
+
"degraded": false,
|
|
394
|
+
"repos": []
|
|
302
395
|
}
|
|
303
396
|
}
|
|
304
397
|
|
|
@@ -489,7 +582,8 @@ const ipc = {
|
|
|
489
582
|
"run",
|
|
490
583
|
"serve",
|
|
491
584
|
"config",
|
|
492
|
-
"version"
|
|
585
|
+
"version",
|
|
586
|
+
"subscribe"
|
|
493
587
|
]
|
|
494
588
|
},
|
|
495
589
|
"configPath": {
|
|
@@ -504,8 +598,123 @@ const ipc = {
|
|
|
504
598
|
},
|
|
505
599
|
"outputDir": {
|
|
506
600
|
"type": "string"
|
|
601
|
+
},
|
|
602
|
+
"action": {
|
|
603
|
+
"type": "string",
|
|
604
|
+
"enum": [
|
|
605
|
+
"list",
|
|
606
|
+
"add",
|
|
607
|
+
"remove"
|
|
608
|
+
]
|
|
609
|
+
},
|
|
610
|
+
"repo": {
|
|
611
|
+
"type": "string",
|
|
612
|
+
"pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
|
|
507
613
|
}
|
|
508
|
-
}
|
|
614
|
+
},
|
|
615
|
+
"description": "Strict request envelope. command=subscribe manages the repo subscription list: action=list needs no repo; action=add/remove require exactly one repo.",
|
|
616
|
+
"allOf": [
|
|
617
|
+
{
|
|
618
|
+
"if": {
|
|
619
|
+
"properties": {
|
|
620
|
+
"command": {
|
|
621
|
+
"const": "subscribe"
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
"required": [
|
|
625
|
+
"command"
|
|
626
|
+
]
|
|
627
|
+
},
|
|
628
|
+
"then": {
|
|
629
|
+
"required": [
|
|
630
|
+
"action"
|
|
631
|
+
],
|
|
632
|
+
"properties": {
|
|
633
|
+
"action": {
|
|
634
|
+
"enum": [
|
|
635
|
+
"list",
|
|
636
|
+
"add",
|
|
637
|
+
"remove"
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
"allOf": [
|
|
642
|
+
{
|
|
643
|
+
"if": {
|
|
644
|
+
"properties": {
|
|
645
|
+
"action": {
|
|
646
|
+
"const": "list"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
"required": [
|
|
650
|
+
"action"
|
|
651
|
+
]
|
|
652
|
+
},
|
|
653
|
+
"then": {
|
|
654
|
+
"not": {
|
|
655
|
+
"required": [
|
|
656
|
+
"repo"
|
|
657
|
+
]
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"if": {
|
|
663
|
+
"properties": {
|
|
664
|
+
"action": {
|
|
665
|
+
"enum": [
|
|
666
|
+
"add",
|
|
667
|
+
"remove"
|
|
668
|
+
]
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
"required": [
|
|
672
|
+
"action"
|
|
673
|
+
]
|
|
674
|
+
},
|
|
675
|
+
"then": {
|
|
676
|
+
"required": [
|
|
677
|
+
"repo"
|
|
678
|
+
]
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
"if": {
|
|
686
|
+
"properties": {
|
|
687
|
+
"command": {
|
|
688
|
+
"enum": [
|
|
689
|
+
"run",
|
|
690
|
+
"serve",
|
|
691
|
+
"config",
|
|
692
|
+
"version"
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
"required": [
|
|
697
|
+
"command"
|
|
698
|
+
]
|
|
699
|
+
},
|
|
700
|
+
"then": {
|
|
701
|
+
"not": {
|
|
702
|
+
"anyOf": [
|
|
703
|
+
{
|
|
704
|
+
"required": [
|
|
705
|
+
"action"
|
|
706
|
+
]
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"required": [
|
|
710
|
+
"repo"
|
|
711
|
+
]
|
|
712
|
+
}
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
]
|
|
509
718
|
},
|
|
510
719
|
"RunResult": {
|
|
511
720
|
"type": "object",
|
|
@@ -574,6 +783,64 @@ const ipc = {
|
|
|
574
783
|
"items": {
|
|
575
784
|
"type": "string"
|
|
576
785
|
}
|
|
786
|
+
},
|
|
787
|
+
"usage": {
|
|
788
|
+
"$ref": "#/$defs/Usage"
|
|
789
|
+
},
|
|
790
|
+
"releases": {
|
|
791
|
+
"$ref": "releases.v2.json#/$defs/ReleasesReport"
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
"Usage": {
|
|
796
|
+
"type": "object",
|
|
797
|
+
"additionalProperties": true,
|
|
798
|
+
"required": [
|
|
799
|
+
"promptTokens",
|
|
800
|
+
"completionTokens",
|
|
801
|
+
"totalTokens",
|
|
802
|
+
"cachedTokens",
|
|
803
|
+
"usageKnown",
|
|
804
|
+
"calls",
|
|
805
|
+
"retries",
|
|
806
|
+
"batches",
|
|
807
|
+
"cacheHits"
|
|
808
|
+
],
|
|
809
|
+
"properties": {
|
|
810
|
+
"promptTokens": {
|
|
811
|
+
"type": "integer",
|
|
812
|
+
"minimum": 0
|
|
813
|
+
},
|
|
814
|
+
"completionTokens": {
|
|
815
|
+
"type": "integer",
|
|
816
|
+
"minimum": 0
|
|
817
|
+
},
|
|
818
|
+
"totalTokens": {
|
|
819
|
+
"type": "integer",
|
|
820
|
+
"minimum": 0
|
|
821
|
+
},
|
|
822
|
+
"cachedTokens": {
|
|
823
|
+
"type": "integer",
|
|
824
|
+
"minimum": 0
|
|
825
|
+
},
|
|
826
|
+
"usageKnown": {
|
|
827
|
+
"type": "boolean"
|
|
828
|
+
},
|
|
829
|
+
"calls": {
|
|
830
|
+
"type": "integer",
|
|
831
|
+
"minimum": 0
|
|
832
|
+
},
|
|
833
|
+
"retries": {
|
|
834
|
+
"type": "integer",
|
|
835
|
+
"minimum": 0
|
|
836
|
+
},
|
|
837
|
+
"batches": {
|
|
838
|
+
"type": "integer",
|
|
839
|
+
"minimum": 0
|
|
840
|
+
},
|
|
841
|
+
"cacheHits": {
|
|
842
|
+
"type": "integer",
|
|
843
|
+
"minimum": 0
|
|
577
844
|
}
|
|
578
845
|
}
|
|
579
846
|
},
|
|
@@ -697,6 +964,284 @@ const digest = {
|
|
|
697
964
|
}
|
|
698
965
|
}
|
|
699
966
|
}
|
|
967
|
+
const releases = {
|
|
968
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
969
|
+
"$id": "https://github.com/morehao/trendradar/contract/schema/releases.v2.json",
|
|
970
|
+
"title": "trendradar releases v2",
|
|
971
|
+
"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.",
|
|
972
|
+
"type": "object",
|
|
973
|
+
"additionalProperties": true,
|
|
974
|
+
"required": [
|
|
975
|
+
"schema",
|
|
976
|
+
"date",
|
|
977
|
+
"period",
|
|
978
|
+
"contentHash",
|
|
979
|
+
"contentHashAlgo",
|
|
980
|
+
"count",
|
|
981
|
+
"degraded",
|
|
982
|
+
"repos"
|
|
983
|
+
],
|
|
984
|
+
"properties": {
|
|
985
|
+
"schema": {
|
|
986
|
+
"const": 1
|
|
987
|
+
},
|
|
988
|
+
"date": {
|
|
989
|
+
"type": "string",
|
|
990
|
+
"format": "date"
|
|
991
|
+
},
|
|
992
|
+
"period": {
|
|
993
|
+
"type": "string",
|
|
994
|
+
"enum": [
|
|
995
|
+
"daily",
|
|
996
|
+
"weekly",
|
|
997
|
+
"monthly"
|
|
998
|
+
]
|
|
999
|
+
},
|
|
1000
|
+
"contentHash": {
|
|
1001
|
+
"type": "string",
|
|
1002
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
1003
|
+
},
|
|
1004
|
+
"contentHashAlgo": {
|
|
1005
|
+
"type": "string",
|
|
1006
|
+
"enum": [
|
|
1007
|
+
"jcs-sha256-v1"
|
|
1008
|
+
]
|
|
1009
|
+
},
|
|
1010
|
+
"coreVersion": {
|
|
1011
|
+
"type": "string"
|
|
1012
|
+
},
|
|
1013
|
+
"generatedAt": {
|
|
1014
|
+
"type": "string",
|
|
1015
|
+
"format": "date-time"
|
|
1016
|
+
},
|
|
1017
|
+
"count": {
|
|
1018
|
+
"type": "integer",
|
|
1019
|
+
"minimum": 0
|
|
1020
|
+
},
|
|
1021
|
+
"degraded": {
|
|
1022
|
+
"type": "boolean"
|
|
1023
|
+
},
|
|
1024
|
+
"repos": {
|
|
1025
|
+
"type": "array",
|
|
1026
|
+
"items": {
|
|
1027
|
+
"$ref": "#/$defs/RepoReleases"
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
1031
|
+
"$defs": {
|
|
1032
|
+
"ReleaseItem": {
|
|
1033
|
+
"type": "object",
|
|
1034
|
+
"additionalProperties": true,
|
|
1035
|
+
"description": "One release or tag. kind distinguishes a GitHub release (has notes) from a tag fallback (commit message used as the summary basis).",
|
|
1036
|
+
"required": [
|
|
1037
|
+
"id",
|
|
1038
|
+
"tag",
|
|
1039
|
+
"name",
|
|
1040
|
+
"kind",
|
|
1041
|
+
"url",
|
|
1042
|
+
"prerelease",
|
|
1043
|
+
"draft",
|
|
1044
|
+
"summaryZh",
|
|
1045
|
+
"summarySource"
|
|
1046
|
+
],
|
|
1047
|
+
"properties": {
|
|
1048
|
+
"id": {
|
|
1049
|
+
"type": "integer",
|
|
1050
|
+
"minimum": 0,
|
|
1051
|
+
"x-go-type": "int64",
|
|
1052
|
+
"description": "GitHub release id; 0 when the item comes from a tag fallback."
|
|
1053
|
+
},
|
|
1054
|
+
"tag": {
|
|
1055
|
+
"type": "string"
|
|
1056
|
+
},
|
|
1057
|
+
"name": {
|
|
1058
|
+
"type": "string"
|
|
1059
|
+
},
|
|
1060
|
+
"kind": {
|
|
1061
|
+
"type": "string",
|
|
1062
|
+
"enum": [
|
|
1063
|
+
"release",
|
|
1064
|
+
"tag"
|
|
1065
|
+
]
|
|
1066
|
+
},
|
|
1067
|
+
"publishedAt": {
|
|
1068
|
+
"type": "string",
|
|
1069
|
+
"format": "date-time"
|
|
1070
|
+
},
|
|
1071
|
+
"url": {
|
|
1072
|
+
"type": "string"
|
|
1073
|
+
},
|
|
1074
|
+
"prerelease": {
|
|
1075
|
+
"type": "boolean"
|
|
1076
|
+
},
|
|
1077
|
+
"draft": {
|
|
1078
|
+
"type": "boolean"
|
|
1079
|
+
},
|
|
1080
|
+
"bodyExcerpt": {
|
|
1081
|
+
"type": "string",
|
|
1082
|
+
"description": "Truncated raw release notes. Untrusted text: display only, never execute."
|
|
1083
|
+
},
|
|
1084
|
+
"summaryZh": {
|
|
1085
|
+
"type": "string"
|
|
1086
|
+
},
|
|
1087
|
+
"summarySource": {
|
|
1088
|
+
"type": "string",
|
|
1089
|
+
"enum": [
|
|
1090
|
+
"model",
|
|
1091
|
+
"original"
|
|
1092
|
+
]
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
"RepoReleases": {
|
|
1097
|
+
"type": "object",
|
|
1098
|
+
"additionalProperties": true,
|
|
1099
|
+
"required": [
|
|
1100
|
+
"fullName",
|
|
1101
|
+
"url",
|
|
1102
|
+
"latestTag",
|
|
1103
|
+
"newCount",
|
|
1104
|
+
"releases"
|
|
1105
|
+
],
|
|
1106
|
+
"properties": {
|
|
1107
|
+
"fullName": {
|
|
1108
|
+
"type": "string",
|
|
1109
|
+
"pattern": "^[^/]+/[^/]+$"
|
|
1110
|
+
},
|
|
1111
|
+
"url": {
|
|
1112
|
+
"type": "string",
|
|
1113
|
+
"format": "uri"
|
|
1114
|
+
},
|
|
1115
|
+
"latestTag": {
|
|
1116
|
+
"type": "string"
|
|
1117
|
+
},
|
|
1118
|
+
"newCount": {
|
|
1119
|
+
"type": "integer",
|
|
1120
|
+
"minimum": 0
|
|
1121
|
+
},
|
|
1122
|
+
"releases": {
|
|
1123
|
+
"type": "array",
|
|
1124
|
+
"items": {
|
|
1125
|
+
"$ref": "#/$defs/ReleaseItem"
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
"ReleasesReport": {
|
|
1131
|
+
"type": "object",
|
|
1132
|
+
"additionalProperties": true,
|
|
1133
|
+
"description": "Per-run diagnostic for the releases stage. usage is required and always serialized so a consumer can tell 'nothing spent' (calls=0) from 'spent but not reported' (calls>0 with usageKnown=false).",
|
|
1134
|
+
"required": [
|
|
1135
|
+
"enabled",
|
|
1136
|
+
"repos",
|
|
1137
|
+
"newReleases",
|
|
1138
|
+
"durationMs",
|
|
1139
|
+
"usage"
|
|
1140
|
+
],
|
|
1141
|
+
"properties": {
|
|
1142
|
+
"enabled": {
|
|
1143
|
+
"type": "boolean"
|
|
1144
|
+
},
|
|
1145
|
+
"repos": {
|
|
1146
|
+
"type": "integer",
|
|
1147
|
+
"minimum": 0
|
|
1148
|
+
},
|
|
1149
|
+
"newReleases": {
|
|
1150
|
+
"type": "integer",
|
|
1151
|
+
"minimum": 0
|
|
1152
|
+
},
|
|
1153
|
+
"summarized": {
|
|
1154
|
+
"type": "integer",
|
|
1155
|
+
"minimum": 0
|
|
1156
|
+
},
|
|
1157
|
+
"degraded": {
|
|
1158
|
+
"type": "integer",
|
|
1159
|
+
"minimum": 0
|
|
1160
|
+
},
|
|
1161
|
+
"failed": {
|
|
1162
|
+
"type": "integer",
|
|
1163
|
+
"minimum": 0
|
|
1164
|
+
},
|
|
1165
|
+
"rateLimited": {
|
|
1166
|
+
"type": "integer",
|
|
1167
|
+
"minimum": 0
|
|
1168
|
+
},
|
|
1169
|
+
"skipped": {
|
|
1170
|
+
"type": "integer",
|
|
1171
|
+
"minimum": 0
|
|
1172
|
+
},
|
|
1173
|
+
"truncated": {
|
|
1174
|
+
"type": "integer",
|
|
1175
|
+
"minimum": 0
|
|
1176
|
+
},
|
|
1177
|
+
"historyTruncated": {
|
|
1178
|
+
"type": "integer",
|
|
1179
|
+
"minimum": 0
|
|
1180
|
+
},
|
|
1181
|
+
"durationMs": {
|
|
1182
|
+
"type": "integer",
|
|
1183
|
+
"minimum": 0
|
|
1184
|
+
},
|
|
1185
|
+
"usage": {
|
|
1186
|
+
"$ref": "https://github.com/morehao/trendradar/contract/schema/ipc.v2.json#/$defs/Usage"
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
},
|
|
1190
|
+
"ReleaseManifestEntry": {
|
|
1191
|
+
"type": "object",
|
|
1192
|
+
"additionalProperties": true,
|
|
1193
|
+
"description": "One row of GET /api/v2/releases. Cost is intentionally absent: manifests describe stored documents, which carry no run cost.",
|
|
1194
|
+
"required": [
|
|
1195
|
+
"date",
|
|
1196
|
+
"period",
|
|
1197
|
+
"count",
|
|
1198
|
+
"contentHash"
|
|
1199
|
+
],
|
|
1200
|
+
"properties": {
|
|
1201
|
+
"date": {
|
|
1202
|
+
"type": "string",
|
|
1203
|
+
"format": "date"
|
|
1204
|
+
},
|
|
1205
|
+
"period": {
|
|
1206
|
+
"type": "string",
|
|
1207
|
+
"enum": [
|
|
1208
|
+
"daily",
|
|
1209
|
+
"weekly",
|
|
1210
|
+
"monthly"
|
|
1211
|
+
]
|
|
1212
|
+
},
|
|
1213
|
+
"count": {
|
|
1214
|
+
"type": "integer",
|
|
1215
|
+
"minimum": 0
|
|
1216
|
+
},
|
|
1217
|
+
"degraded": {
|
|
1218
|
+
"type": "boolean"
|
|
1219
|
+
},
|
|
1220
|
+
"contentHash": {
|
|
1221
|
+
"type": "string",
|
|
1222
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
},
|
|
1226
|
+
"SubscriptionList": {
|
|
1227
|
+
"type": "object",
|
|
1228
|
+
"additionalProperties": true,
|
|
1229
|
+
"description": "Response of GET /api/v2/subscriptions.",
|
|
1230
|
+
"required": [
|
|
1231
|
+
"repos"
|
|
1232
|
+
],
|
|
1233
|
+
"properties": {
|
|
1234
|
+
"repos": {
|
|
1235
|
+
"type": "array",
|
|
1236
|
+
"items": {
|
|
1237
|
+
"type": "string",
|
|
1238
|
+
"pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
700
1245
|
const versionInfo = {
|
|
701
1246
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
702
1247
|
"$id": "https://github.com/morehao/trendradar/contract/schema/version-info.v2.json",
|
|
@@ -1077,20 +1622,23 @@ const errors = {
|
|
|
1077
1622
|
}
|
|
1078
1623
|
}
|
|
1079
1624
|
}
|
|
1080
|
-
const api = "openapi: 3.1.0\ninfo:\n title: trendradar serve API\n version: 0.
|
|
1625
|
+
const api = "openapi: 3.1.0\ninfo:\n title: trendradar serve API\n version: 0.3.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. Returns an empty array when the subscription file is missing\n or empty. Writing subscriptions stays on the CLI / IPC subscribe command.\n responses:\n \"200\":\n description: Current subscription list\n content:\n application/json:\n schema:\n $ref: \"./releases.v2.json#/$defs/SubscriptionList\"\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"
|
|
1081
1626
|
|
|
1082
|
-
export const rawSchema = { model, ipc, digest, errors, versionInfo, api }
|
|
1627
|
+
export const rawSchema = { model, ipc, digest, releases, errors, versionInfo, api }
|
|
1083
1628
|
|
|
1084
1629
|
const ajv = new Ajv({ allErrors: true, strict: false })
|
|
1085
1630
|
addFormats(ajv)
|
|
1086
1631
|
ajv.addSchema(model)
|
|
1087
1632
|
ajv.addSchema(ipc)
|
|
1088
1633
|
ajv.addSchema(digest)
|
|
1634
|
+
ajv.addSchema(releases)
|
|
1089
1635
|
ajv.addSchema(versionInfo)
|
|
1090
1636
|
|
|
1091
1637
|
export const validators = {
|
|
1092
1638
|
runRequest: ajv.compile({ $ref: ipc.$id + '#/$defs/RunRequest' }),
|
|
1093
1639
|
runResult: ajv.compile({ $ref: ipc.$id + '#/$defs/RunResult' }),
|
|
1094
1640
|
digest: ajv.getSchema(digest.$id),
|
|
1641
|
+
releases: ajv.getSchema(releases.$id),
|
|
1642
|
+
releasesReport: ajv.compile({ $ref: releases.$id + '#/$defs/ReleasesReport' }),
|
|
1095
1643
|
versionInfo: ajv.getSchema(versionInfo.$id),
|
|
1096
1644
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morehao/trendradar-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|
|
@@ -30,9 +30,8 @@
|
|
|
30
30
|
"generate": "node scripts/generate.mjs",
|
|
31
31
|
"verify": "node scripts/generate.mjs && git diff --exit-code -- gen contract.gen.go schema",
|
|
32
32
|
"verify-versions": "node scripts/check-versions.mjs",
|
|
33
|
-
"verify-field-map": "node scripts/check-field-map.mjs",
|
|
34
33
|
"test": "node --test test/*.test.mjs",
|
|
35
|
-
"prepack": "npm run verify-versions
|
|
34
|
+
"prepack": "npm run verify-versions"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"canonicalize": "5.1.0"
|