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

@terajs/adapter-ai

v1.1.3

Published

AI-facing helper package for Terajs.

Readme

@terajs/adapter-ai

AI-facing helper package for Terajs.

This package provides structured action-schema helpers and sanitized reactive-state snapshots for tooling, assistants, and other AI-adjacent integrations.

It also provides a higher-level chatbot helper for app teams that want a simple request pipeline without giving up safe defaults.

Install

npm install @terajs/adapter-ai

What it exports

  • defineAIActions(schema) for declaring a typed action schema with built-in validation
  • captureStateSnapshot(signals?) for exporting a sanitized snapshot of active Terajs signals
  • createAIChatbot(options) for wiring a chatbot client with same-origin defaults and explicit external opt-in
  • AIActionsSchema and AIActionsDefinition types for action-schema authoring
  • AIStateSnapshot for structured state export consumers

Minimal example

import { createAIChatbot, defineAIActions } from "@terajs/adapter-ai";

const actions = defineAIActions({
  openIssue: {
    description: "Create a project issue",
    params: {
      title: { type: "string", required: true },
      priority: { type: "string" }
    }
  }
});

const chatbot = createAIChatbot({
  endpoint: "/api/chat",
  actions,
  includeStateSnapshot: true,
  signals: []
});

const request = chatbot.buildRequest("Help this shopper find a gift", {
  metadata: {
    route: "/products",
    signedIn: true
  }
});

const response = await chatbot.sendMessage("Help this shopper find a gift");

Notes

  • captureStateSnapshot() filters sensitive keys such as password, token, credential, and API-key style fields instead of serializing them blindly.
  • Snapshot output is normalized for tooling consumption and avoids leaking raw non-serializable values.
  • createAIChatbot() only sends state when you explicitly opt in with includeStateSnapshot: true and provide signals.
  • Absolute external endpoints are blocked by default; set allowExternalEndpoint: true if you intentionally want to call an external AI service.
  • External endpoint opt-in omits ambient credentials instead of forwarding cookies by default.
  • This package complements Terajs metadata and DevTools workflows; it is not a model-provider SDK.