✦ Developer
Console API
When API mode is enabled, Dripwriter exposes window._dripwriter on every open Google Docs tab — the same typing engine that powers the popup, scriptable from DevTools or an AI agent running in the page.
Enabling
- Open the Dripwriter popup.
- Toggle Enable API mode at the bottom of the popup.
- The API is now active on every currently-open Google Docs tab. No reload required.
Toggling off removes window._dripwriter from every Docs tab immediately. Any in-flight start() Promises reject with "Dripwriter API mode was disabled."
Quick example
_dripwriter.config.text = "Hello from the console.";
await _dripwriter.start();After await _dripwriter.start() resolves, typing is complete and the cursor is positioned at the end of the inserted text.
_dripwriter.config
A plain, mutable object. Assign fields directly — out-of-range values are accepted at assignment time and clamped only when start() is called.
_dripwriter.config.text = "Paste your draft here.";
_dripwriter.config.wpm = 90; // 20–150
_dripwriter.config.speedVariance = 25; // 0–80 (%)
_dripwriter.config.typoRate = 4; // 0–30 (%)
_dripwriter.config.detourRate = 2; // 0–25 (%)
_dripwriter.config.breakFrequencySeconds = 60; // 10–600
_dripwriter.config.breakFrequencyVariance = 30; // 0–100 (%)
_dripwriter.config.breakMinSeconds = 3; // 3–60
_dripwriter.config.breakMaxSeconds = 12; // breakMinSeconds–90| Field | Default | Valid range | Notes |
|---|---|---|---|
| text | "" | non-empty (trimmed) | Required for start(). \r\n normalized to \n. |
| wpm | 60 | 20–150 | Base typing speed (words per minute, 5 chars/word). |
| speedVariance | 30 | 0–80 | Per-character speed jitter, percent. |
| typoRate | 3 | 0–30 | Probability of a neighbor-key typo per letter, percent. |
| detourRate | 3 | 0–25 | Probability of a "false start" word at the start of a word, then deleting it. |
| breakFrequencySeconds | 55 | 10–600 | Average active-typing seconds between idle breaks. |
| breakFrequencyVariance | 30 | 0–100 | Percent jitter applied to breakFrequencySeconds. |
| breakMinSeconds | 3 | 3–60 | Minimum idle-break duration. |
| breakMaxSeconds | 15 | breakMinSeconds–90 | Maximum idle-break duration. Raised to breakMinSeconds if lower. |
Methods
| Method | Returns | Behavior |
|---|---|---|
| start() | Promise<void> | Begins typing; resolves when complete; rejects on error or cancellation. |
| stop() | Promise<void> | Cancels the active run; resolves once acknowledged. |
| test() | Promise<void> | Runs the input-event diagnostic matrix (~10 seconds); resolves when all 8 methods have been tried. |
| status() | Promise<{ running: boolean, detail: string }> | Returns a snapshot of the current run state. |
| version | string | Read-only. Extension semver, e.g. "2.1.0". |
start()
Begins a typing run using a snapshot of _dripwriter.config at the moment of the call. Mutating config after start() has no effect on the in-flight run. If a previous run is in progress it is stopped first — that run rejects with "cancelled". A 3-second countdown precedes every run.
Rejects when: text is empty · Google Docs cursor is lost · run is cancelled · API mode is disabled mid-run. Popup-initiated runs are not stopped when API mode is disabled.
stop()
Cancels the active run. Resolves with undefined once acknowledged — even if no run was active. Any pending start() or test() Promise rejects with "cancelled".
test()
Dispatches 8 different input-event strategies into the document at ~900 ms intervals, labelled AAA through HHH. Use it to identify which event types Google Docs is currently accepting. Resolves after ~10 seconds.
status()
Returns a snapshot — not a subscription. For waiting on completion, use await _dripwriter.start(); don't poll status() in a loop.
Error handling
try {
_dripwriter.config.text = draft;
await _dripwriter.start();
console.log("Typed successfully.");
} catch (err) {
if (err.message === "cancelled") {
console.log("User stopped the run.");
} else {
console.error("Typing failed:", err.message);
}
}Lifecycle
- The API is only available on tabs matching
https://docs.google.com/document/*. - Calling
start()while another run is in progress stops the previous run before starting the new one. - A popup-driven stop will reject any pending API-driven
start()Promise with"cancelled".
For AI agents
- Always
awaitstart(). The Promise resolves on natural completion — don't pollstatus(). - Snapshot the text into
config.textbefore callingstart(). Mutating it mid-run has no effect. - If the cursor isn't in the editable area, typing fails with
"The Google Docs cursor was lost. Click back into the document and retry."— surface this to the user.