import json
import sys

with open(r'C:\Users\decid\AppData\Local\spt\psyches\tracked\echo-input-1778837448.jsonl') as f:
    lines = f.readlines()
    print(f'Total lines: {len(lines)}')

    # Parse all entries to get summary
    for i, line in enumerate(lines, start=1):
        try:
            obj = json.loads(line)
            role = obj.get('message', {}).get('role')
            content_list = obj.get('message', {}).get('content', [])

            # Get text content
            text_content = [c for c in content_list if c.get('type') == 'text']
            if text_content:
                text = text_content[0]['text']
                preview = text[:150].replace('\n', ' ')
                print(f'{i:2d}. [{role}] {preview}...')
            else:
                types = [c.get('type') for c in content_list]
                print(f'{i:2d}. [{role}] types={types}')
        except Exception as e:
            print(f'{i:2d}. ERROR: {type(e).__name__}')
