things-api 0.11.0 → 0.12.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 (192) hide show
  1. package/README.md +16 -5
  2. package/dist/audit/schema.d.ts +7 -0
  3. package/dist/audit/schema.js.map +1 -1
  4. package/dist/cli/commands/area.d.ts +18 -11
  5. package/dist/cli/commands/area.js +55 -67
  6. package/dist/cli/commands/area.js.map +1 -1
  7. package/dist/cli/commands/doctor.d.ts +1 -2
  8. package/dist/cli/commands/doctor.js +11 -1
  9. package/dist/cli/commands/doctor.js.map +1 -1
  10. package/dist/cli/commands/install-skill.d.ts +19 -4
  11. package/dist/cli/commands/install-skill.js +101 -52
  12. package/dist/cli/commands/install-skill.js.map +1 -1
  13. package/dist/cli/commands/mcp.js +9 -0
  14. package/dist/cli/commands/mcp.js.map +1 -1
  15. package/dist/cli/commands/project.d.ts +1 -0
  16. package/dist/cli/commands/project.js +20 -28
  17. package/dist/cli/commands/project.js.map +1 -1
  18. package/dist/cli/commands/reads.js +100 -28
  19. package/dist/cli/commands/reads.js.map +1 -1
  20. package/dist/cli/commands/show.js +32 -8
  21. package/dist/cli/commands/show.js.map +1 -1
  22. package/dist/cli/commands/todo.js +1 -1
  23. package/dist/cli/commands/todo.js.map +1 -1
  24. package/dist/cli/commands/writes.js +769 -143
  25. package/dist/cli/commands/writes.js.map +1 -1
  26. package/dist/cli/did-you-mean.d.ts +14 -3
  27. package/dist/cli/did-you-mean.js +26 -3
  28. package/dist/cli/did-you-mean.js.map +1 -1
  29. package/dist/cli/glyphs.d.ts +16 -2
  30. package/dist/cli/glyphs.js +60 -12
  31. package/dist/cli/glyphs.js.map +1 -1
  32. package/dist/cli/help.js +67 -12
  33. package/dist/cli/help.js.map +1 -1
  34. package/dist/cli/main.js +1 -1
  35. package/dist/cli/main.js.map +1 -1
  36. package/dist/cli/move-hint.d.ts +3 -2
  37. package/dist/cli/move-hint.js +2 -2
  38. package/dist/cli/move-hint.js.map +1 -1
  39. package/dist/cli/read-driver.d.ts +43 -5
  40. package/dist/cli/read-driver.js +81 -15
  41. package/dist/cli/read-driver.js.map +1 -1
  42. package/dist/cli/render.d.ts +19 -8
  43. package/dist/cli/render.js +59 -25
  44. package/dist/cli/render.js.map +1 -1
  45. package/dist/cli/resolve-invocation.d.ts +2 -2
  46. package/dist/cli/resolve-invocation.js +3 -3
  47. package/dist/cli/resolve-invocation.js.map +1 -1
  48. package/dist/cli/skill-check.d.ts +12 -6
  49. package/dist/cli/skill-check.js +31 -14
  50. package/dist/cli/skill-check.js.map +1 -1
  51. package/dist/cli/skill.d.ts +8 -0
  52. package/dist/cli/skill.js +10 -0
  53. package/dist/cli/skill.js.map +1 -1
  54. package/dist/cli/verb-hint.js +1 -1
  55. package/dist/cli/verb-hint.js.map +1 -1
  56. package/dist/client.d.ts +140 -19
  57. package/dist/client.js +253 -38
  58. package/dist/client.js.map +1 -1
  59. package/dist/config.d.ts +66 -2
  60. package/dist/config.js +120 -12
  61. package/dist/config.js.map +1 -1
  62. package/dist/contracts.d.ts +176 -28
  63. package/dist/contracts.js +22 -1
  64. package/dist/contracts.js.map +1 -1
  65. package/dist/diagnose.d.ts +34 -2
  66. package/dist/diagnose.js +36 -1
  67. package/dist/diagnose.js.map +1 -1
  68. package/dist/index.d.ts +19 -8
  69. package/dist/index.js +19 -3
  70. package/dist/index.js.map +1 -1
  71. package/dist/mcp/server.d.ts +9 -0
  72. package/dist/mcp/server.js +733 -304
  73. package/dist/mcp/server.js.map +1 -1
  74. package/dist/model/entities.d.ts +46 -3
  75. package/dist/model/entities.js.map +1 -1
  76. package/dist/model/mappers.d.ts +2 -0
  77. package/dist/model/mappers.js +41 -2
  78. package/dist/model/mappers.js.map +1 -1
  79. package/dist/model/recurrence.d.ts +8 -1
  80. package/dist/model/recurrence.js.map +1 -1
  81. package/dist/read/area-filter.d.ts +76 -0
  82. package/dist/read/area-filter.js +59 -0
  83. package/dist/read/area-filter.js.map +1 -0
  84. package/dist/read/area-view.d.ts +11 -11
  85. package/dist/read/area-view.js +50 -28
  86. package/dist/read/area-view.js.map +1 -1
  87. package/dist/read/detail.js +15 -8
  88. package/dist/read/detail.js.map +1 -1
  89. package/dist/read/predicates.d.ts +18 -0
  90. package/dist/read/predicates.js +19 -0
  91. package/dist/read/predicates.js.map +1 -1
  92. package/dist/read/project-view.d.ts +31 -15
  93. package/dist/read/project-view.js +72 -39
  94. package/dist/read/project-view.js.map +1 -1
  95. package/dist/read/pseudo-area.d.ts +29 -0
  96. package/dist/read/pseudo-area.js +27 -0
  97. package/dist/read/pseudo-area.js.map +1 -0
  98. package/dist/read/queries.d.ts +105 -18
  99. package/dist/read/queries.js +185 -30
  100. package/dist/read/queries.js.map +1 -1
  101. package/dist/read/scope.d.ts +126 -0
  102. package/dist/read/scope.js +162 -0
  103. package/dist/read/scope.js.map +1 -0
  104. package/dist/read/search-rank.d.ts +2 -5
  105. package/dist/read/shape.d.ts +162 -0
  106. package/dist/read/shape.js +686 -0
  107. package/dist/read/shape.js.map +1 -0
  108. package/dist/read/show-target.d.ts +9 -1
  109. package/dist/read/show-target.js +45 -4
  110. package/dist/read/show-target.js.map +1 -1
  111. package/dist/read/stage.d.ts +199 -0
  112. package/dist/read/stage.js +125 -0
  113. package/dist/read/stage.js.map +1 -0
  114. package/dist/read/truncation.d.ts +7 -5
  115. package/dist/read/truncation.js +33 -8
  116. package/dist/read/truncation.js.map +1 -1
  117. package/dist/read/views.d.ts +49 -9
  118. package/dist/read/views.js +193 -40
  119. package/dist/read/views.js.map +1 -1
  120. package/dist/surface-copy.d.ts +9 -0
  121. package/dist/surface-copy.js +9 -0
  122. package/dist/surface-copy.js.map +1 -1
  123. package/dist/write/batch.d.ts +49 -10
  124. package/dist/write/batch.js +423 -71
  125. package/dist/write/batch.js.map +1 -1
  126. package/dist/write/commands.js +266 -55
  127. package/dist/write/commands.js.map +1 -1
  128. package/dist/write/guards.d.ts +1 -1
  129. package/dist/write/guards.js +71 -10
  130. package/dist/write/guards.js.map +1 -1
  131. package/dist/write/heading.d.ts +10 -1
  132. package/dist/write/heading.js +35 -5
  133. package/dist/write/heading.js.map +1 -1
  134. package/dist/write/make-repeating-project.d.ts +2 -2
  135. package/dist/write/make-repeating-project.js +9 -9
  136. package/dist/write/make-repeating-project.js.map +1 -1
  137. package/dist/write/move.d.ts +130 -0
  138. package/dist/write/move.js +1533 -0
  139. package/dist/write/move.js.map +1 -0
  140. package/dist/write/operations.d.ts +105 -19
  141. package/dist/write/operations.js +56 -7
  142. package/dist/write/operations.js.map +1 -1
  143. package/dist/write/opid.d.ts +31 -0
  144. package/dist/write/opid.js +30 -0
  145. package/dist/write/opid.js.map +1 -0
  146. package/dist/write/pipeline.d.ts +70 -3
  147. package/dist/write/pipeline.js +198 -33
  148. package/dist/write/pipeline.js.map +1 -1
  149. package/dist/write/pre-state.d.ts +162 -8
  150. package/dist/write/pre-state.js +385 -20
  151. package/dist/write/pre-state.js.map +1 -1
  152. package/dist/write/reorder.d.ts +23 -3
  153. package/dist/write/reorder.js +1871 -85
  154. package/dist/write/reorder.js.map +1 -1
  155. package/dist/write/reversibility.js +19 -7
  156. package/dist/write/reversibility.js.map +1 -1
  157. package/dist/write/scope-guard.d.ts +31 -0
  158. package/dist/write/scope-guard.js +162 -0
  159. package/dist/write/scope-guard.js.map +1 -0
  160. package/dist/write/undo.js +120 -13
  161. package/dist/write/undo.js.map +1 -1
  162. package/dist/write/vectors/applescript.js +16 -7
  163. package/dist/write/vectors/applescript.js.map +1 -1
  164. package/dist/write/vectors/shortcuts.js +1 -1
  165. package/dist/write/vectors/shortcuts.js.map +1 -1
  166. package/dist/write/vectors/simulator.js +83 -27
  167. package/dist/write/vectors/simulator.js.map +1 -1
  168. package/dist/write/vectors/types.d.ts +11 -0
  169. package/dist/write/vectors/ui-certification.d.ts +3 -3
  170. package/dist/write/vectors/ui-certification.js +41 -5
  171. package/dist/write/vectors/ui-certification.js.map +1 -1
  172. package/dist/write/vectors/ui-drag.d.ts +21 -1
  173. package/dist/write/vectors/ui-drag.js +138 -27
  174. package/dist/write/vectors/ui-drag.js.map +1 -1
  175. package/dist/write/vectors/ui-recipes.d.ts +21 -1
  176. package/dist/write/vectors/ui-recipes.js +166 -7
  177. package/dist/write/vectors/ui-recipes.js.map +1 -1
  178. package/dist/write/vectors/ui.d.ts +25 -1
  179. package/dist/write/vectors/ui.js +142 -33
  180. package/dist/write/vectors/ui.js.map +1 -1
  181. package/dist/write/verify/delta.d.ts +17 -1
  182. package/dist/write/verify/delta.js +106 -29
  183. package/dist/write/verify/delta.js.map +1 -1
  184. package/package.json +7 -1
  185. package/schema/envelope.schema.json +383 -0
  186. package/skills/things-cli/SKILL.md +34 -17
  187. package/skills/things-cli/references/banner.md +35 -0
  188. package/skills/things-cli/references/contracts.md +30 -9
  189. package/skills/things-cli/references/errors.md +49 -0
  190. package/skills/things-cli/references/gui.md +1 -1
  191. package/skills/things-cli/references/model.md +15 -6
  192. package/skills/things-cli/references/ordering.md +71 -0
@@ -3,8 +3,9 @@
3
3
  * world BEFORE a mutation. One read pass, snapshot semantics per statement.
4
4
  */
5
5
  import type { DatabaseSync } from "node:sqlite";
6
- import type { AnyTask, Project, TaskStatus, TaskType, Todo } from "../model/entities.ts";
7
- import type { ContainerRef, ReorderParams } from "./operations.ts";
6
+ import { type IsoDate } from "../model/dates.ts";
7
+ import type { AnyTask, TaskStatus, TaskType, Todo } from "../model/entities.ts";
8
+ import type { ContainerRef, HeadingPlacement, ReorderParams } from "./operations.ts";
8
9
  export interface ResolvedContainer {
9
10
  uuid: string;
10
11
  title: string;
@@ -13,6 +14,14 @@ export interface ContainerResolution {
13
14
  resolved: ResolvedContainer | null;
14
15
  /** 0 = not found, 1 = ok, >1 = ambiguous title. */
15
16
  matches: number;
17
+ /**
18
+ * An honest not-found tail (`resolved === null && matches === 0`) when the NAME
19
+ * matched only non-open destination rows the resolver deliberately excludes —
20
+ * e.g. a completed/canceled project (which would strand an open child, PLOG1).
21
+ * Surfaced by H-UNKNOWN-DESTINATION so the caller learns the row exists and how
22
+ * to reach it (by uuid). Absent when the miss is a genuine no-match.
23
+ */
24
+ deadHint?: string;
16
25
  }
17
26
  export interface ReorderMember {
18
27
  uuid: string;
@@ -47,9 +56,25 @@ export interface ReorderPre {
47
56
  /** Full wire list: requested order first, remaining members after. */
48
57
  wireList: string[];
49
58
  }
59
+ /** area.delete: live member census of the area (non-trashed direct rows). */
60
+ export interface AreaMemberCounts {
61
+ /** Projects whose area FK is this area (trashed = 0). */
62
+ projects: number;
63
+ /** Direct to-dos in the area (trashed = 0, any status). */
64
+ todos: number;
65
+ }
50
66
  export interface PreState {
51
67
  /** Primary target for uuid-addressed operations. */
52
68
  target: AnyTask | null;
69
+ /**
70
+ * The response clock's local calendar date (guest/host clock), captured at
71
+ * pre-read. Feeds §9n reminder-liveness: the `when=` reminder auto-preserve
72
+ * (commands.ts `effectiveReminder`) gates a STALE reminder byte out against
73
+ * the target's CURRENT startDate under this date, rather than resurrecting a
74
+ * presentation-dead reminder. Defaults to the host today (emptyPreState); the
75
+ * date-bearing update preReads stamp the injected clock.
76
+ */
77
+ todayIso: IsoDate;
53
78
  destProject: ContainerResolution | null;
54
79
  /** Status of the resolved destination project (reopen hazard, T19). */
55
80
  destProjectStatus: TaskStatus | null;
@@ -70,6 +95,13 @@ export interface PreState {
70
95
  entityTarget: ContainerResolution | null;
71
96
  /** tag.delete: descendant tags that a delete would CASCADE onto (P16). */
72
97
  childTags: string[];
98
+ /**
99
+ * area.delete: live (non-trashed) member counts, direct to-dos and projects
100
+ * carrying the area's FK. A non-empty area's delete trashes its to-dos and
101
+ * takes its projects with it (A25/A25B), so the delete refuses unless the
102
+ * caller allows it. Null for non-area ops (and when the area did not resolve).
103
+ */
104
+ areaMembers: AreaMemberCounts | null;
73
105
  /** project.complete / project.cancel: children by pre-status. */
74
106
  openChildren: Todo[];
75
107
  canceledChildren: Todo[];
@@ -96,8 +128,25 @@ export interface PreState {
96
128
  * counts how many of these are dead post-op. Null for non-project ops.
97
129
  */
98
130
  repeatSubtreeUuids: string[] | null;
99
- /** heading.convert-to-project: the project-reveal + heading-row ordinal (HEADCERT1). */
131
+ /** project.promote-heading: the project-reveal + heading-row ordinal (HEADCERT1). */
100
132
  headingConvert: HeadingConvertTaxonomy | null;
133
+ /** project.move-heading: current heading order + computed target order. */
134
+ headingMove: HeadingMovePre | null;
135
+ /** project.move-heading-to-project: source reveal + heading + destination (HEADXPROJ). */
136
+ headingMoveToProject: HeadingMoveToProjectTaxonomy | null;
137
+ /** project.dissolve-heading: parent reveal + heading title + children (DISS1). */
138
+ headingDissolve: HeadingDissolveTaxonomy | null;
139
+ }
140
+ /** project.move-heading pre-computation (spec §2/§4). */
141
+ export interface HeadingMovePre {
142
+ /** Destination project resolution (the container the headings live in). */
143
+ project: ContainerResolution;
144
+ /** The project's non-trashed heading uuids in current display (index) order. */
145
+ current: string[];
146
+ /** Full target order after moving the block — feeds the native wire + delta. */
147
+ targetOrder: string[];
148
+ /** Reasons the move is illegal (empty = ok). */
149
+ problems: string[];
101
150
  }
102
151
  /**
103
152
  * Row-selection taxonomy for `project.make-repeating` (UIC4-f). A project is
@@ -133,6 +182,15 @@ export type ProjectRepeatTaxonomy = {
133
182
  detail: string;
134
183
  };
135
184
  export declare function emptyPreState(): PreState;
185
+ /**
186
+ * Read a project's current heading order and compute the FULL target order
187
+ * after moving `headings` (an ordered block) to the requested placement. The
188
+ * block lands contiguously in selection order; every other heading keeps its
189
+ * relative order. Children follow their heading on the wire (scf P1). Illegal
190
+ * requests (unknown/duplicated movee, an anchor that is a movee or absent)
191
+ * collect problems and leave the order unchanged.
192
+ */
193
+ export declare function computeHeadingMovePre(db: DatabaseSync, project: ContainerResolution, headings: string[], placement: HeadingPlacement): HeadingMovePre;
136
194
  /**
137
195
  * The uuids of a project's source subtree rows (non-trashed to-dos AND
138
196
  * headings, direct or heading-nested). `childrenReplaced` counts how many of
@@ -141,7 +199,7 @@ export declare function emptyPreState(): PreState;
141
199
  */
142
200
  export declare function projectSubtreeUuids(db: DatabaseSync, projectUuid: string): string[];
143
201
  /**
144
- * Taxonomy for `heading.convert-to-project`'s pure-AX drive (HEADCERT1). A
202
+ * Taxonomy for `project.promote-heading`'s pure-AX drive (HEADCERT1). A
145
203
  * heading is not selectable via `things:///show` (the reveal URL selects to-dos
146
204
  * only — the UIC1 blocker), but revealing the heading's PARENT PROJECT shows its
147
205
  * content table, in which the heading renders as a selectable ROW. The row
@@ -162,6 +220,74 @@ export type HeadingConvertTaxonomy = {
162
220
  detail: string;
163
221
  };
164
222
  export declare function classifyHeadingConvert(db: DatabaseSync, target: AnyTask | null): HeadingConvertTaxonomy;
223
+ /**
224
+ * Taxonomy for `project.move-heading-to-project`'s ellipsis-`Move…` drive
225
+ * (HEADXPROJ). Unlike the promote drive (positional), the heading row is
226
+ * TITLE-addressable: its `…` button is an AXUnknown whose AXDescription is
227
+ * `"More. <title>"`, so the recipe HID-clicks that button, then `Move…`, then
228
+ * TYPES the destination project title into the search picker and presses Return.
229
+ * Two collision surfaces therefore fail closed: (a) the SOURCE heading title is
230
+ * shared by another heading in the same project (the `"More. <title>"` node
231
+ * matches both — indistinguishable), and (b) the DESTINATION title is shared by
232
+ * another project (the picker is search-by-title — Return would pick the wrong
233
+ * row). A titleless heading is refused (its `"More. "` description matches every
234
+ * titleless heading). Verify oracle: the heading row's `project` FK becomes the
235
+ * destination (children follow via their intact heading FK — a single-row change).
236
+ */
237
+ export interface HeadingMoveToProjectPre {
238
+ /** Source project revealed via things:///show?id= to render the heading row. */
239
+ sourceProjectUuid: string;
240
+ /** The heading being moved (the verify oracle's target row). */
241
+ headingUuid: string;
242
+ /** The heading title — the `"More. <title>"` click target. */
243
+ headingTitle: string;
244
+ /** The destination project — the heading's `project` FK becomes this post-op. */
245
+ destProjectUuid: string;
246
+ /** The destination title typed into the Move… search picker. */
247
+ destProjectTitle: string;
248
+ }
249
+ export type HeadingMoveToProjectRefusal = "no-source" | "heading-not-found" | "heading-ambiguous" | "empty-heading-title" | "no-dest" | "dest-ambiguous" | "same-project";
250
+ export type HeadingMoveToProjectTaxonomy = {
251
+ kind: "ok";
252
+ pre: HeadingMoveToProjectPre;
253
+ } | {
254
+ kind: "refuse";
255
+ refusal: HeadingMoveToProjectRefusal;
256
+ detail: string;
257
+ candidates?: string[];
258
+ };
259
+ export declare function classifyHeadingMoveToProject(db: DatabaseSync, project: ContainerRef, headingSel: string, toProject: ContainerRef): HeadingMoveToProjectTaxonomy;
260
+ /**
261
+ * Taxonomy for `project.dissolve-heading`'s ellipsis-`Delete` drive (DISS1). Same
262
+ * title-addressed `"More. <title>"` reveal as the cross-project move, driving the
263
+ * popover's Delete instead of Move…. DISS1 (2026-07-28, Things 3.22.11): Delete
264
+ * HARD-DELETES the heading row (removed from TMTask) while its children become
265
+ * DIRECT project children (heading→NULL, project→the parent, index preserved,
266
+ * NOT trashed) — no confirm sheet. Contrast the Shortcuts delete cascade (P12),
267
+ * which TRASHES the children. Fails closed on a title shared by another heading in
268
+ * the project (the drive addresses by title) and on a titleless heading.
269
+ */
270
+ export interface HeadingDissolvePre {
271
+ /** Parent project revealed via things:///show?id= to render the heading row. */
272
+ projectReveal: string;
273
+ /** The heading being dissolved (the verify oracle's gone-target). */
274
+ headingUuid: string;
275
+ /** The heading title — the `"More. <title>"` click target. */
276
+ headingTitle: string;
277
+ /** Open children that become direct project children (for the result note). */
278
+ childUuids: string[];
279
+ }
280
+ export type HeadingDissolveRefusal = "not-a-heading" | "no-project" | "title-ambiguous" | "empty-title";
281
+ export type HeadingDissolveTaxonomy = {
282
+ kind: "ok";
283
+ pre: HeadingDissolvePre;
284
+ } | {
285
+ kind: "refuse";
286
+ refusal: HeadingDissolveRefusal;
287
+ detail: string;
288
+ candidates?: string[];
289
+ };
290
+ export declare function classifyHeadingDissolve(db: DatabaseSync, target: AnyTask | null): HeadingDissolveTaxonomy;
165
291
  /**
166
292
  * Classify a project for `project.make-repeating`'s pure-AX row-selection
167
293
  * recipe (UIC4-f), or refuse. Reads DB truth (area / start / template / status)
@@ -170,8 +296,19 @@ export declare function classifyHeadingConvert(db: DatabaseSync, target: AnyTask
170
296
  */
171
297
  export declare function classifyProjectRepeat(db: DatabaseSync, target: AnyTask | null): ProjectRepeatTaxonomy;
172
298
  export declare function resolveArea(db: DatabaseSync, ref: ContainerRef): ContainerResolution;
299
+ /**
300
+ * Resolve a project DESTINATION (`--to-project` / `--project` on add/move). NAME
301
+ * resolution is OPEN-only (`status = 0`) — a completed/canceled project is not a
302
+ * valid live destination by name: placing an open child there strands it (PLOG1,
303
+ * "a completed-in-place project strands children identically, one sweep later").
304
+ * A UUID / partial-uuid still reaches a completed project (explicit intent —
305
+ * `nameExtraWhere` narrows the NAME tiers only). When a name matches ONLY non-open
306
+ * projects, the resolution carries a `deadHint` so the destination not-found says
307
+ * the row exists and how to reach it (by uuid), instead of a bare "project not
308
+ * found".
309
+ */
173
310
  export declare function resolveProject(db: DatabaseSync, ref: ContainerRef): ContainerResolution;
174
- export declare function resolveHeading(db: DatabaseSync, projectUuid: string, headingTitle: string): ContainerResolution;
311
+ export declare function resolveHeading(db: DatabaseSync, projectUuid: string, headingSel: string): ContainerResolution;
175
312
  export declare function projectStatus(db: DatabaseSync, uuid: string): TaskStatus | null;
176
313
  export declare function resolveTag(db: DatabaseSync, ref: string): ContainerResolution;
177
314
  export declare function loadTarget(db: DatabaseSync, uuid: string): AnyTask | null;
@@ -194,6 +331,14 @@ export declare function projectChildren(db: DatabaseSync, projectUuid: string):
194
331
  * them. UNION (not UNION ALL): a parent cycle must terminate, not hang.
195
332
  */
196
333
  export declare function childTagTitles(db: DatabaseSync, tagUuid: string): string[];
334
+ /**
335
+ * Live member census for `area.delete` (A25/A25B). Counts the area's non-trashed
336
+ * DIRECT members: to-dos carrying the area FK (any status — a logged to-do is
337
+ * still trashed by the delete) and projects carrying the area FK. Deleting a
338
+ * non-empty area trashes the to-dos and takes the projects with it, so the guard
339
+ * uses these counts to refuse fail-closed unless the caller allows it.
340
+ */
341
+ export declare function areaMemberCounts(db: DatabaseSync, areaUuid: string): AreaMemberCounts;
197
342
  export declare function trashedCount(db: DatabaseSync): number;
198
343
  export declare function isRepeatingTemplate(task: AnyTask | null): boolean;
199
344
  /**
@@ -212,8 +357,6 @@ export declare function isRepeatingTemplate(task: AnyTask | null): boolean;
212
357
  * unprobed and the guard rejects them.
213
358
  * - inbox: unscheduled to-dos with no container (start=0), by "index"
214
359
  * (A6/P8a — the command ranks the sent list in order).
215
- * - headings: the HEADING rows (type=2) of a project, by "index" (scf P1 —
216
- * the private command accepts heading uuids; children follow).
217
360
  * - someday: loose someday to-dos AND area-less someday projects, by
218
361
  * "index"; same-type requests only. The Someday list handler is
219
362
  * anchor-stacked with OPPOSITE stack directions by row type:
@@ -224,4 +367,15 @@ export declare function isRepeatingTemplate(task: AnyTask | null): boolean;
224
367
  * when=anytime round-trip front-inserts (P8e).
225
368
  */
226
369
  export declare function computeReorderPre(db: DatabaseSync, params: ReorderParams, containerUuid: string | null, now: Date): ReorderPre;
227
- export declare function projectOf(task: AnyTask | null): Project | null;
370
+ /**
371
+ * A row's live Today/Evening flag — `"today"`, `"evening"`, or `null` — read
372
+ * from the SAME marker the `today`/`evening` reorder membership uses
373
+ * ({@link computeReorderPre}, O01/O03/§9n): an ARRIVED scheduled row
374
+ * (`start IN (1,2)` AND `startDate <= today`) carries the flag — `evening` at
375
+ * raw `startBucket=1` (a live evening flag expires daily, so a stale past-dated
376
+ * bucket-1 row reads `today` proper), `today` otherwise. Someday, anytime,
377
+ * inbox, and future-scheduled rows carry NO flag. Single-sourced here so any
378
+ * de-Today guard (e.g. the `projects` bounce's de-star refusal in reorder.ts)
379
+ * keys off the one marker and can never drift from the membership query.
380
+ */
381
+ export declare function todayEveningFlagOf(db: DatabaseSync, uuid: string, now: Date): "today" | "evening" | null;