@ai-setting/roy-agent-core 1.7.37 → 1.7.39

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 (82) hide show
  1. package/dist/config/index.js +7 -7
  2. package/dist/env/agent/index.js +10 -10
  3. package/dist/env/commands/index.js +7 -7
  4. package/dist/env/context/index.js +7 -3
  5. package/dist/env/debug/index.js +7 -7
  6. package/dist/env/event-source/index.js +24 -14
  7. package/dist/env/hook/index.js +5 -5
  8. package/dist/env/index.js +33 -32
  9. package/dist/env/llm/index.js +7 -7
  10. package/dist/env/log-trace/index.js +7 -7
  11. package/dist/env/mcp/index.js +7 -7
  12. package/dist/env/memory/index.js +7 -7
  13. package/dist/env/plugin/index.js +7 -7
  14. package/dist/env/prompt/index.js +7 -7
  15. package/dist/env/session/index.js +7 -7
  16. package/dist/env/skill/index.js +7 -7
  17. package/dist/env/task/delegate/index.js +7 -6
  18. package/dist/env/task/index.js +12 -11
  19. package/dist/env/task/plugins/index.js +7 -7
  20. package/dist/env/task/storage/index.js +2 -2
  21. package/dist/env/task/tools/index.js +3 -3
  22. package/dist/env/tool/built-in/index.js +2 -2
  23. package/dist/env/tool/index.js +8 -8
  24. package/dist/env/workflow/engine/index.js +9 -9
  25. package/dist/env/workflow/index.js +17 -17
  26. package/dist/env/workflow/nodes/index.js +2 -2
  27. package/dist/env/workflow/service/index.js +2 -2
  28. package/dist/env/workflow/storage/index.js +3 -3
  29. package/dist/env/workflow/tools/index.js +11 -11
  30. package/dist/env/workflow/utils/index.js +4 -4
  31. package/dist/index.js +53 -43
  32. package/dist/shared/@ai-setting/{roy-agent-core-yf0ex8y1.js → roy-agent-core-333apxaa.js} +1 -1
  33. package/dist/shared/@ai-setting/{roy-agent-core-pxyyrxnn.js → roy-agent-core-34je386q.js} +4 -4
  34. package/dist/shared/@ai-setting/{roy-agent-core-q8vew3zh.js → roy-agent-core-3h7ajma5.js} +2 -2
  35. package/dist/shared/@ai-setting/{roy-agent-core-e4v61k3j.js → roy-agent-core-47wrv4ex.js} +94 -32
  36. package/dist/shared/@ai-setting/{roy-agent-core-9drbkjfr.js → roy-agent-core-4cj6hram.js} +1 -1
  37. package/dist/shared/@ai-setting/{roy-agent-core-fytqnxrd.js → roy-agent-core-4cqcdk7k.js} +3 -3
  38. package/dist/shared/@ai-setting/{roy-agent-core-zda3rfr3.js → roy-agent-core-4kbvfnn1.js} +54 -5
  39. package/dist/shared/@ai-setting/{roy-agent-core-bb57xjfh.js → roy-agent-core-5exnp10h.js} +11 -8
  40. package/dist/shared/@ai-setting/{roy-agent-core-jq7g5nxz.js → roy-agent-core-5j4awbgc.js} +3 -3
  41. package/dist/shared/@ai-setting/{roy-agent-core-1vj7dd14.js → roy-agent-core-6mnwqcqf.js} +1 -1
  42. package/dist/shared/@ai-setting/{roy-agent-core-wgttzq8e.js → roy-agent-core-6vbgswjw.js} +1 -1
  43. package/dist/shared/@ai-setting/{roy-agent-core-1q6gjxba.js → roy-agent-core-6vwf03cz.js} +10 -7
  44. package/dist/shared/@ai-setting/{roy-agent-core-a8zf7ts4.js → roy-agent-core-754b0078.js} +5 -5
  45. package/dist/shared/@ai-setting/{roy-agent-core-j9ejsmsj.js → roy-agent-core-8nv07zgr.js} +1 -1
  46. package/dist/shared/@ai-setting/{roy-agent-core-yw07bvqz.js → roy-agent-core-9cqpdrnk.js} +3 -3
  47. package/dist/shared/@ai-setting/{roy-agent-core-q3zvkbj6.js → roy-agent-core-9qn92jhf.js} +2 -2
  48. package/dist/shared/@ai-setting/{roy-agent-core-m7dppx2p.js → roy-agent-core-9t675te0.js} +2 -2
  49. package/dist/shared/@ai-setting/{roy-agent-core-fym6zz5a.js → roy-agent-core-a236mps6.js} +2 -2
  50. package/dist/shared/@ai-setting/{roy-agent-core-qhjm0bxm.js → roy-agent-core-a9pbda78.js} +23 -13
  51. package/dist/shared/@ai-setting/{roy-agent-core-s53yya0w.js → roy-agent-core-asxe1nt4.js} +5 -5
  52. package/dist/shared/@ai-setting/{roy-agent-core-em8618g6.js → roy-agent-core-cazvr63z.js} +237 -14
  53. package/dist/shared/@ai-setting/{roy-agent-core-ds5f75pg.js → roy-agent-core-ck60j1q9.js} +19 -1
  54. package/dist/shared/@ai-setting/{roy-agent-core-w457586k.js → roy-agent-core-cw89yj9d.js} +1 -1
  55. package/dist/shared/@ai-setting/{roy-agent-core-462v5d24.js → roy-agent-core-cysnmvcy.js} +1 -1
  56. package/dist/shared/@ai-setting/{roy-agent-core-88tfzaxg.js → roy-agent-core-f18jk3cw.js} +1 -1
  57. package/dist/shared/@ai-setting/{roy-agent-core-qz9jb9sp.js → roy-agent-core-hkj5v9xq.js} +1 -1
  58. package/dist/shared/@ai-setting/{roy-agent-core-dzfyjzgw.js → roy-agent-core-jadrj0bz.js} +27 -2
  59. package/dist/shared/@ai-setting/{roy-agent-core-dfay0w56.js → roy-agent-core-jawzpf5k.js} +2 -2
  60. package/dist/shared/@ai-setting/{roy-agent-core-zekkw27m.js → roy-agent-core-jg8cv1f7.js} +128 -29
  61. package/dist/shared/@ai-setting/{roy-agent-core-mwaesrpc.js → roy-agent-core-jjw7xcxv.js} +4 -4
  62. package/dist/shared/@ai-setting/{roy-agent-core-2qke91fm.js → roy-agent-core-krppch0s.js} +3 -3
  63. package/dist/shared/@ai-setting/{roy-agent-core-mxwaq8ey.js → roy-agent-core-m3ffkexb.js} +13 -13
  64. package/dist/shared/@ai-setting/{roy-agent-core-2wbdfrtg.js → roy-agent-core-n1ceexfz.js} +1 -1
  65. package/dist/shared/@ai-setting/{roy-agent-core-1btakphh.js → roy-agent-core-pc8x07p0.js} +1 -1
  66. package/dist/shared/@ai-setting/{roy-agent-core-d5gwqrr5.js → roy-agent-core-pd0exvnq.js} +1 -1
  67. package/dist/shared/@ai-setting/{roy-agent-core-1nvqn17p.js → roy-agent-core-qfktfbrr.js} +4 -4
  68. package/dist/shared/@ai-setting/{roy-agent-core-x4wev4rn.js → roy-agent-core-rczz7e81.js} +5 -5
  69. package/dist/shared/@ai-setting/{roy-agent-core-e3qjt852.js → roy-agent-core-rgpkygbc.js} +1 -1
  70. package/dist/shared/@ai-setting/{roy-agent-core-rx8whb18.js → roy-agent-core-s44egzrh.js} +35 -4
  71. package/dist/shared/@ai-setting/{roy-agent-core-k5csz66y.js → roy-agent-core-tm57tmds.js} +1 -1
  72. package/dist/shared/@ai-setting/{roy-agent-core-qhtejtpc.js → roy-agent-core-vsrfzaze.js} +1 -1
  73. package/dist/shared/@ai-setting/{roy-agent-core-whta3f53.js → roy-agent-core-wn59p0zw.js} +1 -1
  74. package/dist/shared/@ai-setting/{roy-agent-core-mdaew65f.js → roy-agent-core-wybj8emq.js} +1 -1
  75. package/dist/shared/@ai-setting/{roy-agent-core-ddq5hcp5.js → roy-agent-core-x6c45yqd.js} +3 -1
  76. package/dist/shared/@ai-setting/roy-agent-core-xyys5m1a.js +159 -0
  77. package/dist/shared/@ai-setting/{roy-agent-core-wphva2vs.js → roy-agent-core-y1n63tse.js} +2 -2
  78. package/dist/shared/@ai-setting/{roy-agent-core-jcdsghyr.js → roy-agent-core-yjjqm4ww.js} +1 -1
  79. package/dist/shared/@ai-setting/{roy-agent-core-n3pwkwjh.js → roy-agent-core-za09t5g3.js} +1 -1
  80. package/dist/shared/@ai-setting/{roy-agent-core-n82acszf.js → roy-agent-core-zbb3sk72.js} +17 -3
  81. package/package.json +1 -1
  82. /package/dist/shared/@ai-setting/{roy-agent-core-k5hxvaf0.js → roy-agent-core-3ztzc83c.js} +0 -0
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ConfigComponent
3
- } from "./shared/@ai-setting/roy-agent-core-88tfzaxg.js";
3
+ } from "./shared/@ai-setting/roy-agent-core-f18jk3cw.js";
4
4
  import {
5
5
  PromptComponent,
6
6
  PromptStore
7
- } from "./shared/@ai-setting/roy-agent-core-2qke91fm.js";
7
+ } from "./shared/@ai-setting/roy-agent-core-krppch0s.js";
8
8
  import {
9
9
  LLMComponent,
10
10
  LLMConfigSchema,
@@ -12,7 +12,7 @@ import {
12
12
  ModelLimitsSchema,
13
13
  ProviderCapabilitiesSchema,
14
14
  ProviderConfigSchema
15
- } from "./shared/@ai-setting/roy-agent-core-fytqnxrd.js";
15
+ } from "./shared/@ai-setting/roy-agent-core-4cqcdk7k.js";
16
16
  import"./shared/@ai-setting/roy-agent-core-adg9ghbt.js";
17
17
  import"./shared/@ai-setting/roy-agent-core-wjmwwc4a.js";
18
18
  import {
@@ -24,7 +24,7 @@ import {
24
24
  grepTool,
25
25
  readFileTool,
26
26
  writeFileTool
27
- } from "./shared/@ai-setting/roy-agent-core-e3qjt852.js";
27
+ } from "./shared/@ai-setting/roy-agent-core-rgpkygbc.js";
28
28
  import {
29
29
  getUnderstandImageLLMProvider,
30
30
  resetUnderstandImageLLMProvider,
@@ -39,7 +39,7 @@ import {
39
39
  } from "./shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
40
40
  import {
41
41
  DebugComponent
42
- } from "./shared/@ai-setting/roy-agent-core-462v5d24.js";
42
+ } from "./shared/@ai-setting/roy-agent-core-cysnmvcy.js";
43
43
  import {
44
44
  ReplFormatter,
45
45
  TraceFormatter,
@@ -47,7 +47,7 @@ import {
47
47
  } from "./shared/@ai-setting/roy-agent-core-rvv6ydff.js";
48
48
  import {
49
49
  MemoryComponent
50
- } from "./shared/@ai-setting/roy-agent-core-mdaew65f.js";
50
+ } from "./shared/@ai-setting/roy-agent-core-wybj8emq.js";
51
51
  import {
52
52
  MemoryPlugin,
53
53
  createMemoryPlugin
@@ -55,31 +55,31 @@ import {
55
55
  import"./shared/@ai-setting/roy-agent-core-g1s2h0e5.js";
56
56
  import {
57
57
  SkillComponent
58
- } from "./shared/@ai-setting/roy-agent-core-1vj7dd14.js";
58
+ } from "./shared/@ai-setting/roy-agent-core-6mnwqcqf.js";
59
59
  import"./shared/@ai-setting/roy-agent-core-psvxt4c9.js";
60
- import"./shared/@ai-setting/roy-agent-core-k5hxvaf0.js";
60
+ import"./shared/@ai-setting/roy-agent-core-3ztzc83c.js";
61
61
  import {
62
62
  closeDatabase
63
- } from "./shared/@ai-setting/roy-agent-core-zda3rfr3.js";
64
- import"./shared/@ai-setting/roy-agent-core-d5gwqrr5.js";
63
+ } from "./shared/@ai-setting/roy-agent-core-4kbvfnn1.js";
64
+ import"./shared/@ai-setting/roy-agent-core-pd0exvnq.js";
65
65
  import {
66
66
  BaseEnvironment,
67
67
  generateDescendingId,
68
68
  generateId
69
- } from "./shared/@ai-setting/roy-agent-core-a8zf7ts4.js";
69
+ } from "./shared/@ai-setting/roy-agent-core-754b0078.js";
70
70
  import {
71
71
  TaskComponent
72
- } from "./shared/@ai-setting/roy-agent-core-1q6gjxba.js";
73
- import"./shared/@ai-setting/roy-agent-core-qhtejtpc.js";
72
+ } from "./shared/@ai-setting/roy-agent-core-6vwf03cz.js";
73
+ import"./shared/@ai-setting/roy-agent-core-vsrfzaze.js";
74
74
  import"./shared/@ai-setting/roy-agent-core-rn57psp0.js";
75
75
  import"./shared/@ai-setting/roy-agent-core-amkqnyzy.js";
76
76
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
77
- import"./shared/@ai-setting/roy-agent-core-zekkw27m.js";
77
+ import"./shared/@ai-setting/roy-agent-core-jg8cv1f7.js";
78
78
  import"./shared/@ai-setting/roy-agent-core-tbrn9wdm.js";
79
79
  import {
80
80
  SQLiteTaskStore,
81
81
  getDefaultTaskDbPath
82
- } from "./shared/@ai-setting/roy-agent-core-dzfyjzgw.js";
82
+ } from "./shared/@ai-setting/roy-agent-core-jadrj0bz.js";
83
83
  import {
84
84
  BountyIMInstance,
85
85
  EventSourceComponent,
@@ -92,11 +92,11 @@ import {
92
92
  larkCliHandler,
93
93
  resolveBountyIMSystemPrompt,
94
94
  timerHandler
95
- } from "./shared/@ai-setting/roy-agent-core-em8618g6.js";
95
+ } from "./shared/@ai-setting/roy-agent-core-cazvr63z.js";
96
96
  import {
97
97
  LogTraceComponent,
98
98
  LogTraceConfigSchema
99
- } from "./shared/@ai-setting/roy-agent-core-dfay0w56.js";
99
+ } from "./shared/@ai-setting/roy-agent-core-jawzpf5k.js";
100
100
  import {
101
101
  BUILT_IN_EVENT_SOURCE_TYPES,
102
102
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -105,11 +105,17 @@ import {
105
105
  isBuiltInEventSourceType,
106
106
  isValidEventSourceType,
107
107
  validateEventSourceConfig
108
- } from "./shared/@ai-setting/roy-agent-core-ds5f75pg.js";
108
+ } from "./shared/@ai-setting/roy-agent-core-ck60j1q9.js";
109
+ import {
110
+ EventStoreImpl,
111
+ getSharedEventStore,
112
+ resetSharedEventStore,
113
+ setSharedEventStore
114
+ } from "./shared/@ai-setting/roy-agent-core-xyys5m1a.js";
109
115
  import {
110
116
  TaskTagPlugin,
111
117
  createAutoTaskPlugin
112
- } from "./shared/@ai-setting/roy-agent-core-e4v61k3j.js";
118
+ } from "./shared/@ai-setting/roy-agent-core-47wrv4ex.js";
113
119
  import {
114
120
  TaskHookPoints
115
121
  } from "./shared/@ai-setting/roy-agent-core-1pg0fepg.js";
@@ -119,11 +125,11 @@ import {
119
125
  } from "./shared/@ai-setting/roy-agent-core-skqt40yy.js";
120
126
  import {
121
127
  WorkflowComponent
122
- } from "./shared/@ai-setting/roy-agent-core-mxwaq8ey.js";
128
+ } from "./shared/@ai-setting/roy-agent-core-m3ffkexb.js";
123
129
  import {
124
130
  init_node_registry_helper,
125
131
  registerDecoratorNodeType
126
- } from "./shared/@ai-setting/roy-agent-core-qz9jb9sp.js";
132
+ } from "./shared/@ai-setting/roy-agent-core-hkj5v9xq.js";
127
133
  import {
128
134
  Edge,
129
135
  NodeAs,
@@ -132,49 +138,49 @@ import {
132
138
  createWorkflowFromClass
133
139
  } from "./shared/@ai-setting/roy-agent-core-h0x19xgn.js";
134
140
  import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
135
- import"./shared/@ai-setting/roy-agent-core-pxyyrxnn.js";
141
+ import"./shared/@ai-setting/roy-agent-core-34je386q.js";
136
142
  import {
137
143
  SessionComponent
138
- } from "./shared/@ai-setting/roy-agent-core-rx8whb18.js";
144
+ } from "./shared/@ai-setting/roy-agent-core-s44egzrh.js";
139
145
  import {
140
146
  MemorySessionStore
141
147
  } from "./shared/@ai-setting/roy-agent-core-bdhcwf4x.js";
142
148
  import"./shared/@ai-setting/roy-agent-core-hhrg314p.js";
143
- import"./shared/@ai-setting/roy-agent-core-j9ejsmsj.js";
144
- import"./shared/@ai-setting/roy-agent-core-x4wev4rn.js";
149
+ import"./shared/@ai-setting/roy-agent-core-8nv07zgr.js";
150
+ import"./shared/@ai-setting/roy-agent-core-rczz7e81.js";
145
151
  import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
146
- import"./shared/@ai-setting/roy-agent-core-q8vew3zh.js";
147
- import"./shared/@ai-setting/roy-agent-core-jcdsghyr.js";
152
+ import"./shared/@ai-setting/roy-agent-core-3h7ajma5.js";
153
+ import"./shared/@ai-setting/roy-agent-core-yjjqm4ww.js";
148
154
  import"./shared/@ai-setting/roy-agent-core-1db4vpc6.js";
149
155
  import"./shared/@ai-setting/roy-agent-core-7exqwax1.js";
150
- import"./shared/@ai-setting/roy-agent-core-wgttzq8e.js";
151
- import"./shared/@ai-setting/roy-agent-core-yf0ex8y1.js";
156
+ import"./shared/@ai-setting/roy-agent-core-6vbgswjw.js";
157
+ import"./shared/@ai-setting/roy-agent-core-333apxaa.js";
152
158
  import"./shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
153
- import"./shared/@ai-setting/roy-agent-core-k5csz66y.js";
159
+ import"./shared/@ai-setting/roy-agent-core-tm57tmds.js";
154
160
  import"./shared/@ai-setting/roy-agent-core-jrj30vq3.js";
155
161
  import"./shared/@ai-setting/roy-agent-core-rvxg1wps.js";
156
162
  import {
157
163
  CommandsComponent
158
- } from "./shared/@ai-setting/roy-agent-core-2wbdfrtg.js";
164
+ } from "./shared/@ai-setting/roy-agent-core-n1ceexfz.js";
159
165
  import {
160
166
  AgentComponent,
161
167
  AgentComponentConfigSchema
162
- } from "./shared/@ai-setting/roy-agent-core-bb57xjfh.js";
168
+ } from "./shared/@ai-setting/roy-agent-core-5exnp10h.js";
163
169
  import {
164
170
  ToolComponent,
165
171
  ToolRegistry,
166
172
  ToolValidator
167
- } from "./shared/@ai-setting/roy-agent-core-mwaesrpc.js";
173
+ } from "./shared/@ai-setting/roy-agent-core-jjw7xcxv.js";
168
174
  import"./shared/@ai-setting/roy-agent-core-kzg1jwt8.js";
169
175
  import {
170
176
  AgentRegistry
171
- } from "./shared/@ai-setting/roy-agent-core-n3pwkwjh.js";
177
+ } from "./shared/@ai-setting/roy-agent-core-za09t5g3.js";
172
178
  import {
173
179
  XDG_PATHS,
174
180
  getXDGPath,
175
181
  getXDGPaths
176
182
  } from "./shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
177
- import"./shared/@ai-setting/roy-agent-core-9drbkjfr.js";
183
+ import"./shared/@ai-setting/roy-agent-core-4cj6hram.js";
178
184
  import"./shared/@ai-setting/roy-agent-core-djdwq743.js";
179
185
  import {
180
186
  createInvokeConfig,
@@ -189,13 +195,13 @@ import {
189
195
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
190
196
  import {
191
197
  PluginComponent
192
- } from "./shared/@ai-setting/roy-agent-core-1nvqn17p.js";
198
+ } from "./shared/@ai-setting/roy-agent-core-qfktfbrr.js";
193
199
  import {
194
200
  BasePlugin
195
201
  } from "./shared/@ai-setting/roy-agent-core-rmn29nrh.js";
196
202
  import {
197
203
  McpComponent
198
- } from "./shared/@ai-setting/roy-agent-core-1btakphh.js";
204
+ } from "./shared/@ai-setting/roy-agent-core-pc8x07p0.js";
199
205
  import"./shared/@ai-setting/roy-agent-core-8t7wny6v.js";
200
206
  import {
201
207
  AgentError,
@@ -211,24 +217,24 @@ import {
211
217
  import"./shared/@ai-setting/roy-agent-core-7hh0brvs.js";
212
218
  import {
213
219
  BaseComponent
214
- } from "./shared/@ai-setting/roy-agent-core-m7dppx2p.js";
220
+ } from "./shared/@ai-setting/roy-agent-core-9t675te0.js";
215
221
  import {
216
222
  createHook,
217
223
  createPriorityHook
218
- } from "./shared/@ai-setting/roy-agent-core-w457586k.js";
224
+ } from "./shared/@ai-setting/roy-agent-core-cw89yj9d.js";
219
225
  import {
220
226
  HookManager,
221
227
  globalHookManager
222
- } from "./shared/@ai-setting/roy-agent-core-fym6zz5a.js";
223
- import"./shared/@ai-setting/roy-agent-core-whta3f53.js";
224
- import"./shared/@ai-setting/roy-agent-core-n82acszf.js";
228
+ } from "./shared/@ai-setting/roy-agent-core-a236mps6.js";
229
+ import"./shared/@ai-setting/roy-agent-core-wn59p0zw.js";
230
+ import"./shared/@ai-setting/roy-agent-core-zbb3sk72.js";
225
231
  import {
226
232
  Traced,
227
233
  TracedAs,
228
234
  TracedLightweight,
229
235
  init_decorator,
230
236
  wrapFunction
231
- } from "./shared/@ai-setting/roy-agent-core-qhjm0bxm.js";
237
+ } from "./shared/@ai-setting/roy-agent-core-a9pbda78.js";
232
238
  import {
233
239
  OTelTracerProvider,
234
240
  SpanKind,
@@ -487,12 +493,14 @@ export {
487
493
  timerHandler,
488
494
  sniffMimeType,
489
495
  setUnderstandImageLLMProvider,
496
+ setSharedEventStore,
490
497
  setQuietMode,
491
498
  setConfigComponent as setLoggerConfigComponent,
492
499
  setLogDirOverride,
493
500
  resolveBountyIMSystemPrompt,
494
501
  resetUnderstandImageLLMProvider,
495
502
  resetTracerProvider,
503
+ resetSharedEventStore,
496
504
  registerDecoratorNodeType,
497
505
  readFileTool,
498
506
  propagation,
@@ -513,6 +521,7 @@ export {
513
521
  getXDGPath,
514
522
  getUnderstandImageLLMProvider,
515
523
  getTracerProvider,
524
+ getSharedEventStore,
516
525
  getLogLevels,
517
526
  getLogLevel,
518
527
  getLogDir,
@@ -586,6 +595,7 @@ export {
586
595
  LLMConfigSchema,
587
596
  LLMComponent,
588
597
  HookManager,
598
+ EventStoreImpl,
589
599
  EventSourceInitHooks,
590
600
  EventSourceComponent,
591
601
  ErrorCodes,
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  TracedAs,
13
13
  init_decorator
14
- } from "./roy-agent-core-qhjm0bxm.js";
14
+ } from "./roy-agent-core-a9pbda78.js";
15
15
  import {
16
16
  __esm,
17
17
  __legacyDecorateClassTS
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  isValidSessionId
3
- } from "./roy-agent-core-rx8whb18.js";
3
+ } from "./roy-agent-core-s44egzrh.js";
4
4
  import {
5
5
  TAG_MAX_COUNT,
6
6
  TAG_MIN_COUNT
7
- } from "./roy-agent-core-j9ejsmsj.js";
7
+ } from "./roy-agent-core-8nv07zgr.js";
8
8
  import {
9
9
  validateWorkflowDefinition
10
- } from "./roy-agent-core-wgttzq8e.js";
10
+ } from "./roy-agent-core-6vbgswjw.js";
11
11
  import {
12
12
  getCurrentBgTaskId
13
13
  } from "./roy-agent-core-c1v263jn.js";
@@ -18,7 +18,7 @@ import {
18
18
  import {
19
19
  TracedAs,
20
20
  init_decorator
21
- } from "./roy-agent-core-qhjm0bxm.js";
21
+ } from "./roy-agent-core-a9pbda78.js";
22
22
  import {
23
23
  createLogger,
24
24
  init_logger
@@ -9,12 +9,12 @@ import {
9
9
  import {
10
10
  globalHookManager,
11
11
  init_global_hook_manager
12
- } from "./roy-agent-core-fym6zz5a.js";
12
+ } from "./roy-agent-core-a236mps6.js";
13
13
  import {
14
14
  TracedAs,
15
15
  init_decorator,
16
16
  wrapFunction
17
- } from "./roy-agent-core-qhjm0bxm.js";
17
+ } from "./roy-agent-core-a9pbda78.js";
18
18
  import {
19
19
  createLogger,
20
20
  init_logger
@@ -6,28 +6,28 @@ import {
6
6
  } from "./roy-agent-core-skqt40yy.js";
7
7
  import {
8
8
  validateWorkflowDefinition
9
- } from "./roy-agent-core-wgttzq8e.js";
9
+ } from "./roy-agent-core-6vbgswjw.js";
10
10
  import {
11
11
  enqueueToAddFakeUserMessage
12
- } from "./roy-agent-core-9drbkjfr.js";
12
+ } from "./roy-agent-core-4cj6hram.js";
13
13
  import {
14
14
  BasePlugin,
15
15
  normalizeLarkAtMentions
16
16
  } from "./roy-agent-core-rmn29nrh.js";
17
17
  import {
18
18
  init_context
19
- } from "./roy-agent-core-whta3f53.js";
19
+ } from "./roy-agent-core-wn59p0zw.js";
20
20
  import {
21
21
  getEnvContextOrEmpty,
22
22
  getEventFromEnvContext,
23
23
  getLarkMessageId,
24
24
  isLarkEvent
25
- } from "./roy-agent-core-n82acszf.js";
25
+ } from "./roy-agent-core-zbb3sk72.js";
26
26
  import {
27
27
  TracedAs,
28
28
  init_decorator,
29
29
  wrapFunction
30
- } from "./roy-agent-core-qhjm0bxm.js";
30
+ } from "./roy-agent-core-a9pbda78.js";
31
31
  import {
32
32
  createLogger,
33
33
  init_logger
@@ -296,11 +296,11 @@ ${prompt}`;
296
296
  }
297
297
  if (!this._workflowRepo) {
298
298
  try {
299
- const sqlite = await import("./roy-agent-core-yw07bvqz.js");
299
+ const sqlite = await import("./roy-agent-core-9cqpdrnk.js");
300
300
  this.ensureDataDir();
301
301
  const db = sqlite.getDatabase();
302
302
  sqlite.initializeTables();
303
- const { WorkflowRepository } = await import("./roy-agent-core-jq7g5nxz.js");
303
+ const { WorkflowRepository } = await import("./roy-agent-core-5j4awbgc.js");
304
304
  this._workflowRepo = new WorkflowRepository(db);
305
305
  return this._workflowRepo;
306
306
  } catch {
@@ -822,6 +822,7 @@ class PerTaskGroupChatPlugin {
822
822
  config;
823
823
  lastNotifyTimestamps = new Map;
824
824
  taskUpdater;
825
+ taskGetter;
825
826
  sessionComponent;
826
827
  constructor(config = {}) {
827
828
  this.config = {
@@ -853,6 +854,13 @@ class PerTaskGroupChatPlugin {
853
854
  hasTaskUpdater() {
854
855
  return this.taskUpdater !== undefined;
855
856
  }
857
+ setTaskGetter(getter) {
858
+ this.taskGetter = getter;
859
+ logger4.debug(`TaskGetter injected for plugin ${this.name} (sourceId=${this.sourceId})`);
860
+ }
861
+ hasTaskGetter() {
862
+ return this.taskGetter !== undefined;
863
+ }
856
864
  setSessionComponent(sessionComponent) {
857
865
  this.sessionComponent = sessionComponent;
858
866
  logger4.debug(`SessionComponent injected for plugin ${this.name} (sourceId=${this.sourceId})`);
@@ -923,29 +931,17 @@ class PerTaskGroupChatPlugin {
923
931
  const botAppIds = this.resolveBotAppIds(replyChannel ?? {});
924
932
  const userIds = this.resolveUserIds(replyChannel);
925
933
  logger4.debug(`onAfterCreate[${this.pluginName}]: creating group chat for task #${task.id} ` + `name="${name}" profile="${profile}" botAppIds=${JSON.stringify(botAppIds)} ` + `userIds=${JSON.stringify(userIds)}`);
934
+ let chatId;
926
935
  try {
927
- const chatId = await this.createGroupChat({
936
+ chatId = await this.createGroupChat({
928
937
  name,
929
938
  description,
930
939
  profile,
931
940
  botAppIds,
932
941
  userIds
933
942
  });
943
+ await this.writeChatBinding(task, chatId, profile, "creating");
934
944
  await this.attachChatIdToTask(task, chatId, profile);
935
- if (this.sessionComponent) {
936
- try {
937
- await this.sessionComponent.upsertChatTaskBinding({
938
- chatId,
939
- taskId: task.id,
940
- profile,
941
- status: "ready"
942
- });
943
- } catch (bindErr) {
944
- logger4.warn(`onAfterCreate[${this.pluginName}]: failed to write chat-task binding for ` + `chat ${chatId} / task #${task.id}: ${bindErr}. ` + `群消息 handler 将无法自动注入 parentTaskId。`);
945
- }
946
- } else if (isPluginDebugEnabled()) {
947
- logger4.debug(`onAfterCreate[${this.pluginName}]: no sessionComponent injected, ` + `skip chat-task binding for chat ${chatId}`);
948
- }
949
945
  if (this.config.sendWelcomeMessage) {
950
946
  try {
951
947
  await this.sendToChat({
@@ -974,13 +970,36 @@ class PerTaskGroupChatPlugin {
974
970
  } else {
975
971
  logger4.debug(`onAfterCreate[${this.pluginName}]: skip "群聊已创建" main-chat notification ` + `(no replyChannel.chatId)`);
976
972
  }
973
+ await this.writeChatBinding(task, chatId, profile, "ready");
977
974
  logger4.info(`Created per-task group chat ${chatId} for task #${task.id}`);
978
975
  } catch (error) {
979
976
  logger4.error(`Failed to create per-task group chat for task #${task.id}: ${error}`);
977
+ if (chatId) {
978
+ await this.writeChatBinding(task, chatId, profile, "failed", String(error));
979
+ }
980
980
  if (!this.config.fallbackToMain)
981
981
  throw error;
982
982
  }
983
983
  }
984
+ async writeChatBinding(task, chatId, profile, status, errorMessage) {
985
+ if (!this.sessionComponent) {
986
+ if (isPluginDebugEnabled()) {
987
+ logger4.debug(`writeChatBinding[${this.pluginName}]: no sessionComponent injected, ` + `skip chat-task binding for chat ${chatId} (status=${status})`);
988
+ }
989
+ return;
990
+ }
991
+ try {
992
+ await this.sessionComponent.upsertChatTaskBinding({
993
+ chatId,
994
+ taskId: task.id,
995
+ profile,
996
+ status,
997
+ errorMessage: errorMessage ?? null
998
+ });
999
+ } catch (bindErr) {
1000
+ logger4.warn(`writeChatBinding[${this.pluginName}]: failed to write chat-task binding for ` + `chat ${chatId} / task #${task.id} (status=${status}): ${bindErr}. ` + `群消息 handler 将无法自动注入 parentTaskId。`);
1001
+ }
1002
+ }
984
1003
  async onAfterUpdate(ctx) {
985
1004
  const data = ctx.data;
986
1005
  if (!data?.task) {
@@ -988,13 +1007,13 @@ class PerTaskGroupChatPlugin {
988
1007
  return;
989
1008
  }
990
1009
  const { task, changes } = data;
991
- const chatId = this.getTaskChatId(task);
1010
+ const { chatId, profile: inheritedProfile } = await this.resolveEffectiveChat(task);
992
1011
  if (!chatId) {
993
1012
  logger4.debug(`onAfterUpdate[${this.pluginName}]: task #${task.id} has no per-task chat_id, skip. ` + `诊断:检查 task.context JSON 是否含 larkPerTaskChatId 字段 ` + `(sqlite: SELECT context FROM task WHERE id=${task.id})`);
994
1013
  return;
995
1014
  }
996
1015
  const replyChannel = this.getReplyChannelFromCtx(ctx);
997
- const profile = replyChannel?.profile ?? this.getTaskChatProfile(task) ?? undefined;
1016
+ const profile = replyChannel?.profile ?? inheritedProfile ?? undefined;
998
1017
  if (!this.hasMeaningfulChange(changes)) {
999
1018
  logger4.debug(`onAfterUpdate[${this.pluginName}]: no meaningful change for task #${task.id}, skip`);
1000
1019
  return;
@@ -1023,13 +1042,13 @@ class PerTaskGroupChatPlugin {
1023
1042
  return;
1024
1043
  }
1025
1044
  const taskFromCtx = ctx.metadata?.task;
1026
- const chatId = taskFromCtx ? this.getTaskChatId(taskFromCtx) : undefined;
1045
+ const { chatId, profile: inheritedProfile } = taskFromCtx ? await this.resolveEffectiveChat(taskFromCtx) : {};
1027
1046
  if (!chatId || !taskFromCtx) {
1028
1047
  logger4.debug(`onAfterOperationCreate[${this.pluginName}]: no per-task chat_id for task #${taskId}, skip. ` + `诊断:ctx.metadata.task 是否包含完整 task 对象?task.context.larkPerTaskChatId 是否存在?`);
1029
1048
  return;
1030
1049
  }
1031
1050
  const replyChannel = this.getReplyChannelFromCtx(ctx);
1032
- const profile = replyChannel?.profile ?? this.getTaskChatProfile(taskFromCtx) ?? undefined;
1051
+ const profile = replyChannel?.profile ?? inheritedProfile ?? undefined;
1033
1052
  logger4.debug(`onAfterOperationCreate[${this.pluginName}]: send operation #${operation.id} ` + `for task #${taskId} to chat_id=${chatId}`);
1034
1053
  await this.sendToChat({
1035
1054
  chatId,
@@ -1044,13 +1063,13 @@ class PerTaskGroupChatPlugin {
1044
1063
  return;
1045
1064
  }
1046
1065
  const { task, terminalStatus } = data;
1047
- const chatId = this.getTaskChatId(task);
1066
+ const { chatId, profile: inheritedProfile } = await this.resolveEffectiveChat(task);
1048
1067
  if (!chatId) {
1049
1068
  logger4.debug(`onAfterComplete[${this.pluginName}]: task #${task.id} has no per-task chat_id, skip`);
1050
1069
  return;
1051
1070
  }
1052
1071
  const replyChannel = this.getReplyChannelFromCtx(ctx);
1053
- const profile = replyChannel?.profile ?? this.getTaskChatProfile(task) ?? undefined;
1072
+ const profile = replyChannel?.profile ?? inheritedProfile ?? undefined;
1054
1073
  const emoji = terminalStatus === "completed" ? "✅" : terminalStatus === "failed" ? "❌" : terminalStatus === "cancelled" ? "\uD83D\uDEAB" : terminalStatus === "timeout" ? "⏰" : "\uD83C\uDFC1";
1055
1074
  logger4.debug(`onAfterComplete[${this.pluginName}]: send complete notification for task #${task.id} ` + `status=${terminalStatus} to chat_id=${chatId}`);
1056
1075
  await this.sendToChat({
@@ -1244,8 +1263,7 @@ ${opts.content}`);
1244
1263
  }
1245
1264
  return;
1246
1265
  }
1247
- getTaskChatId(task) {
1248
- const ctxStr = task.context;
1266
+ parseChatIdFromContext(ctxStr) {
1249
1267
  if (!ctxStr)
1250
1268
  return;
1251
1269
  try {
@@ -1256,8 +1274,7 @@ ${opts.content}`);
1256
1274
  return;
1257
1275
  }
1258
1276
  }
1259
- getTaskChatProfile(task) {
1260
- const ctxStr = task.context;
1277
+ parseProfileFromContext(ctxStr) {
1261
1278
  if (!ctxStr)
1262
1279
  return;
1263
1280
  try {
@@ -1268,6 +1285,39 @@ ${opts.content}`);
1268
1285
  return;
1269
1286
  }
1270
1287
  }
1288
+ getTaskChatId(task) {
1289
+ return this.parseChatIdFromContext(task.context);
1290
+ }
1291
+ getTaskChatProfile(task) {
1292
+ return this.parseProfileFromContext(task.context);
1293
+ }
1294
+ async resolveEffectiveChat(task) {
1295
+ const ownChatId = this.getTaskChatId(task);
1296
+ if (ownChatId) {
1297
+ return { chatId: ownChatId, profile: this.getTaskChatProfile(task) };
1298
+ }
1299
+ if (!this.taskGetter)
1300
+ return {};
1301
+ const seen = new Set;
1302
+ let id = task.parent_task_id;
1303
+ while (typeof id === "number" && id > 0 && !seen.has(id) && seen.size < 8) {
1304
+ seen.add(id);
1305
+ let parent;
1306
+ try {
1307
+ parent = await this.taskGetter(id);
1308
+ } catch {
1309
+ return {};
1310
+ }
1311
+ if (!parent)
1312
+ return {};
1313
+ const chatId = this.parseChatIdFromContext(parent.context);
1314
+ if (chatId) {
1315
+ return { chatId, profile: this.parseProfileFromContext(parent.context) };
1316
+ }
1317
+ id = parent.parent_task_id ?? undefined;
1318
+ }
1319
+ return {};
1320
+ }
1271
1321
  resolveBotAppIds(replyChannel) {
1272
1322
  if (this.config.botAppIds.length > 0) {
1273
1323
  logger4.debug(`resolveBotAppIds[${this.pluginName}]: using config.botAppIds=${JSON.stringify(this.config.botAppIds)}`);
@@ -1455,6 +1505,18 @@ __legacyDecorateClassTS([
1455
1505
  __legacyDecorateClassTS([
1456
1506
  TracedAs("per-task-group-chat.onAfterCreate", { recordParams: false })
1457
1507
  ], PerTaskGroupChatPlugin.prototype, "onAfterCreate", null);
1508
+ __legacyDecorateClassTS([
1509
+ TracedAs("per-task-group-chat.writeChatBinding", {
1510
+ recordParams: true,
1511
+ recordResult: false,
1512
+ flattenParamFilter: true,
1513
+ paramFilter: (args) => ({
1514
+ taskId: args[0]?.id,
1515
+ chatId: args[1],
1516
+ status: args[3]
1517
+ })
1518
+ })
1519
+ ], PerTaskGroupChatPlugin.prototype, "writeChatBinding", null);
1458
1520
  __legacyDecorateClassTS([
1459
1521
  TracedAs("per-task-group-chat.onAfterUpdate", { recordParams: false })
1460
1522
  ], PerTaskGroupChatPlugin.prototype, "onAfterUpdate", null);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_decorator,
3
3
  wrapFunction
4
- } from "./roy-agent-core-qhjm0bxm.js";
4
+ } from "./roy-agent-core-a9pbda78.js";
5
5
 
6
6
  // src/env/task/plugins/fake-user-message-helper.ts
7
7
  init_decorator();
@@ -19,17 +19,17 @@ import {
19
19
  } from "./roy-agent-core-7hh0brvs.js";
20
20
  import {
21
21
  BaseComponent
22
- } from "./roy-agent-core-m7dppx2p.js";
22
+ } from "./roy-agent-core-9t675te0.js";
23
23
  import {
24
24
  LLMHookPoints,
25
25
  globalHookManager,
26
26
  init_global_hook_manager
27
- } from "./roy-agent-core-fym6zz5a.js";
27
+ } from "./roy-agent-core-a236mps6.js";
28
28
  import {
29
29
  TracedAs,
30
30
  init_decorator,
31
31
  wrapFunction
32
- } from "./roy-agent-core-qhjm0bxm.js";
32
+ } from "./roy-agent-core-a9pbda78.js";
33
33
  import {
34
34
  createLogger,
35
35
  init_logger