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

docmd-assistant

v0.1.15

Published

Universal headless AI Assistant engine with extensible tool execution and custom relay support.

Readme

Quick Start

Install docmd-assistant via npm:

npm install docmd-assistant

Initialise the AI engine in your application:

import { DocmdAssistantEngine } from 'docmd-assistant';

const assistant = new DocmdAssistantEngine({
  provider: 'openai',
  model: 'gpt-4o-mini',
  apiKey: process.env.OPENAI_API_KEY,
  systemPrompt: 'You are a technical documentation assistant.'
});

const response = await assistant.sendMessage('How do I configure routing?');
console.log(response.message);

Features

Designed to be 100% UI-agnostic, headless, and lightweight.

Multi-Provider Multi-Model Support

  • Powered directly by aiplug multi-provider runtime
  • Supports OpenAI, Anthropic, Gemini, DeepSeek, Groq, MiniMax, Ollama, and more
  • Hot-swappable providers and models at runtime

Extensible Tool Execution

  • Register custom client-side or server-side tools
  • Native execution pipeline for document search, page navigation, and code copying
  • Dynamic tool registration surface (registerTool, unregisterTool)

Headless & UI-Agnostic

  • Pure logic engine with no hardcoded DOM elements or mandatory UI
  • Embed into React, Vue, Svelte, Angular, Vanilla JS, Node.js servers, or CLI tools
  • Event-driven architecture with subscriptions for message, tool, and error events

Custom Relay Support

  • Connect directly via local provider API keys or proxy through custom relay endpoints
  • Seamless integration with docmd Cloud AI Relay backend

How It Works

Application Layer (React / Vue / Custom UI / CLI)
─────────────────────────────────────────────────
 1. Call assistant.sendMessage("query")
    → Emits 'message' event to UI
 2. Headless Engine processes turn:
    ├─ Direct Mode (aiplug)   → Interacts with OpenAI / Claude / Gemini / Ollama
    └─ Relay Mode (Cloud API) → Proxies securely via relay endpoint
 3. Tool Calling Pipeline:
    ├─ LLM triggers registered tool (e.g. search_documentation)
    ├─ Engine executes handler & appends context
    └─ Final response returned & 'message' event fired

Programmatic Usage

Registering Custom Tools

import { DocmdAssistantEngine } from 'docmd-assistant';

const assistant = new DocmdAssistantEngine({
  provider: 'anthropic',
  model: 'claude-3-5-haiku-20241022',
  apiKey: process.env.ANTHROPIC_API_KEY
});

// Register custom tool
assistant.registerTool({
  name: 'lookup_user_account',
  description: 'Retrieve user details by email address',
  parameters: {
    type: 'object',
    properties: {
      email: { type: 'string', description: 'User email address' }
    },
    required: ['email']
  },
  execute: async ({ email }) => {
    return { accountId: 'acc_12345', plan: 'pro', status: 'active' };
  }
});

Subscribing to Engine Events

assistant.on('message', (event) => {
  console.log(`[${event.data.role}]: ${event.data.content}`);
});

assistant.on('tool_call', (event) => {
  console.log(`Tool invoked: ${event.data.name}`, event.data.args);
});

assistant.on('error', (event) => {
  console.error('Assistant error:', event.data);
});

Dynamic System Prompt Reinforcement

assistant.setSystemPrompt('Act as a senior software architect.');
assistant.appendSystemPrompt('Always provide complete code snippets in TypeScript.');

Configuration Options

| Option | Type | Description | Default | | :--- | :--- | :--- | :--- | | provider | string | AI Provider name | 'openai' | | model | string | Model identifier | 'gpt-4o-mini' | | apiKey | string | Direct provider API key | undefined | | baseURL | string | Custom API gateway URL | undefined | | relayUrl | string | Relay endpoint URL | undefined | | systemPrompt | string | System instruction prompt | Default prompt | | history | ChatMessage[] | Initial conversation history | [] | | tools | AssistantTool[] | Array of initial tools | [] |

Project Structure

Keeps the codebase modular, typed, and clean.

docmd-assistant/
├── dist/                  # Compiled ESM and CJS bundles
├── src/
│   ├── engine.ts          # Core DocmdAssistantEngine class & event pipeline
│   ├── index.ts           # Barrel module exports
│   ├── tools/
│   │   └── index.ts       # Standard documentation & navigation tools
│   └── types.ts           # TypeScript interfaces and event schemas
├── build.js               # Dual ESM/CJS esbuild bundler
├── package.json           # Package manifest
└── tsconfig.json          # TypeScript compiler configuration

Part of the docmd ecosystem

docmd-assistant works standalone with any project or web framework. It also powers AI capabilities across docmd documentation tools.

| Tool | What it does | | :--- | :----------- | | docmd | Zero-config documentation engine | | docmd-search | Offline semantic search engine | | docmd-assistant | Universal headless AI Assistant engine |

Community & Support

  • Contributions are welcome
  • If you find it useful, consider sponsoring or starring the repo ⭐

License

MIT License. See LICENSE for details.