"""From a current-main checkout, run this script before scenarios:prove.
Keep the sibling executable `hermes` beside this file. The script changes only
scenario startup settings; it does not change the app or provider adapter.
"""
from pathlib import Path
import json

path = Path('scripts/scenarios/start-app.ts')
source = path.read_text()
command = json.dumps(str(Path(__file__).resolve().parent / 'hermes'))
source = source.replace('defaultModelSelection: REPLAY,', 'defaultModelSelection: { instanceId: "hermes-proof", model: "default" },')
source = source.replace('REAL_PROVIDERS.map((driver) => [', '[["hermes-proof", { driver: "acpRegistry", displayName: "Hermes Agent", enabled: true, config: { source: "local", commandPath: ' + command + ', commandArgs: ["acp"] } }], ...REAL_PROVIDERS.map((driver) => [')
source = source.replace('        ]),\n      ),', '        ])],\n      ),')
path.write_text(source)
