feat(wasm): inspect local artifacts with WABT (#1533)

* feat(wasm): inspect local artifacts with WABT

* fix(wasm): preserve custom names and failed cleanup ownership

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Thang Luu
2026-10-11 19:49:00 +08:00
committed by GitHub
co-authored by morluto
parent e4407dbed5
commit ffaf2c12f1
46 changed files with 2309 additions and 7 deletions
+29
View File
@@ -0,0 +1,29 @@
import {
inspectWasmArtifactInputSchema,
wasmArtifactSchema,
} from "../../domain/wasm/wasmArtifact.js";
import type { ToolContract } from "../toolContractTypes.js";
import { toolContractMetadata } from "../toolEffects.js";
import { evidenceResultOf } from "../toolOutputSchemaPrimitives.js";
/** Optional caller-supplied WABT capability with target-free CLI/MCP parity. */
export const WASM_TOOL_CONTRACTS = [
{
name: "inspect_wasm_artifact",
...toolContractMetadata("inspect_wasm_artifact"),
kind: "artifact-provider",
description:
"Validate an explicit local WASM artifact with caller-supplied WABT 1.0.42, retain exact byte SHA-256, sections, upstream import/export WAT forms and decoded WAT inline as Evidence. Optionally associate selected JavaScript glue literals with explicit local candidates while preserving ambiguous URL/basename matches. Configure absolute REA_WABT_BIN_DIRECTORY. No installation, implicit fetch, WASM execution or original-source claim.",
inputSchema: inspectWasmArtifactInputSchema,
outputSchema: evidenceResultOf(wasmArtifactSchema),
examples: [
{
title: "Inspect a selected local WASM module",
input: {
path: "/artifacts/module.wasm",
glue_paths: [],
candidate_paths: [],
},
},
],
},
] as const satisfies readonly ToolContract[];