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

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-pv0812hg.js";
5
- import"../../shared/@ai-setting/roy-agent-core-wmdrsbwe.js";
4
+ } from "../../shared/@ai-setting/roy-agent-core-rcd7ek6n.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-kdmwhshb.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-1r86pags.js";
14
- import"../../shared/@ai-setting/roy-agent-core-fp6f15av.js";
13
+ import"../../shared/@ai-setting/roy-agent-core-tktkp52c.js";
14
+ import"../../shared/@ai-setting/roy-agent-core-rjp2cqsn.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,9 +21,9 @@ 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-1yaa58cp.js";
24
+ } from "../shared/@ai-setting/roy-agent-core-r7zphnam.js";
25
25
  import"../shared/@ai-setting/roy-agent-core-fjexv5nm.js";
26
- import"../shared/@ai-setting/roy-agent-core-56xsjjyw.js";
26
+ import"../shared/@ai-setting/roy-agent-core-yn229bhx.js";
27
27
  import"../shared/@ai-setting/roy-agent-core-zgtmazxg.js";
28
28
  import"../shared/@ai-setting/roy-agent-core-6d5v531t.js";
29
29
  import"../shared/@ai-setting/roy-agent-core-6atd905e.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-pv0812hg.js";
43
- import"../shared/@ai-setting/roy-agent-core-wmdrsbwe.js";
42
+ } from "../shared/@ai-setting/roy-agent-core-rcd7ek6n.js";
43
+ import"../shared/@ai-setting/roy-agent-core-kdmwhshb.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-1r86pags.js";
68
- import"../shared/@ai-setting/roy-agent-core-fp6f15av.js";
67
+ import"../shared/@ai-setting/roy-agent-core-tktkp52c.js";
68
+ import"../shared/@ai-setting/roy-agent-core-rjp2cqsn.js";
69
69
  import"../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
70
70
  import {
71
71
  BaseComponent
@@ -8,15 +8,15 @@ import {
8
8
  ProviderCapabilitiesSchema,
9
9
  ProviderConfigSchema,
10
10
  ProviderManager
11
- } from "../../shared/@ai-setting/roy-agent-core-k8xx1h03.js";
11
+ } from "../../shared/@ai-setting/roy-agent-core-dqf8t38a.js";
12
12
  import {
13
13
  createInvokeConfig,
14
14
  invoke,
15
15
  invokeNonStream,
16
16
  parseModelString
17
- } from "../../shared/@ai-setting/roy-agent-core-wmdrsbwe.js";
17
+ } from "../../shared/@ai-setting/roy-agent-core-kdmwhshb.js";
18
18
  import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
19
- import"../../shared/@ai-setting/roy-agent-core-fp6f15av.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-rjp2cqsn.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-wnmtdnd7.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-b18mgzpc.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-33855dsc.js";
7
+ } from "../../shared/@ai-setting/roy-agent-core-jweqxgyb.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-1r86pags.js";
12
- import"../../shared/@ai-setting/roy-agent-core-fp6f15av.js";
11
+ } from "../../shared/@ai-setting/roy-agent-core-tktkp52c.js";
12
+ import"../../shared/@ai-setting/roy-agent-core-rjp2cqsn.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-33855dsc.js";
7
- import"../../../shared/@ai-setting/roy-agent-core-1r86pags.js";
8
- import"../../../shared/@ai-setting/roy-agent-core-fp6f15av.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-jweqxgyb.js";
7
+ import"../../../shared/@ai-setting/roy-agent-core-tktkp52c.js";
8
+ import"../../../shared/@ai-setting/roy-agent-core-rjp2cqsn.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,7 +6,7 @@ import {
6
6
  Scheduler,
7
7
  WorkflowEngine,
8
8
  init_engine
9
- } from "../../../shared/@ai-setting/roy-agent-core-56xsjjyw.js";
9
+ } from "../../../shared/@ai-setting/roy-agent-core-yn229bhx.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-zgtmazxg.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-6d5v531t.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkflowComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-1yaa58cp.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-r7zphnam.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-fjexv5nm.js";
5
- import"../../shared/@ai-setting/roy-agent-core-56xsjjyw.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-yn229bhx.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-zgtmazxg.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-6d5v531t.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-6atd905e.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-k8xx1h03.js";
14
+ } from "./shared/@ai-setting/roy-agent-core-dqf8t38a.js";
15
15
  import {
16
16
  ConfigComponent
17
17
  } from "./shared/@ai-setting/roy-agent-core-prdngx28.js";
@@ -89,12 +89,12 @@ 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-1yaa58cp.js";
92
+ } from "./shared/@ai-setting/roy-agent-core-r7zphnam.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-56xsjjyw.js";
97
+ import"./shared/@ai-setting/roy-agent-core-yn229bhx.js";
98
98
  import"./shared/@ai-setting/roy-agent-core-zgtmazxg.js";
99
99
  import"./shared/@ai-setting/roy-agent-core-6d5v531t.js";
100
100
  import"./shared/@ai-setting/roy-agent-core-6atd905e.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-pv0812hg.js";
119
+ } from "./shared/@ai-setting/roy-agent-core-rcd7ek6n.js";
120
120
  import {
121
121
  createInvokeConfig,
122
122
  invoke,
123
123
  invokeNonStream,
124
124
  parseModelString
125
- } from "./shared/@ai-setting/roy-agent-core-wmdrsbwe.js";
125
+ } from "./shared/@ai-setting/roy-agent-core-kdmwhshb.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-wnmtdnd7.js";
174
+ } from "./shared/@ai-setting/roy-agent-core-b18mgzpc.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-33855dsc.js";
178
+ } from "./shared/@ai-setting/roy-agent-core-jweqxgyb.js";
179
179
  import"./shared/@ai-setting/roy-agent-core-x3gtyqax.js";
180
- import"./shared/@ai-setting/roy-agent-core-1r86pags.js";
181
- import"./shared/@ai-setting/roy-agent-core-fp6f15av.js";
180
+ import"./shared/@ai-setting/roy-agent-core-tktkp52c.js";
181
+ import"./shared/@ai-setting/roy-agent-core-rjp2cqsn.js";
182
182
  import"./shared/@ai-setting/roy-agent-core-qxhq8ven.js";
183
183
  import {
184
184
  BaseComponent
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  MemorySessionStore,
8
8
  SQLiteSessionStore
9
- } from "./roy-agent-core-33855dsc.js";
9
+ } from "./roy-agent-core-jweqxgyb.js";
10
10
  import {
11
11
  SummaryAgent
12
12
  } from "./roy-agent-core-x3gtyqax.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  invoke
3
- } from "./roy-agent-core-wmdrsbwe.js";
3
+ } from "./roy-agent-core-kdmwhshb.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SessionMessageConverter
3
- } from "./roy-agent-core-1r86pags.js";
3
+ } from "./roy-agent-core-tktkp52c.js";
4
4
  import {
5
5
  __require
6
6
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  safeParseToolArgs
3
- } from "./roy-agent-core-fp6f15av.js";
3
+ } from "./roy-agent-core-rjp2cqsn.js";
4
4
  import {
5
5
  createLogger,
6
6
  init_logger
@@ -113,9 +113,14 @@ function convertToSDKMessages(messages) {
113
113
  input
114
114
  };
115
115
  });
116
+ const contentParts = [];
117
+ if (msg.content) {
118
+ contentParts.push({ type: "text", text: msg.content });
119
+ }
120
+ contentParts.push(...toolCallParts);
116
121
  return {
117
122
  role: "assistant",
118
- content: toolCallParts
123
+ content: contentParts
119
124
  };
120
125
  }
121
126
  if (msg.role === "tool") {
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowEngine,
7
7
  exports_engine,
8
8
  init_engine
9
- } from "./roy-agent-core-56xsjjyw.js";
9
+ } from "./roy-agent-core-yn229bhx.js";
10
10
  import {
11
11
  WorkflowService
12
12
  } from "./roy-agent-core-4t40mkpv.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTimeout
3
- } from "./roy-agent-core-wmdrsbwe.js";
3
+ } from "./roy-agent-core-kdmwhshb.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-1r86pags.js";
16
+ } from "./roy-agent-core-tktkp52c.js";
17
17
  import {
18
18
  safeParseToolArgs
19
- } from "./roy-agent-core-fp6f15av.js";
19
+ } from "./roy-agent-core-rjp2cqsn.js";
20
20
  import {
21
21
  envKeyToConfigKey
22
22
  } from "./roy-agent-core-qxhq8ven.js";
@@ -111,9 +111,10 @@ function toLLMMessage(msg) {
111
111
  toolCallId = toolResult?.toolCallId;
112
112
  toolName = toolResult?.toolName;
113
113
  } else {
114
- const textParts = msg.content.filter((part) => part.type === "text");
115
114
  const toolCallParts = msg.content.filter((part) => part.type === "tool-call");
116
- content = textParts.map((part) => part.text || "").join("");
115
+ const contentParts = msg.content.filter((part) => part.type === "text" || part.type === "reasoning").map((part) => part.text || "");
116
+ content = contentParts.join(`
117
+ `);
117
118
  if (msg.role === "assistant" && toolCallParts.length > 0) {
118
119
  toolCalls = toolCallParts.map((part) => {
119
120
  const argsString = typeof part.input === "string" ? part.input : JSON.stringify(part.input || {});
@@ -0,0 +1,36 @@
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) {
16
+ return args;
17
+ }
18
+ if (typeof args === "string") {
19
+ try {
20
+ const parsed = JSON.parse(args);
21
+ if (typeof parsed === "string") {
22
+ logger.debug(`[safeParseToolArgs] Detected double/multi-stringified JSON at depth ${depth}. ` + "LLM may be double-stringifying tool arguments. Parsing recursively.", { depth, parsedLength: parsed.length });
23
+ return safeParseToolArgs(parsed, depth + 1);
24
+ }
25
+ if (typeof parsed === "object" && parsed !== null) {
26
+ return parsed;
27
+ }
28
+ return { value: parsed };
29
+ } catch {
30
+ return {};
31
+ }
32
+ }
33
+ return {};
34
+ }
35
+
36
+ export { safeParseToolArgs };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  safeParseToolArgs
3
- } from "./roy-agent-core-fp6f15av.js";
3
+ } from "./roy-agent-core-rjp2cqsn.js";
4
4
 
5
5
  // src/env/session/session-message-converter.ts
6
6
  import { randomUUID } from "crypto";
@@ -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 node = this.nodeMap.get(nodeId);
372
- if (!node) {
373
- return false;
403
+ const analysis = this.analyze();
404
+ const deps = analysis.dependencies.get(nodeId);
405
+ if (!deps) {
406
+ return true;
374
407
  }
375
- const dependencies = node.depends_on || [];
376
- for (const dep of dependencies) {
408
+ for (const dep of deps) {
377
409
  if (!completedNodes.has(dep)) {
378
410
  return false;
379
411
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.69",
3
+ "version": "1.5.71",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",
@@ -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 };