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:
Peter Steinberger
2026-08-11 23:26:37 -07:00
committed by GitHub
parent 66fe424590
commit b080dd1e76
276 changed files with 1685 additions and 1663 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ function parseExpectedStatus(raw) {
return Number(raw);
}
function resolveTimerTimeoutMs(valueMs, fallbackMs) {
function resolveOpenWebUiHttpProbeTimeoutMs(valueMs, fallbackMs) {
const value = Number.isFinite(valueMs) ? valueMs : fallbackMs;
return Math.min(Math.max(Math.floor(value), 1), MAX_TIMER_TIMEOUT_MS);
}
@@ -27,7 +27,7 @@ export async function probeHttpStatus({
throw new Error("usage: http-probe.mjs <url> [status|lt500]");
}
const expectedStatus = expectedRaw === "lt500" ? undefined : parseExpectedStatus(expectedRaw);
const resolvedTimeoutMs = resolveTimerTimeoutMs(timeoutMs, 30_000);
const resolvedTimeoutMs = resolveOpenWebUiHttpProbeTimeoutMs(timeoutMs, 30_000);
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), resolvedTimeoutMs);
let res;
@@ -50,17 +50,17 @@ function readPositiveNumberEnv(name, fallback) {
const MAX_TIMER_TIMEOUT_MS = 2_147_000_000;
function clampTimerTimeoutMs(valueMs) {
function clampPluginLifecycleTimerMs(valueMs) {
return Math.min(Math.max(Math.floor(valueMs), 1), MAX_TIMER_TIMEOUT_MS);
}
const pollMs = clampTimerTimeoutMs(
const pollMs = clampPluginLifecycleTimerMs(
readPositiveIntEnv("OPENCLAW_PLUGIN_LIFECYCLE_METRIC_POLL_MS", 100),
);
const timeoutMs = clampTimerTimeoutMs(
const timeoutMs = clampPluginLifecycleTimerMs(
readPositiveIntEnv("OPENCLAW_PLUGIN_LIFECYCLE_PHASE_TIMEOUT_MS", 300000),
);
const timeoutKillGraceMs = clampTimerTimeoutMs(
const timeoutKillGraceMs = clampPluginLifecycleTimerMs(
readPositiveIntEnv("OPENCLAW_PLUGIN_LIFECYCLE_TIMEOUT_KILL_GRACE_MS", 2000),
);
const maxRssKbThreshold = readPositiveIntEnv(