Skip to content

✨ feat(sources): return a conversation's messages from sources/get - #103

Merged
marcelsamyn merged 1 commit into
mainfrom
feat/source-conversation-read
Oct 7, 2026
Merged

marcelsamyn merged 1 commit into
mainfrom
feat/source-conversation-read

Conversation

@marcelsamyn

Copy link
Copy Markdown
Owner

What

POST /sources/get with includeContent: true now also returns a conversation field for sources that have conversation_message children (meeting transcripts and chats):

  • sourceKind: the host-supplied origin from the parent's metadata, such as google_meet.
  • messages: each child's sourceId, speaker, speakerNodeId, role, timestamp and text, in conversation order.

conversation is null when the source has no child messages. The source's own content is returned unchanged next to it.

Why

A transcript's parent source stores no body; each utterance is a child source. Clients that open the parent, such as the Petals source view, showed "No content captured" for every transcript.

Ordering

  • Transcripts are ordered by utterance index (${transcriptId}:<n>). Untimed utterances get the meeting start as a fallback timestamp, so timestamps cannot order them.
  • Chats are ordered by timestamp, then by insertion time.

The query reads only the needed metadata->> fields, not the full JSONB. Malformed provenance, such as a bad node id or an invalid timestamp, becomes null and does not fail the read.

Known limit

The response is unbounded. It returns every message, with no cap or pagination. This is fine for meeting-length transcripts. Very long chat histories would make one large payload.

How to test

docker compose up -d db
pnpm exec vitest run src/lib/source-conversation src/sources-get-route.test.ts

Status

  • Type check (tsc --noEmit): pass
  • ESLint (changed files): pass
  • Prettier: pass
  • Vitest: 13 tests pass, including a DB-backed test that checks live and soft-deleted children, ordering, and sourceKind
  • pnpm run build-sdk: pass

The Petals UI that uses this field is ready on a local branch. It needs a published SDK version before it can open as a PR.

🤖 Generated with Claude Code

Transcripts and chats keep their text on conversation_message children,
so the parent source read back as empty. With includeContent, sources/get
now also returns the child messages in conversation order, with speaker,
resolved speaker node, role, and time, plus the host-supplied origin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@marcelsamyn
marcelsamyn merged commit 67c1c2d into main Oct 7, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant