Skip to content

Commit 4134417

Browse files
authored
feat: Agent Terminal v1 — Week 3 remaining implementation (#5)
* Add export and replay schema groundwork * Add offline replay renderer helper * Add offline fallback for snapshot command * Add offline fallback for screenshot command * test: update exited snapshot e2e expectation * Add asciicast record export command * Add gc command for stale session cleanup * Add doctor filesystem and PTY health checks * Add Ghostty web video capture support * Add WebM record export support * Fix record export hashing for webm and asciicast * Fix prettier formatting in GhosttyWebBackend * test: add export fixture e2e coverage * Add Week 3 dogfood proof bundles * Fix targeted review findings * Fix WebM renderer backend abstraction * test: cover replay and export error fallbacks * dogfood: add LazyVim + Claude Code extra scenario Demonstrates a full interactive LazyVim workflow driven entirely through agent-terminal CLI commands: 1. LazyVim first boot with 32 plugin installation 2. Dashboard navigation 3. Lazy Extras: search, enable ai.claudecode 4. Restart to activate claudecode.nvim (33 plugins) 5. <leader>a AI keybinding menu with Claude Code bindings Artifacts: 11 screenshots (dark+light), 2 asciicast recordings, 1 WebM video, 2 event logs, JSON envelopes for all operations. * docs: add LazyVim scenario repro playbook for coding agents Comprehensive step-by-step runbook (732 lines) covering: - Full environment setup (Neovim, LazyVim, prerequisites) - 11-step walkthrough with exact CLI commands - agent-terminal command reference and wait strategies - Common patterns: TUI navigation, search, multi-session workflows - Troubleshooting guide - Expected artifacts and verification checklist Designed as a reusable playbook for any coding agent to demonstrate agent-terminal's capabilities with a real-world TUI application. * docs: fix lazyvim repro playbook * style: fix prettier formatting across all changed files * Fix alt-screen demo timing window * Fix alt-screen fixture timing flakiness * Add marker protocol schemas and event log support * Add mark RPC handler and CLI command * Add marker support to asciicast export
1 parent 211fe16 commit 4134417

134 files changed

Lines changed: 11248 additions & 101 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Week 3 crash-retention dogfood proof bundle
2+
3+
- **Date:** 2026-03-21T21:48:34Z
4+
- **Bundle:** `dogfood/20260321-week3-crash-retention/`
5+
- **Crash session ID:** `01KM95Z3QSQKN28SVD03BP28Z2`
6+
- **AGENT_TERMINAL_HOME:** `/tmp/agent-terminal-week3-bundles.Bo0MbU/home.KGOAC6`
7+
- **Environment:** Node `v24.14.0` on `Linux 6.8.0-94-generic x86_64 GNU/Linux`
8+
- **Headless note:** Review this bundle via the JSON envelopes plus the copied snapshot/screenshot/recording/video artifacts.
9+
10+
## Artifacts
11+
12+
| File | Description |
13+
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
14+
| `commands.sh` | Exact shell commands used to generate the crash-retention bundle. |
15+
| `agent-terminal-home.txt` | The isolated home used for the crash-retention scenario. |
16+
| `session-id.txt` | Session ID for the crash-retention scenario. |
17+
| `doctor.json` | `doctor --json` output proving the environment and renderer checks passed before running the crash scenario. |
18+
| `create-output.json` | Session creation result for the crashing command. |
19+
| `wait-exit.json` | `wait --exit --json` result capturing the crash exit code. |
20+
| `inspect-post-crash.json` | `inspect --json` result showing the session remains persisted after the abnormal exit. |
21+
| `snapshot-post-crash.json` | Offline replay snapshot taken after the crash. |
22+
| `screenshot-post-crash.json` | Offline replay screenshot taken after the crash. |
23+
| `record-asciicast-post-crash.json` | Asciicast export JSON envelope from the crashed session. |
24+
| `record-webm-post-crash.json` | WebM export JSON envelope from the crashed session. |
25+
| `manifest.json` | Final copied artifact manifest from the crash session home. |
26+
| `session-manifest.json` | Copied session manifest showing the persisted exited state and crash metadata. |
27+
| `event-log.jsonl` | Raw event log copied from the crash session home. |
28+
| `artifacts/post-crash-snapshot-structured-artifact.json` | Snapshot artifact copied after offline replay. |
29+
| `artifacts/post-crash-reference-dark.png` | Screenshot PNG copied after offline replay. |
30+
| `artifacts/session-post-crash.cast` | Asciicast exported from the crashed session. |
31+
| `artifacts/session-post-crash.webm` | WebM exported from the crashed session. |
32+
33+
## Verification claims
34+
35+
- `doctor.json` reports `ok: true` and all checks passed before the crash scenario ran.
36+
- `wait-exit.json` captured exit code `42`, demonstrating non-zero exit retention.
37+
- `inspect-post-crash.json` shows the session persisted in `exited` state after the abnormal termination rather than disappearing.
38+
- `snapshot-post-crash.json` and `screenshot-post-crash.json` prove offline replay remained available after the crash.
39+
- `record-asciicast-post-crash.json` and `record-webm-post-crash.json` prove recording export also remained available after the crash.
40+
- `manifest.json`, `session-manifest.json`, and `event-log.jsonl` preserve the evidence that remained after the process exited non-zero.
41+
42+
## Issues encountered
43+
44+
- No blocking issues were encountered during bundle generation.
45+
- As with the renderer bundle, the generator retries WebM export once before failing because video export is the slowest step.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/tmp/agent-terminal-week3-bundles.Bo0MbU/home.KGOAC6
3.23 KB
Loading
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"format": "structured",
3+
"sessionId": "01KM95Z3QSQKN28SVD03BP28Z2",
4+
"capturedAtSeq": 1,
5+
"cols": 80,
6+
"rows": 24,
7+
"cursorRow": 1,
8+
"cursorCol": 0,
9+
"isAltScreen": false,
10+
"visibleLines": [
11+
{
12+
"row": 0,
13+
"text": "crash-test-output"
14+
},
15+
{
16+
"row": 1,
17+
"text": ""
18+
},
19+
{
20+
"row": 2,
21+
"text": ""
22+
},
23+
{
24+
"row": 3,
25+
"text": ""
26+
},
27+
{
28+
"row": 4,
29+
"text": ""
30+
},
31+
{
32+
"row": 5,
33+
"text": ""
34+
},
35+
{
36+
"row": 6,
37+
"text": ""
38+
},
39+
{
40+
"row": 7,
41+
"text": ""
42+
},
43+
{
44+
"row": 8,
45+
"text": ""
46+
},
47+
{
48+
"row": 9,
49+
"text": ""
50+
},
51+
{
52+
"row": 10,
53+
"text": ""
54+
},
55+
{
56+
"row": 11,
57+
"text": ""
58+
},
59+
{
60+
"row": 12,
61+
"text": ""
62+
},
63+
{
64+
"row": 13,
65+
"text": ""
66+
},
67+
{
68+
"row": 14,
69+
"text": ""
70+
},
71+
{
72+
"row": 15,
73+
"text": ""
74+
},
75+
{
76+
"row": 16,
77+
"text": ""
78+
},
79+
{
80+
"row": 17,
81+
"text": ""
82+
},
83+
{
84+
"row": 18,
85+
"text": ""
86+
},
87+
{
88+
"row": 19,
89+
"text": ""
90+
},
91+
{
92+
"row": 20,
93+
"text": ""
94+
},
95+
{
96+
"row": 21,
97+
"text": ""
98+
},
99+
{
100+
"row": 22,
101+
"text": ""
102+
},
103+
{
104+
"row": 23,
105+
"text": ""
106+
}
107+
]
108+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{"version":2,"width":80,"height":24,"timestamp":1774129746,"title":"01KM95Z3QSQKN28SVD03BP28Z2","env":{"TERM":"xterm-256color"}}
2+
[0,"o","crash-test-output\r\n"]
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
export PATH="$HOME/.local/bin:$PATH"
4+
if command -v mise >/dev/null 2>&1; then
5+
mise_shell_env="$(mise activate bash 2>/dev/null || true)"
6+
if [[ -n "$mise_shell_env" ]]; then
7+
eval "$mise_shell_env"
8+
fi
9+
mise_node="$(mise which node 2>/dev/null || true)"
10+
if [[ -n "$mise_node" ]]; then
11+
export PATH="$(dirname "$mise_node"):$PATH"
12+
fi
13+
fi
14+
cd /home/coder/.mux/src/agent-terminal/agent_exec_7c2a453166
15+
export PATH="/home/coder/.mux/src/agent-terminal/agent_exec_7c2a453166/node_modules/.bin:$PATH"
16+
export AGENT_TERMINAL_HOME=/tmp/agent-terminal-week3-bundles.Bo0MbU/home.KGOAC6
17+
18+
tsx src/cli/main.ts doctor --json
19+
tsx src/cli/main.ts create --json -- /bin/bash -lc echo\ crash-test-output\ \&\&\ exit\ 42
20+
tsx src/cli/main.ts wait 01KM95Z3QSQKN28SVD03BP28Z2 --exit --timeout 20000 --json
21+
tsx src/cli/main.ts inspect 01KM95Z3QSQKN28SVD03BP28Z2 --json
22+
tsx src/cli/main.ts snapshot 01KM95Z3QSQKN28SVD03BP28Z2 --json
23+
tsx src/cli/main.ts screenshot 01KM95Z3QSQKN28SVD03BP28Z2 --json
24+
tsx src/cli/main.ts record export 01KM95Z3QSQKN28SVD03BP28Z2 --format asciicast --out dogfood/20260321-week3-crash-retention/artifacts/session-post-crash.cast --json
25+
tsx src/cli/main.ts record export 01KM95Z3QSQKN28SVD03BP28Z2 --format webm --out dogfood/20260321-week3-crash-retention/artifacts/session-post-crash.webm --json
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"ok": true,
3+
"command": "create",
4+
"timestamp": "2026-03-21T21:49:06.387Z",
5+
"result": {
6+
"sessionId": "01KM95Z3QSQKN28SVD03BP28Z2"
7+
}
8+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"ok": true,
3+
"command": "doctor",
4+
"timestamp": "2026-03-21T21:49:04.852Z",
5+
"result": {
6+
"ok": true,
7+
"checks": {
8+
"environment": [
9+
{
10+
"name": "node-runtime",
11+
"status": "pass",
12+
"message": "Node 24.14.0 ok",
13+
"durationMs": 0
14+
},
15+
{
16+
"name": "cwd-access",
17+
"status": "pass",
18+
"message": "cwd read/write: /home/coder/.mux/src/agent-terminal/agent_exec_7c2a453166",
19+
"durationMs": 1
20+
},
21+
{
22+
"name": "temp-dir",
23+
"status": "pass",
24+
"message": "temp dir ok: /tmp",
25+
"durationMs": 8
26+
},
27+
{
28+
"name": "home-writable",
29+
"status": "pass",
30+
"message": "home writable: /tmp/agent-terminal-week3-bundles.Bo0MbU/home.KGOAC6",
31+
"durationMs": 2
32+
},
33+
{
34+
"name": "pty-spawn",
35+
"status": "pass",
36+
"message": "spawned /home/coder/.local/share/mise/installs/node/24.14.0/bin/node",
37+
"durationMs": 36
38+
},
39+
{
40+
"name": "socket-viable",
41+
"status": "pass",
42+
"message": "socket ok: /tmp/agent-terminal-week3-bundles.Bo0MbU/home.KGOAC6/sessions/doctor-833752-mn0v1jxt-2/host.sock",
43+
"durationMs": 3
44+
},
45+
{
46+
"name": "artifact-atomicity",
47+
"status": "pass",
48+
"message": "atomic rename ok: /tmp/agent-terminal-week3-bundles.Bo0MbU/home.KGOAC6/sessions/doctor-833752-mn0v1jxw-3/artifacts",
49+
"durationMs": 2
50+
},
51+
{
52+
"name": "event-log-writable",
53+
"status": "pass",
54+
"message": "append ok: /tmp/agent-terminal-week3-bundles.Bo0MbU/home.KGOAC6/sessions/doctor-833752-mn0v1jxy-5/events.jsonl",
55+
"durationMs": 1
56+
}
57+
],
58+
"renderer": [
59+
{
60+
"name": "playwright_available",
61+
"status": "pass",
62+
"message": "available",
63+
"durationMs": 1
64+
},
65+
{
66+
"name": "browser_launch",
67+
"status": "pass",
68+
"message": "chromium launches",
69+
"durationMs": 120
70+
},
71+
{
72+
"name": "ghostty_web_available",
73+
"status": "pass",
74+
"message": "WASM available",
75+
"durationMs": 130
76+
},
77+
{
78+
"name": "screenshot_viable",
79+
"status": "pass",
80+
"message": "viable",
81+
"durationMs": 162
82+
}
83+
]
84+
}
85+
}
86+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{"seq":0,"ts":"2026-03-21T21:49:06.407Z","type":"output","payload":{"data":"crash-test-output\r\n"}}
2+
{"seq":1,"ts":"2026-03-21T21:49:06.408Z","type":"exit","payload":{"exitCode":42,"exitSignal":null}}

0 commit comments

Comments
 (0)