@ai-setting/roy-agent-core 1.5.86 → 1.5.88

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.
package/dist/env/index.js CHANGED
@@ -21,17 +21,17 @@ import"../shared/@ai-setting/roy-agent-core-7fdzfsm6.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-dp73ghtz.js";
24
+ } from "../shared/@ai-setting/roy-agent-core-6n7xwv4v.js";
25
25
  import"../shared/@ai-setting/roy-agent-core-fjexv5nm.js";
26
- import"../shared/@ai-setting/roy-agent-core-gttz2jpm.js";
26
+ import"../shared/@ai-setting/roy-agent-core-9y09xfav.js";
27
27
  import"../shared/@ai-setting/roy-agent-core-5kdw0p98.js";
28
28
  import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
29
29
  import"../shared/@ai-setting/roy-agent-core-gb9gbkc3.js";
30
30
  import"../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
31
31
  import"../shared/@ai-setting/roy-agent-core-hhrg314p.js";
32
- import"../shared/@ai-setting/roy-agent-core-j754zgb4.js";
32
+ import"../shared/@ai-setting/roy-agent-core-hc20420t.js";
33
33
  import"../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
34
- import"../shared/@ai-setting/roy-agent-core-r5axf0ad.js";
34
+ import"../shared/@ai-setting/roy-agent-core-0y64qaac.js";
35
35
  import"../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
36
36
  import"../shared/@ai-setting/roy-agent-core-tq9528d3.js";
37
37
  import"../shared/@ai-setting/roy-agent-core-h0x19xgn.js";
@@ -44,7 +44,7 @@ import"../shared/@ai-setting/roy-agent-core-r0m0at3x.js";
44
44
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
45
45
  import {
46
46
  TaskComponent
47
- } from "../shared/@ai-setting/roy-agent-core-bk5g94yd.js";
47
+ } from "../shared/@ai-setting/roy-agent-core-4cdtdxqx.js";
48
48
  import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
49
49
  import"../shared/@ai-setting/roy-agent-core-bgw4dq11.js";
50
50
  import"../shared/@ai-setting/roy-agent-core-pcdzfwdv.js";
@@ -54,7 +54,7 @@ import {
54
54
  getXDGPath,
55
55
  getXDGPaths
56
56
  } from "../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
57
- import"../shared/@ai-setting/roy-agent-core-7nh5h9fn.js";
57
+ import"../shared/@ai-setting/roy-agent-core-h5867smx.js";
58
58
  import"../shared/@ai-setting/roy-agent-core-t94ktchq.js";
59
59
  import"../shared/@ai-setting/roy-agent-core-92z6t4he.js";
60
60
  import {
@@ -5,7 +5,7 @@ import {
5
5
  TaskPriorityEnum,
6
6
  TaskStatusEnum,
7
7
  TaskTypeEnum
8
- } from "../../shared/@ai-setting/roy-agent-core-bk5g94yd.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-4cdtdxqx.js";
9
9
  import {
10
10
  TaskEntityEventTypes
11
11
  } from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
@@ -16,7 +16,7 @@ import {
16
16
  } from "../../shared/@ai-setting/roy-agent-core-pcdzfwdv.js";
17
17
  import"../../shared/@ai-setting/roy-agent-core-7z4xtrmw.js";
18
18
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
19
- import"../../shared/@ai-setting/roy-agent-core-7nh5h9fn.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-h5867smx.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-t94ktchq.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
22
22
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
@@ -8,7 +8,7 @@ import {
8
8
  listTasksTool,
9
9
  searchTasksTool,
10
10
  updateTaskTool
11
- } from "../../../shared/@ai-setting/roy-agent-core-7nh5h9fn.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-h5867smx.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-y5d04fm3.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-k05v31rc.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
@@ -8,7 +8,9 @@ import {
8
8
  grepTool,
9
9
  readFileTool,
10
10
  writeFileTool
11
- } from "../../../shared/@ai-setting/roy-agent-core-8pk6a00t.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-qhjb153z.js";
12
+ import"../../../shared/@ai-setting/roy-agent-core-k05v31rc.js";
13
+ import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
12
14
  import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
13
15
  import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
14
16
  import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
@@ -4,7 +4,7 @@ import {
4
4
  ToolValidator,
5
5
  getMaxOutputSize,
6
6
  setToolConfigComponent
7
- } from "../../shared/@ai-setting/roy-agent-core-pwzkgtgr.js";
7
+ } from "../../shared/@ai-setting/roy-agent-core-3arrpf7n.js";
8
8
  import {
9
9
  bashTool,
10
10
  echoTool,
@@ -15,7 +15,7 @@ import {
15
15
  grepTool,
16
16
  readFileTool,
17
17
  writeFileTool
18
- } from "../../shared/@ai-setting/roy-agent-core-8pk6a00t.js";
18
+ } from "../../shared/@ai-setting/roy-agent-core-qhjb153z.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
@@ -6,12 +6,12 @@ import {
6
6
  Scheduler,
7
7
  WorkflowEngine,
8
8
  init_engine
9
- } from "../../../shared/@ai-setting/roy-agent-core-gttz2jpm.js";
9
+ } from "../../../shared/@ai-setting/roy-agent-core-9y09xfav.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-5kdw0p98.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-gb9gbkc3.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
14
- import"../../../shared/@ai-setting/roy-agent-core-j754zgb4.js";
14
+ import"../../../shared/@ai-setting/roy-agent-core-hc20420t.js";
15
15
  import"../../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
16
16
  import"../../../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
17
17
  import"../../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  WorkflowComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-dp73ghtz.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-6n7xwv4v.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-fjexv5nm.js";
5
- import"../../shared/@ai-setting/roy-agent-core-gttz2jpm.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-9y09xfav.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-5kdw0p98.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-gb9gbkc3.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-hhrg314p.js";
11
- import"../../shared/@ai-setting/roy-agent-core-j754zgb4.js";
11
+ import"../../shared/@ai-setting/roy-agent-core-hc20420t.js";
12
12
  import {
13
13
  BaseEventSchema,
14
14
  ControlPauseEventSchema,
@@ -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-r5axf0ad.js";
63
+ import"../../shared/@ai-setting/roy-agent-core-0y64qaac.js";
64
64
  import"../../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
65
65
  import"../../shared/@ai-setting/roy-agent-core-tq9528d3.js";
66
66
  import {
@@ -5,7 +5,7 @@ import {
5
5
  init_skill_node,
6
6
  init_tool_node,
7
7
  init_workflow_node
8
- } from "../../../shared/@ai-setting/roy-agent-core-j754zgb4.js";
8
+ } from "../../../shared/@ai-setting/roy-agent-core-hc20420t.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-k05v31rc.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
@@ -22,7 +22,7 @@ import {
22
22
  getRunWorkflowTool,
23
23
  initRunWorkflowTool,
24
24
  resetRunWorkflowTool
25
- } from "../../../shared/@ai-setting/roy-agent-core-r5axf0ad.js";
25
+ } from "../../../shared/@ai-setting/roy-agent-core-0y64qaac.js";
26
26
  import {
27
27
  WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
28
28
  WorkflowJsonOutputMarker,
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  ToolComponent,
23
23
  ToolRegistry,
24
24
  ToolValidator
25
- } from "./shared/@ai-setting/roy-agent-core-pwzkgtgr.js";
25
+ } from "./shared/@ai-setting/roy-agent-core-3arrpf7n.js";
26
26
  import {
27
27
  bashTool,
28
28
  editFileTool,
@@ -32,7 +32,7 @@ import {
32
32
  grepTool,
33
33
  readFileTool,
34
34
  writeFileTool
35
- } from "./shared/@ai-setting/roy-agent-core-8pk6a00t.js";
35
+ } from "./shared/@ai-setting/roy-agent-core-qhjb153z.js";
36
36
  import {
37
37
  closeDatabase
38
38
  } from "./shared/@ai-setting/roy-agent-core-h4h55x4h.js";
@@ -92,20 +92,20 @@ import {
92
92
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
93
93
  import {
94
94
  WorkflowComponent
95
- } from "./shared/@ai-setting/roy-agent-core-dp73ghtz.js";
95
+ } from "./shared/@ai-setting/roy-agent-core-6n7xwv4v.js";
96
96
  import {
97
97
  init_node_registry_helper,
98
98
  registerDecoratorNodeType
99
99
  } from "./shared/@ai-setting/roy-agent-core-fjexv5nm.js";
100
- import"./shared/@ai-setting/roy-agent-core-gttz2jpm.js";
100
+ import"./shared/@ai-setting/roy-agent-core-9y09xfav.js";
101
101
  import"./shared/@ai-setting/roy-agent-core-5kdw0p98.js";
102
102
  import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
103
103
  import"./shared/@ai-setting/roy-agent-core-gb9gbkc3.js";
104
104
  import"./shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
105
105
  import"./shared/@ai-setting/roy-agent-core-hhrg314p.js";
106
- import"./shared/@ai-setting/roy-agent-core-j754zgb4.js";
106
+ import"./shared/@ai-setting/roy-agent-core-hc20420t.js";
107
107
  import"./shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
108
- import"./shared/@ai-setting/roy-agent-core-r5axf0ad.js";
108
+ import"./shared/@ai-setting/roy-agent-core-0y64qaac.js";
109
109
  import"./shared/@ai-setting/roy-agent-core-1db4vpc6.js";
110
110
  import"./shared/@ai-setting/roy-agent-core-tq9528d3.js";
111
111
  import {
@@ -132,7 +132,7 @@ import {
132
132
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
133
133
  import {
134
134
  TaskComponent
135
- } from "./shared/@ai-setting/roy-agent-core-bk5g94yd.js";
135
+ } from "./shared/@ai-setting/roy-agent-core-4cdtdxqx.js";
136
136
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
137
137
  import"./shared/@ai-setting/roy-agent-core-bgw4dq11.js";
138
138
  import {
@@ -147,7 +147,7 @@ import {
147
147
  getXDGPath,
148
148
  getXDGPaths
149
149
  } from "./shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
150
- import"./shared/@ai-setting/roy-agent-core-7nh5h9fn.js";
150
+ import"./shared/@ai-setting/roy-agent-core-h5867smx.js";
151
151
  import"./shared/@ai-setting/roy-agent-core-t94ktchq.js";
152
152
  import {
153
153
  TaskHookPoints
@@ -147,16 +147,40 @@ var WorkflowListInputSchema = z3.object({
147
147
  tags: z3.array(z3.string()).optional().describe("Filter by multiple tags (AND)"),
148
148
  search: z3.string().optional().describe("Search workflows by keyword"),
149
149
  limit: z3.number().positive().optional().describe("Maximum number of results to return"),
150
- offset: z3.number().min(0).optional().describe("Offset for pagination")
150
+ offset: z3.number().min(0).optional().describe("Offset for pagination"),
151
+ page: z3.number().int().min(1).optional().describe("1-based page number (optional; defaults to 1)")
151
152
  });
153
+ function projectWorkflow(w) {
154
+ return {
155
+ name: w.name,
156
+ version: w.version,
157
+ description: w.description,
158
+ tags: w.tags,
159
+ created_at: w.createdAt
160
+ };
161
+ }
162
+ function buildListToolOutput(result, params) {
163
+ return {
164
+ total: result.total,
165
+ count: result.workflows.length,
166
+ truncated: result.total > result.workflows.length,
167
+ limit: params.limit,
168
+ offset: params.offset,
169
+ page: params.page ?? 1,
170
+ available_tags: result.available_tags,
171
+ workflows: result.workflows.map(projectWorkflow)
172
+ };
173
+ }
152
174
  function createWorkflowListTool(workflowService) {
153
175
  return {
154
176
  name: "workflow_list",
155
- description: "List all registered workflows with optional filtering. " + "Returns `workflows`, `total` (filtered count regardless of pagination), `count` (returned count), " + "`limit`, `offset`, and `available_tags` (sorted by usage_count DESC). " + "Multi-tag filter uses AND logic. " + "\uD83D\uDCA1 TIP: The `available_tags` field tells you what tags already exist. " + "Before calling `workflow_add` with new tags, call `workflow_tag_list` to discover " + "existing tags and prefer reusing them for semantic consistency " + "(e.g. reuse 'ci-cd' rather than creating 'continuous-integration'). " + "Avoid tag proliferation is a design goal — limit the number of distinct tags in the pool.",
177
+ description: "List all registered workflows with optional filtering. " + "Returns canonical JSON shape (Code Review #1479 follow-up): " + "`total` (filtered count BEFORE pagination), `count` (returned count), `truncated` (true when total > count), " + "`limit`, `offset`, `page` (1-based page number; defaults to 1), `available_tags` (sorted by usage_count DESC), " + "and `workflows` (the array, always LAST so downstream tail-truncation strips it rather than the metadata). " + "Multi-tag filter uses AND logic. " + "\uD83D\uDCA1 TIP: The `available_tags` field tells you what tags already exist. " + "Before calling `workflow_add` with new tags, call `workflow_tag_list` to discover " + "existing tags and prefer reusing them for semantic consistency " + "(e.g. reuse 'ci-cd' rather than creating 'continuous-integration'). " + "Avoid tag proliferation is a design goal — limit the number of distinct tags in the pool.",
156
178
  parameters: WorkflowListInputSchema,
157
179
  execute: async (args, ctx) => {
158
180
  const params = WorkflowListInputSchema.parse(args);
159
181
  try {
182
+ const effectivePage = params.page ?? 1;
183
+ const effectiveOffset = params.offset !== undefined ? params.offset : (effectivePage - 1) * (params.limit ?? 20);
160
184
  const options = {};
161
185
  if (params.tag !== undefined)
162
186
  options.tag = params.tag;
@@ -164,54 +188,41 @@ function createWorkflowListTool(workflowService) {
164
188
  options.search = params.search;
165
189
  if (params.limit !== undefined)
166
190
  options.limit = params.limit;
167
- if (params.offset !== undefined)
168
- options.offset = params.offset;
191
+ if (effectiveOffset !== 0)
192
+ options.offset = effectiveOffset;
169
193
  if (params.tags && params.tags.length > 0) {
170
- const result2 = await workflowService.searchWorkflowsWithTags ? await workflowService.searchWorkflowsWithTags({
194
+ const result2 = workflowService.searchWorkflowsWithTags ? await workflowService.searchWorkflowsWithTags({
171
195
  tags: params.tags,
172
196
  limit: params.limit,
173
- offset: params.offset
174
- }) : { workflows: workflowService.searchWorkflows({ tags: params.tags, limit: params.limit, offset: params.offset }), available_tags: [], total: 0 };
197
+ offset: effectiveOffset
198
+ }) : {
199
+ workflows: workflowService.searchWorkflows({
200
+ tags: params.tags,
201
+ limit: params.limit,
202
+ offset: effectiveOffset
203
+ }),
204
+ available_tags: [],
205
+ total: workflowService.searchWorkflows({
206
+ tags: params.tags
207
+ }).length
208
+ };
175
209
  return {
176
210
  success: true,
177
- output: JSON.stringify({
178
- workflows: result2.workflows.map((w) => ({
179
- name: w.name,
180
- version: w.version,
181
- description: w.description,
182
- tags: w.tags,
183
- created_at: w.createdAt
184
- })),
185
- available_tags: result2.available_tags,
186
- total: result2.total,
187
- count: result2.workflows.length,
188
- limit: params.limit,
189
- offset: params.offset
190
- }, null, 2),
211
+ output: JSON.stringify(buildListToolOutput(result2, params), null, 2),
191
212
  metadata: { execution_time_ms: 0 }
192
213
  };
193
214
  }
194
215
  const result = workflowService.listWorkflowsWithTags ? await workflowService.listWorkflowsWithTags(options) : {
195
216
  workflows: workflowService.listWorkflows(options),
196
217
  available_tags: [],
197
- total: 0
218
+ total: workflowService.listWorkflows({
219
+ tag: options.tag,
220
+ search: options.search
221
+ }).length
198
222
  };
199
223
  return {
200
224
  success: true,
201
- output: JSON.stringify({
202
- workflows: result.workflows.map((w) => ({
203
- name: w.name,
204
- version: w.version,
205
- description: w.description,
206
- tags: w.tags,
207
- created_at: w.createdAt
208
- })),
209
- available_tags: result.available_tags,
210
- total: result.total,
211
- count: result.workflows.length,
212
- limit: params.limit,
213
- offset: params.offset
214
- }, null, 2),
225
+ output: JSON.stringify(buildListToolOutput(result, params), null, 2),
215
226
  metadata: { execution_time_ms: 0 }
216
227
  };
217
228
  } catch (error) {
@@ -20,7 +20,7 @@ import {
20
20
  listTasksTool,
21
21
  searchTasksTool,
22
22
  updateTaskTool
23
- } from "./roy-agent-core-7nh5h9fn.js";
23
+ } from "./roy-agent-core-h5867smx.js";
24
24
  import {
25
25
  createOperationTool,
26
26
  deleteOperationTool,
@@ -358,12 +358,11 @@ class TaskComponent extends BaseComponent {
358
358
  }
359
359
  async createTask(options) {
360
360
  const sessionId = options.sessionId;
361
- if (options.parent_task_id === undefined || options.parent_task_id === null) {
362
- throw new Error("parent_task_id is required. All tasks must be attached to a parent task. " + "Use task_list(depth=0) to find root tasks, or create a parent task first.");
363
- }
364
- const parentTask = await this.store.getTask(options.parent_task_id);
365
- if (!parentTask) {
366
- throw new Error(`Parent task #${options.parent_task_id} not found. ` + "Please provide a valid parent_task_id. Use task_list(depth=0) to see all root tasks.");
361
+ if (options.parent_task_id !== undefined && options.parent_task_id !== null) {
362
+ const parentTask = await this.store.getTask(options.parent_task_id);
363
+ if (!parentTask) {
364
+ throw new Error(`Parent task #${options.parent_task_id} not found. ` + "Please provide a valid parent_task_id. Use task_list(depth=0) to see all root tasks.");
365
+ }
367
366
  }
368
367
  const createCtx = {
369
368
  options: { ...options },
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowEngine,
7
7
  exports_engine,
8
8
  init_engine
9
- } from "./roy-agent-core-gttz2jpm.js";
9
+ } from "./roy-agent-core-9y09xfav.js";
10
10
  import {
11
11
  askUserTool,
12
12
  createRunWorkflowTool,
@@ -17,7 +17,7 @@ import {
17
17
  createWorkflowRunStopTool,
18
18
  createWorkflowSearchTool,
19
19
  createWorkflowTagListTool
20
- } from "./roy-agent-core-r5axf0ad.js";
20
+ } from "./roy-agent-core-0y64qaac.js";
21
21
  import {
22
22
  WorkflowService
23
23
  } from "./roy-agent-core-tq9528d3.js";
@@ -19,7 +19,7 @@ import {
19
19
  init_skill_node,
20
20
  init_tool_node,
21
21
  init_workflow_node
22
- } from "./roy-agent-core-j754zgb4.js";
22
+ } from "./roy-agent-core-hc20420t.js";
23
23
  import {
24
24
  WorkflowError,
25
25
  createWorkflowEvent,
@@ -1856,7 +1856,15 @@ var init_engine = __esm(() => {
1856
1856
  }
1857
1857
  const { stripEphemeralResumeInput } = await import("./roy-agent-core-2vhsccvz.js");
1858
1858
  const { workflowInput: runtimeInput } = stripEphemeralResumeInput(rawRuntimeInput);
1859
- const mergedWorkflowInput = { ...persistedInput, ...runtimeInput };
1859
+ const defaultsFromSchema = {};
1860
+ if (definition.inputs) {
1861
+ for (const [key, param] of Object.entries(definition.inputs)) {
1862
+ if (param.default !== undefined) {
1863
+ defaultsFromSchema[key] = param.default;
1864
+ }
1865
+ }
1866
+ }
1867
+ const mergedWorkflowInput = { ...defaultsFromSchema, ...persistedInput, ...runtimeInput };
1860
1868
  const workflowInput = Object.keys(mergedWorkflowInput).length > 0 ? mergedWorkflowInput : undefined;
1861
1869
  const config = {
1862
1870
  parallelLimit,
@@ -18,15 +18,13 @@ var CreateTaskToolSchema = z.object({
18
18
  due_date: z.string().optional().describe("Due date (ISO format)"),
19
19
  tags: z.array(z.string()).optional().describe("Task tags (for search, stored in task.tags JSON field)"),
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
- parent_task_id: z.number().describe(`父任务 ID(必填)。所有新任务都必须挂载到某个父任务下,以维护良好的任务树结构。
22
- ` + `为什么 parent_task_id 是必填的:
23
- ` + ` 1. 任务聚类:将相关任务聚合到同一父任务下,便于管理和追踪
24
- ` + ` 2. 维护任务树:保持根任务数量可控(≤10个),深度适中(≤5层)
21
+ parent_task_id: z.union([z.number(), z.null()]).optional().describe(`父任务 ID(可选)。不传或传 null 时,创建根任务(root task)。
22
+ ` + `如需将任务挂载到某个父任务下,传入对应父任务 ID。
25
23
  ` + `如何选择合适的父任务:
26
24
  ` + ` 1. 使用 task_list(depth=0) 查看当前所有根任务
27
25
  ` + ` 2. 使用 task_search 搜索与当前任务相关的父任务
28
26
  ` + ` 3. 按主题归类:将相似主题的任务挂载到同一个父任务下
29
- ` + "如果确实找不到合适的父任务,可以先创建一个合适的父任务,再创建子任务。"),
27
+ ` + "如果确实找不到合适的父任务,可以直接创建根任务(不传 parent_task_id)。"),
30
28
  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!")
31
29
  });
32
30
  var GetTaskToolSchema = z.object({
@@ -124,32 +122,28 @@ function createTaskTool(taskComponent) {
124
122
 
125
123
  **DO NOT leave this as plain text** - it must be valid JSON!
126
124
 
127
- ## ⚠️ parent_task_id is REQUIRED
125
+ ## parent_task_id is OPTIONAL
128
126
 
129
- All new tasks MUST have a parent_task_id. This is critical for:
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\`).
130
129
 
131
- 1. **Task Tree Structure**: Every task must be attached to a parent,
132
- maintaining a clean hierarchy (根任务 ≤10, 深度 ≤5).
133
-
134
- 2. **Task Clustering**: Related tasks are grouped under the same parent,
135
- making it easy to track progress and find related work.
136
-
137
- **How to choose a parent task:**
130
+ To create a child task, provide an existing parent's \`parent_task_id\`. Best practices:
138
131
 
139
132
  1. First, use \`task_list(depth=0)\` to see all root tasks (top-level tasks).
140
133
  2. Use \`task_search\` with relevant keywords to find existing tasks
141
134
  that could serve as the parent.
142
135
  3. Group by topic: put similar tasks under the same parent.
143
- 4. If no suitable parent exists, create a parent task first,
144
- then create the child task with that parent_task_id.
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.
145
138
 
146
- **Example:**
147
- - First: task_list(depth=0) find an appropriate root task for your project
148
- (e.g. one whose title matches your project name). Use the returned root task's
149
- id as \`parent_task_id\` — do NOT hardcode a specific id; the root task id varies
150
- across deployments and resets.
151
- - Then: task_create(title="New feature", parent_task_id=<root_task_id>, ...)
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>, ...)\`
152
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)
153
147
  `,
154
148
  parameters: CreateTaskToolSchema,
155
149
  execute: async (args, ctx) => {
@@ -248,7 +242,10 @@ function listTasksTool(taskComponent) {
248
242
  return {
249
243
  name: "task_list",
250
244
  description: "List tasks with optional filters for status, priority, type, parent_task_id, " + "and depth (hierarchy level). " + `depth: 0=只根任务(无父任务),1=根+一层子任务,2=根+二层子任务,-1 或忽略=全部。
251
- ` + "Returns { tasks, total, limit, offset } where total is the count of all " + "matching tasks BEFORE pagination.",
245
+ ` + `Returns { total, count, truncated, limit, offset, depth, tasks } where:
246
+ ` + ` - total: count of all matching tasks BEFORE pagination
247
+ ` + " - count: count of tasks in the returned `tasks` array (after pagination)\n" + ` - truncated: true when total > count (data was truncated by pagination)
248
+ ` + "Note: `total` is the FIRST field in the response so it survives tail-truncation " + "by ToolComponent.truncateOutput.",
252
249
  parameters: ListTasksToolSchema,
253
250
  execute: async (args, ctx) => {
254
251
  const params = ListTasksToolSchema.parse(args);
@@ -265,12 +262,13 @@ function listTasksTool(taskComponent) {
265
262
  return {
266
263
  success: true,
267
264
  output: JSON.stringify({
268
- tasks: result.tasks,
269
265
  total: result.total,
270
266
  count: result.tasks.length,
267
+ truncated: result.total > result.tasks.length,
271
268
  limit: params.limit,
272
269
  offset: params.offset,
273
- depth: params.depth
270
+ depth: params.depth,
271
+ tasks: result.tasks
274
272
  }),
275
273
  metadata: { execution_time_ms: 0 }
276
274
  };
@@ -66,7 +66,7 @@ var init_tool_node = __esm(() => {
66
66
  }
67
67
  if (toolName === "bash" && typeof input.command === "string") {
68
68
  const trimmed = input.command.replace(/\n+$/, "");
69
- const echoMatch = trimmed.match(/^echo\s+"([\s\S]*)"\s*$/);
69
+ const echoMatch = trimmed.match(/^echo\s+"([^\n\r]*)"\s*$/);
70
70
  if (echoMatch) {
71
71
  let inner = echoMatch[1];
72
72
  inner = inner.replace(/\\/g, "\\\\");
@@ -1,3 +1,7 @@
1
+ import {
2
+ init_decorator,
3
+ wrapFunction
4
+ } from "./roy-agent-core-k05v31rc.js";
1
5
  import {
2
6
  exports_tracer_provider,
3
7
  init_propagation,
@@ -10,6 +14,7 @@ import {
10
14
 
11
15
  // src/env/tool/built-in/bash.ts
12
16
  init_propagation();
17
+ init_decorator();
13
18
  import { z } from "zod";
14
19
  import { Effect as Effect2 } from "effect";
15
20
 
@@ -188,7 +193,7 @@ var bashTool = {
188
193
  tags: ["shell", "command", "terminal", "exec"],
189
194
  version: "2.0.0"
190
195
  },
191
- execute: async (args, ctx) => {
196
+ execute: wrapFunction(async (args, ctx) => {
192
197
  const startTime = Date.now();
193
198
  const { command, workdir, timeout = 60000, env } = args;
194
199
  const currentSpanCtx = getCurrentSpanContext();
@@ -293,7 +298,7 @@ var bashTool = {
293
298
  }
294
299
  };
295
300
  }
296
- }
301
+ }, "tool.bash.execute", { recordParams: true, recordResult: true })
297
302
  };
298
303
 
299
304
  // src/env/tool/built-in/echo.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.86",
3
+ "version": "1.5.88",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",