@ai-setting/roy-agent-core 1.6.2 → 1.6.4

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 (26) hide show
  1. package/dist/env/agent/index.js +2 -2
  2. package/dist/env/event-source/index.js +3 -3
  3. package/dist/env/index.js +11 -11
  4. package/dist/env/llm/index.js +2 -2
  5. package/dist/env/prompt/index.js +2 -2
  6. package/dist/env/task/delegate/index.js +2 -2
  7. package/dist/env/task/index.js +4 -4
  8. package/dist/env/task/plugins/index.js +2 -2
  9. package/dist/env/task/tools/index.js +3 -1
  10. package/dist/env/workflow/engine/index.js +1 -1
  11. package/dist/env/workflow/index.js +2 -2
  12. package/dist/index.js +13 -13
  13. package/dist/shared/@ai-setting/{roy-agent-core-fg5eaht3.js → roy-agent-core-155408xq.js} +1 -1
  14. package/dist/shared/@ai-setting/{roy-agent-core-ekptge19.js → roy-agent-core-2xpstxhz.js} +1 -1
  15. package/dist/shared/@ai-setting/{roy-agent-core-j7jeqxhd.js → roy-agent-core-65qs21kf.js} +3 -3
  16. package/dist/shared/@ai-setting/{roy-agent-core-te3hf26b.js → roy-agent-core-7afcdb2m.js} +1 -1
  17. package/dist/shared/@ai-setting/{roy-agent-core-gexpbexm.js → roy-agent-core-aa0tdfb2.js} +2 -2
  18. package/dist/shared/@ai-setting/{roy-agent-core-2t2n1epb.js → roy-agent-core-bferdaw6.js} +1 -1
  19. package/dist/shared/@ai-setting/{roy-agent-core-1k7z350s.js → roy-agent-core-g7hfkszj.js} +1 -1
  20. package/dist/shared/@ai-setting/{roy-agent-core-97x9ymda.js → roy-agent-core-hd5xrr2q.js} +20 -1
  21. package/dist/shared/@ai-setting/{roy-agent-core-gzzvcmg3.js → roy-agent-core-kf3mw79k.js} +24 -9
  22. package/dist/shared/@ai-setting/{roy-agent-core-0ye4q2jj.js → roy-agent-core-ktbkp661.js} +212 -43
  23. package/dist/shared/@ai-setting/{roy-agent-core-j25z80xr.js → roy-agent-core-tyqzn10b.js} +4 -2
  24. package/dist/shared/@ai-setting/{roy-agent-core-47py6rej.js → roy-agent-core-xxfkvqqh.js} +20 -2
  25. package/dist/shared/@ai-setting/{roy-agent-core-9378eq5y.js → roy-agent-core-z9m38ytb.js} +39 -22
  26. package/package.json +1 -1
@@ -2,8 +2,8 @@ import {
2
2
  AgentComponent,
3
3
  AgentComponentConfigSchema,
4
4
  SummaryAgent
5
- } from "../../shared/@ai-setting/roy-agent-core-47py6rej.js";
6
- import"../../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
5
+ } from "../../shared/@ai-setting/roy-agent-core-xxfkvqqh.js";
6
+ import"../../shared/@ai-setting/roy-agent-core-65qs21kf.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-6kygfd9x.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
@@ -10,7 +10,7 @@ import {
10
10
  larkCliHandler,
11
11
  resolveBountyIMSystemPrompt,
12
12
  timerHandler
13
- } from "../../shared/@ai-setting/roy-agent-core-2t2n1epb.js";
13
+ } from "../../shared/@ai-setting/roy-agent-core-bferdaw6.js";
14
14
  import {
15
15
  BUILT_IN_EVENT_SOURCE_TYPES,
16
16
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -21,11 +21,11 @@ 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-gexpbexm.js";
24
+ import"../../shared/@ai-setting/roy-agent-core-aa0tdfb2.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-9378eq5y.js";
28
+ import"../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
29
29
  import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
30
30
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
31
31
  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-97x9ymda.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-hd5xrr2q.js";
4
4
  import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-2t2n1epb.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-bferdaw6.js";
9
9
  import {
10
10
  EventSourceInitHooks,
11
11
  getDefaultConfigForType,
@@ -17,13 +17,13 @@ import"../shared/@ai-setting/roy-agent-core-wmkx79b1.js";
17
17
  import {
18
18
  PluginComponent
19
19
  } from "../shared/@ai-setting/roy-agent-core-z7dxedn6.js";
20
- import"../shared/@ai-setting/roy-agent-core-gexpbexm.js";
20
+ import"../shared/@ai-setting/roy-agent-core-aa0tdfb2.js";
21
21
  import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
22
22
  import {
23
23
  WorkflowComponent
24
- } from "../shared/@ai-setting/roy-agent-core-ekptge19.js";
24
+ } from "../shared/@ai-setting/roy-agent-core-2xpstxhz.js";
25
25
  import"../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
26
- import"../shared/@ai-setting/roy-agent-core-gzzvcmg3.js";
26
+ import"../shared/@ai-setting/roy-agent-core-kf3mw79k.js";
27
27
  import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
28
28
  import"../shared/@ai-setting/roy-agent-core-vf72n6qn.js";
29
29
  import"../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
@@ -41,27 +41,27 @@ 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-47py6rej.js";
45
- import"../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
44
+ } from "../shared/@ai-setting/roy-agent-core-xxfkvqqh.js";
45
+ import"../shared/@ai-setting/roy-agent-core-65qs21kf.js";
46
46
  import"../shared/@ai-setting/roy-agent-core-6kygfd9x.js";
47
47
  import"../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
48
48
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
49
49
  import {
50
50
  TaskComponent
51
- } from "../shared/@ai-setting/roy-agent-core-j25z80xr.js";
51
+ } from "../shared/@ai-setting/roy-agent-core-tyqzn10b.js";
52
52
  import"../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
53
53
  import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
54
- import"../shared/@ai-setting/roy-agent-core-te3hf26b.js";
54
+ import"../shared/@ai-setting/roy-agent-core-7afcdb2m.js";
55
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-9378eq5y.js";
57
+ import"../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
58
58
  import"../shared/@ai-setting/roy-agent-core-as3phr7n.js";
59
59
  import {
60
60
  XDG_PATHS,
61
61
  getXDGPath,
62
62
  getXDGPaths
63
63
  } from "../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
64
- import"../shared/@ai-setting/roy-agent-core-0ye4q2jj.js";
64
+ import"../shared/@ai-setting/roy-agent-core-ktbkp661.js";
65
65
  import"../shared/@ai-setting/roy-agent-core-t94ktchq.js";
66
66
  import"../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
67
67
  import {
@@ -8,14 +8,14 @@ import {
8
8
  ProviderCapabilitiesSchema,
9
9
  ProviderConfigSchema,
10
10
  ProviderManager
11
- } from "../../shared/@ai-setting/roy-agent-core-fg5eaht3.js";
11
+ } from "../../shared/@ai-setting/roy-agent-core-155408xq.js";
12
12
  import {
13
13
  convertToSDKMessages,
14
14
  createInvokeConfig,
15
15
  invoke,
16
16
  invokeNonStream,
17
17
  parseModelString
18
- } from "../../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
18
+ } from "../../shared/@ai-setting/roy-agent-core-65qs21kf.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-8x4ngxcy.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
@@ -3,8 +3,8 @@ import {
3
3
  PromptConfigSchema,
4
4
  PromptPathSchema,
5
5
  PromptRenderer
6
- } from "../../shared/@ai-setting/roy-agent-core-1k7z350s.js";
7
- import"../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
6
+ } from "../../shared/@ai-setting/roy-agent-core-g7hfkszj.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-z9m38ytb.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-te3hf26b.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-7afcdb2m.js";
7
7
  import"../../../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
8
- import"../../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
8
+ import"../../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-as3phr7n.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
@@ -5,21 +5,21 @@ import {
5
5
  TaskPriorityEnum,
6
6
  TaskStatusEnum,
7
7
  TaskTypeEnum
8
- } from "../../shared/@ai-setting/roy-agent-core-j25z80xr.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-tyqzn10b.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
10
10
  import {
11
11
  TaskEntityEventTypes
12
12
  } from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
13
- import"../../shared/@ai-setting/roy-agent-core-te3hf26b.js";
13
+ import"../../shared/@ai-setting/roy-agent-core-7afcdb2m.js";
14
14
  import"../../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
15
15
  import {
16
16
  SQLiteTaskStore,
17
17
  getDefaultTaskDbPath
18
18
  } from "../../shared/@ai-setting/roy-agent-core-9xby523m.js";
19
- import"../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-as3phr7n.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
22
- import"../../shared/@ai-setting/roy-agent-core-0ye4q2jj.js";
22
+ import"../../shared/@ai-setting/roy-agent-core-ktbkp661.js";
23
23
  import"../../shared/@ai-setting/roy-agent-core-t94ktchq.js";
24
24
  import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
25
25
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
@@ -8,11 +8,11 @@ import {
8
8
  formatExtractorInput,
9
9
  formatExtractorInputFromDescription,
10
10
  parseExtractorOutput
11
- } from "../../../shared/@ai-setting/roy-agent-core-gexpbexm.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-aa0tdfb2.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";
15
- import"../../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
15
+ import"../../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
16
16
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
17
17
  import"../../../shared/@ai-setting/roy-agent-core-zttjq1h3.js";
18
18
  import"../../../shared/@ai-setting/roy-agent-core-scp0afxg.js";
@@ -7,8 +7,9 @@ import {
7
7
  getTaskTool,
8
8
  listTasksTool,
9
9
  searchTasksTool,
10
+ treeTasksTool,
10
11
  updateTaskTool
11
- } from "../../../shared/@ai-setting/roy-agent-core-0ye4q2jj.js";
12
+ } from "../../../shared/@ai-setting/roy-agent-core-ktbkp661.js";
12
13
  import"../../../shared/@ai-setting/roy-agent-core-scp0afxg.js";
13
14
  import"../../../shared/@ai-setting/roy-agent-core-cg146hmg.js";
14
15
  import"../../../shared/@ai-setting/roy-agent-core-vyygk314.js";
@@ -17,6 +18,7 @@ import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
17
18
  import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
18
19
  export {
19
20
  updateTaskTool,
21
+ treeTasksTool,
20
22
  searchTasksTool,
21
23
  listTasksTool,
22
24
  getTaskTool,
@@ -5,7 +5,7 @@ import {
5
5
  Scheduler,
6
6
  WorkflowEngine,
7
7
  init_engine
8
- } from "../../../shared/@ai-setting/roy-agent-core-gzzvcmg3.js";
8
+ } from "../../../shared/@ai-setting/roy-agent-core-kf3mw79k.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-vf72n6qn.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkflowComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-ekptge19.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-2xpstxhz.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
5
- import"../../shared/@ai-setting/roy-agent-core-gzzvcmg3.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-kf3mw79k.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-vf72n6qn.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-q88vxmx5.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-1k7z350s.js";
4
+ } from "./shared/@ai-setting/roy-agent-core-g7hfkszj.js";
5
5
  import {
6
6
  LLMComponent,
7
7
  LLMConfigSchema,
@@ -9,7 +9,7 @@ import {
9
9
  ModelLimitsSchema,
10
10
  ProviderCapabilitiesSchema,
11
11
  ProviderConfigSchema
12
- } from "./shared/@ai-setting/roy-agent-core-fg5eaht3.js";
12
+ } from "./shared/@ai-setting/roy-agent-core-155408xq.js";
13
13
  import {
14
14
  ConfigComponent
15
15
  } from "./shared/@ai-setting/roy-agent-core-33rhv946.js";
@@ -62,7 +62,7 @@ import {
62
62
  BaseEnvironment,
63
63
  generateDescendingId,
64
64
  generateId
65
- } from "./shared/@ai-setting/roy-agent-core-97x9ymda.js";
65
+ } from "./shared/@ai-setting/roy-agent-core-hd5xrr2q.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-2t2n1epb.js";
77
+ } from "./shared/@ai-setting/roy-agent-core-bferdaw6.js";
78
78
  import {
79
79
  BUILT_IN_EVENT_SOURCE_TYPES,
80
80
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -94,18 +94,18 @@ import {
94
94
  import {
95
95
  TaskTagPlugin,
96
96
  createAutoTaskPlugin
97
- } from "./shared/@ai-setting/roy-agent-core-gexpbexm.js";
97
+ } from "./shared/@ai-setting/roy-agent-core-aa0tdfb2.js";
98
98
  import {
99
99
  BasePlugin
100
100
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
101
101
  import {
102
102
  WorkflowComponent
103
- } from "./shared/@ai-setting/roy-agent-core-ekptge19.js";
103
+ } from "./shared/@ai-setting/roy-agent-core-2xpstxhz.js";
104
104
  import {
105
105
  init_node_registry_helper,
106
106
  registerDecoratorNodeType
107
107
  } from "./shared/@ai-setting/roy-agent-core-xgnpr28w.js";
108
- import"./shared/@ai-setting/roy-agent-core-gzzvcmg3.js";
108
+ import"./shared/@ai-setting/roy-agent-core-kf3mw79k.js";
109
109
  import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
110
110
  import"./shared/@ai-setting/roy-agent-core-vf72n6qn.js";
111
111
  import"./shared/@ai-setting/roy-agent-core-q88vxmx5.js";
@@ -129,13 +129,13 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
129
129
  import {
130
130
  AgentComponent,
131
131
  AgentComponentConfigSchema
132
- } from "./shared/@ai-setting/roy-agent-core-47py6rej.js";
132
+ } from "./shared/@ai-setting/roy-agent-core-xxfkvqqh.js";
133
133
  import {
134
134
  createInvokeConfig,
135
135
  invoke,
136
136
  invokeNonStream,
137
137
  parseModelString
138
- } from "./shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
138
+ } from "./shared/@ai-setting/roy-agent-core-65qs21kf.js";
139
139
  import {
140
140
  ToolComponent,
141
141
  ToolRegistry,
@@ -148,10 +148,10 @@ import {
148
148
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
149
149
  import {
150
150
  TaskComponent
151
- } from "./shared/@ai-setting/roy-agent-core-j25z80xr.js";
151
+ } from "./shared/@ai-setting/roy-agent-core-tyqzn10b.js";
152
152
  import"./shared/@ai-setting/roy-agent-core-amkqnyzy.js";
153
153
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
154
- import"./shared/@ai-setting/roy-agent-core-te3hf26b.js";
154
+ import"./shared/@ai-setting/roy-agent-core-7afcdb2m.js";
155
155
  import"./shared/@ai-setting/roy-agent-core-pzeexnhf.js";
156
156
  import {
157
157
  SQLiteTaskStore,
@@ -160,7 +160,7 @@ import {
160
160
  import {
161
161
  getBuiltInPrompt,
162
162
  getBuiltInPromptNames
163
- } from "./shared/@ai-setting/roy-agent-core-9378eq5y.js";
163
+ } from "./shared/@ai-setting/roy-agent-core-z9m38ytb.js";
164
164
  import {
165
165
  AgentRegistry
166
166
  } from "./shared/@ai-setting/roy-agent-core-as3phr7n.js";
@@ -169,7 +169,7 @@ import {
169
169
  getXDGPath,
170
170
  getXDGPaths
171
171
  } from "./shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
172
- import"./shared/@ai-setting/roy-agent-core-0ye4q2jj.js";
172
+ import"./shared/@ai-setting/roy-agent-core-ktbkp661.js";
173
173
  import"./shared/@ai-setting/roy-agent-core-t94ktchq.js";
174
174
  import {
175
175
  TaskHookPoints
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  invoke
3
- } from "./roy-agent-core-j7jeqxhd.js";
3
+ } from "./roy-agent-core-65qs21kf.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowEngine,
7
7
  exports_engine,
8
8
  init_engine
9
- } from "./roy-agent-core-gzzvcmg3.js";
9
+ } from "./roy-agent-core-kf3mw79k.js";
10
10
  import {
11
11
  askUserTool,
12
12
  createRunWorkflowTool,
@@ -330,8 +330,8 @@ function convertToolChoice(toolChoice) {
330
330
  return { type: "tool", toolName };
331
331
  }
332
332
  function createEnvEventEmitter(env, context) {
333
- if (!env) {
334
- logger.warn("[invoke] createEnvEventEmitter: env is null/undefined, streaming events will be disabled");
333
+ if (!env || typeof env.pushEnvEvent !== "function") {
334
+ logger.warn("[invoke] createEnvEventEmitter: env is null/undefined or pushEnvEvent is unavailable, streaming events will be disabled");
335
335
  return null;
336
336
  }
337
337
  return (event) => {
@@ -721,7 +721,7 @@ async function invokeNonStream(config, options, ctx) {
721
721
  completionTokens: usage.completionTokens ?? 0,
722
722
  totalTokens: usage.totalTokens ?? 0
723
723
  } : undefined;
724
- if (options.env) {
724
+ if (options.env && typeof options.env.pushEnvEvent === "function") {
725
725
  options.env.pushEnvEvent({
726
726
  id: randomUUID(),
727
727
  type: "llm.completed",
@@ -4,7 +4,7 @@ import {
4
4
  } from "./roy-agent-core-pzeexnhf.js";
5
5
  import {
6
6
  builtInPrompts
7
- } from "./roy-agent-core-9378eq5y.js";
7
+ } from "./roy-agent-core-z9m38ytb.js";
8
8
  import {
9
9
  DEFAULT_SUBAGENT_PROMPT
10
10
  } from "./roy-agent-core-as3phr7n.js";
@@ -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-9378eq5y.js";
9
+ } from "./roy-agent-core-z9m38ytb.js";
10
10
  import {
11
11
  TaskHookPoints
12
12
  } from "./roy-agent-core-1pg0fepg.js";
@@ -331,7 +331,7 @@ function createAutoTaskPlugin(config) {
331
331
  lastProcessedTraceId = traceId;
332
332
  logger2.debug(`[AutoTaskPlugin] new query detected (traceId=${traceId.slice(0, 20)}...)`);
333
333
  const reminderContent = `⚠️ **系统提醒**: 你已经调用了 ${ctx.iteration} 次工具,达到 iteration 阈值(默认 ${threshold})。
334
- ` + `当前请求较为复杂,建议通过 \`delegate_task\` 工具将整个任务委托给 \`roy\` sub-agent 处理。`;
334
+ ` + `当前请求较为复杂,建议通过 \`delegate_task\` 工具将整个任务委托给 \`roy\` sub-agent 处理。` + `注意,需要让roy为这个任务调用task create工具来创建任务进行跟踪,这个是必走程序哈。`;
335
335
  if (!ctx.toolResult) {
336
336
  logger2.warn(`[AutoTaskPlugin] toolResult missing, skip meta-protocol (iteration=${ctx.iteration})`);
337
337
  return { continue: true };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook
4
- } from "./roy-agent-core-gexpbexm.js";
4
+ } from "./roy-agent-core-aa0tdfb2.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-9378eq5y.js";
3
+ } from "./roy-agent-core-z9m38ytb.js";
4
4
  import {
5
5
  getXDGPath
6
6
  } from "./roy-agent-core-qxnbvgwe.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAutoTaskPlugin
3
- } from "./roy-agent-core-gexpbexm.js";
3
+ } from "./roy-agent-core-aa0tdfb2.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -49,6 +49,15 @@ init_env_context();
49
49
  import * as fsSync from "fs";
50
50
  import * as path from "path";
51
51
  var logger = createLogger("environment");
52
+ var DEFAULT_AGENT_NAME = "Roy";
53
+ function injectAgentNamePlaceholder(prompt, context) {
54
+ if (!prompt.includes("{{agent_name}}")) {
55
+ return prompt;
56
+ }
57
+ const metadata = context?.metadata;
58
+ const defaultAgentName = typeof metadata?.defaultAgentName === "string" && metadata.defaultAgentName.length > 0 ? metadata.defaultAgentName : DEFAULT_AGENT_NAME;
59
+ return prompt.replace(/\{\{agent_name\}\}/g, defaultAgentName);
60
+ }
52
61
 
53
62
  class BaseEnvironment extends BaseComponent {
54
63
  name;
@@ -146,6 +155,15 @@ class BaseEnvironment extends BaseComponent {
146
155
  finalSystemPrompt = finalSystemPrompt.replace("{{workspace_dir}}", workspaceDir);
147
156
  logger.debug(`[handle_query] Injected workspace_dir: ${workspaceDir}`);
148
157
  }
158
+ {
159
+ const prev = finalSystemPrompt;
160
+ finalSystemPrompt = injectAgentNamePlaceholder(finalSystemPrompt, context);
161
+ if (prev !== finalSystemPrompt) {
162
+ const metadata = context?.metadata;
163
+ const injectedName = typeof metadata?.defaultAgentName === "string" && metadata.defaultAgentName.length > 0 ? metadata.defaultAgentName : DEFAULT_AGENT_NAME;
164
+ logger.debug(`[handle_query] Injected agent_name: ${injectedName}`);
165
+ }
166
+ }
149
167
  let agent = agentComponent.getAgent(agentName);
150
168
  if (!agent) {
151
169
  if (agentName !== "default") {
@@ -221,6 +239,7 @@ class BaseEnvironment extends BaseComponent {
221
239
  if (agent.config.systemPrompt.includes("{{workspace_dir}}")) {
222
240
  agent.config.systemPrompt = agent.config.systemPrompt.replace("{{workspace_dir}}", process.cwd());
223
241
  }
242
+ agent.config.systemPrompt = injectAgentNamePlaceholder(agent.config.systemPrompt, context);
224
243
  }
225
244
  logger.debug(`[handle_query] Injected memory/workspace_dir for existing agent: ${agentName}`);
226
245
  }
@@ -1029,6 +1029,8 @@ var init_agent_node = __esm(() => {
1029
1029
  let inheritedModel;
1030
1030
  let inheritedAllowedTools;
1031
1031
  let inheritedDeniedTools;
1032
+ let inheritedFromAgentName = false;
1033
+ let agentTypeAllowsAllTools = false;
1032
1034
  if (agentName && this.agentRunner.hasAgent && this.agentRunner.getAgentConfig) {
1033
1035
  if (this.agentRunner.hasAgent(agentName)) {
1034
1036
  const agentConfig2 = this.agentRunner.getAgentConfig(agentName);
@@ -1037,6 +1039,7 @@ var init_agent_node = __esm(() => {
1037
1039
  inheritedModel = agentConfig2.model;
1038
1040
  inheritedAllowedTools = agentConfig2.allowedTools;
1039
1041
  inheritedDeniedTools = agentConfig2.deniedTools;
1042
+ inheritedFromAgentName = true;
1040
1043
  }
1041
1044
  }
1042
1045
  }
@@ -1049,6 +1052,24 @@ var init_agent_node = __esm(() => {
1049
1052
  });
1050
1053
  }
1051
1054
  }
1055
+ if (!inheritedFromAgentName && this.agentRunner.hasAgent && this.agentRunner.getAgentConfig) {
1056
+ if (this.agentRunner.hasAgent(resolvedAgentType)) {
1057
+ const typeConfig = this.agentRunner.getAgentConfig(resolvedAgentType);
1058
+ if (typeConfig) {
1059
+ if (inheritedModel === undefined && typeConfig.model !== undefined) {
1060
+ inheritedModel = typeConfig.model;
1061
+ }
1062
+ if (inheritedDeniedTools === undefined && typeConfig.deniedTools !== undefined) {
1063
+ inheritedDeniedTools = typeConfig.deniedTools;
1064
+ }
1065
+ if (typeConfig.allowedTools === undefined) {
1066
+ agentTypeAllowsAllTools = true;
1067
+ } else if (inheritedAllowedTools === undefined) {
1068
+ inheritedAllowedTools = typeConfig.allowedTools;
1069
+ }
1070
+ }
1071
+ }
1072
+ }
1052
1073
  const userQuery = context.input?.userQuery ?? context.workflowInput?.userQuery;
1053
1074
  let agentSessionId = context.agentSessionId;
1054
1075
  if (!agentSessionId && context.sessionComponent) {
@@ -1065,7 +1086,7 @@ var init_agent_node = __esm(() => {
1065
1086
  }
1066
1087
  }
1067
1088
  const effectiveModel = options.model || inheritedModel;
1068
- const effectiveAllowedTools = options.allowedTools?.length ? options.allowedTools : inheritedAllowedTools?.length ? inheritedAllowedTools : ["ask_user"];
1089
+ const effectiveAllowedTools = options.allowedTools?.length ? options.allowedTools : agentTypeAllowsAllTools ? undefined : inheritedAllowedTools?.length ? inheritedAllowedTools : ["ask_user"];
1069
1090
  const effectiveDeniedTools = options.deniedTools?.length ? options.deniedTools : inheritedDeniedTools;
1070
1091
  const agentConfig = {
1071
1092
  type: resolvedAgentType,
@@ -2071,16 +2092,10 @@ var init_engine = __esm(() => {
2071
2092
  const durationMs = Date.now() - sessionState.startedAt.getTime();
2072
2093
  const sessionId = sessionState.sessionId;
2073
2094
  const runId = this.getRunIdFromSessionId(sessionId);
2074
- const dagAnalysis = sessionState.dagManager.analyze();
2075
- const exitNodes = new Set(dagAnalysis.exitNodes);
2076
- const exitOutput = {};
2095
+ const finalOutput = {};
2077
2096
  for (const [nodeId, nodeOutput] of sessionState.nodeOutputs) {
2078
- if (exitNodes.has(nodeId)) {
2079
- exitOutput[nodeId] = nodeOutput;
2080
- }
2097
+ finalOutput[nodeId] = nodeOutput;
2081
2098
  }
2082
- const singleExit = exitNodes.size === 1 ? Array.from(exitNodes)[0] : undefined;
2083
- const finalOutput = singleExit && exitOutput[singleExit] !== undefined ? exitOutput[singleExit] : exitOutput;
2084
2099
  const allNodeOutputs = {};
2085
2100
  for (const [nodeId, nodeOutput] of sessionState.nodeOutputs) {
2086
2101
  allNodeOutputs[nodeId] = nodeOutput;
@@ -20,11 +20,13 @@ var CreateTaskToolSchema = z.object({
20
20
  project_path: z.string().describe("Project root path for task positioning. " + "Used to locate the project space for this task. " + "Use 'unknown' if unknown."),
21
21
  parent_task_id: z.union([z.number(), z.null()]).optional().describe(`父任务 ID(可选)。不传或传 null 时,创建根任务(root task)。
22
22
  ` + `如需将任务挂载到某个父任务下,传入对应父任务 ID。
23
- ` + `如何选择合适的父任务:
24
- ` + ` 1. 使用 task_list(depth=0) 查看当前所有根任务
25
- ` + ` 2. 使用 task_search 搜索与当前任务相关的父任务
26
- ` + ` 3. 按主题归类:将相似主题的任务挂载到同一个父任务下
27
- ` + "如果确实找不到合适的父任务,可以直接创建根任务(不传 parent_task_id)。"),
23
+ ` + `**调用前必须先调用 task_tree(depth=2)** 查看现有任务树结构,避免重复创建根任务、避免孤儿任务。
24
+ ` + `决策路径(按顺序匹配):
25
+ ` + ` A. 归属到现有 longterm 根(如「[Longterm] X 生态」)→ parent_task_id = 该根 ID
26
+ ` + ` B. 归属到现有主题聚类(非 longterm 根,但同主题)→ parent_task_id = 该根 ID
27
+ ` + ` C. 新建根任务 → 省略 parent_task_id(让树根 ≤10)
28
+ ` + `如何找到 parent_task_id:使用 task_tree(depth=2) 获取的树形结构,
29
+ ` + "根据节点 id 选择合适的父任务 ID(来自 tree 输出,**不要硬编码**数字)。"),
28
30
  context: z.string().describe("JSON string with time-space positioning information for task continuity. " + "This field is crucial for Agent task handoff. " + "Core fields: worktree_path (git worktree path), branch (current branch), type (feature/bug/refactor/chore). " + 'Example for coding: {"worktree_path": "/path/worktree", "branch": "feature/xyz", "type": "feature"}. ' + 'Example for other: {"type": "general"}. ' + `If unknown, use '{}' or '{"type":"unknown"}'. ` + "IMPORTANT: Must be a valid JSON string!")
29
31
  });
30
32
  var GetTaskToolSchema = z.object({
@@ -77,6 +79,14 @@ var BatchArchiveToolSchema = z.object({
77
79
  var BatchDeleteToolSchema = z.object({
78
80
  task_ids: z.array(z.number()).describe("要删除的任务 ID 列表")
79
81
  });
82
+ var TreeTasksToolSchema = z.object({
83
+ depth: z.number().optional().default(2).describe("树的展开深度。默认 2 (根 + 一层子任务 + 二层孙任务)。" + "0 = 只返回根任务,不展开任何子节点。" + "-1 或负数 = 无限层级(全部展开)。"),
84
+ parent_task_id: z.number().optional().describe("只看指定父任务的子树。不传则从所有根任务(forest)开始。"),
85
+ status: z.enum(["todo", "active", "completed", "paused", "cancelled", "archived"]).optional().describe("按状态过滤(与 task_list 一致)。"),
86
+ priority: z.enum(["low", "medium", "high"]).optional().describe("按优先级过滤。"),
87
+ type: z.enum(["normal", "cycle", "longterm"]).optional().describe("按任务类型过滤。"),
88
+ include_archived: z.boolean().optional().default(false).describe("是否包含已归档任务(默认 false,与 task_list 一致)。")
89
+ });
80
90
 
81
91
  // src/env/task/tools/create-tool.ts
82
92
  init_env_context();
@@ -87,63 +97,84 @@ function createTaskTool(taskComponent) {
87
97
  name: "task_create",
88
98
  description: `
89
99
  Create a new task for tracking work.
90
-
100
+
101
+ ## ⚠️ CALL task_tree(depth=2) BEFORE THIS TOOL
102
+
103
+ Before calling \`task_create\`, you **MUST** first call
104
+ \`task_tree(depth=2)\` to inspect the existing task hierarchy.
105
+ This is critical because:
106
+
107
+ 1. Avoid duplicating root tasks (root tasks should stay ≤ 10).
108
+ 2. Find the right \`parent_task_id\` to attach under.
109
+ 3. Avoid creating stranded/orphan tasks.
110
+
111
+ Workflow:
112
+ step 1: task_tree({depth: 2})
113
+ step 2: read the tree, then decide per "Decision Tree" below
114
+ step 3: task_create({...})
115
+
116
+ ## Decision Tree — How to choose parent_task_id
117
+
118
+ Walk these paths in order:
119
+
120
+ **Path A — Attach under a longterm root.**
121
+ The task belongs to a theme whose longterm root already exists
122
+ (e.g. "[Longterm] X ecosystem"). Set \`parent_task_id\` to that
123
+ root's id. This is the **preferred** path for incremental work
124
+ inside an established theme.
125
+
126
+ **Path B — Attach under an existing topic cluster.**
127
+ A non-longterm root already aggregates similar tasks and yours
128
+ belongs in the same cluster. Set \`parent_task_id\` to that root.
129
+
130
+ **Path C — Create a new root.**
131
+ Neither A nor B fits (cross-cutting work, or root count already
132
+ ≥ ~10). **Omit** \`parent_task_id\` (or pass \`null\`) and the
133
+ task becomes a new root.
134
+
135
+ ## Tree Hygiene Principles
136
+
137
+ Apply these when deciding parent_task_id:
138
+
139
+ - Root tasks ≤ 10 (keep tree width manageable)
140
+ - Depth ≤ 5 (avoid deep nesting)
141
+ - Same-theme tasks cluster under one parent
142
+ - Long-tail/stranded tasks should be archived or merged
143
+
91
144
  ## IMPORTANT: Task Continuity Fields
92
-
93
- This tool creates persistent task records that can be picked up by a
94
- Task Manager Agent to continue推进未完成的任务.
95
-
145
+
146
+ This tool creates persistent task records that can be picked up by a
147
+ Task Manager Agent to continue advancing unfinished work.
148
+
96
149
  The following fields are critical for task context preservation:
97
-
150
+
98
151
  - project_path: The project root path where this task belongs.
99
152
  Used to locate the project space for this task.
100
153
  If unknown, use 'unknown'.
101
-
154
+
102
155
  - context: A JSON string containing time-space positioning information.
103
156
  This field is crucial for Agent task handoff.
104
-
157
+
105
158
  **Required format**: Valid JSON string (parseable).
106
-
159
+
107
160
  **Core fields**:
108
161
  - worktree_path: Git worktree path (for code development)
109
162
  - branch: Current branch name
110
163
  - type: Work type classification (feature/bug/refactor/chore).
111
164
  ⚠️ NOTE: This is the **context.type** (work classification), NOT the
112
165
  task's type field (normal/cycle/longterm). They are independent concepts.
113
-
166
+
114
167
  **Example for coding tasks**:
115
- {"worktree_path": "/path/to/worktree", "branch": "feature/xyz", "type": "feature", "parent_branch": "main"}
116
-
168
+ {"worktree_path": "<worktree-path>", "branch": "<branch-name>", "type": "feature", "parent_branch": "main"}
169
+
117
170
  **Example for other tasks**:
118
171
  {"type": "general"}
119
-
172
+
120
173
  If unable to fill in details, use at minimum:
121
174
  {"type": "unknown"}
122
-
175
+
123
176
  **DO NOT leave this as plain text** - it must be valid JSON!
124
-
125
- ## parent_task_id is OPTIONAL
126
-
127
- Creating a root task (top-level task) is allowed and common. To create a root task,
128
- simply **omit** \`parent_task_id\` (or pass \`null\`).
129
-
130
- To create a child task, provide an existing parent's \`parent_task_id\`. Best practices:
131
-
132
- 1. First, use \`task_list(depth=0)\` to see all root tasks (top-level tasks).
133
- 2. Use \`task_search\` with relevant keywords to find existing tasks
134
- that could serve as the parent.
135
- 3. Group by topic: put similar tasks under the same parent.
136
- 4. If no suitable parent exists, create a root task first (omit \`parent_task_id\`),
137
- then create the child task with that root task's id.
138
-
139
- **Examples:**
140
- - Root task: \`task_create(title="New project", ...)\` (no parent_task_id)
141
- - Child task: \`task_create(title="New feature", parent_task_id=<root_task_id>, ...)\`
142
- where \`<root_task_id>\` is the id returned by task_list, NOT a hardcoded number.
143
-
144
- **Hierarchy guidance** (not enforced):
145
- - 根任务 ≤10 (keep root tasks manageable)
146
- - 深度 ≤5 (avoid deep nesting)
177
+
147
178
  `,
148
179
  parameters: CreateTaskToolSchema,
149
180
  execute: async (args, ctx) => {
@@ -626,4 +657,142 @@ function completeTaskTool(taskComponent) {
626
657
  }
627
658
  };
628
659
  }
629
- export { createTaskTool, getTaskTool, listTasksTool, searchTasksTool, batchArchiveTaskTool, batchDeleteTaskTool, updateTaskTool, deleteTaskTool, completeTaskTool };
660
+ // src/env/task/tools/task-tree-tool.ts
661
+ function compareTasksDesc(a, b) {
662
+ if (a.updatedAt < b.updatedAt)
663
+ return 1;
664
+ if (a.updatedAt > b.updatedAt)
665
+ return -1;
666
+ if (a.id < b.id)
667
+ return 1;
668
+ if (a.id > b.id)
669
+ return -1;
670
+ return 0;
671
+ }
672
+ function trimToDepth(nodes, depth) {
673
+ if (depth < 0)
674
+ return nodes;
675
+ if (depth === 0) {
676
+ return nodes.map((n) => ({ ...n, children: [] }));
677
+ }
678
+ return nodes.map((n) => ({
679
+ ...n,
680
+ children: trimToDepth(n.children, depth - 1)
681
+ }));
682
+ }
683
+ function countNodes(nodes) {
684
+ let n = 0;
685
+ for (const node of nodes)
686
+ n += 1 + countNodes(node.children);
687
+ return n;
688
+ }
689
+ function buildTaskNodes(tasks) {
690
+ const nodeById = new Map;
691
+ const byParent = new Map;
692
+ const roots = [];
693
+ for (const t of tasks) {
694
+ nodeById.set(t.id, {
695
+ id: t.id,
696
+ title: t.title,
697
+ status: t.status,
698
+ type: t.type,
699
+ priority: t.priority,
700
+ progress: t.progress,
701
+ children: []
702
+ });
703
+ }
704
+ for (const t of tasks) {
705
+ const pid = t.parent_task_id;
706
+ if (pid !== undefined && pid !== null && nodeById.has(pid)) {
707
+ const list = byParent.get(pid) || [];
708
+ list.push(t);
709
+ byParent.set(pid, list);
710
+ } else {
711
+ roots.push(t);
712
+ }
713
+ }
714
+ for (const [parentId, children] of byParent.entries()) {
715
+ const parentNode = nodeById.get(parentId);
716
+ children.sort(compareTasksDesc);
717
+ parentNode.children = children.map((c) => nodeById.get(c.id));
718
+ }
719
+ roots.sort(compareTasksDesc);
720
+ return roots.map((r) => nodeById.get(r.id));
721
+ }
722
+ function treeTasksTool(taskComponent) {
723
+ return {
724
+ name: "task_tree",
725
+ description: "View the task tree (forest) with optional filters. " + "Use this BEFORE task_create to decide whether to create a root task " + "(omit parent_task_id) or attach to an existing parent. " + "depth: 0=只根任务, 1=根+一层子任务, 2=根+二层子任务 (default), " + "-1 or omitted as -1=无限层级. " + `Returns { total, truncated, depth, parent_task_id, nodes } where:
726
+ ` + ` - total: count of ALL tasks in the returned tree (incl. descendants)
727
+ ` + ` - truncated: always false for now (no pagination cap on tree)
728
+ ` + ` - depth: the resolved depth value
729
+ ` + ` - parent_task_id: the root's id, or null for forest mode
730
+ ` + ` - nodes: TaskNode[] with { id, title, status, type, priority, progress, children }
731
+ ` + "Note: `total` is the FIRST field in the response so it survives " + "tail-truncation by ToolComponent.truncateOutput.",
732
+ parameters: TreeTasksToolSchema,
733
+ execute: async (args, _ctx) => {
734
+ const params = TreeTasksToolSchema.parse(args);
735
+ try {
736
+ let flat = [];
737
+ let parent_task_id = params.parent_task_id ?? null;
738
+ if (params.parent_task_id !== undefined && params.parent_task_id !== null) {
739
+ const root = await taskComponent.getTask(params.parent_task_id);
740
+ if (!root) {
741
+ flat = [];
742
+ } else {
743
+ const descendants = await taskComponent.getTaskTree(params.parent_task_id, params.depth === -1 ? -1 : Math.max(0, params.depth - 1));
744
+ flat = [root, ...descendants];
745
+ }
746
+ } else {
747
+ const result = await taskComponent.listTasks({
748
+ status: params.status,
749
+ priority: params.priority,
750
+ type: params.type,
751
+ include_archived: params.include_archived,
752
+ limit: 9999,
753
+ offset: 0
754
+ });
755
+ flat = result.tasks;
756
+ }
757
+ if (params.parent_task_id !== undefined && params.parent_task_id !== null) {
758
+ if (params.status) {
759
+ flat = flat.filter((t) => t.status === params.status);
760
+ }
761
+ if (params.priority) {
762
+ flat = flat.filter((t) => t.priority === params.priority);
763
+ }
764
+ if (params.type) {
765
+ flat = flat.filter((t) => t.type === params.type);
766
+ }
767
+ if (!params.include_archived) {
768
+ flat = flat.filter((t) => t.status !== "archived");
769
+ }
770
+ }
771
+ let nodes = buildTaskNodes(flat);
772
+ if (params.parent_task_id === undefined || params.parent_task_id === null) {
773
+ nodes = trimToDepth(nodes, params.depth);
774
+ }
775
+ const total = countNodes(nodes);
776
+ return {
777
+ success: true,
778
+ output: JSON.stringify({
779
+ total,
780
+ truncated: false,
781
+ depth: params.depth,
782
+ parent_task_id,
783
+ nodes
784
+ }),
785
+ metadata: { execution_time_ms: 0 }
786
+ };
787
+ } catch (error) {
788
+ return {
789
+ success: false,
790
+ output: "",
791
+ error: error instanceof Error ? error.message : String(error),
792
+ metadata: { execution_time_ms: 0 }
793
+ };
794
+ }
795
+ }
796
+ };
797
+ }
798
+ export { createTaskTool, getTaskTool, listTasksTool, searchTasksTool, batchArchiveTaskTool, batchDeleteTaskTool, updateTaskTool, deleteTaskTool, completeTaskTool, treeTasksTool };
@@ -8,7 +8,7 @@ import {
8
8
  BackgroundTaskManager,
9
9
  createDelegateTool,
10
10
  createStopTool
11
- } from "./roy-agent-core-te3hf26b.js";
11
+ } from "./roy-agent-core-7afcdb2m.js";
12
12
  import {
13
13
  SQLiteTaskStore,
14
14
  getDefaultTaskDbPath
@@ -22,8 +22,9 @@ import {
22
22
  getTaskTool,
23
23
  listTasksTool,
24
24
  searchTasksTool,
25
+ treeTasksTool,
25
26
  updateTaskTool
26
- } from "./roy-agent-core-0ye4q2jj.js";
27
+ } from "./roy-agent-core-ktbkp661.js";
27
28
  import {
28
29
  createOperationTool,
29
30
  deleteOperationTool,
@@ -352,6 +353,7 @@ class TaskComponent extends BaseComponent {
352
353
  createTaskTool(this),
353
354
  getTaskTool(this),
354
355
  listTasksTool(this),
356
+ treeTasksTool(this),
355
357
  searchTasksTool(this),
356
358
  batchArchiveTaskTool(this),
357
359
  batchDeleteTaskTool(this),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTimeout
3
- } from "./roy-agent-core-j7jeqxhd.js";
3
+ } from "./roy-agent-core-65qs21kf.js";
4
4
  import {
5
5
  truncateOutputInline
6
6
  } from "./roy-agent-core-6kygfd9x.js";
@@ -76,6 +76,8 @@ var AGENT_CONFIG_REGISTRATION = {
76
76
  { key: "agent.defaultAgent.systemPrompt", sources: ["env", "file"] },
77
77
  { key: "agent.defaultAgent.streaming", sources: ["env", "file"] },
78
78
  { key: "agent.defaultAgent.tools", sources: ["env", "file"] },
79
+ { key: "agent.defaultAgent.allowedTools", sources: ["env", "file"] },
80
+ { key: "agent.defaultAgent.deniedTools", sources: ["env", "file"] },
79
81
  { key: "agent.defaultAgent.maxErrorRetries", sources: ["env", "file"] },
80
82
  { key: "agent.defaultAgent.filterHistory", sources: ["env", "file"] }
81
83
  ]
@@ -86,6 +88,20 @@ init_decorator();
86
88
  init_global_hook_manager();
87
89
  init_context();
88
90
  init_workflow_hil();
91
+ function parseToolList(v) {
92
+ if (v === undefined || v === null) {
93
+ return;
94
+ }
95
+ if (Array.isArray(v)) {
96
+ const arr = v.filter((x) => typeof x === "string");
97
+ return arr.length > 0 ? arr : undefined;
98
+ }
99
+ if (typeof v === "string") {
100
+ const parts = v.split(",").map((s) => s.trim()).filter(Boolean);
101
+ return parts.length > 0 ? parts : undefined;
102
+ }
103
+ return;
104
+ }
89
105
  var logger = createLogger("agent:component");
90
106
  function toLLMMessage(msg) {
91
107
  let content;
@@ -304,7 +320,9 @@ class AgentComponent extends BaseComponent {
304
320
  type: constructorDefaultAgent?.type ?? configComponent.get("agent.defaultAgent.type") ?? "primary",
305
321
  systemPrompt: constructorDefaultAgent?.systemPrompt ?? configComponent.get("agent.defaultAgent.systemPrompt"),
306
322
  model: constructorDefaultAgent?.model ?? configComponent.get("agent.defaultAgent.model"),
307
- behaviorSpecId: constructorDefaultAgent?.behaviorSpecId ?? configComponent.get("agent.defaultAgent.behaviorSpecId")
323
+ behaviorSpecId: constructorDefaultAgent?.behaviorSpecId ?? configComponent.get("agent.defaultAgent.behaviorSpecId"),
324
+ allowedTools: parseToolList(constructorDefaultAgent?.allowedTools ?? configComponent.get("agent.defaultAgent.allowedTools")),
325
+ deniedTools: parseToolList(constructorDefaultAgent?.deniedTools ?? configComponent.get("agent.defaultAgent.deniedTools"))
308
326
  };
309
327
  logger.info(`[registerConfig] Synced config from ConfigComponent: maxIterations=${this.config.defaultAgent.maxIterations}`);
310
328
  this.registerConfigWatcher(configComponent);
@@ -1,6 +1,16 @@
1
1
  // src/env/prompt/prompts-index.ts
2
2
  var builtInPrompts = {
3
- default: `你是 Roy 接待智能体(Receptionist Agent)—— Roy 系统的智能入口。
3
+ default: `你是 {{agent_name}} 接待智能体(Receptionist Agent)—— {{agent_name}} 系统的智能入口。
4
+
5
+ ## ⚠️ 重要澄清:关于本 prompt 中的工具引用
6
+
7
+ > **本 prompt 中部分段落(如 \`delegate_task(...)\` 调用模板、行为规则 6 里的引用)是**你转交给 sub-agent(通常是 \`roy\`)的示例指令**,不代表你自己能直接调用其中提到的所有工具**。
8
+ >
9
+ > 具体来说:
10
+ > - \`delegate_task(...)\` 调用里的 prompt 模板中可能提到 \`task_create\` / \`task_update\` / \`task_operation_create\` / \`task_complete\` 等工具 —— 这些是**指示子 agent 用的**,不是你自己的工具(你已被 \`deniedTools\` 禁用)。
11
+ > - 你**自己**真正可用的工具,**严格以下方"## 你的工具"区块中的工具表为准**。
12
+ >
13
+ > 如果你读到 prompt 里有工具名但下方工具表里没有该工具 —— **不要尝试调用**,那是给子 agent 的示例。
4
14
 
5
15
  ## 工作目录
6
16
 
@@ -8,13 +18,13 @@ var builtInPrompts = {
8
18
 
9
19
  ## 你的身份
10
20
 
11
- - **名称**: Roy(接待员)
21
+ - **名称**: {{agent_name}}(接待员)
12
22
  - **角色**: 入口 AI 助手,分析用户请求并将其委托给合适的子智能体执行
13
23
  - **个性**: 友好、善于分析、高效、简洁
14
24
 
15
25
  ## 核心使命
16
26
 
17
- 你是 Roy 系统的**前门**。你的工作只有:
27
+ 你是 {{agent_name}} 系统的**前门**。你的工作只有:
18
28
 
19
29
  1. **倾听** 用户的请求
20
30
  2. **分析** 需要做什么
@@ -95,7 +105,7 @@ var builtInPrompts = {
95
105
  你有两个子智能体。**默认首次委托使用 \`roy\`**。仅在需要严格 Plan→Execute→Verify 纪律时使用 \`strict-task-agent\`。
96
106
 
97
107
  ### \uD83E\uDD47 首选:\`roy\`(首次委托默认)
98
- 全功能的 Roy AI 助手,拥有所有工具和技能,提示词中内置了 **任务作为一等公民** 原则。遵循结构化任务生命周期(创建→跟踪→完成),同时保持灵活性。
108
+ 全功能的 {{agent_name}} AI 助手,拥有所有工具和技能,提示词中内置了 **任务作为一等公民** 原则。遵循结构化任务生命周期(创建→跟踪→完成),同时保持灵活性。
99
109
  - ✅ 通用问题解决
100
110
  - ✅ 代码探索、阅读和分析
101
111
  - ✅ 创造性/探索性工作,可迭代优化
@@ -693,11 +703,18 @@ roy-agent <command> <subcmd> --help
693
703
  | \`task_list\` | List tasks with optional filters for status/priority |
694
704
  | \`task_complete\` | Mark a task as completed (progress=100, status=completed). Creates an operation record. |
695
705
  | \`task_delete\` | Delete a task and all its operation records |
696
- | \`delegate_task\` | Delegate complex tasks to a sub-agent (always background mode) |
697
- | \`stop_task\` | Stop a running background task |
698
706
  | \`task_operation_create\` | Create operation records to track progress/milestones |
699
707
  | \`task_operation_list\` | List operation records for a task |
700
708
 
709
+ ### ❌ 禁止使用的工具(你不能调用以下工具)
710
+
711
+ > 这些工具在你的 \`deniedTools\` 白名单里被禁用了。即使 prompt 提到它们,**你也不能调用**。
712
+
713
+ | 工具 | 为什么禁用 | 你应该怎么做 |
714
+ |------|-----------|-------------|
715
+ | \`delegate_task\` | 子 agent 委托入口,由 \`default\` 接待员独占 | 直接用 \`bash\` / \`read_file\` / \`edit_file\` 等工具自己完成任务;若是真正的复杂多步任务,建议用户切换到 \`default\` agent |
716
+ | \`stop_task\` | 后台进程管理入口,由 \`default\` 接待员独占 | 你无法启动后台进程,自然不需要 \`stop_task\` |
717
+
701
718
  ### Task Lifecycle
702
719
 
703
720
  Follow this lifecycle for every task:
@@ -734,18 +751,18 @@ Follow this lifecycle for every task:
734
751
  └─────────────────────────────────────────────────────────────────┘
735
752
 
736
753
  ┌─────────────────────────────────────────────────────────────────┐
737
- │ 3. EXECUTE (delegate_task)
738
- │ - delegate_task 总是后台执行,立即返回
739
- - 通过返回的 task_id 主动用 task_get 查询进度
754
+ │ 3. EXECUTE
755
+ │ - 利用各种工具和能力,skill,workflow等来解决任务达到任务描述
756
+ 和任务目标要求
740
757
  │ │
741
- Background mode is recommended when:
742
- │ - Task duration > 5 minutes
743
- - Multiple independent subtasks can run in parallel
744
- │ - User prefers async progress with notifications
758
+ Long-running work guidance:
759
+ │ - 超过 5 分钟的复杂任务:用 \`task_operation_create\`
760
+ 记录里程碑,让用户能看到实时进展
761
+ │ - 多个独立子任务可并行:用 \`bash &\` 后台启动或
762
+ │ 拆分成多个并行 ReAct 步骤 │
745
763
  │ │
746
- │ ⚠️ Note: Background tasks auto-create operation records.
747
- For sync delegation, manually call task_operation_create
748
- │ to record execution results. │
764
+ │ ⚠️ Note: 不需要手动调用 \`task_operation_create\` 跟踪
765
+ task_create / task_update 等操作也会自动创建记录。
749
766
  └─────────────────────────────────────────────────────────────────┘
750
767
 
751
768
  ┌─────────────────────────────────────────────────────────────────┐
@@ -910,7 +927,7 @@ When reusing an existing task, you MUST follow these rules:
910
927
  # 可用工具
911
928
  - search_sessions(query, session_id?, limit?): 搜索会话历史
912
929
  - get_session(session_id): 获取指定会话
913
- - record_memory({ scope, mode, content, title }): 写入记忆文件
930
+ - write_memory({ scope: "project" | "global", content: string }): 写入记忆文件(覆盖模式)
914
931
  - glob(pattern, cwd?): 查找匹配的文件
915
932
  - bash(command, workdir?): 执行命令
916
933
  - read_file(path, offset?, limit?): 读取文件内容
@@ -925,10 +942,10 @@ When reusing an existing task, you MUST follow these rules:
925
942
  3. 根据用户指导确定提炼重点
926
943
  4. 分析提炼新知识
927
944
  5. 整合新旧知识,生成完整的项目记忆
928
- 6. 使用 record_memory({ scope: "project", mode: "overwrite", content, title }) 写入
945
+ 6. 使用 write_memory({ scope: "project", content }) 写入(覆盖模式)
929
946
 
930
947
  # 输出要求
931
- 直接调用 record_memory 工具,写入新的项目记忆。
948
+ 直接调用 write_memory 工具,写入新的项目记忆。
932
949
  输出格式为 Markdown,保持结构清晰。`,
933
950
  "global-memory": `# 角色
934
951
  你是一个全局记忆管理专家,负责提炼跨项目的通用知识和用户偏好。
@@ -965,7 +982,7 @@ When reusing an existing task, you MUST follow these rules:
965
982
  # 可用工具
966
983
  - search_sessions(query, session_id?, limit?): 搜索会话历史
967
984
  - get_session(session_id): 获取指定会话
968
- - record_memory({ scope, mode, content, title }): 写入记忆文件
985
+ - write_memory({ scope: "project" | "global", content: string }): 写入记忆文件(覆盖模式)
969
986
 
970
987
  # 执行流程
971
988
  1. 理解现有全局记忆
@@ -973,10 +990,10 @@ When reusing an existing task, you MUST follow these rules:
973
990
  3. 使用工具搜索相关会话历史
974
991
  4. 分析提炼新知识
975
992
  5. 整合新旧知识,生成完整的全局记忆
976
- 6. 使用 record_memory({ scope: "global", mode: "overwrite", content, title }) 写入
993
+ 6. 使用 write_memory({ scope: "global", content }) 写入(覆盖模式)
977
994
 
978
995
  # 输出要求
979
- 直接调用 record_memory 工具,写入新的全局记忆。
996
+ 直接调用 write_memory 工具,写入新的全局记忆。
980
997
  输出格式为 Markdown,保持结构清晰。`,
981
998
  "workflow-agent": `# Workflow 调度中介(Workflow Dispatch Mediator)
982
999
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",