Introduction

A high-performance orchestration framework designed to bridge the gap between the Node.js runtime and the native macOS automation infrastructure.

Core Architecture

IPC Bridge

Low-latency JSON communication between Node.js and the system event bus.

Persistent Workers

Eliminates the performance overhead of repeated script compilation.

Native Security

Direct integration with macOS Transparency, Consent, and Control (TCC).

Implementation Workflow

01

Environment Setup

Deploy the stable orchestration package to your environment. apple-js requires Node.js 14+ and a valid macOS execution context.

bash
npm install apple-js-stable
02

Orchestration Initialization

Establish the initialization bridge. All system calls are non-blocking and return standard Promises.

javascript
const { Osascript } = require("apple-js-stable");
const script = new Osascript();

async function initializeCore() {
    // Establish high-availability notification link
    await script.executeScript([
        script.appleCommands.notifications.banner("System Core Initialized"),
        script.appleCommands.speak("Automation bridge active."),
    ]);
    
    // Example: Trigger native security event
    await script.executeSingleCommand(
        script.appleCommands.systemControl.lockScreen()
    );
}

initializeCore();
03

Security Authorization

Native automation requires explicit user consent. You must authorize your terminal or code execution environment within the macOS security sandbox.

System Settings > Privacy & Security > Accessibility
Enable your Terminal app or IDE (e.g., VS Code)
System Settings > Privacy & Security > Automation
Verify AppleScript permissions for your specific application

Technical Guidance

Access deep-level technical documentation for specific automation targets.