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

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
@@ -57,8 +57,8 @@ console.log(result.text);
57
57
 
58
58
  ### With React (`useChat`)
59
59
 
60
- ```typescript
61
- import { DirectChatTransport } from 'ai';
60
+ ```tsx
61
+ import { DirectChatTransport, isTextUIPart } from 'ai';
62
62
  import { useChat } from '@ai-sdk/react';
63
63
 
64
64
  const agent = createMapAgent(map, { model: openai('gpt-4o') });
@@ -70,10 +70,10 @@ function ChatPanel() {
70
70
 
71
71
  return (
72
72
  <div>
73
- {messages.map((m) => (
74
- <div key={m.id}>{m.content}</div>
73
+ {messages.map((message) => (
74
+ <div key={message.id}>{message.parts.filter(isTextUIPart).map((part) => part.text).join('')}</div>
75
75
  ))}
76
- <input onKeyDown={(e) => e.key === 'Enter' && sendMessage(e.target.value)} />
76
+ <input onKeyDown={(event) => event.key === 'Enter' && sendMessage({ text: event.currentTarget.value })} />
77
77
  </div>
78
78
  );
79
79
  }
@@ -105,29 +105,37 @@ The plugin ships a `DEFAULT_TOOLS` registry covering search, routing, traffic, r
105
105
  | `removeWaypointsFromRoute` | Remove one or more waypoints by index from the current route |
106
106
  | `replaceWaypointInRoute` | Overwrite a single waypoint of the current route in place — origin, destination, or by index |
107
107
  | `getCurrentWaypoints` | Get the staged waypoint slots (origin, stops, destination) |
108
+ | `startRouteMonitor` | Recalculate an already-calculated route on a cadence (default 60 s) so its live-traffic delays stay current |
109
+ | `stopRouteMonitor` | Stop recalculating a route; the entry keeps its last data |
108
110
  | `findReachableAreas` | Calculate isochrone/isodistance polygons from one or more origins (private preview: the API key needs Calculate Reachable Range access) |
109
111
 
110
112
  ### Traffic
111
113
 
112
114
  | Tool | Description |
113
115
  |---|---|
114
- | `getTrafficIncidents` | Fetch traffic incidents within an area (viewport, named place, route corridor, polygon, IDs) |
115
- | `startTrafficIncidentsMonitor` | Start a live monitor that refreshes incident state on a configurable cadence |
116
- | `stopTrafficIncidentsMonitor` | Stop the live incident monitor |
116
+ | `getTrafficIncidents` | Fetch traffic incidents within an area (viewport, named place, route corridor, polygon, IDs); the entry keeps refreshing by default |
117
+ | `setTrafficIncidentsMonitor` | Turn background refreshing of an already-loaded incidents entry on or off |
118
+ | `clusterIncidents` | Group loaded incidents into hotspots (DBSCAN) with road and category labels, delay totals and trends |
117
119
  | `focusIncidents` | Highlight a subset of incidents (by id / category / severity) on the map and dim the rest |
118
120
  | `getTrafficAreaAnalytics` | Fetch historical traffic analytics (speed, congestion, travel time) for an area |
119
- | `queryTrafficAnalytics` | Query cached analytics data or check what is currently displayed |
120
121
  | `toggleTilesTrafficFlow` | Toggle the real-time traffic-flow tile overlay |
121
122
  | `toggleTilesTrafficIncidents` | Toggle the real-time traffic-incidents tile overlay |
122
123
  | `setMapStyling` | Set or reset base-map styling knobs — label/icon/road sizes, exit numbers, shields, 3D buildings, congestion colours, map colours, presets, or a whole theme from a few colours or an image |
123
- | `getShownTileIncidents` | List real-time incidents visible in the current viewport |
124
+
125
+ ### Trackers
126
+
127
+ | Tool | Description |
128
+ |---|---|
129
+ | `createTracker` | Watch loaded entries with generated code and log an alert when its condition turns true (e.g. an incident near a hospital) |
130
+ | `getTrackers` | List the active trackers and whether each is firing |
131
+ | `getTrackerHistory` | Read the alerts and events trackers have logged, for one tracker or since a time |
132
+ | `clearTracker` | Stop a tracker; the entries it watched stay |
124
133
 
125
134
  ### Bring-your-own-data (BYOD)
126
135
 
127
136
  | Tool | Description |
128
137
  |---|---|
129
138
  | `addByodSource` | Ingest a customer-authored GeoJSON source (URL or inline `FeatureCollection`) and profile its shape; the entry has no layers and renders nothing until the agent sets them via `setByodLayers` |
130
- | `recallByod` | List BYOD entries, or retrieve a single entry's full `FeatureCollection` by id |
131
139
  | `setByodLayers` | Restyle a BYOD entry — replace its MapLibre layers (type + data-driven paint) using the entry's data `profile` |
132
140
  | `updateByodDisplay` | Show, hide, or clear BYOD layers on the map |
133
141
 
@@ -139,6 +147,7 @@ The plugin ships a `DEFAULT_TOOLS` registry covering search, routing, traffic, r
139
147
  |---|---|
140
148
  | `analyseData` | Aggregate / chart entries (`places`, `routes`, `incidents`, `geometries`, `trafficAreaAnalytics`, `byod`) via dynamic JS; classifier-emitted scope narrows the schema per turn |
141
149
  | `processData` | Transform entries into new `places`, `placeConnections`, `geometries`, `byod`, or a `fitOnMap` camera move via dynamic JS |
150
+ | `monitorAnalysis` | Start or stop recomputing an `analyseData` analysis whenever its source entries change |
142
151
  | `executeMaplibreCode` | Execute arbitrary MapLibre JS against the live `Map` instance — escape hatch for custom layers, animations, raster overlays |
143
152
 
144
153
  > See [Code generation](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/code-generation) for the injected identifiers, output contracts, and threat model, and [Scope-aware data tools](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/scope-aware-data-tools) for how the per-turn classifier scope keeps the prompt small.
@@ -188,12 +197,7 @@ const agent = createMapAgent(map, {
188
197
 
189
198
  | Tool | Description |
190
199
  |---|---|
191
- | `recallPlaces` | Retrieve the history of place lookups from this session |
192
- | `recallRoutes` | Retrieve previously calculated routes from this session |
193
- | `recallRanges` | Retrieve stored reachable-range results |
194
- | `recallGeometries` | Look up polygon sources by `{ kind, id }` across place footprints, isochrones, and `customGeometries` entries |
195
- | `recallByod` | Retrieve BYOD entries (see [BYOD](#bring-your-own-data-byod)) |
196
- | `recallState` | Summarize the current contents of every state slice |
200
+ | `recallState` | Read session state: a snapshot of every slice, one kind's entries (`places`, `routes`, `ranges`, `geometries`, `byod`, …), or one entry by `{ kind, id }` |
197
201
  | `setEntryMode` | Switch a slice between `multiple` (default) and `single` entry modes |
198
202
  | `resetState` | Reset one or all state slices |
199
203
 
@@ -202,8 +206,7 @@ const agent = createMapAgent(map, {
202
206
  | Tool | Description |
203
207
  |---|---|
204
208
  | `calculateBBox` | Compute a bounding box from GeoJSON features or tool results |
205
- | `formatDistance` | Format meters into a human-readable string (e.g. "2.5 km") |
206
- | `formatDuration` | Format seconds into a human-readable string (e.g. "1 h 30 min") |
209
+ | `clarifyIntent` | Ask the user to resolve a genuinely ambiguous or missing input, as a few numbered choices plus a free answer |
207
210
  | `help` | List available capabilities in summary or searchable detail mode |
208
211
 
209
212
  ## Customization
@@ -556,3 +559,7 @@ For the complete, always-current list of exports — factories, tool-registry he
556
559
  - [AI SDK v6 documentation](https://ai-sdk.dev/)
557
560
  - [TomTom Maps SDK documentation](https://docs.tomtom.com/maps-sdk-js)
558
561
  - [Example application](../../examples/map-traffic-agent-react) — full chat interface implementation
562
+
563
+ ## License
564
+
565
+ See `LICENSE.txt`.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
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";
1
+ import { BaseMapModule, CustomGeoJSONLayerSpec, CustomGeoJSONModule, GeometriesModule, GeometryFillStyle, POIsModule, PlaceConnectionDisplay, PlacesModule, PlanningWaypoint, ReachableRangesModule, RoutingModule, StylingModule, TomTomMap, TrafficAreaAnalyticsModule, TrafficAreaAnalyticsModuleConfig, TrafficFlowModule, TrafficIncidentDetailsModule, TrafficIncidentsModule } from "@tomtom-org/maps-sdk/map";
2
+ import { BBox, CommonPlaceProps, GeographyType, Place, Places, PolygonFeature, PolygonFeatures, ReachableRangeBudget, 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";
6
- import { GeoBias, ReachableRangeBudget, TrafficIncidentDetailsByBBoxParams } from "@tomtom-org/maps-sdk/services";
6
+ import { GeoBias, TrafficIncidentDetailsByBBoxParams } from "@tomtom-org/maps-sdk/services";
7
7
  import { LanguageModel, ModelMessage, PrepareStepFunction, ToolLoopAgent } from "ai";
8
8
  //#region src/engine/engine.d.ts
9
9
  /** What {@link JobEngine.register} needs to mint a {@link Job}. `run` and `onOrphaned` are owner closures. */
@@ -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 `updateConfig` 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 `updateConfig` 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 `updateConfig({ markerType })`.
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
@@ -1377,17 +1377,17 @@ type ReachableRange = {
1377
1377
  */
1378
1378
  type RangesEntry = BaseEntry<ReachableRange[]> & {
1379
1379
  /**
1380
- * Per-entry display modules. Each entry owns a dedicated GeometriesModule (for the
1381
- * isochrone polygons) and PlacesModule (for the origin pin(s)), so display state lives
1380
+ * Per-entry display modules. Each entry owns a dedicated ReachableRangesModule (for the
1381
+ * isochrone polygons, and their fill style), a GeometriesModule (for the same polygons in a
1382
+ * consumer's own style) and a PlacesModule (for the origin pin(s)), so display state lives
1382
1383
  * on the entry instead of a shared slice-level module. Lazy-initialised via RangeState
1383
1384
  * helpers — undefined until first show.
1384
1385
  */
1385
1386
  _modules?: {
1387
+ ranges?: ReachableRangesModule;
1386
1388
  geometries?: GeometriesModule;
1387
1389
  places?: PlacesModule;
1388
1390
  };
1389
- /** Fill style that the geometries module is currently configured with. */
1390
- _shownFillStyle?: GeometryFillStyle;
1391
1391
  /** True while any of this entry's modules are rendering on the map. */
1392
1392
  _shown?: boolean;
1393
1393
  };
@@ -1418,7 +1418,7 @@ type RangeStateEvents = {
1418
1418
  *
1419
1419
  * Stores semantic summaries of calculated ranges (origin, budgets).
1420
1420
  * Also retains raw polygon geometry internally for use in geometry searches
1421
- * (e.g. discoverPlaces withinRange). Displayed on the map via GeometriesModule.
1421
+ * (e.g. discoverPlaces withinRange). Displayed on the map via ReachableRangesModule.
1422
1422
  *
1423
1423
  * @group Agent Toolkit
1424
1424
  */
@@ -1444,9 +1444,16 @@ declare class RangeState implements ShownEntriesSlice {
1444
1444
  */
1445
1445
  setEntryMode(mode: EntryMode): Promise<void>;
1446
1446
  /**
1447
- * Lazy-init the entry's GeometriesModule (for the isochrone/isodistance polygons),
1447
+ * Lazy-init the entry's ReachableRangesModule (for the isochrone/isodistance polygons),
1448
1448
  * applying the requested fill style. Throws on unknown id.
1449
1449
  */
1450
+ getEntryRangesModule(entryId: string, fillStyle?: GeometryFillStyle): Promise<ReachableRangesModule>;
1451
+ /**
1452
+ * Lazy-init the entry's plain GeometriesModule, for drawing the entry's polygons in a style of
1453
+ * your own (per-feature colours, border widths) rather than as reachable-range bands.
1454
+ * Updates only the fill style when it changes, keeping the styling applied since. Throws on
1455
+ * unknown id.
1456
+ */
1450
1457
  getEntryGeometriesModule(entryId: string, fillStyle?: GeometryFillStyle): Promise<GeometriesModule>;
1451
1458
  /**
1452
1459
  * Lazy-init the entry's origin-pin PlacesModule. Each entry maintains its own pin module
@@ -1466,7 +1473,7 @@ declare class RangeState implements ShownEntriesSlice {
1466
1473
  /** Hide every module on the entry (clear). No-op when the entry is unknown. */
1467
1474
  hideEntry(entryId: string): Promise<void>;
1468
1475
  /**
1469
- * Drop a single entry from history. Hides it from the map first (clears its geometries +
1476
+ * Drop a single entry from history. Hides it from the map first (clears its ranges +
1470
1477
  * origin-pin modules) then removes it from `_entries`. Emits `entries-change`. No-op when
1471
1478
  * the id is unknown.
1472
1479
  */
@@ -2292,7 +2299,7 @@ type TrafficIncidentsEntry = BaseEntry<TrafficIncident[]> & {
2292
2299
  * via `TrafficIncidentsState.getEntryModule` — undefined until first show. Subscribe to
2293
2300
  * clicks via `module.events.on('click', ...)` once retrieved.
2294
2301
  */
2295
- _module?: TrafficIncidentOverlayModule;
2302
+ _module?: TrafficIncidentDetailsModule;
2296
2303
  /** True while this entry is currently rendered on the map. */
2297
2304
  _shown?: boolean;
2298
2305
  /**
@@ -2390,7 +2397,7 @@ type TrafficIncidentsStateEvents = {
2390
2397
  };
2391
2398
  /**
2392
2399
  * State for traffic incidents: entry history and map rendering via per-entry
2393
- * TrafficIncidentOverlayModule. Each entry can be a separate area; under the default
2400
+ * TrafficIncidentDetailsModule. Each entry can be a separate area; under the default
2394
2401
  * `multiple` mode several entries can render at once.
2395
2402
  *
2396
2403
  * Each entry owns its own module (lazy-init on first show) plus an optional per-entry
@@ -2442,11 +2449,11 @@ declare class TrafficIncidentsState implements StateSlice {
2442
2449
  */
2443
2450
  replaceEntryData(entryId: TrafficIncidentsEntry['id'], data: TrafficIncident[], sampledAt: number): Promise<boolean>;
2444
2451
  /**
2445
- * Lazy-init and return the entry's TrafficIncidentOverlayModule. Consumers subscribe to
2452
+ * Lazy-init and return the entry's TrafficIncidentDetailsModule. Consumers subscribe to
2446
2453
  * clicks directly on the returned module via `module.events.on('click', ...)`;
2447
2454
  * Throws on unknown entry id.
2448
2455
  */
2449
- getEntryModule(entryId: TrafficIncidentsEntry['id']): Promise<TrafficIncidentOverlayModule>;
2456
+ getEntryModule(entryId: TrafficIncidentsEntry['id']): Promise<TrafficIncidentDetailsModule>;
2450
2457
  /**
2451
2458
  * Render an entry on the map. Lazy-inits its module, pushes the entry's incidents, and
2452
2459
  * (when `fitBounds` is true) fits the camera to the entry's bbox. Emits `shown-change`
@@ -2567,6 +2574,12 @@ declare class TrafficTilesState implements StateSlice {
2567
2574
  export declare const hidePreviousShownEntries: (slice: ShownEntriesSlice, keepEntryIds: readonly string[], selector: "all" | readonly string[] | undefined) => Promise<void>;
2568
2575
  //#endregion
2569
2576
  //#region src/tools/shared/locate-places.d.ts
2577
+ /**
2578
+ * How {@link locatePlace} resolves a query: `'poi'` searches points of interest by name, `'place'` geocodes
2579
+ * an address or an area.
2580
+ *
2581
+ * @group Agent Toolkit
2582
+ */
2570
2583
  export type QueryAs = 'poi' | 'place';
2571
2584
  /**
2572
2585
  * Resolves a query string to up to `limit` Places. POI search when `queryAs === 'poi'`, geocoding
@@ -2576,7 +2589,25 @@ export declare const locatePlaces: (query: string, queryAs: QueryAs, options: {
2576
2589
  limit: number;
2577
2590
  bias?: GeoBias;
2578
2591
  }, execOptions?: ToolExecuteOptions) => Promise<Place[]>;
2579
- /** Convenience wrapper around {@link locatePlaces} for the single-result case. */
2592
+ /**
2593
+ * The best match for a query, as the `locatePlace` tool resolves it, for a custom tool that needs one place.
2594
+ * A failed or cancelled request rejects, so catch it in `execute`.
2595
+ *
2596
+ * @param bias - Favours results near a position, such as the map centre from {@link getViewportBias}.
2597
+ * @param execOptions - The `execute` options, whose `signal` cancels the request with the turn.
2598
+ * @returns The first match, or `null` when nothing matches.
2599
+ *
2600
+ * @example
2601
+ * ```ts
2602
+ * execute: async ({ name }, state, options) => {
2603
+ * const position = getViewportBias(state.baseMap);
2604
+ * const place = await locatePlace(name, 'poi', position && { position }, options);
2605
+ * // ...
2606
+ * },
2607
+ * ```
2608
+ *
2609
+ * @group Agent Toolkit
2610
+ */
2580
2611
  export declare const locatePlace: (query: string, queryAs: QueryAs, bias?: GeoBias, execOptions?: ToolExecuteOptions) => Promise<Place | null>;
2581
2612
  //#endregion
2582
2613
  //#region src/tools/shared/location-input.d.ts
@@ -2800,17 +2831,6 @@ export declare const prepareMultiInputs: (ids: MultiInputIds, state: ToolState)
2800
2831
  * @ignore
2801
2832
  */
2802
2833
  export declare const BY_ENTRY_VIEWS_DOC: string;
2803
- /**
2804
- * @ignore
2805
- */
2806
- export declare const routeUtils: {
2807
- readonly calculateProgressAtRoutePoint: (route: Route, pathIndex: number) => import("@tomtom-org/maps-sdk/core").RouteProgressAtPoint | undefined;
2808
- readonly getCoordinateAtRouteProgress: (route: Route, query: import("@tomtom-org/maps-sdk/core").RouteProgressQuery) => import("@tomtom-org/maps-sdk/core").RouteCoordinateAtProgress | undefined;
2809
- readonly getProgressAtNearestRoutePoint: (route: Route, point: import("@tomtom-org/maps-sdk/core").HasLngLat) => import("@tomtom-org/maps-sdk/core").RouteCoordinateAtProgress | undefined;
2810
- readonly getRouteProgressBetween: (route: Route, startPathIndex: number, endPathIndex: number) => import("@tomtom-org/maps-sdk/core").RouteSegmentProgress | undefined;
2811
- readonly getRouteProgressForSection: (route: Route, section: import("@tomtom-org/maps-sdk/core").SectionProps) => import("@tomtom-org/maps-sdk/core").RouteSegmentProgress | undefined;
2812
- readonly getSectionBBox: (route: Route, section: import("@tomtom-org/maps-sdk/core").SectionProps) => import("@tomtom-org/maps-sdk/core").OptionalBBox;
2813
- };
2814
2834
  /**
2815
2835
  * Names injected into the sandbox by analyseData / processData, in fixed order.
2816
2836
  *
@@ -2876,25 +2896,6 @@ export declare const buildPlacesSchemaDoc: (_flags: FeatureFlags) => string;
2876
2896
  */
2877
2897
  export declare const PLACES_SCHEMA_DOC: string;
2878
2898
  //#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
2899
  //#region src/tools/shared/resolve-range.d.ts
2899
2900
  export declare const getRangePolygons: (state: ToolState, rangeId: string) => {
2900
2901
  polygons: (Polygon | MultiPolygon)[];
@@ -3274,6 +3275,30 @@ export type ResolvedAreaDisclosure = {
3274
3275
  };
3275
3276
  export declare const isResolveError: (r: unknown) => r is ResolveError;
3276
3277
  //#endregion
3278
+ //#region src/tools/shared/route-utils.d.ts
3279
+ /**
3280
+ * @module agent-toolkit-tools
3281
+ *
3282
+ * The `routeUtils` namespace injected into sandboxed model-authored code, so a routes input can be
3283
+ * sliced and measured without re-implementing it. Its own module because the worker entry
3284
+ * (`sandbox/sdk-utils-worker-entry.ts`) is bundled standalone at SDK build time, so importing it
3285
+ * from `multi-input.ts` would pull that module's prompt text into the worker bundle.
3286
+ *
3287
+ * Every function here depends only on `@turf/turf` — available in the worker as `self.turf` — and
3288
+ * pure local helpers, which is what makes the set portable into the sandbox.
3289
+ */
3290
+ /**
3291
+ * @ignore
3292
+ */
3293
+ export declare const routeUtils: {
3294
+ readonly calculateProgressAtRoutePoint: (route: import("@tomtom-org/maps-sdk/core").Route, pathIndex: number) => import("@tomtom-org/maps-sdk/core").RouteProgressAtPoint | undefined;
3295
+ readonly getCoordinateAtRouteProgress: (route: import("@tomtom-org/maps-sdk/core").Route, query: import("@tomtom-org/maps-sdk/core").RouteProgressQuery) => import("@tomtom-org/maps-sdk/core").RouteCoordinateAtProgress | undefined;
3296
+ readonly getProgressAtNearestRoutePoint: (route: import("@tomtom-org/maps-sdk/core").Route, point: import("@tomtom-org/maps-sdk/core").HasLngLat) => import("@tomtom-org/maps-sdk/core").RouteCoordinateAtProgress | undefined;
3297
+ readonly getRouteProgressBetween: (route: import("@tomtom-org/maps-sdk/core").Route, startPathIndex: number, endPathIndex: number) => import("@tomtom-org/maps-sdk/core").RouteSegmentProgress | undefined;
3298
+ readonly getRouteProgressForSection: (route: import("@tomtom-org/maps-sdk/core").Route, section: import("@tomtom-org/maps-sdk/core").SectionProps) => import("@tomtom-org/maps-sdk/core").RouteSegmentProgress | undefined;
3299
+ readonly getSectionBBox: (route: import("@tomtom-org/maps-sdk/core").Route, section: import("@tomtom-org/maps-sdk/core").SectionProps) => import("@tomtom-org/maps-sdk/core").OptionalBBox;
3300
+ };
3301
+ //#endregion
3277
3302
  //#region src/tools/shared/routes-schema-doc.d.ts
3278
3303
  /**
3279
3304
  * @module agent-toolkit-tools
@@ -3324,9 +3349,21 @@ export declare const showResultsOnMap: (state: ToolState, placesEntryIds: readon
3324
3349
  export declare const toolStateToWhereContext: (state: ToolState, options?: ToolExecuteOptions) => WhereContext;
3325
3350
  //#endregion
3326
3351
  //#region src/tools/shared/viewport-bias.d.ts
3327
- /** @ignore */
3352
+ /**
3353
+ * Lowest zoom at which {@link getViewportBias} returns the map centre.
3354
+ *
3355
+ * @group Agent Toolkit
3356
+ */
3328
3357
  export declare const MIN_VIEWPORT_BIAS_ZOOM = 6;
3329
- /** @ignore */
3358
+ /**
3359
+ * The map centre, to favour search results in view: pass it as `{ position }` to a service's `geoBias` or to
3360
+ * {@link locatePlace}'s `bias`. Below `minZoom` the view spans too wide an area to say where the user means.
3361
+ *
3362
+ * @param map - The agent's base-map slice, `state.baseMap` in a tool's `execute`.
3363
+ * @returns The centre as `[longitude, latitude]`, or `undefined` below `minZoom`.
3364
+ *
3365
+ * @group Agent Toolkit
3366
+ */
3330
3367
  export declare const getViewportBias: (map: BaseMapState, minZoom?: number) => Position | undefined;
3331
3368
  /** @ignore */
3332
3369
  export declare const getViewportBoundingBox: (map: BaseMapState) => BBox;
@@ -4666,7 +4703,8 @@ export type MapAgentInstance<CS extends ToolState = ToolState> = ToolLoopAgent &
4666
4703
  * ```typescript
4667
4704
  * import { createMapAgent } from '@tomtom-org/maps-sdk-plugin-agent-toolkit';
4668
4705
  * import { openai } from '@ai-sdk/openai';
4669
- * import { DirectChatTransport } from 'ai/react';
4706
+ * import { useChat } from '@ai-sdk/react';
4707
+ * import { DirectChatTransport } from 'ai';
4670
4708
  *
4671
4709
  * const agent = createMapAgent(map, { model: openai('gpt-4o') });
4672
4710
  *
@@ -4793,4 +4831,26 @@ type ClarifyIntentToolOptions = {
4793
4831
  */
4794
4832
  export declare const createClarifyIntentTool: (options?: ClarifyIntentToolOptions) => ToolEntry;
4795
4833
  //#endregion
4796
- export type { AnalysesEvents, AnalysisRecord, BYODAnalysis, BYODDataProfile, BYODEntry, BYODPropertyProfile, BYODSource, ByodSourceUrlValidation, ByodSourceUrlValidator, ClarifyIntentQuestion, ClarifyIntentToolOptions, ClassificationResult, ClassifierOptions, ClusterResult, ClusterTrend, ClusteringOutput, ClusteringParams, CustomGeometriesAnalysis, CustomGeometriesEntry, DataEntryConfig, DataEntryKind, EntryAnalysis, EntryMode, EntryModeSlice, EntryModeSliceName, GeometryProvenance, IncidentSnapshot, IncidentsAnalysis, MemberRef, MonitoredArea, PlacesAnalysis, PlacesEntry, PollingStatus, RangesEntry, ReachableRange, RouteParams, RoutesAnalysis, RoutesEntry, StateDigest, SystemPromptSection, SystemPromptSectionOverrides, ToolName, Tracker, TrackerEvent, TrackerEventStatus, TrackerEventType, TrackerStateEvents, TrafficAreaAnalyticsAnalysis, TrafficAreaAnalyticsEntry, TrafficAreaAnalyticsParams, TrafficIncidentsEntry, Verdict };
4834
+ //#region src/tools/utilities/get-current-location.d.ts
4835
+ type GetCurrentLocationToolOptions = {
4836
+ /**
4837
+ * Send the exact position, the device's accuracy and the fix's timestamp to the model, from a
4838
+ * fresh high-accuracy fix. Defaults to `false`: the position is rounded to 3 decimals (about
4839
+ * 100 m) from a fix up to a minute old, with no timestamp.
4840
+ */
4841
+ fullPrecision?: boolean;
4842
+ };
4843
+ /**
4844
+ * Build a getCurrentLocation {@link ToolEntry}. Pass the result to `createMapAgent`'s `tools` option
4845
+ * to replace the built-in default, for example to send the exact position:
4846
+ *
4847
+ * ```typescript
4848
+ * createMapAgent(map, {
4849
+ * model,
4850
+ * tools: { getCurrentLocation: createGetCurrentLocationTool({ fullPrecision: true }) },
4851
+ * });
4852
+ * ```
4853
+ */
4854
+ export declare const createGetCurrentLocationTool: (options?: GetCurrentLocationToolOptions) => ToolEntry;
4855
+ //#endregion
4856
+ export type { AnalysesEvents, AnalysisRecord, BYODAnalysis, BYODDataProfile, BYODEntry, BYODPropertyProfile, BYODSource, ByodSourceUrlValidation, ByodSourceUrlValidator, ClarifyIntentQuestion, ClarifyIntentToolOptions, ClassificationResult, ClassifierOptions, ClusterResult, ClusterTrend, ClusteringOutput, ClusteringParams, CustomGeometriesAnalysis, CustomGeometriesEntry, DataEntryConfig, DataEntryKind, EntryAnalysis, EntryMode, EntryModeSlice, EntryModeSliceName, GeometryProvenance, GetCurrentLocationToolOptions, IncidentSnapshot, IncidentsAnalysis, MemberRef, MonitoredArea, PlacesAnalysis, PlacesEntry, PollingStatus, RangesEntry, ReachableRange, RouteParams, RoutesAnalysis, RoutesEntry, StateDigest, SystemPromptSection, SystemPromptSectionOverrides, ToolName, Tracker, TrackerEvent, TrackerEventStatus, TrackerEventType, TrackerStateEvents, TrafficAreaAnalyticsAnalysis, TrafficAreaAnalyticsEntry, TrafficAreaAnalyticsParams, TrafficIncidentsEntry, Verdict };