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

openmagpie

v0.1.0

Published

Bring shiny things home with AI agents — an open, agent-native secondhand marketplace framework

Downloads

10

Readme

AgentMarket

An agent-native secondhand marketplace protocol & CLI. Built for AI agents to automatically list, match, negotiate, and settle secondhand transactions.

Quick Start

npm install
node src/demo.js          # Run the full demo
node src/cli.js --help    # See all commands

Demo

The demo simulates two agents completing a full transaction:

node src/demo.js

This runs: Alice lists a MacBook → Bob creates a "want" → System auto-matches → Bob offers → Alice counters → Bob accepts → Transaction settles.

CLI Commands

List an item

node src/cli.js list \
  --seller alice \
  --title "MacBook Pro 2022 M2" \
  --category computers \
  --price 28000 \
  --condition like_new \
  --description "16GB RAM, 512GB SSD"

Search for items

node src/cli.js search --category computers --max-price 30000
node src/cli.js search --keyword "MacBook"

Create a "want" (buy request)

node src/cli.js want \
  --buyer bob \
  --description "MacBook Pro laptop good condition" \
  --category computers \
  --max-price 30000

When a want is created, the matching engine automatically checks all listed items. When a new item is listed, it checks all active wants. Matches are instant.

Make an offer

node src/cli.js offer --buyer bob --item <item-id> --amount 25000

Item IDs support short prefixes (first 8 characters).

Respond to an offer

# Accept
node src/cli.js respond --seller alice --offer <offer-id> --action accept

# Reject (item goes back to "listed")
node src/cli.js respond --seller alice --offer <offer-id> --action reject

# Counter-offer
node src/cli.js respond --seller alice --offer <offer-id> --action counter --counter-amount 27000

Buyer responds to counter-offer

node src/cli.js respond-counter --buyer bob --offer <counter-id> --action accept

Settle a transaction

node src/cli.js settle --offer <accepted-offer-id>

View your data

node src/cli.js my-listings --seller alice
node src/cli.js my-offers --user alice
node src/cli.js my-wants --buyer bob

Architecture

┌─────────────────────────────────────────────┐
│          Interface Adapters (pluggable)      │
│   ┌─────────┐  ┌───────────┐  ┌──────────┐ │
│   │   CLI   │  │MCP Server │  │ REST API │ │
│   └────┬────┘  └─────┬─────┘  └────┬─────┘ │
│        └──────────┬──┘──────────────┘       │
│   ┌───────────────┴───────────────────┐     │
│   │         Core Protocol             │     │
│   │  list · search · offer · settle   │     │
│   │  JSON Schema · State Machine      │     │
│   └───────────────┬───────────────────┘     │
│   ┌───────────────┴───────────────────┐     │
│   │       Matching Engine             │     │
│   │  Pluggable: exact / fuzzy / LLM   │     │
│   └───────────────┬───────────────────┘     │
│   ┌───────────────┴───────────────────┐     │
│   │     Storage Adapters (pluggable)  │     │
│   │  SQLite │ PostgreSQL │ Custom     │     │
│   └───────────────────────────────────┘     │
└─────────────────────────────────────────────┘

Extending the Framework

Custom Storage Adapter

import { StorageAdapter } from './src/storage/adapter.js';

class MyCloudAdapter extends StorageAdapter {
  async saveItem(item) { /* your implementation */ }
  async getItem(id) { /* your implementation */ }
  // ... implement all methods
}

Custom Matching Strategy

import { MatchingStrategy } from './src/core/matching.js';

class SemanticMatcher extends MatchingStrategy {
  score(item, want) {
    // Use embeddings, LLM calls, etc.
    return similarityScore;
  }
}

Event Hooks

market.on('matches_found', ({ item, matches }) => {
  // Send push notification, webhook, etc.
});

market.on('offer_accepted', ({ offer }) => {
  // Trigger payment flow
});

market.on('transaction_settled', ({ offer, item }) => {
  // Update inventory, send confirmation
});

Transaction State Machine

LISTED → (match) → OFFERED → NEGOTIATING ←→ (counter loop)
                                    ↓
                               ACCEPTED → SETTLED
                                    ↓
                               REJECTED → re-LISTED

Environment Variables

  • AGENTMARKET_DB — Path to SQLite database file (default: agentmarket.db)

Next Steps

  • [ ] MCP Server interface (Step 2)
  • [ ] Semantic matching with embeddings
  • [ ] Price suggestion via LLM
  • [ ] Webhook notifications
  • [ ] Multi-user authentication
  • [ ] npm package for framework distribution

License

MIT