@sackville-mcp/verify 0.0.1-alpha.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Curtis Autery
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,102 @@
1
+ import { CaptureVerdictFacts, CompositeVerdict, VerdictPolicy } from "@sackville-mcp/verdict";
2
+ import { ContractResult } from "@sackville-mcp/api";
3
+ import { DiffCoverageReport } from "@sackville-mcp/coverage";
4
+ import { DependencyAudit } from "@sackville-mcp/deps";
5
+ import { FlakeVerdict } from "@sackville-mcp/flake";
6
+ import { MutationSummary } from "@sackville-mcp/mutate";
7
+
8
+ //#region src/gate.d.ts
9
+ /**
10
+ * The gate-denial brand (ADR 0013 Addendum, milestone 5c — "compose, never widen").
11
+ *
12
+ * A run-driving pillar can reject for two very different reasons: its **own**
13
+ * operator gate denied the run (the pillar was never executed — `skipReason:
14
+ * 'gate-not-set'`), or it ran and **crashed** (`errorReason`). The orchestrator must
15
+ * tell them apart, but it must NOT import any engine runtime to do so (the
16
+ * spawn-free invariant, § gate (e)). So the contract is a structural brand carried
17
+ * on the error itself, keyed by a GLOBAL symbol — `Symbol.for(...)` resolves to the
18
+ * same symbol in every package WITHOUT a shared import, so each pillar's own
19
+ * `*GateError` (and the surface's no-fetcher / no-DB checks) can set it and the
20
+ * orchestrator can read it with zero coupling.
21
+ *
22
+ * This reuses each pillar's REAL gate decision (`assertAllowed`) — there is no
23
+ * reimplemented gate predicate here to drift out of sync.
24
+ */
25
+ declare const GATE_DENIAL: unique symbol;
26
+ /** True when `reason` is branded as a pillar gate DENIAL (not a runtime failure). */
27
+ declare function isGateDenial(reason: unknown): boolean;
28
+ /**
29
+ * Mint a gate-denial error. Used by the surface for an unmet gate that does NOT
30
+ * surface as a pillar `*GateError` — e.g. deps with network off (no packument
31
+ * fetcher) or flake with no history DB configured. Both must read as
32
+ * `skipReason:'gate-not-set'`, never `errored` (ADR 0013 Addendum § execution).
33
+ */
34
+ declare function gateDenied(message: string): Error;
35
+ //#endregion
36
+ //#region src/orchestrate.d.ts
37
+ /**
38
+ * Per-pillar run request. Each present pillar carries an async `run` thunk that
39
+ * produces that pillar's NATIVE result — the orchestrator maps it via the existing
40
+ * `@sackville-mcp/verdict` `from*` adapter. The thunk is wired by the surface (bin/CLI)
41
+ * to the pillar's own gated runner, so `@sackville-mcp/verify` itself imports zero
42
+ * spawn-capable engine code (§ gate (e)). A rejection branded as a gate denial maps
43
+ * to `skipReason:'gate-not-set'`; any other rejection to a redacted `errorReason`.
44
+ */
45
+ interface OrchestrateRequest {
46
+ /** The contract thunk returns EITHER the bare results (compose path — folded by
47
+ * `fromContractResults`) OR the FULL capture verdict facts (consume / produce paths —
48
+ * folded by `fromCaptureVerdict` so a not-`clean` capture is inconclusive, never a pass;
49
+ * 5f, ADR 0013 Addendum 4). */
50
+ contract?: {
51
+ run: () => Promise<ContractResult[] | CaptureVerdictFacts>;
52
+ source?: 'run' | 'capture-from-HAR';
53
+ };
54
+ coverage?: {
55
+ run: () => Promise<DiffCoverageReport>;
56
+ };
57
+ deps?: {
58
+ run: () => Promise<{
59
+ audits: DependencyAudit[];
60
+ osvSnapshotLoaded: boolean;
61
+ }>;
62
+ };
63
+ flake?: {
64
+ run: () => Promise<FlakeVerdict[]>;
65
+ };
66
+ mutate?: {
67
+ run: () => Promise<MutationSummary>;
68
+ };
69
+ }
70
+ interface OrchestrateOptions {
71
+ /** The policy cut threaded straight through to `composeVerdict` (no default). */
72
+ policy?: VerdictPolicy;
73
+ /** Mint the verdict id (default `randomUUID`); tests inject a deterministic stub. */
74
+ idFactory?: () => string;
75
+ /** Redact a string before it enters the verdict (default identity). */
76
+ redact?: (value: string) => string;
77
+ }
78
+ interface OrchestrateResult {
79
+ /** The id under which the surface stores the full verdict by handle. */
80
+ id: string;
81
+ verdict: CompositeVerdict;
82
+ }
83
+ /**
84
+ * Drive the requested pillars and fold them into one `CompositeVerdict` (ADR 0013
85
+ * Addendum, milestone 5c). Each requested pillar's `run` thunk is invoked
86
+ * concurrently; each task catches its own rejection (the per-pillar failure
87
+ * isolation `Promise.allSettled` gives) so one pillar's crash/timeout never sinks the
88
+ * verdict. A fulfilled run is mapped through the existing `from*` adapter; a rejected
89
+ * run becomes a `no-signal` contributor: a branded gate denial ⇒
90
+ * `skipReason:'gate-not-set'` (never run), any other crash ⇒ a **redacted**
91
+ * `errorReason`. Pillars not in the request are folded as `missing`. "Absence is
92
+ * never a pass" therefore holds for skipped/errored/missing pillars for free (all
93
+ * fold to `inconclusive`).
94
+ *
95
+ * Pure orchestration: the `run` thunks (wired by the surface to each pillar's own
96
+ * gated runner) are the only side-effecting code; this module imports no engine
97
+ * runtime — gate denials are recognized structurally via the global-symbol brand.
98
+ */
99
+ declare function orchestrate(request: OrchestrateRequest, options?: OrchestrateOptions): Promise<OrchestrateResult>;
100
+ //#endregion
101
+ export { GATE_DENIAL, type OrchestrateOptions, type OrchestrateRequest, type OrchestrateResult, gateDenied, isGateDenial, orchestrate };
102
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/gate.ts","../src/orchestrate.ts"],"mappings":";;;;;;;;;;;;;;;;AAgBA;;;;AAA6E;AAG7E;;;cAHa,WAAA;AAG+B;AAAA,iBAA5B,YAAA,CAAa,MAAe;;;;AAcM;;;iBAAlC,UAAA,CAAW,OAAA,WAAkB,KAAK;;;;;AAjBlD;;;;AAA6E;AAG7E;UCYiB,kBAAA;;;ADZ2B;AAc5C;ECGE,QAAA;IACE,GAAA,QAAW,OAAA,CAAQ,cAAA,KAAmB,mBAAA;IACtC,MAAA;EAAA;EAEF,QAAA;IAAa,GAAA,QAAW,OAAA,CAAQ,kBAAA;EAAA;EAChC,IAAA;IAAS,GAAA,QAAW,OAAA;MAAU,MAAA,EAAQ,eAAA;MAAmB,iBAAA;IAAA;EAAA;EACzD,KAAA;IAAU,GAAA,QAAW,OAAA,CAAQ,YAAA;EAAA;EAC7B,MAAA;IAAW,GAAA,QAAW,OAAA,CAAQ,eAAA;EAAA;AAAA;AAAA,UAGf,kBAAA;EAHc;EAK7B,MAAA,GAAS,aAAa;EAZtB;EAcA,SAAA;EAba;EAeb,MAAA,IAAU,KAAA;AAAA;AAAA,UAGK,iBAAA;EAff;EAiBA,EAAA;EACA,OAAA,EAAS,gBAAgB;AAAA;;;;;;;;;;;;;;;;AAfoB;iBAkCzB,WAAA,CACpB,OAAA,EAAS,kBAAA,EACT,OAAA,GAAS,kBAAA,GACR,OAAA,CAAQ,iBAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,121 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { composeVerdict, fromCaptureVerdict, fromContractResults, fromDependencyAudits, fromDiffCoverage, fromFlakeVerdicts, fromMutationSummary } from "@sackville-mcp/verdict";
3
+ //#region src/gate.ts
4
+ /**
5
+ * The gate-denial brand (ADR 0013 Addendum, milestone 5c — "compose, never widen").
6
+ *
7
+ * A run-driving pillar can reject for two very different reasons: its **own**
8
+ * operator gate denied the run (the pillar was never executed — `skipReason:
9
+ * 'gate-not-set'`), or it ran and **crashed** (`errorReason`). The orchestrator must
10
+ * tell them apart, but it must NOT import any engine runtime to do so (the
11
+ * spawn-free invariant, § gate (e)). So the contract is a structural brand carried
12
+ * on the error itself, keyed by a GLOBAL symbol — `Symbol.for(...)` resolves to the
13
+ * same symbol in every package WITHOUT a shared import, so each pillar's own
14
+ * `*GateError` (and the surface's no-fetcher / no-DB checks) can set it and the
15
+ * orchestrator can read it with zero coupling.
16
+ *
17
+ * This reuses each pillar's REAL gate decision (`assertAllowed`) — there is no
18
+ * reimplemented gate predicate here to drift out of sync.
19
+ */
20
+ const GATE_DENIAL = Symbol.for("sackville.gate-denial");
21
+ /** True when `reason` is branded as a pillar gate DENIAL (not a runtime failure). */
22
+ function isGateDenial(reason) {
23
+ return typeof reason === "object" && reason !== null && reason[GATE_DENIAL] === true;
24
+ }
25
+ /**
26
+ * Mint a gate-denial error. Used by the surface for an unmet gate that does NOT
27
+ * surface as a pillar `*GateError` — e.g. deps with network off (no packument
28
+ * fetcher) or flake with no history DB configured. Both must read as
29
+ * `skipReason:'gate-not-set'`, never `errored` (ADR 0013 Addendum § execution).
30
+ */
31
+ function gateDenied(message) {
32
+ const err = new Error(message);
33
+ err[GATE_DENIAL] = true;
34
+ return err;
35
+ }
36
+ //#endregion
37
+ //#region src/orchestrate.ts
38
+ /**
39
+ * Drive the requested pillars and fold them into one `CompositeVerdict` (ADR 0013
40
+ * Addendum, milestone 5c). Each requested pillar's `run` thunk is invoked
41
+ * concurrently; each task catches its own rejection (the per-pillar failure
42
+ * isolation `Promise.allSettled` gives) so one pillar's crash/timeout never sinks the
43
+ * verdict. A fulfilled run is mapped through the existing `from*` adapter; a rejected
44
+ * run becomes a `no-signal` contributor: a branded gate denial ⇒
45
+ * `skipReason:'gate-not-set'` (never run), any other crash ⇒ a **redacted**
46
+ * `errorReason`. Pillars not in the request are folded as `missing`. "Absence is
47
+ * never a pass" therefore holds for skipped/errored/missing pillars for free (all
48
+ * fold to `inconclusive`).
49
+ *
50
+ * Pure orchestration: the `run` thunks (wired by the surface to each pillar's own
51
+ * gated runner) are the only side-effecting code; this module imports no engine
52
+ * runtime — gate denials are recognized structurally via the global-symbol brand.
53
+ */
54
+ async function orchestrate(request, options = {}) {
55
+ const idFactory = options.idFactory ?? randomUUID;
56
+ const redact = options.redact ?? ((value) => value);
57
+ const tasks = [];
58
+ const add = (pillar, produce) => {
59
+ tasks.push(produce().then((verdict) => ({
60
+ pillar,
61
+ verdict
62
+ })).catch((reason) => ({
63
+ pillar,
64
+ verdict: rejectionToPillar(pillar, reason, redact)
65
+ })));
66
+ };
67
+ if (request.contract) {
68
+ const { run, source } = request.contract;
69
+ add("contract", () => run().then((r) => Array.isArray(r) ? fromContractResults(r, source) : fromCaptureVerdict(r, source)));
70
+ }
71
+ if (request.coverage) {
72
+ const { run } = request.coverage;
73
+ add("coverage", () => run().then(fromDiffCoverage));
74
+ }
75
+ if (request.deps) {
76
+ const { run } = request.deps;
77
+ add("deps", () => run().then((r) => fromDependencyAudits(r.audits, { osvSnapshotLoaded: r.osvSnapshotLoaded })));
78
+ }
79
+ if (request.flake) {
80
+ const { run } = request.flake;
81
+ add("flake", () => run().then(fromFlakeVerdicts));
82
+ }
83
+ if (request.mutate) {
84
+ const { run } = request.mutate;
85
+ add("mutate", () => run().then(fromMutationSummary));
86
+ }
87
+ const inputs = {};
88
+ for (const { pillar, verdict } of await Promise.all(tasks)) inputs[pillar] = verdict;
89
+ return {
90
+ id: idFactory(),
91
+ verdict: composeVerdict(inputs, options.policy)
92
+ };
93
+ }
94
+ /**
95
+ * Map a rejected pillar run to its `no-signal` contributor — never a pass (ADR 0013
96
+ * Addendum, milestone 5c). "Compose, never widen": a rejection BRANDED as a gate
97
+ * denial (the pillar's own `assertAllowed`, or the surface's no-fetcher/no-DB check)
98
+ * becomes `skipReason:'gate-not-set'` — the pillar was never run, surfaced, and its
99
+ * raw message is dropped (a skip needs no detail and must not leak a path). Any other
100
+ * rejection is a genuine crash ⇒ `errorReason`, with the message **redacted**.
101
+ */
102
+ function rejectionToPillar(pillar, reason, redact) {
103
+ if (isGateDenial(reason)) return {
104
+ pillar,
105
+ status: "no-signal",
106
+ severity: "none",
107
+ headline: `${pillar} gate not set — pillar not run`,
108
+ skipReason: "gate-not-set"
109
+ };
110
+ return {
111
+ pillar,
112
+ status: "no-signal",
113
+ severity: "none",
114
+ headline: "pillar run failed",
115
+ errorReason: redact(reason instanceof Error ? reason.message : String(reason))
116
+ };
117
+ }
118
+ //#endregion
119
+ export { GATE_DENIAL, gateDenied, isGateDenial, orchestrate };
120
+
121
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/gate.ts","../src/orchestrate.ts"],"sourcesContent":["/**\n * The gate-denial brand (ADR 0013 Addendum, milestone 5c — \"compose, never widen\").\n *\n * A run-driving pillar can reject for two very different reasons: its **own**\n * operator gate denied the run (the pillar was never executed — `skipReason:\n * 'gate-not-set'`), or it ran and **crashed** (`errorReason`). The orchestrator must\n * tell them apart, but it must NOT import any engine runtime to do so (the\n * spawn-free invariant, § gate (e)). So the contract is a structural brand carried\n * on the error itself, keyed by a GLOBAL symbol — `Symbol.for(...)` resolves to the\n * same symbol in every package WITHOUT a shared import, so each pillar's own\n * `*GateError` (and the surface's no-fetcher / no-DB checks) can set it and the\n * orchestrator can read it with zero coupling.\n *\n * This reuses each pillar's REAL gate decision (`assertAllowed`) — there is no\n * reimplemented gate predicate here to drift out of sync.\n */\nexport const GATE_DENIAL: unique symbol = Symbol.for('sackville.gate-denial')\n\n/** True when `reason` is branded as a pillar gate DENIAL (not a runtime failure). */\nexport function isGateDenial(reason: unknown): boolean {\n return (\n typeof reason === 'object' &&\n reason !== null &&\n (reason as Record<symbol, unknown>)[GATE_DENIAL] === true\n )\n}\n\n/**\n * Mint a gate-denial error. Used by the surface for an unmet gate that does NOT\n * surface as a pillar `*GateError` — e.g. deps with network off (no packument\n * fetcher) or flake with no history DB configured. Both must read as\n * `skipReason:'gate-not-set'`, never `errored` (ADR 0013 Addendum § execution).\n */\nexport function gateDenied(message: string): Error {\n const err = new Error(message)\n ;(err as unknown as Record<symbol, unknown>)[GATE_DENIAL] = true\n return err\n}\n","import { randomUUID } from 'node:crypto'\nimport type { ContractResult } from '@sackville-mcp/api'\nimport type { DiffCoverageReport } from '@sackville-mcp/coverage'\nimport type { DependencyAudit } from '@sackville-mcp/deps'\nimport type { FlakeVerdict } from '@sackville-mcp/flake'\nimport type { MutationSummary } from '@sackville-mcp/mutate'\nimport {\n type CaptureVerdictFacts,\n type ComposeInputs,\n type CompositeVerdict,\n composeVerdict,\n fromCaptureVerdict,\n fromContractResults,\n fromDependencyAudits,\n fromDiffCoverage,\n fromFlakeVerdicts,\n fromMutationSummary,\n type PillarName,\n type PillarVerdict,\n type VerdictPolicy,\n} from '@sackville-mcp/verdict'\nimport { isGateDenial } from './gate.js'\n\n/**\n * Per-pillar run request. Each present pillar carries an async `run` thunk that\n * produces that pillar's NATIVE result — the orchestrator maps it via the existing\n * `@sackville-mcp/verdict` `from*` adapter. The thunk is wired by the surface (bin/CLI)\n * to the pillar's own gated runner, so `@sackville-mcp/verify` itself imports zero\n * spawn-capable engine code (§ gate (e)). A rejection branded as a gate denial maps\n * to `skipReason:'gate-not-set'`; any other rejection to a redacted `errorReason`.\n */\nexport interface OrchestrateRequest {\n /** The contract thunk returns EITHER the bare results (compose path — folded by\n * `fromContractResults`) OR the FULL capture verdict facts (consume / produce paths —\n * folded by `fromCaptureVerdict` so a not-`clean` capture is inconclusive, never a pass;\n * 5f, ADR 0013 Addendum 4). */\n contract?: {\n run: () => Promise<ContractResult[] | CaptureVerdictFacts>\n source?: 'run' | 'capture-from-HAR'\n }\n coverage?: { run: () => Promise<DiffCoverageReport> }\n deps?: { run: () => Promise<{ audits: DependencyAudit[]; osvSnapshotLoaded: boolean }> }\n flake?: { run: () => Promise<FlakeVerdict[]> }\n mutate?: { run: () => Promise<MutationSummary> }\n}\n\nexport interface OrchestrateOptions {\n /** The policy cut threaded straight through to `composeVerdict` (no default). */\n policy?: VerdictPolicy\n /** Mint the verdict id (default `randomUUID`); tests inject a deterministic stub. */\n idFactory?: () => string\n /** Redact a string before it enters the verdict (default identity). */\n redact?: (value: string) => string\n}\n\nexport interface OrchestrateResult {\n /** The id under which the surface stores the full verdict by handle. */\n id: string\n verdict: CompositeVerdict\n}\n\n/**\n * Drive the requested pillars and fold them into one `CompositeVerdict` (ADR 0013\n * Addendum, milestone 5c). Each requested pillar's `run` thunk is invoked\n * concurrently; each task catches its own rejection (the per-pillar failure\n * isolation `Promise.allSettled` gives) so one pillar's crash/timeout never sinks the\n * verdict. A fulfilled run is mapped through the existing `from*` adapter; a rejected\n * run becomes a `no-signal` contributor: a branded gate denial ⇒\n * `skipReason:'gate-not-set'` (never run), any other crash ⇒ a **redacted**\n * `errorReason`. Pillars not in the request are folded as `missing`. \"Absence is\n * never a pass\" therefore holds for skipped/errored/missing pillars for free (all\n * fold to `inconclusive`).\n *\n * Pure orchestration: the `run` thunks (wired by the surface to each pillar's own\n * gated runner) are the only side-effecting code; this module imports no engine\n * runtime — gate denials are recognized structurally via the global-symbol brand.\n */\nexport async function orchestrate(\n request: OrchestrateRequest,\n options: OrchestrateOptions = {},\n): Promise<OrchestrateResult> {\n const idFactory = options.idFactory ?? randomUUID\n const redact = options.redact ?? ((value: string) => value)\n\n // One labelled task per requested pillar, each composing the pillar's native\n // `run` thunk with its `from*` adapter. Each task catches its OWN rejection and\n // resolves to a skipped (gate-denied) or errored contributor — so the concurrent\n // `Promise.all` never rejects (the same per-pillar failure isolation\n // `Promise.allSettled` gives), while the pillar label rides along with each result.\n const tasks: Array<Promise<{ pillar: PillarName; verdict: PillarVerdict }>> = []\n const add = (pillar: PillarName, produce: () => Promise<PillarVerdict>): void => {\n tasks.push(\n produce()\n .then((verdict) => ({ pillar, verdict }))\n .catch((reason: unknown) => ({\n pillar,\n verdict: rejectionToPillar(pillar, reason, redact),\n })),\n )\n }\n\n if (request.contract) {\n const { run, source } = request.contract\n add('contract', () =>\n run().then((r) =>\n Array.isArray(r) ? fromContractResults(r, source) : fromCaptureVerdict(r, source),\n ),\n )\n }\n if (request.coverage) {\n const { run } = request.coverage\n add('coverage', () => run().then(fromDiffCoverage))\n }\n if (request.deps) {\n const { run } = request.deps\n add('deps', () =>\n run().then((r) => fromDependencyAudits(r.audits, { osvSnapshotLoaded: r.osvSnapshotLoaded })),\n )\n }\n if (request.flake) {\n const { run } = request.flake\n add('flake', () => run().then(fromFlakeVerdicts))\n }\n if (request.mutate) {\n const { run } = request.mutate\n add('mutate', () => run().then(fromMutationSummary))\n }\n\n const inputs: ComposeInputs = {}\n for (const { pillar, verdict } of await Promise.all(tasks)) {\n inputs[pillar] = verdict\n }\n\n return { id: idFactory(), verdict: composeVerdict(inputs, options.policy) }\n}\n\n/**\n * Map a rejected pillar run to its `no-signal` contributor — never a pass (ADR 0013\n * Addendum, milestone 5c). \"Compose, never widen\": a rejection BRANDED as a gate\n * denial (the pillar's own `assertAllowed`, or the surface's no-fetcher/no-DB check)\n * becomes `skipReason:'gate-not-set'` — the pillar was never run, surfaced, and its\n * raw message is dropped (a skip needs no detail and must not leak a path). Any other\n * rejection is a genuine crash ⇒ `errorReason`, with the message **redacted**.\n */\nfunction rejectionToPillar(\n pillar: PillarName,\n reason: unknown,\n redact: (value: string) => string,\n): PillarVerdict {\n if (isGateDenial(reason)) {\n return {\n pillar,\n status: 'no-signal',\n severity: 'none',\n headline: `${pillar} gate not set — pillar not run`,\n skipReason: 'gate-not-set',\n }\n }\n const message = reason instanceof Error ? reason.message : String(reason)\n return {\n pillar,\n status: 'no-signal',\n severity: 'none',\n headline: 'pillar run failed',\n errorReason: redact(message),\n }\n}\n\nexport type { PillarName, PillarVerdict }\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAa,cAA6B,OAAO,IAAI,uBAAuB;;AAG5E,SAAgB,aAAa,QAA0B;CACrD,OACE,OAAO,WAAW,YAClB,WAAW,QACV,OAAmC,iBAAiB;AAEzD;;;;;;;AAQA,SAAgB,WAAW,SAAwB;CACjD,MAAM,MAAM,IAAI,MAAM,OAAO;CAC5B,IAA4C,eAAe;CAC5D,OAAO;AACT;;;;;;;;;;;;;;;;;;;ACwCA,eAAsB,YACpB,SACA,UAA8B,CAAC,GACH;CAC5B,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,SAAS,QAAQ,YAAY,UAAkB;CAOrD,MAAM,QAAwE,CAAC;CAC/E,MAAM,OAAO,QAAoB,YAAgD;EAC/E,MAAM,KACJ,QAAQ,EACL,MAAM,aAAa;GAAE;GAAQ;EAAQ,EAAE,EACvC,OAAO,YAAqB;GAC3B;GACA,SAAS,kBAAkB,QAAQ,QAAQ,MAAM;EACnD,EAAE,CACN;CACF;CAEA,IAAI,QAAQ,UAAU;EACpB,MAAM,EAAE,KAAK,WAAW,QAAQ;EAChC,IAAI,kBACF,IAAI,EAAE,MAAM,MACV,MAAM,QAAQ,CAAC,IAAI,oBAAoB,GAAG,MAAM,IAAI,mBAAmB,GAAG,MAAM,CAClF,CACF;CACF;CACA,IAAI,QAAQ,UAAU;EACpB,MAAM,EAAE,QAAQ,QAAQ;EACxB,IAAI,kBAAkB,IAAI,EAAE,KAAK,gBAAgB,CAAC;CACpD;CACA,IAAI,QAAQ,MAAM;EAChB,MAAM,EAAE,QAAQ,QAAQ;EACxB,IAAI,cACF,IAAI,EAAE,MAAM,MAAM,qBAAqB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC,CAC9F;CACF;CACA,IAAI,QAAQ,OAAO;EACjB,MAAM,EAAE,QAAQ,QAAQ;EACxB,IAAI,eAAe,IAAI,EAAE,KAAK,iBAAiB,CAAC;CAClD;CACA,IAAI,QAAQ,QAAQ;EAClB,MAAM,EAAE,QAAQ,QAAQ;EACxB,IAAI,gBAAgB,IAAI,EAAE,KAAK,mBAAmB,CAAC;CACrD;CAEA,MAAM,SAAwB,CAAC;CAC/B,KAAK,MAAM,EAAE,QAAQ,aAAa,MAAM,QAAQ,IAAI,KAAK,GACvD,OAAO,UAAU;CAGnB,OAAO;EAAE,IAAI,UAAU;EAAG,SAAS,eAAe,QAAQ,QAAQ,MAAM;CAAE;AAC5E;;;;;;;;;AAUA,SAAS,kBACP,QACA,QACA,QACe;CACf,IAAI,aAAa,MAAM,GACrB,OAAO;EACL;EACA,QAAQ;EACR,UAAU;EACV,UAAU,GAAG,OAAO;EACpB,YAAY;CACd;CAGF,OAAO;EACL;EACA,QAAQ;EACR,UAAU;EACV,UAAU;EACV,aAAa,OANC,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM,CAM3C;CAC7B;AACF"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@sackville-mcp/verify",
3
+ "version": "0.0.1-alpha.0",
4
+ "type": "module",
5
+ "license": "Apache-2.0",
6
+ "exports": {
7
+ ".": {
8
+ "import": {
9
+ "types": "./dist/index.d.mts",
10
+ "default": "./dist/index.mjs"
11
+ }
12
+ }
13
+ },
14
+ "main": "./dist/index.mjs",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "@sackville-mcp/verdict": "0.0.1-alpha.0"
20
+ },
21
+ "devDependencies": {
22
+ "@sackville-mcp/api": "0.0.1-alpha.0",
23
+ "@sackville-mcp/coverage": "0.0.1-alpha.0",
24
+ "@sackville-mcp/deps": "0.0.1-alpha.0",
25
+ "@sackville-mcp/flake": "0.0.1-alpha.0",
26
+ "@sackville-mcp/mutate": "0.0.1-alpha.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/ceautery/sackville.git",
34
+ "directory": "packages/verify"
35
+ },
36
+ "scripts": {
37
+ "build": "tsdown",
38
+ "typecheck": "tsc --noEmit"
39
+ }
40
+ }