mirror of
https://github.com/morluto/rea
synced 2026-10-26 14:25:49 -04:00
b955b825fc
Keep failed stable-read handles and WABT runtime roots under retryable resource scopes. Preserve cancellation causes and primary errors, close the same service instances bound to MCP tools, and consolidate CLI operation/cleanup projection. Validation: fast typecheck and lint, cached runtime build, docs checks, SDK schema validation, focused service and real-file cleanup tests, CLI cleanup regressions, and MCP lifecycle/shutdown workflows. Provider process fixtures simulate engine output; real WABT and Linux EVM execution are not established by this pass.
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
import type { JsonValue } from "../domain/jsonValue.js";
|
|
import type { Result } from "../domain/result.js";
|
|
import type {
|
|
WebModuleFile,
|
|
WebModuleResolution,
|
|
WebModuleTraceInput,
|
|
} from "../domain/webModuleTrace.js";
|
|
import type { SelectedWebScriptArtifacts } from "../domain/webScriptArtifacts.js";
|
|
import type { ExecutionOptions } from "./AnalysisProvider.js";
|
|
|
|
type JsonObject = Record<string, JsonValue>;
|
|
|
|
/** Verified selected source and capture metadata; provider protocols stay outside. */
|
|
export interface WebModuleArtifacts extends SelectedWebScriptArtifacts {
|
|
readonly importMap: {
|
|
readonly file: WebModuleFile;
|
|
readonly baseUrl: string;
|
|
readonly value: JsonObject;
|
|
} | null;
|
|
}
|
|
|
|
/** Read selected local artifacts without refetching website assets. */
|
|
export interface WebModuleArtifactPort {
|
|
close?(): Promise<void>;
|
|
load(
|
|
input: WebModuleTraceInput,
|
|
options?: ExecutionOptions,
|
|
): Promise<Result<WebModuleArtifacts, AnalysisError>>;
|
|
}
|
|
|
|
/** Resolve literal specifiers in a selected URL/map context without executing the selected application. */
|
|
export interface WebModuleResolutionBatch {
|
|
readonly engine: { readonly id: string; readonly version: string };
|
|
readonly resolutions: readonly WebModuleResolution[];
|
|
readonly diagnostics: readonly string[];
|
|
readonly rawResult: JsonObject;
|
|
}
|
|
|
|
/** Replaceable native resolution engine, with no provider protocol in callers. */
|
|
export interface WebModuleResolutionPort {
|
|
close?(): Promise<void>;
|
|
resolve(
|
|
input: {
|
|
readonly importerUrl: string;
|
|
readonly importMap: {
|
|
readonly baseUrl: string;
|
|
readonly value: JsonObject;
|
|
} | null;
|
|
readonly specifiers: readonly string[];
|
|
},
|
|
options?: ExecutionOptions,
|
|
): Promise<Result<WebModuleResolutionBatch, AnalysisError>>;
|
|
}
|