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

@cellular-ai/engine

v1.3.1

Published

API for building custom AI coding editors/agents/platforms

Readme

Features

  • AI-powered code generation with streaming support
  • Tool execution with automatic function calling
  • Memory management for context-aware conversations
  • Express.js integration for easy web server setup
  • TypeScript support with full type definitions

Installation

npm install @cellular-ai/engine

Quick Start

Basic Usage

import { engine, stream } from '@cellular-ai/engine';

// Create an engine instance
const engineInstance = engine({
  dir: '/path/to/project',
  fullContext: true,
  sessionId: 'session-123',
  apikey: 'your-api-key',
  debug: false
});

// Stream AI responses
for await (const token of engineInstance.stream('Write a function to sort an array')) {
  process.stdout.write(token);
}

Express.js Integration

import express from 'express';
import { stream } from '@cellular-ai/engine';

const app = express();

app.post('/generate', async (req, res) => {
  const { prompt, dir, context } = req.body;
  const setHeaders = true;

  // Create engine for specific request
  const engineInstance = engine({
    dir: dir,
    fullContext: true,
    sessionId: 'session-123',
    apikey: 'your-api-key',
    debug: false
  });
  
  // Stream agent response w/ tool calls for given prompt
  await stream(res, engineInstance, prompt, setHeaders, context);
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

The stream function returns data in standard SSE format:

  • Content events: data: {"type": "text", "content": "hello world", "timestamp": "..."}
  • Tool events:
    event: tool_request
    data: {"type": "tool_request", "content": {...}, "timestamp": "..."}

API Reference

engine(config)

Creates a new engine instance.

Parameters:

  • config (EngineConfig): Configuration object with the following properties:
    • dir (string): Project directory path
    • fullContext (boolean, optional): Whether to dump entire codebase into context window. Default: false
    • model (string, optional): Model to use. Options: 'pro', 'flash', 'mini'. Default: 'flash'
    • apikey (string, optional): Gemini API key. Can also be set via GEMINI_API_KEY environment variable.
    • sessionId (string, optional): Session identifier. Auto-generated if not provided.
    • debug (boolean): Enable debug logging

Returns: EngineService instance

stream(response, engine, prompt, setHeaders?, context?)

Express Integration to Streams AI responses seamlessly.

Parameters:

  • response (Response): Express.js response object.
  • engine (EngineService): Engine instance.
  • prompt (string): User prompt.
  • setHeaders (boolean, optional): Whether to set required SSE headers automatically. Default: false
  • context (string, optional): Additional context.

EngineService Methods

stream(message, context?)

Streams AI responses as an async generator. Ideal for ask type questions that do not require tool usage.

for await (const token of engineInstance.stream('Your prompt here')) {
  console.log(token);
}

streamWithToolEvents(message, context?)

Streams AI responses with tool execution events as an async generator. Ideal for project-wide agent queries.

for await (const event of engineInstance.streamWithToolEvents('Your prompt here')) {
  if (event.type === 'text') {
    console.log(event.data);
  } else if (event.type === 'tool_request') {
    console.log('Tool requested:', event.data);
  }
}

getTools()

Returns available tools as function declarations.

const tools = await engineInstance.getTools();
console.log('Available tools:', tools.map(t => t.name));

executeTool(toolName, params)

Executes a specific tool with parameters.

const result = await engineInstance.executeTool('read-file', { path: './example.js' });
console.log(result);

getMemoryContent()

Returns the current memory content.

const memory = engineInstance.getMemoryContent();
console.log('Memory content:', memory);

Configuration

Environment Variables

  • GEMINI_API_KEY: Your Gemini API key (required)

Examples

Code Generation

import { engine } from '@cellular-ai/engine';

const engineInstance = engine({
  dir: './my-project',
  fullContext: true,
  sessionId: 'code-gen-session',
  debug: false
});

for await (const token of engineInstance.stream(
  'Create a React component that displays a user profile'
)) {
  process.stdout.write(token);
}

Streaming with Tool Events

import { engine } from '@cellular-ai/engine';

const engineInstance = engine({
  dir: './my-project',
  fullContext: true,
  sessionId: 'code-gen-session',
  debug: false
});

for await (const event of engineInstance.streamWithToolEvents(
  'Create a React component that displays a user profile'
)) {
  switch (event.type) {
    case 'text':
      process.stdout.write(event.data);
      break;
    case 'tool_request':
      console.log('🛠️ Tool requested:', event.data.name);
      break;
    case 'tool_start':
      console.log('🚀 Tool started:', event.data.name);
      break;
    case 'tool_result':
      console.log('✅ Tool completed:', event.data.name);
      break;
    case 'tool_error':
      console.log('❌ Tool failed:', event.data.name);
      break;
  }
}

Tool Execution

import { engine } from '@cellular-ai/engine';

const engineInstance = engine({
  dir: './my-project',
  debug: false
});

// Get available tools
const tools = await engineInstance.getTools();
console.log('Available tools:', tools.map(t => t.name));

// Execute a specific tool
const fileContent = await engineInstance.executeTool('read-file', {
  path: './src/index.js'
});
console.log('File content:', fileContent);

License

All code in this project is maintained under the Apache-2.0 License