@ai-setting/roy-agent-core 1.6.3 → 1.6.5

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 (23) hide show
  1. package/dist/env/event-source/index.js +3 -3
  2. package/dist/env/index.js +10 -10
  3. package/dist/env/prompt/index.js +2 -2
  4. package/dist/env/task/delegate/index.js +2 -2
  5. package/dist/env/task/index.js +4 -4
  6. package/dist/env/task/plugins/index.js +2 -2
  7. package/dist/env/task/tools/index.js +3 -1
  8. package/dist/env/workflow/engine/index.js +1 -1
  9. package/dist/env/workflow/index.js +3 -3
  10. package/dist/env/workflow/tools/index.js +1 -1
  11. package/dist/index.js +11 -11
  12. package/dist/shared/@ai-setting/{roy-agent-core-anhvbnrc.js → roy-agent-core-12ttd2w1.js} +1 -1
  13. package/dist/shared/@ai-setting/{roy-agent-core-z9m38ytb.js → roy-agent-core-4extx33r.js} +2 -3
  14. package/dist/shared/@ai-setting/{roy-agent-core-xnga0ksx.js → roy-agent-core-5rjccr3c.js} +19 -37
  15. package/dist/shared/@ai-setting/{roy-agent-core-g7hfkszj.js → roy-agent-core-971gwby7.js} +1 -1
  16. package/dist/shared/@ai-setting/{roy-agent-core-pr7f94gn.js → roy-agent-core-bcd3y74k.js} +4 -2
  17. package/dist/shared/@ai-setting/{roy-agent-core-7afcdb2m.js → roy-agent-core-c94yan0b.js} +1 -1
  18. package/dist/shared/@ai-setting/{roy-agent-core-78m47x1d.js → roy-agent-core-fb3wyr3d.js} +24 -6
  19. package/dist/shared/@ai-setting/{roy-agent-core-45tvcwwz.js → roy-agent-core-hp1n198d.js} +1 -1
  20. package/dist/shared/@ai-setting/{roy-agent-core-6ve6tsm5.js → roy-agent-core-jayzyg7h.js} +2 -2
  21. package/dist/shared/@ai-setting/{roy-agent-core-0ye4q2jj.js → roy-agent-core-ktbkp661.js} +212 -43
  22. package/dist/shared/@ai-setting/{roy-agent-core-8mqahsj5.js → roy-agent-core-p8zgxdgy.js} +2 -2
  23. package/package.json +1 -1
@@ -10,7 +10,7 @@ import {
10
10
  larkCliHandler,
11
11
  resolveBountyIMSystemPrompt,
12
12
  timerHandler
13
- } from "../../shared/@ai-setting/roy-agent-core-45tvcwwz.js";
13
+ } from "../../shared/@ai-setting/roy-agent-core-hp1n198d.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-6ve6tsm5.js";
24
+ import"../../shared/@ai-setting/roy-agent-core-jayzyg7h.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-z9m38ytb.js";
28
+ import"../../shared/@ai-setting/roy-agent-core-4extx33r.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-anhvbnrc.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-12ttd2w1.js";
4
4
  import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-45tvcwwz.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-hp1n198d.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-6ve6tsm5.js";
20
+ import"../shared/@ai-setting/roy-agent-core-jayzyg7h.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-8mqahsj5.js";
24
+ } from "../shared/@ai-setting/roy-agent-core-p8zgxdgy.js";
25
25
  import"../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
26
- import"../shared/@ai-setting/roy-agent-core-78m47x1d.js";
26
+ import"../shared/@ai-setting/roy-agent-core-fb3wyr3d.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";
@@ -31,7 +31,7 @@ import"../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
31
31
  import"../shared/@ai-setting/roy-agent-core-hhrg314p.js";
32
32
  import"../shared/@ai-setting/roy-agent-core-ba6243hr.js";
33
33
  import"../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
34
- import"../shared/@ai-setting/roy-agent-core-xnga0ksx.js";
34
+ import"../shared/@ai-setting/roy-agent-core-5rjccr3c.js";
35
35
  import"../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
36
36
  import"../shared/@ai-setting/roy-agent-core-b75jtybq.js";
37
37
  import"../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
@@ -48,20 +48,20 @@ 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-pr7f94gn.js";
51
+ } from "../shared/@ai-setting/roy-agent-core-bcd3y74k.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-7afcdb2m.js";
54
+ import"../shared/@ai-setting/roy-agent-core-c94yan0b.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-z9m38ytb.js";
57
+ import"../shared/@ai-setting/roy-agent-core-4extx33r.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 {
@@ -3,8 +3,8 @@ import {
3
3
  PromptConfigSchema,
4
4
  PromptPathSchema,
5
5
  PromptRenderer
6
- } from "../../shared/@ai-setting/roy-agent-core-g7hfkszj.js";
7
- import"../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
6
+ } from "../../shared/@ai-setting/roy-agent-core-971gwby7.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-4extx33r.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-7afcdb2m.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-c94yan0b.js";
7
7
  import"../../../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
8
- import"../../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
8
+ import"../../../shared/@ai-setting/roy-agent-core-4extx33r.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-pr7f94gn.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-bcd3y74k.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-7afcdb2m.js";
13
+ import"../../shared/@ai-setting/roy-agent-core-c94yan0b.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-z9m38ytb.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-4extx33r.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-6ve6tsm5.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-jayzyg7h.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-z9m38ytb.js";
15
+ import"../../../shared/@ai-setting/roy-agent-core-4extx33r.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-78m47x1d.js";
8
+ } from "../../../shared/@ai-setting/roy-agent-core-fb3wyr3d.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-8mqahsj5.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-p8zgxdgy.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
5
- import"../../shared/@ai-setting/roy-agent-core-78m47x1d.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-fb3wyr3d.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";
@@ -60,7 +60,7 @@ import {
60
60
  pathNotFound,
61
61
  unresolvedVariable
62
62
  } from "../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
63
- import"../../shared/@ai-setting/roy-agent-core-xnga0ksx.js";
63
+ import"../../shared/@ai-setting/roy-agent-core-5rjccr3c.js";
64
64
  import"../../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
65
65
  import"../../shared/@ai-setting/roy-agent-core-b75jtybq.js";
66
66
  import"../../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
@@ -24,7 +24,7 @@ import {
24
24
  getRunWorkflowTool,
25
25
  initRunWorkflowTool,
26
26
  resetRunWorkflowTool
27
- } from "../../../shared/@ai-setting/roy-agent-core-xnga0ksx.js";
27
+ } from "../../../shared/@ai-setting/roy-agent-core-5rjccr3c.js";
28
28
  import {
29
29
  WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
30
30
  WorkflowJsonOutputMarker,
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-g7hfkszj.js";
4
+ } from "./shared/@ai-setting/roy-agent-core-971gwby7.js";
5
5
  import {
6
6
  LLMComponent,
7
7
  LLMConfigSchema,
@@ -62,7 +62,7 @@ import {
62
62
  BaseEnvironment,
63
63
  generateDescendingId,
64
64
  generateId
65
- } from "./shared/@ai-setting/roy-agent-core-anhvbnrc.js";
65
+ } from "./shared/@ai-setting/roy-agent-core-12ttd2w1.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-45tvcwwz.js";
77
+ } from "./shared/@ai-setting/roy-agent-core-hp1n198d.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-6ve6tsm5.js";
97
+ } from "./shared/@ai-setting/roy-agent-core-jayzyg7h.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-8mqahsj5.js";
103
+ } from "./shared/@ai-setting/roy-agent-core-p8zgxdgy.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-78m47x1d.js";
108
+ import"./shared/@ai-setting/roy-agent-core-fb3wyr3d.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";
@@ -113,7 +113,7 @@ import"./shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
113
113
  import"./shared/@ai-setting/roy-agent-core-hhrg314p.js";
114
114
  import"./shared/@ai-setting/roy-agent-core-ba6243hr.js";
115
115
  import"./shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
116
- import"./shared/@ai-setting/roy-agent-core-xnga0ksx.js";
116
+ import"./shared/@ai-setting/roy-agent-core-5rjccr3c.js";
117
117
  import"./shared/@ai-setting/roy-agent-core-1db4vpc6.js";
118
118
  import"./shared/@ai-setting/roy-agent-core-b75jtybq.js";
119
119
  import"./shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
@@ -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-pr7f94gn.js";
151
+ } from "./shared/@ai-setting/roy-agent-core-bcd3y74k.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-7afcdb2m.js";
154
+ import"./shared/@ai-setting/roy-agent-core-c94yan0b.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-z9m38ytb.js";
163
+ } from "./shared/@ai-setting/roy-agent-core-4extx33r.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
  createAutoTaskPlugin
3
- } from "./roy-agent-core-6ve6tsm5.js";
3
+ } from "./roy-agent-core-jayzyg7h.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -530,7 +530,7 @@ roy-agent workflow list|add|search|get|tag|validate|update|remove|run|pause|resu
530
530
  | \`workflow get <name>\` | Get workflow definition details. |
531
531
  | \`workflow tag list [--sort-by name/usage_count/created_at] [--order desc/asc]\` | List all available tags with usage_count. \`\`\` |
532
532
  | \`workflow validate --file <path>\` | Validate a workflow YAML/JSON before adding. Always run this BEFORE \`workflow add\`. |
533
- | \`workflow run <name> [--input JSON] [--sync/--async]\` | Run a workflow. |
533
+ | \`workflow run <name> [--input JSON]\` | Run a workflow. |
534
534
  | \`workflow status <run-id>\` | Check workflow run status. |
535
535
  | \`workflow pause/resume/stop <run-id>\` | Control workflow execution. |
536
536
  | \`workflow update <id> [--tags] [--description]\` | Update workflow metadata. |
@@ -1022,7 +1022,7 @@ When reusing an existing task, you MUST follow these rules:
1022
1022
  - 返回值:workflow 定义(名称、版本、描述、入参 inputs schema、节点列表),或 run 的状态
1023
1023
 
1024
1024
  3. **\`workflow_run\`** — 运行 workflow
1025
- - 参数:\`workflow_name\`(必填),\`input\`(可选 JSON),\`sync\`(是否等待完成,默认 true),\`timeout\`(可选),\`session\`(resume 用,传 runId 即可),\`node_config\`(per-node 覆盖,Task #1974,JSON 对象 { "<nodeId>": { timeout: 5000 } })
1025
+ - 参数:\`workflow_name\`(必填),\`input\`(可选 JSON),\`timeout\`(可选),\`session\`(resume 用,传 runId 即可),\`node_config\`(per-node 覆盖,Task #1974,JSON 对象 { "<nodeId>": { timeout: 5000 } })
1026
1026
  - 返回值:run_id, status, output, error, duration_ms
1027
1027
 
1028
1028
  4. **\`workflow_run_status\`** — 查询 run 状态
@@ -1170,7 +1170,6 @@ plan/execute/verify 三阶段已完成的会跳过,未完成的会接上。
1170
1170
  | \`workflow_run\` 返回 \`status="failed"\` + error 含 "timeout" | stop → resume(同 session) |
1171
1171
  | \`workflow_run\` 返回 \`status="failed"\` + error 是业务错误(如校验失败) | **不** resume,原样返回给上游 |
1172
1172
  | \`workflow_run\` 返回 \`status="paused"\`(ask_user 中断) | 用 \`session\` resume + 用户 response |
1173
- | \`workflow_run\` 返回 \`status="running"\` 但实际卡死很久 | 先 \`workflow_run_status\` 确认;仍是 running 则 stop → resume |
1174
1173
  | \`workflow_run\` 抛异常(非 status=failed,是 throw) | stop → resume;resume 仍失败则开新 run |
1175
1174
 
1176
1175
  记住:**stop + resume 是默认动作**,不是例外。
@@ -618,11 +618,10 @@ var logger7 = createLogger("run-workflow-tool");
618
618
  var RunWorkflowInputSchema = z8.object({
619
619
  workflow_name: z8.string().describe("Name of the workflow to run"),
620
620
  input: z8.record(z8.any()).optional().describe("Input to pass to the workflow"),
621
- sync: z8.boolean().default(true).describe("Wait for completion (default: true)"),
622
621
  timeout: z8.number().positive().optional().describe("Timeout in milliseconds (default: 1800000 = 30 min)"),
623
622
  node_config: z8.record(z8.string(), z8.record(z8.string(), z8.any())).optional().describe("Per-node runtime config overrides keyed by node id (Task #1974). " + "Shallow-merged into each node's effective config; input wins over nodeDef.config."),
624
623
  session: z8.string().regex(/^workflow_/, { message: "session must start with 'workflow_'" }).optional().describe("Existing session ID (workflow_xxx) to resume from. Mutually exclusive with fresh `input` runs.")
625
- });
624
+ }).strict();
626
625
  function createRunWorkflowTool(workflowService) {
627
626
  return {
628
627
  name: "workflow_run",
@@ -642,10 +641,9 @@ function createRunWorkflowTool(workflowService) {
642
641
  },
643
642
  execute: async (args, ctx) => {
644
643
  const startTime = Date.now();
645
- const { workflow_name, input, session, sync = true, timeout = 1800000, node_config } = args;
644
+ const { workflow_name, input, session, timeout = 1800000, node_config } = args;
646
645
  logger7.info(`Running workflow: ${workflow_name}`, {
647
646
  input,
648
- sync,
649
647
  timeout,
650
648
  ...session ? { resumeSession: session } : {}
651
649
  });
@@ -664,7 +662,6 @@ function createRunWorkflowTool(workflowService) {
664
662
  try {
665
663
  let result;
666
664
  const baseOptions = {
667
- sync,
668
665
  ...parentSessionId ? { parentSessionId } : {},
669
666
  onSessionCreated,
670
667
  ...node_config ? { nodeConfig: node_config } : {}
@@ -695,38 +692,23 @@ function createRunWorkflowTool(workflowService) {
695
692
  }
696
693
  durationMs = Date.now() - startTime;
697
694
  const finalRunId = capturedRunId ?? result.runId ?? "";
698
- if (sync) {
699
- return {
700
- success: result.status === "completed" || result.status === "paused",
701
- output: {
702
- run_id: finalRunId,
703
- status: result.status,
704
- output: result.output,
705
- error: result.error,
706
- duration_ms: result.durationMs || durationMs,
707
- ...result.pendingNodeId ? { pending_node_id: result.pendingNodeId } : {},
708
- ...result.query ? { query: result.query } : {},
709
- ...result.agentSessionId ? { agent_session_id: result.agentSessionId } : {}
710
- },
711
- metadata: {
712
- execution_time_ms: durationMs,
713
- run_id: finalRunId
714
- }
715
- };
716
- } else {
717
- return {
718
- success: true,
719
- output: {
720
- run_id: finalRunId,
721
- status: result.status,
722
- duration_ms: durationMs
723
- },
724
- metadata: {
725
- execution_time_ms: durationMs,
726
- run_id: finalRunId
727
- }
728
- };
729
- }
695
+ return {
696
+ success: result.status === "completed" || result.status === "paused",
697
+ output: {
698
+ run_id: finalRunId,
699
+ status: result.status,
700
+ output: result.output,
701
+ error: result.error,
702
+ duration_ms: result.durationMs || durationMs,
703
+ ...result.pendingNodeId ? { pending_node_id: result.pendingNodeId } : {},
704
+ ...result.query ? { query: result.query } : {},
705
+ ...result.agentSessionId ? { agent_session_id: result.agentSessionId } : {}
706
+ },
707
+ metadata: {
708
+ execution_time_ms: durationMs,
709
+ run_id: finalRunId
710
+ }
711
+ };
730
712
  } catch (error) {
731
713
  if (timeoutHandle) {
732
714
  clearTimeout(timeoutHandle);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtInPrompts
3
- } from "./roy-agent-core-z9m38ytb.js";
3
+ } from "./roy-agent-core-4extx33r.js";
4
4
  import {
5
5
  getXDGPath
6
6
  } from "./roy-agent-core-qxnbvgwe.js";
@@ -8,7 +8,7 @@ import {
8
8
  BackgroundTaskManager,
9
9
  createDelegateTool,
10
10
  createStopTool
11
- } from "./roy-agent-core-7afcdb2m.js";
11
+ } from "./roy-agent-core-c94yan0b.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),
@@ -4,7 +4,7 @@ import {
4
4
  } from "./roy-agent-core-pzeexnhf.js";
5
5
  import {
6
6
  builtInPrompts
7
- } from "./roy-agent-core-z9m38ytb.js";
7
+ } from "./roy-agent-core-4extx33r.js";
8
8
  import {
9
9
  DEFAULT_SUBAGENT_PROMPT
10
10
  } from "./roy-agent-core-as3phr7n.js";
@@ -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,
@@ -1621,11 +1642,8 @@ var init_engine = __esm(() => {
1621
1642
  logger3.error(`Workflow ${sessionId} scheduling error:`, error);
1622
1643
  this.failWorkflow(sessionState, error);
1623
1644
  });
1624
- if (options?.sync !== false) {
1625
- const wfTimeout = options?.timeout ?? sessionState.config.timeout ?? undefined;
1626
- return this.waitForCompletion(sessionId, wfTimeout);
1627
- }
1628
- return { runId, status: "running" };
1645
+ const wfTimeout = options?.timeout ?? sessionState.config.timeout ?? undefined;
1646
+ return this.waitForCompletion(sessionId, wfTimeout);
1629
1647
  }
1630
1648
  async runWorkflow(workflow, options) {
1631
1649
  const definition = "definition" in workflow ? workflow.definition : workflow;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook
4
- } from "./roy-agent-core-6ve6tsm5.js";
4
+ } from "./roy-agent-core-jayzyg7h.js";
5
5
  import {
6
6
  envKeyToConfigKey
7
7
  } from "./roy-agent-core-qxhq8ven.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-z9m38ytb.js";
9
+ } from "./roy-agent-core-4extx33r.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 };
@@ -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 };
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowEngine,
7
7
  exports_engine,
8
8
  init_engine
9
- } from "./roy-agent-core-78m47x1d.js";
9
+ } from "./roy-agent-core-fb3wyr3d.js";
10
10
  import {
11
11
  askUserTool,
12
12
  createRunWorkflowTool,
@@ -18,7 +18,7 @@ import {
18
18
  createWorkflowSearchTool,
19
19
  createWorkflowTagListTool,
20
20
  createWorkflowValidateTool
21
- } from "./roy-agent-core-xnga0ksx.js";
21
+ } from "./roy-agent-core-5rjccr3c.js";
22
22
  import {
23
23
  WorkflowService
24
24
  } from "./roy-agent-core-b75jtybq.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",