@ai-setting/roy-agent-core 1.5.68 → 1.5.70
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 -3
- package/dist/env/index.js +4 -3
- package/dist/env/llm/index.js +3 -2
- package/dist/env/session/index.js +4 -3
- package/dist/env/session/storage/index.js +3 -2
- package/dist/index.js +7 -6
- package/dist/shared/@ai-setting/{roy-agent-core-ew29335n.js → roy-agent-core-1r86pags.js} +10 -7
- package/dist/shared/@ai-setting/{roy-agent-core-pcjenbaf.js → roy-agent-core-33855dsc.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-08q02yz2.js → roy-agent-core-4hctvbr8.js} +12 -28
- package/dist/shared/@ai-setting/{roy-agent-core-qskhsjmc.js → roy-agent-core-8e1cac6w.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-fp6f15av.js +23 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ecth1zak.js → roy-agent-core-ke7wmra6.js} +11 -13
- package/dist/shared/@ai-setting/{roy-agent-core-jkzgmd1v.js → roy-agent-core-wnmtdnd7.js} +1 -1
- package/package.json +1 -1
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-4hctvbr8.js";
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-ke7wmra6.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,7 +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-
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-1r86pags.js";
|
|
14
|
+
import"../../shared/@ai-setting/roy-agent-core-fp6f15av.js";
|
|
14
15
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
15
16
|
import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
|
|
16
17
|
import"../../shared/@ai-setting/roy-agent-core-b8r4tfqq.js";
|
package/dist/env/index.js
CHANGED
|
@@ -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-4hctvbr8.js";
|
|
43
|
+
import"../shared/@ai-setting/roy-agent-core-ke7wmra6.js";
|
|
44
44
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
45
45
|
import {
|
|
46
46
|
TaskComponent
|
|
@@ -64,7 +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-
|
|
67
|
+
import"../shared/@ai-setting/roy-agent-core-1r86pags.js";
|
|
68
|
+
import"../shared/@ai-setting/roy-agent-core-fp6f15av.js";
|
|
68
69
|
import"../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
69
70
|
import {
|
|
70
71
|
BaseComponent
|
package/dist/env/llm/index.js
CHANGED
|
@@ -8,14 +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-8e1cac6w.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-ke7wmra6.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
19
|
+
import"../../shared/@ai-setting/roy-agent-core-fp6f15av.js";
|
|
19
20
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
20
21
|
import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
|
|
21
22
|
import"../../shared/@ai-setting/roy-agent-core-b8r4tfqq.js";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SessionComponent
|
|
3
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../../shared/@ai-setting/roy-agent-core-wnmtdnd7.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-33855dsc.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-
|
|
11
|
+
} from "../../shared/@ai-setting/roy-agent-core-1r86pags.js";
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-fp6f15av.js";
|
|
12
13
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
13
14
|
import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
|
|
14
15
|
import"../../shared/@ai-setting/roy-agent-core-b8r4tfqq.js";
|
|
@@ -3,8 +3,9 @@ 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-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-33855dsc.js";
|
|
7
|
+
import"../../../shared/@ai-setting/roy-agent-core-1r86pags.js";
|
|
8
|
+
import"../../../shared/@ai-setting/roy-agent-core-fp6f15av.js";
|
|
8
9
|
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
9
10
|
export {
|
|
10
11
|
getDefaultSessionDbPath,
|
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-8e1cac6w.js";
|
|
15
15
|
import {
|
|
16
16
|
ConfigComponent
|
|
17
17
|
} from "./shared/@ai-setting/roy-agent-core-prdngx28.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-4hctvbr8.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-ke7wmra6.js";
|
|
126
126
|
import {
|
|
127
127
|
AskUserError,
|
|
128
128
|
init_workflow_hil
|
|
@@ -171,13 +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-wnmtdnd7.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-33855dsc.js";
|
|
179
179
|
import"./shared/@ai-setting/roy-agent-core-x3gtyqax.js";
|
|
180
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
180
|
+
import"./shared/@ai-setting/roy-agent-core-1r86pags.js";
|
|
181
|
+
import"./shared/@ai-setting/roy-agent-core-fp6f15av.js";
|
|
181
182
|
import"./shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
182
183
|
import {
|
|
183
184
|
BaseComponent
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
safeParseToolArgs
|
|
3
|
+
} from "./roy-agent-core-fp6f15av.js";
|
|
4
|
+
|
|
1
5
|
// src/env/session/session-message-converter.ts
|
|
2
6
|
import { randomUUID } from "crypto";
|
|
3
7
|
var DEFAULT_REASONING_BUDGET_TOKENS = 1e4;
|
|
@@ -25,12 +29,7 @@ class SessionMessageConverter {
|
|
|
25
29
|
const toolPart = part;
|
|
26
30
|
let parsedArgs = {};
|
|
27
31
|
if (typeof toolPart.arguments === "string") {
|
|
28
|
-
|
|
29
|
-
const parsed = JSON.parse(toolPart.arguments);
|
|
30
|
-
parsedArgs = typeof parsed === "string" ? { _raw: parsed } : parsed;
|
|
31
|
-
} catch {
|
|
32
|
-
parsedArgs = { _raw: toolPart.arguments };
|
|
33
|
-
}
|
|
32
|
+
parsedArgs = safeParseToolArgs(toolPart.arguments);
|
|
34
33
|
} else {
|
|
35
34
|
parsedArgs = toolPart.arguments;
|
|
36
35
|
}
|
|
@@ -95,11 +94,15 @@ class SessionMessageConverter {
|
|
|
95
94
|
});
|
|
96
95
|
} else if (p.type === "tool-call") {
|
|
97
96
|
hasToolCallPart = true;
|
|
97
|
+
let args = p.input;
|
|
98
|
+
if (typeof p.input === "string") {
|
|
99
|
+
args = safeParseToolArgs(p.input);
|
|
100
|
+
}
|
|
98
101
|
parts.push({
|
|
99
102
|
type: "tool-call",
|
|
100
103
|
toolCallId: p.toolCallId,
|
|
101
104
|
toolName: p.toolName,
|
|
102
|
-
arguments:
|
|
105
|
+
arguments: args,
|
|
103
106
|
state: "pending"
|
|
104
107
|
});
|
|
105
108
|
} else if (p.type === "tool-result") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withTimeout
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-ke7wmra6.js";
|
|
4
4
|
import {
|
|
5
5
|
AskUserError,
|
|
6
6
|
init_workflow_hil
|
|
@@ -13,7 +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-1r86pags.js";
|
|
17
|
+
import {
|
|
18
|
+
safeParseToolArgs
|
|
19
|
+
} from "./roy-agent-core-fp6f15av.js";
|
|
17
20
|
import {
|
|
18
21
|
envKeyToConfigKey
|
|
19
22
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
@@ -108,9 +111,10 @@ function toLLMMessage(msg) {
|
|
|
108
111
|
toolCallId = toolResult?.toolCallId;
|
|
109
112
|
toolName = toolResult?.toolName;
|
|
110
113
|
} else {
|
|
111
|
-
const textParts = msg.content.filter((part) => part.type === "text");
|
|
112
114
|
const toolCallParts = msg.content.filter((part) => part.type === "tool-call");
|
|
113
|
-
|
|
115
|
+
const contentParts = msg.content.filter((part) => part.type === "text" || part.type === "reasoning").map((part) => part.text || "");
|
|
116
|
+
content = contentParts.join(`
|
|
117
|
+
`);
|
|
114
118
|
if (msg.role === "assistant" && toolCallParts.length > 0) {
|
|
115
119
|
toolCalls = toolCallParts.map((part) => {
|
|
116
120
|
const argsString = typeof part.input === "string" ? part.input : JSON.stringify(part.input || {});
|
|
@@ -684,12 +688,7 @@ class AgentComponent extends BaseComponent {
|
|
|
684
688
|
if (tc.function?.arguments) {
|
|
685
689
|
if (typeof tc.function.arguments === "string") {
|
|
686
690
|
argsStr = tc.function.arguments;
|
|
687
|
-
|
|
688
|
-
const parsed = JSON.parse(argsStr);
|
|
689
|
-
argsObj = typeof parsed === "string" ? { _raw: parsed } : parsed;
|
|
690
|
-
} catch {
|
|
691
|
-
argsObj = { _raw: argsStr };
|
|
692
|
-
}
|
|
691
|
+
argsObj = safeParseToolArgs(argsStr);
|
|
693
692
|
} else {
|
|
694
693
|
argsObj = tc.function.arguments;
|
|
695
694
|
argsStr = JSON.stringify(argsObj);
|
|
@@ -697,12 +696,7 @@ class AgentComponent extends BaseComponent {
|
|
|
697
696
|
} else if (tc.arguments) {
|
|
698
697
|
if (typeof tc.arguments === "string") {
|
|
699
698
|
argsStr = tc.arguments;
|
|
700
|
-
|
|
701
|
-
const parsed = JSON.parse(argsStr);
|
|
702
|
-
argsObj = typeof parsed === "string" ? { _raw: parsed } : parsed;
|
|
703
|
-
} catch {
|
|
704
|
-
argsObj = { _raw: argsStr };
|
|
705
|
-
}
|
|
699
|
+
argsObj = safeParseToolArgs(argsStr);
|
|
706
700
|
} else {
|
|
707
701
|
argsObj = tc.arguments;
|
|
708
702
|
argsStr = JSON.stringify(argsObj);
|
|
@@ -737,14 +731,7 @@ class AgentComponent extends BaseComponent {
|
|
|
737
731
|
}
|
|
738
732
|
const func = toolCall.function;
|
|
739
733
|
const tcName = func?.name || toolCall.name || "unknown";
|
|
740
|
-
const tcArgs = func?.arguments ? typeof func.arguments === "string" ? (
|
|
741
|
-
const parsed = JSON.parse(func.arguments);
|
|
742
|
-
if (typeof parsed === "string") {
|
|
743
|
-
logger.warn(`[agent.component] Tool "${tcName}" arguments are double-stringified, wrapping in { _raw }`);
|
|
744
|
-
return { _raw: parsed };
|
|
745
|
-
}
|
|
746
|
-
return parsed;
|
|
747
|
-
})() : func.arguments : toolCall.arguments;
|
|
734
|
+
const tcArgs = func?.arguments ? typeof func.arguments === "string" ? safeParseToolArgs(func.arguments) : func.arguments : toolCall.arguments;
|
|
748
735
|
hookCtx.currentToolCall = {
|
|
749
736
|
id: toolCall.id,
|
|
750
737
|
name: tcName,
|
|
@@ -812,10 +799,7 @@ class AgentComponent extends BaseComponent {
|
|
|
812
799
|
});
|
|
813
800
|
}
|
|
814
801
|
for (const tc of llmOutput.toolCalls) {
|
|
815
|
-
const tcInput = typeof tc.function?.arguments === "string" ? (
|
|
816
|
-
const parsed = JSON.parse(tc.function.arguments);
|
|
817
|
-
return typeof parsed === "string" ? { _raw: parsed } : parsed;
|
|
818
|
-
})() : tc.arguments || {};
|
|
802
|
+
const tcInput = typeof tc.function?.arguments === "string" ? safeParseToolArgs(tc.function.arguments) : tc.arguments || {};
|
|
819
803
|
assistantParts.push({
|
|
820
804
|
type: "tool-call",
|
|
821
805
|
toolCallId: tc.id,
|
|
@@ -0,0 +1,23 @@
|
|
|
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 };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
safeParseToolArgs
|
|
3
|
+
} from "./roy-agent-core-fp6f15av.js";
|
|
1
4
|
import {
|
|
2
5
|
createLogger,
|
|
3
6
|
init_logger
|
|
@@ -92,23 +95,13 @@ function convertToSDKMessages(messages) {
|
|
|
92
95
|
let input = {};
|
|
93
96
|
if (tc.function?.arguments) {
|
|
94
97
|
if (typeof tc.function.arguments === "string") {
|
|
95
|
-
|
|
96
|
-
const parsed = JSON.parse(tc.function.arguments);
|
|
97
|
-
input = typeof parsed === "string" ? { _raw: parsed } : parsed;
|
|
98
|
-
} catch {
|
|
99
|
-
input = { _raw: tc.function.arguments };
|
|
100
|
-
}
|
|
98
|
+
input = safeParseToolArgs(tc.function.arguments);
|
|
101
99
|
} else {
|
|
102
100
|
input = tc.function.arguments;
|
|
103
101
|
}
|
|
104
102
|
} else if (tc.arguments) {
|
|
105
103
|
if (typeof tc.arguments === "string") {
|
|
106
|
-
|
|
107
|
-
const parsed = JSON.parse(tc.arguments);
|
|
108
|
-
input = typeof parsed === "string" ? { _raw: parsed } : parsed;
|
|
109
|
-
} catch {
|
|
110
|
-
input = { _raw: tc.arguments };
|
|
111
|
-
}
|
|
104
|
+
input = safeParseToolArgs(tc.arguments);
|
|
112
105
|
} else {
|
|
113
106
|
input = tc.arguments;
|
|
114
107
|
}
|
|
@@ -120,9 +113,14 @@ function convertToSDKMessages(messages) {
|
|
|
120
113
|
input
|
|
121
114
|
};
|
|
122
115
|
});
|
|
116
|
+
const contentParts = [];
|
|
117
|
+
if (msg.content) {
|
|
118
|
+
contentParts.push({ type: "text", text: msg.content });
|
|
119
|
+
}
|
|
120
|
+
contentParts.push(...toolCallParts);
|
|
123
121
|
return {
|
|
124
122
|
role: "assistant",
|
|
125
|
-
content:
|
|
123
|
+
content: contentParts
|
|
126
124
|
};
|
|
127
125
|
}
|
|
128
126
|
if (msg.role === "tool") {
|