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

@better-files/plugin-ai

v0.1.0

Published

Permission-aware AI for Better Files: answers and summaries grounded in documents the asker may view, with citations, on Claude.

Readme

@better-files/plugin-ai

Permission-aware AI for Better Files: answers and summaries grounded in documents the asker may view, with citations, on Claude.

import { searchPlugin } from 'better-files/plugin-search';
import { aiPlugin, claudeProvider } from 'better-files/plugin-ai';

const plugins = [
  searchPlugin({ indexContent: true }), // retrieval uses the search index
  aiPlugin({ provider: claudeProvider() }), // claude-opus-5, adaptive thinking, citations
] as const;

const result = await dr.api.ai.ask(credential, {
  tenantId,
  roomId,
  question: 'Who can terminate the lease?',
});
// { answer, refused, citations: [{ nodeId, name, quote }], sources: [{ nodeId, name }] }
await dr.api.ai.summarize(credential, { tenantId, nodeId });
  • Nothing the asker can't open reaches the model. Candidates come from the search plugin's index, whatever its backend (SQL or Meilisearch). Before any text is fetched or sent, each one is checked against Better Files' own tables: same tenant and room, not in the trash, and VIEW for the asker. Moved, trashed and stale index entries are caught at question time.
  • View-only stays view-only. Documents flagged viewOnly or noCopy reach the model only for people with COPY_TEXT, so the assistant cannot be used to extract their text. aiPlugin({ requireCopyText: true }) requires COPY_TEXT for every document.
  • Grounded and cited. Documents go to Claude as citable document blocks, and citations map back to node ids. A citation is returned only if it names a document the asker was given and quotes text that is in it. A prompt-injected document or a misbehaving provider can't attribute words to other documents.
  • Audited. ai.asked and ai.summarized land in the room's activity log.
  • Refusal fallbacks. Server-side fallbacks are on by default; claudeProvider({ fallbacks: false }) turns them off. A refusal comes back as refused: true.
  • Any model. provider is a two-method interface (answer, summarize); claudeProvider is the default.

claudeProvider options: client (an Anthropic instance; default reads ANTHROPIC_API_KEY), model (default claude-opus-5), effort (default medium), maxTokens, fallbacks. @anthropic-ai/sdk is an optional peer dependency, needed only for claudeProvider.

Part of Better Files. Most applications install better-files and import this package through its subpaths.