Files
reverse-engineering-anything/src/composition/wasm.ts
T
Ysopwnableandfactory-droid[bot] 58fb372071 feat(analysis): add opt-in retained inventory and WASM views (#2122)
Add opt-in retained inventory and WASM Evidence views with exact nested output contracts and a small static WASM descriptor. Preserve old complete CLI/MCP workflows, producer choices, original authenticated Evidence and cleanup ownership.

Validated with real public applications, genuine old Evidence migration, 123 focused assertions, 11 synchronized description checks and 42 installed-package WABT cases. Detailed generated experiment JSON stays outside the final tree; concise findings and reproduction inputs remain. Main-existing completion/package CI failures are separately attributed and left unchanged.

Refs #2016

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-12 21:17:52 +08:00

30 lines
1.3 KiB
TypeScript

import { WasmArtifactService } from "../application/wasm/WasmArtifactService.js";
import { WabtArtifactProvider } from "../wasm/WabtArtifactProvider.js";
import { INSPECT_WASM_ARTIFACT_CONTRACT } from "../contracts/wasm/wasmToolContracts.js";
import { CLI_COMMANDS } from "../cliCommandNames.js";
/** Compose the caller-supplied offline toolchain without acquisition or import-time I/O. */
export const createWasmArtifactService = (
environment: Readonly<NodeJS.ProcessEnv> = process.env,
): WasmArtifactService =>
new WasmArtifactService(new WabtArtifactProvider(environment));
/**
* Internal static descriptor for one named domain operation and its lifetime.
* CLI/MCP share this binding; the service keeps failed resource ownership so
* close can be retried. Construction performs no acquisition or target I/O.
*/
export const wasmArtifactModule = {
contract: INSPECT_WASM_ARTIFACT_CONTRACT,
cliCommand: CLI_COMMANDS.inspectWasmArtifact,
create(
environment: Readonly<NodeJS.ProcessEnv>,
injected?: WasmArtifactService,
): Pick<WasmArtifactService, "inspect" | "close"> {
const service = injected ?? createWasmArtifactService(environment);
return {
inspect: service.inspect.bind(service),
close: service.close.bind(service),
};
},
} as const;