things-api 0.9.0 → 0.10.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.
- package/README.md +30 -11
- package/dist/audit/log.js +56 -2
- package/dist/audit/log.js.map +1 -1
- package/dist/audit/schema.d.ts +26 -8
- package/dist/audit/schema.js +42 -1
- package/dist/audit/schema.js.map +1 -1
- package/dist/cli/commands/area.d.ts +26 -3
- package/dist/cli/commands/area.js +125 -70
- package/dist/cli/commands/area.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +1 -1
- package/dist/cli/commands/doctor.js +44 -5
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/mcp.js +23 -4
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/project.d.ts +18 -1
- package/dist/cli/commands/project.js +69 -31
- package/dist/cli/commands/project.js.map +1 -1
- package/dist/cli/commands/reads.js +423 -157
- package/dist/cli/commands/reads.js.map +1 -1
- package/dist/cli/commands/repeat-flags.d.ts +20 -0
- package/dist/cli/commands/repeat-flags.js +76 -0
- package/dist/cli/commands/repeat-flags.js.map +1 -0
- package/dist/cli/commands/setup.js +2 -3
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/show.js +47 -24
- package/dist/cli/commands/show.js.map +1 -1
- package/dist/cli/commands/todo.d.ts +1 -1
- package/dist/cli/commands/todo.js +7 -6
- package/dist/cli/commands/todo.js.map +1 -1
- package/dist/cli/commands/writes.js +378 -148
- package/dist/cli/commands/writes.js.map +1 -1
- package/dist/cli/did-you-mean.d.ts +1 -1
- package/dist/cli/excess-args.d.ts +15 -0
- package/dist/cli/excess-args.js +51 -0
- package/dist/cli/excess-args.js.map +1 -0
- package/dist/cli/glyphs.d.ts +39 -2
- package/dist/cli/glyphs.js +91 -21
- package/dist/cli/glyphs.js.map +1 -1
- package/dist/cli/help.d.ts +54 -0
- package/dist/cli/help.js +355 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/main.js +32 -25
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/period.d.ts +7 -0
- package/dist/cli/period.js +12 -0
- package/dist/cli/period.js.map +1 -1
- package/dist/cli/read-driver.d.ts +26 -19
- package/dist/cli/read-driver.js +67 -33
- package/dist/cli/read-driver.js.map +1 -1
- package/dist/cli/render.d.ts +92 -28
- package/dist/cli/render.js +318 -97
- package/dist/cli/render.js.map +1 -1
- package/dist/cli/resolve-invocation.d.ts +42 -4
- package/dist/cli/resolve-invocation.js +97 -14
- package/dist/cli/resolve-invocation.js.map +1 -1
- package/dist/cli/tag-filters.d.ts +59 -0
- package/dist/cli/tag-filters.js +57 -0
- package/dist/cli/tag-filters.js.map +1 -0
- package/dist/cli/verb-hint.d.ts +25 -0
- package/dist/cli/verb-hint.js +138 -0
- package/dist/cli/verb-hint.js.map +1 -0
- package/dist/cli/width.d.ts +135 -0
- package/dist/cli/width.js +313 -0
- package/dist/cli/width.js.map +1 -0
- package/dist/client.d.ts +137 -24
- package/dist/client.js +105 -16
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +11 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -1
- package/dist/contracts.d.ts +87 -17
- package/dist/contracts.js +44 -1
- package/dist/contracts.js.map +1 -1
- package/dist/db/fingerprint.d.ts +12 -0
- package/dist/db/fingerprint.js +15 -1
- package/dist/db/fingerprint.js.map +1 -1
- package/dist/db/locate.js +1 -1
- package/dist/db/locate.js.map +1 -1
- package/dist/diagnose.d.ts +63 -0
- package/dist/diagnose.js +38 -1
- package/dist/diagnose.js.map +1 -1
- package/dist/index.d.ts +30 -4
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +9 -1
- package/dist/mcp/server.js +691 -133
- package/dist/mcp/server.js.map +1 -1
- package/dist/model/entities.d.ts +31 -7
- package/dist/model/entities.js.map +1 -1
- package/dist/model/mappers.d.ts +7 -0
- package/dist/model/mappers.js +7 -2
- package/dist/model/mappers.js.map +1 -1
- package/dist/model/serialize.d.ts +28 -0
- package/dist/model/serialize.js +80 -0
- package/dist/model/serialize.js.map +1 -0
- package/dist/model/when-sugar.d.ts +47 -0
- package/dist/model/when-sugar.js +45 -0
- package/dist/model/when-sugar.js.map +1 -0
- package/dist/read/area-view.d.ts +8 -1
- package/dist/read/area-view.js +49 -13
- package/dist/read/area-view.js.map +1 -1
- package/dist/read/filter-contract.d.ts +117 -0
- package/dist/read/filter-contract.js +78 -0
- package/dist/read/filter-contract.js.map +1 -0
- package/dist/read/predicates.d.ts +30 -0
- package/dist/read/predicates.js +30 -0
- package/dist/read/predicates.js.map +1 -1
- package/dist/read/project-view.d.ts +12 -1
- package/dist/read/project-view.js +39 -8
- package/dist/read/project-view.js.map +1 -1
- package/dist/read/queries.d.ts +149 -6
- package/dist/read/queries.js +250 -31
- package/dist/read/queries.js.map +1 -1
- package/dist/read/sections.d.ts +51 -0
- package/dist/read/sections.js +37 -0
- package/dist/read/sections.js.map +1 -0
- package/dist/read/sidebar-order.js +2 -1
- package/dist/read/sidebar-order.js.map +1 -1
- package/dist/read/tags.d.ts +27 -3
- package/dist/read/tags.js +83 -12
- package/dist/read/tags.js.map +1 -1
- package/dist/read/truncation.d.ts +71 -0
- package/dist/read/{pagination.js → truncation.js} +103 -94
- package/dist/read/truncation.js.map +1 -0
- package/dist/read/views.d.ts +140 -16
- package/dist/read/views.js +264 -67
- package/dist/read/views.js.map +1 -1
- package/dist/surface-copy.d.ts +19 -0
- package/dist/surface-copy.js +32 -0
- package/dist/surface-copy.js.map +1 -1
- package/dist/sync-health.d.ts +78 -0
- package/dist/sync-health.js +312 -0
- package/dist/sync-health.js.map +1 -0
- package/dist/write/accessibility-probe.d.ts +12 -0
- package/dist/write/accessibility-probe.js +63 -0
- package/dist/write/accessibility-probe.js.map +1 -0
- package/dist/write/automation-probe.d.ts +7 -0
- package/dist/write/automation-probe.js +8 -1
- package/dist/write/automation-probe.js.map +1 -1
- package/dist/write/batch.js +4 -2
- package/dist/write/batch.js.map +1 -1
- package/dist/write/capabilities.d.ts +8 -0
- package/dist/write/capabilities.js +13 -6
- package/dist/write/capabilities.js.map +1 -1
- package/dist/write/commands.d.ts +2 -0
- package/dist/write/commands.js +562 -48
- package/dist/write/commands.js.map +1 -1
- package/dist/write/edit-checklist.js +3 -2
- package/dist/write/edit-checklist.js.map +1 -1
- package/dist/write/guards.d.ts +2 -7
- package/dist/write/guards.js +64 -6
- package/dist/write/guards.js.map +1 -1
- package/dist/write/heading.js +2 -0
- package/dist/write/heading.js.map +1 -1
- package/dist/write/lock.d.ts +40 -2
- package/dist/write/lock.js +91 -14
- package/dist/write/lock.js.map +1 -1
- package/dist/write/make-repeating-project.d.ts +4 -0
- package/dist/write/make-repeating-project.js +253 -0
- package/dist/write/make-repeating-project.js.map +1 -0
- package/dist/write/operations.d.ts +145 -1
- package/dist/write/operations.js +48 -0
- package/dist/write/operations.js.map +1 -1
- package/dist/write/pipeline.d.ts +19 -0
- package/dist/write/pipeline.js +109 -26
- package/dist/write/pipeline.js.map +1 -1
- package/dist/write/pre-state.d.ts +68 -3
- package/dist/write/pre-state.js +102 -3
- package/dist/write/pre-state.js.map +1 -1
- package/dist/write/reopen.js +3 -2
- package/dist/write/reopen.js.map +1 -1
- package/dist/write/reorder.js +27 -17
- package/dist/write/reorder.js.map +1 -1
- package/dist/write/repeat-rule.d.ts +22 -0
- package/dist/write/repeat-rule.js +258 -0
- package/dist/write/repeat-rule.js.map +1 -0
- package/dist/write/reversibility.js +49 -0
- package/dist/write/reversibility.js.map +1 -1
- package/dist/write/tag-refs.d.ts +47 -0
- package/dist/write/tag-refs.js +126 -0
- package/dist/write/tag-refs.js.map +1 -0
- package/dist/write/undo.d.ts +74 -5
- package/dist/write/undo.js +493 -80
- package/dist/write/undo.js.map +1 -1
- package/dist/write/vectors/registry.d.ts +17 -1
- package/dist/write/vectors/registry.js +18 -2
- package/dist/write/vectors/registry.js.map +1 -1
- package/dist/write/vectors/types.d.ts +119 -3
- package/dist/write/vectors/ui-certification.d.ts +48 -0
- package/dist/write/vectors/ui-certification.js +46 -0
- package/dist/write/vectors/ui-certification.js.map +1 -0
- package/dist/write/vectors/ui-drag.d.ts +188 -0
- package/dist/write/vectors/ui-drag.js +1095 -0
- package/dist/write/vectors/ui-drag.js.map +1 -0
- package/dist/write/vectors/ui-recipes.d.ts +70 -0
- package/dist/write/vectors/ui-recipes.js +558 -0
- package/dist/write/vectors/ui-recipes.js.map +1 -0
- package/dist/write/vectors/ui.d.ts +137 -0
- package/dist/write/vectors/ui.js +656 -0
- package/dist/write/vectors/ui.js.map +1 -0
- package/dist/write/verify/delta.d.ts +31 -3
- package/dist/write/verify/delta.js +22 -6
- package/dist/write/verify/delta.js.map +1 -1
- package/dist/write/verify/poller.js +1 -0
- package/dist/write/verify/poller.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/exit-codes.d.ts +0 -26
- package/dist/cli/exit-codes.js +0 -26
- package/dist/cli/exit-codes.js.map +0 -1
- package/dist/cli/output.d.ts +0 -42
- package/dist/cli/output.js +0 -16
- package/dist/cli/output.js.map +0 -1
- package/dist/read/pagination.d.ts +0 -104
- package/dist/read/pagination.js.map +0 -1
package/dist/contracts.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const API_VERSION = 1;
|
|
|
13
13
|
* Package version, surfaced by `things --version` and the MCP serverInfo.
|
|
14
14
|
* Kept in lockstep with package.json by a contract test.
|
|
15
15
|
*/
|
|
16
|
-
export declare const PKG_VERSION = "0.
|
|
16
|
+
export declare const PKG_VERSION = "0.10.0";
|
|
17
17
|
/**
|
|
18
18
|
* Stable exit-code contract for the `things` CLI (mirrored by MCP error
|
|
19
19
|
* codes). Part of the public API surface consumed by agents and scripts —
|
|
@@ -38,31 +38,54 @@ export declare const ExitCode: {
|
|
|
38
38
|
readonly Environment: 7;
|
|
39
39
|
};
|
|
40
40
|
export type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
|
|
41
|
+
/**
|
|
42
|
+
* Per-section counts for a SPLIT flat view — currently only `today`'s
|
|
43
|
+
* Today / This-Evening split. One entry per section IN RENDER ORDER, each
|
|
44
|
+
* reporting the rows `shown` of the `total` that matched after all filters.
|
|
45
|
+
* Lets a renderer keep a downstream section (This Evening) honest under a
|
|
46
|
+
* single global cap without a pre-truncation copy of the view.
|
|
47
|
+
*/
|
|
48
|
+
export interface SectionCount {
|
|
49
|
+
key: "today" | "evening";
|
|
50
|
+
shown: number;
|
|
51
|
+
total: number;
|
|
52
|
+
}
|
|
41
53
|
/**
|
|
42
54
|
* List-view truncation metadata (ADDITIVE). Present on the meta of any read
|
|
43
55
|
* command that applies a row limit; absent on unbounded/structured views.
|
|
44
56
|
* `shown` items were returned of `total` that matched after all filters;
|
|
45
57
|
* `limit` is the effective cap (null when the caller asked for all rows);
|
|
46
58
|
* `truncated` is true exactly when `shown < total`. The dropped remainder is
|
|
47
|
-
* `total - shown`.
|
|
59
|
+
* `total - shown`. `sections` is present only on a split flat view (the Today
|
|
60
|
+
* split), breaking the whole-view counts down per render section.
|
|
48
61
|
*/
|
|
49
|
-
export interface
|
|
62
|
+
export interface Truncation {
|
|
50
63
|
shown: number;
|
|
51
64
|
total: number;
|
|
52
65
|
limit: number | null;
|
|
53
66
|
truncated: boolean;
|
|
67
|
+
/** Per-section shown/total breakdown for a split flat view; absent otherwise. */
|
|
68
|
+
sections?: SectionCount[];
|
|
54
69
|
}
|
|
55
70
|
/**
|
|
56
|
-
*
|
|
57
|
-
* sectioned detail
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
71
|
+
* One identity-carrying block of a grouped catalogue (anytime/someday) or a
|
|
72
|
+
* sectioned detail view (`area show`). Every header/section is always rendered;
|
|
73
|
+
* only the innermost item lists are capped. Emitted for every block that has
|
|
74
|
+
* rows to cap (`total > 0`) — including a block whose rows were ALL dropped
|
|
75
|
+
* (`shown: 0`), so no truncated header is untraceable. A block with no
|
|
76
|
+
* cappable rows of its own (`total: 0`) is omitted UNLESS it wraps truncated
|
|
77
|
+
* `children` — an area whose only capped content is its project item-lists
|
|
78
|
+
* still appears as their container.
|
|
79
|
+
*
|
|
80
|
+
* Blocks are NESTED: an area/loose block carries its project blocks in
|
|
81
|
+
* `children` — in anytime the project item-lists inside the area, in someday
|
|
82
|
+
* the active-project child groups found in that section. The `area show`
|
|
83
|
+
* `projects`/`area` blocks are siblings of one area and stay top-level.
|
|
61
84
|
*/
|
|
62
|
-
export interface
|
|
85
|
+
export interface GroupBlock {
|
|
63
86
|
kind: "loose" | "area" | "project" | "projects";
|
|
64
|
-
/** Container
|
|
65
|
-
|
|
87
|
+
/** Container reference (area or project uuid); null for the loose block. */
|
|
88
|
+
ref: string | null;
|
|
66
89
|
/** Container title; null for the loose block. */
|
|
67
90
|
title: string | null;
|
|
68
91
|
shown: number;
|
|
@@ -77,12 +100,14 @@ export interface BlockCount {
|
|
|
77
100
|
*/
|
|
78
101
|
totalProjects?: number;
|
|
79
102
|
totalTodos?: number;
|
|
103
|
+
/** Nested project blocks (anytime item-lists / someday active-project groups). Absent when none. */
|
|
104
|
+
children?: GroupBlock[];
|
|
80
105
|
}
|
|
81
|
-
/** Grouped-view truncation metadata (ADDITIVE); the per-block counterpart of {@link
|
|
82
|
-
export interface
|
|
106
|
+
/** Grouped-view truncation metadata (ADDITIVE); the per-block counterpart of {@link Truncation}. */
|
|
107
|
+
export interface GroupedTruncation {
|
|
83
108
|
/** True when any block hid items. */
|
|
84
109
|
truncated: boolean;
|
|
85
|
-
blocks:
|
|
110
|
+
blocks: GroupBlock[];
|
|
86
111
|
}
|
|
87
112
|
export interface EnvelopeMeta {
|
|
88
113
|
/** Things database schema version (`Meta.databaseVersion`), null when no DB was opened. */
|
|
@@ -92,15 +117,22 @@ export interface EnvelopeMeta {
|
|
|
92
117
|
/** Wall-clock duration of the command in milliseconds. */
|
|
93
118
|
elapsedMs: number;
|
|
94
119
|
/** List-view truncation metadata; present only on limited flat read views. */
|
|
95
|
-
|
|
120
|
+
truncation?: Truncation;
|
|
96
121
|
/** Per-block truncation metadata; present only on grouped views (anytime/someday). */
|
|
97
|
-
grouped?:
|
|
122
|
+
grouped?: GroupedTruncation;
|
|
98
123
|
/**
|
|
99
124
|
* The canonical `things …` command a sugar invocation normalized to (bare
|
|
100
125
|
* noun, keyword-in-show, uuid/share-link routing). Present only on routed
|
|
101
126
|
* reads reached via a sugar form; absent for canonical invocations.
|
|
102
127
|
*/
|
|
103
128
|
resolvedCommand?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Non-blocking advisories about this read (ADDITIVE). Present only when there
|
|
131
|
+
* is something to flag — currently a one-line note when the Things database
|
|
132
|
+
* schema no longer matches the version this build was validated against
|
|
133
|
+
* (reads stay best-effort; run `things doctor`). Absent means none.
|
|
134
|
+
*/
|
|
135
|
+
warnings?: string[];
|
|
104
136
|
}
|
|
105
137
|
export interface OkEnvelope<T> {
|
|
106
138
|
apiVersion: typeof API_VERSION;
|
|
@@ -131,10 +163,13 @@ export interface ErrorEnvelope {
|
|
|
131
163
|
* Structured, machine-readable failure context (ADDITIVE). For an
|
|
132
164
|
* unresolved show/bare-noun subject it carries `candidates` — the
|
|
133
165
|
* did-you-mean title matches (standard item shapes, capped) so an agent
|
|
134
|
-
* can self-correct without a second round-trip.
|
|
166
|
+
* can self-correct without a second round-trip. For a bare mutation verb
|
|
167
|
+
* (`things update <ref>`) it carries `suggestions` — the concrete
|
|
168
|
+
* namespaced command(s) to run instead.
|
|
135
169
|
*/
|
|
136
170
|
details?: {
|
|
137
171
|
candidates?: unknown[];
|
|
172
|
+
suggestions?: string[];
|
|
138
173
|
};
|
|
139
174
|
};
|
|
140
175
|
meta: EnvelopeMeta;
|
|
@@ -142,3 +177,38 @@ export interface ErrorEnvelope {
|
|
|
142
177
|
export type Envelope<T> = OkEnvelope<T> | ErrorEnvelope;
|
|
143
178
|
export declare function okEnvelope<T>(kind: string, data: T, meta: EnvelopeMeta): OkEnvelope<T>;
|
|
144
179
|
export declare function errorEnvelope(error: ErrorEnvelope["error"], meta: EnvelopeMeta): ErrorEnvelope;
|
|
180
|
+
/**
|
|
181
|
+
* Canonical machine-readable error CODE for a refused ("blocked") mutation: the
|
|
182
|
+
* specific hazard id when one is named, else the block reason. Every surface —
|
|
183
|
+
* the CLI `--json` envelope, the MCP tool error, and the audit trail — builds
|
|
184
|
+
* the `blocked:*` string HERE so the format lives in exactly one place. The
|
|
185
|
+
* input is a structural subset of the blocked mutation outcome (`hazard`,
|
|
186
|
+
* `reason`), kept as plain strings so the core never depends on the write layer.
|
|
187
|
+
*/
|
|
188
|
+
export declare function blockedCode(outcome: {
|
|
189
|
+
hazard?: string;
|
|
190
|
+
reason: string;
|
|
191
|
+
}): `blocked:${string}`;
|
|
192
|
+
/**
|
|
193
|
+
* Canonical error CODE for a mutation that executed but failed read-after-write
|
|
194
|
+
* verification (`verify-failed:<reason>`). Companion to {@link blockedCode}; see
|
|
195
|
+
* it for why this lives in the core and takes a plain-string shape.
|
|
196
|
+
*/
|
|
197
|
+
export declare function verifyFailedCode<R extends string>(outcome: {
|
|
198
|
+
reason: R;
|
|
199
|
+
}): `verify-failed:${R}`;
|
|
200
|
+
/**
|
|
201
|
+
* Aggregate exit code for a multi-op run (`things batch`): the single WORST
|
|
202
|
+
* failure decides, by the documented precedence
|
|
203
|
+
*
|
|
204
|
+
* drift-blocked > blocked > unsupported > verify-failed
|
|
205
|
+
*
|
|
206
|
+
* mirroring the per-outcome mapping the single-op path applies (drift→5,
|
|
207
|
+
* blocked→4, unsupported→6, everything else that failed→3). `failures` is the
|
|
208
|
+
* failed ops' outcomes: each carries its `kind`, plus the block `reason` so a
|
|
209
|
+
* drift block can be told apart from a policy block. An empty list is success.
|
|
210
|
+
*/
|
|
211
|
+
export declare function aggregateExitCode(failures: readonly {
|
|
212
|
+
kind: string;
|
|
213
|
+
reason?: string;
|
|
214
|
+
}[]): ExitCode;
|
package/dist/contracts.js
CHANGED
|
@@ -13,7 +13,7 @@ export const API_VERSION = 1;
|
|
|
13
13
|
* Package version, surfaced by `things --version` and the MCP serverInfo.
|
|
14
14
|
* Kept in lockstep with package.json by a contract test.
|
|
15
15
|
*/
|
|
16
|
-
export const PKG_VERSION = "0.
|
|
16
|
+
export const PKG_VERSION = "0.10.0";
|
|
17
17
|
/**
|
|
18
18
|
* Stable exit-code contract for the `things` CLI (mirrored by MCP error
|
|
19
19
|
* codes). Part of the public API surface consumed by agents and scripts —
|
|
@@ -43,4 +43,47 @@ export function okEnvelope(kind, data, meta) {
|
|
|
43
43
|
export function errorEnvelope(error, meta) {
|
|
44
44
|
return { apiVersion: API_VERSION, ok: false, kind: "error", error, meta };
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Canonical machine-readable error CODE for a refused ("blocked") mutation: the
|
|
48
|
+
* specific hazard id when one is named, else the block reason. Every surface —
|
|
49
|
+
* the CLI `--json` envelope, the MCP tool error, and the audit trail — builds
|
|
50
|
+
* the `blocked:*` string HERE so the format lives in exactly one place. The
|
|
51
|
+
* input is a structural subset of the blocked mutation outcome (`hazard`,
|
|
52
|
+
* `reason`), kept as plain strings so the core never depends on the write layer.
|
|
53
|
+
*/
|
|
54
|
+
export function blockedCode(outcome) {
|
|
55
|
+
return `blocked:${outcome.hazard ?? outcome.reason}`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Canonical error CODE for a mutation that executed but failed read-after-write
|
|
59
|
+
* verification (`verify-failed:<reason>`). Companion to {@link blockedCode}; see
|
|
60
|
+
* it for why this lives in the core and takes a plain-string shape.
|
|
61
|
+
*/
|
|
62
|
+
export function verifyFailedCode(outcome) {
|
|
63
|
+
return `verify-failed:${outcome.reason}`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Aggregate exit code for a multi-op run (`things batch`): the single WORST
|
|
67
|
+
* failure decides, by the documented precedence
|
|
68
|
+
*
|
|
69
|
+
* drift-blocked > blocked > unsupported > verify-failed
|
|
70
|
+
*
|
|
71
|
+
* mirroring the per-outcome mapping the single-op path applies (drift→5,
|
|
72
|
+
* blocked→4, unsupported→6, everything else that failed→3). `failures` is the
|
|
73
|
+
* failed ops' outcomes: each carries its `kind`, plus the block `reason` so a
|
|
74
|
+
* drift block can be told apart from a policy block. An empty list is success.
|
|
75
|
+
*/
|
|
76
|
+
export function aggregateExitCode(failures) {
|
|
77
|
+
if (failures.length === 0)
|
|
78
|
+
return ExitCode.Ok;
|
|
79
|
+
const kinds = new Set(failures.map((f) => f.kind));
|
|
80
|
+
if (failures.some((f) => f.kind === "blocked" && f.reason === "drift")) {
|
|
81
|
+
return ExitCode.DriftBlocked;
|
|
82
|
+
}
|
|
83
|
+
if (kinds.has("blocked"))
|
|
84
|
+
return ExitCode.Blocked;
|
|
85
|
+
if (kinds.has("unsupported"))
|
|
86
|
+
return ExitCode.Unsupported;
|
|
87
|
+
return ExitCode.VerifyFailed;
|
|
88
|
+
}
|
|
46
89
|
//# sourceMappingURL=contracts.js.map
|
package/dist/contracts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,eAAe;IACf,EAAE,EAAE,CAAC;IACL,4DAA4D;IAC5D,UAAU,EAAE,CAAC;IACb,kEAAkE;IAClE,KAAK,EAAE,CAAC;IACR,uGAAuG;IACvG,YAAY,EAAE,CAAC;IACf,wFAAwF;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CAAC;IAC/B,CAAC;IACD,IAAI,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC;IAClD,IAAI,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC;QAAE,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC1D,OAAO,QAAQ,CAAC,YAAY,CAAC;AAC/B,CAAC"}
|
package/dist/db/fingerprint.d.ts
CHANGED
|
@@ -40,3 +40,15 @@ export interface Baseline {
|
|
|
40
40
|
knownThingsAppVersions: string[];
|
|
41
41
|
}
|
|
42
42
|
export declare function compareToBaseline(observation: SchemaObservation, baselines: readonly Baseline[]): FingerprintStatus;
|
|
43
|
+
/**
|
|
44
|
+
* The read-path view of {@link FingerprintStatus}: the comparison outcome
|
|
45
|
+
* reduced to the discriminant a consumer surface acts on, plus the human
|
|
46
|
+
* detail lines (for drift, the missing tables/columns). Reads consult this to
|
|
47
|
+
* WARN — never to block; the write path keeps using the full FingerprintStatus.
|
|
48
|
+
*/
|
|
49
|
+
export interface SchemaStatus {
|
|
50
|
+
status: "ok" | "drift" | "unknown-version";
|
|
51
|
+
detail: string[];
|
|
52
|
+
}
|
|
53
|
+
/** Reduce a cached {@link FingerprintStatus} to the read-path {@link SchemaStatus}. */
|
|
54
|
+
export declare function toSchemaStatus(fp: FingerprintStatus): SchemaStatus;
|
package/dist/db/fingerprint.js
CHANGED
|
@@ -29,7 +29,7 @@ export function observeSchema(db) {
|
|
|
29
29
|
const extraColumns = rows
|
|
30
30
|
.map((r) => r.name)
|
|
31
31
|
.filter((name) => !declaredSet.has(name))
|
|
32
|
-
.
|
|
32
|
+
.toSorted();
|
|
33
33
|
return { table, present: rows.length > 0, columns, extraColumns };
|
|
34
34
|
});
|
|
35
35
|
const canonical = tables.map((t) => ({
|
|
@@ -79,4 +79,18 @@ export function compareToBaseline(observation, baselines) {
|
|
|
79
79
|
});
|
|
80
80
|
return { kind: "drift", observation, expected: baseline.fingerprint, detail };
|
|
81
81
|
}
|
|
82
|
+
/** Reduce a cached {@link FingerprintStatus} to the read-path {@link SchemaStatus}. */
|
|
83
|
+
export function toSchemaStatus(fp) {
|
|
84
|
+
switch (fp.kind) {
|
|
85
|
+
case "ok":
|
|
86
|
+
return { status: "ok", detail: [] };
|
|
87
|
+
case "drift":
|
|
88
|
+
return { status: "drift", detail: fp.detail };
|
|
89
|
+
case "unknown-version":
|
|
90
|
+
return {
|
|
91
|
+
status: "unknown-version",
|
|
92
|
+
detail: [`unrecognized databaseVersion: ${fp.observation.databaseVersion ?? "unknown"}`],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
82
96
|
//# sourceMappingURL=fingerprint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../src/db/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAsB,CAAC,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA+BlF,MAAM,UAAU,aAAa,CAAC,EAAgB;IAC5C,MAAM,MAAM,GAAiB,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACrD,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAA4B,CAAC;QAC1F,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAsB,EAAE;YACxD,MAAM,GAAG,GAAG,MAAM,CAA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BAAiB;YACpB,OAAO;gBACL,MAAM,EAAE,iBAAiB;gBACzB,MAAM,EAAE,CAAC,iCAAiC,EAAE,CAAC,WAAW,CAAC,eAAe,IAAI,SAAS,EAAE,CAAC;aACzF,CAAC;IACN,CAAC;AACH,CAAC"}
|
package/dist/db/locate.js
CHANGED
|
@@ -31,7 +31,7 @@ export function locateThingsDb(options) {
|
|
|
31
31
|
}
|
|
32
32
|
const byMtime = matches
|
|
33
33
|
.map((path) => ({ path, mtime: statSync(path).mtimeMs }))
|
|
34
|
-
.
|
|
34
|
+
.toSorted((a, b) => b.mtime - a.mtime);
|
|
35
35
|
const first = byMtime[0];
|
|
36
36
|
if (!first)
|
|
37
37
|
throw new ThingsDbNotFoundError(join(home, CONTAINER_GLOB));
|
package/dist/db/locate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locate.js","sourceRoot":"","sources":["../../src/db/locate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,cAAc,GAAG,IAAI,CACzB,gEAAgE,EAChE,yDAAyD,CAC1D,CAAC;AASF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,QAAgB;QAC1B,KAAK,CACH,uCAAuC,QAAQ,KAAK;YAClD,8DAA8D;YAC9D,oDAAoD,CACvD,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,MAAM,UAAU,cAAc,CAAC,OAA4C;IACzE,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;QACpB,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC;IAC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KAAK;QAAE,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;IACxE,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,WAAW;QACnB,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;KAC7D,CAAC;AACJ,CAAC"}
|
package/dist/diagnose.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type AutomationProbeDeps, type AutomationProbeStatus } from "./write/automation-probe.ts";
|
|
2
|
+
import { type AccessibilityProbeDeps, type AccessibilityProbeStatus } from "./write/accessibility-probe.ts";
|
|
3
|
+
import { type CertificationStatus } from "./write/vectors/ui-certification.ts";
|
|
2
4
|
import { type AvailabilityDeps, type ShortcutsState, type UrlSchemeState } from "./write/availability.ts";
|
|
3
5
|
import { type EnvironmentChange, type EnvironmentTracker, type EnvironmentTuple } from "./write/environment.ts";
|
|
6
|
+
import { type SyncHealth, type SyncHealthDeps } from "./sync-health.ts";
|
|
4
7
|
import { ExitCode, type EnvelopeMeta } from "./contracts.ts";
|
|
5
8
|
export interface DiagnoseReport {
|
|
6
9
|
db: {
|
|
@@ -42,6 +45,29 @@ export interface DiagnoseReport {
|
|
|
42
45
|
status: AutomationProbeStatus | "not-probed";
|
|
43
46
|
detail: string;
|
|
44
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* The Accessibility GUI ("ui") vector's health: whether it is enabled on
|
|
50
|
+
* this machine, whether the app is running, the Accessibility grant + recipe
|
|
51
|
+
* canary (opt-in, --probe-accessibility, mirroring the Automation probe so a
|
|
52
|
+
* diagnostic never triggers a surprise TCC prompt), and per-op certification.
|
|
53
|
+
*/
|
|
54
|
+
ui: {
|
|
55
|
+
/** config.ui.enabled — the first of the vector's two keys. */
|
|
56
|
+
enabled: boolean;
|
|
57
|
+
appRunning: boolean;
|
|
58
|
+
accessibility: {
|
|
59
|
+
status: AccessibilityProbeStatus | "not-probed";
|
|
60
|
+
detail: string;
|
|
61
|
+
};
|
|
62
|
+
/** Manifest profile ("provisional" until a real-hardware sitting lands). */
|
|
63
|
+
certificationProfile: string;
|
|
64
|
+
/** Per-op certification: recipes ship uncertified until certified on hardware. */
|
|
65
|
+
certification: {
|
|
66
|
+
op: string;
|
|
67
|
+
status: CertificationStatus;
|
|
68
|
+
}[];
|
|
69
|
+
reason: string;
|
|
70
|
+
};
|
|
45
71
|
availability: {
|
|
46
72
|
/** On-disk 'Enable Things URLs' state (group-container plist; Phase 21b). */
|
|
47
73
|
urlScheme: UrlSchemeState;
|
|
@@ -59,6 +85,24 @@ export interface DiagnoseReport {
|
|
|
59
85
|
undecodable: number;
|
|
60
86
|
detail: string;
|
|
61
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Local-history integrity: writes that were STARTED but whose result was
|
|
90
|
+
* never recorded (M3). Each mutation records its intent before touching the
|
|
91
|
+
* app and its outcome after; an intent with no recorded outcome means the
|
|
92
|
+
* process died mid-write, so a change may have been applied without being
|
|
93
|
+
* saved to the local history. A non-zero count is advisory, not a failure.
|
|
94
|
+
*/
|
|
95
|
+
audit: {
|
|
96
|
+
orphanedIntents: number;
|
|
97
|
+
newestOrphanIntent: string | null;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Freshness + sync-liveness proxies for long-running headless operation
|
|
101
|
+
* (docs/lab/headless-research.md SYNC1 + SYNC2): app-running, WAL write
|
|
102
|
+
* activity, last local edit, last foreground, and — only when a Things Cloud
|
|
103
|
+
* account is attached — the sync engine's last-attempt timestamp.
|
|
104
|
+
*/
|
|
105
|
+
syncHealth: SyncHealth;
|
|
62
106
|
}
|
|
63
107
|
export interface DiagnoseOptions {
|
|
64
108
|
/**
|
|
@@ -68,10 +112,22 @@ export interface DiagnoseOptions {
|
|
|
68
112
|
* not running so a diagnostic never launches the app.
|
|
69
113
|
*/
|
|
70
114
|
probeAutomation?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Actively test Accessibility consent + the ui recipe canary by querying the
|
|
117
|
+
* Things UI tree once. Opt-in for the same reason as probeAutomation: the
|
|
118
|
+
* probe itself can make macOS show the Accessibility prompt.
|
|
119
|
+
*/
|
|
120
|
+
probeAccessibility?: boolean;
|
|
71
121
|
/** Test seams. */
|
|
72
122
|
probeDeps?: AutomationProbeDeps;
|
|
123
|
+
/** Test seam for the Accessibility probe. */
|
|
124
|
+
accessibilityProbeDeps?: AccessibilityProbeDeps;
|
|
73
125
|
environment?: EnvironmentTracker;
|
|
74
126
|
availability?: AvailabilityDeps;
|
|
127
|
+
/** Test seams for the sync-health section (clock, process check, WAL/plist readers). */
|
|
128
|
+
syncHealth?: SyncHealthDeps;
|
|
129
|
+
/** Directory holding the audit JSONL files; defaults to the state dir. Test seam. */
|
|
130
|
+
auditDir?: string;
|
|
75
131
|
}
|
|
76
132
|
export interface DiagnoseResult {
|
|
77
133
|
report: DiagnoseReport | null;
|
|
@@ -83,4 +139,11 @@ export interface DiagnoseResult {
|
|
|
83
139
|
exitCode: ExitCode;
|
|
84
140
|
meta: Pick<EnvelopeMeta, "dbVersion" | "fingerprint">;
|
|
85
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Which bundled Apple Shortcuts proxies are installed — a standalone
|
|
144
|
+
* environment accessor that needs no database (the shortcuts probe is a pure
|
|
145
|
+
* host check). The public capability behind `things setup shortcuts`; the full
|
|
146
|
+
* {@link diagnose} report carries the same state under `availability.shortcuts`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function shortcutProxies(deps?: AvailabilityDeps): ShortcutsState;
|
|
86
149
|
export declare function diagnose(dbPath?: string, options?: DiagnoseOptions): DiagnoseResult;
|
package/dist/diagnose.js
CHANGED
|
@@ -5,15 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { loadConfig } from "./config.js";
|
|
8
|
+
import { auditDir } from "./paths.js";
|
|
9
|
+
import { readAuditRecords, scanAuditIntegrity } from "./write/undo.js";
|
|
8
10
|
import { decodeRecurrenceRule } from "./model/recurrence.js";
|
|
9
11
|
import { BASELINES } from "./db/baselines/index.js";
|
|
10
12
|
import { openConnection, ThingsDbOpenError } from "./db/connection.js";
|
|
11
13
|
import { compareToBaseline, observeSchema } from "./db/fingerprint.js";
|
|
12
14
|
import { locateThingsDb, ThingsDbNotFoundError } from "./db/locate.js";
|
|
13
|
-
import { probeAutomation, } from "./write/automation-probe.js";
|
|
15
|
+
import { isThingsRunning, probeAutomation, } from "./write/automation-probe.js";
|
|
16
|
+
import { probeAccessibility, } from "./write/accessibility-probe.js";
|
|
17
|
+
import { allCertifications, UI_CERTIFICATION_PROFILE, } from "./write/vectors/ui-certification.js";
|
|
14
18
|
import { readShortcutProxies, readUrlSchemeEnabled, } from "./write/availability.js";
|
|
15
19
|
import { createEnvironmentTracker, diffEnvironment, } from "./write/environment.js";
|
|
16
20
|
import { sdefDeclaresPrivateReorder } from "./write/experimental.js";
|
|
21
|
+
import { computeSyncHealth } from "./sync-health.js";
|
|
17
22
|
import { ExitCode, PKG_VERSION } from "./contracts.js";
|
|
18
23
|
const THINGS_APP = "/Applications/Things3.app";
|
|
19
24
|
/** Decode every repeating template's rule blob; count the failures. */
|
|
@@ -51,6 +56,15 @@ function scanRecurrenceRules(db) {
|
|
|
51
56
|
"templates are unavailable",
|
|
52
57
|
};
|
|
53
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Which bundled Apple Shortcuts proxies are installed — a standalone
|
|
61
|
+
* environment accessor that needs no database (the shortcuts probe is a pure
|
|
62
|
+
* host check). The public capability behind `things setup shortcuts`; the full
|
|
63
|
+
* {@link diagnose} report carries the same state under `availability.shortcuts`.
|
|
64
|
+
*/
|
|
65
|
+
export function shortcutProxies(deps = {}) {
|
|
66
|
+
return readShortcutProxies(deps);
|
|
67
|
+
}
|
|
54
68
|
export function diagnose(dbPath, options = {}) {
|
|
55
69
|
let located;
|
|
56
70
|
try {
|
|
@@ -162,11 +176,34 @@ export function diagnose(dbPath, options = {}) {
|
|
|
162
176
|
detail: "opt-in: pass --probe-automation to actively test Automation consent (may " +
|
|
163
177
|
"show a one-time macOS prompt; skipped when Things is not running)",
|
|
164
178
|
},
|
|
179
|
+
ui: {
|
|
180
|
+
enabled: config.ui.enabled,
|
|
181
|
+
appRunning: isThingsRunning(),
|
|
182
|
+
accessibility: options.probeAccessibility === true
|
|
183
|
+
? probeAccessibility(options.accessibilityProbeDeps)
|
|
184
|
+
: {
|
|
185
|
+
status: "not-probed",
|
|
186
|
+
detail: "opt-in: pass --probe-accessibility to test Accessibility consent + the recipe " +
|
|
187
|
+
"canary (may show a one-time macOS prompt; skipped when Things is not running)",
|
|
188
|
+
},
|
|
189
|
+
certificationProfile: UI_CERTIFICATION_PROFILE,
|
|
190
|
+
certification: allCertifications().map(({ op, entry }) => ({
|
|
191
|
+
op,
|
|
192
|
+
status: entry.status,
|
|
193
|
+
})),
|
|
194
|
+
reason: config.ui.enabled
|
|
195
|
+
? "on — GUI-driven ops available (each still needs --dangerously-drive-gui and grants " +
|
|
196
|
+
"Accessibility; recipes are uncertified until a real-hardware sitting)"
|
|
197
|
+
: "off — GUI-driven ops unavailable (`things config set ui-enabled true` to opt in; " +
|
|
198
|
+
"intended for a dedicated always-on Mac, see docs/setup.md)",
|
|
199
|
+
},
|
|
165
200
|
availability: {
|
|
166
201
|
urlScheme: readUrlSchemeEnabled(options.availability),
|
|
167
202
|
shortcuts: readShortcutProxies(options.availability),
|
|
168
203
|
},
|
|
169
204
|
recurrence: scanRecurrenceRules(conn.db),
|
|
205
|
+
syncHealth: computeSyncHealth(conn.db, located.path, options.syncHealth),
|
|
206
|
+
audit: scanAuditIntegrity(readAuditRecords(options.auditDir ?? auditDir())),
|
|
170
207
|
};
|
|
171
208
|
return {
|
|
172
209
|
report,
|
package/dist/diagnose.js.map
CHANGED
|
@@ -1 +1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AE,mBAAmB,CAAC,OAAO,CAAC,YAAY,CAAC;aACrD;YACD,UAAU,EAAE,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* See docs/design/architecture.md.
|
|
7
7
|
*/
|
|
8
8
|
export { openThings } from "./client.ts";
|
|
9
|
-
export type { OpenOptions, ThingsClient } from "./client.ts";
|
|
9
|
+
export type { BoundedAreaView, BoundedList, BoundedSectionsView, BoundedTodayView, GroupedBound, ListBound, OpenOptions, ThingsClient, } from "./client.ts";
|
|
10
|
+
export type { Truncation, GroupedTruncation, GroupBlock, SectionCount } from "./contracts.ts";
|
|
10
11
|
export { diagnose } from "./diagnose.ts";
|
|
11
12
|
export type { DiagnoseOptions, DiagnoseReport, DiagnoseResult } from "./diagnose.ts";
|
|
12
13
|
export { probeAutomation } from "./write/automation-probe.ts";
|
|
@@ -17,12 +18,12 @@ export type { FailureHint, LikelyCause } from "./write/failure-hints.ts";
|
|
|
17
18
|
export { capabilitiesTable } from "./write/capabilities.ts";
|
|
18
19
|
export type { CapabilityEntry } from "./write/capabilities.ts";
|
|
19
20
|
export { saveConfigKey } from "./config.ts";
|
|
20
|
-
export { createThingsMcpServer } from "./mcp/server.ts";
|
|
21
|
-
export type { McpServerOptions } from "./mcp/server.ts";
|
|
22
21
|
export type { UndoItemResult, UndoOptions, UndoPlan, UndoStep } from "./write/undo.ts";
|
|
23
22
|
export type { BatchItemResult, BatchOp, BatchOptions } from "./write/batch.ts";
|
|
24
23
|
export type { ReorderResult } from "./write/reorder.ts";
|
|
25
24
|
export type { SearchOptions, SomedayFilter, UpcomingFilter, ViewFilter, ChangedItem, } from "./read/views.ts";
|
|
25
|
+
export { FILTER_CONTRACT, hasTagPresence, tagFlagConflict, tagFilterFields, validateViewArgs, } from "./read/filter-contract.ts";
|
|
26
|
+
export type { BoundModel, FilterArgs, FilterVocab, TagPresence, TagSemantics, ViewFilterSpec, ViewName, ViewValidation, } from "./read/filter-contract.ts";
|
|
26
27
|
export type { Acknowledgements, AreaAddParams, ContainerRef, OperationKind, OperationParamsMap, ProjectAddParams, ProjectCompleteParams, ProjectMoveParams, ProjectUpdateParams, ReorderParams, ReorderScope, ReorderStrategy, TagAddParams, TagUpdateParams, AreaUpdateParams, TodoAddParams, TodoMoveParams, TodoUpdateParams, WhenValue, } from "./write/operations.ts";
|
|
27
28
|
export { OPERATION_KINDS } from "./write/operations.ts";
|
|
28
29
|
export type { MutationPlan, MutationResult, WriteOptions } from "./write/pipeline.ts";
|
|
@@ -39,9 +40,34 @@ export type { IsoDate } from "./model/dates.ts";
|
|
|
39
40
|
export type { ListItem, SidebarSection, TodayView } from "./read/views.ts";
|
|
40
41
|
export type { ProjectView } from "./read/project-view.ts";
|
|
41
42
|
export type { AreaView } from "./read/area-view.ts";
|
|
43
|
+
export { isActiveProjectRow, isScheduledProjectRow, isSomedayProjectRow, } from "./read/area-view.ts";
|
|
42
44
|
export { ProjectNotFoundError } from "./read/project-view.ts";
|
|
45
|
+
export { ReferenceResolutionError } from "./read/queries.ts";
|
|
46
|
+
export type { RefCandidate } from "./read/queries.ts";
|
|
47
|
+
export { splitWhenSugar, CLI_WHEN_LABELS, MCP_WHEN_LABELS } from "./model/when-sugar.ts";
|
|
48
|
+
export type { WhenSugar, WhenSugarLabels } from "./model/when-sugar.ts";
|
|
43
49
|
export { ThingsDbNotFoundError } from "./db/locate.ts";
|
|
44
50
|
export { ThingsDbOpenError } from "./db/connection.ts";
|
|
45
51
|
export type { Baseline, FingerprintStatus, SchemaObservation } from "./db/fingerprint.ts";
|
|
46
|
-
export { API_VERSION, ExitCode, PKG_VERSION } from "./contracts.ts";
|
|
52
|
+
export { aggregateExitCode, API_VERSION, blockedCode, errorEnvelope, ExitCode, okEnvelope, PKG_VERSION, verifyFailedCode, } from "./contracts.ts";
|
|
47
53
|
export type { Envelope, EnvelopeMeta, ErrorEnvelope, OkEnvelope } from "./contracts.ts";
|
|
54
|
+
export * from "./surface-copy.ts";
|
|
55
|
+
export { omitEmpty } from "./model/serialize.ts";
|
|
56
|
+
export { localToday } from "./model/dates.ts";
|
|
57
|
+
export { templateStatus } from "./model/recurrence.ts";
|
|
58
|
+
export { isTodayMember } from "./read/views.ts";
|
|
59
|
+
export type { LiteCandidate, LiteSearchResult } from "./read/views.ts";
|
|
60
|
+
export { partitionSomedaySection, splitSectionBlocks } from "./read/sections.ts";
|
|
61
|
+
export type { GroupedLimits } from "./read/sections.ts";
|
|
62
|
+
export { noUuidMatch, stripThingsUri } from "./read/queries.ts";
|
|
63
|
+
export type { Snapshot } from "./read/snapshot.ts";
|
|
64
|
+
export type { ShowTarget } from "./read/show-target.ts";
|
|
65
|
+
export type { ChecklistEdit } from "./client.ts";
|
|
66
|
+
export type { TagRef } from "./model/entities.ts";
|
|
67
|
+
export { outcomeFailed } from "./write/batch.ts";
|
|
68
|
+
export { BOUNCE_MAX_ITEMS } from "./write/reorder.ts";
|
|
69
|
+
export type { MonthlyAnchor, RepeatFrequency, RepeatRuleParams, Weekday, WeekdayOrdinal, YearlyAnchor, } from "./write/operations.ts";
|
|
70
|
+
export { shortcutProxies } from "./diagnose.ts";
|
|
71
|
+
export type { ShortcutsState } from "./write/availability.ts";
|
|
72
|
+
export type { McpServerOptions } from "./mcp/server.ts";
|
|
73
|
+
export declare function loadMcpServer(): Promise<typeof import("./mcp/server.ts")>;
|
package/dist/index.js
CHANGED
|
@@ -11,13 +11,46 @@ export { probeAutomation } from "./write/automation-probe.js";
|
|
|
11
11
|
export { createEnvironmentTracker, describeEnvironmentChanges, diffEnvironment, } from "./write/environment.js";
|
|
12
12
|
export { capabilitiesTable } from "./write/capabilities.js";
|
|
13
13
|
export { saveConfigKey } from "./config.js";
|
|
14
|
-
|
|
14
|
+
// The per-view read-filter contract: the declarative applicability table plus
|
|
15
|
+
// the shared tag-conflict predicates both surfaces enforce. See
|
|
16
|
+
// docs/design/architecture.md (Consumer boundary).
|
|
17
|
+
export { FILTER_CONTRACT, hasTagPresence, tagFlagConflict, tagFilterFields, validateViewArgs, } from "./read/filter-contract.js";
|
|
15
18
|
export { OPERATION_KINDS } from "./write/operations.js";
|
|
16
19
|
export { HAZARD_IDS } from "./write/guards.js";
|
|
17
20
|
export { APPLESCRIPT_MATRIX } from "./write/vectors/applescript.js";
|
|
18
21
|
export { URL_SCHEME_MATRIX } from "./write/vectors/url-scheme.js";
|
|
22
|
+
export { isActiveProjectRow, isScheduledProjectRow, isSomedayProjectRow, } from "./read/area-view.js";
|
|
19
23
|
export { ProjectNotFoundError } from "./read/project-view.js";
|
|
24
|
+
// Reference resolution: the stable public error a uuid/partial-uuid/name raises
|
|
25
|
+
// when it resolves to zero or several entities, carrying the machine shape the
|
|
26
|
+
// CLI --json envelope and MCP tool errors surface (code + candidates).
|
|
27
|
+
export { ReferenceResolutionError } from "./read/queries.js";
|
|
28
|
+
// The shared `<when>@<time>` scheduling sugar parser (CLI + MCP).
|
|
29
|
+
export { splitWhenSugar, CLI_WHEN_LABELS, MCP_WHEN_LABELS } from "./model/when-sugar.js";
|
|
20
30
|
export { ThingsDbNotFoundError } from "./db/locate.js";
|
|
21
31
|
export { ThingsDbOpenError } from "./db/connection.js";
|
|
22
|
-
export { API_VERSION, ExitCode, PKG_VERSION } from "./contracts.js";
|
|
32
|
+
export { aggregateExitCode, API_VERSION, blockedCode, errorEnvelope, ExitCode, okEnvelope, PKG_VERSION, verifyFailedCode, } from "./contracts.js";
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Consumer-surface support: everything below is exported so the CLI and MCP
|
|
35
|
+
// server can consume it through this one entry point (the air-gap boundary,
|
|
36
|
+
// docs/design/architecture.md). None of it reaches back into surface code.
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Consumer-facing shared copy (parameter vocabulary + read-path advisory).
|
|
39
|
+
export * from "./surface-copy.js";
|
|
40
|
+
// Pure model/read helpers the presentation layers reuse.
|
|
41
|
+
export { omitEmpty } from "./model/serialize.js";
|
|
42
|
+
export { localToday } from "./model/dates.js";
|
|
43
|
+
export { templateStatus } from "./model/recurrence.js";
|
|
44
|
+
export { isTodayMember } from "./read/views.js";
|
|
45
|
+
export { partitionSomedaySection, splitSectionBlocks } from "./read/sections.js";
|
|
46
|
+
export { noUuidMatch, stripThingsUri } from "./read/queries.js";
|
|
47
|
+
// Write-path values/types the surfaces render or gate on.
|
|
48
|
+
export { outcomeFailed } from "./write/batch.js";
|
|
49
|
+
export { BOUNCE_MAX_ITEMS } from "./write/reorder.js";
|
|
50
|
+
// Shortcut-proxy availability: a proper library accessor (setup consumes it
|
|
51
|
+
// without opening a database). See shortcutProxies in diagnose.ts.
|
|
52
|
+
export { shortcutProxies } from "./diagnose.js";
|
|
53
|
+
export function loadMcpServer() {
|
|
54
|
+
return import("./mcp/server.js");
|
|
55
|
+
}
|
|
23
56
|
//# sourceMappingURL=index.js.map
|