@uptimizr/db 2.0.1 → 2.1.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.
Files changed (171) hide show
  1. package/AGENTS.md +228 -3
  2. package/README.md +13 -0
  3. package/dist/duckdb/migrations.d.ts.map +1 -1
  4. package/dist/duckdb/migrations.js +169 -0
  5. package/dist/duckdb/migrations.js.map +1 -1
  6. package/dist/duckdb/panelSpecs.d.ts +29 -0
  7. package/dist/duckdb/panelSpecs.d.ts.map +1 -0
  8. package/dist/duckdb/panelSpecs.js +104 -0
  9. package/dist/duckdb/panelSpecs.js.map +1 -0
  10. package/dist/duckdb/projectMetadata.d.ts +43 -0
  11. package/dist/duckdb/projectMetadata.d.ts.map +1 -0
  12. package/dist/duckdb/projectMetadata.js +222 -0
  13. package/dist/duckdb/projectMetadata.js.map +1 -0
  14. package/dist/duckdb/subscriptions.d.ts +45 -0
  15. package/dist/duckdb/subscriptions.d.ts.map +1 -0
  16. package/dist/duckdb/subscriptions.js +202 -0
  17. package/dist/duckdb/subscriptions.js.map +1 -0
  18. package/dist/index.d.ts +18 -4
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +48 -3
  21. package/dist/index.js.map +1 -1
  22. package/dist/insights/anomalies.d.ts +213 -0
  23. package/dist/insights/anomalies.d.ts.map +1 -0
  24. package/dist/insights/anomalies.js +340 -0
  25. package/dist/insights/anomalies.js.map +1 -0
  26. package/dist/insights/baseline.d.ts +51 -0
  27. package/dist/insights/baseline.d.ts.map +1 -0
  28. package/dist/insights/baseline.js +48 -0
  29. package/dist/insights/baseline.js.map +1 -0
  30. package/dist/insights/buckets.d.ts +114 -0
  31. package/dist/insights/buckets.d.ts.map +1 -0
  32. package/dist/insights/buckets.js +220 -0
  33. package/dist/insights/buckets.js.map +1 -0
  34. package/dist/insights/changepoint.d.ts +130 -0
  35. package/dist/insights/changepoint.d.ts.map +1 -0
  36. package/dist/insights/changepoint.js +209 -0
  37. package/dist/insights/changepoint.js.map +1 -0
  38. package/dist/insights/evaluate.d.ts +63 -0
  39. package/dist/insights/evaluate.d.ts.map +1 -0
  40. package/dist/insights/evaluate.js +158 -0
  41. package/dist/insights/evaluate.js.map +1 -0
  42. package/dist/insights/health.d.ts +219 -0
  43. package/dist/insights/health.d.ts.map +1 -0
  44. package/dist/insights/health.js +349 -0
  45. package/dist/insights/health.js.map +1 -0
  46. package/dist/insights/index.d.ts +45 -0
  47. package/dist/insights/index.d.ts.map +1 -0
  48. package/dist/insights/index.js +40 -0
  49. package/dist/insights/index.js.map +1 -0
  50. package/dist/insights/measures.d.ts +222 -0
  51. package/dist/insights/measures.d.ts.map +1 -0
  52. package/dist/insights/measures.js +431 -0
  53. package/dist/insights/measures.js.map +1 -0
  54. package/dist/insights/movers.d.ts +123 -0
  55. package/dist/insights/movers.d.ts.map +1 -0
  56. package/dist/insights/movers.js +166 -0
  57. package/dist/insights/movers.js.map +1 -0
  58. package/dist/insights/significance.d.ts +221 -0
  59. package/dist/insights/significance.d.ts.map +1 -0
  60. package/dist/insights/significance.js +531 -0
  61. package/dist/insights/significance.js.map +1 -0
  62. package/dist/insights/stats.d.ts +104 -0
  63. package/dist/insights/stats.d.ts.map +1 -0
  64. package/dist/insights/stats.js +181 -0
  65. package/dist/insights/stats.js.map +1 -0
  66. package/dist/insights/windows.d.ts +95 -0
  67. package/dist/insights/windows.d.ts.map +1 -0
  68. package/dist/insights/windows.js +97 -0
  69. package/dist/insights/windows.js.map +1 -0
  70. package/dist/metadata.d.ts +178 -1
  71. package/dist/metadata.d.ts.map +1 -1
  72. package/dist/metadata.js +80 -0
  73. package/dist/metadata.js.map +1 -1
  74. package/dist/narrative/build.d.ts +78 -0
  75. package/dist/narrative/build.d.ts.map +1 -0
  76. package/dist/narrative/build.js +437 -0
  77. package/dist/narrative/build.js.map +1 -0
  78. package/dist/narrative/index.d.ts +14 -0
  79. package/dist/narrative/index.d.ts.map +1 -0
  80. package/dist/narrative/index.js +13 -0
  81. package/dist/narrative/index.js.map +1 -0
  82. package/dist/narrative/text.d.ts +25 -0
  83. package/dist/narrative/text.d.ts.map +1 -0
  84. package/dist/narrative/text.js +41 -0
  85. package/dist/narrative/text.js.map +1 -0
  86. package/dist/parity/cases.d.ts +3 -0
  87. package/dist/parity/cases.d.ts.map +1 -1
  88. package/dist/parity/cases.js +387 -7
  89. package/dist/parity/cases.js.map +1 -1
  90. package/dist/parity/compare.d.ts +19 -0
  91. package/dist/parity/compare.d.ts.map +1 -1
  92. package/dist/parity/compare.js +19 -0
  93. package/dist/parity/compare.js.map +1 -1
  94. package/dist/parity/fixtures.d.ts.map +1 -1
  95. package/dist/parity/fixtures.js +25 -0
  96. package/dist/parity/fixtures.js.map +1 -1
  97. package/dist/query/aggregations.d.ts +46 -1
  98. package/dist/query/aggregations.d.ts.map +1 -1
  99. package/dist/query/aggregations.js +86 -0
  100. package/dist/query/aggregations.js.map +1 -1
  101. package/dist/query/clickhouseDialect.d.ts.map +1 -1
  102. package/dist/query/clickhouseDialect.js +5 -1
  103. package/dist/query/clickhouseDialect.js.map +1 -1
  104. package/dist/query/customEventVocabulary.d.ts +46 -0
  105. package/dist/query/customEventVocabulary.d.ts.map +1 -0
  106. package/dist/query/customEventVocabulary.js +127 -0
  107. package/dist/query/customEventVocabulary.js.map +1 -0
  108. package/dist/query/dsl/builders.d.ts +38 -0
  109. package/dist/query/dsl/builders.d.ts.map +1 -0
  110. package/dist/query/dsl/builders.js +35 -0
  111. package/dist/query/dsl/builders.js.map +1 -0
  112. package/dist/query/dsl/compare.d.ts +167 -0
  113. package/dist/query/dsl/compare.d.ts.map +1 -0
  114. package/dist/query/dsl/compare.js +358 -0
  115. package/dist/query/dsl/compare.js.map +1 -0
  116. package/dist/query/dsl/compile.d.ts +89 -0
  117. package/dist/query/dsl/compile.d.ts.map +1 -0
  118. package/dist/query/dsl/compile.js +174 -0
  119. package/dist/query/dsl/compile.js.map +1 -0
  120. package/dist/query/dsl/explain.d.ts +115 -0
  121. package/dist/query/dsl/explain.d.ts.map +1 -0
  122. package/dist/query/dsl/explain.js +143 -0
  123. package/dist/query/dsl/explain.js.map +1 -0
  124. package/dist/query/dsl/generic.d.ts +127 -0
  125. package/dist/query/dsl/generic.d.ts.map +1 -0
  126. package/dist/query/dsl/generic.js +323 -0
  127. package/dist/query/dsl/generic.js.map +1 -0
  128. package/dist/query/dsl/index.d.ts +30 -0
  129. package/dist/query/dsl/index.d.ts.map +1 -0
  130. package/dist/query/dsl/index.js +23 -0
  131. package/dist/query/dsl/index.js.map +1 -0
  132. package/dist/query/dsl/order.d.ts +41 -0
  133. package/dist/query/dsl/order.d.ts.map +1 -0
  134. package/dist/query/dsl/order.js +55 -0
  135. package/dist/query/dsl/order.js.map +1 -0
  136. package/dist/query/dsl/significance.d.ts +130 -0
  137. package/dist/query/dsl/significance.d.ts.map +1 -0
  138. package/dist/query/dsl/significance.js +224 -0
  139. package/dist/query/dsl/significance.js.map +1 -0
  140. package/dist/query/index.d.ts +2 -0
  141. package/dist/query/index.d.ts.map +1 -1
  142. package/dist/query/index.js +8 -0
  143. package/dist/query/index.js.map +1 -1
  144. package/dist/query/summary/index.d.ts +4 -2
  145. package/dist/query/summary/index.d.ts.map +1 -1
  146. package/dist/query/summary/index.js +2 -1
  147. package/dist/query/summary/index.js.map +1 -1
  148. package/dist/query/summary/labels.d.ts +101 -0
  149. package/dist/query/summary/labels.d.ts.map +1 -0
  150. package/dist/query/summary/labels.js +261 -0
  151. package/dist/query/summary/labels.js.map +1 -0
  152. package/dist/query/summary/reading.d.ts.map +1 -1
  153. package/dist/query/summary/reading.js +21 -2
  154. package/dist/query/summary/reading.js.map +1 -1
  155. package/dist/query/summary/schema.d.ts +250 -20
  156. package/dist/query/summary/schema.d.ts.map +1 -1
  157. package/dist/query/summary/schema.js +135 -123
  158. package/dist/query/summary/schema.js.map +1 -1
  159. package/dist/query/summary/summarize.d.ts.map +1 -1
  160. package/dist/query/summary/summarize.js +91 -5
  161. package/dist/query/summary/summarize.js.map +1 -1
  162. package/dist/query/summary/types.d.ts +77 -2
  163. package/dist/query/summary/types.d.ts.map +1 -1
  164. package/dist/query/types.d.ts +47 -1
  165. package/dist/query/types.d.ts.map +1 -1
  166. package/dist/subscriptions.d.ts +208 -0
  167. package/dist/subscriptions.d.ts.map +1 -0
  168. package/dist/subscriptions.js +153 -0
  169. package/dist/subscriptions.js.map +1 -0
  170. package/llms.txt +9 -0
  171. package/package.json +8 -8
@@ -0,0 +1,261 @@
1
+ /**
2
+ * **Spatial labelling** of summary clusters (ADR 0051 §2, design sketch §B.2).
3
+ *
4
+ * A hotspot reported as "centred at (-6.2, 0, 8.4)" tells a language model
5
+ * nothing it can act on. The scene registry already knows the vocabulary that
6
+ * would: the proxy's per-mesh AABBs (ADR 0010/0014) name the geometry, and the
7
+ * scene's **regions** (`sceneRegionSchema`) name the places a developer cares
8
+ * about. This module joins the two onto a cluster so the same hotspot reads
9
+ * "near `checkout_button`, in region `counter`".
10
+ *
11
+ * Four fields are attached, and each is defensible on its own:
12
+ *
13
+ * | field | rule |
14
+ * | ------------- | ----------------------------------------------------------------- |
15
+ * | `region` | the **smallest** region (by volume) whose box contains the centroid |
16
+ * | `regions` | *every* containing region id, ascending — regions may overlap |
17
+ * | `nearestMesh` | a proxy box containing the centroid, else the nearest box centre |
18
+ * | `distance` | world units to that mesh's centre; `0` when the box contains it |
19
+ *
20
+ * A mesh match is only reported when it is close enough to mean something: a
21
+ * non-containing box must have its centre within `cellSize × 2` of the centroid,
22
+ * the width of the cell the hotspot was binned into either side. Beyond that the
23
+ * answer is `null` — "there is nothing here" is information, and a confidently
24
+ * wrong landmark is worse than none.
25
+ *
26
+ * ## Determinism
27
+ *
28
+ * Everything here is a pure function of the *sets* it is given. Ties are broken
29
+ * by id / name ascending (never by array order), volumes and distances are
30
+ * compared as plain numbers, and no accumulation happens across boxes — so the
31
+ * same scene and the same clusters always produce the same labels, whatever
32
+ * order the store, the registry table or the proxy listed their rows in.
33
+ *
34
+ * ## Cost
35
+ *
36
+ * `O(clusters × boxes)`, with an early exit: a box whose expanded bounds (its
37
+ * own box grown by the mesh threshold) do not contain the centroid can neither
38
+ * contain it nor have its centre within the threshold, so it is rejected after
39
+ * at most three comparisons without any distance math. With a summary capped at
40
+ * `maxSummaryRows` clusters and a proxy capped at `LIMITS.maxSceneProxyMeshes`
41
+ * boxes, the whole labelling pass is bounded — `__tests__/spatialLabels.test.ts`
42
+ * holds the largest shape to under 50 ms.
43
+ *
44
+ * Pure and browser-safe: no I/O, no `node:` import, no store reference. The
45
+ * collector loads the regions and the proxy once per request and hands them in.
46
+ */
47
+ import { gridColumns } from "./columns.js";
48
+ /**
49
+ * Which **world** axis each grid axis indexes, for the registry's `unit: "index"`
50
+ * column names. `null` for a grid that is not world-space at all — the pointer
51
+ * and mesh-UV grids (`gx`/`gy`) are normalised viewport/UV cells and the
52
+ * view-direction grid is angular, so a world box would be a category error.
53
+ *
54
+ * Only the two world-space shapes are labelled: the voxel grids (`vx/vy/vz`) and
55
+ * the ground-plane bins (`gx/gz`), which index X and Z with no Y at all.
56
+ */
57
+ const WORLD_AXES = {
58
+ vx: 0,
59
+ vy: 1,
60
+ vz: 2,
61
+ gx: 0,
62
+ gz: 2,
63
+ };
64
+ /**
65
+ * Map a cluster summary's grid axes onto world axes, or `null` when the grid is
66
+ * not world-space. A 2-axis `gx`/`gz` grid maps to X and Z: the labelling then
67
+ * tests containment and distance **in the ground plane only**, which is what a
68
+ * ground-binned metric actually measured.
69
+ */
70
+ export function worldAxisMap(axes) {
71
+ if (axes.length === 0)
72
+ return null;
73
+ const mapped = [];
74
+ for (const axis of axes) {
75
+ const world = WORLD_AXES[axis];
76
+ if (world == null)
77
+ return null;
78
+ mapped.push(world);
79
+ }
80
+ // A repeated world axis would make containment meaningless.
81
+ return new Set(mapped).size === mapped.length ? mapped : null;
82
+ }
83
+ /**
84
+ * Whether a metric summarises as clusters on a **world-space** grid, and so is
85
+ * worth loading a scene's regions and proxy for. Lets the collector skip the two
86
+ * registry reads for the grids that could never be labelled — the viewport
87
+ * pointer/UV bins and the angular view-direction grid — without teaching the
88
+ * Fastify layer which grids those are.
89
+ */
90
+ export function isWorldSpatialMetric(metric) {
91
+ if (metric.grain !== "bin" && metric.grain !== "voxel")
92
+ return false;
93
+ const axes = gridColumns(metric, metric.grain === "voxel" ? 3 : 2);
94
+ return axes != null && worldAxisMap(axes.map(([name]) => name)) != null;
95
+ }
96
+ /** Volume of a box over the axes under test; `0` for a degenerate box. */
97
+ function volumeOf(box, axes) {
98
+ let volume = 1;
99
+ for (const axis of axes) {
100
+ const min = box[axis] ?? 0;
101
+ const max = box[axis + 3] ?? 0;
102
+ volume *= Math.max(0, max - min);
103
+ }
104
+ return volume;
105
+ }
106
+ /** Whether `point` (indexed by the same axes) lies inside `box`, inclusive. */
107
+ function contains(box, point, axes) {
108
+ for (let i = 0; i < axes.length; i++) {
109
+ const axis = axes[i];
110
+ const value = point[i];
111
+ if (value < (box[axis] ?? 0) || value > (box[axis + 3] ?? 0))
112
+ return false;
113
+ }
114
+ return true;
115
+ }
116
+ /** Squared distance from `point` to the centre of `box`, over the tested axes. */
117
+ function centreDistanceSq(box, point, axes) {
118
+ let sum = 0;
119
+ for (let i = 0; i < axes.length; i++) {
120
+ const axis = axes[i];
121
+ const centre = ((box[axis] ?? 0) + (box[axis + 3] ?? 0)) / 2;
122
+ const delta = point[i] - centre;
123
+ sum += delta * delta;
124
+ }
125
+ return sum;
126
+ }
127
+ /**
128
+ * The early exit: a box grown by `slack` on every tested axis must still contain
129
+ * the point, or it can neither contain the point nor have its centre within
130
+ * `slack` of it (the centre is at least the overhang plus the half-extent away).
131
+ * Three comparisons, no square root, no allocation.
132
+ */
133
+ function withinSlack(box, point, axes, slack) {
134
+ for (let i = 0; i < axes.length; i++) {
135
+ const axis = axes[i];
136
+ const value = point[i];
137
+ if (value < (box[axis] ?? 0) - slack || value > (box[axis + 3] ?? 0) + slack)
138
+ return false;
139
+ }
140
+ return true;
141
+ }
142
+ /** Nothing known: the shape a cluster gets when the scene registers neither. */
143
+ const UNLABELLED = {
144
+ region: null,
145
+ regions: [],
146
+ nearestMesh: null,
147
+ distance: null,
148
+ };
149
+ /**
150
+ * Label one world-space point against a scene's regions and proxy meshes.
151
+ *
152
+ * `point` carries one coordinate per entry of `axes`, already in world units.
153
+ * `meshThreshold` is how far a *non-containing* mesh box's centre may be and
154
+ * still be reported (the collector passes `cellSize × 2`); pass `0` to accept
155
+ * containment only.
156
+ */
157
+ export function labelPoint(point, scene, axes, meshThreshold) {
158
+ const regions = scene.regions ?? [];
159
+ const meshes = scene.meshes ?? [];
160
+ if (regions.length === 0 && meshes.length === 0)
161
+ return UNLABELLED;
162
+ // Regions: every containing box (ids ascending), smallest by volume reported.
163
+ const containing = [];
164
+ let smallestId = null;
165
+ let smallestVolume = Number.POSITIVE_INFINITY;
166
+ for (const region of regions) {
167
+ if (!contains(region.bounds, point, axes))
168
+ continue;
169
+ containing.push(region.id);
170
+ const volume = volumeOf(region.bounds, axes);
171
+ // `<` keeps the first of equal volumes; the id sort below makes that stable.
172
+ if (volume < smallestVolume || (volume === smallestVolume && region.id < (smallestId ?? ""))) {
173
+ smallestVolume = volume;
174
+ smallestId = region.id;
175
+ }
176
+ }
177
+ containing.sort();
178
+ // Meshes: a containing box wins outright (smallest, so a prop inside a room
179
+ // beats the room); otherwise the nearest centre inside the threshold.
180
+ let containedName = null;
181
+ let containedVolume = Number.POSITIVE_INFINITY;
182
+ let nearestName = null;
183
+ let nearestDistanceSq = Number.POSITIVE_INFINITY;
184
+ const thresholdSq = meshThreshold * meshThreshold;
185
+ for (const mesh of meshes) {
186
+ if (!withinSlack(mesh.aabb, point, axes, meshThreshold))
187
+ continue;
188
+ if (contains(mesh.aabb, point, axes)) {
189
+ const volume = volumeOf(mesh.aabb, axes);
190
+ if (volume < containedVolume ||
191
+ (volume === containedVolume && mesh.name < (containedName ?? ""))) {
192
+ containedVolume = volume;
193
+ containedName = mesh.name;
194
+ }
195
+ continue;
196
+ }
197
+ // Only worth measuring while nothing contains the point.
198
+ if (containedName != null)
199
+ continue;
200
+ const distanceSq = centreDistanceSq(mesh.aabb, point, axes);
201
+ if (distanceSq > thresholdSq)
202
+ continue;
203
+ if (distanceSq < nearestDistanceSq ||
204
+ (distanceSq === nearestDistanceSq && mesh.name < (nearestName ?? ""))) {
205
+ nearestDistanceSq = distanceSq;
206
+ nearestName = mesh.name;
207
+ }
208
+ }
209
+ const nearestMesh = containedName ?? nearestName;
210
+ return {
211
+ region: smallestId,
212
+ regions: containing,
213
+ nearestMesh,
214
+ distance: nearestMesh == null ? null : containedName != null ? 0 : Math.sqrt(nearestDistanceSq),
215
+ };
216
+ }
217
+ /**
218
+ * Attach `region` / `regions` / `nearestMesh` / `distance` to each cluster, and
219
+ * upgrade the `drill.region` hint from an ad-hoc world box to the **region id**
220
+ * when a registered region contains the hotspot — the id is the shared name both
221
+ * a human and `?region=<id>` understand, so it is strictly the better hint.
222
+ *
223
+ * Returns the clusters untouched (and `labelled: false`) when the grid is not
224
+ * world-space or no cell size is known: a viewport-bin or angular grid has no
225
+ * world point to label, and saying so is the honest answer.
226
+ */
227
+ export function labelClusters(clusters, options) {
228
+ const { axes, cellSize, scene } = options;
229
+ const axisMap = worldAxisMap(axes);
230
+ const regions = scene.regions ?? [];
231
+ const meshes = scene.meshes ?? [];
232
+ if (axisMap == null || !(cellSize > 0) || !Number.isFinite(cellSize)) {
233
+ return { clusters: [...clusters], caveats: [], labelled: false };
234
+ }
235
+ const caveats = [];
236
+ if (meshes.length === 0) {
237
+ caveats.push(`No proxy registered for scene ${scene.id == null ? "(unnamed)" : `\`${scene.id}\``} — ` +
238
+ "`nearestMesh` and `distance` are unavailable. Register one with the SDK's " +
239
+ "`scanSceneProxy` so hotspots can name the geometry they sit on.");
240
+ }
241
+ if (regions.length === 0) {
242
+ caveats.push(`No regions defined for scene ${scene.id == null ? "(unnamed)" : `\`${scene.id}\``} — ` +
243
+ "`region` is null. Declare named boxes with `registerRegions` to give spatial answers a " +
244
+ "vocabulary.");
245
+ }
246
+ const threshold = cellSize * 2;
247
+ const labelledClusters = clusters.map((cluster) => {
248
+ // A cluster's centroid is a weighted mean of cell *indices*; the world point
249
+ // is the centre of that fractional cell (ADR 0040 §1).
250
+ const point = cluster.centroid.map((index) => (index + 0.5) * cellSize);
251
+ const label = labelPoint(point, scene, axisMap, threshold);
252
+ const drill = label.region != null ? { ...cluster.drill, region: label.region } : cluster.drill;
253
+ return {
254
+ ...cluster,
255
+ ...(drill != null ? { drill } : {}),
256
+ ...label,
257
+ };
258
+ });
259
+ return { clusters: labelledClusters, caveats, labelled: true };
260
+ }
261
+ //# sourceMappingURL=labels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.js","sourceRoot":"","sources":["../../../src/query/summary/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C;;;;;;;;GAQG;AACH,MAAM,UAAU,GAAwC;IACtD,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACN,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAuB;IAClD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,4DAA4D;IAC5D,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CA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d.ts","sourceRoot":"","sources":["../../../src/query/summary/reading.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAU1D,OAAO,KAAK,EAIV,aAAa,EAGd,MAAM,YAAY,CAAC;AA+JpB;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,aAAa,IAAI,CAAC,SAAS,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC;AAE9F,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAWnF"}
1
+ {"version":3,"file":"reading.d.ts","sourceRoot":"","sources":["../../../src/query/summary/reading.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAU1D,OAAO,KAAK,EAIV,aAAa,EAId,MAAM,YAAY,CAAC;AAkLpB;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,aAAa,IAAI,CAAC,SAAS,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC;AAE9F,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAWnF"}
@@ -93,6 +93,25 @@ function seriesReading(metric, summary) {
93
93
  `${formatQuantity(series.max, unit)} at ${formatLabel(series.maxLabel)}.` +
94
94
  sampleSentence(summary.sampleSize));
95
95
  }
96
+ /**
97
+ * Where a hotspot is **in the scene's own words** (ADR 0051 §2, sketch §B.2):
98
+ * "near `checkout_button` in region `counter` ". Returns `""` when the scene
99
+ * registered nothing that could name it, so the sentence falls back to the grid
100
+ * coordinate it has always reported. The trailing space is deliberate — the
101
+ * caller concatenates it straight onto "centred at", and an unlabelled cluster
102
+ * must produce byte-identical text to before.
103
+ */
104
+ function placeOf(cluster) {
105
+ const parts = [];
106
+ if (cluster.nearestMesh != null) {
107
+ // `distance === 0` means the mesh box contains the centroid — "on" rather
108
+ // than "near", because the hotspot is literally there.
109
+ parts.push(`${cluster.distance === 0 ? "on" : "near"} \`${cluster.nearestMesh}\``);
110
+ }
111
+ if (cluster.region != null)
112
+ parts.push(`in region \`${cluster.region}\``);
113
+ return parts.length === 0 ? "" : `${parts.join(" ")}, `;
114
+ }
96
115
  function clusterReading(metric, summary) {
97
116
  const cellNoun = grainNoun(metric.grain, summary.occupiedCells);
98
117
  if (summary.occupiedCells === 0)
@@ -111,8 +130,8 @@ function clusterReading(metric, summary) {
111
130
  let text = `${metric.title}: ${formatNumber(summary.clusters.length)} ` +
112
131
  `hotspot${summary.clusters.length === 1 ? "" : "s"} over ` +
113
132
  `${formatNumber(summary.occupiedCells)} occupied ${cellNoun}. The densest spans ` +
114
- `${extent} ${cellNoun} centred at (${centroid}) on ${summary.axes.join("/")}, holding ` +
115
- `${formatQuantity(densest.weight, weightUnit)}`;
133
+ `${extent} ${cellNoun} ${placeOf(densest)}centred at (${centroid}) on ` +
134
+ `${summary.axes.join("/")}, holding ${formatQuantity(densest.weight, weightUnit)}`;
116
135
  text += densest.share == null ? "." : ` (${formatShare(densest.share)}).`;
117
136
  // Only name the part of `rest` that actually exists — "0 further clusters" is
118
137
  // noise in a sentence meant to be read at a glance.
@@ -1 +1 @@
1
- {"version":3,"file":"reading.js","sourceRoot":"","sources":["../../../src/query/summary/reading.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,cAAc,GACf,MAAM,aAAa,CAAC;AAUrB,iFAAiF;AACjF,SAAS,cAAc,CAAC,MAAkB;IACx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U,UAAU,CAAC,MAAwB,EAAE,OAAsB;IACzE,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5D,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5D,KAAK,UAAU;YACb,OAAO,cAAc,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7D,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC"}
@@ -1,30 +1,24 @@
1
1
  /**
2
- * Zod mirrors of the three result envelopes.
2
+ * Zod mirrors of the three result envelopes — **re-exported**, not redefined.
3
3
  *
4
4
  * The collector attaches each route's 200 response schema from the registry so
5
5
  * the Zod type provider **serialises through it** — which means the `table` and
6
6
  * `summary` envelopes need schemas too, or a formatted response would be
7
- * stripped down to nothing on its way out. `resultEnvelopeSchema(row)` builds
8
- * the union a formatted route responds with: the untouched `full` shape first,
9
- * so a default request is validated by exactly the schema it has always been
10
- * validated by, then the two envelopes.
7
+ * stripped down to nothing on its way out. `resultEnvelopeSchema(full, row)`
8
+ * builds the union a formatted route responds with: the untouched `full` shape
9
+ * first, so a default request is validated by exactly the schema it has always
10
+ * been validated by, then the two envelopes.
11
11
  *
12
- * These live next to the types rather than in the collector so the shapes have
13
- * one definition the same reason the row schemas live in the registry.
12
+ * The definitions themselves now live in `@uptimizr/metrics`, next to the row
13
+ * schemas they wrap (#350): `@uptimizr/agent-core` and `@uptimizr/mcp` need the
14
+ * same shapes to describe a tool's result, and neither may depend on this
15
+ * package — it carries the DuckDB driver. This module keeps the names and the
16
+ * signatures `@uptimizr/db` has always exported, so nothing downstream changes.
14
17
  */
15
18
  import { z } from "zod";
19
+ import { resultFormatSchema } from "@uptimizr/metrics";
16
20
  import type { ResultFormat } from "./types.js";
17
- /**
18
- * `format=full | table | summary`, the shared querystring value every
19
- * registry-served aggregate endpoint accepts. Spelled out literally rather than
20
- * built from `RESULT_FORMATS` so the inferred type is the `ResultFormat` union
21
- * and a route handler keeps its narrowing.
22
- */
23
- export declare const resultFormatSchema: z.ZodEnum<{
24
- table: "table";
25
- full: "full";
26
- summary: "summary";
27
- }>;
21
+ export { resultFormatSchema };
28
22
  /** Fails to compile if the schema and {@link ResultFormat} ever drift apart. */
29
23
  type AssertFormatsAgree = [
30
24
  z.infer<typeof resultFormatSchema> extends ResultFormat ? true : never,
@@ -43,6 +37,7 @@ export declare const resultSummarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
43
37
  high: z.ZodNumber;
44
38
  }, z.core.$strip>>;
45
39
  drill: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
40
+ drillQuery: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
46
41
  }, z.core.$strip>>;
47
42
  rest: z.ZodObject<{
48
43
  rows: z.ZodNumber;
@@ -88,9 +83,9 @@ export declare const resultSummarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
83
  minLabel: z.ZodNullable<z.ZodString>;
89
84
  maxLabel: z.ZodNullable<z.ZodString>;
90
85
  trend: z.ZodEnum<{
91
- flat: "flat";
92
86
  up: "up";
93
87
  down: "down";
88
+ flat: "flat";
94
89
  }>;
95
90
  slope: z.ZodNullable<z.ZodNumber>;
96
91
  }, z.core.$strip>;
@@ -134,6 +129,10 @@ export declare const resultSummarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
134
129
  weight: z.ZodNumber;
135
130
  share: z.ZodNullable<z.ZodNumber>;
136
131
  drill: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
132
+ region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
+ regions: z.ZodOptional<z.ZodArray<z.ZodString>>;
134
+ nearestMesh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ distance: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
137
136
  }, z.core.$strip>>;
138
137
  rest: z.ZodObject<{
139
138
  clusters: z.ZodNumber;
@@ -211,7 +210,238 @@ export declare function tableResultSchema(row: z.ZodType): z.ZodObject;
211
210
  * The envelopes are unambiguous against it — `table` is an object with `meta`
212
211
  * and `rows`, `summary` an object with `kind` and `reading`, and neither can
213
212
  * satisfy a row array or a stats row's required numeric columns.
213
+ *
214
+ * A route's own `full` schema is passed explicitly because a single-record
215
+ * endpoint (the spatial `stats` routes) answers with a bare object rather than
216
+ * an array of rows.
214
217
  */
215
218
  export declare function resultEnvelopeSchema(full: z.ZodType, row: z.ZodType): z.ZodType;
216
- export {};
219
+ /** `format=full | table` on a `compare` query: the envelope plus joined rows. */
220
+ export declare const comparisonResultSchema: z.ZodObject<{
221
+ meta: z.ZodObject<{
222
+ metric: z.ZodEnum<{
223
+ [x: string]: string;
224
+ }>;
225
+ basis: z.ZodEnum<{
226
+ range: "range";
227
+ segment: "segment";
228
+ }>;
229
+ keys: z.ZodArray<z.ZodString>;
230
+ measure: z.ZodNullable<z.ZodObject<{
231
+ column: z.ZodString;
232
+ unit: z.ZodNullable<z.ZodString>;
233
+ additive: z.ZodBoolean;
234
+ }, z.core.$strip>>;
235
+ current: z.ZodObject<{
236
+ range: z.ZodObject<{
237
+ since: z.ZodNullable<z.ZodNumber>;
238
+ until: z.ZodNullable<z.ZodNumber>;
239
+ }, z.core.$strip>;
240
+ segment: z.ZodRecord<z.ZodString, z.ZodUnknown>;
241
+ rows: z.ZodNumber;
242
+ total: z.ZodNullable<z.ZodNumber>;
243
+ sampleSize: z.ZodObject<{
244
+ sessions: z.ZodNullable<z.ZodNumber>;
245
+ events: z.ZodNullable<z.ZodNumber>;
246
+ }, z.core.$strip>;
247
+ }, z.core.$strip>;
248
+ previous: z.ZodObject<{
249
+ range: z.ZodObject<{
250
+ since: z.ZodNullable<z.ZodNumber>;
251
+ until: z.ZodNullable<z.ZodNumber>;
252
+ }, z.core.$strip>;
253
+ segment: z.ZodRecord<z.ZodString, z.ZodUnknown>;
254
+ rows: z.ZodNumber;
255
+ total: z.ZodNullable<z.ZodNumber>;
256
+ sampleSize: z.ZodObject<{
257
+ sessions: z.ZodNullable<z.ZodNumber>;
258
+ events: z.ZodNullable<z.ZodNumber>;
259
+ }, z.core.$strip>;
260
+ }, z.core.$strip>;
261
+ rows: z.ZodNumber;
262
+ truncated: z.ZodBoolean;
263
+ overall: z.ZodOptional<z.ZodObject<{
264
+ test: z.ZodLiteral<"welch-t">;
265
+ current: z.ZodNumber;
266
+ previous: z.ZodNumber;
267
+ diff: z.ZodNumber;
268
+ t: z.ZodNumber;
269
+ df: z.ZodNumber;
270
+ pValue: z.ZodNumber;
271
+ significant: z.ZodBoolean;
272
+ currentSamples: z.ZodNumber;
273
+ previousSamples: z.ZodNumber;
274
+ }, z.core.$strip>>;
275
+ caveats: z.ZodArray<z.ZodString>;
276
+ }, z.core.$strip>;
277
+ rows: z.ZodArray<z.ZodObject<{
278
+ key: z.ZodRecord<z.ZodString, z.ZodString>;
279
+ label: z.ZodString;
280
+ current: z.ZodNullable<z.ZodNumber>;
281
+ previous: z.ZodNullable<z.ZodNumber>;
282
+ delta: z.ZodNullable<z.ZodNumber>;
283
+ deltaPct: z.ZodNullable<z.ZodNumber>;
284
+ significance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
285
+ test: z.ZodLiteral<"two-proportion-z">;
286
+ current: z.ZodNumber;
287
+ previous: z.ZodNumber;
288
+ diff: z.ZodNumber;
289
+ z: z.ZodNumber;
290
+ pValue: z.ZodNumber;
291
+ significant: z.ZodBoolean;
292
+ currentInterval: z.ZodObject<{
293
+ low: z.ZodNumber;
294
+ high: z.ZodNumber;
295
+ }, z.core.$strip>;
296
+ previousInterval: z.ZodObject<{
297
+ low: z.ZodNumber;
298
+ high: z.ZodNumber;
299
+ }, z.core.$strip>;
300
+ }, z.core.$strip>, z.ZodObject<{
301
+ test: z.ZodLiteral<"welch-t">;
302
+ current: z.ZodNumber;
303
+ previous: z.ZodNumber;
304
+ diff: z.ZodNumber;
305
+ t: z.ZodNumber;
306
+ df: z.ZodNumber;
307
+ pValue: z.ZodNumber;
308
+ significant: z.ZodBoolean;
309
+ currentSamples: z.ZodNumber;
310
+ previousSamples: z.ZodNumber;
311
+ }, z.core.$strip>], "test">>;
312
+ }, z.core.$strip>>;
313
+ }, z.core.$strip>;
314
+ /** `format=summary` on a `compare` query: the biggest movers, with a reading. */
315
+ export declare const moversSummarySchema: z.ZodObject<{
316
+ kind: z.ZodLiteral<"movers">;
317
+ metric: z.ZodEnum<{
318
+ [x: string]: string;
319
+ }>;
320
+ basis: z.ZodEnum<{
321
+ range: "range";
322
+ segment: "segment";
323
+ }>;
324
+ measure: z.ZodNullable<z.ZodObject<{
325
+ column: z.ZodString;
326
+ unit: z.ZodNullable<z.ZodString>;
327
+ additive: z.ZodBoolean;
328
+ }, z.core.$strip>>;
329
+ current: z.ZodObject<{
330
+ range: z.ZodObject<{
331
+ since: z.ZodNullable<z.ZodNumber>;
332
+ until: z.ZodNullable<z.ZodNumber>;
333
+ }, z.core.$strip>;
334
+ segment: z.ZodRecord<z.ZodString, z.ZodUnknown>;
335
+ rows: z.ZodNumber;
336
+ total: z.ZodNullable<z.ZodNumber>;
337
+ sampleSize: z.ZodObject<{
338
+ sessions: z.ZodNullable<z.ZodNumber>;
339
+ events: z.ZodNullable<z.ZodNumber>;
340
+ }, z.core.$strip>;
341
+ }, z.core.$strip>;
342
+ previous: z.ZodObject<{
343
+ range: z.ZodObject<{
344
+ since: z.ZodNullable<z.ZodNumber>;
345
+ until: z.ZodNullable<z.ZodNumber>;
346
+ }, z.core.$strip>;
347
+ segment: z.ZodRecord<z.ZodString, z.ZodUnknown>;
348
+ rows: z.ZodNumber;
349
+ total: z.ZodNullable<z.ZodNumber>;
350
+ sampleSize: z.ZodObject<{
351
+ sessions: z.ZodNullable<z.ZodNumber>;
352
+ events: z.ZodNullable<z.ZodNumber>;
353
+ }, z.core.$strip>;
354
+ }, z.core.$strip>;
355
+ top: z.ZodArray<z.ZodObject<{
356
+ key: z.ZodRecord<z.ZodString, z.ZodString>;
357
+ label: z.ZodString;
358
+ current: z.ZodNullable<z.ZodNumber>;
359
+ previous: z.ZodNullable<z.ZodNumber>;
360
+ delta: z.ZodNullable<z.ZodNumber>;
361
+ deltaPct: z.ZodNullable<z.ZodNumber>;
362
+ significance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
363
+ test: z.ZodLiteral<"two-proportion-z">;
364
+ current: z.ZodNumber;
365
+ previous: z.ZodNumber;
366
+ diff: z.ZodNumber;
367
+ z: z.ZodNumber;
368
+ pValue: z.ZodNumber;
369
+ significant: z.ZodBoolean;
370
+ currentInterval: z.ZodObject<{
371
+ low: z.ZodNumber;
372
+ high: z.ZodNumber;
373
+ }, z.core.$strip>;
374
+ previousInterval: z.ZodObject<{
375
+ low: z.ZodNumber;
376
+ high: z.ZodNumber;
377
+ }, z.core.$strip>;
378
+ }, z.core.$strip>, z.ZodObject<{
379
+ test: z.ZodLiteral<"welch-t">;
380
+ current: z.ZodNumber;
381
+ previous: z.ZodNumber;
382
+ diff: z.ZodNumber;
383
+ t: z.ZodNumber;
384
+ df: z.ZodNumber;
385
+ pValue: z.ZodNumber;
386
+ significant: z.ZodBoolean;
387
+ currentSamples: z.ZodNumber;
388
+ previousSamples: z.ZodNumber;
389
+ }, z.core.$strip>], "test">>;
390
+ }, z.core.$strip>>;
391
+ rest: z.ZodObject<{
392
+ rows: z.ZodNumber;
393
+ delta: z.ZodNullable<z.ZodNumber>;
394
+ }, z.core.$strip>;
395
+ overall: z.ZodOptional<z.ZodObject<{
396
+ test: z.ZodLiteral<"welch-t">;
397
+ current: z.ZodNumber;
398
+ previous: z.ZodNumber;
399
+ diff: z.ZodNumber;
400
+ t: z.ZodNumber;
401
+ df: z.ZodNumber;
402
+ pValue: z.ZodNumber;
403
+ significant: z.ZodBoolean;
404
+ currentSamples: z.ZodNumber;
405
+ previousSamples: z.ZodNumber;
406
+ }, z.core.$strip>>;
407
+ reading: z.ZodString;
408
+ caveats: z.ZodArray<z.ZodString>;
409
+ }, z.core.$strip>;
410
+ /**
411
+ * `explain: true`: the plan instead of the rows.
412
+ *
413
+ * `params` carries names and logical types only — never values. That is not a
414
+ * redaction step applied afterwards; the DSL binds every caller-supplied value,
415
+ * so there is nothing in `sql` to redact and nothing in `params` worth echoing.
416
+ */
417
+ export declare const queryPlanSchema: z.ZodObject<{
418
+ metric: z.ZodEnum<{
419
+ [x: string]: string;
420
+ }>;
421
+ tier: z.ZodEnum<{
422
+ delegated: "delegated";
423
+ generic: "generic";
424
+ }>;
425
+ dialect: z.ZodString;
426
+ sql: z.ZodString;
427
+ params: z.ZodArray<z.ZodObject<{
428
+ name: z.ZodString;
429
+ type: z.ZodString;
430
+ }, z.core.$strip>>;
431
+ rowsScanned: z.ZodNullable<z.ZodNumber>;
432
+ sampleSize: z.ZodObject<{
433
+ sessions: z.ZodNullable<z.ZodNumber>;
434
+ events: z.ZodNullable<z.ZodNumber>;
435
+ }, z.core.$strip>;
436
+ warnings: z.ZodArray<z.ZodString>;
437
+ }, z.core.$strip>;
438
+ /**
439
+ * The 200 response schema of the query DSL endpoint: everything
440
+ * {@link resultEnvelopeSchema} answers with, plus the three envelopes only the
441
+ * DSL can produce — a comparison, a movers digest and a plan.
442
+ *
443
+ * Order matters for the same reason it does there: the plain-rows shape is
444
+ * matched first so a `format=full` response cannot be reshaped on its way out.
445
+ */
446
+ export declare function queryEnvelopeSchema(full: z.ZodType, row: z.ZodType): z.ZodType;
217
447
  //# sourceMappingURL=schema.d.ts.map