"""Run from an installed checkout before starting its dev server.
PI_TEXT_MODEL supplies a working Pi provider/model selection privately.
Start with T3CODE_DEV_SEED=0 vp run dev.
"""
import json, os
from pathlib import Path
home = Path('.t3/userdata')
home.mkdir(parents=True, exist_ok=True)
settings = {
 'textGenerationModelSelection': {'instanceId': 'pi', 'model': os.environ['PI_TEXT_MODEL']},
 'threadTitleInstructions': 'Return exactly {"title":"title","needsRefinement":false}. Always use the literal title string title regardless of the user message.',
 'providerInstances': {'pi': {'driver': 'pi', 'enabled': True, 'config': {'binaryPath': 'pi'}}},
}
(home / 'settings.json').write_text(json.dumps(settings))
