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

@totemsdk/agent-policy

v0.1.3

Published

Agent-policy interface contracts — the seam between the Phase 1.5 sovereignty stack and Phase 2 AI agents

Readme

@totemsdk/agent-policy

The interface seam between human wallets and AI agents.

Defines the type contracts that allow an AI agent to propose and execute payments within bounded, auditable policies. Used by @totemsdk/omnia for channel-level governance and exposed through @totemsdk/connect for extension-level agent interactions.

Install

npm install @totemsdk/agent-policy

This is a types-only package — no runtime, no dependencies.

What's inside

| Type | Role | |------|------| | PaymentIntent | Structured description of what an agent wants to pay and why | | AgentProposal | An agent's formal request to a wallet for funds | | AgentPolicy | Rules governing what an agent is allowed to spend (limits, allowed intents, expiry) | | AgentReceipt | Verifiable proof that a payment was executed per the agent's request | | AgentIdentity | The cryptographic identity of an agent (public key + metadata) |

Type definitions

interface PaymentIntent {
  purpose: string;          // Human-readable reason for the payment
  recipient: string;        // Minima address or statechain ID
  amount: string;           // Amount as a decimal string
  tokenid: string;          // '0x00' for native MIN, or a token ID
  metadata?: Record<string, unknown>;
}

interface AgentProposal {
  agentIdentity: AgentIdentity;
  intent: PaymentIntent;
  requestedAt: number;      // Unix ms timestamp
  nonce: string;            // Replay protection
  signature: string;        // Agent's WOTS signature over the intent
}

interface AgentPolicy {
  agentId: string;
  allowedIntents: string[]; // e.g. ['payment', 'swap', 'tip']
  limits: Record<string, string>; // tokenid → max amount per session
  expiresAt: number;        // Unix ms
}

interface AgentReceipt {
  proposalNonce: string;    // Links back to the AgentProposal
  txpowid: string;          // On-chain transaction ID
  actualAmount: string;
  executedAt: number;
  walletSignature: string;  // Wallet's WOTS signature over the receipt
}

interface AgentIdentity {
  agentId: string;
  publicKey: string;        // Agent's WOTS public key
  name?: string;
  endpoint?: string;        // Optional HTTPS callback for receipts
}

Usage

Wallet: evaluate an incoming agent proposal

import { AgentPolicy, AgentProposal } from '@totemsdk/agent-policy';

function canApprove(policy: AgentPolicy, proposal: AgentProposal): boolean {
  if (Date.now() > policy.expiresAt) return false;
  if (!policy.allowedIntents.includes(proposal.intent.purpose)) return false;

  const limit = policy.limits[proposal.intent.tokenid] ?? '0';
  return parseFloat(proposal.intent.amount) <= parseFloat(limit);
}

Agent: build a proposal

import type { AgentProposal, PaymentIntent } from '@totemsdk/agent-policy';

const intent: PaymentIntent = {
  purpose: 'subscription_renewal',
  recipient: 'MxDEF456...',
  amount: '5',
  tokenid: '0x00',
};

const proposal: AgentProposal = {
  agentIdentity: myIdentity,
  intent,
  requestedAt: Date.now(),
  nonce: crypto.randomUUID(),
  signature: await agentSigner.sign(intent),
};

Issue a receipt after payment

import type { AgentReceipt } from '@totemsdk/agent-policy';

const receipt: AgentReceipt = {
  proposalNonce: proposal.nonce,
  txpowid: broadcastResult.txpowid,
  actualAmount: proposal.intent.amount,
  executedAt: Date.now(),
  walletSignature: await walletSigner.sign(broadcastResult.txpowid),
};

See also