Resolve each caller-selected Electron path once at the application boundary, collect field-specific failures with original causes, and pass canonical paths directly to the provider. Update direct provider consumers and route the real verifier through the shared application workflow. Validation: public CLI/MCP invalid-path acceptance, canonicalization boundary, provider tests, and cancellation/cleanup checks. Live Electron launch was not verified. This does not address the separate Playwright launch-rejection crash in #2269. Fixes #2272
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
import { digestCanonicalValue } from "../../domain/canonicalDigest.js";
|
|
import type { ProviderIdentity } from "../AnalysisProvider.js";
|
|
import type { CanonicalElectronActiveObservationInput } from "./ElectronActiveObservationPort.js";
|
|
import type { Evidence, EvidenceObservation } from "../../domain/evidence.js";
|
|
import { createEvidence } from "../../domain/evidence.js";
|
|
import type { ElectronActiveObservationResult } from "../../domain/javascript/electronActiveObservation.js";
|
|
import { jsonObjectSchema, jsonValueSchema } from "../../domain/jsonValue.js";
|
|
|
|
/** Commit the selected Electron experiment and its observed result. */
|
|
export const createElectronActiveEvidence = (
|
|
input: CanonicalElectronActiveObservationInput,
|
|
result: ElectronActiveObservationResult,
|
|
provider: ProviderIdentity,
|
|
): Evidence =>
|
|
createEvidence(undefined, provider, {
|
|
predicateType: "rea.electron-active-scenario",
|
|
operation: "capture_electron_scenario",
|
|
parameters: parameters(input),
|
|
result: jsonValueSchema.parse(result),
|
|
confidence: "observed",
|
|
authority: "controlled-replay",
|
|
environment: {
|
|
id: `${result.application.electron_version}@unknown`,
|
|
platform: "unknown",
|
|
architecture: "unknown",
|
|
isolation: "none",
|
|
},
|
|
limitations: [
|
|
...result.limitations,
|
|
"Application host platform and architecture were not observed.",
|
|
],
|
|
});
|
|
|
|
const parameters = (
|
|
input: CanonicalElectronActiveObservationInput,
|
|
): EvidenceObservation["parameters"] => {
|
|
const scenario = jsonObjectSchema.parse(input);
|
|
return {
|
|
...scenario,
|
|
scenario_sha256: digestCanonicalValue(scenario, "Electron scenario"),
|
|
};
|
|
};
|