deadbyte-mcp 0.15.34 → 0.15.36
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 +100 -38
- package/PROVENANCE.json +87 -41
- package/README.txt +72 -14
- package/RELEASE.json +187 -150
- package/SBOM.cdx.json +25 -3
- package/TEST-MATRIX.json +258 -151
- package/bridge/package.json +13 -0
- package/bridge/src/bridge-health-r59.mjs +52 -0
- package/bridge/src/bridge.mjs +487 -0
- package/bridge/src/node-http-adapter.mjs +56 -0
- package/bridge/src/public-tool-definitions.mjs +14 -0
- package/bridge/src/r40-governor.mjs +206 -0
- package/controller/deadbyte-controller.ps1 +152 -18
- package/controller/deadbyte-process-policy.json +4 -4
- package/docs/R59-TASK-CONTRACT.md +26 -0
- package/package.json +7 -3
- package/proof/r59-full-regression-current.json +13 -0
- package/proof/r59-full-regression-current.stderr.log +0 -0
- package/proof/r59-full-regression-current.stdout.log +1268 -0
- package/scripts/bridge-benchmark-r58.mjs +67 -0
- package/scripts/deploy-r48.mjs +2 -3
- package/scripts/gate-windows-r58.ps1 +33 -0
- package/scripts/gate-windows-r59-prepublish.ps1 +41 -0
- package/scripts/owner-probe-r58.mjs +31 -0
- package/scripts/performance-r58.mjs +57 -0
- package/scripts/public-baseline-r58.mjs +72 -0
- package/scripts/public-surface-r58.mjs +84 -0
- package/scripts/r58-cross-plane.ps1 +6 -0
- package/scripts/r58-focused.ps1 +6 -0
- package/scripts/r59-full-regression-capture.mjs +35 -0
- package/scripts/windows-gate-evidence-r58.mjs +93 -0
- package/src/capability-resolver.mjs +25 -7
- package/src/capability-snapshot.mjs +52 -0
- package/src/compact-gateway-mcp-tools.mjs +10 -11
- package/src/deadbyte-cli.mjs +40 -12
- package/src/doctor-foreground-r58.mjs +44 -0
- package/src/doctor-installation-r58.mjs +63 -0
- package/src/doctor-r45.mjs +21 -4
- package/src/doctor-runtime-r58.mjs +82 -0
- package/src/doctor-transactions-r58.mjs +40 -0
- package/src/foreground-process-identity.mjs +27 -0
- package/src/foreground-session-lock.mjs +20 -0
- package/src/foreground-session-lock.ps1 +15 -0
- package/src/mcp-server.mjs +179 -118
- package/src/r40-compact-disarmed-probe.mjs +1 -1
- package/src/r44-compact-disarmed-probe.mjs +1 -1
- package/src/r45-compact-disarmed-probe.mjs +1 -1
- package/src/release-generation.mjs +1 -0
- package/src/release-slot.mjs +2 -1
- package/src/remote-mcp-r40-parity-client.mjs +1 -1
- package/src/remote-mcp-r44-parity-client.mjs +1 -1
- package/src/remote-mcp-r45-parity-client.mjs +1 -1
- package/src/remote-mcp-smoke-client.mjs +1 -1
- package/src/remote-session-guardian.mjs +8 -1
- package/src/runtime-plane-registry.mjs +74 -0
- package/src/runtime-update.mjs +85 -2
- package/src/version.mjs +1 -1
- package/test/bridge-runtime-r59.test.mjs +60 -0
- package/test/capability-resolver.test.mjs +16 -0
- package/test/capability-snapshot-r59.test.mjs +39 -0
- package/test/compact-gateway-r36.test.mjs +22 -2
- package/test/compact-max-catalog-r44.test.mjs +1 -1
- package/test/compact-max-catalog-r45.test.mjs +1 -1
- package/test/contained.test.mjs +2 -1
- package/test/controller-policy-preflight-r59.test.mjs +39 -0
- package/test/controller-r211.test.mjs +4 -1
- package/test/controller.test.mjs +2 -1
- package/test/fixtures/r59-compact-surface-v0.15.35.json +222 -0
- package/test/helpers/r58-doctor-fixture.mjs +26 -0
- package/test/observation-integration.test.mjs +2 -3
- package/test/optional-plane-degraded-r59.test.mjs +44 -0
- package/test/r49-windows-gate.test.mjs +2 -2
- package/test/r57-release-contract.test.mjs +5 -3
- package/test/r58-bridge-dependency-binding.test.mjs +62 -0
- package/test/r58-bundled-bridge.test.mjs +24 -0
- package/test/r58-cleanup-retention.test.mjs +45 -0
- package/test/r58-completed-update-receipt.test.mjs +76 -0
- package/test/r58-concurrent-recovery.test.mjs +54 -0
- package/test/r58-controller-core-observation.test.mjs +36 -0
- package/test/r58-controller-json.test.mjs +48 -0
- package/test/r58-controller-live-local.test.mjs +98 -0
- package/test/r58-controller-readonly.test.mjs +23 -0
- package/test/r58-controller-state-coherence.test.mjs +45 -0
- package/test/r58-doctor-cli.test.mjs +20 -0
- package/test/r58-doctor-foreground.test.mjs +50 -0
- package/test/r58-doctor-installation.test.mjs +55 -0
- package/test/r58-doctor-pointer.test.mjs +41 -0
- package/test/r58-doctor-runtime.test.mjs +45 -0
- package/test/r58-doctor-transactions.test.mjs +21 -0
- package/test/r58-guardian-channel.test.mjs +26 -0
- package/test/r58-launcher-shell.test.mjs +28 -0
- package/test/r58-owner-identity.test.mjs +20 -0
- package/test/r58-release-contract.test.mjs +50 -0
- package/test/r58-session-lock.test.mjs +26 -0
- package/test/r58-stale-owner.test.mjs +71 -0
- package/test/r58-windows-gate.test.mjs +32 -0
- package/test/r59-release-contract.test.mjs +61 -0
- package/test/r59-tool-surface-compat.test.mjs +90 -0
- package/test/release-generation.test.mjs +4 -1
- package/test/remote-session-cli.test.mjs +55 -2
- package/test/runtime-plane-registry-r59.test.mjs +40 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {spawnSync} from 'node:child_process';
|
|
2
|
+
import {createHash} from 'node:crypto';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {windowsPowerShellEnvironment} from './runtime-update.mjs';
|
|
5
|
+
|
|
6
|
+
export function validForegroundIdentity(value){
|
|
7
|
+
return value?.schema==='deadbyte.foreground-process.v1'&&Number.isSafeInteger(value.pid)&&value.pid>0&&Number.isSafeInteger(value.parent_pid)&&value.parent_pid>=0&&typeof value.creation_utc==='string'&&/^\d{4}-\d\d-\d\dT.*Z$/.test(value.creation_utc)&&Number.isFinite(Date.parse(value.creation_utc))&&typeof value.executable_path==='string'&&path.isAbsolute(value.executable_path)&&/^[0-9a-f]{64}$/.test(value.command_line_sha256??'');
|
|
8
|
+
}
|
|
9
|
+
export function foregroundIdentityMatches(expected,observed){
|
|
10
|
+
if(!validForegroundIdentity(expected))throw new Error('foreground ownership identity unverified');
|
|
11
|
+
if(observed===null)return false;
|
|
12
|
+
if(!validForegroundIdentity(observed))throw new Error('observed foreground identity incomplete');
|
|
13
|
+
return expected.pid===observed.pid&&expected.parent_pid===observed.parent_pid&&expected.creation_utc===observed.creation_utc&&path.resolve(expected.executable_path).toLowerCase()===path.resolve(observed.executable_path).toLowerCase()&&expected.command_line_sha256===observed.command_line_sha256;
|
|
14
|
+
}
|
|
15
|
+
export function queryForegroundIdentity(pid){
|
|
16
|
+
if(process.platform!=='win32'||!Number.isSafeInteger(pid)||pid<1)throw new Error('foreground identity requires a positive Windows PID');
|
|
17
|
+
const root=process.env.SystemRoot||process.env.WINDIR;if(!root)throw new Error('Windows system root missing');
|
|
18
|
+
const command=`$p=Get-CimInstance Win32_Process -Filter 'ProcessId=${pid}'; if ($null -eq $p) {Write-Output 'null';exit 0}; [pscustomobject]@{pid=$p.ProcessId;parent_pid=$p.ParentProcessId;creation_utc=$p.CreationDate.ToUniversalTime().ToString('o');executable_path=$p.ExecutablePath;command_line=$p.CommandLine} | ConvertTo-Json -Compress`;
|
|
19
|
+
const result=spawnSync(path.join(root,'System32/WindowsPowerShell/v1.0/powershell.exe'),['-NoLogo','-NoProfile','-Command',command],{encoding:'utf8',windowsHide:true,env:windowsPowerShellEnvironment(process.env),timeout:15000,maxBuffer:1024*1024});
|
|
20
|
+
if(result.error||result.status!==0)throw new Error('foreground process identity query failed');
|
|
21
|
+
let raw;try{raw=JSON.parse(result.stdout);}catch{throw new Error('foreground process identity query malformed');}
|
|
22
|
+
if(raw===null)return null;
|
|
23
|
+
if(typeof raw.command_line!=='string'||!raw.command_line)throw new Error('foreground process command identity unavailable');
|
|
24
|
+
const identity={schema:'deadbyte.foreground-process.v1',pid:raw.pid,parent_pid:raw.parent_pid,creation_utc:raw.creation_utc,executable_path:raw.executable_path,command_line_sha256:createHash('sha256').update(raw.command_line).digest('hex')};
|
|
25
|
+
if(!validForegroundIdentity(identity)||identity.pid!==pid)throw new Error('foreground process identity incomplete');
|
|
26
|
+
return identity;
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {spawn} from 'node:child_process';
|
|
2
|
+
import {createHash} from 'node:crypto';
|
|
3
|
+
import {fileURLToPath} from 'node:url';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import {windowsPowerShellEnvironment} from './runtime-update.mjs';
|
|
6
|
+
|
|
7
|
+
export async function acquireForegroundSessionLock({root,powershell}){
|
|
8
|
+
const hash=createHash('sha256').update(path.resolve(root).toLowerCase()).digest('hex');
|
|
9
|
+
const child=spawn(powershell,['-NoLogo','-NoProfile','-ExecutionPolicy','Bypass','-File',fileURLToPath(new URL('./foreground-session-lock.ps1',import.meta.url)),'-LockName',`Local\\DEADBYTE-foreground-${hash}`],{windowsHide:true,stdio:['pipe','pipe','pipe'],env:windowsPowerShellEnvironment(process.env)});
|
|
10
|
+
let text='',errorText='';child.stderr.on('data',b=>{errorText=(errorText+b).slice(-2048);});
|
|
11
|
+
let settled=false;
|
|
12
|
+
const exited=new Promise(resolve=>{child.once('exit',(code,signal)=>resolve({code,signal}));child.once('error',error=>resolve({error}));});
|
|
13
|
+
const ready=new Promise((resolve,reject)=>{
|
|
14
|
+
const timer=setTimeout(()=>{if(!settled){settled=true;child.kill();reject(new Error('foreground session lock acquisition timed out'));}},15000);
|
|
15
|
+
child.stdout.on('data',b=>{text+=b.toString();if(!settled&&text.includes('DEADBYTE_FOREGROUND_LOCK_READY')){settled=true;clearTimeout(timer);resolve();}});
|
|
16
|
+
exited.then(result=>{if(!settled){settled=true;clearTimeout(timer);reject(new Error(result.code===73?'remote session already claimed (startup/recovery lock)':`foreground session lock failed: ${errorText||result.error?.message||result.code}`));}});
|
|
17
|
+
});
|
|
18
|
+
try{await ready;}catch(error){child.stdin.end();await exited;throw error;}
|
|
19
|
+
return {assertHeld(){if(child.exitCode!==null||child.signalCode!==null)throw new Error('foreground session lock ownership lost');},async release(){child.stdin.end();const result=await exited;if(result.code!==0)throw new Error('foreground session lock release failed');}};
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
param([Parameter(Mandatory=$true)][ValidatePattern('^Local\\DEADBYTE-foreground-[0-9a-f]{64}$')][string]$LockName)
|
|
2
|
+
$ErrorActionPreference='Stop'
|
|
3
|
+
$mutex=New-Object System.Threading.Mutex($false,$LockName)
|
|
4
|
+
$owned=$false
|
|
5
|
+
try {
|
|
6
|
+
try { $owned=$mutex.WaitOne(0) } catch [System.Threading.AbandonedMutexException] { $owned=$true }
|
|
7
|
+
if(-not $owned){exit 73}
|
|
8
|
+
[Console]::Out.WriteLine('DEADBYTE_FOREGROUND_LOCK_READY')
|
|
9
|
+
[Console]::Out.Flush()
|
|
10
|
+
# Owner death closes the inherited stdin pipe. No persisted PID lockfile.
|
|
11
|
+
[void][Console]::In.ReadLine()
|
|
12
|
+
} finally {
|
|
13
|
+
if($owned){$mutex.ReleaseMutex()}
|
|
14
|
+
$mutex.Dispose()
|
|
15
|
+
}
|
package/src/mcp-server.mjs
CHANGED
|
@@ -66,6 +66,7 @@ import { capabilityProfileFromEnv, COMPACT_SURFACE_TOOL_LIMIT, R36_CAPABILITY_LE
|
|
|
66
66
|
import { registerCompactGatewayTools } from './compact-gateway-mcp-tools.mjs';
|
|
67
67
|
import { createSkillPlane } from './skill-plane-r44.mjs';
|
|
68
68
|
import { registerSkillToolsR44 } from './skill-mcp-tools-r44.mjs';
|
|
69
|
+
import { createRuntimePlaneRegistry, createUnavailableRuntime, RuntimePlaneUnavailableError } from './runtime-plane-registry.mjs';
|
|
69
70
|
import {
|
|
70
71
|
containedTransformOutputSchema,
|
|
71
72
|
evidenceVerifyOutputSchema,
|
|
@@ -86,6 +87,7 @@ const verifyKeyPath = process.env.DEADBYTE_VERIFY_KEY ?? defaultPublicKeyPath();
|
|
|
86
87
|
const auditRuntimeMode = process.env.DEADBYTE_AUDIT_RUNTIME ?? '0';
|
|
87
88
|
if (!['0','1'].includes(auditRuntimeMode)) throw new Error('DEADBYTE_AUDIT_RUNTIME must be 0 or 1');
|
|
88
89
|
const runtimeStateRoot = path.resolve(process.env.DEADBYTE_STATE_ROOT || path.join(os.homedir(),'.deadbyte-mcp'));
|
|
90
|
+
const planeRegistry=createRuntimePlaneRegistry();
|
|
89
91
|
const interruptedUpdateRecovery = await recoverInterruptedSlotUpdates({ stateRoot: runtimeStateRoot });
|
|
90
92
|
if (interruptedUpdateRecovery.launched > 0) {
|
|
91
93
|
console.error(`[runtime-update-recovery] launched ${interruptedUpdateRecovery.launched} detached supervisor(s)`);
|
|
@@ -103,15 +105,16 @@ if (!privilegedPolicyExplicit) {
|
|
|
103
105
|
if (error?.code !== 'ENOENT') throw error;
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
|
-
|
|
108
|
+
planeRegistry.define('host',{configured:Boolean(privilegedPolicyPath),required:false});
|
|
109
|
+
const hostPolicy=await planeRegistry.initialize('host',async()=>loadHostPolicy(privilegedPolicyPath));
|
|
107
110
|
const machineRuntimeMode = process.env.DEADBYTE_MACHINE_RUNTIME ?? '0';
|
|
108
111
|
if (!['0', '1'].includes(machineRuntimeMode)) throw new Error('DEADBYTE_MACHINE_RUNTIME must be 0 or 1');
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
: null;
|
|
112
|
+
planeRegistry.define('machine',{configured:machineRuntimeMode==='1',required:true});
|
|
113
|
+
const machineRuntime=await planeRegistry.initialize('machine',async()=>createMachineRuntime({stateRoot:runtimeStateRoot}));
|
|
112
114
|
const agentRuntimeMode = process.env.DEADBYTE_AGENT_RUNTIME ?? '0';
|
|
113
115
|
if (!['0', '1'].includes(agentRuntimeMode)) throw new Error('DEADBYTE_AGENT_RUNTIME must be 0 or 1');
|
|
114
|
-
|
|
116
|
+
planeRegistry.define('agent',{configured:agentRuntimeMode==='1',required:false});
|
|
117
|
+
const agentRuntime=await planeRegistry.initialize('agent',async()=>createAgentRuntime({signingKeyPath,verifyKeyPath}));
|
|
115
118
|
|
|
116
119
|
const processRuntimeMode = process.env.DEADBYTE_PROCESS_RUNTIME ?? '0';
|
|
117
120
|
if (!['0', '1'].includes(processRuntimeMode)) throw new Error('DEADBYTE_PROCESS_RUNTIME must be 0 or 1');
|
|
@@ -121,9 +124,14 @@ if (processRuntimeMode === '1' && !processPolicyPath) {
|
|
|
121
124
|
try { await access(localProcessPolicyPath); processPolicyPath = localProcessPolicyPath; }
|
|
122
125
|
catch (error) { if (error?.code !== 'ENOENT') throw error; }
|
|
123
126
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const processRuntime
|
|
127
|
+
planeRegistry.define('process',{configured:processRuntimeMode==='1',required:false});
|
|
128
|
+
let processPolicy=null;
|
|
129
|
+
const processRuntime=await planeRegistry.initialize('process',async()=>{
|
|
130
|
+
if(!processPolicyPath) throw new Error('DEADBYTE_PROCESS_RUNTIME=1 requires a process policy');
|
|
131
|
+
processPolicy=await loadProcessPolicy(processPolicyPath);
|
|
132
|
+
return createProcessRuntime({policy:processPolicy,signingKeyPath,verifyKeyPath});
|
|
133
|
+
});
|
|
134
|
+
if(!processRuntime) processPolicy=null;
|
|
127
135
|
|
|
128
136
|
const codingRuntimeMode = process.env.DEADBYTE_CODING_RUNTIME ?? '0';
|
|
129
137
|
if (!['0', '1'].includes(codingRuntimeMode)) throw new Error('DEADBYTE_CODING_RUNTIME must be 0 or 1');
|
|
@@ -133,29 +141,32 @@ if (codingRuntimeMode === '1' && !codingPolicyPath) {
|
|
|
133
141
|
try { await access(localCodingPolicyPath); codingPolicyPath = localCodingPolicyPath; }
|
|
134
142
|
catch (error) { if (error?.code !== 'ENOENT') throw error; }
|
|
135
143
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const codingRuntime
|
|
139
|
-
|
|
144
|
+
planeRegistry.define('coding',{configured:codingRuntimeMode==='1',required:false});
|
|
145
|
+
let codingPolicy=null;
|
|
146
|
+
const codingRuntime=await planeRegistry.initialize('coding',async()=>{
|
|
147
|
+
if(!codingPolicyPath) throw new Error('DEADBYTE_CODING_RUNTIME=1 requires a coding policy');
|
|
148
|
+
codingPolicy=await loadCodingPolicy(codingPolicyPath);
|
|
149
|
+
return createCodingRuntime({policy:codingPolicy,signingKeyPath,verifyKeyPath});
|
|
150
|
+
});
|
|
151
|
+
if(!codingRuntime) codingPolicy=null;
|
|
152
|
+
const codingTaskRuntime=codingRuntime?createCodingTaskRuntime({codingRuntime,signingKeyPath,verifyKeyPath}):null;
|
|
140
153
|
const semanticLspBinding = semanticConfigBindingFromEnv(process.env);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
154
|
+
planeRegistry.define('semantic',{configured:codingRuntimeMode==='1',required:false,dependencies:['coding']});
|
|
155
|
+
let semanticLsp={backends:[],required_ids:[]};
|
|
156
|
+
let semanticRuntime=await planeRegistry.initialize('semantic',async()=>{
|
|
157
|
+
semanticLsp=semanticLspBinding?await loadSemanticLspBackends({...semanticLspBinding,codingRuntime}):semanticLsp;
|
|
158
|
+
return createSemanticCodeRuntime({codingRuntime,backends:semanticLsp.backends,nativeDiffRuntime:null});
|
|
159
|
+
});
|
|
145
160
|
const machineFsRuntimeMode = process.env.DEADBYTE_MACHINE_FS_RUNTIME ?? '0';
|
|
146
161
|
if (!['0','1'].includes(machineFsRuntimeMode)) throw new Error('DEADBYTE_MACHINE_FS_RUNTIME must be 0 or 1');
|
|
147
|
-
|
|
148
|
-
const machineFsRuntime
|
|
149
|
-
? createMachineFsRuntime({ policy: codingPolicy, signingKeyPath, verifyKeyPath })
|
|
150
|
-
: null;
|
|
162
|
+
planeRegistry.define('machine_fs',{configured:machineFsRuntimeMode==='1',required:false,dependencies:['coding']});
|
|
163
|
+
const machineFsRuntime=await planeRegistry.initialize('machine_fs',async()=>createMachineFsRuntime({policy:codingPolicy,signingKeyPath,verifyKeyPath}));
|
|
151
164
|
const observationRuntimeMode = process.env.DEADBYTE_OBSERVATION_RUNTIME ?? '0';
|
|
152
165
|
if (!['0','1'].includes(observationRuntimeMode)) throw new Error('DEADBYTE_OBSERVATION_RUNTIME must be 0 or 1');
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
stateRoot: runtimeStateRoot })
|
|
158
|
-
: null;
|
|
166
|
+
planeRegistry.define('observation',{configured:observationRuntimeMode==='1',required:false,dependencies:['machine','coding']});
|
|
167
|
+
const observationRuntime=await planeRegistry.initialize('observation',async()=>createObservationRuntime({
|
|
168
|
+
policy:codingPolicy,processRuntime,signingKeyPath,verifyKeyPath,stateRoot:runtimeStateRoot
|
|
169
|
+
}));
|
|
159
170
|
|
|
160
171
|
const desktopRuntimeMode=process.env.DEADBYTE_DESKTOP_RUNTIME??'0';
|
|
161
172
|
if(!['0','1'].includes(desktopRuntimeMode)) throw new Error('DEADBYTE_DESKTOP_RUNTIME must be 0 or 1');
|
|
@@ -165,35 +176,37 @@ if(desktopRuntimeMode==='1'&&!desktopPolicyPath){
|
|
|
165
176
|
try{await access(localDesktopPolicyPath);desktopPolicyPath=localDesktopPolicyPath;}
|
|
166
177
|
catch(error){if(error?.code!=='ENOENT')throw error;}
|
|
167
178
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
})
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
})
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
})
|
|
179
|
+
planeRegistry.define('desktop',{configured:desktopRuntimeMode==='1',required:false});
|
|
180
|
+
let desktopPolicy=null;
|
|
181
|
+
let desktopMemoryProvider=null;
|
|
182
|
+
const desktopRuntime=await planeRegistry.initialize('desktop',async()=>{
|
|
183
|
+
if(!desktopPolicyPath) throw new Error('DEADBYTE_DESKTOP_RUNTIME=1 requires a desktop policy');
|
|
184
|
+
desktopPolicy=await loadDesktopPolicy(desktopPolicyPath);
|
|
185
|
+
const observerRuntime=createDesktopObserverRuntime({
|
|
186
|
+
observerPath:desktopPolicy.observer.executable,expectedObserverSha256:desktopPolicy.observer.sha256,
|
|
187
|
+
maxFrameBytes:desktopPolicy.limits.max_frame_bytes,timeoutMs:desktopPolicy.limits.capture_timeout_ms,
|
|
188
|
+
allowInputDesktops:desktopPolicy.allowed_input_desktops
|
|
189
|
+
});
|
|
190
|
+
const inputProvider=createNativeDesktopInputProvider({
|
|
191
|
+
inputPath:desktopPolicy.input.executable,expectedInputSha256:desktopPolicy.input.sha256,
|
|
192
|
+
timeoutMs:desktopPolicy.limits.input_timeout_ms
|
|
193
|
+
});
|
|
194
|
+
const grounderProvider=createNativeDesktopGrounder({
|
|
195
|
+
grounderPath:desktopPolicy.grounder.executable,expectedGrounderSha256:desktopPolicy.grounder.sha256,
|
|
196
|
+
timeoutMs:desktopPolicy.limits.ground_timeout_ms
|
|
197
|
+
});
|
|
198
|
+
const signingKey=await loadPrivateSigningKey(signingKeyPath);
|
|
199
|
+
const verifyKey=await loadPublicVerifyKey(verifyKeyPath);
|
|
200
|
+
if(signingKey.keyId!==verifyKey.keyId) throw new Error('Desktop signing/verify key mismatch');
|
|
201
|
+
desktopMemoryProvider=createDesktopMemoryProvider({
|
|
202
|
+
evidenceDir:desktopPolicy.evidence_dir,snapshotPath:path.join(desktopPolicy.evidence_dir,'desktop-memory.json'),
|
|
203
|
+
policySha256:desktopPolicy.policy_sha256,privateKey:signingKey.privateKey,
|
|
204
|
+
publicKey:verifyKey.publicKey,keyId:signingKey.keyId
|
|
205
|
+
});
|
|
206
|
+
return createDesktopRuntime({policy:desktopPolicy,observerRuntime,inputProvider,grounderProvider,
|
|
207
|
+
privateKey:signingKey.privateKey,publicKey:verifyKey.publicKey,keyId:signingKey.keyId});
|
|
208
|
+
});
|
|
209
|
+
if(!desktopRuntime){desktopPolicy=null;desktopMemoryProvider=null;}
|
|
197
210
|
|
|
198
211
|
const autonomousRuntimeMode = process.env.DEADBYTE_AUTONOMOUS_RUNTIME ?? '0';
|
|
199
212
|
if (!['0','1'].includes(autonomousRuntimeMode)) throw new Error('DEADBYTE_AUTONOMOUS_RUNTIME must be 0 or 1');
|
|
@@ -201,53 +214,55 @@ const autonomousSupervisorMode = process.env.DEADBYTE_AUTONOMOUS_SUPERVISOR_MODE
|
|
|
201
214
|
if (!['in_process','external'].includes(autonomousSupervisorMode)) {
|
|
202
215
|
throw new Error('DEADBYTE_AUTONOMOUS_SUPERVISOR_MODE must be in_process or external');
|
|
203
216
|
}
|
|
204
|
-
if (autonomousRuntimeMode === '1' && !codingRuntime) throw new Error('DEADBYTE_AUTONOMOUS_RUNTIME=1 requires DEADBYTE_CODING_RUNTIME=1');
|
|
205
217
|
const localAutonomousPolicyPath = path.join(packageRoot,'controller','deadbyte-autonomous-policy.json');
|
|
206
218
|
let autonomousPolicyPath = process.env.DEADBYTE_AUTONOMOUS_POLICY ?? '';
|
|
207
219
|
if (autonomousRuntimeMode === '1' && !autonomousPolicyPath) {
|
|
208
220
|
try { await access(localAutonomousPolicyPath); autonomousPolicyPath = localAutonomousPolicyPath; }
|
|
209
221
|
catch (error) { if (error?.code !== 'ENOENT') throw error; }
|
|
210
222
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
223
|
+
planeRegistry.define('autonomous',{configured:autonomousRuntimeMode==='1',required:false,dependencies:['coding']});
|
|
224
|
+
let autonomousPolicy=null;
|
|
225
|
+
let nativeDiffRuntime=null;
|
|
226
|
+
const autonomousRuntime=await planeRegistry.initialize('autonomous',async()=>{
|
|
227
|
+
if(!autonomousPolicyPath) throw new Error('DEADBYTE_AUTONOMOUS_RUNTIME=1 requires an autonomous policy');
|
|
228
|
+
autonomousPolicy=await loadAutonomousPolicy(autonomousPolicyPath,codingPolicy);
|
|
229
|
+
nativeDiffRuntime=createNativeDiffRuntime({policy:autonomousPolicy,codingRuntime,machineFsRuntime,signingKeyPath,verifyKeyPath});
|
|
230
|
+
semanticRuntime=createSemanticCodeRuntime({codingRuntime,backends:semanticLsp.backends,nativeDiffRuntime});
|
|
231
|
+
const memorySigningKey=await loadPrivateSigningKey(signingKeyPath);
|
|
232
|
+
const memoryVerifyKey=await loadPublicVerifyKey(verifyKeyPath);
|
|
233
|
+
if(memorySigningKey.keyId!==memoryVerifyKey.keyId) throw new Error('R41 memory signing/verify key mismatch');
|
|
234
|
+
const memoryProvider=createR41MemoryProvider({
|
|
235
|
+
memoryRoot:path.join(autonomousPolicy.evidence_dir,'memory-r41',packageManifestSha256),sourceReleaseManifest:packageManifestSha256,
|
|
236
|
+
journalRoot:path.join(autonomousPolicy.evidence_dir,'goals'),writerVersion:DEADBYTE_VERSION,
|
|
237
|
+
privateKey:memorySigningKey.privateKey,publicKey:memoryVerifyKey.publicKey,keyId:memorySigningKey.keyId,
|
|
238
|
+
byteBudget:Math.min(262144,Math.max(65536,Math.floor(autonomousPolicy.limits.max_context_bytes/2))),semantic:{enabled:false}
|
|
239
|
+
});
|
|
240
|
+
const plannerProviderRuntime=autonomousPolicy.planner.backend==='codex_app_server'
|
|
241
|
+
? await createCodexAppServerR44({stateDir:path.join(autonomousPolicy.evidence_dir,'provider-r44','codex-app-server'),
|
|
242
|
+
model:autonomousPolicy.planner.model,cwd:codingPolicy.roots[autonomousPolicy.planner.root_id].real_path,
|
|
243
|
+
clientVersion:DEADBYTE_VERSION,executable:autonomousPolicy.planner.executable,
|
|
244
|
+
executableSha256:autonomousPolicy.planner.executable_sha256,args:autonomousPolicy.planner.args})
|
|
245
|
+
: null;
|
|
246
|
+
return createAutonomousRuntime({policy:autonomousPolicy,codingRuntime,nativeDiffRuntime,machineFsRuntime,
|
|
247
|
+
observationRuntime,processRuntime,semanticRuntime,desktopRuntime,desktopMemoryProvider,memoryProvider,
|
|
248
|
+
plannerProviderRuntime,signingKeyPath,verifyKeyPath});
|
|
249
|
+
});
|
|
250
|
+
if(!autonomousRuntime){autonomousPolicy=null;nativeDiffRuntime=null;}
|
|
236
251
|
const autonomousSupervisor = autonomousRuntime && ['openai_compatible','openai_responses','codex_app_server'].includes(autonomousPolicy.planner.backend) &&
|
|
237
252
|
autonomousSupervisorMode === 'in_process'
|
|
238
253
|
? startAutonomousSupervisor({ runtime: autonomousRuntime, policy: autonomousPolicy })
|
|
239
254
|
: null;
|
|
240
255
|
void autonomousSupervisor;
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
stateRoot:runtimeStateRoot,packageRoot,machineRuntime,
|
|
244
|
-
})
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}) : null;
|
|
256
|
+
planeRegistry.define('audit',{configured:auditRuntimeMode==='1',required:false,dependencies:['machine']});
|
|
257
|
+
const toolAudit=await planeRegistry.initialize('audit',async()=>{
|
|
258
|
+
const contextProvider=createAuditContextProvider({stateRoot:runtimeStateRoot,packageRoot,machineRuntime,
|
|
259
|
+
processPolicy,codingRuntime,autonomousRuntime,hostPolicy});
|
|
260
|
+
return createToolAudit({stateRoot:runtimeStateRoot,signingKeyPath,contextProvider});
|
|
261
|
+
});
|
|
248
262
|
const skillRoot=path.join(runtimeStateRoot,'skills');
|
|
249
263
|
await mkdir(skillRoot,{recursive:true});
|
|
250
|
-
|
|
264
|
+
planeRegistry.define('skill',{configured:true,required:false});
|
|
265
|
+
const skillRuntime=await planeRegistry.initialize('skill',async()=>createSkillPlane({root:skillRoot,verifyKeyPath}));
|
|
251
266
|
const commanderExtendedRuntime=createCommanderExtendedRuntime({stateRoot:runtimeStateRoot});
|
|
252
267
|
const commanderExternalProcessRuntime=observationRuntime?createCommanderExternalProcessRuntime({
|
|
253
268
|
observationRuntime,hostPolicy,hostExecInlineFn:hostExecInline
|
|
@@ -259,6 +274,48 @@ const remoteCapabilities=new Set(String(process.env.DEADBYTE_REMOTE_CAPABILITIES
|
|
|
259
274
|
const remoteRelay=remoteRelayEndpoint?await createCommanderRemoteRelayR47({endpoint:remoteRelayEndpoint}):null;
|
|
260
275
|
const remoteDevicePlane=remoteRelay?await createRemoteDevicePlaneR44({stateDir:path.join(runtimeStateRoot,'remote-device-r44'),relay:remoteRelay,authorizeCapability:async capability=>remoteCapabilities.has(capability)}):null;
|
|
261
276
|
|
|
277
|
+
function runtimeForRegistration(plane,runtime){
|
|
278
|
+
const state=planeRegistry.state(plane);
|
|
279
|
+
return runtime??(state.configured?createUnavailableRuntime(plane,state.diagnostic??{}):null);
|
|
280
|
+
}
|
|
281
|
+
function requirePlane(plane,runtime){
|
|
282
|
+
if(runtime) return runtime;
|
|
283
|
+
const state=planeRegistry.state(plane);
|
|
284
|
+
throw new RuntimePlaneUnavailableError(plane,state.diagnostic??{});
|
|
285
|
+
}
|
|
286
|
+
function capabilityPlaneSnapshot(){
|
|
287
|
+
const planes=planeRegistry.snapshot().planes;
|
|
288
|
+
return {
|
|
289
|
+
DEADBYTE_MACHINE_RUNTIME:planes.machine,
|
|
290
|
+
DEADBYTE_PROCESS_RUNTIME:planes.process,
|
|
291
|
+
DEADBYTE_CODING_RUNTIME:planes.coding,
|
|
292
|
+
DEADBYTE_MACHINE_FS_RUNTIME:planes.machine_fs,
|
|
293
|
+
DEADBYTE_OBSERVATION_RUNTIME:planes.observation,
|
|
294
|
+
DEADBYTE_DESKTOP_RUNTIME:planes.desktop,
|
|
295
|
+
DEADBYTE_AUTONOMOUS_RUNTIME:planes.autonomous,
|
|
296
|
+
DEADBYTE_PRIVILEGED_POLICY:planes.host
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
async function currentReleaseBindings(){
|
|
300
|
+
if(machineRuntime){
|
|
301
|
+
try{return await machineRuntime.status();}catch{}
|
|
302
|
+
}
|
|
303
|
+
return {release_id:`package-${packageManifestSha256.slice(0,16)}`,
|
|
304
|
+
release_manifest_sha256:packageManifestSha256,generation_manifest_sha256:null};
|
|
305
|
+
}
|
|
306
|
+
const registeredMachineRuntime=runtimeForRegistration('machine',machineRuntime);
|
|
307
|
+
const registeredAgentRuntime=runtimeForRegistration('agent',agentRuntime);
|
|
308
|
+
const registeredProcessRuntime=runtimeForRegistration('process',processRuntime);
|
|
309
|
+
const registeredCodingRuntime=runtimeForRegistration('coding',codingRuntime);
|
|
310
|
+
const registeredCodingTaskRuntime=codingTaskRuntime??(planeRegistry.state('coding').configured?createUnavailableRuntime('coding',planeRegistry.state('coding').diagnostic??{}):null);
|
|
311
|
+
const registeredSemanticRuntime=runtimeForRegistration('semantic',semanticRuntime);
|
|
312
|
+
const registeredMachineFsRuntime=runtimeForRegistration('machine_fs',machineFsRuntime);
|
|
313
|
+
const registeredObservationRuntime=runtimeForRegistration('observation',observationRuntime);
|
|
314
|
+
const registeredDesktopRuntime=runtimeForRegistration('desktop',desktopRuntime);
|
|
315
|
+
const registeredAutonomousRuntime=runtimeForRegistration('autonomous',autonomousRuntime);
|
|
316
|
+
const registeredNativeDiffRuntime=nativeDiffRuntime??(planeRegistry.state('autonomous').configured?createUnavailableRuntime('autonomous',planeRegistry.state('autonomous').diagnostic??{}):null);
|
|
317
|
+
const registeredSkillRuntime=runtimeForRegistration('skill',skillRuntime);
|
|
318
|
+
|
|
262
319
|
installStdioConsoleGuard();
|
|
263
320
|
if (process.env.DEADBYTE_STDIO_CONSOLE_GUARD_PROBE === '1') console.log('DEADBYTE_STDIO_CONSOLE_GUARD_PROBE');
|
|
264
321
|
|
|
@@ -437,54 +494,58 @@ serveStdio(() => {
|
|
|
437
494
|
}
|
|
438
495
|
);
|
|
439
496
|
|
|
440
|
-
if (
|
|
497
|
+
if (registeredMachineRuntime) {
|
|
441
498
|
registerMachineTools(toolServer, {
|
|
442
|
-
runtime:
|
|
499
|
+
runtime: registeredMachineRuntime,
|
|
443
500
|
assertRevokeAuthority: async () => {
|
|
444
501
|
if (!hostPolicy) throw new Error('privileged host plane is not configured');
|
|
445
|
-
await assertHostArmed(hostPolicy);
|
|
502
|
+
await assertHostArmed(requirePlane('host',hostPolicy));
|
|
446
503
|
}
|
|
447
504
|
});
|
|
448
505
|
}
|
|
449
506
|
|
|
450
|
-
if (
|
|
451
|
-
registerAgentTools(toolServer, { runtime:
|
|
507
|
+
if (registeredAgentRuntime && surfaceProfile === 'full') {
|
|
508
|
+
registerAgentTools(toolServer, { runtime: registeredAgentRuntime, workspacePathFromId });
|
|
452
509
|
}
|
|
453
510
|
|
|
454
|
-
if (
|
|
455
|
-
registerProcessTools(toolServer, { runtime:
|
|
511
|
+
if (registeredProcessRuntime && surfaceProfile === 'full') {
|
|
512
|
+
registerProcessTools(toolServer, { runtime: registeredProcessRuntime });
|
|
456
513
|
}
|
|
457
514
|
|
|
458
|
-
if (
|
|
515
|
+
if (registeredCodingRuntime && registeredCodingTaskRuntime && registeredSemanticRuntime) {
|
|
459
516
|
const codingServer=surfaceProfile==='full'?toolServer:filteredToolServer(toolServer,COMPACT_CODING_DIRECT_TOOLS);
|
|
460
|
-
registerCodingTools(codingServer, { codingRuntime, taskRuntime:
|
|
517
|
+
registerCodingTools(codingServer, { codingRuntime:registeredCodingRuntime, taskRuntime:registeredCodingTaskRuntime, semanticRuntime:registeredSemanticRuntime });
|
|
461
518
|
}
|
|
462
519
|
|
|
463
|
-
if (
|
|
464
|
-
registerMachineFsTools(toolServer, { runtime:
|
|
520
|
+
if (registeredMachineFsRuntime && surfaceProfile === 'full') {
|
|
521
|
+
registerMachineFsTools(toolServer, { runtime: registeredMachineFsRuntime });
|
|
465
522
|
}
|
|
466
523
|
|
|
467
|
-
if (
|
|
468
|
-
registerObservationTools(toolServer, { runtime:
|
|
524
|
+
if (registeredObservationRuntime && surfaceProfile === 'full') {
|
|
525
|
+
registerObservationTools(toolServer, { runtime: registeredObservationRuntime });
|
|
469
526
|
}
|
|
470
527
|
|
|
471
|
-
if (
|
|
472
|
-
registerDesktopTools(toolServer,{runtime:
|
|
528
|
+
if (registeredDesktopRuntime && surfaceProfile === 'full') {
|
|
529
|
+
registerDesktopTools(toolServer,{runtime:registeredDesktopRuntime});
|
|
473
530
|
}
|
|
474
531
|
|
|
475
|
-
if (
|
|
476
|
-
registerAutonomousTools(toolServer, { autonomousRuntime, nativeDiffRuntime });
|
|
532
|
+
if (registeredAutonomousRuntime && registeredNativeDiffRuntime) {
|
|
533
|
+
registerAutonomousTools(toolServer, { autonomousRuntime:registeredAutonomousRuntime, nativeDiffRuntime:registeredNativeDiffRuntime });
|
|
477
534
|
}
|
|
478
535
|
|
|
479
|
-
registerSkillToolsR44(toolServer,{runtime:
|
|
536
|
+
registerSkillToolsR44(toolServer,{runtime:registeredSkillRuntime});
|
|
480
537
|
|
|
481
538
|
registerCompactGatewayTools(toolServer,{
|
|
482
|
-
profile:surfaceProfile,ledger:R36_CAPABILITY_LEDGER,codingRuntime,
|
|
483
|
-
|
|
484
|
-
|
|
539
|
+
profile:surfaceProfile,ledger:R36_CAPABILITY_LEDGER,codingRuntime:registeredCodingRuntime,
|
|
540
|
+
semanticRuntime:registeredSemanticRuntime,machineFsRuntime:registeredMachineFsRuntime,
|
|
541
|
+
processRuntime:registeredProcessRuntime,observationRuntime:registeredObservationRuntime,
|
|
542
|
+
machineRuntime:registeredMachineRuntime,desktopRuntime:registeredDesktopRuntime,
|
|
543
|
+
skillRuntime:registeredSkillRuntime,autonomousRuntime:registeredAutonomousRuntime,hostPolicy,
|
|
544
|
+
catalogProvider:()=>[...registeredToolNames],runtimePlanes:capabilityPlaneSnapshot,
|
|
545
|
+
releaseBindingProvider:currentReleaseBindings
|
|
485
546
|
});
|
|
486
547
|
|
|
487
|
-
if (
|
|
548
|
+
if (planeRegistry.state('host').configured) {
|
|
488
549
|
toolServer.registerTool(
|
|
489
550
|
'host_file_read',
|
|
490
551
|
{
|
|
@@ -498,7 +559,7 @@ serveStdio(() => {
|
|
|
498
559
|
},
|
|
499
560
|
async ({ root_id, path: relativePath, encoding }) => {
|
|
500
561
|
try {
|
|
501
|
-
const result = await hostFileRead(hostPolicy, { rootId: root_id, relativePath, encoding });
|
|
562
|
+
const result = await hostFileRead(requirePlane('host',hostPolicy), { rootId: root_id, relativePath, encoding });
|
|
502
563
|
return textResult(hostFileReadOutputSchema, { status: 'ok', root_id, path: relativePath, ...result });
|
|
503
564
|
} catch (error) {
|
|
504
565
|
return textResult(hostFileReadOutputSchema, { status: 'denied', error: String(error) }, true);
|
|
@@ -521,7 +582,7 @@ serveStdio(() => {
|
|
|
521
582
|
},
|
|
522
583
|
async ({ root_id, path: relativePath, content, encoding, expected_sha256 }) => {
|
|
523
584
|
try {
|
|
524
|
-
const result = await hostFileWrite(hostPolicy, {
|
|
585
|
+
const result = await hostFileWrite(requirePlane('host',hostPolicy), {
|
|
525
586
|
rootId: root_id,
|
|
526
587
|
relativePath,
|
|
527
588
|
content,
|
|
@@ -585,7 +646,7 @@ serveStdio(() => {
|
|
|
585
646
|
try {
|
|
586
647
|
let result;
|
|
587
648
|
if (args.mode === 'inline') {
|
|
588
|
-
result = await hostExecInline(hostPolicy, {
|
|
649
|
+
result = await hostExecInline(requirePlane('host',hostPolicy), {
|
|
589
650
|
commandId: args.command_id,
|
|
590
651
|
rootId: args.root_id,
|
|
591
652
|
command: args.command,
|
|
@@ -593,7 +654,7 @@ serveStdio(() => {
|
|
|
593
654
|
timeoutMs: args.timeout_ms
|
|
594
655
|
});
|
|
595
656
|
} else if (args.mode === 'native') {
|
|
596
|
-
result = await hostExecNative(hostPolicy, {
|
|
657
|
+
result = await hostExecNative(requirePlane('host',hostPolicy), {
|
|
597
658
|
rootId: args.root_id,
|
|
598
659
|
executable: args.executable,
|
|
599
660
|
executableSha256: args.executable_sha256,
|
|
@@ -602,7 +663,7 @@ serveStdio(() => {
|
|
|
602
663
|
timeoutMs: args.timeout_ms
|
|
603
664
|
});
|
|
604
665
|
} else {
|
|
605
|
-
result = await hostExec(hostPolicy, {
|
|
666
|
+
result = await hostExec(requirePlane('host',hostPolicy), {
|
|
606
667
|
commandId: args.command_id,
|
|
607
668
|
rootId: args.root_id,
|
|
608
669
|
scriptPath: args.script_path,
|
|
@@ -622,8 +683,8 @@ serveStdio(() => {
|
|
|
622
683
|
}
|
|
623
684
|
|
|
624
685
|
if (surfaceProfile === 'full') {
|
|
625
|
-
registerCommanderCoreBridge(toolServer,{machineFsRuntime,processRuntime,searchRuntime:
|
|
626
|
-
registerCommanderExtendedBridge(toolServer,{extendedRuntime:commanderExtendedRuntime,observability:commanderObservability,skillPlane:
|
|
686
|
+
registerCommanderCoreBridge(toolServer,{machineFsRuntime:registeredMachineFsRuntime,processRuntime:registeredProcessRuntime,searchRuntime:registeredCodingRuntime?.search??null,extendedRuntime:commanderExtendedRuntime,externalProcessRuntime:commanderExternalProcessRuntime,includeMarkdownEditor:true});
|
|
687
|
+
registerCommanderExtendedBridge(toolServer,{extendedRuntime:commanderExtendedRuntime,observability:commanderObservability,skillPlane:registeredSkillRuntime});
|
|
627
688
|
registerCommanderRemoteBridge(toolServer,{remoteDevicePlane});
|
|
628
689
|
registerCommanderHiddenUiDispatch(server);
|
|
629
690
|
registerCommanderUiResources(server);
|
|
@@ -41,7 +41,7 @@ export async function probeR40CompactDisarmed(endpointText){
|
|
|
41
41
|
for(const name of R40_COMPACT_GATEWAYS)if(!names.includes(name))throw new Error('R40 compact gateway missing '+name);
|
|
42
42
|
for(const tool of listed.tools)if(tool.outputSchema?.type!=='object'||tool.outputSchema?.additionalProperties!==false||!tool.outputSchema?.properties)throw new Error('tool '+tool.name+' missing strict output schema');
|
|
43
43
|
const manifest=gateway(await client.callTool({name:'capability_manifest',arguments:{}}),'capability_manifest');
|
|
44
|
-
if(manifest.
|
|
44
|
+
if(!['deadbyte.capability-manifest.v2','deadbyte.capability-manifest.v3'].includes(manifest.schema)||manifest.profile!=='compact'||manifest.tool_count!==names.length||
|
|
45
45
|
JSON.stringify(manifest.tool_catalog)!==JSON.stringify(names))throw new Error('R40 compact manifest malformed');
|
|
46
46
|
const required=manifest.capabilities.filter(x=>x?.production===true&&x?.host_only!==true);
|
|
47
47
|
for(const item of required)if(typeof item.compact_tool!=='string'||!names.includes(item.compact_tool))throw new Error('compact route missing '+String(item.id));
|
|
@@ -41,7 +41,7 @@ export async function probeR44CompactDisarmed(endpointText){
|
|
|
41
41
|
for(const name of R44_COMPACT_GATEWAYS)if(!names.includes(name))throw new Error('R44 compact gateway missing '+name);
|
|
42
42
|
for(const tool of listed.tools)if(tool.outputSchema?.type!=='object'||tool.outputSchema?.additionalProperties!==false||!tool.outputSchema?.properties)throw new Error('tool '+tool.name+' missing strict output schema');
|
|
43
43
|
const manifest=gateway(await client.callTool({name:'capability_manifest',arguments:{}}),'capability_manifest');
|
|
44
|
-
if(manifest.
|
|
44
|
+
if(!['deadbyte.capability-manifest.v2','deadbyte.capability-manifest.v3'].includes(manifest.schema)||manifest.profile!=='compact'||manifest.tool_count!==names.length||
|
|
45
45
|
JSON.stringify(manifest.tool_catalog)!==JSON.stringify(names))throw new Error('R44 compact manifest malformed');
|
|
46
46
|
const required=manifest.capabilities.filter(x=>x?.production===true&&x?.host_only!==true);
|
|
47
47
|
for(const item of required)if(typeof item.compact_tool!=='string'||!names.includes(item.compact_tool))throw new Error('compact route missing '+String(item.id));
|
|
@@ -41,7 +41,7 @@ export async function probeR45CompactDisarmed(endpointText){
|
|
|
41
41
|
for(const name of R45_COMPACT_GATEWAYS)if(!names.includes(name))throw new Error('R45 compact gateway missing '+name);
|
|
42
42
|
for(const tool of listed.tools)if(tool.outputSchema?.type!=='object'||tool.outputSchema?.additionalProperties!==false||!tool.outputSchema?.properties)throw new Error('tool '+tool.name+' missing strict output schema');
|
|
43
43
|
const manifest=gateway(await client.callTool({name:'capability_manifest',arguments:{}}),'capability_manifest');
|
|
44
|
-
if(manifest.
|
|
44
|
+
if(!['deadbyte.capability-manifest.v2','deadbyte.capability-manifest.v3'].includes(manifest.schema)||manifest.profile!=='compact'||manifest.tool_count!==names.length||
|
|
45
45
|
JSON.stringify(manifest.tool_catalog)!==JSON.stringify(names))throw new Error('R45 compact manifest malformed');
|
|
46
46
|
const required=manifest.capabilities.filter(x=>x?.production===true&&x?.host_only!==true);
|
|
47
47
|
for(const item of required)if(typeof item.compact_tool!=='string'||!names.includes(item.compact_tool))throw new Error('compact route missing '+String(item.id));
|
|
@@ -200,6 +200,7 @@ function renderControllerConfig({currentConfig,coreRoot,workspaceRoot,processPol
|
|
|
200
200
|
` WorkingDirectory = ${psQuote(bridge.WorkingDirectory)}`,
|
|
201
201
|
` ScriptPath = ${psQuote(bridge.ScriptPath)}`,
|
|
202
202
|
` ScriptSha256 = ${psQuote(bridge.ScriptSha256)}`,
|
|
203
|
+
...renderPsDependencies(bridge.Dependencies),
|
|
203
204
|
' }',' Cloud = @{',
|
|
204
205
|
` FilePath = ${psQuote(cloud.FilePath)}`,
|
|
205
206
|
` FileSha256 = ${psQuote(cloud.FileSha256)}`,
|
package/src/release-slot.mjs
CHANGED
|
@@ -289,7 +289,8 @@ export function renderStableLauncherPs1(){
|
|
|
289
289
|
'$env:DEADBYTE_STATE_ROOT = $StateRoot',
|
|
290
290
|
'$env:DEADBYTE_CONTROLLER_CONFIG = $configPath',
|
|
291
291
|
"$env:DEADBYTE_CONTROLLER_RUNTIME_ROOT = Join-Path $StateRoot 'runtime'",
|
|
292
|
-
"$powershell = Join-Path
|
|
292
|
+
"$powershell = Join-Path ([Environment]::GetFolderPath('Windows')) 'System32\\WindowsPowerShell\\v1.0\\powershell.exe'",
|
|
293
|
+
"if (-not (Test-Path -LiteralPath $powershell -PathType Leaf)) { Fail 'native Windows PowerShell missing' }",
|
|
293
294
|
'& $powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -File $controller @ControllerArgs',
|
|
294
295
|
'$exitCode = (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue)',
|
|
295
296
|
'if ($null -eq $exitCode) { $exitCode = 0 }',
|
|
@@ -98,7 +98,7 @@ export async function runR40CompactParity(endpointText){
|
|
|
98
98
|
if(tool.outputSchema?.type!=='object'||tool.outputSchema?.additionalProperties!==false||!tool.outputSchema?.properties) throw new Error(`tool ${tool.name} missing strict output schema`);
|
|
99
99
|
}
|
|
100
100
|
const manifest=gateway(await client.callTool({name:'capability_manifest',arguments:{}}),'capability_manifest');
|
|
101
|
-
if(manifest.
|
|
101
|
+
if(!['deadbyte.capability-manifest.v2','deadbyte.capability-manifest.v3'].includes(manifest.schema)||manifest.profile!=='compact'||!Array.isArray(manifest.capabilities)||!/^[0-9a-f]{64}$/.test(String(manifest.ledger_sha256??''))) throw new Error('R40 compact capability manifest malformed');
|
|
102
102
|
if(manifest.tool_count!==names.length||JSON.stringify(manifest.tool_catalog)!==JSON.stringify(names)||
|
|
103
103
|
manifest.catalog_sha256!==sha256(Buffer.from(JSON.stringify(names),'utf8'))) throw new Error('R40 compact manifest catalog binding mismatch');
|
|
104
104
|
const required=manifest.capabilities.filter(item=>item?.production===true&&item?.host_only!==true);
|
|
@@ -98,7 +98,7 @@ export async function runR44CompactParity(endpointText){
|
|
|
98
98
|
if(tool.outputSchema?.type!=='object'||tool.outputSchema?.additionalProperties!==false||!tool.outputSchema?.properties) throw new Error(`tool ${tool.name} missing strict output schema`);
|
|
99
99
|
}
|
|
100
100
|
const manifest=gateway(await client.callTool({name:'capability_manifest',arguments:{}}),'capability_manifest');
|
|
101
|
-
if(manifest.
|
|
101
|
+
if(!['deadbyte.capability-manifest.v2','deadbyte.capability-manifest.v3'].includes(manifest.schema)||manifest.profile!=='compact'||!Array.isArray(manifest.capabilities)||!/^[0-9a-f]{64}$/.test(String(manifest.ledger_sha256??''))) throw new Error('R44 compact capability manifest malformed');
|
|
102
102
|
if(manifest.tool_count!==names.length||JSON.stringify(manifest.tool_catalog)!==JSON.stringify(names)||
|
|
103
103
|
manifest.catalog_sha256!==sha256(Buffer.from(JSON.stringify(names),'utf8'))) throw new Error('R44 compact manifest catalog binding mismatch');
|
|
104
104
|
const required=manifest.capabilities.filter(item=>item?.production===true&&item?.host_only!==true);
|
|
@@ -98,7 +98,7 @@ export async function runR45CompactParity(endpointText){
|
|
|
98
98
|
if(tool.outputSchema?.type!=='object'||tool.outputSchema?.additionalProperties!==false||!tool.outputSchema?.properties) throw new Error(`tool ${tool.name} missing strict output schema`);
|
|
99
99
|
}
|
|
100
100
|
const manifest=gateway(await client.callTool({name:'capability_manifest',arguments:{}}),'capability_manifest');
|
|
101
|
-
if(manifest.
|
|
101
|
+
if(!['deadbyte.capability-manifest.v2','deadbyte.capability-manifest.v3'].includes(manifest.schema)||manifest.profile!=='compact'||!Array.isArray(manifest.capabilities)||!/^[0-9a-f]{64}$/.test(String(manifest.ledger_sha256??''))) throw new Error('R45 compact capability manifest malformed');
|
|
102
102
|
if(manifest.tool_count!==names.length||JSON.stringify(manifest.tool_catalog)!==JSON.stringify(names)||
|
|
103
103
|
manifest.catalog_sha256!==sha256(Buffer.from(JSON.stringify(names),'utf8'))) throw new Error('R45 compact manifest catalog binding mismatch');
|
|
104
104
|
const required=manifest.capabilities.filter(item=>item?.production===true&&item?.host_only!==true);
|