dsh-standards 1.6.10 → 1.6.12

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.
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * land-runtime-artifacts.mjs — turn uploaded GitHub Actions artifacts from the
4
+ * rc3 runtime runs into committed evidence, without rewriting history.
5
+ *
6
+ * The 2026-11-14 rc3 runs uploaded their per-row artifacts to GitHub Actions
7
+ * (`entry18-runtime` run and `web-runtime` run). Artifacts expire; the repo's
8
+ * committed evidence is the durable copy. This script downloads the artifacts
9
+ * and writes them into a NEW asOf directory (e.g.
10
+ * `40-checker/results/entry/18/fullbase-rc3-20261114/`), never into the
11
+ * historical `fullbase/` / `webruntime/` directories.
12
+ *
13
+ * It only lands raw evidence; the REPORT.md / RUNTIME.md / SUPPORTED.md prose
14
+ * stays a human edit (the numbers must match the landed files).
15
+ *
16
+ * Credentials: imports DSH_KEY (default the deepseek-community-hub _key.mjs),
17
+ * whose side effect sets GH_TOKEN. Tokens are never printed.
18
+ *
19
+ * Usage:
20
+ * node 40-checker/scripts/land-runtime-artifacts.mjs \
21
+ * --kind entry18 --run 43560480242 --out 40-checker/results/entry/18/fullbase-rc3-20261114
22
+ * node 40-checker/scripts/land-runtime-artifacts.mjs \
23
+ * --kind web-runtime --run 43560484422 --out 40-checker/results/webruntime-rc3-20261114
24
+ *
25
+ * Options: --repo (default PerryLink/dsh-standards), --dry-run, --keep (comma list
26
+ * of extra artifact files to keep for web rows).
27
+ */
28
+ import fs from 'node:fs'
29
+ import path from 'node:path'
30
+ import zlib from 'node:zlib'
31
+
32
+ const KEY = process.env.DSH_KEY || '/mnt/d/Projects/dsh/deepseek-community-hub/00-live/_key.mjs'
33
+ if (fs.existsSync(KEY)) await import(KEY)
34
+
35
+ const API = 'https://api.github.com'
36
+ const WEB_ROW_FILES = ['client-export.json', 'installed-package.json', 'probe.json', 'shot.png', 'summary.md']
37
+
38
+ function usage(message) {
39
+ if (message) console.error(`error: ${message}`)
40
+ console.error('usage: land-runtime-artifacts.mjs --kind entry18|web-runtime --run <id> --out <dir> [--repo owner/name] [--dry-run]')
41
+ process.exit(2)
42
+ }
43
+
44
+ function parseArgs(argv) {
45
+ const options = { repo: 'PerryLink/dsh-standards', kind: '', run: '', out: '', dryRun: false }
46
+ for (let index = 0; index < argv.length; index += 1) {
47
+ const arg = argv[index]
48
+ if (arg === '--kind') options.kind = argv[++index]
49
+ else if (arg === '--run') options.run = argv[++index]
50
+ else if (arg === '--out') options.out = argv[++index]
51
+ else if (arg === '--repo') options.repo = argv[++index]
52
+ else if (arg === '--dry-run') options.dryRun = true
53
+ else if (arg === '--help' || arg === '-h') usage()
54
+ else usage(`unknown argument: ${arg}`)
55
+ }
56
+ if (!['entry18', 'web-runtime'].includes(options.kind)) usage('--kind must be entry18 or web-runtime')
57
+ if (!/^\d+$/.test(options.run)) usage('--run must be a workflow run id')
58
+ if (!options.out) usage('--out is required')
59
+ if (!process.env.GH_TOKEN) usage('GH_TOKEN is not set (check DSH_KEY)')
60
+ return options
61
+ }
62
+
63
+ async function github(pathname) {
64
+ const response = await fetch(API + pathname, {
65
+ headers: {
66
+ Authorization: `Bearer ${process.env.GH_TOKEN}`,
67
+ Accept: 'application/vnd.github+json',
68
+ 'User-Agent': 'dsh-standards-land-artifacts',
69
+ },
70
+ })
71
+ if (!response.ok) throw new Error(`GitHub ${pathname} → ${response.status}: ${(await response.text()).slice(0, 200)}`)
72
+ return response
73
+ }
74
+
75
+ /** Minimal ZIP reader (deflate/store) — enough for Actions artifact zips. */
76
+ export function unzip(buffer) {
77
+ const eocdSignature = 0x06054b50
78
+ let eocd = -1
79
+ for (let index = buffer.length - 22; index >= Math.max(0, buffer.length - 66000); index -= 1) {
80
+ if (buffer.readUInt32LE(index) === eocdSignature) { eocd = index; break }
81
+ }
82
+ if (eocd < 0) throw new Error('not a zip: EOCD not found')
83
+ const count = buffer.readUInt16LE(eocd + 10)
84
+ let offset = buffer.readUInt32LE(eocd + 16)
85
+ const files = new Map()
86
+ for (let entry = 0; entry < count; entry += 1) {
87
+ if (buffer.readUInt32LE(offset) !== 0x02014b50) throw new Error('bad central directory header')
88
+ const method = buffer.readUInt16LE(offset + 10)
89
+ const compressedSize = buffer.readUInt32LE(offset + 20)
90
+ const nameLength = buffer.readUInt16LE(offset + 28)
91
+ const extraLength = buffer.readUInt16LE(offset + 30)
92
+ const commentLength = buffer.readUInt16LE(offset + 32)
93
+ const localOffset = buffer.readUInt32LE(offset + 42)
94
+ const name = buffer.subarray(offset + 46, offset + 46 + nameLength).toString('utf8')
95
+ if (buffer.readUInt32LE(localOffset) !== 0x04034b50) throw new Error('bad local file header')
96
+ const localNameLength = buffer.readUInt16LE(localOffset + 26)
97
+ const localExtraLength = buffer.readUInt16LE(localOffset + 28)
98
+ const dataStart = localOffset + 30 + localNameLength + localExtraLength
99
+ const compressed = buffer.subarray(dataStart, dataStart + compressedSize)
100
+ const data = method === 0 ? Buffer.from(compressed) : zlib.inflateRawSync(compressed)
101
+ files.set(name, data)
102
+ offset += 46 + nameLength + extraLength + commentLength
103
+ }
104
+ return files
105
+ }
106
+
107
+ function rowIdFromArtifact(name, kind) {
108
+ if (kind === 'entry18') {
109
+ const prefix = 'entry18-fullbase-'
110
+ if (!name.startsWith(prefix) || name === 'entry18-fullbase-summary') return null
111
+ return name.slice(prefix.length)
112
+ }
113
+ const prefix = 'web-runtime-'
114
+ if (!name.startsWith(prefix)) return null
115
+ return name.slice(prefix.length)
116
+ }
117
+
118
+ export async function land({ repo, kind, run, out, dryRun = false }) {
119
+ const root = path.resolve(out)
120
+ const artifacts = []
121
+ for (let page = 1; ; page += 1) {
122
+ const response = await github(`/repos/${repo}/actions/runs/${run}/artifacts?per_page=100&page=${page}`)
123
+ const payload = await response.json()
124
+ artifacts.push(...(payload.artifacts || []))
125
+ if (!payload.artifacts || payload.artifacts.length < 100) break
126
+ }
127
+ const landed = []
128
+ const skipped = []
129
+ for (const artifact of artifacts.sort((a, b) => a.name.localeCompare(b.name))) {
130
+ const id = rowIdFromArtifact(artifact.name, kind)
131
+ if (id === null) { skipped.push(artifact.name); continue }
132
+ const response = await github(`/repos/${repo}/actions/artifacts/${artifact.id}/zip`)
133
+ const files = unzip(Buffer.from(await response.arrayBuffer()))
134
+ if (kind === 'entry18') {
135
+ const jsonName = `${id}.json`
136
+ const row = files.get(jsonName)
137
+ if (!row) throw new Error(`${artifact.name}: missing ${jsonName}`)
138
+ const target = path.join(root, jsonName)
139
+ if (!dryRun) { fs.mkdirSync(root, { recursive: true }); fs.writeFileSync(target, row) }
140
+ landed.push({ artifact: artifact.name, file: path.relative(process.cwd(), target), bytes: row.length })
141
+ } else {
142
+ const targetDir = path.join(root, id)
143
+ if (!dryRun) fs.mkdirSync(targetDir, { recursive: true })
144
+ const kept = []
145
+ for (const name of WEB_ROW_FILES) {
146
+ const data = files.get(name)
147
+ if (!data) continue
148
+ if (!dryRun) fs.writeFileSync(path.join(targetDir, name), data)
149
+ kept.push(name)
150
+ }
151
+ // Rows that are not client-bearing (shell-only / gate-rejected) carry only
152
+ // probe.json + summary.md in the historical layout; keep the subset.
153
+ const required = ['probe.json', 'summary.md']
154
+ const missing = required.filter(name => !kept.includes(name))
155
+ if (missing.length > 0) throw new Error(`${artifact.name}: missing required files (${missing.join(',')})`)
156
+ landed.push({ artifact: artifact.name, dir: path.relative(process.cwd(), targetDir), files: kept })
157
+ }
158
+ }
159
+ // entry18 also carries the aggregate summary artifact.
160
+ if (kind === 'entry18') {
161
+ const summaryArtifact = artifacts.find(artifact => artifact.name === 'entry18-fullbase-summary')
162
+ if (!summaryArtifact) throw new Error('summary artifact not found')
163
+ const response = await github(`/repos/${repo}/actions/artifacts/${summaryArtifact.id}/zip`)
164
+ const files = unzip(Buffer.from(await response.arrayBuffer()))
165
+ const summary = files.get('summary.json')
166
+ if (!summary) throw new Error('summary.json not found inside the summary artifact')
167
+ const target = path.join(root, 'summary.json')
168
+ if (!dryRun) { fs.mkdirSync(root, { recursive: true }); fs.writeFileSync(target, summary) }
169
+ landed.push({ artifact: summaryArtifact.name, file: path.relative(process.cwd(), target), bytes: summary.length })
170
+ }
171
+ return { repo, run, kind, out: root, landed, skipped }
172
+ }
173
+
174
+ function main() {
175
+ const options = parseArgs(process.argv.slice(2))
176
+ land({ repo: options.repo, kind: options.kind, run: options.run, out: options.out, dryRun: options.dryRun })
177
+ .then(result => {
178
+ console.log(JSON.stringify(result, null, 2))
179
+ if (options.dryRun) console.log('\n(dry run: nothing written)')
180
+ })
181
+ .catch(error => { console.error(error.stack || error.message); process.exit(1) })
182
+ }
183
+
184
+ if (process.argv[1] && path.resolve(process.argv[1]) === new URL(import.meta.url).pathname) main()
@@ -11,7 +11,8 @@
11
11
  * node scripts/m2-runner.mjs \
12
12
  * --package /tmp/dsh-host/plugins/ci-diet \
13
13
  * --runtime <dsh-checkout>/vendor/cordis/lib/index.js \
14
- * --runtime-version 0.2.2-alpha.2 \
14
+ * --runtime-version 0.2.2-rc.3 \
15
+ * --cordis-version 4.1.0 \
15
16
  * --out results/m2/ci-diet.json
16
17
  */
17
18
  import fs from 'node:fs'
@@ -19,10 +20,12 @@ import os from 'node:os'
19
20
  import path from 'node:path'
20
21
  import { spawn, spawnSync } from 'node:child_process'
21
22
  import { sanitizedEnv } from '../src/sandbox-env.mjs'
23
+ import { DEFAULT_RUNTIME_VERSION } from '../src/manifest.mjs'
24
+ import { DEFAULT_CORDIS } from '../src/cli.mjs'
22
25
 
23
26
  function parse(argv) {
24
27
  const options = {
25
- package: null, runtime: null, runtimeVersion: '0.2.2-alpha.2', cordisVersion: '4.0.6-alpha.1',
28
+ package: null, runtime: null, runtimeVersion: DEFAULT_RUNTIME_VERSION, cordisVersion: DEFAULT_CORDIS,
26
29
  timeoutMs: 60_000, out: null, keep: false, json: false, modules: null, backend: 'process', image: null,
27
30
  }
28
31
  for (let i = 0; i < argv.length; i += 1) {
@@ -0,0 +1,206 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * repo-anchor-check.mjs — verify `REPO/<path>:<line(s)>` evidence anchors in the
4
+ * standard documents against a real host checkout at a pinned commit.
5
+ *
6
+ * The standard cites upstream source by `REPO/packages/.../file.ts:123` (or a
7
+ * line list such as `:32-41`, `:109,150`). When the host moves those lines can
8
+ * drift even though the file still exists, so a prose anchor is only as good as
9
+ * the commit it was re-taken at. This script is the mechanical half of P1-8
10
+ * (2026-11-14 rc3 audit): it proves every anchor still resolves at the pinned
11
+ * commit and reports the ones that no longer point at a real line.
12
+ *
13
+ * What it proves:
14
+ * - the referenced file exists at the pinned commit;
15
+ * - every referenced line number is within the file;
16
+ * - the referenced line is not blank (a blank line is almost never intended).
17
+ *
18
+ * What it does NOT prove: that the line still contains the *same* symbol named
19
+ * around the anchor. That is a semantic re-take; the script prints the current
20
+ * line text so a reviewer can eyeball it (and `--context` gives N lines).
21
+ *
22
+ * Exit codes: 0 all anchors resolve; 1 at least one drift; 2 usage/host error.
23
+ *
24
+ * Usage:
25
+ * DSH_HOST=/path/to/deepseek-harness node 40-checker/scripts/repo-anchor-check.mjs
26
+ * node 40-checker/scripts/repo-anchor-check.mjs --host /path --commit 38a6a5c9 --json
27
+ * node 40-checker/scripts/repo-anchor-check.mjs --files 31-DS-C条款.md,60-权限与标注规范.md
28
+ */
29
+ import { execFileSync } from 'node:child_process'
30
+ import fs from 'node:fs'
31
+ import path from 'node:path'
32
+ import { fileURLToPath } from 'node:url'
33
+
34
+ const HERE = path.dirname(fileURLToPath(import.meta.url))
35
+ const ROOT = path.resolve(HERE, '..', '..')
36
+ const DEFAULT_COMMIT = '38a6a5c965aa99ab525161efb7cc5cf1fe62fced'
37
+ const DEFAULT_FILES = [
38
+ '31-DS-C条款.md',
39
+ '32-DS-R条款.md',
40
+ '33-DS-G条款.md',
41
+ '35-三层开发建议与验收清单.md',
42
+ '60-权限与标注规范.md',
43
+ '93-开发建议-入门.md',
44
+ ]
45
+ // REPO/path/to/file.ext:1 | :10-12 | :10,12 | :10-12,20
46
+ const REF = /REPO\/([A-Za-z0-9_.][A-Za-z0-9_./-]*):([0-9][0-9,\-]*)/g
47
+
48
+ function parseArgs(argv) {
49
+ const options = {
50
+ host: process.env.DSH_HOST || '',
51
+ commit: process.env.DSH_COMMIT || DEFAULT_COMMIT,
52
+ files: DEFAULT_FILES,
53
+ json: false,
54
+ context: 0,
55
+ }
56
+ for (let index = 0; index < argv.length; index += 1) {
57
+ const arg = argv[index]
58
+ if (arg === '--host') options.host = argv[++index]
59
+ else if (arg.startsWith('--host=')) options.host = arg.slice('--host='.length)
60
+ else if (arg === '--commit') options.commit = argv[++index]
61
+ else if (arg.startsWith('--commit=')) options.commit = arg.slice('--commit='.length)
62
+ else if (arg === '--files') options.files = argv[++index].split(',').map(item => item.trim()).filter(Boolean)
63
+ else if (arg === '--json') options.json = true
64
+ else if (arg === '--context') options.context = Number(argv[++index])
65
+ else if (arg === '--help' || arg === '-h') {
66
+ console.log('usage: repo-anchor-check.mjs --host <dsh-checkout> [--commit <sha>] [--files a.md,b.md] [--json] [--context N]')
67
+ process.exit(0)
68
+ } else {
69
+ console.error(`unknown argument: ${arg}`)
70
+ process.exit(2)
71
+ }
72
+ }
73
+ if (!options.host) {
74
+ console.error('error: --host <dsh-checkout> or DSH_HOST is required (the host checkout is read-only)')
75
+ process.exit(2)
76
+ }
77
+ if (!/^[0-9a-f]{7,40}$/i.test(options.commit)) {
78
+ console.error(`error: bad commit: ${options.commit}`)
79
+ process.exit(2)
80
+ }
81
+ return options
82
+ }
83
+
84
+ function gitShow(host, commit, relative) {
85
+ try {
86
+ return execFileSync('git', ['-C', host, 'show', `${commit}:${relative}`], {
87
+ encoding: 'utf8',
88
+ maxBuffer: 64 * 1024 * 1024,
89
+ stdio: ['ignore', 'pipe', 'pipe'],
90
+ })
91
+ } catch (error) {
92
+ return null
93
+ }
94
+ }
95
+
96
+ function lineNumbers(spec) {
97
+ const numbers = []
98
+ for (const part of spec.split(',')) {
99
+ if (!part) continue
100
+ const range = part.match(/^(\d+)-(\d+)$/)
101
+ if (range) {
102
+ const start = Number(range[1])
103
+ const end = Number(range[2])
104
+ for (let line = start; line <= end; line += 1) numbers.push(line)
105
+ } else {
106
+ numbers.push(Number(part))
107
+ }
108
+ }
109
+ return numbers
110
+ }
111
+
112
+ export function scanAnchors({ host, commit, files, root = ROOT }) {
113
+ const cache = new Map()
114
+ const docs = []
115
+ for (const file of files) {
116
+ const absolute = path.isAbsolute(file) ? file : path.join(root, file)
117
+ if (!fs.existsSync(absolute)) {
118
+ docs.push({ file, missing: true, anchors: 0, drifts: [] })
119
+ continue
120
+ }
121
+ const text = fs.readFileSync(absolute, 'utf8')
122
+ const anchors = []
123
+ for (const match of text.matchAll(REF)) {
124
+ const relative = match[1]
125
+ const spec = match[2]
126
+ const line = text.slice(0, match.index).split('\n').length
127
+ const numbers = lineNumbers(spec)
128
+ let content = cache.get(relative)
129
+ if (content === undefined) {
130
+ content = gitShow(host, commit, relative)
131
+ cache.set(relative, content)
132
+ }
133
+ const entry = {
134
+ doc: file,
135
+ docLine: line,
136
+ target: relative,
137
+ spec,
138
+ numbers,
139
+ sourceLine: text.split('\n')[line - 1].trim(),
140
+ }
141
+ if (content === null) {
142
+ entry.reason = 'file not found at the pinned commit'
143
+ } else {
144
+ const lines = content.split('\n')
145
+ entry.lineCount = lines.length
146
+ const outOfRange = numbers.filter(number => number < 1 || number > lines.length)
147
+ const blank = numbers.filter(number => {
148
+ const value = lines[number - 1]
149
+ return number >= 1 && number <= lines.length && value !== undefined && value.trim() === ''
150
+ })
151
+ // A range anchor legitimately spans blank lines; only a single-line
152
+ // anchor pointing at a blank line is suspicious (likely an off-by-one).
153
+ if (outOfRange.length > 0) entry.reason = `line(s) out of range (file has ${lines.length} lines): ${outOfRange.join(',')}`
154
+ else if (numbers.length === 1 && blank.length > 0) entry.warning = `single-line anchor points at a blank line: ${blank.join(',')}`
155
+ else {
156
+ entry.current = numbers.map(number => ({ line: number, text: lines[number - 1].trim() }))
157
+ }
158
+ }
159
+ anchors.push(entry)
160
+ }
161
+ docs.push({
162
+ file,
163
+ anchors: anchors.length,
164
+ drifts: anchors.filter(anchor => anchor.reason),
165
+ warnings: anchors.filter(anchor => !anchor.reason && anchor.warning),
166
+ entries: anchors,
167
+ })
168
+ }
169
+ const total = docs.reduce((sum, doc) => sum + doc.anchors, 0)
170
+ const drifts = docs.reduce((sum, doc) => sum + doc.drifts.length, 0)
171
+ const warnings = docs.reduce((sum, doc) => sum + (doc.warnings || []).length, 0)
172
+ return { commit, host, docs, total, drifts, warnings }
173
+ }
174
+
175
+ function main() {
176
+ const options = parseArgs(process.argv.slice(2))
177
+ try {
178
+ execFileSync('git', ['-C', options.host, 'rev-parse', '--git-dir'], { stdio: 'ignore' })
179
+ } catch {
180
+ console.error(`error: ${options.host} is not a git checkout`)
181
+ process.exit(2)
182
+ }
183
+ const report = scanAnchors(options)
184
+ if (options.json) {
185
+ console.log(JSON.stringify(report, null, 2))
186
+ } else {
187
+ console.log(`REPO anchors at ${report.commit.slice(0, 12)} (host: ${report.host})`)
188
+ for (const doc of report.docs) {
189
+ if (doc.missing) {
190
+ console.log(` MISSING DOC ${doc.file}`)
191
+ continue
192
+ }
193
+ console.log(` ${doc.drifts.length > 0 ? '!!' : 'OK'} ${doc.file}: ${doc.anchors} anchors, ${doc.drifts.length} drift, ${(doc.warnings || []).length} warning`)
194
+ for (const drift of doc.drifts) {
195
+ console.log(` - line ${drift.docLine}: ${drift.target}:${drift.spec} → ${drift.reason}`)
196
+ }
197
+ for (const warning of doc.warnings || []) {
198
+ console.log(` ~ line ${warning.docLine}: ${warning.target}:${warning.spec} → ${warning.warning}`)
199
+ }
200
+ }
201
+ console.log(`total: ${report.total} anchors, ${report.drifts} drift, ${report.warnings} warning`)
202
+ }
203
+ process.exit(report.drifts > 0 ? 1 : 0)
204
+ }
205
+
206
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main()
@@ -67,7 +67,7 @@ Safety:
67
67
 
68
68
  Any other flag is forwarded to the checker, e.g.:
69
69
  --scope entry --entry-claim static --no-exec
70
- --runtime-version 0.2.2-rc.1
70
+ --runtime-version 0.2.2-rc.3
71
71
  --market-index index.json --plugin-name @scope/name
72
72
 
73
73
  Exit codes (same as the checker):
@@ -14,8 +14,12 @@ import { readSourcesWithStats } from './util.mjs'
14
14
  import { buildReport, writeReport } from './report.mjs'
15
15
 
16
16
  const VERSION = '0.1.0'
17
- const DEFAULT_COMMIT = 'ce7073d51254c26cd63b22a60835b8f948deb447'
18
- const DEFAULT_CORDIS = '4.0.6-alpha.1'
17
+ // The released anchor the standards are calibrated against (DSH 0.2.2-rc.3,
18
+ // released 2026-11-13, tag dsh-v0.2.2-rc.3). These are recorded in every report
19
+ // when the caller does not pass --commit/--cordis-version; use --host-version
20
+ // to judge C-2 against the actually installed host.
21
+ export const DEFAULT_COMMIT = '38a6a5c965aa99ab525161efb7cc5cf1fe62fced'
22
+ export const DEFAULT_CORDIS = '4.1.0'
19
23
  const HOST_RUNTIME_TIMEOUT_MS = 5000
20
24
 
21
25
  function binName() {
@@ -28,6 +32,10 @@ function usage() {
28
32
  const bin = binName()
29
33
  return `${process.env.DSH_CHECKER_BRAND || 'dsh-plugin-verify ' + VERSION} — DS-C conformance checker (MVP)
30
34
 
35
+ Anchor defaults (recorded in every report): dsh ${DEFAULT_RUNTIME_VERSION} · cordis ${DEFAULT_CORDIS} · commit ${DEFAULT_COMMIT}
36
+ Without --host-version or a working \`dsh --version\`, anchor.dsh is this placeholder
37
+ (source=default, suspect=true) and C-2.1/C-2.2 are NA — not PASS and not FAIL.
38
+
31
39
  Usage:
32
40
  ${bin} check [dir] [--json] [--html <file>] author-facing report (Markdown by default)
33
41
  ${bin} <package-dir> [options] raw conformance report
@@ -681,7 +689,7 @@ export async function main(argv = process.argv.slice(2)) {
681
689
  scan = read.scan
682
690
  } catch { sources = [] }
683
691
  const declarationChecks = manifest ? [
684
- checkCapabilities(manifest, sources, patch),
692
+ checkCapabilities(manifest, sources, patch, scan),
685
693
  checkCredentials(manifest, sources),
686
694
  checkLabels(manifest, sources),
687
695
  ] : [
@@ -13,6 +13,27 @@ export const CAPABILITIES = new Set([
13
13
  'sessions:read', 'system-prompt:write', 'tools:register', 'remote:expose', 'plugin:install',
14
14
  ])
15
15
 
16
+ // Reserved capability IDs (2026-11-14, P1-6): names the current standard version
17
+ // accepts but does not judge. They cover DSH 0.2.2-rc.3 host seams whose static
18
+ // observation surface / FAIL policy is not settled yet. C-11.1 accepts them
19
+ // (declaring one is never an "unknown capability id" FAIL), C-11.2 never maps a
20
+ // trigger to them (the FAIL surface stays exactly the judged set above), and
21
+ // C-11.5 reports not-run instead of an over-declaration WARN.
22
+ //
23
+ // Contract: removing an id is a breaking standard change; promoting one into
24
+ // CAPABILITIES requires a C-11.2 trigger, an observation surface (or a
25
+ // deliberate NO_OBSERVATION_SURFACE entry) and tests.
26
+ export const RESERVED_CAPABILITIES = new Set([
27
+ // pre-existing reserved vocabulary (kept for compatibility).
28
+ 'mcp:client', 'browser', 'webhook:rule', 'theme:ui', 'client:ui',
29
+ // rc3 seams that had no declarable id before this version.
30
+ 'computer:control', 'browser:control', 'mcp:manage', 'mcp:resources',
31
+ 'ssh:connect', 'terminal:control', 'sandbox:override', 'approval:override',
32
+ 'authorization:delegate', 'remote-access:use', 'session-log:egress',
33
+ ])
34
+
35
+ export const KNOWN_CAPABILITIES = new Set([...CAPABILITIES, ...RESERVED_CAPABILITIES])
36
+
16
37
  export const LABELS = new Set([
17
38
  'prompt-modification', 'red-team', 'third-party-model-provider', 'remote-access', 'mirror',
18
39
  ])
@@ -635,16 +656,28 @@ export function checkImportTimeAdvisory(sources, entryRelative = null, scan = nu
635
656
  })
636
657
  }
637
658
 
659
+ /**
660
+ * Bounded-scan statement for C-11.5. A truncated scan cannot prove a declared
661
+ * capability is unused: the use may live in the files the budget never read, so
662
+ * the finding is not-run (NA) with partial coverage, never a WARN.
663
+ */
664
+ function capabilityTruncationReason(scan) {
665
+ if (!scan?.truncated) return ''
666
+ return `source scan truncated at ${scan.maxFiles} files / ${scan.maxBytes} bytes (scanned ${scan.files} files / ${scan.bytes} bytes)`
667
+ }
668
+
638
669
  /** DSC-11: dsh.capabilities declaration + high-signal static triggers. */
639
- export function checkCapabilities(manifest, sources, patch) {
670
+ export function checkCapabilities(manifest, sources, patch, scan = null) {
640
671
  const caps = capabilityList(manifest)
641
672
  const details = []
673
+ const truncation = capabilityTruncationReason(scan)
642
674
  if (caps.error) details.push(detail('C-11.1', 'FAIL', caps.error, ['package.json#dsh.capabilities']))
643
675
  if (!caps.defined) {
644
676
  details.push(detail('C-11.1', 'WARN', 'dsh.capabilities is not declared (transitional WARN; host does not read it yet)', ['package.json#dsh.capabilities']))
645
677
  } else if (!caps.error) {
646
678
  for (const id of caps.list) {
647
- if (!CAPABILITIES.has(id)) details.push(detail('C-11.1', 'FAIL', `unknown capability id: ${id}`, ['package.json#dsh.capabilities']))
679
+ // Reserved ids are accepted but not judged (see RESERVED_CAPABILITIES).
680
+ if (!KNOWN_CAPABILITIES.has(id)) details.push(detail('C-11.1', 'FAIL', `unknown capability id: ${id}`, ['package.json#dsh.capabilities']))
648
681
  }
649
682
  }
650
683
 
@@ -670,9 +703,15 @@ export function checkCapabilities(manifest, sources, patch) {
670
703
  }
671
704
  }
672
705
  if (sources.length === 0) {
673
- details.push(detail('C-11.5', 'NA', 'not-run: no source files were scanned, so no capability can be observed', []))
706
+ details.push(detail('C-11.5', 'NA', truncation
707
+ ? `not-run: ${truncation}, so no capability can be observed`
708
+ : 'not-run: no source files were scanned, so no capability can be observed', []))
674
709
  } else {
675
710
  for (const cap of caps.list) {
711
+ if (RESERVED_CAPABILITIES.has(cap)) {
712
+ details.push(detail('C-11.5', 'NA', `not-run: reserved capability ${cap} is accepted but not judged in this standard version (no static observation surface / policy defined)`, []))
713
+ continue
714
+ }
676
715
  if (NO_OBSERVATION_SURFACE.has(cap)) {
677
716
  details.push(detail('C-11.5', 'NA', `not-run: no static observation surface for ${cap} in this checker version`, []))
678
717
  continue
@@ -681,7 +720,15 @@ export function checkCapabilities(manifest, sources, patch) {
681
720
  // read-only plugin declare a write capability and pass. Read and write
682
721
  // are now observed independently (ctx.fs method + direct node:fs).
683
722
  const observed = triggered.has(cap) || observedEvidence.has(cap)
684
- if (!observed) details.push(detail('C-11.5', 'WARN', `declared capability ${cap} was not observed statically (this is not proof it is unused: node:fs, dynamic calls and scan truncation are outside the trigger surface)`, ['package.json#dsh.capabilities']))
723
+ if (!observed) {
724
+ // A truncated scan is missing coverage, not an over-declaration:
725
+ // report NA/partial instead of WARN so the cap is not accused.
726
+ if (truncation) {
727
+ details.push(detail('C-11.5', 'NA', `not-run: ${truncation}; declared capability ${cap} may be used outside the scanned subset`, ['package.json#dsh.capabilities']))
728
+ } else {
729
+ details.push(detail('C-11.5', 'WARN', `declared capability ${cap} was not observed statically (this is not proof it is unused: node:fs and dynamic calls are outside the trigger surface)`, ['package.json#dsh.capabilities']))
730
+ }
731
+ }
685
732
  }
686
733
  }
687
734
  }
@@ -702,7 +749,7 @@ export function checkCapabilities(manifest, sources, patch) {
702
749
  const result = worst(details.map(item => item.result))
703
750
  return check({
704
751
  id: 'DSC-11', clause: 'C-11', layer: 'L0', result,
705
- coverage: dangerUnparsableAll ? 'not-run' : dangerScan.parseErrors.length > 0 ? 'partial' : 'full',
752
+ coverage: dangerUnparsableAll ? 'not-run' : (dangerScan.parseErrors.length > 0 || truncation !== '') ? 'partial' : 'full',
706
753
  reason: details.filter(item => item.result !== 'PASS').map(item => `${item.item}: ${item.reason}`).join(' | '),
707
754
  details,
708
755
  evidence: ['package.json#dsh.capabilities', 'dsh.bundle.patch'],
@@ -1,5 +1,5 @@
1
1
  /** Programmatic API for dsh-plugin-verify. */
2
- export { main, parseArgs, usage, VERSION, detectHostRuntime, resolveRuntimeAnchor, declarationsOf } from './cli.mjs'
2
+ export { main, parseArgs, usage, VERSION, detectHostRuntime, resolveRuntimeAnchor, declarationsOf, DEFAULT_COMMIT, DEFAULT_CORDIS } from './cli.mjs'
3
3
  export { runManifestChecks, checkMarketEntry, DEFAULT_RUNTIME_VERSION, inferKind, resolveEntry } from './manifest.mjs'
4
4
  export { checkCapabilities, checkCredentials, checkLabels, checkImportTimeAdvisory, scanTruncationReason, CAPABILITIES, LABELS } from './declarations.mjs'
5
5
  export { readSources, readSourcesWithStats, listSourceFiles, scanSourceFiles } from './util.mjs'
@@ -17,7 +17,11 @@ const REGISTRY_ID = /^[a-z0-9][a-z0-9._~-]*(?:\/[a-z0-9][a-z0-9._~-]*)?$/
17
17
  const UNKNOWN_HOST_HOW = 'pass --host-version <v> (or run `check --allow-host-probe`); without a host version C-2.1/C-2.2 stay NA and compatibility is not judged'
18
18
  const UNKNOWN_HOST_REASON = '未指定 host 版本(host version not specified),兼容性未判定(compatibility not judged);C-2.1/C-2.2 are NA, not FAIL/PASS'
19
19
 
20
- export const DEFAULT_RUNTIME_VERSION = '0.2.2-alpha.2'
20
+ // The release this checker is calibrated against. It is only a placeholder:
21
+ // when no host version is known the anchor records it with
22
+ // runtimeSource=default and suspect=true, and C-2 stays NA. Never judge
23
+ // compatibility against it as if it were the installed host.
24
+ export const DEFAULT_RUNTIME_VERSION = '0.2.2-rc.3'
21
25
 
22
26
  export function inferKind(manifest, entryExists) {
23
27
  const declared = manifest?.dsh?.kind
@@ -457,7 +461,7 @@ export function runManifestChecks(dir, options = {}) {
457
461
  }
458
462
  }
459
463
  if (!invalid) {
460
- compatDetails.push(detail('C-2.1', 'PASS', 'dsh peer range(s) are valid SemVer; no engines.dsh declared'))
464
+ compatDetails.push(detail('C-2.1', 'PASS', 'dsh peer range(s) are valid SemVer; no engines.dsh declared (peer substitute, weaker than engines.dsh)'))
461
465
  }
462
466
  if (invalid) {
463
467
  compatDetails.push(detail('C-2.1', 'FAIL', 'one or more dsh peer ranges are invalid'))
package/CHANGELOG.md CHANGED
@@ -1,3 +1,52 @@
1
+ ## 1.6.12 — 2026-11-14
2
+
3
+ ### Added
4
+
5
+ - **Reserved capability IDs (P1-6, 2026-11-14 rc3 audit).** `31-DS-C条款.md` §8.1 and `60-权限与标注规范.md` §2.2 now carry a reserved-id table for DSH `0.2.2-rc.3` host seams the standard does not judge yet: `computer:control`, `browser:control`, `mcp:manage`, `mcp:resources`, `ssh:connect`, `terminal:control`, `sandbox:override`, `approval:override`, `authorization:delegate`, `remote-access:use`, `session-log:egress`, alongside the pre-existing `mcp:client`, `browser`, `webhook:rule`, `theme:ui`, `client:ui`. The checker accepts reserved ids in C-11.1 (declaring one is never an "unknown capability id" FAIL) and reports C-11.5 as `NA` (not-run) for them; the C-11.2 FAIL surface is **unchanged** — a reserved id never satisfies a judged trigger (e.g. declaring `computer:control` does not cover a `ctx.shell` trigger). `spec/dsc-clauses.json` C-11.1 wording follows.
6
+ - **`40-checker/scripts/repo-anchor-check.mjs`** — mechanical re-take of every `REPO/<path>:<line>` evidence anchor against a read-only host checkout at a pinned commit: it proves the file exists, every referenced line is in range, and (for single-line anchors) points at a non-blank line, and prints the current line so the semantic match can be reviewed. 2026-11-14 run at `38a6a5c9`: **368 anchors across 31/32/33/35/60/93 → 0 drift, 0 warnings** after fixing three `docs/tool-catalog.md:9` anchors to `:8` (they pointed at a blank line). Evidence summary: `docs/repo-anchors-rc3-2026-11-14.md`.
7
+ - **rc3 runtime evidence landed (P0-4).** `40-checker/results/entry/18/fullbase-rc3-20261114/` (18 raw `dsh-entry18-fullbase/1` rows + `summary.json` + `REPORT.md`) and `40-checker/results/webruntime-rc3-20261114/` (18 row dirs + `REPORT.md`), downloaded from runs `43560480242` / `43560484422` by `40-checker/scripts/land-runtime-artifacts.mjs`. The 2026-10-31 alpha.2 evidence directories are untouched. ENTRY: 10 verified / 7 partial / 1 error (the `YuJunZhiXue/dsh-purge` fixture is not cloneable from CI). Web: 14/15 client-bearing rows `client-module-loaded`, 4/4 web-app rows, 2 host-gate rejects, 1 install failure (same fixture), so the run-level denominator gate is red. `40-checker/results/entry/18/RUNTIME.md`, `SUPPORTED.md` (new `checker 1.6.12` column, evidence anchor A13, A12 marked historical) and the counts paragraph were updated. The rc3 cell is **`partial`**, not `runtime`: the run was produced by the 1.6.11-era tree, attribution relies on the evidence being committed at the v1.6.12 release commit, and web 15/15 coverage was not reached.
8
+
9
+ ### Changed
10
+
11
+ - `SUPPORTED.md`: counts re-derived at 2026-11-14 14:40 (398 legacy static results: `anchor.dsh=0.2.2-alpha.2` 241, no anchor 157; A12's 243/155 kept as the 05:23 snapshot, difference noted) and the matrix gained the `checker 1.6.12` column; §3 not-run conditions and §8 known limits updated to stop claiming rc.3 was never run.
12
+
13
+ ### Fixed
14
+
15
+ - `.github/workflows/publish.yml`: skip an already-published version before `npm publish` and add a `concurrency` group, so a manual publish and a tag-triggered publish cannot race into `E409 Cannot publish over previously staged version` (the 1.6.11 red run). A re-run of a red tag run is now safe.
16
+
17
+ ### Verified
18
+
19
+ - `npm test`: 322 tests, 321 pass, 1 skipped, 0 failed (Node 24).
20
+ - `node 40-checker/scripts/repo-anchor-check.mjs --host /home/yy/deepseek-harness`: 368 anchors, 0 drift, 0 warnings at `38a6a5c9`.
21
+ - `40-checker/scripts/land-runtime-artifacts.mjs` round-trips both GitHub Actions artifact zips into the committed directories; `REPORT.md` numbers match `summary.json` / each `probe.json`.
22
+ - Not verified: web denominator 15/15 — blocked by the private fixture and recorded as such instead of being papered over.
23
+
24
+ ## 1.6.11 — 2026-11-14
25
+
26
+ ### Changed
27
+
28
+ - **Anchors and default values move to DSH `0.2.2-rc.3`** (`dsh-v0.2.2-rc.3` = `38a6a5c9…`, 2026-11-13): `spec/reference-suite.json` → `dsh=0.2.2-rc.3` / `cordis=4.1.0` / `node >=24.9.0` (suite `1.1.0`, expected results unchanged; `limits` says the 11 expectations are still alpha.2-era evidence), five READMEs, `31-DS-C条款.md` §1.5/§3.3, `35` §7, `SUPPORTED.md`, `publish/*.example.json`, `spec/examples/*`, `spec/schemas/*` examples and `examples/plugin-template/package.json` now carry rc.3 / vendored cordis `4.1.0` (upstream `4.0.0-rc.11`) / `38a6a5c9…` / Node `>=24.9.0`. `0.2.2-alpha.2` + `4.0.6-alpha.1` + `ce7073d…` are kept only as dated historical anchors. **Only reports and examples that do not pass an explicit anchor are affected; committed `40-checker/results/**` keep their alpha.2 anchor and are stale for rc.3.**
29
+ - Runtime evidence CI re-pinned to rc.3: `entry18-runtime.yml` (install line, title, `--expected-dsh-version`) together with `40-checker/samples/entry18.json#targetDshVersion` (the pair must move together or `entry18-ci.mjs` throws), plus `web-runtime.yml`/`web-smoke.yml`/`lev6-capture.yml` `DSH_VERSION` and `40-checker/.github/workflows/plugin-verify.yml --runtime-version`. No rc.3 runtime result is committed yet, so `SUPPORTED.md` keeps `not-run` and says so.
30
+ - Node 22 jobs in `cross-platform.yml`, `governance.yml`, `round-robin.yml`, `surveillance.yml` and `40-checker/.github/workflows/plugin-verify.yml` moved to Node 24, matching `engines.node >=24.9.0`.
31
+ - `publish/README.md` + `index.example.json`: labels now use the `spec/levels.json` vocabulary (`dsh-flow:manual`, `dsh-boost:measured`, `dsh-entry:blocked`); `draft` / `lev7` / `unavailable` are documented as not emitted. `level-labels.example.json` shows a coherent rc.3 example (status `not-run` because no rc.3 evidence exists, asOf 2026-11-14).
32
+ - `SUPPORTED.md`: A7 now says the real host is `0.2.2-rc.3`; matrix gained `0.2.2-rc.2`/`0.2.2-rc.3` rows (all `not-run`/`NA`); counts re-checked at rc3 (243 alpha.2 anchors, 155 without anchor, 0 rc.2/rc.3; new A12).
33
+
34
+ ### Fixed
35
+
36
+ - `31-DS-C条款.md`: §1.5 five-part anchor and §3.3 report example are rc.3; the 2026-10-30 alpha.2 anchor is fenced off as history; the C-2 three-value table now matches the checker (`peer-only` + satisfied → PASS with a weaker "peer substitute" note, no longer WARN); REPO line anchors re-taken at rc3 (`plugin-manager/src/index.ts` 873→969, `tools.ts` 108→109/149→150, `package-manifest/src/types.ts` `dsh` :28 and `DshManifest` :32-41, `cordis-host-runner/sandbox.ts` 8→7, `vendor/README.md` 19→15, `install-spec.ts` 69-92→70-93 and 94-95→131, `plugin-market-index/src/index.ts` ranges +3~4); `ctx.root.fiber.await()` keeps a future-only note (still valid in rc3).
37
+ - `35-三层开发建议与验收清单.md`: new §7.1 rc.3 baseline; the alpha.3 table is demoted to a dated §7.2 history; the "npm default semver ignores prereleases" claim is corrected (`>=0.2.2-0 <0.3.0` already includes `0.2.2-rc.*`).
38
+ - `93-开发建议-入门.md`: client example no longer uses the removed `@deepseek-ai/dsh-client-runtime` (and explains `dsh.client.inject` is informational, `external` is the module-table field); `--runtime-version` examples → `0.2.2-rc.3`; `engines.dsh` example → `>=0.2.2-0 <0.3.0`.
39
+ - `32-DS-R条款.md`: evidence anchors for `practices.md` moved to the rc3 path `skills/dsh-doc/references/practices.md` (same line, now marked "rc3 重取"); `20-研究底稿/B-…` only gained a dated history note, no row changes.
40
+ - `spec/schemas/conformance.schema.json`: `runtimeSource` enum drops `fallback` (the code only emits `cli`/`host`/`default`); description now states `suspect` is true for `default`.
41
+ - `40-checker/README.md` / `docs/coverage.md`: examples use rc.3, `--cordis-version 4.1.0`, and the anchor fallback is described as `default` (not `fallback`).
42
+
43
+ ### Verified
44
+
45
+ - `npm test` (`node 40-checker/test/*.mjs test/*.mjs`): 321 tests, 320 pass, 1 skipped, 0 failed.
46
+ - `spec/examples/boost-card.example.json` `recordHash` and `spec/examples/flow-evidence.example.json` `chain.evidenceHash` recomputed after the anchor edits (spec-contract tests green).
47
+ - Checker default constants (`DEFAULT_RUNTIME_VERSION` / `DEFAULT_CORDIS` / `DEFAULT_COMMIT`) are `0.2.2-rc.3` / `4.1.0` / `38a6a5c9…` in this version (changed in the same release alongside the checker work); the README default tables match them.
48
+ - Not verified here: rc.3 runtime re-runs and the sidecar rebuild (evidence work owned by the checker changes), so `SUPPORTED.md` keeps every rc.3 cell `not-run`.
49
+
1
50
  ## 1.6.10 — 2026-11-13
2
51
 
3
52
  ### Fixed