Skip to content

✦ Developer

Console API

When API mode is enabled, Dripwriter Origin exposes window._dripwriter on every open tab — a Google Doc, a Canvas assignment, the Packback editor, or any page with a text box — the same typing engine that powers the popup, scriptable from DevTools or an AI agent running in the page.

Enabling

  1. Open the Dripwriter Origin popup.
  2. Toggle Enable API mode at the bottom of the popup.
  3. The API is now active on every currently-open tab with a text box. No reload required.

Toggling off removes window._dripwriter from every 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
FieldDefaultValid rangeNotes
text""non-empty (trimmed)Required for start(). \r\n normalized to \n.
wpm6020–150Base typing speed (words per minute, 5 chars/word).
speedVariance300–80Per-character speed jitter, percent.
typoRate30–30Probability of a neighbor-key typo per letter, percent.
detourRate30–25Probability of a "false start" word at the start of a word, then deleting it.
breakFrequencySeconds5510–600Average active-typing seconds between idle breaks.
breakFrequencyVariance300–100Percent jitter applied to breakFrequencySeconds.
breakMinSeconds33–60Minimum idle-break duration.
breakMaxSeconds15breakMinSeconds–90Maximum idle-break duration. Raised to breakMinSeconds if lower.

Methods

MethodReturnsBehavior
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, resumable?: boolean }>Returns a snapshot of the current run state. resumable is true when a stopped run can be continued from the popup.
versionstringRead-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 · the cursor leaves the text box · 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. When a run is stopped mid-way, resumable is true — the user can press Resume in the popup to continue from where they left off.

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

  • With API mode enabled, the bridge is available on any page you're typing into — Google Docs, Canvas, Packback, or any standard textarea or contenteditable field. Microsoft Word Online is not supported via the console API — use the popup instead.
  • 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

  1. Always await start(). The Promise resolves on natural completion — don't poll status().
  2. Snapshot the text into config.text before calling start(). Mutating it mid-run has no effect.
  3. If the cursor isn't in the editable area, typing fails — on Google Docs with "The Google Docs cursor was lost. Click back into the document and retry.", and on other fields with a similar “click back into it” message — surface it to the user.