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 = 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, injected?: WasmArtifactService, ): Pick { const service = injected ?? createWasmArtifactService(environment); return { inspect: service.inspect.bind(service), close: service.close.bind(service), }; }, } as const;