π‘οΈ BLA (Blind LLM Agents) β Adversarial defense shield that protects binaries, Electron apps, JS bundles, Python, and WebAssembly against AI reverse-engineering agents like REA. Poison -> Exhaust -> Hallucinate.
JavaScript adversarial-aiclaude-codecursorelectron-securityllm-securitymcpmcp-serverobfuscationreverse-engineeringwebassembly
feat(mcp): stage B lint_lanes, param parity, and verify honesty passthrough
qybaihec6f2c2690179
diff --git a/src/mcp/server.ts b/src/mcp/server.tsindex 0cbd4e9..fe1740c 100644--- a/src/mcp/server.ts+++ b/src/mcp/server.ts@@ -4,10 +4,15 @@ import { inspectReleaseExposure } from "../core/release-exposure.js";import type { ProtectionIntensity } from "../core/types.js";import { auditTarget } from "../engine/auditor.js";import { protectTarget, resolveProtectOutputPath } from "../engine/protector.js";-import { verifyTarget } from "../engine/verifier.js";+import { verifyTarget, type VerifyTargetOptions } from "../engine/verifier.js";import { defendTarget } from "../engine/defender.js";-import { existsSync } from "node:fs";+import { existsSync, readFileSync } from "node:fs";+import { resolve as resolvePath } from "node:path";import { discoverHardenTargets, hardenProject } from "../engine/harden.js";+import {+ lintLaneIndependence,+ type LaneIndependenceReport,+} from "../engine/lane-independence-lint.js";import { runShowcaseBenchmark } from "../engine/benchmark.js";import {emitCompileTimeNativeHeader,@@ -160,6 +165,11 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([description:"Explicit write-confirmation boundary. Required (true) when this call would overwrite an existing output file; without it the call is refused with a confirmation_required receipt listing the paths. Default false.",},+ output_directory: {+ type: "string",+ description:+ "Optional root directory for hardened outputs (same as CLI `harden -o`). Default: <directory>/.bla-hardened.",+ },},additionalProperties: false,},@@ -231,6 +241,11 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([type: "string",description: "Optional deterministic seed; when omitted, BLA uses/persists a per-project random seed in .blarc",},+ in_place: {+ type: "boolean",+ description:+ "Overwrite the input path in place (same as CLI --in-place). When the planned output already exists β including the input itself β confirm_overwrite:true is required; otherwise the call is refused and nothing is written. Default false.",+ },confirm_overwrite: {type: "boolean",description:@@ -301,6 +316,16 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([type: "boolean",description: "Opt-in risky LLM directive layers. Default false.",},+ in_place: {+ type: "boolean",+ description:+ "Overwrite the input path in place (same as CLI --in-place). When the planned output already exists β including the input itself β confirm_overwrite:true is required; otherwise the call is refused and nothing is written. Default false.",+ },+ honey_source_maps: {+ type: "boolean",+ description:+ "Emit honey/decoy source maps with the shield (same as CLI default; pass false for --no-honey-maps). Default true.",+ },confirm_overwrite: {type: "boolean",description:@@ -314,7 +339,7 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([{name: "bla_verify",description:- "Verifies a BLA-protected artifact against REA's static/semantic resource limits, call-graph tarpit expansion, and token bankruptcy amplification.",+ "Verifies a BLA-protected artifact against REA's static/semantic resource limits, call-graph tarpit expansion, and token bankruptcy amplification. Pass protection-side honesty metadata (self_seal_enabled / wasm_export_rename_applied) so defenseScore soft-caps reflect what actually ran β same fields defend/harden already forward from ProtectionResult.",inputSchema: {type: "object",properties: {@@ -326,6 +351,21 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([type: "string",description: "Optional path to the unprotected original for amplification comparison",},+ self_seal_enabled: {+ type: "boolean",+ description:+ "Honesty metadata: true when protect/defend ran with self-seal. Omitting it soft-caps JS-like scores with self-seal-not-enabled (issue #40.6).",+ },+ wasm_export_rename_applied: {+ type: "boolean",+ description:+ "Honesty metadata: true when WASM export rename actually rewrote non-ABI exports. Omitting it soft-caps WASM scores with wasm-export-rename-pending (issue #40.6).",+ },+ numeric_template_leak_known: {+ type: "boolean",+ description:+ "Honesty metadata: true when known BLA-injected numeric template golden constants still leak (issue #40.6).",+ },},required: ["target_path"],additionalProperties: false,@@ -441,6 +481,22 @@ export const BLA_MCP_TOOLS: readonly McpToolDefinition[] = Object.freeze([additionalProperties: false,},},+ {+ name: "bla_lint_lanes",+ description:+ "Read-only heuristic lane-independence footgun lint (same engine as CLI `bla lint-lanes`). Warns when gate/activation source looks like independent per-lane checks. Defensive guidance only β prefer whole-key chained mixing. Writes nothing.",+ inputSchema: {+ type: "object",+ properties: {+ path: {+ type: "string",+ description: "Path to a UTF-8 source file to lint (JS/TS/Python-like)",+ },+ },+ required: ["path"],+ additionalProperties: false,+ },+ },]);@@ -569,12 +625,20 @@ function optionalCount(value: unknown): number | undefined {: undefined;}+function stringListArg(value: unknown): readonly string[] | undefined {+ if (!Array.isArray(value)) return undefined;+ const list = value.filter((x): x is string => typeof x === "string" && x.length > 0);+ return list.length > 0 ? list : undefined;+}+function runDefend(handlers: McpEngineHandlers, args: Record<string, unknown>): unknown {+ const wasmPreserveExports = stringListArg(args.wasm_preserve_exports);return handlers.defendTarget({inputPath: args.input_path as string,...(typeof args.output_path === "string"? { outputPath: args.output_path }: {}),+ ...(args.in_place === true ? { inPlace: true } : {}),intensity:typeof args.intensity === "string"? (args.intensity as ProtectionIntensity)@@ -583,20 +647,17 @@ function runDefend(handlers: McpEngineHandlers, args: Record<string, unknown>):llmDirectives: Boolean(args.llm_directives),weaveDecoys: Boolean(args.weave_decoys),selfSeal: Boolean(args.self_seal),- ...(Array.isArray(args.wasm_preserve_exports)- ? {- wasmPreserveExports: (args.wasm_preserve_exports as unknown[])- .filter((x): x is string => typeof x === "string" && x.length > 0),- }- : {}),+ ...(wasmPreserveExports !== undefined ? { wasmPreserveExports } : {}),...(typeof args.seed === "string" ? { seed: args.seed } : {}),});}function runProtect(handlers: McpEngineHandlers, args: Record<string, unknown>): unknown {+ const wasmPreserveExports = stringListArg(args.wasm_preserve_exports);return handlers.protectTarget({inputPath: args.input_path as string,...(typeof args.output_path === "string" ? { outputPath: args.output_path } : {}),+ ...(args.in_place === true ? { inPlace: true } : {}),...(typeof args.intensity === "string"? { intensity: args.intensity as ProtectionIntensity }: {}),@@ -604,15 +665,36 @@ function runProtect(handlers: McpEngineHandlers, args: Record<string, unknown>):llmDirectives: Boolean(args.llm_directives),weaveDecoys: Boolean(args.weave_decoys),selfSeal: Boolean(args.self_seal),- ...(Array.isArray(args.wasm_preserve_exports)- ? {- wasmPreserveExports: (args.wasm_preserve_exports as unknown[])- .filter((x): x is string => typeof x === "string" && x.length > 0),- }+ ...(typeof args.honey_source_maps === "boolean"+ ? { honeySourceMaps: args.honey_source_maps }: {}),+ ...(wasmPreserveExports !== undefined ? { wasmPreserveExports } : {}),});}+function verifyHonestyOptions(args: Record<string, unknown>): VerifyTargetOptions {+ return {+ ...(typeof args.self_seal_enabled === "boolean"+ ? { selfSealEnabled: args.self_seal_enabled }+ : {}),+ ...(typeof args.wasm_export_rename_applied === "boolean"+ ? { wasmExportRenameApplied: args.wasm_export_rename_applied }+ : {}),+ ...(typeof args.numeric_template_leak_known === "boolean"+ ? { numericTemplateLeakKnown: args.numeric_template_leak_known }+ : {}),+ };+}++function runLintLanes(args: Record<string, unknown>): LaneIndependenceReport {+ const abs = resolvePath(args.path as string);+ if (!existsSync(abs)) {+ throw new Error(`lint-lanes target not found: ${abs}`);+ }+ const source = readFileSync(abs, "utf8");+ return lintLaneIndependence(source);+}+export function validateMcpToolCall(params: unknown,):@@ -1028,6 +1110,11 @@ export async function handleMcpRequest(: process.cwd();const maxArtifacts = optionalCount(args.max_artifacts);const dryRun = args.dry_run === true;+ const outputDirectory =+ typeof args.output_directory === "string" &&+ args.output_directory.trim().length > 0+ ? (args.output_directory as string)+ : undefined;let preOverwrite: readonly string[] = [];if (!dryRun && existsSync(hardenDir)) {// Zero-write preview with the real engine to find clobbered outputs.@@ -1035,16 +1122,19 @@ export async function handleMcpRequest(directory: hardenDir,dryRun: true,...(maxArtifacts !== undefined ? { maxArtifacts } : {}),+ ...(outputDirectory !== undefined ? { outputDirectory } : {}),}).wouldOverwrite;}if (!dryRun && preOverwrite.length > 0 && !confirmed) {refused = true;payload = confirmationRequiredPayload(name, preOverwrite);} else {+ const wasmPreserveExports = stringListArg(args.wasm_preserve_exports);payload = handlers.hardenProject({directory: hardenDir,dryRun,...(maxArtifacts !== undefined ? { maxArtifacts } : {}),+ ...(outputDirectory !== undefined ? { outputDirectory } : {}),intensity:typeof args.intensity === "string"? (args.intensity as ProtectionIntensity)@@ -1053,19 +1143,16 @@ export async function handleMcpRequest(llmDirectives: Boolean(args.llm_directives),weaveDecoys: Boolean(args.weave_decoys),selfSeal: Boolean(args.self_seal),- ...(Array.isArray(args.wasm_preserve_exports)- ? {- wasmPreserveExports: (args.wasm_preserve_exports as unknown[])- .filter((x): x is string => typeof x === "string" && x.length > 0),- }- : {}),+ ...(wasmPreserveExports !== undefined ? { wasmPreserveExports } : {}),...(typeof args.seed === "string" ? { seed: args.seed } : {}),});}} else if (name === "bla_defend" || name === "bla_protect") {+ const inPlace = args.in_place === true;const out = resolveProtectOutputPath(args.input_path as string,typeof args.output_path === "string" ? args.output_path : undefined,+ inPlace,);const planned =name === "bla_defend" && args.emit_manifest === true@@ -1094,6 +1181,7 @@ export async function handleMcpRequest(payload = handlers.verifyTarget(args.target_path as string,typeof args.original_path === "string" ? args.original_path : undefined,+ verifyHonestyOptions(args),);} else if (name === "bla_benchmark") {payload = await handlers.runShowcaseBenchmark();@@ -1123,6 +1211,8 @@ export async function handleMcpRequest(? { maxTargets: args.max_targets }: {}),});+ } else if (name === "bla_lint_lanes") {+ payload = runLintLanes(args);}return {diff --git a/tests/cli-mcp-setup.test.ts b/tests/cli-mcp-setup.test.tsindex 6f0bea2..bfa2f9f 100644--- a/tests/cli-mcp-setup.test.ts+++ b/tests/cli-mcp-setup.test.ts@@ -4,7 +4,7 @@ import * as os from "node:os";import * as path from "node:path";import { runSetup, runUninstall } from "../src/setup/setup.js";import { runDoctor } from "../src/setup/doctor.js";-import { handleMcpRequest } from "../src/mcp/server.js";+import { BLA_MCP_TOOLS, handleMcpRequest } from "../src/mcp/server.js";import { runShowcaseBenchmark } from "../src/engine/benchmark.js";import { isNodeSqliteAvailable } from "../src/core/sqlite-runtime.js";@@ -76,20 +76,8 @@ describe("CLI Setup, Doctor, Benchmark & MCP Server", () => {method: "tools/list",});const tools = (listRes?.result as { tools: Array<{ name: string }> }).tools;- expect(tools.map((t) => t.name)).toEqual([- "bla_harden",- "bla_discover",- "bla_defend",- "bla_audit",- "bla_protect",- "bla_verify",- "bla_benchmark",- "bla_emit_headers",- "bla_doctor",- "bla_inspect_release",- "bla_init",- "bla_weave_plan",- ]);+ expect(tools.map((t) => t.name)).toEqual(BLA_MCP_TOOLS.map((t) => t.name));+ expect(tools.map((t) => t.name)).toContain("bla_lint_lanes");// Test bla_audit + bla_protect + bla_verify via MCP tool callsconst sampleFile = path.join(tmpDir, "sample.js");diff --git a/tests/mcp-engine-capability-parity.test.ts b/tests/mcp-engine-capability-parity.test.tsnew file mode 100644index 0000000..8fee3cd--- /dev/null+++ b/tests/mcp-engine-capability-parity.test.ts@@ -0,0 +1,100 @@+import { describe, expect, it } from "vitest";+import { BLA_MCP_TOOLS } from "../src/mcp/server.js";++/**+ * Maintainable expectation list: engine capabilities agents rely on that MCP+ * must expose. Add a row when a new engine knob is intentionally hung on MCP;+ * do not assert raw schema prose β only tool name + param keys.+ *+ * This is NOT "full CLI mirror"; only the agreed agent-facing surface.+ */+const EXPECTED_MCP_ENGINE_CAPABILITIES: ReadonlyArray<{+ readonly tool: string;+ readonly params: readonly string[];+}> = Object.freeze([+ {+ tool: "bla_harden",+ params: [+ "directory",+ "intensity",+ "emit_manifest",+ "llm_directives",+ "weave_decoys",+ "self_seal",+ "wasm_preserve_exports",+ "seed",+ "dry_run",+ "max_artifacts",+ "confirm_overwrite",+ "output_directory",+ ],+ },+ {+ tool: "bla_discover",+ params: ["directory", "max_artifacts"],+ },+ {+ tool: "bla_defend",+ params: [+ "input_path",+ "output_path",+ "intensity",+ "emit_manifest",+ "llm_directives",+ "weave_decoys",+ "self_seal",+ "wasm_preserve_exports",+ "seed",+ "in_place",+ "confirm_overwrite",+ ],+ },+ {+ tool: "bla_protect",+ params: [+ "input_path",+ "output_path",+ "intensity",+ "weave_decoys",+ "self_seal",+ "wasm_preserve_exports",+ "seed",+ "llm_directives",+ "in_place",+ "honey_source_maps",+ "confirm_overwrite",+ ],+ },+ {+ tool: "bla_verify",+ params: [+ "target_path",+ "original_path",+ "self_seal_enabled",+ "wasm_export_rename_applied",+ "numeric_template_leak_known",+ ],+ },+ {+ tool: "bla_lint_lanes",+ params: ["path"],+ },+]);++describe("MCP β engine capability parity (agent-facing)", () => {+ it("exposes every agreed engine capability on the named MCP tools", () => {+ for (const expected of EXPECTED_MCP_ENGINE_CAPABILITIES) {+ const tool = BLA_MCP_TOOLS.find((t) => t.name === expected.tool);+ expect(tool, `missing MCP tool ${expected.tool}`).toBeDefined();+ const props = Object.keys(tool!.inputSchema.properties);+ for (const param of expected.params) {+ expect(props, `${expected.tool} missing param ${param}`).toContain(param);+ }+ }+ });++ it("does not register duplicate tool names", () => {+ const names = BLA_MCP_TOOLS.map((t) => t.name);+ expect(new Set(names).size).toBe(names.length);+ });+});diff --git a/tests/mcp-lint-lanes.test.ts b/tests/mcp-lint-lanes.test.tsnew file mode 100644index 0000000..149c7e0--- /dev/null+++ b/tests/mcp-lint-lanes.test.ts@@ -0,0 +1,108 @@+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterEach, describe, expect, it } from "vitest";+import { handleMcpRequest, BLA_MCP_TOOLS } from "../src/mcp/server.js";+import { LANE_INDEPENDENCE_SCHEMA } from "../src/engine/lane-independence-lint.js";++const tempDirs: string[] = [];+afterEach(() => {+ for (const d of tempDirs.splice(0)) rmSync(d, { recursive: true, force: true });+});++async function call(name: string, args: Record<string, unknown>) {+ const res = await handleMcpRequest({+ jsonrpc: "2.0",+ id: 1,+ method: "tools/call",+ params: { name, arguments: args },+ });+ return res;+}++describe("MCP bla_lint_lanes", () => {+ it("is registered once next to the CLI-homologous engine", () => {+ expect(BLA_MCP_TOOLS.filter((t) => t.name === "bla_lint_lanes")).toHaveLength(1);+ const tool = BLA_MCP_TOOLS.find((t) => t.name === "bla_lint_lanes")!;+ expect(tool.inputSchema.required).toEqual(["path"]);+ expect(tool.inputSchema.properties.path?.type).toBe("string");+ });++ it("returns a clean report for whole-key mixing source", async () => {+ const dir = mkdtempSync(join(tmpdir(), "bla-lint-clean-"));+ tempDirs.push(dir);+ const file = join(dir, "gate.js");+ writeFileSync(+ file,+ `+ function activate(key) {+ let a = pack(key.slice(0,5)), b = pack(key.slice(5,10));+ let c = pack(key.slice(10,15)), d = pack(key.slice(15,20));+ for (let r = 0; r < 24; r++) {+ a = (a + b) | 0; b = rotl(b ^ a, 7);+ c = (c + d) | 0; d = rotl(d ^ c, 9);+ a ^= c; b ^= d;+ }+ return hex(a,b,c,d) === catalog.revision;+ }+ `,+ "utf8",+ );+ const res = await call("bla_lint_lanes", { path: file });+ expect(res?.error).toBeUndefined();+ const result = res!.result as {+ isError?: boolean;+ structuredContent: {+ schema: string;+ looksLaneIndependent: boolean;+ findings: readonly unknown[];+ oneLineAdvice: string;+ };+ };+ expect(result.isError).toBeFalsy();+ expect(result.structuredContent.schema).toBe(LANE_INDEPENDENCE_SCHEMA);+ expect(result.structuredContent.looksLaneIndependent).toBe(false);+ expect(result.structuredContent.findings).toHaveLength(0);+ });++ it("returns warn findings for independent per-lane gate shapes", async () => {+ const dir = mkdtempSync(join(tmpdir(), "bla-lint-warn-"));+ tempDirs.push(dir);+ const file = join(dir, "oracle.js");+ writeFileSync(+ file,+ `+ const lanes = [0x41, 0x42, 0x43, 0x44, 0x45];+ function check(key) {+ return key.split("").every((ch, i) => ch.charCodeAt(0) === lanes[i]);+ }+ `,+ "utf8",+ );+ const res = await call("bla_lint_lanes", { path: file });+ expect(res?.error).toBeUndefined();+ const result = res!.result as {+ structuredContent: {+ looksLaneIndependent: boolean;+ findings: ReadonlyArray<{ id: string; severity: string }>;+ oneLineAdvice: string;+ };+ };+ expect(result.structuredContent.looksLaneIndependent).toBe(true);+ expect(result.structuredContent.findings.some((f) => f.id === "per-lane-byte-compare-array")).toBe(+ true,+ );+ expect(result.structuredContent.findings.every((f) => f.severity === "warn")).toBe(true);+ expect(result.structuredContent.oneLineAdvice).toMatch(/whole-key chained mixing/i);+ });++ it("errors when the source file is missing", async () => {+ const res = await call("bla_lint_lanes", {+ path: join(tmpdir(), "bla-missing-lane-gate-does-not-exist.js"),+ });+ expect(res?.error).toBeUndefined();+ const result = res!.result as { isError: boolean; content: ReadonlyArray<{ text: string }> };+ expect(result.isError).toBe(true);+ expect(result.content[0]?.text).toMatch(/not found/i);+ });+});diff --git a/tests/mcp-param-alignment.test.ts b/tests/mcp-param-alignment.test.tsnew file mode 100644index 0000000..496eafd--- /dev/null+++ b/tests/mcp-param-alignment.test.ts@@ -0,0 +1,179 @@+import {+ existsSync,+ mkdirSync,+ mkdtempSync,+ readFileSync,+ rmSync,+ writeFileSync,+} from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterEach, describe, expect, it } from "vitest";+import { handleMcpRequest } from "../src/mcp/server.js";+import { protectTarget } from "../src/engine/protector.js";++const tempDirs: string[] = [];+afterEach(() => {+ for (const d of tempDirs.splice(0)) rmSync(d, { recursive: true, force: true });+});++const JS = `export function unlockPremium(token) { return token === "LIVE-KEY"; }\n`;++async function call(name: string, args: Record<string, unknown>) {+ const res = await handleMcpRequest({+ jsonrpc: "2.0",+ id: 1,+ method: "tools/call",+ params: { name, arguments: args },+ });+ expect(res?.error).toBeUndefined();+ return res!.result as {+ isError: boolean;+ structuredContent: {+ readonly [key: string]: unknown;+ status?: string;+ wouldOverwrite?: readonly string[];+ wrote?: readonly string[];+ writeReceipt?: Readonly<Record<string, unknown>>;+ outputDirectory?: string;+ metrics?: { honeySourceMapsGenerated?: number };+ defenseScore?: number;+ defenseScoreRaw?: number;+ defenseScoreGaps?: ReadonlyArray<{ id: string }>;+ outputPath?: string;+ selfSeal?: boolean;+ };+ };+}++describe("MCP param alignment: in_place / honey_source_maps / output_directory", () => {+ it("bla_protect in_place refuses without confirm_overwrite and succeeds with it", async () => {+ const dir = mkdtempSync(join(tmpdir(), "bla-inplace-"));+ tempDirs.push(dir);+ const input = join(dir, "app.js");+ writeFileSync(input, JS, "utf8");+ const before = readFileSync(input, "utf8");++ const refused = await call("bla_protect", {+ input_path: input,+ in_place: true,+ seed: "inplace-1",+ });+ expect(refused.isError).toBe(true);+ expect(refused.structuredContent.status).toBe("confirmation_required");+ expect(refused.structuredContent.wouldOverwrite).toEqual([input]);+ expect(readFileSync(input, "utf8")).toBe(before);++ const ok = await call("bla_protect", {+ input_path: input,+ in_place: true,+ confirm_overwrite: true,+ seed: "inplace-1",+ });+ expect(ok.isError).toBe(false);+ expect(ok.structuredContent.writeReceipt).toMatchObject({+ status: "written",+ wrote: [input],+ overwrote: [input],+ confirmed: true,+ });+ expect(readFileSync(input, "utf8")).not.toBe(before);+ expect(existsSync(join(dir, "app.shielded.js"))).toBe(false);+ });++ it("bla_defend in_place also requires confirm_overwrite before clobbering the input", async () => {+ const dir = mkdtempSync(join(tmpdir(), "bla-defend-inplace-"));+ tempDirs.push(dir);+ const input = join(dir, "svc.js");+ writeFileSync(input, JS, "utf8");+ const refused = await call("bla_defend", {+ input_path: input,+ in_place: true,+ seed: "d-inplace",+ });+ expect(refused.isError).toBe(true);+ expect(refused.structuredContent.wouldOverwrite).toEqual([input]);+ expect(readFileSync(input, "utf8")).toBe(JS);+ });++ it("bla_protect honey_source_maps:false skips honey map emission", async () => {+ const dir = mkdtempSync(join(tmpdir(), "bla-honey-"));+ tempDirs.push(dir);+ const input = join(dir, "app.js");+ const output = join(dir, "out.js");+ writeFileSync(input, JS, "utf8");+ const off = await call("bla_protect", {+ input_path: input,+ output_path: output,+ honey_source_maps: false,+ seed: "honey-off",+ });+ expect(off.isError).toBe(false);+ expect(off.structuredContent.metrics?.honeySourceMapsGenerated).toBe(0);++ const onOut = join(dir, "out-on.js");+ const on = await call("bla_protect", {+ input_path: input,+ output_path: onOut,+ honey_source_maps: true,+ seed: "honey-on",+ });+ expect(on.isError).toBe(false);+ expect((on.structuredContent.metrics?.honeySourceMapsGenerated ?? 0) > 0).toBe(true);+ });++ it("bla_harden output_directory writes under the custom root", async () => {+ const root = mkdtempSync(join(tmpdir(), "bla-outdir-"));+ tempDirs.push(root);+ mkdirSync(join(root, "dist"), { recursive: true });+ writeFileSync(join(root, "dist", "m0.js"), JS, "utf8");+ const custom = join(root, "custom-out");+ const r = await call("bla_harden", {+ directory: root,+ output_directory: custom,+ seed: "outdir-1",+ });+ expect(r.isError).toBe(false);+ expect(r.structuredContent.outputDirectory).toBe(custom);+ expect(existsSync(join(custom, "dist", "m0.js"))).toBe(true);+ expect(existsSync(join(root, ".bla-hardened"))).toBe(false);+ });+});++describe("MCP bla_verify honesty metadata passthrough", () => {+ it("soft-caps JS verify without self_seal_enabled and lifts the gap when metadata says sealed", async () => {+ const dir = mkdtempSync(join(tmpdir(), "bla-verify-honesty-"));+ tempDirs.push(dir);+ const input = join(dir, "app.js");+ writeFileSync(input, JS, "utf8");+ const protectedRes = protectTarget({+ inputPath: input,+ intensity: "balanced",+ seed: "verify-honesty-1",+ selfSeal: true,+ });+ expect(protectedRes.selfSeal).toBe(true);++ const without = await call("bla_verify", {+ target_path: protectedRes.outputPath,+ original_path: input,+ });+ expect(without.isError).toBe(false);+ expect(+ without.structuredContent.defenseScoreGaps?.some((g) => g.id === "self-seal-not-enabled"),+ ).toBe(true);++ const withMeta = await call("bla_verify", {+ target_path: protectedRes.outputPath,+ original_path: input,+ self_seal_enabled: true,+ });+ expect(withMeta.isError).toBe(false);+ expect(+ withMeta.structuredContent.defenseScoreGaps?.some((g) => g.id === "self-seal-not-enabled"),+ ).toBe(false);+ expect(withMeta.structuredContent.defenseScoreRaw).toBeGreaterThanOrEqual(+ withMeta.structuredContent.defenseScore as number,+ );+ });+});