@tomtom-org/maps-sdk-plugin-agent-toolkit 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -556,3 +556,7 @@ For the complete, always-current list of exports — factories, tool-registry he
556
556
  - [AI SDK v6 documentation](https://ai-sdk.dev/)
557
557
  - [TomTom Maps SDK documentation](https://docs.tomtom.com/maps-sdk-js)
558
558
  - [Example application](../../examples/map-traffic-agent-react) — full chat interface implementation
559
+
560
+ ## License
561
+
562
+ See `LICENSE.txt`.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BaseMapModule, CustomGeoJSONLayerSpec, CustomGeoJSONModule, GeometriesModule, GeometryFillStyle, POIsModule, PlaceConnectionDisplay, PlacesModule, PlanningWaypoint, RoutingModule, StylingModule, TomTomMap, TrafficAreaAnalyticsModule, TrafficAreaAnalyticsModuleConfig, TrafficFlowModule, TrafficIncidentOverlayModule, TrafficIncidentsModule } from "@tomtom-org/maps-sdk/map";
2
- import { BBox, CommonPlaceProps, GeographyType, POICategory, Place, Places, PolygonFeature, PolygonFeatures, Route, Routes, TrafficAreaAnalytics, TrafficIncident, WaypointLike } from "@tomtom-org/maps-sdk/core";
2
+ import { BBox, CommonPlaceProps, GeographyType, Place, Places, PolygonFeature, PolygonFeatures, Route, Routes, TrafficAreaAnalytics, TrafficIncident, WaypointLike } from "@tomtom-org/maps-sdk/core";
3
3
  import { ChartConfiguration } from "chart.js";
4
4
  import { Map as Map$1 } from "maplibre-gl";
5
5
  import { z } from "zod";
@@ -1141,7 +1141,7 @@ type PlacesAnalysis = EntryAnalysis;
1141
1141
  //#region src/state/places/state.d.ts
1142
1142
  /**
1143
1143
  * The marker looks an entry can be rendered with: individual pins, base-map POIs, or clustered
1144
- * pins. A type-checked subset of the SDK's {@link PlacesTheme} — `circle-icon` is not offered to
1144
+ * pins. A type-checked subset of the SDK's `PlacesMarkerType` — `circle-icon` is not offered to
1145
1145
  * the agent. Every tool enum for marker types derives from this array rather than repeating it.
1146
1146
  */
1147
1147
  declare const placesMarkerTypes: readonly ["pin", "base-map", "pin-clustered"];
@@ -1177,10 +1177,10 @@ type PlacesStateEvents = {
1177
1177
  * State for the places layer: an append-only history of place results plus per-entry display
1178
1178
  * modules.
1179
1179
  *
1180
- * Each entry owns a single PlacesModule (rethemed in-place via `applyTheme` when the marker
1181
- * type changes — an entry only renders under one theme at a time) and a dedicated
1180
+ * Each entry owns a single PlacesModule (switched in place via `applyMarkerType` when the marker
1181
+ * type changes — an entry only renders under one marker type at a time) and a dedicated
1182
1182
  * GeometriesModule, lazy-initialised on first show. Display state lives on the entry, so two
1183
- * entries can be rendered side by side under different themes without sharing a single source.
1183
+ * entries can be rendered side by side under different marker types without sharing a single source.
1184
1184
  *
1185
1185
  * @group Agent Toolkit
1186
1186
  */
@@ -1204,9 +1204,9 @@ declare class PlacesState implements StateSlice {
1204
1204
  */
1205
1205
  setEntryMode(mode: EntryMode): Promise<void>;
1206
1206
  /**
1207
- * Lazy-init and return the entry's PlacesModule, rethemed to `markerType`. An entry only
1208
- * ever renders under one theme at a time, so the same module is reused — flipping themes
1209
- * calls `applyTheme` in place. Throws when the entry id is unknown.
1207
+ * Lazy-init and return the entry's PlacesModule, switched to `markerType`. An entry only
1208
+ * ever renders under one marker type at a time, so the same module is reused — flipping marker
1209
+ * types calls `applyMarkerType` in place. Throws when the entry id is unknown.
1210
1210
  */
1211
1211
  getEntryPlacesModule(entryId: string, markerType: PlacesMarkerType): Promise<PlacesModule>;
1212
1212
  /**
@@ -1283,8 +1283,8 @@ declare class PlacesState implements StateSlice {
1283
1283
  setShownEntries(ids: readonly string[], markerType: PlacesMarkerType): Promise<Place[]>;
1284
1284
  /**
1285
1285
  * Add ids to the shown set under `markerType`. Any id previously shown as
1286
- * a different marker type is moved (its previous module is cleared, the
1287
- * new theme's module renders).
1286
+ * a different marker type is moved (its module switches to the new
1287
+ * marker type).
1288
1288
  *
1289
1289
  * Under `entryMode === 'single'` everything else is hidden first, so the
1290
1290
  * effective behaviour collapses to "show exactly the last id in the list".
@@ -1301,7 +1301,7 @@ declare class PlacesState implements StateSlice {
1301
1301
  clearShown(): Promise<void>;
1302
1302
  clearShownGeometries(ids?: readonly string[]): Promise<void>;
1303
1303
  /**
1304
- * Drop a single entry from history. Hides it from the map first (clears every theme module
1304
+ * Drop a single entry from history. Hides it from the map first (clears every module
1305
1305
  * it owns) then removes it from `_entries`. Emits `entries-change` and, when the entry was
1306
1306
  * shown, `shown-change`. No-op when the id is unknown.
1307
1307
  */
@@ -1334,8 +1334,8 @@ type PlacesEntry = BaseEntry<Place[]> & {
1334
1334
  /** Lazy place-id → boundary polygon index, built on first lookup through PlacesState.getGeometryForPlace. */
1335
1335
  _geometryByPlaceId?: Record<string, PolygonFeature<CommonPlaceProps>>;
1336
1336
  /**
1337
- * Per-entry display modules. An entry is rendered under at most one marker theme at a time,
1338
- * so a single PlacesModule covers all themes — `_showEntryAs` rethemes it via `applyTheme`.
1337
+ * Per-entry display modules. An entry is rendered under at most one marker type at a time,
1338
+ * so a single PlacesModule covers all of them — `_showEntryAs` switches it via `applyMarkerType`.
1339
1339
  * A dedicated GeometriesModule renders the entry's boundary polygons.
1340
1340
  * Lazy-initialised via PlacesState helpers — undefined until first show.
1341
1341
  */
@@ -1343,7 +1343,7 @@ type PlacesEntry = BaseEntry<Place[]> & {
1343
1343
  places?: PlacesModule;
1344
1344
  geometries?: GeometriesModule;
1345
1345
  };
1346
- /** The marker theme currently rendering this entry, or undefined when hidden. */
1346
+ /** The marker type currently rendering this entry, or undefined when hidden. */
1347
1347
  _shownAs?: PlacesMarkerType;
1348
1348
  };
1349
1349
  //#endregion
@@ -2567,6 +2567,12 @@ declare class TrafficTilesState implements StateSlice {
2567
2567
  export declare const hidePreviousShownEntries: (slice: ShownEntriesSlice, keepEntryIds: readonly string[], selector: "all" | readonly string[] | undefined) => Promise<void>;
2568
2568
  //#endregion
2569
2569
  //#region src/tools/shared/locate-places.d.ts
2570
+ /**
2571
+ * How {@link locatePlace} resolves a query: `'poi'` searches points of interest by name, `'place'` geocodes
2572
+ * an address or an area.
2573
+ *
2574
+ * @group Agent Toolkit
2575
+ */
2570
2576
  export type QueryAs = 'poi' | 'place';
2571
2577
  /**
2572
2578
  * Resolves a query string to up to `limit` Places. POI search when `queryAs === 'poi'`, geocoding
@@ -2576,7 +2582,25 @@ export declare const locatePlaces: (query: string, queryAs: QueryAs, options: {
2576
2582
  limit: number;
2577
2583
  bias?: GeoBias;
2578
2584
  }, execOptions?: ToolExecuteOptions) => Promise<Place[]>;
2579
- /** Convenience wrapper around {@link locatePlaces} for the single-result case. */
2585
+ /**
2586
+ * The best match for a query, as the `locatePlace` tool resolves it, for a custom tool that needs one place.
2587
+ * A failed or cancelled request rejects, so catch it in `execute`.
2588
+ *
2589
+ * @param bias - Favours results near a position, such as the map centre from {@link getViewportBias}.
2590
+ * @param execOptions - The `execute` options, whose `signal` cancels the request with the turn.
2591
+ * @returns The first match, or `null` when nothing matches.
2592
+ *
2593
+ * @example
2594
+ * ```ts
2595
+ * execute: async ({ name }, state, options) => {
2596
+ * const position = getViewportBias(state.baseMap);
2597
+ * const place = await locatePlace(name, 'poi', position && { position }, options);
2598
+ * // ...
2599
+ * },
2600
+ * ```
2601
+ *
2602
+ * @group Agent Toolkit
2603
+ */
2580
2604
  export declare const locatePlace: (query: string, queryAs: QueryAs, bias?: GeoBias, execOptions?: ToolExecuteOptions) => Promise<Place | null>;
2581
2605
  //#endregion
2582
2606
  //#region src/tools/shared/location-input.d.ts
@@ -2876,25 +2900,6 @@ export declare const buildPlacesSchemaDoc: (_flags: FeatureFlags) => string;
2876
2900
  */
2877
2901
  export declare const PLACES_SCHEMA_DOC: string;
2878
2902
  //#endregion
2879
- //#region src/tools/shared/resolve-poi-categories.d.ts
2880
- /** Outcome of {@link resolvePoiCategories}. @ignore */
2881
- export type ResolvedPoiCategories = {
2882
- /** Final search filter — known codes plus codes resolved from natural-language synonyms. */
2883
- resolved: POICategory[] | undefined;
2884
- /** Inputs that matched neither an exact code nor any synonym. */
2885
- unresolved: string[];
2886
- };
2887
- /**
2888
- * Resolve a mixed list of POI inputs to canonical {@link POICategory} codes.
2889
- *
2890
- * Each input is either an exact catalog code (kept as-is) or a natural-language term that is
2891
- * resolved via the POI categories service. Inputs that produce zero matches are reported in
2892
- * `unresolved` so callers can surface a precise error.
2893
- *
2894
- * @ignore
2895
- */
2896
- export declare const resolvePoiCategories: (poiCategories: string[] | undefined, options?: ToolExecuteOptions) => Promise<ResolvedPoiCategories>;
2897
- //#endregion
2898
2903
  //#region src/tools/shared/resolve-range.d.ts
2899
2904
  export declare const getRangePolygons: (state: ToolState, rangeId: string) => {
2900
2905
  polygons: (Polygon | MultiPolygon)[];
@@ -3324,9 +3329,21 @@ export declare const showResultsOnMap: (state: ToolState, placesEntryIds: readon
3324
3329
  export declare const toolStateToWhereContext: (state: ToolState, options?: ToolExecuteOptions) => WhereContext;
3325
3330
  //#endregion
3326
3331
  //#region src/tools/shared/viewport-bias.d.ts
3327
- /** @ignore */
3332
+ /**
3333
+ * Lowest zoom at which {@link getViewportBias} returns the map centre.
3334
+ *
3335
+ * @group Agent Toolkit
3336
+ */
3328
3337
  export declare const MIN_VIEWPORT_BIAS_ZOOM = 6;
3329
- /** @ignore */
3338
+ /**
3339
+ * The map centre, to favour search results in view: pass it as `{ position }` to a service's `geoBias` or to
3340
+ * {@link locatePlace}'s `bias`. Below `minZoom` the view spans too wide an area to say where the user means.
3341
+ *
3342
+ * @param map - The agent's base-map slice, `state.baseMap` in a tool's `execute`.
3343
+ * @returns The centre as `[longitude, latitude]`, or `undefined` below `minZoom`.
3344
+ *
3345
+ * @group Agent Toolkit
3346
+ */
3330
3347
  export declare const getViewportBias: (map: BaseMapState, minZoom?: number) => Position | undefined;
3331
3348
  /** @ignore */
3332
3349
  export declare const getViewportBoundingBox: (map: BaseMapState) => BBox;