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 🙏

© 2025 – Pkg Stats / Ryan Hefner

blink

v1.1.34

Published

Blink is a tool for building and deploying AI agents.

Readme

MIT License discord NPM Version

Blink is a way to build and deploy chat agents with the AI SDK.

import { Agent } from "blink";
import { sendMessages } from "ai";

const agent = new Agent();

agent.on("chat", ({ messages }) => {
  return sendMessages({
    model: "anthropic/claude-sonnet-4.5",
    messages: convertToModelMessages(messages),
  });
});

agent.serve();

To chat with the agent, run blink dev to enter a terminal interface.

  • Leverages the familiar AI SDK at it's core.
  • SDKs for making Slack and GitHub bots.
  • Run your agent locally without ever deploying to the cloud.

Get Started

Install Blink:

npm i -g blink

Create your first agent:

# creates the agent source code in your current directory
blink init

# starts a hot-reloading terminal interface to chat with your agent
blink dev

Create a Slack bot in under a minute:

https://github.com/user-attachments/assets/6bb73e58-b4ae-4543-b2c0-0e1195113ba6

[!NOTE] You provide LLM API keys. blink init guides you through this, or add them to .env.local later.

Deploy

If you wish to deploy your agent to the cloud, run:

blink deploy

[!IMPORTANT] Cloud is not required to build Blink agents. We guarantee that Blink agents will always be local-first.

User Guide

Developing an Agent

Blink has two modes: run and edit (toggle with ctrl+t, or /run and /edit). Run mode is blue, edit mode is orange. Run mode allows you to chat with your agent. Edit mode allows you to take context from run mode, and edit the agent.

Chat in run mode, switch to edit mode and provide feedback, then go back to run mode and continue chatting. Agents hot-reload as you develop, so changes are reflected instantly.

[!NOTE] Run mode cannot see edit mode messages.

https://github.com/user-attachments/assets/4abd47ad-4b59-41d5-abda-27ed902ae69b

Chats

Blink allows you to start new chats from web requests:

import blink from "blink";

const agent = blink.agent();

agent.on("request", async (request, context) => {
  // Check if this is a request you'd like to start a chat for.
  // e.g. if this is a webhook from Slack, start a chat for that thread.

  // Specify a unique key for the chat so that on subsequent requests, the same chat is used.
  const chat = await blink.chat.upsert(`slack-${request.body.thread_ts}`);

  await blink.chat.message(
    chat.id,
    {
      role: "user",
      parts: [
        {
          type: "text",
          text: "Hello, how can I help you today?",
        },
      ],
    },
    {
      // Blink manages chat state for you. Interrupt, enqueue, or append messages.
      behavior: "interrupt",
    }
  );

  // This would trigger the chat event handler in your agent.
});

// ... agent.on("chat", ...) ...

agent.serve();

Locally, all chats are stored in ./.blink/chats/<key>.json relative to where your agent is running.

In the cloud, chats keys are namespaced per-agent.

Storage

Blink has a persistent key-value store for your agent:

import { convertToModelMessages, streamText, tool } from "ai";
import blink from "blink";
import { z } from "zod";

const agent = blink.agent();

agent.on("chat", async ({ messages }) => {
  return streamText({
    model: "anthropic/claude-sonnet-4",
    system: "You are a helpful assistant.",
    messages: convertToModelMessages(messages),

    tools: {
      set_memory: tool({
        description: "Set a value to remember later.",
        inputSchema: z.object({
          key: z.string(),
          value: z.string(),
        }),
        execute: async ({ key, value }) => {
          await blink.storage.set(key, value);
          return "Saved memory!";
        },
      }),
      get_memory: tool({
        description: "Get a value from your memory.",
        inputSchema: z.object({
          key: z.string(),
        }),
        execute: async ({ key }) => {
          const value = await blink.storage.get(key);
          return `The value for ${key} is ${value}`;
        },
      }),
      delete_memory: tool({
        description: "Delete a value from your memory.",
        inputSchema: z.object({
          key: z.string(),
        }),
        execute: async ({ key }) => {
          await blink.storage.delete(key);
          return `Deleted memory for ${key}`;
        },
      }),
    },
  });
});

agent.serve();

Locally, all storage is in ./.blink/storage.json relative to where your agent is running.

In the cloud, storage is namespaced per-agent.

Tools

Blink has helpers for tool approvals, and commonly used tools.

Manual Approval

Some tools you'd prefer to approve manually, particularly if they're destructive.

import { convertToModelMessages, streamText, tool } from "ai";
import blink from "blink";
import { z } from "zod";

const agent = blink.agent();

agent.on("chat", async ({ messages }) => {
  return streamText({
    model: "anthropic/claude-sonnet-4",
    system: "You are a helpful assistant.",
    messages: convertToModelMessages(messages),

    tools: {
      harmless_tool: tool({
        description: "A harmless tool.",
        inputSchema: z.object({
          name: z.string(),
        }),
        execute: async ({ name }) => {
          return `Hello, ${name}!`;
        },
      }),
      ...blink.tools.withApproval({
        messages,
        tools: {
          destructive_tool: tool({
            description: "A destructive tool.",
            inputSchema: z.object({
              name: z.string(),
            }),
            execute: async ({ name }) => {
              return `Destructive tool executed!`;
            },
          }),
        },
      }),
    },
  });
});

agent.serve();

Blink will require explicit approval by the user before destructive_tool is executed - displaying a UI to the user to approve or reject the tool call.

Toolsets

Blink has SDK packages for common tools, like Slack, GitHub, and Search:

import github from "@blink-sdk/github";
import { convertToModelMessages, streamText } from "ai";
import blink from "blink";

const agent = blink.agent();

agent.on("chat", async ({ messages }) => {
  return streamText({
    model: "anthropic/claude-sonnet-4",
    system: "You are a helpful assistant.",
    messages: convertToModelMessages(messages),

    tools: {
      ...github.tools,
    },
  });
});

agent.serve();

By default, GitHub tools will not have authentication. Provide context to tools:

import blink from "blink";

blink.tools.withContext(github.tools, {
  accessToken: process.env.GITHUB_TOKEN,
  // optionally, specify app auth, or your own Octokit instance
});

Customizing Tools

You can override any descriptions to customize behavior:

import github from "@blink-sdk/github";
import { convertToModelMessages, streamText } from "ai";
import blink from "blink";

const agent = blink.agent();

agent.on("chat", async ({ messages }) => {
  return streamText({
    model: "anthropic/claude-sonnet-4",
    system: "You are a helpful assistant.",
    messages: convertToModelMessages(messages),

    tools: {
      ...github.tools,
      // Override the default tool with your own description.
      create_issue: {
        ...github.tools.create_issue,
        description: "Create a GitHub issue. *Never* tag users.",
      },
    },
  });
});

agent.serve();

Custom Models

You do not need to use the AI SDK with Blink. Return a Response in sendMessages using withResponseFormat:

import * as blink from "blink";
import OpenAI from "openai";

const client = new OpenAI();
const agent = blink.agent();

agent.on("chat", async ({ messages }) => {
  const stream = await client.chat.completions
    .create({
      model: "gpt-4o",
      messages: messages.map((m) => ({
        role: m.role,
        content: m.parts
          .map((p) => {
            if (p.type === "text") {
              return p.text;
            }
          })
          .join("\n"),
      })),
      stream: true,
    })
    .withResponse();
  return blink.withResponseFormat(stream.response, "openai-chat");
});

agent.serve();

Custom Bundling

Create a blink.config.ts file in your project root (next to package.json):

import { defineConfig, buildWithEsbuild } from "blink/build";

export default defineConfig({
  entry: "src/agent.ts",
  outdir: "dist",
  build: buildWithEsbuild({
    // ... esbuild options ...
  }),
});

By default, Blink uses esbuild to bundle your agent.

The build function can be customized to use a different bundler if you wish.

Blink Documentation

For a closer look at Blink, visit docs.blink.so.