Files
TREK/server/src/addons.ts
T
Maurice b64da26651 feat(assistant): trip assistant chat with your own AI connection
Adds an in-app assistant that reads and plans the open trip. Users connect
their own provider (Sign in with ChatGPT, or an Anthropic, OpenAI, Gemini or
OpenRouter key) or use the one the admin set up, including a custom
OpenAI-compatible server. It is an addon and only shows while a connection
is usable.

The chat runs on the existing MCP tools, pinned to the trip. Every change is
held as a change card the user applies or discards, and applied changes can
be undone. On the desktop it is a floating window that can be moved and
resized; on the phone it is fullscreen. Search results show as place cards
that can go onto a day, weather lookups as a strip, proposed places as
ghost markers on the map with a before/after switch, and an answer can be
shared into the trip chat. Booking files can be dropped in and are read
into change cards.
2026-10-22 21:30:12 +00:00

54 lines
1.6 KiB
TypeScript

export const ADDON_IDS = {
MCP: 'mcp',
PACKING: 'packing',
BUDGET: 'budget',
DOCUMENTS: 'documents',
VACAY: 'vacay',
ATLAS: 'atlas',
COLLAB: 'collab',
JOURNEY: 'journey',
AIRTRAIL: 'airtrail',
DAWARICH: 'dawarich',
LLM_PARSING: 'llm_parsing',
COLLECTIONS: 'collections',
ROADTRIP: 'roadtrip',
TOURS: 'tours',
AI_ASSISTANT: 'ai_assistant',
} as const;
export type AddonId = (typeof ADDON_IDS)[keyof typeof ADDON_IDS];
/**
* The addons that gate an MCP surface, which is what decides whether switching
* one off has to tear down the live sessions.
*
* A `when:` gate is evaluated once per session, at attach time. A client that
* connected while an addon was on therefore keeps its tools registered and
* callable after an admin switches it off — the gate never re-runs — while the
* REST half answers 404 for the same user in the same moment. Only tearing the
* sessions down closes that.
*
* Stated here rather than collected at import time, so nothing depends on which
* modules a caller happens to have loaded, and guarded by a parity test that
* reads the gates out of the source: as a hand-kept list this had already
* drifted, and airtrail and collections were missing from it.
*
* MCP itself is on the list for a different reason — it gates the whole surface
* rather than any single tool.
*/
export const MCP_GATED_ADDON_IDS: readonly AddonId[] = [
ADDON_IDS.MCP,
ADDON_IDS.AIRTRAIL,
ADDON_IDS.ATLAS,
ADDON_IDS.BUDGET,
ADDON_IDS.COLLAB,
ADDON_IDS.COLLECTIONS,
ADDON_IDS.DAWARICH,
ADDON_IDS.DOCUMENTS,
ADDON_IDS.JOURNEY,
ADDON_IDS.PACKING,
ADDON_IDS.ROADTRIP,
ADDON_IDS.TOURS,
ADDON_IDS.VACAY,
];