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

@agent-e/adapter-game

v2.0.7

Published

AgentE adapter for game economies

Readme

@agent-e/adapter-game

Game economy adapter for AgentE. Translates your game's API into AgentE's universal multi-currency state format.

When to Use This

Use this adapter when you're running AgentE inside your game process (not over HTTP). If your game engine can run Node.js/TypeScript, embed AgentE directly:

import { AgentE } from '@agent-e/core';
import { GameAdapter } from '@agent-e/adapter-game';

const adapter = new GameAdapter({
  api: myGameAPI,  // implements GameAPI interface
});

const agentE = new AgentE({
  adapter,
  mode: 'autonomous',
  gracePeriod: 50,
  checkInterval: 5,
});

agentE.connect(adapter).start();

// In your game loop:
function onTick() {
  agentE.tick();
}

If your game engine cannot run Node.js (Unity, Unreal, Godot), use @agent-e/server instead and communicate over HTTP/WebSocket. See the examples/ directory.

GameAPI Interface

Implement this interface to connect your game:

interface GameAPI {
  getTick(): number;
  getRoles(): string[];
  getCurrencies(): string[];
  getResources(): string[];
  getAgentRoles(): Record<string, string>;
  getAgentBalances(): Record<string, Record<string, number>>;
  getAgentInventories(): Record<string, Record<string, number>>;
  getMarketPrices(): Record<string, Record<string, number>>;
  setParam(key: string, value: number, currency?: string): void;

  // Optional
  getAgentSatisfaction?(): Record<string, number>;
  getRecentEvents?(): EconomicEvent[];
  getPoolSizes?(): Record<string, Record<string, number>>;
}

Multi-Currency Support

Balances, prices, and pools are all nested by currency:

// Agent balances: agent → currency → amount
getAgentBalances(): {
  'player_1': { gold: 150, gems: 10 },
  'player_2': { gold: 80, gems: 25 },
}

// Market prices: currency → resource → price
getMarketPrices(): {
  gold: { ore: 15, weapons: 50 },
  gems: { ore: 2, weapons: 8 },
}

// Pool sizes: currency → pool → amount
getPoolSizes(): {
  gold: { arena: 500, bank: 200 },
  gems: { shop: 1000 },
}

Event Types

If you implement getRecentEvents(), return events with these types:

| Type | Description | |------|-------------| | trade | Player-to-player or auction house trade | | mint | Currency created (quest reward, daily login) | | burn | Currency destroyed (repair cost, tax) | | transfer | Currency moved between agents | | produce | Resource crafted or gathered | | consume | Resource used up | | role_change | Agent switched roles | | enter | New agent entered economy | | churn | Agent left economy |

Pushing Events

For real-time event streaming (instead of polling via getRecentEvents):

const adapter = new GameAdapter({ api: myGameAPI });

// Push events as they happen in your game
onPlayerTrade((trade) => {
  adapter.pushEvent({
    type: 'trade',
    timestamp: currentTick,
    actor: trade.buyerId,
    resource: trade.item,
    amount: trade.quantity,
    price: trade.price,
  });
});

Links


Built by Oka × Claude — AB Labs