Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership. Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers. BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import { AsarArtifactReader } from "../AsarArtifactReader.js";
|
|
import type { ArtifactReader } from "../ArtifactReader.js";
|
|
import { DirectoryArtifactReader } from "../DirectoryArtifactReader.js";
|
|
import { MachOSliceArtifactReader } from "../MachOSliceArtifactReader.js";
|
|
import { NativeDmgArtifactReader } from "../NativeDmgArtifactReader.js";
|
|
import { ZipArtifactReader } from "../ZipArtifactReader.js";
|
|
import type { ArtifactOccurrence } from "../../domain/artifactGraph.js";
|
|
|
|
export const createReader = async (
|
|
path: string,
|
|
format: ArtifactOccurrence["artifact_format"],
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
signal?: AbortSignal,
|
|
): Promise<ArtifactReader | undefined> => {
|
|
switch (format) {
|
|
case "directory":
|
|
return new DirectoryArtifactReader(path);
|
|
case "zip":
|
|
case "ipa":
|
|
case "apk":
|
|
case "msix":
|
|
case "appx":
|
|
return new ZipArtifactReader(path, format);
|
|
case "asar":
|
|
return new AsarArtifactReader(path);
|
|
case "mach-o-universal":
|
|
return process.platform === "darwin"
|
|
? new MachOSliceArtifactReader(path, environment)
|
|
: undefined;
|
|
case "dmg":
|
|
if (process.platform !== "darwin") return undefined;
|
|
return NativeDmgArtifactReader.create(path, environment, signal);
|
|
default:
|
|
return undefined;
|
|
}
|
|
};
|
|
|
|
export const inventoryLimitations = (
|
|
format: ArtifactOccurrence["artifact_format"],
|
|
reader: ArtifactReader | undefined,
|
|
): string[] => {
|
|
if (reader !== undefined) return [];
|
|
if (format === "dmg" || format === "pkg")
|
|
return [
|
|
`${format.toUpperCase()} root hash is observed; child inventory requires a native macOS adapter.`,
|
|
];
|
|
if (format === "mach-o-universal" && process.platform !== "darwin")
|
|
return ["Universal Mach-O slices require the native macOS lipo adapter."];
|
|
return ["Artifact has no child container entries."];
|
|
};
|