Utility for determining approval flow and formatting/parsing approval requests.
// Source: https://github.com/clawflint/oh-my-openclaw | License: MIT | Copyright 2026 clawflint
// Provided via justclaw.it.com; keep this notice with the code.
export type ApprovalMode = 'required' | 'auto' | 'skip';
export interface ApprovalRequest {
stage: string;
nextStage: string;
summary: string;
cost: number;
}
export interface ApprovalDecision {
approved: boolean;
reason?: string;
}
export function shouldRequestApproval(mode: ApprovalMode, stage: string): boolean {
if (mode === 'skip') return false;
if (mode === 'auto') return false;
// 'required' — ask before build and review stages
return stage === 'build' || stage === 'review';
}
export function formatApprovalRequest(request: ApprovalRequest): string {
return [
`🔒 Approval Required: ${request.stage
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key