feat: [AI-6949] add session transcript REST endpoint for datamates extension
Merged
AL
5mo ago+223+223+012345678901234567890123456789-0-0-0123456789
Summary
- Adds
GET /session/:sessionID/transcriptREST endpoint toaltimate-codeserver - Returns the session conversation as a formatted markdown transcript (
text/plain; charset=utf-8) - Reuses
formatTranscriptfromcli/cmd/tui/util/transcript.ts(same function powering the TUI/exportcommand) - Supports optional query params:
thinking(bool),toolDetails(bool),assistantMetadata(bool) — all defaultfalse
Endpoint
GET /session/:sessionID/transcript[?thinking=true&toolDetails=true&assistantMetadata=true]
Response: text/plain; charset=utf-8 — markdown string starting with # <session title>
Example response:
# My session title
**Session ID:** ses_xxx
**Created:** 6/15/2026, 7:04:58 AM
**Updated:** 6/15/2026, 7:04:58 AM
---
Test plan
- Created session via
POST /session, calledGET /session/:id/transcript - Response is
200 OK,Content-Type: text/plain; charset=UTF-8 - Body starts with
#(markdown session title) - Query params (
thinking,toolDetails,assistantMetadata) accepted without error - Verify with a session that has messages (tool calls, reasoning) to confirm option flags work
Files changed
packages/opencode/src/server/routes/session.ts— added import + route handler
Requested by @saravmajestic via harness
Summary by cubic
Adds a new REST endpoint to export a session’s conversation as a markdown transcript for easy sharing and offline viewing. Implements Linear AI-6949.
-
New Features
- Adds GET /session/:sessionID/transcript returning markdown (
text/plain; charset=utf-8); reusesformatTranscriptto match the TUI/export; supportsthinking,toolDetails, andassistantMetadataflags (defaultfalse); includes tests for 200/404, empty sessions, and flag behavior.
- Adds GET /session/:sessionID/transcript returning markdown (
-
Bug Fixes
- Fixes boolean parsing for query flags using
z.preprocessso?thinking=falseis respected; aligns import to@/cli/...; strengthens tests to assert reasoning is included/excluded.
- Fixes boolean parsing for query flags using