# Usage: python3 native-summary.py <native-conversation.db> <side>
# Reads the real runtime's SQLite transcript without exposing prompts, paths or credentials.
import sqlite3,json,sys
c=sqlite3.connect('file:'+sys.argv[1]+'?mode=ro',uri=True)
rows=[]
for i,t,b in c.execute('select idx,step_type,step_payload from steps'):
 v=bytes(b or b'')
 rows.append({'index':i,'type':t,'automaticContinue':t==14 and b'\x12\x08continue\x1a' in v,'notFound':t==17 and b'NOT_FOUND' in v,'finished':t==15 and b'FOREGROUND_SEQUENCE_FINISHED' in v})
print(json.dumps({'side':sys.argv[2],'steps':rows,'automaticContinueCount':sum(r['automaticContinue'] for r in rows)},indent=2))
