/push docs

Useful work, from your first session to your whole team.

Browse the docs
Connect and automate · Guide

Build with the Push SDK

Install the SDK bundled with your Mac app and choose the client, webhook verifier or custom-connector entry point.

Use @masslessai/push-sdk in your own JavaScript or TypeScript programs to read Push state, receive signed notifications or bridge another request system. An agent acting for you uses the Push skill and CLI, which carry the conversational workflow and confirmation steps.

Before you start

Use Push 1.10.329 or later on a Mac and a project where you can install a local npm package. The webhook and connector entry points require Node.js 20.3 or later. The general client is browser compatible, but credentials and host access still need a deliberate deployment choice.

You supply the API base and appropriate credential explicitly. The SDK does not discover your CLI context, sign in, install a runtime or run an agent for you. A workspace credential uses that caller's permissions; an intake token or webhook secret cannot substitute for it. The ordinary PushSDK constructor sends direct HTTP requests. Changing the API base does not configure an encrypted device connection or change the credential's authority.

Install from your app

Run this in a shell on the Mac with Push installed:

Run in your shell
push sdk path

It prints the SDK's location, version and exact npm install command. Run that installation command in your program's project. The app bundles an archive with its dependency, so installation can work offline. This package is distributed with Push rather than through the public npm registry.

The package version matches the app release that built it. Record the version in your lockfile. Updating Push does not update a copy already installed in your project; reinstall deliberately and check your program against the new version. If you develop on another machine, transfer the archive through your normal private project distribution.

Choose the credential role

Import the root as @masslessai/push-sdk; append /webhooks or /connector for the other roles. Choose the import for the credential your program holds:

Entry pointCredentialRuntime and state
Call Push (root)Workspace or agent credential; trusted local loopback can use none.Browser-compatible JavaScript client.
Verify signed deliveries (/webhooks)Connection signing secret.Node.js 20.3 or later; your own delivery-ID store.
Bridge a custom request system (/connector)Separate intake and output tokens.Node.js 20.3 or later; durable private journal.

Keep these credentials separate. The general client refuses intake and output tokens. A signing secret verifies received deliveries and gives no API access.

Make a first read

The following Node.js example reads the runtime-state capabilities for one workspace. Replace the workspace ID. apiBase is the API base for the host you are targeting, including its trailing /api/; the example uses the Mac's own loopback connection.

Tokenless loopback uses the local operator's authority. Run this only in a trusted program on the host. For a supported authenticated connection, provide token as a callback that reads your credential store; never embed a credential in source or browser code shared with other people.

Example
import { PushSDK, PushSDKError } from "@masslessai/push-sdk";

const push = new PushSDK({ apiBase: "http://127.0.0.1:3100/api/" });
try {
  const capabilities = await push.runtimeStateCapabilities("<workspace-id>");
  console.log(capabilities);
} catch (error) {
  if (!(error instanceof PushSDKError)) throw error;
  console.error(error.code, error.status, error.outcome);
}

The typed client also provides runtime-state reads, diagnostics, configuration-template catalog and preview/apply operations, and session communication helpers. Their authorization and prerequisites remain those of the underlying feature. Start with reads; use the template preview workflow before adding configuration writes. To read the named facts a Push Session records, such as a release stage, use entries; see record your team's facts.

Three more typed reads and writes are worth knowing. humanInputRequests, humanInputRequest and answerHumanInput read and answer what a runtime is waiting on a person for. setSessionPermission sets whether a session bypasses, asks or refuses from its next launch; a session's own credential cannot call it, see permission choices. readContextSourceFile returns one file a context source lists, addressed by its thread and message.

Receive webhooks

Import verifyCustomWebhook from @masslessai/push-sdk/webhooks. Pass the original request body, a header-name-to-value object, and your signing secret, or both secrets during rotation. Verify before acting on the payload. Do not parse and reserialize the body before checking its signature.

The verifier checks bounded input, signature and timestamp. Your HTTP receiver owns request admission, time limits, durable delivery-ID deduplication and the response. Verification alone does not make a delivery unique. See configuring a webhook.

Bridge a request system

The connector entry point provides MessagingAdapterClient and FileAdapterJournal for a custom connection. It uses separate intake and output tokens and durable private state. Your bridge owns provider authentication, sender identity, formatting and provider rate limits.

Keep private preparation separate from publication: a prepare callback returns a publish function for the first recipient-visible action. A readable shared-folder write is already publication. Preserve the journal across restarts and grant rotation; inspect uncertain publication rather than resending. The installed package's examples directory includes a local fake-provider example for learning this sequence without sending to a real recipient.

See the result

Confirm the installed package version and import the entry point your program uses. The first-read example should return the targeted host's capabilities or a bounded error. Verify a receiver with your own test delivery, and exercise a bridge with the local fake provider before connecting real senders. A successful API response is separate from recipient delivery.

Limits and recovery

PushSDKError includes a code, optional HTTP status and an outcome such as not_dispatched or unconfirmed. A structured refusal may be available separately; inspect only the fields needed, treating its text as returned data. Avoid logging complete errors, credentials or message bodies.

The general client bounds JSON responses to 128 KiB by default, with a per-call maximum of 8 MiB, requests to 1 MiB, and simultaneous requests to eight. It follows no redirect and automatically retries no mutation. A timeout or canceled request does not establish that a write failed; inspect the affected state before retrying.

Its general request() method supports compatible bounded JSON operations and explicitly requested binary responses with a caller-specified byte limit and reader. The caller must validate the returned file format. With the ordinary direct HTTP client, this method does not add general multipart uploads, streaming events, WebSocket sessions, an encrypted device connection, native IPC or filesystem operations. Connector-specific file support does not expand that general transport. The SDK is not a promise that every app capability has a typed method.

If something stops

If push sdk path reports a missing package, check the installed app and its version before choosing another distribution. For invalid_config, check the API base and credential role. For an access refusal, fix the caller's actual access rather than changing transports. For an unconfirmed mutation or send, retain the evidence and inspect its state.

Continue with connectors, templates or CLI automation.

Updated