build: update tsgo native preview

This commit is contained in:
Peter Steinberger
2026-04-23 15:59:43 +01:00
parent da3e9ded19
commit 7b6b7d53fc
4 changed files with 55 additions and 52 deletions

View File

@@ -46,7 +46,7 @@ export function applyLocalTsgoPolicy(args, env, hostResources) {
);
}
if (shouldThrottleLocalHeavyChecks(nextEnv, hostResources)) {
if (shouldThrottleLocalHeavyChecks(nextEnv, hostResources, "auto")) {
insertBeforeSeparator(nextArgs, "--singleThreaded");
insertBeforeSeparator(nextArgs, "--checkers", "1");
@@ -145,12 +145,12 @@ export function shouldAcquireLocalHeavyCheckLockForTsgo(args, env = process.env)
);
}
export function shouldThrottleLocalHeavyChecks(env, hostResources) {
export function shouldThrottleLocalHeavyChecks(env, hostResources, defaultMode = "throttled") {
if (!isLocalCheckEnabled(env)) {
return false;
}
const mode = readLocalCheckMode(env);
const mode = readLocalCheckMode(env, defaultMode);
if (mode === "throttled") {
return true;
}
@@ -298,7 +298,7 @@ function insertBeforeSeparator(args, ...items) {
args.splice(insertIndex, 0, ...items);
}
function readLocalCheckMode(env) {
function readLocalCheckMode(env, defaultMode) {
const raw = env.OPENCLAW_LOCAL_CHECK_MODE?.trim().toLowerCase();
if (raw === "throttled" || raw === "low-memory") {
return "throttled";
@@ -306,9 +306,7 @@ function readLocalCheckMode(env) {
if (raw === "full" || raw === "fast") {
return "full";
}
// Keep local heavy checks conservative by default. Developers can still opt
// into full-speed runs explicitly with OPENCLAW_LOCAL_CHECK_MODE=full.
return "throttled";
return defaultMode;
}
function resolveHostResources(hostResources) {