refactor: return complete tool results inline

This commit is contained in:
morluto
2026-09-29 07:08:46 +08:00
parent 2160d4fae5
commit 0d96275b68
535 changed files with 4084 additions and 13537 deletions
+10 -18
View File
@@ -14,11 +14,11 @@ const PROVIDER = {
describe("analysis profile commitments", () => {
it("canonicalizes parameter key order and validates its digest", () => {
const first = createAnalysisProfile(PROVIDER, 1, {
const first = createAnalysisProfile(PROVIDER, {
architecture: "arm64",
analyzers: { strings: true, functions: true },
});
const reordered = createAnalysisProfile(PROVIDER, 1, {
const reordered = createAnalysisProfile(PROVIDER, {
analyzers: { functions: true, strings: true },
architecture: "arm64",
});
@@ -27,36 +27,28 @@ describe("analysis profile commitments", () => {
expect(analysisProfileSchema.parse(first)).toEqual(first);
});
it("separates provider builds, profile schemas, and semantic parameters", () => {
const baseline = createAnalysisProfile(PROVIDER, 1, { loader: "default" });
it("separates provider builds and semantic parameters", () => {
const baseline = createAnalysisProfile(PROVIDER, { loader: "default" });
const changedBuild = createAnalysisProfile(
{ ...PROVIDER, version: "1.2.4" },
1,
{ loader: "default" },
);
const changedSchema = createAnalysisProfile(PROVIDER, 2, {
loader: "default",
});
const changedParameters = createAnalysisProfile(PROVIDER, 1, {
const changedParameters = createAnalysisProfile(PROVIDER, {
loader: "override",
});
expect(
new Set([
baseline.digest,
changedBuild.digest,
changedSchema.digest,
changedParameters.digest,
]).size,
).toBe(4);
new Set([baseline.digest, changedBuild.digest, changedParameters.digest])
.size,
).toBe(3);
});
it("rejects digest tampering and unbounded parameters", () => {
const profile = createAnalysisProfile(PROVIDER, 1, { loader: "default" });
const profile = createAnalysisProfile(PROVIDER, { loader: "default" });
expect(() =>
analysisProfileSchema.parse({ ...profile, digest: "0".repeat(64) }),
).toThrow(/digest/u);
expect(() =>
createAnalysisProfile(PROVIDER, 1, {
createAnalysisProfile(PROVIDER, {
oversized: "x".repeat(65 * 1024),
}),
).toThrow(/limit/u);