Commit Graph

41 Commits

Author SHA1 Message Date
Iisyourdad 0ab29e4ff0 Warm the frame recorder before hiding the window at recording start
Template tests / tests (push) Successful in 1m52s
Template tests / tests (pull_request) Successful in 1m46s
The first screenshot of a session was late while every later one was fine.
Cause: on 'Start recording' the window hid first and the capture backend
started warming up after — creating worker, getUserMedia, first frame takes
~1s. A click in that gap found no buffered frame and took the post-click
fresh shot.

armRecording() now warms the recorder while the window is still visible and
only hides once frames are buffering (with a brief post-hide settle so the
first frame shows the user's screen, not the dismissed app window). Verified
end to end with a new self-test scenario that clicks 250ms after start: the
first click is now served a pre-click frame instead of a post-click shot.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 08:48:54 -05:00
Iisyourdad 34cc358902 Never take a post-click screenshot when a pre-click frame exists
Template tests / tests (push) Successful in 1m48s
Template tests / tests (pull_request) Successful in 1m55s
The remaining 'captured slightly after the click' reports came from the
fresh-shot fallback, which grabs the screen when the click is processed
(after it). The previous lead change made that fallback *more* likely: a
frame now had to be >=120ms before the click to qualify, so on machines
where the capture stream can't always keep a frame that old buffered, more
clicks fell through to the post-click shot.

Make the click-lead a two-tier preference instead of a hard gate in
selectFrameForClick:
1. newest frame captured at least leadMs before the click (ideal margin), else
2. newest frame captured before the click at all.
Only when no pre-click frame exists does the caller fresh-shot. leadMs is
threaded through the stream backend to the worker so both selection paths
agree. Verified end to end: frames land ~120-170ms before each click,
markers stay at 0.00%, and the 8-click burst still saves all 8.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 08:40:33 -05:00
Iisyourdad 5b89b5c927 Capture the screen slightly before each click; record milestone in CHANGELOG
Template tests / tests (push) Successful in 1m58s
Template tests / tests (pull_request) Successful in 1m47s
Real-world recording now saves every click with exact markers; the only
remaining nit was screenshots feeling a touch late. Add a configurable
click-lead (capture.clickLeadMs, default 120ms) that targets the screen
just before the hook timestamp, and tighten the stream sampling cadence to
50ms so a frame near that target always exists. Verified end to end: frames
now land ~120-160ms before the click (was 25-57ms), markers stay at 0.00%
offset, and the 8-click burst still saves all 8.

Also document the milestone in docs/CHANGELOG.md and remove an accidental
paste of Gitea commit-page text from it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 08:12:13 -05:00
Iisyourdad 951bba7a21 Fix dropped clicks and late screenshots in fast recording
Template tests / tests (push) Successful in 2m13s
Template tests / tests (pull_request) Successful in 1m48s
Root cause of 'I clicked many times but only got two screenshots':
finishing/pausing a session called backend.stop(), which cancelled every
in-flight frame request to null. Clicks whose PNG had not finished
encoding yet were then dropped — only the first few survived.

Fixes:
- Stream backend now *drains* on stop: it stops accepting new requests but
  keeps the worker alive until frames already selected for queued clicks
  finish encoding. stop({ immediate: true }) keeps the old abandon-now
  behavior for an unhealthy worker.
- Two-stage worker reply: a fast 'frame-selected' ack pins the pairing and
  proves liveness; the slow PNG payload follows. A slow encode (seconds on
  software-rendered hosts) is no longer mistaken for a dead worker, which
  had been forcing the post-click fresh-shot fallback (late screenshots).
- Queued clicks carry their guide id and are stored even if the session
  ends while they wait in the queue.
- The tray gesture that stops a session is discarded by matching its
  recorded screen position, not a time window — a fast workflow click near
  the stop is no longer collateral damage. (Replaces the earlier grace
  window, which dropped whole bursts.)
- A click on a display with no ready stream resolves null so the caller
  fresh-shots the correct monitor instead of returning another screen.
- STEPFORGE_CAPTURE_LOG=1 prints one line per click decision; the
  second-instance handler now surfaces the running window instead of
  exiting silently.
- Self-test gains a fast-burst-then-finish scenario (8/8 saved) and the
  marker/coordinate checks remain at 0.00% offset.

Tests: 133 unit + all repo checks passing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 07:56:31 -05:00
Iisyourdad 5ca59805dc Make click selftest immune to real mouse input and DPI scaling
Template tests / tests (pull_request) Successful in 1m48s
Template tests / tests (push) Successful in 1m51s
- Stop the live OS click watcher during the selftest so the user's real
  clicks (toast dismissal, terminal focus) can't add extra steps and
  shift the marker comparisons.
- Inject clicks in physical pixels via dipToScreenPoint so the test
  measures correctly on scaled Windows displays.
- Guard the marker report against step-count mismatches instead of
  crashing on out-of-range indexing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 22:01:37 -05:00
Iisyourdad a0b69f8cc7 Rearchitect click capture: strict click-time frames, off-main-process recorder, exact marker coordinates
Template tests / tests (push) Successful in 1m50s
Implements the architecture change from ai_prompts/prompt3.md:

- New app/click-frames.js: shared timestamped frame ring + strict
  click-to-frame pairing (never a frame whose grab started after the
  click); legacy slack behavior kept behind capture.strictClickFrames=false.
- New stream capture backend (app/stream-backend.js + hidden worker
  window): per-display desktop media streams sampled into ring buffers
  and PNG-encoded entirely off the main process, so click delivery is
  never starved by capture work. Auto-degrades to the legacy in-process
  frame loop when streams cannot start or the worker stops answering.
- Clicks are paired with their frame at event time (eager pairing in
  enqueueClickCapture); only the storing is serialized, so slow encodes
  cannot skew later clicks in a fast burst.
- Linux watcher: restored event-time root coordinates from
  xinput test-xi2 and merge raw/regular twin events structurally.
- Replaced the 40ms time debounce with source-aware duplicate
  suppression: fast legitimate clicks are never dropped.
- New app/coords.js: physical-to-DIP conversion with multi-monitor and
  scale-factor handling; Windows keeps screenToDipPoint.
- STEPFORGE_CLICK_SELFTEST end-to-end hook: 3/3 clicks become steps via
  the stream backend with 0.00% marker offset on this host.
- Tests rewritten/added: strict selection, coords, stream backend,
  Linux coordinate parsing, twin merge, burst clicking (126 passing).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:33:31 -05:00
Iisyourdad 5b7b075e91 Fixed clicking location part 5 :(
Template tests / tests (push) Successful in 1m51s
2026-06-11 18:46:56 -05:00
Iisyourdad 6682cdae0f Fixed clicking location part 4
Template tests / tests (push) Successful in 1m52s
2026-06-11 16:57:59 -05:00
Iisyourdad 27439b475d Fixed clicking location part 3
Template tests / tests (push) Successful in 1m50s
2026-06-11 16:33:52 -05:00
Iisyourdad e7b91f8c4c Fixed clicking location part 2
Template tests / tests (push) Successful in 1m48s
2026-06-11 16:12:09 -05:00
Iisyourdad 646d6c4716 Fixed clicking location
Template tests / tests (push) Successful in 1m48s
2026-06-11 16:00:01 -05:00
Iisyourdad ec9371b43a Undo
Template tests / tests (push) Successful in 1m47s
2026-06-11 15:52:57 -05:00
Iisyourdad 298d7728b8 Fixed an issue where clicking wouldn't line up with screenshot part 5
Template tests / tests (push) Successful in 1m48s
2026-06-11 13:02:37 -05:00
Iisyourdad 3d80c86abf Fixed an issue where clicking wouldn't line up with screenshot part 4
Template tests / tests (push) Successful in 1m48s
2026-06-11 12:45:14 -05:00
Iisyourdad 42affc571d Fixed an issue where clicking wouldn't line up with screenshot part 3
Template tests / tests (push) Successful in 1m54s
2026-06-11 12:38:48 -05:00
Iisyourdad 0ecc1b473f Fixed an issue where clicking wouldn't line up with screenshot part 2
Template tests / tests (push) Successful in 1m56s
2026-06-11 12:23:02 -05:00
Iisyourdad 6d529256bb Fixed an issue where clicking wouldn't line up with screenshot
Template tests / tests (push) Successful in 1m49s
2026-06-11 12:08:37 -05:00
Iisyourdad c352741809 Fixed a bug where a resumed recording wouldn't update the image Part 2
Template tests / tests (push) Successful in 1m51s
2026-06-11 11:57:55 -05:00
Iisyourdad 72b3f10a8a Fixed a bug where a resumed recording wouldn't update the image
Template tests / tests (push) Successful in 1m54s
2026-06-11 11:48:09 -05:00
Iisyourdad 3df52e37fc added restore button
Template tests / tests (push) Successful in 1m48s
2026-06-11 11:35:57 -05:00
Iisyourdad 33c421b746 Added select button toggle for trash library grid
Template tests / tests (push) Successful in 2m0s
2026-06-11 11:31:58 -05:00
Iisyourdad 7e979cb2de small changes
Template tests / tests (push) Successful in 1m56s
2026-06-11 11:24:35 -05:00
Iisyourdad 4e342a7449 small changes
Template tests / tests (push) Successful in 1m49s
2026-06-11 11:21:06 -05:00
Iisyourdad 726f993a7a added select button while editing guides
Template tests / tests (push) Successful in 1m48s
2026-06-11 11:17:24 -05:00
Iisyourdad 706d9dce60 Make it so that the recording bar pops up everytime on the guide editor
Template tests / tests (push) Successful in 1m59s
2026-06-11 11:05:25 -05:00
Iisyourdad a5d0013c3a I know this wont work
Template tests / tests (push) Failing after 41s
2026-06-11 10:40:42 -05:00
Iisyourdad 333aa296c3 Fix selecting styling
Template tests / tests (push) Failing after 40s
Also moved license
2026-06-11 10:31:16 -05:00
Iisyourdad 85a34d6ab5 select button on cards in library view
Template tests / tests (push) Successful in 1m52s
2026-06-11 10:19:56 -05:00
Iisyourdad 99376fdeb2 Fix new-capture auto-hide, library capture bar, step delete, and click-capture timing
Template tests / tests (push) Successful in 1m49s
- New Capture sessions now start paused; the window only tucks away once
  the user clicks "Start recording" in the capture bar instead of hiding
  ~1.2s after starting.
- The capture status bar is shown only in the editor view, not over the
  library.
- Fix openModal/confirmDialog resolving as cancelled when an action button
  is clicked, which made the step "Delete" button (and other modal actions)
  silently no-op.
- Click-triggered captures now use the click-time cursor position for the
  marker and arm the capture cache as soon as recording starts, so the
  first click is captured instantly and accurately placed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 09:21:19 -05:00
Iisyourdad 451a831eb6 make click captures instant
Template tests / tests (push) Failing after 15s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 08:31:19 -05:00
Iisyourdad fe6ce675bd reduce click capture latency
Template tests / tests (push) Failing after 42s
Template tests / tests (pull_request) Failing after 16s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 08:15:50 -05:00
Iisyourdad 25bca7c3de Session UX: tray-controlled recording, no per-shot window hiding
Template tests / tests (push) Failing after 24s
Users couldn't click into the app mid-session: every automatic capture
hid the window for the shot, so it vanished under the cursor. Under
WSLg minimize() is a no-op and isFocused() sticks true, so neither can
be used for control.

- Sessions now hide the window once at start and show a red tray icon
  with Capture now / Pause-Resume / Open StepForge (auto-pauses) /
  Finish; finishing or quitting restores/cleans up properly
- Opening the app from the tray pauses capture; resuming tucks the
  window away again
- Automatic captures skip while the cursor is over a visible StepForge
  window (cursor-based, not focus-based, due to WSLg sticky focus)
- Per-shot latency reduced: with the window already hidden the 350 ms
  hide-repaint wait is skipped entirely
- OS notification announces the session; self-tests updated and green

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 22:51:01 -05:00
Iisyourdad 52fd516a5d Make capture sessions continuous: click-capture + interval auto-capture
Template tests / tests (push) Failing after 29s
The session previously only listened for the global hotkey, which is
unreliable under WSLg/Wayland — users got one screenshot and nothing
more. Sessions now layer three triggers:

- click-capture via OS adapters (xinput test-xi2 on X11, PowerShell
  GetAsyncKeyState polling on Windows), debounced, ignoring clicks on
  StepForge itself
- interval auto-capture (3/5/10 s) as the always-works fallback,
  enabled by default when click detection is unavailable
- the existing global hotkey, plus a manual Shoot button

The REC bar now shows live count + active trigger with Shoot / Auto /
Pause / Finish. New captures and added steps are selected in the
editor (explicit reload(stepId) wins over a surviving selection).
Capture self-test hook (STEPFORGE_CAPTURE_SELFTEST) verifies 3x
hotkey-path captures and interval capture end-to-end.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 22:33:12 -05:00
Iisyourdad 6e790832f5 Complete the app: capture UI, dialogs, template manager, shortcuts help
Template tests / tests (push) Failing after 21s
- Editor topbar reworked: Back | Capture ▾ (full screen/window/region/
  delay/paste/import/session) | Save | Export | Share (.sfgz) | More ▾
  (rename, guide placeholders, backups, linked guide, shortcuts,
  settings)
- New dialogs: backups & snapshots (undoable restore), guide/global
  placeholder editor, keyboard-shortcuts reference, template manager
  (rename/duplicate/delete/share/import .sfglt)
- Export dialog: editable per-format options generated from exporter
  defaults, save-as-template, preview opens the file in the default
  viewer and keeps the dialog open for tweaking
- export:defaults IPC + preload entry
- CSS for blocks panel, focused-view sliders, export options, rows
- ipc-surface test: every preload channel has a main handler; renderer
  api.*/dialogs.* usage stays within the exposed surface (60 tests)
- CHANGELOG/README updated; prompt2.md checklist fully ticked

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 22:15:15 -05:00
Iisyourdad 382dbc9717 Capture hardening, editor blocks/shortcuts, handoff checklist
- capture.js: window-mode falls back to screen under WSLg; app window
  hides during capture (showInactive restore for hotkey path so focus
  is not stolen from the documented app); region capture hides too
- editor: Blocks panel (text/code/table block editors), focused-view
  zoom/pan sliders, capture context menu, paste-image step, share as
  .sfgz, apply-style-across step/guide, annotation copy/paste,
  tool-key shortcuts (s/r/o/l/a/t/g/n/b/h/m/u/c), PageUp/Down step nav,
  Ctrl+=/-/0 zoom, Ctrl+Delete step delete, Shift-arrow fast nudge
- prompt2.md: prescriptive handoff checklist for finishing remaining
  dialogs/topbar/IPC/polish work

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 22:01:20 -05:00
Iisyourdad 03bd9b0e2b Fix renderer scope collisions, editor bugs; add welcome screen
Bug fixes from code review:
- Wrap renderer modules (canvas/dialogs/editor/app) in IIFEs: duplicate
  top-level 'const api' across plain scripts threw a SyntaxError that
  prevented app.js from ever running (blank window), and dialogs.js/
  editor.js silently overrode each other's labeledRow/makeSelect
- Focused-view toggle now writes step.focusedView.enabled instead of a
  nonexistent flat field that the schema dropped on save
- Annotation property edits no longer rebuild the panel on every
  keystroke (focus was stolen mid-typing); debounced save instead
- flushStep/undo/redo keep this.steps in sync with stepMap so the step
  list stops going stale after the first save
- Escape now deselects the annotation; Delete remains the delete key

Welcome screen (per spec): app opens to a title at top and three
buttons at the bottom — New Capture (creates a guide, opens the editor,
starts a capture session), Existing Workspace (library), Settings.
Brand click returns to the welcome screen.

Adds an env-gated dev screenshot hook (STEPFORGE_SCREENSHOT[_JS]) used
to visually verify welcome/library/editor views under WSLg.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 21:29:14 -05:00
Iisyourdad 4ab18080ce Revert "welcome screen"
Template tests / tests (push) Failing after 16s
This reverts commit 34fe8183b6.
2026-06-10 20:05:39 -05:00
Iisyourdad 34fe8183b6 welcome screen
Template tests / tests (push) Failing after 16s
2026-06-10 20:03:18 -05:00
Iisyourdad a21e086ac7 Revert "Add welcome landing screen"
Template tests / tests (push) Failing after 16s
This reverts commit 78247ac9ba.
2026-06-10 19:50:01 -05:00
Iisyourdad 78247ac9ba Add welcome landing screen
Template tests / tests (push) Failing after 16s
2026-06-10 19:48:41 -05:00
Iisyourdad f47aca67c2 Finish Electron shell and workflow wiring
Template tests / tests (push) Failing after 4s
2026-06-10 18:32:30 -05:00