Files
openclaw/src/gateway/server-methods/approval-wait-response.ts
T
Peter Steinberger 8853217ec7 fix(gateway): cancel run-bound approvals on abort and expose approval-park lifecycle (#110993)
* fix: harden approval abort lifecycle

* fix(gateway): recheck abort before committing detached exec authorization

* fix(gateway): recheck abort after inline exec authorization commit

* fix(gateway): propagate run-abort cancellation on the inline approval path

* fix(ci): refresh approval protocol bindings
2026-07-19 00:52:21 +01:00

23 lines
761 B
TypeScript

import type { ExecApprovalDecision } from "../../infra/exec-approvals.js";
import type { ExecApprovalRecord } from "../exec-approval-manager.js";
import type { OperatorApprovalTerminalReason } from "../operator-approval-store.js";
export type WaitReasonResolver<TPayload> = (
snapshot: ExecApprovalRecord<TPayload>,
) => OperatorApprovalTerminalReason | null | undefined;
export function buildWaitResponse<TPayload>(
id: string,
decision: ExecApprovalDecision | null,
snapshot: ExecApprovalRecord<TPayload>,
terminalReason?: OperatorApprovalTerminalReason | null,
) {
return {
id,
decision,
createdAtMs: snapshot.createdAtMs,
expiresAtMs: snapshot.expiresAtMs,
terminalReason: terminalReason ?? snapshot.terminalReason,
};
}