fix(sdk): skip plugin code during agent discovery - #1026
Conversation
|
Good, minimal fix that matches the pattern already used for One thing worth flagging for the maintainer doing the port: this closes the door specifically on files under a directory literally named Scope-wise this is entirely in sdk/src, so no forbidden-path issues. The change is small, tested, and matches existing code conventions, so it's a reasonable candidate to port as-is, with a note that broader hardening of |
|
Thanks for the thorough review. Agreed on both points:
Let me know if you'd prefer any adjustment before the port. |
Summary
.agents/pluginstrees from local agent-module discoveryRoot cause
loadLocalAgentsrecursively treated every supported JavaScript or TypeScript file under.agentsas a candidate agent module and imported it before checking whether it exported an agent definition. Third-party plugin and MCP executables can inspect the host process arguments or callprocess.exit(), so discovery could terminate the Freebuff CLI.Closes #1018.
Validation
bun test sdk/src/__tests__/load-agents.test.ts --test-name-pattern 'does not execute nested MCP implementation files'bun test sdk/src/__tests__/load-agents.test.ts(34 passed)bun run --cwd sdk typecheckbun run build:sdkgit diff --check