@tomtom-org/maps-sdk-plugin-agent-toolkit 0.13.0 → 0.14.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/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { LanguageModel, ModelMessage, PrepareStepFunction, ToolLoopAgent } from
10
10
  type JobSpec = {
11
11
  /** Ids of every entry this job reads. The engine re-runs the job when any of them changes. */
12
12
  affectedEntryIds: readonly string[];
13
- /** The recipe, opaque to the engine — stored as the single home of the code + for re-arm change-detect. */
13
+ /** The recipe, opaque to the engine and the single home of the code, compared on re-arm to detect change. */
14
14
  code: string;
15
15
  /** Whether the engine scans this job. A paused job (`false`) is retained but never run. */
16
16
  active: boolean;
@@ -21,20 +21,20 @@ type JobSpec = {
21
21
  };
22
22
  /** A registered job, handed back to the owner as the reference linking a sink record to its recurrence. */
23
23
  interface Job {
24
- /** Ids of every entry this job reads (immutable; a re-arm with different sources is a different job). */
24
+ /** Ids of every entry this job reads (immutable, as a re-arm with different sources is a different job). */
25
25
  readonly affectedEntryIds: readonly string[];
26
- /** The recipe behind this job — compared on re-arm to decide whether to drop stale history. */
26
+ /** The recipe behind this job, which a re-arm compares to decide whether to drop stale history. */
27
27
  readonly code: string;
28
28
  /** Whether the engine currently scans this job. */
29
29
  readonly active: boolean;
30
- /** Pause (`false`) or resume (`true`) scanning. A paused job keeps its recipe for later promotion. */
30
+ /** Pauses (`false`) or resumes (`true`) scanning. A paused job keeps its recipe for later promotion. */
31
31
  setActive(active: boolean): void;
32
- /** Remove the job from the engine. The owner drops its stored reference. */
32
+ /** Removes the job from the engine. The owner drops its stored reference. */
33
33
  unregister(): void;
34
34
  }
35
35
  /**
36
- * Session-level recurrence engine. Held on `ToolState` as `state.engine`; constructed and wired by the
37
- * state factory. Owners ({@link Analyses}, {@link EventsState}) register jobs and keep the returned
36
+ * Session-level recurrence engine, held on `ToolState` as `state.engine`, which the state factory
37
+ * constructs and wires. Owners ({@link Analyses}, {@link EventsState}) register jobs and keep the returned
38
38
  * handles.
39
39
  *
40
40
  * @group Agent Toolkit
@@ -45,12 +45,12 @@ declare class JobEngine {
45
45
  private scanning;
46
46
  private scheduled;
47
47
  private pending;
48
- /** Register a job and return its handle. Stored by the owner as its reference to the recurrence. */
48
+ /** Registers a job and returns its handle, which the owner stores as its reference to the recurrence. */
49
49
  register(spec: JobSpec): Job;
50
50
  /** @internal — called by {@link JobHandle.unregister}. */
51
51
  drop(job: JobHandle): void;
52
52
  /**
53
- * Subscribe the scan to every input slice's `entries-change`, exactly once per session. The state
53
+ * Subscribes the scan to every input slice's `entries-change`, exactly once per session. The state
54
54
  * factory calls this at construction (it holds the slices), so every `ToolState` gets a live engine
55
55
  * without the job builders having to wire lazily.
56
56
  */
@@ -61,7 +61,7 @@ declare class JobEngine {
61
61
  private hasActiveJob;
62
62
  private scheduleScan;
63
63
  private runScan;
64
- /** Drop every job. Walked automatically by `destroyState` (duck-typed `reset`). Subscriptions persist
64
+ /** Drops every job. `destroyState` calls it automatically (duck-typed `reset`). Subscriptions persist
65
65
  * (harmless without jobs), mirroring the one-shot `wired` guard. */
66
66
  reset(): void;
67
67
  }
@@ -80,8 +80,8 @@ declare class JobHandle implements Job {
80
80
  //#region src/tools/shared/sandbox-code.d.ts
81
81
  export type AnalysisOutputFormat = 'json' | 'chart';
82
82
  /**
83
- * Compact sandbox-code blurb shared by `process-places`, `process-geometries`,
84
- * `analyse-places`, `analyse-geometries`, and `analyse-routes`. Keeps the
83
+ * Compact sandbox-code blurb shared by every code-generation tool, through
84
+ * `buildSandboxToolsDoc`. Keeps the
85
85
  * "what's in scope / what's forbidden" rules short and consistent across all
86
86
  * code-generation tools so the LLM is prompted the same way each time. Pass
87
87
  * the names of the injected identifiers (the params the AsyncFunction body
@@ -118,11 +118,11 @@ export declare const ANALYSE_OUTPUT_FORMAT_DESCRIPTION: string;
118
118
  */
119
119
  export declare const buildAnalyseReturnPrompt: (jsonExamples: string, chartLabelExample?: string) => string;
120
120
  /**
121
- * Validates the value returned by analyse-* sandboxed code: rejects
121
+ * Validates the value returned by sandboxed code: rejects
122
122
  * `undefined`, JSON-normalizes via `toJsonSafe`, and — when
123
123
  * `outputFormat: "chart"` — checks the result is a Chart.js
124
- * `ChartConfiguration`. Centralises the contract shared by analyse-places,
125
- * analyse-routes, and analyse-geometries.
124
+ * `ChartConfiguration`. Centralises the contract shared by `analyseData` and every
125
+ * recurring re-run (`sandbox-replay.ts`: monitored analyses, trackers, `clusterIncidents` code).
126
126
  *
127
127
  * @ignore
128
128
  */
@@ -137,11 +137,11 @@ export declare const sandboxedGlobalShadows: readonly ["fetch", "XMLHttpRequest"
137
137
  export declare const WORKER_PROVIDED_PARAMS: readonly ["turf", "h3", "routeUtils", "log", "cluster"];
138
138
  /**
139
139
  * Pluggable strategy for executing sandbox code. The default
140
- * {@link mainThreadExecutor} compiles + runs in the host realm; an alternative
141
- * executor (e.g. the iframe-worker one) can run the same code in a locked-down
140
+ * {@link mainThreadExecutor} compiles and runs in the host realm. An alternative
141
+ * executor, such as the iframe-worker one, can run the same code in a locked-down
142
142
  * realm off the main thread while honouring this exact contract.
143
143
  *
144
- * `run` MUST resolve to `{ value }` or `{ error }` and never reject — execution
144
+ * `run` MUST resolve to `{ value }` or `{ error }` and never reject. Execution
145
145
  * failures are reported as `{ error }` via {@link formatSandboxExecutionError}.
146
146
  *
147
147
  * @group Agent Toolkit
@@ -152,7 +152,7 @@ export type SandboxExecutor = {
152
152
  } | {
153
153
  error: string;
154
154
  }>;
155
- /** Release any held resources (iframe / worker). No-op for the main-thread executor. */
155
+ /** Releases any held resources (iframe / worker). No-op for the main-thread executor. */
156
156
  destroy?(): void;
157
157
  };
158
158
  /**
@@ -168,7 +168,7 @@ export declare const mainThreadExecutor: SandboxExecutor;
168
168
  * Compiles `code` as the body of an `async` function that takes the named
169
169
  * `paramNames`, sanitises injected redeclarations, runs it with `args`, and
170
170
  * returns either `{ value }` or `{ error }`. Centralises the AsyncFunction
171
- * dance shared by every sandbox-running tool (analyse-* and process-*) so
171
+ * dance shared by every sandbox-running tool (analyseData, processData, createTracker, clusterIncidents) so
172
172
  * each callsite only owns its inputs and result handling.
173
173
  *
174
174
  * In addition to the caller's `paramNames`, a fixed set of network / storage /
@@ -207,18 +207,18 @@ export declare const formatSandboxExecutionError: (verb: string, error: unknown)
207
207
  /**
208
208
  * @module agent-toolkit-state
209
209
  *
210
- * Tiny typed event emitter used by every state slice (PlacesState, RoutingState, ...) to notify
211
- * subscribers when their internals change. The shape mirrors the SDK's `ModuleEvents` API
212
- * (`on(type, handler) => unsubscribe`, `off(type)`) so consumers see one consistent pattern across
213
- * the SDK and the agent toolkit. Designed to plug straight into React's `useSyncExternalStore`.
210
+ * A tiny typed event emitter that every state slice (PlacesState, RoutingState, ...) uses to notify
211
+ * subscribers when its internals change. Its shape mirrors the SDK's `ModuleEvents` API
212
+ * (`on(type, handler) => unsubscribe`, `off(type)`), so consumers see one consistent pattern across
213
+ * the SDK and the agent toolkit. It plugs straight into React's `useSyncExternalStore`.
214
214
  *
215
215
  * @group Agent Toolkit
216
216
  */
217
217
  /**
218
- * Generic typed event bus. The `EventMap` parameter declares the set of event names this emitter
219
- * supports along with each event's payload type — `on` and `emit` are then strongly typed against it.
218
+ * A generic typed event bus. The `EventMap` parameter declares the event names this emitter supports
219
+ * and each event's payload type, and `on` and `emit` are strongly typed against it.
220
220
  *
221
- * Usage from outside the slice (subscribe-only):
221
+ * Outside the slice, you can only subscribe:
222
222
  * ```ts
223
223
  * const unsub = state.places.events.on('entries-change', ({ entries }) => render(entries));
224
224
  * // ...
@@ -230,10 +230,10 @@ export declare const formatSandboxExecutionError: (verb: string, error: unknown)
230
230
  declare class StateEvents<EventMap extends Record<string, unknown>> {
231
231
  private readonly handlers;
232
232
  /**
233
- * Subscribe to an event. Returns an unsubscribe function that removes only this handler.
233
+ * Subscribes to an event and returns an unsubscribe function that removes only this handler.
234
234
  */
235
235
  on<K extends keyof EventMap>(type: K, handler: (payload: EventMap[K]) => void): () => void;
236
- /** Remove all handlers for a given event type. Use the unsubscribe from `on` for single-handler removal. */
236
+ /** Removes all handlers for an event type. To remove one handler, call the unsubscribe `on` returns. */
237
237
  off<K extends keyof EventMap>(type: K): void;
238
238
  /**
239
239
  * Fire an event. Internal — only the owning slice should call this. We don't make it `protected`
@@ -243,7 +243,7 @@ declare class StateEvents<EventMap extends Record<string, unknown>> {
243
243
  * @internal
244
244
  */
245
245
  emit<K extends keyof EventMap>(type: K, payload: EventMap[K]): void;
246
- /** Drop every handler for every type. Used by slice `reset()` to detach lingering listeners. */
246
+ /** Removes every handler for every type. A slice's `reset()` calls it to detach lingering listeners. */
247
247
  clear(): void;
248
248
  }
249
249
  //#endregion
@@ -268,12 +268,12 @@ type EntryAnalysis = {
268
268
  data: unknown;
269
269
  };
270
270
  /**
271
- * One analysis tracked by the session-level {@link Analyses} registry — the single home for every
272
- * `analyseData` analysis, one-shot or monitored, across every entry kind. Pure sink state: metadata plus
273
- * the bounded result `history`. The recipe (`code` / `inputs`) and recurrence are NOT here — they live on
274
- * the analysis's {@link Job} (see `_jobs`). `affectedEntryIds` is the per-entry lookup key
275
- * ({@link Analyses.getAnalysesForEntry}); `history` is the result timeline (oldest first), whose latest
276
- * is the current result and is threaded back into the sandbox code as `previous`.
271
+ * One analysis tracked by the session-level {@link Analyses} registry, the single home for every
272
+ * `analyseData` analysis, one-shot or monitored, across every entry kind. It is pure sink state,
273
+ * metadata plus the bounded result `history`. The recipe (`code` / `inputs`) and recurrence are NOT
274
+ * here. They live on the analysis's {@link Job} (see `_jobs`). `affectedEntryIds` is the per-entry
275
+ * lookup key ({@link Analyses.getAnalysesForEntry}). `history` is the result timeline (oldest first),
276
+ * whose latest is the current result, threaded back into the sandbox code as `previous`.
277
277
  *
278
278
  * @group Agent Toolkit
279
279
  */
@@ -289,8 +289,8 @@ type AnalysisRecord = {
289
289
  history: EntryAnalysis[];
290
290
  };
291
291
  /**
292
- * {@link Analyses.register} input — the record's metadata. No `history` (the registry builds that as
293
- * results land) and no recipe (that lives on the {@link Job}).
292
+ * The input of {@link Analyses.register}, the record's metadata. It has no `history` (the registry
293
+ * builds that as results land) and no recipe (that lives on the {@link Job}).
294
294
  *
295
295
  * @group Agent Toolkit
296
296
  */
@@ -311,15 +311,15 @@ type AnalysesEvents = {
311
311
  };
312
312
  };
313
313
  /**
314
- * Session-level registry of EVERY analysis — the single source of truth that replaces the per-entry
315
- * `_analyses` stores. Holds one {@link AnalysisRecord} per analysis (keyed by `analysisId`), each with
316
- * its own bounded result history. Entries carry no analysis state; per-entry views call
317
- * {@link getAnalysesForEntry}. Held on `ToolState` as `state.analyses`.
314
+ * The session-level registry of EVERY analysis, the single source of truth that replaces the per-entry
315
+ * `_analyses` stores. It holds one {@link AnalysisRecord} per analysis (keyed by `analysisId`), each
316
+ * with its own bounded result history. Entries carry no analysis state. Per-entry views call
317
+ * {@link getAnalysesForEntry}. `ToolState` holds it as `state.analyses`.
318
318
  *
319
- * Pure sink: metadata + result history only. The recurrence lives on the {@link JobEngine}; this
320
- * registry keeps each monitored analysis's {@link Job} handle in `_jobs` (keyed by `analysisId`) so it
321
- * can pause/resume it ({@link job}) or compare its `code` on re-arm. A one-shot analysis keeps a paused
322
- * job for later promotion.
319
+ * It is a pure sink of metadata and result history. The recurrence lives on the {@link JobEngine}.
320
+ * This registry keeps each monitored analysis's {@link Job} handle in `_jobs` (keyed by `analysisId`)
321
+ * so it can pause or resume it ({@link job}) or compare its `code` on re-arm. A one-shot analysis keeps
322
+ * a paused job for later promotion.
323
323
  *
324
324
  * @group Agent Toolkit
325
325
  */
@@ -327,36 +327,37 @@ declare class Analyses {
327
327
  private readonly _records;
328
328
  /** analysisId → the {@link Job} backing it (one-shot = paused). The reference linking record to engine. */
329
329
  private readonly _jobs;
330
- /** Subscribe to {@link AnalysesEvents} — fired whenever a result is attached or recomputed. */
330
+ /** The {@link AnalysesEvents} emitter, fired whenever a result is attached or recomputed. */
331
331
  readonly events: StateEvents<AnalysesEvents>;
332
332
  /**
333
- * Insert or replace a record's metadata (NOT its result — use {@link attachResult}; nor its recipe —
334
- * that lives on the {@link Job}). Re-registering an existing `analysisId` preserves its result
335
- * history; callers drop stale history explicitly via {@link resetHistory} when the recipe changes.
333
+ * Inserts or replaces a record's metadata, NOT its result (use {@link attachResult}) or its recipe,
334
+ * which lives on the {@link Job}. Re-registering an existing `analysisId` preserves its result
335
+ * history. Callers drop stale history explicitly with {@link resetHistory} when the recipe changes.
336
336
  */
337
337
  register(input: AnalysisRegistration): void;
338
- /** Store the {@link Job} backing an analysis — the reference linking this record to the engine. */
338
+ /** Stores the {@link Job} backing an analysis, the reference linking this record to the engine. */
339
339
  setJob(analysisId: string, job: Job): void;
340
340
  /** The {@link Job} backing an analysis, if monitored or a retained one-shot. */
341
341
  job(analysisId: string): Job | undefined;
342
- /** Drop an analysis's result history — called on re-arm when the recipe changed (stale `previous`). */
342
+ /** Drops an analysis's result history. A re-arm calls it when the recipe changed (stale `previous`). */
343
343
  resetHistory(analysisId: string): void;
344
344
  /**
345
- * Append a result to a record's timeline, evicting the oldest when the per-analysis cap is hit. A
345
+ * Appends a result to a record's timeline, evicting the oldest when the per-analysis cap is hit. A
346
346
  * same-timestamp re-run (an id-stability re-read of an unchanged snapshot) overwrites the last entry
347
- * rather than duplicating it. No-op (no emit) when the `analysisId` is unknown. Emits `analysis-change`.
347
+ * rather than duplicating it. It emits `analysis-change`, unless the `analysisId` is unknown
348
+ * (a no-op).
348
349
  */
349
350
  attachResult(analysisId: string, result: EntryAnalysis): void;
350
351
  /**
351
- * Latest result of every analysis attached to `entryId`, in registration order. The on-demand
352
- * replacement for the old per-entry `_analyses.results`. Linear scan over records — fine at session
353
- * scale (one record per distinct analyseData name+sources, plus one per clustered incidents entry).
352
+ * Returns the latest result of every analysis attached to `entryId`, in registration order,
353
+ * replacing the old per-entry `_analyses.results`. It scans records linearly, fine at session scale
354
+ * (one record per distinct analyseData name+sources, plus one per clustered incidents entry).
354
355
  */
355
356
  getAnalysesForEntry(entryId: string): readonly EntryAnalysis[];
356
357
  /**
357
- * Every analysis record, in registration order — the combined, cross-entry view. Read
358
- * `record.history.at(-1)` for each one's latest result. (Tracker verdicts are no longer analyses, so
359
- * every record here is operator-facing.)
358
+ * Returns every analysis record in registration order, the combined cross-entry view. Read
359
+ * `record.history.at(-1)` for each one's latest result. Tracker verdicts are not analyses, so every
360
+ * record here is operator-facing.
360
361
  */
361
362
  all(): readonly AnalysisRecord[];
362
363
  /** Full result timeline for one analysis, oldest first. Empty when unknown. */
@@ -366,14 +367,14 @@ declare class Analyses {
366
367
  get(analysisId: string): AnalysisRecord | undefined;
367
368
  /** Whether the analysis is currently recomputed on source change (its job exists and is active). */
368
369
  isMonitored(analysisId: string): boolean;
369
- /** Remove an analysis: tear down its job and drop the record + handle. */
370
+ /** Removes an analysis, tearing down its job and dropping the record and handle. */
370
371
  remove(analysisId: string): void;
371
372
  /**
372
- * Remove every record sharing a `name`, across all source entries. Mirrors the old per-entry
373
- * `unregister(name)` which dropped a named analysis wherever it was attached.
373
+ * Removes every record sharing a `name`, across all source entries, as the old per-entry
374
+ * `unregister(name)` dropped a named analysis wherever it was attached.
374
375
  */
375
376
  removeByName(name: string): void;
376
- /** Drop every record + job handle. Walked automatically by `destroyState` (duck-typed `reset`). */
377
+ /** Drops every record and job handle. `destroyState` calls it automatically (duck-typed `reset`). */
377
378
  reset(): void;
378
379
  }
379
380
  //#endregion
@@ -568,39 +569,38 @@ interface FeatureCollection$1<G extends Geometry | null = Geometry, P = GeoJsonP
568
569
  /**
569
570
  * @module agent-toolkit-state
570
571
  *
571
- * Shared base shape for the per-slice history entries (places / routes / ranges / byod /
572
- * custom-geometries / traffic-area-analytics / traffic-incidents). Every slice keeps an append-only
573
- * history of entries, and they all share the same four fields — an `id`, a `timestamp`, a `label`,
574
- * and a single `data` payload. Those live here so each slice's entry type can be written as
575
- * `BaseEntry<TPayload> & { … }` plus only the fields unique to that slice (its per-entry display and
576
- * runtime state).
572
+ * The shared base shape for the per-slice history entries of places, routes, ranges, byod,
573
+ * custom-geometries, traffic-area-analytics and traffic-incidents. Every slice keeps an append-only
574
+ * history of entries that share four fields: an `id`, a `timestamp`, a `label`, and a single `data`
575
+ * payload. They live here, so each slice's entry type is `BaseEntry<TPayload> & { … }` plus only the
576
+ * fields unique to that slice, its per-entry display and runtime state.
577
577
  *
578
578
  * @group Agent Toolkit
579
579
  */
580
580
  /**
581
- * The fields shared by every history entry across the toolkit's state slices: identity
582
- * (`id`), provenance (`timestamp`, `label`), and the slice's payload (`data`). Each slice intersects
583
- * this with its own per-entry display state — e.g. `type RoutesEntry = BaseEntry<Routes> & { … }`.
581
+ * The fields every history entry shares across the toolkit's state slices, namely identity
582
+ * (`id`), provenance (`timestamp`, `label`) and the slice's payload (`data`). Each slice intersects
583
+ * this with its own per-entry display state, such as `type RoutesEntry = BaseEntry<Routes> & { … }`.
584
584
  *
585
- * @typeParam TData - the entry's payload type (e.g. `Routes`, `Place[]`, `FeatureCollection`,
586
- * `TrafficIncident[]`). It is the single result the entry was created to hold.
585
+ * @typeParam TData - The entry's payload type, such as `Routes`, `Place[]`, `FeatureCollection` or
586
+ * `TrafficIncident[]`. It is the single result the entry was created to hold.
587
587
  *
588
588
  * @group Agent Toolkit
589
589
  */
590
590
  type BaseEntry<TData> = {
591
591
  /**
592
- * Stable, slice-unique entry id (e.g. `places-0`, or a caller-supplied id deduped against
593
- * existing entries on collision). Used to address the entry from tools and recall surfaces.
592
+ * The stable, slice-unique entry id, such as `places-0` or a caller-supplied id deduped against
593
+ * existing entries on collision. Tools and recall surfaces address the entry by it.
594
594
  */
595
595
  id: string;
596
596
  /**
597
- * Creation / last-refresh time, in milliseconds since the epoch. Set when the entry is added and
598
- * bumped on each in-place replace (a monitored re-run stamps the source sample time).
597
+ * The creation or last-refresh time, in milliseconds since the epoch. It is set when the entry is
598
+ * added and bumped on each in-place replace. A monitored re-run stamps the source sample time.
599
599
  */
600
600
  timestamp: number;
601
- /** Short, human-readable label for the entry — shown in recall / recents surfaces. */
601
+ /** A short, human-readable label, shown in recall and recents surfaces. */
602
602
  label: string;
603
- /** The entry's payload — the single result this entry was created to hold. */
603
+ /** The entry's payload, the single result it was created to hold. */
604
604
  data: TData;
605
605
  };
606
606
  //#endregion
@@ -700,7 +700,7 @@ type BYODEntry = BaseEntry<FeatureCollection$1> & {
700
700
  /**
701
701
  * State for base map display: style, language, viewport and layers.
702
702
  *
703
- * Provides direct access to the TomTomMap and MapLibre instances alongside
703
+ * It exposes the TomTomMap and MapLibre instances directly, alongside
704
704
  * lazy-initialized BaseMapModule, StylingFoundationsModule and TerrainModule.
705
705
  *
706
706
  * @group Agent Toolkit
@@ -910,18 +910,18 @@ export declare const applyFitOnMap: (state: ToolState, fit: FitOnMapInput) => z.
910
910
  //#endregion
911
911
  //#region src/tools/shared/geocode-areas.d.ts
912
912
  /**
913
- * Administrative-AREA geography types accepted when resolving a query to a *containing area*
914
- * (`within` mode). Restricting the geocode to these (via `entityTypeSet`) is what stops streets and
915
- * POIs from drowning the area — e.g. "De Pijp" / "Westminster" geocode to Streets at rank 0 without
916
- * it. Excludes `Country` (too coarse) and `PostalCodeArea` (homonym noise — "A10" → a Kazakh
917
- * postcode).
913
+ * Administrative-area geography types accepted when resolving a query to a *containing area*
914
+ * (`within` mode). Restricting the geocode to these (via `entityTypeSet`) stops streets and POIs
915
+ * from drowning the area. Without it, "De Pijp" and "Westminster" geocode to Streets at rank 0.
916
+ * Excludes `Country` (too coarse) and `PostalCodeArea` (homonym noise, such as "A10" matching a
917
+ * Kazakh postcode).
918
918
  */
919
919
  export declare const AREA_GEOGRAPHY_TYPES: GeographyType[];
920
920
  /**
921
- * Geocodes `query` restricted to administrative AREA geographies (not streets/POIs), biased toward
921
+ * Geocodes `query` restricted to administrative area geographies (not streets/POIs), biased toward
922
922
  * `bias` (the map centre). Because `geographyTypes` filters to areas, every result carries a
923
- * `boundingBox`. Callers choose among the candidates (e.g. the one nearest the current view) — a
924
- * centre bias is used rather than a hard viewport-bbox filter so out-of-view areas still resolve.
923
+ * `boundingBox`. Callers choose among the candidates, for example the one nearest the current view.
924
+ * A centre bias is used rather than a hard viewport-bbox filter, so out-of-view areas still resolve.
925
925
  */
926
926
  export declare const geocodeAreas: (query: string, opts?: {
927
927
  bias?: Position;
@@ -937,8 +937,8 @@ export declare const geocodeAreas: (query: string, opts?: {
937
937
  export type GeometriesIdKind = 'place' | 'places' | 'ranges' | 'customGeometries';
938
938
  /**
939
939
  * Tagged geometries id. The Zod schema is exposed so tools can plug it
940
- * straight into their input shape (`z.array(geometriesIdSchema).min(1)`)
941
- * — no string parsing on the way in.
940
+ * straight into their input shape (`z.array(geometriesIdSchema).min(1)`),
941
+ * with no string parsing on the way in.
942
942
  *
943
943
  * @group Agent Toolkit
944
944
  */
@@ -1007,10 +1007,10 @@ export declare const GEOMETRIES_SOURCE_IDS_DESC = "Tagged input ids that contrib
1007
1007
  * @module agent-toolkit-tools
1008
1008
  *
1009
1009
  * Compact schema doc for the geometry polygons consumed/produced by sandboxed
1010
- * code in `processData` / `analyseData` — injected per source as
1010
+ * code in `processData` / `analyseData`, injected per source as
1011
1011
  * `geometriesByEntry[key]`. Each item is a
1012
- * `PolygonFeature<CommonPlaceProps>`; only the non-GeoJSON-standard bits are
1013
- * spelled out here.
1012
+ * `PolygonFeature<CommonPlaceProps>`, and only its non-GeoJSON-standard bits
1013
+ * are spelled out here.
1014
1014
  */
1015
1015
  /** @ignore */
1016
1016
  export declare const GEOMETRIES_SCHEMA_DOC: string;
@@ -1029,8 +1029,8 @@ type CustomGeometriesAnalysis = EntryAnalysis;
1029
1029
  //#endregion
1030
1030
  //#region src/state/digest.d.ts
1031
1031
  /**
1032
- * Compact snapshot of the user-visible parts of `ToolState`. Designed to be diffable: every field
1033
- * is serialisable to JSON and stable for `===` comparison when the underlying state hasn't changed.
1032
+ * A compact, diffable snapshot of the user-visible parts of `ToolState`. Every field serialises to
1033
+ * JSON and stays stable for `===` comparison while the underlying state is unchanged.
1034
1034
  *
1035
1035
  * @group Agent Toolkit
1036
1036
  */
@@ -1040,25 +1040,25 @@ type StateDigest = {
1040
1040
  shownAsPin: string[];
1041
1041
  /** Entry ids currently rendered as base-map POIs, sorted ascending. */
1042
1042
  shownAsBaseMap: string[];
1043
- /** Display policy in force on the slice — `multiple` (default) or `single`. */
1043
+ /** The slice's display policy, `multiple` (default) or `single`. */
1044
1044
  entryMode: EntryMode;
1045
1045
  };
1046
1046
  routes: {
1047
1047
  /** Routes-entry ids currently drawn on the map, sorted ascending. */
1048
1048
  shown: string[];
1049
- /** Display policy in force on the slice — `multiple` (default) or `single`. */
1049
+ /** The slice's display policy, `multiple` (default) or `single`. */
1050
1050
  entryMode: EntryMode;
1051
1051
  };
1052
1052
  ranges: {
1053
1053
  /** Range-entry ids currently drawn on the map, sorted ascending. */
1054
1054
  shown: string[];
1055
- /** Display policy in force on the slice — `multiple` (default) or `single`. */
1055
+ /** The slice's display policy, `multiple` (default) or `single`. */
1056
1056
  entryMode: EntryMode;
1057
1057
  };
1058
1058
  traffic: {
1059
1059
  /** Traffic-area-analytics entry ids currently rendered on the map, sorted ascending. */
1060
1060
  shown: string[];
1061
- /** Display policy in force on the slice — `multiple` (default) or `single`. */
1061
+ /** The slice's display policy, `multiple` (default) or `single`. */
1062
1062
  entryMode: EntryMode;
1063
1063
  /** Total traffic-area-analytics entries in history (shown + hidden). */
1064
1064
  entryCount: number;
@@ -1068,13 +1068,13 @@ type StateDigest = {
1068
1068
  shown: string[];
1069
1069
  /** Entry ids currently being polled by the per-entry network monitor, sorted ascending. */
1070
1070
  monitored: string[];
1071
- /** Display policy in force on the slice — `multiple` (default) or `single`. */
1071
+ /** The slice's display policy, `multiple` (default) or `single`. */
1072
1072
  entryMode: EntryMode;
1073
1073
  };
1074
1074
  customGeometries: {
1075
1075
  /** Custom-geometries entry ids currently rendered on the map, sorted ascending. */
1076
1076
  shown: string[];
1077
- /** Display policy in force on the slice — `multiple` (default) or `single`. */
1077
+ /** The slice's display policy, `multiple` (default) or `single`. */
1078
1078
  entryMode: EntryMode;
1079
1079
  /** Total custom-geometries entries in history (shown + hidden). */
1080
1080
  entryCount: number;
@@ -1082,23 +1082,23 @@ type StateDigest = {
1082
1082
  byod: {
1083
1083
  /** BYOD entry ids currently rendered on the map, sorted ascending. */
1084
1084
  shown: string[];
1085
- /** Display policy in force on the slice — `multiple` (default) or `single`. */
1085
+ /** The slice's display policy, `multiple` (default) or `single`. */
1086
1086
  entryMode: EntryMode;
1087
1087
  /** Total BYOD entries in history (shown + hidden). */
1088
1088
  entryCount: number;
1089
1089
  };
1090
1090
  };
1091
1091
  /**
1092
- * Snapshot the user-visible state surface. Call after every assistant turn (to record the
1093
- * "agent-known" baseline) and again before each user prompt (to detect what changed since).
1092
+ * Takes a snapshot of the user-visible state surface. Call it after every assistant turn to record
1093
+ * the "agent-known" baseline, and again before each user prompt to detect what changed since.
1094
1094
  *
1095
1095
  * @group Agent Toolkit
1096
1096
  */
1097
1097
  export declare const getStateDigest: (state: ToolState) => StateDigest;
1098
1098
  /**
1099
- * Produce a compact, LLM-readable summary of the differences between two digests, or `null` when
1099
+ * Returns a compact, LLM-readable summary of the differences between two digests, or `null` if
1100
1100
  * nothing changed. The output is short enough to prepend to a user prompt without bloating the
1101
- * conversation; longer per-field diffs are deliberately omitted.
1101
+ * conversation, so it deliberately omits longer per-field diffs.
1102
1102
  *
1103
1103
  * @example
1104
1104
  * ```ts
@@ -1143,12 +1143,12 @@ type PlacesAnalysis = EntryAnalysis;
1143
1143
  //#endregion
1144
1144
  //#region src/state/places/state.d.ts
1145
1145
  /**
1146
- * The marker looks an entry can be rendered with: individual pins, base-map POIs, or clustered
1147
- * pins. A type-checked subset of the SDK's `PlacesMarkerType` — `circle-icon` is not offered to
1148
- * the agent. Every tool enum for marker types derives from this array rather than repeating it.
1146
+ * The marker looks an entry can render with, namely individual pins, base-map POIs, or clustered
1147
+ * pins. It is a type-checked subset of the SDK's `PlacesMarkerType` that doesn't offer `circle-icon`
1148
+ * to the agent. Every tool enum for marker types derives from this array instead of repeating it.
1149
1149
  */
1150
1150
  declare const placesMarkerTypes: readonly ["pin", "base-map", "pin-clustered"];
1151
- /** How an entry is rendered on the map — one of {@link placesMarkerTypes}. */
1151
+ /** How an entry renders on the map, one of {@link placesMarkerTypes}. */
1152
1152
  type PlacesMarkerType = (typeof placesMarkerTypes)[number];
1153
1153
  /**
1154
1154
  * Events fired by {@link PlacesState}. Subscribe via `state.places.events.on(type, handler)`.
@@ -1157,33 +1157,33 @@ type PlacesMarkerType = (typeof placesMarkerTypes)[number];
1157
1157
  */
1158
1158
  type PlacesStateEvents = {
1159
1159
  /**
1160
- * History changed — entry added, replaced, or cleared via `reset()`. `entries` is the full
1161
- * snapshot after the change; `changedIds` lists the ids of the entries this specific change
1162
- * added, replaced in place, or removed (the {@link JobEngine} matches these against each job's
1163
- * `affectedEntryIds`).
1160
+ * An entry was added or replaced, or `reset()` cleared the history. `entries` is the full
1161
+ * snapshot after the change, and `changedIds` lists the ids of the entries this change added,
1162
+ * replaced in place, or removed. The {@link JobEngine} matches these against each job's
1163
+ * `affectedEntryIds`.
1164
1164
  */
1165
1165
  'entries-change': {
1166
1166
  entries: readonly PlacesEntry[];
1167
1167
  changedIds: readonly string[];
1168
1168
  };
1169
- /** Set of entries currently rendered on the map changed (or marker type swapped). */
1169
+ /** The set of entries rendered on the map, or a marker type, changed. */
1170
1170
  'shown-change': ReadonlySet<string>;
1171
1171
  /** Boundary polygons were fetched and cached on an entry. */
1172
1172
  'geometries-change': {
1173
1173
  entryId: string;
1174
1174
  count: number;
1175
1175
  };
1176
- /** Display policy switched between `single` and `multiple`. */
1176
+ /** The display policy switched between `single` and `multiple`. */
1177
1177
  'mode-change': EntryMode;
1178
1178
  };
1179
1179
  /**
1180
- * State for the places layer: an append-only history of place results plus per-entry display
1180
+ * The state for the places layer, an append-only history of place results plus per-entry display
1181
1181
  * modules.
1182
1182
  *
1183
- * Each entry owns a single PlacesModule (switched in place via `updateConfig` when the marker
1184
- * type changes — an entry only renders under one marker type at a time) and a dedicated
1185
- * GeometriesModule, lazy-initialised on first show. Display state lives on the entry, so two
1186
- * entries can be rendered side by side under different marker types without sharing a single source.
1183
+ * Each entry owns a single PlacesModule and a dedicated GeometriesModule, both initialised lazily
1184
+ * on first show. An entry renders under one marker type at a time, so `updateConfig` switches its
1185
+ * PlacesModule in place when the marker type changes. Display state lives on the entry, so two
1186
+ * entries can render side by side under different marker types without sharing a single source.
1187
1187
  *
1188
1188
  * @group Agent Toolkit
1189
1189
  */
@@ -1191,37 +1191,38 @@ declare class PlacesState implements StateSlice {
1191
1191
  private readonly _ttMap;
1192
1192
  private _entries;
1193
1193
  private _entryMode;
1194
- /** Subscribe to state changes — see {@link PlacesStateEvents}. */
1194
+ /** The state change events, listed in {@link PlacesStateEvents}. */
1195
1195
  readonly events: StateEvents<PlacesStateEvents>;
1196
1196
  constructor(_ttMap: TomTomMap);
1197
1197
  /**
1198
- * Display policy: `multiple` (default) keeps every history entry available to render
1199
- * simultaneously; `single` enforces "at most one entry on the map at a time" and trims
1200
- * the history down to the latest entry whenever it's set.
1198
+ * The display policy. `multiple` (default) keeps every history entry available to render
1199
+ * simultaneously. `single` allows at most one entry on the map at a time and trims the
1200
+ * history to the latest entry whenever it's set.
1201
1201
  */
1202
1202
  get entryMode(): EntryMode;
1203
1203
  /**
1204
- * Switch the display policy. When moving from `multiple` → `single` we hide every entry
1205
- * older than the latest, drop them from history, and emit `entries-change` so listeners
1206
- * (the recents rail, recall tools, …) re-render. No-op when the mode hasn't changed.
1204
+ * Switches the display policy. Moving from `multiple` to `single` hides every entry older
1205
+ * than the latest, drops them from history, and emits `entries-change` so listeners (the
1206
+ * recents rail, recall tools, …) re-render. Does nothing if the mode hasn't changed.
1207
1207
  */
1208
1208
  setEntryMode(mode: EntryMode): Promise<void>;
1209
1209
  /**
1210
- * Lazy-init and return the entry's PlacesModule, switched to `markerType`. An entry only
1211
- * ever renders under one marker type at a time, so the same module is reused — flipping marker
1212
- * types calls `updateConfig` in place. Throws when the entry id is unknown.
1210
+ * Returns the entry's PlacesModule, created on first call and switched to `markerType`. An entry
1211
+ * renders under only one marker type at a time, so flipping marker types reuses the same module
1212
+ * and calls `updateConfig` in place. Throws if the entry id is unknown.
1213
1213
  */
1214
1214
  getEntryPlacesModule(entryId: string, markerType: PlacesMarkerType): Promise<PlacesModule>;
1215
1215
  /**
1216
- * Lazy-init and return the entry's place-geometries module (for POI footprints, municipality
1217
- * outlines). Re-applies the config when the fill style changes. Throws on unknown entry id.
1216
+ * Returns the entry's place-geometries module for POI footprints and municipality outlines,
1217
+ * created on first call. Re-applies the config when the fill style changes. Throws on an
1218
+ * unknown entry id.
1218
1219
  */
1219
1220
  getEntryGeometriesModule(entryId: string, fillStyle?: GeometryFillStyle): Promise<GeometriesModule>;
1220
1221
  private _requireEntry;
1221
1222
  get entries(): readonly PlacesEntry[];
1222
1223
  /**
1223
- * This is used purely to pass data between tools in a context-dependent way,
1224
- * so we assume the most recent entry is the relevant one to show on the map.
1224
+ * Only passes data between tools in a context-dependent way, so it assumes
1225
+ * the most recent entry is the relevant one to show on the map.
1225
1226
  */
1226
1227
  get latestPlace(): Place[] | undefined;
1227
1228
  addPlaceResult(place: Place | Places, label: string, explicitId?: string, connections?: PlaceConnectionDisplay[], geometries?: PolygonFeature<CommonPlaceProps>[]): Promise<string>;
@@ -1249,18 +1250,17 @@ declare class PlacesState implements StateSlice {
1249
1250
  */
1250
1251
  fetchGeometriesForEntry(entryId: string, options?: ToolExecuteOptions): Promise<PolygonFeature<CommonPlaceProps>[]>;
1251
1252
  /**
1252
- * Render the given polygons via the entry's GeometriesModule. The `mode` flag is
1253
- * scoped to **this entry's layer only** — it does not touch other entries (use
1254
- * the slice's per-entry hide/show methods for cross-entry visibility).
1253
+ * Renders the given polygons via the entry's GeometriesModule. The `mode` flag applies to
1254
+ * **this entry's layer only** and doesn't touch other entries. For cross-entry visibility,
1255
+ * use the slice's per-entry hide and show methods.
1255
1256
  *
1256
- * - `mode: 'replace'` (default) — calls `module.show` with exactly these features, replacing
1257
- * whatever was previously on this entry's layer. An empty array clears the layer.
1258
- * - `mode: 'add'` — merges the new features with the polygons currently shown on this
1259
- * entry's layer (deduped by `feature.id`) and re-renders the union. An empty array is a
1260
- * no-op.
1257
+ * - `mode: 'replace'` (default) calls `module.show` with exactly these features, replacing
1258
+ * whatever was on this entry's layer before. An empty array clears the layer.
1259
+ * - `mode: 'add'` merges the new features with the polygons shown on this entry's layer,
1260
+ * deduped by `feature.id`, and re-renders the union. An empty array does nothing.
1261
1261
  *
1262
- * `entryId` defaults to the latest entry that owns geometries — handy when callers only ever
1263
- * render the most-recently produced footprints. Pass an explicit id to target an older one.
1262
+ * `entryId` defaults to the latest entry that owns geometries, which suits callers that only
1263
+ * render the most recently produced footprints. Pass an explicit id to target an older one.
1264
1264
  */
1265
1265
  showPlaceGeometries(features: PolygonFeature<CommonPlaceProps>[], fillStyle?: GeometryFillStyle, mode?: 'add' | 'replace', entryId?: string): Promise<void>;
1266
1266
  private _latestGeometriesEntryId;
@@ -1276,37 +1276,36 @@ declare class PlacesState implements StateSlice {
1276
1276
  private _idsShownAs;
1277
1277
  /** Marker type for a specific entry, or undefined if it is not shown. */
1278
1278
  getShownMarkerType(id: string): PlacesMarkerType | undefined;
1279
- /** Return the union of all features belonging to currently-shown entries. */
1279
+ /** Returns the union of all features belonging to the shown entries. */
1280
1280
  getShownFeatures(): Place[];
1281
1281
  /**
1282
- * Replace the shown set for `markerType` with exactly these ids and re-render.
1283
- * Entries currently shown as `markerType` but absent from `ids` are hidden;
1284
- * entries in `ids` are switched to `markerType` (lazy-creating their module).
1282
+ * Replaces the shown set for `markerType` with exactly these ids and re-renders.
1283
+ * Entries shown as `markerType` but absent from `ids` are hidden. Entries in `ids`
1284
+ * switch to `markerType`, creating their module if needed.
1285
1285
  */
1286
1286
  setShownEntries(ids: readonly string[], markerType: PlacesMarkerType): Promise<Place[]>;
1287
1287
  /**
1288
- * Add ids to the shown set under `markerType`. Any id previously shown as
1289
- * a different marker type is moved (its module switches to the new
1290
- * marker type).
1288
+ * Adds ids to the shown set under `markerType`. Any id shown as a different
1289
+ * marker type moves, and its module switches to the new marker type.
1291
1290
  *
1292
- * Under `entryMode === 'single'` everything else is hidden first, so the
1293
- * effective behaviour collapses to "show exactly the last id in the list".
1291
+ * With `entryMode === 'single'`, everything else is hidden first, so in effect
1292
+ * only the last id in the list is shown.
1294
1293
  */
1295
1294
  addShownEntries(ids: readonly string[], markerType: PlacesMarkerType): Promise<Place[]>;
1296
- /** Remove ids from the shown set and clear their modules. */
1295
+ /** Removes ids from the shown set and clears their modules. */
1297
1296
  removeShownEntries(ids: readonly string[]): Promise<Place[]>;
1298
- /** Clear everything from the map (does not touch entries history). */
1297
+ /** Clears everything from the map but leaves the entries history untouched. */
1299
1298
  clearShownEntries(): Promise<void>;
1300
1299
  /**
1301
- * Hide every PlacesState rendering — pins AND attached boundary polygons. Map-only:
1302
- * history (`entries`) is untouched. Implements {@link ClearableMapSlice}.
1300
+ * Hides every PlacesState rendering, both pins and attached boundary polygons, but leaves
1301
+ * the history (`entries`) untouched. Implements {@link ClearableMapSlice}.
1303
1302
  */
1304
1303
  clearShown(): Promise<void>;
1305
1304
  clearShownGeometries(ids?: readonly string[]): Promise<void>;
1306
1305
  /**
1307
- * Drop a single entry from history. Hides it from the map first (clears every module
1308
- * it owns) then removes it from `_entries`. Emits `entries-change` and, when the entry was
1309
- * shown, `shown-change`. No-op when the id is unknown.
1306
+ * Drops a single entry from history. It first hides the entry by clearing every module it
1307
+ * owns, then removes it from `_entries`. Emits `entries-change`, plus `shown-change` if the
1308
+ * entry was shown. Does nothing if the id is unknown.
1310
1309
  */
1311
1310
  removeEntry(id: string): Promise<void>;
1312
1311
  private _showEntryAs;
@@ -1403,25 +1402,25 @@ type RangesEntry = BaseEntry<ReachableRange[]> & {
1403
1402
  */
1404
1403
  type RangeStateEvents = {
1405
1404
  /**
1406
- * Range history changed — entry added or cleared via `reset()`. `entries` is the full snapshot
1407
- * after the change; `changedIds` lists the ids of the entries this specific change added,
1408
- * replaced in place, or removed.
1405
+ * An entry was added, or `reset()` cleared the range history. `entries` is the full snapshot
1406
+ * after the change, and `changedIds` lists the ids of the entries this change added, replaced
1407
+ * in place, or removed.
1409
1408
  */
1410
1409
  'entries-change': {
1411
1410
  entries: readonly RangesEntry[];
1412
1411
  changedIds: readonly string[];
1413
1412
  };
1414
- /** Set of ranges entries currently rendered on the map changed (multi-show under `multiple`). */
1413
+ /** The set of ranges entries rendered on the map changed (multi-show under `multiple`). */
1415
1414
  'shown-change': ReadonlySet<string>;
1416
- /** Display policy switched between `single` and `multiple`. */
1415
+ /** The display policy switched between `single` and `multiple`. */
1417
1416
  'mode-change': EntryMode;
1418
1417
  };
1419
1418
  /**
1420
1419
  * State for reachable range results.
1421
1420
  *
1422
- * Stores semantic summaries of calculated ranges (origin, budgets).
1423
- * Also retains raw polygon geometry internally for use in geometry searches
1424
- * (e.g. discoverPlaces withinRange). Displayed on the map via ReachableRangesModule.
1421
+ * It stores semantic summaries of calculated ranges (origin, budgets), plus the raw polygon
1422
+ * geometry internally for geometry searches such as discoverPlaces withinRange.
1423
+ * ReachableRangesModule displays them on the map.
1425
1424
  *
1426
1425
  * @group Agent Toolkit
1427
1426
  */
@@ -1429,56 +1428,55 @@ declare class RangeState implements ShownEntriesSlice {
1429
1428
  private readonly _ttMap;
1430
1429
  private _entries;
1431
1430
  private _entryMode;
1432
- /** Subscribe to state changes — see {@link RangeStateEvents}. */
1431
+ /** The state change events, listed in {@link RangeStateEvents}. */
1433
1432
  readonly events: StateEvents<RangeStateEvents>;
1434
1433
  constructor(_ttMap: TomTomMap);
1435
1434
  /** Set of ranges-entry ids currently rendered on the map. */
1436
1435
  get shownEntryIds(): ReadonlySet<string>;
1437
1436
  /**
1438
- * Display policy: `multiple` (default) lets several reachable-area entries render side
1439
- * by side; `single` forces "at most one ranges entry on the map" — `markEntryShown`
1440
- * then hides any previously-shown entry first.
1437
+ * The display policy. `multiple` (default) lets several reachable-area entries render
1438
+ * side by side. `single` allows at most one ranges entry on the map, so `markEntryShown`
1439
+ * first hides any previously-shown entry.
1441
1440
  */
1442
1441
  get entryMode(): EntryMode;
1443
1442
  /**
1444
- * Switch the display policy. When moving from `multiple` → `single` we hide every
1445
- * non-latest entry, drop them from history, and emit `entries-change`. No-op when the
1446
- * mode hasn't changed.
1443
+ * Switches the display policy. Moving from `multiple` to `single` hides every non-latest
1444
+ * entry, drops them from history, and emits `entries-change`. Does nothing if the mode
1445
+ * hasn't changed.
1447
1446
  */
1448
1447
  setEntryMode(mode: EntryMode): Promise<void>;
1449
1448
  /**
1450
- * Lazy-init the entry's ReachableRangesModule (for the isochrone/isodistance polygons),
1451
- * applying the requested fill style. Throws on unknown id.
1449
+ * Initialises the entry's ReachableRangesModule for the isochrone/isodistance polygons
1450
+ * lazily and applies the requested fill style. Throws on unknown id.
1452
1451
  */
1453
1452
  getEntryRangesModule(entryId: string, fillStyle?: GeometryFillStyle): Promise<ReachableRangesModule>;
1454
1453
  /**
1455
- * Lazy-init the entry's plain GeometriesModule, for drawing the entry's polygons in a style of
1456
- * your own (per-feature colours, border widths) rather than as reachable-range bands.
1454
+ * Initialises the entry's plain GeometriesModule lazily for drawing the entry's polygons in a
1455
+ * style of your own (per-feature colours, border widths) instead of as reachable-range bands.
1457
1456
  * Updates only the fill style when it changes, keeping the styling applied since. Throws on
1458
1457
  * unknown id.
1459
1458
  */
1460
1459
  getEntryGeometriesModule(entryId: string, fillStyle?: GeometryFillStyle): Promise<GeometriesModule>;
1461
1460
  /**
1462
- * Lazy-init the entry's origin-pin PlacesModule. Each entry maintains its own pin module
1463
- * so multiple ranges entries can be on the map simultaneously without the pins of one
1464
- * overwriting another.
1461
+ * Initialises the entry's origin-pin PlacesModule lazily. Each entry has its own pin module,
1462
+ * so several ranges entries can share the map without one's pins overwriting another's.
1465
1463
  */
1466
1464
  getEntryPlacesModule(entryId: string): Promise<PlacesModule>;
1467
1465
  /**
1468
- * Mark this entry as shown — records `_shown = true` and emits `shown-change`. The
1469
- * caller is expected to push features into the lazy modules itself; this method only
1470
- * keeps the `_shown` flag in sync with what the user sees.
1466
+ * Marks the entry as shown by recording `_shown = true` and emitting `shown-change`. The
1467
+ * caller pushes features into the lazy modules itself. This method only keeps the `_shown`
1468
+ * flag in sync with what the user sees.
1471
1469
  *
1472
- * Under `entryMode === 'single'` any other shown entry is hidden first so two range
1470
+ * With `entryMode === 'single'`, any other shown entry is hidden first so two range
1473
1471
  * layers don't overlap.
1474
1472
  */
1475
1473
  markEntryShown(entryId: string): Promise<void>;
1476
- /** Hide every module on the entry (clear). No-op when the entry is unknown. */
1474
+ /** Clears every module on the entry. Does nothing if the entry is unknown. */
1477
1475
  hideEntry(entryId: string): Promise<void>;
1478
1476
  /**
1479
- * Drop a single entry from history. Hides it from the map first (clears its ranges +
1480
- * origin-pin modules) then removes it from `_entries`. Emits `entries-change`. No-op when
1481
- * the id is unknown.
1477
+ * Drops a single entry from history. It clears the entry's ranges and origin-pin modules to
1478
+ * hide it, then removes it from `_entries`. Emits `entries-change`. Does nothing if the id is
1479
+ * unknown.
1482
1480
  */
1483
1481
  removeEntry(entryId: string): Promise<void>;
1484
1482
  private _requireEntry;
@@ -1486,8 +1484,8 @@ declare class RangeState implements ShownEntriesSlice {
1486
1484
  get latestEntry(): RangesEntry | undefined;
1487
1485
  addEntry(entry: Omit<RangesEntry, 'id' | 'timestamp'>): Promise<string>;
1488
1486
  /**
1489
- * Hide every reachable-range entry currently on the map. Map-only — history is kept.
1490
- * Implements {@link ClearableMapSlice}.
1487
+ * Hides every reachable-range entry on the map but keeps the history. Implements
1488
+ * {@link ClearableMapSlice}.
1491
1489
  */
1492
1490
  clearShown(): Promise<void>;
1493
1491
  reset(): void;
@@ -1516,8 +1514,8 @@ type RouteSnapshot = {
1516
1514
  routes: Routes;
1517
1515
  };
1518
1516
  /**
1519
- * Lifecycle state of a per-entry route monitor. `stopped-error` indicates the last recalculation
1520
- * failed and the timer has been cleared — start the monitor again to retry.
1517
+ * The lifecycle state of a per-entry route monitor. `stopped-error` means the last recalculation
1518
+ * failed and the timer was cleared. To retry, start the monitor again.
1521
1519
  *
1522
1520
  * @group Agent Toolkit
1523
1521
  */
@@ -1525,11 +1523,11 @@ type RoutePollingStatus = 'idle' | 'running' | 'stopped-error';
1525
1523
  //#endregion
1526
1524
  //#region src/state/routing/monitor/monitor.d.ts
1527
1525
  /**
1528
- * Dependency injection for a {@link RouteMonitor}. Production code wires `recalculate` to a closure
1529
- * over `calculateRoute` + the entry's waypoints / params (so each tick re-runs the SAME route);
1530
- * tests pass a deterministic fake and override the timer.
1526
+ * The injected dependencies of a {@link RouteMonitor}. Production code wires `recalculate` to a
1527
+ * closure over `calculateRoute` and the entry's waypoints and params, so each tick re-runs the same
1528
+ * route. Tests pass a deterministic fake and override the timer.
1531
1529
  *
1532
- * The recalculator returns just the routes — the monitor stamps `takenAt` itself so every consumer of
1530
+ * The recalculator returns only the routes. The monitor stamps `takenAt` itself, so every consumer of
1533
1531
  * one tick (entry data, derived analyses) agrees on the same canonical moment.
1534
1532
  *
1535
1533
  * @group Agent Toolkit
@@ -1542,21 +1540,21 @@ type RouteMonitorDeps = {
1542
1540
  };
1543
1541
  /**
1544
1542
  * Events fired by {@link RouteMonitor}. The slice subscribes once and re-emits translated copies
1545
- * (`monitor-tick` / `monitor-error`) keyed by entry id.
1543
+ * (`monitor-tick`, `monitor-error`) keyed by entry id.
1546
1544
  */
1547
1545
  type RouteMonitorEvents = {
1548
- /** A recalculation succeeded. Payload: the fresh snapshot. */
1546
+ /** A recalculation succeeded. The payload is the fresh snapshot. */
1549
1547
  tick: RouteSnapshot;
1550
- /** A recalculation failed — the monitor has cleared its timer and moved to `stopped-error`. */
1548
+ /** A recalculation failed, so the monitor cleared its timer and moved to `stopped-error`. */
1551
1549
  error: string;
1552
1550
  };
1553
1551
  /**
1554
- * One-shot polling loop that recalculates a single route on an interval. Owns its timer, status, and
1555
- * error. Re-starting after `stop()` is allowed and resets all state.
1552
+ * A one-shot polling loop that recalculates a single route on an interval. It owns its timer, status,
1553
+ * and error. Restarting it after `stop()` resets all state.
1556
1554
  *
1557
- * The monitor never knows about the entry that owns it — the `recalculate` closure captures the
1558
- * waypoints + params, and the caller decides what to do with each fresh snapshot. Mirrors
1559
- * `IncidentMonitor`; routes carry live traffic, so periodic recalculation keeps the entry fresh.
1555
+ * The monitor never knows about the entry that owns it. The `recalculate` closure captures the
1556
+ * waypoints and params, and the caller decides what to do with each fresh snapshot. It mirrors
1557
+ * `IncidentMonitor`. Routes carry live traffic, so periodic recalculation keeps the entry fresh.
1560
1558
  *
1561
1559
  * @group Agent Toolkit
1562
1560
  */
@@ -1569,19 +1567,20 @@ declare class RouteMonitor {
1569
1567
  private _recalculate?;
1570
1568
  get status(): RoutePollingStatus;
1571
1569
  get error(): string | undefined;
1572
- /** True when the monitor is *currently* recalculating on its interval. */
1570
+ /** Whether the monitor is *currently* recalculating on its interval. */
1573
1571
  get isRunning(): boolean;
1574
- /** True when the monitor has any activity (running or stopped-error). */
1572
+ /** Whether the monitor has any activity (running or stopped-error). */
1575
1573
  get isActive(): boolean;
1576
1574
  /**
1577
- * Begin polling. Captures `deps` for the lifetime of the run, fires the first recalculation
1578
- * immediately (unless `skipInitialTick`), then schedules an interval. No-op when already running.
1575
+ * Starts polling. It captures `deps` for the lifetime of the run, fires the first recalculation
1576
+ * immediately unless `skipInitialTick` is set, then schedules an interval. Does nothing if
1577
+ * already running.
1579
1578
  *
1580
- * `skipInitialTick` is for a caller that JUST calculated the route and only wants the recurring
1581
- * refresh — an eager first tick would be a redundant duplicate recalculation.
1579
+ * Set `skipInitialTick` if you just calculated the route and only want the recurring refresh,
1580
+ * since an eager first tick would duplicate that recalculation.
1582
1581
  */
1583
1582
  start(deps: RouteMonitorDeps, intervalMs?: number, skipInitialTick?: boolean): void;
1584
- /** Stop polling and reset state. No-op when idle. */
1583
+ /** Stops polling and resets state. Does nothing when idle. */
1585
1584
  stop(): void;
1586
1585
  private _tick;
1587
1586
  private _failed;
@@ -1651,9 +1650,9 @@ type RoutesEntry = BaseEntry<Routes> & {
1651
1650
  */
1652
1651
  type RoutingStateEvents = {
1653
1652
  /**
1654
- * Route history changed — new calculation stored, analysis attached, or cleared via `reset()`.
1655
- * `entries` is the full snapshot after the change; `changedIds` lists the ids of the entries
1656
- * this specific change added, replaced in place, or removed.
1653
+ * A calculation was stored, an analysis attached, or `reset()` cleared the history.
1654
+ * `entries` is the full snapshot after the change, and `changedIds` lists the ids of the
1655
+ * entries this change added, replaced in place, or removed.
1657
1656
  */
1658
1657
  'entries-change': {
1659
1658
  entries: readonly RoutesEntry[];
@@ -1663,28 +1662,28 @@ type RoutingStateEvents = {
1663
1662
  'planning-change': readonly PlanningWaypoint[];
1664
1663
  /** Route parameters (alternatives, cost model, depart/arrive time) changed. */
1665
1664
  'params-change': RouteParams;
1666
- /** Set of routes entries currently rendered on the map changed (multi-show under `multiple`). */
1665
+ /** The set of routes entries rendered on the map changed (multi-show under `multiple`). */
1667
1666
  'shown-change': ReadonlySet<string>;
1668
- /** Display policy switched between `single` and `multiple`. */
1667
+ /** The display policy switched between `single` and `multiple`. */
1669
1668
  'mode-change': EntryMode;
1670
- /** Monitoring began on an entry (idle → running). Skipped when already running. */
1669
+ /** Monitoring began on an entry (idle → running). Skipped if already running. */
1671
1670
  'monitor-start': {
1672
1671
  entryId: string;
1673
1672
  };
1674
1673
  /**
1675
- * Monitoring halted on an entry. `reason: 'manual'` covers explicit `stopMonitoring` and entry
1676
- * teardown (remove / reset); `reason: 'error'` fires alongside `monitor-error`.
1674
+ * Monitoring halted on an entry. `reason: 'manual'` covers an explicit `stopMonitoring` and
1675
+ * entry teardown (remove, reset). `reason: 'error'` fires alongside `monitor-error`.
1677
1676
  */
1678
1677
  'monitor-stop': {
1679
1678
  entryId: string;
1680
1679
  reason: 'manual' | 'error';
1681
1680
  };
1682
- /** A monitored route was recalculated (per-tick). The entry's data has been updated in place. */
1681
+ /** A monitored route was recalculated on a tick. The entry's data was updated in place. */
1683
1682
  'monitor-tick': {
1684
1683
  entryId: string;
1685
1684
  snap: RouteSnapshot;
1686
1685
  };
1687
- /** A monitored route's recalculation failed — the monitor cleared its timer and stopped. */
1686
+ /** A monitored route's recalculation failed, so the monitor cleared its timer and stopped. */
1688
1687
  'monitor-error': {
1689
1688
  entryId: string;
1690
1689
  error: string;
@@ -1694,9 +1693,9 @@ type RoutingStateEvents = {
1694
1693
  * State for route calculation, waypoint management, and route planning parameters.
1695
1694
  *
1696
1695
  * Each entry carries its own lazy-initialised RoutingModule (`entry._module`), so display
1697
- * state lives on the entry instead of a shared slice-level module. Two routes can be rendered
1698
- * concurrently by showing both entries, and switching the active route hides the previous
1699
- * entry's module without disturbing its calculated data.
1696
+ * state lives on the entry instead of a shared slice-level module. To render two routes at once,
1697
+ * show both entries. Switching the active route hides the previous entry's module without
1698
+ * disturbing its calculated data.
1700
1699
  *
1701
1700
  * @group Agent Toolkit
1702
1701
  */
@@ -1718,34 +1717,34 @@ declare class RoutingState implements ShownEntriesSlice {
1718
1717
  * set is `shownEntryIds` (derived from each entry's `_shown` flag).
1719
1718
  */
1720
1719
  private _lastShownEntryId?;
1721
- /** Subscribe to state changes — see {@link RoutingStateEvents}. */
1720
+ /** The state change events, listed in {@link RoutingStateEvents}. */
1722
1721
  readonly events: StateEvents<RoutingStateEvents>;
1723
1722
  constructor(_ttMap: TomTomMap);
1724
1723
  /** Set of routes-entry ids currently rendered on the map. */
1725
1724
  get shownEntryIds(): ReadonlySet<string>;
1726
1725
  /**
1727
- * Display policy: `multiple` (default) lets several entries render side-by-side;
1728
- * `single` forces "at most one route on the map" — `showEntry` then hides any
1729
- * previously-shown entry first.
1726
+ * The display policy. `multiple` (default) lets several entries render side-by-side.
1727
+ * `single` allows at most one route on the map, so `showEntry` first hides any
1728
+ * previously-shown entry.
1730
1729
  */
1731
1730
  get entryMode(): EntryMode;
1732
1731
  /**
1733
- * Switch the display policy. When moving from `multiple` → `single` we hide every
1734
- * non-latest entry, drop them from history, and emit `entries-change`. No-op when the
1735
- * mode hasn't changed.
1732
+ * Switches the display policy. Moving from `multiple` to `single` hides every non-latest
1733
+ * entry, drops them from history, and emits `entries-change`. Does nothing if the mode
1734
+ * hasn't changed.
1736
1735
  */
1737
1736
  setEntryMode(mode: EntryMode): Promise<void>;
1738
1737
  /**
1739
- * Lazy-init and return an entry's RoutingModule. Throws on unknown id. Callers that need
1740
- * to show/hide should prefer the higher-level {@link showEntry} / {@link hideEntry}.
1738
+ * Returns an entry's RoutingModule, created on first call. Throws on unknown id. To show or
1739
+ * hide it, prefer the higher-level {@link showEntry} and {@link hideEntry}.
1741
1740
  */
1742
1741
  getEntryRoutingModule(entryId: string): Promise<RoutingModule>;
1743
1742
  /**
1744
- * Render the given entry's routes + waypoints on its own RoutingModule.
1743
+ * Renders the given entry's routes and waypoints on its own RoutingModule.
1745
1744
  *
1746
- * Under `entryMode === 'single'` any other shown entry is hidden first so two route
1747
- * layers don't pile up. Under `entryMode === 'multiple'` previously-shown entries stay
1748
- * rendered, letting the caller overlay several routes at once.
1745
+ * With `entryMode === 'single'`, any other shown entry is hidden first so two route
1746
+ * layers don't pile up. With `entryMode === 'multiple'`, previously-shown entries stay
1747
+ * rendered, so the caller can overlay several routes at once.
1749
1748
  *
1750
1749
  * Emits `shown-change` once the new entry is up. Pass `showWaypoints: false` to render the
1751
1750
  * route lines without origin/stop/destination pins, and `showSummaryBubbles: false` to drop the
@@ -1755,29 +1754,28 @@ declare class RoutingState implements ShownEntriesSlice {
1755
1754
  showWaypoints?: boolean;
1756
1755
  showSummaryBubbles?: boolean;
1757
1756
  }): Promise<void>;
1758
- /** Slice-level route colour persisted across entry swaps. Undefined when none has been set. */
1757
+ /** The slice-level route colour, persisted across entry swaps. Undefined if none was set. */
1759
1758
  get color(): string | undefined;
1760
1759
  /**
1761
- * Set the slice-level route colour. The colour is applied immediately to every currently-shown
1762
- * entry's RoutingModule and remembered so that subsequent {@link showEntry} calls apply it
1763
- * automatically. Pass `undefined` to clear the sticky colour — currently-shown modules keep
1764
- * their last paint until they're re-shown (MapLibre style restore handles full revert).
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.
1765
1764
  */
1766
1765
  setColor(color: string | undefined): void;
1767
1766
  /**
1768
- * Hide the entry's routes + waypoints on its module (clear; the module stays cached).
1769
- * No-op when the entry is unknown or already hidden.
1767
+ * Hides the entry's routes and waypoints by clearing its module, which stays cached.
1768
+ * Does nothing if the entry is unknown or already hidden.
1770
1769
  */
1771
1770
  hideEntry(entryId: string): Promise<void>;
1772
1771
  /**
1773
- * Drop a single entry from history. Hides it from the map first (clears its routing module)
1774
- * then removes it from `_entries`. Emits `entries-change`. No-op when the id is unknown.
1772
+ * Drops a single entry from history. It clears the entry's routing module to hide it, then
1773
+ * removes it from `_entries`. Emits `entries-change`. Does nothing if the id is unknown.
1775
1774
  */
1776
1775
  removeEntry(entryId: string): Promise<void>;
1777
1776
  private _requireEntry;
1778
1777
  /**
1779
- * RoutingModule of the most-recently-shown entry, if any. Returns undefined when no
1780
- * entry is currently shown.
1778
+ * The RoutingModule of the most recently shown entry, or undefined if no entry is shown.
1781
1779
  */
1782
1780
  get currentEntryModule(): RoutingModule | undefined;
1783
1781
  get entries(): readonly RoutesEntry[];
@@ -1790,15 +1788,15 @@ declare class RoutingState implements ShownEntriesSlice {
1790
1788
  setWaypointAt(index: number, waypoint: WaypointLike): void;
1791
1789
  setParams(params: Partial<RouteParams>): void;
1792
1790
  /**
1793
- * Replace a route entry's data in place (a monitor recalculated it). Bumps `_tick`, updates
1791
+ * Replaces a route entry's data in place after a monitor recalculated it. Bumps `_tick`, updates
1794
1792
  * `data`/`timestamp`, emits `entries-change`, and re-renders the route on its module when shown.
1795
- * The `_tick` guard bails if a newer tick overwrote `data` while `showRoutes` awaited. No-op
1796
- * (returns false) when the entry is unknown. Mirrors `TrafficIncidentsState.replaceEntryData`.
1793
+ * The `_tick` guard bails if a newer tick overwrote `data` while `showRoutes` awaited. Returns
1794
+ * false if the entry is unknown. Mirrors `TrafficIncidentsState.replaceEntryData`.
1797
1795
  */
1798
1796
  replaceRouteData(entryId: string, routes: Routes, sampledAt: number): Promise<boolean>;
1799
1797
  private _createMonitorForEntry;
1800
1798
  /**
1801
- * Arm background recalculation on an entry. Lazy-creates its monitor, then starts polling with
1799
+ * Arms background recalculation on an entry. Lazy-creates its monitor, then starts polling with
1802
1800
  * the caller-supplied `recalculate` closure. Emits `monitor-start` on the idle → running
1803
1801
  * transition. Throws on unknown id.
1804
1802
  */
@@ -1806,13 +1804,13 @@ declare class RoutingState implements ShownEntriesSlice {
1806
1804
  intervalMs?: number;
1807
1805
  skipInitialTick?: boolean;
1808
1806
  }): void;
1809
- /** Stop recalculating an entry; its last data stays. Emits `monitor-stop`. No-op when not running. */
1807
+ /** Stops recalculating an entry but keeps its last data. Emits `monitor-stop`. Does nothing if not running. */
1810
1808
  stopMonitoring(entryId: string): void;
1811
- /** True when the entry is currently being recalculated on its interval. */
1809
+ /** Whether the entry is being recalculated on its interval. */
1812
1810
  isMonitored(entryId: string): boolean;
1813
1811
  /**
1814
- * Hide every route + waypoint set currently on the map. Map-only — history (`entries`)
1815
- * stays intact. Implements {@link ClearableMapSlice}.
1812
+ * Hides every route and waypoint set on the map but keeps the history (`entries`) intact.
1813
+ * Implements {@link ClearableMapSlice}.
1816
1814
  */
1817
1815
  clearShown(): Promise<void>;
1818
1816
  reset(): void;
@@ -1834,10 +1832,10 @@ export interface StateSlice {
1834
1832
  //#endregion
1835
1833
  //#region src/state/trackers.d.ts
1836
1834
  /**
1837
- * The features within ONE source entry that matched the rule — the per-entry unit of a {@link Verdict}.
1838
- * `featureIds` is the matched SUBSET, not the whole entry: a rule selects features by arbitrary sandbox
1839
- * logic (proximity, threshold, filter), and that selection isn't recoverable from `entryId` alone (the
1840
- * entry holds every feature) without re-running the rule — so the verdict records exactly what matched.
1835
+ * The features within one source entry that matched the rule, the per-entry unit of a {@link Verdict}.
1836
+ * `featureIds` is the matched subset, not the whole entry. A rule selects features by arbitrary sandbox
1837
+ * logic (proximity, threshold, filter). The entry holds every feature, so without re-running the rule
1838
+ * that selection can't be recovered from `entryId` alone, and the verdict records exactly what matched.
1841
1839
  * These are the features the UI highlights and the `summary` cites.
1842
1840
  */
1843
1841
  type MemberRef = {
@@ -1845,24 +1843,24 @@ type MemberRef = {
1845
1843
  featureIds: string[];
1846
1844
  };
1847
1845
  /**
1848
- * What a tracker's sandboxed `evaluateCode` returns — stored verbatim as the rule analysis's `data`
1849
- * and read back by the reducer. `members` groups matches by source entry so a verdict can span
1850
- * multiple entry kinds (e.g. "an incident within 100m of a hospital" returns a hospitals group and an
1851
- * incidents group). `summary` is a grounded headline the code produces deterministically.
1846
+ * What a tracker's sandboxed `evaluateCode` returns, stored verbatim as the rule analysis's `data`
1847
+ * and read back by the reducer. `members` groups matches by source entry, so a verdict can span
1848
+ * several entry kinds. For example, "an incident within 100m of a hospital" returns a hospitals group
1849
+ * and an incidents group. `summary` is a grounded headline the code produces deterministically.
1852
1850
  */
1853
1851
  type Verdict = {
1854
1852
  active: boolean;
1855
1853
  members: MemberRef[];
1856
1854
  summary: string;
1857
1855
  };
1858
- /** Toast-worthy (`alert`) vs quietly-logged (`event`). One store; the type discriminates. */
1856
+ /** Toast-worthy (`alert`) or quietly-logged (`event`), discriminating events in one store. */
1859
1857
  type TrackerEventType = 'alert' | 'event';
1860
- /** Rising edge (`opened`) vs falling edge (`resolved`). The only two statuses in the rising-edge model. */
1858
+ /** Rising edge (`opened`) or falling edge (`resolved`), the only two statuses in the rising-edge model. */
1861
1859
  type TrackerEventStatus = 'opened' | 'resolved';
1862
- /** One thing that happened — a tracker crossing an edge. The durable record the feed + toasts render. */
1860
+ /** A tracker crossing an edge, kept as the durable record the feed and toasts render. */
1863
1861
  type TrackerEvent = {
1864
1862
  id: string;
1865
- /** Source-data sample time of the recompute that fired it (NOT wall-clock). */
1863
+ /** Source-data sample time of the recompute that fired it, **not** wall-clock. */
1866
1864
  at: number;
1867
1865
  trackerId: string;
1868
1866
  trackerName: string;
@@ -1870,39 +1868,39 @@ type TrackerEvent = {
1870
1868
  kind: TrackerEventStatus;
1871
1869
  summary: string;
1872
1870
  members: MemberRef[];
1873
- /** Rising-edge time of the episode this closes — present on `resolved`. */
1871
+ /** The rising-edge time of the episode this closes, present on `resolved`. */
1874
1872
  openedAt?: number;
1875
1873
  };
1876
1874
  /**
1877
- * One tracker = one rule: an NL condition plus its rising-edge state. The compiled code lives on the
1878
- * tracker's {@link Job}, not here. `affectedEntryIds` are the entries the rule watches; a verdict's
1879
- * `members` are the ones that matched.
1875
+ * A tracker is one rule, a natural-language condition plus its rising-edge state. The compiled code
1876
+ * lives on the tracker's {@link Job}, not here. `affectedEntryIds` are the entries the rule watches,
1877
+ * and a verdict's `members` are the ones that matched.
1880
1878
  */
1881
1879
  type Tracker = {
1882
1880
  id: string;
1883
1881
  name: string;
1884
- /** Natural-language condition (LLM-readable); the compiled code lives on the tracker's job. */
1882
+ /** Natural-language condition (LLM-readable). The compiled code lives on the tracker's job. */
1885
1883
  rule: string;
1886
- /** Ids of every entry the rule reads — the per-entry lookup key ({@link EventsState.trackersForEntry}). */
1884
+ /** The ids of every entry the rule reads, the per-entry lookup key ({@link EventsState.trackersForEntry}). */
1887
1885
  affectedEntryIds: readonly string[];
1888
1886
  enabled: boolean;
1889
- /** The one bit of memory: was the verdict active at the last recompute (rising-edge detection). */
1887
+ /** Whether the verdict was active at the last recompute, the one bit of rising-edge memory. */
1890
1888
  wasActive: boolean;
1891
1889
  /** Rising-edge time of the current open episode, if active. */
1892
1890
  openedAt?: number;
1893
1891
  };
1894
1892
  /** Events emitted by {@link EventsState}. */
1895
1893
  type TrackerStateEvents = {
1896
- /** The tracker set or a tracker's live state changed (create / clear / enable / edge crossed). */
1894
+ /** The tracker set or a tracker's live state changed (create, clear, enable, edge crossed). */
1897
1895
  'trackers-change': readonly Tracker[];
1898
- /** A tracker crossed an edge — the freshly-logged event (drives toasts + feed append). */
1896
+ /** A tracker crossed an edge. The freshly-logged event drives toasts and feed appends. */
1899
1897
  'tracker-event': TrackerEvent;
1900
1898
  };
1901
1899
  /**
1902
- * Generic tracker store + rising-edge reducer. Held on `ToolState` as `state.trackers`. Pure
1903
- * storage + reaction: tools register/unregister trackers and register their rule jobs on the
1904
- * {@link JobEngine}; each job's `run` feeds verdicts here via {@link ingestVerdict}. Keeps the
1905
- * {@link Job} handle backing each tracker (`_jobs`) so pausing a tracker pauses its job.
1900
+ * Generic tracker store and rising-edge reducer, held on `ToolState` as `state.trackers`. It only
1901
+ * stores and reacts. Tools register and unregister trackers and register their rule jobs on the
1902
+ * {@link JobEngine}, and each job's `run` feeds verdicts here via {@link ingestVerdict}. Keeps the
1903
+ * {@link Job} handle backing each tracker (`_jobs`), so pausing a tracker pauses its job.
1906
1904
  *
1907
1905
  * @group Agent Toolkit
1908
1906
  */
@@ -1914,24 +1912,24 @@ declare class EventsState implements StateSlice {
1914
1912
  private _seq;
1915
1913
  readonly events: StateEvents<TrackerStateEvents>;
1916
1914
  /**
1917
- * Register a tracker. The caller (createTracker) registers it with the rising-edge bit clear
1918
- * (`wasActive: false`) and feeds the arm-time verdict via {@link ingestVerdict} AFTER this call, so a
1919
- * condition already live at creation crosses false→true and fires one `opened` alert. Emits
1915
+ * Registers a tracker. The caller (createTracker) registers it with the rising-edge bit clear
1916
+ * (`wasActive: false`) and feeds the arm-time verdict via {@link ingestVerdict} after this call. A
1917
+ * condition already live at creation then crosses false→true and fires one `opened` alert. Emits
1920
1918
  * `trackers-change`.
1921
1919
  */
1922
1920
  register(tracker: Tracker): void;
1923
- /** Store the {@link Job} backing a tracker — the reference linking it to the engine. */
1921
+ /** Stores the {@link Job} backing a tracker, which links it to the engine. */
1924
1922
  setJob(trackerId: string, job: Job): void;
1925
- /** Remove a tracker and tear down its job. */
1923
+ /** Removes a tracker and tears down its job. */
1926
1924
  unregister(trackerId: string): void;
1927
- /** Pause/resume a tracker AND its job (a paused job never recomputes, so never crosses edges). */
1925
+ /** Pauses or resumes a tracker and its job. A paused job never recomputes or crosses edges. */
1928
1926
  setEnabled(trackerId: string, enabled: boolean): boolean;
1929
1927
  /** Live trackers, as copies so external mutation can't corrupt the store. */
1930
1928
  get trackers(): readonly Tracker[];
1931
1929
  get(trackerId: string): Tracker | undefined;
1932
1930
  /**
1933
- * Trackers whose rule reads `entryId` — e.g. every tracker watching a given incidents area. Drives
1934
- * "show all trackers for this area" in the UI.
1931
+ * The trackers whose rule reads `entryId`, such as every tracker watching a given incidents area.
1932
+ * Drives "show all trackers for this area" in the UI.
1935
1933
  */
1936
1934
  trackersForEntry(entryId: string): readonly Tracker[];
1937
1935
  /**
@@ -1942,13 +1940,14 @@ declare class EventsState implements StateSlice {
1942
1940
  trackerId?: string;
1943
1941
  sinceMs?: number;
1944
1942
  }): readonly TrackerEvent[];
1945
- /** Clear all trackers + log + job handles. Walked automatically by `destroyState`. */
1943
+ /** Clears all trackers, the log and job handles. `destroyState` calls it automatically. */
1946
1944
  reset(): void;
1947
1945
  /**
1948
- * Feed a freshly-computed verdict through the rising-edge reducer — called by the tracker's job `run`
1949
- * on each recompute (and once at arm time). Bails fast unless the tracker is live + enabled. A verdict
1950
- * flipping false→true logs `opened` (alert); true→false logs `resolved` (event). No change on
1951
- * active→active / inactive→inactive. `at` is the source-data sample time of the recompute.
1946
+ * Feeds a freshly computed verdict through the rising-edge reducer. The tracker's job `run` calls it
1947
+ * on each recompute and once at arm time. It bails fast unless the tracker is live and enabled. A
1948
+ * verdict flipping false→true logs `opened` (alert), and true→false logs `resolved` (event).
1949
+ * Active→active and inactive→inactive change nothing. `at` is the source-data sample time of the
1950
+ * recompute.
1952
1951
  */
1953
1952
  ingestVerdict(trackerId: string, verdict: Verdict, at: number): void;
1954
1953
  private append;
@@ -2014,29 +2013,28 @@ type TrafficAreaAnalyticsEntry = BaseEntry<TrafficAreaAnalytics> & {
2014
2013
  */
2015
2014
  type TrafficAreaAnalyticsStateEvents = {
2016
2015
  /**
2017
- * History changed — entry added, removed, or cleared via `reset()`. `entries` is the full
2018
- * snapshot after the change; `changedIds` lists the ids of the entries this specific change
2019
- * added, replaced in place, or removed.
2016
+ * An entry was added or removed, or `reset()` cleared the history. `entries` is the full
2017
+ * snapshot after the change, and `changedIds` lists the ids of the entries this change added,
2018
+ * replaced in place, or removed.
2020
2019
  */
2021
2020
  'entries-change': {
2022
2021
  entries: readonly TrafficAreaAnalyticsEntry[];
2023
2022
  changedIds: readonly string[];
2024
2023
  };
2025
- /** Set of entries currently rendered on the map changed. */
2024
+ /** The set of entries rendered on the map changed. */
2026
2025
  'shown-change': ReadonlySet<string>;
2027
- /** Per-entry viz config changed (mode / metric / scaleMode / …). */
2026
+ /** An entry's viz config (mode, metric, scaleMode, …) changed. */
2028
2027
  'config-change': {
2029
2028
  entryId: string;
2030
2029
  config: TrafficAreaAnalyticsModuleConfig | undefined;
2031
2030
  };
2032
- /** Display policy switched between `single` and `multiple`. */
2031
+ /** The display policy switched between `single` and `multiple`. */
2033
2032
  'mode-change': EntryMode;
2034
2033
  };
2035
2034
  /**
2036
- * Append-only history of traffic-area-analytics aggregations, with per-entry
2037
- * rendering. Each entry owns a dedicated {@link TrafficAreaAnalyticsModule},
2038
- * lazy-initialised on first show. Mirrors the per-entry pattern used by
2039
- * `RoutingState` / `CustomGeometriesState`.
2035
+ * An append-only history of traffic-area-analytics aggregations, with per-entry
2036
+ * rendering. As in `RoutingState` and `CustomGeometriesState`, each entry owns a
2037
+ * dedicated {@link TrafficAreaAnalyticsModule}, initialised lazily on first show.
2040
2038
  *
2041
2039
  * Live tile overlays (flow + incidents) live in {@link TrafficTilesState}.
2042
2040
  *
@@ -2046,7 +2044,7 @@ declare class TrafficAreaAnalyticsState implements ShownEntriesSlice, StateSlice
2046
2044
  private readonly _ttMap;
2047
2045
  private _entries;
2048
2046
  private _entryMode;
2049
- /** Subscribe to state changes — see {@link TrafficAreaAnalyticsStateEvents}. */
2047
+ /** The state change events, listed in {@link TrafficAreaAnalyticsStateEvents}. */
2050
2048
  readonly events: StateEvents<TrafficAreaAnalyticsStateEvents>;
2051
2049
  constructor(_ttMap: TomTomMap);
2052
2050
  get entries(): readonly TrafficAreaAnalyticsEntry[];
@@ -2056,25 +2054,25 @@ declare class TrafficAreaAnalyticsState implements ShownEntriesSlice, StateSlice
2056
2054
  setEntryMode(mode: EntryMode): Promise<void>;
2057
2055
  findById(entryId: string): TrafficAreaAnalyticsEntry | undefined;
2058
2056
  /**
2059
- * Append a new entry. Auto-suffixes the id on collision. Under `single` mode the new entry
2060
- * replaces every older one (hidden + dropped from history).
2057
+ * Appends a new entry and suffixes its id on collision. In `single` mode it replaces every
2058
+ * older one, which is hidden and dropped from history.
2061
2059
  */
2062
2060
  addEntry(data: TrafficAreaAnalytics, label: string, params: TrafficAreaAnalyticsParams, explicitId?: string): Promise<string>;
2063
2061
  /**
2064
- * Lazy-init the entry's TrafficAreaAnalyticsModule, wiring per-entry config-change events.
2065
- * Throws on unknown id.
2062
+ * Initialises the entry's TrafficAreaAnalyticsModule lazily, wiring its config-change
2063
+ * events. Throws on unknown id.
2066
2064
  */
2067
2065
  getEntryModule(entryId: string): Promise<TrafficAreaAnalyticsModule>;
2068
- /** Render this entry's analytics on its own module. Under `single` mode, hides every other shown entry first. */
2066
+ /** Renders the entry's analytics on its own module. In `single` mode, hides every other shown entry first. */
2069
2067
  showEntry(entryId: string): Promise<void>;
2070
- /** Hide the entry's analytics on its module. No-op when unknown or already hidden. */
2068
+ /** Hides the entry's analytics on its module. Does nothing if unknown or already hidden. */
2071
2069
  hideEntry(entryId: string): Promise<void>;
2072
- /** Drop a single entry from history. Hides it first, then removes; emits `entries-change`. No-op on unknown id. */
2070
+ /** Hides a single entry, then drops it from history and emits `entries-change`. Does nothing for an unknown id. */
2073
2071
  removeEntry(entryId: string): Promise<void>;
2074
2072
  private _requireEntry;
2075
2073
  /**
2076
- * Hide every traffic-area-analytics entry currently on the map. Map-only — history is kept.
2077
- * Implements {@link ClearableMapSlice}.
2074
+ * Hides every traffic-area-analytics entry on the map but keeps the history. Implements
2075
+ * {@link ClearableMapSlice}.
2078
2076
  */
2079
2077
  clearShown(): Promise<void>;
2080
2078
  reset(): void;
@@ -2095,7 +2093,7 @@ type IncidentsAnalysis = EntryAnalysis;
2095
2093
  //#region src/state/traffic-incidents/clustering.d.ts
2096
2094
  /** Direction a cluster's total delay is trending across recent snapshots. */
2097
2095
  type ClusterTrend = 'growing' | 'fading' | 'steady' | 'new';
2098
- /** Tuneable parameters for {@link runClustering}. All optional with sensible defaults. */
2096
+ /** Tuneable parameters for {@link runClustering}, all optional with sensible defaults. */
2099
2097
  type ClusteringParams = {
2100
2098
  /** DBSCAN neighbourhood radius in km. Default: 0.5 */
2101
2099
  eps?: number;
@@ -2107,13 +2105,13 @@ type ClusteringParams = {
2107
2105
  preFilter?: {
2108
2106
  /** Categories to exclude entirely. Default: `['roadworks', 'road-closed']` */
2109
2107
  excludeCategories?: string[];
2110
- /** Incidents with `delayInSeconds` below this are excluded (within excludeCategories). Default: 1 (i.e. exclude 0-delay) */
2108
+ /** Incidents in excludeCategories with `delayInSeconds` below this are excluded. Default: 1 (excludes 0-delay) */
2111
2109
  minDelaySeconds?: number;
2112
2110
  };
2113
2111
  };
2114
2112
  /** A single cluster produced by {@link runClustering}. */
2115
2113
  type ClusterResult = {
2116
- /** Stable identifier — reused across runs when member overlap >= 50%. */
2114
+ /** A stable identifier, reused across runs when member overlap >= 50%. */
2117
2115
  id: string;
2118
2116
  /** Geographic centre of the cluster `[lng, lat]`. */
2119
2117
  centroid: [number, number];
@@ -2131,12 +2129,12 @@ type ClusterResult = {
2131
2129
  primaryRoads: string[];
2132
2130
  /** Most-frequent incident category across members (e.g. "jam"). */
2133
2131
  primaryCategory: string;
2134
- /** Trend across recent snapshots — see {@link classifyTrend}. */
2132
+ /** Trend across recent snapshots (see {@link classifyTrend}). */
2135
2133
  trend: ClusterTrend;
2136
2134
  /**
2137
- * Rolling window of `totalDelaySeconds` across recent matched snapshots
2138
- * (bounded to {@link TREND_WINDOW}). Internal trend state threaded forward
2139
- * via the previous run; not display data.
2135
+ * Rolling window of `totalDelaySeconds` across recent matched snapshots,
2136
+ * bounded to {@link TREND_WINDOW}. Internal trend state threaded forward
2137
+ * via the previous run, not display data.
2140
2138
  */
2141
2139
  delaySamples: number[];
2142
2140
  };
@@ -2146,7 +2144,7 @@ type ClusteringOutput = {
2146
2144
  };
2147
2145
  /**
2148
2146
  * {@link runClustering} output plus the moment it was computed. The extra `sampledAt` lets the sandbox
2149
- * `cluster()` primitive thread the trend window forward without the caller juggling timestamps: it is
2147
+ * `cluster()` primitive thread the trend window forward without the caller juggling timestamps. It is
2150
2148
  * stamped onto the result and read back off `previous` on the next call.
2151
2149
  *
2152
2150
  * @group Agent Toolkit
@@ -2178,8 +2176,8 @@ type IncidentSnapshot = {
2178
2176
  incidents: TrafficIncident[];
2179
2177
  };
2180
2178
  /**
2181
- * Lifecycle state of a per-entry incidents monitor. `stopped-error` indicates the last
2182
- * poll failed and the timer has been cleared — start the monitor again to retry.
2179
+ * The lifecycle state of a per-entry incidents monitor. `stopped-error` means the last
2180
+ * poll failed and the timer was cleared. To retry, start the monitor again.
2183
2181
  *
2184
2182
  * @group Agent Toolkit
2185
2183
  */
@@ -2187,13 +2185,13 @@ type PollingStatus = 'idle' | 'running' | 'stopped-error';
2187
2185
  //#endregion
2188
2186
  //#region src/state/traffic-incidents/monitor/monitor.d.ts
2189
2187
  /**
2190
- * Dependency injection for an {@link IncidentMonitor}. Production code wires
2191
- * `fetchIncidents` to `trafficIncidentDetails`; tests can pass a deterministic fake
2188
+ * The injected dependencies of an {@link IncidentMonitor}. Production code wires
2189
+ * `fetchIncidents` to `trafficIncidentDetails`. Tests can pass a deterministic fake
2192
2190
  * and override the timer.
2193
2191
  *
2194
- * The fetcher returns just the incidents — the monitor stamps `takenAt` itself
2195
- * so every consumer of one tick (entry data, derived analyses, sandbox `now`)
2196
- * agrees on the same canonical moment.
2192
+ * The fetcher returns only the incidents. The monitor stamps `takenAt` itself, so
2193
+ * every consumer of one tick (entry data, derived analyses, sandbox `now`) agrees
2194
+ * on the same canonical moment.
2197
2195
  *
2198
2196
  * @group Agent Toolkit
2199
2197
  */
@@ -2205,19 +2203,19 @@ type IncidentMonitorDeps = {
2205
2203
  };
2206
2204
  /**
2207
2205
  * Events fired by {@link IncidentMonitor}. The slice subscribes once and re-emits
2208
- * translated copies (`monitor-tick` / `monitor-error`) keyed by entry id.
2206
+ * translated copies (`monitor-tick`, `monitor-error`) keyed by entry id.
2209
2207
  */
2210
2208
  type IncidentMonitorEvents = {
2211
2209
  /** A poll succeeded. Payload: the fresh snapshot. */
2212
2210
  tick: IncidentSnapshot;
2213
- /** A poll failed — the monitor has cleared its timer and moved to `stopped-error`. */
2211
+ /** A poll failed, so the monitor cleared its timer and moved to `stopped-error`. */
2214
2212
  error: string;
2215
2213
  };
2216
2214
  /**
2217
- * One-shot polling loop scoped to a single bbox. Owns its timer, status, error,
2218
- * and captured area. Re-starting after `stop()` is allowed and resets all state.
2215
+ * A one-shot polling loop scoped to a single bbox. It owns its timer, status, error,
2216
+ * and captured area. Restarting it after `stop()` resets all state.
2219
2217
  *
2220
- * The monitor never knows about the entry that owns it — it surfaces ticks/errors
2218
+ * The monitor never knows about the entry that owns it. It surfaces ticks and errors
2221
2219
  * through `events`, and the caller decides what to do with the snapshot.
2222
2220
  *
2223
2221
  * @group Agent Toolkit
@@ -2236,25 +2234,26 @@ declare class IncidentMonitor {
2236
2234
  get monitoredArea(): MonitoredArea | undefined;
2237
2235
  get error(): string | undefined;
2238
2236
  /**
2239
- * True when the monitor is *currently* polling. Distinct from {@link isActive},
2240
- * which also covers `stopped-error` — a state where the timer is gone but the
2241
- * monitor still carries an unacknowledged error. Use this for "is the entry
2242
- * being polled right now"; use `isActive` for "is there anything to clean up".
2237
+ * Whether the monitor is *currently* polling. Unlike {@link isActive}, it excludes
2238
+ * `stopped-error`, a state where the timer is gone but the monitor still carries an
2239
+ * unacknowledged error. Use this to ask "is the entry being polled right now", and
2240
+ * `isActive` to ask "is there anything to clean up".
2243
2241
  */
2244
2242
  get isRunning(): boolean;
2245
- /** True when the monitor has any polling activity (running or stopped-error). */
2243
+ /** Whether the monitor has any polling activity (running or stopped-error). */
2246
2244
  get isActive(): boolean;
2247
2245
  /**
2248
- * Begin polling. Captures `deps` for the lifetime of the run, fires the first tick
2249
- * immediately (unless `skipInitialTick`), then schedules an interval. No-op when already running.
2246
+ * Starts polling. It captures `deps` for the lifetime of the run, fires the first tick
2247
+ * immediately unless `skipInitialTick` is set, then schedules an interval. Does nothing if
2248
+ * already running.
2250
2249
  *
2251
- * `skipInitialTick` is for the caller that JUST fetched the data itself (e.g. getTrafficIncidents
2252
- * arming monitoring on the entry it just loaded): the entry is already fresh, so an eager first
2253
- * tick would be a redundant duplicate fetch. Standalone callers leave it false so the monitor
2250
+ * Set `skipInitialTick` if you just fetched the data yourself, as getTrafficIncidents does
2251
+ * when arming monitoring on the entry it just loaded. The entry is already fresh, so an eager
2252
+ * first tick would duplicate that fetch. Standalone callers leave it false, so the monitor
2254
2253
  * produces an initial snapshot without waiting a full interval.
2255
2254
  */
2256
2255
  start(area: MonitoredArea, deps: IncidentMonitorDeps, intervalMs?: number, skipInitialTick?: boolean): void;
2257
- /** Stop polling and reset state. No-op when idle. */
2256
+ /** Stops polling and resets state. Does nothing when idle. */
2258
2257
  stop(): void;
2259
2258
  private _tick;
2260
2259
  private _failed;
@@ -2263,12 +2262,12 @@ declare class IncidentMonitor {
2263
2262
  //#endregion
2264
2263
  //#region src/state/traffic-incidents/state.d.ts
2265
2264
  /**
2266
- * Dedicated per-entry clustering state. Incident clustering is NOT a generic analysis — it is typed,
2265
+ * Dedicated per-entry clustering state. Incident clustering is **not** a generic analysis. It is typed,
2267
2266
  * first-class incidents state with its own home here. `output` is the latest {@link SandboxClusteringOutput}
2268
- * (the DBSCAN groups + the moment it was computed); `recipe` is how to recompute it (re-used by
2269
- * `tools/state/clusters-runtime.ts` to re-run on each monitor tick so clusters stay live). `recipe`
2270
- * is opaque here (a tools-layer `ClusterRecipe`) — the slice never interprets it, keeping the state layer
2271
- * tools-agnostic.
2267
+ * (the DBSCAN groups and the moment they were computed). `recipe` is how to recompute it, and
2268
+ * `tools/state/clusters-runtime.ts` reuses it on each monitor tick so clusters stay live. `recipe` is
2269
+ * opaque here (a tools-layer `ClusterRecipe`). The slice never interprets it, which keeps the state
2270
+ * layer tools-agnostic.
2272
2271
  *
2273
2272
  * @group Agent Toolkit
2274
2273
  */
@@ -2327,7 +2326,7 @@ type TrafficIncidentsEntry = BaseEntry<TrafficIncident[]> & {
2327
2326
  _tick?: number;
2328
2327
  };
2329
2328
  /**
2330
- * Snapshot of an entry's focus subset. Returned by `getFocus` / payload on `focus-change`.
2329
+ * Snapshot of an entry's focus subset, returned by `getFocus` and carried by `focus-change`.
2331
2330
  *
2332
2331
  * @group Agent Toolkit
2333
2332
  */
@@ -2337,14 +2336,14 @@ type IncidentFocus = {
2337
2336
  };
2338
2337
  /**
2339
2338
  * Events fired by {@link TrafficIncidentsState}. Subscribe via
2340
- * `state.trafficIncidents.events.on(type, handler)` — returns an unsubscribe function.
2339
+ * `state.trafficIncidents.events.on(type, handler)`, which returns an unsubscribe function.
2341
2340
  *
2342
2341
  * @group Agent Toolkit
2343
2342
  */
2344
2343
  type TrafficIncidentsStateEvents = {
2345
2344
  /**
2346
- * History changed — entry added, replaced, removed, or cleared via `reset()`. `entries` is the
2347
- * full snapshot after the change; `changedIds` lists the ids of the entries this specific change
2345
+ * An entry was added, replaced or removed, or `reset()` cleared the history. `entries` is the
2346
+ * full snapshot after the change, and `changedIds` lists the ids of the entries this change
2348
2347
  * added, replaced in place, or removed. The {@link JobEngine} and the clustering re-run
2349
2348
  * match these against the entries they depend on.
2350
2349
  */
@@ -2352,46 +2351,46 @@ type TrafficIncidentsStateEvents = {
2352
2351
  entries: readonly TrafficIncidentsEntry[];
2353
2352
  changedIds: readonly string[];
2354
2353
  };
2355
- /** Set of entries currently rendered on the map changed. */
2354
+ /** The set of entries rendered on the map changed. */
2356
2355
  'shown-change': ReadonlySet<TrafficIncidentsEntry['id']>;
2357
- /** Focus subset for an entry changed (or cleared, when `focus === null`). */
2356
+ /** An entry's focus subset changed, or was cleared if `focus === null`. */
2358
2357
  'focus-change': {
2359
2358
  entryId: TrafficIncidentsEntry['id'];
2360
2359
  focus: IncidentFocus | null;
2361
2360
  };
2362
- /** Display policy switched between `single` and `multiple`. */
2361
+ /** The display policy switched between `single` and `multiple`. */
2363
2362
  'mode-change': EntryMode;
2364
- /** A monitored entry produced a fresh snapshot (per-tick). */
2363
+ /** A monitored entry's tick produced a fresh snapshot. */
2365
2364
  'monitor-tick': {
2366
2365
  entryId: TrafficIncidentsEntry['id'];
2367
2366
  snap: IncidentSnapshot;
2368
2367
  };
2369
- /** A monitored entry's poll failed — slice has cleared the timer. */
2368
+ /** A monitored entry's poll failed, and the slice cleared the timer. */
2370
2369
  'monitor-error': {
2371
2370
  entryId: TrafficIncidentsEntry['id'];
2372
2371
  error: string;
2373
2372
  };
2374
2373
  /**
2375
- * Polling began on an entry (idle → running). Skipped when `startMonitoring`
2376
- * was a no-op against an already-running monitor.
2374
+ * Polling began on an entry (idle → running). Skipped if `startMonitoring`
2375
+ * found the monitor already running.
2377
2376
  */
2378
2377
  'monitor-start': {
2379
2378
  entryId: TrafficIncidentsEntry['id'];
2380
2379
  };
2381
2380
  /**
2382
- * Polling halted on an entry. `reason: 'manual'` covers explicit
2383
- * `stopMonitoring` and entry teardown (remove / single-mode trim / reset).
2384
- * `reason: 'error'` fires alongside `monitor-error` — error-only listeners
2385
- * keep using `monitor-error`; lifecycle listeners can rely on this alone.
2381
+ * Polling halted on an entry. `reason: 'manual'` covers an explicit
2382
+ * `stopMonitoring` and entry teardown (remove, single-mode trim, reset).
2383
+ * `reason: 'error'` fires alongside `monitor-error`. Error-only listeners
2384
+ * keep using `monitor-error`, and lifecycle listeners can rely on this alone.
2386
2385
  */
2387
2386
  'monitor-stop': {
2388
2387
  entryId: TrafficIncidentsEntry['id'];
2389
2388
  reason: 'manual' | 'error';
2390
2389
  };
2391
2390
  /**
2392
- * An entry's clustering result changed — set, recomputed on a tick, or cleared (`clusters === null`).
2393
- * UI that renders cluster pins re-derives off this (not `entries-change`): the clustering re-run is
2394
- * async to the monitor tick, so the fresh result lands here a step later.
2391
+ * An entry's clustering result was set, recomputed on a tick, or cleared (`clusters === null`).
2392
+ * UI that renders cluster pins re-derives from this, not from `entries-change`, because the
2393
+ * clustering re-run is async to the monitor tick, so the fresh result lands here a step later.
2395
2394
  */
2396
2395
  'clusters-change': {
2397
2396
  entryId: TrafficIncidentsEntry['id'];
@@ -2399,11 +2398,11 @@ type TrafficIncidentsStateEvents = {
2399
2398
  };
2400
2399
  };
2401
2400
  /**
2402
- * State for traffic incidents: entry history and map rendering via per-entry
2403
- * TrafficIncidentDetailsModule. Each entry can be a separate area; under the default
2401
+ * State for traffic incidents, with entry history and map rendering via per-entry
2402
+ * TrafficIncidentDetailsModule. Each entry can be a separate area, and in the default
2404
2403
  * `multiple` mode several entries can render at once.
2405
2404
  *
2406
- * Each entry owns its own module (lazy-init on first show) plus an optional per-entry
2405
+ * Each entry owns its own module, initialised lazily on first show, plus an optional
2407
2406
  * background monitor. Subscribe to changes via `events.on('...')`.
2408
2407
  *
2409
2408
  * @group Agent Toolkit
@@ -2413,84 +2412,84 @@ declare class TrafficIncidentsState implements StateSlice {
2413
2412
  private _entries;
2414
2413
  private _entryMode;
2415
2414
  private readonly _clusters;
2416
- /** Subscribe to state changes — see {@link TrafficIncidentsStateEvents}. */
2415
+ /** The state change events, listed in {@link TrafficIncidentsStateEvents}. */
2417
2416
  readonly events: StateEvents<TrafficIncidentsStateEvents>;
2418
2417
  constructor(_ttMap: TomTomMap);
2419
2418
  get entries(): readonly TrafficIncidentsEntry[];
2420
2419
  /**
2421
- * Display policy: `multiple` (default) keeps every history entry available to render
2422
- * simultaneously; `single` enforces "at most one entry on the map at a time" and trims
2423
- * the history down to the latest entry whenever it's set.
2420
+ * The display policy. `multiple` (default) keeps every history entry available to render
2421
+ * simultaneously. `single` allows at most one entry on the map at a time and trims the
2422
+ * history to the latest entry whenever it's set.
2424
2423
  */
2425
2424
  get entryMode(): EntryMode;
2426
2425
  /**
2427
- * Switch the display policy. When moving from `multiple` → `single` we hide every entry
2428
- * older than the latest, drop them from history, and emit `entries-change`. No-op when the
2429
- * mode hasn't changed.
2426
+ * Switches the display policy. Moving from `multiple` to `single` hides every entry older
2427
+ * than the latest, drops them from history, and emits `entries-change`. Does nothing if
2428
+ * the mode hasn't changed.
2430
2429
  */
2431
2430
  setEntryMode(mode: EntryMode): Promise<void>;
2432
2431
  /** Set of entries currently rendered on the map. */
2433
2432
  get shownEntryIds(): ReadonlySet<TrafficIncidentsEntry['id']>;
2434
2433
  /**
2435
- * Append a new entry to the history. Under `single` mode the new entry replaces every
2436
- * older one (and tears their modules + monitors down). `sampledAt` is the moment the
2437
- * data was captured — pass one canonical value per "moment" so future joins (entry
2438
- * data ↔ derived analyses) are byte-equal. Returns the assigned id.
2434
+ * Appends a new entry to the history and returns its assigned id. In `single` mode the new
2435
+ * entry replaces every older one and tears down their modules and monitors. `sampledAt` is
2436
+ * the moment the data was captured. Pass one canonical value per "moment" so future joins
2437
+ * (entry data ↔ derived analyses) are byte-equal.
2439
2438
  */
2440
2439
  addIncidentsEntry(data: TrafficIncident[], params: TrafficIncidentDetailsByBBoxParams & {
2441
2440
  bbox: BBox;
2442
2441
  }, label: string, sampledAt: number, explicitId?: string): Promise<string>;
2443
2442
  /**
2444
- * Replace an entry's data in place and repaint its module without moving the camera.
2445
- * Used by the per-entry monitor tick so incident geometries and any open detail
2446
- * panel stay in sync with the freshest snapshot. `sampledAt` is the canonical moment
2447
- * for this update — propagated to the entry timestamp before the `entries-change` emit.
2448
- * That emit is what drives analysis replay: the session-level {@link JobEngine} re-runs every
2449
- * job bound to this entry off the change, ASYNCHRONOUSLY (a microtask later) — the slice itself
2450
- * owns no analysis logic.
2451
- * Returns true on success, false when the entry is unknown.
2443
+ * Replaces an entry's data in place and repaints its module without moving the camera.
2444
+ * The per-entry monitor tick uses it so incident geometries and any open detail panel
2445
+ * stay in sync with the freshest snapshot. `sampledAt` is the canonical moment for this
2446
+ * update, propagated to the entry timestamp before the `entries-change` emit. That emit
2447
+ * drives analysis replay. The session-level {@link JobEngine} re-runs every job bound to
2448
+ * this entry off the change **asynchronously**, a microtask later. The slice itself owns
2449
+ * no analysis logic.
2450
+ * Returns true on success, false if the entry is unknown.
2452
2451
  */
2453
2452
  replaceEntryData(entryId: TrafficIncidentsEntry['id'], data: TrafficIncident[], sampledAt: number): Promise<boolean>;
2454
2453
  /**
2455
- * Lazy-init and return the entry's TrafficIncidentDetailsModule. Consumers subscribe to
2456
- * clicks directly on the returned module via `module.events.on('click', ...)`;
2454
+ * Returns the entry's TrafficIncidentDetailsModule, created on first call. To handle
2455
+ * clicks, subscribe on the returned module via `module.events.on('click', ...)`.
2457
2456
  * Throws on unknown entry id.
2458
2457
  */
2459
2458
  getEntryModule(entryId: TrafficIncidentsEntry['id']): Promise<TrafficIncidentDetailsModule>;
2460
2459
  /**
2461
- * Render an entry on the map. Lazy-inits its module, pushes the entry's incidents, and
2462
- * (when `fitBounds` is true) fits the camera to the entry's bbox. Emits `shown-change`
2463
- * once the entry transitions to shown.
2460
+ * Renders an entry on the map. Lazy-inits its module, pushes the entry's incidents, and
2461
+ * fits the camera to the entry's bbox if `fitBounds` is true. Emits `shown-change` once
2462
+ * the entry transitions to shown.
2464
2463
  */
2465
2464
  showEntry(entryId: TrafficIncidentsEntry['id'], fitBounds?: boolean): Promise<void>;
2466
2465
  /**
2467
- * Hide an entry — clears its module + drops focus. The module reference stays on the
2468
- * entry for cheap re-show. No-op when the entry is unknown or already hidden.
2466
+ * Hides an entry by clearing its module and dropping focus. The module reference stays
2467
+ * on the entry for cheap re-show. Does nothing if the entry is unknown or already hidden.
2469
2468
  */
2470
2469
  hideEntry(entryId: TrafficIncidentsEntry['id']): Promise<void>;
2471
2470
  /**
2472
- * Drop an entry from history. Hides it from the map and stops its monitor if any.
2473
- * Emits `entries-change` and, when the entry was shown, `shown-change`. No-op when the
2474
- * id is unknown.
2471
+ * Drops an entry from history, hiding it from the map and stopping any monitor. Emits
2472
+ * `entries-change`, plus `shown-change` if the entry was shown. Does nothing if the id
2473
+ * is unknown.
2475
2474
  */
2476
2475
  removeEntry(entryId: TrafficIncidentsEntry['id']): Promise<void>;
2477
2476
  /**
2478
- * Store (or replace) an entry's clustering record and emit `clusters-change`. No-op when the entry is
2479
- * unknown — clusters are entry-scoped, so an orphan record is meaningless. Called by `clusterIncidents`
2480
- * and its monitor-tick re-run (`tools/state/clusters-runtime.ts`).
2477
+ * Stores or replaces an entry's clustering record and emits `clusters-change`. Does nothing if the
2478
+ * entry is unknown, because clusters are entry-scoped and an orphan record is meaningless.
2479
+ * `clusterIncidents` and its monitor-tick re-run (`tools/state/clusters-runtime.ts`) call it.
2481
2480
  */
2482
2481
  setClusters(entryId: TrafficIncidentsEntry['id'], record: ClustersRecord): void;
2483
- /** Latest clustering output for an entry, or undefined when none has been computed. */
2482
+ /** The latest clustering output for an entry, or undefined if none was computed. */
2484
2483
  getClusters(entryId: TrafficIncidentsEntry['id']): SandboxClusteringOutput | undefined;
2485
- /** Full clustering record (recipe + output) for an entry — the re-run reads this back. */
2484
+ /** The full clustering record (recipe and output) for an entry, which the re-run reads back. */
2486
2485
  getClustersRecord(entryId: TrafficIncidentsEntry['id']): ClustersRecord | undefined;
2487
- /** Drop an entry's clustering. Emits `clusters-change` with `null`. No-op when nothing is stored. */
2486
+ /** Drops an entry's clustering and emits `clusters-change` with `null`. Does nothing if none is stored. */
2488
2487
  clearClusters(entryId: TrafficIncidentsEntry['id']): void;
2489
- /** Snapshot of an entry's focus subset, or null when no focus is active or the entry is unknown. */
2488
+ /** Snapshot of an entry's focus subset, or null if no focus is active or the entry is unknown. */
2490
2489
  getFocus(entryId: TrafficIncidentsEntry['id']): IncidentFocus | null;
2491
2490
  /**
2492
- * Set the focus subset on a specific entry. Filters ids against the entry's current
2493
- * incidents (drops unknown ones) and pushes the result onto the entry's module.
2491
+ * Sets the focus subset on a specific entry. Filters ids against the entry's current
2492
+ * incidents, dropping unknown ones, and pushes the result onto the entry's module.
2494
2493
  * Returns the kept count and any dropped ids.
2495
2494
  */
2496
2495
  setFocus(entryId: TrafficIncidentsEntry['id'], ids: readonly string[], reason?: string): {
@@ -2499,46 +2498,46 @@ declare class TrafficIncidentsState implements StateSlice {
2499
2498
  };
2500
2499
  clearFocus(entryId: TrafficIncidentsEntry['id']): void;
2501
2500
  /**
2502
- * The focused incidents in the order passed to {@link setFocus}. Empty when no focus is
2503
- * active on the entry or when the entry is unknown. Used by UI layers that step through
2504
- * the focused subset (prev/next).
2501
+ * The focused incidents in the order passed to {@link setFocus}, or empty if no focus is
2502
+ * active on the entry or the entry is unknown. UI layers use it to step through the
2503
+ * focused subset (prev/next).
2505
2504
  */
2506
2505
  focusedFeatures(entryId: TrafficIncidentsEntry['id']): TrafficIncident[];
2507
2506
  /**
2508
- * Fly the camera to the i-th focused incident on an entry (0-based). Wraps out-of-range
2509
- * indices so callers can pass raw prev/next counters. No-op when the entry has no active
2510
- * focus. Line geometries fitBounds; points flyTo with a sensible zoom.
2507
+ * Flies the camera to the i-th focused incident on an entry (0-based). Wraps out-of-range
2508
+ * indices, so callers can pass raw prev/next counters. Does nothing if the entry has no active
2509
+ * focus. Line geometries use fitBounds, points flyTo with a sensible zoom.
2511
2510
  */
2512
2511
  navigateFocus(entryId: TrafficIncidentsEntry['id'], index: number): void;
2513
2512
  /**
2514
- * Walk entries newest-first to find which one currently holds an incident with this id.
2515
- * Useful for UI layers that hold an incident id without remembering which entry produced it.
2513
+ * Walks entries newest-first to find the one that holds an incident with this id. UI layers
2514
+ * use it when they hold an incident id without remembering which entry produced it.
2516
2515
  */
2517
2516
  findEntryWithIncident(incidentId: string): TrafficIncidentsEntry | undefined;
2518
2517
  /**
2519
- * Start polling for an entry. Lazy-creates an {@link IncidentMonitor}, wires its events
2520
- * once, then delegates to {@link IncidentMonitor.start}. No-op when polling is already
2518
+ * Starts polling for an entry. Lazy-creates an {@link IncidentMonitor}, wires its events
2519
+ * once, then delegates to {@link IncidentMonitor.start}. Does nothing if polling is already
2521
2520
  * running. Throws on unknown entry id.
2522
2521
  */
2523
2522
  startMonitoring(entryId: TrafficIncidentsEntry['id'], area: MonitoredArea, deps: IncidentMonitorDeps, opts?: {
2524
2523
  intervalMs?: number;
2525
2524
  skipInitialTick?: boolean;
2526
2525
  }): void;
2527
- /** Stop polling. No-op when idle or unknown. */
2526
+ /** Stops polling. Does nothing if idle or unknown. */
2528
2527
  stopMonitoring(entryId: TrafficIncidentsEntry['id']): void;
2529
2528
  /**
2530
- * True when the entry is *currently* being polled. A monitor stuck in
2531
- * `stopped-error` returns false here so the start tool can report a truthful
2529
+ * Whether the entry is *currently* being polled. A monitor stuck in
2530
+ * `stopped-error` returns false here, so the start tool can report a truthful
2532
2531
  * `alreadyRunning` and a fresh `start` call actually re-arms the timer
2533
- * instead of silently being treated as a no-op.
2532
+ * instead of silently doing nothing.
2534
2533
  */
2535
2534
  isMonitored(entryId: TrafficIncidentsEntry['id']): boolean;
2536
2535
  private _createMonitorForEntry;
2537
2536
  private _requireEntry;
2538
2537
  private _teardownEntry;
2539
2538
  /**
2540
- * Hide every traffic-incidents entry currently on the map. Map-only — history is kept.
2541
- * Implements {@link ClearableMapSlice}.
2539
+ * Hides every traffic-incidents entry on the map but keeps the history. Implements
2540
+ * {@link ClearableMapSlice}.
2542
2541
  */
2543
2542
  clearShown(): Promise<void>;
2544
2543
  reset(): void;
@@ -2546,9 +2545,9 @@ declare class TrafficIncidentsState implements StateSlice {
2546
2545
  //#endregion
2547
2546
  //#region src/state/traffic-tiles/state.d.ts
2548
2547
  /**
2549
- * State for traffic tile overlays — flow tiles and incident overlay tiles. These are
2550
- * raster/tile layers that the user toggles on top of the base map; result caching and
2551
- * per-result rendering for incident *features* lives in {@link TrafficIncidentsState},
2548
+ * State for traffic tile overlays, the flow tiles and incident overlay tiles. These are
2549
+ * raster/tile layers that the user toggles on top of the base map. Result caching and
2550
+ * per-result rendering for incident *features* live in {@link TrafficIncidentsState},
2552
2551
  * and analytics aggregations in {@link TrafficAreaAnalyticsState}.
2553
2552
  *
2554
2553
  * @group Agent Toolkit
@@ -2585,15 +2584,15 @@ export declare const hidePreviousShownEntries: (slice: ShownEntriesSlice, keepEn
2585
2584
  */
2586
2585
  export type QueryAs = 'poi' | 'place';
2587
2586
  /**
2588
- * Resolves a query string to up to `limit` Places. POI search when `queryAs === 'poi'`, geocoding
2589
- * otherwise. Optional `bias` narrows the search to a region.
2587
+ * Resolves a query string to up to `limit` Places, using POI search when `queryAs === 'poi'`,
2588
+ * otherwise geocoding. The optional `bias` narrows the search to a region.
2590
2589
  */
2591
2590
  export declare const locatePlaces: (query: string, queryAs: QueryAs, options: {
2592
2591
  limit: number;
2593
2592
  bias?: GeoBias;
2594
2593
  }, execOptions?: ToolExecuteOptions) => Promise<Place[]>;
2595
2594
  /**
2596
- * The best match for a query, as the `locatePlace` tool resolves it, for a custom tool that needs one place.
2595
+ * Finds the best match for a query as the `locatePlace` tool does, for a custom tool that needs one place.
2597
2596
  * A failed or cancelled request rejects, so catch it in `execute`.
2598
2597
  *
2599
2598
  * @param bias - Favours results near a position, such as the map centre from {@link getViewportBias}.
@@ -2616,7 +2615,7 @@ export declare const locatePlace: (query: string, queryAs: QueryAs, bias?: GeoBi
2616
2615
  //#region src/tools/shared/location-input.d.ts
2617
2616
  /** @ignore */
2618
2617
  export type ResolvedLocation = {
2619
- /** Resolved place: a Place (with address metadata) or a bare [lng, lat] tuple. */
2618
+ /** A resolved Place with address metadata, or a bare [lng, lat] tuple. */
2620
2619
  place: WaypointLike;
2621
2620
  position: Position;
2622
2621
  name: string;
@@ -2749,8 +2748,8 @@ export type ResolvedEntries = {
2749
2748
  trafficAreaAnalytics: TrafficAreaAnalyticsEntry[];
2750
2749
  byod: BYODEntry[];
2751
2750
  };
2752
- /** Newest `timestamp` across every resolved source entry, or undefined when none carry one. The
2753
- * canonical `sampledAt` for a recurring sandbox run over these inputs. */
2751
+ /** Newest `timestamp` across every resolved source entry, or undefined when none carry one, as
2752
+ * the canonical `sampledAt` for a recurring sandbox run over these inputs. */
2754
2753
  export declare const latestTimestamp: (resolved: ResolvedEntries) => number | undefined;
2755
2754
  /**
2756
2755
  * Sandbox-facing inputs. Each kind is exposed as a single `<kind>ByEntry` record keyed by the entry id
@@ -2775,9 +2774,9 @@ export type SandboxInputs = {
2775
2774
  incidentsByEntry: Record<string, TrafficIncident[]> | undefined;
2776
2775
  /**
2777
2776
  * Per-source polygons collected from every requested source (place / places / ranges / customGeometries).
2778
- * Keyed by the tagged source `${kind}:${id}` (NOT a bare id: the same id can recur across kinds, e.g. a
2779
- * `place` vs a `customGeometries` entry), so the kind stays unambiguous. Each feature also self-describes
2780
- * its origin in `properties._source` (`{ kind, id }`).
2777
+ * The key is the tagged source `${kind}:${id}`, not a bare id, since the same id can recur across kinds
2778
+ * (e.g. a `place` and a `customGeometries` entry). This keeps the kind unambiguous. Each feature also
2779
+ * self-describes its origin in `properties._source` (`{ kind, id }`).
2781
2780
  */
2782
2781
  geometriesByEntry: Record<string, PolygonFeature[]> | undefined;
2783
2782
  /**
@@ -2787,7 +2786,7 @@ export type SandboxInputs = {
2787
2786
  */
2788
2787
  trafficAreaAnalyticsByEntry: Record<string, TrafficAreaAnalytics> | undefined;
2789
2788
  /**
2790
- * Per-entry BYOD, keyed by entry id. Each value is a FeatureCollection; mixed geometry types are normal
2789
+ * Per-entry BYOD, keyed by entry id. Each value is a FeatureCollection. Mixed geometry types are normal
2791
2790
  * (BYOD layers can be Point / LineString / Polygon).
2792
2791
  */
2793
2792
  byodByEntry: Record<string, FeatureCollection$1> | undefined;
@@ -2835,21 +2834,20 @@ export declare const prepareMultiInputs: (ids: MultiInputIds, state: ToolState)
2835
2834
  */
2836
2835
  export declare const BY_ENTRY_VIEWS_DOC: string;
2837
2836
  /**
2838
- * Names injected into the sandbox by analyseData / processData, in fixed order.
2837
+ * Names injected into the sandbox by analyseData, processData, createTracker and clusterIncidents, in fixed order.
2839
2838
  *
2840
2839
  * @ignore
2841
2840
  */
2842
2841
  export declare const MULTI_INPUT_SANDBOX_PARAMS: readonly ["placesByEntry", "routesByEntry", "incidentsByEntry", "geometriesByEntry", "trafficAreaAnalyticsByEntry", "byodByEntry", "h3", "turf", "routeUtils", "cluster"];
2843
2842
  /**
2844
2843
  * Common "tools available in the sandbox" prompt section, shared verbatim by
2845
- * analyseData and processData so the injected-library docs live in ONE place and the
2846
- * two tools never drift. It documents the three function namespaces handed to every
2847
- * sandbox body — `turf` / `h3` (base usage rules via {@link buildSandboxCodePrompt}),
2848
- * the cross-kind turf cheat-sheet ({@link CROSS_KIND_OPS_DOC}), and `routeUtils`
2849
- * ({@link ROUTE_UTILS_DOC}) — in a fixed order. The two scope-gated docs are appended
2850
- * only when relevant: cross-kind when scope commits to more than one kind, routeUtils
2851
- * when `routes` is in scope (matching the conditional `routeUtils` usefulness). Returns
2852
- * a block ending in a blank line, ready to drop straight into either tool's `code` doc.
2844
+ * analyseData, processData, clusterIncidents and createTracker so the injected-library docs
2845
+ * live in ONE place and the tools never drift. It documents `turf` / `h3` (base usage rules
2846
+ * via {@link buildSandboxCodePrompt}) and the per-entry input views. With `scoped`, the helper
2847
+ * docs follow the active kinds: the cross-kind turf cheat-sheet ({@link CROSS_KIND_OPS_DOC})
2848
+ * when more than one is active, `routeUtils` ({@link ROUTE_UTILS_DOC}) with `routes`, and
2849
+ * `cluster` with `incidents`. Returns a block ending in a blank line, ready to drop straight
2850
+ * into a tool's `code` doc.
2853
2851
  *
2854
2852
  * @ignore
2855
2853
  */
@@ -3224,7 +3222,7 @@ export declare const areaWhereSchema: z.ZodObject<{
3224
3222
  widthMeters: z.ZodNumber;
3225
3223
  }, z.core.$strip>>;
3226
3224
  }, z.core.$strip>;
3227
- /** The `where` fields resolve-where.ts resolves — inferred from {@link areaWhereSchema}. */
3225
+ /** The `where` fields resolve-where.ts resolves, inferred from {@link areaWhereSchema}. */
3228
3226
  export type AreaWhere = z.infer<typeof areaWhereSchema>;
3229
3227
  //#endregion
3230
3228
  //#region src/tools/shared/resolve-where.d.ts
@@ -3255,8 +3253,8 @@ export declare const resolveGlobal: () => ResolvedBias;
3255
3253
  export type ResolvedArea = {
3256
3254
  bbox: BBox;
3257
3255
  polygon?: Polygon | MultiPolygon;
3258
- /** The GROUNDED match label — `freeformAddress, <countryCode>` for a `query` area — i.e. what the
3259
- * data was actually loaded for, NOT the query echo. Lets a consumer surface where a query really
3256
+ /** The grounded match label (`freeformAddress, <countryCode>` for a `query` area), meaning what the
3257
+ * data was actually loaded for, not the query echo. It lets a consumer surface where a query really
3260
3258
  * resolved. */
3261
3259
  label?: string;
3262
3260
  source: AreaSource;
@@ -3283,12 +3281,12 @@ export declare const isResolveError: (r: unknown) => r is ResolveError;
3283
3281
  * @module agent-toolkit-tools
3284
3282
  *
3285
3283
  * The `routeUtils` namespace injected into sandboxed model-authored code, so a routes input can be
3286
- * sliced and measured without re-implementing it. Its own module because the worker entry
3287
- * (`sandbox/sdk-utils-worker-entry.ts`) is bundled standalone at SDK build time, so importing it
3284
+ * sliced and measured without re-implementing it. It has its own module because the worker entry
3285
+ * (`sandbox/sdk-utils-worker-entry.ts`) is bundled standalone at SDK build time, and importing it
3288
3286
  * from `multi-input.ts` would pull that module's prompt text into the worker bundle.
3289
3287
  *
3290
- * Every function here depends only on `@turf/turf` — available in the worker as `self.turf` — and
3291
- * pure local helpers, which is what makes the set portable into the sandbox.
3288
+ * Every function here depends only on `@turf/turf` (available in the worker as `self.turf`) and
3289
+ * pure local helpers, which makes the set portable into the sandbox.
3292
3290
  */
3293
3291
  /**
3294
3292
  * @ignore
@@ -3308,8 +3306,8 @@ export declare const routeUtils: {
3308
3306
  *
3309
3307
  * Compact schema documentation for the `Route` properties shape, reused by
3310
3308
  * every tool whose LLM-authored code reads a Routes FeatureCollection
3311
- * (`analyseData`, `processData`) — injected per entry as `routesByEntry[id]`.
3312
- * Only the non-GeoJSON-standard bits are spelled out — `Route` is a LineString Feature.
3309
+ * (`analyseData`, `processData`), injected per entry as `routesByEntry[id]`.
3310
+ * Only the non-GeoJSON-standard bits are spelled out, since `Route` is a LineString Feature.
3313
3311
  */
3314
3312
  /** @ignore */
3315
3313
  export declare const ROUTES_SCHEMA_DOC: string;
@@ -3348,7 +3346,7 @@ export declare const showResultsOnMap: (state: ToolState, placesEntryIds: readon
3348
3346
  //#endregion
3349
3347
  //#region src/tools/shared/tool-state-where-context.d.ts
3350
3348
  /** Adapts the live `ToolState` to the narrow `WhereContext` the resolver depends on. Keeping this
3351
- * mapping in one place is what lets resolveAreas stay testable without a ToolState. */
3349
+ * mapping in one place lets resolveAreas stay testable without a ToolState. */
3352
3350
  export declare const toolStateToWhereContext: (state: ToolState, options?: ToolExecuteOptions) => WhereContext;
3353
3351
  //#endregion
3354
3352
  //#region src/tools/shared/viewport-bias.d.ts
@@ -3359,8 +3357,8 @@ export declare const toolStateToWhereContext: (state: ToolState, options?: ToolE
3359
3357
  */
3360
3358
  export declare const MIN_VIEWPORT_BIAS_ZOOM = 6;
3361
3359
  /**
3362
- * The map centre, to favour search results in view: pass it as `{ position }` to a service's `geoBias` or to
3363
- * {@link locatePlace}'s `bias`. Below `minZoom` the view spans too wide an area to say where the user means.
3360
+ * Returns the map centre, to favour search results in view. Pass it as `{ position }` to a service's `geoBias`
3361
+ * or to {@link locatePlace}'s `bias`. Below `minZoom`, the view is too wide to say where the user means.
3364
3362
  *
3365
3363
  * @param map - The agent's base-map slice, `state.baseMap` in a tool's `execute`.
3366
3364
  * @returns The centre as `[longitude, latitude]`, or `undefined` below `minZoom`.
@@ -3425,26 +3423,26 @@ type CustomGeometriesEntry = BaseEntry<PolygonFeature[]> & {
3425
3423
  */
3426
3424
  type CustomGeometriesStateEvents = {
3427
3425
  /**
3428
- * History changed — entry added or cleared via `reset()`. `entries` is the full snapshot after
3429
- * the change; `changedIds` lists the ids of the entries this specific change added, replaced in
3426
+ * An entry was added, or `reset()` cleared the history. `entries` is the full snapshot after
3427
+ * the change, and `changedIds` lists the ids of the entries this change added, replaced in
3430
3428
  * place, or removed.
3431
3429
  */
3432
3430
  'entries-change': {
3433
3431
  entries: readonly CustomGeometriesEntry[];
3434
3432
  changedIds: readonly string[];
3435
3433
  };
3436
- /** Set of entries currently rendered on the map changed. */
3434
+ /** The set of entries rendered on the map changed. */
3437
3435
  'shown-change': ReadonlySet<string>;
3438
- /** Display policy switched between `single` and `multiple`. */
3436
+ /** The display policy switched between `single` and `multiple`. */
3439
3437
  'mode-change': EntryMode;
3440
3438
  };
3441
3439
  /**
3442
- * State for derived / custom geometries — output of `processData` and any future
3440
+ * The state for derived or custom geometries, the output of `processData` and any future
3443
3441
  * polygon-producing tool whose result doesn't belong to a place or a reachable-range entry.
3444
3442
  *
3445
- * Each entry owns a dedicated GeometriesModule, lazy-initialised on first show, mirroring
3446
- * the per-entry display model used by {@link RangeState}. Provenance metadata captures the
3447
- * input sources (tagged ids) and the operation that produced the polygons.
3443
+ * As in {@link RangeState}, each entry owns a dedicated GeometriesModule, initialised lazily
3444
+ * on first show. Provenance metadata captures the input sources (tagged ids) and the
3445
+ * operation that produced the polygons.
3448
3446
  *
3449
3447
  * @group Agent Toolkit
3450
3448
  */
@@ -3452,7 +3450,7 @@ declare class CustomGeometriesState implements ShownEntriesSlice, StateSlice {
3452
3450
  private readonly _ttMap;
3453
3451
  private _entries;
3454
3452
  private _entryMode;
3455
- /** Subscribe to state changes — see {@link CustomGeometriesStateEvents}. */
3453
+ /** The state change events, listed in {@link CustomGeometriesStateEvents}. */
3456
3454
  readonly events: StateEvents<CustomGeometriesStateEvents>;
3457
3455
  constructor(_ttMap: TomTomMap);
3458
3456
  get entries(): readonly CustomGeometriesEntry[];
@@ -3460,40 +3458,40 @@ declare class CustomGeometriesState implements ShownEntriesSlice, StateSlice {
3460
3458
  /** Set of custom-geometries entry ids currently rendered on the map. */
3461
3459
  get shownEntryIds(): ReadonlySet<string>;
3462
3460
  /**
3463
- * Display policy: `multiple` (default) lets several derived-geometry entries render side
3464
- * by side; `single` enforces "at most one entry on the map" — switching to it auto-hides
3461
+ * The display policy. `multiple` (default) lets several derived-geometry entries render
3462
+ * side by side. `single` allows at most one entry on the map, and switching to it hides
3465
3463
  * older entries.
3466
3464
  */
3467
3465
  get entryMode(): EntryMode;
3468
3466
  setEntryMode(mode: EntryMode): Promise<void>;
3469
3467
  findById(entryId: string): CustomGeometriesEntry | undefined;
3470
3468
  /**
3471
- * Append a new entry. If `explicitId` collides, the slice auto-suffixes (`-2`, `-3`, ...).
3472
- * Returns the assigned id. Under `single` mode the new entry replaces every older one.
3469
+ * Appends a new entry and returns its assigned id. If `explicitId` collides, the slice adds a
3470
+ * suffix (`-2`, `-3`, ...). In `single` mode the new entry replaces every older one.
3473
3471
  */
3474
3472
  addEntry(features: PolygonFeature<CommonPlaceProps>[], provenance: CustomGeometriesEntry['provenance'], label: string, explicitId?: string): Promise<string>;
3475
- /** Lazy-init the entry's GeometriesModule, applying / re-applying the requested fill style. */
3473
+ /** Initialises the entry's GeometriesModule lazily and applies the requested fill style. */
3476
3474
  getEntryGeometriesModule(entryId: string, fillStyle?: GeometryFillStyle): Promise<GeometriesModule>;
3477
3475
  /**
3478
- * Render this entry's polygons. `mode` is scoped to this entry's own layer:
3479
- * - `'replace'` (default) — show exactly `entry.data`, clearing whatever the
3480
- * entry's module had rendered before.
3481
- * - `'add'` — merge `entry.data` with the polygons currently shown on this entry's
3482
- * layer (deduped by feature id). Mostly only meaningful when re-showing the same entry.
3476
+ * Renders the entry's polygons. `mode` applies to this entry's own layer only:
3477
+ * - `'replace'` (default) shows exactly `entry.data` and clears whatever the
3478
+ * entry's module rendered before.
3479
+ * - `'add'` merges `entry.data` with the polygons shown on this entry's layer,
3480
+ * deduped by feature id. It matters mostly when re-showing the same entry.
3483
3481
  *
3484
- * Cross-entry visibility is handled separately: under `entryMode === 'single'` other
3485
- * shown entries are hidden first; otherwise the caller uses `hideEntry` / the
3486
- * tools' `hidePreviousEntries` option.
3482
+ * Other entries are handled separately. With `entryMode === 'single'`, other shown
3483
+ * entries are hidden first. Otherwise the caller uses `hideEntry` or the tools'
3484
+ * `hidePreviousEntries` option.
3487
3485
  */
3488
3486
  showEntry(entryId: string, fillStyle?: GeometryFillStyle, mode?: 'add' | 'replace'): Promise<void>;
3489
3487
  private _hideOthersUnderSingleMode;
3490
3488
  hideEntry(entryId: string): Promise<void>;
3491
- /** Drop a single entry from history (clears its module first). No-op when unknown. */
3489
+ /** Clears an entry's module, then drops the entry from history. Does nothing for an unknown id. */
3492
3490
  removeEntry(entryId: string): Promise<void>;
3493
3491
  private _requireEntry;
3494
3492
  /**
3495
- * Hide every custom-geometries entry currently on the map. Map-only — history is kept.
3496
- * Implements {@link ClearableMapSlice}.
3493
+ * Hides every custom-geometries entry on the map but keeps the history. Implements
3494
+ * {@link ClearableMapSlice}.
3497
3495
  */
3498
3496
  clearShown(): Promise<void>;
3499
3497
  reset(): void;
@@ -3501,16 +3499,16 @@ declare class CustomGeometriesState implements ShownEntriesSlice, StateSlice {
3501
3499
  //#endregion
3502
3500
  //#region src/state/state.d.ts
3503
3501
  /**
3504
- * Per-slice display policy. With `multiple` (default) several history entries can be on the
3505
- * map at once; with `single` only the most recent one stays. Switching from `multiple` to
3506
- * `single` automatically drops every entry except the latest (and clears their modules) so
3502
+ * The per-slice display policy. With `multiple` (default), several history entries can be on the
3503
+ * map at once. With `single`, only the most recent one stays. Switching from `multiple` to
3504
+ * `single` automatically drops every entry except the latest and clears their modules, so
3507
3505
  * the map matches the new policy immediately.
3508
3506
  *
3509
3507
  * @group Agent Toolkit
3510
3508
  */
3511
3509
  type EntryMode = 'single' | 'multiple';
3512
3510
  /**
3513
- * State slice that owns a history of entries and can be driven into `single` or `multiple`
3511
+ * A state slice that owns a history of entries and can be set to `single` or `multiple`
3514
3512
  * mode. Every {@link ToolState} slice with `setEntryMode` implements this shape, which lets
3515
3513
  * callers (the `setEntryMode` tool, `createMapAgent`'s `dataEntries` option, …) handle the
3516
3514
  * whole family uniformly without listing slice names.
@@ -3525,12 +3523,12 @@ interface EntryModeSlice {
3525
3523
  setEntryMode(mode: EntryMode): Promise<void>;
3526
3524
  }
3527
3525
  /**
3528
- * Data-entry kind names — the vocabulary used by `dataEntries` on `createMapAgent`. Superset
3529
- * of the analyse/process input kinds (`EntryDataKind`) — adds `ranges`, which has its own
3526
+ * The data-entry kind names that `dataEntries` on `createMapAgent` uses. They extend the
3527
+ * analyse/process input kinds (`EntryDataKind`) with `ranges`, which has its own
3530
3528
  * entry-mode-supporting slice but is not a top-level input kind for those tools.
3531
3529
  *
3532
- * The kind names are LLM-facing (`routes`, `incidents`) rather than slice names (`routing`,
3533
- * `trafficIncidents`); the slice mapping is internal — see {@link DATA_ENTRY_KIND_TO_SLICE}.
3530
+ * The kind names are LLM-facing (`routes`, `incidents`) instead of slice names (`routing`,
3531
+ * `trafficIncidents`). The slice mapping is internal (see {@link DATA_ENTRY_KIND_TO_SLICE}).
3534
3532
  *
3535
3533
  * @group Agent Toolkit
3536
3534
  */
@@ -3543,22 +3541,22 @@ type DataEntryKind = 'places' | 'routes' | 'incidents' | 'customGeometries' | 't
3543
3541
  type DataEntryConfig = {
3544
3542
  /**
3545
3543
  * When `false`, the kind is removed from the agent's tool surface entirely:
3546
- * - the kind disappears from `analyseData` / `processData` scope and input fields;
3547
- * - related recall / display / fetch tools are dropped from the registry
3544
+ * - The kind disappears from the `analyseData` and `processData` scope and input fields.
3545
+ * - Related recall, display and fetch tools are dropped from the registry
3548
3546
  * (see {@link TOOLS_BY_DATA_ENTRY_KIND}).
3549
3547
  *
3550
- * Default: `true`.
3548
+ * Defaults to `true`.
3551
3549
  */
3552
3550
  enabled?: boolean;
3553
3551
  /**
3554
- * Initial entry-display policy for the underlying slice. `single` keeps only the latest
3555
- * entry on the map (others auto-hide); `multiple` (default) lets several coexist.
3552
+ * The initial entry-display policy for the underlying slice. `single` keeps only the latest
3553
+ * entry on the map and hides the others. `multiple` (default) lets several coexist.
3556
3554
  */
3557
3555
  entryMode?: EntryMode;
3558
3556
  };
3559
3557
  /**
3560
- * Mapping from {@link DataEntryKind} (LLM-facing name) to the {@link ToolState} slice key
3561
- * that owns the entries for that kind. Used by `createMapAgent` to apply `entryMode` from
3558
+ * Maps each {@link DataEntryKind} (LLM-facing name) to the {@link ToolState} slice key that
3559
+ * owns its entries. `createMapAgent` uses it to apply `entryMode` from
3562
3560
  * `dataEntries[kind].entryMode` to the right slice.
3563
3561
  *
3564
3562
  * @group Agent Toolkit
@@ -3573,34 +3571,33 @@ export declare const DATA_ENTRY_KIND_TO_SLICE: {
3573
3571
  readonly ranges: "ranges";
3574
3572
  };
3575
3573
  /**
3576
- * Compile-time union of {@link ToolState} keys whose slice supports {@link EntryMode}.
3577
- * Names match the {@link ToolState} keys exactly — `routing` (not `routes`),
3578
- * `customGeometries` (not `geometries`) — so the slice name in the tool API never drifts
3574
+ * The compile-time union of {@link ToolState} keys whose slice supports {@link EntryMode}.
3575
+ * Names match the {@link ToolState} keys exactly, such as `routing` (not `routes`) and
3576
+ * `customGeometries` (not `geometries`), so the slice name in the tool API never drifts
3579
3577
  * from the property on `state`.
3580
3578
  *
3581
- * Auto-grows when a new slice implements `setEntryMode`: the union picks up the new key,
3582
- * and the runtime list {@link ENTRY_MODE_SLICE_NAMES} fails to type-check until the key
3583
- * is added there too.
3579
+ * When a new slice implements `setEntryMode`, the union picks up its key, and the runtime
3580
+ * list {@link ENTRY_MODE_SLICE_NAMES} fails to type-check until the key is added there too.
3584
3581
  *
3585
3582
  * @group Agent Toolkit
3586
3583
  */
3587
3584
  type EntryModeSliceName = { [K in keyof ToolState]: ToolState[K] extends EntryModeSlice ? K : never; }[keyof ToolState];
3588
3585
  /**
3589
- * Runtime enumeration of slice names that support entry mode. The `satisfies` clause
3590
- * makes drift a compile error: when a new {@link ToolState} slice gains `setEntryMode`,
3591
- * this constant has to be updated before the package will build.
3586
+ * The runtime list of slice names that support entry mode. Its `satisfies` clause makes
3587
+ * drift a compile error. When a new {@link ToolState} slice gains `setEntryMode`, the
3588
+ * package won't build until this constant is updated.
3592
3589
  *
3593
3590
  * @group Agent Toolkit
3594
3591
  */
3595
3592
  export declare const ENTRY_MODE_SLICE_NAMES: readonly EntryModeSliceName[];
3596
3593
  /**
3597
- * State slice that owns a set of "entries" (routes, ranges) where each entry can be hidden
3598
- * individually by id and the slice exposes the currently-shown set. Implemented by
3599
- * {@link RoutingState} and {@link RangeState}; consumed by helpers that need to hide
3600
- * previously-shown entries before rendering a new one (see `hidePreviousShownEntries`).
3594
+ * A state slice that owns a set of "entries" (routes, ranges), each of which can be hidden
3595
+ * individually by id, and exposes the shown set. {@link RoutingState} and {@link RangeState}
3596
+ * implement it. Helpers that hide previously-shown entries before rendering a new one
3597
+ * consume it (see `hidePreviousShownEntries`).
3601
3598
  *
3602
- * Not implemented by {@link PlacesState}, which uses a wider per-entry marker-type model
3603
- * (`removeShownEntries(ids)` rather than `hideEntry(id)`).
3599
+ * {@link PlacesState} doesn't implement it, because it uses a wider per-entry marker-type
3600
+ * model (`removeShownEntries(ids)` instead of `hideEntry(id)`).
3604
3601
  *
3605
3602
  * @group Agent Toolkit
3606
3603
  */
@@ -3618,17 +3615,17 @@ interface ShownEntriesSlice extends StateSlice {
3618
3615
  */
3619
3616
  type BYODStateEvents = {
3620
3617
  /**
3621
- * History changed — entry added, removed, or cleared via `reset()`. `entries` is the full
3622
- * snapshot after the change; `changedIds` lists the ids of the entries this specific change
3623
- * added, replaced in place, or removed.
3618
+ * An entry was added or removed, or `reset()` cleared the history. `entries` is the full
3619
+ * snapshot after the change, and `changedIds` lists the ids of the entries this change added,
3620
+ * replaced in place, or removed.
3624
3621
  */
3625
3622
  'entries-change': {
3626
3623
  entries: readonly BYODEntry[];
3627
3624
  changedIds: readonly string[];
3628
3625
  };
3629
- /** Set of entries currently rendered on the map changed. */
3626
+ /** The set of entries rendered on the map changed. */
3630
3627
  'shown-change': ReadonlySet<string>;
3631
- /** Display policy switched between `single` and `multiple`. */
3628
+ /** The display policy switched between `single` and `multiple`. */
3632
3629
  'mode-change': EntryMode;
3633
3630
  };
3634
3631
  /**
@@ -3638,9 +3635,9 @@ type BYODStateEvents = {
3638
3635
  */
3639
3636
  type AddBYODEntryOptions = {
3640
3637
  /**
3641
- * Explicit MapLibre layer specs. Layers are never derived automatically:
3642
- * when omitted the entry is created with no layers and renders nothing until
3643
- * they are set — by the agent via `setByodLayers`, or by passing them here.
3638
+ * Explicit MapLibre layer specs, never derived automatically. You pass them here,
3639
+ * or the agent sets them via `setByodLayers`. Until then the entry renders nothing.
3640
+ * Either way they are only stored, and {@link BYODState.showEntry} renders them.
3644
3641
  */
3645
3642
  layers?: CustomGeoJSONLayerSpec[];
3646
3643
  /** Provenance for the data. Defaults to `{ kind: 'integrator' }`. */
@@ -3652,9 +3649,9 @@ type AddBYODEntryOptions = {
3652
3649
  explicitId?: string;
3653
3650
  };
3654
3651
  /**
3655
- * Verdict returned by a {@link ByodSourceUrlValidator}: explicitly allow the fetch with
3656
- * `{ valid: true }`, or block it with `{ valid: false, reason }` — the `reason` is surfaced
3657
- * to the model as the tool error.
3652
+ * The verdict a {@link ByodSourceUrlValidator} returns. `{ valid: true }` explicitly allows
3653
+ * the fetch, and `{ valid: false, reason }` blocks it and surfaces the `reason` to the model
3654
+ * as the tool error.
3658
3655
  *
3659
3656
  * @group Agent Toolkit
3660
3657
  */
@@ -3665,30 +3662,30 @@ type ByodSourceUrlValidation = {
3665
3662
  reason: string;
3666
3663
  };
3667
3664
  /**
3668
- * App-supplied authorization hook for BYOD source URLs. Runs inside
3669
- * `addByodSource` AFTER the built-in scheme / size / timeout policy and BEFORE
3670
- * the network fetch. Return `{ valid: true }` to allow the fetch or
3671
- * `{ valid: false, reason }` to block it (see {@link ByodSourceUrlValidation}).
3672
- * May be sync or async — e.g. an allowlist lookup.
3673
- *
3674
- * The toolkit can't enforce SSRF guarantees the host itself can't, so it leaves
3675
- * the URL surface open by default; this hook lets a deployment add its own
3676
- * policy — refuse cloud-metadata endpoints (`169.254.169.254`), restrict to
3677
- * known hosts, etc. — without the SDK prescribing one for everyone. Configure
3678
- * via the `byod.validateSourceUrl` option on `createMapAgent`, or assign
3665
+ * An app-supplied authorization hook for BYOD source URLs. `addByodSource` runs it
3666
+ * after the built-in scheme, size and timeout policy and before the network fetch.
3667
+ * Return `{ valid: true }` to allow the fetch or `{ valid: false, reason }` to
3668
+ * block it (see {@link ByodSourceUrlValidation}). It may be sync or async, such as
3669
+ * an allowlist lookup.
3670
+ *
3671
+ * The toolkit can't enforce SSRF guarantees the host itself can't, so by default it
3672
+ * leaves the URL surface open. This hook lets a deployment add its own policy, such
3673
+ * as refusing cloud-metadata endpoints (`169.254.169.254`) or allowing only known
3674
+ * hosts, without the SDK prescribing one for everyone. Set it via the
3675
+ * `byod.validateSourceUrl` option on `createMapAgent`, or assign
3679
3676
  * `state.byod.sourceUrlValidator` directly.
3680
3677
  *
3681
3678
  * @group Agent Toolkit
3682
3679
  */
3683
3680
  type ByodSourceUrlValidator = (url: URL) => ByodSourceUrlValidation | Promise<ByodSourceUrlValidation>;
3684
3681
  /**
3685
- * State slice for BYOD (bring-your-own-data) GeoJSON layers — customer-owned
3686
- * data that doesn't fit places / routes / ranges / custom-geometries. Each
3687
- * entry wraps a {@link CustomGeoJSONModule} so the agent can render, query,
3688
- * and pipe it through analyseData / processData.
3682
+ * The state slice for BYOD (bring-your-own-data) GeoJSON layers, the customer-owned
3683
+ * data that doesn't fit places, routes, ranges or custom geometries. Each entry
3684
+ * wraps a {@link CustomGeoJSONModule} so the agent can render, query, and pipe it
3685
+ * through analyseData or processData.
3689
3686
  *
3690
- * Per-entry display model mirrors {@link CustomGeometriesState}: every entry
3691
- * owns its own module, lazy-initialised on first show.
3687
+ * As in {@link CustomGeometriesState}, every entry owns its own module, initialised
3688
+ * lazily on first show.
3692
3689
  *
3693
3690
  * @group Agent Toolkit
3694
3691
  */
@@ -3696,12 +3693,12 @@ declare class BYODState implements ShownEntriesSlice, StateSlice {
3696
3693
  private readonly _ttMap;
3697
3694
  private _entries;
3698
3695
  private _entryMode;
3699
- /** Subscribe to state changes — see {@link BYODStateEvents}. */
3696
+ /** The state change events, listed in {@link BYODStateEvents}. */
3700
3697
  readonly events: StateEvents<BYODStateEvents>;
3701
3698
  /**
3702
- * Optional authorization hook for `addByodSource` URL fetches — see
3703
- * {@link ByodSourceUrlValidator}. Unset = no restriction beyond the built-in
3704
- * scheme / size / timeout policy.
3699
+ * The optional authorization hook for `addByodSource` URL fetches (see
3700
+ * {@link ByodSourceUrlValidator}). If unset, only the built-in scheme, size
3701
+ * and timeout policy applies.
3705
3702
  */
3706
3703
  sourceUrlValidator?: ByodSourceUrlValidator;
3707
3704
  constructor(_ttMap: TomTomMap);
@@ -3713,35 +3710,35 @@ declare class BYODState implements ShownEntriesSlice, StateSlice {
3713
3710
  setEntryMode(mode: EntryMode): Promise<void>;
3714
3711
  findById(entryId: string): BYODEntry | undefined;
3715
3712
  /**
3716
- * Append a new BYOD entry. Under `single` mode the new entry replaces every older one (hides
3717
- * + drops them before the new entry is pushed, so the caller never sees the new entry
3718
- * rendered on top of a still-visible old one). Returns the assigned id.
3713
+ * Appends a new BYOD entry and returns its assigned id. In `single` mode the new entry
3714
+ * replaces every older one. It hides and drops them before pushing the new entry, so the
3715
+ * caller never sees it rendered on top of a still-visible old one.
3719
3716
  */
3720
3717
  addEntry(data: FeatureCollection$1, label: string, options?: AddBYODEntryOptions): Promise<string>;
3721
3718
  /**
3722
- * Replace the MapLibre layer specs an entry renders under. When the entry already owns a
3723
- * module (it has been shown at least once) the new specs are pushed live via the module's
3724
- * `applyConfig` runtime layer diff — no tear-down, no flicker. When no module exists yet the
3725
- * specs are stored and the next {@link showEntry} picks them up. Throws on an unknown id.
3719
+ * Replaces the MapLibre layer specs an entry renders under. If the entry already owns a
3720
+ * module because it was shown at least once, the module's `applyConfig` runtime layer diff
3721
+ * pushes the new specs live, without tear-down or flicker. Otherwise the specs are stored
3722
+ * and the next {@link showEntry} picks them up. Throws on an unknown id.
3726
3723
  */
3727
3724
  setEntryLayers(entryId: string, layers: CustomGeoJSONLayerSpec[]): void;
3728
3725
  /**
3729
- * Lazy-init the entry's CustomGeoJSONModule. The module is created with a
3730
- * single source named `data`, configured with this entry's `layers`. To swap
3731
- * layers after creation, call {@link setEntryLayers} — it pushes the new specs
3732
- * into this module via `applyConfig` rather than recreating it.
3726
+ * Initialises the entry's CustomGeoJSONModule lazily. The module has a single
3727
+ * source named `data`, configured with this entry's `layers`. To swap layers
3728
+ * afterwards, call {@link setEntryLayers}, which pushes the new specs into this
3729
+ * module via `applyConfig` instead of recreating it.
3733
3730
  */
3734
3731
  getEntryModule(entryId: string): Promise<CustomGeoJSONModule>;
3735
- /** Render this entry on the map. */
3732
+ /** Renders the entry on the map. */
3736
3733
  showEntry(entryId: string): Promise<void>;
3737
3734
  private _hideOthersUnderSingleMode;
3738
3735
  hideEntry(entryId: string): Promise<void>;
3739
- /** Drop a single entry from history (clears its module first). No-op when unknown. */
3736
+ /** Clears an entry's module, then drops the entry from history. Does nothing for an unknown id. */
3740
3737
  removeEntry(entryId: string): Promise<void>;
3741
3738
  private _requireEntry;
3742
3739
  /**
3743
- * Hide every BYOD layer currently on the map. Map-only — history is kept.
3744
- * Implements {@link ClearableMapSlice}.
3740
+ * Hides every BYOD layer on the map but keeps the history. Implements
3741
+ * {@link ClearableMapSlice}.
3745
3742
  */
3746
3743
  clearShown(): Promise<void>;
3747
3744
  reset(): void;
@@ -3751,15 +3748,15 @@ declare class BYODState implements ShownEntriesSlice, StateSlice {
3751
3748
  /**
3752
3749
  * @module agent-toolkit-system-prompt
3753
3750
  *
3754
- * Behavioral contract: persona, tone, dual-response, cadence — lives here.
3751
+ * The behavioural contract (persona, tone, dual-response, cadence) lives here.
3755
3752
  *
3756
- * Tool mechanics: call shape, return shape, error handling, when-to-use vs.
3757
- * which-tool-next — lives in the relevant tool's description string and Zod
3758
- * schema. Each tool re-explains its own role; the LLM sees those alongside
3759
- * this prompt. The intent classifier (see `utils/intent-classifier.ts`) also
3760
- * scopes tools per step, so a tool's description is only in context when that
3761
- * tool is active — keep cross-cutting safety rules here (always present), and
3762
- * leave per-tool mechanics to the tool itself.
3753
+ * Tool mechanics (call shape, return shape, error handling, when-to-use vs.
3754
+ * which-tool-next) live in each tool's description string and Zod schema. Each
3755
+ * tool re-explains its own role, and the LLM sees those alongside this prompt.
3756
+ * The intent classifier (see `utils/intent-classifier.ts`) also scopes tools per
3757
+ * step, so a tool's description is only in context while that tool is active.
3758
+ * Keep cross-cutting safety rules here, where they are always present, and leave
3759
+ * per-tool mechanics to the tool.
3763
3760
  *
3764
3761
  * If you find yourself adding lines here to fix an LLM mistake, ask first
3765
3762
  * whether the fix belongs in a tool description or a tool error message.
@@ -3775,14 +3772,14 @@ declare class BYODState implements ShownEntriesSlice, StateSlice {
3775
3772
  */
3776
3773
  type SystemPromptSection = 'identity' | 'capabilities' | 'rejectionRules' | 'responseFormatting' | 'dataConfidence' | 'toolExecution' | 'sessionState';
3777
3774
  /**
3778
- * Per-section body overrides. Each key replaces that section's body; omitted
3779
- * sections fall back to {@link SYSTEM_PROMPT_SECTIONS}. Accepted by
3780
- * {@link composeSystemPrompt} and `MapAgentOptions.systemPrompt`.
3775
+ * Per-section body overrides. Each key replaces that section's body, and omitted
3776
+ * sections fall back to {@link SYSTEM_PROMPT_SECTIONS}. {@link composeSystemPrompt}
3777
+ * and `MapAgentOptions.systemPrompt` accept them.
3781
3778
  *
3782
3779
  * @remarks
3783
3780
  * To *extend* rather than replace a section, read its current default from the
3784
- * exported {@link SYSTEM_PROMPT_SECTIONS} map and override with a derived string
3785
- * — e.g. append a rule, prepend a note, or hand the default to a coding agent to
3781
+ * exported {@link SYSTEM_PROMPT_SECTIONS} map and override with a derived string,
3782
+ * e.g. append a rule, prepend a note, or hand the default to a coding agent to
3786
3783
  * rewrite under some criteria:
3787
3784
  *
3788
3785
  * ```typescript
@@ -3796,35 +3793,35 @@ type SystemPromptSection = 'identity' | 'capabilities' | 'rejectionRules' | 'res
3796
3793
  */
3797
3794
  type SystemPromptSectionOverrides = Partial<Record<SystemPromptSection, string>>;
3798
3795
  /**
3799
- * The default body text for each base-prompt section — heading excluded.
3796
+ * The default body text for each base-prompt section, without its heading.
3800
3797
  *
3801
3798
  * @remarks
3802
- * Each value is the section's content only; the structural heading (e.g.
3803
- * `RESPONSE FORMATTING:`) is added by {@link composeSystemPrompt}. So an override
3804
- * passes just the body — `composeSystemPrompt({ responseFormatting: 'Reply in Spanish.' })`
3799
+ * Each value holds only the section's content. {@link composeSystemPrompt} adds the
3800
+ * structural heading (e.g. `RESPONSE FORMATTING:`), so an override passes just the
3801
+ * body. For example, `composeSystemPrompt({ responseFormatting: 'Reply in Spanish.' })`
3805
3802
  * still renders under the `RESPONSE FORMATTING:` heading.
3806
3803
  *
3807
- * The behavioral prose is split so each concern is overridable on its own:
3808
- * - `identity` — who the assistant is and its tone of voice; the natural hook to
3804
+ * The behavioural prose is split so each concern is overridable on its own:
3805
+ * - `identity` — who the assistant is and its tone of voice, the natural hook to
3809
3806
  * rebrand or set a persona.
3810
3807
  * - `capabilities` — the map environment plus a compact summary of what the
3811
- * toolkit can do. Kept at the group level (not per-tool) so it does not drift
3812
- * as tools change; the exact mechanics live in each tool's description and the
3813
- * classifier prompt. It also gives `rejectionRules` something concrete to steer
3814
- * the user back toward.
3808
+ * toolkit can do. It stays at the group level (not per-tool) so it does not
3809
+ * drift as tools change. The exact mechanics live in each tool's description and
3810
+ * the classifier prompt. It also gives `rejectionRules` something concrete to
3811
+ * steer the user back toward.
3815
3812
  * - `rejectionRules` — how to handle in-scope / mixed / out-of-scope / illegal
3816
3813
  * requests, and the requirement to always explain a rejection.
3817
3814
  * - `dataConfidence` — how to surface incomplete, partial, stale, or conflicting
3818
3815
  * data instead of presenting it as complete.
3819
3816
  *
3820
3817
  * Location-reference routing ("near me" → getCurrentLocation, "here" →
3821
- * getViewport) is intentionally NOT a section: it is a tool-selection rule
3818
+ * getViewport) is intentionally **not** a section. It is a tool-selection rule
3822
3819
  * already owned by the classifier prompt and the two tools' cross-referencing
3823
3820
  * descriptions.
3824
3821
  *
3825
- * This map is the canonical source of the default body text, exported so a
3826
- * consumer can read a default and override with a derived value (extend, prefix,
3827
- * or rewrite it) — see {@link SystemPromptSectionOverrides}.
3822
+ * This map is the exported, canonical source of the default body text. A consumer
3823
+ * can read a default and override it with a derived value (extend, prefix, or
3824
+ * rewrite it). See {@link SystemPromptSectionOverrides}.
3828
3825
  *
3829
3826
  * @group Agent Toolkit
3830
3827
  */
@@ -3833,8 +3830,8 @@ export declare const SYSTEM_PROMPT_SECTIONS: Record<SystemPromptSection, string>
3833
3830
  * Composes the base system prompt from {@link SYSTEM_PROMPT_SECTIONS}, applying
3834
3831
  * any per-section overrides.
3835
3832
  *
3836
- * @param overrides - Replacement **body** text keyed by section; omitted
3837
- * sections fall back to the default. The section heading is added automatically,
3833
+ * @param overrides - Replacement **body** text keyed by section. Omitted
3834
+ * sections fall back to the default. It adds the section heading itself,
3838
3835
  * so an override does not repeat it. Pass the result to
3839
3836
  * `MapAgentOptions.systemPrompt`.
3840
3837
  * @returns The composed system prompt string.
@@ -3859,9 +3856,9 @@ export declare const composeSystemPrompt: (overrides?: SystemPromptSectionOverri
3859
3856
  * The base system prompt that teaches the LLM how to use the agent toolkit tools.
3860
3857
  *
3861
3858
  * @remarks
3862
- * Equivalent to `composeSystemPrompt()` with no overrides. Export this constant
3863
- * so consumers can reference or extend it when providing a custom system prompt
3864
- * via `MapAgentOptions.systemPrompt`. To replace just one section, prefer
3859
+ * Equivalent to `composeSystemPrompt()` with no overrides. It is exported so you
3860
+ * can reference or extend it when you provide a custom system prompt via
3861
+ * `MapAgentOptions.systemPrompt`. To replace just one section, use
3865
3862
  * {@link composeSystemPrompt} instead of rebuilding the whole string.
3866
3863
  *
3867
3864
  * @example
@@ -3915,12 +3912,12 @@ export declare const buildSystemPrompt: ({ customPrompt, prefix, suffix }?: Buil
3915
3912
  //#endregion
3916
3913
  //#region src/tools/tool-registry.d.ts
3917
3914
  /**
3918
- * Default tool set for the agent toolkit. Each entry is a {@link ToolDefinition}
3919
- * — either a static `ToolEntry` or a `ToolEntryBuilder` that tailors the tool to
3915
+ * Default tool set for the agent toolkit. Each entry is a {@link ToolDefinition},
3916
+ * either a static `ToolEntry` or a `ToolEntryBuilder` that tailors the tool to
3920
3917
  * {@link ToolBuildOptions} (e.g. feature flags) at agent-creation time.
3921
3918
  *
3922
- * Included automatically by createMapAgent unless includeDefaultTools is false.
3923
- * Use resolveTools() for manual composition outside createMapAgent.
3919
+ * createMapAgent includes it automatically unless includeDefaultTools is false.
3920
+ * For manual composition outside createMapAgent, use resolveTools().
3924
3921
  *
3925
3922
  * @group Agent Toolkit
3926
3923
  */
@@ -3961,11 +3958,8 @@ export declare const DEFAULT_TOOLS: {
3961
3958
  getStandardMapStyles: ToolDefinition;
3962
3959
  setMapStandardStyle: ToolDefinition;
3963
3960
  setLanguage: ToolDefinition;
3964
- toggleTilesPOIs: ToolDefinition;
3965
- toggleTilesBaseMapLayerGroups: ToolDefinition;
3961
+ setGeopoliticalView: ToolDefinition;
3966
3962
  setMapStyling: ToolDefinition;
3967
- toggleTilesTrafficFlow: ToolDefinition;
3968
- toggleTilesTrafficIncidents: ToolDefinition;
3969
3963
  getMapStyleLayers: ToolDefinition;
3970
3964
  setLayoutProperties: ToolDefinition;
3971
3965
  setPaintProperties: ToolDefinition;
@@ -3995,12 +3989,12 @@ type ToolName = keyof typeof DEFAULT_TOOLS;
3995
3989
  export declare const TOOL_NAMES: ToolName[];
3996
3990
  /**
3997
3991
  * Default tool names that should be dropped from the registry when a {@link DataEntryKind}
3998
- * is disabled. Only default-tool names are listed here — user-supplied custom tools are
3999
- * never filtered automatically; integrators that want to gate their own tools on enabled
4000
- * kinds can read `dataEntries` themselves.
3992
+ * is disabled. Only default-tool names are listed here. User-supplied custom tools are
3993
+ * never filtered automatically. To gate your own tools on enabled kinds, read
3994
+ * `dataEntries` yourself.
4001
3995
  *
4002
3996
  * Tools that span multiple kinds (`clearMap`, `recallState`, `setEntryMode`, …) are
4003
- * intentionally absent — they keep working regardless of which kinds are disabled.
3997
+ * intentionally absent, since they keep working regardless of which kinds are disabled.
4004
3998
  *
4005
3999
  * @group Agent Toolkit
4006
4000
  */
@@ -4011,7 +4005,7 @@ export declare const TOOLS_BY_DATA_ENTRY_KIND: Record<DataEntryKind, readonly To
4011
4005
  * tool's default (full-surface) shape. Tools without prompts map to `[]`.
4012
4006
  *
4013
4007
  * Surface these in chat UIs to keep starter suggestions in sync with what the
4014
- * tools can actually do — the registry stays the single source of truth.
4008
+ * tools can actually do. The registry stays the single source of truth.
4015
4009
  *
4016
4010
  * @group Agent Toolkit
4017
4011
  */
@@ -4027,16 +4021,19 @@ type ClassificationResult = {
4027
4021
  /** Tool names selected by the classifier. */
4028
4022
  activeToolNames: string[];
4029
4023
  /**
4030
- * Optional per-tool scope. Keyed by tool name, value is the raw classifier
4031
- * output for that tool — validated against the tool's `scopeSchema` in
4032
- * `prepareStep` before any narrowing is applied. Tools without
4033
- * `scopeSchema`, or for which the classifier omitted a scope, retain
4034
- * their full description and inputSchema for the turn.
4024
+ * The optional per-tool scope, keyed by tool name. Each value is the raw
4025
+ * classifier output for that tool, which `prepareStep` validates against
4026
+ * the tool's `scopeSchema` before applying any narrowing. Tools without
4027
+ * `scopeSchema`, or with no scope from the classifier, keep their full
4028
+ * description and inputSchema for the turn.
4035
4029
  */
4036
4030
  toolScopes?: Record<string, unknown>;
4037
- /** Wall-clock time in ms for the classification step only (not the agent response). */
4031
+ /** The wall-clock time in ms of the classification step, excluding the agent response. */
4038
4032
  timeMs: number;
4039
- /** Token usage for the classification LLM call. */
4033
+ /**
4034
+ * Token usage of the classification, summed over its one LLM call, or two when the first
4035
+ * answer fails validation.
4036
+ */
4040
4037
  usage: {
4041
4038
  inputTokens: number;
4042
4039
  outputTokens: number;
@@ -4050,8 +4047,8 @@ type ClassificationResult = {
4050
4047
  */
4051
4048
  type ClassifierOptions = {
4052
4049
  /**
4053
- * Language model to use for structured generation.
4054
- * Ideally should be a fast, low-cost model (e.g. gpt-4o-mini).
4050
+ * The language model for structured generation, ideally a fast, low-cost
4051
+ * one such as gpt-4o-mini.
4055
4052
  */
4056
4053
  chatModel: LanguageModel;
4057
4054
  /** Per-tool metadata used to build the classifier prompt. */
@@ -4069,10 +4066,10 @@ type ConversationMessage = {
4069
4066
  content: string;
4070
4067
  };
4071
4068
  /**
4072
- * Classify a user conversation to determine which tools to activate.
4069
+ * Classifies a user conversation to pick the tools to activate.
4073
4070
  *
4074
4071
  * The `conversation` should contain the last user message plus a compaction
4075
- * of the previous chat history (each truncated to save tokens).
4072
+ * of the earlier chat history, each message truncated to save tokens.
4076
4073
  *
4077
4074
  * @example
4078
4075
  * ```typescript
@@ -4088,14 +4085,14 @@ type ConversationMessage = {
4088
4085
  export declare const classifyUserIntent: (conversation: ConversationMessage[], options: ClassifierOptions) => Promise<ClassificationResult>;
4089
4086
  /**
4090
4087
  * Extracts the text content of the last user message in a message array.
4091
- * Returns null if no user message is found or if content has no text.
4088
+ * Returns `null` if there is no user message or its content has no text.
4092
4089
  *
4093
4090
  * @group Agent Toolkit
4094
4091
  */
4095
4092
  export declare const extractLastUserText: (messages: ReadonlyArray<ModelMessage>) => string | null;
4096
4093
  /**
4097
- * Creates the default LLM-based classifier. Uses structured generation to select
4098
- * the minimal tool set for each user message.
4094
+ * Creates the default LLM-based classifier, which selects the minimal tool set for each user
4095
+ * message with structured generation.
4099
4096
  *
4100
4097
  * @param options.model - Language model for classification (ideally fast/cheap like gpt-4o-mini)
4101
4098
  * @param options.maxHistoryMessages - Max prior turns for context. Default: 8
@@ -4122,14 +4119,14 @@ type ProviderOptions = Record<string, Record<string, JSONValue | undefined>>;
4122
4119
  */
4123
4120
  export type ToolNameHint = ToolName | (string & {});
4124
4121
  /**
4125
- * Tool-facing union of state slices that own analysable entries — the
4122
+ * Tool-facing union of state slices that own analysable entries, the
4126
4123
  * vocabulary used by tools that read from multiple slices (`analyseData`,
4127
4124
  * `processData`) and by the classifier when proposing per-call scope.
4128
4125
  *
4129
4126
  * Distinct from {@link EntryModeSliceName}, which uses the literal state-slice
4130
4127
  * keys (`routing`, `trafficIncidents`, …) for state-level operations.
4131
4128
  *
4132
- * `ranges` is intentionally excluded: it feeds the analysis/processing tools
4129
+ * `ranges` is intentionally excluded. It feeds the analysis/processing tools
4133
4130
  * only via `geometriesEntryIDs` (its isochrone polygons), not as a direct
4134
4131
  * top-level input.
4135
4132
  *
@@ -4137,8 +4134,8 @@ export type ToolNameHint = ToolName | (string & {});
4137
4134
  */
4138
4135
  export type EntryDataKind = 'places' | 'routes' | 'incidents' | 'customGeometries' | 'trafficAreaAnalytics' | 'byod';
4139
4136
  /**
4140
- * State passed to tool factory functions. Organized by feature area,
4141
- * each sub-state mixes lazy module access with the current service data
4137
+ * State passed to tool factory functions, organised by feature area.
4138
+ * Each sub-state mixes lazy module access with the current service data
4142
4139
  * produced during the session.
4143
4140
  *
4144
4141
  * @group Agent Toolkit
@@ -4157,68 +4154,69 @@ export type EntryDataKind = 'places' | 'routes' | 'incidents' | 'customGeometrie
4157
4154
  * ```
4158
4155
  */
4159
4156
  export type ToolState = {
4160
- /** Places layer: PlacesModule plus an append-only search history. */
4157
+ /** The places layer's PlacesModule and append-only search history. */
4161
4158
  places: PlacesState;
4162
- /** Map POI layer: visibility, filtering, and category management. */
4159
+ /** Map POI layer visibility, filtering and category management. */
4163
4160
  mapPOIs: MapPOIsState;
4164
4161
  /** Route calculation, waypoint management, and planning parameter state. */
4165
4162
  routing: RoutingState;
4166
- /** Base map display: style, language, viewport and layers. */
4163
+ /** The displayed base map's style, language, viewport and layers. */
4167
4164
  baseMap: BaseMapState;
4168
- /** Traffic tile overlays: flow tiles + incident overlay tiles. */
4165
+ /** Traffic flow tiles and incident overlay tiles. */
4169
4166
  trafficTiles: TrafficTilesState;
4170
- /** Traffic area analytics: aggregation module + last result + viz config. */
4167
+ /** Traffic area analytics aggregation module, last result and viz config. */
4171
4168
  trafficAreaAnalytics: TrafficAreaAnalyticsState;
4172
- /** Traffic incidents: fetched entry history and per-entry rendering. */
4169
+ /** Fetched traffic incident entry history and per-entry rendering. */
4173
4170
  trafficIncidents: TrafficIncidentsState;
4174
- /** Reachable range results: origin, budgets, and bbox summaries. */
4171
+ /** Reachable range results, with origin, budgets and bbox summaries. */
4175
4172
  ranges: RangeState;
4176
- /** Derived/custom polygon entries — output of `processData`. */
4173
+ /** Derived/custom polygon entries that `processData` outputs. */
4177
4174
  customGeometries: CustomGeometriesState;
4178
- /** Bring-your-own-data GeoJSON layers — customer-authored data the agent can read and render. */
4175
+ /** Bring-your-own-data GeoJSON layers, customer-authored data the agent can read and render. */
4179
4176
  byod: BYODState;
4180
4177
  /**
4181
- * Strategy used to run code-generation tools (`analyseData` / `processData`).
4182
- * Initialised to the main-thread executor by `createToolState`, and overridden
4183
- * by `createMapAgent` from {@link MapAgentOptions.codeExecution}. Tools read this
4178
+ * Strategy used to run code-generation tools (`analyseData`, `processData`, `createTracker`,
4179
+ * `clusterIncidents`). `createToolState` initialises it to the env-resolved executor, and
4180
+ * `createMapAgent` re-resolves it with {@link MapAgentOptions.codeExecution}. Tools read this
4184
4181
  * to select where sandbox code runs.
4185
4182
  */
4186
4183
  codeExecution: SandboxExecutor;
4187
4184
  /**
4188
4185
  * The single recurrence engine. Owners (`analyses`, `trackers`) register entry-anchored jobs and keep
4189
- * the returned handles; the engine re-runs each active job when its source entries change. Generic —
4190
- * it never interprets a job's recipe (the tools layer builds the run closure). See {@link JobEngine}.
4186
+ * the returned handles. The engine re-runs each active job when its source entries change. It is generic
4187
+ * and never interprets a job's recipe (the tools layer builds the run closure). See {@link JobEngine}.
4191
4188
  */
4192
4189
  engine: JobEngine;
4193
4190
  /**
4194
4191
  * Single session-level registry of every analysis (one-shot + recurring) across all entry kinds.
4195
4192
  * Results live here, and per-entry views read them on demand via {@link Analyses.getAnalysesForEntry}.
4196
- * `analyseData` registers a record + a job on {@link JobEngine}; `monitorAnalysis` toggles the job's
4193
+ * `analyseData` registers a record and a job on {@link JobEngine}. `monitorAnalysis` toggles the job's
4197
4194
  * active flag.
4198
4195
  */
4199
4196
  analyses: Analyses;
4200
4197
  /**
4201
- * Generic trackers — rising-edge reducers fed by their own {@link JobEngine} jobs. A tracker fires an
4202
- * alert/event when its rule's {@link Verdict} crosses an edge (`ingestVerdict`); owns the durable
4203
- * {@link TrackerEvent} log.
4198
+ * Generic trackers, rising-edge reducers fed by their own {@link JobEngine} jobs. A tracker fires an
4199
+ * alert/event when its rule's {@link Verdict} crosses an edge (`ingestVerdict`). The slice
4200
+ * keeps the durable {@link TrackerEvent} log.
4204
4201
  */
4205
4202
  trackers: EventsState;
4206
4203
  };
4207
4204
  /**
4208
- * Tunes `analyseData` / `processData` sandbox execution. **Where** the code runs is
4209
- * not configurable: it is chosen by environment — a sandboxed, opaque-origin
4210
- * iframe + Web Worker in the browser (no DOM/storage access, no network via CSP,
4211
- * terminable on timeout), and the main thread in Node / SSR (where that boundary
4212
- * has no equivalent). The options below only tune the isolated browser run.
4205
+ * Tunes the sandbox execution of `analyseData`, `processData`, `createTracker` and
4206
+ * `clusterIncidents` code. **Where** the code runs is
4207
+ * not configurable, since the environment decides. In the browser, it is a
4208
+ * sandboxed, opaque-origin iframe + Web Worker (no DOM/storage access, no network
4209
+ * via CSP, terminable on timeout). In Node / SSR, where that boundary has no
4210
+ * equivalent, it is the main thread. The options below only tune the isolated browser run.
4213
4211
  *
4214
4212
  * @group Agent Toolkit
4215
4213
  */
4216
4214
  export type CodeExecutionConfig = {
4217
- /** Wall-clock budget per isolated (browser) run, in ms. Default: 10000. */
4215
+ /** Wall-clock budget per isolated (browser) run, in ms. Defaults to 10000. */
4218
4216
  timeoutMs?: number;
4219
4217
  /**
4220
- * Optional override of the worker's library source. By default the SDK loads its own
4221
- * inlined turf/h3 UMD (a separate lazy chunk), so this is rarely needed — supply it only
4218
+ * Optional override of the worker's library source. By default, the SDK loads its own
4219
+ * inlined turf/h3 UMD (a separate lazy chunk), so this is rarely needed. Supply it only
4222
4220
  * to pin a specific build or add libraries. Return UMD/IIFE JavaScript that defines
4223
4221
  * `self.turf` and `self.h3` (string or Promise of one).
4224
4222
  */
@@ -4227,11 +4225,11 @@ export type CodeExecutionConfig = {
4227
4225
  /**
4228
4226
  * Per-call options handed to a tool's `execute`, separate from its parsed input.
4229
4227
  *
4230
- * `signal` is the AI SDK's own `abortSignal` for the tool call — it fires when the model's
4228
+ * `signal` is the AI SDK's own `abortSignal` for the tool call, which fires when the model's
4231
4229
  * turn is cancelled. Forward it to any `@tomtom-org/maps-sdk/services` call the tool makes
4232
- * (as `signal`) so a cancelled turn also cancels its in-flight HTTP requests.
4230
+ * (as `signal`), so a cancelled turn also cancels its in-flight HTTP requests.
4233
4231
  *
4234
- * Do NOT forward it into work that outlives the turn — a monitor's recurring tick, or any
4232
+ * Do NOT forward it into work that outlives the turn, such as a monitor's recurring tick or any
4235
4233
  * deferred job. Those fire after the signal has aborted, and a monitor treats a rejected tick
4236
4234
  * as fatal (it clears its own interval), so a leaked signal kills the monitor rather than
4237
4235
  * cancelling a request.
@@ -4242,14 +4240,14 @@ export type ToolExecuteOptions = {
4242
4240
  signal?: AbortSignal;
4243
4241
  };
4244
4242
  /**
4245
- * A tool definition — the universal format for both built-in and third-party tools.
4246
- * Combines execution (inputSchema + execute) with classifier metadata.
4243
+ * A tool definition, the universal format for both built-in and third-party tools.
4244
+ * It combines execution (inputSchema + execute) with classifier metadata.
4247
4245
  *
4248
4246
  * @typeParam S - The ToolState shape this tool requires. Default: base `ToolState`.
4249
4247
  * @typeParam Scope - Optional per-tool scope shape. When set via `scopeSchema`, the
4250
4248
  * classifier may emit a value of this shape per turn so the tool's `description`
4251
4249
  * and `inputSchema` can be rebuilt narrower for that step. Tools without scope
4252
- * leave this at the default `unknown`; `scopeSchema` is then absent and no rebuild
4250
+ * leave this at the default `unknown`. `scopeSchema` is then absent and no rebuild
4253
4251
  * ever runs for the tool.
4254
4252
  *
4255
4253
  * @group Agent Toolkit
@@ -4262,20 +4260,20 @@ export type ToolEntry<S extends ToolState = ToolState, Scope = unknown> = {
4262
4260
  /** Optional Zod schema describing the tool's structured output. */
4263
4261
  outputSchema?: z.ZodType;
4264
4262
  /**
4265
- * Function that executes the tool. Receives parsed input and the agent's state.
4263
+ * Function that executes the tool. It receives the parsed input and the agent's state.
4266
4264
  *
4267
4265
  * If this calls a `@tomtom-org/maps-sdk/services` function directly, wrap its params with
4268
- * `withAgentToolkitHeaders` (`tools/shared/agent-headers.ts`) before passing them in — e.g.
4266
+ * `withAgentToolkitHeaders` (`tools/shared/agent-headers.ts`) before passing them in, for example
4269
4267
  * `const requestParams = withAgentToolkitHeaders({ position }); await reverseGeocode(requestParams);`.
4270
- * This tags the request so TomTom's traffic analytics attribute it to agent-toolkit; an
4271
- * untagged call is picked up by the guard test in `tools/shared/tests/agent-headers.test.ts`.
4268
+ * This tags the request so TomTom's traffic analytics attribute it to agent-toolkit. The guard
4269
+ * test in `tools/shared/tests/agent-headers.test.ts` picks up an untagged call.
4272
4270
  */
4273
4271
  execute: (input: any, state: S, options?: ToolExecuteOptions) => Promise<any>;
4274
4272
  /** Compact one-liner for the intent classifier prompt. */
4275
4273
  classificationPrompt?: string;
4276
4274
  /** Category tags (e.g. 'location', 'routing'). */
4277
4275
  tags?: string[];
4278
- /** Usage examples (e.g. 'geocode("Amsterdam")'). */
4276
+ /** Usage examples (e.g. 'geocode("Amsterdam")'), passed on in the metadata a custom classifier receives. */
4279
4277
  examples?: string[];
4280
4278
  /** Natural language prompts (e.g. 'Where is the Louvre?'). */
4281
4279
  examplePrompts?: string[];
@@ -4284,27 +4282,27 @@ export type ToolEntry<S extends ToolState = ToolState, Scope = unknown> = {
4284
4282
  /** Tool names that must run before this one. */
4285
4283
  dependsOn?: string[];
4286
4284
  /**
4287
- * Keep this tool active on every step regardless of the classifier's selection. Its name is
4288
- * unioned into the per-turn `activeTools` set, so the model can always reach it. Use sparingly —
4285
+ * Whether this tool stays active on every step regardless of the classifier's selection. Its name is
4286
+ * unioned into the per-turn `activeTools` set, so the model can always reach it. Use it sparingly,
4289
4287
  * for tools that may be needed to set up *any* request (e.g. asking the user to clarify intent).
4290
- * Has no effect on the fail-open path (when classification is skipped, every tool is active).
4288
+ * It has no effect on the fail-open path (when classification is skipped, every tool is active).
4291
4289
  */
4292
4290
  alwaysActive?: boolean;
4293
4291
  /**
4294
- * Halt the agent loop on the SAME step that calls this tool, with no trailing step. Use for tools
4295
- * whose turn must be a single silent tool call (e.g. clarifyIntent rendering a form). Leave unset to
4296
- * let the model take one more step after the tool returns — e.g. to present the tool's result as text
4297
- * before the loop stops naturally on a no-tool-call step. A tool that semantically awaits the user
4292
+ * Whether to halt the agent loop on the SAME step that calls this tool, with no trailing step. Use for
4293
+ * tools whose turn must be a single silent tool call (e.g. clarifyIntent rendering a form). Leave unset
4294
+ * to let the model take one more step after the tool returns, for example to present the tool's result
4295
+ * as text before the loop stops naturally on a no-tool-call step. A tool that semantically awaits the user
4298
4296
  * conveys that through its own result (e.g. clarifyIntent's `status: 'awaiting_user_response'`), not
4299
4297
  * this flag.
4300
4298
  */
4301
4299
  endsTurnOnCall?: boolean;
4302
4300
  /**
4303
4301
  * Optional per-tool scope schema. When set, the classifier may emit a
4304
- * scope value (validated against this schema) and `prepareStep` will
4305
- * rebuild this tool's `description` + `inputSchema` by re-invoking its
4302
+ * scope value (validated against this schema), and `prepareStep` then
4303
+ * rebuilds this tool's `description` + `inputSchema` by re-invoking its
4306
4304
  * {@link ToolEntryBuilder} with the parsed scope. Tools without a builder
4307
- * cannot be scoped — `scopeSchema` is only meaningful on builder-produced
4305
+ * cannot be scoped, so `scopeSchema` is only meaningful on builder-produced
4308
4306
  * entries.
4309
4307
  */
4310
4308
  scopeSchema?: z.ZodType<Scope>;
@@ -4323,13 +4321,13 @@ export type ToolEntry<S extends ToolState = ToolState, Scope = unknown> = {
4323
4321
  export type ToolMetadata = {
4324
4322
  /** Tool identifier, derived from the config key. */
4325
4323
  name: string;
4326
- /** Description of the tool's purpose. Used by the SDK's system prompt. */
4324
+ /** Description of the tool's purpose, used by the SDK's system prompt. */
4327
4325
  description: string;
4328
4326
  /** Compact one-liner for the intent classifier prompt. */
4329
4327
  classificationPrompt?: string;
4330
4328
  /** Category tags used by the help tool for filtering (e.g. 'location', 'routing'). */
4331
4329
  tags?: string[];
4332
- /** Usage examples (e.g. 'geocode("Amsterdam")'). */
4330
+ /** Usage examples (e.g. 'geocode("Amsterdam")'), for a custom classifier. The help tool does not show them. */
4333
4331
  examples?: string[];
4334
4332
  /** Natural language prompts shown by the help tool (e.g. 'Where is the Louvre?'). */
4335
4333
  examplePrompts?: string[];
@@ -4337,9 +4335,9 @@ export type ToolMetadata = {
4337
4335
  relatedTools?: ToolNameHint[];
4338
4336
  /** Tool names that must run before this one. */
4339
4337
  dependsOn?: ToolNameHint[];
4340
- /** Keep this tool active on every step regardless of the classifier's selection. */
4338
+ /** Whether this tool stays active on every step regardless of the classifier's selection. */
4341
4339
  alwaysActive?: boolean;
4342
- /** Halt the agent loop on the step that calls this tool (no trailing step) — e.g. clarifyIntent rendering a form. */
4340
+ /** Whether to halt the agent loop on the step that calls this tool (no trailing step), e.g. clarifyIntent rendering a form. */
4343
4341
  endsTurnOnCall?: boolean;
4344
4342
  /** When set, the classifier may emit `toolScopes[name]` for this tool to narrow per-turn. */
4345
4343
  scopePrompt?: string;
@@ -4363,9 +4361,9 @@ export type ClassifierContext = {
4363
4361
  */
4364
4362
  export type Classifier = (context: ClassifierContext) => Promise<ClassificationResult | null>;
4365
4363
  /**
4366
- * Feature-flag bag for {@link createMapAgent}. Toggles in-flight or
4367
- * opt-in agent-toolkit behaviour. Individual flags vary in stability —
4368
- * some may graduate to stable public options, others are internal-only
4364
+ * Feature-flag bag for {@link createMapAgent}. It toggles in-flight or
4365
+ * opt-in agent-toolkit behaviour. Individual flags vary in stability.
4366
+ * Some may graduate to stable public options, and others are internal-only
4369
4367
  * experiments that can change or disappear without notice. Check each
4370
4368
  * flag's own doc for its current status.
4371
4369
  *
@@ -4385,7 +4383,7 @@ export type FeatureFlags = {
4385
4383
  readonly [flag: string]: never;
4386
4384
  };
4387
4385
  /**
4388
- * Build-time options passed to a {@link ToolEntryBuilder}. Lets each tool
4386
+ * Build-time options passed to a {@link ToolEntryBuilder}. They let each tool
4389
4387
  * tailor its description, schema, or executor to flags or per-turn scope
4390
4388
  * resolved by the classifier.
4391
4389
  *
@@ -4400,8 +4398,8 @@ export type ToolBuildOptions<Scope = unknown> = {
4400
4398
  featureFlags?: FeatureFlags;
4401
4399
  /**
4402
4400
  * Per-turn scope emitted by the classifier (already validated against the
4403
- * tool's {@link ToolEntry.scopeSchema}). `undefined` at agent-creation time
4404
- * or when the classifier omits a scope for this tool — builders should
4401
+ * tool's {@link ToolEntry.scopeSchema}). It is `undefined` at agent-creation
4402
+ * time or when the classifier omits a scope for this tool. Builders should
4405
4403
  * treat `undefined` as "produce the full surface".
4406
4404
  */
4407
4405
  scope?: Scope;
@@ -4409,8 +4407,8 @@ export type ToolBuildOptions<Scope = unknown> = {
4409
4407
  * Subset of {@link EntryDataKind} the agent is configured to expose, derived
4410
4408
  * from `createMapAgent`'s `dataEntries` option. Builders for `analyseData`
4411
4409
  * and `processData` use this to narrow their static (unscoped) input surface
4412
- * to the agent's enabled kinds. `undefined` means "no agent-level filtering —
4413
- * every kind stays available".
4410
+ * to the agent's enabled kinds. `undefined` means no agent-level filtering, so
4411
+ * every kind stays available.
4414
4412
  */
4415
4413
  enabledDataKinds?: readonly EntryDataKind[];
4416
4414
  };
@@ -4430,8 +4428,8 @@ export type ToolEntryBuilder<S extends ToolState = ToolState, Scope = unknown> =
4430
4428
  /**
4431
4429
  * A registered tool definition: either a static {@link ToolEntry} or a
4432
4430
  * {@link ToolEntryBuilder} that builds one from {@link ToolBuildOptions} at
4433
- * agent-creation time. Used wherever the tool registry, resolver, and
4434
- * setup pipeline accept either form interchangeably.
4431
+ * agent-creation time. The tool registry, resolver and setup pipeline
4432
+ * accept either form interchangeably.
4435
4433
  *
4436
4434
  * @typeParam S - The ToolState shape this tool requires. Default: base `ToolState`.
4437
4435
  * @typeParam Scope - Optional per-tool scope shape (only relevant for builder
@@ -4450,7 +4448,7 @@ export type ToolExecutionInfo = {
4450
4448
  toolName: string;
4451
4449
  /** Wall-clock duration of `execute`, in milliseconds (includes any network/IO). */
4452
4450
  durationMs: number;
4453
- /** True if the tool threw or returned the standardized `{ error: string }` shape. */
4451
+ /** Whether the tool threw or returned the standardized `{ error: string }` shape. */
4454
4452
  isError: boolean;
4455
4453
  /** Error message when `isError` is true (the thrown message or the returned `error`). */
4456
4454
  errorMessage?: string;
@@ -4492,19 +4490,19 @@ export type MapAgentOptions<CS extends ToolState = ToolState> = {
4492
4490
  * the exported `SYSTEM_PROMPT_SECTIONS` map and override with a derived value
4493
4491
  * (e.g. ``responseFormatting: `${SYSTEM_PROMPT_SECTIONS.responseFormatting}\n- Answer in Spanish.` ``).
4494
4492
  *
4495
- * A full string ignores `systemPromptPrefix` and `systemPromptSuffix`;
4496
- * section overrides still honor both.
4493
+ * A full string ignores `systemPromptPrefix` and `systemPromptSuffix`.
4494
+ * Section overrides still honour both.
4497
4495
  */
4498
4496
  systemPrompt?: string | SystemPromptSectionOverrides;
4499
4497
  /**
4500
4498
  * Text prepended above the whole prompt as a preamble, separated by a blank
4501
- * line and carrying no heading. Applied on top of the base prompt or section
4502
- * overrides; ignored only when `systemPrompt` is a full replacement string.
4499
+ * line and carrying no heading. It applies on top of the base prompt or section
4500
+ * overrides, unless `systemPrompt` is a full replacement string.
4503
4501
  */
4504
4502
  systemPromptPrefix?: string;
4505
4503
  /**
4506
4504
  * Additional text appended under an `ADDITIONAL INSTRUCTIONS` heading.
4507
- * Applied on top of the base prompt or section overrides; ignored only when
4505
+ * It applies on top of the base prompt or section overrides, unless
4508
4506
  * `systemPrompt` is a full replacement string.
4509
4507
  */
4510
4508
  systemPromptSuffix?: string;
@@ -4540,19 +4538,19 @@ export type MapAgentOptions<CS extends ToolState = ToolState> = {
4540
4538
  tools?: { [K in ToolNameHint]?: ToolDefinition<CS> | false | undefined; };
4541
4539
  /**
4542
4540
  * Custom state slices merged alongside built-in state.
4543
- * Only custom slices need to be provided — built-in slices are created automatically.
4544
- * Accessible in custom tool `execute` via the state parameter.
4541
+ * Only custom slices need to be provided, since built-in slices are created automatically.
4542
+ * Custom tools read them in `execute` via the state parameter.
4545
4543
  */
4546
4544
  state?: Omit<CS, keyof ToolState>;
4547
4545
  /**
4548
4546
  * Per-kind data-entry configuration. Each {@link DataEntryKind} accepts
4549
4547
  * `{ enabled?, entryMode? }`. Setting `enabled: false` removes the kind from the
4550
- * agent's tool surface entirely — it disappears from `analyseData` / `processData`
4548
+ * agent's tool surface entirely. It disappears from `analyseData` / `processData`
4551
4549
  * scope and input fields, and its slice-specific display / fetch tools
4552
- * ({@link TOOLS_BY_DATA_ENTRY_KIND}) are dropped from the registry; `recallState` stays.
4553
- * `entryMode` is applied to the underlying slice right after the agent state is built — before any tool runs.
4550
+ * ({@link TOOLS_BY_DATA_ENTRY_KIND}) are dropped from the registry. `recallState` stays.
4551
+ * `entryMode` is applied to the underlying slice right after the agent state is built, before any tool runs.
4554
4552
  *
4555
- * Keys are LLM-facing kind names (`routes`, `incidents`) — not slice names
4553
+ * Keys are LLM-facing kind names (`routes`, `incidents`), not slice names
4556
4554
  * (`routing`, `trafficIncidents`). The slice mapping is internal.
4557
4555
  *
4558
4556
  * @example
@@ -4588,17 +4586,17 @@ export type MapAgentOptions<CS extends ToolState = ToolState> = {
4588
4586
  */
4589
4587
  byod?: {
4590
4588
  /**
4591
- * Authorize each `addByodSource` URL before it is fetched — see
4592
- * {@link ByodSourceUrlValidator}. Return `{ valid: true }` to allow or
4593
- * `{ valid: false, reason }` to block (sync or async). Runs in addition
4589
+ * Authorises each `addByodSource` URL before it is fetched (see
4590
+ * {@link ByodSourceUrlValidator}). Return `{ valid: true }` to allow or
4591
+ * `{ valid: false, reason }` to block (sync or async). It runs in addition
4594
4592
  * to the built-in scheme / size / timeout policy.
4595
4593
  */
4596
4594
  validateSourceUrl?: ByodSourceUrlValidator;
4597
4595
  };
4598
4596
  /**
4599
- * Tunes `analyseData` / `processData` sandbox execution — see {@link CodeExecutionConfig}.
4600
- * Where the code runs is chosen by environment (off-thread iframe-worker in the browser,
4601
- * main thread in Node/SSR), not configured here; these options only adjust the isolated
4597
+ * Tunes the data tools' sandbox execution (see {@link CodeExecutionConfig}).
4598
+ * The environment, not this option, chooses where the code runs (off-thread iframe-worker
4599
+ * in the browser, main thread in Node/SSR). These options only adjust the isolated
4602
4600
  * browser run (`timeoutMs`, `loadWorkerLibrarySource`).
4603
4601
  *
4604
4602
  * @experimental
@@ -4632,11 +4630,11 @@ export type MapAgentOptions<CS extends ToolState = ToolState> = {
4632
4630
  * Defaults to `true`. Set to `false` for providers that don't support structured tool outputs.
4633
4631
  */
4634
4632
  outputSchemas?: boolean;
4635
- /** Max multi-step tool loop iterations. Default: 10. */
4633
+ /** Maximum multi-step tool loop iterations. Defaults to 10. */
4636
4634
  maxSteps?: number;
4637
4635
  /**
4638
4636
  * Opt into in-flight or experimental agent-toolkit behaviour. Stability
4639
- * varies per flag — see {@link FeatureFlags} and each flag's own doc.
4637
+ * varies per flag (see {@link FeatureFlags} and each flag's own doc).
4640
4638
  *
4641
4639
  * @experimental
4642
4640
  */
@@ -4645,8 +4643,8 @@ export type MapAgentOptions<CS extends ToolState = ToolState> = {
4645
4643
  * Provider-specific options forwarded to the AI SDK on every step. Keyed by
4646
4644
  * provider id (`openai`, `azure`, `anthropic`, ...).
4647
4645
  *
4648
- * Use this to enable reasoning summaries for gpt-5.x via the Responses API
4649
- * — without `reasoningSummary` the model thinks but returns no reasoning text:
4646
+ * Use this to enable reasoning summaries for gpt-5.x via the Responses API.
4647
+ * Without `reasoningSummary`, the model thinks but returns no reasoning text.
4650
4648
  *
4651
4649
  * @example
4652
4650
  * ```typescript
@@ -4661,7 +4659,7 @@ export type MapAgentOptions<CS extends ToolState = ToolState> = {
4661
4659
  providerOptions?: ProviderOptions;
4662
4660
  /**
4663
4661
  * Per-step `providerOptions` override. Called once per step with the
4664
- * classifier-narrowed active toolset; the returned object is merged on top
4662
+ * classifier-narrowed active toolset. The returned object is merged on top
4665
4663
  * of `providerOptions` for that step. Use it to bump reasoning effort on
4666
4664
  * turns that include a code-execution tool without paying the cost on
4667
4665
  * simple fetch/toggle turns.
@@ -4680,15 +4678,15 @@ export type MapAgentOptions<CS extends ToolState = ToolState> = {
4680
4678
  }) => ProviderOptions | undefined;
4681
4679
  };
4682
4680
  /**
4683
- * The return type of createMapAgent().
4684
- * A real ToolLoopAgent instance with state access and cleanup.
4681
+ * The return type of createMapAgent(), a real ToolLoopAgent instance
4682
+ * with state access and cleanup.
4685
4683
  *
4686
4684
  * @group Agent Toolkit
4687
4685
  */
4688
4686
  export type MapAgentInstance<CS extends ToolState = ToolState> = ToolLoopAgent & {
4689
4687
  /** Live agent state (built-in + custom slices). */
4690
4688
  readonly state: CS;
4691
- /** Tear down: resets all state slices that have a reset() method. */
4689
+ /** Tears down by resetting all state slices that have a reset() method. */
4692
4690
  destroy(): void;
4693
4691
  };
4694
4692
  //#endregion
@@ -4696,13 +4694,12 @@ export type MapAgentInstance<CS extends ToolState = ToolState> = ToolLoopAgent &
4696
4694
  /**
4697
4695
  * Creates a conversational agent toolkit that gives an LLM control over a TomTom map.
4698
4696
  *
4699
- * Returns a ToolLoopAgent instance (compatible with DirectChatTransport) with
4697
+ * It returns a ToolLoopAgent instance (compatible with DirectChatTransport) with
4700
4698
  * `state` and `destroy` attached. Classification runs transparently inside
4701
- * `prepareStep` — no wrapper type needed.
4699
+ * `prepareStep`, so you need no wrapper type.
4702
4700
  *
4703
- * @param map - The TomTomMap instance to control
4704
- * @param options - Agent configuration options
4705
- * @returns A ToolLoopAgent with state access and cleanup
4701
+ * @param map - The map to control.
4702
+ * @returns A ToolLoopAgent with state access and cleanup.
4706
4703
  *
4707
4704
  * @example Basic usage
4708
4705
  * ```typescript
@@ -4739,11 +4736,11 @@ export declare const createMapAgent: <CS extends ToolState = ToolState>(map: Tom
4739
4736
  *
4740
4737
  * - `ToolEntry` (or builder) values add or replace tools in `defaults`.
4741
4738
  * - `false` values remove tools from `defaults`.
4742
- * - Returns a new object — `defaults` is never mutated.
4739
+ * - It returns a new object and never mutates `defaults`.
4743
4740
  *
4744
4741
  * Default entries may be {@link ToolEntryBuilder builders} that produce
4745
4742
  * their {@link ToolEntry} from build-time options. Builders pass through
4746
- * untouched and are materialized later by `setupTools`.
4743
+ * untouched, and `setupTools` materializes them later.
4747
4744
  *
4748
4745
  * @param defaults - Base tool record (typically DEFAULT_TOOLS or empty).
4749
4746
  * @param overrides - User-provided additions, replacements, and exclusions.
@@ -4761,7 +4758,7 @@ export declare const questionSchema: z.ZodObject<{
4761
4758
  options: z.ZodArray<z.ZodString>;
4762
4759
  multiSelect: z.ZodDefault<z.ZodBoolean>;
4763
4760
  }, z.core.$strip>;
4764
- /** One clarification question — the unit a host UI renders. */
4761
+ /** One clarification question, the unit a host UI renders. */
4765
4762
  type ClarifyIntentQuestion = z.infer<typeof questionSchema>;
4766
4763
  /**
4767
4764
  * Input schema for {@link executeClarifyIntent}.
@@ -4778,8 +4775,8 @@ export declare const clarifyIntentSchema: z.ZodObject<{
4778
4775
  /**
4779
4776
  * Output schema for {@link executeClarifyIntent}. The tool resolves immediately, echoing back the
4780
4777
  * `intro` + `questions` (so a host can render the whole form) plus an `awaiting_user_response` status.
4781
- * No "stop and wait" directive is echoed here: the description-level usage contract already carries it
4782
- * (CLARIFY_FORM_PROMPT and CLARIFY_PROSE_PROMPT both tell the agent to STOP and wait), so repeating it
4778
+ * No "stop and wait" directive is echoed, because the description-level usage contract already carries
4779
+ * it. CLARIFY_FORM_PROMPT and CLARIFY_PROSE_PROMPT both tell the agent to STOP and wait, so repeating it
4783
4780
  * in the result would be redundant.
4784
4781
  */
4785
4782
  export declare const clarifyIntentOutputSchema: z.ZodObject<{
@@ -4794,7 +4791,7 @@ export declare const clarifyIntentOutputSchema: z.ZodObject<{
4794
4791
  }, z.core.$strip>;
4795
4792
  /** Usage contract appended to the description when the host renders the form: silent turn, questions not restated in prose. */
4796
4793
  export declare const CLARIFY_FORM_PROMPT: string;
4797
- /** Usage contract appended to the description when there is no form: the model also writes the questions as prose so any UI shows them. */
4794
+ /** Usage contract appended to the description when there is no form. The model also writes the questions as prose so any UI shows them. */
4798
4795
  export declare const CLARIFY_PROSE_PROMPT: string;
4799
4796
  /** Per-call overrides accepted by {@link createClarifyIntentTool}. */
4800
4797
  type ClarifyIntentToolOptions = {
@@ -4807,19 +4804,19 @@ type ClarifyIntentToolOptions = {
4807
4804
  /** Replace the default natural-language example prompts. */
4808
4805
  examplePrompts?: string[];
4809
4806
  /**
4810
- * Keep the tool active on every step regardless of the classifier (so the agent can always ask
4811
- * to clarify, even mid-task). Defaults to `true`; set `false` to leave activation to the classifier.
4807
+ * Whether the tool stays active on every step regardless of the classifier, so the agent can always
4808
+ * ask to clarify, even mid-task. Defaults to `true`. `false` leaves activation to the classifier.
4812
4809
  */
4813
4810
  alwaysActive?: boolean;
4814
4811
  /**
4815
- * Does your host render the clarifyIntent form? `true` → silent form contract; `false` (default) →
4816
- * the agent narrates the questions as prose so they reach a form-less UI.
4812
+ * Whether your host renders the clarifyIntent form. `true` uses the silent form contract. With
4813
+ * `false` (default), the agent narrates the questions as prose so they reach a form-less UI.
4817
4814
  */
4818
4815
  rendersForm?: boolean;
4819
4816
  };
4820
4817
  /**
4821
- * Build a clarifyIntent {@link ToolEntry}, optionally overriding its description and examples for a
4822
- * specific domain. The schema and `execute` are fixed; only the classifier-facing metadata is
4818
+ * Builds a clarifyIntent {@link ToolEntry}, optionally overriding its description and examples for a
4819
+ * specific domain. The schema and `execute` are fixed. Only the classifier-facing metadata is
4823
4820
  * customizable. Pass the result to `createMapAgent`'s `tools` option to replace the built-in default:
4824
4821
  *
4825
4822
  * ```typescript
@@ -4839,14 +4836,14 @@ export declare const createClarifyIntentTool: (options?: ClarifyIntentToolOption
4839
4836
  //#region src/tools/utilities/get-current-location.d.ts
4840
4837
  type GetCurrentLocationToolOptions = {
4841
4838
  /**
4842
- * Send the exact position, the device's accuracy and the fix's timestamp to the model, from a
4843
- * fresh high-accuracy fix. Defaults to `false`: the position is rounded to 3 decimals (about
4839
+ * Whether the model gets the exact position, the device's accuracy and the fix's timestamp, from a
4840
+ * fresh high-accuracy fix. By default (`false`), the position is rounded to 3 decimals (about
4844
4841
  * 100 m) from a fix up to a minute old, with no timestamp.
4845
4842
  */
4846
4843
  fullPrecision?: boolean;
4847
4844
  };
4848
4845
  /**
4849
- * Build a getCurrentLocation {@link ToolEntry}. Pass the result to `createMapAgent`'s `tools` option
4846
+ * Builds a getCurrentLocation {@link ToolEntry}. Pass the result to `createMapAgent`'s `tools` option
4850
4847
  * to replace the built-in default, for example to send the exact position:
4851
4848
  *
4852
4849
  * ```typescript