Conversation
…h context arrays Replace 3 separate tool registration channels (datamachine_global_tools, datamachine_chat_tools, datamachine_system_tools) with a single unified datamachine_tools filter. Every tool now registers once with a contexts array declaring where it's available. - BaseTool.registerTool() now takes (toolName, toolDefinition, contexts) instead of (agentType, toolName, toolDefinition) - Delete registerGlobalTool() and registerChatTool() from BaseTool - ToolManager gains get_all_tools(), get_raw_tools(), get_tool_contexts() with get_global_tools() kept as deprecated alias - ToolManager.resolveToolDefinition() handles _callable wrapper format for pre-resolution context filtering - ToolPolicyResolver.gatherBySurface() methods now filter unified registry by context instead of reading separate filters - All 46+ tool registrations updated with context declarations - Ability-registered tools (PostQuery, GetPostBlocks, EditPostBlocks, ReplacePostBlocks) updated to use datamachine_tools filter - Tests updated to use new filter and context patterns Phase 1 of #741 — ToolPolicyResolver surface→context rename is Phase 2.
Homeboy Results —
|
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.
Summary
Phase 1 of #741: Replace the 3 separate tool registration channels with a single unified
datamachine_toolsfilter. Every tool now declares acontextsarray specifying where it's available.datamachine_toolsreplacesdatamachine_global_tools,datamachine_chat_tools,datamachine_system_toolscontexts: ['chat', 'pipeline', 'standalone'](or subset)Changes
BaseTool.php
registerTool(toolName, toolDefinition, contexts)replaces the old 3-param(agentType, toolName, toolDefinition)signatureregisterGlobalTool()andregisterChatTool()_callablekey to keep contexts available pre-resolutionToolManager.php
get_all_tools()reads fromdatamachine_toolsfilter (replacesget_global_tools())get_global_tools()kept as deprecated aliasget_raw_tools()andget_tool_contexts()added for pre-resolution context checksresolveToolDefinition()handles_callablewrapper format, merging contexts into resolved resultToolPolicyResolver.php
filterByContext()helper filters resolved tools by context stringgatherPipelineTools(): filters to'pipeline'context + handler tools fromchubes_ai_toolsgatherChatTools(): filters to'chat'context with availability/enablement checksgatherStandaloneTools(): filters to'standalone'contextgatherSystemTools(): filters to'system'context (currently empty — no tools register with system context)ToolServiceProvider.php
registerGlobalTools()+registerChatTools()into singleregisterTools()46+ tool registration sites updated
contexts: ['chat', 'pipeline', 'standalone']contexts: ['chat']datamachine_toolsfilter with'chat'contextTests
ToolPolicyResolverTest: system surface test updated (no tools havesystemcontext now)ImageGenerationTest:datamachine_global_tools→datamachine_toolsListFlowsTest:datamachine_chat_tools→datamachine_toolswith_callableunwrappingTest Results
764 tests, 0 failures, 3 skipped (pre-existing)
What's NOT in this PR (Phase 2)
SURFACE_*constants toCONTEXT_*in ToolPolicyResolver