fix(type): remove default keystroke delay
This commit is contained in:
parent
1c6273c017
commit
aabea1550e
@ -17,7 +17,7 @@ struct TypeCommand: ErrorHandlingCommand, OutputFormattable, RuntimeOptionsConfi
|
||||
var snapshot: String?
|
||||
|
||||
@Option(help: "Delay between keystrokes in milliseconds")
|
||||
var delay: Int = 2
|
||||
var delay: Int = 0
|
||||
|
||||
@Option(name: .customLong("wpm"), help: "Approximate human typing speed (words per minute)")
|
||||
var wordsPerMinute: Int?
|
||||
@ -393,7 +393,7 @@ extension TypeCommand: ParsableCommand {
|
||||
Without a target, keys are injected into the current focused element.
|
||||
|
||||
TYPING CADENCE:
|
||||
Linear typing is the default and uses --delay (2ms by default).
|
||||
Linear typing is the default and uses --delay (0ms by default).
|
||||
Use --profile human or --wpm (80-220) for realistic cadence.
|
||||
""",
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ struct TypeCommandTests {
|
||||
|
||||
#expect(command.text == "Hello World")
|
||||
#expect(command.jsonOutput == true)
|
||||
#expect(command.delay == 2) // default delay
|
||||
#expect(command.delay == 0) // default delay
|
||||
#expect(command.pressReturn == false)
|
||||
#expect(command.clear == false)
|
||||
}
|
||||
@ -42,7 +42,7 @@ struct TypeCommandTests {
|
||||
|
||||
#expect(command.text == "New Text")
|
||||
#expect(command.clear == true)
|
||||
#expect(command.delay == 2) // default delay
|
||||
#expect(command.delay == 0) // default delay
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -57,7 +57,7 @@ struct TypeCommandTests {
|
||||
func `Type command with human typing speed`() throws {
|
||||
var command = try TypeCommand.parse(["Message", "--wpm", "140", "--json"])
|
||||
#expect(command.wordsPerMinute == 140)
|
||||
#expect(command.delay == 2)
|
||||
#expect(command.delay == 0)
|
||||
// Validation should allow the selected range
|
||||
try command.validate()
|
||||
}
|
||||
@ -103,7 +103,7 @@ struct TypeCommandTests {
|
||||
#expect(result.exitStatus == 0)
|
||||
let call = try #require(await self.automationState(context) { $0.typeActionsCalls.first })
|
||||
if case let .fixed(milliseconds) = call.cadence {
|
||||
#expect(milliseconds == 2)
|
||||
#expect(milliseconds == 0)
|
||||
} else {
|
||||
Issue.record("Expected linear cadence")
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
- `peekaboo type` and the MCP `type` tool now default to fast linear typing at 2ms per character; supplying `--wpm`/`wpm` still opts into human cadence.
|
||||
- `peekaboo type` and the MCP `type` tool now default to zero-delay linear typing; supplying `--wpm`/`wpm` still opts into human cadence.
|
||||
- Hardened the maintainer release workflow around 1Password credential consistency, non-login shells, and neutral-directory npm verification.
|
||||
|
||||
## [3.5.1] - 2026-06-12
|
||||
|
||||
@ -35,8 +35,8 @@ public struct TypeTool: MCPTool {
|
||||
description: "Optional. Snapshot ID from `see` or `inspect_ui`. " +
|
||||
"Uses latest snapshot if not specified."),
|
||||
"delay": SchemaBuilder.number(
|
||||
description: "Optional. Delay between keystrokes in milliseconds (linear profile). Default: 2.",
|
||||
default: 2),
|
||||
description: "Optional. Delay between keystrokes in milliseconds (linear profile). Default: 0.",
|
||||
default: 0),
|
||||
"profile": SchemaBuilder.string(
|
||||
description: "Optional. Typing profile: linear (default) or human."),
|
||||
"wpm": SchemaBuilder.number(
|
||||
@ -109,7 +109,7 @@ public struct TypeTool: MCPTool {
|
||||
text: arguments.getString("text"),
|
||||
elementId: arguments.getString("on"),
|
||||
snapshotId: arguments.getString("snapshot"),
|
||||
delay: Int(arguments.getNumber("delay") ?? 2),
|
||||
delay: Int(arguments.getNumber("delay") ?? 0),
|
||||
profile: profile,
|
||||
wordsPerMinute: wordsPerMinute,
|
||||
clearField: arguments.getBool("clear") ?? false,
|
||||
|
||||
@ -1590,7 +1590,7 @@ struct MCPToolErrorHandlingTests {
|
||||
}
|
||||
|
||||
if case let .fixed(milliseconds) = cadence {
|
||||
#expect(milliseconds == 2)
|
||||
#expect(milliseconds == 0)
|
||||
} else {
|
||||
Issue.record("Expected linear cadence, got \(cadence)")
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ read_when:
|
||||
| --- | --- |
|
||||
| `[text]` | Optional positional string; supports escape sequences like `\n` (Return) and `\t` (Tab). |
|
||||
| `--snapshot <id>` | Target a specific snapshot; otherwise the most recent snapshot ID is used if available. |
|
||||
| `--delay <ms>` | Milliseconds between synthetic keystrokes (default `2`). |
|
||||
| `--delay <ms>` | Milliseconds between synthetic keystrokes (default `0`). |
|
||||
| `--wpm <80-220>` | Enable human-typing cadence at the chosen words per minute. |
|
||||
| `--profile <linear|human>` | Switch between linear (default, honors `--delay`) and human (honors `--wpm`). |
|
||||
| `--clear` | Issue Cmd+A, Delete before typing any new text. |
|
||||
@ -32,7 +32,7 @@ read_when:
|
||||
- You can omit the text entirely and rely on the key flags (e.g., just `--tab 2 --return`). Validation only requires *some* action to be specified.
|
||||
- Escape handling splits literal text and key presses: `"Hello\nWorld"` becomes `text("Hello"), key(.return), text("World")`, so newlines don’t require separate flags.
|
||||
- Without a resolvable snapshot or target process, the command falls back to foreground/global keyboard input and logs a warning that typing will be “blind” because it cannot confirm focus.
|
||||
- Default profile is `linear`, using a 2ms delay for fast deterministic input. Passing `--wpm` opts into human cadence; `--profile human` uses 140 WPM when `--wpm` is omitted.
|
||||
- Default profile is `linear`, using no inter-key delay for fast deterministic input. Passing `--wpm` opts into human cadence; `--profile human` uses 140 WPM when `--wpm` is omitted.
|
||||
- Background delivery uses process-targeted CoreGraphics keyboard events and requires Event Synthesizing access. Apps that only accept typing in a focused key window may still need `--foreground`.
|
||||
- JSON output reports `totalCharacters`, `keyPresses`, delivery mode, optional target PID, and elapsed time; this matches what the agent logs when executing scripted steps.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user