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

@statiolake/coc-lm-chat

v2.4.0

Published

Language Model Chat agent extension for coc.nvim

Downloads

21

Readme

@statiolake/coc-lm-chat

Interactive AI chat interface for coc.nvim with autonomous agent capabilities and tool integration.

Features

  • 🗨️ Interactive Chat Interface: Real-time chat with language models in Neovim
  • 🤖 Autonomous Agent: Self-operating agent with tool execution capabilities
  • 🛠️ Built-in Tools: Time, calculation, and workspace information tools
  • 📝 Markdown Rendering: Syntax-highlighted chat display with virtual text
  • 🔄 Streaming Responses: Real-time token streaming for immediate feedback
  • 🎯 Context-Aware: Maintains conversation history and context
  • 📊 Sidebar Support: Optional sidebar chat interface

Installation

Prerequisites

Install via coc.nvim

:CocInstall @statiolake/coc-lm-api @statiolake/coc-github-copilot @statiolake/coc-lm-chat

Install via npm

npm install -g @statiolake/coc-lm-api @statiolake/coc-github-copilot @statiolake/coc-lm-chat

Setup

  1. Install all required extensions
  2. Authenticate with your language model provider (e.g., :CocCommand copilot.signIn for GitHub Copilot)
  3. Start chatting with :CocCommand copilot.chat

Commands

| Command | Description | |---------|-------------| | :CocCommand copilot.chat | Open a new chat buffer | | :CocCommand copilot.sendMessage | Send current buffer content as message | | :CocCommand copilot.chatSideBarToggle | Toggle sidebar chat | | :CocCommand copilot.chatSideBarOpen | Open sidebar chat | | :CocCommand copilot.chatSideBarClose | Close sidebar chat | | :CocCommand copilot.chatSideBarReset | Reset sidebar chat |

Usage

Basic Chat

  1. Open a chat session: :CocCommand copilot.chat
  2. Type your message in the input area (after the "You:" line)
  3. Press <Enter> in normal mode to send the message
  4. Watch the AI response stream in real-time

Chat Interface

The chat buffer displays:

# Copilot Chat

You:
[Type your message here]

Agent:
[AI response appears here]

Tool:
🔧 **toolName** {\"param\": \"value\"}
```tool output```

You:
[Next message...]

Keybindings

In chat buffers:

  • <Enter> (normal mode): Send the current message
  • <C-c> (normal mode): Clear conversation history

Sidebar Chat

For a persistent chat interface:

:CocCommand copilot.chatSideBarOpen

The sidebar provides a dedicated chat area that doesn't interfere with your main editing workflow.

Built-in Tools

The extension includes several built-in tools that the AI can use:

getCurrentTime

Get the current date and time.

{
  \"name\": \"getCurrentTime\",
  \"description\": \"Get the current date and time\",
  \"inputSchema\": { \"type\": \"object\", \"properties\": {} }
}

calculate

Perform mathematical calculations.

{
  \"name\": \"calculate\",
  \"description\": \"Perform mathematical calculations\",
  \"inputSchema\": {
    \"type\": \"object\",
    \"properties\": {
      \"expression\": { \"type\": \"string\", \"description\": \"Mathematical expression to evaluate\" }
    },
    \"required\": [\"expression\"]
  }
}

getWorkspaceInfo

Get information about the current workspace.

{
  \"name\": \"getWorkspaceInfo\",
  \"description\": \"Get information about the current workspace\",
  \"inputSchema\": { \"type\": \"object\", \"properties\": {} }
}

Configuration

Add to your coc-settings.json:

{
  \"copilot.enable\": true
}

Agent Configuration

The autonomous agent supports various configuration options that can be customized by extension developers:

  • maxIterations: Maximum number of tool execution iterations (default: 10)
  • maxDepth: Maximum recursion depth for tool calls (default: 3)
  • autoExecute: Whether to automatically execute tools (default: true)
  • timeout: Timeout for tool execution in milliseconds (default: 30000)
  • enableLogging: Enable detailed logging (default: true)

Architecture

Agent System

The extension implements a self-operating agent that can:

  1. Understand Requests: Parse user messages and determine appropriate actions
  2. Execute Tools: Automatically invoke registered tools based on context
  3. Chain Operations: Use tool results to inform subsequent actions
  4. Provide Feedback: Stream responses and tool execution results in real-time

Tool Integration

Tools are registered with the LM API and can be invoked by the language model:

// Tools are automatically registered on startup
lmApi.registerTool('getCurrentTime', getCurrentTimeTool);
lmApi.registerTool('calculate', calculateTool);
lmApi.registerTool('getWorkspaceInfo', getWorkspaceInfoTool);

Message Flow

  1. User types message in chat buffer
  2. Message sent to language model via LM API
  3. Model processes request and may invoke tools
  4. Tool results fed back to model
  5. Final response streamed to chat buffer

Examples

Basic Conversation

You:
What time is it?

Agent:
Let me check the current time for you.

Tool:
🔧 **getCurrentTime** {}
2025-01-13T22:45:06.406Z

Agent:
The current time is January 13th, 2025 at 10:45 PM UTC.

Mathematical Calculation

You:
Calculate 15% tip on a $45 bill

Agent:
I'll calculate that for you.

Tool:
🔧 **calculate** {\"expression\": \"45 * 0.15\"}
6.75

Agent:
A 15% tip on a $45 bill would be $6.75, making the total $51.75.

Workspace Information

You:
What files are in my current workspace?

Agent:
Let me check your workspace information.

Tool:
🔧 **getWorkspaceInfo** {}
Current workspace: /home/user/project
Files: src/main.ts, package.json, README.md

Agent:
Your current workspace is `/home/user/project` and contains 3 files: src/main.ts, package.json, and README.md.

Troubleshooting

No Language Models Available

  1. Ensure LM API extension is installed: :CocInstall @statiolake/coc-lm-api
  2. Install a language model provider: :CocInstall @statiolake/coc-github-copilot
  3. Authenticate with the provider: :CocCommand copilot.signIn
  4. Restart coc.nvim: :CocRestart

Agent Not Responding

  1. Check if the agent is initialized properly
  2. Verify language models are available
  3. Check coc.nvim logs for errors: :CocOpenLog

Tool Execution Errors

  1. Ensure tools are properly registered
  2. Check tool input parameters
  3. Verify workspace permissions for file operations

Development

# Clone the repository
git clone https://github.com/statiolake/coc-github-copilot.git
cd coc-github-copilot/coc-lm-chat

# Install dependencies
npm install

# Build
npm run build

# Watch mode for development
npm run watch

# Run linting
npm run lint

Adding Custom Tools

Developers can extend the tool system by registering additional tools:

import type { LmApi } from '@statiolake/coc-lm-api';

// Register a custom tool
lmApi.registerTool('customTool', {
  name: 'customTool',
  description: 'Description of what the tool does',
  inputSchema: {
    type: 'object',
    properties: {
      param: { type: 'string', description: 'Parameter description' }
    },
    required: ['param']
  },
  invoke: async (options) => {
    const { param } = options.input;
    // Tool implementation
    return {
      content: [new LanguageModelTextPart(`Result: ${param}`)]
    };
  }
});

Related Extensions

License

MIT

Repository

GitHub

Acknowledgments

  • coc.nvim for the extension framework
  • Language model providers for AI capabilities
  • The Vim/Neovim community for inspiration and feedback