@ai-setting/roy-agent-core 1.5.70 → 1.5.72
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 +4 -4
- package/dist/env/index.js +8 -8
- package/dist/env/llm/index.js +3 -3
- package/dist/env/session/index.js +4 -4
- package/dist/env/session/storage/index.js +6 -3
- package/dist/env/workflow/engine/index.js +3 -3
- package/dist/env/workflow/index.js +4 -4
- package/dist/index.js +11 -11
- package/dist/shared/@ai-setting/{roy-agent-core-ke7wmra6.js → roy-agent-core-3f0bkm7q.js} +57 -28
- package/dist/shared/@ai-setting/{roy-agent-core-56xsjjyw.js → roy-agent-core-4hh4s0w1.js} +38 -6
- package/dist/shared/@ai-setting/{roy-agent-core-zgtmazxg.js → roy-agent-core-9adgwts7.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4hctvbr8.js → roy-agent-core-9dja7n0q.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-ggvv4snf.js → roy-agent-core-assbmxe0.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-1r86pags.js → roy-agent-core-c1j7ev4e.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-1yaa58cp.js → roy-agent-core-c4hhd1f2.js} +3 -3
- package/dist/shared/@ai-setting/roy-agent-core-ce10b0ez.js +44 -0
- package/dist/shared/@ai-setting/{roy-agent-core-6d5v531t.js → roy-agent-core-fkv7ewz9.js} +2 -1
- package/dist/shared/@ai-setting/{roy-agent-core-wnmtdnd7.js → roy-agent-core-jymz9fzp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-33855dsc.js → roy-agent-core-q7sqeax6.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-8e1cac6w.js → roy-agent-core-smgpr5tz.js} +8 -6
- package/dist/shared/@ai-setting/{roy-agent-core-8vkr264k.js → roy-agent-core-yakvqh1d.js} +1 -1
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-fp6f15av.js +0 -23
package/dist/env/agent/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentComponent,
|
|
3
3
|
AgentComponentConfigSchema
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
5
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-9dja7n0q.js";
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-3f0bkm7q.js";
|
|
6
6
|
import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
@@ -10,8 +10,8 @@ import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
|
10
10
|
import {
|
|
11
11
|
SummaryAgent
|
|
12
12
|
} from "../../shared/@ai-setting/roy-agent-core-x3gtyqax.js";
|
|
13
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
14
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-c1j7ev4e.js";
|
|
14
|
+
import"../../shared/@ai-setting/roy-agent-core-ce10b0ez.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
16
16
|
import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-b8r4tfqq.js";
|
package/dist/env/index.js
CHANGED
|
@@ -21,11 +21,11 @@ import"../shared/@ai-setting/roy-agent-core-xp8xrxgc.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-c4hhd1f2.js";
|
|
25
25
|
import"../shared/@ai-setting/roy-agent-core-fjexv5nm.js";
|
|
26
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
27
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
28
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
26
|
+
import"../shared/@ai-setting/roy-agent-core-4hh4s0w1.js";
|
|
27
|
+
import"../shared/@ai-setting/roy-agent-core-9adgwts7.js";
|
|
28
|
+
import"../shared/@ai-setting/roy-agent-core-fkv7ewz9.js";
|
|
29
29
|
import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
30
30
|
import"../shared/@ai-setting/roy-agent-core-99j4w3fx.js";
|
|
31
31
|
import"../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
@@ -39,8 +39,8 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
39
39
|
import {
|
|
40
40
|
AgentComponent,
|
|
41
41
|
AgentComponentConfigSchema
|
|
42
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
43
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
42
|
+
} from "../shared/@ai-setting/roy-agent-core-9dja7n0q.js";
|
|
43
|
+
import"../shared/@ai-setting/roy-agent-core-3f0bkm7q.js";
|
|
44
44
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
45
45
|
import {
|
|
46
46
|
TaskComponent
|
|
@@ -64,8 +64,8 @@ import"../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
|
64
64
|
import"../shared/@ai-setting/roy-agent-core-fnv3ev18.js";
|
|
65
65
|
import"../shared/@ai-setting/roy-agent-core-djtkntar.js";
|
|
66
66
|
import"../shared/@ai-setting/roy-agent-core-x3gtyqax.js";
|
|
67
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
68
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
67
|
+
import"../shared/@ai-setting/roy-agent-core-c1j7ev4e.js";
|
|
68
|
+
import"../shared/@ai-setting/roy-agent-core-ce10b0ez.js";
|
|
69
69
|
import"../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
70
70
|
import {
|
|
71
71
|
BaseComponent
|
package/dist/env/llm/index.js
CHANGED
|
@@ -8,15 +8,15 @@ 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-smgpr5tz.js";
|
|
12
12
|
import {
|
|
13
13
|
createInvokeConfig,
|
|
14
14
|
invoke,
|
|
15
15
|
invokeNonStream,
|
|
16
16
|
parseModelString
|
|
17
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
} from "../../shared/@ai-setting/roy-agent-core-3f0bkm7q.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
19
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
19
|
+
import"../../shared/@ai-setting/roy-agent-core-ce10b0ez.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
21
21
|
import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
|
|
22
22
|
import"../../shared/@ai-setting/roy-agent-core-b8r4tfqq.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SessionComponent
|
|
3
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../../shared/@ai-setting/roy-agent-core-jymz9fzp.js";
|
|
4
4
|
import"../../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
5
5
|
import {
|
|
6
6
|
MemorySessionStore
|
|
7
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
7
|
+
} from "../../shared/@ai-setting/roy-agent-core-q7sqeax6.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-x3gtyqax.js";
|
|
9
9
|
import {
|
|
10
10
|
SessionMessageConverter
|
|
11
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
12
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
} from "../../shared/@ai-setting/roy-agent-core-c1j7ev4e.js";
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-ce10b0ez.js";
|
|
13
13
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
14
14
|
import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-b8r4tfqq.js";
|
|
@@ -3,9 +3,12 @@ import {
|
|
|
3
3
|
SQLiteSessionStore,
|
|
4
4
|
getDefaultDataDir,
|
|
5
5
|
getDefaultSessionDbPath
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
8
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-q7sqeax6.js";
|
|
7
|
+
import"../../../shared/@ai-setting/roy-agent-core-c1j7ev4e.js";
|
|
8
|
+
import"../../../shared/@ai-setting/roy-agent-core-ce10b0ez.js";
|
|
9
|
+
import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
|
|
10
|
+
import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
|
|
11
|
+
import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
|
|
9
12
|
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
10
13
|
export {
|
|
11
14
|
getDefaultSessionDbPath,
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
Scheduler,
|
|
7
7
|
WorkflowEngine,
|
|
8
8
|
init_engine
|
|
9
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
10
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
11
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
} from "../../../shared/@ai-setting/roy-agent-core-4hh4s0w1.js";
|
|
10
|
+
import"../../../shared/@ai-setting/roy-agent-core-9adgwts7.js";
|
|
11
|
+
import"../../../shared/@ai-setting/roy-agent-core-fkv7ewz9.js";
|
|
12
12
|
import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
13
13
|
import"../../../shared/@ai-setting/roy-agent-core-99j4w3fx.js";
|
|
14
14
|
import"../../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkflowComponent
|
|
3
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../../shared/@ai-setting/roy-agent-core-c4hhd1f2.js";
|
|
4
4
|
import"../../shared/@ai-setting/roy-agent-core-fjexv5nm.js";
|
|
5
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
6
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-4hh4s0w1.js";
|
|
6
|
+
import"../../shared/@ai-setting/roy-agent-core-9adgwts7.js";
|
|
7
|
+
import"../../shared/@ai-setting/roy-agent-core-fkv7ewz9.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-99j4w3fx.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ModelLimitsSchema,
|
|
12
12
|
ProviderCapabilitiesSchema,
|
|
13
13
|
ProviderConfigSchema
|
|
14
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
14
|
+
} from "./shared/@ai-setting/roy-agent-core-smgpr5tz.js";
|
|
15
15
|
import {
|
|
16
16
|
ConfigComponent
|
|
17
17
|
} from "./shared/@ai-setting/roy-agent-core-prdngx28.js";
|
|
@@ -89,14 +89,14 @@ import {
|
|
|
89
89
|
} from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
90
90
|
import {
|
|
91
91
|
WorkflowComponent
|
|
92
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
92
|
+
} from "./shared/@ai-setting/roy-agent-core-c4hhd1f2.js";
|
|
93
93
|
import {
|
|
94
94
|
init_node_registry_helper,
|
|
95
95
|
registerDecoratorNodeType
|
|
96
96
|
} from "./shared/@ai-setting/roy-agent-core-fjexv5nm.js";
|
|
97
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
98
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
99
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
97
|
+
import"./shared/@ai-setting/roy-agent-core-4hh4s0w1.js";
|
|
98
|
+
import"./shared/@ai-setting/roy-agent-core-9adgwts7.js";
|
|
99
|
+
import"./shared/@ai-setting/roy-agent-core-fkv7ewz9.js";
|
|
100
100
|
import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
101
101
|
import"./shared/@ai-setting/roy-agent-core-99j4w3fx.js";
|
|
102
102
|
import"./shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
@@ -116,13 +116,13 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
116
116
|
import {
|
|
117
117
|
AgentComponent,
|
|
118
118
|
AgentComponentConfigSchema
|
|
119
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
119
|
+
} from "./shared/@ai-setting/roy-agent-core-9dja7n0q.js";
|
|
120
120
|
import {
|
|
121
121
|
createInvokeConfig,
|
|
122
122
|
invoke,
|
|
123
123
|
invokeNonStream,
|
|
124
124
|
parseModelString
|
|
125
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
125
|
+
} from "./shared/@ai-setting/roy-agent-core-3f0bkm7q.js";
|
|
126
126
|
import {
|
|
127
127
|
AskUserError,
|
|
128
128
|
init_workflow_hil
|
|
@@ -171,14 +171,14 @@ import"./shared/@ai-setting/roy-agent-core-fnv3ev18.js";
|
|
|
171
171
|
import"./shared/@ai-setting/roy-agent-core-djtkntar.js";
|
|
172
172
|
import {
|
|
173
173
|
SessionComponent
|
|
174
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
174
|
+
} from "./shared/@ai-setting/roy-agent-core-jymz9fzp.js";
|
|
175
175
|
import"./shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
176
176
|
import {
|
|
177
177
|
MemorySessionStore
|
|
178
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
178
|
+
} from "./shared/@ai-setting/roy-agent-core-q7sqeax6.js";
|
|
179
179
|
import"./shared/@ai-setting/roy-agent-core-x3gtyqax.js";
|
|
180
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
181
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
180
|
+
import"./shared/@ai-setting/roy-agent-core-c1j7ev4e.js";
|
|
181
|
+
import"./shared/@ai-setting/roy-agent-core-ce10b0ez.js";
|
|
182
182
|
import"./shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
183
183
|
import {
|
|
184
184
|
BaseComponent
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
safeParseToolArgs
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-ce10b0ez.js";
|
|
4
4
|
import {
|
|
5
5
|
createLogger,
|
|
6
6
|
init_logger
|
|
@@ -253,9 +253,9 @@ function processThinkingStream(textDelta, config, state) {
|
|
|
253
253
|
}
|
|
254
254
|
const tags = config.tags || ["thinking"];
|
|
255
255
|
let remainingText = textDelta;
|
|
256
|
-
const
|
|
257
|
-
let
|
|
258
|
-
let
|
|
256
|
+
const reasoningEvents = [];
|
|
257
|
+
let isOpen = state.isOpen;
|
|
258
|
+
let currentContent = state.content;
|
|
259
259
|
for (const tag of tags) {
|
|
260
260
|
const openTag = `<${tag}>`;
|
|
261
261
|
const closeTag = `</${tag}>`;
|
|
@@ -266,35 +266,35 @@ function processThinkingStream(textDelta, config, state) {
|
|
|
266
266
|
if (openIndex !== -1 && (closeIndex === -1 || openIndex < closeIndex)) {
|
|
267
267
|
const beforeOpen = text.substring(0, openIndex);
|
|
268
268
|
const afterOpen = text.substring(openIndex + openTag.length);
|
|
269
|
-
if (!
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
if (!isOpen) {
|
|
270
|
+
isOpen = true;
|
|
271
|
+
currentContent = "";
|
|
272
|
+
reasoningEvents.push("");
|
|
273
273
|
}
|
|
274
274
|
result += beforeOpen;
|
|
275
275
|
const innerCloseIndex = afterOpen.toLowerCase().indexOf(closeTag.toLowerCase());
|
|
276
276
|
if (innerCloseIndex !== -1) {
|
|
277
277
|
const thinkingContent = afterOpen.substring(0, innerCloseIndex);
|
|
278
278
|
const afterClose = afterOpen.substring(innerCloseIndex + closeTag.length);
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
currentContent += thinkingContent;
|
|
280
|
+
reasoningEvents.push(currentContent);
|
|
281
|
+
isOpen = false;
|
|
282
|
+
currentContent = "";
|
|
283
283
|
result += afterClose;
|
|
284
284
|
} else {
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
currentContent += afterOpen;
|
|
286
|
+
reasoningEvents.push(currentContent);
|
|
287
287
|
result += "";
|
|
288
288
|
}
|
|
289
289
|
remainingText = result;
|
|
290
290
|
} else if (closeIndex !== -1) {
|
|
291
291
|
const beforeClose = text.substring(0, closeIndex);
|
|
292
292
|
const afterClose = text.substring(closeIndex + closeTag.length);
|
|
293
|
-
if (
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
293
|
+
if (isOpen) {
|
|
294
|
+
currentContent += beforeClose;
|
|
295
|
+
reasoningEvents.push(currentContent);
|
|
296
|
+
isOpen = false;
|
|
297
|
+
currentContent = "";
|
|
298
298
|
result = afterClose;
|
|
299
299
|
} else {
|
|
300
300
|
result = text;
|
|
@@ -302,16 +302,16 @@ function processThinkingStream(textDelta, config, state) {
|
|
|
302
302
|
remainingText = result;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
if (
|
|
306
|
-
|
|
307
|
-
|
|
305
|
+
if (isOpen && remainingText === textDelta) {
|
|
306
|
+
currentContent += remainingText;
|
|
307
|
+
reasoningEvents.push(currentContent);
|
|
308
308
|
remainingText = "";
|
|
309
309
|
}
|
|
310
310
|
return {
|
|
311
311
|
cleanedText: remainingText,
|
|
312
|
-
isThinkingTagOpen:
|
|
313
|
-
currentThinkingContent:
|
|
314
|
-
reasoningEvents
|
|
312
|
+
isThinkingTagOpen: isOpen,
|
|
313
|
+
currentThinkingContent: currentContent,
|
|
314
|
+
reasoningEvents
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
async function invoke(config, options, ctx) {
|
|
@@ -389,16 +389,17 @@ async function invoke(config, options, ctx) {
|
|
|
389
389
|
let reasoningContent = "";
|
|
390
390
|
const toolCalls = [];
|
|
391
391
|
let usageInfo;
|
|
392
|
+
const textDeltaLog = [];
|
|
392
393
|
let isThinkingTagOpen = false;
|
|
393
394
|
let currentThinkingContent = "";
|
|
394
395
|
for await (const part of result.fullStream) {
|
|
395
396
|
const streamPart = part;
|
|
397
|
+
const thinkingConfig = config.options?.thinkingInText;
|
|
396
398
|
switch (streamPart.type) {
|
|
397
399
|
case "text-delta": {
|
|
398
400
|
const textDelta = getStreamPartText(streamPart);
|
|
399
401
|
if (!textDelta)
|
|
400
402
|
break;
|
|
401
|
-
const thinkingConfig = config.options?.thinkingInText;
|
|
402
403
|
if (thinkingConfig?.enabled) {
|
|
403
404
|
const thinkingResult = processThinkingStream(textDelta, thinkingConfig, {
|
|
404
405
|
isOpen: isThinkingTagOpen,
|
|
@@ -421,6 +422,9 @@ async function invoke(config, options, ctx) {
|
|
|
421
422
|
} else {
|
|
422
423
|
fullContent += textDelta;
|
|
423
424
|
rawFullContent += textDelta;
|
|
425
|
+
if (process.env.DEBUG_DUPLICATE) {
|
|
426
|
+
textDeltaLog.push(textDelta);
|
|
427
|
+
}
|
|
424
428
|
if (emitToEnv) {
|
|
425
429
|
emitToEnv({ type: "text", content: fullContent, delta: textDelta });
|
|
426
430
|
}
|
|
@@ -431,6 +435,8 @@ async function invoke(config, options, ctx) {
|
|
|
431
435
|
const reasoningDelta = getStreamPartText(streamPart);
|
|
432
436
|
if (!reasoningDelta)
|
|
433
437
|
break;
|
|
438
|
+
if (thinkingConfig?.enabled)
|
|
439
|
+
break;
|
|
434
440
|
reasoningContent += reasoningDelta;
|
|
435
441
|
if (emitToEnv) {
|
|
436
442
|
emitToEnv({ type: "reasoning", content: reasoningContent, delta: reasoningDelta });
|
|
@@ -476,12 +482,35 @@ async function invoke(config, options, ctx) {
|
|
|
476
482
|
}
|
|
477
483
|
});
|
|
478
484
|
}
|
|
485
|
+
const thinkingOpts = config.options?.thinkingInText;
|
|
486
|
+
const outputContent = thinkingOpts?.removeFromOutput ? fullContent : rawFullContent;
|
|
487
|
+
if (process.env.DEBUG_DUPLICATE) {
|
|
488
|
+
const outputLines = outputContent.split(`
|
|
489
|
+
`).filter(Boolean);
|
|
490
|
+
const uniqueLines = new Set(outputLines);
|
|
491
|
+
if (outputLines.length !== uniqueLines.size) {
|
|
492
|
+
logger.warn("[DEBUG_DUPLICATE] outputContent has duplicate lines", {
|
|
493
|
+
fullContent,
|
|
494
|
+
rawFullContent,
|
|
495
|
+
outputContent,
|
|
496
|
+
reasoningContent: reasoningContent || "",
|
|
497
|
+
textDeltas: textDeltaLog
|
|
498
|
+
});
|
|
499
|
+
} else {
|
|
500
|
+
logger.info("[DEBUG_DUPLICATE] outputContent OK", {
|
|
501
|
+
charCount: outputContent.length,
|
|
502
|
+
lineCount: outputLines.length,
|
|
503
|
+
uniqueLineCount: uniqueLines.size,
|
|
504
|
+
hasReasoning: !!reasoningContent
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
}
|
|
479
508
|
if (toolCalls.length > 0) {
|
|
480
509
|
const firstToolCall = toolCalls[0];
|
|
481
510
|
return {
|
|
482
511
|
toolCallId: firstToolCall.id,
|
|
483
512
|
result: JSON.stringify({
|
|
484
|
-
content:
|
|
513
|
+
content: outputContent,
|
|
485
514
|
reasoning: reasoningContent || undefined,
|
|
486
515
|
tool_calls: toolCalls.map((tc) => ({
|
|
487
516
|
id: tc.id,
|
|
@@ -496,7 +525,7 @@ async function invoke(config, options, ctx) {
|
|
|
496
525
|
return {
|
|
497
526
|
toolCallId: "invoke-" + Date.now(),
|
|
498
527
|
result: JSON.stringify({
|
|
499
|
-
content:
|
|
528
|
+
content: outputContent,
|
|
500
529
|
reasoning: reasoningContent || undefined,
|
|
501
530
|
usage: usageInfo,
|
|
502
531
|
model
|
|
@@ -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-9adgwts7.js";
|
|
5
5
|
import {
|
|
6
6
|
buildWorkflowNodeMetadata,
|
|
7
7
|
getWorkflowNodeIdFromMetadata,
|
|
@@ -210,8 +210,40 @@ class DAGManager {
|
|
|
210
210
|
const deps = node.depends_on || [];
|
|
211
211
|
dependencies.set(node.id, [...deps]);
|
|
212
212
|
}
|
|
213
|
+
if (this.workflow.edges) {
|
|
214
|
+
for (const edge of this.workflow.edges) {
|
|
215
|
+
const targetDeps = dependencies.get(edge.to);
|
|
216
|
+
if (!targetDeps)
|
|
217
|
+
continue;
|
|
218
|
+
if (targetDeps.includes(edge.from))
|
|
219
|
+
continue;
|
|
220
|
+
if (!this.isReachable(edge.from, edge.to, dependencies)) {
|
|
221
|
+
targetDeps.push(edge.from);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
213
225
|
return dependencies;
|
|
214
226
|
}
|
|
227
|
+
isReachable(source, target, dependencies) {
|
|
228
|
+
if (source === target)
|
|
229
|
+
return true;
|
|
230
|
+
const visited = new Set;
|
|
231
|
+
const queue = [source];
|
|
232
|
+
while (queue.length > 0) {
|
|
233
|
+
const current = queue.shift();
|
|
234
|
+
if (current === target)
|
|
235
|
+
return true;
|
|
236
|
+
if (visited.has(current))
|
|
237
|
+
continue;
|
|
238
|
+
visited.add(current);
|
|
239
|
+
const deps = dependencies.get(current) || [];
|
|
240
|
+
for (const dep of deps) {
|
|
241
|
+
if (!visited.has(dep))
|
|
242
|
+
queue.push(dep);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
215
247
|
buildDependentsMap(dependencies) {
|
|
216
248
|
const dependentsMap = new Map;
|
|
217
249
|
for (const nodeId of dependencies.keys()) {
|
|
@@ -368,12 +400,12 @@ class DAGManager {
|
|
|
368
400
|
return ready;
|
|
369
401
|
}
|
|
370
402
|
areDependenciesMet(nodeId, completedNodes) {
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
403
|
+
const analysis = this.analyze();
|
|
404
|
+
const deps = analysis.dependencies.get(nodeId);
|
|
405
|
+
if (!deps) {
|
|
406
|
+
return true;
|
|
374
407
|
}
|
|
375
|
-
const
|
|
376
|
-
for (const dep of dependencies) {
|
|
408
|
+
for (const dep of deps) {
|
|
377
409
|
if (!completedNodes.has(dep)) {
|
|
378
410
|
return false;
|
|
379
411
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withTimeout
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-3f0bkm7q.js";
|
|
4
4
|
import {
|
|
5
5
|
AskUserError,
|
|
6
6
|
init_workflow_hil
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
} from "./roy-agent-core-ctdhjv68.js";
|
|
14
14
|
import {
|
|
15
15
|
SessionMessageConverter
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-c1j7ev4e.js";
|
|
17
17
|
import {
|
|
18
18
|
safeParseToolArgs
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-ce10b0ez.js";
|
|
20
20
|
import {
|
|
21
21
|
envKeyToConfigKey
|
|
22
22
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
@@ -112,7 +112,7 @@ function toLLMMessage(msg) {
|
|
|
112
112
|
toolName = toolResult?.toolName;
|
|
113
113
|
} else {
|
|
114
114
|
const toolCallParts = msg.content.filter((part) => part.type === "tool-call");
|
|
115
|
-
const contentParts = msg.content.filter((part) => part.type === "text"
|
|
115
|
+
const contentParts = msg.content.filter((part) => part.type === "text").map((part) => part.text || "");
|
|
116
116
|
content = contentParts.join(`
|
|
117
117
|
`);
|
|
118
118
|
if (msg.role === "assistant" && toolCallParts.length > 0) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentComponentAdapter,
|
|
3
3
|
init_agent_component_adapter
|
|
4
|
-
} from "./roy-agent-core-
|
|
5
|
-
import"./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-9adgwts7.js";
|
|
5
|
+
import"./roy-agent-core-fkv7ewz9.js";
|
|
6
6
|
import"./roy-agent-core-nhfy3p8q.js";
|
|
7
7
|
import"./roy-agent-core-e25xkv53.js";
|
|
8
8
|
import"./roy-agent-core-7tp56w6n.js";
|
|
@@ -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-4hh4s0w1.js";
|
|
10
10
|
import {
|
|
11
11
|
WorkflowService
|
|
12
12
|
} from "./roy-agent-core-4t40mkpv.js";
|
|
@@ -136,7 +136,7 @@ class WorkflowComponent extends BaseComponent {
|
|
|
136
136
|
const agentComponent = this._workflowEnv.getComponent("agent");
|
|
137
137
|
const llmComponent = this._workflowEnv.getComponent("llm");
|
|
138
138
|
if (agentComponent) {
|
|
139
|
-
const { AgentComponentAdapter } = await import("./roy-agent-core-
|
|
139
|
+
const { AgentComponentAdapter } = await import("./roy-agent-core-assbmxe0.js");
|
|
140
140
|
agentRunner = new AgentComponentAdapter(agentComponent, {}, this.sessionComponent, llmComponent);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -208,7 +208,7 @@ class WorkflowComponent extends BaseComponent {
|
|
|
208
208
|
const sessionComponent = this._workflowEnv?.getComponent("session");
|
|
209
209
|
componentLogger.info(`initSqliteService - toolComponent: ${!!toolComponent}, llmComponent: ${!!llmComponent}, skillRegistry: ${!!skillComponent}, sessionComponent: ${!!sessionComponent}`);
|
|
210
210
|
if (llmComponent) {
|
|
211
|
-
const { registerWorkflowJsonOutputPlugin } = await import("./roy-agent-core-
|
|
211
|
+
const { registerWorkflowJsonOutputPlugin } = await import("./roy-agent-core-yakvqh1d.js");
|
|
212
212
|
registerWorkflowJsonOutputPlugin(llmComponent);
|
|
213
213
|
}
|
|
214
214
|
this.createService({
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLogger,
|
|
3
|
+
init_logger
|
|
4
|
+
} from "./roy-agent-core-shme7set.js";
|
|
5
|
+
|
|
6
|
+
// src/env/llm/tool-args-parser.ts
|
|
7
|
+
init_logger();
|
|
8
|
+
var logger = createLogger("llm:tool-args-parser");
|
|
9
|
+
var MAX_SAFE_DEPTH = 5;
|
|
10
|
+
function safeParseToolArgs(args, depth = 0) {
|
|
11
|
+
if (depth >= MAX_SAFE_DEPTH) {
|
|
12
|
+
logger.warn(`[safeParseToolArgs] Max recursion depth (${MAX_SAFE_DEPTH}) exceeded at depth ${depth}. ` + "Input may be malicious or abnormally deeply nested. Returning empty object.", { depth, argsType: typeof args });
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
if (typeof args === "object" && args !== null && !Array.isArray(args)) {
|
|
16
|
+
return args;
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(args)) {
|
|
19
|
+
logger.debug(`[safeParseToolArgs] Input is an array. Tool arguments should be objects. Returning empty object.`, { depth, arrayLength: args.length });
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
if (typeof args === "string") {
|
|
23
|
+
try {
|
|
24
|
+
const parsed = JSON.parse(args);
|
|
25
|
+
if (typeof parsed === "string") {
|
|
26
|
+
logger.debug(`[safeParseToolArgs] Detected double/multi-stringified JSON at depth ${depth}. ` + "LLM may be double-stringifying tool arguments. Parsing recursively.", { depth, parsedLength: parsed.length });
|
|
27
|
+
return safeParseToolArgs(parsed, depth + 1);
|
|
28
|
+
}
|
|
29
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
30
|
+
return parsed;
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(parsed)) {
|
|
33
|
+
logger.debug(`[safeParseToolArgs] Parsed result is an array at depth ${depth}. ` + "Tool arguments should be objects, not arrays. Returning empty object.", { depth, parsedLength: parsed.length });
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
return { value: parsed };
|
|
37
|
+
} catch {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { safeParseToolArgs };
|
|
@@ -159,7 +159,8 @@ function toLLMMessage(msg) {
|
|
|
159
159
|
name: toolResult?.toolName
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
const text = msg.content.filter((part) => part.type === "text").map((part) => part.text ?? "").join(
|
|
162
|
+
const text = msg.content.filter((part) => part.type === "text").map((part) => part.text ?? "").join(`
|
|
163
|
+
`);
|
|
163
164
|
const toolCallParts = msg.content.filter((part) => part.type === "tool-call");
|
|
164
165
|
const toolCalls = msg.role === "assistant" && toolCallParts.length > 0 ? toolCallParts.map((part) => {
|
|
165
166
|
const argsString = typeof part.input === "string" ? part.input : JSON.stringify(part.input ?? {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
invoke
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-3f0bkm7q.js";
|
|
4
4
|
import {
|
|
5
5
|
ContextError,
|
|
6
6
|
ErrorCodes
|
|
@@ -631,7 +631,9 @@ class LLMComponent extends BaseComponent {
|
|
|
631
631
|
toolCalls: msg.toolCalls
|
|
632
632
|
}));
|
|
633
633
|
const provider = this.getProvider(providerId);
|
|
634
|
-
const
|
|
634
|
+
const capabilities = provider?.capabilities;
|
|
635
|
+
const thinkingInText = capabilities?.thinkingInText;
|
|
636
|
+
const effectiveThinkingInText = thinkingInText !== undefined ? thinkingInText : undefined;
|
|
635
637
|
return {
|
|
636
638
|
providerId,
|
|
637
639
|
model,
|
|
@@ -639,12 +641,12 @@ class LLMComponent extends BaseComponent {
|
|
|
639
641
|
model: `${providerId}/${model}`,
|
|
640
642
|
apiKey,
|
|
641
643
|
baseURL: provider?.baseURL,
|
|
642
|
-
...
|
|
644
|
+
...effectiveThinkingInText?.enabled ? {
|
|
643
645
|
options: {
|
|
644
646
|
thinkingInText: {
|
|
645
|
-
enabled:
|
|
646
|
-
tags:
|
|
647
|
-
removeFromOutput:
|
|
647
|
+
enabled: effectiveThinkingInText.enabled,
|
|
648
|
+
tags: effectiveThinkingInText.tags,
|
|
649
|
+
removeFromOutput: effectiveThinkingInText.removeFromOutput
|
|
648
650
|
}
|
|
649
651
|
}
|
|
650
652
|
} : {}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
tracedExtractStructuredJsonViaLlm,
|
|
11
11
|
tracedRunWorkflowJsonOutputExtraction,
|
|
12
12
|
unregisterWorkflowJsonOutputPlugin
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-fkv7ewz9.js";
|
|
14
14
|
import"./roy-agent-core-nhfy3p8q.js";
|
|
15
15
|
import"./roy-agent-core-e25xkv53.js";
|
|
16
16
|
import"./roy-agent-core-7tp56w6n.js";
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// src/env/llm/tool-args-parser.ts
|
|
2
|
-
function safeParseToolArgs(args) {
|
|
3
|
-
if (typeof args === "object" && args !== null) {
|
|
4
|
-
return args;
|
|
5
|
-
}
|
|
6
|
-
if (typeof args === "string") {
|
|
7
|
-
try {
|
|
8
|
-
const parsed = JSON.parse(args);
|
|
9
|
-
if (typeof parsed === "string") {
|
|
10
|
-
return safeParseToolArgs(parsed);
|
|
11
|
-
}
|
|
12
|
-
if (typeof parsed === "object" && parsed !== null) {
|
|
13
|
-
return parsed;
|
|
14
|
-
}
|
|
15
|
-
return { value: parsed };
|
|
16
|
-
} catch {
|
|
17
|
-
return {};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { safeParseToolArgs };
|