perf: reduce idle desktop load by gating plan-mode checks

- Add startup feature flag for plan mode from OPENCODE_EXPERIMENTAL* env vars.
- Stop recurring app health polling and keep a one-time startup check.
- Skip plan-mode synthetic parsing and plan tab/file work when flag is off.
This commit is contained in:
Bohdan Triapitsyn
2026-04-03 13:59:10 +03:00
parent a36b11d54e
commit 5045d21821
7 changed files with 82 additions and 15 deletions
+13
View File
@@ -98,6 +98,18 @@ const OPENCHAMBER_VERSION = (() => {
}
return 'unknown';
})();
const isEnvFlagEnabled = (value) => {
if (value === true || value === 1) return true;
if (typeof value !== 'string') return false;
const normalized = value.trim().toLowerCase();
return normalized === '1' || normalized === 'true';
};
const PLAN_MODE_EXPERIMENT_ENABLED =
isEnvFlagEnabled(process.env.OPENCODE_EXPERIMENTAL_PLAN_MODE)
|| isEnvFlagEnabled(process.env.OPENCODE_EXPERIMENTAL);
const fsPromises = fs.promises;
const settingsNormalizationRuntime = createSettingsNormalizationRuntime({
@@ -850,6 +862,7 @@ async function main(options = {}) {
opencodeWslDistro: resolvedWslDistro || null,
nodeBinaryResolved: resolvedNodeBinary || null,
bunBinaryResolved: resolvedBunBinary || null,
planModeExperimentalEnabled: PLAN_MODE_EXPERIMENT_ENABLED,
}),
uiPassword,
tunnelAuthController,