feat: pin controlled Harness profile and verify owned tool and model bridge

This commit is contained in:
Agent Workbench Dev
2026-10-31 04:25:44 +08:00
parent 60b63bc70f
commit a01c41811b
14 changed files with 1928 additions and 0 deletions
@@ -0,0 +1,55 @@
import path from 'node:path';
import { pathToFileURL } from 'node:url';
import { engineDigest, engineError } from '../../shared/contracts/engines.mjs';
import { resolveDeepSeekInstallation, assertDeepSeekInstallation, engineFileIdentity } from './deepseek-installation.mjs';
import { CONTROLLED_BRIDGE_PLUGIN, CONTROLLED_DISABLED_PLUGINS, canonicalEngineValue } from './controlled-plugin.mjs';
export const CONTROLLED_ENGINE_SCOPE = 'deepseek-workbench-engine-v1';
export const CONTROLLED_CRITICAL_FILES = Object.freeze(['packages/core/tools/lib/index.js', 'packages/core/agent/lib/index.js',
'packages/core/agent-loop/lib/index.js', 'packages/core/system-prompt/lib/index.js', 'packages/llm/llm/lib/index.js',
'packages/llm/llm-retry/lib/index.js', 'vendor/include/lib/index.js']);
export const controlledDigest = value => engineDigest(canonicalEngineValue(value));
export function resolveControlledInstallation(appDirectory = process.cwd(), root) {
const base = resolveDeepSeekInstallation(appDirectory, root);
if (base.status !== 'available') return { ...base, scope: CONTROLLED_ENGINE_SCOPE, controlledStatus: 'unavailable' };
try {
const inputs = CONTROLLED_CRITICAL_FILES.map(relative => {
const file = engineFileIdentity(path.join(base.root, relative));
if (!file.path.startsWith(base.root + path.sep)) throw engineError('受控引擎输入不属于当前安装目录。');
return { ...file, relative };
});
const bridgeSha256 = engineDigest(CONTROLLED_BRIDGE_PLUGIN), disabledPlugins = [...CONTROLLED_DISABLED_PLUGINS];
const controlledSha256 = controlledDigest({ schemaVersion: 1, scope: CONTROLLED_ENGINE_SCOPE, installationSha256: base.identitySha256,
inputs, bridgeSha256, disabledPlugins });
return { ...base, scope: CONTROLLED_ENGINE_SCOPE, controlledStatus: 'available', controlledSha256, controlledInputs: inputs,
bridgeSha256, disabledPlugins, llmModule: pathToFileURL(path.join(base.root, 'packages/llm/llm/lib/index.js')).href,
controlledCapabilities: { bridge: true, text: true, nativeProjectTools: false, nativeModelCredentials: false,
singleSessionCancel: false, cancellationUnit: 'owned-process', nativeSessionResume: false, tokenStreaming: false } };
} catch (error) { return { ...base, scope: CONTROLLED_ENGINE_SCOPE, controlledStatus: 'unavailable', message: error.message }; }
}
export function assertControlledInstallation(installation) {
assertDeepSeekInstallation(installation);
const current = resolveControlledInstallation(process.cwd(), installation.root);
if (current.controlledStatus !== 'available' || current.controlledSha256 !== installation.controlledSha256) {
throw engineError('受控引擎入口、工具内核或叠加插件已变化,请重新检测并封存新计划。', 409, 'ENGINE_INPUT_CHANGED');
}
return current;
}
export function controlledToolCatalogue(tools) {
if (!Array.isArray(tools) || !tools.length || tools.length > 32) throw engineError('受控工具目录需要1到32项。', 400);
const result = tools.map(tool => tool.function ?? tool).map(({ name, description, parameters }) => {
if (typeof name !== 'string' || !/^[a-z][a-z0-9_]{0,63}$/.test(name) || typeof description !== 'string'
|| !parameters || parameters.type !== 'object') throw engineError('受控工具目录格式无效。', 400);
return structuredClone({ name, description, parameters });
}).sort((left, right) => left.name.localeCompare(right.name));
if (new Set(result.map(tool => tool.name)).size !== result.length) throw engineError('受控工具目录不能重复。', 400);
return result;
}
export function controlledPatch(plugin, config) {
return [...CONTROLLED_DISABLED_PLUGINS.map(id => ({ id, disabled: true })),
{ insert: [{ id: 'agent-workbench-controlled-bridge', name: plugin, config }] }];
}
+102
View File
@@ -0,0 +1,102 @@
// The literal is copied into each owned runtime. Bundling preserves its bytes;
// no third-party program or currently running release is modified.
export const CONTROLLED_BRIDGE_PLUGIN = String.raw`import fs from 'node:fs';
import { createHash } from 'node:crypto';
export const name = 'agent-workbench-controlled-bridge';
export const inject = ['tools', 'llm', 'appReady'];
const canonical = value => Array.isArray(value) ? value.map(canonical) : value && typeof value === 'object'
? Object.fromEntries(Object.keys(value).sort().map(key => [key, canonical(value[key])])) : value;
const digest = value => createHash('sha256').update(JSON.stringify(canonical(value))).digest('hex');
export async function apply(ctx, config) {
const { LlmAdapter } = await import(config.llmModule);
const controller = new AbortController();
ctx.effect(() => () => controller.abort(new Error('Owned engine bridge disposed.')));
const descriptors = config.tools.map(({ name, description, parameters }) => ({ name, description, parameters }));
const names = new Set(descriptors.map(tool => tool.name));
const catalogue = () => ctx.tools.schemas().map(({ name, description, parameters }) => ({ name, description, parameters }))
.sort((left, right) => left.name.localeCompare(right.name));
const assertCatalogue = () => {
if (digest(catalogue()) !== config.catalogueSha256) throw new Error('The owned tool catalogue changed.');
};
const post = async (route, data, signal) => {
controller.signal.throwIfAborted(); signal?.throwIfAborted(); assertCatalogue();
const response = await fetch(config.endpoint + route, { method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + config.nonce },
signal: signal ? AbortSignal.any([signal, controller.signal]) : controller.signal,
body: JSON.stringify({ owner: config.owner, sessionId: config.sdkSessionId, pid: process.pid, data }) });
let size = 0; const chunks = [];
for await (const chunk of response.body) {
size += chunk.length;
if (size > config.maximumFrameBytes) throw new Error('Owned bridge response exceeded its bound.');
chunks.push(chunk);
}
const value = JSON.parse(Buffer.concat(chunks).toString('utf8'));
if (!response.ok) throw new Error(value.error || 'Owned bridge rejected the request.');
return value;
};
for (const descriptor of descriptors) ctx.tools.register({ ...descriptor,
output: { schema: {}, render: (_args, value) => [{ type: 'text', text: JSON.stringify(value) }] },
async execute(args, execution) {
if (execution.agent?.session?.id !== config.sdkSessionId) throw new Error('Tool caller is not the owned SDK session.');
return post('/tool', { callId: execution.callId, name: descriptor.name, arguments: args }, execution.signal);
},
});
ctx.on('tools/pre-execute', async (execution, next) => {
assertCatalogue();
if (execution.agent?.session?.id !== config.sdkSessionId || !names.has(execution.name)) {
return { kind: 'deny', reason: 'This tool or caller is outside the owned workbench scope.' };
}
return next();
});
class WorkbenchAdapter extends LlmAdapter {
async resolveModel(provider, model) {
if (provider !== 'agent-workbench' || model !== config.model) throw new Error('Owned model route changed.');
return { provider, id: model, name: model, contextWindow: config.contextLimit, defaultMaxTokens: config.maxOutputTokens };
}
async *stream(options) {
if (options.provider !== 'agent-workbench' || options.model !== config.model) throw new Error('Unowned model route.');
const result = await post('/model', { messages: options.messages, system: options.system ?? null,
tools: options.tools ?? [], toolHistory: options.toolHistory ?? null,
model: options.model, maxTokens: options.maxTokens ?? config.maxOutputTokens }, options.signal);
const message = result.message;
if (!message || message.role !== 'assistant' || typeof message.content !== 'string'
|| message.tool_calls !== undefined && !Array.isArray(message.tool_calls)) throw new Error('Invalid owned model result.');
let index = 0;
if (message.content) {
yield { type: 'block-start', index, blockType: 'text' };
yield { type: 'text-delta', index, text: message.content };
yield { type: 'block-end', index, block: { type: 'text', text: message.content } }; index++;
}
for (const call of message.tool_calls ?? []) {
if (typeof call.id !== 'string' || typeof call.function?.name !== 'string'
|| typeof call.function.arguments !== 'string') throw new Error('Incomplete owned tool call.');
JSON.parse(call.function.arguments);
yield { type: 'block-start', index, blockType: 'tool-call' };
yield { type: 'tool-call-delta', index, id: call.id, name: call.function.name, argumentsDelta: call.function.arguments };
yield { type: 'block-end', index, block: { type: 'tool-call', id: call.id, name: call.function.name, arguments: call.function.arguments } }; index++;
}
const usage = result.usage, valid = value => Number.isSafeInteger(value) && value >= 0;
if (valid(usage?.prompt_tokens) && valid(usage?.completion_tokens)) {
yield { type: 'usage', usage: { inputTokens: usage.prompt_tokens, outputTokens: usage.completion_tokens } };
}
yield { type: 'finish', reason: { kind: message.tool_calls?.length ? 'tool-calls' : 'stop' } };
}
}
ctx.llm.registerAdapter(['agent-workbench'], new WorkbenchAdapter());
const off = ctx.appReady.onReady(() => {
assertCatalogue();
const providers = ctx.llm.listProviders().map(provider => provider.id).sort();
if (providers.length !== 1 || providers[0] !== 'agent-workbench') throw new Error('Unexpected native model provider.');
const marker = { schemaVersion: 1, nonce: config.nonce, pid: process.pid, signal: 'appReady', readyAt: new Date().toISOString(),
owner: config.owner, sdkSessionId: config.sdkSessionId, catalogue: catalogue(), catalogueSha256: config.catalogueSha256, providers };
fs.writeFileSync(config.marker + '.writing', JSON.stringify(marker), { flag: 'wx' });
fs.renameSync(config.marker + '.writing', config.marker);
});
ctx.effect(() => off, 'workbench.controlled-ready');
}
`;
export const CONTROLLED_DISABLED_PLUGINS = Object.freeze(['tool-fs', 'tool-working-directory', 'persistent-bash', 'persistent-pwsh',
'terminal-bash', 'terminal-pwsh', 'llm-deepseek', 'llm-retry']);
export const canonicalEngineValue = value => Array.isArray(value) ? value.map(canonicalEngineValue) : value && typeof value === 'object'
? Object.fromEntries(Object.keys(value).sort().map(key => [key, canonicalEngineValue(value[key])])) : value;
+182
View File
@@ -0,0 +1,182 @@
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
import { randomUUID, timingSafeEqual } from 'node:crypto';
import { DeepSeekAdapter } from './deepseek-adapter.mjs';
import { engineFileIdentity } from './deepseek-installation.mjs';
import { engineError } from '../../shared/contracts/engines.mjs';
import { isId } from '../../shared/contracts/execution.mjs';
import { CONTROLLED_BRIDGE_PLUGIN } from './controlled-plugin.mjs';
import { assertControlledInstallation, controlledDigest, controlledPatch, controlledToolCatalogue, CONTROLLED_ENGINE_SCOPE } from './controlled-installation.mjs';
const allowedEnvironment = /^(path|pathext|systemroot|systemdrive|windir|comspec|temp|tmp|userprofile|appdata|localappdata|programfiles(?:\(x86\))?|homedrive|homepath)$/i;
const at = () => new Date().toISOString();
const equalSecret = (left, right) => typeof left === 'string' && Buffer.byteLength(left) === Buffer.byteLength(right)
&& timingSafeEqual(Buffer.from(left), Buffer.from(right));
export class ControlledDeepSeekSession extends DeepSeekAdapter {
constructor(installation, options = {}) {
super(installation, options); this.maximumFrameBytes = options.maximumFrameBytes ?? 4 * 1024 * 1024;
this.pending = new Set(); this.closed = false;
}
async open({ directory, cwd, owner, sdkSessionId, tools, config, signal, onModel, onTool, onState = () => {}, onNotification = () => {} }) {
for (const field of ['sessionId', 'projectId', 'taskId', 'runId', 'jobId']) if (!isId(owner?.[field])) throw engineError('受控引擎所属身份无效。', 400);
if (!isId(sdkSessionId) || typeof onModel !== 'function' || typeof onTool !== 'function') throw engineError('受控引擎回调或会话无效。', 400);
signal?.throwIfAborted(); assertControlledInstallation(this.installation);
const catalogue = controlledToolCatalogue(tools), catalogueSha256 = controlledDigest(catalogue);
this.bridgeController = new AbortController();
const bridgeSignal = signal ? AbortSignal.any([signal, this.bridgeController.signal]) : this.bridgeController.signal;
this.owner = structuredClone(owner); this.sdkSessionId = sdkSessionId; this.signal = bridgeSignal; this.parentSignal = signal;
this.catalogueNames = new Set(catalogue.map(tool => tool.name)); this.callIds = new Set();
this.catalogueSha256 = catalogueSha256; this.config = structuredClone(config);
this.report = { schemaVersion: 1, scope: CONTROLLED_ENGINE_SCOPE, owner: this.owner, sdkSessionId,
installationSha256: this.installation.controlledSha256, startedAt: at(), responses: [], notifications: [], unownedNotifications: [],
rejectedServerRequests: [], bridgeRequests: [], cleanup: null, modelRequests: 0, toolRequests: 0 };
fs.mkdirSync(directory, { recursive: false });
const home = path.join(directory, 'home'), agents = path.join(directory, 'agents');
fs.mkdirSync(home); fs.mkdirSync(agents);
const nonce = randomUUID(), marker = path.join(directory, 'ready.json'), plugin = path.join(directory, 'bridge.mjs'), patch = path.join(directory, 'bridge.patch.json');
const authentication = 'Bearer ' + nonce;
this.guard = http.createServer((request, response) => {
const operation = this.handleBridge(request, response, { authentication, onModel, onTool, signal: bridgeSignal }).catch(error => {
if (!response.destroyed && !response.writableEnded) { response.writeHead(error.status ?? 409, { 'Content-Type': 'application/json', Connection: 'close' }); response.end(JSON.stringify({ error: error.message })); }
});
this.pending.add(operation); operation.finally(() => this.pending.delete(operation));
});
await new Promise((resolve, reject) => { this.guard.once('error', reject); this.guard.listen(0, '127.0.0.1', resolve); });
const pluginConfig = { owner: this.owner, sdkSessionId, tools: catalogue, catalogueSha256, nonce, marker,
llmModule: this.installation.llmModule, endpoint: 'http://127.0.0.1:' + this.guard.address().port,
maximumFrameBytes: this.maximumFrameBytes, model: config.model, maxOutputTokens: config.maxOutputTokens, contextLimit: config.contextLimit };
fs.writeFileSync(plugin, CONTROLLED_BRIDGE_PLUGIN, { flag: 'wx' }); fs.writeFileSync(patch, JSON.stringify(controlledPatch(plugin, pluginConfig)), { flag: 'wx' });
this.report.launchInputs = { plugin: engineFileIdentity(plugin), patch: engineFileIdentity(patch), cwd: fs.realpathSync.native(cwd),
disabledPlugins: this.installation.disabledPlugins, catalogue, catalogueSha256 };
const env = {};
for (const name of Object.keys(process.env)) if (allowedEnvironment.test(name)) env[name] = process.env[name];
Object.assign(env, { DSH_HOME: home, DSH_AGENTS_HOME: agents, DSH_TELEMETRY_DISABLED: 'true' });
signal?.throwIfAborted(); assertControlledInstallation(this.installation);
this.client = this.clientFactory({ executable: this.installation.node.path,
args: [this.installation.entry, '--profile', this.installation.profile, '--patch', patch], cwd, env },
{ timeoutMs: this.timeoutMs, maximumFrameBytes: this.maximumFrameBytes, cancellationMethod: null });
this.report.process = { pid: this.client.pid, connectionId: this.client.id, startedAt: this.client.startedAt, ownership: 'one-process-per-engine-run' };
onState('starting', this.report.process);
this.client.on('server-request', request => {
this.report.rejectedServerRequests.push({ id: request.id, method: request.method, parametersSha256: controlledDigest(request.params ?? {}) });
this.client.fail(engineError('原SDK反向请求未在受控契约中开放。'));
});
let notificationBytes = 0;
this.client.on('notification', value => {
notificationBytes += Buffer.byteLength(JSON.stringify(value));
if (notificationBytes > 16 * 1024 * 1024 || this.report.notifications.length + this.report.unownedNotifications.length >= 8192) {
this.client.fail(engineError('受控引擎事件超过接收范围。')); return;
}
if (!['session.event', 'session.status', 'subagent.started', 'subagent.finished'].includes(value.method)) {
this.client.fail(engineError('受控引擎返回未支持的通知。')); return;
}
if (value.params?.sessionId !== sdkSessionId) { this.report.unownedNotifications.push(value); return; }
this.report.notifications.push(value);
try { onNotification(value); } catch (error) { this.client.fail(error); }
});
this.report.readiness = await this.waitReady(marker, nonce, signal);
const ready = this.report.readiness;
if (controlledDigest(ready.owner) !== controlledDigest(this.owner) || ready.sdkSessionId !== sdkSessionId
|| ready.catalogueSha256 !== catalogueSha256 || controlledDigest(ready.catalogue) !== catalogueSha256
|| JSON.stringify(ready.providers) !== JSON.stringify(['agent-workbench'])) throw engineError('启动后工具、模型或Run目录不符合封存契约。');
this.verifyLaunch(); onState('initializing', { readiness: ready });
const initialized = await this.request('initialize', { cwd, provider: 'agent-workbench', model: config.model, maxTokens: config.maxOutputTokens });
if (controlledDigest(initialized.serverInfo) !== controlledDigest(this.installation.serverInfo)) throw engineError('受控SDK返回身份不符合固定发行。');
const working = await this.request('session/working-directory/get', { sessionId: sdkSessionId });
if (fs.realpathSync.native(working.cwd) !== fs.realpathSync.native(cwd)) throw engineError('原SDK工作目录不属于所封存的工作区。');
onState('ready', { serverInfo: initialized.serverInfo }); return this.report;
}
verifyLaunch() {
assertControlledInstallation(this.installation);
for (const input of [this.report.launchInputs.plugin, this.report.launchInputs.patch]) {
if (engineFileIdentity(input.path).sha256 !== input.sha256) throw engineError('所属叠加插件或启动输入发生变化。');
}
}
async handleBridge(request, response, { authentication, onModel, onTool, signal }) {
if (this.closed || signal?.aborted || request.method !== 'POST' || !['/model', '/tool'].includes(request.url)
|| request.headers.origin !== undefined || request.headers['content-type'] !== 'application/json'
|| !equalSecret(request.headers.authorization, authentication)) throw engineError('桥请求不属于当前受控Run。', 403);
const chunks = []; let size = 0;
for await (const chunk of request) { size += chunk.length; if (size > this.maximumFrameBytes) throw engineError('桥请求超过输入范围。', 413); chunks.push(chunk); }
const body = JSON.parse(Buffer.concat(chunks).toString('utf8'));
if (Object.keys(body).some(key => !['owner', 'sessionId', 'pid', 'data'].includes(key)) || body.pid !== this.client?.pid
|| body.sessionId !== this.sdkSessionId || controlledDigest(body.owner) !== controlledDigest(this.owner)) throw engineError('桥请求的进程或任务归属不一致。', 403);
signal?.throwIfAborted(); this.verifyLaunch();
const data = body.data;
if (!data || typeof data !== 'object' || Array.isArray(data)) throw engineError('桥调用正文必须是对象。', 400);
if (request.url === '/tool') {
if (Object.keys(data).some(key => !['callId', 'name', 'arguments'].includes(key))
|| typeof data.callId !== 'string' || !data.callId || data.callId.length > 160 || !this.catalogueNames.has(data.name)
|| !data.arguments || typeof data.arguments !== 'object' || Array.isArray(data.arguments)) throw engineError('工具调用不符合原目录和参数契约。', 400);
if (this.callIds.has(data.callId)) throw engineError('原引擎工具调用ID已接收,不会重复执行。');
this.callIds.add(data.callId);
} else if (Object.keys(data).some(key => !['messages', 'system', 'tools', 'toolHistory', 'model', 'maxTokens'].includes(key))
|| data.model !== this.config.model || !Array.isArray(data.messages) || !Array.isArray(data.tools)
|| controlledDigest(controlledToolCatalogue(data.tools)) !== this.catalogueSha256
|| !Number.isSafeInteger(data.maxTokens) || data.maxTokens < 1 || data.maxTokens > this.config.maxOutputTokens) {
throw engineError('原引擎模型请求与封存的目录、模型或输出预算不一致。', 400);
}
const trace = { id: randomUUID(), route: request.url, requestSha256: controlledDigest(body), requestBytes: size, data: body.data, status: 'received', startedAt: at() };
if (this.report.bridgeRequests.length >= 1024) throw engineError('桥请求次数超过接收范围。');
this.report.bridgeRequests.push(trace);
const callback = request.url === '/model' ? onModel : onTool;
if (request.url === '/model') this.report.modelRequests++; else this.report.toolRequests++;
try {
const result = await callback(body.data, trace, signal);
trace.resultSha256 = controlledDigest(result); trace.status = 'completed'; trace.finishedAt = at();
if (this.closed || signal?.aborted) throw engineError('所属引擎已停止,迟到原结果只保留记录。');
response.writeHead(200, { 'Content-Type': 'application/json', Connection: 'close' }); response.end(JSON.stringify(result));
} catch (error) { trace.status = 'failed'; trace.error = error.message; trace.finishedAt = at(); throw error; }
}
async request(method, params = {}) {
this.signal?.throwIfAborted(); this.verifyLaunch();
const result = await this.client.request(method, params, { signal: this.signal,
...(method === 'session/wait' ? { timeoutMs: this.config.maxRunDurationMs ?? 600000 } : {}) });
this.report.responses.push({ method, params, result, trace: structuredClone(this.client.trace.at(-1)) }); return result;
}
async prompt(content) {
if (typeof content !== 'string' || !content || Buffer.byteLength(content) > this.maximumFrameBytes / 2) throw engineError('受控引擎任务输入超出范围。', 400);
const receipt = await this.request('session/prompt', { sessionId: this.sdkSessionId, contentBlocks: [{ type: 'text', text: content }] });
if (typeof receipt.messageId !== 'string' || !receipt.messageId) throw engineError('SDK没有返回原入队收据。');
this.report.receipt = receipt; return receipt;
}
async wait() {
const result = await this.request('session/wait', { sessionId: this.sdkSessionId });
if (!result || Array.isArray(result) || Object.keys(result).length) throw engineError('SDK等待结果不符合原协议。');
const events = this.report.notifications.filter(value => value.method === 'session.event').map(value => value.params.event);
const receipt = events.findIndex(event => event?.type === 'agent/inbox/spliced'
&& event.data?.inserted?.some(value => value.id === this.report.receipt?.messageId));
if (receipt < 0) throw engineError('未观察到所属prompt收据,不能采纳引擎输出。');
const activity = events.slice(receipt), assistant = activity.findLast(event => event?.type === 'assistant/message');
if (!assistant || !Array.isArray(assistant.data?.message?.content)) throw engineError('所属活动没有完整assistant原消息。');
const ends = activity.filter(event => event?.type === 'turn/end');
this.report.activity = { receiptIndex: receipt, endEvents: ends };
this.report.finalText = assistant.data.message.content.filter(block => block.type === 'text').map(block => block.text).join('');
return this.report.finalText;
}
async close({ force = false } = {}) {
if (this.closePromise) return this.closePromise;
const interrupted = force || this.parentSignal?.aborted === true;
this.closed = true;
this.bridgeController?.abort(new Error('所属引擎正在关闭。'));
return this.closePromise = (async () => {
let failure = null;
if (this.client) {
if (!interrupted && !this.client.exited) {
try { await this.client.request('shutdown', {}, { timeoutMs: 1000 }); } catch (error) { failure = error; }
}
try { this.report.cleanup = await this.client.close({ force: interrupted || !!failure }); } catch (error) { failure ??= error; }
this.report.trace = this.client.trace; this.report.stderr = this.client.stderr;
}
if (this.guard) { this.guard.closeAllConnections(); await new Promise(resolve => this.guard.close(resolve)); }
await Promise.allSettled([...this.pending]);
if (!interrupted && this.report.launchInputs) { try { this.verifyLaunch(); } catch (error) { failure ??= error; } }
if (!interrupted && this.report.cleanup?.exit?.code !== 0) failure ??= engineError('所属引擎未正常退出。');
this.report.finishedAt = at(); this.report.status = failure || !this.report.cleanup?.rootExited ? 'unknown' : interrupted ? 'cancelled' : 'closed';
if (failure) this.report.error = failure.message;
return this.report;
})();
}
}