@ai-setting/roy-agent-core 1.7.75 → 1.7.76

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.
Files changed (41) hide show
  1. package/dist/env/agent/agent-component.js +1 -1
  2. package/dist/env/agent/index.js +1 -1
  3. package/dist/env/event-source/event-source-handlers.js +5 -4
  4. package/dist/env/event-source/index.js +6 -5
  5. package/dist/env/index.js +11 -10
  6. package/dist/env/prompt/index.js +4 -3
  7. package/dist/env/prompt/prompts-index.d.ts +11 -9
  8. package/dist/env/task/backend/index.js +9 -1
  9. package/dist/env/task/delegate/delegate-tool.js +4 -3
  10. package/dist/env/task/delegate/index.js +4 -3
  11. package/dist/env/task/hooks/contexts.d.ts +12 -1
  12. package/dist/env/task/hooks/task-hook-points.d.ts +8 -3
  13. package/dist/env/task/index.d.ts +1 -0
  14. package/dist/env/task/index.js +15 -5
  15. package/dist/env/task/mcp/index.js +3 -2
  16. package/dist/env/task/plugins/index.js +4 -3
  17. package/dist/env/task/prompt/index.js +2 -1
  18. package/dist/env/task/prompt/task-discipline.d.ts +1 -1
  19. package/dist/env/task/task-component.d.ts +79 -0
  20. package/dist/env/task/tools/cancel-tool.d.ts +12 -4
  21. package/dist/env/task/tools/completion-copy.d.ts +92 -0
  22. package/dist/env/task/tools/index.d.ts +1 -0
  23. package/dist/env/task/tools/index.js +5 -2
  24. package/dist/env/task/tools/pre-complete-tool.d.ts +32 -0
  25. package/dist/env/task/tools/task-types.d.ts +49 -17
  26. package/dist/env/task/types.d.ts +13 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +21 -11
  29. package/dist/shared/@ai-setting/roy-agent-core-4rtg69cn.js +26 -0
  30. package/dist/shared/@ai-setting/{roy-agent-core-3e6gg17d.js → roy-agent-core-9vxh6f8h.js} +169 -30
  31. package/dist/shared/@ai-setting/{roy-agent-core-jg65qnwa.js → roy-agent-core-aa2j7bk9.js} +1 -1
  32. package/dist/shared/@ai-setting/{roy-agent-core-29b6hc39.js → roy-agent-core-cmprygrp.js} +1 -1
  33. package/dist/shared/@ai-setting/{roy-agent-core-n9q1encx.js → roy-agent-core-cxy143m4.js} +1 -1
  34. package/dist/shared/@ai-setting/{roy-agent-core-y7x2qzwc.js → roy-agent-core-ghnagzrh.js} +7 -3
  35. package/dist/shared/@ai-setting/{roy-agent-core-11shp00p.js → roy-agent-core-m46fe3x4.js} +21 -31
  36. package/dist/shared/@ai-setting/{roy-agent-core-djpq6yb0.js → roy-agent-core-q5r75vev.js} +1 -1
  37. package/dist/shared/@ai-setting/{roy-agent-core-60jbrfye.js → roy-agent-core-t3rrb959.js} +28 -4
  38. package/dist/shared/@ai-setting/{roy-agent-core-hnyk1by7.js → roy-agent-core-vffccgf6.js} +152 -33
  39. package/dist/shared/@ai-setting/{roy-agent-core-4gr3k7qg.js → roy-agent-core-z43aj03k.js} +120 -28
  40. package/dist/shared/@ai-setting/{roy-agent-core-snvh4s2p.js → roy-agent-core-zycadbpx.js} +1 -1
  41. package/package.json +1 -1
@@ -5,26 +5,32 @@ import {
5
5
  TaskPriorityEnum,
6
6
  TaskStatusEnum,
7
7
  TaskTypeEnum
8
- } from "../../shared/@ai-setting/roy-agent-core-4gr3k7qg.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-z43aj03k.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-2akfd64z.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-jm136jzh.js";
11
- import"../../shared/@ai-setting/roy-agent-core-jg65qnwa.js";
11
+ import"../../shared/@ai-setting/roy-agent-core-aa2j7bk9.js";
12
12
  import"../../shared/@ai-setting/roy-agent-core-fttgm52a.js";
13
13
  import"../../shared/@ai-setting/roy-agent-core-ntq0gz7q.js";
14
14
  import {
15
15
  TaskEntityEventTypes
16
16
  } from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
17
- import"../../shared/@ai-setting/roy-agent-core-hnyk1by7.js";
17
+ import"../../shared/@ai-setting/roy-agent-core-vffccgf6.js";
18
18
  import"../../shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
20
- import"../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
20
+ import"../../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
21
21
  import {
22
22
  SQLiteTaskStore,
23
23
  getDefaultTaskDbPath
24
24
  } from "../../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
25
25
  import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
26
26
  import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
27
- import"../../shared/@ai-setting/roy-agent-core-11shp00p.js";
27
+ import"../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
28
+ import {
29
+ TASK_ARCHIVED_STATUS_WORD,
30
+ TASK_CANCELLED_STATUS_WORD,
31
+ TASK_COMPLETED_STATUS_WORD,
32
+ TASK_DELIVERABLE_RECORDED
33
+ } from "../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
28
34
  import"../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
29
35
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
30
36
  import"../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
@@ -46,6 +52,10 @@ export {
46
52
  TaskEntityEventTypes,
47
53
  TaskConfigSchema,
48
54
  TaskComponent,
55
+ TASK_DELIVERABLE_RECORDED,
56
+ TASK_COMPLETED_STATUS_WORD,
57
+ TASK_CANCELLED_STATUS_WORD,
58
+ TASK_ARCHIVED_STATUS_WORD,
49
59
  SQLiteTaskStore,
50
60
  ActionTypeEnum
51
61
  };
@@ -6,13 +6,14 @@ import {
6
6
  searchTasksTool,
7
7
  treeTasksTool,
8
8
  updateTaskTool
9
- } from "../../../shared/@ai-setting/roy-agent-core-hnyk1by7.js";
9
+ } from "../../../shared/@ai-setting/roy-agent-core-vffccgf6.js";
10
10
  import {
11
11
  createOperationTool,
12
12
  listOperationsTool
13
13
  } from "../../../shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
15
- import"../../../shared/@ai-setting/roy-agent-core-11shp00p.js";
15
+ import"../../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
16
+ import"../../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
16
17
  import"../../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
17
18
  import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
18
19
  import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
@@ -24,18 +24,19 @@ import {
24
24
  parseExtractorOutput,
25
25
  registerLayaCompletionTaskHook,
26
26
  renderCompletionState
27
- } from "../../../shared/@ai-setting/roy-agent-core-y7x2qzwc.js";
27
+ } from "../../../shared/@ai-setting/roy-agent-core-ghnagzrh.js";
28
28
  import"../../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
29
- import"../../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
29
+ import"../../../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
30
30
  import"../../../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
31
31
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
32
32
  import"../../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
33
+ import"../../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
33
34
  import {
34
35
  TASK_COMPLETE_ACCEPTANCE,
35
36
  TASK_COMPLETE_ITEM_BY_ITEM,
36
37
  TASK_COMPLETE_VERIFY_DUTY,
37
38
  TASK_COMPLETION_HINT_ANCHOR
38
- } from "../../../shared/@ai-setting/roy-agent-core-11shp00p.js";
39
+ } from "../../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
39
40
  import {
40
41
  DEFAULT_APP_LINK_BASE,
41
42
  LarkCardPatchNotifier,
@@ -5,7 +5,8 @@ import {
5
5
  TASK_DISCIPLINE_LIFECYCLE,
6
6
  TASK_DISCIPLINE_OPERATION,
7
7
  TASK_DISCIPLINE_PROMPT
8
- } from "../../../shared/@ai-setting/roy-agent-core-11shp00p.js";
8
+ } from "../../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
9
+ import"../../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
9
10
  import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
10
11
  export {
11
12
  TASK_DISCIPLINE_PROMPT,
@@ -33,6 +33,6 @@ export declare const TASK_DISCIPLINE_GOALS = "### Goals \u5B50\u9879\u62C6\u5206
33
33
  * 执行方(roy sub-agent)**没有** `task_complete` 权限,不适用本分片。
34
34
  * 为避免执行方误读,段落开头显式声明「仅验收方适用」。
35
35
  */
36
- export declare const TASK_DISCIPLINE_COMPLETE = "### Task Complete \u2014 \u6838\u5B9E\u4E49\u52A1\uFF08**\u4EC5\u9A8C\u6536\u65B9\u9002\u7528**\uFF09\n\n> \u26A0\uFE0F **\u89D2\u8272\u4F5C\u7528\u57DF\uFF08Task #5007\uFF09**\uFF1A\u672C\u8282\u662F**\u9A8C\u6536\u65B9**\uFF08default agent / \u63A5\u5F85\u5458\uFF09\u7684\u52A8\u4F5C\u3002\n> \u82E5\u4F60\u662F**\u6267\u884C\u65B9**\uFF08roy sub-agent\uFF09\uFF0C\u4F60\u6CA1\u6709 `task_complete` \u6743\u9650 \u2014\u2014\n> \u4F60\u7684\u6536\u5C3E\u52A8\u4F5C\u662F\u300C\u8FDB\u5EA6\u63A8\u5230 100% + \u8BB0\u5B8C\u64CD\u4F5C\u8BB0\u5F55 + \u7ED3\u675F\u8FD4\u56DE\u300D\uFF0C\u9A8C\u6536\u7531\u4E3B\u667A\u80FD\u4F53\u8D1F\u8D23\u3002\n\nBefore calling `task_complete`, you MUST:\n\n1. Read the task's `goal` (description) and `delivery` (goals_and_expected_deliverables) fields.\n - Use `task_get(task_id=<id>)` to fetch the full task record.\n2. **Validate whether each goal sub-item was achieved** \u2014 accept the goal\n **item-by-item** (\u6309\u5B50\u9879\u9010\u6761\u9A8C\u6536).\n - Goals should be numbered sub-items (\u7F16\u53F7\u5B50\u9879). Check\n each sub-item against the operation-record chain (\u64CD\u4F5C\u8BB0\u5F55\u94FE) and the\n deliverable evidence (context.deliverable_storage_path).\n - The completion hook (task:after.complete) judges the whole goal vs.\n deliverables; numbered sub-items give it finer-grained evidence to\n reason with (\u9010\u6761\u5BF9\u7167\u7684\u8BC1\u636E\u7C92\u5EA6). If it detects that the goal or\n deliverables appear unmet, the task context will carry a\n `[TASK_COMPLETION_HINT]`.\n - **If you receive a [TASK_COMPLETION_HINT]**, you MUST verify it\n (\u6838\u5B9E\u4E49\u52A1): re-read the task via `task_get`, then do exactly one of:\n (a) \u786E\u8BA4\u672A\u5B8C\u6210 \u2192 **\u91CD\u65B0\u59D4\u6258**\uFF08\u7528\u4F60\u7684\u59D4\u6258\u5DE5\u5177 + \u540C\u4E00 sub-session \u7EED\u8DD1\uFF0C\n \u5728\u6307\u4EE4\u91CC\u5199\u660E\"\u76EE\u6807\u5C1A\u672A\u8FBE\u6210\uFF0C\u9700\u8981\u8865 X/Y/Z\"\uFF09\uFF0C\u7531 sub-agent \u7528\n `task_update(status=active)` \u91CD\u5F00\u5E76\u7EE7\u7EED\u63A8\u8FDB\uFF1B\u82E5\u4F60**\u81EA\u5DF1\u5C31\u662F\u6267\u884C\u65B9**\n \uFF08\u6709 `task_update` \u6743\u9650\uFF09\uFF0C\u5219\u76F4\u63A5 `task_update(status=todo)` \u91CD\u5F00\uFF1B\u6216\n (b) \u786E\u8BA4\u5DF2\u5B8C\u6210 \u2192 **\u7528\u4F60\u624B\u4E0A\u6709\u6743\u9650\u7684\u5199\u5DE5\u5177**\u843D\u4E00\u6761 `decision` \u7C7B\u64CD\u4F5C\u8BB0\u5F55\n \uFF08`task_operation_create`\uFF0Cmilestone_type=decision\uFF0Cmilestone_title=<\u4E00\u884C\u7ED3\u8BBA>\uFF09\n \u8BF4\u660E\u5B50\u9879\u5B9E\u9645\u5DF2\u8FBE\u6210\uFF08\u8BF4\u660E\u7406\u7531\uFF09\u3002\u82E5\u4F60\u6CA1\u6709\u8BE5\u5DE5\u5177\u7684\u6743\u9650\uFF08\u9A8C\u6536\u65B9\u573A\u666F\uFF09\uFF0C\n \u5C31\u901A\u8FC7\u4F60\u7684**\u59D4\u6258\u5DE5\u5177**\u8BA9 sub-agent \u4EE3\u5199\u8FD9\u6761\u8BB0\u5F55\uFF0C\u6216\u5728 `task_complete`\n \u7684 `deliverable_storage_path` / \u6700\u7EC8\u6C47\u62A5\u91CC\u660E\u786E\u5199\u51FA\u6838\u5B9E\u7ED3\u8BBA\u4E0E\u8BC1\u636E\u3002\n Never ignore it (\u4E0D\u5141\u8BB8\u65E0\u89C6).\n \u26A0\uFE0F **\u6838\u5B9E\u4E49\u52A1\u7684\u4E24\u6761\u8DEF\u5F84\u90FD\u4F9D\u8D56\u5199\u6743\u9650**\uFF08`task_update` / `task_operation_create`\uFF09\u3002\n \u82E5\u8FD9\u4E9B\u5DE5\u5177\u5BF9\u4F60**\u4E0D\u53EF\u7528**\uFF08\u5982\u9A8C\u6536\u65B9\u4E0D\u6301\u6709\u6267\u884C\u7C7B\u5DE5\u5177\uFF09\uFF0C\u5FC5\u987B**\u6539\u7528\u59D4\u6258**\u628A\u52A8\u4F5C\n \u4EA4\u56DE\u7ED9\u6709\u6743\u9650\u7684 sub-agent \u6267\u884C \u2014\u2014 \u4E0D\u8981\u8BD5\u56FE\u8C03\u7528\u4E0D\u53EF\u7528\u7684\u5DE5\u5177\uFF08\u4F1A\u88AB\u62E6\u6389\u5E76\u6D6A\u8D39\u4E00\u8F6E\u8FED\u4EE3\uFF09\u3002\n - If the goal and delivery mismatch **without** a hint, either:\n (a) extend the task via `task_update`, or\n (b) record the discrepancy via `task_operation_create`\n (milestone_type=decision) \u2014 the reason **must** land in the\n operation record (\u5FC5\u987B\u843D\u5230\u64CD\u4F5C\u8BB0\u5F55\u91CC), not merely a line in\n your final report (\u4E0D\u80FD\u53EA\u5728\u62A5\u544A\u91CC\u5E26\u4E00\u53E5).\n3. **Provide `deliverable_storage_path`** parameter with the deliverable's address.\n It may name **multiple paths** (multiple deliverables), space-separated\n (`/tmp/report.md /tmp/diff.patch`) \u2014 the judge splits on whitespace as\n well as `,` `;` `\u3001` and ` + `. A local path may also be written in its\n `file://` form (`file:///tmp/report.md`) \u2014 the scheme is stripped and the\n path kept. Declare **every** artefact you produced: a path left out reads\n as \"not produced\".\n - Feishu doc URL (e.g., https://my.feishu.cn/docx/abc)\n - Local file path (e.g., /tmp/report.md)\n - Git branch or worktree path (e.g., feature/my-feature)\n - GitHub commit URL or PR URL\n - Cloud drive URL (e.g., https://my.feishu.cn/file/abc)\n - Or any other locator that points to where the work product lives\n\nThe `deliverable_storage_path` will be persisted to the task's\n`context.deliverable_storage_path` for future reference and traceability.";
36
+ export declare const TASK_DISCIPLINE_COMPLETE = "### Task Complete \u2014 \u6838\u5B9E\u4E49\u52A1\uFF08**\u4EC5\u9A8C\u6536\u65B9\u9002\u7528**\uFF09\n\n> \u26A0\uFE0F **\u89D2\u8272\u4F5C\u7528\u57DF\uFF08Task #5007\uFF09**\uFF1A\u672C\u8282\u662F**\u9A8C\u6536\u65B9**\uFF08default agent / \u63A5\u5F85\u5458\uFF09\u7684\u52A8\u4F5C\u3002\n> \u82E5\u4F60\u662F**\u6267\u884C\u65B9**\uFF08roy sub-agent\uFF09\uFF0C\u4F60\u6CA1\u6709 `task_complete` \u6743\u9650 \u2014\u2014\n> \u4F60\u7684\u6536\u5C3E\u52A8\u4F5C\u662F\u300C\u8FDB\u5EA6\u63A8\u5230 100% + \u8BB0\u5B8C\u64CD\u4F5C\u8BB0\u5F55 + \u7ED3\u675F\u8FD4\u56DE\u300D\uFF0C\u9A8C\u6536\u7531\u4E3B\u667A\u80FD\u4F53\u8D1F\u8D23\u3002\n\nBefore calling `task_complete`, you MUST:\n\n1. Read the task's `goal` (description) and `delivery` (goals_and_expected_deliverables) fields.\n - Use `task_get(task_id=<id>)` to fetch the full task record.\n2. **Validate whether each goal sub-item was achieved** \u2014 accept the goal\n **item-by-item** (\u6309\u5B50\u9879\u9010\u6761\u9A8C\u6536).\n - Goals should be numbered sub-items (\u7F16\u53F7\u5B50\u9879). Check\n each sub-item against the operation-record chain (\u64CD\u4F5C\u8BB0\u5F55\u94FE) and the\n deliverable evidence (context.deliverable_storage_path).\n - The completion hook (task:after.complete) judges the whole goal vs.\n deliverables; numbered sub-items give it finer-grained evidence to\n reason with (\u9010\u6761\u5BF9\u7167\u7684\u8BC1\u636E\u7C92\u5EA6). If it detects that the goal or\n deliverables appear unmet, the task context will carry a\n `[TASK_COMPLETION_HINT]`.\n - **If you receive a [TASK_COMPLETION_HINT]**, you MUST verify it\n (\u6838\u5B9E\u4E49\u52A1): re-read the task via `task_get`, then do exactly one of:\n (a) \u786E\u8BA4\u672A\u5B8C\u6210 \u2192 **\u91CD\u65B0\u59D4\u6258**\uFF08\u7528\u4F60\u7684\u59D4\u6258\u5DE5\u5177 + \u540C\u4E00 sub-session \u7EED\u8DD1\uFF0C\n \u5728\u6307\u4EE4\u91CC\u5199\u660E\"\u76EE\u6807\u5C1A\u672A\u8FBE\u6210\uFF0C\u9700\u8981\u8865 X/Y/Z\"\uFF09\uFF0C\u7531 sub-agent \u7528\n `task_update(status=active)` \u91CD\u5F00\u5E76\u7EE7\u7EED\u63A8\u8FDB\uFF1B\u82E5\u4F60**\u81EA\u5DF1\u5C31\u662F\u6267\u884C\u65B9**\n \uFF08\u6709 `task_update` \u6743\u9650\uFF09\uFF0C\u5219\u76F4\u63A5 `task_update(status=todo)` \u91CD\u5F00\uFF1B\u6216\n (b) \u786E\u8BA4\u5DF2\u5B8C\u6210 \u2192 **\u7528\u4F60\u624B\u4E0A\u6709\u6743\u9650\u7684\u5199\u5DE5\u5177**\u843D\u4E00\u6761 `decision` \u7C7B\u64CD\u4F5C\u8BB0\u5F55\n \uFF08`task_operation_create`\uFF0Cmilestone_type=decision\uFF0Cmilestone_title=<\u4E00\u884C\u7ED3\u8BBA>\uFF09\n \u8BF4\u660E\u5B50\u9879\u5B9E\u9645\u5DF2\u8FBE\u6210\uFF08\u8BF4\u660E\u7406\u7531\uFF09\u3002\u82E5\u4F60\u6CA1\u6709\u8BE5\u5DE5\u5177\u7684\u6743\u9650\uFF08\u9A8C\u6536\u65B9\u573A\u666F\uFF09\uFF0C\n \u5C31\u901A\u8FC7\u4F60\u7684**\u59D4\u6258\u5DE5\u5177**\u8BA9 sub-agent \u4EE3\u5199\u8FD9\u6761\u8BB0\u5F55\uFF0C\u6216\u5728\u6700\u7EC8\u6C47\u62A5\u91CC\n \u660E\u786E\u5199\u51FA\u6838\u5B9E\u7ED3\u8BBA\u4E0E\u8BC1\u636E\u3002\n Never ignore it (\u4E0D\u5141\u8BB8\u65E0\u89C6).\n \u26A0\uFE0F **\u6838\u5B9E\u4E49\u52A1\u7684\u4E24\u6761\u8DEF\u5F84\u90FD\u4F9D\u8D56\u5199\u6743\u9650**\uFF08`task_update` / `task_operation_create`\uFF09\u3002\n \u82E5\u8FD9\u4E9B\u5DE5\u5177\u5BF9\u4F60**\u4E0D\u53EF\u7528**\uFF08\u5982\u9A8C\u6536\u65B9\u4E0D\u6301\u6709\u6267\u884C\u7C7B\u5DE5\u5177\uFF09\uFF0C\u5FC5\u987B**\u6539\u7528\u59D4\u6258**\u628A\u52A8\u4F5C\n \u4EA4\u56DE\u7ED9\u6709\u6743\u9650\u7684 sub-agent \u6267\u884C \u2014\u2014 \u4E0D\u8981\u8BD5\u56FE\u8C03\u7528\u4E0D\u53EF\u7528\u7684\u5DE5\u5177\uFF08\u4F1A\u88AB\u62E6\u6389\u5E76\u6D6A\u8D39\u4E00\u8F6E\u8FED\u4EE3\uFF09\u3002\n - If the goal and delivery mismatch **without** a hint, either:\n (a) extend the task via `task_update`, or\n (b) record the discrepancy via `task_operation_create`\n (milestone_type=decision) \u2014 the reason **must** land in the\n operation record (\u5FC5\u987B\u843D\u5230\u64CD\u4F5C\u8BB0\u5F55\u91CC), not merely a line in\n your final report (\u4E0D\u80FD\u53EA\u5728\u62A5\u544A\u91CC\u5E26\u4E00\u53E5).\n3. Deliverables were submitted by the executor via `task_pre_complete`\n (Task #5073 two-phase acceptance): they live in\n `context.deliverable_storage_path` and the operation trail\n (`Deliverable: <path>` lines). Cross-check them in step 2.\n `task_complete` takes **no** deliverable parameter \u2014 if the\n deliverables are missing from the record, re-delegate instead of\n asking for a path here.";
37
37
  /** 完整纪律正文(主出口):4 分片拼装 */
38
38
  export declare const TASK_DISCIPLINE_PROMPT: string;
@@ -213,6 +213,54 @@ export declare class TaskComponent extends BaseComponent {
213
213
  operations: TaskOperation[];
214
214
  task: Task;
215
215
  }) | undefined>;
216
+ /**
217
+ * ★ Task #5063 — 终态 current_status 收口辅助(**唯一**措辞/规则来源)
218
+ *
219
+ * 规则(测试锁死,勿改):
220
+ * 1. **只在 status 迁移到终态时**补 current_status
221
+ * —— 非终态(todo/active/paused)原样返回,不碰 current_status。
222
+ * (否则会破坏 `task_update(current_status="推进中")` 这类合法用法。)
223
+ * 2. **调用方显式传了 current_status 就尊重调用方**,不覆盖
224
+ * —— completeTask / cancelTaskTool 已在自己的调用里写好了带
225
+ * deliverable / reason 的终态文案,不能被这里冲掉。
226
+ * 3. 只认**本次更新要落**的 status —— `status` 缺省时一律不动。
227
+ *
228
+ * 终态集合与措辞:
229
+ * - completed → TASK_COMPLETED_STATUS_WORD(但 completeTask 自己写了带
230
+ * deliverable 的版本,走的是规则 2「尊重调用方」,不受这里影响)
231
+ * - cancelled → TASK_CANCELLED_STATUS_WORD
232
+ * - archived → TASK_ARCHIVED_STATUS_WORD
233
+ *
234
+ * ⚠️ 与 TASK_COMPLETE_TERMINAL_STATUSES(hooks/contexts.ts)**故意不同**:
235
+ * 那个集合决定「要不要 fire AFTER_COMPLETE 钩子」(archived 不 fire);
236
+ * 这个集合决定「要不要刷新 current_status」(archived 要刷)。
237
+ * 两者语义正交,别合并。
238
+ *
239
+ * ★ Task #5067 — 新增**反向**收口(reopen:终态 → 非终态)
240
+ *
241
+ * #5063 只管「迁入终态」。反向路径没管 ⇒ 任务从终态被 reopen 回
242
+ * active/todo 时,current_status 仍停在终态文案("已归档"/"已取消"/"已完成"),
243
+ * 出现「status: active 但 current_status: 已归档」的自相矛盾状态。
244
+ *
245
+ * 规则 4(新增,测试锁死):
246
+ * **从终态迁出到非终态,且当前 current_status 是系统写的终态文案时,
247
+ * 把 current_status 换成 reopen 措辞。**
248
+ *
249
+ * 为什么这不违反规则 1:
250
+ * 规则 1 说的「非终态迁移不碰 current_status」指的是**普通进度更新**
251
+ * (如 `task_update(current_status="推进中")`)—— 那必须保留调用方
252
+ * 显式传的值。而 reopen 时 current_status 里留着的是**系统自己写的
253
+ * 终态文案**,不是调用方的意图 ⇒ 这种情况**应该**被刷新。
254
+ *
255
+ * 判定用「值比对 + 前态 status」双条件(修法 A 增强版):
256
+ * - 值比对:current_status 以某个终态锚点**开头**(TASK_TERMINAL_STATUS_WORDS)
257
+ * - 前态 status:任务**当前**确实处于终态(archived/cancelled/completed)
258
+ * 两个条件同时成立才替换。为什么要加「前态」条件:
259
+ * 只看值的话,active 任务上手写的「已完成的部分:A/B/C」会被误判
260
+ * 成陈旧终态文案而被冲掉。加上前态判定后,只有**真的从终态迁出**
261
+ * 时才动 —— 把误伤面压到极窄。
262
+ */
263
+ private withTerminalCurrentStatus;
216
264
  /**
217
265
  * Update task
218
266
  */
@@ -278,6 +326,37 @@ export declare class TaskComponent extends BaseComponent {
278
326
  * @returns 更新后的 Task,任务不存在时返回 undefined
279
327
  */
280
328
  updateTaskContext(id: number, context: string): Promise<Task | undefined>;
329
+ /**
330
+ * ★ Task #5073 — 提交待验证(两阶段验收的第一阶段)
331
+ *
332
+ * 需求(用户 2026-11-06 飞书):sub-agent 觉得可以完成了,
333
+ * 传交付物等参数调 task_pre_complete → task 状态变为 to_validate;
334
+ * default agent 调 task_complete 校验之后状态正式 completed。
335
+ *
336
+ * 语义要点:
337
+ * - to_validate **不是终态**:
338
+ * - 不加入 isTerminalTaskStatus(reopen 反向收口不管它)
339
+ * - 卡片(lark 插件)保持 running 更新态(cardStatusOf 不识别
340
+ * to_validate → 走 sendCardUpdate 普通 patch,不 unpin)
341
+ * - ★ 设计调整②(38603):preCompleteTask 在 updateTask 后**显式
342
+ * fire 一次 AFTER_COMPLETE**(goal 检查自查关,terminalStatus=
343
+ * to_validate);updateTask 本体已**不再**触发 AFTER_COMPLETE
344
+ * (见 updateTask 注释),本钩子的触发点唯一 = preCompleteTask。
345
+ * - current_status 同步(#5060 收口模式):措辞同源锚点
346
+ * TASK_TO_VALIDATE_STATUS_WORD =「待验证」,调用方传了
347
+ * progressSummary 就带上(「待验证:<summary>」)
348
+ * - 交付物双写(#2778 v2 同模式):context.deliverable_storage_path
349
+ * + operation 的 Deliverable 行
350
+ * - 幂等:重复提交安全(后一次覆盖前一次的 current_status /
351
+ * deliverable,operation 各自留痕)
352
+ *
353
+ * @param id 任务 ID
354
+ * @param sessionId 当前 session ID
355
+ * @param deliverableStoragePath 可选,交付物寻址地址
356
+ * @param progressSummary 可选,本次交付的进展摘要(拼进 current_status)
357
+ * @returns 更新后的 Task 或 undefined
358
+ */
359
+ preCompleteTask(id: number, sessionId: string, deliverableStoragePath?: string, progressSummary?: string): Promise<Task | undefined>;
281
360
  /**
282
361
  * Create operation record
283
362
  */
@@ -7,7 +7,13 @@
7
7
  * 且 sub-agent 超时 / 未更新状态时任务状态会长期不同步。
8
8
  * 调整后 default agent 承担验收:
9
9
  * - task_complete —— 核对产出后判定完成(触发 goal 检查 decision model)
10
- * - task_cancel —— 验收不通过 / 用户要求时取消任务
10
+ * - task_cancel —— **仅在用户明令取消时**取消任务
11
+ *
12
+ * 语义边界(Task #5055,用户明令):
13
+ * task_cancel 是**用户明令**才能调的 —— 用户说"取消 / 停掉这个任务"。
14
+ * 失败 / 超时 ≠ 取消:正确的出路是找根因 → 提修复方案 → 重新委托
15
+ * (可用 sub_session_id 续跑)→ 实在推不动就如实告知用户、等用户决定,
16
+ * **不自行 cancel**。
11
17
  *
12
18
  * 本工具的职责边界:
13
19
  * - **取消 Task 本身**(task.status = "cancelled")
@@ -15,9 +21,11 @@
15
21
  * task_cancel 停 Task 记录)。两者正交,default agent 可能需要连用:
16
22
  * 先 stop_task 掐掉还在跑的 sub-agent,再 task_cancel 取消任务记录。
17
23
  *
18
- * 终态 hook:`cancelled` 属于 TASK_COMPLETE_TERMINAL_STATUSES
19
- * ⇒ 走 taskComponent.updateTask ⇒ 自动 fire AFTER_COMPLETE
20
- * ⇒ 飞书终态通知 / lark-card 状态机正常收敛,无需额外接线。
24
+ * 终态 hook:`cancelled` 属于 TASK_COMPLETE_TERMINAL_STATUSES。
25
+ * ⚠️ Task #5073 设计调整②:updateTask **不再** fire
26
+ * AFTER_COMPLETE —— 终态通知走 task:after.update
27
+ * (lark-card 状态机 cardStatusOf 覆盖 completed/cancelled/
28
+ * archived 等),本工具无需额外接线。
21
29
  */
22
30
  import type { Tool } from "../../tool/types";
23
31
  import type { TaskComponent } from "../task-component";
@@ -25,3 +25,95 @@ export declare const TASK_COMPLETE_ACCEPTANCE: {
25
25
  readonly hintAnchor: "TASK_COMPLETION_HINT";
26
26
  readonly verifyDuty: "核实义务";
27
27
  };
28
+ /**
29
+ * Task #5060 — 终态 current_status 文案同源锚点
30
+ *
31
+ * 背景:`task_complete` / `task_cancel` 原来只改 status/progress,
32
+ * **完全不碰 current_status** ⇒ 任务落终态后 current_status 仍留着
33
+ * 完成前的旧文案(如「按用户方案 X 决定暂停:未 commit」),出现
34
+ * 「status=completed 但描述说没做完」的自相矛盾状态。
35
+ *
36
+ * 修复:终态工具在同一次 updateTask 里把 current_status 一起写成终态语义。
37
+ * 下面的短语是「终态 current_status」的**唯一措辞来源** ——
38
+ * task-component(完成)/ cancel-tool(取消)都引用它,避免两处漂移。
39
+ */
40
+ /** 完成态 current_status 的核心语义词 */
41
+ export declare const TASK_COMPLETED_STATUS_WORD = "\u5DF2\u5B8C\u6210";
42
+ /** 取消态 current_status 的核心语义词 */
43
+ export declare const TASK_CANCELLED_STATUS_WORD = "\u5DF2\u53D6\u6D88";
44
+ /** 交付物已记录的前缀(跟在终态词之后) */
45
+ export declare const TASK_DELIVERABLE_RECORDED = "\u4EA4\u4ED8\u7269\u5DF2\u8BB0\u5F55";
46
+ /**
47
+ * Task #5063 — 归档态 current_status 的核心语义词
48
+ *
49
+ * 背景(Task #5060 的 follow-up,DS review 留档 MINOR m2):
50
+ * `archived` 是「终态 current_status 不刷新」这个 bug 的**第四个出口**。
51
+ * #5060 只修了 completed / cancelled 两条路径,导致走归档路径
52
+ * (`tasks complete --archive`、批量归档工具、通用 task_update)
53
+ * 的任务完成后 current_status 仍留着归档前的旧文案。
54
+ *
55
+ * 本锚点与 TASK_COMPLETED_STATUS_WORD / TASK_CANCELLED_STATUS_WORD 并列,
56
+ * 是「归档态 current_status」的**唯一措辞来源**。
57
+ */
58
+ export declare const TASK_ARCHIVED_STATUS_WORD = "\u5DF2\u5F52\u6863";
59
+ /**
60
+ * Task #5067 — reopen(终态 → 非终态)后 current_status 的核心语义词
61
+ *
62
+ * 背景(Task #5063 DS review 留档 MINOR m1):
63
+ * #5063 只收口了「**迁入**终态时刷新 current_status」,**反向**路径没管:
64
+ * 任务从终态被 reopen 回 active/todo 时,current_status 仍停在终态文案
65
+ * ("已归档" / "已取消" / "已完成")⇒ 出现
66
+ * status: active / current_status: "已归档" ← 说反了
67
+ *
68
+ * 为什么措辞是「已重新打开」而不是清空:
69
+ * 卡片渲染(lark-card-patch-notifier.ts)与 CLI(tasks get / tasks search)
70
+ * 都用 `if (current_status)` 守卫 —— **空串会让整行消失**,用户看到的是
71
+ * 一张没有「📶 当前状态」行的卡片,而不是「已重新打开」。
72
+ * 「已重新打开」非空、可渲染、语义明确(区别于「已完成」这类终态词)。
73
+ */
74
+ export declare const TASK_REOPENED_STATUS_WORD = "\u5DF2\u91CD\u65B0\u6253\u5F00";
75
+ /**
76
+ * Task #5073 — 待验证(to_validate)current_status 的核心语义词
77
+ *
78
+ * 两阶段验收(#5007 的机制化落地):
79
+ * sub-agent 干完 → `task_pre_complete` → status=to_validate,
80
+ * current_status 刷成「待验证」;default agent `task_complete`
81
+ * 校验通过后才落 completed(措辞 TASK_COMPLETED_STATUS_WORD)。
82
+ *
83
+ * 与终态措辞(TASK_COMPLETED_STATUS_WORD 等)并列但**不入**
84
+ * TASK_TERMINAL_STATUS_WORDS —— to_validate 是**非终态**
85
+ * (reopen 反向收口管不着它:从 to_validate 迁出时 current_status
86
+ * 本来就该带「待验证」语义,由 withTerminalCurrentStatus 的
87
+ * 非终态分支按调用方意图处理)。
88
+ */
89
+ export declare const TASK_TO_VALIDATE_STATUS_WORD = "\u5F85\u9A8C\u8BC1";
90
+ /**
91
+ * Task #5067 — 终态 current_status 措辞锚点集合(reopen 判定的**唯一**依据)
92
+ *
93
+ * 用途:`withTerminalCurrentStatus` 在「迁出终态」时,需要判断当前
94
+ * current_status 是不是**系统写的终态文案**(而不是调用方自己写的)。
95
+ * 判定方式 = current_status 以本集合中任一锚点**开头**。
96
+ *
97
+ * ⚠️ 为什么用 startsWith 而不是 includes:
98
+ * 终态文案可能带后缀(如「已归档:批量整理」「已完成(交付物已记录:/x.md)」),
99
+ * 但**开头**的锚点才是系统写的语义主体。反过来,包含判断会误伤
100
+ * 调用方自己写的「已完成的部分:A/B/C」这类正常文案。
101
+ *
102
+ * ⚠️ 边界取舍(已知且接受):
103
+ * 若调用方**恰好手动写了**以「已完成」/「已取消」/「已归档」开头的文案,
104
+ * 且任务当时正处于终态,reopen 时该文案会被系统措辞替换。
105
+ * 这是「值比对」方案的固有代价 —— 用「前态 status 是终态」这一额外条件
106
+ * 把它压到极窄(只在真的从终态迁出、且文案形状与系统措辞完全一致时触发)。
107
+ */
108
+ export declare const TASK_TERMINAL_STATUS_WORDS: readonly ["已完成", "已取消", "已归档"];
109
+ /**
110
+ * ★ Task #5073(DS review r4 MINOR-3)— 终态护栏集合的同源锚点:
111
+ * 已终态(cancelled / archived)任务**不可**被「验收通过」翻转成
112
+ * completed。消费点:TaskComponent.completeTask(组件层护栏,
113
+ * 兜底 CLI / 直连通道)+ complete-tool.ts(tool 层友好报错)。
114
+ *
115
+ * ⚠️ to_validate / active / todo / paused **不在**集合里 ——
116
+ * 规范路径 to_validate → completed 与兜底路径 active →
117
+ * completed(#5054 补验收)都必须放行。
118
+ */
119
+ export declare const TERMINAL_NON_ACCEPTABLE_STATUSES: readonly ["cancelled", "archived"];
@@ -11,4 +11,5 @@ export { updateTaskTool } from "./update-tool";
11
11
  export { deleteTaskTool } from "./delete-tool";
12
12
  export { completeTaskTool } from "./complete-tool";
13
13
  export { cancelTaskTool } from "./cancel-tool";
14
+ export { preCompleteTaskTool } from "./pre-complete-tool";
14
15
  export { treeTasksTool } from "./task-tree-tool";
@@ -7,12 +7,14 @@ import {
7
7
  deleteTaskTool,
8
8
  getTaskTool,
9
9
  listTasksTool,
10
+ preCompleteTaskTool,
10
11
  searchTasksTool,
11
12
  treeTasksTool,
12
13
  updateTaskTool
13
- } from "../../../shared/@ai-setting/roy-agent-core-hnyk1by7.js";
14
+ } from "../../../shared/@ai-setting/roy-agent-core-vffccgf6.js";
14
15
  import"../../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
15
- import"../../../shared/@ai-setting/roy-agent-core-11shp00p.js";
16
+ import"../../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
17
+ import"../../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
16
18
  import"../../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
17
19
  import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
18
20
  import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
@@ -22,6 +24,7 @@ export {
22
24
  updateTaskTool,
23
25
  treeTasksTool,
24
26
  searchTasksTool,
27
+ preCompleteTaskTool,
25
28
  listTasksTool,
26
29
  getTaskTool,
27
30
  deleteTaskTool,
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @fileoverview Task Pre-Complete Tool (Task #5073 — 两阶段验收)
3
+ *
4
+ * 需求(用户 2026-11-06 飞书原话):
5
+ * 「给 subagent 添加一个跟 task_complete 类似的工具,比如
6
+ * task_pre_complete,sub agent 觉得可以完成了就传入交付物等参数,
7
+ * task 状态变为待验证(to_validate),default agent 调用
8
+ * task_complete 校验之后状态正式完成。」
9
+ *
10
+ * 职责边界(沿用 #5007「执行与验收分离」架构):
11
+ * - **执行方(roy sub-agent)**:干完活 → task_pre_complete 提交待验证
12
+ * (status → to_validate + 交付物落 context/operation)
13
+ * - **验收方(default agent)**:task_complete 逐条验收 → completed
14
+ *
15
+ * 与 task_complete 的关系:
16
+ * - 参数同构(deliverable_storage_path),调用体验一致
17
+ * - 语义不同:这里只是「提交待验证」,不是终态 —— 会 fire 一次
18
+ * AFTER_COMPLETE(terminalStatus="to_validate")作为 goal 检查
19
+ * 自查关(design v2 #38603),卡片保持 running 更新态
20
+ *
21
+ * current_status 同步:走 TaskComponent.preCompleteTask →
22
+ * updateTask(withTerminalCurrentStatus 收口模式之外的本层显式文案,
23
+ * 措辞同源锚点 TASK_TO_VALIDATE_STATUS_WORD = 「待验证」,
24
+ * 见 tools/completion-copy.ts —— 与 #5060 的 completed/cancelled 同模式)。
25
+ */
26
+ import type { Tool } from "../../tool/types";
27
+ import type { TaskComponent } from "../task-component";
28
+ /**
29
+ * task_pre_complete 工具描述(导出便于单测和 reuse)
30
+ */
31
+ export declare const TASK_PRE_COMPLETE_DESCRIPTION: string;
32
+ export declare function preCompleteTaskTool(taskComponent: TaskComponent): Tool;
@@ -87,7 +87,7 @@ export type GetTaskToolParams = z.infer<typeof GetTaskToolSchema>;
87
87
  * task_list tool parameters
88
88
  */
89
89
  export declare const ListTasksToolSchema: z.ZodObject<{
90
- status: z.ZodOptional<z.ZodEnum<["todo", "active", "completed", "paused", "cancelled", "archived"]>>;
90
+ status: z.ZodOptional<z.ZodEnum<["todo", "active", "to_validate", "completed", "paused", "cancelled", "archived"]>>;
91
91
  priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
92
92
  type: z.ZodOptional<z.ZodEnum<["normal", "cycle", "longterm"]>>;
93
93
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
@@ -99,12 +99,12 @@ export declare const ListTasksToolSchema: z.ZodObject<{
99
99
  offset: number;
100
100
  include_archived: boolean;
101
101
  type?: "normal" | "cycle" | "longterm" | undefined;
102
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
102
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
103
103
  priority?: "low" | "medium" | "high" | undefined;
104
104
  depth?: number | undefined;
105
105
  }, {
106
106
  type?: "normal" | "cycle" | "longterm" | undefined;
107
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
107
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
108
108
  priority?: "low" | "medium" | "high" | undefined;
109
109
  limit?: number | undefined;
110
110
  offset?: number | undefined;
@@ -119,7 +119,7 @@ export declare const SearchTasksToolSchema: z.ZodObject<{
119
119
  keywords: z.ZodArray<z.ZodString, "many">;
120
120
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
121
121
  offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
122
- status: z.ZodOptional<z.ZodEnum<["todo", "active", "completed", "paused", "cancelled", "archived"]>>;
122
+ status: z.ZodOptional<z.ZodEnum<["todo", "active", "to_validate", "completed", "paused", "cancelled", "archived"]>>;
123
123
  priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
124
124
  type: z.ZodOptional<z.ZodEnum<["normal", "cycle", "longterm"]>>;
125
125
  exclude_task_id: z.ZodOptional<z.ZodNumber>;
@@ -131,14 +131,14 @@ export declare const SearchTasksToolSchema: z.ZodObject<{
131
131
  include_archived: boolean;
132
132
  keywords: string[];
133
133
  type?: "normal" | "cycle" | "longterm" | undefined;
134
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
134
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
135
135
  priority?: "low" | "medium" | "high" | undefined;
136
136
  depth?: number | undefined;
137
137
  exclude_task_id?: number | undefined;
138
138
  }, {
139
139
  keywords: string[];
140
140
  type?: "normal" | "cycle" | "longterm" | undefined;
141
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
141
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
142
142
  priority?: "low" | "medium" | "high" | undefined;
143
143
  limit?: number | undefined;
144
144
  offset?: number | undefined;
@@ -155,7 +155,7 @@ export declare const UpdateTaskToolSchema: z.ZodEffects<z.ZodObject<{
155
155
  } & {
156
156
  title: z.ZodOptional<z.ZodString>;
157
157
  description: z.ZodOptional<z.ZodString>;
158
- status: z.ZodOptional<z.ZodEnum<["todo", "active", "completed", "paused", "cancelled", "archived"]>>;
158
+ status: z.ZodOptional<z.ZodEnum<["todo", "active", "to_validate", "completed", "paused", "cancelled", "archived"]>>;
159
159
  priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
160
160
  type: z.ZodOptional<z.ZodEnum<["normal", "cycle", "longterm"]>>;
161
161
  progress: z.ZodOptional<z.ZodNumber>;
@@ -169,7 +169,7 @@ export declare const UpdateTaskToolSchema: z.ZodEffects<z.ZodObject<{
169
169
  }, "strip", z.ZodTypeAny, {
170
170
  task_id: number;
171
171
  type?: "normal" | "cycle" | "longterm" | undefined;
172
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
172
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
173
173
  tags?: string[] | undefined;
174
174
  description?: string | undefined;
175
175
  progress?: number | undefined;
@@ -184,7 +184,7 @@ export declare const UpdateTaskToolSchema: z.ZodEffects<z.ZodObject<{
184
184
  }, {
185
185
  task_id: number;
186
186
  type?: "normal" | "cycle" | "longterm" | undefined;
187
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
187
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
188
188
  tags?: string[] | undefined;
189
189
  description?: string | undefined;
190
190
  progress?: number | undefined;
@@ -199,7 +199,7 @@ export declare const UpdateTaskToolSchema: z.ZodEffects<z.ZodObject<{
199
199
  }>, {
200
200
  task_id: number;
201
201
  type?: "normal" | "cycle" | "longterm" | undefined;
202
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
202
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
203
203
  tags?: string[] | undefined;
204
204
  description?: string | undefined;
205
205
  progress?: number | undefined;
@@ -228,26 +228,58 @@ export type DeleteTaskToolParams = z.infer<typeof DeleteTaskToolSchema>;
228
228
  * task_complete tool parameters
229
229
  *
230
230
  * Task #2778: 新增 deliverable_storage_path 参数。
231
- * 调用方在完成任务时,应提供实际交付物的寻址地址,便于后续追溯。
231
+ * Task #5073 设计调整① — task_complete 精简为**纯验收动作**:
232
232
  *
233
- * 支持任意形式的寻址:本地文件路径 / 飞书 doc URL / git 分支名 / GitHub PR/commit URL。
234
- * 该参数会持久化到 task.context.deliverable_storage_path。
233
+ * deliverable_storage_path 入参已删除(用户 2026-11-06 明令)。
234
+ * 交付物在 pre_complete 阶段(task_pre_complete)提交落库
235
+ * (task.context.deliverable_storage_path + operation Deliverable 行),
236
+ * task_complete 只做状态修改验收:逐条核对 goals 子项后
237
+ * 把 to_validate → completed(TASK_COMPLETION_TERMINAL)。
238
+ *
239
+ * ⚠️ 交付物通道 = task_pre_complete,验收通道 = task_complete ——
240
+ * 两者职责分离后,交付物参数不该再出现在 complete 的 schema 里。
241
+ *
242
+ * 兼容性:unknown-key 被 zod 静默剥离(withLegacyTaskId 的 object
243
+ * 不含 additionalProperties:false)→ 老调用方传了 deliverable 也
244
+ * 不报错,只是不再被读取。CLI / TaskStoreBackend(MCP 通道)的
245
+ * completeTask(deliverable) 底层签名保留(#5060 修复链不破坏)。
235
246
  */
236
247
  export declare const CompleteTaskToolSchema: z.ZodEffects<z.ZodObject<{
237
248
  task_id: z.ZodNumber;
249
+ }, "strip", z.ZodTypeAny, {
250
+ task_id: number;
251
+ }, {
252
+ task_id: number;
253
+ }>, {
254
+ task_id: number;
255
+ }, unknown>;
256
+ export type CompleteTaskToolParams = z.infer<typeof CompleteTaskToolSchema>;
257
+ /**
258
+ * task_pre_complete tool parameters (Task #5073 — 两阶段验收)
259
+ *
260
+ * sub-agent 交付时调用:把任务置为 to_validate(待验证),
261
+ * 交付物参数与 task_complete 完全同构(deliverable_storage_path),
262
+ * 让执行方「提交待验证」的调用体验与验收方「落终态」一致。
263
+ */
264
+ export declare const PreCompleteTaskToolSchema: z.ZodEffects<z.ZodObject<{
265
+ task_id: z.ZodNumber;
238
266
  } & {
239
267
  deliverable_storage_path: z.ZodOptional<z.ZodString>;
268
+ current_status: z.ZodOptional<z.ZodString>;
240
269
  }, "strip", z.ZodTypeAny, {
241
270
  task_id: number;
271
+ current_status?: string | undefined;
242
272
  deliverable_storage_path?: string | undefined;
243
273
  }, {
244
274
  task_id: number;
275
+ current_status?: string | undefined;
245
276
  deliverable_storage_path?: string | undefined;
246
277
  }>, {
247
278
  task_id: number;
279
+ current_status?: string | undefined;
248
280
  deliverable_storage_path?: string | undefined;
249
281
  }, unknown>;
250
- export type CompleteTaskToolParams = z.infer<typeof CompleteTaskToolSchema>;
282
+ export type PreCompleteTaskToolParams = z.infer<typeof PreCompleteTaskToolSchema>;
251
283
  /**
252
284
  * task_cancel tool parameters (Task #5007)
253
285
  *
@@ -304,7 +336,7 @@ export type BatchDeleteToolParams = z.infer<typeof BatchDeleteToolSchema>;
304
336
  export declare const TreeTasksToolSchema: z.ZodObject<{
305
337
  depth: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
306
338
  parent_task_id: z.ZodOptional<z.ZodNumber>;
307
- status: z.ZodOptional<z.ZodEnum<["todo", "active", "completed", "paused", "cancelled", "archived"]>>;
339
+ status: z.ZodOptional<z.ZodEnum<["todo", "active", "to_validate", "completed", "paused", "cancelled", "archived"]>>;
308
340
  priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
309
341
  type: z.ZodOptional<z.ZodEnum<["normal", "cycle", "longterm"]>>;
310
342
  include_archived: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -312,12 +344,12 @@ export declare const TreeTasksToolSchema: z.ZodObject<{
312
344
  depth: number;
313
345
  include_archived: boolean;
314
346
  type?: "normal" | "cycle" | "longterm" | undefined;
315
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
347
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
316
348
  priority?: "low" | "medium" | "high" | undefined;
317
349
  parent_task_id?: number | undefined;
318
350
  }, {
319
351
  type?: "normal" | "cycle" | "longterm" | undefined;
320
- status?: "todo" | "active" | "completed" | "paused" | "cancelled" | "archived" | undefined;
352
+ status?: "todo" | "active" | "to_validate" | "completed" | "paused" | "cancelled" | "archived" | undefined;
321
353
  priority?: "low" | "medium" | "high" | undefined;
322
354
  parent_task_id?: number | undefined;
323
355
  depth?: number | undefined;
@@ -4,8 +4,20 @@
4
4
  import { z } from "zod";
5
5
  /**
6
6
  * Task status enum
7
+ *
8
+ * ★ Task #5073 — 新增 `to_validate`(待验证)。
9
+ *
10
+ * 两阶段验收(#5007 的机制化落地):
11
+ * sub-agent 干完 → task_pre_complete → status=to_validate(待验证)
12
+ * default agent → task_complete → status=completed(正式完成)
13
+ *
14
+ * ⚠️ 其余 6 个旧状态(todo/active/completed/paused/cancelled/archived)
15
+ * **全部保留** —— 存量库有 paused/cancelled/archived 记录,
16
+ * 不做状态迁移、不删任何旧值(用户 2026-11-06 明令修正)。
17
+ * to_validate 是唯一的**新增**状态,是「非终态」(可被 task_complete
18
+ * 落成 completed,也可被 reopen 回 active)。
7
19
  */
8
- export declare const TaskStatusEnum: z.ZodEnum<["todo", "active", "completed", "paused", "cancelled", "archived"]>;
20
+ export declare const TaskStatusEnum: z.ZodEnum<["todo", "active", "to_validate", "completed", "paused", "cancelled", "archived"]>;
9
21
  export type TaskStatus = z.infer<typeof TaskStatusEnum>;
10
22
  /**
11
23
  * Task priority enum
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ export { cascadeStopSessionTree, type CascadeStopOptions, type CascadeStopResult
31
31
  export { createMemoryAgentTools, } from "./env/memory/tools/memory-agent-tools";
32
32
  export type { SearchSessionsParams, GetSessionParams, WriteMemoryParams, } from "./env/memory/tools/memory-agent-tools";
33
33
  export { getBuiltInPrompt, getBuiltInPromptNames, } from "./env/prompt/prompts-index";
34
- export { TaskComponent, SQLiteTaskStore, getDefaultTaskDbPath, } from "./env/task";
34
+ export { TaskComponent, SQLiteTaskStore, getDefaultTaskDbPath, TASK_COMPLETED_STATUS_WORD, TASK_CANCELLED_STATUS_WORD, TASK_ARCHIVED_STATUS_WORD, TASK_DELIVERABLE_RECORDED, } from "./env/task";
35
35
  export type { Task, TaskOperation, TaskStatus, TaskPriority, ActionType, CreateTaskOptions, UpdateTaskOptions, ListTasksOptions, CreateOperationOptions, ListOperationsOptions, TaskConfig, } from "./env/task/types";
36
36
  export { TaskTagPlugin, createAutoTaskPlugin, type AutoTaskPluginConfig, } from "./env/task/plugins";
37
37
  export { TaskHookPoints, type TaskHookPoint, } from "./env/task/hooks";