oricore 1.3.1 → 1.3.3
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 +18 -16
- package/README.zh-CN.md +15 -13
- package/dist/core/config.d.ts +20 -0
- package/dist/core/configValidation.d.ts +35 -0
- package/dist/core/history.d.ts +9 -0
- package/dist/index.js +110333 -107622
- package/dist/session/session.d.ts +5 -1
- package/dist/tools/tool.d.ts +1 -0
- package/dist/utils/fileLock.d.ts +55 -0
- package/dist/utils/pdf-parser.d.ts +51 -0
- package/package.json +3 -2
- package/src/core/loop.ts +38 -0
- package/src/core/model.ts +12 -2
- package/src/mcp/mcp.ts +19 -2
- package/src/skill/skill.ts +2 -13
- package/src/tools/tool.ts +21 -9
- package/src/utils/safeParseJson.ts +14 -1
package/README.md
CHANGED
|
@@ -74,11 +74,11 @@ const engine = createEngine({
|
|
|
74
74
|
|
|
75
75
|
// 2. Initialize with model and API key
|
|
76
76
|
await engine.initialize({
|
|
77
|
-
model: '
|
|
77
|
+
model: 'openai/gpt-5.2-codex',
|
|
78
78
|
provider: {
|
|
79
|
-
|
|
79
|
+
openai: {
|
|
80
80
|
apiKey: 'your-api-key',
|
|
81
|
-
baseURL: 'https://
|
|
81
|
+
baseURL: 'https://api.openai.com/v1',
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
});
|
|
@@ -142,19 +142,19 @@ OriCore includes a comprehensive set of tools:
|
|
|
142
142
|
|
|
143
143
|
```typescript
|
|
144
144
|
await engine.initialize({
|
|
145
|
-
model: '
|
|
146
|
-
planModel: '
|
|
145
|
+
model: 'openai/gpt-5.2-codex',
|
|
146
|
+
planModel: 'openai/gpt-5.2-codex',
|
|
147
147
|
approvalMode: 'autoEdit',
|
|
148
|
-
language: '
|
|
148
|
+
language: 'en',
|
|
149
149
|
tools: {
|
|
150
150
|
read: true,
|
|
151
151
|
write: true,
|
|
152
152
|
bash: true,
|
|
153
153
|
},
|
|
154
154
|
provider: {
|
|
155
|
-
|
|
155
|
+
openai: {
|
|
156
156
|
apiKey: 'your-api-key',
|
|
157
|
-
baseURL: 'https://
|
|
157
|
+
baseURL: 'https://api.openai.com/v1',
|
|
158
158
|
},
|
|
159
159
|
},
|
|
160
160
|
});
|
|
@@ -164,14 +164,16 @@ await engine.initialize({
|
|
|
164
164
|
|
|
165
165
|
| Provider | Model Example | API Base URL |
|
|
166
166
|
|----------|---------------|--------------|
|
|
167
|
-
|
|
|
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` |
|
|
168
170
|
| DeepSeek | `deepseek/deepseek-chat` | `https://api.deepseek.com` |
|
|
169
|
-
|
|
|
170
|
-
| Anthropic | `anthropic/claude-sonnet-4` | `https://api.anthropic.com` |
|
|
171
|
-
| Google | `google/gemini-2.5-flash` | `https://generativelanguage.googleapis.com` |
|
|
171
|
+
| Zhipu AI | `zhipuai/glm-4.7` | `https://open.bigmodel.cn/api/paas/v4` |
|
|
172
172
|
|
|
173
173
|
See [USAGE.md](./USAGE.md) for more configuration options.
|
|
174
174
|
|
|
175
|
+
**Tool Approval System:** See [APPROVAL.md](./APPROVAL.md) for detailed information about the approval system, including approval modes (`default`, `autoEdit`, `yolo`), custom approval handlers, and best practices.
|
|
176
|
+
|
|
175
177
|
## Project Structure
|
|
176
178
|
|
|
177
179
|
```
|
|
@@ -190,12 +192,12 @@ oricore/
|
|
|
190
192
|
└── dist/ # Compiled output
|
|
191
193
|
```
|
|
192
194
|
|
|
193
|
-
##
|
|
195
|
+
## Statement
|
|
194
196
|
|
|
195
|
-
This project
|
|
196
|
-
- **[neovate-code](https://github.com/
|
|
197
|
+
This project references the core architecture of the following excellent project:
|
|
198
|
+
- **[neovate-code](https://github.com/neovateai/neovate-code)** - Core AI engine architecture
|
|
197
199
|
|
|
198
|
-
OriCore has been refactored and streamlined, removing UI, CLI, and other peripheral features to focus on providing a lightweight, standalone AI engine library that can be easily integrated into any project.
|
|
200
|
+
OriCore has been refactored and streamlined on this foundation, removing UI, CLI, and other peripheral features to focus on providing a lightweight, standalone AI engine library that can be easily integrated into any project.
|
|
199
201
|
|
|
200
202
|
## License
|
|
201
203
|
|
package/README.zh-CN.md
CHANGED
|
@@ -74,11 +74,11 @@ const engine = createEngine({
|
|
|
74
74
|
|
|
75
75
|
// 2. 初始化模型和 API Key
|
|
76
76
|
await engine.initialize({
|
|
77
|
-
model: '
|
|
77
|
+
model: 'openai/gpt-5.2-codex',
|
|
78
78
|
provider: {
|
|
79
|
-
|
|
79
|
+
openai: {
|
|
80
80
|
apiKey: 'your-api-key',
|
|
81
|
-
baseURL: 'https://
|
|
81
|
+
baseURL: 'https://api.openai.com/v1',
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
});
|
|
@@ -142,8 +142,8 @@ OriCore 包含一套完整的工具:
|
|
|
142
142
|
|
|
143
143
|
```typescript
|
|
144
144
|
await engine.initialize({
|
|
145
|
-
model: '
|
|
146
|
-
planModel: '
|
|
145
|
+
model: 'openai/gpt-5.2-codex',
|
|
146
|
+
planModel: 'openai/gpt-5.2-codex',
|
|
147
147
|
approvalMode: 'autoEdit',
|
|
148
148
|
language: 'zh-CN',
|
|
149
149
|
tools: {
|
|
@@ -152,9 +152,9 @@ await engine.initialize({
|
|
|
152
152
|
bash: true,
|
|
153
153
|
},
|
|
154
154
|
provider: {
|
|
155
|
-
|
|
155
|
+
openai: {
|
|
156
156
|
apiKey: 'your-api-key',
|
|
157
|
-
baseURL: 'https://
|
|
157
|
+
baseURL: 'https://api.openai.com/v1',
|
|
158
158
|
},
|
|
159
159
|
},
|
|
160
160
|
});
|
|
@@ -164,14 +164,16 @@ await engine.initialize({
|
|
|
164
164
|
|
|
165
165
|
| 提供商 | 模型示例 | API 地址 |
|
|
166
166
|
|----------|---------------|--------------|
|
|
167
|
-
|
|
|
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` |
|
|
168
170
|
| DeepSeek | `deepseek/deepseek-chat` | `https://api.deepseek.com` |
|
|
169
|
-
|
|
|
170
|
-
| Anthropic | `anthropic/claude-sonnet-4` | `https://api.anthropic.com` |
|
|
171
|
-
| Google | `google/gemini-2.5-flash` | `https://generativelanguage.googleapis.com` |
|
|
171
|
+
| 智谱 AI | `zhipuai/glm-4.7` | `https://open.bigmodel.cn/api/paas/v4` |
|
|
172
172
|
|
|
173
173
|
更多配置选项请参阅 [USAGE.zh-CN.md](./USAGE.zh-CN.md)。
|
|
174
174
|
|
|
175
|
+
**工具审批系统:** 有关审批系统的详细信息,包括审批模式(`default`、`autoEdit`、`yolo`)、自定义审批处理程序和最佳实践,请参阅 [APPROVAL.zh-CN.md](./APPROVAL.zh-CN.md)。
|
|
176
|
+
|
|
175
177
|
## 项目结构
|
|
176
178
|
|
|
177
179
|
```
|
|
@@ -190,10 +192,10 @@ oricore/
|
|
|
190
192
|
└── dist/ # 编译输出
|
|
191
193
|
```
|
|
192
194
|
|
|
193
|
-
##
|
|
195
|
+
## 声明
|
|
194
196
|
|
|
195
197
|
本项目参考了以下优秀项目的核心架构:
|
|
196
|
-
- **[neovate-code](https://github.com/
|
|
198
|
+
- **[neovate-code](https://github.com/neovateai/neovate-code)** - 核心 AI 引擎架构
|
|
197
199
|
|
|
198
200
|
OriCore 在此基础上进行了重新封装和精简,移除了 UI、CLI 等周边功能,专注于提供一个轻量、独立的 AI 引擎库,可轻松集成到任何项目中。
|
|
199
201
|
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Provider } from '../core/model';
|
|
2
|
+
import { type ValidationResult } from './configValidation';
|
|
2
3
|
export type McpStdioServerConfig = {
|
|
3
4
|
type: 'stdio';
|
|
4
5
|
command: string;
|
|
@@ -93,8 +94,27 @@ export declare class ConfigManager {
|
|
|
93
94
|
argvConfig: Partial<Config>;
|
|
94
95
|
globalConfigPath: string;
|
|
95
96
|
projectConfigPath: string;
|
|
97
|
+
private validationEnabled;
|
|
96
98
|
constructor(cwd: string, productName: string, argvConfig: Partial<Config>);
|
|
97
99
|
get config(): Config;
|
|
100
|
+
/**
|
|
101
|
+
* Enable configuration validation
|
|
102
|
+
* When enabled, invalid configurations will throw errors
|
|
103
|
+
*/
|
|
104
|
+
enableValidation(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Disable configuration validation
|
|
107
|
+
*/
|
|
108
|
+
disableValidation(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Validate the current configuration
|
|
111
|
+
* Returns validation result without throwing
|
|
112
|
+
*/
|
|
113
|
+
validate(): ValidationResult;
|
|
114
|
+
/**
|
|
115
|
+
* Get validation errors as a formatted string
|
|
116
|
+
*/
|
|
117
|
+
getValidationErrors(): string;
|
|
98
118
|
removeConfig(global: boolean, key: string, values?: string[]): void;
|
|
99
119
|
addConfig(global: boolean, key: string, values: string[]): void;
|
|
100
120
|
getConfig(global: boolean, key: string): any;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Validation
|
|
3
|
+
* Runtime validation for engine configuration
|
|
4
|
+
*/
|
|
5
|
+
import type { Config } from './config';
|
|
6
|
+
/**
|
|
7
|
+
* Validation result
|
|
8
|
+
*/
|
|
9
|
+
export interface ValidationResult {
|
|
10
|
+
valid: boolean;
|
|
11
|
+
errors: ValidationError[];
|
|
12
|
+
warnings: ValidationWarning[];
|
|
13
|
+
}
|
|
14
|
+
export interface ValidationError {
|
|
15
|
+
path: string;
|
|
16
|
+
message: string;
|
|
17
|
+
value?: any;
|
|
18
|
+
}
|
|
19
|
+
export interface ValidationWarning {
|
|
20
|
+
path: string;
|
|
21
|
+
message: string;
|
|
22
|
+
value?: any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Validate a configuration object
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateConfig(config: Partial<Config>): ValidationResult;
|
|
28
|
+
/**
|
|
29
|
+
* Format validation errors for display
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatValidationErrors(result: ValidationResult): string;
|
|
32
|
+
/**
|
|
33
|
+
* Assert that configuration is valid, throws if not
|
|
34
|
+
*/
|
|
35
|
+
export declare function assertValidConfig(config: Partial<Config>): void;
|
package/dist/core/history.d.ts
CHANGED
|
@@ -17,8 +17,17 @@ export declare class History {
|
|
|
17
17
|
compress(model: ModelInfo): Promise<{
|
|
18
18
|
compressed: boolean;
|
|
19
19
|
summary?: undefined;
|
|
20
|
+
fallback?: undefined;
|
|
21
|
+
error?: undefined;
|
|
20
22
|
} | {
|
|
21
23
|
compressed: boolean;
|
|
22
24
|
summary: string;
|
|
25
|
+
fallback: boolean;
|
|
26
|
+
error: string;
|
|
27
|
+
} | {
|
|
28
|
+
compressed: boolean;
|
|
29
|
+
summary: string;
|
|
30
|
+
fallback: boolean;
|
|
31
|
+
error?: undefined;
|
|
23
32
|
}>;
|
|
24
33
|
}
|