Michael Suchacz b794b1edd9
feat(mux): add package_manager and registry_url variables (#761)
## Summary

Add two new customization variables to the Mux module so users can
control how Mux is installed:

### `package_manager` (default: `"auto"`)

Choose which Node package manager installs Mux:

- **`auto`** (default) — auto-detects `npm` → `pnpm` → `bun` in order,
falling back to a direct tarball download when none is available
- **`npm`**, **`pnpm`**, **`bun`** — force a specific package manager
(fails if not found on PATH)

### `registry_url` (default: `"https://registry.npmjs.org"`)

Override the npm registry URL for private registries or mirrors. All
previously hardcoded `registry.npmjs.org` references have been replaced
with this variable. The `--registry` flag is passed to whichever package
manager is used, and the tarball fallback path also uses it.

## Changes

| File | What changed |
|---|---|
| `main.tf` | Added `package_manager` and `registry_url` variables with
validation; pass both to template |
| `run.sh` | Rewrote install logic: PM auto-detection loop,
`case`/`esac` dispatch with PM-specific flags, replaced all hardcoded
registry URLs with `${REGISTRY_URL}` |
| `mux.tftest.hcl` | Added 6 new test cases: PM selection
(npm/pnpm/bun), invalid PM validation, custom registry URL,
trailing-slash stripping |
| `main.test.ts` | Updated expected log messages to match new generic
wording |
| `README.md` | Updated description, added Custom Package Manager and
Custom Registry examples, updated Notes section |

## Version

Bumped **1.2.0 → 1.3.0** (minor: new backward-compatible features).

## Validation

-  `terraform validate` — clean
-  `terraform test` — **15 passed, 0 failed**
-  `terraform fmt` — clean

---

Generated with [Mux](https://mux.coder.com) using Claude
2026-02-26 16:40:40 +01:00
..

display_name description icon verified tags
Mux Coding Agent Multiplexer - Run multiple AI agents in parallel ../../../../.icons/mux.svg true
ai
agents
development
multiplexer

Mux

Automatically install and run Mux in a Coder workspace. By default, the module auto-detects an available package manager (npm, pnpm, or bun) to install mux@next (with a fallback to downloading the npm tarball if none is found). You can also force a specific package manager via package_manager and point to a custom registry with registry_url. Mux is a desktop application for parallel agentic development that enables developers to run multiple AI agents simultaneously across isolated workspaces.

module "mux" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/mux/coder"
  version  = "1.3.0"
  agent_id = coder_agent.main.id
}

Mux

Features

  • Parallel Agent Execution: Run multiple AI agents simultaneously on different tasks
  • Mux Workspace Isolation: Each agent works in its own isolated environment
  • Git Divergence Visualization: Track changes across different Mux agent workspaces
  • Long-Running Processes: Resume AI work after interruptions
  • Cost Tracking: Monitor API usage across agents

Examples

Basic Usage

module "mux" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/mux/coder"
  version  = "1.3.0"
  agent_id = coder_agent.main.id
}

Pin Version

module "mux" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/mux/coder"
  version  = "1.3.0"
  agent_id = coder_agent.main.id
  # Default is "latest"; set to a specific version to pin
  install_version = "0.4.0"
}

Open a Project on Launch

Start Mux with mux server --add-project /path/to/project:

module "mux" {
  count       = data.coder_workspace.me.start_count
  source      = "registry.coder.com/coder/mux/coder"
  version     = "1.3.0"
  agent_id    = coder_agent.main.id
  add-project = "/path/to/project"
}

Pass Arbitrary mux server Arguments

Use additional_arguments to append additional arguments to mux server. The module parses quoted values, so grouped arguments remain intact.

module "mux" {
  count                = data.coder_workspace.me.start_count
  source               = "registry.coder.com/coder/mux/coder"
  version              = "1.3.0"
  agent_id             = coder_agent.main.id
  additional_arguments = "--open-mode pinned --add-project '/workspaces/my repo'"
}

Custom Port

module "mux" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/mux/coder"
  version  = "1.3.0"
  agent_id = coder_agent.main.id
  port     = 8080
}

Custom Package Manager

Force a specific package manager instead of auto-detection:

module "mux" {
  count           = data.coder_workspace.me.start_count
  source          = "registry.coder.com/coder/mux/coder"
  version         = "1.3.0"
  agent_id        = coder_agent.main.id
  package_manager = "pnpm" # or "npm", "bun"
}

Custom Registry

Use a private or mirrored npm registry:

module "mux" {
  count        = data.coder_workspace.me.start_count
  source       = "registry.coder.com/coder/mux/coder"
  version      = "1.3.0"
  agent_id     = coder_agent.main.id
  registry_url = "https://npm.pkg.github.com"
}

Use Cached Installation

Run an existing copy of Mux if found, otherwise install from npm:

module "mux" {
  count      = data.coder_workspace.me.start_count
  source     = "registry.coder.com/coder/mux/coder"
  version    = "1.3.0"
  agent_id   = coder_agent.main.id
  use_cached = true
}

Skip Install

Run without installing from the network (requires Mux to be pre-installed):

module "mux" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/mux/coder"
  version  = "1.3.0"
  agent_id = coder_agent.main.id
  install  = false
}

Supported Platforms

  • Linux (x86_64, aarch64)

Notes

  • Mux is currently in preview and you may encounter bugs
  • Requires internet connectivity for agent operations (unless install is set to false)
  • Auto-detects npm, pnpm, or bun by default; set package_manager to force a specific one
  • Installs mux@next from the npm registry by default; set registry_url to use a private or mirrored registry
  • Falls back to a direct tarball download when no package manager is found