mirror of
https://github.com/morluto/rea.git
synced 2026-10-12 02:19:24 +00:00
Remove REA permission grants, scope ceilings, approval confirmations, and inert settings. Preserve selected local evidence, accept caller-chosen commands and paths, and report actual runtime failures. Harden provider results, schema serialization, snapshot evidence binding, archive paths, source maps, native screenshots, managed EH parsing, and cancellation cleanup. Regenerate tool metadata and document direct invocation. BREAKING CHANGE: Removed permission configuration and policy commands, approval fields, filesystem scope inputs, and fixed confirmation options. Process capture inherits the host environment and accepts command names; callers must refresh tool schemas and migrate removed fields.
112 lines
3.8 KiB
JavaScript
112 lines
3.8 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import { join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { PlaywrightElectronActiveProvider } from "../dist/browser/PlaywrightElectronActiveProvider.js";
|
|
import { electronActiveObservationInputSchema } from "../dist/domain/electronActiveObservation.js";
|
|
import { completeVerifierRun, createVerifierRun } from "./lib/verifier-run.mjs";
|
|
|
|
const executable = process.env.REA_ELECTRON_EXECUTABLE;
|
|
if (executable === undefined || executable.length === 0)
|
|
throw new Error(
|
|
"REA_ELECTRON_EXECUTABLE must identify the Electron executable for this verification lane",
|
|
);
|
|
|
|
const repositoryRoot = fileURLToPath(new URL("..", import.meta.url));
|
|
const applicationRoot =
|
|
process.env.REA_ELECTRON_APPLICATION_ROOT ??
|
|
join(repositoryRoot, "tests/conformance/readiness/electron");
|
|
const applicationPath =
|
|
process.env.REA_ELECTRON_APPLICATION_PATH ?? join(applicationRoot, "main.js");
|
|
const input = electronActiveObservationInputSchema.parse({
|
|
executable_path: executable,
|
|
application_path: applicationPath,
|
|
application_root: applicationRoot,
|
|
actions: [
|
|
{ step_id: "ipc", kind: "click", selector: "#run", window_index: 0 },
|
|
{
|
|
step_id: "open-url",
|
|
kind: "deep-link",
|
|
delivery: "open-url",
|
|
url: "rea-readiness://open-url",
|
|
},
|
|
{
|
|
step_id: "second-instance",
|
|
kind: "deep-link",
|
|
delivery: "second-instance",
|
|
url: "rea-readiness://second-instance",
|
|
},
|
|
{ step_id: "renderer-reload", kind: "renderer-reload", window_index: 1 },
|
|
{ step_id: "renderer-crash", kind: "renderer-crash", window_index: 1 },
|
|
{
|
|
step_id: "renderer-restart",
|
|
kind: "wait",
|
|
duration_ms: 250,
|
|
window_index: 1,
|
|
},
|
|
],
|
|
});
|
|
const verifierRun = createVerifierRun();
|
|
const result = await new PlaywrightElectronActiveProvider().capture(input);
|
|
if (!result.ok) throw result.error;
|
|
|
|
const output = {
|
|
verifier_run: await completeVerifierRun(verifierRun),
|
|
electron: result.value.application,
|
|
actions: result.value.actions,
|
|
processes: result.value.processes,
|
|
ipc: result.value.ipc,
|
|
timeline: result.value.timeline,
|
|
windows: result.value.windows,
|
|
verified:
|
|
result.value.actions.every(({ status }) => status === "completed") &&
|
|
result.value.actions.some(
|
|
({ kind, window_index }) =>
|
|
kind === "renderer-reload" && window_index === 1,
|
|
) &&
|
|
result.value.actions.some(
|
|
({ kind, window_index }) =>
|
|
kind === "renderer-crash" && window_index === 1,
|
|
) &&
|
|
result.value.windows.length >= 2 &&
|
|
result.value.ipc.events.some(
|
|
({ kind, channel }) =>
|
|
kind === "main-handler-invocation" && channel === "readiness:echo",
|
|
) &&
|
|
result.value.timeline.events.some(
|
|
({ kind, event, phase }) =>
|
|
kind === "window-lifecycle" &&
|
|
event === "created" &&
|
|
phase === "completed",
|
|
) &&
|
|
result.value.timeline.events.some(
|
|
({ kind, event }) =>
|
|
kind === "process-lifecycle" && event === "utility-process-fork",
|
|
) &&
|
|
result.value.timeline.events.some(
|
|
({ kind, event, phase }) =>
|
|
kind === "shell-attempt" &&
|
|
event === "openExternal" &&
|
|
phase === "blocked",
|
|
) &&
|
|
result.value.timeline.events.some(
|
|
({ kind, event, phase }) =>
|
|
kind === "preload" && event === "configured" && phase === "completed",
|
|
) &&
|
|
result.value.timeline.events.some(
|
|
({ kind, event }) =>
|
|
kind === "protocol" &&
|
|
(event === "open-url" || event === "second-instance"),
|
|
) &&
|
|
result.value.timeline.events.some(
|
|
({ kind, event }) =>
|
|
kind === "process-lifecycle" && event === "child.spawn",
|
|
),
|
|
};
|
|
if (!output.verified)
|
|
throw new Error(
|
|
"real Electron verifier did not observe the readiness IPC round trip",
|
|
);
|
|
process.stdout.write(`${JSON.stringify(output)}\n`);
|