@ai-setting/roy-agent-core 1.5.92 → 1.5.94

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.
Files changed (30) hide show
  1. package/dist/env/agent/index.js +3 -3
  2. package/dist/env/event-source/index.js +3 -3
  3. package/dist/env/index.js +11 -11
  4. package/dist/env/prompt/index.js +2 -2
  5. package/dist/env/task/delegate/index.js +2 -2
  6. package/dist/env/task/index.js +3 -3
  7. package/dist/env/task/plugins/index.js +2 -2
  8. package/dist/env/tool/built-in/index.js +11 -1
  9. package/dist/env/tool/index.js +13 -3
  10. package/dist/env/workflow/engine/index.js +2 -2
  11. package/dist/env/workflow/index.js +3 -3
  12. package/dist/index.js +28 -111
  13. package/dist/shared/@ai-setting/{roy-agent-core-spzb03na.js → roy-agent-core-09xaxtpf.js} +5 -2
  14. package/dist/shared/@ai-setting/{roy-agent-core-mw9a595w.js → roy-agent-core-6rx2yt78.js} +32 -7
  15. package/dist/shared/@ai-setting/{roy-agent-core-q7ffkt1e.js → roy-agent-core-81j8yhsw.js} +1 -1
  16. package/dist/shared/@ai-setting/{roy-agent-core-5j649pb1.js → roy-agent-core-8f37pvct.js} +1 -1
  17. package/dist/shared/@ai-setting/{roy-agent-core-vh8ncnzm.js → roy-agent-core-ac0bc4x0.js} +2 -2
  18. package/dist/shared/@ai-setting/{roy-agent-core-snvsn60t.js → roy-agent-core-b4sbnec8.js} +44 -6
  19. package/dist/shared/@ai-setting/roy-agent-core-cy8azvpb.js +13 -0
  20. package/dist/shared/@ai-setting/{roy-agent-core-97tjdb2r.js → roy-agent-core-dj18eyyk.js} +29 -3
  21. package/dist/shared/@ai-setting/{roy-agent-core-vady4w02.js → roy-agent-core-hfgqwf5w.js} +1 -1
  22. package/dist/shared/@ai-setting/{roy-agent-core-7svhckhz.js → roy-agent-core-mwb6918x.js} +1 -1
  23. package/dist/shared/@ai-setting/{roy-agent-core-svcr4gjw.js → roy-agent-core-mx9vq7b2.js} +1 -1
  24. package/dist/shared/@ai-setting/{roy-agent-core-w1s8yrm5.js → roy-agent-core-phq62515.js} +58 -18
  25. package/dist/shared/@ai-setting/{roy-agent-core-at05dk0z.js → roy-agent-core-ss92p0r6.js} +1 -1
  26. package/dist/shared/@ai-setting/roy-agent-core-t7rw68q8.js +185 -0
  27. package/dist/shared/@ai-setting/{roy-agent-core-b1vkkcbr.js → roy-agent-core-x65fyjaw.js} +1 -1
  28. package/package.json +1 -1
  29. /package/dist/shared/@ai-setting/{roy-agent-core-ptb4pkva.js → roy-agent-core-jhdv14ks.js} +0 -0
  30. /package/dist/shared/@ai-setting/{roy-agent-core-pt7as39r.js → roy-agent-core-wjmwwc4a.js} +0 -0
@@ -2,13 +2,13 @@ import {
2
2
  AgentComponent,
3
3
  AgentComponentConfigSchema,
4
4
  SummaryAgent
5
- } from "../../shared/@ai-setting/roy-agent-core-mw9a595w.js";
5
+ } from "../../shared/@ai-setting/roy-agent-core-6rx2yt78.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
7
- import"../../shared/@ai-setting/roy-agent-core-ptb4pkva.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-jhdv14ks.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-bdajt9cs.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
11
- import"../../shared/@ai-setting/roy-agent-core-vady4w02.js";
11
+ import"../../shared/@ai-setting/roy-agent-core-hfgqwf5w.js";
12
12
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
13
13
  import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
14
14
  import"../../shared/@ai-setting/roy-agent-core-yfhgxh5a.js";
@@ -8,7 +8,7 @@ import {
8
8
  getBuiltInHandler,
9
9
  larkCliHandler,
10
10
  timerHandler
11
- } from "../../shared/@ai-setting/roy-agent-core-5j649pb1.js";
11
+ } from "../../shared/@ai-setting/roy-agent-core-8f37pvct.js";
12
12
  import {
13
13
  BUILT_IN_EVENT_SOURCE_TYPES,
14
14
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -19,8 +19,8 @@ import {
19
19
  validateEventSourceConfig
20
20
  } from "../../shared/@ai-setting/roy-agent-core-ds5f75pg.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-wmkx79b1.js";
22
- import"../../shared/@ai-setting/roy-agent-core-svcr4gjw.js";
23
- import"../../shared/@ai-setting/roy-agent-core-97tjdb2r.js";
22
+ import"../../shared/@ai-setting/roy-agent-core-mx9vq7b2.js";
23
+ import"../../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
24
24
  import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
25
25
  import"../../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
26
26
  import"../../shared/@ai-setting/roy-agent-core-4yq23m5g.js";
package/dist/env/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-5j649pb1.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-8f37pvct.js";
9
9
  import {
10
10
  EventSourceInitHooks,
11
11
  getDefaultConfigForType,
@@ -17,16 +17,16 @@ import"../shared/@ai-setting/roy-agent-core-wmkx79b1.js";
17
17
  import {
18
18
  PluginComponent
19
19
  } from "../shared/@ai-setting/roy-agent-core-ws76avbn.js";
20
- import"../shared/@ai-setting/roy-agent-core-svcr4gjw.js";
21
- import"../shared/@ai-setting/roy-agent-core-97tjdb2r.js";
20
+ import"../shared/@ai-setting/roy-agent-core-mx9vq7b2.js";
21
+ import"../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
22
22
  import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
23
23
  import {
24
24
  WorkflowComponent
25
- } from "../shared/@ai-setting/roy-agent-core-vh8ncnzm.js";
25
+ } from "../shared/@ai-setting/roy-agent-core-ac0bc4x0.js";
26
26
  import"../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
27
- import"../shared/@ai-setting/roy-agent-core-snvsn60t.js";
28
- import"../shared/@ai-setting/roy-agent-core-w1s8yrm5.js";
27
+ import"../shared/@ai-setting/roy-agent-core-b4sbnec8.js";
29
28
  import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
29
+ import"../shared/@ai-setting/roy-agent-core-phq62515.js";
30
30
  import"../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
31
31
  import"../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
32
32
  import"../shared/@ai-setting/roy-agent-core-hhrg314p.js";
@@ -42,20 +42,20 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
42
42
  import {
43
43
  AgentComponent,
44
44
  AgentComponentConfigSchema
45
- } from "../shared/@ai-setting/roy-agent-core-mw9a595w.js";
45
+ } from "../shared/@ai-setting/roy-agent-core-6rx2yt78.js";
46
46
  import"../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
47
- import"../shared/@ai-setting/roy-agent-core-ptb4pkva.js";
47
+ import"../shared/@ai-setting/roy-agent-core-jhdv14ks.js";
48
48
  import"../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
49
49
  import"../shared/@ai-setting/roy-agent-core-bdajt9cs.js";
50
50
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
51
51
  import {
52
52
  TaskComponent
53
- } from "../shared/@ai-setting/roy-agent-core-b1vkkcbr.js";
53
+ } from "../shared/@ai-setting/roy-agent-core-x65fyjaw.js";
54
54
  import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
55
- import"../shared/@ai-setting/roy-agent-core-at05dk0z.js";
55
+ import"../shared/@ai-setting/roy-agent-core-ss92p0r6.js";
56
56
  import"../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
57
57
  import"../shared/@ai-setting/roy-agent-core-9xby523m.js";
58
- import"../shared/@ai-setting/roy-agent-core-vady4w02.js";
58
+ import"../shared/@ai-setting/roy-agent-core-hfgqwf5w.js";
59
59
  import {
60
60
  XDG_PATHS,
61
61
  getXDGPath,
@@ -3,8 +3,8 @@ import {
3
3
  PromptConfigSchema,
4
4
  PromptPathSchema,
5
5
  PromptRenderer
6
- } from "../../shared/@ai-setting/roy-agent-core-7svhckhz.js";
7
- import"../../shared/@ai-setting/roy-agent-core-97tjdb2r.js";
6
+ } from "../../shared/@ai-setting/roy-agent-core-mwb6918x.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-pf1c360e.js";
@@ -3,9 +3,9 @@ import {
3
3
  BackgroundTaskManager,
4
4
  createDelegateTool,
5
5
  createStopTool
6
- } from "../../../shared/@ai-setting/roy-agent-core-at05dk0z.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-ss92p0r6.js";
7
7
  import"../../../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
8
- import"../../../shared/@ai-setting/roy-agent-core-vady4w02.js";
8
+ import"../../../shared/@ai-setting/roy-agent-core-hfgqwf5w.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-gp872e7m.js";
@@ -5,17 +5,17 @@ import {
5
5
  TaskPriorityEnum,
6
6
  TaskStatusEnum,
7
7
  TaskTypeEnum
8
- } from "../../shared/@ai-setting/roy-agent-core-b1vkkcbr.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-x65fyjaw.js";
9
9
  import {
10
10
  TaskEntityEventTypes
11
11
  } from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
12
- import"../../shared/@ai-setting/roy-agent-core-at05dk0z.js";
12
+ import"../../shared/@ai-setting/roy-agent-core-ss92p0r6.js";
13
13
  import"../../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
14
14
  import {
15
15
  SQLiteTaskStore,
16
16
  getDefaultTaskDbPath
17
17
  } from "../../shared/@ai-setting/roy-agent-core-9xby523m.js";
18
- import"../../shared/@ai-setting/roy-agent-core-vady4w02.js";
18
+ import"../../shared/@ai-setting/roy-agent-core-hfgqwf5w.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-0ye4q2jj.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-t94ktchq.js";
@@ -7,8 +7,8 @@ import {
7
7
  formatExtractorInput,
8
8
  formatExtractorInputFromDescription,
9
9
  parseExtractorOutput
10
- } from "../../../shared/@ai-setting/roy-agent-core-svcr4gjw.js";
11
- import"../../../shared/@ai-setting/roy-agent-core-97tjdb2r.js";
10
+ } from "../../../shared/@ai-setting/roy-agent-core-mx9vq7b2.js";
11
+ import"../../../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-4yq23m5g.js";
@@ -8,7 +8,13 @@ import {
8
8
  grepTool,
9
9
  readFileTool,
10
10
  writeFileTool
11
- } from "../../../shared/@ai-setting/roy-agent-core-spzb03na.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-09xaxtpf.js";
12
+ import {
13
+ getUnderstandImageLLMProvider,
14
+ resetUnderstandImageLLMProvider,
15
+ setUnderstandImageLLMProvider,
16
+ understandImageTool
17
+ } from "../../../shared/@ai-setting/roy-agent-core-t7rw68q8.js";
12
18
  import"../../../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
13
19
  import"../../../shared/@ai-setting/roy-agent-core-cg146hmg.js";
14
20
  import"../../../shared/@ai-setting/roy-agent-core-vyygk314.js";
@@ -17,9 +23,13 @@ import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
17
23
  import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
18
24
  export {
19
25
  writeFileTool,
26
+ understandImageTool,
27
+ setUnderstandImageLLMProvider,
28
+ resetUnderstandImageLLMProvider,
20
29
  readFileTool,
21
30
  grepTool,
22
31
  globTool,
32
+ getUnderstandImageLLMProvider,
23
33
  getBuiltInTool,
24
34
  getAllBuiltInTools,
25
35
  editFileTool,
@@ -1,4 +1,4 @@
1
- import"../../shared/@ai-setting/roy-agent-core-pt7as39r.js";
1
+ import"../../shared/@ai-setting/roy-agent-core-wjmwwc4a.js";
2
2
  import {
3
3
  bashTool,
4
4
  echoTool,
@@ -9,14 +9,20 @@ import {
9
9
  grepTool,
10
10
  readFileTool,
11
11
  writeFileTool
12
- } from "../../shared/@ai-setting/roy-agent-core-spzb03na.js";
12
+ } from "../../shared/@ai-setting/roy-agent-core-09xaxtpf.js";
13
+ import {
14
+ getUnderstandImageLLMProvider,
15
+ resetUnderstandImageLLMProvider,
16
+ setUnderstandImageLLMProvider,
17
+ understandImageTool
18
+ } from "../../shared/@ai-setting/roy-agent-core-t7rw68q8.js";
13
19
  import {
14
20
  ToolComponent,
15
21
  ToolRegistry,
16
22
  ToolValidator,
17
23
  getMaxOutputSize,
18
24
  setToolConfigComponent
19
- } from "../../shared/@ai-setting/roy-agent-core-ptb4pkva.js";
25
+ } from "../../shared/@ai-setting/roy-agent-core-jhdv14ks.js";
20
26
  import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
21
27
  import"../../shared/@ai-setting/roy-agent-core-bdajt9cs.js";
22
28
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
@@ -34,10 +40,14 @@ import"../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
34
40
  import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
35
41
  export {
36
42
  writeFileTool,
43
+ understandImageTool,
44
+ setUnderstandImageLLMProvider,
37
45
  setToolConfigComponent,
46
+ resetUnderstandImageLLMProvider,
38
47
  readFileTool,
39
48
  grepTool,
40
49
  globTool,
50
+ getUnderstandImageLLMProvider,
41
51
  getMaxOutputSize,
42
52
  getBuiltInTool,
43
53
  getAllBuiltInTools,
@@ -5,9 +5,9 @@ import {
5
5
  Scheduler,
6
6
  WorkflowEngine,
7
7
  init_engine
8
- } from "../../../shared/@ai-setting/roy-agent-core-snvsn60t.js";
9
- import"../../../shared/@ai-setting/roy-agent-core-w1s8yrm5.js";
8
+ } from "../../../shared/@ai-setting/roy-agent-core-b4sbnec8.js";
10
9
  import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
10
+ import"../../../shared/@ai-setting/roy-agent-core-phq62515.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-g2mth323.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  WorkflowComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-vh8ncnzm.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-ac0bc4x0.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
5
- import"../../shared/@ai-setting/roy-agent-core-snvsn60t.js";
6
- import"../../shared/@ai-setting/roy-agent-core-w1s8yrm5.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-b4sbnec8.js";
7
6
  import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-phq62515.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-hhrg314p.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PromptComponent,
3
3
  PromptStore
4
- } from "./shared/@ai-setting/roy-agent-core-7svhckhz.js";
4
+ } from "./shared/@ai-setting/roy-agent-core-mwb6918x.js";
5
5
  import {
6
6
  LLMComponent,
7
7
  LLMConfigSchema,
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  CommandsComponent
18
18
  } from "./shared/@ai-setting/roy-agent-core-578qk38y.js";
19
- import"./shared/@ai-setting/roy-agent-core-pt7as39r.js";
19
+ import"./shared/@ai-setting/roy-agent-core-wjmwwc4a.js";
20
20
  import {
21
21
  bashTool,
22
22
  editFileTool,
@@ -26,7 +26,17 @@ import {
26
26
  grepTool,
27
27
  readFileTool,
28
28
  writeFileTool
29
- } from "./shared/@ai-setting/roy-agent-core-spzb03na.js";
29
+ } from "./shared/@ai-setting/roy-agent-core-09xaxtpf.js";
30
+ import {
31
+ ATTACH_FILE_MAX_BYTES,
32
+ getUnderstandImageLLMProvider,
33
+ isMediaType,
34
+ parseImageInput,
35
+ resetUnderstandImageLLMProvider,
36
+ setUnderstandImageLLMProvider,
37
+ sniffMimeType,
38
+ understandImageTool
39
+ } from "./shared/@ai-setting/roy-agent-core-t7rw68q8.js";
30
40
  import {
31
41
  closeDatabase
32
42
  } from "./shared/@ai-setting/roy-agent-core-jexyz11d.js";
@@ -62,7 +72,7 @@ import {
62
72
  getBuiltInHandler,
63
73
  larkCliHandler,
64
74
  timerHandler
65
- } from "./shared/@ai-setting/roy-agent-core-5j649pb1.js";
75
+ } from "./shared/@ai-setting/roy-agent-core-8f37pvct.js";
66
76
  import {
67
77
  BUILT_IN_EVENT_SOURCE_TYPES,
68
78
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -81,24 +91,24 @@ import {
81
91
  } from "./shared/@ai-setting/roy-agent-core-ws76avbn.js";
82
92
  import {
83
93
  TaskTagPlugin
84
- } from "./shared/@ai-setting/roy-agent-core-svcr4gjw.js";
94
+ } from "./shared/@ai-setting/roy-agent-core-mx9vq7b2.js";
85
95
  import {
86
96
  getBuiltInPrompt,
87
97
  getBuiltInPromptNames
88
- } from "./shared/@ai-setting/roy-agent-core-97tjdb2r.js";
98
+ } from "./shared/@ai-setting/roy-agent-core-dj18eyyk.js";
89
99
  import {
90
100
  BasePlugin
91
101
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
92
102
  import {
93
103
  WorkflowComponent
94
- } from "./shared/@ai-setting/roy-agent-core-vh8ncnzm.js";
104
+ } from "./shared/@ai-setting/roy-agent-core-ac0bc4x0.js";
95
105
  import {
96
106
  init_node_registry_helper,
97
107
  registerDecoratorNodeType
98
108
  } from "./shared/@ai-setting/roy-agent-core-xgnpr28w.js";
99
- import"./shared/@ai-setting/roy-agent-core-snvsn60t.js";
100
- import"./shared/@ai-setting/roy-agent-core-w1s8yrm5.js";
109
+ import"./shared/@ai-setting/roy-agent-core-b4sbnec8.js";
101
110
  import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
111
+ import"./shared/@ai-setting/roy-agent-core-phq62515.js";
102
112
  import"./shared/@ai-setting/roy-agent-core-q88vxmx5.js";
103
113
  import"./shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
104
114
  import"./shared/@ai-setting/roy-agent-core-hhrg314p.js";
@@ -120,7 +130,7 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
120
130
  import {
121
131
  AgentComponent,
122
132
  AgentComponentConfigSchema
123
- } from "./shared/@ai-setting/roy-agent-core-mw9a595w.js";
133
+ } from "./shared/@ai-setting/roy-agent-core-6rx2yt78.js";
124
134
  import {
125
135
  createInvokeConfig,
126
136
  invoke,
@@ -131,7 +141,7 @@ import {
131
141
  ToolComponent,
132
142
  ToolRegistry,
133
143
  ToolValidator
134
- } from "./shared/@ai-setting/roy-agent-core-ptb4pkva.js";
144
+ } from "./shared/@ai-setting/roy-agent-core-jhdv14ks.js";
135
145
  import"./shared/@ai-setting/roy-agent-core-5h49ct1a.js";
136
146
  import {
137
147
  createAutoTaskPlugin
@@ -142,9 +152,9 @@ import {
142
152
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
143
153
  import {
144
154
  TaskComponent
145
- } from "./shared/@ai-setting/roy-agent-core-b1vkkcbr.js";
155
+ } from "./shared/@ai-setting/roy-agent-core-x65fyjaw.js";
146
156
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
147
- import"./shared/@ai-setting/roy-agent-core-at05dk0z.js";
157
+ import"./shared/@ai-setting/roy-agent-core-ss92p0r6.js";
148
158
  import"./shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
149
159
  import {
150
160
  SQLiteTaskStore,
@@ -152,7 +162,7 @@ import {
152
162
  } from "./shared/@ai-setting/roy-agent-core-9xby523m.js";
153
163
  import {
154
164
  AgentRegistry
155
- } from "./shared/@ai-setting/roy-agent-core-vady4w02.js";
165
+ } from "./shared/@ai-setting/roy-agent-core-hfgqwf5w.js";
156
166
  import {
157
167
  XDG_PATHS,
158
168
  getXDGPath,
@@ -234,103 +244,6 @@ import {
234
244
  SQLiteSpanStorage
235
245
  } from "./shared/@ai-setting/roy-agent-core-c6592r3c.js";
236
246
  import"./shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
237
- // src/utils/media.ts
238
- import * as fs from "node:fs/promises";
239
- import * as path from "node:path";
240
- var ATTACH_FILE_MAX_BYTES = 10 * 1024 * 1024;
241
- function startsWith(buf, sig) {
242
- if (buf.length < sig.length)
243
- return false;
244
- for (let i = 0;i < sig.length; i++) {
245
- if (buf[i] !== sig[i])
246
- return false;
247
- }
248
- return true;
249
- }
250
- function sniffMimeType(buffer, fallbackName) {
251
- if (startsWith(buffer, [137, 80, 78, 71, 13, 10, 26, 10])) {
252
- return "image/png";
253
- }
254
- if (startsWith(buffer, [255, 216, 255])) {
255
- return "image/jpeg";
256
- }
257
- if (startsWith(buffer, [71, 73, 70, 56])) {
258
- return "image/gif";
259
- }
260
- if (startsWith(buffer, [66, 77])) {
261
- return "image/bmp";
262
- }
263
- if (startsWith(buffer, [37, 80, 68, 70, 45])) {
264
- return "application/pdf";
265
- }
266
- if (startsWith(buffer, [82, 73, 70, 70]) && startsWith(buffer.subarray(8), [87, 69, 66, 80])) {
267
- return "image/webp";
268
- }
269
- if (fallbackName) {
270
- const ext = path.extname(fallbackName).toLowerCase();
271
- const extMap = {
272
- ".png": "image/png",
273
- ".jpg": "image/jpeg",
274
- ".jpeg": "image/jpeg",
275
- ".gif": "image/gif",
276
- ".webp": "image/webp",
277
- ".bmp": "image/bmp",
278
- ".pdf": "application/pdf",
279
- ".mp3": "audio/mpeg",
280
- ".wav": "audio/wav",
281
- ".ogg": "audio/ogg",
282
- ".m4a": "audio/mp4",
283
- ".mp4": "video/mp4",
284
- ".mov": "video/quicktime",
285
- ".webm": "video/webm"
286
- };
287
- const mapped = extMap[ext];
288
- if (mapped)
289
- return mapped;
290
- }
291
- return "application/octet-stream";
292
- }
293
- function isMediaType(mime) {
294
- if (typeof mime !== "string")
295
- return false;
296
- const m = mime.toLowerCase();
297
- return m.startsWith("image/") || m.startsWith("audio/") || m.startsWith("video/") || m === "application/pdf";
298
- }
299
- var HTTP_URL_RE = /^https?:\/\//i;
300
- var DATA_URL_RE = /^data:([^;,]+)(;base64)?,(.*)$/s;
301
- async function parseImageInput(input) {
302
- if (!input || typeof input !== "string" || input.trim().length === 0) {
303
- throw new Error("parseImageInput: input is empty");
304
- }
305
- const trimmed = input.trim();
306
- if (HTTP_URL_RE.test(trimmed)) {
307
- return { type: "image", image: trimmed };
308
- }
309
- if (DATA_URL_RE.test(trimmed)) {
310
- return { type: "image", image: trimmed };
311
- }
312
- return await parseLocalImagePath(trimmed);
313
- }
314
- async function parseLocalImagePath(filePath) {
315
- let stat2;
316
- try {
317
- stat2 = await fs.stat(filePath);
318
- } catch (err) {
319
- throw new Error(`parseImageInput: cannot stat file '${filePath}': ${err.message}`);
320
- }
321
- if (!stat2.isFile()) {
322
- throw new Error(`parseImageInput: not a regular file: ${filePath}`);
323
- }
324
- if (stat2.size > ATTACH_FILE_MAX_BYTES) {
325
- throw new Error(`parseImageInput: file '${filePath}' exceeds 10 MiB limit ` + `(${stat2.size} bytes > ${ATTACH_FILE_MAX_BYTES} bytes)`);
326
- }
327
- const buffer = await fs.readFile(filePath);
328
- const mime = sniffMimeType(buffer, filePath);
329
- if (!mime.startsWith("image/")) {
330
- throw new Error(`parseImageInput: file '${filePath}' is not an image (detected ${mime}). ` + `Use ContentPart type 'file' for non-image attachments.`);
331
- }
332
- return { type: "image", image: buffer };
333
- }
334
247
  // src/env/memory/tools/memory-agent-tools.ts
335
248
  import { z } from "zod";
336
249
  var SearchSessionsSchema = z.object({
@@ -455,11 +368,14 @@ export {
455
368
  writeFileTool,
456
369
  wrapFunction,
457
370
  validateEventSourceConfig,
371
+ understandImageTool,
458
372
  timerHandler,
459
373
  sniffMimeType,
374
+ setUnderstandImageLLMProvider,
460
375
  setQuietMode,
461
376
  setConfigComponent as setLoggerConfigComponent,
462
377
  setLogDirOverride,
378
+ resetUnderstandImageLLMProvider,
463
379
  resetTracerProvider,
464
380
  registerDecoratorNodeType,
465
381
  readFileTool,
@@ -479,6 +395,7 @@ export {
479
395
  globTool,
480
396
  getXDGPaths,
481
397
  getXDGPath,
398
+ getUnderstandImageLLMProvider,
482
399
  getTracerProvider,
483
400
  getLogLevels,
484
401
  getLogLevel,
@@ -1,3 +1,6 @@
1
+ import {
2
+ understandImageTool
3
+ } from "./roy-agent-core-t7rw68q8.js";
1
4
  import {
2
5
  getCurrentProcessRegistry,
3
6
  killProcessTree
@@ -907,7 +910,6 @@ var grepTool = {
907
910
  }
908
911
  }
909
912
  };
910
-
911
913
  // src/env/tool/built-in/index.ts
912
914
  function getAllBuiltInTools() {
913
915
  return [
@@ -917,7 +919,8 @@ function getAllBuiltInTools() {
917
919
  readFileTool,
918
920
  writeFileTool,
919
921
  editFileTool,
920
- grepTool
922
+ grepTool,
923
+ understandImageTool
921
924
  ];
922
925
  }
923
926
  function getBuiltInTool(name) {
@@ -3,14 +3,14 @@ import {
3
3
  } from "./roy-agent-core-j7jeqxhd.js";
4
4
  import {
5
5
  truncateOutputInline
6
- } from "./roy-agent-core-ptb4pkva.js";
6
+ } from "./roy-agent-core-jhdv14ks.js";
7
7
  import {
8
8
  AskUserError,
9
9
  init_workflow_hil
10
10
  } from "./roy-agent-core-e25xkv53.js";
11
11
  import {
12
12
  AgentRegistry
13
- } from "./roy-agent-core-vady4w02.js";
13
+ } from "./roy-agent-core-hfgqwf5w.js";
14
14
  import {
15
15
  ContextError
16
16
  } from "./roy-agent-core-ctdhjv68.js";
@@ -47,7 +47,8 @@ import {
47
47
  init_logger
48
48
  } from "./roy-agent-core-vyygk314.js";
49
49
  import {
50
- __legacyDecorateClassTS
50
+ __legacyDecorateClassTS,
51
+ __require
51
52
  } from "./roy-agent-core-fs0mn2jk.js";
52
53
 
53
54
  // src/env/agent/agent-component.ts
@@ -416,12 +417,32 @@ class AgentComponent extends BaseComponent {
416
417
  this.setStatus("stopped");
417
418
  logger.info("[AgentComponent] Cleanup completed");
418
419
  }
419
- refreshDependencies() {
420
+ async refreshDependencies() {
420
421
  if (this.env) {
421
422
  const llm = this.env.getComponent("llm");
422
423
  const tool = this.env.getComponent("tool");
423
424
  this.llmComponent = llm ? llm : null;
424
425
  this.toolComponent = tool ? tool : null;
426
+ if (this.llmComponent) {
427
+ try {
428
+ const mod = await import("./roy-agent-core-cy8azvpb.js");
429
+ mod.setUnderstandImageLLMProvider(async (messages) => {
430
+ const result = await this.llmComponent.invoke({
431
+ messages,
432
+ tools: [],
433
+ skipThresholdCheck: true,
434
+ context: {
435
+ sessionId: undefined,
436
+ messageId: `understand_image-${Date.now()}`
437
+ }
438
+ });
439
+ return result.output?.content ?? "";
440
+ });
441
+ logger.debug("[refreshDependencies] understand_image LLM provider injected");
442
+ } catch (err) {
443
+ logger.warn(`[refreshDependencies] failed to inject understand_image provider: ${err.message}`);
444
+ }
445
+ }
425
446
  logger.debug("[refreshDependencies] AgentComponent refreshed", {
426
447
  hasLLM: !!this.llmComponent,
427
448
  hasTool: !!this.toolComponent
@@ -574,7 +595,7 @@ class AgentComponent extends BaseComponent {
574
595
  this.notifyMessageAdded(message);
575
596
  }
576
597
  async _run(agentName, query, context) {
577
- this.refreshDependencies();
598
+ await this.refreshDependencies();
578
599
  const agent = this.getAgent(agentName);
579
600
  if (!agent) {
580
601
  throw new Error(`Agent not found: ${agentName}`);
@@ -633,7 +654,10 @@ class AgentComponent extends BaseComponent {
633
654
  context: effectiveContext
634
655
  };
635
656
  let historyMessageCount = 0;
636
- if (effectiveContext.sessionId) {
657
+ if (effectiveContext.messages && effectiveContext.messages.length > 0) {
658
+ hookCtx.messages = effectiveContext.messages;
659
+ historyMessageCount = hookCtx.messages.length;
660
+ } else if (effectiveContext.sessionId) {
637
661
  try {
638
662
  const sessionComponent = this.env.getComponent("session");
639
663
  if (sessionComponent) {
@@ -1105,7 +1129,8 @@ ${additionInfo}`
1105
1129
  messageId: ctx.context.messageId
1106
1130
  },
1107
1131
  abortSignal: ctx.context.abort,
1108
- skipThresholdCheck: ctx.context.agentType === "sub"
1132
+ skipThresholdCheck: ctx.context.agentType === "sub",
1133
+ ...ctx.context.toolChoice ? { toolChoice: ctx.context.toolChoice } : {}
1109
1134
  });
1110
1135
  const result = await withTimeout(llmPromise, 300000, "LLM invocation timeout after 300s");
1111
1136
  logger.debug("[invokeLLM] LLMComponent.invoke returned successfully");
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AgentComponentAdapter,
3
3
  init_agent_component_adapter
4
- } from "./roy-agent-core-w1s8yrm5.js";
4
+ } from "./roy-agent-core-phq62515.js";
5
5
  import"./roy-agent-core-1db4vpc6.js";
6
6
  import"./roy-agent-core-e25xkv53.js";
7
7
  import"./roy-agent-core-gp872e7m.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook
4
- } from "./roy-agent-core-svcr4gjw.js";
4
+ } from "./roy-agent-core-mx9vq7b2.js";
5
5
  import {
6
6
  envKeyToConfigKey
7
7
  } from "./roy-agent-core-qxhq8ven.js";
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowEngine,
7
7
  exports_engine,
8
8
  init_engine
9
- } from "./roy-agent-core-snvsn60t.js";
9
+ } from "./roy-agent-core-b4sbnec8.js";
10
10
  import {
11
11
  askUserTool,
12
12
  createRunWorkflowTool,
@@ -141,7 +141,7 @@ class WorkflowComponent extends BaseComponent {
141
141
  if (!agentRunner && this._workflowEnv) {
142
142
  const agentComponent = this._workflowEnv.getComponent("agent");
143
143
  if (agentComponent) {
144
- const { AgentComponentAdapter } = await import("./roy-agent-core-q7ffkt1e.js");
144
+ const { AgentComponentAdapter } = await import("./roy-agent-core-81j8yhsw.js");
145
145
  agentRunner = new AgentComponentAdapter(agentComponent, {}, this.sessionComponent);
146
146
  }
147
147
  }
@@ -1,13 +1,13 @@
1
- import {
2
- AgentComponentAdapter,
3
- init_agent_component_adapter
4
- } from "./roy-agent-core-w1s8yrm5.js";
5
1
  import {
6
2
  buildWorkflowNodeMetadata,
7
3
  getWorkflowNodeIdFromMetadata,
8
4
  init_workflow_message_metadata,
9
5
  patchAgentSessionIdOnMessage
10
6
  } from "./roy-agent-core-6atd905e.js";
7
+ import {
8
+ AgentComponentAdapter,
9
+ init_agent_component_adapter
10
+ } from "./roy-agent-core-phq62515.js";
11
11
  import {
12
12
  TemplateResolver,
13
13
  init_template_resolver
@@ -892,6 +892,32 @@ var init_extract_agent_json_output = __esm(() => {
892
892
  });
893
893
 
894
894
  // src/env/workflow/utils/build-agent-node-output.ts
895
+ function extractSchemaFieldNames(schema) {
896
+ if (!schema)
897
+ return [];
898
+ const props = schema.properties;
899
+ if (!props || typeof props !== "object")
900
+ return [];
901
+ return Object.keys(props);
902
+ }
903
+ function defaultValueForField(fieldName) {
904
+ const lower = fieldName.toLowerCase();
905
+ if (lower === "score" || lower.endsWith("_score"))
906
+ return 0;
907
+ if (lower === "findings" || lower.endsWith("_list") || lower.endsWith("s"))
908
+ return [];
909
+ if (lower.includes("count") || lower.includes("total"))
910
+ return 0;
911
+ if (lower === "dimension")
912
+ return "unknown";
913
+ if (lower === "verdict")
914
+ return "unknown";
915
+ if (lower.includes("summary") || lower.includes("description") || lower.includes("report"))
916
+ return "";
917
+ if (lower.includes("markdown"))
918
+ return "";
919
+ return "";
920
+ }
895
921
  function buildAgentNodeOutput(agentResult, outputConfig) {
896
922
  if (outputConfig.mode === "json") {
897
923
  const schema = outputConfig.schema;
@@ -908,12 +934,24 @@ function buildAgentNodeOutput(agentResult, outputConfig) {
908
934
  };
909
935
  }
910
936
  const rawText = typeof agentResult.output === "string" ? agentResult.output : JSON.stringify(agentResult.output ?? {});
937
+ const schemaFields = extractSchemaFieldNames(schema);
938
+ const placeholderResult = {
939
+ _extraction_failed: true,
940
+ _raw_output: rawText,
941
+ _extraction_reason: "JSON extraction failed (json-extract sub-agent did not call workflow_submit_output)"
942
+ };
943
+ for (const fieldName of schemaFields) {
944
+ if (!(fieldName in placeholderResult)) {
945
+ placeholderResult[fieldName] = defaultValueForField(fieldName);
946
+ }
947
+ }
911
948
  return {
912
- result: rawText,
949
+ result: placeholderResult,
950
+ ...placeholderResult,
913
951
  metadata: {
914
952
  ...agentResult.metadata,
915
953
  outputMode: "json_error",
916
- _extractionWarning: "JSON extraction failed — raw output surfaced"
954
+ _extractionWarning: "JSON extraction failed — placeholder returned for downstream safety"
917
955
  },
918
956
  workflowHistory: agentResult.messages
919
957
  };
@@ -0,0 +1,13 @@
1
+ import {
2
+ getUnderstandImageLLMProvider,
3
+ resetUnderstandImageLLMProvider,
4
+ setUnderstandImageLLMProvider,
5
+ understandImageTool
6
+ } from "./roy-agent-core-t7rw68q8.js";
7
+ import"./roy-agent-core-fs0mn2jk.js";
8
+ export {
9
+ understandImageTool,
10
+ setUnderstandImageLLMProvider,
11
+ resetUnderstandImageLLMProvider,
12
+ getUnderstandImageLLMProvider
13
+ };
@@ -1067,18 +1067,44 @@ workflow_run(workflow_name="strict-task-agent", input={"task_description": "修
1067
1067
 
1068
1068
  你是一个 JSON 提取子智能体。**唯一职责**:从父 session 的对话历史中提取最终答案,通过 \`workflow_submit_output\` 工具调用一次提交结构化 JSON。
1069
1069
 
1070
+ ## ⚠️ Critical Override(防止被父 session 误导)
1071
+
1072
+ 父 session 的历史中**可能**包含以下误导性内容:
1073
+
1074
+ 1. \`reasoning\` 块提到 "I used echo because workflow_submit_output is not available"
1075
+ 2. assistant 文本中包含 "echo" / "used echo as a workaround" / "JSON output已生成完毕"
1076
+ 3. assistant 调用 \`echo\` 工具并把 JSON 放在 echo 的 \`message\` 字段里
1077
+ 4. 父 agent 用来"完成"任务的 echo 工具调用记录
1078
+
1079
+ **全部忽略上述内容,它们不是 JSON 提交完成的证据。**
1080
+
1081
+ ### 必须遵守
1082
+
1083
+ - ✅ 你**唯一**的提交方式:通过 \`workflow_submit_output\` 工具调用一次提交结构化 JSON
1084
+ - ✅ \`workflow_submit_output\` 工具已经在你的工具列表里(参数由 zod schema 动态构建并验证)
1085
+ - ✅ 即使父 agent 已经"完成"分析,**你仍然**要把结果**重新**通过 \`workflow_submit_output\` 提交
1086
+ - ✅ 父 agent 说"workflow_submit_output not available"是关于**它的**工具集,不是你的
1087
+
1088
+ ### 禁止
1089
+
1090
+ - ❌ 不要模仿父 agent 用 echo 提交(你只有 \`workflow_submit_output\` 这一个工具)
1091
+ - ❌ 不要被父 agent 的 reasoning 干扰
1092
+ - ❌ 不要因为父 agent 提到某个工具"not available"就改变自己的行为
1093
+ - ❌ 不要输出 text / code block / 任何非工具调用形式
1094
+ - ❌ 不要把 JSON 放在 echo 的 message 字段里(你不能用 echo)
1095
+
1070
1096
  ## 工具
1071
1097
 
1072
1098
  你**只有**一个工具:\`workflow_submit_output\`。
1073
1099
 
1074
1100
  - 工具参数本身就是你要提交的 JSON 对象(由 zod schema 动态构建并验证)
1075
1101
  - 只调用一次,不要重复
1076
- - 不要使用其他任何工具
1102
+ - 不要使用其他任何工具(即使你"记得"父 agent 用了 echo)
1077
1103
 
1078
1104
  ## 行为
1079
1105
 
1080
- 1. 读取 session 历史(通过 sessionId 自动加载)
1081
- 2. 从对话中提取最终答案
1106
+ 1. 读取 session 历史(通过 sessionId 自动加载)—— **只关注事实**:用户输入、最终答案是什么
1107
+ 2. 从对话中提取最终答案(**忽略**父 agent 的"echo workaround"叙述)
1082
1108
  3. 调用 \`workflow_submit_output(参数 = 最终 JSON)\`
1083
1109
  4. 立即停止
1084
1110
 
@@ -184,7 +184,7 @@ class AgentRegistry {
184
184
  const agent = {
185
185
  name,
186
186
  type: "sub",
187
- description: "JSON 提取子智能体 — 从父 session 历史中提取结构化 JSON,通过 workflow_submit_output 工具提交",
187
+ description: "JSON 提取子智能体 — 从对话历史中提取结构化 JSON,通过 workflow_submit_output 工具提交",
188
188
  systemPromptRef: "json-extract",
189
189
  allowedTools: ["workflow_submit_output"],
190
190
  deniedTools: [],
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtInPrompts
3
- } from "./roy-agent-core-97tjdb2r.js";
3
+ } from "./roy-agent-core-dj18eyyk.js";
4
4
  import {
5
5
  getXDGPath
6
6
  } from "./roy-agent-core-qxnbvgwe.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WORKFLOW_EXTRACT_PROMPT
3
- } from "./roy-agent-core-97tjdb2r.js";
3
+ } from "./roy-agent-core-dj18eyyk.js";
4
4
  import {
5
5
  BasePlugin
6
6
  } from "./roy-agent-core-az13yzmc.js";
@@ -25,6 +25,28 @@ import {
25
25
  } from "./roy-agent-core-fs0mn2jk.js";
26
26
 
27
27
  // src/env/workflow/plugins/workflow-json-output-plugin.ts
28
+ function extractLastAssistantText(messages) {
29
+ if (!messages || messages.length === 0) {
30
+ return;
31
+ }
32
+ for (let i = messages.length - 1;i >= 0; i--) {
33
+ const msg = messages[i];
34
+ if (msg.role !== "assistant") {
35
+ continue;
36
+ }
37
+ const content = msg.content;
38
+ if (typeof content === "string") {
39
+ return content.trim() || undefined;
40
+ }
41
+ if (Array.isArray(content)) {
42
+ const textParts = content.filter((p) => typeof p === "object" && p !== null && p.type === "text").map((p) => p.text);
43
+ const combined = textParts.join(`
44
+ `).trim();
45
+ return combined || undefined;
46
+ }
47
+ }
48
+ return;
49
+ }
28
50
  function registerWorkflowJsonOutputPlugin(options = undefined) {
29
51
  if (registered) {
30
52
  return;
@@ -61,34 +83,52 @@ async function runWorkflowJsonOutputExtraction(hookCtx) {
61
83
  logger.warn("Workflow JSON extraction: agentComponent not registered. " + "Plugin cannot invoke json-extract sub-agent. " + "Ensure registerWorkflowJsonOutputPlugin({ agentComponent }) was called.");
62
84
  return;
63
85
  }
64
- const sessionId = hookCtx.context.sessionId;
65
- if (!sessionId) {
66
- logger.warn("Workflow JSON extraction: no sessionId in hookCtx.context. " + "Cannot reuse main session history for json-extract sub-agent.");
86
+ const assistantText = extractLastAssistantText(hookCtx.messages);
87
+ if (!assistantText) {
88
+ logger.warn("Workflow JSON extraction: no assistant text found in main agent output. " + "The agent must produce a final text response (plain or markdown).");
67
89
  return;
68
90
  }
91
+ const submitTool = createSubmitJsonOutputTool(schema, hookCtx);
92
+ const submitToolAsExtra = {
93
+ name: submitTool.name,
94
+ description: submitTool.description ?? "",
95
+ parameters: submitTool.parameters,
96
+ execute: submitTool.execute
97
+ };
98
+ const userQuery = [
99
+ "The main agent has produced the following final response.",
100
+ "Extract the structured JSON from it and submit via workflow_submit_output.",
101
+ "",
102
+ "--- START of main agent response ---",
103
+ assistantText,
104
+ "--- END of main agent response ---",
105
+ "",
106
+ "Your ONLY job: call workflow_submit_output with the extracted JSON.",
107
+ "Do NOT output any text — just call the tool."
108
+ ].join(`
109
+ `);
110
+ const messagesOverride = [
111
+ {
112
+ role: "user",
113
+ content: userQuery
114
+ }
115
+ ];
116
+ const extractContext = {
117
+ messages: messagesOverride,
118
+ extraTools: [submitToolAsExtra],
119
+ persistSession: false,
120
+ abort: hookCtx.context.abort
121
+ };
69
122
  try {
70
- const submitTool = createSubmitJsonOutputTool(schema, hookCtx);
71
- const submitToolAsExtra = {
72
- name: submitTool.name,
73
- description: submitTool.description ?? "",
74
- parameters: submitTool.parameters,
75
- execute: submitTool.execute
76
- };
77
- const extractContext = {
78
- sessionId,
79
- extraTools: [submitToolAsExtra],
80
- persistSession: false,
81
- abort: hookCtx.context.abort
82
- };
83
123
  const result = await agentComponentRef.run("json-extract", "", extractContext);
84
124
  if (result.error) {
85
125
  logger.warn(`Workflow JSON extraction: json-extract sub-agent returned error: ${result.error}`);
86
126
  return;
87
127
  }
88
128
  if (hookCtx.structuredOutputExtracted) {
89
- logger.info("Workflow JSON output extracted via json-extract sub-agent " + `(iterations=${result.iterations}, toolCalls=${result.toolCalls?.length ?? 0})`);
129
+ logger.info("Workflow JSON output extracted via json-extract sub-agent (clean override) " + `(iterations=${result.iterations}, toolCalls=${result.toolCalls?.length ?? 0})`);
90
130
  } else {
91
- logger.warn("Workflow JSON extraction: json-extract sub-agent did not call workflow_submit_output. " + "Check that the model supports tool calls.");
131
+ logger.warn("Workflow JSON extraction: json-extract sub-agent did not call workflow_submit_output. " + "toolChoice=required failed to force tool call — investigate provider support.");
92
132
  }
93
133
  } catch (error) {
94
134
  logger.error(`Workflow JSON extraction: json-extract sub-agent threw: ${error instanceof Error ? error.message : String(error)}`);
@@ -4,7 +4,7 @@ import {
4
4
  } from "./roy-agent-core-hvdfgvfz.js";
5
5
  import {
6
6
  DEFAULT_SUBAGENT_PROMPT
7
- } from "./roy-agent-core-vady4w02.js";
7
+ } from "./roy-agent-core-hfgqwf5w.js";
8
8
  import {
9
9
  TaskHookPoints
10
10
  } from "./roy-agent-core-92z6t4he.js";
@@ -0,0 +1,185 @@
1
+ // src/env/tool/built-in/understand-image.ts
2
+ import { z } from "zod";
3
+
4
+ // src/utils/media.ts
5
+ import * as fs from "node:fs/promises";
6
+ import * as path from "node:path";
7
+ var ATTACH_FILE_MAX_BYTES = 10 * 1024 * 1024;
8
+ function startsWith(buf, sig) {
9
+ if (buf.length < sig.length)
10
+ return false;
11
+ for (let i = 0;i < sig.length; i++) {
12
+ if (buf[i] !== sig[i])
13
+ return false;
14
+ }
15
+ return true;
16
+ }
17
+ function sniffMimeType(buffer, fallbackName) {
18
+ if (startsWith(buffer, [137, 80, 78, 71, 13, 10, 26, 10])) {
19
+ return "image/png";
20
+ }
21
+ if (startsWith(buffer, [255, 216, 255])) {
22
+ return "image/jpeg";
23
+ }
24
+ if (startsWith(buffer, [71, 73, 70, 56])) {
25
+ return "image/gif";
26
+ }
27
+ if (startsWith(buffer, [66, 77])) {
28
+ return "image/bmp";
29
+ }
30
+ if (startsWith(buffer, [37, 80, 68, 70, 45])) {
31
+ return "application/pdf";
32
+ }
33
+ if (startsWith(buffer, [82, 73, 70, 70]) && startsWith(buffer.subarray(8), [87, 69, 66, 80])) {
34
+ return "image/webp";
35
+ }
36
+ if (fallbackName) {
37
+ const ext = path.extname(fallbackName).toLowerCase();
38
+ const extMap = {
39
+ ".png": "image/png",
40
+ ".jpg": "image/jpeg",
41
+ ".jpeg": "image/jpeg",
42
+ ".gif": "image/gif",
43
+ ".webp": "image/webp",
44
+ ".bmp": "image/bmp",
45
+ ".pdf": "application/pdf",
46
+ ".mp3": "audio/mpeg",
47
+ ".wav": "audio/wav",
48
+ ".ogg": "audio/ogg",
49
+ ".m4a": "audio/mp4",
50
+ ".mp4": "video/mp4",
51
+ ".mov": "video/quicktime",
52
+ ".webm": "video/webm"
53
+ };
54
+ const mapped = extMap[ext];
55
+ if (mapped)
56
+ return mapped;
57
+ }
58
+ return "application/octet-stream";
59
+ }
60
+ function isMediaType(mime) {
61
+ if (typeof mime !== "string")
62
+ return false;
63
+ const m = mime.toLowerCase();
64
+ return m.startsWith("image/") || m.startsWith("audio/") || m.startsWith("video/") || m === "application/pdf";
65
+ }
66
+ var HTTP_URL_RE = /^https?:\/\//i;
67
+ var DATA_URL_RE = /^data:([^;,]+)(;base64)?,(.*)$/s;
68
+ async function parseImageInput(input) {
69
+ if (!input || typeof input !== "string" || input.trim().length === 0) {
70
+ throw new Error("parseImageInput: input is empty");
71
+ }
72
+ const trimmed = input.trim();
73
+ if (HTTP_URL_RE.test(trimmed)) {
74
+ return { type: "image", image: trimmed };
75
+ }
76
+ if (DATA_URL_RE.test(trimmed)) {
77
+ return { type: "image", image: trimmed };
78
+ }
79
+ return await parseLocalImagePath(trimmed);
80
+ }
81
+ async function parseLocalImagePath(filePath) {
82
+ let stat2;
83
+ try {
84
+ stat2 = await fs.stat(filePath);
85
+ } catch (err) {
86
+ throw new Error(`parseImageInput: cannot stat file '${filePath}': ${err.message}`);
87
+ }
88
+ if (!stat2.isFile()) {
89
+ throw new Error(`parseImageInput: not a regular file: ${filePath}`);
90
+ }
91
+ if (stat2.size > ATTACH_FILE_MAX_BYTES) {
92
+ throw new Error(`parseImageInput: file '${filePath}' exceeds 10 MiB limit ` + `(${stat2.size} bytes > ${ATTACH_FILE_MAX_BYTES} bytes)`);
93
+ }
94
+ const buffer = await fs.readFile(filePath);
95
+ const mime = sniffMimeType(buffer, filePath);
96
+ if (!mime.startsWith("image/")) {
97
+ throw new Error(`parseImageInput: file '${filePath}' is not an image (detected ${mime}). ` + `Use ContentPart type 'file' for non-image attachments.`);
98
+ }
99
+ return { type: "image", image: buffer };
100
+ }
101
+
102
+ // src/env/tool/built-in/understand-image.ts
103
+ var injectedProvider = null;
104
+ function setUnderstandImageLLMProvider(provider) {
105
+ injectedProvider = provider;
106
+ }
107
+ function getUnderstandImageLLMProvider() {
108
+ return injectedProvider;
109
+ }
110
+ async function resetUnderstandImageLLMProvider() {
111
+ injectedProvider = null;
112
+ }
113
+ function normalizeImageSource(raw) {
114
+ if (typeof raw !== "string")
115
+ return raw;
116
+ return raw.startsWith("@") ? raw.slice(1) : raw;
117
+ }
118
+ var understandImageTool = {
119
+ name: "understand_image",
120
+ description: "Analyze or describe the contents of an image using a multimodal LLM. " + "Provide a prompt describing what you want to extract or understand " + "(e.g. 'Describe this image in detail', 'Read the text in the receipt', " + "'What color is the car?'). The image_source can be an HTTP(S) URL, a " + "data:base64 URL, or a local file path (optionally prefixed with '@').",
121
+ parameters: z.object({
122
+ prompt: z.string().min(1).describe("A text prompt describing what you want to analyze or extract from the image."),
123
+ image_source: z.string().min(1).describe("The location of the image to analyze. Accepts HTTP(S) URL, data:base64 URL, or local file path. Optional '@' prefix is stripped.")
124
+ }),
125
+ metadata: {
126
+ category: "ai",
127
+ tags: ["multimodal", "vision", "image", "llm", "ocr"],
128
+ version: "1.0.0"
129
+ },
130
+ permission: {
131
+ level: "safe"
132
+ },
133
+ execute: async (args, _ctx) => {
134
+ const startTime = Date.now();
135
+ const { prompt, image_source } = args;
136
+ if (!injectedProvider) {
137
+ return {
138
+ success: false,
139
+ output: "",
140
+ error: "understand_image is not initialized: no LLM provider has been " + "registered. AgentComponent should call setUnderstandImageLLMProvider() " + "at agent startup.",
141
+ metadata: { execution_time_ms: Date.now() - startTime }
142
+ };
143
+ }
144
+ let imagePart;
145
+ try {
146
+ imagePart = await parseImageInput(normalizeImageSource(image_source));
147
+ } catch (err) {
148
+ return {
149
+ success: false,
150
+ output: "",
151
+ error: `failed to read image: ${err.message}`,
152
+ metadata: { execution_time_ms: Date.now() - startTime }
153
+ };
154
+ }
155
+ const messages = [
156
+ {
157
+ role: "user",
158
+ content: [
159
+ { type: "text", text: prompt },
160
+ imagePart
161
+ ]
162
+ }
163
+ ];
164
+ let responseText;
165
+ try {
166
+ responseText = await injectedProvider(messages);
167
+ } catch (err) {
168
+ return {
169
+ success: false,
170
+ output: "",
171
+ error: `LLM invocation failed: ${err.message}`,
172
+ metadata: { execution_time_ms: Date.now() - startTime }
173
+ };
174
+ }
175
+ return {
176
+ success: true,
177
+ output: responseText,
178
+ metadata: {
179
+ execution_time_ms: Date.now() - startTime
180
+ }
181
+ };
182
+ }
183
+ };
184
+
185
+ export { ATTACH_FILE_MAX_BYTES, sniffMimeType, isMediaType, parseImageInput, setUnderstandImageLLMProvider, getUnderstandImageLLMProvider, resetUnderstandImageLLMProvider, understandImageTool };
@@ -5,7 +5,7 @@ import {
5
5
  BackgroundTaskManager,
6
6
  createDelegateTool,
7
7
  createStopTool
8
- } from "./roy-agent-core-at05dk0z.js";
8
+ } from "./roy-agent-core-ss92p0r6.js";
9
9
  import {
10
10
  SQLiteTaskStore,
11
11
  getDefaultTaskDbPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.92",
3
+ "version": "1.5.94",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",