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

@verifiedstate/sdk

v0.3.0

Published

TypeScript SDK for the VerifiedState verified memory API

Downloads

659

Readme

@verifiedstate/sdk

TypeScript SDK for the VerifiedState verified memory API.

Install

npm install @verifiedstate/sdk

Quick Start

import { VerifiedStateClient } from '@verifiedstate/sdk';

const client = new VerifiedStateClient({
  apiKey: 'vs_live_...',
  baseUrl: 'https://api.verifiedstate.ai', // optional, this is the default
});

// Store content
const artifact = await client.ingest({
  namespace_id: 'your-namespace-uuid',
  content: 'The user prefers dark mode and uses PostgreSQL.',
  source_type: 'user_input',
});

// Extract assertions
const extracted = await client.extract({
  namespace_id: 'your-namespace-uuid',
  artifact_id: artifact.artifact_id,
});

// Verify an assertion
const receipt = await client.verify({
  assertion_id: extracted.assertion_ids[0],
  namespace_id: 'your-namespace-uuid',
});

// Query memory
const results = await client.query({
  namespace_id: 'your-namespace-uuid',
  query_text: 'What database does the user prefer?',
});

API Methods

ingest(params)

Store raw content and create an artifact with spans.

const result = await client.ingest({
  namespace_id: 'uuid',
  content: 'Raw text content to store',
  source_type: 'user_input', // or 'document', 'api', etc.
  source_id: 'optional-external-id',
});
// => { artifact_id, span_count, r2_stored }

extract(params)

Extract structured assertions from an artifact using LLM.

const result = await client.extract({
  namespace_id: 'uuid',
  artifact_id: 'artifact-uuid',
});
// => { assertions_created, assertion_ids }

verify(params)

Run the verification ladder and produce a signed receipt.

const result = await client.verify({
  assertion_id: 'assertion-uuid',
  namespace_id: 'uuid',
});
// => { receipt_id, status, final_confidence, conflicts_found }

query(params)

Multi-channel retrieval with intent-aware routing.

const result = await client.query({
  namespace_id: 'uuid',
  query_text: 'What is the user's preferred language?',
  mode: 'current',    // 'current' | 'point_in_time' | 'trusted'
  limit: 10,
  filters: { valid_only: true },
});
// => { assertions, receipts, total, answerable, channels_used }

Structured queries:

const result = await client.query({
  namespace_id: 'uuid',
  query: { subject: 'user:42', predicate: 'prefers' },
});

receipt(receiptId)

Retrieve a verification receipt by ID.

const detail = await client.receipt('receipt-uuid');
// => { receipt, assertion, evidence_spans }

chain(writerPrincipal)

Get the Merkle chain for a writer.

const chain = await client.chain('agent:billing');
// => { writer_principal, current_hash, assertion_count, recent_assertions }

compress(params)

Compress an artifact to IR1 format.

const result = await client.compress({
  namespace_id: 'uuid',
  artifact_id: 'artifact-uuid',
});
// => { encoded_artifact_id, compression_ratio }

decompress(params)

Decompress an encoded artifact.

const result = await client.decompress({
  namespace_id: 'uuid',
  encoded_artifact_id: 'encoded-uuid',
});
// => { content, verified }

challenge(params)

Challenge an assertion with counter-evidence.

const result = await client.challenge({
  assertion_id: 'assertion-uuid',
  namespace_id: 'uuid',
  reason: 'Contradicted by updated policy',
  counter_evidence: 'Policy v2 states...',
});
// => { challenge_id, status }

retract(params)

Retract an assertion.

const result = await client.retract({
  assertion_id: 'assertion-uuid',
  namespace_id: 'uuid',
  reason: 'Information no longer valid',
});
// => { retraction_id, status }

health(namespaceId)

Get memory health metrics.

const health = await client.health('namespace-uuid');
// => { namespace_id, total_assertions, verified_count, disputed_count, coverage_score }

Proof Meter

Billing attestation for AI agents. Every transaction signed, chained, and independently verifiable.

// Create a spend authorization
const cap = await client.meter.authorize({
  namespace_id: 'your-namespace-uuid',
  authorizedAgentId: 'agent-alpha',
  maxBudgetCents: 1000,
  scope: { allowedProviders: ['openai', 'anthropic'] },
});

// Submit a spend receipt
const receipt = await client.meter.spend({
  namespace_id: 'your-namespace-uuid',
  capabilityId: cap.capability_id,
  actorId: 'agent-alpha',
  providerId: 'openai',
  usageUnit: 'tokens',
  usageQuantity: 1500,
  costCents: 45,
  occurredAt: new Date().toISOString(),
});
// => { receipt_id, receipt_hash, signature, status: 'verified' }

// Check remaining budget
const budget = await client.meter.budget(cap.capability_id);
// => { spent_cents, remaining_cents, receipt_count, children }

// Verify a receipt (cryptographic integrity check)
const check = await client.meter.verify(receipt.receipt_id);
// => { verified: true, checks: { hash_integrity, signature_valid, chain_continuity, merkle_inclusion } }

// Settle receipts into a Merkle root
const settlement = await client.meter.settle({
  namespace_id: 'your-namespace-uuid',
  capabilityId: cap.capability_id,
});
// => { settlement_id, merkle_root, total_cost_cents, receipt_count }

Real-Time Subscriptions

Subscribe once. Get instant answers.

// Subscribe to your namespace
await client.subscribe(namespaceId);

// Four-tier retrieval — automatically takes the fastest path
const fact = await client.quickQuery(namespaceId, 'user|prefers.drink|morning');

Retrieval speed:

  • Existence check: 0.01ms (local filter, no network)
  • Cached facts: <1ms (live in memory via real-time stream)
  • Direct queries: <5ms (pre-computed state)
  • Complex queries: <100ms (full retrieval)

Before VerifiedState: 80ms per query, every time. After VerifiedState: 0.01ms to know if a fact exists, <1ms to retrieve it.

New Methods

  • subscribe(namespaceId) — load filter + cache + start receiving state
  • unsubscribe() — clean up subscription and clear cache
  • refreshFilter(namespaceId) — refresh existence filter (call every ~5 min for long-running agents)
  • quickQuery(namespaceId, slotKey) — four-tier retrieval with automatic fastest path
  • resync(namespaceId) — catch up on missed deltas

Error Handling

import { VerifiedStateError } from '@verifiedstate/sdk';

try {
  await client.query({ namespace_id: 'uuid', query_text: '...' });
} catch (err) {
  if (err instanceof VerifiedStateError) {
    console.error(err.status, err.message, err.body);
  }
}

License

MIT