feat: add passive website reverse engineering

This commit is contained in:
N0zoM1z0
2026-07-14 12:27:13 +08:00
parent a699fdd6a5
commit 2c1ceabbf1
71 changed files with 5279 additions and 80 deletions
+9 -4
View File
@@ -8,6 +8,7 @@ import {
} from "../src/contracts/toolContracts.js";
import { NATIVE_TOOL_CONTRACTS } from "../src/contracts/nativeToolContracts.js";
import { ARTIFACT_TOOL_CONTRACTS } from "../src/contracts/artifactToolContracts.js";
import { BROWSER_TOOL_CONTRACTS } from "../src/contracts/browserToolContracts.js";
import {
enhancedOutputSchemas,
officialOutputSchemas,
@@ -34,8 +35,9 @@ describe("tool contract surface", () => {
...ENHANCED_TOOL_CONTRACTS,
...NATIVE_TOOL_CONTRACTS,
...ARTIFACT_TOOL_CONTRACTS,
...BROWSER_TOOL_CONTRACTS,
];
expect(contracts).toHaveLength(50);
expect(contracts).toHaveLength(52);
for (const contract of contracts) {
const inputSchema = z.toJSONSchema(contract.inputSchema, {
target: "draft-07",
@@ -50,7 +52,9 @@ describe("tool contract surface", () => {
expect(contract.annotations).toMatchObject({
idempotentHint: true,
});
expect(contract.annotations.openWorldHint).toBe(false);
expect(contract.annotations.openWorldHint).toBe(
contract.kind === "browser-provider",
);
expect(typeof contract.annotations.readOnlyHint).toBe("boolean");
expect(typeof contract.annotations.destructiveHint).toBe("boolean");
expect(contract.examples).toHaveLength(1);
@@ -136,15 +140,16 @@ describe("tool contract surface", () => {
}
});
it("publishes no unconstrained output-schema holes across all 68 tools", () => {
it("publishes no unconstrained output-schema holes across all 70 tools", () => {
const contracts = [
...OFFICIAL_TOOL_CONTRACTS,
...ENHANCED_TOOL_CONTRACTS,
...NATIVE_TOOL_CONTRACTS,
...ARTIFACT_TOOL_CONTRACTS,
...BROWSER_TOOL_CONTRACTS,
...SESSION_TOOL_CONTRACTS,
];
expect(contracts).toHaveLength(68);
expect(contracts).toHaveLength(70);
for (const contract of contracts) {
const schema = z.toJSONSchema(contract.outputSchema, {
target: "draft-07",