Backend
Trip operations registry
Trip operations registry
Single source of truth for trip-scoped editor mutations shared by:
- HTTP request validation (
apps/api/src/interfaces/http/app.ts) - Agent write tools + AI SDK
toolApproval(agent-model.ai-sdk.ts) - Proactive
pendingPatchschema (generateObject) - Apply path after human approval (
applyTripOp)
Location
apps/api/src/application/trip/ops/
schemas.ts # shared Zod
catalog.ts # TRIP_OPS registry
apply.ts # applyTripOp
index.ts # public exportsDomain aggregate methods stay in domain/trip/trip.ts. The registry only
orchestrates those methods + TripRepository persistence. It does not
import the Vercel AI SDK (tool() lives in infrastructure).
How to add a new trip CRUD op
- Domain — Add or extend a
Tripmethod (+ repository method if needed). - Registry — Append one entry to
TRIP_OPSincatalog.ts:kind(snake_case, stored inagent_suggestions.patch)toolName(camelCase for the model)description,inputSchema,patchSchematoPatch,applyneedsApproval: true,allowProactiveas appropriate
- Schemas — Add Zod in
schemas.tsif not already shared with HTTP. - HTTP — Wire a route that parses the shared schema (if user-facing).
- Do not edit hand-written tool lists in
agent-model.ai-sdk.ts— tools and approval maps are generated fromlistWriteOps().
Not in this registry
checkWeather(read-only agent tool)- Invites, votes, stop comments
- Ops the product domain does not support yet (e.g. delete stop / expense)
Approval
All write ops use AI SDK toolApproval: 'user-approval' (viewers denied).
See agent.md and ../decisions/0005-trip-agent.md.