@vibecheckai/cli 3.7.0 → 3.9.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 +135 -63
- package/bin/_deprecations.js +447 -19
- package/bin/_router.js +1 -1
- package/bin/registry.js +347 -280
- package/bin/runners/context/generators/cursor-enhanced.js +2439 -0
- package/bin/runners/lib/agent-firewall/enforcement/gateway.js +1059 -0
- package/bin/runners/lib/agent-firewall/enforcement/index.js +98 -0
- package/bin/runners/lib/agent-firewall/enforcement/mode.js +318 -0
- package/bin/runners/lib/agent-firewall/enforcement/orchestrator.js +484 -0
- package/bin/runners/lib/agent-firewall/enforcement/proof-artifact.js +418 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/change-event.schema.json +173 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/intent.schema.json +181 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/verdict.schema.json +222 -0
- package/bin/runners/lib/agent-firewall/enforcement/verdict-v2.js +333 -0
- package/bin/runners/lib/agent-firewall/index.js +200 -0
- package/bin/runners/lib/agent-firewall/integration/index.js +20 -0
- package/bin/runners/lib/agent-firewall/integration/ship-gate.js +437 -0
- package/bin/runners/lib/agent-firewall/intent/alignment-engine.js +634 -0
- package/bin/runners/lib/agent-firewall/intent/auto-detect.js +426 -0
- package/bin/runners/lib/agent-firewall/intent/index.js +102 -0
- package/bin/runners/lib/agent-firewall/intent/schema.js +352 -0
- package/bin/runners/lib/agent-firewall/intent/store.js +283 -0
- package/bin/runners/lib/agent-firewall/interception/fs-interceptor.js +502 -0
- package/bin/runners/lib/agent-firewall/interception/index.js +23 -0
- package/bin/runners/lib/agent-firewall/interceptor/base.js +7 -3
- package/bin/runners/lib/agent-firewall/session/collector.js +451 -0
- package/bin/runners/lib/agent-firewall/session/index.js +26 -0
- package/bin/runners/lib/artifact-envelope.js +540 -0
- package/bin/runners/lib/auth-shared.js +977 -0
- package/bin/runners/lib/checkpoint.js +941 -0
- package/bin/runners/lib/cleanup/engine.js +571 -0
- package/bin/runners/lib/cleanup/index.js +53 -0
- package/bin/runners/lib/cleanup/output.js +375 -0
- package/bin/runners/lib/cleanup/rules.js +1060 -0
- package/bin/runners/lib/doctor/diagnosis-receipt.js +454 -0
- package/bin/runners/lib/doctor/failure-signatures.js +526 -0
- package/bin/runners/lib/doctor/fix-script.js +336 -0
- package/bin/runners/lib/doctor/modules/build-tools.js +453 -0
- package/bin/runners/lib/doctor/modules/index.js +62 -3
- package/bin/runners/lib/doctor/modules/os-quirks.js +706 -0
- package/bin/runners/lib/doctor/modules/repo-integrity.js +485 -0
- package/bin/runners/lib/doctor/safe-repair.js +384 -0
- package/bin/runners/lib/engine/ast-cache.js +210 -210
- package/bin/runners/lib/engine/auth-extractor.js +211 -211
- package/bin/runners/lib/engine/billing-extractor.js +112 -112
- package/bin/runners/lib/engine/enforcement-extractor.js +100 -100
- package/bin/runners/lib/engine/env-extractor.js +207 -207
- package/bin/runners/lib/engine/express-extractor.js +208 -208
- package/bin/runners/lib/engine/extractors.js +849 -849
- package/bin/runners/lib/engine/index.js +207 -207
- package/bin/runners/lib/engine/repo-index.js +514 -514
- package/bin/runners/lib/engine/types.js +124 -124
- package/bin/runners/lib/engines/attack-detector.js +1192 -0
- package/bin/runners/lib/entitlements-v2.js +2 -2
- package/bin/runners/lib/missions/briefing.js +427 -0
- package/bin/runners/lib/missions/checkpoint.js +753 -0
- package/bin/runners/lib/missions/hardening.js +851 -0
- package/bin/runners/lib/missions/plan.js +421 -32
- package/bin/runners/lib/missions/safety-gates.js +645 -0
- package/bin/runners/lib/missions/schema.js +478 -0
- package/bin/runners/lib/packs/bundle.js +675 -0
- package/bin/runners/lib/packs/evidence-pack.js +671 -0
- package/bin/runners/lib/packs/pack-factory.js +837 -0
- package/bin/runners/lib/packs/permissions-pack.js +686 -0
- package/bin/runners/lib/packs/proof-graph-pack.js +779 -0
- package/bin/runners/lib/safelist/index.js +96 -0
- package/bin/runners/lib/safelist/integration.js +334 -0
- package/bin/runners/lib/safelist/matcher.js +696 -0
- package/bin/runners/lib/safelist/schema.js +948 -0
- package/bin/runners/lib/safelist/store.js +438 -0
- package/bin/runners/lib/schemas/ship-manifest.schema.json +251 -0
- package/bin/runners/lib/ship-gate.js +832 -0
- package/bin/runners/lib/ship-manifest.js +1153 -0
- package/bin/runners/lib/ship-output.js +1 -1
- package/bin/runners/lib/unified-cli-output.js +710 -383
- package/bin/runners/lib/upsell.js +3 -3
- package/bin/runners/lib/why-tree.js +650 -0
- package/bin/runners/runAllowlist.js +33 -4
- package/bin/runners/runApprove.js +240 -1122
- package/bin/runners/runAudit.js +692 -0
- package/bin/runners/runAuth.js +325 -29
- package/bin/runners/runCheckpoint.js +442 -494
- package/bin/runners/runCleanup.js +343 -0
- package/bin/runners/runDoctor.js +269 -19
- package/bin/runners/runFix.js +411 -32
- package/bin/runners/runForge.js +411 -0
- package/bin/runners/runIntent.js +906 -0
- package/bin/runners/runKickoff.js +878 -0
- package/bin/runners/runLaunch.js +2000 -0
- package/bin/runners/runLink.js +785 -0
- package/bin/runners/runMcp.js +1741 -837
- package/bin/runners/runPacks.js +2089 -0
- package/bin/runners/runPolish.js +41 -0
- package/bin/runners/runReality.js +178 -1
- package/bin/runners/runSafelist.js +1190 -0
- package/bin/runners/runScan.js +21 -9
- package/bin/runners/runShield.js +1282 -0
- package/bin/runners/runShip.js +395 -16
- package/bin/vibecheck.js +34 -6
- package/mcp-server/README.md +117 -158
- package/mcp-server/handlers/index.ts +2 -2
- package/mcp-server/handlers/tool-handler.ts +50 -11
- package/mcp-server/index.js +16 -0
- package/mcp-server/intent-firewall-interceptor.js +529 -0
- package/mcp-server/lib/executor.ts +5 -5
- package/mcp-server/lib/index.ts +14 -4
- package/mcp-server/lib/sandbox.test.ts +4 -4
- package/mcp-server/lib/sandbox.ts +2 -2
- package/mcp-server/manifest.json +473 -0
- package/mcp-server/package.json +1 -1
- package/mcp-server/registry/tool-registry.js +315 -523
- package/mcp-server/registry/tools.json +442 -428
- package/mcp-server/registry.test.ts +18 -12
- package/mcp-server/tier-auth.js +68 -11
- package/mcp-server/tools-v3.js +70 -16
- package/mcp-server/tsconfig.json +1 -0
- package/package.json +2 -1
- package/bin/runners/runProof.zip +0 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verdict System v2 - Deterministic Enforcement Verdicts
|
|
3
|
+
*
|
|
4
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
* AGENT FIREWALL™ - VERDICT SYSTEM
|
|
6
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
7
|
+
*
|
|
8
|
+
* Every Agent Firewall run MUST end in exactly one verdict:
|
|
9
|
+
* - PASS (intent + proof satisfied)
|
|
10
|
+
* - BLOCK (default on any violation)
|
|
11
|
+
*
|
|
12
|
+
* NO "partial success".
|
|
13
|
+
* NO "best effort".
|
|
14
|
+
* NO "WARN" as a final state in ENFORCE mode.
|
|
15
|
+
*
|
|
16
|
+
* Verdicts are:
|
|
17
|
+
* - Deterministic
|
|
18
|
+
* - Signed/hashed
|
|
19
|
+
* - Stored for reuse
|
|
20
|
+
*
|
|
21
|
+
* @module enforcement/verdict-v2
|
|
22
|
+
* @version 2.0.0
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
"use strict";
|
|
26
|
+
|
|
27
|
+
const crypto = require("crypto");
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Verdict decisions - only two options
|
|
31
|
+
*/
|
|
32
|
+
const VERDICT = {
|
|
33
|
+
PASS: "PASS",
|
|
34
|
+
BLOCK: "BLOCK",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Observation decision (for OBSERVE mode only)
|
|
39
|
+
*/
|
|
40
|
+
const OBSERVATION = {
|
|
41
|
+
WOULD_PASS: "WOULD_PASS",
|
|
42
|
+
WOULD_BLOCK: "WOULD_BLOCK",
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Firewall modes
|
|
47
|
+
*/
|
|
48
|
+
const MODE = {
|
|
49
|
+
ENFORCE: "ENFORCE", // Default: block on violation
|
|
50
|
+
OBSERVE: "OBSERVE", // Log + warn only (returns WOULD_* verdicts)
|
|
51
|
+
CI: "CI", // Fail pipeline on BLOCK
|
|
52
|
+
IDE: "IDE", // Real-time interception, block writes
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Verdict object structure
|
|
57
|
+
* @typedef {Object} Verdict
|
|
58
|
+
* @property {string} decision - PASS or BLOCK
|
|
59
|
+
* @property {string} mode - Mode used for evaluation
|
|
60
|
+
* @property {Object[]} violations - All violations found
|
|
61
|
+
* @property {Object[]} proofs - All proofs collected
|
|
62
|
+
* @property {string} intent_hash - Hash of intent used
|
|
63
|
+
* @property {string} verdict_hash - Hash of entire verdict for signing
|
|
64
|
+
* @property {string} timestamp - ISO timestamp
|
|
65
|
+
* @property {string} id - Unique verdict ID
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Generate verdict ID
|
|
70
|
+
* @returns {string} Unique verdict ID
|
|
71
|
+
*/
|
|
72
|
+
function generateVerdictId() {
|
|
73
|
+
return `vrd-${Date.now().toString(36)}-${crypto.randomBytes(4).toString("hex")}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Compute verdict hash for integrity/signing
|
|
78
|
+
* @param {Object} verdict - Verdict object (without hash)
|
|
79
|
+
* @returns {string} SHA-256 hash
|
|
80
|
+
*/
|
|
81
|
+
function computeVerdictHash(verdict) {
|
|
82
|
+
const content = JSON.stringify({
|
|
83
|
+
decision: verdict.decision,
|
|
84
|
+
mode: verdict.mode,
|
|
85
|
+
violations: verdict.violations.map(v => ({
|
|
86
|
+
code: v.code,
|
|
87
|
+
resource: v.resource,
|
|
88
|
+
})),
|
|
89
|
+
proofs: verdict.proofs.map(p => ({
|
|
90
|
+
id: p.id,
|
|
91
|
+
status: p.status,
|
|
92
|
+
})),
|
|
93
|
+
intent_hash: verdict.intent_hash,
|
|
94
|
+
timestamp: verdict.timestamp,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return crypto.createHash("sha256").update(content).digest("hex");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Generate deterministic verdict from alignment and proof results
|
|
102
|
+
*
|
|
103
|
+
* RULES:
|
|
104
|
+
* - If ANY violation exists → BLOCK
|
|
105
|
+
* - If ANY required proof failed → BLOCK
|
|
106
|
+
* - If intent is missing → BLOCK
|
|
107
|
+
* - Only if ALL checks pass → PASS
|
|
108
|
+
*
|
|
109
|
+
* @param {Object} params - Verdict parameters
|
|
110
|
+
* @param {Object} params.alignmentResult - Result from alignment engine
|
|
111
|
+
* @param {Object[]} params.proofs - Array of proof artifacts
|
|
112
|
+
* @param {string} params.mode - Firewall mode
|
|
113
|
+
* @param {string} params.intent_hash - Hash of intent used
|
|
114
|
+
* @returns {Verdict} Final verdict
|
|
115
|
+
*/
|
|
116
|
+
function generateVerdict({ alignmentResult, proofs = [], mode = MODE.ENFORCE, intent_hash = null }) {
|
|
117
|
+
const timestamp = new Date().toISOString();
|
|
118
|
+
const id = generateVerdictId();
|
|
119
|
+
|
|
120
|
+
// Collect all violations
|
|
121
|
+
const violations = alignmentResult?.violations || [];
|
|
122
|
+
|
|
123
|
+
// Check for failed proofs
|
|
124
|
+
const failedProofs = proofs.filter(p => p.status === "failed" || p.status === "unverified");
|
|
125
|
+
for (const proof of failedProofs) {
|
|
126
|
+
violations.push({
|
|
127
|
+
code: "PROOF_FAILED",
|
|
128
|
+
rule: `proof_${proof.type}`,
|
|
129
|
+
message: `Required proof failed: ${proof.type} - ${proof.id}`,
|
|
130
|
+
resource: proof.target || "unknown",
|
|
131
|
+
intent_ref: "reality_proof",
|
|
132
|
+
severity: "block",
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Determine decision
|
|
137
|
+
// In ENFORCE/CI mode: any violation = BLOCK
|
|
138
|
+
// In OBSERVE mode: violations generate WOULD_BLOCK but don't actually block
|
|
139
|
+
let decision;
|
|
140
|
+
|
|
141
|
+
if (mode === MODE.OBSERVE) {
|
|
142
|
+
decision = violations.length > 0 ? OBSERVATION.WOULD_BLOCK : OBSERVATION.WOULD_PASS;
|
|
143
|
+
} else {
|
|
144
|
+
// ENFORCE, CI, IDE - strict enforcement
|
|
145
|
+
decision = violations.length > 0 ? VERDICT.BLOCK : VERDICT.PASS;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const verdict = {
|
|
149
|
+
id,
|
|
150
|
+
decision,
|
|
151
|
+
mode,
|
|
152
|
+
violations,
|
|
153
|
+
proofs: proofs.map(p => ({
|
|
154
|
+
id: p.id,
|
|
155
|
+
type: p.type,
|
|
156
|
+
status: p.status,
|
|
157
|
+
trace: p.trace,
|
|
158
|
+
})),
|
|
159
|
+
intent_hash,
|
|
160
|
+
timestamp,
|
|
161
|
+
verdict_hash: "", // Will be computed
|
|
162
|
+
|
|
163
|
+
// Summary for humans
|
|
164
|
+
summary: generateSummary(decision, violations, proofs),
|
|
165
|
+
|
|
166
|
+
// Machine-readable status
|
|
167
|
+
passed: decision === VERDICT.PASS || decision === OBSERVATION.WOULD_PASS,
|
|
168
|
+
blocked: decision === VERDICT.BLOCK || decision === OBSERVATION.WOULD_BLOCK,
|
|
169
|
+
violation_count: violations.length,
|
|
170
|
+
proof_count: proofs.length,
|
|
171
|
+
failed_proof_count: failedProofs.length,
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Compute and set hash
|
|
175
|
+
verdict.verdict_hash = computeVerdictHash(verdict);
|
|
176
|
+
|
|
177
|
+
return verdict;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Generate human-readable summary
|
|
182
|
+
* @param {string} decision - Verdict decision
|
|
183
|
+
* @param {Object[]} violations - Violations array
|
|
184
|
+
* @param {Object[]} proofs - Proofs array
|
|
185
|
+
* @returns {string} Summary text
|
|
186
|
+
*/
|
|
187
|
+
function generateSummary(decision, violations, proofs) {
|
|
188
|
+
if (decision === VERDICT.PASS || decision === OBSERVATION.WOULD_PASS) {
|
|
189
|
+
return `All checks passed. Intent aligned, ${proofs.length} proofs verified.`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const violationSummary = violations.slice(0, 3)
|
|
193
|
+
.map(v => v.message)
|
|
194
|
+
.join("; ");
|
|
195
|
+
|
|
196
|
+
const extra = violations.length > 3 ? ` (+${violations.length - 3} more)` : "";
|
|
197
|
+
|
|
198
|
+
return `BLOCKED: ${violations.length} violation(s). ${violationSummary}${extra}`;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Generate block message with exact reason and reference
|
|
203
|
+
* @param {Object[]} violations - Violations array
|
|
204
|
+
* @returns {string} Formatted block message
|
|
205
|
+
*/
|
|
206
|
+
function formatBlockMessage(violations) {
|
|
207
|
+
if (violations.length === 0) {
|
|
208
|
+
return "BLOCKED_BY_AGENT_FIREWALL: Unknown reason";
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const lines = ["BLOCKED_BY_AGENT_FIREWALL:"];
|
|
212
|
+
|
|
213
|
+
for (const violation of violations) {
|
|
214
|
+
lines.push(`- reason: ${violation.code}`);
|
|
215
|
+
lines.push(` resource: ${violation.resource}`);
|
|
216
|
+
lines.push(` intent_ref: ${violation.intent_ref}`);
|
|
217
|
+
if (violation.message) {
|
|
218
|
+
lines.push(` message: ${violation.message}`);
|
|
219
|
+
}
|
|
220
|
+
lines.push("");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return lines.join("\n");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Verify verdict integrity
|
|
228
|
+
* @param {Object} verdict - Verdict to verify
|
|
229
|
+
* @returns {Object} Verification result
|
|
230
|
+
*/
|
|
231
|
+
function verifyVerdictIntegrity(verdict) {
|
|
232
|
+
if (!verdict || !verdict.verdict_hash) {
|
|
233
|
+
return {
|
|
234
|
+
valid: false,
|
|
235
|
+
reason: "MISSING_HASH",
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const computed = computeVerdictHash(verdict);
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
valid: computed === verdict.verdict_hash,
|
|
243
|
+
reason: computed === verdict.verdict_hash ? "VERIFIED" : "HASH_MISMATCH",
|
|
244
|
+
computed_hash: computed,
|
|
245
|
+
stored_hash: verdict.verdict_hash,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Convert legacy verdict (ALLOW/WARN/BLOCK) to v2 format
|
|
251
|
+
* @param {Object} legacyVerdict - Legacy verdict object
|
|
252
|
+
* @param {string} mode - Firewall mode
|
|
253
|
+
* @returns {Verdict} V2 verdict
|
|
254
|
+
*/
|
|
255
|
+
function convertLegacyVerdict(legacyVerdict, mode = MODE.ENFORCE) {
|
|
256
|
+
const violations = (legacyVerdict.violations || []).map(v => ({
|
|
257
|
+
code: v.rule?.toUpperCase().replace(/-/g, "_") || "UNKNOWN",
|
|
258
|
+
rule: v.rule || "unknown",
|
|
259
|
+
message: v.message || "No message",
|
|
260
|
+
resource: v.claimId || v.file || "unknown",
|
|
261
|
+
intent_ref: "legacy",
|
|
262
|
+
severity: v.severity || "block",
|
|
263
|
+
}));
|
|
264
|
+
|
|
265
|
+
// In v2, WARN becomes BLOCK in ENFORCE mode
|
|
266
|
+
let decision;
|
|
267
|
+
if (mode === MODE.OBSERVE) {
|
|
268
|
+
decision = legacyVerdict.decision === "ALLOW"
|
|
269
|
+
? OBSERVATION.WOULD_PASS
|
|
270
|
+
: OBSERVATION.WOULD_BLOCK;
|
|
271
|
+
} else {
|
|
272
|
+
// ALLOW stays PASS, WARN and BLOCK become BLOCK
|
|
273
|
+
decision = legacyVerdict.decision === "ALLOW" ? VERDICT.PASS : VERDICT.BLOCK;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return generateVerdict({
|
|
277
|
+
alignmentResult: { violations },
|
|
278
|
+
proofs: [],
|
|
279
|
+
mode,
|
|
280
|
+
intent_hash: null,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Create verdict manifest for artifact storage
|
|
286
|
+
* @param {Object} verdict - Verdict object
|
|
287
|
+
* @param {Object} metadata - Additional metadata
|
|
288
|
+
* @returns {Object} Manifest object
|
|
289
|
+
*/
|
|
290
|
+
function createVerdictManifest(verdict, metadata = {}) {
|
|
291
|
+
return {
|
|
292
|
+
schema_version: "2.0.0",
|
|
293
|
+
verdict: {
|
|
294
|
+
id: verdict.id,
|
|
295
|
+
decision: verdict.decision,
|
|
296
|
+
hash: verdict.verdict_hash,
|
|
297
|
+
timestamp: verdict.timestamp,
|
|
298
|
+
},
|
|
299
|
+
intent: {
|
|
300
|
+
hash: verdict.intent_hash,
|
|
301
|
+
},
|
|
302
|
+
violations: verdict.violations.map(v => ({
|
|
303
|
+
code: v.code,
|
|
304
|
+
resource: v.resource,
|
|
305
|
+
intent_ref: v.intent_ref,
|
|
306
|
+
})),
|
|
307
|
+
proofs: verdict.proofs.map(p => ({
|
|
308
|
+
id: p.id,
|
|
309
|
+
type: p.type,
|
|
310
|
+
status: p.status,
|
|
311
|
+
})),
|
|
312
|
+
summary: verdict.summary,
|
|
313
|
+
metadata: {
|
|
314
|
+
mode: verdict.mode,
|
|
315
|
+
...metadata,
|
|
316
|
+
},
|
|
317
|
+
created_at: new Date().toISOString(),
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
module.exports = {
|
|
322
|
+
VERDICT,
|
|
323
|
+
OBSERVATION,
|
|
324
|
+
MODE,
|
|
325
|
+
generateVerdict,
|
|
326
|
+
generateVerdictId,
|
|
327
|
+
computeVerdictHash,
|
|
328
|
+
verifyVerdictIntegrity,
|
|
329
|
+
formatBlockMessage,
|
|
330
|
+
generateSummary,
|
|
331
|
+
convertLegacyVerdict,
|
|
332
|
+
createVerdictManifest,
|
|
333
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Firewall - Unified Entry Point
|
|
3
|
+
*
|
|
4
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
* AGENT FIREWALL™ v3.0 - ENFORCEMENT INFRASTRUCTURE
|
|
6
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
7
|
+
*
|
|
8
|
+
* THE SINGLE ENTRY POINT for all Agent Firewall functionality.
|
|
9
|
+
*
|
|
10
|
+
* This module consolidates:
|
|
11
|
+
* - Intent system (capture, store, validate)
|
|
12
|
+
* - Enforcement gateway (intercept, evaluate, verdict)
|
|
13
|
+
* - Interception layer (MCP, file writes, git hooks)
|
|
14
|
+
* - Integration layer (ship, packs, seal, CI)
|
|
15
|
+
*
|
|
16
|
+
* All code should import from this module.
|
|
17
|
+
*
|
|
18
|
+
* Example:
|
|
19
|
+
* ```javascript
|
|
20
|
+
* const { createGateway, intercept, canShip } = require("./lib/agent-firewall");
|
|
21
|
+
*
|
|
22
|
+
* // Create gateway for session
|
|
23
|
+
* const gateway = createGateway(projectRoot);
|
|
24
|
+
*
|
|
25
|
+
* // Intercept a change
|
|
26
|
+
* const verdict = await gateway.intercept(change, source);
|
|
27
|
+
*
|
|
28
|
+
* // Check if can ship
|
|
29
|
+
* const allowed = await canShip(projectRoot);
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @module agent-firewall
|
|
33
|
+
* @version 3.0.0
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
"use strict";
|
|
37
|
+
|
|
38
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
39
|
+
// CORE MODULES
|
|
40
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
41
|
+
|
|
42
|
+
// Intent system
|
|
43
|
+
const intent = require("./intent");
|
|
44
|
+
|
|
45
|
+
// Enforcement system
|
|
46
|
+
const enforcement = require("./enforcement");
|
|
47
|
+
|
|
48
|
+
// Session system
|
|
49
|
+
const session = require("./session");
|
|
50
|
+
|
|
51
|
+
// Interception layer
|
|
52
|
+
let interception;
|
|
53
|
+
try {
|
|
54
|
+
interception = require("./interception");
|
|
55
|
+
} catch {
|
|
56
|
+
interception = {};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Integration layer
|
|
60
|
+
let integration;
|
|
61
|
+
try {
|
|
62
|
+
integration = require("./integration");
|
|
63
|
+
} catch {
|
|
64
|
+
integration = {};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
68
|
+
// UNIFIED EXPORTS
|
|
69
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
70
|
+
|
|
71
|
+
module.exports = {
|
|
72
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
73
|
+
// PRIMARY API - Gateway (THE entry point for enforcement)
|
|
74
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
75
|
+
|
|
76
|
+
// Gateway creation and use
|
|
77
|
+
EnforcementGateway: enforcement.EnforcementGateway,
|
|
78
|
+
createGateway: enforcement.createGateway,
|
|
79
|
+
intercept: enforcement.intercept,
|
|
80
|
+
quickCheck: enforcement.quickCheck,
|
|
81
|
+
|
|
82
|
+
// Change event helpers
|
|
83
|
+
buildChangeEvent: enforcement.buildChangeEvent,
|
|
84
|
+
analyzeCodeQuality: enforcement.analyzeCodeQuality,
|
|
85
|
+
classifyDomain: enforcement.classifyDomain,
|
|
86
|
+
|
|
87
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
88
|
+
// INTENT SYSTEM
|
|
89
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
90
|
+
|
|
91
|
+
// Intent store
|
|
92
|
+
IntentStore: intent.IntentStore,
|
|
93
|
+
|
|
94
|
+
// Intent creation and validation
|
|
95
|
+
createIntent: intent.createIntent,
|
|
96
|
+
verifyIntentIntegrity: intent.verifyIntentIntegrity,
|
|
97
|
+
isIntentExpired: intent.isIntentExpired,
|
|
98
|
+
computeIntentHash: intent.computeIntentHash,
|
|
99
|
+
|
|
100
|
+
// Alignment checking
|
|
101
|
+
checkAlignment: intent.checkAlignment,
|
|
102
|
+
checkAlignmentBatch: intent.checkAlignmentBatch,
|
|
103
|
+
VIOLATION_CODES: intent.VIOLATION_CODES,
|
|
104
|
+
|
|
105
|
+
// Auto-detection
|
|
106
|
+
autoDetectIntent: intent.autoDetectIntent,
|
|
107
|
+
inferIntentFromGit: intent.inferIntentFromGit,
|
|
108
|
+
|
|
109
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
110
|
+
// VERDICT SYSTEM
|
|
111
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
112
|
+
|
|
113
|
+
// Verdict generation
|
|
114
|
+
generateVerdict: enforcement.generateVerdict,
|
|
115
|
+
generateVerdictId: enforcement.generateVerdictId,
|
|
116
|
+
|
|
117
|
+
// Verdict verification
|
|
118
|
+
computeVerdictHash: enforcement.computeVerdictHash,
|
|
119
|
+
verifyVerdictIntegrity: enforcement.verifyVerdictIntegrity,
|
|
120
|
+
|
|
121
|
+
// Verdict formatting
|
|
122
|
+
formatBlockMessage: enforcement.formatBlockMessage,
|
|
123
|
+
createVerdictManifest: enforcement.createVerdictManifest,
|
|
124
|
+
|
|
125
|
+
// Legacy conversion
|
|
126
|
+
convertLegacyVerdict: enforcement.convertLegacyVerdict,
|
|
127
|
+
|
|
128
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
129
|
+
// PROOF SYSTEM
|
|
130
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
131
|
+
|
|
132
|
+
ProofCollection: enforcement.ProofCollection,
|
|
133
|
+
determineRequiredProofs: enforcement.determineRequiredProofs,
|
|
134
|
+
PROOF_STATUS: enforcement.PROOF_STATUS,
|
|
135
|
+
PROOF_TYPE: enforcement.PROOF_TYPE,
|
|
136
|
+
|
|
137
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
138
|
+
// SESSION SYSTEM
|
|
139
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
140
|
+
|
|
141
|
+
SessionCollector: session.SessionCollector,
|
|
142
|
+
getCollector: session.getCollector,
|
|
143
|
+
|
|
144
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
145
|
+
// INTERCEPTION LAYER
|
|
146
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
147
|
+
|
|
148
|
+
// File system interception
|
|
149
|
+
activateFsInterceptor: interception.activateFsInterceptor,
|
|
150
|
+
deactivateFsInterceptor: interception.deactivateFsInterceptor,
|
|
151
|
+
isFsInterceptorActive: interception.isFsInterceptorActive,
|
|
152
|
+
BlockedWriteError: interception.BlockedWriteError,
|
|
153
|
+
|
|
154
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
155
|
+
// INTEGRATION LAYER (ship/packs/seal/CI)
|
|
156
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
157
|
+
|
|
158
|
+
// Ship gate
|
|
159
|
+
ShipGate: integration.ShipGate,
|
|
160
|
+
createShipGate: integration.createShipGate,
|
|
161
|
+
canShip: integration.canShip,
|
|
162
|
+
getCIStatus: integration.getCIStatus,
|
|
163
|
+
SHIP_GATE_STATUS: integration.SHIP_GATE_STATUS,
|
|
164
|
+
|
|
165
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
166
|
+
// MODE & CONSTANTS
|
|
167
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
168
|
+
|
|
169
|
+
MODE: enforcement.MODE,
|
|
170
|
+
VERDICT: enforcement.VERDICT,
|
|
171
|
+
OBSERVATION: enforcement.OBSERVATION,
|
|
172
|
+
BLOCK_PATTERNS: enforcement.BLOCK_PATTERNS,
|
|
173
|
+
|
|
174
|
+
// Mode configuration
|
|
175
|
+
ModeConfig: enforcement.ModeConfig,
|
|
176
|
+
formatModeBanner: enforcement.formatModeBanner,
|
|
177
|
+
|
|
178
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
179
|
+
// LEGACY COMPATIBILITY
|
|
180
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
181
|
+
|
|
182
|
+
// Orchestrator (use gateway for new code)
|
|
183
|
+
FirewallOrchestrator: enforcement.FirewallOrchestrator,
|
|
184
|
+
createOrchestrator: enforcement.createOrchestrator,
|
|
185
|
+
normalizeChangeEvent: enforcement.normalizeChangeEvent,
|
|
186
|
+
CHANGE_EVENT_TYPE: enforcement.CHANGE_EVENT_TYPE,
|
|
187
|
+
|
|
188
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
189
|
+
// SUBMODULE ACCESS
|
|
190
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
191
|
+
|
|
192
|
+
// For advanced use cases that need full submodule access
|
|
193
|
+
_modules: {
|
|
194
|
+
intent,
|
|
195
|
+
enforcement,
|
|
196
|
+
session,
|
|
197
|
+
interception,
|
|
198
|
+
integration,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Firewall Integration Index
|
|
3
|
+
*
|
|
4
|
+
* Exports integration modules for ship/packs/seal/CI.
|
|
5
|
+
*
|
|
6
|
+
* @module integration
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
"use strict";
|
|
10
|
+
|
|
11
|
+
const shipGate = require("./ship-gate");
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
// Ship Gate
|
|
15
|
+
ShipGate: shipGate.ShipGate,
|
|
16
|
+
createShipGate: shipGate.createShipGate,
|
|
17
|
+
canShip: shipGate.canShip,
|
|
18
|
+
getCIStatus: shipGate.getCIStatus,
|
|
19
|
+
SHIP_GATE_STATUS: shipGate.SHIP_GATE_STATUS,
|
|
20
|
+
};
|