Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Preserve implicit On feature defaults in config exports and imports

Emre Sokullu0b9ab2d3ea4b
diff --git a/src/chrome/src/config-transfer.js b/src/chrome/src/config-transfer.js
index 83cadf1f2..8454edcdb 100644
--- a/src/chrome/src/config-transfer.js
+++ b/src/chrome/src/config-transfer.js
@@ -13,7 +13,7 @@ import {
import { AUTO_GROUP_TABS_KEY } from './tab-group-preference.js';
import { normalizeSettings as normalizeSafeSocialSettings, SETTINGS_KEY as SAFE_SOCIAL_SETTINGS_KEY } from './safesocial/config.js';
import { normalizeUiScale, UI_SCALE_STORAGE_KEY } from './ui/ui-scale.js';
-import { DECISION_MODES, resolveDecisionConfig } from './agent/decision-config.js';
+import { DECISION_FEATURE_KEYS, DECISION_MODES, resolveDecisionConfig } from './agent/decision-config.js';
export const CONFIG_SCHEMA = 'webbrain-config/1';
export const MAX_CONFIG_IMPORT_CHARS = 10_000_000;
@@ -296,6 +296,13 @@ function normalizeSettings(source, { strict = false } = {}) {
settings.decisionInputRate = source.decisionProvider === 'typesafe' || (!source.decisionProvider && source.typesafeApiKey)
? .042 : ['local', 'webgpu_d1', 'webgpu_chat'].includes(source.decisionProvider) ? 0 : .02;
}
+ if (source?.decisionMode === 'on') {
+ for (const key of Object.values(DECISION_FEATURE_KEYS)) {
+ if (!Object.hasOwn(source, key)) {
+ settings[key] = true;
+ }
+ }
+ }
return settings;
}
diff --git a/src/firefox/src/config-transfer.js b/src/firefox/src/config-transfer.js
index a599439bf..d79046cab 100644
--- a/src/firefox/src/config-transfer.js
+++ b/src/firefox/src/config-transfer.js
@@ -13,7 +13,7 @@ import {
import { AUTO_GROUP_TABS_KEY } from './tab-group-preference.js';
import { normalizeSettings as normalizeSafeSocialSettings, SETTINGS_KEY as SAFE_SOCIAL_SETTINGS_KEY } from './safesocial/config.js';
import { normalizeUiScale, UI_SCALE_STORAGE_KEY } from './ui/ui-scale.js';
-import { DECISION_MODES, resolveDecisionConfig } from './agent/decision-config.js';
+import { DECISION_FEATURE_KEYS, DECISION_MODES, resolveDecisionConfig } from './agent/decision-config.js';
export const CONFIG_SCHEMA = 'webbrain-config/1';
export const MAX_CONFIG_IMPORT_CHARS = 10_000_000;
@@ -312,6 +312,13 @@ function normalizeSettings(source, { strict = false } = {}) {
settings.decisionInputRate = decisionProvider === 'typesafe' || (!decisionProvider && source.typesafeApiKey)
? .042 : ['local', 'webgpu_d1'].includes(decisionProvider) ? 0 : .02;
}
+ if (source?.decisionMode === 'on') {
+ for (const key of Object.values(DECISION_FEATURE_KEYS)) {
+ if (!Object.hasOwn(source, key)) {
+ settings[key] = true;
+ }
+ }
+ }
return settings;
}
diff --git a/test/decision-mode.mjs b/test/decision-mode.mjs
index 06c23c787..75cf6d729 100644
--- a/test/decision-mode.mjs
+++ b/test/decision-mode.mjs
@@ -92,6 +92,32 @@ for (const build of ['chrome', 'firefox']) {
assert.equal(config.resolveDecisionMode(transfer.parseConfigImport(JSON.stringify({ schema: transfer.CONFIG_SCHEMA, settings: {} })).settings), 'auto');
});
+ test(`${build}: explicit On profile preserves implicit feature defaults across export and import`, () => {
+ const onSparse = { decisionMode: 'on', decisionProvider: 'local' };
+ const runtimeConfig = config.resolveDecisionConfig(onSparse);
+ assert.equal(config.decisionFeatureEnabled(runtimeConfig, 'watch'), true);
+ assert.equal(config.decisionFeatureEnabled(runtimeConfig, 'completion'), true);
+ assert.equal(config.decisionFeatureEnabled(runtimeConfig, 'classifications'), true);
+ assert.equal(config.decisionFeatureEnabled(runtimeConfig, 'browser'), true);
+
+ const exported = transfer.createConfigExport(onSparse);
+ assert.equal(exported.settings.systemOneWatchEnabled, true);
+ assert.equal(exported.settings.systemOneCompletionEnabled, true);
+ assert.equal(exported.settings.systemOneFastClassifications, true);
+ assert.equal(exported.settings.systemOneFastBrowser, true);
+
+ const imported = transfer.parseConfigImport(JSON.stringify(exported)).settings;
+ assert.equal(imported.systemOneWatchEnabled, true);
+ assert.equal(imported.systemOneCompletionEnabled, true);
+ assert.equal(imported.systemOneFastClassifications, true);
+ assert.equal(imported.systemOneFastBrowser, true);
+ const importedConfig = config.resolveDecisionConfig(imported);
+ assert.equal(config.decisionFeatureEnabled(importedConfig, 'watch'), true);
+ assert.equal(config.decisionFeatureEnabled(importedConfig, 'completion'), true);
+ assert.equal(config.decisionFeatureEnabled(importedConfig, 'classifications'), true);
+ assert.equal(config.decisionFeatureEnabled(importedConfig, 'browser'), true);
+ });
+
test(`${build}: scheduled checks follow the mode`, async () => {
let calls = 0;
const judge = { evaluate: async () => { calls++; return { model: 'judge', answers: { condition_met: { noul: .95 }, task_complete: { noul: .95 }, task_completeness: { score: 2 } } }; } };