things-api 0.15.0 → 0.16.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 (90) hide show
  1. package/README.md +4 -4
  2. package/dist/audit/schema.d.ts +8 -0
  3. package/dist/audit/schema.js.map +1 -1
  4. package/dist/cli/commands/install-skill.js +9 -2
  5. package/dist/cli/commands/install-skill.js.map +1 -1
  6. package/dist/cli/commands/repeat-flags.d.ts +11 -1
  7. package/dist/cli/commands/repeat-flags.js +23 -0
  8. package/dist/cli/commands/repeat-flags.js.map +1 -1
  9. package/dist/cli/commands/todo.js +49 -2
  10. package/dist/cli/commands/todo.js.map +1 -1
  11. package/dist/cli/commands/writes.js +182 -61
  12. package/dist/cli/commands/writes.js.map +1 -1
  13. package/dist/cli/help.js +14 -11
  14. package/dist/cli/help.js.map +1 -1
  15. package/dist/cli/read-driver.d.ts +2 -2
  16. package/dist/cli/skill.d.ts +24 -0
  17. package/dist/cli/skill.js +40 -0
  18. package/dist/cli/skill.js.map +1 -1
  19. package/dist/client.d.ts +53 -12
  20. package/dist/client.js +6 -1
  21. package/dist/client.js.map +1 -1
  22. package/dist/contracts.d.ts +1 -1
  23. package/dist/contracts.js +1 -1
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/mcp/server.js +132 -31
  27. package/dist/mcp/server.js.map +1 -1
  28. package/dist/model/entities.d.ts +35 -0
  29. package/dist/model/entities.js.map +1 -1
  30. package/dist/read/detail.js +49 -1
  31. package/dist/read/detail.js.map +1 -1
  32. package/dist/read/queries.d.ts +12 -0
  33. package/dist/read/queries.js +14 -0
  34. package/dist/read/queries.js.map +1 -1
  35. package/dist/read/shape.d.ts +25 -22
  36. package/dist/read/shape.js +81 -55
  37. package/dist/read/shape.js.map +1 -1
  38. package/dist/read/stage.d.ts +5 -5
  39. package/dist/read/stage.js +2 -2
  40. package/dist/read/views.d.ts +1 -1
  41. package/dist/read/views.js +4 -4
  42. package/dist/surface-copy.d.ts +2 -2
  43. package/dist/surface-copy.js +2 -2
  44. package/dist/write/batch.d.ts +28 -3
  45. package/dist/write/batch.js +162 -46
  46. package/dist/write/batch.js.map +1 -1
  47. package/dist/write/clone.d.ts +4 -0
  48. package/dist/write/clone.js +531 -0
  49. package/dist/write/clone.js.map +1 -0
  50. package/dist/write/commands.js +90 -4
  51. package/dist/write/commands.js.map +1 -1
  52. package/dist/write/guards.d.ts +1 -1
  53. package/dist/write/guards.js +33 -5
  54. package/dist/write/guards.js.map +1 -1
  55. package/dist/write/make-repeating-project.d.ts +2 -3
  56. package/dist/write/make-repeating-project.js +2 -73
  57. package/dist/write/make-repeating-project.js.map +1 -1
  58. package/dist/write/move.js +8 -1
  59. package/dist/write/move.js.map +1 -1
  60. package/dist/write/operations.d.ts +131 -9
  61. package/dist/write/operations.js +4 -1
  62. package/dist/write/operations.js.map +1 -1
  63. package/dist/write/pipeline.d.ts +38 -0
  64. package/dist/write/pipeline.js +68 -3
  65. package/dist/write/pipeline.js.map +1 -1
  66. package/dist/write/pre-state.js +7 -1
  67. package/dist/write/pre-state.js.map +1 -1
  68. package/dist/write/preserve-modified.d.ts +55 -0
  69. package/dist/write/preserve-modified.js +106 -0
  70. package/dist/write/preserve-modified.js.map +1 -0
  71. package/dist/write/promote-clone.d.ts +32 -0
  72. package/dist/write/promote-clone.js +620 -0
  73. package/dist/write/promote-clone.js.map +1 -0
  74. package/dist/write/resolution-timestamps.js +22 -0
  75. package/dist/write/resolution-timestamps.js.map +1 -1
  76. package/dist/write/reversibility.js +27 -14
  77. package/dist/write/reversibility.js.map +1 -1
  78. package/dist/write/undo.d.ts +11 -1
  79. package/dist/write/undo.js +126 -10
  80. package/dist/write/undo.js.map +1 -1
  81. package/dist/write/vectors/simulator.js +32 -1
  82. package/dist/write/vectors/simulator.js.map +1 -1
  83. package/dist/write/vectors/ui-certification.d.ts +1 -1
  84. package/dist/write/vectors/ui-certification.js +10 -3
  85. package/dist/write/vectors/ui-certification.js.map +1 -1
  86. package/package.json +1 -1
  87. package/skills/things-cli/SKILL.md +3 -2
  88. package/skills/things-cli/references/banner.md +1 -1
  89. package/skills/things-cli/references/contracts.md +17 -9
  90. package/skills/things-cli/references/data-model.md +2 -1
@@ -2,6 +2,8 @@ import { resolveProjectWriteTarget, resolveTaskUuidPrefix } from "../read/querie
2
2
  import { resolutionDeltaDate } from "./commands.js";
3
3
  import { loadTarget, projectChildren } from "./pre-state.js";
4
4
  import { fingerprintLabel, runMutation, } from "./pipeline.js";
5
+ import { restoreModDates } from "./preserve-modified.js";
6
+ import { createDbReader } from "./verify/delta.js";
5
7
  /** Dispatch a cataloged op with dynamic (op-erased) params. */
6
8
  function exec(deps, op, params, options) {
7
9
  return runMutation(deps, op, params, options);
@@ -86,6 +88,13 @@ function appendSummary(deps, args) {
86
88
  async function runComposite(deps, summaryOp, uuid, legs, finalDelta, options) {
87
89
  if (options.dryRun === true)
88
90
  return dryRunComposite(summaryOp, uuid, legs, finalDelta);
91
+ // --preserve-modified: capture the target's umd BEFORE the first leg (each flip
92
+ // bumps it) and restore ONCE after the last (never per-leg — the leg options
93
+ // strip the flag). Single-target by construction (the resolution-timestamp
94
+ // compounds operate on one to-do/project).
95
+ const preUmd = options.preserveModified === true
96
+ ? createDbReader(deps.db, deps.now?.() ?? new Date(), deps.zone).modDateOf(uuid)
97
+ : null;
89
98
  const startedAt = deps.now?.() ?? new Date();
90
99
  const txnId = newTxnId(startedAt);
91
100
  const disclosure = legs.map((l, i) => `${i + 1}. ${l.describe}`).join(" → ");
@@ -117,11 +126,24 @@ async function runComposite(deps, summaryOp, uuid, legs, finalDelta, options) {
117
126
  invocation: `${summaryOp} (${legs.length}-leg): ${disclosure}`,
118
127
  });
119
128
  const ok = last;
129
+ // Restore the captured umd once, after the last leg (best-effort, per row).
130
+ let preserve = null;
131
+ if (options.preserveModified === true && preUmd !== null) {
132
+ const post = createDbReader(deps.db, deps.now?.() ?? new Date(), deps.zone).modDateOf(uuid);
133
+ const targets = post !== null && post > preUmd ? [{ uuid, preUmd }] : [];
134
+ preserve = await restoreModDates(deps.db, deps.vectors, targets);
135
+ }
120
136
  return {
121
137
  ...ok,
122
138
  op: summaryOp,
123
139
  uuid,
124
140
  undoToken: txnId,
141
+ ...(preserve !== null &&
142
+ (preserve.restored > 0 || preserve.failures.length > 0) && {
143
+ preservedModified: preserve.restored,
144
+ }),
145
+ ...(preserve !== null &&
146
+ preserve.failures.length > 0 && { preserveFailures: preserve.failures }),
125
147
  warnings: [...(ok.warnings ?? []), `applied as ${legs.length} non-atomic legs: ${disclosure}`],
126
148
  };
127
149
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resolution-timestamps.js","sourceRoot":"","sources":["../../src/write/resolution-timestamps.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,WAAW,GAIZ,MAAM,eAAe,CAAC;AAgBvB,+DAA+D;AAC/D,SAAS,IAAI,CACX,IAAe,EACf,EAAiB,EACjB,MAA+B,EAC/B,OAAqB;IAErB,OAAO,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,MAAe,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,QAAQ,CAAC,GAAS;IACzB,OAAO,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AACzE,CAAC;AAED,SAAS,UAAU,CACjB,IAAkB,EAClB,KAAa,EACb,MAAoC;IAEpC,MAAM,GAAG,GAAiB,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EA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ACnE,CAAC;IAEF,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAC3B,yEAAyE;QACzE,OAAO,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,uEAAuE;IACvE,MAAM,QAAQ,GAAG,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAChE,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC;IACvC,MAAM,IAAI,GAAU;QAClB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,kBAAkB,CAAC;QAC3C,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC;QAC9B,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,kBAAkB,CAAC;KAC1C,CAAC;IACF,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,mBAAmB,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/F,OAAO,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC"}
@@ -20,6 +20,14 @@ export const REVERSIBILITY = {
20
20
  class: "reversible",
21
21
  note: "inverse deletes the duplicated project to the Trash",
22
22
  },
23
+ "todo.clone": {
24
+ class: "reversible",
25
+ note: "inverse trashes the minted clone to-do (single leg); irreversible only if the clone's uuid was never discovered",
26
+ },
27
+ "project.clone": {
28
+ class: "reversible",
29
+ note: "inverse trashes the minted clone project (and the children it carried) to the Trash; irreversible only if the clone's uuid was never discovered",
30
+ },
23
31
  "area.add": {
24
32
  class: "reversible",
25
33
  ack: "permanent",
@@ -58,12 +66,12 @@ export const REVERSIBILITY = {
58
66
  // ---- delete / restore ---------------------------------------------------
59
67
  "todo.delete": {
60
68
  class: "reversible-with-loss",
61
- note: "inverse restores from the Trash but lands in the Inbox DE-SCHEDULED (E15) — the prior list/schedule was not captured by the delete",
69
+ note: "inverse restores from the Trash but lands in the Inbox DE-SCHEDULED (E15) — the prior list/schedule was not captured by the delete. EXCEPTION: deleting a repeating TEMPLATE is IRREVERSIBLE headlessly (the app forbids restoring a template out to a list, AS 301) — no undo token is emitted and the result discloses Trash ▸ Put Back as the only revival (SERDEL S2/S3, ruling 2026-08-13)",
62
70
  },
63
71
  "todo.restore": { class: "reversible", note: "inverse re-deletes the to-do to the Trash" },
64
72
  "project.delete": {
65
73
  class: "reversible",
66
- note: "inverse restores the project IN PLACE (P06) — schedule/area/children keep their state",
74
+ note: "inverse restores the project IN PLACE (P06) — schedule/area/children keep their state. EXCEPTION: deleting a repeating project TEMPLATE is IRREVERSIBLE headlessly (Put Back only) — no undo token, disclosed in the result (ruling 2026-08-13)",
67
75
  },
68
76
  "project.restore": { class: "reversible", note: "inverse re-deletes the project to the Trash" },
69
77
  // ---- field updates ------------------------------------------------------
@@ -164,22 +172,10 @@ export const REVERSIBILITY = {
164
172
  class: "irreversible",
165
173
  note: "a created heading has no headless delete surface (heading delete is interactive-only) — archive it in the app instead",
166
174
  },
167
- "todo.make-repeating": {
168
- class: "irreversible",
169
- note: "making a to-do repeat is an identity REPLACEMENT (UI2-a): the original uuid is destroyed and a new template row is born — there is no un-repeat that restores the original",
170
- },
171
175
  "todo.convert-to-project": {
172
176
  class: "irreversible",
173
177
  note: "converting a to-do to a project is an identity REPLACEMENT (UI2-d): the to-do uuid is destroyed and a new project uuid is born (notes preserved); the app offers no convert-back",
174
178
  },
175
- "project.make-repeating": {
176
- class: "irreversible",
177
- note: "making a project repeat is an identity REPLACEMENT (UIC4-b): the original project uuid is destroyed and a new template project is born (area preserved, start normalized to someday) — there is no un-repeat that restores the original",
178
- },
179
- "project.add-repeating": {
180
- class: "irreversible",
181
- note: "the composite CREATES a project then promotes it (identity replacement, UIC4-b): the created uuid is destroyed by the promote and a new repeating template is born — no automated inverse captures it; delete the resulting repeating project in the app",
182
- },
183
179
  "project.promote-heading": {
184
180
  class: "irreversible",
185
181
  note: "promoting a heading to a project is an identity REPLACEMENT (UI2-d): the heading uuid is destroyed, a new project is promoted into the parent's area and children reparent; no convert-back",
@@ -200,6 +196,23 @@ export const REVERSIBILITY = {
200
196
  class: "conditional",
201
197
  note: "the project's rule mutates in place (identity preserved, UIC2-a); re-drives reschedule with the captured prior rule (same faithfulness boundary as todo.reschedule-repeat) — invertible when the prior rule was captured, decodable, and dialog-expressible; irreversible otherwise. A per-instance reminder time is not restored",
202
198
  },
199
+ // ---- promote-via-clone (make/add-repeating) → undo is trash-both (+restore) --
200
+ "todo.make-repeating": {
201
+ class: "reversible-with-loss",
202
+ note: "promote-via-clone: the minted template + its current instance are the inverse's target — undo TRASHES BOTH (the SERDEL trash-both) and restores the original to-do from the Trash (it lands in the Inbox DE-SCHEDULED, E15). The trashed template leaves no tombstone and its own un-delete is GUI-only (Trash ▸ Put Back), so this undo cannot itself be undone headlessly",
203
+ },
204
+ "project.make-repeating": {
205
+ class: "reversible-with-loss",
206
+ note: "promote-via-clone: undo TRASHES the minted template + its current instance (trash-both) and restores the original project IN PLACE (P06). The trashed template leaves no tombstone and its own un-delete is GUI-only (Put Back), so this undo cannot itself be undone headlessly",
207
+ },
208
+ "todo.add-repeating": {
209
+ class: "reversible",
210
+ note: "the composite creates a to-do then promotes it; undo TRASHES the minted template + its current instance (SERDEL trash-both) — the whole created series moves to the Trash. Re-creating the series is GUI-only (the template leaves no tombstone; use Trash ▸ Put Back), so this undo is not itself headlessly undoable",
211
+ },
212
+ "project.add-repeating": {
213
+ class: "reversible",
214
+ note: "the composite creates a project then promotes it; undo TRASHES the minted template + its current instance (SERDEL trash-both) — the whole created series moves to the Trash. Re-creating the series is GUI-only, so this undo is not itself headlessly undoable",
215
+ },
203
216
  // ---- ui-vector reversible pairs -----------------------------------------
204
217
  "todo.pause-repeat": {
205
218
  class: "reversible",
@@ -1 +1 @@
1
- {"version":3,"file":"reversibility.js","sourceRoot":"","sources":["../../src/write/reversibility.ts"],"names":[],"mappings":"AA0CA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAA8C;IACtE,4EAA4E;IAC5E,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,uHAAuH;KAC9H;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,kGAAkG;KACzG;IACD,aAAa,EAAE;QACb,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,wEAAwE;KAC/E;IACD,mBAAmB,EAAE;QACnB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,qDAAqD;KAC5D;IACD,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,qGAAqG;KAC5G;IACD,SAAS,EAAE;QACT,KAAK,EAAE,YAAY;QACnB,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,mGAAmG;KAC1G;IAED,4EAA4E;IAC5E,eAAe,EAAE;QACf,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,yFAAyF;KAChG;IACD,aAAa,EAAE;QACb,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,0DAA0D;KACjE;IACD,aAAa,EAAE;QACb,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,mEAAmE;KAC1E;IACD,kBAAkB,EAAE;QAClB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,+FAA+F;KACtG;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,2FAA2F;KAClG;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,2HAA2H;KAClI;IAED,4EAA4E;IAC5E,aAAa,EAAE;QACb,KAAK,EAAE,sBAAsB;QAC7B,IAAI,EAAE,oIAAoI;KAC3I;IACD,cAAc,E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,EAAE,cAAc;QACrB,IAAI,EAAE,6LAA6L;KACpM;IACD,iCAAiC,EAAE;QACjC,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,wWAAwW;KAC/W;IACD,0BAA0B,EAAE;QAC1B,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,sdAAsd;KAC7d;IACD,wBAAwB,EAAE;QACxB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,+iBAA+iB;KACtjB;IACD,2BAA2B,EAAE;QAC3B,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,mUAAmU;KAC1U;IAED,4EAA4E;IAC5E,mBAAmB,EAAE;QACnB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,0HAA0H;KACjI;IACD,oBAAoB,EAAE;QACpB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,sHAAsH;KAC7H;IACD,sBAAsB,EAAE;QACtB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,qIAAqI;KAC5I;IACD,uBAAuB,EAAE;QACvB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,+FAA+F;KACtG;IAED,4EAA4E;IAC5E,SAAS,EAAE;QACT,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,0PAA0P;KACjQ;CACF,CAAC;AAEF,sFAAsF;AACtF,MAAM,UAAU,eAAe;IAC7B,OAAQ,MAAM,CAAC,IAAI,CAAC,aAAa,CAAqB,CAAC,MAAM,CAC3D,CAAC,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,cAAc,CACnD,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"reversibility.js","sourceRoot":"","sources":["../../src/write/reversibility.ts"],"names":[],"mappings":"AA0CA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAA8C;IACtE,4EAA4E;IAC5E,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,uHAAuH;KAC9H;IACD,gBAAgB,EAAE;QAChB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AC1U;IAED,iFAAiF;IACjF,qBAAqB,EAAE;QACrB,KAAK,EAAE,sBAAsB;QAC7B,IAAI,EAAE,6WAA6W;KACpX;IACD,wBAAwB,EAAE;QACxB,KAAK,EAAE,sBAAsB;QAC7B,IAAI,EAAE,kRAAkR;KACzR;IACD,oBAAoB,EAAE;QACpB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,wTAAwT;KAC/T;IACD,uBAAuB,EAAE;QACvB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,iQAAiQ;KACxQ;IAED,4EAA4E;IAC5E,mBAAmB,EAAE;QACnB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,0HAA0H;KACjI;IACD,oBAAoB,EAAE;QACpB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,sHAAsH;KAC7H;IACD,sBAAsB,EAAE;QACtB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,qIAAqI;KAC5I;IACD,uBAAuB,EAAE;QACvB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,+FAA+F;KACtG;IAED,4EAA4E;IAC5E,SAAS,EAAE;QACT,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,0PAA0P;KACjQ;CACF,CAAC;AAEF,sFAAsF;AACtF,MAAM,UAAU,eAAe;IAC7B,OAAQ,MAAM,CAAC,IAAI,CAAC,aAAa,CAAqB,CAAC,MAAM,CAC3D,CAAC,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,cAAc,CACnD,CAAC;AACJ,CAAC"}
@@ -123,10 +123,20 @@ export declare function scanAuditIntegrity(records: AuditRecord[]): AuditIntegri
123
123
  * The undoable targets to unwind, NEWEST FIRST (undo unwinds a stack).
124
124
  *
125
125
  * - `txn` wins when present: the ONE record whose undo token matches (or an
126
- * empty array — the caller distinguishes not-found from already-undone).
126
+ * empty array — the caller distinguishes not-found from already-undone). The
127
+ * already-undone exclusion below does NOT apply to `--txn`: surgical targeting
128
+ * keeps the loud "already undone" error (runUndo raises it before selecting).
127
129
  * - otherwise the last `last` records, optionally narrowed to actor `by`
128
130
  * (exact match; "*"/undefined = every actor). `by` NEVER matches an
129
131
  * `undo:<actor>` record — those are excluded from undoability entirely.
132
+ *
133
+ * ALREADY-UNDONE records are EXCLUDED from `--last`/`--by` selection (Change 3),
134
+ * so `--last N` always means "the N newest NOT-YET-undone mutations" and a
135
+ * repeated `undo --last N` walks progressively deeper into history instead of
136
+ * re-selecting the same records (whose inverses would trip the precondition
137
+ * guard). IRREVERSIBLE records are NOT excluded — they were never undone, so
138
+ * they keep COUNTING toward N and being reported every pass (reaching silently
139
+ * past one to undo something older would be a dangerous surprise).
130
140
  */
131
141
  export declare function selectUndoTargets(records: AuditRecord[], selector?: UndoSelector): AuditRecord[];
132
142
  export declare const IRREVERSIBLE: Partial<Record<string, string>>;
@@ -46,6 +46,7 @@ import { localToday } from "../model/dates.js";
46
46
  import { getField } from "./verify/delta.js";
47
47
  import { isRepeatingTemplate, loadTarget } from "./pre-state.js";
48
48
  import { isUiDriveOp } from "./operations.js";
49
+ import { restoreModDates } from "./preserve-modified.js";
49
50
  import { ruleToInverseParams } from "./repeat-rule.js";
50
51
  import { runMutation } from "./pipeline.js";
51
52
  import { runReorder } from "./reorder.js";
@@ -141,14 +142,39 @@ export function scanAuditIntegrity(records) {
141
142
  }
142
143
  return { orphanedIntents, newestOrphanIntent };
143
144
  }
145
+ /**
146
+ * The set of mutation undo-tokens that have ALREADY been undone: derived from
147
+ * the inverse records on the trail (an `ok` record under an `undo:*` actor whose
148
+ * `undoOf` back-references the mutation it reversed). This is the same linkage
149
+ * the `--txn` already-undone check reads, generalized to a set.
150
+ */
151
+ function undoneTokens(records) {
152
+ const undone = new Set();
153
+ for (const r of records) {
154
+ if (r.result === "ok" && r.actor.startsWith("undo:") && typeof r.undoOf === "string") {
155
+ undone.add(r.undoOf);
156
+ }
157
+ }
158
+ return undone;
159
+ }
144
160
  /**
145
161
  * The undoable targets to unwind, NEWEST FIRST (undo unwinds a stack).
146
162
  *
147
163
  * - `txn` wins when present: the ONE record whose undo token matches (or an
148
- * empty array — the caller distinguishes not-found from already-undone).
164
+ * empty array — the caller distinguishes not-found from already-undone). The
165
+ * already-undone exclusion below does NOT apply to `--txn`: surgical targeting
166
+ * keeps the loud "already undone" error (runUndo raises it before selecting).
149
167
  * - otherwise the last `last` records, optionally narrowed to actor `by`
150
168
  * (exact match; "*"/undefined = every actor). `by` NEVER matches an
151
169
  * `undo:<actor>` record — those are excluded from undoability entirely.
170
+ *
171
+ * ALREADY-UNDONE records are EXCLUDED from `--last`/`--by` selection (Change 3),
172
+ * so `--last N` always means "the N newest NOT-YET-undone mutations" and a
173
+ * repeated `undo --last N` walks progressively deeper into history instead of
174
+ * re-selecting the same records (whose inverses would trip the precondition
175
+ * guard). IRREVERSIBLE records are NOT excluded — they were never undone, so
176
+ * they keep COUNTING toward N and being reported every pass (reaching silently
177
+ * past one to undo something older would be a dangerous surprise).
152
178
  */
153
179
  export function selectUndoTargets(records, selector = {}) {
154
180
  const undoable = undoableRecords(records);
@@ -156,9 +182,11 @@ export function selectUndoTargets(records, selector = {}) {
156
182
  const match = undoable.find((r) => undoToken(r) === selector.txn);
157
183
  return match === undefined ? [] : [match];
158
184
  }
185
+ const undone = undoneTokens(records);
186
+ const notUndone = undoable.filter((r) => !undone.has(undoToken(r)));
159
187
  const byActor = selector.by === undefined || selector.by === "*"
160
- ? undoable
161
- : undoable.filter((r) => r.actor === selector.by);
188
+ ? notUndone
189
+ : notUndone.filter((r) => r.actor === selector.by);
162
190
  return byActor.slice(-Math.max(1, selector.last ?? 1)).toReversed();
163
191
  }
164
192
  /**
@@ -214,15 +242,8 @@ export const IRREVERSIBLE = {
214
242
  "no inverse — nothing is deleted, the items are simply logged",
215
243
  "project.add-heading": "a created heading can only be removed by deleting it, which has no headless surface " +
216
244
  "(heading delete is interactive-only) — archive it in the app instead",
217
- "todo.make-repeating": "making a to-do repeat is an identity replacement (UI2-a): the original uuid is destroyed " +
218
- "and a new template row is born — there is no un-repeat that restores the original",
219
245
  "todo.convert-to-project": "converting a to-do to a project is an identity replacement (UI2-d): the to-do uuid is " +
220
246
  "destroyed and a new project is born — the app offers no convert-back",
221
- "project.make-repeating": "making a project repeat is an identity replacement (UIC4-b): the original project uuid is " +
222
- "destroyed and a new template project is born — there is no un-repeat that restores the original",
223
- "project.add-repeating": "the composite creates a project then promotes it (identity replacement, UIC4-b): the " +
224
- "created uuid is destroyed by the promote and a new repeating template is born — delete the " +
225
- "resulting repeating project in the app",
226
247
  "project.promote-heading": "promoting a heading to a project is an identity replacement (UI2-d): the heading uuid is " +
227
248
  "destroyed and a new project is born — no convert-back",
228
249
  "project.move-heading-to-project": "moving a heading to another project is app-reversible (move it back) but has no wired " +
@@ -564,6 +585,71 @@ export function planUndo(record, now, allRecords = [], current) {
564
585
  notes,
565
586
  };
566
587
  }
588
+ // A clone (todo.clone / project.clone): the summary record heads the txn whose
589
+ // legs (the base add, checklist checks, terminal-state flips) are ordinary
590
+ // `leg`-role mutations excluded from independent undo. The single undoable unit
591
+ // is the whole clone, and its inverse is trashing the minted root — a project
592
+ // clone's minted children ride to the Trash with it (shallow delete), so no
593
+ // per-child inverse is replayed (the child uuids are captured on the record for
594
+ // the audit trail, not for undo).
595
+ case "todo.clone": {
596
+ if (uuid === null)
597
+ return irreversible("the clone's uuid was never discovered");
598
+ return {
599
+ target,
600
+ kind: "invertible",
601
+ steps: [{ op: "todo.delete", params: { uuid } }],
602
+ notes,
603
+ };
604
+ }
605
+ case "project.clone": {
606
+ if (uuid === null)
607
+ return irreversible("the clone's uuid was never discovered");
608
+ notes.push("the cloned project (and every child it minted) moves to the Trash");
609
+ return {
610
+ target,
611
+ kind: "invertible",
612
+ steps: [{ op: "project.delete", params: { uuid } }],
613
+ notes,
614
+ };
615
+ }
616
+ // Promote-via-clone (make/add-repeating): the SUMMARY record captured the
617
+ // minted template, its current instance, and — for make-repeating — the
618
+ // trashed original. Undo is the SERDEL trash-both (delete BOTH rows — a
619
+ // template delete is a plain, publicly-allowed delete now, ruling 2026-08-13),
620
+ // then (make-repeating only) restore the original from the Trash. This undo
621
+ // cannot itself be undone headlessly — a trashed template's only revival is
622
+ // the app's Trash ▸ Put Back (SERDEL S2/S3) — disclosed here.
623
+ case "todo.make-repeating":
624
+ case "project.make-repeating":
625
+ case "todo.add-repeating":
626
+ case "project.add-repeating": {
627
+ const obs = record.observed ?? {};
628
+ const templateUuid = obs["templateUuid"];
629
+ if (typeof templateUuid !== "string") {
630
+ return irreversible("the minted template uuid was not captured on this record — remove the repeating " +
631
+ "series in the Things app (delete the template, then its current instance)");
632
+ }
633
+ const kind = record.op.startsWith("project.") ? "project" : "todo";
634
+ const deleteOp = kind === "project" ? "project.delete" : "todo.delete";
635
+ const restoreOp = kind === "project" ? "project.restore" : "todo.restore";
636
+ const steps = [{ op: deleteOp, params: { uuid: templateUuid } }];
637
+ const instanceUuid = obs["instanceUuid"];
638
+ if (typeof instanceUuid === "string" && instanceUuid !== templateUuid) {
639
+ steps.push({ op: deleteOp, params: { uuid: instanceUuid } });
640
+ }
641
+ const originalUuid = obs["originalUuid"];
642
+ if (typeof originalUuid === "string") {
643
+ steps.push({ op: restoreOp, params: { uuid: originalUuid } });
644
+ notes.push(kind === "todo"
645
+ ? "the original to-do is restored from the Trash — it lands in the Inbox de-scheduled (E15)"
646
+ : "the original project is restored from the Trash in place (P06)");
647
+ }
648
+ notes.push("removing the series trashes the minted template AND its current instance (trash-both, " +
649
+ "SERDEL); this undo cannot itself be undone headlessly — a trashed template's only " +
650
+ "revival is the app's Trash ▸ Put Back");
651
+ return { target, kind: "invertible", steps, notes };
652
+ }
567
653
  case "area.add": {
568
654
  if (uuid === null)
569
655
  return irreversible("the created uuid was never discovered");
@@ -1621,6 +1707,14 @@ export async function runUndo(deps, auditDirPath, options = {}, onItem) {
1621
1707
  break;
1622
1708
  }
1623
1709
  }
1710
+ // Preview the symmetric umd-restore (a --preserve-modified original).
1711
+ if (record.preModDates !== undefined) {
1712
+ const n = Object.values(record.preModDates).filter((v) => typeof v === "number").length;
1713
+ if (n > 0) {
1714
+ plan.notes.push(`would restore the modification date on ${n} row(s) after the inverse (this undo ` +
1715
+ "stays off the changes/watch timeline, symmetric with the --preserve-modified original)");
1716
+ }
1717
+ }
1624
1718
  item = { plan, results: preview, outcome: "dry-run" };
1625
1719
  }
1626
1720
  else {
@@ -1677,6 +1771,28 @@ export async function runUndo(deps, auditDirPath, options = {}, onItem) {
1677
1771
  break;
1678
1772
  }
1679
1773
  }
1774
+ // Symmetric umd-restore (2026-08-13 ruling): a forward op that ran with
1775
+ // --preserve-modified recorded each touched row's pre-write
1776
+ // userModificationDate on `preModDates`. After the inverse legs land, put
1777
+ // those umd values back (floor(preUmd)) so the UNDO is ALSO off the
1778
+ // changes/watch timeline — matching the forward op's silence. Best-effort:
1779
+ // a failed restore is disclosed, never fatal (the inverse already stands).
1780
+ // Records without preModDates (the default) are untouched.
1781
+ if (!failed && record.preModDates !== undefined) {
1782
+ const umdTargets = Object.entries(record.preModDates)
1783
+ .filter((e) => typeof e[1] === "number")
1784
+ .map(([tUuid, preUmd]) => ({ uuid: tUuid, preUmd }));
1785
+ if (umdTargets.length > 0) {
1786
+ const restore = await restoreModDates(deps.db, deps.vectors, umdTargets);
1787
+ if (restore.restored > 0) {
1788
+ plan.notes.push(`restored the modification date on ${restore.restored} row(s) so this undo stays ` +
1789
+ "off the changes/watch timeline (symmetric with the --preserve-modified original)");
1790
+ }
1791
+ for (const f of restore.failures) {
1792
+ plan.notes.push(`could not restore the modification date on ${f.uuid}: ${f.detail} (non-fatal)`);
1793
+ }
1794
+ }
1795
+ }
1680
1796
  const okCount = results.filter((r) => r.kind === "ok").length;
1681
1797
  item = {
1682
1798
  plan,