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

@adaptcom/core

v0.4.4

Published

Framework for file-based AI agents.

Readme

@adaptcom/core

The Adapt agent runtime: harnesses, tools, channels, connections, persistent conversations, and deployment APIs. Requires Node 24 or later. The HTTP API and its browser client live in @adaptcom/api.

pnpm add @adaptcom/core
pnpm add -D @adaptcom/cli
import { defineAgent, createHttpChannel } from "@adaptcom/core";

Channel and connection subpaths are also available, for example @adaptcom/core/channels/slack. @adaptcom/api/client is the browser-safe API client.

Use @adaptcom/cli for the adapt command. Core does not depend on the CLI. See the repository guides and examples.

Compaction

Configure compaction on the harness, not on defineAgent. The provider receives active ModelMessage[] history and returns a smaller array of the same type. Preserve current intent, required context, and complete tool-call/result groups. Return the input unchanged if no safe reduction is possible. Honor cancellation.

import { createAiSdkHarness, defineAgent, type CompactionProvider } from "@adaptcom/core";
import type { LanguageModel } from "ai";

export function agent(model: Exclude<LanguageModel, string>, compaction: CompactionProvider) {
  return defineAgent({
    harness: createAiSdkHarness({
      model,
      contextWindow: 128_000, // Use your model's actual capacity.
      compaction, // Optional compaction.threshold defaults to 0.8.
    }),
  });
}

CompactionProvider.threshold is optional, defaults to 0.8, and must be between 0 and 1 inclusive. The AI SDK harness checks before each request, including after completed tools, and compacts when the request token estimate reaches contextWindow * threshold. Zero attempts compaction before every request; one waits until the estimated full context window. A no-op reduction proceeds without looping. Compaction stays opt-in; a context window alone does not enable it.

The harness estimates tokens from serialized messages, instructions (including skills), and tool definitions at roughly three UTF-8 bytes per token. Within a turn, reported input usage corrects underestimates, with new history added to that count. This is approximate, not a model-specific tokenizer. contextWindow stays local to the harness and is required when configuring compaction; it is not passed through project or runtime configuration.

A recognized context-overflow rejection still allows one compaction-and-retry of that request, without rerunning completed tools or consuming another step. No reduction rethrows the original overflow. Other errors are not retried. Invalid/failed/aborted replacements leave the original history intact.

createGitHubAiSdkHarness accepts the same settings and preserves them when tools are injected. For an environment-selected model, use createEnvironmentHarness(process.env, { compaction, contextWindow: 128_000 }). A project harness factory can resolve provider credentials at startup. Codex harnesses own native conversation state and do not implement this compaction loop.

A smaller serialized history is not proof it will fit the model's limit. A summarizing provider must also be able to process the history it receives, using its own chunking or a larger-context model when necessary.

Successful reductions append a session.compacted event through the ordinary store commit. On replay, the harness replaces its messages with that event's history. Revisions and retry receipts keep their existing append-only semantics; runtime state, resource handles, and other sessions are unchanged. Compaction rejects unresolved tool calls and clears completed tool state.

The Next.js chat example replaces earlier messages with a "Conversation compacted" marker and the replacement's public text. System messages, reasoning, tool payloads, and provider metadata are not projected. Custom chat clients should reset their transcript on a compaction event.

This compacts model context, not disk usage. Original events and receipts remain in the journal for idempotent retries, including sensitive original history; there is no automatic retention policy. No archives or special store methods are needed. Custom stores must support the session.compacted event and its tool-state invariant, as exercised by the shared store contract. Custom harnesses expose their provider as AgentHarness.compaction, reset history on that event when reading context.events(), and invoke context.compaction.compact() only at a safe boundary. The runtime validates and checkpoints before returning.