@ai-setting/roy-agent-core 1.5.72 → 1.5.74
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/dist/env/agent/index.js +3 -3
- package/dist/env/index.js +6 -6
- package/dist/env/llm/index.js +2 -2
- package/dist/env/plugin/index.js +1 -1
- package/dist/env/task/delegate/index.js +2 -2
- package/dist/env/task/index.js +3 -3
- package/dist/index.js +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-eq52jra7.js → roy-agent-core-0tgnq4nz.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-84vtpbw6.js → roy-agent-core-11dnsfwp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-smgpr5tz.js → roy-agent-core-h2d1s8yd.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ap59dpve.js → roy-agent-core-p7grnnzp.js} +82 -16
- package/dist/shared/@ai-setting/{roy-agent-core-3f0bkm7q.js → roy-agent-core-r0m0at3x.js} +4 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9dja7n0q.js → roy-agent-core-w6j4zyps.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-nx3c3ce2.js → roy-agent-core-zf62vkc4.js} +6 -5
- package/package.json +1 -1
package/dist/env/agent/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentComponent,
|
|
3
3
|
AgentComponentConfigSchema
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
5
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-w6j4zyps.js";
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-r0m0at3x.js";
|
|
6
6
|
import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
7
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
7
|
+
import"../../shared/@ai-setting/roy-agent-core-zf62vkc4.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
10
10
|
import {
|
package/dist/env/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import"../shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
|
|
17
17
|
import {
|
|
18
18
|
PluginComponent
|
|
19
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
19
|
+
} from "../shared/@ai-setting/roy-agent-core-p7grnnzp.js";
|
|
20
20
|
import"../shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
|
|
21
21
|
import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
22
22
|
import {
|
|
@@ -39,16 +39,16 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
39
39
|
import {
|
|
40
40
|
AgentComponent,
|
|
41
41
|
AgentComponentConfigSchema
|
|
42
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
43
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
42
|
+
} from "../shared/@ai-setting/roy-agent-core-w6j4zyps.js";
|
|
43
|
+
import"../shared/@ai-setting/roy-agent-core-r0m0at3x.js";
|
|
44
44
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
45
45
|
import {
|
|
46
46
|
TaskComponent
|
|
47
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
47
|
+
} from "../shared/@ai-setting/roy-agent-core-11dnsfwp.js";
|
|
48
48
|
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
49
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
49
|
+
import"../shared/@ai-setting/roy-agent-core-0tgnq4nz.js";
|
|
50
50
|
import"../shared/@ai-setting/roy-agent-core-r9y8ct0w.js";
|
|
51
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
51
|
+
import"../shared/@ai-setting/roy-agent-core-zf62vkc4.js";
|
|
52
52
|
import {
|
|
53
53
|
XDG_PATHS,
|
|
54
54
|
getXDGPath,
|
package/dist/env/llm/index.js
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
ProviderCapabilitiesSchema,
|
|
9
9
|
ProviderConfigSchema,
|
|
10
10
|
ProviderManager
|
|
11
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
} from "../../shared/@ai-setting/roy-agent-core-h2d1s8yd.js";
|
|
12
12
|
import {
|
|
13
13
|
createInvokeConfig,
|
|
14
14
|
invoke,
|
|
15
15
|
invokeNonStream,
|
|
16
16
|
parseModelString
|
|
17
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
} from "../../shared/@ai-setting/roy-agent-core-r0m0at3x.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-ce10b0ez.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
package/dist/env/plugin/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
BackgroundTaskManager,
|
|
4
4
|
createDelegateTool,
|
|
5
5
|
createStopTool
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-0tgnq4nz.js";
|
|
7
|
+
import"../../../shared/@ai-setting/roy-agent-core-zf62vkc4.js";
|
|
8
8
|
import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
10
10
|
import"../../../shared/@ai-setting/roy-agent-core-7tp56w6n.js";
|
package/dist/env/task/index.js
CHANGED
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
TaskPriorityEnum,
|
|
6
6
|
TaskStatusEnum,
|
|
7
7
|
TaskTypeEnum
|
|
8
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../shared/@ai-setting/roy-agent-core-11dnsfwp.js";
|
|
9
9
|
import {
|
|
10
10
|
TaskEntityEventTypes
|
|
11
11
|
} from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
12
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-0tgnq4nz.js";
|
|
13
13
|
import {
|
|
14
14
|
SQLiteTaskStore,
|
|
15
15
|
getDefaultTaskDbPath
|
|
16
16
|
} from "../../shared/@ai-setting/roy-agent-core-r9y8ct0w.js";
|
|
17
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
import"../../shared/@ai-setting/roy-agent-core-zf62vkc4.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-7t0jen73.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-t94ktchq.js";
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ModelLimitsSchema,
|
|
12
12
|
ProviderCapabilitiesSchema,
|
|
13
13
|
ProviderConfigSchema
|
|
14
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
14
|
+
} from "./shared/@ai-setting/roy-agent-core-h2d1s8yd.js";
|
|
15
15
|
import {
|
|
16
16
|
ConfigComponent
|
|
17
17
|
} from "./shared/@ai-setting/roy-agent-core-prdngx28.js";
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
} from "./shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
|
|
80
80
|
import {
|
|
81
81
|
PluginComponent
|
|
82
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
82
|
+
} from "./shared/@ai-setting/roy-agent-core-p7grnnzp.js";
|
|
83
83
|
import {
|
|
84
84
|
TaskTagPlugin,
|
|
85
85
|
createAutoTaskPlugin
|
|
@@ -116,29 +116,29 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
116
116
|
import {
|
|
117
117
|
AgentComponent,
|
|
118
118
|
AgentComponentConfigSchema
|
|
119
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
119
|
+
} from "./shared/@ai-setting/roy-agent-core-w6j4zyps.js";
|
|
120
120
|
import {
|
|
121
121
|
createInvokeConfig,
|
|
122
122
|
invoke,
|
|
123
123
|
invokeNonStream,
|
|
124
124
|
parseModelString
|
|
125
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
125
|
+
} from "./shared/@ai-setting/roy-agent-core-r0m0at3x.js";
|
|
126
126
|
import {
|
|
127
127
|
AskUserError,
|
|
128
128
|
init_workflow_hil
|
|
129
129
|
} from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
130
130
|
import {
|
|
131
131
|
TaskComponent
|
|
132
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
132
|
+
} from "./shared/@ai-setting/roy-agent-core-11dnsfwp.js";
|
|
133
133
|
import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
134
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
134
|
+
import"./shared/@ai-setting/roy-agent-core-0tgnq4nz.js";
|
|
135
135
|
import {
|
|
136
136
|
SQLiteTaskStore,
|
|
137
137
|
getDefaultTaskDbPath
|
|
138
138
|
} from "./shared/@ai-setting/roy-agent-core-r9y8ct0w.js";
|
|
139
139
|
import {
|
|
140
140
|
AgentRegistry
|
|
141
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
141
|
+
} from "./shared/@ai-setting/roy-agent-core-zf62vkc4.js";
|
|
142
142
|
import {
|
|
143
143
|
XDG_PATHS,
|
|
144
144
|
getXDGPath,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BasePlugin
|
|
3
|
+
} from "./roy-agent-core-az13yzmc.js";
|
|
1
4
|
import {
|
|
2
5
|
BaseComponent
|
|
3
6
|
} from "./roy-agent-core-rgckng3p.js";
|
|
@@ -13,6 +16,9 @@ import {
|
|
|
13
16
|
// src/env/plugin/plugin-component.ts
|
|
14
17
|
init_global_hook_manager();
|
|
15
18
|
init_logger();
|
|
19
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
import { homedir } from "node:os";
|
|
16
22
|
|
|
17
23
|
class PluginComponent extends BaseComponent {
|
|
18
24
|
name = "plugin";
|
|
@@ -32,27 +38,87 @@ class PluginComponent extends BaseComponent {
|
|
|
32
38
|
}
|
|
33
39
|
this.configComponent = options.configComponent;
|
|
34
40
|
this.setStatus("running");
|
|
41
|
+
await this.loadInstalledPlugins();
|
|
35
42
|
this.logger.info("[PluginComponent] Initialized");
|
|
36
43
|
}
|
|
37
|
-
|
|
44
|
+
async loadInstalledPlugins() {
|
|
45
|
+
const configPath = join(homedir(), ".roy-agent", "plugins.json");
|
|
46
|
+
if (!existsSync(configPath)) {
|
|
47
|
+
this.logger.debug("[PluginComponent] No plugins.json found, skipping auto-load");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let config;
|
|
51
|
+
try {
|
|
52
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
53
|
+
config = JSON.parse(raw);
|
|
54
|
+
} catch (err) {
|
|
55
|
+
this.logger.warn(`[PluginComponent] Failed to read plugins.json: ${err}`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const plugins = config.plugins ?? [];
|
|
59
|
+
if (plugins.length === 0) {
|
|
60
|
+
this.logger.debug("[PluginComponent] plugins.json is empty, skipping auto-load");
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.logger.info(`[PluginComponent] Loading ${plugins.length} installed plugin(s) from plugins.json`);
|
|
64
|
+
for (const entry of plugins) {
|
|
65
|
+
try {
|
|
66
|
+
await this.loadPluginFromPackage(entry.packageName);
|
|
67
|
+
} catch (err) {
|
|
68
|
+
this.logger.error(`[PluginComponent] Failed to load plugin '${entry.packageName}': ${err}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async loadPluginFromPackage(packageName) {
|
|
73
|
+
let pluginModule;
|
|
74
|
+
try {
|
|
75
|
+
pluginModule = await import(packageName);
|
|
76
|
+
} catch (err) {
|
|
77
|
+
this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}': ${err}`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const tryCreateInstance = (candidate, exportKind) => {
|
|
81
|
+
if (!candidate)
|
|
82
|
+
return;
|
|
83
|
+
if (candidate instanceof BasePlugin) {
|
|
84
|
+
return candidate;
|
|
85
|
+
}
|
|
86
|
+
if (typeof candidate === "function" && candidate.prototype instanceof BasePlugin) {
|
|
87
|
+
return new candidate;
|
|
88
|
+
}
|
|
89
|
+
if (typeof candidate === "object" && typeof candidate.name === "string" && typeof candidate.init === "function") {
|
|
90
|
+
this.logger.debug(`[PluginComponent] Plugin '${packageName}' ${exportKind} matches duck-type BasePlugin interface (instance)`);
|
|
91
|
+
return candidate;
|
|
92
|
+
}
|
|
93
|
+
if (typeof candidate === "function" && typeof candidate.prototype?.init === "function") {
|
|
94
|
+
this.logger.debug(`[PluginComponent] Plugin '${packageName}' ${exportKind} matches duck-type BasePlugin interface (class)`);
|
|
95
|
+
return new candidate;
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
};
|
|
99
|
+
let pluginInstance;
|
|
100
|
+
if (pluginModule.default) {
|
|
101
|
+
pluginInstance = tryCreateInstance(pluginModule.default, "default export");
|
|
102
|
+
}
|
|
103
|
+
if (!pluginInstance && pluginModule.plugin) {
|
|
104
|
+
pluginInstance = tryCreateInstance(pluginModule.plugin, "named export 'plugin'");
|
|
105
|
+
}
|
|
106
|
+
if (!pluginInstance) {
|
|
107
|
+
this.logger.warn(`[PluginComponent] Plugin '${packageName}' does not export a valid plugin instance (expected default export or named export 'plugin' with { name, init, dispose? })`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
await this.register(pluginInstance);
|
|
111
|
+
this.logger.info(`[PluginComponent] Loaded plugin: ${pluginInstance.name} (from ${packageName})`);
|
|
112
|
+
}
|
|
113
|
+
async register(plugin) {
|
|
38
114
|
if (this.registry.has(plugin.name)) {
|
|
39
115
|
throw new Error(`Plugin "${plugin.name}" is already registered`);
|
|
40
116
|
}
|
|
41
117
|
const env = this.createPluginEnv(plugin);
|
|
42
118
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.registry.set(plugin.name, plugin);
|
|
47
|
-
this.logger.info(`Registered plugin: ${plugin.name}`);
|
|
48
|
-
}).catch((err) => {
|
|
49
|
-
this.logger.error(`Failed to init plugin ${plugin.name}: ${err}`);
|
|
50
|
-
throw err;
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
this.registry.set(plugin.name, plugin);
|
|
54
|
-
this.logger.info(`Registered plugin: ${plugin.name}`);
|
|
55
|
-
}
|
|
119
|
+
await plugin.init(env);
|
|
120
|
+
this.registry.set(plugin.name, plugin);
|
|
121
|
+
this.logger.info(`Registered plugin: ${plugin.name}`);
|
|
56
122
|
} catch (err) {
|
|
57
123
|
this.logger.error(`Failed to init plugin ${plugin.name}: ${err}`);
|
|
58
124
|
throw err;
|
|
@@ -84,9 +150,9 @@ class PluginComponent extends BaseComponent {
|
|
|
84
150
|
getConfig(name) {
|
|
85
151
|
return this.configComponent?.get(`plugin.${name}`);
|
|
86
152
|
}
|
|
87
|
-
registerAll(plugins) {
|
|
153
|
+
async registerAll(plugins) {
|
|
88
154
|
for (const plugin of plugins) {
|
|
89
|
-
this.register(plugin);
|
|
155
|
+
await this.register(plugin);
|
|
90
156
|
}
|
|
91
157
|
}
|
|
92
158
|
async stop() {
|
|
@@ -212,7 +212,10 @@ function convertToolChoice(toolChoice) {
|
|
|
212
212
|
return;
|
|
213
213
|
if (typeof toolChoice === "string")
|
|
214
214
|
return toolChoice;
|
|
215
|
-
|
|
215
|
+
const toolName = toolChoice.function?.name?.trim();
|
|
216
|
+
if (!toolName)
|
|
217
|
+
return;
|
|
218
|
+
return { type: "tool", toolName };
|
|
216
219
|
}
|
|
217
220
|
function createEnvEventEmitter(env, context) {
|
|
218
221
|
if (!env) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withTimeout
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-r0m0at3x.js";
|
|
4
4
|
import {
|
|
5
5
|
AskUserError,
|
|
6
6
|
init_workflow_hil
|
|
7
7
|
} from "./roy-agent-core-e25xkv53.js";
|
|
8
8
|
import {
|
|
9
9
|
AgentRegistry
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-zf62vkc4.js";
|
|
11
11
|
import {
|
|
12
12
|
ContextError
|
|
13
13
|
} from "./roy-agent-core-ctdhjv68.js";
|
|
@@ -109,17 +109,18 @@ class AgentRegistry {
|
|
|
109
109
|
const promptComponent = this.getActivePromptComponent();
|
|
110
110
|
if (agent.systemPromptRef) {
|
|
111
111
|
try {
|
|
112
|
-
const prompt = promptComponent?.get?.(agent.systemPromptRef);
|
|
113
|
-
if (prompt) {
|
|
114
|
-
logger.debug(`[AgentRegistry] Resolved systemPromptRef: ${agent.systemPromptRef}`);
|
|
115
|
-
return prompt;
|
|
116
|
-
}
|
|
117
112
|
if (promptComponent?.getPrompt) {
|
|
118
113
|
const rendered = await promptComponent.getPrompt(agent.systemPromptRef);
|
|
119
114
|
if (rendered) {
|
|
115
|
+
logger.debug(`[AgentRegistry] Resolved systemPromptRef via getPrompt: ${agent.systemPromptRef}`);
|
|
120
116
|
return rendered;
|
|
121
117
|
}
|
|
122
118
|
}
|
|
119
|
+
const prompt = promptComponent?.get?.(agent.systemPromptRef);
|
|
120
|
+
if (prompt) {
|
|
121
|
+
logger.debug(`[AgentRegistry] Resolved systemPromptRef via get: ${agent.systemPromptRef}`);
|
|
122
|
+
return prompt;
|
|
123
|
+
}
|
|
123
124
|
if (agent.systemPrompt) {
|
|
124
125
|
logger.debug(`[AgentRegistry] systemPromptRef not found, falling back to inline`);
|
|
125
126
|
return agent.systemPrompt;
|