fix: remove open execution record caps and preserve recovery history

This commit is contained in:
Agent Workbench Dev
2026-11-07 03:17:05 +08:00
parent affd733d03
commit 32780bee8d
22 changed files with 595 additions and 74 deletions
+4 -2
View File
@@ -25,6 +25,7 @@ import { validateModelWaitSettings } from '../core/models/request-deadline.mjs';
import { nativeParameterSettings } from '../shared/contracts/native-parameters.mjs';
import { localDirectories } from './local-directories.mjs';
import { readInstallationProgress } from '../core/desktop/installation-progress.mjs';
import { recordPageQuery } from '../shared/contracts/record-page.mjs';
export function createSessionPublisher(clients) {
return session => {
@@ -103,6 +104,7 @@ return async (request, response) => {
if (route.startsWith('/api/companion')) {
const gateway = companionGateway({ appDirectory, server, store, provider, runtime });
if (method === 'GET' && route === '/api/companion') return json(response, gateway.status());
if (method === 'GET' && route === '/api/companion/audit') return json(response, gateway.registry.auditPage(recordPageQuery(url) ?? {}));
if (method === 'POST' && route === '/api/companion/start') return json(response, await gateway.start(await body(request)));
if (method === 'POST' && route === '/api/companion/close') { const value = await body(request); if (Object.keys(value).length) throw Object.assign(new Error('关闭手机连接不接受额外字段。'), { status: 400 }); return json(response, await gateway.close()); }
if (method === 'POST' && route === '/api/companion/pair') return json(response, await gateway.pairing(await body(request)));
@@ -488,7 +490,7 @@ return async (request, response) => {
'X-Content-Type-Options': 'nosniff', ...(engineRun[2] === 'download' ? { 'Content-Disposition': 'attachment; filename="agent-workbench-engine-run-' + job.id + '.json"' } : {}) });
response.end(text); return;
}
if (method === 'GET' && action === 'mcp/jobs') return json(response, runtime.mcpRegistry().jobs(session));
if (method === 'GET' && action === 'mcp/jobs') return json(response, runtime.mcpRegistry().jobs(session, recordPageQuery(url)));
if (method === 'POST' && action === 'mcp/probe') {
const started = runtime.mcpRegistry().start(session, await body(request));
return json(response, { job: started.job, session: store.publicSession(session) }, 202);
@@ -535,7 +537,7 @@ return async (request, response) => {
if (method === 'GET' && action === 'research') {
const manager = runtime.researchManager(); return json(response, { availability: manager.availability(), targets: manager.targets(session), jobs: manager.jobs(session) });
}
if (method === 'GET' && action === 'task-checkpoints') return json(response, runtime.checkpointManager().list(session));
if (method === 'GET' && action === 'task-checkpoints') return json(response, runtime.checkpointManager().list(session, recordPageQuery(url)));
if (method === 'POST' && action === 'task-checkpoints') {
const input = await body(request);
if (Object.keys(input).some(key => !['taskId', 'runId'].includes(key)) || input.taskId !== session.taskId || input.runId !== session.runId) throw Object.assign(new Error('检查点的原任务或运行已变化,请刷新当前任务。'), { status: 409 });