npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@composio/ao-plugin-runtime-tmux

v0.1.0

Published

Runtime plugin: tmux sessions

Readme

@agent-orchestrator/plugin-runtime-tmux

Runtime plugin for executing agent sessions in tmux.

What This Does

Creates isolated tmux sessions for each agent. Each session runs in a separate tmux session with:

  • Working directory set to workspace path
  • Environment variables from config
  • Agent launch command executed automatically

How It Works

Creating a Session

const handle = await runtime.create({
  sessionId: "my-app-3",
  workspacePath: "/Users/dev/.worktrees/my-app/my-app-3",
  launchCommand: "claude -p 'Fix bug in auth module'",
  environment: {
    AO_SESSION_ID: "my-app-3",
    AO_PROJECT_ID: "my-app",
  },
});

What happens:

  1. Validates sessionId (only alphanumeric, dash, underscore allowed)
  2. Creates detached tmux session: tmux new-session -d -s my-app-3 -c /path/to/workspace
  3. Sets environment variables: tmux ... -e KEY=VALUE
  4. Sends launch command: tmux send-keys -t my-app-3 "claude -p '...'" Enter
  5. Returns RuntimeHandle with tmux session name

Sending Messages

await runtime.sendMessage(handle, "Fix the test failure in auth.test.ts");

What happens:

  1. Clears partial input: tmux send-keys -t my-app-3 C-u
  2. For short messages (<200 chars, no newlines): sends directly with -l flag (literal mode)
  3. For long/multiline messages: writes to temp file → tmux load-buffertmux paste-buffer
  4. Waits 300ms (let tmux process the text)
  5. Sends Enter: tmux send-keys -t my-app-3 Enter

Why the complexity?

  • send-keys without -l interprets special strings ("Enter", "Space") as key names
  • Long strings can overflow tmux's command buffer
  • Multiline strings need special handling

Getting Output

const output = await runtime.getOutput(handle, 50); // last 50 lines

Uses tmux capture-pane -t my-app-3 -p -S -50 to capture terminal buffer.

Checking if Alive

const alive = await runtime.isAlive(handle);

Uses tmux has-session -t my-app-3 (exit code 0 = exists, 1 = doesn't exist).

Destroying

await runtime.destroy(handle);

Kills tmux session: tmux kill-session -t my-app-3 (ignores errors if already dead).

Attaching to Sessions

For Terminal plugins (iTerm2, web):

const attachInfo = await runtime.getAttachInfo(handle);
// Returns: { type: "tmux", target: "my-app-3", command: "tmux attach -t my-app-3" }

Security

Session ID validation:

const SAFE_SESSION_ID = /^[a-zA-Z0-9_-]+$/;

Only allows safe characters. Prevents shell injection via session name (used in tmux commands).

Error Handling

  • Session creation fails → cleans up (kills session) before throwing
  • Message send fails → throws (caller should handle)
  • Session already deaddestroy() silently succeeds (idempotent)

Metrics

const metrics = await runtime.getMetrics(handle);
// Returns: { uptimeMs: 123456 }

Tracks uptime (stored in RuntimeHandle.data.createdAt).

Testing

This plugin is tested indirectly via packages/core/src/__tests__/tmux.test.ts (utility functions) and integration tests.

To test manually:

# Start a test session
tmux new-session -d -s test-session -c /tmp
tmux send-keys -t test-session "echo hello" Enter

# Capture output
tmux capture-pane -t test-session -p

# Kill session
tmux kill-session -t test-session

Common Issues

tmux not installed

If tmux is not in PATH, all operations fail. Install via:

  • macOS: brew install tmux
  • Linux: apt-get install tmux or yum install tmux

Session name conflicts

If a session with the same ID already exists, create() fails. The orchestrator should ensure unique session IDs.

Detached sessions persist after orchestrator crashes

tmux sessions keep running even if the orchestrator dies. Use tmux list-sessions to find orphans, tmux kill-session -t <name> to clean up.

Limitations

  • macOS/Linux only — tmux is not available on Windows (use WSL)
  • No Windows native support — use runtime-process instead on Windows
  • Terminal buffer sizegetOutput() limited by tmux buffer size (default 2000 lines)
  • No resource limits — agents can consume unlimited CPU/memory (use docker/k8s runtimes for isolation)

Architecture Notes

Why tmux over raw processes?

  • Sessions persist across orchestrator restarts
  • Easy to attach for debugging: tmux attach -t session-name
  • Terminal emulation (colors, ANSI codes work)
  • Works well with interactive AI tools (Claude Code, Aider)

Why detached mode?

  • Orchestrator doesn't block waiting for agent
  • Multiple agents can run in parallel
  • Humans can attach later without interrupting agent