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

@viso/code-core

v0.0.7

Published

Core functionality for Code CLI

Readme

@viso/code-core

English | 中文

Core functionality and AI engine for the Code CLI ecosystem.

🚀 Features

  • Multi-Provider Support: Works with various AI providers (SiliconFlow, LaoZhang, etc.)
  • Intelligent Routing: Automatic provider selection based on performance and availability
  • Tool System: Extensible tool framework for code operations
  • Context Management: Advanced context handling for better AI responses
  • Memory System: Persistent storage for conversations and code snippets
  • Planning Engine: Advanced task decomposition and planning capabilities

📦 Installation

npm install @viso/code-core

🔧 Usage

Basic Setup

import { EnhancedAIAssistant } from '@viso/code-core';

const assistant = new EnhancedAIAssistant({
  providers: [
    {
      name: 'silicon-flow',
      type: 'chat',
      apiKey: 'your-api-key',
    },
  ],
});

AI Providers

import { SiliconFlowProvider } from '@viso/code-core/providers';

const provider = new SiliconFlowProvider({
  apiKey: 'your-api-key',
  model: 'deepseek-chat',
});

const response = await provider.chat([
  { role: 'user', content: 'Hello, world!' },
]);

Tool System

import { ToolRegistry } from '@viso/code-core/tools';

const registry = new ToolRegistry();

// Register custom tools
registry.register('file-reader', {
  name: 'File Reader',
  description: 'Read file contents',
  execute: async (path: string) => {
    // Implementation
  },
});

Context Management

import { ContextManager } from '@viso/code-core';

const contextManager = new ContextManager();

// Add context
contextManager.addContext('project', {
  name: 'My Project',
  description: 'A TypeScript project',
  files: ['src/index.ts', 'package.json'],
});

// Get relevant context
const context = contextManager.getRelevantContext('typescript');

🏗️ Architecture

Core Components

  1. AI Engine: Main orchestrator for AI interactions
  2. Provider System: Abstraction layer for different AI services
  3. Tool Registry: Manages available tools and their execution
  4. Context Manager: Handles contextual information
  5. Memory System: Persistent storage for conversations
  6. Planning Engine: Task decomposition and planning

Provider Interface

interface AIProvider {
  name: string;
  type: ProviderType;
  chat(messages: ChatMessage[]): Promise<ChatResponse>;
  isAvailable(): Promise<boolean>;
}

Tool Interface

interface Tool {
  name: string;
  description: string;
  parameters: ToolParameter[];
  execute(args: any): Promise<any>;
}

📖 API Reference

Classes

EnhancedAIAssistant

Main class for AI interactions.

class EnhancedAIAssistant {
  constructor(config: AIConfig);

  async chat(message: string): Promise<ChatResponse>;
  async executeCommand(command: string): Promise<CommandResult>;
  async getContext(): Promise<Context>;
}

ToolRegistry

Manages available tools.

class ToolRegistry {
  register(name: string, tool: Tool): void;
  unregister(name: string): void;
  execute(name: string, args: any): Promise<any>;
  list(): Tool[];
}

ContextManager

Handles contextual information.

class ContextManager {
  addContext(key: string, context: any): void;
  getContext(key: string): any;
  getRelevantContext(query: string): any[];
}

🔧 Configuration

Environment Variables

# AI Provider Configuration
SILICON_FLOW_API_KEY=your-api-key
SILICON_FLOW_BASE_URL=https://api.siliconflow.cn

# Database Configuration
LANCEDB_PATH=./data/lancedb
MEMORY_ENABLED=true

# Tool Configuration
SHELL_TOOL_ENABLED=true
FILE_TOOL_ENABLED=true

Configuration File

{
  "providers": [
    {
      "name": "silicon-flow",
      "type": "chat",
      "apiKey": "${SILICON_FLOW_API_KEY}",
      "baseUrl": "https://api.siliconflow.cn"
    }
  ],
  "tools": {
    "enabled": ["shell", "file", "search"],
    "shell": {
      "timeout": 30000
    }
  },
  "memory": {
    "enabled": true,
    "path": "./data/memory"
  }
}

🧪 Testing

npm test                # Run all tests
npm run test:unit      # Run unit tests
npm run test:integration # Run integration tests

🔗 Related Packages

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

📄 License

MIT License - see LICENSE for details.

🆘 Support