@ai-setting/roy-agent-core 1.5.87 → 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
@@ -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-r1adqgaa.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-9vwyj29a.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-r1adqgaa.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-9vwyj29a.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-9vwyj29a.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";
package/dist/index.js CHANGED
@@ -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-r1adqgaa.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-9vwyj29a.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
@@ -20,7 +20,7 @@ import {
20
20
  listTasksTool,
21
21
  searchTasksTool,
22
22
  updateTaskTool
23
- } from "./roy-agent-core-9vwyj29a.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 },
@@ -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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.87",
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",