oricore 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -137
- package/README.zh-CN.md +81 -134
- package/dist/core/context.d.ts +3 -0
- package/dist/core/globalData.d.ts +2 -0
- package/dist/core/loop.d.ts +1 -1
- package/dist/core/model/aliases.d.ts +2 -0
- package/dist/core/model/models.d.ts +2 -0
- package/dist/core/model/providers.d.ts +12 -0
- package/dist/core/model/proxy.d.ts +12 -0
- package/dist/core/model/resolution.d.ts +17 -0
- package/dist/core/model/types.d.ts +65 -0
- package/dist/core/model/utils.d.ts +11 -0
- package/dist/core/model.d.ts +13 -80
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2569 -2319
- package/dist/tools/tools/bash.d.ts +4 -20
- package/dist/utils/background-detection.d.ts +1 -1
- package/dist/utils/bash/constants.d.ts +20 -0
- package/dist/utils/bash/output.d.ts +49 -0
- package/dist/utils/bash/security.d.ts +46 -0
- package/package.json +1 -1
- package/src/api/engine.ts +16 -2
- package/src/core/context.ts +6 -0
- package/src/core/globalData.ts +15 -0
- package/src/core/loop.ts +22 -5
- package/src/core/model/aliases.ts +12 -0
- package/src/core/model/models.ts +1014 -0
- package/src/core/model/providers.ts +919 -0
- package/src/core/model/proxy.ts +42 -0
- package/src/core/model/resolution.ts +422 -0
- package/src/core/model/types.ts +76 -0
- package/src/core/model/utils.ts +41 -0
- package/src/core/model.ts +32 -2255
- package/src/core/promptCache.ts +39 -16
- package/src/index.ts +17 -0
- package/src/tools/tools/bash.integration.test.ts +516 -0
- package/src/tools/tools/bash.test.ts +35 -323
- package/src/tools/tools/bash.ts +214 -507
- package/src/utils/background-detection.ts +3 -8
- package/src/utils/bash/constants.ts +52 -0
- package/src/utils/bash/output.test.ts +461 -0
- package/src/utils/bash/output.ts +145 -0
- package/src/utils/bash/security.test.ts +315 -0
- package/src/utils/bash/security.ts +234 -0
- package/src/core/thinking-config.ts +0 -98
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OriCore
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**Powerful AI Engine Library - Build Smart Assistants in 5 Lines of Code**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/oricore)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -11,202 +11,149 @@
|
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
---
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## What is OriCore?
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
OriCore is a fully-featured **AI Engine Library** that lets you easily integrate powerful AI capabilities into any application.
|
|
19
19
|
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **MCP
|
|
24
|
-
- **
|
|
25
|
-
- **Agent Framework**: Built-in agents for complex multi-step tasks (explore, general-purpose)
|
|
26
|
-
- **Session Management**: Persistent conversation history with session resumption
|
|
27
|
-
- **Streaming Support**: Real-time text delta streaming for responsive interactions
|
|
28
|
-
- **Fully Typed**: Complete TypeScript support with comprehensive type definitions
|
|
29
|
-
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
20
|
+
- **Support for 40+ AI providers** (OpenAI, Claude, DeepSeek, Zhipu AI, etc.)
|
|
21
|
+
- **Complete built-in tool system** (file read/write, code search, shell commands, network requests)
|
|
22
|
+
- **Session management** + **Context compression**
|
|
23
|
+
- **MCP protocol** + **Skill system** for unlimited extensions
|
|
24
|
+
- **5 professional interaction modes** (brainstorm, plan, review, debug, default)
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
Build AI-powered products with just **5 lines of code**:
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- Create automated code review systems
|
|
36
|
-
- Develop intelligent debugging tools
|
|
37
|
-
- Build educational platforms
|
|
38
|
-
- Implement automated documentation generation
|
|
39
|
-
|
|
40
|
-
## Installation
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npm install oricore
|
|
44
|
-
```
|
|
28
|
+
```typescript
|
|
29
|
+
import { createEngine } from 'oricore';
|
|
45
30
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
pnpm add oricore
|
|
31
|
+
const engine = createEngine({ productName: 'MyApp', version: '1.0.0' });
|
|
32
|
+
await engine.initialize({ model: 'deepseek/deepseek-chat', provider: { deepseek: { apiKey: 'your-key' } } });
|
|
49
33
|
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
const result = await engine.sendMessage({ message: 'Analyze this project structure', write: true });
|
|
35
|
+
console.log(result.data.text);
|
|
52
36
|
```
|
|
53
37
|
|
|
54
|
-
|
|
38
|
+
---
|
|
55
39
|
|
|
56
|
-
|
|
40
|
+
## Quick Start
|
|
57
41
|
|
|
58
|
-
**PDF Support**
|
|
59
42
|
```bash
|
|
60
|
-
npm install
|
|
43
|
+
npm install oricore ai
|
|
61
44
|
```
|
|
62
|
-
The `read` tool can parse PDF files when `pdf-parse` is installed. Without it, PDF reading will be disabled.
|
|
63
|
-
|
|
64
|
-
## Quick Start
|
|
65
45
|
|
|
66
46
|
```typescript
|
|
67
47
|
import { createEngine } from 'oricore';
|
|
68
48
|
|
|
69
|
-
|
|
70
|
-
const engine = createEngine({
|
|
71
|
-
productName: 'MyAIAssistant',
|
|
72
|
-
version: '1.0.0',
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// 2. Initialize with model and API key
|
|
49
|
+
const engine = createEngine({ productName: 'MyAIAssistant', version: '1.0.0' });
|
|
76
50
|
await engine.initialize({
|
|
77
|
-
model: '
|
|
78
|
-
provider: {
|
|
79
|
-
openai: {
|
|
80
|
-
apiKey: 'your-api-key',
|
|
81
|
-
baseURL: 'https://api.openai.com/v1',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
51
|
+
model: 'deepseek/deepseek-chat',
|
|
52
|
+
provider: { deepseek: { apiKey: 'your-api-key' } },
|
|
84
53
|
});
|
|
85
54
|
|
|
86
|
-
// 3. Send a message
|
|
87
55
|
const result = await engine.sendMessage({
|
|
88
|
-
message: 'Create a TypeScript function to calculate
|
|
56
|
+
message: 'Create a TypeScript function to calculate Fibonacci',
|
|
89
57
|
write: true,
|
|
90
58
|
});
|
|
91
59
|
|
|
92
60
|
console.log(result.data.text);
|
|
93
|
-
|
|
94
|
-
// 4. Cleanup
|
|
95
61
|
await engine.shutdown();
|
|
96
62
|
```
|
|
97
63
|
|
|
98
|
-
|
|
64
|
+
[📖 5-Minute Quick Start Guide](docs/QUICKSTART.md)
|
|
99
65
|
|
|
100
|
-
|
|
66
|
+
---
|
|
101
67
|
|
|
102
|
-
|
|
103
|
-
// Brainstorm mode - interactive design exploration
|
|
104
|
-
engine.setMode('brainstorm');
|
|
105
|
-
const design = await engine.sendMessageWithMode('I want to build a task management app');
|
|
68
|
+
## Why OriCore?
|
|
106
69
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
70
|
+
| What You Need | OriCore | Others |
|
|
71
|
+
|---------------|---------|--------|
|
|
72
|
+
| **Build an AI assistant fast** | ✅ 5 lines of code | ❌ 100+ lines of setup |
|
|
73
|
+
| **Work with any AI provider** | ✅ 40+ providers unified | ⚠️ Provider-specific SDKs |
|
|
74
|
+
| **Ready-to-use tools** | ✅ File, shell, search, web | ❌ Build everything yourself |
|
|
75
|
+
| **Save on API costs** | ✅ Auto context compression | ❌ Pay for full context every time |
|
|
76
|
+
| **Extend with plugins** | ✅ MCP + Skills | ❌ Complex or impossible |
|
|
77
|
+
| **Switch AI providers** | ✅ Change 1 line of code | ❌ Rewrite integration code |
|
|
110
78
|
|
|
111
|
-
|
|
112
|
-
engine.setMode('review');
|
|
113
|
-
const review = await engine.sendMessageWithMode('Review this code: ...');
|
|
79
|
+
**Built for developers who need to ship AI features fast:**
|
|
114
80
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
81
|
+
- **5-minute setup** - Get a working AI assistant with file access, code search, and shell commands
|
|
82
|
+
- **No vendor lock-in** - Switch between OpenAI, Claude, DeepSeek, etc. anytime
|
|
83
|
+
- **Production-ready** - Built-in session persistence, cost tracking, and error handling
|
|
84
|
+
- **Extensible** - Add custom tools via MCP servers or local skill files
|
|
85
|
+
- **AI-aware** - Context compression and specialized modes for different tasks
|
|
119
86
|
|
|
120
|
-
|
|
87
|
+
---
|
|
121
88
|
|
|
122
|
-
|
|
89
|
+
## Built-in Tools
|
|
123
90
|
|
|
124
|
-
| Tool |
|
|
125
|
-
|
|
126
|
-
| `read` | Read
|
|
127
|
-
| `write` | Write
|
|
128
|
-
| `edit` | Edit
|
|
91
|
+
| Tool | Function |
|
|
92
|
+
|------|----------|
|
|
93
|
+
| `read` | Read files (text, images, PDF) |
|
|
94
|
+
| `write` | Write files |
|
|
95
|
+
| `edit` | Edit files (search & replace) |
|
|
129
96
|
| `glob` | Find files by pattern |
|
|
130
97
|
| `grep` | Search file contents |
|
|
131
98
|
| `bash` | Execute shell commands |
|
|
132
99
|
| `fetch` | Make HTTP requests |
|
|
133
|
-
| `
|
|
134
|
-
| `task` | Spawn specialized agents |
|
|
100
|
+
| `task` | Launch specialized agents |
|
|
135
101
|
| `todo` | Track task progress |
|
|
102
|
+
| `askUserQuestion` | Interactive Q&A with users |
|
|
136
103
|
|
|
137
|
-
|
|
104
|
+
[📖 Tools Documentation](docs/TOOLS.md)
|
|
138
105
|
|
|
139
|
-
|
|
106
|
+
---
|
|
140
107
|
|
|
141
|
-
|
|
108
|
+
## Use Cases
|
|
142
109
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
tools: {
|
|
150
|
-
read: true,
|
|
151
|
-
write: true,
|
|
152
|
-
bash: true,
|
|
153
|
-
},
|
|
154
|
-
provider: {
|
|
155
|
-
openai: {
|
|
156
|
-
apiKey: 'your-api-key',
|
|
157
|
-
baseURL: 'https://api.openai.com/v1',
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
```
|
|
110
|
+
- **Build Custom AI Assistants** - Chatbots, customer service systems
|
|
111
|
+
- **IDE Integration** - Code assistants, smart autocomplete
|
|
112
|
+
- **Code Review** - Automated code review systems
|
|
113
|
+
- **Debugging Tools** - Intelligent error diagnosis
|
|
114
|
+
- **Education Platforms** - Programming teaching assistants
|
|
115
|
+
- **Documentation Generation** - Automated documentation generation
|
|
162
116
|
|
|
163
|
-
|
|
117
|
+
---
|
|
164
118
|
|
|
165
|
-
|
|
166
|
-
|----------|---------------|--------------|
|
|
167
|
-
| OpenAI | `openai/gpt-5.2-codex` | `https://api.openai.com/v1` |
|
|
168
|
-
| Anthropic | `anthropic/claude-opus-4-5` | `https://api.anthropic.com` |
|
|
169
|
-
| Google | `google/gemini-3-flash-preview` | `https://generativelanguage.googleapis.com` |
|
|
170
|
-
| DeepSeek | `deepseek/deepseek-chat` | `https://api.deepseek.com` |
|
|
171
|
-
| Zhipu AI | `zhipuai/glm-4.7` | `https://open.bigmodel.cn/api/paas/v4` |
|
|
119
|
+
## Documentation
|
|
172
120
|
|
|
173
|
-
|
|
121
|
+
### Getting Started
|
|
122
|
+
- **[5-Minute Quick Start](docs/QUICKSTART.md)** - Get up to speed with OriCore
|
|
123
|
+
- **[Tutorials](docs/TUTORIALS.md)** - Practical examples
|
|
174
124
|
|
|
175
|
-
|
|
125
|
+
### Core Features
|
|
126
|
+
- **[API Reference](docs/API.md)** - Complete API documentation
|
|
127
|
+
- **[Configuration Guide](docs/CONFIG.md)** - All configuration options
|
|
128
|
+
- **[Tools System](docs/TOOLS.md)** - Built-in tools guide
|
|
129
|
+
- **[Interaction Modes](docs/MODES.md)** - 5 professional modes
|
|
176
130
|
|
|
177
|
-
|
|
131
|
+
### Advanced Features
|
|
132
|
+
- **[Session Management](docs/SESSIONS.md)** - Persistence & context compression
|
|
133
|
+
- **[Event System](docs/EVENTS.md)** - Message bus & events
|
|
134
|
+
- **[MCP Integration](docs/MCP.md)** - MCP protocol support
|
|
135
|
+
- **[Skill System](docs/SKILLS.md)** - Custom skill loading
|
|
136
|
+
- **[Approval System](docs/APPROVAL.md)** - Tool execution permission control
|
|
178
137
|
|
|
179
|
-
|
|
180
|
-
oricore/
|
|
181
|
-
├── src/
|
|
182
|
-
│ ├── api/ # Main Engine API
|
|
183
|
-
│ ├── core/ # Core functionality (loop, context, config)
|
|
184
|
-
│ ├── tools/ # Built-in tools
|
|
185
|
-
│ ├── modes/ # Interaction modes
|
|
186
|
-
│ ├── mcp/ # MCP integration
|
|
187
|
-
│ ├── skill/ # Skill system
|
|
188
|
-
│ ├── agent/ # Agent framework
|
|
189
|
-
│ ├── session/ # Session management
|
|
190
|
-
│ └── utils/ # Utilities
|
|
191
|
-
├── examples/ # Usage examples
|
|
192
|
-
└── dist/ # Compiled output
|
|
193
|
-
```
|
|
138
|
+
---
|
|
194
139
|
|
|
195
|
-
##
|
|
140
|
+
## Acknowledgments
|
|
196
141
|
|
|
197
142
|
This project references the core architecture of the following excellent project:
|
|
198
|
-
- **[neovate-code](https://github.com/neovateai/neovate-code)** - Core AI engine architecture
|
|
199
143
|
|
|
200
|
-
|
|
144
|
+
**[neovate-code](https://github.com/neovateai/neovate-code)** - Core AI engine architecture
|
|
145
|
+
|
|
146
|
+
OriCore has been refactored and streamlined on this foundation, removing UI, CLI, and other peripheral features to focus on providing a powerful and standalone AI engine library that can be easily integrated into any project.
|
|
147
|
+
|
|
148
|
+
---
|
|
201
149
|
|
|
202
150
|
## License
|
|
203
151
|
|
|
204
152
|
MIT © [lyw405](https://github.com/lyw405)
|
|
205
153
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
154
|
+
---
|
|
209
155
|
|
|
210
156
|
## Support
|
|
211
157
|
|
|
212
|
-
|
|
158
|
+
- **GitHub**: [lyw405/oricore](https://github.com/lyw405/oricore)
|
|
159
|
+
- **Issues**: [Report a problem](https://github.com/lyw405/oricore/issues)
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OriCore
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**强大的 AI 引擎库,5 行代码构建智能助手**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/oricore)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -11,202 +11,149 @@
|
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
---
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## 什么是 OriCore?
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
OriCore 是一个功能完整的 **AI 引擎库**,让你可以轻松地在任何应用中集成强大的 AI 能力。
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- **MCP
|
|
24
|
-
-
|
|
25
|
-
- **Agent 框架**:用于复杂多步骤任务的内置 Agent(探索、通用)
|
|
26
|
-
- **会话管理**:持久的对话历史,支持会话恢复
|
|
27
|
-
- **流式支持**:实时文本增量流式传输,提供响应式交互
|
|
28
|
-
- **完整的类型支持**:全面的 TypeScript 支持和类型定义
|
|
29
|
-
- **零配置**:使用合理的默认值即可开箱即用
|
|
20
|
+
- 支持 **40+ AI 厂商**(OpenAI、Claude、DeepSeek、智谱等)
|
|
21
|
+
- 内置 **完整工具系统**(文件读写、代码搜索、Shell 命令、网络请求)
|
|
22
|
+
- **会话管理** + **上下文压缩**
|
|
23
|
+
- **MCP 协议** + **Skill 系统** 无限扩展
|
|
24
|
+
- **5 种专业交互模式**(头脑风暴、规划、审查、调试、默认)
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
只需要 **5 行代码**,就能给你的产品加上 AI:
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- 创建自动化代码审查系统
|
|
36
|
-
- 开发智能调试工具
|
|
37
|
-
- 构建教育平台
|
|
38
|
-
- 实现自动化文档生成
|
|
39
|
-
|
|
40
|
-
## 安装
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npm install oricore
|
|
44
|
-
```
|
|
28
|
+
```typescript
|
|
29
|
+
import { createEngine } from 'oricore';
|
|
45
30
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
pnpm add oricore
|
|
31
|
+
const engine = createEngine({ productName: 'MyApp', version: '1.0.0' });
|
|
32
|
+
await engine.initialize({ model: 'deepseek/deepseek-chat', provider: { deepseek: { apiKey: 'your-key' } } });
|
|
49
33
|
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
const result = await engine.sendMessage({ message: '帮我分析这个项目的结构', write: true });
|
|
35
|
+
console.log(result.data.text);
|
|
52
36
|
```
|
|
53
37
|
|
|
54
|
-
|
|
38
|
+
---
|
|
55
39
|
|
|
56
|
-
|
|
40
|
+
## 快速开始
|
|
57
41
|
|
|
58
|
-
**PDF 支持**
|
|
59
42
|
```bash
|
|
60
|
-
npm install
|
|
43
|
+
npm install oricore ai
|
|
61
44
|
```
|
|
62
|
-
安装 `pdf-parse` 后,`read` 工具可以解析 PDF 文件。未安装时,PDF 读取功能将被禁用。
|
|
63
|
-
|
|
64
|
-
## 快速开始
|
|
65
45
|
|
|
66
46
|
```typescript
|
|
67
47
|
import { createEngine } from 'oricore';
|
|
68
48
|
|
|
69
|
-
|
|
70
|
-
const engine = createEngine({
|
|
71
|
-
productName: 'MyAIAssistant',
|
|
72
|
-
version: '1.0.0',
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// 2. 初始化模型和 API Key
|
|
49
|
+
const engine = createEngine({ productName: 'MyAIAssistant', version: '1.0.0' });
|
|
76
50
|
await engine.initialize({
|
|
77
|
-
model: '
|
|
78
|
-
provider: {
|
|
79
|
-
openai: {
|
|
80
|
-
apiKey: 'your-api-key',
|
|
81
|
-
baseURL: 'https://api.openai.com/v1',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
51
|
+
model: 'deepseek/deepseek-chat',
|
|
52
|
+
provider: { deepseek: { apiKey: 'your-api-key' } },
|
|
84
53
|
});
|
|
85
54
|
|
|
86
|
-
// 3. 发送消息
|
|
87
55
|
const result = await engine.sendMessage({
|
|
88
56
|
message: '创建一个 TypeScript 函数来计算斐波那契数列',
|
|
89
57
|
write: true,
|
|
90
58
|
});
|
|
91
59
|
|
|
92
60
|
console.log(result.data.text);
|
|
93
|
-
|
|
94
|
-
// 4. 清理
|
|
95
61
|
await engine.shutdown();
|
|
96
62
|
```
|
|
97
63
|
|
|
98
|
-
|
|
64
|
+
[📖 5分钟上手指南](docs/QUICKSTART.zh-CN.md)
|
|
99
65
|
|
|
100
|
-
|
|
66
|
+
---
|
|
101
67
|
|
|
102
|
-
|
|
103
|
-
// 头脑风暴模式 - 交互式设计探索
|
|
104
|
-
engine.setMode('brainstorm');
|
|
105
|
-
const design = await engine.sendMessageWithMode('我想构建一个任务管理应用');
|
|
68
|
+
## 为什么选择 OriCore?
|
|
106
69
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
70
|
+
| 你的需求 | OriCore | 其他方案 |
|
|
71
|
+
|---------|---------|----------|
|
|
72
|
+
| **快速构建 AI 助手** | ✅ 5 行代码 | ❌ 100+ 行配置 |
|
|
73
|
+
| **对接任意 AI 厂商** | ✅ 40+ 厂商统一接口 | ⚠️ 各自独立的 SDK |
|
|
74
|
+
| **开箱即用的工具** | ✅ 文件、Shell、搜索、网络 | ❌ 全部自己实现 |
|
|
75
|
+
| **节省 API 成本** | ✅ 自动上下文压缩 | ❌ 每次都传完整上下文 |
|
|
76
|
+
| **插件扩展能力** | ✅ MCP + Skills | ❌ 复杂或无法实现 |
|
|
77
|
+
| **切换 AI 厂商** | ✅ 改一行代码 | ❌ 重写集成代码 |
|
|
110
78
|
|
|
111
|
-
|
|
112
|
-
engine.setMode('review');
|
|
113
|
-
const review = await engine.sendMessageWithMode('审查这段代码的性能');
|
|
79
|
+
**为需要快速交付 AI 功能的开发者打造:**
|
|
114
80
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
81
|
+
- **5 分钟上手** - 立即获得具备文件访问、代码搜索、Shell 命令的 AI 助手
|
|
82
|
+
- **无厂商锁定** - 随时在 OpenAI、Claude、DeepSeek 等之间切换
|
|
83
|
+
- **生产就绪** - 内置会话持久化、成本追踪、错误处理
|
|
84
|
+
- **易于扩展** - 通过 MCP 服务器或本地技能文件添加自定义工具
|
|
85
|
+
- **AI 智能优化** - 上下文压缩和针对不同任务的专业模式
|
|
119
86
|
|
|
120
|
-
|
|
87
|
+
---
|
|
121
88
|
|
|
122
|
-
|
|
89
|
+
## 内置工具
|
|
123
90
|
|
|
124
|
-
| 工具 |
|
|
91
|
+
| 工具 | 功能 |
|
|
125
92
|
|------|------|
|
|
126
|
-
| `read` |
|
|
127
|
-
| `write` |
|
|
128
|
-
| `edit` |
|
|
93
|
+
| `read` | 读取文件(支持文本、图片、PDF) |
|
|
94
|
+
| `write` | 写入文件 |
|
|
95
|
+
| `edit` | 编辑文件(搜索替换) |
|
|
129
96
|
| `glob` | 按模式查找文件 |
|
|
130
97
|
| `grep` | 搜索文件内容 |
|
|
131
98
|
| `bash` | 执行 Shell 命令 |
|
|
132
99
|
| `fetch` | 发起 HTTP 请求 |
|
|
133
|
-
| `askUserQuestion` | 与用户交互式问答 |
|
|
134
100
|
| `task` | 启动专用 Agent |
|
|
135
101
|
| `todo` | 跟踪任务进度 |
|
|
102
|
+
| `askUserQuestion` | 与用户交互问答 |
|
|
136
103
|
|
|
137
|
-
|
|
104
|
+
[📖 工具系统详解](docs/TOOLS.md)
|
|
138
105
|
|
|
139
|
-
|
|
106
|
+
---
|
|
140
107
|
|
|
141
|
-
|
|
108
|
+
## 使用场景
|
|
142
109
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
tools: {
|
|
150
|
-
read: true,
|
|
151
|
-
write: true,
|
|
152
|
-
bash: true,
|
|
153
|
-
},
|
|
154
|
-
provider: {
|
|
155
|
-
openai: {
|
|
156
|
-
apiKey: 'your-api-key',
|
|
157
|
-
baseURL: 'https://api.openai.com/v1',
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
```
|
|
110
|
+
- **构建自定义 AI 助手** - 聊天机器人、客服系统
|
|
111
|
+
- **IDE 集成** - 代码助手、智能补全
|
|
112
|
+
- **代码审查** - 自动化代码审查系统
|
|
113
|
+
- **调试工具** - 智能错误诊断
|
|
114
|
+
- **教育平台** - 编程教学助手
|
|
115
|
+
- **文档生成** - 自动化文档生成
|
|
162
116
|
|
|
163
|
-
|
|
117
|
+
---
|
|
164
118
|
|
|
165
|
-
|
|
166
|
-
|----------|---------------|--------------|
|
|
167
|
-
| OpenAI | `openai/gpt-5.2-codex` | `https://api.openai.com/v1` |
|
|
168
|
-
| Anthropic | `anthropic/claude-opus-4-5` | `https://api.anthropic.com` |
|
|
169
|
-
| Google | `google/gemini-3-flash-preview` | `https://generativelanguage.googleapis.com` |
|
|
170
|
-
| DeepSeek | `deepseek/deepseek-chat` | `https://api.deepseek.com` |
|
|
171
|
-
| 智谱 AI | `zhipuai/glm-4.7` | `https://open.bigmodel.cn/api/paas/v4` |
|
|
119
|
+
## 文档导航
|
|
172
120
|
|
|
173
|
-
|
|
121
|
+
### 新手入门
|
|
122
|
+
- **[5分钟上手](docs/QUICKSTART.md)** - 快速了解 OriCore
|
|
123
|
+
- **[场景教程](docs/TUTORIALS.md)** - 实战示例
|
|
174
124
|
|
|
175
|
-
|
|
125
|
+
### 核心功能
|
|
126
|
+
- **[API 参考](docs/API.md)** - 完整的 API 文档
|
|
127
|
+
- **[配置详解](docs/CONFIG.md)** - 所有配置选项
|
|
128
|
+
- **[工具系统](docs/TOOLS.md)** - 内置工具详解
|
|
129
|
+
- **[交互模式](docs/MODES.md)** - 5 种专业模式
|
|
176
130
|
|
|
177
|
-
|
|
131
|
+
### 高级功能
|
|
132
|
+
- **[会话管理](docs/SESSIONS.md)** - 持久化与上下文压缩
|
|
133
|
+
- **[事件系统](docs/EVENTS.md)** - 消息总线与事件
|
|
134
|
+
- **[MCP 集成](docs/MCP.md)** - MCP 协议支持
|
|
135
|
+
- **[Skill 系统](docs/SKILLS.md)** - 自定义技能加载
|
|
136
|
+
- **[审批系统](docs/APPROVAL.md)** - 工具执行权限控制
|
|
178
137
|
|
|
179
|
-
|
|
180
|
-
oricore/
|
|
181
|
-
├── src/
|
|
182
|
-
│ ├── api/ # 核心 API
|
|
183
|
-
│ ├── core/ # 核心功能(循环、上下文、配置)
|
|
184
|
-
│ ├── tools/ # 内置工具
|
|
185
|
-
│ ├── modes/ # 交互模式
|
|
186
|
-
│ ├── mcp/ # MCP 集成
|
|
187
|
-
│ ├── skill/ # 技能系统
|
|
188
|
-
│ ├── agent/ # Agent 框架
|
|
189
|
-
│ ├── session/ # 会话管理
|
|
190
|
-
│ └── utils/ # 工具函数
|
|
191
|
-
├── examples/ # 使用示例
|
|
192
|
-
└── dist/ # 编译输出
|
|
193
|
-
```
|
|
138
|
+
---
|
|
194
139
|
|
|
195
|
-
##
|
|
140
|
+
## 致谢
|
|
196
141
|
|
|
197
142
|
本项目参考了以下优秀项目的核心架构:
|
|
198
|
-
- **[neovate-code](https://github.com/neovateai/neovate-code)** - 核心 AI 引擎架构
|
|
199
143
|
|
|
200
|
-
|
|
144
|
+
**[neovate-code](https://github.com/neovateai/neovate-code)** - 核心 AI 引擎架构
|
|
145
|
+
|
|
146
|
+
OriCore 在此基础上进行了重构和精简,移除了 UI、CLI 等外围功能,专注于提供一个功能强大且独立的 AI 引擎库,可以轻松集成到任何项目中。
|
|
147
|
+
|
|
148
|
+
---
|
|
201
149
|
|
|
202
150
|
## 许可证
|
|
203
151
|
|
|
204
152
|
MIT © [lyw405](https://github.com/lyw405)
|
|
205
153
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
欢迎提交 Issue 和 Pull Request!
|
|
154
|
+
---
|
|
209
155
|
|
|
210
156
|
## 支持
|
|
211
157
|
|
|
212
|
-
|
|
158
|
+
- **GitHub**: [lyw405/oricore](https://github.com/lyw405/oricore)
|
|
159
|
+
- **问题反馈**: [Issues](https://github.com/lyw405/oricore/issues)
|
package/dist/core/context.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AgentManager } from '../agent/agent/agentManager';
|
|
2
2
|
import { BackgroundTaskManager } from './backgroundTaskManager';
|
|
3
3
|
import { type Config } from '../core/config';
|
|
4
|
+
import { GlobalData } from './globalData';
|
|
4
5
|
import { MCPManager } from '../mcp/mcp';
|
|
5
6
|
import type { MessageBus } from '../communication/messageBus';
|
|
6
7
|
import { Paths } from './paths';
|
|
@@ -22,6 +23,7 @@ type ContextOpts = {
|
|
|
22
23
|
agentManager?: AgentManager;
|
|
23
24
|
plugins: (string | Plugin)[];
|
|
24
25
|
fetch?: typeof globalThis.fetch;
|
|
26
|
+
globalData: GlobalData;
|
|
25
27
|
};
|
|
26
28
|
export type ContextCreateOpts = {
|
|
27
29
|
cwd: string;
|
|
@@ -49,6 +51,7 @@ export declare class Context {
|
|
|
49
51
|
agentManager?: AgentManager;
|
|
50
52
|
plugins: (string | Plugin)[];
|
|
51
53
|
fetch?: typeof globalThis.fetch;
|
|
54
|
+
globalData: GlobalData;
|
|
52
55
|
constructor(opts: ContextOpts);
|
|
53
56
|
apply(applyOpts: Omit<PluginApplyOpts, 'pluginContext'>): Promise<any>;
|
|
54
57
|
destroy(): Promise<void>;
|
package/dist/core/loop.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { LanguageModelV3FunctionTool, LanguageModelV3Prompt, SharedV3Header
|
|
|
2
2
|
import { History, type OnMessage } from '../core/history';
|
|
3
3
|
import { type NormalizedMessage } from '../core/message';
|
|
4
4
|
import type { ModelInfo } from '../core/model';
|
|
5
|
-
import { type ReasoningEffort } from './thinking-config';
|
|
6
5
|
import type { ToolApprovalResult, ToolResult, Tools, ToolUse } from '../tools/tool';
|
|
7
6
|
import { Usage } from '../core/usage';
|
|
8
7
|
export type LoopResult = {
|
|
@@ -46,6 +45,7 @@ export type ResponseFormat = {
|
|
|
46
45
|
name?: string;
|
|
47
46
|
description?: string;
|
|
48
47
|
};
|
|
48
|
+
export type ReasoningEffort = 'low' | 'medium' | 'high' | 'max';
|
|
49
49
|
export type ThinkingConfig = {
|
|
50
50
|
effort: ReasoningEffort;
|
|
51
51
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LanguageModelV3, LanguageModelV3Middleware } from '@ai-sdk/provider';
|
|
2
|
+
import type { Provider, ProvidersMap } from './types';
|
|
3
|
+
export declare const defaultModelCreator: (name: string, provider: Provider) => LanguageModelV3;
|
|
4
|
+
export declare const defaultAnthropicModelCreator: (name: string, provider: Provider) => LanguageModelV3;
|
|
5
|
+
export declare const openaiModelCreator: (name: string, provider: Provider) => LanguageModelV3;
|
|
6
|
+
export declare const openaiModelResponseCreator: (name: string, provider: Provider) => LanguageModelV3;
|
|
7
|
+
export declare const createModelCreatorCompatible: (opts?: {
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
fetch?: any;
|
|
10
|
+
middlewares?: LanguageModelV3Middleware[];
|
|
11
|
+
}) => (name: string, provider: Provider) => LanguageModelV3;
|
|
12
|
+
export declare const providers: ProvidersMap;
|