Package Exports
- oricore
Readme
OriCore
A powerful, standalone AI coding engine with multi-model support, tool calling, and extensible architecture
Features
- 🤖 Multi-Model Support: OpenAI, Anthropic, Google, DeepSeek, and 40+ providers
- 🛠️ Rich Tool System: read, write, edit, grep, glob, fetch, and more
- 🧠 Interaction Modes: brainstorm, plan, review, debug, and default modes
- 🔌 MCP Integration: Extensible via Model Context Protocol
- 🎯 Agent System: Built-in agents for complex tasks
- 💬 Interactive: Q&A tool for user interaction
- 📦 Zero Configuration: Works out of the box with sensible defaults
- 🔧 Fully Typed: Complete TypeScript support
Installation
npm install oricore# Using pnpm
pnpm add oricore
# Using bun
bun add oricoreQuick Start
import { createEngine } from 'oricore';
const engine = createEngine({
productName: 'MyApp',
version: '1.0.0',
});
await engine.initialize({
model: 'openai/gpt-4o',
});
const result = await engine.sendMessage({
message: 'Create a TypeScript function to calculate fibonacci',
write: true,
});
console.log(result.data.text);Usage
Basic Chat
const answer = await engine.ask('What is TypeScript?');Multi-Turn Conversation
const result = await engine.sendMessage({
message: 'Create a user class',
write: true,
maxTurns: 50,
});Brainstorming Mode
engine.setMode('brainstorm');
const result = await engine.sendMessageWithMode(
'I want to build a task management app',
{
onToolApprove: async (toolUse) => {
if (toolUse.name === 'askUserQuestion') {
const questions = toolUse.params.questions;
// Collect user answers
const answers = await collectAnswers(questions);
return {
approved: true,
params: { ...toolUse.params, answers },
};
}
return { approved: true };
},
}
);Custom Mode
engine.registerMode({
id: 'code-reviewer',
name: 'Code Reviewer',
config: {
systemPrompt: 'You are a code reviewer...',
write: false,
askUserQuestion: false,
},
});
engine.setMode('code-reviewer');Configuration
Environment Variables
# OpenAI
export OPENAI_API_KEY=sk-...
export OPENAI_API_BASE=https://api.openai.com/v1
# Anthropic
export ANTHROPIC_API_KEY=sk-ant-...
# Google
export GOOGLE_API_KEY=...
# DeepSeek
export DEEPSEEK_API_KEY=...Initialize with Config
await engine.initialize({
model: 'openai/gpt-4o',
provider: {
openai: {
apiKey: 'sk-...',
baseURL: 'https://api.openai.com/v1'
}
}
});API
Engine Class
class Engine {
constructor(options: EngineOptions)
async initialize(config: EngineConfig): Promise<void>
async sendMessage(options: SendMessageOptions): Promise<LoopResult>
async ask(message: string): Promise<string>
async createSession(options?: SessionOptions): Promise<Session>
setMode(mode: ModeType): void
sendMessageWithMode(message: string, options?: Partial<SendMessageOptions>): Promise<LoopResult>
getContext(): Context
getMessageBus(): MessageBus
async shutdown(): Promise<void>
}Modes
default- General purpose coding assistantbrainstorm- Interactive design and ideationplan- Create implementation plansreview- Code review and analysisdebug- Troubleshooting and debugging
Examples
See the examples/ directory for more examples:
basic.ts- Basic usagemodes.ts- Using different modesstreaming.ts- Streaming responses
Documentation
For more detailed documentation, please visit the USAGE.md file.
License
MIT © lyw405
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you have any questions or issues, please open an issue on GitHub.