-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Labels
Description
Replace shell commands with Node.js APIs for system information gathering
Currently, the agent gathers system information using Unix/Linux shell commands like pwd
, ls -la
, and uname -a
via execSync
. This approach is not cross-platform and will fail on Windows systems.
Problem
- Commands like
pwd
,ls -la
, anduname -a
are Unix/Linux specific - Windows users will see error messages in the agent prompt
- Reduces reliability and consistency across different operating systems
Proposed Solution
Replace shell commands with Node.js native APIs:
- Current directory:
process.cwd()
instead ofpwd
- File listing:
fs.readdirSync()
with formatting instead ofls -la
- System info:
os
module instead ofuname -a
- Date/time: Already using JavaScript's
new Date().toString()
(no change needed)
Benefits
- Cross-platform compatibility (Windows, macOS, Linux)
- More reliable and consistent behavior
- Removes dependency on external shell commands
- Better error handling
Implementation Notes
- Update
getDefaultSystemPrompt
function inpackages/agent/src/core/toolAgent/config.ts
- Maintain similar formatting of output for consistency
- Ensure proper error handling