@ai-setting/roy-agent-core 1.5.68 → 1.5.69

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.
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  AgentComponent,
3
3
  AgentComponentConfigSchema
4
- } from "../../shared/@ai-setting/roy-agent-core-08q02yz2.js";
5
- import"../../shared/@ai-setting/roy-agent-core-ecth1zak.js";
4
+ } from "../../shared/@ai-setting/roy-agent-core-pv0812hg.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-wmdrsbwe.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-ew29335n.js";
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-08q02yz2.js";
43
- import"../shared/@ai-setting/roy-agent-core-ecth1zak.js";
42
+ } from "../shared/@ai-setting/roy-agent-core-pv0812hg.js";
43
+ import"../shared/@ai-setting/roy-agent-core-wmdrsbwe.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-ew29335n.js";
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
@@ -8,14 +8,15 @@ import {
8
8
  ProviderCapabilitiesSchema,
9
9
  ProviderConfigSchema,
10
10
  ProviderManager
11
- } from "../../shared/@ai-setting/roy-agent-core-qskhsjmc.js";
11
+ } from "../../shared/@ai-setting/roy-agent-core-k8xx1h03.js";
12
12
  import {
13
13
  createInvokeConfig,
14
14
  invoke,
15
15
  invokeNonStream,
16
16
  parseModelString
17
- } from "../../shared/@ai-setting/roy-agent-core-ecth1zak.js";
17
+ } from "../../shared/@ai-setting/roy-agent-core-wmdrsbwe.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-jkzgmd1v.js";
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-pcjenbaf.js";
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-ew29335n.js";
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-pcjenbaf.js";
7
- import"../../../shared/@ai-setting/roy-agent-core-ew29335n.js";
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-qskhsjmc.js";
14
+ } from "./shared/@ai-setting/roy-agent-core-k8xx1h03.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-08q02yz2.js";
119
+ } from "./shared/@ai-setting/roy-agent-core-pv0812hg.js";
120
120
  import {
121
121
  createInvokeConfig,
122
122
  invoke,
123
123
  invokeNonStream,
124
124
  parseModelString
125
- } from "./shared/@ai-setting/roy-agent-core-ecth1zak.js";
125
+ } from "./shared/@ai-setting/roy-agent-core-wmdrsbwe.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-jkzgmd1v.js";
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-pcjenbaf.js";
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-ew29335n.js";
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
- try {
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: typeof p.input === "string" ? { _raw: p.input } : p.input,
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
  SessionMessageConverter
3
- } from "./roy-agent-core-ew29335n.js";
3
+ } from "./roy-agent-core-1r86pags.js";
4
4
  import {
5
5
  __require
6
6
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -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,6 +1,6 @@
1
1
  import {
2
2
  invoke
3
- } from "./roy-agent-core-ecth1zak.js";
3
+ } from "./roy-agent-core-wmdrsbwe.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTimeout
3
- } from "./roy-agent-core-ecth1zak.js";
3
+ } from "./roy-agent-core-wmdrsbwe.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-ew29335n.js";
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";
@@ -684,12 +687,7 @@ class AgentComponent extends BaseComponent {
684
687
  if (tc.function?.arguments) {
685
688
  if (typeof tc.function.arguments === "string") {
686
689
  argsStr = tc.function.arguments;
687
- try {
688
- const parsed = JSON.parse(argsStr);
689
- argsObj = typeof parsed === "string" ? { _raw: parsed } : parsed;
690
- } catch {
691
- argsObj = { _raw: argsStr };
692
- }
690
+ argsObj = safeParseToolArgs(argsStr);
693
691
  } else {
694
692
  argsObj = tc.function.arguments;
695
693
  argsStr = JSON.stringify(argsObj);
@@ -697,12 +695,7 @@ class AgentComponent extends BaseComponent {
697
695
  } else if (tc.arguments) {
698
696
  if (typeof tc.arguments === "string") {
699
697
  argsStr = tc.arguments;
700
- try {
701
- const parsed = JSON.parse(argsStr);
702
- argsObj = typeof parsed === "string" ? { _raw: parsed } : parsed;
703
- } catch {
704
- argsObj = { _raw: argsStr };
705
- }
698
+ argsObj = safeParseToolArgs(argsStr);
706
699
  } else {
707
700
  argsObj = tc.arguments;
708
701
  argsStr = JSON.stringify(argsObj);
@@ -737,14 +730,7 @@ class AgentComponent extends BaseComponent {
737
730
  }
738
731
  const func = toolCall.function;
739
732
  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;
733
+ const tcArgs = func?.arguments ? typeof func.arguments === "string" ? safeParseToolArgs(func.arguments) : func.arguments : toolCall.arguments;
748
734
  hookCtx.currentToolCall = {
749
735
  id: toolCall.id,
750
736
  name: tcName,
@@ -812,10 +798,7 @@ class AgentComponent extends BaseComponent {
812
798
  });
813
799
  }
814
800
  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 || {};
801
+ const tcInput = typeof tc.function?.arguments === "string" ? safeParseToolArgs(tc.function.arguments) : tc.arguments || {};
819
802
  assistantParts.push({
820
803
  type: "tool-call",
821
804
  toolCallId: tc.id,
@@ -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
- try {
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
- try {
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
  }
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  MemorySessionStore,
8
8
  SQLiteSessionStore
9
- } from "./roy-agent-core-pcjenbaf.js";
9
+ } from "./roy-agent-core-33855dsc.js";
10
10
  import {
11
11
  SummaryAgent
12
12
  } from "./roy-agent-core-x3gtyqax.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.68",
3
+ "version": "1.5.69",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",