feat(group): add unified Group type deriving toolset and promptset views#3488
feat(group): add unified Group type deriving toolset and promptset views#3488twishabansal wants to merge 4 commits into
Conversation
Introduce internal/group as the source of truth for a named collection of tools and prompts. Group.Initialize reuses the toolset/promptset Initialize logic; ToToolset/ToPromptset project the legacy views keyed by the group name. No existing behavior changes yet.
There was a problem hiding this comment.
Code Review
This pull request introduces a new group package to manage a named collection of both tools and prompts, acting as a single source of truth while providing projection methods (ToToolset and ToPromptset) for backward compatibility. The review feedback highlights an efficiency issue where manual reconstruction of tools.Toolset and prompts.Promptset in these projection methods discards the unexported toolNameSet field, causing ContainsTool to fall back to an O(N) linear scan. The reviewer suggests storing the fully initialized Toolset and Promptset structs directly within the Group struct to preserve O(1) lookups, simplify the code, and update the corresponding unit tests.
Embed the initialized Toolset and Promptset in Group instead of flattening their fields, so ToToolset/ToPromptset return the views with their lookup sets intact rather than rebuilding them per call.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new group package under internal/group to support grouping tools and prompts together. It defines GroupConfig for configuration and Group as the initialized source of truth, along with methods to project them into legacy Toolset and Promptset views. Comprehensive unit tests are also added to validate initialization and projections. There are no review comments, and I have no feedback to provide.
Description
First slice of the toolsets→groups evolution. Introduces
internal/groupas the unified source of truth for a named collection of tools and prompts, without changing any existing behavior yet.GroupConfig/Grouptypes;Initializereusestools.ToolsetConfig.Initializeandprompts.PromptsetConfig.Initializeso validation and manifest-building stay consistent.ToToolset()/ToPromptset()project the legacy views keyed by the group name.Wiring (config parsing, ResourceManager, server init, validation rules) and the prompt-scoping fix follow in subsequent PRs.