Tmux Agent Monitor

Monitor and analyze tmux agent activity and health

Overview

The node "Tmux Agent Monitor" provides various operations to monitor, analyze, and interact with tmux sessions and windows. Specifically, the Find Windows operation allows users to search for tmux windows by a name pattern. This is useful in scenarios where you want to locate specific windows across multiple tmux sessions based on partial or full window names.

Practical examples include:

  • Quickly locating all windows related to a particular project or task by matching part of their names.
  • Automating workflows that need to target specific tmux windows dynamically.
  • Auditing or managing tmux environments by identifying windows matching certain criteria.

Properties

Name Meaning
Window Pattern Pattern to search for in window names. This is a required string input where you specify the substring or regex pattern to match window names against.

Output

The output JSON structure for the Find Windows operation includes:

  • success (boolean): Indicates if the operation was successful.
  • pattern (string): The window pattern used for searching.
  • matchCount (number): The total number of windows matched.
  • matches (array): List of matched windows, each containing:
    • session (string): The tmux session name where the window resides.
    • windowIndex (number): The index of the matched window within the session.
    • target (string): A combined string in the format sessionName:windowIndex representing the window uniquely.
  • timestamp (string): ISO timestamp when the operation was performed.

No binary data output is produced by this operation.

Example output snippet:

{
  "success": true,
  "pattern": "myWindow",
  "matchCount": 2,
  "matches": [
    {
      "session": "session1",
      "windowIndex": 3,
      "target": "session1:3"
    },
    {
      "session": "session2",
      "windowIndex": 1,
      "target": "session2:1"
    }
  ],
  "timestamp": "2024-06-01T12:00:00.000Z"
}

Dependencies

  • Requires access to a tmux environment where the tmux sessions and windows exist.
  • Uses an internal utility bridge (TmuxBridge) to communicate with tmux.
  • Optionally uses credentials that may specify external script directories or project base paths to customize behavior.
  • No direct external API dependencies are indicated beyond the tmux environment itself.

Troubleshooting

  • Common issues:

    • If no matches are found, verify that the window pattern is correct and that tmux sessions/windows exist.
    • Permissions or environment issues might prevent accessing tmux sessions; ensure the node runs in an environment with proper tmux access.
    • Misconfiguration of optional credentials (e.g., external scripts directory) could cause failures.
  • Error messages:

    • "Failed to find windows: <error message>": Indicates an error occurred during the search process. Check tmux availability and pattern validity.
    • Node operation errors will be thrown if the underlying tmux bridge fails or if invalid parameters are provided.
  • Resolution tips:

    • Confirm tmux is installed and accessible from the environment running n8n.
    • Validate the window pattern string for correctness.
    • Review any credential configurations related to external scripts or project paths.

Links and References

Discussion