oricore 1.3.2 → 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 +2 -0
- package/README.zh-CN.md +2 -0
- package/dist/index.js +110333 -107622
- package/dist/tools/tool.d.ts +1 -0
- package/package.json +1 -1
- package/src/skill/skill.ts +2 -13
- package/src/tools/tool.ts +21 -9
package/dist/tools/tool.d.ts
CHANGED
package/package.json
CHANGED
package/src/skill/skill.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface AddSkillResult {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const MAX_NAME_LENGTH = 64;
|
|
63
|
-
const MAX_DESCRIPTION_LENGTH =
|
|
63
|
+
const MAX_DESCRIPTION_LENGTH = 2048;
|
|
64
64
|
|
|
65
65
|
export interface SkillManagerOpts {
|
|
66
66
|
context: Context;
|
|
@@ -252,14 +252,6 @@ export class SkillManager {
|
|
|
252
252
|
return null;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
if (attributes.description.includes('\n')) {
|
|
256
|
-
this.errors.push({
|
|
257
|
-
path: skillPath,
|
|
258
|
-
message: 'Description must be a single line',
|
|
259
|
-
});
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
255
|
return {
|
|
264
256
|
name: attributes.name,
|
|
265
257
|
description: attributes.description,
|
|
@@ -527,10 +519,7 @@ export class SkillManager {
|
|
|
527
519
|
return null;
|
|
528
520
|
}
|
|
529
521
|
|
|
530
|
-
if (
|
|
531
|
-
attributes.description.length > MAX_DESCRIPTION_LENGTH ||
|
|
532
|
-
attributes.description.includes('\n')
|
|
533
|
-
) {
|
|
522
|
+
if (attributes.description.length > MAX_DESCRIPTION_LENGTH) {
|
|
534
523
|
return null;
|
|
535
524
|
}
|
|
536
525
|
|
package/src/tools/tool.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as z from 'zod';
|
|
|
4
4
|
import type { Context } from '../core/context';
|
|
5
5
|
import type { ImagePart, TextPart } from '../core/message';
|
|
6
6
|
import { resolveModelWithContext } from '../core/model';
|
|
7
|
+
import { PluginHookType } from '../core/plugin';
|
|
7
8
|
import { createAskUserQuestionTool } from './tools/askUserQuestion';
|
|
8
9
|
import {
|
|
9
10
|
createBashOutputTool,
|
|
@@ -29,6 +30,7 @@ type ResolveToolsOpts = {
|
|
|
29
30
|
askUserQuestion?: boolean;
|
|
30
31
|
signal?: AbortSignal;
|
|
31
32
|
task?: boolean;
|
|
33
|
+
isPlan?: boolean;
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
export async function resolveTools(opts: ResolveToolsOpts) {
|
|
@@ -97,17 +99,27 @@ export async function resolveTools(opts: ResolveToolsOpts) {
|
|
|
97
99
|
...mcpTools,
|
|
98
100
|
];
|
|
99
101
|
|
|
102
|
+
// 1. First, execute plugin hook to allow plugins to add/modify tools
|
|
103
|
+
let availableTools = allTools;
|
|
104
|
+
try {
|
|
105
|
+
availableTools = await opts.context.apply({
|
|
106
|
+
hook: 'tool',
|
|
107
|
+
args: [{ isPlan: opts.isPlan, sessionId: opts.sessionId }],
|
|
108
|
+
memo: allTools,
|
|
109
|
+
type: PluginHookType.SeriesMerge,
|
|
110
|
+
});
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.warn('[resolveTools] Plugin tool hook failed:', error);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 2. Then, filter all tools (including plugin-injected ones) by config
|
|
100
116
|
const toolsConfig = opts.context.config.tools;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return allTools.filter((tool) => {
|
|
106
|
-
// Check if the tool is disabled (only explicitly set to false will disable)
|
|
107
|
-
const isDisabled = toolsConfig[tool.name] === false;
|
|
108
|
-
return !isDisabled;
|
|
117
|
+
if (toolsConfig && Object.keys(toolsConfig).length > 0) {
|
|
118
|
+
availableTools = availableTools.filter((tool) => {
|
|
119
|
+
// Only explicitly set to false will disable the tool
|
|
120
|
+
return toolsConfig[tool.name] !== false;
|
|
109
121
|
});
|
|
110
|
-
}
|
|
122
|
+
}
|
|
111
123
|
|
|
112
124
|
const taskTools = (() => {
|
|
113
125
|
// Task tool is only available in quiet mode
|