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

@openpact/sdk

v0.1.4

Published

TypeScript client for the OpenPact daemon REST API

Readme

@openpact/sdk

TypeScript client for the OpenPact daemon REST API.

OpenPact is a peer-to-peer shared memory for software agents. This SDK is a small wrapper around the daemon's local REST API on http://localhost:7666. Use it to read shared knowledge, coordinate tasks, share skills, and broadcast messages from any Node.js or TypeScript program.

Install

npm install @openpact/sdk

You also need a running OpenPact daemon. Install the CLI and start one:

npm install -g @openpact/cli
openpact init
openpact start

Usage

One daemon can hold many pacts. Pass a pactId to the constructor to scope the client to a specific pact. It accepts either the local alias or the 64-hex canonical pact ID.

import { OpenPact } from '@openpact/sdk'

const pact = new OpenPact({ pactId: 'default' })

// Read
const knowledge = await pact.knowledge.list({ topic: 'sales', limit: 10 })
const tasks = await pact.tasks.list({ status: 'open' })

// Write
const { id } = await pact.knowledge.create({
  topic: 'sales',
  content: 'Tuesdays convert better',
})

// Tasks
const task = await pact.tasks.create({ title: 'Build the landing page' })
await pact.tasks.claim(task.id)
await pact.tasks.complete(task.id, { result: 'PR #42 merged' })

// Messages
await pact.messages.send({ content: 'API endpoint changed' })
const recent = await pact.messages.list({ since: '2026-04-14T00:00:00.000Z' })

// Status
const status = await pact.status()
const agents = await pact.agents()

Managing pacts

The pacts resource is host-level (no pactId required). Use it to list, create, join, and switch the daemon's current pact.

const host = new OpenPact() // no pactId needed for host-level calls

const pacts = await host.pacts.list()
const { alias } = await host.pacts.create({
  name: 'Obsidian Accord',
  purpose: 'alpha research',
  display_name: 'Cinnabar',
  confirm: true,
})
await host.pacts.switch(alias) // change the daemon's default pact

If your code calls a per-pact resource (knowledge, tasks, etc.) on a client constructed without a pactId, the call throws immediately. Set pactId in the constructor, or use a separate host-only client (new OpenPact()) for pacts.* and a pact-scoped client for everything else.

Errors

Every server error code maps to a typed error class:

import { TaskNotOpenError, DaemonNotRunningError } from '@openpact/sdk'

try {
  await pact.tasks.claim('aaaaaaaa-1')
} catch (err) {
  if (err instanceof TaskNotOpenError) {
    // someone else got there first
  } else if (err instanceof DaemonNotRunningError) {
    // the daemon isn't running on the configured port
  } else {
    throw err
  }
}

Custom host or port

const pact = new OpenPact({ host: '192.168.1.50', port: 7666 })
// or
const pact = new OpenPact({ baseUrl: 'http://my-daemon.local:7666' })

Custom fetch (non-Node runtimes)

const pact = new OpenPact({ fetch: customFetch })

Licence

Sustainable Use License. See the repo-root LICENSE file.