@@ -33,6 +33,7 @@ import {
3333 PDF_PASSTHROUGH_MAX_BYTES,
3434} from './pdf-tools.js';
3535import * as trace from '../trace/recorder.js';
36+ import { normalizeRuntimeTraceConfig } from '../trace/runtime-config.js';
3637import { tracesToMarkdown } from './trace-export.js';
3738import { solveCaptcha, detectCaptcha, injectToken, captchaParamError, captchaTypesMatch, captchaWebsiteUrl } from './captcha-solver.js';
3839import { isCapsolverEnabled, normalizeCapsolverApiKey } from './capsolver-config.js';
@@ -823,6 +824,34 @@ export class Agent extends LoopDetector {
823824 return this.conversationIds.get(tabId) || null;
824825 }
825826
827+ _runtimeTraceConfig(provider, { tabId = null, mode = null } = {}) {
828+ let extensionVersion = '';
829+ let promptTier = 'full';
830+ try { extensionVersion = browser.runtime.getManifest().version || ''; } catch {}
831+ try { promptTier = provider?.promptTier || 'full'; } catch {}
832+ const effectiveMode = mode
833+ || (tabId != null ? this._effectiveRunMode(tabId) : 'ask');
834+ return normalizeRuntimeTraceConfig({
835+ extension_version: extensionVersion,
836+ browser_target: 'firefox',
837+ mode: effectiveMode,
838+ prompt_tier: promptTier,
839+ screenshot_redaction: this.screenshotRedaction === true,
840+ strict_secret_mode: this.strictSecretMode === true,
841+ plan_before_act_mode: this._normalizePlanBeforeActMode(this.planBeforeActMode),
842+ auto_screenshot: this.autoScreenshot,
843+ use_site_adapters: this.useSiteAdapters === true,
844+ web_mcp_enabled: this.webMcpEnabled === true,
845+ api_mutations_allowed: tabId != null && this.apiAllowedTabs.has(tabId),
846+ user_memory_enabled: this.userMemoryEnabled === true,
847+ selection_grounded: tabId != null && this.selectionGroundingScopes.has(tabId),
848+ image_detail: this.imageDetail,
849+ max_agent_steps: this.maxSteps,
850+ max_image_dimension: this.maxImageDimension,
851+ max_screenshots_per_turn: this.maxScreenshotsPerTurn,
852+ });
853+ }
854+
826855 _cloudGenerationOptions(provider, options = {}, { tabId = null, conversationId = null, generationName = 'main' } = {}) {
827856 if (String(provider?.config?.providerName || '').toLowerCase() !== 'webbrain-cloud') return options;
828857 const effectiveConversationId = conversationId || (tabId != null ? this.conversationIds.get(tabId) : null);
@@ -831,6 +860,7 @@ export class Agent extends LoopDetector {
831860 ...options,
832861 webbrainSessionId: String(effectiveConversationId),
833862 webbrainGenerationName: String(generationName || 'main'),
863+ webbrainRuntimeConfig: this._runtimeTraceConfig(provider, { tabId }),
834864 };
835865 }
836866
@@ -5693,6 +5723,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
56935723 providerId: provider?.name,
56945724 providerClass: provider?.constructor?.name,
56955725 webbrainVersion: browser.runtime.getManifest().version || '',
5726+ runtimeConfig: this._runtimeTraceConfig(provider, { tabId, mode }),
56965727 userMessage: typeof userMessage === 'string' ? userMessage : JSON.stringify(userMessage).slice(0, 2000),
56975728 tabUrl,
56985729 tabTitle,
@@ -11833,6 +11864,10 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
1183311864 mode: 'act',
1183411865 model: this.providerManager?.getActive?.()?.model || '',
1183511866 providerId: this.providerManager?.activeProviderId || '',
11867+ runtimeConfig: this._runtimeTraceConfig(this.providerManager?.getActive?.(), {
11868+ tabId,
11869+ mode: 'act',
11870+ }),
1183611871 });
1183711872 let traceStatus = 'workflow_stopped';
1183811873 let finalContent = '';
0 commit comments