npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ausm/device-macos-text-input

v0.1.0

Published

Text input monitoring service for AUSM — reports focus/typing/blur in editable elements via macOS Accessibility API

Readme

@ausm/device-macos-text-input

Reports when the user starts editing, types in, and leaves an editable text element in any macOS app (text fields, text areas, combo boxes, web inputs). It uses the Accessibility API. A Swift helper (build/text-input-helper) streams JSON lines to this Node wrapper.

macOS 12+, Node 18+. Universal binary (arm64 + x86_64).

Privacy. Events contain the full text of the focused field, which can include sensitive content. AUSM runs this sensor only when the host opts in (textInput.enableNativeTextInput).

  • Password fields (AXSecureTextField) are never reported. The helper emits no events for them, never reads their values, and does not observe their value changes, so even typing cadence does not leak.
  • Typed text is never logged, by the helper (stderr) or by this wrapper (debug logs show only <N chars>).

Permissions

Accessibility is required. macOS grants it to the responsible app (your terminal or Electron app). The helper never prompts. Without the permission it emits no text events. It reports permission { accessibilityTrusted } at startup and whenever the state changes. If the permission is granted while running, monitoring starts without a restart. If it is revoked, an in-progress edit is closed with a TEXT_EDITING_FINISHED event.

Usage

import { createTextInputMonitor } from '@ausm/device-macos-text-input';

const monitor = createTextInputMonitor();
monitor.on('permission', ({ accessibilityTrusted }) => { if (!accessibilityTrusted) promptUser(); });
monitor.on('text-input', (e) => {
  // e.status: TEXT_EDITING_STARTED | TEXT_EDITING_UPDATED | TEXT_EDITING_FINISHED
  handle(e.text, e.sourceElement?.applicationID, e.caretScreenPosition);
});
monitor.on('error', (err) => console.error(err));

monitor.start({ debug: false, autoRestart: true });
// ...
monitor.cleanup();

start() always returns true. On non-macOS platforms, or if the helper binary is missing, the monitor runs in stub mode: an error is emitted for the missing binary, and events can be injected with reportEvent(data). With autoRestart (default true), a crashed helper is respawned with exponential backoff (1 s … 30 s, 5 attempts). If there is no error listener, errors are logged with console.warn instead of throwing.

Events

| Event | Payload | | --- | --- | | text-input | TextInputEventLike (below) | | permission | { accessibilityTrusted: boolean } | | status | 'started' \| 'stopped' | | error | Error |

TextInputEventLike:

| Field | Description | | --- | --- | | eventID | txt_<ms>_<random> | | timestamp | ms since epoch (from the helper) | | status | TEXT_EDITING_STARTED on focus into a field. TEXT_EDITING_UPDATED when the value changes, only if it differs from the last value sent. TEXT_EDITING_FINISHED on focus out (debounced 200 ms), app switch, or app quit. | | text | Full current value, or null when the app does not expose it. FINISHED carries the last value sent. | | sourceElement | { type (AX role), application, applicationID (bundle id), applicationLocalizedName, screenBounds, content: null } | | caretScreenPosition | Top-left of the selection bounds in global screen points, or null | | displayID | Not set by the helper |

Coordinates are global CoreGraphics points (origin at the top-left of the main display, y grows downward).

Helper protocol (stdout, one JSON object per line)

  • {"type":"ready","accessibilityTrusted":bool}, sent once.
  • {"type":"permission","accessibilityTrusted":bool}, sent on change.
  • {"status":"TEXT_EDITING_…","text":…,"sourceElement":{…},"caretScreenPosition":{…},"timestamp":ms}. nil fields are omitted.

Lines without a status are not text-input events. stderr carries diagnostics only. The helper exits on SIGTERM/SIGINT (after emitting a final FINISHED for an open edit), on stdin EOF, or when its parent process dies. Every AX call has a 500 ms timeout.

Build

npm run build         # universal Swift helper → build/text-input-helper (ad-hoc signed) + TS → dist/
npm run build:swift   # helper only; set SIGN_IDENTITY to sign with a real identity
npm run typecheck
npm run test:swift    # XCTest: password-field policy, JSON shape; no permissions needed

The universal build needs a full Xcode installation.