@svatah/yam-adapter-ax
macOS Accessibility adapter: the Yam agent surface over AXUIElement
- Source:
packages/adapter-ax· README:packages/adapter-ax/README.md - Install:
npm install @svatah/yam-adapter-ax - Version 0.1.0 · Apache-2.0
Exports
| Export | Kind | Signature | |
|---|---|---|---|
accessibilityGranted | function | export function accessibilityGranted(options: { runner?: GrantRunner; platform?: string } = {}): | Whether Accessibility is granted, without showing anything. |
automationIdOf | function | export function automationIdOf(node: AxNode): string | undefined | The automationId candidate's value (LLD §3.3, §7.5). |
AX_ADAPTER_NAME | variable | AX_ADAPTER_NAME = "ax" | The name this adapter is selected by in yam.config.yaml (LLD §2.4). |
AX_CAPABILITIES | variable | AX_CAPABILITIES: Capabilities | What this adapter can do (LLD §2.4). |
AX_SUBROLE_MAP | variable | AX_SUBROLE_MAP: Readonly<Record<string, string>> | The subroles that mean something different from their role (LLD §7.5). |
AX_SUBROLE_NAME | variable | AX_SUBROLE_NAME: Readonly<Record<string, string>> | The accessible name a window-chrome control has by virtue of its subrole |
AxAdapterOptions | interface | export interface AxAdapterOptions | |
AxBridge | interface | export interface AxBridge | What the adapter needs from macOS. Everything else is a pure function. |
AxBridgeError | class | export class AxBridgeError extends Error | |
AxCheckContext | interface | export interface AxCheckContext | |
AxCommand | typealias | export type AxCommand | An action the bridge performs on one element, addressed by its path. |
AxIdentity | interface | export interface AxIdentity | Who a running application actually is (native-feedback D4). |
AxNode | interface | export interface AxNode | One accessibility element, flattened (LLD §7.5). |
AxPermission | interface | export interface AxPermission | |
AxPermissionState | typealias | export type AxPermissionState | Why an accessibility call could not be made. |
AxSession | interface | export interface AxSession | Whether anything in this login session owns a window (Draft 2.12 §7.5, P9-F7). |
AxSnapshotCost | interface | export interface AxSnapshotCost | What one snapshot() cost, which Draft 2.8 §7.5 requires the desktop |
AxSnapshotNode | interface | export interface AxSnapshotNode extends SnapshotNode | A snapshot node, plus what only the walk knows. |
AxSurface | class | export class AxSurface implements AgentSurface | |
AxWindow | interface | export interface AxWindow | What the bridge was asked to do, and what came back. |
childIndex | function | export function childIndex(nodes: readonly AxNode[]): Map<number, number[]> | The children index controlPathOf needs, for callers that have only nodes. |
controlPathOf | function | export function controlPathOf( | Window[Yam]/AXGroup[2]/AXButton[Run] (LLD §3.3, §7.5). |
ConvertOptions | interface | export interface ConvertOptions | |
convertTree | function | export function convertTree(nodes: readonly AxNode[], options: ConvertOptions): AxSnapshotNode[] | Flatten one window's tree into snapshot nodes. |
createAxSurface | function | export function createAxSurface(config: | The factory the registry calls (LLD §2.4). |
evaluateAxPredicate | function | export function evaluateAxPredicate( | |
GrantRunner | interface | export interface GrantRunner | How this module reaches the host; replaced in tests. |
insideList | function | export function insideList(nodes: readonly AxNode[], index: number): boolean | Whether this node is inside a list (see roleOf). |
insidePopUp | function | export function insidePopUp(nodes: readonly AxNode[], index: number): boolean | Whether this node is inside a pop-up button's menu (see roleOf). |
isTextual | function | export function isTextual(node: AxNode): boolean | |
keyChord | function | export function keyChord(key: string): { text: string; code?: number; using: string[] } | A key name → what System Events sends. |
literalValue | function | export function literalValue(ref: ValueRef): string | The literal a ValueRef names; an unresolved one is a caller mistake (LLD §8.2). |
LOGIN_WINDOW | variable | LOGIN_WINDOW = "loginwindow" | The process that owns the screen when nobody is at it. |
machineLoad | function | export function machineLoad(): { loadAverage1m: number; cpus: number } | What the machine was doing when a read finished (Draft 2.10 §7.5, P8-F2). |
matchNodes | function | export function matchNodes( | Every node the candidate matches, in snapshot order. |
nameFor | function | export function nameFor(who: ResponsibleProgram): string | How to say "add this program" when the program has a name. |
nameOf | function | export function nameOf(node: AxNode): string | The accessible name (REQ-SURF-4). |
osascriptBridge | function | export function osascriptBridge(options: OsascriptBridgeOptions): AxBridge | The real bridge: osascript, System Events, and this machine. |
OsascriptBridgeOptions | interface | export interface OsascriptBridgeOptions | |
OsascriptLanguage | typealias | export type OsascriptLanguage = "JavaScript" | "AppleScript"; | Which osascript dialect a script is written in. |
parseWindow | function | export function parseWindow(stdout: string): | |
PERFORM_SCRIPT | variable | PERFORM_SCRIPT = function processWithWindow(se, name)` | |
registerAxAdapter | function | export function registerAxAdapter(): void | Register the adapter. Idempotent, because the registry refuses a silent |
requestAccessibility | function | export function requestAccessibility(options: { runner?: GrantRunner; platform?: string } = {}): | Ask macOS to show the Accessibility prompt, and answer whether it is granted. |
requestScreenRecording | function | export function requestScreenRecording(options: { runner?: GrantRunner; platform?: string } = {}): | The same, for Screen Recording. Also once per application, forever. |
responsibleProgram | function | export function responsibleProgram( | The application that owns this process, by walking ps to launchd. |
ResponsibleProgram | interface | export interface ResponsibleProgram | The application a macOS permission would be attached to. |
roleOf | function | export function roleOf( | AXRole → an ARIA role, with the subrole consulted first. |
runOsascript | function | export async function runOsascript( | Run one JXA script, with a hard deadline. |
saidBy | function | export function saidBy(node: | The words an element itself puts on the screen (native-feedback D3). |
screenRecordingGranted | function | export function screenRecordingGranted(options: { runner?: GrantRunner; platform?: string } = {}): | Is Screen Recording granted? |
statesOf | function | export function statesOf(node: AxNode): NodeState[] | The states LLD §2.2 lists, from the attributes macOS exposes. |
synthesise | function | export function synthesise( | The candidate bundle for one element, best first (REQ-REC-3, LLD §3.3). |
valueOf | function | export function valueOf(node: AxNode): string | undefined | The value a read("value") and a value predicate see. |