diff --git a/scripts/plugin-sdk-surface-report.mjs b/scripts/plugin-sdk-surface-report.mjs index 8254461d4a51..c17da9858537 100644 --- a/scripts/plugin-sdk-surface-report.mjs +++ b/scripts/plugin-sdk-surface-report.mjs @@ -203,9 +203,25 @@ function hasDeprecatedTag(symbol) { return symbol.getJsDocTags().some((tag) => tag.name === "deprecated"); } +const generatedLlmCoreValidatorExports = new Set(["validateToolArguments", "validateToolCall"]); + +function isGeneratedLlmCoreValidatorDeclaration(exportName, declaration) { + if (!generatedLlmCoreValidatorExports.has(exportName)) { + return false; + } + const relative = path.relative(repoRoot, declaration.getSourceFile().fileName); + const relativePath = relative.split(path.sep).join(path.posix.sep); + // Build artifacts can make agent-core's package-name validator reexports look + // newly callable. Keep this source report independent of generated dist state. + return relativePath.includes("llm-core/dist/validation.d."); +} + function isCallableExport(checker, symbol, sourceFile) { const target = unwrapAlias(checker, symbol); const declaration = target.valueDeclaration ?? target.declarations?.[0] ?? sourceFile; + if (isGeneratedLlmCoreValidatorDeclaration(symbol.getName(), declaration)) { + return false; + } const type = checker.getTypeOfSymbolAtLocation(target, declaration); return checker.getSignaturesOfType(type, ts.SignatureKind.Call).length > 0; } diff --git a/test/scripts/plugin-sdk-surface-report.test.ts b/test/scripts/plugin-sdk-surface-report.test.ts index 50b4e99e3420..74abfd4fd186 100644 --- a/test/scripts/plugin-sdk-surface-report.test.ts +++ b/test/scripts/plugin-sdk-surface-report.test.ts @@ -49,6 +49,15 @@ describe("plugin SDK surface report", () => { expect(result.stderr).toBe(""); }); + it("keeps generated package declarations out of source surface counts", () => { + const result = runSurfaceReport({ + OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_FUNCTION_EXPORTS: "5186", + }); + + expect(result.status).toBe(1); + expect(result.stderr).toContain("public callable exports 5187 > 5186"); + }); + it("rejects deprecated export growth by public entrypoint", () => { const result = runSurfaceReport({ OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_DEPRECATED_EXPORTS_BY_ENTRYPOINT: JSON.stringify({ core: 1 }),