@spotto/contract 1.0.70-alpha.9 → 1.0.70-y.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 (285) hide show
  1. package/README.md +33 -33
  2. package/dist/actions/[id]/index.d.ts +1 -0
  3. package/dist/actions/[id]/index.js +18 -0
  4. package/dist/actions/[id]/index.js.map +1 -0
  5. package/dist/actions/[id]/patch/index.d.ts +2 -0
  6. package/dist/actions/[id]/patch/index.js +19 -0
  7. package/dist/actions/[id]/patch/index.js.map +1 -0
  8. package/dist/actions/[id]/patch/request.d.ts +16 -0
  9. package/dist/actions/[id]/patch/request.js +3 -0
  10. package/dist/actions/[id]/patch/request.js.map +1 -0
  11. package/dist/actions/[id]/patch/response.d.ts +1 -0
  12. package/dist/actions/[id]/patch/response.js +3 -0
  13. package/dist/actions/[id]/patch/response.js.map +1 -0
  14. package/dist/actions/get/index.d.ts +2 -0
  15. package/dist/actions/get/index.js +19 -0
  16. package/dist/actions/get/index.js.map +1 -0
  17. package/dist/actions/get/query.d.ts +14 -0
  18. package/dist/actions/get/query.js +3 -0
  19. package/dist/actions/get/query.js.map +1 -0
  20. package/dist/actions/get/response.d.ts +29 -0
  21. package/dist/actions/get/response.js +3 -0
  22. package/dist/actions/get/response.js.map +1 -0
  23. package/dist/actions/index.d.ts +4 -0
  24. package/dist/actions/index.js +21 -0
  25. package/dist/actions/index.js.map +1 -0
  26. package/dist/actions/post/index.d.ts +2 -0
  27. package/dist/actions/post/index.js +19 -0
  28. package/dist/actions/post/index.js.map +1 -0
  29. package/dist/actions/post/request.d.ts +15 -0
  30. package/dist/actions/post/request.js +3 -0
  31. package/dist/actions/post/request.js.map +1 -0
  32. package/dist/actions/post/response.d.ts +1 -0
  33. package/dist/actions/post/response.js +3 -0
  34. package/dist/actions/post/response.js.map +1 -0
  35. package/dist/actions/shared.d.ts +51 -0
  36. package/dist/actions/shared.js +13 -0
  37. package/dist/actions/shared.js.map +1 -0
  38. package/dist/ai/chat/index.d.ts +2 -0
  39. package/dist/ai/chat/index.js +19 -0
  40. package/dist/ai/chat/index.js.map +1 -0
  41. package/dist/ai/chat/request.d.ts +42 -0
  42. package/dist/ai/chat/request.js +3 -0
  43. package/dist/ai/chat/request.js.map +1 -0
  44. package/dist/ai/chat/response.d.ts +74 -0
  45. package/dist/ai/chat/response.js +11 -0
  46. package/dist/ai/chat/response.js.map +1 -0
  47. package/dist/ai/expression/request.d.ts +3 -1
  48. package/dist/ai/index.d.ts +3 -0
  49. package/dist/ai/index.js +3 -0
  50. package/dist/ai/index.js.map +1 -1
  51. package/dist/ai/semantic-query/index.d.ts +2 -0
  52. package/dist/ai/semantic-query/index.js +19 -0
  53. package/dist/ai/semantic-query/index.js.map +1 -0
  54. package/dist/ai/semantic-query/request.d.ts +43 -0
  55. package/dist/ai/semantic-query/request.js +3 -0
  56. package/dist/ai/semantic-query/request.js.map +1 -0
  57. package/dist/ai/semantic-query/response.d.ts +40 -0
  58. package/dist/ai/semantic-query/response.js +3 -0
  59. package/dist/ai/semantic-query/response.js.map +1 -0
  60. package/dist/ai/shared.d.ts +22 -0
  61. package/dist/ai/shared.js +11 -0
  62. package/dist/ai/shared.js.map +1 -0
  63. package/dist/assets/[id]/get.d.ts +2 -1
  64. package/dist/assets/count/query.d.ts +16 -1
  65. package/dist/assets/download/query.d.ts +7 -0
  66. package/dist/assets/get/query.d.ts +11 -0
  67. package/dist/assets/location/request.d.ts +10 -1
  68. package/dist/events/constants.d.ts +16 -1
  69. package/dist/events/constants.js +21 -1
  70. package/dist/events/constants.js.map +1 -1
  71. package/dist/events/get/query.d.ts +25 -0
  72. package/dist/events/get/response.d.ts +17 -1
  73. package/dist/fields/[id]/get.d.ts +3 -0
  74. package/dist/fields/[id]/patch/request.d.ts +4 -0
  75. package/dist/forms/[id]/index.d.ts +1 -0
  76. package/dist/forms/[id]/index.js +18 -0
  77. package/dist/forms/[id]/index.js.map +1 -0
  78. package/dist/forms/[id]/patch/index.d.ts +2 -0
  79. package/dist/forms/[id]/patch/index.js +19 -0
  80. package/dist/forms/[id]/patch/index.js.map +1 -0
  81. package/dist/forms/[id]/patch/request.d.ts +14 -0
  82. package/dist/forms/[id]/patch/request.js +3 -0
  83. package/dist/forms/[id]/patch/request.js.map +1 -0
  84. package/dist/forms/[id]/patch/response.d.ts +1 -0
  85. package/dist/forms/[id]/patch/response.js +3 -0
  86. package/dist/forms/[id]/patch/response.js.map +1 -0
  87. package/dist/forms/constants.d.ts +19 -0
  88. package/dist/forms/constants.js +33 -0
  89. package/dist/forms/constants.js.map +1 -0
  90. package/dist/forms/get/index.d.ts +2 -0
  91. package/dist/forms/get/index.js +19 -0
  92. package/dist/forms/get/index.js.map +1 -0
  93. package/dist/forms/get/query.d.ts +18 -0
  94. package/dist/forms/get/query.js +3 -0
  95. package/dist/forms/get/query.js.map +1 -0
  96. package/dist/forms/get/response.d.ts +23 -0
  97. package/dist/forms/get/response.js +3 -0
  98. package/dist/forms/get/response.js.map +1 -0
  99. package/dist/forms/index.d.ts +6 -0
  100. package/dist/forms/index.js +23 -0
  101. package/dist/forms/index.js.map +1 -0
  102. package/dist/forms/post/index.d.ts +2 -0
  103. package/dist/forms/post/index.js +19 -0
  104. package/dist/forms/post/index.js.map +1 -0
  105. package/dist/forms/post/request.d.ts +9 -0
  106. package/dist/forms/post/request.js +3 -0
  107. package/dist/forms/post/request.js.map +1 -0
  108. package/dist/forms/post/response.d.ts +1 -0
  109. package/dist/forms/post/response.js +3 -0
  110. package/dist/forms/post/response.js.map +1 -0
  111. package/dist/forms/shared.d.ts +127 -0
  112. package/dist/forms/shared.js +3 -0
  113. package/dist/forms/shared.js.map +1 -0
  114. package/dist/forms/versions/index.d.ts +2 -0
  115. package/dist/forms/versions/index.js +19 -0
  116. package/dist/forms/versions/index.js.map +1 -0
  117. package/dist/forms/versions/path.d.ts +8 -0
  118. package/dist/forms/versions/path.js +3 -0
  119. package/dist/forms/versions/path.js.map +1 -0
  120. package/dist/forms/versions/response.d.ts +1 -0
  121. package/dist/forms/versions/response.js +3 -0
  122. package/dist/forms/versions/response.js.map +1 -0
  123. package/dist/index.d.ts +5 -0
  124. package/dist/index.js +5 -0
  125. package/dist/index.js.map +1 -1
  126. package/dist/locations/get/query.d.ts +14 -0
  127. package/dist/organisations/constants.d.ts +11 -0
  128. package/dist/organisations/sso/constants.d.ts +15 -0
  129. package/dist/organisations/sso/constants.js +16 -1
  130. package/dist/organisations/sso/constants.js.map +1 -1
  131. package/dist/organisations/sso/types.d.ts +48 -0
  132. package/dist/readers/get/query.d.ts +12 -0
  133. package/dist/semantic-queries/[id]/index.d.ts +1 -0
  134. package/dist/semantic-queries/[id]/index.js +18 -0
  135. package/dist/semantic-queries/[id]/index.js.map +1 -0
  136. package/dist/semantic-queries/[id]/patch/index.d.ts +2 -0
  137. package/dist/semantic-queries/[id]/patch/index.js +19 -0
  138. package/dist/semantic-queries/[id]/patch/index.js.map +1 -0
  139. package/dist/semantic-queries/[id]/patch/request.d.ts +20 -0
  140. package/dist/semantic-queries/[id]/patch/request.js +3 -0
  141. package/dist/semantic-queries/[id]/patch/request.js.map +1 -0
  142. package/dist/semantic-queries/[id]/patch/response.d.ts +1 -0
  143. package/dist/semantic-queries/[id]/patch/response.js +3 -0
  144. package/dist/semantic-queries/[id]/patch/response.js.map +1 -0
  145. package/dist/semantic-queries/get/index.d.ts +2 -0
  146. package/dist/semantic-queries/get/index.js +19 -0
  147. package/dist/semantic-queries/get/index.js.map +1 -0
  148. package/dist/semantic-queries/get/query.d.ts +18 -0
  149. package/dist/semantic-queries/get/query.js +3 -0
  150. package/dist/semantic-queries/get/query.js.map +1 -0
  151. package/dist/semantic-queries/get/response.d.ts +40 -0
  152. package/dist/semantic-queries/get/response.js +3 -0
  153. package/dist/semantic-queries/get/response.js.map +1 -0
  154. package/dist/semantic-queries/index.d.ts +4 -0
  155. package/dist/semantic-queries/index.js +21 -0
  156. package/dist/semantic-queries/index.js.map +1 -0
  157. package/dist/semantic-queries/post/index.d.ts +2 -0
  158. package/dist/semantic-queries/post/index.js +19 -0
  159. package/dist/semantic-queries/post/index.js.map +1 -0
  160. package/dist/semantic-queries/post/request.d.ts +56 -0
  161. package/dist/semantic-queries/post/request.js +3 -0
  162. package/dist/semantic-queries/post/request.js.map +1 -0
  163. package/dist/semantic-queries/post/response.d.ts +1 -0
  164. package/dist/semantic-queries/post/response.js +3 -0
  165. package/dist/semantic-queries/post/response.js.map +1 -0
  166. package/dist/semantic-queries/shared.d.ts +853 -0
  167. package/dist/semantic-queries/shared.js +318 -0
  168. package/dist/semantic-queries/shared.js.map +1 -0
  169. package/dist/shared/attachments.d.ts +29 -0
  170. package/dist/shared/attachments.js +11 -0
  171. package/dist/shared/attachments.js.map +1 -0
  172. package/dist/shared/embed.d.ts +14 -0
  173. package/dist/shared/index.d.ts +1 -0
  174. package/dist/shared/index.js +1 -0
  175. package/dist/shared/index.js.map +1 -1
  176. package/dist/shared/readiness.d.ts +23 -0
  177. package/dist/snapshots/[id]/get.d.ts +139 -11
  178. package/dist/snapshots/[id]/get.js.map +1 -1
  179. package/dist/snapshots/get/query.d.ts +39 -0
  180. package/dist/snapshots/get/query.js +23 -1
  181. package/dist/snapshots/get/query.js.map +1 -1
  182. package/dist/snapshots/post/request.d.ts +21 -0
  183. package/dist/snapshots/post/request.js.map +1 -1
  184. package/dist/sso/onboard/request.d.ts +12 -1
  185. package/dist/sso/sso-mappings/request.d.ts +10 -5
  186. package/dist/submissions/[id]/index.d.ts +1 -0
  187. package/dist/submissions/[id]/index.js +18 -0
  188. package/dist/submissions/[id]/index.js.map +1 -0
  189. package/dist/submissions/[id]/void/post.d.ts +6 -0
  190. package/dist/submissions/[id]/void/post.js +3 -0
  191. package/dist/submissions/[id]/void/post.js.map +1 -0
  192. package/dist/submissions/constants.d.ts +14 -0
  193. package/dist/submissions/constants.js +21 -0
  194. package/dist/submissions/constants.js.map +1 -0
  195. package/dist/submissions/get/index.d.ts +2 -0
  196. package/dist/submissions/get/index.js +19 -0
  197. package/dist/submissions/get/index.js.map +1 -0
  198. package/dist/submissions/get/query.d.ts +14 -0
  199. package/dist/submissions/get/query.js +3 -0
  200. package/dist/submissions/get/query.js.map +1 -0
  201. package/dist/submissions/get/response.d.ts +6 -0
  202. package/dist/submissions/get/response.js +3 -0
  203. package/dist/submissions/get/response.js.map +1 -0
  204. package/dist/submissions/index.d.ts +6 -0
  205. package/dist/submissions/index.js +23 -0
  206. package/dist/submissions/index.js.map +1 -0
  207. package/dist/submissions/post/index.d.ts +2 -0
  208. package/dist/submissions/post/index.js +19 -0
  209. package/dist/submissions/post/index.js.map +1 -0
  210. package/dist/submissions/post/request.d.ts +17 -0
  211. package/dist/submissions/post/request.js +3 -0
  212. package/dist/submissions/post/request.js.map +1 -0
  213. package/dist/submissions/post/response.d.ts +22 -0
  214. package/dist/submissions/post/response.js +3 -0
  215. package/dist/submissions/post/response.js.map +1 -0
  216. package/dist/submissions/shared.d.ts +133 -0
  217. package/dist/submissions/shared.js +3 -0
  218. package/dist/submissions/shared.js.map +1 -0
  219. package/dist/submissions/uploads/[fileId]/get.d.ts +11 -0
  220. package/dist/submissions/uploads/[fileId]/get.js +3 -0
  221. package/dist/submissions/uploads/[fileId]/get.js.map +1 -0
  222. package/dist/submissions/uploads/[fileId]/index.d.ts +1 -0
  223. package/dist/submissions/uploads/[fileId]/index.js +18 -0
  224. package/dist/submissions/uploads/[fileId]/index.js.map +1 -0
  225. package/dist/submissions/uploads/index.d.ts +2 -0
  226. package/dist/submissions/uploads/index.js +19 -0
  227. package/dist/submissions/uploads/index.js.map +1 -0
  228. package/dist/submissions/uploads/post/index.d.ts +2 -0
  229. package/dist/submissions/uploads/post/index.js +19 -0
  230. package/dist/submissions/uploads/post/index.js.map +1 -0
  231. package/dist/submissions/uploads/post/request.d.ts +9 -0
  232. package/dist/submissions/uploads/post/request.js +3 -0
  233. package/dist/submissions/uploads/post/request.js.map +1 -0
  234. package/dist/submissions/uploads/post/response.d.ts +18 -0
  235. package/dist/submissions/uploads/post/response.js +3 -0
  236. package/dist/submissions/uploads/post/response.js.map +1 -0
  237. package/dist/types/[id]/get.d.ts +3 -1
  238. package/dist/types/[id]/patch/request.d.ts +4 -1
  239. package/dist/types/post/request.d.ts +2 -1
  240. package/dist/types/post/request.js.map +1 -1
  241. package/dist/usergroups/[id]/index.d.ts +1 -0
  242. package/dist/usergroups/[id]/index.js +18 -0
  243. package/dist/usergroups/[id]/index.js.map +1 -0
  244. package/dist/usergroups/[id]/patch/index.d.ts +2 -0
  245. package/dist/usergroups/[id]/patch/index.js +19 -0
  246. package/dist/usergroups/[id]/patch/index.js.map +1 -0
  247. package/dist/usergroups/[id]/patch/request.d.ts +12 -0
  248. package/dist/usergroups/[id]/patch/request.js +3 -0
  249. package/dist/usergroups/[id]/patch/request.js.map +1 -0
  250. package/dist/usergroups/[id]/patch/response.d.ts +1 -0
  251. package/dist/usergroups/[id]/patch/response.js +3 -0
  252. package/dist/usergroups/[id]/patch/response.js.map +1 -0
  253. package/dist/usergroups/get/index.d.ts +2 -0
  254. package/dist/usergroups/get/index.js +19 -0
  255. package/dist/usergroups/get/index.js.map +1 -0
  256. package/dist/usergroups/get/query.d.ts +12 -0
  257. package/dist/usergroups/get/query.js +3 -0
  258. package/dist/usergroups/get/query.js.map +1 -0
  259. package/dist/usergroups/get/response.d.ts +35 -0
  260. package/dist/usergroups/get/response.js +3 -0
  261. package/dist/usergroups/get/response.js.map +1 -0
  262. package/dist/usergroups/index.d.ts +4 -0
  263. package/dist/usergroups/index.js +21 -0
  264. package/dist/usergroups/index.js.map +1 -0
  265. package/dist/usergroups/post/index.d.ts +2 -0
  266. package/dist/usergroups/post/index.js +19 -0
  267. package/dist/usergroups/post/index.js.map +1 -0
  268. package/dist/usergroups/post/request.d.ts +11 -0
  269. package/dist/usergroups/post/request.js +3 -0
  270. package/dist/usergroups/post/request.js.map +1 -0
  271. package/dist/usergroups/post/response.d.ts +1 -0
  272. package/dist/usergroups/post/response.js +3 -0
  273. package/dist/usergroups/post/response.js.map +1 -0
  274. package/dist/usergroups/shared.d.ts +25 -0
  275. package/dist/usergroups/shared.js +11 -0
  276. package/dist/usergroups/shared.js.map +1 -0
  277. package/dist/users/[id]/get/response.d.ts +0 -2
  278. package/dist/users/[id]/patch/request.d.ts +5 -1
  279. package/dist/users/current.d.ts +22 -4
  280. package/dist/users/get/query.d.ts +0 -2
  281. package/dist/users/home-layout/shared.d.ts +96 -21
  282. package/dist/users/home-layout/shared.js +11 -5
  283. package/dist/users/home-layout/shared.js.map +1 -1
  284. package/dist/users/post/request.d.ts +6 -1
  285. package/package.json +2 -2
@@ -0,0 +1,853 @@
1
+ import { SortOrders } from '../shared';
2
+ import { AssetSortField } from '../assets/get/query';
3
+ import { LocationSortField } from '../locations/get/query';
4
+ import { LocationStatus, LocationType } from '../locations/constants';
5
+ import { EventType } from '../events/constants';
6
+ import { DeviceType, ReaderType } from '../readers/constants';
7
+ import { SnapshotSortField, SnapshotTypeEnum } from '../snapshots/get/query';
8
+ import { FieldDataType } from '../fields/constants';
9
+ /**
10
+ * SEMANTIC QUERIES — the portable query language.
11
+ *
12
+ * A semantic query is a JSON list of typed conditions (ANDed together, nestable
13
+ * with and/or groups) over one entity type. Three parties speak this contract —
14
+ * the client filter UI that builds conditions, the LLM that generates them, and
15
+ * the server compiler that executes them — so this file is the single
16
+ * vocabulary all three encode.
17
+ *
18
+ * THE CLOSED-VOCABULARY RULE. Condition types, operators AND property names are
19
+ * closed sets: validation rejects an unknown property rather than ignoring it,
20
+ * at every level. This is not defensive tidiness — an LLM once invented a
21
+ * `"negate": true` property; ignoring it compiled NOT(X) as X, a query that ran
22
+ * successfully and returned exactly the complement of what was asked. Every
23
+ * defect class this design guards against fails SILENTLY (valid query, wrong
24
+ * rows), which is why an honest rejection always beats a plausible guess.
25
+ *
26
+ * There is deliberately NO general negation (no `not` group, no invertible
27
+ * flag). Expressible negatively: `notExists`, `ne`, `geolocation.exists:false`,
28
+ * `kit.isMember:false`. Anything else must surface as a validation issue,
29
+ * never an approximation.
30
+ *
31
+ * Descends from the G2G Chat prototype (see g2g-client
32
+ * `docs/semantic-query-decisions.md` while it lives, folding into
33
+ * TECHNICAL_DECISIONS.md) and the semantic-query specification errata.
34
+ */
35
+ /**
36
+ * What a semantic query targets. All but `manifest` execute; it is recorded so
37
+ * the classifier can name what it is declining, and so a stored query would
38
+ * never need retrofitting if it ever learns to speak.
39
+ */
40
+ export declare const semanticQueryEntityTypes: readonly ["asset", "location", "event", "reader", "snapshot", "manifest"];
41
+ export declare type SemanticQueryEntityType = (typeof semanticQueryEntityTypes)[number];
42
+ /**
43
+ * What a stored record IS, as opposed to what it targets.
44
+ * - `query` — a selector. Executing it returns rows.
45
+ * - `operation` — a selector PLUS verbs ("move everything matching this to
46
+ * Southport"). Only the DEFINITION is stored; execution belongs
47
+ * to the bulk-operations API when it exists.
48
+ */
49
+ export declare const semanticQueryKinds: readonly ["query", "operation"];
50
+ export declare type SemanticQueryKind = (typeof semanticQueryKinds)[number];
51
+ export declare const semanticQueryVisibilities: readonly ["private", "organisation"];
52
+ export declare type SemanticQueryVisibility = (typeof semanticQueryVisibilities)[number];
53
+ export declare const semanticRelativeDateBases: readonly ["day", "week", "month", "quarter", "year"];
54
+ export declare type SemanticRelativeDateBase = (typeof semanticRelativeDateBases)[number];
55
+ export declare const semanticRelativeDatePositions: readonly ["start", "end", "same"];
56
+ export declare type SemanticRelativeDatePosition = (typeof semanticRelativeDatePositions)[number];
57
+ /**
58
+ * A relative date, stored UNRESOLVED — that is the point. A saved query whose
59
+ * date resolved at save time silently means the wrong period forever; leaving
60
+ * it symbolic means "last 30 days" re-run next month means next month.
61
+ * Resolution happens at execution, against an explicit timezone.
62
+ *
63
+ * `offset`: 0 = this period, 1 = next, -1 = last, -30 = thirty periods ago.
64
+ *
65
+ * `position`:
66
+ * - `start` / `end` snap to the boundaries of the named period (calendar
67
+ * semantics — "start of last month").
68
+ * - `same` is the same day-of-month, `offset` periods away, clamped for short
69
+ * months (31 Jan + 1 month = 28/29 Feb). Without it "one month from today"
70
+ * is inexpressible — `{base:'month', offset:1, position:'start'}` is the 1st
71
+ * of next month and `{base:'day', offset:30}` drifts. Service and inspection
72
+ * intervals are quoted in months, so for date-setting operations `same` is
73
+ * the common case, not an edge case. Meaningless for `day` (the offset is
74
+ * already in days).
75
+ *
76
+ * Sibling of the platform's `DateCondition`/`DateOffset` (shared/relative-date
77
+ * .ts), which derives period boundaries from the comparison operator instead.
78
+ * This shape exists separately because it is what the LLM emits and what
79
+ * stored queries carry, and because `position: 'same'` has no `DateCondition`
80
+ * encoding. One resolver serves both (assets resolve-date).
81
+ */
82
+ export interface SemanticRelativeDate {
83
+ relative: true;
84
+ base: SemanticRelativeDateBase;
85
+ offset: number;
86
+ /** Required for week/month/quarter/year; optional for day. */
87
+ position?: SemanticRelativeDatePosition;
88
+ }
89
+ /** An absolute `"YYYY-MM-DD"` date, or a relative one. A range is always two conditions (gte + lt). */
90
+ export declare type SemanticDateValue = string | SemanticRelativeDate;
91
+ export declare const semanticFieldOperators: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "contains", "exists", "notExists"];
92
+ export declare type SemanticFieldOperator = (typeof semanticFieldOperators)[number];
93
+ export declare const semanticTimestampOperators: readonly ["gt", "gte", "lt", "lte"];
94
+ export declare type SemanticTimestampOperator = (typeof semanticTimestampOperators)[number];
95
+ export declare const semanticComparisonOperators: readonly ["eq", "ne", "gt", "gte", "lt", "lte"];
96
+ export declare type SemanticComparisonOperator = (typeof semanticComparisonOperators)[number];
97
+ export declare const semanticSetOperators: readonly ["any", "all"];
98
+ export declare type SemanticSetOperator = (typeof semanticSetOperators)[number];
99
+ /**
100
+ * Grouping. Two interfaces rather than one with `type: 'and' | 'or'` so that
101
+ * `Extract<SemanticQueryCondition, { type: 'or' }>` narrows — with a shared
102
+ * interface it collapses to `never`.
103
+ */
104
+ export interface SemanticAndCondition {
105
+ type: 'and';
106
+ conditions: SemanticQueryCondition[];
107
+ }
108
+ export interface SemanticOrCondition {
109
+ type: 'or';
110
+ conditions: SemanticQueryCondition[];
111
+ }
112
+ /** Matches a type subtree by pipe-delimited path ("Vehicle|Forklift|"). */
113
+ export interface SemanticAssetTypeCondition {
114
+ type: 'assetType';
115
+ path: string;
116
+ /** Default true — the type and everything under it. False = exact type only. */
117
+ includeSubtypes?: boolean;
118
+ }
119
+ /**
120
+ * Matches a location subtree by pipe-delimited path. `location` is where the
121
+ * asset currently IS; `homeLocation` is where it BELONGS — a fixed, often
122
+ * high-level node. Conflating them fails silently, so they are distinct types.
123
+ */
124
+ export interface SemanticAssetLocationCondition {
125
+ type: 'location' | 'homeLocation';
126
+ path: string;
127
+ /** Default true. */
128
+ includeSublocations?: boolean;
129
+ }
130
+ /**
131
+ * Assets currently travelling with another asset — the defibrillator in the
132
+ * ambulance. (The carrier side — "can hold other assets" — is deliberately not
133
+ * in the language: ruled out 2026-07-31.)
134
+ *
135
+ * NOTE the producer gap (prototype finding #12): nothing can currently supply
136
+ * an `assetId` — the AI is never asked for an id (models invent them, and a
137
+ * fabricated id runs and matches nothing) and the client UI has no
138
+ * asset-picking filter. PARKED by ruling (Aaron, 2026-08-03): a peer solution
139
+ * is incoming; until then the AI declines "what's in <asset>" honestly and
140
+ * only `hasAny` is produced.
141
+ */
142
+ export interface SemanticWithAssetCondition {
143
+ type: 'withAsset';
144
+ /** With one specific asset. */
145
+ assetId?: string;
146
+ /** With any asset at all (or none, when false). */
147
+ hasAny?: boolean;
148
+ }
149
+ /**
150
+ * A custom-field condition.
151
+ *
152
+ * `ne` INCLUDES UNSET by default: "Ownership ≠ QH" counts assets where the
153
+ * field is absent, because that is how the English reads. On a sparse field
154
+ * the two readings differ by orders of magnitude (2 rows vs 785 measured).
155
+ * `includeUnset: false` opts into the strict has-the-field-and-differs
156
+ * reading.
157
+ *
158
+ * Fields whose values live on the asset TYPE (inherited down the type
159
+ * hierarchy) are the compiler's problem, not the caller's: the condition shape
160
+ * is identical and the compiler resolves type-level values itself. Without
161
+ * that, the flagship "assets by Manufacturer" query matches nothing.
162
+ */
163
+ export interface SemanticCustomFieldCondition {
164
+ type: 'customField';
165
+ fieldName: string;
166
+ /** Advisory only — the authoritative dataType comes from the field catalogue. */
167
+ dataType?: FieldDataType;
168
+ operator: SemanticFieldOperator;
169
+ value?: string | number | boolean | SemanticRelativeDate;
170
+ /** For `ne` only. Default true. */
171
+ includeUnset?: boolean;
172
+ }
173
+ /**
174
+ * The timestamp family:
175
+ * - `createdDate` — when the asset was created
176
+ * - `lastUpdated` — the asset's own record edited through the APIs
177
+ * - `lastChanged` — ANY system touched the asset, including location /
178
+ * telemetry updates (drives offline-sync deltas)
179
+ * - `lastSeen` / `firstSeen` — detection timestamps
180
+ *
181
+ * "Edited / record changed" wording maps to `lastUpdated`; "moved / touched /
182
+ * anything happened" maps to `lastChanged` — genuinely different questions
183
+ * with substantially different answers.
184
+ *
185
+ * `lt`/`lte` INCLUDE NEVER-SET by default: none of these fields exist on an
186
+ * asset that has never been modified/seen, so a naive "not updated since
187
+ * March" excludes exactly the assets the user is usually looking for.
188
+ * `includeNeverSet: false` opts out.
189
+ *
190
+ * Comparison operators only — bare timestamp existence was ruled out of the
191
+ * language (gap #6, 2026-07-31); "never seen" is `locationStatus: NEVERSEEN`.
192
+ */
193
+ export interface SemanticTimestampCondition {
194
+ type: 'createdDate' | 'lastUpdated' | 'lastChanged' | 'lastSeen' | 'firstSeen';
195
+ operator: SemanticTimestampOperator;
196
+ /** Required for comparisons; forbidden for exists/notExists. */
197
+ value?: SemanticDateValue;
198
+ /** For `lt`/`lte` only. Default true. */
199
+ includeNeverSet?: boolean;
200
+ }
201
+ /** Whether the asset has map coordinates. Nothing more — "online" is not a concept assets have. */
202
+ export interface SemanticGeolocationCondition {
203
+ type: 'geolocation';
204
+ exists: boolean;
205
+ }
206
+ /** Tag conditions take tag IDS, not display names. `any` (default) or `all`. */
207
+ export interface SemanticTagsCondition {
208
+ type: 'tags';
209
+ operator?: SemanticSetOperator;
210
+ values: string[];
211
+ }
212
+ export declare const semanticTelemetryFields: readonly ["battery", "temperature", "voltage"];
213
+ export declare type SemanticTelemetryField = (typeof semanticTelemetryFields)[number];
214
+ export interface SemanticTelemetryCondition {
215
+ type: 'telemetry';
216
+ field: SemanticTelemetryField;
217
+ operator: SemanticComparisonOperator;
218
+ value: number;
219
+ }
220
+ /** Readiness severity scale (contract shared/readiness.ts): 0 green, 1 amber, 2 red. */
221
+ export declare const semanticReadinessLevels: readonly [0, 1, 2];
222
+ export declare type SemanticReadinessLevel = (typeof semanticReadinessLevels)[number];
223
+ /**
224
+ * Readiness. Missing `readiness` on an asset means green — a query including
225
+ * level 0 must also match never-evaluated assets (the compiler owns that).
226
+ * `level` and `levels` are mutually exclusive.
227
+ */
228
+ export interface SemanticReadinessCondition {
229
+ type: 'readiness';
230
+ level?: SemanticReadinessLevel;
231
+ /** Any of several levels — e.g. [1, 2] for "not fully ready". */
232
+ levels?: SemanticReadinessLevel[];
233
+ }
234
+ /**
235
+ * Kits / grouping. Exactly one property may be set. The negative forms match
236
+ * assets where the flag is absent as well as false (the flags are stored
237
+ * true-or-absent).
238
+ *
239
+ * `parentAssetId` shares the withAsset producer gap above — parked the same
240
+ * way; the AI declines "members of kit <name>" until the incoming solution.
241
+ */
242
+ /** The four manifest-check states a kit can be in (`groupSatisfiesManifest`):
243
+ * satisfied (0) — the most recent manifest check passed; needsRecheck (1) — a
244
+ * later membership change invalidated that pass; notSatisfied (2) — the most
245
+ * recent check failed; neverChecked (absent) — no check has ever stamped the
246
+ * kit. */
247
+ export declare type SemanticManifestState = 'satisfied' | 'needsRecheck' | 'notSatisfied' | 'neverChecked';
248
+ export interface SemanticKitCondition {
249
+ type: 'kit';
250
+ /** The asset is itself a kit. */
251
+ isKit?: boolean;
252
+ /** The asset belongs to a kit. */
253
+ isMember?: boolean;
254
+ /**
255
+ * LEGACY two-state form of `manifest`, kept compiling forever for saved
256
+ * queries: true → manifest satisfied (0), false → manifest not satisfied
257
+ * (2). New queries use `manifest`, which can also say needsRecheck and
258
+ * neverChecked.
259
+ */
260
+ satisfied?: boolean;
261
+ /** The kit's manifest-check status (see `SemanticManifestState`).
262
+ * `neverChecked` self-scopes to kits — it never matches ordinary assets. */
263
+ manifest?: SemanticManifestState;
264
+ /** Members of one specific kit. */
265
+ parentAssetId?: string;
266
+ }
267
+ /**
268
+ * Location status ("currently dispatched", "never seen", …). `NEVERSEEN`
269
+ * matches assets with no state at all as well as the explicit status — the
270
+ * compiler owns that missing-state semantic.
271
+ */
272
+ export interface SemanticLocationStatusCondition {
273
+ type: 'locationStatus';
274
+ values: LocationStatus[];
275
+ }
276
+ /**
277
+ * Grouping — valid in every entity's vocabulary, because nesting is structure
278
+ * rather than subject matter.
279
+ */
280
+ export declare const semanticGroupConditionTypes: readonly ["and", "or"];
281
+ /**
282
+ * The ASSET vocabulary. Over a third of it is asset-only by nature —
283
+ * `readiness`, `kit`, `withAsset`, `telemetry`, `locationStatus` mean nothing
284
+ * for a reader or a snapshot.
285
+ */
286
+ export declare const semanticAssetConditionTypes: readonly ["and", "or", "assetType", "location", "homeLocation", "withAsset", "customField", "createdDate", "lastUpdated", "lastChanged", "lastSeen", "firstSeen", "geolocation", "tags", "telemetry", "readiness", "kit", "locationStatus"];
287
+ /**
288
+ * A location subtree, by pipe-delimited path.
289
+ *
290
+ * `path` rather than reusing the asset vocabulary's `location`, deliberately.
291
+ * They are not the same fact: an asset's `location` is a RELATIONSHIP to
292
+ * another record, while a location's path is its own identity — and
293
+ * "location" as a condition on a location query reads as self-reference.
294
+ * (Storage note for implementors: the Mongo document keeps this pipe path in
295
+ * `name`, not in a `path` field.)
296
+ */
297
+ export interface SemanticLocationPathCondition {
298
+ type: 'path';
299
+ path: string;
300
+ /** Default true — this location and everything under it. */
301
+ includeSublocations?: boolean;
302
+ }
303
+ /** A location is FIXED (a room, a bay) or MOVING (a vehicle). */
304
+ export interface SemanticLocationTypeCondition {
305
+ type: 'locationType';
306
+ values: LocationType[];
307
+ }
308
+ /** Whether any reader is installed at the location. */
309
+ export interface SemanticLocationHasReadersCondition {
310
+ type: 'hasReaders';
311
+ value: boolean;
312
+ }
313
+ /** Whether a geofence polygon has been drawn for the location. */
314
+ export interface SemanticLocationGeofenceCondition {
315
+ type: 'geofence';
316
+ exists: boolean;
317
+ }
318
+ /** Locations carrying one specific manifest. Ids point; paths match. */
319
+ export interface SemanticLocationManifestCondition {
320
+ type: 'manifest';
321
+ manifestId: string;
322
+ }
323
+ /**
324
+ * The LOCATION vocabulary.
325
+ *
326
+ * Where a fact is genuinely the same as an asset's, it keeps the same word AND
327
+ * the same meaning — `tags`, `createdDate`, `lastUpdated`, `lastChanged`. That
328
+ * is the naming rule working: one fact stored the same way, sharing one
329
+ * emitter, not two coincidences that agree today.
330
+ *
331
+ * `geolocation` is the exception that proves it needs care. The word means the
332
+ * same thing — "has map coordinates" — but a location has TWO: the coordinates
333
+ * it was configured with, and the ones a moving location last reported
334
+ * (`state.geolocation`, which is what the asset condition reads). This
335
+ * condition means the CONFIGURED position; the observed one belongs to a
336
+ * separate condition if it is ever wanted, rather than being silently folded
337
+ * in here.
338
+ *
339
+ * DELIBERATELY ABSENT: `lastSeen`, `firstSeen` and `telemetry`. The location
340
+ * document declares all three and the parser exposes them, so they were easy
341
+ * to add — but nothing in this repo writes them (the reader/MQTT ingestion
342
+ * does, if anything does), no legacy filter or prototype condition ever
343
+ * offered them, and they could only ever apply to MOVING locations carrying a
344
+ * tracker. A condition over a field that may never be populated is one that
345
+ * runs and confidently returns nothing. They come back the day the ingestion
346
+ * is confirmed to populate them — the emitters are already shared, so it is a
347
+ * list entry and two switch arms.
348
+ *
349
+ * Also absent, and for a different reason: free text. There is no
350
+ * `nameContains` (the prototype had one) because search is a view option
351
+ * platform-wide, not a condition.
352
+ */
353
+ export declare const semanticLocationConditionTypes: readonly ["and", "or", "path", "locationType", "hasReaders", "geofence", "manifest", "tags", "geolocation", "createdDate", "lastUpdated", "lastChanged"];
354
+ /**
355
+ * The three timestamps a location answers for. Narrowed rather than reusing
356
+ * `SemanticTimestampCondition` whole: that interface covers all five, and
357
+ * leaving it wide would let `lastSeen` typecheck on a location query and rely
358
+ * on the runtime vocabulary alone to catch it — the type should say the same
359
+ * thing the gate does.
360
+ */
361
+ export declare type SemanticLocationTimestampCondition = Omit<SemanticTimestampCondition, 'type'> & {
362
+ type: 'createdDate' | 'lastUpdated' | 'lastChanged';
363
+ };
364
+ export declare type SemanticLocationCondition = SemanticAndCondition | SemanticOrCondition | SemanticLocationPathCondition | SemanticLocationTypeCondition | SemanticLocationHasReadersCondition | SemanticLocationGeofenceCondition | SemanticLocationManifestCondition | SemanticTagsCondition | SemanticGeolocationCondition | SemanticLocationTimestampCondition;
365
+ /** WHEN it happened. Events are always in the past. */
366
+ export interface SemanticEventOccurredCondition {
367
+ type: 'occurred';
368
+ operator: SemanticTimestampOperator;
369
+ value: SemanticDateValue;
370
+ }
371
+ /** WHAT KIND of event. One or more of the platform's closed set. */
372
+ export interface SemanticEventTypeCondition {
373
+ type: 'eventType';
374
+ values: EventType[];
375
+ }
376
+ /**
377
+ * WHERE it happened, by pipe-delimited path — the same path vocabulary the
378
+ * location entity uses, matched as a prefix so a parent covers its subtree.
379
+ * Events embed the location's stored path in `location.name`, exactly as a
380
+ * location document does.
381
+ *
382
+ * PARTIAL BY CONSTRUCTION, and the line between this and the withheld
383
+ * `assetType` is worth stating because it is fine.
384
+ *
385
+ * Most event types embed `location`; several do not. For most of those the
386
+ * omission is honest — a `UserSearch` or a `ReaderOnline` has no place it
387
+ * happened. `assetType` was withheld because the events missing `thing
388
+ * .typePath` DO have an asset type; it simply is not stored, so the filter
389
+ * would be silently wrong about real data.
390
+ *
391
+ * ONE case here is on the wrong side of that line: a `FormSubmitted` event
392
+ * embeds `location` only for a LOCATION-target run. An asset-target
393
+ * submission made at the same place embeds `thing` instead, so "submissions at
394
+ * Brisbane" returns the location-target subset and drops the rest without
395
+ * saying so. That is the identical failure `assetType` was withheld for, and
396
+ * it survives here for one reason: the flat `locations` filter on
397
+ * `GET /events` has always behaved this way, so removing it from the language
398
+ * would make the two paths disagree about the same word. Fixing it properly
399
+ * means embedding the location on asset-target submissions — a write-path
400
+ * change, not a query one. Until then the preamble says so out loud.
401
+ */
402
+ export interface SemanticEventLocationCondition {
403
+ type: 'location';
404
+ path: string;
405
+ /**
406
+ * Default true, matching the location entity. Carried rather than omitted
407
+ * because the boundary's property table is per-WORD, not per-entity: it
408
+ * already accepts `includeSublocations` on `location`, so leaving it
409
+ * unhandled here would mean an explicit `false` was accepted and silently
410
+ * behaved as `true` — a narrower query than asked for, quietly widened.
411
+ */
412
+ includeSublocations?: boolean;
413
+ }
414
+ /**
415
+ * WHICH READER saw it, by name.
416
+ *
417
+ * A name rather than an id, and that is safe here in a way it is not for
418
+ * assets: readers are a small named catalogue, so the name RESOLVES against
419
+ * real records at compile time and an unknown or ambiguous one is a loud
420
+ * failure. Nothing is guessed and no regex is left to match whatever it
421
+ * happens to match.
422
+ */
423
+ export interface SemanticEventReaderCondition {
424
+ type: 'reader';
425
+ name: string;
426
+ }
427
+ /**
428
+ * WHO did it, by name — resolved the same way, against the organisation's
429
+ * users.
430
+ *
431
+ * Matching on a resolved user id inherently excludes system-generated events:
432
+ * Slate movements and arrivals carry no user at all. That is correct and worth
433
+ * stating, because "what did Sarah do" should never sweep in a reader
434
+ * detection.
435
+ */
436
+ export interface SemanticEventUserCondition {
437
+ type: 'user';
438
+ name: string;
439
+ }
440
+ /**
441
+ * WHICH ACTION a form submission belongs to, by name.
442
+ *
443
+ * The action is the useful handle and the form behind it is an implementation
444
+ * detail (ruled by Steve Mann, 2026-07-29, carried over from the prototype).
445
+ * An action condition already implies a submission, so it constrains the event
446
+ * type too and needs no pairing with `eventType`.
447
+ *
448
+ * It constrains to BOTH submission types — `FormSubmitted` and
449
+ * `FormSubmissionVoided`, which also carries `actionName`. Pinning it to
450
+ * `FormSubmitted` alone read as the tighter, safer choice and was the opposite:
451
+ * pairing it with `eventType: ['FormSubmissionVoided']` to ask for voided
452
+ * pre-start checks then produced two contradictory type constraints, which
453
+ * compiles cleanly and returns zero rows forever. Narrowing to just submitted
454
+ * ones stays possible — that is what the `eventType` pairing is for.
455
+ */
456
+ export interface SemanticEventActionCondition {
457
+ type: 'action';
458
+ name: string;
459
+ }
460
+ /**
461
+ * The TYPE of the asset an event was about, by pipe-delimited path.
462
+ *
463
+ * Same word, shape and meaning as the asset vocabulary's `assetType` — hence
464
+ * the alias, exactly as the snapshot vocabulary does it.
465
+ *
466
+ * SCOPED TO THE ASSET CRUD EVENTS, and that is the whole design. It reads
467
+ * `thing.typePath`, which only `IAssetCrudSchema` events carry; every movement
468
+ * event embeds a reduced `thing` with no type at all. So the compiler and the
469
+ * evaluator both AND `ASSET_CRUD_EVENT_TYPES` onto this condition — at the
470
+ * LEAF, not across the query, so an or-group can still ask for movements in
471
+ * its other branch.
472
+ *
473
+ * Two things keep the narrowing honest rather than hidden, which is what kept
474
+ * this word out of the vocabulary until now:
475
+ * - pairing it with an `eventType` that names no CRUD event is REFUSED by
476
+ * validation, because that conjunction can only ever match nothing, and a
477
+ * silent empty feed is the failure this language exists to prevent;
478
+ * - the client states the scope on the chip ("creations, updates & deletions")
479
+ * rather than implying a filter over all activity.
480
+ *
481
+ * The wider version returns if movement events ever embed the type — that is a
482
+ * write-path change plus a backfill, and nothing here blocks it.
483
+ */
484
+ export declare type SemanticEventAssetTypeCondition = SemanticAssetTypeCondition;
485
+ /**
486
+ * The EVENT vocabulary.
487
+ *
488
+ * `location` borrows its WORD from the asset vocabulary but not its meaning:
489
+ * an asset's `location` is where the asset is now, an event's is where the
490
+ * event happened. Same name for the same kind of question, different subject —
491
+ * which is why each entity compiles it against its own field.
492
+ * `occurred` is its own word rather than reusing a timestamp
493
+ * name, because an event has exactly ONE time and calling it `createdDate`
494
+ * would invite the reading that events have several dates the way assets do.
495
+ */
496
+ export declare const semanticEventConditionTypes: readonly ["and", "or", "occurred", "eventType", "assetType", "location", "reader", "user", "action"];
497
+ export declare type SemanticEventCondition = SemanticAndCondition | SemanticOrCondition | SemanticEventOccurredCondition | SemanticEventTypeCondition | SemanticEventAssetTypeCondition | SemanticEventLocationCondition | SemanticEventReaderCondition | SemanticEventUserCondition | SemanticEventActionCondition;
498
+ /**
499
+ * WHEN the snapshot happened.
500
+ *
501
+ * Compiles to `submitted`, NOT `created` — and that is a deliberate departure
502
+ * from the prototype, which used `created`. The platform's own time filter
503
+ * (`timeFrom`/`timeTo` on `GET /snapshots`) bounds `submitted`, so compiling
504
+ * to `created` would mean the Date chip and an `occurred` condition disagreed
505
+ * about "snapshots last week" while both looked right.
506
+ *
507
+ * The cost, stated because it is silent: `submitted` is optional, so a
508
+ * snapshot that was never submitted matches NO `occurred` bound. That is
509
+ * exactly how the existing Date chip already behaves — this condition inherits
510
+ * the gap rather than introducing it. Sorting still offers both fields
511
+ * (`snapshotSortFields`), because sorting cannot hide a row.
512
+ */
513
+ export declare type SemanticSnapshotOccurredCondition = SemanticEventOccurredCondition;
514
+ /**
515
+ * WHICH KIND of field operation.
516
+ *
517
+ * Not a plain equality. `type` was added after the fact, so a legacy snapshot
518
+ * has none and is classified by whether it carries a manifest: no manifest
519
+ * means Stocktake, a manifest means Inventory. Dispatch always carries an
520
+ * explicit type. `snapshots/filters.ts` encodes exactly this, and the compiler
521
+ * reproduces it — matching on `type` alone would return zero legacy rows while
522
+ * the chip beside it returned them.
523
+ */
524
+ export interface SemanticSnapshotTypeCondition {
525
+ type: 'snapshotType';
526
+ values: SnapshotTypeEnum[];
527
+ }
528
+ /**
529
+ * The asset the snapshot was taken AGAINST, by id.
530
+ *
531
+ * Named `asset` rather than reusing `withAsset` because the fact differs: an
532
+ * asset's `withAsset` asks what a kit CONTAINS, while this asks what this
533
+ * operation was ABOUT.
534
+ *
535
+ * Read the field before believing the flat filter's own description. A
536
+ * snapshot embeds a single optional `asset` — its SUBJECT — while its contents
537
+ * live in `detectedAssets` / `sightedAssets` / `undetectedAssets`. The
538
+ * `assetIds` filter is documented as "snapshots containing specific assets"
539
+ * and does nothing of the kind: it matches `asset._id`, the subject. This
540
+ * condition means the subject too, so chip and query agree; asking what a
541
+ * snapshot CONTAINED is a different question that neither can answer yet.
542
+ *
543
+ * An id, not a name — the §B1 refusal. The AI cannot produce one (it never
544
+ * sees ids), so this is a chip-built condition, exactly as `withAsset` is.
545
+ */
546
+ export interface SemanticSnapshotAssetCondition {
547
+ type: 'asset';
548
+ assetId: string;
549
+ }
550
+ /**
551
+ * The TYPE of the snapshot's subject asset, by pipe-delimited path.
552
+ *
553
+ * Same word and same meaning as the asset vocabulary's `assetType`, applied to
554
+ * the subject asset (`asset.typePath`). Carries the subject-not-contents
555
+ * caveat above.
556
+ */
557
+ export declare type SemanticSnapshotAssetTypeCondition = SemanticAssetTypeCondition;
558
+ /**
559
+ * WHERE the snapshot was taken, by pipe-delimited path.
560
+ *
561
+ * `location.path` is absent on legacy snapshots, so a path condition does not
562
+ * see them. That is the same acceptance already recorded for record scope
563
+ * (usergroups S7: "Legacy snapshots pre-date that field and stay hidden to
564
+ * scoped callers"), so the language matches the platform rather than inventing
565
+ * a second answer. The flat filter softens it only when BOTH `locationIds` and
566
+ * `locationPathBeginsWith` are supplied — a semantic condition carries one
567
+ * path and has no id to pair with it.
568
+ */
569
+ export declare type SemanticSnapshotLocationCondition = SemanticEventLocationCondition;
570
+ /**
571
+ * The manifest the operation ran against, and/or how the check came out.
572
+ * Forked from the location alias the day it grew `satisfied` — extending the
573
+ * alias in place would have leaked the property into the location vocabulary.
574
+ *
575
+ * `satisfied` reads the snapshot's frozen `c_satisfiesManifest` annotation by
576
+ * exact match: `true` = the check stamped satisfied, `false` = it stamped not
577
+ * satisfied. Snapshots that never stamped a verdict (stocktakes, location
578
+ * checks, records predating the annotation) carry no flag and match NEITHER
579
+ * polarity — never `$ne`. At least one of the two keys must be present.
580
+ */
581
+ export interface SemanticSnapshotManifestCondition {
582
+ type: 'manifest';
583
+ /** Ids point; paths match. Optional since `satisfied` can stand alone. */
584
+ manifestId?: string;
585
+ /** Exact-match against the frozen check verdict. */
586
+ satisfied?: boolean;
587
+ }
588
+ /** WHO ran it, by name — resolved against the org's users, as events do. */
589
+ export declare type SemanticSnapshotUserCondition = SemanticEventUserCondition;
590
+ /** WHICH READER took it, by name — resolved the same way. */
591
+ export declare type SemanticSnapshotReaderCondition = SemanticEventReaderCondition;
592
+ /**
593
+ * The SNAPSHOT vocabulary.
594
+ *
595
+ * Full parity with the prototype's six words, plus `assetType` and `reader`,
596
+ * which its descriptor lacked and the platform's flat filters already support.
597
+ *
598
+ * Nothing is withheld here, and that is worth contrasting with events. The
599
+ * prototype matched `asset`, `user` and `manifest` by case-insensitive regex
600
+ * over a denormalised name — the failure the asset vocabulary refuses, three
601
+ * times over. It survives translation intact only because this entity stores
602
+ * real ids for all three, so the honest form costs no capability. Where it
603
+ * could not (a name for `user`), the event ladder already solved it.
604
+ *
605
+ * Absent for the standing reason: free text. No `nameContains` — search is a
606
+ * view option platform-wide, never a stored condition.
607
+ */
608
+ export declare const semanticSnapshotConditionTypes: readonly ["and", "or", "occurred", "snapshotType", "asset", "assetType", "location", "manifest", "user", "reader"];
609
+ export declare type SemanticSnapshotCondition = SemanticAndCondition | SemanticOrCondition | SemanticSnapshotOccurredCondition | SemanticSnapshotTypeCondition | SemanticSnapshotAssetCondition | SemanticSnapshotAssetTypeCondition | SemanticSnapshotLocationCondition | SemanticSnapshotManifestCondition | SemanticSnapshotUserCondition | SemanticSnapshotReaderCondition;
610
+ /** The hardware model. A closed platform set (`DEVICE_TYPES`). */
611
+ export interface SemanticReaderDeviceTypeCondition {
612
+ type: 'deviceType';
613
+ values: DeviceType[];
614
+ }
615
+ /**
616
+ * The reader's BEHAVIOUR — fixed in place, roving, or itself moving
617
+ * (`READER_TYPES`). Named `readerType` rather than `type`, which is the wire
618
+ * key every condition already uses for its own discriminator.
619
+ */
620
+ export interface SemanticReaderTypeCondition {
621
+ type: 'readerType';
622
+ values: ReaderType[];
623
+ }
624
+ /**
625
+ * WHERE the reader is installed, by pipe-delimited path.
626
+ *
627
+ * Compiles against `locationName`, which holds the location's FULL
628
+ * pipe-terminated path (`readers/helpers.ts` copies `location.name`, and a
629
+ * location document's `name` is its path). The flat `locationIds` filter
630
+ * answers a different question — these exact locations — and the two coexist,
631
+ * exactly as they do for assets.
632
+ */
633
+ export declare type SemanticReaderLocationCondition = SemanticEventLocationCondition;
634
+ /**
635
+ * The asset this reader is attached to, by id.
636
+ *
637
+ * An id, never a name. The prototype matched `assetName` with a
638
+ * case-insensitive regex, which is the failure that makes "BC-A1" also return
639
+ * "BC-A10".
640
+ */
641
+ export interface SemanticReaderAttachedAssetCondition {
642
+ type: 'attachedAsset';
643
+ assetId: string;
644
+ }
645
+ /**
646
+ * Whether the reader is online RIGHT NOW.
647
+ *
648
+ * Split from `hasReported`, and this is where we do better than the prototype
649
+ * rather than merely differently. Its `online` condition folded the two
650
+ * together — its own comment concedes why: "`state` is absent on readers in
651
+ * several dev orgs, so 'offline' must also match readers that have never
652
+ * reported". So asking for offline readers returned the genuinely-offline AND
653
+ * the never-installed, with no way to tell them apart or to ask for either
654
+ * alone. The platform's flat filters have always kept them separate
655
+ * (`isOnline` vs `hasReported`); the language now does too.
656
+ */
657
+ export interface SemanticReaderOnlineCondition {
658
+ type: 'online';
659
+ value: boolean;
660
+ }
661
+ /** Whether the reader has EVER reported. See `online` for why this is its own word. */
662
+ export interface SemanticReaderHasReportedCondition {
663
+ type: 'hasReported';
664
+ value: boolean;
665
+ }
666
+ /** Whether the reader has reported map coordinates. */
667
+ export interface SemanticReaderHasGeolocationCondition {
668
+ type: 'hasGeolocation';
669
+ value: boolean;
670
+ }
671
+ /**
672
+ * The READER vocabulary.
673
+ *
674
+ * Five of the prototype's six words, plus `hasReported` and `hasGeolocation`
675
+ * that it had no form for. The sixth (`nameContains`) is refused above.
676
+ *
677
+ * Note what is NOT here: readers carry no user-group scope, and this
678
+ * vocabulary does not add one. `usergroups/scope.ts` lists them among the
679
+ * surfaces deliberately unscoped in v1, and filtering a set the caller can
680
+ * already read in full reveals nothing new.
681
+ */
682
+ export declare const semanticReaderConditionTypes: readonly ["and", "or", "deviceType", "readerType", "location", "attachedAsset", "online", "hasReported", "hasGeolocation"];
683
+ export declare type SemanticReaderCondition = SemanticAndCondition | SemanticOrCondition | SemanticReaderDeviceTypeCondition | SemanticReaderTypeCondition | SemanticReaderLocationCondition | SemanticReaderAttachedAssetCondition | SemanticReaderOnlineCondition | SemanticReaderHasReportedCondition | SemanticReaderHasGeolocationCondition;
684
+ /**
685
+ * WHICH WORDS EACH ENTITY KNOWS — the closed vocabulary, per entity.
686
+ *
687
+ * The rule only has teeth if "unknown" is decidable for the entity being
688
+ * queried. In one flat list `{type:'readiness'}` on a location query is a
689
+ * VALID word, so rejecting it would demote to a hand-maintained compatibility
690
+ * table — a second gate that can drift from the first, which is the
691
+ * runs-cleanly-returns-wrong-rows failure this design exists to prevent.
692
+ *
693
+ * It also scopes what the generator is shown: composing a location query, the
694
+ * model never sees `readiness` at all. The prototype's prompt listed
695
+ * conditions it could not supply and the model duly emitted them (finding 12);
696
+ * a shared vocabulary hands that failure to every entity at once.
697
+ *
698
+ * An entity with an EMPTY vocabulary is one the language does not speak yet —
699
+ * every condition is rejected, which is the honest answer while only assets
700
+ * execute. Entities are listed from day one so a stored record never needs
701
+ * retrofitting.
702
+ *
703
+ * Where a concept genuinely coincides across entities it keeps the SAME word
704
+ * (`createdDate` is the same fact everywhere). A domain word is only earned
705
+ * where the meaning differs.
706
+ */
707
+ export declare const semanticConditionTypesByEntity: Record<SemanticQueryEntityType, readonly string[]>;
708
+ /**
709
+ * Every condition type the language knows, across all entities.
710
+ *
711
+ * This is the BOUNDARY's list — the wire schema checks that a condition names
712
+ * a real word at all, and leaves which-entity-may-use-it to the shared
713
+ * validator, which knows the entity and can say "'readiness' is an asset
714
+ * condition" instead of "not allowed".
715
+ */
716
+ export declare const semanticConditionTypes: readonly ("telemetry" | "readiness" | "path" | "asset" | "location" | "reader" | "manifest" | "and" | "or" | "assetType" | "homeLocation" | "withAsset" | "customField" | "createdDate" | "lastUpdated" | "lastChanged" | "lastSeen" | "firstSeen" | "geolocation" | "tags" | "kit" | "locationStatus" | "locationType" | "hasReaders" | "geofence" | "occurred" | "eventType" | "user" | "action" | "snapshotType" | "deviceType" | "readerType" | "attachedAsset" | "online" | "hasReported" | "hasGeolocation")[];
717
+ export declare type SemanticConditionType = (typeof semanticConditionTypes)[number];
718
+ /**
719
+ * Query size bounds, shared by the boundary schema (which refuses an oversized
720
+ * query before parsing it) and the compiler (which counts every branch as it
721
+ * walks). Both halves are load-bearing: without the compiler's counting a
722
+ * single `or` could carry thousands of arms, and without the boundary's cap
723
+ * the parse itself is the cost.
724
+ */
725
+ export declare const SEMANTIC_QUERY_LIMITS: {
726
+ readonly maxConditions: 50;
727
+ readonly maxDepth: 5;
728
+ };
729
+ /**
730
+ * The ASSET condition union. Per-entity rather than one shared union on
731
+ * purpose: an entity's compiler takes its own union, so a condition it has not
732
+ * handled is a COMPILE error rather than a runtime fall-through. The prototype
733
+ * kept its vocabularies as `string[]` allowlists and lost exactly that.
734
+ */
735
+ export declare type SemanticAssetCondition = SemanticAndCondition | SemanticOrCondition | SemanticAssetTypeCondition | SemanticAssetLocationCondition | SemanticWithAssetCondition | SemanticCustomFieldCondition | SemanticTimestampCondition | SemanticGeolocationCondition | SemanticTagsCondition | SemanticTelemetryCondition | SemanticReadinessCondition | SemanticKitCondition | SemanticLocationStatusCondition;
736
+ /**
737
+ * Any condition, whatever the entity. Widens as entities are added; the
738
+ * envelope and everything generic over it stay unchanged when they are.
739
+ */
740
+ export declare type SemanticQueryCondition = SemanticAssetCondition | SemanticLocationCondition | SemanticEventCondition | SemanticSnapshotCondition | SemanticReaderCondition;
741
+ /** Current wire version of the condition vocabulary. */
742
+ export declare const SEMANTIC_QUERY_VERSION = 2;
743
+ export interface SemanticQuery {
744
+ /** Defaults to the current version when absent. */
745
+ version?: number;
746
+ /** ANDed together. Empty is valid — "everything" (entity defaults may bound it). */
747
+ conditions: SemanticQueryCondition[];
748
+ }
749
+ /**
750
+ * PATHS MATCH, IDS POINT. A hierarchical path is for MATCHING a subtree; an id
751
+ * is for pointing at ONE specific record. Setting an asset's location is
752
+ * unambiguous by definition, so it always takes `locationId` — `locationPath`
753
+ * rides along only as a display label. Field names are unique, so `fieldName`
754
+ * needs no resolution step.
755
+ */
756
+ export declare type SemanticAssetOperation =
757
+ /**
758
+ * A DATE field's value may be a SemanticRelativeDate, left UNRESOLVED
759
+ * exactly as in a query — otherwise "set expiry to 12 months from today"
760
+ * freezes the date it was authored on, and re-running it next year is wrong.
761
+ */
762
+ {
763
+ op: 'setField';
764
+ fieldName: string;
765
+ value: string | number | boolean | SemanticRelativeDate;
766
+ } | {
767
+ op: 'clearField';
768
+ fieldName: string;
769
+ } | {
770
+ op: 'setLocation';
771
+ locationId: string;
772
+ locationPath?: string;
773
+ }
774
+ /** Where the asset BELONGS — a different property from where it IS. */
775
+ | {
776
+ op: 'setHomeLocation';
777
+ locationId: string;
778
+ locationPath?: string;
779
+ }
780
+ /**
781
+ * Stored but NOT executable, and deliberately not translated to a sentinel
782
+ * id: asset location state has many permutations (current, home,
783
+ * with-another-asset, pending dispatch), so "clear the location" is not one
784
+ * well-defined write. Captured so the intent is not lost; a no-op until the
785
+ * semantics are decided.
786
+ */
787
+ | {
788
+ op: 'clearLocation';
789
+ }
790
+ /**
791
+ * Captured but PENDING: clearing a home location means setting it to the
792
+ * organisation's root location. Whether that is expressed as the root id or
793
+ * resolved server-side is an open question with the API team — this op
794
+ * deliberately carries no id until settled.
795
+ */
796
+ | {
797
+ op: 'clearHomeLocation';
798
+ }
799
+ /** Irreversible — requires explicit confirmation at execution time. */
800
+ | {
801
+ op: 'delete';
802
+ };
803
+ export interface SemanticOperationPayload {
804
+ operations: SemanticAssetOperation[];
805
+ /** Human-readable restatement, shown on the confirmation card. */
806
+ description: string;
807
+ }
808
+ /** Which rendering of the asset list a saved query opens in. */
809
+ export declare const semanticQueryViewTypes: readonly ["table", "map", "tree"];
810
+ export declare type SemanticQueryViewType = (typeof semanticQueryViewTypes)[number];
811
+ /**
812
+ * Everything a saved list REMEMBERS that is not the query itself — columns,
813
+ * sort, and which rendering it opens in. Populated on save; absent on drafts.
814
+ *
815
+ * This is the home for every property the superseded saved VIEW carried
816
+ * outside its `filters` (contract views/shared.ts): each of `columnVisibility`,
817
+ * `columnOrder`, `sort` and `sortOrder` is here under its own name, so a view
818
+ * converts without losing anything it displayed.
819
+ *
820
+ * Free-text search is deliberately absent, from here and from the conditions
821
+ * alike (ruling, 2026-08-05). It is not a filter over a property and the closed
822
+ * vocabulary has no term for it; it is a live narrowing of whatever is already
823
+ * on screen, and it belongs to the session rather than to the saved query. The
824
+ * legacy view persisted it on `filters.search` — the one member of that object
825
+ * that was never really a filter — and that is the behaviour being dropped.
826
+ */
827
+ /**
828
+ * Every sort field a saved list can remember, across entities.
829
+ *
830
+ * This was `AssetSortField` — written when assets were the only thing the
831
+ * language spoke, and missed when the vocabulary was split per entity. A
832
+ * location list sorts by `path`, which no asset has, so saving a location view
833
+ * was rejected at the boundary with a message naming only the asset fields.
834
+ *
835
+ * A UNION rather than a per-entity type, deliberately, and the reasoning is
836
+ * the opposite of the one that made CONDITIONS per-entity. A condition from
837
+ * the wrong vocabulary runs and returns the wrong rows silently — that had to
838
+ * be undecidable-proof. A sort from the wrong entity just names a field the
839
+ * documents do not have: the order falls back, nothing is hidden, and no row
840
+ * is wrongly included or excluded. Splitting `display` per entity to prevent a
841
+ * harmless odd ordering would cost a discriminated union on every read path
842
+ * for no safety gained.
843
+ */
844
+ export declare type SemanticQuerySortField = AssetSortField | LocationSortField | SnapshotSortField;
845
+ export declare const semanticQuerySortFields: SemanticQuerySortField[];
846
+ export interface SemanticQueryDisplay {
847
+ columnVisibility?: Record<string, boolean>;
848
+ columnOrder?: string[];
849
+ sort?: SemanticQuerySortField;
850
+ sortOrder?: SortOrders;
851
+ /** Absent means the client's default rendering. */
852
+ viewType?: SemanticQueryViewType;
853
+ }