things-api 0.10.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 (239) hide show
  1. package/README.md +50 -13
  2. package/dist/audit/schema.d.ts +7 -0
  3. package/dist/audit/schema.js.map +1 -1
  4. package/dist/cli/clock.d.ts +8 -0
  5. package/dist/cli/clock.js +24 -0
  6. package/dist/cli/clock.js.map +1 -0
  7. package/dist/cli/commands/area.d.ts +18 -11
  8. package/dist/cli/commands/area.js +61 -74
  9. package/dist/cli/commands/area.js.map +1 -1
  10. package/dist/cli/commands/doctor.d.ts +1 -2
  11. package/dist/cli/commands/doctor.js +11 -1
  12. package/dist/cli/commands/doctor.js.map +1 -1
  13. package/dist/cli/commands/install-skill.d.ts +60 -0
  14. package/dist/cli/commands/install-skill.js +256 -0
  15. package/dist/cli/commands/install-skill.js.map +1 -0
  16. package/dist/cli/commands/mcp.js +9 -0
  17. package/dist/cli/commands/mcp.js.map +1 -1
  18. package/dist/cli/commands/project.d.ts +1 -0
  19. package/dist/cli/commands/project.js +27 -34
  20. package/dist/cli/commands/project.js.map +1 -1
  21. package/dist/cli/commands/reads.d.ts +15 -2
  22. package/dist/cli/commands/reads.js +144 -44
  23. package/dist/cli/commands/reads.js.map +1 -1
  24. package/dist/cli/commands/setup.js +7 -2
  25. package/dist/cli/commands/setup.js.map +1 -1
  26. package/dist/cli/commands/show.js +38 -14
  27. package/dist/cli/commands/show.js.map +1 -1
  28. package/dist/cli/commands/todo.js +15 -9
  29. package/dist/cli/commands/todo.js.map +1 -1
  30. package/dist/cli/commands/writes.js +797 -174
  31. package/dist/cli/commands/writes.js.map +1 -1
  32. package/dist/cli/did-you-mean.d.ts +14 -3
  33. package/dist/cli/did-you-mean.js +26 -3
  34. package/dist/cli/did-you-mean.js.map +1 -1
  35. package/dist/cli/glyphs.d.ts +32 -2
  36. package/dist/cli/glyphs.js +83 -12
  37. package/dist/cli/glyphs.js.map +1 -1
  38. package/dist/cli/help.js +121 -16
  39. package/dist/cli/help.js.map +1 -1
  40. package/dist/cli/main.js +33 -2
  41. package/dist/cli/main.js.map +1 -1
  42. package/dist/cli/move-hint.d.ts +46 -0
  43. package/dist/cli/move-hint.js +196 -0
  44. package/dist/cli/move-hint.js.map +1 -0
  45. package/dist/cli/period.d.ts +2 -8
  46. package/dist/cli/period.js +44 -30
  47. package/dist/cli/period.js.map +1 -1
  48. package/dist/cli/read-driver.d.ts +43 -5
  49. package/dist/cli/read-driver.js +91 -15
  50. package/dist/cli/read-driver.js.map +1 -1
  51. package/dist/cli/render.d.ts +19 -8
  52. package/dist/cli/render.js +70 -27
  53. package/dist/cli/render.js.map +1 -1
  54. package/dist/cli/resolve-invocation.d.ts +2 -2
  55. package/dist/cli/resolve-invocation.js +3 -3
  56. package/dist/cli/resolve-invocation.js.map +1 -1
  57. package/dist/cli/skill-check.d.ts +27 -0
  58. package/dist/cli/skill-check.js +99 -0
  59. package/dist/cli/skill-check.js.map +1 -0
  60. package/dist/cli/skill.d.ts +70 -0
  61. package/dist/cli/skill.js +152 -0
  62. package/dist/cli/skill.js.map +1 -0
  63. package/dist/cli/tag-filters.d.ts +6 -2
  64. package/dist/cli/tag-filters.js +8 -6
  65. package/dist/cli/tag-filters.js.map +1 -1
  66. package/dist/cli/verb-hint.js +28 -3
  67. package/dist/cli/verb-hint.js.map +1 -1
  68. package/dist/cli/version.d.ts +4 -0
  69. package/dist/cli/version.js +18 -0
  70. package/dist/cli/version.js.map +1 -0
  71. package/dist/client.d.ts +171 -27
  72. package/dist/client.js +279 -40
  73. package/dist/client.js.map +1 -1
  74. package/dist/config.d.ts +66 -2
  75. package/dist/config.js +120 -12
  76. package/dist/config.js.map +1 -1
  77. package/dist/contracts.d.ts +186 -28
  78. package/dist/contracts.js +22 -1
  79. package/dist/contracts.js.map +1 -1
  80. package/dist/diagnose.d.ts +34 -2
  81. package/dist/diagnose.js +36 -1
  82. package/dist/diagnose.js.map +1 -1
  83. package/dist/index.d.ts +25 -9
  84. package/dist/index.js +22 -3
  85. package/dist/index.js.map +1 -1
  86. package/dist/mcp/server.d.ts +9 -0
  87. package/dist/mcp/server.js +1157 -684
  88. package/dist/mcp/server.js.map +1 -1
  89. package/dist/model/clock.d.ts +61 -0
  90. package/dist/model/clock.js +71 -0
  91. package/dist/model/clock.js.map +1 -0
  92. package/dist/model/dates.d.ts +26 -3
  93. package/dist/model/dates.js +84 -3
  94. package/dist/model/dates.js.map +1 -1
  95. package/dist/model/entities.d.ts +60 -3
  96. package/dist/model/entities.js.map +1 -1
  97. package/dist/model/mappers.d.ts +4 -2
  98. package/dist/model/mappers.js +66 -9
  99. package/dist/model/mappers.js.map +1 -1
  100. package/dist/model/recurrence.d.ts +8 -1
  101. package/dist/model/recurrence.js.map +1 -1
  102. package/dist/read/area-filter.d.ts +76 -0
  103. package/dist/read/area-filter.js +59 -0
  104. package/dist/read/area-filter.js.map +1 -0
  105. package/dist/read/area-view.d.ts +12 -12
  106. package/dist/read/area-view.js +58 -34
  107. package/dist/read/area-view.js.map +1 -1
  108. package/dist/read/detail.d.ts +1 -1
  109. package/dist/read/detail.js +26 -12
  110. package/dist/read/detail.js.map +1 -1
  111. package/dist/read/log-boundary.d.ts +1 -1
  112. package/dist/read/log-boundary.js +13 -3
  113. package/dist/read/log-boundary.js.map +1 -1
  114. package/dist/read/predicates.d.ts +18 -0
  115. package/dist/read/predicates.js +19 -0
  116. package/dist/read/predicates.js.map +1 -1
  117. package/dist/read/project-view.d.ts +32 -16
  118. package/dist/read/project-view.js +80 -45
  119. package/dist/read/project-view.js.map +1 -1
  120. package/dist/read/pseudo-area.d.ts +29 -0
  121. package/dist/read/pseudo-area.js +27 -0
  122. package/dist/read/pseudo-area.js.map +1 -0
  123. package/dist/read/queries.d.ts +108 -19
  124. package/dist/read/queries.js +212 -35
  125. package/dist/read/queries.js.map +1 -1
  126. package/dist/read/scope.d.ts +126 -0
  127. package/dist/read/scope.js +162 -0
  128. package/dist/read/scope.js.map +1 -0
  129. package/dist/read/search-rank.d.ts +2 -5
  130. package/dist/read/shape.d.ts +162 -0
  131. package/dist/read/shape.js +686 -0
  132. package/dist/read/shape.js.map +1 -0
  133. package/dist/read/show-target.d.ts +9 -1
  134. package/dist/read/show-target.js +45 -4
  135. package/dist/read/show-target.js.map +1 -1
  136. package/dist/read/snapshot.d.ts +1 -1
  137. package/dist/read/snapshot.js +9 -2
  138. package/dist/read/snapshot.js.map +1 -1
  139. package/dist/read/stage.d.ts +199 -0
  140. package/dist/read/stage.js +125 -0
  141. package/dist/read/stage.js.map +1 -0
  142. package/dist/read/truncation.d.ts +8 -6
  143. package/dist/read/truncation.js +35 -10
  144. package/dist/read/truncation.js.map +1 -1
  145. package/dist/read/views.d.ts +61 -20
  146. package/dist/read/views.js +240 -82
  147. package/dist/read/views.js.map +1 -1
  148. package/dist/surface-copy.d.ts +9 -0
  149. package/dist/surface-copy.js +9 -0
  150. package/dist/surface-copy.js.map +1 -1
  151. package/dist/write/accessibility-probe.d.ts +1 -1
  152. package/dist/write/accessibility-probe.js +8 -0
  153. package/dist/write/accessibility-probe.js.map +1 -1
  154. package/dist/write/automation-probe.d.ts +1 -1
  155. package/dist/write/automation-probe.js +8 -0
  156. package/dist/write/automation-probe.js.map +1 -1
  157. package/dist/write/batch.d.ts +49 -10
  158. package/dist/write/batch.js +423 -70
  159. package/dist/write/batch.js.map +1 -1
  160. package/dist/write/commands.d.ts +1 -1
  161. package/dist/write/commands.js +316 -66
  162. package/dist/write/commands.js.map +1 -1
  163. package/dist/write/guards.d.ts +1 -1
  164. package/dist/write/guards.js +94 -10
  165. package/dist/write/guards.js.map +1 -1
  166. package/dist/write/heading.d.ts +10 -1
  167. package/dist/write/heading.js +35 -5
  168. package/dist/write/heading.js.map +1 -1
  169. package/dist/write/make-repeating-project.d.ts +2 -2
  170. package/dist/write/make-repeating-project.js +9 -9
  171. package/dist/write/make-repeating-project.js.map +1 -1
  172. package/dist/write/move.d.ts +130 -0
  173. package/dist/write/move.js +1533 -0
  174. package/dist/write/move.js.map +1 -0
  175. package/dist/write/operations.d.ts +105 -19
  176. package/dist/write/operations.js +56 -7
  177. package/dist/write/operations.js.map +1 -1
  178. package/dist/write/opid.d.ts +31 -0
  179. package/dist/write/opid.js +30 -0
  180. package/dist/write/opid.js.map +1 -0
  181. package/dist/write/pipeline.d.ts +122 -3
  182. package/dist/write/pipeline.js +309 -52
  183. package/dist/write/pipeline.js.map +1 -1
  184. package/dist/write/planner.js +8 -1
  185. package/dist/write/planner.js.map +1 -1
  186. package/dist/write/pre-state.d.ts +197 -6
  187. package/dist/write/pre-state.js +427 -20
  188. package/dist/write/pre-state.js.map +1 -1
  189. package/dist/write/recurrence-rule-blob.d.ts +65 -0
  190. package/dist/write/recurrence-rule-blob.js +150 -0
  191. package/dist/write/recurrence-rule-blob.js.map +1 -0
  192. package/dist/write/reorder.d.ts +23 -3
  193. package/dist/write/reorder.js +1871 -85
  194. package/dist/write/reorder.js.map +1 -1
  195. package/dist/write/reversibility.js +19 -7
  196. package/dist/write/reversibility.js.map +1 -1
  197. package/dist/write/scope-guard.d.ts +31 -0
  198. package/dist/write/scope-guard.js +162 -0
  199. package/dist/write/scope-guard.js.map +1 -0
  200. package/dist/write/undo.js +120 -13
  201. package/dist/write/undo.js.map +1 -1
  202. package/dist/write/vectors/applescript.js +16 -7
  203. package/dist/write/vectors/applescript.js.map +1 -1
  204. package/dist/write/vectors/registry.d.ts +5 -7
  205. package/dist/write/vectors/registry.js +49 -2
  206. package/dist/write/vectors/registry.js.map +1 -1
  207. package/dist/write/vectors/shortcuts.js +1 -1
  208. package/dist/write/vectors/shortcuts.js.map +1 -1
  209. package/dist/write/vectors/simulator.d.ts +44 -0
  210. package/dist/write/vectors/simulator.js +1192 -0
  211. package/dist/write/vectors/simulator.js.map +1 -0
  212. package/dist/write/vectors/types.d.ts +46 -0
  213. package/dist/write/vectors/ui-certification.d.ts +10 -4
  214. package/dist/write/vectors/ui-certification.js +43 -10
  215. package/dist/write/vectors/ui-certification.js.map +1 -1
  216. package/dist/write/vectors/ui-drag.d.ts +21 -1
  217. package/dist/write/vectors/ui-drag.js +138 -27
  218. package/dist/write/vectors/ui-drag.js.map +1 -1
  219. package/dist/write/vectors/ui-recipes.d.ts +34 -1
  220. package/dist/write/vectors/ui-recipes.js +217 -6
  221. package/dist/write/vectors/ui-recipes.js.map +1 -1
  222. package/dist/write/vectors/ui.d.ts +40 -1
  223. package/dist/write/vectors/ui.js +196 -39
  224. package/dist/write/vectors/ui.js.map +1 -1
  225. package/dist/write/verify/delta.d.ts +127 -2
  226. package/dist/write/verify/delta.js +255 -16
  227. package/dist/write/verify/delta.js.map +1 -1
  228. package/dist/write/verify/poller.d.ts +7 -1
  229. package/dist/write/verify/poller.js +20 -1
  230. package/dist/write/verify/poller.js.map +1 -1
  231. package/package.json +24 -3
  232. package/schema/envelope.schema.json +383 -0
  233. package/skills/things-cli/SKILL.md +70 -0
  234. package/skills/things-cli/references/banner.md +35 -0
  235. package/skills/things-cli/references/contracts.md +62 -0
  236. package/skills/things-cli/references/errors.md +49 -0
  237. package/skills/things-cli/references/gui.md +11 -0
  238. package/skills/things-cli/references/model.md +60 -0
  239. 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[];
@@ -90,6 +122,31 @@ export interface PreState {
90
122
  areaOrder: string[] | null;
91
123
  /** project.make-repeating: the row-selection taxonomy (UIC4-f). */
92
124
  projectRepeat: ProjectRepeatTaxonomy | null;
125
+ /**
126
+ * project.make-repeating: the uuids of the source subtree rows (non-trashed
127
+ * to-dos + headings) captured pre-write — the result's `childrenReplaced`
128
+ * counts how many of these are dead post-op. Null for non-project ops.
129
+ */
130
+ repeatSubtreeUuids: string[] | null;
131
+ /** project.promote-heading: the project-reveal + heading-row ordinal (HEADCERT1). */
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[];
93
150
  }
94
151
  /**
95
152
  * Row-selection taxonomy for `project.make-repeating` (UIC4-f). A project is
@@ -125,6 +182,112 @@ export type ProjectRepeatTaxonomy = {
125
182
  detail: string;
126
183
  };
127
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;
194
+ /**
195
+ * The uuids of a project's source subtree rows (non-trashed to-dos AND
196
+ * headings, direct or heading-nested). `childrenReplaced` counts how many of
197
+ * these are dead post-op — the whole subtree in the delete-remint fate, just
198
+ * the flattened nested-template row in the nested-repeater preserve fate.
199
+ */
200
+ export declare function projectSubtreeUuids(db: DatabaseSync, projectUuid: string): string[];
201
+ /**
202
+ * Taxonomy for `project.promote-heading`'s pure-AX drive (HEADCERT1). A
203
+ * heading is not selectable via `things:///show` (the reveal URL selects to-dos
204
+ * only — the UIC1 blocker), but revealing the heading's PARENT PROJECT shows its
205
+ * content table, in which the heading renders as a selectable ROW. The row
206
+ * exposes no stable AX title handle (its title lives only in a hover-dependent
207
+ * "More" affordance), so identity is POSITIONAL: `ordinal` is the heading's
208
+ * 0-based position among the project's non-trashed headings in display (`index`)
209
+ * order, and the select-heading-row primitive walks the content table selecting
210
+ * the Nth row that is selectable AND has an empty `selected to dos` readback (a
211
+ * heading, not a to-do). Two same-titled headings are therefore unambiguous.
212
+ */
213
+ export type HeadingConvertTaxonomy = {
214
+ kind: "ok";
215
+ projectReveal: string;
216
+ ordinal: number;
217
+ } | {
218
+ kind: "refuse";
219
+ refusal: "not-a-heading" | "no-project" | "not-found";
220
+ detail: string;
221
+ };
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;
128
291
  /**
129
292
  * Classify a project for `project.make-repeating`'s pure-AX row-selection
130
293
  * recipe (UIC4-f), or refuse. Reads DB truth (area / start / template / status)
@@ -133,8 +296,19 @@ export declare function emptyPreState(): PreState;
133
296
  */
134
297
  export declare function classifyProjectRepeat(db: DatabaseSync, target: AnyTask | null): ProjectRepeatTaxonomy;
135
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
+ */
136
310
  export declare function resolveProject(db: DatabaseSync, ref: ContainerRef): ContainerResolution;
137
- export declare function resolveHeading(db: DatabaseSync, projectUuid: string, headingTitle: string): ContainerResolution;
311
+ export declare function resolveHeading(db: DatabaseSync, projectUuid: string, headingSel: string): ContainerResolution;
138
312
  export declare function projectStatus(db: DatabaseSync, uuid: string): TaskStatus | null;
139
313
  export declare function resolveTag(db: DatabaseSync, ref: string): ContainerResolution;
140
314
  export declare function loadTarget(db: DatabaseSync, uuid: string): AnyTask | null;
@@ -157,6 +331,14 @@ export declare function projectChildren(db: DatabaseSync, projectUuid: string):
157
331
  * them. UNION (not UNION ALL): a parent cycle must terminate, not hang.
158
332
  */
159
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;
160
342
  export declare function trashedCount(db: DatabaseSync): number;
161
343
  export declare function isRepeatingTemplate(task: AnyTask | null): boolean;
162
344
  /**
@@ -175,8 +357,6 @@ export declare function isRepeatingTemplate(task: AnyTask | null): boolean;
175
357
  * unprobed and the guard rejects them.
176
358
  * - inbox: unscheduled to-dos with no container (start=0), by "index"
177
359
  * (A6/P8a — the command ranks the sent list in order).
178
- * - headings: the HEADING rows (type=2) of a project, by "index" (scf P1 —
179
- * the private command accepts heading uuids; children follow).
180
360
  * - someday: loose someday to-dos AND area-less someday projects, by
181
361
  * "index"; same-type requests only. The Someday list handler is
182
362
  * anchor-stacked with OPPOSITE stack directions by row type:
@@ -187,4 +367,15 @@ export declare function isRepeatingTemplate(task: AnyTask | null): boolean;
187
367
  * when=anytime round-trip front-inserts (P8e).
188
368
  */
189
369
  export declare function computeReorderPre(db: DatabaseSync, params: ReorderParams, containerUuid: string | null, now: Date): ReorderPre;
190
- 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;