Public: anyone can read this; the crew can change it.

Talk API: an agent turn's cards as data, with exact values #18008

opened this in answer to

Merged 11h 10m ago, live in production

Each agent turn from GET /api/v1/conversation/turns now carries cards, which is the results its text places with ::show cN, as typed data a native client can draw itself. A bearer token of either scope reads them. Shape of each card Every card has { ref, kind, title, source, tool, at }.

Notes

opened this

Each agent turn from GET /api/v1/conversation/turns now carries cards, which is the results its text places with ::show cN, as typed data a native client can draw itself. A bearer token of either scope reads them.

Shape of each card

  • Every card has { ref, kind, title, source, tool, at }.
    • ref is the cN of the ::show cN line.
    • source is the call in plain words.
    • tool is the tool that drew it, and at is the ISO time it was kept.
  • A chart's kind is line, bar or area. It adds series: [{ label, unit?, tone?, points: [{ t?, v }] }], and levels: true when each value is a level, so a client reads the last one, not the sum.
  • Any other kind (rows, a receipt) adds status and rows: [{ label, value, link?, depth? }], and has no series.
  • Cards come in the order the text first places them, each once. A handle that names no kept result is left out, and a failed turn carries cards: [].

One source for the values The series are copied from the same kept chart data that the page's SVG and the terminal's block-character lines (widgetLines) are built from, never read back from a drawing. A test checks the exact values, including 3.25 and 0.001.

Contract

  • The route's reply is now typed in full as ConversationTurns, with ConversationTurn, TurnCard, TurnCardSeries, TurnCardPoint and TurnCardField beside it. Every key a turn already carried (work, costUsd, plain, failed and so on) is named too, because the schema test refuses unnamed ones.
  • The new code is src/core/talk_cards.ts, wired in at src/http/api/conversation_talk.ts.
  • I reused cardsPlaced and voiceParts/shownIn, so nothing new parses a reply.
  • I added a num helper to schema_kit.ts.

What I left out

  • I added no terminal change. The terminal already prints these same kept results through plainVoice, so the commit says No door: …. The CLI's type for the turns call now lists cards.
  • I added no per-point timestamps beyond the chart's own x label (t). Widgets have only labels such as a day, an hour or a name.

Checks

  • tsc is clean and gate.ts passes.
  • test/widgets.test.ts and test/openapi-schemas.test.ts pass, along with the contract, conversation-talk, hollow and unused-exports tests.
  • I did not run the rest of the suite; the forge's check runs it.
  • The how-to is in docs/features/talk-voice.md.

To try it Have a conversation whose agent places a ::show result, then call GET /api/v1/conversation/turns with any token and read turns[].cards. /api/v1/openapi.json has the schemas.

After merge When this merges, I'll comment on #18005 with each route's final shape.

Closes #18005

commented

Each agent turn from GET /api/v1/conversation/turns now carries cards, which is the results its text places with ::show cN, as typed data a native client can draw itself. A bearer token of either scope reads them.

Shape of each card

  • Every card has { ref, kind, title, source, tool, at }.
    • ref is the cN of the ::show cN line.
    • source is the call in plain words.
    • tool is the tool that drew it, and at is the ISO time it was kept.
  • A chart's kind is line, bar or area. It adds series: [{ label, unit?, tone?, points: [{ t?, v }] }], and levels: true when each value is a level, so a client reads the last one, not the sum.
  • Any other kind (rows, a receipt) adds status and rows: [{ label, value, link?, depth? }], and has no series.
  • Cards come in the order the text first places them, each once. A handle that names no kept result is left out, and a failed turn carries cards: [].

One source for the values The series are copied from the same kept chart data that the page's SVG and the terminal's block-character lines (widgetLines) are built from, never read back from a drawing. A test checks the exact values, including 3.25 and 0.001.

Contract

  • The route's reply is now typed in full as ConversationTurns, with ConversationTurn, TurnCard, TurnCardSeries, TurnCardPoint and TurnCardField beside it. Every key a turn already carried (work, costUsd, plain, failed and so on) is named too, because the schema test refuses unnamed ones.
  • The new code is src/core/talk_cards.ts, wired in at src/http/api/conversation_talk.ts.
  • I reused cardsPlaced and voiceParts/shownIn, so nothing new parses a reply.
  • I added a num helper to schema_kit.ts.

What I left out

  • I added no terminal change. The terminal already prints these same kept results through plainVoice, so the commit says No door: …. The CLI's type for the turns call now lists cards.
  • I added no per-point timestamps beyond the chart's own x label (t). Widgets have only labels such as a day, an hour or a name.

Checks

  • tsc is clean and gate.ts passes.
  • test/widgets.test.ts and test/openapi-schemas.test.ts pass, along with the contract, conversation-talk, hollow and unused-exports tests.
  • I did not run the rest of the suite; the forge's check runs it.
  • The how-to is in docs/features/talk-voice.md.

To try it Have a conversation whose agent places a ::show result, then call GET /api/v1/conversation/turns with any token and read turns[].cards. /api/v1/openapi.json has the schemas.

After merge When this merges, I'll comment on #18005 with each route's final shape.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs