dsh-plugin-update-doctor 0.5.0 → 0.5.3
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/README.md +91 -12
- package/client.js +328 -32
- package/docs/DETAIL.md +65 -22
- package/docs/PUBLICATION.md +29 -3
- package/docs/RELEASE_NOTES_0_5_1.md +80 -0
- package/docs/RELEASE_REVIEW_0_5_1.md +54 -0
- package/docs/SELF_UPDATE.md +5 -1
- package/docs/UNION_GENERATION_0_5_2.md +32 -0
- package/docs/V0_3_DESIGN.md +2 -0
- package/docs/VERIFICATION.md +81 -4
- package/docs/WINDOWS_REQUIREMENTS.md +48 -0
- package/docs/WINDOWS_SUPPORT.md +78 -0
- package/docs/WSL_STRUCTURAL_0_5_3.md +30 -0
- package/index.js +15 -2
- package/lib/dependency-policy.js +89 -0
- package/lib/history.js +2 -2
- package/lib/http.js +5 -1
- package/lib/identity.js +22 -3
- package/lib/online.js +44 -18
- package/lib/self-update-policy.js +60 -26
- package/lib/self-update-store.js +21 -9
- package/lib/self-update.js +80 -29
- package/lib/service.js +437 -58
- package/lib/source.js +29 -0
- package/lib/staging.js +128 -30
- package/lib/union-generation.js +376 -0
- package/lib/union-service.js +83 -0
- package/lib/union-staging.js +325 -0
- package/lib/wsl-outcome.js +15 -0
- package/lib/wsl-policy.js +71 -5
- package/lib/wsl-proof.js +85 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +10 -50
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { boundedFile } from './file-read.js';
|
|
5
|
+
import { archiveKey, archivePath, PUBLIC_REGISTRY } from './source.js';
|
|
6
|
+
import { inspectPatches } from './patch-safety.js';
|
|
7
|
+
import { UNION_LIMITS, UNION_RELEASE_HASHES, canAdmitUnion, canonical, unionDigest, unionHash,
|
|
8
|
+
inspectUnionArchive, unionManifest, unionInventory, unionDeadline, unionPlainDirectory,
|
|
9
|
+
assertUnionDependencyPolicy, unionDependencySnapshot, verifyUnionPublicSnapshot,
|
|
10
|
+
verifyUnionSRI, unionSnapshotEvidence, validateUnionEvidence, unionPortableLayout,
|
|
11
|
+
unionRoutedManifest, buildUnionGeneration, verifyUnionInstalledEntries, unionRangeMatches } from './union-generation.js';
|
|
12
|
+
|
|
13
|
+
export { UNION_RELEASE_HASHES } from './union-generation.js';
|
|
14
|
+
export const canAdmit = canAdmitUnion;
|
|
15
|
+
const ORIGIN=PUBLIC_REGISTRY, SOURCE='derived-local-generation-not-npm', MAX_EVIDENCE=12*1024*1024;
|
|
16
|
+
const UUID=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/;
|
|
17
|
+
const SHA=/^[a-f0-9]{64}$/, GENERATION=/^g\/[a-f0-9]{32}$/;
|
|
18
|
+
const fail=code=>{throw Object.assign(Error(code),{code});};
|
|
19
|
+
const check=(condition,code)=>{if(!condition)fail(code);};
|
|
20
|
+
const same=(a,b)=>JSON.stringify(canonical(a))===JSON.stringify(canonical(b));
|
|
21
|
+
const boundedRecord=value=>{let text;try{text=JSON.stringify(value);}catch{fail('union-reference-invalid');}
|
|
22
|
+
check(text && Buffer.byteLength(text)<=512*1024,'union-reference-bound');return value;};
|
|
23
|
+
|
|
24
|
+
/** Pure reference validator for the identity store. Reopening additionally verifies
|
|
25
|
+
* all file-owned evidence/source/archive bytes; this function grants no provenance. */
|
|
26
|
+
export function validateUnionReference(reference) {
|
|
27
|
+
boundedRecord(reference);const r=reference?.runtimeGeneration;
|
|
28
|
+
check(reference?.name==='dsh-union-search' && Object.hasOwn(UNION_RELEASE_HASHES,reference.version)
|
|
29
|
+
&& reference.origin===ORIGIN && reference.originalRegistry===PUBLIC_REGISTRY
|
|
30
|
+
&& reference.installMode==='union-generation' && reference.originalSha256===UNION_RELEASE_HASHES[reference.version]
|
|
31
|
+
&& SHA.test(reference.sha256) && /^sha512-[A-Za-z0-9+/]+={0,2}$/.test(reference.integrity??''),'union-reference-identity');
|
|
32
|
+
check(r?.kind==='union-dependency' && r.source===SOURCE && GENERATION.test(r.generation??'')
|
|
33
|
+
&& Array.isArray(r.moduleAliases) && r.moduleAliases.length===0 && r.originalRuntimeBytesPreserved===true
|
|
34
|
+
&& r.legacyRootResourcesPreserved===true,'union-reference-generation');
|
|
35
|
+
check(UUID.test(r.stageKey??'') && reference.archiveKey===r.stageKey+'/package.tgz'
|
|
36
|
+
&& r.evidenceKey===r.stageKey+'/union-evidence.json' && SHA.test(r.evidenceSha256??''),'union-reference-stage-key');
|
|
37
|
+
check(Object.hasOwn(UNION_RELEASE_HASHES,r.rootOriginalVersion) && r.rootOriginalSha256===UNION_RELEASE_HASHES[r.rootOriginalVersion]
|
|
38
|
+
&& SHA.test(r.inventoryDigest??'') && SHA.test(r.layoutDigest??''),'union-reference-root');
|
|
39
|
+
const d=r.dependencyEvidence;
|
|
40
|
+
check(d && SHA.test(d.digest??'') && SHA.test(d.publicProofDigest??'') && SHA.test(d.topDigest??'')
|
|
41
|
+
&& d.layoutDigest===r.layoutDigest && Number.isSafeInteger(d.packageCount) && d.packageCount>=0 && d.packageCount<=UNION_LIMITS.packages
|
|
42
|
+
&& Number.isSafeInteger(d.fileCount) && d.fileCount>=0 && d.fileCount<=UNION_LIMITS.dependencyFiles,'union-reference-dependencies');
|
|
43
|
+
check(Array.isArray(r.retained) && r.retained.length<=UNION_LIMITS.oldGenerations,'union-retention-limit');
|
|
44
|
+
const seen=new Set([r.generation]);
|
|
45
|
+
for(const old of r.retained) {
|
|
46
|
+
check(GENERATION.test(old?.generation??'') && !seen.has(old.generation) && Object.hasOwn(UNION_RELEASE_HASHES,old.version)
|
|
47
|
+
&& old.originalSha256===UNION_RELEASE_HASHES[old.version] && SHA.test(old.dependencyDigest??'')
|
|
48
|
+
&& SHA.test(old.layoutDigest??'') && SHA.test(old.inventoryDigest??''),'union-reference-retained');seen.add(old.generation);
|
|
49
|
+
}
|
|
50
|
+
check(reference.manifest?.name===reference.name && reference.manifest?.version===reference.version
|
|
51
|
+
&& Array.isArray(reference.rows) && reference.rows.length>0 && reference.rows.length<=64
|
|
52
|
+
&& Array.isArray(reference.overrides) && reference.overrides.length===0,'union-reference-metadata');
|
|
53
|
+
return reference;
|
|
54
|
+
}
|
|
55
|
+
function sourceFootprint(bytes,version) {
|
|
56
|
+
check(unionHash(bytes)===UNION_RELEASE_HASHES[version],'union-archive-requires-new-review');
|
|
57
|
+
const entries=inspectUnionArchive(bytes),manifest=unionManifest(entries);
|
|
58
|
+
check(manifest.name==='dsh-union-search'&&manifest.version===version,'union-source-identity');
|
|
59
|
+
assertUnionDependencyPolicy(manifest,{root:true});
|
|
60
|
+
check(!entries.some(e=>e.name.split('/')[1]==='g'||e.name.split('/').includes('node_modules')),'union-source-layout');
|
|
61
|
+
const patches=typeof manifest.dsh?.bundle?.patch==='string'?[manifest.dsh.bundle.patch]:manifest.dsh?.bundle?.patch;
|
|
62
|
+
check(Array.isArray(patches)&&patches.length>0&&patches.length<=8,'union-source-patches');
|
|
63
|
+
const texts=patches.map(file=>{
|
|
64
|
+
check(typeof file==='string' && /^(?:\.\/)?[A-Za-z0-9._/-]+$/.test(file) && !file.replace(/^\.\//,'').split('/').some(part=>!part||part==='.'||part==='..'),'union-source-patches');
|
|
65
|
+
const entry=entries.find(e=>e.name==='package/'+file.replace(/^\.\//,''));check(entry && entry.bytes.length<=256*1024,'union-source-patches');return entry.bytes.toString('utf8');
|
|
66
|
+
});
|
|
67
|
+
return {entries,manifest,rows:inspectPatches(texts,manifest.name),overrides:[]};
|
|
68
|
+
}
|
|
69
|
+
function retainedRecord(record) {
|
|
70
|
+
return {generation:record.generation,version:record.version,originalSha256:record.originalSha256,
|
|
71
|
+
dependencyDigest:record.dependencies.graphDigest,layoutDigest:record.dependencies.layoutDigest,inventoryDigest:record.inventoryDigest};
|
|
72
|
+
}
|
|
73
|
+
function runtimeRecord(document,evidenceSha256) {
|
|
74
|
+
const active=document.generations.find(g=>g.generation===document.generation),e=active.dependencies;
|
|
75
|
+
return {kind:'union-dependency',source:SOURCE,generation:document.generation,moduleAliases:[],
|
|
76
|
+
originalRuntimeBytesPreserved:true,legacyRootResourcesPreserved:true,
|
|
77
|
+
stageKey:document.stageKey,evidenceKey:document.stageKey+'/union-evidence.json',evidenceSha256,
|
|
78
|
+
rootOriginalSha256:document.rootOriginalSha256,rootOriginalVersion:document.rootOriginalVersion,
|
|
79
|
+
retained:document.generations.filter(g=>g.generation!==document.generation).map(retainedRecord),
|
|
80
|
+
dependencyEvidence:{digest:e.graphDigest,publicProofDigest:e.proof.digest,topDigest:unionDigest(e.graph.top),
|
|
81
|
+
layoutDigest:e.layoutDigest,packageCount:e.graph.packages.length,fileCount:e.fileCount},
|
|
82
|
+
layoutDigest:e.layoutDigest,inventoryDigest:document.inventoryDigest};
|
|
83
|
+
}
|
|
84
|
+
/** Independent Union source/generation stager. RegistryStager remains the canonical
|
|
85
|
+
* original-byte fetch/cache authority. This module never writes a Host/profile file. */
|
|
86
|
+
export class UnionGenerationStager {
|
|
87
|
+
constructor(root,{registryStager,fetcher=fetch}={}) {
|
|
88
|
+
check(registryStager && typeof registryStager.stage==='function' && typeof registryStager.reference==='function'
|
|
89
|
+
&& typeof registryStager.reopen==='function','union-registry-stager-required');
|
|
90
|
+
this.root=resolve(root);this.registryStager=registryStager;this.fetcher=fetcher;
|
|
91
|
+
}
|
|
92
|
+
canAdmit(name,from,to) {return canAdmit(name,from,to);}
|
|
93
|
+
async _canonical(version,signal) {
|
|
94
|
+
check(Object.hasOwn(UNION_RELEASE_HASHES,version),'union-version-not-reviewed');signal.throwIfAborted();
|
|
95
|
+
const original=await this.registryStager.stage('dsh-union-search',version,{signal,origin:PUBLIC_REGISTRY});
|
|
96
|
+
check(original.origin===PUBLIC_REGISTRY && original.version===version && original.name==='dsh-union-search'
|
|
97
|
+
&& original.runtimeGeneration==null && original.originalSha256===UNION_RELEASE_HASHES[version]
|
|
98
|
+
&& original.sha256===original.originalSha256,'union-canonical-source-required');
|
|
99
|
+
await this.registryStager.verify(original);
|
|
100
|
+
await unionPlainDirectory(dirname(original.sourceArchivePath));
|
|
101
|
+
const bytes=await boundedFile(original.sourceArchivePath,UNION_LIMITS.compressed);verifyUnionSRI(bytes,original.integrity);
|
|
102
|
+
const footprint=sourceFootprint(bytes,version);
|
|
103
|
+
check(same(original.manifest,footprint.manifest)&&same(original.rows,footprint.rows),'union-source-metadata');
|
|
104
|
+
return {original,bytes,...footprint};
|
|
105
|
+
}
|
|
106
|
+
async stagePair({name,from,to,packageDirectory,knownReference,signal}={}) {
|
|
107
|
+
check(canAdmit(name,from,to),'union-version-not-reviewed');signal=unionDeadline(signal,180000);
|
|
108
|
+
// Both canonical originals and the failed-target recovery are prepared BEFORE
|
|
109
|
+
// any caller is permitted to invoke remove/install through the public Host.
|
|
110
|
+
const old=await this._canonical(from,signal),nextSource=await this._canonical(to,signal);
|
|
111
|
+
check(same(old.manifest.dependencies??{},nextSource.manifest.dependencies??{}),'union-declaration-changed');
|
|
112
|
+
let baseline,rootSource=old,retained=[],snapshotDirectory=packageDirectory,known;
|
|
113
|
+
if(knownReference) {
|
|
114
|
+
validateUnionReference(knownReference);check(knownReference.version===from,'union-current-version-mismatch');
|
|
115
|
+
known=await this._read(knownReference,signal);await verifyUnionInstalledEntries(known.entries,packageDirectory,{signal});
|
|
116
|
+
baseline={kind:'union',reference:this.reference(known.staged)};
|
|
117
|
+
rootSource=await this._sourceFromDocument(known,known.document.rootOriginalVersion,signal);
|
|
118
|
+
retained=known.document.generations.map(record=>({record,entries:known.entries.filter(e=>e.name.startsWith('package/'+record.generation+'/'))}));
|
|
119
|
+
snapshotDirectory=join(packageDirectory,knownReference.runtimeGeneration.generation);
|
|
120
|
+
} else {
|
|
121
|
+
await verifyUnionInstalledEntries(old.entries,packageDirectory,{signal});
|
|
122
|
+
baseline={kind:'public',reference:this.registryStager.reference(old.original)};
|
|
123
|
+
}
|
|
124
|
+
// The recovery additionally retains next's resources. Refuse exhaustion now,
|
|
125
|
+
// not after removal; never silently drop an old loaded generation.
|
|
126
|
+
check(retained.length+1<=UNION_LIMITS.oldGenerations,'union-retention-limit');
|
|
127
|
+
const snapshot=await unionDependencySnapshot(snapshotDirectory,old.manifest,{signal});
|
|
128
|
+
const proof=await verifyUnionPublicSnapshot(snapshot,{fetcher:this.fetcher,signal});
|
|
129
|
+
const dependencies=unionSnapshotEvidence(snapshot,proof);
|
|
130
|
+
baseline.dependencyEvidence={digest:dependencies.graphDigest,layoutDigest:dependencies.layoutDigest};
|
|
131
|
+
if(known) {
|
|
132
|
+
const active=known.document.generations.find(g=>g.generation===knownReference.runtimeGeneration.generation);
|
|
133
|
+
check(active.dependencies.graphDigest===dependencies.graphDigest && active.dependencies.layoutDigest===dependencies.layoutDigest,'union-current-dependency-changed');
|
|
134
|
+
}
|
|
135
|
+
const sourceMap=new Map([[from,old],[to,nextSource],[rootSource.manifest.version,rootSource]]);
|
|
136
|
+
const publicArchives=new Map(snapshot.publicArchives??[]);
|
|
137
|
+
if(known) {
|
|
138
|
+
for(const [hash,bytes] of known.publicArchives)publicArchives.set(hash,bytes);
|
|
139
|
+
for(const source of known.document.sources)if(!sourceMap.has(source.version))sourceMap.set(source.version,await this._sourceFromDocument(known,source.version,signal));
|
|
140
|
+
}
|
|
141
|
+
const next=await this._persist(nextSource,snapshot,dependencies,rootSource,retained,sourceMap,signal,publicArchives);
|
|
142
|
+
const nextRead=await this._read(this.reference(next),signal),nextRecord=nextRead.document.generations.find(g=>g.generation===next.runtimeGeneration.generation);
|
|
143
|
+
const previous=await this._persist(old,snapshot,dependencies,rootSource,[...retained,{record:nextRecord,
|
|
144
|
+
entries:nextRead.entries.filter(e=>e.name.startsWith('package/'+nextRecord.generation+'/'))}],sourceMap,signal,publicArchives);
|
|
145
|
+
check(previous.runtimeGeneration.generation!==next.runtimeGeneration.generation
|
|
146
|
+
&& (!knownReference || previous.runtimeGeneration.generation!==knownReference.runtimeGeneration.generation),'union-recovery-token-reused');
|
|
147
|
+
return {next,previous,baseline};
|
|
148
|
+
}
|
|
149
|
+
async _sourceFromDocument(read,version,signal) {
|
|
150
|
+
signal.throwIfAborted();const info=read.document.sources.find(s=>s.version===version);check(info,'union-owned-source-missing');
|
|
151
|
+
const bytes=await boundedFile(join(dirname(read.staged.archivePath),'source-'+version+'.tgz'),UNION_LIMITS.compressed);
|
|
152
|
+
verifyUnionSRI(bytes,info.integrity);check(unionHash(bytes)===info.sha256,'union-owned-source-changed');
|
|
153
|
+
return {bytes,integrity:info.integrity,...sourceFootprint(bytes,version)};
|
|
154
|
+
}
|
|
155
|
+
async _persist(source,snapshot,dependencies,rootSource,retained,sourceMap,signal,publicArchives=snapshot.publicArchives) {
|
|
156
|
+
signal.throwIfAborted();check(retained.length<=UNION_LIMITS.oldGenerations,'union-retention-limit');
|
|
157
|
+
await mkdir(this.root,{recursive:true,mode:0o700});await unionPlainDirectory(this.root);
|
|
158
|
+
const stageKey=randomUUID(),directory=join(this.root,stageKey);await mkdir(directory,{mode:0o700});
|
|
159
|
+
const generation='g/'+randomUUID().replaceAll('-','');
|
|
160
|
+
const built=buildUnionGeneration(source.bytes,snapshot,{rootBytes:rootSource.bytes,generation,
|
|
161
|
+
retained:retained.map(old=>({generation:old.record.generation,entries:old.entries}))});
|
|
162
|
+
const activeEntries=inspectUnionArchive(built.bytes).filter(e=>e.name.startsWith('package/'+generation+'/'));
|
|
163
|
+
const active={generation,version:source.manifest.version,originalSha256:unionHash(source.bytes),
|
|
164
|
+
dependencies,inventoryDigest:unionDigest(unionInventory(activeEntries))};
|
|
165
|
+
const sources=[...sourceMap].map(([version,s])=>({version,sha256:unionHash(s.bytes),integrity:s.original?.integrity??s.integrity})).sort((a,b)=>a.version.localeCompare(b.version));
|
|
166
|
+
const document={schemaVersion:1,stageKey,generation,rootOriginalVersion:rootSource.manifest.version,
|
|
167
|
+
rootOriginalSha256:unionHash(rootSource.bytes),inventoryDigest:built.inventoryDigest,
|
|
168
|
+
generations:[active,...retained.map(old=>old.record)],sources};
|
|
169
|
+
const evidenceBytes=Buffer.from(JSON.stringify(document));check(evidenceBytes.length<=MAX_EVIDENCE,'union-evidence-bound');
|
|
170
|
+
const archive=join(directory,'package.tgz'),sourcePath=join(directory,'source-package.tgz');
|
|
171
|
+
const neededProofs=new Map(document.generations.flatMap(g=>g.dependencies.proof.packages).map(p=>[p.sha256,p]));
|
|
172
|
+
check(neededProofs.size<=UNION_LIMITS.packages*2,'union-public-source-bound');let publicBytes=0;
|
|
173
|
+
for(const [hash,proof] of neededProofs) {
|
|
174
|
+
const bytes=publicArchives?.get(hash);check(bytes&&unionHash(bytes)===hash,'union-public-source-missing');
|
|
175
|
+
verifyUnionSRI(bytes,proof.integrity);publicBytes+=bytes.length;check(publicBytes<=UNION_LIMITS.archive,'union-public-source-bound');
|
|
176
|
+
await writeFile(join(directory,'dependency-'+hash+'.tgz'),bytes,{mode:0o600,flag:'wx'});
|
|
177
|
+
}
|
|
178
|
+
for(const [version,s] of sourceMap)await writeFile(join(directory,'source-'+version+'.tgz'),s.bytes,{mode:0o600,flag:'wx'});
|
|
179
|
+
await writeFile(sourcePath,source.bytes,{mode:0o600,flag:'wx'});
|
|
180
|
+
await writeFile(join(directory,'union-evidence.json'),evidenceBytes,{mode:0o600,flag:'wx'});
|
|
181
|
+
await writeFile(archive,built.bytes,{mode:0o600,flag:'wx'});signal.throwIfAborted();
|
|
182
|
+
const staged={name:source.manifest.name,version:source.manifest.version,origin:ORIGIN,originalRegistry:PUBLIC_REGISTRY,
|
|
183
|
+
installMode:'union-generation',archivePath:archive,sourceArchivePath:sourcePath,manifest:source.manifest,rows:source.rows,overrides:[],
|
|
184
|
+
originalSha256:unionHash(source.bytes),sha256:built.sha256,integrity:source.original?.integrity??source.integrity,
|
|
185
|
+
size:built.bytes.length,runtimeGeneration:runtimeRecord(document,unionHash(evidenceBytes))};
|
|
186
|
+
await this.verify(staged,signal);return staged;
|
|
187
|
+
}
|
|
188
|
+
reference(staged) {
|
|
189
|
+
const key=archiveKey(this.root,staged.archivePath);check(key,'union-untrusted-archive-reference');
|
|
190
|
+
return validateUnionReference({name:staged.name,version:staged.version,origin:ORIGIN,originalRegistry:staged.originalRegistry,
|
|
191
|
+
installMode:'union-generation',archiveKey:key,sha256:staged.sha256,originalSha256:staged.originalSha256,
|
|
192
|
+
integrity:staged.integrity,manifest:staged.manifest,rows:staged.rows,overrides:staged.overrides??[],runtimeGeneration:staged.runtimeGeneration});
|
|
193
|
+
}
|
|
194
|
+
async _read(reference,signal) {
|
|
195
|
+
validateUnionReference(reference);signal=unionDeadline(signal);signal.throwIfAborted();
|
|
196
|
+
const path=archivePath(this.root,reference.archiveKey),directory=dirname(path);
|
|
197
|
+
await unionPlainDirectory(this.root);await unionPlainDirectory(directory);
|
|
198
|
+
check(basename(directory)===reference.runtimeGeneration.stageKey,'union-stage-key');
|
|
199
|
+
const bytes=await boundedFile(path,UNION_LIMITS.compressed);check(unionHash(bytes)===reference.sha256,'union-staged-package-changed');
|
|
200
|
+
const entries=inspectUnionArchive(bytes),evidenceBytes=await boundedFile(join(directory,'union-evidence.json'),MAX_EVIDENCE);
|
|
201
|
+
check(unionHash(evidenceBytes)===reference.runtimeGeneration.evidenceSha256,'union-evidence-changed');
|
|
202
|
+
let document;try{document=JSON.parse(evidenceBytes.toString('utf8'));}catch{fail('union-evidence-invalid');}
|
|
203
|
+
check(document?.schemaVersion===1 && document.stageKey===reference.runtimeGeneration.stageKey && document.generation===reference.runtimeGeneration.generation
|
|
204
|
+
&& Array.isArray(document.generations) && document.generations.length>=1 && document.generations.length<=UNION_LIMITS.oldGenerations+1
|
|
205
|
+
&& Array.isArray(document.sources) && document.sources.length>=1 && document.sources.length<=2,'union-evidence-document');
|
|
206
|
+
check(same(runtimeRecord(document,unionHash(evidenceBytes)),reference.runtimeGeneration),'union-generation-evidence-changed');
|
|
207
|
+
const originals=new Map();
|
|
208
|
+
for(const source of document.sources) {
|
|
209
|
+
signal.throwIfAborted();check(Object.hasOwn(UNION_RELEASE_HASHES,source.version)&&source.sha256===UNION_RELEASE_HASHES[source.version]
|
|
210
|
+
&& !originals.has(source.version),'union-owned-source-identity');
|
|
211
|
+
const sourceBytes=await boundedFile(join(directory,'source-'+source.version+'.tgz'),UNION_LIMITS.compressed);
|
|
212
|
+
verifyUnionSRI(sourceBytes,source.integrity);const footprint=sourceFootprint(sourceBytes,source.version);originals.set(source.version,{...footprint,bytes:sourceBytes});
|
|
213
|
+
}
|
|
214
|
+
const source=originals.get(reference.version),root=originals.get(document.rootOriginalVersion);
|
|
215
|
+
check(source && root && unionHash(root.bytes)===document.rootOriginalSha256,'union-root-source-changed');
|
|
216
|
+
const ownSource=await boundedFile(join(directory,'source-package.tgz'),UNION_LIMITS.compressed);
|
|
217
|
+
verifyUnionSRI(ownSource,reference.integrity);check(ownSource.equals(source.bytes),'union-source-package-changed');
|
|
218
|
+
check(same(source.manifest,reference.manifest)&&same(source.rows,reference.rows)&&same(source.overrides,reference.overrides),'union-identity-metadata-changed');
|
|
219
|
+
const expected=[...root.entries.map(e=>e.name==='package/package.json'?{...e,bytes:Buffer.from(JSON.stringify(unionRoutedManifest(source.manifest,document.generation),null,2))}:e)];
|
|
220
|
+
const tokens=new Set(),publicArchives=new Map(),publicInventory=new Map();let publicSourceBytes=0;
|
|
221
|
+
for(const record of document.generations) {
|
|
222
|
+
signal.throwIfAborted();check(GENERATION.test(record.generation??'')&&!tokens.has(record.generation),'union-retained-token');tokens.add(record.generation);
|
|
223
|
+
const original=originals.get(record.version);check(original && record.originalSha256===UNION_RELEASE_HASHES[record.version],'union-retained-original');
|
|
224
|
+
validateUnionEvidence(record.dependencies);
|
|
225
|
+
for(const proof of record.dependencies.proof.packages) {
|
|
226
|
+
let archive=publicArchives.get(proof.sha256);
|
|
227
|
+
if(!archive) {
|
|
228
|
+
check(publicArchives.size<UNION_LIMITS.packages*2,'union-public-source-bound');
|
|
229
|
+
archive=await boundedFile(join(directory,'dependency-'+proof.sha256+'.tgz'),16*1024*1024);
|
|
230
|
+
publicSourceBytes+=archive.length;check(publicSourceBytes<=UNION_LIMITS.archive,'union-public-source-bound');
|
|
231
|
+
check(unionHash(archive)===proof.sha256,'union-public-source-changed');
|
|
232
|
+
const publicEntries=inspectUnionArchive(archive),publicManifest=unionManifest(publicEntries);
|
|
233
|
+
assertUnionDependencyPolicy(publicManifest);
|
|
234
|
+
check(publicManifest.name===proof.name&&publicManifest.version===proof.version
|
|
235
|
+
&& !publicEntries.some(e=>e.name.split('/').includes('node_modules')),'union-public-source-identity');
|
|
236
|
+
publicInventory.set(proof.sha256,unionInventory(publicEntries.map(e=>({...e,name:e.name.slice(8)}))));
|
|
237
|
+
publicArchives.set(proof.sha256,archive);
|
|
238
|
+
}
|
|
239
|
+
verifyUnionSRI(archive,proof.integrity);
|
|
240
|
+
const inventory=publicInventory.get(proof.sha256);
|
|
241
|
+
check(proof.files===inventory.length&&proof.inventoryDigest===unionDigest(inventory),'union-public-source-inventory');
|
|
242
|
+
}
|
|
243
|
+
check(same(original.manifest.dependencies??{},record.dependencies.graph.declaration),'union-root-top-proof-binding');
|
|
244
|
+
const prefix='package/'+record.generation+'/',generationEntries=entries.filter(e=>e.name.startsWith(prefix));
|
|
245
|
+
check(unionDigest(unionInventory(generationEntries))===record.inventoryDigest,'union-generation-inventory-changed');
|
|
246
|
+
const files=new Map(generationEntries.map(e=>[e.name.slice(prefix.length),e.bytes]));
|
|
247
|
+
const packages=record.dependencies.graph.packages.map(pkg=>{
|
|
248
|
+
const location=record.dependencies.graph.layout.find(row=>row.key===pkg.name+'@'+pkg.version);check(location,'union-layout-package');
|
|
249
|
+
const pkgFiles=pkg.files.map(([name,hash,size])=>{
|
|
250
|
+
const bytes=files.get(location.path+'/'+name);check(bytes&&bytes.length===size&&unionHash(bytes)===hash,'union-dependency-inventory-changed');return {name,bytes};
|
|
251
|
+
});
|
|
252
|
+
const manifest=unionManifest(pkgFiles.map(f=>({...f,name:'package/'+f.name})));assertUnionDependencyPolicy(manifest);
|
|
253
|
+
check(manifest.name===pkg.name&&manifest.version===pkg.version,'union-dependency-identity');
|
|
254
|
+
check(same(Object.keys(manifest.dependencies??{}).sort(),pkg.edges.map(e=>e.name).sort()),'union-dependency-edges-changed');
|
|
255
|
+
for(const edge of pkg.edges) {
|
|
256
|
+
check(manifest.dependencies[edge.name]===edge.range,'union-dependency-range');
|
|
257
|
+
if(edge.external)check(edge.name==='@deepseek-ai/schemastery','union-external-runtime');
|
|
258
|
+
else {const target=record.dependencies.graph.packages.find(p=>p.name+'@'+p.version===edge.target);
|
|
259
|
+
check(target&&target.name===edge.name&&unionRangeMatches(target.version,edge.range),'union-dependency-range');}
|
|
260
|
+
}
|
|
261
|
+
return {...pkg,key:pkg.name+'@'+pkg.version,files:pkgFiles,manifest};
|
|
262
|
+
});
|
|
263
|
+
const top=record.dependencies.graph.top;
|
|
264
|
+
check(same(Object.keys(original.manifest.dependencies??{}).sort(),top.map(e=>e.name).sort()),'union-root-top-proof-binding');
|
|
265
|
+
for(const edge of top) {
|
|
266
|
+
check(original.manifest.dependencies[edge.name]===edge.range,'union-root-top-proof-binding');
|
|
267
|
+
if(edge.external)check(edge.name==='@deepseek-ai/schemastery','union-external-runtime');
|
|
268
|
+
else {const target=packages.find(p=>p.key===edge.target);check(target&&target.name===edge.name&&unionRangeMatches(target.version,edge.range),'union-root-top-proof-binding');}
|
|
269
|
+
}
|
|
270
|
+
const reconstructed=unionPortableLayout({packages,top});
|
|
271
|
+
check(same(reconstructed.layout,record.dependencies.graph.layout)&&reconstructed.layoutDigest===record.dependencies.layoutDigest
|
|
272
|
+
&& same(unionInventory(reconstructed.portableFiles),record.dependencies.portableInventory),'union-layout-changed');
|
|
273
|
+
expected.push(...original.entries.map(e=>({...e,name:prefix+e.name.slice(8)})),
|
|
274
|
+
...reconstructed.portableFiles.map(e=>({...e,name:prefix+e.name})));
|
|
275
|
+
}
|
|
276
|
+
check(tokens.has(document.generation) && expected.length===entries.length
|
|
277
|
+
&& same(unionInventory(expected),unionInventory(entries)) && document.inventoryDigest===unionDigest(unionInventory(entries)),'union-full-inventory-changed');
|
|
278
|
+
const staged={...reference,archivePath:path,sourceArchivePath:join(directory,'source-package.tgz'),size:bytes.length};
|
|
279
|
+
return {staged,entries,document,publicArchives};
|
|
280
|
+
}
|
|
281
|
+
async reopen(reference,signal) {return (await this._read(reference,signal)).staged;}
|
|
282
|
+
async verify(staged,signal) {await this._read(this.reference(staged),signal);return {verified:true,sha256:staged.sha256};}
|
|
283
|
+
async verifyInstalledArchive(reference,packageDirectory,{signal}={}) {
|
|
284
|
+
const read=await this._read(reference,signal);return verifyUnionInstalledEntries(read.entries,packageDirectory,{signal});
|
|
285
|
+
}
|
|
286
|
+
async verifyBaseline(baseline,packageDirectory,signal) {
|
|
287
|
+
signal=unionDeadline(signal,60000);check(baseline?.kind==='public'||baseline?.kind==='union','union-baseline-invalid');
|
|
288
|
+
check(SHA.test(baseline.dependencyEvidence?.digest??'')&&SHA.test(baseline.dependencyEvidence?.layoutDigest??''),'union-baseline-dependencies');
|
|
289
|
+
if(baseline.kind==='union') {
|
|
290
|
+
const verified=await this.verifyInstalledArchive(baseline.reference,packageDirectory,{signal});
|
|
291
|
+
const snapshot=await unionDependencySnapshot(join(packageDirectory,baseline.reference.runtimeGeneration.generation),baseline.reference.manifest,{signal});
|
|
292
|
+
check(snapshot.digest===baseline.dependencyEvidence.digest&&snapshot.layoutDigest===baseline.dependencyEvidence.layoutDigest,'union-baseline-dependency-changed');
|
|
293
|
+
return verified;
|
|
294
|
+
}
|
|
295
|
+
const ref=baseline.reference;check(ref?.name==='dsh-union-search'&&Object.hasOwn(UNION_RELEASE_HASHES,ref.version)
|
|
296
|
+
&& ref.origin===PUBLIC_REGISTRY&&ref.runtimeGeneration==null&&ref.originalSha256===UNION_RELEASE_HASHES[ref.version]
|
|
297
|
+
&& ref.sha256===ref.originalSha256,'union-baseline-source');
|
|
298
|
+
const staged=await this.registryStager.reopen(ref);signal.throwIfAborted();await unionPlainDirectory(dirname(staged.sourceArchivePath));
|
|
299
|
+
const bytes=await boundedFile(staged.sourceArchivePath,UNION_LIMITS.compressed);verifyUnionSRI(bytes,ref.integrity);
|
|
300
|
+
const source=sourceFootprint(bytes,ref.version);
|
|
301
|
+
const verified=await verifyUnionInstalledEntries(source.entries,packageDirectory,{signal});
|
|
302
|
+
const snapshot=await unionDependencySnapshot(packageDirectory,source.manifest,{signal});
|
|
303
|
+
check(snapshot.digest===baseline.dependencyEvidence.digest&&snapshot.layoutDigest===baseline.dependencyEvidence.layoutDigest,'union-baseline-dependency-changed');
|
|
304
|
+
return verified;
|
|
305
|
+
}
|
|
306
|
+
/** Manual recovery must supply a positively verified currently installed union
|
|
307
|
+
* reference. Unknown or partially installed failures cannot be guessed safe. */
|
|
308
|
+
async prepareRecovery(reference,{knownCurrentReference,packageDirectory,signal}={}) {
|
|
309
|
+
validateUnionReference(reference);check(knownCurrentReference&&packageDirectory,'union-recovery-current-reference-required');
|
|
310
|
+
validateUnionReference(knownCurrentReference);signal=unionDeadline(signal,180000);
|
|
311
|
+
const current=await this._read(knownCurrentReference,signal);
|
|
312
|
+
await verifyUnionInstalledEntries(current.entries,packageDirectory,{signal});
|
|
313
|
+
const target=await this._canonical(reference.version,signal),root=await this._sourceFromDocument(current,current.document.rootOriginalVersion,signal);
|
|
314
|
+
check(same(target.manifest.dependencies??{},unionManifest(current.entries.filter(e=>e.name.startsWith('package/'+knownCurrentReference.runtimeGeneration.generation+'/'))
|
|
315
|
+
.map(e=>({...e,name:'package/'+e.name.slice(('package/'+knownCurrentReference.runtimeGeneration.generation+'/').length)}))).dependencies??{}),'union-declaration-changed');
|
|
316
|
+
const snapshot=await unionDependencySnapshot(join(packageDirectory,knownCurrentReference.runtimeGeneration.generation),target.manifest,{signal});
|
|
317
|
+
const proof=await verifyUnionPublicSnapshot(snapshot,{fetcher:this.fetcher,signal}),dependencies=unionSnapshotEvidence(snapshot,proof);
|
|
318
|
+
check(current.document.generations.length<=UNION_LIMITS.oldGenerations,'union-retention-limit');
|
|
319
|
+
const sources=new Map([[target.manifest.version,target],[root.manifest.version,root]]);
|
|
320
|
+
for(const source of current.document.sources)if(!sources.has(source.version))sources.set(source.version,await this._sourceFromDocument(current,source.version,signal));
|
|
321
|
+
const publicArchives=new Map([...current.publicArchives,...(snapshot.publicArchives??[])]);
|
|
322
|
+
return this._persist(target,snapshot,dependencies,root,current.document.generations.map(record=>({record,
|
|
323
|
+
entries:current.entries.filter(e=>e.name.startsWith('package/'+record.generation+'/'))})),sources,signal,publicArchives);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {archiveKey} from './source.js';
|
|
2
|
+
export const completeWslReply=value=>value&&['applied','failed','cancelled','restart-required','overridden'].includes(value.application);
|
|
3
|
+
export function unknownWsl(item,error){item.status='unknown';item.wslOutcomeUnknown=true;return {application:'unknown',error:{code:'wsl-generation-outcome-unknown',diagnostic:String(error?.message??error??'Incomplete Host reply')}};}
|
|
4
|
+
export async function persistWslOutcome(service,job,item,bundle,recovery){
|
|
5
|
+
const unknown=async()=>{await service.identities.settle(item.name,null,{...recovery,status:'unknown',expectedFingerprint:service.fingerprint(bundle)});delete item.recoveryId;delete item.restoreVersion;};
|
|
6
|
+
if(item.wslOutcomeUnknown||item.status==='unknown'){await unknown();return;}
|
|
7
|
+
if(['preparing','waiting','skipped'].includes(item.status)&&!item.wslDispatchStarted){await service.identities.settle(item.name,service.lineageOf(bundle),job.record.operation==='batch-restore'?{...recovery,status:'failed',dispatchStarted:false}:null);delete item.recoveryId;delete item.restoreVersion;return;}
|
|
8
|
+
const key=archiveKey(service.stager.root,bundle?.source),reference=[item.nextReference,item.previousReference].find(value=>value?.version===bundle?.version&&value.archiveKey===key);
|
|
9
|
+
let verified=null;if(reference)try{await service.stager.verifyInstalledArchive(reference,await service.resolvePackage(item.name));verified=reference;}catch{}
|
|
10
|
+
const success=['updated','restored'].includes(item.status)||item.restore?.application==='applied'&&item.restoreVerification?.package.status==='verified';
|
|
11
|
+
if(success){if(!verified){item.result={...item.result,observedApplication:item.result?.application,application:'unknown'};unknownWsl(item,'Installed WSL identity changed after outcome verification');await unknown();return;}await service.identities.settle(item.name,verified,null);delete item.recoveryId;delete item.restoreVersion;return;}
|
|
12
|
+
const ours=!bundle?.installed||verified||service.fingerprint(bundle)===item.fingerprint;
|
|
13
|
+
await service.identities.settle(item.name,verified,ours?{...recovery,status:'failed',expectedFingerprint:service.fingerprint(bundle)}:null);
|
|
14
|
+
if(ours){item.recoveryId=recovery.id;item.restoreVersion=recovery.from;}else{delete item.recoveryId;delete item.restoreVersion;}
|
|
15
|
+
}
|
package/lib/wsl-policy.js
CHANGED
|
@@ -1,18 +1,80 @@
|
|
|
1
1
|
import { parseDocument } from 'yaml';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
2
3
|
|
|
4
|
+
export const WSL_NAME = 'dsh-plugin-wsl-env';
|
|
5
|
+
export const WSL_GENERATION_KIND = 'wsl-structural-v1';
|
|
6
|
+
export const WSL_LEGACY_ORIGINALS = Object.freeze({
|
|
7
|
+
'0.24.0':'1d03208d3e58596d155b052c8a0e9eab7a539ac45def89ad53052fa1746104b7',
|
|
8
|
+
'0.26.2':'0761e085453faa1b32ef8b44e8099bc938b62662b11b74e23f7946f4ef75fe98',
|
|
9
|
+
'0.28.0':'c137376aba2b3973690ecef93baed9e4de79a22825ab5a50e92ae9ad2881e694',
|
|
10
|
+
});
|
|
11
|
+
export const WSL_PATCH_CONTRACT = '5aa75e4ace76675fefbd26fb59aedf076cd06957e615685057afd9a1815fc183';
|
|
12
|
+
export const wslCanonical = value => Array.isArray(value) ? value.map(wslCanonical) : value && typeof value === 'object' ? Object.fromEntries(Object.keys(value).sort().map(key=>[key,wslCanonical(value[key])])) : value;
|
|
13
|
+
export const wslHash = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
14
|
+
/** A route candidate, not installation permission. Original archive/contract checks remain mandatory. */
|
|
3
15
|
export function isGenerationSupported(manifest) {
|
|
4
|
-
return manifest?.name ===
|
|
16
|
+
return manifest?.name === WSL_NAME && /^\d+\.\d+\.\d+$/.test(manifest.version??'')
|
|
17
|
+
&& manifest.version.split('.').map(Number).every(Number.isSafeInteger);
|
|
5
18
|
}
|
|
19
|
+
export function isLegacyWsl(manifest) { return manifest?.name===WSL_NAME && Object.hasOwn(WSL_LEGACY_ORIGINALS,manifest.version??''); }
|
|
20
|
+
const WSL_PEERS = ['@deepseek-ai/cordis','@deepseek-ai/dsh-bash-local','@deepseek-ai/dsh-fs','@deepseek-ai/dsh-fs-local','@deepseek-ai/dsh-fs-patch','@deepseek-ai/dsh-host-directory-picker','@deepseek-ai/dsh-sandbox','@deepseek-ai/dsh-subprocess','@deepseek-ai/dsh-subprocess-local','@deepseek-ai/dsh-tools','@deepseek-ai/schemastery'];
|
|
21
|
+
const WSL_CLIENT = {platform:'web',immediately:true,inject:['@deepseek-ai/dsh-api-remotes','@deepseek-ai/dsh-client-ui-slots','@deepseek-ai/dsh-client-ui-layout','@deepseek-ai/dsh-client-ui-sidebar','@deepseek-ai/dsh-client-ui-workspace','@deepseek-ai/dsh-client-ui-conversation','@deepseek-ai/dsh-client-ui-context-menu','@deepseek-ai/dsh-client-ui-session']};
|
|
22
|
+
const WSL_NATIVE = new Set(['agent/native/linux-aarch64/dsh-wsl-agent','agent/native/linux-x86_64/dsh-wsl-agent']);
|
|
23
|
+
/** Validate a modern published archive without executing plugin, YAML expressions or native assets. */
|
|
24
|
+
export function inspectWslArchivePolicy(manifest, entries) {
|
|
25
|
+
if(!isGenerationSupported(manifest))throw Error('wsl-version-format-unsupported');
|
|
26
|
+
if(isLegacyWsl(manifest))return {kind:'legacy-reviewed-original'};
|
|
27
|
+
if(manifest.type!=='module'||Object.keys(manifest.dependencies??{}).length||Object.keys(manifest.optionalDependencies??{}).length)throw Error('wsl-runtime-dependency-contract-changed');
|
|
28
|
+
for(const key of ['bin','gypfile','imports','workspaces','overrides','resolutions','pnpm','bundledDependencies','bundleDependencies'])if(manifest[key]!=null&&manifest[key]!==false)throw Error('wsl-package-resolution-contract-changed');
|
|
29
|
+
for(const key of ['preinstall','install','postinstall','prepare','prepack','postpack'])if(manifest.scripts?.[key])throw Error('package-install-scripts-require-separate-review');
|
|
30
|
+
if(JSON.stringify(wslCanonical(manifest.dsh?.client))!==JSON.stringify(wslCanonical(WSL_CLIENT)))throw Error('wsl-client-contract-changed');
|
|
31
|
+
if(JSON.stringify(Object.keys(manifest.peerDependencies??{}).sort())!==JSON.stringify(WSL_PEERS))throw Error('wsl-peer-contract-changed');
|
|
32
|
+
if(Object.values(manifest.peerDependencies).some(value=>typeof value!=='string'||value.length>128||!/^[\d\s.~^<>=*|+a-zA-Z-]+$/.test(value)))throw Error('wsl-peer-contract-changed');
|
|
33
|
+
const files=new Map(),directoryCases=new Map();
|
|
34
|
+
for(const entry of entries){
|
|
35
|
+
const file=entry.name.slice(8),parts=file.split('/');
|
|
36
|
+
if(!entry.name.startsWith('package/')||parts.some(part=>!part||part==='.'||part==='..'||/[<>:"\\|?*\x00-\x1f]/.test(part)||/[. ]$/.test(part)||/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(part)))throw Error('wsl-archive-path-unsupported');
|
|
37
|
+
const lower=file.toLowerCase();if(files.has(lower))throw Error('wsl-archive-case-collision');files.set(lower,entry);
|
|
38
|
+
for(let depth=1;depth<parts.length;depth++){const dir=parts.slice(0,depth).join('/'),key=dir.toLowerCase();if(directoryCases.has(key)&&directoryCases.get(key)!==dir)throw Error('wsl-archive-case-collision');directoryCases.set(key,dir);}
|
|
39
|
+
const native=/\.(?:node|dll|exe|so|dylib)$/i.test(file)||file.includes('/native/')||entry.bytes.subarray(0,4).equals(Buffer.from([127,69,76,70]))||entry.bytes.subarray(0,2).toString('ascii')==='MZ';
|
|
40
|
+
if(native&&!WSL_NATIVE.has(file))throw Error('wsl-native-resource-contract-changed');
|
|
41
|
+
}
|
|
42
|
+
for(const file of files.keys()){const parts=file.split('/');for(let depth=1;depth<parts.length;depth++)if(files.has(parts.slice(0,depth).join('/')))throw Error('wsl-archive-prefix-collision');}
|
|
43
|
+
const exported=manifest.exports;if(!exported||typeof exported!=='object'||Array.isArray(exported)||Object.keys(exported).length>128)throw Error('wsl-export-contract-changed');
|
|
44
|
+
const target=(value,depth=0)=>{if(depth>4)throw Error('wsl-export-contract-changed');if(typeof value==='string'){if(!value.startsWith('./')||value.includes('\\')||value.slice(2).split('/').some(part=>!part||part==='.'||part==='..')||!files.has(value.slice(2).toLowerCase()))throw Error('wsl-export-contract-changed');return;}if(!value||typeof value!=='object'||Array.isArray(value)||Object.keys(value).some(key=>!['default','types'].includes(key)))throw Error('wsl-export-contract-changed');for(const item of Object.values(value))target(item,depth+1);};
|
|
45
|
+
for(const [key,value]of Object.entries(exported)){if(key!=='.'&&(!key.startsWith('./')||key.includes('*')||key.startsWith('./_g/')||key.startsWith('./g/')))throw Error('wsl-export-contract-changed');target(value);}
|
|
46
|
+
for(const key of ['.','./client','./subprocess','./picker','./status','./fs-routing','./shell-env','./auto-preset','./preflight','./cwd-prompt','./cwd-prompt-tool','./update-check','./plugin-update','./wsl-doctor-command','./open-in-app','./package.json'])if(!Object.hasOwn(exported,key))throw Error('wsl-export-contract-changed');
|
|
47
|
+
return {kind:'published-structure-contract',patchContract:WSL_PATCH_CONTRACT};
|
|
48
|
+
}
|
|
49
|
+
const MODERN_ROWS = new Map([
|
|
50
|
+
['subprocess-wsl','dsh-plugin-wsl-env/subprocess'],
|
|
51
|
+
['directory-picker-wsl','dsh-plugin-wsl-env/picker'],
|
|
52
|
+
['directory-picker-browse-surface','@deepseek-ai/dsh-client-ui-directory-picker-browse'],
|
|
53
|
+
['wsl-env-client-host','dsh-plugin-wsl-env'],
|
|
54
|
+
['wsl-status','dsh-plugin-wsl-env/status'],
|
|
55
|
+
['wsl-plugin-update','dsh-plugin-wsl-env/plugin-update'],
|
|
56
|
+
['wsl-doctor-command','dsh-plugin-wsl-env/wsl-doctor-command'],
|
|
57
|
+
['wsl-open-in-app','dsh-plugin-wsl-env/open-in-app'],
|
|
58
|
+
['fs-routing','dsh-plugin-wsl-env/fs-routing'],
|
|
59
|
+
['wsl-shell-env','dsh-plugin-wsl-env/shell-env'],
|
|
60
|
+
['auto-preset','dsh-plugin-wsl-env/auto-preset'],
|
|
61
|
+
['wsl-preflight','dsh-plugin-wsl-env/preflight'],
|
|
62
|
+
['wsl-cwd-prompt','dsh-plugin-wsl-env/cwd-prompt'],
|
|
63
|
+
['wsl-cwd-prompt-tool','dsh-plugin-wsl-env/cwd-prompt-tool'],
|
|
64
|
+
['wsl-update-check','dsh-plugin-wsl-env/update-check'],
|
|
65
|
+
['preset-wsl','@deepseek-ai/dsh-agent-preset'],
|
|
66
|
+
]);
|
|
6
67
|
/** Parse WSL's known declarative footprint without executing !!js configuration expressions. */
|
|
7
68
|
export function inspectWslPatches(texts, manifest) {
|
|
8
|
-
if (!isGenerationSupported(manifest)) throw new Error('wsl-version-
|
|
9
|
-
const
|
|
69
|
+
if (!isGenerationSupported(manifest)) throw new Error('wsl-version-format-unsupported');
|
|
70
|
+
const modern = manifest.version==='0.28.0' || !isLegacyWsl(manifest);
|
|
71
|
+
const rows=[]; const overrides=[]; const ids=new Set(); const declarations=[];
|
|
10
72
|
const required = new Map([['subprocess',true],['directory-picker',true],['fs-sandbox',true],['tool-working-directory',true]]);
|
|
11
73
|
for(const text of texts){
|
|
12
74
|
if(typeof text!=='string'||Buffer.byteLength(text)>256_000)throw new Error('wsl-patch-size-limit');
|
|
13
75
|
const doc=parseDocument(text,{uniqueKeys:true,maxAliasCount:0,customTags:[{tag:'tag:yaml.org,2002:js',resolve:value=>({__declarativeJs:value})}]});
|
|
14
76
|
if(doc.errors.length || doc.warnings.length)throw new Error('wsl-patch-parse-failed');
|
|
15
|
-
const entries=doc.toJS({maxAliasCount:0});if(!Array.isArray(entries))throw new Error('invalid-wsl-patch');
|
|
77
|
+
const entries=doc.toJS({maxAliasCount:0});if(!Array.isArray(entries))throw new Error('invalid-wsl-patch');declarations.push(...entries);
|
|
16
78
|
for(const entry of entries){
|
|
17
79
|
if(entry.insert){
|
|
18
80
|
if(Object.keys(entry).some(key=>key!=='insert')||!Array.isArray(entry.insert))throw new Error('wsl-nested-patch-unsupported');
|
|
@@ -20,6 +82,7 @@ export function inspectWslPatches(texts, manifest) {
|
|
|
20
82
|
if(typeof row.id!=='string'||ids.has(row.id)||typeof row.name!=='string')throw new Error('invalid-wsl-row');
|
|
21
83
|
if(row.name!=='dsh-plugin-wsl-env' && !row.name.startsWith('dsh-plugin-wsl-env/') && !['@deepseek-ai/dsh-agent-preset','@deepseek-ai/dsh-client-ui-directory-picker-browse'].includes(row.name))throw new Error('foreign-wsl-row');
|
|
22
84
|
if(['hmr','plugin-manager','plugin-update-doctor','agent-loop','session','storage'].includes(row.id))throw new Error('protected-wsl-row');
|
|
85
|
+
if(modern && MODERN_ROWS.get(row.id)!==row.name)throw new Error('unverified-modern-wsl-row');
|
|
23
86
|
ids.add(row.id);rows.push({id:row.id,name:row.name});
|
|
24
87
|
}
|
|
25
88
|
}else{
|
|
@@ -34,5 +97,8 @@ export function inspectWslPatches(texts, manifest) {
|
|
|
34
97
|
}
|
|
35
98
|
}
|
|
36
99
|
if(required.size||rows.length<10||rows.length>24)throw new Error('incomplete-wsl-footprint');
|
|
37
|
-
|
|
100
|
+
if(modern && (rows.length!==MODERN_ROWS.size || [...MODERN_ROWS.keys()].some(id=>!ids.has(id))))throw new Error('incomplete-modern-wsl-footprint');
|
|
101
|
+
const contractDigest=wslHash(JSON.stringify(wslCanonical(declarations)));
|
|
102
|
+
if(!isLegacyWsl(manifest)&&contractDigest!==WSL_PATCH_CONTRACT)throw Error('wsl-provider-contract-changed');
|
|
103
|
+
return {rows,overrides,contractDigest};
|
|
38
104
|
}
|
package/lib/wsl-proof.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {mkdir,writeFile,lstat,realpath} from 'node:fs/promises';
|
|
2
|
+
import {join,dirname,resolve} from 'node:path';
|
|
3
|
+
import {createHash} from 'node:crypto';
|
|
4
|
+
import {archiveEntries,generationArchive} from './generation.js';
|
|
5
|
+
import {boundedFile} from './file-read.js';
|
|
6
|
+
import {archivePath,PUBLIC_REGISTRY} from './source.js';
|
|
7
|
+
import {WSL_NAME,WSL_GENERATION_KIND,WSL_LEGACY_ORIGINALS,isGenerationSupported,inspectWslPatches,inspectWslArchivePolicy,wslCanonical,wslHash} from './wsl-policy.js';
|
|
8
|
+
|
|
9
|
+
const SHA=/^[a-f0-9]{64}$/,SRI=/^sha512-[A-Za-z0-9+/]{86}==$/;
|
|
10
|
+
export const WSL_MAX_ORIGINALS=8;
|
|
11
|
+
const MAX_ARCHIVE=64*1024*1024;
|
|
12
|
+
const canonical=value=>JSON.stringify(wslCanonical(value));
|
|
13
|
+
const integrity=bytes=>'sha512-'+createHash('sha512').update(bytes).digest('base64');
|
|
14
|
+
export const structuralWsl=reference=>reference?.name===WSL_NAME&&reference.runtimeGeneration?.kind===WSL_GENERATION_KIND;
|
|
15
|
+
function original(bytes,expected={}){
|
|
16
|
+
const entries=archiveEntries(bytes),metadata=entries.find(value=>value.name==='package/package.json');if(!metadata)throw Error('packed-manifest-missing');
|
|
17
|
+
const manifest=JSON.parse(metadata.bytes),sha256=wslHash(bytes),sri=integrity(bytes);
|
|
18
|
+
if(!isGenerationSupported(manifest)||expected.version&&manifest.version!==expected.version||expected.sha256&&sha256!==expected.sha256||expected.integrity&&sri!==expected.integrity)throw Error('wsl-original-identity-mismatch');
|
|
19
|
+
if(WSL_LEGACY_ORIGINALS[manifest.version]&&WSL_LEGACY_ORIGINALS[manifest.version]!==sha256)throw Error('wsl-legacy-original-changed');
|
|
20
|
+
inspectWslArchivePolicy(manifest,entries);
|
|
21
|
+
const patches=typeof manifest.dsh?.bundle?.patch==='string'?[manifest.dsh.bundle.patch]:manifest.dsh?.bundle?.patch;
|
|
22
|
+
if(!Array.isArray(patches)||!patches.length||patches.length>8)throw Error('invalid-bundle-patch-list');
|
|
23
|
+
const texts=patches.map(file=>{if(typeof file!=='string'||!/^\.?\/?[A-Za-z0-9._/-]+$/.test(file)||file.startsWith('/')||file.split('/').some(part=>part==='..'))throw Error('unsafe-bundle-patch-path');const value=entries.find(entry=>entry.name==='package/'+file.replace(/^\.\//,''));if(!value)throw Error('bundle-patch-missing');return value.bytes.toString('utf8');});
|
|
24
|
+
const footprint=inspectWslPatches(texts,manifest);
|
|
25
|
+
return {version:manifest.version,sha256,integrity:sri,bytes,manifest,entries,footprint};
|
|
26
|
+
}
|
|
27
|
+
export function validateWslReference(reference){
|
|
28
|
+
const runtime=reference?.runtimeGeneration;
|
|
29
|
+
if(reference?.name!==WSL_NAME||reference.origin!==PUBLIC_REGISTRY||!isGenerationSupported(reference.manifest)||reference.version!==reference.manifest.version||!SHA.test(reference.sha256??'')||!SHA.test(reference.originalSha256??'')||!SRI.test(reference.integrity??'')||!/^[A-Za-z0-9-]+\/package\.tgz$/.test(reference.archiveKey??''))throw Error('identity-wsl-generation-invalid');
|
|
30
|
+
if(runtime?.kind!==WSL_GENERATION_KIND||runtime.generation!=='g/'+reference.originalSha256.slice(0,12)||runtime.originalRuntimeBytesPreserved!==true||!SHA.test(runtime.rootOriginalSha256??'')||!SHA.test(runtime.originalProofSha256??''))throw Error('identity-wsl-generation-invalid');
|
|
31
|
+
if(!Array.isArray(runtime.originals)||!runtime.originals.length||runtime.originals.length>WSL_MAX_ORIGINALS||!Array.isArray(runtime.retainedOriginalSha256)||!Array.isArray(runtime.moduleAliases)||runtime.moduleAliases.length>128||!Array.isArray(reference.rows)||reference.rows.length>24)throw Error('identity-wsl-generation-invalid');
|
|
32
|
+
const hashes=new Set(),versions=new Set(),ids=new Set();
|
|
33
|
+
for(const value of runtime.originals){if(!isGenerationSupported({name:WSL_NAME,version:value?.version})||!SHA.test(value.sha256??'')||!SRI.test(value.integrity??'')||hashes.has(value.sha256)||versions.has(value.version)||ids.has(value.sha256.slice(0,12)))throw Error('identity-wsl-originals-invalid');hashes.add(value.sha256);versions.add(value.version);ids.add(value.sha256.slice(0,12));}
|
|
34
|
+
if(!runtime.originals.some(value=>value.version===reference.version&&value.sha256===reference.originalSha256&&value.integrity===reference.integrity)||!hashes.has(runtime.rootOriginalSha256)||canonical([...hashes].sort())!==canonical(runtime.retainedOriginalSha256))throw Error('identity-wsl-originals-invalid');
|
|
35
|
+
for(const alias of runtime.moduleAliases)if(!Array.isArray(alias)||alias.length!==2||!alias[0]?.startsWith(WSL_NAME+'/')||!alias[1]?.startsWith(WSL_NAME+'/_g/'+reference.originalSha256.slice(0,12)+'/'))throw Error('identity-wsl-generation-invalid');
|
|
36
|
+
}
|
|
37
|
+
async function ordinaryDirectory(directory){const info=await lstat(directory);if(!info.isDirectory()||info.isSymbolicLink()||await realpath(directory)!==resolve(directory))throw Error('wsl-original-directory-untrusted');}
|
|
38
|
+
function proofFor(staged,records,rootSha){return {schemaVersion:1,kind:WSL_GENERATION_KIND,sourceSha256:staged.originalSha256,rootOriginalSha256:rootSha,originals:records.map(({version,sha256,integrity})=>({version,sha256,integrity})).sort((a,b)=>a.sha256.localeCompare(b.sha256))};}
|
|
39
|
+
async function save(stager,staged,records,rootSha){
|
|
40
|
+
if(!records.length||records.length>WSL_MAX_ORIGINALS)throw Error('wsl-retained-generation-limit');
|
|
41
|
+
const directory=dirname(staged.archivePath);await ordinaryDirectory(directory);const originalsDir=join(directory,'wsl-originals');await mkdir(originalsDir,{recursive:true,mode:0o700});await ordinaryDirectory(originalsDir);
|
|
42
|
+
const distinct=new Set(),versions=new Set(),ids=new Set();
|
|
43
|
+
for(const record of records){if(distinct.has(record.sha256)||versions.has(record.version)||ids.has(record.sha256.slice(0,12)))throw Error('wsl-original-identity-conflict');distinct.add(record.sha256);versions.add(record.version);ids.add(record.sha256.slice(0,12));await writeFile(join(originalsDir,record.sha256+'.tgz'),record.bytes,{mode:0o600});}
|
|
44
|
+
if(!distinct.has(rootSha)||!distinct.has(staged.originalSha256))throw Error('wsl-original-identity-mismatch');
|
|
45
|
+
const proof=proofFor(staged,records,rootSha),proofBytes=Buffer.from(JSON.stringify(proof));await writeFile(join(directory,'wsl-originals.json'),proofBytes,{mode:0o600});
|
|
46
|
+
const own=records.find(value=>value.sha256===staged.originalSha256),root=records.find(value=>value.sha256===rootSha);
|
|
47
|
+
const transformed=generationArchive(own.bytes,{legacyOriginal:root.bytes,retainedOriginal:records.map(value=>value.bytes)});
|
|
48
|
+
archiveEntries(transformed.bytes); // Retention/resource exhaustion refuses before any Host operation.
|
|
49
|
+
await writeFile(staged.archivePath,transformed.bytes,{mode:0o600});staged.sha256=wslHash(transformed.bytes);staged.size=transformed.bytes.length;
|
|
50
|
+
staged.runtimeGeneration={kind:WSL_GENERATION_KIND,generation:transformed.generation,moduleAliases:transformed.moduleAliases,originalRuntimeBytesPreserved:true,legacyRootResourcesPreserved:rootSha!==staged.originalSha256,rootOriginalSha256:rootSha,retainedOriginalSha256:[...distinct].sort(),originals:proof.originals,originalProofSha256:wslHash(proofBytes)};
|
|
51
|
+
staged.integrity=own.integrity;
|
|
52
|
+
}
|
|
53
|
+
export async function annotateWslStage(stager,staged){const own=original(await boundedFile(staged.sourceArchivePath,MAX_ARCHIVE),{version:staged.version,sha256:staged.originalSha256});await save(stager,staged,[own],own.sha256);stager.verifiedWslOriginals.set(own.sha256,Buffer.from(own.bytes));}
|
|
54
|
+
export async function loadWslOriginals(stager,reference){
|
|
55
|
+
validateWslReference(reference);const directory=dirname(archivePath(stager.root,reference.archiveKey));await ordinaryDirectory(directory);const originalsDir=join(directory,'wsl-originals');await ordinaryDirectory(originalsDir);
|
|
56
|
+
const proofBytes=await boundedFile(join(directory,'wsl-originals.json'),64000);if(wslHash(proofBytes)!==reference.runtimeGeneration.originalProofSha256)throw Error('wsl-original-proof-changed');
|
|
57
|
+
const proof=JSON.parse(proofBytes);if(canonical(proof)!==canonical({schemaVersion:1,kind:WSL_GENERATION_KIND,sourceSha256:reference.originalSha256,rootOriginalSha256:reference.runtimeGeneration.rootOriginalSha256,originals:reference.runtimeGeneration.originals}))throw Error('wsl-original-proof-changed');
|
|
58
|
+
const records=[];for(const identity of reference.runtimeGeneration.originals){const bytes=await boundedFile(join(originalsDir,identity.sha256+'.tgz'),MAX_ARCHIVE);const record=original(bytes,identity);if(stager.compatibility(record.manifest))throw Error('staged-version-incompatible');records.push(record);}
|
|
59
|
+
return records;
|
|
60
|
+
}
|
|
61
|
+
export async function verifyWslProofInventory(stager,sourcePath,reference,installed){
|
|
62
|
+
const records=await loadWslOriginals(stager,reference),source=await boundedFile(sourcePath,MAX_ARCHIVE),own=records.find(value=>value.sha256===reference.originalSha256),root=records.find(value=>value.sha256===reference.runtimeGeneration.rootOriginalSha256);
|
|
63
|
+
if(!own.bytes.equals(source))throw Error('verified-source-archive-changed');
|
|
64
|
+
const transformed=generationArchive(source,{legacyOriginal:root.bytes,retainedOriginal:records.map(value=>value.bytes)}),expected=archiveEntries(transformed.bytes),deployed=new Map(archiveEntries(installed).map(value=>[value.name,value.bytes]));
|
|
65
|
+
if(expected.length!==deployed.size||expected.some(value=>{const actual=deployed.get(value.name);return !actual||(value.name==='package/package.json'?canonical(JSON.parse(actual))!==canonical(JSON.parse(value.bytes)):!actual.equals(value.bytes));}))throw Error('retained-wsl-inventory-changed');
|
|
66
|
+
if(canonical(transformed.moduleAliases)!==canonical(reference.runtimeGeneration.moduleAliases)||transformed.generation!==reference.runtimeGeneration.generation)throw Error('identity-generation-changed');
|
|
67
|
+
return {rootOriginalSha256:root.sha256,retainedOriginalSha256:records.map(value=>value.sha256).sort()};
|
|
68
|
+
}
|
|
69
|
+
export async function preserveWslProofPair(stager,next,previous,deployedReference){
|
|
70
|
+
const latest=original(await boundedFile(next.sourceArchivePath,MAX_ARCHIVE),{version:next.version,sha256:next.originalSha256}),old=original(await boundedFile(previous.sourceArchivePath,MAX_ARCHIVE),{version:previous.version,sha256:previous.originalSha256});
|
|
71
|
+
const records=new Map([[latest.sha256,latest],[old.sha256,old]]);let root=old;
|
|
72
|
+
if(deployedReference){
|
|
73
|
+
const deployed=await stager.reopen(deployedReference),installed=await boundedFile(deployed.archivePath,128*1024*1024),entries=new Map(archiveEntries(installed).map(value=>[value.name,value.bytes]));
|
|
74
|
+
if(structuralWsl(deployedReference)){for(const value of await loadWslOriginals(stager,deployedReference))records.set(value.sha256,value);root=records.get(deployedReference.runtimeGeneration.rootOriginalSha256);}
|
|
75
|
+
else{
|
|
76
|
+
const ids=new Set([...entries.keys()].filter(file=>file.startsWith('package/g/')).map(file=>file.split('/')[2]));
|
|
77
|
+
for(const [version,digest]of Object.entries(WSL_LEGACY_ORIGINALS))if(ids.has(digest.slice(0,12))||version==='0.24.0'){if(!records.has(digest))records.set(digest,original(await stager.reviewedWslOriginal(version,digest),{version,sha256:digest}));}
|
|
78
|
+
const manifest=JSON.parse(entries.get('package/package.json')),patches=new Set((Array.isArray(manifest.dsh.bundle.patch)?manifest.dsh.bundle.patch:[manifest.dsh.bundle.patch]).map(file=>'package/'+file.replace(/^\.\//,'')));
|
|
79
|
+
root=[...records.values()].find(value=>value.entries.filter(entry=>entry.name!=='package/package.json'&&!patches.has(entry.name)).every(entry=>entries.get(entry.name)?.equals(entry.bytes)));
|
|
80
|
+
if(!root)throw Error('wsl-root-generation-unverified');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if(!root)throw Error('wsl-root-generation-unverified');
|
|
84
|
+
for(const staged of [next,previous])await save(stager,staged,[...records.values()],root.sha256);
|
|
85
|
+
}
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Plugin online updates",
|
|
4
|
-
"description": "Open Plugin online updates in the
|
|
4
|
+
"description": "Local-test v0.5.3 is not published to public npm. Public npm remains v0.5.0; local archives require separate installation through the official manager. Final archive and local-install results are recorded in the delivered acceptance report; new-dialog browser checks and live UI acceptance remain pending. Open Plugin online updates in the sidebar, check all updates, select eligible compatible stable releases, then review Update selected. At most 20 targets per batch; initial opening does not query or select updates. Version discovery and replacement admission are separate and source-scoped; a failed or incomplete check does not mean up to date. Wait for current tasks to finish naturally by default. Stopping current Agent activities requires additional consent, clears queued input and cannot undo completed operations. External terminals and independent Workers are never killed; DSH is not automatically closed or restarted. Normal npm updates use the official exact-version Host path, preserve npm identity and verify files and activation. The Host refetches using existing fallback settings; prepared bytes are not an atomic exact-byte installation guarantee. Only identified, byte-verified older ordinary Doctor archives can migrate back to npm at the same version after independent confirmation. Self, WSL, arbitrary local, Git and linked installations are not automatically migrated. JS dependencies are limited to reviewed unchanged declarations and verified installed graphs and files without native dependencies or install lifecycle scripts. Fixed public-mirror paths require canonical archive comparison and additional consent without silently changing registry configuration. WSL candidates are checked against canonical public archives and the modern declaration contract instead of a fixed version allowlist. Production 0.26.2 to 0.29.0 updates and preprepared old-package restoration passed in an owned isolated Host. Schema4 retains all original-archive proofs; unknown install/reapply/recovery outcomes are not resent and retained generations are never silently deleted; old resources remain, the source remains a local archive, and existing sessions may retain old presets. The detail-page extension is a separate read-only Doctor check and navigation entry, not built-in Versions or an installer. Self-update is confirmed separately under its npm, fixed public-mirror or fixed full-commit GitHub policy; GitHub main HEAD is not a signed Release. Target failure and recovery are recorded separately; unknown outcomes are not resent. Stock Union Search npm/HMR remains unsafe for hot updates. v0.5.1 only blocked that risk, which is not a fix. v0.5.2 adds the reviewed 0.10.24 to 0.10.25 complete-dependency local generation route: original JavaScript and dependency bytes remain unchanged, target and distinct fresh recovery archives are prepared before replacement, and actual Loader generation identity is verified for enabled plugins. The installation becomes a Doctor-owned local archive, not npm; built-in Versions eligibility is not preserved and extra source acknowledgement is required. Unreviewed versions, unknown outcomes and unverifiable current generations remain blocked; retained-generation exhaustion refuses before mutation without silently deleting old resources. Installing the updater does not automatically update Union or WSL. No DSH, Node or Electron patching, debugger injection, forced cache clearing, process termination, unlocking, elevation, script approval or version exemptions. Local diagnostics are not uploaded. Windows x64 only; real-plugin upgrade and browser acceptance remain pending."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "插件在线更新",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "v0.5.3 本地修复版尚未发布到公共 npm,公共 npm 仍为 v0.5.0;本地包由官方管理器另行安装,最终归档和本机安装结果以交付验收记录为准,浏览器交互尚未验收。从左侧“插件在线更新”进入,点击“检查全部更新”,勾选符合条件的兼容正式版后确认“一键更新所选”。每批最多20项,初次打开不自动查询或勾选。版本发现与在线替换条件分开,并显示查询源;发现新版不等于可安全更新,查询失败或信息不完整不称“已是最新”。更新前默认等待当前任务自然结束;停止当前智能体活动需额外明确同意,排队输入会清除,已完成操作不能撤销。外部终端和独立 Worker 不会被杀掉,DSH 不自动退出或重启。普通 npm 更新走官方精确版本路径,保留 npm 来源并核验实际文件和 Host 激活;Host 会沿用现有 fallback 重新下载,准备归档不是原子或精确字节替换保证。只对已核验的旧普通 Doctor 归档,单独确认同版本迁回 npm;自身、WSL、任意本地、Git 和开发链接不自动迁移。JS 依赖支持限声明不变、实际图与文件可核验、无原生或安装生命周期脚本的受审查路径,不代表所有依赖都能热更新。固定公共镜像路径与官方归档比对并额外确认,不偷偷修改源配置。WSL新版不再单凭固定版本名单拒绝,按公开原包/现代声明契约核验;0.26.2→0.29.0生产更新及预准备旧版恢复已隔离验证。schema4保存全部保留原包证明,未知install/reapply/restore结果禁止重发,达到保留上限不静默删旧代;来源仍为本地归档,不伪装内置 Versions,已有会话可能保留旧预设。详情页独立检查由更新器提供,只读检查和导航,不直接安装。更新器自身升级单独确认,不与普通批次混合;npm、固定公共镜像、固定 GitHub 完整提交各有独立准入,GitHub 主分支不是签名 Release。目标失败和恢复结果分别记录,未知结果不自动重发。常规Union Search npm/HMR路径仍不支持安全热更新,旧0.5.1风险拦截不算修复。本版0.5.2新增仅已审查0.10.24→0.10.25完整依赖本地代际:原始JS及依赖字节不改、提前准备fresh恢复、真实Loader运行代际核验;来源变本地归档、内置Versions资格不保留,须额外确认。未知结果/未审查版本及不可核验当前代际继续拒绝,不复用旧token、不静默删除保留旧代。本插件不改DSH/Node/Electron、不注入调试补丁或强清缓存。文件使用检测仅作辅助,不强制解锁、提权或批准脚本/版本豁免。本机诊断不上传。仅Windows x64;最终归档与本机更新器安装状态见交付验收记录,真实插件升级与新界面浏览器交互尚未验收。"
|
|
5
5
|
}
|
|
6
6
|
}
|