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

@agentoffernetwork/sdk

v0.0.2

Published

TypeScript SDK for Agent Offer Network — intent-driven offer matching, click/conversion tracking, and recommendation formatting for LLM agents.

Downloads

429

Readme

@agentoffernetwork/sdk

TypeScript SDK for Agent Offer Network — connect your LLM agent to a marketplace of product and service offers.

Features

  • Intent-driven search — describe what the user wants in natural language, get matched offers
  • Multimodal intent — text + image support (OpenAI-compatible content parts format)
  • Click & conversion tracking — full attribution pipeline for monetization
  • Recommendation formatting — ready-to-display output with disclosure labels
  • Zero dependencies — uses native fetch (Node 18+)
  • Dual modemock for development, live for production

Install

npm install @agentoffernetwork/sdk

Quick Start

import { initialize } from '@agentoffernetwork/sdk';

// Initialize (mock mode for development)
const client = await initialize({
  apiKey: 'your-api-key',
  mode: 'mock',
});

// Search offers by intent
const result = await client.queryOffers({
  intent: {
    content: [{ type: 'text', text: 'noise-cancelling headphones under $300' }],
  },
  limit: 5,
});

// Display results
for (const offer of result.offers) {
  console.log(client.formatRecommendation(offer, { style: 'markdown' }));
}

API

initialize(config): Promise<AgentOfferClient>

Create an SDK client instance.

const client = await initialize({
  apiKey: 'your-api-key',       // Required
  mode: 'mock',                  // 'mock' | 'live'
  baseUrl: 'https://api.agentoffernetwork.com', // Optional, default shown
  timeout: 5000,                 // Optional, ms
});

client.queryOffers(params): Promise<QueryOffersResponse>

Search offers by user intent.

const result = await client.queryOffers({
  intent: {
    content: [
      { type: 'text', text: 'project management tool for small teams' },
    ],
  },
  context: {                     // Optional — improves matching
    platform: 'chatgpt',
    locale: 'en',
    region: 'US',
    currency: 'USD',
  },
  limit: 10,                    // Default 10, max 50
  offset: 0,                    // Pagination
});

// result.offers    — Offer[]
// result.total     — number
// result.hasMore   — boolean

client.reportClick(event): Promise<ClickResult>

Track when a user clicks an offer.

const click = await client.reportClick({
  offerId: offer.id,
  trackingUrl: offer.trackingUrl,
  timestamp: new Date().toISOString(),
  context: null,
});

// click.clickId   — use for conversion attribution
// click.timestamp

client.reportConversion(event): Promise<void>

Track when a user completes a purchase.

await client.reportConversion({
  offerId: offer.id,
  clickId: click.clickId,
  revenue: { amount: 29.99, currency: 'USD', display: '$29.99' },
  timestamp: new Date().toISOString(),
  metadata: null,
});

client.formatRecommendation(offer, options?): string

Format an offer as display text.

// Styles: 'brief' | 'detailed' | 'markdown'
const text = client.formatRecommendation(offer, {
  style: 'markdown',
  includeDisclosure: true,       // Default true
  disclosureText: 'Sponsored',   // Default 'Sponsored'
  includePrice: true,            // Default true
});

Context

The optional QueryContext helps the backend improve matching. Fill in what's available:

| Field | Type | Example | Purpose | |-------|------|---------|---------| | platform | string | 'chatgpt', 'claude-mcp' | Platform identification | | locale | string | 'en', 'zh-CN' | Language matching | | region | string | 'US', 'JP' | Geo-filtering | | currency | string | 'USD', 'CNY' | Price display | | conversationId | string | UUID | Dedup within session | | userId | string | — | Personalization |

Error Handling

import {
  AonAuthError,
  AonRateLimitError,
  AonNetworkError,
  AonValidationError,
  AonApiError,
} from '@agentoffernetwork/sdk';

try {
  const result = await client.queryOffers({ /* ... */ });
} catch (err) {
  if (err instanceof AonAuthError) {
    // Invalid API key (401)
  } else if (err instanceof AonRateLimitError) {
    // Too many requests (429)
  } else if (err instanceof AonNetworkError) {
    // Network/timeout error
  } else if (err instanceof AonValidationError) {
    // Invalid parameters
  } else if (err instanceof AonApiError) {
    // Business logic error (err.code, err.message)
  }
}

Modes

| Mode | Use case | Backend | |------|----------|---------| | mock | Development & testing | Built-in mock data (21 offers, 3 categories) | | live | Production | https://api.agentoffernetwork.com |

Platform Integrations

This SDK is the foundation for agent platform integrations:

| Platform | Integration | Package | |----------|-------------|---------| | Claude (MCP) | MCP tool server | @aon/demo-skill | | ChatGPT | OpenAPI Action | Direct API (see sdk/openapi.json) | | Coze / Dify | HTTP Plugin | Direct API (see sdk/openapi.json) | | Custom Agent | Code integration | This SDK |

License

MIT