Skip to content

Commit 86fea26

Browse files
committed
fix(plugin-sdk): stabilize surface report after builds
1 parent 2e7c3ac commit 86fea26

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

scripts/plugin-sdk-surface-report.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,25 @@ function hasDeprecatedTag(symbol) {
203203
return symbol.getJsDocTags().some((tag) => tag.name === "deprecated");
204204
}
205205

206+
const generatedLlmCoreValidatorExports = new Set(["validateToolArguments", "validateToolCall"]);
207+
208+
function isGeneratedLlmCoreValidatorDeclaration(exportName, declaration) {
209+
if (!generatedLlmCoreValidatorExports.has(exportName)) {
210+
return false;
211+
}
212+
const relative = path.relative(repoRoot, declaration.getSourceFile().fileName);
213+
const relativePath = relative.split(path.sep).join(path.posix.sep);
214+
// Build artifacts can make agent-core's package-name validator reexports look
215+
// newly callable. Keep this source report independent of generated dist state.
216+
return relativePath.includes("llm-core/dist/validation.d.");
217+
}
218+
206219
function isCallableExport(checker, symbol, sourceFile) {
207220
const target = unwrapAlias(checker, symbol);
208221
const declaration = target.valueDeclaration ?? target.declarations?.[0] ?? sourceFile;
222+
if (isGeneratedLlmCoreValidatorDeclaration(symbol.getName(), declaration)) {
223+
return false;
224+
}
209225
const type = checker.getTypeOfSymbolAtLocation(target, declaration);
210226
return checker.getSignaturesOfType(type, ts.SignatureKind.Call).length > 0;
211227
}

test/scripts/plugin-sdk-surface-report.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ describe("plugin SDK surface report", () => {
4949
expect(result.stderr).toBe("");
5050
});
5151

52+
it("keeps generated package declarations out of source surface counts", () => {
53+
const result = runSurfaceReport({
54+
OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_FUNCTION_EXPORTS: "5186",
55+
});
56+
57+
expect(result.status).toBe(1);
58+
expect(result.stderr).toContain("public callable exports 5187 > 5186");
59+
});
60+
5261
it("rejects deprecated export growth by public entrypoint", () => {
5362
const result = runSurfaceReport({
5463
OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_DEPRECATED_EXPORTS_BY_ENTRYPOINT: JSON.stringify({ core: 1 }),

0 commit comments

Comments
 (0)