@tomtom-org/maps-sdk-plugin-agent-toolkit 0.14.0 → 0.15.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/LICENSE.txt +2 -2
- package/README.md +72 -63
- package/THIRD_PARTY.txt +2 -2
- package/dist/THIRD_PARTY.txt +2 -2
- package/dist/index.d.ts +62 -23
- package/dist/index.es.js +2 -1
- package/dist/third-party.json +2 -2
- package/package.json +13 -13
package/LICENSE.txt
CHANGED
|
@@ -14,7 +14,7 @@ You may not use the SDK or accept this Agreement if you are barred from receivin
|
|
|
14
14
|
|
|
15
15
|
3.1. You agree to use the SDK only for purposes permitted by (a) this Agreement and (b) any applicable law, regulation or generally accepted practice or guideline in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries).
|
|
16
16
|
|
|
17
|
-
3.2.
|
|
17
|
+
3.2. Except as permitted by applicable law or this Clause 3.2, you may not copy (except for backup purposes), modify, adapt, distribute, rent, lend, publicly present, decompile, reverse engineer, disassemble or create derivative works of the SDK. Solely for your Permitted Applications and subject to Clauses 3.3 to 3.5, you may: (a) inspect the SDK, including source code in its source maps, for debugging; (b) copy the SDK as reasonably necessary to develop, build, test and deploy them, including in internal repositories, mirrors and offline build environments used only by you, your Affiliates and your contractors; (c) modify the SDK to fix errors or security vulnerabilities, to maintain compatibility, or to prepare a Contribution under Clause 11.5, but you may not alter, circumvent or disable any functionality for authentication, metering, billing, the notices in Clause 5.2 or the data collection in Clause 4; and (d) distribute the SDK only as a bundled part of a Permitted Application, and not on a standalone basis or as a library. Modified versions remain part of the SDK, and TomTom need not support them. On termination, you must delete all copies held under (b), except copies already distributed under (d). The readability of the SDK's source code does not make it open source and grants no rights beyond those in Clause 1 and this Clause 3.2.
|
|
18
18
|
|
|
19
19
|
3.3. You may not use the SDK in connection with any illegal, fraudulent, dishonest or unethical activity or behaviour, and in particular not to create or develop, or help others create or develop, a product, service or library that competes, directly or indirectly, with the SDK or the TomTom APIs.
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ You may not use the SDK or accept this Agreement if you are barred from receivin
|
|
|
22
22
|
|
|
23
23
|
3.5. The SDK may include data or software that TomTom licenses from third parties, including open-source software. Such components are made available to you under the terms and conditions of their applicable licenses, and you shall comply with all requirements and restrictions that those third parties may require TomTom to impose on you (as may be updated and amended by TomTom from time to time). It is your responsibility to check, review and comply with those terms as they apply to the SDK licensed to you under this Agreement. The applicable third party and open-source notices are set out in the accompanying THIRD_PARTY.txt file. In the event of a conflict between this Agreement and an open-source license governing a specific dependency, that open-source license shall prevail solely with respect to that dependency.
|
|
24
24
|
|
|
25
|
-
4. PRIVACY: In order to improve the TomTom Developer Portal and the SDK, TomTom may collect certain usage related information from the software, including but not limited to general SDK and product identifiers, version numbers, and information on which tools and/or services in the SDK are used and how you use them. In addition, TomTom may collect your unique identifier and associated IP address for legitimate business reasons (such as, without limitation, the processing of invoices). This data is retained for a maximum period of 120 days and is maintained in accordance with our Privacy Policy.
|
|
25
|
+
4. PRIVACY: In order to improve the TomTom Developer Portal and the SDK, TomTom may collect certain usage related information from the software, including but not limited to general SDK and product identifiers, version numbers, and information on which tools and/or services in the SDK are used and how you use them. In addition, TomTom may collect your unique identifier and associated IP address for legitimate business reasons (such as, without limitation, the processing of invoices). This data is retained for a maximum period of 120 days and is maintained in accordance with our Privacy Policy (https://www.tomtom.com/privacy/).
|
|
26
26
|
|
|
27
27
|
5. INTELLECTUAL PROPERTY RIGHTS AND COPYRIGHT NOTICES:
|
|
28
28
|
|
package/README.md
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Agent Toolkit Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This plugin is a headless conversational agent that gives large language models tool-based control over a [TomTom Map](https://docs.tomtom.com/maps-sdk-js/guides/map/tomtom-map) and TomTom location services. It's built on [Vercel AI SDK v6](https://ai-sdk.dev/).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The plugin has no UI, so you bring your own chat interface. It bundles no LLM provider, so you supply any AI SDK-compatible model.
|
|
6
6
|
|
|
7
|
-
> **Full documentation
|
|
7
|
+
> **Full documentation**, with guides, architecture diagrams and tutorials, lives at [docs.tomtom.com](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/overview).
|
|
8
8
|
|
|
9
9
|
## Design principles
|
|
10
10
|
|
|
11
|
-
1. **Client-side only** —
|
|
12
|
-
2. **No bundled LLM provider** — supply any AI SDK-compatible `LanguageModel
|
|
13
|
-
3. **Token-efficient** —
|
|
14
|
-
4. **Lazy module initialization** —
|
|
15
|
-
5. **Coordinate convention** — always `[longitude, latitude]
|
|
16
|
-
6. **Task-oriented tools** — tool boundaries follow user tasks, not SDK API surface, so
|
|
11
|
+
1. **Client-side only** — the agent runs on AI SDK's `DirectChatTransport` and `ToolLoopAgent`. You provide the model and need no server infrastructure.
|
|
12
|
+
2. **No bundled LLM provider** — you supply any AI SDK-compatible `LanguageModel`, which keeps the package provider-agnostic.
|
|
13
|
+
3. **Token-efficient** — the plugin summarizes every service response before it reaches the LLM. The full GeoJSON stays in `ToolState`.
|
|
14
|
+
4. **Lazy module initialization** — the plugin creates each map module on first use and caches it in state.
|
|
15
|
+
5. **Coordinate convention** — the plugin always uses and enforces `[longitude, latitude]`, the GeoJSON standard's order.
|
|
16
|
+
6. **Task-oriented tools** — tool boundaries follow user tasks, not the SDK's API surface, so one prompt maps to one tool call.
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
pnpm add @tomtom-org/maps-sdk @tomtom-org/maps-sdk-plugin-agent-toolkit ai zod maplibre-gl @turf/turf chart.js h3-js
|
|
21
|
+
pnpm add @tomtom-org/maps-sdk @tomtom-org/maps-sdk-plugin-agent-toolkit @tomtom-org/maps-sdk-plugin-map-theme ai zod maplibre-gl @turf/turf chart.js h3-js
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Install at least one AI SDK provider:
|
|
24
|
+
Install at least one AI SDK provider, plus `@ai-sdk/react` for the `useChat` example below:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
# Pick one (or more)
|
|
28
28
|
pnpm add @ai-sdk/openai
|
|
29
29
|
pnpm add @ai-sdk/anthropic
|
|
30
30
|
pnpm add @ai-sdk/azure
|
|
31
|
+
|
|
32
|
+
pnpm add @ai-sdk/react
|
|
31
33
|
```
|
|
32
34
|
|
|
33
35
|
## Quick start
|
|
@@ -79,11 +81,11 @@ function ChatPanel() {
|
|
|
79
81
|
}
|
|
80
82
|
```
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
For a full working app, see the [traffic agent example](https://docs.tomtom.com/maps-sdk-js/examples/map-traffic-agent-react).
|
|
83
85
|
|
|
84
86
|
## Tools reference
|
|
85
87
|
|
|
86
|
-
The plugin ships a `DEFAULT_TOOLS` registry
|
|
88
|
+
The plugin ships a `DEFAULT_TOOLS` registry that covers search, routing, traffic, reachable areas, BYOD GeoJSON, base-map control, MapLibre access and code-generated analysis. The agent gets every tool by default, and you can remove or replace each one through the [`tools` option](#composing-tool-sets). The [Agent Toolkit guide](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/tools) has the full per-tool reference.
|
|
87
89
|
|
|
88
90
|
### Location & search
|
|
89
91
|
|
|
@@ -94,30 +96,31 @@ The plugin ships a `DEFAULT_TOOLS` registry covering search, routing, traffic, r
|
|
|
94
96
|
| `discoverPlaces` | Search for places by text query or POI category within an area |
|
|
95
97
|
| `getPOICategoryCodes` | Look up TomTom POI category codes from natural-language names |
|
|
96
98
|
| `getCurrentLocation` | Get the user's physical GPS location from the browser |
|
|
97
|
-
| `getViewport` | Get current map center, zoom
|
|
99
|
+
| `getViewport` | Get the current map center, zoom and bounding box |
|
|
98
100
|
|
|
99
101
|
### Routing & reachable areas
|
|
100
102
|
|
|
101
103
|
| Tool | Description |
|
|
102
104
|
|---|---|
|
|
103
|
-
| `setRoute` | Calculate or recalculate a route — provide `locations` (waypoints), `parameters` (route options)
|
|
105
|
+
| `setRoute` | Calculate or recalculate a route — provide `locations` (waypoints), `parameters` (route options) or both |
|
|
104
106
|
| `addWaypointsToRoute` | Extend the current route — prepend a new origin, append a new destination, and/or insert intermediate stops |
|
|
105
107
|
| `removeWaypointsFromRoute` | Remove one or more waypoints by index from the current route |
|
|
106
|
-
| `replaceWaypointInRoute` | Overwrite a single waypoint of the current route in place — origin, destination
|
|
108
|
+
| `replaceWaypointInRoute` | Overwrite a single waypoint of the current route in place — origin, destination or by index |
|
|
107
109
|
| `getCurrentWaypoints` | Get the staged waypoint slots (origin, stops, destination) |
|
|
108
110
|
| `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
|
|
110
|
-
| `findReachableAreas` | Calculate isochrone/isodistance polygons from one or more origins (private preview
|
|
111
|
+
| `stopRouteMonitor` | Stop recalculating a route. The entry keeps its last data |
|
|
112
|
+
| `findReachableAreas` | Calculate isochrone/isodistance polygons from one or more origins (in private preview, so the API key needs Calculate Reachable Range access) |
|
|
111
113
|
|
|
112
114
|
### Traffic
|
|
113
115
|
|
|
114
116
|
| Tool | Description |
|
|
115
117
|
|---|---|
|
|
116
|
-
| `getTrafficIncidents` | Fetch traffic incidents within an area (viewport, named place, route corridor, polygon, IDs)
|
|
118
|
+
| `getTrafficIncidents` | Fetch traffic incidents within an area (viewport, named place, route corridor, polygon, IDs). By default, the entry keeps refreshing |
|
|
117
119
|
| `setTrafficIncidentsMonitor` | Turn background refreshing of an already-loaded incidents entry on or off |
|
|
118
120
|
| `clusterIncidents` | Group loaded incidents into hotspots (DBSCAN) with road and category labels, delay totals and trends |
|
|
119
121
|
| `focusIncidents` | Highlight a subset of incidents (by id / category / severity) on the map and dim the rest |
|
|
120
122
|
| `getTrafficAreaAnalytics` | Fetch historical traffic analytics (speed, congestion, travel time) for an area |
|
|
123
|
+
|
|
121
124
|
### Trackers
|
|
122
125
|
|
|
123
126
|
| Tool | Description |
|
|
@@ -125,30 +128,30 @@ The plugin ships a `DEFAULT_TOOLS` registry covering search, routing, traffic, r
|
|
|
125
128
|
| `createTracker` | Watch loaded entries with generated code and log an alert when its condition turns true (e.g. an incident near a hospital) |
|
|
126
129
|
| `getTrackers` | List the active trackers and whether each is firing |
|
|
127
130
|
| `getTrackerHistory` | Read the alerts and events trackers have logged, for one tracker or since a time |
|
|
128
|
-
| `clearTracker` | Stop a tracker
|
|
131
|
+
| `clearTracker` | Stop a tracker. The entries it watched stay |
|
|
129
132
|
|
|
130
133
|
### Bring-your-own-data (BYOD)
|
|
131
134
|
|
|
132
135
|
| Tool | Description |
|
|
133
136
|
|---|---|
|
|
134
|
-
| `addByodSource` | Ingest a customer-authored GeoJSON source (URL or inline `FeatureCollection`) and profile its shape
|
|
135
|
-
| `setByodLayers` | Restyle a BYOD entry
|
|
136
|
-
| `updateByodDisplay` | Show, hide
|
|
137
|
+
| `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 with `setByodLayers` |
|
|
138
|
+
| `setByodLayers` | Restyle a BYOD entry by replacing its MapLibre layers (type and data-driven paint), using the entry's data `profile` |
|
|
139
|
+
| `updateByodDisplay` | Show, hide or clear BYOD layers on the map |
|
|
137
140
|
|
|
138
|
-
> See the [Bring your own data](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/byod) guide for ingestion patterns, visibility lifecycle
|
|
141
|
+
> See the [Bring your own data](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/byod) guide for ingestion patterns, the visibility lifecycle and how BYOD entries feed into `analyseData` / `processData`.
|
|
139
142
|
|
|
140
143
|
### Unified data tools — scope-aware code generation
|
|
141
144
|
|
|
142
145
|
| Tool | Description |
|
|
143
146
|
|---|---|
|
|
144
|
-
| `analyseData` | Aggregate
|
|
145
|
-
| `processData` | Transform entries into new `places`, `placeConnections`, `geometries`, `byod
|
|
147
|
+
| `analyseData` | Aggregate or chart entries (`places`, `routes`, `incidents`, `geometries`, `trafficAreaAnalytics`, `byod`) with dynamic JS. The scope the classifier emits narrows the schema each turn |
|
|
148
|
+
| `processData` | Transform entries, with dynamic JS, into new `places`, `placeConnections`, `geometries`, `byod` or a `fitOnMap` camera move |
|
|
146
149
|
| `monitorAnalysis` | Start or stop recomputing an `analyseData` analysis whenever its source entries change |
|
|
147
|
-
| `executeMaplibreCode` |
|
|
150
|
+
| `executeMaplibreCode` | Run arbitrary MapLibre JS against the live `Map` instance, an escape hatch for custom layers, animations and raster overlays |
|
|
148
151
|
|
|
149
|
-
> See [Code generation](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/code-generation) for the injected identifiers, output contracts
|
|
152
|
+
> 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.
|
|
150
153
|
|
|
151
|
-
`analyseData`, `processData`, `createTracker` and `clusterIncidents` code is **always isolated in the browser
|
|
154
|
+
`analyseData`, `processData`, `createTracker` and `clusterIncidents` code is **always isolated in the browser**. It runs in a Web Worker inside a sandboxed, opaque-origin iframe with no DOM or network access, terminable on timeout. It needs no configuration, since the SDK lazily loads its own bundled turf and h3 for the worker. The environment, not a setting, decides where the code runs. The browser always isolates it, while Node and SSR always run it on the main thread. That boundary has no equivalent there, so the protection is defense-in-depth only. The optional `codeExecution` only tunes the isolated browser run:
|
|
152
155
|
|
|
153
156
|
```typescript
|
|
154
157
|
const agent = createMapAgent(map, {
|
|
@@ -157,17 +160,17 @@ const agent = createMapAgent(map, {
|
|
|
157
160
|
});
|
|
158
161
|
```
|
|
159
162
|
|
|
160
|
-
> **Experimental
|
|
163
|
+
> **Experimental.** The `e2e-tests/` suite verifies the isolation boundary (CSP egress-block, worker termination, opaque-origin isolation) and runs in CI as a dedicated job. If the iframe can't initialise, the code falls back to the main thread with a warning. The worker bundles `turf`, `h3` and `routeUtils`, so that code, route slicing included, runs fully in the browser. See the [code-generation guide](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/code-generation#data-tool-execution-isolation-experimental).
|
|
161
164
|
|
|
162
165
|
### Map display
|
|
163
166
|
|
|
164
167
|
| Tool | Description |
|
|
165
168
|
|---|---|
|
|
166
|
-
| `updatePlacesDisplay` | Show, hide
|
|
167
|
-
| `updateRoutesDisplay` | Show, hide
|
|
169
|
+
| `updatePlacesDisplay` | Show, hide or restyle place entries on the map |
|
|
170
|
+
| `updateRoutesDisplay` | Show, hide or swap route entries, switch the highlighted alternative or fit the camera |
|
|
168
171
|
| `updateWaypointsDisplay` | Show staged waypoint markers without the route line |
|
|
169
|
-
| `updateTrafficAreaAnalyticsDisplay` |
|
|
170
|
-
| `clearMap` | Remove displayed places, routes, BYOD layers
|
|
172
|
+
| `updateTrafficAreaAnalyticsDisplay` | Show, hide or swap traffic-area-analytics entries |
|
|
173
|
+
| `clearMap` | Remove displayed places, routes, BYOD layers or all features |
|
|
171
174
|
|
|
172
175
|
### Map control
|
|
173
176
|
|
|
@@ -180,15 +183,14 @@ const agent = createMapAgent(map, {
|
|
|
180
183
|
| `setMapStandardStyle` | Switch map style (light, dark, satellite, driving, etc.) |
|
|
181
184
|
| `setLanguage` | Change the language for map labels and API responses |
|
|
182
185
|
| `setGeopoliticalView` | Show disputed borders and territory names from a country's view, for the map and later searches |
|
|
183
|
-
| `setMapStyling` | Set or reset what the base map shows and how it looks
|
|
186
|
+
| `setMapStyling` | Set or reset, by knob id, what the base map shows and how it looks. That covers layer groups such as 3D buildings, the built-in POI icons and their categories, the live traffic overlays and their filters, the hillshade and 3D terrain, sizes, colours, map presets, or a whole theme from a few colours or an image. It also sets the look of every layer the agent drew: places, routes and their sections, polygons, reachable areas, area analytics and fetched incidents. The classifier scope lists only the knob families a turn touches |
|
|
184
187
|
|
|
185
188
|
### MapLibre direct access
|
|
186
189
|
|
|
187
190
|
| Tool | Description |
|
|
188
191
|
|---|---|
|
|
189
192
|
| `getMapStyleLayers` | List MapLibre layer IDs with their paint/layout properties |
|
|
190
|
-
| `
|
|
191
|
-
| `setPaintProperties` | Set MapLibre paint properties (colors, widths, opacity) on named layers |
|
|
193
|
+
| `setLayerProperties` | Set MapLibre paint (colors, widths, opacity) and layout (visibility, text, sizes) properties on named layers |
|
|
192
194
|
|
|
193
195
|
### State & recall
|
|
194
196
|
|
|
@@ -208,7 +210,7 @@ const agent = createMapAgent(map, {
|
|
|
208
210
|
|
|
209
211
|
## Customization
|
|
210
212
|
|
|
211
|
-
> See [Customizing tools](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/customizing-tools) for the full walkthrough
|
|
213
|
+
> See [Customizing tools](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/customizing-tools) for the full walkthrough. It covers registry resolution, removing or replacing defaults, adding scopable custom tools and starting from a blank slate.
|
|
212
214
|
|
|
213
215
|
### `createMapAgent` options
|
|
214
216
|
|
|
@@ -275,7 +277,7 @@ const agent = createMapAgent<MyState>(map, {
|
|
|
275
277
|
|
|
276
278
|
### Composing tool sets
|
|
277
279
|
|
|
278
|
-
The `tools` option
|
|
280
|
+
The plugin merges the `tools` option with the built-in defaults. To exclude a tool, set it to `false`.
|
|
279
281
|
|
|
280
282
|
```typescript
|
|
281
283
|
import { createMapAgent } from '@tomtom-org/maps-sdk-plugin-agent-toolkit';
|
|
@@ -305,7 +307,7 @@ createMapAgent(map, { model, includeDefaultTools: false, tools: { myTool } });
|
|
|
305
307
|
|
|
306
308
|
### Defining custom tools
|
|
307
309
|
|
|
308
|
-
|
|
310
|
+
To define custom tools type-safely, use `satisfies`:
|
|
309
311
|
|
|
310
312
|
```typescript
|
|
311
313
|
import { type ToolEntry, createMapAgent } from '@tomtom-org/maps-sdk-plugin-agent-toolkit';
|
|
@@ -334,11 +336,12 @@ createMapAgent(map, { model, tools: fleetTools });
|
|
|
334
336
|
Every tool (built-in or custom) follows the `ToolEntry` interface:
|
|
335
337
|
|
|
336
338
|
```typescript
|
|
337
|
-
type ToolEntry<S extends ToolState = ToolState> = {
|
|
339
|
+
type ToolEntry<S extends ToolState = ToolState, Scope = unknown> = {
|
|
338
340
|
description: string; // Operational contract for the LLM
|
|
339
341
|
inputSchema: z.ZodType; // Zod schema for input validation
|
|
340
342
|
outputSchema?: z.ZodType; // Optional structured output schema
|
|
341
|
-
|
|
343
|
+
// options.signal is the turn's AbortSignal: forward it to the services calls the tool makes
|
|
344
|
+
execute: (input, state: S, options?: ToolExecuteOptions) => Promise<any>;
|
|
342
345
|
|
|
343
346
|
// Classifier metadata (optional)
|
|
344
347
|
classificationPrompt?: string; // One-liner for the intent classifier
|
|
@@ -347,14 +350,20 @@ type ToolEntry<S extends ToolState = ToolState> = {
|
|
|
347
350
|
examplePrompts?: string[]; // Natural language prompt examples
|
|
348
351
|
relatedTools?: string[]; // Tools often used together
|
|
349
352
|
dependsOn?: string[]; // Tools that must run before this one
|
|
353
|
+
scopeSchema?: z.ZodType<Scope>; // Per-turn scope the classifier may emit to narrow the tool
|
|
354
|
+
scopePrompt?: string; // Classifier hint on when and how to scope the tool
|
|
355
|
+
|
|
356
|
+
// Loop control (optional)
|
|
357
|
+
alwaysActive?: boolean; // Visible on every step, whatever the classifier picks
|
|
358
|
+
endsTurnOnCall?: boolean; // Stop the loop on the step that calls this tool
|
|
350
359
|
};
|
|
351
360
|
```
|
|
352
361
|
|
|
353
362
|
## State management
|
|
354
363
|
|
|
355
|
-
> See the [State](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/state) guide for a per-slice deep dive, `entryMode` semantics (`multiple` vs `single`), inspecting state from your application
|
|
364
|
+
> See the [State](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/state) guide for a per-slice deep dive, `entryMode` semantics (`multiple` vs `single`), inspecting state from your application and adding custom slices.
|
|
356
365
|
|
|
357
|
-
`ToolState`
|
|
366
|
+
`ToolState` holds one slice per feature area. Each slice manages lazily initialized map modules and an append-only history of the results the session produces. The built-in slices are:
|
|
358
367
|
|
|
359
368
|
- `PlacesState` — place / geometry entry history
|
|
360
369
|
- `RoutingState` — route history, planning waypoint slots, route parameters
|
|
@@ -362,12 +371,12 @@ type ToolEntry<S extends ToolState = ToolState> = {
|
|
|
362
371
|
- `CustomGeometriesState` — derived polygon entries produced by `processData` (union, difference, h3-coverage, …)
|
|
363
372
|
- `BYODState` — bring-your-own-data GeoJSON layer entries
|
|
364
373
|
- `BaseMapState` — viewport, style, language, raw `mapLibreMap`
|
|
365
|
-
- `TrafficTilesState` — real-time traffic flow
|
|
374
|
+
- `TrafficTilesState` — visibility of the real-time traffic flow and incident tile overlays
|
|
366
375
|
- `TrafficAreaAnalyticsState` — historical traffic-area-analytics entries and per-entry visualisation
|
|
367
|
-
- `TrafficIncidentsState` — fetched incident entries, registered analyses, focused subsets
|
|
376
|
+
- `TrafficIncidentsState` — fetched incident entries, registered analyses, focused subsets and the optional polling monitor
|
|
368
377
|
- `MapPOIsState` — POI category visibility and filters
|
|
369
378
|
|
|
370
|
-
|
|
379
|
+
`createMapAgent` constructs the built-in slices. To add custom slices, define an interface that extends `ToolState` and pass it as the type parameter. You provide only the custom fields:
|
|
371
380
|
|
|
372
381
|
```typescript
|
|
373
382
|
interface MyState extends ToolState {
|
|
@@ -387,14 +396,14 @@ agent.state.places; // PlacesState — append-only history of place entries
|
|
|
387
396
|
|
|
388
397
|
> See the [What the agent sends, and where](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/what-the-agent-sends) guide for the full list.
|
|
389
398
|
|
|
390
|
-
- **What reaches your model provider**: every message and the system prompt
|
|
399
|
+
- **What reaches your model provider**: every message and the system prompt, plus the classifier's copy of earlier messages. By default, that copy holds up to eight messages of 300 characters each, and `classifier: false` turns it off. Tool results go too, including addresses, coordinates, the viewport, the device location, `analyseData` and `processData` output over your BYOD data, and up to 200 events per tracker.
|
|
391
400
|
- **The provider is your processor**: sign a DPA with it and pick an EEA region where it offers one.
|
|
392
|
-
- **What stays in memory**: `agent.state`, until the `resetState` tool or `agent.destroy()
|
|
393
|
-
- **To send less**: remove tools (`getCurrentLocation: false`), turn off the classifier
|
|
401
|
+
- **What stays in memory**: `agent.state`, until the `resetState` tool or `agent.destroy()` clears it. Nothing goes to browser storage. Chat history is yours, so erasing a user's data means clearing it and calling `agent.destroy()`.
|
|
402
|
+
- **To send less**: remove tools (`getCurrentLocation: false`), turn off the classifier or replace a tool with one that returns less.
|
|
394
403
|
|
|
395
404
|
## Intent classifier
|
|
396
405
|
|
|
397
|
-
The intent classifier is an optional per-turn optimization
|
|
406
|
+
The intent classifier is an optional per-turn optimization. It picks which tools the LLM sees, which cuts noise and improves accuracy. The [How it works](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/how-it-works) guide covers the full two-phase pipeline (classification, then the tool loop), prompt assembly and observability hooks.
|
|
398
407
|
|
|
399
408
|
```typescript
|
|
400
409
|
import { createMapAgent, createDefaultClassifier } from '@tomtom-org/maps-sdk-plugin-agent-toolkit';
|
|
@@ -415,13 +424,13 @@ const agent = createMapAgent(map, {
|
|
|
415
424
|
});
|
|
416
425
|
```
|
|
417
426
|
|
|
418
|
-
The classifier prompt
|
|
427
|
+
The plugin builds the classifier prompt on the fly from each tool's `classificationPrompt` and `relatedTools` metadata, so the prompt stays in sync when you add or rename tools.
|
|
419
428
|
|
|
420
429
|
## System prompt
|
|
421
430
|
|
|
422
|
-
The built-in `BASE_SYSTEM_PROMPT` covers identity, a capability summary, scope/rejection rules, response formatting, data-confidence rules, tool-execution guidance
|
|
431
|
+
The built-in `BASE_SYSTEM_PROMPT` covers identity, a capability summary, scope/rejection rules, response formatting, data-confidence rules, tool-execution guidance and session-state conventions. Per-tool mechanics (coordinate order, location-reference routing, etc.) live in the tool descriptions and the classifier prompt, not here.
|
|
423
432
|
|
|
424
|
-
`systemPrompt` accepts **either** a full replacement string **or** a section-overrides object (`Partial<Record<SystemPromptSection, string>>`)
|
|
433
|
+
`systemPrompt` accepts **either** a full replacement string **or** a section-overrides object (`Partial<Record<SystemPromptSection, string>>`). Sections you omit keep their defaults. For a section you override, you supply only its body, and the plugin adds the heading:
|
|
425
434
|
|
|
426
435
|
```typescript
|
|
427
436
|
import {
|
|
@@ -473,7 +482,7 @@ const agent = createMapAgent(map, {
|
|
|
473
482
|
|
|
474
483
|
### Wrapping default tools
|
|
475
484
|
|
|
476
|
-
|
|
485
|
+
To add logging, analytics or custom behavior around an existing tool, wrap it:
|
|
477
486
|
|
|
478
487
|
```typescript
|
|
479
488
|
import { DEFAULT_TOOLS, createMapAgent } from '@tomtom-org/maps-sdk-plugin-agent-toolkit';
|
|
@@ -516,8 +525,7 @@ const agent = createMapAgent(map, {
|
|
|
516
525
|
tools: {
|
|
517
526
|
setMapStandardStyle: false,
|
|
518
527
|
setLanguage: false,
|
|
519
|
-
|
|
520
|
-
setPaintProperties: false,
|
|
528
|
+
setLayerProperties: false,
|
|
521
529
|
setMapStyling: false,
|
|
522
530
|
},
|
|
523
531
|
});
|
|
@@ -536,15 +544,16 @@ agent.destroy(); // Reset all state slices (call on unmount)
|
|
|
536
544
|
|
|
537
545
|
## Public API exports
|
|
538
546
|
|
|
539
|
-
The main entry point is `createMapAgent
|
|
547
|
+
The main entry point is `createMapAgent`. `DEFAULT_TOOLS` and `BASE_SYSTEM_PROMPT` cover the most common customizations, as the examples above show.
|
|
540
548
|
|
|
541
|
-
For the complete, always-current list of exports
|
|
549
|
+
For the complete, always-current list of exports, including factories, tool-registry helpers, state introspection, the classifier and all types, see the [API reference](https://docs.tomtom.com/maps-sdk-js/reference).
|
|
542
550
|
|
|
543
551
|
## Dependencies
|
|
544
552
|
|
|
545
553
|
| Type | Package | Purpose |
|
|
546
554
|
|---|---|---|
|
|
547
|
-
| Peer | `@tomtom-org/maps-sdk` | TomTom Maps SDK (types, services, map modules) |
|
|
555
|
+
| Peer | `@tomtom-org/maps-sdk@>=1.0.0-rc.0 <1.0.0` | TomTom Maps SDK (types, services, map modules) — its 1.0.0 release candidates |
|
|
556
|
+
| Peer | `@tomtom-org/maps-sdk-plugin-map-theme@>=0.3.0` | Theming the map from a few colours or an image in `setMapStyling` |
|
|
548
557
|
| Peer | `ai@^6` | Vercel AI SDK (ToolLoopAgent, tool types) |
|
|
549
558
|
| Peer | `zod@^4` | Schema validation |
|
|
550
559
|
| Peer | `maplibre-gl@^6` | Map rendering engine |
|
|
@@ -558,13 +567,13 @@ For the complete, always-current list of exports — factories, tool-registry he
|
|
|
558
567
|
- [How it works](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/how-it-works) — two-phase pipeline (classifier + tool loop), prompt assembly, observability
|
|
559
568
|
- [Tools](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/tools) — per-tool reference
|
|
560
569
|
- [State](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/state) — per-slice reference, entry modes, custom slices
|
|
561
|
-
- [Customizing tools](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/customizing-tools) — add, replace, remove
|
|
570
|
+
- [Customizing tools](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/customizing-tools) — add, replace, remove or start from a blank slate
|
|
562
571
|
- [Code generation](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/code-generation) — `analyseData` / `processData` / `createTracker` / `clusterIncidents` / `executeMaplibreCode` (threat model included)
|
|
563
572
|
- [Scope-aware data tools](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/scope-aware-data-tools) — per-turn scope mechanism
|
|
564
573
|
- [Bring your own data](https://docs.tomtom.com/maps-sdk-js/guides/plugins/agent-toolkit/byod) — ingest customer GeoJSON layers
|
|
565
574
|
- [AI SDK v6 documentation](https://ai-sdk.dev/)
|
|
566
575
|
- [TomTom Maps SDK documentation](https://docs.tomtom.com/maps-sdk-js)
|
|
567
|
-
- [Example application](
|
|
576
|
+
- [Example application](https://docs.tomtom.com/maps-sdk-js/examples/map-traffic-agent-react) — full chat interface implementation
|
|
568
577
|
|
|
569
578
|
## License
|
|
570
579
|
|
package/THIRD_PARTY.txt
CHANGED
|
@@ -49,7 +49,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
49
49
|
---
|
|
50
50
|
|
|
51
51
|
Name: ai
|
|
52
|
-
Version: 6.0.
|
|
52
|
+
Version: 6.0.302
|
|
53
53
|
License: Apache-2.0
|
|
54
54
|
Bundled: false (peer dependency)
|
|
55
55
|
Description: AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.
|
|
@@ -334,7 +334,7 @@ limitations under the License.
|
|
|
334
334
|
---
|
|
335
335
|
|
|
336
336
|
Name: maplibre-gl
|
|
337
|
-
Version: 6.
|
|
337
|
+
Version: 6.13.0
|
|
338
338
|
License: BSD-3-Clause
|
|
339
339
|
Bundled: false (peer dependency)
|
|
340
340
|
Description: BSD licensed community fork of mapbox-gl, a WebGL interactive maps library
|
package/dist/THIRD_PARTY.txt
CHANGED
|
@@ -39,7 +39,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
39
39
|
---
|
|
40
40
|
|
|
41
41
|
Name: ai
|
|
42
|
-
Version: 6.0.
|
|
42
|
+
Version: 6.0.302
|
|
43
43
|
License: Apache-2.0
|
|
44
44
|
Bundled: false (peer dependency)
|
|
45
45
|
Description: AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.
|
|
@@ -324,7 +324,7 @@ limitations under the License.
|
|
|
324
324
|
---
|
|
325
325
|
|
|
326
326
|
Name: maplibre-gl
|
|
327
|
-
Version: 6.
|
|
327
|
+
Version: 6.13.0
|
|
328
328
|
License: BSD-3-Clause
|
|
329
329
|
Bundled: false (peer dependency)
|
|
330
330
|
Description: BSD licensed community fork of mapbox-gl, a WebGL interactive maps library
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseMapModule, CustomGeoJSONLayerSpec, CustomGeoJSONModule, GeometriesModule, GeometryFillStyle, POIsModule, PlaceConnectionDisplay, PlacesModule, PlanningWaypoint, ReachableRangesModule, RoutingModule, StylingFoundationsModule, TerrainModule, TomTomMap, TrafficAreaAnalyticsModule, TrafficAreaAnalyticsModuleConfig, TrafficFlowModule, TrafficIncidentDetailsModule, TrafficIncidentsModule } from "@tomtom-org/maps-sdk/map";
|
|
1
|
+
import { BaseMapModule, CustomGeoJSONLayerSpec, CustomGeoJSONModule, GeometriesModule, GeometryFillStyle, KnobEntry, KnobTarget, POIsModule, PlaceConnectionDisplay, PlacesModule, PlanningWaypoint, ReachableRangesModule, RoutingModule, StylingFoundationsModule, TerrainModule, TomTomMap, TrafficAreaAnalyticsModule, TrafficAreaAnalyticsModuleConfig, TrafficFlowModule, TrafficIncidentDetailsModule, TrafficIncidentsModule } from "@tomtom-org/maps-sdk/map";
|
|
2
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";
|
|
@@ -719,6 +719,38 @@ declare class BaseMapState implements StateSlice {
|
|
|
719
719
|
reset(): void;
|
|
720
720
|
}
|
|
721
721
|
//#endregion
|
|
722
|
+
//#region src/state/slice-knobs.d.ts
|
|
723
|
+
/**
|
|
724
|
+
* The knobs set on every module of one kind a slice holds: the modules it holds now, and each one
|
|
725
|
+
* it creates later through {@link SliceKnobs.applyTo}. `setMapStyling` sets the knobs of the
|
|
726
|
+
* places, routes, geometries, ranges and traffic modules the agent drew through it.
|
|
727
|
+
*
|
|
728
|
+
* @group Agent Toolkit
|
|
729
|
+
*/
|
|
730
|
+
declare class SliceKnobs {
|
|
731
|
+
readonly catalogue: readonly KnobEntry<string>[];
|
|
732
|
+
private readonly modules;
|
|
733
|
+
private readonly _values;
|
|
734
|
+
/**
|
|
735
|
+
* @param catalogue - The catalogue of the module kind, e.g. `routingKnobCatalogue`.
|
|
736
|
+
* @param modules - The modules of that kind the slice holds now.
|
|
737
|
+
*/
|
|
738
|
+
constructor(catalogue: readonly KnobEntry<string>[], modules: () => Iterable<KnobTarget<unknown>>);
|
|
739
|
+
/** Every knob set, by its id in the catalogue. */
|
|
740
|
+
get values(): Readonly<Record<string, unknown>>;
|
|
741
|
+
/** Sets the knob on every module, and remembers it for those created later. Throws on an invalid value. */
|
|
742
|
+
set(id: string, value: unknown): void;
|
|
743
|
+
/** Resets the knob on every module to its default, and forgets it. */
|
|
744
|
+
reset(id: string): void;
|
|
745
|
+
/** Resets every knob set. */
|
|
746
|
+
resetAll(): void;
|
|
747
|
+
/** Forgets every knob set without touching the modules, for a slice dropping them. */
|
|
748
|
+
clear(): void;
|
|
749
|
+
/** Sets every knob remembered on a module the slice just created, and returns it. */
|
|
750
|
+
applyTo<MODULE extends KnobTarget<unknown>>(module: MODULE): MODULE;
|
|
751
|
+
private _knob;
|
|
752
|
+
}
|
|
753
|
+
//#endregion
|
|
722
754
|
//#region src/tools/shared/agent-headers.d.ts
|
|
723
755
|
/**
|
|
724
756
|
* @module agent-toolkit-tools
|
|
@@ -1193,6 +1225,10 @@ declare class PlacesState implements StateSlice {
|
|
|
1193
1225
|
private _entryMode;
|
|
1194
1226
|
/** The state change events, listed in {@link PlacesStateEvents}. */
|
|
1195
1227
|
readonly events: StateEvents<PlacesStateEvents>;
|
|
1228
|
+
/** The knobs set on every entry's PlacesModule, such as `color` and `label.size`. Cleared on `reset`. */
|
|
1229
|
+
readonly knobs: SliceKnobs;
|
|
1230
|
+
/** The knobs set on every entry's boundary GeometriesModule. Cleared on `reset`. */
|
|
1231
|
+
readonly geometriesKnobs: SliceKnobs;
|
|
1196
1232
|
constructor(_ttMap: TomTomMap);
|
|
1197
1233
|
/**
|
|
1198
1234
|
* The display policy. `multiple` (default) keeps every history entry available to render
|
|
@@ -1214,8 +1250,8 @@ declare class PlacesState implements StateSlice {
|
|
|
1214
1250
|
getEntryPlacesModule(entryId: string, markerType: PlacesMarkerType): Promise<PlacesModule>;
|
|
1215
1251
|
/**
|
|
1216
1252
|
* Returns the entry's place-geometries module for POI footprints and municipality outlines,
|
|
1217
|
-
* created on first call.
|
|
1218
|
-
* unknown entry id.
|
|
1253
|
+
* created on first call. Updates only the fill style when it changes, keeping the styling
|
|
1254
|
+
* applied since. Throws on an unknown entry id.
|
|
1219
1255
|
*/
|
|
1220
1256
|
getEntryGeometriesModule(entryId: string, fillStyle?: GeometryFillStyle): Promise<GeometriesModule>;
|
|
1221
1257
|
private _requireEntry;
|
|
@@ -1430,6 +1466,12 @@ declare class RangeState implements ShownEntriesSlice {
|
|
|
1430
1466
|
private _entryMode;
|
|
1431
1467
|
/** The state change events, listed in {@link RangeStateEvents}. */
|
|
1432
1468
|
readonly events: StateEvents<RangeStateEvents>;
|
|
1469
|
+
/** The knobs set on every entry's ReachableRangesModule, such as `fill.opacity`. Cleared on `reset`. */
|
|
1470
|
+
readonly knobs: SliceKnobs;
|
|
1471
|
+
/** The knobs set on every entry's GeometriesModule, the one drawing in a style of your own. Cleared on `reset`. */
|
|
1472
|
+
readonly geometriesKnobs: SliceKnobs;
|
|
1473
|
+
/** The knobs set on every entry's origin-pin PlacesModule. Cleared on `reset`. */
|
|
1474
|
+
readonly placesKnobs: SliceKnobs;
|
|
1433
1475
|
constructor(_ttMap: TomTomMap);
|
|
1434
1476
|
/** Set of ranges-entry ids currently rendered on the map. */
|
|
1435
1477
|
get shownEntryIds(): ReadonlySet<string>;
|
|
@@ -1705,12 +1747,8 @@ declare class RoutingState implements ShownEntriesSlice {
|
|
|
1705
1747
|
private _planningSlots;
|
|
1706
1748
|
private _params;
|
|
1707
1749
|
private _entryMode;
|
|
1708
|
-
/**
|
|
1709
|
-
|
|
1710
|
-
* across entry swaps so the rendered route always uses the most recently requested color.
|
|
1711
|
-
* Set via {@link setColor}; persists for the lifetime of the slice (cleared on `reset`).
|
|
1712
|
-
*/
|
|
1713
|
-
private _color?;
|
|
1750
|
+
/** The knobs set on every entry's RoutingModule, `color` and `widthFactor` among them. Cleared on `reset`. */
|
|
1751
|
+
readonly knobs: SliceKnobs;
|
|
1714
1752
|
/**
|
|
1715
1753
|
* The most recently `.showEntry`-ed id. Tracks "who was last brought up" so tools that
|
|
1716
1754
|
* operate on the focused module have a single pointer to read; the authoritative shown
|
|
@@ -1754,15 +1792,6 @@ declare class RoutingState implements ShownEntriesSlice {
|
|
|
1754
1792
|
showWaypoints?: boolean;
|
|
1755
1793
|
showSummaryBubbles?: boolean;
|
|
1756
1794
|
}): Promise<void>;
|
|
1757
|
-
/** The slice-level route colour, persisted across entry swaps. Undefined if none was set. */
|
|
1758
|
-
get color(): string | undefined;
|
|
1759
|
-
/**
|
|
1760
|
-
* Sets the slice-level route colour. It applies immediately to every shown entry's
|
|
1761
|
-
* RoutingModule, and later {@link showEntry} calls apply it automatically. Pass `undefined` to
|
|
1762
|
-
* clear the sticky colour. Shown modules then keep their last paint until they're re-shown,
|
|
1763
|
-
* and MapLibre style restore handles the full revert.
|
|
1764
|
-
*/
|
|
1765
|
-
setColor(color: string | undefined): void;
|
|
1766
1795
|
/**
|
|
1767
1796
|
* Hides the entry's routes and waypoints by clearing its module, which stays cached.
|
|
1768
1797
|
* Does nothing if the entry is unknown or already hidden.
|
|
@@ -2046,6 +2075,12 @@ declare class TrafficAreaAnalyticsState implements ShownEntriesSlice, StateSlice
|
|
|
2046
2075
|
private _entryMode;
|
|
2047
2076
|
/** The state change events, listed in {@link TrafficAreaAnalyticsStateEvents}. */
|
|
2048
2077
|
readonly events: StateEvents<TrafficAreaAnalyticsStateEvents>;
|
|
2078
|
+
/**
|
|
2079
|
+
* The knobs set on every entry's TrafficAreaAnalyticsModule, such as `displayMode` and
|
|
2080
|
+
* `metrics.congestionLevel.palette`. An entry that did not fetch the `activeMetric` set shows
|
|
2081
|
+
* the first metric it fetched. Cleared on `reset`.
|
|
2082
|
+
*/
|
|
2083
|
+
readonly knobs: SliceKnobs;
|
|
2049
2084
|
constructor(_ttMap: TomTomMap);
|
|
2050
2085
|
get entries(): readonly TrafficAreaAnalyticsEntry[];
|
|
2051
2086
|
get latestEntry(): TrafficAreaAnalyticsEntry | undefined;
|
|
@@ -2414,6 +2449,8 @@ declare class TrafficIncidentsState implements StateSlice {
|
|
|
2414
2449
|
private readonly _clusters;
|
|
2415
2450
|
/** The state change events, listed in {@link TrafficIncidentsStateEvents}. */
|
|
2416
2451
|
readonly events: StateEvents<TrafficIncidentsStateEvents>;
|
|
2452
|
+
/** The knobs set on every entry's TrafficIncidentDetailsModule. Cleared on `reset`. */
|
|
2453
|
+
readonly knobs: SliceKnobs;
|
|
2417
2454
|
constructor(_ttMap: TomTomMap);
|
|
2418
2455
|
get entries(): readonly TrafficIncidentsEntry[];
|
|
2419
2456
|
/**
|
|
@@ -3408,8 +3445,6 @@ type CustomGeometriesEntry = BaseEntry<PolygonFeature[]> & {
|
|
|
3408
3445
|
* module. Lazy-initialised via CustomGeometriesState helpers.
|
|
3409
3446
|
*/
|
|
3410
3447
|
_module?: GeometriesModule;
|
|
3411
|
-
/** Fill style that the geometries module is currently configured with. */
|
|
3412
|
-
_shownFillStyle?: GeometryFillStyle;
|
|
3413
3448
|
/** True while this entry's `_module` is rendering on the map. */
|
|
3414
3449
|
_shown?: boolean;
|
|
3415
3450
|
};
|
|
@@ -3452,6 +3487,8 @@ declare class CustomGeometriesState implements ShownEntriesSlice, StateSlice {
|
|
|
3452
3487
|
private _entryMode;
|
|
3453
3488
|
/** The state change events, listed in {@link CustomGeometriesStateEvents}. */
|
|
3454
3489
|
readonly events: StateEvents<CustomGeometriesStateEvents>;
|
|
3490
|
+
/** The knobs set on every entry's GeometriesModule, such as `line.width`. Cleared on `reset`. */
|
|
3491
|
+
readonly knobs: SliceKnobs;
|
|
3455
3492
|
constructor(_ttMap: TomTomMap);
|
|
3456
3493
|
get entries(): readonly CustomGeometriesEntry[];
|
|
3457
3494
|
get latestEntry(): CustomGeometriesEntry | undefined;
|
|
@@ -3470,7 +3507,10 @@ declare class CustomGeometriesState implements ShownEntriesSlice, StateSlice {
|
|
|
3470
3507
|
* suffix (`-2`, `-3`, ...). In `single` mode the new entry replaces every older one.
|
|
3471
3508
|
*/
|
|
3472
3509
|
addEntry(features: PolygonFeature<CommonPlaceProps>[], provenance: CustomGeometriesEntry['provenance'], label: string, explicitId?: string): Promise<string>;
|
|
3473
|
-
/**
|
|
3510
|
+
/**
|
|
3511
|
+
* Initialises the entry's GeometriesModule lazily. Updates only the fill style when it changes,
|
|
3512
|
+
* keeping the styling applied since.
|
|
3513
|
+
*/
|
|
3474
3514
|
getEntryGeometriesModule(entryId: string, fillStyle?: GeometryFillStyle): Promise<GeometriesModule>;
|
|
3475
3515
|
/**
|
|
3476
3516
|
* Renders the entry's polygons. `mode` applies to this entry's own layer only:
|
|
@@ -3961,8 +4001,7 @@ export declare const DEFAULT_TOOLS: {
|
|
|
3961
4001
|
setGeopoliticalView: ToolDefinition;
|
|
3962
4002
|
setMapStyling: ToolDefinition;
|
|
3963
4003
|
getMapStyleLayers: ToolDefinition;
|
|
3964
|
-
|
|
3965
|
-
setPaintProperties: ToolDefinition;
|
|
4004
|
+
setLayerProperties: ToolDefinition;
|
|
3966
4005
|
setPitchBearing: ToolDefinition;
|
|
3967
4006
|
zoomInOrOut: ToolDefinition;
|
|
3968
4007
|
executeMaplibreCode: ToolDefinition;
|