@tomtom-org/maps-sdk-plugin-agent-toolkit 0.17.1 → 0.17.2

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
@@ -120,7 +120,7 @@ The plugin ships a `DEFAULT_TOOLS` registry that covers search, routing, traffic
120
120
  | `getTrafficIncidents` | Fetch traffic incidents within an area (viewport, named place, route corridor, polygon, IDs). By default, the entry keeps refreshing |
121
121
  | `setTrafficIncidentsMonitor` | Turn background refreshing of an already-loaded incidents entry on or off |
122
122
  | `clusterIncidents` | Group loaded incidents into hotspots (DBSCAN) with road and category labels, delay totals and trends |
123
- | `focusIncidents` | Highlight a subset of incidents (by id / category / severity) on the map and dim the rest |
123
+ | `focusIncidents` | Highlight a subset of incidents by id (`analyseData` can pick them by category or severity) on the map and dim the rest |
124
124
  | `getTrafficAreaAnalytics` | Fetch historical traffic analytics (speed, congestion, travel time) for an area |
125
125
 
126
126
  ### Trackers
@@ -199,9 +199,9 @@ const agent = createMapAgent(map, {
199
199
 
200
200
  | Tool | Description |
201
201
  |---|---|
202
- | `recallState` | Read session state: a snapshot of every slice, one kind's entries (`places`, `routes`, `ranges`, `geometries`, `byod`, …), or one entry by `{ kind, id }` |
202
+ | `recallState` | Read session state: a snapshot of the places, routes and ranges entries with the map style and layer configs, one kind's entries (`places`, `routes`, `ranges`, `geometries`, `byod`, …), or one entry by `{ kind, id }` |
203
203
  | `setEntryMode` | Switch a slice between `multiple` (default) and `single` entry modes |
204
- | `resetState` | Reset one or all state slices |
204
+ | `resetState` | Reset every state slice and the map style to their defaults |
205
205
 
206
206
  ### Utilities
207
207
 
@@ -485,22 +485,26 @@ const agent = createMapAgent(map, {
485
485
 
486
486
  ### Wrapping default tools
487
487
 
488
- To add logging, analytics or custom behavior around an existing tool, wrap it:
488
+ To add logging, analytics or custom behavior around an existing tool, wrap it. `DEFAULT_TOOLS` types
489
+ each value as a `ToolDefinition`: `locatePlace` is a static `ToolEntry`, while builders such as
490
+ `discoverPlaces` are functions of `ToolBuildOptions` that return one.
489
491
 
490
492
  ```typescript
491
- import { DEFAULT_TOOLS, createMapAgent } from '@tomtom-org/maps-sdk-plugin-agent-toolkit';
492
-
493
- const wrappedDiscover = {
494
- ...DEFAULT_TOOLS.discoverPlaces,
495
- execute: async (input, state) => {
496
- console.log('[Analytics] Search:', input.query);
497
- const result = await DEFAULT_TOOLS.discoverPlaces.execute(input, state);
498
- console.log('[Analytics] Found:', result.count, 'places');
493
+ import { DEFAULT_TOOLS, createMapAgent, type ToolEntry } from '@tomtom-org/maps-sdk-plugin-agent-toolkit';
494
+
495
+ const locatePlace = DEFAULT_TOOLS.locatePlace as ToolEntry;
496
+
497
+ const wrappedLocatePlace: ToolEntry = {
498
+ ...locatePlace,
499
+ execute: async (input, state, options) => {
500
+ console.log('[Analytics] Locate:', input);
501
+ const result = await locatePlace.execute(input, state, options);
502
+ console.log('[Analytics] Result:', result);
499
503
  return result;
500
504
  },
501
505
  };
502
506
 
503
- createMapAgent(map, { model, tools: { discoverPlaces: wrappedDiscover } });
507
+ createMapAgent(map, { model, tools: { locatePlace: wrappedLocatePlace } });
504
508
  ```
505
509
 
506
510
  ### Common configuration patterns