import json
import pathlib
import sys

root = pathlib.Path(sys.argv[1])
fixture = root / 'apps/server/src/orchestration-v2/testkit/fixtures/multi_turn/registry_transcript.ndjson'
rows = [json.loads(line) for line in fixture.read_text().splitlines()]
paragraphs = '\n\n'.join(f'Example paragraph {i}: Select text to cite a useful part of this response.' for i in range(1, 15))
code = '\n'.join(f'const sample{i:02d} = "' + ('visible selected code text ' * 12) + '";' for i in range(1, 13))
text = 'first fixture turn complete\n\n' + paragraphs + '\n\n```ts\n' + code + '\n```\n\nEnd of the synthetic selection example.'
for row in rows:
    if row.get('label') == 'first.assistant':
        row['frame']['params']['update']['content']['text'] = text
fixture.write_text('\n'.join(json.dumps(row) for row in rows) + '\n')
