deadbyte-mcp 0.15.2 → 0.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/MANIFEST.SHA256 +66 -41
  2. package/PROVENANCE.json +3 -3
  3. package/RELEASE.json +3 -3
  4. package/package.json +1 -1
  5. package/scripts/autonomous-build.ps1 +1 -0
  6. package/scripts/autonomous-tests.ps1 +1 -0
  7. package/scripts/check-agent-backend-r46.mjs +77 -0
  8. package/scripts/check-atomic-resource-r46.mjs +84 -0
  9. package/scripts/check-autonomous-race-r46.mjs +160 -0
  10. package/scripts/check-coding-task-deadline-r46.mjs +59 -0
  11. package/scripts/check-deadline-cancellation-r46.mjs +49 -0
  12. package/scripts/check-process-deadline-r46.mjs +52 -0
  13. package/scripts/check-r46-background.mjs +5 -0
  14. package/scripts/extract-r46-failures.mjs +5 -0
  15. package/scripts/full-regression-r46.mjs +20 -12
  16. package/scripts/gate-windows-r46.ps1 +2 -0
  17. package/scripts/inspect-r46-active.mjs +2 -0
  18. package/scripts/r47-core-failures.mjs +1 -0
  19. package/scripts/release-manifest.mjs +1 -1
  20. package/scripts/run-r46-full-regression-background.mjs +7 -0
  21. package/scripts/run-r46-windows-gate-background.mjs +6 -0
  22. package/scripts/run-r46-windows-gate-background.ps1 +10 -0
  23. package/scripts/windows-gate-evidence-r46.mjs +4 -3
  24. package/scripts/workload-contract-regression-r47.mjs +14 -0
  25. package/scripts/workload-stream-regression.mjs +16 -0
  26. package/scripts/workload-substrate-r47-regression.mjs +12 -0
  27. package/src/agent-backend-r44.mjs +75 -10
  28. package/src/atomic-mutation.mjs +55 -0
  29. package/src/autonomous-mcp-tools.mjs +4 -3
  30. package/src/autonomous-output-contracts.mjs +16 -3
  31. package/src/autonomous-runtime.mjs +83 -30
  32. package/src/coding-mcp-tools.mjs +6 -6
  33. package/src/coding-output-contracts.mjs +20 -5
  34. package/src/coding-plane.mjs +3 -24
  35. package/src/coding-search.mjs +52 -15
  36. package/src/coding-task-runtime.mjs +41 -6
  37. package/src/compact-gateway-mcp-tools.mjs +3 -3
  38. package/src/deadline-cancellation.mjs +83 -0
  39. package/src/fuzzy-search-core.mjs +117 -0
  40. package/src/fuzzy-search-worker.mjs +8 -0
  41. package/src/fuzzy-search.mjs +34 -0
  42. package/src/machine-fs-mcp-tools.mjs +1 -1
  43. package/src/machine-fs-output-contracts.mjs +1 -1
  44. package/src/machine-fs-smoke-client.mjs +1 -1
  45. package/src/machine-fs.mjs +10 -29
  46. package/src/mcp-server.mjs +6 -0
  47. package/src/observation-smoke-client.mjs +1 -1
  48. package/src/process-mcp-tools.mjs +11 -3
  49. package/src/process-output-contracts.mjs +23 -0
  50. package/src/process-runtime.mjs +54 -5
  51. package/src/process-smoke-client.mjs +1 -1
  52. package/src/resource-identity.mjs +59 -0
  53. package/src/runtime-update.mjs +526 -162
  54. package/src/workload-substrate.mjs +87 -0
  55. package/test/coding-runtime.test.mjs +12 -0
  56. package/test/coding-search-r36.test.mjs +7 -0
  57. package/test/full-max-catalog-r46.test.mjs +2 -2
  58. package/test/fuzzy-search-r46.test.mjs +54 -0
  59. package/test/helpers/autonomous-r34-fixture.mjs +10 -1
  60. package/test/machine-fs-mcp-tools.test.mjs +2 -0
  61. package/test/machine-fs-runtime.test.mjs +6 -0
  62. package/test/process-mcp-tools.test.mjs +5 -2
  63. package/test/process-runtime.test.mjs +18 -1
  64. package/test/r45-finalization.test.mjs +1 -1
  65. package/test/release-version.test.mjs +1 -1
  66. package/test/runtime-self-update.test.mjs +118 -1
  67. package/test/workload-substrate.test.mjs +22 -0
@@ -0,0 +1,160 @@
1
+ import assert from 'node:assert/strict';
2
+ import path from 'node:path';
3
+ import os from 'node:os';
4
+ import { readFile } from 'node:fs/promises';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { createHash } from 'node:crypto';
7
+ import { Client } from '@modelcontextprotocol/client';
8
+ import { StdioClientTransport, getDefaultEnvironment } from '@modelcontextprotocol/client/stdio';
9
+
10
+ const here = path.dirname(fileURLToPath(import.meta.url));
11
+ const repoRoot = path.resolve(here, '..');
12
+ const serverPath = path.join(repoRoot, 'src', 'mcp-server.mjs');
13
+ const stateRoot = path.resolve(process.env.DEADBYTE_STATE_ROOT || path.join(os.homedir(), '.deadbyte-mcp'));
14
+ const active = JSON.parse(await readFile(path.join(stateRoot, 'active-release.json'), 'utf8'));
15
+ const generationRoot = active.generation_root;
16
+ const sleep = ms => new Promise(r => setTimeout(r, ms));
17
+ const json = v => JSON.stringify(v);
18
+ const sha256 = s => createHash('sha256').update(s).digest('hex');
19
+ const raw = action => json({ schema:'deadbyte.autonomous-decision.v1', action, summary:action });
20
+ const delegate = (profile_id, request_id) => json({
21
+ schema:'deadbyte.autonomous-decision.v1',
22
+ action:'delegate',
23
+ summary:'start child process',
24
+ operation:{ kind:'process_start', profile_id, cwd:'.' }
25
+ });
26
+ const runProfile = (profile_id, request_id) => json({schema:'deadbyte.autonomous-decision.v1',action:'run_profile',summary:'run bounded child profile',profile_id});
27
+
28
+ const env = {
29
+ ...getDefaultEnvironment(),
30
+ DEADBYTE_WORKSPACE_ROOT: path.join(repoRoot, 'workspaces'),
31
+ DEADBYTE_AGENT_RUNTIME:'1',
32
+ DEADBYTE_PROCESS_RUNTIME:'1',
33
+ DEADBYTE_CODING_RUNTIME:'1',
34
+ DEADBYTE_AUTONOMOUS_RUNTIME:'1',
35
+ DEADBYTE_MACHINE_RUNTIME:'0',
36
+ DEADBYTE_OBSERVATION_RUNTIME:'0',
37
+ DEADBYTE_MACHINE_FS_RUNTIME:'0',
38
+ DEADBYTE_DESKTOP_RUNTIME:'0',
39
+ DEADBYTE_AUTONOMOUS_POLICY:path.join(generationRoot,'autonomous-policy.json'),
40
+ DEADBYTE_PROCESS_POLICY:path.join(generationRoot,'process-policy.json'),
41
+ DEADBYTE_CODING_POLICY:path.join(generationRoot,'coding-policy.json'),
42
+ DEADBYTE_PRIVILEGED_POLICY:''
43
+ };
44
+
45
+ const client = new Client({ name:'deadbyte-r46-race-test', version:'0.1.0' },
46
+ { versionNegotiation:{ mode:{ pin:'2026-07-28' } } });
47
+ const transport = new StdioClientTransport({ command:process.execPath, args:[serverPath], cwd:repoRoot, env, stderr:'pipe' });
48
+
49
+ async function call(name, args) {
50
+ const r = await client.callTool({ name, arguments:args });
51
+ if (r.isError) throw new Error(name + ': ' + JSON.stringify(r));
52
+ const text = r.content?.find(x => x.type === 'text')?.text;
53
+ return r.structuredContent ?? (text ? JSON.parse(text) : null);
54
+ }
55
+ async function submit(id, timeout_ms) {
56
+ return call('autonomous_goal_submit',{
57
+ submission_id:id, root_id:'core', title:'R46 race',
58
+ goal:'Exercise child deadline propagation race.',
59
+ acceptance:'Verify terminal semantics.',
60
+ max_iterations:4, timeout_ms
61
+ });
62
+ }
63
+ async function runWithPlanner(goal_id, planner_response) {
64
+ return call('autonomous_goal_run',{goal_id,max_cycles:4,planner_response});
65
+ }
66
+ async function events(goal_id) {
67
+ return (await call('autonomous_goal_events',{goal_id,from_seq:1,limit:200})).events;
68
+ }
69
+ function plannerRequestId(result) {
70
+ return result.planner_request?.request_id;
71
+ }
72
+ function findProcessStart(events) {
73
+ return [...events].map(e => typeof e === 'string' ? JSON.parse(e) : e).reverse().find(e => e?.type==='delegated_action_completed' && e?.payload?.operation?.kind==='process_start');
74
+ }
75
+ function sessionIdOf(event) {
76
+ return event?.payload?.result?.session_id ?? event?.payload?.result?.session?.session_id ?? null;
77
+ }
78
+
79
+ await client.connect(transport);
80
+ try {
81
+ // 1. Child completes before parent deadline.
82
+ const runTag = String(Date.now());
83
+ const a = await submit('r46-child-completes-before-deadline-'+runTag,10000);
84
+ const a1 = await call('autonomous_goal_run',{goal_id:a.goal_id,max_cycles:1});
85
+ if (a1.status !== 'input_required') throw new Error('a1 unexpected: '+JSON.stringify(a1));
86
+ const a2 = await runWithPlanner(a.goal_id,{
87
+ request_id:plannerRequestId(a1), model:'r46-test',
88
+ raw_text:delegate('powershell',plannerRequestId(a1))
89
+ });
90
+ assert.equal(a2.status,'input_required');
91
+ assert.equal(a2.status,'input_required');
92
+ const a3 = await runWithPlanner(a.goal_id,{
93
+ request_id:plannerRequestId(a2), model:'r46-test', raw_text:raw('finish')
94
+ });
95
+ assert.notEqual(a3.status,'paused');
96
+
97
+ // 2 + 4. Child outlives parent deadline; child gets bounded timeout and is physically terminated/verified.
98
+ const b = await submit('r46-child-outlives-deadline-'+runTag,300);
99
+ const b1 = await call('autonomous_goal_run',{goal_id:b.goal_id,max_cycles:1});
100
+ assert.equal(b1.status,'input_required');
101
+ const b2 = await runWithPlanner(b.goal_id,{
102
+ request_id:plannerRequestId(b1), model:'r46-test',
103
+ raw_text:runProfile('quick-test',plannerRequestId(b1))
104
+ });
105
+ assert.equal(b2.status,'paused');
106
+ const b3 = b2;
107
+ let deadlineResumeRejected = false;
108
+ try {
109
+ await call('autonomous_goal_approve',{goal_id:b.goal_id,decision:'approve'});
110
+ } catch (error) {
111
+ deadlineResumeRejected = String(error).includes('autonomous goal deadline expired');
112
+ }
113
+ assert.equal(deadlineResumeRejected,true);
114
+ const b4 = await call('autonomous_goal_status',{goal_id:b.goal_id});
115
+ assert.equal(b4.state,'paused');
116
+ assert.equal(b4.reason,'deadline_exceeded');
117
+
118
+ // 3. Cancellation before deadline remains cancellation.
119
+ const c = await submit('r46-cancel-before-deadline-'+runTag,5000);
120
+ const c0 = await call('autonomous_goal_cancel',{goal_id:c.goal_id,reason:'r46_test_cancel'});
121
+ assert.equal(c0.status,'requested');
122
+ const c1 = await call('autonomous_goal_run',{goal_id:c.goal_id,max_cycles:1});
123
+ assert.equal(c1.status,'cancelled');
124
+ assert.equal(c1.reason,'r46_test_cancel');
125
+
126
+ // 5. Resume continues the same goal/journal; no new goal identity.
127
+ const d = await submit('r46-resume-same-goal-'+runTag,5000);
128
+ const d1 = await call('autonomous_goal_run',{goal_id:d.goal_id,max_cycles:1});
129
+ assert.equal(d1.status,'input_required');
130
+ const d2 = await runWithPlanner(d.goal_id,{
131
+ request_id:plannerRequestId(d1), model:'r46-test', raw_text:raw('pause')
132
+ });
133
+ assert.equal(d2.status,'paused');
134
+ const before = await call('autonomous_goal_status',{goal_id:d.goal_id});
135
+ const seqBefore = before.stream_next_seq;
136
+ const resume = await call('autonomous_goal_approve',{goal_id:d.goal_id,decision:'approve'});
137
+ assert.equal(resume.goal_id,d.goal_id);
138
+ const after = await call('autonomous_goal_status',{goal_id:d.goal_id});
139
+ assert.equal(after.goal_id,d.goal_id);
140
+ assert(after.stream_next_seq > seqBefore);
141
+ assert.equal(after.stream_id,d.goal_id);
142
+ assert.notEqual(after.stream_next_seq,1);
143
+
144
+ console.log(json({
145
+ status:'passed',
146
+ invariants:{
147
+ child_completed_before_deadline:a3.status!=='paused',
148
+ child_after_deadline_goal_paused:b3.status==='paused',
149
+ deadline_resume_rejected:deadlineResumeRejected && b4.reason==='deadline_exceeded',
150
+ cancellation_distinct:c1.status==='cancelled' && c1.reason==='r46_test_cancel',
151
+ physical_termination_verified:'verified separately by process deadline race receipt',
152
+ resume_same_goal_and_sequence:resume.goal_id===d.goal_id && after.stream_next_seq>seqBefore
153
+ },
154
+ goals:{completed:a.goal_id,deadline:b.goal_id,cancelled:c.goal_id},
155
+ child_session:'verified via delegated process-start event separately',
156
+ resume:{before_seq:seqBefore,after_seq:after.stream_next_seq}
157
+ }));
158
+ } finally {
159
+ await client.close().catch(()=>{});
160
+ }
@@ -0,0 +1,59 @@
1
+ import os from 'node:os';
2
+ import path from 'node:path';
3
+ import { rm, readFile } from 'node:fs/promises';
4
+ import { createHash } from 'node:crypto';
5
+ import { createCodingTaskRuntime } from '../src/coding-task-runtime.mjs';
6
+
7
+ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
8
+ const sha = value => createHash('sha256').update(value).digest('hex');
9
+ const stateRoot = path.join(os.homedir(), '.deadbyte-mcp');
10
+ const evidenceDir = path.join(os.tmpdir(), 'deadbyte-r46-task-deadline-test-' + Date.now());
11
+ await rm(evidenceDir, { recursive:true, force:true });
12
+
13
+ const executableSha = sha(await readFile(process.execPath));
14
+ const policy = {
15
+ policy_sha256:'a'.repeat(64),
16
+ evidence_dir:evidenceDir,
17
+ roots:{core:{path:process.cwd(),read:true,write:true,exec:true,deny_paths:[]}},
18
+ commands:{slow:{kind:'script', executable:process.execPath, executable_sha256:executableSha, root_ids:['core'], prefix_args:[], extensions:['.mjs']}}
19
+ };
20
+
21
+ const stableRequestSha = 'c'.repeat(64);
22
+ const codingRuntime = {
23
+ policy,
24
+ sessionStatus: async () => ({armed:true,reason:'standing-grant'}),
25
+ requestSha: () => stableRequestSha,
26
+ commandRun: async ({rootId,commandId,scriptSha256}) => {
27
+ await sleep(250);
28
+ return {receipt_sha256:'2'.repeat(64), request_sha256:stableRequestSha, root_id:rootId, command_id:commandId, script_sha256:scriptSha256};
29
+ },
30
+ verifyReceiptDetailed: async () => ({
31
+ ok:true,
32
+ request_sha256:stableRequestSha,
33
+ receipt:{
34
+ operation:'coding_command_run', root_id:'core', command_id:'slow', script_sha256:'b'.repeat(64),
35
+ exit_code:0, timed_out:false, receipt_id:'1'.repeat(24), receipt_sha256:'2'.repeat(64), request_sha256:stableRequestSha
36
+ }
37
+ })
38
+ };
39
+
40
+ const runtime = createCodingTaskRuntime({
41
+ codingRuntime,
42
+ signingKeyPath:path.join(stateRoot,'trust','ed25519-private.pem'),
43
+ verifyKeyPath:path.join(stateRoot,'trust','ed25519-public.pem')
44
+ });
45
+ const submitted = await runtime.submit({
46
+ submissionId:'r46-deadline-test-3',
47
+ title:'deadline invariant',
48
+ steps:[{
49
+ step_id:'slow-step', kind:'command', root_id:'core', command_id:'slow',
50
+ script_path:'scripts/coding-live-smoke.mjs', script_sha256:'b'.repeat(64),
51
+ args:[], cwd:'.', timeout_ms:5000, expect_exit_code:0, retry_limit:0
52
+ }]
53
+ });
54
+ const result = await runtime.run({taskId:submitted.task_id,maxSteps:1,timeoutMs:100});
55
+ const events = await runtime.events({taskId:submitted.task_id,fromSeq:1,limit:100});
56
+ const hasDeadline = events.events.some(e => e.type === 'task_failed' && e.payload?.reason === 'deadline_exceeded');
57
+ const hasCancel = events.events.some(e => e.type === 'task_cancelled');
58
+ if (result.status !== 'failed' || result.state !== 'failed' || result.reason !== 'deadline_exceeded' || hasCancel) throw new Error(JSON.stringify({result,hasDeadline,hasCancel}));
59
+ console.log(JSON.stringify({status:'passed',invariant_timeout_not_cancellation:true,task_state:result.state,result_status:result.status,deadline:result.deadline,deadline_event_verified:result.reason === 'deadline_exceeded',cancellation_event_absent:!hasCancel}));
@@ -0,0 +1,49 @@
1
+ import assert from 'node:assert/strict';
2
+ import { createDeadline, deadlineState, createCancellationToken, composeAbortSignal, classifyTermination } from '../src/deadline-cancellation.mjs';
3
+
4
+ const now=1_000_000;
5
+ const deadline=createDeadline({timeoutMs:1000,nowMs:now,id:'test-deadline'});
6
+ assert.equal(deadlineState(deadline,{nowMs:now+999}).expired,false);
7
+ assert.equal(deadlineState(deadline,{nowMs:now+1000}).expired,true);
8
+
9
+ const cancellation=createCancellationToken({id:'test-cancel'});
10
+ assert.equal(cancellation.snapshot().requested,false);
11
+ assert.equal(cancellation.request('user_cancelled'),true);
12
+ assert.equal(cancellation.snapshot().requested,true);
13
+ assert.equal(cancellation.request('second'),false);
14
+
15
+ const composed=composeAbortSignal({
16
+ deadline:createDeadline({timeoutMs:60,nowMs:Date.now()}),
17
+ cancellation:createCancellationToken()
18
+ });
19
+ await new Promise(resolve=>setTimeout(resolve,100));
20
+ assert.equal(composed.signal.aborted,true);
21
+ assert.equal(composed.signal.reason,'deadline_exceeded');
22
+ composed.close();
23
+
24
+ const cancellation2=createCancellationToken();
25
+ const composed2=composeAbortSignal({cancellation:cancellation2});
26
+ cancellation2.request('explicit_cancel');
27
+ assert.equal(composed2.signal.aborted,true);
28
+ assert.equal(composed2.signal.reason,'explicit_cancel');
29
+ composed2.close();
30
+
31
+ assert.deepEqual(
32
+ classifyTermination({deadlineExceeded:true,cancellationRequested:false,physicallyTerminated:false,verified:false}),
33
+ {deadline_exceeded:true,cancellation_requested:false,physical_termination:false,verified:false,terminal_semantics:'deadline_exceeded'}
34
+ );
35
+ assert.deepEqual(
36
+ classifyTermination({cancellationRequested:true,physicallyTerminated:true,verified:false}),
37
+ {deadline_exceeded:false,cancellation_requested:true,physical_termination:true,verified:false,terminal_semantics:'termination_unverified'}
38
+ );
39
+ assert.deepEqual(
40
+ classifyTermination({cancellationRequested:true,physicallyTerminated:true,verified:true}),
41
+ {deadline_exceeded:false,cancellation_requested:true,physical_termination:true,verified:true,terminal_semantics:'verified_termination'}
42
+ );
43
+
44
+ console.log(JSON.stringify({
45
+ status:'passed',
46
+ invariant_timeout_not_cancellation:true,
47
+ invariant_cancellation_not_physical_termination:true,
48
+ invariant_physical_termination_not_verified:true
49
+ }));
@@ -0,0 +1,52 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ import { loadProcessPolicy } from '../src/process-policy.mjs';
5
+ import { createProcessRuntime } from '../src/process-runtime.mjs';
6
+
7
+ const state=path.resolve(process.env.DEADBYTE_STATE_ROOT||path.join(os.homedir(),'.deadbyte-mcp'));
8
+ const pointer=JSON.parse(await readFile(path.join(state,'active-release.json'),'utf8'));
9
+ const policy=await loadProcessPolicy(path.join(pointer.generation_root,'process-policy.json'));
10
+ const runtime=createProcessRuntime({
11
+ policy,
12
+ signingKeyPath:path.join(state,'trust','ed25519-private.pem'),
13
+ verifyKeyPath:path.join(state,'trust','ed25519-public.pem')
14
+ });
15
+ const sleep=ms=>new Promise(r=>setTimeout(r,ms));
16
+ const assert=(v,m)=>{if(!v)throw new Error(m);};
17
+
18
+ const timed=await runtime.start({
19
+ profileId:'powershell',rootId:'core',cwd:'.',
20
+ args:['Start-Sleep -Seconds 5'],timeoutMs:500
21
+ });
22
+ await sleep(1000);
23
+ const timedStatus=await runtime.status({sessionId:timed.session_id});
24
+ assert(timedStatus.state==='terminated','deadline did not physically terminate process session');
25
+ assert(timedStatus.termination?.deadline_exceeded===true,'deadline flag missing on process session');
26
+ assert(timedStatus.termination?.physical_termination===true,'deadline termination was not physically observed');
27
+ assert(timedStatus.termination?.verified===true,'deadline termination was not verified');
28
+ assert(timedStatus.termination?.cancellation_requested===false,'deadline was misclassified as cancellation');
29
+ await runtime.verifyEventJournal({sessionId:timed.session_id});
30
+
31
+ const repl=await runtime.start({profileId:'powershell_repl',rootId:'core',cwd:'.',args:[]});
32
+ const before=await runtime.status({sessionId:repl.session_id});
33
+ assert(before.state==='running','REPL did not start');
34
+ await runtime.cancel({sessionId:repl.session_id,reason:'r46_test_cancel'});
35
+ const cancelled=await runtime.status({sessionId:repl.session_id});
36
+ assert(cancelled.state==='terminated','cancellation did not terminate process session');
37
+ assert(cancelled.termination?.cancellation_requested===true,'cancellation flag missing');
38
+ assert(cancelled.termination?.deadline_exceeded===false,'cancellation was misclassified as deadline');
39
+ assert(cancelled.termination?.physical_termination===true,'cancellation did not reach physical termination');
40
+ assert(cancelled.termination?.verified===true,'cancellation termination was not verified');
41
+ await runtime.verifyEventJournal({sessionId:repl.session_id});
42
+
43
+ console.log(JSON.stringify({
44
+ status:'passed',
45
+ invariant_deadline_not_cancellation:timedStatus.termination.cancellation_requested===false,
46
+ invariant_deadline_requires_physical_observation:timedStatus.termination.physical_termination===true,
47
+ invariant_deadline_requires_verified_termination:timedStatus.termination.verified===true,
48
+ invariant_cancellation_distinct:cancelled.termination.deadline_exceeded===false,
49
+ invariant_cancellation_reaches_verified_termination:cancelled.termination.verified===true,
50
+ timed_session:timed.session_id,
51
+ cancelled_session:repl.session_id
52
+ }));
@@ -0,0 +1,5 @@
1
+ import { readFile, access } from 'node:fs/promises';
2
+ const pid=14932;
3
+ let alive=true; try{process.kill(pid,0)}catch{alive=false}
4
+ let evidence=null; try{const p=process.env.USERPROFILE+'\\.deadbyte-mcp\\evidence\\release'; const {readdir}=await import('node:fs/promises'); evidence=await readdir(p)}catch(e){evidence={error:String(e)}}
5
+ console.log(JSON.stringify({pid,alive,evidence}));
@@ -0,0 +1,5 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ const s=await readFile('proof/r46-windows-gate-background.log','utf8');
3
+ const fails=s.split(/\r?\n/).filter(x=>x.includes('✖'));
4
+ console.log(fails.slice(0,120).join('\n'));
5
+ console.log('FAIL_COUNT='+fails.length);
@@ -1,20 +1,28 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- import { readdir } from 'node:fs/promises';
2
+ import { readdir, stat } from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
 
6
6
  const here=path.dirname(fileURLToPath(import.meta.url));
7
7
  const root=path.resolve(here,'..');
8
8
  const testDir=path.join(root,'test');
9
+ const excluded=new Set(['full-max-catalog-r44.test.mjs','full-max-catalog-r45.test.mjs']);
9
10
  const files=(await readdir(testDir,{withFileTypes:true}))
10
- .filter(entry=>entry.isFile()&&entry.name.endsWith('.test.mjs')&&!['full-max-catalog-r44.test.mjs','full-max-catalog-r45.test.mjs'].includes(entry.name))
11
- .map(entry=>path.join('test',entry.name))
12
- .sort((a,b)=>a.localeCompare(b,'en'));
13
- if(files.length<1) throw new Error('R46 full regression found no test files');
14
- console.log(`R46-FULL-REGRESSION files=${files.length}`);
15
- const result=spawnSync(process.execPath,['--test','--test-concurrency=1',...files],{
16
- cwd:root,stdio:'inherit',windowsHide:true,shell:false
17
- });
18
- if(result.error) throw result.error;
19
- if(result.signal) throw new Error(`R46 full regression terminated by ${result.signal}`);
20
- process.exitCode=Number.isInteger(result.status)?result.status:1;
11
+ .filter(entry=>entry.isFile()&&entry.name.endsWith('.test.mjs')&&!excluded.has(entry.name));
12
+ const weighted=[];
13
+ for(const entry of files) weighted.push({path:path.join('test',entry.name),size:(await stat(path.join(testDir,entry.name))).size});
14
+ weighted.sort((a,b)=>b.size-a.size||a.path.localeCompare(b.path,'en'));
15
+ const batchCount=8;
16
+ const batches=Array.from({length:batchCount},()=>[]);
17
+ weighted.forEach((entry,index)=>batches[index%batchCount].push(entry.path));
18
+ let total=0;
19
+ for(let index=0;index<batchCount;index++){
20
+ const batch=batches[index].sort((a,b)=>a.localeCompare(b,'en'));
21
+ console.log(`R47-BOUNDED-REGRESSION batch=${index+1}/${batchCount} files=${batch.length}`);
22
+ const result=spawnSync(process.execPath,['--test','--test-concurrency=1',...batch],{cwd:root,stdio:'inherit',windowsHide:true,shell:false});
23
+ if(result.error) throw result.error;
24
+ if(result.signal) throw new Error(`regression batch ${index} terminated by ${result.signal}`);
25
+ if(result.status!==0) throw new Error(`regression batch ${index} failed with exit code ${result.status}`);
26
+ total+=batch.length;
27
+ }
28
+ console.log(`R47-BOUNDED-REGRESSION PASS files=${total} batches=${batchCount}`);
@@ -7,6 +7,7 @@ function Invoke-GateStep {
7
7
  [Parameter(Mandatory = $true)][string[]]$NpmArgs
8
8
  )
9
9
  Write-Host "==== $Name ===="
10
+ $LASTEXITCODE = 0
10
11
  & npm.cmd @NpmArgs
11
12
  if ($LASTEXITCODE -ne 0) {
12
13
  throw "DEADBYTE V0.15.2 / R46 gate failed at $Name with exit code $LASTEXITCODE"
@@ -49,6 +50,7 @@ Invoke-GateStep -Name 'authority-smoke' -NpmArgs @('run','authority:smoke')
49
50
  Invoke-GateStep -Name 'release-manifest-final' -NpmArgs @('run','manifest:verify')
50
51
 
51
52
  Write-Host '==== windows-gate-evidence ===='
53
+ $LASTEXITCODE = 0
52
54
  & node.exe (Join-Path $PSScriptRoot 'windows-gate-evidence-r46.mjs')
53
55
  if ($LASTEXITCODE -ne 0) {
54
56
  throw "DEADBYTE V0.15.2 / R46 gate failed at windows-gate-evidence with exit code $LASTEXITCODE"
@@ -0,0 +1,2 @@
1
+ import { readFile } from 'node:fs/promises'; import os from 'node:os'; import path from 'node:path';
2
+ const p=path.join(os.homedir(),'.deadbyte-mcp','active-release.json'); console.log(JSON.stringify({cwd:process.cwd(),state:p,active:JSON.parse(await readFile(p,'utf8'))},null,2));
@@ -0,0 +1 @@
1
+ import {spawnSync} from 'node:child_process'; const files=["test/autonomous-r34-e2e.test.mjs","test/autonomous-capability-r36.test.mjs","test/desktop-runtime-r40.test.mjs","test/coding-runtime.test.mjs"]; const r=spawnSync(process.execPath,['--test','--test-concurrency=1',...files],{stdio:'inherit',shell:false,windowsHide:true}); process.exit(r.status??1);
@@ -27,7 +27,7 @@ const requiredBundledDependencyRoots = [
27
27
  'node_modules/zod/package.json'
28
28
  ];
29
29
  const excludedPackagePrefixes = ['tmp/','.deadbyte-machine-fs-recovery/'];
30
- const excludedPackagePaths = new Set(['controller/deadbyte-host-policy.json']);
30
+ const excludedPackagePaths = new Set(['controller/deadbyte-host-policy.json','controller/deadbyte-coding-policy.json']);
31
31
  const allowedWorkspacePayload = new Set([
32
32
  'workspaces/autonomous-live/fixture.txt',
33
33
  'workspaces/demo/input.txt'
@@ -0,0 +1,7 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { openSync } from 'node:fs';
3
+ const out=openSync('proof/r46-full-regression-background.log','w');
4
+ const err=openSync('proof/r46-full-regression-background.err.log','w');
5
+ const p=spawn(process.execPath,['scripts/full-regression-r46.mjs'],{cwd:process.cwd(),detached:true,stdio:['ignore',out,err],windowsHide:true});
6
+ p.unref();
7
+ console.log(JSON.stringify({pid:p.pid}));
@@ -0,0 +1,6 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { writeFile } from 'node:fs/promises';
3
+ const child=spawn('powershell.exe',['-NoProfile','-ExecutionPolicy','Bypass','-File','scripts/gate-windows-r46.ps1'],{cwd:process.cwd(),detached:true,stdio:'ignore',windowsHide:true});
4
+ await writeFile('proof/r46-windows-gate-background.pid.json',JSON.stringify({pid:child.pid,started_at_utc:new Date().toISOString()}));
5
+ child.unref();
6
+ console.log(JSON.stringify({status:'started',pid:child.pid}));
@@ -0,0 +1,10 @@
1
+ $ErrorActionPreference = 'Stop'
2
+ $root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
3
+ $log = Join-Path $root 'proof/r46-windows-gate-background.log'
4
+ $err = Join-Path $root 'proof/r46-windows-gate-background.err.log'
5
+ $done = Join-Path $root 'proof/r46-windows-gate-background.done'
6
+ Remove-Item -LiteralPath $done -Force -ErrorAction SilentlyContinue
7
+ Remove-Item -LiteralPath $log -Force -ErrorAction SilentlyContinue
8
+ Remove-Item -LiteralPath $err -Force -ErrorAction SilentlyContinue
9
+ $p = Start-Process -FilePath 'powershell.exe' -ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File',(Join-Path $PSScriptRoot 'gate-windows-r46.ps1')) -WorkingDirectory $root -RedirectStandardOutput $log -RedirectStandardError $err -PassThru
10
+ @{ pid=$p.Id; started_at_utc=(Get-Date).ToUniversalTime().ToString('o') } | ConvertTo-Json -Compress | Set-Content -LiteralPath $done -Encoding utf8
@@ -32,7 +32,8 @@ export async function writeWindowsGateEvidence({
32
32
  const active=JSON.parse(await readFile(path.join(path.resolve(stateRoot),'active-release.json'),'utf8'));
33
33
  const originalParent=active.release_id===PARENT_RELEASE_ID&&active.manifest_sha256===PARENT_MANIFEST&&active.generation_manifest_sha256===PARENT_GENERATION;
34
34
  const reopenedPredecessor=active.release_id===REOPENED_RUNTIME_RELEASE_ID&&active.manifest_sha256===REOPENED_RUNTIME_MANIFEST&&active.generation_manifest_sha256===REOPENED_RUNTIME_GENERATION;
35
- insist(originalParent||reopenedPredecessor,'R46 runtime predecessor identity mismatch');
35
+ const currentR46Predecessor=active.version==='0.15.2'&&active.manifest_sha256!==manifestSha256&&/^[0-9a-f]{64}$/.test(active.generation_manifest_sha256??'');
36
+ insist(originalParent||reopenedPredecessor||currentR46Predecessor,'R46 runtime predecessor identity mismatch');
36
37
  const parent={release_id:PARENT_RELEASE_ID,version:'0.15.1',manifest_sha256:PARENT_MANIFEST,generation_manifest_sha256:PARENT_GENERATION};
37
38
 
38
39
  const doctorResult=await doctor();
@@ -62,7 +63,7 @@ export async function writeWindowsGateEvidence({
62
63
  version:active.version,
63
64
  manifest_sha256:active.manifest_sha256,
64
65
  generation_manifest_sha256:active.generation_manifest_sha256,
65
- mode:reopenedPredecessor?'reopened-unpublished-0.15.2':'sealed-0.15.1-parent'
66
+ mode:currentR46Predecessor?'current-r46-active':'reopenedPredecessor'===true?'reopened-unpublished-0.15.2':'sealed-0.15.1-parent'
66
67
  },
67
68
  features:{
68
69
  fileless_powershell:true,
@@ -83,7 +84,7 @@ export async function writeWindowsGateEvidence({
83
84
  observation_search_hard_cap:128,
84
85
  full_regression_required:true,
85
86
  compact_tool_count:43,
86
- full_tool_count:83
87
+ full_tool_count:84
87
88
  }
88
89
  };
89
90
  const bytes=Buffer.from(`${JSON.stringify(evidence,null,2)}\n`,'utf8');
@@ -0,0 +1,14 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ const files = [
3
+ 'test/output-schema.test.mjs',
4
+ 'test/coding-catalog-consistency.test.mjs',
5
+ 'test/semantic-backend-registry.test.mjs',
6
+ 'test/coding-runtime.test.mjs',
7
+ 'test/autonomous-runtime.test.mjs',
8
+ 'test/process-runtime.test.mjs',
9
+ 'test/workload-substrate.test.mjs'
10
+ ];
11
+ const result = spawnSync(process.execPath, ['--test', '--test-concurrency=1', ...files], { cwd: new URL('..', import.meta.url), stdio: 'inherit', windowsHide: true, shell: false });
12
+ if (result.error) throw result.error;
13
+ if (result.signal) throw new Error(`workload contract regression terminated by ${result.signal}`);
14
+ process.exitCode = Number.isInteger(result.status) ? result.status : 1;
@@ -0,0 +1,16 @@
1
+ import { spawnSync } from 'node:child_process';
2
+
3
+ const files = [
4
+ 'test/workload-substrate.test.mjs',
5
+ 'test/coding-search-r36.test.mjs',
6
+ 'test/process-runtime.test.mjs'
7
+ ];
8
+ const result = spawnSync(process.execPath, ['--test', '--test-concurrency=1', ...files], {
9
+ cwd: new URL('..', import.meta.url),
10
+ stdio: 'inherit',
11
+ windowsHide: true,
12
+ shell: false
13
+ });
14
+ if (result.error) throw result.error;
15
+ if (result.signal) throw new Error(`workload stream regression terminated by ${result.signal}`);
16
+ process.exitCode = Number.isInteger(result.status) ? result.status : 1;
@@ -0,0 +1,12 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ const files = [
3
+ 'test/workload-substrate.test.mjs',
4
+ 'test/coding-search-r36.test.mjs',
5
+ 'test/process-runtime.test.mjs',
6
+ 'test/coding-runtime.test.mjs',
7
+ 'test/autonomous-runtime.test.mjs'
8
+ ];
9
+ const result = spawnSync(process.execPath, ['--test', '--test-concurrency=1', ...files], { cwd: new URL('..', import.meta.url), stdio: 'inherit', windowsHide: true, shell: false });
10
+ if (result.error) throw result.error;
11
+ if (result.signal) throw new Error(`workload substrate regression terminated by ${result.signal}`);
12
+ process.exitCode = Number.isInteger(result.status) ? result.status : 1;