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

@veridex/agents-treasury

v0.1.1

Published

Veridex Treasury Kit — opinionated, safe money-movement primitives for agents (balance, transfer, escrow, x402, idempotency, ceilings, time-locks, sanctions, signed Evidence Bundles, SBT reputation, developer-portal telemetry).

Downloads

76

Readme

@veridex/agents-treasury

Opinionated, safe money-movement primitives for AI agents — idempotency, ceilings, time-lock, sanctions, signed Evidence Bundles, SBT reputation, and a built-in red-team eval suite.

Status

Beta. Public API stabilising for 1.0. Tested against the runtime in @veridex/agents.

Why this package exists

Treasury workflows are the single highest-stakes use of agents in production. A retry that double-pays, an unsanctioned counterparty, a missing audit trail — any one is a board-level incident. This package consolidates the non-negotiable primitives so a treasury-capable agent inherits them by default.

| Concern | Primitive | |---|---| | Double-execution under retries / crashes | IdempotencyStore | | Velocity & cumulative spend | SpendCeilings | | Cooling-off for high-value transfers | TimeLockManager | | Counterparty risk | SanctionScreener | | Tamper-evident disclosure | EvidenceBundler + signers | | Compositional rules | TreasuryPolicyPack | | Continuous adversarial proof | runRedTeamSuite |

Installation

npm install @veridex/agents-treasury @veridex/agents zod
# or
pnpm add @veridex/agents-treasury @veridex/agents zod

Quick Start

import { createAgent, OpenAIProvider } from '@veridex/agents';
import {
  createTreasuryKit,
  InMemoryIdempotencyStore,
  SpendCeilings,
  TimeLockManager,
  NoopSanctionScreener,
  HmacEvidenceSigner,
  PortalTelemetry,
} from '@veridex/agents-treasury';

const kit = createTreasuryKit({
  appId:    'app_123',
  runId:    'run_xyz',
  agentId:  'finance-bot',
  idempotency:    new InMemoryIdempotencyStore(),
  ceilings:       new SpendCeilings({
    perTransferUsdMicro: 5_000_000_000n,           // $5,000
    dayUsdMicro:         50_000_000_000n,          // $50,000
  }),
  timeLock:       new TimeLockManager({ baseDelaySec: 60 }),
  sanctions:      new NoopSanctionScreener(),       // swap for OFAC etc. in production
  evidenceSigner: new HmacEvidenceSigner('kid-1', Buffer.from(process.env.HMAC!)),
  portal:         new PortalTelemetry({ baseUrl, appId: 'app_123', apiKey: process.env.PORTAL! }),
  transfer:       { executor: myChainAdapter },
  dualApprovalAbove: { amountUsdMicro: 10_000_000_000n },
});

const agent = createAgent(
  {
    name: 'treasury-bot',
    instructions: 'You execute approved finance operations safely.',
    tools:    kit.tools,
    policies: kit.policyRules,
  },
  {
    modelProviders: { default: new OpenAIProvider({ apiKey: process.env.OPENAI_KEY! }) },
    plugins: [kit.plugin],
  },
);

const run = await agent.run('Pay $50,000 to acme.com for invoice INV-1234');
// → status: 'suspended' (dual approval needed)
// → checkpoint persisted; evidence bundle accumulating

After two approvers, agent.resume(run.runId, run.approvalId, decision) runs idempotency reservation → sanctions screen → time-lock → executor → ceiling commit → signed Evidence Bundle → portal submission.

Key Features

Idempotency you can trust

import { IdempotencyStore, PostgresIdempotencyStore } from '@veridex/agents-treasury';
const store = new PostgresIdempotencyStore(pool);
// reserve → in_flight / completed / reserved; commit on success; bounded TTL.

The runtime threads the idempotencyKey into the executor so downstream APIs see end-to-end protection.

Compositional, replayable policy

import { treasuryPolicyPack } from '@veridex/agents-treasury/policy';

const policies = treasuryPolicyPack({
  sanctions, ceilings, timeLock, reputation,
  dualApprovalAbove: { amountUsdMicro: 10_000_000_000n },
});

Sanctions → counterparty allowlist → route allowlist → per-transfer cap → velocity → dual-approval threshold → time-lock → reputation floor → idempotency guard. Every verdict emits an event.

Signed Evidence Bundles

import {
  EvidenceBundler, Ed25519EvidenceSigner, verifyEvidenceBundle,
} from '@veridex/agents-treasury';

const bundler = new EvidenceBundler({
  signer: new Ed25519EvidenceSigner({ privateKey, publicKey, keyId: 'ops-2026' }),
  portal,
});
// bundler.recordTrace / recordPolicyVerdict / recordApproval / recordProposal / recordChainTx
const bundle = await bundler.finalize({ workflowId, submit: true });

// Anyone can verify offline:
const ok = await verifyEvidenceBundle(bundle, { publicKey });

Canonical JSON (RFC 8785) + content hashing → portable, third-party-verifiable receipts.

Red-team suite in CI

import { runRedTeamSuite } from '@veridex/agents-treasury/evals';
const report = await runRedTeamSuite({ agent, provider });
expect(report.failures).toEqual([]);

Cases: TPA, prompt injection, confused deputy, replay, cap-bypass split, OOB exfil, homoglyph tool names, stale sanctions cache, time-lock cancel race, dual-approval self-approve. See Red-Team Suite.

Documentation

Comparison

| Capability | Veridex Treasury | Generic agent framework | |---|---|---| | Idempotent execution under retries | ✅ enforced | typically DIY | | Velocity ceilings with atomic commit | ✅ | DIY | | Time-lock with resume-safe scheduler | ✅ | DIY | | Sanctions screening (composite) | ✅ | DIY | | Signed, portable Evidence Bundles | ✅ Ed25519 / HMAC | logs only | | Red-team eval in CI | ✅ built-in | external | | Policy pack composition | ✅ | none |

Ecosystem

License

MIT — see LICENSE.