# Run in each app checkout before starting its isolated dev server.
# Replaces only the scratch Showcase replay recording, never production data.
import json,pathlib
cr='<details>\r<summary>Example</summary>\r~~~\r</details>\r~~~\r</details>\r\rAfter.'
rows=[]
for text in [cr,cr.replace('\r','\n')]:
 rows += [{'type':'expect_outbound','frame':{'kind':'request','method':'session/prompt','params':'<any>'}},{'type':'emit_inbound','frame':{'kind':'notification','method':'session/update','params':{'sessionId':'dev-replay-session','update':{'sessionUpdate':'agent_message_chunk','content':{'type':'text','text':text}}}}},{'type':'emit_inbound','frame':{'kind':'response','method':'session/prompt','result':{'stopReason':'end_turn'}}}]
pathlib.Path('apps/server/scripts/dev-replay/showcase_transcript.ndjson').write_text('\n'.join(map(json.dumps,rows))+'\n')
