@ai-setting/roy-agent-core 1.5.4 → 1.5.6
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/config/index.d.ts +1250 -0
- package/dist/env/agent/index.d.ts +2279 -0
- package/dist/env/agent/index.js +7 -7
- package/dist/env/commands/index.d.ts +1131 -0
- package/dist/env/commands/index.js +4 -4
- package/dist/env/debug/formatters/index.d.ts +236 -0
- package/dist/env/debug/index.d.ts +1652 -0
- package/dist/env/debug/index.js +1 -1
- package/dist/env/hook/index.d.ts +279 -0
- package/dist/env/index.d.ts +3460 -0
- package/dist/env/index.js +18 -18
- package/dist/env/llm/index.d.ts +1760 -0
- package/dist/env/llm/index.js +5 -5
- package/dist/env/log-trace/index.d.ts +1574 -0
- package/dist/env/log-trace/index.js +5 -5
- package/dist/env/mcp/index.d.ts +1331 -0
- package/dist/env/mcp/index.js +5 -5
- package/dist/env/mcp/tool/index.d.ts +183 -0
- package/dist/env/mcp/tool/index.js +4 -4
- package/dist/env/memory/built-in/index.d.ts +232 -0
- package/dist/env/memory/index.d.ts +1799 -0
- package/dist/env/memory/index.js +5 -5
- package/dist/env/memory/plugin/index.d.ts +747 -0
- package/dist/env/memory/plugin/index.js +4 -4
- package/dist/env/prompt/index.d.ts +1164 -0
- package/dist/env/prompt/index.js +4 -4
- package/dist/env/session/index.d.ts +1908 -0
- package/dist/env/session/index.js +8 -8
- package/dist/env/session/storage/index.d.ts +564 -0
- package/dist/env/session/storage/index.js +6 -6
- package/dist/env/skill/index.d.ts +1266 -0
- package/dist/env/skill/index.js +4 -4
- package/dist/env/skill/tool/index.d.ts +193 -0
- package/dist/env/task/delegate/index.d.ts +1622 -0
- package/dist/env/task/delegate/index.js +4 -4
- package/dist/env/task/hooks/index.d.ts +607 -0
- package/dist/env/task/index.d.ts +1415 -0
- package/dist/env/task/index.js +6 -6
- package/dist/env/task/plugins/index.d.ts +462 -0
- package/dist/env/task/plugins/index.js +4 -4
- package/dist/env/task/storage/index.d.ts +224 -0
- package/dist/env/task/storage/index.js +4 -4
- package/dist/env/task/tools/index.d.ts +1464 -0
- package/dist/env/task/tools/operation/index.d.ts +1463 -0
- package/dist/env/tool/built-in/index.d.ts +218 -0
- package/dist/env/tool/built-in/index.js +3 -3
- package/dist/env/tool/index.d.ts +1396 -0
- package/dist/env/tool/index.js +5 -5
- package/dist/env/workflow/decorators/index.d.ts +2161 -0
- package/dist/env/workflow/engine/index.d.ts +3453 -0
- package/dist/env/workflow/engine/index.js +8 -8
- package/dist/env/workflow/index.d.ts +3546 -0
- package/dist/env/workflow/index.js +13 -9
- package/dist/env/workflow/nodes/index.d.ts +2092 -0
- package/dist/env/workflow/nodes/index.js +1 -1
- package/dist/env/workflow/service/index.d.ts +227 -0
- package/dist/env/workflow/storage/index.d.ts +165 -0
- package/dist/env/workflow/storage/index.js +5 -5
- package/dist/env/workflow/tools/index.d.ts +416 -0
- package/dist/env/workflow/tools/index.js +3 -3
- package/dist/env/workflow/types/index.d.ts +2255 -0
- package/dist/env/workflow/types/index.js +5 -1
- package/dist/env/workflow/utils/index.d.ts +2031 -0
- package/dist/env/workflow/utils/index.js +4 -4
- package/dist/index.d.ts +7837 -0
- package/dist/index.js +31 -31
- package/dist/shared/@ai-setting/{roy-agent-core-6a72jfdy.js → roy-agent-core-1akcqxj9.js} +50 -4
- package/dist/shared/@ai-setting/{roy-agent-core-12zkpda2.js → roy-agent-core-3jywqmdd.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-7n436rb4.js → roy-agent-core-3rr5k71j.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zfbxb999.js → roy-agent-core-3xwneva0.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-j3wc4465.js → roy-agent-core-44hnfb02.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-cv890rg5.js → roy-agent-core-4txzpsbt.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-rzp9kxne.js → roy-agent-core-5x94xmt6.js} +14 -5
- package/dist/shared/@ai-setting/{roy-agent-core-pc9g3962.js → roy-agent-core-69jskqjg.js} +41 -66
- package/dist/shared/@ai-setting/{roy-agent-core-qya7seh6.js → roy-agent-core-6kvtahqv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-kv5nkf8j.js → roy-agent-core-81w1963m.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-zqjdy75r.js → roy-agent-core-93zfb3r1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-fsvb6bwe.js → roy-agent-core-b0x5dda6.js} +5 -5
- package/dist/shared/@ai-setting/roy-agent-core-bcbqy27c.js +14 -0
- package/dist/shared/@ai-setting/{roy-agent-core-2x0m2p66.js → roy-agent-core-d7cyjkf7.js} +24 -3
- package/dist/shared/@ai-setting/{roy-agent-core-r973kbm7.js → roy-agent-core-dc497hmk.js} +9 -8
- package/dist/shared/@ai-setting/{roy-agent-core-z2t8hse8.js → roy-agent-core-dh9d7a3m.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-j3bbr2n0.js → roy-agent-core-eajcvp4e.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-m61m1vqf.js → roy-agent-core-f7q2x5z6.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-8a96qnjv.js → roy-agent-core-g99pxzn5.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-5v9bh6wz.js → roy-agent-core-gbqcyegm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-qw0ebh1d.js → roy-agent-core-gq20wsgv.js} +49 -17
- package/dist/shared/@ai-setting/{roy-agent-core-2kg2wma8.js → roy-agent-core-htwpckw9.js} +24 -3
- package/dist/shared/@ai-setting/{roy-agent-core-e62e2a5a.js → roy-agent-core-jfh9q2qh.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-3agad0d9.js → roy-agent-core-jvatggbb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-j8q93v21.js → roy-agent-core-n2cvdgd6.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-nga1gqft.js → roy-agent-core-pjr12nnd.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-bncgx3gb.js → roy-agent-core-psv4v63c.js} +24 -2
- package/dist/shared/@ai-setting/{roy-agent-core-p4xv133t.js → roy-agent-core-qqceba6k.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-e5jcp24a.js → roy-agent-core-r9ezzemr.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ewrj1c4k.js → roy-agent-core-satmq6sh.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7f303ffd.js → roy-agent-core-sx7wsvnn.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-q779wnwm.js → roy-agent-core-wft9ra24.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-fdb6m4e4.js → roy-agent-core-wrcy0h6z.js} +134 -182
- package/dist/shared/@ai-setting/{roy-agent-core-8y8tw6ns.js → roy-agent-core-xq8hhqb8.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-fv32jaa8.js → roy-agent-core-xs5rsgat.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-t2nc5acr.js → roy-agent-core-z62zee1e.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-72zpazpc.js → roy-agent-core-zbkpc41z.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-35x0wrtt.js → roy-agent-core-zgypchmt.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-37e4tep3.js → roy-agent-core-zpn0bqa8.js} +24 -3
- package/package.json +5 -2
- package/dist/shared/@ai-setting/roy-agent-core-rft3fmp0.js +0 -14
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LogTraceComponent,
|
|
3
3
|
LogTraceConfigSchema
|
|
4
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "./shared/@ai-setting/roy-agent-core-xq8hhqb8.js";
|
|
5
5
|
import {
|
|
6
6
|
ToolComponent,
|
|
7
7
|
ToolRegistry,
|
|
8
8
|
ToolValidator
|
|
9
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
9
|
+
} from "./shared/@ai-setting/roy-agent-core-qqceba6k.js";
|
|
10
10
|
import {
|
|
11
11
|
bashTool,
|
|
12
12
|
editFileTool,
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
grepTool,
|
|
17
17
|
readFileTool,
|
|
18
18
|
writeFileTool
|
|
19
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
19
|
+
} from "./shared/@ai-setting/roy-agent-core-satmq6sh.js";
|
|
20
20
|
import {
|
|
21
21
|
PromptComponent,
|
|
22
22
|
getBuiltInPrompt,
|
|
23
23
|
getBuiltInPromptNames
|
|
24
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
24
|
+
} from "./shared/@ai-setting/roy-agent-core-93zfb3r1.js";
|
|
25
25
|
import {
|
|
26
26
|
LLMComponent,
|
|
27
27
|
LLMConfigSchema,
|
|
@@ -33,28 +33,28 @@ import {
|
|
|
33
33
|
invoke,
|
|
34
34
|
invokeNonStream,
|
|
35
35
|
parseModelString
|
|
36
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
36
|
+
} from "./shared/@ai-setting/roy-agent-core-3xwneva0.js";
|
|
37
37
|
import {
|
|
38
38
|
ConfigComponent
|
|
39
39
|
} from "./shared/@ai-setting/roy-agent-core-vn2bc59q.js";
|
|
40
40
|
import {
|
|
41
41
|
MemoryComponent
|
|
42
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
42
|
+
} from "./shared/@ai-setting/roy-agent-core-4txzpsbt.js";
|
|
43
43
|
import"./shared/@ai-setting/roy-agent-core-g1s2h0e5.js";
|
|
44
44
|
import {
|
|
45
45
|
MemoryPlugin,
|
|
46
46
|
createMemoryPlugin
|
|
47
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
47
|
+
} from "./shared/@ai-setting/roy-agent-core-6kvtahqv.js";
|
|
48
48
|
import {
|
|
49
49
|
CommandsComponent
|
|
50
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
50
|
+
} from "./shared/@ai-setting/roy-agent-core-f7q2x5z6.js";
|
|
51
51
|
import {
|
|
52
52
|
TaskPlugin,
|
|
53
53
|
TaskTagPlugin
|
|
54
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
54
|
+
} from "./shared/@ai-setting/roy-agent-core-3jywqmdd.js";
|
|
55
55
|
import {
|
|
56
56
|
DebugComponent
|
|
57
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
57
|
+
} from "./shared/@ai-setting/roy-agent-core-g99pxzn5.js";
|
|
58
58
|
import {
|
|
59
59
|
ReplFormatter,
|
|
60
60
|
TraceFormatter,
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
EventSourceComponent,
|
|
67
67
|
generateDescendingId,
|
|
68
68
|
generateId
|
|
69
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
69
|
+
} from "./shared/@ai-setting/roy-agent-core-gbqcyegm.js";
|
|
70
70
|
import {
|
|
71
71
|
XDG_PATHS,
|
|
72
72
|
getXDGPath,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
} from "./shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
75
75
|
import {
|
|
76
76
|
WorkflowComponent
|
|
77
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
77
|
+
} from "./shared/@ai-setting/roy-agent-core-dc497hmk.js";
|
|
78
78
|
import {
|
|
79
79
|
init_node_registry_helper,
|
|
80
80
|
registerDecoratorNodeType
|
|
@@ -89,35 +89,35 @@ import {
|
|
|
89
89
|
createWorkflowFromClass
|
|
90
90
|
} from "./shared/@ai-setting/roy-agent-core-7fgf85wc.js";
|
|
91
91
|
import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
92
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
93
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
94
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
95
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
92
|
+
import"./shared/@ai-setting/roy-agent-core-wrcy0h6z.js";
|
|
93
|
+
import"./shared/@ai-setting/roy-agent-core-69jskqjg.js";
|
|
94
|
+
import"./shared/@ai-setting/roy-agent-core-jvatggbb.js";
|
|
95
|
+
import"./shared/@ai-setting/roy-agent-core-5x94xmt6.js";
|
|
96
96
|
import {
|
|
97
97
|
AgentComponent,
|
|
98
98
|
AgentComponentConfigSchema
|
|
99
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
99
|
+
} from "./shared/@ai-setting/roy-agent-core-b0x5dda6.js";
|
|
100
100
|
import {
|
|
101
101
|
AskUserError,
|
|
102
102
|
init_workflow_hil
|
|
103
103
|
} from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
104
104
|
import {
|
|
105
105
|
TaskComponent
|
|
106
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
107
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
106
|
+
} from "./shared/@ai-setting/roy-agent-core-n2cvdgd6.js";
|
|
107
|
+
import"./shared/@ai-setting/roy-agent-core-htwpckw9.js";
|
|
108
108
|
import"./shared/@ai-setting/roy-agent-core-dbsk841j.js";
|
|
109
109
|
import"./shared/@ai-setting/roy-agent-core-t94ktchq.js";
|
|
110
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
110
|
+
import"./shared/@ai-setting/roy-agent-core-z62zee1e.js";
|
|
111
111
|
import {
|
|
112
112
|
TaskHookPoints
|
|
113
113
|
} from "./shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
114
114
|
import {
|
|
115
115
|
SkillComponent
|
|
116
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
116
|
+
} from "./shared/@ai-setting/roy-agent-core-zbkpc41z.js";
|
|
117
117
|
import"./shared/@ai-setting/roy-agent-core-psvxt4c9.js";
|
|
118
118
|
import {
|
|
119
119
|
McpComponent
|
|
120
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
120
|
+
} from "./shared/@ai-setting/roy-agent-core-pjr12nnd.js";
|
|
121
121
|
import {
|
|
122
122
|
AgentError,
|
|
123
123
|
ComponentError,
|
|
@@ -129,12 +129,12 @@ import {
|
|
|
129
129
|
getErrorCode,
|
|
130
130
|
isRoyError
|
|
131
131
|
} from "./shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
132
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
132
|
+
import"./shared/@ai-setting/roy-agent-core-1akcqxj9.js";
|
|
133
133
|
import {
|
|
134
134
|
SessionComponent
|
|
135
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
135
|
+
} from "./shared/@ai-setting/roy-agent-core-81w1963m.js";
|
|
136
136
|
import"./shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
137
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
137
|
+
import"./shared/@ai-setting/roy-agent-core-eajcvp4e.js";
|
|
138
138
|
import"./shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
139
139
|
import {
|
|
140
140
|
BaseComponent
|
|
@@ -149,14 +149,14 @@ import {
|
|
|
149
149
|
} from "./shared/@ai-setting/roy-agent-core-gjq1yk68.js";
|
|
150
150
|
import {
|
|
151
151
|
MemorySessionStore
|
|
152
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
153
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
152
|
+
} from "./shared/@ai-setting/roy-agent-core-d7cyjkf7.js";
|
|
153
|
+
import"./shared/@ai-setting/roy-agent-core-jfh9q2qh.js";
|
|
154
154
|
import {
|
|
155
155
|
Traced,
|
|
156
156
|
TracedAs,
|
|
157
157
|
TracedLightweight,
|
|
158
158
|
wrapFunction
|
|
159
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
159
|
+
} from "./shared/@ai-setting/roy-agent-core-zgypchmt.js";
|
|
160
160
|
import {
|
|
161
161
|
createLogger,
|
|
162
162
|
getLogDir,
|
|
@@ -166,7 +166,7 @@ import {
|
|
|
166
166
|
setConfigComponent,
|
|
167
167
|
setLogDirOverride,
|
|
168
168
|
setQuietMode
|
|
169
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
169
|
+
} from "./shared/@ai-setting/roy-agent-core-44hnfb02.js";
|
|
170
170
|
import {
|
|
171
171
|
OTelTracerProvider,
|
|
172
172
|
SpanKind,
|
|
@@ -174,10 +174,10 @@ import {
|
|
|
174
174
|
getTracerProvider,
|
|
175
175
|
propagation,
|
|
176
176
|
resetTracerProvider
|
|
177
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
177
|
+
} from "./shared/@ai-setting/roy-agent-core-xs5rsgat.js";
|
|
178
178
|
import {
|
|
179
179
|
SQLiteSpanStorage
|
|
180
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
180
|
+
} from "./shared/@ai-setting/roy-agent-core-psv4v63c.js";
|
|
181
181
|
import"./shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
182
182
|
// src/env/memory/tools/memory-agent-tools.ts
|
|
183
183
|
import { z } from "zod";
|
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger,
|
|
3
3
|
init_logger
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-44hnfb02.js";
|
|
5
5
|
|
|
6
6
|
// src/env/mcp/tool/adapter.ts
|
|
7
7
|
init_logger();
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
var logger = createLogger("mcp-adapter");
|
|
10
|
+
function validateRequiredParams(inputSchema, args) {
|
|
11
|
+
if (!inputSchema) {
|
|
12
|
+
return { valid: true, missing: [] };
|
|
13
|
+
}
|
|
14
|
+
const schema = inputSchema;
|
|
15
|
+
const required = schema.required ?? [];
|
|
16
|
+
if (required.length === 0) {
|
|
17
|
+
return { valid: true, missing: [] };
|
|
18
|
+
}
|
|
19
|
+
const missing = [];
|
|
20
|
+
for (const param of required) {
|
|
21
|
+
const value = args[param];
|
|
22
|
+
if (value === undefined || value === null) {
|
|
23
|
+
missing.push(param);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (missing.length > 0) {
|
|
27
|
+
return {
|
|
28
|
+
valid: false,
|
|
29
|
+
missing,
|
|
30
|
+
error: `Missing required parameter${missing.length > 1 ? "s" : ""}: ${missing.join(", ")}`
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return { valid: true, missing: [] };
|
|
34
|
+
}
|
|
10
35
|
function adaptMcpTool(mcpTool, mcpClient, serverName) {
|
|
11
36
|
const toolName = `mcp_${serverName}_${mcpTool.name}`;
|
|
12
37
|
const description = `MCP tool [${serverName}/${mcpTool.name}]: ${mcpTool.description ?? ""}`;
|
|
@@ -16,20 +41,41 @@ function adaptMcpTool(mcpTool, mcpClient, serverName) {
|
|
|
16
41
|
description,
|
|
17
42
|
parameters: paramsSchema,
|
|
18
43
|
execute: async (args, _ctx) => {
|
|
44
|
+
const toolArgs = args ?? {};
|
|
45
|
+
const validation = validateRequiredParams(mcpTool.inputSchema, toolArgs);
|
|
46
|
+
if (!validation.valid) {
|
|
47
|
+
logger.warn(`[McpAdapter] Tool call skipped: ${toolName}`, {
|
|
48
|
+
reason: "missing_required_params",
|
|
49
|
+
missing: validation.missing
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
output: "",
|
|
54
|
+
error: validation.error
|
|
55
|
+
};
|
|
56
|
+
}
|
|
19
57
|
try {
|
|
20
58
|
const result = await mcpClient.callTool({
|
|
21
59
|
name: mcpTool.name,
|
|
22
|
-
arguments:
|
|
60
|
+
arguments: toolArgs
|
|
23
61
|
});
|
|
24
62
|
return convertMcpCallResult(result);
|
|
25
63
|
} catch (error) {
|
|
64
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
65
|
+
const errorCode = error?.code;
|
|
26
66
|
logger.error(`[McpAdapter] Tool call failed: ${toolName}`, {
|
|
27
|
-
error:
|
|
67
|
+
error: errorMessage,
|
|
68
|
+
errorCode,
|
|
69
|
+
receivedArgs: toolArgs
|
|
28
70
|
});
|
|
71
|
+
let userMessage = errorMessage;
|
|
72
|
+
if (errorCode === -32602) {
|
|
73
|
+
userMessage = `Invalid parameters for tool "${mcpTool.name}": ${errorMessage}`;
|
|
74
|
+
}
|
|
29
75
|
return {
|
|
30
76
|
success: false,
|
|
31
77
|
output: "",
|
|
32
|
-
error:
|
|
78
|
+
error: userMessage
|
|
33
79
|
};
|
|
34
80
|
}
|
|
35
81
|
},
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createLogger,
|
|
6
6
|
init_logger
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-44hnfb02.js";
|
|
8
8
|
import {
|
|
9
9
|
__require
|
|
10
10
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -367,11 +367,11 @@ ${prompt}`;
|
|
|
367
367
|
}
|
|
368
368
|
if (!this._workflowRepo) {
|
|
369
369
|
try {
|
|
370
|
-
const sqlite = await import("./roy-agent-core-
|
|
370
|
+
const sqlite = await import("./roy-agent-core-wft9ra24.js");
|
|
371
371
|
this.ensureDataDir();
|
|
372
372
|
const db = sqlite.getDatabase();
|
|
373
373
|
sqlite.initializeTables();
|
|
374
|
-
const { WorkflowRepository } = await import("./roy-agent-core-
|
|
374
|
+
const { WorkflowRepository } = await import("./roy-agent-core-bcbqy27c.js");
|
|
375
375
|
this._workflowRepo = new WorkflowRepository(db);
|
|
376
376
|
return this._workflowRepo;
|
|
377
377
|
} catch {
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
TracedAs,
|
|
18
18
|
init_decorator
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-zgypchmt.js";
|
|
20
20
|
import {
|
|
21
21
|
createLogger,
|
|
22
22
|
init_logger
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-44hnfb02.js";
|
|
24
24
|
import {
|
|
25
25
|
__legacyDecorateClassTS,
|
|
26
26
|
__require
|
|
@@ -57,7 +57,7 @@ function parseWorkflowFileSync(content, filename) {
|
|
|
57
57
|
definition
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
var DependsOnSchema, RetryConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, yamlParser = null;
|
|
60
|
+
var DependsOnSchema, RetryConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, InputParameterSchema, WorkflowInputsSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, yamlParser = null;
|
|
61
61
|
var init_workflow = __esm(() => {
|
|
62
62
|
DependsOnSchema = z.array(z.string());
|
|
63
63
|
RetryConfigSchema = z.object({
|
|
@@ -86,6 +86,13 @@ var init_workflow = __esm(() => {
|
|
|
86
86
|
source: z.string(),
|
|
87
87
|
path: z.string()
|
|
88
88
|
});
|
|
89
|
+
InputParameterSchema = z.object({
|
|
90
|
+
type: z.enum(["string", "number", "boolean", "object", "array"]),
|
|
91
|
+
description: z.string().optional(),
|
|
92
|
+
default: z.unknown().optional(),
|
|
93
|
+
required: z.boolean().default(false)
|
|
94
|
+
});
|
|
95
|
+
WorkflowInputsSchema = z.record(z.string(), InputParameterSchema);
|
|
89
96
|
WorkflowMetadataSchema = z.object({
|
|
90
97
|
author: z.string().optional(),
|
|
91
98
|
taskId: z.number().optional(),
|
|
@@ -101,6 +108,7 @@ var init_workflow = __esm(() => {
|
|
|
101
108
|
nodes: z.array(NodeDefinitionSchema).min(1, "At least one node is required"),
|
|
102
109
|
entry: z.union([z.string(), z.array(z.string())]).default("__default_entry__"),
|
|
103
110
|
outputs: z.array(OutputDefinitionSchema).optional().default([]),
|
|
111
|
+
inputs: WorkflowInputsSchema.optional().default({}),
|
|
104
112
|
metadata: WorkflowMetadataSchema.optional().default({})
|
|
105
113
|
});
|
|
106
114
|
});
|
|
@@ -111,9 +119,9 @@ var WorkflowMessageRoleSchema;
|
|
|
111
119
|
var init_workflow_message = __esm(() => {
|
|
112
120
|
init_workflow_hil();
|
|
113
121
|
WorkflowMessageRoleSchema = z2.enum([
|
|
114
|
-
"workflow.node.
|
|
122
|
+
"workflow.node.start",
|
|
115
123
|
"workflow.node.interrupt",
|
|
116
|
-
"workflow.node.
|
|
124
|
+
"workflow.node.end",
|
|
117
125
|
"workflow.node.resume"
|
|
118
126
|
]);
|
|
119
127
|
});
|
|
@@ -203,8 +211,9 @@ var init_event = __esm(() => {
|
|
|
203
211
|
NodeStartedEventSchema = BaseEventSchema.extend({
|
|
204
212
|
type: z3.literal("node.started"),
|
|
205
213
|
node_id: z3.string(),
|
|
206
|
-
input: z3.any(),
|
|
214
|
+
input: z3.any().optional(),
|
|
207
215
|
agentSessionId: z3.string().optional(),
|
|
216
|
+
userQuery: z3.string().optional(),
|
|
208
217
|
userResponse: z3.string().optional()
|
|
209
218
|
});
|
|
210
219
|
NodeProgressEventSchema = BaseEventSchema.extend({
|
|
@@ -338,4 +347,4 @@ var init_types = __esm(() => {
|
|
|
338
347
|
init_run();
|
|
339
348
|
});
|
|
340
349
|
|
|
341
|
-
export { BaseEventSchema, WorkflowStartedEventSchema, WorkflowPausedEventSchema, WorkflowResumedEventSchema, WorkflowStoppedEventSchema, WorkflowCompletedEventSchema, WorkflowFailedEventSchema, WorkflowOutputEventSchema, NodeScheduledEventSchema, NodeStartedEventSchema, NodeProgressEventSchema, NodeCompletedEventSchema, NodeFailedEventSchema, NodeSkippedEventSchema, NodeDataEventSchema, NodeAddedEventSchema, NodeRemovedEventSchema, ControlPauseEventSchema, ControlResumeEventSchema, ControlStopEventSchema, NodeInterruptEventSchema, WorkflowAskUserEventSchema, WorkflowEventSchema, createWorkflowEvent, init_event, DependsOnSchema, RetryConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, parseWorkflowFile, parseWorkflowFileSync, WorkflowMessageRoleSchema, isWorkflowSessionMetadata, getWorkflowSessionStatus, RunStatusSchema, NodeStatusSchema, createNodeExecutionContext, init_types };
|
|
350
|
+
export { BaseEventSchema, WorkflowStartedEventSchema, WorkflowPausedEventSchema, WorkflowResumedEventSchema, WorkflowStoppedEventSchema, WorkflowCompletedEventSchema, WorkflowFailedEventSchema, WorkflowOutputEventSchema, NodeScheduledEventSchema, NodeStartedEventSchema, NodeProgressEventSchema, NodeCompletedEventSchema, NodeFailedEventSchema, NodeSkippedEventSchema, NodeDataEventSchema, NodeAddedEventSchema, NodeRemovedEventSchema, ControlPauseEventSchema, ControlResumeEventSchema, ControlStopEventSchema, NodeInterruptEventSchema, WorkflowAskUserEventSchema, WorkflowEventSchema, createWorkflowEvent, init_event, DependsOnSchema, RetryConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, InputParameterSchema, WorkflowInputsSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, parseWorkflowFile, parseWorkflowFileSync, WorkflowMessageRoleSchema, isWorkflowSessionMetadata, getWorkflowSessionStatus, RunStatusSchema, NodeStatusSchema, createNodeExecutionContext, init_types };
|
|
@@ -46,55 +46,42 @@ class AgentComponentAdapter {
|
|
|
46
46
|
const nodeId = config.nodeId || "unknown";
|
|
47
47
|
const runId = config.runId || "unknown";
|
|
48
48
|
const workflowSessionId = config.workflowSessionId;
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
metadata: {
|
|
61
|
-
type: "user_intent",
|
|
62
|
-
intent: "workflow.resume",
|
|
63
|
-
workflowNodeId: nodeId
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.warn(`Failed to add user response to agent session ${agentSessionId}:`, error);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
if (this._sessionComponent) {
|
|
72
|
-
agentSessionId = `${this.agentSessionPrefix}_${runId}_${nodeId}_${Date.now()}`;
|
|
73
|
-
try {
|
|
74
|
-
await this._sessionComponent.create({
|
|
75
|
-
title: `Agent Session: ${config.type} (${agentSessionId})`,
|
|
76
|
-
metadata: {
|
|
77
|
-
type: "agent",
|
|
78
|
-
workflowRunId: runId,
|
|
79
|
-
workflowNodeId: nodeId
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
this._currentAgentSessionId = agentSessionId;
|
|
83
|
-
if (workflowSessionId) {
|
|
84
|
-
const mapping = this.runSessionToAgentSessions.get(workflowSessionId) || [];
|
|
85
|
-
mapping.push(agentSessionId);
|
|
86
|
-
this.runSessionToAgentSessions.set(workflowSessionId, mapping);
|
|
49
|
+
const isResume = !!resumeOptions?.userQuery;
|
|
50
|
+
let agentSessionId = resumeOptions?.agentSessionId || config.agentSessionId || this._currentAgentSessionId;
|
|
51
|
+
if (!agentSessionId && this._sessionComponent) {
|
|
52
|
+
agentSessionId = `${this.agentSessionPrefix}_${runId}_${nodeId}_${Date.now()}`;
|
|
53
|
+
try {
|
|
54
|
+
await this._sessionComponent.create({
|
|
55
|
+
title: `Agent Session: ${config.type} (${agentSessionId})`,
|
|
56
|
+
metadata: {
|
|
57
|
+
type: "agent",
|
|
58
|
+
workflowRunId: runId,
|
|
59
|
+
workflowNodeId: nodeId
|
|
87
60
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
61
|
+
});
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.warn(`Failed to create agent session ${agentSessionId}:`, error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (agentSessionId) {
|
|
67
|
+
this._currentAgentSessionId = agentSessionId;
|
|
68
|
+
if (workflowSessionId && this._sessionComponent) {
|
|
69
|
+
const mapping = this.runSessionToAgentSessions.get(workflowSessionId) || [];
|
|
70
|
+
if (!mapping.includes(agentSessionId)) {
|
|
71
|
+
mapping.push(agentSessionId);
|
|
72
|
+
this.runSessionToAgentSessions.set(workflowSessionId, mapping);
|
|
96
73
|
}
|
|
97
74
|
}
|
|
75
|
+
if (isResume) {
|
|
76
|
+
this.pendingSessions.delete(agentSessionId);
|
|
77
|
+
} else {
|
|
78
|
+
this.pendingSessions.set(agentSessionId, {
|
|
79
|
+
agentSessionId,
|
|
80
|
+
nodeId,
|
|
81
|
+
runId,
|
|
82
|
+
createdAt: Date.now()
|
|
83
|
+
});
|
|
84
|
+
}
|
|
98
85
|
}
|
|
99
86
|
try {
|
|
100
87
|
const context = {};
|
|
@@ -113,7 +100,9 @@ class AgentComponentAdapter {
|
|
|
113
100
|
if (config.workflowHistory) {
|
|
114
101
|
context.workflowHistory = config.workflowHistory;
|
|
115
102
|
}
|
|
116
|
-
|
|
103
|
+
context.additionInfo = config.prompt;
|
|
104
|
+
const userInput = resumeOptions?.userQuery || "";
|
|
105
|
+
const result = await this.agentComponent.run(config.type || "general", userInput, context);
|
|
117
106
|
if (result.error?.startsWith("__ASK_USER_ERROR__:")) {
|
|
118
107
|
const jsonStr = result.error.substring("__ASK_USER_ERROR__:".length);
|
|
119
108
|
const errorInfo = JSON.parse(jsonStr);
|
|
@@ -153,30 +142,16 @@ class AgentComponentAdapter {
|
|
|
153
142
|
}
|
|
154
143
|
};
|
|
155
144
|
} finally {
|
|
156
|
-
if (
|
|
145
|
+
if (isResume) {
|
|
157
146
|
this._currentAgentSessionId = undefined;
|
|
158
147
|
}
|
|
159
148
|
}
|
|
160
149
|
}
|
|
161
|
-
async resumeAgent(agentSessionId,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
await this._sessionComponent.addMessage(agentSessionId, {
|
|
165
|
-
role: "user",
|
|
166
|
-
content: userResponse,
|
|
167
|
-
metadata: {
|
|
168
|
-
type: "user_intent",
|
|
169
|
-
intent: "workflow.resume"
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
this.pendingSessions.delete(agentSessionId);
|
|
173
|
-
this._currentAgentSessionId = agentSessionId;
|
|
174
|
-
} catch (error) {
|
|
175
|
-
console.warn(`Failed to add user response to agent session ${agentSessionId}:`, error);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
150
|
+
async resumeAgent(agentSessionId, userQuery, config) {
|
|
151
|
+
this.pendingSessions.delete(agentSessionId);
|
|
152
|
+
this._currentAgentSessionId = agentSessionId;
|
|
178
153
|
config.agentSessionId = agentSessionId;
|
|
179
|
-
return this.run(config, {
|
|
154
|
+
return this.run(config, { userQuery, agentSessionId });
|
|
180
155
|
}
|
|
181
156
|
getPendingSession(agentSessionId) {
|
|
182
157
|
return this.pendingSessions.get(agentSessionId);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./roy-agent-core-rvxg1wps.js";
|
|
6
6
|
import {
|
|
7
7
|
SummaryAgent
|
|
8
|
-
} from "./roy-agent-core-
|
|
8
|
+
} from "./roy-agent-core-eajcvp4e.js";
|
|
9
9
|
import {
|
|
10
10
|
envKeyToConfigKey
|
|
11
11
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
@@ -15,15 +15,15 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
MemorySessionStore,
|
|
17
17
|
SQLiteSessionStore
|
|
18
|
-
} from "./roy-agent-core-
|
|
18
|
+
} from "./roy-agent-core-d7cyjkf7.js";
|
|
19
19
|
import {
|
|
20
20
|
TracedAs,
|
|
21
21
|
init_decorator
|
|
22
|
-
} from "./roy-agent-core-
|
|
22
|
+
} from "./roy-agent-core-zgypchmt.js";
|
|
23
23
|
import {
|
|
24
24
|
createLogger,
|
|
25
25
|
init_logger
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-44hnfb02.js";
|
|
27
27
|
import {
|
|
28
28
|
__legacyDecorateClassTS
|
|
29
29
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -13,15 +13,15 @@ import {
|
|
|
13
13
|
} from "./roy-agent-core-kkbwepqb.js";
|
|
14
14
|
import {
|
|
15
15
|
SessionMessageConverter
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-jfh9q2qh.js";
|
|
17
17
|
import {
|
|
18
18
|
TracedAs,
|
|
19
19
|
init_decorator
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-zgypchmt.js";
|
|
21
21
|
import {
|
|
22
22
|
createLogger,
|
|
23
23
|
init_logger
|
|
24
|
-
} from "./roy-agent-core-
|
|
24
|
+
} from "./roy-agent-core-44hnfb02.js";
|
|
25
25
|
import {
|
|
26
26
|
__legacyDecorateClassTS
|
|
27
27
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -834,11 +834,11 @@ class AgentComponent extends BaseComponent {
|
|
|
834
834
|
content: ctx.systemPrompt
|
|
835
835
|
});
|
|
836
836
|
}
|
|
837
|
-
if (ctx.additionInfo) {
|
|
837
|
+
if (ctx.context?.additionInfo) {
|
|
838
838
|
messages.push({
|
|
839
839
|
role: "user",
|
|
840
840
|
content: `额外信息:
|
|
841
|
-
${ctx.additionInfo}`
|
|
841
|
+
${ctx.context.additionInfo}`
|
|
842
842
|
});
|
|
843
843
|
}
|
|
844
844
|
messages.push(...ctx.messages);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WorkflowRepository,
|
|
3
|
+
rowToWorkflow
|
|
4
|
+
} from "./roy-agent-core-3rr5k71j.js";
|
|
5
|
+
import"./roy-agent-core-zpn0bqa8.js";
|
|
6
|
+
import"./roy-agent-core-rvxg1wps.js";
|
|
7
|
+
import"./roy-agent-core-44hnfb02.js";
|
|
8
|
+
import"./roy-agent-core-xs5rsgat.js";
|
|
9
|
+
import"./roy-agent-core-psv4v63c.js";
|
|
10
|
+
import"./roy-agent-core-fs0mn2jk.js";
|
|
11
|
+
export {
|
|
12
|
+
rowToWorkflow,
|
|
13
|
+
WorkflowRepository
|
|
14
|
+
};
|