mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor: consolidate coercion contracts (#122458)
* refactor: consolidate coercion contracts Centralize exact string, record, numeric, date, Boolean, argument, and structured-error coercions while preserving call-site semantics. Migrate canonical-name collisions and deprecated internal SDK bypasses, deleting 55 net production/tooling lines. Expand declaration ownership enforcement to 101 allowed helpers and add a narrow export-completeness audit. * fix: preserve standalone script coercions Keep copied Control UI tooling self-contained and retain the trusted release harness module-relative source seam when the harness runs against an old target cwd.
This commit is contained in:
committed by
GitHub
parent
66fe424590
commit
b080dd1e76
@@ -5,6 +5,7 @@ import { randomUUID } from "node:crypto";
|
||||
import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { runExec } from "openclaw/plugin-sdk/process-runtime";
|
||||
import { asFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
|
||||
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
||||
|
||||
type LogbookSnapshotParams = {
|
||||
@@ -22,11 +23,11 @@ function readParams(value: unknown): LogbookSnapshotParams {
|
||||
return {};
|
||||
}
|
||||
const record = value as Record<string, unknown>;
|
||||
const num = (key: string) => {
|
||||
const candidate = record[key];
|
||||
return typeof candidate === "number" && Number.isFinite(candidate) ? candidate : undefined;
|
||||
return {
|
||||
screenIndex: asFiniteNumber(record.screenIndex),
|
||||
maxWidth: asFiniteNumber(record.maxWidth),
|
||||
quality: asFiniteNumber(record.quality),
|
||||
};
|
||||
return { screenIndex: num("screenIndex"), maxWidth: num("maxWidth"), quality: num("quality") };
|
||||
}
|
||||
|
||||
export async function handleLogbookSnapshot(rawParams: unknown): Promise<LogbookSnapshotPayload> {
|
||||
|
||||
Reference in New Issue
Block a user