@ai-setting/roy-agent-core 1.5.6 → 1.5.8
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.d.ts +21 -0
- package/dist/env/index.js +10 -9
- package/dist/env/llm/index.js +1 -1
- package/dist/env/task/delegate/index.d.ts +66 -76
- package/dist/env/task/delegate/index.js +4 -4
- package/dist/env/task/events/index.d.ts +171 -0
- package/dist/env/task/events/index.js +7 -0
- package/dist/env/task/hooks/index.d.ts +24 -7
- package/dist/env/task/index.d.ts +139 -1
- package/dist/env/task/index.js +8 -4
- package/dist/env/task/plugins/index.d.ts +4 -0
- package/dist/env/task/storage/index.d.ts +17 -0
- package/dist/env/task/storage/index.js +1 -1
- package/dist/env/task/tools/index.d.ts +21 -0
- package/dist/env/task/tools/index.js +1 -1
- package/dist/env/task/tools/operation/index.d.ts +21 -0
- package/dist/env/workflow/index.js +15 -15
- package/dist/index.d.ts +21 -0
- package/dist/index.js +14 -13
- package/dist/shared/@ai-setting/roy-agent-core-8gxth0eh.js +10 -0
- package/dist/shared/@ai-setting/{roy-agent-core-htwpckw9.js → roy-agent-core-bvr1761x.js} +17 -5
- package/dist/shared/@ai-setting/{roy-agent-core-n2cvdgd6.js → roy-agent-core-gwc4h96n.js} +28 -7
- package/dist/shared/@ai-setting/{roy-agent-core-z62zee1e.js → roy-agent-core-vf215qfv.js} +121 -97
- package/dist/shared/@ai-setting/{roy-agent-core-3xwneva0.js → roy-agent-core-vkz81f7v.js} +12 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dbsk841j.js → roy-agent-core-wa1kzqky.js} +47 -5
- package/package.json +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dc497hmk.js → roy-agent-core-rhmtwnw1.js} +5 -5
package/dist/env/index.d.ts
CHANGED
|
@@ -2116,6 +2116,10 @@ interface Task {
|
|
|
2116
2116
|
updatedAt: string;
|
|
2117
2117
|
due_date?: string;
|
|
2118
2118
|
tags?: string[];
|
|
2119
|
+
/** Project root path for task positioning */
|
|
2120
|
+
project_path: string;
|
|
2121
|
+
/** JSON string with time-space positioning info (worktree, branch, etc.) */
|
|
2122
|
+
context: string;
|
|
2119
2123
|
}
|
|
2120
2124
|
/**
|
|
2121
2125
|
* TaskOperation entity
|
|
@@ -2154,6 +2158,15 @@ interface CreateTaskOptions {
|
|
|
2154
2158
|
due_date?: string;
|
|
2155
2159
|
tags?: string[];
|
|
2156
2160
|
sessionId: string;
|
|
2161
|
+
/** Project root path for task positioning. Use 'unknown' if unknown. */
|
|
2162
|
+
project_path: string;
|
|
2163
|
+
/**
|
|
2164
|
+
* JSON string with time-space positioning info.
|
|
2165
|
+
* - For coding tasks: include worktree_path, branch, type
|
|
2166
|
+
* - For other tasks: use '{}' or '{"type":"unknown"}'
|
|
2167
|
+
* Must be a valid JSON string.
|
|
2168
|
+
*/
|
|
2169
|
+
context: string;
|
|
2157
2170
|
}
|
|
2158
2171
|
interface UpdateTaskOptions {
|
|
2159
2172
|
title?: string;
|
|
@@ -2165,6 +2178,10 @@ interface UpdateTaskOptions {
|
|
|
2165
2178
|
goals_and_expected_deliverables?: string;
|
|
2166
2179
|
due_date?: string;
|
|
2167
2180
|
tags?: string[];
|
|
2181
|
+
/** 项目路径,标识任务所属的项目 */
|
|
2182
|
+
project_path?: string;
|
|
2183
|
+
/** 任务上下文信息,用于存储额外上下文 */
|
|
2184
|
+
context?: string;
|
|
2168
2185
|
}
|
|
2169
2186
|
interface ListTasksOptions {
|
|
2170
2187
|
status?: TaskStatus;
|
|
@@ -2299,6 +2316,10 @@ declare class TaskComponent extends BaseComponent {
|
|
|
2299
2316
|
private configComponent?;
|
|
2300
2317
|
private tagService;
|
|
2301
2318
|
private plugins;
|
|
2319
|
+
/**
|
|
2320
|
+
* 发布 EnvEvent
|
|
2321
|
+
*/
|
|
2322
|
+
private publishEvent;
|
|
2302
2323
|
constructor();
|
|
2303
2324
|
/**
|
|
2304
2325
|
* Initialize the component
|
package/dist/env/index.js
CHANGED
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
} from "../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
14
14
|
import {
|
|
15
15
|
WorkflowComponent
|
|
16
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
16
|
+
} from "../shared/@ai-setting/roy-agent-core-rhmtwnw1.js";
|
|
17
17
|
import"../shared/@ai-setting/roy-agent-core-0rtxwr28.js";
|
|
18
|
-
import"../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
19
|
-
import"../shared/@ai-setting/roy-agent-core-0vbdz0x7.js";
|
|
20
|
-
import"../shared/@ai-setting/roy-agent-core-7fgf85wc.js";
|
|
21
|
-
import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
22
18
|
import"../shared/@ai-setting/roy-agent-core-wrcy0h6z.js";
|
|
23
19
|
import"../shared/@ai-setting/roy-agent-core-69jskqjg.js";
|
|
20
|
+
import"../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
24
21
|
import"../shared/@ai-setting/roy-agent-core-jvatggbb.js";
|
|
25
22
|
import"../shared/@ai-setting/roy-agent-core-5x94xmt6.js";
|
|
23
|
+
import"../shared/@ai-setting/roy-agent-core-0vbdz0x7.js";
|
|
24
|
+
import"../shared/@ai-setting/roy-agent-core-7fgf85wc.js";
|
|
25
|
+
import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
26
26
|
import {
|
|
27
27
|
AgentComponent,
|
|
28
28
|
AgentComponentConfigSchema
|
|
@@ -30,12 +30,13 @@ import {
|
|
|
30
30
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
31
31
|
import {
|
|
32
32
|
TaskComponent
|
|
33
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
34
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
35
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
33
|
+
} from "../shared/@ai-setting/roy-agent-core-gwc4h96n.js";
|
|
34
|
+
import"../shared/@ai-setting/roy-agent-core-vf215qfv.js";
|
|
35
|
+
import"../shared/@ai-setting/roy-agent-core-bvr1761x.js";
|
|
36
|
+
import"../shared/@ai-setting/roy-agent-core-wa1kzqky.js";
|
|
36
37
|
import"../shared/@ai-setting/roy-agent-core-t94ktchq.js";
|
|
37
|
-
import"../shared/@ai-setting/roy-agent-core-z62zee1e.js";
|
|
38
38
|
import"../shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
39
|
+
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
39
40
|
import {
|
|
40
41
|
McpComponent
|
|
41
42
|
} from "../shared/@ai-setting/roy-agent-core-pjr12nnd.js";
|
package/dist/env/llm/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
invoke,
|
|
13
13
|
invokeNonStream,
|
|
14
14
|
parseModelString
|
|
15
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
15
|
+
} from "../../shared/@ai-setting/roy-agent-core-vkz81f7v.js";
|
|
16
16
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-kkbwepqb.js";
|
|
@@ -1163,6 +1163,10 @@ interface Task {
|
|
|
1163
1163
|
updatedAt: string;
|
|
1164
1164
|
due_date?: string;
|
|
1165
1165
|
tags?: string[];
|
|
1166
|
+
/** Project root path for task positioning */
|
|
1167
|
+
project_path: string;
|
|
1168
|
+
/** JSON string with time-space positioning info (worktree, branch, etc.) */
|
|
1169
|
+
context: string;
|
|
1166
1170
|
}
|
|
1167
1171
|
/**
|
|
1168
1172
|
* TaskOperation entity
|
|
@@ -1199,6 +1203,15 @@ interface CreateTaskOptions {
|
|
|
1199
1203
|
due_date?: string;
|
|
1200
1204
|
tags?: string[];
|
|
1201
1205
|
sessionId: string;
|
|
1206
|
+
/** Project root path for task positioning. Use 'unknown' if unknown. */
|
|
1207
|
+
project_path: string;
|
|
1208
|
+
/**
|
|
1209
|
+
* JSON string with time-space positioning info.
|
|
1210
|
+
* - For coding tasks: include worktree_path, branch, type
|
|
1211
|
+
* - For other tasks: use '{}' or '{"type":"unknown"}'
|
|
1212
|
+
* Must be a valid JSON string.
|
|
1213
|
+
*/
|
|
1214
|
+
context: string;
|
|
1202
1215
|
}
|
|
1203
1216
|
interface UpdateTaskOptions {
|
|
1204
1217
|
title?: string;
|
|
@@ -1210,6 +1223,10 @@ interface UpdateTaskOptions {
|
|
|
1210
1223
|
goals_and_expected_deliverables?: string;
|
|
1211
1224
|
due_date?: string;
|
|
1212
1225
|
tags?: string[];
|
|
1226
|
+
/** 项目路径,标识任务所属的项目 */
|
|
1227
|
+
project_path?: string;
|
|
1228
|
+
/** 任务上下文信息,用于存储额外上下文 */
|
|
1229
|
+
context?: string;
|
|
1213
1230
|
}
|
|
1214
1231
|
interface ListTasksOptions {
|
|
1215
1232
|
status?: TaskStatus;
|
|
@@ -1327,6 +1344,10 @@ declare class TaskComponent extends BaseComponent {
|
|
|
1327
1344
|
private configComponent?;
|
|
1328
1345
|
private tagService;
|
|
1329
1346
|
private plugins;
|
|
1347
|
+
/**
|
|
1348
|
+
* 发布 EnvEvent
|
|
1349
|
+
*/
|
|
1350
|
+
private publishEvent;
|
|
1330
1351
|
constructor();
|
|
1331
1352
|
/**
|
|
1332
1353
|
* Initialize the component
|
|
@@ -1456,6 +1477,43 @@ declare class TaskComponent extends BaseComponent {
|
|
|
1456
1477
|
*/
|
|
1457
1478
|
listPlugins(): TaskPlugin[];
|
|
1458
1479
|
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Background Task Event Types
|
|
1482
|
+
* 这些事件由 BackgroundTaskManager 发布,标识为 task.background.*
|
|
1483
|
+
*/
|
|
1484
|
+
declare const BackgroundTaskEventTypes: {
|
|
1485
|
+
readonly STARTED: "task.background.started";
|
|
1486
|
+
readonly PROGRESS: "task.background.progress";
|
|
1487
|
+
readonly COMPLETED: "task.background.completed";
|
|
1488
|
+
readonly FAILED: "task.background.failed";
|
|
1489
|
+
readonly TIMEOUT: "task.background.timeout";
|
|
1490
|
+
readonly STOPPED: "task.background.stopped";
|
|
1491
|
+
};
|
|
1492
|
+
interface BackgroundTaskStartedPayload {
|
|
1493
|
+
backgroundTaskId: string;
|
|
1494
|
+
subSessionId: string;
|
|
1495
|
+
parentSessionId: string;
|
|
1496
|
+
description: string;
|
|
1497
|
+
subagentType: string;
|
|
1498
|
+
associatedTaskId?: number;
|
|
1499
|
+
}
|
|
1500
|
+
interface BackgroundTaskProgressPayload {
|
|
1501
|
+
backgroundTaskId: string;
|
|
1502
|
+
subSessionId: string;
|
|
1503
|
+
parentSessionId: string;
|
|
1504
|
+
status: string;
|
|
1505
|
+
progress?: number;
|
|
1506
|
+
}
|
|
1507
|
+
interface BackgroundTaskCompletedPayload {
|
|
1508
|
+
backgroundTaskId: string;
|
|
1509
|
+
subSessionId: string;
|
|
1510
|
+
parentSessionId: string;
|
|
1511
|
+
status: "completed" | "failed" | "timeout" | "stopped";
|
|
1512
|
+
result?: string;
|
|
1513
|
+
error?: string;
|
|
1514
|
+
executionTimeMs: number;
|
|
1515
|
+
associatedTaskId?: number;
|
|
1516
|
+
}
|
|
1459
1517
|
interface SubAgentSpec {
|
|
1460
1518
|
id: string;
|
|
1461
1519
|
name: string;
|
|
@@ -1503,24 +1561,27 @@ interface CreateBackgroundTaskOptions {
|
|
|
1503
1561
|
* Background Task Manager (简化版)
|
|
1504
1562
|
*
|
|
1505
1563
|
* 管理后台任务的创建、执行、状态跟踪
|
|
1506
|
-
*
|
|
1564
|
+
* 发布 task.background.* 事件供外部订阅
|
|
1507
1565
|
*/
|
|
1508
1566
|
declare class BackgroundTaskManager {
|
|
1509
1567
|
private env;
|
|
1510
1568
|
private tasks;
|
|
1511
|
-
private progressTimers;
|
|
1512
1569
|
private abortControllers;
|
|
1570
|
+
private progressTimers;
|
|
1513
1571
|
constructor(env: any);
|
|
1514
1572
|
/**
|
|
1515
1573
|
* Get SessionComponent from env
|
|
1516
1574
|
*/
|
|
1517
1575
|
private getSessionComponent;
|
|
1576
|
+
/**
|
|
1577
|
+
* Publish a task.background.* event
|
|
1578
|
+
*/
|
|
1579
|
+
private publishBackgroundEvent;
|
|
1518
1580
|
createTask(options: CreateBackgroundTaskOptions): Promise<{
|
|
1519
1581
|
taskId: string;
|
|
1520
1582
|
subSessionId: string;
|
|
1521
1583
|
}>;
|
|
1522
1584
|
private executeTask;
|
|
1523
|
-
private executeWithAbort;
|
|
1524
1585
|
/**
|
|
1525
1586
|
* Start progress reporter for a task
|
|
1526
1587
|
*/
|
|
@@ -1529,10 +1590,7 @@ declare class BackgroundTaskManager {
|
|
|
1529
1590
|
* Stop progress reporter for a task
|
|
1530
1591
|
*/
|
|
1531
1592
|
private stopProgressReporter;
|
|
1532
|
-
|
|
1533
|
-
* Publish an event to the environment
|
|
1534
|
-
*/
|
|
1535
|
-
private publishEvent;
|
|
1593
|
+
private executeWithAbort;
|
|
1536
1594
|
stopTask(taskId: string): {
|
|
1537
1595
|
success: boolean;
|
|
1538
1596
|
task?: BackgroundTask;
|
|
@@ -1551,72 +1609,4 @@ declare class BackgroundTaskManager {
|
|
|
1551
1609
|
*/
|
|
1552
1610
|
declare function createDelegateTool(taskComponent: TaskComponent): Tool;
|
|
1553
1611
|
declare function createStopTool(taskManager: BackgroundTaskManager): Tool;
|
|
1554
|
-
|
|
1555
|
-
* 任务事件类型枚举
|
|
1556
|
-
*/
|
|
1557
|
-
declare const TaskEventTypes: {
|
|
1558
|
-
/** 任务开始执行 */
|
|
1559
|
-
readonly TASK_STARTED: "task.started";
|
|
1560
|
-
/** 任务进度更新 */
|
|
1561
|
-
readonly TASK_PROGRESS: "task.progress";
|
|
1562
|
-
/** 任务完成 */
|
|
1563
|
-
readonly TASK_COMPLETED: "task.completed";
|
|
1564
|
-
/** 任务失败 */
|
|
1565
|
-
readonly TASK_FAILED: "task.failed";
|
|
1566
|
-
/** 任务超时 */
|
|
1567
|
-
readonly TASK_TIMEOUT: "task.timeout";
|
|
1568
|
-
/** 任务被停止 */
|
|
1569
|
-
readonly TASK_STOPPED: "task.stopped";
|
|
1570
|
-
};
|
|
1571
|
-
type TaskEventType = (typeof TaskEventTypes)[keyof typeof TaskEventTypes];
|
|
1572
|
-
/**
|
|
1573
|
-
* 任务开始事件负载
|
|
1574
|
-
*/
|
|
1575
|
-
interface TaskStartedPayload {
|
|
1576
|
-
taskId: string;
|
|
1577
|
-
subSessionId: string;
|
|
1578
|
-
parentSessionId: string;
|
|
1579
|
-
description: string;
|
|
1580
|
-
subagentType: string;
|
|
1581
|
-
associatedTaskId?: number;
|
|
1582
|
-
}
|
|
1583
|
-
/**
|
|
1584
|
-
* 任务进度事件负载
|
|
1585
|
-
*/
|
|
1586
|
-
interface TaskProgressPayload {
|
|
1587
|
-
taskId: string;
|
|
1588
|
-
subSessionId: string;
|
|
1589
|
-
parentSessionId: string;
|
|
1590
|
-
status: string;
|
|
1591
|
-
progress?: number;
|
|
1592
|
-
progressMessage?: string;
|
|
1593
|
-
description?: string;
|
|
1594
|
-
subagentType?: string;
|
|
1595
|
-
}
|
|
1596
|
-
/**
|
|
1597
|
-
* 任务完成事件负载
|
|
1598
|
-
*/
|
|
1599
|
-
interface TaskCompletedPayload {
|
|
1600
|
-
taskId: string;
|
|
1601
|
-
subSessionId: string;
|
|
1602
|
-
parentSessionId: string;
|
|
1603
|
-
status: "completed" | "failed" | "timeout" | "stopped";
|
|
1604
|
-
result?: string;
|
|
1605
|
-
error?: string;
|
|
1606
|
-
executionTimeMs: number;
|
|
1607
|
-
associatedTaskId?: number;
|
|
1608
|
-
description?: string;
|
|
1609
|
-
subagentType?: string;
|
|
1610
|
-
}
|
|
1611
|
-
/**
|
|
1612
|
-
* 任务事件基类
|
|
1613
|
-
*/
|
|
1614
|
-
interface BaseTaskEventPayload {
|
|
1615
|
-
taskId: string;
|
|
1616
|
-
subSessionId: string;
|
|
1617
|
-
parentSessionId: string;
|
|
1618
|
-
description: string;
|
|
1619
|
-
subagentType: string;
|
|
1620
|
-
associatedTaskId?: number;
|
|
1621
|
-
}
|
|
1622
|
-
export { createStopTool, createDelegateTool, TaskStartedPayload, TaskProgressPayload, TaskEventTypes, TaskEventType, TaskCompletedPayload, SubAgentSpec, DelegateToolResult, DelegateToolParams, DelegateToolParameters, BaseTaskEventPayload, BackgroundTaskManager, BackgroundTask };
|
|
1612
|
+
export { createStopTool, createDelegateTool, SubAgentSpec, DelegateToolResult, DelegateToolParams, DelegateToolParameters, BackgroundTaskStartedPayload, BackgroundTaskProgressPayload, BackgroundTaskManager, BackgroundTaskEventTypes, BackgroundTaskCompletedPayload, BackgroundTask };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BackgroundTaskEventTypes,
|
|
2
3
|
BackgroundTaskManager,
|
|
3
|
-
TaskEventTypes,
|
|
4
4
|
createDelegateTool,
|
|
5
5
|
createStopTool
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-vf215qfv.js";
|
|
7
7
|
import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
8
8
|
import"../../../shared/@ai-setting/roy-agent-core-gjq1yk68.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-44hnfb02.js";
|
|
@@ -13,6 +13,6 @@ import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
|
13
13
|
export {
|
|
14
14
|
createStopTool,
|
|
15
15
|
createDelegateTool,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
BackgroundTaskManager,
|
|
17
|
+
BackgroundTaskEventTypes
|
|
18
18
|
};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Entity Event Types
|
|
3
|
+
*
|
|
4
|
+
* 定义 TaskComponent 相关的 EnvEvent 类型
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Task Entity 事件类型枚举
|
|
8
|
+
*/
|
|
9
|
+
declare const TaskEntityEventTypes: {
|
|
10
|
+
/** Task 创建 */
|
|
11
|
+
readonly CREATED: "task.created";
|
|
12
|
+
/** Task 更新 */
|
|
13
|
+
readonly UPDATED: "task.updated";
|
|
14
|
+
/** Task 完成 */
|
|
15
|
+
readonly COMPLETED: "task.completed";
|
|
16
|
+
/** Task 删除 */
|
|
17
|
+
readonly DELETED: "task.deleted";
|
|
18
|
+
/** Operation 记录添加 */
|
|
19
|
+
readonly OPERATION_ADDED: "task.operation_added";
|
|
20
|
+
/** Task 被委托 */
|
|
21
|
+
readonly DELEGATED: "task.delegated";
|
|
22
|
+
};
|
|
23
|
+
type TaskEntityEventType = (typeof TaskEntityEventTypes)[keyof typeof TaskEntityEventTypes];
|
|
24
|
+
import { z } from "zod";
|
|
25
|
+
/**
|
|
26
|
+
* Task status enum
|
|
27
|
+
*/
|
|
28
|
+
declare const TaskStatusEnum: unknown;
|
|
29
|
+
type TaskStatus = z.infer<typeof TaskStatusEnum>;
|
|
30
|
+
/**
|
|
31
|
+
* Task priority enum
|
|
32
|
+
*/
|
|
33
|
+
declare const TaskPriorityEnum: unknown;
|
|
34
|
+
type TaskPriority = z.infer<typeof TaskPriorityEnum>;
|
|
35
|
+
/**
|
|
36
|
+
* Action type for task operations
|
|
37
|
+
*/
|
|
38
|
+
declare const ActionTypeEnum: unknown;
|
|
39
|
+
type ActionType = z.infer<typeof ActionTypeEnum>;
|
|
40
|
+
/**
|
|
41
|
+
* Task entity
|
|
42
|
+
*/
|
|
43
|
+
interface Task {
|
|
44
|
+
id: number;
|
|
45
|
+
title: string;
|
|
46
|
+
description: string;
|
|
47
|
+
status: TaskStatus;
|
|
48
|
+
priority: TaskPriority;
|
|
49
|
+
progress: number;
|
|
50
|
+
current_status: string;
|
|
51
|
+
goals_and_expected_deliverables: string;
|
|
52
|
+
parent_task_id?: number;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
due_date?: string;
|
|
56
|
+
tags?: string[];
|
|
57
|
+
/** Project root path for task positioning */
|
|
58
|
+
project_path: string;
|
|
59
|
+
/** JSON string with time-space positioning info (worktree, branch, etc.) */
|
|
60
|
+
context: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* TaskOperation entity
|
|
64
|
+
*
|
|
65
|
+
* 记录任务的操作历史,每个操作关联到一个 sessionId
|
|
66
|
+
*/
|
|
67
|
+
interface TaskOperation {
|
|
68
|
+
id: number;
|
|
69
|
+
taskId: number;
|
|
70
|
+
sessionId: string;
|
|
71
|
+
actionType: ActionType;
|
|
72
|
+
actionTitle: string;
|
|
73
|
+
actionDescription: string;
|
|
74
|
+
timestamp: string;
|
|
75
|
+
mdPath?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* task.created 事件负载
|
|
79
|
+
*/
|
|
80
|
+
interface TaskCreatedPayload {
|
|
81
|
+
task: Task;
|
|
82
|
+
sessionId: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* task.updated 事件负载
|
|
86
|
+
*/
|
|
87
|
+
interface TaskUpdatedPayload {
|
|
88
|
+
task: Task;
|
|
89
|
+
changes: Partial<Task>;
|
|
90
|
+
sessionId: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* task.completed 事件负载
|
|
94
|
+
*/
|
|
95
|
+
interface TaskCompletedPayload {
|
|
96
|
+
task: Task;
|
|
97
|
+
sessionId: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* task.deleted 事件负载
|
|
101
|
+
*/
|
|
102
|
+
interface TaskDeletedPayload {
|
|
103
|
+
taskId: number;
|
|
104
|
+
sessionId: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* task.operation_added 事件负载
|
|
108
|
+
*/
|
|
109
|
+
interface TaskOperationAddedPayload {
|
|
110
|
+
operation: TaskOperation;
|
|
111
|
+
taskId: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* task.delegated 事件负载
|
|
115
|
+
*/
|
|
116
|
+
interface TaskDelegatedPayload {
|
|
117
|
+
taskId: number;
|
|
118
|
+
backgroundTaskId: string;
|
|
119
|
+
subSessionId: string;
|
|
120
|
+
parentSessionId: string;
|
|
121
|
+
description: string;
|
|
122
|
+
subagentType: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* task.background.started 事件负载
|
|
126
|
+
*/
|
|
127
|
+
interface BackgroundTaskStartedPayload {
|
|
128
|
+
taskId: string;
|
|
129
|
+
subSessionId: string;
|
|
130
|
+
parentSessionId: string;
|
|
131
|
+
description: string;
|
|
132
|
+
subagentType: string;
|
|
133
|
+
associatedTaskId?: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* task.background.progress 事件负载
|
|
137
|
+
*/
|
|
138
|
+
interface BackgroundTaskProgressPayload {
|
|
139
|
+
taskId: string;
|
|
140
|
+
subSessionId: string;
|
|
141
|
+
parentSessionId: string;
|
|
142
|
+
status: string;
|
|
143
|
+
progress?: number;
|
|
144
|
+
progressMessage?: string;
|
|
145
|
+
description?: string;
|
|
146
|
+
subagentType?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* task.background.completed/failed/timeout/stopped 事件负载
|
|
150
|
+
*/
|
|
151
|
+
interface BackgroundTaskCompletedPayload {
|
|
152
|
+
taskId: string;
|
|
153
|
+
subSessionId: string;
|
|
154
|
+
parentSessionId: string;
|
|
155
|
+
status: "completed" | "failed" | "timeout" | "stopped";
|
|
156
|
+
result?: string;
|
|
157
|
+
error?: string;
|
|
158
|
+
executionTimeMs: number;
|
|
159
|
+
associatedTaskId?: number;
|
|
160
|
+
description?: string;
|
|
161
|
+
subagentType?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 所有 Task Entity 事件负载的联合类型
|
|
165
|
+
*/
|
|
166
|
+
type TaskEntityEventPayload = TaskCreatedPayload | TaskUpdatedPayload | TaskCompletedPayload | TaskDeletedPayload | TaskOperationAddedPayload | TaskDelegatedPayload;
|
|
167
|
+
/**
|
|
168
|
+
* 所有 Background Task 事件负载的联合类型
|
|
169
|
+
*/
|
|
170
|
+
type BackgroundTaskEventPayload = BackgroundTaskStartedPayload | BackgroundTaskProgressPayload | BackgroundTaskCompletedPayload;
|
|
171
|
+
export { TaskUpdatedPayload, TaskOperationAddedPayload, TaskEntityEventTypes, TaskEntityEventType, TaskEntityEventPayload, TaskDeletedPayload, TaskDelegatedPayload, TaskCreatedPayload, TaskCompletedPayload, BackgroundTaskStartedPayload, BackgroundTaskProgressPayload, BackgroundTaskEventPayload, BackgroundTaskCompletedPayload };
|
|
@@ -198,6 +198,10 @@ interface Task {
|
|
|
198
198
|
updatedAt: string;
|
|
199
199
|
due_date?: string;
|
|
200
200
|
tags?: string[];
|
|
201
|
+
/** Project root path for task positioning */
|
|
202
|
+
project_path: string;
|
|
203
|
+
/** JSON string with time-space positioning info (worktree, branch, etc.) */
|
|
204
|
+
context: string;
|
|
201
205
|
}
|
|
202
206
|
/**
|
|
203
207
|
* TaskOperation entity
|
|
@@ -234,6 +238,15 @@ interface CreateTaskOptions {
|
|
|
234
238
|
due_date?: string;
|
|
235
239
|
tags?: string[];
|
|
236
240
|
sessionId: string;
|
|
241
|
+
/** Project root path for task positioning. Use 'unknown' if unknown. */
|
|
242
|
+
project_path: string;
|
|
243
|
+
/**
|
|
244
|
+
* JSON string with time-space positioning info.
|
|
245
|
+
* - For coding tasks: include worktree_path, branch, type
|
|
246
|
+
* - For other tasks: use '{}' or '{"type":"unknown"}'
|
|
247
|
+
* Must be a valid JSON string.
|
|
248
|
+
*/
|
|
249
|
+
context: string;
|
|
237
250
|
}
|
|
238
251
|
interface UpdateTaskOptions {
|
|
239
252
|
title?: string;
|
|
@@ -245,6 +258,10 @@ interface UpdateTaskOptions {
|
|
|
245
258
|
goals_and_expected_deliverables?: string;
|
|
246
259
|
due_date?: string;
|
|
247
260
|
tags?: string[];
|
|
261
|
+
/** 项目路径,标识任务所属的项目 */
|
|
262
|
+
project_path?: string;
|
|
263
|
+
/** 任务上下文信息,用于存储额外上下文 */
|
|
264
|
+
context?: string;
|
|
248
265
|
}
|
|
249
266
|
interface CreateOperationOptions {
|
|
250
267
|
taskId: number;
|
|
@@ -403,24 +420,27 @@ interface CreateBackgroundTaskOptions {
|
|
|
403
420
|
* Background Task Manager (简化版)
|
|
404
421
|
*
|
|
405
422
|
* 管理后台任务的创建、执行、状态跟踪
|
|
406
|
-
*
|
|
423
|
+
* 发布 task.background.* 事件供外部订阅
|
|
407
424
|
*/
|
|
408
425
|
declare class BackgroundTaskManager {
|
|
409
426
|
private env;
|
|
410
427
|
private tasks;
|
|
411
|
-
private progressTimers;
|
|
412
428
|
private abortControllers;
|
|
429
|
+
private progressTimers;
|
|
413
430
|
constructor(env: any);
|
|
414
431
|
/**
|
|
415
432
|
* Get SessionComponent from env
|
|
416
433
|
*/
|
|
417
434
|
private getSessionComponent;
|
|
435
|
+
/**
|
|
436
|
+
* Publish a task.background.* event
|
|
437
|
+
*/
|
|
438
|
+
private publishBackgroundEvent;
|
|
418
439
|
createTask(options: CreateBackgroundTaskOptions): Promise<{
|
|
419
440
|
taskId: string;
|
|
420
441
|
subSessionId: string;
|
|
421
442
|
}>;
|
|
422
443
|
private executeTask;
|
|
423
|
-
private executeWithAbort;
|
|
424
444
|
/**
|
|
425
445
|
* Start progress reporter for a task
|
|
426
446
|
*/
|
|
@@ -429,10 +449,7 @@ declare class BackgroundTaskManager {
|
|
|
429
449
|
* Stop progress reporter for a task
|
|
430
450
|
*/
|
|
431
451
|
private stopProgressReporter;
|
|
432
|
-
|
|
433
|
-
* Publish an event to the environment
|
|
434
|
-
*/
|
|
435
|
-
private publishEvent;
|
|
452
|
+
private executeWithAbort;
|
|
436
453
|
stopTask(taskId: string): {
|
|
437
454
|
success: boolean;
|
|
438
455
|
task?: BackgroundTask;
|