馃О refactor: Use Bash PTC for Agent Tools - #13042
Conversation
3562a6b to
6dd71e4
Compare
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR migrates agent Programmatic Tool Calling (PTC) to a bash-first tool name (run_tools_with_bash) while retaining backwards compatibility for legacy run_tools_with_code event payloads across the API and client UI.
Changes:
- Introduces
Constants.BASH_PROGRAMMATIC_TOOL_CALLINGand updates tool classification to register/instantiate the bash PTC tool/definition. - Updates agent tool-execution handling and ToolService event-driven tool loading to treat
run_tools_with_codeas a compatibility alias routed through the bash PTC implementation. - Updates client labeling/icon/renderer handling for the new tool name and adds/updates Jest coverage.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/data-provider/src/config.ts | Adds a new constant for the bash PTC tool name. |
| packages/api/src/tools/classification.ts | Switches tool classification/registration to bash PTC definition + tool factory. |
| packages/api/src/tools/classification.spec.ts | Updates expectations and adds coverage ensuring bash PTC is created/registered. |
| packages/api/src/agents/handlers.ts | Treats both bash and legacy PTC tool names as triggers for toolDefs/toolMap injection. |
| packages/api/src/agents/handlers.spec.ts | Adds coverage for legacy PTC name receiving toolDefs/toolMap injection. |
| api/server/services/ToolService.js | Loads bash PTC tool for both bash + legacy tool names (aliasing via name). |
| api/server/services/tests/ToolService.spec.js | Adds compatibility test ensuring legacy name loads the bash PTC tool under the legacy name. |
| client/src/utils/toolLabels.ts | Adds friendly label mapping for run_tools_with_bash. |
| client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx | Maps bash PTC name to the execute-code icon type. |
| client/src/components/Chat/Messages/Content/Part.tsx | Renders run_tools_with_bash tool calls via the ExecuteCode UI path. |
| client/src/components/Chat/Messages/Content/tests/ToolIcon.test.tsx | Adds icon mapping coverage for the bash PTC constant. |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codex Review: Didn't find any major issues. 馃殌 鈩癸笍 About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 馃憤. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
GitNexus: 馃殌 deployedThe |
* fix: Use Bash PTC for programmatic agent tools * fix: Preserve legacy PTC event calls
* fix: Use Bash PTC for programmatic agent tools * fix: Preserve legacy PTC event calls
* fix: Use Bash PTC for programmatic agent tools * fix: Preserve legacy PTC event calls
Summary
I split the programmatic tool-calling migration into its own stacked PR on top of #13028. This keeps the Code API auth PR focused while preserving the bash-first PTC behavior.
run_tools_with_codetorun_tools_with_bash.run_tools_with_codeevent payloads as a compatibility alias, while still routing them through the bash PTC implementation.Change Type
Testing
cd api && npx jest server/services/__tests__/ToolService.spec.js --runInBandcd packages/api && npx jest src/agents/handlers.spec.ts src/tools/classification.spec.ts --runInBandnpm run build:client-packagecd client && npx jest src/components/Chat/Messages/Content/__tests__/ToolIcon.test.tsx --runInBandTest Configuration:
@librechat/clientwas built; afternpm run build:client-package, the targeted client test passed.Checklist