feat(electron): add autonomous Electron runtime analysis (#464)
* feat: add autonomous Electron runtime analysis * feat(electron): add lifecycle and boundary telemetry * feat(electron): capture runtime boundary evidence * fix(electron): package boundary hook helper * feat(electron): report active capture coverage * fix(electron): account for bring-your-own runtime * feat(electron): expand agent-owned runtime scenarios * fix(ghidra): keep fixture credentials out of argv * perf(test): serialize local test and docs workloads * fix(electron): harden active runtime capture * fix(inspector): require exact runtime target authorization * fix(docs): make managed manifest host independent * fix(ci): make generated catalog portable * fix: unblock autonomous command and electron flows * fix(electron): close popup and detached helper gaps
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
createConformancePackage,
|
||||
type ConformancePackage,
|
||||
} from "../../../src/domain/conformancePackage.js";
|
||||
import { createEvidence } from "../../../src/domain/evidence.js";
|
||||
import {
|
||||
replayConformancePackage,
|
||||
type ScenarioReplayResult,
|
||||
@@ -115,6 +116,41 @@ describe("conformance CI replay", () => {
|
||||
expect(result.drift_detected).toBe(false);
|
||||
});
|
||||
|
||||
it("retains the observed Evidence ID on the first drift", async () => {
|
||||
const expected = createEvidence(
|
||||
undefined,
|
||||
{ id: "fixture-provider", name: "Fixture provider", version: "1" },
|
||||
{ operation: "run", parameters: {}, result: { exit_code: 0 } },
|
||||
);
|
||||
const pkg = createConformancePackage({
|
||||
...validPackage,
|
||||
expected_evidence: [
|
||||
{
|
||||
scenario_id: "s1",
|
||||
envelopes: [expected],
|
||||
bundle: null,
|
||||
required_dimensions: ["exit_code"],
|
||||
},
|
||||
],
|
||||
});
|
||||
const actualEvidenceId = `ev_${"3".repeat(64)}`;
|
||||
const result = await replayConformancePackage(
|
||||
pkg,
|
||||
{
|
||||
s1: {
|
||||
evidence_id: actualEvidenceId,
|
||||
normalized_result: { exit_code: 1 },
|
||||
},
|
||||
},
|
||||
passingRunner,
|
||||
);
|
||||
expect(result.drift_detected).toBe(true);
|
||||
expect(result.first_drift).toMatchObject({
|
||||
dimension: "exit_code",
|
||||
evidence_id: actualEvidenceId,
|
||||
});
|
||||
});
|
||||
|
||||
it("throws on invalid package", async () => {
|
||||
await expect(replayConformancePackage({}, {})).rejects.toThrow(
|
||||
/invalid conformance package/u,
|
||||
|
||||
@@ -62,7 +62,78 @@ describe("conformance trust gates", () => {
|
||||
|
||||
it("handles missing actual", () => {
|
||||
const result = compareDimension("exit_code", 0, undefined);
|
||||
expect(result.status).toBe("mismatch");
|
||||
expect(result.status).toBe("unknown");
|
||||
});
|
||||
|
||||
it("keeps semantic unknown and truncated values out of equivalence", () => {
|
||||
expect(
|
||||
compareDimension(
|
||||
"process_tree",
|
||||
{ processes: [] },
|
||||
{ status: "unknown" },
|
||||
),
|
||||
).toMatchObject({ status: "unknown" });
|
||||
expect(
|
||||
compareDimension("process_tree", { processes: [] }, { truncated: true }),
|
||||
).toMatchObject({ status: "truncated" });
|
||||
expect(
|
||||
compareDimension(
|
||||
"process_tree",
|
||||
{ status: "unknown" },
|
||||
{ status: "unknown" },
|
||||
),
|
||||
).toMatchObject({ status: "unknown" });
|
||||
});
|
||||
|
||||
it("projects Evidence envelopes and links a divergence to the observed ID", () => {
|
||||
const expectedEvidenceId = `ev_${"1".repeat(64)}`;
|
||||
const actualEvidenceId = `ev_${"2".repeat(64)}`;
|
||||
const result = evaluateTrustGate(
|
||||
contract,
|
||||
{
|
||||
evidence_id: expectedEvidenceId,
|
||||
normalized_result: { exit_code: 0, stdout: "hello" },
|
||||
},
|
||||
{
|
||||
evidence_id: actualEvidenceId,
|
||||
normalized_result: { exit_code: 1, stdout: "hello" },
|
||||
},
|
||||
);
|
||||
expect(result.verdict).toBe("fail");
|
||||
expect(result.dimension_results[0]?.evidence_ids).toEqual([
|
||||
actualEvidenceId,
|
||||
expectedEvidenceId,
|
||||
]);
|
||||
expect(result.first_divergence).toMatchObject({
|
||||
dimension: "exit_code",
|
||||
evidence_id: actualEvidenceId,
|
||||
});
|
||||
});
|
||||
|
||||
it("scopes process residual unknowns without hiding complete dimensions", () => {
|
||||
const processContract: VerifierContract = {
|
||||
...contract,
|
||||
dimensions: [
|
||||
{ name: "exit_code", required: true, comparison: "exact" },
|
||||
{ name: "process_tree", required: true, comparison: "semantic" },
|
||||
],
|
||||
};
|
||||
const result = evaluateTrustGate(
|
||||
processContract,
|
||||
{ exit_code: 0, process_tree: { processes: [] } },
|
||||
{
|
||||
exit_code: 0,
|
||||
process_tree: { processes: [] },
|
||||
residual_unknowns: [{ scope: "process", reason: "event gap" }],
|
||||
},
|
||||
);
|
||||
expect(result.verdict).toBe("unknown");
|
||||
expect(result.dimension_results).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ name: "exit_code", status: "match" }),
|
||||
expect.objectContaining({ name: "process_tree", status: "unknown" }),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
it("passes when all dimensions match", () => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
systemNoFollowOpenCapability,
|
||||
type WindowsCapabilityDependencies,
|
||||
} from "../../../../src/application/WindowsCapabilities.js";
|
||||
import { WINDOWS_NATIVE_AUTHORITY_UNAVAILABLE_REASON } from "../../../../src/process/WindowsAuthority.js";
|
||||
|
||||
const dependencies = (
|
||||
overrides: Partial<WindowsCapabilityDependencies> = {},
|
||||
@@ -67,6 +68,23 @@ describe("Windows host capability report", () => {
|
||||
},
|
||||
pty: { available: false, reason: "probe unavailable" },
|
||||
},
|
||||
security: {
|
||||
job_object_process_ownership: {
|
||||
available: false,
|
||||
reason: WINDOWS_NATIVE_AUTHORITY_UNAVAILABLE_REASON,
|
||||
proof: "not-proven",
|
||||
},
|
||||
private_runtime_dacl: {
|
||||
available: false,
|
||||
reason: WINDOWS_NATIVE_AUTHORITY_UNAVAILABLE_REASON,
|
||||
proof: "not-proven",
|
||||
},
|
||||
reparse_safe_path_admission: {
|
||||
available: false,
|
||||
reason: WINDOWS_NATIVE_AUTHORITY_UNAVAILABLE_REASON,
|
||||
proof: "not-proven",
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -89,5 +107,26 @@ describe("Windows host capability report", () => {
|
||||
reason: null,
|
||||
});
|
||||
expect(result.capabilities.private_acl.available).toBe(false);
|
||||
expect(result.security.private_runtime_dacl).toMatchObject({
|
||||
available: false,
|
||||
proof: "not-proven",
|
||||
});
|
||||
});
|
||||
|
||||
it("does not promote an ordinary ACL probe into native authority", async () => {
|
||||
const result = await probeWindowsCapabilities(
|
||||
dependencies({
|
||||
probePrivateAcl: () => ({ available: true, reason: null }),
|
||||
}),
|
||||
);
|
||||
|
||||
expect(result.capabilities.private_acl).toEqual({
|
||||
available: true,
|
||||
reason: null,
|
||||
});
|
||||
expect(result.security.private_runtime_dacl).toMatchObject({
|
||||
available: false,
|
||||
proof: "not-proven",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,19 +5,32 @@ const {
|
||||
shell,
|
||||
utilityProcess,
|
||||
} = require("electron");
|
||||
const { spawn } = require("node:child_process");
|
||||
|
||||
const windows = new Set();
|
||||
app.on("open-url", (_event, url) => {
|
||||
const deliverDeepLink = (url) => {
|
||||
for (const window of windows) window.webContents.send("deep-link", url);
|
||||
};
|
||||
app.on("open-url", (_event, url) => deliverDeepLink(url));
|
||||
app.on("second-instance", (_event, commandLine) => {
|
||||
const url = commandLine.at(-1);
|
||||
if (typeof url === "string") deliverDeepLink(url);
|
||||
});
|
||||
app.whenReady().then(() => {
|
||||
const window = new BrowserWindow({
|
||||
webPreferences: { preload: require.resolve("./preload.js") },
|
||||
});
|
||||
windows.add(window);
|
||||
window.loadFile("renderer.html");
|
||||
for (let index = 0; index < 2; index += 1) {
|
||||
const window = new BrowserWindow({
|
||||
webPreferences: { preload: require.resolve("./preload.js") },
|
||||
});
|
||||
windows.add(window);
|
||||
window.loadFile("renderer.html");
|
||||
window.webContents.on("render-process-gone", () => window.reload());
|
||||
}
|
||||
utilityProcess.fork(require.resolve("./utility.js"));
|
||||
spawn(
|
||||
process.env.REA_ELECTRON_NODE_EXECUTABLE ?? "node",
|
||||
["-e", "setTimeout(() => {}, 100)"],
|
||||
{ stdio: "ignore" },
|
||||
);
|
||||
ipcMain.handle("readiness:echo", (_event, value) => ({ value }));
|
||||
window.webContents.on("render-process-gone", () => window.reload());
|
||||
shell.openExternal("https://blocked.invalid").catch(() => undefined);
|
||||
});
|
||||
|
||||
@@ -107,4 +107,12 @@ describe("localized README product facts", () => {
|
||||
"pin persistent MCP registrations to the exact version",
|
||||
);
|
||||
});
|
||||
|
||||
it("documents the published MCP Registry installation path", async () => {
|
||||
const content = await readFile(resolve("docs/installation.md"), "utf8");
|
||||
expect(content).toContain("MCP Registry");
|
||||
expect(content).toContain("io.github.morluto/rea");
|
||||
expect(content).toContain('"command": "npx"');
|
||||
expect(content).toContain('"args": ["-y", "rea-agents@latest", "mcp"]');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,6 +26,16 @@ describe("release configuration", () => {
|
||||
type: "generic",
|
||||
path: "src/generatedPackageMetadata.ts",
|
||||
},
|
||||
{
|
||||
type: "json",
|
||||
path: "server.json",
|
||||
jsonpath: "$.version",
|
||||
},
|
||||
{
|
||||
type: "json",
|
||||
path: "server.json",
|
||||
jsonpath: "$.packages[0].version",
|
||||
},
|
||||
{
|
||||
type: "json",
|
||||
path: "docs/product-catalog.json",
|
||||
@@ -61,6 +71,47 @@ describe("release configuration", () => {
|
||||
expect(generated).toContain("x-release-please-version");
|
||||
});
|
||||
|
||||
it("keeps the npm package and MCP Registry metadata aligned", async () => {
|
||||
const packageJson = (await readJson("package.json")) as {
|
||||
name: string;
|
||||
version: string;
|
||||
mcpName: string;
|
||||
};
|
||||
const serverJson = (await readJson("server.json")) as {
|
||||
name: string;
|
||||
version: string;
|
||||
packages: Array<{
|
||||
registryType: string;
|
||||
registryBaseUrl: string;
|
||||
identifier: string;
|
||||
version: string;
|
||||
runtimeHint: string;
|
||||
transport: { type: string };
|
||||
packageArguments: Array<{ type: string; value: string }>;
|
||||
}>;
|
||||
};
|
||||
|
||||
expect(packageJson).toMatchObject({
|
||||
name: "rea-agents",
|
||||
mcpName: "io.github.morluto/rea",
|
||||
});
|
||||
expect(serverJson).toMatchObject({
|
||||
name: packageJson.mcpName,
|
||||
version: packageJson.version,
|
||||
packages: [
|
||||
{
|
||||
registryType: "npm",
|
||||
registryBaseUrl: "https://registry.npmjs.org",
|
||||
identifier: packageJson.name,
|
||||
version: packageJson.version,
|
||||
runtimeHint: "npx",
|
||||
transport: { type: "stdio" },
|
||||
packageArguments: [{ type: "positional", value: "mcp" }],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps TypeDoc unversioned and outside the tracked documentation tree", async () => {
|
||||
await expect(readJson("typedoc.json")).resolves.toMatchObject({
|
||||
includeVersion: false,
|
||||
|
||||
Reference in New Issue
Block a user