@ai-setting/roy-agent-core 1.5.43 → 1.5.45
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.js +5 -5
- package/dist/env/agent/index.js +5 -5
- package/dist/env/commands/index.js +5 -5
- package/dist/env/context/index.js +4 -1
- package/dist/env/debug/index.js +5 -5
- package/dist/env/event-source/index.js +7 -7
- package/dist/env/hook/index.js +3 -3
- package/dist/env/index.js +24 -20
- package/dist/env/llm/index.js +5 -5
- package/dist/env/log-trace/index.js +5 -5
- package/dist/env/mcp/index.js +20 -6
- package/dist/env/memory/index.js +5 -5
- package/dist/env/plugin/index.js +5 -5
- package/dist/env/prompt/index.js +5 -5
- package/dist/env/session/index.js +6 -6
- package/dist/env/session/storage/index.js +1 -1
- package/dist/env/skill/index.js +5 -5
- package/dist/env/task/delegate/index.js +3 -3
- package/dist/env/task/index.js +6 -6
- package/dist/env/task/plugins/index.js +2 -2
- package/dist/env/tool/built-in/index.js +1 -1
- package/dist/env/tool/index.js +6 -6
- package/dist/env/workflow/decorators/index.js +1 -1
- package/dist/env/workflow/engine/index.js +10 -4
- package/dist/env/workflow/index.js +42 -24
- package/dist/env/workflow/nodes/index.js +5 -1
- package/dist/env/workflow/tools/index.js +14 -0
- package/dist/env/workflow/types/index.js +16 -2
- package/dist/env/workflow/utils/index.js +15 -196
- package/dist/index.js +35 -31
- package/dist/shared/@ai-setting/{roy-agent-core-kajktp3d.js → roy-agent-core-20fm423j.js} +47 -26
- package/dist/shared/@ai-setting/{roy-agent-core-ffb9fq4v.js → roy-agent-core-2vhsccvz.js} +54 -12
- package/dist/shared/@ai-setting/{roy-agent-core-69jskqjg.js → roy-agent-core-44g4dhzg.js} +75 -7
- package/dist/shared/@ai-setting/{roy-agent-core-e9fdm13a.js → roy-agent-core-4gmxjdhn.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-b4wd9tn6.js → roy-agent-core-4k9a823d.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-68qy97r3.js +31 -0
- package/dist/shared/@ai-setting/roy-agent-core-6atd905e.js +42 -0
- package/dist/shared/@ai-setting/{roy-agent-core-4jqq077c.js → roy-agent-core-6e3wz81d.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-pwkk12p4.js → roy-agent-core-6mcb7nqa.js} +60 -0
- package/dist/shared/@ai-setting/roy-agent-core-6vxg2gmr.js +321 -0
- package/dist/shared/@ai-setting/{roy-agent-core-9p43ap7h.js → roy-agent-core-8y804aat.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-0rtxwr28.js → roy-agent-core-9bmtxmp6.js} +77 -120
- package/dist/shared/@ai-setting/{roy-agent-core-r6rwsr54.js → roy-agent-core-9p604xjf.js} +29 -9
- package/dist/shared/@ai-setting/{roy-agent-core-z1xf2fdk.js → roy-agent-core-a67e90d1.js} +6 -4
- package/dist/shared/@ai-setting/{roy-agent-core-xkb264a8.js → roy-agent-core-bp3xggmb.js} +192 -26
- package/dist/shared/@ai-setting/{roy-agent-core-zrja5v78.js → roy-agent-core-ce9w0j8n.js} +10 -2
- package/dist/shared/@ai-setting/{roy-agent-core-bmr6bdfb.js → roy-agent-core-cr8xer31.js} +15 -8
- package/dist/shared/@ai-setting/roy-agent-core-dbxm76wf.js +190 -0
- package/dist/shared/@ai-setting/{roy-agent-core-nj8yerg9.js → roy-agent-core-eftqdsy5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7fgf85wc.js → roy-agent-core-h0x19xgn.js} +6 -7
- package/dist/shared/@ai-setting/{roy-agent-core-psvwzdhj.js → roy-agent-core-hdszq729.js} +9 -5
- package/dist/shared/@ai-setting/{roy-agent-core-dxbsc1zy.js → roy-agent-core-ja9qhg6d.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-cevpwnq7.js → roy-agent-core-mjbfgqen.js} +5 -3
- package/dist/shared/@ai-setting/roy-agent-core-nhfy3p8q.js +132 -0
- package/dist/shared/@ai-setting/{roy-agent-core-2jnzv9at.js → roy-agent-core-nn9dmffw.js} +629 -288
- package/dist/shared/@ai-setting/roy-agent-core-qnrf2aw6.js +441 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ee6nnnqw.js → roy-agent-core-r9hq4cjx.js} +8 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jqy2mdyq.js → roy-agent-core-rgj6hq15.js} +52 -41
- package/dist/shared/@ai-setting/{roy-agent-core-z33en0cz.js → roy-agent-core-rm3hay00.js} +15 -2
- package/dist/shared/@ai-setting/{roy-agent-core-e130w7mv.js → roy-agent-core-rx74rye7.js} +5 -3
- package/dist/shared/@ai-setting/{roy-agent-core-pxcrzyv9.js → roy-agent-core-sk535ft2.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-v002ynpa.js +435 -0
- package/dist/shared/@ai-setting/{roy-agent-core-2dhd60aw.js → roy-agent-core-vdwvamre.js} +10 -0
- package/dist/shared/@ai-setting/{roy-agent-core-1zq3p19q.js → roy-agent-core-w64zachx.js} +8 -4
- package/dist/shared/@ai-setting/roy-agent-core-ye0z728h.js +18 -0
- package/dist/shared/@ai-setting/{roy-agent-core-rsybkb38.js → roy-agent-core-ysvh8er9.js} +36 -39
- package/dist/shared/@ai-setting/{roy-agent-core-9yxb3ty9.js → roy-agent-core-z5sxe4p7.js} +5 -1
- package/dist/shared/@ai-setting/{roy-agent-core-eg6nv09z.js → roy-agent-core-ztx5eh72.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nqgrjja0.js → roy-agent-core-zwq6vhpj.js} +1 -1
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +0 -350
- package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +0 -11
- package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +0 -603
package/dist/index.js
CHANGED
|
@@ -9,18 +9,18 @@ import {
|
|
|
9
9
|
invoke,
|
|
10
10
|
invokeNonStream,
|
|
11
11
|
parseModelString
|
|
12
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
12
|
+
} from "./shared/@ai-setting/roy-agent-core-20fm423j.js";
|
|
13
13
|
import {
|
|
14
14
|
ConfigComponent
|
|
15
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
15
|
+
} from "./shared/@ai-setting/roy-agent-core-eftqdsy5.js";
|
|
16
16
|
import {
|
|
17
17
|
CommandsComponent
|
|
18
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
18
|
+
} from "./shared/@ai-setting/roy-agent-core-4k9a823d.js";
|
|
19
19
|
import {
|
|
20
20
|
ToolComponent,
|
|
21
21
|
ToolRegistry,
|
|
22
22
|
ToolValidator
|
|
23
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
23
|
+
} from "./shared/@ai-setting/roy-agent-core-rx74rye7.js";
|
|
24
24
|
import {
|
|
25
25
|
bashTool,
|
|
26
26
|
editFileTool,
|
|
@@ -30,20 +30,20 @@ import {
|
|
|
30
30
|
grepTool,
|
|
31
31
|
readFileTool,
|
|
32
32
|
writeFileTool
|
|
33
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
33
|
+
} from "./shared/@ai-setting/roy-agent-core-ysvh8er9.js";
|
|
34
34
|
import {
|
|
35
35
|
PromptComponent,
|
|
36
36
|
PromptStore,
|
|
37
37
|
getBuiltInPrompt,
|
|
38
38
|
getBuiltInPromptNames
|
|
39
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
39
|
+
} from "./shared/@ai-setting/roy-agent-core-a67e90d1.js";
|
|
40
40
|
import {
|
|
41
41
|
closeDatabase
|
|
42
42
|
} from "./shared/@ai-setting/roy-agent-core-9ffsvvcf.js";
|
|
43
43
|
import"./shared/@ai-setting/roy-agent-core-2grcjaad.js";
|
|
44
44
|
import {
|
|
45
45
|
MemoryComponent
|
|
46
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
46
|
+
} from "./shared/@ai-setting/roy-agent-core-ztx5eh72.js";
|
|
47
47
|
import {
|
|
48
48
|
MemoryPlugin,
|
|
49
49
|
createMemoryPlugin
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
import"./shared/@ai-setting/roy-agent-core-g1s2h0e5.js";
|
|
52
52
|
import {
|
|
53
53
|
DebugComponent
|
|
54
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
54
|
+
} from "./shared/@ai-setting/roy-agent-core-zwq6vhpj.js";
|
|
55
55
|
import {
|
|
56
56
|
ReplFormatter,
|
|
57
57
|
TraceFormatter,
|
|
@@ -61,13 +61,13 @@ import {
|
|
|
61
61
|
BaseEnvironment,
|
|
62
62
|
generateDescendingId,
|
|
63
63
|
generateId
|
|
64
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
64
|
+
} from "./shared/@ai-setting/roy-agent-core-r9hq4cjx.js";
|
|
65
65
|
import {
|
|
66
66
|
EventSourceComponent,
|
|
67
67
|
builtInHandlers,
|
|
68
68
|
getBuiltInHandler,
|
|
69
69
|
larkCliHandler
|
|
70
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
70
|
+
} from "./shared/@ai-setting/roy-agent-core-hdszq729.js";
|
|
71
71
|
import {
|
|
72
72
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
73
73
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -80,49 +80,53 @@ import {
|
|
|
80
80
|
import {
|
|
81
81
|
LogTraceComponent,
|
|
82
82
|
LogTraceConfigSchema
|
|
83
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
83
|
+
} from "./shared/@ai-setting/roy-agent-core-ja9qhg6d.js";
|
|
84
84
|
import {
|
|
85
85
|
PluginComponent
|
|
86
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
86
|
+
} from "./shared/@ai-setting/roy-agent-core-mjbfgqen.js";
|
|
87
87
|
import {
|
|
88
88
|
TaskTagPlugin
|
|
89
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
89
|
+
} from "./shared/@ai-setting/roy-agent-core-4gmxjdhn.js";
|
|
90
90
|
import {
|
|
91
91
|
BasePlugin
|
|
92
92
|
} from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
93
93
|
import {
|
|
94
94
|
WorkflowComponent
|
|
95
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
95
|
+
} from "./shared/@ai-setting/roy-agent-core-cr8xer31.js";
|
|
96
96
|
import {
|
|
97
97
|
init_node_registry_helper,
|
|
98
98
|
registerDecoratorNodeType
|
|
99
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
100
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
101
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
99
|
+
} from "./shared/@ai-setting/roy-agent-core-9bmtxmp6.js";
|
|
100
|
+
import"./shared/@ai-setting/roy-agent-core-nn9dmffw.js";
|
|
101
|
+
import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
102
|
+
import"./shared/@ai-setting/roy-agent-core-44g4dhzg.js";
|
|
103
|
+
import"./shared/@ai-setting/roy-agent-core-dbxm76wf.js";
|
|
102
104
|
import"./shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
103
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
104
|
-
import"./shared/@ai-setting/roy-agent-core-5x94xmt6.js";
|
|
105
|
+
import"./shared/@ai-setting/roy-agent-core-6vxg2gmr.js";
|
|
105
106
|
import"./shared/@ai-setting/roy-agent-core-0vbdz0x7.js";
|
|
107
|
+
import"./shared/@ai-setting/roy-agent-core-nhfy3p8q.js";
|
|
106
108
|
import {
|
|
107
109
|
Edge,
|
|
108
110
|
NodeAs,
|
|
109
111
|
Workflow,
|
|
110
112
|
WorkflowEdges,
|
|
111
113
|
createWorkflowFromClass
|
|
112
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
114
|
+
} from "./shared/@ai-setting/roy-agent-core-h0x19xgn.js";
|
|
113
115
|
import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
116
|
+
import"./shared/@ai-setting/roy-agent-core-v002ynpa.js";
|
|
117
|
+
import"./shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
114
118
|
import {
|
|
115
119
|
AgentComponent,
|
|
116
120
|
AgentComponentConfigSchema
|
|
117
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
121
|
+
} from "./shared/@ai-setting/roy-agent-core-9p604xjf.js";
|
|
118
122
|
import {
|
|
119
123
|
AskUserError,
|
|
120
124
|
init_workflow_hil
|
|
121
125
|
} from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
122
126
|
import {
|
|
123
127
|
TaskComponent
|
|
124
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
125
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
128
|
+
} from "./shared/@ai-setting/roy-agent-core-w64zachx.js";
|
|
129
|
+
import"./shared/@ai-setting/roy-agent-core-8y804aat.js";
|
|
126
130
|
import"./shared/@ai-setting/roy-agent-core-hsxn8m1j.js";
|
|
127
131
|
import {
|
|
128
132
|
AgentRegistry
|
|
@@ -140,11 +144,11 @@ import {
|
|
|
140
144
|
import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
141
145
|
import {
|
|
142
146
|
SkillComponent
|
|
143
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
147
|
+
} from "./shared/@ai-setting/roy-agent-core-sk535ft2.js";
|
|
144
148
|
import"./shared/@ai-setting/roy-agent-core-psvxt4c9.js";
|
|
145
149
|
import {
|
|
146
150
|
McpComponent
|
|
147
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
151
|
+
} from "./shared/@ai-setting/roy-agent-core-bp3xggmb.js";
|
|
148
152
|
import {
|
|
149
153
|
AgentError,
|
|
150
154
|
ComponentError,
|
|
@@ -159,7 +163,7 @@ import {
|
|
|
159
163
|
import"./shared/@ai-setting/roy-agent-core-1bfmxx89.js";
|
|
160
164
|
import {
|
|
161
165
|
SessionComponent
|
|
162
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
166
|
+
} from "./shared/@ai-setting/roy-agent-core-ce9w0j8n.js";
|
|
163
167
|
import"./shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
164
168
|
import"./shared/@ai-setting/roy-agent-core-kwhv9dcd.js";
|
|
165
169
|
import {
|
|
@@ -171,16 +175,16 @@ import {
|
|
|
171
175
|
import"./shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
172
176
|
import {
|
|
173
177
|
BaseComponent
|
|
174
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
178
|
+
} from "./shared/@ai-setting/roy-agent-core-6e3wz81d.js";
|
|
175
179
|
import {
|
|
176
180
|
createHook,
|
|
177
181
|
createPriorityHook
|
|
178
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
182
|
+
} from "./shared/@ai-setting/roy-agent-core-vdwvamre.js";
|
|
179
183
|
import {
|
|
180
184
|
HookManager,
|
|
181
185
|
globalHookManager
|
|
182
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
183
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
186
|
+
} from "./shared/@ai-setting/roy-agent-core-rgj6hq15.js";
|
|
187
|
+
import"./shared/@ai-setting/roy-agent-core-rm3hay00.js";
|
|
184
188
|
import {
|
|
185
189
|
createLogger,
|
|
186
190
|
getLogDir,
|
|
@@ -204,7 +208,7 @@ import {
|
|
|
204
208
|
} from "./shared/@ai-setting/roy-agent-core-c6592r3c.js";
|
|
205
209
|
import {
|
|
206
210
|
MemorySessionStore
|
|
207
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
211
|
+
} from "./shared/@ai-setting/roy-agent-core-6mcb7nqa.js";
|
|
208
212
|
import"./shared/@ai-setting/roy-agent-core-7b35emr7.js";
|
|
209
213
|
import"./shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
210
214
|
// src/env/memory/tools/memory-agent-tools.ts
|
|
@@ -12,11 +12,12 @@ import {
|
|
|
12
12
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
13
13
|
import {
|
|
14
14
|
BaseComponent
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-6e3wz81d.js";
|
|
16
16
|
import {
|
|
17
17
|
LLMHookPoints,
|
|
18
|
-
globalHookManager
|
|
19
|
-
|
|
18
|
+
globalHookManager,
|
|
19
|
+
init_global_hook_manager
|
|
20
|
+
} from "./roy-agent-core-rgj6hq15.js";
|
|
20
21
|
import {
|
|
21
22
|
createLogger,
|
|
22
23
|
init_logger
|
|
@@ -513,6 +514,10 @@ function createEnvEventEmitter(env, context) {
|
|
|
513
514
|
}
|
|
514
515
|
};
|
|
515
516
|
}
|
|
517
|
+
function getStreamPartText(part) {
|
|
518
|
+
const value = part.text ?? part.delta ?? part.textDelta;
|
|
519
|
+
return typeof value === "string" ? value : "";
|
|
520
|
+
}
|
|
516
521
|
function processThinkingStream(textDelta, config, state) {
|
|
517
522
|
if (!config.enabled || !textDelta) {
|
|
518
523
|
return {
|
|
@@ -658,8 +663,10 @@ async function invoke(config, options, ctx) {
|
|
|
658
663
|
for await (const part of result.fullStream) {
|
|
659
664
|
const streamPart = part;
|
|
660
665
|
switch (streamPart.type) {
|
|
661
|
-
case "text-delta":
|
|
662
|
-
const textDelta = streamPart
|
|
666
|
+
case "text-delta": {
|
|
667
|
+
const textDelta = getStreamPartText(streamPart);
|
|
668
|
+
if (!textDelta)
|
|
669
|
+
break;
|
|
663
670
|
const thinkingConfig = config.options?.thinkingInText;
|
|
664
671
|
if (thinkingConfig?.enabled) {
|
|
665
672
|
const thinkingResult = processThinkingStream(textDelta, thinkingConfig, {
|
|
@@ -669,13 +676,14 @@ async function invoke(config, options, ctx) {
|
|
|
669
676
|
isThinkingTagOpen = thinkingResult.isThinkingTagOpen;
|
|
670
677
|
currentThinkingContent = thinkingResult.currentThinkingContent;
|
|
671
678
|
fullContent += thinkingResult.cleanedText;
|
|
672
|
-
for (const
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
679
|
+
for (const reasoningSnapshot of thinkingResult.reasoningEvents) {
|
|
680
|
+
const delta = reasoningSnapshot.slice(reasoningContent.length);
|
|
681
|
+
reasoningContent = reasoningSnapshot;
|
|
682
|
+
if (emitToEnv && delta) {
|
|
683
|
+
emitToEnv({ type: "reasoning", content: reasoningContent, delta });
|
|
676
684
|
}
|
|
677
685
|
}
|
|
678
|
-
if (emitToEnv) {
|
|
686
|
+
if (emitToEnv && thinkingResult.cleanedText) {
|
|
679
687
|
emitToEnv({ type: "text", content: fullContent, delta: thinkingResult.cleanedText });
|
|
680
688
|
}
|
|
681
689
|
} else {
|
|
@@ -685,33 +693,33 @@ async function invoke(config, options, ctx) {
|
|
|
685
693
|
}
|
|
686
694
|
}
|
|
687
695
|
break;
|
|
688
|
-
|
|
689
|
-
|
|
696
|
+
}
|
|
697
|
+
case "reasoning-delta": {
|
|
698
|
+
const reasoningDelta = getStreamPartText(streamPart);
|
|
699
|
+
if (!reasoningDelta)
|
|
700
|
+
break;
|
|
690
701
|
reasoningContent += reasoningDelta;
|
|
691
702
|
if (emitToEnv) {
|
|
692
|
-
emitToEnv({ type: "reasoning", content: reasoningContent });
|
|
703
|
+
emitToEnv({ type: "reasoning", content: reasoningContent, delta: reasoningDelta });
|
|
704
|
+
}
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
case "reasoning-end":
|
|
708
|
+
if (emitToEnv) {
|
|
709
|
+
emitToEnv({ type: "reasoning", content: reasoningContent, phase: "end" });
|
|
693
710
|
}
|
|
694
711
|
break;
|
|
695
|
-
case "tool-call":
|
|
712
|
+
case "tool-call": {
|
|
696
713
|
const toolInput = streamPart.input;
|
|
697
|
-
const toolCallId = streamPart.toolCallId;
|
|
714
|
+
const toolCallId = streamPart.toolCallId ?? streamPart.id;
|
|
698
715
|
const toolName = streamPart.toolName;
|
|
699
716
|
toolCalls.push({
|
|
700
717
|
id: toolCallId,
|
|
701
718
|
name: toolName,
|
|
702
719
|
args: toolInput
|
|
703
720
|
});
|
|
704
|
-
if (emitToEnv) {
|
|
705
|
-
emitToEnv({
|
|
706
|
-
type: "tool_call",
|
|
707
|
-
toolCall: {
|
|
708
|
-
id: toolCallId,
|
|
709
|
-
name: toolName,
|
|
710
|
-
arguments: JSON.stringify(toolInput)
|
|
711
|
-
}
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
721
|
break;
|
|
722
|
+
}
|
|
715
723
|
case "finish-step":
|
|
716
724
|
const stepUsage = extractUsageInfo(streamPart.usage);
|
|
717
725
|
if (stepUsage) {
|
|
@@ -873,6 +881,8 @@ function createInvokeConfig(model, apiKey, baseURL) {
|
|
|
873
881
|
};
|
|
874
882
|
}
|
|
875
883
|
// src/env/llm/hooks.ts
|
|
884
|
+
init_global_hook_manager();
|
|
885
|
+
|
|
876
886
|
class LLMHookManager {
|
|
877
887
|
registrations = [];
|
|
878
888
|
register(type, handler, name) {
|
|
@@ -1180,13 +1190,24 @@ class LLMComponent extends BaseComponent {
|
|
|
1180
1190
|
toolCallId: msg.toolCallId,
|
|
1181
1191
|
toolCalls: msg.toolCalls
|
|
1182
1192
|
}));
|
|
1193
|
+
const provider = this.getProvider(providerId);
|
|
1194
|
+
const thinkingInText = provider?.capabilities?.thinkingInText;
|
|
1183
1195
|
return {
|
|
1184
1196
|
providerId,
|
|
1185
1197
|
model,
|
|
1186
1198
|
invokeConfig: {
|
|
1187
1199
|
model: `${providerId}/${model}`,
|
|
1188
1200
|
apiKey,
|
|
1189
|
-
baseURL:
|
|
1201
|
+
baseURL: provider?.baseURL,
|
|
1202
|
+
...thinkingInText?.enabled ? {
|
|
1203
|
+
options: {
|
|
1204
|
+
thinkingInText: {
|
|
1205
|
+
enabled: thinkingInText.enabled,
|
|
1206
|
+
tags: thinkingInText.tags,
|
|
1207
|
+
removeFromOutput: thinkingInText.removeFromOutput
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
} : {}
|
|
1190
1211
|
},
|
|
1191
1212
|
messages,
|
|
1192
1213
|
temperature: request.temperature ?? defaultTemperature,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getWorkflowNodeIdFromMetadata,
|
|
3
|
+
init_workflow_message_metadata
|
|
4
|
+
} from "./roy-agent-core-6atd905e.js";
|
|
1
5
|
import {
|
|
2
6
|
__esm
|
|
3
7
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -13,25 +17,25 @@ function inferNextNode(messages, definition) {
|
|
|
13
17
|
case "workflow.node.start":
|
|
14
18
|
return {
|
|
15
19
|
type: "resume_node",
|
|
16
|
-
nodeId: metadata
|
|
20
|
+
nodeId: getWorkflowNodeIdFromMetadata(metadata),
|
|
17
21
|
agentSessionId: metadata.agentSessionId
|
|
18
22
|
};
|
|
19
23
|
case "workflow.node.interrupt":
|
|
20
24
|
return {
|
|
21
25
|
type: "ask_user",
|
|
22
|
-
nodeId: metadata
|
|
26
|
+
nodeId: getWorkflowNodeIdFromMetadata(metadata),
|
|
23
27
|
agentSessionId: metadata.agentSessionId
|
|
24
28
|
};
|
|
25
29
|
case "workflow.node.end":
|
|
26
30
|
case "workflow.node.result":
|
|
27
|
-
return getNextNodes(metadata
|
|
31
|
+
return getNextNodes(getWorkflowNodeIdFromMetadata(metadata), definition);
|
|
28
32
|
default:
|
|
29
33
|
const lastStart = findLastStartMessage(messages);
|
|
30
34
|
if (lastStart) {
|
|
31
35
|
const startMetadata = lastStart.metadata;
|
|
32
36
|
return {
|
|
33
37
|
type: "resume_node",
|
|
34
|
-
nodeId: startMetadata
|
|
38
|
+
nodeId: getWorkflowNodeIdFromMetadata(startMetadata),
|
|
35
39
|
agentSessionId: startMetadata.agentSessionId
|
|
36
40
|
};
|
|
37
41
|
}
|
|
@@ -40,7 +44,7 @@ function inferNextNode(messages, definition) {
|
|
|
40
44
|
const callMetadata = lastCall.metadata;
|
|
41
45
|
return {
|
|
42
46
|
type: "resume_node",
|
|
43
|
-
nodeId: callMetadata
|
|
47
|
+
nodeId: getWorkflowNodeIdFromMetadata(callMetadata),
|
|
44
48
|
agentSessionId: callMetadata.agentSessionId
|
|
45
49
|
};
|
|
46
50
|
}
|
|
@@ -88,7 +92,7 @@ function parseNodeOutputs(messages) {
|
|
|
88
92
|
const metadata = msg.metadata;
|
|
89
93
|
const msgType = metadata?.type;
|
|
90
94
|
if (msgType === "workflow.node.start" || msgType === "workflow.node.call") {
|
|
91
|
-
lastStartNodeId = metadata
|
|
95
|
+
lastStartNodeId = getWorkflowNodeIdFromMetadata(metadata) ?? null;
|
|
92
96
|
} else if ((msgType === "workflow.node.end" || msgType === "workflow.node.result") && lastStartNodeId) {
|
|
93
97
|
try {
|
|
94
98
|
outputs.set(lastStartNodeId, JSON.parse(msg.content));
|
|
@@ -114,6 +118,27 @@ function getAgentSessionIdFromInterrupt(messages) {
|
|
|
114
118
|
const metadata = lastInterrupt.metadata;
|
|
115
119
|
return metadata?.agentSessionId || null;
|
|
116
120
|
}
|
|
121
|
+
function resolveAgentSessionId(nodeId, agentSessionId, agentSessions) {
|
|
122
|
+
if (agentSessionId) {
|
|
123
|
+
return agentSessionId;
|
|
124
|
+
}
|
|
125
|
+
if (!nodeId || !agentSessions?.length) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
return agentSessions.find((ref) => ref.nodeId === nodeId)?.sessionId;
|
|
129
|
+
}
|
|
130
|
+
function enrichResumeInfoWithAgentSessions(resumeInfo, agentSessions) {
|
|
131
|
+
return {
|
|
132
|
+
...resumeInfo,
|
|
133
|
+
agentSessionId: resolveAgentSessionId(resumeInfo.pendingNodeId, resumeInfo.agentSessionId, agentSessions)
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function enrichResumePointWithAgentSessions(resumePoint, agentSessions) {
|
|
137
|
+
return {
|
|
138
|
+
...resumePoint,
|
|
139
|
+
agentSessionId: resolveAgentSessionId(resumePoint.nodeId, resumePoint.agentSessionId, agentSessions)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
117
142
|
function extractResumeInfo(messages) {
|
|
118
143
|
const nodeOutputs = parseNodeOutputs(messages);
|
|
119
144
|
let pendingNodeId;
|
|
@@ -122,16 +147,16 @@ function extractResumeInfo(messages) {
|
|
|
122
147
|
let lastInterruptQuery;
|
|
123
148
|
for (const msg of messages) {
|
|
124
149
|
const metadata = msg.metadata;
|
|
125
|
-
if (metadata?.type === "workflow.node.start") {
|
|
126
|
-
pendingNodeId = metadata
|
|
150
|
+
if (metadata?.type === "workflow.node.start" || metadata?.type === "workflow.node.call") {
|
|
151
|
+
pendingNodeId = getWorkflowNodeIdFromMetadata(metadata);
|
|
127
152
|
if (metadata?.agentSessionId && !agentSessionId) {
|
|
128
153
|
agentSessionId = metadata.agentSessionId;
|
|
129
154
|
}
|
|
130
|
-
} else if (metadata?.type === "workflow.node.end") {
|
|
155
|
+
} else if (metadata?.type === "workflow.node.end" || metadata?.type === "workflow.node.result") {
|
|
131
156
|
pendingNodeId = undefined;
|
|
132
157
|
agentSessionId = undefined;
|
|
133
158
|
} else if (metadata?.type === "workflow.node.interrupt") {
|
|
134
|
-
pendingNodeId = metadata
|
|
159
|
+
pendingNodeId = getWorkflowNodeIdFromMetadata(metadata);
|
|
135
160
|
agentSessionId = metadata.agentSessionId;
|
|
136
161
|
hasInterrupt = true;
|
|
137
162
|
lastInterruptQuery = msg.content;
|
|
@@ -145,10 +170,25 @@ function extractResumeInfo(messages) {
|
|
|
145
170
|
lastInterruptQuery
|
|
146
171
|
};
|
|
147
172
|
}
|
|
148
|
-
|
|
173
|
+
function stripEphemeralResumeInput(input) {
|
|
174
|
+
if (!input) {
|
|
175
|
+
return {};
|
|
176
|
+
}
|
|
177
|
+
const { userQuery, ...rest } = input;
|
|
178
|
+
const workflowInput = Object.keys(rest).length > 0 ? rest : undefined;
|
|
179
|
+
return {
|
|
180
|
+
workflowInput,
|
|
181
|
+
userQuery
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
var init_session_recovery = __esm(() => {
|
|
185
|
+
init_workflow_message_metadata();
|
|
186
|
+
});
|
|
149
187
|
init_session_recovery();
|
|
150
188
|
|
|
151
189
|
export {
|
|
190
|
+
stripEphemeralResumeInput,
|
|
191
|
+
resolveAgentSessionId,
|
|
152
192
|
parseNodeOutputs,
|
|
153
193
|
inferNextNode,
|
|
154
194
|
hasPendingAskUser,
|
|
@@ -156,5 +196,7 @@ export {
|
|
|
156
196
|
findLastStartMessage,
|
|
157
197
|
findLastInterruptMessage,
|
|
158
198
|
findLastCallMessage,
|
|
159
|
-
extractResumeInfo
|
|
199
|
+
extractResumeInfo,
|
|
200
|
+
enrichResumePointWithAgentSessions,
|
|
201
|
+
enrichResumeInfoWithAgentSessions
|
|
160
202
|
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_KEY,
|
|
3
|
+
extractStructuredJsonViaLlm,
|
|
4
|
+
init_workflow_json_output_plugin,
|
|
5
|
+
registerWorkflowJsonOutputPlugin
|
|
6
|
+
} from "./roy-agent-core-dbxm76wf.js";
|
|
1
7
|
import {
|
|
2
8
|
AskUserError,
|
|
3
9
|
init_workflow_hil
|
|
@@ -11,14 +17,29 @@ class AgentComponentAdapter {
|
|
|
11
17
|
agentComponent;
|
|
12
18
|
options;
|
|
13
19
|
_sessionComponent;
|
|
20
|
+
_llmComponent;
|
|
14
21
|
agentSessionPrefix = "agent";
|
|
15
22
|
_currentAgentSessionId;
|
|
16
23
|
pendingSessions = new Map;
|
|
17
24
|
runSessionToAgentSessions = new Map;
|
|
18
|
-
|
|
25
|
+
jsonOutputPluginRegistered = false;
|
|
26
|
+
constructor(agentComponent, options = {}, _sessionComponent, _llmComponent) {
|
|
19
27
|
this.agentComponent = agentComponent;
|
|
20
28
|
this.options = options;
|
|
21
29
|
this._sessionComponent = _sessionComponent;
|
|
30
|
+
this._llmComponent = _llmComponent;
|
|
31
|
+
this.ensureJsonOutputPluginRegistered();
|
|
32
|
+
}
|
|
33
|
+
setLLMComponent(llmComponent) {
|
|
34
|
+
this._llmComponent = llmComponent;
|
|
35
|
+
this.ensureJsonOutputPluginRegistered();
|
|
36
|
+
}
|
|
37
|
+
ensureJsonOutputPluginRegistered() {
|
|
38
|
+
if (this.jsonOutputPluginRegistered || !this._llmComponent) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
registerWorkflowJsonOutputPlugin(this._llmComponent);
|
|
42
|
+
this.jsonOutputPluginRegistered = true;
|
|
22
43
|
}
|
|
23
44
|
setSessionComponent(sessionComponent) {
|
|
24
45
|
this._sessionComponent = sessionComponent;
|
|
@@ -84,6 +105,7 @@ class AgentComponentAdapter {
|
|
|
84
105
|
}
|
|
85
106
|
}
|
|
86
107
|
try {
|
|
108
|
+
const outputSchema = config.options?.outputSchema;
|
|
87
109
|
const context = {};
|
|
88
110
|
if (config.options?.timeout) {
|
|
89
111
|
context.abort = new AbortController;
|
|
@@ -97,11 +119,33 @@ class AgentComponentAdapter {
|
|
|
97
119
|
if (config.options?.deniedTools) {
|
|
98
120
|
context.deniedTools = config.options.deniedTools;
|
|
99
121
|
}
|
|
122
|
+
context.metadata = {
|
|
123
|
+
runId,
|
|
124
|
+
nodeId,
|
|
125
|
+
sessionId: agentSessionId,
|
|
126
|
+
outputSchema
|
|
127
|
+
};
|
|
128
|
+
if (outputSchema) {
|
|
129
|
+
context.pluginEnabled = {
|
|
130
|
+
...context.pluginEnabled ?? {},
|
|
131
|
+
[WORKFLOW_JSON_OUTPUT_PLUGIN_KEY]: true
|
|
132
|
+
};
|
|
133
|
+
}
|
|
100
134
|
if (config.workflowHistory) {
|
|
101
135
|
context.workflowHistory = config.workflowHistory;
|
|
102
136
|
}
|
|
103
|
-
|
|
104
|
-
|
|
137
|
+
let additionInfo = config.prompt;
|
|
138
|
+
let userInput = resumeOptions?.userQuery || "";
|
|
139
|
+
if (agentSessionId && this._sessionComponent && !isResume) {
|
|
140
|
+
try {
|
|
141
|
+
const priorMessages = await this._sessionComponent.getMessages(agentSessionId);
|
|
142
|
+
const hasPriorAssistant = priorMessages.some((m) => m.role === "assistant" && (Boolean(m.content?.trim()) || m.parts?.some((p) => p.type === "tool-call" || p.type === "text")));
|
|
143
|
+
if (hasPriorAssistant && !userInput) {
|
|
144
|
+
userInput = "[Workflow re-run] Inputs were updated since your last reply. Produce a new result for this run.";
|
|
145
|
+
}
|
|
146
|
+
} catch {}
|
|
147
|
+
}
|
|
148
|
+
context.additionInfo = additionInfo;
|
|
105
149
|
const result = await this.agentComponent.run(config.type || "general", userInput, context);
|
|
106
150
|
if (result.error?.startsWith("__ASK_USER_ERROR__:")) {
|
|
107
151
|
const jsonStr = result.error.substring("__ASK_USER_ERROR__:".length);
|
|
@@ -112,16 +156,17 @@ class AgentComponentAdapter {
|
|
|
112
156
|
if (agentSessionId) {
|
|
113
157
|
this.pendingSessions.delete(agentSessionId);
|
|
114
158
|
}
|
|
115
|
-
const
|
|
159
|
+
const structuredOutput = await this.resolveStructuredOutput(result.structuredOutput, outputSchema, config, agentSessionId);
|
|
116
160
|
return {
|
|
117
|
-
output: result.finalText
|
|
161
|
+
output: structuredOutput ?? result.finalText ?? result.output,
|
|
162
|
+
structuredOutput,
|
|
118
163
|
metadata: {
|
|
119
164
|
duration,
|
|
120
165
|
iterations: result.iterations,
|
|
121
166
|
toolCalls: result.toolCalls?.length,
|
|
167
|
+
toolCallsDetail: result.toolCalls,
|
|
122
168
|
agentSessionId
|
|
123
|
-
}
|
|
124
|
-
messages
|
|
169
|
+
}
|
|
125
170
|
};
|
|
126
171
|
} catch (error) {
|
|
127
172
|
const isAskUserError = error instanceof Error && error.name === "AskUserError";
|
|
@@ -171,10 +216,33 @@ class AgentComponentAdapter {
|
|
|
171
216
|
getAgentComponent() {
|
|
172
217
|
return this.agentComponent;
|
|
173
218
|
}
|
|
219
|
+
async resolveStructuredOutput(fromPlugin, outputSchema, config, agentSessionId) {
|
|
220
|
+
if (fromPlugin) {
|
|
221
|
+
return fromPlugin;
|
|
222
|
+
}
|
|
223
|
+
if (!outputSchema || !this._llmComponent || !agentSessionId || !this._sessionComponent) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
const sessionMessages = await this._sessionComponent.getMessages(agentSessionId);
|
|
228
|
+
const history = sessionMessages.map((m) => ({
|
|
229
|
+
role: m.role,
|
|
230
|
+
content: m.content ?? ""
|
|
231
|
+
}));
|
|
232
|
+
return await extractStructuredJsonViaLlm(this._llmComponent, history, outputSchema, {
|
|
233
|
+
model: config.options?.model,
|
|
234
|
+
sessionId: agentSessionId
|
|
235
|
+
});
|
|
236
|
+
} catch (error) {
|
|
237
|
+
console.warn("Workflow JSON extraction fallback failed:", error);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
174
241
|
agentSessionPrefixes = new Map;
|
|
175
242
|
}
|
|
176
243
|
var init_agent_component_adapter = __esm(() => {
|
|
177
244
|
init_workflow_hil();
|
|
245
|
+
init_workflow_json_output_plugin();
|
|
178
246
|
});
|
|
179
247
|
|
|
180
248
|
export { AgentComponentAdapter, init_agent_component_adapter };
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
init_decorator
|
|
10
10
|
} from "./roy-agent-core-q5qj0fes.js";
|
|
11
11
|
import {
|
|
12
|
-
getEnvContextOrEmpty
|
|
13
|
-
|
|
12
|
+
getEnvContextOrEmpty,
|
|
13
|
+
init_context
|
|
14
|
+
} from "./roy-agent-core-rm3hay00.js";
|
|
14
15
|
import {
|
|
15
16
|
createLogger,
|
|
16
17
|
init_logger
|
|
@@ -387,6 +388,7 @@ ${prompt}`;
|
|
|
387
388
|
// src/env/task/plugins/lark-cli-task-notify-plugin.ts
|
|
388
389
|
init_decorator();
|
|
389
390
|
init_logger();
|
|
391
|
+
init_context();
|
|
390
392
|
import { spawn } from "child_process";
|
|
391
393
|
var logger2 = createLogger("lark-cli:task-notify");
|
|
392
394
|
function isTaskNotifyDebugEnabled() {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_KEY,
|
|
3
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_NAME,
|
|
4
|
+
WORKFLOW_JSON_OUTPUT_SOURCE_ID,
|
|
5
|
+
extractStructuredJsonViaLlm,
|
|
6
|
+
init_workflow_json_output_plugin,
|
|
7
|
+
isWorkflowJsonOutputEnabled,
|
|
8
|
+
registerWorkflowJsonOutputPlugin,
|
|
9
|
+
runWorkflowJsonOutputExtraction,
|
|
10
|
+
unregisterWorkflowJsonOutputPlugin
|
|
11
|
+
} from "./roy-agent-core-dbxm76wf.js";
|
|
12
|
+
import"./roy-agent-core-nhfy3p8q.js";
|
|
13
|
+
import"./roy-agent-core-e25xkv53.js";
|
|
14
|
+
import"./roy-agent-core-rgj6hq15.js";
|
|
15
|
+
import"./roy-agent-core-rm3hay00.js";
|
|
16
|
+
import"./roy-agent-core-10n2jh7p.js";
|
|
17
|
+
import"./roy-agent-core-58k274fg.js";
|
|
18
|
+
import"./roy-agent-core-c6592r3c.js";
|
|
19
|
+
import"./roy-agent-core-fs0mn2jk.js";
|
|
20
|
+
init_workflow_json_output_plugin();
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
unregisterWorkflowJsonOutputPlugin,
|
|
24
|
+
runWorkflowJsonOutputExtraction,
|
|
25
|
+
registerWorkflowJsonOutputPlugin,
|
|
26
|
+
isWorkflowJsonOutputEnabled,
|
|
27
|
+
extractStructuredJsonViaLlm,
|
|
28
|
+
WORKFLOW_JSON_OUTPUT_SOURCE_ID,
|
|
29
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_NAME,
|
|
30
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_KEY
|
|
31
|
+
};
|