diff --git a/electron/utils/openclaw-auth.ts b/electron/utils/openclaw-auth.ts index 107d42fd3..34ebbe43b 100644 --- a/electron/utils/openclaw-auth.ts +++ b/electron/utils/openclaw-auth.ts @@ -977,6 +977,30 @@ export async function sanitizeOpenClawConfig(): Promise { } } + // ── tools.profile & sessions.visibility ─────────────────────── + // OpenClaw 3.8+ requires tools.profile = 'full' and tools.sessions.visibility = 'all' + // for ClawX to properly integrate with its updated tool system. + const toolsConfig = (config.tools as Record | undefined) || {}; + let toolsModified = false; + + if (toolsConfig.profile !== 'full') { + toolsConfig.profile = 'full'; + toolsModified = true; + } + + const sessions = (toolsConfig.sessions as Record | undefined) || {}; + if (sessions.visibility !== 'all') { + sessions.visibility = 'all'; + toolsConfig.sessions = sessions; + toolsModified = true; + } + + if (toolsModified) { + config.tools = toolsConfig; + modified = true; + console.log('[sanitize] Enforced tools.profile="full" and tools.sessions.visibility="all" for OpenClaw 3.8+'); + } + if (modified) { await writeOpenClawJson(config); console.log('[sanitize] openclaw.json sanitized successfully');