@@ -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';
@@ -837,6 +838,34 @@ export class Agent extends LoopDetector {
837838 return this.conversationIds.get(tabId) || null;
838839 }
839840
841+ _runtimeTraceConfig(provider, { tabId = null, mode = null } = {}) {
842+ let extensionVersion = '';
843+ let promptTier = 'full';
844+ try { extensionVersion = browser.runtime.getManifest().version || ''; } catch {}
845+ try { promptTier = provider?.promptTier || 'full'; } catch {}
846+ const effectiveMode = mode
847+ || (tabId != null ? this._effectiveRunMode(tabId) : 'ask');
848+ return normalizeRuntimeTraceConfig({
849+ extension_version: extensionVersion,
850+ browser_target: 'firefox',
851+ mode: effectiveMode,
852+ prompt_tier: promptTier,
853+ screenshot_redaction: this.screenshotRedaction === true,
854+ strict_secret_mode: this.strictSecretMode === true,
855+ plan_before_act_mode: this._normalizePlanBeforeActMode(this.planBeforeActMode),
856+ auto_screenshot: this.autoScreenshot,
857+ use_site_adapters: this.useSiteAdapters === true,
858+ web_mcp_enabled: this.webMcpEnabled === true,
859+ api_mutations_allowed: tabId != null && this.apiAllowedTabs.has(tabId),
860+ user_memory_enabled: this.userMemoryEnabled === true,
861+ selection_grounded: tabId != null && this.selectionGroundingScopes.has(tabId),
862+ image_detail: this.imageDetail,
863+ max_agent_steps: this.maxSteps,
864+ max_image_dimension: this.maxImageDimension,
865+ max_screenshots_per_turn: this.maxScreenshotsPerTurn,
866+ });
867+ }
868+
840869 _cloudGenerationOptions(provider, options = {}, { tabId = null, conversationId = null, generationName = 'main' } = {}) {
841870 if (String(provider?.config?.providerName || '').toLowerCase() !== 'webbrain-cloud') return options;
842871 const effectiveConversationId = conversationId || (tabId != null ? this.conversationIds.get(tabId) : null);
@@ -845,6 +874,7 @@ export class Agent extends LoopDetector {
845874 ...options,
846875 webbrainSessionId: String(effectiveConversationId),
847876 webbrainGenerationName: String(generationName || 'main'),
877+ webbrainRuntimeConfig: this._runtimeTraceConfig(provider, { tabId }),
848878 };
849879 }
850880
@@ -5707,6 +5737,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
57075737 providerId: provider?.name,
57085738 providerClass: provider?.constructor?.name,
57095739 webbrainVersion: browser.runtime.getManifest().version || '',
5740+ runtimeConfig: this._runtimeTraceConfig(provider, { tabId, mode }),
57105741 userMessage: typeof userMessage === 'string' ? userMessage : JSON.stringify(userMessage).slice(0, 2000),
57115742 tabUrl,
57125743 tabTitle,
@@ -12011,6 +12042,10 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
1201112042 mode: 'act',
1201212043 model: this.providerManager?.getActive?.()?.model || '',
1201312044 providerId: this.providerManager?.activeProviderId || '',
12045+ runtimeConfig: this._runtimeTraceConfig(this.providerManager?.getActive?.(), {
12046+ tabId,
12047+ mode: 'act',
12048+ }),
1201412049 });
1201512050 let traceStatus = 'workflow_stopped';
1201612051 let finalContent = '';
0 commit comments