Merge branch 'main' into morl/roadmap_implementation

This commit is contained in:
morluto authored and GitHub committed 2026-07-14 03:21:30 +08:00
commit a93a198da7
7 files changed
+615 -12

No files matched your search

+3 -1
View File
@@ -15,6 +15,7 @@ import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { TextReader, Uint8ArrayWriter, ZipWriter } from "@zip.js/zip.js";
import { TOOL_CONTRACTS } from "../dist/contracts/toolContracts.js";
import { verifyPackedBridge } from "./verify-packed-bridge.mjs";
const expectedToolCount = TOOL_CONTRACTS.length;
@@ -41,6 +42,7 @@ try {
) {
throw new Error("package contained generated Python bytecode");
}
await verifyPackedBridge({ root, workspace, tarball, packedFiles });
const prefix = join(workspace, "prefix");
const home = join(workspace, "home");
const fakeBin = join(workspace, "bin");
@@ -484,7 +486,7 @@ try {
}
process.stdout.write(
`${JSON.stringify({ cli: true, analysisCli: true, artifactCli: true, evidenceCli: true, incurMcpCommand: "npx -y rea-agents mcp", doctor: "platform-appropriate", setup: supportedSetupHost ? "planned-then-idempotent" : "unsupported-host-rejected", setupPlanReadOnly: supportedSetupHost, existingHopperPreserved: supportedSetupHost, clients: supportedSetupHost ? 2 : 0, backupReadback: supportedSetupHost, failureRecovery: supportedSetupHost, skill: supportedSetupHost, mcpTools: expectedToolCount, evidenceMcp: true, targetFree: true, targetLifecycle: true })}\n`,
`${JSON.stringify({ cli: true, analysisCli: true, artifactCli: true, evidenceCli: true, incurMcpCommand: "npx -y rea-agents mcp", doctor: "platform-appropriate", setup: supportedSetupHost ? "planned-then-idempotent" : "unsupported-host-rejected", setupPlanReadOnly: supportedSetupHost, existingHopperPreserved: supportedSetupHost, clients: supportedSetupHost ? 2 : 0, backupReadback: supportedSetupHost, failureRecovery: supportedSetupHost, skill: supportedSetupHost, mcpTools: expectedToolCount, evidenceMcp: true, targetFree: true, targetLifecycle: true, boundedRegexBridge: true })}\n`,
);
} finally {
if (tarball) await rm(join(root, tarball), { force: true });
+40
View File
@@ -0,0 +1,40 @@
import { execFile } from "node:child_process";
import { join } from "node:path";
import { promisify } from "node:util";
const exec = promisify(execFile);
const packedBridge = "package/bridge/hopper_bridge.py";
/** Verify that the packed production bridge rejects a catastrophic regex. */
export async function verifyPackedBridge({
root,
workspace,
tarball,
packedFiles,
}) {
if (!packedFiles.includes(packedBridge))
throw new Error("package omitted the Hopper bridge");
await exec("tar", ["-xf", join(root, tarball), "-C", workspace]);
const probe = JSON.parse(
(
await exec("python3", [
join(root, "tests/fixtures/bridgeRegexProbe.py"),
join(workspace, packedBridge),
JSON.stringify({
action: "match",
pattern: "(a|aa){1,35}b",
value: "a".repeat(35),
case_sensitive: true,
}),
])
).stdout,
);
if (
probe.ok !== false ||
probe.diagnostic_type !== "invalid_request" ||
probe.message !== "Regex exceeds the 10000-path backtracking budget"
)
throw new Error(
`packaged Hopper bridge omitted regex bounds: ${JSON.stringify(probe)}`,
);
}