upstream-radar 0.4.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.
Files changed (92) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +222 -0
  3. package/README.zh-CN.md +170 -0
  4. package/cordis.patch.yml +11 -0
  5. package/dist/src/cli.d.ts +3 -0
  6. package/dist/src/cli.d.ts.map +1 -0
  7. package/dist/src/cli.js +286 -0
  8. package/dist/src/cli.js.map +1 -0
  9. package/dist/src/compatibility.d.ts +12 -0
  10. package/dist/src/compatibility.d.ts.map +1 -0
  11. package/dist/src/compatibility.js +195 -0
  12. package/dist/src/compatibility.js.map +1 -0
  13. package/dist/src/dsh-analysis.d.ts +7 -0
  14. package/dist/src/dsh-analysis.d.ts.map +1 -0
  15. package/dist/src/dsh-analysis.js +53 -0
  16. package/dist/src/dsh-analysis.js.map +1 -0
  17. package/dist/src/dsh-plugin.d.ts +45 -0
  18. package/dist/src/dsh-plugin.d.ts.map +1 -0
  19. package/dist/src/dsh-plugin.js +121 -0
  20. package/dist/src/dsh-plugin.js.map +1 -0
  21. package/dist/src/graph.d.ts +14 -0
  22. package/dist/src/graph.d.ts.map +1 -0
  23. package/dist/src/graph.js +198 -0
  24. package/dist/src/graph.js.map +1 -0
  25. package/dist/src/index.d.ts +19 -0
  26. package/dist/src/index.d.ts.map +1 -0
  27. package/dist/src/index.js +19 -0
  28. package/dist/src/index.js.map +1 -0
  29. package/dist/src/inventory.d.ts +4 -0
  30. package/dist/src/inventory.d.ts.map +1 -0
  31. package/dist/src/inventory.js +182 -0
  32. package/dist/src/inventory.js.map +1 -0
  33. package/dist/src/npm-release.d.ts +24 -0
  34. package/dist/src/npm-release.d.ts.map +1 -0
  35. package/dist/src/npm-release.js +131 -0
  36. package/dist/src/npm-release.js.map +1 -0
  37. package/dist/src/npm.d.ts +36 -0
  38. package/dist/src/npm.d.ts.map +1 -0
  39. package/dist/src/npm.js +803 -0
  40. package/dist/src/npm.js.map +1 -0
  41. package/dist/src/osv.d.ts +18 -0
  42. package/dist/src/osv.d.ts.map +1 -0
  43. package/dist/src/osv.js +238 -0
  44. package/dist/src/osv.js.map +1 -0
  45. package/dist/src/policy.d.ts +5 -0
  46. package/dist/src/policy.d.ts.map +1 -0
  47. package/dist/src/policy.js +32 -0
  48. package/dist/src/policy.js.map +1 -0
  49. package/dist/src/radar-render.d.ts +4 -0
  50. package/dist/src/radar-render.d.ts.map +1 -0
  51. package/dist/src/radar-render.js +50 -0
  52. package/dist/src/radar-render.js.map +1 -0
  53. package/dist/src/radar-state.d.ts +5 -0
  54. package/dist/src/radar-state.d.ts.map +1 -0
  55. package/dist/src/radar-state.js +87 -0
  56. package/dist/src/radar-state.js.map +1 -0
  57. package/dist/src/radar-types.d.ts +163 -0
  58. package/dist/src/radar-types.d.ts.map +1 -0
  59. package/dist/src/radar-types.js +7 -0
  60. package/dist/src/radar-types.js.map +1 -0
  61. package/dist/src/radar.d.ts +24 -0
  62. package/dist/src/radar.d.ts.map +1 -0
  63. package/dist/src/radar.js +234 -0
  64. package/dist/src/radar.js.map +1 -0
  65. package/dist/src/render.d.ts +3 -0
  66. package/dist/src/render.d.ts.map +1 -0
  67. package/dist/src/render.js +58 -0
  68. package/dist/src/render.js.map +1 -0
  69. package/dist/src/scan.d.ts +8 -0
  70. package/dist/src/scan.d.ts.map +1 -0
  71. package/dist/src/scan.js +293 -0
  72. package/dist/src/scan.js.map +1 -0
  73. package/dist/src/semver.d.ts +13 -0
  74. package/dist/src/semver.d.ts.map +1 -0
  75. package/dist/src/semver.js +136 -0
  76. package/dist/src/semver.js.map +1 -0
  77. package/dist/src/tar.d.ts +25 -0
  78. package/dist/src/tar.d.ts.map +1 -0
  79. package/dist/src/tar.js +327 -0
  80. package/dist/src/tar.js.map +1 -0
  81. package/dist/src/types.d.ts +111 -0
  82. package/dist/src/types.d.ts.map +1 -0
  83. package/dist/src/types.js +2 -0
  84. package/dist/src/types.js.map +1 -0
  85. package/dist/src/version.d.ts +2 -0
  86. package/dist/src/version.d.ts.map +1 -0
  87. package/dist/src/version.js +2 -0
  88. package/dist/src/version.js.map +1 -0
  89. package/docs/assets/upstream-radar-hero-mobile.jpg +0 -0
  90. package/docs/assets/upstream-radar-hero.jpg +0 -0
  91. package/package.json +84 -0
  92. package/schemas/analysis-result.schema.json +39 -0
package/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,222 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(max-width: 600px)" srcset="docs/assets/upstream-radar-hero-mobile.jpg">
4
+ <img src="docs/assets/upstream-radar-hero.jpg" alt="Upstream Radar watches a dependency graph, highlights one affected path, and routes one signal to a DSH Agent." width="100%">
5
+ </picture>
6
+ </p>
7
+
8
+ <h1 align="center">Upstream Radar</h1>
9
+
10
+ <p align="center"><strong>Dependency changes that wake your DSH Agent only when your project is actually affected.</strong></p>
11
+
12
+ <p align="center">
13
+ English · <a href="README.zh-CN.md">简体中文</a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://www.npmjs.com/package/upstream-radar"><img alt="npm version" src="https://img.shields.io/npm/v/upstream-radar?style=flat-square&color=2563eb"></a>
18
+ <a href="https://github.com/MicroMilo/upstream-radar/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/MicroMilo/upstream-radar/ci.yml?branch=main&style=flat-square&label=CI"></a>
19
+ <a href="examples/dsh/README.md"><img alt="Tested with DSH 0.1.0-rc.6" src="https://img.shields.io/badge/tested_with_DSH-0.1.0--rc.6-5b5bd6?style=flat-square"></a>
20
+ <a href="https://github.com/MicroMilo/upstream-radar/releases"><img alt="GitHub release" src="https://img.shields.io/github/v/release/MicroMilo/upstream-radar?style=flat-square"></a>
21
+ <a href="LICENSE"><img alt="Apache-2.0 license" src="https://img.shields.io/badge/license-Apache--2.0-0f766e?style=flat-square"></a>
22
+ </p>
23
+
24
+ <p align="center">
25
+ <a href="#run-the-proof">Run the proof</a> ·
26
+ <a href="#install-in-dsh">Install in DSH</a> ·
27
+ <a href="#how-the-loop-works">How it works</a> ·
28
+ <a href="ROADMAP.md">Roadmap</a>
29
+ </p>
30
+
31
+ ---
32
+
33
+ A vulnerability feed can tell you that a package is affected. It usually cannot tell you which DSH plugin brought that exact version into your profile, whether the vulnerable path reaches your project, or whether the available upgrade breaks DSH on the way out.
34
+
35
+ Upstream Radar closes that loop inside [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness):
36
+
37
+ - **Exact path, not a package-name guess.** It preserves physical dependency nodes, duplicate versions, and the root-to-package path that actually matched.
38
+ - **An incident, not alert spam.** It stores `new`, `updated`, and `resolved` state and keeps only the current task for each incident.
39
+ - **Program facts before model judgment.** Version matching and compatibility boundaries stay deterministic; the DSH Agent investigates only project-specific reachability and migration impact.
40
+
41
+ ## Run the proof
42
+
43
+ Boot a real DSH `headless` profile with the packed Upstream Radar bundle installed:
44
+
45
+ ```bash
46
+ git clone https://github.com/MicroMilo/upstream-radar.git
47
+ cd upstream-radar
48
+ corepack enable
49
+ pnpm install --frozen-lockfile
50
+ pnpm run try:dsh
51
+ ```
52
+
53
+ No DeepSeek API key is required. The paid model endpoint is replaced by a deterministic local DeepSeek-compatible stub; the Cordis loader, DSH Agent, Session, persistence stack, bundle installation, and plugin delivery are real.
54
+
55
+ The command fails unless DSH proves all four facts:
56
+
57
+ ```json
58
+ {
59
+ "bundleInstalled": true,
60
+ "radarTaskReachedModel": true,
61
+ "pluginSourcePreserved": true,
62
+ "pendingTasksAfterDelivery": 0
63
+ }
64
+ ```
65
+
66
+ This proof runs in CI on Node.js 22. See the executable [showcase contract](examples/dsh/README.md) and its checked-in [result](examples/dsh/reports/headless-smoke.json).
67
+
68
+ To include a current OSV and npm poll before the DSH handoff:
69
+
70
+ ```bash
71
+ pnpm run try:dsh:live
72
+ ```
73
+
74
+ ## Install in DSH
75
+
76
+ Upstream Radar is an npm-published DSH bundle, so no install-time build permission is required:
77
+
78
+ ```bash
79
+ dsh plugin --profile web add upstream-radar@0.4.0
80
+ ```
81
+
82
+ Point the bundle at an explicit project inventory, choose a durable state file, then boot the profile:
83
+
84
+ ```bash
85
+ export UPSTREAM_RADAR_CONFIG=/absolute/path/radar-config.json
86
+ export UPSTREAM_RADAR_STATE=/absolute/path/radar-state.json
87
+ export UPSTREAM_RADAR_INTERVAL_SECONDS=1800
88
+
89
+ dsh --profile web --dump-config
90
+ dsh --profile web
91
+ ```
92
+
93
+ Start from [the example inventory](examples/radar/config.json). If `UPSTREAM_RADAR_CONFIG` is not set, the bundle stays dormant and performs no polling.
94
+
95
+ ## How the loop works
96
+
97
+ 1. Read the project inventory and exact installed npm graph.
98
+ 2. Query OSV with every installed `name@version` pair.
99
+ 3. Watch npm releases for the installed plugin and DSH/Cordis packages.
100
+ 4. Create or update one durable incident with the exact dependency path.
101
+ 5. Persist a constrained analysis task before delivery.
102
+ 6. Send a plugin-originated follow-up to the first live root DSH Agent.
103
+ 7. Keep the task on disk when no Agent is available; cancel it when the incident resolves.
104
+
105
+ The handoff uses `ctx.agents.roots()[0].followup(...)` with:
106
+
107
+ ```json
108
+ {
109
+ "kind": "plugin",
110
+ "plugin": "upstream-radar",
111
+ "form": "notice"
112
+ }
113
+ ```
114
+
115
+ It is a native DSH lifecycle integration—not a chat bridge or a remote-control bot.
116
+
117
+ ## One vulnerable path, not a false-positive package name
118
+
119
+ Given this installed graph:
120
+
121
+ ```text
122
+ plugin@1.0.0
123
+ ├── framework@2.4.7
124
+ │ ├── parser@3.2.1
125
+ │ └── archive@1.8.0
126
+ └── logger@4.0.2
127
+ └── parser@2.9.0
128
+ ```
129
+
130
+ an advisory affecting only `parser@2.9.0` produces:
131
+
132
+ ```text
133
+ [HIGH][NEW] Dependency vulnerability
134
+ Project: Payments API (payments-api)
135
+ Plugin: plugin@1.0.0
136
+ Affected: parser@2.9.0
137
+ Path: plugin@1.0.0 -> logger@4.0.2 -> parser@2.9.0
138
+ Fixed versions: 3.0.0
139
+ ```
140
+
141
+ The unaffected `parser@3.2.1` remains a distinct node.
142
+
143
+ ## Vulnerabilities are only half the upstream problem
144
+
145
+ Upstream Radar also watches candidate releases for compatibility boundaries that matter to DSH plugins:
146
+
147
+ - Node.js engine exclusions;
148
+ - incompatible `@deepseek-ai/dsh-*` or `@deepseek-ai/cordis` peer ranges;
149
+ - changed `main`, `exports`, or DSH bundle patch paths;
150
+ - removed dependencies;
151
+ - major and pre-1.0 breaking version boundaries;
152
+ - publisher-declared breaking changes in supplied release notes.
153
+
154
+ These are signals for project analysis, not automatic claims that an upgrade is broken.
155
+
156
+ ## The model gets judgment, not control of the facts
157
+
158
+ Upstream Radar determines facts that a model must not guess:
159
+
160
+ ```text
161
+ parser@2.9.0 is reported as affected
162
+ plugin -> logger -> parser is the installed path
163
+ the project runs Node.js 22
164
+ the candidate requires Node.js >=24
165
+ the installed DSH peer is outside the candidate range
166
+ ```
167
+
168
+ The DSH Agent answers the repository-specific questions:
169
+
170
+ ```text
171
+ is the vulnerable feature reachable here?
172
+ can attacker-controlled input reach it?
173
+ which API or Cordis configuration would the upgrade disturb?
174
+ what is the least disruptive project-specific action?
175
+ ```
176
+
177
+ Advisories, release notes, links, package names, and repository strings remain untrusted data. The generated task requires read-only analysis, project evidence, explicit uncertainty, and a fixed [result schema](schemas/analysis-result.schema.json).
178
+
179
+ ## What works today
180
+
181
+ - npm lockfile graphs with duplicate versions and bounded dependency paths;
182
+ - exact-version OSV vulnerability and malicious-package matching;
183
+ - npm release monitoring for plugins and DSH/Cordis packages;
184
+ - durable incident state with current-task replacement and resolution;
185
+ - native DSH bundle installation, startup polling, `agent/created` retry, and plugin-source attribution;
186
+ - compatibility signals for Node.js, peers, exports, entrypoints, bundle paths, dependencies, and version boundaries;
187
+ - network-free Radar and real DSH runtime showcases.
188
+
189
+ The bounded pre-install scanner remains available as a supporting collector:
190
+
191
+ ```bash
192
+ upstream-radar scan /path/to/dsh-plugin
193
+ upstream-radar inspect npm:dsh-cloudflare-browser-run@0.1.1 --deep
194
+ ```
195
+
196
+ ## Current boundaries
197
+
198
+ - Project inventory is explicit JSON; active DSH profile discovery is not implemented yet.
199
+ - npm lock graphs are supported; pnpm and Yarn graph adapters are not implemented.
200
+ - OSV and npm `latest` are the live sources; GitHub release and migration-guide ingestion are deferred.
201
+ - Delivery currently targets the first live root Agent rather than a project-specific session.
202
+ - Agent conclusions stay in the DSH Session; Radar does not ingest them back into incident state yet.
203
+ - No Issue, branch, Pull Request, dependency override, or merge is created automatically.
204
+
205
+ Upstream Radar is alpha software built for the developer-preview DSH ecosystem. Event schemas and adapter boundaries can change.
206
+
207
+ ## Project guide
208
+
209
+ - [Architecture](docs/architecture.md)
210
+ - [DSH headless showcase](examples/dsh/README.md)
211
+ - [Radar showcase walkthrough](docs/showcase.md)
212
+ - [Product vision(中文)](docs/vision.zh-CN.md)
213
+ - [Checks and evidence(中文)](docs/checks.zh-CN.md)
214
+ - [Threat model](docs/threat-model.md)
215
+ - [Roadmap](ROADMAP.md)
216
+ - [Changelog](CHANGELOG.md)
217
+ - [Contributing](CONTRIBUTING.md)
218
+ - [Security policy](SECURITY.md)
219
+
220
+ If DSH plugins are part of your stack, star the repository to follow the upstream safety loop as it grows. Questions and design feedback are welcome in [GitHub Discussions](https://github.com/MicroMilo/upstream-radar/discussions).
221
+
222
+ <sub>Community project for DeepSeek Harness. Not an official DeepSeek product. Apache-2.0 licensed.</sub>
@@ -0,0 +1,170 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(max-width: 600px)" srcset="docs/assets/upstream-radar-hero-mobile.jpg">
4
+ <img src="docs/assets/upstream-radar-hero.jpg" alt="Upstream Radar 监控依赖图,只高亮真正受影响的路径,并把一个信号交给 DSH Agent。" width="100%">
5
+ </picture>
6
+ </p>
7
+
8
+ <h1 align="center">Upstream Radar</h1>
9
+
10
+ <p align="center"><strong>只有当上游变化真正命中项目时,才唤醒你的 DSH Agent。</strong></p>
11
+
12
+ <p align="center">
13
+ <a href="README.md">English</a> · 简体中文
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://www.npmjs.com/package/upstream-radar"><img alt="npm 版本" src="https://img.shields.io/npm/v/upstream-radar?style=flat-square&color=2563eb"></a>
18
+ <a href="https://github.com/MicroMilo/upstream-radar/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/MicroMilo/upstream-radar/ci.yml?branch=main&style=flat-square&label=CI"></a>
19
+ <a href="examples/dsh/README.md"><img alt="已使用 DSH 0.1.0-rc.6 验证" src="https://img.shields.io/badge/tested_with_DSH-0.1.0--rc.6-5b5bd6?style=flat-square"></a>
20
+ <a href="LICENSE"><img alt="Apache-2.0 许可证" src="https://img.shields.io/badge/license-Apache--2.0-0f766e?style=flat-square"></a>
21
+ </p>
22
+
23
+ ---
24
+
25
+ 普通漏洞源只能告诉你“某个包有问题”。它通常无法回答:这个精确版本是被哪个 DSH 插件带进来的、真实依赖路径是什么、项目是否会触发漏洞,以及升级时会不会顺手破坏 DSH 兼容性。
26
+
27
+ Upstream Radar 把这条链路闭合在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 内部:
28
+
29
+ - **看精确路径,不按包名猜。** 保留物理依赖节点、重复版本和真正命中的完整路径。
30
+ - **维护事件状态,不制造告警洪水。** 记录 `new`、`updated`、`resolved`,同一事件只保留当前任务。
31
+ - **程序先确定事实,模型只做判断。** 版本命中和兼容边界由程序计算;DSH Agent 只调查项目可达性和迁移影响。
32
+
33
+ ## 在真实 DSH 中运行证明
34
+
35
+ ```bash
36
+ git clone https://github.com/MicroMilo/upstream-radar.git
37
+ cd upstream-radar
38
+ corepack enable
39
+ pnpm install --frozen-lockfile
40
+ pnpm run try:dsh
41
+ ```
42
+
43
+ 这个命令会把打包后的 bundle 安装进全新的 DSH `headless` profile。只有付费模型端点被本地确定性 stub 替代;Cordis loader、DSH Agent、Session、持久化和插件投递都是真实组件。
44
+
45
+ 验证不满足以下四项就会失败:
46
+
47
+ ```json
48
+ {
49
+ "bundleInstalled": true,
50
+ "radarTaskReachedModel": true,
51
+ "pluginSourcePreserved": true,
52
+ "pendingTasksAfterDelivery": 0
53
+ }
54
+ ```
55
+
56
+ 要把当前 OSV 和 npm 数据也加入启动轮询:
57
+
58
+ ```bash
59
+ pnpm run try:dsh:live
60
+ ```
61
+
62
+ ## 安装到 DSH
63
+
64
+ Upstream Radar 发布的是已经构建好的 npm bundle,不需要开放安装期构建权限:
65
+
66
+ ```bash
67
+ dsh plugin --profile web add upstream-radar@0.4.0
68
+ ```
69
+
70
+ 指定项目清单和持久化状态文件后启动 profile:
71
+
72
+ ```bash
73
+ export UPSTREAM_RADAR_CONFIG=/absolute/path/radar-config.json
74
+ export UPSTREAM_RADAR_STATE=/absolute/path/radar-state.json
75
+ export UPSTREAM_RADAR_INTERVAL_SECONDS=1800
76
+
77
+ dsh --profile web --dump-config
78
+ dsh --profile web
79
+ ```
80
+
81
+ 可以从[示例清单](examples/radar/config.json)开始。如果没有设置 `UPSTREAM_RADAR_CONFIG`,插件会保持休眠,不发起轮询。
82
+
83
+ ## 闭环如何工作
84
+
85
+ 1. 读取项目清单和实际安装的 npm 依赖图。
86
+ 2. 用每一个精确 `name@version` 查询 OSV。
87
+ 3. 监听已安装插件和 DSH/Cordis 包的 npm 新版本。
88
+ 4. 用真实依赖路径创建或更新一个持久事件。
89
+ 5. 先把受约束的分析任务落盘,再尝试投递。
90
+ 6. 通过 `ctx.agents.roots()[0].followup(...)` 唤醒在线 DSH Agent。
91
+ 7. Agent 不在线时保留任务;事件解决后撤销过期任务。
92
+
93
+ 投递消息保留明确的插件身份:
94
+
95
+ ```json
96
+ {
97
+ "kind": "plugin",
98
+ "plugin": "upstream-radar",
99
+ "form": "notice"
100
+ }
101
+ ```
102
+
103
+ 这是 DSH 原生生命周期集成,不是聊天机器人,也不是远程控制入口。
104
+
105
+ ## 一个真实命中的路径
106
+
107
+ ```text
108
+ plugin@1.0.0
109
+ ├── framework@2.4.7
110
+ │ ├── parser@3.2.1
111
+ │ └── archive@1.8.0
112
+ └── logger@4.0.2
113
+ └── parser@2.9.0
114
+ ```
115
+
116
+ 如果公告只影响 `parser@2.9.0`,Radar 输出的是:
117
+
118
+ ```text
119
+ [HIGH][NEW] Dependency vulnerability
120
+ Project: Payments API (payments-api)
121
+ Plugin: plugin@1.0.0
122
+ Affected: parser@2.9.0
123
+ Path: plugin@1.0.0 -> logger@4.0.2 -> parser@2.9.0
124
+ Fixed versions: 3.0.0
125
+ ```
126
+
127
+ 不受影响的 `parser@3.2.1` 仍然是独立节点。
128
+
129
+ ## 不只监控漏洞,也监控 breaking changes
130
+
131
+ Radar 还会识别与 DSH 插件直接相关的升级边界:
132
+
133
+ - Node.js 版本不兼容;
134
+ - `@deepseek-ai/dsh-*` 或 `@deepseek-ai/cordis` peer 范围不兼容;
135
+ - `main`、`exports` 或 DSH bundle patch 路径变化;
136
+ - 依赖被移除;
137
+ - major 和 1.0 前的破坏性版本边界;
138
+ - 发布者在 release notes 中明确声明 breaking change。
139
+
140
+ 这些是交给项目分析的信号,不会被包装成“已经确认升级会坏”。
141
+
142
+ ## 安全边界
143
+
144
+ 版本是否命中、依赖路径和兼容边界由程序确定。漏洞公告、release notes、链接、包名和仓库文字始终是不可信数据。
145
+
146
+ DSH Agent 收到的任务要求:只读分析、引用项目证据、保留不确定性,并返回固定的[结果结构](schemas/analysis-result.schema.json)。模型无法改写程序已经确认的匹配事实。
147
+
148
+ ## 当前能力与边界
149
+
150
+ 已经支持:npm lock 依赖图、重复版本路径、OSV 精确版本匹配、恶意包记录、npm release 监听、持久事件、DSH 原生投递,以及 Node/peer/exports/入口/bundle/版本边界检查。
151
+
152
+ 暂未支持:自动发现当前 DSH profile、pnpm/Yarn 图适配、GitHub release 与迁移文档源、项目级 Session 精确路由、把 Agent 结论写回事件,以及自动创建 Issue 或 PR。
153
+
154
+ Upstream Radar 目前是面向 DSH developer preview 生态的 alpha 软件,事件结构和适配边界仍可能变化。
155
+
156
+ ## 项目文档
157
+
158
+ - [架构](docs/architecture.md)
159
+ - [真实 DSH showcase](examples/dsh/README.md)
160
+ - [产品愿景](docs/vision.zh-CN.md)
161
+ - [检查项与证据](docs/checks.zh-CN.md)
162
+ - [威胁模型](docs/threat-model.md)
163
+ - [Roadmap](ROADMAP.md)
164
+ - [Changelog](CHANGELOG.md)
165
+ - [贡献指南](CONTRIBUTING.md)
166
+ - [安全策略](SECURITY.md)
167
+
168
+ 如果 DSH 插件已经进入你的技术栈,欢迎 Star 并在 [GitHub Discussions](https://github.com/MicroMilo/upstream-radar/discussions) 里讨论真实场景。
169
+
170
+ <sub>DeepSeek Harness 社区项目,并非 DeepSeek 官方产品。Apache-2.0 许可。</sub>
@@ -0,0 +1,11 @@
1
+ # Upstream Radar stays dormant until an inventory file is configured. This keeps
2
+ # installation side-effect free while letting one DSH profile opt into polling.
3
+ - insert:
4
+ - id: upstream-radar
5
+ name: 'upstream-radar/dsh'
6
+ config:
7
+ configFile: !!js process.env.UPSTREAM_RADAR_CONFIG
8
+ stateFile: !!js process.env.UPSTREAM_RADAR_STATE
9
+ intervalSeconds: !!js Number(process.env.UPSTREAM_RADAR_INTERVAL_SECONDS || 1800)
10
+ osvBaseUrl: !!js process.env.UPSTREAM_RADAR_OSV_BASE_URL
11
+ runOnStart: !!js process.env.UPSTREAM_RADAR_RUN_ON_START !== 'false'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}