@ai-setting/roy-agent-core 1.5.59 → 1.5.60
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 +3 -3
- package/dist/env/prompt/index.js +1 -1
- package/dist/env/task/index.js +3 -3
- package/dist/env/task/storage/index.js +1 -1
- package/dist/env/task/tools/index.js +8 -2
- package/dist/index.js +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-e1704378.js → roy-agent-core-3s9va046.js} +198 -8
- package/dist/shared/@ai-setting/{roy-agent-core-q16bh5e9.js → roy-agent-core-8am1xdvb.js} +21 -7
- package/dist/shared/@ai-setting/{roy-agent-core-w4f871e2.js → roy-agent-core-cgq7btak.js} +233 -34
- package/dist/shared/@ai-setting/{roy-agent-core-1pfxbpp2.js → roy-agent-core-wqzkxab9.js} +18 -3
- package/package.json +1 -1
package/dist/env/index.js
CHANGED
|
@@ -43,17 +43,17 @@ import"../shared/@ai-setting/roy-agent-core-nd3amf4x.js";
|
|
|
43
43
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
44
44
|
import {
|
|
45
45
|
TaskComponent
|
|
46
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
46
|
+
} from "../shared/@ai-setting/roy-agent-core-wqzkxab9.js";
|
|
47
47
|
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
48
48
|
import"../shared/@ai-setting/roy-agent-core-dkevkmas.js";
|
|
49
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
49
|
+
import"../shared/@ai-setting/roy-agent-core-cgq7btak.js";
|
|
50
50
|
import"../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
|
|
51
51
|
import {
|
|
52
52
|
XDG_PATHS,
|
|
53
53
|
getXDGPath,
|
|
54
54
|
getXDGPaths
|
|
55
55
|
} from "../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
56
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
56
|
+
import"../shared/@ai-setting/roy-agent-core-3s9va046.js";
|
|
57
57
|
import"../shared/@ai-setting/roy-agent-core-t94ktchq.js";
|
|
58
58
|
import"../shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
59
59
|
import {
|
package/dist/env/prompt/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
PromptConfigSchema,
|
|
4
4
|
PromptPathSchema,
|
|
5
5
|
PromptRenderer
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-8am1xdvb.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
|
package/dist/env/task/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
TaskPriorityEnum,
|
|
6
6
|
TaskStatusEnum,
|
|
7
7
|
TaskTypeEnum
|
|
8
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../shared/@ai-setting/roy-agent-core-wqzkxab9.js";
|
|
9
9
|
import {
|
|
10
10
|
TaskEntityEventTypes
|
|
11
11
|
} from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
@@ -13,10 +13,10 @@ import"../../shared/@ai-setting/roy-agent-core-dkevkmas.js";
|
|
|
13
13
|
import {
|
|
14
14
|
SQLiteTaskStore,
|
|
15
15
|
getDefaultTaskDbPath
|
|
16
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
16
|
+
} from "../../shared/@ai-setting/roy-agent-core-cgq7btak.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
19
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
19
|
+
import"../../shared/@ai-setting/roy-agent-core-3s9va046.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";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
SQLiteTaskStore,
|
|
3
3
|
getDefaultDataDir,
|
|
4
4
|
getDefaultTaskDbPath
|
|
5
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
5
|
+
} from "../../../shared/@ai-setting/roy-agent-core-cgq7btak.js";
|
|
6
6
|
import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
|
|
7
7
|
import"../../../shared/@ai-setting/roy-agent-core-7z9b1fm8.js";
|
|
8
8
|
import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
batchArchiveTaskTool,
|
|
3
|
+
batchDeleteTaskTool,
|
|
2
4
|
completeTaskTool,
|
|
3
5
|
createTaskTool,
|
|
4
6
|
deleteTaskTool,
|
|
5
7
|
getTaskTool,
|
|
6
8
|
listTasksTool,
|
|
9
|
+
searchTasksTool,
|
|
7
10
|
updateTaskTool
|
|
8
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
} from "../../../shared/@ai-setting/roy-agent-core-3s9va046.js";
|
|
9
12
|
import"../../../shared/@ai-setting/roy-agent-core-y5d04fm3.js";
|
|
10
13
|
import"../../../shared/@ai-setting/roy-agent-core-k05v31rc.js";
|
|
11
14
|
import"../../../shared/@ai-setting/roy-agent-core-shme7set.js";
|
|
@@ -14,9 +17,12 @@ import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
|
|
|
14
17
|
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
15
18
|
export {
|
|
16
19
|
updateTaskTool,
|
|
20
|
+
searchTasksTool,
|
|
17
21
|
listTasksTool,
|
|
18
22
|
getTaskTool,
|
|
19
23
|
deleteTaskTool,
|
|
20
24
|
createTaskTool,
|
|
21
|
-
completeTaskTool
|
|
25
|
+
completeTaskTool,
|
|
26
|
+
batchDeleteTaskTool,
|
|
27
|
+
batchArchiveTaskTool
|
|
22
28
|
};
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
PromptStore,
|
|
4
4
|
getBuiltInPrompt,
|
|
5
5
|
getBuiltInPromptNames
|
|
6
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "./shared/@ai-setting/roy-agent-core-8am1xdvb.js";
|
|
7
7
|
import {
|
|
8
8
|
LLMComponent,
|
|
9
9
|
LLMConfigSchema,
|
|
@@ -127,13 +127,13 @@ import {
|
|
|
127
127
|
} from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
128
128
|
import {
|
|
129
129
|
TaskComponent
|
|
130
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
130
|
+
} from "./shared/@ai-setting/roy-agent-core-wqzkxab9.js";
|
|
131
131
|
import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
132
132
|
import"./shared/@ai-setting/roy-agent-core-dkevkmas.js";
|
|
133
133
|
import {
|
|
134
134
|
SQLiteTaskStore,
|
|
135
135
|
getDefaultTaskDbPath
|
|
136
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
136
|
+
} from "./shared/@ai-setting/roy-agent-core-cgq7btak.js";
|
|
137
137
|
import {
|
|
138
138
|
AgentRegistry
|
|
139
139
|
} from "./shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
|
|
@@ -142,7 +142,7 @@ import {
|
|
|
142
142
|
getXDGPath,
|
|
143
143
|
getXDGPaths
|
|
144
144
|
} from "./shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
145
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
145
|
+
import"./shared/@ai-setting/roy-agent-core-3s9va046.js";
|
|
146
146
|
import"./shared/@ai-setting/roy-agent-core-t94ktchq.js";
|
|
147
147
|
import {
|
|
148
148
|
TaskHookPoints
|
|
@@ -18,6 +18,7 @@ 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().optional().describe("父任务 ID(可选,用于构建任务树)"),
|
|
21
22
|
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!")
|
|
22
23
|
});
|
|
23
24
|
var GetTaskToolSchema = z.object({
|
|
@@ -25,17 +26,30 @@ var GetTaskToolSchema = z.object({
|
|
|
25
26
|
include_operations: z.boolean().optional().default(false).describe("Include operation records")
|
|
26
27
|
});
|
|
27
28
|
var ListTasksToolSchema = z.object({
|
|
28
|
-
status: z.enum(["todo", "active", "completed", "paused", "cancelled"]).optional(),
|
|
29
|
+
status: z.enum(["todo", "active", "completed", "paused", "cancelled", "archived"]).optional(),
|
|
29
30
|
priority: z.enum(["low", "medium", "high"]).optional(),
|
|
30
31
|
type: z.enum(["normal", "cycle", "longterm"]).optional().describe("Filter by task type"),
|
|
31
32
|
limit: z.number().optional().default(20),
|
|
32
|
-
offset: z.number().optional().default(0)
|
|
33
|
+
offset: z.number().optional().default(0),
|
|
34
|
+
depth: z.number().optional().describe("检索层级深度:0=只根任务(无父任务),1=根+一层子任务,2=根+二层子任务,-1 或忽略=全部"),
|
|
35
|
+
include_archived: z.boolean().optional().default(false).describe("是否包含已归档任务(status=archived 的任务默认被排除)")
|
|
36
|
+
});
|
|
37
|
+
var SearchTasksToolSchema = z.object({
|
|
38
|
+
keywords: z.array(z.string()).describe("关键词列表(AND 逻辑,匹配 title/description/goals/tags/operations)"),
|
|
39
|
+
limit: z.number().optional().default(20).describe("返回数量"),
|
|
40
|
+
offset: z.number().optional().default(0).describe("偏移量"),
|
|
41
|
+
status: z.enum(["todo", "active", "completed", "paused", "cancelled", "archived"]).optional().describe("按状态筛选"),
|
|
42
|
+
priority: z.enum(["low", "medium", "high"]).optional().describe("按优先级筛选"),
|
|
43
|
+
type: z.enum(["normal", "cycle", "longterm"]).optional().describe("按类型筛选"),
|
|
44
|
+
exclude_task_id: z.number().optional().describe("排除的 task ID"),
|
|
45
|
+
depth: z.number().optional().describe("检索层级深度:0=只根任务,1=根+一层子任务,2=根+二层子任务,-1 或忽略=全部"),
|
|
46
|
+
include_archived: z.boolean().optional().default(false).describe("是否包含已归档任务(status=archived 的任务默认被排除)")
|
|
33
47
|
});
|
|
34
48
|
var UpdateTaskToolSchema = z.object({
|
|
35
49
|
task_id: z.number().describe("Task ID"),
|
|
36
50
|
title: z.string().optional(),
|
|
37
51
|
description: z.string().optional(),
|
|
38
|
-
status: z.enum(["todo", "active", "completed", "paused", "cancelled"]).optional(),
|
|
52
|
+
status: z.enum(["todo", "active", "completed", "paused", "cancelled", "archived"]).optional(),
|
|
39
53
|
priority: z.enum(["low", "medium", "high"]).optional(),
|
|
40
54
|
type: z.enum(["normal", "cycle", "longterm"]).optional().describe("Task type"),
|
|
41
55
|
progress: z.number().min(0).max(100).optional(),
|
|
@@ -49,6 +63,13 @@ var UpdateTaskToolSchema = z.object({
|
|
|
49
63
|
var DeleteTaskToolSchema = z.object({
|
|
50
64
|
task_id: z.number().describe("Task ID")
|
|
51
65
|
});
|
|
66
|
+
var BatchArchiveToolSchema = z.object({
|
|
67
|
+
task_ids: z.array(z.number()).describe("要归档的任务 ID 列表"),
|
|
68
|
+
reason: z.string().optional().describe("归档原因(可选,会写入每个任务的 operation 记录)")
|
|
69
|
+
});
|
|
70
|
+
var BatchDeleteToolSchema = z.object({
|
|
71
|
+
task_ids: z.array(z.number()).describe("要删除的任务 ID 列表")
|
|
72
|
+
});
|
|
52
73
|
|
|
53
74
|
// src/env/task/tools/create-tool.ts
|
|
54
75
|
init_env_context();
|
|
@@ -100,6 +121,7 @@ function createTaskTool(taskComponent) {
|
|
|
100
121
|
const sessionId = ctx.session_id || "unknown";
|
|
101
122
|
try {
|
|
102
123
|
const task = await taskComponent.createTask({
|
|
124
|
+
parent_task_id: params.parent_task_id,
|
|
103
125
|
title: params.title,
|
|
104
126
|
description: params.description,
|
|
105
127
|
priority: params.priority,
|
|
@@ -189,21 +211,31 @@ function getTaskTool(taskComponent) {
|
|
|
189
211
|
function listTasksTool(taskComponent) {
|
|
190
212
|
return {
|
|
191
213
|
name: "task_list",
|
|
192
|
-
description: "List tasks with optional filters for status, priority, and
|
|
214
|
+
description: "List tasks with optional filters for status, priority, type, parent_task_id, " + "and depth (hierarchy level). " + `depth: 0=只根任务(无父任务),1=根+一层子任务,2=根+二层子任务,-1 或忽略=全部。
|
|
215
|
+
` + "Returns { tasks, total, limit, offset } where total is the count of all " + "matching tasks BEFORE pagination.",
|
|
193
216
|
parameters: ListTasksToolSchema,
|
|
194
217
|
execute: async (args, ctx) => {
|
|
195
218
|
const params = ListTasksToolSchema.parse(args);
|
|
196
219
|
try {
|
|
197
|
-
const
|
|
220
|
+
const result = await taskComponent.listTasks({
|
|
198
221
|
status: params.status,
|
|
199
222
|
priority: params.priority,
|
|
200
223
|
type: params.type,
|
|
201
224
|
limit: params.limit,
|
|
202
|
-
offset: params.offset
|
|
225
|
+
offset: params.offset,
|
|
226
|
+
depth: params.depth,
|
|
227
|
+
include_archived: params.include_archived
|
|
203
228
|
});
|
|
204
229
|
return {
|
|
205
230
|
success: true,
|
|
206
|
-
output: JSON.stringify({
|
|
231
|
+
output: JSON.stringify({
|
|
232
|
+
tasks: result.tasks,
|
|
233
|
+
total: result.total,
|
|
234
|
+
count: result.tasks.length,
|
|
235
|
+
limit: params.limit,
|
|
236
|
+
offset: params.offset,
|
|
237
|
+
depth: params.depth
|
|
238
|
+
}),
|
|
207
239
|
metadata: { execution_time_ms: 0 }
|
|
208
240
|
};
|
|
209
241
|
} catch (error) {
|
|
@@ -217,6 +249,164 @@ function listTasksTool(taskComponent) {
|
|
|
217
249
|
}
|
|
218
250
|
};
|
|
219
251
|
}
|
|
252
|
+
// src/env/task/tools/search-tool.ts
|
|
253
|
+
function searchTasksTool(taskComponent) {
|
|
254
|
+
return {
|
|
255
|
+
name: "task_search",
|
|
256
|
+
description: "Search tasks by keywords across title, description, goals, tags, and " + "operation records. Use this when you need to find tasks related to a " + "topic, feature, bug, or area of work — even when the keyword is only " + `in description / goals / tags / past operation logs.
|
|
257
|
+
|
|
258
|
+
` + `Returns { tasks, total, limit, offset } so you can paginate large result sets.
|
|
259
|
+
|
|
260
|
+
` + "If `keywords` is empty, returns no results.",
|
|
261
|
+
parameters: SearchTasksToolSchema,
|
|
262
|
+
execute: async (args, ctx) => {
|
|
263
|
+
const params = SearchTasksToolSchema.parse(args);
|
|
264
|
+
try {
|
|
265
|
+
const result = await taskComponent.searchTasksByKeywords(params.keywords, {
|
|
266
|
+
limit: params.limit,
|
|
267
|
+
offset: params.offset,
|
|
268
|
+
excludeTaskId: params.exclude_task_id,
|
|
269
|
+
status: params.status,
|
|
270
|
+
priority: params.priority,
|
|
271
|
+
type: params.type,
|
|
272
|
+
depth: params.depth,
|
|
273
|
+
include_archived: params.include_archived
|
|
274
|
+
});
|
|
275
|
+
return {
|
|
276
|
+
success: true,
|
|
277
|
+
output: JSON.stringify({
|
|
278
|
+
tasks: result.tasks,
|
|
279
|
+
total: result.total,
|
|
280
|
+
limit: params.limit,
|
|
281
|
+
offset: params.offset
|
|
282
|
+
}),
|
|
283
|
+
metadata: { execution_time_ms: 0 }
|
|
284
|
+
};
|
|
285
|
+
} catch (error) {
|
|
286
|
+
return {
|
|
287
|
+
success: false,
|
|
288
|
+
output: "",
|
|
289
|
+
error: error instanceof Error ? error.message : String(error),
|
|
290
|
+
metadata: { execution_time_ms: 0 }
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
// src/env/task/tools/batch-archive-tool.ts
|
|
297
|
+
function batchArchiveTaskTool(taskComponent) {
|
|
298
|
+
return {
|
|
299
|
+
name: "task_batch_archive",
|
|
300
|
+
description: "Batch archive multiple tasks at once. Sets all specified tasks to " + `'archived' status and creates operation records for each.
|
|
301
|
+
|
|
302
|
+
` + "Use this when you need to quickly archive a group of completed, " + `obsolete, or historical tasks (e.g., during task organization).
|
|
303
|
+
|
|
304
|
+
` + "Returns summary of how many tasks were successfully archived " + "and any errors encountered.",
|
|
305
|
+
parameters: BatchArchiveToolSchema,
|
|
306
|
+
execute: async (args, ctx) => {
|
|
307
|
+
const params = BatchArchiveToolSchema.parse(args);
|
|
308
|
+
const taskIds = params.task_ids;
|
|
309
|
+
const sessionId = ctx.session_id || "batch-archive";
|
|
310
|
+
if (!taskIds || taskIds.length === 0) {
|
|
311
|
+
return {
|
|
312
|
+
success: true,
|
|
313
|
+
output: JSON.stringify({ archived_count: 0, errors: [] }),
|
|
314
|
+
metadata: { execution_time_ms: 0 }
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
const results = [];
|
|
318
|
+
let archivedCount = 0;
|
|
319
|
+
for (const taskId of taskIds) {
|
|
320
|
+
try {
|
|
321
|
+
const task = await taskComponent.updateTask(taskId, { status: "archived" });
|
|
322
|
+
if (task) {
|
|
323
|
+
await taskComponent.createOperation({
|
|
324
|
+
taskId,
|
|
325
|
+
sessionId,
|
|
326
|
+
actionType: "completed",
|
|
327
|
+
actionTitle: "Batch archived",
|
|
328
|
+
actionDescription: params.reason || "批量归档(任务整理)"
|
|
329
|
+
});
|
|
330
|
+
archivedCount++;
|
|
331
|
+
results.push({ id: taskId, success: true });
|
|
332
|
+
} else {
|
|
333
|
+
results.push({ id: taskId, success: false, error: "Task not found" });
|
|
334
|
+
}
|
|
335
|
+
} catch (error) {
|
|
336
|
+
results.push({
|
|
337
|
+
id: taskId,
|
|
338
|
+
success: false,
|
|
339
|
+
error: error instanceof Error ? error.message : String(error)
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const hasErrors = results.some((r) => !r.success);
|
|
344
|
+
return {
|
|
345
|
+
success: !hasErrors,
|
|
346
|
+
output: JSON.stringify({
|
|
347
|
+
archived_count: archivedCount,
|
|
348
|
+
total: taskIds.length,
|
|
349
|
+
errors: results.filter((r) => !r.success).map((r) => ({ id: r.id, error: r.error })),
|
|
350
|
+
results
|
|
351
|
+
}, null, 2),
|
|
352
|
+
metadata: { execution_time_ms: 0 }
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
// src/env/task/tools/batch-delete-tool.ts
|
|
358
|
+
function batchDeleteTaskTool(taskComponent) {
|
|
359
|
+
return {
|
|
360
|
+
name: "task_batch_delete",
|
|
361
|
+
description: "Batch delete multiple tasks at once. Deletes each task and all its " + `operation records.
|
|
362
|
+
|
|
363
|
+
` + "Use this when you need to quickly remove a group of test, temporary, " + `or otherwise worthless tasks (e.g., during task organization).
|
|
364
|
+
|
|
365
|
+
` + "Returns summary of how many tasks were successfully deleted " + "and any errors encountered.",
|
|
366
|
+
parameters: BatchDeleteToolSchema,
|
|
367
|
+
execute: async (args, ctx) => {
|
|
368
|
+
const params = BatchDeleteToolSchema.parse(args);
|
|
369
|
+
const taskIds = params.task_ids;
|
|
370
|
+
if (!taskIds || taskIds.length === 0) {
|
|
371
|
+
return {
|
|
372
|
+
success: true,
|
|
373
|
+
output: JSON.stringify({ deleted_count: 0, errors: [] }),
|
|
374
|
+
metadata: { execution_time_ms: 0 }
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
const results = [];
|
|
378
|
+
let deletedCount = 0;
|
|
379
|
+
for (const taskId of taskIds) {
|
|
380
|
+
try {
|
|
381
|
+
const deleted = await taskComponent.deleteTask(taskId);
|
|
382
|
+
if (deleted) {
|
|
383
|
+
deletedCount++;
|
|
384
|
+
results.push({ id: taskId, success: true });
|
|
385
|
+
} else {
|
|
386
|
+
results.push({ id: taskId, success: false, error: "Task not found" });
|
|
387
|
+
}
|
|
388
|
+
} catch (error) {
|
|
389
|
+
results.push({
|
|
390
|
+
id: taskId,
|
|
391
|
+
success: false,
|
|
392
|
+
error: error instanceof Error ? error.message : String(error)
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
const hasErrors = results.some((r) => !r.success);
|
|
397
|
+
return {
|
|
398
|
+
success: !hasErrors,
|
|
399
|
+
output: JSON.stringify({
|
|
400
|
+
deleted_count: deletedCount,
|
|
401
|
+
total: taskIds.length,
|
|
402
|
+
errors: results.filter((r) => !r.success).map((r) => ({ id: r.id, error: r.error })),
|
|
403
|
+
results
|
|
404
|
+
}, null, 2),
|
|
405
|
+
metadata: { execution_time_ms: 0 }
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
}
|
|
220
410
|
// src/env/task/tools/update-tool.ts
|
|
221
411
|
init_env_context();
|
|
222
412
|
init_logger();
|
|
@@ -374,4 +564,4 @@ function completeTaskTool(taskComponent) {
|
|
|
374
564
|
}
|
|
375
565
|
};
|
|
376
566
|
}
|
|
377
|
-
export { createTaskTool, getTaskTool, listTasksTool, updateTaskTool, deleteTaskTool, completeTaskTool };
|
|
567
|
+
export { createTaskTool, getTaskTool, listTasksTool, searchTasksTool, batchArchiveTaskTool, batchDeleteTaskTool, updateTaskTool, deleteTaskTool, completeTaskTool };
|
|
@@ -105,16 +105,30 @@ var builtInPrompts = {
|
|
|
105
105
|
|
|
106
106
|
## 你的工具
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
你有一组任务查询工具和两个执行工具可用:
|
|
109
109
|
|
|
110
|
-
| 工具 | 描述 |
|
|
111
|
-
|
|
112
|
-
| \`
|
|
113
|
-
| \`
|
|
110
|
+
| 工具 | 类别 | 描述 |
|
|
111
|
+
|------|------|------|
|
|
112
|
+
| \`task_search\` | **查询** | 关键词搜索任务(匹配 title/description/goals/tags/operations),带分页和 relevance 排序 |
|
|
113
|
+
| \`task_get\` | **查询** | 获取单个任务详情(含 operations) |
|
|
114
|
+
| \`task_list\` | **查询** | 按 status/priority/type/depth 列出任务,支持分页 |
|
|
115
|
+
| \`task_operation_list\` | **查询** | 查看任务的操作记录 |
|
|
116
|
+
| \`delegate_task\` | **执行** | 委托复杂/多步骤任务给子智能体执行 |
|
|
117
|
+
| \`bash\` | **执行** | 仅用于执行一行简单的 shell 命令 |
|
|
114
118
|
|
|
115
|
-
###
|
|
119
|
+
### 查询工具(可直接使用)
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
以下任务查询工具 **不需要委托**,可以直接调用:
|
|
122
|
+
- \`task_search(keywords=["关键词"], limit=10)\` — 搜索相关任务
|
|
123
|
+
- \`task_get(task_id=123)\` — 查看任务详情
|
|
124
|
+
- \`task_list(status="active")\` — 列出任务
|
|
125
|
+
- \`task_operation_list(task_id=123)\` — 查看操作记录
|
|
126
|
+
|
|
127
|
+
> ✅ 用户询问任务状态、搜索已有任务、查看任务详情时,**直接使用查询工具**,无需委托。
|
|
128
|
+
|
|
129
|
+
### 执行工具使用规则
|
|
130
|
+
|
|
131
|
+
**\`delegate_task\`** — 这是你的**主要执行工具**。用于一切复杂、多步骤、需要读文件、运行命令、代码分析、搜索、实现功能等场景。**当不确定用哪个时,选 \`delegate_task\`。**
|
|
118
132
|
|
|
119
133
|
**\`bash\`** — **仅限**以下**一次性简单操作**:
|
|
120
134
|
- 调用一行 \`roy-agent\` 命令(如 \`bun packages/cli/dist/bin/roy-agent.js tasks list\`)
|
|
@@ -184,6 +184,7 @@ class SQLiteTaskStore {
|
|
|
184
184
|
)
|
|
185
185
|
`);
|
|
186
186
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_task_tag_relation_tag_id ON task_tag_relation(tag_id)");
|
|
187
|
+
this.db.run("CREATE INDEX IF NOT EXISTS idx_task_parent_task_id ON task(parent_task_id)");
|
|
187
188
|
if (this.dbPath !== ":memory:") {
|
|
188
189
|
try {
|
|
189
190
|
const { runMigration: runMigration001 } = (init_001_add_project_path_context(), __toCommonJS(exports_001_add_project_path_context));
|
|
@@ -308,24 +309,36 @@ class SQLiteTaskStore {
|
|
|
308
309
|
}
|
|
309
310
|
async listTasks(options) {
|
|
310
311
|
await this.initialize();
|
|
311
|
-
|
|
312
|
-
|
|
312
|
+
if (options?.depth !== undefined && options.depth >= 0 && options.parent_task_id === undefined) {
|
|
313
|
+
return this.listTasksByDepth(options);
|
|
314
|
+
}
|
|
315
|
+
const whereClauses = ["1=1"];
|
|
316
|
+
const whereParams = [];
|
|
313
317
|
if (options?.status) {
|
|
314
|
-
|
|
315
|
-
|
|
318
|
+
whereClauses.push("status = ?");
|
|
319
|
+
whereParams.push(options.status);
|
|
316
320
|
}
|
|
317
321
|
if (options?.priority) {
|
|
318
|
-
|
|
319
|
-
|
|
322
|
+
whereClauses.push("priority = ?");
|
|
323
|
+
whereParams.push(options.priority);
|
|
320
324
|
}
|
|
321
325
|
if (options?.type) {
|
|
322
|
-
|
|
323
|
-
|
|
326
|
+
whereClauses.push("type = ?");
|
|
327
|
+
whereParams.push(options.type);
|
|
324
328
|
}
|
|
325
329
|
if (options?.parent_task_id !== undefined) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
330
|
+
whereClauses.push("parent_task_id = ?");
|
|
331
|
+
whereParams.push(options.parent_task_id);
|
|
332
|
+
}
|
|
333
|
+
if (!options?.include_archived && options?.status !== "archived") {
|
|
334
|
+
whereClauses.push("status != 'archived'");
|
|
335
|
+
}
|
|
336
|
+
const whereSql = whereClauses.join(" AND ");
|
|
337
|
+
const countSql = `SELECT COUNT(*) as total FROM task WHERE ${whereSql}`;
|
|
338
|
+
const countRow = this.db.prepare(countSql).get(...whereParams);
|
|
339
|
+
const total = countRow?.total ?? 0;
|
|
340
|
+
let sql = `SELECT * FROM task WHERE ${whereSql}`;
|
|
341
|
+
const params = [...whereParams];
|
|
329
342
|
sql += " ORDER BY updated_at DESC";
|
|
330
343
|
if (options?.limit) {
|
|
331
344
|
sql += " LIMIT ?";
|
|
@@ -337,11 +350,96 @@ class SQLiteTaskStore {
|
|
|
337
350
|
}
|
|
338
351
|
const stmt = this.db.prepare(sql);
|
|
339
352
|
const rows = stmt.all(...params);
|
|
340
|
-
|
|
353
|
+
const tasks = rows.map((row) => {
|
|
341
354
|
const task = this.rowToTask(row);
|
|
342
355
|
this.tasksCache.set(task.id, task);
|
|
343
356
|
return task;
|
|
344
357
|
});
|
|
358
|
+
return { tasks, total };
|
|
359
|
+
}
|
|
360
|
+
async listTasksByDepth(options) {
|
|
361
|
+
const depth = options.depth ?? 0;
|
|
362
|
+
const filterClauses = ["1=1"];
|
|
363
|
+
const filterParams = [];
|
|
364
|
+
if (options.status) {
|
|
365
|
+
filterClauses.push("status = ?");
|
|
366
|
+
filterParams.push(options.status);
|
|
367
|
+
}
|
|
368
|
+
if (options.priority) {
|
|
369
|
+
filterClauses.push("priority = ?");
|
|
370
|
+
filterParams.push(options.priority);
|
|
371
|
+
}
|
|
372
|
+
if (options.type) {
|
|
373
|
+
filterClauses.push("type = ?");
|
|
374
|
+
filterParams.push(options.type);
|
|
375
|
+
}
|
|
376
|
+
if (!options?.include_archived && options?.status !== "archived") {
|
|
377
|
+
filterClauses.push("status != 'archived'");
|
|
378
|
+
}
|
|
379
|
+
const filterSql = filterClauses.join(" AND ");
|
|
380
|
+
const collected = [];
|
|
381
|
+
if (depth === 0) {
|
|
382
|
+
const rootSql = `SELECT * FROM task WHERE parent_task_id IS NULL AND ${filterSql} ORDER BY updated_at DESC`;
|
|
383
|
+
const rows = this.db.prepare(rootSql).all(...filterParams);
|
|
384
|
+
for (const row of rows) {
|
|
385
|
+
const t = this.rowToTask(row);
|
|
386
|
+
this.tasksCache.set(t.id, t);
|
|
387
|
+
collected.push(t);
|
|
388
|
+
}
|
|
389
|
+
} else {
|
|
390
|
+
const rootRows = this.db.prepare(`SELECT * FROM task WHERE parent_task_id IS NULL AND ${filterSql} ORDER BY updated_at DESC`).all(...filterParams);
|
|
391
|
+
let currentLevel = rootRows.map((row) => {
|
|
392
|
+
const t = this.rowToTask(row);
|
|
393
|
+
this.tasksCache.set(t.id, t);
|
|
394
|
+
return t;
|
|
395
|
+
});
|
|
396
|
+
collected.push(...currentLevel);
|
|
397
|
+
for (let level = 1;level <= depth; level++) {
|
|
398
|
+
if (currentLevel.length === 0)
|
|
399
|
+
break;
|
|
400
|
+
const ids = currentLevel.map((t) => t.id);
|
|
401
|
+
const placeholders = ids.map(() => "?").join(",");
|
|
402
|
+
const childSql = `SELECT * FROM task WHERE parent_task_id IN (${placeholders}) AND ${filterSql} ORDER BY updated_at DESC`;
|
|
403
|
+
const childRows = this.db.prepare(childSql).all(...ids, ...filterParams);
|
|
404
|
+
const nextLevel = childRows.map((row) => {
|
|
405
|
+
const t = this.rowToTask(row);
|
|
406
|
+
this.tasksCache.set(t.id, t);
|
|
407
|
+
return t;
|
|
408
|
+
});
|
|
409
|
+
collected.push(...nextLevel);
|
|
410
|
+
currentLevel = nextLevel;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const total = collected.length;
|
|
414
|
+
const offset = options.offset ?? 0;
|
|
415
|
+
const limit = options.limit ?? total;
|
|
416
|
+
const sliced = collected.slice(offset, offset + limit);
|
|
417
|
+
return { tasks: sliced, total };
|
|
418
|
+
}
|
|
419
|
+
async getTaskTree(taskId, depth = -1) {
|
|
420
|
+
await this.initialize();
|
|
421
|
+
const result = [];
|
|
422
|
+
let currentLevel = [taskId];
|
|
423
|
+
let currentDepth = 0;
|
|
424
|
+
while (currentLevel.length > 0) {
|
|
425
|
+
if (depth !== -1 && currentDepth >= depth)
|
|
426
|
+
break;
|
|
427
|
+
const placeholders = currentLevel.map(() => "?").join(",");
|
|
428
|
+
const rows = this.db.prepare(`SELECT * FROM task WHERE parent_task_id IN (${placeholders}) ORDER BY updated_at DESC`).all(...currentLevel);
|
|
429
|
+
const nextLevel = [];
|
|
430
|
+
for (const row of rows) {
|
|
431
|
+
const t = this.rowToTask(row);
|
|
432
|
+
this.tasksCache.set(t.id, t);
|
|
433
|
+
result.push(t);
|
|
434
|
+
nextLevel.push(t.id);
|
|
435
|
+
}
|
|
436
|
+
currentLevel = nextLevel;
|
|
437
|
+
currentDepth++;
|
|
438
|
+
}
|
|
439
|
+
return result;
|
|
440
|
+
}
|
|
441
|
+
async getChildTasks(taskId, options = {}) {
|
|
442
|
+
return this.listTasks({ ...options, parent_task_id: taskId });
|
|
345
443
|
}
|
|
346
444
|
async createOperation(options) {
|
|
347
445
|
await this.initialize();
|
|
@@ -599,9 +697,13 @@ class SQLiteTaskStore {
|
|
|
599
697
|
async searchTasksByKeywords(keywords, options = {}) {
|
|
600
698
|
await this.initialize();
|
|
601
699
|
if (!keywords || keywords.length === 0) {
|
|
602
|
-
return [];
|
|
700
|
+
return { tasks: [], total: 0 };
|
|
701
|
+
}
|
|
702
|
+
const { limit = 20, offset = 0, excludeTaskId, status, priority, type, depth } = options;
|
|
703
|
+
let allowedTaskIds = null;
|
|
704
|
+
if (depth !== undefined && depth >= 0) {
|
|
705
|
+
allowedTaskIds = await this.collectTaskIdsByDepth(depth);
|
|
603
706
|
}
|
|
604
|
-
const { limit = 20, excludeTaskId } = options;
|
|
605
707
|
const tasks = new Map;
|
|
606
708
|
let taskSql = "SELECT * FROM task WHERE 1=1";
|
|
607
709
|
const taskParams = [];
|
|
@@ -609,17 +711,37 @@ class SQLiteTaskStore {
|
|
|
609
711
|
taskSql += " AND id != ?";
|
|
610
712
|
taskParams.push(excludeTaskId);
|
|
611
713
|
}
|
|
714
|
+
if (status) {
|
|
715
|
+
taskSql += " AND status = ?";
|
|
716
|
+
taskParams.push(status);
|
|
717
|
+
}
|
|
718
|
+
if (priority) {
|
|
719
|
+
taskSql += " AND priority = ?";
|
|
720
|
+
taskParams.push(priority);
|
|
721
|
+
}
|
|
722
|
+
if (type) {
|
|
723
|
+
taskSql += " AND type = ?";
|
|
724
|
+
taskParams.push(type);
|
|
725
|
+
}
|
|
726
|
+
if (!options?.include_archived && options?.status !== "archived") {
|
|
727
|
+
taskSql += " AND status != 'archived'";
|
|
728
|
+
}
|
|
729
|
+
const scanLimit = Math.max(limit * 5, 200);
|
|
612
730
|
taskSql += " ORDER BY updated_at DESC LIMIT ?";
|
|
613
|
-
taskParams.push(
|
|
731
|
+
taskParams.push(scanLimit);
|
|
614
732
|
const taskRows = this.db.prepare(taskSql).all(...taskParams);
|
|
615
733
|
for (const row of taskRows) {
|
|
616
734
|
const task = this.rowToTask(row);
|
|
735
|
+
const matchedKeywords = new Set;
|
|
617
736
|
let matchCount = 0;
|
|
618
737
|
if (task.title) {
|
|
619
738
|
const lowerTitle = task.title.toLowerCase();
|
|
620
739
|
for (const keyword of keywords) {
|
|
621
740
|
if (lowerTitle.includes(keyword.toLowerCase())) {
|
|
622
|
-
|
|
741
|
+
{
|
|
742
|
+
matchCount++;
|
|
743
|
+
matchedKeywords.add(keyword);
|
|
744
|
+
}
|
|
623
745
|
}
|
|
624
746
|
}
|
|
625
747
|
}
|
|
@@ -627,7 +749,10 @@ class SQLiteTaskStore {
|
|
|
627
749
|
for (const keyword of keywords) {
|
|
628
750
|
const lowerKeyword = keyword.toLowerCase();
|
|
629
751
|
if (task.tags.some((tag) => tag.toLowerCase().includes(lowerKeyword))) {
|
|
630
|
-
|
|
752
|
+
{
|
|
753
|
+
matchCount += 2;
|
|
754
|
+
matchedKeywords.add(keyword);
|
|
755
|
+
}
|
|
631
756
|
}
|
|
632
757
|
}
|
|
633
758
|
}
|
|
@@ -635,7 +760,10 @@ class SQLiteTaskStore {
|
|
|
635
760
|
const lowerDesc = task.description.toLowerCase();
|
|
636
761
|
for (const keyword of keywords) {
|
|
637
762
|
if (lowerDesc.includes(keyword.toLowerCase())) {
|
|
638
|
-
|
|
763
|
+
{
|
|
764
|
+
matchCount++;
|
|
765
|
+
matchedKeywords.add(keyword);
|
|
766
|
+
}
|
|
639
767
|
}
|
|
640
768
|
}
|
|
641
769
|
}
|
|
@@ -643,11 +771,14 @@ class SQLiteTaskStore {
|
|
|
643
771
|
const lowerGoals = task.goals_and_expected_deliverables.toLowerCase();
|
|
644
772
|
for (const keyword of keywords) {
|
|
645
773
|
if (lowerGoals.includes(keyword.toLowerCase())) {
|
|
646
|
-
|
|
774
|
+
{
|
|
775
|
+
matchCount++;
|
|
776
|
+
matchedKeywords.add(keyword);
|
|
777
|
+
}
|
|
647
778
|
}
|
|
648
779
|
}
|
|
649
780
|
}
|
|
650
|
-
if (
|
|
781
|
+
if (matchedKeywords.size === keywords.length) {
|
|
651
782
|
tasks.set(task.id, { task, matchCount });
|
|
652
783
|
}
|
|
653
784
|
}
|
|
@@ -659,31 +790,99 @@ class SQLiteTaskStore {
|
|
|
659
790
|
AND (action_title LIKE ? OR action_description LIKE ?)
|
|
660
791
|
LIMIT 10
|
|
661
792
|
`;
|
|
793
|
+
const opMatchedKeywords = new Set;
|
|
662
794
|
for (const keyword of keywords) {
|
|
663
795
|
const pattern = `%${keyword}%`;
|
|
664
796
|
const ops = this.db.prepare(opSql).all(opRow.task_id, pattern, pattern);
|
|
665
797
|
if (ops.length > 0) {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
798
|
+
opMatchedKeywords.add(keyword);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
if (opMatchedKeywords.size === 0)
|
|
802
|
+
continue;
|
|
803
|
+
const taskRow = this.db.prepare("SELECT * FROM task WHERE id = ?").get(opRow.task_id);
|
|
804
|
+
if (!taskRow)
|
|
805
|
+
continue;
|
|
806
|
+
const task = this.rowToTask(taskRow);
|
|
807
|
+
if (excludeTaskId && task.id === excludeTaskId)
|
|
808
|
+
continue;
|
|
809
|
+
if (status && task.status !== status)
|
|
810
|
+
continue;
|
|
811
|
+
if (priority && task.priority !== priority)
|
|
812
|
+
continue;
|
|
813
|
+
if (type && task.type !== type)
|
|
814
|
+
continue;
|
|
815
|
+
if (!options?.include_archived && task.status === "archived")
|
|
816
|
+
continue;
|
|
817
|
+
const existing = tasks.get(task.id);
|
|
818
|
+
if (existing) {
|
|
819
|
+
existing.matchCount += 2;
|
|
820
|
+
} else {
|
|
821
|
+
const combinedKeywords = new Set(opMatchedKeywords);
|
|
822
|
+
if (task.title) {
|
|
823
|
+
const lowerTitle = task.title.toLowerCase();
|
|
824
|
+
for (const kw of keywords) {
|
|
825
|
+
if (lowerTitle.includes(kw.toLowerCase()))
|
|
826
|
+
combinedKeywords.add(kw);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
if (task.description) {
|
|
830
|
+
const lowerDesc = task.description.toLowerCase();
|
|
831
|
+
for (const kw of keywords) {
|
|
832
|
+
if (lowerDesc.includes(kw.toLowerCase()))
|
|
833
|
+
combinedKeywords.add(kw);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
if (task.goals_and_expected_deliverables) {
|
|
837
|
+
const lowerGoals = task.goals_and_expected_deliverables.toLowerCase();
|
|
838
|
+
for (const kw of keywords) {
|
|
839
|
+
if (lowerGoals.includes(kw.toLowerCase()))
|
|
840
|
+
combinedKeywords.add(kw);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
if (task.tags && Array.isArray(task.tags)) {
|
|
844
|
+
for (const kw of keywords) {
|
|
845
|
+
if (task.tags.some((tag) => tag.toLowerCase().includes(kw.toLowerCase())))
|
|
846
|
+
combinedKeywords.add(kw);
|
|
677
847
|
}
|
|
678
848
|
}
|
|
849
|
+
if (combinedKeywords.size === keywords.length) {
|
|
850
|
+
tasks.set(task.id, { task, matchCount: 2 });
|
|
851
|
+
}
|
|
679
852
|
}
|
|
680
853
|
}
|
|
681
|
-
|
|
682
|
-
|
|
854
|
+
let sorted = Array.from(tasks.values()).sort((a, b) => b.matchCount - a.matchCount);
|
|
855
|
+
if (allowedTaskIds !== null) {
|
|
856
|
+
sorted = sorted.filter((item) => allowedTaskIds.has(item.task.id));
|
|
857
|
+
}
|
|
858
|
+
const total = sorted.length;
|
|
859
|
+
const sliced = sorted.slice(offset, offset + limit);
|
|
860
|
+
const resultTasks = sliced.map((item) => item.task);
|
|
861
|
+
return { tasks: resultTasks, total };
|
|
862
|
+
}
|
|
863
|
+
async collectTaskIdsByDepth(depth) {
|
|
864
|
+
const ids = new Set;
|
|
865
|
+
const rootRows = this.db.prepare("SELECT id FROM task WHERE parent_task_id IS NULL").all();
|
|
866
|
+
let currentLevel = rootRows.map((r) => r.id);
|
|
867
|
+
for (const id of currentLevel)
|
|
868
|
+
ids.add(id);
|
|
869
|
+
if (depth === 0)
|
|
870
|
+
return ids;
|
|
871
|
+
for (let level = 1;level <= depth; level++) {
|
|
872
|
+
if (currentLevel.length === 0)
|
|
873
|
+
break;
|
|
874
|
+
const placeholders = currentLevel.map(() => "?").join(",");
|
|
875
|
+
const rows = this.db.prepare(`SELECT id FROM task WHERE parent_task_id IN (${placeholders})`).all(...currentLevel);
|
|
876
|
+
currentLevel = rows.map((r) => r.id);
|
|
877
|
+
for (const id of currentLevel)
|
|
878
|
+
ids.add(id);
|
|
879
|
+
}
|
|
880
|
+
return ids;
|
|
683
881
|
}
|
|
684
882
|
async findSimilarTasksByKeywords(keywords, options = {}) {
|
|
685
883
|
const mergedOptions = { ...options, limit: options.limit ?? 5 };
|
|
686
|
-
|
|
884
|
+
const result = await this.searchTasksByKeywords(keywords, mergedOptions);
|
|
885
|
+
return result.tasks;
|
|
687
886
|
}
|
|
688
887
|
async findSimilarTasks(taskId, limit = 5) {
|
|
689
888
|
await this.initialize();
|
|
@@ -9,15 +9,18 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
SQLiteTaskStore,
|
|
11
11
|
getDefaultTaskDbPath
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-cgq7btak.js";
|
|
13
13
|
import {
|
|
14
|
+
batchArchiveTaskTool,
|
|
15
|
+
batchDeleteTaskTool,
|
|
14
16
|
completeTaskTool,
|
|
15
17
|
createTaskTool,
|
|
16
18
|
deleteTaskTool,
|
|
17
19
|
getTaskTool,
|
|
18
20
|
listTasksTool,
|
|
21
|
+
searchTasksTool,
|
|
19
22
|
updateTaskTool
|
|
20
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-3s9va046.js";
|
|
21
24
|
import {
|
|
22
25
|
createOperationTool,
|
|
23
26
|
deleteOperationTool,
|
|
@@ -320,6 +323,9 @@ class TaskComponent extends BaseComponent {
|
|
|
320
323
|
createTaskTool(this),
|
|
321
324
|
getTaskTool(this),
|
|
322
325
|
listTasksTool(this),
|
|
326
|
+
searchTasksTool(this),
|
|
327
|
+
batchArchiveTaskTool(this),
|
|
328
|
+
batchDeleteTaskTool(this),
|
|
323
329
|
updateTaskTool(this),
|
|
324
330
|
deleteTaskTool(this),
|
|
325
331
|
completeTaskTool(this)
|
|
@@ -421,6 +427,15 @@ class TaskComponent extends BaseComponent {
|
|
|
421
427
|
async listTasks(options) {
|
|
422
428
|
return this.store.listTasks(options);
|
|
423
429
|
}
|
|
430
|
+
async searchTasksByKeywords(keywords, options) {
|
|
431
|
+
return this.store.searchTasksByKeywords(keywords, options || {});
|
|
432
|
+
}
|
|
433
|
+
async getTaskTree(taskId, depth = -1) {
|
|
434
|
+
return this.store.getTaskTree(taskId, depth);
|
|
435
|
+
}
|
|
436
|
+
async getChildTasks(taskId, options) {
|
|
437
|
+
return this.store.getChildTasks(taskId, options);
|
|
438
|
+
}
|
|
424
439
|
async completeTask(id, sessionId) {
|
|
425
440
|
const existing = await this.store.getTask(id);
|
|
426
441
|
if (existing && existing.type === "cycle") {
|
|
@@ -514,7 +529,7 @@ __legacyDecorateClassTS([
|
|
|
514
529
|
], TaskComponent.prototype, "createOperation", null);
|
|
515
530
|
// src/env/task/types.ts
|
|
516
531
|
import { z } from "zod";
|
|
517
|
-
var TaskStatusEnum = z.enum(["todo", "active", "completed", "paused", "cancelled"]);
|
|
532
|
+
var TaskStatusEnum = z.enum(["todo", "active", "completed", "paused", "cancelled", "archived"]);
|
|
518
533
|
var TaskPriorityEnum = z.enum(["low", "medium", "high"]);
|
|
519
534
|
var TaskTypeEnum = z.enum(["normal", "cycle", "longterm"]);
|
|
520
535
|
var ActionTypeEnum = z.enum([
|