feat: add owned Vite previews and isolated task browser with approved actions

This commit is contained in:
Agent Workbench Dev
2026-11-02 03:46:40 +08:00
parent de5a1d6c06
commit dc32c899f1
44 changed files with 1282 additions and 35 deletions
+7
View File
@@ -16,6 +16,13 @@ export async function exportSession(id: string) {
const blob = await response.blob();
downloadBlob(blob, 'agent-workbench-session-' + id + '.json');
}
export async function browsingScreenshot(sessionId:string,observationId:string) {
const response=await fetch('/api/sessions/'+sessionId+'/browsing/observations/'+observationId+'/image',{headers:{'X-Workbench-Token':accessToken}});
if(!response.ok)throw new Error('原页面截图读取失败,请核对原观察记录。');
const bytes=await response.arrayBuffer(),digest=await crypto.subtle.digest('SHA-256',bytes),sha=Array.from(new Uint8Array(digest)).map(value=>value.toString(16).padStart(2,'0')).join('');
if(sha!==response.headers.get('X-Content-SHA256'))throw new Error('原页面截图SHA-256不一致。');
return URL.createObjectURL(new Blob([bytes],{type:'image/png'}));
}
export async function downloadCompanionCertificate() {
const response = await fetch('/api/companion/certificate', { headers: { 'X-Workbench-Token': accessToken } });
if (!response.ok) { const value = await response.json().catch(() => ({})); throw new Error(value.error || '手机根证书下载失败。'); }