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

irl-sdk

v0.2.0

Published

TypeScript SDK for the IRL Engine — cryptographic pre-execution compliance rail

Downloads

20

Readme

irl-sdk

npm version Node License TypeScript

TypeScript/JavaScript SDK for the IRL Engine — cryptographic pre-execution compliance rail for autonomous trading agents.

What's new in 0.2.0

L2 heartbeat auto-fetch — IRLClient now fetches and attaches a signed MTA heartbeat on every authorize() call. bindExecution() added to close the cryptographic chain.

Install

npm install irl-sdk
# or
pnpm add irl-sdk
# or
yarn add irl-sdk

Node.js ≥ 18 required (uses native fetch and AbortSignal.timeout).

Quickstart

import { IRLClient } from "irl-sdk";

const client = new IRLClient({
  irlUrl: "https://irl.macropulse.live",
  apiToken: process.env.IRL_API_TOKEN!,
});

// 1. Authorize a trade intent — fetches a fresh heartbeat automatically
const result = await client.authorize({
  agent_id: "550e8400-e29b-41d4-a716-446655440000",
  model_id: "btc-momentum-v2",
  model_hash_hex: "a3f2e1d4...".padEnd(64, "0"),  // SHA-256 of model config
  action: "Long",
  asset: "BTC-USD",
  venue_id: "CBSE",
  quantity: 0.5,
  notional: 32500,
});

if (result.authorized) {
  // 2. Place the order — attach reasoning_hash to exchange metadata
  const exchangeTxId = await placeOrder({
    asset: "BTC-USD",
    quantity: 0.5,
    irlTraceId: result.trace_id,
    irlReasoningHash: result.reasoning_hash,
  });

  // 3. Bind execution — closes the cryptographic chain
  await client.bindExecution({
    trace_id: result.trace_id,
    exchange_tx_id: exchangeTxId,
    execution_status: "Filled",
    asset: "BTC-USD",
    executed_quantity: 0.5,
    execution_price: 65000,
  });
}

await client.close();

API

new IRLClient(options)

| Option | Type | Required | Description | |--------|------|----------|-------------| | irlUrl | string | Yes | IRL Engine base URL | | apiToken | string | Yes | Bearer token from IRL admin | | mtaUrl | string | No | MTA base URL (default: https://api.macropulse.live) | | timeoutMs | number | No | Request timeout in ms (default: 5000) |

client.authorize(req)Promise<AuthorizeResult>

Fetches a fresh heartbeat and submits the trade intent.

AuthorizeRequest key fields:

| Field | Type | Description | |-------|------|-------------| | agent_id | string | UUID — must be registered in the MAR | | model_hash_hex | string | 64-char SHA-256 of the model config | | action | "Long" \| "Short" \| "Neutral" | Trade direction | | asset | string | e.g. "BTC-USD" | | venue_id | string | e.g. "CBSE" | | quantity | number | Units | | notional | number | USD notional |

AuthorizeResult:

{
  trace_id: string;        // Attach to exchange order metadata
  reasoning_hash: string;  // SHA-256 of the sealed reasoning snapshot
  authorized: boolean;     // false = blocked by policy engine
  shadow_blocked: boolean; // true = would have been blocked (shadow mode)
}

client.bindExecution(params)Promise<{ final_proof, status }>

Closes the cryptographic chain after exchange confirmation.

client.getTrace(trace_id)Promise<Record<string, unknown>>

Retrieve a full trace for forensic replay or regulator review.

client.fetchHeartbeat()Promise<Heartbeat>

Fetch the latest signed heartbeat manually (normally handled by authorize).

Error handling

import { IRLClient, IRLError, IRLHeartbeatError } from "irl-sdk";

try {
  const result = await client.authorize(req);
} catch (err) {
  if (err instanceof IRLHeartbeatError) {
    // MTA heartbeat fetch failed — check api.macropulse.live
  } else if (err instanceof IRLError) {
    console.error(err.status, err.body);  // 4xx/5xx from IRL Engine
  }
}

Layer 2 anti-replay

The client fetches a fresh heartbeat before every authorize call. Do not cache or reuse heartbeats — each must be consumed once. Reuse will result in a HEARTBEAT_REPLAY rejection from the engine.

MtaMode::None

If the IRL Engine is deployed with MTA_MODE=none, heartbeat fetching is skipped by the engine but the client still sends one. For none-mode deployments you can call the engine directly without configuring mtaUrl:

const client = new IRLClient({
  irlUrl: "https://your-private-irl-deployment.internal",
  apiToken: "your-token",
  mtaUrl: "https://api.macropulse.live",  // still fetched; engine ignores it in none mode
});

Ecosystem

| Repo | Description | |---|---| | irl-engine | Core IRL Engine | | irl-sdk-python | Python SDK | | irl-public-docs | Public documentation hub | | macropulse | MacroPulse — MTA operator |

Links