mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
a9907e2f10
TREK searches its own place index and OpenStreetMap. Neither carries a rating, so "the best rated hotel around here" has never been answerable, and an operator with a better index for their region had no way to reach the search box at all. The searchProvider hook is that way in: a plugin is handed the query, a limit, the language and the coordinate the search is biased toward, and answers with places in the same shape the core search returns, plus a rating. It sits beside the core search rather than inside it. The plugin runtime already imports PlacesModule, which imports MapsModule, so asking the providers from the maps service would close a module cycle — the same reason the other fourteen contribution controllers stand next to what they contribute to. The client asks both at once and merges, at the single point every caller already goes through, so all nine search surfaces get plugin hits without knowing the hook exists. A plugin index may never hold up the list: the client stops waiting at two and a half seconds and the host gives a provider two, which is also why the budget is the shortest of any hook here. With no such plugin installed the route answers without reaching the runtime at all. Every hit is normalized host-side and shared by the REST route and the MCP tool, so a cap that holds for the browser holds for the assistant: coordinates are range-checked, strings capped, the rating clamped to 0..5, a website must be http or https, and ids are namespaced so they can never collide with an OSM one. search_places_via_plugins is the MCP half, because what the user can see the assistant has to be able to see; search_place now points at it.
93 lines
2.6 KiB
TypeScript
93 lines
2.6 KiB
TypeScript
// GENERATED — do not edit by hand.
|
|
// Source: server/src/nest/plugins/protocol/envelope.ts + server/src/plugin-event-sink.ts
|
|
// Regenerate: node --import tsx server/scripts/gen-plugin-facts.ts
|
|
|
|
/** Widened on purpose so client callers can .includes() with a plain string. */
|
|
export const PLUGIN_PERMISSIONS: readonly string[] = [
|
|
'db:own',
|
|
'db:read:trips',
|
|
'db:read:users',
|
|
'db:read:costs',
|
|
'db:read:packing',
|
|
'db:write:packing',
|
|
'db:read:files',
|
|
'db:read:files:content',
|
|
'db:write:files',
|
|
'db:read:collab',
|
|
'db:write:collab',
|
|
'db:write:members',
|
|
'db:create:trips',
|
|
'db:read:journal',
|
|
'db:read:atlas',
|
|
'rates:read',
|
|
'db:read:vacay',
|
|
'db:read:daynotes',
|
|
'db:read:collections',
|
|
'db:write:collections',
|
|
'db:write:atlas',
|
|
'db:write:vacay',
|
|
'db:write:journal',
|
|
'db:read:categories',
|
|
'db:read:tags',
|
|
'db:write:tags',
|
|
'db:read:todos',
|
|
'db:write:todos',
|
|
'weather:read',
|
|
'db:write:daynotes',
|
|
'db:write:costs',
|
|
'db:write:places',
|
|
'db:write:days',
|
|
'db:write:itinerary',
|
|
'db:write:trips',
|
|
'db:write:reservations',
|
|
'db:write:accommodations',
|
|
'db:meta',
|
|
'ws:broadcast:trip',
|
|
'ws:broadcast:user',
|
|
'hook:photo-provider',
|
|
'hook:calendar-source',
|
|
'hook:place-detail-provider',
|
|
'hook:search-provider',
|
|
'hook:trip-warning-provider',
|
|
'hook:table-contributor',
|
|
'hook:map-marker-provider',
|
|
'hook:map-layer-provider',
|
|
'hook:route-provider',
|
|
'hook:day-schedule-provider',
|
|
'hook:day-tint-provider',
|
|
'hook:pdf-section-provider',
|
|
'hook:atlas-layer-provider',
|
|
'hook:journal-entry-provider',
|
|
'hook:trip-card-provider',
|
|
'hook:notification-channel',
|
|
'hook:user-data',
|
|
'events:subscribe',
|
|
'jobs:run',
|
|
'http:outbound',
|
|
'notify:send',
|
|
'ai:invoke',
|
|
'oauth:client',
|
|
'geolocation:read',
|
|
'mcp:tools',
|
|
];
|
|
|
|
export const PLUGIN_HOOK_PERMISSION: Readonly<Record<string, string>> = {
|
|
photoProvider: 'hook:photo-provider',
|
|
calendarSource: 'hook:calendar-source',
|
|
placeDetailProvider: 'hook:place-detail-provider',
|
|
searchProvider: 'hook:search-provider',
|
|
warningProvider: 'hook:trip-warning-provider',
|
|
tableContributor: 'hook:table-contributor',
|
|
mapMarkerProvider: 'hook:map-marker-provider',
|
|
mapLayerProvider: 'hook:map-layer-provider',
|
|
routeProvider: 'hook:route-provider',
|
|
dayScheduleProvider: 'hook:day-schedule-provider',
|
|
dayTintProvider: 'hook:day-tint-provider',
|
|
pdfSectionProvider: 'hook:pdf-section-provider',
|
|
atlasLayerProvider: 'hook:atlas-layer-provider',
|
|
journalEntryProvider: 'hook:journal-entry-provider',
|
|
tripCardProvider: 'hook:trip-card-provider',
|
|
notificationChannel: 'hook:notification-channel',
|
|
mcpToolProvider: 'mcp:tools',
|
|
};
|