Skip to content

Decouple Shell Process Tracking from backgroundTools #290

@bhouston

Description

@bhouston

Decouple Shell Process Tracking from backgroundTools

Description

Currently, the backgroundTools tracker is used to track shell processes, browser sessions, and agents in a single implementation. This creates unnecessary coupling between these different types of tools. This issue proposes to refactor the shell process tracking into its own dedicated tracker.

Proposed Changes

  1. Create a new ShellTracker class in packages/agent/src/tools/system/shellTracker.ts that will be responsible for tracking shell processes
  2. Move shell-specific tracking logic from backgroundTools.ts to this new class
  3. Implement a new listShells tool that uses the dedicated ShellTracker
  4. Update shellStart.ts and shellMessage.ts to use the new tracker instead of backgroundTools
  5. Remove shell-related code from backgroundTools.ts

Technical Details

  • The new ShellTracker should maintain a registry of shell processes similar to how processStates works now
  • It should provide methods for registering, updating, and retrieving shell processes
  • The listShells tool should have similar filtering capabilities as listBackgroundTools but focused only on shell processes
  • The implementation should maintain backward compatibility where possible

Benefits

  • Reduced coupling between different tool types
  • More focused and maintainable code
  • Easier to extend or modify shell-specific functionality
  • Clearer separation of concerns

Acceptance Criteria

  • ShellTracker class is implemented
  • listShells tool is implemented
  • shellStart and shellMessage are updated to use the new tracker
  • Shell-specific code is removed from backgroundTools.ts
  • All tests pass
  • Documentation is updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions