refactor(contracts): simplify workflows and drop readiness tool

This commit is contained in:
morluto
2026-09-29 09:22:44 +08:00
parent 0fe96d92df
commit 7acac615ca
37 changed files with 401 additions and 505 deletions
+40
View File
@@ -59,6 +59,46 @@ const describesObject = (schema: ReturnType<typeof contractJsonSchema>) =>
);
describe("tool contract surface", () => {
it("advertises capture comparison alternatives on an object root", () => {
const contract = BROWSER_TOOL_CONTRACTS.find(
({ name }) => name === "compare_web_captures",
);
if (contract === undefined)
throw new Error("compare_web_captures contract is missing");
const schema = contractJsonSchema(contract.inputSchema);
expect(schema.type).toBe("object");
expect(schema.oneOf).toBeUndefined();
expect(Object.keys(schema.properties ?? {})).toEqual(
expect.arrayContaining([
"before",
"after",
"before_scenario",
"after_scenario",
"normalization",
"max_changes",
]),
);
const example = contract.examples[0];
if (example === undefined)
throw new Error("compare_web_captures example is missing");
if (
!("before_scenario" in example.input) ||
!("after_scenario" in example.input)
)
throw new Error("compare_web_captures example is not a scenario pair");
const withoutNormalization = Object.fromEntries(
Object.entries(example.input).filter(([key]) => key !== "normalization"),
);
expect(contract.inputSchema.safeParse(withoutNormalization).success).toBe(
true,
);
const incomplete = Object.fromEntries(
Object.entries(example.input).filter(([key]) => key !== "after_scenario"),
);
expect(contract.inputSchema.safeParse(incomplete).success).toBe(false);
});
it("advertises complete typed schemas and annotations for every public tool", () => {
const contracts = TOOL_CONTRACTS;
for (const contract of contracts) {