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

eslint-plugin-copilotkit-guardrails

v0.2.0

Published

ESLint rules enforcing CopilotKit runtime shape correctness. Catches dual-named import traps, wrong tool factories, A2UI+serviceAdapter mismatches, missing nodejs runtime declarations, and caps-stacking in system prompts.

Readme

eslint-plugin-copilotkit-guardrails

ESLint rules enforcing CopilotKit v1.57.x runtime shape correctness. Targets shape A (CopilotKit-native BuiltInAgent + A2UI + AG-UI) by default; future shape B/C/D rules can be added without breaking existing consumers.

Why this exists

CopilotKit's v1 → v2 transition introduced a set of subtle traps that type-check silently but break at runtime or feature-load time. Real incidents observed in scaffolded codebases:

  • CopilotRuntime imported from @copilotkit/runtime (root v1 class, no a2ui field), then a2ui: {...} added, then the field dropped to silence typecheck — shipping a broken agent with A2UI silently disabled.
  • BuiltInAgent imported from a hypothetical @copilotkit/agent package (doesn't exist) or from the root subpath of @copilotkit/runtime (doesn't export it).
  • defineTool written with Vercel AI SDK's inputSchema instead of CopilotKit's parameters.
  • A2UI middleware paired with AnthropicAdapter (silently does nothing — A2UI doesn't inject through service adapters).
  • app/api/copilotkit/route.ts missing export const runtime = "nodejs" (edge runtime breaks BuiltInAgent).
  • System prompts piled with ALWAYS / NEVER rules instead of transmitted reasoning (brittle prompts that fight the model).

Each rule below catches one of those failure modes at lint time.

Install

pnpm add -D eslint-plugin-copilotkit-guardrails

Peer deps: eslint ^9.0.0. Optional: @typescript-eslint/parser ^8.0.0 if you want to lint TypeScript.

Configure

Flat config (eslint.config.mjs or eslint.config.js):

import copilotkitGuardrails from "eslint-plugin-copilotkit-guardrails";

export default [
  copilotkitGuardrails.configs.recommended,
  {
    settings: {
      copilotkit: { shape: "a" }, // default; explicit is better
    },
  },
];

Or pick rules individually:

import copilotkitGuardrails from "eslint-plugin-copilotkit-guardrails";

export default [
  {
    plugins: { "copilotkit-guardrails": copilotkitGuardrails },
    rules: {
      "copilotkit-guardrails/copilotkit-runtime-v2-import": "error",
      "copilotkit-guardrails/built-in-agent-import": "error",
      // ...
    },
  },
];

Settings

settings.copilotkit.shape: one of "a" | "b" | "c" | "d". Defaults to "a".

| Shape | Runtime | | ----- | ------------------------------------------------------------------------- | | a | CopilotKit-native BuiltInAgent (Vercel AI SDK under the hood). DEFAULT. | | b | In-process TypeScript LangGraph CoAgent. (Rules not yet shipped.) | | c | Remote Python LangGraph / CrewAI / Mastra / Agno CoAgent. (Not yet.) | | d | Direct AG-UI agent (custom AbstractAgent). (Not yet.) |

Shape-specific rules bail when shape doesn't match. As a v0.1 detail, only shape A rules ship.

Rules

All rules are error in the recommended config except where noted.

| Rule | Description | Autofix | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------- | -------- | | copilotkit-runtime-v2-import | CopilotRuntime must come from @copilotkit/runtime/v2. | ✓ | | built-in-agent-import | BuiltInAgent must come from @copilotkit/runtime/v2. | ✓ | | define-tool-shape | defineTool uses parameters: z.object({...}), not inputSchema. | — | | no-a2ui-with-service-adapter | Reject a2ui paired with a service adapter (shape A only). | — | | route-nodejs-runtime | CopilotKit route must export runtime = "nodejs". | ✓ | | copilotkit-route-catchall | Route must live at [[...route]]/route.ts (catch-all) for v2. | — | | no-caps-stacking-in-prompt | Warn when system prompts pile on caps-stacking tokens. | — (warn) |

Changelog

v0.2.0

  • Added copilotkit-route-catchall: requires the v2 route handler at app/api/copilotkit/[[...route]]/route.ts. Catches the flat-route silent-404 incident.
  • Updated route-nodejs-runtime to match both flat and catch-all route paths.

v0.1.0

  • Initial release with 6 rules.

Roadmap (v0.3+)

The doctrine that motivates this plugin lists 18 failure modes; v0.1–0.2 ship 7 of them. Likely additions:

  • Catalog API hygiene (createCatalog arg shape, props: schema key)
  • A2UI provider wiring (<CopilotKitProvider a2ui={{ catalog }}> vs nonexistent <A2UIProvider>)
  • v1/v2 hook mixing (useCopilotAction v1 alongside useFrontendTool v2)
  • Terminal frontend tool missing followUp: false
  • Stylesheet path (@copilotkit/react-core/v2/styles.css)
  • Reject copilotRuntimeNextJSAppRouterEndpoint in shape A
  • Require both POST and GET exports from the v2 route handler
  • Shape B/C/D rule sets

File issues for any failure modes that bite you in production scaffolds — they're prime candidates for new rules.

License

MIT — John Pearson.