Implement managed browser security, individual agents and observability

This commit is contained in:
Karl committed 2026-10-13 16:58:15 +02:00
1 parent ff482ebe23
commit ea448de2d4
172 files changed
+5404 -347

No files matched your search

+3 -2
View File
@@ -16,7 +16,7 @@ function privateInspectorPaths(root,packaged=false,environment=process.env){
return {python,script};
}catch{return null;}
}
function startInspector(root,packaged=false){
function startInspector(root,packaged=false,options={}){
const files=privateInspectorPaths(root,packaged);if(!files)return null;
const {python,script}=files;
const credential=crypto.randomBytes(32).toString('base64url');
@@ -44,7 +44,8 @@ function startInspector(root,packaged=false){
const response=await require('./loopback-http.cjs').postLoopback({port,route,token:credential,body:{data:Buffer.from(bytes).toString('base64'),policy},signal:controller.signal});
if(response.status!==200)throw Error('Local content inspection failed');const result=response.body;
if(!['allow','block'].includes(result.decision)||typeof result.coverage?.complete!=='boolean')throw Error('Inspector response rejected');
if(result.decision==='allow'&&!result.coverage.complete)throw Error('Incomplete content cannot be released');return result;
if(result.decision==='allow'&&!result.coverage.complete)throw Error('Incomplete content cannot be released');
const stages=result._diagnosticStages;delete result._diagnosticStages;if(policy?.diagnostics?.enabled===true&&policy.diagnostics.mode==='debug'&&typeof options.onStages==='function'){try{options.onStages(stages);}catch{}}return result;
}catch(error){if(error.name==='AbortError'){child.kill();throw Error('Content inspection exceeded its time budget');}throw error;}
finally{clearTimeout(timer);}
};