Core Library Overview
The@janhq/core library is the foundation for building extensions in Jan. It provides type definitions, base classes, and an event system that enables seamless integration with the Jan platform.
What is @janhq/core?
@janhq/core is a TypeScript library that exports:
- Type definitions for models, messages, threads, and more
- Base extension classes to build custom extensions
- Event system for communication between components
- Interfaces for implementing model management and inference capabilities
Installation
Core Exports
The library exports from several modules:Available Type Modules
Model Types
Types for model definitions, settings, and parameters
Message Types
Types for messages, threads, and conversations
Assistant Types
Types for assistant configuration and tools
Inference Types
Types for chat completion and inference requests
Key Concepts
Extensions
Extensions are the building blocks of Jan. Each extension extends theBaseExtension class and implements specific functionality.
Event System
The event system enables communication between extensions and the core application.Type Safety
All types are fully typed with TypeScript, providing excellent IntelliSense support and compile-time safety.Global Core Object
The library declares a globalcore object used internally:
Next Steps
Type Definitions
Explore all available TypeScript types
Event System
Learn about the event-driven architecture
Extension Base Classes
Build your first extension
Model Interface
Implement model management