chore: merge main (d8a9673f) into environment state writes

The analysis-view contract description conflicted only where this branch adds its write-plan sentence; main's GPU code-object entry is kept alongside.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Edgar ArakelyanandClaude Opus 5.5 committed 2026-10-21 09:00:08 -07:00
commit bec65b3ede
284 files changed
+19614 -1419

No files matched your search

+25
View File
@@ -63,6 +63,31 @@ function classifyPackage(base, head) {
const after = JSON.parse(git("show", `${head}:package.json`));
const { scripts: beforeScripts, ...beforeRest } = before;
const { scripts: afterScripts, ...afterRest } = after;
const compilerDependencies = (metadata) => ({
dependencies: {
typescript: metadata.dependencies?.typescript,
tsrs: metadata.dependencies?.tsrs,
},
devDependencies: {
typescript: metadata.devDependencies?.typescript,
tsrs: metadata.devDependencies?.tsrs,
},
});
const compilerScripts = [
"compile",
"typecheck",
"build",
"build:cached",
"test:prepare",
"docs:prepare",
"verify:frida:bindings",
].flatMap((name) => [name, `pre${name}`, `post${name}`]);
selected.package ||=
JSON.stringify(compilerDependencies(before)) !==
JSON.stringify(compilerDependencies(after)) ||
compilerScripts.some(
(name) => beforeScripts?.[name] !== afterScripts?.[name],
);
if (JSON.stringify(beforeRest) !== JSON.stringify(afterRest)) {
full("Package metadata or dependencies changed");
return;
+12
View File
@@ -92,6 +92,17 @@ export const SCOPES = {
],
// Four-host installed-package matrix and the Windows curated lane.
package: [
// Both host compilers must be exercised when their installation, options,
// or entrypoints change; Linux's accelerated checker cannot stand in for Go.
"scripts/run-typescript.*",
"scripts/run-turbo.mjs",
"turbo.json",
"tsconfig.json",
"tsconfig.build.json",
"tsconfig.frida-verification.json",
"package-lock.json",
".nvmrc",
".npmrc",
".github/actions/publish-mcp/**",
".github/actions/prepare-release-package/**",
".github/workflows/release-recovery.yml",
@@ -135,6 +146,7 @@ export const SCOPES = {
"src/application/DshCordis*.ts",
"src/cli/interactiveSetup.ts",
"src/cli/setupCommands.ts",
"tests/boundary/filesystem/typescriptCompiler.test.ts",
"tests/boundary/filesystem/binaryTarget.test.ts",
"tests/boundary/filesystem/safeOutputTree.test.ts",
"tests/boundary/providers/native/artifactProvider.archiveSafety.test.ts",
+75 -4
View File
@@ -4,6 +4,67 @@ import { promisify } from "node:util";
import { fileURLToPath } from "node:url";
import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { closeVerifierResources } from "./verifier-cleanup.mjs";
// REA registers process-static tool contracts. Bind their parsed definitions to
// the SDK's negotiated connection identity, including when a Client reconnects.
const toolBindings = new WeakMap();
const advertisedTool = async (client, name) => {
const connection = client.getServerVersion();
assert.ok(connection, "MCP must be initialized before binding tool schemas");
let binding = toolBindings.get(client);
if (binding?.connection !== connection) {
binding = {
connection,
definitions: client.listTools().then(({ tools }) => {
const definitions = new Map();
for (const tool of tools) {
assert.ok(
!definitions.has(tool.name),
`Duplicate MCP tool: ${tool.name}`,
);
definitions.set(tool.name, tool);
}
return definitions;
}),
};
toolBindings.set(client, binding);
}
let definitions;
try {
definitions = await binding.definitions;
assert.equal(
client.getServerVersion(),
connection,
"MCP connection changed while binding tool schemas",
);
} catch (cause) {
if (toolBindings.get(client) === binding) toolBindings.delete(client);
throw cause;
}
const tool = definitions.get(name);
assert.ok(tool, `MCP catalog did not advertise ${name}`);
return tool;
};
/** Call an advertised tool with SDK output validation of its actual schema. */
export async function artifactMcpCall(client, parameters, options = {}) {
options.signal?.throwIfAborted();
assert.equal(
options.toolDefinition,
undefined,
"Artifact verification owns the advertised schema; pass request options only",
);
const toolDefinition = await advertisedTool(client, parameters.name);
assert.notEqual(
toolDefinition.outputSchema,
undefined,
`MCP tool omitted its output schema: ${parameters.name}`,
);
options.signal?.throwIfAborted();
return client.callTool(parameters, { ...options, toolDefinition });
}
const environment = () => {
const compileCache =
@@ -66,9 +127,10 @@ const withOpenedArtifactMcp = async (target, openTool, verify) => {
stderr: "pipe",
});
const client = new Client({ name: "artifact-real-e2e", version: "1" });
let failure;
try {
await client.connect(transport);
const opened = await client.callTool({
const opened = await artifactMcpCall(client, {
name: openTool,
arguments: { path: target },
});
@@ -76,9 +138,15 @@ const withOpenedArtifactMcp = async (target, openTool, verify) => {
if (openTool === "open_bundle_resources")
assert.equal(opened.structuredContent?.result?.caller_path, target);
await verify(client);
} catch (cause) {
failure = cause;
throw cause;
} finally {
await client.close();
await transport.close();
toolBindings.delete(client);
await closeVerifierResources(
[() => client.close(), () => transport.close()],
failure,
);
}
};
@@ -94,7 +162,10 @@ export async function withBundleResourcesMcp(target, verify) {
/** Require a successful structured MCP tool result rather than its text rendering. */
export async function artifactMcpResult(client, name, arguments_ = {}) {
const result = await client.callTool({ name, arguments: arguments_ });
const result = await artifactMcpCall(client, {
name,
arguments: arguments_,
});
assert.notEqual(result.isError, true, JSON.stringify(result));
assert.ok(
result.structuredContent?.normalized_result,
+5
View File
@@ -34,6 +34,7 @@ export const toolFamilyCatalog = (sources) => {
...sources.desktopContracts.DESKTOP_APPLICATION_TOOL_CONTRACTS,
...sources.evmContracts.EVM_TOOL_CONTRACTS,
...sources.goContracts.GO_TOOL_CONTRACTS,
...sources.gpuContracts.GPU_TOOL_CONTRACTS,
...sources.il2cppContracts.IL2CPP_TOOL_CONTRACTS,
...sources.modelContracts.MODEL_TOOL_CONTRACTS,
...sources.rustContracts.RUST_TOOL_CONTRACTS,
@@ -268,6 +269,10 @@ export const providerCatalog = (sources) => {
identity: sources.goProvider.GO_BINARY_PROVIDER_IDENTITY,
contracts: sources.goContracts.GO_TOOL_CONTRACTS,
},
{
identity: sources.gpuProvider.GPU_CODE_OBJECTS_PROVIDER_IDENTITY,
contracts: sources.gpuContracts.GPU_TOOL_CONTRACTS,
},
{
identity: sources.il2cppProvider.IL2CPP_METADATA_PROVIDER_IDENTITY,
contracts: sources.il2cppContracts.IL2CPP_TOOL_CONTRACTS,
+2
View File
@@ -69,6 +69,8 @@ const SOURCE_PATHS = {
evmProvider: "dist/evm/EvmoleRelease.js",
goContracts: "dist/contracts/go/goToolContracts.js",
goProvider: "dist/go/GoBinaryProvider.js",
gpuContracts: "dist/contracts/gpu/gpuToolContracts.js",
gpuProvider: "dist/gpu/GpuCodeObjectsProvider.js",
modelContracts: "dist/contracts/model/modelToolContracts.js",
modelProvider: "dist/model/ModelArtifactProvider.js",
il2cppContracts: "dist/contracts/il2cpp/il2cppToolContracts.js",
+1
View File
@@ -10,6 +10,7 @@ const MIGRATED_PROVIDER_ROOTS = new Set([
"go",
"il2cpp",
"model",
"gpu",
"rust",
"wasm",
"captures",
+1 -1
View File
@@ -17,7 +17,7 @@ export const SOURCE_TEST_PROJECTS = [
group: "source",
include: [
"src/*.test.ts",
"src/{apktool,jeb,adb,artifacts,browser,dotnet,electron,evm,firmware,flutter,pcap,ghidra,go,hopper,ida,inspector,javascript,native,process,reference,rust,server,sqlite,wasm,windows}/**/*.test.ts",
"src/{apktool,jeb,adb,artifacts,browser,dotnet,electron,evm,firmware,flutter,pcap,ghidra,go,gpu,hopper,ida,inspector,javascript,native,process,reference,rust,server,sqlite,wasm,windows}/**/*.test.ts",
],
},
{
+94 -39
View File
@@ -80,7 +80,7 @@ if (!(await compiledRuntimeExists(runtimeFiles))) {
writeStdout(result.output);
process.exitCode = result.exitCode;
} else {
const { cliConfigurationError, createCli } =
const { cliConfigurationError, closeCliJavaScriptResources, createCli } =
await import("../dist/cli-runtime/cli.js");
const { createCliResultOutput } =
await import("../dist/cli-runtime/cliResultOutput.js");
@@ -94,47 +94,97 @@ if (!(await compiledRuntimeExists(runtimeFiles))) {
const cliArgs = normalizeCliArguments(args);
const outputArguments = validateCliOutputArguments(cliArgs);
const configurationError = cliConfigurationError(process.env);
// Doctor is the readiness report for this failure. Other commands still stop
// here so they do not run with an unusable log level.
if (configurationError !== undefined && !isDoctorCommand(cliArgs)) {
process.stderr.write(`${configurationError}\n`);
process.exitCode = 1;
} else if (!outputArguments.ok) {
writeStdout(renderCliOutputArgumentError(outputArguments));
process.exitCode = 1;
} else {
let wroteOutput = false;
const resultOutput = createCliResultOutput(cliArgs, process.stdout);
try {
await createCli(process.env, resultOutput).serve(cliArgs, {
stdout: (output) => {
if (resultOutput?.handled) {
if (resultOutput.failed && !stdoutClosed)
process.stderr.write(output);
return;
}
if (output.length > 0) wroteOutput = true;
writeStdout(output);
},
// A command failure caused by the closed pipe keeps the pipe's status.
exit: (code) => process.exit(stdoutClosed ? SIGPIPE_EXIT_STATUS : code),
});
} catch (cause) {
if (wroteOutput) throw cause;
const recovered = await resultOutput
?.recoverFormattingFailure(cause)
.catch((writeFailure) => {
// Recovery writes outside Incur's command boundary. A reader that
// declined this document keeps the same quiet SIGPIPE outcome.
if (!stdoutClosed) throw writeFailure;
return true;
let dispatchFailure;
// Incur can exit from the callback below before this function returns.
// That callback owns the status, including a closed-pipe exit of 141.
let exiting = false;
try {
// Doctor is the readiness report for this failure. Other commands still stop
// here so they do not run with an unusable log level.
if (configurationError !== undefined && !isDoctorCommand(cliArgs)) {
process.stderr.write(`${configurationError}\n`);
process.exitCode = 1;
} else if (!outputArguments.ok) {
writeStdout(renderCliOutputArgumentError(outputArguments));
process.exitCode = 1;
} else {
let wroteOutput = false;
const resultOutput = createCliResultOutput(cliArgs, process.stdout);
try {
await createCli(process.env, resultOutput).serve(cliArgs, {
stdout: (output) => {
if (resultOutput?.handled) {
if (resultOutput.failed && !stdoutClosed)
process.stderr.write(output);
return;
}
if (output.length > 0) wroteOutput = true;
writeStdout(output);
},
// A command failure caused by the closed pipe keeps the pipe's status.
// Worker shutdown is shared with the dispatch finally below. A failed
// shutdown is reported here because this callback is what exits.
exit: (code) => {
exiting = true;
const status = stdoutClosed ? SIGPIPE_EXIT_STATUS : code;
void Promise.resolve()
.then(() => closeCliJavaScriptResources())
.then(
() => {
process.exit(status);
},
(cleanup) => {
process.stderr.write(
`Failed to close the JavaScript analysis worker: ${cleanupFailureText(cleanup)}\n`,
);
process.exit(
stdoutClosed
? SIGPIPE_EXIT_STATUS
: status === 0
? 1
: status,
);
},
);
},
});
if (!recovered) throw cause;
process.exitCode = stdoutClosed ? SIGPIPE_EXIT_STATUS : 1;
} catch (cause) {
if (wroteOutput) throw cause;
const recovered = await resultOutput
?.recoverFormattingFailure(cause)
.catch((writeFailure) => {
// Recovery writes outside Incur's command boundary. A reader that
// declined this document keeps the same quiet SIGPIPE outcome.
if (!stdoutClosed) throw writeFailure;
return true;
});
if (!recovered) throw cause;
process.exitCode = stdoutClosed ? SIGPIPE_EXIT_STATUS : 1;
}
if (!wroteOutput && !resultOutput?.handled)
writeStdout(renderEmptyFilteredCliOutput(cliArgs) ?? "");
}
} catch (cause) {
dispatchFailure = cause;
} finally {
// Serve and output rendering can throw after a worker is parked. Stop it
// on that path too, and keep the dispatch failure when both fail.
try {
await closeCliJavaScriptResources();
} catch (cleanup) {
// The exit callback reports this same shared failure and then exits.
if (!exiting) {
dispatchFailure =
dispatchFailure === undefined
? cleanup
: new AggregateError(
[dispatchFailure, cleanup],
"CLI dispatch failed and the JavaScript analysis worker remained owned",
);
}
}
if (!wroteOutput && !resultOutput?.handled)
writeStdout(renderEmptyFilteredCliOutput(cliArgs) ?? "");
}
if (!exiting && dispatchFailure !== undefined) throw dispatchFailure;
}
/** True when the first positional command is `doctor`, after global output flags. */
@@ -164,6 +214,11 @@ function isDoctorCommand(arguments_) {
* with the status a SIGPIPE-terminated writer reports. MCP stdio keeps its own
* client lifecycle.
*/
function cleanupFailureText(cleanup) {
if (cleanup instanceof Error) return cleanup.stack ?? cleanup.message;
return String(cleanup);
}
function guardClosedStdout() {
process.stdout.on("error", (cause) => {
if (cause?.code === "EPIPE") {
+1 -1
View File
@@ -59,7 +59,7 @@ try {
"scripts/run-exclusive.mjs",
"artifacts",
process.execPath,
resolve("node_modules/turbo/bin/turbo"),
resolve("scripts/run-turbo.mjs"),
"run",
...(plan.needsBuild ? ["artifacts:skills"] : []),
...plan.artifactTasks,
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env node
import { createRequire } from "node:module";
import { pathToFileURL } from "node:url";
import { resolveTypeScriptCompiler } from "./run-typescript.mjs";
// Compute the actual host compiler before Turbo hashes or restores its tasks.
process.env.REA_TYPESCRIPT_COMPILER = resolveTypeScriptCompiler().identity;
const require = createRequire(import.meta.url);
await import(pathToFileURL(require.resolve("turbo/bin/turbo")).href);
+11
View File
@@ -0,0 +1,11 @@
export function selectTypeScriptCompiler(
platform: string,
arch: string,
optionalDependencies: Readonly<Record<string, string>>,
): "tsrs" | "typescript";
export function resolveTypeScriptCompiler(): {
readonly name: "tsrs" | "typescript";
readonly identity: string;
readonly launcher: string;
};
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env node
import { readFileSync } from "node:fs";
import { createRequire } from "node:module";
import { availableParallelism } from "node:os";
import { dirname, resolve } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
/** Use the pinned package's platform inventory; let its launcher select libc. */
export const selectTypeScriptCompiler = (
platform,
arch,
optionalDependencies,
) => {
if (platform === "win32") return "typescript";
const prefix = `@tsrs/${platform}-${arch}`;
return Object.keys(optionalDependencies).some(
(name) => name === prefix || name.startsWith(`${prefix}-`),
)
? "tsrs"
: "typescript";
};
export const resolveTypeScriptCompiler = () => {
const require = createRequire(import.meta.url);
const rustPackagePath = require.resolve("tsrs/package.json");
const rustPackage = JSON.parse(readFileSync(rustPackagePath, "utf8"));
const compiler = selectTypeScriptCompiler(
process.platform,
process.arch,
rustPackage.optionalDependencies,
);
const packagePath =
compiler === "tsrs"
? rustPackagePath
: require.resolve("typescript/package.json");
const metadata =
compiler === "tsrs"
? rustPackage
: JSON.parse(readFileSync(packagePath, "utf8"));
const command = compiler === "tsrs" ? "tsrs" : "tsc";
return {
name: compiler,
identity: `${compiler}@${metadata.version}`,
launcher: resolve(dirname(packagePath), metadata.bin[command]),
};
};
const main = async () => {
const compiler = resolveTypeScriptCompiler();
if (
process.env.TURBO_HASH !== undefined &&
process.env.REA_TYPESCRIPT_COMPILER !== compiler.identity
)
throw new Error(
"Compiler identity is missing or stale. Run Turbo through scripts/run-turbo.mjs.",
);
if (compiler.name === "tsrs") {
const args = process.argv.slice(2);
// Rust consumes --maxMemory once; duplicating it becomes an unknown option.
// Preserve explicit resource choices rather than injecting another value.
const defaults = [
["--checkers", String(Math.min(2, availableParallelism()))],
["--maxMemory", "3G"],
].flatMap(([option, value]) =>
args.includes(option) ? [] : [option, value],
);
process.argv.splice(2, 0, ...defaults);
}
// Delegate execution, diagnostics, status and signals to the package's launcher.
// An unavailable binary on a supported host must fail rather than hide drift.
await import(pathToFileURL(compiler.launcher).href);
};
if (process.argv[1] === fileURLToPath(import.meta.url)) await main();
+3 -1
View File
@@ -10,6 +10,7 @@ import { promisify } from "node:util";
import {
artifactCli,
artifactMcpResult,
artifactMcpCall,
withArtifactMcp,
} from "./lib/artifact-e2e.mjs";
@@ -225,7 +226,8 @@ const checkHardenedRuntime = async (directory, binary) => {
assert.equal(denied.code, "capability_unavailable");
assert.match(denied.details.reason, /^debugger-attach-denied: /u);
await withArtifactMcp(blocked, async (client) => {
const deniedMcp = await client.callTool(
const deniedMcp = await artifactMcpCall(
client,
{
name: "observe_native_calls",
arguments: INPUT,
+6
View File
@@ -555,6 +555,12 @@ async function verifyPageScopedTransport(provider, proxy, origin) {
throw new Error(
"Page-scoped CDP disconnect must report transport loss without claiming a target crash",
);
const remaining = await provider.listTargets(
listBrowserTargetsInputSchema.parse({ cdp_endpoint: proxy.endpoint }),
);
if (!remaining.ok) throw remaining.error;
if (!remaining.value.targets.some(({ target_id }) => target_id === target))
throw new Error("Page-scoped CDP disconnect removed its live target");
}
async function browserExecutable() {
+20 -5
View File
@@ -39,6 +39,19 @@ const environment = {
TEMP: root.path,
};
const client = new Client({ name: "signal-recording-verifier", version: "1" });
// Real sigrok refusals of an unknown decoder ID must name the caller's field.
const assertRejectedSelector = (response, operation, field) => {
assert.equal(response.isError, true);
const text = response.content.find((item) => item.type === "text")?.text;
const { error } = JSON.parse(text ?? "{}");
assert.equal(error.code, "invalid_request");
assert.equal(error.details.operation, operation);
assert.deepEqual(
error.details.issues.map((issue) => issue.path),
[[field]],
);
assert.equal(error.details.captured_output.exit_code, 1);
};
const transport = new StdioClientTransport({
command: process.execPath,
args: [entrypoint, "mcp"],
@@ -244,16 +257,18 @@ try {
assert.equal(await readFile(pagedPath, "utf8"), pagedSource);
cases++;
}
for (const input of [
{ path, decoders: "no_such_decoder" },
{ path: join(root.path, "absent.vcd"), decoders: "uart" },
{ path, decoders: "uart", driver: "demo" },
for (const [input, rejectedField] of [
[{ path, decoders: "no_such_decoder" }, "decoders"],
[{ path: join(root.path, "absent.vcd"), decoders: "uart" }],
[{ path, decoders: "uart", driver: "demo" }],
]) {
const response = await client.callTool({
name: advertised.name,
arguments: input,
});
assert.equal(response.isError, true);
if (rejectedField !== undefined)
assertRejectedSelector(response, advertised.name, rejectedField);
await client.ping();
cases++;
}
@@ -378,7 +393,7 @@ try {
name: discoveryTool.name,
arguments: { decoder: "rea_no_such_decoder" },
});
assert.equal(unavailable.isError, true);
assertRejectedSelector(unavailable, discoveryTool.name, "decoder");
cases++;
await client.close();
assert.deepEqual((await readdir(root.path)).sort(), [
+32 -1
View File
@@ -369,7 +369,38 @@ process.stdout.write(JSON.stringify({executable:basename(process.execPath),abiVe
"-NoProfile",
"-NonInteractive",
"-Command",
"$ErrorActionPreference='Stop'; $p=$env:REA_TEST_PRIVATE_RUNTIME_PATH; $a=Get-Acl -LiteralPath $p; $u=[Security.Principal.WindowsIdentity]::GetCurrent().User; [IO.File]::SetAttributes($p,[IO.FileAttributes]([int][IO.File]::GetAttributes($p) -bor 1)); @{protected=$a.AreAccessRulesProtected; ownerMatchesUser=($a.GetOwner([Security.Principal.SecurityIdentifier]).Value -eq $u.Value); trusteesOnlyUserAndSystem=(@($a.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier]) | Where-Object {$_.IdentityReference.Value -ne $u.Value -and $_.IdentityReference.Value -ne 'S-1-5-18'}).Count -eq 0); count=@($a.Access).Count; rootReadonly=(([int][IO.File]::GetAttributes($p) -band 1) -ne 0)} | ConvertTo-Json -Compress",
String.raw`
$ErrorActionPreference = 'Stop'
$clock = [Diagnostics.Stopwatch]::StartNew()
function Trace-AclPhase([string]$phase) {
[Console]::Error.WriteLine('private-runtime-acl: ' + $phase + ' ' + $clock.ElapsedMilliseconds + 'ms')
}
Trace-AclPhase 'started'
$p = $env:REA_TEST_PRIVATE_RUNTIME_PATH
$a = Get-Acl -LiteralPath $p
Trace-AclPhase 'acl-read'
$u = [Security.Principal.WindowsIdentity]::GetCurrent().User
$owner = $a.GetOwner([Security.Principal.SecurityIdentifier])
Trace-AclPhase 'owner-sid-read'
# Guard the independent observer against accidental account-name resolution.
# Access is a PowerShell convenience property that requests NTAccount rules.
Update-TypeData -TypeName ($a.GetType().FullName) -MemberType ScriptProperty -MemberName Access -Value { throw 'ACL observation must use SID rules' } -Force
if ($a.PSObject.Properties['Access'].MemberType -ne [Management.Automation.PSMemberTypes]::ScriptProperty) {
throw 'ACL observation Access guard was not installed'
}
$rules = @($a.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier]))
Trace-AclPhase 'rule-sids-read'
[IO.File]::SetAttributes($p, [IO.FileAttributes]([int][IO.File]::GetAttributes($p) -bor 1))
Trace-AclPhase 'readonly-set'
@{
protected = $a.AreAccessRulesProtected
ownerMatchesUser = ($owner.Value -eq $u.Value)
trusteesOnlyUserAndSystem = (@($rules | Where-Object { $_.IdentityReference.Value -ne $u.Value -and $_.IdentityReference.Value -ne 'S-1-5-18' }).Count -eq 0)
count = $rules.Count
rootReadonly = (([int][IO.File]::GetAttributes($p) -band 1) -ne 0)
} | ConvertTo-Json -Compress
Trace-AclPhase 'complete'
`,
],
{
encoding: "utf8",
+2 -1
View File
@@ -9,6 +9,7 @@ import { promisify } from "node:util";
import {
artifactCli,
artifactMcpResult,
artifactMcpCall,
withArtifactMcp,
withBundleResourcesMcp,
} from "../../lib/artifact-e2e.mjs";
@@ -97,7 +98,7 @@ try {
offset: first.next_offset,
});
assert.deepEqual([...first.records, ...next.records], cli.records);
const invalid = await client.callTool({
const invalid = await artifactMcpCall(client, {
name: "inspect_asset_catalog",
arguments: { offset: -1 },
});
+2 -1
View File
@@ -9,6 +9,7 @@ import { createHash } from "node:crypto";
import {
artifactCli,
artifactMcpResult,
artifactMcpCall,
withArtifactMcp,
} from "../../lib/artifact-e2e.mjs";
import {
@@ -53,7 +54,7 @@ try {
});
assert.deepEqual(page.objects, [graph.objects[1]]);
assert.equal(page.next_offset, 2);
const invalid = await client.callTool({
const invalid = await artifactMcpCall(client, {
name: "inspect_keyed_archive",
arguments: { path: "../other.plist" },
});
+2 -1
View File
@@ -5,6 +5,7 @@ import { relative, sep } from "node:path";
import { parseArtifactInventoryEvidence } from "../../../dist/domain/artifactInventoryEvidence.js";
import {
artifactCliEvidence,
artifactMcpCall,
withArtifactMcp,
} from "../../lib/artifact-e2e.mjs";
@@ -53,7 +54,7 @@ export async function verifyMachOOccurrences(app, executable) {
assert.equal(node.sha256, direct.manifest.root_sha256);
assert.equal(node.format, root.artifact_format);
await withArtifactMcp(app, async (client) => {
const reply = await client.callTool({
const reply = await artifactMcpCall(client, {
name: "inspect_artifact",
arguments: {},
});
+2 -1
View File
@@ -7,6 +7,7 @@ import { promisify } from "node:util";
import {
artifactCliEvidence,
artifactMcpResult,
artifactMcpCall,
withArtifactMcp,
} from "../../lib/artifact-e2e.mjs";
@@ -180,7 +181,7 @@ export async function verifyDylibResolution(app) {
await artifactMcpResult(client, "trace_dylib_resolution"),
trace,
);
const invalid = await client.callTool({
const invalid = await artifactMcpCall(client, {
name: "trace_dylib_resolution",
arguments: { roots: ["../outside"] },
});
+10 -15
View File
@@ -5,6 +5,7 @@ import { readFile } from "node:fs/promises";
import { toolContract } from "../../../dist/contracts/toolContracts.js";
import {
artifactCliEvidence,
artifactMcpCall,
withArtifactMcp,
withBundleResourcesMcp,
} from "../../lib/artifact-e2e.mjs";
@@ -27,7 +28,7 @@ export async function verifyNativeProvenance(app, executable) {
assert.equal(resourcePlistCli.subject, null);
assert.equal(resourcePlistCli.raw_result, null);
await withBundleResourcesMcp(app, async (client) => {
const response = await client.callTool({
const response = await artifactMcpCall(client, {
name: "inspect_plist",
arguments: {},
});
@@ -58,13 +59,10 @@ export async function verifyNativeProvenance(app, executable) {
assert.equal(binaryPlistCli.raw_result, null);
assert.equal(binaryPlistCli.normalized_result.resource_root, undefined);
await withArtifactMcp(app, async (client) => {
const definitions = new Map(
(await client.listTools()).tools.map((tool) => [tool.name, tool]),
);
const plistResponse = await client.callTool(
{ name: "inspect_plist", arguments: {} },
{ toolDefinition: definitions.get("inspect_plist") },
);
const plistResponse = await artifactMcpCall(client, {
name: "inspect_plist",
arguments: {},
});
assert.notEqual(plistResponse.isError, true, JSON.stringify(plistResponse));
const binaryPlistMcp = toolContract("inspect_plist").outputSchema.parse(
plistResponse.structuredContent,
@@ -98,13 +96,10 @@ export async function verifyNativeProvenance(app, executable) {
arguments_,
),
);
const response = await client.callTool(
{
name: operation,
arguments: operation === "demangle_swift" ? { symbols } : {},
},
{ toolDefinition: definitions.get(operation) },
);
const response = await artifactMcpCall(client, {
name: operation,
arguments: operation === "demangle_swift" ? { symbols } : {},
});
assert.notEqual(response.isError, true, JSON.stringify(response));
const mcp = toolContract(operation).outputSchema.parse(
response.structuredContent,