Skip to content

refactor(launch-video): agent-driven capture infrastructure and scene - #782

Draft
elucid wants to merge 4 commits into
mainfrom
video/agent-attention-scene
Draft

refactor(launch-video): agent-driven capture infrastructure and scene#782
elucid wants to merge 4 commits into
mainfrom
video/agent-attention-scene

Conversation

@elucid

@elucid elucid commented Aug 16, 2026

Copy link
Copy Markdown
Member

What

Turns the one-off attention scene into reusable infrastructure for showcasing agent/CLI-driven Hunk in demo videos, and broadens the scene itself into a full agent story:

  • scripts/launch-video/agentDriver.ts (new) — launchAgentDrivenHunk() runs a TUI against a daemon nobody else can see (scratch XDG_RUNTIME_DIR + OS-assigned HUNK_MCP_PORT, never HUNK_MCP_DISABLE), polls until the session registers, and hands back run/runJson session-CLI handles plus an optional on-camera shell sharing the same isolated env. driveGestures() plays a declarative sequence: silent gestures issue a command off camera and snap the TUI reacting; shell gestures type the same kind of command on camera, then snap the shell and/or the TUI.
  • scripts/launch-video/demoContent.ts (new) — the generated report module, the demo repos, and locateNeedle, so every line number and character offset a scene points at is computed rather than hand-counted.
  • captureAgentScene (was captureAttentionScene, SCENES=agent) — built entirely on the driver and gestures, with agent- frames.

Why

The agent surfaces' whole point is that they arrive over the session daemon, so the scene must drive them for real. But the daemon setup, the CLI runner, and the demo content were all buried inside one scene function — a second agent scene would have had to copy all three. Splitting them out makes "an agent drives this review" a capability of the capture pipeline instead of a property of one shot.

The scene

Opening review shot → hunk session list typed on camera (the CLI surface, one live session) → hunk-level vs line-exact landing (--hunk parks at the top of a tall hunk; --new-line 86 lands the buried comparator, typed on camera with the computed line) → character-range warning mark → tone-only repaint as current (viewport untouched, isolating --tone from --focus) → cross-file highlight add … --focus typed on camera → a comment add on that same line, showing what persists when a mark does not → highlight clear.

On-camera commands select the session with --repo . from the demo repo: a selector is mandatory (hunk session navigate with neither <session-id> nor --repo errors), and an absolute path or a UUID reads badly on screen.

Storyboard consumer

compose.mjs gains a six-shot agent segment before the outro (agent-review, agent-shell-nav, agent-line-nav, agent-mark-warning, agent-mark-focus, agent-comment), with NEW badges on the line-exact and mark claims. Capture scenes rot when nothing consumes their frames — the compose preflight only checks frames a storyboard references — so this keeps the scene exercised by every full-capture preflight. The rest of the storyboard is still the 0.18 reference and is unchanged.

skills/hunk-launch-video/SKILL.md documents the pattern under "Authoring scenes".

Verification

  • bun run typecheck, bun run lint clean.
  • SCENES=agent bun run scripts/launch-video/capture.ts run twice; both produced the same 17 frames with no errors.
  • Eyeballed agent-shell-list, agent-shell-nav, agent-line-nav, agent-mark-warning, agent-mark-focus, agent-comment, agent-clear: typed commands and their real output are legible in the shell frames, marks are visibly painted on the exact ranges, the note renders as an agent-note card, and each landing sits near the top of the viewport.
  • A full composite needs every scene captured, so it is out of scope here; the segment's frame names were checked against the capture output.

Notes

  • Also silences macOS bash's zsh-migration banner in shell scenes — it was the first thing on camera in every shell frame.
  • Empty changeset: maintainer-only tooling (scripts/launch-video/ never ships to npm).

Adds a video scene that demonstrates the 0.19 agent surfaces the way
they are actually used: it launches Hunk against an isolated session
daemon (scratch XDG_RUNTIME_DIR plus a pinned non-default port so a
developer's live daemon is never touched) and drives the review with
real `hunk session navigate` and `hunk session highlight` calls
rather than keystrokes, so every captured frame shows the genuine
agent-facing behavior: hunk-level vs line-exact landings, character-
range attention marks, tone changes, a cross-file --focus jump, and
an exact-count clear.

The deep-line shot needs a hunk taller than the mini-app example
provides, so buildReportModule() deterministically generates a long
policy table with one behavioral comparator change buried below it,
written only into the throwaway capture repo; the shipped example
fixtures are untouched. Needle lines and mark offsets are computed
from the generated text at capture time instead of being hand-counted.

Empty changeset: maintainer-only tooling, not release-notes material.
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hunk-web Ignored Ignored Preview Aug 16, 2026 10:35pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds an agent-attention launch-video scene that drives line navigation and character-range highlights through a session broker.

  • Generates a deterministic tall demo diff for line-exact navigation.
  • Captures warning/current highlights, focus movement, and highlight clearing.
  • Adds per-launch environment overrides and an empty maintainer-tooling changeset.

Confidence Score: 4/5

The PR should not merge until the attention scene allocates a unique available broker port so captures cannot collide or control another capture's session.

The scene isolates broker metadata but reuses a fixed host-global TCP port, allowing overlapping captures or a lingering broker to cause startup failure or cross-session commands.

Files Needing Attention: scripts/launch-video/capture.ts

Important Files Changed

Filename Overview
scripts/launch-video/capture.ts Adds the attention capture workflow, but its fixed broker port prevents the promised isolation between overlapping or recently completed captures.
.changeset/big-actors-build.md Adds the expected empty changeset for maintainer-only launch-video tooling.

Sequence Diagram

sequenceDiagram
  participant A as Attention capture A
  participant B as Attention capture B
  participant D as Broker on 127.0.0.1:47911
  A->>D: Launch/discover broker
  A->>D: Register session A
  B->>D: Discover same healthy endpoint
  B->>D: Register session B
  B->>D: list sessions
  D-->>B: Sessions ordered by latest update
  B->>D: Navigate/highlight sessions[0]
  Note over B,D: Command may target session A
Loading
Prompt To Fix All With AI
### Issue 1
scripts/launch-video/capture.ts:217
**Fixed port breaks daemon isolation**

If two attention captures overlap or a previous capture's detached broker remains healthy, both runs use the host-global `127.0.0.1:47911` endpoint despite their separate runtime directories, causing an address-in-use failure or reuse of a broker where `sessions[0]` can belong to the other capture and receive its navigation and highlight commands.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "chore(launch-video): add agent-attention..." | Re-trigger Greptile

Comment thread scripts/launch-video/capture.ts Outdated
const attentionEnv: Record<string, string> = {
XDG_CONFIG_HOME: configHome,
XDG_RUNTIME_DIR: makeTempDir("hunk-video-runtime-"),
HUNK_MCP_PORT: "47911",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Fixed port breaks daemon isolation

If two attention captures overlap or a previous capture's detached broker remains healthy, both runs use the host-global 127.0.0.1:47911 endpoint despite their separate runtime directories, causing an address-in-use failure or reuse of a broker where sessions[0] can belong to the other capture and receive its navigation and highlight commands.

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/launch-video/capture.ts
Line: 217

Comment:
**Fixed port breaks daemon isolation**

If two attention captures overlap or a previous capture's detached broker remains healthy, both runs use the host-global `127.0.0.1:47911` endpoint despite their separate runtime directories, causing an address-in-use failure or reuse of a broker where `sessions[0]` can belong to the other capture and receive its navigation and highlight commands.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

elucid added 3 commits August 16, 2026 17:52
A pinned port was a machine-wide resource: concurrent captures, a
daemon left by a crashed run, or an unrelated listener on that port
could make the scene talk to the wrong daemon or fail to start one.
Binding port 0 and handing the OS-assigned port to the scene keeps
daemon isolation true per run instead of true by convention.
…ture

The attention scene hard-coded its isolated daemon, its session CLI runner,
and its demo content inside one scene function, so any future scene that
wants to show an agent driving Hunk would have had to copy all three.

Split that glue out: agentDriver.ts owns the private daemon (scratch runtime
dir plus an OS-assigned port, never HUNK_MCP_DISABLE), polls registration,
and plays declarative gestures — silent commands issued off camera, shell
commands typed on camera against the same daemon. demoContent.ts owns the
generated report module and the demo repos, so every line and offset a scene
points at is computed instead of hand-counted.

The scene becomes captureAgentScene: it now also shows the CLI surface
itself, a cross-file mark, and a comment persisting what a mark cannot, with
frames renamed to the agent- prefix.
Capture scenes rot when nothing consumes their frames: the compose preflight
only fails on frames a storyboard references. Append a six-shot agent segment
to the canonical storyboard so the reworked scene's frame names are checked
in and exercised by every full-capture preflight, and document how
agent-driven scenes are authored — isolated daemon, declarative gestures,
`--repo .` on camera, computed offsets.
@elucid elucid changed the title chore(launch-video): add agent-attention capture scene refactor(launch-video): agent-driven capture infrastructure and scene Aug 16, 2026
@elucid
elucid marked this pull request as draft August 17, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant