mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 03:40:42 +00:00
25 lines
710 B
TypeScript
25 lines
710 B
TypeScript
import { readConfigFileSnapshot } from "../config/config.js";
|
|
import {
|
|
formatFutureConfigActionBlock,
|
|
resolveFutureConfigActionBlock,
|
|
type FutureConfigActionBlock,
|
|
} from "../config/future-version-guard.js";
|
|
|
|
async function readFutureConfigActionBlock(
|
|
action: string,
|
|
): Promise<FutureConfigActionBlock | null> {
|
|
try {
|
|
const snapshot = await readConfigFileSnapshot();
|
|
return resolveFutureConfigActionBlock({ action, snapshot });
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export async function assertFutureConfigActionAllowed(action: string): Promise<void> {
|
|
const block = await readFutureConfigActionBlock(action);
|
|
if (block) {
|
|
throw new Error(formatFutureConfigActionBlock(block));
|
|
}
|
|
}
|