// Interactive verification entry: real built product with an isolated local-only profile. const { app } = require('electron') const fs = require('node:fs') const path = require('node:path') const { createHash } = require('node:crypto') const root = path.resolve(__dirname, '../../..') const profile = path.join(root, 'test-results/typing-load/profile') fs.mkdirSync(profile, { recursive: true }) app.setPath('userData', profile) app.setAppLogsPath(path.join(profile, 'logs')) app.setAppPath(path.join(root, 'apps/desktop')) process.env.NODE_ENV = 'test' // A test launch must never take ownership of the installed OAuth protocol handler. app.setAsDefaultProtocolClient = () => false app.setLoginItemSettings = () => { throw new Error('OS startup registration is disabled in the isolated verification runtime') } const configPath = path.join(profile, 'd3ro-voice-config.json') if (!fs.existsSync(configPath)) fs.writeFileSync(configPath, JSON.stringify({ appUsageMode: 'local', onboardingCompleted: true, autoLaunch: false, closeToTray: false, soundEnabled: false, inputTelemetryEnabled: false, inputLearnTypedText: false, suggestionEnabled: false, typoAutoCorrectEnabled: false, typoAutoCorrectUseModel: false, llmModelId: 'gemma4:e4b', ollamaServerUrl: 'http://127.0.0.1:11434', sttModelId: 'tiny', sttProviderConfigs: {local: {modelId: 'tiny'}}, localModelsDir: path.join(process.env.APPDATA, 'd3ro-voice/whisper-models') }, null, 2)) const productBundle = path.join(root, 'apps/desktop/out/main/index.js') const productPackage = JSON.parse(fs.readFileSync(path.join(root, 'apps/desktop/package.json'), 'utf8')) fs.writeFileSync(path.join(root, 'test-results/typing-load/runtime.json'), JSON.stringify({ pid: process.pid, startedAt: new Date().toISOString(), profile, productBundle, productPackageVersion: productPackage.version, productBundleSha256: createHash('sha256').update(fs.readFileSync(productBundle)).digest('hex'), isolation: 'local-only empty profile; protocol and OS startup registration disabled; real product bootstrap' }, null, 2)) require(productBundle)