Files
zeekay 7e26aa9653 feat(rag): finish the cutover — retrieval + vector cleanup on the one surface
The first pass moved ingestion; these are the paths that still read RAG_API_URL,
which the universe change removes. Left as-is they would have silently degraded:
file_search and the context handler would stop retrieving, and deleting an S3 object
would orphan its embeddings.

- file_search (api/app/clients/tools/util/fileSearch.js) queries through RagClient;
  `req` is threaded from handleTools (as `options.req`, the same value that file
  already passes to resolveTenantBearer for images) so retrieval runs on the user's
  own IAM bearer instead of a chat-minted short-lived token.
- createContextHandlers uses the client for both shapes (full context + top-k),
  normalised to { data } so its callers are untouched.
- deleting an S3 object now drops the file's chunks via the same client rather than
  the legacy deleteRagFile (which reads RAG_API_URL and would have no-op'd) —
  best-effort, so a retrieval-side failure never blocks the object delete.

Dead code removed with the paths they served: the axios import and createQueryBody
body-builder in fileSearch, the deleteRagFile import in S3 crud.

Tests 11/11 (7 client + 4 key convention; the S3 spec mocks the client). Lint clean
on every touched file — the one remaining handleTools prettier error is pre-existing
(3 on clean main, 1 after this).

packages/api/src/files/{text,rag}.ts and app/checks.ts still name RAG_API_URL; all
three already guard on it and degrade gracefully (native text parsing, no-op delete,
a startup log), so they are inert once the var is gone — they come out with the
package's own pass rather than being half-migrated here.
2026-07-26 14:13:26 -07:00
..