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

agentified

v0.0.6

Published

Context intelligence for AI agents. Register tools, assemble the right context per turn.

Readme

agentified

Context intelligence for AI agents. Register tools, assemble the right context per turn.

TypeScript SDK for Agentified — register tools, discover relevant ones via hybrid ranking, and track sessions across turns.

Install

npm install agentified

Quick Start

import { Agentified } from "agentified";

const ag = new Agentified();
await ag.connect("http://localhost:9119");

const dataset = await ag.dataset("my-agent").register({
  tools: [
    { name: "get_weather", description: "Get current weather", parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] }, handler: async (args) => ({ temp: 22 }) },
    { name: "book_flight", description: "Book a flight", parameters: { type: "object", properties: { from: { type: "string" }, to: { type: "string" } }, required: ["from", "to"] }, handler: async (args) => ({ booked: true }) },
  ],
});

const session = dataset.session("chat-1");

// Assemble context — tools + messages for this turn
const ctx = await session.context
  .messages({ strategy: "recent", maxTokens: 4000 })
  .assemble();
// ctx.tools     → { get_weather, book_flight } (ranked by relevance)
// ctx.messages  → conversation history
// ctx.tokenEstimate → estimated token count

See ts-sdk-smoke for a runnable version of this.

Authentication

Pass custom headers (e.g. for Cloud Run IAM, API gateways) via connect():

await ag.connect("https://my-service.run.app", {
  headers: { Authorization: `Bearer ${identityToken}` },
});

Headers are sent on every request, including the initial health check.

Hierarchy

Agentified
  ├─ .connect(serverUrl?, options?)  → void
  ├─ .adaptTo(adapter)   → T (framework-specific wrapper)
  └─ .dataset(name) → DatasetRef
       └─ .register({ tools }) → Instance
            ├─ .discoverTool     — DiscoverTool
            ├─ .prepareStep      — PrepareStepFn
            ├─ .session(id)      → Session
            │    ├─ .discoverTool
            │    ├─ .prepareStep (persists messages)
            │    ├─ .context.messages(opts).recall(opts).assemble()
            │    ├─ .updateConversation({ messages })
            │    ├─ .getMessages(opts)
            │    └─ .conversation → Conversation
            └─ .namespace(id)    → Namespace
                 ├─ .tools (stub)
                 └─ .session(id) → Session

API Reference

ContextBuilder

Fluent API for assembling context per agent turn. Access via session.context:

const ctx = await session.context
  .tools({ custom_tool: myTool })     // inject explicit tools
  .messages({ strategy: "recent", maxTokens: 4000 })  // include conversation history
  .recall()                            // recall from memory (stub)
  .assemble();                         // → AssembledContext

AssembledContext<T>

interface AssembledContext<T> {
  tools: Record<string, T>;       // explicit + discovered tools
  messages: StoredMessage[];       // conversation messages
  recalled: unknown[];             // recalled memories (stub)
  strategyUsed: string;           // message strategy applied
  fallback: boolean;              // whether fallback was used
  tokenEstimate: number;          // estimated token count
  conversationMessages: number;   // total in conversation
  totalMessages: number;          // total messages stored
  includedMessages: number;       // messages included in context
}

session.discoverTool

Agent-callable tool for runtime discovery. The agent can call this to find relevant tools on-the-fly.

session.updateConversation({ messages })

Persist messages with deduplication for multi-turn context.

session.getMessages(opts)

Retrieve conversation history with strategy-based filtering.

Events

Subscribe to lifecycle events via onEvent in the config:

const agent = new ApiClient({
  serverUrl: "http://localhost:9119",
  tools: [...],
  onEvent: (event) => {
    switch (event.type) {
      case "agentified:prefetch:start":    // { messages }
      case "agentified:prefetch:complete": // { tools, durationMs, tokenUsage? }
      case "agentified:prefetch:skipped":  // { tools, durationMs }
      case "agentified:discover:start":    // { query }
      case "agentified:discover:complete": // { query, tools, durationMs, tokenUsage? }
    }
  },
});

Types

interface ServerTool {
  name: string;
  description: string;
  parameters: Record<string, unknown>;
  metadata?: Record<string, unknown>;
  fields?: { name: string; description: string; inputSchema?: string; outputSchema?: string };
}

interface RankedTool extends ServerTool {
  score: number;
  graphExpanded?: boolean;
}

interface Message {
  role: string;
  content: string;
}

interface TokenUsage {
  input: number;
  output: number;
  cached: number;
  reasoning: number;
}

Links

License

MIT