Core: rewrite tool-activation.ts + new guard extension generator#186
Closed
SuuBro wants to merge 1 commit intogoal/simplify-t-703f66e2from
Closed
Core: rewrite tool-activation.ts + new guard extension generator#186SuuBro wants to merge 1 commit intogoal/simplify-t-703f66e2from
SuuBro wants to merge 1 commit intogoal/simplify-t-703f66e2from
Conversation
- Remove stub extension functions: writeToolStubExtensions, writeLeakedToolStubs, generateToolStubExtension, generateMcpStubExtension - Remove leakedTools detection from computeToolActivationArgs - Add normalizePolicy helpers (isAllowPolicy, isAskPolicy, isNeverPolicy) - Update resolveGrantPolicy to normalize old policy values - Update computeEffectiveAllowedTools to include ask tools (not just allow) - Simplify writeMcpProxyExtensions: no stub variants, only real proxies - Add computeToolPolicies: returns policy+group for all tools - Add writeToolGuardExtension: generates guard when ask tools exist - New tool-guard-extension.ts: generates pi-coding-agent extension that intercepts tool_call events and enforces ask policy via REST long-poll Expected type errors in session-manager.ts and session-setup.ts (those files still import removed functions — handled by separate tasks). Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the core tool-activation.ts rewrite and new tool-guard-extension.ts generator.
Changes
New file:
src/server/agent/tool-guard-extension.tsgenerateToolGuardExtension(sessionId, policies, grantedTools)generates a pi-coding-agent extension that interceptstool_calleventsaskpolicy tools: blocks execution via REST long-poll to gateway until user grants/deniesBOBBIT_GATEWAY_URL,BOBBIT_TOKEN)Modified:
src/server/agent/tool-activation.tswriteToolStubExtensions(),writeLeakedToolStubs(),generateToolStubExtension(),generateMcpStubExtension()leakedToolsfromToolActivationResultand all leaked tool detection logicresolveGrantPolicy()normalizes old policy values (always-allow→allow,ask-once/always-ask→ask,never-ask→never)computeEffectiveAllowedTools()now returns tools withallowORaskpolicywriteMcpProxyExtensions()generates proxies for all non-neverMCP tools (no stub variants)computeToolPolicies()returns policy+group map for all known toolswriteToolGuardExtension()writes guard extension when anyasktools existExpected downstream type errors
session-manager.tsandsession-setup.tsstill import removed functions — those are handled by separate tasks.🤖 Generated with Bobbit