@eyeoverthink/sva-gate 2.1.2 → 2.1.4
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 +1 -1
- package/bin/sva-gate.js +2 -2
- package/package.json +2 -1
- package/src/mcp-server.js +217 -42
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `@eyeoverthink/sva-gate` (`v2.1.
|
|
1
|
+
# `@eyeoverthink/sva-gate` (`v2.1.4`)
|
|
2
2
|
|
|
3
3
|
[](https://github.com/eyeoverthink/sva-gate/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/@eyeoverthink/sva-gate)
|
package/bin/sva-gate.js
CHANGED
|
@@ -58,12 +58,12 @@ function readJsonArg(arg) {
|
|
|
58
58
|
|
|
59
59
|
const [cmd, ...rest] = process.argv.slice(2);
|
|
60
60
|
|
|
61
|
-
if (
|
|
61
|
+
if (cmd === '-h' || cmd === '--help' || (!cmd && process.stdin.isTTY)) {
|
|
62
62
|
console.log(USAGE);
|
|
63
63
|
process.exit(0);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
if (cmd === 'mcp') {
|
|
66
|
+
if (!cmd || cmd === 'mcp') {
|
|
67
67
|
startStdioMcpServer();
|
|
68
68
|
} else if (cmd === 'seal') {
|
|
69
69
|
const text = rest.join(' ');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eyeoverthink/sva-gate",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"mcpName": "io.github.eyeoverthink/sva-gate",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Zero-dependency 3-layer verification SDK, CLI, and stdio MCP server for AI agents: SVA-ER/1 & AER-1 (draft-zambo-aer1) receipts, OPEG/1 execution gates, StreamSealGuard split-token privacy membrane, SVA-JEV/1 rule-based judge checks, and zero-LLM skill crystallization.",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"url": "https://github.com/eyeoverthink/sva-gate/issues"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
|
+
"build": "node -e \"console.log('sva-gate zero-build ESM ready')\"",
|
|
70
71
|
"test": "node --test \"test/*.test.js\"",
|
|
71
72
|
"mcp": "node ./bin/sva-gate.js mcp",
|
|
72
73
|
"self-test": "node ./bin/sva-gate.js self-test"
|
package/src/mcp-server.js
CHANGED
|
@@ -25,74 +25,217 @@ export const SERVER_INFO = {
|
|
|
25
25
|
export const MCP_TOOLS = [
|
|
26
26
|
{
|
|
27
27
|
name: 'sva_seal_text',
|
|
28
|
-
|
|
28
|
+
title: 'Seal PII, Secrets, and Prompt-Injection Vectors (EMA/1)',
|
|
29
|
+
description:
|
|
30
|
+
'Redact sensitive PII and credentials into deterministic typed placeholders and scan untrusted text or token chunks for zero-width Unicode stego-injection under EMA/1. Call this before passing untrusted user input, clinical/enterprise records, or split-token streaming output across an LLM or tool boundary; do not use for signing post-execution deliverables (use sva_mint_receipt) or gating final answers (use sva_opeg_check). Executes deterministically in memory with zero network or LLM calls and fails closed on digit-squeezed egress leaks or hidden control-character injection.',
|
|
31
|
+
annotations: {
|
|
32
|
+
title: 'Seal PII & Scan Prompt Injection (EMA/1)',
|
|
33
|
+
readOnlyHint: true,
|
|
34
|
+
destructiveHint: false,
|
|
35
|
+
idempotentHint: true,
|
|
36
|
+
openWorldHint: false,
|
|
37
|
+
},
|
|
29
38
|
inputSchema: {
|
|
30
39
|
type: 'object',
|
|
40
|
+
additionalProperties: false,
|
|
31
41
|
properties: {
|
|
32
|
-
text: {
|
|
33
|
-
|
|
42
|
+
text: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'Raw untrusted input string to scan for PII, API secrets, and hidden Unicode injection characters.',
|
|
45
|
+
},
|
|
46
|
+
chunks: {
|
|
47
|
+
type: 'array',
|
|
48
|
+
items: { type: 'string', description: 'Individual token chunk to feed sequentially through StreamSealGuard.' },
|
|
49
|
+
description: 'Optional ordered token chunks for cross-boundary split-secret redaction via StreamSealGuard; omit when sealing a single complete string in text.',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
outputSchema: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
required: ['ok', 'mode', 'sealed', 'sealedText', 'audit', 'injection'],
|
|
56
|
+
properties: {
|
|
57
|
+
ok: { type: 'boolean', description: 'True when sealing completed cleanly with zero unsealed egress leaks.' },
|
|
58
|
+
mode: { type: 'string', enum: ['single', 'stream'], description: 'Sealing mode used (single string or streaming chunks).' },
|
|
59
|
+
sealed: { type: 'string', description: 'Sanitized text with secrets and PII replaced by deterministic typed placeholders.' },
|
|
60
|
+
sealedText: { type: 'string', description: 'Alias of sealed for structured-output clients expecting sealedText.' },
|
|
61
|
+
findingsCount: { type: 'integer', minimum: 0, description: 'Count of PII and secret spans detected in single-string mode.' },
|
|
62
|
+
audit: { type: 'object', description: 'Egress audit result ({ clean, leaks }) verifying zero raw secrets remain.' },
|
|
63
|
+
injection: { type: 'object', description: 'Prompt-injection and hidden-Unicode scan result ({ score, flags, suspicious }).' },
|
|
34
64
|
},
|
|
35
65
|
},
|
|
36
66
|
},
|
|
37
67
|
{
|
|
38
68
|
name: 'sva_mint_receipt',
|
|
39
|
-
|
|
69
|
+
title: 'Mint Ed25519 Merkle Execution Receipt (SVA-ER/1)',
|
|
70
|
+
description:
|
|
71
|
+
'Mint an Ed25519-signed, RFC 6962 Merkle-proven cryptographic execution receipt (SVA-ER/1) and matching OPEG/1 S4_COMMIT envelope over a sanitized computation result. Call this immediately after deterministic tool or code execution produces a verified deliverable; do not use to validate an existing receipt (use sva_verify_receipt) or to redact raw PII prior to execution (use sva_seal_text). Runs offline in memory with zero external network calls; local unsynced system clocks are stamped unattested by default.',
|
|
72
|
+
annotations: {
|
|
73
|
+
title: 'Mint Signed SVA-ER/1 Execution Receipt',
|
|
74
|
+
readOnlyHint: true,
|
|
75
|
+
destructiveHint: false,
|
|
76
|
+
idempotentHint: false,
|
|
77
|
+
openWorldHint: false,
|
|
78
|
+
},
|
|
40
79
|
inputSchema: {
|
|
41
80
|
type: 'object',
|
|
81
|
+
additionalProperties: false,
|
|
42
82
|
required: ['rSan'],
|
|
43
83
|
properties: {
|
|
44
|
-
rSan: { type: 'object', description: 'Sanitized
|
|
45
|
-
missionId: { type: 'string', description: 'Optional mission identifier.' },
|
|
46
|
-
agencyName: { type: 'string', description: 'Optional agency
|
|
84
|
+
rSan: { type: 'object', description: 'Sanitized deterministic execution output payload (R_san) bound into the Merkle tree and signed.' },
|
|
85
|
+
missionId: { type: 'string', description: 'Optional mission identifier stamped in the receipt.' },
|
|
86
|
+
agencyName: { type: 'string', description: 'Optional agency or issuer display name.' },
|
|
47
87
|
clockStatus: { type: 'string', enum: ['attested', 'drift', 'unattested'], description: 'Explicit clock honesty state (default: unattested).' },
|
|
48
|
-
seedHex: { type: 'string', description: 'Optional 64-hex-char Ed25519 signing seed
|
|
49
|
-
events: {
|
|
88
|
+
seedHex: { type: 'string', description: 'Optional 64-hex-char Ed25519 signing seed; an ephemeral keypair is generated when omitted.' },
|
|
89
|
+
events: {
|
|
90
|
+
type: 'array',
|
|
91
|
+
items: { type: 'object', description: 'Execution log event committed as an RFC 6962 0x00 Merkle leaf.' },
|
|
92
|
+
description: 'Optional ordered execution log events to commit into the RFC 6962 Merkle root.',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
outputSchema: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
required: ['ok', 'receipt', 'deliverable', 'opegEnvelope', 'publicKeyHex', 'fxId'],
|
|
99
|
+
properties: {
|
|
100
|
+
ok: { type: 'boolean', description: 'True when the Ed25519 signature, Merkle root, and OPEG/1 envelope were minted cleanly.' },
|
|
101
|
+
receipt: { type: 'object', description: 'Signed SVA-ER/1 receipt containing Ed25519 signature, public key, RFC 6962 Merkle root, and clock status.' },
|
|
102
|
+
deliverable: { type: 'string', description: 'Canonicalized deliverable JSON string committed by SHA-256 digest inside the receipt.' },
|
|
103
|
+
opegEnvelope: { type: 'object', description: 'Ready-to-evaluate OPEG/1 S4_COMMIT envelope pairing the sanitized result with the minted receipt.' },
|
|
104
|
+
publicKeyHex: { type: 'string', description: '64-hex Ed25519 public key used to sign the receipt.' },
|
|
105
|
+
fxId: { type: 'string', description: 'Short deterministic key fingerprint identifier derived from publicKeyHex.' },
|
|
50
106
|
},
|
|
51
107
|
},
|
|
52
108
|
},
|
|
53
109
|
{
|
|
54
110
|
name: 'sva_verify_receipt',
|
|
55
|
-
|
|
111
|
+
title: 'Verify SVA-ER/1 or AER-1 Cryptographic Receipt',
|
|
112
|
+
description:
|
|
113
|
+
'Verify offline Ed25519 signature validity, RFC 6962 0x00/0x01 Merkle inclusion proofs, and deliverable digest binding for an SVA-ER/1 or AER-1 v0.4 (draft-zambo-aer1-26) receipt. Call this when auditing a standalone cryptographic receipt against a caller-pinned key; do not use to mint new receipts (use sva_mint_receipt) or to enforce OPEG/1 pre-answer grounding gates (use sva_opeg_check). Executes deterministically in memory with zero network calls and fails closed on 1-byte tampering, small-order Ed25519 keys, or unpinned signers.',
|
|
114
|
+
annotations: {
|
|
115
|
+
title: 'Verify SVA-ER/1 or AER-1 Receipt Offline',
|
|
116
|
+
readOnlyHint: true,
|
|
117
|
+
destructiveHint: false,
|
|
118
|
+
idempotentHint: true,
|
|
119
|
+
openWorldHint: false,
|
|
120
|
+
},
|
|
56
121
|
inputSchema: {
|
|
57
122
|
type: 'object',
|
|
123
|
+
additionalProperties: false,
|
|
58
124
|
required: ['receipt'],
|
|
59
125
|
properties: {
|
|
60
|
-
receipt: { type: 'object', description: 'SVA-ER/1 or AER-1 v0.4 receipt JSON object.' },
|
|
61
|
-
deliverable: { description: 'Optional deliverable string or JSON object to verify against deliverableSha256 (SVA-ER/1) or
|
|
62
|
-
expectedPublicKeys: {
|
|
63
|
-
|
|
126
|
+
receipt: { type: 'object', description: 'Parsed SVA-ER/1 or AER-1 v0.4 receipt JSON object.' },
|
|
127
|
+
deliverable: { description: 'Optional deliverable string or JSON object to verify against deliverableSha256 (SVA-ER/1) or outputs (AER-1).' },
|
|
128
|
+
expectedPublicKeys: {
|
|
129
|
+
type: 'array',
|
|
130
|
+
items: { type: 'string', description: 'Trusted 64-hex Ed25519 public key.' },
|
|
131
|
+
description: 'Hex Ed25519 public key(s) allowed to have signed; without them an intact receipt returns integrity_only (ok: false).',
|
|
132
|
+
},
|
|
133
|
+
allowUnpinned: { type: 'boolean', description: 'Accept any valid non-small-order signer (1.x compatibility for demos and migration only).' },
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
outputSchema: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
required: ['ok', 'outcome'],
|
|
139
|
+
properties: {
|
|
140
|
+
ok: { type: 'boolean', description: 'True only when cryptographic signature, Merkle proof, deliverable digest, and pinned signer trust all pass.' },
|
|
141
|
+
outcome: {
|
|
142
|
+
type: 'string',
|
|
143
|
+
enum: ['verified', 'verification_failed', 'rejected_malformed', 'integrity_only', 'untrusted_signer'],
|
|
144
|
+
description: 'Exact deterministic verification outcome code.',
|
|
145
|
+
},
|
|
146
|
+
deliverable: { type: 'string', description: 'Deliverable hash check status (verified, not_checked, or verification_failed).' },
|
|
147
|
+
clock: { type: 'string', description: 'Clock honesty status (attested, drift, unattested, or verification_failed).' },
|
|
148
|
+
trust: { type: 'string', description: 'Signer trust classification (pinned, unpinned, unsigned, or rejected).' },
|
|
149
|
+
reason: { type: 'string', description: 'Diagnostic explanation when verification fails or is held at integrity_only.' },
|
|
64
150
|
},
|
|
65
151
|
},
|
|
66
152
|
},
|
|
67
153
|
{
|
|
68
154
|
name: 'sva_opeg_check',
|
|
69
|
-
|
|
155
|
+
title: 'Enforce OPEG/1 Fail-Closed Pre-Commit Execution Gate',
|
|
156
|
+
description:
|
|
157
|
+
'Evaluate an OPEG/1 S0-S4 execution-grounding envelope fail-closed before committing a quantitative, security, or tool-backed agent answer. Call this as the pre-commit gate to block ungrounded DIRECT_INFERENCE claims, mutated R_san digests, or invalid receipts; for standalone receipt inspection without an OPEG/1 state envelope, use sva_verify_receipt, and for multi-agent prose review auditing, use sva_judge_audit. Runs deterministically in memory with zero external network or LLM calls.',
|
|
158
|
+
annotations: {
|
|
159
|
+
title: 'Evaluate OPEG/1 Pre-Commit Gate',
|
|
160
|
+
readOnlyHint: true,
|
|
161
|
+
destructiveHint: false,
|
|
162
|
+
idempotentHint: true,
|
|
163
|
+
openWorldHint: false,
|
|
164
|
+
},
|
|
70
165
|
inputSchema: {
|
|
71
166
|
type: 'object',
|
|
167
|
+
additionalProperties: false,
|
|
72
168
|
required: ['envelope'],
|
|
73
169
|
properties: {
|
|
74
|
-
envelope: { type: 'object', description: 'OPEG/1 S4_COMMIT envelope JSON object.' },
|
|
75
|
-
expectedPublicKeys: {
|
|
76
|
-
|
|
170
|
+
envelope: { type: 'object', description: 'OPEG/1 S4_COMMIT envelope JSON object with execution mode, sanitized R_san payload, and attached receipt.' },
|
|
171
|
+
expectedPublicKeys: {
|
|
172
|
+
type: 'array',
|
|
173
|
+
items: { type: 'string', description: 'Trusted 64-hex Ed25519 public key.' },
|
|
174
|
+
description: 'Hex Ed25519 public key(s) allowed to have signed the embedded receipt.',
|
|
175
|
+
},
|
|
176
|
+
allowUnpinned: { type: 'boolean', description: 'Accept any valid non-small-order signer (demos and 1.x migration only).' },
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
outputSchema: {
|
|
180
|
+
type: 'object',
|
|
181
|
+
required: ['ok', 'gate', 'receiptFormat'],
|
|
182
|
+
properties: {
|
|
183
|
+
ok: { type: 'boolean', description: 'True only when the envelope reaches S4_COMMIT with a verified cryptographic receipt and intact R_san digest.' },
|
|
184
|
+
gate: { type: 'string', enum: ['pass', 'blocked', 'integrity_only'], description: 'Fail-closed OPEG/1 gate decision.' },
|
|
185
|
+
receiptFormat: { type: 'string', description: 'Detected embedded receipt format (sva-er/1, aer-1, or none).' },
|
|
186
|
+
reason: { type: 'string', description: 'Exact rejection or pass reason.' },
|
|
187
|
+
receiptOutcome: { description: 'Underlying receipt verification result object or null.' },
|
|
77
188
|
},
|
|
78
189
|
},
|
|
79
190
|
},
|
|
80
191
|
{
|
|
81
192
|
name: 'sva_judge_audit',
|
|
82
|
-
|
|
193
|
+
title: 'Audit Multi-Agent Claims & Calibration (SVA-JEV/1)',
|
|
194
|
+
description:
|
|
195
|
+
'Audit multi-model review panels and claim-trace briefs deterministically using Wilson 95% confidence-interval calibration, author self-vote exclusion, verbatim >=12-char quote verification, planted-fake traps, and zero-LLM invented-term scanning under SVA-JEV/1. Call this when verifying open-ended architectural plans, peer-model critiques, or evidence-backed summaries; do not use for cryptographic receipt verification (use sva_verify_receipt) or numeric execution gating (use sva_opeg_check). Executes with zero LLM calls and stamps verdicts as stability-signal-not-correctness.',
|
|
196
|
+
annotations: {
|
|
197
|
+
title: 'Audit Epistemic Judge Envelope (SVA-JEV/1)',
|
|
198
|
+
readOnlyHint: true,
|
|
199
|
+
destructiveHint: false,
|
|
200
|
+
idempotentHint: true,
|
|
201
|
+
openWorldHint: false,
|
|
202
|
+
},
|
|
83
203
|
inputSchema: {
|
|
84
204
|
type: 'object',
|
|
205
|
+
additionalProperties: false,
|
|
85
206
|
required: ['envelope'],
|
|
86
207
|
properties: {
|
|
87
|
-
envelope: {
|
|
208
|
+
envelope: {
|
|
209
|
+
type: 'object',
|
|
210
|
+
description: 'SVA-JEV/1 evaluation envelope with spec="sva-jev/1", semantics="stability-signal-not-correctness", and mode (calibration, jev_vote, quote_check, or claim_trace).',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
outputSchema: {
|
|
215
|
+
type: 'object',
|
|
216
|
+
required: ['ok', 'mode'],
|
|
217
|
+
properties: {
|
|
218
|
+
ok: { type: 'boolean', description: 'True only when all SVA-JEV/1 rules for the selected mode pass.' },
|
|
219
|
+
mode: { type: 'string', description: 'Evaluated SVA-JEV/1 audit mode.' },
|
|
220
|
+
reason: { type: 'string', description: 'Exact rejection diagnostic when ok is false.' },
|
|
88
221
|
},
|
|
89
222
|
},
|
|
90
223
|
},
|
|
91
224
|
{
|
|
92
225
|
name: 'sva_crystallize_skill',
|
|
93
|
-
|
|
226
|
+
title: 'Induce Zero-LLM Deterministic Parameter Binder (VSC/1)',
|
|
227
|
+
description:
|
|
228
|
+
'Induce a deterministic, zero-LLM parameter extraction binder from solved task examples, validate it via leave-one-out cross-check, and optionally test binding against a novel task string under VSC/1. Call this when compiling repeated structured agent tasks into a fast, zero-token deterministic function; do not use on unstructured prose or post-execution receipt signing (use sva_mint_receipt). Runs purely in memory with zero model invocations and refuses unseen quantity/negation words and ambiguous rules.',
|
|
229
|
+
annotations: {
|
|
230
|
+
title: 'Crystallize Zero-LLM Skill Binder (VSC/1)',
|
|
231
|
+
readOnlyHint: true,
|
|
232
|
+
destructiveHint: false,
|
|
233
|
+
idempotentHint: true,
|
|
234
|
+
openWorldHint: false,
|
|
235
|
+
},
|
|
94
236
|
inputSchema: {
|
|
95
237
|
type: 'object',
|
|
238
|
+
additionalProperties: false,
|
|
96
239
|
required: ['examples'],
|
|
97
240
|
properties: {
|
|
98
241
|
examples: {
|
|
@@ -101,24 +244,51 @@ export const MCP_TOOLS = [
|
|
|
101
244
|
type: 'object',
|
|
102
245
|
required: ['task', 'input'],
|
|
103
246
|
properties: {
|
|
104
|
-
task: { type: 'string' },
|
|
105
|
-
input: { type: 'object' },
|
|
247
|
+
task: { type: 'string', description: 'Natural-language task prompt from a solved run.' },
|
|
248
|
+
input: { type: 'object', description: 'Verified structured parameter map for this task.' },
|
|
106
249
|
},
|
|
250
|
+
description: 'Solved positive { task, input } training example.',
|
|
107
251
|
},
|
|
108
|
-
description: 'Array of solved positive { task, input } examples.',
|
|
252
|
+
description: 'Array of solved positive { task, input } examples sharing a repeatable pattern.',
|
|
109
253
|
},
|
|
110
254
|
negatives: {
|
|
111
255
|
type: 'array',
|
|
112
|
-
items: {
|
|
256
|
+
items: {
|
|
257
|
+
type: 'object',
|
|
258
|
+
properties: { task: { type: 'string', description: 'Near-miss prompt that must be rejected.' } },
|
|
259
|
+
description: 'Refused near-miss { task } counter-example.',
|
|
260
|
+
},
|
|
113
261
|
description: 'Optional refused near-miss { task } counter-examples.',
|
|
114
262
|
},
|
|
115
263
|
skill: { type: 'object', description: 'Optional skill schema with params.properties metadata.' },
|
|
116
|
-
testTask: { type: 'string', description: 'Optional novel task string to test binder extraction and near-miss
|
|
264
|
+
testTask: { type: 'string', description: 'Optional novel task string to test binder extraction and near-miss refusal diagnostics.' },
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
outputSchema: {
|
|
268
|
+
type: 'object',
|
|
269
|
+
required: ['ok', 'induced', 'leaveOneOut'],
|
|
270
|
+
properties: {
|
|
271
|
+
ok: { type: 'boolean', description: 'True when a binder was induced and achieved 100% leave-one-out accuracy.' },
|
|
272
|
+
induced: { type: 'boolean', description: 'Whether a deterministic binder spec was induced.' },
|
|
273
|
+
error: { description: 'Induction failure message or null.' },
|
|
274
|
+
leaveOneOut: { type: 'object', description: 'Leave-one-out cross-validation summary ({ passed, total, ok }).' },
|
|
275
|
+
spec: { description: 'Induced deterministic binder specification object or null.' },
|
|
276
|
+
testResult: { type: 'object', description: 'Optional binding and refusal diagnostic for testTask.' },
|
|
117
277
|
},
|
|
118
278
|
},
|
|
119
279
|
},
|
|
120
280
|
];
|
|
121
281
|
|
|
282
|
+
export const SVA_GATE_TOOLS = MCP_TOOLS;
|
|
283
|
+
|
|
284
|
+
export function formatMcpToolResult(resultPayload, isError = false) {
|
|
285
|
+
return {
|
|
286
|
+
isError,
|
|
287
|
+
structuredContent: resultPayload,
|
|
288
|
+
content: [{ type: 'text', text: JSON.stringify(resultPayload, null, 2) }],
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
122
292
|
function runTool(name, args = {}) {
|
|
123
293
|
switch (name) {
|
|
124
294
|
case 'sva_seal_text': {
|
|
@@ -126,10 +296,13 @@ function runTool(name, args = {}) {
|
|
|
126
296
|
const sg = new StreamSealGuard();
|
|
127
297
|
const sealed = args.chunks.map((c) => sg.push(String(c))).join('') + sg.flush();
|
|
128
298
|
const fullRaw = args.chunks.map(String).join('');
|
|
299
|
+
const audit = sg.session.audit(sealed);
|
|
129
300
|
return {
|
|
301
|
+
ok: audit.clean,
|
|
130
302
|
mode: 'stream',
|
|
131
303
|
sealed,
|
|
132
|
-
|
|
304
|
+
sealedText: sealed,
|
|
305
|
+
audit,
|
|
133
306
|
injection: scanInjection(fullRaw),
|
|
134
307
|
};
|
|
135
308
|
}
|
|
@@ -137,23 +310,29 @@ function runTool(name, args = {}) {
|
|
|
137
310
|
const findings = detect(text);
|
|
138
311
|
const session = new SealSession();
|
|
139
312
|
const sealed = session.apply(text, findings);
|
|
313
|
+
const audit = session.audit(sealed);
|
|
140
314
|
return {
|
|
315
|
+
ok: audit.clean,
|
|
141
316
|
mode: 'single',
|
|
142
317
|
sealed,
|
|
318
|
+
sealedText: sealed,
|
|
143
319
|
findingsCount: findings.length,
|
|
144
|
-
audit
|
|
320
|
+
audit,
|
|
145
321
|
injection: scanInjection(text),
|
|
146
322
|
};
|
|
147
323
|
}
|
|
148
324
|
case 'sva_mint_receipt': {
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
325
|
+
return {
|
|
326
|
+
ok: true,
|
|
327
|
+
...mintSvaEr1({
|
|
328
|
+
rSan: args.rSan,
|
|
329
|
+
missionId: args.missionId,
|
|
330
|
+
agencyName: args.agencyName,
|
|
331
|
+
clockStatus: args.clockStatus || 'unattested',
|
|
332
|
+
seedHex: args.seedHex || null,
|
|
333
|
+
events: Array.isArray(args.events) ? args.events : [],
|
|
334
|
+
}),
|
|
335
|
+
};
|
|
157
336
|
}
|
|
158
337
|
case 'sva_verify_receipt': {
|
|
159
338
|
return verifyAnyReceipt(args.receipt, { deliverable: args.deliverable ?? null, expectedPublicKeys: args.expectedPublicKeys ?? null, allowUnpinned: args.allowUnpinned === true });
|
|
@@ -176,7 +355,7 @@ function runTool(name, args = {}) {
|
|
|
176
355
|
const looRows = spec ? leaveOneOut(pos, neg, skill) : [];
|
|
177
356
|
const looPassed = looRows.filter((r) => r.ok).length;
|
|
178
357
|
const loo = { passed: looPassed, total: looRows.length, ok: looRows.length > 0 && looPassed === looRows.length };
|
|
179
|
-
const out = { induced: Boolean(spec), error: induced?.error ?? null, leaveOneOut: loo, spec };
|
|
358
|
+
const out = { ok: Boolean(spec && loo.ok), induced: Boolean(spec), error: induced?.error ?? null, leaveOneOut: loo, spec };
|
|
180
359
|
if (spec && typeof args.testTask === 'string') {
|
|
181
360
|
const { input: bound, refused, detail } = explainApply(spec, args.testTask);
|
|
182
361
|
const novel = novelWording(pos, args.testTask);
|
|
@@ -230,11 +409,7 @@ export function createMcpHandler() {
|
|
|
230
409
|
return {
|
|
231
410
|
jsonrpc: '2.0',
|
|
232
411
|
id,
|
|
233
|
-
result:
|
|
234
|
-
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
235
|
-
structuredContent: data,
|
|
236
|
-
isError: false,
|
|
237
|
-
},
|
|
412
|
+
result: formatMcpToolResult(data, false),
|
|
238
413
|
};
|
|
239
414
|
}
|
|
240
415
|
return { jsonrpc: '2.0', id, error: { code: -32601, message: `Method not found: ${method}` } };
|