mirror of
https://github.com/morluto/rea.git
synced 2026-10-29 19:05:45 +00:00
58 lines
1.9 KiB
TypeScript
58 lines
1.9 KiB
TypeScript
import type { ProviderIdentity } from "../AnalysisProvider.js";
|
|
import type {
|
|
GpuCodeObjects,
|
|
GpuCodeObjectsInput,
|
|
GpuCodeObjectsPartial,
|
|
} from "../../domain/gpu/gpuCodeObjects.js";
|
|
import { createEvidence, type Evidence } from "../../domain/evidence.js";
|
|
|
|
const gpuParameters = (parameters: GpuCodeObjectsInput) => ({
|
|
path: parameters.path,
|
|
analysis: parameters.analysis,
|
|
...(parameters.object_ids === undefined
|
|
? {}
|
|
: { object_ids: parameters.object_ids }),
|
|
...(parameters.targets === undefined ? {} : { targets: parameters.targets }),
|
|
...(parameters.expected_sha256 === undefined
|
|
? {}
|
|
: { expected_sha256: parameters.expected_sha256 }),
|
|
});
|
|
/** One Evidence interpretation for success and observations retained by file finalization failures. */
|
|
export const createGpuCodeObjectsEvidence = (
|
|
report: GpuCodeObjects,
|
|
provider: ProviderIdentity,
|
|
parameters: GpuCodeObjectsInput,
|
|
): Evidence =>
|
|
createEvidence(
|
|
{
|
|
path: report.artifact.path,
|
|
sha256: report.artifact.sha256,
|
|
format: "file",
|
|
},
|
|
provider,
|
|
{
|
|
operation: "inspect_gpu_code_objects",
|
|
parameters: gpuParameters(parameters),
|
|
result: report,
|
|
confidence: "observed",
|
|
locations: [{ kind: "artifact-path", path: report.artifact.path }],
|
|
limitations: report.limitations,
|
|
},
|
|
);
|
|
|
|
export const createGpuCodeObjectsPartialEvidence = (
|
|
report: GpuCodeObjectsPartial,
|
|
provider: ProviderIdentity,
|
|
parameters: GpuCodeObjectsInput,
|
|
): Evidence =>
|
|
createEvidence(undefined, provider, {
|
|
operation: "inspect_gpu_code_objects",
|
|
parameters: gpuParameters(parameters),
|
|
result: report,
|
|
confidence: "observed",
|
|
subjectUnavailableReason:
|
|
"The interrupted inspection did not complete final file identity verification; root digest and completeness are unknown.",
|
|
locations: [{ kind: "artifact-path", path: report.artifact.path }],
|
|
limitations: report.limitations,
|
|
});
|