A booking file without a booking ended the answer on the error "No booking found in this file." with no action, and the user was left to type. Now the server answers every booking file itself, without a model: one line that names the file and what TREK found in it, or that it found nothing, why, and asks what to do with the file. Under it come up to three chips, picked from what the user may do on the trip and what the file allows: keep it in Files, make a booking from its text, attach it to a booking or an expense, ask what is in it, or keep it with the booking just found. A chip sends its words as an ordinary chat message. The line and the chips are written in the language of the request from new assistant.attach.* keys in all 27 locales, through a small helper the sports proposals now share. The empty answer finishes as stop; no_bookings_found stays in the contract for the threads older builds wrote. Route files keep their answer as it was.
@trek/shared
Single source of truth for TREK's API contracts, expressed as Zod schemas and consumed by both the server (request validation + inferred DTO types) and the client (typed requests/responses).
This package is part of the incremental NestJS + React 19 migration (see the "Brownfield Rewrite" board). It is intentionally dormant until modules start importing it — adding it changes nothing for users.
Rules
- One folder per domain:
src/<domain>/<domain>.schema.ts(+.spec.ts). - Domain-agnostic building blocks live in
src/common/. - A route is only considered migrated once its contract lives here.
- Schemas are the source of truth; server DTOs and client types are inferred from them
(
z.infer<typeof schema>), never hand-duplicated.
Consumption (dev)
Both apps resolve @trek/shared to this package's TypeScript source:
- Server (
tsx): viapathsinserver/tsconfig.json. - Client (
vite): viaresolve.aliasinclient/vite.config.ts(+pathsfor the type-checker).
Production packaging (Docker / workspace wiring) is introduced in card F2, when the server first depends on this package at runtime. Until then prod builds are untouched.
Not yet here
The canonical error envelope is finalised in card F5 (it must match TREK's current Express error responses byte-for-byte), so it is deliberately not invented in F1.