@ai-setting/roy-agent-core 1.5.101 → 1.5.103

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 (24) hide show
  1. package/dist/env/agent/index.js +3 -3
  2. package/dist/env/event-source/index.js +4 -4
  3. package/dist/env/index.js +10 -10
  4. package/dist/env/prompt/index.js +2 -2
  5. package/dist/env/task/delegate/index.js +3 -3
  6. package/dist/env/task/index.js +4 -4
  7. package/dist/env/task/plugins/index.js +3 -3
  8. package/dist/env/tool/built-in/index.js +2 -2
  9. package/dist/env/tool/index.js +4 -4
  10. package/dist/index.js +12 -12
  11. package/dist/shared/@ai-setting/{roy-agent-core-x47gc6rq.js → roy-agent-core-9ga65zcv.js} +1 -1
  12. package/dist/shared/@ai-setting/{roy-agent-core-mwb6918x.js → roy-agent-core-ac18e14n.js} +1 -1
  13. package/dist/shared/@ai-setting/{roy-agent-core-jhdv14ks.js → roy-agent-core-nbsw8k13.js} +6 -6
  14. package/dist/shared/@ai-setting/{roy-agent-core-09xaxtpf.js → roy-agent-core-npkwftxj.js} +11 -2
  15. package/dist/shared/@ai-setting/{roy-agent-core-ks9t8jh1.js → roy-agent-core-nz5wn9yc.js} +1 -1
  16. package/dist/shared/@ai-setting/roy-agent-core-pzeexnhf.js +192 -0
  17. package/dist/shared/@ai-setting/{roy-agent-core-fkb75cf6.js → roy-agent-core-s10azh5q.js} +13 -13
  18. package/dist/shared/@ai-setting/{roy-agent-core-nt77d6fs.js → roy-agent-core-s22egcxa.js} +1 -1
  19. package/dist/shared/@ai-setting/{roy-agent-core-dj18eyyk.js → roy-agent-core-vb9aa3kf.js} +22 -1
  20. package/dist/shared/@ai-setting/{roy-agent-core-mp3xb3am.js → roy-agent-core-wg0zvwx0.js} +1 -1
  21. package/dist/shared/@ai-setting/{roy-agent-core-bdajt9cs.js → roy-agent-core-xjdcx45t.js} +7 -6
  22. package/dist/shared/@ai-setting/{roy-agent-core-0vsnecwa.js → roy-agent-core-yd9ydk9a.js} +1 -1
  23. package/package.json +1 -1
  24. package/dist/shared/@ai-setting/roy-agent-core-hvdfgvfz.js +0 -114
@@ -2,11 +2,11 @@ import {
2
2
  AgentComponent,
3
3
  AgentComponentConfigSchema,
4
4
  SummaryAgent
5
- } from "../../shared/@ai-setting/roy-agent-core-ks9t8jh1.js";
5
+ } from "../../shared/@ai-setting/roy-agent-core-nz5wn9yc.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
7
- import"../../shared/@ai-setting/roy-agent-core-jhdv14ks.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-nbsw8k13.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
9
- import"../../shared/@ai-setting/roy-agent-core-bdajt9cs.js";
9
+ import"../../shared/@ai-setting/roy-agent-core-xjdcx45t.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
11
11
  import"../../shared/@ai-setting/roy-agent-core-k31c3kvz.js";
12
12
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
@@ -10,7 +10,7 @@ import {
10
10
  larkCliHandler,
11
11
  resolveBountyIMSystemPrompt,
12
12
  timerHandler
13
- } from "../../shared/@ai-setting/roy-agent-core-x47gc6rq.js";
13
+ } from "../../shared/@ai-setting/roy-agent-core-9ga65zcv.js";
14
14
  import {
15
15
  BUILT_IN_EVENT_SOURCE_TYPES,
16
16
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -21,12 +21,12 @@ import {
21
21
  validateEventSourceConfig
22
22
  } from "../../shared/@ai-setting/roy-agent-core-ds5f75pg.js";
23
23
  import"../../shared/@ai-setting/roy-agent-core-wmkx79b1.js";
24
- import"../../shared/@ai-setting/roy-agent-core-nt77d6fs.js";
24
+ import"../../shared/@ai-setting/roy-agent-core-s22egcxa.js";
25
25
  import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
26
26
  import"../../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
27
27
  import"../../shared/@ai-setting/roy-agent-core-4yq23m5g.js";
28
- import"../../shared/@ai-setting/roy-agent-core-bdajt9cs.js";
29
- import"../../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
28
+ import"../../shared/@ai-setting/roy-agent-core-xjdcx45t.js";
29
+ import"../../shared/@ai-setting/roy-agent-core-vb9aa3kf.js";
30
30
  import"../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
31
31
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
32
32
  import"../../shared/@ai-setting/roy-agent-core-pf1c360e.js";
package/dist/env/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  BaseEnvironment
3
- } from "../shared/@ai-setting/roy-agent-core-0vsnecwa.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-yd9ydk9a.js";
4
4
  import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-x47gc6rq.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-9ga65zcv.js";
9
9
  import {
10
10
  EventSourceInitHooks,
11
11
  getDefaultConfigForType,
@@ -17,7 +17,7 @@ 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-nt77d6fs.js";
20
+ import"../shared/@ai-setting/roy-agent-core-s22egcxa.js";
21
21
  import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
22
22
  import {
23
23
  WorkflowComponent
@@ -41,20 +41,20 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
41
41
  import {
42
42
  AgentComponent,
43
43
  AgentComponentConfigSchema
44
- } from "../shared/@ai-setting/roy-agent-core-ks9t8jh1.js";
44
+ } from "../shared/@ai-setting/roy-agent-core-nz5wn9yc.js";
45
45
  import"../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
46
- import"../shared/@ai-setting/roy-agent-core-jhdv14ks.js";
46
+ import"../shared/@ai-setting/roy-agent-core-nbsw8k13.js";
47
47
  import"../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
48
- import"../shared/@ai-setting/roy-agent-core-bdajt9cs.js";
48
+ import"../shared/@ai-setting/roy-agent-core-xjdcx45t.js";
49
49
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
50
50
  import {
51
51
  TaskComponent
52
- } from "../shared/@ai-setting/roy-agent-core-mp3xb3am.js";
52
+ } from "../shared/@ai-setting/roy-agent-core-wg0zvwx0.js";
53
53
  import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
54
- import"../shared/@ai-setting/roy-agent-core-fkb75cf6.js";
55
- import"../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
54
+ import"../shared/@ai-setting/roy-agent-core-s10azh5q.js";
55
+ import"../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
56
56
  import"../shared/@ai-setting/roy-agent-core-9xby523m.js";
57
- import"../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
57
+ import"../shared/@ai-setting/roy-agent-core-vb9aa3kf.js";
58
58
  import"../shared/@ai-setting/roy-agent-core-k31c3kvz.js";
59
59
  import {
60
60
  XDG_PATHS,
@@ -3,8 +3,8 @@ import {
3
3
  PromptConfigSchema,
4
4
  PromptPathSchema,
5
5
  PromptRenderer
6
- } from "../../shared/@ai-setting/roy-agent-core-mwb6918x.js";
7
- import"../../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
6
+ } from "../../shared/@ai-setting/roy-agent-core-ac18e14n.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-vb9aa3kf.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-fkb75cf6.js";
7
- import"../../../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
8
- import"../../../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-s10azh5q.js";
7
+ import"../../../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
8
+ import"../../../shared/@ai-setting/roy-agent-core-vb9aa3kf.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-k31c3kvz.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
@@ -5,17 +5,17 @@ import {
5
5
  TaskPriorityEnum,
6
6
  TaskStatusEnum,
7
7
  TaskTypeEnum
8
- } from "../../shared/@ai-setting/roy-agent-core-mp3xb3am.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-wg0zvwx0.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-fkb75cf6.js";
13
- import"../../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
12
+ import"../../shared/@ai-setting/roy-agent-core-s10azh5q.js";
13
+ import"../../shared/@ai-setting/roy-agent-core-pzeexnhf.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-dj18eyyk.js";
18
+ import"../../shared/@ai-setting/roy-agent-core-vb9aa3kf.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-k31c3kvz.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-0ye4q2jj.js";
@@ -7,14 +7,14 @@ import {
7
7
  formatExtractorInput,
8
8
  formatExtractorInputFromDescription,
9
9
  parseExtractorOutput
10
- } from "../../../shared/@ai-setting/roy-agent-core-nt77d6fs.js";
10
+ } from "../../../shared/@ai-setting/roy-agent-core-s22egcxa.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-4yq23m5g.js";
14
14
  import {
15
15
  createAutoTaskPlugin
16
- } from "../../../shared/@ai-setting/roy-agent-core-bdajt9cs.js";
17
- import"../../../shared/@ai-setting/roy-agent-core-dj18eyyk.js";
16
+ } from "../../../shared/@ai-setting/roy-agent-core-xjdcx45t.js";
17
+ import"../../../shared/@ai-setting/roy-agent-core-vb9aa3kf.js";
18
18
  import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
19
19
  import"../../../shared/@ai-setting/roy-agent-core-zttjq1h3.js";
20
20
  import"../../../shared/@ai-setting/roy-agent-core-scp0afxg.js";
@@ -8,14 +8,14 @@ import {
8
8
  grepTool,
9
9
  readFileTool,
10
10
  writeFileTool
11
- } from "../../../shared/@ai-setting/roy-agent-core-09xaxtpf.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-npkwftxj.js";
12
12
  import {
13
13
  getUnderstandImageLLMProvider,
14
14
  resetUnderstandImageLLMProvider,
15
15
  setUnderstandImageLLMProvider,
16
16
  understandImageTool
17
17
  } from "../../../shared/@ai-setting/roy-agent-core-t7rw68q8.js";
18
- import"../../../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
18
+ import"../../../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
19
19
  import"../../../shared/@ai-setting/roy-agent-core-cg146hmg.js";
20
20
  import"../../../shared/@ai-setting/roy-agent-core-vyygk314.js";
21
21
  import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
@@ -9,7 +9,7 @@ import {
9
9
  grepTool,
10
10
  readFileTool,
11
11
  writeFileTool
12
- } from "../../shared/@ai-setting/roy-agent-core-09xaxtpf.js";
12
+ } from "../../shared/@ai-setting/roy-agent-core-npkwftxj.js";
13
13
  import {
14
14
  getUnderstandImageLLMProvider,
15
15
  resetUnderstandImageLLMProvider,
@@ -22,11 +22,11 @@ import {
22
22
  ToolValidator,
23
23
  getMaxOutputSize,
24
24
  setToolConfigComponent
25
- } from "../../shared/@ai-setting/roy-agent-core-jhdv14ks.js";
25
+ } from "../../shared/@ai-setting/roy-agent-core-nbsw8k13.js";
26
26
  import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
27
- import"../../shared/@ai-setting/roy-agent-core-bdajt9cs.js";
27
+ import"../../shared/@ai-setting/roy-agent-core-xjdcx45t.js";
28
28
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
29
- import"../../shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
29
+ import"../../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
30
30
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
31
31
  import"../../shared/@ai-setting/roy-agent-core-pf1c360e.js";
32
32
  import"../../shared/@ai-setting/roy-agent-core-ksx9a556.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-mwb6918x.js";
4
+ } from "./shared/@ai-setting/roy-agent-core-ac18e14n.js";
5
5
  import {
6
6
  LLMComponent,
7
7
  LLMConfigSchema,
@@ -26,7 +26,7 @@ import {
26
26
  grepTool,
27
27
  readFileTool,
28
28
  writeFileTool
29
- } from "./shared/@ai-setting/roy-agent-core-09xaxtpf.js";
29
+ } from "./shared/@ai-setting/roy-agent-core-npkwftxj.js";
30
30
  import {
31
31
  ATTACH_FILE_MAX_BYTES,
32
32
  getUnderstandImageLLMProvider,
@@ -62,7 +62,7 @@ import {
62
62
  BaseEnvironment,
63
63
  generateDescendingId,
64
64
  generateId
65
- } from "./shared/@ai-setting/roy-agent-core-0vsnecwa.js";
65
+ } from "./shared/@ai-setting/roy-agent-core-yd9ydk9a.js";
66
66
  import {
67
67
  BountyIMInstance,
68
68
  EventSourceComponent,
@@ -74,7 +74,7 @@ import {
74
74
  larkCliHandler,
75
75
  resolveBountyIMSystemPrompt,
76
76
  timerHandler
77
- } from "./shared/@ai-setting/roy-agent-core-x47gc6rq.js";
77
+ } from "./shared/@ai-setting/roy-agent-core-9ga65zcv.js";
78
78
  import {
79
79
  BUILT_IN_EVENT_SOURCE_TYPES,
80
80
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -93,7 +93,7 @@ import {
93
93
  } from "./shared/@ai-setting/roy-agent-core-ws76avbn.js";
94
94
  import {
95
95
  TaskTagPlugin
96
- } from "./shared/@ai-setting/roy-agent-core-nt77d6fs.js";
96
+ } from "./shared/@ai-setting/roy-agent-core-s22egcxa.js";
97
97
  import {
98
98
  BasePlugin
99
99
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
@@ -128,7 +128,7 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
128
128
  import {
129
129
  AgentComponent,
130
130
  AgentComponentConfigSchema
131
- } from "./shared/@ai-setting/roy-agent-core-ks9t8jh1.js";
131
+ } from "./shared/@ai-setting/roy-agent-core-nz5wn9yc.js";
132
132
  import {
133
133
  createInvokeConfig,
134
134
  invoke,
@@ -139,21 +139,21 @@ import {
139
139
  ToolComponent,
140
140
  ToolRegistry,
141
141
  ToolValidator
142
- } from "./shared/@ai-setting/roy-agent-core-jhdv14ks.js";
142
+ } from "./shared/@ai-setting/roy-agent-core-nbsw8k13.js";
143
143
  import"./shared/@ai-setting/roy-agent-core-5h49ct1a.js";
144
144
  import {
145
145
  createAutoTaskPlugin
146
- } from "./shared/@ai-setting/roy-agent-core-bdajt9cs.js";
146
+ } from "./shared/@ai-setting/roy-agent-core-xjdcx45t.js";
147
147
  import {
148
148
  AskUserError,
149
149
  init_workflow_hil
150
150
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
151
151
  import {
152
152
  TaskComponent
153
- } from "./shared/@ai-setting/roy-agent-core-mp3xb3am.js";
153
+ } from "./shared/@ai-setting/roy-agent-core-wg0zvwx0.js";
154
154
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
155
- import"./shared/@ai-setting/roy-agent-core-fkb75cf6.js";
156
- import"./shared/@ai-setting/roy-agent-core-hvdfgvfz.js";
155
+ import"./shared/@ai-setting/roy-agent-core-s10azh5q.js";
156
+ import"./shared/@ai-setting/roy-agent-core-pzeexnhf.js";
157
157
  import {
158
158
  SQLiteTaskStore,
159
159
  getDefaultTaskDbPath
@@ -161,7 +161,7 @@ import {
161
161
  import {
162
162
  getBuiltInPrompt,
163
163
  getBuiltInPromptNames
164
- } from "./shared/@ai-setting/roy-agent-core-dj18eyyk.js";
164
+ } from "./shared/@ai-setting/roy-agent-core-vb9aa3kf.js";
165
165
  import {
166
166
  AgentRegistry
167
167
  } from "./shared/@ai-setting/roy-agent-core-k31c3kvz.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook
4
- } from "./roy-agent-core-nt77d6fs.js";
4
+ } from "./roy-agent-core-s22egcxa.js";
5
5
  import {
6
6
  envKeyToConfigKey
7
7
  } from "./roy-agent-core-qxhq8ven.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtInPrompts
3
- } from "./roy-agent-core-dj18eyyk.js";
3
+ } from "./roy-agent-core-vb9aa3kf.js";
4
4
  import {
5
5
  getXDGPath
6
6
  } from "./roy-agent-core-qxnbvgwe.js";
@@ -2,9 +2,9 @@ import {
2
2
  TempFileManager
3
3
  } from "./roy-agent-core-5h49ct1a.js";
4
4
  import {
5
- AUTO_TASK_METADATA_BEGIN,
6
- AUTO_TASK_METADATA_END
7
- } from "./roy-agent-core-bdajt9cs.js";
5
+ ITERATION_TASK_TRIGGER_BEGIN,
6
+ ITERATION_TASK_TRIGGER_END
7
+ } from "./roy-agent-core-xjdcx45t.js";
8
8
  import {
9
9
  AskUserError,
10
10
  init_workflow_hil
@@ -205,10 +205,10 @@ function truncateOutput(output, maxSize) {
205
205
  metadata: {}
206
206
  };
207
207
  }
208
- const beginIdx = output.indexOf(AUTO_TASK_METADATA_BEGIN);
209
- const endIdx = output.indexOf(AUTO_TASK_METADATA_END, beginIdx >= 0 ? beginIdx + AUTO_TASK_METADATA_BEGIN.length : 0);
208
+ const beginIdx = output.indexOf(ITERATION_TASK_TRIGGER_BEGIN);
209
+ const endIdx = output.indexOf(ITERATION_TASK_TRIGGER_END, beginIdx >= 0 ? beginIdx + ITERATION_TASK_TRIGGER_BEGIN.length : 0);
210
210
  if (beginIdx >= 0 && endIdx > beginIdx) {
211
- const metaEnd = endIdx + AUTO_TASK_METADATA_END.length;
211
+ const metaEnd = endIdx + ITERATION_TASK_TRIGGER_END.length;
212
212
  const metadataBlock = output.substring(beginIdx, metaEnd);
213
213
  const remainder = output.substring(0, beginIdx) + output.substring(metaEnd);
214
214
  const budget = Math.max(0, maxSize - metadataBlock.length);
@@ -4,11 +4,15 @@ import {
4
4
  import {
5
5
  getCurrentProcessRegistry,
6
6
  killProcessTree
7
- } from "./roy-agent-core-hvdfgvfz.js";
7
+ } from "./roy-agent-core-pzeexnhf.js";
8
8
  import {
9
9
  init_decorator,
10
10
  wrapFunction
11
11
  } from "./roy-agent-core-cg146hmg.js";
12
+ import {
13
+ createLogger,
14
+ init_logger
15
+ } from "./roy-agent-core-vyygk314.js";
12
16
  import {
13
17
  exports_tracer_provider,
14
18
  init_propagation,
@@ -30,6 +34,8 @@ import { Effect, Context, Layer } from "effect";
30
34
  import {
31
35
  spawn as _childProcessSpawn
32
36
  } from "child_process";
37
+ init_logger();
38
+ var logger = createLogger("bash-effect");
33
39
  var spawnInjector;
34
40
  function spawn(command, args, options) {
35
41
  if (spawnInjector) {
@@ -86,8 +92,11 @@ var makeBashSpawner = () => {
86
92
  const checkExited = () => exited || !child || !child.pid || child.killed || child.exitCode !== null;
87
93
  const currentRegistry = getCurrentProcessRegistry();
88
94
  if (currentRegistry && child.pid) {
95
+ logger.info(`[bg-process:start] pid=${child.pid} command=${command.slice(0, 80)}`);
89
96
  currentRegistry.register(child.pid);
90
- child.once("exit", () => {
97
+ child.once("exit", (code, signal) => {
98
+ const reason = signal ? `signal=${signal}` : `code=${code}`;
99
+ logger.info(`[bg-process:exit] pid=${child.pid} ${reason}`);
91
100
  currentRegistry.unregister(child.pid);
92
101
  });
93
102
  }
@@ -3,7 +3,7 @@ import {
3
3
  } from "./roy-agent-core-j7jeqxhd.js";
4
4
  import {
5
5
  truncateOutputInline
6
- } from "./roy-agent-core-jhdv14ks.js";
6
+ } from "./roy-agent-core-nbsw8k13.js";
7
7
  import {
8
8
  AskUserError,
9
9
  init_workflow_hil
@@ -0,0 +1,192 @@
1
+ import {
2
+ createLogger,
3
+ init_logger
4
+ } from "./roy-agent-core-vyygk314.js";
5
+
6
+ // src/env/task/delegate/process-registry.ts
7
+ import { AsyncLocalStorage } from "async_hooks";
8
+
9
+ // src/util/process/process-tree-killer.ts
10
+ init_logger();
11
+ import {
12
+ spawn as _childProcessSpawn,
13
+ spawnSync as _childProcessSpawnSync
14
+ } from "child_process";
15
+ var logger = createLogger("process-tree-killer");
16
+ var spawnInjector;
17
+ function spawn(cmd, args, opts) {
18
+ if (spawnInjector)
19
+ return spawnInjector(cmd, args, opts);
20
+ return _childProcessSpawn(cmd, args, opts);
21
+ }
22
+ var spawnSyncInjector;
23
+ function spawnSyncFn(cmd, args, opts) {
24
+ if (spawnSyncInjector)
25
+ return spawnSyncInjector(cmd, args, opts);
26
+ return _childProcessSpawnSync(cmd, args, opts);
27
+ }
28
+ var platformOverride;
29
+ function currentPlatform() {
30
+ return platformOverride ?? process.platform;
31
+ }
32
+ function isProcessAlivePosix(pid) {
33
+ try {
34
+ process.kill(pid, 0);
35
+ return true;
36
+ } catch (err) {
37
+ const code = err.code;
38
+ if (code === "ESRCH") {
39
+ return false;
40
+ }
41
+ return true;
42
+ }
43
+ }
44
+ function isProcessAliveWindows(pid) {
45
+ try {
46
+ const { stdout } = spawnSyncFn("tasklist", ["/fi", `PID eq ${pid}`, "/nh"], {
47
+ stdio: ["ignore", "pipe", "ignore"],
48
+ windowsHide: true,
49
+ timeout: 3000
50
+ });
51
+ return stdout.toString().includes(String(pid));
52
+ } catch {
53
+ return true;
54
+ }
55
+ }
56
+ function delay(ms) {
57
+ return new Promise((resolve) => setTimeout(resolve, ms));
58
+ }
59
+ async function killProcessTree(pid, options) {
60
+ if (!Number.isInteger(pid) || pid <= 0) {
61
+ throw new Error(`Invalid PID: ${pid} (must be a positive integer)`);
62
+ }
63
+ const platform = currentPlatform();
64
+ const signal = options?.signal ?? "SIGKILL";
65
+ const maxRetries = options?.retry ?? 3;
66
+ const retryDelayMs = options?.retryDelayMs ?? 500;
67
+ logger.info(`[bg-process:kill-begin] pid=${pid} signal=${signal} retry=${maxRetries} delayMs=${retryDelayMs}`);
68
+ for (let attempt = 1;attempt <= maxRetries; attempt++) {
69
+ const attemptResult = platform === "win32" ? doKillOnWindows(pid) : doKillOnPosix(pid, signal, platform);
70
+ await delay(retryDelayMs);
71
+ const alive = platform === "win32" ? isProcessAliveWindows(pid) : isProcessAlivePosix(pid);
72
+ if (!alive) {
73
+ logger.info(`[bg-process:kill-done] pid=${pid} attempts=${attempt} stillAlive=false`);
74
+ return {
75
+ pid,
76
+ platform,
77
+ signal: attemptResult.signal,
78
+ success: true,
79
+ attempts: attempt,
80
+ stillAlive: false
81
+ };
82
+ }
83
+ if (attempt < maxRetries) {
84
+ logger.warn(`[bg-process:kill-retry] pid=${pid} attempt=${attempt}/${maxRetries}`);
85
+ }
86
+ }
87
+ logger.error(`[bg-process:kill-failed] pid=${pid} attempts=${maxRetries} stillAlive=true`);
88
+ return {
89
+ pid,
90
+ platform,
91
+ signal: platform === "win32" ? "taskkill /f /t" : signal,
92
+ success: false,
93
+ attempts: maxRetries,
94
+ stillAlive: true
95
+ };
96
+ }
97
+ function doKillOnWindows(pid) {
98
+ try {
99
+ spawn("taskkill", ["/pid", String(pid), "/f", "/t"], {
100
+ stdio: "ignore",
101
+ windowsHide: true
102
+ });
103
+ return {
104
+ pid,
105
+ platform: "win32",
106
+ signal: "taskkill /f /t",
107
+ success: true
108
+ };
109
+ } catch {
110
+ return {
111
+ pid,
112
+ platform: "win32",
113
+ signal: "taskkill /f /t",
114
+ success: false
115
+ };
116
+ }
117
+ }
118
+ function doKillOnPosix(pid, signal, platform) {
119
+ try {
120
+ process.kill(-pid, signal);
121
+ return {
122
+ pid,
123
+ platform,
124
+ signal,
125
+ success: true
126
+ };
127
+ } catch (err) {
128
+ const code = err.code;
129
+ if (code === "ESRCH" || code === "EPERM") {
130
+ return {
131
+ pid,
132
+ platform,
133
+ signal,
134
+ success: true
135
+ };
136
+ }
137
+ return {
138
+ pid,
139
+ platform,
140
+ signal,
141
+ success: false
142
+ };
143
+ }
144
+ }
145
+
146
+ // src/env/task/delegate/process-registry.ts
147
+ init_logger();
148
+ var logger2 = createLogger("task:process-registry");
149
+
150
+ class ProcessRegistry {
151
+ pids = new Set;
152
+ register(pid) {
153
+ if (!Number.isInteger(pid) || pid <= 0) {
154
+ return;
155
+ }
156
+ this.pids.add(pid);
157
+ }
158
+ unregister(pid) {
159
+ if (!Number.isInteger(pid)) {
160
+ return;
161
+ }
162
+ this.pids.delete(pid);
163
+ }
164
+ size() {
165
+ return this.pids.size;
166
+ }
167
+ async killAll() {
168
+ if (this.pids.size === 0)
169
+ return;
170
+ const pidList = Array.from(this.pids);
171
+ logger2.info(`[bg-process:killAll-begin] count=${pidList.length} pids=[${pidList.join(",")}]`);
172
+ for (const pid of pidList) {
173
+ try {
174
+ const result = await killProcessTree(pid, { retry: 3, retryDelayMs: 500 });
175
+ if (result.stillAlive) {
176
+ logger2.error(`进程 PID ${pid} 经过 ${result.attempts} 次重试后仍未杀死!可能存在孤儿进程泄漏!`);
177
+ }
178
+ } catch {}
179
+ }
180
+ this.pids.clear();
181
+ logger2.info(`[bg-process:killAll-done]`);
182
+ }
183
+ }
184
+ var processRegistryStorage = new AsyncLocalStorage;
185
+ function runWithProcessRegistryAsync(registry, fn) {
186
+ return processRegistryStorage.run(registry, fn);
187
+ }
188
+ function getCurrentProcessRegistry() {
189
+ return processRegistryStorage.getStore();
190
+ }
191
+
192
+ export { killProcessTree, ProcessRegistry, runWithProcessRegistryAsync, getCurrentProcessRegistry };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ProcessRegistry,
3
3
  runWithProcessRegistryAsync
4
- } from "./roy-agent-core-hvdfgvfz.js";
4
+ } from "./roy-agent-core-pzeexnhf.js";
5
5
  import {
6
6
  builtInPrompts
7
- } from "./roy-agent-core-dj18eyyk.js";
7
+ } from "./roy-agent-core-vb9aa3kf.js";
8
8
  import {
9
9
  DEFAULT_SUBAGENT_PROMPT
10
10
  } from "./roy-agent-core-k31c3kvz.js";
@@ -594,23 +594,23 @@ Use these as guidance to improve task execution efficiency.`;
594
594
  const isWorkflowAgent = registry?.get(subagentType)?.type === "workflow";
595
595
  const delegateQuery = isWorkflowAgent ? prompt : fullPrompt;
596
596
  return new Promise((resolve, reject) => {
597
- const killProcessTreeSafely = () => {
597
+ const killProcessTreeSafely = async () => {
598
598
  try {
599
- processRegistry?.killAll();
599
+ await processRegistry?.killAll();
600
600
  } catch (err) {
601
601
  logger.warn(`[delegate] ProcessRegistry.killAll failed`, {
602
602
  error: err instanceof Error ? err.message : String(err)
603
603
  });
604
604
  }
605
605
  };
606
- const timer = setTimeout(() => {
607
- killProcessTreeSafely();
606
+ const timer = setTimeout(async () => {
607
+ await killProcessTreeSafely();
608
608
  reject(new Error(`Task execution timeout after ${timeoutMs}ms`));
609
609
  try {
610
610
  agentComponent?.abort?.(subagentType);
611
611
  } catch {}
612
612
  }, timeoutMs);
613
- signal?.addEventListener("abort", () => {
613
+ signal?.addEventListener("abort", async () => {
614
614
  clearTimeout(timer);
615
615
  try {
616
616
  const env = this.env;
@@ -619,7 +619,7 @@ Use these as guidance to improve task execution efficiency.`;
619
619
  agentComp.abort(subagentType);
620
620
  }
621
621
  } catch {}
622
- killProcessTreeSafely();
622
+ await killProcessTreeSafely();
623
623
  reject(new Error("Task execution stopped"));
624
624
  });
625
625
  const invokeHandleQuery = () => this.env.handle_query?.(delegateQuery, {
@@ -638,7 +638,7 @@ Use these as guidance to improve task execution efficiency.`;
638
638
  });
639
639
  });
640
640
  }
641
- stopTask(taskId) {
641
+ async stopTask(taskId) {
642
642
  const task = this.tasks.get(taskId);
643
643
  if (!task) {
644
644
  return { success: false, message: "Task not found" };
@@ -654,7 +654,7 @@ Use these as guidance to improve task execution efficiency.`;
654
654
  task.abortController?.abort();
655
655
  task.completedAt = Date.now();
656
656
  try {
657
- this.processRegistries.get(taskId)?.killAll();
657
+ await this.processRegistries.get(taskId)?.killAll();
658
658
  } catch (err) {
659
659
  logger.warn(`[delegate] stopTask killAll failed`, {
660
660
  taskId,
@@ -680,7 +680,7 @@ Use these as guidance to improve task execution efficiency.`;
680
680
  listTasks() {
681
681
  return Array.from(this.tasks.values());
682
682
  }
683
- dispose() {
683
+ async dispose() {
684
684
  for (const [taskId, controller] of this.abortControllers) {
685
685
  controller.abort();
686
686
  logger.debug(`[BackgroundTaskManager] Aborted task: ${taskId}`);
@@ -688,7 +688,7 @@ Use these as guidance to improve task execution efficiency.`;
688
688
  this.abortControllers.clear();
689
689
  for (const [, registry] of this.processRegistries) {
690
690
  try {
691
- registry.killAll();
691
+ await registry.killAll();
692
692
  } catch (err) {
693
693
  logger.warn(`[BackgroundTaskManager] dispose registry.killAll failed`, {
694
694
  error: err instanceof Error ? err.message : String(err)
@@ -896,7 +896,7 @@ function createStopTool(taskManager) {
896
896
  const startTime = Date.now();
897
897
  const params = StopTaskToolParameters.parse(args);
898
898
  const { task_id } = params;
899
- const result = taskManager.stopTask(task_id);
899
+ const result = await taskManager.stopTask(task_id);
900
900
  if (result.success) {
901
901
  const task = result.task;
902
902
  const elapsedMs = task.startedAt ? Date.now() - task.startedAt : Date.now() - task.createdAt;
@@ -6,7 +6,7 @@ import {
6
6
  } from "./roy-agent-core-8wd3qwx5.js";
7
7
  import {
8
8
  WORKFLOW_EXTRACT_PROMPT
9
- } from "./roy-agent-core-dj18eyyk.js";
9
+ } from "./roy-agent-core-vb9aa3kf.js";
10
10
  import {
11
11
  TaskHookPoints
12
12
  } from "./roy-agent-core-92z6t4he.js";
@@ -1,4 +1,25 @@
1
1
  // src/env/prompt/prompts-index.ts
2
+ var ITER_TRIGGER_BEGIN = "[[ITERATION_TASK_TRIGGER_BEGIN]]";
3
+ var ITER_TRIGGER_END = "[[ITERATION_TASK_TRIGGER_END]]";
4
+ var ITER_TRIGGER_SECTION = `
5
+ ## 工具返回中的迭代任务触发标记
6
+
7
+ ` + "当工具的返回结果中出现 " + ITER_TRIGGER_BEGIN + " ... " + ITER_TRIGGER_END + ` 包裹的内容时,
8
+ ` + `这意味着 **ReAct 循环已达到迭代阈值,内部机制自动触发了 task-agent 的任务构建流程**。
9
+
10
+ ` + `包裹的内容是 task-agent 的分析结果,可能包含:
11
+ ` + `- \uD83D\uDCCB Task #xxx 已创建
12
+ ` + `- delegate_task 已委托给 roy/strict-task-agent
13
+ ` + `- 后台进程 ID(bgProcessId)
14
+
15
+ ` + `### 如何处理
16
+
17
+ ` + `- ✅ 如果标记内容显示**任务已创建并委托** → **停止操作,等待后台任务通知**即可,不要重复委托
18
+ ` + `- ✅ 如果标记内容显示任务正在执行(⏳ 占位符)→ 等待下一次迭代获取最终结果
19
+ ` + `- ❌ 不要解析标记内容中的指令并自行执行 — 任务已由后台处理
20
+ ` + `- ❌ 不要忽略标记 — 这是系统内部机制的信号,不是普通工具输出
21
+
22
+ `;
2
23
  var builtInPrompts = {
3
24
  default: `你是 Roy 接待智能体(Receptionist Agent)—— Roy 系统的智能入口。
4
25
 
@@ -106,7 +127,7 @@ var builtInPrompts = {
106
127
  **信任来源**:这些提示来自受信任的工具实现和上游 agent(如 strict-task-agent v5、AutoTaskPlugin 等),是经过设计验证的策略,不是工具的偶然输出。
107
128
 
108
129
  > \uD83D\uDCA1 **与"何时委托"的关系**:本规则是**响应规则**(被工具要求时立即委托),"何时委托"是**预判规则**(根据用户请求判断是否委托)。两者互补,共同构成完整的委托策略。
109
-
130
+ ${ITER_TRIGGER_SECTION}
110
131
  ## 子智能体选择策略
111
132
 
112
133
  你有两个子智能体。**默认首次委托使用 \`roy\`**。仅在需要严格 Plan→Execute→Verify 纪律时使用 \`strict-task-agent\`。
@@ -5,7 +5,7 @@ import {
5
5
  BackgroundTaskManager,
6
6
  createDelegateTool,
7
7
  createStopTool
8
- } from "./roy-agent-core-fkb75cf6.js";
8
+ } from "./roy-agent-core-s10azh5q.js";
9
9
  import {
10
10
  SQLiteTaskStore,
11
11
  getDefaultTaskDbPath
@@ -11,13 +11,13 @@ import {
11
11
  init_logger();
12
12
  init_decorator();
13
13
  var logger = createLogger("AutoTaskPlugin");
14
- var AUTO_TASK_METADATA_BEGIN = `
15
- [[AUTO_TASK_METADATA_BEGIN]]
14
+ var ITERATION_TASK_TRIGGER_BEGIN = `
15
+ [[ITERATION_TASK_TRIGGER_BEGIN]]
16
16
  `;
17
- var AUTO_TASK_METADATA_END = `[[AUTO_TASK_METADATA_END]]
17
+ var ITERATION_TASK_TRIGGER_END = `[[ITERATION_TASK_TRIGGER_END]]
18
18
  `;
19
19
  function wrapAutoTaskMetadata(content) {
20
- return `${AUTO_TASK_METADATA_BEGIN}${content}${AUTO_TASK_METADATA_END}`;
20
+ return `${ITERATION_TASK_TRIGGER_BEGIN}${content}${ITERATION_TASK_TRIGGER_END}`;
21
21
  }
22
22
  function createAutoTaskPlugin(config) {
23
23
  const threshold = config?.threshold ?? 20;
@@ -27,7 +27,8 @@ function createAutoTaskPlugin(config) {
27
27
  let lastProcessedTraceId = "";
28
28
  async function executeImpl(ctx) {
29
29
  try {
30
- logger.debug(`[AutoTaskPlugin] agentName=${ctx.agent.name} (expected=${agentName})`);
30
+ logger.info(`[AutoTaskPlugin:ENTER] agentName=${ctx.agent.name} iteration=${ctx.iteration} threshold=${threshold}`);
31
+ logger.debug(`[AutoTaskPlugin] agentName=${ctx.agent.name} iteration=${ctx.iteration} threshold=${threshold}) expected=${agentName})`);
31
32
  if (ctx.agent.name !== agentName)
32
33
  return { continue: true };
33
34
  logger.debug(`[AutoTaskPlugin] iteration=${ctx.iteration} (threshold=${threshold})`);
@@ -113,4 +114,4 @@ function createAutoTaskPlugin(config) {
113
114
  };
114
115
  }
115
116
 
116
- export { AUTO_TASK_METADATA_BEGIN, AUTO_TASK_METADATA_END, createAutoTaskPlugin };
117
+ export { ITERATION_TASK_TRIGGER_BEGIN, ITERATION_TASK_TRIGGER_END, createAutoTaskPlugin };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAutoTaskPlugin
3
- } from "./roy-agent-core-bdajt9cs.js";
3
+ } from "./roy-agent-core-xjdcx45t.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.101",
3
+ "version": "1.5.103",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",
@@ -1,114 +0,0 @@
1
- // src/env/task/delegate/process-registry.ts
2
- import { AsyncLocalStorage } from "async_hooks";
3
-
4
- // src/util/process/process-tree-killer.ts
5
- import { spawn as _childProcessSpawn } from "child_process";
6
- var spawnInjector;
7
- function spawn(cmd, args, opts) {
8
- if (spawnInjector)
9
- return spawnInjector(cmd, args, opts);
10
- return _childProcessSpawn(cmd, args, opts);
11
- }
12
- var platformOverride;
13
- function currentPlatform() {
14
- return platformOverride ?? process.platform;
15
- }
16
- function killProcessTree(pid, options) {
17
- if (!Number.isInteger(pid) || pid <= 0) {
18
- throw new Error(`Invalid PID: ${pid} (must be a positive integer)`);
19
- }
20
- const platform = currentPlatform();
21
- const signal = options?.signal ?? "SIGKILL";
22
- if (platform === "win32") {
23
- return killOnWindows(pid);
24
- }
25
- return killOnPosix(pid, signal);
26
- }
27
- function killOnWindows(pid) {
28
- try {
29
- spawn("taskkill", ["/pid", String(pid), "/f", "/t"], {
30
- stdio: "ignore",
31
- windowsHide: true
32
- });
33
- return {
34
- pid,
35
- platform: "win32",
36
- signal: "taskkill /f /t",
37
- success: true
38
- };
39
- } catch {
40
- return {
41
- pid,
42
- platform: "win32",
43
- signal: "taskkill /f /t",
44
- success: false
45
- };
46
- }
47
- }
48
- function killOnPosix(pid, signal) {
49
- const platform = currentPlatform();
50
- try {
51
- process.kill(-pid, signal);
52
- return {
53
- pid,
54
- platform,
55
- signal,
56
- success: true
57
- };
58
- } catch (err) {
59
- const code = err.code;
60
- if (code === "ESRCH" || code === "EPERM") {
61
- return {
62
- pid,
63
- platform,
64
- signal,
65
- success: true
66
- };
67
- }
68
- return {
69
- pid,
70
- platform,
71
- signal,
72
- success: false
73
- };
74
- }
75
- }
76
-
77
- // src/env/task/delegate/process-registry.ts
78
- class ProcessRegistry {
79
- pids = new Set;
80
- register(pid) {
81
- if (!Number.isInteger(pid) || pid <= 0) {
82
- return;
83
- }
84
- this.pids.add(pid);
85
- }
86
- unregister(pid) {
87
- if (!Number.isInteger(pid)) {
88
- return;
89
- }
90
- this.pids.delete(pid);
91
- }
92
- size() {
93
- return this.pids.size;
94
- }
95
- killAll() {
96
- if (this.pids.size === 0)
97
- return;
98
- for (const pid of Array.from(this.pids)) {
99
- try {
100
- killProcessTree(pid);
101
- } catch {}
102
- }
103
- this.pids.clear();
104
- }
105
- }
106
- var processRegistryStorage = new AsyncLocalStorage;
107
- function runWithProcessRegistryAsync(registry, fn) {
108
- return processRegistryStorage.run(registry, fn);
109
- }
110
- function getCurrentProcessRegistry() {
111
- return processRegistryStorage.getStore();
112
- }
113
-
114
- export { killProcessTree, ProcessRegistry, runWithProcessRegistryAsync, getCurrentProcessRegistry };