diff --git a/CHANGELOG.md b/CHANGELOG.md index c85e952..f7753e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Session-status policy is now centralized in a single module that classifies every `SessionStatus` as active, terminal, commandable, live-host eligible, offline-replay eligible, collectable, and destroyed; lifecycle, inspect, gc, wait, host, and command-state checks share the same predicates. CLI JSON, protocol schemas, event-log behavior, and artifact formats are unchanged ([#67](https://github.com/coder/agent-tty/pull/67)). - Persisted event-log validation, JSONL parsing, and contiguous-sequence checks for live hydration, offline replay, and `record export` now flow through a shared codec at `src/storage/eventLogCodec.ts`. Validation errors use neutral event-log wording; missing-log policy remains caller-specific (offline replay treats missing logs as empty; `record export` still surfaces missing logs as an error) ([#68](https://github.com/coder/agent-tty/pull/68)). - Snapshot result construction and artifact persistence are now shared between live host RPCs and offline replay through `src/snapshot/capture.ts`. Snapshot artifact filenames, JSON formatting (two-space indent + trailing newline), manifest metadata, and `rendererBackend` reporting are unchanged ([#69](https://github.com/coder/agent-tty/pull/69)). +- Screenshot capture, validation, and artifact persistence are now shared between live host RPCs and offline replay through `src/screenshot/capture.ts`. The shared seam owns temporary-file allocation, renderer screenshot invocation, allowlisted public result construction, Zod validation before any rename or manifest append, manifest metadata creation, and temp-file cleanup on failure. Screenshot filenames, final PNG paths, manifest entry shape (`profileName`, `cols`, `rows`, `pngSizeBytes`, `cursorVisible`, `rendererBackend`, `pixelWidth`, `pixelHeight`, `sha256`, `renderProfileHash`), and `screenshot --json` output are unchanged ([#78](https://github.com/coder/agent-tty/pull/78)). - Waited-run completion bookkeeping (sentinel scanning, postamble sanitization, waiter resolution, timeout, exit, `run_complete` appends) moved out of `hostMain` into a dedicated `RunCompletionCoordinator`. No public CLI, protocol, or event-log changes ([#70](https://github.com/coder/agent-tty/pull/70)). - Refreshed contributor and agent guidance in `AGENTS.md` with an outcome-first operating contract, validation guidance, and grouped project invariants ([#46](https://github.com/coder/agent-tty/pull/46)). Added in-repo agent skills under `.agents/skills/` (`diagnose`, `tdd`, `triage`, `improve-codebase-architecture`, `grill-with-docs`, `to-issues`, `to-prd`) plus matching links from `.claude/skills/` and `.mux/skills/` ([#65](https://github.com/coder/agent-tty/pull/65)). diff --git a/CONTEXT.md b/CONTEXT.md index 20870a7..0fcb703 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -69,6 +69,16 @@ A persisted JSON artifact containing exactly the **Snapshot Result** returned to The operation that derives a **Snapshot Result** from a **Semantic Snapshot** and records the matching **Snapshot Artifact**. _Avoid_: Renderer capture +**Screenshot Result**: +A public screenshot payload returned to a caller describing the rendered PNG of a **Session** at a captured event-log sequence. + +**Screenshot Artifact**: +A persisted PNG file plus its manifest entry recording the **Screenshot Result** for a **Session** at a captured event-log sequence. + +**Screenshot Capture**: +The operation that invokes the renderer to produce the PNG, builds the **Screenshot Result**, and records the matching **Screenshot Artifact**. +_Avoid_: Renderer capture + **Release Prep Workflow**: The maintainer-facing process for choosing the next release version and preparing release changes for review before they land on the default branch. @@ -90,6 +100,8 @@ The tag-triggered automation that validates, packages, and publishes a release a - An **Offline Replay Eligible Session** is reconstructed from its persisted **Event Log** and manifest. - A **Snapshot Result** is derived from exactly one **Semantic Snapshot**. - A **Snapshot Artifact** contains exactly the **Snapshot Result** emitted to the caller. +- A **Screenshot Capture** produces exactly one **Screenshot Result** and exactly one **Screenshot Artifact** for the same captured event-log sequence. +- A **Screenshot Artifact** is the persisted PNG plus its manifest entry that the **Screenshot Result** describes to the caller. - A **Command Target** is exactly one **Commandable Session** selected by an input or control command. - A **Commandable Session** can accept a **Waited Run**. - A **Render Wait** may include text, regex, cursor, or **Screen Stability** conditions. diff --git a/dogfood/issue-64-share-screenshot-capture/README.md b/dogfood/issue-64-share-screenshot-capture/README.md new file mode 100644 index 0000000..4ca3623 --- /dev/null +++ b/dogfood/issue-64-share-screenshot-capture/README.md @@ -0,0 +1,95 @@ +# Issue 64 — Share screenshot capture and artifact persistence + +This bundle compares screenshot output from the running session (live) and +exited session (offline replay) paths, before and after the refactor that +moves both paths through the shared `captureScreenshotResult(...)` helper in +`src/screenshot/capture.ts`. + +## How it was generated + +The same `commands.sh` was run twice: + +1. **before**: against parent commit `b2d5068` (`refactor: share render wait +matching (#76)`) in a temporary `git worktree`. This still has the + inline screenshot logic in `src/host/hostMain.ts` and a duplicate + implementation in `src/cli/commands/screenshot.ts`. +2. **after**: against this branch, where both paths call the new + `captureScreenshotResult(...)` helper. + +Each run uses an isolated absolute `AGENT_TTY_HOME` (recorded in +`