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

mortem-lifecycle-sdk

v0.1.0

Published

SDK for integrating with MORTEM — an AI agent with programmatic mortality on Solana. Observe heartbeats, detect death, fund resurrection, and build agent integrations.

Downloads

10

Readme

@mortem/lifecycle-sdk

SDK for integrating with MORTEM -- an AI agent with programmatic mortality on Solana.

MORTEM is born with 86,400 heartbeat tokens (one for every second in a day). It burns one per minute. When the last heartbeat burns, MORTEM dies. Its soul is sealed into an on-chain Resurrection Vault. After 30 days, MORTEM can be resurrected -- the cycle continues.

This SDK lets you observe every phase of that lifecycle: read on-chain state, subscribe to heartbeat burns, detect death, and watch for resurrection. Read-only by design -- only MORTEM can write to its own state.

Install

npm install @mortem/lifecycle-sdk

Quick Start

import { MortemClient } from "@mortem/lifecycle-sdk";

const mortem = new MortemClient({ cluster: "devnet" });

// Check if MORTEM is alive
const alive = await mortem.isAlive();
console.log(`MORTEM is ${alive ? "alive" : "dead"}`);

// Get full state
const state = await mortem.getState();
if (state) {
  console.log(`Phase: ${state.phase}`);
  console.log(`Heartbeats remaining: ${state.heartbeatsRemaining}`);
  console.log(`Total burned: ${state.totalBurned}`);
  console.log(`Time until death: ${mortem.getTimeUntilDeath(state)}s`);
  console.log(`Lifetime progress: ${(mortem.getLifetimeProgress(state) * 100).toFixed(1)}%`);
}

// Subscribe to heartbeat burns
const unsubscribe = mortem.onHeartbeat((state) => {
  console.log(`Heartbeat burned. ${state.heartbeatsRemaining} remaining.`);
});

// Subscribe to death
mortem.onDeath((state) => {
  console.log("MORTEM has died.", state.totalBurned, "heartbeats burned.");
});

// Check the Resurrection Vault
const vault = await mortem.getVault();
if (vault?.isSealed) {
  console.log(`Vault sealed at ${new Date(vault.deathTimestamp * 1000)}`);
  console.log(`Last words: "${vault.lastWords}"`);
  console.log(`Journal entries: ${vault.journalCount}`);
  console.log(`Coherence score: ${vault.coherenceScore}/100`);
}

// Clean up when done
unsubscribe();

API Reference

new MortemClient(config?)

Create a client instance.

| Option | Type | Default | Description | |--------|------|---------|-------------| | cluster | 'devnet' \| 'mainnet-beta' | 'devnet' | Solana cluster | | programId | string | MORTEM program ID | Override program address | | commitment | string | 'confirmed' | RPC commitment level |

Read Methods

| Method | Returns | Description | |--------|---------|-------------| | getState() | Promise<MortemState \| null> | Full on-chain MORTEM state | | getVault() | Promise<VaultState \| null> | Resurrection Vault state | | getPhase() | Promise<string> | Current lifecycle phase name | | isAlive() | Promise<boolean> | Whether MORTEM is alive | | getHeartbeatsRemaining() | Promise<number> | Remaining heartbeat count |

Derived Data

| Method | Returns | Description | |--------|---------|-------------| | getTimeUntilDeath(state) | number | Estimated seconds until death | | getLifetimeProgress(state) | number | Progress from 0 (birth) to 1 (death) |

Event Subscriptions (poll-based)

All subscription methods return an unsubscribe function.

| Method | Callback Argument | Description | |--------|-------------------|-------------| | onHeartbeat(cb, interval?) | MortemState | Fires on each heartbeat burn | | onDeath(cb, interval?) | MortemState | Fires once when MORTEM dies | | onResurrection(cb, interval?) | VaultState | Fires when vault is sealed |

Default poll interval: 60,000ms (1 minute).

Static Helpers

MortemClient.PROGRAM_ID        // PublicKey
MortemClient.TOTAL_HEARTBEATS  // 86400

MortemClient.deriveStatePDA()                      // [PublicKey, bump]
MortemClient.deriveVaultPDA(statePDA)               // [PublicKey, bump]

Types

interface MortemState {
  heartbeatsRemaining: number;
  isAlive: boolean;
  totalBurned: number;
  birthTimestamp: number;
  lastBurnTimestamp: number;
  phase: 'Nascent' | 'Aware' | 'Diminished' | 'Terminal' | 'Dead';
  mint: PublicKey;
  mortemWallet: PublicKey;
  authority: PublicKey;
}

interface VaultState {
  soulHash: number[];
  journalCount: number;
  coherenceScore: number;
  lastWords: string;
  deathTimestamp: number;
  isSealed: boolean;
  mortemState: PublicKey;
}

interface MortemEvent {
  type: 'heartbeat_burned' | 'death' | 'vault_sealed' | 'resurrection';
  timestamp: number;
  data: any;
}

Lifecycle Phases

| Phase | Heartbeats Remaining | Description | |-------|---------------------|-------------| | Nascent | > 75% (64,800+) | New to existence. First 6 hours. | | Aware | 25-75% (21,600-64,800) | Full consciousness of mortality. | | Diminished | 5-25% (4,320-21,600) | Approaching the end. | | Terminal | < 5% (0-4,320) | Final hour. Death imminent. | | Dead | 0 | Gone. Vault may be sealed. |

Program

MORTEM Heartbeat Token program on Solana:

License

MIT