deadbyte-mcp 0.15.63 → 0.15.65

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,124 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import {createHash} from 'node:crypto';
4
+ import {mkdtemp,mkdir,readFile,readdir,rm,writeFile} from 'node:fs/promises';
5
+ import {spawnSync} from 'node:child_process';
6
+ import os from 'node:os';
7
+ import path from 'node:path';
8
+ import {fileURLToPath} from 'node:url';
9
+ import {
10
+ parseActivationPathFlags,
11
+ assertTrustedActivationEntrypoint,
12
+ appendActivationPathArgs
13
+ } from '../src/activation-path-r167.mjs';
14
+
15
+ const protectedRoot='C:\\Program Files\\DEADBYTE-R167';
16
+ const developmentRoot='D:\\Projects\\deadbyte-mcp\\development\\deadbyte-mcp-0.15.65-r167-activation-path';
17
+ const root=path.resolve(fileURLToPath(new URL('..',import.meta.url)));
18
+ const H=value=>createHash('sha256').update(value).digest('hex');
19
+
20
+ test('R167 parses one exact protected epoch root and one separate development root',()=>{
21
+ const parsed=parseActivationPathFlags([
22
+ '--preflight','--authority-epoch-root',protectedRoot,'--development-root',developmentRoot
23
+ ]);
24
+ assert.equal(parsed.authorityEpochRoot,protectedRoot);
25
+ assert.equal(parsed.developmentRoot,developmentRoot);
26
+ assert.deepEqual(parsed.remainingArgs,['--preflight']);
27
+ });
28
+
29
+ test('R167 rejects missing duplicate relative UNC drive-relative and noncanonical roots',()=>{
30
+ const invalid=[
31
+ ['--authority-epoch-root'],
32
+ ['--development-root'],
33
+ ['--authority-epoch-root','relative'],
34
+ ['--authority-epoch-root','\\\\server\\share'],
35
+ ['--authority-epoch-root','C:relative'],
36
+ ['--authority-epoch-root','C:\\Program Files\\..\\Writable'],
37
+ ['--authority-epoch-root',protectedRoot,'--authority-epoch-root',protectedRoot],
38
+ ['--development-root',developmentRoot,'--development-root',developmentRoot]
39
+ ];
40
+ for(const argv of invalid)assert.throws(()=>parseActivationPathFlags(argv));
41
+ });
42
+
43
+ test('R167 EPOCH_NATIVE activation requires the executing package root to be the trusted protected root',()=>{
44
+ assert.throws(()=>assertTrustedActivationEntrypoint({
45
+ continuity:'EPOCH_NATIVE',packageRoot:developmentRoot,
46
+ authorityEpochRoot:protectedRoot,developmentRoot,trusted:true
47
+ }),/protected entrypoint/i);
48
+ assert.throws(()=>assertTrustedActivationEntrypoint({
49
+ continuity:'EPOCH_NATIVE',packageRoot:protectedRoot,
50
+ authorityEpochRoot:protectedRoot,developmentRoot,trusted:false
51
+ }),/ACL-trusted/i);
52
+ assert.deepEqual(assertTrustedActivationEntrypoint({
53
+ continuity:'EPOCH_NATIVE',packageRoot:protectedRoot,
54
+ authorityEpochRoot:protectedRoot,developmentRoot,trusted:true
55
+ }),{authorityEpochRoot:protectedRoot,developmentRoot});
56
+ });
57
+
58
+ test('R167 forwards exact protected stage epoch and development roots to updater without fallback',()=>{
59
+ const args=appendActivationPathArgs(['--expected-version','0.15.65'],{
60
+ stageRoot:protectedRoot,authorityEpochRoot:protectedRoot,developmentRoot
61
+ });
62
+ assert.deepEqual(args,[
63
+ '--expected-version','0.15.65','--stage',protectedRoot,
64
+ '--development-root',developmentRoot,'--authority-epoch-root',protectedRoot
65
+ ]);
66
+ assert.throws(()=>appendActivationPathArgs([],{
67
+ stageRoot:developmentRoot,authorityEpochRoot:protectedRoot,developmentRoot
68
+ }),/stage.*protected/i);
69
+ });
70
+
71
+ test('R167 writable EPOCH_NATIVE entrypoint rejects before creating an activation claim',
72
+ {skip:process.platform!=='win32'},async()=>{
73
+ const isolated=await mkdtemp(path.join(os.tmpdir(),'deadbyte-r167-preclaim-'));
74
+ try{
75
+ const state=path.join(isolated,'state'),runtime=path.join(state,'runtime'),bin=path.join(state,'bin');
76
+ const generation=path.join(state,'generations','fixture'),policies=path.join(state,'policies');
77
+ await Promise.all([mkdir(runtime,{recursive:true}),mkdir(bin,{recursive:true}),mkdir(generation,{recursive:true}),mkdir(policies,{recursive:true})]);
78
+ const release=JSON.parse(await readFile(path.join(root,'RELEASE.json'),'utf8'));
79
+ const fields={process:'grant_file',coding:'lease_file',autonomous:'lease_file',desktop:'grant_file',host:'arm_file'};
80
+ const policyPaths={},config=[];
81
+ const configFields={process:'ProcessPolicyFile',coding:'CodingPolicyFile',autonomous:'AutonomousPolicyFile',desktop:'DesktopPolicyFile',host:'HostPolicyFile'};
82
+ for(const [plane,field] of Object.entries(fields)){
83
+ const grant=path.join(runtime,`${plane}-grant.json`),policy=path.join(policies,`${plane}.json`);
84
+ const body={schema:plane==='host'?'deadbyte.host-policy.v2':`deadbyte.${plane}-policy.v1`,enabled:true,[field]:grant};
85
+ await writeFile(policy,JSON.stringify(body));
86
+ policyPaths[plane]=policy;
87
+ config.push(`${configFields[plane]} = '${policy.replaceAll("'","''")}'`);
88
+ if(plane==='coding')await writeFile(grant,JSON.stringify({schema:'fixture',nonce:H('coding-grant')}));
89
+ }
90
+ const pointer={schema:'deadbyte.active-release.v1',...release.parent,
91
+ release_root:path.join(state,'releases',release.parent.release_id),generation_root:generation,
92
+ launcher_sha256:H('launcher'),config_path:path.join(generation,'controller-config.psd1')};
93
+ await writeFile(pointer.config_path,`@{ ${config.join('; ')} }\n`);
94
+ const pointerBytes=Buffer.from(JSON.stringify(pointer));
95
+ await writeFile(path.join(state,'active-release.json'),pointerBytes);
96
+ const disarmed=plane=>({configured:true,armed:false,reason:plane==='autonomous'?'coding-disarmed':'disarmed'});
97
+ const observation={schema:'deadbyte.controller-observation.v1',state:'ONLINE',local_ready:true,
98
+ bridge:{alive:true,reason:'verified',pid:101},core:{alive:true,reason:'verified',pid:102},
99
+ cloud:{alive:true,reason:'verified',pid:103},supervisor:{running:true},
100
+ authority:{process:disarmed('process'),coding:{configured:true,armed:true,reason:'standing-grant',epoch_seq:7,epoch_sha256:H('coding-epoch')},
101
+ autonomous:disarmed('autonomous'),desktop:disarmed('desktop'),host:disarmed('host')}};
102
+ const observationPath=path.join(state,'observation.json');
103
+ await writeFile(observationPath,JSON.stringify(observation));
104
+ await writeFile(path.join(bin,'DEADBYTE-MCP.ps1'),`param([string]$Command,[switch]$Json)\nif($Command -ne 'status' -or -not $Json){throw 'mutation attempted'}\nGet-Content -Raw -LiteralPath '${observationPath.replaceAll("'","''")}'\n`);
105
+ const before=H(pointerBytes);
106
+ const preflightRun=spawnSync(process.execPath,[path.join(root,'scripts','deploy-r48.mjs'),'--preflight',
107
+ '--authority-epoch-root',protectedRoot,'--development-root',developmentRoot],{
108
+ env:{...process.env,DEADBYTE_STATE_ROOT:state},cwd:root,encoding:'utf8',timeout:30000,windowsHide:true});
109
+ assert.equal(preflightRun.status,0,preflightRun.stderr);
110
+ const preflight=JSON.parse(preflightRun.stdout.trim());
111
+ assert.equal(preflight.authority_continuity,'EPOCH_NATIVE');
112
+ assert.equal(preflight.activation_entrypoint_state,'REJECTED');
113
+ assert.equal(preflight.protected_activation_entrypoint,false);
114
+ assert.match(preflight.activation_entrypoint_reason,/protected|trusted|UNTRUSTED_WRITE_ACE/i);
115
+ const run=spawnSync(process.execPath,[path.join(root,'scripts','deploy-r48.mjs'),
116
+ '--authority-epoch-root',protectedRoot,'--development-root',developmentRoot],{
117
+ env:{...process.env,DEADBYTE_STATE_ROOT:state},cwd:root,encoding:'utf8',timeout:30000,windowsHide:true});
118
+ assert.notEqual(run.status,0,run.stdout);
119
+ assert.match(run.stderr,/trusted|protected|UNTRUSTED_WRITE_ACE/i);
120
+ assert.equal(H(await readFile(path.join(state,'active-release.json'))),before);
121
+ const updates=path.join(state,'evidence','updates');
122
+ await assert.rejects(readdir(updates),error=>error?.code==='ENOENT');
123
+ }finally{await rm(isolated,{recursive:true,force:true});}
124
+ });
@@ -0,0 +1,51 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import {readFile} from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ import {fileURLToPath} from 'node:url';
6
+ import {DEADBYTE_VERSION} from '../src/version.mjs';
7
+
8
+ const root=path.resolve(fileURLToPath(new URL('..',import.meta.url)));
9
+ const read=async rel=>JSON.parse(await readFile(path.join(root,rel),'utf8'));
10
+ const readOptional=async rel=>{try{return await read(rel);}catch(error){if(error?.code==='ENOENT')return null;throw error;}};
11
+ const VERSION='0.15.65';
12
+ const R166_MANIFEST='ad3c091fbbe2bac6d234548724008b67305fd483ad6542f92d5aeb1aa84f5849';
13
+ const R166_TARBALL='3d22412c3cebabd66bfa92ca4dbaaf3ef49acba7f92436a16485d7e4cb18c653';
14
+
15
+ test('R167 package identity binds published R166 source separately from active R153 runtime',async()=>{
16
+ const [pkg,lock,bridge,release,provenance,matrix,bom]=await Promise.all([
17
+ read('package.json'),readOptional('package-lock.json'),read('bridge/package.json'),read('RELEASE.json'),
18
+ read('PROVENANCE.json'),read('TEST-MATRIX.json'),read('SBOM.cdx.json')]);
19
+ const versions=[pkg.version,bridge.version,release.version,
20
+ provenance.version,matrix.version,bom.metadata.component.version,DEADBYTE_VERSION];
21
+ if(lock)versions.push(lock.version,lock.packages[''].version);
22
+ for(const version of versions)assert.equal(version,VERSION);
23
+ assert.equal(release.train,'R167');
24
+ assert.equal(matrix.train,'R167');
25
+ assert.equal(bom.serialNumber,'urn:cdx:deadbyte-mcp:r167:0.15.65');
26
+ assert.deepEqual(release.runtime_predecessor,{
27
+ version:'0.15.61',release_id:'v0.15.61-055d1ff0aa99e60b',
28
+ manifest_sha256:'055d1ff0aa99e60bbf9e9f136b02ebd4fffb8391712560f7607cff30af94dcdf',
29
+ generation_manifest_sha256:'f940e794daac2dda097a66301c4b85c4b29a2df7c669e549503c05a2a55ff6c4'
30
+ });
31
+ assert.equal(release.source_predecessor.version,'0.15.64');
32
+ assert.equal(release.source_predecessor.train,'R166');
33
+ assert.equal(release.source_predecessor.tarball_sha256,R166_TARBALL);
34
+ assert.equal(release.r167.source_predecessor_manifest_sha256,R166_MANIFEST);
35
+ assert.equal(provenance.source_predecessor_manifest_file_sha256,R166_MANIFEST);
36
+ assert.equal(provenance.source_predecessor_tarball_sha256,R166_TARBALL);
37
+ assert.equal(release.r167.public_tool_delta,0);
38
+ assert.equal(release.r167.authority_scope_delta,0);
39
+ assert.equal(release.r167.production_activation,'NOT_RUN');
40
+ assert.equal(release.r167.npm_publish,'NOT_RUN');
41
+ });
42
+
43
+ test('R167 protected continuity remains pending until exact Windows fixture evidence exists',async()=>{
44
+ const [release,provenance,matrix]=await Promise.all([
45
+ read('RELEASE.json'),read('PROVENANCE.json'),read('TEST-MATRIX.json')]);
46
+ assert.equal(release.r167.protected_entrypoint_continuity,'PENDING_PROTECTED_WINDOWS_FIXTURE');
47
+ assert.equal(provenance.r167.final_manifest_evidence,'PENDING_PROTECTED_WINDOWS_FIXTURE');
48
+ assert.equal(matrix.r167.protected_epoch_continuity,'PENDING_PROTECTED_WINDOWS_FIXTURE');
49
+ assert.equal(matrix.r167.new_public_tools,0);
50
+ assert.equal(matrix.r167.new_authority_scopes,0);
51
+ });
@@ -0,0 +1,27 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import path from 'node:path';
4
+ import {fileURLToPath} from 'node:url';
5
+ import {readFile} from 'node:fs/promises';
6
+ import {assertR167NpmPublishReady,assertR167PackedIdentity} from '../scripts/npm-release-readiness-r167.mjs';
7
+
8
+ const root=path.resolve(fileURLToPath(new URL('..',import.meta.url)));
9
+
10
+ test('R167 publication refuses absent external exact-byte closure',async()=>{
11
+ const release=JSON.parse(await readFile(path.join(root,'RELEASE.json'),'utf8'));
12
+ const prior=process.env.DEADBYTE_R167_CLOSURE_ROOT;
13
+ try{
14
+ delete process.env.DEADBYTE_R167_CLOSURE_ROOT;
15
+ await assert.rejects(assertR167NpmPublishReady(release,{root}),/PUBLISH_BLOCKED R167/);
16
+ }finally{
17
+ if(prior===undefined)delete process.env.DEADBYTE_R167_CLOSURE_ROOT;
18
+ else process.env.DEADBYTE_R167_CLOSURE_ROOT=prior;
19
+ }
20
+ });
21
+
22
+ test('R167 publication rejects a repacked artifact that differs from verified closure bytes',()=>{
23
+ const expected={tarball_sha256:'a'.repeat(64),tarball_integrity:'sha512-expected',tarball_shasum:'b'.repeat(40)};
24
+ assert.throws(()=>assertR167PackedIdentity({
25
+ ...expected,observedSha256:'c'.repeat(64),observedIntegrity:'sha512-other',observedShasum:'d'.repeat(40)
26
+ }),/PUBLISH_BLOCKED R167.*tarball/i);
27
+ });
@@ -83,7 +83,7 @@ test('R72 compact baseline permits only R64 read offset and authorized coding-on
83
83
  assert.deepEqual(diff.added,[]);
84
84
  assert.deepEqual(diff.removed,[]);
85
85
  const packageVersion=JSON.parse(await readFile(path.join(repoRoot,'package.json'),'utf8')).version;
86
- if(['0.15.41','0.15.42','0.15.43','0.15.44','0.15.45','0.15.46','0.15.47','0.15.48','0.15.49','0.15.50','0.15.51','0.15.52','0.15.53','0.15.54','0.15.55','0.15.56','0.15.57','0.15.58','0.15.59','0.15.60','0.15.61','0.15.62','0.15.63'].includes(packageVersion)){
86
+ if(['0.15.41','0.15.42','0.15.43','0.15.44','0.15.45','0.15.46','0.15.47','0.15.48','0.15.49','0.15.50','0.15.51','0.15.52','0.15.53','0.15.54','0.15.55','0.15.56','0.15.57','0.15.58','0.15.59','0.15.60','0.15.61','0.15.62','0.15.63','0.15.64','0.15.65'].includes(packageVersion)){
87
87
  assert.deepEqual([...diff.schema_changed].sort(),['machine_fs','native_diff_preview']);
88
88
  assert.equal(diff.unchanged.length,41);
89
89
  const prior=baseline.tools.find(tool=>tool.name==='machine_fs');