@ai-setting/roy-agent-core 1.6.5 → 1.6.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/env/agent/index.js +3 -3
- package/dist/env/event-source/index.js +1 -1
- package/dist/env/index.js +11 -11
- package/dist/env/llm/index.js +2 -2
- package/dist/env/plugin/index.js +1 -1
- package/dist/env/task/index.js +1 -1
- package/dist/env/tool/built-in/index.js +1 -1
- package/dist/env/tool/index.js +2 -2
- package/dist/env/workflow/engine/index.js +3 -3
- package/dist/env/workflow/index.js +5 -5
- package/dist/env/workflow/nodes/index.js +6 -2
- package/dist/env/workflow/tools/index.js +1 -1
- package/dist/index.js +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-ba6243hr.js → roy-agent-core-0tfv18rf.js} +175 -1
- package/dist/shared/@ai-setting/{roy-agent-core-z7dxedn6.js → roy-agent-core-2r1rc0fe.js} +12 -2
- package/dist/shared/@ai-setting/{roy-agent-core-xxfkvqqh.js → roy-agent-core-34xt19yg.js} +8 -7
- package/dist/shared/@ai-setting/{roy-agent-core-fb3wyr3d.js → roy-agent-core-4y3hdqw2.js} +18 -3
- package/dist/shared/@ai-setting/{roy-agent-core-y1m7c2v7.js → roy-agent-core-8jmkghjc.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-bcd3y74k.js → roy-agent-core-a5rde2ky.js} +2 -1
- package/dist/shared/@ai-setting/{roy-agent-core-p8zgxdgy.js → roy-agent-core-b9bnm4mj.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-65qs21kf.js → roy-agent-core-dcd1s7ct.js} +4 -1
- package/dist/shared/@ai-setting/{roy-agent-core-r3209bcd.js → roy-agent-core-gw43m8yd.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-hp1n198d.js → roy-agent-core-mzhsk0jb.js} +57 -25
- package/dist/shared/@ai-setting/{roy-agent-core-155408xq.js → roy-agent-core-r08qk37k.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-5rjccr3c.js → roy-agent-core-smmr6wr3.js} +24 -3
- package/dist/shared/@ai-setting/{roy-agent-core-vf72n6qn.js → roy-agent-core-w7mhnc4c.js} +22 -4
- package/package.json +1 -1
- /package/dist/shared/@ai-setting/{roy-agent-core-6kygfd9x.js → roy-agent-core-02n40zbs.js} +0 -0
package/dist/env/agent/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
AgentComponent,
|
|
3
3
|
AgentComponentConfigSchema,
|
|
4
4
|
SummaryAgent
|
|
5
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
6
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
5
|
+
} from "../../shared/@ai-setting/roy-agent-core-34xt19yg.js";
|
|
6
|
+
import"../../shared/@ai-setting/roy-agent-core-dcd1s7ct.js";
|
|
7
|
+
import"../../shared/@ai-setting/roy-agent-core-02n40zbs.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-as3phr7n.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
larkCliHandler,
|
|
11
11
|
resolveBountyIMSystemPrompt,
|
|
12
12
|
timerHandler
|
|
13
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
} from "../../shared/@ai-setting/roy-agent-core-mzhsk0jb.js";
|
|
14
14
|
import {
|
|
15
15
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
16
16
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
package/dist/env/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
EventSourceComponent,
|
|
6
6
|
builtInHandlers,
|
|
7
7
|
larkCliHandler
|
|
8
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../shared/@ai-setting/roy-agent-core-mzhsk0jb.js";
|
|
9
9
|
import {
|
|
10
10
|
EventSourceInitHooks,
|
|
11
11
|
getDefaultConfigForType,
|
|
@@ -16,22 +16,22 @@ import {
|
|
|
16
16
|
import"../shared/@ai-setting/roy-agent-core-wmkx79b1.js";
|
|
17
17
|
import {
|
|
18
18
|
PluginComponent
|
|
19
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
19
|
+
} from "../shared/@ai-setting/roy-agent-core-2r1rc0fe.js";
|
|
20
20
|
import"../shared/@ai-setting/roy-agent-core-jayzyg7h.js";
|
|
21
21
|
import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
22
22
|
import {
|
|
23
23
|
WorkflowComponent
|
|
24
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
24
|
+
} from "../shared/@ai-setting/roy-agent-core-b9bnm4mj.js";
|
|
25
25
|
import"../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
|
|
26
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
26
|
+
import"../shared/@ai-setting/roy-agent-core-4y3hdqw2.js";
|
|
27
27
|
import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
28
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
28
|
+
import"../shared/@ai-setting/roy-agent-core-w7mhnc4c.js";
|
|
29
29
|
import"../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
|
|
30
30
|
import"../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
31
31
|
import"../shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
32
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
32
|
+
import"../shared/@ai-setting/roy-agent-core-0tfv18rf.js";
|
|
33
33
|
import"../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
34
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
34
|
+
import"../shared/@ai-setting/roy-agent-core-smmr6wr3.js";
|
|
35
35
|
import"../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
36
36
|
import"../shared/@ai-setting/roy-agent-core-b75jtybq.js";
|
|
37
37
|
import"../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
|
|
@@ -41,14 +41,14 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
41
41
|
import {
|
|
42
42
|
AgentComponent,
|
|
43
43
|
AgentComponentConfigSchema
|
|
44
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
45
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
46
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
44
|
+
} from "../shared/@ai-setting/roy-agent-core-34xt19yg.js";
|
|
45
|
+
import"../shared/@ai-setting/roy-agent-core-dcd1s7ct.js";
|
|
46
|
+
import"../shared/@ai-setting/roy-agent-core-02n40zbs.js";
|
|
47
47
|
import"../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
|
|
48
48
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
49
49
|
import {
|
|
50
50
|
TaskComponent
|
|
51
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
51
|
+
} from "../shared/@ai-setting/roy-agent-core-a5rde2ky.js";
|
|
52
52
|
import"../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
|
|
53
53
|
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
54
54
|
import"../shared/@ai-setting/roy-agent-core-c94yan0b.js";
|
package/dist/env/llm/index.js
CHANGED
|
@@ -8,14 +8,14 @@ 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-r08qk37k.js";
|
|
12
12
|
import {
|
|
13
13
|
convertToSDKMessages,
|
|
14
14
|
createInvokeConfig,
|
|
15
15
|
invoke,
|
|
16
16
|
invokeNonStream,
|
|
17
17
|
parseModelString
|
|
18
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
18
|
+
} from "../../shared/@ai-setting/roy-agent-core-dcd1s7ct.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-8x4ngxcy.js";
|
|
21
21
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
package/dist/env/plugin/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EventBusNotificationChannel,
|
|
3
3
|
PluginComponent
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-2r1rc0fe.js";
|
|
5
5
|
import {
|
|
6
6
|
BasePlugin
|
|
7
7
|
} from "../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
package/dist/env/task/index.js
CHANGED
|
@@ -5,7 +5,7 @@ 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-a5rde2ky.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
|
|
10
10
|
import {
|
|
11
11
|
TaskEntityEventTypes
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
grepTool,
|
|
9
9
|
readFileTool,
|
|
10
10
|
writeFileTool
|
|
11
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
} from "../../../shared/@ai-setting/roy-agent-core-gw43m8yd.js";
|
|
12
12
|
import {
|
|
13
13
|
getUnderstandImageLLMProvider,
|
|
14
14
|
resetUnderstandImageLLMProvider,
|
package/dist/env/tool/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
grepTool,
|
|
10
10
|
readFileTool,
|
|
11
11
|
writeFileTool
|
|
12
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
12
|
+
} from "../../shared/@ai-setting/roy-agent-core-gw43m8yd.js";
|
|
13
13
|
import {
|
|
14
14
|
getUnderstandImageLLMProvider,
|
|
15
15
|
resetUnderstandImageLLMProvider,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
ToolValidator,
|
|
23
23
|
getMaxOutputSize,
|
|
24
24
|
setToolConfigComponent
|
|
25
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
25
|
+
} from "../../shared/@ai-setting/roy-agent-core-02n40zbs.js";
|
|
26
26
|
import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
|
|
27
27
|
import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
28
28
|
import"../../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
Scheduler,
|
|
6
6
|
WorkflowEngine,
|
|
7
7
|
init_engine
|
|
8
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../../shared/@ai-setting/roy-agent-core-4y3hdqw2.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
10
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
import"../../../shared/@ai-setting/roy-agent-core-w7mhnc4c.js";
|
|
11
11
|
import"../../../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
|
|
12
12
|
import"../../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
13
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../../../shared/@ai-setting/roy-agent-core-0tfv18rf.js";
|
|
14
14
|
import"../../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
15
15
|
import"../../../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
16
16
|
import {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkflowComponent
|
|
3
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../../shared/@ai-setting/roy-agent-core-b9bnm4mj.js";
|
|
4
4
|
import"../../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
|
|
5
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-4y3hdqw2.js";
|
|
6
6
|
import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
7
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
7
|
+
import"../../shared/@ai-setting/roy-agent-core-w7mhnc4c.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
11
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
import"../../shared/@ai-setting/roy-agent-core-0tfv18rf.js";
|
|
12
12
|
import {
|
|
13
13
|
BaseEventSchema,
|
|
14
14
|
ControlPauseEventSchema,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
pathNotFound,
|
|
61
61
|
unresolvedVariable
|
|
62
62
|
} from "../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
63
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
63
|
+
import"../../shared/@ai-setting/roy-agent-core-smmr6wr3.js";
|
|
64
64
|
import"../../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
65
65
|
import"../../shared/@ai-setting/roy-agent-core-b75jtybq.js";
|
|
66
66
|
import"../../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
+
PythonCallNode,
|
|
2
3
|
SkillNode,
|
|
3
4
|
ToolNode,
|
|
4
5
|
WorkflowNode,
|
|
6
|
+
init_python_call_node,
|
|
5
7
|
init_skill_node,
|
|
6
8
|
init_tool_node,
|
|
7
9
|
init_workflow_node
|
|
8
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
} from "../../../shared/@ai-setting/roy-agent-core-0tfv18rf.js";
|
|
9
11
|
import"../../../shared/@ai-setting/roy-agent-core-cg146hmg.js";
|
|
10
12
|
import"../../../shared/@ai-setting/roy-agent-core-vyygk314.js";
|
|
11
13
|
import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
|
|
@@ -16,8 +18,10 @@ import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
|
16
18
|
init_tool_node();
|
|
17
19
|
init_skill_node();
|
|
18
20
|
init_workflow_node();
|
|
21
|
+
init_python_call_node();
|
|
19
22
|
export {
|
|
20
23
|
WorkflowNode,
|
|
21
24
|
ToolNode,
|
|
22
|
-
SkillNode
|
|
25
|
+
SkillNode,
|
|
26
|
+
PythonCallNode
|
|
23
27
|
};
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
getRunWorkflowTool,
|
|
25
25
|
initRunWorkflowTool,
|
|
26
26
|
resetRunWorkflowTool
|
|
27
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
27
|
+
} from "../../../shared/@ai-setting/roy-agent-core-smmr6wr3.js";
|
|
28
28
|
import {
|
|
29
29
|
WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
|
|
30
30
|
WorkflowJsonOutputMarker,
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ModelLimitsSchema,
|
|
10
10
|
ProviderCapabilitiesSchema,
|
|
11
11
|
ProviderConfigSchema
|
|
12
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
12
|
+
} from "./shared/@ai-setting/roy-agent-core-r08qk37k.js";
|
|
13
13
|
import {
|
|
14
14
|
ConfigComponent
|
|
15
15
|
} from "./shared/@ai-setting/roy-agent-core-33rhv946.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
grepTool,
|
|
27
27
|
readFileTool,
|
|
28
28
|
writeFileTool
|
|
29
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
29
|
+
} from "./shared/@ai-setting/roy-agent-core-gw43m8yd.js";
|
|
30
30
|
import {
|
|
31
31
|
ATTACH_FILE_MAX_BYTES,
|
|
32
32
|
getUnderstandImageLLMProvider,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
larkCliHandler,
|
|
75
75
|
resolveBountyIMSystemPrompt,
|
|
76
76
|
timerHandler
|
|
77
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
77
|
+
} from "./shared/@ai-setting/roy-agent-core-mzhsk0jb.js";
|
|
78
78
|
import {
|
|
79
79
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
80
80
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
} from "./shared/@ai-setting/roy-agent-core-wmkx79b1.js";
|
|
91
91
|
import {
|
|
92
92
|
PluginComponent
|
|
93
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
93
|
+
} from "./shared/@ai-setting/roy-agent-core-2r1rc0fe.js";
|
|
94
94
|
import {
|
|
95
95
|
TaskTagPlugin,
|
|
96
96
|
createAutoTaskPlugin
|
|
@@ -100,20 +100,20 @@ import {
|
|
|
100
100
|
} from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
101
101
|
import {
|
|
102
102
|
WorkflowComponent
|
|
103
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
103
|
+
} from "./shared/@ai-setting/roy-agent-core-b9bnm4mj.js";
|
|
104
104
|
import {
|
|
105
105
|
init_node_registry_helper,
|
|
106
106
|
registerDecoratorNodeType
|
|
107
107
|
} from "./shared/@ai-setting/roy-agent-core-xgnpr28w.js";
|
|
108
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
108
|
+
import"./shared/@ai-setting/roy-agent-core-4y3hdqw2.js";
|
|
109
109
|
import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
110
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
110
|
+
import"./shared/@ai-setting/roy-agent-core-w7mhnc4c.js";
|
|
111
111
|
import"./shared/@ai-setting/roy-agent-core-q88vxmx5.js";
|
|
112
112
|
import"./shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
113
113
|
import"./shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
114
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
114
|
+
import"./shared/@ai-setting/roy-agent-core-0tfv18rf.js";
|
|
115
115
|
import"./shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
116
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
116
|
+
import"./shared/@ai-setting/roy-agent-core-smmr6wr3.js";
|
|
117
117
|
import"./shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
118
118
|
import"./shared/@ai-setting/roy-agent-core-b75jtybq.js";
|
|
119
119
|
import"./shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
|
|
@@ -129,18 +129,18 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
129
129
|
import {
|
|
130
130
|
AgentComponent,
|
|
131
131
|
AgentComponentConfigSchema
|
|
132
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
132
|
+
} from "./shared/@ai-setting/roy-agent-core-34xt19yg.js";
|
|
133
133
|
import {
|
|
134
134
|
createInvokeConfig,
|
|
135
135
|
invoke,
|
|
136
136
|
invokeNonStream,
|
|
137
137
|
parseModelString
|
|
138
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
138
|
+
} from "./shared/@ai-setting/roy-agent-core-dcd1s7ct.js";
|
|
139
139
|
import {
|
|
140
140
|
ToolComponent,
|
|
141
141
|
ToolRegistry,
|
|
142
142
|
ToolValidator
|
|
143
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
143
|
+
} from "./shared/@ai-setting/roy-agent-core-02n40zbs.js";
|
|
144
144
|
import"./shared/@ai-setting/roy-agent-core-5h49ct1a.js";
|
|
145
145
|
import {
|
|
146
146
|
AskUserError,
|
|
@@ -148,7 +148,7 @@ import {
|
|
|
148
148
|
} from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
149
149
|
import {
|
|
150
150
|
TaskComponent
|
|
151
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
151
|
+
} from "./shared/@ai-setting/roy-agent-core-a5rde2ky.js";
|
|
152
152
|
import"./shared/@ai-setting/roy-agent-core-amkqnyzy.js";
|
|
153
153
|
import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
154
154
|
import"./shared/@ai-setting/roy-agent-core-c94yan0b.js";
|
|
@@ -355,4 +355,178 @@ class WorkflowNode {
|
|
|
355
355
|
}
|
|
356
356
|
var init_workflow_node = () => {};
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
// src/env/workflow/nodes/python-call-node.ts
|
|
359
|
+
import { spawn } from "node:child_process";
|
|
360
|
+
function buildPythonSource(module, functionName) {
|
|
361
|
+
return [
|
|
362
|
+
"import sys, json, traceback",
|
|
363
|
+
`_args = json.loads(sys.stdin.read() or "{}")`,
|
|
364
|
+
`from ${module} import ${functionName} as _fn`,
|
|
365
|
+
`try:`,
|
|
366
|
+
` _result = _fn(**_args)`,
|
|
367
|
+
` sys.stdout.write(json.dumps(_result, ensure_ascii=False, default=str))`,
|
|
368
|
+
` sys.stdout.write("\\n")`,
|
|
369
|
+
` sys.exit(0)`,
|
|
370
|
+
`except Exception as _e:`,
|
|
371
|
+
` sys.stderr.write("".join(traceback.format_exception(type(_e), _e, _e.__traceback__)))`,
|
|
372
|
+
` sys.exit(1)`
|
|
373
|
+
].join(`
|
|
374
|
+
`);
|
|
375
|
+
}
|
|
376
|
+
var DEFAULT_TIMEOUT_MS = 60000, DEFAULT_PYTHON = "python3", DEFAULT_ALLOW_LIST, FUNCTION_NAME_REGEX, MODULE_NAME_REGEX, PythonCallNode;
|
|
377
|
+
var init_python_call_node = __esm(() => {
|
|
378
|
+
init_decorator();
|
|
379
|
+
DEFAULT_ALLOW_LIST = {
|
|
380
|
+
prefix: ["investment_strategy"]
|
|
381
|
+
};
|
|
382
|
+
FUNCTION_NAME_REGEX = /^[A-Za-z_]\w*$/;
|
|
383
|
+
MODULE_NAME_REGEX = /^[A-Za-z_]\w*(\.[A-Za-z_]\w*)*$/;
|
|
384
|
+
PythonCallNode = class PythonCallNode {
|
|
385
|
+
definition;
|
|
386
|
+
type = "python_call";
|
|
387
|
+
id;
|
|
388
|
+
allowList;
|
|
389
|
+
spawnFn;
|
|
390
|
+
constructor(definition, options = {}) {
|
|
391
|
+
this.definition = definition;
|
|
392
|
+
this.id = definition.id;
|
|
393
|
+
this.allowList = options.allowList ?? DEFAULT_ALLOW_LIST;
|
|
394
|
+
this.spawnFn = options.spawnFn ?? spawn;
|
|
395
|
+
}
|
|
396
|
+
checkAllowList(module) {
|
|
397
|
+
if (!Array.isArray(this.allowList.prefix) || this.allowList.prefix.length === 0) {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
for (const prefix of this.allowList.prefix) {
|
|
401
|
+
if (module === prefix || module.startsWith(prefix + ".")) {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return `Module "${module}" is not allowed by the python_call allow-list (allowed prefixes: ${this.allowList.prefix.join(", ")})`;
|
|
406
|
+
}
|
|
407
|
+
parseOutput(stdout) {
|
|
408
|
+
const trimmed = stdout.trim();
|
|
409
|
+
if (trimmed === "")
|
|
410
|
+
return "";
|
|
411
|
+
try {
|
|
412
|
+
return JSON.parse(trimmed);
|
|
413
|
+
} catch {
|
|
414
|
+
return stdout.replace(/\n+$/, "");
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
async execute(context) {
|
|
418
|
+
const startTime = Date.now();
|
|
419
|
+
const rawConfig = context.resolvedConfig ?? this.definition.config ?? {};
|
|
420
|
+
try {
|
|
421
|
+
const module = typeof rawConfig.module === "string" ? rawConfig.module.trim() : "";
|
|
422
|
+
const functionName = typeof rawConfig.function === "string" ? rawConfig.function.trim() : "";
|
|
423
|
+
const args = rawConfig.args && typeof rawConfig.args === "object" && !Array.isArray(rawConfig.args) ? rawConfig.args : {};
|
|
424
|
+
const cwd = typeof rawConfig.cwd === "string" && rawConfig.cwd ? rawConfig.cwd : undefined;
|
|
425
|
+
const pythonBin = typeof rawConfig.python === "string" && rawConfig.python ? rawConfig.python : DEFAULT_PYTHON;
|
|
426
|
+
const timeoutMs = typeof rawConfig.timeout === "number" && rawConfig.timeout > 0 ? rawConfig.timeout : DEFAULT_TIMEOUT_MS;
|
|
427
|
+
if (!module) {
|
|
428
|
+
throw new Error(`PythonCallNode "${this.id}": config.module is required`);
|
|
429
|
+
}
|
|
430
|
+
if (!functionName) {
|
|
431
|
+
throw new Error(`PythonCallNode "${this.id}": config.function is required`);
|
|
432
|
+
}
|
|
433
|
+
if (!MODULE_NAME_REGEX.test(module)) {
|
|
434
|
+
throw new Error(`PythonCallNode "${this.id}": config.module "${module}" is not a valid Python module path`);
|
|
435
|
+
}
|
|
436
|
+
if (!FUNCTION_NAME_REGEX.test(functionName)) {
|
|
437
|
+
throw new Error(`PythonCallNode "${this.id}": config.function "${functionName}" is invalid (must match ${FUNCTION_NAME_REGEX})`);
|
|
438
|
+
}
|
|
439
|
+
const allowErr = this.checkAllowList(module);
|
|
440
|
+
if (allowErr) {
|
|
441
|
+
throw new Error(allowErr);
|
|
442
|
+
}
|
|
443
|
+
const hasResolvedConfig = context.resolvedConfig !== undefined;
|
|
444
|
+
const resolvedArgs = hasResolvedConfig ? args : context.templateResolver ? context.templateResolver.resolveValue(args) : args;
|
|
445
|
+
const source = buildPythonSource(module, functionName);
|
|
446
|
+
const child = this.spawnFn(pythonBin, ["-c", source], {
|
|
447
|
+
cwd,
|
|
448
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
449
|
+
env: { ...process.env }
|
|
450
|
+
});
|
|
451
|
+
const payload = JSON.stringify(resolvedArgs);
|
|
452
|
+
child.stdin?.end(payload);
|
|
453
|
+
const stdoutChunks = [];
|
|
454
|
+
const stderrChunks = [];
|
|
455
|
+
child.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
456
|
+
child.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
|
|
457
|
+
const result = await new Promise((resolve, reject) => {
|
|
458
|
+
let timedOut = false;
|
|
459
|
+
let timer = null;
|
|
460
|
+
const onClose = (code) => {
|
|
461
|
+
if (timer)
|
|
462
|
+
clearTimeout(timer);
|
|
463
|
+
resolve({
|
|
464
|
+
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
465
|
+
stderr: Buffer.concat(stderrChunks).toString("utf8"),
|
|
466
|
+
exitCode: code,
|
|
467
|
+
timedOut
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
const onError = (err) => {
|
|
471
|
+
if (timer)
|
|
472
|
+
clearTimeout(timer);
|
|
473
|
+
reject(err);
|
|
474
|
+
};
|
|
475
|
+
child.once("close", onClose);
|
|
476
|
+
child.once("error", onError);
|
|
477
|
+
if (timeoutMs > 0) {
|
|
478
|
+
timer = setTimeout(() => {
|
|
479
|
+
timedOut = true;
|
|
480
|
+
try {
|
|
481
|
+
if (typeof child.pid === "number") {
|
|
482
|
+
try {
|
|
483
|
+
process.kill(-child.pid, "SIGTERM");
|
|
484
|
+
} catch {
|
|
485
|
+
child.kill("SIGTERM");
|
|
486
|
+
}
|
|
487
|
+
} else {
|
|
488
|
+
child.kill("SIGTERM");
|
|
489
|
+
}
|
|
490
|
+
} catch {}
|
|
491
|
+
setTimeout(() => {
|
|
492
|
+
if (!child.killed) {
|
|
493
|
+
try {
|
|
494
|
+
child.kill("SIGKILL");
|
|
495
|
+
} catch {}
|
|
496
|
+
}
|
|
497
|
+
}, 200);
|
|
498
|
+
reject(new Error(`PythonCallNode "${this.id}": execution timed out after ${Math.round(timeoutMs / 1000)}s`));
|
|
499
|
+
}, timeoutMs);
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
if (result.timedOut) {
|
|
503
|
+
throw new Error(`PythonCallNode "${this.id}": execution timed out after ${Math.round(timeoutMs / 1000)}s`);
|
|
504
|
+
}
|
|
505
|
+
if (result.exitCode !== 0) {
|
|
506
|
+
const stderrTail = result.stderr.split(`
|
|
507
|
+
`).filter((l) => l.trim().length > 0).slice(-20).join(`
|
|
508
|
+
`);
|
|
509
|
+
throw new Error(`PythonCallNode "${this.id}": python exit code ${result.exitCode} (module=${module}, fn=${functionName})
|
|
510
|
+
${stderrTail}`);
|
|
511
|
+
}
|
|
512
|
+
const output = this.parseOutput(result.stdout);
|
|
513
|
+
return {
|
|
514
|
+
output,
|
|
515
|
+
error: undefined,
|
|
516
|
+
durationMs: Date.now() - startTime
|
|
517
|
+
};
|
|
518
|
+
} catch (error) {
|
|
519
|
+
return {
|
|
520
|
+
output: undefined,
|
|
521
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
522
|
+
durationMs: Date.now() - startTime
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
__legacyDecorateClassTS([
|
|
528
|
+
TracedAs("workflow.python_call.execute")
|
|
529
|
+
], PythonCallNode.prototype, "execute", null);
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
export { ToolNode, init_tool_node, SkillNode, init_skill_node, WorkflowNode, init_workflow_node, PythonCallNode, init_python_call_node };
|
|
@@ -234,6 +234,9 @@ class PluginComponent extends BaseComponent {
|
|
|
234
234
|
return this.registry.has(name);
|
|
235
235
|
}
|
|
236
236
|
getConfig(name) {
|
|
237
|
+
if (name === undefined) {
|
|
238
|
+
return super.getConfig();
|
|
239
|
+
}
|
|
237
240
|
return this.configComponent?.get(`plugin.${name}`);
|
|
238
241
|
}
|
|
239
242
|
async registerAll(plugins) {
|
|
@@ -299,7 +302,12 @@ class PluginComponent extends BaseComponent {
|
|
|
299
302
|
registerTool(tool) {
|
|
300
303
|
const toolComponent = self.env?.getComponent("tool");
|
|
301
304
|
if (toolComponent) {
|
|
302
|
-
toolComponent.register(
|
|
305
|
+
toolComponent.register({
|
|
306
|
+
name: tool.name,
|
|
307
|
+
description: tool.description,
|
|
308
|
+
parameters: tool.parameters,
|
|
309
|
+
execute: async (args) => tool.handler(args)
|
|
310
|
+
});
|
|
303
311
|
self.logger.debug(`Registered tool: ${tool.name} (for plugin: ${plugin.name})`);
|
|
304
312
|
} else {
|
|
305
313
|
self.logger.warn(`Cannot register tool ${tool.name}: ToolComponent not available`);
|
|
@@ -309,7 +317,9 @@ class PluginComponent extends BaseComponent {
|
|
|
309
317
|
globalHookManager.register(hook.point, {
|
|
310
318
|
name: `${plugin.name}:${hook.point}`,
|
|
311
319
|
priority: hook.priority ?? plugin.priority,
|
|
312
|
-
execute:
|
|
320
|
+
execute: async (ctx) => {
|
|
321
|
+
await hook.handler(ctx);
|
|
322
|
+
}
|
|
313
323
|
});
|
|
314
324
|
self.logger.debug(`Registered hook: ${hook.point} (for plugin: ${plugin.name})`);
|
|
315
325
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withTimeout
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-dcd1s7ct.js";
|
|
4
4
|
import {
|
|
5
5
|
truncateOutputInline
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-02n40zbs.js";
|
|
7
7
|
import {
|
|
8
8
|
AskUserError,
|
|
9
9
|
init_workflow_hil
|
|
@@ -672,7 +672,7 @@ class AgentComponent extends BaseComponent {
|
|
|
672
672
|
agentType: agent.config.type,
|
|
673
673
|
model: context?.model ?? agent.config.model,
|
|
674
674
|
traceId: context?.metadata?.traceId ?? context?.traceId,
|
|
675
|
-
abort: abortController.signal
|
|
675
|
+
abort: context?.abort ? AbortSignal.any([abortController.signal, context.abort]) : abortController.signal
|
|
676
676
|
};
|
|
677
677
|
const result = {
|
|
678
678
|
iterations: 0,
|
|
@@ -1405,13 +1405,14 @@ ${additionInfo}`
|
|
|
1405
1405
|
if (!sessionId) {
|
|
1406
1406
|
return;
|
|
1407
1407
|
}
|
|
1408
|
+
let filtered;
|
|
1408
1409
|
try {
|
|
1409
1410
|
const sessionComponent = this.env.getComponent("session");
|
|
1410
1411
|
if (!sessionComponent) {
|
|
1411
1412
|
logger.warn("SessionComponent not found, skipping session recording");
|
|
1412
1413
|
return;
|
|
1413
1414
|
}
|
|
1414
|
-
|
|
1415
|
+
filtered = [];
|
|
1415
1416
|
for (const msg of allMessages) {
|
|
1416
1417
|
if (msg.role === "system") {
|
|
1417
1418
|
continue;
|
|
@@ -1424,12 +1425,12 @@ ${additionInfo}`
|
|
|
1424
1425
|
continue;
|
|
1425
1426
|
}
|
|
1426
1427
|
}
|
|
1427
|
-
|
|
1428
|
+
filtered.push(this.messageConverter.fromModelMessage(msg, { sessionID: sessionId }));
|
|
1428
1429
|
}
|
|
1429
|
-
if (
|
|
1430
|
+
if (filtered.length === 0) {
|
|
1430
1431
|
return;
|
|
1431
1432
|
}
|
|
1432
|
-
await sessionComponent.addMessages(sessionId,
|
|
1433
|
+
await sessionComponent.addMessages(sessionId, filtered);
|
|
1433
1434
|
} catch (err) {
|
|
1434
1435
|
const kind = err && typeof err === "object" && "kind" in err ? err.kind : undefined;
|
|
1435
1436
|
if (kind === "lock_exhausted") {
|
|
@@ -7,19 +7,21 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AgentComponentAdapter,
|
|
9
9
|
init_agent_component_adapter
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-w7mhnc4c.js";
|
|
11
11
|
import {
|
|
12
12
|
TemplateResolver,
|
|
13
13
|
init_template_resolver
|
|
14
14
|
} from "./roy-agent-core-q88vxmx5.js";
|
|
15
15
|
import {
|
|
16
|
+
PythonCallNode,
|
|
16
17
|
SkillNode,
|
|
17
18
|
ToolNode,
|
|
18
19
|
WorkflowNode,
|
|
20
|
+
init_python_call_node,
|
|
19
21
|
init_skill_node,
|
|
20
22
|
init_tool_node,
|
|
21
23
|
init_workflow_node
|
|
22
|
-
} from "./roy-agent-core-
|
|
24
|
+
} from "./roy-agent-core-0tfv18rf.js";
|
|
23
25
|
import {
|
|
24
26
|
WorkflowError,
|
|
25
27
|
createWorkflowEvent,
|
|
@@ -1297,6 +1299,9 @@ class NodeRegistry {
|
|
|
1297
1299
|
this.factories.set("ask_user", (definition) => {
|
|
1298
1300
|
return new AskUserNode(definition);
|
|
1299
1301
|
});
|
|
1302
|
+
this.factories.set("python_call", (definition) => {
|
|
1303
|
+
return new PythonCallNode(definition);
|
|
1304
|
+
});
|
|
1300
1305
|
}
|
|
1301
1306
|
register(type, factory) {
|
|
1302
1307
|
this.factories.set(type, factory);
|
|
@@ -1323,6 +1328,7 @@ var init_node_registry = __esm(() => {
|
|
|
1323
1328
|
init_agent_component_adapter();
|
|
1324
1329
|
init_workflow_node();
|
|
1325
1330
|
init_ask_user_node();
|
|
1331
|
+
init_python_call_node();
|
|
1326
1332
|
});
|
|
1327
1333
|
|
|
1328
1334
|
// src/env/workflow/utils/agent-session-metadata.ts
|
|
@@ -1395,7 +1401,16 @@ var init_engine = __esm(() => {
|
|
|
1395
1401
|
const definition = "definition" in workflow ? workflow.definition : workflow;
|
|
1396
1402
|
const workflowId = "id" in workflow ? workflow.id : `inline_${definition.name}`;
|
|
1397
1403
|
const workflowName = definition.name;
|
|
1398
|
-
|
|
1404
|
+
let runId;
|
|
1405
|
+
if (options?.runId) {
|
|
1406
|
+
const reserved = options.runId;
|
|
1407
|
+
if (typeof reserved !== "string" || !reserved.startsWith("workflow_")) {
|
|
1408
|
+
throw new Error(`[WorkflowEngine.createSession] reserved runId must start with 'workflow_'; got ${JSON.stringify(reserved)}`);
|
|
1409
|
+
}
|
|
1410
|
+
runId = reserved;
|
|
1411
|
+
} else {
|
|
1412
|
+
runId = this.generateRunId();
|
|
1413
|
+
}
|
|
1399
1414
|
const sessionId = this.getSessionId(runId);
|
|
1400
1415
|
const metadata = {
|
|
1401
1416
|
type: "workflow",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentComponentAdapter,
|
|
3
3
|
init_agent_component_adapter
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-w7mhnc4c.js";
|
|
5
5
|
import"./roy-agent-core-1db4vpc6.js";
|
|
6
6
|
import"./roy-agent-core-e25xkv53.js";
|
|
7
7
|
import"./roy-agent-core-gp872e7m.js";
|
|
@@ -148,7 +148,8 @@ class DefaultTagService {
|
|
|
148
148
|
return this.store.searchTasks(query, limit);
|
|
149
149
|
}
|
|
150
150
|
async searchTasksByKeywords(keywords, options) {
|
|
151
|
-
|
|
151
|
+
const result = await this.store.searchTasksByKeywords(keywords, options);
|
|
152
|
+
return result.tasks;
|
|
152
153
|
}
|
|
153
154
|
async findSimilarTasksByKeywords(keywords, options) {
|
|
154
155
|
return this.store.findSimilarTasksByKeywords(keywords, options);
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
WorkflowEngine,
|
|
7
7
|
exports_engine,
|
|
8
8
|
init_engine
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-4y3hdqw2.js";
|
|
10
10
|
import {
|
|
11
11
|
askUserTool,
|
|
12
12
|
createRunWorkflowTool,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
createWorkflowSearchTool,
|
|
19
19
|
createWorkflowTagListTool,
|
|
20
20
|
createWorkflowValidateTool
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-smmr6wr3.js";
|
|
22
22
|
import {
|
|
23
23
|
WorkflowService
|
|
24
24
|
} from "./roy-agent-core-b75jtybq.js";
|
|
@@ -141,7 +141,7 @@ class WorkflowComponent extends BaseComponent {
|
|
|
141
141
|
if (!agentRunner && this._workflowEnv) {
|
|
142
142
|
const agentComponent = this._workflowEnv.getComponent("agent");
|
|
143
143
|
if (agentComponent) {
|
|
144
|
-
const { AgentComponentAdapter } = await import("./roy-agent-core-
|
|
144
|
+
const { AgentComponentAdapter } = await import("./roy-agent-core-8jmkghjc.js");
|
|
145
145
|
agentRunner = new AgentComponentAdapter(agentComponent, {}, this.sessionComponent);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -432,7 +432,10 @@ function processThinkingStream(textDelta, config, state) {
|
|
|
432
432
|
async function invoke(config, options, ctx) {
|
|
433
433
|
try {
|
|
434
434
|
const emitToEnv = createEnvEventEmitter(options.env, options.context);
|
|
435
|
-
logger.info("[invoke] Created event emitter
|
|
435
|
+
logger.info("[invoke] Created event emitter", {
|
|
436
|
+
envAvailable: !!options.env,
|
|
437
|
+
hasContext: options.context !== undefined
|
|
438
|
+
});
|
|
436
439
|
const { providerId, modelId } = parseModelString(options.model || config.model);
|
|
437
440
|
const provider = createProviderInstance(providerId, config.apiKey, config.baseURL);
|
|
438
441
|
if (!provider) {
|
|
@@ -73,7 +73,7 @@ var killTree = (proc, signal = "SIGKILL") => {
|
|
|
73
73
|
var makeBashSpawner = () => {
|
|
74
74
|
return {
|
|
75
75
|
run: (command, options) => {
|
|
76
|
-
return Effect.gen(function* () {
|
|
76
|
+
return Effect.scoped(Effect.gen(function* () {
|
|
77
77
|
const cwd = options?.cwd;
|
|
78
78
|
const timeout = options?.timeout ?? 60000;
|
|
79
79
|
const env = options?.env ?? {};
|
|
@@ -175,7 +175,7 @@ var makeBashSpawner = () => {
|
|
|
175
175
|
success: !timedOut && exitCode === 0,
|
|
176
176
|
timedOut
|
|
177
177
|
};
|
|
178
|
-
});
|
|
178
|
+
}));
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
};
|
|
@@ -196,11 +196,14 @@ var timerHandler = {
|
|
|
196
196
|
function readBountyIMConfig(config) {
|
|
197
197
|
const topLevelAddress = config.address;
|
|
198
198
|
const topLevelUrl = config.imServerUrl;
|
|
199
|
+
const topLevelEmail = config.email;
|
|
199
200
|
const optionsAddress = config.options?.address;
|
|
200
201
|
const optionsUrl = config.options?.imServerUrl;
|
|
202
|
+
const optionsEmail = config.options?.email;
|
|
201
203
|
return {
|
|
202
204
|
address: topLevelAddress || optionsAddress,
|
|
203
|
-
imServerUrl: topLevelUrl || optionsUrl
|
|
205
|
+
imServerUrl: topLevelUrl || optionsUrl,
|
|
206
|
+
email: topLevelEmail || optionsEmail
|
|
204
207
|
};
|
|
205
208
|
}
|
|
206
209
|
function readBountyIMTlsSkipVerify(config) {
|
|
@@ -213,20 +216,25 @@ function buildDefaultBountyIMSystemPrompt(input) {
|
|
|
213
216
|
const server = input.imServerUrl || "ws://localhost:4005/ws";
|
|
214
217
|
const httpScheme = server.startsWith("wss://") ? "https://" : "http://";
|
|
215
218
|
const endpoint = server.replace(/^wss?:\/\//, httpScheme).replace(/\/ws$/, "");
|
|
219
|
+
const hasEmail = !!input.currentEmail;
|
|
220
|
+
const identity = input.currentEmail || input.currentAddress || "unknown";
|
|
221
|
+
const command = hasEmail ? `bounty com send --server-url ${endpoint} --from-email ${input.currentEmail} --to-email <recipient-email> --body "..."` : `bounty com send --endpoint ${endpoint} -f ${input.currentAddress} -t <to-address> -b "..."`;
|
|
222
|
+
const rule = hasEmail ? `规则:from-email 永远固定为 ${input.currentEmail}; to-email 是收到消息的 from 字段。` : `规则:to-address 总是收到的消息的 from 字段;from-address 永远固定为 ${input.currentAddress}。`;
|
|
223
|
+
const tlsCommand = hasEmail ? ` bounty com send --server-url ${endpoint} --from-email ${input.currentEmail} --to-email <recipient-email> --body "..."` : ` bounty com send --endpoint ${endpoint} -k -f ${input.currentAddress} -t <to-address> -b "..."`;
|
|
216
224
|
return [
|
|
217
225
|
"你正在通过 Bounty IM 与其他 agent 通信。",
|
|
218
226
|
"",
|
|
219
|
-
`你的 IM
|
|
227
|
+
`你的 IM 身份:${identity}`,
|
|
220
228
|
`IM Server:${endpoint} (k8s remote server)`,
|
|
221
229
|
"",
|
|
222
|
-
"回复收到的消息时,**必须**使用以下命令格式(注意 --endpoint 不可省略,省略会默认连 localhost:4000 而失败):",
|
|
230
|
+
"回复收到的消息时,**必须**使用以下命令格式(注意 --server-url / --endpoint 不可省略,省略会默认连 localhost:4000 而失败):",
|
|
223
231
|
"",
|
|
224
|
-
`
|
|
232
|
+
` ${command}`,
|
|
225
233
|
"",
|
|
226
234
|
"如果遇到 TLS 错误(自签名证书),加 -k:",
|
|
227
|
-
|
|
235
|
+
tlsCommand,
|
|
228
236
|
"",
|
|
229
|
-
|
|
237
|
+
rule
|
|
230
238
|
].join(`
|
|
231
239
|
`);
|
|
232
240
|
}
|
|
@@ -247,15 +255,20 @@ class BountyIMInstance {
|
|
|
247
255
|
constructor(config) {
|
|
248
256
|
this.config = config;
|
|
249
257
|
}
|
|
258
|
+
getCurrentIdentity() {
|
|
259
|
+
const { email, address } = readBountyIMConfig(this.config);
|
|
260
|
+
return { email, address };
|
|
261
|
+
}
|
|
250
262
|
getCurrentAddress() {
|
|
251
|
-
const { address } = readBountyIMConfig(this.config);
|
|
252
|
-
return address || "unknown";
|
|
263
|
+
const { email, address } = readBountyIMConfig(this.config);
|
|
264
|
+
return address || email || "unknown";
|
|
253
265
|
}
|
|
254
266
|
getCurrentSystemPrompt() {
|
|
255
|
-
const imServerUrl = readBountyIMConfig(this.config)
|
|
267
|
+
const { email, address, imServerUrl } = readBountyIMConfig(this.config);
|
|
256
268
|
return resolveBountyIMSystemPrompt({
|
|
257
269
|
configSystemPrompt: this.config.systemPrompt,
|
|
258
|
-
currentAddress:
|
|
270
|
+
currentAddress: address,
|
|
271
|
+
currentEmail: email,
|
|
259
272
|
imServerUrl
|
|
260
273
|
});
|
|
261
274
|
}
|
|
@@ -266,12 +279,14 @@ class BountyIMInstance {
|
|
|
266
279
|
if (this.status === "running")
|
|
267
280
|
return;
|
|
268
281
|
this.setStatus("starting");
|
|
269
|
-
const { address, imServerUrl } = readBountyIMConfig(this.config);
|
|
282
|
+
const { email, address, imServerUrl } = readBountyIMConfig(this.config);
|
|
270
283
|
if (!imServerUrl) {
|
|
271
284
|
throw new Error("imServerUrl is required for bounty-im event source");
|
|
272
285
|
}
|
|
273
286
|
const wsUrl = new URL(imServerUrl);
|
|
274
|
-
if (
|
|
287
|
+
if (email) {
|
|
288
|
+
wsUrl.searchParams.set("email", email);
|
|
289
|
+
} else if (address) {
|
|
275
290
|
wsUrl.searchParams.set("address", address);
|
|
276
291
|
}
|
|
277
292
|
console.log(`[BountyIM] Connecting to ${wsUrl.toString()}...`);
|
|
@@ -352,13 +367,16 @@ class BountyIMInstance {
|
|
|
352
367
|
const eventType = `bounty-im.${evt.event || "message"}`;
|
|
353
368
|
const fromAddress = msg.from || "unknown";
|
|
354
369
|
const currentAddress = this.getCurrentAddress();
|
|
370
|
+
const currentIdentity = this.getCurrentIdentity();
|
|
371
|
+
const currentEmail = currentIdentity.email;
|
|
355
372
|
const toAddress = msg.to || currentAddress;
|
|
356
|
-
|
|
357
|
-
|
|
373
|
+
const identityMatches = currentEmail ? msg.to === currentEmail || msg.to === currentAddress : msg.to === currentAddress;
|
|
374
|
+
if (msg.to && !identityMatches) {
|
|
375
|
+
console.warn(`[BountyIM] Warning: message.to (${msg.to}) !== current identity (${currentEmail || currentAddress})`);
|
|
358
376
|
}
|
|
359
377
|
const msgContent = msg.content;
|
|
360
378
|
const content = msgContent?.type === "text" ? String(msgContent.body || "") : "";
|
|
361
|
-
const { imServerUrl } = readBountyIMConfig(this.config);
|
|
379
|
+
const { imServerUrl, email } = readBountyIMConfig(this.config);
|
|
362
380
|
const agent = this.config.handleRule?.agent;
|
|
363
381
|
const metadata = {
|
|
364
382
|
eventType,
|
|
@@ -366,10 +384,12 @@ class BountyIMInstance {
|
|
|
366
384
|
chatId: toAddress,
|
|
367
385
|
agent
|
|
368
386
|
};
|
|
387
|
+
const replyCommandHint = email ? `bounty com send --server-url ${imServerUrl} --from-email ${email} --to-email <recipient-email> --body "..."` : `bounty com send -f ${toAddress} -t ${fromAddress} -b "回复内容"`;
|
|
388
|
+
const inlineReplyHint = email ? `bounty com send --server-url ${imServerUrl} --from-email ${email} --to-email ${fromAddress} --body "回复内容"` : `bounty com send -f ${toAddress} -t ${fromAddress} -b "回复内容"`;
|
|
369
389
|
let recommendedAction;
|
|
370
390
|
if (evt.event === "message") {
|
|
371
391
|
recommendedAction = {
|
|
372
|
-
action: `处理消息并通过 bounty com send
|
|
392
|
+
action: `处理消息并通过 bounty com send 回复发件人。使用格式:${replyCommandHint}`,
|
|
373
393
|
replyTo: {
|
|
374
394
|
chatId: fromAddress
|
|
375
395
|
}
|
|
@@ -379,14 +399,14 @@ class BountyIMInstance {
|
|
|
379
399
|
type: "bounty-im",
|
|
380
400
|
chatId: fromAddress,
|
|
381
401
|
params: {
|
|
382
|
-
from: toAddress,
|
|
402
|
+
from: email || toAddress,
|
|
383
403
|
to: fromAddress,
|
|
384
404
|
imServerUrl
|
|
385
405
|
}
|
|
386
406
|
};
|
|
387
407
|
const displayMessage = content ? `[From ${fromAddress}] ${content}
|
|
388
408
|
|
|
389
|
-
\uD83D\uDCA1 回复:
|
|
409
|
+
\uD83D\uDCA1 回复: ${inlineReplyHint}` : this.formatMessage(rawEvent);
|
|
390
410
|
const event = {
|
|
391
411
|
id: `es-${this.config.id}-${Date.now()}`,
|
|
392
412
|
type: "event-source.event.bounty-im",
|
|
@@ -451,11 +471,19 @@ var bountyIMHandler = {
|
|
|
451
471
|
errors.push("EventSource ID is required");
|
|
452
472
|
if (!config.name)
|
|
453
473
|
errors.push("EventSource name is required");
|
|
454
|
-
const { address, imServerUrl } = readBountyIMConfig(config);
|
|
455
|
-
if (!address) {
|
|
456
|
-
errors.push("Bounty IM address is required (top-level address or options.address)");
|
|
457
|
-
}
|
|
458
|
-
|
|
474
|
+
const { address, imServerUrl, email } = readBountyIMConfig(config);
|
|
475
|
+
if (!email && !address) {
|
|
476
|
+
errors.push("Bounty IM email or address is required (top-level email/address or options.email/address)");
|
|
477
|
+
}
|
|
478
|
+
if (email !== undefined && email !== "") {
|
|
479
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
|
480
|
+
errors.push("Bounty IM email format invalid (expected: user@domain.tld)");
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (address !== undefined && address !== "") {
|
|
484
|
+
if (!/^[\w-]+@[\w.-]+$/.test(address)) {
|
|
485
|
+
errors.push("Bounty IM address format invalid (expected: agent-id@host)");
|
|
486
|
+
}
|
|
459
487
|
}
|
|
460
488
|
if (!imServerUrl) {
|
|
461
489
|
errors.push("Bounty IM imServerUrl is required (top-level imServerUrl or options.imServerUrl)");
|
|
@@ -808,8 +836,9 @@ class LarkCliInstance {
|
|
|
808
836
|
}
|
|
809
837
|
const event = rawEvent;
|
|
810
838
|
let eventType;
|
|
811
|
-
|
|
812
|
-
|
|
839
|
+
const eventHeader = event.header;
|
|
840
|
+
if (eventHeader?.event_type) {
|
|
841
|
+
eventType = eventHeader.event_type;
|
|
813
842
|
} else if (event.schema) {
|
|
814
843
|
eventType = `lark.${event.schema}`;
|
|
815
844
|
} else if (event.type) {
|
|
@@ -1310,6 +1339,9 @@ class EventSourceComponent extends BaseComponent {
|
|
|
1310
1339
|
return Array.from(this.sources.values());
|
|
1311
1340
|
}
|
|
1312
1341
|
getStatus(id) {
|
|
1342
|
+
if (id === undefined) {
|
|
1343
|
+
return this._status;
|
|
1344
|
+
}
|
|
1313
1345
|
return this.statuses.get(id);
|
|
1314
1346
|
}
|
|
1315
1347
|
getEventSourceStatus(id) {
|
|
@@ -615,6 +615,16 @@ function createWorkflowSearchTool(workflowService) {
|
|
|
615
615
|
init_logger();
|
|
616
616
|
import { z as z8 } from "zod";
|
|
617
617
|
var logger7 = createLogger("run-workflow-tool");
|
|
618
|
+
function synthFallbackRunId(now = Date.now()) {
|
|
619
|
+
return `workflow_${now}_fallback_${Math.random().toString(36).slice(2, 8)}`;
|
|
620
|
+
}
|
|
621
|
+
function attemptStopOnTimeout(workflowService, runId, reason) {
|
|
622
|
+
if (typeof workflowService.stopRun !== "function")
|
|
623
|
+
return;
|
|
624
|
+
workflowService.stopRun(runId, reason).catch((stopErr) => {
|
|
625
|
+
logger7.warn(`Failed to stop workflow ${runId} after timeout: ${stopErr instanceof Error ? stopErr.message : String(stopErr)}`);
|
|
626
|
+
});
|
|
627
|
+
}
|
|
618
628
|
var RunWorkflowInputSchema = z8.object({
|
|
619
629
|
workflow_name: z8.string().describe("Name of the workflow to run"),
|
|
620
630
|
input: z8.record(z8.any()).optional().describe("Input to pass to the workflow"),
|
|
@@ -655,14 +665,23 @@ function createRunWorkflowTool(workflowService) {
|
|
|
655
665
|
const parentSessionId = ctxSessionId ?? envSessionId;
|
|
656
666
|
let timeoutHandle;
|
|
657
667
|
let durationMs;
|
|
658
|
-
|
|
668
|
+
const reservedRunId = synthFallbackRunId();
|
|
669
|
+
let timedOut = false;
|
|
670
|
+
let capturedByCallback = false;
|
|
671
|
+
let capturedRunId = session ? session : reservedRunId;
|
|
659
672
|
const onSessionCreated = (sid) => {
|
|
660
673
|
capturedRunId = sid;
|
|
674
|
+
capturedByCallback = true;
|
|
675
|
+
if (timedOut) {
|
|
676
|
+
attemptStopOnTimeout(workflowService, sid, "timed out");
|
|
677
|
+
}
|
|
661
678
|
};
|
|
662
679
|
try {
|
|
663
680
|
let result;
|
|
681
|
+
const fallbackRunId = reservedRunId;
|
|
664
682
|
const baseOptions = {
|
|
665
683
|
...parentSessionId ? { parentSessionId } : {},
|
|
684
|
+
...session ? {} : { runId: reservedRunId },
|
|
666
685
|
onSessionCreated,
|
|
667
686
|
...node_config ? { nodeConfig: node_config } : {}
|
|
668
687
|
};
|
|
@@ -680,6 +699,8 @@ function createRunWorkflowTool(workflowService) {
|
|
|
680
699
|
executeCall(),
|
|
681
700
|
new Promise((_, reject) => {
|
|
682
701
|
timeoutHandle = setTimeout(() => {
|
|
702
|
+
timedOut = true;
|
|
703
|
+
attemptStopOnTimeout(workflowService, capturedRunId ?? reservedRunId, "timed out");
|
|
683
704
|
reject(new Error("Workflow execution timed out"));
|
|
684
705
|
}, timeout);
|
|
685
706
|
})
|
|
@@ -691,7 +712,7 @@ function createRunWorkflowTool(workflowService) {
|
|
|
691
712
|
clearTimeout(timeoutHandle);
|
|
692
713
|
}
|
|
693
714
|
durationMs = Date.now() - startTime;
|
|
694
|
-
const finalRunId = capturedRunId
|
|
715
|
+
const finalRunId = capturedByCallback ? capturedRunId : result.runId ?? "";
|
|
695
716
|
return {
|
|
696
717
|
success: result.status === "completed" || result.status === "paused",
|
|
697
718
|
output: {
|
|
@@ -715,7 +736,7 @@ function createRunWorkflowTool(workflowService) {
|
|
|
715
736
|
}
|
|
716
737
|
durationMs = Date.now() - startTime;
|
|
717
738
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
718
|
-
const errorRunId = capturedRunId ??
|
|
739
|
+
const errorRunId = capturedRunId ?? reservedRunId;
|
|
719
740
|
if (errorMessage.includes("Workflow not found")) {
|
|
720
741
|
return {
|
|
721
742
|
success: false,
|
|
@@ -241,15 +241,30 @@ var init_agent_component_adapter = __esm(() => {
|
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
+
let timeoutHandle;
|
|
244
245
|
try {
|
|
245
246
|
const outputSchema = config.options?.outputSchema;
|
|
246
247
|
const context = {};
|
|
247
248
|
context.model = config.options?.model;
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
const configuredTimeout = config.options?.timeout;
|
|
250
|
+
const deadlineController = typeof configuredTimeout === "number" && configuredTimeout > 0 ? new AbortController : undefined;
|
|
251
|
+
if (deadlineController) {
|
|
252
|
+
const timeoutMsFinal = configuredTimeout;
|
|
253
|
+
timeoutHandle = setTimeout(() => {
|
|
254
|
+
if (process.env["DEBUG"]) {
|
|
255
|
+
console.warn(`[AgentComponentAdapter] agent '${config.type || "general"}' timeout ${timeoutMsFinal}ms elapsed, aborting THIS run only.`);
|
|
256
|
+
}
|
|
257
|
+
deadlineController.abort(new Error(`Agent ${config.type || "general"} timed out after ${timeoutMsFinal}ms`));
|
|
258
|
+
}, timeoutMsFinal);
|
|
259
|
+
if (typeof timeoutHandle.unref === "function") {
|
|
260
|
+
timeoutHandle.unref();
|
|
261
|
+
}
|
|
250
262
|
}
|
|
251
|
-
|
|
252
|
-
|
|
263
|
+
const signals = [signal, deadlineController?.signal].filter((value) => value !== undefined);
|
|
264
|
+
if (signals.length === 1) {
|
|
265
|
+
context.abort = signals[0];
|
|
266
|
+
} else if (signals.length > 1) {
|
|
267
|
+
context.abort = AbortSignal.any(signals);
|
|
253
268
|
}
|
|
254
269
|
context.sessionId = agentSessionId;
|
|
255
270
|
if (config.options?.allowedTools) {
|
|
@@ -326,6 +341,9 @@ var init_agent_component_adapter = __esm(() => {
|
|
|
326
341
|
}
|
|
327
342
|
};
|
|
328
343
|
} finally {
|
|
344
|
+
if (timeoutHandle) {
|
|
345
|
+
clearTimeout(timeoutHandle);
|
|
346
|
+
}
|
|
329
347
|
if (isResume) {
|
|
330
348
|
this._currentAgentSessionId = undefined;
|
|
331
349
|
}
|
package/package.json
CHANGED
|
File without changes
|