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

@ank1015/agents-contracts

v0.1.11

Published

Shared schemas and TypeScript contracts for @ank1015/agents.

Downloads

55

Readme

@ank1015/agents-contracts

Shared runtime schemas and TypeScript contracts for the @ank1015/agents packages.

This package is the lowest-level public boundary for agent messages, LLM requests, model metadata, provider registration types, tool definitions, usage accounting, and streaming events. It intentionally does not depend on any provider SDK or runtime adapter.

Install

pnpm add @ank1015/agents-contracts

What This Package Provides

  • Zod schemas for provider-neutral structural validation.
  • TypeScript types inferred from those schemas.
  • Provider augmentation maps for provider-specific native messages, config, options, and model IDs.
  • Optional prompt-token pricing tiers and shared model-cost resolution.
  • Shared LLM transport and adapter interfaces.
  • Shared assistant event-stream types and createEventStream.

Import Paths

import {
  llmRequestSchema,
  messageSchema,
  createEventStream,
} from '@ank1015/agents-contracts';

import { contentSchema } from '@ank1015/agents-contracts/content';
import type { AssistantEvent } from '@ank1015/agents-contracts/llm';
import type { Message } from '@ank1015/agents-contracts/messages';
import type { Model } from '@ank1015/agents-contracts/models';
import type { ModelSelection } from '@ank1015/agents-contracts/providers';

Contract Areas

Content

Content parts are provider-neutral user/tool payloads:

  • text
  • image

Images use base64 data plus a MIME type. Provider adapters are responsible for enforcing provider-specific MIME support.

Messages

The shared message union includes:

  • user
  • assistant
  • toolResult
  • custom

Assistant messages carry normalized assistant content plus optional provider-native data.

Models And Providers

Model and provider contracts are open by design. Provider packages can augment:

  • ProviderNativeMessageMap
  • ProviderOptionsMap
  • ProviderModelIdMap
  • ProviderConfigMap

That lets provider packages narrow generic contracts without making this package depend on provider implementations.

Models always provide a base cost and may provide ordered pricingTiers keyed by prompt-token intervals. resolveModelCost returns the first matching tier, falling back to the base cost so existing flat-priced models remain compatible.

LLM Requests And Streams

LLMRequest describes a provider-neutral request shape. LLMTransport and LLMProviderAdapter describe the streaming transport boundary.

createEventStream creates a queue-backed EventStreamSource that buffers pushed events until consumed and resolves a final result when ended.

Runtime Validation Scope

The schemas in this package validate provider-neutral structure. They do not validate provider-specific semantics such as:

  • whether a model ID exists for a provider,
  • whether providerOptions matches a provider SDK,
  • whether an image MIME type is supported by a provider,
  • whether a native provider message matches that provider's SDK shape.

Provider packages should add provider-specific validation at their adapter boundaries.

Versioning

This package is currently 0.1.11. Until 1.0.0, public contracts may still evolve as the runtime packages settle.