mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
* feat(region-routing): P1 tagging + region_routes primitive + read/write API + preview launcher - config.py: add Coverage.region_tagging (bool=False); add RegionRouteMatrix dataclass (enabled, cells) above NotificationsConfig; add region_routes field to NotificationsConfig; add explicit hydration branch for region_routes in _dict_to_dataclass mirroring destinations pattern. - coverage_area.py: add MonitoringArea.name (str|None=None, frozen); update areas_from_config to preserve name; refactor inline geom extraction from classify_event_areas into shared _event_geom_json helper; add matching_area_names(geom_json, areas)->list[str] (additive, all named matches, config-order, deduped; gate unchanged); add event_region_names convenience wrapper. - coverage_filter.py: add region_tagging ctor kwarg; stamp event.region/ regions before the gate when region_tagging=True and areas non-empty and not event.regions (never clobbers satpass preset). - pipeline/__init__.py: wire region_tagging into CoverageFilter construction. - notification_routes.py: add GET /notifications/regions (named coverage area names, config-order, deduped); GET /notifications/region-routing (matrix as JSON); POST /notifications/region-routing (explicit RMW — only region_routes changes, toggles/rules/destinations survive). - scripts/preview_dashboard.py: mesh-free launcher — dashboard API only, no mesh connector, no broadcast loop; vite runs separately. All 87 coverage tests pass; 300 total pass; 6 pre-existing failures unchanged (adapter config count mismatch + MeshCore EventType.NEW_CONTACT). * feat(region-routing): manual region x family matrix editor page Adds RegionRoutingMatrix.tsx — a plain editor over the region_routes config primitive. Rows = families (via useFamilies()), cols = regions (from GET /api/notifications/regions). Each cell exposes MT channel (ChannelPicker single + includeDisabled), MC channel name (text input), min_severity select (routine/priority/critical/immediate), and an enabled checkbox. Only cells where MT or MC is set are included in the sparse POST payload. Master enable toggle maps to top-level enabled. MT budget guard warns when more than 7 distinct MT indices are in use. Sticky family column; horizontal scroll for wide region sets. Registers route /region-routing in App.tsx and adds "Region Routing" nav entry (Map icon) under the Meshtastic section in Layout.tsx, immediately after Routing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(region-routing): regions endpoint reads saved (disk) coverage so routing columns are dynamic without a bot restart; preview reloads config after writes * feat(routing): unify MT/MC routing into per-family cards; region routing as an in-card expand; remove rules/destinations UI + standalone page * refactor(routing): move Meshtastic Routing from /notifications to /meshtastic/routing (mirror /meshcore/routing); redirect legacy path * feat(region-routing): dispatcher honors region_routes matrix (authoritative-on-match, per-region cooldown, per-channel dedup); non-matrix path unchanged Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(region-routing): matrix dedup key must match boot-restore 2-tuple form (prevents restart re-broadcast flood); regression test --------- Co-authored-by: Matt Johnson <mj@k7zvx.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
59 lines
3.6 KiB
TypeScript
59 lines
3.6 KiB
TypeScript
declare function fastq<C, T = any, R = any>(context: C, worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R>
|
|
declare function fastq<C, T = any, R = any>(worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R>
|
|
|
|
declare namespace fastq {
|
|
type worker<C, T = any, R = any> = (this: C, task: T, cb: fastq.done<R>) => void
|
|
type asyncWorker<C, T = any, R = any> = (this: C, task: T) => Promise<R>
|
|
type done<R = any> = (err: Error | null, result?: R) => void
|
|
type errorHandler<T = any> = (err: Error, task: T) => void
|
|
|
|
interface queue<T = any, R = any> {
|
|
/** Add a task at the end of the queue. `done(err, result)` will be called when the task was processed. */
|
|
push(task: T, done?: done<R>): void
|
|
/** Add a task at the beginning of the queue. `done(err, result)` will be called when the task was processed. */
|
|
unshift(task: T, done?: done<R>): void
|
|
/** Pause the processing of tasks. Currently worked tasks are not stopped. */
|
|
pause(): any
|
|
/** Resume the processing of tasks. */
|
|
resume(): any
|
|
running(): number
|
|
/** Returns `false` if there are tasks being processed or waiting to be processed. `true` otherwise. */
|
|
idle(): boolean
|
|
/** Returns the number of tasks waiting to be processed (in the queue). */
|
|
length(): number
|
|
/** Returns all the tasks be processed (in the queue). Returns empty array when there are no tasks */
|
|
getQueue(): T[]
|
|
/** Removes all tasks waiting to be processed, and reset `drain` to an empty function. */
|
|
kill(): any
|
|
/** Same than `kill` but the `drain` function will be called before reset to empty. */
|
|
killAndDrain(): any
|
|
/** Removes all tasks waiting to be processed, calls each task's callback with an abort error (rejects promises for promise-based queues), and resets `drain` to an empty function. */
|
|
abort(): any
|
|
/** Set a global error handler. `handler(err, task)` will be called each time a task is completed, `err` will be not null if the task has thrown an error. */
|
|
error(handler: errorHandler<T>): void
|
|
/** Property that returns the number of concurrent tasks that could be executed in parallel. It can be altered at runtime. */
|
|
concurrency: number
|
|
/** Property (Read-Only) that returns `true` when the queue is in a paused state. */
|
|
readonly paused: boolean
|
|
/** Function that will be called when the last item from the queue has been processed by a worker. It can be altered at runtime. */
|
|
drain(): any
|
|
/** Function that will be called when the last item from the queue has been assigned to a worker. It can be altered at runtime. */
|
|
empty: () => void
|
|
/** Function that will be called when the queue hits the concurrency limit. It can be altered at runtime. */
|
|
saturated: () => void
|
|
}
|
|
|
|
interface queueAsPromised<T = any, R = any> extends queue<T, R> {
|
|
/** Add a task at the end of the queue. The returned `Promise` will be fulfilled (rejected) when the task is completed successfully (unsuccessfully). */
|
|
push(task: T): Promise<R>
|
|
/** Add a task at the beginning of the queue. The returned `Promise` will be fulfilled (rejected) when the task is completed successfully (unsuccessfully). */
|
|
unshift(task: T): Promise<R>
|
|
/** Wait for the queue to be drained. The returned `Promise` will be resolved when all tasks in the queue have been processed by a worker. */
|
|
drained(): Promise<void>
|
|
}
|
|
|
|
function promise<C, T = any, R = any>(context: C, worker: fastq.asyncWorker<C, T, R>, concurrency: number): fastq.queueAsPromised<T, R>
|
|
function promise<C, T = any, R = any>(worker: fastq.asyncWorker<C, T, R>, concurrency: number): fastq.queueAsPromised<T, R>
|
|
}
|
|
|
|
export = fastq
|