@eyeoverthink/sva-gate 0.0.0-stage → 1.0.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
95
+ Derivative 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 EyeOverThink / Vaughn Scott
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.
package/README.md CHANGED
@@ -1,3 +1,132 @@
1
- # Temporary Holding Version
1
+ # `@eyeoverthink/sva-gate` (`v1.0.0`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI: Node + MCP + Python](https://github.com/eyeoverthink/sva-gate/actions/workflows/ci.yml/badge.svg)](https://github.com/eyeoverthink/sva-gate/actions/workflows/ci.yml)
4
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
5
+
6
+ **Zero-dependency 3-layer verification SDK, CLI, and stdio MCP server for AI agents.**
7
+
8
+ Unifies the proven standards from [`eyeoverthink/sva-standard`](https://github.com/eyeoverthink/sva-standard) (`v1.7.0`, 106/106 tri-runtime conformance) and [`eyeoverthink/logic-chain-judge`](https://github.com/eyeoverthink/logic-chain-judge) (`v1.0.0`, 321 tests) into **one installable package** with **zero external runtime dependencies** (Node 22+ ESM with TypeScript `.d.ts` definitions + pure Python 3.10+ stdlib companion in `python/`).
9
+
10
+ ---
11
+
12
+ ## 1. Drop Into Claude Code / Cursor / Codex / Any MCP Client (4 Lines)
13
+
14
+ ```json
15
+ {
16
+ "mcpServers": {
17
+ "sva-gate": {
18
+ "command": "npx",
19
+ "args": ["-y", "@eyeoverthink/sva-gate", "mcp"]
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ Gives any agent **6 deterministic verification tools** over stdio JSON-RPC 2.0:
26
+
27
+ | MCP Tool | Layer | What It Enforces |
28
+ | --- | --- | --- |
29
+ | `sva_seal_text` | Layer 2 (`EMA/1`) | Seals PII/secrets (emails, SSNs, API keys, phones) into typed placeholders + `StreamSealGuard` cross-token split-secret sealing + zero-width prompt-injection scan |
30
+ | `sva_mint_receipt` | Layer 1 (`SVA-ER/1`) | Mints an Ed25519-signed, RFC 6962 `0x00`/`0x01` Merkle-proven receipt + matching `OPEG/1` `S4_COMMIT` envelope |
31
+ | `sva_verify_receipt` | Layer 1 (`SVA-ER/1` + `AER-1`) | Verifies **`SVA-ER/1`** receipts AND **IETF `draft-zambo-aer1-26` (`AER-1` v0.4)** receipts offline |
32
+ | `sva_opeg_check` | Layer 2 (`OPEG/1`) | Fail-closed pre-commit gate: blocks `DIRECT_INFERENCE`, tampered `R_san` digests, and invalid receipts (`sva-er/1` or `aer-1`) |
33
+ | `sva_judge_audit` | Layer 3 (`SVA-JEV/1`) | Calibrated epistemic judge gates: Wilson 95% CI > 2/3, author self-vote exclusion, mandatory verbatim `>= 12`-char quotes, hidden planted-fake traps, and zero-LLM `new_terms` invention scanner |
34
+ | `sva_crystallize_skill` | Layer 1 (`VSC/1`) | Zero-LLM deterministic parameter binder induction with leave-one-out verification and novel-wording near-miss rejection |
35
+
36
+ ---
37
+
38
+ ## 2. CLI Quick Start (10-Second Offline Self-Test)
39
+
40
+ ```bash
41
+ # Run built-in 3-layer verification (receipts + OPEG tamper block + StreamSealGuard + SVA-JEV/1 + skill crystallizer)
42
+ npx @eyeoverthink/sva-gate self-test
43
+
44
+ # Seal secrets & scan for prompt injection
45
+ npx @eyeoverthink/sva-gate seal "Patient SSN 123-45-6789 key sk-ant-api03-abcdefghijklmnop1234567890"
46
+
47
+ # Demo cross-token split-secret streaming redaction
48
+ npx @eyeoverthink/sva-gate stream-demo
49
+
50
+ # Mint a signed SVA-ER/1 receipt + OPEG/1 envelope
51
+ npx @eyeoverthink/sva-gate mint '{"answer":42,"unit":"ms"}'
52
+
53
+ # Verify an SVA-ER/1 OR IETF AER-1 v0.4 receipt offline
54
+ npx @eyeoverthink/sva-gate verify receipt.json [deliverable.json]
55
+
56
+ # Evaluate an OPEG/1 gate or SVA-JEV/1 judge envelope fail-closed
57
+ npx @eyeoverthink/sva-gate gate opeg-envelope.json
58
+ npx @eyeoverthink/sva-gate judge jev-envelope.json
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 3. JS / TypeScript SDK (`0` Dependencies)
64
+
65
+ ```js
66
+ import {
67
+ mintSvaEr1,
68
+ verifyAnyReceipt,
69
+ evaluateOpeg1,
70
+ evaluateSvaJev1,
71
+ StreamSealGuard,
72
+ JEV_SEMANTICS,
73
+ } from '@eyeoverthink/sva-gate';
74
+
75
+ // 1. Mint & verify an SVA-ER/1 receipt + OPEG/1 S4_COMMIT envelope
76
+ const { receipt, deliverable, opegEnvelope } = mintSvaEr1({ rSan: { ok: true, value: 42 } });
77
+ console.log(verifyAnyReceipt(receipt, { deliverable })); // { format: 'sva-er/1', ok: true, outcome: 'verified', ... }
78
+ console.log(evaluateOpeg1(opegEnvelope)); // { ok: true, gate: 'pass', ... }
79
+
80
+ // 2. Seal split-token API keys across streaming chunks
81
+ const sg = new StreamSealGuard();
82
+ const safe = ['Key sk-', 'ant-api03-abcdefghijklmnop1234567890 ok'].map((c) => sg.push(c)).join('') + sg.flush();
83
+
84
+ // 3. Enforce SVA-JEV/1 epistemic judge gates
85
+ const verdict = evaluateSvaJev1({
86
+ spec: 'sva-jev/1',
87
+ semantics: JEV_SEMANTICS,
88
+ mode: 'claim_trace',
89
+ ledgerTexts: ['[stage 1] Enforce 80% quorum via verify_run.'],
90
+ briefText: 'Enforce 80% quorum with 9999 retries via invented_helper_v2.',
91
+ plantedFakes: [{ id: 'fake-1', verdict: 'unsupported' }],
92
+ });
93
+ // -> { ok: false, newTerms: ['9999', 'invented_helper_v2'], ... }
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 4. Pure Python 3.10+ Companion (`python/`)
99
+
100
+ Zero `pip` dependencies (standard library only):
101
+
102
+ ```bash
103
+ pip install ./python
104
+ python -m unittest discover -s python/tests -v
105
+ ```
106
+
107
+ ```python
108
+ from sva_gate import JEV_SEMANTICS, evaluate_sva_jev1
109
+ res = evaluate_sva_jev1({
110
+ "spec": "sva-jev/1",
111
+ "semantics": JEV_SEMANTICS,
112
+ "mode": "calibration",
113
+ "answered": 36, "total": 36, "right": 33, "realFound": 12, "realTotal": 12,
114
+ })
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Honest Limits
120
+
121
+ - **Signatures prove post-signing integrity and key possession**, not that a compromised host didn't fabricate data prior to signing. Local unsynced clocks are explicitly labeled `unattested`.
122
+ - **`SVA-JEV/1` verdicts are stamped `stability-signal-not-correctness`** — multi-model consensus is never proof of truth.
123
+ - **Deterministic `new_terms` catches invented numbers and code identifiers**, not subtle semantic paraphrasing.
124
+
125
+ ## Related Repositories & Live Offline Playgrounds
126
+
127
+ - **Open Standards & 5 Zero-Backend Browser Labs:** https://eyeoverthink.github.io/sva-standard/ (`eyeoverthink/sva-standard`)
128
+ - **Calibrated Epistemic Judge Pipeline:** https://github.com/eyeoverthink/logic-chain-judge
129
+
130
+ ## License
131
+
132
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env node
2
+ // @eyeoverthink/sva-gate CLI — Zero-dependency 3-layer AI verification CLI & stdio MCP server.
3
+
4
+ import fs from 'node:fs';
5
+ import {
6
+ mintSvaEr1,
7
+ verifyAnyReceipt,
8
+ evaluateOpeg1,
9
+ evaluateSvaJev1,
10
+ detect,
11
+ SealSession,
12
+ StreamSealGuard,
13
+ scanInjection,
14
+ induce,
15
+ leaveOneOut,
16
+ applySpec,
17
+ novelWording,
18
+ startStdioMcpServer,
19
+ JEV_SEMANTICS,
20
+ } from '../src/index.js';
21
+
22
+ const USAGE = `sva-gate v1.0.0 — Zero-dependency 3-layer AI verification CLI & MCP server
23
+
24
+ Commands:
25
+ sva-gate mcp Start stdio JSON-RPC 2.0 MCP server (6 tools)
26
+ sva-gate seal <text> Seal PII/secrets & scan for prompt injection
27
+ sva-gate stream-demo Demonstrate StreamSealGuard cross-token sealing
28
+ sva-gate mint <json-file | inline-json> Mint SVA-ER/1 receipt + OPEG/1 S4_COMMIT envelope
29
+ sva-gate verify <receipt.json> [deliverable] Verify SVA-ER/1 or IETF AER-1 v0.4 receipt offline
30
+ sva-gate gate <opeg-envelope.json> Evaluate OPEG/1 S4_COMMIT gate fail-closed
31
+ sva-gate judge <jev-envelope.json> Evaluate SVA-JEV/1 epistemic judge gate
32
+ sva-gate self-test Run built-in 3-layer end-to-end verification check
33
+ `;
34
+
35
+ function readJsonArg(arg) {
36
+ if (!arg) throw new Error('Missing JSON argument or file path');
37
+ if (fs.existsSync(arg) && fs.statSync(arg).isFile()) {
38
+ return JSON.parse(fs.readFileSync(arg, 'utf8'));
39
+ }
40
+ return JSON.parse(arg);
41
+ }
42
+
43
+ const [cmd, ...rest] = process.argv.slice(2);
44
+
45
+ if (!cmd || cmd === '-h' || cmd === '--help') {
46
+ console.log(USAGE);
47
+ process.exit(0);
48
+ }
49
+
50
+ if (cmd === 'mcp') {
51
+ startStdioMcpServer();
52
+ } else if (cmd === 'seal') {
53
+ const text = rest.join(' ');
54
+ const findings = detect(text);
55
+ const session = new SealSession();
56
+ const sealed = session.apply(text, findings);
57
+ console.log(JSON.stringify({ sealed, findingsCount: findings.length, audit: session.audit(sealed), injection: scanInjection(text) }, null, 2));
58
+ } else if (cmd === 'stream-demo') {
59
+ const chunks = ['Key sk-', 'ant-api03-abcdefghijklmnop1234567890 SSN 123-', '45-6789 mail elena@', 'northstar.org ok.'];
60
+ const sg = new StreamSealGuard();
61
+ const sealed = chunks.map((c) => sg.push(c)).join('') + sg.flush();
62
+ console.log(JSON.stringify({ chunks, sealed, audit: sg.session.audit(sealed) }, null, 2));
63
+ } else if (cmd === 'mint') {
64
+ const rSan = readJsonArg(rest[0]);
65
+ const res = mintSvaEr1({ rSan });
66
+ console.log(JSON.stringify(res, null, 2));
67
+ } else if (cmd === 'verify') {
68
+ const receipt = readJsonArg(rest[0]);
69
+ let deliverable = null;
70
+ if (rest[1]) {
71
+ deliverable = fs.existsSync(rest[1]) ? fs.readFileSync(rest[1], 'utf8') : rest[1];
72
+ }
73
+ const res = verifyAnyReceipt(receipt, { deliverable });
74
+ console.log(JSON.stringify(res, null, 2));
75
+ process.exit(res.ok ? 0 : 1);
76
+ } else if (cmd === 'gate') {
77
+ const env = readJsonArg(rest[0]);
78
+ const res = evaluateOpeg1(env);
79
+ console.log(JSON.stringify(res, null, 2));
80
+ process.exit(res.ok ? 0 : 1);
81
+ } else if (cmd === 'judge') {
82
+ const env = readJsonArg(rest[0]);
83
+ const res = evaluateSvaJev1(env);
84
+ console.log(JSON.stringify(res, null, 2));
85
+ process.exit(res.ok ? 0 : 1);
86
+ } else if (cmd === 'self-test') {
87
+ // 1. Layer 1 + 2: Mint SVA-ER/1 + OPEG/1, verify pass, verify tamper block
88
+ const minted = mintSvaEr1({ agencyName: 'sva-gate-selftest', missionId: 'ms_selftest', rSan: { answer: 42, unit: 'ms' } });
89
+ const rOk = verifyAnyReceipt(minted.receipt, { deliverable: minted.deliverable });
90
+ const gOk = evaluateOpeg1(minted.opegEnvelope);
91
+ const badEnv = structuredClone(minted.opegEnvelope);
92
+ badEnv.sanitizer.rSan.answer = 999;
93
+ const gBad = evaluateOpeg1(badEnv);
94
+
95
+ // 2. Layer 2: StreamSealGuard cross-token secret sealing
96
+ const sg = new StreamSealGuard();
97
+ const sOut = ['Token sk-', 'ant-api03-abcdefghijklmnop1234567890 done'].map((c) => sg.push(c)).join('') + sg.flush();
98
+ const sClean = sg.session.audit(sOut).clean && !sOut.includes('sk-ant-api03');
99
+
100
+ // 3. Layer 3: SVA-JEV/1 calibrated judge + planted fake + zero-LLM new_terms block
101
+ const jPass = evaluateSvaJev1({
102
+ spec: 'sva-jev/1', semantics: JEV_SEMANTICS, mode: 'calibration',
103
+ answered: 36, total: 36, right: 33, realFound: 12, realTotal: 12,
104
+ });
105
+ const jBlock = evaluateSvaJev1({
106
+ spec: 'sva-jev/1', semantics: JEV_SEMANTICS, mode: 'claim_trace',
107
+ ledgerTexts: ['[stage 1] Enforce 80% quorum via verify_run.'],
108
+ briefText: 'Enforce 80% quorum with 9999 retries via invented_helper_v2.',
109
+ plantedFakes: [{ id: 'fake-1', verdict: 'unsupported' }],
110
+ });
111
+
112
+ // 4. Skill Crystallizer zero-LLM binder check
113
+ const skill = {
114
+ name: 'sequential_discount',
115
+ params: {
116
+ type: 'object',
117
+ properties: {
118
+ price: { type: 'number', description: 'original price' },
119
+ d1: { type: 'number', description: 'first discount as decimal fraction' },
120
+ d2: { type: 'number', description: 'second discount as decimal fraction' },
121
+ },
122
+ },
123
+ };
124
+ const pos = [
125
+ { task: 'A $100 jacket is 20% off, then an extra 10% off. What is the final price?', input: { price: 100, d1: 0.2, d2: 0.1 } },
126
+ { task: 'A $80 pair of shoes is 15% off, then an extra 20% off. What is the final price?', input: { price: 80, d1: 0.15, d2: 0.2 } },
127
+ { task: 'A $150 backpack is 30% off, then an extra 5% off. What is the final price?', input: { price: 150, d1: 0.3, d2: 0.05 } },
128
+ ];
129
+ const neg = [{ task: 'A $200 desk is 20% off, then 8% sales tax is added. What is the final price?' }];
130
+ const { spec } = induce(pos, neg, skill);
131
+ const looRows = leaveOneOut(pos, neg, skill);
132
+ const loo = { passed: looRows.filter((r) => r.ok).length, total: looRows.length, ok: looRows.every((r) => r.ok) };
133
+ const bound = spec ? applySpec(spec, 'A $240 coat is 25% off, then an extra 10% off. What is the final price?') : null;
134
+ const trapNovel = novelWording(pos, 'A $200 shoe is 10% off, then 8% sales tax is added. What is the final price?');
135
+ const trapBlocked = !applySpec(spec, 'A $200 shoe is 10% off, then 8% sales tax is added. What is the final price?') || trapNovel.length > 0;
136
+
137
+ const ok = Boolean(
138
+ rOk.ok && gOk.ok && !gBad.ok && sClean && jPass.ok && !jBlock.ok && loo.ok && bound?.price === 240 && trapBlocked
139
+ );
140
+ console.log(JSON.stringify({
141
+ ok,
142
+ layers: {
143
+ receiptAndOpeg: { verified: rOk.ok, gatePass: gOk.ok, tamperBlocked: !gBad.ok },
144
+ streamPrivacyMembrane: { clean: sClean, sealedPreview: sOut },
145
+ epistemicJudge: { calibrationPass: jPass.ok, inventedTermsBlocked: !jBlock.ok, newTerms: jBlock.newTerms },
146
+ skillCrystallizer: { leaveOneOut: loo, boundPrice: bound?.price ?? null, taxTrapRejected: trapBlocked },
147
+ },
148
+ }, null, 2));
149
+ process.exit(ok ? 0 : 1);
150
+ } else {
151
+ console.error(`Unknown command: ${cmd}\n\n${USAGE}`);
152
+ process.exit(1);
153
+ }
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@eyeoverthink/sva-gate",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Zero-dependency 3-layer verification SDK, CLI, and stdio MCP server for AI agents: SVA-ER/1 & IETF AER-1 receipts, OPEG/1 execution gates, StreamSealGuard split-token privacy membrane, SVA-JEV/1 calibrated epistemic judge, and zero-LLM skill crystallization.",
6
+ "license": "Apache-2.0",
7
+ "main": "./src/index.js",
8
+ "types": "./src/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./src/index.d.ts",
12
+ "import": "./src/index.js"
13
+ },
14
+ "./receipt": "./src/receipt.js",
15
+ "./judge": "./src/lib/judge-verify.js",
16
+ "./membrane": "./src/membrane.js",
17
+ "./skill": "./src/lib/binder-induction.js",
18
+ "./mcp": "./src/mcp-server.js"
19
+ },
20
+ "bin": {
21
+ "sva-gate": "bin/sva-gate.js"
22
+ },
23
+ "files": [
24
+ "bin/",
25
+ "src/",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "keywords": [
30
+ "mcp",
31
+ "mcp-server",
32
+ "ai-agents",
33
+ "sva-standard",
34
+ "sva-er-1",
35
+ "aer-1",
36
+ "opeg-1",
37
+ "sva-jev-1",
38
+ "ed25519",
39
+ "merkle",
40
+ "privacy-membrane",
41
+ "llm-judge",
42
+ "zero-dependency"
43
+ ],
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/eyeoverthink/sva-gate.git"
47
+ },
48
+ "homepage": "https://eyeoverthink.github.io/sva-standard/",
49
+ "bugs": {
50
+ "url": "https://github.com/eyeoverthink/sva-gate/issues"
51
+ },
52
+ "scripts": {
53
+ "test": "node --test \"test/*.test.js\"",
54
+ "mcp": "node ./bin/sva-gate.js mcp",
55
+ "self-test": "node ./bin/sva-gate.js self-test"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "engines": {
61
+ "node": ">=22.0.0"
62
+ }
63
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,96 @@
1
+ export function canonical(value: unknown): string;
2
+ export function sha256Hex(data: string | Uint8Array): string;
3
+ export function isValidRfc3339(s: string): boolean;
4
+
5
+ export interface Ed25519Keypair {
6
+ publicKeyHex: string;
7
+ seedHex: string;
8
+ fxId: string;
9
+ privateKey: unknown;
10
+ publicKey: unknown;
11
+ }
12
+
13
+ export function generateEd25519Keypair(): Ed25519Keypair;
14
+ export function keypairFromSeedHex(seedHex: string): Ed25519Keypair;
15
+
16
+ export interface MintOptions {
17
+ agencyName?: string;
18
+ missionId?: string;
19
+ rSan: Record<string, unknown>;
20
+ events?: Array<{ kind?: string; actor?: string; ts?: string; data?: Record<string, unknown> }>;
21
+ clockStatus?: 'attested' | 'drift' | 'unattested';
22
+ issuedAt?: string;
23
+ keypair?: Ed25519Keypair | null;
24
+ seedHex?: string | null;
25
+ }
26
+
27
+ export interface MintResult {
28
+ receipt: Record<string, unknown>;
29
+ deliverable: string;
30
+ opegEnvelope: Record<string, unknown>;
31
+ publicKeyHex: string;
32
+ fxId: string;
33
+ }
34
+
35
+ export function mintSvaEr1(opts: MintOptions): MintResult;
36
+
37
+ export interface SvaEr1Outcome {
38
+ ok: boolean;
39
+ outcome: 'verified' | 'verification_failed' | 'rejected_malformed';
40
+ deliverable: 'verified' | 'not_checked' | 'verification_failed';
41
+ clock: 'attested' | 'drift' | 'unattested' | 'verification_failed';
42
+ }
43
+
44
+ export function evaluateSvaEr1(input: { receipt: Record<string, unknown>; deliverable?: string | Record<string, unknown> | null }): SvaEr1Outcome;
45
+ export function evaluateAer1V04(receipt: Record<string, unknown>): {
46
+ ok: boolean;
47
+ outcome: 'verified' | 'verification_failed';
48
+ clockAttestation: 'absent';
49
+ issuerKeyBinding: 'absent';
50
+ reason?: string;
51
+ payload?: Record<string, unknown>;
52
+ };
53
+ export function verifyAnyReceipt(receipt: Record<string, unknown>, opts?: { deliverable?: string | Record<string, unknown> | null }): Record<string, unknown>;
54
+ export function evaluateOpeg1(doc: Record<string, unknown>): {
55
+ ok: boolean;
56
+ gate: 'pass' | 'blocked';
57
+ receiptFormat: string;
58
+ reason?: string;
59
+ receiptOutcome: Record<string, unknown> | null;
60
+ };
61
+
62
+ export const JEV_SEMANTICS: 'stability-signal-not-correctness';
63
+ export function wilsonLower95(right: number, total: number, z?: number): number;
64
+ export function flatText(text: string): string;
65
+ export function extractFactualTerms(text: string): Set<string>;
66
+ export function evaluateSvaJev1(doc: Record<string, unknown>): { ok: boolean; mode: string; reason?: string; [k: string]: unknown };
67
+
68
+ export function detect(text: string): Array<{ type: string; value: string; start: number; end: number }>;
69
+ export class SealSession {
70
+ apply(text: string, findings: unknown[]): string;
71
+ restore(text: string): string;
72
+ audit(outbound: string): { clean: boolean; leaks: unknown[] };
73
+ }
74
+ export class StreamSealGuard {
75
+ session: SealSession;
76
+ push(chunk: string): string;
77
+ flush(): string;
78
+ }
79
+ export function scanInjection(text: string): { suspicious: boolean; reasons: string[] };
80
+
81
+ export function induce(
82
+ pos: Array<{ task: string; input: Record<string, unknown> }>,
83
+ neg: Array<{ task: string }>,
84
+ skill: { params?: { properties?: Record<string, unknown> } },
85
+ ): { spec?: Record<string, unknown>; error?: string };
86
+ export function leaveOneOut(
87
+ pos: Array<{ task: string; input: Record<string, unknown> }>,
88
+ neg: Array<{ task: string }>,
89
+ skill: { params?: { properties?: Record<string, unknown> } },
90
+ ): Array<{ ok: boolean; [k: string]: unknown }>;
91
+ export function applySpec(spec: Record<string, unknown>, task: string): Record<string, unknown> | null;
92
+ export function novelWording(pos: Array<{ task: string }>, task: string): string[];
93
+
94
+ export const MCP_TOOLS: Array<{ name: string; description: string; inputSchema: Record<string, unknown> }>;
95
+ export function createMcpHandler(): (req: Record<string, unknown>) => Record<string, unknown> | null;
96
+ export function startStdioMcpServer(): void;