diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a5de01..2953268 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,8 @@ name: Release # Keep this workflow hand-curated. The prepare job produces the verified tarball, -# checksum, and metadata that future publish steps (for example npm) should -# reuse instead of rebuilding from scratch. +# checksum, and metadata that downstream publish steps on GitHub Releases and +# npm should reuse instead of rebuilding from scratch. on: workflow_dispatch: inputs: @@ -183,6 +183,7 @@ jobs: shell: bash env: RELEASE_TAG: ${{ needs.prepare-release.outputs.release_tag }} + PACKAGE_NAME: ${{ needs.prepare-release.outputs.package_name }} PACKAGE_VERSION: ${{ needs.prepare-release.outputs.package_version }} TARBALL_FILENAME: ${{ needs.prepare-release.outputs.tarball_filename }} CHECKSUM_FILENAME: ${{ needs.prepare-release.outputs.checksum_filename }} @@ -193,7 +194,14 @@ jobs: tarball_url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/download/${RELEASE_TAG}/${TARBALL_FILENAME}" cat > "$RELEASE_NOTES_FILE" <&2 + exit 1 + fi + + publish_args=() + if [[ "$PACKAGE_NAME" == @* ]]; then + publish_args+=(--access public) + fi + if [[ "$PACKAGE_VERSION" == *-* ]]; then + dist_tag="${PACKAGE_VERSION#*-}" + dist_tag="${dist_tag%%.*}" + if [[ -z "$dist_tag" ]]; then + echo "Unable to derive prerelease dist-tag from $PACKAGE_VERSION" >&2 + exit 1 + fi + publish_args+=(--tag "$dist_tag") + echo "Publishing prerelease $PACKAGE_NAME@$PACKAGE_VERSION with dist-tag $dist_tag" + else + echo "Publishing stable $PACKAGE_NAME@$PACKAGE_VERSION with dist-tag latest" + fi + + npm publish "$TARBALL_PATH" "${publish_args[@]}" diff --git a/AGENTS.md b/AGENTS.md index 940aec1..0a2d907 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ You are an experienced, pragmatic software engineering AI agent. Do not over-eng # Project Overview -`agent-terminal` is a CLI-first terminal automation tool for AI agents and humans. It creates long-lived PTY-backed sessions, exposes machine-friendly commands to control them, and produces inspectable artifacts such as semantic snapshots, PNG screenshots, asciicast recordings, and WebM exports. +`agent-tty` is a CLI-first terminal automation tool for AI agents and humans. It creates long-lived PTY-backed sessions, exposes machine-friendly commands to control them, and produces inspectable artifacts such as semantic snapshots, PNG screenshots, asciicast recordings, and WebM exports. The current implementation is a TypeScript/Node v1 with these main building blocks: @@ -13,7 +13,7 @@ The current implementation is a TypeScript/Node v1 with these main building bloc - **Vitest, ESLint, Prettier, and TypeScript** for quality gates. - **mise** as the canonical task runner in CI. -Session state is stored under `~/.agent-terminal` by default. In tests and automation, prefer an isolated absolute `AGENT_TERMINAL_HOME` instead of writing into the real home directory. +Session state is stored under `~/.agent-tty` by default. In tests and automation, prefer an isolated absolute `AGENT_TTY_HOME` instead of writing into the real home directory. # Reference @@ -105,12 +105,12 @@ bash dogfood/generate-week3-bundles.sh find dogfood -type f -name 'commands.sh' | sort ``` -Development server: **none**. This is a CLI project, so iterative development usually means running `npx tsx src/cli/main.ts ` against an isolated `AGENT_TERMINAL_HOME`. +Development server: **none**. This is a CLI project, so iterative development usually means running `npx tsx src/cli/main.ts ` against an isolated `AGENT_TTY_HOME`. # Patterns - **Do use `--json` for automation and prefer direct CLI invocation (`npx tsx src/cli/main.ts ...`) while developing.** Tests and design docs assume automation consumers read JSON envelopes. **Do not** scrape human-readable output when a JSON mode exists, and do not rely on noisy `npm run` wrappers when you need machine-parseable JSON. -- **Do isolate session homes in tests.** Follow the pattern in `test/helpers.ts` and `test/e2e/helpers.ts`: create a temp directory, set absolute `AGENT_TERMINAL_HOME`, clean it up, and destroy any surviving sessions. **Do not** let tests mutate `~/.agent-terminal`. +- **Do isolate session homes in tests.** Follow the pattern in `test/helpers.ts` and `test/e2e/helpers.ts`: create a temp directory, set absolute `AGENT_TTY_HOME`, clean it up, and destroy any surviving sessions. **Do not** let tests mutate `~/.agent-tty`. - **Do fail fast with assertions and schemas.** Existing code uses `invariant()`, `assertString()`, and `.safeParse()`/`.strict()` heavily. **Do not** silently coerce invalid paths, session IDs, or manifest data. - **Do preserve the event-log-as-truth model.** New snapshot, screenshot, wait, or export features should flow through replayable event/state data. **Do not** add one-off state that only live PTY code can see. - **Do keep storage writes inside validated helpers.** Path resolution in `src/storage/sessionPaths.ts`, manifest writers, and artifact helpers intentionally guard against path escape and invalid filenames. **Do not** write manifest-like files with ad hoc `fs.writeFile()` logic. @@ -118,7 +118,7 @@ Development server: **none**. This is a CLI project, so iterative development us - **Do update coupled limits together.** `src/host/eventLog.ts` and `src/host/replay.ts` both enforce the 50 MB event-log limit. **Do not** change one without the other. - **Do add tests at the right layer.** Small parser/validation changes usually belong in `test/unit`; CLI wiring and temp-home behavior fit `test/integration`; renderer/artifact flows belong in `test/e2e`. -- **Do keep the public `skills/agent-terminal/` artifact binary-first.** The committed public skill and public-facing skill docs must use `agent-terminal ...`, not repo-local `npx`, `tsx`, or `src/cli/main.ts` invocations. When you execute those examples from this source tree, translate them locally to `npx tsx src/cli/main.ts ...`, but do not commit that substitution back into the public skill or README skill-install guidance. +- **Do keep the public `skills/agent-tty/` artifact binary-first.** The committed public skill and public-facing skill docs must use `agent-tty ...`, not repo-local `npx`, `tsx`, or `src/cli/main.ts` invocations. When you execute those examples from this source tree, translate them locally to `npx tsx src/cli/main.ts ...`, but do not commit that substitution back into the public skill or README skill-install guidance. - **Do teach the terminal workflow the public skill is supposed to reinforce.** Prefer `--home`, `--json`, `run`, `wait`, `snapshot`, `screenshot`, and `record export` when writing or maintaining public skill examples. **Do not** teach `tmux`, blind `sleep`, or out-of-band screenshots as the primary workflow. ## Testing patterns diff --git a/README.md b/README.md index 6e6b643..5d7a97f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,33 @@ -# agent-terminal +# agent-tty -`agent-terminal` is a Node/TypeScript CLI for launching, controlling, inspecting, and exporting reviewable terminal sessions. +`agent-tty` is a Node/TypeScript CLI for launching, controlling, inspecting, and exporting reviewable terminal sessions. It is built for agent workflows that need both semantic state and visual artifacts from live or exited TUIs. ## Installation -`agent-terminal` currently supports Node `24.x`. -Today, the supported hosted install path is the GitHub Release tarball asset. npm publication is intentionally not wired yet, and direct git dependency installs remain best-effort because they build from source. +`agent-tty` currently supports Node `24.x`. +The recommended hosted install path is the npm package `agent-tty`. GitHub Release tarballs remain the registry-independent fallback, and direct git dependency installs remain best-effort because they build from source. + +### npm installation (recommended) + +#### Global install from npm + +```bash +PACKAGE_VERSION= +npm install -g "agent-tty@${PACKAGE_VERSION}" +agent-tty version --json +agent-tty --home "$(mktemp -d)" doctor --json +``` + +To follow the prerelease channel instead of pinning an exact version, substitute `@beta` (or another dist-tag such as `@rc`) for `@${PACKAGE_VERSION}`. + +#### Project-local install from npm + +```bash +PACKAGE_VERSION= +npm install "agent-tty@${PACKAGE_VERSION}" +./node_modules/.bin/agent-tty version --json +``` ### GitHub Release tarball installation @@ -15,11 +36,11 @@ Today, the supported hosted install path is the GitHub Release tarball asset. np ```bash VERSION= RELEASE_TAG="v${VERSION}" -RELEASE_TGZ="agent-terminal-${VERSION}.tgz" -TARBALL_URL="https://github.com/coder/agent-terminal/releases/download/${RELEASE_TAG}/${RELEASE_TGZ}" +RELEASE_TGZ="agent-tty-${VERSION}.tgz" +TARBALL_URL="https://github.com/coder/agent-tty/releases/download/${RELEASE_TAG}/${RELEASE_TGZ}" npm install -g "$TARBALL_URL" -agent-terminal version --json +agent-tty version --json ``` #### Authenticated or private release install @@ -27,22 +48,22 @@ agent-terminal version --json ```bash VERSION= RELEASE_TAG="v${VERSION}" -RELEASE_TGZ="agent-terminal-${VERSION}.tgz" +RELEASE_TGZ="agent-tty-${VERSION}.tgz" -gh release download "$RELEASE_TAG" --repo coder/agent-terminal --pattern "$RELEASE_TGZ" +gh release download "$RELEASE_TAG" --repo coder/agent-tty --pattern "$RELEASE_TGZ" npm install -g "./$RELEASE_TGZ" -agent-terminal version --json -agent-terminal --home "$(mktemp -d)" doctor --json +agent-tty version --json +agent-tty --home "$(mktemp -d)" doctor --json ``` #### Project-local install from a downloaded tarball ```bash VERSION= -RELEASE_TGZ="./agent-terminal-${VERSION}.tgz" +RELEASE_TGZ="./agent-tty-${VERSION}.tgz" npm install "$RELEASE_TGZ" -./node_modules/.bin/agent-terminal version --json +./node_modules/.bin/agent-tty version --json ``` ### Local tarball build from a source checkout @@ -55,18 +76,18 @@ npm ci npm run pack:private -- --pack-destination "$TARBALL_DIR" INSTALL_PREFIX=$(mktemp -d) -npm install -g --prefix "$INSTALL_PREFIX" "$TARBALL_DIR"/agent-terminal-*.tgz -"$INSTALL_PREFIX"/bin/agent-terminal version --json -"$INSTALL_PREFIX"/bin/agent-terminal --home "$(mktemp -d)" doctor --json +npm install -g --prefix "$INSTALL_PREFIX" "$TARBALL_DIR"/*.tgz +"$INSTALL_PREFIX"/bin/agent-tty version --json +"$INSTALL_PREFIX"/bin/agent-tty --home "$(mktemp -d)" doctor --json ``` -`npm run pack:private` always rebuilds `dist/` before packing. Release automation instead uses `npm run pack:release` after the CI-quality build step so GitHub Releases upload the same verified tarball plus a checksum file. +`npm run pack:private` always rebuilds `dist/` before packing. Release automation instead uses `npm run pack:release` after the CI-quality build step so GitHub Releases and the npm publish job both reuse the same verified tarball plus a checksum file. ### Git source installation (best-effort) ```bash -npm install -g github:coder/agent-terminal -agent-terminal version --json +npm install -g github:coder/agent-tty +agent-tty version --json ``` GitHub installs attempt to build from source via npm's `prepare` hook. @@ -80,11 +101,11 @@ If `doctor --json` reports a missing Playwright browser cache on a fresh machine ```bash AGENT_HOME="$(mktemp -d)" -agent-terminal --home "$AGENT_HOME" doctor --json -SESSION_ID=$(agent-terminal --home "$AGENT_HOME" create --json --name demo -- /bin/bash | jq -r '.result.sessionId') -agent-terminal --home "$AGENT_HOME" run "$SESSION_ID" 'echo hello from agent-terminal' --json -agent-terminal --home "$AGENT_HOME" snapshot "$SESSION_ID" --format text --json -agent-terminal --home "$AGENT_HOME" destroy "$SESSION_ID" --json +agent-tty --home "$AGENT_HOME" doctor --json +SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json --name demo -- /bin/bash | jq -r '.result.sessionId') +agent-tty --home "$AGENT_HOME" run "$SESSION_ID" 'echo hello from agent-tty' --json +agent-tty --home "$AGENT_HOME" snapshot "$SESSION_ID" --format text --json +agent-tty --home "$AGENT_HOME" destroy "$SESSION_ID" --json ``` ## Documentation map @@ -105,7 +126,7 @@ agent-terminal --home "$AGENT_HOME" destroy "$SESSION_ID" --json ## 0.1.0 release focus -`agent-terminal` `0.1.0` is the first release aimed at reliable, isolated, reviewable TUI automation. +`agent-tty` `0.1.0` is the first release aimed at reliable, isolated, reviewable TUI automation. For the explicit shipping contract, see [`RELEASE.md`](./RELEASE.md). For intentionally deferred work, see [`ROADMAP.md`](./ROADMAP.md). Reviewer-facing proof bundles are curated in [`dogfood/CATALOG.md`](./dogfood/CATALOG.md), with current release-signoff evidence in `dogfood/20260326-week9-release-readiness/` and evergreen workflow coverage such as `dogfood/run-command/`. @@ -115,12 +136,12 @@ For setup-heavy TUI automation, prefer an isolated home plus the higher-level `r ```bash AGENT_HOME="$(mktemp -d)" -agent-terminal --home "$AGENT_HOME" doctor --json -SESSION_ID=$(agent-terminal --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') -agent-terminal --home "$AGENT_HOME" run "$SESSION_ID" 'npm install' -agent-terminal --home "$AGENT_HOME" wait "$SESSION_ID" --text 'ready' -agent-terminal --home "$AGENT_HOME" screenshot "$SESSION_ID" -agent-terminal --home "$AGENT_HOME" record export "$SESSION_ID" --format webm +agent-tty --home "$AGENT_HOME" doctor --json +SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') +agent-tty --home "$AGENT_HOME" run "$SESSION_ID" 'npm install' +agent-tty --home "$AGENT_HOME" wait "$SESSION_ID" --text 'ready' +agent-tty --home "$AGENT_HOME" screenshot "$SESSION_ID" +agent-tty --home "$AGENT_HOME" record export "$SESSION_ID" --format webm ``` Recommended sequence: @@ -134,61 +155,62 @@ Recommended sequence: ## AI agent skill -The public skill lives under `skills/agent-terminal/` and ships in the release tarball package. -Install `agent-terminal` from a GitHub Release tarball first, then either use the packaged skill directly or let TanStack Intent map it into your agent config. +The public skill lives under `skills/agent-tty/` and ships in the npm package as well as the GitHub Release tarball. +Install `agent-tty` from npm first (or from a GitHub Release tarball when you need a registry-independent fallback), then either use the packaged skill directly or let TanStack Intent map it into your agent config. -For coding agents that can ingest instructions on demand, `agent-terminal skill` prints the packaged `SKILL.md` directly to stdout after installation. +For coding agents that can ingest instructions on demand, `agent-tty skill` prints the packaged `SKILL.md` directly to stdout after installation. ```bash -agent-terminal skill +agent-tty skill ``` ### TanStack Intent integration -After downloading `agent-terminal-.tgz` from GitHub Releases, install it in the project and let Intent wire the mapping into `AGENTS.md`, `CLAUDE.md`, or another supported agent config file. +After installing `agent-tty` in the project, let Intent wire the mapping into `AGENTS.md`, `CLAUDE.md`, or another supported agent config file. ```bash -npm install ./agent-terminal-.tgz +PACKAGE_VERSION= +npm install "agent-tty@${PACKAGE_VERSION}" npx @tanstack/intent@latest list npx @tanstack/intent@latest install ``` -That workflow keeps the skill version aligned with the installed `agent-terminal` package and avoids writing one-off instructions for each individual coding agent. +That workflow keeps the skill version aligned with the installed `agent-tty` package and avoids writing one-off instructions for each individual coding agent. ### Mux skill installation -After installing the release tarball globally: +After installing the npm package globally: ```bash -mkdir -p ~/.mux/skills/agent-terminal -cp -R "$(npm root -g)/agent-terminal/skills/agent-terminal/." ~/.mux/skills/agent-terminal/ +mkdir -p ~/.mux/skills/agent-tty +cp -R "$(npm root -g)/agent-tty/skills/agent-tty/." ~/.mux/skills/agent-tty/ ``` ### Direct skill copy for other skill loaders -After installing the release tarball globally: +After installing the npm package globally: ```bash -mkdir -p ~/.claude/skills/agent-terminal -cp -R "$(npm root -g)/agent-terminal/skills/agent-terminal/." ~/.claude/skills/agent-terminal/ +mkdir -p ~/.claude/skills/agent-tty +cp -R "$(npm root -g)/agent-tty/skills/agent-tty/." ~/.claude/skills/agent-tty/ ``` -If your assistant supports repository-backed skills, point it at `coder/agent-terminal` and select the `agent-terminal` skill directory. +If your assistant supports repository-backed skills, point it at `coder/agent-tty` and select the `agent-tty` skill directory. ### Suggested `AGENTS.md` / `CLAUDE.md` snippet ```markdown ## Terminal Automation -Use `agent-terminal` for terminal and TUI automation instead of `tmux`, ad hoc PTY wrappers, or external screenshot tools. +Use `agent-tty` for terminal and TUI automation instead of `tmux`, ad hoc PTY wrappers, or external screenshot tools. Preferred workflow: -1. Create an isolated home and session with `agent-terminal --home "$AGENT_HOME" create --json -- /bin/bash`. -2. Use `agent-terminal run` for setup and bootstrap commands. -3. Use `agent-terminal wait` for observable readiness instead of blind sleeps. -4. Use `agent-terminal snapshot` to inspect the current terminal state. -5. Use `agent-terminal screenshot` or `agent-terminal record export` for reviewer-facing artifacts. +1. Create an isolated home and session with `agent-tty --home "$AGENT_HOME" create --json -- /bin/bash`. +2. Use `agent-tty run` for setup and bootstrap commands. +3. Use `agent-tty wait` for observable readiness instead of blind sleeps. +4. Use `agent-tty snapshot` to inspect the current terminal state. +5. Use `agent-tty screenshot` or `agent-tty record export` for reviewer-facing artifacts. 6. Destroy the session when the task is done. ``` @@ -200,11 +222,11 @@ npm run intent:validate ## Isolation -- `--home ` stores manifests, sockets, event logs, and artifacts under an isolated agent-terminal home. Pass the same `--home` value to each command in a workflow. -- `doctor --json` reports whether `agent-terminal` is using the default location or an isolated home, including a `home_isolation` check for whether `--home` produced an isolated environment. +- `--home ` stores manifests, sockets, event logs, and artifacts under an isolated agent-tty home. Pass the same `--home` value to each command in a workflow. +- `doctor --json` reports whether `agent-tty` is using the default location or an isolated home, including a `home_isolation` check for whether `--home` produced an isolated environment. - It also exposes `browser_cache_accessible`, which verifies the Playwright browser cache is discoverable for renderer operations before screenshot/export flows. - Renderer boot now carries Playwright browser-cache resolution into isolated-home workflows automatically when Chromium is installed in the normal cache or exposed through `PLAYWRIGHT_BROWSERS_PATH`. -- In a new machine, CI job, or container, run `agent-terminal --home doctor --json` before starting screenshot or recording workflows. +- In a new machine, CI job, or container, run `agent-tty --home doctor --json` before starting screenshot or recording workflows. ## Platform Support @@ -214,7 +236,7 @@ npm run intent:validate ## CLI-wide flags -- `--home `: override the agent-terminal home directory. +- `--home `: override the agent-tty home directory. - `--timeout-ms `: apply a shared CLI timeout budget in milliseconds. - `--no-color`: disable ANSI color in human-readable output. - `--json`: available on user-facing commands to emit structured command envelopes. @@ -245,10 +267,10 @@ npm run intent:validate Basic usage: ```bash -agent-terminal run [command] -agent-terminal run --file ./setup.sh -agent-terminal run 'npm install && npm test' --timeout 60000 --json -agent-terminal run 'npm run dev' --no-wait +agent-tty run [command] +agent-tty run --file ./setup.sh +agent-tty run 'npm install && npm test' --timeout 60000 --json +agent-tty run 'npm run dev' --no-wait ``` Important flags: @@ -289,7 +311,7 @@ For contributor workflow and release hygiene, see [`docs/CONTRIBUTING.md`](./doc ## Design docs Design and implementation notes live under [`design/`](./design/README.md). -Start with [`design/ARCHITECTURE.md`](./design/ARCHITECTURE.md) for the stable overview, use [`design/20260319_agent-terminal-v1/`](./design/20260319_agent-terminal-v1/) for the active reference set, and use [`design/archive/`](./design/archive/) for week-by-week project history. +Start with [`design/ARCHITECTURE.md`](./design/ARCHITECTURE.md) for the stable overview, use [`design/20260319_agent-tty-v1/`](./design/20260319_agent-tty-v1/) for the active reference set, and use [`design/archive/`](./design/archive/) for week-by-week project history. ## Repository notes diff --git a/RELEASE.md b/RELEASE.md index b85c672..c2e807f 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,13 +1,13 @@ -# agent-terminal 0.1.0 release contract +# agent-tty 0.1.0 release contract -`agent-terminal` `0.1.0` is the first release that explicitly targets isolated, reviewable terminal automation for real TUI workflows. +`agent-tty` `0.1.0` is the first release that explicitly targets isolated, reviewable terminal automation for real TUI workflows. The contract below is the bar for what maintainers should feel comfortable supporting at release time. If a workflow depends on behavior outside this document, treat it as future-scope or best-effort rather than a guaranteed `0.1.0` capability. For intentionally deferred work, see [`ROADMAP.md`](./ROADMAP.md). For reviewer-facing proof bundles, start with [`dogfood/CATALOG.md`](./dogfood/CATALOG.md). ## What 0.1.0 delivers -- Reliable isolated session lifecycle management: `create`, `inspect`, `destroy`, and `gc` all work against isolated agent-terminal homes. +- Reliable isolated session lifecycle management: `create`, `inspect`, `destroy`, and `gc` all work against isolated agent-tty homes. - Renderer-backed screenshots, semantic snapshots, and WebM export for reviewer-visible proof artifacts. - The `run` command for robust in-session command execution without having to simulate long shell setup scripts as manual keystrokes. - `doctor --json` with isolation-aware diagnostics for home resolution, renderer prerequisites, and screenshot viability. diff --git a/ROADMAP.md b/ROADMAP.md index fa5a837..144b756 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,4 +1,4 @@ -# agent-terminal roadmap +# agent-tty roadmap `RELEASE.md` defines what `0.1.0` ships today. This roadmap tracks intentionally deferred work and post-release direction so the repository front door separates shipped scope from future scope. For historical week-by-week planning and status context, see [`design/archive/`](./design/archive/). For the stable design overview, see [`design/ARCHITECTURE.md`](./design/ARCHITECTURE.md). diff --git a/design/20260319_agent-terminal-v1/01-architecture.md b/design/20260319_agent-tty-v1/01-architecture.md similarity index 98% rename from design/20260319_agent-terminal-v1/01-architecture.md rename to design/20260319_agent-tty-v1/01-architecture.md index e6a132c..5eeabff 100644 --- a/design/20260319_agent-terminal-v1/01-architecture.md +++ b/design/20260319_agent-tty-v1/01-architecture.md @@ -1,10 +1,10 @@ -# agent-terminal v1 architecture +# agent-tty v1 architecture ## 1. Design principles ### 1.1 General-purpose first -`agent-terminal` must be useful outside Mux. +`agent-tty` must be useful outside Mux. Concretely, that means: @@ -80,18 +80,18 @@ A per-session host gives simpler isolation: Public binary: -- `agent-terminal` +- `agent-tty` Internal host entrypoint: -- `agent-terminal _host --session-id ...` +- `agent-tty _host --session-id ...` The internal `_host` subcommand is not documented for end users and may change without semver guarantees. ## 3. Suggested repository layout for a standalone implementation ```text -agent-terminal/ +agent-tty/ ├── src/ │ ├── cli/ │ │ ├── main.ts @@ -151,7 +151,7 @@ agent-terminal/ ## 4. Session directory layout ```text -~/.agent-terminal/ +~/.agent-tty/ ├── config.json ├── sessions/ │ └── / diff --git a/design/20260319_agent-terminal-v1/02-cli-contract.md b/design/20260319_agent-tty-v1/02-cli-contract.md similarity index 89% rename from design/20260319_agent-terminal-v1/02-cli-contract.md rename to design/20260319_agent-tty-v1/02-cli-contract.md index 4cdecaa..e389633 100644 --- a/design/20260319_agent-terminal-v1/02-cli-contract.md +++ b/design/20260319_agent-tty-v1/02-cli-contract.md @@ -1,4 +1,4 @@ -# agent-terminal v1 CLI contract +# agent-tty v1 CLI contract This document defines the concrete v1 CLI contract. @@ -66,7 +66,7 @@ Failure envelope: "retryable": false, "details": { "sessionId": "missing-session", - "manifestPath": "/tmp/agent-terminal/sessions/missing-session/session.json" + "manifestPath": "/tmp/agent-tty/sessions/missing-session/session.json" } } } @@ -95,7 +95,7 @@ All public commands should support these where sensible: | Flag | Meaning | | --------------------- | --------------------------------------------------- | | `--json` | Emit JSON envelope | -| `--home ` | Override `~/.agent-terminal` | +| `--home ` | Override `~/.agent-tty` | | `--log-level ` | `error`, `warn`, `info`, `debug`, `trace` | | `--timeout-ms ` | Command timeout | | `--profile ` | Render profile override for render-related commands | @@ -114,11 +114,11 @@ Resolved config order: | Variable | Meaning | | ----------------------------- | -------------------------------------- | -| `AGENT_TERMINAL_HOME` | Override home directory | -| `AGENT_TERMINAL_LOG_LEVEL` | Logging default | -| `AGENT_TERMINAL_PROFILE` | Default render profile | -| `AGENT_TERMINAL_BROWSER_PATH` | Override Playwright browser executable | -| `AGENT_TERMINAL_KEEP_TEMP` | Preserve temp replay outputs | +| `AGENT_TTY_HOME` | Override home directory | +| `AGENT_TTY_LOG_LEVEL` | Logging default | +| `AGENT_TTY_PROFILE` | Default render profile | +| `AGENT_TTY_BROWSER_PATH` | Override Playwright browser executable | +| `AGENT_TTY_KEEP_TEMP` | Preserve temp replay outputs | ## 4. Resource identifiers @@ -148,9 +148,9 @@ Create a new session host and spawn a PTY child. ### 5.1 Syntax ```bash -agent-terminal create [options] [command...] -agent-terminal create [options] -agent-terminal create [options] --shell /bin/zsh +agent-tty create [options] [command...] +agent-tty create [options] +agent-tty create [options] --shell /bin/zsh ``` ### 5.2 Required behavior @@ -209,7 +209,7 @@ List sessions known in the home directory. ### 6.1 Syntax ```bash -agent-terminal list [--all] [--json] +agent-tty list [--all] [--json] ``` ### 6.2 Behavior @@ -237,8 +237,8 @@ Return the shipped merged session summary for one session. ### 7.1 Syntax ```bash -agent-terminal inspect -agent-terminal inspect --json +agent-tty inspect +agent-tty inspect --json ``` ### 7.2 Behavior @@ -317,9 +317,9 @@ Write raw UTF-8 text bytes into the PTY. ### 8.1 Syntax ```bash -agent-terminal type 'hello world' -agent-terminal type --file ./payload.txt -agent-terminal type 'hello world' --append-newline +agent-tty type 'hello world' +agent-tty type --file ./payload.txt +agent-tty type 'hello world' --append-newline ``` ### 8.2 Flags @@ -344,8 +344,8 @@ Write text as a paste operation. ### 9.1 Syntax ```bash -agent-terminal paste 'multiline\ninput' -agent-terminal paste --file ./payload.txt +agent-tty paste 'multiline\ninput' +agent-tty paste --file ./payload.txt ``` ### 9.2 Semantics @@ -367,9 +367,9 @@ Send named keys and chords. ### 10.1 Syntax ```bash -agent-terminal send-keys Enter -agent-terminal send-keys ctrl+l g g -agent-terminal send-keys alt+shift+f10 +agent-tty send-keys Enter +agent-tty send-keys ctrl+l g g +agent-tty send-keys alt+shift+f10 ``` ### 10.2 Key grammar @@ -414,7 +414,7 @@ Resize the terminal. ### 11.1 Syntax ```bash -agent-terminal resize --rows 50 --cols 140 +agent-tty resize --rows 50 --cols 140 ``` ### 11.2 Required behavior @@ -438,8 +438,8 @@ Send a process signal to the PTY child. ### 12.1 Syntax ```bash -agent-terminal signal INT -agent-terminal signal TERM +agent-tty signal INT +agent-tty signal TERM ``` ### 12.2 Required behavior @@ -466,11 +466,11 @@ V1 should support: ### 13.2 Syntax examples ```bash -agent-terminal wait --text 'Ready' -agent-terminal wait --regex 'Connected: .*' -agent-terminal wait --idle-ms 250 -agent-terminal wait --screen-stable-ms 300 -agent-terminal wait --exit +agent-tty wait --text 'Ready' +agent-tty wait --regex 'Connected: .*' +agent-tty wait --idle-ms 250 +agent-tty wait --screen-stable-ms 300 +agent-tty wait --exit ``` ### 13.3 Semantics @@ -515,10 +515,10 @@ Capture semantic terminal state. ### 14.1 Syntax ```bash -agent-terminal snapshot -agent-terminal snapshot --format text -agent-terminal snapshot --include-scrollback -agent-terminal snapshot --include-scrollback --include-cells --json +agent-tty snapshot +agent-tty snapshot --format text +agent-tty snapshot --include-scrollback +agent-tty snapshot --include-scrollback --include-cells --json ``` ### 14.2 Formats @@ -558,10 +558,10 @@ Capture a PNG screenshot from the selected renderer backend. ### 15.1 Syntax ```bash -agent-terminal screenshot -agent-terminal screenshot --profile reference-light -agent-terminal screenshot --show-cursor -agent-terminal screenshot --hide-cursor +agent-tty screenshot +agent-tty screenshot --profile reference-light +agent-tty screenshot --show-cursor +agent-tty screenshot --hide-cursor ``` ### 15.2 Required behavior @@ -581,7 +581,7 @@ agent-terminal screenshot --hide-cursor "profileName": "reference-dark", "cols": 120, "rows": 40, - "artifactPath": "/home/user/.agent-terminal/sessions/.../artifacts/screenshot-85-reference-dark.png", + "artifactPath": "/home/user/.agent-tty/sessions/.../artifacts/screenshot-85-reference-dark.png", "pngSizeBytes": 123456, "cursorVisible": false, "rendererBackend": "ghostty-web", @@ -604,8 +604,8 @@ Export a replay artifact. ### 16.2 Syntax ```bash -agent-terminal record export --format asciicast --out ./run.cast -agent-terminal record export --format webm --out ./run.webm +agent-tty record export --format asciicast --out ./run.cast +agent-tty record export --format webm --out ./run.webm ``` ### 16.3 Semantics @@ -621,8 +621,8 @@ Terminate session control. ### 17.1 Syntax ```bash -agent-terminal destroy -agent-terminal destroy --force +agent-tty destroy +agent-tty destroy --force ``` ### 17.2 Semantics @@ -648,8 +648,8 @@ Garbage-collect old sessions and temp artifacts. ### 18.1 Syntax ```bash -agent-terminal gc --older-than 7d -agent-terminal gc --stale-only +agent-tty gc --older-than 7d +agent-tty gc --stale-only ``` ### 18.2 Behavior diff --git a/design/20260319_agent-terminal-v1/03-rendering-and-artifacts.md b/design/20260319_agent-tty-v1/03-rendering-and-artifacts.md similarity index 99% rename from design/20260319_agent-terminal-v1/03-rendering-and-artifacts.md rename to design/20260319_agent-tty-v1/03-rendering-and-artifacts.md index b1065eb..83f1eda 100644 --- a/design/20260319_agent-terminal-v1/03-rendering-and-artifacts.md +++ b/design/20260319_agent-tty-v1/03-rendering-and-artifacts.md @@ -1,6 +1,6 @@ -# agent-terminal v1 rendering and artifacts +# agent-tty v1 rendering and artifacts -This document defines how `agent-terminal` turns PTY activity into inspectable artifacts. +This document defines how `agent-tty` turns PTY activity into inspectable artifacts. ## 1. Rendering philosophy diff --git a/design/20260319_agent-terminal-v1/04-implementation-plan.md b/design/20260319_agent-tty-v1/04-implementation-plan.md similarity index 98% rename from design/20260319_agent-terminal-v1/04-implementation-plan.md rename to design/20260319_agent-tty-v1/04-implementation-plan.md index c3341bc..88fc5af 100644 --- a/design/20260319_agent-terminal-v1/04-implementation-plan.md +++ b/design/20260319_agent-tty-v1/04-implementation-plan.md @@ -1,4 +1,4 @@ -# agent-terminal v1 implementation plan +# agent-tty v1 implementation plan This plan is written so a follow-up AI coding agent can execute against it directly. @@ -132,8 +132,8 @@ Create the initial project scaffold and the fundamental types. ### Dogfooding gate -- run `agent-terminal version --json`, -- run `agent-terminal doctor --json`, +- run `agent-tty version --json`, +- run `agent-tty doctor --json`, - capture a screenshot of the CLI output, - record a short terminal video showing both commands, - store artifacts under `dogfood/phase-0/`. @@ -413,7 +413,7 @@ Fixture apps under `test/fixtures/apps/`: ### Acceptance criteria -- every fixture can be launched by `agent-terminal create -- ...`, +- every fixture can be launched by `agent-tty create -- ...`, - every fixture is used by at least one integration or e2e test, - the final proof bundle contains screenshots and videos for the critical flows. diff --git a/design/20260319_agent-terminal-v1/05-dogfooding-and-validation.md b/design/20260319_agent-tty-v1/05-dogfooding-and-validation.md similarity index 99% rename from design/20260319_agent-terminal-v1/05-dogfooding-and-validation.md rename to design/20260319_agent-tty-v1/05-dogfooding-and-validation.md index 89aac09..9f2c983 100644 --- a/design/20260319_agent-terminal-v1/05-dogfooding-and-validation.md +++ b/design/20260319_agent-tty-v1/05-dogfooding-and-validation.md @@ -1,6 +1,6 @@ -# agent-terminal v1 dogfooding and validation +# agent-tty v1 dogfooding and validation -This document defines how to prove that `agent-terminal` actually works for TUI dogfooding. +This document defines how to prove that `agent-tty` actually works for TUI dogfooding. It is intentionally prescriptive. @@ -501,7 +501,7 @@ Every scenario directory should include `notes.md` using a template like: ## Command under test -`agent-terminal ...` +`agent-tty ...` ## Expected behavior diff --git a/design/ARCHITECTURE.md b/design/ARCHITECTURE.md index 0ef97f7..9aa2a35 100644 --- a/design/ARCHITECTURE.md +++ b/design/ARCHITECTURE.md @@ -3,9 +3,9 @@ author: "@mux" date: 2026-03-19 --- -# agent-terminal architecture overview +# agent-tty architecture overview -`agent-terminal` is a CLI-first terminal automation system for AI agents and humans. +`agent-tty` is a CLI-first terminal automation system for AI agents and humans. It is designed to let an agent: @@ -17,7 +17,7 @@ It is designed to let an agent: - export replay artifacts that reviewers can inspect, - and later swap the reference renderer for native terminal backends. -This design intentionally describes a **general product**, not a Mux-specific implementation. A future Mux integration should consume `agent-terminal` as an external CLI/runtime rather than baking Mux-specific assumptions into the design. +This design intentionally describes a **general product**, not a Mux-specific implementation. A future Mux integration should consume `agent-tty` as an external CLI/runtime rather than baking Mux-specific assumptions into the design. ## Current shipped status (2026-03-26) @@ -48,7 +48,7 @@ The stable contract and deferred work now have dedicated homes: use [`../RELEASE The recommended v1 shape is: -1. **CLI-first** public surface: `agent-terminal ...` +1. **CLI-first** public surface: `agent-tty ...` 2. **No MCP in v1** 3. **TypeScript/Node** implementation 4. **One session-host process per terminal session**, not a global daemon @@ -103,7 +103,7 @@ This shape optimizes for the constraints discussed so far: The public contract is the CLI and its JSON output, not an internal RPC API and not Mux tools. -This keeps `agent-terminal` reusable by: +This keeps `agent-tty` reusable by: - AI coding agents, - shell scripts, @@ -170,7 +170,7 @@ The architecture reserves native backends for later: ## Tiered truth model -`agent-terminal` should treat terminal truth as layered rather than singular. +`agent-tty` should treat terminal truth as layered rather than singular. | Layer | Source of truth | What it answers | | ---------------------- | --------------------------- | --------------------------------------------------------- | @@ -197,15 +197,15 @@ Asciicast and replay-video export remain intended follow-on capabilities rather ## Deliverables in this design set -This design file is the entry point. Detailed supporting docs live in the active reference set under `design/20260319_agent-terminal-v1/`, while historical planning/status material lives under `design/archive/`. +This design file is the entry point. Detailed supporting docs live in the active reference set under `design/20260319_agent-tty-v1/`, while historical planning/status material lives under `design/archive/`. ### Active reference set -- [01-architecture.md](./20260319_agent-terminal-v1/01-architecture.md) -- [02-cli-contract.md](./20260319_agent-terminal-v1/02-cli-contract.md) -- [03-rendering-and-artifacts.md](./20260319_agent-terminal-v1/03-rendering-and-artifacts.md) -- [04-implementation-plan.md](./20260319_agent-terminal-v1/04-implementation-plan.md) -- [05-dogfooding-and-validation.md](./20260319_agent-terminal-v1/05-dogfooding-and-validation.md) +- [01-architecture.md](./20260319_agent-tty-v1/01-architecture.md) +- [02-cli-contract.md](./20260319_agent-tty-v1/02-cli-contract.md) +- [03-rendering-and-artifacts.md](./20260319_agent-tty-v1/03-rendering-and-artifacts.md) +- [04-implementation-plan.md](./20260319_agent-tty-v1/04-implementation-plan.md) +- [05-dogfooding-and-validation.md](./20260319_agent-tty-v1/05-dogfooding-and-validation.md) ### Historical archive @@ -226,8 +226,8 @@ This design file is the entry point. Detailed supporting docs live in the active ```mermaid flowchart TD - CLI["agent-terminal CLI"] --> SessionCtl["Session host control socket"] - CLI --> Home["~/.agent-terminal"] + CLI["agent-tty CLI"] --> SessionCtl["Session host control socket"] + CLI --> Home["~/.agent-tty"] SessionCtl --> Host["Per-session host process"] Host --> PTY["node-pty PTY child"] diff --git a/design/README.md b/design/README.md index 2a2bc8f..64a9f20 100644 --- a/design/README.md +++ b/design/README.md @@ -6,19 +6,19 @@ The active reference set stays separate from the week-by-week project history so ## Start here 1. [`ARCHITECTURE.md`](./ARCHITECTURE.md) — stable product and architecture overview. -2. [`20260319_agent-terminal-v1/02-cli-contract.md`](./20260319_agent-terminal-v1/02-cli-contract.md) — CLI contract details. -3. [`20260319_agent-terminal-v1/03-rendering-and-artifacts.md`](./20260319_agent-terminal-v1/03-rendering-and-artifacts.md) — replay, screenshot, and export model. -4. [`20260319_agent-terminal-v1/05-dogfooding-and-validation.md`](./20260319_agent-terminal-v1/05-dogfooding-and-validation.md) — proof-bundle expectations. +2. [`20260319_agent-tty-v1/02-cli-contract.md`](./20260319_agent-tty-v1/02-cli-contract.md) — CLI contract details. +3. [`20260319_agent-tty-v1/03-rendering-and-artifacts.md`](./20260319_agent-tty-v1/03-rendering-and-artifacts.md) — replay, screenshot, and export model. +4. [`20260319_agent-tty-v1/05-dogfooding-and-validation.md`](./20260319_agent-tty-v1/05-dogfooding-and-validation.md) — proof-bundle expectations. ## Active reference set The original v1 design review produced a focused reference set that is still useful as evergreen technical documentation: -- [`20260319_agent-terminal-v1/01-architecture.md`](./20260319_agent-terminal-v1/01-architecture.md) -- [`20260319_agent-terminal-v1/02-cli-contract.md`](./20260319_agent-terminal-v1/02-cli-contract.md) -- [`20260319_agent-terminal-v1/03-rendering-and-artifacts.md`](./20260319_agent-terminal-v1/03-rendering-and-artifacts.md) -- [`20260319_agent-terminal-v1/04-implementation-plan.md`](./20260319_agent-terminal-v1/04-implementation-plan.md) -- [`20260319_agent-terminal-v1/05-dogfooding-and-validation.md`](./20260319_agent-terminal-v1/05-dogfooding-and-validation.md) +- [`20260319_agent-tty-v1/01-architecture.md`](./20260319_agent-tty-v1/01-architecture.md) +- [`20260319_agent-tty-v1/02-cli-contract.md`](./20260319_agent-tty-v1/02-cli-contract.md) +- [`20260319_agent-tty-v1/03-rendering-and-artifacts.md`](./20260319_agent-tty-v1/03-rendering-and-artifacts.md) +- [`20260319_agent-tty-v1/04-implementation-plan.md`](./20260319_agent-tty-v1/04-implementation-plan.md) +- [`20260319_agent-tty-v1/05-dogfooding-and-validation.md`](./20260319_agent-tty-v1/05-dogfooding-and-validation.md) ## Historical archive diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 5bd0c93..008e4b4 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -20,7 +20,7 @@ npx playwright install chromium - Use `npx tsx src/cli/main.ts ...` while developing from the source tree. - Prefer `--json` when a workflow needs machine-readable output. -- Use an isolated absolute `AGENT_TERMINAL_HOME` for tests and manual dogfooding. +- Use an isolated absolute `AGENT_TTY_HOME` for tests and manual dogfooding. - Keep storage writes, manifests, and protocol updates inside the existing validated helpers and schemas. ## Validation @@ -52,4 +52,4 @@ npm run intent:validate - Keep the root docs split clear: `README.md` for overview, `RELEASE.md` for current scope, `ROADMAP.md` for future scope. - Update [`design/README.md`](../design/README.md) when the active vs archived design split changes. - Update [`dogfood/CATALOG.md`](../dogfood/CATALOG.md) when you add or promote a reviewer-facing proof bundle. -- Prefer public `agent-terminal ...` invocations in shipped skill/docs examples; do not commit repo-local `npx tsx src/cli/main.ts ...` substitutions into public-facing examples. +- Prefer public `agent-tty ...` invocations in shipped skill/docs examples; do not commit repo-local `npx tsx src/cli/main.ts ...` substitutions into public-facing examples. diff --git a/docs/RELEASE-PROCESS.md b/docs/RELEASE-PROCESS.md index fd0ec3e..7cae60b 100644 --- a/docs/RELEASE-PROCESS.md +++ b/docs/RELEASE-PROCESS.md @@ -1,6 +1,21 @@ # Release process -`RELEASE.md` defines the shipping contract. This document describes how maintainers should validate, version, tag, and publish that contract on GitHub Releases. +`RELEASE.md` defines the shipping contract. This document describes how maintainers should validate, version, tag, and publish that contract on GitHub Releases and npm. + +## One-time npm trusted publishing setup + +1. Ensure the intended npm package name remains `agent-tty`. +2. On npm, configure trusted publishing for `agent-tty` with these GitHub Actions settings: + - organization or user: `coder` + - repository: `agent-tty` + - workflow filename: `release.yml` (the workflow file committed at `.github/workflows/release.yml`) + - environment name: leave empty unless this workflow later adds a protected GitHub environment for publishing +3. After the first successful trusted publish, restrict the package's npm publishing access to require 2FA and disallow traditional tokens. +4. Keep the package metadata aligned with npm provenance expectations: + - `package.json.name` must stay `agent-tty` + - `package.json.repository.url` must stay `git+https://github.com/coder/agent-tty.git` + - `package.json.publishConfig.registry` must stay `https://registry.npmjs.org/` +5. No GitHub Actions secret is required for npm publishing in this flow; the workflow uses GitHub-hosted runners plus OIDC trusted publishing. ## Release prerequisites @@ -8,7 +23,7 @@ 2. Re-read [`../ROADMAP.md`](../ROADMAP.md) and confirm deferred work is not mixed back into the release contract. 3. Verify the primary docs route correctly from [`../README.md`](../README.md) to release, roadmap, design, and dogfood materials. 4. Review [`../dogfood/CATALOG.md`](../dogfood/CATALOG.md) and make sure the release-signoff bundle is current and easy to find. -5. Confirm npm publication is still intentionally out of scope for this workflow; the supported hosted install path today is the GitHub Release tarball asset. +5. Confirm the published package metadata still points at `agent-tty` and the public GitHub repository. 6. Remember that `main` is protected: release changes must land through a pull request, and the release tag must be created only after that PR is merged. ## Validation bar @@ -31,7 +46,7 @@ If the public skill changed, also run: npm run intent:validate ``` -`mise run ci` exercises formatting, lint, typecheck, tests, build, and the install smoke. The install smoke validates the shared release tarball packer plus the guaranteed tarball install route before any publish step runs. +`mise run ci` exercises formatting, lint, typecheck, tests, build, and the install smoke. The install smoke validates the shared release tarball packer plus the required tarball install route before any publish step runs. ## Prepare the release asset locally (optional but recommended) @@ -45,7 +60,7 @@ cat "$RELEASE_DIR/package-metadata.json" sha256sum -c "$RELEASE_DIR"/*.tgz.sha256 ``` -That command produces the same tarball, checksum, and metadata shape that the GitHub release workflow uploads. +That command produces the same tarball, checksum, and metadata shape that the GitHub release workflow uploads and later reuses for npm publishing. ## Release flow overview @@ -55,7 +70,7 @@ Because `main` is pull-request-only, the correct release flow is: 2. bump the version **without creating a tag yet**, 3. open and merge a PR, 4. tag the merged `main` commit, -5. let the `Release` workflow publish the GitHub Release assets. +5. let the `Release` workflow publish the GitHub Release assets and npm package. Do **not** run `npm version ...` on `main` and then push `HEAD --follow-tags`; GitHub will reject the protected-branch push but still accept the tag, which can start a release from an unmerged commit. @@ -108,7 +123,7 @@ Release candidate with an exact version: npm version 0.1.1-rc.0 --no-git-tag-version ``` -Versions containing a hyphen, such as `-beta.0` or `-rc.0`, are published by the workflow as GitHub prereleases. +Versions containing a hyphen, such as `-beta.0` or `-rc.0`, are published by the workflow as GitHub prereleases and published to the matching npm dist-tag (`beta`, `rc`, and so on). ### Open the release PR @@ -149,7 +164,7 @@ or: - `package.json`: `0.1.1-beta.0` - tag: `v0.1.1-beta.0` -## Publish the GitHub Release +## Publish the GitHub Release and npm package The hand-curated workflow lives at [`.github/workflows/release.yml`](../.github/workflows/release.yml). It triggers automatically on pushed `v*` tags, and it can also be rerun manually for an already-existing remote tag via the **Release** workflow's `tag` input. @@ -162,33 +177,72 @@ The workflow will: - run `mise run ci`, - pack the verified tarball with `npm run pack:release`, - upload the tarball, checksum, and metadata JSON as workflow artifacts, -- and create or update the GitHub Release with the `.tgz` and `.sha256` assets attached. +- create or update the GitHub Release with the `.tgz` and `.sha256` assets attached, +- and publish that same verified tarball to npm via trusted publishing on a GitHub-hosted runner. -The workflow intentionally splits artifact preparation from GitHub release publication so a future npm-publish job can depend on the verified `prepare-release` outputs instead of rebuilding the package. +Stable releases publish with npm's default `latest` dist-tag. +Prerelease versions publish with the prerelease identifier as the dist-tag, so `0.1.1-beta.0` publishes to the `beta` dist-tag and `0.1.1-rc.1` publishes to the `rc` dist-tag. -## Verify the published release assets +## Verify the published npm package -After the workflow succeeds, verify the hosted asset before announcing the release: +After the workflow succeeds, verify the exact npm package version before announcing the release: + +```bash +PACKAGE_NAME='agent-tty' +PACKAGE_VERSION='' +INSTALL_PREFIX=$(mktemp -d) +AGENT_TTY_HOME=$(mktemp -d) + +npm view "$PACKAGE_NAME" dist-tags --json +npm install -g --prefix "$INSTALL_PREFIX" "$PACKAGE_NAME@$PACKAGE_VERSION" +"$INSTALL_PREFIX"/bin/agent-tty version --json +"$INSTALL_PREFIX"/bin/agent-tty --home "$AGENT_TTY_HOME" doctor --json +``` + +If the release is a prerelease, also confirm the intended dist-tag points at the exact published version: + +```bash +PACKAGE_NAME='agent-tty' +PACKAGE_VERSION='' +DIST_TAG=$(node --input-type=module <<'EOF_NODE' +const version = process.env.PACKAGE_VERSION; +if (!version.includes('-')) { + process.stdout.write('latest'); + process.exit(0); +} +const prerelease = version.split('-', 2)[1] ?? ''; +const distTag = prerelease.split('.', 1)[0] ?? ''; +if (distTag.length === 0) { + throw new Error(`unable to derive dist-tag from ${version}`); +} +process.stdout.write(distTag); +EOF_NODE +) + +npm view "$PACKAGE_NAME" dist-tags --json +printf 'expected dist-tag %s for %s\n' "$DIST_TAG" "$PACKAGE_VERSION" +``` + +## Verify the published GitHub Release assets + +Also verify the hosted tarball fallback before announcing the release: ```bash VERSION= RELEASE_TAG="v${VERSION}" -RELEASE_TGZ="agent-terminal-${VERSION}.tgz" +RELEASE_TGZ="agent-tty-${VERSION}.tgz" DOWNLOAD_DIR=$(mktemp -d) INSTALL_PREFIX=$(mktemp -d) -AGENT_TERMINAL_HOME=$(mktemp -d) +AGENT_TTY_HOME=$(mktemp -d) -gh release download "$RELEASE_TAG" --repo coder/agent-terminal --dir "$DOWNLOAD_DIR" --pattern "$RELEASE_TGZ" -gh release download "$RELEASE_TAG" --repo coder/agent-terminal --dir "$DOWNLOAD_DIR" --pattern "${RELEASE_TGZ}.sha256" -( - cd "$DOWNLOAD_DIR" - sha256sum -c "${RELEASE_TGZ}.sha256" -) +gh release download "$RELEASE_TAG" --repo coder/agent-tty --dir "$DOWNLOAD_DIR" --pattern "$RELEASE_TGZ" +gh release download "$RELEASE_TAG" --repo coder/agent-tty --dir "$DOWNLOAD_DIR" --pattern "${RELEASE_TGZ}.sha256" +sha256sum -c "$DOWNLOAD_DIR/${RELEASE_TGZ}.sha256" npm install -g --prefix "$INSTALL_PREFIX" "$DOWNLOAD_DIR/$RELEASE_TGZ" -"$INSTALL_PREFIX"/bin/agent-terminal version --json -"$INSTALL_PREFIX"/bin/agent-terminal --home "$AGENT_TERMINAL_HOME" doctor --json +"$INSTALL_PREFIX"/bin/agent-tty version --json +"$INSTALL_PREFIX"/bin/agent-tty --home "$AGENT_TTY_HOME" doctor --json ``` For private releases, authenticated download is the expected verification route. @@ -218,9 +272,3 @@ Then create or update the release branch PR, merge it, and tag the merged `main` - Keep at least one current release-readiness bundle under `dogfood/`. - Keep evergreen scenario bundles easy to discover from the dogfood catalog. - When a change affects release, packaging, install, renderer, screenshot, wait, export, or review UX, include screenshots and recordings in the relevant proof bundle when feasible. - -## Future npm publish seam - -The release workflow intentionally stops at the GitHub Release asset. -A future npm-publish job should depend on `prepare-release`, consume the verified tarball and metadata JSON that job already emits, and publish without rebuilding the package. -Package name and registry decisions remain a separate follow-up because the current npm name is not settled. diff --git a/package-lock.json b/package-lock.json index 47b2a16..306e693 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "agent-terminal", + "name": "agent-tty", "version": "0.1.1-beta.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "agent-terminal", + "name": "agent-tty", "version": "0.1.1-beta.0", "dependencies": { "commander": "14.0.3", @@ -16,7 +16,7 @@ "zod": "4.3.6" }, "bin": { - "agent-terminal": "dist/cli/main.js" + "agent-tty": "dist/cli/main.js" }, "devDependencies": { "@eslint/js": "10.0.1", diff --git a/package.json b/package.json index 70f38c8..ae0d7e0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "agent-terminal", + "name": "agent-tty", "version": "0.1.1-beta.0", "description": "Terminal automation CLI for AI agents and humans", "keywords": [ @@ -9,13 +9,21 @@ "ai", "tanstack-intent" ], + "homepage": "https://github.com/coder/agent-tty#readme", + "bugs": { + "url": "https://github.com/coder/agent-tty/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/coder/agent-tty.git" + }, "type": "module", "packageManager": "npm@11.9.0", "engines": { "node": ">=24.0.0 <25" }, "bin": { - "agent-terminal": "./dist/cli/main.js" + "agent-tty": "./dist/cli/main.js" }, "files": [ "dist", @@ -24,6 +32,9 @@ ], "main": "./dist/index.js", "types": "./dist/index.d.ts", + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, "scripts": { "build": "tsc -p tsconfig.build.json && node ./scripts/copy-renderer-assets.mjs", "clean": "rimraf coverage dist *.tsbuildinfo", diff --git a/scripts/smoke-install.mjs b/scripts/smoke-install.mjs index 512b7db..bae4f94 100755 --- a/scripts/smoke-install.mjs +++ b/scripts/smoke-install.mjs @@ -45,7 +45,7 @@ assert( const [binName] = Object.keys(packageBins); assert(typeof binName === 'string' && binName.length > 0, 'bin name missing'); -const tempRoot = await mkdtemp(join(tmpdir(), 'agent-terminal-install-smoke-')); +const tempRoot = await mkdtemp(join(tmpdir(), 'agent-tty-install-smoke-')); function logStep(message) { assert(message.length > 0, 'log messages must be non-empty'); @@ -213,7 +213,7 @@ function getRequiredPackPaths(rendererAssets) { 'dist/cli/main.js', 'dist/index.js', 'dist/index.d.ts', - 'skills/agent-terminal/SKILL.md', + 'skills/agent-tty/SKILL.md', ...rendererAssets.map( (assetPath) => `dist/renderer/ghosttyWeb/assets/${assetPath}`, ), @@ -378,10 +378,10 @@ async function createGitInstallSource() { }); run('git', ['init', '--quiet'], { cwd: gitSourceRoot }); - run('git', ['config', 'user.email', 'agent-terminal@example.invalid'], { + run('git', ['config', 'user.email', 'agent-tty@example.invalid'], { cwd: gitSourceRoot, }); - run('git', ['config', 'user.name', 'agent-terminal smoke'], { + run('git', ['config', 'user.name', 'agent-tty smoke'], { cwd: gitSourceRoot, }); run('git', ['add', '--all'], { cwd: gitSourceRoot }); diff --git a/skills/agent-terminal/SKILL.md b/skills/agent-terminal/SKILL.md deleted file mode 100644 index 1c514eb..0000000 --- a/skills/agent-terminal/SKILL.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -name: agent-terminal -description: Terminal and TUI automation CLI for AI agents. Use when the user needs to create a terminal session, run a command in a terminal, automate an interactive CLI or TUI, wait for terminal output, capture a TUI screenshot, export a terminal recording, or test a CLI workflow with reviewable artifacts. -advertise: true ---- - -# Terminal Automation with agent-terminal - -If `agent-terminal` is not already available in the environment, fetch the current `README.md` from `coder/agent-terminal` on GitHub and follow its installation instructions before continuing. Otherwise use `agent-terminal` directly. -Examples use `jq` for JSON parsing; any JSON-processing tool works. -Prefer isolated homes, JSON envelopes, and renderer-backed artifacts so terminal workflows stay reviewable and reproducible. - -## Core Workflow - -Every terminal or TUI automation task should follow this pattern: - -1. **Create an isolated home** with `--home`. -2. **Check prerequisites** with `doctor --json` before screenshot or recording work. -3. **Create a session** with `create --json`. -4. **Run setup commands** with `run` instead of simulating long shell typing. -5. **Wait on observable terminal state** with `wait` instead of blind sleeps. -6. **Inspect the current screen** with `snapshot`. -7. **Capture proof artifacts** with `screenshot` or `record export`. -8. **Destroy the session** when finished. - -```bash -AGENT_HOME="$(mktemp -d)" -agent-terminal --home "$AGENT_HOME" doctor --json -SESSION_ID=$(agent-terminal --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') -agent-terminal --home "$AGENT_HOME" run "$SESSION_ID" 'printf "ready\n"' -agent-terminal --home "$AGENT_HOME" wait "$SESSION_ID" --text 'ready' --json -agent-terminal --home "$AGENT_HOME" snapshot "$SESSION_ID" --format text --json -agent-terminal --home "$AGENT_HOME" screenshot "$SESSION_ID" --json -agent-terminal --home "$AGENT_HOME" record export "$SESSION_ID" --format webm --json -agent-terminal --home "$AGENT_HOME" destroy "$SESSION_ID" --json -``` - -## Essential Commands - -```bash -# Environment and lifecycle -agent-terminal --home doctor --json -agent-terminal --home create --json -- /bin/bash -agent-terminal --home inspect --json -agent-terminal --home destroy --json - -# In-session control -agent-terminal --home run 'command here' --json -agent-terminal --home type 'literal text' --json -agent-terminal --home paste 'multiline payload' --json -agent-terminal --home send-keys Enter Ctrl+C --json - -# Observation and proof -agent-terminal --home wait --text 'ready' --json -agent-terminal --home wait --screen-stable-ms 1000 --json -agent-terminal --home snapshot --format text --json -agent-terminal --home screenshot --json -agent-terminal --home record export --format webm --json -``` - -## Common Patterns - -### Bootstrap a shell session - -```bash -AGENT_HOME="$(mktemp -d)" -SESSION_ID=$(agent-terminal --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') -agent-terminal --home "$AGENT_HOME" run "$SESSION_ID" 'pwd && ls -la' --json -agent-terminal --home "$AGENT_HOME" snapshot "$SESSION_ID" --format text --json -``` - -### Drive an interactive CLI or TUI - -```bash -AGENT_HOME="$(mktemp -d)" -SESSION_ID=$(agent-terminal --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') -agent-terminal --home "$AGENT_HOME" run "$SESSION_ID" '' --no-wait --json -agent-terminal --home "$AGENT_HOME" wait "$SESSION_ID" --screen-stable-ms 1000 --json -agent-terminal --home "$AGENT_HOME" send-keys "$SESSION_ID" Down Down Enter --json -agent-terminal --home "$AGENT_HOME" screenshot "$SESSION_ID" --json -``` - -### Export reviewer-facing artifacts - -```bash -AGENT_HOME="$(mktemp -d)" -SESSION_ID=$(agent-terminal --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') -agent-terminal --home "$AGENT_HOME" run "$SESSION_ID" 'printf "artifact proof\n"' --json -agent-terminal --home "$AGENT_HOME" wait "$SESSION_ID" --text 'artifact proof' --json -agent-terminal --home "$AGENT_HOME" screenshot "$SESSION_ID" --json -agent-terminal --home "$AGENT_HOME" record export "$SESSION_ID" --format asciicast --json -agent-terminal --home "$AGENT_HOME" record export "$SESSION_ID" --format webm --json -``` - -## Anti-Patterns - -- **Do not reach for `tmux`, `screen`, or ad hoc PTY wrappers first** when `agent-terminal` can provide an isolated, inspectable session. -- **Do not rely on blind `sleep` calls** when `wait --text`, `wait --idle-ms`, or `wait --screen-stable-ms` can observe terminal readiness directly. -- **Do not bypass `--json`** when another tool or agent needs machine-readable results. -- **Do not use external screenshot tools as the primary proof path** when `agent-terminal screenshot` and `agent-terminal record export` can produce renderer-backed artifacts tied to the session timeline. -- **Do not leave sessions running after the task ends**; destroy them explicitly. -- **Do not rewrite public examples into repo-local development invocations**; the public workflow should stay `agent-terminal ...`. diff --git a/skills/agent-tty/SKILL.md b/skills/agent-tty/SKILL.md new file mode 100644 index 0000000..cb1cee0 --- /dev/null +++ b/skills/agent-tty/SKILL.md @@ -0,0 +1,102 @@ +--- +name: agent-tty +description: Terminal and TUI automation CLI for AI agents. Use when the user needs to create a terminal session, run a command in a terminal, automate an interactive CLI or TUI, wait for terminal output, capture a TUI screenshot, export a terminal recording, or test a CLI workflow with reviewable artifacts. +advertise: true +--- + +# Terminal Automation with agent-tty + +If `agent-tty` is not already available in the environment, fetch the current `README.md` from `coder/agent-tty` on GitHub and follow its installation instructions before continuing. Otherwise use `agent-tty` directly. +Examples use `jq` for JSON parsing; any JSON-processing tool works. +Prefer isolated homes, JSON envelopes, and renderer-backed artifacts so terminal workflows stay reviewable and reproducible. + +## Core Workflow + +Every terminal or TUI automation task should follow this pattern: + +1. **Create an isolated home** with `--home`. +2. **Check prerequisites** with `doctor --json` before screenshot or recording work. +3. **Create a session** with `create --json`. +4. **Run setup commands** with `run` instead of simulating long shell typing. +5. **Wait on observable terminal state** with `wait` instead of blind sleeps. +6. **Inspect the current screen** with `snapshot`. +7. **Capture proof artifacts** with `screenshot` or `record export`. +8. **Destroy the session** when finished. + +```bash +AGENT_HOME="$(mktemp -d)" +agent-tty --home "$AGENT_HOME" doctor --json +SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') +agent-tty --home "$AGENT_HOME" run "$SESSION_ID" 'printf "ready\n"' +agent-tty --home "$AGENT_HOME" wait "$SESSION_ID" --text 'ready' --json +agent-tty --home "$AGENT_HOME" snapshot "$SESSION_ID" --format text --json +agent-tty --home "$AGENT_HOME" screenshot "$SESSION_ID" --json +agent-tty --home "$AGENT_HOME" record export "$SESSION_ID" --format webm --json +agent-tty --home "$AGENT_HOME" destroy "$SESSION_ID" --json +``` + +## Essential Commands + +```bash +# Environment and lifecycle +agent-tty --home doctor --json +agent-tty --home create --json -- /bin/bash +agent-tty --home inspect --json +agent-tty --home destroy --json + +# In-session control +agent-tty --home run 'command here' --json +agent-tty --home type 'literal text' --json +agent-tty --home paste 'multiline payload' --json +agent-tty --home send-keys Enter Ctrl+C --json + +# Observation and proof +agent-tty --home wait --text 'ready' --json +agent-tty --home wait --screen-stable-ms 1000 --json +agent-tty --home snapshot --format text --json +agent-tty --home screenshot --json +agent-tty --home record export --format webm --json +``` + +## Common Patterns + +### Bootstrap a shell session + +```bash +AGENT_HOME="$(mktemp -d)" +SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') +agent-tty --home "$AGENT_HOME" run "$SESSION_ID" 'pwd && ls -la' --json +agent-tty --home "$AGENT_HOME" snapshot "$SESSION_ID" --format text --json +``` + +### Drive an interactive CLI or TUI + +```bash +AGENT_HOME="$(mktemp -d)" +SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') +agent-tty --home "$AGENT_HOME" run "$SESSION_ID" '' --no-wait --json +agent-tty --home "$AGENT_HOME" wait "$SESSION_ID" --screen-stable-ms 1000 --json +agent-tty --home "$AGENT_HOME" send-keys "$SESSION_ID" Down Down Enter --json +agent-tty --home "$AGENT_HOME" screenshot "$SESSION_ID" --json +``` + +### Export reviewer-facing artifacts + +```bash +AGENT_HOME="$(mktemp -d)" +SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId') +agent-tty --home "$AGENT_HOME" run "$SESSION_ID" 'printf "artifact proof\n"' --json +agent-tty --home "$AGENT_HOME" wait "$SESSION_ID" --text 'artifact proof' --json +agent-tty --home "$AGENT_HOME" screenshot "$SESSION_ID" --json +agent-tty --home "$AGENT_HOME" record export "$SESSION_ID" --format asciicast --json +agent-tty --home "$AGENT_HOME" record export "$SESSION_ID" --format webm --json +``` + +## Anti-Patterns + +- **Do not reach for `tmux`, `screen`, or ad hoc PTY wrappers first** when `agent-tty` can provide an isolated, inspectable session. +- **Do not rely on blind `sleep` calls** when `wait --text`, `wait --idle-ms`, or `wait --screen-stable-ms` can observe terminal readiness directly. +- **Do not bypass `--json`** when another tool or agent needs machine-readable results. +- **Do not use external screenshot tools as the primary proof path** when `agent-tty screenshot` and `agent-tty record export` can produce renderer-backed artifacts tied to the session timeline. +- **Do not leave sessions running after the task ends**; destroy them explicitly. +- **Do not rewrite public examples into repo-local development invocations**; the public workflow should stay `agent-tty ...`. diff --git a/src/cli/commands/doctor.ts b/src/cli/commands/doctor.ts index 7275caa..3f6feb0 100644 --- a/src/cli/commands/doctor.ts +++ b/src/cli/commands/doctor.ts @@ -366,14 +366,14 @@ async function runWorkingDirectoryCheck(): Promise { } async function runTemporaryDirectoryCheck(): Promise { - const directoryPrefix = join(tmpdir(), 'agent-terminal-'); + const directoryPrefix = join(tmpdir(), 'agent-tty-'); const temporaryDirectory = await mkdtemp(directoryPrefix); await rm(temporaryDirectory, { recursive: true, force: true }); return `temp dir ok: ${tmpdir()}`; } export function runHomeIsolationCheck(): string { - const configuredHome = process.env.AGENT_TERMINAL_HOME; + const configuredHome = process.env.AGENT_TTY_HOME; if (configuredHome === undefined) { return 'Agent-terminal home uses default location'; } @@ -750,9 +750,7 @@ async function runGhosttyWebAvailableCheck(): Promise { async function runScreenshotViabilityCheck(): Promise { const chromium = await getPlaywrightChromium(); - const temporaryDirectory = await mkdtemp( - join(tmpdir(), 'agent-terminal-doctor-'), - ); + const temporaryDirectory = await mkdtemp(join(tmpdir(), 'agent-tty-doctor-')); const screenshotPath = join(temporaryDirectory, 'smoke-check.png'); let browser: BrowserLike | null = null; diff --git a/src/cli/commands/inputSource.ts b/src/cli/commands/inputSource.ts index 7136484..4512b9f 100644 --- a/src/cli/commands/inputSource.ts +++ b/src/cli/commands/inputSource.ts @@ -24,7 +24,7 @@ function createInvalidInputError( } function usageMessage(commandName: 'type' | 'paste' | 'run'): string { - return `Usage: agent-terminal ${commandName} [text] [--file ]`; + return `Usage: agent-tty ${commandName} [text] [--file ]`; } function isErrnoException(error: unknown): error is NodeJS.ErrnoException { diff --git a/src/cli/commands/skill.ts b/src/cli/commands/skill.ts index baf52a4..d1c6aba 100644 --- a/src/cli/commands/skill.ts +++ b/src/cli/commands/skill.ts @@ -8,7 +8,7 @@ import { ERROR_CODES, makeCliError } from '../../protocol/errors.js'; import { assertString, invariant } from '../../util/assert.js'; const COMMAND_NAME = 'skill'; -const SKILL_NAME = 'agent-terminal'; +const SKILL_NAME = 'agent-tty'; const SKILL_SOURCE = 'packaged-file'; export interface SkillResult { @@ -24,10 +24,7 @@ export interface SkillDependencies { const DEFAULT_SKILL_DEPENDENCIES: SkillDependencies = { readFile: (path, encoding) => readFile(path, encoding), - skillFileUrl: new URL( - '../../../skills/agent-terminal/SKILL.md', - import.meta.url, - ), + skillFileUrl: new URL('../../../skills/agent-tty/SKILL.md', import.meta.url), }; export async function loadPackagedSkillContent( diff --git a/src/cli/commands/version.ts b/src/cli/commands/version.ts index c5ce402..e05029c 100644 --- a/src/cli/commands/version.ts +++ b/src/cli/commands/version.ts @@ -90,7 +90,7 @@ export async function runVersionCommand(options: { json: options.json, result, lines: [ - `agent-terminal ${result.cliVersion}`, + `agent-tty ${result.cliVersion}`, `protocol ${result.protocolVersion}`, `runtime ${result.runtime.node} (${result.runtime.platform}/${result.runtime.arch})`, ], diff --git a/src/cli/context.ts b/src/cli/context.ts index f77f737..c509fe5 100644 --- a/src/cli/context.ts +++ b/src/cli/context.ts @@ -104,23 +104,23 @@ export async function resolveCommandContext( options: GlobalCliOptions, env: NodeJS.ProcessEnv = process.env, ): Promise { - const configuredHome = options.home ?? env.AGENT_TERMINAL_HOME; + const configuredHome = options.home ?? env.AGENT_TTY_HOME; const home = configuredHome === undefined - ? resolveHome(env.AGENT_TERMINAL_HOME) + ? resolveHome(env.AGENT_TTY_HOME) : validateHomePath( configuredHome, - options.home !== undefined ? '--home' : 'AGENT_TERMINAL_HOME', + options.home !== undefined ? '--home' : 'AGENT_TTY_HOME', ); const configFile = await loadConfigFile(home); const logLevel = resolveLogLevel( - options.logLevel ?? env.AGENT_TERMINAL_LOG_LEVEL ?? configFile?.logLevel, + options.logLevel ?? env.AGENT_TTY_LOG_LEVEL ?? configFile?.logLevel, ); const logger = createLogger(logLevel); const profileDefault = options.profileDefault ?? options.profile ?? - env.AGENT_TERMINAL_PROFILE ?? + env.AGENT_TTY_PROFILE ?? configFile?.defaultProfile; return Object.freeze({ diff --git a/src/cli/main.ts b/src/cli/main.ts index 1afbdd8..1dedcd4 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -108,21 +108,21 @@ function wrapAction( } const CODING_AGENT_HELP_INTRO = - 'MANDATORY FOR CODING AGENTS: read the `agent-terminal` skill first. If your agent already loaded that skill, follow it; otherwise run `agent-terminal skill` before any other agent-terminal command.'; + 'MANDATORY FOR CODING AGENTS: read the `agent-tty` skill first. If your agent already loaded that skill, follow it; otherwise run `agent-tty skill` before any other agent-tty command.'; const CODING_AGENT_HELP_OUTRO = - 'Coding agents: use the preloaded `agent-terminal` skill when available; otherwise call `agent-terminal skill` before using session commands.'; + 'Coding agents: use the preloaded `agent-tty` skill when available; otherwise call `agent-tty skill` before using session commands.'; const SKILL_COMMAND_DESCRIPTION = 'Fallback first step for coding agents: print the packaged skill if it is not already loaded'; async function main(): Promise { const program = new Command() - .name('agent-terminal') + .name('agent-tty') .description('CLI for managing and controlling terminal sessions') .showHelpAfterError() .exitOverride(); program - .option('--home ', 'Override the agent-terminal home directory') + .option('--home ', 'Override the agent-tty home directory') .option( '--timeout-ms ', 'Set a shared CLI timeout in milliseconds', @@ -136,14 +136,14 @@ async function main(): Promise { const context = await resolveCommandContext( actionCommand.optsWithGlobals(), ); - process.env.AGENT_TERMINAL_HOME = context.home; + process.env.AGENT_TTY_HOME = context.home; // Propagate the resolved log level to the process environment so that // subsystems instantiated outside the CLI context (e.g., renderer backends, // host processes) inherit the correct level via createProcessLogger(). // This is intentional: threading a Logger instance through every factory // and constructor is a larger refactor with no user-visible benefit, since // the env var is set before any command handler runs. - process.env.AGENT_TERMINAL_LOG_LEVEL = context.logLevel; + process.env.AGENT_TTY_LOG_LEVEL = context.logLevel; setColorEnabled(context.colorEnabled); setCommandContext(actionCommand, context); context.logger.debug('resolved command context', { @@ -753,7 +753,7 @@ try { process.exitCode = error.code === 'commander.helpDisplayed' ? 0 : 2; } else if (error instanceof CliError) { setColorEnabled(!process.argv.includes('--no-color')); - emitCliError('agent-terminal', error); + emitCliError('agent-tty', error); } else { throw error; } diff --git a/src/config/resolveConfig.ts b/src/config/resolveConfig.ts index 1ee1eca..91f66d4 100644 --- a/src/config/resolveConfig.ts +++ b/src/config/resolveConfig.ts @@ -27,7 +27,7 @@ export const ConfigFileSchema = z .strict(); export type ConfigFile = z.infer; -export interface AgentTerminalConfig { +export interface AgentTtyConfig { readonly home: string; readonly cols: number; readonly rows: number; @@ -101,7 +101,7 @@ export async function loadConfigFile(home: string): Promise { return result.data; } -export function resolveConfig(): Readonly { +export function resolveConfig(): Readonly { return Object.freeze({ home: resolveHome(), cols: DEFAULT_COLS, diff --git a/src/export/webm.ts b/src/export/webm.ts index 6102184..cecdad4 100644 --- a/src/export/webm.ts +++ b/src/export/webm.ts @@ -146,7 +146,7 @@ export async function generateWebmExport( 480, Math.ceil(rows * profile.fontSize * 1.5) + 32, ); - const videoTmpDir = await mkdtemp(join(tmpdir(), 'agent-terminal-webm-')); + const videoTmpDir = await mkdtemp(join(tmpdir(), 'agent-tty-webm-')); let backend: VideoCapableRendererBackend | null = null; try { diff --git a/src/host/lifecycle.ts b/src/host/lifecycle.ts index e2472f1..9457bb3 100644 --- a/src/host/lifecycle.ts +++ b/src/host/lifecycle.ts @@ -454,7 +454,7 @@ export function launchHost(config: LaunchHostConfig): number { env: { ...process.env, ...config.env, - AGENT_TERMINAL_HOME: config.home, + AGENT_TTY_HOME: config.home, TERM: config.term, }, }, diff --git a/src/index.ts b/src/index.ts index f3756cc..c9c3f78 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,4 +35,4 @@ export type { SessionStatus, } from './protocol/schemas.js'; export type { ProtocolErrorCode } from './protocol/errors.js'; -export type { AgentTerminalConfig } from './config/resolveConfig.js'; +export type { AgentTtyConfig } from './config/resolveConfig.js'; diff --git a/src/renderer/ghosttyWeb/backend.ts b/src/renderer/ghosttyWeb/backend.ts index 94bd5bf..01a3c3d 100644 --- a/src/renderer/ghosttyWeb/backend.ts +++ b/src/renderer/ghosttyWeb/backend.ts @@ -91,8 +91,8 @@ interface GhosttyBrowserBridge { } interface GhosttyBrowserGlobal { - __agentTerminal?: GhosttyBrowserBridge; - __agentTerminalLog?: ( + __agentTty?: GhosttyBrowserBridge; + __agentTtyLog?: ( level: LogLevel, message: string, detail?: string, @@ -141,7 +141,7 @@ const EMBEDDED_HARNESS_HTML = ` name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> - agent-terminal ghostty-web harness + agent-tty ghostty-web harness