refactor: return complete tool results inline

This commit is contained in:
morluto
2026-09-29 07:08:46 +08:00
parent 2160d4fae5
commit 0d96275b68
535 changed files with 4084 additions and 13537 deletions
+13 -2
View File
@@ -40,6 +40,7 @@ export interface HopperCleanupInput {
readonly processSupervisor: ProviderProcessSupervisor | undefined;
readonly runtimeRoot: PrivateRuntimeRoot | undefined;
readonly activeRequest: HopperRequestActivity | null;
readonly retainDocument: boolean;
readonly progress: ProgressReporter | undefined;
readonly logger: Logger;
readonly onDiagnostic: ((event: HopperDiagnostic) => void) | undefined;
@@ -59,7 +60,13 @@ export const cleanupHopperSession = async (
cleanupResult: undefined,
shutdownConfirmed: false,
};
await report(input.progress, 0, "requesting Hopper document shutdown");
await report(
input.progress,
0,
input.retainDocument
? "detaching REA from the Hopper document"
: "requesting Hopper document shutdown",
);
await requestShutdown(input, state);
await report(input.progress, 0.35, "releasing Hopper bridge transport");
input.releaseTransport(input.socket);
@@ -90,7 +97,11 @@ const requestShutdown = async (
return;
}
const shutdown = await input
.request("shutdown")
.request(
input.retainDocument || input.launch?.shutdownMode === "process-cleanup"
? "shutdown"
: "shutdown_document",
)
.catch(() => err(new HopperProcessError(null)));
if (
shutdown.ok &&