docs: document sources API parameter and focusMode deprecation (v1.12.1)#1043
docs: document sources API parameter and focusMode deprecation (v1.12.1)#1043willtwilson wants to merge 2 commits intoItzCrazyKns:masterfrom
Conversation
The v1.12.1 release replaced the focusMode parameter with sources in the API endpoints. This was an undocumented breaking change that caused silent failures in integrations. Add to docs/API/SEARCH.md: - Migration guide for focusMode -> sources with mapping table - Internal /api/chat endpoint documentation (request/response format) - NDJSON streaming response event types and JSON Patch format Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds missing migration and internal streaming endpoint documentation to help integrators understand the v1.12.1 breaking API change and the /api/chat NDJSON stream format.
Changes:
- Document
focusMode→sourcesmigration for v1.12.1+. - Add internal
/api/chatendpoint request body and streaming event documentation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
docs/API/SEARCH.md
Outdated
|
|
||
| | Type | Description | Fields | | ||
| |------|-------------|--------| | ||
| | `block` | New content block created | `block: { id, type }` | |
There was a problem hiding this comment.
For the /api/chat stream, block events include the full block object (e.g., { id, type, data: ... }), not just { id, type }. Documenting only id/type can mislead clients that need the block’s data payload (text chunks, widget params, research substeps, etc.). Please update the event schema description accordingly.
| | `block` | New content block created | `block: { id, type }` | | |
| | `block` | New content block created | `block` (full block object, e.g. `{ id, type, data, ... }`) | |
There was a problem hiding this comment.
Fixed in follow-up commit (77f0099) — updated the block event description to include the full block object shape including the data payload, which is the most important field for clients assembling streamed content. Thanks for the clarification.
docs/API/SEARCH.md
Outdated
| | `optimizationMode` | string | ✅ | `"speed"`, `"balanced"`, or `"quality"` | | ||
| | `history` | array | No | Previous conversation as `["human"/"assistant", "text"]` tuples | | ||
| | `files` | string[] | No | Uploaded file IDs to include in search context | | ||
| | `systemInstructions` | string | No | Custom instructions for the AI | |
There was a problem hiding this comment.
systemInstructions can be null in the /api/chat request body (the server schema accepts string | null). The docs currently list it as string only; please update the type/description so client implementations don’t fail strict validation when sending/receiving nulls.
| | `systemInstructions` | string | No | Custom instructions for the AI | | |
| | `systemInstructions` | string \| null | No | Custom instructions for the AI (may be `null` or omitted if not used) | |
There was a problem hiding this comment.
Fixed in follow-up commit (77f0099) — updated the type to string | null to match the server's Zod schema. Good catch.
docs/API/SEARCH.md
Outdated
| | `"focusMode": "webSearch"` | `"sources": ["web"]` | | ||
| | `"focusMode": "academicSearch"` | `"sources": ["academic"]` | | ||
|
|
||
| If you pass `focusMode` to v1.12.1+, it is silently ignored and no sources will be searched. Update your API calls to use `sources` instead. |
There was a problem hiding this comment.
The note that focusMode is “silently ignored” is not accurate for /api/search: the handler returns a 400 when sources is missing (Missing sources or query). This silent-ignore behavior seems specific to /api/chat (Zod strips unknown keys and defaults sources to []). Please adjust the migration text to distinguish between /api/search vs /api/chat behavior so integrators know what to expect.
| If you pass `focusMode` to v1.12.1+, it is silently ignored and no sources will be searched. Update your API calls to use `sources` instead. | |
| For v1.12.1+ you must migrate to `sources`. On `/api/chat`, any `focusMode` value is ignored (Zod strips the field and defaults `sources` to `[]`, so no sources are searched). On `/api/search`, `focusMode` is not accepted as a replacement for `sources`: if you omit `sources` (even when sending `focusMode`), the request will fail with a 400 error such as `Missing sources or query`. Update your API calls to always send `sources` instead of `focusMode`. |
There was a problem hiding this comment.
Good catch — this was genuinely wrong. Fixed in the follow-up commit (77f0099). The updated text now correctly distinguishes the two failure modes: on /api/chat, Zod strips focusMode and defaults sources to [] (silent, no web data returned); on /api/search, omitting sources returns HTTP 400 Missing sources or query. Thanks for reading the source code to verify — I had only tested via /api/chat.
…block event schema - Clarify that /api/chat returns HTTP 200 with no web data (sources defaults to []) while /api/search returns HTTP 400 when sources is missing - Update systemInstructions type to string | null per Zod schema - Include data field in block event documentation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Context
The v1.12.1 release replaced the \ocusMode\ parameter with \sources\ in the API endpoints. This is a breaking change with no migration documentation — existing integrations that pass \ocusMode\ get no error, but search does not work as expected because no sources are activated.
I discovered this while building an integration and had to read the source code to understand why web search had stopped working after upgrading.
Changes
Added to \docs/API/SEARCH.md:
Impact
This helps:
Summary by cubic
Documents the v1.12.1 change replacing
focusModewithsources, adds a migration guide, and updates internal/api/chatstreaming docs (NDJSON events, JSON Patch,block.data). Clarifies endpoint behavior:/api/chatreturns 200 with LLM-only output whensourcesis omitted, while/api/searchreturns 400; prefer/api/search."focusMode": "webSearch"with"sources": ["web"], and"academicSearch"with["academic"]./api/chatstripsfocusMode(defaultssourcesto[]);/api/searchrejects it. Update tosourcesand setsystemInstructionsasstring | null.Written for commit 77f0099. Summary will update on new commits.