things-api 0.17.0 → 0.19.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 (277) hide show
  1. package/README.md +16 -9
  2. package/deputy/AppIcon.icns +0 -0
  3. package/deputy/VERSION +1 -0
  4. package/deputy/helpers-Info.plist +27 -0
  5. package/deputy/prebuilt/Things API Helper.app/Contents/CodeResources +0 -0
  6. package/deputy/prebuilt/Things API Helper.app/Contents/Helpers/things-reader.app/Contents/Info.plist +22 -0
  7. package/deputy/prebuilt/Things API Helper.app/Contents/Helpers/things-reader.app/Contents/MacOS/things-reader +0 -0
  8. package/deputy/prebuilt/Things API Helper.app/Contents/Helpers/things-reader.app/Contents/Resources/AppIcon.icns +0 -0
  9. package/deputy/prebuilt/Things API Helper.app/Contents/Helpers/things-reader.app/Contents/_CodeSignature/CodeResources +128 -0
  10. package/deputy/prebuilt/Things API Helper.app/Contents/Info.plist +27 -0
  11. package/deputy/prebuilt/Things API Helper.app/Contents/MacOS/things-deputy +0 -0
  12. package/deputy/prebuilt/Things API Helper.app/Contents/Resources/AppIcon.icns +0 -0
  13. package/deputy/prebuilt/Things API Helper.app/Contents/_CodeSignature/CodeResources +137 -0
  14. package/deputy/reader/Info.plist +22 -0
  15. package/deputy/reader/entitlements.plist +45 -0
  16. package/deputy/reader/main.swift +580 -0
  17. package/deputy/src/main.swift +133 -0
  18. package/deputy/src/osascript.swift +102 -0
  19. package/deputy/src/server.swift +373 -0
  20. package/deputy/src/sqlite.swift +121 -0
  21. package/deputy/src/tcc.swift +58 -0
  22. package/dist/audit/schema.d.ts +13 -1
  23. package/dist/audit/schema.js.map +1 -1
  24. package/dist/capability.d.ts +160 -0
  25. package/dist/capability.js +416 -0
  26. package/dist/capability.js.map +1 -0
  27. package/dist/cli/commands/doctor.js +181 -2
  28. package/dist/cli/commands/doctor.js.map +1 -1
  29. package/dist/cli/commands/helpers.d.ts +17 -0
  30. package/dist/cli/commands/helpers.js +275 -0
  31. package/dist/cli/commands/helpers.js.map +1 -0
  32. package/dist/cli/commands/op-result.d.ts +15 -0
  33. package/dist/cli/commands/op-result.js +45 -0
  34. package/dist/cli/commands/op-result.js.map +1 -0
  35. package/dist/cli/commands/reads.js +47 -1
  36. package/dist/cli/commands/reads.js.map +1 -1
  37. package/dist/cli/commands/setup.d.ts +9 -0
  38. package/dist/cli/commands/setup.js +63 -83
  39. package/dist/cli/commands/setup.js.map +1 -1
  40. package/dist/cli/commands/writes.d.ts +1 -1
  41. package/dist/cli/commands/writes.js +262 -109
  42. package/dist/cli/commands/writes.js.map +1 -1
  43. package/dist/cli/dry-run.d.ts +1 -1
  44. package/dist/cli/dry-run.js +1 -1
  45. package/dist/cli/glyphs.d.ts +23 -4
  46. package/dist/cli/glyphs.js +46 -19
  47. package/dist/cli/glyphs.js.map +1 -1
  48. package/dist/cli/help.d.ts +1 -1
  49. package/dist/cli/help.js +53 -27
  50. package/dist/cli/help.js.map +1 -1
  51. package/dist/cli/helpers-check.d.ts +10 -0
  52. package/dist/cli/helpers-check.js +59 -0
  53. package/dist/cli/helpers-check.js.map +1 -0
  54. package/dist/cli/main.js +22 -1
  55. package/dist/cli/main.js.map +1 -1
  56. package/dist/cli/period.d.ts +3 -1
  57. package/dist/cli/period.js +1 -1
  58. package/dist/cli/period.js.map +1 -1
  59. package/dist/cli/read-driver.js +26 -1
  60. package/dist/cli/read-driver.js.map +1 -1
  61. package/dist/cli/render.d.ts +31 -4
  62. package/dist/cli/render.js +127 -15
  63. package/dist/cli/render.js.map +1 -1
  64. package/dist/client.d.ts +22 -2
  65. package/dist/client.js +52 -15
  66. package/dist/client.js.map +1 -1
  67. package/dist/config.d.ts +31 -0
  68. package/dist/config.js +9 -0
  69. package/dist/config.js.map +1 -1
  70. package/dist/contracts.d.ts +6 -2
  71. package/dist/contracts.js +1 -1
  72. package/dist/contracts.js.map +1 -1
  73. package/dist/db/baselines/db-v26.js +8 -4
  74. package/dist/db/baselines/db-v26.js.map +1 -1
  75. package/dist/db/baselines/db-v27.d.ts +42 -0
  76. package/dist/db/baselines/db-v27.js +47 -0
  77. package/dist/db/baselines/db-v27.js.map +1 -0
  78. package/dist/db/baselines/index.js +2 -1
  79. package/dist/db/baselines/index.js.map +1 -1
  80. package/dist/db/locate.d.ts +4 -1
  81. package/dist/db/locate.js +3 -1
  82. package/dist/db/locate.js.map +1 -1
  83. package/dist/db/schema.d.ts +1 -1
  84. package/dist/db/schema.js +9 -0
  85. package/dist/db/schema.js.map +1 -1
  86. package/dist/deputy/bridge-worker.d.ts +1 -0
  87. package/dist/deputy/bridge-worker.js +79 -0
  88. package/dist/deputy/bridge-worker.js.map +1 -0
  89. package/dist/deputy/bridge.d.ts +14 -0
  90. package/dist/deputy/bridge.js +70 -0
  91. package/dist/deputy/bridge.js.map +1 -0
  92. package/dist/deputy/client.d.ts +19 -0
  93. package/dist/deputy/client.js +104 -0
  94. package/dist/deputy/client.js.map +1 -0
  95. package/dist/deputy/db-facade.d.ts +18 -0
  96. package/dist/deputy/db-facade.js +71 -0
  97. package/dist/deputy/db-facade.js.map +1 -0
  98. package/dist/deputy/files.d.ts +1 -0
  99. package/dist/deputy/files.js +16 -0
  100. package/dist/deputy/files.js.map +1 -0
  101. package/dist/deputy/install.d.ts +319 -0
  102. package/dist/deputy/install.js +1239 -0
  103. package/dist/deputy/install.js.map +1 -0
  104. package/dist/deputy/notice.d.ts +6 -0
  105. package/dist/deputy/notice.js +28 -0
  106. package/dist/deputy/notice.js.map +1 -0
  107. package/dist/deputy/notices.d.ts +31 -0
  108. package/dist/deputy/notices.js +94 -0
  109. package/dist/deputy/notices.js.map +1 -0
  110. package/dist/deputy/osa.d.ts +21 -0
  111. package/dist/deputy/osa.js +72 -0
  112. package/dist/deputy/osa.js.map +1 -0
  113. package/dist/deputy/protocol.d.ts +140 -0
  114. package/dist/deputy/protocol.js +143 -0
  115. package/dist/deputy/protocol.js.map +1 -0
  116. package/dist/deputy/routing.d.ts +84 -0
  117. package/dist/deputy/routing.js +422 -0
  118. package/dist/deputy/routing.js.map +1 -0
  119. package/dist/deputy/shortcuts-exec.d.ts +10 -0
  120. package/dist/deputy/shortcuts-exec.js +50 -0
  121. package/dist/deputy/shortcuts-exec.js.map +1 -0
  122. package/dist/diagnose.d.ts +57 -2
  123. package/dist/diagnose.js +105 -3
  124. package/dist/diagnose.js.map +1 -1
  125. package/dist/direct-setup.d.ts +78 -0
  126. package/dist/direct-setup.js +484 -0
  127. package/dist/direct-setup.js.map +1 -0
  128. package/dist/host-access.d.ts +63 -0
  129. package/dist/host-access.js +165 -0
  130. package/dist/host-access.js.map +1 -0
  131. package/dist/index.d.ts +31 -5
  132. package/dist/index.js +23 -1
  133. package/dist/index.js.map +1 -1
  134. package/dist/mcp/server.d.ts +27 -1
  135. package/dist/mcp/server.js +300 -97
  136. package/dist/mcp/server.js.map +1 -1
  137. package/dist/model/mappers.d.ts +12 -3
  138. package/dist/model/mappers.js +6 -1
  139. package/dist/model/mappers.js.map +1 -1
  140. package/dist/model/recurrence.d.ts +5 -1
  141. package/dist/model/recurrence.js +19 -1
  142. package/dist/model/recurrence.js.map +1 -1
  143. package/dist/model/template-projection.d.ts +26 -0
  144. package/dist/model/template-projection.js +113 -0
  145. package/dist/model/template-projection.js.map +1 -0
  146. package/dist/op-result.d.ts +55 -0
  147. package/dist/op-result.js +161 -0
  148. package/dist/op-result.js.map +1 -0
  149. package/dist/read/detail.js +7 -1
  150. package/dist/read/detail.js.map +1 -1
  151. package/dist/read/filter-contract.d.ts +1 -1
  152. package/dist/read/filter-contract.js +4 -0
  153. package/dist/read/filter-contract.js.map +1 -1
  154. package/dist/read/queries.js +8 -1
  155. package/dist/read/queries.js.map +1 -1
  156. package/dist/read/shape.js +4 -0
  157. package/dist/read/shape.js.map +1 -1
  158. package/dist/read/views.d.ts +35 -4
  159. package/dist/read/views.js +120 -18
  160. package/dist/read/views.js.map +1 -1
  161. package/dist/session-grant.d.ts +48 -0
  162. package/dist/session-grant.js +170 -0
  163. package/dist/session-grant.js.map +1 -0
  164. package/dist/surface-copy.d.ts +8 -0
  165. package/dist/surface-copy.js +8 -0
  166. package/dist/surface-copy.js.map +1 -1
  167. package/dist/sync-health.js +6 -2
  168. package/dist/sync-health.js.map +1 -1
  169. package/dist/wizard.d.ts +58 -0
  170. package/dist/wizard.js +167 -0
  171. package/dist/wizard.js.map +1 -0
  172. package/dist/write/accessibility-probe.js +4 -2
  173. package/dist/write/accessibility-probe.js.map +1 -1
  174. package/dist/write/automation-probe.js +5 -1
  175. package/dist/write/automation-probe.js.map +1 -1
  176. package/dist/write/availability.d.ts +1 -1
  177. package/dist/write/availability.js +10 -6
  178. package/dist/write/availability.js.map +1 -1
  179. package/dist/write/batch.d.ts +20 -0
  180. package/dist/write/batch.js +94 -15
  181. package/dist/write/batch.js.map +1 -1
  182. package/dist/write/capabilities.d.ts +9 -0
  183. package/dist/write/capabilities.js +2 -0
  184. package/dist/write/capabilities.js.map +1 -1
  185. package/dist/write/clear-reminder.js +1 -1
  186. package/dist/write/clear-reminder.js.map +1 -1
  187. package/dist/write/commands.d.ts +12 -1
  188. package/dist/write/commands.js +170 -237
  189. package/dist/write/commands.js.map +1 -1
  190. package/dist/write/experimental.d.ts +19 -0
  191. package/dist/write/experimental.js +50 -0
  192. package/dist/write/experimental.js.map +1 -1
  193. package/dist/write/failure-hints.d.ts +3 -1
  194. package/dist/write/failure-hints.js.map +1 -1
  195. package/dist/write/guards.js +19 -2
  196. package/dist/write/guards.js.map +1 -1
  197. package/dist/write/lock.d.ts +16 -13
  198. package/dist/write/lock.js +55 -0
  199. package/dist/write/lock.js.map +1 -1
  200. package/dist/write/make-repeating-project.js +9 -13
  201. package/dist/write/make-repeating-project.js.map +1 -1
  202. package/dist/write/move.js +14 -6
  203. package/dist/write/move.js.map +1 -1
  204. package/dist/write/operations.d.ts +64 -25
  205. package/dist/write/operations.js +7 -0
  206. package/dist/write/operations.js.map +1 -1
  207. package/dist/write/opid.d.ts +14 -0
  208. package/dist/write/opid.js +22 -0
  209. package/dist/write/opid.js.map +1 -1
  210. package/dist/write/param-schema.d.ts +124 -0
  211. package/dist/write/param-schema.js +747 -0
  212. package/dist/write/param-schema.js.map +1 -0
  213. package/dist/write/pipeline.d.ts +78 -2
  214. package/dist/write/pipeline.js +249 -4
  215. package/dist/write/pipeline.js.map +1 -1
  216. package/dist/write/pre-state.d.ts +8 -0
  217. package/dist/write/pre-state.js +62 -17
  218. package/dist/write/pre-state.js.map +1 -1
  219. package/dist/write/promote-clone.js +635 -367
  220. package/dist/write/promote-clone.js.map +1 -1
  221. package/dist/write/reorder.js +95 -29
  222. package/dist/write/reorder.js.map +1 -1
  223. package/dist/write/repeat-anchor.d.ts +30 -0
  224. package/dist/write/repeat-anchor.js +166 -1
  225. package/dist/write/repeat-anchor.js.map +1 -1
  226. package/dist/write/repeat-rule.d.ts +28 -1
  227. package/dist/write/repeat-rule.js +64 -4
  228. package/dist/write/repeat-rule.js.map +1 -1
  229. package/dist/write/resolution-timestamps.d.ts +11 -0
  230. package/dist/write/resolution-timestamps.js +83 -38
  231. package/dist/write/resolution-timestamps.js.map +1 -1
  232. package/dist/write/reversibility.js +4 -0
  233. package/dist/write/reversibility.js.map +1 -1
  234. package/dist/write/template-mutation.d.ts +137 -0
  235. package/dist/write/template-mutation.js +451 -0
  236. package/dist/write/template-mutation.js.map +1 -0
  237. package/dist/write/undo.js +10 -20
  238. package/dist/write/undo.js.map +1 -1
  239. package/dist/write/update-fields.d.ts +151 -0
  240. package/dist/write/update-fields.js +427 -0
  241. package/dist/write/update-fields.js.map +1 -0
  242. package/dist/write/vectors/applescript.js +10 -16
  243. package/dist/write/vectors/applescript.js.map +1 -1
  244. package/dist/write/vectors/registry.d.ts +1 -1
  245. package/dist/write/vectors/registry.js +10 -2
  246. package/dist/write/vectors/registry.js.map +1 -1
  247. package/dist/write/vectors/session-reachability.d.ts +55 -0
  248. package/dist/write/vectors/session-reachability.js +56 -8
  249. package/dist/write/vectors/session-reachability.js.map +1 -1
  250. package/dist/write/vectors/shortcuts.js +7 -16
  251. package/dist/write/vectors/shortcuts.js.map +1 -1
  252. package/dist/write/vectors/simulator.d.ts +16 -1
  253. package/dist/write/vectors/simulator.js +68 -12
  254. package/dist/write/vectors/simulator.js.map +1 -1
  255. package/dist/write/vectors/types.d.ts +124 -1
  256. package/dist/write/vectors/ui-recipes.d.ts +19 -0
  257. package/dist/write/vectors/ui-recipes.js +158 -38
  258. package/dist/write/vectors/ui-recipes.js.map +1 -1
  259. package/dist/write/vectors/ui.d.ts +89 -0
  260. package/dist/write/vectors/ui.js +504 -49
  261. package/dist/write/vectors/ui.js.map +1 -1
  262. package/dist/write/verify/delta.d.ts +21 -0
  263. package/dist/write/verify/delta.js.map +1 -1
  264. package/dist/write/verify/poller.d.ts +13 -0
  265. package/dist/write/verify/poller.js +38 -0
  266. package/dist/write/verify/poller.js.map +1 -1
  267. package/package.json +9 -1
  268. package/schema/envelope.schema.json +5 -3
  269. package/scripts/build-helpers.sh +109 -0
  270. package/scripts/deputy-cert-setup.sh +60 -0
  271. package/skills/things-cli/SKILL.md +12 -5
  272. package/skills/things-cli/references/contracts.md +1 -0
  273. package/skills/things-cli/references/data-model.md +3 -0
  274. package/skills/things-cli/references/errors.md +5 -1
  275. package/skills/things-cli/references/gui.md +1 -0
  276. package/skills/things-cli/references/repeating.md +75 -0
  277. package/skills/things-cli/references/tag-cleanup.md +64 -0
@@ -1,3 +1,7 @@
1
+ import { type HelpersMode } from "./config.ts";
2
+ import { type HelpersStatus } from "./deputy/install.ts";
3
+ import { type HelpersRouting } from "./deputy/routing.ts";
4
+ import { type ReadCapability, type UiCapability, type WriteCapability } from "./capability.ts";
1
5
  import { type AutomationProbeDeps, type AutomationProbeStatus } from "./write/automation-probe.ts";
2
6
  import { type AccessibilityProbeDeps, type AccessibilityProbeStatus } from "./write/accessibility-probe.ts";
3
7
  import { type CertificationStatus } from "./write/vectors/ui-certification.ts";
@@ -5,10 +9,47 @@ import { type AvailabilityDeps, type ShortcutsState, type UrlSchemeState } from
5
9
  import { type EnvironmentChange, type EnvironmentTracker, type EnvironmentTuple } from "./write/environment.ts";
6
10
  import { type SyncHealth, type SyncHealthDeps } from "./sync-health.ts";
7
11
  import { ExitCode, type EnvelopeMeta, type ErrorCode } from "./contracts.ts";
12
+ /** The helper pair's section of the report — see {@link DiagnoseReport.helpers}. */
13
+ export interface HelpersReport {
14
+ /** Configured routing mode (`helpers-enabled`): auto | true | false. */
15
+ mode: HelpersMode;
16
+ /** What that mode RESOLVED to in this process (per-half, with reasons). */
17
+ routing: HelpersRouting;
18
+ /** Installation + liveness + signing + grant, both halves. */
19
+ status: HelpersStatus;
20
+ /** The installed bundle's version, null when nothing is installed. */
21
+ installedVersion: string | null;
22
+ /** The version this package's protocol/library was built against. */
23
+ expectedVersion: string;
24
+ /** Installed but not the expected version — the remedy is a rebuild + reinstall. */
25
+ versionSkew: boolean;
26
+ /** Either half left a socket behind that no longer answers a handshake. */
27
+ hungSocket: boolean;
28
+ /** One line naming the fix, or null when there is nothing to fix. */
29
+ remedy: string | null;
30
+ detail: string;
31
+ }
32
+ /** Test seam for the helpers section (see {@link DiagnoseOptions.helpers}). */
33
+ export interface HelpersReportDeps {
34
+ status?: HelpersStatus;
35
+ routing?: HelpersRouting;
36
+ }
8
37
  export interface DiagnoseReport {
38
+ /**
39
+ * What this process is permitted to do, and on whose authority
40
+ * (docs/design/permissions-doctrine.md, Article II). Detected prompt-free, so
41
+ * asking `doctor` never costs a consent dialog — which matters most on
42
+ * exactly the broken machine where someone runs it.
43
+ */
44
+ capability: {
45
+ read: ReadCapability;
46
+ write: WriteCapability;
47
+ /** GUI-driving standing — helpers-only by Article IV. */
48
+ ui: UiCapability;
49
+ };
9
50
  db: {
10
51
  path: string;
11
- source: "option" | "env" | "container";
52
+ source: "option" | "env" | "container" | "deputy";
12
53
  otherCandidates: string[];
13
54
  databaseVersion: number | null;
14
55
  };
@@ -128,6 +169,14 @@ export interface DiagnoseReport {
128
169
  orphanedIntents: number;
129
170
  newestOrphanIntent: string | null;
130
171
  };
172
+ /**
173
+ * The optional helper pair (docs/design/agent-daemon.md §3b–§3c): what
174
+ * routing is configured to do, what it actually resolved to in THIS process,
175
+ * and each half's installation/liveness/signing/grant state. Prompt-free —
176
+ * every field comes from the same probes `things helpers status` runs, so
177
+ * doctor never triggers a consent dialog of its own.
178
+ */
179
+ helpers: HelpersReport;
131
180
  /**
132
181
  * Freshness + sync-liveness proxies for long-running headless operation
133
182
  * (docs/lab/headless-research.md SYNC1 + SYNC2): app-running, WAL write
@@ -158,6 +207,12 @@ export interface DiagnoseOptions {
158
207
  availability?: AvailabilityDeps;
159
208
  /** Test seams for the sync-health section (clock, process check, WAL/plist readers). */
160
209
  syncHealth?: SyncHealthDeps;
210
+ /**
211
+ * Test seam for the helpers section. Without it the section probes the real
212
+ * machine (launchd, sockets, codesign) — honest for a diagnostic, useless for
213
+ * an assertion, since the host running the suite may have live helpers.
214
+ */
215
+ helpers?: HelpersReportDeps;
161
216
  /** Directory holding the audit JSONL files; defaults to the state dir. Test seam. */
162
217
  auditDir?: string;
163
218
  }
@@ -174,7 +229,7 @@ export interface DiagnoseResult {
174
229
  /**
175
230
  * Which bundled Apple Shortcuts proxies are installed — a standalone
176
231
  * environment accessor that needs no database (the shortcuts probe is a pure
177
- * host check). The public capability behind `things setup shortcuts`; the full
232
+ * host check). The public capability behind `things setup`; the full
178
233
  * {@link diagnose} report carries the same state under `availability.shortcuts`.
179
234
  */
180
235
  export declare function shortcutProxies(deps?: AvailabilityDeps): ShortcutsState;
package/dist/diagnose.js CHANGED
@@ -11,6 +11,11 @@ import { readAuditRecords, scanAuditIntegrity } from "./write/undo.js";
11
11
  import { decodeRecurrenceRule } from "./model/recurrence.js";
12
12
  import { BASELINES } from "./db/baselines/index.js";
13
13
  import { openConnection, ThingsDbOpenError } from "./db/connection.js";
14
+ import { createDeputyDbFacade } from "./deputy/db-facade.js";
15
+ import { helpersStatus } from "./deputy/install.js";
16
+ import { EXPECTED_HELPERS_VERSION } from "./deputy/protocol.js";
17
+ import { deputyDbPath, deputyRoutesDb, helpersRouting, } from "./deputy/routing.js";
18
+ import { readAllowed, readCapability, uiCapability, writeCapability, } from "./capability.js";
14
19
  import { compareToBaseline, observeSchema } from "./db/fingerprint.js";
15
20
  import { locateThingsDb, ThingsDbNotFoundError } from "./db/locate.js";
16
21
  import { isThingsRunning, probeAutomation, } from "./write/automation-probe.js";
@@ -57,19 +62,111 @@ function scanRecurrenceRules(db) {
57
62
  "templates are unavailable",
58
63
  };
59
64
  }
65
+ /**
66
+ * Does the deputy still owe macOS a consent it can only collect with a human
67
+ * present? Reads the TCC standing its handshake carries (helpers v1.2.0+);
68
+ * an older deputy reports nothing here, so nothing is claimed about it.
69
+ */
70
+ function outstandingConsent(hello) {
71
+ if (hello === null)
72
+ return false;
73
+ if (hello.axTrusted === false)
74
+ return true;
75
+ const automation = hello.automation;
76
+ if (automation === undefined)
77
+ return false;
78
+ return automation.things !== "granted" || automation.systemEvents !== "granted";
79
+ }
80
+ function buildHelpersReport(configMode, deps = {}) {
81
+ // The routing resolution carries the mode it resolved (helpersRouting reads
82
+ // the same config), so the section has ONE source for it.
83
+ const routing = deps.routing ?? helpersRouting();
84
+ const mode = routing.mode;
85
+ const status = deps.status ?? helpersStatus(configMode);
86
+ const installedVersion = status.installedVersion;
87
+ const versionSkew = installedVersion !== null && installedVersion !== EXPECTED_HELPERS_VERSION;
88
+ const hungSocket = status.deputy.hungSocket || status.reader.hungSocket;
89
+ const remedy = versionSkew
90
+ ? "rebuild the bundle (`bash scripts/build-helpers.sh`) and rerun `things helpers setup`"
91
+ : hungSocket
92
+ ? "`things helpers restart` — a socket is present but no handshake comes back"
93
+ : !status.bundleInstalled
94
+ ? mode === "false"
95
+ ? null
96
+ : "`things helpers setup` to move macOS permission grants onto the helpers"
97
+ : status.reader.installed && status.reader.running && !status.reader.granted
98
+ ? "`things helpers setup` once, at the machine, to give the reader durable read access"
99
+ : status.bundleInstalled && !status.deputy.running
100
+ ? "`things helpers setup` (re-registers both helpers with launchd and starts them)"
101
+ : outstandingConsent(status.deputy.hello)
102
+ ? "`things helpers setup` once, at the machine — one sitting settles every macOS permission the helpers still need"
103
+ : null;
104
+ const detail = mode === "false"
105
+ ? "routing off — every primitive runs in this process (`things config set helpers-enabled auto` to use an installed helper)"
106
+ : routing.automation && routing.files
107
+ ? "both halves carrying traffic"
108
+ : !status.bundleInstalled
109
+ ? mode === "auto"
110
+ ? "nothing installed — running direct, which is the normal state for a machine that has not onboarded the helpers"
111
+ : "routing is set to true but nothing is installed — running direct"
112
+ : `running direct for ${[
113
+ ...(routing.automation ? [] : [`automation (${routing.deputyReason ?? "unknown"})`]),
114
+ ...(routing.files ? [] : [`database reads (${routing.readerReason ?? "unknown"})`]),
115
+ ].join(" and ")}`;
116
+ return {
117
+ mode,
118
+ routing,
119
+ status,
120
+ installedVersion,
121
+ expectedVersion: EXPECTED_HELPERS_VERSION,
122
+ versionSkew,
123
+ hungSocket,
124
+ remedy,
125
+ detail,
126
+ };
127
+ }
60
128
  /**
61
129
  * Which bundled Apple Shortcuts proxies are installed — a standalone
62
130
  * environment accessor that needs no database (the shortcuts probe is a pure
63
- * host check). The public capability behind `things setup shortcuts`; the full
131
+ * host check). The public capability behind `things setup`; the full
64
132
  * {@link diagnose} report carries the same state under `availability.shortcuts`.
65
133
  */
66
134
  export function shortcutProxies(deps = {}) {
67
135
  return readShortcutProxies(deps);
68
136
  }
69
137
  export function diagnose(dbPath, options = {}) {
138
+ // The capability verdict comes FIRST and prompt-free (permissions doctrine,
139
+ // Articles I–III). Doctor is the command people run when access is broken, so
140
+ // it must be able to say "you hold nothing, here is how to fix it" without
141
+ // itself opening the container and raising the dialog it is diagnosing.
142
+ const capability = {
143
+ read: readCapability(dbPath !== undefined ? { dbPath } : {}),
144
+ write: writeCapability(),
145
+ ui: uiCapability(),
146
+ };
147
+ if (!readAllowed(capability.read)) {
148
+ return {
149
+ report: null,
150
+ error: {
151
+ code: "environment",
152
+ message: `the Things database cannot be read: ${capability.read.detail}`,
153
+ remediation: capability.read.remediation.join("; "),
154
+ },
155
+ exitCode: ExitCode.Environment,
156
+ meta: { dbVersion: null, fingerprint: "unknown" },
157
+ };
158
+ }
159
+ // Mirror openThings: deputy-brokered database access for the default
160
+ // container db, local open for explicit paths (src/deputy/routing.ts).
161
+ const routedDbPath = deputyRoutesDb(dbPath !== undefined ? { dbPath } : undefined)
162
+ ? deputyDbPath()
163
+ : null;
70
164
  let located;
71
165
  try {
72
- located = locateThingsDb(dbPath ? { dbPath } : undefined);
166
+ located =
167
+ routedDbPath !== null
168
+ ? { path: routedDbPath, source: "deputy", otherCandidates: [] }
169
+ : locateThingsDb(dbPath ? { dbPath } : undefined);
73
170
  }
74
171
  catch (err) {
75
172
  if (err instanceof ThingsDbNotFoundError) {
@@ -88,7 +185,10 @@ export function diagnose(dbPath, options = {}) {
88
185
  }
89
186
  let conn;
90
187
  try {
91
- conn = openConnection(located.path);
188
+ conn =
189
+ routedDbPath !== null
190
+ ? { db: createDeputyDbFacade(), path: routedDbPath, close() { } }
191
+ : openConnection(located.path);
92
192
  }
93
193
  catch (err) {
94
194
  if (err instanceof ThingsDbOpenError) {
@@ -156,6 +256,7 @@ export function diagnose(dbPath, options = {}) {
156
256
  }
157
257
  })();
158
258
  const report = {
259
+ capability,
159
260
  db: {
160
261
  path: located.path,
161
262
  source: located.source,
@@ -237,6 +338,7 @@ export function diagnose(dbPath, options = {}) {
237
338
  shortcuts: readShortcutProxies(options.availability),
238
339
  },
239
340
  recurrence: scanRecurrenceRules(conn.db),
341
+ helpers: buildHelpersReport(config.helpersMode, options.helpers),
240
342
  syncHealth: computeSyncHealth(conn.db, located.path, options.syncHealth),
241
343
  audit: scanAuditIntegrity(readAuditRecords(options.auditDir ?? auditDir())),
242
344
  };
@@ -1 +1 @@
1
- {"version":3,"file":"diagnose.js","sourceRoot":"","sources":["../src/diagnose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA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OAAO,CAAC,OAAO,CAAC;YAChE,UAAU,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;YACxE,KAAK,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC;SAC5E,CAAC;QACF,OAAO;YACL,MAAM;YACN,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY;YAC7D,IAAI,EAAE;gBACJ,SAAS,EAAE,WAAW,CAAC,eAAe;gBACtC,WAAW,EAAE,iBAAiB,KAAK,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB;aACrF;SACF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { writeCapability, type CapabilityDeps, type ReadCapability } from "./capability.ts";
2
+ import { type Wizard } from "./wizard.ts";
3
+ import { type ShortcutsState } from "./write/availability.ts";
4
+ export type SetupLeg = "read-access" | "app-control" | "shortcuts";
5
+ /**
6
+ * Where a leg stands. `pending` is a HUMAN-pace outcome (a toggle not yet
7
+ * flipped, a sheet not yet clicked) and resumes on a rerun; `denied` means
8
+ * macOS or the user refused and only the human can undo it.
9
+ */
10
+ export type SetupState = "granted" | "denied" | "pending" | "skipped";
11
+ export interface SetupStep {
12
+ leg: SetupLeg;
13
+ label: string;
14
+ state: SetupState;
15
+ /** True when the leg was already satisfied, detected without raising anything. */
16
+ alreadySatisfied: boolean;
17
+ detail: string;
18
+ }
19
+ export interface DirectSetupResult {
20
+ /** The host app every direct grant in this run attaches to. */
21
+ host: {
22
+ bundleId: string | null;
23
+ name: string;
24
+ };
25
+ steps: SetupStep[];
26
+ /** The legs that were going to put something on screen, surveyed BEFORE the first ran. */
27
+ outstanding: SetupLeg[];
28
+ denied: boolean;
29
+ pending: boolean;
30
+ /** The single closing line printed under the report. */
31
+ closing: string;
32
+ }
33
+ export interface DirectSetupDeps extends CapabilityDeps {
34
+ progress?: (line: string) => void;
35
+ /**
36
+ * The Article V wizard (./wizard.ts). At a TTY it explains each dialog before
37
+ * the leg raises it and waits for the human; off a TTY every method is inert
38
+ * and this ceremony behaves exactly as strict mode always has.
39
+ */
40
+ wizard?: Wizard;
41
+ openUrl?: (url: string) => void;
42
+ /** Send the real Apple Event that mints an Automation grant. Throws on failure. */
43
+ sendAutomationProbe?: (timeoutMs: number) => void;
44
+ /** Open the container database once, deliberately, to provoke the app-data modal. */
45
+ openContainer?: () => void;
46
+ /** Open one shortcut's install sheet. */
47
+ openShortcut?: (file: string) => void;
48
+ /** The installed proxy-shortcut census (availability.ts). */
49
+ shortcutProxies?: () => ShortcutsState;
50
+ automationTimeoutMs?: number;
51
+ }
52
+ export interface SetupSurvey {
53
+ host: {
54
+ bundleId: string | null;
55
+ name: string;
56
+ };
57
+ read: ReadCapability;
58
+ write: ReturnType<typeof writeCapability>;
59
+ shortcutsMissing: string[];
60
+ /** The legs that WOULD put something on screen. Empty means a rerun asks nothing. */
61
+ outstanding: SetupLeg[];
62
+ }
63
+ /**
64
+ * What the ceremony would do, established entirely prompt-free. This is the
65
+ * idempotence check (Article V): it is what lets a rerun skip settled legs, and
66
+ * it is what `--dry-run` reports. Raises nothing, ever.
67
+ */
68
+ export declare function surveySetup(deps?: DirectSetupDeps): SetupSurvey;
69
+ /**
70
+ * Run the direct-path ceremony. Strict mode: the banner counts what is about
71
+ * to appear, waits are bounded, and an unanswered leg leaves the run nonzero.
72
+ *
73
+ * Runs under {@link withDefaultInterrupts} for its whole synchronous span, so
74
+ * a Ctrl-C at a gate — or during a leg's bounded wait — actually stops it
75
+ * (./wizard.ts, "Why a ceremony runs with the DEFAULT signal disposition").
76
+ * Throws {@link CeremonyStopped} when the human stops at a gate.
77
+ */
78
+ export declare function directSetup(deps?: DirectSetupDeps): DirectSetupResult;