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
@@ -0,0 +1,150 @@
1
+ /**
2
+ * The recurrence-rule SERIALIZER — the write-side inverse of the read-only
3
+ * decoder in {@link ../model/recurrence.ts}. It composes the `rt1_recurrenceRule`
4
+ * XML plist the Things app writes for a repeating template, in the exact shape
5
+ * the decoder round-trips (rrv=4, the `of` offset grammar, the year-4001 "forever"
6
+ * `ed` sentinel).
7
+ *
8
+ * Two consumers share it, and NEITHER writes to a real Things database:
9
+ * - the SIMULATOR write vector (src/write/vectors/simulator.ts), which applies
10
+ * the RSIM-characterized recurrence mutations as SQL against a synthetic
11
+ * fixture DB (docs/lab/rsim-results.md); and
12
+ * - the bench WORLD profile (bench/world.ts), which seeds synthetic templates.
13
+ *
14
+ * Repeat rules remain UI-only on any real surface (writes go through the app's
15
+ * Repeat dialog, never SQLite) — this serializer exists solely so bench/simulated
16
+ * writes can reproduce the app's row shape without a Things install. The
17
+ * low-level {@link ruleXml} takes a numeric {@link RuleSpec}; {@link composeRepeatRuleSpec}
18
+ * maps the consumer-facing {@link RepeatRuleParams} vocabulary onto that spec.
19
+ */
20
+ import {} from "../model/dates.js";
21
+ import { WEEKDAY_TO_WD } from "./repeat-rule.js";
22
+ /** Distant-future `ed` sentinel (year 4001 — the same class the app writes). */
23
+ export const RULE_FOREVER = 64_092_211_200;
24
+ /** Recurrence-unit code for each frequency (mirrors the decoder's UNITS map). */
25
+ export const FREQUENCY_TO_FU = {
26
+ daily: 16,
27
+ weekly: 256,
28
+ monthly: 8,
29
+ yearly: 4,
30
+ };
31
+ /** Compose an `rt1_recurrenceRule` XML plist the read-path decoder accepts. */
32
+ export function ruleXml(spec) {
33
+ const offsets = (spec.of ?? [{ dy: 0 }])
34
+ .map((o) => {
35
+ const entries = Object.entries(o)
36
+ .map(([k, v]) => `<key>${k}</key><integer>${v}</integer>`)
37
+ .join("");
38
+ return `<dict>${entries}</dict>`;
39
+ })
40
+ .join("");
41
+ return (`<?xml version="1.0" encoding="UTF-8"?>\n` +
42
+ `<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n` +
43
+ `<plist version="1.0"><dict>` +
44
+ `<key>ed</key><integer>${spec.ed ?? RULE_FOREVER}</integer>` +
45
+ `<key>fa</key><integer>${spec.fa}</integer>` +
46
+ `<key>fu</key><integer>${spec.fu}</integer>` +
47
+ `<key>ia</key><integer>${spec.anchor}</integer>` +
48
+ `<key>of</key><array>${offsets}</array>` +
49
+ `<key>rc</key><integer>${spec.rc ?? 0}</integer>` +
50
+ `<key>rrv</key><integer>4</integer>` +
51
+ `<key>sr</key><integer>${spec.anchor}</integer>` +
52
+ `<key>tp</key><integer>${spec.tp}</integer>` +
53
+ `<key>ts</key><integer>${spec.ts ?? 0}</integer>` +
54
+ `</dict></plist>\n`);
55
+ }
56
+ // -------------------------------------------------- vocabulary → spec
57
+ const ymd = (iso) => iso.split("-").map(Number);
58
+ /** Weekday (0 = Sunday) of an ISO date, evaluated at UTC noon (tz-invariant). */
59
+ function weekdayOf(iso) {
60
+ const [y, m, d] = ymd(iso);
61
+ return new Date(Date.UTC(y, m - 1, d, 12)).getUTCDay();
62
+ }
63
+ /**
64
+ * The `of` offsets for a rule. A FIXED rule anchors on its calendar placement —
65
+ * the explicit weekdays/monthly/yearly anchor when given, else derived from the
66
+ * occurrence date (`refIso`): a weekly rule fires on the occurrence's weekday, a
67
+ * monthly one on its day-of-month, a yearly one on its month + day. An
68
+ * AFTER-COMPLETION rule has NO calendar day, so Things writes only the unit's
69
+ * nominal zero-index offset (UIC6-e: weekly of=[{wd:0}], monthly of=[{dy:0}]);
70
+ * the decoder ignores it. Only the weekly after-completion shape is RSIM-proven
71
+ * (RSIM2); the daily/monthly/yearly nominals follow the UIC6-e convention.
72
+ */
73
+ function composeOffsets(params, refIso) {
74
+ if (params.afterCompletion === true) {
75
+ switch (params.frequency) {
76
+ case "daily":
77
+ return [{ dy: 0 }];
78
+ case "weekly":
79
+ return [{ wd: 0 }];
80
+ case "monthly":
81
+ return [{ dy: 0 }];
82
+ case "yearly":
83
+ return [{ mo: 0, dy: 0 }];
84
+ }
85
+ }
86
+ switch (params.frequency) {
87
+ case "daily":
88
+ return [{ dy: 0 }];
89
+ case "weekly": {
90
+ if (params.weekdays !== undefined) {
91
+ return params.weekdays.map((w) => ({ wd: WEEKDAY_TO_WD[w] }));
92
+ }
93
+ return [{ wd: weekdayOf(refIso) }];
94
+ }
95
+ case "monthly": {
96
+ const anchor = params.monthly;
97
+ if (anchor === undefined)
98
+ return [{ dy: ymd(refIso)[2] - 1 }];
99
+ return [monthlyOffset(anchor)];
100
+ }
101
+ case "yearly": {
102
+ const anchor = params.yearly;
103
+ if (anchor === undefined) {
104
+ const [, m, d] = ymd(refIso);
105
+ return [{ mo: m - 1, dy: d - 1 }];
106
+ }
107
+ return [{ mo: anchor.month - 1, ...monthlyOffset(anchor) }];
108
+ }
109
+ }
110
+ }
111
+ /** One month/year day anchor → its offset entry (day-of-month OR nth-weekday). */
112
+ function monthlyOffset(anchor) {
113
+ if ("day" in anchor) {
114
+ return { dy: anchor.day === "last" ? -1 : anchor.day - 1 };
115
+ }
116
+ return {
117
+ wd: WEEKDAY_TO_WD[anchor.weekday],
118
+ wdo: anchor.ordinal === "last" ? -1 : anchor.ordinal,
119
+ };
120
+ }
121
+ /**
122
+ * Map the extended {@link RepeatRuleParams} vocabulary onto a numeric
123
+ * {@link RuleSpec}. `refIso` is the occurrence date the calendar anchor derives
124
+ * from when no explicit anchor is given; `anchor` seeds the (decoder-ignored)
125
+ * sr/ia epochs. A deadlined rule carries the start-offset in `ts` (ts = −N days
126
+ * earlier); the template's own `deadline` sentinel column — set by the applier,
127
+ * not here — is what actually flags deadline-ness (oddities §8a).
128
+ */
129
+ export function composeRepeatRuleSpec(params, refIso, anchor) {
130
+ const deadlined = params.deadline === true || (params.startDaysEarlier ?? 0) > 0;
131
+ const spec = {
132
+ tp: params.afterCompletion === true ? 1 : 0,
133
+ fu: FREQUENCY_TO_FU[params.frequency],
134
+ fa: params.interval,
135
+ ts: deadlined ? -(params.startDaysEarlier ?? 0) : 0,
136
+ of: composeOffsets(params, refIso),
137
+ anchor,
138
+ };
139
+ const ends = params.ends;
140
+ if (ends !== undefined && ends.kind !== "never") {
141
+ if (ends.kind === "on-date") {
142
+ spec.ed = Math.floor(Date.parse(`${ends.date}T00:00:00Z`) / 1000);
143
+ }
144
+ else {
145
+ spec.rc = ends.count;
146
+ }
147
+ }
148
+ return spec;
149
+ }
150
+ //# sourceMappingURL=recurrence-rule-blob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recurrence-rule-blob.js","sourceRoot":"","sources":["../../src/write/recurrence-rule-blob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAA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AI,CAAC,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,10 +1,30 @@
1
1
  import type { ReorderParams } from "./operations.ts";
2
2
  import { type MutationResult, type WriteDeps, type WriteOptions } from "./pipeline.ts";
3
3
  /**
4
- * Bounce cost is 2 verified mutations per item; beyond this the today scope
5
- * should use the native strategy and the evening scope should be re-thought.
4
+ * DEFAULT bounce cap 2 verified mutations per item (~110 ms/item guest-local,
5
+ * BOUNCE2-t). The effective cap is `config.bounceMaxItems` (default 30); this
6
+ * constant is the built-in fallback used when a caller supplies no config value,
7
+ * and the figure surface copy cites.
6
8
  */
7
- export declare const BOUNCE_MAX_ITEMS = 10;
9
+ export declare const BOUNCE_MAX_ITEMS = 30;
10
+ /**
11
+ * The bounce re-entry law (reordgaps-results.md, BOUNCE2). A `when=` round-trip
12
+ * re-inserts the touched item; the DIRECTION depends on its containment context,
13
+ * and the away/back legs depend on its resting bucket:
14
+ * - loose/area-direct items FRONT-insert (reverse-order legs land target order)
15
+ * - strict-container children (heading/project) BACK-insert (forward-order legs)
16
+ * `away`/`back` are the two `when=` values of the round-trip; the resting bucket
17
+ * is `back`.
18
+ */
19
+ export type BounceKind = "today" | "evening" | "day" | "projects" | "heading" | "area-someday" | "anytime" | "project-someday" | "someday";
20
+ /**
21
+ * The bounce kinds whose N-item round-trip is eligible for the `things:///json`
22
+ * one-array collapse (BOUNCEJSON §9i) — exactly the classes whose placement
23
+ * (`back`) leg is `when=anytime` into a loose/heading-container bucket. Exported
24
+ * for the classification regression test (guards against "optimizing" a someday-
25
+ * placement or area-direct class into json, which §9i proves is a silent no-op).
26
+ */
27
+ export declare function bounceJsonCollapsible(kind: BounceKind): boolean;
8
28
  export type ReorderResult = MutationResult | {
9
29
  kind: "bounce-aborted";
10
30
  op: "reorder";