deadbyte-mcp 0.15.44 → 0.15.46
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/MANIFEST.SHA256 +86 -138
- package/PROVENANCE.json +35 -18
- package/README.txt +22 -21
- package/RELEASE.json +369 -334
- package/SBOM.cdx.json +2 -2
- package/TEST-MATRIX.json +27 -17
- package/bridge/package.json +1 -1
- package/controller/deadbyte-controller.ps1 +1871 -1769
- package/controller/deadbyte-desktop-policy.json +6 -6
- package/controller/deadbyte-process-policy.json +4 -4
- package/docs/R68-COMPAT-HOST-EXEC-CANDIDATE.md +63 -0
- package/docs/R69-LIVE-OUTCOME-R70-POLICY-TRANSFER.md +136 -0
- package/docs/R70-CODING-DIGEST-SUPERVISOR-CHECKPOINT-20261013.md +42 -0
- package/docs/R70-FINITE-GRANT-OWNER-BOUNDARY-20261013.md +80 -0
- package/docs/R70-OWNER-BOOTSTRAP-CHECKPOINT-20261013.md +60 -0
- package/docs/R70-REFERENCE-MECHANISMS.json +95 -0
- package/docs/R70-TRUST-GUARD-EXPIRY-CHECKPOINT-20261013.md +47 -0
- package/package.json +2 -2
- package/scripts/benchmark-l0-r71.mjs +76 -0
- package/scripts/gate-windows-r71.ps1 +64 -0
- package/scripts/gate-windows-r72.ps1 +76 -0
- package/scripts/npm-release-r48.mjs +4 -0
- package/scripts/npm-release-readiness-r71.mjs +21 -0
- package/scripts/npm-release-readiness-r72.mjs +76 -0
- package/scripts/verify-r70-full-regression.ps1 +72 -0
- package/src/authority-continuity-r65.mjs +28 -8
- package/src/autonomous-mcp-tools.mjs +1 -1
- package/src/autonomous-output-contracts.mjs +4 -1
- package/src/autonomous-policy.mjs +54 -7
- package/src/capability-ledger.mjs +1 -1
- package/src/capability-resolver.mjs +2 -1
- package/src/commander-compat-runtime.mjs +30 -2
- package/src/deadbyte-cli.mjs +722 -719
- package/src/launcher-isolation.mjs +58 -0
- package/src/native-diff-v2.mjs +18 -5
- package/src/native-diff.mjs +21 -5
- package/src/r70-owner-approval.mjs +78 -0
- package/src/remote-authority.mjs +75 -75
- package/src/remote-live-log.mjs +48 -14
- package/src/remote-mcp-machine-smoke-client.mjs +84 -84
- package/src/remote-result-journal.mjs +1 -1
- package/src/runtime-update.mjs +232 -24
- package/src/staging-input-isolation.mjs +79 -0
- package/src/tool-audit.mjs +2 -0
- package/src/version.mjs +1 -1
- package/test/autonomous-local-supervisor.test.mjs +2 -1
- package/test/autonomous-output-contract.test.mjs +17 -1
- package/test/autonomous-supervisor-integration.test.mjs +2 -1
- package/test/capability-resolver.test.mjs +17 -0
- package/test/codex-autonomous-r44.test.mjs +1 -1
- package/test/commander-compat-runtime.test.mjs +42 -0
- package/test/controller-policy-preflight-r59.test.mjs +1 -0
- package/test/deferred-slot-operation-behavior.test.mjs +2 -2
- package/test/native-diff-topology-r36.test.mjs +35 -2
- package/test/native-diff.test.mjs +83 -3
- package/test/r58-cleanup-retention.test.mjs +3 -3
- package/test/r58-concurrent-recovery.test.mjs +3 -3
- package/test/r58-stale-owner.test.mjs +1 -1
- package/test/r59-tool-surface-compat.test.mjs +9 -5
- package/test/r60-authority-coherence.test.mjs +10 -2
- package/test/r65-authority-runtime-epoch.test.mjs +9 -1
- package/test/r67-isolated-slot-rollback-restore.test.mjs +2 -1
- package/test/r67-npm-publish-gate.test.mjs +4 -2
- package/test/r67-release-contract.test.mjs +8 -7
- package/test/r69-live-outcome.test.mjs +137 -0
- package/test/r70-autonomous-grant-expiry.test.mjs +89 -0
- package/test/r70-autonomous-policy-bootstrap.test.mjs +166 -0
- package/test/r70-controller-autonomous-root.test.mjs +104 -0
- package/test/r70-controller-grant-subset.test.mjs +28 -0
- package/test/r70-controller-owner-issue-boundary.test.mjs +80 -0
- package/test/r70-controller-policy-snapshot.test.mjs +66 -0
- package/test/r70-owner-approval.test.mjs +67 -0
- package/test/r71-full-verifier-artifact.test.mjs +28 -0
- package/test/r71-isolated-slot-rollback-restore.test.mjs +62 -0
- package/test/r71-native-diff-mcp-wire.test.mjs +75 -0
- package/test/r71-publish-fence.test.mjs +38 -0
- package/test/r71-release-identity.test.mjs +33 -0
- package/test/r72-launcher-isolation.test.mjs +99 -0
- package/test/r72-publication-fence.test.mjs +56 -0
- package/test/r72-publication-output-integrity.test.mjs +110 -0
- package/test/r72-remote-safe-contract.test.mjs +101 -0
- package/test/r72-staging-input-isolation.test.mjs +87 -0
- package/test/r72-staging-workspace-isolation.test.mjs +114 -0
- package/test/remote-result-journal.test.mjs +12 -0
- package/test/remote-session-cli.test.mjs +112 -65
- package/test/standing-grants.test.mjs +2 -2
- package/test/tool-audit.test.mjs +14 -0
- package/bin/appcontainer-stage.obj +0 -0
- package/bin/bootstrap-advapi32.obj +0 -0
- package/bin/bootstrap-exitcode.obj +0 -0
- package/bin/bootstrap-kernel32.obj +0 -0
- package/bin/child-control-probe.obj +0 -0
- package/bin/child-control-stage.obj +0 -0
- package/bin/contained-reverse-worker.obj +0 -0
- package/bin/contained-transform-worker.obj +0 -0
- package/bin/containment-probe.obj +0 -0
- package/bin/deadbyte-contain.obj +0 -0
- package/bin/deadbyte-desktop-input-r40.obj +0 -0
- package/bin/deadbyte-desktop-observer-r40.obj +0 -0
- package/bin/deadbyte-desktop-uia-r40.obj +0 -0
- package/bin/deadbyte-exec.obj +0 -0
- package/bin/deadbyte-hardware-observer-r45.obj +0 -0
- package/bin/deadbyte-native-inspect-r67.obj +0 -0
- package/bin/deadbyte-process-host.obj +0 -0
- package/bin/deadbyte-tunnel-host.obj +0 -0
- package/conpty-input-observer.obj +0 -0
- package/miniconpty.obj +0 -0
- package/proof/CONTAINMENT-BUILD.txt +0 -163
- package/proof/MCP-SMOKE-STATUS.txt +0 -9
- package/proof/NODE-SYNTAX.txt +0 -4
- package/proof/PROOF.txt +0 -6
- package/proof/R34-TASK8-SUPERVISOR-CHECKPOINT.json +0 -29
- package/proof/R34-TASK9-MCP-SURFACE-CHECKPOINT.json +0 -28
- package/proof/SECRET-SCAN.txt +0 -4
- package/proof/SOURCE-GATES.txt +0 -16
- package/proof/STATUS.txt +0 -11
- package/proof/TARGET-V0313-CONTAINMENT-PASS.sha256 +0 -1
- package/proof/TARGET-V0313-CONTAINMENT-PASS.txt +0 -215
- package/proof/TARGET-V040-CONTAINED-IPC-FAIL.sha256 +0 -1
- package/proof/TARGET-V040-CONTAINED-IPC-FAIL.txt +0 -299
- package/proof/TARGET-V041-CONTAINED-CREATEPROCESS-203.sha256 +0 -1
- package/proof/TARGET-V041-CONTAINED-CREATEPROCESS-203.txt +0 -311
- package/proof/TARGET-V042-CONTAINED-CREATEPROCESS-203.sha256 +0 -1
- package/proof/TARGET-V042-CONTAINED-CREATEPROCESS-203.txt +0 -313
- package/proof/TARGET-V043-CONTAINED-CREATEPROCESS-203.sha256 +0 -1
- package/proof/TARGET-V043-CONTAINED-CREATEPROCESS-203.txt +0 -308
- package/proof/TARGET-V044-CONTAINED-PASS.sha256 +0 -1
- package/proof/TARGET-V044-CONTAINED-PASS.txt +0 -432
- package/proof/TARGET-V045-DUAL-OPERATION-PASS.sha256 +0 -1
- package/proof/TARGET-V045-DUAL-OPERATION-PASS.txt +0 -481
- package/proof/TARGET-V046-FIXED-EXECUTABLE-REGISTRY-PASS.sha256 +0 -1
- package/proof/TARGET-V046-FIXED-EXECUTABLE-REGISTRY-PASS.txt +0 -610
- package/proof/TARGET-V047-RUNTIME-MANIFEST-PASS.sha256 +0 -1
- package/proof/TARGET-V047-RUNTIME-MANIFEST-PASS.txt +0 -642
- package/proof/TARGET-V050-BATCH-GATE-PASS.sha256 +0 -1
- package/proof/TARGET-V050-BATCH-GATE-PASS.txt +0 -713
- package/proof/TESTS.txt +0 -686
- package/proof/TRUST-EPHEMERAL.txt +0 -4
- package/proof/V03-FREEZE.txt +0 -27
- package/proof/V041-IPC-HOTFIX.txt +0 -16
- package/proof/V042-ENV-HOTFIX.txt +0 -15
- package/proof/V043-DRIVE-CWD-HOTFIX.txt +0 -14
- package/proof/V044-LOCALAPPDATA-HOTFIX.txt +0 -18
- package/proof/V045-OPERATION-REGISTRY.txt +0 -7
- package/proof/V046-WORKER-REGISTRY.txt +0 -12
- package/proof/V047-WORKER-MANIFEST.txt +0 -18
- package/proof/V050-BATCH-TRUST-CLOSURE.txt +0 -21
- package/proof/V060-ACTIVE-NETWORK-AUTHORITY.txt +0 -29
- package/proof/V070-NODE-SYNTAX.txt +0 -36
- package/proof/V070-NODE-TESTS.txt +0 -752
- package/proof/V070-PACK-DRY-RUN.txt +0 -126
- package/proof/V070-SOURCE-GATE.txt +0 -30
- package/proof/V070-STATIC-SCAN.txt +0 -4
- package/proof/V070-WINDOWS-GATE-PENDING.txt +0 -25
- package/proof/V071-NODE-SYNTAX.txt +0 -1
- package/proof/V071-NODE-TESTS.txt +0 -796
- package/proof/V071-PACK-DRY-RUN.json +0 -656
- package/proof/V071-SOURCE-GATE.txt +0 -16
- package/proof/V071-WINDOWS-GATE-PENDING.txt +0 -24
- package/proof/V073-NODE-SYNTAX.txt +0 -4
- package/proof/V073-SOURCE-GATE.txt +0 -21
- package/proof/V073-STATIC-SCAN.txt +0 -10
- package/proof/V073-WINDOWS-GATE-PENDING.txt +0 -5
- package/proof/VERIFY.txt +0 -7
- package/proof/WINDOWS-CONTAINED-STATUS.txt +0 -5
- package/proof/WINDOWS-CONTAINMENT-STATUS.txt +0 -3
- package/proof/commander-closure-20260927/CONTINUATION.json +0 -43
- package/proof/commander-closure-20260927/RESULT.json +0 -30
- package/proof/commander-closure-20260927/SEARCH-CONTINUATION.json +0 -30
- package/proof/commander-closure-20260927/XLS-REFERENCE-PROBE.json +0 -13
- package/proof/commander-closure-20260928/DIFFERENTIAL-CHECKPOINT.json +0 -122
- package/proof/r59-full-regression-current.json +0 -13
- package/proof/r59-full-regression-current.stderr.log +0 -0
- package/proof/r59-full-regression-current.stdout.log +0 -1268
|
@@ -37,6 +37,10 @@ test('R59 live plane state can only reduce signed capability availability', asyn
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
test('deriveCapabilityRequirements maps dependencies accurately', () => {
|
|
40
|
+
const preview=R36_CAPABILITY_LEDGER.entries.find(item=>item.id==='native_diff.preview');
|
|
41
|
+
assert.equal(preview.authority,'coding');
|
|
42
|
+
assert.equal(preview.mutating,false);
|
|
43
|
+
assert.deepEqual(deriveCapabilityRequirements(preview),['DEADBYTE_AUTONOMOUS_RUNTIME','coding_session.armed']);
|
|
40
44
|
const reqCodingRead = deriveCapabilityRequirements({
|
|
41
45
|
id: 'coding.search',
|
|
42
46
|
authority: 'coding',
|
|
@@ -61,6 +65,19 @@ test('deriveCapabilityRequirements maps dependencies accurately', () => {
|
|
|
61
65
|
assert.deepEqual(reqSkill, ['skill_plane.valid']);
|
|
62
66
|
});
|
|
63
67
|
|
|
68
|
+
test('Native Diff preview is available under Coding read while apply remains Autonomous denied',async()=>{
|
|
69
|
+
const preview=R36_CAPABILITY_LEDGER.entries.find(item=>item.id==='native_diff.preview');
|
|
70
|
+
const apply=R36_CAPABILITY_LEDGER.entries.find(item=>item.id==='native_diff.apply');
|
|
71
|
+
const result=await resolveCapabilityStates({ledger:{entries:[preview,apply]},
|
|
72
|
+
toolCatalog:['native_diff_preview','native_diff_apply'],profile:'full',
|
|
73
|
+
env:{DEADBYTE_AUTONOMOUS_RUNTIME:'1'},
|
|
74
|
+
codingRuntime:{sessionStatus:async()=>({armed:true,root_ids:['project']})},
|
|
75
|
+
autonomousRuntime:{sessionStatus:async()=>({armed:false,reason:'disarmed'})}});
|
|
76
|
+
const byId=id=>result.capabilities.find(item=>item.id===id);
|
|
77
|
+
assert.equal(byId('native_diff.preview').state,CAPABILITY_STATES.AVAILABLE);
|
|
78
|
+
assert.equal(byId('native_diff.apply').state,CAPABILITY_STATES.DENIED);
|
|
79
|
+
});
|
|
80
|
+
|
|
64
81
|
test('resolveCapabilityStates resolves all 5 states correctly', async () => {
|
|
65
82
|
const allCompactTools = [
|
|
66
83
|
'capability_manifest',
|
|
@@ -38,7 +38,7 @@ async function fixture(){
|
|
|
38
38
|
const policy=await loadAutonomousPolicy(autonomousPath,codingPolicy);
|
|
39
39
|
await writeBoundStandingGrant('coding', codingPolicy.lease_file, {schema:'deadbyte.coding-grant.v2',policy_sha256:codingPolicy.policy_sha256,
|
|
40
40
|
instance_nonce:nonce(),root_ids:['project'],armed_at_utc:new Date().toISOString()});
|
|
41
|
-
await writeBoundStandingGrant('autonomous', policy.lease_file, {schema:'deadbyte.autonomous-grant.v2',policy_sha256:policy.policy_sha256,
|
|
41
|
+
await writeBoundStandingGrant('autonomous', policy.lease_file, {schema:'deadbyte.autonomous-grant.v2',policy_sha256:policy.policy_sha256,coding_policy_sha256:codingPolicy.policy_sha256,
|
|
42
42
|
instance_nonce:nonce(),root_ids:['project'],armed_at_utc:new Date().toISOString()});
|
|
43
43
|
const codingRuntime=createCodingRuntime({policy:codingPolicy,signingKeyPath:keys.privateKeyPath,verifyKeyPath:keys.publicKeyPath});
|
|
44
44
|
const nativeDiffRuntime=createNativeDiffRuntime({policy,codingRuntime,signingKeyPath:keys.privateKeyPath,verifyKeyPath:keys.publicKeyPath});
|
|
@@ -32,3 +32,45 @@ test('native source rejects a Commander package dependency', () => {
|
|
|
32
32
|
assertNoCommanderDependency("import x from './machine-fs.mjs';");
|
|
33
33
|
assert.throws(()=>assertNoCommanderDependency("import x from '@wonderwhy-er/desktop-commander';"),/must not depend/);
|
|
34
34
|
});
|
|
35
|
+
|
|
36
|
+
test('host_exec script, inline, and native have independent required fields', () => {
|
|
37
|
+
const sha='a'.repeat(64);
|
|
38
|
+
const script={root_id:'core',command_id:'powershell_script',script_path:'scripts/check.ps1',script_sha256:sha};
|
|
39
|
+
const inline={mode:'inline',root_id:'core',command_id:'powershell_inline',command:'Write-Output ok'};
|
|
40
|
+
const native={mode:'native',root_id:'core',executable:'C:\\Windows\\System32\\whoami.exe',executable_sha256:sha};
|
|
41
|
+
for(const args of [script,inline,native]){
|
|
42
|
+
const validated=validateCommanderRequest('host_exec',args);
|
|
43
|
+
assert.equal(validated.native_tool,'host.exec');
|
|
44
|
+
assert.deepEqual(validated.args,args);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('compat adapter routes only validated host_exec modes to the native operation', async () => {
|
|
49
|
+
const calls=[];
|
|
50
|
+
const rt=createCommanderCompatibilityRuntime({
|
|
51
|
+
invoke:async(native,args)=>{calls.push({native,args});return {status:'passed',mode:args.mode};}
|
|
52
|
+
});
|
|
53
|
+
const inline={mode:'inline',root_id:'core',command_id:'powershell_inline',command:'Write-Output ok'};
|
|
54
|
+
const result=await rt.call('host_exec',inline);
|
|
55
|
+
assert.equal(result.status,'ok');
|
|
56
|
+
assert.equal(calls.length,1);
|
|
57
|
+
assert.deepEqual(calls[0],{native:'host.exec',args:inline});
|
|
58
|
+
await assert.rejects(()=>rt.call('host_exec',{...inline,script_path:'stray.ps1'}),/unexpected fields/);
|
|
59
|
+
assert.equal(calls.length,1,'rejected requests must never reach native invoke');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('host_exec rejects cross-mode parameters and malformed authority inputs', () => {
|
|
63
|
+
const sha='a'.repeat(64);
|
|
64
|
+
const inline={mode:'inline',root_id:'core',command_id:'powershell_inline',command:'Write-Output ok'};
|
|
65
|
+
const native={mode:'native',root_id:'core',executable:'C:\\Windows\\System32\\whoami.exe',executable_sha256:sha};
|
|
66
|
+
const reject=args=>assert.throws(()=>validateCommanderRequest('host_exec',args));
|
|
67
|
+
reject({...inline,script_sha256:sha});
|
|
68
|
+
reject({...native,command_id:'powershell_inline'});
|
|
69
|
+
reject({...native,executable_sha256:'bad'});
|
|
70
|
+
reject({...inline,command:'a'+String.fromCharCode(0)+'b'});
|
|
71
|
+
reject({...inline,command:''});
|
|
72
|
+
reject({mode:'inline',root_id:'core',command_id:'powershell_inline'});
|
|
73
|
+
reject({mode:'native',root_id:'core',executable:'x.exe'});
|
|
74
|
+
reject({mode:'superuser',root_id:'core',command:'x'});
|
|
75
|
+
reject({root_id:'core',command_id:'powershell_script',script_path:'scripts/check.ps1',script_sha256:'bad'});
|
|
76
|
+
});
|
|
@@ -26,6 +26,7 @@ test('R59 controller refuses to arm process or coding policy with a missing root
|
|
|
26
26
|
const source=await readFile(controllerPath,'utf8');
|
|
27
27
|
const blocks=[functionBlock(source,'Assert-PolicyRootsAvailable','Get-HostPolicyMetadata'),
|
|
28
28
|
functionBlock(source,'Get-ProcessPolicyMetadata','Get-ProcessGrantStatus'),
|
|
29
|
+
functionBlock(source,'Read-ControllerPolicySnapshot','Get-CodingPolicyMetadata'),
|
|
29
30
|
functionBlock(source,'Get-CodingPolicyMetadata','Get-CodingLeaseStatus')].join('\n');
|
|
30
31
|
const script=`$ErrorActionPreference='Stop';$RuntimeDir=${quote(runtime)};function Fail([string]$m){throw $m};function Get-ExecutableHash($p){return '${'a'.repeat(64)}'};${blocks};`+
|
|
31
32
|
`$errors=@();foreach($case in @(@{kind='process';cfg=@{ProcessPolicyFile=${quote(processPolicy)}}},@{kind='coding';cfg=@{CodingPolicyFile=${quote(coding)}}})){try{if($case.kind -eq 'process'){Get-ProcessPolicyMetadata $case.cfg|Out-Null}else{Get-CodingPolicyMetadata $case.cfg|Out-Null};throw 'unexpected pass'}catch{$errors+=$_.Exception.Message}};$errors|ConvertTo-Json -Compress`;
|
|
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
9
9
|
|
|
10
10
|
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..');
|
|
11
11
|
test('R33 deferred worker survives scheduler exit and stays bound to explicit state root',
|
|
12
|
-
{ skip: process.platform !== 'win32', timeout:
|
|
12
|
+
{ skip: process.platform !== 'win32', timeout:30000 }, async()=>{
|
|
13
13
|
const state=await mkdtemp(path.join(os.tmpdir(),'deadbyte-deferred-'));
|
|
14
14
|
try {
|
|
15
15
|
const child=spawn(process.execPath,['scripts/deferred-slot-operation.mjs','activate','0'.repeat(64)],{
|
|
@@ -22,7 +22,7 @@ test('R33 deferred worker survives scheduler exit and stays bound to explicit st
|
|
|
22
22
|
assert.equal(scheduled.status,'scheduled');
|
|
23
23
|
assert.ok(path.resolve(scheduled.state_path).startsWith(path.resolve(state)+path.sep));
|
|
24
24
|
let record;
|
|
25
|
-
for(let i=0;i<
|
|
25
|
+
for(let i=0;i<60;i++){
|
|
26
26
|
await sleep(300);
|
|
27
27
|
record=JSON.parse(await readFile(scheduled.state_path,'utf8'));
|
|
28
28
|
if(record.state==='failed'||record.state==='passed') break;
|
|
@@ -18,9 +18,9 @@ async function fixture(){
|
|
|
18
18
|
await mkdir(project); await mkdir(trust);
|
|
19
19
|
const keys=await generateTrustKeypair({privateKeyPath:path.join(trust,'private.pem'),publicKeyPath:path.join(trust,'public.pem')});
|
|
20
20
|
const codingPath=path.join(root,'coding-policy.json');
|
|
21
|
-
await writeFile(codingPath,JSON.stringify({schema:'deadbyte.coding-policy.v1',enabled:true,lease_file:path.join(root,'coding-lease.json'),evidence_dir:path.join(root,'coding-evidence'),roots:{project:{path:project,read:true,write:true,exec:false,deny_paths:[]}},commands:{},max_read_bytes:524288,max_write_bytes:2097152}));
|
|
21
|
+
await writeFile(codingPath,JSON.stringify({schema:'deadbyte.coding-policy.v1',enabled:true,lease_file:path.join(root,'coding-lease.json'),evidence_dir:path.join(root,'coding-evidence'),roots:{project:{path:project,read:true,write:true,exec:false,deny_paths:[]},preview:{path:project,read:true,write:false,exec:false,deny_paths:[]}},commands:{},max_read_bytes:524288,max_write_bytes:2097152}));
|
|
22
22
|
const codingPolicy=await loadCodingPolicy(codingPath);
|
|
23
|
-
await writeFile(codingPolicy.lease_file,JSON.stringify({schema:'deadbyte.coding-lease.v1',policy_sha256:codingPolicy.policy_sha256,instance_nonce:randomBytes(32).toString('hex'),root_ids:['project'],armed_at_utc:new Date().toISOString(),expires_at_utc:new Date(Date.now()+3600000).toISOString()}));
|
|
23
|
+
await writeFile(codingPolicy.lease_file,JSON.stringify({schema:'deadbyte.coding-lease.v1',policy_sha256:codingPolicy.policy_sha256,instance_nonce:randomBytes(32).toString('hex'),root_ids:['project','preview'],armed_at_utc:new Date().toISOString(),expires_at_utc:new Date(Date.now()+3600000).toISOString()}));
|
|
24
24
|
const autoPath=path.join(root,'autonomous-policy.json');
|
|
25
25
|
await writeFile(autoPath,JSON.stringify({schema:'deadbyte.autonomous-policy.v1',enabled:true,lease_file:path.join(root,'auto-lease.json'),evidence_dir:path.join(root,'auto-evidence'),root_ids:['project'],coding_policy_sha256:codingPolicy.policy_sha256,planner:{backend:'client_sampling',max_tokens:2048},profiles:{},limits:{max_files_per_diff:12,max_diff_bytes:1048576}}));
|
|
26
26
|
const policy=await loadAutonomousPolicy(autoPath,codingPolicy);
|
|
@@ -31,6 +31,39 @@ async function fixture(){
|
|
|
31
31
|
return {root,project,keys,policy,codingRuntime,machineFsRuntime,nativeDiff};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
test('R71 Native Diff V2 Coding-only topology preview is non-applicable',async()=>{
|
|
35
|
+
const f=await fixture();
|
|
36
|
+
try{
|
|
37
|
+
const preview=await f.nativeDiff.preview({rootId:'preview',title:'read-only topology',operations:[
|
|
38
|
+
{kind:'mkdir',path:'candidate/newdir'}
|
|
39
|
+
]});
|
|
40
|
+
assert.equal(preview.status,'preview_only');
|
|
41
|
+
assert.equal(preview.schema,NATIVE_DIFF_V2_SCHEMA);
|
|
42
|
+
assert.equal(preview.diff_id,undefined);
|
|
43
|
+
assert.equal(preview.root_id,'preview');
|
|
44
|
+
assert.equal(preview.operation_count,1);
|
|
45
|
+
assert.equal(await exists(path.join(f.project,'candidate')),false);
|
|
46
|
+
assert.equal(await exists(path.join(f.policy.evidence_dir,'native-diffs')),false);
|
|
47
|
+
await assert.rejects(f.nativeDiff.apply({diffId:'0'.repeat(64)}));
|
|
48
|
+
await rm(f.codingRuntime.policy.lease_file);
|
|
49
|
+
await assert.rejects(f.nativeDiff.preview({rootId:'preview',operations:[
|
|
50
|
+
{kind:'mkdir',path:'after-revoke'}
|
|
51
|
+
]}),/coding plane is disarmed/);
|
|
52
|
+
}finally{await rm(f.root,{recursive:true,force:true});}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('V2 topology preview on an Autonomous root remains non-applicable after Autonomous revocation',async()=>{
|
|
56
|
+
const f=await fixture();
|
|
57
|
+
try{
|
|
58
|
+
await rm(f.policy.lease_file);
|
|
59
|
+
const preview=await f.nativeDiff.preview({rootId:'project',operations:[{kind:'mkdir',path:'still-read-only'}]});
|
|
60
|
+
assert.equal(preview.status,'preview_only');
|
|
61
|
+
assert.equal(preview.diff_id,undefined);
|
|
62
|
+
assert.equal(await exists(path.join(f.project,'still-read-only')),false);
|
|
63
|
+
assert.equal(await exists(path.join(f.policy.evidence_dir,'native-diffs')),false);
|
|
64
|
+
}finally{await rm(f.root,{recursive:true,force:true});}
|
|
65
|
+
});
|
|
66
|
+
|
|
34
67
|
test('R36 Native Diff V2 commits mkdir write move and independently verifies mixed receipts',async()=>{
|
|
35
68
|
const f=await fixture(); try{
|
|
36
69
|
await writeFile(path.join(f.project,'seed.txt'),'seed\n');
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import { createHash, randomBytes } from 'node:crypto';
|
|
4
|
-
import { access, mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { access, mkdtemp, mkdir, readFile, rm, symlink, writeFile } from 'node:fs/promises';
|
|
5
5
|
import os from 'node:os';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { generateTrustKeypair } from '../src/trust.mjs';
|
|
8
8
|
import { createCodingRuntime, loadCodingPolicy } from '../src/coding-plane.mjs';
|
|
9
9
|
import { loadAutonomousPolicy } from '../src/autonomous-policy.mjs';
|
|
10
10
|
import { createNativeDiffRuntime } from '../src/native-diff.mjs';
|
|
11
|
+
import { registerAutonomousTools } from '../src/autonomous-mcp-tools.mjs';
|
|
11
12
|
|
|
12
13
|
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
13
14
|
const exists = file => access(file).then(() => true, () => false);
|
|
@@ -19,10 +20,11 @@ async function fixture() {
|
|
|
19
20
|
const codingPolicyPath = path.join(root, 'coding-policy.json');
|
|
20
21
|
await writeFile(codingPolicyPath, JSON.stringify({ schema:'deadbyte.coding-policy.v1', enabled:true,
|
|
21
22
|
lease_file:path.join(root,'coding-lease.json'), evidence_dir:path.join(root,'coding-evidence'),
|
|
22
|
-
roots:{ project:{ path:project, read:true, write:true, exec:true, deny_paths:[] }
|
|
23
|
+
roots:{ project:{ path:project, read:true, write:true, exec:true, deny_paths:[] },
|
|
24
|
+
preview:{ path:project, read:true, write:false, exec:false, deny_paths:[] } }, commands:{} }, null, 2));
|
|
23
25
|
const codingPolicy = await loadCodingPolicy(codingPolicyPath);
|
|
24
26
|
await writeFile(codingPolicy.lease_file, JSON.stringify({ schema:'deadbyte.coding-lease.v1', policy_sha256:codingPolicy.policy_sha256,
|
|
25
|
-
instance_nonce:randomBytes(32).toString('hex'), root_ids:['project'], armed_at_utc:new Date().toISOString(),
|
|
27
|
+
instance_nonce:randomBytes(32).toString('hex'), root_ids:['project','preview'], armed_at_utc:new Date().toISOString(),
|
|
26
28
|
expires_at_utc:new Date(Date.now()+3600000).toISOString() }));
|
|
27
29
|
const autonomousPolicyPath = path.join(root, 'autonomous-policy.json');
|
|
28
30
|
await writeFile(autonomousPolicyPath, JSON.stringify({ schema:'deadbyte.autonomous-policy.v1', enabled:true,
|
|
@@ -38,6 +40,84 @@ async function fixture() {
|
|
|
38
40
|
return { root, project, keys, policy, codingRuntime, nativeDiff };
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
test('R71 Coding-only native_diff_preview does not create an applicable signed diff',async()=>{
|
|
44
|
+
const f=await fixture();
|
|
45
|
+
try{
|
|
46
|
+
const file=path.join(f.project,'only-preview.txt');
|
|
47
|
+
await writeFile(file,'original text\n');
|
|
48
|
+
const before=sha(await readFile(file));
|
|
49
|
+
const preview=await f.nativeDiff.preview({rootId:'preview',title:'read-only project preview',operations:[
|
|
50
|
+
{kind:'replace',path:'only-preview.txt',expected_sha256:before,old_string:'original',new_string:'updated',expected_replacements:1}
|
|
51
|
+
]});
|
|
52
|
+
assert.equal(preview.status,'preview_only');
|
|
53
|
+
assert.equal(preview.diff_id,undefined);
|
|
54
|
+
assert.equal(preview.root_id,'preview');
|
|
55
|
+
assert.equal(preview.operation_count,1);
|
|
56
|
+
assert.equal((await readFile(file,'utf8')),'original text\n');
|
|
57
|
+
assert.equal(await exists(path.join(f.policy.evidence_dir,'native-diffs')),false);
|
|
58
|
+
await assert.rejects(f.nativeDiff.apply({diffId:'0'.repeat(64)}));
|
|
59
|
+
await assert.rejects(f.nativeDiff.preview({rootId:'ungranted',operations:[
|
|
60
|
+
{kind:'write',path:'not-allowed.txt',content:'abc',expected_sha256:'absent'}
|
|
61
|
+
]}),/not allowed|disarmed|denied|root/);
|
|
62
|
+
await rm(f.codingRuntime.policy.lease_file);
|
|
63
|
+
await assert.rejects(f.nativeDiff.preview({rootId:'preview',operations:[
|
|
64
|
+
{kind:'replace',path:'only-preview.txt',expected_sha256:before,old_string:'original',new_string:'updated'}
|
|
65
|
+
]}),/coding plane is disarmed/);
|
|
66
|
+
}finally{await rm(f.root,{recursive:true,force:true});}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('MCP preview on an Autonomous-policy root remains read-only with only Coding authority',async()=>{
|
|
70
|
+
const f=await fixture();
|
|
71
|
+
try{
|
|
72
|
+
const file=path.join(f.project,'mcp-preview.txt');
|
|
73
|
+
await writeFile(file,'old\n');
|
|
74
|
+
const before=sha(await readFile(file));
|
|
75
|
+
await rm(f.policy.lease_file);
|
|
76
|
+
const handlers=new Map();
|
|
77
|
+
const contracts=new Map();
|
|
78
|
+
registerAutonomousTools({registerTool:(name,contract,handler)=>{handlers.set(name,handler);contracts.set(name,contract);}},
|
|
79
|
+
{autonomousRuntime:{},nativeDiffRuntime:f.nativeDiff});
|
|
80
|
+
assert.match(contracts.get('native_diff_preview').description,/Coding read authority/i);
|
|
81
|
+
assert.match(contracts.get('native_diff_preview').description,/preview.only/i);
|
|
82
|
+
const response=await handlers.get('native_diff_preview')({root_id:'project',title:'read only',operations:[
|
|
83
|
+
{kind:'replace',path:'mcp-preview.txt',expected_sha256:before,old_string:'old',new_string:'new',expected_replacements:1}
|
|
84
|
+
]});
|
|
85
|
+
assert.equal(response.isError,false);
|
|
86
|
+
assert.equal(response.structuredContent.status,'preview_only');
|
|
87
|
+
assert.equal(response.structuredContent.diff_id,undefined);
|
|
88
|
+
assert.equal(sha(await readFile(file)),before);
|
|
89
|
+
assert.equal(await exists(path.join(f.policy.evidence_dir,'native-diffs')),false);
|
|
90
|
+
}finally{await rm(f.root,{recursive:true,force:true});}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('Coding-only preview denies escaped, reparse, and expired authority without changing targets',async()=>{
|
|
94
|
+
const f=await fixture();
|
|
95
|
+
try{
|
|
96
|
+
await rm(f.policy.lease_file);
|
|
97
|
+
const outside=path.join(f.root,'outside.txt');
|
|
98
|
+
await writeFile(outside,'outside\n');
|
|
99
|
+
const outsideSha=sha(await readFile(outside));
|
|
100
|
+
await assert.rejects(f.nativeDiff.preview({rootId:'project',operations:[
|
|
101
|
+
{kind:'replace',path:'../outside.txt',expected_sha256:outsideSha,old_string:'outside',new_string:'changed'}
|
|
102
|
+
]}),/path|escape|outside|relative/i);
|
|
103
|
+
const link=path.join(f.project,'linked');
|
|
104
|
+
const target=path.join(f.root,'external');
|
|
105
|
+
await mkdir(target);
|
|
106
|
+
await writeFile(path.join(target,'target.txt'),'outside\n');
|
|
107
|
+
await symlink(target,link,process.platform==='win32'?'junction':'dir');
|
|
108
|
+
await assert.rejects(f.nativeDiff.preview({rootId:'project',operations:[
|
|
109
|
+
{kind:'replace',path:'linked/target.txt',expected_sha256:outsideSha,old_string:'outside',new_string:'changed'}
|
|
110
|
+
]}),/reparse|symlink|path|outside|root/i);
|
|
111
|
+
const lease=JSON.parse(await readFile(f.codingRuntime.policy.lease_file,'utf8'));
|
|
112
|
+
await writeFile(f.codingRuntime.policy.lease_file,JSON.stringify({...lease,expires_at_utc:new Date(Date.now()-1000).toISOString()}));
|
|
113
|
+
await assert.rejects(f.nativeDiff.preview({rootId:'project',operations:[
|
|
114
|
+
{kind:'write',path:'new.txt',content:'new',expected_sha256:'absent'}
|
|
115
|
+
]}),/coding plane is disarmed: expired/);
|
|
116
|
+
assert.equal(sha(await readFile(outside)),outsideSha);
|
|
117
|
+
assert.equal(sha(await readFile(path.join(target,'target.txt'))),outsideSha);
|
|
118
|
+
}finally{await rm(f.root,{recursive:true,force:true});}
|
|
119
|
+
});
|
|
120
|
+
|
|
41
121
|
test('native diff commits exact preconditioned edits and independently verifies coding receipts', async () => {
|
|
42
122
|
const f = await fixture();
|
|
43
123
|
try {
|
|
@@ -6,7 +6,7 @@ import path from 'node:path';
|
|
|
6
6
|
import { spawn } from 'node:child_process';
|
|
7
7
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
8
8
|
|
|
9
|
-
test('R58 foreground cleanup failure retains ownership evidence for recovery', {timeout:
|
|
9
|
+
test('R58 foreground cleanup failure retains ownership evidence for recovery', {timeout:60000}, async () => {
|
|
10
10
|
const base='D:/Projects/deadbyte-mcp/testing/0.15.35/fixtures';
|
|
11
11
|
await mkdir(base,{recursive:true});
|
|
12
12
|
const root=await mkdtemp(path.join(base,'cleanup-'));
|
|
@@ -29,12 +29,12 @@ switch ($Command) {
|
|
|
29
29
|
}
|
|
30
30
|
exit 0
|
|
31
31
|
`);
|
|
32
|
-
const child=spawn(process.execPath,[fileURLToPath(new URL('../src/deadbyte-cli.mjs',import.meta.url)),'remote'],{env:{...process.env,DEADBYTE_STATE_ROOT:root},windowsHide:true,stdio:['pipe','pipe','pipe']});
|
|
32
|
+
const child=spawn(process.execPath,[fileURLToPath(new URL('../src/deadbyte-cli.mjs',import.meta.url)),'remote','--operator'],{env:{...process.env,DEADBYTE_STATE_ROOT:root},windowsHide:true,stdio:['pipe','pipe','pipe']});
|
|
33
33
|
let stdout='',stderr='';
|
|
34
34
|
child.stdout.on('data',b=>{stdout+=b;});child.stderr.on('data',b=>{stderr+=b;});
|
|
35
35
|
const closed=new Promise(resolve=>child.once('close',code=>resolve(code)));
|
|
36
36
|
try {
|
|
37
|
-
const deadline=Date.now()+
|
|
37
|
+
const deadline=Date.now()+50000;
|
|
38
38
|
while(!stdout.includes('[READY]')&&child.exitCode===null&&Date.now()<deadline) await delay(50);
|
|
39
39
|
assert.match(stdout,/\[READY\]/,stderr);
|
|
40
40
|
assert.match(stdout,/\[AUTH\] process ARMED \| coding ARMED \| autonomous ARMED \| desktop DISARMED \| host DISARMED/,stderr);
|
|
@@ -6,7 +6,7 @@ import {fileURLToPath} from 'node:url';
|
|
|
6
6
|
import {spawn} from 'node:child_process';
|
|
7
7
|
import {setTimeout as delay} from 'node:timers/promises';
|
|
8
8
|
|
|
9
|
-
test('R58 simultaneous stale recovery cannot both revoke the shared authority', {timeout:
|
|
9
|
+
test('R58 simultaneous stale recovery cannot both revoke the shared authority', {timeout:90000},async()=>{
|
|
10
10
|
const base='D:/Projects/deadbyte-mcp/testing/0.15.35/fixtures';await mkdir(base,{recursive:true});
|
|
11
11
|
const root=await mkdtemp(path.join(base,'concurrent-recovery-'));await mkdir(path.join(root,'bin'));await mkdir(path.join(root,'runtime'));
|
|
12
12
|
const trace=path.join(root,'trace.txt'),markerPath=path.join(root,'runtime','remote-session.json');
|
|
@@ -47,14 +47,14 @@ exit 0
|
|
|
47
47
|
const c=spawn(process.execPath,[fileURLToPath(new URL('../src/deadbyte-cli.mjs',import.meta.url)),'remote'],{env:{...process.env,DEADBYTE_STATE_ROOT:root},stdio:['pipe','pipe','pipe'],windowsHide:true});
|
|
48
48
|
const o={stdout:'',stderr:''};c.stdout.on('data',b=>{o.stdout+=b;});c.stderr.on('data',b=>{o.stderr+=b;});o.exit=new Promise(resolve=>c.once('exit',resolve));children.push(c);outputs.push(o);
|
|
49
49
|
}
|
|
50
|
-
const until=Date.now()+
|
|
50
|
+
const until=Date.now()+45000;let commands=[];
|
|
51
51
|
while(Date.now()<until){try{commands=(await readFile(trace,'utf8')).trim().split(/\r?\n/);}catch{}if(outputs.some(o=>o.stdout.includes('[READY]')))break;await delay(50);}
|
|
52
52
|
await writeFile(path.join(root,'observation.json'),JSON.stringify({commands,outputs:outputs.map(o=>({stdout:o.stdout,stderr:o.stderr})),simulation:'concurrent stale marker recovery with delayed second park'}),{flag:'wx'});
|
|
53
53
|
assert.ok(outputs.some(o=>o.stdout.includes('[READY]')),'a recovered foreground must become ready');
|
|
54
54
|
for(const cmd of ['disarmautonomous','disarmcoding','disarmprocess','disarmdesktop','disarmhost'])assert.equal(commands.filter(x=>x===cmd).length,1,`stale recovery must serialize ${cmd}`);
|
|
55
55
|
}finally{
|
|
56
56
|
for(const c of children)if(c.exitCode===null)c.stdin.end();
|
|
57
|
-
await Promise.race([Promise.all(outputs.map(o=>o.exit)),delay(
|
|
57
|
+
await Promise.race([Promise.all(outputs.map(o=>o.exit)),delay(30000)]);
|
|
58
58
|
for(const c of children)if(c.exitCode===null&&c.signalCode===null)c.kill();
|
|
59
59
|
}
|
|
60
60
|
});
|
|
@@ -46,7 +46,7 @@ test('R58 live unrelated PID is not accepted as a remote foreground owner', {tim
|
|
|
46
46
|
assert.notEqual(code,0);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
test('R58 bound stale birth identity reconciles on the first invocation without killing a reused PID', {timeout:
|
|
49
|
+
test('R58 bound stale birth identity reconciles on the first invocation without killing a reused PID', {timeout:60000}, async()=>{
|
|
50
50
|
const base='D:/Projects/deadbyte-mcp/testing/0.15.35/fixtures';
|
|
51
51
|
await mkdir(base,{recursive:true});const root=await mkdtemp(path.join(base,'stale-birth-'));
|
|
52
52
|
await mkdir(path.join(root,'runtime'));await mkdir(path.join(root,'bin'));
|
|
@@ -71,7 +71,7 @@ async function captureCurrentSurface(){
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
test('
|
|
74
|
+
test('R72 compact baseline permits only R64 read offset and authorized coding-only preview output',async()=>{
|
|
75
75
|
const raw=JSON.parse(await readFile(fixturePath,'utf8'));
|
|
76
76
|
assert.equal(raw.schema,'deadbyte.tool-surface-baseline.v1');
|
|
77
77
|
assert.equal(raw.release_id,'v0.15.35-1b5715b276facbc0');
|
|
@@ -83,13 +83,17 @@ test('R59 compact baseline changes only at the explicitly authorized R64 read-of
|
|
|
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'].includes(packageVersion)){
|
|
87
|
-
assert.deepEqual(diff.schema_changed,['machine_fs']);
|
|
88
|
-
assert.equal(diff.unchanged.length,
|
|
86
|
+
if(['0.15.41','0.15.42','0.15.43','0.15.44','0.15.45','0.15.46'].includes(packageVersion)){
|
|
87
|
+
assert.deepEqual([...diff.schema_changed].sort(),['machine_fs','native_diff_preview']);
|
|
88
|
+
assert.equal(diff.unchanged.length,41);
|
|
89
89
|
const prior=baseline.tools.find(tool=>tool.name==='machine_fs');
|
|
90
90
|
const present=current.tools.find(tool=>tool.name==='machine_fs');
|
|
91
|
-
assert.equal(present.output_sha256,prior.output_sha256,'output contract must remain unchanged');
|
|
91
|
+
assert.equal(present.output_sha256,prior.output_sha256,'machine_fs output contract must remain unchanged');
|
|
92
92
|
assert.notEqual(present.input_sha256,prior.input_sha256,'R64 must expose the widened read offset');
|
|
93
|
+
const previewBefore=baseline.tools.find(tool=>tool.name==='native_diff_preview');
|
|
94
|
+
const previewAfter=current.tools.find(tool=>tool.name==='native_diff_preview');
|
|
95
|
+
assert.equal(previewAfter.input_sha256,previewBefore.input_sha256,'preview-only must not change input permissions or tool selection');
|
|
96
|
+
assert.notEqual(previewAfter.output_sha256,previewBefore.output_sha256,'preview-only output must be declared in MCP schema');
|
|
93
97
|
}else{
|
|
94
98
|
assert.deepEqual(diff.schema_changed,[]);
|
|
95
99
|
assert.equal(diff.unchanged.length,43);
|
|
@@ -10,7 +10,8 @@ const observed = (armed={}) => ({
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
test('remote modes have exact non-widening authority vectors',()=>{
|
|
13
|
-
assert.deepEqual(authorityVector('default'),{process:
|
|
13
|
+
assert.deepEqual(authorityVector('default'),{process:false,coding:false,autonomous:false,desktop:false,host:false});
|
|
14
|
+
assert.deepEqual(authorityVector('operator'),{process:true,coding:true,autonomous:true,desktop:false,host:false});
|
|
14
15
|
assert.deepEqual(authorityVector('desktop'),{process:true,coding:true,autonomous:true,desktop:true,host:false});
|
|
15
16
|
assert.deepEqual(authorityVector('host'),{process:true,coding:true,autonomous:true,desktop:false,host:true});
|
|
16
17
|
assert.deepEqual(authorityVector('full'),{process:true,coding:true,autonomous:true,desktop:true,host:true});
|
|
@@ -18,7 +19,7 @@ test('remote modes have exact non-widening authority vectors',()=>{
|
|
|
18
19
|
|
|
19
20
|
test('observed standing Host grant rejects bounded READY',()=>{
|
|
20
21
|
const snapshot=parseAuthorityObservation(JSON.stringify(observed({process:true,coding:true,autonomous:true,host:true})));
|
|
21
|
-
assert.throws(()=>assertAuthorityVector(snapshot,authorityVector('
|
|
22
|
+
assert.throws(()=>assertAuthorityVector(snapshot,authorityVector('operator')),/host.*expected DISARMED/);
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
test('malformed or incomplete controller observation fails closed',()=>{
|
|
@@ -34,3 +35,10 @@ test('readiness requires verified Bridge Core Cloud and local MCP, not just ONLI
|
|
|
34
35
|
assert.throws(()=>assertRuntimeReadyObservation({...value,core:{alive:false,reason:'wrong-core-generation'}}),/core/);
|
|
35
36
|
assert.throws(()=>assertRuntimeReadyObservation({...value,core_root:'D:\\wrong'} ,{coreRoot:'D:\\exact-release'}),/core root/);
|
|
36
37
|
});
|
|
38
|
+
|
|
39
|
+
test('safe default rejects a pre-existing grant in any plane, not only Host',()=>{
|
|
40
|
+
for(const plane of ['process','coding','autonomous','desktop','host']){
|
|
41
|
+
const snapshot=parseAuthorityObservation(JSON.stringify(observed({[plane]:true})));
|
|
42
|
+
assert.throws(()=>assertAuthorityVector(snapshot,authorityVector('default')),new RegExp(`${plane}.*expected DISARMED`));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import {mkdtemp,mkdir,rm,writeFile,readFile} from 'node:fs/promises';
|
|
4
|
-
import {createHash} from 'node:crypto';
|
|
4
|
+
import {createHash,generateKeyPairSync} from 'node:crypto';
|
|
5
5
|
import os from 'node:os';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import {loadCodingPolicy,codingSessionStatus} from '../src/coding-plane.mjs';
|
|
@@ -37,6 +37,14 @@ test('R65 standing Coding grant is disarmed until the durable epoch binds the ex
|
|
|
37
37
|
assert.equal(trusted.armed,true);
|
|
38
38
|
assert.equal(trusted.reason,'standing-grant');
|
|
39
39
|
assert.equal(trusted.instance_nonce,grant.instance_nonce);
|
|
40
|
+
const publicPath=path.join(root,'trust','ed25519-public.pem');
|
|
41
|
+
const originalPublic=await readFile(publicPath);
|
|
42
|
+
const rotated=generateKeyPairSync('ed25519').publicKey.export({format:'pem',type:'spki'});
|
|
43
|
+
await writeFile(publicPath,rotated);
|
|
44
|
+
const denied=await codingSessionStatus(policy);
|
|
45
|
+
assert.equal(denied.armed,false,'changed trust bytes must not reuse the cached parsed key');
|
|
46
|
+
await writeFile(publicPath,originalPublic);
|
|
47
|
+
assert.equal((await codingSessionStatus(policy)).armed,true);
|
|
40
48
|
}finally{
|
|
41
49
|
await rm(root,{recursive:true,force:true});
|
|
42
50
|
}
|
|
@@ -22,7 +22,8 @@ async function generation(state,label){
|
|
|
22
22
|
return {root,manifest_sha256:sha(manifest),config_path:path.join(root,'controller-config.psd1')};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const historicalR67=JSON.parse(await readFile(path.join(candidate,'package.json'),'utf8')).version==='0.15.44';
|
|
26
|
+
test('R67 isolated immutable slot activates, rolls back exact R66, and restores the same R67 bytes with no authority',{skip:historicalR67?false:'Historical R67 regression applies only to package version 0.15.44; R71 test is separate'},async()=>{
|
|
26
27
|
const base=await mkdtemp(path.join(os.tmpdir(),'deadbyte-r67-slot-parity-'));
|
|
27
28
|
const state=path.join(base,'state');
|
|
28
29
|
try{
|
|
@@ -3,10 +3,12 @@ import assert from 'node:assert/strict';
|
|
|
3
3
|
import {readFile} from 'node:fs/promises';
|
|
4
4
|
import {fileURLToPath} from 'node:url';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
+
import os from 'node:os';
|
|
6
7
|
import {assertR67NpmPublishReady} from '../scripts/npm-release-readiness-r67.mjs';
|
|
7
8
|
const root=path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
8
|
-
test('
|
|
9
|
-
const
|
|
9
|
+
test('sealed R67 predecessor retains its exact npm publish-readiness metadata gate',async()=>{
|
|
10
|
+
const sealed=path.join(os.homedir(),'.deadbyte-mcp','releases','v0.15.44-9f500af433df3e77');
|
|
11
|
+
const release=JSON.parse(await readFile(path.join(sealed,'RELEASE.json'),'utf8'));
|
|
10
12
|
assert.equal(release.r67_native_observation.status,'CANDIDATE_SEALED');
|
|
11
13
|
assert.doesNotThrow(()=>assertR67NpmPublishReady(release));
|
|
12
14
|
});
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import {readFile} from 'node:fs/promises';
|
|
4
|
-
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
const sealedRoot=path.join(os.homedir(),'.deadbyte-mcp','releases','v0.15.44-9f500af433df3e77');
|
|
7
|
+
const get=async rel=>JSON.parse(await readFile(path.join(sealedRoot,rel),'utf8'));
|
|
5
8
|
const parent={
|
|
6
9
|
release_id:'v0.15.43-4c4a64a4c8e9f5a6',
|
|
7
10
|
manifest_sha256:'4c4a64a4c8e9f5a6e9eecce85fd0007ebcac99121b29c07f1a1fc81d1643cd33',
|
|
8
11
|
generation_manifest_sha256:'ef3b041e2a87c2e143d4733a98a52d9db80cd16ad7007e112fcb5202e70c77c3'
|
|
9
12
|
};
|
|
10
|
-
test('R67 release version,
|
|
11
|
-
const [pkg,
|
|
12
|
-
get('package.json'),get('
|
|
13
|
+
test('sealed R67 predecessor preserves its release version, lineage and prepublish evidence',async()=>{
|
|
14
|
+
const [pkg,bridge,release,prov,matrix,sbom,version]=await Promise.all([
|
|
15
|
+
get('package.json'),get('bridge/package.json'),
|
|
13
16
|
get('RELEASE.json'),get('PROVENANCE.json'),get('TEST-MATRIX.json'),get('SBOM.cdx.json'),
|
|
14
|
-
readFile(
|
|
17
|
+
readFile(path.join(sealedRoot,'src','version.mjs'),'utf8')
|
|
15
18
|
]);
|
|
16
19
|
assert.equal(pkg.version,'0.15.44');
|
|
17
|
-
assert.equal(lock.version,pkg.version);
|
|
18
|
-
assert.equal(lock.packages[''].version,pkg.version);
|
|
19
20
|
assert.equal(bridge.version,pkg.version);
|
|
20
21
|
assert.match(version,/DEADBYTE_VERSION = '0\.15\.44'/);
|
|
21
22
|
assert.equal(release.version,pkg.version);
|