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

@aimarket/agent

v0.3.0

Published

AI Market Protocol v2 consumer SDK for TypeScript — Electron, Node.js, web apps

Readme

@aimarket/agent

AI Market Protocol v2 consumer SDK for TypeScript — Electron, Node.js servers, and web apps.

Discover, pay for, and invoke AI capabilities from the decentralized marketplace, with production cryptography:

  • Ed25519 (ed25519:<base64>) for canonical hub / invoke signatures
  • EIP-712 (keccak256 + secp256k1, eip712:0x<r><s><v>) for on-chain channel debits

Part of the AIMarket SDKs (Dart · TypeScript · Rust) — all three ship the same version and the same model shapes, enforced by an ecosystem parity guard in CI.

Install

# Published on npm (v0.1.1+ — CommonJS require() on Node 20/22):
npm install @aimarket/agent

# ESM / TypeScript:
import { AimarketAgent } from '@aimarket/agent';

# CommonJS:
const { AimarketAgent } = require('@aimarket/agent');

Quick start

market is exported by the published 0.2.2 package (npm install @aimarket/agent). To run the example below from this 0.3.0 source tree instead, build the checkout first:

git clone https://github.com/alexar76/aimarket-sdks.git
cd aimarket-sdks/typescript
npm ci
npm run build

Or download a runnable consumer project.

The shortest safe path needs no wallet or private key. It searches the live Independent federation, applies budget/trust/latency limits again in the client, invokes exactly once, and verifies the returned Ed25519 + ML-DSA-65 receipt against the live Hub identity:

import { market } from './dist/index.js';

const run = await market.run({
  intent: 'audit this agent trace for unsafe tool use',
  input: { trace: 'An agent reads a public weather report and returns its source.' },
});

console.log(run.invocation.result);
console.log(run.trusted); // true only after pinned Hub receipt verification

The zero-config call uses the Hub's bounded free trial. For repeated calls, pass either payment: { kind: 'credits', apiKey } or payment: { kind: 'channel', channelId, channelSecret }. Credentials are header-only, never placed in URLs or request bodies, and a possibly charged invoke is never retried.

Pay with a credit account

AimarketAgent pays one of two ways, as the Python aimarket-agent does: with a credit-account key when one is set, otherwise from a payment channel.

import { AimarketAgent } from '@aimarket/agent';

// A key from POST /ai-market/v2/accounts on a hub with open signup, or one its
// operator issued. The account pays: no channel, no deposit.
const agent = new AimarketAgent({
  hubUrl: 'https://modelmarket.dev',
  walletKey: loadYourWalletKey(),
  apiKey: process.env.AIMARKET_API_KEY,
});

// Discover capabilities for an intent — returns a ranked PlanStep[].
const plan = await agent.discover({ intent: 'ATS scoring rules for fintech roles', budget: 1.0 });
const cap = plan[0].capability;

const result = await agent.invoke({
  capabilityId: cap.capability_id,
  productId: cap.product_id, // the hub requires it
  sourceHub: cap.source_hub, // and this, for a federated capability
  input: { target_role: 'Senior PM', industry: 'fintech' },
});
console.log('Output:', result.result, '· cost $', result.price_usd);

With apiKey set, every invoke sends X-API-Key and no channel headers, and runOnce neither opens nor closes a channel. A 402 (AimarketPaymentException) carries the hub's reason and the account's balance against the needed price.

Pay from a channel

Without a key, invokes are paid from a channel. A production hub opens one only against an on-chain deposit it can verify: transfer the deposit first, then pass its transaction hash and the paying wallet's signature over the payer-proof challenge.

import { AimarketAgent, signChannelOpenProof } from '@aimarket/agent';
import { privateKeyToAccount } from 'viem/accounts';

const payer = privateKeyToAccount(payingWalletKey);
const payerSignature = await signChannelOpenProof(
  { chain: 'base', txHash: depositTxHash, payer: payer.address, amountUsd: 5 },
  (message) => payer.signMessage({ message }),
);

const agent = new AimarketAgent({ hubUrl: 'https://modelmarket.dev', walletKey: loadYourWalletKey() });
const channel = await agent.openChannel(5.0, 'USDC', 'base', { txHash: depositTxHash, payerSignature });
const result = await agent.invoke({
  capabilityId: cap.capability_id,
  productId: cap.product_id,
  input: { target_role: 'Senior PM', industry: 'fintech' },
  channelId: channel.channel_id,
});
await agent.closeChannel(channel.channel_id); // presents the channel secret and paying wallet

Without txHash a production hub answers 400 tx_hash is required for on-chain verification; without payerSignature it refuses with "missing or invalid payer proof" and returns the text to sign. Only a dev/demo hub opens a channel with no deposit. A deposit funds exactly one channel, so openChannel with the same txHash returns the channel it opened.

Links

License

MIT