@ai-setting/roy-agent-core 1.7.76 → 1.7.77
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/agent/agent-component.js +2 -2
- package/dist/env/agent/index.js +2 -2
- package/dist/env/event-source/event-source-handlers.js +6 -6
- package/dist/env/event-source/index.js +7 -7
- package/dist/env/index.js +11 -11
- package/dist/env/task/backend/index.js +37 -1
- package/dist/env/task/backend/task-store-backend.d.ts +12 -0
- package/dist/env/task/backend/types.d.ts +19 -0
- package/dist/env/task/index.js +3 -3
- package/dist/env/task/mcp/index.js +3 -0
- package/dist/env/task/mcp/task-mcp-server.d.ts +1 -1
- package/dist/env/task/plugins/fake-user-message-helper.d.ts +10 -2
- package/dist/env/task/plugins/index.d.ts +1 -0
- package/dist/env/task/plugins/index.js +15 -4
- package/dist/env/task/plugins/lark-card-patch-notifier.js +1 -1
- package/dist/env/task/plugins/task-op-watermark-plugin.d.ts +112 -0
- package/dist/env/task/storage/index.js +2 -2
- package/dist/env/task/storage/sqlite-task-store.d.ts +54 -0
- package/dist/env/task/task-component.d.ts +16 -0
- package/dist/env/task/tools/operation/operation-types.d.ts +13 -13
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/types/event.d.ts +4 -4
- package/dist/index.js +11 -11
- package/dist/shared/@ai-setting/{roy-agent-core-cxy143m4.js → roy-agent-core-0v27y99n.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-t3rrb959.js → roy-agent-core-3gpygqcx.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-q5r75vev.js → roy-agent-core-9vhq7fvv.js} +5 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zycadbpx.js → roy-agent-core-ew6qb5yx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-abqhkbn3.js → roy-agent-core-ezvpreqz.js} +23 -0
- package/dist/shared/@ai-setting/roy-agent-core-h21gngxf.js +247 -0
- package/dist/shared/@ai-setting/{roy-agent-core-p3zv1mx5.js → roy-agent-core-hd3n57zs.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ntq0gz7q.js → roy-agent-core-q813vafd.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-z43aj03k.js → roy-agent-core-rhtdspx6.js} +20 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ghnagzrh.js → roy-agent-core-rsn44n9y.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-nmx9934r.js → roy-agent-core-w0qjeq2v.js} +1 -1
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-f77k3gqt.js +0 -71
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
filterToolsByAgent,
|
|
8
8
|
parseToolList,
|
|
9
9
|
toLLMMessage
|
|
10
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
} from "../../shared/@ai-setting/roy-agent-core-9vhq7fvv.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-v85n42ve.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
13
13
|
import"../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
14
14
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
15
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
15
|
+
import"../../shared/@ai-setting/roy-agent-core-h21gngxf.js";
|
|
16
16
|
import"../../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
package/dist/env/agent/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
AgentComponent,
|
|
6
6
|
AgentComponentConfigSchema
|
|
7
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
7
|
+
} from "../../shared/@ai-setting/roy-agent-core-9vhq7fvv.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-v85n42ve.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
12
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-h21gngxf.js";
|
|
13
13
|
import"../../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
|
|
14
14
|
import"../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
@@ -11,28 +11,28 @@ import {
|
|
|
11
11
|
patchCardByLarkCli,
|
|
12
12
|
renderRuleNoticeSection,
|
|
13
13
|
timerHandler
|
|
14
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
14
|
+
} from "../../shared/@ai-setting/roy-agent-core-3gpygqcx.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-bxkjk7zx.js";
|
|
16
16
|
import {
|
|
17
17
|
cliCommandHandler
|
|
18
18
|
} from "../../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
20
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
20
|
+
import"../../shared/@ai-setting/roy-agent-core-rsn44n9y.js";
|
|
21
21
|
import"../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
22
22
|
import"../../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
|
|
23
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
23
|
+
import"../../shared/@ai-setting/roy-agent-core-ezvpreqz.js";
|
|
24
24
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
25
25
|
import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
26
26
|
import"../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
|
|
27
27
|
import"../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
|
|
28
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
29
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
28
|
+
import"../../shared/@ai-setting/roy-agent-core-hd3n57zs.js";
|
|
29
|
+
import"../../shared/@ai-setting/roy-agent-core-w0qjeq2v.js";
|
|
30
30
|
import"../../shared/@ai-setting/roy-agent-core-6cy43nss.js";
|
|
31
31
|
import"../../shared/@ai-setting/roy-agent-core-c2gbt68e.js";
|
|
32
32
|
import"../../shared/@ai-setting/roy-agent-core-1v4g0d4x.js";
|
|
33
33
|
import"../../shared/@ai-setting/roy-agent-core-cgtq6427.js";
|
|
34
34
|
import"../../shared/@ai-setting/roy-agent-core-er070zjq.js";
|
|
35
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
35
|
+
import"../../shared/@ai-setting/roy-agent-core-h21gngxf.js";
|
|
36
36
|
import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
37
37
|
import"../../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
38
38
|
import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import"../../shared/@ai-setting/roy-agent-core-b4x6x4k2.js";
|
|
2
2
|
import {
|
|
3
3
|
EventSourceComponent
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-0v27y99n.js";
|
|
5
5
|
import {
|
|
6
6
|
BountyIMInstance,
|
|
7
7
|
COMMAND_PREFIX,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
timerHandler,
|
|
34
34
|
translateCardActionToCommand,
|
|
35
35
|
writeFallbackModelList
|
|
36
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
36
|
+
} from "../../shared/@ai-setting/roy-agent-core-3gpygqcx.js";
|
|
37
37
|
import {
|
|
38
38
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
39
39
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
parseCliSessionChatId
|
|
52
52
|
} from "../../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
53
53
|
import"../../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
54
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
54
|
+
import"../../shared/@ai-setting/roy-agent-core-rsn44n9y.js";
|
|
55
55
|
import {
|
|
56
56
|
EventStoreImpl,
|
|
57
57
|
getSharedEventStore,
|
|
@@ -59,19 +59,19 @@ import {
|
|
|
59
59
|
setSharedEventStore
|
|
60
60
|
} from "../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
61
61
|
import"../../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
|
|
62
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
62
|
+
import"../../shared/@ai-setting/roy-agent-core-ezvpreqz.js";
|
|
63
63
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
64
64
|
import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
65
65
|
import"../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
|
|
66
66
|
import"../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
|
|
67
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
68
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
67
|
+
import"../../shared/@ai-setting/roy-agent-core-hd3n57zs.js";
|
|
68
|
+
import"../../shared/@ai-setting/roy-agent-core-w0qjeq2v.js";
|
|
69
69
|
import"../../shared/@ai-setting/roy-agent-core-6cy43nss.js";
|
|
70
70
|
import"../../shared/@ai-setting/roy-agent-core-c2gbt68e.js";
|
|
71
71
|
import"../../shared/@ai-setting/roy-agent-core-1v4g0d4x.js";
|
|
72
72
|
import"../../shared/@ai-setting/roy-agent-core-cgtq6427.js";
|
|
73
73
|
import"../../shared/@ai-setting/roy-agent-core-er070zjq.js";
|
|
74
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
74
|
+
import"../../shared/@ai-setting/roy-agent-core-h21gngxf.js";
|
|
75
75
|
import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
76
76
|
import"../../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
77
77
|
import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
package/dist/env/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseEnvironment
|
|
3
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../shared/@ai-setting/roy-agent-core-ew6qb5yx.js";
|
|
4
4
|
import {
|
|
5
5
|
TaskComponent
|
|
6
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../shared/@ai-setting/roy-agent-core-rhtdspx6.js";
|
|
7
7
|
import"../shared/@ai-setting/roy-agent-core-2akfd64z.js";
|
|
8
8
|
import"../shared/@ai-setting/roy-agent-core-jm136jzh.js";
|
|
9
9
|
import"../shared/@ai-setting/roy-agent-core-aa2j7bk9.js";
|
|
10
10
|
import"../shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
11
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
import"../shared/@ai-setting/roy-agent-core-q813vafd.js";
|
|
12
12
|
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
13
13
|
import"../shared/@ai-setting/roy-agent-core-vffccgf6.js";
|
|
14
14
|
import"../shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
|
|
15
15
|
import {
|
|
16
16
|
EventSourceComponent
|
|
17
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
} from "../shared/@ai-setting/roy-agent-core-0v27y99n.js";
|
|
18
18
|
import {
|
|
19
19
|
builtInHandlers,
|
|
20
20
|
larkCliHandler
|
|
21
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
21
|
+
} from "../shared/@ai-setting/roy-agent-core-3gpygqcx.js";
|
|
22
22
|
import {
|
|
23
23
|
EventSourceInitHooks,
|
|
24
24
|
getDefaultConfigForType,
|
|
@@ -28,16 +28,16 @@ import {
|
|
|
28
28
|
} from "../shared/@ai-setting/roy-agent-core-bxkjk7zx.js";
|
|
29
29
|
import"../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
30
30
|
import"../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
31
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
31
|
+
import"../shared/@ai-setting/roy-agent-core-rsn44n9y.js";
|
|
32
32
|
import"../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
33
33
|
import"../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
|
|
34
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
34
|
+
import"../shared/@ai-setting/roy-agent-core-ezvpreqz.js";
|
|
35
35
|
import"../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
36
36
|
import"../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
37
37
|
import"../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
|
|
38
38
|
import"../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
|
|
39
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
40
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
39
|
+
import"../shared/@ai-setting/roy-agent-core-hd3n57zs.js";
|
|
40
|
+
import"../shared/@ai-setting/roy-agent-core-w0qjeq2v.js";
|
|
41
41
|
import {
|
|
42
42
|
WorkflowComponent
|
|
43
43
|
} from "../shared/@ai-setting/roy-agent-core-v87njmq7.js";
|
|
@@ -68,7 +68,7 @@ import"../shared/@ai-setting/roy-agent-core-jagkferh.js";
|
|
|
68
68
|
import {
|
|
69
69
|
AgentComponent,
|
|
70
70
|
AgentComponentConfigSchema
|
|
71
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
71
|
+
} from "../shared/@ai-setting/roy-agent-core-9vhq7fvv.js";
|
|
72
72
|
import"../shared/@ai-setting/roy-agent-core-v85n42ve.js";
|
|
73
73
|
import"../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
74
74
|
import"../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
getXDGPath,
|
|
78
78
|
getXDGPaths
|
|
79
79
|
} from "../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
80
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
80
|
+
import"../shared/@ai-setting/roy-agent-core-h21gngxf.js";
|
|
81
81
|
import"../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
|
|
82
82
|
import"../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
83
83
|
import"../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TASK_COMPLETED_STATUS_WORD,
|
|
3
|
-
TASK_DELIVERABLE_RECORDED
|
|
3
|
+
TASK_DELIVERABLE_RECORDED,
|
|
4
|
+
TASK_TO_VALIDATE_STATUS_WORD
|
|
4
5
|
} from "../../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
|
|
5
6
|
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
6
7
|
// src/env/task/backend/task-store-backend.ts
|
|
@@ -166,6 +167,41 @@ class TaskStoreBackend {
|
|
|
166
167
|
const reread = await this.resolve(record.nativeId);
|
|
167
168
|
return this.toTask(reread ?? updated);
|
|
168
169
|
}
|
|
170
|
+
async preCompleteTask(id, sessionId, deliverable, progressSummary) {
|
|
171
|
+
const record = await this.resolve(id);
|
|
172
|
+
if (!record)
|
|
173
|
+
return null;
|
|
174
|
+
if (record.type === "cycle") {
|
|
175
|
+
throw new Error(`Cannot pre-complete cycle task: #${record.id} - ${record.title}. Cycle tasks are not meant to be completed or submitted for acceptance.`);
|
|
176
|
+
}
|
|
177
|
+
const toValidateWording = progressSummary ? `${TASK_TO_VALIDATE_STATUS_WORD}:${progressSummary}` : TASK_TO_VALIDATE_STATUS_WORD;
|
|
178
|
+
const patch = {
|
|
179
|
+
status: "to_validate",
|
|
180
|
+
current_status: toValidateWording
|
|
181
|
+
};
|
|
182
|
+
if (deliverable) {
|
|
183
|
+
patch.context = mergeDeliverableIntoContext(record.context, deliverable);
|
|
184
|
+
}
|
|
185
|
+
const updated = await this.port.updateTask(record.nativeId, patch);
|
|
186
|
+
if (!updated)
|
|
187
|
+
return null;
|
|
188
|
+
const descParts = [];
|
|
189
|
+
const deliverableLine = formatDeliverableForOperation(deliverable);
|
|
190
|
+
if (deliverableLine)
|
|
191
|
+
descParts.push(deliverableLine);
|
|
192
|
+
if (progressSummary)
|
|
193
|
+
descParts.push(progressSummary);
|
|
194
|
+
await this.createOperation({
|
|
195
|
+
taskId: updated.id,
|
|
196
|
+
sessionId: sessionId ?? this.defaultSessionId,
|
|
197
|
+
milestoneType: "milestone",
|
|
198
|
+
milestoneTitle: `${TASK_TO_VALIDATE_STATUS_WORD}(to_validate):Task #${updated.id} submitted for acceptance`,
|
|
199
|
+
milestoneDescription: descParts.join(" / ") || TASK_TO_VALIDATE_STATUS_WORD,
|
|
200
|
+
...deliverable ? { mdPath: deliverable } : {}
|
|
201
|
+
});
|
|
202
|
+
const reread = await this.resolve(record.nativeId);
|
|
203
|
+
return this.toTask(reread ?? updated);
|
|
204
|
+
}
|
|
169
205
|
async getTaskTree(id, depth = -1) {
|
|
170
206
|
const root = await this.resolve(id);
|
|
171
207
|
if (!root)
|
|
@@ -62,6 +62,18 @@ export declare class TaskStoreBackend implements TaskBackend {
|
|
|
62
62
|
updateTask(id: TaskId, input: BackendUpdateTaskOptions): Promise<Task | null>;
|
|
63
63
|
deleteTask(id: TaskId): Promise<boolean>;
|
|
64
64
|
completeTask(id: TaskId, sessionId?: string, deliverable?: string): Promise<Task | null>;
|
|
65
|
+
/**
|
|
66
|
+
* Task #5078 — 提交待验证(两阶段验收 #5073 的 backend 实现)。
|
|
67
|
+
*
|
|
68
|
+
* 语义与 `TaskComponent.preCompleteTask` 同构:
|
|
69
|
+
* status → to_validate、current_status → 待验证措辞、
|
|
70
|
+
* deliverable merge 进 context、milestone operation 留痕。
|
|
71
|
+
*
|
|
72
|
+
* 与 TaskComponent 的唯一差别:**不 fire AFTER_COMPLETE 钩子** ——
|
|
73
|
+
* backend 没有 hook 链(#5035 已确认),goal 判定由上层负责
|
|
74
|
+
* (MCP 侧 = 插件 withGoalCheck;TaskComponent 侧 = 插件链)。
|
|
75
|
+
*/
|
|
76
|
+
preCompleteTask(id: TaskId, sessionId?: string, deliverable?: string, progressSummary?: string): Promise<Task | null>;
|
|
65
77
|
/**
|
|
66
78
|
* review B1 — roy 的 `task-tree-tool.ts` 在子树模式下调这个方法;
|
|
67
79
|
* 老 facade 缺它导致 `task_tree(parent_task_id=…)` 直接抛
|
|
@@ -81,6 +81,25 @@ export interface TaskBackend {
|
|
|
81
81
|
* - `cycle` 类型任务拒绝完成(roy 语义)
|
|
82
82
|
*/
|
|
83
83
|
completeTask(id: TaskId, sessionId?: string, deliverable?: string): Promise<Task | null>;
|
|
84
|
+
/**
|
|
85
|
+
* 提交待验证(Task #5073 两阶段验收的第一阶段,Task #5078)。
|
|
86
|
+
*
|
|
87
|
+
* 契约(与 `TaskComponent.preCompleteTask` 语义同构,MCP/
|
|
88
|
+
* 插件侧共用):
|
|
89
|
+
* - `status` → `to_validate`(**非终态**:只进验收队列)
|
|
90
|
+
* - `current_status` → 「待验证」措辞(progressSummary 拼接:
|
|
91
|
+
* 「待验证:<summary>」)
|
|
92
|
+
* - 若给了 `deliverable`,merge 进 `context.deliverable_storage_path`
|
|
93
|
+
* 并写入 submission operation 的 `milestoneDescription`
|
|
94
|
+
* - 写一条 `milestoneType: "milestone"` 的提交留痕 operation
|
|
95
|
+
* (与 TaskComponent.preCompleteTask 的细微增强:deliverable
|
|
96
|
+
* 同时落在 operation 的 `mdPath` 字段,便于寻址)
|
|
97
|
+
* - `cycle` 类型任务拒绝提交(roy 语义,同 completeTask)
|
|
98
|
+
* - **不 fire 任何钩子**:`TaskStoreBackend` 没有 hook 链,
|
|
99
|
+
* goal 判定由上层(MCP withGoalCheck / TaskComponent 钩子)
|
|
100
|
+
* 负责 —— 本方法只是状态落库。
|
|
101
|
+
*/
|
|
102
|
+
preCompleteTask(id: TaskId, sessionId?: string, deliverable?: string, progressSummary?: string): Promise<Task | null>;
|
|
84
103
|
/** 子树(所有后代,**不含** root),BFS 按层展开,`depth` 限制层数。 */
|
|
85
104
|
getTaskTree(id: TaskId, depth?: number): Promise<Task[]>;
|
|
86
105
|
/** 关键词检索 + 全部 roy 过滤项(review finding Y2)。 */
|
package/dist/env/task/index.js
CHANGED
|
@@ -5,12 +5,12 @@ 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-rhtdspx6.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-2akfd64z.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-jm136jzh.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-aa2j7bk9.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
13
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-q813vafd.js";
|
|
14
14
|
import {
|
|
15
15
|
TaskEntityEventTypes
|
|
16
16
|
} from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
@@ -21,7 +21,7 @@ import"../../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
|
|
|
21
21
|
import {
|
|
22
22
|
SQLiteTaskStore,
|
|
23
23
|
getDefaultTaskDbPath
|
|
24
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
24
|
+
} from "../../shared/@ai-setting/roy-agent-core-ezvpreqz.js";
|
|
25
25
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
26
26
|
import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
27
27
|
import"../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
createTaskTool,
|
|
4
4
|
getTaskTool,
|
|
5
5
|
listTasksTool,
|
|
6
|
+
preCompleteTaskTool,
|
|
6
7
|
searchTasksTool,
|
|
7
8
|
treeTasksTool,
|
|
8
9
|
updateTaskTool
|
|
@@ -30,6 +31,7 @@ var TASK_MCP_TOOL_NAMES = [
|
|
|
30
31
|
"task_search",
|
|
31
32
|
"task_update",
|
|
32
33
|
"task_complete",
|
|
34
|
+
"task_pre_complete",
|
|
33
35
|
"task_operation_create",
|
|
34
36
|
"task_operation_list"
|
|
35
37
|
];
|
|
@@ -56,6 +58,7 @@ var TASK_TOOL_FACTORIES = [
|
|
|
56
58
|
searchTasksTool,
|
|
57
59
|
updateTaskTool,
|
|
58
60
|
completeTaskTool,
|
|
61
|
+
preCompleteTaskTool,
|
|
59
62
|
createOperationTool,
|
|
60
63
|
listOperationsTool
|
|
61
64
|
];
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
*/
|
|
36
36
|
import type { TaskBackend } from "../backend/types";
|
|
37
37
|
/** The task tools exposed over MCP. */
|
|
38
|
-
export declare const TASK_MCP_TOOL_NAMES: readonly ["task_create", "task_tree", "task_get", "task_list", "task_search", "task_update", "task_complete", "task_operation_create", "task_operation_list"];
|
|
38
|
+
export declare const TASK_MCP_TOOL_NAMES: readonly ["task_create", "task_tree", "task_get", "task_list", "task_search", "task_update", "task_complete", "task_pre_complete", "task_operation_create", "task_operation_list"];
|
|
39
39
|
export type TaskMcpToolName = (typeof TASK_MCP_TOOL_NAMES)[number];
|
|
40
40
|
/** An MCP tool definition (JSON Schema document — MCP requires JSON Schema). */
|
|
41
41
|
export interface TaskMcpToolDefinition {
|
|
@@ -45,13 +45,21 @@ import type { ModelMessage } from "ai";
|
|
|
45
45
|
/**
|
|
46
46
|
* Kinds of fake user messages. Used for deterministic merge ordering.
|
|
47
47
|
*
|
|
48
|
-
* Priority: "max-iter" > "delegate"
|
|
48
|
+
* Priority (KIND_PRIORITY below): "max-iter" > "task-ops" > "delegate"
|
|
49
49
|
* - "max-iter" reminders contain "不要再调用任何工具,直接总结" (final instruction)
|
|
50
|
+
* - "task-ops" reminders contain "task_operation_list" (Task #5081:
|
|
51
|
+
* sub-agent awareness of others' task operations)
|
|
50
52
|
* - "delegate" reminders contain "use delegate_task" (earlier hint)
|
|
51
53
|
*
|
|
52
54
|
* The final merged message always ends with the max-iter reminder.
|
|
53
55
|
*/
|
|
54
|
-
export type FakeUserMessageKind = "delegate" | "max-iter";
|
|
56
|
+
export type FakeUserMessageKind = "delegate" | "task-ops" | "max-iter";
|
|
57
|
+
/**
|
|
58
|
+
* Merge priority per kind — higher value = appears later in the
|
|
59
|
+
* merged message / wins the finalKind. Task #5081: "task-ops" sits
|
|
60
|
+
* between "delegate" (business hint) and "max-iter" (final word).
|
|
61
|
+
*/
|
|
62
|
+
export declare const KIND_PRIORITY: Record<FakeUserMessageKind, number>;
|
|
55
63
|
/**
|
|
56
64
|
* Internal implementation of the enqueue helper. Not exported directly;
|
|
57
65
|
* instead `enqueueToAddFakeUserMessage` (the wrapped version) is exported
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export { TaskTagPlugin } from "./task-tag-plugin";
|
|
5
5
|
export { LayaDecisionPlugin, createLayaDecisionPlugin, LAYA_REUSE_THRESHOLD, type LayaDecisionPluginOptions, } from "./laya-decision-plugin";
|
|
6
6
|
export { createAutoTaskPlugin, type AutoTaskPluginConfig, } from "./auto-task-plugin";
|
|
7
|
+
export { createTaskOpWatermarkPlugin, TaskOpWatermarkPlugin, TASK_OP_WATERMARK_MAX_REMINDERS, TASK_OP_WATERMARK_MESSAGE_LIMIT, TASK_OP_WATERMARK_AUDIT_INTERVAL, type TaskOpWatermarkPluginConfig, } from "./task-op-watermark-plugin";
|
|
7
8
|
export { LayaCompletionPlugin, createLayaCompletionPlugin, registerLayaCompletionTaskHook, buildCompletionHint, renderCompletionState, buildCompletionQuestion, LAYA_COMPLETION_THRESHOLD, type LayaCompletionPluginOptions, } from "./laya-completion-plugin";
|
|
8
9
|
export { TASK_COMPLETION_HINT_ANCHOR, TASK_COMPLETE_ITEM_BY_ITEM, TASK_COMPLETE_VERIFY_DUTY, TASK_COMPLETE_ACCEPTANCE, } from "../tools/completion-copy";
|
|
9
10
|
export type { DecisionPort, DecisionRequest, DecisionAnswer, DecisionResponse, } from "./decision-port";
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
parseExtractorOutput,
|
|
25
25
|
registerLayaCompletionTaskHook,
|
|
26
26
|
renderCompletionState
|
|
27
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
27
|
+
} from "../../../shared/@ai-setting/roy-agent-core-rsn44n9y.js";
|
|
28
28
|
import"../../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
29
29
|
import"../../../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
|
|
30
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
30
|
+
import"../../../shared/@ai-setting/roy-agent-core-ezvpreqz.js";
|
|
31
31
|
import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
32
32
|
import"../../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
33
33
|
import"../../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
|
|
@@ -55,11 +55,17 @@ import {
|
|
|
55
55
|
renderWorkflowInfoLines,
|
|
56
56
|
resolveTaskTitleForDisplay,
|
|
57
57
|
sanitizeInlineText
|
|
58
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
58
|
+
} from "../../../shared/@ai-setting/roy-agent-core-w0qjeq2v.js";
|
|
59
59
|
import"../../../shared/@ai-setting/roy-agent-core-1v4g0d4x.js";
|
|
60
60
|
import"../../../shared/@ai-setting/roy-agent-core-cgtq6427.js";
|
|
61
61
|
import"../../../shared/@ai-setting/roy-agent-core-er070zjq.js";
|
|
62
|
-
import
|
|
62
|
+
import {
|
|
63
|
+
TASK_OP_WATERMARK_AUDIT_INTERVAL,
|
|
64
|
+
TASK_OP_WATERMARK_MAX_REMINDERS,
|
|
65
|
+
TASK_OP_WATERMARK_MESSAGE_LIMIT,
|
|
66
|
+
TaskOpWatermarkPlugin,
|
|
67
|
+
createTaskOpWatermarkPlugin
|
|
68
|
+
} from "../../../shared/@ai-setting/roy-agent-core-h21gngxf.js";
|
|
63
69
|
import"../../../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
64
70
|
import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
65
71
|
import"../../../shared/@ai-setting/roy-agent-core-qqaak24r.js";
|
|
@@ -87,6 +93,7 @@ export {
|
|
|
87
93
|
formatExtractorInput,
|
|
88
94
|
formatDurationMs,
|
|
89
95
|
formatDateTimeForDisplay,
|
|
96
|
+
createTaskOpWatermarkPlugin,
|
|
90
97
|
createPerTaskGroupChatPlugin,
|
|
91
98
|
createLayaDecisionPlugin,
|
|
92
99
|
createLayaCompletionPlugin,
|
|
@@ -100,6 +107,10 @@ export {
|
|
|
100
107
|
buildChatAppLink,
|
|
101
108
|
WORKFLOW_EXTRACTOR_PROMPT,
|
|
102
109
|
TaskTagPlugin,
|
|
110
|
+
TaskOpWatermarkPlugin,
|
|
111
|
+
TASK_OP_WATERMARK_MESSAGE_LIMIT,
|
|
112
|
+
TASK_OP_WATERMARK_MAX_REMINDERS,
|
|
113
|
+
TASK_OP_WATERMARK_AUDIT_INTERVAL,
|
|
103
114
|
TASK_COMPLETION_HINT_ANCHOR,
|
|
104
115
|
TASK_COMPLETE_VERIFY_DUTY,
|
|
105
116
|
TASK_COMPLETE_ITEM_BY_ITEM,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveTaskTitleForDisplay,
|
|
23
23
|
sanitizeInlineText,
|
|
24
24
|
truncateHeadTitle
|
|
25
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
25
|
+
} from "../../../shared/@ai-setting/roy-agent-core-w0qjeq2v.js";
|
|
26
26
|
import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
|
|
27
27
|
import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
|
|
28
28
|
import"../../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview TaskOpWatermarkPlugin — sub-agent 感知任务操作记录(Task #5081,M1)
|
|
3
|
+
*
|
|
4
|
+
* 设计文档:/tmp/task-op-awareness-design.md(Task #5079,已验收)
|
|
5
|
+
*
|
|
6
|
+
* ## 场景
|
|
7
|
+
*
|
|
8
|
+
* sub-agent(roy 等)被委托推进某个 task 期间,default agent(或其它
|
|
9
|
+
* sub-agent / CLI 探针进程)往同一 task 写了新的 operation 记录。
|
|
10
|
+
* sub-agent 的 ReAct 循环对「别人给我加了记录」**毫无感知** —— 本插件
|
|
11
|
+
* 在 `agent:after.tool` 时点做水位比对,命中则通过共享 meta-protocol
|
|
12
|
+
* (`toolResult.result.metadata.toAddFakeUserMessage`)注入一条
|
|
13
|
+
* user role 提醒,sub-agent 下轮读到后自行调 `task_operation_list` 读取。
|
|
14
|
+
*
|
|
15
|
+
* ## 水位语义(关键设计决策)
|
|
16
|
+
*
|
|
17
|
+
* - 水位用 **operation id**(SQLite AUTOINCREMENT,严格单调)而非
|
|
18
|
+
* timestamp(Date.now() 毫秒,同毫秒多条会漏)。
|
|
19
|
+
* - 水位存 plugin 实例的 `Map<sessionId, Watermark>` —— 生命周期与
|
|
20
|
+
* plugin 实例一致;进程重启后首轮全量扫(N 聚 1 + 限流兜底噪声)。
|
|
21
|
+
* - **查询必须绕过 operationsCache**:`sqlite-task-store.ts` 的缓存只在
|
|
22
|
+
* 本进程写入时失效,跨进程(CLI 探针 / 另一 daemon)写入的记录不会
|
|
23
|
+
* 失效本进程缓存 → 必须走 `listOperationsFresh`(直打 DB)。
|
|
24
|
+
* - 能力探测:store 未实现 `listOperationsFresh`(外部宿主的后端)时
|
|
25
|
+
* 降级 `listOperations` + `invalidateOperationsCache`,功能等价。
|
|
26
|
+
*
|
|
27
|
+
* ## 自提醒过滤(防 doom loop,核心)
|
|
28
|
+
*
|
|
29
|
+
* `op.sessionId === 我的 sessionId` → 不算新记录。三个来源:
|
|
30
|
+
* 1. sub-agent 自己 `task_operation_create` 记进度(create-tool.ts:87)
|
|
31
|
+
* 2. sub-agent 自己 `task_pre_complete` 写的留痕(pre-complete-tool.ts:89,
|
|
32
|
+
* Task #5073 两阶段验收的提交口 —— 回归保护)
|
|
33
|
+
* 3. `sessionId = "unknown"` 的 fallback 写入(create-tool.ts:87 的兜底)
|
|
34
|
+
*
|
|
35
|
+
* ## 防退化与边界(设计文档 §4)
|
|
36
|
+
*
|
|
37
|
+
* - 无 task 绑定 → 跳过;DB 读异常 → catch + warn,不影响工具执行
|
|
38
|
+
* - N 条新记录聚合 **1 条**提醒(详情 ≤3 条,最新优先,其余折叠)
|
|
39
|
+
* - 单 session 限流 `TASK_OP_WATERMARK_MAX_REMINDERS`(5)次,超限只推水位
|
|
40
|
+
* - 消息总长 ≤ `TASK_OP_WATERMARK_MESSAGE_LIMIT`(1500 字符)
|
|
41
|
+
* - 每 `TASK_OP_WATERMARK_AUDIT_INTERVAL`(15)次工具调用兜底全量对账
|
|
42
|
+
* - kind 合并顺序:`delegate` → `task-ops` → `max-iter`(max-iter 最终
|
|
43
|
+
* 指令永远在末尾,见 fake-user-message-helper KIND_PRIORITY)
|
|
44
|
+
*/
|
|
45
|
+
import type { Plugin, HookContext, HookResult } from "../../agent/types";
|
|
46
|
+
import type { TaskOperation } from "../types";
|
|
47
|
+
/** 单 session(plugin 实例生命周期内)最大提醒次数 */
|
|
48
|
+
export declare const TASK_OP_WATERMARK_MAX_REMINDERS = 5;
|
|
49
|
+
/** 注入消息的总长度上限(字符) */
|
|
50
|
+
export declare const TASK_OP_WATERMARK_MESSAGE_LIMIT = 1500;
|
|
51
|
+
/** 兜底全量对账的工具调用间隔 */
|
|
52
|
+
export declare const TASK_OP_WATERMARK_AUDIT_INTERVAL = 15;
|
|
53
|
+
/**
|
|
54
|
+
* TaskComponent 只读能力面 —— 与 decision-hint-plugin 的
|
|
55
|
+
* `TaskComponentReadonly` 同款隔离模式(避免类型循环依赖)。
|
|
56
|
+
*/
|
|
57
|
+
export interface TaskOpWatermarkTaskComponentLike {
|
|
58
|
+
/** 按 session 反查绑定的**全部** task(多 task 并集水位,不漏报) */
|
|
59
|
+
getTaskIdsBySessionId?(sessionId: string): Promise<number[] | undefined>;
|
|
60
|
+
/** 老接口:只返回第一个 task(getTaskIdsBySessionId 未实现时的 fallback) */
|
|
61
|
+
getTaskIdBySessionId?(sessionId: string): Promise<number | undefined>;
|
|
62
|
+
getTask(id: number): Promise<{
|
|
63
|
+
id: number;
|
|
64
|
+
title: string;
|
|
65
|
+
} | undefined>;
|
|
66
|
+
/** 绕过 operationsCache 的 fresh 查询(可选 —— 能力探测) */
|
|
67
|
+
listOperationsFresh?(options: {
|
|
68
|
+
taskId: number;
|
|
69
|
+
limit?: number;
|
|
70
|
+
}): Promise<TaskOperation[]>;
|
|
71
|
+
/** 常规查询(fallback 路径用) */
|
|
72
|
+
listOperations(options: {
|
|
73
|
+
taskId: number;
|
|
74
|
+
limit?: number;
|
|
75
|
+
}): Promise<TaskOperation[]>;
|
|
76
|
+
/** 缓存失效(fallback 路径用;可选 —— 能力探测) */
|
|
77
|
+
invalidateOperationsCache?(taskId: number): void;
|
|
78
|
+
}
|
|
79
|
+
export interface TaskOpWatermarkPluginConfig {
|
|
80
|
+
/**
|
|
81
|
+
* 惰性解析 TaskComponent(推荐注入方式)。
|
|
82
|
+
*
|
|
83
|
+
* 为什么惰性:`registerAgent` 可能早于 TaskComponent 注册(时序风险),
|
|
84
|
+
* 惰性闭包把解析推迟到首次 `execute()`(env 组件已就绪)——
|
|
85
|
+
* 设计文档 §2.1 方案 (c)。
|
|
86
|
+
*/
|
|
87
|
+
resolveTaskComponent?: () => TaskOpWatermarkTaskComponentLike | undefined;
|
|
88
|
+
}
|
|
89
|
+
export declare class TaskOpWatermarkPlugin {
|
|
90
|
+
readonly name = "TaskOpWatermarkPlugin";
|
|
91
|
+
readonly version = "1.0.0";
|
|
92
|
+
readonly description = "Task #5081 \u2014 agent:after.tool \u6C34\u4F4D\u6BD4\u5BF9\uFF1A\u540C\u4E00 task \u51FA\u73B0\u4ED6\u4EBA\uFF08sessionId \u8FC7\u6EE4 + unknown \u8FC7\u6EE4\uFF09\u65B0\u589E\u7684 operation \u65F6\uFF0C\u7ECF\u5171\u4EAB meta-protocol \u6CE8\u5165 user role \u63D0\u9192\uFF08N \u805A 1 / \u9650\u6D41 5 / \u957F\u5EA6 1500 / 15 \u6B21\u515C\u5E95\u5BF9\u8D26 / fresh \u65C1\u8DEF\u7ED5 operationsCache\uFF09\u3002";
|
|
93
|
+
readonly priority = 40;
|
|
94
|
+
/** session 级水位(plugin 实例生命周期) */
|
|
95
|
+
private readonly watermarks;
|
|
96
|
+
private readonly resolveTaskComponent;
|
|
97
|
+
constructor(config?: TaskOpWatermarkPluginConfig);
|
|
98
|
+
execute(ctx: HookContext): Promise<HookResult>;
|
|
99
|
+
private check;
|
|
100
|
+
/** 自提醒过滤:自己写的 + unknown fallback 写入的都不算「别人的」 */
|
|
101
|
+
private isSelf;
|
|
102
|
+
private resolveTaskIds;
|
|
103
|
+
/**
|
|
104
|
+
* 拉取记录 —— fresh 优先(绕 operationsCache;跨进程写入可见),
|
|
105
|
+
* 能力探测失败降级 listOperations + invalidateOperationsCache。
|
|
106
|
+
*/
|
|
107
|
+
private listOps;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 创建 TaskOpWatermarkPlugin 实例(与 createMaxIterationReminderPlugin 同款形态)
|
|
111
|
+
*/
|
|
112
|
+
export declare function createTaskOpWatermarkPlugin(config?: TaskOpWatermarkPluginConfig): Plugin;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
1
|
+
import"../../../shared/@ai-setting/roy-agent-core-q813vafd.js";
|
|
2
2
|
import {
|
|
3
3
|
SQLiteTaskStore,
|
|
4
4
|
getDefaultDataDir,
|
|
5
5
|
getDefaultTaskDbPath
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-ezvpreqz.js";
|
|
7
7
|
import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
|
|
8
8
|
import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
|