Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
Config export: resolve a pre-mode On profile's switches instead of using modern defaults
Claude6828f25ded4e
diff --git a/src/chrome/src/config-transfer.js b/src/chrome/src/config-transfer.jsindex e967de532..8e7f26332 100644--- a/src/chrome/src/config-transfer.js+++ b/src/chrome/src/config-transfer.js@@ -301,12 +301,13 @@ function normalizeSettings(source, { strict = false } = {}) {// switches to On with the omitted switches enabled, so they are materialized as on and a round// trip does not turn them into the old `false` defaults.const isLegacyOnProfile = !DECISION_MODES.includes(source?.decisionMode) && source?.systemOneEnabled === true;- if (!isLegacyOnProfile) {- for (const key of Object.values(DECISION_FEATURE_KEYS)) {- if (!Object.hasOwn(source, key)) {- settings[key] = true;- }- }+ // The legacy reading is resolved from the profile itself (completion verification, for one, is off+ // for an in-browser provider that never stored its switch), not taken from the modern defaults.+ const legacyFeatures = isLegacyOnProfile ? resolveDecisionConfig(source).features : null;+ for (const [feature, key] of Object.entries(DECISION_FEATURE_KEYS)) {+ if (Object.hasOwn(source, key)) continue;+ if (legacyFeatures) settings[key] = legacyFeatures[feature] === true;+ else settings[key] = true;}return settings;}diff --git a/src/firefox/src/config-transfer.js b/src/firefox/src/config-transfer.jsindex 46c2f169d..c4a0923ca 100644--- a/src/firefox/src/config-transfer.js+++ b/src/firefox/src/config-transfer.js@@ -325,12 +325,13 @@ function normalizeSettings(source, { strict = false } = {}) {// switches to On with the omitted switches enabled, so they are materialized as on and a round// trip does not turn them into the old `false` defaults.const isLegacyOnProfile = !DECISION_MODES.includes(source?.decisionMode) && source?.systemOneEnabled === true;- if (!isLegacyOnProfile) {- for (const key of Object.values(DECISION_FEATURE_KEYS)) {- if (!Object.hasOwn(source, key)) {- settings[key] = true;- }- }+ // The legacy reading is resolved from the profile itself (completion verification, for one, is off+ // for an in-browser provider that never stored its switch), not taken from the modern defaults.+ const legacyFeatures = isLegacyOnProfile ? resolveDecisionConfig(source).features : null;+ for (const [feature, key] of Object.entries(DECISION_FEATURE_KEYS)) {+ if (Object.hasOwn(source, key)) continue;+ if (legacyFeatures) settings[key] = legacyFeatures[feature] === true;+ else settings[key] = true;}return settings;}diff --git a/test/decision-mode.mjs b/test/decision-mode.mjsindex 701e940fd..fc29f9d9e 100644--- a/test/decision-mode.mjs+++ b/test/decision-mode.mjs@@ -302,3 +302,24 @@ for (const build of ['chrome', 'firefox']) {for (const key of keys.filter((k) => k !== 'systemOneDoneEnabled')) assert.equal(legacyOn[key], false, `pre-mode On: ${key} stays off`);});}++for (const build of ['chrome', 'firefox']) {+ test(`${build}: a pre-mode On profile exports its resolved completion default`, async () => {+ const transfer = await import(`../src/${build}/src/config-transfer.js`);+ const config = await import(`../src/${build}/src/agent/decision-config.js`);+ const roundTrip = (stored) => transfer.parseConfigImport(JSON.stringify(transfer.createConfigExport(stored))).settings;+ for (const stored of [+ { systemOneEnabled: true, decisionProvider: 'webgpu_chat' },+ { systemOneEnabled: true, decisionProvider: 'webgpu_d1' },+ { systemOneEnabled: true, decisionApiKey: 'sk-or-v1-test' },+ ]) {+ const before = config.resolveDecisionConfig(stored).features;+ const restored = roundTrip(stored);+ if (restored.decisionProvider !== stored.decisionProvider) continue; // Firefox drops the Chrome-only provider and goes Auto+ const after = config.resolveDecisionConfig(restored).features;+ for (const feature of ['done', 'watch', 'completion', 'classifications', 'browser']) {+ assert.equal(after[feature], before[feature], `${JSON.stringify(stored)}: ${feature} survives the round trip`);+ }+ }+ });+}