oricore 1.3.2 → 1.3.4

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.
@@ -11,6 +11,7 @@ type ResolveToolsOpts = {
11
11
  askUserQuestion?: boolean;
12
12
  signal?: AbortSignal;
13
13
  task?: boolean;
14
+ isPlan?: boolean;
14
15
  };
15
16
  export declare function resolveTools(opts: ResolveToolsOpts): Promise<any[]>;
16
17
  export declare class Tools {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oricore",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "OriCore - A powerful AI engine with multi-modal support, tool calling, and extensible architecture",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -71,15 +71,16 @@
71
71
  "glob": "^13.0.0",
72
72
  "gpt-tokenizer": "^3.4.0",
73
73
  "jiti": "^2.6.1",
74
+ "jsonrepair": "^3.10.0",
74
75
  "oauth-providers": "^1.0.2",
75
76
  "pathe": "^2.0.3",
77
+ "pdf-parse": "^2.4.5",
76
78
  "resolve": "^1.22.11",
77
79
  "spawn-rx": "^5.1.2",
78
80
  "tar": "^7.5.2",
79
81
  "turndown": "^7.2.2",
80
82
  "ws": "^8.18.3",
81
- "zod": "^4.1.13",
82
- "jsonrepair": "^3.10.0"
83
+ "zod": "^4.1.13"
83
84
  },
84
85
  "devDependencies": {
85
86
  "@eslint/js": "^9.39.2",
@@ -60,7 +60,7 @@ export interface AddSkillResult {
60
60
  }
61
61
 
62
62
  const MAX_NAME_LENGTH = 64;
63
- const MAX_DESCRIPTION_LENGTH = 1024;
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
- const availableTools = (() => {
102
- if (!toolsConfig || Object.keys(toolsConfig).length === 0) {
103
- return allTools;
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