Skip to content

feat: add type --interval-ms to type at a steady pace - #348

Merged
ctate merged 1 commit into
ctate/cursor-travel-before-leasefrom
ctate/type-interval
Oct 31, 2026
Merged

ctate merged 1 commit into
ctate/cursor-travel-before-leasefrom
ctate/type-interval

Conversation

@ctate

@ctate ctate commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor
  • Type one keystroke every N ms (1 to 2000) in one command, keeping combining marks, emoji sequences and CR LF together
  • Resolve and verify the field once, then post each keystroke on the clock under its own interaction lease, so headed typing keeps the cadence and other agents can act in between
  • Verify the result against the field after the last keystroke, wait on --wait-for once at the end, report how far a failed burst got, and document the flag

type --interval-ms 70 into TextEdit.

interval-typing.mp4

@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
agent-desktop Ready Ready Preview, v0 Oct 31, 2026 8:21am UTC

@ctate
ctate added this pull request to stack #351 October 30, 2026 22:26
@ctate
ctate force-pushed the ctate/type-interval branch from b1da6f9 to 1b7965c Compare October 30, 2026 23:11
@ctate
ctate marked this pull request as ready for review October 31, 2026 00:41
let request = context.request_base(Action::TypeText(unit.clone()));
let delivered = match &burst {
Some(burst) => deliver(adapter, burst, request, budget(unit)).map(|_| ()),
None => execute_ref_action_with_context(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

--wait-for runs after the first keystroke. type_text_interval.rs:49 sends keystroke 1 through execute_ref_action_with_context, which runs the wait immediately.

If the condition needs the full text, it times out and the rest is never typed. The error has no typed_keystrokes.

If the wait succeeds, keystrokes and post_state are written onto the wait snapshot instead of the result.

Fix: reject the two flags together, or run the wait once after the last keystroke.

clock.wait_for(index);
let request = context.request_base(Action::TypeText(unit.clone()));
let delivered = match &burst {
Some(burst) => deliver(adapter, burst, request, budget(unit)).map(|_| ()),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The burst reports keystroke 1's delivered_verified. .map(|_| ()) at L48 throws away the results of keystrokes 2..n.

If the final read fails, the old post_state is kept with no warning.

Fix: check the final value against the expected text, or downgrade to delivered_unverified.

@ctate
ctate force-pushed the ctate/type-interval branch from 1b7965c to 1d5426a Compare October 31, 2026 02:08
@ctate
ctate force-pushed the ctate/type-interval branch from 1d5426a to 04d3abf Compare October 31, 2026 03:49
@ctate
ctate requested a review from lahfir October 31, 2026 04:03
@ctate
ctate force-pushed the ctate/type-interval branch 2 times, most recently from c7dd4f2 to da1d14a Compare October 31, 2026 04:54
.saturating_mul(u32::try_from(index).unwrap_or(u32::MAX));
let on_grid = self.started + offset;
let due = self.previous.map_or(on_grid, |previous| {
on_grid.max(previous + self.interval / 2)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

started is set before the first keystroke, so a slow first one (or a lease stall) makes every later key go out at interval / 2.

fix: let the grid slide. after each keystroke set next = max(slot + interval, now + interval / 2) instead of using a fixed grid from started.

@ctate
ctate force-pushed the ctate/type-interval branch from da1d14a to 899c38e Compare October 31, 2026 08:03
- Type one keystroke every N ms (1 to 2000) in one command, keeping combining marks, emoji sequences and CR LF together
- Resolve and verify the field once, then post each keystroke on the clock under its own interaction lease, so headed typing keeps the cadence and other agents can act in between
- Verify the result against the field after the last keystroke, wait on `--wait-for` once at the end, report how far a failed burst got, and document the flag
@ctate
ctate force-pushed the ctate/type-interval branch from 899c38e to f06e54b Compare October 31, 2026 08:20
@ctate
ctate requested a review from lahfir October 31, 2026 08:35
@ctate
ctate merged commit 4075c76 into main Oct 31, 2026
24 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Issues and PR Oct 31, 2026
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.

2 participants