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

Talk API: a person's sent files on each turn, and search inside turns #18009

opened this in answer to

Merged 10h 35m ago, live in production

Both parts of the Talk API are in: sent files on each person turn, and search inside turns. Both are covered by a new contract-tested test file, test/talk-search-files-api.test.ts. I ran that file and the API-contract, route-list and Talk tests that touch these routes, and they pass.

Notes

opened this

Both parts of the Talk API are in: sent files on each person turn, and search inside turns. Both are covered by a new contract-tested test file, test/talk-search-files-api.test.ts. I ran that file and the API-contract, route-list and Talk tests that touch these routes, and they pass. tsc is clean and the gate gave only two notes. I did not run the full suite because the forge runs it on the push. The final shapes for the issue comment are below.

What changed

  • GET /api/v1/conversation/turns: each person turn now carries files: [{id, name, type, size}], with [] when nothing was sent. These are the files attached to that turn, read in one query by the existing filesOfTurns. Agent turns are unchanged.
  • GET /api/v1/conversations/search?q=&limit=&cursor= is new:
    • It answers {items: [{conversation: {id, title}, turnId, snippet}], next_cursor}, best match first.
    • It runs on findConversations, the same search /talk?find= uses, and only looks at the caller's own conversations.
    • turnId is null when only the title matched.
    • q is 1 to 100 characters. limit is 1 to 200, default 50. A bad q, limit or cursor is a 422, and no token is a 401.
    • Reads need only a read token, not a session.
  • findConversations gained an optional max argument. The page keeps its 20-conversation cap. The API asks for up to 200 and pages through them with the shared offsetQuery and offsetPage.
  • openapi.json has the new route and the updated turns description. docs/features/talk.md documents both. lazy_lists.ts is regenerated for the new path.

What I chose not to do

  • No terminal change. The terminal already shows sent files and searches conversations, so the commit says No door: ….
  • No hit per turn. The search returns one hit per conversation, as the page does, so "search inside turns" means the best-matching turn of each conversation.
  • The gate notes that my test's user helper looks like makeUser in test/talk-build.test.ts; I kept it local.

Try it Call GET /api/v1/conversations/search?q=hello with a bearer token on this pull's preview. GET /api/v1/conversation/turns shows files on a turn that had an attachment.

🤖 Generated with Claude Code

Closes #18004

2 earlier comments
commented

Both parts of the Talk API are in: sent files on each person turn, and search inside turns. Both are covered by a new contract-tested test file, test/talk-search-files-api.test.ts. I ran that file and the API-contract, route-list and Talk tests that touch these routes, and they pass. tsc is clean and the gate gave only two notes. I did not run the full suite because the forge runs it on the push. The final shapes for the issue comment are below.

What changed

  • GET /api/v1/conversation/turns: each person turn now carries files: [{id, name, type, size}], with [] when nothing was sent. These are the files attached to that turn, read in one query by the existing filesOfTurns. Agent turns are unchanged.
  • GET /api/v1/conversations/search?q=&limit=&cursor= is new:
    • It answers {items: [{conversation: {id, title}, turnId, snippet}], next_cursor}, best match first.
    • It runs on findConversations, the same search /talk?find= uses, and only looks at the caller's own conversations.
    • turnId is null when only the title matched.
    • q is 1 to 100 characters. limit is 1 to 200, default 50. A bad q, limit or cursor is a 422, and no token is a 401.
    • Reads need only a read token, not a session.
  • findConversations gained an optional max argument. The page keeps its 20-conversation cap. The API asks for up to 200 and pages through them with the shared offsetQuery and offsetPage.
  • openapi.json has the new route and the updated turns description. docs/features/talk.md documents both. lazy_lists.ts is regenerated for the new path.

What I chose not to do

  • No terminal change. The terminal already shows sent files and searches conversations, so the commit says No door: ….
  • No hit per turn. The search returns one hit per conversation, as the page does, so "search inside turns" means the best-matching turn of each conversation.
  • The gate notes that my test's user helper looks like makeUser in test/talk-build.test.ts; I kept it local.

Try it Call GET /api/v1/conversations/search?q=hello with a bearer token on this pull's preview. GET /api/v1/conversation/turns shows files on a turn that had an attachment.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it. Type-check is clean and the Talk, contract and route-list tests pass, but I did not run the full suite, so the forge's check on this push is the full verdict.

Both conflicts were beside the same lines main had changed:

  • conversation_talk.ts: main added cards to agent turns. I kept that and my files on person turns.
  • getApiV1ConversationTurns.ts: main now describes the reply with a typed ConversationTurns schema. I kept its longer description and appended the sentence about files.

main's schema would not have listed files, so I added it to the turn schema in schemas/conversation.ts, marked optional because only person turns carry it. I regenerated the route index and the lazy route list.

The pull description from my earlier message still stands.

commented

This push fixes the two list-route failures from the check. GET /api/v1/conversations/search now checks limit and cursor before it checks q. A bad limit or cursor gets the same refusal as every other list route.

  • Before: with no q, the route answered invalid_query first, so test/list-limit-shape.test.ts never saw invalid_limit or invalid_cursor.
  • Cursor refusal: the cursor refusal also lacked field: "cursor". It now goes through cursorRefusal, like the other routes.
  • Cold /map: I didn't change anything for "a cold /map answers within a few passes over the runs". It passed in a local re-run of test/observability-budget.test.ts, and the failure looks timing-related under the check's load. If it fails again on the next check, it needs a real look.

Verification:

  • bun test passes for test/list-limit-shape.test.ts and the test/api-conversation*.test.ts files.
  • bun x tsc --noEmit is clean.
  • gate.ts --fix changed nothing. It noted one comment over 100 columns in src/core/conversations.ts, which I left because the nightly rewrap handles it on main. It also flagged mk in test/talk-search-files-api.test.ts as 0.82 similar to makeUser in test/talk-build.test.ts. I left that too.

I haven't re-run the full check; the forge runs it on this push.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs