mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 00:40:42 +00:00
26 lines
717 B
TypeScript
26 lines
717 B
TypeScript
import type { callGateway as defaultCallGateway } from "../gateway/call.js";
|
|
import type { SpawnSubagentMode } from "./subagent-spawn.types.js";
|
|
|
|
type CallGateway = typeof defaultCallGateway;
|
|
|
|
export async function deleteSubagentSessionForCleanup(params: {
|
|
callGateway: CallGateway;
|
|
childSessionKey: string;
|
|
spawnMode?: SpawnSubagentMode;
|
|
onError?: (error: unknown) => void;
|
|
}): Promise<void> {
|
|
try {
|
|
await params.callGateway({
|
|
method: "sessions.delete",
|
|
params: {
|
|
key: params.childSessionKey,
|
|
deleteTranscript: true,
|
|
emitLifecycleHooks: params.spawnMode === "session",
|
|
},
|
|
timeoutMs: 10_000,
|
|
});
|
|
} catch (error) {
|
|
params.onError?.(error);
|
|
}
|
|
}
|