mirror of
https://github.com/morluto/rea.git
synced 2026-11-17 04:04:25 +00:00
* refactor(contracts): move the CLI command name owner into src/contracts * refactor(contracts): own catalog identity in contracts and server identity in process (#11435) * refactor(contracts): move catalog identity into contracts and server identity into process * refactor(contracts): own the advertised MCP schema presentation in contracts * test(mcp): import the advertised presentation from contracts in toolSchemaValidity * test(release): expect the catalog identity at its contracts path in the canary * test(mcp): import the catalog identity from contracts in syntheticContractSurfaces * refactor(contracts): import CLI command names from contracts in the capability conformance test
34 lines
1.5 KiB
TypeScript
34 lines
1.5 KiB
TypeScript
import type { AnalysisSettingsReader } from "../domain/analysisSettings.js";
|
|
import { WasmArtifactService } from "../application/wasm/WasmArtifactService.js";
|
|
import { WabtArtifactProvider } from "../wasm/WabtArtifactProvider.js";
|
|
import { INSPECT_WASM_ARTIFACT_CONTRACT } from "../contracts/wasm/wasmToolContracts.js";
|
|
import { cliCommandFor } from "../contracts/cliCommandNames.js";
|
|
/** Compose the caller-supplied offline toolchain without acquisition or import-time I/O. */
|
|
export const createWasmArtifactService = (
|
|
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
|
settings?: AnalysisSettingsReader,
|
|
): WasmArtifactService =>
|
|
new WasmArtifactService(new WabtArtifactProvider(environment), settings);
|
|
|
|
/**
|
|
* 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: cliCommandFor("inspect_wasm_artifact"),
|
|
create(
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
injected?: WasmArtifactService,
|
|
settings?: AnalysisSettingsReader,
|
|
): Pick<WasmArtifactService, "inspect" | "close"> {
|
|
const service =
|
|
injected ?? createWasmArtifactService(environment, settings);
|
|
return {
|
|
inspect: service.inspect.bind(service),
|
|
close: service.close.bind(service),
|
|
};
|
|
},
|
|
} as const;
|